GDSX (Extended General Device Support) Manual
Using Pseudo Procedures in a TS/MP Environment
Extended General Device Support (GDSX) Manual—529931-001
D-27
USAMPLE2 Listing
269. @My^Dcb := Dcbtbl[Internal^Term^No];
270. @My^Tcb := My^Dcb.Tcbaddr;
271
272 -- Do the initialization
273. Call Initialize^Device^Handler;
274.
275. -- Do the Main-Loop
276. While 1 Do Begin
277.
278. -- wait for an event to complete (message from device or stop)
279. Evt := Wait^Event ((Disp^Ioc + Disp^Stop), -1D);
280.
281. -- an event occured
282. Case Evt of Begin
283. E^Ioc -> -- from our device
284. Begin
285. -- let's get the address of the IOCB for the message just
completed
286. Filenum := -1;
287. @Term^Iocb := ^Listen (0, Filenum, 0);
288. -- get the new address for the new buffer
289. @Work^Buf := Term^Iocb.BufaddrX;
290. -- clear the buffer that we send to the Server
291. RCV^Buf ':=' " " & RCV^Buf for 30;
292. -- move the buffer that we received from our device
293. RCV^Buf ':=' 0 & Work^Buf For Term^Iocb.Iocnt Bytes;
294. If Check^Buffer Then Begin
295. -- buffer passed our checks
296. -- start a TMF transaction
297. Ferr := ^Begintransaction;
298. If Ferr Then
299. -- we have an error with ^BEGINTRANSACTION - let's die
300. Call Debug;
301. -- send the buffer that we just received to the server
303. Call Call^PathSend;
305. If Ferr Then Begin
306. -- ^SERVERCLASS_SEND_ reported an error
307. -- let's cancel this transaction
308. Ferr := ^Aborttransaction;
309. If Ferr Then
310. -- we have an error with ^ABORTTRANSACTION - let's die
311. Call Debug;
312. -- get more info about the error reported by
313. -- ^SERVERCLASS_SEND_
314. Ferr := ^Serverclass_Send_Info_ (Pathsend^Error,
315. Pathsend^Error[1]);
316. If Ferr Then
317. -- we have an error with ^SERVERCLASS_SEND_INFO_
318. Call Debug;
319. -- move the error from ^SERVERCLASS_SEND_INFO_ into the
buffer
320. S^Term^Buf ':=' "Serverclass_Send_ error ";
322. S^Term^Buf ':=' "Serverclass_Send_ error " &
323. "PE:xxx, FS:xxx " &
324. S^Term^Buf[38] for 11 Bytes;
325. Call Numout(Ascii^Result, Pathsend^Error, 10, 3);
326. S^Term^Buf[27] ':=' Ascii^Result for 3 Bytes;
327. Call Numout(Ascii^Result, Pathsend^Error[1], 10, 3);
328. S^Term^Buf[35] ':=' Ascii^Result for 3 Bytes;
329. -- write the response from the server to our device
330. Call ^WriteReadX(Term^File^Num, Term^Buf, 50, 62);
331. End
332. Else Begin
333. -- ^SERVERCLASS_SEND_ reported no error
334. -- let's end this transaction
335. Ferr := ^Endtransaction;
336. If Ferr Then
337. -- we have an error with ^ENDTRANSACTION - let's die
338. Call Debug;
339. -- move the buffer that we received from ^SERVERCLASS_SEND_
340. -- to the Terminal^Buffer
341. Term^Buf ':=' Rcv^Buf[1] For 60 Bytes;
342. -- write the response from the server to our device