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