Trailing-Edge
-
PDP-10 Archives
-
tops20tools_v6_9-jan-86_dumper
-
tools/compil2/compile.com
There are 2 other files named compile.com in the archive. Click here to see a list.
$ ! COMPILE.COM - call the right compiler, and only if .OBJ is stale
$ SAVE_VERIFY := 'COMMAND$DEBUG ! COMMAND$DEBUG == 1 to see more
$ SAVE_VERIFY = 'F$VERIFY( SAVE_VERIFY .AND. F$VERIFY( ) ) ! economize logs
$ COMMAND$DEBUG := 'COMMAND$DEBUG
$ GOTO START ! even in VERIFY mode, economize logging
$ ! This command conditionally compiles programs by checking the
$ ! revision date of the source file against that of the object file.
$ ! It also automatically selects the compiler based on the most recent
$ ! source-language extension encountered.
$ !
$ ! To use:
$ ! $ @COMPILE progid{,progid2...} {/COMPILE}
$ ! or:
$ ! $ @COMPILE @progid.lst {/COMPILE}
$ ! In the latter case, all the progid's in the indirect file are
$ ! conditionally compiled. The optional second parameter /C forces compilation.
$ !
$ ! REVISION HISTORY
$ !
$ ! 27-AUG-1984 PFK Initial commented version, includes "?" help
$ ! Peter F. Klammer
$ !
$ ! 29-Aug-1984 PFK added comma-separated list parameter handling
$ !
$ ! 30-Aug-1984 PFK fixed bug in @file handling introduced yesterday,
$ ! added more languages (none tested here but MAR, FOR)
$ !
$ ! 6-Sep-1984 PFK fixed up some comments
$ !
$ ! 20-Sep-1984 PFK same global symbol for COMPILE, LOAD, and EXECUTE
$ !
$ ! 26-Sep-1984 PFK added ";0" to search filespec
$ !
$ ! 29-Sep-1984 PFK optional P2 second parameter /C force to compile
$ !
$ ! 2-Oct-1984 PFK for debugging only, COMMAND$DEBUG == 1;
$ ! for full trace, COMMAND$DEBUG == 1 and SET VERIFY;
$ ! SET VERIFY alone, default for batch, is suppressed
$ !
$ ! 17-OCT-1984 PFK control_y must always goto abort, not just sometimes
$ !
$ ! 22-OCT-1984 PFK show compiler symbol evaluation if not null, to see switches
$ !
$ ! 23-OCT-1984 PFK Show exact filespec in "up-to-date" message.
$ ! Also handle case of no sources, nor objects found.
$ ! Also retain fuller filespec given for .OBJ's elsewhere.
$ !
$ ! 8-NOV-1984 PFK Added type .C for language C
$ !
$ ! END REVISION HISTORY
$START:
$ STATUS = 1
$ ON CONTROL_Y THEN GOTO ABORT
$ ON ERROR THEN GOTO ABORT
$ PV := 'COMPILE$LOAD$EXECUTE$FILESPEC ! was there any previous value?
$ IF PV .EQS. "" THEN COMPILE$LOAD$EXECUTE$FILESPEC == "" ! global now exists
$TRYP1:
$ IF p1 .EQS. "" THEN p1 = COMPILE$LOAD$EXECUTE$FILESPEC ! {RET} given, use global memory
$ IF p1 .NES. "?" THEN GOTO GETP1
$ WRITE SYS$OUTPUT "$ COMPILE (program) ?"
$ TYPE SYS$INPUT:
PROGID name of a source and object module to conditionally compile
or,
PROGI1,PROGI1,... list of names
or,
@PROGID.LST filename of a list of source modules
or,
{RETURN} remembers previous COMPILE parameter
and
optional second parameter /COMPILE forces compilation
$ p1 = ""
$GETP1:
$ IF p1 .NES. "" THEN GOTO GOTP1 ! if no parameter yet, keep trying
$ INQUIRE/NOPUNCT p1 "$ COMPILE (program) "
$ GOTO TRYP1
$GOTP1:
$ COMPILE$LOAD$EXECUTE$FILESPEC == p1 ! global now set
$ COMPILE_FORCED = F$EXTRACT( 0, 2, p2 ) .EQS. "/C"
$ IF COMMAND$DEBUG .AND. COMPILE_FORCED -
THEN WRITE SYS$OUTPUT " [COMPILE: /COMPILE forced.]"
$ FILE = ""
$ LINE = p1
$ IF F$EXTRACT(0,1,p1) .NES. "@" THEN GOTO GETPROGID
$ FILE = p1 - "@"
$ OPEN/READ AT &FILE
$READP1:
$ READ/END=END AT LINE
$ IF COMMAND$DEBUG -
THEN WRITE SYS$OUTPUT " [COMPILE: indirect file line:''LINE']"
$ LINE = LINE - "-"
$GETPROGID:
$ IF COMMAND$DEBUG -
THEN WRITE SYS$OUTPUT " [COMPILE: now line has:''LINE']"
$ IF LINE .EQS. "" THEN GOTO READP1
$ PROGID = F$EXTRACT(0,F$LOCATE(",",LINE),LINE)
$ LINE = LINE - PROGID
$ LINE = LINE - ","
$ IF COMMAND$DEBUG -
THEN WRITE SYS$OUTPUT " [COMPILE: next module is:''PROGID']"
$DOPROGID:
$ OBJSTAMP = "0000-00-00 00:00:00"
$ OBJSPEC = ""
$ SRCSTAMP = "0000-00-00 00:00:00"
$ LANGUAGE = ""
$ PARSPEC = F$PARSE(PROGID,,,"DEVICE") -
+ F$PARSE(PROGID,,,"DIRECTORY") -
+ F$PARSE(PROGID,,,"NAME") -
+ ".*;0"
$ IF COMMAND$DEBUG -
THEN WRITE SYS$OUTPUT " [COMPILE: searching for ''PARSPEC']"
$ FILESPEC = F$SEARCH(PARSPEC)
$ IF FILESPEC .EQS. "" THEN GOTO NONE
$LOOP:
$ IF COMMAND$DEBUG -
THEN WRITE SYS$OUTPUT " [COMPILE: next filespec is: ''FILESPEC']"
$ TYPE = F$PARSE(FILESPEC,,,"TYPE") - "."
$ TIMESTAMP = F$CVTIME(F$FILE_ATTRIBUTE(FILESPEC,"RDT"))
$ IF TYPE .EQS. "OBJ" THEN GOTO OBJ
$ IF TYPE .EQS. "FOR" THEN GOTO SOURCE
$ IF TYPE .EQS. "MAR" THEN GOTO SOURCE
$ IF TYPE .EQS. "COB" THEN GOTO SOURCE
$ IF TYPE .EQS. "C" THEN GOTO SOURCE
$ IF TYPE .EQS. "BAS" THEN GOTO SOURCE
$ IF TYPE .EQS. "B32" THEN GOTO SOURCE
$ IF TYPE .EQS. "PAS" THEN GOTO SOURCE
$ IF TYPE .EQS. "PLI" THEN GOTO SOURCE
$ GOTO OTHER
$OBJ:
$ IF TIMESTAMP .LES. OBJSTAMP THEN GOTO OTHER
$ OBJSTAMP = TIMESTAMP
$ OBJSPEC = FILESPEC
$ GOTO OTHER
$SOURCE:
$ IF TIMESTAMP .LES. SRCSTAMP THEN GOTO OTHER
$ SRCSTAMP = TIMESTAMP
$ LANGUAGE = TYPE
$ GOTO OTHER
$OTHER:
$ FILESPEC = F$SEARCH(PARSPEC)
$ IF FILESPEC .EQS. "" THEN GOTO DONE
$ GOTO LOOP
$DONE:
$ IF LANGUAGE .EQS. "" .AND. OBJSPEC .EQS. "" THEN GOTO NONE
$ IF SRCSTAMP .GTS. OBJSTAMP THEN GOTO COMPILE
$ IF COMPILE_FORCED THEN GOTO COMPILE
$ WRITE SYS$OUTPUT " [COMPILE: no compile; ''OBJSPEC' up-to-date.]"
$ GOTO DIDPROGID
$NONE:
$ WRITE SYS$OUTPUT "%COMPILE-F-NOFILES, no files ''PROGID' found to compile"
$ GOTO ABORT
$COMPILE:
$ COMPILER = "UNKNOWN"
$ IF LANGUAGE .EQS. "FOR" THEN COMPILER := FORTRAN
$ IF LANGUAGE .EQS. "MAR" THEN COMPILER := MACRO
$ IF LANGUAGE .EQS. "COB" THEN COMPILER := COBOL
$ IF LANGUAGE .EQS. "C" THEN COMPILER := CC
$ IF LANGUAGE .EQS. "BAS" THEN COMPILER := BASIC
$ IF LANGUAGE .EQS. "B32" THEN COMPILER := BLISS
$ IF LANGUAGE .EQS. "PAS" THEN COMPILER := PASCAL
$ IF LANGUAGE .EQS. "PLI" THEN COMPILER := PLI
$ GLOBAL := 'COMPILER ! see if user has defined this symbol
$ IF COMMAND$DEBUG -
THEN SHOW SYMBOL GLOBAL
$ GLOBAL := '&GLOBAL ! it takes two step, in case undefined
$ IF COMMAND$DEBUG -
THEN SHOW SYMBOL GLOBAL
$ IF GLOBAL .NES. "" THEN COMPILER = GLOBAL ! this way switches will appear
$ WRITE SYS$OUTPUT "$ ''COMPILER' ''PROGID'"
$ 'COMPILER 'PROGID
$ GOTO DIDPROGID ! prevent "blank records by system ignored" noise
$DIDPROGID:
$ IF ( LINE .EQS. "" ) .AND. ( FILE .EQS. "" ) THEN GOTO END
$ GOTO GETPROGID
$ABORT:
$ IF COMMAND$DEBUG -
THEN WRITE SYS$OUTPUT " [COMPILE: ABORT!]"
$ SET NOCONTROL=Y ! be sure control-Y trapping cleared
$ SET CONTROL=Y
$ STATUS = 4 + %X10000000 ! failure + message already shown
$END:
$ CLOSE/ERROR=IGNORE AT
$IGNORE:
$ IF COMMAND$DEBUG THEN SHOW SYMBOL STATUS
$ SAVE_VERIFY := 'F$VERIFY(SAVE_VERIFY)'
$ EXIT STATUS