diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /dviware/psprint/vms/lw_print.com |
Initial commit
Diffstat (limited to 'dviware/psprint/vms/lw_print.com')
-rw-r--r-- | dviware/psprint/vms/lw_print.com | 178 |
1 files changed, 178 insertions, 0 deletions
diff --git a/dviware/psprint/vms/lw_print.com b/dviware/psprint/vms/lw_print.com new file mode 100644 index 0000000000..fc07e54199 --- /dev/null +++ b/dviware/psprint/vms/lw_print.com @@ -0,0 +1,178 @@ +$! This command file is run by PSPRINT/DEV=LW with the following parameters: +$! P1 = complete file specification +$! P2 = file format (DVI or PS or TEXT or TWO or WIDE) +$! P3 = options for PSDVI +$! P4 = options for PRINT +$! P5 = /NOTE value ("" if not used) +$! P6 = /COPIES value (1 if not used) +$! P7 = /OUTPUT value ("" if not used) +$! P8 = "bbbb<prep>" where b = Y or N and represents the status of the +$! boolean qualifiers /DELETE, /LANDSCAPE, /BANNER, /MANUALFEED +$! and <prep> is the /PREP value, possibly empty +$ +$ on control_y then exit +$ set symbol/scope=(nolocal,noglobal) ! avoid symbol collision +$ delflag = f$extract(0,1,p8) ! Y or N +$ landflag = f$extract(1,1,p8) ! Y or N +$ bannerflag = f$extract(2,1,p8) ! Y or N +$ manualflag = f$extract(3,1,p8) ! Y or N +$ prepfile = f$extract(4,999,p8) ! /PREP value +$ +$! We arbitrarily restrict /COPIES to <= 100. Other sites might want to +$! increase this limit or restrict it even further: +$ +$ if (p6 .gt. 0) .and. (p6 .lt. 101) then goto CONTINUE +$ write sys$output "Bad /COPIES value. Specify 1 to 100." +$ exit +$ +$ CONTINUE: +$ copies = f$string(p6) +$ job = f$parse(p1,,,"NAME") +$ +$! Build temporary file in sys$scratch. +$! We no longer start with ^D because of problems encountered when +$! a LaserWriter is connected to an X25 pad (due to echoing of ^D). +$! We now assume that any previous job has been terminated. +$! (The LaserWriter server uses ^D to end a job and restore virtual memory.) +$ +$ copy tex_ps:lw_header.ps sys$scratch:'job'.tmp +$ tmpfile = f$search("sys$scratch:''job'.tmp") ! include version number +$ write sys$output - + "Creating SYS$SCRATCH:''job'.TMP" + f$parse(tmpfile,,,"VERSION") +$ +$! tex_ps:lw_header.ps defines @bannerpage and a PostScript error handler. +$! It also stores the current LaserWriter page count; when @bannerpage +$! is finally called we can work out how many pages were printed. +$! Now append various strings that will eventually appear on banner page: +$ +$ open/append tmp 'tmpfile' +$ write tmp "/@USER (USER : " + f$getjpi(0,"USERNAME") + ") def" +$ write tmp "/@ACCOUNT (ACCOUNT : " + f$getjpi(0,"ACCOUNT") + ") def" +$ write tmp "/@JOB (JOB : " + job + ") def" +$ write tmp "/@NODE (NODE : " + f$trnlnm("SYS$NODE")-"::" + ") def" +$ write tmp "/@FILE (FILE : " + p1 + ") def" +$ write tmp "/@FORMAT (FORMAT : " + p2 + ") def" +$ write tmp "/@QUEUED (QUEUED : " + f$time() + ") def" +$ +$! Note that PSPRINT.MOD has prefixed each (,),\ in p5 with \. +$! Such characters should never occur in the above strings!!! +$ +$ write tmp "/@NOTE (NOTE : " + p5 + ") def" +$ +$! The value of #copies will be used by PostScript's showpage operator to +$! print multiple copies of each page. +$! This is very efficient but means that copies are not collated. +$! (Good; we don't want the LaserWriter to be treated like a copier.) +$ +$ write tmp "/#copies " + copies + " def" +$ +$! Check for /NOBANNER and /MANUALFEED: +$ +$ if bannerflag .eqs. "N" then write tmp "/@bannerpage { } def" +$ if manualflag .eqs. "Y" then write tmp - + "statusdict begin /manualfeed true def end" +$ +$! Here are the definitions used in the job prologues: +$ +$ write tmp "/dev (LW) def" +$ write tmp "/res 300 def" +$ write tmp "/fspec (" + p1 + ") def" +$ if landflag .eqs. "Y" then write tmp "/land true def" +$ if landflag .eqs. "N" then write tmp "/land false def" +$ +$ close tmp +$ +$! Each type of job requires its own prologue: +$ +$ if p2 .eqs. "DVI" then append tex_ps:tex.ps, tex_ps:lw_fonts.ps 'tmpfile' +$ if p2 .eqs. "PS" then append tex_ps:ps.ps 'tmpfile' +$ if p2 .eqs. "TEXT" then append tex_ps:text.ps 'tmpfile' +$ if p2 .eqs. "TWO" then append tex_ps:two.ps 'tmpfile' +$ if p2 .eqs. "WIDE" then append tex_ps:wide.ps 'tmpfile' +$ +$! /PREP qualifier is only allowed for DVI or PS job: +$ +$ if (p2 .nes. "DVI") .and. (p2 .nes. "PS") then goto SKIPPREP +$ if prepfile .eqs. "" then goto SKIPPREP +$ write sys$output "Including " + prepfile +$ append 'prepfile' 'tmpfile' +$ SKIPPREP: +$ +$! If global.ps exists in the user's current directory then append it +$! to the prologue for a DVI job: +$ +$ global = f$search("global.ps") +$ if (global .eqs. "") .or. (p2 .nes. "DVI") then goto SKIPGLOBAL +$ write sys$output "Including GLOBAL.PS" +$ append 'global' 'tmpfile' +$ SKIPGLOBAL: +$ +$ if p2 .nes. "DVI" then goto PRINT ! skip PSDVI if non-DVI file +$ +$! Else run PSDVI. +$! psdvifile must be a completely new file spec to avoid file name conflicts: +$ +$ ver = 1 +$ LOOP: +$ psdvifile = "sys$scratch:psdvi.tmp;''f$string(ver)'" +$ if f$search(psdvifile) .eqs. "" then goto ENDLOOP +$ ver = ver + 1 +$ goto LOOP +$ +$ ENDLOOP: ! psdvifile does not exist +$ land = "" +$ if landflag .eqs. "Y" then land = "/xsize=297mm /ysize=210mm" ! rotated A4 +$ on warning then goto BADDVI +$ PSDVI 'p1' 'land' /HEADER='tmpfile' - + /OUTPUT='psdvifile' - + /RES=300 - + /FONT="disk$utils:[utilities.tex.300pk]" - + /DUMMY="cmr10.300pk" - + /NOCONSERVE - + /NOREVERSE 'p3' ! p3 may override above defaults +$ delete/nolog 'tmpfile' +$ rename/nolog 'psdvifile' 'tmpfile' +$ goto PRINT ! output file is okay +$ +$! We decide not to print anything if the DVI file has errors. +$! Sites that don't care about wasting paper may wish to do something else. +$ +$ BADDVI: +$ delete/nolog 'tmpfile' ! delete header +$ if f$search(psdvifile) .nes. "" then - ! delete bad output file +$ delete/nolog 'psdvifile' +$ write sys$output "" +$ write sys$output "Printing aborted due to error(s). Temporary file deleted." +$ exit +$ +$ PRINT: +$ on error then exit +$ +$! Now complete tmpfile. +$! For TEXT/TWO/WIDE jobs we must end with ^D. +$! For DVI/PS jobs we must end with tex_ps:lw_trailer.ps before ^D. +$! But if /OUTPUT is used we don't append ^D. +$ +$ ctrld = "tex_ps:ctrld.dat" +$ if p7 .nes. "" then ctrld = "tex_ps:empty.ps" +$ +$ if (p2 .eqs. "TEXT") .or. (p2 .eqs. "TWO") .or. (p2 .eqs. "WIDE") then - + append 'p1', 'ctrld' 'tmpfile' +$ if p2 .eqs. "PS" then - + append 'p1', tex_ps:lw_trailer.ps, 'ctrld' 'tmpfile' +$ if p2 .eqs. "DVI" then - + append tex_ps:lw_trailer.ps, 'ctrld' 'tmpfile' +$ +$! If /OUTPUT given then rename tmpfile instead of sending it to printer. +$! Use copy & delete rather than rename since tmpfile may be on another disk: +$ +$ if p7 .eqs. "" then goto PRINTJOB ! /OUTPUT not used +$ copy tex_ps:empty.ps, 'tmpfile' 'p7' ! empty.ps avoids version conflict +$ delete/log 'tmpfile' +$ write sys$output "" +$ write sys$output "Nothing printed. PostScript saved in " + p7 +$ exit +$ +$ PRINTJOB: +$ print/queue=APPLE/form=postscript/name='job' 'tmpfile'/delete 'p4' +$ if delflag .eqs. "Y" then delete/log 'p1' |