!*************************** AMUS Program Label ******************************
! Filename: SS1MAK.BV Date: 05/30/89
! Category: UTIL Hash Code: 633-501-521-655 Version: 1.0
! Initials: DD Name: DAVE DRAKE
! Company: DOUBLE-D SOFTWARE SERVICES Telephone #: 7024382173
! Related Files: NONE
! Min. Op. Sys.: N/A Expertise Level: INT
! Special:
! Description: MAKE utility for AlphaBASE/Metropolis Programs
! Can be modified to work with BSI's and BAS programs
!
!
!*****************************************************************************
! SS1MAK ( ) - Double-D Software AlphaBASE Make Utility
!*********************************************************************
!
! Double-D Software Services Dave Drake
! 4924 Chantilly (702) 438-2173
! Las Vegas, Nv. 89110
!
! PROGRAM NAME: SS1MAK
!
! DATE CREATED: 05/14/89
!
! DESCRIPTION: Creates .CMD file to recompile programs in response
! to changed .CPY file.
!
! NOTES: .CPY files must have special comment lines
! (See Example at end of this program)
!
! CHANGE HISTORY:
! DATE BY DESCRIPTION
!*********************************************************************
PROGRAM SS1MAK,1.0
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
! AREA FOR FILE LAYOUT MAPS - COPYF's [ ,11]
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
COPYF "APDFIL[SY]" ! Applications directory
COPYF "APDKEY[SY]"
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
! AREA FOR STANDARD MAP STATEMENT COPY's [7,6]
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
COPY "USRBUF" !User Buffer (Ldusr)
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
! AREA FOR LOCAL MAPS
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MAP1 FILENAME,S,6 !For input of .CPY filename
MAP1 SRCE'FILENAME,S,25 !.CPY processing
MAP1 OUTP'FILENAME,S,10 !File List Output
MAP1 INPT'FILENAME,S,10 !File List Input
MAP1 OUTP'SEQ,B,1 !File List Extension Sequencer
MAP1 FIRST'LINE,B,1 !Flag
MAP1 CURR'APP,S,2 !Current APP (CMD file processing)
MAP1 GOTO'APP,S,2 !
MAP1 FNAME,S,15 !Extracted names
MAP1 NAME'COUNT,B,2 !count of extracted names
MAP1 FOUND,B,5 !LOOKUP status return
MAP1 NEW'FILES,B,1
MAP1 X,F
MAP1 Y,F
MAP1 I,F
MAP1 STRING,S,132
MAP1 FOUND'NAME,B,1
MAP1 LENGTH,F
MAP1 DUPELIST(100),S,6
MAP1 PATHDSK,S,6
MAP1 PATHPPN,S,9
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
! AREA FOR GLOBAL SYMBOLS
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
GLOBAL YES = "1" !For setting Boolean Flags
GLOBAL NO = "0" !For setting Boolean Flags
!*********************************************************************
! TOP LEVEL PROCEDURE
!*********************************************************************
BEGIN:
ldusr !to get curr APP
PRINT TAB(-1,0);
PRINT "Double-D Software AlphaBASE/Metropolis MAKE Utility"
!'Make' .CMD files until 'END'
DO
INPUT "Copy File to Process (END to Exit): ";FILENAME
IF UCS(FILENAME)="END" EXIT
SRCE'FILENAME = FILENAME+".CPY" !.CPY is default for AlphaBase
LOOKUP SRCE'FILENAME,FOUND !Find it!
IF FOUND # 0 ! Found
GOSUB PROCESS ! Process
ELSE ! else
PRINT FILENAME;": not found" ! Error
ENDIF !
LOOP !Try another
END
!---------------------------------------------------------------------
! ALL THE WORK IS DONE HERE
!---------------------------------------------------------------------
!The Make utility makes as many passes through the list of files as needed
! until the list contains only .BV references. This is done by
! incrementing the File Extensions for each pass. The first pass
! reads the original .CPY and outputs .001, second pass inputs .001
! and outputs .002, etc until a pass through the input file doesn't
! contain any more .CPYs.
PROCESS:
OUTP'SEQ = 1 !reset extension sequence
!build file list from original copy file
OUTP'FILENAME=FILENAME+"."+(OUTP'SEQ USING "#ZZ")
OPEN #3,OUTP'FILENAME,OUTPUT
GOSUB PROCESS'SRCE'FILE
IF NAME'COUNT = 0
PRINT "*** ";SRCE'FILENAME;" has no 'COPIED INTO' lines"
RETURN
ENDIF
CLOSE #3
!process list down to all .bv files
DO
INPT'FILENAME=FILENAME+"."+(OUTP'SEQ USING "#ZZ")
OUTP'SEQ = OUTP'SEQ + 1
OUTP'FILENAME=FILENAME+"."+(OUTP'SEQ USING "#ZZ")
OPEN #2,INPT'FILENAME,INPUT
OPEN #3,OUTP'FILENAME,OUTPUT
GOSUB PROCESS'INPT'FILE
CLOSE #2
CLOSE #3
LOOP WHILE NEW'FILES = YES
!Create .CMD file
GOSUB MAKE'CMD'FILE
!Clean up work files
GOSUB CLEAN'UP'FILES
RETURN
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
! BUILD LIST FROM SOURCE COPY FILE
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PROCESS'SRCE'FILE:
!Find list of files using this file
PRINT "PROCESSING: ";SRCE'FILENAME
FIRST'LINE = YES !YES until tag line found in header
NAME'COUNT = 0
OPEN #1,SRCE'FILENAME,INPUT
DO UNTIL EOF(1)
X = 1
INPUT LINE #1,STRING !get a line
!if haven't found COPIED INTO: - search for it
IF FIRST'LINE = YES
X=INSTR(2,STRING,"COPIED INTO:")
IF X # 0
GOSUB EXTRACT'NAMES
IF FOUND'NAME = NO EXIT
FIRST'LINE = NO
ENDIF
!Found COPIED INTO: - Now process subsequent lines until
! line with only comment found
ELSE
GOSUB EXTRACT'NAMES
IF FOUND'NAME = NO EXIT
ENDIF
LOOP
CLOSE #1
RETURN
!-----------------------------------------------------------
! EXTRACT FILE NAMES FROM SOURCE FILE LINES
!-----------------------------------------------------------
EXTRACT'NAMES:
FOUND'NAME = NO
LENGTH = LEN(STRING) !set length of string
IF FIRST'LINE = YES !if on TAG line
X = X + 11 !skip past COPIED INTO:
ENDIF
!find beginning of first'name
DO UNTIL X >= LENGTH
IF ASC(STRING[X;1]) >=65 AND & !look for legal
ASC(STRING[X;1]) <=90 ! character
Y = INSTR(X,STRING,",") !index comma
IF Y = 0 !if no comma
FNAME=STRING[X,LENGTH] ! extract filename
X = LENGTH ! set offset
ELSE !else
FNAME = STRING[X,Y-1] ! extract filename
X = Y + 1 ! set offset
ENDIF !done
PRINT #3,FNAME !output filename
FOUND'NAME = YES !set flag
NAME'COUNT = NAME'COUNT + 1 !inc count
ELSE !if not legal char
X = X + 1 ! inc offset
ENDIF !
LOOP !loop
RETURN
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
! EXPAND FILE LIST UNTIL ALL BV's
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PROCESS'INPT'FILE:
NEW'FILES = NO
DO UNTIL EOF(2)
INPUT LINE#2,STRING
X = INSTR(1,STRING,".CPY")
IF X # 0
Y = INSTR(1,STRING,"(")
IF Y # 0
GOTO'APP = STRING[Y+1;2]
GOSUB GET'PATH
ENDIF
IF PATH'ERROR = NO
SRCE'FILENAME = PATHDSK+STRING[1,10]+PATHPPN
GOSUB PROCESS'SRCE'FILE
NEW'FILES = YES
ELSE
PRINT "ERROR: Bad APP: ";STRING
ENDIF
ELSE
PRINT #3,STRING
ENDIF
LOOP
RETURN
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
! MAKE COMMAND FILE TO RECOMPILE ALL PROGS
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MAKE'CMD'FILE:
!clear dup check list
FOR I = 1 TO 100
LIST(I) = ""
NEXT I
LIST'CNT = 0
!start processing
CURR'APP = UB'APP
INPT'FILENAME = OUTP'FILENAME
OPEN #1,INPT'FILENAME,INPUT
OUTP'FILENAME = FILENAME+".CMD"
OPEN #2,OUTP'FILENAME,OUTPUT
PRINT #2,":T"
PRINT #2,"XY=0"
PRINT #2,":<"
PRINT #2,"Begin Compile of all programs using ";FILENAME;".CPY>"
INPUT LINE#1,STRING
DO UNTIL EOF(1)
GOSUB DUPE'CHECK !check if name duped
IF DUPE = NO !if not duped
LIST'CNT = LIST'CNT + 1 ! inc count
DUPELIST(LIST'CNT)=STRING[1,Y-1]! put in dupe list
ENDIF !
!process filename
IF LEN(STRING) # 0
!search for parentheses - if there, need to log to application within
X = INSTR(1,STRING,"(")
IF X = 0
IF CURR'APP # UB'APP
CURR'APP = UB'APP
PRINT #2,"L ";CURR'APP
ENDIF
ELSE
IF CURR'APP # STRING[X+1;2]
CURR'APP = STRING[X+1;2]
PRINT #2,"L ";CURR'APP
ENDIF
ENDIF
!strip extension - assumes .BV
Y = INSTR(1,STRING,".")
!put 'CC' (AB compile)
PRINT #2,"CC ";STRING[1,Y-1]
ENDIF
INPUT LINE #1,STRING
LOOP
!if not in starting app - put command to get back
IF CURR'APP # UB'APP
PRINT #2,"L ";UB'APP
ENDIF
PRINT #2,":<Done"
PRINT #2,">"
CLOSE #1
CLOSE #2
RETURN
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
! CLEAN UP INTERMEDIATE FILES
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!delete all work files created during processing
CLEAN'UP'FILES:
FOR I = 1 TO OUTP'SEQ
OUTP'FILENAME = FILENAME+"."+(I USING "#ZZ")
KILL OUTP'FILENAME
NEXT I
RETURN
!*********************************************************************
! AREA FOR STANDARD SUBROUTINE INCLUDE FILES
!*********************************************************************
!check if name duplicated
DUPE'CHECK:
DUPE = NO
IF STRING="" RETURN
CNT = 1
DO UNTIL CNT > LIST'CNT
IF DUPELIST(CNT) = STRING[1;Y-1]
PRINT "WARNING: ";STRING;" Duplicated!!"
DUPE = YES
EXIT
ENDIF
CNT = CNT + 1
LOOP
RETURN
!*********************************************************************
! AREA FOR STANDARD SUBROUTINE INCLUDE FILES
!*********************************************************************
!the program will track .CPYs through multiple applications
! Here is where it gets the path to a CPY file in another application
GET'PATH:
PATH'ERROR = NO
APD'KSYSTEM = UB'SYS
APD'KAPPID = GOTO'APP
use APD key APD'key
IF APD'CTL # 0 THEN
LOG'ERROR = YES
RETURN
ENDIF
PATHDSK = APD'DISK(2)+ ":"
PATHPPN = "["+APD'PRJ(2)+ ",0]"
RETURN
!*********************************************************************
! end of program code
!*********************************************************************
! Example of Header for Copy files used by Double-D Software
! XXXXXX.CPY (rev) - Description of routine
!****************************************************************************!
!
! Double-D Software Services Dave Drake
! 4924 Chantilly (702) 438-2173
! Las Vegas, Nv. 89110
!
! ROUTINE NAME: XXXXXX
!
! DATE CREATED: mm-dd-yy
!
! DESCRIPTION: Description of routine
!
! COPIED INTO: XXXXXX.CPY(AP),XXXXXX.BV(AR),XXXXXX.CPY(GL)
! XXXXXX.CPY,XXXXXX.BV
!
! CHANGE HISTORY:
!
! DATE BY DESCRIPTION
!****************************************************************************!
!
!The MAKE utility looks for a line with 'COPIED INTO:' on it. It will extract
!the file names following the COPIED INTO and on all subsequent lines until a
!line with only a comment symbol (!) is found.
!
!A file containing all of the file names is built.
!
!Then that file is processed and any .CPY files contained in it will be
!processed and the list of files added to the master list. This continues
!until no more .CPY files are found in the master list. If the .CPY file
!has an application code [xx], the program will log to that application and
!process the file, then log back.
!
!When the Master List is Completed, the program builds a .CMD file that will
!recompile all of the programs on the list, logging to appropriate
!applications as necessary.
!
! NOTE: CURRENT ASSUMPTION IS THAT ALL FILES ARE IN SAME ALPHABASE SYSTEM
!