summaryrefslogtreecommitdiff
path: root/dviware/screenview/vms/crudetype.ch
blob: 1ce66d4025efb633b532439582e7dd16af0c79ed (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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
% Andrew Trevorrow, June 1988
% All my changes (both here and in .WEB file) are flagged with "AKT".
% AKT: Text file Change file for Crudetype.

@x
*** Attach printer change file here ***
@y
\vskip 0.5in
\centerline{The text file change file for Crudetype starts here}
\vskip 0.5in

@<Const...@>= device_ID = 'Text file';

@ Where will the printed file go to?

@<Set init...@>=
  set_string( print_end,
  '.TXT                                                                 ' , ' ', 32 ) ;
  {AKT: was .PRI}

@ The first lot of data describes the printer's overall style of carriage
control. |fortran| means that the carriage control character gets put at the
start of the line, and it is here assumed that it must be inserted explicitly.
Note also that the program makes no attempt to check all these values for
consistency.

@<Carriage control constants@>=
  fortran = false ;
  list = true ;                 {AKT: was false}
  w_l_does_c_r = true ;         {AKT: was false}
  b_feed_absolute = false ;
  b_feed_by_string = false ;
  feed_absolute = false ;
  b_feed_scream = true ;
  b_space_absolute = false ;
  b_space_by_string = false ;
  space_absolute = false ;
  abs_is_incr = false ;
  want_split = true ;
  is_header = false ; {each page needs a header}
  param_type = 'D' ;

@ This batch is concerned with distances and resolutions.

@<Const...@>=
  l_margin =  0 ;             {AKT: was 6}
  top_margin = 0 ;            {AKT: was 6}
  h_resolution = 10 ;         {|h_steps| per inch}
  v_resolution = 6 ;          {|v_steps| per inch}
  fixed_width = true ;        {printers characters are fixed width}
  char_width = 1 ;
  {all printer characters are this width, in units of |h_step|. Normally,
    |space_dist| will be equal to this, but some printers are not normal!}
  gap_width = 1 ; {Intended minimum space between words}
  char_ht = 1 ;

@ The general run of \TeX\ characters are narrower than line-printer chars. So
we spread them out to make them fit.

@<Set init...@>=
  h_fudge := 7.227  {number of points per |h_step|}
  / 5.25 ;          {A typical design width}
  v_fudge := 1.2 ;  {AKT: was 2.0 to force double-spacing }

@ @<Glob...@>=
  h_fudge, v_fudge: real_num ;

@ Next, some constants for rule-setting.

@<Rule setting const...@>=
  rail_width = 1 ;  {Height and width of rule chars, in steps}
  rail_height  = 1 ;
  post_width = 1 ;
  post_height = 1 ;
  rail_types = 2 ;

@ @<Set rule characters@>=
  rail_chars[1] := codes[ 1, 95 ] ;
  rail_chars[2] := codes[ 1, 45 ] ;
  post_char := codes[ 1, 124] ;

@ @<Pause constants...@>=
  do_pause = false ;
  pause_steps = 20 ;
  pause_ask = 'PAUSED. Type <return> to continue' ;

@ The next batch are concerned with fonts.

@<Const...@>=
  min_font = 1 ;
  {smallest and largest number of printers resident fonts}
  max_font = 1 ;
  only_one_font = true ;
  can_dl_font = false ;
  min_dl_font = 0 ;
  max_dl_font = 0 ; {printers down-loadable fonts}
  max_codes = 9 ;   {AKT: was 8; no. of known \TeX\ coding schemes}
  max_char = 255 ;  {AKT: was 127; max. no. of chars per \TeX\ or PS font}
  max_plain = 4 ;   {Max number of a plain text font}

@ Finally, consider command strings. These are intended to set options, but a
line printer hasnt any.

@<Set init...@>=
  start_stuff := blank ;
  stop_stuff := blank ;
  page_top  := blank ;
  pause_after := blank ;

@* Character code data for the printer.

Here we actually put data into the |codes| array. In general, I have merely
replaced each character in the PLAIN.TEX coding schemes by the nearest
equivalent in ASCII, when a reasonable one exists ; I have not tried to tackle
either AMSY or AMATHEX ; clearly there will be some scope for doing so. First
we give the scheme names, ( padded to |code_len|) then do stuff for each
scheme in turn.

@<Assign char...@>=
  set_string( known_schemes[ 0 ] ,
    '                                                                     ' , ' ', 32 ) ;
  set_string( known_schemes[ 1 ] ,
    'TEX EXTENDED ASCII                                                   ' , ' ', 32 ) ;
  set_string( known_schemes[ 2 ] ,
    'TEX TYPEWRITER TEXT                                                  ' , ' ', 32 ) ;
  set_string( known_schemes[ 3 ] ,
    'TEX TEXT                                                             ' , ' ', 32 ) ;
  set_string( known_schemes[ 4 ] ,
    'TEX TEXT WITHOUT F-LIGATURES                                         ' , ' ', 32 ) ;
  set_string( known_schemes[ 5 ] ,
    'AEFMNOT ONLY                                                         ' , ' ', 32 ) ;
  set_string( known_schemes[ 6 ] ,
    'TEX MATH ITALIC                                                      ' , ' ', 32 ) ;
  set_string( known_schemes[ 7 ] ,
    'TEX MATH SYMBOLS                                                     ' , ' ', 32 ) ;
  set_string( known_schemes[ 8 ] ,
    'TEX MATH EXTENSION                                                   ' , ' ', 32 ) ;
  set_string( known_schemes[ 9 ] ,
    'AKT: This scheme will be used for all unknown schemes; what a hack!  ' , ' ', 32 ) ;

@ Now do scheme 1 = EXTENDED ASCII

@<Assign char...@>=
  alphabet( 32, 95, 1, 1, 32) ;
  row(  ' .       {|v}    Z       Z       &       ~       {LC-}   Z           ' ,1,0,1) ;
  row(  ' Z       Z       Z       {^|}    {+_}    {LO+}   Z       Z           ' ,1,1,1) ;
  row(  ' Z       Z       Z       Z       Z       Z       {LOx}   Z           ' ,1,2,1) ;
  row(  ' [{L<-}-] [-{-L>}] {=/}  Z       {L<_}   {L>_}   {=_}    [or]        ' ,1,3,1) ;

@ Now do scheme 2 = TYPEWRITER. Unfortunately, \.{TANGLE} imposes a limit of 69
on the length of quoted strings. This causes difficulty because several multi-
character commands are too long for 8 of them to fit neatly into a string of
that length. So I use the Z command to ( effectively) split any complicated
|row_spec| into two.

@<Assign char...@>=
  alphabet( 32, 95, 2, 1, 32) ;
  codes[2, 255].IM_char:= 34 ;        {AKT: was 2, 127}
  row(  ' Z               [{/_}{_\}]      {0-}            [/\]        Z Z Z Z ' ,2,0,1) ;
  {first half row}
  row(  ' Z Z Z Z         <U_{-_}>        <U[__][||]>     <U_{L>_}>        LY ' ,2,0,1) ;
  {and second}
  row(  ' {oI}    {u|}    Z       {^|}    {v|}    Q       !       ?           ' ,2,1,1) ;
  row(  ' i       j       `       Q       Z       Z       <U_>    <U.>        ' ,2,2,1) ;
  row(  ' ,       {LB_}   [ae]    [oe]    {o/}    [LALE]  [LOLE]  {LO/}       ' ,2,3,1) ;

@ The TEX TEXT scheme is nearly the same, so we start by copying it.

@<Assign char...@>=
  for in_i := 0 to 255 do codes [3, in_i] := codes [2, in_i] ;
  {AKT: was   0 to 127}
  row(  ' Z       Z       Z       [ff]    [fi]    [fl]    [ffi]   [ffl]       ' ,3,1,1) ;
  row(  ' Z       Z       Z       Z       !       Z       ?       Z           ' ,3,7,1) ;
  row(  ' Z       Z       Z       Z       W       Z       Z       <U.>        ' ,3,11,1) ;
  row(  ' Z       Z       Z       -       [--]    W       ~       W           ' ,3,15,1) ;

@ Recently there has appeared a scheme, called TEX TEXT WITHOUT F-LIGATURES.

@<Assign char...@>=
  for in_i := 0 to 255 do codes [4, in_i] := codes [3, in_i] ;
  {AKT: was   0 to 127}
  row(  ' {oI}    {u|}    Z       {^|}    {v|}    Q       !       ?           ' ,4,1,1) ;

@ and AEFMNOT ONLY  (for the Metafont logo).

@<Assign char...@>=
  row(  ' Z      LA       Z       Z       Z      LE      LF       Z           ' ,5,8,1) ;
  row(  ' Z       Z       Z       Z       Z      LM      LN      LO           ' ,5,9,1) ;
  row(  ' Z       Z       Z       Z      LT       Z       Z       Z           ' ,5,10,1) ;

@ The MATH ITALIC scheme is almost impossible.

@<Assign char...@>=
  for in_i := 0 to 9 do codes [6, in_i] := codes [2, in_i] ;
  alphabet( 48, 43, 6, 1, 48) ;
  alphabet( 97, 26, 6, 1, 97) ;
  row(  ' Z       Z       .       ,       Z       /       Z       *           ' ,6,7,1) ;

@ MATH SYMBOLS are messy, and no doubt the results will look unpleasant.

@<Assign char...@>=
  alphabet( 65, 26, 7, 1, 65) ;
  row(  ' -       .       {\/}    *       {-:}    Z       {+_}    <U_+>       ' ,7,0,1) ;
  row(  ' {LO+}   {LO-}   {LOx}   {LO/}   LO      LO       o       o          ' ,7,1,1) ;
  row(  ' Z       {=_}    Z       Z       {L<_}   {L>_}   {L<_}   {L>_}       ' ,7,2,1) ;
  row(  ' ~       <U~~>   Z       Z       [L<L<]  [L>L>]  L<      L>          ' ,7,3,1) ;
  row(  ' [{L<-}-]        [-{L>-}]        {|^}            {|v}    Z Z Z Z     ' ,7,4,1) ;
  row(  ' Z Z Z Z         [{L<-}{-L>}]    /               \       {~_}        ' ,7,4,1) ;
  row(  ' [{L<=}=]        [={L>=}]        {|^}            {|v}    Z Z Z Z     ' ,7,5,1) ;
  row(  ' Z Z Z Z         [{L<=}{=L>}]    Z               Z       Z           ' ,7,5,1) ;
  row(  ' Q               [oo]            {L(-}           {-L)}   Z Z Z Z     ' ,7,6,1) ;
  row(  ' Z Z Z Z         [{/_}{_\}]      <U[__][\/]>     /       Q           ' ,7,6,1) ;
  row(  ' [{\-}{-/}]      <U_[{-_}|]>     ~       {0/}    LR LT   <U_|>   {|_}' ,7,7,1) ;
  row(  ' Z       Z       Z       LU      Z       {LU+}   &       [or]        ' ,7,11,1) ;
  row(  ' [{|-}-]         [-{-|}]         Z Z Z   Z       L{      L}          ' ,7,12,1) ;
  row(  ' L<      L>      |       [||]    {^|v}   {^|v}   \       Z           ' ,7,13,1) ;
  row(  ' <U[S_]{v/}>     [{LI_}{LI_}]    <[__][\/]>      </|/>   Z Z Z Z     ' ,7,14,1) ;

@ And here is a first attempt at the MATH EXTENSION scheme. These codes look
rather peculiar because characters in the Extension font (unlike all others)
have their reference points at the top. Here the restriction of string length
to 69 is a real pain. It seemed that the least bad way to arrange these |row|s
was by splitting each into 2 halves; then most half-rows do fit into one
rowstring. Here are the left hand halves.

@<Assign char...@>=
  row(' <SL(L(>         <SL)L)>         <SL[L[>         <SL]L]>         ZZZZ',8,0,1);
  row(' <SL{L{>         <SL}L}>         <S/\>           <S\/>           ZZZZ',8,1,1);
  row(' <SL(L(L(>       <SL)L)L)>       <SL(L(L(L(>     <SL)L)L)L)>     ZZZZ',8,2,1);
  row(' <SL[|||>        <SL]|||>        <SL{/\L{>       <SL}\/L}>       ZZZZ',8,3,1);
  row(' <SL(L(L(L(L(>   <SL)L)L)L)L)>   <SL[|||L[>      <SL]|||L]>      ZZZZ',8,4,1);
  row(' <SL{L|L<|L{>    <SL}|L>|L}>     <S[S/]/\[S\]>   <S\[S\][S/]/>   ZZZZ',8,5,1);
  row(' <S/||>          <S\||>          <SL[||>         <SL]||>         ZZZZ',8,6,1);
  row(' <S[S/]|>        <S\[S|]>        <S|[S\]>        <S[S|]/>        ZZZZ',8,7,1);
  row(' <S||\>          <S||/>          <S|>            <S|>            ZZZZ',8,8,1);
  row(' <[__]\[{/_}_]>  <[__][LILI]>    </|/>           <S[||][\/]>     ZZZZ',8,10,1);
  row(' <S[{|_}{|_}]>   <S[|S|][{|_}_{_|}]>     <U_>    <U[__]>         ZZZZ',8,12,1);
  row(' <SL[L[L[>       <SL]L]L]>       <S||L[>         <S||L]>         ZZZZ',8,13,1);
  row(' <S{|^}>         <S{|v}>         /               \               ZZZZ',8,15,1);

@ Here are the right hand halves.

@<Assign char...@>=
  row('ZZZZ   <S|L[>          <S|L]>          <SL[|>          <SL]|>        ',8,0,1);
  row('ZZZZ   <S|>            <S[||]>         <S[S/]/>        <Z\[S\]>      ',8,1,1);
  row('ZZZZ   <SL[L[L[L[>     <SL]L]L]L]>     <S|||L[>        <S|||L]>      ',8,2,1);
  row('ZZZZ   <S[S/]/\[S\]>   <S\[S\][S/]/>   <S[S/][S/]//>   <S\\[S\][S\]> ',8,3,1);
  row('ZZZZ   <S||||L[>       <S||||L]>       <SL[||||>       <SL]||||>     ',8,4,1);
  row('ZZZZ   <S[S/][S/]//>   <S\\[S\][S\]>   <S[SS/][S/]/>   <S\[S\][SS\]> ',8,5,1);
  row('ZZZZ   <S||L[>         <S||L]>         <S|>            <S|>          ',8,6,1);
  row('ZZZZ   <S[S|]L<[S|]>   <S|[SL>]|>      <S|>            <S|>          ',8,7,1);
  row('ZZZZ   <S[S/]L<[S\]>  <S\[SL>]/>  <S[{|_}{|_}]>  <S[|S|][{|_}S{|_}]> ',8,8,1);
  row('ZZZZ   <S[/\][||]>     <S[|+|][\_/]>   <S[/\]>         <S[\/]>       ',8,10,1);
  row('ZZZZ   <U[___]>        <U~>            <U[~~]>         <U[~~~]>      ',8,12,1);
  row('ZZZZ   <SL[||>         <SL]||>         <SL{L{L{>       <SL}L}L}>     ',8,13,1);
  row('ZZZZ   \               /               <S{|^}>         <S{|v}>       ',8,15,1);

@ And here are the half rows that are so long that even half a row must be
further split.

@<Assign char...@>=
  row('        </{|O}/>   <S/{|O}|/>   <S[/\][\/]>   <S[S_][/.\][\_/]>  ZZZZ',8,9,1);
  row('ZZZZ    <S[{/_}{\_}][\/]>       <S[S_][{/_}{|_}{_\}][\{|_}/]>      ZZ',8,9,1);
  row('ZZZZZZ  <S[{\/}{/\}][{\/}{/\}]> <[S_][{\/}S{/\}][|{\/}|][{/\}_{/\}]> ',8,9,1);

@#
  row('        <[___]\[SL>][{/_}__]>   <[___][|S|][|S|][|S|]> <S/||/>  ZZZZZ',8,11,1);
  row('ZZZ     <S[|S|][|S|][\_/]>      <[S_][/S\][|S|][|S|]>             ZZZ',8,11,1);
  row('ZZZZZ   <S[|S|][|+|][\_/]>      <SS[S/\][/SS\]>  <SS[\SS/][S\/]>     ',8,11,1);

@#
  row('  <S[_S|][S\|]>   <S[SS|][_S|][S\|]>  <S[SS|][SS|][_S|][S\|]>   ZZZZZ',8,14,1);
  row('ZZZ     <S[SS|][SS|][SS|][_S|][S\|]>  <S[SS|][_S|][S\|]>          ZZZ',8,14,1);
  row('ZZZZZ   <S|>      <U_|>               <S[||]>                        ',8,14,1);

@ AKT: Now do scheme 9 = unknown (eg. PostScript font).
We simply use the TEX TEXT scheme.

@<Assign char...@>=
  for in_i := 0 to 255 do codes [9, in_i] := codes [3, in_i] ;

@ This must be done last of all:

@<Assign char...@>=
  @<Set rule characters@>

@z