Table of Contents

FSECMDS

Table Of Contents

  • [00006] - SUPPLEMENTARY COMMANDS.
  • [00112] XFRCMOUT - OUTWARD LINE TRANSFER FOR COPY/MOVE.
  • [00147] XFRCMIN - INWARD TRANSFER FOR COPY/MOVE.
  • [00165] TTCHAR - OUTPUT INTERNAL CHARACTER TO TERMINAL.
  • [00228] UNDODECODE - DECODE AN AUDIT TRAIL DESCRIPTOR.
  • [00253] UNDOPOS - POSITION TO AUDITED DATA LINE.
  • [00279] UNDOOPEN - GET FILE IMAGE INTO ACTIVE BRACKET.
  • [00307] DOFILL - MAIN ALGORITHM FOR PARAGRAPH FORMATTING.
  • [00627] SNGLMOV - COMMAND PROCESSOR FOR COPY AND MOVE.
  • [00834] HELPCMD - COMMAND PROCESSOR FOR HELP FACILITY.
  • [00960] GETSTATUS - COMMAND PROCESSOR FOR GET STATUS SUBCOMMAND.
  • [01156] UNDOCMD - COMMAND PROCESSOR FOR UNDO FACILITY.
  • [01259] WORDCMD - COMMAND PROCESSOR FOR WORD PROCESSING.

Source Code

FSECMDS.txt
  1. PROC FSECMDS;
  2. BEGIN
  3.  
  4.  
  5. #
  6. *** FSECMDS -- SUPPLEMENTARY COMMANDS.
  7. *
  8. * COPYRIGHT CONTROL DATA SYSTEMS INC. 1992.
  9. *
  10. * FSECMDS CONTAINS CODE WHICH NORMALLY WOULD BE PART OF THE
  11. * LARGE "PROCESS" CASE STATEMENT, BUT WHICH WE HAVE MOVED
  12. * OUT TO CONSERVE FIELD LENGTH MOST OF THE TIME. CODE IN
  13. * FSECMDS IS A CANDIDATE FOR ANY OVERLAY STRUCTURING THAT MAY
  14. * BE PROVIDED IN THE FUTURE. CODE IN FSECMDS MUST BE STRICTLY
  15. * FOR THE SINGLE-USER VERSION ONLY. REENTRANT PROGRAMMING
  16. * IS NOT USED IN THIS MODULE.
  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. # COMMON, DATA #
  29.  
  30.  
  31. *CALL COMFDS1
  32. *CALL COMFVD2
  33. *CALL COMFDS2
  34.  
  35.  
  36. # COMMAND/SYNTAX TABLES #
  37.  
  38.  
  39. *CALL COMFTAB
  40.  
  41.  
  42. # EXTERNALS #
  43.  
  44.  
  45. XDEF
  46. BEGIN
  47. *CALL COMFXCM
  48. END
  49.  
  50.  
  51. XREF
  52. BEGIN
  53. *CALL COMFXFL
  54. *CALL COMFXSC
  55. *CALL COMFXED
  56. *CALL COMFXSB
  57. *CALL COMFXTI
  58. *CALL COMFXFO
  59. *CALL COMFXWK
  60. END
  61.  
  62. XREF # SYMPLIB SUPPORT #
  63. BEGIN
  64. PROC REWIND;
  65. PROC WRITER;
  66. PROC READ;
  67. PROC RETERN;
  68. PROC RECALL;
  69. PROC PF;
  70. PROC WRITEC;
  71. PROC READC;
  72. PROC SKIPEI;
  73. PROC BKSP;
  74. END
  75.  
  76. XREF # FSELIB #
  77. BEGIN
  78. FUNC FIXCTL B;
  79. FUNC LENGTH;
  80. PROC FLDLEN;
  81. END
  82.  
  83. XREF # VIRTERM #
  84. BEGIN
  85. PROC VDTCHR;
  86. END
  87.  
  88. XREF # BUFFER MAPPING #
  89. BEGIN
  90. ARRAY WORKBUF;;
  91. ARRAY BUILDBF;;
  92. ITEM MAXADDR;
  93. END
  94. PAGE # DATA LOCAL TO OVERLAY #
  95.  
  96.  
  97. ITEM RESULT,NWORDS, TMP1, INDEX, KILLUPLOW B, ZERO=0;
  98. ITEM SAVBLANKS, SAVLINENO;
  99.  
  100. ARRAY STATUSMSGS [0:3] P(2);
  101. BEGIN
  102. ITEM YESORNO C(0,0,7)=[" NO ", " YES ", " ", " "];
  103. ITEM CHARTYPE C(1,0,7)=["DISPLAY", "DISPLAY", " ASCII ",
  104. " 8/12 "];
  105. END
  106. PAGE # USEFUL LITTLE ROUTINES #
  107.  
  108.  
  109. PROC XFRCMOUT;
  110. BEGIN
  111. #
  112. ** XFRCMOUT - OUTWARD LINE TRANSFER FOR COPY/MOVE.
  113. *
  114. * ENTRY LIN - INTERNAL LINE IMAGE.
  115. * FORCEFIELD, CHARRANGE - MODE SETTINGS.
  116. * CHRPTR1, CHRPTR2, FIRSTRANGE, LASTRANGE - DITTO.
  117. * MOVEFET - FET FOR SCRATCH FILE.
  118. *
  119. * EXIT IMAGE WRITTEN TO SCRATCH IN 6/12 CHARSET.
  120. *
  121. * MACROS SETCHAR.
  122. *
  123. * CALLS LSHIFT, CONVOUT, POSZ, WRITEC.
  124. #
  125. IF FORCEFIELD THEN
  126. BEGIN
  127. SETCHAR(LINE,CHRPTR2+1,CENDLINE);
  128. LSHIFT(LIN,CHRPTR1,CHRPTR1);
  129. CONVOUT(LIN,4);
  130. POSZ(CURRENT); # RE-FRESH LINE BUFFER #
  131. END
  132. ELSE IF CHARRANGE THEN
  133. BEGIN # TRUNCATE LAST, SHIFT FIRST #
  134. IF LASTRANGE THEN SETCHAR(LINE,CHRPTR2+1,CENDLINE);
  135. IF FIRSTRANGE THEN LSHIFT(LIN,CHRPTR1,CHRPTR1);
  136. CONVOUT(LIN,4);
  137. POSZ(CURRENT); # RE-FRESH LINE BUFFER #
  138. END
  139. ELSE CONVOUT(LIN,4);
  140. WRITEC(MOVEFET,TMPLIN);
  141. END # OF XFRCMOUT #
  142.  
  143.  
  144. PROC XFRCMIN;
  145. BEGIN
  146. #
  147. ** XFRCMIN - INWARD TRANSFER FOR COPY/MOVE.
  148. *
  149. * ENTRY MOVEFET - SCRATCH FILE FET.
  150. *
  151. * EXIT LIN - LINE IMAGE, INTERNAL CHARSET FROM 6/12.
  152. *
  153. * CALLS READC, CONVIN.
  154. #
  155. ITEM TMP1;
  156. READC(MOVEFET,TMPLIN,BUFWID2P1,TMP1);
  157. IF TMP1 NQ 0 THEN FATAL(" TRANSFER TO THE BUFFER IS INCOMPLETE.$");
  158. CONVIN(LIN,2);
  159. END # OF XFRCMIN #
  160.  
  161.  
  162. PROC TTCHAR(CHAR,SYMBOL);
  163. BEGIN
  164. #
  165. ** TTCHAR - OUTPUT INTERNAL CHARACTER TO TERMINAL.
  166. *
  167. * TTCHAR OUTPUTS A SINGLE CHARACTER, USING SYMBOLIC KEYWORDS
  168. * FOR (BLANK) AND (NONE) IF REQUESTED. NOTE THAT SINCE THE
  169. * TERMINAL IS DRIVEN IN 6/12 WHILE IN LINE MODE SPECIAL
  170. * TRANSLATION MAY BE NEEDED.
  171. *
  172. * ENTRY CHAR = THE CHARACTER (INTERNAL CSET).
  173. * SYMBOL = USE SYMBOLIC NOTATION (TRUE/FALSE).
  174. *
  175. * CALLS TTST, TTSTR, VDTCHR.
  176. #
  177. ITEM CHAR I; # CHARACTER, AS INTEGER #
  178. ITEM SYMBOL B; # SYMBOLIC FLAG (TRUE/FALSE) #
  179.  
  180. ITEM TMP1 I; # TEMPORARY #
  181.  
  182. IF CHAR EQ CNOTHING THEN
  183. BEGIN # IF NO CHARACTER #
  184. IF SYMBOL THEN TTSTR("(NONE)$"); # IF SYMBOLIC REQUESTED #
  185. END
  186. ELSE
  187. BEGIN # IF CHARACTER OR BLANK #
  188. IF SYMBOL AND CHAR EQ CBLANK THEN TTSTR("(BLANK)$"); # IF SYMBOL #
  189. ELSE
  190. BEGIN # IF CHARACTER OR NORMAL BLANK #
  191. IF SCREENMODE THEN
  192. BEGIN # IF SCREEN MODE #
  193. TMP1 = XLTINTXP[CHAR]; # TRANSLATE, OUTPUT #
  194. VDTCHR(TMP1);
  195. END
  196. ELSE
  197. BEGIN # LINE MODE #
  198. TMP1=XLTINTDSP[CHAR]; # TRANSLATE TO DISPLAY #
  199. IF CHAR EQ CATSIGN OR CHAR EQ CUPARROW OR CHAR EQ CGRAVE THEN
  200. BEGIN # IF 74XX TRANSLATION NEEDED #
  201. TTCHR(O"74"); # OUTPUT ESCAPE CHARACTER #
  202. TMP1 = O"01"; # ASSUME AT SIGN #
  203. IF CHAR EQ CUPARROW THEN TMP1 = O"02";
  204. IF CHAR EQ CGRAVE THEN TMP1 = O"07";
  205. END
  206. ELSE
  207. BEGIN # NOT 74XX #
  208. IF CHAR EQ CLEFTCURL OR CHAR EQ CVERTICAL OR
  209. CHAR EQ CRITECURL OR CHAR EQ CTILDE THEN
  210. BEGIN # IF 76XX TRANSLATION NEEDED #
  211. TTCHR(O"76"); # OUTPUT ESCAPE CHARACTER #
  212. TMP1 = O"33"; # ASSUME LEFT BRACE #
  213. IF CHAR EQ CVERTICAL THEN TMP1 = O"34";
  214. IF CHAR EQ CRITECURL THEN TMP1 = O"35";
  215. IF CHAR EQ CTILDE THEN TMP1 = O"36";
  216. END
  217. END
  218. TTCHR(TMP1); # OUTPUT (REST OF) CHARACTER #
  219. END
  220. END
  221. END
  222. END # TTCHAR #
  223.  
  224.  
  225. PROC UNDODECODE(POS,NUM);
  226. BEGIN
  227. #
  228. ** UNDODECODE - DECODE AN AUDIT TRAIL DESCRIPTOR.
  229. *
  230. * ENTRY POS - CHARACTER POSITION OF FIELD.
  231. * LIN - CONTAINS DESCRIPTOR.
  232. *
  233. * EXIT NUM - VALUE DECODED FROM FIELD.
  234. *
  235. * MACROS GETCHAR.
  236. #
  237. ITEM POS, NUM, TMP1, TMP2;
  238. NUM=0;
  239. TMP2=POS;
  240. GETCHAR(LINE,TMP2,TMP1);
  241. WHYLE TMP1 GQ CDIGIT0 AND TMP1 LQ CDIGIT9 DO
  242. BEGIN
  243. NUM=NUM*10+TMP1-CDIGIT0;
  244. TMP2=TMP2+1;
  245. GETCHAR(LINE,TMP2,TMP1);
  246. END
  247. END # OF UNDODECODE #
  248.  
  249.  
  250. PROC UNDOPOS(OFFSET);
  251. BEGIN
  252. #
  253. ** UNDOPOS - POSITION TO AUDITED DATA LINE.
  254. *
  255. * ENTRY OFFSET - DIFFERENCE BETWEEN LINNUM3 AND TARGET.
  256. * LINNUM1 - FILE BRACKET NUMBER.
  257. * LINNUM3 - LINE ORDINAL IN FILE BRACKET.
  258. *
  259. * EXIT CURFILE - EQUALS LINNUM1.
  260. * CURRENT - ABSOLUTE LINE ADDRESS.
  261. * LIN - THE TEXT OF THE LINE.
  262. * CURF(CURFILE) - EQUAL TO CURRENT.
  263. * P<LINEBUF> - POINTS TO LIN.
  264. *
  265. * CALLS POSZ.
  266. #
  267. ITEM OFFSET;
  268. P&lt;LINEBUF>=0; # POSITION INVISIBLY #
  269. POSZ(TOPF(LINNUM1)+LINNUM3+OFFSET);
  270. P&lt;LINEBUF>=LOC(LIN); # RESTORE #
  271. CURFILE=LINNUM1; # REMEMBER WHERE WE ARE #
  272. CURF(CURFILE)=CURRENT;
  273. END # OF UNDOPOS #
  274.  
  275.  
  276. PROC UNDOOPEN(BRACKET,DIRECTORY);
  277. BEGIN
  278. #
  279. ** UNDOOPEN - GET FILE IMAGE INTO ACTIVE BRACKET.
  280. *
  281. * ENTRY BRACKET - DESIRED BRACKET NUMBER.
  282. * DIRECTORY - WORKFILE ADDRESS OF FILE DIRECTORY LINE.
  283. *
  284. * EXIT FILE IS OPENED IN BRACKET.
  285. * THIS AFFECTS TOPF(), BOTF(), ETC.
  286. *
  287. * CALLS PUSH, POSZ, SCANFDL, OPENFILE, POP.
  288. *
  289. * USES READNAM, FILNUM, CHARPARM, GETPARM.
  290. #
  291. ITEM BRACKET, DIRECTORY;
  292. IF DIRECTORY EQ 0 OR DIRECTORY EQ FDLF(BRACKET) THEN RETURN;
  293. PUSH;
  294. POSZ(DIRECTORY);
  295. SCANFDL(READNAM);
  296. FILNUM=BRACKET;
  297. CHARPARM=0;
  298. GETPARM=0;
  299. OPENFILE;
  300. POP;
  301. END # OF UNDOOPEN #
  302.  
  303.  
  304. PROC DOFILL;
  305. BEGIN
  306. #
  307. ** DOFILL - MAIN ALGORITHM FOR PARAGRAPH FORMATTING.
  308. *
  309. * DOFILL IS THE MAIN PROCESSING ALGORITHM FOR THE WORD-
  310. * PROCESSING COMMAND, ".FILL". THE UNIVERSAL SYNTAX
  311. * SCANNER MUST BE CALLED BEFORE BEFORE DOFILL. DOFILL
  312. * ACCEPTS EXPLICIT RANGE BOUNDARIES, OR COMPUTE AN IMPLICIT
  313. * RANGE AS THE PARAGRAPH SURROUNDING ONE TARGET LINE.
  314. * MARGINS MAY BE COLUMN 1 THRU THE WIDTH SETTING, OR A
  315. * TAB FIELD.
  316. *
  317. * ENTRY SCANNER HAS BEEN CALLED.
  318. * LINPTR1 - FIRST LINE OF RANGE IF RANGE EXPLICIT.
  319. * ANY ADDRESS WITHIN PARAGRAPH FOR IMPLICIT.
  320. * LINPTR2 - LAST LINE OF RANGE IF RANGE EXPLICIT.
  321. * LIMIT - RANGE LENGTH LIMIT IF RANGE EXPLICIT.
  322. * NONDEFAULT - TELLS RANGE IMPLICIT OR EXPLICIT.
  323. * FILLLEFT, FILLRIGHT - DEFAULT MARGIN OBJECTIVES.
  324. * FILLFIRST - DEFAULT MARGIN OBJECTIVES.
  325. * CURFILE - WHICH FILE BRACKET.
  326. * NUMBERED[CURFILE] - REQUIRED TO BE FALSE.
  327. * TOPF(CURFILE), BOTF(CURFILE) - FILE BOUNDS.
  328. * SCREENMODE - CONTROLS FINAL POSITIONING/PRINTING.
  329. *
  330. * EXIT LINPTR1, LINPTR2, LIMIT - POSSIBLY DESTROYED.
  331. * CURRENT - FRONT OF RESULTANT RANGE IF SCREEN,
  332. * ELSE END OF RESULTANT RANGE.
  333. * LIN - TEXT OF CURRENT LINE.
  334. * BOTF(CURFILE) - POSSIBLY RELOCATED.
  335. *
  336. * MACROS GETCHAR, SETCHAR.
  337. *
  338. * CALLS TABFN, MIN, MAX, POSZ, LENGTH, BAKZ, FWDZ, TRIMPAD,
  339. * REPX, LSHIFT, RSHIFT, DOSPLIT, COPYLIN, DORANGE.
  340. *
  341. * USES TTYLIN.
  342. #
  343. ITEM FILLLOOP; # USED FOR LOOP TESTING #
  344. ITEM LMARGIN, RMARGIN;
  345. ITEM TMP1, TMP2, TMP3, TMP4, TMP5, TMP6;
  346. ITEM LEFTRIGHT B;
  347.  
  348. # PROCESS A PARAGRAPH OF WORDS OF TEXT CENTERED AROUND #
  349. # THE CURRENT LINE (LINPTR1 INITIALLY). WE LOOK BACK #
  350. # AND FORWARDS FOR BOUNDARIES, THEN PROCESS THE BLOCK #
  351. # MERGING WORDS ONTO LINES TO MATCH "SET WIDTH". #
  352.  
  353. IF NUMBERED[CURFILE] NQ 0 THEN
  354. BEGIN
  355. ERRJUMP("FILE MUST NOT CONTAIN SEQUENCE NUMBERS$");
  356. END
  357.  
  358. LMARGIN=FILLFIRST;
  359. RMARGIN=FILLRIGHT;
  360. LEFTRIGHT = FALSE;
  361.  
  362. IF NONDEFAULT THEN # USE LINPTR1, LINPTR2 #
  363. BEGIN
  364. REGLINE[RNGTOPREG]=LINPTR1-1;
  365. REGLINE[RNGBOTREG]=MIN(LINPTR2+1,LINPTR1+LIMIT);
  366. END
  367. ELSE # SEARCH FOR PARAGRAPH #
  368. BEGIN
  369. POSZ(LINPTR1);
  370. IF NOTEXT THEN RETURN; # NO TEXT ON THIS LINE #
  371. WHYLE CURRENT GR TOPF(CURFILE) AND NOT NOTEXT DO
  372. BEGIN # LOOK BACK FOR BLANK #
  373. BAKZ;
  374. IF USRBRK NQ 0 THEN RETURN;
  375. END
  376. REGLINE[RNGTOPREG]=CURRENT;
  377. POSZ(LINPTR1);
  378. WHYLE CURRENT LS BOTF(CURFILE) AND NOT NOTEXT DO
  379. BEGIN # LOOK FORWARDS FOR BLANK #
  380. FWDZ;
  381. IF USRBRK NQ 0 THEN RETURN;
  382. END
  383. REGLINE[RNGBOTREG]=CURRENT;
  384. END
  385.  
  386. POSZ(REGLINE[RNGTOPREG]+1);
  387. FOR FILLLOOP=FILLLOOP WHILE CURRENT LS REGLINE[RNGBOTREG]
  388. AND CURRENT GR REGLINE[RNGTOPREG] AND USRBRK EQ 0 DO
  389. BEGIN
  390.  
  391. IF CURRENT GR REGLINE[RNGTOPREG]+1 THEN
  392. BEGIN # LOOK BACK FOR START PARA #
  393. BAKZ;
  394. IF NOTEXT THEN LMARGIN=FILLFIRST;
  395. ELSE LMARGIN=FILLLEFT;
  396. FWDZ;
  397. END
  398.  
  399. IF LENGTH(LIN) GR EDITFIELD THEN # KILL PROTECTED #
  400. BEGIN
  401. SETCHAR(LINE,EDITFIELD,CENDLINE);
  402. TRIMPAD;
  403. REPX;
  404. END
  405.  
  406. IF LENGTH(LIN) GR 0 THEN # NORMALIZE SPACING #
  407. BEGIN
  408. TMP1=0; # CURSOR #
  409. TMP2=LMARGIN; # NUMBER OF EXPECTED BLANKS #
  410. TMP3=0; # FLAG FOR CHANGES MADE #
  411. WHYLE TMP1 LS LENGTH(LIN) DO
  412. BEGIN
  413. # FIRST CHECK AND COMPRESS BLANKS BEFORE WORD #
  414. TMP4=TMP1;
  415. GETCHAR(LINE,TMP4,TMP5);
  416. WHYLE TMP5 EQ CBLANK DO # SPAN BLANKS BEFORE WORD #
  417. BEGIN
  418. TMP4=TMP4+1;
  419. GETCHAR(LINE,TMP4,TMP5);
  420. END
  421. TMP4=TMP4-TMP1; # NUMBER OF BLANKS #
  422. IF TMP4 GR TMP2 THEN # NEED LESS SPACING #
  423. BEGIN
  424. LSHIFT(LIN,TMP1+TMP4-TMP2,TMP4-TMP2);
  425. TMP3=1; # FLAG CHANGE #
  426. END
  427. IF TMP4 LS TMP2 THEN # NEED MORE SPACING #
  428. BEGIN
  429. RSHIFT(LIN,TMP1,TMP2-TMP4);
  430. FOR TMP3=1 STEP 1 UNTIL TMP2-TMP4
  431. DO SETCHAR(LINE,TMP1+TMP3-1,CBLANK);
  432. TMP3=1;
  433. END
  434. # SECOND SCAN ACROSS WORD TO SET NEW BLANK EXPECTATION #
  435. TMP1=TMP1+TMP2; # POINT TO WORD #
  436. GETCHAR(LINE,TMP1,TMP5);
  437. WHYLE TMP5 NQ CBLANK AND TMP5 NQ CENDLINE DO
  438. BEGIN
  439. TMP4=TMP5; # NEED TO KNOW LAST CHARACTER OF WORD #
  440. TMP1=TMP1+1;
  441. GETCHAR(LINE,TMP1,TMP5);
  442. END
  443. IF TMP4 EQ CPERIOD OR TMP4 EQ CEXCLAM OR TMP4 EQ CQUESTION
  444. OR TMP4 EQ XLTDSPINT[CCOLON] THEN TMP2=2;
  445. ELSE TMP2=1;
  446. END
  447. IF TMP3 NQ 0 THEN
  448. BEGIN
  449. TRIMPAD;
  450. REPX;
  451. END
  452. END
  453.  
  454. IF LENGTH(LIN) EQ RMARGIN OR NOTEXT THEN
  455. BEGIN # SKIP PERFECT OR BLANK LINE #
  456. FWDZ;
  457. TEST FILLLOOP;
  458. END
  459.  
  460. IF LENGTH(LIN) GR RMARGIN THEN
  461. BEGIN # SPLIT THIS LINE TO SHORTEN #
  462. TMP1=RMARGIN;
  463. GETCHAR(LINE,TMP1,TMP2);
  464. WHYLE TMP2 NQ CBLANK AND TMP1 GR 0 DO
  465. BEGIN # LOOK BACK FOR BLANK #
  466. TMP1=TMP1-1;
  467. GETCHAR(LINE,TMP1,TMP2);
  468. END
  469. IF TMP1 GR LMARGIN THEN # SPLIT AND WORK ON SECOND HALF #
  470. BEGIN
  471. CHRPTR3=TMP1+1;
  472. DOSPLIT(1);
  473. IF RIGHTJUST[0] THEN GOTO JUSTIFY; # IF RIGHT JUSTIFY NEEDED #
  474. END
  475. ELSE FWDZ; # ALL ONE WORD - JUST MOVE ON #
  476. TEST FILLLOOP;
  477. END
  478.  
  479. IF LENGTH(LIN) LS RMARGIN AND CURRENT EQ REGLINE[RNGBOTREG]-1 THEN
  480. BEGIN # CANNOT ENLARGE LAST SO SKIP #
  481. FWDZ;
  482. TEST FILLLOOP; # THIS ACTUALLY TERMINATES LOOP #
  483. END
  484.  
  485. IF LENGTH(LIN) LS RMARGIN AND CURRENT LS REGLINE[RNGBOTREG]-1 THEN
  486. BEGIN # TRY TO ADD WORDS FROM NEXT #
  487. COPYLIN(LIN,TTYLIN); # TTYLIN = CURRENT LINE #
  488. FWDZ; # READ UP NEXT LINE #
  489. IF NOTEXT THEN TEST FILLLOOP; # NEXT PARAGRAPH #
  490. TMP1=0;
  491. GETCHAR(LINE,0,TMP2);
  492. WHYLE TMP2 EQ CBLANK DO
  493. BEGIN # SPAN LEADING BLANKS #
  494. TMP1=TMP1+1;
  495. GETCHAR(LINE,TMP1,TMP2);
  496. END
  497. TMP3=TMP1; # KEEP START OF WORD #
  498. WHYLE TMP2 NQ CBLANK AND TMP2 NQ CENDLINE DO
  499. BEGIN # SPAN WORD #
  500. TMP1=TMP1+1;
  501. GETCHAR(LINE,TMP1,TMP2);
  502. END
  503. TMP4=LENGTH(TTYLIN);
  504. GETCHAR(TTYLINE,TMP4-1,TMP5); # DETERMINE SPACING #
  505. IF TMP5 EQ CPERIOD OR TMP5 EQ CEXCLAM OR TMP5 EQ CQUESTION
  506. OR TMP5 EQ XLTDSPINT[CCOLON] THEN TMP5=2;
  507. ELSE TMP5=1;
  508. # ADD WORD IF ROOM FOR OLD LINE, BLANKS, AND WORD #
  509. IF (LENGTH(TTYLIN)) + (TMP5) + (TMP1-TMP3-1) LQ RMARGIN THEN
  510. BEGIN # CAN ADD ONE WORD #
  511. FOR TMP2=1 STEP 1 UNTIL TMP5 DO # ADD 1 OR 2 BLANK #
  512. BEGIN
  513. SETCHAR(TTYLINE,TMP4,CBLANK);
  514. TMP4=TMP4+1;
  515. END
  516. FOR TMP2=TMP3 STEP 1 UNTIL TMP1-1 DO # ADD ONE WORD #
  517. BEGIN
  518. GETCHAR(LINE,TMP2,TMP5);
  519. SETCHAR(TTYLINE,TMP4,TMP5);
  520. TMP4=TMP4+1;
  521. END
  522. SETCHAR(TTYLINE,TMP4,CENDLINE);
  523. BAKZ; # RETURN TO CURRENT LINE #
  524. COPYLIN(TTYLIN,LIN);
  525. TRIMPAD;
  526. REPX; # SAVE ENLARGED LINE #
  527. FWDZ; # EXTRACT FROM NEXT LINE #
  528. GETCHAR(LINE,TMP1,TMP2);
  529. WHYLE TMP2 EQ CBLANK DO # KILL LEADER, WORD, TRAILER #
  530. BEGIN
  531. TMP1=TMP1+1;
  532. GETCHAR(LINE,TMP1,TMP2);
  533. END
  534. LSHIFT(LIN,TMP1,TMP1);
  535. TRIMPAD;
  536. IF LENGTH(LIN) EQ 0 THEN DELX; # DEL AND BACKUP IF EMPTIED #
  537. ELSE # UPDATE IF STILL EXIST #
  538. BEGIN
  539. REPX; # UPDATE REMAINDER OF NEXT LINE #
  540. BAKZ; # TO ORIG TO TRY ANOTHER WORD #
  541. END
  542. END
  543. # NOTE - IF NO-OP-ED, WE ARE ALREADY ADVANCED ONE LINE #
  544. ELSE IF RIGHTJUST[0] THEN GOTO JUSTIFY;
  545. TEST FILLLOOP;
  546. END
  547.  
  548. JUSTIFY: # ALIGN WORDS TO RIGHT MARGIN #
  549. BAKZ;
  550. COPYLIN(LIN,TTYLIN);
  551. TMP2 = 0; # NUMBER OF WORDS/BLANKS ADDED #
  552. TMP1 = RMARGIN - LENGTH(TTYLIN);
  553. FOR TMP3 = LMARGIN STEP 1 UNTIL LENGTH(TTYLIN) DO
  554. BEGIN
  555. GETCHAR(TTYLINE,TMP3,TMP5);
  556. IF TMP5 EQ CBLANK THEN
  557. TMP2 = TMP2 + 1;
  558. END
  559. IF TMP2 EQ 0 THEN
  560. BEGIN # IF NO SPACES DO NOT JUSTIFY #
  561. FWDZ;
  562. TEST FILLLOOP;
  563. END
  564. TMP3 = TMP1/TMP2; # COMPUTE NUMBER OF BLANKS #
  565. TMP4 = TMP1-TMP2*TMP3; # NUMBER TIMES INSERTED #
  566. LEFTRIGHT = NOT LEFTRIGHT;
  567. FOR TMP5 = LMARGIN STEP 1 UNTIL RMARGIN DO
  568. BEGIN
  569. SETCHAR(LINE,TMP5,CBLANK);
  570. END
  571. IF LEFTRIGHT THEN
  572. BEGIN # IF FROM LEFT TO RIGHT #
  573. TMP6 = LMARGIN;
  574. FOR TMP5 = LMARGIN STEP 1 UNTIL LENGTH(TTYLIN)-1 DO
  575. BEGIN
  576. GETCHAR(TTYLINE,TMP5,TMP2);
  577. SETCHAR(LINE,TMP6,TMP2);
  578. IF TMP2 EQ CBLANK AND TMP1 NQ 0 THEN
  579. BEGIN
  580. IF TMP4 EQ 0 THEN TMP3 = TMP3 - 1;
  581. TMP6 = TMP6 + TMP3 + 1;
  582. TMP4 = TMP4 - 1;
  583. TMP1 = TMP1 - TMP3;
  584. END
  585. TMP6 = TMP6 + 1;
  586. END
  587. END
  588. ELSE
  589. BEGIN # JUSTIFY FROM RIGHT TO LEFT #
  590. TMP6 = RMARGIN - 1;
  591. FOR TMP5 = LENGTH(TTYLIN)-1 STEP -1 UNTIL LMARGIN DO
  592. BEGIN
  593. GETCHAR(TTYLINE,TMP5,TMP2);
  594. SETCHAR(LINE,TMP6,TMP2);
  595. IF TMP2 EQ CBLANK AND TMP1 NQ 0 THEN
  596. BEGIN
  597. IF TMP4 EQ 0 THEN TMP3 = TMP3 - 1;
  598. TMP6 = TMP6 - TMP3 - 1;
  599. TMP4 = TMP4 - 1;
  600. TMP1 = TMP1 - TMP3;
  601. END
  602. TMP6 = TMP6 - 1;
  603. END
  604. END
  605. SETCHAR(LINE,RMARGIN,CENDLINE);
  606. REPX;
  607. FWDZ;
  608.  
  609. END # OF LOOP #
  610.  
  611. IF SCREENMODE THEN POSZ(REGLINE[RNGTOPREG]+1);
  612. ELSE
  613. BEGIN
  614. LINPTR1=REGLINE[RNGTOPREG]+1;
  615. LINPTR2=REGLINE[RNGBOTREG]-1;
  616. LIMIT=LARGENUM; EXECNDX=EXECST"TYPE";
  617. DORANGE;
  618. END
  619.  
  620. END # OF DOFILL #
  621. PAGE # MAIN CODE FOR FSECMDS #
  622.  
  623.  
  624. PROC SNGLMOV;
  625. BEGIN
  626. #
  627. ** SNGLMOV - COMMAND PROCESSOR FOR COPY AND MOVE.
  628. *
  629. * ENTRY COMMAND PROCESSOR HAS RECOGNIZED VERB.
  630. * TOKEN ADVANCED BUT NO OTHER SCANNING DONE.
  631. * TOKENTYPE, SCANPOS, TOKENPOS, ETC - AS ABOVE.
  632. * CURFILE, CURSPLIT, CURRENT - DEFAULT ADDRESS.
  633. * CHARRANGE - CHARACTER OR LINE RANGE BOUNDS.
  634. * SCREENMODE - FINAL POSITIONING/PRINTING.
  635. * WIDTH - THIS SETTING WILL BE IGNORED.
  636. * DONTPRINT - LINE MODE ECHO OF RESULTS.
  637. * BLANKS - THIS SETTING WILL BE IGNORED.
  638. *
  639. * EXIT CURFILE, CURRENT - FINAL RESTING PLACE.
  640. * (ANOTHER FILE MAY HAVE BEEN OPENED)
  641. * SMALLFIELD - TRUE.
  642. *
  643. * CALLS FLDLEN, SCANNER, FITNUM, MAKEFET, REWIND, RETERN,
  644. * PUSH, DORANGE, SPLICE, POP, WRITER, READ, TABFN,
  645. * DOSPLIT, BAKZ, XFRCMIN, SQUELCH, TRIMPAD, SETLNUM,
  646. * INSX, DOJOIN, POSZ, VFYLOCK.
  647. *
  648. * USES LINPTR1-3, CHRPTR1-3, FILPTR1-3, LINNUM1-3,
  649. * LINCTR, LIMIT, MOVEFET, FILEBUF.
  650. *
  651. * NOTE USES THEN RESTORES - LINENO.
  652. #
  653. ITEM LEN;
  654.  
  655. SCANNER;
  656. IF FIELDTARGET NQ 0 THEN CHRPTR3=NUMWIDBLK+TABFN(FIELDTARGET-1);
  657.  
  658. IF EXECNDX EQ EXECST"MOVE" THEN
  659. BEGIN # IF MOVE COMMAND #
  660. VFYLOCK;
  661. IF SCANMARK THEN KILLMARKS = TRUE;
  662. END
  663. CURFILE = = FILPTR3;
  664. VFYLOCK;
  665. CURFILE = = FILPTR3;
  666.  
  667. IF NUMBERED[FILPTR3] NQ 0 AND CHARRANGE AND LINPTR1 NQ LINPTR2
  668. AND LIMIT GR 1
  669. THEN ERRJUMP("FILE MUST NOT CONTAIN SEQUENCE NUMBERS$");
  670.  
  671. CURFILE = = FILPTR3;
  672. POSZ(LINPTR3); # GET FAMILIAR WITH TARGET #
  673. FITNUM; # ASSURE NUMBERED MODE IS OK #
  674. CURFILE = = FILPTR3;
  675.  
  676. IF CHARRANGE AND LINPTR1 EQ LINPTR2 AND LINPTR1 EQ LINPTR3 THEN
  677. BEGIN # PHRASE WITHIN LINE #
  678. POSZ(LINPTR1);
  679. IF LENGTH(LIN) EQ 0 THEN
  680. BEGIN
  681. SETCHAR(LINE,0,CBLANK);
  682. SETCHAR(LINE,1,CENDLINE);
  683. END
  684. COPYLIN(LIN,TTYLIN);
  685. CHRPTR1=MIN(CHRPTR1,LENGTH(LIN)-1);
  686. CHRPTR2=MIN(CHRPTR2,LENGTH(LIN)-1);
  687. LEN=CHRPTR2-CHRPTR1+1;
  688. RSHIFT(LIN,CHRPTR3,LEN);
  689. FOR LINCTR=0 STEP 1 UNTIL LEN-1 DO
  690. BEGIN
  691. GETCHAR(TTYLINE,CHRPTR1+LINCTR,LINPTR2);
  692. IF CHRPTR3+LINCTR LQ BUFCM1
  693. THEN SETCHAR(LINE,CHRPTR3+LINCTR,LINPTR2);
  694. END
  695.  
  696. # NO TRUNCATION AT EDITFIELD HERE SINCE THIS IS CONSIDERED TO #
  697. # BE AN IN-PLACE ALTERATION RATHER THAN A CREATION OF NEW TEXT. #
  698.  
  699. SETCHAR(LINE,BUFCHAR,CENDLINE);
  700. NEWCURSOR=CHRPTR3;
  701. IF FILCMDNDX EQ FILCMDST"MOVE" THEN
  702. BEGIN
  703. IF CHRPTR3 LS CHRPTR1 THEN CHRPTR2=CHRPTR2+LEN;
  704. ELSE IF CHRPTR3 GR CHRPTR2 THEN NEWCURSOR=CHRPTR3-LEN;
  705. ELSE NEWCURSOR=CHRPTR1;
  706. LSHIFT(LIN,CHRPTR2+1,LEN);
  707. END
  708. TRIMPAD;
  709. REPX;
  710. IF FILCMDNDX EQ FILCMDST"COPY" THEN
  711. BEGIN # IF MARK MAY NEED TO BE MOVED #
  712. IF CHRPTR3 LQ MRKCHAR[1] THEN
  713. BEGIN # IF SECOND MARK MUST BE MOVED #
  714. MRKCHAR[1] = MRKCHAR[1]+LEN;
  715. IF CHRPTR3 LQ MRKCHAR[0] THEN
  716. BEGIN # IF FIRST MARK MUST BE MOVED #
  717. MRKCHAR[0] = MRKCHAR[0]+LEN;
  718. END
  719. END
  720. END
  721. IF NOT (SCREENMODE OR DONTPRINT) THEN PRINTL;
  722. RETURN;
  723. END
  724.  
  725. FLDLEN(LOC(MAXADDR)+4);
  726. SMALLFIELD=FALSE;
  727.  
  728. MAKEFET(MOVEFET,"ZZZMOVE",FILEBUF,INIDSKSIZ);
  729. REWIND(MOVEFET,1);
  730.  
  731. SAVLINENO=LINENO;
  732. PUSH; # SAVE TARGET ADDRESS #
  733.  
  734. IF FILCMDNDX EQ FILCMDST"MOVE" AND CHARRANGE THEN
  735. BEGIN
  736. IF LINPTR2 EQ LINPTR3
  737. THEN CHRPTR3=MAX(0,CHRPTR3-(CHRPTR2-CHRPTR1+1));
  738. DORANGE; # COPY RANGE TO ZZZMOVE #
  739. IF FOUND THEN SPLICE; # CLOSE BOUNDARIES TOGETHER #
  740. END
  741. ELSE DORANGE; # COPY RANGE TO ZZZMOVE #
  742.  
  743. POP; # TO TARGET AREA #
  744. LINENO=SAVLINENO;
  745.  
  746. WRITER(MOVEFET,1);
  747. REWIND(MOVEFET,1);
  748. IF NOT FOUND THEN RETURN;
  749. KILLUPLOW=FALSE;
  750. IF CURFILE NQ FILPTR3 AND ASCII[CURFILE] GQ 2 AND
  751. ASCII[FILPTR3] LQ 1 THEN
  752. BEGIN
  753. # IF CHARACTER SETS ARE INCOMPATIBLE, CHANGE CHARSET OF EMPTY #
  754. # TARGET FILE, OR FLAG CASE SUPPRESSION #
  755. IF BOTF(FILPTR3)-TOPF(FILPTR3)-1 EQ THISEXTEND
  756. AND ASCII[FILPTR3] EQ 0
  757. THEN ASCII[FILPTR3]=ASCII[CURFILE];
  758. ELSE KILLUPLOW=TRUE;
  759. END
  760. CURFILE=FILPTR3;
  761. READ(MOVEFET,0); # START FEEDING BUFFER #
  762.  
  763. NUMWIDBLK=0;
  764. IF NUMBERED[CURFILE] NQ 0 THEN NUMWIDBLK=NUMWIDTH+BLANKS;
  765. SAVBLANKS=BLANKS;
  766. BLANKS=0;
  767. LINPTR3=CURRENT+1; # TAKE NOTE OF RELOCATED TARGET #
  768. IF BOTF(CURFILE)-TOPF(CURFILE)-1 EQ THISEXTEND THEN
  769. BEGIN # IF TARGET FILE IS EMPTY #
  770. CHARRANGE = FALSE;
  771. FIELDTARGET = 0;
  772. END
  773. IF CHARRANGE OR FIELDTARGET NQ 0 THEN
  774. BEGIN # FIRST SEGMENT INTO MIDDLE OF LINE #
  775. DOSPLIT(0); # SPLIT TARGET AT CHRPTR3 #
  776. BAKZ; # INSERTION AFTER FIRST HALF #
  777. LINPTR3=CURRENT;
  778. END
  779. FOR LINCTR=1 STEP 1 WHILE LINCTR LQ LCOUNT
  780. AND NOT (CANINTER AND USRBRK NQ 0) DO
  781. BEGIN
  782. IF USRBRK NQ 0 THEN DONTPRINT=TRUE;
  783. XFRCMIN;
  784. IF KILLUPLOW THEN SQUELCH(LIN);
  785. IF EDITFIELD LS LENGTH(LIN) THEN
  786. BEGIN
  787. SETCHAR(LINE,EDITFIELD,CENDLINE); # CLEAR TO END OF LINE #
  788. TRIMPAD;
  789. END
  790. LINENO=LINENO+INCR;
  791. SETLNUM;
  792. INSX;
  793. IF NOT (DONTPRINT OR SCREENMODE) THEN PRINTL;
  794. END
  795. IF CHARRANGE OR FIELDTARGET NQ 0 THEN
  796. BEGIN
  797. IF CHARRANGE AND FILCMDNDX EQ FILCMDST"COPY" THEN
  798. BEGIN # IF MARK MAY NEED TO BE MOVED #
  799. IF LINPTR3 EQ REGLINE[MARKREG]
  800. AND CHRPTR3 LQ MRKCHAR[0] THEN
  801. BEGIN # IF FIRST MARK MUST BE MOVED #
  802. REGLINE[MARKREG] = CURRENT;
  803. MRKCHAR[0] = MRKCHAR[0] - CHRPTR3 + LENGTH(LIN);
  804. END
  805. ELSE IF LINPTR3 EQ REGLINE[MARKREG+1]
  806. AND CHRPTR3 LQ MRKCHAR[1] THEN
  807. BEGIN # IF SECOND MARK MUST BE MOVED #
  808. REGLINE[MARKREG+1] = CURRENT;
  809. MRKCHAR[1] = MRKCHAR[1] - CHRPTR3 + LENGTH(LIN);
  810. END
  811. END
  812. CHRPTR3 == ZERO; # ASSURE NO EXTENSION IN MERGES #
  813. DOJOIN(0); # MERGE LAST INSERT WITH TRAILER #
  814. CHRPTR3 == ZERO; # RESTORE TARGET CHARACTER ADDRESS #
  815. PUSH;
  816. POSZ(LINPTR3);
  817. DOJOIN(0); # MERGE LEADER WITH FIRST INSERT #
  818. POP;
  819. NEWCURSOR = CHRPTR3;
  820. END
  821. IF SCREENMODE THEN POSZ(LINPTR3); # POSITION TO TOP OF BLOCK #
  822. BLANKS=SAVBLANKS;
  823.  
  824. RETERN(MOVEFET,1);
  825. FLDLEN(LOC(WORKBUF)+DSKSIZ+4);
  826. SMALLFIELD=TRUE;
  827.  
  828. END # OF SNGLMOV #
  829.  
  830.  
  831. PROC HELPCMD;
  832. BEGIN
  833. #
  834. ** HELPCMD - COMMAND PROCESSOR FOR HELP FACILITY.
  835. *
  836. * ENTRY PROCESSNDX - INDICATES HELP OR TEACH COMMAND.
  837. * NO SCANNING BEYOND COMMAND VERB YET.
  838. * TOKEN CALLED TO PREPARE NEXT SCAN.
  839. * SCANPOS, TOKENPOS, TOKENTYPE, ETC - AS ABOVE.
  840. * SCREENMODE - PRINTING/POSITIONING MODE.
  841. *
  842. * EXIT HELP FILE BECOMES CURRENT FILE.
  843. * CURRENT, CURFILE, CURSPLIT - AS ABOVE.
  844. *
  845. * MACROS SETCHAR.
  846. *
  847. * CALLS MAKEFET, GET, ATTACH, OPENFILE, SCNEQNAME, SCNEOC,
  848. * DORANGE, POSZ, SETUPSCREEN, HALT.
  849. *
  850. * USES LINPTR1-3, LINNUM1-3, FILPTR1-3, CHRPTR1-3,
  851. * PFMFET, FILEBUF, READNAM, FILNUM, CHARPARM, GETPARM,
  852. * LOCSTRING1, EXECNDX, WORDSEARCH, ELLIPSIS, DONTPRINT,
  853. * UPPERSEARCH, FOUND.
  854. #
  855.  
  856. READNAM="FSEHELP";
  857. IF PROCESSNDX EQ KEYST"TCMD" THEN READNAM="FSTEACH";
  858.  
  859. IF NOT ASSGNFILE(READNAM) THEN
  860. BEGIN
  861. IF READNAM EQ "FSEHELP" THEN
  862. BEGIN
  863. PF("ATTACH",READNAM,READNAM,"RC",PFMERROR,"M","R","UN",
  864. HELPUSERNUM,"NA","YES","SR","NF","PN","0",0);
  865. END
  866. ELSE
  867. BEGIN
  868. C&lt;0,1>READNAM="T"; # LOOK FOR FILE FOR THIS MODEL #
  869. C&lt;1,6>READNAM=C&lt;0,6>TABMODNAME;
  870. PF("GET","FSTEACH",READNAM,"RC",PFMERROR,"UN",HELPUSERNUM,
  871. "PN","0",0);
  872. READNAM="FSTEACH";
  873. IF PFMERROR NQ 0 THEN
  874. BEGIN # IF SPECIFIC FILE NOT FOUND #
  875. PF("GET",READNAM,READNAM,"RC",PFMERROR,"UN",HELPUSERNUM,
  876. "PN","0",0);
  877. END
  878. END
  879. END
  880.  
  881. FILNUM=CURFILE;
  882. IF FILENAM[FILNUM] NQ READNAM THEN
  883. BEGIN
  884. FILNUM=1;
  885. IF SCREENMODE AND PROCESSNDX EQ KEYST"HCMD" THEN
  886. BEGIN # IF SCREEN MODE HELP #
  887. FILNUM = 2; # SPLIT SCREEN MODE #
  888. ERRSTRING = "USE 'EDIT' TO UNSPLIT SCREEN$";
  889. END
  890. ELSE
  891. BEGIN # LINE MODE OR TEACH #
  892. ERRSTRING = "USE 'EDIT' TO RETURN TO INITIAL FILE$";
  893. END
  894. CHARPARM=2;
  895. GETPARM=0;
  896. OPENFILE;
  897. END
  898. POSZ(TOPF(FILNUM)+1); # DEFAULT TO TOP OF FILE #
  899. IF SYNTAXCHAR[TOKENCHAR] THEN
  900. BEGIN # TOPIC SEARCH RATHER THAN DEFAULT #
  901. IF TOKENTYPE EQ TYPST"LETTER" THEN
  902. BEGIN # IF CHARACTER STRING #
  903. SCNEQNAM(READNAM);
  904. SCNEOC;
  905. SETCHAR(LOCSTR1,0,CLPAREN);
  906. LINPTR2=B&lt;0,6>READNAM;
  907. FOR LINPTR1=0 STEP 1 WHILE LINPTR1 LQ 6 AND
  908. LINPTR2 NQ " " DO
  909. BEGIN
  910. SETCHAR(LOCSTR1,LINPTR1+1,LINPTR2);
  911. LINPTR2=B&lt;6*LINPTR1+6,6>READNAM;
  912. END
  913. SETCHAR(LOCSTR1,LINPTR1+1,CRPAREN);
  914. END
  915. ELSE
  916. BEGIN # NOT ALPHABETIC #
  917. LINPTR2 = TOKENCHAR;
  918. SETCHAR(LOCSTR1,0,CLPAREN);
  919. SETCHAR(LOCSTR1,1,LINPTR2);
  920. SETCHAR(LOCSTR1,2,CRPAREN);
  921. LINPTR1 = 1;
  922. TOKEN;
  923. IF SYNTAXCHAR[TOKENCHAR] THEN
  924. ERRJUMP("PLEASE ENTER 'HELP DIRECTIVE'$");
  925. END
  926. SETCHAR(LOCSTR1,LINPTR1+2,CENDLINE);
  927. LOCSTRLEN1=LINPTR1+2;
  928. LINPTR1=CURRENT;
  929. LINPTR3=CURRENT;
  930. LINPTR2=BOTF(FILNUM)-1;
  931. LIMIT=1;
  932. EXECNDX=EXECST"LOCATE";
  933. WORDSEARCH=FALSE; ELLIPSIS=FALSE; DONTPRINT=TRUE;
  934. UPPERSEARCH=FALSE; CHRPTR1=0; CHRPTR2=BUFCM1;
  935. DORANGE; # SEARCH FOR (KEYWORD) #
  936. IF NOT FOUND THEN POSZ(LINPTR3);
  937. FOUND=TRUE;
  938. END
  939. IF NOT SCREENMODE THEN
  940. BEGIN
  941. LINPTR1=CURRENT;
  942. LINPTR2=BOTF(FILNUM)-1;
  943. LIMIT=HELPSIZE; # HELP FILE LINES TO DISPLAY #
  944. EXECNDX=EXECST"TYPE";
  945. DONTPRINT=FALSE;
  946. DORANGE;
  947. END
  948. IF FILNUM EQ 2 THEN
  949. BEGIN
  950. IF SPLITFILE[2] NQ 2 THEN SETUPSCREEN(1,2,USRSPLTSZ);
  951. END
  952.  
  953.  
  954. END # OF HELPCMD #
  955.  
  956.  
  957. PROC GETSTATUS;
  958. BEGIN
  959. #
  960. ** GETSTATUS - COMMAND PROCESSOR FOR GET STATUS SUBCOMMAND.
  961. *
  962. * ENTRY COMMAND FULLY SCANNED EXCEPT TERMINATOR VERIFY.
  963. * ONE OR BOTH FILE BRACKETS OPENED SOMEWHERE.
  964. *
  965. * EXIT SCREENMODE SCHEDULED FOR TOTAL REPAINT.
  966. * COMMAND TERMINATOR SCANNED.
  967. * OPEN FILES UPDATED INTO DIRECTORY. (SIDE EFFECT)
  968. *
  969. * CALLS SCNEOC, BGNDSPLAY, TTSTR, EOLDSPLAY, PUSH,
  970. * PADNAME, CLOSEFILE, POSZ, SCANFDL, TTST, FWDZ, POP,
  971. * TTDEC, TTCHAR, ENDDSPLAY, TABFN.
  972. *
  973. * USES FILNUM, READNAM, LINPTR1, LINCTR.
  974. *
  975. * NOTE -
  976. *
  977. * THIS BLOCK OF CODE IS SUBJECT TO CERTAIN RESTRICTIONS IN
  978. * ORDER TO DRIVE THE TERMINAL IN BOTH LINE MODE AND SCREEN
  979. * MODE. TTLIN CANNOT BE USED. THE ONLY ALLOWABLE WAY TO
  980. * ADVANCE TO A NEW LINE OF OUTPUT IS TO CALL EOLDSPLAY AS
  981. * A LOGICAL REPLACEMENT FOR TTBRK. EOLDSPLAY WILL IN TURN
  982. * USE EITHER TTBRK (FOR LINE MODE) OR VDTPOS (SCREEN MODE)
  983. * TO CONTROL THE OUTPUT DEVICE. BGNDSPLAY IS USED TO INIT
  984. * THE DISPLAY AND ENDDSPLAY CLEANS UP AFTERWARD. EOLDSPLAY
  985. * INCLUDES SCREEN-OVERFLOW LOGIC.
  986. #
  987. ITEM TMP1, TMP2, TMP3, TMP4, TMP5;
  988. BASED ARRAY KEYLIN[0:99]; ITEM KEYLINE;
  989.  
  990.  
  991. PROC DSPLFKEY(WHICH);
  992. BEGIN
  993. ITEM WHICH;
  994. ITEM TMP1, TMP2;
  995. P&lt;KEYLIN>=LOC(FKEYSTRING[WHICH]);
  996. IF WHICH LS 0 THEN TTSTR(" SHIFT F$");
  997. ELSE TTSTR(" F$");
  998. TTDEC(ABS(WHICH));
  999. IF ABS(WHICH) LS 10 THEN TTSTR(" $");
  1000. TTSTR(" $");
  1001. TTST(FKEYNAME[WHICH],6);
  1002. TTSTR(" $");
  1003. FOR TMP1=0 STEP 1 UNTIL 15 DO
  1004. BEGIN
  1005. IF TMP1 LS LENGTH(KEYLIN) THEN
  1006. BEGIN
  1007. GETCHAR(KEYLINE,TMP1,TMP2);
  1008. TMP2=XLTINTDSP[TMP2];
  1009. C&lt;0,1>TMP2=C&lt;9,1>TMP2;
  1010. TTST(TMP2,1);
  1011. END
  1012. ELSE TTSTR(" $");
  1013. END
  1014. END # OF DSPLFKEY #
  1015.  
  1016.  
  1017. # ACTUAL GETSTATUS CODE STARTS HERE #
  1018.  
  1019. SCNEOC;
  1020. BGNDSPLAY;
  1021. TTSTR(" $");
  1022. TTSTR(" EDITOR STATUS INFORMATION:$");
  1023. EOLDSPLAY;
  1024. EOLDSPLAY;
  1025. TTSTR(" FILES: NAME LOCK CHANGE $");
  1026. TTSTR("CHARSET NUMBERED SIZE POSITION$");
  1027. EOLDSPLAY;
  1028. PUSH;
  1029. FOR FILNUM=1 STEP 1 UNTIL 2 DO
  1030. BEGIN
  1031. IF PADNAME(FILENAM[FILNUM]) NQ " " THEN CLOSEFILE;
  1032. END
  1033. POSZ(TOPC(FILECTL)+1);
  1034. WHYLE CURRENT LS BOTC(FILECTL) DO
  1035. BEGIN
  1036. SCANFDL(READNAM);
  1037. IF READNAM NQ "ZZZNULL" THEN
  1038. BEGIN
  1039. IF CURRENT EQ FDLF(CURFILE) THEN
  1040. BEGIN # IF CURRENT FILE, INDICATE #
  1041. TTSTR(" (CURRENT) $");
  1042. END
  1043. ELSE
  1044. BEGIN # JUST ANOTHER FILE #
  1045. TTSTR(" $");
  1046. END
  1047. FOR FILNUM=0 STEP 1 UNTIL 6 DO TTST(C&lt;FILNUM,1>READNAM,1);
  1048. TTST(YESORNO[SCNFDLOCK],7);
  1049. TTST(YESORNO[SCNFDCHNG],7);
  1050. TTST(CHARTYPE[SCNFDASCI],7);
  1051. TTST(YESORNO[SCNFDNUMB],7);
  1052. TTLPAD(SCNFDSIZE,7," ");
  1053. TTLPAD(SCNFDCURF,7," ");
  1054. EOLDSPLAY;
  1055. END
  1056. FWDZ;
  1057. END
  1058. POP;
  1059. EOLDSPLAY;
  1060. TTSTR(" SET VIEW IN: $");
  1061. TTDEC(DFINBGN);
  1062. TTSTR(" $");
  1063. TTDEC(DFINEND);
  1064. TTSTR(" $");
  1065. TTSTR(" TAB COLUMNS: $");
  1066. LINPTR1=TABFN(1);
  1067. FOR LINCTR=1 STEP 1 WHILE LINCTR LQ USERTABS AND LINPTR1 NQ 0 DO
  1068. BEGIN
  1069. TTDEC(LINPTR1+1); TTSTR(" $");
  1070. LINPTR1=TABFN(LINCTR+1);
  1071. END
  1072. EOLDSPLAY;
  1073. TTSTR(" SET VIEW WARN: $");
  1074. TTDEC(WIDTH);
  1075. TTSTR(" $");
  1076. TTSTR("SET UNDO: $");
  1077. IF AUDITOFF THEN TTSTR(" NO$"); ELSE TTSTR("YES$");
  1078. TTSTR(" $");
  1079. TTSTR("TAB CHARACTER: $");
  1080. TTCHAR(TABCHAR,TRUE);
  1081. TTSTR(" $");
  1082. TTSTR("CNTRL CHRS: $");
  1083. TTCHAR(UNPRINT,TRUE);
  1084. EOLDSPLAY;
  1085. TTSTR(" SET VIEW EDIT: $");
  1086. TTDEC(EDITFIELD);
  1087. TTSTR(" $");
  1088. TTSTR("SET JUMP: $");
  1089. IF AUTOINDENT THEN TTSTR("YES$"); ELSE TTSTR(" NO$");
  1090. TTSTR(" $");
  1091. TTSTR("SET WORD FILL: $");
  1092. TTDEC(FILLLEFT+1);
  1093. TTSTR(" $");
  1094. TTDEC(FILLRIGHT+1);
  1095. TTSTR(" $");
  1096. TTDEC(FILLFIRST+1);
  1097. TTSTR(" JUSTIFY:$");
  1098. IF RIGHTJUST[0] THEN TTSTR(" YES$"); ELSE TTSTR(" NO$");
  1099. EOLDSPLAY;
  1100. TTSTR(" SEARCH STRING: '$");
  1101. FOR TMP1=0 STEP 1 UNTIL LOCSTRLEN1-1 DO
  1102. BEGIN
  1103. GETCHAR(LOCSTR1,TMP1,TMP2);
  1104. TTCHAR(TMP2,FALSE);
  1105. END
  1106. IF ELLIPSIS THEN
  1107. BEGIN
  1108. TTSTR("'..'$");
  1109. FOR TMP1=0 STEP 1 UNTIL LOCSTRLEN2-1 DO
  1110. BEGIN
  1111. GETCHAR(LOCSTR2,TMP1,TMP2);
  1112. TTCHAR(TMP2,FALSE);
  1113. END
  1114. END
  1115. TTSTR("'$");
  1116. EOLDSPLAY;
  1117. IF SCREENMODE THEN
  1118. BEGIN
  1119. EOLDSPLAY;
  1120. TTSTR(" FUNCTIONS: KEY$");
  1121. TTSTR(" LABEL DIRECTIVES $");
  1122. TTSTR(" KEY LABEL DIRECTIVES$");
  1123. FOR TMP1=1 STEP 1 UNTIL POSFKEYS DO
  1124. BEGIN
  1125. TMP2=0;
  1126. P&lt;KEYLIN>=LOC(FKEYSTRING[TMP1]);
  1127. FOR TMP4=0 STEP 1 UNTIL LENGTH(KEYLIN)-1 DO
  1128. BEGIN
  1129. GETCHAR(KEYLINE,TMP4,TMP5);
  1130. IF TMP5 NQ CBLANK THEN TMP2=1;
  1131. END
  1132. TMP3=0;
  1133. P&lt;KEYLIN>=LOC(FKEYSTRING[-TMP1]);
  1134. FOR TMP4=0 STEP 1 UNTIL LENGTH(KEYLIN)-1 DO
  1135. BEGIN
  1136. GETCHAR(KEYLINE,TMP4,TMP5);
  1137. IF TMP5 NQ CBLANK THEN TMP3=1;
  1138. END
  1139. IF TMP2 NQ 0 OR FKEYNAME[TMP1] NQ " "
  1140. OR TMP3 NQ 0 OR FKEYNAME[-TMP1] NQ " " THEN
  1141. BEGIN
  1142. EOLDSPLAY;
  1143. TTSTR(" $");
  1144. DSPLFKEY(TMP1);
  1145. IF TMP3 NQ 0 OR FKEYNAME[-TMP1] NQ " " THEN DSPLFKEY(-TMP1);
  1146. END
  1147. END
  1148. END
  1149. ENDDSPLAY;
  1150. END # OF GETSTATUS #
  1151.  
  1152.  
  1153. PROC UNDOCMD;
  1154. BEGIN
  1155. #
  1156. ** UNDOCMD - COMMAND PROCESSOR FOR UNDO FACILITY.
  1157. *
  1158. * ENTRY COMMAND SCANNED EXCEPT TERMINATOR VERIFY.
  1159. * CURA(AUDITCTL) AT MOST RECENT CHANGE RECORD.
  1160. * TOPA(AUDITCTL) BOUNDS AUDIT TRAIL.
  1161. * NUMMARKS - WHETHER MARKS ARE CURRENTLY ON.
  1162. *
  1163. * EXIT COMMAND TERMINATOR VERIFIED.
  1164. * SELECTION OF OPENED FILES MAY CHANGE.
  1165. * CURA(AUDITCTL) BACKED UP.
  1166. * NUMMARKS - ZEROED.
  1167. *
  1168. * MACROS GETCHAR.
  1169. *
  1170. * CALLS ERRJUMP, AUDITSYNCH, POSZ, UNDODECODE, UNDOOPEN,
  1171. * BAKZ, FATAL, PUSH, UNDOPOS, INSX, POP, DELX, REPX,
  1172. * PAINTMARKS.
  1173. *
  1174. * USES AUDITOFF, AUDITUSED, LINPTR1, LINNUM1, LINNUM2,
  1175. * LINNUM3, USRBRK.
  1176. #
  1177.  
  1178. IF SYNTAXCHAR[TOKENCHAR] THEN
  1179. BEGIN # IF MORE SYNTAX #
  1180. TOKEN;
  1181. IF NUMMARKS NQ 0 THEN
  1182. BEGIN # IF MARKS ACTIVE #
  1183. PAINTMARKS(3);
  1184. NUMMARKS=0;
  1185. ERRSTRING="MARKS CANCELLED$";
  1186. END
  1187. ELSE
  1188. BEGIN # NO MARKS ACTIVE #
  1189. ERRSTRING="NO MARK(S) ACTIVE$";
  1190. END
  1191. SCNEOC; # SCAN FOR END OF COMMAND #
  1192. RETURN;
  1193. END
  1194.  
  1195. SCNEOC; # SCAN FOR END OF COMMAND #
  1196.  
  1197. IF AUDITOFF THEN ERRJUMP("SET UNDO YES - TO ENABLE UNDO$");
  1198. AUDITOFF=TRUE;
  1199. AUDITSYNCH; # CLEAR STAGING BUFFER #
  1200. AUDITUSED=FALSE; # NO CHKPT TRANSACT CANCELLED IN MIDDLE #
  1201. POSZ(CURA(AUDITCTL));
  1202. GETCHAR(LINE,0,LINPTR1);
  1203. IF LINPTR1 EQ CLETTERC THEN # ACCESS PREVIOUS FILES #
  1204. BEGIN
  1205. UNDODECODE(1,LINNUM1); # FIRST FILE #
  1206. UNDODECODE(12,LINNUM2); # SECOND FILE #
  1207. UNDODECODE(23,LINNUM3); # SCREEN SPLIT #
  1208. UNDOOPEN(1,LINNUM1);
  1209. UNDODECODE(12,LINNUM1);
  1210. UNDOOPEN(2,LINNUM1);
  1211. BAKZ;
  1212. END
  1213. GETCHAR(LINE,0,LINPTR1);
  1214. WHYLE CURRENT GR TOPA(AUDITCTL) AND LINPTR1 NQ CLETTERC
  1215. AND LINPTR1 NQ CLETTERE AND USRBRK EQ 0 DO
  1216. BEGIN
  1217. UNDODECODE(1,LINNUM1);
  1218. UNDODECODE(12,LINNUM2);
  1219. UNDODECODE(23,LINNUM3);
  1220. IF LINNUM2 NQ FDLF(LINNUM1) THEN UNDOOPEN(LINNUM1,LINNUM2);
  1221. IF LINPTR1 EQ CLETTERD THEN
  1222. BEGIN
  1223. BAKZ;
  1224. PUSH;
  1225. UNDOPOS(-1);
  1226. INSX;
  1227. POP;
  1228. END
  1229. ELSE IF LINPTR1 EQ CLETTERI THEN
  1230. BEGIN
  1231. PUSH;
  1232. UNDOPOS(+1);
  1233. DELX;
  1234. POP;
  1235. END
  1236. ELSE IF LINPTR1 EQ CLETTERR THEN
  1237. BEGIN
  1238. BAKZ;
  1239. PUSH;
  1240. UNDOPOS(0);
  1241. REPX;
  1242. CURF(CURFILE)=CURF(CURFILE)-1;
  1243. POP;
  1244. END
  1245. BAKZ;
  1246. GETCHAR(LINE,0,LINPTR1);
  1247. END
  1248. CURA(AUDITCTL)=CURRENT;
  1249. CURF(CURFILE)=MAX(MIN(CURF(CURFILE)+1,BOTF(CURFILE)-1),TOPF(CURFILE));
  1250. POSZ(CURF(CURFILE));
  1251. AUDITOFF=FALSE;
  1252. NEWCURSOR = 0;
  1253. END # OF UNDOCMD #
  1254.  
  1255.  
  1256. PROC WORDCMD;
  1257. BEGIN
  1258. #
  1259. ** WORDCMD - COMMAND PROCESSOR FOR WORD PROCESSING.
  1260. *
  1261. * ENTRY COMMAND VERB SCANNED, TOKEN ADVANCED FOR NEXT.
  1262. * USUAL DEFAULTS AVAILABLE. (CURRENT, ETC.)
  1263. *
  1264. * EXIT COMMAND PROCESSED.
  1265. *
  1266. * CALLS VFYLOCK, TOKEN, ERRJUMP, SCANNER,
  1267. * DOFILL.
  1268. *
  1269. * USES LCOUNT, SCANPOS, KEYWDTYPE.
  1270. #
  1271. IF TOKENTYPE NQ TYPST"LETTER" OR KEYWDNDX LS 0
  1272. THEN ERRJUMP("CHARACTER SEQUENCE NOT RECOGNIZED$");
  1273. LCOUNT=KEYWDNDX;
  1274. TOKEN; # ADVANCE TO NEXT SYNTAX #
  1275. SCANNER;
  1276. VFYLOCK;
  1277. IF NOT FOUND THEN RETURN; # OUT OF BOUNDS #
  1278. IF LCOUNT EQ KEYST"WFIL" THEN
  1279. BEGIN
  1280. DOFILL;
  1281. NEWCURSOR=0;
  1282. RETURN;
  1283. END
  1284. ELSE IF LCOUNT EQ KEYST"WCEN" THEN
  1285. BEGIN
  1286. EXECNDX=EXECST"CENTER";
  1287. DORANGE;
  1288. RETURN;
  1289. END
  1290. END # OF WORDCMD #
  1291.  
  1292.  
  1293. END TERM