home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / pascal / pxl214a / makrsrv.pas next >
Encoding:
Pascal/Delphi Source File  |  1989-07-05  |  2.5 KB  |  74 lines

  1. {$A+,B-,D-,E+,F-,I+,L-,N-,O-,R+,S+,V+}
  2. {$M 16384,0,0}
  3.  
  4. program MakeReserve;
  5.  
  6. { A utility program to help update PXL with new Turbo Pascal reserved words.}
  7. { After you put new reserved words into PXL.WDS, run this program.  It will }
  8. {                                                                           }
  9. {  (a) read PXL.WDS,                                                        }
  10. {  (b) create a file with the name given in constant TempFileName, below, & }
  11. {  (c) write in it a new procedure IntWds4                                  }
  12. {                                                                           }
  13. { Substitute this new procedure IntWds4 for the old IntWds4 in procedure    }
  14. { LoadReserv in PXLMENU.PAS.                                                }
  15. {                                                                           }
  16. {    This needs to be done, of course, only if you set DataFiles := False   }
  17. { (in PXL.PAS, procedure SetUp) to use PXL's internal data aboutr reserved  }
  18. { words and printer controls.                                               }
  19.  
  20. uses DOS,CRT,PXLINIT;
  21. const
  22.    TempFileName = 'INTWDS4.PAS';
  23. type
  24.    LineType = string[80];
  25. var
  26.    F:           text;
  27.    NRes,K:      integer;
  28.    ResWd:       array[1..100] of LineType;
  29.    Line,St:     LineType;
  30.  
  31.    procedure Emit(L: LineType);
  32.    begin
  33.       writeln(F,L);
  34.       writeln(L);
  35.    end; {Emit}
  36.  
  37. begin
  38.    assign(F,'PXL.WDS');
  39.    reset(F);
  40.    NRes := 0;
  41.    while not Eof(F) do begin
  42.       readln(F,St);
  43.       if St<>'' then begin
  44.          inc(NRes);
  45.          ResWd[NRes] := Strip(InCapitals(St),[]);
  46.       end; {if not empty}
  47.    end; {while not Eof}
  48.    if NRes=0 then begin
  49.       Writeln('Huh?');
  50.       halt
  51.    end; {if none}
  52.    close(F);
  53.    assign(F,TempFileName);
  54.    rewrite(F);
  55.    Emit('   procedure IntWds4; {This version for TP 4 & 5}');
  56.    Emit('   begin');
  57.    Emit('      {if DataFiles = False, reserved words will be set thus:}');
  58.    Emit('      NRes := ' + StrgI(NRes,1));
  59.    for K := 1 to NRes do begin
  60.       if Odd(K) then
  61.          Line := '      Reserv[' + StrgI(K,1) + '] := ''' + ResWd[K] + ''';'
  62.       else begin
  63.          Line := PadOrChop(Line,39);
  64.          Line := Line + 'Reserv[' + StrgI(K,1) + '] := ''' + ResWd[K] + ''';';
  65.          Emit(Line);
  66.       end {else even}
  67.    end; {For K}
  68.    if odd(NRes) then Emit(Line);
  69.    Emit('   end; {IntWds4}');
  70.    Emit(' ');
  71.    close(F);
  72.    writeln('All done.  New procedure IntWds4 is in ',TempFileName);
  73. end.
  74.