diff options
Diffstat (limited to 'math/rexx-regmath/files')
-rw-r--r-- | math/rexx-regmath/files/README.in | 5 | ||||
-rw-r--r-- | math/rexx-regmath/files/patch-Makefile.bsd | 12 | ||||
-rw-r--r-- | math/rexx-regmath/files/patch-rexxmath.c | 38 | ||||
-rw-r--r-- | math/rexx-regmath/files/patch-rxmath.c | 42 | ||||
-rw-r--r-- | math/rexx-regmath/files/regmath.1.in | 29 | ||||
-rw-r--r-- | math/rexx-regmath/files/testrexxmath.in | 96 | ||||
-rw-r--r-- | math/rexx-regmath/files/testrxmath.in | 123 |
7 files changed, 345 insertions, 0 deletions
diff --git a/math/rexx-regmath/files/README.in b/math/rexx-regmath/files/README.in new file mode 100644 index 000000000000..e0e6c4e92e38 --- /dev/null +++ b/math/rexx-regmath/files/README.in @@ -0,0 +1,5 @@ +These are really test program rather than examples, but they do show how the two packages are used. + +Bob Eager +August 2017 + diff --git a/math/rexx-regmath/files/patch-Makefile.bsd b/math/rexx-regmath/files/patch-Makefile.bsd new file mode 100644 index 000000000000..05e32dbde8ad --- /dev/null +++ b/math/rexx-regmath/files/patch-Makefile.bsd @@ -0,0 +1,12 @@ +--- Makefile.bsd.orig 2001-11-04 18:09:04 UTC ++++ Makefile.bsd +@@ -9,7 +9,8 @@ + POPT=-O -fomit-frame-pointer + PLFL=-s + DEBUG=-g +-CFLAGS=$(OPT) $(DEBUG) -pipe -fpic -I $$HOME/regina -pipe ++CFLAGS+=$(OPT) $(DEBUG) -pipe -fpic -I $$HOME/regina -pipe -I/usr/local/include ++CFLAGS+=-Wno-incompatible-pointer-types + LDFLAGS=-Bdynamic -Bshareable $(LFL) + LIBS=-lm + so=so diff --git a/math/rexx-regmath/files/patch-rexxmath.c b/math/rexx-regmath/files/patch-rexxmath.c new file mode 100644 index 000000000000..ed92e4c57bb7 --- /dev/null +++ b/math/rexx-regmath/files/patch-rexxmath.c @@ -0,0 +1,38 @@ +--- rexxmath.c.orig 2001-11-04 21:51:10 UTC ++++ rexxmath.c +@@ -19,7 +19,7 @@ + static double cotan(const double arg); + static double csc(const double arg); + static double sec(const double arg); +-static double round(const double arg); ++static double xround(const double arg); + + #if defined(__EMX__) || defined(_WIN32) + static double acosh(double arg); +@@ -48,7 +48,7 @@ static struct funclist { + "ln", log, /* Log base e ln(x) log x > 0.0 */ + "log", log, /* Log base e ln(x) log x > 0.0 */ + "log10", log10, /* Log base 10 log10(x) x > 0.0 */ +- "nint", round, /* nearest integer */ ++ "nint", xround, /* nearest integer */ + "sec", sec, /* secant */ + "sin", sin, /* sine */ + "sinh", sinh, /* hyperbolic sine */ +@@ -70,7 +70,7 @@ rxfunc(mathfunc1) + + checkparam(1,1); + +- afunc.name = fname; ++ afunc.name = (char *) fname; + theFunc = (struct funclist *)bsearch(&afunc, mathfuncs,DIM(mathfuncs) + , sizeof(*theFunc), findmathfunc); + +@@ -158,7 +158,7 @@ rxfunc(mathfact) + } + + /* Nearest integer to x nint(x) */ +-static double round(const double arg) ++static double xround(const double arg) + { + return floor(arg+.5); + } diff --git a/math/rexx-regmath/files/patch-rxmath.c b/math/rexx-regmath/files/patch-rxmath.c new file mode 100644 index 000000000000..fc70ad9c4fcf --- /dev/null +++ b/math/rexx-regmath/files/patch-rxmath.c @@ -0,0 +1,42 @@ +--- rxmath.c.orig 2001-11-04 22:23:42 UTC ++++ rxmath.c +@@ -116,8 +116,8 @@ static rxfunc(trigfunc1) + rxstrdup(arg, argv[0]); + + /* argument might be in degrees or grades */ +- if (argc > 2) { +- switch (argv[2].strptr[0]) { ++ if (argc > 1 && argv[1].strptr != NULL) { ++ switch (argv[1].strptr[0]) { + /* degrees -- convert to radians */ + case 'd': + case 'D': +@@ -144,7 +144,7 @@ static rxfunc(trigfunc1) + argval = atof(arg) * PI/180.; + } + +- result->strlength = setresult(result->strptr, theFunc->fnptr(argval), argc - 1, argv+1); ++ result->strlength = setresult(result->strptr, theFunc->fnptr(argval), argc - 2, argv+2); + + return 0; + +@@ -170,8 +170,8 @@ static rxfunc(trigfunc2) + res = theFunc->fnptr(atof(arg)); + + /* result could be needed in degrees or grades */ +- if (argc > 2) { +- switch (argv[2].strptr[0]) { ++ if (argc > 1 && argv[1].strptr != NULL) { ++ switch (argv[1].strptr[0]) { + /* degrees -- convert radians to degrees */ + case 'd': + case 'D': +@@ -198,7 +198,7 @@ static rxfunc(trigfunc2) + res *= 180./PI; + } + +- result->strlength = setresult(result->strptr, res, argc - 1, argv+1); ++ result->strlength = setresult(result->strptr, res, argc - 2, argv+2); + + return 0; + } diff --git a/math/rexx-regmath/files/regmath.1.in b/math/rexx-regmath/files/regmath.1.in new file mode 100644 index 000000000000..c366afa3c0a9 --- /dev/null +++ b/math/rexx-regmath/files/regmath.1.in @@ -0,0 +1,29 @@ +.Dd August 16, 2017 +.Dt REGMATH 1 CON +.Os +.Sh NAME +.Nm regmath +.Nd "Mathematics libraries for Regina REXX interpreter" +.Sh DESCRIPTION +.Nm +consists of two separate collections of utility functions for use with the Regina REXX interpreter. +These closely mirror the functions contained in the +.Em RxMath +library provided on IBM systems, and the +.Em RexxMath +library provided for use with Amiga Rexx. +As it stands, the +.Nm +collections will not work with another REXX interpreter. +.Pp +Details of usage are in the full manual, which is normally found at: +.br +.Pa %%DOCSDIR%%/regmath.pdf +(if installed). +.Sh SEE ALSO +The original author's web site at +.Em http://pages.interlog.com/~pjtm/ +.Sh AUTHORS +.An "Patrick T J McPhee" (original author) +.An "Bob Eager" Aq bob@eager.cx +(port) diff --git a/math/rexx-regmath/files/testrexxmath.in b/math/rexx-regmath/files/testrexxmath.in new file mode 100644 index 000000000000..24a13c2c595d --- /dev/null +++ b/math/rexx-regmath/files/testrexxmath.in @@ -0,0 +1,96 @@ +#!/usr/local/bin/regina + +/* + * Tests and examples for RexxMath (AMath) + * + * Bob Eager August 2017 + * + */ + +/* Load the library */ + +rc = RxFuncAdd('MathLoadFuncs','rexxmath','MathLoadFuncs') +say 'MathLoadFuncs =>' rc +call MathLoadFuncs + +say '' +say '+++ Trig functions (all in radians) +++' + +pi = 3.14159265358979323846264338327 +rad30 = 30*(pi/180) +rad45 = 45*(pi/180) +rc = Sin(rad30) +say "Sin(rad30) =>" rc '(should be about 0.5)' +rc = ASin(0.5) +say "ASin(0.5) =>" rc '(should be about' format(rad30,1,6)')' +rc = Cos(rad30) +say "Cos(rad30) =>" rc '(should be about 0.866025)' +rc = ACos(0.866025) +say "ACos(0.866025) =>" rc '(should be about' format(rad30,1,6)')' +rc = Tan(rad45) +say "Tan(rad45) =>" rc '(should be about 1)' +rc = ATan(1) +say "ATan(1) =>" rc '(should be about' format(rad45,1,6)')' +rc = ATan(1,1) +say "ATan(1,1) =>" rc '(should be about' format(rad45,1,6)')' +rc = CoT(rad30) +say "CoT(rad30) =>" rc '(should be about 1.73205)' +rc = CoTan(rad30) +say "CoTan(rad30) =>" rc '(should be about 1.73205)' +rc = CSc(rad30) +say "CSc(rad30) =>" rc '(should be about 2)' +rc = Sec(rad30) +say "Secc(rad30) =>" rc '(should be about 1.15470)' + +say '' +say '+++ Exponential functions +++' + +rc = Exp(0) +say 'Exp(0) =>' rc '(should be about 1)' +rc = Exp(1) +say 'Exp(1) =>' rc '(should be about 2.71828)' +rc = Log(1) +say 'Log(1) =>' rc '(should be about 0)' +rc = Log10(2) +say 'Log10(2) =>' rc '(should be about 0.30103)' +rc = Sqrt(2) +say 'Sqrt(2) =>' rc '(should be about 1.41421)' +rc = Pow(3,3) +say 'Pow(3,3) =>' rc '(should be about 27)' + +say '' +say '+++ Hyperbolic functions +++' + +rc = SinH(2) +say 'SinH(2) =>' rc '(should be about 3.6268604)' +rc = ASinH(3.62686) +say 'ASinH(2) =>' rc '(should be about 2)' +rc = CosH(2) +say 'CosH(2) =>' rc '(should be about 3.7621956)' +rc = ACosH(3.76219) +say 'ACosH(2) =>' rc '(should be about 2)' +rc = TanH(2) +say 'TanH(2) =>' rc '(should be about 0.9640275)' +rc = ATanH(0.96402) +say 'ATanH(2) =>' rc '(should be about 2)' + +say '' +say '+++ Numerical functions +++' + +rc = Ceil(2.4) +say 'Ceil(2.4) =>' rc '(should be 3)' +rc = Floor(2.4) +say 'Floor(2.4) =>' rc '(should be 2)' +rc = Int(2.4) +say 'Int(2.4) =>' rc '(should be 2)' +rc = NInt(2.4) +say 'NInt(2.4) =>' rc '(should be 2)' +rc = NInt(2.9) +say 'NInt(2.9) =>' rc '(should be 3)' +rc = Fact(3) +say 'Fact(3) =>' rc '(should be 6)' + +exit + +/* end */ + diff --git a/math/rexx-regmath/files/testrxmath.in b/math/rexx-regmath/files/testrxmath.in new file mode 100644 index 000000000000..fa72b244280c --- /dev/null +++ b/math/rexx-regmath/files/testrxmath.in @@ -0,0 +1,123 @@ +#!/usr/local/bin/regina + +/* + * Tests and examples for RxMath + * + * Bob Eager August 2017 + * + */ + +/* Load the library */ + +rc = RxFuncAdd('MathLoadFuncs','rxmath','MathLoadFuncs') +say 'MathLoadFuncs =>' rc +call MathLoadFuncs + +say '' +say '+++ Pi +++' + +rc = RxCalcPi() +say 'RxCalcPi =>' rc + +say '' +say '+++ Trig functions using degrees +++' + +rc = RxCalcSin(30) +say "RxCalcSin(30) =>" rc '(should be about 0.5)' +rc = RxCalcSin(30,'d') +say "RxCalcSin(30,'d' =>" rc '(should be about 0.5)' +rc = RxCalcSin(30,,6) +say "RxCalcSin(30,,6) =>" rc '(should be about 0.5)' +rc = RxCalcSin(30,'d',6) +say "RxCalcSin(30,'d',6) =>" rc '(should be about 0.5)' +rc = RxCalcArcSin(0.5,'d',6) +say "RxCalcArcSin(0.5,'d',6) =>" rc '(should be about 30)' +rc = RxCalcCos(30,'d',6) +say "RxCalcCos(30,'d',6) =>" rc '(should be about 0.866025)' +rc = RxCalcArcCos(0.866025,'d',6) +say "RxCalcArcCos(0.866025,'d',6) =>" rc '(should be about 30)' +rc = RxCalcTan(45,'d',6) +say "RxCalcTan(45,'d',6) =>" rc '(should be about 1)' +rc = RxCalcArcTan(1,'d',6) +say "RxCalcArcTan(1,'d',6) =>" rc '(should be about 45)' +rc = RxCalcCotan(30,'d',6) +say "RxCalcCoTan(30,'d',6) =>" rc '(should be about 1.73205)' + +say '' +say '+++ Trig functions using radians +++' + +pi = RxCalcPi() +rad30 = 30*(pi/180) +rad45 = 45*(pi/180) +rc = RxCalcSin(rad30,'r',6) +say "RxCalcSin(rad30,'r',6) =>" rc '(should be about 0.5)' +rc = RxCalcArcSin(0.5,'r',6) +say "RxCalcArcSin(0.5,'r',6) =>" rc '(should be about' format(rad30,1,6)')' +rc = RxCalcCos(rad30,'r',6) +say "RxCalcCos(rad30,'r',6) =>" rc '(should be about 0.866025)' +rc = RxCalcArcCos(0.866025,'r',6) +say "RxCalcArcCos(0.866025,'r',6) =>" rc '(should be about' format(rad30,1,6)')' +rc = RxCalcTan(rad45,'r',6) +say "RxCalcTan(rad45,'r',6) =>" rc '(should be about 1)' +rc = RxCalcArcTan(1,'r',6) +say "RxCalcArcTan(1,'r',6) =>" rc '(should be about' format(rad45,1,6)')' +rc = RxCalcCoTan(rad30,'r',6) +say "RxCalcCoTan(rad30,'r',6) =>" rc '(should be about 1.73205)' + +say '' +say '+++ Trig functions using gradians +++' + +pi = RxCalcPi() +grad30 = 30*(400/360) +grad45 = 45*(400/360) +rc = RxCalcSin(grad30,'g',6) +say "RxCalcSin(grad30,'g',6) =>" rc '(should be about 0.5)' +rc = RxCalcArcSin(0.5,'g',6) +say "RxCalcArcSin(0.5,'g',6) =>" rc '(should be about' format(grad30,2,6)')' +rc = RxCalcCos(grad30,'g',6) +say "RxCalcCos(grad30,'g',6) =>" rc '(should be about 0.866025)' +rc = RxCalcArcCos(0.866025,'g',6) +say "RxCalcArcCos(0.866025,'g',6) =>" rc '(should be about' format(grad30,2,6)')' +rc = RxCalcTan(grad45,'g',6) +say "RxCalcTan(grad45,'g',6) =>" rc '(should be about 1)' +rc = RxCalcArcTan(1,'g',6) +say "RxCalcArcTan(1,'g',6) =>" rc '(should be about' format(grad45,2,6)')' +rc = RxCalcCotan(grad30,'g',6) +say "RxCalcCoTan(grad30,'g',6) =>" rc '(should be about 1.73205)' + +say '' +say '+++ Exponential functions +++' + +rc = RxCalcExp(0) +say 'RxCalcExp(0) =>' rc '(should be about 1)' +rc = RxCalcExp(0,6) +say 'RxCalcExp(0,6) =>' rc '(should be about 1)' +rc = RxCalcExp(1,6) +say 'RxCalcExp(1,6) =>' rc '(should be about 2.71828)' +rc = RxCalcLog(1,6) +say 'RxCalcLog(1,6) =>' rc '(should be about 0)' +rc = RxCalcLog10(2,6) +say 'RxCalcLog10(2,6) =>' rc '(should be about 0.30103)' +rc = RxCalcSqrt(2,6) +say 'RxCalcSqrt(2,6) =>' rc '(should be about 1.41421)' +rc = RxCalcPower(3,3) +say 'RxCalcPower(3,3) =>' rc '(should be about 27)' +rc = RxCalcPower(3,3,6) +say 'RxCalcPower(3,3,6) =>' rc '(should be about 27)' + +say '' +say '+++ Hyperbolic functions +++' + +rc = RxCalcSinH(2) +say 'RxCalcSinH(2) =>' rc '(should be about 3.6268604)' +rc = RxCalcSinH(2,6) +say 'RxCalcSinH(2,6) =>' rc '(should be about 3.6268604)' +rc = RxCalcCosH(2,6) +say 'RxCalcCosH(2,6) =>' rc '(should be about 3.7621956)' +rc = RxCalcTanH(2,6) +say 'RxCalcTanH(2,6) =>' rc '(should be about 0.9640275)' + +exit + +/* end */ + |