THIS COMMENT FILE IS STORED ON SAVE.CMT STORED ON: SAVE.VLI AUTHOR: PAUL MENNEN DATE: 6-NOV-80 The functions in this file can be loaded when desired by: (INPUT SAVE) This file contains the routines necessary to be able to save a function or a group of functions on a file using the pretty printer and also using a comment file if desired. This set of routines requires that the initialization file (VLISP.INI) be loaded The following resources are used when this file is loaded: Atoms = 259 Lists = 651 SAVE calling sequence: (save FNC1 FNC2 ... FNCn) first user is asked for output file name. (default ext. = VLL, default device = DK:) then a file to be used as comment file is looked for on system device with same name as output file but with extention CMT. if such a file is found, the user is asked if these comments should be included in output. then user is asked if paren matching is desired. then save outputs the functions FNCi using PRET and returns # of pages printed. for an example of how a comment file is structured, see VLISP.CMT .PRIN ask for output file with default extention VLL .INP see if a comment file exists but close it afterwards .INP if there is a comment file, ask user if he wants to use it .PARM ask user if he wants paren matching .PRINT tell user weather comments are being printed .PRINT tell user if paren matching is being used .OUTPUT open output file .INPUT open input file if comment file is active .SETQ initialize several variables .IF if we have a valid comment file, print the file header .WHILE do this for all functions to be saved .LINES does it look like the next function will fit on what remains of this page? .12 no, skip tho the next page using form feed character (ascii 12) .SETQ clear comment flag for every function .INP do we have a comment file? .IF yes, if LIN1 is not null, then LIN1 contains the function name associated with the next group of comments in the file, LIN1 is not null we dont need to read another line .READLN LIN1 is null, go read the next line (should contain function name) .IF if the line was empty, terminate input file usage (INP = nil) otherwize assemble the function name into LIN1 .IF if the function name is the same as the next function to be saved, set the comment flag .SETQ pretty print the next function and keep track of lines used on this page .TERPRI skip a line between functions .PAGES close input and output files, return # of pages printed GETCOM .IFN does COMLI contain a set of comment lines waiting for the right time to be printed? yes, skip to last line of this routine .IFN COMLI is empty, thus we need to get the next set of comments from the file. is the next line empty? (the line has allready been read for us) .SETQ its a blank line, must be the end of the comments for this function .CDR remove first character from LIN (its a ".") .EQ put all the characters up to the first tab into COMWORD, comword will be the keyword used to match up the comment lines with the program text .NEQ discard all of the tabs separating comword from the comment .SETQ assemble comword, COMS is a temporary collection for this set of comment lines .AND this comment includes all succeeding lines that dont begin with a "." .NEQ this is another continuation line, remove all leading tabs .NCONC append the continuation line to COMS .WHILE now break up the characters in COMS into separete lines short enough to fit. we will be done when all characters are removed from COMS .NXTLN NXTLN will contain the next line to be split off of COMS .OR continue to add characters to NXTLN until one of the following 3 conditions .EQ we have no more room on the line .COMS we have used up all comment characters .EQ a semicolon can be used to force seperation of comments in specific places (also prevents harmful semicolons in comments) .CNT remove the next character from COMS into NXTLN .EQ have we stoped NXTLN because there is no more room for the remaining characters? .EQ yes, we have to back up so that we split the line at word boundries .NEXTL remove the unneeded space between the words that were split up .NEWL add the next line to the comment line list (COMLI) .COMLI get the comment lines back into proper order .IF if the COMWORD is equal to the atom we are now printing, set COMT to let TERP know to print the comments in COMLI ASKYN (ASK Yes No) Ask the user a yes or no question. PROMPT contains characters used to prompt the user for a yes/no response. If response is Y or y, return T, otherwise return NIL. .PRIN print prompt message .MEMQ returns T or NIL READLN read the next line from the comment file and put the characters read into list LIN. note that lines beginning with a form feed (ascii 12) and ending with a carriage return are ignored by this routine, so that the can be used to break up the comment file into convienient pages. PRINL send all characters in list X to the output device PRINL1 print the comment line W surrounded by semicolons at the proper output positions .IF advance to the comment position if we have not allready gone beyond it .Z if W is to be attached after a paren matching line then the semicolon isnt needed here .W print the comment characters .PRIN indicate the end of the comment line .TERPRA advance to the next line PRINTHEADER this routine prints a header at the beginning of the output file and can contain any descriptive information desired. .PRINT the whole header is a comment .UNTIL skip the first 10 lines of comment file and read the eleventh .LIN print all lines read until a blank line is encountered .PRINT end the comment RFILE ask the user for a file name in the standard RT11 style (DDD:NNNNNN.EEE) The default device is always DK: and DEFAULT-EXT is the default extention. Three variables are returned (DEV,FNAME,EXT) which will contain the users response in the form of lists of characters .TERPRI output the prompt message .INPUT for readline .FNAME set FNAME to contain input string .32 convert all lower case characters to upper case .MEMQ is a device specified? .DEV No, default to DK .DEV yes, start collecting into DEV all the characters which belong to the device name .UNTIL we are done when semicolon is encountered .FNAME delete the semicolon .L1 L1 contains part of string beginning with "." .L1 is an extention specified? .SETQ no, use the default extention .SETQ yes, EXT is L1 with "." removed .UNTIL strip off extention characters from FNAME .SETQ and put FNAME back into normal order SVSAVE this routine saves al of the routines on this file (SAVE.VLI)