GDSX (Extended General Device Support) Manual
Using Pseudo Procedures in a TS/MP Environment
Extended General Device Support (GDSX) Manual—529931-001
D-7
USAMPLE1 Listing
71. Term^Type ; -- terminal type
72.
73. Begin
74.
75. !===========================================================================
76. ! USCODE can declare desired DEVICE^HANDLER Local Variables here
77. !===========================================================================
78.
79. Int .EXT My^Dcb (DCB^TEMPLATE);
80. Int .EXT RCV^IOCB (IOCB^TEMPLATE);
81. Int .EXT Term^IOCB (IOCB^TEMPLATE);
82. Int .EXT MY^TCB (TCB^TEMPLATE);
83.
84. Int .EXT Term^Buf := 0D;
85. String .EXT S^Term^Buf = Term^Buf;
86. Int .EXT Rcv^Buf := 0D;
87. String .EXT S^Rcv^Buf = Rcv^Buf;
88. Int .EXT Work^Buf := 0D;
89. String .EXT S^Work^Buf = Work^Buf;
90.
91.
92. Int Dolr^Rcv := 0;
93. Int Evt := 0;
94.
96. !===========================================================================
97. ! Initialization procedure
98. !===========================================================================
99. SubProc Initialize^Device^Handler;
100. Begin
101.
102. ! reserve all the buffers we need
103. @RCV^Buf := GetExtPool(11,32); ! from message pool
104. If @RCV^Buf = 0D Then
105. Call Debug;
106.
107. @Term^Buf := GetExtPool(11,32); ! from message pool
108. If @Term^Buf = 0D Then
109. Call Debug;
110.
111. @Work^Buf := GetExtPool(10,32); ! from buffer pool
112. If @Work^Buf = 0D Then
113. Call Debug;
114.
115. While 1 Do Begin
116. -- Read messages from $RECEIVE, until we receive our initialization
messge
117. Call ^Readupdatex(Dolr^Rcv,Rcv^Buf,64);
118.
119. Evt := Wait^Event ((Disp^Imsg + Disp^Stop), -1D);
120.
121. Case Evt of Begin
122. E^Imsg -> ! from $RECEIVE
123. Begin
124. -- let's get the address of the IOCB for the message just
completed
125. @Rcv^Iocb := ^Listen (1,0,0);
126. -- get the new bufferaddress
127. @Work^Buf := Rcv^Iocb.BufaddrX;
128. -- move the buffer
129. If Work^Buf[7] = ["Initialization"] Then Begin
130. -- If we have the init. message, we can exit this loop
131. -- write the first buffer and wait for the first message
132. Term^Buf ':=' "Enter your text: xnnnkkkkkkkkkkk.... " &
133. Term^Buf[18] for 12;
134. Call ^WriteReadX(Term^File^Num, Term^Buf, 50, 64);
135. -- return to the main-loop
136. Return;
137. End
138. Else
139. -- reply to $RECEIVE, but not to the init. message
140. -- (this is done in the main loop)
141. Call ^Replyx();
142. End;