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 prtdim_changemode:
26 procedure (P_sdb_ptr, P_new_modes, P_old_modes, P_iostatus);
27
28
29
30
31 dcl P_new_modes character (*) parameter;
32 dcl P_old_modes character (*) parameter;
33
34 dcl P_sdb_ptr pointer parameter;
35 dcl P_iostatus bit (72) aligned;
36
37 dcl P_iocb_ptr pointer parameter;
38 dcl P_code fixed binary (35) parameter;
39
40
41
42
43 dcl code fixed binary (35);
44
45
46
47
48 dcl ios_interface bit (1) aligned;
49
50 dcl system_area area based (system_area_ptr);
51 dcl system_area_ptr pointer;
52
53 dcl (single_page_bit, print_bit) bit (1) aligned;
54 dcl stop_every_value fixed binary;
55 dcl old_modes_lth fixed binary (21);
56 dcl i fixed binary (21);
57
58 dcl (mode_idx, array_idx, idx) fixed binary;
59 dcl legal_mode bit (1) aligned;
60
61
62 dcl BOOLEAN_MODE_NAMES (-3:8) character (32) static options (constant) initial (
63 "in", "indent", "stop", "default",
64 "noskip", "single", "non_edited", "truncate", "esc",
65 "ctl_char", "1pg", "print");
66
67 dcl NUMERIC_MODE_NAMES (1:5) character (32) static options (constant) initial (
68 "stop", "in", "indent", "ll", "pl");
69
70 dcl NUMERIC_MODE_RANGES (1:5, 2) fixed binary static options (constant) initial (
71 0, 9999,
72 0, 250,
73 0, 250,
74 2, 250,
75 2, 127);
76
77
78 dcl error_table_$bad_mode fixed binary (35) external;
79
80 dcl get_system_free_area_ entry () returns (pointer);
81 dcl ioa_$rsnnl entry () options (variable);
82 dcl mode_string_$parse entry (character (*), pointer, pointer, fixed binary (35));
83
84 dcl (addr, divide, hbound, index, lbound, length, min, null, reverse, rtrim, substr, unspec) builtin;
85
86 dcl cleanup condition;
87
88
89
90
91
92 ios_interface = "1"b;
93
94 P_iostatus = ""b;
95 substr (P_iostatus, 41, 1) = "1"b;
96
97 sdb_ptr = P_sdb_ptr;
98 adp = null ();
99
100 pcip = addr (sdb.conv_info);
101 go to COMMON;
102
103
104
105
106 remote_printer_modes_:
107 entry (P_iocb_ptr, P_new_modes, P_old_modes, P_code);
108
109 ios_interface = "0"b;
110
111 P_code = 0;
112
113 sdb_ptr = null ();
114 adp = P_iocb_ptr -> iocb.attach_data_ptr;
115
116 pcip = addr (ad.remote_pci);
117
118
119
120
121 COMMON:
122 system_area_ptr = get_system_free_area_ ();
123 mode_string_info_ptr = null ();
124
125 on condition (cleanup)
126 begin;
127 if mode_string_info_ptr ^= null () then free mode_string_info in (system_area);
128 end;
129
130
131
132
133 if ios_interface then do;
134 single_page_bit = sdb.single_page;
135 print_bit = ^sdb.noprint;
136 stop_every_value = sdb.stop_every;
137 end;
138 else do;
139 single_page_bit = ad.single_page;
140 print_bit = ^ad.noprint;
141 stop_every_value = ad.stop_every;
142 end;
143
144 if length (P_old_modes) > 0 then do;
145 call ioa_$rsnnl (
146 "^[^;^^^]noskip,^[^;^^^]single,^[^;^^^]non_edited,^[^;^^^]truncate,^[^;^^^]esc,^[^;^^^]ctl_char,^[^;^^^]1pg,^[^;^^^]print,stop=^d,ll=^d,indent=^d,pl=^d."
147 , P_old_modes, old_modes_lth, pci.overflow_off, pci.single_space, pci.non_edited, pci.truncate,
148 pci.esc, pci.ctl_char, single_page_bit, print_bit, stop_every_value, pci.rmarg, pci.lmarg,
149 pci.page_length);
150 if old_modes_lth > length (P_old_modes) then do;
151
152 i = index (reverse (P_old_modes), ",");
153 if (i > 0) then
154 substr (P_old_modes, (length (P_old_modes) - i + 1)) = ".";
155 else P_old_modes = "";
156 end;
157 end;
158
159
160
161
162 if length (rtrim (P_new_modes)) ^= 0 then do;
163
164 call mode_string_$parse (P_new_modes, system_area_ptr, mode_string_info_ptr, code);
165 if code ^= 0 then go to ERROR_RETURN;
166
167
168
169
170 do mode_idx = 1 to mode_string_info.number;
171 mode_value_ptr = addr (mode_string_info.modes (mode_idx));
172 if mode_value.char_valuep then
173 go to BAD_MODE_VALUE;
174 else if mode_value.boolean_valuep then do;
175 legal_mode = "0"b;
176 do idx = lbound (BOOLEAN_MODE_NAMES, 1) to hbound (BOOLEAN_MODE_NAMES, 1) while (^legal_mode);
177 if mode_value.mode_name = BOOLEAN_MODE_NAMES (idx) then legal_mode = "1"b;
178 end;
179 if ^legal_mode then go to BAD_MODE_VALUE;
180 if (mode_value.mode_name = "default") & (^mode_value.boolean_value) then go to BAD_MODE_VALUE;
181
182 if (mode_value.mode_name = "stop") & (mode_value.boolean_value) then go to BAD_MODE_VALUE;
183
184 if (mode_value.mode_name = "in") & (mode_value.boolean_value) then go to BAD_MODE_VALUE;
185
186 if (mode_value.mode_name = "indent") & (mode_value.boolean_value) then go to BAD_MODE_VALUE;
187
188 end;
189 else do;
190
191 legal_mode = "0"b;
192 do idx = lbound (NUMERIC_MODE_NAMES, 1) to hbound (NUMERIC_MODE_NAMES, 1) while (^legal_mode);
193 if mode_value.mode_name = NUMERIC_MODE_NAMES (idx) then legal_mode = "1"b;
194 end;
195 if ^legal_mode then go to BAD_MODE_VALUE;
196 idx = idx - 1;
197 if (mode_value.numeric_value < NUMERIC_MODE_RANGES (idx, 1))
198 | (mode_value.numeric_value > NUMERIC_MODE_RANGES (idx, 2)) then
199 go to BAD_MODE_VALUE;
200 end;
201 end;
202
203
204
205
206 do mode_idx = 1 to mode_string_info.number;
207 mode_value_ptr = addr (mode_string_info.modes (mode_idx));
208 if mode_value.boolean_valuep then do;
209 legal_mode = "0"b;
210 do idx = lbound (BOOLEAN_MODE_NAMES, 1) to hbound (BOOLEAN_MODE_NAMES, 1) while (^legal_mode);
211 if mode_value.mode_name = BOOLEAN_MODE_NAMES (idx) then do;
212 legal_mode = "1"b;
213 array_idx = idx;
214 end;
215 end;
216 if legal_mode then
217 go to SET_BOOLEAN_MODE (array_idx);
218 else go to BAD_MODE_VALUE;
219 end;
220 else do;
221 legal_mode = "0"b;
222 do idx = lbound (NUMERIC_MODE_NAMES, 1) to hbound (NUMERIC_MODE_NAMES, 1) while (^legal_mode);
223 if mode_value.mode_name = NUMERIC_MODE_NAMES (idx) then do;
224 legal_mode = "1"b;
225 array_idx = idx;
226 end;
227 end;
228 if legal_mode then
229 go to SET_NUMERIC_MODE (array_idx);
230 else go to BAD_MODE_VALUE;
231 end;
232 go to BAD_MODE_VALUE;
233
234 SET_BOOLEAN_MODE (0):
235 if ^mode_value.boolean_value then go to BAD_MODE_VALUE;
236
237 pci.modes = ""b;
238 if ios_interface then do;
239 sdb.mode = ""b;
240 sdb.stop_every = 0;
241 end;
242 else do;
243 ad.output_modes = ""b;
244 ad.stop_every = 0;
245 end;
246 pci.top_label_length, pci.bot_label_length = 0;
247
248 pci.rmarg = pci.phys_line_length;
249 pci.lmarg = 0;
250 pci.page_length = pci.phys_page_length - pci.lpi;
251 go to SET_NEXT_MODE;
252
253 SET_BOOLEAN_MODE (1):
254 pci.overflow_off = mode_value.boolean_value;
255 go to SET_NEXT_MODE;
256
257 SET_BOOLEAN_MODE (2):
258 pci.single_space = mode_value.boolean_value;
259 go to SET_NEXT_MODE;
260
261 SET_BOOLEAN_MODE (3):
262 pci.non_edited = mode_value.boolean_value;
263 go to SET_NEXT_MODE;
264
265 SET_BOOLEAN_MODE (4):
266 pci.truncate = mode_value.boolean_value;
267 go to SET_NEXT_MODE;
268
269 SET_BOOLEAN_MODE (5):
270 pci.esc = mode_value.boolean_value;
271 go to SET_NEXT_MODE;
272
273 SET_BOOLEAN_MODE (6):
274 pci.ctl_char = mode_value.boolean_value;
275 go to SET_NEXT_MODE;
276
277 SET_BOOLEAN_MODE (7):
278 if ios_interface then
279 sdb.single_page = mode_value.boolean_value;
280 else ad.single_page = mode_value.boolean_value;
281 go to SET_NEXT_MODE;
282
283 SET_BOOLEAN_MODE (8):
284 if ios_interface then
285 sdb.noprint = ^mode_value.boolean_value;
286 else ad.noprint = ^mode_value.boolean_value;
287 go to SET_NEXT_MODE;
288
289 SET_BOOLEAN_MODE (-1):
290 mode_value.numeric_value = 0;
291 SET_NUMERIC_MODE (1):
292 if ios_interface then do;
293 sdb.stop_every = mode_value.numeric_value;
294 sdb.stop_counter = 0;
295 end;
296 else do;
297 ad.stop_every = mode_value.numeric_value;
298 ad.stop_counter = 0;
299 end;
300 go to SET_NEXT_MODE;
301
302 SET_BOOLEAN_MODE (-3):
303 SET_BOOLEAN_MODE (-2):
304 mode_value.numeric_value = 0;
305 SET_NUMERIC_MODE (2):
306 SET_NUMERIC_MODE (3):
307 pci.lmarg = mode_value.numeric_value;
308 go to SET_NEXT_MODE;
309
310 SET_NUMERIC_MODE (4):
311 pci.rmarg = mode_value.numeric_value;
312 go to SET_NEXT_MODE;
313
314 SET_NUMERIC_MODE (5):
315 pci.page_length = mode_value.numeric_value;
316 go to SET_NEXT_MODE;
317
318 SET_NEXT_MODE:
319 end;
320
321 free mode_string_info in (system_area);
322 mode_string_info_ptr = null ();
323 end;
324
325
326
327
328 pci.rmarg = min (pci.rmarg, pci.phys_line_length);
329 pci.lmarg = min (pci.lmarg, pci.rmarg);
330
331 if pci.overflow_off then do;
332 pci.top_label_length,
333 pci.bot_label_length = 0;
334 pci.sheets_per_page = 1;
335 pci.page_length = pci.phys_page_length - pci.lpi;
336
337 end;
338
339 else
340 pci.sheets_per_page =
341 divide (pci.page_length + pci.lpi - 1 + pci.phys_page_length, pci.phys_page_length, 17, 0);
342
343
344 return;
345
346
347
348
349 BAD_MODE_VALUE:
350 code = error_table_$bad_mode;
351
352
353 ERROR_RETURN:
354 if mode_string_info_ptr ^= null () then free mode_string_info in (system_area);
355
356 if ios_interface then
357 substr (P_iostatus, 1, 36) = unspec (code);
358 else P_code = code;
359
360 return;
361
362
363
364 %include prt_sdb;
365 %page;
366 %include prt_info;
367 %page;
368 %include prt_conv_info;
369 %page;
370 %include remote_attach_data;
371 %page;
372 %include iocb;
373 %page;
374 %include mode_string_info;
375
376 end prtdim_changemode;