PROGRAM SUPDIR C ************************************************** C * * C * S U P E R - M A C * C * * C * PREPROCESSOR * C * * C * FORTRAN VERSION * C * * C * AUTHORS: Thomas J. Weslowski * C * Computer Science Dept. * C * SUNY at Oswego * C * Oswego, NY 13126 * C * * C * and * C * * C * Richard R. DeMidio * C * Instructional Comp. Ctr. * C * Snygg Hall * C * SUNY at Oswego * C * Oswego, NY 13126 * C * * C * MAINTAINER: Edward F. Beadel, Jr. * C * Manager * C * Instructional Comp. Ctr. * C * Snygg Hall * C * SUNY at Oswego * C * Oswego, NY 13126 * C * * C * PHONE: (315) 341-3305 * C * * C ************************************************** C C C COPYRIGHT (c) 1981, 1982, 1983 C BY C Instructional Computing Center C State University of New York at Oswego C Oswego, NY 13126 C C contact: Edward F. Beadel, Jr., Manager C phone: 315/341-3055 C C C This software is furnished in an as-is condition, C with no committments of support or updates. This C software or any other copies thereof may NOT be C sold for profit nor can it be included in any C package to be sold for profit without the written C consent of the author and the coppyright owner. C This software may be used and copied only in ac- C cordance with the terms set forth above and with C the inclusion of the above copyright notice. C C The information in this software is subject C to change without notice and should not be con- C strued as a commitment by The State University of C New York, The C.A.U.S.E. Instructional Computing C Center, the author(s) or maintainer(s) of this C software. C C The State University of New York, The C C.A.U.S.E. Instructional Computing Center, the C author(s), and the maintainer(s) of this software C collectively and individually assume no responsi- C bility for the use or reliability of this C software. C C C C This program is going to be our preprocessor for C processing Supermac directives. These directives are C are as follows. C # INCLUDE -- This directive will fetch a file and C include this file as an addition to the C current Supermac program being compiled C It is invoked by # INCLUDE PROG.SMA C where prog is any supermac program. C # DEFINE -- This directive will allow a user to define C blocks of code by specifying a name. C ex. # DEFINE code C # DEFINE /Fred/ LET R0 := R0 +1; / C If you are familiar with ALGOL, this works C in the same way. C Mainline declarations will now follow BYTE OUTFIL(16),IFL(12),OFL(12),NFL(12) INTEGER CH,INUM,ONUM INTEGER *4 IM,FM LOGICAL FLG DATA INUM,ONUM /50,51/ C Mainline Code TYPE *,'****** Supermac Directive Preprocessor ******' TYPE *,'****** used in conjuction with the ******' TYPE *,'****** Supermac Compiler ******' TYPE *,'****** Version 1.1 ******' TYPE *,' ' CALL JCTIME(IM) TYPE 21 21 FORMAT('$','Input file name > ') CALL GETSTR(7,IFL,11) CALL ASSIGN(INUM,'123.456',7,'SRC') CALL CHECKF(IFL) CALL FLCOPY(IFL,1,49,INUM) REWIND INUM TYPE 24 24 FORMAT('$','Output file name (use .sma extension) > ') CALL GETSTR(7,OUTFIL,11) CALL CHECKF(OUTFIL) C Get user's input file, check to see if it is valid, C then get the output file and see if it is valid. CALL ASSIGN(ONUM,'654.321',7,'SCR') C Set up initial output file and new output file. C What follows now, is to process the Supermac C directives. First the include, the define C we will continue processing directives until C no more # includes can be found. CH=0 5 CALL INCLUD(INUM,ONUM,FLG) IF(.NOT.(FLG))GOTO 100 ! Anymore includes? CALL DEFINE(INUM,ONUM) CH=1 GOTO 5 100 IF(CH .EQ. 0) CALL DEFINE(INUM,ONUM) CALL FLCOPY(OUTFIL,3,INUM,54) CALL JCTIME(FM) TYPE 110,(FM-IM)/10. TYPE *,' ' CLOSE(UNIT=ONUM) CLOSE(UNIT=INUM) CALL MERGE(OUTFIL) CALL EXIT C Copy final output to file C Then kill all extraneous files 110 FORMAT(//,12X,'Your program used ',F5.1,' seconds of CPU time') END