Annotation of OpenXM_contrib2/fep/fep_defs.h, Revision 1.4
1.1 noro 1: /* Copyright (c) 1987, 1988 by Software Research Associates, Inc. */
2:
3: #ifndef lint
4: # define FEP_DEFS \
5: "$Header: /home/mmb/utashiro/src/fep/RCS/fep_defs.h,v 4.3 1989/01/06 10:07:29 utashiro Exp $ (SRA)"
6: #endif /* lint */
7:
8: #define MAXCMDLEN 512 /* maximum command length */
9: #define MAXARGS 64 /* maximum number of arguments */
10: #define ON 1 /* on switch */
11: #define OFF 0 /* off switch */
12: #define DFL_HISTLEN 100 /* default history length */
13: #define DFL_SHOWHIST 20 /* default show history length */
14: #define IGNORED 2 /* ignored */
15: #define PROCESSED 1 /* processed or not by history */
16: #define NOT_PROCESSED 0 /* built-in functions */
17:
18: #define BS '\b' /* backspace character */
19: #define SP ' ' /* space character */
20:
21: #define DEFAULT_DELIMITERS " \t" /* default delimiter character */
22:
23: /*
24: * Pseudo functions
25: */
26: #define eq(a,b) (strcmp(a,b) == 0)
27: #define abs(a) ((a)>0?(a):-(a))
28: #define max(a,b) ((a)>(b)?(a):(b))
29: #define min(a,b) ((a)<(b)?(a):(b))
30: #ifdef KANJI
31: # define isctlchar(c) (c && !iskanji(c) && (!(c&0140) || c=='\177'))
32: # define iswordchar(c) (c && (iskanji(c) || isalnum(c) || iscntrl(c)))
33: # define isWordchar(c) ((c) && !isspace((c)))
34: #else /* KANJI */
35: # define isctlchar(c) (c && (!(c&0140) || c=='\177'))
36: # define iswordchar(c) (isalnum(c) || iscntrl(c))
37: # define isWordchar(c) ((c) && !isspace((c)))
38: #endif /* KANJI */
39: #define unctl(c) (((c)=='\177') ? '?' : ((c) >= 040) ? (c) : (c)|0100)
40: #define toctrl(c) ((c)&~0100)
41: #define ctrl(c) ((c)&037)
42:
1.4 ! noro 43: #if defined(__alpha) || defined(__x86_64__) || defined(__amd64__) || defined(ANDROID) || defined(__aarch64__)
1.1 noro 44: #define INDIRECTED (((u_long)1)<<63)
45: #define isIndirect(f) ((u_long)(f)&(u_long)INDIRECTED)
46: #define setIndirect(f) (FUNC)((u_long)(f)|(u_long)INDIRECTED)
47: #define maskIndirect(f) (FUNC *)((u_long)(f)&~(u_long)INDIRECTED)
48: #else
49: #define INDIRECTED (1<<(sizeof(char*)*8-1))
50: /* this is actually 0x80000000 on 32 bit machine,
51: that addresses kernel address space */
52: #define isIndirect(f) ((u_int)(f)&(u_int)INDIRECTED)
53: #define setIndirect(f) (FUNC)((u_int)(f)|(u_int)INDIRECTED)
54: #define maskIndirect(f) (FUNC *)((u_int)(f)&~(u_int)INDIRECTED)
55: #endif
56:
57: /*
58: * Type of character
59: */
60: #ifdef KANJI
61: # define CHAR unsigned char
62: # define CHARMASK 0377
63: #else /* KANJI */
64: # define CHAR char
65: # define CHARMASK 0177
66: #endif /* KANJI */
67:
68: /*
69: * Only one machine I know alloca() works is vax.
70: */
71: #ifdef vax
72: # define ALLOCA
73: #endif /* vax */
74:
75: /*
76: * Typedef's
77: */
78: typedef int (*FUNC)(); /* pointer to funciton */
79:
80: typedef enum { /* edit status */
81: EDITING,
82: NOTEDITING
83: } EDITSTATUS;
84:
85: typedef enum { /* edit mode */
86: NOTYET,
87: EMACS,
88: VI
89: } EDITMODE;
90:
91: typedef struct { /* bind table entry type */
92: char *bt_s;
93: FUNC bt_func;
94: } BINDENT;
95:
96: typedef struct _var {
97: char *v_name;
98: char *v_value;
99: char *v_help;
100: struct _var *v_next;
101: } VAR;
102:
103: typedef struct {
104: char *b_buf; /* buffer */
105: char *b_lastbuf; /* last i/o done pointer */
106: int b_max; /* max size */
107: int b_next; /* next read point */
108: int b_count; /* count */
109: int b_hiwater; /* high water mark */
110: } BUFFER;
111:
112: #define buf_count(b) ((b)->b_count)
113: #define buf_remain(b) ((b)->b_size-(b)->b_count)
114: /*
115: char buf_char (b, n)
116: BUFFER *b;
117: int n;
118: {
119: if (n >= b->b_count || -n > b->b_count)
120: return (-1);
121: if (b->b_next+n >= b->b_count)
122: return (b->b_buf[b->b_next+n-b->b_count]);
123: else if (b->b_next+n < 0)
124: return (b->b_buf[b->b_next+n+b->b_count]);
125: else
126: return (b->b_buf[b->b_next+n]);
127: }
128: */
129: #define buf_char(b,n) \
130: (((n) >= (b)->b_count || -(n) > (b)->b_count) \
131: ?((char)-1) \
132: :((((b)->b_next + (n)) >= (b)->b_count) \
133: ?((b)->b_buf[(b)->b_next + (n) - (b)->b_count]) \
134: :((((b)->b_next + (n)) < 0) \
135: ?((b)->b_buf[(b)->b_next + (n) + (b)->b_count]) \
136: :((b)->b_buf[(b)->b_next + (n)]))))
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>