From f9bb83066b023bb2581562dc905e25c64cee3416 Mon Sep 17 00:00:00 2001 From: SMcNeill Date: Sat, 8 Aug 2015 02:23:15 -0400 Subject: [PATCH] Added "&B" support to VAL function. Added extended math functionality into user mods. (COT, SEC, COT, and their deritives.) Cleaned up old config setting from config.txt file. --- internal/c/libqb.cpp | 16 ++++ .../c/parts/user_mods/include/steve_mods.h | 12 ++- .../user_mods/src/Steve Stuff/extramath.cpp | 51 ++++++++++ .../c/parts/user_mods/src/Steve Stuff/pi.cpp | 3 - internal/c/parts/user_mods/src/steve_mods.cpp | 2 +- source/global/IDEsettings.bas | 2 +- .../extensions/Steve Stuff-ID_Includes.bas | 94 ++++++++++++++++++- 7 files changed, 173 insertions(+), 7 deletions(-) create mode 100644 internal/c/parts/user_mods/src/Steve Stuff/extramath.cpp delete mode 100644 internal/c/parts/user_mods/src/Steve Stuff/pi.cpp diff --git a/internal/c/libqb.cpp b/internal/c/libqb.cpp index ed5d1fbf2..b8c508183 100644 --- a/internal/c/libqb.cpp +++ b/internal/c/libqb.cpp @@ -14074,6 +14074,22 @@ long double func_val(qbs *s){ }//i return hex_value; } + if ((c==66)||(c==98)){//"B"or"b" + hex_digits=0; + hex_value=0; + for (i=i+2;ilen;i++){ + c=s->chr[i]; + if ((c>47)&&(c<50)){//0-1 + c-=48; + hex_value<<=1; + hex_value|=c; + if (hex_digits||c) hex_digits++; + if (hex_digits>64){error(6); return 0;} + }else + break; + }//i + return hex_value; + } if ((c==72)||(c==104)){//"H"or"h" hex_digits=0; hex_value=0; diff --git a/internal/c/parts/user_mods/include/steve_mods.h b/internal/c/parts/user_mods/include/steve_mods.h index 4b34e20fc..e4416cc4d 100644 --- a/internal/c/parts/user_mods/include/steve_mods.h +++ b/internal/c/parts/user_mods/include/steve_mods.h @@ -13,7 +13,8 @@ double func_rad2deg(double degree); double func_rad2grad(double degree); double func_grad2deg(double degree); double func_grad2rad(double degree); -double func_pi(); + +double func_pi(double multiplier,int32 passed); int32 func_screenwidth(); int32 func_screenheight(); void sub_screenicon(); @@ -21,3 +22,12 @@ int32 func_windowexists (); int32 func__controlchr(); int32 func__str_nc_compare(qbs *s1, qbs *s2); int32 func__str_compare(qbs *s1, qbs *s2); +double func_arcsec (double num); +double func_arccsc (double num); +double func_arccot (double num); +double func_sech (double num); +double func_csch (double num); +double func_coth (double num); +double func_sec (double num); +double func_csc (double num); +double func_cot (double num); \ No newline at end of file diff --git a/internal/c/parts/user_mods/src/Steve Stuff/extramath.cpp b/internal/c/parts/user_mods/src/Steve Stuff/extramath.cpp new file mode 100644 index 000000000..d00e4559e --- /dev/null +++ b/internal/c/parts/user_mods/src/Steve Stuff/extramath.cpp @@ -0,0 +1,51 @@ +double func_pi (double multiplier,int32 passed) { + if (passed) {return 3.14159265358979323846264338327950288419716939937510582 * multiplier;} + return (3.14159265358979323846264338327950288419716939937510582); +} + +double func_arcsec (double num) { + int sign = (num > 0) - (num < 0); + if (num<-1||num>1) {error(5);return 0;} + return atan(num / sqrt(1 - num * num)) + (sign - 1) * (2 * atan(1)); +} + +double func_arccsc (double num) { + int sign = (num > 0) - (num < 0); + if (num<-1||num>1) {error(5);return 0;} + return atan(num / sqrt(1 - num * num)) + (sign - 1) * (2 * atan(1)); +} + +double func_arccot (double num) {return 2 * atan(1) - atan(num);} + +double func_sech (double num) { + if (num>88.02969) {error(5);return 0;} + if (exp(num) + exp(-num)==0) {error(5);return 0;} + return 2/ (exp(num) + exp(-num)); +} + +double func_csch (double num) { + if (num>88.02969) {error(5);return 0;} + if (exp(num) - exp(-num)==0) {error(5);return 0;} + return 2/ (exp(num) - exp(-num)); +} + +double func_coth (double num) { + if (num>44.014845) {error(5);return 0;} + if (2 * exp(num) - 1==0) {error(5);return 0;} + return 2 * exp(num) - 1; +} + +double func_sec (double num) { + if (cos(num)==0) {error(5);return 0;} + return 1/cos(num); +} + +double func_csc (double num) { + if (sin(num)==0) {error(5);return 0;} + return 1/sin(num); +} + +double func_cot (double num) { + if (tan(num)==0) {error(5);return 0;} + return 1/tan(num); +} \ No newline at end of file diff --git a/internal/c/parts/user_mods/src/Steve Stuff/pi.cpp b/internal/c/parts/user_mods/src/Steve Stuff/pi.cpp deleted file mode 100644 index 6814e7e02..000000000 --- a/internal/c/parts/user_mods/src/Steve Stuff/pi.cpp +++ /dev/null @@ -1,3 +0,0 @@ -double func_pi () { - return (3.14159265358979323846264338327950288419716939937510582); -} \ No newline at end of file diff --git a/internal/c/parts/user_mods/src/steve_mods.cpp b/internal/c/parts/user_mods/src/steve_mods.cpp index 56574e966..aa8b13c37 100644 --- a/internal/c/parts/user_mods/src/steve_mods.cpp +++ b/internal/c/parts/user_mods/src/steve_mods.cpp @@ -2,6 +2,6 @@ #include "steve_mods.h" #include "Steve Stuff/convert_angle.cpp" -#include "Steve Stuff/pi.cpp" +#include "Steve Stuff/extramath.cpp" #include "Steve Stuff/screeninfo.cpp" #include "Steve Stuff/stringcomp.cpp" diff --git a/source/global/IDEsettings.bas b/source/global/IDEsettings.bas index f6c211e08..ea1ef2457 100644 --- a/source/global/IDEsettings.bas +++ b/source/global/IDEsettings.bas @@ -272,7 +272,7 @@ IF LoadedIDESettings = 0 THEN WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFont$", "c:\windows\fonts\lucon.ttf" WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFont", "FALSE" WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CodePage", "0" - WriteConfigSetting "'[MOUSE SETTINGS]", "Mouse_Orentation$", "RIGHT" + WriteConfigSetting "'[MOUSE SETTINGS]", "SwapMouseButton", "FALSE" ELSE 'use the main config file as the default values and just copy it over to the new file f = FREEFILE diff --git a/source/subs_functions/extensions/Steve Stuff-ID_Includes.bas b/source/subs_functions/extensions/Steve Stuff-ID_Includes.bas index 8759c4aa0..8f4f90975 100644 --- a/source/subs_functions/extensions/Steve Stuff-ID_Includes.bas +++ b/source/subs_functions/extensions/Steve Stuff-ID_Includes.bas @@ -161,8 +161,10 @@ clearid id.n = "_PI" id.subfunc = 1 id.callname = "func_pi" -id.args = 0 +id.args = 1 +id.arg = MKL$(DOUBLETYPE - ISPOINTER) id.ret = DOUBLETYPE - ISPOINTER +id.specialformat = "[?]" id.Dependency = DEPENDENCY_USER_MODS regid @@ -227,3 +229,93 @@ id.ret = LONGTYPE - ISPOINTER id.Dependency = DEPENDENCY_USER_MODS regid +clearid +id.n = "_ARCSEC" +id.subfunc = 1 +id.callname = "func_arcsec" +id.args = 1 +id.arg = MKL$(FLOATTYPE - ISPOINTER) +id.ret = FLOATTYPE - ISPOINTER +id.Dependency = DEPENDENCY_USER_MODS +regid + +clearid +id.n = "_ARCCSC" +id.subfunc = 1 +id.callname = "func_arccsc" +id.args = 1 +id.arg = MKL$(FLOATTYPE - ISPOINTER) +id.ret = FLOATTYPE - ISPOINTER +id.Dependency = DEPENDENCY_USER_MODS +regid + +clearid +id.n = "_ARCCOT" +id.subfunc = 1 +id.callname = "func_arccot" +id.args = 1 +id.arg = MKL$(FLOATTYPE - ISPOINTER) +id.ret = FLOATTYPE - ISPOINTER +id.Dependency = DEPENDENCY_USER_MODS +regid + +clearid +id.n = "_SECH" +id.subfunc = 1 +id.callname = "func_sech" +id.args = 1 +id.arg = MKL$(FLOATTYPE - ISPOINTER) +id.ret = FLOATTYPE - ISPOINTER +id.Dependency = DEPENDENCY_USER_MODS +regid + +clearid +id.n = "_CSCH" +id.subfunc = 1 +id.callname = "func_csch" +id.args = 1 +id.arg = MKL$(FLOATTYPE - ISPOINTER) +id.ret = FLOATTYPE - ISPOINTER +id.Dependency = DEPENDENCY_USER_MODS +regid + +clearid +id.n = "_COTH" +id.subfunc = 1 +id.callname = "func_coth" +id.args = 1 +id.arg = MKL$(FLOATTYPE - ISPOINTER) +id.ret = FLOATTYPE - ISPOINTER +id.Dependency = DEPENDENCY_USER_MODS +regid + +clearid +id.n = "_SEC" +id.subfunc = 1 +id.callname = "func_sec" +id.args = 1 +id.arg = MKL$(FLOATTYPE - ISPOINTER) +id.ret = FLOATTYPE - ISPOINTER +id.Dependency = DEPENDENCY_USER_MODS +regid + +clearid +id.n = "_CSC" +id.subfunc = 1 +id.callname = "func_csc" +id.args = 1 +id.arg = MKL$(FLOATTYPE - ISPOINTER) +id.ret = FLOATTYPE - ISPOINTER +id.Dependency = DEPENDENCY_USER_MODS +regid + +clearid +id.n = "_COT" +id.subfunc = 1 +id.callname = "func_cot" +id.args = 1 +id.arg = MKL$(FLOATTYPE - ISPOINTER) +id.ret = FLOATTYPE - ISPOINTER +id.Dependency = DEPENDENCY_USER_MODS +regid +