home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / useful / text / tex / pastex / mf / rexx / makebatch.rexx < prev    next >
OS/2 REXX Batch file  |  1994-05-11  |  5KB  |  183 lines

  1. /*
  2. ** AREXX MakeBatch 1.04
  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. **    1.04: + DVIPS 5.523 *does* support correct pkdir
  65. **          ! "DVIPSPKDIR" removed
  66. **          Andreas Scherer 2.5.94
  67. */
  68.  
  69. BATCHNAME    = "MF:MakeTeXFont.sh"
  70. FONTFILENAME = "TeX:config/fontvols"
  71. MAKETEXFONT  = "MF:rexx/MakeTeXFont"
  72.  
  73. If ~Show('Libraries','rexxsupport.library') Then Do
  74.   If ~AddLib('rexxsupport.library',0,-30) Then Do
  75.     Say "No RexxSupport ... no Metafont"
  76.     Exit 10
  77.   End
  78. End
  79.  
  80. Address COMMAND
  81.  
  82. If ~Exists(BATCHNAME) Then Do
  83.   If ~Open(BATCHFILE,BATCHNAME,'W') Then Do
  84.     Say "MakeBatch: Could not create "BATCHNAME" !"
  85.     Exit 10
  86.   End; Else Do
  87.     Call Writeln(BATCHFILE,";# Batchfile for font generation")
  88.     If Close(BATCHFILE) Then Do
  89.       'Protect 'BATCHNAME' Add s'
  90.       Say "MakeBatch: Batchfile "BATCHNAME" created."
  91.     End; Else Do
  92.       Say "MakeBatch: Error during creation of "BATCHNAME" !"
  93.       Exit 10
  94.     End
  95.   End
  96. End
  97.  
  98. Parse Arg PARAMETERS
  99. Parse Value PARAMETERS With FNTNAME DPI HBASEDPI VBASEDPI DRIVERTYPE PKFILENAME PKDIR .
  100.  
  101. /*
  102. ** Only ShowDVI and DVIPrint of version >= 1.08 supply arguments
  103. ** <drivertype> (show/print) and <pkfilename> (for example "120/cmr10.pk")
  104. **
  105. ** Only ShowDVI and DVIPrint of version >= 1.10 supply the argument <pkdir>
  106. **
  107. ** DVIPS 5.47 supplies <drivertype> <pkfilename> and <pkdir>, but <pkdir>
  108. ** is NOT correct!  It is always "TeX:pk/" instead of the directory given
  109. ** in "config.ps".
  110. **
  111. ** DVIPS 5.523 supplies <drivertype> <pkfilename> and <pkdir> correctly
  112. ** as given in "config.ps".
  113. */
  114.  
  115. /*
  116. ** Insert fontcaching for DVIPS.
  117. */
  118. If DRIVERTYPE="dvips" Then Do
  119.   If Open('fontfile', fontfilename, 'read') Then Do
  120.     Do  Until EOF('fontfile')
  121.       LINE = readln('fontfile')
  122.       If Pos(';', line) > 0 Then
  123.         LINE = Left(LINE, Pos(';', LINE)-1)
  124.       Parse Var LINE DISK'='ddd'd.'LINE
  125.       If DDD=HBASEDPI Then Do
  126.         Do Until LINE = ''
  127.           Parse Var LINE DIR'.'LINE
  128.           If DIR=DPI Then Do
  129.             If Exists(DISK':'PKFILENAME) Then Do
  130.               FULLNAME=PKDIR||PKFILENAME
  131.               DIRNAME=Left(FULLNAME, LastPos('/', FULLNAME)-1)
  132.               If ~Exists(DIRNAME) Then Do
  133.                 Say 'makedir 'DIRNAME
  134.                 MakeDir DIRNAME
  135.               End
  136.               Say 'copy 'DISK':'PKFILENAME' 'FULLNAME
  137.               Copy DISK':'PKFILENAME' 'PKDIR||PKFILENAME' QUIET NOREQ'
  138.               If ~Close('fontfile') Then
  139.                 Say "Can't close "fontfilename"-file!"
  140.               Exit
  141.             End /* If Exists */
  142.           End /* If DIR=DPI */
  143.         End /* Do Until LINE */
  144.       End /* If DDD */
  145.     End /* Do Until EOF */
  146.     If ~Close('fontfile') Then
  147.       Say "Can't close "fontfilename"-file!"
  148.   End /* If Open */
  149.   Else Say "Couldn't find file "fontfilename
  150. End /* If DRIVERTYPE */
  151.  
  152. /*
  153. ** Say "MakeBatch: Font named = "FNTNAME" with dpi = "DPI" and base x = "HBASEDPI"  y = "VBASEDPI
  154. ** If DRIVERTYPE ~= "" Then
  155. **   Say " for driver = "DRIVERTYPE", pkname = "PKFILENAME
  156. */
  157.  
  158. MESSAGE = 'rx 'MAKETEXFONT PARAMETERS
  159.  
  160. 'Search >NIL: 'BATCHNAME' "'MESSAGE'"'
  161. /*
  162. ** Better: Search for FNTNAME, DPI, HBASEDPI and VBASEDPI only?
  163. */
  164.  
  165. If RC ~=0 Then Do
  166.   If ~Open(BATCHFILE,BATCHNAME,'Append') Then Do
  167.     Say "MakeBatch: Can't open "BATCHNAME" to add new entry"
  168.     Exit 10
  169.   End
  170.  
  171.   DUMMY = Writeln(BATCHFILE,MESSAGE)
  172.  
  173.   If Close(BATCHFILE) Then
  174.     Say "MakeBatch: New entry added for "FNTNAME DPI" dpi"
  175.   Else Do
  176.     Say "MakeBatch: Error while adding new entry!"
  177.     Exit 10
  178.   End
  179. End; Else 
  180.   Say "MakeBatch: Entry already exists!"
  181.  
  182. Exit 0
  183.