diff --git a/build/make.linux64.lib.py b/build/make.linux64.lib.py index 3023958..2e9bb79 100644 --- a/build/make.linux64.lib.py +++ b/build/make.linux64.lib.py @@ -14,7 +14,7 @@ depdir = "./dependencies/linux64" #local pre-compiled dependency libraries and t installdir = "../../linux64" #directory to install to when finished builddir = "./build_linux64" -doinstall = False #copies the build_output to the install dir when finished +doinstall = True #copies the build_output to the install dir when finished cc = "g++" #compiler cflags = "-fPIC" libraries = "-l{}".format(libname) diff --git a/build/make.linux64.test.py b/build/make.linux64.test.py index 00ad1e8..1c91f45 100644 --- a/build/make.linux64.test.py +++ b/build/make.linux64.test.py @@ -14,7 +14,7 @@ depdir = "./dependencies/linux64" #local pre-compiled dependency libraries and t installdir = "../../linux64" #directory to install to when finished builddir = "./build_linux64" -doinstall = False #copies the build_output to the install dir when finished +doinstall = True #copies the build_output to the install dir when finished cc = "g++" #compiler cflags = "-fPIC" libraries = "-l{}".format(libname) diff --git a/build/make.mingw64.lib.py b/build/make.mingw64.lib.py index 7f87aaf..527659f 100644 --- a/build/make.mingw64.lib.py +++ b/build/make.mingw64.lib.py @@ -14,7 +14,7 @@ depdir = "./dependencies/winx64" #local pre-compiled dependency libraries and th installdir = "../../winx64" #directory to install to when finished builddir = "./build_mingw64" -doinstall = False #copies the build_output to the install dir when finished +doinstall = True #copies the build_output to the install dir when finished cc = "x86_64-w64-mingw32-g++" #compiler cflags = "-fPIC -O3" libraries = "-l{}".format(libname) diff --git a/build/make.mingw64.test.py b/build/make.mingw64.test.py index ffab1e8..d1c484e 100644 --- a/build/make.mingw64.test.py +++ b/build/make.mingw64.test.py @@ -14,7 +14,7 @@ depdir = "./dependencies/winx64" #local pre-compiled dependency libraries and th installdir = "../../winx64" #directory to install to when finished builddir = "./build_mingw64" -doinstall = False #copies the build_output to the install dir when finished +doinstall = True #copies the build_output to the install dir when finished cc = "x86_64-w64-mingw32-g++" #compiler cflags = "-fPIC -O3" libraries = "-l{}".format(libname) diff --git a/build/make.msvc64.lib.py b/build/make.msvc64.lib.py index 3444204..ffdd27f 100644 --- a/build/make.msvc64.lib.py +++ b/build/make.msvc64.lib.py @@ -14,7 +14,7 @@ depdir = "./dependencies/winx64" #local pre-compiled dependency libraries and th installdir = "../../winx64" #directory to install to when finished builddir = "./build_msvc64" -doinstall = False #copies the build_output to the install dir when finished +doinstall = True #copies the build_output to the install dir when finished cc = "cl" #compiler cflags = "/O2" libraries = "lib{}.lib".format(libname) diff --git a/build/make.msvc64.test.py b/build/make.msvc64.test.py index 605e698..56a53f6 100644 --- a/build/make.msvc64.test.py +++ b/build/make.msvc64.test.py @@ -14,7 +14,7 @@ depdir = "./dependencies/winx64" #local pre-compiled dependency libraries and th installdir = "../../winx64" #directory to install to when finished builddir = "./build_msvc64" -doinstall = False #copies the build_output to the install dir when finished +doinstall = True #copies the build_output to the install dir when finished cc = "cl" #compiler cflags = "/O2" libraries = "lib{}.lib".format(libname) diff --git a/build_linux64/libamsstring4.linux64.a b/build_linux64/libamsstring4.linux64.a index 259b44d..39fa8e7 100644 Binary files a/build_linux64/libamsstring4.linux64.a and b/build_linux64/libamsstring4.linux64.a differ diff --git a/build_linux64/objstore/amsstring4_class.o b/build_linux64/objstore/amsstring4_class.o index 22467d1..b0a9604 100644 Binary files a/build_linux64/objstore/amsstring4_class.o and b/build_linux64/objstore/amsstring4_class.o differ diff --git a/build_linux64/objstore/amsstring4_portability.o b/build_linux64/objstore/amsstring4_portability.o index b047824..1b8c2ce 100644 Binary files a/build_linux64/objstore/amsstring4_portability.o and b/build_linux64/objstore/amsstring4_portability.o differ diff --git a/build_linux64/tests b/build_linux64/tests index 68fc482..8318d7b 100644 Binary files a/build_linux64/tests and b/build_linux64/tests differ diff --git a/build_mingw64/libamsstring4.mingw64.a b/build_mingw64/libamsstring4.mingw64.a new file mode 100644 index 0000000..0a11903 Binary files /dev/null and b/build_mingw64/libamsstring4.mingw64.a differ diff --git a/build_mingw64/objstore/amsstring4_bintextencoding.o b/build_mingw64/objstore/amsstring4_bintextencoding.o new file mode 100644 index 0000000..dcd3668 Binary files /dev/null and b/build_mingw64/objstore/amsstring4_bintextencoding.o differ diff --git a/build_mingw64/objstore/amsstring4_class.o b/build_mingw64/objstore/amsstring4_class.o new file mode 100644 index 0000000..b075bcc Binary files /dev/null and b/build_mingw64/objstore/amsstring4_class.o differ diff --git a/build_mingw64/objstore/amsstring4_portability.o b/build_mingw64/objstore/amsstring4_portability.o new file mode 100644 index 0000000..391322e Binary files /dev/null and b/build_mingw64/objstore/amsstring4_portability.o differ diff --git a/build_mingw64/objstore/amsstring4_template.o b/build_mingw64/objstore/amsstring4_template.o new file mode 100644 index 0000000..b8a067a Binary files /dev/null and b/build_mingw64/objstore/amsstring4_template.o differ diff --git a/build_mingw64/objstore/amsstring4_tests1.o b/build_mingw64/objstore/amsstring4_tests1.o new file mode 100644 index 0000000..260e76b Binary files /dev/null and b/build_mingw64/objstore/amsstring4_tests1.o differ diff --git a/build_mingw64/objstore/amsstring4_unicode.o b/build_mingw64/objstore/amsstring4_unicode.o new file mode 100644 index 0000000..2183de2 Binary files /dev/null and b/build_mingw64/objstore/amsstring4_unicode.o differ diff --git a/build_mingw64/tests.exe b/build_mingw64/tests.exe new file mode 100644 index 0000000..5227de9 Binary files /dev/null and b/build_mingw64/tests.exe differ diff --git a/ref/testrewrite.scad b/ref/testrewrite.scad index c9636fc..a3ef7d8 100644 --- a/ref/testrewrite.scad +++ b/ref/testrewrite.scad @@ -1,28 +1,28 @@ - -use - - -module acmehexbolt_0p375(L) -{ - -Lh = 0.25; -Dh = 0.75; -Dth = 0.375; -Lth = L-Lh-0.125; - -union() -{ - translate([0,0,0]) - { - cylinder(d=Dh,h=Lh,$fn=6); - } - translate([0,0,Lh-0.125]) - { - thread_10tpi(Dth,Lth); - } -} - -} - - + +use + + +module acmehexbolt_0p375(L) +{ + +Lh = 0.25; +Dh = 0.75; +Dth = 0.375; +Lth = L-Lh-0.125; + +union() +{ + translate([0,0,0]) + { + cylinder(d=Dh,h=Lh,$fn=6); + } + translate([0,0,Lh-0.125]) + { + thread_10tpi(Dth,Lth); + } +} + +} + + acmehexbolt_0p375(4); \ No newline at end of file diff --git a/src/amsstring4/amsstring4_class.cpp b/src/amsstring4/amsstring4_class.cpp index fdb1c05..7b4e311 100644 --- a/src/amsstring4/amsstring4_class.cpp +++ b/src/amsstring4/amsstring4_class.cpp @@ -141,6 +141,7 @@ namespace ams if(newcstring==NULL) { ret = amsstring_failure; + printf("debug: amsstring::resize() - failed to allocate.\n"); return ret; } @@ -151,7 +152,7 @@ namespace ams newcstring[I] = cstring[I]; } } - for(I=length;I<_newlen+1;I++) + for(I=length;I<(_newlen+1);I++) { newcstring[I] = (ams_chartype) '\0'; } @@ -242,6 +243,9 @@ namespace ams if(this!=&other) { + if(this->cstring!=NULL) {delete[] this->cstring; this->cstring=NULL;} + this->length = 0; + this->length = other.length; this->blank = other.blank; this->cstring = other.cstring; diff --git a/src/amsstring4/amsstring4_portability.cpp b/src/amsstring4/amsstring4_portability.cpp index aa00a94..d19a58d 100644 --- a/src/amsstring4/amsstring4_portability.cpp +++ b/src/amsstring4/amsstring4_portability.cpp @@ -122,11 +122,24 @@ int amssprintf_s(char *s, int n, const char *format, ...) int ret = 0; va_list args; + + if(s==NULL) {ret = -1; return ret;} + if(format==NULL) + { + ret = -2; + if(s!=NULL && n>0) + { + s[0] = '\0'; + } + return ret; + } + + va_start(args, format); //exampleV(b, args); //va_arg(val,datatype) - if(s!=NULL) - { + // if(s!=NULL) + // { #if defined(LINUX) || defined(linux) || defined(__linux__) || defined(__GNUC__) //use snprintf ret = (int)vsnprintf(s,n,format,args); @@ -138,7 +151,7 @@ int amssprintf_s(char *s, int n, const char *format, ...) #else #pragma message("amssprintf_s: Unsupported architecture - neither linux nor mingw64 nor msvc") #endif - } + //} va_end(args); return ret; @@ -151,6 +164,9 @@ double amsstrtonum(const char *str) { int q; double ret = std::numeric_limits::quiet_NaN(); + + if(str==NULL) return ret; + try { //sscanf(s.cstring,"%lf",&ret);