Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Oct 2017 00:37:32 +0000 (UTC)
From:      Larry Rosenman <ler@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r451939 - in head/math/rexx-regmath: . files
Message-ID:  <201710130037.v9D0bWwX083233@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ler
Date: Fri Oct 13 00:37:31 2017
New Revision: 451939
URL: https://svnweb.freebsd.org/changeset/ports/451939

Log:
  New port: math/rexx-regmath
  
  regmath contains two different implementations of math libraries for the REXX language.
  
  PR:		221573
  Submitted by:	bob@eager.cx

Added:
  head/math/rexx-regmath/
  head/math/rexx-regmath/Makefile   (contents, props changed)
  head/math/rexx-regmath/distinfo   (contents, props changed)
  head/math/rexx-regmath/files/
  head/math/rexx-regmath/files/README.in   (contents, props changed)
  head/math/rexx-regmath/files/patch-Makefile.bsd   (contents, props changed)
  head/math/rexx-regmath/files/patch-rexxmath.c   (contents, props changed)
  head/math/rexx-regmath/files/patch-rxmath.c   (contents, props changed)
  head/math/rexx-regmath/files/regmath.1.in   (contents, props changed)
  head/math/rexx-regmath/files/testrexxmath.in   (contents, props changed)
  head/math/rexx-regmath/files/testrxmath.in   (contents, props changed)
  head/math/rexx-regmath/pkg-descr   (contents, props changed)

Added: head/math/rexx-regmath/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/rexx-regmath/Makefile	Fri Oct 13 00:37:31 2017	(r451939)
@@ -0,0 +1,51 @@
+# Created by: Bob Eager <bob@eager.cx>
+# $FreeBSD$
+
+PORTNAME=	regmath
+PORTVERSION=	1.00
+CATEGORIES=	math
+MASTER_SITES=	http://home.interlog.com/~ptjm/ \
+		http://www.ancientgeek.org.uk/distfiles/
+PKGNAMEPREFIX=	rexx-
+DISTNAME=	regmath${PORTVERSION:S/.//}
+
+MAINTAINER=	bob@eager.cx
+COMMENT=	Two mathematics libraries for Rexx
+
+LICENSE=	MPL10
+
+BUILD_DEPENDS=	${LOCALBASE}/include/rexxsaa.h:lang/rexx-regina
+
+USES=		zip
+
+CFLAGS+=	-Wno-incompatible-pointer-types
+
+WRKSRC=		${WRKDIR}/math
+USE_LDCONFIG=	yes
+MAKEFILE=	Makefile.bsd
+
+PLIST_FILES=	lib/librexxmath.so lib/librxmath.so man/man1/regmath.1.gz
+
+SUB_FILES=	regmath.1 README testrxmath testrexxmath
+
+PORTDOCS=	regmath.pdf
+PORTEXAMPLES=	README testrxmath testrexxmath
+
+OPTIONS_DEFINE=	DOCS EXAMPLES
+
+do-install:
+		${INSTALL_LIB} ${WRKSRC}/librexxmath.so ${STAGEDIR}${PREFIX}/lib/
+		${INSTALL_LIB} ${WRKSRC}/librxmath.so ${STAGEDIR}${PREFIX}/lib/
+		${INSTALL_MAN} ${WRKDIR}/regmath.1 ${STAGEDIR}${PREFIX}/man/man1/
+
+do-install-DOCS-on:
+		@${MKDIR} ${STAGEDIR}${DOCSDIR}
+		${INSTALL_DATA} ${WRKSRC}/regmath.pdf ${STAGEDIR}${DOCSDIR}/
+
+do-install-EXAMPLES-on:
+		@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
+		${INSTALL_DATA} ${WRKDIR}/README ${STAGEDIR}${EXAMPLESDIR}/
+		${INSTALL_DATA} ${WRKDIR}/testrxmath ${STAGEDIR}${EXAMPLESDIR}/
+		${INSTALL_DATA} ${WRKDIR}/testrexxmath ${STAGEDIR}${EXAMPLESDIR}/
+
+.include <bsd.port.mk>

Added: head/math/rexx-regmath/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/rexx-regmath/distinfo	Fri Oct 13 00:37:31 2017	(r451939)
@@ -0,0 +1,3 @@
+TIMESTAMP = 1502836277
+SHA256 (regmath100.zip) = 2de0c43f4c0979bd237c6085406eb817347b6e3534f5f51daff5d83aef0afe8d
+SIZE (regmath100.zip) = 90463

Added: head/math/rexx-regmath/files/README.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/rexx-regmath/files/README.in	Fri Oct 13 00:37:31 2017	(r451939)
@@ -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
+

Added: head/math/rexx-regmath/files/patch-Makefile.bsd
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/rexx-regmath/files/patch-Makefile.bsd	Fri Oct 13 00:37:31 2017	(r451939)
@@ -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

Added: head/math/rexx-regmath/files/patch-rexxmath.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/rexx-regmath/files/patch-rexxmath.c	Fri Oct 13 00:37:31 2017	(r451939)
@@ -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);
+ }

Added: head/math/rexx-regmath/files/patch-rxmath.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/rexx-regmath/files/patch-rxmath.c	Fri Oct 13 00:37:31 2017	(r451939)
@@ -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;
+ }

Added: head/math/rexx-regmath/files/regmath.1.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/rexx-regmath/files/regmath.1.in	Fri Oct 13 00:37:31 2017	(r451939)
@@ -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)

Added: head/math/rexx-regmath/files/testrexxmath.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/rexx-regmath/files/testrexxmath.in	Fri Oct 13 00:37:31 2017	(r451939)
@@ -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 */
+

Added: head/math/rexx-regmath/files/testrxmath.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/rexx-regmath/files/testrxmath.in	Fri Oct 13 00:37:31 2017	(r451939)
@@ -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 */
+

Added: head/math/rexx-regmath/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/rexx-regmath/pkg-descr	Fri Oct 13 00:37:31 2017	(r451939)
@@ -0,0 +1,8 @@
+RxMath duplicates the interface of IBM's RxMath library, as well as the
+library that comes with ARexx (known here as RexxMath).
+
+Note that any scripts which load RxMath or RexxMath must be run with the
+'regina' command, rather than 'rexx'; the latter does not support the use
+of external function packages.
+
+WWW: http://pages.interlog.com/~pjtm/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710130037.v9D0bWwX083233>