source: trunk/minix/commands/elle/elle.h@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 12.7 KB
Line 
1/* ELLE - Copyright 1982, 1984 by Ken Harrenstien, SRI International
2 * This software is quasi-public; it may be used freely with
3 * like software, but may NOT be sold or made part of licensed
4 * products without permission of the author.
5 */
6/*
7 * ELLE.H Global ELLE definitions
8 */
9
10#ifndef EXT
11#define EXT extern /* Default assumes these are referencing decls */
12#endif
13
14/* Make identifiers unique in 1st 6 chars as per ANSI rule for externals */
15#define tvc_cin tvccin
16#define tvc_cdn tvccdn
17#define tvc_lin tvclin
18#define tvc_ldn tvcldn
19#define ev_fno1 evfno1
20#define ev_fno2 evfno2
21#define ev_fnn1 evfnn1
22#define ev_fnn2 evfnn2
23
24#define ask_sall asksal /* eebuff.c */
25#define ask_save asksav
26#define buf_tmod buftmo
27#define buf_tmat buftma
28#define e_gobob egobob /* eeedit.c */
29#define e_gobol egobol
30#define e_goeob egoeob
31#define e_goeol egoeol
32#define fill_prefix filpfx /* eefill.c */
33#define fill_plen filpln
34#define fill_cur_line filcln
35#define kill_ptr kilptr /* eef3.c */
36#define kill_push kilpsh
37#define ed_insert edinst /* eefed.c */
38#define ed_insn edinsn
39#define ed_deln eddeln
40#define ed_delete eddele
41#define f_fillreg ffilrg /* eejust.c */
42#define f_fillpara ffilpa
43
44#include "eesite.h" /* Insert site-dependent flags and parameters */
45#include "sb.h" /* Insert SB package definitions */
46#include "eeprof.h" /* Insert user profile definition. This is a
47 * separate file so ELLEC can use it too. */
48#include "eefidx.h" /* Insert desired function defs */
49
50/* ELLE Compile-time parameter defaults */
51
52#ifndef KILL_LEN
53#define KILL_LEN 8 /* Size of kill ring */
54#endif
55#ifndef MAXHT
56#define MAXHT 72 /* Height (# lines) of largest screen we'll suport */
57#endif
58#ifndef MAXLINE
59#define MAXLINE 132 /* Width (# chars) of largest screen we'll support */
60#endif
61#ifndef FNAMELEN
62#define FNAMELEN 14 /* Sys-dep: Max size of last filename component */
63#endif /* Check FNAMSIZ if you change this. */
64#ifndef FNAMSIZ
65#define FNAMSIZ 100 /* Sys-dep: Max size of complete filename */
66#endif /* This must be at least as large as FNAMELEN! */
67#ifndef ISRCHLIM
68#define ISRCHLIM 50 /* Max # of chars to allow I-search on */
69#endif
70#ifndef TOBFSIZ
71#define TOBFSIZ 80 /* Size of TTY output buffer */
72#endif
73#ifndef TIBFSIZ
74#define TIBFSIZ 50 /* Size of TTY input buffer */
75#endif
76#ifndef ECHOLINES
77#define ECHOLINES 1 /* # of lines for echo area (below mode line) */
78#endif
79#ifndef MAXARGFILES
80#define MAXARGFILES 2 /* # of filename args OK at startup */
81#endif
82
83/* ELLE initialized variables.
84 * Initial values are defined in EEVINI.C, but the vars must be
85 * declared here as well so that references from all modules will
86 * compile correctly.
87 */
88
89extern char *ev_verstr; /* String: Editor name and version # */
90extern int ev_filmod; /* Default file creation mode */
91extern char *ev_fno1,*ev_fno2; /* Pre, postfix for "old" filenames */
92extern char *ev_fnn1,*ev_fnn2; /* Pre, postfix for "new" filenames */
93extern int ev_fcolumn; /* Fill Column variable */
94#if FX_INDCOMM
95extern int ev_ccolumn; /* Comment Column variable */
96#endif
97extern int ev_nwpct, ev_mvpct; /* New window selection percentages */
98#if FX_SOWIND
99extern int ev_modwso; /* Initial mode window standout flag */
100#endif
101#if FX_2MODEWINDS
102extern int ev_2modws; /* Initial setting of 2-mode-window flag */
103#endif
104extern char *ev_markshow; /* String to show when Set Mark done */
105extern char *ev_helpfile; /* Location of ELLE help file */
106extern char *ev_profile; /* Filename of ELLE binary user profile */
107extern struct profile def_prof; /* ELLE default user profile */
108
109/* Global variables */
110
111EXT chroff cur_dot; /* Current dot */
112EXT chroff mark_dot; /* Dot for mark */
113EXT int mark_p; /* flag indicating whether mark exists */
114EXT int this_cmd, last_cmd; /* Command type */
115EXT int unrchf; /* Stuffed character back for readcommand */
116EXT int exp; /* Numeric argument for commands */
117EXT int exp_p; /* Flag meaning an arg was given */
118EXT int pgoal; /* Permanent goal column */
119EXT int goal;
120EXT char *srch_str; /* Last search string specified (0 = none) */
121EXT int srch_len; /* Length of srch_str string */
122EXT int ask_len; /* Length of last string returned by "ask" */
123EXT char *homedir; /* User's home directory */
124EXT int kill_ptr; /* Index into kill ring */
125extern SBSTR *kill_ring[]; /* Kill ring table (allocated in eevini) */
126
127/* Editor Command types */
128
129#define KILLCMD 1 /* Kill command, for kill merging */
130#define ARGCMD 2 /* Argument-setter, for main loop */
131#define YANKCMD 3 /* Yank command, for yankpop */
132#define LINECMD 4 /* Next or previous line goal hacking */
133#if IMAGEN
134#define INSCMD 5 /* Simple char-insert command, for autowrap */
135#endif /*IMAGEN*/
136
137/* Misc char definitions */
138#define CTRL(ch) (037&ch)
139#define BELL ('\007') /* Will become \a in ANSI */
140#define BS ('\b')
141#define TAB ('\t')
142#define LF ('\n')
143#define FF ('\f')
144#define CR ('\r')
145#define ESC ('\033')
146#define SP (' ')
147#define DEL ('\177')
148
149#define CB_META (0200) /* Meta bit in command char */
150#define CB_EXT (0400) /* Extend bit in command char */
151#define METIZER ESC
152#define EXTIZER CTRL('X')
153
154/* Terminal parameters - set at runtime startup */
155
156EXT char *tv_stype; /* Terminal type string specified by user/system */
157EXT int scr_ht; /* # lines of main screen area */
158EXT int scr_wid; /* # columns of screen */
159EXT int scr_wd0; /* scr_wid - 1 (for 0-origin stuff) */
160EXT int trm_ospeed; /* Output speed index */
161EXT int tvc_pos; /* Cost for absolute move (# of output chars) */
162EXT int tvc_bs; /* Cost for backspace */
163EXT int tvc_ci, tvc_cin; /* Char ins cost per call, cost per column */
164EXT int tvc_cd, tvc_cdn; /* Char del " " " " " " */
165EXT int tvc_li, tvc_lin; /* Line ins cost per call, cost per line */
166EXT int tvc_ld, tvc_ldn; /* Line del " " " " " " */
167
168EXT int trm_flags; /* Terminal capabilities - bit flags */
169 /* Maybe change to word vars someday (faster) */
170#define TF_IDLIN 01 /* Has I/D line */
171#define TF_IDCHR 02 /* Has I/D char */
172#define TF_SO 04 /* Has usable standout mode */
173#define TF_CLEOL 010 /* Has clear-to-eol */
174#define TF_METAKEY 020 /* Has meta key */
175#define TF_DIRVID 040 /* Has direct-video type interface */
176
177
178/* Redisplay definitions */
179
180EXT int curs_lin; /* Line # of current cursor (0 origin) */
181EXT int curs_col; /* Column # of current cursor (0 origin) */
182
183EXT int rd_type; /* Global var: holds redisplay "hints" */
184#define redp(n) rd_type |= (n)
185
186#define RD_SCREEN 01 /* Clear everything and redisplay */
187#define RD_WINDS 02 /* Check all windows for changes (b/emod) */
188#define RD_MODE 04 /* Mode line has changed, update it. */
189#define RD_WINRES 0400 /* Assume all of window was changed (clear b/emod) */
190#define RD_MOVE 010 /* Cursor has moved */
191#define RD_UPDWIN 020 /* Window fixed, must update modified screen lines */
192/*#define RD_ICHR 0 *//* Hint: Char insert done */
193/*#define RD_DCHR 0 *//* Hint: Char del done */
194#define RD_ILIN 0100 /* Hint: Line insert done */
195#define RD_DLIN 0200 /* Hint: Line del done */
196
197/* #define RD_MOVWIN 02000 *//* Window should be re-positioned */
198#define RD_FIXWIN 02000 /* Window needs fixing (call fix_wind) */
199#define RD_TMOD 04000 /* Text changed in this window, check it. */
200#define RD_WINCLR 010000 /* Clear window with CLEOLs (not yet) */
201#define RD_CHKALL 020000 /* Check all windows for redisplay flags */
202#if IMAGEN
203#define RD_REDO 040000 /* Just re-do the entire window, don't think */
204#endif /*IMAGEN*/
205
206 /* Flags with global effects, only seen in rd_type */
207#define RDS_GLOBALS (RD_SCREEN|RD_MODE|RD_WINDS|RD_CHKALL)
208 /* Flags which are allowed per-window (in w_redp) */
209#define RDS_WINFLGS (~RDS_GLOBALS)
210 /* Flags which force FIX_WIND() to do something */
211#define RDS_DOFIX (RD_WINRES|RD_TMOD|RD_FIXWIN|RD_MOVE)
212
213#define CI_CLINE '!' /* Char indicator for continued line */
214#define CI_CNTRL '^' /* Char indicator for control chars */
215#define CI_META '~' /* Char indicator for meta-bit (8th) set */
216#define CI_TOP '|' /* Char indicator for top-bit (9th) set */
217#define MAXCHAR (8+3) /* Longest char representation (TAB) + slop */
218
219/* Definitions for screen structures */
220
221struct scr_line {
222 chroff sl_boff; /* Ptr to start of line's text in buffer */
223 int sl_len; /* # buffer chars in line (incl NL) */
224 char *sl_line; /* Ptr to screen image of line */
225 int sl_col; /* # chars in image == # columns used */
226 char sl_flg; /* Flags - set if this line modified */
227 char sl_cont; /* If line being continued on next, this */
228 /* contains 1 plus # extra chars (if any) */
229 /* stored at end of this line which shd be */
230 /* put at beg of next line. */
231 char *sl_nlin; /* New screen image line if modified flag set */
232 int sl_ncol;
233};
234 /* sl_flg definitions */
235#define SL_MOD 01 /* New line exists, must update to it */
236#define SL_EOL 02 /* Buffer line ends with EOL */
237#define SL_CSO 04 /* Current screen line is in standout mode */
238#define SL_NSO 010 /* New screen line is in standout mode */
239#if IMAGEN
240#define SL_REDO 0100 /* Line should be redone completely */
241#endif /*IMAGEN*/
242
243extern struct scr_line *scr[]; /* Screen line ptrs (allocated in e_vinit) */
244
245
246/* Buffer stuff */
247
248struct buffer
249{ SBBUF b_sb; /* MUST be 1st thing! */
250 struct buffer *b_next; /* ptr to next in chain */
251 char *b_name; /* text name */
252 char *b_fn; /* filename */
253 chroff b_dot; /* point (dot) */
254 int b_flags; /* misc. bits */
255 struct majmode *b_mode; /* Mode of buffer */
256#if IMAGEN
257 long b_mtime; /* Last file modification time */
258#endif /*IMAGEN*/
259};
260 /* b_flags definitions */
261#define B_MODIFIED 01 /* Buffer is modified */
262#define B_EOLCRLF 0200 /* On = CRLF mode, off = LF mode */
263#if IMAGEN
264#define B_PERMANENT 002 /* buffer cannot be killed */
265#define B_CMODE 004 /* "C" mode (HACK HACK) */
266#define B_BACKEDUP 010 /* Buffer has been backed up once */
267#define B_TEXTMODE 020 /* Text mode (auto-wrap, basically) */
268#define B_QUERYREP 040 /* Query-replace mode (qualifier) */
269#endif /*IMAGEN*/
270
271/* Handy macro to check EOL mode */
272#define eolcrlf(buf) (((struct buffer *)buf)->b_flags&B_EOLCRLF)
273
274/* Buffer pointers */
275
276EXT struct buffer
277 *buf_head, /* head of list of all buffers */
278 *cur_buf, /* buffer we are editing now */
279 *last_buf, /* buffer we were editing before */
280 *lines_buf; /* buffer for sep_win */
281
282/* Window stuff */
283
284struct window
285{ struct window *w_next; /* ptr to next in chain */
286 int w_flags; /* Window flags */
287 int w_pos; /* index of top line */
288 int w_ht; /* number of lines */
289 struct buffer *w_buf; /* buffer in this window */
290 int w_pct; /* % of buffer window is at */
291 int w_redp; /* Redisplay hints */
292 chroff w_topldot; /* line currently at top of window */
293 chroff w_dot; /* Saved dot while not cur_win */
294 chroff w_bmod; /* Lower bound of modified text */
295 chroff w_emod; /* Upper bound of modified text */
296 /* (offset from end of buffer!) */
297 chroff w_oldz; /* Buffer len as of last update */
298};
299
300/* Window flags */
301#define W_STANDOUT 01 /* Use terminal's standout mode for window */
302#define W_MODE 02 /* This is a mode window */
303
304/* Window pointers */
305
306EXT struct window
307 *win_head, /* head of list of all windows */
308 *cur_win, /* window we are now in */
309 *user_win, /* current user window */
310 *oth_win, /* "other" user window */
311 *mode_win, /* window for mode line */
312 *ask_win, /* window for ask (echo) area */
313 *sep_win; /* window for separation dashes */
314
315/* Major Mode stuff. Each buffer has its own major mode.
316 * Only one major mode may be in effect at any time.
317 */
318struct majmode {
319 char *mjm_name; /* Simple for now */
320};
321EXT struct majmode *fun_mode; /* Fundamental mode - the default */
322EXT struct majmode *cur_mode; /* Current major mode */
323
324/* Minor modes are currently implemented by means of flag variables
325 * which have global effects (regardless of buffer or major mode).
326 * Each variable has the name "x_mode" where x is the name of the minor
327 * mode. These are declared in the modules containing their support code.
328 * In the future this may be generalized along the lines of major modes.
329 */
330
331
332/* Miscellaneous debug stuff */
333
334EXT int dbgval; /* Set nonzero to do verify stuff */
335EXT int dbg_isw; /* Set to enable interrupts if possible */
336#if IMAGEN
337EXT int dbg_redp; /* Set to debug redisplay algorithms */
338#endif /*IMAGEN*/
339extern int errno;
340
341/* V7 routines for setexit/reset emulation */
342
343#if !(V6)
344#include <setjmp.h>
345EXT jmp_buf env_main;
346#define setexit(a) setjmp(env_main)
347#define reset(a) longjmp(env_main,a)
348#endif /*-V6*/
349
350/* Declare functions returning CHROFF values (offsets into a buffer) */
351
352extern chroff e_dot(),e_nldot(),e_pldot(),e_boldot(),e_eoldot(),
353 e_alldot(),ex_boldot(),ex_alldot(),
354 ex_blen(),e_blen(),ex_dot(),e_wdot();
355
356extern SBSTR *e_copyn();
357
358/* Some other commonly needed declarations */
359
360extern char *memalloc(), *ask(), *dottoa(), *strdup();
361#if !(V6)
362extern char *getenv();
363#endif /*-V6*/
364#include "eeproto.h" /* function prototypes */
Note: See TracBrowser for help on using the repository browser.