home *** CD-ROM | disk | FTP | other *** search
/ Nibble Magazine / nib34b.dsk / ALINER.PROGS.txt next >
Text File  |  2023-02-26  |  12KB  |  652 lines

  1.  
  2. Listing 3: AppleLiner programs
  3.  
  4. -----------------------------------------------------------
  5.  
  6. OUT PND
  7. *** Mark cursor position with mark A
  8.    F##{CTRL-G}a#
  9.    YN
  10. *** Switch to single window
  11.    YN
  12. *** Prompt for outline level
  13.    PIN {CTRL-G}lOutline level (enter dashes):=$D
  14. *** If no response then use 6 dashes
  15.    PCS/$D//
  16.    PAS------=$D
  17. *** Return to cursor position with forward search direction
  18.    B
  19.    F#{CTRL-G}a##
  20.    YN
  21.    PPR{CTRL-G}l
  22. *** Go to split screen, use lower cursor
  23.    YY
  24. *** Insert mark 1 with leading dash after current line
  25.    F#%##
  26.    YN
  27.    P
  28.    F##%- {CTRL-G}1%#
  29.    YN
  30.    P
  31. *** Delete outline, if any
  32.    PPR{CTRL-G}l==> Erasing old outline, if any....
  33. *** Move back 3 CRs from end of file
  34.    E
  35.    F#%#%#
  36.    YYYYN
  37. *** Look forward for end of outline
  38.    D
  39.    F#%- !!#
  40.    N
  41. *** If found, go delete whole outline
  42.    PGO DEL0
  43. *** Else done
  44.    PGO DEL1
  45. DEL0 D
  46. *** Back up one line
  47.    F#%#%#
  48.    YN
  49. *** Find end of document
  50.    F#%- !!#
  51.    N
  52.    PGO DEL
  53.    PGO DEL1
  54. *** Delete all characters
  55. DEL D
  56.    F#&##A
  57. *** Return to cursor position
  58. DEL1 P
  59. *** Insert outline title line at end of file
  60.    E
  61.    F##%- !! END OF DOCUMENT !!%%%%%%%%%#
  62.    YN
  63. *** Put carriage return at beginning
  64.    B
  65.    F##%#
  66.    YN
  67. *** Mark all headlines
  68.    PPR{CTRL-G}l==> Creating new outline....
  69.    B
  70.    F#%-#%{CTRL-G}a-#A
  71.    P
  72. *** Copy (direct load) to end of file all headlines
  73.    E
  74.    L##{CTRL-G}a#%#A
  75.    P
  76. *** Remove all mark A's
  77.    B
  78.    F#{CTRL-G}a##A
  79.    P
  80. *** Go to the beginning of the outline
  81.    PPR{CTRL-G}l==> Cleaning up outline....
  82.    B
  83.    F#%- !!#
  84.    N
  85. *** Delete all lines that have more leading dashes than
  86. *** desired
  87.    F#%-$D$%##A
  88.    P
  89. *** Go to first outline headline
  90.    B
  91.    F#%- !!#%- !!#
  92.    YN
  93.    F#%-#
  94.    N
  95. *** Delete all double carriage returns
  96.    F#%%-#%-#A
  97.    P
  98. *** Remove CR at beginning
  99.    PPR{CTRL-G}l==> Finishing up....
  100.    B
  101.    F#%##
  102.    YN
  103. *** Find and delete both mark 1's, leave cursor at second
  104. *** (in outline)
  105.    F#%- {CTRL-G}1##
  106.    YYYN
  107.    P
  108.    PYD
  109. *** Switch to cursor in top screen
  110.    Y
  111.    PQT
  112.  
  113. -----------------------------------------------------------
  114.  
  115. DELOUT PND
  116. *** Mark cursor position
  117.    F##{CTRL-G}a%#
  118.    YN
  119.    PDO DELO
  120.  
  121. -----------------------------------------------------------
  122.  
  123. DELO PND
  124. *** Delete outline, if any
  125.    PPR{CTRL-G}l==> Erasing outline, if any....
  126. *** Move back 3 CRs from end of file
  127.    E
  128.    F#%#%#
  129.    YYYYN
  130. *** Look forward for end of outline
  131.    D
  132.    F#%- !!#
  133.    N
  134. *** If found, go delete whole outline
  135.    PGO DEL0
  136. *** Else done
  137.    PGO DEL1
  138. DEL0 D
  139. *** Back up one line
  140.    F#%#%#
  141.    YN
  142. *** Find end of document
  143.    F#%- !!#
  144.    N
  145.    PGO DEL
  146.    PGO DEL1
  147. *** Delete all subsequent characters
  148. DEL D
  149.    F#&##A
  150. *** Return to cursor position
  151. DEL1 B
  152.    F#{CTRL-G}a%##
  153.    YN
  154.    P
  155. *** Unsplit screen
  156.    Y
  157.    Y
  158.    YN
  159.    PQT
  160.  
  161. -----------------------------------------------------------
  162.  
  163. FIND PND
  164. *** Mark cursor position
  165.    F##{CTRL-G}a#
  166.    YN
  167. *** Return to position, backward direction
  168.    E
  169.    F#{CTRL-G}a##
  170.    YN
  171. *** Put a mark at beginning of line
  172.    F#%#%{CTRL-G}a#
  173.    YN
  174. *** Put the line into string $A
  175.    PLS##%{CTRL-G}a#%#N=$A
  176. *** Search forward from the beginning of the file to find
  177. *** matching string
  178.    B
  179.    F/$A/
  180.    N
  181. *** Get cursor into lower window
  182.    YY
  183. *** Remove the mark
  184.    F#{CTRL-G}a##
  185.    YN
  186. *** Turn on display
  187.    PYD
  188. *** Switch to upper window and cursor
  189.    Y
  190.    PQT
  191.  
  192. -----------------------------------------------------------
  193.  
  194. MARK P
  195. *** Undo split screen, if any
  196.    YN
  197. *** Turn off display
  198.    PND
  199. *** Mark cursor position
  200.    F##{CTRL-G}a#
  201.    YN
  202. *** Remove any existing marks
  203.    PPR{CTRL-G}l==> Removing any existing marks....
  204.    B
  205.    F#{CTRL-G}&%##A
  206.    P
  207. *** Put carriage return at beginning
  208.    B
  209.    F##%#
  210.    YN
  211. *** Come back to cursor position with forward search
  212. *** direction
  213.    F#{CTRL-G}a##
  214.    YN
  215. *** Move backward one character
  216.    D
  217.    F#&#&#
  218.    YN
  219. *** Write message
  220.    PPR{CTRL-G}l==> Marking....
  221. *** Search backward, place mark 1 at beginning of nearest
  222. *** headline
  223.    F#%-#%{CTRL-G}1%-#
  224.    YN
  225. *** If a headline was found, preceeded by carriage-return
  226. *** then go on
  227.    PGO HOK
  228. *** Else put mark 1 at beginning of file
  229.    F##%{CTRL-G}1#
  230.    YN
  231. *** Set headline level $A to maximum
  232.    PAS------=$A
  233.    PGO MK1
  234. *** Compute headline level
  235. HOK PLS##{CTRL-G}1%# #N=$A
  236. *** Move cursor forward just beyond mark
  237. MK1 B
  238.    F#{CTRL-G}1%#{CTRL-G}1%#
  239.    YN
  240. *** Look for next headline and mark it with mark 2
  241. HEAD F#%-#%{CTRL-G}2%-#
  242.    YN
  243. *** If a headline was found, then go check its level
  244.    PGO CHECK
  245. *** Else put mark 2 at end of file, and go on the exit
  246. *** routine
  247.    F##{CTRL-G}2%#
  248.    YN
  249.    PGO EXIT
  250. *** Back up before mark
  251. CHECK D
  252.    F#{CTRL-G}2%#
  253.    N
  254.    D
  255. *** Remove mark if marked headline has more dashes than
  256. *** starting headline
  257.    F#{CTRL-G}2%$A-#$A-#
  258.    YN
  259. *** And then proceed to next headline
  260.    PGO HEAD
  261. *** Else marking is done, so exit
  262. EXIT B
  263. *** Remove initial carriage return
  264.    F#%##
  265.    YN
  266. *** Position cursor at beginning of marked text
  267.    F#{CTRL-G}1%#{CTRL-G}1%#
  268.    N
  269. *** Turn display back on
  270.    PYD
  271. *** Return to routine MOTE if $C is MOTE
  272.    PCS/$C/MOTE/
  273.    PDO $C
  274.    PQT
  275.  
  276. -----------------------------------------------------------
  277.  
  278. UNMARK PND
  279. *** Mark cursor location
  280.    F##{CTRL-G}a#
  281.    YN
  282. *** Remove all marks and following carriage-return
  283.    PPR{CTRL-G}l==> Removing marks....
  284.    B
  285.    F#{CTRL-G}&%##A
  286.    P
  287. *** Return to original cursor position
  288.    B
  289.    F#{CTRL-G}a##
  290.    YN
  291. *** Turn display back on and quit
  292.    PQT
  293.  
  294. -----------------------------------------------------------
  295.  
  296. MOVE PND
  297. *** Copy everything between marks to cursor location
  298.    PPR{CTRL-G}l==> Copying material....
  299.    L##{CTRL-G}1%#{CTRL-G}2#N
  300. *** Go delete moved material
  301.    PDO DELETE
  302.  
  303. -----------------------------------------------------------
  304.  
  305. COPY PND
  306. *** Copy everthing between marks to cursor location
  307.    PPR{CTRL-G}l==> Copying material....
  308.    L##{CTRL-G}1%#{CTRL-G}2#N
  309.    P
  310. *** Mark cursor position
  311.    F##{CTRL-G}a%#
  312.    YN
  313. *** Remove marks
  314.    B
  315.    F#{CTRL-G}&##A
  316.    P
  317. *** Delete outline, if any
  318.    PDO DELO
  319.  
  320. -----------------------------------------------------------
  321.  
  322. DELETE PND
  323. *** Mark cursor position
  324.    F##{CTRL-G}a%#
  325.    YN
  326. *** Find mark 2
  327.    E
  328.    F#{CTRL-G}2#
  329.    N
  330. *** If mark 2 exists, go on
  331.    PGO LOOP
  332. *** Else nothing to delete, so exit
  333.    PGO ERROR
  334. *** Search backward for mark 1
  335. LOOP F#{CTRL-G}1#
  336.    N
  337.    PGO DELOK
  338. *** If no mark found then deletion is done
  339.    PGO DELDONE
  340. *** Print message
  341. DELOK PPR{CTRL-G}l==> Deleting ...
  342. *** Forward direction
  343.    D
  344. *** Find mark 2
  345.    F#{CTRL-G}2#
  346.    N
  347. *** Reverse direction
  348.    D
  349. *** Delete a paragraph
  350.    X
  351. *** Go back and delete some more
  352.    PGO LOOP
  353. *** Remove mark 2
  354. DELDONE D
  355.    F#{CTRL-G}2##
  356.    YN
  357. *** Erase old outline
  358.    PDO DELO
  359. *** Error exit
  360. ERROR PPR {CTRL-G}lMarks missing or not in order.
  361.    PIN     (Press RETURN)
  362. *** Restore cursor position
  363.    B
  364.    F#{CTRL-G}a##
  365.    YN
  366.    P
  367.    PQT
  368.  
  369. -----------------------------------------------------------
  370.  
  371. PROMOTE PND
  372. *** Set up return to MOTE when done with marking
  373.    PASMOTE=$C
  374. *** Set up for deleting a dash
  375.    PAS=$D
  376. *** Go mark text; do MOTE when done
  377.    PDO MARK
  378.  
  379. -----------------------------------------------------------
  380.  
  381. DEMOTE PND
  382. *** Set up return to MOTE when done with marking
  383.    PASMOTE=$C
  384. *** Set up for adding a dash
  385.    PAS--=$D
  386. *** Go mark text; do MOTE when done
  387.    PDO MARK
  388.  
  389. -----------------------------------------------------------
  390.  
  391. MOTE PND
  392. *** Erase string $C
  393.    PAS=$C
  394. *** Put cursor at mark 1
  395.    F#{CTRL-G}1#{CTRL-G}a#
  396.    YN
  397.    PGO MOK
  398. *** If mark 1 doesn't exist, just exit
  399.    PQT
  400. MOK PPR{CTRL-G}l==> Adjusting headline levels....
  401. *** Move mark 1 to next headline
  402. LOOP F#%-#%{CTRL-G}1%-#
  403.    YN
  404.    P
  405. *** Check if beyond mark 2
  406.    F#{CTRL-G}2#
  407.    N
  408. *** If not, go back and adjust
  409.    PGO MADJ
  410. *** If so then done
  411.    PGO MDONE
  412. MADJ D
  413. *** Adjust dashes at mark 1
  414.    F#{CTRL-G}1#
  415.    N
  416.    D
  417.    F#{CTRL-G}1%-#$D#
  418.    YN
  419.    PGO LOOP
  420. MDONE B
  421. *** Remove marks
  422.    F#{CTRL-G}&%##
  423.    YYYN
  424.    P
  425. *** Erase outline
  426.    PDO DELO
  427.  
  428. -----------------------------------------------------------
  429. POUT PND
  430. *** Look for outline section
  431.    B
  432.    F#%- !!#%- !!#
  433.    YN
  434. *** If found, go on
  435.    PGO POUT1
  436. *** Else print message and exit
  437.    PIN{CTRL-G}lNo outline exists (press RETURN)
  438.    PGO POUT2
  439. POUT1 P
  440. *** Turn on printing at outline, after formfeed
  441.    PPR{CTRL-G}l==> Marking outline for printing....
  442.    F#%-#%.ff%.ep1%-#
  443.    YN
  444.    P
  445. *** Turn off printing at beginning of document
  446.    B
  447.    F##.ep0%#
  448.    YN
  449. *** Print it
  450.    PPR{CTRL-G}l==> Printing....
  451.    PNP
  452. *** Remove printing commands
  453.    PPR{CTRL-G}l==> Restoring document
  454.    B
  455.    F#.ep0%##
  456.    YN
  457.    F#.ff%.ep1%##
  458.    YN
  459.    P
  460. *** Reposition cursor
  461. POUT2 B
  462. *** Turn on display and quit
  463.    PQT
  464.  
  465. -----------------------------------------------------------
  466.  
  467. PTXT PND
  468. *** Get headline level for printing
  469.    PIN{CTRL-G}lOutline level to print? (enter dashes):=$D
  470. *** Insert CR at beginning of file
  471.    B
  472.    F##%#
  473.    YN
  474. *** Make comments of all lower level headlines
  475.    PPR{CTRL-G}l==> Removing unneeded headlines....
  476.    B
  477.    F#%$D-#%. $D-#A
  478.    P
  479. *** Restore headlines which are also text
  480.    B
  481.    F#%. - "#%. - "{CTRL-G}a%#A
  482.    P
  483.    B
  484.    F#%. -- "#%. -- "{CTRL-G}a%#A
  485.    P
  486.    B
  487.    F#%. --- "#%. --- "{CTRL-G}a%#A
  488.    P
  489.    B
  490.    F#%. ---- "#%. ---- "{CTRL-G}a%#A
  491.    P
  492.    B
  493.    F#%. ----- "#%. ----- "{CTRL-G}a%#A
  494.    P
  495.    B
  496.    F#%. ------ "#%. ------ "{CTRL-G}a%#A
  497.    P
  498. *** Turn off printing of outline, if any
  499. OUTOFF B
  500.    F#%- !!#%.ep0%- !!#
  501.    YN
  502.    P
  503. *** Print
  504.    PPR{CTRL-G}l==> Printing....
  505.    PNP
  506.    PPR{CTRL-G}l==> Restoring document...
  507. *** Fix up text headlines
  508.    B
  509.    F#"{CTRL-G}a%#"#A
  510.    P
  511. *** Remove comments
  512.    B
  513.    F#. -#-#A
  514.    P
  515. *** Remove print disable
  516.    E
  517.    F#.epo%##A
  518.    P
  519. *** Remove extra CR at beginning
  520.    B
  521.    F#%##
  522.    YN
  523. *** Turn on display and quit
  524.    PQT
  525.  
  526. -----------------------------------------------------------
  527.  
  528. SOUT PND
  529. *** Look for outline section
  530.    PPR{CTRL-G}lLooking for outline....
  531.    B
  532.    F#%- !!#%- !!#
  533.    YN
  534. *** If found, go on
  535.    PGO SOUT1
  536. *** Else print message and exit
  537.    PIN{CTRL-G}lNo outline exists (press RETURN)
  538.    PGO SOUT2
  539. *** Get saving file name
  540. SOUT1 PIN {CTRL-G}lFilename for saving outline? =$B
  541. *** If none, exit
  542.    PCS/$B//
  543.    PGO SOUT2
  544.    P
  545. *** Go to first headline of outline
  546.    F#%-#
  547.    N
  548.    P
  549. *** Save segment to end of outline
  550.    PPR{CTRL-G}l==> Saving outline into  $B ....
  551.    S$B#!!%#
  552.    YES
  553. SOUT2 B
  554. *** Turn display back on and quit
  555.    PQT
  556.  
  557. -----------------------------------------------------------
  558.  
  559. STXT PND
  560. *** Print warning message
  561.    PPR {CTRL-G}l Note:{CTRL-G}l
  562.    PPR  This command will erase your
  563.    PPR  document in memory.
  564.    PIN  Have you saved it? (Y/N) =$A
  565. *** Check for yes answer to query
  566.    PCS/$A/Y/
  567.    PGO STXT1
  568.    PCS/$A/y/
  569.    PGO STXT1
  570.    PGO STXT2
  571. *** Get saving file name
  572. STXT1 PIN{CTRL-G}l File for saving text? =$B
  573. *** If none, exit
  574.    PCS/$B//
  575.    PGO STXT2
  576. *** Get headline level to save
  577.    PIN{CTRL-G}lHeadline level to save? (enter dashes):=$D
  578. *** Find and erase outline section
  579.    PPR{CTRL-G}l==> Erasing old outline, if any....
  580. *** Move back 3 CRs from end of file
  581.    E
  582.    F#%#%#
  583.    YYYYN
  584. *** Look forward for end of outline
  585.    D
  586.    F#%- !!#
  587.    N
  588. *** If found, go delete whole outline
  589.    PGO DEL0
  590. *** Else done
  591.    PGO DEL1
  592. *** Find end of document
  593. DEL0 D
  594.    F#%- !!#
  595.    YN
  596.    PGO DEL
  597.    PGO DEL1
  598. *** Delete all characters
  599. DEL D
  600.    F#&##A
  601. DEL1 P
  602. *** Put carriage return at start
  603.    B
  604.    F##%#
  605.    YN
  606. *** Mark headlines of lower level
  607.    PPR{CTRL-G}l==> Removing unneeded headlines....
  608.    B
  609.    F#%$D-#%{CTRL-G}a$D-#A
  610.    P
  611. *** Restore text headlines
  612.    PPR{CTRL-G}l==> Restoring text headlines
  613.    B
  614.    F#{CTRL-G}a- "##A
  615.    P
  616.    B
  617.    F#{CTRL-G}a-- "##A
  618.    P
  619.    B
  620.    F#{CTRL-G}a--- "##A
  621.    P
  622.    B
  623.    F#{CTRL-G}a---- "##A
  624.    P
  625.    B
  626.    F#{CTRL-G}a----- "##A
  627.    P
  628.    B
  629.    F#{CTRL-G}a------ "##A
  630.    P
  631. *** Delete marked headlines
  632.    B
  633.    F#{CTRL-G}a$%##A
  634.    P
  635. *** Remove initial carriage return
  636.    B
  637.    F#%##
  638.    YN
  639. *** Save what's left
  640.    PPR{CTRL-G}lSaving into  $B ....
  641.    S$B
  642.    YES
  643. *** Clear buffer
  644.    NY
  645. *** Go to single window
  646. STXT2 Y
  647.    YN
  648. *** Turn on display and quit
  649.    PQT
  650.  
  651. -----------------------------------------------------------
  652.