Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 206 lines (191 sloc) 8.322 kB
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
1 /* ex.h */
2 /* Copyright 1995 by Steve Kirkendall */
3
4 /* This is a list of all possible print flag combinations */
5 typedef enum
6 {
7 PF_NONE, /* don't print */
8 PF_PRINT, /* print the line */
9 PF_NUMBER, /* print line number, then print line */
10 PF_LIST, /* list the line (making control characters visible) */
11 PF_NUMLIST /* print line number, then list line */
12 } PFLAG;
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
13
14 typedef enum
15 {
16 ELVFNR_TILDE = 1, /* perform tilde expansion */
17 ELVFNR_DOLLAR = 2, /* expand $ENVVAR in filenames */
18 ELVFNR_PAREN = 4, /* expand (expr) in filenames */
19 ELVFNR_WILDCARD = 8, /* perform wildcard expansion in filenames */
20 ELVFNR_SPECIAL = 16, /* replace % and # with current/alternate name*/
21 ELVFNR_SPACE = 32 /* interpret <space> as filename delimiter */
22 } ELVFNR;
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
23
24 typedef enum
25 {
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
26 EX_ABBR, EX_ALIAS, EX_ALL, EX_APPEND, EX_ARGS, EX_AT, EX_AUTOCMD,
27 EX_AUEVENT, EX_AUGROUP,
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
28 EX_BANG, EX_BBROWSE, EX_BREAK, EX_BROWSE, EX_BUFFER,
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
29 EX_CALC, EX_CASE, EX_CC, EX_CD, EX_CHANGE, EX_CHECK, EX_CHREGION,
30 EX_CLOSE, EX_COLOR, EX_COMMENT, EX_COPY,
31 EX_DEFAULT, EX_DELETE, EX_DIGRAPH, EX_DISPLAY, EX_DO,
32 EX_DOALIAS, EX_DOAUTOCMD, EX_DOPROTO,
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
33 EX_ECHO, EX_EDIT, EX_ELSE, EX_EQUAL, EX_ERRLIST, EX_ERROR, EX_EVAL,
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
34 EX_FILE, EX_FOLD, EX_FOR,
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
35 EX_GOTO, EX_GLOBAL, EX_GUI,
36 EX_HELP,
37 EX_IF, EX_INSERT,
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
38 EX_JOIN,
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
39 EX_LAST, EX_LET, EX_LIST, EX_LOCAL, EX_LPR,
40 EX_MAKE, EX_MAP, EX_MARK, EX_MESSAGE, EX_MKEXRC, EX_MOVE,
2fe6e17 @mbert Import Elvis 2.2_1 (written by Steve Kirkendall)
authored
41 EX_NEXT, EX_NOFOLD, EX_NOHLSEARCH, EX_NORMAL, EX_NUMBER,
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
42 EX_ONLY, EX_OPEN,
2fe6e17 @mbert Import Elvis 2.2_1 (written by Steve Kirkendall)
authored
43 EX_PHELP, EX_POP, EX_PRESERVE, EX_PREVIOUS, EX_PRINT, EX_PUSH, EX_PUT,
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
44 EX_QALL, EX_QUIT,
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
45 EX_READ, EX_REDO, EX_REGION, EX_REWIND,
46 EX_SALL, EX_SAFELY, EX_SBBROWSE, EX_SBROWSE, EX_SET, EX_SHELL,
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
47 EX_SHIFTL, EX_SHIFTR, EX_SLAST, EX_SNEW, EX_SNEXT, EX_SOURCE,
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
48 EX_SPELL, EX_SPLIT, EX_SPREVIOUS, EX_SREWIND, EX_STAG,
49 EX_STACK, EX_STOP, EX_SUBAGAIN, EX_SUBRECENT, EX_SUBSTITUTE,
50 EX_SUSPEND, EX_SWITCH,
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
51 EX_TAG, EX_THEN, EX_TRY,
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
52 EX_UNABBR, EX_UNALIAS, EX_UNBREAK, EX_UNDO, EX_UNFOLD, EX_UNMAP,
53 EX_UNREGION,
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
54 EX_VERSION, EX_VGLOBAL, EX_VISUAL,
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
55 EX_WARNING, EX_WHILE, EX_WINDOW, EX_WNEXT, EX_WORDFILE, EX_WORDS,
56 EX_WQUIT, EX_WRITE,
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
57 EX_XIT,
58 EX_YANK,
59 EX_Z
60 } EXCMD;
61
62 /* This structure is used to store a parsed ex command */
63 typedef struct
64 {
65 WINDOW window; /* window where line was entered */
66 MARKBUF defaddr; /* default address (includes buffer spec) */
67 long from, to; /* range line numbers */
68 long fromoffset; /* exact offset of an addressed point */
69 MARK fromaddr; /* start of the "from" line */
70 MARK toaddr; /* end of "to" line (start of following line) */
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
71 ELVBOOL anyaddr; /* ElvTrue if any addresses given, ElvFalse if none */
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
72 char *cmdname; /* name of command (for diagnostics) */
73 EXCMD command; /* code for command name, e.g. EX_PRINT */
74 int cmdidx; /* index into internal array of cmd attributes */
75 int multi; /* number of times cmd name was stuttered */
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
76 ELVBOOL bang; /* ElvTrue if '!' appended to command name */
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
77 MARK destaddr; /* end of destination line */
78 regexp *re; /* regular expression */
79 CHAR *lhs; /* single-word argument or "+lineno" string */
80 CHAR *rhs; /* multi-word argument, or command line */
81 char **file; /* array of file names */
82 int nfiles; /* size of "file" array */
83 CHAR cutbuf; /* cut buffer name */
84 long count; /* count argument, or plus value */
85 PFLAG pflag; /* print flag, causes output of some lines */
86 long delta; /* print offset */
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
87 ELVBOOL global; /* executed as part of :global command? */
88 ELVBOOL undo; /* save an "undo" version before first change? */
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
89 MARK newcurs; /* where cursor should be left (NULL to not move) */
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
90 #ifdef FEATURE_V
91 MARKBUF putbacktop; /* for rectangles, where to put changed text */
92 MARKBUF putbackbottom; /* for rectangles, end to put changed text */
93 long putbackleft; /* left edge of putback rectangle */
94 long putbackright; /* right edge of putback rectangle */
95 long putbackchanges; /* used to detect changes in original buffer */
96 long cbchanges; /* used to detect changes in rect cut buffer */
97 #endif
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
98 } EXINFO;
99
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
100
97d8998 @mbert Import Elvis 2.1_4 (written by Steve Kirkendall)
authored
101 /* This stores the current state of ex's control structures */
102 typedef struct
103 {
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
104 ELVBOOL thenflag; /* result of an :if */
105 ELVBOOL switchcarry; /* falling through to next :case? */
97d8998 @mbert Import Elvis 2.1_4 (written by Steve Kirkendall)
authored
106 CHAR *switchvalue; /* result of :switch, compare to :case value */
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
107 CHAR *dotest; /* :while expression, or :for variable */
108 CHAR *list; /* space-delimited list of :for values */
109 char **file; /* array of file names */
110 int nfiles; /* number of files in the array */
97d8998 @mbert Import Elvis 2.1_4 (written by Steve Kirkendall)
authored
111 } EXCTLSTATE;
112
113
3a9bb55 @mbert Import Elvis 2.1_3 (written by Steve Kirkendall)
authored
114 /* defined in exconfig.c */
97d8998 @mbert Import Elvis 2.1_4 (written by Steve Kirkendall)
authored
115 extern EXCTLSTATE exctlstate;
116
117 /* macros for saving & restoring the control state in a local variable */
118 #define exctlsave(v) {(v) = exctlstate; memset(&exctlstate, 0, sizeof exctlstate);}
119 #define exctlrestore(v) {if (exctlstate.switchvalue) safefree(exctlstate.switchvalue);\
120 if (exctlstate.dotest) safefree(exctlstate.dotest);\
121 exctlstate = (v);}
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
122
3a9bb55 @mbert Import Elvis 2.1_3 (written by Steve Kirkendall)
authored
123 /* defined in exmake.c */
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
124 extern ELVBOOL makeflag;
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
125
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
126 BEGIN_EXTERNC
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
127 extern ELVBOOL exparseaddress P_((CHAR **refp, EXINFO *xinf));
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
128 extern RESULT experform P_((WINDOW win, MARK from, MARK to));
3a9bb55 @mbert Import Elvis 2.1_3 (written by Steve Kirkendall)
authored
129 extern RESULT exstring P_((WINDOW win, CHAR *str, char *name));
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
130 extern CHAR *exname P_((CHAR *name));
131 extern RESULT exenter P_((WINDOW win));
132 extern long exprintlines P_((WINDOW win, MARK line, long qty, PFLAG pflag));
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
133 extern CHAR *excomplete P_((WINDOW win, MARK from, MARK to));
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
134 extern void exfree P_((EXINFO *xinf));
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
135 extern ELVFNR exfilenamerules P_((CHAR *rulestr));
136 extern ELVBOOL exaddfilearg P_((char ***file, int *nfiles, char *filename, ELVFNR rules));
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
137
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
138 extern char *exaliasname P_((int i));
139 extern char *exisalias P_((char *name, ELVBOOL inuse));
140 extern void exaliassave P_((BUFFER custom));
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
141
142 extern RESULT ex_alias P_((EXINFO *xinf));
143 extern RESULT ex_doalias P_((EXINFO *xinf));
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
144 extern RESULT ex_all P_((EXINFO *xinf));
145 extern RESULT ex_append P_((EXINFO *xinf));
146 extern RESULT ex_args P_((EXINFO *xinf));
147 extern RESULT ex_at P_((EXINFO *xinf));
148 extern RESULT ex_bang P_((EXINFO *xinf));
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
149 extern RESULT ex_browse P_((EXINFO *xinf));
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
150 extern RESULT ex_buffer P_((EXINFO *xinf));
97d8998 @mbert Import Elvis 2.1_4 (written by Steve Kirkendall)
authored
151 extern RESULT ex_case P_((EXINFO *xinf));
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
152 extern RESULT ex_cd P_((EXINFO *xinf));
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
153 extern RESULT ex_check P_((EXINFO *xinf));
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
154 extern RESULT ex_color P_((EXINFO *xinf));
155 extern RESULT ex_comment P_((EXINFO *xinf));
156 extern RESULT ex_delete P_((EXINFO *xinf));
157 extern RESULT ex_digraph P_((EXINFO *xinf));
158 extern RESULT ex_display P_((EXINFO *xinf));
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
159 extern RESULT ex_do P_((EXINFO *xinf));
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
160 extern RESULT ex_edit P_((EXINFO *xinf));
161 extern RESULT ex_errlist P_((EXINFO *xinf));
162 extern RESULT ex_file P_((EXINFO *xinf));
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
163 extern RESULT ex_fold P_((EXINFO *xinf));
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
164 extern RESULT ex_global P_((EXINFO *xinf));
165 extern RESULT ex_gui P_((EXINFO *xinf));
166 extern RESULT ex_help P_((EXINFO *xinf));
167 extern RESULT ex_if P_((EXINFO *xinf));
168 extern RESULT ex_join P_((EXINFO *xinf));
169 extern RESULT ex_lpr P_((EXINFO *xinf));
170 extern RESULT ex_make P_((EXINFO *xinf));
171 extern RESULT ex_map P_((EXINFO *xinf));
172 extern RESULT ex_mark P_((EXINFO *xinf));
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
173 extern RESULT ex_message P_((EXINFO *xinf));
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
174 extern RESULT ex_mkexrc P_((EXINFO *xinf));
175 extern RESULT ex_move P_((EXINFO *xinf));
176 extern RESULT ex_next P_((EXINFO *xinf));
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
177 extern RESULT ex_nohlsearch P_((EXINFO *xinf));
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
178 extern RESULT ex_pop P_((EXINFO *xinf));
179 extern RESULT ex_print P_((EXINFO *xinf));
180 extern RESULT ex_put P_((EXINFO *xinf));
181 extern RESULT ex_qall P_((EXINFO *xinf));
182 extern RESULT ex_read P_((EXINFO *xinf));
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
183 extern RESULT ex_region P_((EXINFO *xinf));
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
184 extern RESULT ex_sall P_((EXINFO *xinf));
185 extern RESULT ex_set P_((EXINFO *xinf));
186 extern RESULT ex_shift P_((EXINFO *xinf));
187 extern RESULT ex_source P_((EXINFO *xinf));
188 extern RESULT ex_stack P_((EXINFO *xinf));
189 extern RESULT ex_substitute P_((EXINFO *xinf));
190 extern RESULT ex_suspend P_((EXINFO *xinf));
97d8998 @mbert Import Elvis 2.1_4 (written by Steve Kirkendall)
authored
191 extern RESULT ex_switch P_((EXINFO *xinf));
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
192 extern RESULT ex_tag P_((EXINFO *xinf));
193 extern RESULT ex_then P_((EXINFO *xinf));
194 extern RESULT ex_undo P_((EXINFO *xinf));
195 extern RESULT ex_version P_((EXINFO *xinf));
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
196 extern RESULT ex_wordfile P_((EXINFO *xinf));
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
197 extern RESULT ex_split P_((EXINFO *xinf));
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
198 extern RESULT ex_while P_((EXINFO *xinf));
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
199 extern RESULT ex_window P_((EXINFO *xinf));
200 extern RESULT ex_write P_((EXINFO *xinf));
201 extern RESULT ex_xit P_((EXINFO *xinf));
202 extern RESULT ex_z P_((EXINFO *xinf));
203
204 extern void colorsave P_((BUFFER custom));
205 END_EXTERNC
Something went wrong with that request. Please try again.