|
|
1.1 ! root 1: /*************************************************************************** ! 2: * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne. JOVE * ! 3: * is provided to you without charge, and with no warranty. You may give * ! 4: * away copies of JOVE, including sources, provided that this notice is * ! 5: * included in all the files. * ! 6: ***************************************************************************/ ! 7: ! 8: /* maximum length of a line (including '\0'). Currently cannot ! 9: be larger than a logical disk block. */ ! 10: #define LBSIZE JBUFSIZ ! 11: ! 12: /* buffer types */ ! 13: #define B_SCRATCH 1 /* for internal things, e.g. minibuffer ... */ ! 14: #define B_FILE 2 /* normal file (we auto-save these.) */ ! 15: #define B_PROCESS 3 /* unix process output in this buffer */ ! 16: ! 17: /* major modes */ ! 18: #define FUNDAMENTAL 0 /* Fundamental mode */ ! 19: #define TEXT 1 /* Text mode */ ! 20: #define CMODE 2 /* C mode */ ! 21: #ifdef LISP ! 22: # define LISPMODE 3 /* Lisp mode */ ! 23: # define NMAJORS 4 ! 24: #else ! 25: # define NMAJORS 3 ! 26: #endif ! 27: ! 28: #define MajorMode(x) (curbuf->b_major == (x)) ! 29: #define SetMajor(x) { curbuf->b_major = (x); UpdModLine = YES; } ! 30: ! 31: /* minor modes */ ! 32: #define Indent (1 << 0) /* indent same as previous line after return */ ! 33: #define ShowMatch (1 << 1) /* paren flash mode */ ! 34: #define Fill (1 << 2) /* text fill mode */ ! 35: #define OverWrite (1 << 3) /* over write mode */ ! 36: #define Abbrev (1 << 4) /* abbrev mode */ ! 37: #define ReadOnly (1 << 5) /* buffer is read only */ ! 38: ! 39: #define BufMinorMode(b, x) ((b)->b_minor & (x)) ! 40: #define MinorMode(x) BufMinorMode(curbuf, (x)) ! 41: ! 42: /* global line scratch buffers */ ! 43: #if defined(VMUNIX) || defined(MSDOS) ! 44: extern char genbuf[LBSIZE], ! 45: linebuf[LBSIZE], ! 46: iobuff[LBSIZE]; ! 47: #else ! 48: extern char *genbuf, /* scratch pad points at s_genbuf (see main()) */ ! 49: *linebuf, /* points at s_linebuf */ ! 50: *iobuff; /* for file reading ... points at s_iobuff */ ! 51: #endif ! 52: ! 53: struct line { ! 54: Line *l_prev, /* pointer to prev */ ! 55: *l_next; /* pointer to next */ ! 56: daddr l_dline; /* pointer to disk location */ ! 57: }; ! 58: ! 59: struct mark { ! 60: Line *m_line; ! 61: int m_char; ! 62: Mark *m_next; /* list of marks */ ! 63: #define M_FIXED 00 ! 64: #define M_FLOATER 01 ! 65: #define M_BIG_DELETE 02 ! 66: char m_flags; /* FLOATERing mark? */ ! 67: }; ! 68: ! 69: struct buffer { ! 70: #ifdef MAC ! 71: int Type; /* kludge... to look like a data_obj */ ! 72: char *Name; /* Name will not be used */ ! 73: #endif ! 74: Buffer *b_next; /* next buffer in chain */ ! 75: char *b_name, /* buffer name */ ! 76: *b_fname; /* file name associated with buffer */ ! 77: dev_t b_dev; /* device of file name. */ ! 78: ino_t b_ino; /* inode of file name */ ! 79: time_t b_mtime; /* last modify time ... ! 80: to detect two people writing ! 81: to the same file */ ! 82: Line *b_first, /* pointer to first line in list */ ! 83: *b_dot, /* current line */ ! 84: *b_last; /* last line in list */ ! 85: int b_char; /* current character in line */ ! 86: ! 87: #define NMARKS 8 /* number of marks in the ring */ ! 88: ! 89: Mark *b_markring[NMARKS], /* new marks are pushed here */ ! 90: #define b_curmark(b) ((b)->b_markring[(b)->b_themark]) ! 91: #define curmark b_curmark(curbuf) ! 92: *b_marks; /* all the marks for this buffer */ ! 93: char b_themark, /* current mark (in b_markring) */ ! 94: b_type, /* file, scratch, process, iprocess */ ! 95: b_ntbf, /* needs to be found when we ! 96: first select? */ ! 97: b_modified; /* is the buffer modified? */ ! 98: int b_major, /* major mode */ ! 99: b_minor; /* and minor mode */ ! 100: struct keymap *b_map; /* local bindings (if any) */ ! 101: #ifdef IPROCS ! 102: Process *b_process; /* process we're attached to */ ! 103: #endif ! 104: }; ! 105: ! 106: extern Buffer *world, /* first buffer */ ! 107: *curbuf, /* pointer into world for current buffer */ ! 108: *lastbuf, /* Last buffer we were in so we have a default ! 109: buffer during a select buffer. */ ! 110: *perr_buf; /* Buffer with error messages */ ! 111: ! 112: #define curline (curbuf->b_dot) ! 113: #define curchar (curbuf->b_char) ! 114: ! 115: /* kill buffer */ ! 116: #define NUMKILLS 10 /* number of kills saved in the kill ring */ ! 117: extern Line *killbuf[NUMKILLS]; ! 118: ! 119: struct position { ! 120: Line *p_line; ! 121: int p_char; ! 122: }; ! 123: ! 124: extern int killptr; /* index into killbuf */ ! 125: ! 126: extern Buffer ! 127: *buf_exists proto((char *name)), ! 128: *do_find proto((struct window *w,char *fname,int force)), ! 129: *do_select proto((struct window *w,char *name)), ! 130: *file_exists proto((char *name)); ! 131: ! 132: extern char ! 133: *ask_buf proto((struct buffer *def)), ! 134: *ralloc proto((char *obj, size_t size)); ! 135: ! 136: #ifdef __STDC__ ! 137: struct macro; ! 138: #endif /* __STDC__ */ ! 139: ! 140: extern void ! 141: TogMinor proto((int bit)), ! 142: bufname proto((struct buffer *b)), ! 143: initlist proto((struct buffer *b)), ! 144: setbname proto((struct buffer *b,char *name)), ! 145: setfname proto((struct buffer *b,char *name)), ! 146: set_ino proto((struct buffer *b)), ! 147: SetABuf proto((struct buffer *b)), ! 148: SetBuf proto((struct buffer *newbuf)), ! 149: AllMarkSet proto((struct buffer *b,struct line *line,int col)), ! 150: DFixMarks proto((struct line *line1,int char1,struct line *line2,int char2)), ! 151: DelMark proto((struct mark *m)), ! 152: IFixMarks proto((struct line *line1, int char1, struct line *line2, int char2)), ! 153: MarkSet proto((struct mark *m, struct line *line, int column)), ! 154: ToMark proto((struct mark *m)), ! 155: flush_marks proto((Buffer *)), ! 156: b_char proto((int n)), ! 157: b_word proto((int num)), ! 158: del_char proto((int dir,int num,int OK_kill)), ! 159: do_macro proto((struct macro *mac)), ! 160: do_set_mark proto((struct line *l, int c)), ! 161: f_char proto((int n)), ! 162: f_word proto((int num)), ! 163: freeline proto((struct line *line)), ! 164: ins_str proto((char *str,int ok_nl)), ! 165: insert_c proto((int c,int n)), ! 166: lfreelist proto((struct line *first)), ! 167: lfreereg proto((struct line *line1,struct line *line2)), ! 168: line_move proto((int dir, int n, int line_cmd)), ! 169: lremove proto((struct line *line1, struct line *line2)), ! 170: mac_putc proto((int c)), ! 171: n_indent proto((int goal)), ! 172: open_lines proto((int n)), ! 173: reg_kill proto((struct line *line2,int char2,int dot_moved)), ! 174: set_mark proto((void)), ! 175: unwind_macro_stack proto((void)), ! 176: buf_init proto((void)); ! 177: ! 178: extern int ! 179: ModMacs proto((void)), ! 180: in_macro proto((void)), ! 181: mac_getc proto((void)), ! 182: how_far proto((struct line *line,int col)); ! 183: ! 184: extern struct line ! 185: *lastline proto((struct line *lp)), ! 186: *listput proto((struct buffer *buf,struct line *after)), ! 187: *max_line proto((struct line *l1,struct line *l2)), ! 188: *min_line proto((struct line *l1,struct line *l2)), ! 189: *nbufline proto((void)), ! 190: *next_line proto((struct line *line,int num)), ! 191: *prev_line proto((struct line *line,int num)), ! 192: *reg_delete proto((struct line *line1,int char1,struct line *line2,int char2)); ! 193: ! 194: extern Mark ! 195: *CurMark proto((void)), ! 196: *MakeMark proto((struct line *line,int column,int type)); ! 197:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.