summaryrefslogtreecommitdiff
path: root/usr.bin/vi/docs/internals
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-05-22 11:37:15 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-05-22 11:37:15 +0000
commit0157a77a51c5e35e093ae03581f66dea010edcc8 (patch)
tree5e8bd32aa4d2b5ed37b7cf3ad26e8bdfc7f20a04 /usr.bin/vi/docs/internals
parent806021be093ad00ce2022a532c0f4cc99b0065ac (diff)
new vi
Diffstat (limited to 'usr.bin/vi/docs/internals')
-rw-r--r--usr.bin/vi/docs/internals/autowrite8
-rw-r--r--usr.bin/vi/docs/internals/context4
-rw-r--r--usr.bin/vi/docs/internals/cscope.NOTES142
-rw-r--r--usr.bin/vi/docs/internals/gdb.script29
-rw-r--r--usr.bin/vi/docs/internals/openmode36
-rw-r--r--usr.bin/vi/docs/internals/quoting187
-rw-r--r--usr.bin/vi/docs/internals/structures63
7 files changed, 321 insertions, 148 deletions
diff --git a/usr.bin/vi/docs/internals/autowrite b/usr.bin/vi/docs/internals/autowrite
index 55cd13b8f72..dbad6c8bae8 100644
--- a/usr.bin/vi/docs/internals/autowrite
+++ b/usr.bin/vi/docs/internals/autowrite
@@ -1,4 +1,4 @@
-# @(#)autowrite 8.2 (Berkeley) 9/28/93
+# @(#)autowrite 8.3 (Berkeley) 2/17/95
Vi autowrite behavior, the fields with *'s are "don't cares".
@@ -13,9 +13,9 @@ Command File Autowrite? Action:
^Z N * Suspend.
# This behavior is NOT identical to :edit.
-^ Y Y Write file and jump.
-^ Y N Error.
-^ N * Jump.
+^^ Y Y Write file and jump.
+^^ Y N Error.
+^^ N * Jump.
# The new nvi command ^T (:tagpop) behaves identically to ^].
# This behavior is identical to :tag, :tagpop, and :tagpush with
diff --git a/usr.bin/vi/docs/internals/context b/usr.bin/vi/docs/internals/context
index 139a1c3fdb4..8b1db32768b 100644
--- a/usr.bin/vi/docs/internals/context
+++ b/usr.bin/vi/docs/internals/context
@@ -1,4 +1,4 @@
-# @(#)context 8.5 (Berkeley) 7/23/94
+# @(#)context 8.6 (Berkeley) 10/14/94
In historic vi, the previous context mark was always set:
@@ -6,7 +6,7 @@ ex address:
any number, <question-mark>, <slash>, <dollar-sign>,
<single-quote>, <backslash>
-ex commands: undo, "z.", global, vglobal
+ex commands: undo, "z.", global, v
vi commands: (, ), {, }, %, [[, ]], ^]
diff --git a/usr.bin/vi/docs/internals/cscope.NOTES b/usr.bin/vi/docs/internals/cscope.NOTES
new file mode 100644
index 00000000000..e0e3483d26e
--- /dev/null
+++ b/usr.bin/vi/docs/internals/cscope.NOTES
@@ -0,0 +1,142 @@
+Cscope Notes:
+
+The nvi tags structure has been reworked to handle the notion of multiple
+locations per tag. This supports cscope, which returns multiple locations
+per query. It will hopefully support ctags programs that create databases
+with multiple locations per tag as well.
+
+There is now a list of "tag queues" chained from each screen. Each tag
+queue has one or more "tag locations".
+
+ +----+ +----+ +----+ +----+
+ | EP | -> | Q1 | <-- | T1 | <-- | T2 |
+ +----+ +----+ --> +----+ --> +----+
+ |
+ +----+ +----+
+ | Q2 | <-- | T1 |
+ +----+ --> +----+
+ |
+ +----+ +----+
+ | Q3 | <-- | T1 |
+ +----+ --> +----+
+
+In the above diagram, each "Q" is a "tag queue", and each "T" is a
+tag location. Generally, the commands:
+
+ :tag create a new Q
+ ^[ create a new Q
+ :cscope find create a new Q
+ :tagnext move to the next T
+ :tagprev move to the previous T
+ :tagpop discard one or more Q's
+ ^T discard the most recent Q
+ :tagtop discard all Q's
+
+More specifically:
+
+:cs[cope] a[dd] cscope-dir
+
+ Attach to the cscope database in cscope-dir.
+
+:cs[cope] f[ind] c|d|e|f|g|i|s|t buffer|pattern
+
+ Query all attached cscopes for the pattern. The pattern is a
+ regular expression. If the pattern is a double-quote character
+ followed by a valid buffer name (e.g., "t), then the contents
+ of the named buffer are used as the pattern.
+
+ c: find callers of name
+ d: find all function calls made from name
+ e: find pattern
+ f: find files with name as substring
+ g: find definition of name
+ i: find files #including name
+ s: find all uses of name
+ t: find assignments to name
+
+ The find command pushes the current location onto the tags stack,
+ and switches to the first location resulting from the query, if
+ the query returned at least one result.
+
+:cs[cope] h[elp] [command]
+
+ List the cscope commands, or usage help on one command.
+
+:display c[onnections]
+
+ Display the list of cscope connections
+
+:display t[ags]
+
+ The tags display has been enhanced to display multiple tag
+ locations per tag query.
+
+:cs[cope] k[ill] #
+
+ Kill cscope connection number #.
+
+:cs[cope] r[eset]
+ Kill all attached cscopes. Useful if one got hung but you don't
+ know which one.
+
+:tagn[ext][!]
+
+ Move to the next tag resulting from a query.
+
+:tagpr[ev][!]
+
+ Return to the previous tag resulting from a query.
+
+:tagp[op], ^T
+
+ Return to the previous tag group (no change).
+
+:tagt[op]
+
+ Discard all tag groups (no change).
+
+Suggested maps:
+
+ " ^N: move to the next tag
+ map ^N :tagnext^M
+ " ^P: move to the previous tag
+ map ^P :tagprev^M
+
+ " Tab+letter performs a C-Scope query on the current word.
+ " C-Scope 12.9 has a text-string query (type t).
+ " C-Scope 13.3 replaces it with an assignment query; hence a==t.
+ map <tab>a "tye:csc find t"t
+ map <tab>c "tye:csc find c"t
+ map <tab>d "tye:csc find d"t
+ map <tab>e "tye:csc find e"t
+ map <tab>f "tye:csc find f"t
+ map <tab>g "tye:csc find g"t
+ map <tab>i "tye:csc find i"t
+ map <tab>s "tye:csc find s"t
+ map <tab>t "tye:csc find t"t
+
+To start nvi with an initial set of cscope directories, use the environment
+variable CSCOPE_DIRS. This variable should contain a <blank>-separated
+list of directories containing cscope databases. (This MAY be changed to
+be an edit option, I haven't really decided, yet.)
+
+Each cscope directory must contain a file named "cscope.out" which is the
+main cscope database, or nvi will not attempt to connect to a cscope to
+handle requests for that database.
+
+The file "cscope.tpath" may contain a colon-separated directory search
+path which will be used to find the files reported by cscope. If this
+cscope.tpath does not exist, then the paths are assumed to be relative to
+the cscope directory itself. This is an extension to the standard cscope,
+but seems important enough to keep.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+Cscope Availability:
+
+UNIXWare System V Release 4.0 variants such as Sun Solaris 2.x
+(/opt/SUNWspro/bin) have version 11.5, and UNIXWare System V
+Release 4.1 has version 12.10 with an option for much faster
+searching.
+
+You can buy version 13.3 source with an unrestricted license
+for $400 from AT&T Software Solutions by calling +1-800-462-8146.
diff --git a/usr.bin/vi/docs/internals/gdb.script b/usr.bin/vi/docs/internals/gdb.script
index c875bf73a01..a1122343c16 100644
--- a/usr.bin/vi/docs/internals/gdb.script
+++ b/usr.bin/vi/docs/internals/gdb.script
@@ -1,12 +1,13 @@
-# @(#)gdb.script 8.3 (Berkeley) 8/16/94
+# @(#)gdb.script 8.5 (Berkeley) 5/4/96
-# display the SVI screen map
+# display the VI screen map
# usage dmap(sp)
define dmap
- set $h = ((SVI_PRIVATE *)$arg0->svi_private)->h_smap
- set $t = ((SVI_PRIVATE *)$arg0->svi_private)->t_smap
+ set $h = ((VI_PRIVATE *)$arg0->vi_private)->h_smap
+ set $t = ((VI_PRIVATE *)$arg0->vi_private)->t_smap
while ($h <= $t)
- printf "lno: %d; off %d ", (int)$h->lno, (int)$h->off
+ printf "lno: %2d; soff %d coff %d ", \
+ (int)$h->lno, (int)$h->soff, (int)$h->coff
if ($h->c_ecsize == 0)
printf "flushed\n"
else
@@ -20,12 +21,13 @@ define dmap
end
end
-# display the tail of the SVI screen map
+# display the tail of the VI screen map
define tmap
- set $h = ((SVI_PRIVATE *)$arg0->svi_private)->h_smap
- set $t = ((SVI_PRIVATE *)$arg0->svi_private)->t_smap
+ set $h = ((VI_PRIVATE *)$arg0->vi_private)->h_smap
+ set $t = ((VI_PRIVATE *)$arg0->vi_private)->t_smap
while ($t >= $h)
- printf "lno: %d; off %d ", (int)$t->lno, (int)$t->off
+ printf "lno: %2d; soff %d coff %d ", \
+ (int)$t->lno, (int)$t->soff, (int)$t->coff
if ($t->c_ecsize == 0)
printf "flushed\n"
else
@@ -40,18 +42,15 @@ define tmap
end
# display the private structures
+define clp
+ print *((CL_PRIVATE *)sp->gp->cl_private)
+end
define vip
print *((VI_PRIVATE *)sp->vi_private)
end
-define svp
- print *((SVI_PRIVATE *)sp->svi_private)
-end
define exp
print *((EX_PRIVATE *)sp->ex_private)
end
-define sxp
- print *((SEX_PRIVATE *)sp->sex_private)
-end
# display the marks
define markp
diff --git a/usr.bin/vi/docs/internals/openmode b/usr.bin/vi/docs/internals/openmode
new file mode 100644
index 00000000000..c64b76774b3
--- /dev/null
+++ b/usr.bin/vi/docs/internals/openmode
@@ -0,0 +1,36 @@
+ @(#)openmode 8.1 (Berkeley) 10/29/94
+
+Open mode has the following special behaviors:
+
+z, ^F, ^B:
+ If count is not specified, it shall default to the window
+ edit option - 2.
+
+ Write lines from the edit buffer starting at:
+
+ (the current line) - ((count - 2) / 2)
+
+ until:
+
+ (((count + 1) / 2) * 2) - 1
+
+ lines, or the last line in the edit buffer has been written. A
+ line consisting of the smaller of the number of columns in the
+ display divided by two or 40 ``-'' characters shall be written
+ immediately before and after the specified is written. These two
+ lines shall count against the total number of lines to be written.
+ A blank line shall be written after the last line is written.
+
+ z, ^F and ^B all behave identically.
+
+^D: Display the next scroll value lines, change the current line.
+
+^U: Change the current line, do nothing else.
+
+^E, ^Y: Do nothing.
+
+^L: Clear the screen and redisplay the current line.
+
+H, L, M:
+ Move to the first nonblank of the current line and do nothing
+ else.
diff --git a/usr.bin/vi/docs/internals/quoting b/usr.bin/vi/docs/internals/quoting
index f20bd3f2b1e..a5fb8926a33 100644
--- a/usr.bin/vi/docs/internals/quoting
+++ b/usr.bin/vi/docs/internals/quoting
@@ -1,93 +1,89 @@
-# @(#)quoting 5.4 (Berkeley) 8/20/93
+# @(#)quoting 5.5 (Berkeley) 11/12/94
QUOTING IN EX/VI:
-There are two escape characters in historic ex/vi, ^V (or whatever
-character the user specified as their literal next character) and
-backslashes. There are two different areas in ex/vi where escaping
-is interesting: the command and text input modes, and within the ex
-commands themselves. In the examples below, ^V is used as the
-typical literal next character.
+There are four escape characters in historic ex/vi:
-1: Escaping characters in ex and vi command and text input modes.
- The set of characters that users might want to escape are as
- follows:
+ \ (backslashes)
+ ^V
+ ^Q (assuming it wasn't used for IXON/IXOFF)
+ The terminal literal next character.
- vi text input mode (a, i, o, etc.):
+Vi did not use the lnext character, it always used ^V (or ^Q).
+^V and ^Q were equivalent in all cases for vi.
- carriage return (^M)
- escape (^[)
- autoindent characters
- (^D, 0, ^, ^T)
- erase, word erase, and line erase
- (^H, ^W, ^U)
- newline (^J) (not historic practice)
- suspend (^Z) (not historic practice)
- repaint (^L) (not historic practice)
-
- vi command line (:colon commands):
-
- carriage return (^M)
- escape (^[)
- erase, word erase, and line erase
- (^H, ^W, ^U)
- newline (^J) (not historic practice)
- suspend (^Z) (not historic practice)
- repaint (^L) (not historic practice)
+There are four different areas in ex/vi where escaping characters
+is interesting:
- ex text input mode (a, i, o, etc.):
+ 1: In vi text input mode.
+ 2: In vi command mode.
+ 3: In ex command and text input modes.
+ 4: In the ex commands themselves.
- carriage return (^M)
- erase, word erase, and line erase
- (^H, ^W, ^U)
- newline (^J) (not historic practice)
+1: Vi text input mode (a, i, o, :colon commands, etc.):
- ex command line:
+ The set of characters that users might want to escape are as follows.
+ As ^L and ^Z were not special in input mode, they are not listed.
carriage return (^M)
- erase, word erase, and line erase
- (^H, ^W, ^U)
- newline (^J) (not historic practice)
- suspend (^Z)
-
- I intend to follow historic practice for all of these cases, which
- was that ^V was the only way to escape any of these characters, and
- that whatever character followed the ^V was taken literally, i.e.
- ^V^V is a single ^V.
-
- The historic ex/vi disallowed the insertion of various control
- characters (^D, ^T, whatever) during various different modes, or,
- permitted the insertion of only a single one, or lots of other random
- behaviors (you can use ^D to enter a command in ex). I have
- regularized this behavior in nvi, there are no characters that cannot
- be entered or which have special meaning other than the ones listed
- above.
-
- One comment regarding the autoindent characters. In historic vi,
- if you entered "^V0^D" autoindent erasure was still triggered,
- although it wasn't if you entered "0^V^D". In nvi, if you escape
- either character, autoindent erasure is not triggered.
-
- This doesn't permit whitespace in command names, but that wasn't
- historic practice and doesn't seem worth doing.
-
- Fun facts to know and tell:
- The historic vi implementation for the 'r' command requires
- *three* ^V's to replace a single character with ^V.
-
-2: Ex commands:
-
- Ex commands are delimited by '|' or newline characters. Within
- the commands, whitespace characters delimit the arguments.
-
- I intend to treat ^V, followed by any character, as that literal
- character.
+ escape (^[)
+ autoindents (^D, 0, ^, ^T)
+ erase (^H)
+ word erase (^W)
+ line erase (^U)
+ newline (^J) (not historic practice)
+
+ Historic practice was that ^V was the only way to escape any
+ of these characters, and that whatever character followed
+ the ^V was taken literally, e.g. ^V^V is a single ^V. I
+ don't see any strong reason to make it possible to escape
+ ^J, so I'm going to leave that alone.
+
+ One comment regarding the autoindent characters. In historic
+ vi, if you entered "^V0^D" autoindent erasure was still
+ triggered, although it wasn't if you entered "0^V^D". In
+ nvi, if you escape either character, autoindent erasure is
+ not triggered.
+
+ Abbreviations were not performed if the non-word character
+ that triggered the abbreviation was escaped by a ^V. Input
+ maps were not triggered if any part of the map was escaped
+ by a ^V.
+
+ The historic vi implementation for the 'r' command requires
+ two leading ^V's to replace a character with a literal
+ character. This is obviously a bug, and should be fixed.
+
+2: Vi command mode
+
+ Command maps were not triggered if the second or later
+ character of a map was escaped by a ^V.
+
+ The obvious extension is that ^V should keep the next command
+ character from being mapped, so you can do ":map x xxx" and
+ then enter ^Vx to delete a single character.
+
+3: Ex command and text input modes.
+
+ As ex ran in canonical mode, there was little work that it
+ needed to do for quoting. The notable differences between
+ ex and vi are that it was possible to escape a <newline> in
+ the ex command and text input modes, and ex used the "literal
+ next" character, not control-V/control-Q.
+
+4: The ex commands:
+
+ Ex commands are delimited by '|' or newline characters.
+ Within the commands, whitespace characters delimit the
+ arguments. Backslash will generally escape any following
+ character. In the abbreviate, unabbreviate, map and unmap
+ commands, control-V escapes the next character, instead.
This is historic behavior in vi, although there are special
cases where it's impossible to escape a character, generally
a whitespace character.
-3: Escaping characters in file names in ex commands:
+ Escaping characters in file names in ex commands:
:cd [directory] (directory)
:chdir [directory] (directory)
@@ -101,26 +97,18 @@ typical literal next character.
:wq [file] (file)
:xit [file] (file)
- I intend to treat a backslash in a file name, followed by any
- character, as that literal character.
-
- This is historic behavior in vi.
-
- In addition, since file names are also subject to word expansion,
- the rules for escape characters in section 3 of this document also
- apply. This is NOT historic behavior in vi, making it impossible
- to insert a whitespace, newline or carriage return character into
- a file name. This change could cause a problem if there were files
- with ^V's in their names, but I think that's unlikely.
+ Since file names are also subject to word expansion, the
+ underlying shell had better be doing the correct backslash
+ escaping. This is NOT historic behavior in vi, making it
+ impossible to insert a whitespace, newline or carriage return
+ character into a file name.
4: Escaping characters in non-file arguments in ex commands:
:abbreviate word string (word, string)
* :edit [+cmd] [file] (+cmd)
* :ex [+cmd] [file] (+cmd)
- :k key (key)
:map word string (word, string)
- :mark key (key)
* :set [option ...] (option)
* :tag string (string)
:unabbreviate word (word)
@@ -147,9 +135,9 @@ typical literal next character.
:edit +10|s/abc/ABC/ file.c
- In addition, the edit and ex commands have historically ignored
- literal next characters in the +cmd string, so that the following
- command won't work.
+ In addition, the edit and ex commands have historically
+ ignored literal next characters in the +cmd string, so that
+ the following command won't work.
:edit +10|s/X/^V / file.c
@@ -167,19 +155,19 @@ typical literal next character.
4.2: The set command:
- The set command treats ^V's as literal characters, so the following
- command won't work. Backslashes do work in this case, though, so
- the second version of the command does work.
+ The set command treats ^V's as literal characters, so the
+ following command won't work. Backslashes do work in this
+ case, though, so the second version of the command does work.
set tags=tags_file1^V tags_file2
set tags=tags_file1\ tags_file2
- I intend to continue permitting backslashes in set commands, but
- to also permit literal next characters to work as well. This is
- backward compatible, but will also make set consistent with the
- other commands. I think it's unlikely to break any historic
- .exrc's, given that there are probably very few files with ^V's
- in their name.
+ I intend to continue permitting backslashes in set commands,
+ but to also permit literal next characters to work as well.
+ This is backward compatible, but will also make set
+ consistent with the other commands. I think it's unlikely
+ to break any historic .exrc's, given that there are probably
+ very few files with ^V's in their name.
4.3: The tag command:
@@ -217,3 +205,4 @@ typical literal next character.
In all of the above rules, an escape character (either ^V or a
backslash) at the end of an argument or file name is not handled
specially, but used as a literal character.
+
diff --git a/usr.bin/vi/docs/internals/structures b/usr.bin/vi/docs/internals/structures
index d49ab65cbee..a25c780c8e6 100644
--- a/usr.bin/vi/docs/internals/structures
+++ b/usr.bin/vi/docs/internals/structures
@@ -1,32 +1,35 @@
-# @(#)structures 5.2 (Berkeley) 11/1/93
+# @(#)structures 5.4 (Berkeley) 10/4/95
-There are three major data structures in this package. The first is a
-single global structure (named GS) which contains information common to
-all files and screens. It's really pretty tiny, and functions more as a
-single place to hang things than anything else.
+There are three major data structures in this package, plus a single data
+structure per screen type. The first is a single global structure (GS)
+which contains information common to all files and screens. It hold
+global things like the input key queues, and functions as a single place
+to hang things. For example, interrupt routines have to be able to find
+screen structures, and they can only do this if they have a starting
+point. The number of globals in nvi is dependent on the screen type, but
+every screen type will have at least one global, __global_list, which
+references the GS structure.
-The second and third structures are the file structures (named EXF) and
-the screen structures (named SCR). They contain information theoretically
-unique to a screen or file, respectively. Each SCR structure has a set
-of functions which update the screen and/or return information about the
-screen from the underlying screen package.
+The GS structure contains linked lists of screen (SCR) structures.
+Each SCR structure normally references a file (EXF) structure.
-The GS structure contains linked lists SCR structures. The structures
-can also be classed by persistence. The GS structure never goes away
-and the SCR structure persists over instances of files.
+The GS structure has a set of functions which update the screen and/or
+return information about the screen from the underlying screen package.
+The GS structure never goes away. The SCR structure persists over
+instances of screens, and the EXF structure persists over references to
+files.
File names have different properties than files themselves, so the name
information for a file is held in an FREF structure which is chained from
the SCR structure.
-In general, functions are always passed an SCR structure and often an EXF
-structure as well. The SCR structure is necessary for any routine that
-wishes to talk to the screen, the EXF structure is necessary for any
-routine that wants to modify the file. The relationship between an SCR
-structure and its underlying EXF structure is not fixed, and although you
-can translate from an SCR to the underlying EXF, it is discouraged. If
-this becomes too onerous, I suspect I'll just stop passing around the EXF
-in the future.
+In general, functions are always passed an SCR structure, which usually
+references an underlying EXF structure. The SCR structure is necessary
+for any routine that wishes to talk to the screen, the EXF structure is
+necessary for any routine that wants to modify the file. The relationship
+between an SCR structure and its underlying EXF structure is not fixed,
+and various ex commands will substitute a new EXF in place of the current
+one, and there's no way to detect this.
The naming of the structures is consistent across the program. (Macros
even depend on it, so don't try and change it!) The global structure is
@@ -41,6 +44,9 @@ TEXT In nvi/cut.h. This structure describes a portion of a line,
CB In nvi/cut.h. A cut buffer. A cut buffer is a place to
hang a list of TEXT structures.
+CL The curses screen private data structure. Everything to
+ do standalone curses screens.
+
MARK In nvi/mark.h. A cursor position, consisting of a line number
and a column number.
@@ -48,14 +54,15 @@ MSG In nvi/msg.h. A chain of messages for the user.
SEQ In nvi/seq.h. An abbreviation or a map entry.
-EXCMDARG
- In nvi/ex/excmd.h.stub. The structure that gets passed around
- to the functions that implement the ex commands. (The main
- ex command loop (see nvi/ex/ex.c) builds this up and then passes
- it to the ex functions.)
+TK The Tcl/Tk screen private data structure. Everything to
+ do standalone Tcl/Tk screens.
+
+EXCMD In nvi/ex/ex.h. The structure that gets passed around to the
+ functions that implement the ex commands. (The main ex command
+ loop (see nvi/ex/ex.c) builds this up and then passes it to the
+ ex functions.)
-VICMDARG
- In nvi/vi/vcmd.h. The structure that gets passed around to the
+VICMD In nvi/vi/vi.h. The structure that gets passed around to the
functions that implement the vi commands. (The main vi command
loop (see nvi/vi/vi.c) builds this up and then passes it to the
vi functions.)