home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3.4.17 [SPARC, PA-RISC] / nextstep33_risc.iso / NextLibrary / TeX / tex / src / dvips / vmcms / maketexp.exec < prev    next >
Encoding:
Text File  |  1992-11-14  |  6.0 KB  |  168 lines

  1. /* MAKETEXP exec: based on the MakeTeXPK script for Unix. */
  2. /* This is version 1.0 as of 9 Nov. 1992.                 */
  3. /* Written by Jim Hafner (hafner@almaden.ibm.com).        */
  4. /*                                                        */
  5. /* Command is:                                            */
  6. /*    MakeTeXP fontname dpi basedpi magnification [mode]  */
  7. /* This is usually called by the DVIPS program or EXEC.   */
  8. /*                                                        */
  9.  
  10. /* END OF HEADER (this line must be preceded by a blank line) */
  11.  
  12. /* This is part of the VM/CMS distribution of Rokicki's DVIPS program.
  13.  * Installers may need to customize this exec extensively, though we
  14.  * have tried to make it as generic as possible.
  15.  *
  16.  * You are welcome to modify this exec in any way you choose.
  17.  *
  18.  * NOTE TO INSTALLERS:
  19.  *   1) For locations of some possible site dependencies, search for
  20.  *      'SITE DEPENDENCIES'.
  21.  *   2) This exec assumes that your Metafont MODULE is called MF MODULE.
  22.  *   3) It tries to bypass any front ends to this module by not invoking
  23.  *      EXEC MF but by calling MF directly.  This was intended to reduce
  24.  *      some site dependencies.
  25.  *   4) It assumes that you have a local modes definition file which
  26.  *      is the first thing MF will load.  The name of this file can
  27.  *      be changed by changing the 'localModeFile' variable.  If you
  28.  *      have no need for this then there are other changes that will
  29.  *      be required.   In particular, using this local mode def file
  30.  *      means that all output files will have their filenames based on
  31.  *      this name.  So, below we rename the output files so they match
  32.  *      the font name.   If you don't have a localModeFile then you
  33.  *      will need to modify this section of the code.
  34.  *
  35.  * NOTE:
  36.  *   This exec can be called either by DVIPS directly (when a font is
  37.  *   found missing and the automatic font generation is allowed in the
  38.  *   code itself) or by the DVIPS EXEC (if a MISSFONT LOG file is
  39.  *   created).  Consequently, any changes to either this exec or the
  40.  *   DVIPS EXEC may require changes to the other.
  41.  *
  42.  * THANKS:
  43.  *   This EXEC is based in large part on the Unix script version and on
  44.  *   some additional features in the version created by Alessio Guglielmi
  45.  *   (ALESSIO@IPISNSIB.BITNET) as modified by Ronald Kappert (R.Kappert@
  46.  *   uci.kun.nl).   We acknowledge their contributions and their
  47.  *   assistence.
  48.  */
  49.  
  50. address 'COMMAND'
  51. basedpi = 300  /* pick your favorite default */
  52.  
  53. /************ SITE DEPENDENCIES **************************************/
  54. /* Use this variable for the filename of your local mode defs file. */
  55. /* This might be MODES (for modes.mf) or LOCAL (for local.mf).      */
  56. /* DO NOT ATTACH the '.MF' since this is used later as filename.    */
  57. LocalModeFile='MODES'
  58. /************ END OF SITE DEPENDENCIES */
  59. parse arg fn dpi bdpi mag mode .
  60. upper fn mag
  61. if fn='' | fn='?' then signal show_header
  62. if bdpi = '' then bdpi = basedpi ;
  63.  
  64. if mode ='' then /* we use bdpi to select mode; this is site dependent */
  65.    select;
  66.      when bdpi = 300 then mode = "CanonCX" ;   /* same as imagen */
  67.      when bdpi = 400 then mode = "nexthi" ;
  68.      when bdpi = 100 then mode = "nextscreen" ;
  69.      when bdpi = 600 then mode = "varitype" ;
  70.      when bdpi = 635 then mode = "linolo" ;
  71.      when bdpi = 1270 then mode = "linohi" ;
  72.      when bdpi = 2540 then mode = "linosuper" ;
  73.      otherwise do
  74.        say "I don't know the mode for base resolution "bdpi
  75.        say "Have your system administrator update MakeTeXPK EXEC"
  76.        end
  77.      end
  78. gftype=dpi'GF'   /* File types are always <size>GF'  */
  79. pktype=dpi'PK'   /* File types are always <size>PK'  */
  80.  
  81. /* =0 if not there, =1 if on A-disk, =2 if on another disk */
  82.  
  83. gfthere=Whereis(fn gftype) ;
  84. mfthere=Whereis(fn 'MF') ;
  85. tfmthere=Whereis(fn 'TFM') ;
  86.  
  87. if (gfthere = 0 & mfthere = 0 ) then call failure
  88.  
  89. parse var mag "MAGSTEP\("magstep"\)"
  90.  
  91. if magstep="" then mag=dpi/bdpi
  92. else mag="magstep "magstep
  93.  
  94.  
  95. /* now run Metafont is there is no GF file */
  96.  
  97. if gfthere = 0 then do
  98.    /* build up Metafont arguments */
  99.    mfargs=''                           /* initialize */
  100. /********* SITE DEPENDENCIES, probably ***********/
  101.    mfargs='&plain 'mfargs              /* note, &plain is first */
  102.    mfargs=mfargs localModeFile         /* WE ASSUME THIS IS REQUIRED */
  103. /********* END OF SITE DEPENDENCIES **************/
  104.    mfargs=mfargs'; \mode='mode'; mag='mag'; scrollmode; input' fn
  105.  
  106. /*** NOTE: we call the module directly so that we can use this generic
  107.      syntax for the command line options.  Should be less SITE DEPENDENT
  108.      this way. ***/
  109.    push mfargs
  110.   'MF'
  111. /*** output filenames are all determined by 'localModeFile' so we
  112.      a) clean up the log, b) check to see that MF worked, and
  113.      c) rename things to 'fn'. ***/
  114.   'ERASE' localModeFile' MFLOG A'
  115.   'STATE' localModeFile gftype 'A'
  116.   if rc ^=0 then call mffailure   /* no gf file was created */
  117.     else do
  118.         'RENAME' localModeFile gftype 'A' fn '= ='
  119.         'RENAME' localModeFile' TFM A' fn '= ='
  120.     end
  121. end
  122.  
  123.  
  124. /* now we can call GFtoPK since everything is OK */
  125. 'EXEC GFTOPK 'fn gftype' * 'fn pktype' A'
  126. if rc ^= 0 then call gffailure
  127.  
  128. /* we erase junk on the A-disk if there wasn't anything there before */
  129. if gfthere^=1 then 'ERASE 'fn gftype' A'
  130. if tfmthere^=1 then 'ERASE 'fn 'TFM A'
  131. exit 0
  132.  
  133. failure:
  134.   say "Can't find either the MF or GF file for this font so will exit." ;
  135.   exit 100 ;
  136.  
  137. mffailure:
  138.   say "Metafont failed for some reason.  I'll have to exit." ;
  139.   exit 200 ;
  140.  
  141. mffailure:
  142.   say "GFtoPK failed for some reason.  I'll have to exit." ;
  143.   exit 300 ;
  144.  
  145. show_header:
  146.    index=1
  147.    line=Sourceline(index)
  148.    Do While Substr(line,1,2)="/*"
  149.       parse var line '/*' middle '*/'
  150.       say middle
  151.       index=index+1
  152.       line=Sourceline(index)
  153.       End
  154.    Exit
  155.  
  156. Whereis:
  157.    arg fn ft
  158.    there = 0
  159.    'MAKEBUF'
  160.    'LISTFILE' fn ft '* (STACK'
  161.    if rc = 0 then do    /* found some version of file */
  162.         pull . . fm .
  163.         if 'ABBREV'(fm,"A",1) then there = 1; else there = 2 ;
  164.         end
  165.    'DROPBUF'
  166.    return there ;
  167.  
  168.