#!/usr/local/rexx/rxx /* * mathbld - program to re-build the uni-REXX interpreter to include the * math function package * * Syntax: mathbld [-h] * * * Without operands, mathbld prompts for the location of required header * files and libraries and builds the uni-REXX interpreter, naming it rxxm. * * Operands: -h help (see the subroutine named "help") * * * Modification History: * * 19 May 94 pjt Initial implementation * * */ signal on halt signal on novalue parse arg flag if flag = '-h' then call help /* if the user asked for help, give it */ call setup /* get directory information for required files */ say '' say 'Ignore any warning messages that may appear below' say '' say 'If error messages appear, contact TWG technical support for assistance' say '' say '' /* compile the function package source code */ address unix 'cc -c -I'libdir sampdir'/math.c -o' sampdir'/math.o' /* rebuild the uni-REXX interpreter */ address unix 'rxc -G' sampdir'/math.o -o' sampdir'/rxxm' exit setup: /* * subroutine to prompt for and validate existence and permissions of * directories for source files, header files, and archive library */ 'clear' ok = 1 say '' say 'Directory name where math.c source file resides?' say ' Default is current working directory' say '' parse pull reply if reply = '' then sampdir = getcwd() else sampdir = reply say '' say 'Directory name where irx.h and librx.a files reside?' say ' Default is /usr/local/bin' say '' parse pull reply if reply = '' then libdir = '/usr/local/bin' else libdir = reply address unix 'test -d' sampdir if rc \= 0 then do say 'Directory:' sampdir 'does not exist' ok = 0 end else do address unix 'test -w' sampdir if rc \= 0 then do say 'Directory:' sampdir 'does not have write permission' ok = 0 end end address unix 'test -d' libdir if rc \= 0 then do say 'Directory:' libdir 'does not exist' ok = 0 end else do address unix 'test -r' libdir if rc \= 0 then do say 'Directory:' libdir 'does not have read permission' ok = 0 end end if \ok then do /* if problems with directories, print messages */ say '' /* and exit */ say 'Please verify directory names and/or permissions before running' say 'mathbld again.' say '' say 'Exiting now.' exit end else do /* otherwise */ call putenv 'RXMATHSRC='sampdir /* set environment variables */ call putenv 'REXXLIB='libdir first_time = 0 /* say "We've been here" */ end /* and return */ return help: /* * subroutine to display help information on the use of the mathbld * program */ 'clear' say 'Syntax: mathbld -h View this help information' say ' mathbld Generate the rxxm interpreter' say '' say '' say 'This program prompts you for the location of the source files required' say 'to re-build the interpreter. You must have write permission for' say 'this directory.' say '' say 'It also prompts you for the location of the header file irx.h and the' say 'archive library librx.a on your system. You must have read' say 'permission for this directory.' say '' say 'In both cases, it tells you the default directory that will be used.' say '' say 'Press Enter to accept the default' say 'Type the full directory path name to change the default' say '' say 'NOTE: HP-UX sites should read the comments in math.c and make a' say ' required change before running mathbld' say '' say 'To build rxxm now: Press Enter' say 'To exit this program: Type Q' say '' pull reply if reply = 'Q' then exit return halt: say '' say 'Program interrupted by halt signal - probably ctl-C' say 'Terminating now' exit novalue: say '' say 'Uninitialized variable detected at line' sigl say 'Contact TWG Technical Support for assistance' exit