home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / pdp10 / k10tt.bli < prev    next >
Text File  |  2020-01-01  |  8KB  |  505 lines

  1. MODULE KERTT (IDENT = '2.0.003'
  2.         ) =
  3. BEGIN
  4.  
  5. SWITCHES LANGUAGE (COMMON);
  6.  
  7. !<BLF/WIDTH:100>
  8.  
  9. !++
  10. ! FACILITY:
  11. !
  12. !    KERMIT text processing
  13. !
  14. ! ABSTRACT:
  15. !
  16. !    This module contains all of the text processing required for
  17. !    KERMSG.
  18. !
  19. ! ENVIRONMENT:
  20. !
  21. !    TOPS-10, P/OS, VAX/VMS
  22. !
  23. ! AUTHOR: Robert C. McQueen, CREATION DATE: 29-August-1983
  24. !--
  25.  
  26. %SBTTL 'Table of Contents'
  27. !
  28. ! TABLE OF CONTENTS:
  29. !
  30. %SBTTL 'Revision History'
  31.  
  32. !++
  33. !
  34. ! Create this module for PRO/Kermit 1.0, Kermit-10 2(100) and Kermit-32 1.2
  35. !
  36. ! 1.2.000    By: Robert C. McQueen            On: 29-August-1983
  37. !        Create this module.
  38. !
  39. ! 1.2.001    By: Robert C. McQueen        On: 9-Sept-1983
  40. !        Make the string passed to TERM_DUMP a counted ASCIZ string,
  41. !        not a counted ASCII string.
  42. !
  43. ! 1.2.002    By: Robert C. McQueen        On: 16-September-1983
  44. !        Make TT_OUTPUT a global routine, so we can force information
  45. !        output a various points in time.
  46. !
  47. ! 2.0.003    Release for TOPS-10 KERMIT-10 version 2.
  48. !        Release for VAX/VMS KERMIT-32 version 2.
  49. !--
  50.  
  51. %SBTTL 'Library files'
  52. !
  53. ! INCLUDE FILES:
  54. !
  55. !
  56. ! KERMIT common definitions
  57. !
  58.  
  59. REQUIRE 'KERCOM';
  60.  
  61. %SBTTL 'Symbol definitions'
  62. !
  63. ! EQUATED SYMBOLS:
  64. !
  65.  
  66. LITERAL
  67.     TEXT_BFR_LENGTH = 256;            ! Length of the text buffer
  68.  
  69. %SBTTL 'Storage'
  70. !
  71. ! OWN STORAGE:
  72. !
  73. !
  74. ! TT_xxxxx routine storage
  75. !
  76.  
  77. OWN
  78.     DUMP_ROUTINE,                ! Address of routine to dump text
  79.     TEXT_COUNT,                    ! Count of the characters
  80.     TEXT_POINTER,                ! Pointer to store characters
  81.     TEXT_BUFFER : VECTOR [CH$ALLOCATION (TEXT_BFR_LENGTH)];    ! Buffer of characters
  82.  
  83. %SBTTL 'External storage'
  84.  
  85. !++
  86. ! The following is the various external storage locations that are
  87. ! referenced from this module.
  88. !--
  89.  
  90. !
  91. ! KERMSG storage
  92. !
  93.  
  94. EXTERNAL
  95.     CONNECT_FLAG;                ! Flag if communications line is TT:
  96.  
  97. !++
  98. ! The following is the only external routine used by this module.  This
  99. ! routine will cause the terminal buffer that we have been building to be
  100. ! output on the terminal
  101. !--
  102.  
  103. EXTERNAL ROUTINE
  104.     TERM_DUMP : NOVALUE;            ! Output the terminal buffer
  105.  
  106. %SBTTL 'Terminal routines -- TT_INIT - Initialize this module'
  107.  
  108. GLOBAL ROUTINE TT_INIT : NOVALUE =
  109.  
  110. !++
  111. ! FUNCTIONAL DESCRIPTION:
  112. !
  113. !    This routine will initialize the terminal processing module.  It will
  114. !    initialize the various data locations in this module.
  115. !
  116. ! CALLING SEQUENCE:
  117. !
  118. !    TT_INIT();
  119. !
  120. ! INPUT PARAMETERS:
  121. !
  122. !    None.
  123. !
  124. ! IMPLICIT INPUTS:
  125. !
  126. !    None.
  127. !
  128. ! OUTPUT PARAMETERS:
  129. !
  130. !    None.
  131. !
  132. ! IMPLICIT OUTPUTS:
  133. !
  134. !    None.
  135. !
  136. ! COMPLETION CODES:
  137. !
  138. !    None.
  139. !
  140. ! SIDE EFFECTS:
  141. !
  142. !    None.
  143. !
  144. !--
  145.  
  146.     BEGIN
  147. !
  148. ! Now initialize the various pointers
  149. !
  150.     TEXT_COUNT = 0;
  151.     TEXT_POINTER = CH$PTR (TEXT_BUFFER);
  152.     DUMP_ROUTINE = TERM_DUMP;            ! Initial output routine is to terminal
  153.     END;                    ! End of TT_INIT
  154.  
  155.     %SBTTL    'TT_SET_OUTPUT - Set output routine to use'
  156. GLOBAL ROUTINE TT_SET_OUTPUT (OUT_RTN) =
  157.  
  158. !++
  159. ! FUNCTIONAL DESCRIPTION:
  160. !
  161. ! This routine will set the output routine to use for the TT_xxx routines.
  162. !The argument is a routine address which will output a counted ASCIZ string.
  163. !It will return the address of the previous output routine.
  164. !
  165. ! CALLING SEQUENCE:
  166. !
  167. !    OLD_RTN = TT_SET_OUTPUT (OUT_RTN);
  168. !
  169. ! INPUT PARAMETERS:
  170. !
  171. !    OUT_RTN - Address of routine to output a counted ASCIZ string
  172. !        called as OUT_RTN (Address of string, length of string)
  173. !
  174. ! IMPLICIT INPUTS:
  175. !
  176. !    DUMP_ROUTINE - Previous output routine
  177. !
  178. ! OUPTUT PARAMETERS:
  179. !
  180. !    The value of the routine is the previous output routine address.
  181. !
  182. ! IMPLICIT OUTPUTS:
  183. !
  184. !    DUMP_ROUTINE - New output routine
  185. !
  186. ! COMPLETION CODES:
  187. !
  188. !    None.
  189. !
  190. ! SIDE EFFECTS:
  191. !
  192. !    None.
  193. !
  194. !--
  195.  
  196. BEGIN
  197. LOCAL
  198.     OLD_RTN;            ! Old routine address
  199.  
  200. OLD_RTN = .DUMP_ROUTINE;    ! Remember the old address
  201. DUMP_ROUTINE = .OUT_RTN;    ! Save the new
  202. RETURN .OLD_RTN;        ! And return the old value
  203. END;                ! End of TT_SET_OUTPUT
  204.  
  205. %SBTTL 'Terminal routines -- TT_OUTPUT - Output the buffer'
  206. GLOBAL ROUTINE TT_OUTPUT : NOVALUE =
  207.  
  208. !++
  209. ! FUNCTIONAL DESCRIPTION:
  210. !
  211. !    This routine will dump the text buffer on the output device.
  212. !
  213. ! CALLING SEQUENCE:
  214. !
  215. !    TT_OUTPUT();
  216. !
  217. ! INPUT PARAMETERS:
  218. !
  219. !    None.
  220. !
  221. ! IMPLICIT INPUTS:
  222. !
  223. !    None.
  224. !
  225. ! OUTPUT PARAMETERS:
  226. !
  227. !    None.
  228. !
  229. ! IMPLICIT OUTPUTS:
  230. !
  231. !    None.
  232. !
  233. ! COMPLETION CODES:
  234. !
  235. !    None.
  236. !
  237. ! SIDE EFFECTS:
  238. !
  239. !    None.
  240. !
  241. !--
  242.  
  243.     BEGIN
  244.  
  245.     LOCAL
  246.     STATUS;                    ! Status returned by the library routine
  247.  
  248. !
  249. ! Output the text
  250. !
  251.     CH$WCHAR_A (CHR_NUL, TEXT_POINTER);
  252.     (.DUMP_ROUTINE) (TEXT_BUFFER, .TEXT_COUNT); ! Output the buffer to the correct place
  253. !
  254. ! Now reset the descriptor and the pointer to a virgin state
  255. !
  256.     TEXT_COUNT = 0;
  257.     TEXT_POINTER = CH$PTR (TEXT_BUFFER);
  258. !
  259.     END;                    ! End of TT_OUTPUT
  260. %SBTTL 'Terminal routines -- TT_CHAR - Output a single character'
  261.  
  262. GLOBAL ROUTINE TT_CHAR (CHARACTER) : NOVALUE =
  263.  
  264. !++
  265. ! FUNCTIONAL DESCRIPTION:
  266. !
  267. !    This routine will store a character into the text buffer.  It will
  268. !    cause the text to be output if the character is a line terminator.
  269. !
  270. ! CALLING SEQUENCE:
  271. !
  272. !    TT_CHAR(Character);
  273. !
  274. ! INPUT PARAMETERS:
  275. !
  276. !    Character - Character to store into the text buffer.
  277. !
  278. ! IMPLICIT INPUTS:
  279. !
  280. !    None.
  281. !
  282. ! OUTPUT PARAMETERS:
  283. !
  284. !    None.
  285. !
  286. ! IMPLICIT OUTPUTS:
  287. !
  288. !    None.
  289. !
  290. ! COMPLETION CODES:
  291. !
  292. !    None.
  293. !
  294. ! SIDE EFFECTS:
  295. !
  296. !    None.
  297. !
  298. !--
  299.  
  300.     BEGIN
  301. !
  302. ! Increment the count of the characters
  303. !
  304.     TEXT_COUNT = .TEXT_COUNT + 1;
  305. !
  306. ! And store the character
  307. !
  308.     CH$WCHAR_A (.CHARACTER, TEXT_POINTER);
  309. !
  310. ! If this is a line feed then just output the text string
  311. !
  312.  
  313.     IF .CHARACTER EQL CHR_LFD THEN TT_OUTPUT ();
  314. !
  315. ! Check to make sure we are not exceeding the limit of the buffer
  316. !
  317.     IF .TEXT_COUNT EQL TEXT_BFR_LENGTH-1 THEN TT_OUTPUT ();
  318.  
  319.  
  320. !
  321.     END;                    ! End of TT_CHAR
  322.  
  323. %SBTTL 'Terminal routines -- TT_TEXT - Output a text string'
  324.  
  325. GLOBAL ROUTINE TT_TEXT (ADDRESS) : NOVALUE =
  326.  
  327. !++
  328. ! FUNCTIONAL DESCRIPTION:
  329. !
  330. !    This routine will output text on the user's terminal.  It will
  331. !    assume that it must check to determine if it can output the text
  332. !    or not.
  333. !
  334. ! CALLING SEQUENCE:
  335. !
  336. !    TT_TEXT(TEXT_ADDRESS);
  337. !
  338. ! INPUT PARAMETERS:
  339. !
  340. !    None.
  341. !
  342. ! IMPLICIT INPUTS:
  343. !
  344. !    None.
  345. !
  346. ! OUTPUT PARAMETERS:
  347. !
  348. !    None.
  349. !
  350. ! IMPLICIT OUTPUTS:
  351. !
  352. !    None.
  353. !
  354. ! COMPLETION CODES:
  355. !
  356. !    None.
  357. !
  358. ! SIDE EFFECTS:
  359. !
  360. !    None.
  361. !
  362. !--
  363.  
  364.     BEGIN
  365.  
  366.     LOCAL
  367.     CHARACTER,                ! Character being processed
  368.     ARG_POINTER;                ! Pointer to the argument's text
  369.  
  370. !
  371. ! Construct a pointer to the argument.
  372. !
  373.     ARG_POINTER = CH$PTR (.ADDRESS);
  374. !
  375. ! Get the first character that was passed.
  376. !
  377.     CHARACTER = CH$RCHAR_A (ARG_POINTER);
  378. !
  379. ! Loop reading characters and calling the output routine to process
  380. ! them
  381. !
  382.  
  383.     WHILE .CHARACTER NEQ CHR_NUL DO
  384.     BEGIN
  385.     TT_CHAR (.CHARACTER);
  386.     CHARACTER = CH$RCHAR_A (ARG_POINTER);
  387.     END;
  388.  
  389.     END;                    ! End of TT_TEXT
  390.  
  391. %SBTTL 'Terminal routines -- TT_NUMBER - Output a three digit number'
  392.  
  393. GLOBAL ROUTINE TT_NUMBER (NUMBER) : NOVALUE =
  394.  
  395. !++
  396. ! FUNCTIONAL DESCRIPTION:
  397. !
  398. !    This routine will store a three digit number into the text buffer.
  399. !    It will just return if the number is greater than 999.
  400. !
  401. ! CALLING SEQUENCE:
  402. !
  403. !    TT_NUMBER(Value);
  404. !
  405. ! INPUT PARAMETERS:
  406. !
  407. !    Value - Value to output.
  408. !
  409. ! IMPLICIT INPUTS:
  410. !
  411. !    None.
  412. !
  413. ! OUTPUT PARAMETERS:
  414. !
  415. !    None.
  416. !
  417. ! IMPLICIT OUTPUTS:
  418. !
  419. !    None.
  420. !
  421. ! COMPLETION CODES:
  422. !
  423. !    None.
  424. !
  425. ! SIDE EFFECTS:
  426. !
  427. !    None.
  428. !
  429. !--
  430.  
  431.     BEGIN
  432.     ROUTINE TT_NUM_WORKER (VALUE) : NOVALUE =
  433.     BEGIN
  434.  
  435.     IF .VALUE LEQ 9
  436.     THEN
  437.         TT_CHAR (.VALUE + %C'0')
  438.     ELSE
  439.         BEGIN
  440.         TT_NUM_WORKER (.VALUE/10);
  441.         TT_CHAR ((.VALUE MOD 10) + %C'0');
  442.         END;
  443.  
  444.     END;
  445.  
  446.     IF .NUMBER LSS 0
  447.     THEN
  448.     BEGIN
  449.     TT_CHAR (%C'-');
  450.     NUMBER = -.NUMBER;
  451.     END;
  452.  
  453.     TT_NUM_WORKER (.NUMBER);
  454.     END;                    ! End of TT_NUMBER
  455.  
  456. %SBTTL 'Terminal routines -- TT_CRLF - Output a CRLF'
  457.  
  458. GLOBAL ROUTINE TT_CRLF : NOVALUE =
  459.  
  460. !++
  461. ! FUNCTIONAL DESCRIPTION:
  462. !
  463. !    This routine will cause the contents of the terminal buffer to be
  464. !    output to SYS$OUTPUT:.
  465. !
  466. ! CALLING SEQUENCE:
  467. !
  468. !    TT_CRLF();
  469. !
  470. ! INPUT PARAMETERS:
  471. !
  472. !    None.
  473. !
  474. ! IMPLICIT INPUTS:
  475. !
  476. !    None.
  477. !
  478. ! OUTPUT PARAMETERS:
  479. !
  480. !    None.
  481. !
  482. ! IMPLICIT OUTPUTS:
  483. !
  484. !    None.
  485. !
  486. ! COMPLETION CODES:
  487. !
  488. !    None.
  489. !
  490. ! SIDE EFFECTS:
  491. !
  492. !    None.
  493. !
  494. !--
  495.  
  496.     BEGIN
  497.     TT_CHAR (CHR_CRT);
  498.     TT_CHAR (CHR_LFD);
  499.     END;                    ! End of TT_CRLF
  500.  
  501. %SBTTL 'End of KERTRM'
  502. END                        ! End of module
  503.  
  504. ELUDOM