1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 prtdim_attach:
18 procedure (stream_name, prt, device, mode, iostatus, sdb_ptr);
19
20 dcl stream_name char (*),
21 prt char (*),
22 device char (*),
23 mode char (*),
24 iostatus bit (72) aligned;
25
26 dcl area_ptr ptr,
27 listen_based_area area ((16374)) based (area_ptr),
28 wksp_max fixed bin (19),
29 time_max fixed bin (52),
30 rcp_state fixed bin,
31 rcode fixed bin (35);
32
33 dcl get_system_free_area_ entry (ptr),
34 ipc_$create_ev_chn entry (fixed bin (71), fixed bin (35)),
35 ipc_$block entry (ptr, ptr, fixed bin (35)),
36 ipc_$delete_ev_chn entry (fixed bin (71), fixed bin (35)),
37 convert_ipc_code_ entry (fixed bin (35)),
38 rcp_$attach entry (char (*), ptr, fixed bin (71), char (*), bit (36) aligned, fixed bin (35)),
39 rcp_$check_attach entry (bit (36) aligned, ptr, char (*), fixed bin, fixed bin (19), fixed bin (52),
40 fixed bin, fixed bin (35)),
41 ioi_$workspace entry (fixed bin, ptr, fixed bin (18), fixed bin (35)),
42 rcp_$detach entry (bit (36) aligned, bit (*), fixed bin, char (*), fixed bin (35)),
43 prtdim_util$init entry (ptr, fixed bin (35)),
44 prtdim_util$load_vfc entry (ptr, fixed bin (35));
45
46
47
48
49
50 dcl error_table_$ionmat fixed bin (35) ext,
51 error_table_$no_room_for_dsb fixed bin (35) ext,
52 error_table_$no_operation fixed bin (35) ext,
53 config_deck$ ext;
54
55 dcl 1 rcp_info like printer_info aligned auto;
56
57 dcl 1 ipc_message aligned,
58 2 chname fixed bin (71),
59 2 message fixed bin (71),
60 2 sender bit (36),
61 2 origin,
62 3 devsignal bit (18),
63 3 ring bit (18),
64 2 channel_index fixed bin;
65
66 dcl (addr, null, ptr, substr, unspec) builtin;
67
68
69
70
71 % include prt_sdb;
72
73
74
75
76 % include rcp_printer_info;
77
78 % include prt_info;
79
80
81
82
83 % include prt_conv_info;
84
85
86
87 % include iom_pcw;
88
89
90
91 iostatus = "0"b;
92 if sdb_ptr ^= null () then do;
93 substr (iostatus, 1, 36) = unspec (error_table_$ionmat);
94 go to exit;
95 end;
96
97 call get_system_free_area_ (area_ptr);
98 allocate sdb in (listen_based_area) set (sdb_ptr);
99 if sdb_ptr = null then do;
100 substr (iostatus, 1, 36) = unspec (error_table_$no_room_for_dsb);
101 go to exit;
102 end;
103
104 sdb.areap = area_ptr;
105
106 outer_module_name = prt;
107 device_name_list_ptr = addr (sdb.device_name);
108 next_device_ptr = null;
109 name_size = 32;
110 name = device;
111 sdb.stream_name = stream_name;
112
113 call ipc_$create_ev_chn (evchan, rcode);
114
115 if rcode ^= 0 then do;
116 call convert_ipc_code_ (rcode);
117 go to free1;
118 end;
119 ev_list.count = 1;
120
121 pip = addr (sdb.info);
122 prt_info.devname = name;
123
124 printer_info_ptr = addr (rcp_info);
125 rcp_info.version_num = 1;
126 rcp_info.usage_time = 0;
127 rcp_info.wait_time = 0;
128 rcp_info.system_flag = "0"b;
129 rcp_info.device_name = name;
130
131 call rcp_$attach ("printer", printer_info_ptr, evchan, "", rcp_id, rcode);
132 if rcode ^= 0 then go to free;
133
134 check: call rcp_$check_attach (rcp_id, printer_info_ptr, "", prt_info.devx, wksp_max, time_max,
135 rcp_state, rcode);
136 if rcode ^= 0 then go to free;
137
138 go to attach_state (rcp_state);
139
140 attach_state (1):
141 call ipc_$block (addr (sdb.ev_list), addr (ipc_message), rcode);
142 if rcode ^= 0 then do;
143 call convert_ipc_code_ (rcode);
144 go to free;
145 end;
146 go to check;
147
148 attach_state (2):
149 attach_state (3):
150 go to free;
151
152 attach_state (0):
153 prt_info.model = rcp_info.model;
154 prt_info.train = rcp_info.print_train;
155 prt_info.line_length = rcp_info.line_length;
156
157 call ioi_$workspace (prt_info.devx, wsegp, 1024, rcode);
158 if rcode ^= 0 then go to free;
159
160 call prtdim_util$init (sdb_ptr, rcode);
161 if rcode ^= 0 then go to free;
162
163 if mode ^= "save_vfc" then do;
164 call prtdim_util$load_vfc (sdb_ptr, rcode);
165 if rcode = error_table_$no_operation then rcode = 0;
166 else if rcode ^= 0 then go to free;
167 end;
168
169 idcwp = addr (prt_info.print_idcw);
170 idcw.control = "10"b;
171
172 stop, bgin, prev = 0;
173 wait_flag = "0"b;
174 running = "0"b;
175 marker_count = 0;
176 paper_low = "0"b;
177 error_count = 0;
178 reload_vfc_train_after_special = "0"b;
179 chars_printed = 0;
180
181 return;
182
183
184
185 free:
186 free1: substr (iostatus, 1, 36) = unspec (rcode);
187
188 go to detach;
189
190
191
192 prtdim_detach: entry (sdb_ptr, device, mode, iostatus);
193
194 iostatus = "0"b;
195
196 detach: call ipc_$delete_ev_chn (evchan, rcode);
197 if rcode ^= 0 then if substr (iostatus, 1, 36) = "0"b then do;
198 call convert_ipc_code_ (rcode);
199 substr (iostatus, 1, 36) = unspec (rcode);
200 end;
201
202 pip = addr (sdb.info);
203
204 call rcp_$detach (rcp_id, "0"b, error_count, "", rcode);
205 if rcode ^= 0 then
206 if substr (iostatus, 1, 36) = "0"b then
207 substr (iostatus, 1, 36) = unspec (rcode);
208
209 area_ptr = sdb.areap;
210 free sdb in (listen_based_area);
211
212 exit: substr (iostatus, 52, 1) = "1"b;
213 substr (iostatus, 41, 1) = "1"b;
214 return;
215
216
217
218
219 end prtdim_attach;