home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / text / tex / pastex / source / dvips / amiga / texc.rexx < prev   
Encoding:
OS/2 REXX Batch file  |  1994-09-29  |  1.2 KB  |  63 lines

  1. /*
  2. **    ARexx script to transform `tex.lpro' into `texc.lpro'
  3. **
  4. **    Written by Giuseppe Ghibò <ghibo@galileo.polito.it>
  5. **    Version 1.0 (28 Sep 1994).
  6. */
  7.  
  8. Signal On Break_C
  9. Signal On Error
  10.  
  11. If ~Open('inputfile',"tex.lpro",'Read') Then Do
  12.     Say "Can't find file 'tex.lpro'"
  13.     Exit
  14. End
  15.  
  16. If ~Open('outputfile',"T:texc.lpro",'Write') Then Do
  17.     Say "Can't open file 'T:texc.lpro'"
  18.     Exit
  19. End
  20.  
  21. mode = 'COPY'
  22.  
  23. Do While ~Eof('inputfile')
  24.  
  25.     line = ReadLn('inputfile')
  26.  
  27.     If line = "% begin code for uncompressed fonts only" Then mode = 'ADD'
  28.  
  29.     If line = "% end code for uncompressed fonts only" Then
  30.         Do
  31.             mode = 'COPY'
  32.             count = WriteCh('outputfile',"% ")
  33.         End
  34.  
  35.     If line = "% % here's the alternate code for unpacking compressed fonts" Then mode = 'DEL'
  36.  
  37.     If line = "% % end of code for unpacking compressed fonts" Then
  38.         Do
  39.             line = SubStr(line, 3)
  40.             mode = 'COPY'
  41.         End
  42.  
  43.     Select
  44.         when mode = 'COPY' Then count = WriteLn('outputfile', line)
  45.  
  46.         when mode = 'ADD' Then count = WriteLn('outputfile', "% " || line)
  47.  
  48.         when mode = 'DEL' Then count = WriteLn('outputfile', SubStr(line,3))
  49.     End
  50. End
  51.  
  52. result = Close('inputfile')
  53. result = Close('outputfile')
  54.  
  55. Exit 0
  56.  
  57. Break_C:
  58.     Say 'Break detected at line' SIGL
  59.     Exit
  60.  
  61. Error:
  62.     Say 'Error detected at line' SIGL
  63.