jwright@quonset.cfht.hawaii.edu (Jim Wright) (06/07/90)
After a year of letting it sit idle, I'm finally trying to learn ARexx. I want to fully integrate all my TeXing into CygnusED. This includes calling [La]TeX on the file currently being edited, looking up errors, sending the .tex file to my workstation for storage, running dvips, sending the postscript file to the workstation and printing the result. I think I've got it all worked out except for running dvips. Working examples would be great. Help on mine would be great. Hints would be great. Get the idea? :-) Thanks. (I've think I've got a TeXify.ced, TeXError.ced and SendTeX.ced that work. So far no trouble. Any interest?) The code so far... /* printDVI.ced */ /* */ /* print a file using unix */ /* most of the "dvi" stuff came from the TxED example on the ARexx */ /* disk -- I don't claim to understand it all yet */ trace r parse arg portname /* First, add the support library if needed */ check = addlib('rexxsupport.library',0,-30,0) /* Make sure we've got an output stream */ if ~show('f',stdout) then call open stdout,'con:/100/640/80/CED-DVI-processor' /* This first part gets run from CED */ if portname == '' then do call openport("FooBar") /* Open a host port */ options failat 5 options results /* figure out the TeX file we're editing */ texfilename = "" address 'ced_rexx' 'status 19' texfilename = result /* strip out any path that may be there */ i = lastpos(filename, '/') if i = 0 then i = lastpos(filename, ':') nopath = right(filename, length(filename)-i) /* and get rid of the .tex extension if it's there */ if pos('.tex', nopath, length(nopath)-4) = 0 then basename = nopath else basename = left(nopath, length(nopath)-4) /* now form the file names */ dvifilename = 'ram:' || basename || '.dvi' bitfilename = 'ram:' || basename || '.ps' /* Launch the WShell and send our host port */ address command 'newwsh "" CMD printDVI.ced' "FooBar" do i=1 for 20 packet = GetPkt("FooBar") select when packet ~= '0000 0000'x then do /* Set the address to the passed host */ address value getarg(packet) /* Issue our commands! */ 'cd ram:' 'dvips ' dvifilename /* output has now been postscriptified (hopefully!!) */ /* if VLT isn't running, fire it up */ if showlist('Ports','VLT')=0 then do address command "dh1:comm/modem/vlt" do i = 1 to 10 if showlist('Ports','VLT') ~=0 then leave i address command 'wait 5' end if showlist('Ports','VLT')=0 then exit end address 'VLT' /* through vlt, tell unix to start up kermit receive */ kermcommand = '""kermit -ir' || '0D'x || '""' send kermcommand /* and tell vlt to send the file */ KS bitfilename /* through vlt, tell unix to print the file */ printcommand = '""lp -dwps ' || basename || '.ps' || '0D'x || '""' send printcommand leave i end otherwise call delay(50) /* Wait a sec ... */ end end end /* This part gets run from the WShell */ else do /* PortName supplied */ OurName = address() /* Save our address */ address value portname /* intermediate host */ ''OurName /* Send 'em our name! */ address /* back to us */ 'endcli' /* That's all, folks */ end exit