.; FILE: LB:[11,44]BUILDLBR.CMD LAST EDIT: 19-JUN-1989 15:30:48 .; .; HISTORY: CREATED 21-SEP-82 PHIL HANNAY .; .; MOVED TO LB:[11,44] FROM LB:[22,10] 11-JAN-83 PHIL HANNAY .; .; Revised to use Pascal 2.1 19-Oct-83 Phil Hannay .; .; JMB 2-DEC-83 -- reference proper PASMAC for Pascal 2.1 .; .; Add recognition of FTN files 25-Sep-85 Phil Hannay .; .; 5-May-86. Philip Hannay. Changed input parameters. .; Listings are saved only when an error occurs. There is no .; longer an option to spool listings, so parameters 2 and .; 3 have been eliminated. SRC files that generate a .; PAS file are assumed to be PA1 files and are built as such. .; OBJ files are always deleted after LBR input. Also .; added an exit status to confirm that library built okay .; and opened the log file append so that others may use it too. .; .; 22-Sep-86. Philip Hannay. Added code to run under DCL. .; .; 19-Jan-87. Glenn Wondra. Revised to continue on compile .; warnings. .; .; 24-Jan-87. Philip Hannay. Modified extention tests to look .; for both upper and lower case types (PAS and pas). It still .; will not accept mixed case (Pas). .; .; 21-Jul-87. Philip Hannay. Added HELP function recognizing .; "?" and "/HE" as help requests .; .; 21-Aug-87. Philip Hannay. Added test for assembler command file .; srcfilename.ASM when doing a macro assembly. If found, we use .; the ASM file to do the assembly. Also updated to look .; for named default directory in rather than in .; if used is building in NAMED environment. Added ONERR .; processing to insure that log file is closed (and not locked), .; and CLI is restored on fatal indirect processing error. .; .; 16-Nov-87. Philip Hannay. Ignore lines beginning with "&" as .; comment lines. These are used by PRINTSRC to signal additional .; files (usually include file) to print. .; .; 16-May-88. Philip Hannay. Changed PA3 default to ERROR from .; LIST to shorten LST file. Did away with purge of source files .; including .ASM and .MOD files, leaving it up to the programmer .; to decide when to purge. .; .; 9-Nov-88. Bob Thomas. Modified to allow for appending a /DEBUG .; switch to either the modfile name (resulting in all of the .; fortran modules being compiled with the /DE switch) or the .; individual file names in the mod file (resulting in just those .; files with the /DEBUG switch being so compiled). .; .; 19-Jun-89. Philip Hannay. Added /DOUBLE switch to PA3 .; (PASCAL 2.1) compiles as we now use double precision .; throughout the land. .; .; GENERIC LIBRARY BUILD PROCEDURE .; .ENABLE SUBSTITUTION .; .; See if help requested .if p1 eq "?" .goto help .if p1 eq "/HE" .goto help .goto nohelp .help: ; ; The BUILDLBR command file will compile/assemble specified modules, and ; insert (replace) them into an existing library. Object modules are optionally ; deleted following insertion. Listings are optionally generated in wide ; or narrow format, and printed. If generated, listings are deleted following ; printing. ; ; A modulator file name.MOD file is specified by the user and will contain ; the library name where modules are inserted, and the module sources ; (SRC, PAS, FTN, or MAC) to be inserted. The syntax of the MOD file ; consists of a one line library name (without the .OLB), and a multiline ; list of module names (one per line) with the appropriate extenstion ; (like .PAS or .FTN). Any line beginning with a ";" is a comment line. ; Any line consisting of just a is ignored. A line beginning ; with a "%" is used by BUILDEXT.CMD for creating include files for ; Pascal, and ignored by BUILDLBR. A line beginning with a "&" is used by ; PRINTSRC.CMD to indicate additional files to be printed (usually include ; files), and ignored by BUILDLBR. ; ; A sample MOD file ; ; ; ; SAMPLE MOD FILE - comment line ; ; another comment line ; ; the next line is just a carriage return with not text, so its ignored ; ; ; ; the following line is the library name (optional device, directory) ; TB:[115,305]PHIL ; ; above line indicates we will deal with existing library ; ; PHIL.OLB in TB:[115,305] ; ; ; ; Now the sources to be compiled and replaced (put) in PHIL.OLB ; ; ; ; Main program ; BIGJOB.PAS ; ; ; ; Subroutine to add two numbers ; ADD.MAC ; ; ; ; Subroutine to open file, write results ; FILWRT.FTN ; ; ; ; Subroutine to initialize variables ; INIT.PAS ; ; ; ; end of MOD file ; ; ; There are three different ways of invoking BUILDLBR. INTERACTIVE mode ; asks any needed questions before proceeding, SUPPRESSED INPUT mode ; uses parameters supplied at invocation to answer any questions, and ; REMOTE mode is the same as SUPPRESSED INPUT mode, but will notify another ; terminal with BROadcast of its progress. ; ; INTERACTIVE mode is for hands on operation. It requires an operator ; present and limits your terminal access. ; ; SUPPRESSED INPUT mode allows another command file to supply anwers to ; BUILDLBR as it invokes it, thus eliminating the need for an operator ; to be present. Your terminal access is still limited. ; ; REMOTE mode allows another command file to supply answers to BUILDLBR ; as it invokes it so an operator does not need to be present. In addition, ; it lets you run the command file on another terminal (TT or VT - BATCH), ; with notifications to your terminal of errors or when the job is complete. ; This keeps you terminal free for other work. ; ; IN MORE DETAIL: ; ; SUPPRESSED INPUT MODE: ; This file may be called from another command file or buffer stuffer ; using the parameters to initialize certain variables. This will ; eliminate the need to query the operator for this information. ; This is useful when this command file is called by another command ; file that will be take two hours doing other work before getting ; around to calling this one. Thus the operator can take a nap and ; not have to wait around to answer the questions the variables ; need initialization. ; ; REMOTE MODE: ; This file may be run from a different terminal, if you have ; access to a buffer stuffer. When this is done, the command ; file does no interaction with its TI: (which you can't readily ; get at). Instead, BRO is used to notify the specified terminal ; of errors and completion. ; ; For either mode, use the following command line. Leave out ; for SUPPRESSED INPUT mode, and specify for REMOTE mode. ; The parameter must be specified, while the others are ; optional, and default values will be used. Note that there can be ; no ommissions between specified parameters, even if the default is ; desired for that parameter in between. Ommissions can only occur ; when no further specified parameters follow. ; ; Invoke with commandline @BUILDLBR . ; ; = dev:[uic]modfilename (p1) ; This is the .MOD (text) file name. The device, uic and name of the file ; is specified (normal file spec defaults apply). Do not specify the ; extention or version. This command file will append the .MOD extention ; and the latest version will be used. The .MOD file will contain the name ; of the library, into which insertion will occur, in the first line. ; The library extention or version should not be specified, only ; device, uic, and name, with normal file spec defaults valid. ; The library name may have a /DEBUG switch appended to it. If it ; does then all fortran modules will be compiled with the /DE switch. ; The second line and onward will contain the names of the source ; modules to be compiled (assembled) and inserted into the library. ; The extention MUST be specifed. Normal file spec defaults apply. ; The individual source module names may also have the /DEBUG switch ; appended, which results in the individual modules so designated ; being compiled with the /DE switch (for Fortran modules only). ; ; The modfile name itself can have a /DEBUG switch appended to it. If it ; does this also results in all the Fortran modules being compiled with ; the /DE switch. ( /DEBUG ) ; ; = error control switch (P2) ; Xn = terminate after n errors (default and n=1) Specify n ; as a 1 or 2 digit number (thus 1 thru 99) with no ; space between it and the letter X. Execution will ; continue until n errors have occurred. If n is not ; specified, or a non-numeric string used, n will ; default to 1. ; ; C = continue on errors ; any other letter = notify and pause (type UNS ...at. or ; UNS ATTxx at YOUR terminal to resume). ; ; = effective ti (P3 - remote mode only) (no default as that ; would mean suppress input mode and not remote mode) ; TTx: = this required switch specifies the tt: to receive ; nofitication of errors and completion. ; ; ; A log file is maintained to allow you to go back and see what occurred ; and when it occurred. The log file will have the same name as the ; MOD file (ie. modfilename.LOG). It will contain starting and ending ; times, and status of compilation and insertion into the library. The ; log file will be appended to if one already exists so that older build ; info will be retained. ; ; Files will be purged and deleted as possible to minimize storage ; space needed. No purges or deletes will be done, until a successful ; operation occurs. If a compile error or warning occurs, the files ; resulting will be left behind (including the list file) allowing you ; to diagnose the error more completely. ; ; This above HELP text is displayed in response to a "?" or "/HE" value ; used as the first parameter to BUILDLBR (ie. "@BUILDLBR ?"). ; .goto 990 .nohelp: .; See if we are running in DCL .; .sets curcli .if curcli ne "MCR" mcr set /cli=ti:mcr .; .setf badend .; Badend will signal if an error occurred so that we can exit with the .; appropriate error status, in case we are being called by another .; indirect command file. .; .setf fatend .; Fatend will signal if a fatal error (detected by .onerr) has occurred. .; .onerr 910 .; If a fatal indirect error detected, go to 910 for cleanup .DISABLE QUIET .SETS ESW "" .SETS ETI "" .SETF REMOTE .SETF NOINPT .SETF ERRX .SETF ERRC .SETF ERRP .SETS ANUM "0123456789" .SETN ERRNUM 0 .SETN ERRMAX 1 .; .TEST P1 .IF EQ 0 .GOTO NOREM .SETS MODNAM P1 .; Invoked with parameters, may be remote, or suppressed input mode .; .; Determine the error option 'P2' .SETS TST "X" .SETS TST1 P2[1:1] .IF TST1 NE TST .GOTO 1 .SETT ERRX .TEST P2 .IF LT 2 .GOTO 1 .IF GT 3 .GOTO 1 .IF EQ 3 .GOTO TWODGT .; .SETS TST1 P2[2:2] .GOSUB NUMOUT .IF COUNT NE 0 .DEC COUNT .SETN ERRMAX COUNT .IF ERRMAX LT 1 .SETN ERRMAX 1 .GOTO 1 .; .TWODGT: .SETS TST1 P2[2:2] .GOSUB NUMOUT .IF COUNT NE 0 .DEC COUNT .SETN TCOUNT COUNT .SETS TST1 P2[3:3] .GOSUB NUMOUT .IF COUNT NE 0 .DEC COUNT .SETN ERRMAX TCOUNT*10.+COUNT .IF ERRMAX LT 1 .SETN ERRMAX 1 .GOTO 1 .; .; .; SUBROUTINE NUMOUT: .; .NUMOUT: .SETN COUNT 1 .LPNEXT: .IF TST1 EQ ANUM[COUNT:COUNT] .RETURN .INC COUNT .IF COUNT LT 11 .GOTO LPNEXT .SETN COUNT 0 .RETURN .; .; END SUBROUTINE .; .; .1: .SETS TST "C" .IF P2 EQ TST .SETT ERRC .SETS TST "P" .IF P2 EQ TST .SETT ERRP .IFF ERRC .IFF ERRP .SETT ERRX .; .; Determine effective TI: 'P3' .TEST P3 .IF NE 0 .GOTO SETRMT .; just mod name supplied, not remote but suppressed input mode .SETT NOINPT .GOTO NOREM .; .SETRMT: .ENABLE QUIET .SETT REMOTE .SETS ETI P3 .SETS TST "T" .SETS TST1 ETI[1:1] .IF TST NE TST1 .SETT FATEND .IF TST NE TST1 .GOTO 900 .;We must have an EDI to work with. .; now skip the interactive questions.... .GOTO START: .; .; .NOREM: ; ; Library build begun '' at '