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 tc_block:
42 procedure (TC_data_ptr, Request_ptr, mask_type);
43
44 declare TC_data_ptr pointer;
45 declare Request_ptr pointer;
46
47
48
49
50
51
52
53
54
55
56
57 declare mask_type bit (36) aligned;
58
59 declare UNMASK_ALL bit (36) aligned initial (""b) internal static options (constant);
60 declare UNMASK_QUIT_ONLY bit (36) aligned initial ("1"b) internal static options (constant);
61 declare UNMASK_NOTHING bit (36) aligned initial ("01"b) internal static options (constant);
62 declare RESTORE_MASK bit (36) aligned initial ("001"b) internal static options (constant);
63
64 declare 1 EWI aligned like event_wait_info automatic;
65 declare 1 event_wait aligned,
66 2 n_channels fixed bin,
67 2 pad bit (36) aligned,
68 2 channels (2) fixed bin (71);
69
70 declare ipc_$block entry (ptr, ptr, fixed bin (35));
71 declare ipc_$create_ev_chn entry (fixed bin (71), fixed bin (35));
72 declare tc_error entry (fixed bin (35), character (*));
73 declare (
74 tc_mask$close,
75 tc_mask$open_all,
76 tc_mask$open_quit
77 ) external entry;
78
79 declare tc_mask$restore entry (bit (36) aligned);
80
81 declare hcs_$get_ips_mask entry (bit (36) aligned);
82
83 declare ips_mask bit (36) aligned;
84 declare saved_change_pclock fixed bin (35);
85 declare code fixed bin (35);
86 declare cleanup condition;
87 declare addr builtin;
88 ^L
89
90 tc_data_ptr = TC_data_ptr;
91 request_ptr = Request_ptr;
92
93 state.pending.count = tc_data.state.pending.count + 1;
94 state_have_sent_protocol (tc_data.state.pending.count) = "0"b;
95 state_async_same_window (tc_data.state.pending.count) = "0"b;
96
97 tc_data.state.pending.blocked_windows (tc_data.state.pending.count) = request_header.window_id;
98
99 event_wait.n_channels = 0;
100
101 event_wait.pad = ""b;
102 event_wait.channels (1) = tc_data.event;
103
104
105
106
107
108
109 event_wait.n_channels = 2;
110 if tc_data.state.pending.protocol_evs (tc_data.state.pending.count) = 0
111 then do;
112 call ipc_$create_ev_chn (event_wait.channels (2), (0));
113 tc_data.state.pending.protocol_evs (tc_data.state.pending.count) = event_wait.channels (2);
114 end;
115 else event_wait.channels (2) = tc_data.state.pending.protocol_evs (tc_data.state.pending.count);
116
117 ips_mask = request_header.saved_ips_mask;
118
119 on cleanup
120 begin;
121 state.pending.count = state.pending.count - 1;
122 if mask_type = RESTORE_MASK
123 then call hcs_$get_ips_mask (request_header.saved_ips_mask);
124 end;
125
126 saved_change_pclock = tc_data.change_pclock;
127
128 if mask_type = UNMASK_QUIT_ONLY
129 then call tc_mask$open_quit;
130 else if mask_type = UNMASK_ALL
131 then call tc_mask$open_all;
132 else if mask_type = UNMASK_NOTHING
133 then ;
134 else if mask_type = RESTORE_MASK
135 then call tc_mask$restore (ips_mask);
136
137 call ipc_$block (addr (event_wait), addr (EWI), code);
138
139 call tc_mask$close ();
140 revert cleanup;
141 tc_data.state.pending.count = tc_data.state.pending.count - 1;
142
143 if code ^= 0
144 then call tc_error (code, "Terminal Control could not block.");
145
146
147 if (tc_data.change_pclock ^= saved_change_pclock)
148 then do;
149 request_header.async_interruption = "1"b;
150
151 if state_async_same_window (tc_data.state.pending.count + 1)
152 then request_header.this_window = "1"b;
153 end;
154
155 start_if_we_have_to:
156 begin;
157
158 declare hcs_$wakeup entry (bit (*), fixed bin (71), fixed bin (71), fixed bin (35));
159 declare get_process_id_ entry () returns (bit (36));
160
161
162
163
164
165
166 if tc_data.state.pending.count > 0
167 then if ^state_have_sent_protocol (tc_data.state.pending.count)
168 then do;
169 call hcs_$wakeup (get_process_id_ (),
170 tc_data.state.pending.protocol_evs (tc_data.state.pending.count), 0, code);
171
172 if code ^= 0
173 then call tc_error (code, "wakeup failed");
174 state_have_sent_protocol (tc_data.state.pending.count) = "1"b;
175
176 end;
177 end start_if_we_have_to;
178
179
180 %page;
181 %include tc_data_;
182 %include tc_operations_;
183 %include event_wait_info;
184
185 end tc_block;