home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / os2tex_2.zip / disk4.zip / disk_4 / l2tools.cmd < prev    next >
OS/2 REXX Batch file  |  1997-12-29  |  5KB  |  222 lines

  1. /**/
  2.  
  3. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  4. call SysLoadFuncs
  5.  
  6.  
  7. parse arg language texmf source options
  8.  
  9.  
  10.  
  11.  
  12. if language='049' then do
  13.  
  14.   msg.10 = 'msg:LaTeX2e Tools: Erzeuge Dokumentation'
  15.   msg.11 = 'Lauf'
  16.   msg.12 = 'von'
  17.  
  18. end
  19. else do
  20.  
  21.   msg.10 = 'msg:LaTeX2e Tools: creating documentation'
  22.   msg.11 = 'run'
  23.   msg.12 = 'of'
  24.  
  25. end
  26.  
  27.  
  28.  
  29. say 'msg:LaTeX2e Tools'
  30.  
  31.  
  32. bin      = texmf||'\os2tex\bin'
  33. tfm      = texmf||'\fonts\tfm'
  34. tex      = texmf||'\tex'
  35. doc      = texmf||'\doc'
  36. fmt      = bin
  37.  
  38. target   = texmf||'\tex\latex\tools'
  39.  
  40. exec     = bin||'\tex.exe'
  41.  
  42.  
  43. install = texmf||'\os2tex\install'
  44.  
  45.  
  46.  
  47. if Pos("InstallFiles", options) > 0 then do
  48.  
  49.    install||'\kdir '||target
  50.  
  51.    'md '||tex
  52.    'md '||tex||'\latex'
  53.    'md '||tex||'\latex\tools'
  54.  
  55.  
  56.    say 'msg:LaTeX2e Tools entpacke Dateien'
  57.  
  58.  
  59.  
  60.    if directory(texmf||'\tex\latex') = '' then do
  61.  
  62.       exit 1
  63.  
  64.    end
  65.  
  66.   
  67.  
  68.    install||'\unzip '||source||'\l2tools.zip'
  69.  
  70.  
  71.  
  72.    say 'msg:LaTeX2e Tools tools.ins'
  73.  
  74.    exec||' -pf '||bin||' -po '||target||' -pi '||target||';'||tex||'\latex\base;'||bin||' '||'tools.ins'
  75.  
  76.  
  77.  
  78.  
  79. end
  80.  
  81.  
  82. /* Dokumentation erzeugen */
  83.  
  84.  
  85.  
  86. if SysOS2Ver() = '2.30' then
  87.   top = 48
  88. else
  89.   top = 45
  90.  
  91.  
  92.  
  93. if Pos("CreateObjects", options) > 0 then do
  94.  
  95.    classname = 'WPFolder'
  96.    objtitle  = 'LaTeX2e Tools'
  97.    location  = '<OS2TEX_DOC_FOLDER>'
  98.    setup     = 'OBJECTID=<OS2TEX_L2TOOLS_FOLDER>;ICONVIEW=MINI,NONFLOWED;ALWAYSSORT=YES;ICONVIEWPOS=50,50,25,'||top
  99.    duplicate = 'replace'
  100.  
  101.  
  102.    rc = SysCreateObject(classname,objtitle,location,setup,duplicate)
  103.  
  104.    if rc = 0 then do
  105.       exit 1
  106.    end
  107. end
  108.  
  109.  
  110.  
  111.  
  112. if Pos("InstallFiles", options) > 0 then do
  113.  
  114.    install||'\kdir '||texmf||'\doc\latex\tools'
  115.    'md '||texmf||'\doc'
  116.    'md '||texmf||'\doc\latex'
  117.    'md '||texmf||'\doc\latex\tools'
  118.  
  119.  
  120.  
  121.    call SysFileTree target||'\*.dtx', "filelist.", "FO"
  122.  
  123. end
  124.  
  125. else
  126.  
  127. if Pos("CreateObjects", options) > 0 then do
  128.  
  129.    call SysFileTree texmf||'\doc\latex\tools\*.dvi', "filelist.", "FO"
  130.  
  131. end 
  132.  
  133.  
  134. do i=1 to filelist.0
  135.  
  136.   dtx = filespec("N",filelist.i)
  137.   name = substr(dtx,1,length(dtx)-4)
  138.   idx = name||'.idx'
  139.   loc = name||'.loc'
  140.   lof = name||'.lof'
  141.   lot = name||'.lof'
  142.   toc = name||'.toc'
  143.   aux = name||'.aux'
  144.   glo = name||'.glo'
  145.  
  146.  
  147.  
  148.    if Pos("InstallFiles", options) > 0 then do
  149.  
  150.       say msg.10' 'filespec("N",filelist.i)' 'msg.11' 1 'msg.12' 3'
  151.       exec||' -r -ff latex.fmt -pf '||bin||' -po '||texmf||'\doc\latex\tools -pt '||tfm||' -pi '||target||';'||doc||'\latex\tools;'||tex||' '||filespec("N",filelist.i)
  152.  
  153.       k = 1
  154.       floc = 0
  155.       faux = 0
  156.       flof = 0
  157.       flot = 0
  158.       ftoc = 0
  159.       fglo = 0
  160.       fidx = 0
  161.       flabel = 0
  162.  
  163.       if stream(doc||'\latex\tools\'||loc, "C", "QUERY EXISTS") \= '' then floc = 1
  164.       if stream(doc||'\latex\tools\'||aux, "C", "QUERY EXISTS") \= '' then faux = 1
  165.       if stream(doc||'\latex\tools\'||lof, "C", "QUERY EXISTS") \= '' then flof = 1
  166.       if stream(doc||'\latex\tools\'||lot, "C", "QUERY EXISTS") \= '' then flot = 1
  167.       if stream(doc||'\latex\tools\'||toc, "C", "QUERY EXISTS") \= '' then ftoc = 1
  168.       if stream(doc||'\latex\tools\'||glo, "C", "QUERY EXISTS") \= '' then fglo = 1
  169.       if stream(doc||'\latex\tools\'||idx, "C", "QUERY EXISTS") \= '' then fidx = 1
  170.  
  171. /*
  172.  
  173.   if faux = 1 then do
  174.     if SysFileSearch("\newlabel", doc||'\latex\tools\'||aux, "") \= '' then flabel = 1
  175.   end
  176.  
  177.  
  178.   if fidx + flabel > 0 & ftoc + flof + flot > 0 then k = 3
  179.  
  180. */
  181.  
  182.       k = 3
  183.  
  184.       do j=2 to k
  185.          say msg.10' 'filespec("N",filelist.i)' 'msg.11' 'j' 'msg.12' 'k
  186.  
  187.          if fidx = 1 & j = k then do
  188.             bin||'\makeindex -c -l '||doc||'\latex\tools\'||idx
  189.          end
  190.  
  191.          exec||' -r -ff latex.fmt -pf '||bin||' -po '||texmf||'\doc\latex\tools -pt '||tfm||' -pi '||target||';'||doc||'\latex\tools;'||tex||' '||filespec("N",filelist.i)
  192.       end
  193.  
  194.    end
  195.  
  196.  
  197.    if Pos("CreateObjects", options) > 0 then do
  198.  
  199.  
  200.       classname = 'WPProgram'
  201.       objtitle  = translate(name,xrange('a','z'),xrange('A','Z'))
  202.       location  = '<OS2TEX_L2TOOLS_FOLDER>'
  203.       setup     = 'EXENAME='texmf'\os2tex\bin\dvi.exe;PROGTYPE=PM;STARTUPDIR='texmf'\os2tex\bin;OBJECTID=<OS2TEX_'name'.dvi>;PARAMETERS='doc'\latex\tools\'name'.dvi'
  204.       duplicate = 'replace'
  205.  
  206.  
  207.       rc = SysCreateObject(classname,objtitle,location,setup,duplicate)
  208.  
  209.       if rc = 0 then do
  210.          exit 1
  211.       end
  212.    end
  213.  
  214.  
  215. end
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.