Home | History | Annotate | Line # | Download | only in internals
      1  1.1  christos #	@(#)structures	5.4 (Berkeley) 10/4/95
      2  1.1  christos 
      3  1.1  christos There are three major data structures in this package, plus a single data
      4  1.1  christos structure per screen type.  The first is a single global structure (GS)
      5  1.1  christos which contains information common to all files and screens.  It hold
      6  1.1  christos global things like the input key queues, and functions as a single place
      7  1.1  christos to hang things.  For example, interrupt routines have to be able to find
      8  1.1  christos screen structures, and they can only do this if they have a starting
      9  1.1  christos point.  The number of globals in nvi is dependent on the screen type, but
     10  1.1  christos every screen type will have at least one global, __global_list, which
     11  1.1  christos references the GS structure.
     12  1.1  christos 
     13  1.1  christos The GS structure contains linked lists of screen (SCR) structures.
     14  1.1  christos Each SCR structure normally references a file (EXF) structure.
     15  1.1  christos 
     16  1.1  christos The GS structure has a set of functions which update the screen and/or
     17  1.1  christos return information about the screen from the underlying screen package.
     18  1.1  christos The GS structure never goes away.  The SCR structure persists over
     19  1.1  christos instances of screens, and the EXF structure persists over references to
     20  1.1  christos files.
     21  1.1  christos 
     22  1.1  christos File names have different properties than files themselves, so the name
     23  1.1  christos information for a file is held in an FREF structure which is chained from
     24  1.1  christos the SCR structure.
     25  1.1  christos 
     26  1.1  christos In general, functions are always passed an SCR structure, which usually
     27  1.1  christos references an underlying EXF structure.  The SCR structure is necessary
     28  1.1  christos for any routine that wishes to talk to the screen, the EXF structure is
     29  1.1  christos necessary for any routine that wants to modify the file.  The relationship
     30  1.1  christos between an SCR structure and its underlying EXF structure is not fixed,
     31  1.1  christos and various ex commands will substitute a new EXF in place of the current
     32  1.1  christos one, and there's no way to detect this.
     33  1.1  christos 
     34  1.1  christos The naming of the structures is consistent across the program.  (Macros
     35  1.1  christos even depend on it, so don't try and change it!)  The global structure is
     36  1.1  christos "gp", the screen structure is "sp", and the file structure is "ep".
     37  1.1  christos 
     38  1.1  christos A few other data structures:
     39  1.1  christos 
     40  1.1  christos TEXT	In nvi/cut.h.  This structure describes a portion of a line,
     41  1.1  christos 	and is used by the input routines and as the "line" part of a
     42  1.1  christos 	cut buffer.
     43  1.1  christos 
     44  1.1  christos CB	In nvi/cut.h.	A cut buffer.  A cut buffer is a place to
     45  1.1  christos 	hang a list of TEXT structures.
     46  1.1  christos 
     47  1.1  christos CL	The curses screen private data structure.  Everything to
     48  1.1  christos 	do standalone curses screens.
     49  1.1  christos 
     50  1.1  christos MARK	In nvi/mark.h.  A cursor position, consisting of a line number
     51  1.1  christos 	and a column number.
     52  1.1  christos 
     53  1.1  christos MSG	In nvi/msg.h.  A chain of messages for the user.
     54  1.1  christos 
     55  1.1  christos SEQ	In nvi/seq.h.  An abbreviation or a map entry.
     56  1.1  christos 
     57  1.1  christos TK	The Tcl/Tk screen private data structure.  Everything to
     58  1.1  christos 	do standalone Tcl/Tk screens.
     59  1.1  christos 
     60  1.1  christos EXCMD   In nvi/ex/ex.h.  The structure that gets passed around to the
     61  1.1  christos 	functions that implement the ex commands.  (The main ex command
     62  1.1  christos 	loop (see nvi/ex/ex.c) builds this up and then passes it to the
     63  1.1  christos 	ex functions.)
     64  1.1  christos 
     65  1.1  christos VICMD	In nvi/vi/vi.h.  The structure that gets passed around to the
     66  1.1  christos 	functions that implement the vi commands.  (The main vi command
     67  1.1  christos 	loop (see nvi/vi/vi.c) builds this up and then passes it to the
     68  1.1  christos 	vi functions.)
     69