home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fonts 1 / freshfonts1.bin / bbs / programs / amiga / pastex13.lha / DVIPS / dvips5519.lha / dvips / vmcms / texc.exec < prev   
Text File  |  1992-11-15  |  4KB  |  132 lines

  1. /* TEXC exec: based on the texc.script for Unix.                 */
  2. /* This is version 2.0 as of 9 Nov. 1992.                        */
  3. /* Written by Jim Hafner (hafner@almaden.ibm.com).               */
  4. /*                                                               */
  5. /* Command is:                                                   */
  6. /*      TEXC [ifn.[ift [ofn.[oft]]]]                             */
  7. /* Note: filemodes are not USED in the input and output file     */
  8. /*       name specification.  They default to '*' and 'A' for    */
  9. /*       the input and output files, respectively.               */
  10. /*                                                               */
  11. /* The defaults:                                                 */
  12. /*   ifn: TEX     ift: LPRO                                      */
  13. /*   ofn: TEXC    oft: LPRO                                      */
  14.  
  15. /* END OF HEADER (this line must be preceded by a blank line)    */
  16.  
  17. /* This program is part of the VM/CMS version of DVIPS, a TeX dvi to
  18.  * PostScript driver written by Tom Rokicki.  It is used in the MKDVIPS
  19.  * procedure to build the TEXC.LPRO file from the TEX.LPRO file.  This is
  20.  * then followed by SQEEZE to remove the comment lines and pack the files
  21.  * tighter.
  22.  *
  23.  * You are welcome to modify this exec in any way you choose.
  24.  *
  25.  * It reads the input file and deletes all the lines between and
  26.  * including
  27.  *    % begin code for uncompressed fonts only
  28.  * and
  29.  *    % end code for uncompressed fonts only
  30.  * Then it strips the leading % comment symbol from all the succeeding
  31.  * lines up to and including the line
  32.  *    % % end of code for unpacking compressed fonts
  33.  *
  34.  * THANKS:
  35.  *   Many thanks to Ronald Kappert (R.Kappert@uci.kun.nl) for sending
  36.  *   me many suggestions to enhance the support for this program.
  37.  *   Also, Michel Goossens (goossens@cernvm.cern.ch) for other ideas
  38.  *   and helping with the testing.
  39.  */
  40.  
  41. parse upper source . . execfn execft execfm .
  42. parse upper arg ifn'.'ift ofn'.'oft .
  43.  
  44. default_ifn = 'TEX';  default_ofn = 'TEXC'
  45.  
  46. default_ift = 'LPRO'; ifm = '*';
  47. default_oft = 'LPRO'; ofm = 'A1';
  48.  
  49. if ifn = '?' then signal show_header ;
  50.  
  51. if ifn = '' then ifn = default_ifn
  52. if ift = '' then ift = default_ift
  53. if ofn = '' then ofn = default_ofn
  54. if oft = '' then oft = default_oft
  55. upper ofn oft ofm
  56.  
  57. address 'COMMAND'
  58.  
  59. 'STATE' ifn ift ifm
  60. if rc^=0 then signal input_state_error
  61.  
  62. 'STATE' ofn oft ofm
  63. if rc=0 then do
  64.    say execfn': Output File' ofn oft ofm 'already exists.'
  65.    say execfn': Will overwrite with new version.'
  66.    "ERASE "ofn oft ofm
  67.    end
  68. else if rc^=28 then signal output_state_error
  69.  
  70.  
  71. 'MAKEBUF'; lev = rc;
  72.  
  73. outputon = 1
  74. stripcomment = 0
  75.  
  76. do forever
  77.   'EXECIO 1 DISKR' ifn ift ifm '(VAR LINE'
  78.   if rc ^= 0 then leave
  79.   parse var line comment text
  80.   if ( comment = "%" &,
  81.             delword(text,5) = "begin code for uncompressed" ) then do
  82.     outputon = 0
  83.     stripcomment = 0
  84.     end
  85.   if (comment = "%" &,
  86.             delword(text,5) = "% here's the alternate" ) then do
  87.     stripcomment = 1
  88.     outputon = 1
  89.     end
  90.   if ( outputon == 1 & stripcomment == 1 ) then
  91.     'EXECIO 1 DISKW' ofn oft ofm '(STRING' text
  92.   else if ( outputon = 1 & stripcomment == 0 ) then
  93.     'EXECIO 1 DISKW' ofn oft ofm '(STRING' line
  94.   if (comment = "%" &,
  95.             delword(text,7) = "% end of code for unpacking" ) then do
  96.     stripcomment = 0
  97.     outputon = 1
  98.     end
  99. end
  100. 'DROPBUF' lev
  101. 'FINIS' ifn ift ifm
  102. 'FINIS' ofn oft ofm
  103.  
  104. exit
  105.  
  106.  
  107. show_header:
  108.    index=1
  109.    line=Sourceline(index)
  110.    Do While Substr(line,1,2)="/*"
  111.       parse var line '/*' middle '*/'
  112.       say middle
  113.       index=index+1
  114.       line=Sourceline(index)
  115.       End
  116.    Exit
  117.  
  118.  
  119. input_state_error:
  120.   if  rc = 28 then say execfn': Input File' ifn ift ifm 'does not exist.'
  121.   else if rc = 36 then say execfn': Disk' ifm 'not accessed.'
  122.   else                 say execfn': Error reading 'ifn ift ifm'.'
  123.   exit rc
  124.  
  125. output_state_error:
  126.   if rc = 36 then say execfn': Disk' ofm 'not accessed.'
  127.   else            say execfn': Error writing to 'ofn oft ofm'.'
  128.   exit rc
  129.  
  130. /* exit */
  131.  
  132.