Annotation of 43BSDReno/contrib/emacs-18.55/src/buffer.h, revision 1.1

1.1     ! root        1: /* Header file for the buffer manipulation primitives.
        !             2:    Copyright (C) 1985, 1986 Free Software Foundation, Inc.
        !             3: 
        !             4: This file is part of GNU Emacs.
        !             5: 
        !             6: GNU Emacs is distributed in the hope that it will be useful,
        !             7: but WITHOUT ANY WARRANTY.  No author or distributor
        !             8: accepts responsibility to anyone for the consequences of using it
        !             9: or for whether it serves any particular purpose or works at all,
        !            10: unless he says so in writing.  Refer to the GNU Emacs General Public
        !            11: License for full details.
        !            12: 
        !            13: Everyone is granted permission to copy, modify and redistribute
        !            14: GNU Emacs, but only under the conditions described in the
        !            15: GNU Emacs General Public License.   A copy of this license is
        !            16: supposed to have been given to you along with GNU Emacs so you
        !            17: can know your rights and responsibilities.  It should be in a
        !            18: file named COPYING.  Among other things, the copyright notice
        !            19: and this notice must be preserved on all copies.  */
        !            20: 
        !            21: 
        !            22: #ifdef lint
        !            23: #include "undo.h"
        !            24: #endif /* lint */
        !            25: 
        !            26: 
        !            27: #define SetPoint  point =
        !            28: 
        !            29: #define PointRight  point +=
        !            30: #define  PointLeft  point -=
        !            31: 
        !            32: struct buffer_text
        !            33:   {
        !            34:     unsigned char *p1;         /* Address of first data char, minus 1 */
        !            35:     unsigned char *p2;         /* p1 plus gap size */
        !            36:     int size1;                 /* # characters before gap */
        !            37:     int size2;                 /* # characters after gap */
        !            38:     int gap;                   /* gap size in chars */
        !            39:     int modified;              /* tick at which contents last modified */
        !            40:     int head_clip;             /* # of first char that's visible (origin 1) */
        !            41:     int tail_clip;             /* # chars not visible at end of buffer */
        !            42:     int pointloc;              /* # of char point is at (origin 1) */
        !            43:   };
        !            44: 
        !            45: /* structure that defines a buffer */
        !            46: struct buffer
        !            47:   {
        !            48:     /* Everything before the `name' slot must be of a non-Lisp_Object type,
        !            49:        and every slot after `name' must be a Lisp_Object
        !            50:        This is known about by both mark_buffer (alloc.c) and
        !            51:        Flist_buffer_local_variables (buffer.c)
        !            52:      */
        !            53: 
        !            54:     /* This describes the buffer's text */
        !            55:     struct buffer_text text;
        !            56:     /* Next buffer, in chain of all buffers that exist.  */
        !            57:     struct buffer *next;
        !            58:     /* Flags saying which DefBufferLispVar variables
        !            59:        are local to this buffer.  */
        !            60:     int local_var_flags;
        !            61:     /* Value of text.modified when buffer last saved */
        !            62:     int save_modified;
        !            63:     /* Set to the modtime of the visited file when read or written.
        !            64:        -1 means visited file was nonexistent.
        !            65:        0 means visited file modtime unknown; in no case complain
        !            66:        about any mismatch on next save attempt.  */
        !            67:     int modtime;
        !            68:     /* the value of text.modified at the last auto-save. */
        !            69:     int auto_save_modified;
        !            70:     /* Position in buffer at which display started
        !            71:        the last time this buffer was displayed */
        !            72:     int last_window_start;
        !            73:     /* Undo records for changes in this buffer. */
        !            74:     struct UndoData *undodata;
        !            75:     /* the syntax table in use */
        !            76:     struct Lisp_Vector *syntax_table_v;
        !            77: 
        !            78:     /* This is a special exception -- as this slot should not be
        !            79:        marked by gc_sweep, and as it is not lisp-accessible as
        !            80:        a local variable -- so re regard it as not really being of type
        !            81:        Lisp_Object */
        !            82:     /* the markers that refer to this buffer.
        !            83:        This is actually a single marker ---
        !            84:        successive elements in its marker `chain'
        !            85:        are the other markers referring to this
        !            86:        buffer */
        !            87:     Lisp_Object markers;
        !            88: 
        !            89: 
        !            90:     /* Everything from here down must be a Lisp_Object */
        !            91: 
        !            92: 
        !            93:     /* the name of this buffer */
        !            94:     Lisp_Object name;
        !            95:     /* Nuked: buffer number, assigned when buffer made Lisp_Object number;*/
        !            96:     /* the name of the file associated with this buffer */
        !            97:     Lisp_Object filename;
        !            98:     /* Dir for expanding relative pathnames */
        !            99:     Lisp_Object directory;
        !           100:     /* true iff this buffer has been been backed
        !           101:        up (if you write to its associated file
        !           102:        and it hasn't been backed up, then a
        !           103:        backup will be made) */
        !           104:     Lisp_Object backed_up;
        !           105:     /* Length of file when last read or saved. */
        !           106:     Lisp_Object save_length;
        !           107:     /* file name used for auto-saving this buffer */
        !           108:     Lisp_Object auto_save_file_name;
        !           109:     /* Non-nil if buffer read-only */
        !           110:     Lisp_Object read_only;
        !           111:     /* "The mark"; no longer allowed to be nil */
        !           112:     Lisp_Object mark;
        !           113: 
        !           114:     /* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER)
        !           115:        for all per-buffer variables of this buffer.  */
        !           116:     Lisp_Object local_var_alist;
        !           117: 
        !           118: 
        !           119:     /* Symbol naming major mode (eg lisp-mode) */
        !           120:     Lisp_Object major_mode;
        !           121:     /* Pretty name of major mode (eg "Lisp") */
        !           122:     Lisp_Object mode_name;
        !           123:     /* Format string for mode line */
        !           124:     Lisp_Object mode_line_format;
        !           125: 
        !           126:     /* Keys that are bound local to this buffer */
        !           127:     Lisp_Object keymap;
        !           128:     /* This buffer's local abbrev table */
        !           129:     Lisp_Object abbrev_table;
        !           130: 
        !           131:     /* Values of several buffer-local variables */
        !           132:     /* tab-width is buffer-local so that redisplay can find it
        !           133:        in buffers that are not current */
        !           134:     Lisp_Object case_fold_search;
        !           135:     Lisp_Object tab_width;
        !           136:     Lisp_Object fill_column;
        !           137:     Lisp_Object left_margin;
        !           138:     /* Function to call when insert space past fiull column */
        !           139:     Lisp_Object auto_fill_hook;
        !           140: 
        !           141:     /* Non-nil means do not display continuation lines */
        !           142:     Lisp_Object truncate_lines;
        !           143:     /* Non-nil means display ctl chars with uparrow */
        !           144:     Lisp_Object ctl_arrow;
        !           145:     /* Non-nil means do selective display;
        !           146:        See doc string in syms_of_buffer (buffer.c) for details.  */
        !           147:     Lisp_Object selective_display;
        !           148:     /* Non-nil means show ... at end of line followed by invisible lines.  */
        !           149:     Lisp_Object selective_display_ellipses;
        !           150:     /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */
        !           151:     Lisp_Object minor_modes;
        !           152:     /* t if "self-insertion" should overwrite */
        !           153:     Lisp_Object overwrite_mode;
        !           154:     /* non-nil means abbrev mode is on.  Expand abbrevs automatically. */
        !           155:     Lisp_Object abbrev_mode;
        !           156: };
        !           157: 
        !           158: extern struct buffer *bf_cur;          /* points to the current buffer */
        !           159: 
        !           160: /* This structure contains data describing the text of the current buffer.
        !           161:  Switching buffers swaps their text data in and out of here */
        !           162: 
        !           163: extern struct buffer_text bf_text;
        !           164: 
        !           165: /* This structure holds the default values of the buffer-local variables
        !           166:    defined with DefBufferLispVar, that have special slots in each buffer.
        !           167:    The default value occupies the same slot in this structure
        !           168:    as an individual buffer's value occupies in that buffer.
        !           169:    Setting the default value also goes through the alist of buffers
        !           170:    and stores into each buffer that does not say it has a local value.  */
        !           171: 
        !           172: extern struct buffer buffer_defaults;
        !           173: 
        !           174: /* This structure marks which slots in a buffer have corresponding
        !           175:    default values in buffer_defaults.
        !           176:    Each such slot has a nonzero value in this structure.
        !           177:    The value has only one nonzero bit.
        !           178: 
        !           179:    When a buffer has its own local value for a slot,
        !           180:    the bit for that slot (found in the same slot in this structure)
        !           181:    is turned on in the buffer's local_var_flags slot.
        !           182: 
        !           183:    If a slot in this structure is zero, then even though there may
        !           184:    be a DefBufferLispVar for the slot, there is no default valuefeor it;
        !           185:    and the corresponding slot in buffer_defaults is not used.  */
        !           186: 
        !           187: extern struct buffer buffer_local_flags;
        !           188: 
        !           189: /* For each buffer slot, this points to the Lisp symbol name
        !           190:    for that slot in the current buffer.  It is 0 for slots
        !           191:    that don't have such names.  */
        !           192: 
        !           193: extern struct buffer buffer_local_symbols;
        !           194: 
        !           195: /* Some aliases for info about the current buffer.  */
        !           196: 
        !           197: #define bf_p1 bf_text.p1
        !           198: #define bf_p2 bf_text.p2
        !           199: #define bf_s1 bf_text.size1
        !           200: #define bf_s2 bf_text.size2
        !           201: #define bf_gap bf_text.gap
        !           202: #define bf_modified bf_text.modified
        !           203: #define bf_head_clip bf_text.head_clip
        !           204: #define bf_tail_clip bf_text.tail_clip
        !           205: #define point bf_text.pointloc
        !           206: 
        !           207: /* Lowest legal value of point for current buffer */
        !           208: #define FirstCharacter bf_text.head_clip
        !           209: 
        !           210: /* Number of last visible character in current buffer */
        !           211: /* The highest legal value for point is one greater than this */
        !           212: #define NumCharacters (bf_text.size1+bf_text.size2-bf_text.tail_clip)
        !           213: 
        !           214: /* Return character at position n.  No range checking */
        !           215: #define CharAt(n) *(((n)>bf_s1 ? bf_p2 : bf_p1) + (n))
        !           216:   
        !           217: /* BufferSafeCeiling (resp. BufferSafeFloor), when applied to n, return */
        !           218: /* the max (resp. min) p such that &CharAt (p) - &CharAt (n) == p - n   */
        !           219: #define BufferSafeCeiling(n) (bf_s1 + (((n) <= bf_s1) ? 0 : bf_s2))
        !           220: 
        !           221: #define BufferSafeFloor(n) (((n) <= bf_s1) ? 1 : bf_s1 + 1)
        !           222: 
        !           223: extern void reset_buffer ();

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.