summaryrefslogtreecommitdiff
path: root/dviware/crudetype/version3/nosve.ch
blob: 71b13b561dccbaf6e0b3e1c5898138e55cfee7aa (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
% nosve.ch -*-mode: change; webfile: crudetype.web version 3.01;-*-
 % LINEPRINTER Change file for Crudetype
% NOS/VE Version 1.0 changed by Matthias Rawohl Sept./Okt. 1987
% Altered by RMD to fit Crudetype version 1 , May 1988.
% Altered by RMD to fit Crudetype version 2, Oct 1988.
% Altered by RMD to fit Crudetype version 3, Oct 1990.
%
%  COPYRIGHT ( C ) G-H Knauf, 1988.
%
%  Permission is given to any person to make and distribute copies of this
%  software, subject to the following conditions:
%
%  1. All copies of the software must carry an exact copy of this notice.
%
%  2. This software is distributed free of charge, "AS IS" with absolutely no
%  guarantee of performance. Any persons receiving or using this software must
%  do so entirely at their own risk. Neither the authors nor their institutions
%  accept any liability for defects of this software, or for any consequential
%  loss or damage however caused.
%
%  3. Any person who changes this software must clearly mark it as modified and
%  add a note describing the changes made.
%


%  WEAVE: New title
@x  Module 0; Lines 42 -- 42
\pageno=\contentspagenumber \advance\pageno by 1
@y
\pageno=\contentspagenumber \advance\pageno by 1
\def\title{Crudetype for {\mc NOS-VE}}
@z

@x  Module 4; Lines 213 -- 216
@d banner=='This is Crudetype, Version 3.01, copyright, experimental'
{printed when the program starts}

@p program crudetype
@y
The identifier |value| is a reserved word in NOS/VE Pascal, so we have to
change this into the word |values|.
@d value ==values
@d banner=='This is Crudetype, NOS/VE Version 3.01, modified by MR'
{printed when the program starts}

@p program crudetype@&_@&module
@z

@x  Module 6; Lines 250 -- 250
  @<Read \.{DVI} preamble@>
@y
  @<Read \.{DVI} preamble@>
  page( printfile) ;
@z

@x  Module 14; Lines 360 -- 361
@<Lowest...@>=
  {Declare |parse_file|}
@y
@<Lowest...@>=
  procedure  parse_file( name: var_string; var dir, nam, ex: var_string) ;
  var p,q,r,s: s_ptr ;
  begin
    dir := blank; nam := blank; ex := blank;
    s := name.len ;
    if ( s>0) then begin
      p := s_search( name, '.', -s);
      if ( p>0) then substring( dir, name, 1, p) ;
      r := s_search( name, '_', -s);
      if ( r>p) then substring( ex, name, r, s-r+1)
      else r := s +1 ;
      substring( nam, name, p+1, r-p-1) ;
    end;
  end;
@z

@x  Module 17; Lines 418 -- 420
@ As an initial attempt at downloading, we declare a |@!raster_file|.

@<Files@>= term_in, term_out, printfile, dvi_file, tfm_file, raster_file
@y
@ Instead of reading a command line, NOS-VE Pascal declares its parameters in
the program header. This is an excellent system, except there is apparently no
way to specify defaults. As an initial attempt at downloading, we declare a
|@!raster_file|.

@<Files@>= term_in, term_out, printfile, dvi_file, tfm_file, raster_file,
  quiet, run_on, squash, first_page, count_pages, magnify, h_mag, v_mag,
  batch_view, inspection
@z

@x  Module 18; Lines 429 -- 436
@d block_length = 512
@d same_dir == false

@<Set init...@>=
  be_string( '.DVI' ) ; dvi_def := buffer ;
  be_string( 'TEX$FONTS:.TFM' ) ; tfm_def := buffer ;
  be_string( 'TEX$GF:.&DGF' ) ; raster_def := buffer ;
  be_string( '.PRI' ) ; print_ex := buffer ;
@y
@d block_length = 16
@d same_dir == false

@<Set init...@>=
  be_string( '_DVI' ) ; dvi_def := buffer ;
  be_string( ':$LIB.PUBLIC.TEX.TFM._TFM' ) ; tfm_def := buffer ;
  be_string( '$LIB.PUBLIC.TEX.GFDIR._&DGF' ) ; raster_def := buffer ;
  be_string( '_LST' ) ; print_ex := buffer ;
@z

@x  Module 19; Lines 442 -- 443
@<Lowest...@>=
  {Declare |open_binary|}
@y

In NOS/VE you have two choices: you may use either the NOS/VE Pascal extension
|bindingtype| or the Cybil routines developed by Norbert Schwarz for his \TeX\
implementation for NOS/VE. Norbert's routines are smarter if a TFM file is
missing.

RMD:  I hope to distribute N.Schwarz's routines in the file NOSVEBIND.CYB.
Dont ask me how these work, I have no idea. The next lot of macro definitions
is rather messy; I have tried to clean them up. To switch from Cybil binding
to (NOS) Pascal binding, swop the curly brackets in the next two definitions.

@d PASCL ==@{   {Open curly for Cybil binding}
@d CYBIL ==@}   {Close curly for Cybil binding}

@d close_binary(#)==
    close_read (#)

@<Lowest...@>=
  @{ CYBIL

@#
  procedure close_read(var f_f:byte_file); external;

@#
  function open_binary (
    var f_f: byte_file; name: var_string ): boolean;
  type string_type=string(64);
  var s: integer;
  long_name_of_file, effectiv_file_name : string_type;
  procedure open_read(
    var f_f:byte_file; given_name:string_type;
    is_text_file:boolean;
    var effectiv_file_name: string_type;
    var open_error:integer);
  external;
  begin
    close_binary(f_f );
      {in case the file was left open}
    long_name_of_file := substr( name.data,1,64);
    open_read(f_f,long_name_of_file, false,effectiv_file_name,s);
    if s <> 0 then open_binary := false
    else begin
      reset(f_f );
      open_binary := true ;
    end;
  end;

@#
  PASCL PASCL

@#
  procedure close_read(var f_f:byte_file); begin  unbind(f_f) end;

@#
  function open_binary (
    var f_f: byte_file; name: var_string; ): boolean;
  var file_bind : @=bindingtype@> ;   { a predefined type in NOS/VE-Pascal}
  begin
    file_bind:=binding(f_f);
    if file_bind.bound then unbind(f_f);
      {in case the file was left open}
    file_bind.name := substr( name.data,1,string_length);
    bind(f_f,file_bind);
    file_bind:= binding(f_f);
    open_binary := file_bind.bound;
    if file_bind.bound  then reset(f_f);
  end;

@#
  CYBIL @}
@z

@x  Module 23; Lines 495 -- 500
@<Determine operating parameters@>=
  command := blank ; get_command ;
  dvi_name := blank ;
  if got_cl then parse_command ;
  @<Get \.{DVI} file name and open it@> ;
  if not got_cl then @<Ask the user@> ;
@y
NOS/VE uses a quite different mechanism; the parameters are passed in as
arguments to the |PROGRAM| statement.

@<Determine operating parameters@>=
  reset( dvi_file) ; dvi_indx := 0 ;
  rewrite(printfile) ;
  display_ln(' ',banner, ' --- ', device_ID) ;
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% change for Crudetype NOS/VE Version 2.1
% MR 10.4.89
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x  Module 24; Lines 525 -- 535
@<Set init...@>=
  quiet := false ;
  run_on := false ;
  squash := false ;
  magnify := 100 ;
  h_mag := 100 ;
  v_mag := 100 ;
  batch_view := false ;
  first_page := -1000000 ;
  count_pages := 1000000 ;
  print_name := blank ;
@y
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% change for Crudetype NOS/VE Version 2.1
% MR 1.4.89
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x  Module 86; Lines 1510 -- 1517
  if not quiet then begin
    display_ln( ' ');
    string_show( font_name);
    display( ' --- loaded at ',scale_size:1,' DVI units');
    if abs(font_mag) > 1 then
      display(' ( magnified ', round(font_mag):1,'%)');
    display_ln(' ');
  end;
@y

@z

@x  Module 207; Lines 3474 -- 3474
  fortran := false ;
@y
  fortran := true ;
@z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% change for Crudetype NOS/VE Version 2.1
% MR 1.4.89
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@x  Module 212; Lines 3577 -- 3580
  if not quiet then begin
    display ('Output written to file:  ');
    string_show(print_name);
  end;
@y
  { display ('Output written to file:  ');
    ====> task moved to SCL Command file }
@z