(**************************************************) (*-------> Include file #1 for XREF.PAS <------*) (**************************************************) (* v. 0300pm, sun, 28.Sep.86, Glen Ellis *) (*--------------------------------------------*) (* *) (* primary procedure pInitialize *) (* *) (*--------------------------------------------*) procedure pInitialize ( var IKeyModeChar : string1 ); VAR Ch: Char; (*------------------------------*) (* sub procedure of pInitialize *) procedure pConnectFiles (var ConnectFlag : boolean; var CFKeyModeChar : string1 ); TYPE Linebuffer = string[80]; VAR ix : byte; InChar : Char; DotLen : integer; DotPos : integer; (*--------------------------------*) (* sub procedure of pConnectFiles *) procedure pGetNames( var GNKeyModeChar : string1 ); var OKchar : char; (* OK controller char *) GetNameChar : char; (* get name char *) GetModeChar : char; (* get mode char *) AgainChar : char; AcceptChar : char; (* accept parameters char *) ok : boolean; x : integer; begin OKchar := ' '; REPEAT (* primary *) (* until OKchar = 'Y' *) WriteLn ('Enter complete filename ( .PRN, and .XRF appended as required)') ; Write('Input File: '); Readln(FileInID); (*---> Allow Exit *) DotLen := Length(FileInID); (* Use an available variable *) If DotLen = 0 then begin clrscr; writeln('No Filename Entered : HALT !'); HALT; (* for a quick Sanity check ! *) end; (*---> Append Extension *) (* since this version will parse both (* dBASE and TurboPascal source files, (* do not append a default extension. (**) (* DotPos := Pos( '.', FileInID ); (* If DotPos = 0 then (* If NO extension (.) *) (* begin (* FileInID := ( FileInID + '.PAS' ); (* DotPos := Pos( '.', FileInID ) (* end; (**) DotPos := Pos( '.', FileInID ); (* Get base filename with dot *) PrnOutID := Copy (FileInID, 1, DotPos); XrfID := Copy (FileInID, 1, DotPos) ; (* and add the proper extension for OutFile PRN and XRF *) PrnOutID := ( PrnOutID + 'PRN' ); XrfID := ( XrfID + 'XRF' ); (*-------> Always Display Parameters *) AcceptChar := ' '; WriteLn (' Input is from : ',FileInID); WriteLn (' Print Out to : ',PrnOutID); WriteLn (' Cross Ref to : ',XrfID); Write ('Are these parameters Accepable (Y/N) ? '); Read(Kbd,AcceptChar); writeln; AcceptChar := upcase(AcceptChar); (*-------> Again Fetch Parameters *) If AcceptChar <> 'Y' then begin ClrScr; gotoxy(00,05); Writeln('---> Supply Complete Filenames <---', chr(7) ); Write (' Input is from : ',FileInID,' : '); Readln(FileInID); Write (' Print Out to : ',PrnOutID,' : '); Readln(PrnOutID); Write (' Cross Ref to : ',XrfID,' : '); Readln(XrfID); Write (' Is this OK (Y/N) ? '); Read (Kbd,AgainChar); writeln; AgainChar := upcase(AgainChar); end; (**) REPEAT (* secondary *) (* until GNKeyModeChar = 'D','T' *) GNKeyModeChar := ' '; WriteLn('Enter dBASE or Turbo Pascal Source files ') ; Write(' Xref MODE : '); Readln(GNKeyModeChar); GNKeyModeChar := upcase(GNKeyModeChar); IF GNKeyModeChar = 'D' then writeln(' mode := dBASE'); IF GNKeyModeChar = 'T' then writeln(' mode := Turbo Pascal'); UNTIL GNKeyModeChar in ['D','T']; (* secondary *) (**) (*---> Always ? OK ? for exit *) OKchar := 'N'; Write (' Is this Information OK (Y/N) ? '); Read (Kbd,OKChar); writeln; OKchar := upcase(OKchar); UNTIL OKchar = 'Y'; (* primary *) end; (* "Sub Sub" Procedure pGetNames *) (*------------------------------*) (* sub procedure of pInitialize *) begin (* procedure pConnectFiles *) FileInID := ''; FatalErrorStatus := false; ConnectFlag := true; (*---> Get Parameters *) (**) (* CALL *) pGetNames( CFKeyModeChar ); (**) (*---> Files Opening Module *) Assign(FOut,PrnOutID); ReWrite(FOut); if IOresult <> 0 then begin WriteLn('Could not open ',PrnOutID,' (print output file).'); ConnectFlag := FALSE; FatalErrorStatus := TRUE; end; assign(xout,XrfID); ReWrite(Xout) ; if IOresult <> 0 then begin WriteLn('Could not open ',XrfID,' (xref output file).'); ConnectFlag := false; FatalErrorStatus := true; end; end; (* of pConnectFiles *) (*---------------------------------------------------*) (* *) (* primary procedure pINITIALIZE *) (* *) (*---------------------------------------------------*) begin (* procedure Initialize *) XrefTrace := true; (* sends each new word to screen *) IKeyModeChar := ' '; (* select dBASE / TurboPascal Keywords *) bell := ^G; GAPchar := ' ' ; Currentline := 0; (**) (* CALL *) pConnectFiles( ConnectFlag, IKeyModeChar ); (**) (* returns : *) (* ConnectFlag = logic *) (* IKeyModeChar = string1 *) (*--------------------------------*) (*------- Pascal KeyWords -------*) IF ConnectFlag and (IKeyModeChar = 'T') then begin Key[ 1] := 'ABSOLUTE'; Key[ 2] := 'AND'; Key[ 3] := 'ARRAY'; Key[ 4] := 'ASSIGN'; Key[ 5] := 'BEGIN'; Key[ 6] := 'BOOLEAN'; Key[ 7] := 'BYTE'; Key[ 8] := 'CASE'; Key[ 9] := 'CHAIN'; Key[10] := 'CHAR'; Key[11] := 'CHR'; Key[12] := 'CLOSE'; Key[13] := 'CONCAT'; Key[14] := 'CONST'; Key[15] := 'COPY'; Key[16] := 'DELETE'; Key[17] := 'DIV'; Key[18] := 'DO'; Key[19] := 'DOWNTO'; Key[20] := 'ELSE'; Key[21] := 'END'; Key[22] := 'EOF'; Key[23] := 'EOLN'; Key[24] := 'EXECUTE'; Key[25] := 'EXIT'; Key[26] := 'EXTERNAL'; Key[27] := 'FALSE'; Key[28] := 'FILE'; Key[29] := 'FILLChar'; Key[30] := 'FOR'; Key[31] := 'FORWARD'; Key[32] := 'FUNCTION'; Key[33] := 'GOTO'; Key[34] := 'IF'; Key[35] := 'IN'; Key[36] := 'INLINE'; Key[37] := 'INPUT'; Key[38] := 'INTEGER'; Key[39] := 'LABEL'; Key[40] := 'LENGTH'; Key[41] := 'MOD'; Key[42] := 'NIL'; Key[43] := 'NOT'; Key[44] := 'OF'; Key[45] := 'OR'; Key[46] := 'ORD'; Key[47] := 'OUTPUT'; Key[48] := 'PACKED'; Key[49] := 'PROCEDURE'; Key[50] := 'PROGRAM'; Key[51] := 'REAL'; Key[52] := 'RECORD'; Key[53] := 'REPEAT'; Key[54] := 'SET'; Key[55] := 'SHL'; Key[56] := 'SHR'; Key[57] := 'STRING'; Key[58] := 'SUCC'; Key[59] := 'TEXT'; Key[60] := 'THEN'; Key[61] := 'TO'; Key[62] := 'TRUE'; Key[63] := 'TYPE'; Key[64] := 'UNTIL'; Key[65] := 'VAR'; Key[66] := 'WHILE'; Key[67] := 'WITH'; Key[68] := 'WRITE'; Key[69] := 'WRITELN'; Key[70] := 'XOR'; NumKeys := 70; (**) TabChar := CHR(9); { ASCII TabChar Character } FormFeedChar := CHR(12); GAPchar := CHR(32); Write('List file to console (Y/N)? :'); Read(kbd,Ch); Listing := ( (Ch='Y') OR (Ch='y') ); WriteLn; WriteLn; end; (* IF ConnectFlag and IKeyModeChar = 'T' *) (*-------------------------------*) (*------- dBASE KeyWords -------*) IF ConnectFlag and (IKeyModeChar = 'D') then begin Key[ 1] := 'ACCEPT'; Key[ 2] := 'ADD'; Key[ 3] := 'ALL'; Key[ 4] := 'ALTERNATE'; Key[ 5] := 'AND'; Key[ 6] := 'APPEND'; Key[ 7] := 'ARCHIVE'; Key[ 8] := 'ASCENDING'; Key[ 9] := 'BEFORE'; Key[10] := 'BLANK'; Key[11] := 'BOTTOM'; Key[12] := 'BROWSE'; Key[13] := 'CANCEL'; Key[14] := 'CASE'; Key[15] := 'CHANGE'; Key[16] := 'CLEAR'; Key[17] := 'CONTINUE'; Key[18] := 'COPY'; Key[19] := 'COUNT'; Key[20] := 'CREATE'; Key[21] := 'DATE'; Key[22] := 'DEFAULT'; Key[23] := 'DELETE'; Key[24] := 'DESCENDING'; Key[25] := 'DISPLAY'; Key[26] := 'DO'; Key[27] := 'EDIT'; Key[28] := 'EJECT'; Key[29] := 'ELSE'; Key[30] := 'ENDCASE'; Key[31] := 'ENDDO'; Key[32] := 'ENDIF'; Key[33] := 'ERASE'; Key[34] := 'FIELD'; Key[35] := 'FILES'; Key[36] := 'FIND'; Key[37] := 'FOR'; Key[38] := 'FORM'; Key[39] := 'FORMAT'; Key[40] := 'FRONT'; Key[41] := 'GET'; Key[42] := 'GETS'; Key[43] := 'GO'; Key[44] := 'GOTO'; Key[45] := 'HEADING'; Key[46] := 'IF'; Key[47] := 'INDEX'; Key[48] := 'INSERT'; Key[49] := 'JOIN'; Key[50] := 'LIKE'; Key[51] := 'LIST'; Key[52] := 'LOCATE'; Key[53] := 'LOOP'; Key[54] := 'MARGIN'; Key[55] := 'MEMORY'; Key[56] := 'MODIFY'; Key[57] := 'NOTE'; Key[58] := 'OFF'; Key[59] := 'ON'; Key[60] := 'OR'; Key[61] := 'OTHERWISE'; Key[62] := 'PACK'; Key[63] := 'PICTURE'; Key[64] := 'PRIMARY'; Key[65] := 'PRINT'; Key[66] := 'QUIT'; Key[67] := 'READ'; Key[68] := 'RECALL'; Key[69] := 'RECORD'; Key[70] := 'REINDEX'; Key[71] := 'RELEASE'; Key[72] := 'REMARK'; Key[73] := 'RENAME'; Key[74] := 'REPLACE'; Key[75] := 'REPORT'; Key[76] := 'RESET'; Key[77] := 'RESTORE'; Key[78] := 'RETURN'; Key[79] := 'SAVE'; Key[80] := 'SAY'; Key[81] := 'SELECT'; Key[82] := 'SET'; Key[83] := 'SKIP'; Key[84] := 'SORT'; Key[85] := 'STORE'; Key[86] := 'STRUCTURE'; Key[87] := 'SUM'; Key[88] := 'TO'; Key[89] := 'TOP'; Key[90] := 'TOTAL'; Key[91] := 'UPDATE'; Key[94] := 'USE'; Key[95] := 'USING'; Key[96] := 'WAIT'; Key[97] := 'WHILE'; Key[98] := 'WITH'; NumKeys := 99; (**) TabChar := CHR(9); { ASCII TabChar Character } FormFeedChar := CHR(12); GAPchar := CHR(32); Write('List file to console (Y/N)? :'); Read(kbd,Ch); Listing := ( (Ch='Y') OR (Ch='y') ); WriteLn; WriteLn; end; (* IF ConnectFlag and IKeyModeChar = 'D' *) end; (* of Initialize *) (***************************************************************) (*:B:0*)