User Tools

Site Tools


cdc:nos2.source:opl871:fseform

FSEFORM

Table Of Contents

  • [00006] - STRING FORMATTING AND OUTPUT ROUTINES.
  • [00052] TTWRD - TRANSMIT ONE-WORD ACCUMULATOR TO OUTPUT.
  • [00070] TTSYNS - CONDITIONALLY DRAIN ONE-WORD ACCUMULATOR.
  • [00096] TTINIT - INITIALIZE ONE-WORD ACCUMULATOR.
  • [00107] TTCHL - FORMAT ONE CHARACTER FROM LEFT OF PARM.
  • [00136] TTCHR - FORMAT CHARACTER FROM RIGHT OF WORD.
  • [00149] TTST - FORMAT STRING OF SPECIFIED LENGTH.
  • [00168] TTSTR - FORMAT STRING TERMINATED BY $
  • [00191] TTLCSTR - TTSTR WITH CONVERT TO LOWER-CASE ON SCREEN.
  • [00217] TTBRK - FORMAT END-OF-LINE.
  • [00236] TTLIN - COMBINED TTSTR AND TTBRK.
  • [00251] GETNUM - FORMAT NUMBER BY RADIX.
  • [00278] PUTNUM - TRANSMIT NUMS1 AS BUILT BY GETNUM.
  • [00293] TTNUM - EXTERNAL INTERFACE TO ENCODE NUMBERS.
  • [00310] TTDEC - ENCODE INTEGER IN DECIMAL.
  • [00323] TTLPAD - LEFT PADDED ENCODE AND TRANSMIT OF INTEGER.

Source Code

FSEFORM.txt
  1. PROC FSEFORM;
  2. BEGIN
  3.  
  4.  
  5. #
  6. *** FSEFORM -- STRING FORMATTING AND OUTPUT ROUTINES.
  7. *
  8. * COPYRIGHT CONTROL DATA SYSTEMS INC. 1992.
  9. #
  10.  
  11. DEF LISTCON #0#;
  12.  
  13. *IFCALL SINGLE,COMFSGL
  14. *IFCALL ONLY,COMFONL
  15. *IFCALL MULTI,COMFMLT
  16. *CALL COMFFSE
  17.  
  18. # COMMON DATA #
  19.  
  20.  
  21. CONTROL IFEQ MULTI,1;
  22. XREF ARRAY RENTSTK [1:MAXREENT]; # SUBROUTINE STACK #
  23. BEGIN
  24. ITEM RSTK;
  25. END
  26. XREF ITEM RSTKPTR;
  27. CONTROL FI;
  28. PAGE # COMMON DATA, EXTERNALS #
  29.  
  30.  
  31. *CALL COMFDS1
  32. *CALL COMFVD2
  33. *CALL COMFDS2
  34. *CALL COMFTAB
  35.  
  36.  
  37. XREF
  38. BEGIN
  39. *CALL COMFXSB
  40. *CALL COMFXVT
  41. *CALL COMFXTI
  42. END
  43.  
  44.  
  45. XDEF
  46. BEGIN
  47. *CALL COMFXFO
  48. END
  49. PAGE PROC TTWRD;
  50. IOBEGIN(TTWRD)
  51. #
  52. ** TTWRD - TRANSMIT ONE-WORD ACCUMULATOR TO OUTPUT.
  53. *
  54. * ENTRY TTOWB - CONTAINS TEXT TO BE OUTPUT.
  55. * TTCDC - SHOWS CHARACTER COUNT IN TTOWB.
  56. *
  57. * EXIT BOTH PARAMETERS CLEARED.
  58. *
  59. * CALLS VDTWTO.
  60. #
  61. VDTWTO(TTOWB); # TRANSMIT WORD #
  62. TTOWB = 0; # CLEAR WORD #
  63. TTCBC = -1; # SHOW EMPTY #
  64. IOEND
  65.  
  66.  
  67. PROC TTSYNC;
  68. IOBEGIN(TTSYNC)
  69. #
  70. ** TTSYNS - CONDITIONALLY DRAIN ONE-WORD ACCUMULATOR.
  71. *
  72. * ENTRY TTCBC - CHARACTER COUNT IN TTOWB.
  73. *
  74. * EXIT TTCBC CLEAR, OUTPUT POSSIBLY TRANSMITTED.
  75. *
  76. * CALLS TTCHR, TTWRD.
  77. #
  78. IF TTCBC GQ 0 THEN # DRAIN PREVIOUS #
  79. BEGIN
  80. CONTROL IFEQ SINGLE,1;
  81. IF NOT TTYOUTPUT THEN GOTO TTSYNC2;
  82. CONTROL FI;
  83. IF TTCBC LAN 1 EQ 0 THEN TTCHR(O"00");
  84. TTCHR(O"00"); # CONTROL BYTE 0013B #
  85. TTCHR(O"13");
  86. TTSYNC2:
  87. IF TTCBC EQ 9 THEN TTWRD;
  88. TTWRD;
  89. END
  90. IOEND # OF TTSYNC #
  91.  
  92.  
  93. PROC TTINIT;
  94. BEGIN
  95. #
  96. ** TTINIT - INITIALIZE ONE-WORD ACCUMULATOR.
  97. *
  98. * EXIT TTCBC, TTOCB, TTOWB - CLEARED.
  99. #
  100. TTOWB=0;
  101. TTOCB=0;
  102. TTCBC=-1;
  103. END # OF TTINIT #
  104. PAGE PROC TTCHL(A); # CHAR (LEFT) #
  105. IOBEGIN(TTCHL)
  106. #
  107. ** TTCHL - FORMAT ONE CHARACTER FROM LEFT OF PARM.
  108. *
  109. * ENTRY A - WORD WITH CHARACTER IN TOP OF WORD.
  110. * SCREENMODE - WHETHER TO USE VIRTERM OR TTWRD.
  111. *
  112. * CALLS VDTCHR, TTWRD.
  113. *
  114. * USES TTOCB, TTCBC, TTOWB.
  115. #
  116. ITEM A;
  117. ITEM B;
  118. IF SCREENMODE THEN
  119. BEGIN
  120. B=C<0,1>A;
  121. B=XLTDSPXP[B];
  122. VDTCHR(B);
  123. END
  124. ELSE
  125. BEGIN
  126. TTOCB = A; # HOLD CHAR #
  127. IF TTCBC EQ 9 THEN TTWRD; # FULL WORD #
  128. TTCBC = TTCBC + 1; # INCREMENT POINTER #
  129. C<TTCBC>TTOWB = C<0>TTOCB; # CHAR TO WORD #
  130. END
  131. IOEND
  132.  
  133. PROC TTCHR(A);
  134. IOBEGIN(TTCHR)
  135. #
  136. ** TTCHR - FORMAT CHARACTER FROM RIGHT OF WORD.
  137. *
  138. * ENTRY A - WORD WITH CHARACTER IN RIGHT END.
  139. *
  140. * CALLS TTCHL.
  141. #
  142. ITEM A,B;
  143. C<0,1>B=C<9,1>A;
  144. TTCHL(B);
  145. IOEND # OF TTCHR #
  146. PAGE PROC TTST(A,B);
  147. IOBEGIN(TTST)
  148. #
  149. ** TTST - FORMAT STRING OF SPECIFIED LENGTH.
  150. *
  151. * ENTRY A - STRING OF 6-BIT CHARACTERS.
  152. * B - LENGTH OF STRING.
  153. *
  154. * CALLS TTCHL.
  155. *
  156. * USES P<STR>, STL, S2.
  157. #
  158. ITEM A C (240), B;
  159. P&lt;STR> = LOC(A); # SAVE PARMS #
  160. STL = B - 1;
  161. FOR S2=0 STEP 1 UNTIL STL DO TTCHL(C&lt;S2>ST); # COPY STRING #
  162. IOEND
  163.  
  164.  
  165. PROC TTSTR(A);
  166. IOBEGIN(TTSTR)
  167. #
  168. ** TTSTR - FORMAT STRING TERMINATED BY $
  169. *
  170. * ENTRY A - STRING.
  171. *
  172. * CALLS TTST, TTBRK.
  173. *
  174. * USES S1.
  175. #
  176. ITEM A C (240);
  177. S1 = 0;
  178. WHYLE S1 LS 80 AND C&lt;S1>A NQ "$" DO S1 = S1+1; # FIND END OF STR #
  179. IF S1 EQ 80 THEN
  180. BEGIN # ERROR #
  181. TTST("NO $ IN TTSTR STRING",20);
  182. TTBRK;
  183. END
  184. ELSE TTST(A,S1); # WRITE THE STRING #
  185. IOEND
  186.  
  187.  
  188. PROC TTLCSTR(A);
  189. IOBEGIN(TTLCSTR)
  190. #
  191. ** TTLCSTR - TTSTR WITH CONVERT TO LOWER-CASE ON SCREEN.
  192. *
  193. * ENTRY A - UPPER-CASE STRING WITH $ TERMINATOR.
  194. *
  195. * CALLS VDTCHR, MORTAL.
  196. *
  197. * USES S1, P<STR>.
  198. #
  199. ITEM A C(240);
  200. ITEM B I;
  201. IF NOT SCREENMODE THEN MORTAL(" SCREEN MODE REQUIRED.$");
  202. S1 = 0;
  203. P&lt;STR> = LOC(A);
  204. WHYLE C&lt;S1>ST NQ "$" DO
  205. BEGIN
  206. B = C&lt;S1>ST;
  207. IF B GQ "A" AND B LQ "Z" THEN VDTCHR(XLTDSPXP[B]+O"40");
  208. ELSE VDTCHR(XLTDSPXP[B]);
  209. S1 = S1 + 1;
  210. END
  211. IOEND # OF TTLCSTR #
  212.  
  213.  
  214. PAGE PROC TTBRK;
  215. IOBEGIN(TTBRK)
  216. #
  217. ** TTBRK - FORMAT END-OF-LINE.
  218. *
  219. * ENTRY TTCBC, SCREENMODE - CONTROL NEED TO DO ANYTHING.
  220. *
  221. * CALLS TTCHL, TTWRD.
  222. #
  223. IF TTCBC GQ 0 AND NOT SCREENMODE THEN # NON-TRIVIAL #
  224. BEGIN
  225. IF C&lt;TTCBC>TTOWB EQ 0 THEN TTCHL(" "); # BLANK AFTER COLON #
  226. IF TTCBC EQ 8 THEN TTCHL(" "); # NO 66-BIT EOL #
  227. IF TTCBC GQ 8 THEN TTWRD; # NEED EXTRA WORD #
  228. TTWRD; # DUMP THE EOL #
  229. END
  230. IOEND
  231.  
  232.  
  233. PROC TTLIN(A); # TTSTR + TTBRK #
  234. IOBEGIN(TTLIN)
  235. #
  236. ** TTLIN - COMBINED TTSTR AND TTBRK.
  237. *
  238. * ENTRY A - PARAMETER TO PASS ON TO TTSTR.
  239. *
  240. * CALLS TTSTR, TTBRK.
  241. #
  242. ARRAY A;;
  243. TTSTR(A); # OUTPUT STRING #
  244. TTBRK; # END LINE #
  245. IOEND
  246.  
  247.  
  248. PROC GETNUM(A,B);
  249. BEGIN
  250. #
  251. ** GETNUM - FORMAT NUMBER BY RADIX.
  252. *
  253. * ENTRY A - BINARY INTEGER TO ENCODE.
  254. * B - RADIX (BASE).
  255. *
  256. * EXIT NUMS1 - CONTAINS FORMATTED NUMBER.
  257. * S1, S2 - RESIDUAL VALUES LEFT FOR PUTNUM USAGE.
  258. *
  259. * MACROS MOD.
  260. *
  261. * USES S1,S2.
  262. #
  263. ITEM A,B;
  264. S1=ABS(A);
  265. S2 = -1; # COUNT DIGITS #
  266. WHYLE S1 GQ B DO # NOT DONE YET #
  267. BEGIN
  268. S2 = S2 + 1; # BUMP POINTER #
  269. C&lt;S2>NUMS1 = MOD(S1,B) + O"33"; # GET A DIGIT #
  270. S1 = S1/B; # REDUCE NUMBER #
  271. END
  272. END
  273.  
  274.  
  275. PROC PUTNUM; # WRITE SET UP NUM #
  276. IOBEGIN(PUTNUM)
  277. #
  278. ** PUTNUM - TRANSMIT NUMS1 AS BUILT BY GETNUM.
  279. *
  280. * ENTRY NUMS1 - ENCODED NUMBER IN GETNUM FORMAT.
  281. * S1, S2 - AS LEFT BY GETNUM.
  282. *
  283. * EXIT S2 - DESTROYED.
  284. *
  285. * CALLS TTCHL, TTCHR.
  286. #
  287. TTCHR(S1+O"33"); # FIRST DIGIT #
  288. FOR S2=S2 STEP -1 UNTIL 0 DO TTCHL(C&lt;S2>NUMS1); # REST OF DIGITS #
  289. IOEND
  290. PAGE PROC TTNUM(A,B); # NUMBER A IN RADIX B #
  291. IOBEGIN(TTNUM)
  292. #
  293. ** TTNUM - EXTERNAL INTERFACE TO ENCODE NUMBERS.
  294. *
  295. * ENTRY A - INTEGER TO ENCODE AND TRANSMIT.
  296. * B - RADIX.
  297. *
  298. * CALLS GETNUM, TTCHL, PUTNUM.
  299. #
  300. ITEM A,B;
  301. GETNUM(A,B); # SET UP S1,S2,NUMS1 #
  302. IF A LS 0 THEN TTCHL("-"); # MINUS SIGN #
  303. PUTNUM; # AND WRITE NUMBER #
  304. IOEND
  305.  
  306.  
  307. PROC TTDEC(A); # NUMBER A IN DECIMAL #
  308. IOBEGIN(TTDEC)
  309. #
  310. ** TTDEC - ENCODE INTEGER IN DECIMAL.
  311. *
  312. * ENTRY A - INTEGER.
  313. *
  314. * CALLS TTNUM.
  315. #
  316. TTNUM(A,10);
  317. IOEND
  318.  
  319.  
  320. PROC TTLPAD(A,N,C); # LEFT PAD DECIMAL NUM #
  321. IOBEGIN(TTLPAD)
  322. #
  323. ** TTLPAD - LEFT PADDED ENCODE AND TRANSMIT OF INTEGER.
  324. *
  325. * ENTRY A - INTEGER.
  326. * N - FIELD WIDTH.
  327. * C - PADDING CHARACTER.
  328. *
  329. * CALLS GETNUM, PUTNUM, TTCHL.
  330. *
  331. * USES S2, S3, S4.
  332. #
  333. ITEM A,N,C;
  334. IF A GQ 0 THEN # DON'T DO NEGATIVE #
  335. BEGIN
  336. GETNUM(A,10); # S2=WIDTH-1 #
  337. S3 = N - S2 - 3; # S3=PAD WIDTH-1 #
  338. S4 = C; # PAD CHARACTER #
  339. FOR S3=S3 STEP -1 UNTIL 0 DO TTCHL(S4); # WRITE PADDING #
  340. PUTNUM; # WRITE NUMBER #
  341. END
  342. IOEND
  343.  
  344.  
  345.  
  346. END TERM
cdc/nos2.source/opl871/fseform.txt ยท Last modified: 2023/08/05 17:24 by Site Administrator