summaryrefslogtreecommitdiff
path: root/dviware/psprint/vms/lino_print.com
blob: 9e5219280e859c6ec1d000519390dee94584e7cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
$! This command file is run by PSPRINT/DEV=LINO 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 = "bbbbbsss<prep>" where b = Y or N and represents the status of the
$!         boolean qualifiers /DELETE, /LANDSCAPE, /CUTMARKS, /LOWRES, /BANNER
$!         and sss = /SIZE value (one of those defined in PSPRINT.CLD)
$!         and <prep> is the /PREP value, possibly empty
$
$  on control_y then exit
$  set symbol/scope=(nolocal,noglobal)              ! avoid symbol collision
$
$! Don't allow text files to be printed on Linotronic:
$  if (p2 .eqs. "DVI") .or. (p2 .eqs. "PS") then goto CONT0
$  write sys$output "Linotronic should not be used to print text files."
$  exit
$
$  CONT0:
$  delflag    = f$extract(0,1,p8)                   ! Y or N
$  landflag   = f$extract(1,1,p8)                   ! Y or N
$  cutflag    = f$extract(2,1,p8)                   ! Y or N
$  lowflag    = f$extract(3,1,p8)                   ! Y or N
$  bannerflag = f$extract(4,1,p8)                   ! Y or N
$  size       = f$extract(5,3,p8)                   ! /SIZE value
$  prepfile   = f$extract(8,999,p8)                 ! /PREP value
$  pagesetup = ""
$  if size .eqs. "A3L" then pagesetup = "A3Lsetup"  ! defined in lino_header.ps
$  if size .eqs. "A4P" then pagesetup = "A4Psetup"  ! ditto
$  if size .eqs. "A4L" then pagesetup = "A4Lsetup"  ! ditto
$  if size .eqs. "A5P" then pagesetup = "A5Psetup"  ! ditto
$  if size .eqs. "A5L" then pagesetup = "A5Lsetup"  ! ditto
$  if size .eqs. "B5P" then pagesetup = "B5Psetup"  ! ditto
$  if size .eqs. "B5L" then pagesetup = "B5Lsetup"  ! ditto
$  if pagesetup .nes. "" then goto CONT1
$! CLD file should prevent us ever getting here:
$  write sys$output "Unknown /SIZE value: " + size
$  exit
$
$  CONT1:
$  if (p6 .gt. 0) .and. (p6 .lt. 101) then goto CONT2
$  write sys$output "Bad /COPIES value.  Specify 1 to 100."
$  exit
$
$  CONT2:
$  copies = f$string(p6)
$  job    = f$parse(p1,,,"NAME")
$
$  copy tex_ps:empty.ps sys$scratch:'job'.tmp
$  tmpfile = f$search("sys$scratch:''job'.tmp")
$  write sys$output -
      "Creating SYS$SCRATCH:''job'.TMP" + f$parse(tmpfile,,,"VERSION")
$  open/append tmp 'tmpfile'
$  write tmp "/@USER (" + f$getjpi(0,"USERNAME") -
                        + "   " + f$trnlnm("SYS$NODE") + p1 + ") def"
$  write tmp "/@DATE (" + f$time() + ") def"
$  write tmp "/@NOTE (" + p5 + ") def"
$  close tmp
$  append tex_ps:lino_header.ps 'tmpfile'    ! uses above definitions
$
$  open/append tmp 'tmpfile'
$  write tmp "/dev (LINO) def"
$  res = "1270"
$  if lowflag .eqs. "Y" then res = "635"     ! res also used below
$  write tmp "/res " + res + " 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"
$  if bannerflag .eqs. "N" then write tmp "/@bannerpage { } def"
$  if bannerflag .eqs. "N" then write tmp "/@footerpage { } def"
$  write tmp "@bannerpage"
$  write tmp "/@oldpagecount statusdict begin pagecount end def"
$  write tmp "/#copies " + copies + " def"   ! set # of copies
$  write tmp pagesetup                       ! call page setup procedure
$  if cutflag .eqs. "N" then -
      write tmp "/@cutmarks { } def"         ! override default
$  close tmp
$
$  if p2 .eqs. "DVI" then append tex_ps:tex.ps, tex_ps:lino_fonts.ps 'tmpfile'
$  if p2 .eqs. "PS"  then append tex_ps:ps.ps                        'tmpfile'
$
$  if prepfile .eqs. "" then goto SKIPPREP
$  write sys$output "Including " + prepfile
$  append 'prepfile' 'tmpfile'
$  SKIPPREP:
$
$  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 DVI processing
$
$  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:
$  if size .eqs. "A3L" then land = "/x=297mm/y=420mm"
$  if size .eqs. "A4P" then land = "/x=210mm/y=297mm"
$  if size .eqs. "A4L" then land = "/x=210mm/y=297mm"
$  if size .eqs. "A5P" then land = "/x=148mm/y=210mm"
$  if size .eqs. "A5L" then land = "/x=148mm/y=210mm"
$  if size .eqs. "B5P" then land = "/x=176mm/y=250mm"
$  if size .eqs. "B5L" then land = "/x=176mm/y=250mm"
$!                          offset: 012345678901
$! If /LANDSCAPE given then we have to swap /xsize and /ysize values.
$! Following stmt assumes /x value starts at offset 3 and /y value at offset 11.
$  if landflag .eqs. "Y" then -
      land = "/x=" + f$extract(11,5,land) + "/y=" + f$extract(3,5,land)
$  on warning then goto BADDVI
$  PSDVI 'p1' 'land' /HEADER='tmpfile' -
                     /OUTPUT='psdvifile' -
                     /RES='res' -
                     /FONT=disk$utils:[utilities.tex.'res'pk] -
                     /DUMMY=cmr10.'res'pk -
                     /CONSERVE -
                     /NOREVERSE 'p3'
$  delete/nolog 'tmpfile'
$  rename/nolog 'psdvifile' 'tmpfile'
$  goto PRINT
$
$  BADDVI:
$  delete/nolog 'tmpfile'
$  if f$search(psdvifile) .nes. "" then delete/nolog 'psdvifile'
$  write sys$output ""
$  write sys$output "Printing aborted due to error(s). Temporary file deleted."
$  exit
$
$  PRINT:
$  on error then exit
$  if p2 .eqs. "PS" then append 'p1'               'tmpfile'
$  ctrld = "tex_ps:ctrld.dat"
$  if p7 .nes. "" then ctrld = "tex_ps:empty.ps"
$  append tex_ps:lino_trailer.ps, 'ctrld'          'tmpfile'
$
$  if p7 .eqs. "" then goto PRINTJOB
$  copy tex_ps:empty.ps, 'tmpfile' 'p7'
$  delete/log 'tmpfile'
$  write sys$output ""
$  write sys$output "Nothing printed. PostScript saved in " + p7
$  exit
$
$  PRINTJOB:
$  print/queue=LINOTRONICS/form=postscript/name='job' 'tmpfile'/delete 'p4'
$  if delflag .eqs. "Y" then delete/log 'p1'