1 /*	ESTRUCT:	Structure and preprocesser defined for
2 			MicroEMACS 4.00
3 
4 			(C)Copyright 1995 by Daniel Lawrence
5 			written by Daniel Lawrence
6 			based on code by Dave G. Conroy,
7 				Steve Wilhite and George Jones
8 */
9 
10 #ifdef	LATTICE
11 #undef	LATTICE 	 /* don't use their definitions...use ours	 */
12 #endif
13 #ifdef	MSDOS
14 #undef	MSDOS
15 #endif
16 #ifdef	WINNT
17 #undef	WINNT
18 #endif
19 #ifdef	AMIGA
20 #undef	AMIGA
21 #endif
22 #ifdef	EGA
23 #undef	EGA
24 #endif
25 #ifdef	CTRLZ
26 #undef	CTRLZ
27 #endif
28 
29 /*	Program Identification.....
30 
31 	PROGNAME should always be MicroEMACS for a distribution
32 	unmodified version. People using MicroEMACS as a shell
33 	for other products should change this to reflect their
34 	product. Macros can query this via the $progname variable
35 */
36 
37 #define PROGNAME	"MicroEMACS"
38 #define VERSION 	"4.00"
39 
40 /*	Machine/OS definitions			*/
41 /*	[Set one of these!!]			*/
42 
43 #define AMIGA	0			/* AmigaDOS			*/
44 #define AOSVS	0			/* Data General AOS/VS		*/
45 #define AUX     0                       /* Apple UNIX for Macintosh     */
46 #define AIX     0                       /* IBM UNIX for various machines*/
47 #define AVIION	0			/* Data General AViiON		*/
48 #define BSD	0			/* UNIX BSD 4.2 and ULTRIX	*/
49 #define FINDER	0			/* Macintosh OS 		*/
50 #define	FREEBSD	1			/* FREEBSD 386 version 2 or +	*/
51 #define HPUX8	0			/* HPUX HP 9000 ver 8 or less	*/
52 #define HPUX9	0			/* HPUX HP 9000 ver 9           */
53 #define MPE	0			/* HP MPE/XL			*/
54 #define MSDOS	0			/* MS-DOS			*/
55 #define WINNT	0			/* MS-Win NT			*/
56 #define OS2	0			/* Microsoft or IBM OS/2	*/
57 #define SMOS	0			/* Supermax UNIX System V	*/
58 #define SUN	0			/* SUN v4.0			*/
59 #define TOS	0			/* ST520, TOS			*/
60 #define USG	0			/* UNIX system V		*/
61 #define VMS	0			/* VAX/VMS			*/
62 #define WMCS	0			/* Wicat's MCS			*/
63 #define XENIX	0			/* IBM-PC SCO XENIX		*/
64 
65 /*	Compiler definitions			*/
66 /*	[Set one of these!!]			*/
67 #define ALCYON	0	/* ALCYON Atari ST compiler */
68 #define AZTEC	0	/* Aztec C 4.00e ONLY for the amiga now... */
69 #define DGC	0	/* Data General AOS/VS C... */
70 #define GCC	1	/* the GNU C compiler */
71 #define IC	0	/* Rational Systems Instant C */
72 #define LATTICE 0	/* Lattice 2.14 through 3.0 compilers */
73 #define MSC	0	/* MicroSoft C compile version 3 thru 7 */
74 #define MWC	0	/* Mark Williams C */
75 #define TURBO	0	/* Turbo C and Borland C++ under MSDOS */
76 #define UNIX	0	/* a standard UNIX compiler (cc) */
77 #define ZTC	0	/* Zortech C/C++ 1.02 thru 2.10 under MSDOS */
78 
79 /*	Machine stack growth direction. 		    */
80 /*  [Set this to 1 if your machine stack grows UP!!!]	    */
81 /*	data general mv/eclipse series stack grows up.	    */
82 /*	dec vax series stack grows down... got it???	    */
83 
84 #define STACK_GROWS_UP	0
85 
86 /*	Debugging options	*/
87 #define RAMSIZE		0	/* dynamic RAM memory usage tracking */
88 #define RAMSHOW		0	/* auto dynamic RAM reporting */
89 #define RAMTRCK		0	/* send debug info to MALLOC.DAT */
90 #define DEBUG_SEARCH	0	/* pop some search info on patterns */
91 
92 /*   Special keyboard/network definitions	     */
93 
94 #define ATKBD	0		/* AT-style keyboard with F11, F12 & grey keys */
95 #define WANGPC	0		/* WangPC - mostly escape sequences	*/
96 #define VT100	1		/* Handle VT100 style keypad - NOT VMS. */
97 #define KEYPAD	0		/* VMS - turn on and off application	*/
98 				/* keypad automatically */
99 #define XONDATA 0		/* VMS - set to force /NOTTSYNC/NOHOSTSY */
100 #define RMSIO	0		/* VMS - skip the rotten C runtime and	*/
101 				/* use RMS directly			*/
102 #define OPTMEM	0		/* VMS 5.0 and up - use a less standard */
103 				/* but more efficient memory allocator	*/
104 
105 /*	Terminal Output definitions		*/
106 /*	[Set one of these!!]			*/
107 
108 #define ANSI	0			/* ANSI escape sequences	*/
109 #define DASHER	0			/* DG Dasher 2xx/4xx crts	*/
110 #define DG10	0			/* Data General system/10	*/
111 #define FMR	0			/* Fujitsu FMR series driver	*/
112 #define HP110	0			/* HP110 screen driver		*/
113 #define HP150	0			/* HP150 screen driver		*/
114 #define I55	0			/* IBM PS55 DOS J4.0/V		*/
115 #define IBMPC	0			/* IBM-PC CGA/MONO/EGA/VGA drvr */
116 #define MAC	0			/* Macintosh			*/
117 #define NEC	0			/* NEC-9801VM driver		*/
118 #define OS2NPM	0			/* OS/2 non-Presentation Mgr.	*/
119 #define SMG	0			/* SMG library on VMS		*/
120 #define ST52	0			/* Atari 520/1040ST screen	*/
121 #define TERMCAP 1			/* Use TERMCAP			*/
122 #define TIPC	0			/* TI Profesional PC driver	*/
123 #define VT52	0			/* VT52 terminal (Zenith).	*/
124 #define NTCON	0			/* Windows NT console		*/
125 #define	XVT	0			/* XVT windowing system		*/
126 #define Z309	0			/* Zenith 100 PC family driver	*/
127 
128 /*	Windowing system style (pick one)				*/
129 
130 #define WINDOW_TEXT	1		/* [default] Text mode		*/
131 #define WINDOW_MSWIN	0		/* MicroSoft Windows		*/
132 #define WINDOW_MSWIN32	0		/* MicroSoft Windows 32 bit API */
133 #define WINDOW_X	0		/* X/Unix			*/
134 
135 /*	Language text options	(pick one)				*/
136 
137 #define ENGLISH 1		/* [default] */
138 #define FRENCH	0
139 #define SPANISH 0
140 #define GERMAN	0
141 #define DUTCH	0
142 #define PLATIN	0		/* Pig Latin */
143 #define JAPAN	0
144 #define LATIN	0		/* real Latin */
145 
146 /*	Configuration options	*/
147 
148 #define TYPEAH	1	/* type ahead causes update to be skipped	*/
149 #define LOGFLG	0	/* send all executed commands to EMACS.LOG	*/
150 #define VISMAC	0	/* update display during keyboard macros	*/
151 #define CTRLZ	0	/* add a ^Z at end of files under MSDOS only	*/
152 #define CLEAN	0	/* de-alloc memory on exit			*/
153 #define CALLED	0	/* is emacs a called subroutine? or stand alone */
154 
155 #define REVSTA	1	/* Status line appears in reverse video 	*/
156 #define COLOR	1	/* color commands and windows			*/
157 
158 #define FILOCK	0	/* file locking under unix BSD 4.2		*/
159 #define ISRCH	1	/* Incremental searches like ITS EMACS		*/
160 #define FLABEL	0	/* function key label code [HP150]		*/
161 #define CRYPT	1	/* file encryption enabled?			*/
162 #define MAGIC	1	/* include regular expression matching? 	*/
163 #define MOUSE	1	/* Include routines for mouse actions		*/
164 #define NOISY	1	/* Use a fancy BELL if it exists		*/
165 #define CTAGS	1	/* include vi-like tagging?			*/
166 #define SPEECH	0	/* spoken EMACS, for the sight impared [not ready] */
167 #define VARARG	1	/* use varargs.h for mlwrite()			*/
168 
169 #if	XVT
170 #undef	COLOR
171 #define	COLOR	1	/* overide this to be TRUE for XVT always	*/
172 #endif
173 
174 /*	Character set options		*/
175 /*	[Set one of these!!]		*/
176 #define ASCII	1	/* always using ASCII char sequences for now	*/
177 #define EBCDIC	0	/* later IBM mainfraim versions will use EBCDIC */
178 
179 /* handle constant and voids properly */
180 
181 #if	VMS
182 #define CONST	readonly
183 #define VOID	void
184 #define NOSHARE noshare
185 #else
186 #if	AOSVS
187 #define CONST $shared $align(1)     /* fake a  const */
188 #define VOID
189 #define NOSHARE $low32k $align(1)   /* attempt to optimize read/write vars. */
190 #else
191 
192 #if	__STDC__ || MSC || TURBO || GCC || (AMIGA && LATTICE)
193 #define CONST	const
194 #define VOID	void
195 #define NOSHARE
196 #else
197 #define CONST
198 #if	IC
199 #define	VOID	void
200 #else
201 #define VOID
202 #endif
203 #define NOSHARE
204 #endif
205 
206 #endif
207 #endif
208 
209 /*	System dependant library redefinitions, structures and includes */
210 
211 /*	multibyte character support?	*/
212 
213 #if	NEC || FMR || I55
214 #define DBCS	1	/* double byte character sets enabled */
215 #define INSDEL	1	/* use insert/delete line display optimizations */
216 
217 /* define DBCS prefix bytes */
218 #define is2char(ch) (((ch&0xff) >= 0x81 && (ch&0xff) <= 0x9f) || ((ch&0xff) >=0xe0 && (ch&0xff) <= 0xfc))
219 
220 #else
221 #define DBCS	0
222 #define INSDEL	0
223 #endif
224 
225 /*	Can we catch the SIGWINCH (the window size change signal)? */
226 
227 #if AIX || HPUX9 || FREEBSD
228 #define HANDLE_WINCH	1
229 #else
230 #define HANDLE_WINCH	0
231 #endif
232 
233 /*	Prototypes in use?	*/
234 
235 #if	MSC || TURBO || IC || VMS || GCC || ZTC
236 #define PROTO	1
237 #else
238 #define PROTO	0
239 #endif
240 
241 /*	the following define allows me to initialize unions...
242 	otherwise we make them structures (like the keybinding table)  */
243 
244 #if	__STDC__ || MSC || TURBO || IC || ZTC
245 #define ETYPE	union
246 #else
247 #define ETYPE	struct
248 #endif
249 
250 /* Instant C can't do stat()s. Arrrg. No file locking for you */
251 #if	IC && MSDOS
252 #undef FILOCK
253 #define FILOCK	0
254 #endif
255 
256 /* Mark Williams/Atari has no standard or varargs or directory functions */
257 #if	TOS & MWC
258 #undef VARARG
259 #define	VARARG	0
260 #undef	FILOCK
261 #define	FILOCK	0
262 #endif
263 
264 /* MS-Windows */
265 
266 #if     WINNT || WINDOW_MSWIN || WINDOW_MSWIN32
267 #if     WINDOW_MSWIN32
268 #undef  WINDOW_MSWIN
269 #define WINDOW_MSWIN    1
270 #endif
271 #if     WINDOW_MSWIN && WINNT
272 #undef  WINDOW_MSWIN32
273 #define WINDOW_MSWIN32  1
274 #endif
275 #undef  VOID    /* windows.h will wind up defining this */
276 #include <windows.h>    /* --------- Huge include file here !!! ---------*/
277 #if     NTCON
278 #include <wincon.h>
279 #include <stdio.h>
280 #include <dos.h>
281 #endif
282 
283 #undef NEAR
284 #define NEAR
285 #define DNEAR
286 #if     MSC || IC
287 #undef CDECL
288 #define CDECL   __cdecl
289 #define DUMMYSZ 1    /* dummy size for unsized extern arrays to avoid
290                         silly DGROUP fixup */
291 #else
292 #if	TURBO
293 #define DUMMYSZ     /* nothing */
294 #else
295 #define CDECL   _cdecl  /* ZTC */
296 #define DUMMYSZ     /* nothing */
297 #endif
298 #endif
299 
300 #if	WINNT
301 #define	EXPORT	/* Windows NT doesn't like this */
302 #endif
303 
304 #if     WINDOW_MSWIN
305 #undef  TYPEAH
306 #define TYPEAH  0   /* typeahead is handled at the term driver level */
307 #undef  CALLED
308 #define CALLED  1   /* under MS Windows, "main" resides in the sys driver */
309 #if     MSC
310 #define EXPORT  __export
311 #else
312 #define EXPORT  _export	/* Fine for TURBO and ZTC */
313 #endif
314 #endif
315 #else
316 
317 /* neither Windows NT nor MS-Windows */
318 
319 #define DUMMYSZ     /* nothing */
320 
321 #if MSDOS & (TURBO | MSC | TIPC)
322 #define	NEAR
323 #define	DNEAR
324 #define	PASCAL pascal
325 #define	CDECL cdecl
326 #else
327 #if MSDOS & ZTC
328 #define	NEAR
329 #define	DNEAR
330 #define	PASCAL _pascal
331 #define	CDECL _cdecl
332 #else
333 #define NEAR
334 #define	DNEAR
335 #define	PASCAL
336 #define	CDECL
337 #endif
338 #endif
339 
340 #endif
341 
342 #if	TURBO
343 #include      <dos.h>
344 #include      <mem.h>
345 #undef peek
346 #undef poke
347 #define       peek(a,b,c,d)   movedata(a,b,FP_SEG(c),FP_OFF(c),d)
348 #define       poke(a,b,c,d)   movedata(FP_SEG(c),FP_OFF(c),a,b,d)
349 #endif
350 
351 #if	IC
352 #include      <dos.h>
353 #undef peek
354 #undef poke
355 #define       peek(a,b,c,d)   movedata(a,b,FP_SEG(c),FP_OFF(c),d)
356 #define       poke(a,b,c,d)   movedata(FP_SEG(c),FP_OFF(c),a,b,d)
357 #endif
358 
359 #if	LATTICE & MSDOS
360 /* you may have to remove this one definition with LATTICE version
361    3.2 and above						  */
362 #define unsigned
363 #endif
364 
365 #if	IC
366 #define inp	inportb
367 #define outp	outportb
368 #define intdos(a, b)	int86(33, a, b)
369 #endif
370 
371 #if	AZTEC
372 #undef	putc
373 #undef	getc
374 #if	MSDOS
375 #define getc	a1getc
376 #define int86	sysint
377 #define intdos(a, b)	sysint(33, a, b)
378 #define inp	inportb
379 #define outp	outportb
380 #else
381 #define getc	agetc
382 #endif
383 #define putc	aputc
384 
385 struct XREG {
386 	unsigned ax,bx,cx,dx,si,di,ds,es;
387 };
388 
389 struct HREG {
390 	char al,ah,bl,bh,cl,ch,dl,dh,d1,d2,e1,e2;
391 };
392 
393 union REGS {
394 	struct XREG x;
395 	struct HREG h;
396 };
397 
398 struct SREGS {
399 	unsigned cs, ss, ds, es;
400 };
401 #endif
402 
403 #if	MSDOS & MWC
404 #include	<dos.h>
405 #define int86(a, b, c)	intcall(b, c, a)
406 #define intdos(a, b)	intcall(a, b, DOSINT)
407 #define inp(a)		in(a)
408 #define outp(a, b)	out(a, b)
409 #define movmem(a, b, c) memcpy(b, a, c)
410 
411 struct XREG {
412 	unsigned int ax,bx,cx,dx,si,di,ds,es,flags;
413 };
414 
415 struct HREG {
416 	char al,ah,bl,bh,cl,ch,dl,dh;
417 	unsigned int ds,es,flags;
418 };
419 
420 union REGS {
421 	struct XREG x;
422 	struct HREG h;
423 };
424 #endif
425 
426 #if	MSDOS & MSC
427 #include	<dos.h>
428 #include	<memory.h>
429 #define peek(a,b,c,d)	movedata(a,b,FP_SEG(c),FP_OFF(c),d)
430 #define poke(a,b,c,d)	movedata(FP_SEG(c),FP_OFF(c),a,b,d)
431 #define movmem(a, b, c) 	memcpy(b, a, c)
432 #define _strrev(a)	strrev(a)
433 #endif
434 
435 #if	MSDOS & LATTICE
436 #undef	CPM
437 #undef	LATTICE
438 #include	<dos.h>
439 #undef	CPM
440 #endif
441 
442 /* System V doesn't name this the same as others */
443 #if	USG | AIX | AUX | SUN | (OS2 & MSC)
444 #define movmem(a, b, c) 	memcpy(b, a, c)
445 #endif
446 
447 /* this keeps VMS happy */
448 #if	VMS
449 #define getname xgetname
450 #define unlink(a)	delete(a)
451 #endif
452 
453 /* some options for AOS/VS */
454 #if	AOSVS
455 #define ORMDNI	1
456 #endif
457 
458 /*	define some ability flags */
459 
460 #if	(IBMPC | Z309 | FMR | TIPC) & !(WINDOW_MSWIN | WINDOW_MSWIN32)
461 #define MEMMAP	1
462 #else
463 #define MEMMAP	0
464 #endif
465 
466 #if	MSDOS | WINNT | OS2 | USG | AIX | AUX | SMOS | HPUX8 | HPUX9 | BSD | FREEBSD | (TOS & MWC) | WMCS | SUN | MPE
467 #define ENVFUNC 1
468 #else
469 #define ENVFUNC 0
470 #endif
471 
472 #if	AUX
473 #define RETCHAR	'\n'
474 #else
475 #define RETCHAR '\r'
476 #endif
477 
478 #if	MPE
479 #define DIRSEPSTR	"."
480 #define DIRSEPCHAR	'.'
481 #else
482 #if	TOS || MSDOS || WINNT || OS2
483 #define DIRSEPSTR	"\\"
484 #define DIRSEPCHAR	'\\'
485 #define DRIVESEPCHAR	':'
486 #else
487 #define DIRSEPSTR	"/"
488 #define DIRSEPCHAR	'/'
489 #define DRIVESEPCHAR	'\0'
490 #endif
491 #endif
492 
493 #if	VARARG
494 #if	(GCC == 0) && (USG || AIX || AUX || BSD || FREEBSD || SUN || XENIX || HPUX8 || HPUX9 || AVIION || MPE)
495 #define VARG	1
496 #define SARG	0
497 #include	<varargs.h>
498 #else
499 #define VARG	0
500 #define SARG	1
501 #include	<stdarg.h>
502 #endif
503 #endif
504 
505 #if ZTC
506 #include     <dos.h>
507 #define      movmem(a, b, c) memcpy(b, a, c)
508 #endif
509 
510 /*	Emacs global flag bit definitions (for gflags)	*/
511 
512 #define GFREAD	1	/* read first file in at startup */
513 #define GFSDRAW 2	/* suppress a screen redraw */
514 #define	GFEXIT	4	/* exit from emacs pending */
515 
516 /*	internal constants	*/
517 
518 #define NBINDS	300			/* max # of bound keys		*/
519 #if	AOSVS | VMS | WINNT | SUN | BSD | FREEBSD | USG | ZENIX | HPUX8 | HPUX9 | OS2
520 #define NFILEN	256
521 #else
522 #define NFILEN	80			/* # of bytes, file name	*/
523 #endif
524 #define NBUFN	128			/* # of bytes, buffer name	*/
525 #define NLINE	256			/* # of bytes, input line	*/
526 #define NSTRING 128			/* # of bytes, string buffers	*/
527 #define NKBDM	4096			/* # of strokes, keyboard macro */
528 #define NPAT	128			/* # of bytes, pattern		*/
529 #define HUGE	1000			/* Huge number			*/
530 #define NLOCKS	256			/* max # of file locks active	*/
531 #define NCOLORS 16			/* number of supported colors	*/
532 #define KBLOCK	250			/* sizeof kill buffer chunks	*/
533 #define NRING	16			/* # of buffers in kill ring	*/
534 #define NBLOCK	16			/* line block chunk size	*/
535 #define NVSIZE	16			/* max #chars in a var name	*/
536 #define NMARKS	16			/* number of marks		*/
537 #define	MAXSYM	32			/* max # chars in symbol to expand */
538 #define MINFLEN 3			/* min # chars to match &func	*/
539 
540 #define CTRL	0x0100		/* Control flag, or'ed in		*/
541 #define META	0x0200		/* Meta flag, or'ed in			*/
542 #define CTLX	0x0400		/* ^X flag, or'ed in			*/
543 #define SPEC	0x0800		/* special key (function keys)		*/
544 #define MOUS	0x1000		/* alternative input device (mouse)	*/
545 #define SHFT	0x2000		/* shifted (for function keys)		*/
546 #define ALTD	0x4000		/* ALT key...				*/
547 #define MENU	MOUS+SPEC	/* menu selection (WINDOW_MSWIN)	*/
548 
549 #define BINDNUL 0		/* not bound to anything		*/
550 #define BINDFNC 1		/* key bound to a function		*/
551 #define BINDBUF 2		/* key bound to a buffer		*/
552 
553 #ifdef	FALSE
554 #undef	FALSE
555 #endif
556 #ifdef	TRUE
557 #undef	TRUE
558 #endif
559 
560 #define FALSE	0			/* False, no, bad, etc. 	*/
561 #define TRUE	1			/* True, yes, good, etc.	*/
562 #define ABORT	2			/* Death, ^G, abort, etc.	*/
563 #define FAILD	3			/* not-quite fatal false return */
564 
565 #define STOP	0			/* keyboard macro not in use	*/
566 #define PLAY	1			/*		  playing	*/
567 #define RECORD	2			/*		  recording	*/
568 
569 /*	Completion types 	*/
570 
571 #define CMP_BUFFER	0
572 #define CMP_COMMAND	1
573 #define CMP_FILENAME	2
574 
575 /*	Directive definitions	*/
576 
577 #define DIF		0
578 #define DELSE		1
579 #define DENDIF		2
580 #define DGOTO		3
581 #define DRETURN 	4
582 #define DENDM		5
583 #define DWHILE		6
584 #define DENDWHILE	7
585 #define DBREAK		8
586 #define DFORCE		9
587 
588 #define NUMDIRS 	10
589 
590 /*
591  * PTBEG, PTEND, FORWARD, and REVERSE are all toggle-able values for
592  * routines that need directions.
593  */
594 #define PTBEG	0	/* Leave the point at the beginning on search	*/
595 #define PTEND	1	/* Leave the point at the end on search 	*/
596 #define FORWARD 0	/* do things in a forward direction		*/
597 #define REVERSE 1	/* do things in a backwards direction		*/
598 
599 #define FIOSUC	0			/* File I/O, success.		*/
600 #define FIOFNF	1			/* File I/O, file not found.	*/
601 #define FIOEOF	2			/* File I/O, end of file.	*/
602 #define FIOERR	3			/* File I/O, error.		*/
603 #define FIOMEM	4			/* File I/O, out of memory	*/
604 #define FIOFUN	5			/* File I/O, eod of file/bad line*/
605 #define FIODEL	6			/* Can't delete/rename file	*/
606 
607 #if     WINDOW_MSWIN
608 /* values for the fbusy flag */
609 #define FREADING 1                      /* file read in progress */
610 #define FWRITING 2                      /* file write in progress */
611 /* if no file activity, the value FALSE is used */
612 #endif
613 
614 #define CFCPCN	0x0001			/* Last command was C-P, C-N	*/
615 #define CFKILL	0x0002			/* Last command was a kill	*/
616 #define CFSRCH	0x0004			/* last command was a search	*/
617 #define CFYANK	0x0008			/* last command was a yank	*/
618 
619 #define SRNORM	0			/* end past, begin front	*/
620 #define SRBEGIN 1			/* always at front		*/
621 #define SREND	2			/* always one past end		*/
622 
623 #define BELL	0x07			/* a bell character		*/
624 #define TAB	0x09			/* a tab character		*/
625 
626 #if	USG | AIX | AUX | SMOS | HPUX8 | HPUX9 | BSD | FREEBSD | SUN | XENIX | AVIION
627 #define PATHCHR ':'
628 #else
629 #if	WMCS || MPE
630 #define PATHCHR ','
631 #else
632 #define PATHCHR ';'
633 #endif
634 #endif
635 
636 #define INTWIDTH	sizeof(int) * 3
637 #define LONGWIDTH	sizeof(long) * 3
638 
639 /*	Macro argument token types					*/
640 
641 #define TKNUL	0			/* end-of-string		*/
642 #define TKARG	1			/* interactive argument 	*/
643 #define TKBUF	2			/* buffer argument		*/
644 #define TKVAR	3			/* user variables		*/
645 #define TKENV	4			/* environment variables	*/
646 #define TKFUN	5			/* function.... 		*/
647 #define TKDIR	6			/* directive			*/
648 #define TKLBL	7			/* line label			*/
649 #define TKLIT	8			/* numeric literal		*/
650 #define TKSTR	9			/* quoted string literal	*/
651 #define TKCMD	10			/* command name 		*/
652 
653 /*	Internal defined functions					*/
654 
655 #define nextab(a)	(a - (a % tabsize)) + tabsize
656 
657 /* DIFCASE represents the integer difference between upper
658    and lower case letters.  It is an xor-able value, which is
659    fortunate, since the relative positions of upper to lower
660    case letters is the opposite of ascii in ebcdic.
661 */
662 
663 #if	ASCII
664 #define DIFCASE 	0x20
665 #else
666 #define DIFCASE 	0x40
667 #endif
668 
669 /*	Dynamic RAM tracking and reporting redefinitions	*/
670 
671 #if	RAMSIZE
672 #define malloc	allocate
673 #define free	release
674 #else
675 #if	VMS & OPTMEM
676 #define malloc	VAXC$MALLOC_OPT
677 #define free	VAXC$FREE_OPT
678 #define calloc	VAXC$CALLOC_OPT
679 #define realloc	VAXC$REALLOC_OPT
680 #define cfree	VAXC$CFREE_OPT
681 #endif
682 #endif
683 
684 /* under MS Windows, we use dialog boxes to prompt the user for filenames */
685 #if     WINDOW_MSWIN
686 #define FILENAMEREPLY(p,b,nb)   filenamedlg(p,b,nb,TRUE)
687 #else
688 #define FILENAMEREPLY(p,b,nb)   mlreply(p,b,nb)
689 #endif
690 
691 /* formal parameters to procedures are stored as a linked list
692    of argument names using the following simple structure:
693 */
694 
695 typedef struct PARG {
696 	struct PARG *next;	/* ptr to next linked argument */
697 	char name[NVSIZE+1];	/* name of the argument */
698 } PARG;
699 
700 /* UNDO definitions and types */
701 
702 typedef int OPTYPE;	/* type of operation being recorded/played back */
703 
704 #define	OP_CMND		1	/* beginning of command */
705 #define	OP_DELC		2	/* delete a single character */
706 #define	OP_INSC		3	/* insert a single character */
707 #define OP_DSTR		4	/* delete a string of characters */
708 #define	OP_ISTR		5	/* insert a string of characters */
709 #define	OP_REPC		6	/* replace a character */
710 #define	OP_CPOS		7	/* set the cursor position */
711 
712 /* object to be undone! */
713 
714 typedef union OBJECT {
715 	char obj_char;		/* a character */
716 	char obj_string[1];	/* many characters */
717 	char *obj_sptr;		/* a ptr to a character */
718 } OBJECT;
719 
720 typedef struct UNDO_OBJ {
721 	struct UNDO_OBJ *next;	/* ptr to next undo object */
722 	OPTYPE type;		/* type of operation */
723 	long line_num;		/* line offset from buffer beginning */
724 	int offset;		/* offset into that line */
725 	long count;		/* repetitions? */
726 	OBJECT undo_obj;	/* object to be undone */
727 } UNDO_OBJ;
728 
729 /*
730  * There is a window structure allocated for every active display window. The
731  * windows are kept in a big list, in top to bottom screen order, with the
732  * listhead at "wheadp". Each window contains its own values of dot and mark.
733  * The flag field contains some bits that are set by commands to guide
734  * redisplay. Although this is a bit of a compromise in terms of decoupling,
735  * the full blown redisplay is just too expensive to run for every input
736  * character.
737  */
738 typedef struct	EWINDOW {
739 	struct	EWINDOW *w_wndp; 	/* Next window			*/
740 	struct	BUFFER *w_bufp; 	/* Buffer displayed in window	*/
741 	struct	LINE *w_linep;		/* Top line in the window	*/
742 	struct	LINE *w_dotp;		/* Line containing "."		*/
743 	short	w_doto; 		/* Byte offset for "."		*/
744 	struct	LINE *w_markp[NMARKS];	/* Line containing "mark"	*/
745 	short	w_marko[NMARKS];	/* Byte offset for "mark"	*/
746 	char	w_toprow;		/* Origin 0 top row of window	*/
747 	char	w_ntrows;		/* # of rows of text in window	*/
748 	char	w_force;		/* If NZ, forcing row.		*/
749 	char	w_flag; 		/* Flags.			*/
750 #if	COLOR
751 	char	w_fcolor;		/* current forground color	*/
752 	char	w_bcolor;		/* current background color	*/
753 #endif
754 	int	w_fcol; 		/* first column displayed	*/
755 }	EWINDOW;
756 
757 #define WFFORCE 0x01			/* Window needs forced reframe	*/
758 #define WFMOVE	0x02			/* Movement from line to line	*/
759 #define WFEDIT	0x04			/* Editing within a line	*/
760 #define WFHARD	0x08			/* Better to a full display	*/
761 #define WFMODE	0x10			/* Update mode line.		*/
762 #define WFCOLR	0x20			/* Needs a color change 	*/
763 
764 /* This structure holds the information about each line appearing on the
765  * video display. The redisplay module uses an array of virtual display
766  * lines. On systems that do not have direct access to display memory,
767  * there is also an array of physical display lines used to minimize
768  * video updating. In most cases, these two arrays are unique. If
769  * WINDOW_MSWIN is 1, there is a pair of such arrays in each SCREEN
770  * structure.
771  */
772 
773 typedef struct	VIDEO {
774 	int	v_flag; 		/* Flags */
775 #if	COLOR
776 	int	v_fcolor;		/* current forground color */
777 	int	v_bcolor;		/* current background color */
778 	int	v_rfcolor;		/* requested forground color */
779 	int	v_rbcolor;		/* requested background color */
780 #endif
781 	int	v_left;			/* left edge of reverse video */
782 	int	v_right;		/* right right of reverse video */
783 #if	INSDEL && MEMMAP == 0
784 	int	v_rline;		/* requested screen line # */
785 #endif
786 	char	v_text[1];		/* Screen data. */
787 }	VIDEO;
788 
789 #define VFNEW	0x0001			/* contents not meaningful yet	*/
790 #define VFCHG	0x0002			/* Changed flag 		*/
791 #define VFEXT	0x0004			/* extended (beyond column 80)	*/
792 #define VFCOL	0x0008			/* color change requested	*/
793 
794 /*
795  *	This structure holds the information about each separate "screen"
796  * within the current editing session.  On a character based system, these
797  * screens overlay each other, and can individually be brought to front.
798  * On a windowing system like MicroSoft Windows 3.0, OS/2, the Macintosh,
799  * Intuition, Sunview or X-windows, each screen is represented in an OS
800  * window.  The terminolgy is wrong in emacs.....
801  *
802  *	EMACS		The outside World
803  *	screen		window
804  *	window		pane
805  */
806 
807 typedef struct SCREEN {
808 	struct SCREEN *s_next_screen;	/* link to next screen in list */
809 	EWINDOW *s_first_window; 	/* head of linked list of windows */
810 	EWINDOW *s_cur_window;		/* current window in this screen */
811 	char *s_screen_name;		/* name of the current window */
812 	short s_roworg; 		/* row origin of stored screen */
813 	short s_colorg; 		/* column origin of stored screen */
814 	short s_nrow;			/* row width of stored screen */
815 	short s_ncol;			/* column origin of stored screen */
816 #if WINDOW_MSWIN
817 	VIDEO **s_virtual;		/* virtual screen contents */
818 	VIDEO **s_physical;		/* physical screen contents */
819 	HWND s_drvhandle;		/* handle for the "term" driver */
820 #endif
821 } SCREEN;
822 
823 /*
824  * Text is kept in buffers. A buffer header, described below, exists for every
825  * buffer in the system. The buffers are kept in a big list, so that commands
826  * that search for a buffer by name can find the buffer header. There is a
827  * safe store for the dot and mark in the header, but this is only valid if
828  * the buffer is not being displayed (that is, if "b_nwnd" is 0). The text for
829  * the buffer is kept in a circularly linked list of lines, with a pointer to
830  * the header line in "b_linep".  Buffers may be "Inactive" which means the
831  * files associated with them have not been read in yet.  These get read in
832  * at "use buffer" time.
833  * Some buffers are really procedures and have a little extra information
834  * stored with them.
835  */
836 typedef struct	BUFFER {
837 	struct	BUFFER *b_bufp; 	/* Link to next BUFFER		*/
838 	struct	LINE *b_dotp;		/* Link to "." LINE structure	*/
839 	short	b_doto; 		/* Offset of "." in above LINE	*/
840 	struct	LINE *b_markp[NMARKS];	/* The same as the above two,	*/
841 	short	b_marko[NMARKS];	/* but for the "mark"		*/
842 	int	b_fcol; 		/* first col to display 	*/
843 	struct	LINE *b_linep;		/* Link to the header LINE	*/
844 	struct	LINE *b_topline;	/* Link to narrowed top text	*/
845 	struct	LINE *b_botline;	/* Link to narrowed bottom text */
846 	char	b_active;		/* window activated flag	*/
847 	char	b_nwnd; 		/* Count of windows on buffer	*/
848 	char	b_exec; 		/* how many active executions	*/
849 	char	b_flag; 		/* Flags			*/
850 	int	b_mode; 		/* editor mode of this buffer	*/
851 	char	b_fname[NFILEN];	/* File name			*/
852 	char	b_bname[NBUFN]; 	/* Buffer name			*/
853 #if	CRYPT
854 	char   b_key[NPAT];		/* current encrypted key        */
855 #endif
856 	int b_numargs;			/* number of arguments to procedure */
857 	PARG *b_args;			/* ptr to the first argument	*/
858 	UNDO_OBJ *undo_head;		/* head of undo stack for buffer */
859 	long undo_count;		/* # of undo operations stacked */
860 	long last_access;		/* time of last access		*/
861 }	BUFFER;
862 
863 #define BFINVS	0x01			/* Internal invisable buffer	*/
864 #define BFCHG	0x02			/* Changed since last write	*/
865 #define BFTRUNC 0x04			/* buffer was truncated when read */
866 #define BFNAROW 0x08			/* buffer has been narrowed	*/
867 
868 #define	NOTPROC	-1			/* buffer is not a procedure */
869 
870 /*	mode flags	*/
871 #define NUMMODES	11	       /* # of defined modes	       */
872 
873 #define MDWRAP	0x0001			/* word wrap			*/
874 #define MDCMOD	0x0002			/* C indentation and fence match*/
875 #define MDSPELL 0x0004			/* spell error parsing		*/
876 #define MDEXACT 0x0008			/* Exact matching for searches	*/
877 #define MDVIEW	0x0010			/* read-only buffer		*/
878 #define MDOVER	0x0020			/* overwrite mode		*/
879 #define MDMAGIC 0x0040			/* regular expresions in search */
880 #define MDCRYPT 0x0080			/* encrytion mode active	*/
881 #define MDASAVE 0x0100			/* auto-save mode		*/
882 #define MDREPL	0x0200			/* replace mode 		*/
883 #define MDABBR	0x0400			/* abbreviation expansion mode	*/
884 
885 /*
886  * The starting position of a region, and the size of the region in
887  * characters, is kept in a region structure.  Used by the region commands.
888  */
889 typedef struct	{
890 	struct	LINE *r_linep;		/* Origin LINE address. 	*/
891 	short	r_offset;		/* Origin LINE offset.		*/
892 	long	r_size; 		/* Length in characters.	*/
893 }	REGION;
894 
895 /*
896  * All text is kept in circularly linked lists of "LINE" structures. These
897  * begin at the header line (which is the blank line beyond the end of the
898  * buffer). This line is pointed to by the "BUFFER". Each line contains a the
899  * number of bytes in the line (the "used" size), the size of the text array,
900  * and the text. The end of line is not stored as a byte; it's implied.
901  */
902 typedef struct	LINE {
903 	struct	LINE *l_fp;		/* Link to the next line	*/
904 	struct	LINE *l_bp;		/* Link to the previous line	*/
905 	short	l_size; 		/* Allocated size		*/
906 	short	l_used; 		/* Used size			*/
907 	char	l_text[1];		/* A bunch of characters.	*/
908 }	LINE;
909 
910 #define lforw(lp)	((lp)->l_fp)
911 #define lback(lp)	((lp)->l_bp)
912 #if UNIX && (SUN || HPUX8 || HPUX9 || BSD || FREEBSD)
913 #define lgetc(lp, n)	((unsigned char)(lp)->l_text[(n)])
914 #else
915 #define lgetc(lp, n)	((lp)->l_text[(n)])
916 #endif
917 #define lputc(lp, n, c) ((lp)->l_text[(n)]=(c))
918 #define lused(lp)	((lp)->l_used)
919 #define lsize(lp)	((lp)->l_size)
920 #define ltext(lp)	((lp)->l_text)
921 
922 /*	This structure is used to hold a user variables name and its
923 	current value. These are used for both the global and the
924 	local symbol tables.
925 */
926 
927 typedef struct UVAR {
928 	char u_name[NVSIZE + 1];	       /* name of user variable */
929 	char *u_value;				/* value (string) */
930 } UVAR;
931 
932 #define	VT_NONE		0	/* don't declare it if not found */
933 #define	VT_LOCAL	1	/* local to the current procedure */
934 #define	VT_GLOBAL	2	/* global to all procedures */
935 
936 /*	A UTABLE is a user variable table.... containing some header
937 	information and an array of user variable names and definitions.
938 	They are held together in a linked list, the last member of
939 	the list being the global user variable table.
940 */
941 
942 typedef struct UTABLE {
943 	struct UTABLE *next;	/* ptr to next user variable table */
944 	int size;		/* max number of variables in table */
945 	BUFFER *bufp;		/* ptr to buffer holding procedure
946 				   assosiated with this symbol table. */
947 	UVAR uv[1];		/* list of variable names/definitions
948 				   in this variable table */
949 } UTABLE;
950 
951 /*
952  * The editor communicates with the display using a high level interface. A
953  * "TERM" structure holds useful variables, and indirect pointers to routines
954  * that do useful operations. The low level get and put routines are here too.
955  * This lets a terminal, in addition to having non standard commands, have
956  * funny get and put character code too. The calls might get changed to
957  * "termp->t_field" style in the future, to make it possible to run more than
958  * one terminal type.
959  */
960 #if	PROTO
961 typedef struct	{
962 	short	t_mrow; 		/* max number of rows allowable */
963 	short	t_nrow; 		/* current number of rows used	*/
964 	short	t_mcol; 		/* max Number of columns.	*/
965 	short	t_ncol; 		/* current Number of columns.	*/
966 	short	t_roworg;		/* origin row (normally zero)	*/
967 	short	t_colorg;		/* origin column (normally zero)*/
968 	short	t_margin;		/* min margin for extended lines*/
969 	short	t_scrsiz;		/* size of scroll region "	*/
970 	int	t_pause;		/* # times thru update to pause */
971 	int (PASCAL NEAR *t_open)(void);    /* Open terminal at the start.*/
972 	int (PASCAL NEAR *t_close)(void);   /* Close terminal at end.	*/
973 	int (PASCAL NEAR *t_kopen)(void);   /* Open keyboard		*/
974 	int (PASCAL NEAR *t_kclose)(void);  /* Close keyboard		*/
975 	int (PASCAL NEAR *t_getchar)(void); /* Get character from keyboard. */
976 	int (PASCAL NEAR *t_putchar)(int);  /* Put character to display.*/
977 	int (PASCAL NEAR *t_flush)(void);   /* Flush output buffers.	*/
978 	int (PASCAL NEAR *t_move)(int, int);/* Move the cursor, origin 0.*/
979 	int (PASCAL NEAR *t_eeol)(void);    /* Erase to end of line.	*/
980 	int (PASCAL NEAR *t_eeop)(void);    /* Erase to end of page.	*/
981 	int (PASCAL NEAR *t_clrdesk)(void); /* Clear the page totally	*/
982 	int (PASCAL NEAR *t_beep)(void);    /* Beep.			*/
983 	int (PASCAL NEAR *t_rev)(int);      /* set reverse video state	*/
984 	int (PASCAL NEAR *t_rez)(char *);   /* change screen resolution	*/
985 #if	COLOR
986 	int (PASCAL NEAR *t_setfor)(int);   /* set forground color	*/
987 	int (PASCAL NEAR *t_setback)(int);  /* set background color 	*/
988 #endif
989 #if	INSDEL
990 	int (PASCAL NEAR *t_insline)(int); /* insert a screen line 	*/
991 	int (PASCAL NEAR *t_delline)(int); /* delete a screen line 	*/
992 #endif
993 #if     WINDOW_MSWIN
994         int (PASCAL NEAR *t_sleep)(int);   /* go to sleep for a while	*/
995         int (PASCAL NEAR *t_newscr)(SCREEN *);  /* create new screen display */
996         int (PASCAL NEAR *t_delscr)(SCREEN *);  /* destroy screen display */
997         int (PASCAL NEAR *t_selscr)(SCREEN *);  /* select screen display */
998         int (PASCAL NEAR *t_sizscr)(SCREEN *);  /* resize screen display */
999         int (PASCAL NEAR *t_topscr)(SCREEN *);  /* bring screen to top	*/
1000 #endif
1001 }	TERM;
1002 #else	/* TERM structure, no prototyping.*/
1003 
1004 typedef struct	{
1005 	short	t_mrow; 		/* max number of rows allowable */
1006 	short	t_nrow; 		/* current number of rows used	*/
1007 	short	t_mcol; 		/* max Number of columns.	*/
1008 	short	t_ncol; 		/* current Number of columns.	*/
1009 	short	t_roworg;		/* origin row (normally zero)	*/
1010 	short	t_colorg;		/* origin column (normally zero)*/
1011 	short	t_margin;		/* min margin for extended lines*/
1012 	short	t_scrsiz;		/* size of scroll region "	*/
1013 	int	t_pause;		/* # times thru update to pause */
1014 	int (PASCAL NEAR *t_open)();	/* Open terminal at the start.	*/
1015 	int (PASCAL NEAR *t_close)();	/* Close terminal at end.	*/
1016 	int (PASCAL NEAR *t_kopen)();	/* Open keyboard		*/
1017 	int (PASCAL NEAR *t_kclose)();	/* close keyboard		*/
1018 	int (PASCAL NEAR *t_getchar)(); /* Get character from keyboard. */
1019 	int (PASCAL NEAR *t_putchar)(); /* Put character to display.	*/
1020 	int (PASCAL NEAR *t_flush)();	/* Flush output buffers.	*/
1021 	int (PASCAL NEAR *t_move)();	/* Move the cursor, origin 0.	*/
1022 	int (PASCAL NEAR *t_eeol)();	/* Erase to end of line.	*/
1023 	int (PASCAL NEAR *t_eeop)();	/* Erase to end of page.	*/
1024 	int (PASCAL NEAR *t_clrdesk)(); /* Clear the page totally	*/
1025 	int (PASCAL NEAR *t_beep)();	/* Beep.			*/
1026 	int (PASCAL NEAR *t_rev)();	/* set reverse video state	*/
1027 	int (PASCAL NEAR *t_rez)();	/* change screen resolution	*/
1028 #if	COLOR
1029 	int (PASCAL NEAR *t_setfor)();	/* set forground color		*/
1030 	int (PASCAL NEAR *t_setback)(); /* set background color 	*/
1031 #endif
1032 #if	INSDEL
1033 	int (PASCAL NEAR *t_insline)(); /* insert a screen line 	*/
1034 	int (PASCAL NEAR *t_delline)(); /* delete a screen line 	*/
1035 #endif
1036 #if     WINDOW_MSWIN
1037         int (PASCAL NEAR *t_sleep)();   /* go to sleep for a while	*/
1038         int (PASCAL NEAR *t_newscr)();  /* create new screen display	*/
1039         int (PASCAL NEAR *t_delscr)();  /* destroy screen display	*/
1040         int (PASCAL NEAR *t_selscr)();  /* select screen display	*/
1041         int (PASCAL NEAR *t_sizscr)();  /* resize screen display	*/
1042         int (PASCAL NEAR *t_topscr)();  /* bring screen to top		*/
1043 #endif
1044 }	TERM;
1045 #endif
1046 
1047 
1048 /*	TEMPORARY macros for terminal I/O  (to be placed in a machine
1049 					    dependant place later) */
1050 
1051 #define TTopen		(*term.t_open)
1052 #define TTclose 	(*term.t_close)
1053 #define TTkopen 	(*term.t_kopen)
1054 #define TTkclose	(*term.t_kclose)
1055 #define TTgetc		(*term.t_getchar)
1056 #define TTputc		(*term.t_putchar)
1057 #define TTflush 	(*term.t_flush)
1058 #define TTmove		(*term.t_move)
1059 #define TTeeol		(*term.t_eeol)
1060 #define TTeeop		(*term.t_eeop)
1061 #define TTclrdesk	(*term.t_clrdesk)
1062 #define TTbeep		(*term.t_beep)
1063 #define TTrev		(*term.t_rev)
1064 #define TTrez		(*term.t_rez)
1065 #if	COLOR
1066 #define TTforg		(*term.t_setfor)
1067 #define TTbacg		(*term.t_setback)
1068 #endif
1069 
1070 /*	Structure for the table of current key bindings 	*/
1071 
1072 ETYPE EPOINTER {
1073 	int (PASCAL NEAR *fp)();	/* C routine to invoke */
1074 	BUFFER *buf;			/* buffer to execute */
1075 };
1076 
1077 typedef struct	{
1078 	short k_code;		/* Key code			*/
1079 	short k_type;		/* binding type (C function or EMACS buffer) */
1080 	ETYPE EPOINTER k_ptr;	/* ptr to thing to execute */
1081 }	KEYTAB;
1082 
1083 /*	structure for the name binding table		*/
1084 
1085 typedef struct {
1086 	char *n_name;			/* name of function key */
1087 	int (PASCAL NEAR *n_func)();	/* function name is bound to */
1088 }	NBIND;
1089 
1090 /*	The editor holds deleted text chunks in the KILL buffer. The
1091 	kill buffer is logically a stream of ascii characters, however
1092 	due to its unpredicatable size, it gets implemented as a linked
1093 	list of chunks. (The d_ prefix is for "deleted" text, as k_
1094 	was taken up by the keycode structure)
1095 */
1096 
1097 typedef struct KILL {
1098 	struct KILL *d_next;   /* link to next chunk, NULL if last */
1099 	char d_chunk[KBLOCK];	/* deleted text */
1100 } KILL;
1101 
1102 /*	When emacs's command interpetor needs to get a variable's name,
1103 	rather than it's value, it is passed back as a VDESC variable
1104 	description structure. The v_num field is a index into the
1105 	appropriate variable table.
1106 */
1107 
1108 typedef struct VDESC {
1109 	int v_type;	/* type of variable */
1110 	int v_num;	/* ordinal pointer to variable in list */
1111 	UTABLE *v_ut;	/* ptr to appropriate user table if user var */
1112 } VDESC;
1113 
1114 /*	The !WHILE directive in the execution language needs to
1115 	stack references to pending whiles. These are stored linked
1116 	to each currently open procedure via a linked list of
1117 	the following structure
1118 */
1119 
1120 typedef struct WHBLOCK {
1121 	LINE *w_begin;		/* ptr to !while statement */
1122 	LINE *w_end;		/* ptr to the !endwhile statement*/
1123 	int w_type;		/* block type */
1124 	struct WHBLOCK *w_next; /* next while */
1125 } WHBLOCK;
1126 
1127 #define BTWHILE 	1
1128 #define BTBREAK 	2
1129 
1130 /*	Abbreviations are short symbols that expand to longer strings
1131 	when typed into a buffer with no intervening whitespace or commands.
1132 	This structure grows dynamically as needed.
1133 */
1134 
1135 typedef struct ABBREV {
1136 	struct ABBREV *ab_next;		/* pointer to the next abbreviation */
1137 	char ab_sym[MAXSYM + 1];	/* name to expand */
1138 	char ab_exp[1];			/* string to expand to */
1139 } ABBREV;
1140 
1141 /* Search definitions... */
1142 
1143 /* HICHAR - 1 is the largest character we will deal with.
1144  * BMAPSIZE represents the number of bytes in the bitmap.
1145  */
1146 #define HICHAR		256
1147 #define BMAPSIZE	HICHAR >> 3
1148 
1149 /*
1150  * Jump table structures.
1151  */
1152 typedef struct {
1153 	int	jump;
1154 	int	patlen;
1155 	int	delta[HICHAR];
1156 	char	patrn[NPAT];
1157 } DELTA;
1158 
1159 #if	MAGIC
1160 /*
1161  * Defines for the metacharacters in the regular expression
1162  * search routines.  MCNIL and GROUP are used in both search
1163  * and replace metachar-arrays.
1164  */
1165 #define MCNIL		0	/* Like the '\0' for strings.*/
1166 #define JMPTABLE	1
1167 #define LITSTRING	2	/* Literal string.*/
1168 #define LITCHAR 	3	/* Literal character.*/
1169 #define ANY		4	/* Any character but the <NL>.*/
1170 #define CCL		5
1171 #define NCCL		6
1172 #define BOL		7
1173 #define EOL		8
1174 #define BOWRD		9
1175 #define EOWRD		10
1176 #define GRPBEG		11	/* Signal start of group.*/
1177 #define GRPEND		12	/* Signal end of group.*/
1178 #define GROUP		13	/* String of group match.*/
1179 #define DITTO		14	/* Replacement with match string.*/
1180 
1181 #define CLOSURE 	0x0100	/* An or-able value for a closure modifier.*/
1182 #define CLOSURE_1	0x0200	/* An or-able value for a closure modifier.*/
1183 #define ZEROONE 	0x0400	/* An or-able value for a closure modifier.*/
1184 
1185 #define ALLCLOS 	(CLOSURE | CLOSURE_1 | ZEROONE)
1186 #define MASKCLO 	(~ALLCLOS)
1187 
1188 #define MC_ANY		'.'	/* 'Any' character (except newline).*/
1189 #define MC_CCL		'['	/* Character class.*/
1190 #define MC_NCCL 	'^'	/* Negate character class.*/
1191 #define MC_RCCL 	'-'	/* Range in character class.*/
1192 #define MC_ECCL 	']'	/* End of character class.*/
1193 #define MC_BOL		'^'	/* Beginning of line.*/
1194 #define MC_EOL		'$'	/* End of line.*/
1195 #define MC_CLOSURE	'*'	/* Closure - zero to many characters match.*/
1196 #define MC_CLOSURE_1	'+'	/* Closure - one to many characters match.*/
1197 #define MC_ZEROONE	'?'	/* Closure - zero to one characters match.*/
1198 #define MC_DITTO	'&'	/* Use matched string in replacement.*/
1199 #define MC_GRPBEG	'('	/* Start of group (begun with a backslash).*/
1200 #define MC_GRPEND	')'	/* End of group (begun with a backslash).*/
1201 #define MC_BOWRD	'<'	/* Beginning of word (begun with a backslash).*/
1202 #define MC_EOWRD	'>'	/* End of word (begun with a backslash).*/
1203 #define MC_ESC		'\\'	/* Escape - suppress meta-meaning.*/
1204 
1205 #define MAXGROUPS	10		/* 1 + maximum # of r. e. groups. */
1206 #define BIT(n)		(1 << (n))	/* An integer with one bit set.*/
1207 
1208 /* Typedefs that define the bitmap type for searching (EBITMAP),
1209  * the meta-character structure for MAGIC mode searching (MC),
1210  * and the meta-character structure for MAGIC mode replacment (RMC).
1211  */
1212 typedef char	*EBITMAP;
1213 
1214 typedef struct {
1215 	short int	mc_type;
1216 	union {
1217 		int	lchar;
1218 		int	group_no;
1219 		char	*lstring;
1220 		DELTA	*jmptable;
1221 		EBITMAP	cclmap;
1222 	} u;
1223 } MC;
1224 
1225 typedef struct {
1226 	short int	mc_type;
1227 	union {
1228 		int	group_no;
1229 		char	*rstr;
1230 	} u;
1231 } RMC;
1232 #endif
1233 
1234 /*
1235 	This is the message which should be added to any "About MicroEMACS"
1236 	boxes on any of the machines with window managers.
1237 
1238 
1239 	------------------------------------------
1240 	|					 |
1241 	|	 MicroEMACS v4.xx		 |
1242 	|		for the ............	 |
1243 	|					 |
1244 	|    Text Editor and Corrector		 |
1245 	|					 |
1246 	|    written by Daniel M. Lawrence	 |
1247 	|    [based on code by Dave Conroy]	 |
1248 	|					 |
1249 	|    Send inquiries and donations to:	 |
1250 	|    617 New York St			 |
1251 	|    Lafayette, IN 47901		 |
1252 	|					 |
1253 	------------------------------------------
1254 */
1255