home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Meeting Pearls 3
/
Meeting_Pearls_III.iso
/
Pearls
/
texmf
/
rexx
/
GoldEd
/
TeX-Server-Start.ged
< prev
next >
Wrap
Text File
|
1994-03-22
|
6KB
|
219 lines
/*
$VER: TeX-Server-Start.ged V0.96 (19.3.94) Axel Burghardt
*/
Title = "TeX-Server-Start V0.96"
Port = "TEX.1"
Bold = "
"
Invers = ""
Norm = ""
FALSE = 0
TRUE = 1
say Invers Title "für GoldEd" Norm
SIGNAL ON Break_C
SIGNAL ON Break_D
SIGNAL ON SYNTAX
OPTIONS RESULTS
/* ------------------ Support-Bibliothek öffnen ------------------- */
IF ~show('L','rexxsupport.library') THEN
IF ~addlib('rexxsupport.library',0,-30,0) THEN DO
say "Kann 'rexxsupport.library' nicht öffnen!"
EXIT 20
END
/* -------------------- Wann den Editor rufen? -------------------- */
Oldedit = upper(NewGetenv(TEXREXX))
IF "EDIT" = Oldedit THEN DO
OPTIONS PROMPT "Bei erstem Fehler GoldEd starten? (J/N)"
PARSE UPPER PULL jn .
IF LEFT(jn,1) = "N" THEN
Newedit = "e"
ELSE
Newedit = "EDIT"
END
ELSE DO
OPTIONS PROMPT "Bei erstem Fehler GoldEd starten? (J/N)"
PARSE UPPER PULL jn .
IF LEFT(jn,1) = "J" THEN
Newedit = "EDIT"
ELSE
Newedit = "e"
END
IF upper(Newedit) ~= Oldedit THEN
call NewSetenv(Texrexx,Newedit)
Drop Newedit Oldedit
OPTIONS PROMPT "Immer nach TeX-Format fragen (J/N) ? "
PARSE UPPER PULL jn .
IF (left(jn,1) = "J") THEN
call setclip("TEXQUERY","TRUE")
ELSE
call setclip("TEXQUERY")
OPTIONS PROMPT "? >"
DROP jn
/* ----------------------- Öffne ARexx-Port ----------------------- */
IF ~openport(Port) THEN DO
say Bold"Konnte" Port "nicht öffnen!"Norm
EXIT 20
END
ELSE
say Bold"ARexx-Port" Port "geöffnet!"Norm
/* ------------------ Endlosschleife des Servers ------------------ */
Empty = FALSE
DO UNTIL Com = 'QUIT'
IF ~Empty THEN DO
call setclip("Textime")
say Bold"TeX-Server ("Port") wartet auf Kommandos..."Norm
END
call waitpkt(Port)
Packet = getpkt(Port)
IF (Packet == NULL()) THEN
EMPTY = TRUE
ELSE DO
Empty = FALSE
parse value getarg(PACKET) with Com Format Fullname
call reply(PACKET,0)
IF Com = 'SHOWDVI' THEN DO
IF (show('P','showdvi')) THEN DO
say Bold"ShowDVI nach vorne..."Norm
address 'showdvi'
tofront
END
ELSE DO
say Bold"ShowDVI" upper(Format)||Norm
address command 'Run >NIL: showdvi' Format
END
END
IF Com = 'COMPILE' THEN DO
IF '&' ~= left(Format,1) THEN
Format = '&' || Format
ELSE
IF '&' = Format THEN
Format = "" /* dann Default von VirTeX nehmen */
Fullname = strip(Fullname)
/* -------------- Aus 'RAM DISK:xxx' wird 'RAM:xxx' --------------- */
IF "RAM DISK:" = upper(left(Fullname,9)) THEN Fullname = "RAM:"||substr(Fullname,10)
IF 0 ~= index(Fullname," ") THEN
say "Leerzeichen im Dateinamen" upper(Fullname) "nicht erlaubt!"
ELSE DO
parse value namestruc(Fullname) with Ivol Idir Iname .
Texdir = left(Fullname,Ivol+Idir) /* TeX:doc/sample.tex-> TeX:doc/ */
Nameonly = substr(Fullname,1+Ivol+Idir) /* sample.tex */
Baseonly = substr(Fullname,1+Ivol+Idir,Iname) /* sample */
Fullbase = left(Fullname,Ivol+Idir+Iname) /* TeX:doc/sample */
IF 0=Ivol THEN DO
say "Absoluter Pfad (z.B. <device|volumename>:...) verwenden!"
END
ELSE
IF (substr(Fullname,1+Ivol+Idir+Iname,1) ~= ".") THEN DO
say "Dateiname benötigt .<extension>!"
END
ELSE DO
IF ~exists(Fullname) THEN DO
say "Datei" upper(FULLNAME) "nicht gefunden!"
END
ELSE DO
call delete(Fullbase || ".log")
Virtex = getclip("virtex") /* TeX oder BigTeX */
IF "" = Virtex THEN Virtex = 'VIRTEX'
say Bold||Virtex Format Texdir||Nameonly||Norm
call pragma('Directory',Texdir)
call setclip("Texfile",Fullname)
Now = time('s')
call setclip("Textime",Now)
address command Virtex '< *' Format Nameonly
IF RC == 0 THEN DO
say Bold"Keine Fehler gefunden!"Norm
IF (show('P','showdvi')) THEN DO
address 'showdvi'
getfile
Loadfile = RESULT
getdir
Loaddir = RESULT
IF right(Loadeddir,1)~=':' & right(Loadeddir,1) ~= '/' THEN Loadeddir = Loadeddir || '/'
IF Texdir = Loadeddir & 1 = index(upper(Loadedfile||".dvi"),upper(Baseonly||".dvi")) THEN DO
say Bold"Aktualisiere ShowDVI..."Norm
loadagain
END
ELSE DO
say Bold"Lade" upper(Fullbase)".DVI in ShowDVI."Norm
loadnew Fullbase".DVI"
END
tofront
END /* Show */
ELSE DO
say Bold"ShowDVI läuft noch nicht!"Norm
END
END
END /* exists */
END /* !ivol, "." */
END /* !index */
END /* compile */
END /* Packet != NULL */
END /* do */
/* --------------------- ARexx-Port schließen --------------------- */
CALL CLOSEPORT Port
say Bold"ARexx-Port" Port "geschlossen!"Norm
say Bold"Fenster schließen mit CLOSE-Gadget oder CTRL-\."Norm
SIGNAL Cleanup
BREAK_C:
BREAK_D:
say Bold"ARexx-Skript abgebrochen!"Norm
Cleanup:
CALL SETCLIP("TEXFILE")
CALL SETCLIP("TEXTIME")
CALL SETCLIP("TEXQUERY")
EXIT
NewGetenv: PROCEDURE
PARSE ARG name
IF open(TEMPFILE,"ENV:"||name,'r') THEN DO
gives = readln(TEMPFILE)
CALL close TEMPFILE
END
ELSE gives = ""
RETURN gives
NewSetenv: PROCEDURE
PARSE ARG name,content
ADDRESS COMMAND "SetEnv" name content
RETURN
/* ----------------------- Fehlerbehandlung ----------------------- */
SYNTAX:
'REQUEST BODY="Fehler in Zeile' SIGL ':' ERRORTEXT(RC) '"'
'MARK HIDE'
'GOTO LINE='SIGL
'MARK SET'
'UNLOCK'
EXIT 5