home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 2 / FFMCD02.bin / new / text / font / metafont / rexx / makebatch.rexx next >
Encoding:
OS/2 REXX Batch file  |  1993-12-21  |  5.1 KB  |  177 lines

  1. /*
  2. ** AREXX MakeBatch 1.03
  3. **
  4. ** Send new features and bug reports to 
  5. **
  6. ** Martin Bokaemper
  7. ** Reuthstr. 12
  8. ** 91099 Poxdorf
  9. ** Germany
  10. **
  11. ** Email:  mnbokaem@cip.e-technik.uni-erlangen.de 
  12. **         Zerberus: mab@ame.ZER 
  13. **
  14. ** Ulrich Wisser
  15. ** Heerstr. 125
  16. ** 53111 Bonn
  17. **
  18. ** HISTORY:
  19. **    0.80: My 'works-fine-for-me' version slightly modified by
  20. **          Georg Hessmann 13.04.91
  21. **          + set script bit of the batchfile 
  22. **
  23. **    0.81: + take new Parameters 'drivertype' and 'pkfilename' 
  24. **          Georg Hessmann 17.04.91
  25. **
  26. **    0.82: + History 
  27. **          + some small changes 
  28. **          Martin Bokaemper 17.04.91
  29. **
  30. **    0.83: + improved batchfile creation
  31. **          + More messages for the user
  32. **          J\"org H\"ohle 25.04.91
  33. **
  34. **    0.84: + add new parameter 'pkdir' (new since driver version V1.10)
  35. **          + add the dummy variable
  36. **          Georg Hessmann 09.06.91
  37. **
  38. **    0.85
  39. **    0.86: + bumped revision number because of MakeTeXFont
  40. **          + changed script file extension to .sh
  41. **          J\"org H\"ohle 06.08.91
  42. **
  43. **    0.90: + bumped revision number because of MakeTeXFont
  44. **          Georg Hessmann 28.08.91
  45. **
  46. **    1.0:  + add fontcaching for DVIPS-driver
  47. **          ! DVIPS doesn't supply correct pkdir, please adapt
  48. **          ! "DVIPSPKDIR" to your needs
  49. **          + MakeTeXFont added
  50. **          Ulrich Wisser 25.08.92
  51. **
  52. **    1.01: + DVIPS fontcaching enhanced to infinity resolutions per disk.
  53. **          ! This was done while I set up my Redis distribution.  All
  54. **          ! fonts for one driver fit on one disk, which means 37 dirs
  55. **          ! for ShowDVI.
  56. **          Ulrich Wisser 5.10.92
  57. **
  58. **    1.02: + DVIPS fontcaching enhanced.  pk-subdirectories now created.
  59. **          Ulrich Wisser 9.12.92
  60. **
  61. **    1.03: + bumped revision number because of partial integration
  62. **          Andreas Scherer 30.10.93
  63. */
  64.           
  65. BATCHNAME    = "MF:MakeTeXFont.sh"
  66. FONTFILENAME = "TeX:config/fontvols"
  67. DVIPSPKDIR   = "TeX:pk/Laser/"
  68. MAKETEXFONT  = "MF:rexx/MakeTeXFont"
  69.  
  70. If ~Show('Libraries','rexxsupport.library') Then Do
  71.   If ~AddLib('rexxsupport.library',0,-30) Then Do
  72.     Say "No RexxSupport ... no Metafont"
  73.     Exit 10
  74.   End
  75. End
  76.  
  77. Address COMMAND
  78.  
  79. If ~Exists(BATCHNAME) Then Do
  80.   If ~Open(BATCHFILE,BATCHNAME,'W') Then Do
  81.     Say "MakeBatch: Could not create "BATCHNAME" !"
  82.     Exit 10
  83.   End; Else Do
  84.     Call Writeln(BATCHFILE,";# Batchfile for font generation")
  85.     If Close(BATCHFILE) Then Do
  86.       'Protect 'BATCHNAME' Add s'
  87.       Say "MakeBatch: Batchfile "BATCHNAME" created."
  88.     End; Else Do
  89.       Say "MakeBatch: Error during creation of "BATCHNAME" !"
  90.       Exit 10
  91.     End
  92.   End
  93. End
  94.  
  95. Parse Arg PARAMETERS
  96. Parse Value PARAMETERS With FNTNAME DPI HBASEDPI VBASEDPI DRIVERTYPE PKFILENAME PKDIR .
  97.  
  98. /*
  99. ** Only ShowDVI and DVIPrint of version >= 1.08 supply arguments
  100. ** <drivertype> (show/print) and <pkfilename> (for example "120/cmr10.pk")
  101. **
  102. ** Only ShowDVI and DVIPrint of version >= 1.10 supply the argument <pkdir>
  103. **
  104. ** DVIPS 5.47 supplies <drivertype> <pkfilename> and <pkdir>, but <pkdir>
  105. ** is NOT correct!  It is always "TeX:pk/" instead of the directory given
  106. ** in "config.ps".
  107. */
  108.  
  109. /*
  110. ** Insert fontcaching for DVIPS.
  111. */
  112. If DRIVERTYPE="dvips" Then Do
  113.   If Open('fontfile', fontfilename, 'read') Then Do
  114.     Do  Until EOF('fontfile')
  115.       LINE = readln('fontfile')
  116.       If Pos(';', line) > 0 Then
  117.         LINE = Left(LINE, Pos(';', LINE)-1)
  118.       Parse Var LINE DISK'='ddd'd.'LINE
  119.       If DDD=HBASEDPI Then Do
  120.         Do Until LINE = ''
  121.           Parse Var LINE DIR'.'LINE
  122.           If DIR=DPI Then Do
  123.             If Exists(DISK':'PKFILENAME) Then Do
  124.               FULLNAME=DVIPSPKDIR||PKFILENAME
  125.               DIRNAME=Left(FULLNAME, LastPos('/', FULLNAME)-1)
  126.               If ~Exists(DIRNAME) Then Do
  127.                 Say 'makedir 'DIRNAME
  128.                 MakeDir DIRNAME
  129.               End
  130.               Say 'copy 'DISK':'PKFILENAME' 'FULLNAME
  131.               Copy DISK':'PKFILENAME' 'DVIPSPKDIR||PKFILENAME' QUIET NOREQ'
  132.               If ~Close('fontfile') Then
  133.                 Say "Can't close "fontfilename"-file!"
  134.               Exit
  135.             End /* If Exists */
  136.           End /* If DIR=DPI */
  137.         End /* Do Until LINE */
  138.       End /* If DDD */
  139.     End /* Do Until EOF */
  140.     If ~Close('fontfile') Then
  141.       Say "Can't close "fontfilename"-file!"
  142.   End /* If Open */
  143.   Else Say "Couldn't find file "fontfilename
  144. End /* If DRIVERTYPE */
  145.  
  146. /*
  147. ** Say "MakeBatch: Font named = "FNTNAME" with dpi = "DPI" and base x = "HBASEDPI"  y = "VBASEDPI
  148. ** If DRIVERTYPE ~= "" Then
  149. **   Say " for driver = "DRIVERTYPE", pkname = "PKFILENAME
  150. */
  151.  
  152. MESSAGE = 'rx 'MAKETEXFONT PARAMETERS
  153.  
  154. 'Search >NIL: 'BATCHNAME' "'MESSAGE'"'
  155. /*
  156. ** Better: Search for FNTNAME, DPI, HBASEDPI and VBASEDPI only?
  157. */
  158.  
  159. If RC ~=0 Then Do
  160.   If ~Open(BATCHFILE,BATCHNAME,'Append') Then Do
  161.     Say "MakeBatch: Can't open "BATCHNAME" to add new entry"
  162.     Exit 10
  163.   End
  164.  
  165.   DUMMY = Writeln(BATCHFILE,MESSAGE)
  166.  
  167.   If Close(BATCHFILE) Then
  168.     Say "MakeBatch: New entry added for "FNTNAME DPI" dpi"
  169.   Else Do
  170.     Say "MakeBatch: Error while adding new entry!"
  171.     Exit 10
  172.   End
  173. End; Else 
  174.   Say "MakeBatch: Entry already exists!"
  175.  
  176. Exit 0
  177.