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