xref: /minix3/external/bsd/nvi/docs/internals/structures (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc#	@(#)structures	5.4 (Berkeley) 10/4/95
2*84d9c625SLionel Sambuc
3*84d9c625SLionel SambucThere are three major data structures in this package, plus a single data
4*84d9c625SLionel Sambucstructure per screen type.  The first is a single global structure (GS)
5*84d9c625SLionel Sambucwhich contains information common to all files and screens.  It hold
6*84d9c625SLionel Sambucglobal things like the input key queues, and functions as a single place
7*84d9c625SLionel Sambucto hang things.  For example, interrupt routines have to be able to find
8*84d9c625SLionel Sambucscreen structures, and they can only do this if they have a starting
9*84d9c625SLionel Sambucpoint.  The number of globals in nvi is dependent on the screen type, but
10*84d9c625SLionel Sambucevery screen type will have at least one global, __global_list, which
11*84d9c625SLionel Sambucreferences the GS structure.
12*84d9c625SLionel Sambuc
13*84d9c625SLionel SambucThe GS structure contains linked lists of screen (SCR) structures.
14*84d9c625SLionel SambucEach SCR structure normally references a file (EXF) structure.
15*84d9c625SLionel Sambuc
16*84d9c625SLionel SambucThe GS structure has a set of functions which update the screen and/or
17*84d9c625SLionel Sambucreturn information about the screen from the underlying screen package.
18*84d9c625SLionel SambucThe GS structure never goes away.  The SCR structure persists over
19*84d9c625SLionel Sambucinstances of screens, and the EXF structure persists over references to
20*84d9c625SLionel Sambucfiles.
21*84d9c625SLionel Sambuc
22*84d9c625SLionel SambucFile names have different properties than files themselves, so the name
23*84d9c625SLionel Sambucinformation for a file is held in an FREF structure which is chained from
24*84d9c625SLionel Sambucthe SCR structure.
25*84d9c625SLionel Sambuc
26*84d9c625SLionel SambucIn general, functions are always passed an SCR structure, which usually
27*84d9c625SLionel Sambucreferences an underlying EXF structure.  The SCR structure is necessary
28*84d9c625SLionel Sambucfor any routine that wishes to talk to the screen, the EXF structure is
29*84d9c625SLionel Sambucnecessary for any routine that wants to modify the file.  The relationship
30*84d9c625SLionel Sambucbetween an SCR structure and its underlying EXF structure is not fixed,
31*84d9c625SLionel Sambucand various ex commands will substitute a new EXF in place of the current
32*84d9c625SLionel Sambucone, and there's no way to detect this.
33*84d9c625SLionel Sambuc
34*84d9c625SLionel SambucThe naming of the structures is consistent across the program.  (Macros
35*84d9c625SLionel Sambuceven depend on it, so don't try and change it!)  The global structure is
36*84d9c625SLionel Sambuc"gp", the screen structure is "sp", and the file structure is "ep".
37*84d9c625SLionel Sambuc
38*84d9c625SLionel SambucA few other data structures:
39*84d9c625SLionel Sambuc
40*84d9c625SLionel SambucTEXT	In nvi/cut.h.  This structure describes a portion of a line,
41*84d9c625SLionel Sambuc	and is used by the input routines and as the "line" part of a
42*84d9c625SLionel Sambuc	cut buffer.
43*84d9c625SLionel Sambuc
44*84d9c625SLionel SambucCB	In nvi/cut.h.	A cut buffer.  A cut buffer is a place to
45*84d9c625SLionel Sambuc	hang a list of TEXT structures.
46*84d9c625SLionel Sambuc
47*84d9c625SLionel SambucCL	The curses screen private data structure.  Everything to
48*84d9c625SLionel Sambuc	do standalone curses screens.
49*84d9c625SLionel Sambuc
50*84d9c625SLionel SambucMARK	In nvi/mark.h.  A cursor position, consisting of a line number
51*84d9c625SLionel Sambuc	and a column number.
52*84d9c625SLionel Sambuc
53*84d9c625SLionel SambucMSG	In nvi/msg.h.  A chain of messages for the user.
54*84d9c625SLionel Sambuc
55*84d9c625SLionel SambucSEQ	In nvi/seq.h.  An abbreviation or a map entry.
56*84d9c625SLionel Sambuc
57*84d9c625SLionel SambucTK	The Tcl/Tk screen private data structure.  Everything to
58*84d9c625SLionel Sambuc	do standalone Tcl/Tk screens.
59*84d9c625SLionel Sambuc
60*84d9c625SLionel SambucEXCMD   In nvi/ex/ex.h.  The structure that gets passed around to the
61*84d9c625SLionel Sambuc	functions that implement the ex commands.  (The main ex command
62*84d9c625SLionel Sambuc	loop (see nvi/ex/ex.c) builds this up and then passes it to the
63*84d9c625SLionel Sambuc	ex functions.)
64*84d9c625SLionel Sambuc
65*84d9c625SLionel SambucVICMD	In nvi/vi/vi.h.  The structure that gets passed around to the
66*84d9c625SLionel Sambuc	functions that implement the vi commands.  (The main vi command
67*84d9c625SLionel Sambuc	loop (see nvi/vi/vi.c) builds this up and then passes it to the
68*84d9c625SLionel Sambuc	vi functions.)
69