diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-08-23 12:22:51 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-08-23 12:22:51 +0200 |
commit | bc3604d9b226ac475a104cd8ae2ca2d1d4a27984 (patch) | |
tree | e796661f371a94a50edfdc693388bb911b253dfd /numlib | |
parent | 509016be676f7915d635fa57144d2a441e3090ca (diff) | |
parent | c0b89ac5bfb90835ef01573267020e42d4fe070c (diff) |
Merge new upstream release
Diffstat (limited to 'numlib')
-rwxr-xr-x[-rw-r--r--] | numlib/Jamfile | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/LUtest.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/License.txt | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/Readme.txt | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/aatree.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/aatree.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/afiles | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/dhsx.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/dhsx.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/dnsq.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/dnsq.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/dnsqtest.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/ludecomp.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/ludecomp.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/numlib.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/numsup.c | 70 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/numsup.h | 34 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/powell.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/powell.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/rand.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/rand.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/sobol.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/sobol.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/soboltest.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/svd.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/svd.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/svdtest.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/tdhsx.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/tpowell.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/ui.c | 10 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/ui.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/zbrent.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/zbrent.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | numlib/zbrenttest.c | 0 |
34 files changed, 76 insertions, 38 deletions
diff --git a/numlib/Jamfile b/numlib/Jamfile index 87c3c78..87c3c78 100644..100755 --- a/numlib/Jamfile +++ b/numlib/Jamfile diff --git a/numlib/LUtest.c b/numlib/LUtest.c index feb2277..feb2277 100644..100755 --- a/numlib/LUtest.c +++ b/numlib/LUtest.c diff --git a/numlib/License.txt b/numlib/License.txt index a871fcf..a871fcf 100644..100755 --- a/numlib/License.txt +++ b/numlib/License.txt diff --git a/numlib/Readme.txt b/numlib/Readme.txt index 8cc0173..8cc0173 100644..100755 --- a/numlib/Readme.txt +++ b/numlib/Readme.txt diff --git a/numlib/aatree.c b/numlib/aatree.c index 2f38b1d..2f38b1d 100644..100755 --- a/numlib/aatree.c +++ b/numlib/aatree.c diff --git a/numlib/aatree.h b/numlib/aatree.h index 4212b09..4212b09 100644..100755 --- a/numlib/aatree.h +++ b/numlib/aatree.h diff --git a/numlib/afiles b/numlib/afiles index 29d6699..29d6699 100644..100755 --- a/numlib/afiles +++ b/numlib/afiles diff --git a/numlib/dhsx.c b/numlib/dhsx.c index 180d15c..180d15c 100644..100755 --- a/numlib/dhsx.c +++ b/numlib/dhsx.c diff --git a/numlib/dhsx.h b/numlib/dhsx.h index 828b8b2..828b8b2 100644..100755 --- a/numlib/dhsx.h +++ b/numlib/dhsx.h diff --git a/numlib/dnsq.c b/numlib/dnsq.c index 75f00a8..75f00a8 100644..100755 --- a/numlib/dnsq.c +++ b/numlib/dnsq.c diff --git a/numlib/dnsq.h b/numlib/dnsq.h index e06e562..e06e562 100644..100755 --- a/numlib/dnsq.h +++ b/numlib/dnsq.h diff --git a/numlib/dnsqtest.c b/numlib/dnsqtest.c index 3f02819..3f02819 100644..100755 --- a/numlib/dnsqtest.c +++ b/numlib/dnsqtest.c diff --git a/numlib/ludecomp.c b/numlib/ludecomp.c index 72e014a..72e014a 100644..100755 --- a/numlib/ludecomp.c +++ b/numlib/ludecomp.c diff --git a/numlib/ludecomp.h b/numlib/ludecomp.h index cdb4382..cdb4382 100644..100755 --- a/numlib/ludecomp.h +++ b/numlib/ludecomp.h diff --git a/numlib/numlib.h b/numlib/numlib.h index aa34b2d..aa34b2d 100644..100755 --- a/numlib/numlib.h +++ b/numlib/numlib.h diff --git a/numlib/numsup.c b/numlib/numsup.c index bfa144b..43f6e73 100644..100755 --- a/numlib/numsup.c +++ b/numlib/numsup.c @@ -63,7 +63,7 @@ void set_exe_path(char *argv0) { g_log->tag = argv0; i = strlen(argv0); if ((exe_path = malloc(i + 5)) == NULL) { - a1loge(g_log, 1, "set_exe_path: malloc %d bytes failed",i+5); + a1loge(g_log, 1, "set_exe_path: malloc %d bytes failed\n",i+5); return; } strcpy(exe_path, argv0); @@ -80,7 +80,7 @@ void set_exe_path(char *argv0) { strcat(exe_path, ".exe"); if ((mh = GetModuleHandle(exe_path)) == NULL) { - a1loge(g_log, 1, "set_exe_path: GetModuleHandle '%s' failed with%d", + a1loge(g_log, 1, "set_exe_path: GetModuleHandle '%s' failed with%d\n", exe_path,GetLastError()); exe_path[0] = '\000'; return; @@ -91,12 +91,12 @@ void set_exe_path(char *argv0) { if (tpath != NULL) free(tpath); if ((tpath = malloc(pl)) == NULL) { - a1loge(g_log, 1, "set_exe_path: malloc %d bytes failed",pl); + a1loge(g_log, 1, "set_exe_path: malloc %d bytes failed\n",pl); exe_path[0] = '\000'; return; } if ((i = GetModuleFileName(mh, tpath, pl)) == 0) { - a1loge(g_log, 1, "set_exe_path: GetModuleFileName '%s' failed with%d", + a1loge(g_log, 1, "set_exe_path: GetModuleFileName '%s' failed with%d\n", tpath,GetLastError()); exe_path[0] = '\000'; return; @@ -135,7 +135,7 @@ void set_exe_path(char *argv0) { else ll = p - cp; if ((ll + 1 + strlen(exe_path) + 1) > PATH_MAX) { - a1loge(g_log, 1, "set_exe_path: Search path exceeds PATH_MAX"); + a1loge(g_log, 1, "set_exe_path: Search path exceeds PATH_MAX\n"); exe_path[0] = '\000'; return; } @@ -148,7 +148,7 @@ void set_exe_path(char *argv0) { found = 1; free(exe_path); if ((exe_path = malloc(strlen(b2)+1)) == NULL) { - a1loge(g_log, 1, "set_exe_path: malloc %d bytes failed",strlen(b2)+1); + a1loge(g_log, 1, "set_exe_path: malloc %d bytes failed\n",strlen(b2)+1); exe_path[0] = '\000'; return; } @@ -170,7 +170,7 @@ void set_exe_path(char *argv0) { if (exe_path[i] == '/') { char *tpath; if ((tpath = malloc(strlen(exe_path + i))) == NULL) { - a1loge(g_log, 1, "set_exe_path: malloc %d bytes failed",strlen(exe_path + i)); + a1loge(g_log, 1, "set_exe_path: malloc %d bytes failed\n",strlen(exe_path + i)); exe_path[0] = '\000'; return; } @@ -454,6 +454,34 @@ void a1logue(a1log *log) { } } +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/* Print bytes as hex to debug log */ +/* base is the base of the displayed offset */ +void adump_bytes(a1log *log, char *pfx, unsigned char *buf, int base, int len) { + int i, j, ii; + char oline[200] = { '\000' }, *bp = oline; + for (i = j = 0; i < len; i++) { + if ((i % 16) == 0) + bp += sprintf(bp,"%s%04x:",pfx,base+i); + bp += sprintf(bp," %02x",buf[i]); + if ((i+1) >= len || ((i+1) % 16) == 0) { + for (ii = i; ((ii+1) % 16) != 0; ii++) + bp += sprintf(bp," "); + bp += sprintf(bp," "); + for (; j <= i; j++) { + if (!(buf[j] & 0x80) && isprint(buf[j])) + bp += sprintf(bp,"%c",buf[j]); + else + bp += sprintf(bp,"."); + } + bp += sprintf(bp,"\n"); + a1logd(log,0,"%s",oline); + bp = oline; + } + } +} + /******************************************************************/ /* Default verbose/warning/error output routines */ /* These fall through to, and can be re-director using the */ @@ -1609,7 +1637,7 @@ unsigned int read_ORD8(ORD8 *p) { return rv; } -void write_ORD8(unsigned int d, ORD8 *p) { +void write_ORD8(ORD8 *p, unsigned int d) { if (d > 0xff) d = 0xff; p[0] = (ORD8)(d); @@ -1624,7 +1652,7 @@ int read_INR8(ORD8 *p) { return rv; } -void write_INR8(int d, ORD8 *p) { +void write_INR8(ORD8 *p, int d) { if (d > 0x7f) d = 0x7f; else if (d < -0x80) @@ -1649,14 +1677,14 @@ unsigned int read_ORD16_le(ORD8 *p) { return rv; } -void write_ORD16_be(unsigned int d, ORD8 *p) { +void write_ORD16_be(ORD8 *p, unsigned int d) { if (d > 0xffff) d = 0xffff; p[0] = (ORD8)(d >> 8); p[1] = (ORD8)(d); } -void write_ORD16_le(unsigned int d, ORD8 *p) { +void write_ORD16_le(ORD8 *p, unsigned int d) { if (d > 0xffff) d = 0xffff; p[0] = (ORD8)(d); @@ -1680,7 +1708,7 @@ int read_INR16_le(ORD8 *p) { return rv; } -void write_INR16_be(int d, ORD8 *p) { +void write_INR16_be(ORD8 *p, int d) { if (d > 0x7fff) d = 0x7fff; else if (d < -0x8000) @@ -1689,7 +1717,7 @@ void write_INR16_be(int d, ORD8 *p) { p[1] = (ORD8)(d); } -void write_INR16_le(int d, ORD8 *p) { +void write_INR16_le(ORD8 *p, int d) { if (d > 0x7fff) d = 0x7fff; else if (d < -0x8000) @@ -1719,14 +1747,14 @@ unsigned int read_ORD32_le(ORD8 *p) { return rv; } -void write_ORD32_be(unsigned int d, ORD8 *p) { +void write_ORD32_be(ORD8 *p, unsigned int d) { p[0] = (ORD8)(d >> 24); p[1] = (ORD8)(d >> 16); p[2] = (ORD8)(d >> 8); p[3] = (ORD8)(d); } -void write_ORD32_le(unsigned int d, ORD8 *p) { +void write_ORD32_le(ORD8 *p, unsigned int d) { p[0] = (ORD8)(d); p[1] = (ORD8)(d >> 8); p[2] = (ORD8)(d >> 16); @@ -1754,14 +1782,14 @@ int read_INR32_le(ORD8 *p) { return rv; } -void write_INR32_be(int d, ORD8 *p) { +void write_INR32_be(ORD8 *p, int d) { p[0] = (ORD8)(d >> 24); p[1] = (ORD8)(d >> 16); p[2] = (ORD8)(d >> 8); p[3] = (ORD8)(d); } -void write_INR32_le(int d, ORD8 *p) { +void write_INR32_le(ORD8 *p, int d) { p[0] = (ORD8)(d); p[1] = (ORD8)(d >> 8); p[2] = (ORD8)(d >> 16); @@ -1797,7 +1825,7 @@ ORD64 read_ORD64_le(ORD8 *p) { return rv; } -void write_ORD64_be(ORD64 d, ORD8 *p) { +void write_ORD64_be(ORD8 *p, ORD64 d) { p[0] = (ORD8)(d >> 56); p[1] = (ORD8)(d >> 48); p[2] = (ORD8)(d >> 40); @@ -1808,7 +1836,7 @@ void write_ORD64_be(ORD64 d, ORD8 *p) { p[7] = (ORD8)(d); } -void write_ORD64_le(ORD64 d, ORD8 *p) { +void write_ORD64_le(ORD8 *p, ORD64 d) { p[0] = (ORD8)(d); p[1] = (ORD8)(d >> 8); p[2] = (ORD8)(d >> 16); @@ -1848,7 +1876,7 @@ INR64 read_INR64_le(ORD8 *p) { return rv; } -void write_INR64_be(INR64 d, ORD8 *p) { +void write_INR64_be(ORD8 *p, INR64 d) { p[0] = (ORD8)(d >> 56); p[1] = (ORD8)(d >> 48); p[2] = (ORD8)(d >> 40); @@ -1859,7 +1887,7 @@ void write_INR64_be(INR64 d, ORD8 *p) { p[7] = (ORD8)(d); } -void write_INR64_le(INR64 d, ORD8 *p) { +void write_INR64_le(ORD8 *p, INR64 d) { p[0] = (ORD8)(d); p[1] = (ORD8)(d >> 8); p[2] = (ORD8)(d >> 16); diff --git a/numlib/numsup.h b/numlib/numsup.h index 1fb83bc..a284809 100644..100755 --- a/numlib/numsup.h +++ b/numlib/numsup.h @@ -85,8 +85,6 @@ #define PNTR UINT_PTR -#define vsnprintf _vsnprintf - #define PF64PREC "I64" /* printf format precision specifier */ #define CF64PREC "LL" /* Constant precision specifier */ @@ -310,6 +308,10 @@ void a1loge(a1log *log, int ecode, char *fmt, ...); /* This resets errc and errm */ void a1logue(a1log *log); +/* Print bytes as hex to debug log */ +/* base is the base of the displayed offset */ +void adump_bytes(a1log *log, char *pfx, unsigned char *buf, int base, int len); + /* =========================================================== */ /* Globals used to hold certain information */ extern char *exe_path; /* Path leading to executable, not including exe name itself. */ @@ -454,47 +456,47 @@ char *ctime_64(const INR64 *timer); /* Unsigned 8 bit */ unsigned int read_ORD8(ORD8 *p); -void write_ORD8(unsigned int d, ORD8 *p); +void write_ORD8(ORD8 *p, unsigned int d); /* Signed 8 bit */ int read_INR8(ORD8 *p); -void write_INR8(int d, ORD8 *p); +void write_INR8(ORD8 *p, int d); /* Unsigned 16 bit */ unsigned int read_ORD16_be(ORD8 *p); unsigned int read_ORD16_le(ORD8 *p); -void write_ORD16_be(unsigned int d, ORD8 *p); -void write_ORD16_le(unsigned int d, ORD8 *p); +void write_ORD16_be(ORD8 *p, unsigned int d); +void write_ORD16_le(ORD8 *p, unsigned int d); /* Signed 16 bit */ int read_INR16_be(ORD8 *p); int read_INR16_le(ORD8 *p); -void write_INR16_be(int d, ORD8 *p); -void write_INR16_le(int d, ORD8 *p); +void write_INR16_be(ORD8 *p, int d); +void write_INR16_le(ORD8 *p, int d); /* Unsigned 32 bit */ unsigned int read_ORD32_be(ORD8 *p); unsigned int read_ORD32_le(ORD8 *p); -void write_ORD32_be(unsigned int d, ORD8 *p); -void write_ORD32_le(unsigned int d, ORD8 *p); +void write_ORD32_be(ORD8 *p, unsigned int d); +void write_ORD32_le(ORD8 *p, unsigned int d); /* Signed 32 bit */ int read_INR32_be(ORD8 *p); int read_INR32_le(ORD8 *p); -void write_INR32_be(int d, ORD8 *p); -void write_INR32_le(int d, ORD8 *p); +void write_INR32_be(ORD8 *p, int d); +void write_INR32_le(ORD8 *p, int d); /* Unsigned 64 bit */ ORD64 read_ORD64_be(ORD8 *p); ORD64 read_ORD64_le(ORD8 *p); -void write_ORD64_be(ORD64 d, ORD8 *p); -void write_ORD64_le(ORD64 d, ORD8 *p); +void write_ORD64_be(ORD8 *p, ORD64 d); +void write_ORD64_le(ORD8 *p, ORD64 d); /* Signed 64 bit */ INR64 read_INR64_be(ORD8 *p); INR64 read_INR64_le(ORD8 *p); -void write_INR64_be(INR64 d, ORD8 *p); -void write_INR64_le(INR64 d, ORD8 *p); +void write_INR64_be(ORD8 *p, INR64 d); +void write_INR64_le(ORD8 *p, INR64 d); /*******************************************/ /* Numerical diagnostics */ diff --git a/numlib/powell.c b/numlib/powell.c index 5d2adac..5d2adac 100644..100755 --- a/numlib/powell.c +++ b/numlib/powell.c diff --git a/numlib/powell.h b/numlib/powell.h index a1db8b6..a1db8b6 100644..100755 --- a/numlib/powell.h +++ b/numlib/powell.h diff --git a/numlib/rand.c b/numlib/rand.c index 436de52..436de52 100644..100755 --- a/numlib/rand.c +++ b/numlib/rand.c diff --git a/numlib/rand.h b/numlib/rand.h index 46f79f2..46f79f2 100644..100755 --- a/numlib/rand.h +++ b/numlib/rand.h diff --git a/numlib/sobol.c b/numlib/sobol.c index 40a2c38..40a2c38 100644..100755 --- a/numlib/sobol.c +++ b/numlib/sobol.c diff --git a/numlib/sobol.h b/numlib/sobol.h index 08ac5c0..08ac5c0 100644..100755 --- a/numlib/sobol.h +++ b/numlib/sobol.h diff --git a/numlib/soboltest.c b/numlib/soboltest.c index 32c26ee..32c26ee 100644..100755 --- a/numlib/soboltest.c +++ b/numlib/soboltest.c diff --git a/numlib/svd.c b/numlib/svd.c index fdb8edd..fdb8edd 100644..100755 --- a/numlib/svd.c +++ b/numlib/svd.c diff --git a/numlib/svd.h b/numlib/svd.h index 59b080d..59b080d 100644..100755 --- a/numlib/svd.h +++ b/numlib/svd.h diff --git a/numlib/svdtest.c b/numlib/svdtest.c index 100120d..100120d 100644..100755 --- a/numlib/svdtest.c +++ b/numlib/svdtest.c diff --git a/numlib/tdhsx.c b/numlib/tdhsx.c index d1738c4..d1738c4 100644..100755 --- a/numlib/tdhsx.c +++ b/numlib/tdhsx.c diff --git a/numlib/tpowell.c b/numlib/tpowell.c index f7b0aad..f7b0aad 100644..100755 --- a/numlib/tpowell.c +++ b/numlib/tpowell.c diff --git a/numlib/ui.c b/numlib/ui.c index fefdcc2..31fd3b6 100644..100755 --- a/numlib/ui.c +++ b/numlib/ui.c @@ -119,13 +119,21 @@ int main(int argc, char ** argv) { /* Call the real main() in another thread */ int rv; + pthread_attr_t stackSzAtrbt; pthread_t thid; g_argc = argc; g_argv = argv; ui_initialized = 1; - if ((rv = pthread_create(&thid, NULL, callMain, (void *)NULL)) != 0) { + /* Default stack size is 512K - this is a bit small - raise it */ + if ((rv = pthread_attr_init(&stackSzAtrbt)) != 0 + || (rv = pthread_attr_setstacksize(&stackSzAtrbt, 4 * 1024 * 1024)) != 0) { + fprintf(stderr,"ui: thread_attr_setstacksize failed with %d\n",rv); + return -1; + } + + if ((rv = pthread_create(&thid, &stackSzAtrbt, callMain, (void *)NULL)) != 0) { fprintf(stderr,"ui: pthread_create failed with %d\n",rv); return -1; } diff --git a/numlib/ui.h b/numlib/ui.h index e1d7a58..e1d7a58 100644..100755 --- a/numlib/ui.h +++ b/numlib/ui.h diff --git a/numlib/zbrent.c b/numlib/zbrent.c index a811818..a811818 100644..100755 --- a/numlib/zbrent.c +++ b/numlib/zbrent.c diff --git a/numlib/zbrent.h b/numlib/zbrent.h index 2f8aac4..2f8aac4 100644..100755 --- a/numlib/zbrent.h +++ b/numlib/zbrent.h diff --git a/numlib/zbrenttest.c b/numlib/zbrenttest.c index d7b44d3..d7b44d3 100644..100755 --- a/numlib/zbrenttest.c +++ b/numlib/zbrenttest.c |