User Tools

Site Tools


cdc:nos2.source:opl871:fsesubs

FSESUBS

Table Of Contents

  • [00006] - SUBROUTINES OF FULL SCREEN EDITOR.
  • [00103] TRIMNAME - CONVERT TRAILING BLANKS TO ZEROS.
  • [00122] PADNAME - CONVERT TRAILING ZEROS TO BLANKS.
  • [00141] MIN - COMPUTE LESSER OF TWO VALUES.
  • [00155] MAX - COMPUTE GREATER OF TWO VALUES.
  • [00170] PUSHTEMP - PRESERVE VALUE ON MISCELLANEOUS STACK.
  • [00189] POPTEMP - RETREIVE VALUE FROM MISCELLANEOUS STACK.
  • [00206] STARTCMD - INITIALIZE SYNTAX SCANNER FOR NEW COMMANDS.
  • [00226] TABFN - COMPUTE TAB COLUMN BY ORDINAL.
  • [00248] COPYTABS - COPY/CONVERT TABS, TABVECTOR→VIRTERM.
  • [00278] MAKEFET - INITIALIZE A FET.
  • [00315] TTLFN - PRINT OUT A ZERO-TERMINATED NAME.
  • [00339] SETCSET - ISSUE CSET MACRO.
  • [00362] FATAL - ABORT THE EDITOR WITH MESSAGE.
  • [00425] TRAGIC - ABORT EDITOR DUE TO WORKFILE PROBLEM.
  • [00445] COPYLIN - COPY LINE IMAGE, INTERNAL CHARSET.
  • [00458] EXTENDC - EXTEND INTERNAL LINE IMAGE TO DESIRED LENGTH.
  • [00482] LSHIFT - SHIFT INTERNAL LINE IMAGE LEFT.
  • [00515] RSHIFT - RIGHT SHIFT OF INTERNAL LINE IMAGE.
  • [00550] CONVIN - CONVERT INPUT LINE TO INTERNAL FORMAT.
  • [00596] CONVOUT - CONVERT INTERNAL LINE IMAGE TO NOS FORMAT.
  • [00673] SLOWC8I - CONVERT 8/12 INPUT LINE TO INTERNAL CHARSET.
  • [00707] SLOWC8O - CONVERT INTERNAL LINE IMAGE TO 8/12 FORMAT.
  • [00742] GETLNUM - ANALYZE INTERNAL LINE IMAGE FOR SEQUENCE NUM.
  • [00778] SETLNUM - FORMAT SEQUENCE NUMBER ONTO INTERNAL LINE.
  • [00824] TRIMPAD - TRIM OFF TRAILING BLANKS, PAD SEQUENCE.
  • [00860] TRIM - TRIM OFF TRAILING BLANKS.
  • [00880] PAD - ADD TRAILING BLANKS TO INTERNAL LINE IMAGE.
  • [01015] PUSH - PUSH CURRENT LINE/FILE ONTO STACK.
  • [01035] POP - POP LINE/FILE POSITION FROM STACK.
  • [01056] RELOCATE - INTERFACE TO UPDATE VECTOR OF RELOCATABLES.
  • [01137] AUDITINS - AUDIT INTERFACE FOR INSZ.
  • [01149] AUDITDEL - AUDIT INTERFACE FOR DELZ.
  • [01162] AUDITREP - AUDIT INTERFACE FOR REPZ.
  • [01175] AUDITNUM - FORMAT NUMERIC VALUE INTO AUDIT DESCRIPTOR.
  • [01200] AUDITEVENT - FORMAT AND TRANSMIT DESCRIPTOR.
  • [01231] AUDITTEXT - TRANSMIT TEXT LINE TO AUDIT TRAIL.
  • [01251] AUDITCHECK - ISSUE CHECKPOINT TO AUDIT TRAIL.
  • [01284] AUDITEND - ISSUE TERMINATOR TO AUDIT TRAIL.
  • [01310] AUDITTRAIL - TRANSMIT LINE IMAGE TO AUDIT TRAIL.
  • [01337] AUDITSYNCH - FLUSH STAGING BUFFER INTO WORKFILE.
  • [01379] FORMFDL - FORMAT FILE DESCRIPTOR LINE.
  • [01450] SCANFDL - ANALYZE FILE DESCRIPTOR LINE.
  • [01505] OPENFILE - BRACKET AN INTERNAL FILE IMAGE.
  • [01535] FORCEPAINT - FORCE A SCREEN PAINT.
  • [01625] ACCESSFILE - ACCESS A FILE.
  • [01725] CLOSEFILE - SAVE CURRENT FILE STATUS IN DESCRIPTOR LINE.
  • [01779] GETCMD - READ COMMAND STRING FROM TERMINAL.
  • [01796] PROMPT - ISSUE PROMPT TO TERMINAL AND INPUT LINE.
  • [01822] DOJOIN - MERGE TWO ADJACENT WORKFILE LINES.
  • [01941] DOSPLIT - SPLIT A WORKFILE LINE INTO TWO.

Source Code

FSESUBS.txt
  1. PROC FSESUBS;
  2. BEGIN
  3.  
  4.  
  5. #
  6. *** FSESUBS -- SUBROUTINES OF FULL SCREEN EDITOR.
  7. *
  8. * COPYRIGHT CONTROL DATA SYSTEMS INC. 1992.
  9. *
  10. * FSESUBS PROVIDES SUBROUTINES WHICH ARE UNIVERSAL TO THE
  11. * SINGLE AND MULTI-USER VERSIONS OF THE EDITOR, AND WHICH ARE
  12. * ALSO REGARDED AS LIKELY TO BE UNIVERSAL TO ALL OVERLAYS IF
  13. * THE SINGLE-USER EDITOR WERE TO BE CONVERTED INTO AN OVERLAY
  14. * STRUCTURE. FSESUBS SPECIFICALLY INCLUDES THE INTERFACES BY
  15. * WHICH THE WORKFILE MANAGER IS CALLED, AND INTERFACES FOR
  16. * MANAGEMENT OF THE AUDIT TRAIL AND OF INTERNAL FILE IMAGES.
  17. #
  18.  
  19. DEF LISTCON #0#;
  20.  
  21. CONTROL EJECT; # UNIVERSAL DECLARES #
  22.  
  23. *IFCALL SINGLE,COMFSGL
  24. *IFCALL ONLY,COMFONL
  25. *IFCALL MULTI,COMFMLT
  26. *CALL COMFFSE
  27.  
  28. # EXTERNAL REF'S AND DEF'S #
  29.  
  30.  
  31. CONTROL IFEQ MULTI,1;
  32. XREF ARRAY RENTSTK [1:MAXREENT]; # SUBROUTINE STACK #
  33. BEGIN
  34. ITEM RSTK;
  35. END
  36. XREF ITEM RSTKPTR;
  37. CONTROL FI;
  38.  
  39. XDEF ITEM LINSIZ=BUFWIDP1; # MAX LINE SIZ IN WORDS #
  40.  
  41. XDEF
  42. BEGIN
  43. *CALL COMFXSB
  44. END
  45.  
  46. XREF
  47. BEGIN
  48. *CALL COMFXED
  49. *CALL COMFXSC
  50. *CALL COMFXTI
  51. *CALL COMFXFO
  52. *CALL COMFXVT
  53. *CALL COMFXWK
  54. PROC ZEROWD;
  55. PROC WRITER;
  56. PROC ABORT;
  57. PROC ENDRUN;
  58. PROC FASTCAI;
  59. PROC FASTCNI;
  60. FUNC LENGTH;
  61. PROC FASTCAO;
  62. PROC FASTCNO;
  63. PROC FASTRLC;
  64. FUNC FASTLNB;
  65. FUNC NOSWDSZ;
  66. PROC MOVEWD;
  67. FUNC LINESZ;
  68. FUNC MOVELN;
  69. CONTROL IFEQ MULTI,1;
  70. LABEL QQSINGLE;
  71. PROC VOLUNTEER;
  72. PROC FATALTRAP;
  73. PROC SMFRCL;
  74. PROC SMFDLY;
  75. CONTROL FI;
  76. CONTROL IFEQ SINGLE,1;
  77. *CALL COMFXFL
  78. PROC MESSAGE;
  79. PROC CSETA;
  80. PROC CSETN;
  81. PROC WRITEC;
  82. PROC READC;
  83. PROC EVICT;
  84. PROC GETJN;
  85. PROC RTIME;
  86. PROC RETERN;
  87. CONTROL FI;
  88. END # OF XREF #
  89.  
  90. # COMMON DATA AREAS #
  91.  
  92. *CALL COMFDS1
  93. *CALL COMFVD2
  94. *CALL COMFDS2
  95.  
  96. *CALL COMFTAB
  97. PAGE # MINOR UTILITY ROUTINES #
  98.  
  99.  
  100. FUNC TRIMNAME(NAME) C(7);
  101. BEGIN
  102. #
  103. ** TRIMNAME - CONVERT TRAILING BLANKS TO ZEROS.
  104. *
  105. * ENTRY (NAME) - LEFT-JUSTIFIED STRING UP TO SEVEN CHARS.
  106. *
  107. * EXIT (NAME) - CONVERTED.
  108. #
  109. ITEM NAME C(7), TMP1, NEWNAME C(7);
  110. FOR TMP1=0 STEP 1 UNTIL 6 DO
  111. BEGIN
  112. IF C<TMP1,1>NAME EQ " " THEN C<TMP1,1>NEWNAME=0;
  113. ELSE C<TMP1,1>NEWNAME=C<TMP1,1>NAME;
  114. END
  115. TRIMNAME=NEWNAME;
  116. END
  117.  
  118.  
  119. FUNC PADNAME(NAME) C(7);
  120. BEGIN
  121. #
  122. ** PADNAME - CONVERT TRAILING ZEROS TO BLANKS.
  123. *
  124. * ENTRY (NAME) - LEFT-JUSTIFIED STRING UP TO SEVEN CHARS.
  125. *
  126. * EXIT (NAME) - CONVERTED.
  127. #
  128. ITEM NAME C(7), TMP1, NEWNAME C(7);
  129. FOR TMP1=0 STEP 1 UNTIL 6 DO
  130. BEGIN
  131. IF C<TMP1,1>NAME EQ 0 THEN C<TMP1,1>NEWNAME=" ";
  132. ELSE C<TMP1,1>NEWNAME=C<TMP1,1>NAME;
  133. END
  134. PADNAME=NEWNAME;
  135. END
  136.  
  137.  
  138. FUNC MIN(A1,A2);
  139. BEGIN
  140. #
  141. ** MIN - COMPUTE LESSER OF TWO VALUES.
  142. *
  143. * ENTRY (A1) AND (A2) - VALUES TO CHOOSE.
  144. *
  145. * EXIT (MIN) - LESSER INTEGER VALUE.
  146. #
  147. ITEM A1,A2;
  148. IF A1 LQ A2 THEN MIN = A1;
  149. ELSE MIN = A2;
  150. END
  151.  
  152. FUNC MAX(A1,A2);
  153. BEGIN
  154. #
  155. ** MAX - COMPUTE GREATER OF TWO VALUES.
  156. *
  157. * ENTRY (A1) AND (A2) - VALUES TO CHOOSE.
  158. *
  159. * EXIT (MAX) - GREATER INTEGER VALUE.
  160. #
  161. ITEM A1,A2;
  162. IF A1 GQ A2 THEN MAX = A1;
  163. ELSE MAX = A2;
  164. END
  165.  
  166.  
  167. PROC PUSHTEMP;
  168. BEGIN
  169. #
  170. ** PUSHTEMP - PRESERVE VALUE ON MISCELLANEOUS STACK.
  171. *
  172. * ENTRY (TEMP) - VALUE TO BE PRESERVED.
  173. *
  174. * EXIT DATA STACK IS PUSHED.
  175. *
  176. * USES DATAPTR, DATASTK.
  177. #
  178. IF DATAPTR GQ MAXDATA THEN
  179. BEGIN
  180. FATAL(" REENTRANT DATA STACK OVERFLOWED.$");
  181. END
  182. DATAPTR=DATAPTR+1;
  183. DATASTK[DATAPTR]=TEMP;
  184. END # OF PUSHTEMP #
  185.  
  186. PROC POPTEMP;
  187. BEGIN
  188. #
  189. ** POPTEMP - RETREIVE VALUE FROM MISCELLANEOUS STACK.
  190. *
  191. * ENTRY DATA STACK ASSUMED TO HAVE DATA.
  192. *
  193. * EXIT (TEMP) - RETRIEVED VALUE.
  194. *
  195. * USES DATAPTR, DATASTK
  196. #
  197. IF DATAPTR LS 0 THEN FATAL(" REENTRANT DATA STACK UNDERFLOWED.$");
  198. TEMP=DATASTK[DATAPTR];
  199. DATAPTR=DATAPTR-1;
  200. END # OF POPTEMP #
  201.  
  202.  
  203. PROC STARTCMD;
  204. BEGIN
  205. #
  206. ** STARTCMD - INITIALIZE SYNTAX SCANNER FOR NEW COMMANDS.
  207. *
  208. * ENTRY (CMDLINE) ALREADY FILLED IN WITH NEW STRING.
  209. *
  210. * EXIT (CMDLINE) TRIMMED.
  211. * SCANPOS, TOKENPOS, CMDMARKER, KEYWDTYPE INITIALIZED.
  212. * EXPANDAT INITIALIZED.
  213. #
  214. TRIM(CMDLIN,0);
  215. SCANPOS=0;
  216. TOKENPOS=0;
  217. CMDMARKER=0;
  218. KEYWDTYPE=1;
  219. EXPANDAT=-1;
  220. END # OF STARTCMD #
  221.  
  222.  
  223. FUNC TABFN(TABNUM);
  224. BEGIN
  225. #
  226. ** TABFN - COMPUTE TAB COLUMN BY ORDINAL.
  227. *
  228. * ENTRY (TABNUM) INTEGER ORDINAL OF TAB STOP.
  229. *
  230. * EXIT (TABFN) COLUMN OFFSET.
  231. #
  232. ITEM TABNUM;
  233. ITEM TMP1, TMP2;
  234. IF TABNUM LS 1 OR TABNUM GR TABSTOPS THEN TABFN=0;
  235. ELSE
  236. BEGIN
  237. TMP2=TABNUM-1;
  238. TMP1=TMP2/7;
  239. TMP2=MOD(TMP2,7);
  240. TABFN=B<TMP2*8,8>TABVCTWRD[TMP1+1];
  241. END
  242. END # OF TABFN #
  243.  
  244.  
  245. PROC COPYTABS;
  246. IOBEGIN(COPYTABS)
  247. #
  248. ** COPYTABS - COPY/CONVERT TABS, TABVECTOR->VIRTERM.
  249. *
  250. * ENTRY TABVECTOR ALREADY SET UP.
  251. *
  252. * EXIT TERMINAL CONFIGURED, VIRTERM DITTO.
  253. *
  254. * CALLS VDTCTS, VDTSTS.
  255. *
  256. * USES LINCTR, LINNUM1.
  257. #
  258. VDTCTS; # CLEAR OLD TABS #
  259. VDTSTS(0); # ALWAYS #
  260. IF TABVCTWRD[1] EQ 0 THEN IORET
  261. VDTSTS(TABFN(1));
  262. FOR LINCTR=2 STEP 1 UNTIL TABSTOPS DO
  263. BEGIN
  264. LINNUM1=TABFN(LINCTR);
  265. IF LINNUM1 NQ 0 THEN
  266. BEGIN
  267. VDTSTS(LINNUM1);
  268. END
  269. ELSE IORET
  270. END
  271.  
  272. IOEND # COPYTABS #
  273.  
  274.  
  275. PROC MAKEFET(AFET,NAME,BUFFER,LENGTH);
  276. BEGIN
  277. #
  278. ** MAKEFET - INITIALIZE A FET.
  279. *
  280. * ENTRY AFET - FET TO BE INITIALIZED.
  281. * NAME - NAME OF FILE.
  282. * BUFFER - THE CIRCULAR BUFFER.
  283. * LENGTH - LENGTH OF CIRCULAR BUFFER.
  284. *
  285. * NOTE USES THEN RESTORES BASE ADDRESS FOR "FET" ARRAY.
  286. #
  287. ARRAY AFET;;
  288. ITEM NAME C(7);
  289. ARRAY BUFFER;;
  290. ITEM LENGTH;
  291. ITEM TMP,TMP2, NEWNAME C(7);
  292.  
  293. ZEROWD(AFET,FETSIZ);
  294. TMP=LOC(FET);
  295. P<FET>=LOC(AFET);
  296. NEWNAME=TRIMNAME(NAME);
  297. FETNAM=NEWNAME;
  298. FETFIR=LOC(BUFFER);
  299. FETIN=FETFIR;
  300. FETOUT=FETFIR;
  301. FETLIM=FETFIR+LENGTH;
  302. IF TRIMNAME(NAME) NQ 0 THEN
  303. BEGIN
  304. FETCOD=1;
  305. FETL=2;
  306. END
  307. P<FET>=TMP;
  308.  
  309. END # OF MAKEFET #
  310.  
  311.  
  312. PROC TTLFN(PARM);
  313. IOBEGIN(TTLFN)
  314. #
  315. ** TTLFN - PRINT OUT A ZERO-TERMINATED NAME.
  316. *
  317. * ENTRY (PARM) - NAME TO BE PRINTED.
  318. *
  319. * CALLS TTST.
  320. #
  321. ITEM TMP1;
  322. ITEM PARM;
  323. TMP1=0;
  324. WHYLE C<TMP1,1>PARM NQ 0 AND TMP1 LQ 7 DO TMP1=TMP1+1;
  325. TTST(PARM,TMP1);
  326. WHYLE TMP1 LQ 7 DO
  327. BEGIN # WHILE NOT BLANK FILLED #
  328. TMP1=TMP1+1;
  329. TTSTR(" $");
  330. END
  331. IOEND # OF TTLFN #
  332.  
  333.  
  334. CONTROL IFEQ SINGLE,1;
  335.  
  336. PROC SETCSET(WHICH);
  337. BEGIN
  338. #
  339. ** SETCSET - ISSUE CSET MACRO.
  340. *
  341. * ENTRY (WHICH) - INDICATES ASCII OR NORMAL.
  342. *
  343. * USES ORIGIN.
  344. *
  345. * CALLS CSETA, CSETN.
  346. #
  347. ITEM WHICH B;
  348. IF ORIGIN EQ TXOT THEN
  349. BEGIN
  350. IF WHICH THEN CSETA;
  351. ELSE CSETN;
  352. END
  353. END # OF SETCSET #
  354.  
  355. CONTROL FI;
  356. PAGE # ABORT ROUTINES #
  357.  
  358.  
  359. PROC FATAL(STR);
  360. IOBEGIN(FATAL)
  361. #
  362. ** FATAL - ABORT THE EDITOR WITH MESSAGE.
  363. * MORTAL - SIMILAR FOR PROBLEMS WITHIN TERMINAL I/O.
  364. *
  365. * FATAL IS THE PRINCIPAL ROUTINE TO ABORT AN EDIT SESSION
  366. * FOR EITHER AN INTERNAL INCONSISTENCY OR A USER ERROR SO
  367. * SEVERE THAT NO MEANINGFUL FUNCTION CAN BE SALVAGED. TO
  368. * PREVENT CIRCULAR (RECURSIVE) SUBROUTINE LINKAGES, THE
  369. * WORKIO MODULE IS RESTRICTED TO INTERFACE VIA THE TRAGIC
  370. * ROUTINE AND THE TERMIO MODULE IS RESTRICTED TO USE THE
  371. * MORTAL ENTRY POINT.
  372. *
  373. * ENTRY STR - THE ABORT MESSAGE.
  374. *
  375. * EXIT TO ABORT ROUTINE, WITH WORKFILE EVICTED.
  376. *
  377. * USES LINPTR1, P<FROM>.
  378. *
  379. * CALLS TTSTR, TTLIN, MESSAGE, TTSYNC, VDTCLO, EVICT,
  380. * CHECKIO, FATALTRAP.
  381. #
  382. ITEM STR C(40);
  383. ERRSTRING=STR; # HANDLE PARM REENTRANTLY #
  384. CONTROL IFEQ SINGLE,1;
  385. IF SCREENMODE THEN CLEARSCREEN;
  386. CONTROL FI;
  387. TTLIN(" FSE INTERNAL ERROR.$");
  388. TTLIN(ERRSTRING);
  389. CONTROL IFEQ SINGLE,1;
  390. GOTO FATAL2;
  391. CONTROL FI;
  392.  
  393. ENTRY PROC MORTAL(STR);
  394.  
  395. CONTROL IFEQ SINGLE,1;
  396. ITEM MSGBUF C(40)=0;
  397. ITEM TMP1;
  398. ERRSTRING=STR;
  399. FATAL2:
  400. FOR TMP1=0 STEP 1 UNTIL 37 DO
  401. BEGIN
  402. IF C&lt;TMP1,1>STR NQ "$" THEN C&lt;TMP1,1>MSGBUF=C&lt;TMP1,1>STR;
  403. ELSE TMP1=38;
  404. END
  405. MESSAGE(MSGBUF,3,1);
  406. TTSYNC;
  407. VDTCLO(0);
  408. EVICT(FET,1);
  409. ABORT;
  410. CONTROL FI;
  411. CONTROL IFEQ MULTI,1;
  412. IF NOT ABORTED THEN
  413. BEGIN
  414. ABORTED=TRUE;
  415. CHECKIO;
  416. END
  417. FATALTRAP;
  418. CONTROL FI;
  419. IOEND # OF FATAL #
  420.  
  421.  
  422. PROC TRAGIC(STR);
  423. IOBEGIN(TRAGIC)
  424. #
  425. ** TRAGIC - ABORT EDITOR DUE TO WORKFILE PROBLEM.
  426. *
  427. * TRAGIC IS USED BY WORKIO FOR SELF-ABORT SITUATIONS. BY
  428. * SETTING THE "ABORTED" FLAG, WE DIRECT "FATAL" TO IMMEDIATELY
  429. * EVICT THE WORKFILE WITHOUT FURTHER WORKIO CALLS.
  430. *
  431. * ENTRY STR - ERROR MESSAGE.
  432. *
  433. * EXIT TO FATAL, WITH "ABORTED" SET.
  434. #
  435. ITEM STR C(80);
  436. ABORTED=TRUE;
  437. FATAL(STR);
  438. IOEND # OF TRAGIC #
  439. PAGE # SUPPORT ROUTINES FOR INTERNAL CHARSET #
  440.  
  441.  
  442. PROC COPYLIN(LIN1,LIN2);
  443. BEGIN
  444. #
  445. ** COPYLIN - COPY LINE IMAGE, INTERNAL CHARSET.
  446. *
  447. * ENTRY LIN1 IS SOURCE, LIN2 IS TARGET.
  448. #
  449. ARRAY LIN1;; ARRAY LIN2;;
  450. DUMB=LINESZ(LIN1); # FIX EOL BITS #
  451. DUMB=MOVELN(LIN1,LIN2); # ACTUAL COPY #
  452. END # OF COPYLIN #
  453.  
  454.  
  455. PROC EXTENDC(TEXTLIN,X);
  456. BEGIN
  457. #
  458. ** EXTENDC - EXTEND INTERNAL LINE IMAGE TO DESIRED LENGTH.
  459. *
  460. * ENTRY TEXTLIN - TRIMMED LINE IMAGE.
  461. * X - LENGTH TO BE PADDED TO.
  462. *
  463. * MACROS SETCHAR.
  464. *
  465. * CALLS LENGTH.
  466. #
  467. ARRAY TEXTLIN[0:99]; ITEM TEXTLINE;
  468. ITEM TMP1, TMP2, X;
  469. IF X GQ LENGTH(TEXTLIN) THEN
  470. BEGIN
  471. TMP1=LENGTH(TEXTLIN);
  472. FOR TMP2=TMP1 STEP 1 UNTIL X
  473. DO SETCHAR(TEXTLINE,TMP2,CBLANK);
  474. SETCHAR(TEXTLINE,X+1,CENDLINE);
  475. END
  476. END # OF EXTENDC #
  477.  
  478.  
  479. PROC LSHIFT(TEXTLIN,X,N);
  480. BEGIN
  481. #
  482. ** LSHIFT - SHIFT INTERNAL LINE IMAGE LEFT.
  483. *
  484. * CHARACTER POSITION "X" GOES TO "X-N", X+1 TO X+1-N, ETC.
  485. *
  486. * ENTRY TEXTLIN - INTERNAL LINE IMAGE.
  487. * X - FIRST SHIFTABLE POSITION.
  488. * N - DISTANCE OF SHIFT.
  489. *
  490. * MACROS GETCHAR, SETCHAR.
  491. *
  492. * CALLS LENGTH, EXTENDC.
  493. #
  494. ARRAY TEXTLIN[0:99]; ITEM TEXTLINE;
  495. ITEM X,N,NN,I,L,C;
  496. IF N NQ 0 THEN
  497. BEGIN
  498. EXTENDC(TEXTLIN,X-1);
  499. L=LENGTH(TEXTLIN);
  500. NN=N;
  501. IF X LS N THEN NN=X;
  502. FOR I=X STEP 1 UNTIL L DO
  503. BEGIN
  504. GETCHAR(TEXTLINE,I,C);
  505. SETCHAR(TEXTLINE,I-NN,C);
  506. END
  507. END
  508. END # OF LSHIFT #
  509.  
  510.  
  511. PROC RSHIFT(TEXTLIN,X,N);
  512. BEGIN
  513. # RSHIFT - RIGHT SHIFT LINE (MOVE X TO X+N, X+1 TO X+1+N, ETC.) #
  514. #
  515. ** RSHIFT - RIGHT SHIFT OF INTERNAL LINE IMAGE.
  516. *
  517. * RSHIFT MOVES POSITION "X" TO "X+N", "X+1" TO "X+1+N", ETC.
  518. *
  519. * ENTRY SAME CONDITIONS AS LSHIFT ROUTINE.
  520. *
  521. * MACROS GETCHAR, SETCHAR.
  522. *
  523. * CALLS EXTENDC, LENGTH.
  524. #
  525. ARRAY TEXTLIN[0:99]; ITEM TEXTLINE;
  526. ITEM X,N,I,L,C;
  527. IF N NQ 0 THEN
  528. BEGIN
  529. EXTENDC(TEXTLIN,X-1);
  530. L=LENGTH(TEXTLIN);
  531. EXTENDC(TEXTLIN,X+N);
  532. IF L+N GR BUFCHAR THEN
  533. BEGIN
  534. L=BUFCHAR-N;
  535. SETCHAR(TEXTLINE,L,CENDLINE);
  536. END
  537. FOR I=L STEP -1 UNTIL X DO
  538. BEGIN
  539. GETCHAR(TEXTLINE,I,C);
  540. SETCHAR(TEXTLINE,I+N,C);
  541. END
  542. SETCHAR(TEXTLINE,L+N,CENDLINE);
  543. END
  544. END # OF RSHIFT #
  545.  
  546.  
  547. PROC CONVIN(TEXTLINE,CHARTYPE);
  548. BEGIN
  549. #
  550. ** CONVIN - CONVERT INPUT LINE TO INTERNAL FORMAT.
  551. *
  552. * ENTRY TMPLIN - ALREADY CONTAINS NOS-FORMAT LINE IMAGE.
  553. * CHARTYPE - CHARACTER SET CONVERSION MODE.
  554. * 0 = 6 BIT DISPLAY,
  555. * 1 = 6 BIT DISPLAY,
  556. * 2 = 6/12 ASCII,
  557. * 3 = 8/12 ASCII.
  558. *
  559. * EXIT TEXTLINE - CONTAINS INTERNAL FORMAT LINE IMAGE.
  560. * ZEROCOLIN - FORCED TRUE IF AND ONLY IF 6/12 AND
  561. * A 00 COLON IS ENCOUNTERED. OTHERWISE UNCHANGED.
  562. *
  563. * CALLS FASTCNI, FASTCAI, SLOWC8I.
  564. #
  565. ARRAY TEXTLINE[0:99]; ITEM TEXT;
  566. ITEM CHARTYPE;
  567. ITEM TMP1;
  568. SWITCH CONVINSW CINORM,CINORM,CIASC,CI812;
  569.  
  570. GOTO CONVINSW[CHARTYPE];
  571.  
  572. CINORM:
  573. FASTCNI(TEXTLINE,TMPLIN,BUFWIDE,BUFWIDE2);
  574. RETURN;
  575.  
  576. CIASC:
  577. TMP1=0;
  578. FASTCAI(TEXTLINE,TMPLIN,BUFWIDE,BUFWIDE2,TMP1);
  579. IF TMP1 LAN 1 NQ 0 THEN ZEROCOLIN = TRUE;
  580. IF TMP1 LAN 2 NQ 0 THEN
  581. BEGIN # IF UNKNOWN CHARACTER(S) #
  582. ERRSTRING = "UNKNOWN CHARACTER(S) FOUND - CONVERTED TO @$";
  583. END
  584. RETURN;
  585.  
  586. CI812:
  587. SLOWC8I(TEXTLINE,TMPLIN,BUFWIDE,BUFWIDE2);
  588. RETURN;
  589.  
  590. END # OF CONVIN #
  591.  
  592.  
  593. PROC CONVOUT(TEXTLINE,CHARTYPE);
  594. BEGIN
  595. #
  596. ** CONVOUT - CONVERT INTERNAL LINE IMAGE TO NOS FORMAT.
  597. *
  598. * ENTRY TEXTLINE - INTERNAL LINE IMAGE.
  599. * CHARTYPE - CHARACTER SET CONVERSION MODE.
  600. * 0 = 6 BIT DISPLAY,
  601. * 1 = 6 BIT DISPLAY,
  602. * 2 = 6/12 ASCII,
  603. * 3 = 8/12 ASCII,
  604. * 4 = 8/12 ASCII, IGNORE COLON CONVERSION.
  605. * ZEROCOLOUT - 7404 VERSUS 00 FORMAT FOR COLONS WHEN
  606. * 6/12 CHARACTER SET DETECTED.
  607. *
  608. * EXIT TMPLIN - CONTAINS NOS LINE IMAGE.
  609. *
  610. * MACROS GETCHAR, SETCHAR.
  611. *
  612. * CALLS LENGTH, FASTCAO, FASTCNO, NOSWDSZ, SLOWC8O.
  613. #
  614. ARRAY TEXTLINE[0:99]; ITEM TEXT;
  615. ITEM CHARTYPE;
  616. ITEM TMP1, TMP2, BOOL B;
  617. SWITCH CONVOUTSW CONORM,CONORM,COASC,CO812,COAINT;
  618.  
  619. TMP1=LENGTH(TEXTLINE);
  620. IF TMP1 EQ 0 THEN
  621. BEGIN # EMPTY LINE IS TWO BLANKS #
  622. IF CHARTYPE NQ 3 THEN
  623. BEGIN # IF DISPLAY OR 6/12 ASCII #
  624. TMPLINE[0]=O"5555 0000 0000 0000 0000";
  625. END
  626. ELSE
  627. BEGIN # 8/12 ASCII #
  628. TMPLINE[0]=O"0040 0040 0000 0000 0000";
  629. END
  630. RETURN;
  631. END
  632. IF CHARTYPE LS 3 THEN # IF DISPLAY OR STANDARD ASCII #
  633. BEGIN
  634. GETCHAR(TEXT,TMP1-1,TMP2);
  635. IF TMP2 EQ CCOLON THEN
  636. BEGIN # TRAILING COLONS NEED A BLANK #
  637. SETCHAR(TEXT,TMP1,CBLANK);
  638. TMP1=TMP1+1;
  639. SETCHAR(TEXT,TMP1,CENDLINE);
  640. END
  641. END
  642. GOTO CONVOUTSW[CHARTYPE];
  643.  
  644. COAINT:
  645. BOOL = TRUE; # FORCE COLONS TO BE 7404B #
  646. FASTCAO(TEXTLINE,TMPLIN,BUFWIDE,BUFWIDE2,BOOL);
  647. RETURN;
  648.  
  649. COASC:
  650. BOOL=NOT ZEROCOLOUT;
  651. FASTCAO(TEXTLINE,TMPLIN,BUFWIDE,BUFWIDE2,BOOL);
  652. RETURN;
  653.  
  654. CONORM:
  655. FASTCNO(TEXTLINE,TMPLIN,BUFWIDE,BUFWIDE2);
  656. TMP1=NOSWDSZ(BUFWIDE2,TMPLIN); # PREVENT 66 BIT END OF LINE #
  657. IF TMP1 GR 1 AND TMPLINE[TMP1-1] EQ 0
  658. AND TMPLINE[TMP1-2] LAN O"00000000000000007700" NQ 0
  659. AND TMPLINE[TMP1-2] LAN O"00000000000000000077" EQ 0
  660. THEN TMPLINE[TMP1-2]=TMPLINE[TMP1-2] LOR O"00000000000000000055";
  661. RETURN;
  662.  
  663. CO812:
  664. SLOWC8O(TEXTLINE,TMPLIN,BUFWIDE,BUFWIDE2);
  665. RETURN;
  666.  
  667. END # OF CONVOUT #
  668.  
  669.  
  670. PROC SLOWC8I(TEXTLIN,BUFLIN,SIZE1,SIZE2);
  671. BEGIN
  672. #
  673. ** SLOWC8I - CONVERT 8/12 INPUT LINE TO INTERNAL CHARSET.
  674. *
  675. * ENTRY BUFLIN - NOS LINE IMAGE.
  676. * SIZE1 - CAPACITY OF TEXTLIN IN WORDS.
  677. * SIZE2 - CAPACITY OF BUFLIN IN WORDS.
  678. *
  679. * EXIT TEXTLIN - INTERNAL LINE IMAGE.
  680. *
  681. * MACROS SETCHAR, MOD.
  682. *
  683. * NOTE ALGORITHM SENSITIVE TO INTERNAL FORMAT DEFINITION.
  684. #
  685. ARRAY TEXTLIN [0:99]; ITEM TEXTLINE;
  686. ARRAY BUFLIN [0:99]; ITEM BUFLINE;
  687. ITEM SIZE1, SIZE2;
  688. ITEM TMP1, TMP2;
  689.  
  690. SETCHAR(TEXTLINE,BUFCM1,CENDLINE);
  691. TMP1=0;
  692. TMP2=CLETTERA;
  693. WHYLE TMP1/8 LQ SIZE1 AND TMP1/5 LQ SIZE2 AND TMP2 NQ CENDLINE DO
  694. BEGIN
  695. TMP2=B&lt;MOD(TMP1,5)*12,12>BUFLINE[TMP1/5];
  696. IF TMP2 EQ 0 THEN TMP2=CENDLINE;
  697. ELSE TMP2=XLTXPINT[TMP2 LAN O"177"];
  698. SETCHAR(TEXTLINE,TMP1,TMP2);
  699. TMP1=TMP1+1;
  700. END
  701. END # OF SLOWC8I #
  702.  
  703.  
  704. PROC SLOWC8O(TEXTLIN,BUFLIN,SIZE1,SIZE2);
  705. BEGIN
  706. #
  707. ** SLOWC8O - CONVERT INTERNAL LINE IMAGE TO 8/12 FORMAT.
  708. *
  709. * ENTRY TEXTLIN - INTERNAL LINE IMAGE.
  710. * SIZE1, SIZE2 - SIMILAR TO "SLOWC8I" ROUTINE.
  711. *
  712. * EXIT BUFLIN - 8/12 FORMAT LINE IMAGE.
  713. *
  714. * MACROS SETCHAR, GETCHAR.
  715. *
  716. * NOTE ALGORITHM SENSITIVE TO INTERNAL FORMAT DEFINITION.
  717. #
  718. ARRAY TEXTLIN [0:99]; ITEM TEXTLINE;
  719. ARRAY BUFLIN [0:99]; ITEM BUFLINE;
  720. ITEM SIZE1, SIZE2;
  721. ITEM TMP1, TMP2;
  722.  
  723. SETCHAR(TEXTLINE,BUFCM1,CENDLINE);
  724. FOR TMP1=1 STEP 1 UNTIL SIZE2 DO BUFLINE[TMP1-1]=0;
  725. TMP1=0;
  726. TMP2=1;
  727. WHYLE TMP1/8 LQ SIZE1 AND TMP1/5 LQ SIZE2 AND TMP2 NQ 0 DO
  728. BEGIN
  729. GETCHAR(TEXTLINE,TMP1,TMP2);
  730. IF TMP2 EQ CENDLINE THEN TMP2=0;
  731. ELSE TMP2=XLTINTXP[TMP2] LAN O"3777";
  732. B&lt;MOD(TMP1,5)*12,12>BUFLINE[TMP1/5]=TMP2;
  733. TMP1=TMP1+1;
  734. END
  735.  
  736. END # OF SLOWC8O #
  737.  
  738.  
  739. PROC GETLNUM;
  740. BEGIN
  741. #
  742. ** GETLNUM - ANALYZE INTERNAL LINE IMAGE FOR SEQUENCE NUM.
  743. *
  744. * GETLNUM IS USED TO RECOGNIZE A LINE NUMBER ON THE CURRENT
  745. * LINE. WE SET LINENO TO ITS BINARY VALUE. WE ALSO SET
  746. * WIDTHFOUND TO THE NUMBER OF DIGITS. NOTE THAT IF
  747. * THERE IS NO NUMBER, WE RETURN WIDTHFOUND=0, LINENO=0.
  748. *
  749. * ENTRY (LIN) - ALREADY CONTAINS LINE IMAGE.
  750. *
  751. * EXIT LINENO, WIDTHFOUND ARE SET.
  752. *
  753. * MACROS GETCHAR.
  754. #
  755. ITEM QUIT B;
  756. ITEM TMP2, TMP3;
  757.  
  758. LINENO=0;
  759. WIDTHFOUND=0;
  760. QUIT=FALSE;
  761. FOR TMP2=0 STEP 1 WHILE TMP2 LS NUMWIDTH AND NOT QUIT DO
  762. BEGIN
  763. GETCHAR(LINE,TMP2,TMP3);
  764. IF TMP3 GQ CDIGIT0 AND TMP3 LQ CDIGIT9 THEN
  765. BEGIN
  766. LINENO=LINENO*10 + TMP3-CDIGIT0;
  767. WIDTHFOUND=WIDTHFOUND+1;
  768. END
  769. ELSE QUIT=TRUE;
  770. END
  771.  
  772. END # OF GETLNUM #
  773.  
  774.  
  775. PROC SETLNUM;
  776. BEGIN
  777. #
  778. ** SETLNUM - FORMAT SEQUENCE NUMBER ONTO INTERNAL LINE.
  779. *
  780. * SETLNUM ADJUSTS THE WIDTH OF ANY EXISTING SEQUENCE
  781. * NUMBER, THEN PLACES THE NEW SEQUENCE NUMBER VALUE ON
  782. * THE LINE.
  783. *
  784. * ENTRY (LIN) - EXISTING INTERNAL FORMAT LINE IMAGE.
  785. * (LINENO) - NEW SEQUENCE VALUE.
  786. *
  787. * EXIT (LIN) - FIXED UP.
  788. *
  789. * MACROS SETCHAR.
  790. *
  791. * CALLS GETLNUM, LSHIFT, RSHIFT.
  792. *
  793. * NOTES USES LINENO THEN RESTORES IT.
  794. #
  795. ITEM TMP1,TMP2,TMP3;
  796.  
  797. IF NUMBERED[CURFILE] EQ 0 THEN RETURN;
  798. TMP2=LINENO;
  799. GETLNUM; # CHECK EXISTING NUMBER DIGITS #
  800. LINENO=TMP2; # RESTORE #
  801. IF WIDTHFOUND NQ NUMWIDTH THEN
  802. BEGIN
  803. LSHIFT(LIN,WIDTHFOUND,WIDTHFOUND);
  804. RSHIFT(LIN,0,NUMWIDTH);
  805. END
  806. FOR TMP1=NUMWIDTH-1 STEP -1 UNTIL 0 DO
  807. BEGIN
  808. TMP3=MOD(TMP2,10)+CDIGIT0;
  809. SETCHAR(LINE,TMP1,TMP3);
  810. TMP2=TMP2/10;
  811. END
  812. IF BLANKS NQ 0 THEN
  813. BEGIN
  814. GETCHAR(LINE,NUMWIDTH,TMP1);
  815. IF TMP1 NQ CBLANK THEN RSHIFT(LIN,NUMWIDTH,1);
  816. SETCHAR(LINE,NUMWIDTH,CBLANK);
  817. END
  818. END # OF SETLNUM #
  819.  
  820.  
  821. PROC TRIMPAD;
  822. BEGIN
  823. #
  824. ** TRIMPAD - TRIM OFF TRAILING BLANKS, PAD SEQUENCE.
  825. *
  826. * TRIMPAD TRIMS ALL TRAILING BLANKS FOR A LINE IMAGE IN
  827. * THE INTERNAL CHARACTER SET, AND FOR SEQUENCE-NUMBERED
  828. * FILES IT ALSO PADS A BLANK ON LINES CONSISTING ONLY OF
  829. * A SEQUENCE NUMBER.
  830. *
  831. * ENTRY (LIN) - LINE IMAGE TO BE PROCESSED.
  832. * NUMBERED[CURFILE] - INDICATES SEQUENCE PADDING.
  833. *
  834. * EXIT (LIN) - UPDATED.
  835. *
  836. * MACROS SETCHAR.
  837. *
  838. * CALLS TRIM, PAD, GETLNUM.
  839. *
  840. * USES WIDTHFOUND.
  841. *
  842. * NOTES USES LINENO THEN RESTORES IT.
  843. #
  844. ITEM TMP1;
  845. IF NUMBERED[CURFILE] NQ 0 THEN
  846. BEGIN
  847. TMP1=LINENO;
  848. GETLNUM;
  849. LINENO=TMP1;
  850. IF LENGTH(LIN) LS WIDTHFOUND+BLANKS THEN PAD(LIN);
  851. TRIM(LIN,WIDTHFOUND+BLANKS);
  852. END
  853. ELSE SETCHAR(LINE,FASTLNB(LIN),CENDLINE);
  854. END # OF TRIMPAD #
  855.  
  856.  
  857. PROC TRIM(ALIN,MINIMUM);
  858. BEGIN
  859. #
  860. ** TRIM - TRIM OFF TRAILING BLANKS.
  861. *
  862. * ENTRY ALIN - LINE IMAGE TO PROCESS.
  863. * MINIMUM - MINIMUM LENGTH TO RESPECT.
  864. *
  865. * EXIT ALIN - UPDATED.
  866. *
  867. * MACROS SETCHAR.
  868. *
  869. * CALLS FASTLNB.
  870. #
  871. ARRAY ALIN[0:99]; ITEM ALINE;
  872. ITEM MINIMUM;
  873. SETCHAR(ALINE,MAX(MINIMUM,FASTLNB(ALIN)),CENDLINE);
  874. END # OF TRIM #
  875.  
  876.  
  877. PROC PAD(ALIN);
  878. BEGIN
  879. #
  880. ** PAD - ADD TRAILING BLANKS TO INTERNAL LINE IMAGE.
  881. *
  882. * ENTRY ALIN - LINE IMAGE TO PROCESS.
  883. *
  884. * EXIT ALIN - PADDED TO MAXIMUM WIDTH.
  885. *
  886. * MACROS SETCHAR.
  887. *
  888. * CALLS LENGTH.
  889. #
  890. ARRAY ALIN [0:99]; ITEM ALINE;
  891. ITEM TMP1,TMP2,TMP3;
  892. ARRAY CHARMASKS [0:7]; ITEM MASK=[
  893. O"03777777777777777777",
  894. O"00017777777777777777",
  895. O"00000077777777777777",
  896. O"00000000377777777777",
  897. O"00000000001777777777",
  898. O"00000000000007777777",
  899. O"00000000000000037777",
  900. O"00000000000000000177"];
  901. TMP2=LENGTH(ALIN);
  902. TMP3=TMP2/8;
  903. TMP2=MASK[TMP2 LAN 7];
  904. ALINE[TMP3]=(ALINE[TMP3] LAN (LNO TMP2)) LOR (ALLBLANKS LAN TMP2);
  905. FOR TMP1=TMP3+1 STEP 1 UNTIL BUFWID DO ALINE[TMP1]=ALLBLANKS;
  906. SETCHAR(ALINE,BUFCHAR,CENDLINE);
  907. END # OF PAD #
  908. PAGE # BASIC IO ROUTINES #
  909.  
  910. #
  911. ** WORKIO INTERFACE ROUTINES.
  912. *
  913. * THE WORKIO ENTRY POINTS (POS,FWD,BAK,INS,DEL,REP) ALL NEED
  914. * ADDITIONAL PROCESSING FOR MOST EDITOR OPERATIONS, SO THE
  915. * EDITOR CONTAINS SEVERAL INTERFACE ROUTINES. THOSE NAMED
  916. * WITH "X" APPEAR IN THE SCREEN MODULE AND SYNCHRONIZE THE
  917. * SCREEN. "Y" ENTRY POINTS PERFORM SECRET CHANGES WITHOUT
  918. * FLAGGING EITHER FILE BRACKET AS CHANGED. "Z" ENTRY POINTS
  919. * PERFORM POINTER VECTOR RELOCATION AND FLAG THE CURRENT FILE
  920. * BRACKET AS CHANGED. NOTE THAT THE "X" INTERFACES USE "Z".
  921. *
  922. * "Z" INTERFACES ALSO PERFORM AUDIT TRAIL MAINTENANCE WHEN
  923. * THE "UNDO" FACILITY IS ENABLED. "TMPLINE" IS USED FOR THIS.
  924. *
  925. * THUS ALL INTERFACES EXCEPT "Y" REQUIRE "CURFILE" SETUP AS
  926. * AN IMPLIED PARAMETER UPON ENTRY.
  927. *
  928. * LINEBUF IS A BASED ARRAY WHICH IS POINTED TO THE DESIRED
  929. * LINE BUFFER FOR WORKIO. REDEFINITION OF LINEBUF IS
  930. * RESTRICTED IN THAT IT MUST POINT TO "LIN" ANY TIME THE
  931. * MULTI-USER EDITOR CODE REACHES AN INTERNAL SWAP EVENT. THE
  932. * RESULT OF THIS RESTRICTION IS THAT LINEBUF ALMOST ALWAYS
  933. * IS POINTED AT "LIN", EXCEPT FOR SPECIAL SEQUENCES (AUDIT
  934. * TRAIL FOR UNDO) WHICH ARE KNOWN TO NOT PERMIT INTERNAL SWAP.
  935. * ALSO, THE POS ENTRY TO WORKIO WILL NOT COPY TEXT INTO THE
  936. * LINE BUFFER IF THE LINE ORDINAL IN NEWCURL IS COMPLEMENTED.
  937. #
  938.  
  939. PROC POSZ(PARM);
  940. IOBEGIN(POSZ)
  941. ITEM PARM;
  942. NEWCURL=PARM;
  943. POS;
  944. IOEND # OF POSZ #
  945.  
  946.  
  947. PROC FWDZ;
  948. IOBEGIN(FWDZ)
  949. FWD;
  950. IOEND # OF FWDZ #
  951.  
  952.  
  953. PROC BAKZ;
  954. IOBEGIN(BAKZ)
  955. BAK;
  956. IOEND # OF BAKZ #
  957.  
  958.  
  959. PROC INSZ;
  960. IOBEGIN(INSZ)
  961. AUDITINS; # AUDIT INSERTION #
  962. CHANGED[CURFILE] = 1 LAN (LNO LOCKED[CURFILE]) ;
  963. INS;
  964. RELOCATE(+1);
  965. IOEND # OF INSZ #
  966.  
  967.  
  968. PROC DELZ;
  969. IOBEGIN(DELZ)
  970. AUDITDEL; # AUDIT DELETION #
  971. CHANGED[CURFILE] = 1 LAN (LNO LOCKED[CURFILE]) ;
  972. DELETEDONE=TRUE;
  973. RELOCATE(-1);
  974. DEL;
  975. POSZ(CURRENT);
  976. IOEND # OF DELZ #
  977.  
  978.  
  979. PROC REPZ;
  980. IOBEGIN(REPZ)
  981. AUDITREP; # AUDIT REPLACE #
  982. CHANGED[CURFILE] = 1 LAN (LNO LOCKED[CURFILE]) ;
  983. REP;
  984. IOEND # OF REPZ #
  985.  
  986.  
  987. PROC INSY;
  988. IOBEGIN(INSY)
  989. INS;
  990. RELOCATE(+1);
  991. IOEND # OF INSY #
  992.  
  993.  
  994. PROC DELY;
  995. IOBEGIN(DELY)
  996. DELETEDONE=TRUE;
  997. RELOCATE(-1);
  998. DEL;
  999. POSZ(CURRENT);
  1000. IOEND # OF DELY #
  1001.  
  1002.  
  1003. PROC REPY;
  1004. IOBEGIN(REPY)
  1005. REP;
  1006. IOEND # OF REPY #
  1007.  
  1008.  
  1009. PAGE # BASIC ROUTINES FOR POSITION STACK #
  1010.  
  1011.  
  1012. PROC PUSH;
  1013. BEGIN
  1014. #
  1015. ** PUSH - PUSH CURRENT LINE/FILE ONTO STACK.
  1016. *
  1017. * ENTRY CURRENT - LINE POSITION TO SAVE.
  1018. * CURFILE - FILE ASSOCIATION TO SAVE.
  1019. *
  1020. * EXIT STACKPTR, REGLINE, STKFILE - UPDATED.
  1021. #
  1022. IF STACKPTR GQ MAXSTACK THEN
  1023. BEGIN
  1024. FATAL(" FILE POSITION STACK OVERFLOWED.$");
  1025. END
  1026. STACKPTR=STACKPTR+1;
  1027. REGLINE[STACKPTR]=CURRENT;
  1028. STKFILE[STACKPTR]=CURFILE;
  1029. END # OF PUSH #
  1030.  
  1031.  
  1032. PROC POP;
  1033. IOBEGIN(POP)
  1034. #
  1035. ** POP - POP LINE/FILE POSITION FROM STACK.
  1036. *
  1037. * ENTRY REGLINE, STACKPTR, STKFILE - CONTAIN SAVED POSITION.
  1038. *
  1039. * EXIT LIN, CURRENT, CURFILE - RESTORED POSITION/TEXT.
  1040. * STACKPTR - UPDATED.
  1041. #
  1042. IF STACKPTR LS 0 THEN
  1043. BEGIN
  1044. FATAL(" FILE POSITION STACK UNDERFLOWED (1).$");
  1045. END
  1046. POSZ(REGLINE[STACKPTR]);
  1047. CURFILE=STKFILE[STACKPTR];
  1048. STACKPTR=STACKPTR-1;
  1049. IOEND # OF POP #
  1050.  
  1051.  
  1052. PROC RELOCATE(PARM);
  1053. BEGIN
  1054. ITEM PARM;
  1055. #
  1056. ** RELOCATE - INTERFACE TO UPDATE VECTOR OF RELOCATABLES.
  1057. *
  1058. * ENTRY PARM - RELOCATION FACTOR.
  1059. * CURRENT - RELOCATION THRESHHOLD.
  1060. *
  1061. * EXIT REGSTACK - UPDATED.
  1062. *
  1063. * CALLS FASTRLC.
  1064. #
  1065. FASTRLC(REGSTACK,MAXREG+1,CURRENT,PARM);
  1066. END # OF RELOCATE #
  1067.  
  1068.  
  1069. PAGE # AUDIT TRAIL ROUTINES #
  1070.  
  1071.  
  1072. #
  1073. ** AUDIT TRAIL FACILITY.
  1074. *
  1075. * AUDIT TRAIL ROUTINES PRESERVE THE CURRENT POSITION AND THE
  1076. * "LIN" BUFFER. "TMPLIN" IS USED WIDELY.
  1077. *
  1078. * FOR AN INSERTION, THE AUDIT RECORD IS A SINGLE DESCRIPTOR
  1079. * LINE WITH "I" TYPE AND THE FLOAT POSITION.
  1080. *
  1081. * FOR A DELETION, WE WRITE THE OLD VERSION OF THE LINE THEN A
  1082. * DESCRIPTOR WITH "D" TYPE, FILE ID, AND FILE POSITION.
  1083. *
  1084. * FOR A REPLACEMENT, WE WRITE THE OLD VERSION OF THE LINE AND
  1085. * AN "R" DESCRIPTOR, FILE ID, AND FILE POSITION.
  1086. *
  1087. * TO CHECK POINT A MAJOR STOPPING POINT, WE WRITE A "C"
  1088. * DESCRIPTOR. THIS INCLUDES FILE ID'S FOR BOTH OPEN
  1089. * BRACKETS, AND SPLIT SCREEN DIMENSIONS.
  1090. *
  1091. * TO TERMINATE A SERIES OF MAJOR STOPPING POINTS, WE WRITE
  1092. * A "E" DESCRIPTOR. THIS HAS NO PARAMETERS ON IT.
  1093. *
  1094. * THIS AUDIT TRAIL FORMAT IS VIABLE ONLY WHEN SCANNED IN
  1095. * REVERSE ORDER, AND WHEN IT IS ASSURED TO REPRESENT ALL
  1096. * CHANGES. THIS IMPLIES THAT THE "AUDITOFF" FLAG CAN BE SET
  1097. * TO DISABLE THE FACILITY, BUT IN ORDER TO CLEAR THE FLAG AND
  1098. * RE-ENABLE THE FACILITY, IT IS MANDATORY TO ISSUE AN "END"
  1099. * DESCRIPTOR AS DESCRIBED IN THE PREVIOUS PARAGRAPH. THE
  1100. * UNDO INTERPRETER MUST NOT GO BEYOND THIS POINT.
  1101. *
  1102. * NOTE THAT ENTRY POINTS AUDITEVENT AND AUDITNUM AND AUDITTEXT
  1103. * ARE USED ONLY BY AUDIT ROUTINES. ENTRY POINTS AUDITINS,
  1104. * AUDITDEL, AND AUDITREP ARE INTENDED TO BE USED ONLY BY INSZ,
  1105. * DELZ, AND REPZ. AUDITCHECK AND AUDITSYNCH ARE THE ENTRY
  1106. * POINTS SUITABLE FOR GENERAL USAGE. AUDITTRAIL IS USED ONLY
  1107. * BY AUDIT ROUTINES. AUDITTRAIL AND AUDITSYNCH ARE THE ONLY
  1108. * ROUTINES TO ACTUALLY MANIPULATE THE AUDIT BUFFERING AREA.
  1109. *
  1110. * ROUTINES WHICH CALL AUDITTRAIL MUST SET UP THE BASE
  1111. * ADDRESS FOR LINEBUF, AND RESTORE IT. SUCH ROUTINES
  1112. * CURRENTLY RESTORE THAT BASE ADDRESS BY ASSUMING THE
  1113. * CORRECT ADDRESS IS "LIN" RATHER THAN BY ACTUALLY
  1114. * SAVING AND RESTORING. THUS, WE IMPOSE A GENERAL
  1115. * RESTRICTION THAT ANY EDITOR CODE WHICH CAUSES AUDITABLE
  1116. * WORKFILE CHANGES MUST USE "LIN" AS THE ADDRESS OF LINEBUF.
  1117. *
  1118. * THE AUDIT TRAIL IS STAGED THRU A DEDICATED MEMORY BUFFER.
  1119. * AUDITSYNCH PURGES THIS BUFFER INTO THE AUDIT BRACKET OF
  1120. * THE WORKFILE, SO ANY ROUTINE THAT NEEDS TO ACCESS THE
  1121. * AUDIT TRAIL (I.E, THE UNDO FACILITY) MUST CALL AUDITSYNCH.
  1122. * THE STAGING AREA PROVIDES PERFORMANCE OPTIMIZATION BY
  1123. * DEFERRING AND BATCHING WORKFILE ACCESSES.
  1124. *
  1125. * ALL AUDIT ROUTINES, WHICH ARE ALLOWED TO BE CALLED FROM
  1126. * OUTSIDE OF OTHER AUDIT ROUTINES, INSPECT THE AUDITOFF
  1127. * FLAG TO SEE IF THE FACILITY IS DISABLED. ROUTINES WHICH
  1128. * ARE LOCAL TO THE AUDIT FACILITY DO NOT CHECK THIS FLAG,
  1129. * BOTH FOR EFFICIENCY AND TO ASSURE THAT STAGED DATA CAN
  1130. * BE HANDLED RIGOROUSLY.
  1131. #
  1132.  
  1133.  
  1134. PROC AUDITINS;
  1135. IOBEGIN(AUDITINS)
  1136. #
  1137. ** AUDITINS - AUDIT INTERFACE FOR INSZ.
  1138. *
  1139. * NOTE REFER TO FACILITY HEADER.
  1140. #
  1141. IF AUDITOFF THEN IORET
  1142. AUDITEVENT(CLETTERI);
  1143. IOEND # OF AUDITINS #
  1144.  
  1145.  
  1146. PROC AUDITDEL;
  1147. IOBEGIN(AUDITDEL)
  1148. #
  1149. ** AUDITDEL - AUDIT INTERFACE FOR DELZ.
  1150. *
  1151. * NOTE REFER TO FACILITY HEADER.
  1152. #
  1153. IF AUDITOFF THEN IORET
  1154. AUDITTEXT;
  1155. AUDITEVENT(CLETTERD);
  1156. IOEND # OF AUDITDEL #
  1157.  
  1158.  
  1159. PROC AUDITREP;
  1160. IOBEGIN(AUDITREP)
  1161. #
  1162. ** AUDITREP - AUDIT INTERFACE FOR REPZ.
  1163. *
  1164. * NOTE REFER TO FACILITY HEADER.
  1165. #
  1166. IF AUDITOFF THEN IORET
  1167. AUDITTEXT;
  1168. AUDITEVENT(CLETTERR);
  1169. IOEND # OF AUDITREP #
  1170.  
  1171.  
  1172. PROC AUDITNUM(POS,NUM);
  1173. BEGIN
  1174. #
  1175. ** AUDITNUM - FORMAT NUMERIC VALUE INTO AUDIT DESCRIPTOR.
  1176. *
  1177. * ENTRY NUM, POS - VALUE AND CHARACTER POSITION.
  1178. *
  1179. * EXIT TMPLIN - CONTAINS FORMATTED VALUE.
  1180. *
  1181. * MACROS SETCHAR.
  1182. *
  1183. * NOTE REFER TO FACILITY HEADER.
  1184. #
  1185. ITEM POS, NUM, TMP2, TMP3, TMP4;
  1186. TMP2=NUM;
  1187. FOR TMP3=9 STEP -1 UNTIL 0 DO
  1188. BEGIN
  1189. TMP4=CDIGIT0+MOD(TMP2,10);
  1190. TMP2=TMP2/10;
  1191. SETCHAR(TMPLINE,POS+TMP3,TMP4);
  1192. END
  1193. SETCHAR(TMPLINE,POS+10,CBLANK);
  1194. END # OF AUDITNUM #
  1195.  
  1196.  
  1197. PROC AUDITEVENT(PARM);
  1198. IOBEGIN(AUDITEVENT)
  1199. #
  1200. ** AUDITEVENT - FORMAT AND TRANSMIT DESCRIPTOR.
  1201. *
  1202. * ENTRY PARM - TYPE OF DESCRIPTOR.
  1203. *
  1204. * EXIT DESCRIPTOR TRANSMITTED TO AUDIT TRAIL.
  1205. *
  1206. * MACROS SETCHAR.
  1207. *
  1208. * CALLS AUDITNUM, AUDITTRAIL.
  1209. *
  1210. * USES TMPLIN, P<LINEBUF>.
  1211. *
  1212. * NOTE REFER TO FACILITY HEADER.
  1213. #
  1214. ITEM PARM;
  1215.  
  1216. SETCHAR(TMPLINE,0,PARM);
  1217. # END OF PARAMETER USAGE #
  1218. AUDITNUM(1,CURFILE);
  1219. AUDITNUM(12,FDLF(CURFILE));
  1220. AUDITNUM(23,CURRENT-TOPF(CURFILE));
  1221. SETCHAR(TMPLINE,34,CENDLINE);
  1222. P&lt;LINEBUF>=LOC(TMPLIN);
  1223. AUDITTRAIL;
  1224. P&lt;LINEBUF>=LOC(LIN);
  1225. IOEND # OF AUDITEVENT #
  1226.  
  1227.  
  1228. PROC AUDITTEXT;
  1229. IOBEGIN(AUDITTEXT)
  1230. #
  1231. ** AUDITTEXT - TRANSMIT TEXT LINE TO AUDIT TRAIL.
  1232. *
  1233. * ENTRY CURRENT - POINTS TO OLD LINE IMAGE IN WORKFILE.
  1234. *
  1235. * CALLS POSZ, AUDITTRAIL.
  1236. *
  1237. * USES TMPLIN, P<LINEBUF>.
  1238. *
  1239. * NOTE REFER TO FACILITY HEADER.
  1240. #
  1241. P&lt;LINEBUF>=LOC(TMPLIN);
  1242. POSZ(CURRENT); # READ OLD VERSION #
  1243. AUDITTRAIL;
  1244. P&lt;LINEBUF>=LOC(LIN);
  1245. IOEND # OF AUDITTEXT #
  1246.  
  1247.  
  1248. PROC AUDITCHECK;
  1249. IOBEGIN(AUDITCHECK)
  1250. #
  1251. ** AUDITCHECK - ISSUE CHECKPOINT TO AUDIT TRAIL.
  1252. *
  1253. * ENTRY AUDITUSED - INDICATES IF ANYTHING AUDITED SINCE
  1254. * LAST CHECKPOINT.
  1255. *
  1256. * EXIT AUDITUSED - CLEAR TO SHOW CHECKPOINT IS MOST
  1257. * RECENT AUDIT ENTRY.
  1258. *
  1259. * MACROS SETCHAR.
  1260. *
  1261. * CALLS AUDITNUM, AUDITTRAIL.
  1262. *
  1263. * USES TMPLIN, P<LINEBUF>.
  1264. *
  1265. * NOTE REFER TO FACILITY HEADER.
  1266. #
  1267. IF AUDITOFF THEN IORET
  1268. IF NOT AUDITUSED THEN IORET
  1269. SETCHAR(TMPLINE,0,CLETTERC);
  1270. AUDITNUM(1,FDLF(1));
  1271. AUDITNUM(12,FDLF(2));
  1272. AUDITNUM(23,NUMROWS[2]);
  1273. SETCHAR(TMPLINE,34,CENDLINE);
  1274. P&lt;LINEBUF>=LOC(TMPLIN);
  1275. AUDITTRAIL;
  1276. P&lt;LINEBUF>=LOC(LIN);
  1277. AUDITUSED=FALSE;
  1278. IOEND # OF AUDITCHECK #
  1279.  
  1280.  
  1281. PROC AUDITEND;
  1282. IOBEGIN(AUDITEND)
  1283. #
  1284. ** AUDITEND - ISSUE TERMINATOR TO AUDIT TRAIL.
  1285. *
  1286. * EXIT AUDITUSED - CLEAR TO SHOW CHECKPOINT IS MOST
  1287. * RECENT AUDIT ENTRY.
  1288. *
  1289. * MACROS SETCHAR.
  1290. *
  1291. * CALLS AUDITTRAIL.
  1292. *
  1293. * USES TMPLIN, P<LINEBUF>.
  1294. *
  1295. * NOTE REFER TO FACILITY HEADER.
  1296. #
  1297. IF AUDITOFF THEN IORET
  1298. SETCHAR(TMPLINE,0,CLETTERE);
  1299. SETCHAR(TMPLINE,1,CENDLINE);
  1300. P&lt;LINEBUF>=LOC(TMPLIN);
  1301. AUDITTRAIL;
  1302. P&lt;LINEBUF>=LOC(LIN);
  1303. AUDITUSED=FALSE;
  1304. IOEND # OF AUDITEND #
  1305.  
  1306.  
  1307. PROC AUDITTRAIL;
  1308. IOBEGIN(AUDITTRAIL);
  1309. #
  1310. ** AUDITTRAIL - TRANSMIT LINE IMAGE TO AUDIT TRAIL.
  1311. *
  1312. * ENTRY P<LINEBUF> - POINTS TO INTERNAL LINE IMAGE.
  1313. *
  1314. * EXIT LINE IMAGE IS STAGED IN BUFFER.
  1315. * AUDITUSED - SET TO SHOW SOMETHING AUDITED SINCE
  1316. * MOST RECENT CHECKPOINT.
  1317. * AUDITNEXT - UPDATED.
  1318. *
  1319. * CALLS LINESZ, MOVELN, AUDITSYNCH.
  1320. *
  1321. * USES P<TOO>.
  1322. *
  1323. * NOTE REFER TO FACILITY HEADER.
  1324. #
  1325. ITEM TMP1; # USE INSTANTLY #
  1326. TMP1=LINESZ(LINEBUF); # MEASURE TEXT, FIX EOL BITS #
  1327. IF TMP1 GQ AUDITSIZE-AUDITNEXT THEN AUDITSYNCH; # ASSURE ROOM #
  1328. P&lt;TOO>=LOC(AUDITWORD[AUDITNEXT]);
  1329. AUDITNEXT=AUDITNEXT+MOVELN(LINEBUF,TOO); # QUEUE THIS RECORD #
  1330. AUDITUSED=TRUE;
  1331. IOEND # OF AUDITTRAIL #
  1332.  
  1333.  
  1334. PROC AUDITSYNCH;
  1335. IOBEGIN(AUDITSYNCH);
  1336. #
  1337. ** AUDITSYNCH - FLUSH STAGING BUFFER INTO WORKFILE.
  1338. *
  1339. * EXIT CURA(AUDITCTL), AUDITNEXT - UPDATED.
  1340. *
  1341. * USES P<LINEBUF> WITH RESTORATION.
  1342. * "TEMP" WITH RESTORATION.
  1343. *
  1344. * CALLS PUSHTEMP, POPTEMP, PUSH, POP, POSZ, INS,
  1345. * RELOCATE.
  1346. *
  1347. * NOTE REFER TO FACILITY HEADER.
  1348. * REQUIRES WORKIO CAPABILITY TO POSITION FILE WITH
  1349. * NO COPY OF LINE IMAGE.
  1350. #
  1351. PUSHTEMP;
  1352. TEMP=LOC(LINEBUF); # SAVE #
  1353. PUSHTEMP;
  1354. PUSH;
  1355. P&lt;LINEBUF>=0;
  1356. POSZ(CURA(AUDITCTL)); # INVISIBLY #
  1357. TEMP=0;
  1358. WHYLE TEMP LS AUDITNEXT DO
  1359. BEGIN
  1360. P&lt;LINEBUF>=LOC(AUDITWORD[TEMP]); # TAKE DIRECTLY FROM QUEUE #
  1361. TEMP=TEMP+LINESZ(LINEBUF); # MEASURE, FIX EOL BITS #
  1362. INS;
  1363. RELOCATE(+1);
  1364. END
  1365. CURA(AUDITCTL)=CURRENT;
  1366. P&lt;LINEBUF>=0;
  1367. POP; # INVISIBLY #
  1368. POPTEMP;
  1369. P&lt;LINEBUF>=TEMP; # RESTORE #
  1370. POPTEMP;
  1371. AUDITNEXT=0;
  1372. IOEND # OF AUDITSYNCH #
  1373. PAGE # FILE MANAGEMENT #
  1374.  
  1375.  
  1376. PROC FORMFDL(FILEPARM);
  1377. BEGIN
  1378. #
  1379. ** FORMFDL - FORMAT FILE DESCRIPTOR LINE.
  1380. *
  1381. * FORMFDL CREATES A FILE DESCRIPTOR LINE BASED ON THE CURRENT
  1382. * ATTRIBUTES OF A FILE IMAGE WHICH IS ONE OF THE TWO BRACKETED
  1383. * FILES. THE FORMAT OF THE FDL IS- CHARACTER POSITION 0 =
  1384. * FILE NAME, 8 = YES/NO FOR THE WRITE LOCKOUT, 10 = YES/NO FOR
  1385. * CHANGES MADE, 12 = YES/NO FOR 6/12 ASCII CHARACTER SET, 14 =
  1386. * YES/NO FOR NUMBERED MODE, 16 = SIZE OF FILE, AND 27 =
  1387. * CURRENT POSITION IN FILE. IF THIS FORMAT IS TO BE CHANGED,
  1388. * CODE MUST ALSO BE CHANGED IN THE "GET STATUS" COMMAND AND IN
  1389. * THE SESSION RESUMPTION LOGIC OF FSEMAIN.
  1390. *
  1391. * ENTRY FILEPARM - WHICH FILE BRACKET TO SUMMARIZE.
  1392. *
  1393. * EXIT LIN - CONTAINS DESCRIPTOR TEXT.
  1394. *
  1395. * MACROS SETCHAR.
  1396. *
  1397. * CALLS FORMNUM(INTERNAL).
  1398. #
  1399.  
  1400. ITEM FILEPARM, TMP1,TMP2,TMP3,TMP4;
  1401.  
  1402. PROC FORMNUM(PARM);
  1403. BEGIN
  1404. ITEM PARM;
  1405. TMP4=PARM;
  1406. FOR TMP1=9 STEP -1 UNTIL 0 DO
  1407. BEGIN
  1408. C&lt;TMP1,1>TMP3=MOD(TMP4,10)+O"33";
  1409. TMP4=TMP4/10;
  1410. END
  1411. FOR TMP1=0 STEP 1 UNTIL 9 DO
  1412. BEGIN
  1413. TMP4=C&lt;TMP1,1>TMP3;
  1414. TMP4=XLTDSPINT[TMP4];
  1415. SETCHAR(LINE,TMP2,TMP4);
  1416. TMP2=TMP2+1;
  1417. END
  1418. SETCHAR(LINE,TMP2,CBLANK);
  1419. TMP2=TMP2+1;
  1420. END
  1421.  
  1422.  
  1423. # START OF FORMFDL #
  1424.  
  1425. TMP2=0;
  1426. FOR TMP1=0 STEP 1 UNTIL 6 DO
  1427. BEGIN
  1428. C&lt;0,7>TMP3=PADNAME(FILENAM[FILEPARM]);
  1429. TMP3=C&lt;TMP1,1>TMP3;
  1430. TMP3=XLTDSPINT[TMP3];
  1431. SETCHAR(LINE,TMP2,TMP3);
  1432. TMP2=TMP2+1;
  1433. END
  1434. FOR TMP2=7 STEP 1 UNTIL 15 DO SETCHAR(LINE,TMP2,CBLANK);
  1435. SETCHAR(LINE,8,LOCKED[FILEPARM]+CDIGIT0);
  1436. SETCHAR(LINE,10,CHANGED[FILEPARM]+CDIGIT0);
  1437. SETCHAR(LINE,12,ASCII[FILEPARM]+CDIGIT0);
  1438. SETCHAR(LINE,14,INITNMBR[FILEPARM]+CDIGIT0);
  1439. TMP2=16;
  1440. FORMNUM(BOTF(FILEPARM)-TOPF(FILEPARM)-1);
  1441. FORMNUM(CURF(FILEPARM)-TOPF(FILEPARM));
  1442. SETCHAR(LINE,TMP2,CENDLINE);
  1443.  
  1444. END # OF FORMFDL #
  1445.  
  1446.  
  1447. PROC SCANFDL(NAME);
  1448. BEGIN
  1449. #
  1450. ** SCANFDL - ANALYZE FILE DESCRIPTOR LINE.
  1451. *
  1452. * ENTRY LIN - CONTAINS FDL TEXT.
  1453. *
  1454. * EXIT NAME - FILE NAME.
  1455. * SCNFDLOCK, SCNFDCHNG, SCNFDASCI, SCNFDNUMB,
  1456. * SCNFDSIZE, SCNFDCURF - UPDATED.
  1457. *
  1458. * USES TMPLIN.
  1459. * CMDLIN, SCANPOS, KEYWDTYPE - WITH RESTORATION.
  1460. *
  1461. * CALLS COPYLIN, TOKEN.
  1462. *
  1463. * NOTE CALLER MUST NON-REENTRANTLY USE SCNFDXXXX.
  1464. #
  1465. ITEM NAME C(7);
  1466. ITEM HOLDSCAN, HOLDSEARCH;
  1467.  
  1468. COPYLIN(CMDLIN,TMPLIN);
  1469. HOLDSCAN=TOKENPOS;
  1470. HOLDSEARCH=KEYWDTYPE;
  1471. COPYLIN(LIN,CMDLIN);
  1472. SCANPOS=0;
  1473. KEYWDTYPE=0;
  1474. TOKEN;
  1475. NAME=TOKENSYM;
  1476. KEYWDTYPE=1;
  1477. TOKEN;
  1478. SCNFDLOCK=TOKENVAL;
  1479. TOKEN;
  1480. SCNFDCHNG=TOKENVAL;
  1481. TOKEN;
  1482. SCNFDASCI=TOKENVAL;
  1483. TOKEN;
  1484. SCNFDNUMB=TOKENVAL LAN 1;
  1485. SCNFDINIT=TOKENVAL/2;
  1486. TOKEN;
  1487. SCNFDSIZE=TOKENVAL;
  1488. TOKEN;
  1489. SCNFDCURF=TOKENVAL;
  1490.  
  1491. COPYLIN(TMPLIN,CMDLIN);
  1492. SCANPOS=HOLDSCAN;
  1493. KEYWDTYPE=HOLDSEARCH;
  1494. TOKEN;
  1495.  
  1496. END # OF SCANFDL #
  1497.  
  1498.  
  1499. PROC OPENFILE;
  1500. # TITLE OPENFILE - BRACKET AN INTERNAL FILE IMAGE. #
  1501.  
  1502. IOBEGIN(OPENFILE)
  1503.  
  1504. #
  1505. ** OPENFILE - BRACKET AN INTERNAL FILE IMAGE.
  1506. *
  1507. * OPENFILE GETS THE REQUESTED FILE INTO ONE OF THE INTERNAL
  1508. * FILE BRACKETS, BY HOOK OR BY CROOK. VALUES OF THE
  1509. * CHARPARM AND GETPARM ENTRIES CAN FORCE DISPOSAL OF AN
  1510. * EXTANT INTERNAL FILE IMAGE WITH A FRESH FILE BUILD.
  1511. * FOR CASES WHERE ANY INTERNAL IMAGE IS UNACCEPTABLE, THE
  1512. * RESULTS OF THE FIRST OPENFILE ARE COMPARED WITH THE ENTRY
  1513. * CONDITIONS, AND OPENFILE MIGHT THEN BE CALLED ONCE MORE.
  1514. *
  1515. * ENTRY READNAM - FILE NAME.
  1516. * FILNUM - BRACKET TO OPEN INTO.
  1517. * CHARPARM - CHARACTER SET PREFERENCE.
  1518. * GETPARM - PREFERENCE FOR INTERNAL/LOCAL/PERMANENT.
  1519. *
  1520. * EXIT DESIRED FILE IS IN BRACKET. OTHER BRACKET MAY
  1521. * BE NULLED OUT IF OTHER BRACKET WAS SAME AS THIS
  1522. * BRACKET, AND THE CURRENT BRACKET REQUIRES NULLOUT.
  1523. *
  1524. * CALLS ACCESSFILE, FORCEPAINT, POPTEMP, PUSHTEMP.
  1525. *
  1526. * USES TEMP WITH RESTORATION.
  1527. #
  1528.  
  1529. PROC FORCEPAINT;
  1530. # TITLE FORCEPAINT - FORCE A SCREEN PAINT. #
  1531.  
  1532. BEGIN # FORCEPAINT #
  1533.  
  1534. #
  1535. ** FORCEPAINT - FORCE A SCREEN PAINT.
  1536. *
  1537. * PROC FORCEPAINT
  1538. *
  1539. * ENTRY FILENAM[1-2] - SETUP.
  1540. *
  1541. * EXIT SCREEN REPAINTED.
  1542. *
  1543. * CALLS PAINTSPLIT.
  1544. *
  1545. * USES CURSPLIT.
  1546. #
  1547.  
  1548. ITEM ONE I=1; # SPLIT ONE #
  1549. ITEM TWO I=2; # SPLIT TWO #
  1550.  
  1551. IF SCREENMODE THEN
  1552. BEGIN
  1553. IF LASTNAME[1] EQ FILENAM[FILNUM] THEN
  1554. BEGIN
  1555. TITLE1LINE[0]=NULLIN;
  1556. CURSPLIT = = ONE;
  1557. PAINTSPLIT;
  1558. CURSPLIT = = ONE;
  1559. END
  1560. IF LASTNAME[2] EQ FILENAM[FILNUM] THEN
  1561. BEGIN
  1562. TITLE2LINE[0]=NULLIN;
  1563. CURSPLIT = = TWO;
  1564. PAINTSPLIT;
  1565. CURSPLIT = = TWO;
  1566. END
  1567. END
  1568.  
  1569. END # FORCEPAINT #
  1570.  
  1571.  
  1572. # MAIN OPENFILE CODE STARTS HERE #
  1573.  
  1574.  
  1575. CONTROL IFEQ MULTI,1;
  1576. IF GETPARM GQ 2 THEN GOTO QQSINGLE; # IF GET/READ WILL BE NEEDED #
  1577. CONTROL FI;
  1578.  
  1579. ACCESSFILE; # ACCESS THE FILE #
  1580.  
  1581. CONTROL IFEQ SINGLE,1;
  1582. SCNFDINIT = 0; # PRESET NOT INITIAL FILE #
  1583. IF GETPARM GQ 2 THEN # IF GET OR READ PARAMETER #
  1584. BEGIN
  1585. FORCEPAINT;
  1586. IF FILNUM NQ 0 THEN
  1587. BEGIN # IF FILE IS IN A BRACKET #
  1588. FOR FILNUM=1 STEP 1 UNTIL 2 DO
  1589. BEGIN # REMOVE BRACKETS FOR OLD FILE #
  1590. IF FDLF(FILNUM) EQ FDLF(CURFILE) THEN
  1591. BEGIN
  1592. SCNFDINIT == INITFILE[FILNUM]; # CLEAR/SET INITIAL FILE #
  1593. FILENAM[FILNUM]="ZZZNULL";
  1594. LOCKED[FILNUM]=1;
  1595. CLOSEFILE; # CLOSE OLD FILE #
  1596. END
  1597. END
  1598. FILNUM = 0; # INDICATE FILE ACCESS NEEDED #
  1599. END
  1600. END
  1601. IF FILNUM EQ 0 THEN
  1602. BEGIN # IF FILE ACCESS NEEDED #
  1603. FILNUM = CURFILE;
  1604. ADDFILE; # ACCESS THE FILE #
  1605. END
  1606. CONTROL FI;
  1607.  
  1608. IF ASCII[FILNUM] NQ CHARPARM AND CHARPARM NQ 0 THEN
  1609. BEGIN # IF CHARACTER SET CHANGED #
  1610. FORCEPAINT;
  1611. PUSHTEMP;
  1612. FOR TEMP = 1 STEP 1 UNTIL 2 DO # IF SPLIT IS USED THEN RESET #
  1613. BEGIN
  1614. IF FDLF(TEMP) EQ FDLF(FILNUM) THEN ASCII[TEMP]=CHARPARM;
  1615. END
  1616. POPTEMP;
  1617. END
  1618.  
  1619. IOEND # OPENFILE #
  1620.  
  1621.  
  1622. PROC ACCESSFILE;
  1623. IOBEGIN(ACCESSFILE)
  1624. #
  1625. ** ACCESSFILE - ACCESS A FILE.
  1626. *
  1627. * ACCESSFILE ATTEMPTS TO LOGICALLY OPEN A FILE BY IDENTIFYING
  1628. * IT AS ALREADY OPEN IN ONE OR BOTH FILE BRACKETS, OR AS
  1629. * AVAILABLE FOR QUICK OPEN FROM THE FILE DIRECTORY LINES. IF
  1630. * THESE METHODS FAIL, THE MULTI-USER EDITOR PASSES CONTROL TO
  1631. * THE SINGLE-USER EDITOR VIA *QQSINGLE*, WHEREUPON THE SINGLE-
  1632. * USER EDITOR WILL WORK IT-S WAY TO THIS POINT BY REPROCESSING
  1633. * THE SAME COMMAND. THE SINGLE-USER EDITOR NOTES THAT THE FILE
  1634. * WAS NOT FOUND BY ZEROING THE FILE NUMBER. *OPENFILE* WILL
  1635. * RECOGNIZE THAT AS AN INDICATION THAT *ADDFILE* MUST BE CALLED
  1636. * TO GET AND/OR READ THE FILE.
  1637. *
  1638. * ENTRY SEE OPENFILE.
  1639. *
  1640. * EXIT IF FILE FOUND, ALL FILE BRACKET STRUCTURES UPDATED.
  1641. * IF NOT, MULTI-USER EDITOR EXITS TO SINGLE-USER EDITOR,
  1642. * SINGLE-USER RETURNS ZERO IN FILNUM.
  1643. *
  1644. * CALLS ADDFILE, CLOSEFILE, NOPOP, PADNAME, POP, POPTEMP,
  1645. * POSZ, PUSH, PUSHTEMP, QQSINGLE, SCANFDL.
  1646. #
  1647. ITEM NAME1 C(7), NAME2 C(7); # USE INSTANTLY #
  1648.  
  1649. CURFILE=FILNUM;
  1650.  
  1651. NAME1=PADNAME(READNAM);
  1652. NAME2=PADNAME(FILENAM[FILNUM]);
  1653. IF NAME2 NQ " " AND NAME1 NQ NAME2 THEN CLOSEFILE;
  1654.  
  1655. PUSHTEMP;
  1656. FOR TEMP=1 STEP 1 UNTIL 2 DO
  1657. BEGIN
  1658. NAME1=PADNAME(READNAM); # RECOMPUTE SINCE REENTERED #
  1659. NAME2=PADNAME(FILENAM[TEMP]);
  1660. IF NAME1 EQ NAME2 THEN
  1661. BEGIN
  1662. IF TEMP NQ FILNUM THEN
  1663. BEGIN
  1664. FILEATTR[FILNUM] = FILEATTR[TEMP];
  1665. TOPF(FILNUM) = TOPF(TEMP);
  1666. BOTF(FILNUM) = BOTF(TEMP);
  1667. CURF(FILNUM) = CURF(TEMP);
  1668. FDLF(FILNUM) = FDLF(TEMP);
  1669. END
  1670. POSZ(CURF(FILNUM));
  1671. POPTEMP;
  1672. IORET
  1673. END
  1674. END
  1675. POPTEMP;
  1676.  
  1677. FILNUM=FILNUM LXR 3; # REVERSE VALUE #
  1678. NAME1=PADNAME(FILENAM[FILNUM]);
  1679. IF NAME1 NQ " " THEN CLOSEFILE; # ASSURES FDL UP TO DATE #
  1680. FILNUM=FILNUM LXR 3; # RESTORE VALUE #
  1681.  
  1682. PUSH;
  1683. POSZ(TOPC(FILECTL)+1);
  1684. LINENO=BOTC(FILECTL);
  1685. WHYLE CURRENT LS BOTC(FILECTL) DO
  1686. BEGIN
  1687. # ONCE SCANFDL IS CALLED MUST USE RESULTS INSTANTLY #
  1688. SCANFDL(NAME2);
  1689. NAME1=PADNAME(READNAM); # RECOMPUTE SINCE REENTERED #
  1690. IF NAME2 EQ NAME1 THEN
  1691. BEGIN
  1692. FILENAM[FILNUM]=TRIMNAME(NAME2);
  1693. INITFILE[FILNUM]=SCNFDINIT;
  1694. LOCKED[FILNUM]=SCNFDLOCK;
  1695. CHANGED[FILNUM]=SCNFDCHNG;
  1696. ASCII[FILNUM]=SCNFDASCI;
  1697. NUMBERED[FILNUM]=SCNFDNUMB;
  1698. TOPF(FILNUM)=LINENO;
  1699. BOTF(FILNUM)=LINENO+1+SCNFDSIZE;
  1700. CURF(FILNUM)=TOPF(FILNUM)+SCNFDCURF;
  1701. FDLF(FILNUM)=CURRENT;
  1702. POSZ(CURF(FILNUM));
  1703. NOPOP;
  1704. IORET
  1705. END
  1706. LINENO=LINENO+1+SCNFDSIZE;
  1707. # END OF INSTANTANEOUS COMPUTATION #
  1708. FWDZ;
  1709. END
  1710. POP;
  1711.  
  1712. CONTROL IFEQ SINGLE,1;
  1713. FILNUM = 0; # INDICATE FILE ACCESS NEEDED #
  1714. CONTROL FI;
  1715. CONTROL IFEQ MULTI,1;
  1716. GOTO QQSINGLE; # EXIT TO SINGLE-USER EDITOR #
  1717. CONTROL FI;
  1718.  
  1719. IOEND # OF ACCESSFILE #
  1720.  
  1721.  
  1722. PROC CLOSEFILE;
  1723. IOBEGIN(CLOSEFILE)
  1724. #
  1725. ** CLOSEFILE - SAVE CURRENT FILE STATUS IN DESCRIPTOR LINE.
  1726. *
  1727. * ENTRY FILNUM - BRACKET TO CLOSE.
  1728. * ALL BRACKET STRUCTURES CONTAIN VALID STATUS.
  1729. *
  1730. * EXIT FILE DESCRIPTOR LINE UPDATED INTO FILE DIRECTORY.
  1731. *
  1732. * CALLS PUSH, POP, POSZ, REPY, FORMFDL.
  1733. *
  1734. * NOTE IF BOTH BRACKETS OPEN TO SAME FILE, CERTAIN
  1735. * ATTRIBUTES MUST BE MERGED.
  1736. #
  1737. PUSH;
  1738. POSZ(FDLF(FILNUM));
  1739. IF FDLF(1) EQ FDLF(2) THEN
  1740. BEGIN
  1741. INITFILE[1]=INITFILE[1] LOR INITFILE[2];
  1742. LOCKED[1]=LOCKED[1] LOR LOCKED[2];
  1743. CHANGED[1]=CHANGED[1] LOR CHANGED[2];
  1744. INITFILE[2]=INITFILE[1];
  1745. LOCKED[2]=LOCKED[1];
  1746. CHANGED[2]=CHANGED[1];
  1747. END
  1748. FORMFDL(FILNUM);
  1749. REPY;
  1750. PUSHTEMP;
  1751. IF FILENAM[FILNUM] NQ "ZZZNULL" THEN
  1752. BEGIN
  1753. FOR TEMP=2 STEP 1 UNTIL 4 DO
  1754. BEGIN
  1755. NONTRIVFILE[FILNUM,TEMP]=NONTRIVFILE[FILNUM,TEMP-1];
  1756. END
  1757. NONTRIVFILE[FILNUM,1]=FDLF(FILNUM);
  1758. END
  1759. ELSE
  1760. BEGIN
  1761. FOR TEMP=1 STEP 1 UNTIL 4 DO
  1762. BEGIN
  1763. IF NONTRIVFILE[1,TEMP] EQ FDLF(FILNUM)
  1764. THEN NONTRIVFILE[1,TEMP]=0;
  1765. IF NONTRIVFILE[2,TEMP] EQ FDLF(FILNUM)
  1766. THEN NONTRIVFILE[2,TEMP]=0;
  1767. END
  1768. END
  1769. POPTEMP;
  1770. POP;
  1771.  
  1772. IOEND # OF CLOSEFILE #
  1773. PAGE # MISC IO ROUTINES #
  1774.  
  1775.  
  1776. PROC GETCMD;
  1777. IOBEGIN(GETCMD)
  1778. #
  1779. ** GETCMD - READ COMMAND STRING FROM TERMINAL.
  1780. *
  1781. * EXIT CMDLIN - TERMINAL INPUT LINE, CONVERTED TO
  1782. * INTERNAL CHARSET FROM 6/12 ASCII.
  1783. *
  1784. * CALLS PROMPT, CONVIN.
  1785. *
  1786. * NOTE SHOULD BE USED ONLY IN LINE-EDITING.
  1787. #
  1788. PROMPT(QCCKWRD);
  1789. CONVIN(CMDLIN,2);
  1790. IOEND # OF GETCMD #
  1791.  
  1792.  
  1793. PROC PROMPT(STR);
  1794. IOBEGIN(PROMPT)
  1795. #
  1796. ** PROMPT - ISSUE PROMPT TO TERMINAL AND INPUT LINE.
  1797. *
  1798. * ENTRY STR - PROMPT STRING, 6/12 ASCII CHARSET.
  1799. *
  1800. * EXIT TMPLIN - INPUT FROM TERMINAL.
  1801. *
  1802. * CALLS TTLIN, TTSYNC, VDTRDC, VDTDRN$.
  1803. *
  1804. * NOTE SHOULD BE USED ONLY IN LINE-EDITING.
  1805. #
  1806. ITEM STR C(10);
  1807. CONTROL IFEQ SINGLE,1;
  1808. IF INTERACT THEN TTLIN(STR);
  1809. ELSE TTLIN(NULLWRD);
  1810. CONTROL FI;
  1811. CONTROL IFEQ MULTI,1;
  1812. TTLIN(STR);
  1813. CONTROL FI;
  1814. TTSYNC;
  1815. VDTRDC(TMPLIN,BUFWID2P1);
  1816. IOEND # OF PROMPT #
  1817.  
  1818.  
  1819. PROC DOJOIN(SETJUMP);
  1820. IOBEGIN(DOJOIN)
  1821. #
  1822. ** DOJOIN - MERGE TWO ADJACENT WORKFILE LINES.
  1823. *
  1824. * ENTRY CURRENT - POINTS AT FIRST WORKFILE LINE.
  1825. * CHRPTR3 - CHARACTER POSITION TO MERGE AT.
  1826. * SETJUMP - IF NONZERO, REMOVE LEADING SPACES ON SECOND
  1827. * LINE TO BE JOINED IF AUTOINDENTING.
  1828. * NUMBERED[CURFILE] - INDICATES SEQUENCE MODE.
  1829. *
  1830. * EXIT LIN - COPY OF WHAT IS MERGED IN FILE.
  1831. *
  1832. * MACROS GETCHAR, SETCHAR.
  1833. *
  1834. * CALLS BAKZ, CONCAT, COPYLIN, DELX, EXTENDC, FWDZ, LSHIFT,
  1835. * POP, POPTEMP, PUSH, PUSHTEMP, REPX, TRIMPAD.
  1836. *
  1837. * USES TTYLIN.
  1838. #
  1839. ITEM SETJUMP;
  1840. ITEM TMP1, TMP2; # USE INSTANTLY #
  1841.  
  1842. IF CURRENT LS BOTF(CURFILE)-1 THEN # CAN DO IT #
  1843. BEGIN
  1844. PUSHTEMP;
  1845. IF AUTOINDENT THEN TEMP = SETJUMP; ELSE TEMP = 0;
  1846. # END OF NON-REENTRANT PARAMETER USAGE #
  1847. FWDZ; # READ SECOND HALF #
  1848. IF EDITFIELD LS LENGTH(LIN) THEN
  1849. BEGIN
  1850. SETCHAR(LINE,EDITFIELD,CENDLINE); # KILL PROTECTED #
  1851. TRIMPAD;
  1852. END
  1853. TMP1 = 0;
  1854. IF TEMP NQ 0 THEN
  1855. BEGIN # IF HONORING *SET JUMP YES* #
  1856. GETCHAR(LINE,TMP1,TMP2);
  1857. WHYLE TMP2 EQ CBLANK DO # COUNT LEADING BLANKS #
  1858. BEGIN
  1859. TMP1 = TMP1 + 1;
  1860. GETCHAR(LINE,TMP1,TMP2);
  1861. END
  1862. TMP1 = MAX(0,TMP1-1);
  1863. TEMP = 1;
  1864. END
  1865. IF NUMBERED[CURFILE] NQ 0 THEN TMP1 = TMP1 + NUMWIDBLK;
  1866. IF TMP1 GR 0 THEN LSHIFT(LIN,TMP1,TMP1);
  1867. IF NUMMARKS GR 0 THEN
  1868. BEGIN # IF MARKS ACTIVE #
  1869. IF REGLINE[MARKREG] EQ CURRENT THEN
  1870. BEGIN # IF FIRST MARKED LINE #
  1871. IF MRKCHAR[0] GQ 0 THEN
  1872. BEGIN # IF MARK WORD ACTIVE #
  1873. TEMP = TEMP LOR 2;
  1874. MRKCHAR[0] = MAX(0, MRKCHAR[0]-TMP1);
  1875. END
  1876. END
  1877. IF REGLINE[MARKREG+1] EQ CURRENT THEN
  1878. BEGIN # IF LAST MARKED LINE #
  1879. IF MRKCHAR[1] GQ 0 THEN
  1880. BEGIN # IF MARK WORD ACTIVE #
  1881. TEMP = TEMP LOR 4;
  1882. MRKCHAR[1] = MAX(-1, MRKCHAR[1]-TMP1);
  1883. END
  1884. END
  1885. END
  1886. COPYLIN(LIN,TTYLIN);
  1887. BAKZ; # REPOSITION AND READ LIN #
  1888. IF EDITFIELD LS LENGTH(LIN) THEN
  1889. BEGIN
  1890. SETCHAR(LINE,EDITFIELD,CENDLINE); # KILL PROTECTED #
  1891. TRIMPAD;
  1892. END
  1893. IF CHRPTR3 GQ LENGTH(LIN) THEN
  1894. BEGIN # IF CURSOR IS BEYOND END OF LINE #
  1895. IF TEMP LAN 1 NQ 0 THEN
  1896. BEGIN # IF HONORING *SET JUMP YES* #
  1897. GETCHAR(TTYLINE,0,TMP2); # CHECK FOR LEADING BLANK #
  1898. IF TMP2 EQ CBLANK THEN
  1899. BEGIN # IF THERE IS A LEADING BLANK #
  1900. LSHIFT(TTYLIN,1,1);
  1901. IF TEMP LAN 2 NQ 0 AND MRKCHAR[0] GR 0 THEN
  1902. MRKCHAR[0] = MRKCHAR[0] - 1;
  1903. IF TEMP LAN 4 NQ 0 AND MRKCHAR[1] GQ 0 THEN
  1904. MRKCHAR[1] = MRKCHAR[1] - 1;
  1905. END
  1906. END
  1907. EXTENDC(LIN,CHRPTR3-1); # LENGTHEN TO CURSOR POSITION #
  1908. END
  1909. IF TEMP LAN 2 NQ 0 THEN
  1910. BEGIN # IF FIRST MARK ADJUSTMENT #
  1911. REGLINE[MARKREG] = CURRENT;
  1912. MRKCHAR[0] = MRKCHAR[0] + LENGTH(LIN);
  1913. END
  1914. IF TEMP LAN 4 NQ 0 THEN
  1915. BEGIN # IF LAST MARK ADJUSTMENT #
  1916. REGLINE[MARKREG+1] = CURRENT;
  1917. MRKCHAR[1] = MRKCHAR[1] + LENGTH(LIN);
  1918. IF MRKCHAR[1] LS 0 THEN
  1919. BEGIN # IF NO PLACE TO PUT MARK #
  1920. MRKCHAR[1] = 0;
  1921. RSHIFT(TTYLIN,0,1);
  1922. SETCHAR(TTYLINE,0,CBLANK);
  1923. END
  1924. END
  1925. CONCAT(LIN,TTYLIN);
  1926. SETCHAR(LINE,EDITFIELD,CENDLINE); # CLEAR END OF LINE #
  1927. TRIMPAD;
  1928. REPX; # STORE CONCATENATED LINES #
  1929. PUSH;
  1930. FWDZ; # DELETE SECOND HALF #
  1931. DELX;
  1932. POP; # LEAVE POSITION AT JOINED #
  1933. POPTEMP;
  1934. END
  1935. IOEND # OF DOJOIN #
  1936.  
  1937.  
  1938. PROC DOSPLIT(TRUNCATE);
  1939. IOBEGIN(DOSPLIT)
  1940. #
  1941. ** DOSPLIT - SPLIT A WORKFILE LINE INTO TWO.
  1942. *
  1943. * ENTRY LIN - THE LINE TO SPLIT.
  1944. * TRUNCATE - IF 1, TRIM TRAILING BLANKS FROM BOTH LINES.
  1945. * IF 2, TRIM TRAILING BLANKS FROM BOTH LINES,
  1946. * AND ADD LEADING BLANKS TO SECOND LINE
  1947. * TO MATCH FIRST LINE IF AUTOINDENTING.
  1948. * CURRENT - FILE POSITION.
  1949. * CHRPTR3 - CHARACTER POSITION.
  1950. * NUMBERED[CURFILE] - INDICATES SEQUENCE MODE.
  1951. *
  1952. * EXIT LIN, CURRENT - UPDATED.
  1953. * WORKFILE CHANGED.
  1954. *
  1955. * MACROS GETCHAR, SETCHAR.
  1956. *
  1957. * CALLS COPYLIN, INSX, POPTEMP, PUSHTEMP,
  1958. * REPX, RSHIFT, TRIMPAD.
  1959. *
  1960. * USES TTYLIN.
  1961. #
  1962. ITEM TRUNCATE;
  1963. ITEM TMP1, TMP2; # USE INSTANTLY #
  1964.  
  1965. PUSHTEMP;
  1966. TEMP=TRUNCATE;
  1967. # END OF NON-REENTRANT PARAMETER USAGE #
  1968. TTYLINE[0]=NULLIN; # DEFAULT NEW LINE #
  1969. IF EDITFIELD LS LENGTH(LIN) THEN
  1970. BEGIN
  1971. SETCHAR(LINE,EDITFIELD,CENDLINE); # KILL PROTECTED #
  1972. TRIMPAD;
  1973. END
  1974. FOR TMP1=CHRPTR3 STEP 1 UNTIL LENGTH(LIN) DO
  1975. BEGIN # COPY SECOND HALF #
  1976. GETCHAR(LINE,TMP1,TMP2);
  1977. SETCHAR(TTYLINE,TMP1-CHRPTR3,TMP2);
  1978. END
  1979. SETCHAR(LINE,CHRPTR3,CENDLINE);
  1980. IF TEMP GR 0 THEN TRIMPAD;
  1981. REPX; # STORE FIRST HALF #
  1982. TMP1 = 0;
  1983. IF AUTOINDENT AND TEMP EQ 2 THEN
  1984. BEGIN # IF HONORING *SET JUMP YES* #
  1985. GETCHAR(LINE,TMP1,TMP2);
  1986. WHYLE TMP2 EQ CBLANK DO # COUNT LEADING BLANKS #
  1987. BEGIN
  1988. TMP1 = TMP1 + 1;
  1989. GETCHAR(LINE,TMP1,TMP2);
  1990. END
  1991. END
  1992. COPYLIN(TTYLIN,LIN);
  1993. IF NUMBERED[CURFILE] NQ 0 THEN TMP1 = TMP1 + NUMWIDBLK;
  1994. IF TMP1 GR 0 THEN
  1995. BEGIN # IF LEADING BLANKS REQUIRED #
  1996. RSHIFT(LIN,0,TMP1);
  1997. FOR TMP2=0 STEP 1 UNTIL TMP1-1 DO SETCHAR(LINE,TMP2,CBLANK);
  1998. END
  1999. IF TEMP GR 0 THEN TRIMPAD;
  2000. IF NUMMARKS EQ 0
  2001. THEN INSX; # IF NO MARKS ACTIVE #
  2002. ELSE
  2003. BEGIN # IF MARKS ACTIVE #
  2004. TEMP = TMP1;
  2005. INSX;
  2006. IF REGLINE[MARKREG] EQ CURRENT-1 THEN
  2007. BEGIN # IF SPLIT OF FIRST MARKED LINE #
  2008. IF MRKCHAR[0] GQ CHRPTR3 THEN
  2009. BEGIN # IF SPLIT LEFT OF FIRST MARK #
  2010. REGLINE[MARKREG] = CURRENT;
  2011. MRKCHAR[0] = MRKCHAR[0] - CHRPTR3 + TEMP;
  2012. END
  2013. END
  2014. IF REGLINE[MARKREG+1] EQ CURRENT-1 THEN
  2015. BEGIN # IF SPLIT OF LAST MARKED LINE #
  2016. IF MRKCHAR[1] LS 0 THEN REGLINE[MARKREG+1] = CURRENT;
  2017. ELSE IF MRKCHAR[1] GQ CHRPTR3 THEN
  2018. BEGIN # IF SPLIT LEFT OF LAST MARK #
  2019. REGLINE[MARKREG+1] = CURRENT;
  2020. MRKCHAR[1] = MRKCHAR[1] - CHRPTR3 + TEMP;
  2021. END
  2022. END
  2023. END
  2024. POPTEMP;
  2025.  
  2026. IOEND # OF DOSPLIT #
  2027. PAGE # KEYWORD MATCHER #
  2028.  
  2029.  
  2030. PROC MATCHKEY(PARM);
  2031. BEGIN
  2032. #
  2033. * MATCHKEY - MATCH KEYWORD BY ABBREVIATION RULES.
  2034. *
  2035. * MATCHKEY MATCHES THE KEYWORD IN TOKENSYM AGAINST THE
  2036. * KEYWORD TABLE, FOR A SPECIFIED SECTION OF THE TABLE,
  2037. * AND HONORING THE ABBREVIATION RULES OF ALL CHARACTERS,
  2038. * THREE CHARACTERS, OR ONE CHARACTER.
  2039. *
  2040. * ENTRY KEYWDTYPE - WHICH SECTION OF TABLE TO SEARCH.
  2041. * TOKENSYM - KEYWORD TO MATCH.
  2042. * TOKENLEN - LENGTH OF KEYWORD.
  2043. *
  2044. * EXIT PARM - LENGTH OF ACCEPTED ABBREVIATION.
  2045. * KEYWDNDX - WHERE MATCHED IN TABLE.
  2046. #
  2047. ITEM PARM;
  2048. ITEM TMP1;
  2049.  
  2050. FOR PARM=TOKENLEN STEP -1 UNTIL 4 DO
  2051. BEGIN
  2052. FOR TMP1=FIRSTKEYWD[KEYWDTYPE] STEP 1
  2053. UNTIL LASTKEYWD[KEYWDTYPE] DO
  2054. BEGIN
  2055. IF C&lt;0,PARM>TOKENSYM EQ KEYWORD[TMP1] THEN GOTO KEYFOUND;
  2056. END
  2057. END
  2058.  
  2059. PARM=3;
  2060. FOR TMP1=FIRSTKEYWD[KEYWDTYPE] STEP 1
  2061. UNTIL LASTKEYWD[KEYWDTYPE] DO
  2062. BEGIN
  2063. IF C&lt;0,3>TOKENSYM EQ C&lt;0,3>KEYWORD[TMP1] THEN GOTO KEYFOUND;
  2064. END
  2065.  
  2066. PARM=2;
  2067. FOR TMP1=FIRSTKEYWD[KEYWDTYPE] STEP 1
  2068. UNTIL LASTKEYWD[KEYWDTYPE] DO
  2069. BEGIN
  2070. IF C&lt;0,2>TOKENSYM EQ C&lt;0,2>KEYWORD[TMP1]
  2071. AND C&lt;2,1>KEYWORD[TMP1] EQ " " THEN GOTO KEYFOUND;
  2072. END
  2073.  
  2074. PARM=1;
  2075. FOR TMP1=FIRSTKEYWD[KEYWDTYPE] STEP 1
  2076. UNTIL LASTKEYWD[KEYWDTYPE] DO
  2077. BEGIN
  2078. IF C&lt;0,1>TOKENSYM EQ C&lt;0,1>KEYWORD[TMP1] THEN GOTO KEYFOUND;
  2079. END
  2080.  
  2081. RETURN;
  2082.  
  2083. KEYFOUND:
  2084. KEYWDNDX=TMP1;
  2085.  
  2086. END # OF MATCHKEY #
  2087.  
  2088.  
  2089. END TERM
cdc/nos2.source/opl871/fsesubs.txt · Last modified: 2023/08/05 17:24 by Site Administrator