Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap5_198111 - decus/20-0145/ante.ve
There are no other files named ante.ve in the archive.
!	VE is an ANTE macro that supports simple two-dimensional editing.
VE fundamentally does no more than execute common ANTE commands while
maintaining a correct image of the edited text.
	Unlike some other video editors, VE is normally in command mode rather
than insert or replace mode -- commands are normal characters and inserts are
ended with escapes.  VE is thus of the serial keystroke (as opposed to parallel
keystroke) school.  It is meant for people who prefer hitting a few keys in a
row rather than a few keys all at once.  For extended inserts the cursor and
edit keys can be made available by entering long insert mode.

  ANTE commands that are unchanged in VE
	+-c
	+-d
	i...
	+-k
	0k
	:k
	+-n
	+-o
	+-r...
	+-s...
	#v (if an argument is given it becomes the default window size)
	#<backspace> (-l) (takes a numeric argument)
	#<linefeed> (l) (takes a numeric argument)
	#<control-l> (-n) (takes a numeric argument)
	#<control-n> (n) (takes a numeric argument)
  ANTE commands that are modified in VE
	g	get text saved by p and x
	m...	execute string as a macro
	p	save text last deleted, adding to other saved text
	q	jump to saved .
	t	redisplay current line
	u	save .
	x	save text last deleted, replacing other saved text
	[	0l
	]	:l
	\	0j and v
	/	zj and v
  display commands
	+-w	adjust window up/down without moving cursor
	#<	-(5)l and v
	#>	(5)l and v
	#~	move backward in window lengths, and v
	#+	move forward in window lengths, and v
  other commands
	a...	0li<cr><lf>...
	#b	-c
	e	exit from VE
	+-f	execute last r command again
	y	delete text from saved . to current .
  cursor and edit key translations
	cursor up	-l
	cursor down	l
	cursor right	c/n
	cursor left	-c/-n
	home		change cursor right/left mode
	tb set		0l
	tb clr		:l
	clear page	v
	clear eop	o
	clear eol	:k
	shift clear eol	0k
	del line	k
	insrt line	a
	del char	d
	insrt char	test for long insert mode
	xmit line	s
	xmit msg	r
	xmit page	f
	print		enter/exit long insert mode
  notes
	commands may be in either upper or lower case
	+- indicates a positive or negative numeric argument
	# indicates a positive numeric argument
	... indicates a string argument
	The insrt char key verifies that VE is in long insert mode -- the
	 terminal will beep if it is not.
	After the macro given to the M command is executed, VE pauses to allow
	 inspection of possible output.  VE continues after any character is
	 typed.  If a space is typed VE will attempt to return to the old
	 window; otherwise VE will execute a v command.


	The VE macro is divided up into five main parts.  The main loop,
occupying a qreg chosen by the user, inputs commands and dispatches to the
appropriate command macro.  The command macros reside in four qregs.
V contains the display macro (T, V, W), J contains the movement macro
(B, C, H, J, L, N), I contains the text input macro (used by A, I, M, R, S),
and C contains all other commands.  V is referenced by C, I, and J;  I and J
are referenced by C.  There are no interdependencies between commands other
than these, except for R, which uses D and G in turn.
	The major reason for VEs relative simplicity is in its not keeping
track of the contents of the screen (how many and which lines are displayed,
where the cursor is).  When it needs such knowledge it uses the read XY feature
of the terminal to determine the cursor position and assumes a full screen of
text (M, R-S, ~, +, display macro).

  storage usage
	c value -- command character
	c text -- main command macro
	d value -- saved argument to j and v macros
	d text -- text last deleted
	g value -- u-saved position
	g text -- p-x-saved deleted text
	i value -- i macro temporary
	i text -- input macro
	j value -- i macro temporary
	j text -- movement macro
	n value -- numeric argument to command
	r value -- long insert flag
	r text -- replace string
	s value -- cursor char/word flag
	s text -- search string
	v value -- window size
	v text -- diplay macro
	w value -- window offset
	9, 8, 7 -- general temporaries
  Teleray controls output by VE
	$A		cursor up
	$H		home up
	$J		clear eop
	$K		clear eol
	$L		insert line
	$M		delete line
	$P		insert char
	$Q		delete char
	$R		set text mode
	$Y		set X Y
	$a		read X Y
  prune macro -- the next 5 lines produce a compressed VE
    j a9 hk 033fi fa < /s/!/ .-1u9 @s9 q9,.k > /fts/comments.../
    j a9 hk 015fi 012fi fa < @fd9 > /fts/lines.../
    j a9 hk 040fi 033fi fa a8 hk 0fi fa < @r98 > /fts/nullsin.../
    j a9 hk 040fi fa < @fd9 > /fts/spaces.../
    j a9 hk 040fi 033fi fa < @r89 > /fts/nullsout.../ 015fto 012fto

0fte 0ur 1us 012uv 0uw #Vuc 1un
!** commands ** ac hk /i^
    [
      [ !F and R and S [ qc-#Ffce qc-#Rfce qc-#Sfce 0,2fce ]
        a9 hk -1/fts/a/ /i/Y/ fti fi fti fi fa
        ! get arguments
        [ qc-#Rfcn -1/fts/Y3 J RDReplace R@/ 012fto 015fto
          as hx8 mi fa -1/fts/RDwith R@/ 012fto 015fto
          ar hk mi fa -1/fts/RD$ R@Y3 J/ ]
        [ qc-#Sfcn -1/fts/Y3 J RDSearch R@/ 012fto 015fto
          as hx8 mi fa -1/fts/RD$ R@Y3 J/ ]
        [ qc-#Ffcn #Ruc ]
        ! search
        [ .u9 1u7
          [ fzsfcn fz8,2fce fm8s ]
          qn@fns u7 ]
        ! position cursor
        [ q7fce [ .-q9fcn -1@fts9 ] [ .-q9fce 0mv ] 07,-1fto 0,3fce ]
        .u8 a9 0j 2c fo-037u7 fa q9j
        [ [ !backwards
            qnfcg -q7+1l q8-.fcl
            q9j -1@fts9
            0u7 q9-q8< -c [ fo-012fcn %7 ] >
            q7< -1/fts/A/ > 015fto 0t 0,2fce ]
          [ !forwards
            qnfcl 2,qvf*-1-q7l :l .-q8fcl
            q9j -1@fts9
            0u7 q8-q9< [ fo-012fcn %7 ] c >
            q7< -1/fts/B/ > 015fto 0t 0,2fce ]
          q8j 0mv ]
        qc-#S,2fce fzsun #Bmj ]
      [ !:K qc-#:fcn :xd -1/fts/K/ 0,2fce ]
      [ !A qc-#Afcn
        -1/fts/L/ 0l 015fi 015fto 012fi 012fto -l -1/fts/A/ mi 0,2fce ]
      [ !D and O and R
        [ qc-#Dfce qc-#Ofce qc-#Rfce 0,2fce ]
        [ ! negative deletion -- move back and delete forward
          qnfcg -qnun
          [ qc-#Dfcn #Bmj ]
          [ qc-#Ofcn .u9 #Lmj #Duc q9-.un ] ]
        .u9
        [ [ qc-#Dfce qc-#Rfce 0,2fce ] qnc fo-012fcn -c fou8 c q8-015fcn c ]
        [ qc-#Ofcn qnn ]
        [ .u8 q9j :l
          [ .-q8+1fcg
            q8j < -1/fts/M/ -l .-q9-1fcl > q9j q9,q8xd #vmv 0,2fce ]
          [ .-q9< -c fo-011,2fce > q9,q8xd q8-q9<-1/fts/Q/> 0,2fce ]
          q9j q9,q8xd #vmv ]
        qc-#R,2fcn ]
      [ !G and R [ qc-#Gfce qc-#Rfce 0,2fce ]
        .u9
        [ qc-#Gfcn fzg,2fce gg ]
        [ qc-#Rfcn fzr,3fce gr ]
        .u8 q9j 0l .u9 0u7 q8-q9< [ fo-012fcn %7 ] c >
        q7< -1/fts/L/ 040<0177,-1fto> > 015fto q9,q8t #vmv 0,2fce ]
      [ !I qc-#Ifcn mi 0,2fce ]
      [ !i (long insert) qc-#ifcn
        < mi ftiuc qc-#O,3fce
          [ [ qc-#Afcn #Hmj 0,2fce ]
            [ qc-#Bfcn #Jmj 0,2fce ]
            [ qc-#Cfcn [ qsfcl #Cmj ] [ qsfcg #Nmj ] 0,2fce ]
            [ qc-#Dfcn [ qsfcl #Bmj ] [ qsfcg #Lmj ] 0,2fce ]
            [ qc-#Hfcn -qsus 0,2fce ]
            [ qc-#Pfcn 0,2fce ]
            1ur 0,4fce ] > ]
      [ !K qc-#Kfcn
        fkd
        [ ! negative deletion -- move back and delete forward
          qnfcg -qnun 0xd 015fto -1/fts/K/ :t 015fto -1%n qn,3fce #Hmj ]
        qn< fxd -1/fts/M/ 040<0177,-1fto> > #vmv 0,2fce ]
      [ !M qc-#Mfcn
        a9 hk -1/fts/a/ /i/Y/ fti fi fti fi fa
        -1/fts/Y3 J RDMacro R@/ 012fto 015fto
        .u9 zu8 a8 hk < .u7 mi 033fi .-q7-1fce #$fto > fa -1/fts/RD$ R@/
        m8; ftiu7 -1/fts/Y3 J/
        [ ! use old display if . and z are unchanged and user confirms
          q9-.fcn q8-zfcn q7-040fcn -1@fts9 0,3fce ]
        0mv 0,2fce ]
      [ !P and X [ qc-#Pfce qc-#Xfce 0,2fce ]
        fzdfce ag [ qc-#Xfcn hk ] gd fa 0,2fce ]
      [ !Q qc-#Qfcn qgfce qgj 0mv 0,2fce ]
      [ !T qc-#Tfcn #vmv 0,2fce ]
      [ !U qc-#Ufcn .ug 0,2fce ]
      [ !V qc-#Vfcn [ qn-2fcl qnuv ] 0mv 0,2fce ]
      [ !W qc-#Wfcn qn+qwmv 0,2fce ]
      [ !Y qc-#Yfcn
        [ .-qgfcg .,qgxd ] [ qg-.fcg qg,.xd ] 0mv 0,2fce ]
      [ !< [ qc-#<fce qc-#,fce 0,2fce ] [ qn-1fcg 5un ] -qnl 0mv 0,2fce ]
      [ !> [ qc-#>fce qc-#.fce 0,2fce ] [ qn-1fcg 5un ] qnl 0mv 0,2fce ]
      [ !~ [ qc-#~fce qc-#`fce 0,2fce ]
        -2,qv-1f*u9 -1/fts/a/ fti-037u8 fti; q9-q8+qvl qn-1<q9l> 0mv 0,2fce ]
      [ !+ [ qc-#+fce qc-#=fce 0,2fce ]
        2,qv-1f*u9 -1/fts/a/ fti-037u8 fti; q9-q8+qvl qn-1<q9l> 0mv 0,2fce ]
      [ ![ [ qc-#[fce qc-#{fce 0,2fce ] 0l 015fto 0,2fce ]
      [ !] [ qc-#]fce qc-#}fce 0,2fce ] :l 015fto 0t 0,2fce ]
      [ !\ [ qc-#\fce qc-#|fce 0,2fce ] 0j 0mv 0,2fce ]
      [ !/ [ qc-#/fce qc-#?fce 0,2fce ] zj 0mv 0,2fce ]
      07,-1fto ]
^ fa
!** input ** ai hk /i^
    [ .ui 0uj :l .-qi< -c fo-011,2fce > 1uj ] qij
    < ftiui qi-033,2fce
      [ !<V> qi-026fcn ftiui ]
      [ [ !<A> and <H> and <rubout>
          [ qi-01fce qi-010fce qi-0177fce 0,2fce ]
          -c foui c
          [ qi-012fcn -d -c foui c [ qi-015fcn -d ] -1/fts/AM/ 022ui 0,2fce ]
          -d 015fto 0t
          [ [ qi-011fce qjfce 0,2fce ] :t -1/fts/K/ 015fto 0t 0,3fce ]
          -1/fts/Q/ 0,2fce ]
        [ !<tab> qi-011fcn 011fi #vmv 0,2fce ]
        [ !<linefeed> qi-012fcn -1/fts/K/ 015fi 015fto 012fi 012fto
          -1/fts/L/ 011fto 015fto :t 015fto 0,2fce ]
        [ !<R> qi-022fcn #vmv 0,2fce ]
        [ !<U> qi-025fcn 0l 015fto :k -1/fts/K/ 0,2fce ]
        qi-015fce qifi
        [ ! tab in remainder of line requires redisplay of line
          qjfcn qifto :t 015fto 0t 0,2fce ]
        -1/fts/P/ qifto ] >
^ fa
!** movement ** aj hk /i^
 ud [
      [ !B and L
        [ qd-#Bfce qd-#Lfce 0,2fce ]
        .u9
        [ qd-#Bfcn -qnc fo-012fcn -c fo-015fce c ]
        [ qd-#Lfcn -qnn ]
        .u8 q9j 0u7 q9-q8< -c [ fo-012fcn %7 ] > q7< -1/fts/A/ >
        015fto 0t 0,2fce ]
      [ !C and N [ qd-#Cfce qd-#Nfce 0,2fce ]
        .u9
        [ qd-#Cfcn qnc fo-012fcn -c fou8 c q8-015fcn c ]
        [ qd-#Nfcn qnn ]
        q9,.t 0,2fce ]
      [ !H qd-#Hfcn qn< 0l .u9 -l [ q9-.fce -1/fts/A/ ] 015fto > 0,2fce ]
      [ !J qd-#Jfcn qn< :l .u9 l 015fto [ .-q9fce 012fto] > 0,2fce ]
    ]
^ fa
!** display ** av hk /i^
   ud [ qd-#vfce
        qduw [ qdfcn [ .fcn qv-1ud ] [ z-.fcn -qvud ] ]
        -1/fts/HJ/ zfce 011fto 015fto
        -qv+qd+1t a9 hk -1/fts/a/ /i/Y/ fti fi fti fi fa
        qv+qdt -1/fts/RF/ -1@fts9 ]
      015fto 0t :t -1/fts/K/ 015fto 0t
^ fa
!** main loop **
  <
    [ ! command execution
      [ !B qc-#Bfcn #Bmj 0,2fce ]
      [ !C qc-#Cfcn #Cmj 0,2fce ]
      [ !E qc-#E,3fce ]
      [ !H qc-#Hfcn #Hmj 0,2fce ]
      [ !J qc-#Jfcn #Jmj 0,2fce ]
      [ !L qc-#Lfcn #Lmj 0,2fce ]
      [ !N qc-#Nfcn #Nmj 0,2fce ]
      mc ]
    ! command input
    0un 0u9
    [ qrfcn ftiuc
      [ !:K and 0K [ qc-#:fce qc-#;fce qc-#0fce 0,2fce ]
        ftiu8
        [ q8-#Kfce q8-#kfce 040uc 0,2fce ]
        [ qc-#;fcn #:uc ]
        qc-#:fce #Kuc -1un ! 0K is -1K, -nK is -(n+1)K ]
      [ !minus flag qc-#-fcn 1u9 ftiuc ]
      < !numeric argument qc-#0fcl qc-#9fcg qn,012f*un qc-#0%n ftiuc >
      [ !<cr> qc-015fcn #[uc ]
      [ !control char translation qc-032fcg qc+0100uc ]
      [ !lower case translation qc-#afcl qc-#zfcg qc-040uc ] ]
    [ qrfce qrfcg 0ur #iuc ]
    [ qrfce -1ur ]
    [ ! cursor and edit key translation
      [ qc-033fce qrfcl 0,2fce ]
      < qc-033fcn ftiuc >
      [ qc-#@fcn #Kuc -1un 0,2fce ]
      [ qc-#Afcn #Huc 0,2fce ]
      [ qc-#Bfcn #Juc 0,2fce ]
      [ qc-#Cfcn [ qsfcl #Cuc ] [ qsfcg #Nuc ] 0,2fce ]
      [ qc-#Dfcn [ qsfcl #Buc ] [ qsfcg #Luc ] 0,2fce ]
      [ qc-#Efcn #]uc 0,2fce ]
      [ qc-#Ffcn #[uc 0,2fce ]
      [ qc-#Hfcn -qsus #Tuc 0,2fce ]
      [ qc-#Ifcn #Ruc 0,2fce ]
      [ qc-#Jfcn #Ouc 0,2fce ]
      [ qc-#Kfcn #:uc 0,2fce ]
      [ qc-#Lfcn #Auc 0,2fce ]
      [ qc-#Mfcn #Kuc 0,2fce ]
      [ qc-#Ofcn #iuc 0,2fce ]
      [ qc-#Qfcn #Duc 0,2fce ]
      [ qc-#Zfcn #Fuc 0,2fce ]
      [ qc-#ifcn #Suc 0,2fce ]
      [ qc-#jfcn #Vuc 0,2fce ]
      040uc ]
    [ ! default argument qnfcn qc-#Wfce 1un ]
    [ ! negative argument q9fce
      [ qc-#Cfcn #Buc 0,2fce ]
      [ qc-#Nfcn #Luc 0,2fce ]
      [ qc-#Kfcn -qn-1un 0,2fce ]
      [ [ qc-#Dfce qc-#Ffce qc-#Ofce qc-#Kfce qc-#Rfce qc-#Sfce qc-#Wfce
          040uc 0,3fce ] -qnun ] ]
   >
015fto v -1/fts/Y7 K/