PROGRAM Tlist; { Copyright 1985 by Thomas E. Croley II; all commercial rights reserved. Written in TURBO PASCAL, Version 3.00A (CP/M-80, Z80), and released to the Public Domain 5 November 1985 by: Thomas E. Croley II Great Lakes Environmental Research Laboratory National Oceanic and Atmospheric Administration U. S. Department of Commerce 2300 Washtenaw Avenue Ann Arbor, Michigan 48104 Text : 7383 bytes (without INCLUDE files) File : 18144 bytes (CP/M-80 *.COM file size) Code : 9981 bytes (w/o TURBO v. 3.0 library) Data : 2059 bytes This program reads the file, supplied when invoked or when prompted for if not supplied when invoked, identifies 'reserved words', 'standard identifiers', and 'dedicated identifiers' used by TURBO PASCAL, and replaces them with 'highlighted' versions. The "highlights" may consist of bold, double-strike, expanded print, and so on, as supported by the user's printer. Upper case translation is also supported, if desired, as part of the highlight. The highlights may be defined as WordStar-oriented and a disk file generated for printing with WordStar OR they may be printer-specific codes and the program output can be directed directly to the printer (CP/M's LST: device) or to a disk file. The disk filename is formed from the source filename with the extension of 'PRN'. Command line options are: direction of output to either a disk file or to the printer, pause for paper change, and starting page number; they are automatically documented if TLIST is invoked with no command line. Include files are expanded in the printout but may not be nested (same as TURBO Pascal). Reserved words within strings or comments (or any combination of strings and comments) are not highlighted. Tabs are expanded should they be present in the source file (not usually found if the file was created with the TURBO editor). A good test of this program's capability is to use it to TLIST itself! This program can be changed easily to support additional reserved words, standard identifiers, or dedicated identifiers, or to change the highlighting to different forms among these groups, or to change the output page format, margin heading, or footer heading. All these changes can be made within the "CONST" declaration sections following in this file. Special notice also should be given to routine "User_ConIn" (found in include file MAIN.PAS), which is specific to the CP/M system, if adapting this program for use with other operating systems. } CONST Page_Length = 66; {ala WordStar} Margin_Top = 5; Margin_Bottom = 5; Header_Margin = 2; Footer_Margin = 2; Header_String {NEC Spinwriter 8810} = 'TURBO PASCAL v. 3.00A, for'^['+ CP/M-80, Z80 CPU'^[',,'; Footer_String = ''; Page_Offset = 13; Line_Width = 82; Max_word_length = 10; {maximum for all TURBO PASCAL words} Max_no_of_accent_bytes = 5; Max_new_word_length = 20; {allows 5 control codes on each end of word} Max_line_length = 255; No_Reserved_Words = 44; {TURBO PASCAL, V 3.00A, CP/M-80, Z80} No_Standard_Identifiers = 114; {TURBO PASCAL, V 3.00A, CP/M-80, Z80} No_Dedicated_Identifiers = 6; {TURBO PASCAL, V 3.00A, CP/M-80, Z80} Max_Table_size = 114; Filename_Length = 14; Res_Word_Hsh_size = 40; Stan_Ident_Hsh_size = 100; Ded_Ident_Hsh_size = 5; Max_Hash_size = 100; TYPE Reserved_Word_Type = ARRAY[1..No_Reserved_Words] OF STRING[Max_word_length]; Standard_Identifier_Type = ARRAY[1..No_Standard_Identifiers] OF STRING[Max_word_length]; Dedicated_Identifier_Type = ARRAY[1..No_Dedicated_Identifiers] OF STRING[Max_word_length]; Symbol_Type = STRING[Max_new_word_length]; Line_Type = STRING[Max_line_length]; {allows min of 12 substitutions} Accent_Type = STRING[Max_no_of_accent_bytes]; Filename_Type = STRING[Filename_Length]; CONST Reserved_Word_ST : Reserved_Word_Type = ('ABSOLUTE', 'AND', 'ARRAY', 'BEGIN', 'CASE', 'CONST', 'DIV', 'DO', 'DOWNTO', 'ELSE', 'END', 'EXTERNAL', 'FILE', 'FORWARD', 'FOR', 'FUNCTION', 'GOTO', 'INLINE', 'IF', 'IN', 'LABEL', 'MOD', 'NIL', 'NOT', 'OVERLAY', 'OF', 'OR', 'PACKED', 'PROCEDURE', 'PROGRAM', 'RECORD', 'REPEAT', 'SET', 'SHL', 'SHR', 'STRING', 'THEN', 'TYPE', 'TO', 'UNTIL', 'VAR', 'WHILE', 'WITH', 'XOR'); Standard_Identifier_ST : Standard_Identifier_Type = ('ADDR', 'ARCTAN', 'ASSIGN', 'AUX', 'AUXINPTR', 'AUXOUTPTR', 'BLOCKREAD', 'BLOCKWRITE', 'BOOLEAN', 'BUFLEN', 'BYTE', 'CHAIN', 'CHAR', 'CHR', 'CLOSE', 'CLREOL', 'CLRSCR', 'CON', 'CONINPTR', 'CONOUTPTR', 'CONCAT', 'CONSTPTR', 'COPY', 'COS', 'CRTEXIT', 'CRTINIT', 'DELLINE', 'DELAY', 'DELETE', 'EOF', 'EOLN', 'ERASE', 'EXECUTE', 'EXIT', 'EXP', 'FALSE', 'FILEPOS', 'FILESIZE', 'FILLCHAR', 'FLUSH', 'FRAC', 'GETMEM', 'GOTOXY', 'HALT', 'HEAPPTR', 'HI', 'IORESULT', 'INPUT', 'INSLINE', 'INSERT', 'INT', 'INTEGER', 'KBD', 'KEYPRESSED', 'LENGTH', 'LN', 'LO', 'LOWVIDEO', 'LST', 'LSTOUTPTR', 'MARK', 'MAXINT', 'MEM', 'MEMAVAIL', 'MOVE', 'NEW', 'NORMVIDEO', 'ODD', 'ORD', 'OUTPUT', 'PI', 'PORT', 'POS', 'PRED', 'PTR', 'RANDOM', 'RANDOMIZE', 'READ', 'READLN', 'REAL', 'RELEASE', 'RENAME', 'RESET', 'REWRITE', 'ROUND', 'SEEK', 'SIN', 'SIZEOF', 'SEEKEOF', 'SEEKEOLN', 'SQR', 'SQRT', 'STR', 'SUCC', 'SWAP', 'TEXT', 'TRM', 'TRUE', 'TRUNC', 'UPCASE', 'USR', 'USRINPTR', 'USROUTPTR', 'VAL', 'WRITE', 'WRITELN' ,'ABS', 'APPEND', 'DISPOSE', 'FREEMEM', 'MAXAVAIL', 'OVRDRIVE', 'PARAMCOUNT', 'PARAMSTR'); Dedicated_Identifier_ST : Dedicated_Identifier_Type = ('BIOS', 'BIOSHL', 'BDOS', 'BDOSHL', 'RECURPTR', 'STACKPTR'); {CP/M version} {Defaults for NEC Spinwriter 8810 printer...} Reserved_Word_Accent_begin : Accent_Type = ^['+'; {NEC bold} Reserved_Word_Accent_end : Accent_Type = ^[','; Standard_Identifier_Accent_begin : Accent_Type = ^['+'; {NEC bold} Standard_Identifier_Accent_end : Accent_Type = ^[','; Dedicated_Identifier_Accent_begin : Accent_Type = ^['+'; {NEC bold} Dedicated_Identifier_Accent_end : Accent_Type = ^[','; Reserved_Word_Upper_Case : BOOLEAN = TRUE; Standard_Identifier_Upper_Case : BOOLEAN = TRUE; Dedicated_Identifier_Upper_Case : BOOLEAN = TRUE; Header : STRING[100] = 'TLISTer v1.1 by Thomas E. Croley II, 5-Nov-85 [^C Aborts]'; VAR CmdLine : STRING[100] ABSOLUTE $80; Reserved_Word_HT : ARRAY[1..Res_Word_Hsh_size] OF INTEGER; Standard_Identifier_HT : ARRAY[1..Stan_Ident_Hsh_size] OF INTEGER; Dedicated_Identifier_HT : ARRAY[1..Ded_Ident_Hsh_size] OF INTEGER; Reserved_Word_CT : ARRAY[1..No_Reserved_Words] OF INTEGER; Standard_Identifier_CT : ARRAY[1..No_Standard_Identifiers] OF INTEGER; Dedicated_Identifier_CT : ARRAY[1..No_Dedicated_Identifiers] OF INTEGER; Text_File, Include_File, List_file : TEXT; Count, I, Dummy, Line_number, Page_number, Max_no_lines, LineCount, Starting_page_number : INTEGER; Symbol : Symbol_Type; Include_file_name : Filename_Type; Line : Line_Type; Comment, Strng, Paginate, DiskFile, Found, Include_file_present, Abort : BOOLEAN; Ch : CHAR; {$I HASHTBLS.PAS} {$I SEARCHRE.PAS} {$I SETUPHSH.PAS} {$I EXPNDTAB.PAS} {$I PARSER.PAS} {$I INCLUDE.PAS} {$I PROCLINE.PAS} {$I MAIN.PAS}