Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.sconf_temp/
.sconsign.dblite
config.log
.test/
build/
.vscode/
.vs/
Source/zstd-orig/
33 changes: 33 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ APPLICABLE LICENSES

* The LZMA compression module for NSIS is licensed under the Common Public License version 1.0.

* The Zstandard compression module for NSIS is licensed under the Zstandard BSD license.

ZLIB/LIBPNG LICENSE
-------------------

Expand Down Expand Up @@ -142,3 +144,34 @@ SPECIAL EXCEPTION FOR LZMA COMPRESSION MODULE
---------------------------------------------

Igor Pavlov and Amir Szekely, the authors of the LZMA compression module for NSIS, expressly permit you to statically or dynamically link your code (or bind by name) to the files from the LZMA compression module for NSIS without subjecting your linked code to the terms of the Common Public license version 1.0. Any modifications or additions to files from the LZMA compression module for NSIS, however, are subject to the terms of the Common Public License version 1.0.


BSD LICENSE FOR ZSTANDARD SOFTWARE
-------------

Copyright (c) 2016-present, Facebook, Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name Facebook nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 changes: 12 additions & 0 deletions Contrib/Makensisw/makensisw.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ typedef enum {
COMPRESSOR_ZLIB_SOLID,
COMPRESSOR_BZIP2,
COMPRESSOR_BZIP2_SOLID,
COMPRESSOR_ZSTD,
COMPRESSOR_ZSTD_SOLID,
COMPRESSOR_LZMA,
COMPRESSOR_LZMA_SOLID,
COMPRESSOR_BEST,
Expand All @@ -142,6 +144,8 @@ const TCHAR *compressor_names[] = {_T(""),
_T("/SOLID zlib"),
_T("bzip2"),
_T("/SOLID bzip2"),
_T("zstd"),
_T("/SOLID zstd"),
_T("lzma"),
_T("/SOLID lzma"),
_T("Best")};
Expand All @@ -150,6 +154,8 @@ const TCHAR *compressor_display_names[] = {_T("Defined in Script/Compiler Defaul
_T("ZLIB (solid)"),
_T("BZIP2"),
_T("BZIP2 (solid)"),
_T("ZSTD"),
_T("ZSTD (solid)"),
_T("LZMA"),
_T("LZMA (solid)"),
_T("Best Compressor")};
Expand All @@ -158,6 +164,8 @@ const WORD compressor_commands[] = {IDM_COMPRESSOR_SCRIPT,
IDM_ZLIB_SOLID,
IDM_BZIP2,
IDM_BZIP2_SOLID,
IDM_ZSTD,
IDM_ZSTD_SOLID,
IDM_LZMA,
IDM_LZMA_SOLID,
IDM_BEST};
Expand All @@ -169,6 +177,8 @@ int compressor_bitmaps[] = {IDB_COMPRESSOR_SCRIPT,
IDB_COMPRESSOR_ZLIB,
IDB_COMPRESSOR_BZIP2,
IDB_COMPRESSOR_BZIP2,
IDB_COMPRESSOR_ZSTD,
IDB_COMPRESSOR_ZSTD,
IDB_COMPRESSOR_LZMA,
IDB_COMPRESSOR_LZMA,
IDB_COMPRESSOR_BEST};
Expand All @@ -177,6 +187,8 @@ int compressor_strings[] = {IDS_SCRIPT,
IDS_ZLIB_SOLID,
IDS_BZIP2,
IDS_BZIP2_SOLID,
IDS_ZSTD,
IDS_ZSTD_SOLID,
IDS_LZMA,
IDS_LZMA_SOLID,
IDS_BEST};
Expand Down
6 changes: 5 additions & 1 deletion Contrib/Makensisw/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#define IDS_BEST 24
#define IDS_LZMA 25
#define IDS_LZMA_SOLID 26
#define IDS_ZSTD 27
#define IDS_ZSTD_SOLID 28
#define DLG_MAIN 101
#define IDI_ICON 102
#define DLG_ABOUT 103
Expand Down Expand Up @@ -134,14 +136,16 @@
#define IDM_ZOOM_DEC 543
#define IDM_ZOOM_RST 544
#define IDM_ARP 545
#define IDM_ZSTD 546
#define IDM_ZSTD_SOLID 547


// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 138
#define _APS_NEXT_COMMAND_VALUE 545
#define _APS_NEXT_COMMAND_VALUE 548
#define _APS_NEXT_CONTROL_VALUE 241
#define _APS_NEXT_SYMED_VALUE 101
#endif
Expand Down
4 changes: 4 additions & 0 deletions Contrib/Makensisw/resource.rc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ BEGIN
MENUITEM "ZLIB (solid)", IDM_ZLIB_SOLID
MENUITEM "BZI&P2", IDM_BZIP2
MENUITEM "BZIP2 (solid)", IDM_BZIP2_SOLID
MENUITEM "Z&STD", IDM_ZSTD
MENUITEM "ZSTD (solid)", IDM_ZSTD_SOLID
MENUITEM "&LZMA", IDM_LZMA
MENUITEM "LZMA (solid)", IDM_LZMA_SOLID
MENUITEM "&Best Compressor", IDM_BEST
Expand Down Expand Up @@ -395,6 +397,8 @@ BEGIN
IDS_BZIP2_SOLID "BZIP2 (solid)"
IDS_RECOMPILE_TEST "Recompile and Test"
IDS_BEST "Best Compressor"
IDS_ZSTD "ZSTD"
IDS_ZSTD_SOLID "ZSTD (solid)"
IDS_LZMA "LZMA"
IDS_LZMA_SOLID "LZMA (solid)"
END
Expand Down
1 change: 1 addition & 0 deletions Contrib/Makensisw/toolbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#define IDB_COMPRESSOR_ZLIB 11
#define IDB_COMPRESSOR_BEST 12
#define IDB_COMPRESSOR_LZMA 13
#define IDB_COMPRESSOR_ZSTD 11
#define IMAGECOUNT 14
#define IDB_COMPRESSOR IDB_COMPRESSOR_SCRIPT

Expand Down
26 changes: 25 additions & 1 deletion Contrib/Math/Math.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,28 @@ to perform flow controlled declaration.
SUCH IS NOT POSSIBLE: "#[a<0, #func()(1), #func()(2)]"
IT WILL SIMPLY DEFINE #func as (2), as the latest variant.

(c) Nik Medved (brainsucker)
(c) Nik Medved (brainsucker)



XPRINTF LIBRARY
Copyright (C) 2021, ChaN, all right reserved.

xprintf module is an open source software. Redistribution and use of
xprintf module in source and binary forms, with or without modification,
are permitted provided that the following condition is met:
1. Redistributions of source code must retain the above copyright notice,
this condition and the following disclaimer.
This software is provided by the copyright holder and contributors "AS IS"
and any warranties related to this software are DISCLAIMED.
The copyright owner or contributors be NOT LIABLE for any damages caused
by use of this software.



MATH LIBRARY:
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.

Developed at SunSoft, a Sun Microsystems, Inc. business.
Permission to use, copy, modify, and distribute this
software is freely granted, provided that this notice is preserved.
44 changes: 43 additions & 1 deletion Contrib/Math/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,44 @@ files = Split("""
Source/Math.c
Source/MyMath.c
Source/plugin.c
Source/xprintf.c
""")

libm_files = Split("""
Source/mathlib/e_acos.c
Source/mathlib/e_atan2.c
Source/mathlib/e_asin.c
Source/mathlib/e_cosh.c
Source/mathlib/e_exp.c
Source/mathlib/e_fmod.c
Source/mathlib/e_log.c
Source/mathlib/e_log10.c
Source/mathlib/e_pow.c
Source/mathlib/e_rem_pio2.c
Source/mathlib/e_scalb.c
Source/mathlib/e_sinh.c
Source/mathlib/e_sqrt.c
Source/mathlib/isinf.c
Source/mathlib/k_cos.c
Source/mathlib/k_rem_pio2.c
Source/mathlib/k_sin.c
Source/mathlib/k_tan.c
Source/mathlib/s_atan.c
Source/mathlib/s_ceil.c
Source/mathlib/s_copysign.c
Source/mathlib/s_cos.c
Source/mathlib/s_expm1.c
Source/mathlib/s_fabs.c
Source/mathlib/s_finite.c
Source/mathlib/s_floor.c
Source/mathlib/s_frexp.c
Source/mathlib/s_isnan.c
Source/mathlib/s_modf.c
Source/mathlib/s_rint.c
Source/mathlib/s_scalbn.c
Source/mathlib/s_sin.c
Source/mathlib/s_tan.c
Source/mathlib/s_tanh.c
""")

libs = Split("""
Expand All @@ -22,6 +60,10 @@ docs = Split("""
Math.txt
""")

defines = ['__BIG_ENDIAN=4321', '__LITTLE_ENDIAN=1234', '__BYTE_ORDER=1234', 'lint=1']

Import('BuildPlugin env')

BuildPlugin(target, files, libs, examples, docs, nodeflib = False, flags = ['$CPP_FLAG'], entry = None)
files += libm_files

BuildPlugin(target, files, libs, examples, docs, nodeflib = False, flags = ['$CPP_FLAG'], defines = defines)
37 changes: 35 additions & 2 deletions Contrib/Math/Source/Math.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <nsis/pluginapi.h> // nsis plugin
#include "MyMath.h"
#include "Math.h"
#include "mathlib/math.h"

extern "C" int _fltused;

Expand Down Expand Up @@ -1525,7 +1526,20 @@ void __declspec(dllexport) Script(HWND hwndParent, int string_size,
}

double _infinity;
extern "C" void _fpreset();

void FpuReset()
{
#if defined(_M_ARM ) || defined(__arm__)
//TODO
#else
#if defined(_MSC_VER)
__asm { finit }
#else
asm("finit");
#endif
#endif
}


void CleanAll(int init)
{
Expand All @@ -1534,7 +1548,7 @@ void CleanAll(int init)
unsigned char _infinity_base[8] = {0, 0, 0, 0, 0, 0, 0xf0, 0x7f};
_fltused = 0;
_infinity = *((double*)(_infinity_base));
_fpreset();
FpuReset();

stack = NULL;
UserVarsCount = 0;
Expand Down Expand Up @@ -1564,3 +1578,22 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID
return TRUE;
}

//TODO: use NSISdl/util.cpp?
void *memset(void *mem, int c, size_t len)
{
/*
** Prevent MSVC 14.00.40310.41-AMD64 from generating a recursive call to memset
**
** #pragma optimize("", off) + #pragma optimize("ty", on) can also
** be used but it generates a lot more code.
*/
#if defined(_MSC_VER) && _MSC_VER > 1200 && _MSC_FULL_VER <= 140040310
volatile
#endif
char *p=(char*)mem;
while (len-- > 0)
{
*p++=c;
}
return mem;
}
22 changes: 15 additions & 7 deletions Contrib/Math/Source/MyMath.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Unicode support by Jim Park -- 08/22/2007

#include <windows.h>
#include <stdio.h>
#include "MyMath.h"
#include "Math.h"
#include "xprintf.h"

// Converts String to Int (Dec, Hex) or Float value
void StringToItem(TCHAR *&s, ExpressionItem *item, int options)
Expand Down Expand Up @@ -203,7 +203,7 @@ void itoa64(__int64 i, TCHAR *buffer)

void FloatFormat(TCHAR *s, double value, int options)
{
TCHAR format[128];
char format[32];
int prec = options & 0xF;

*s = 0;
Expand All @@ -219,22 +219,30 @@ void FloatFormat(TCHAR *s, double value, int options)

if (options & FF_NOEXP)
{
_stprintf(format, _T("%%.%df"), prec);
xsprintf(format, "%%.%df", prec);
}
else if (options & FF_EXP)
{
_stprintf(format, _T("%%.%de"), prec);
xsprintf(format, "%%.%de", prec);
}
else if (options & FF_LEXP)
{
_stprintf(format, _T("%%.%dE"), prec);
xsprintf(format, "%%.%dE", prec);
}
else
{
_stprintf(format, _T("%%.%dg"), prec);
xsprintf(format, "%%.%dg", prec);
}

_stprintf(s, format, value);
#ifdef UNICODE
char buffer[128];
xsprintf(buffer, format, value);
int cnt = strlen(buffer);
for (int n = 0; n < cnt; n++) s[n] = buffer[n];
s[cnt] = 0;
#else
xsprintf(s, format, value);
#endif
}

int lstrcmpn(TCHAR *s1, const TCHAR *s2, int chars)
Expand Down
2 changes: 1 addition & 1 deletion Contrib/Math/Source/MyMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#pragma once

#include <math.h>
#include "mathlib/math.h"
#include <float.h>
#include <nsis/nsis_tchar.h>

Expand Down
Loading