! Scope Editor for use with Heath H19, or Zenith Z19 terminals ! ! ! ! AUTHOR: Paul Mennen (many ideas stolen from VTEDIT.TEC) ! ! DATE: 03-Mar-84 ! ! ! ! unsquished version stored on: H19.TES ! ! squished version is stored on: H19.TEC (runs much faster than unsquished version) ! ! ! ! Note: H19.TEC must be invoked by TECO.INI so that macros Q5 and Q6 and some flags get set up properly ! ! ! ! On the H19 terminal, the following strip should be put above the top row of keys to identify their use: ! ! (this identifies keys f1 thru white box) ! ! ! ! 24-UP UP DOWN LEFT RIGHT 24-DOWN SAVE COMND UNSAVE ! ! ! ! The seperate 12 key keypad of the H19 terminal should be identified as follows ! ! ! ! ! ! |--------|--------|--------| ! ! | | | | ! ! | OPEN | PAGE | PAGE | ! ! | | | SEARCH | ! ! | | | | ! ! |--------|--------|--------| ! ! | | | | ! ! | UP | DEL | DEL | ! ! | LINE | CHAR | LAST | ! ! | | | | ! ! |--------|--------|--------| ! ! | | | | ! ! | TOP | BOTTOM | START | ! ! | | | OF LINE| ! ! | | | | ! ! |--------|--------|--------| ! ! | | | | ! ! | DOWN | SEARCH | SEARCH | ! ! | LINE | AGAIN | | ! ! | | | | ! ! |--------|--------|--------| ! ! ! ! ! ! The only other key which should be labled is the back space key (END LINE). ! ! A brief description of all other commands can be called up while running this macro by typing T ! ! Thus no other reference should be needed once the keys are labled as described above ! ! ! ! Notes on the use of the command key: ! ! All searches which are entered via normal teco commands (i.e. using the command key) should be colon ! ! modified searches. You may leave out the colon, but then if the search fails, teco will exit from the H19.TEC ! ! macro, at which point you would have to type EITECO.INI$$ to get back into the scope editor. ! ! for example - Command: 7<:FSA1$A2$>$$ will change 7 occurances of A1 to A2 without bombing if the search fails. ! ! ! ! You may use any Q register except Q2 thru Q9 in teco commands entered via the command key. ! ! ! ! To squish this macro, use: *EISQU$$ and answer the 7 questions as follows: N,Y,Y,Y,N,Y,N. This sets up squish to: ! ! Set line size to 70, delete lexical tabs, delete comments, no watch, auto mode, dissallow adjacent escapes ! ! ! ! ******* Q-register usage ****** (note Q4# refers to the numeric storage component of Q-register 4) ! ! ! ! Q2 = storage of user filespec buffer ! ! Q2# = not used ! ! Q3 = text in paste buffer (save, unsave keys) ! ! Q3# = position of right hand margin (default=78) ! ! Q4 = text for user prompt for search and command keys ! ! Q4# = pointer for save command (position of start of saved text + 1) ! ! Q5 = macro for typing escape sequences ! ! Q5# = command repitition count ! ! Q6 = macro to get teco command or search argument from user ! ! Q6# = line position for use with up and down arrow commands ! ! Q7 = text deleted by last ^K, ^U, ^D, or ^E ! ! Q7# = ascii code of last character recieved from user ! ! Q8 = storage of user search string ! ! Q8# = scratch ! ! Q9 = storage of user teco command string ! ! Q9# = scratch ! ! ! ! EFFECTS OF CONTROL CHARACTERS UNDER H19.TEC ! ! ! ! A append n pages of text from the input file (with form feeds) ! ! B close output file and do edit backup of last specified file ! ! C cause teco to abort ! ! D removes n lines from . not including last CR,LF ! ! E deletes n words following . ! ! F move pointer forward n words ! ! G move pointer forward 15 characters ! ! H (backspace key) move pointer to end of nth line past . ! ! I (tab key) insert a tab into buffer ! ! J insert a line feed into buffer ! ! K removes n lines from . ! ! L inserts a form feed into buffer ! ! M inserts a carriage return into buffer ! ! N inserts Q8 (last search string) into buffer n times ! ! O intercepted by RT11, stops terminal output ! ! P insert last text deleted by a ^K, ^D, ^U, ^E command ! ! Q intercepted by RT11, continues terminal output ! ! R move backwards n words (if n=0, go to start of current word) ! ! S intercepted by RT11, stops terminal output ! ! T list control character usage (type any character to continue) ! ! U delete from beginning of line to . ! ! V toggle seeall mode ! ! W not used ! ! X move pointer backwards 15 characters ! ! Y yank n-1 pages [Esc 2 ^Y will yank 1 page] (gives protection) ! ! Z exit from this macro ! ! ! ! ! ! EFFECTS OF ESCAPE SEQUENCES UNDER H19.TEC ! ! ! ! ESC double esc executes previously entered red key command n times ! ! 0-9 escape followed by digits will set command repeat count ! ! ? all keypad keys (except arrows) echo ESC ? x ! ! @ *** available for future options *** ! ! A,a (up arrow key) move pointer to same position n lines up ! ! B,b (down arrow) move poiner to same position n lines down ! ! C,c (right arrow) move pointer forward n characters ! ! D,d (left arrow) move pointer backwards n characters ! ! E,e insert ascii n to buffer, or insert next key if n not specified ! ! F,f fill n lines with as many words as possible withen right margin ! ! G,g *** available for future options *** ! ! H,h *** available for future options *** ! ! I,i insert blanks between words to justify n lines to right margin ! ! J,j (erase key on H19) move pointer down by 24 times n lines ! ! K,k kill excess spaces (unjustify) ! ! L,l *** available for future options *** ! ! M,m set right hand margin position to n (initialized to 78) ! ! N,n *** available for future options *** ! ! O,o *** available for future options *** ! ! P,p (blue key) save n lines in paste buffer ! ! Q,q (red key) enter teco command and execute ! ! R,r (grey key) insert saved text into buffer n times ! ! S,s (f1 key on H19) move pointer up by 24 times n lines ! ! T,t (f2 key on H19) same as ESC A or up arrow ! ! U,u (f3 key on H19) same as ESC B or down arrow ! ! V,v (f4 key on H19) same as ESC D or left arrow ! ! W,w (f5 key on H19) same as ESC C or right arrow ! ! X,x close output file and exit from teco ! ! Y,y *** available for future options *** ! ! ! ! ! ! EFFECTS OF KEYPAD KEYS UNDER H19.TEC ! ! ! ! 0 move pointer to beginning of n th line following . ! ! 1 move pointer to top of buffer (beginning of buffer) ! ! 2 move pointer to the end of buffer ! ! 3 move pointer to the start of the current line ! ! 4 move pointer to beginning of n th previous line ! ! 5 delete n characters following . ! ! 6 delete last string searched for or saved with blue key ! ! 7 insert n carriage returns into the buffer ! ! 8 output buffer to file and read in next input page ! ! 9 same as . (search again) except will advance pages to find it ! ! ENTER get search arguement from user and search for nth occurance ! ! . search for the nth occurance of the last used search string ! ! ! :Q2"E G* ^YX2 ^YK ' ! get user filespec into buffer, put into Q2, then remove it from buffer ! @EI%% ! prevent teco from reading characters after the ESC,ESC ! < ! this iteration loop is included only for speed reasons ! !A! 0U4 0U6 !B! 1U5 ! clear Q4# and Q6#, set Q5# (command repeat count) to 1 ! 0,32ET ^TU7 32,0ET ! set no wait mode, get character if typed, reset to wait mode ! Q7"L -1W ^TU7 ' ! if there wasnt a caracter, refresh screen and wait for next character ! !V! Q7-127"E ."N -D ' @O!A! ' ! delete key: delete previous character if not at top of buffer ! Q7-27"G ^^@M5 Q7@I%% Q7^T ^^OM5 0,32ET ! if Q7#>ESC, insert Q7# into buffer, put char on screen using terminal ! 300<^TU7 Q7;> 32,0ET Q7"L -1W ^TU7' @O!V! ' ! insert character mode (enter mode with ESC @ and exit with ESC O) ! 64+Q7U7 @O!C^EU7! ! adding 64 to Q7# gives a character between @ and [, do a 28 way jump ! !C[! ^TU7 ! escape character comes here, get the next character ! Q7-96"G Q7-^^z"L Q7-32U7 ' ' ! if ESC a thru ESC y, convert it to ESC A thru ESC Y ! Q7-^^Y"G @O!A! ' ! ignore ESC Z and greater ! Q7-^^>"G @O!E^EU7! ' ! if its ESC ? thru ESC Y go do a 27 way jump ! Q7-27"E Q5 @O!C! ' ! if its ESC ESC execute previous teco command Q5# times, restore flags ! Q7"D 0U5 < Q5*10+Q7-^^0U5 ^TU7 Q7"D > ' @O!V! ' ! ESC followed by a string of digits, will set Q5# for repeat count ! @O!A! ! ignore all other escape sequences ! !EC! !EW! Z-.-Q5"L ZJ | Q5C ' @O!A! ! f5 or right arrow key: advance Q5# characters (to end if cant) ! !ED! !EV! .-Q5"L J | Q5R ' @O!A! ! f4 or left arrow key: backup Q5# characters (to start if cant) ! !CR! Q5<."NR' -1:@S/^N^S/ ."NR' -1:@S/^S/> @O!A! ! control R: search backwards first for a symbol then for a separator ! !E?! ^T&31#32U7 ! all keypad keys (ESC ? x) come here, get x, set bit 5, clear bits 6,7 ! Q7-045"E @^U4%Search: % M6"F @O!A! ' ! enter key: prompt user for search arg ended by ESC ESC, if M6 returns T ! G4 ^Y-2X8 ^YK @O!S! ' ! then put users input into Q8 (except for last 2 escapes),go do search ! Q7-^^."L @O!A!' Q7-^^:"G @O!A!' ! discard command if Q7 is not between . and 9 ! @O!?^EU7! ! do a 10 way jump ! !?4! -Q5U5 !?0! Q5L @O!A! ! keypad 4: move pointer up Q5# lines, keypad 0: move down Q5# lines ! !?2! ZJ @O!A! ! keypad 2: move pointer to the end of the buffer ! !?1! J !?3! 0L @O!A! ! keypad 1: move to top of buffer, keypad 3: move to start of current line! !?5! Z-.-Q5"L .,ZK | Q5D ' @O!A! ! keypad 5: delete Q5# characters or rest of buffer if fewer remain ! !?6! @FR%% @O!A! ! keypad 6: delete # of characters in last search string or G command ! !?7! Q5< @13I// @10I// 2R> @O!A! ! keypad 7: insert Q5# carriage returns, move to 1st newly created line ! !?8! Q5P @O!A! ! keypad 8: execute page command Q5# times ! !?9! Q5:@N/^EQ8/^[ @O!A! ! keypad 9: same as keypad . but uses global search ! !?.! 0U6 !S! Q5:@S/^EQ8/^[ Q6"N Q6W ' @O!A! ! keypad .: search Q5# times for text in Q8, indicate screen altered ! !CJ! !CM! !CI! !CL! -64%7@I%% @O!A! ! control J,M,I,L: inserts line feed, CR, tab, form feed respectively ! !CF! Q5<:@S/^S/ 0A-10"E L | :@S/^N^ES/^[R'>@O!A! ! control F: search first for a separator then for a symbol ! !CG! 15U5 @O!EW! ! control G: move pointer forward 15 characters ! !CX! 15U5 @O!EV! ! control X: move pointer backwards 15 characters ! !EA! !ET! -Q5U5 ! ESC A,T (up arrow or f2) move up Q5# lines to same position ! !EB! !EU! ! ESC B,U (down arrow or f3) move down Q5# lines to same position ! Q6"E ! if Q6#=0 (1st time up/down arrow hit) do this to compute line position ! 0U7 .U8 0L ! clear #Q7 (relative position to tab stop), save ., go to start of line ! Q8-.%6< ! set Q6# to # of characters we just backed up and repeat loop Q6# times ! 0A-9"E 7-(Q7&7)%6 0U7 | %7 ' 1C > ' ! special processing for tabs ! Q5L -Q6U9 0U7 ! move up/down Q5# lines, #Q9=-#Q6, clear Q7# (relative position to tabs) ! Q6< .-Z; ! repeat loop Q6# times, quit here if were at end of buffer ! 0A-13"E 0; ' ! if next character is a carriage return, quit here ! 0A-9"E 7-(Q7&7)%9 0U7 | %7 ' 1C %9; > ! special processing for tabs ! 0U4 @O!B! ! remember that we just hit an up/down arrow key by not clearing Q6# ! !EQ! @^U4%Command: % M6"F @O!A! ' G4 ^YX9 ^YK ! red key: prompt user to enter teco command, put response into Q9 ! M9 Q6"N Q6W '! execute user command, restore all lines destroyed by prompt ! !C! ^D 0ED 225,542ET @O!A! ! set base to decimal, set up required ED and ET flags ! !ER! Q5 @O!A! ! grey key: insert paste buffer (Q3) into text Q5# times ! !EP! Q4"E .+1U4 ' ! blue key: if Q4=0 (1st time save key pressed), set Q4=.+1 ! Q5L Q4-1,.X3 Q4-1,.K G3 0U6 @O!B! ! advance Q5# lines, put text to save into X3, kill and restore it ! !ES! -Q5U5 ! ESC S (f1 key): move pointer up 24*Q5# lines ! !EJ! 24*Q5L @O!A! ! ESC J (erase key): move pointer down 24*Q5# lines ! ! ! !EF! Q5< 0L -1-Q3U9 0U7 .U6 ! ESC F: do fill loop Q5# times, get right margin, initialize Q7#,Q6# ! < 0A-9"E 7-(Q7&7)%9 0U7 | %7 ' ! do this loop until reaching right margin, first do tab processing ! 0A-13"E 2D @I% % R ' ! treat carriage returns as if they were spaces ! 0A-32"E Q9; .U6 ' C %9 > ! if space, exit loop if beyond margin, otherwise save . and continue ! Q6J D @13I// @10I// > @O!A! ! move to last space and replace it with a carriage return ! !EI! Q5< :@FB/^ES/ "S -Q3U9 0L ! ESC I: do justify loop Q5# times, dont attempt a line with no delims. ! <0A-13"E 0;' 0A-9"E 7%9 ' 1%9 1C>! this loop counts characters in the line, treating tabs as 8 characters ! 0L<:@FB/^ES/"S Q9; @I% % %9 | 0L'> 'L> @O!A! ! continually search for word delims., inserting blanks until line full ! !EK! Q5<<:@FC%^ES% %"F 0;'>L> @O!A! ! ESC K: change all word delimiters to 1 blank, do Q5# lines ! !EM! Q5U3 @O!A! ! ESC M: set right margin position to Q5# ! !EE! Q5-1"E ^TU5 ' Q5@I%% @O!A! ! ESC E: if Q5#=1 insert next key, otherwise insert ascii Q5# to buffer ! !CA! ZJ Q5<^E"T 12@I%% ' A> @O!A! ! control A: append Q5# pages inserting form feeds if form feed flag set ! !CB! EC :@EB/^EQ2/^[ Y @O!A! ! control B: close output file, do edit backup on last used file, do yank ! !CD! Q5X7 .,.+:Q7-2X7 .,.+:Q7K @O!A! ! control D: save into Q7 and kill Q5# lines except last 2 characters ! !CF! Q5<:@S/^S/ 0A-10"E L | :@S/^N^ES/^[R'>@O!A! ! control F: search first for a separator then for a symbol ! !CE! .U4 Q5<:@S/^S/ 0A-10"E L | :@S/^N^ES/^[R'> ! control E: save current position, advance Q5# words ! .-Q4"G Q4,.X7 Q4,.K | ZJ' @O!A! ! then save text in Q7 befor deleting it ! !CH! Q5L .-1"G 2R ' @O!A! ! control H (backspace): move Q5# lines, backup 2 places (end of line) ! !CN! Q5 @O!A! ! control N: insert text in Q8 (search buffer) Q5# times ! !CK! Q5X7 Q5K @O!A! ! control K: save Q5# lines into Q7 and kill them from buffer ! !CP! G7 @O!A! ! control P: insert Q7 text into buffer (restore deleted text) ! !CU! 0X7 0K @O!A! ! control U: save into Q7 and kill text from start of current line to . ! !CV! -1-(3:W),3:W @O!A! ! control V: if seeall mode = 0, set to -1, if it's -1, set to 0 ! !CY! Q5-1 @O!A! ! control Y: yank Q5#-1 pages ignoring yank protection status ! !CT! ^^EM5 @^A% * ^A Append page * Esc E Enter Quote ^B Backup file * Esc F Fill line ^C abort teco * Esc I justify margins * ^D Delete line * Esc K unjustify * ^E Eliminate word * Esc M set right Margin * ^F Forward word Esc X close file and eXit ^G Go forward 15 * ^K Kill line ^L insert form feed * ^N iNsert last search arg ^P Put back deleted text * ^R Reverse word ^T Talk about commands HIT SPACE TO GET RID OF THIS TEXT ^U delete from start of line ^X reverse 15 char * ^Y Yank n-1 pages ^Z exit this macro * allows numeric argument % ^TU7 @O!A! ! control T: type the above message, type any character to continue ! !CC! !CO! !CQ! !CS! !CW! ! unused control characters ! !E@! !EG! !EH! !EL! !EN! !EO! !EY! @O!A! ! unused escape sequences ! > ! this iteration loop is used because it speeds up the execution ! !EX! !CZ! 0,16ET ! come here to exit macro, set mode to cancel ^O ! ^^>M5 ^^YM5 23+32^T 32^T ^^KM5 ! type ESC > (exit alt. keypad mode) ESC Y (direct cursor addressing) ! ! and go to last line (line 23) and first column, type ESC K (erase line) ! Q7-^^X"E EX ' ! if user typed ESC X, also do an exit from teco !  ! there are two unprintable ESC's on this line !