GDSX (Extended General Device Support) Manual
Using Pseudo Procedures in a TS/MP Environment
Extended General Device Support (GDSX) Manual—529931-001
D-8
USAMPLE1 Listing
143. E^Stop -> ! task is stopping
144. Call Stop^Task;
145. End;
146. End; ! of While
147.
148. End;
149.
151. !===========================================================================
152. Int SubProc Check^Buffer;
153. !===========================================================================
154. ! we return the value 0, when we detected an error
155. ! we return the value 1, when the buffer is OK
156. !===========================================================================
157. Begin
158.
159. Int S^Error;
160.
161. S^Error := String_Upshift_ (S^Term^Buf[0]:1,S^Term^Buf[0]:1);
162. If S^Error Or
163. S^Term^Buf[0] <> ["W"] And
164. S^Term^Buf[0] <> ["D"] Then Begin
165. Term^Buf ':=' "wrong function code (x) (must be 'd' or 'w') " &
166. Term^Buf[22] For 18 Bytes;
167. Return 0;
168. End;
169.
170. If Not $Numeric(S^Term^Buf[1]) Or
171. Not $Numeric(S^Term^Buf[2]) Or
172. Not $Numeric(S^Term^Buf[3]) Then Begin
173. Term^Buf ':=' "loop-counter (nnn) is not numeric " &
174. Term^Buf[17] For 28 Bytes;
175. Return 0;
176. End;
177.
178. -- everything is OK
179. Return 1;
180.
181. End;
185. !===========================================================================
186. ! DEVICE^HANDLER Procedure MAIN ENTRY POINT Begins here
187. !===========================================================================
188.
189. ! Find out our own DCB- and TCB-address
190. @My^Dcb := Dcbtbl[Internal^Term^No];
191. @My^Tcb := My^Dcb.Tcbaddr;
192.
193. -- Do the initialization - wait for buffer 'Initialization'
194. Call Initialize^Device^Handler;
195.
196. -- Do the Main-Loop
197. While 1 Do Begin
198.
199. Evt := Wait^Event ((Disp^Imsg + Disp^Ioc + Disp^Stop), -1D);
200.
201. Case Evt of Begin
202. E^Imsg -> ! From $Rcv
203. Begin
204. -- let's get the address of the IOCB for the message just
completed
205. @Rcv^Iocb := ^Listen (1,0,0);
206. -- get the new address of the new buffer
207. @Work^Buf := Rcv^Iocb.BufaddrX;
208. -- move the buffer
209. Term^Buf ':=' "Rep: " & Work^Buf[1] For
210. (Rcv^Iocb.Iocnt-2) Bytes;
211. -- write the buffer to our device
212. Call ^WriteReadX(Term^File^Num, Term^Buf, 50, 62);
213. End;
214.
215. E^Ioc -> ! from our device
216. Begin
217. -- let's get the address of the IOCB for the message just
completed