home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 216.lha / RexxArpLib_v2.1 / rexx / TxEdStuff / viewchunk.txed < prev   
Encoding:
Text File  |  1996-02-15  |  2.2 KB  |  89 lines

  1. /*   This file texify's a chunk */
  2. OPTIONS results
  3.    filename = "vd0:tempfromtxed.tex"
  4.  
  5. STATUS D
  6.    directory = result
  7.    if directory = "" then directory = ":"
  8.  
  9. STATUS F
  10.    if result ~= "" then filename = result
  11.    if filename ~= "vd0:tempfromtexed.tex" then origfile = directory||filename
  12.    else origfile = filename
  13.  
  14.    parse var filename rootname "." rest
  15.  
  16. STATUS P
  17.  
  18.    TEXport = result
  19.    parse var TEXport "TxEd Plus" TEXport"/c".
  20.    TEXport = "Port"TEXport
  21.  
  22.    chunkfile = "ram:"rootname"_Chunk.tex"
  23.  
  24.  
  25.    checkpad = open(scratchpad,chunkfile,"W")
  26.  
  27. COPY X
  28. STATUS MX
  29.    chunktext = result
  30.    chunklength = length(chunktext)
  31.  
  32. LEFT chunklength
  33. STATUS R
  34.    lineandcol = result
  35.    parse var lineandcol row lineno col colno
  36.  
  37.    chunktext = chunktext||"   \bye"
  38.    chunkwrite = writech(scratchpad,chunktext)
  39.  
  40.    envvarname = TEXport" vd0:"rootname"_Chunk.data"
  41.    envvarvalue = "  origfile = '"origfile"' ;"
  42.    envvarvalue = envvarvalue||" rowno = "lineno" ; "
  43.    envvarvalue = envvarvalue||" colno = "colno"; "
  44.  
  45.    y = setenv(envvarname,envvarvalue)
  46.  
  47.    call close(scratchpad)
  48.  
  49.    call CheckForTeX()
  50.    if  ~showlist('p','TeX:dvistream') then call CheckForPreview()   call StopTex()
  51.    call StopTex()
  52.  
  53.  
  54.    address 'AmigaTeX'
  55.    'TeXify' chunkfile               /* send the file */
  56.  
  57. exit
  58.  
  59. CheckForTex:    /* Check to see if Tex is up */
  60.     if ~showlist('P','AmigaTeX') then do    
  61.        WINDOW 0 0 screencols()-10 screenrows() - 80
  62.        constring = "newwsh con:0/"screenrows()-79"/"screencols()-10"/79/'TeXWindow' CMD rexx:startup_tex.rexx"
  63.        interpret address COMMAND '"'constring'"' 
  64.  
  65.        do until showlist('p','AmigaTeX')
  66.           address COMMAND 'c:WaitForPort "AmigaTeX"'    
  67.                             /* give things time to get going */
  68.        end
  69.     end
  70. return 0
  71.  
  72. CheckForPreview:   /* Check for previewer being up if TeX is up */
  73.        if ~showlist('P','TeX:dvistream') then address command runwsh preview     
  74.        do until showlist('p','TeX:dvistream')
  75.           address COMMAND 'c:WaitForPort "TeX:dvistream"'    
  76.                             /* give things time to get going */
  77.        end
  78. return 0
  79.  
  80. StopTex:
  81.  
  82.     do istop=1 to 50
  83.       address 'AmigaTeX' 'Abort'
  84.       if RC=0 then leave istop        /* If it is doing something stop it */
  85.     end 
  86.  
  87. return 0
  88.  
  89.