Most of my REXX scripts come out of weave. This means I write a commentry on the program, and run that through weave to produce the rexx script (etc).
/* REXX Woven from zrxc.cmd by Wendy Krieger on 20210630 at 20:52:58 */
/*~ Rexx Maths calculator v0.203 */; numeric digits 60; numeric fuzz 1;
setpi = 2; econst=0; ln2p=0 ; nd = digits()
The first line tells me when and where the source is, the second is picked up by the description program.
extproc weave.rex
regina woven.rex zrxc.cmd
::~ source for rxc v 0.202
goto :eof
!topic About
This is a rebuild of the rexx calculator
see http://www.lightlink.com/hessling/
or http://regina-rexx.sourceforge.net/
Album of algorithms at http://www.geocities.com/zabrodskyvlada/aat/
(also available in Czech [cesky]
The calculator is not strictly related to one field, but just acquires
functions as i need them. Most of them are however, either hyperbolic
geometry or higher dimensional stuff.
!topic Settings
!src
!set [rxc version ] yvers 0.203
!exe mainrexx #..\rxc.rex##Rexx Maths calculator v##
!lbl settings - *******************************************
!set [ $#disp#high#low# ] yexp120 $#20#16#-4#
!set [ decimal in base 1000 ] yexp010 $#126E36#9#-3#
!set [disp 1+1/ydspadd ] ydspadd 1e50
!lbl rexxsets - *******************************************
numeric digits 60; numeric fuzz 1;
setpi = 2; econst=0; ln2p=0 ; nd = digits()
!inc units We handle some conversion factors now.
!end
In non-twelfty bases, we look to see the size of 126E38 is in
the base in question, and use that many places. The reason for
this is to keep the same level of precision throughout.
Most of the stuff in the second bit is simply intro, it isn't the first part of the code, just some random insert to it.
It's actually an extproc command I run under 4nt. The program that accepts this is weave.rex, which is also written in a similar style on a simple print on/off tangle.rex. So tangle.rex is used to compile weave.rex, which is used to write all sorts of other things.
The bits of code that are 'commented out' or not included in the compile can still be in the source, but simply bypassed in the compile.
The program is handy enough that you can write a number of matching code pieces to different files, like write a matching 4DOS.INI and 4OS2.INI at once.
rxc.cmd is the command-line calculator, it's 22.170 bytes, the source code is 37.249 bytes. The !topic is the 4dos help topic header, is what I use for bait for a folding editor. This is what turns up on the fold.
File: D:\save\cdata\BATCH\zsource\zrxc.cmd 47 occurrences found on 47 lines
6: !topic About
21: !topic Settings
41: !topic Conversion factors
130: !topic functions
161: !topic - vf (vulgar fractions)
175: !topic - sp, sm
190: !topic - star()
209: !topic - klein (convert Eq to Kq)
253: !topic h2k and k2h [Guage rule]
294: !topic - tube
334: !topic - a1_a2
348: !topic - c1_c2
366: !topic - ij
410: !topic - fact()
422: !topic - borr()
443: !topic Complex
461: !topic Base
478: !topic fract
494: !topic Zspans
534: !topic Diameters & Edges - d2 and e2
560: !topic some sequences
591: !topic distances dx
604: !topic isoquad
644: !topic addquad
668: !topic modulo functions
718: !topic - rss
732: !topic - ddif
743: !topic - mp
755: !topic - DOS
761: !topic - rxxmath
774: !topic Twelfty
810: !topic - Powerset(base, pos number)
834: !topic - other bases
863: !topic Program
881: !topic - RexCalc
905: !topic version stuff
912: !topic Standard functions
933: !topic - cbrt
954: !topic - sqrt
975: !topic - sin
1001: !topic - - sinp
1014: !topic - - cosp
1023: !topic - pi
1056: !topic - - piconst
1065: !topic - pow
1080: !topic - Ln()
1128: !eof !topic Remmed out stuff