1: /*
2: * $Id: mcommand.h,v 1.6 2025/05/18 18:15:38 snw Exp $
3: * Generic stuff for handling M commands
4: *
5: *
6: * Author: Serena Willis <snw@coherent-logic.com>
7: * Copyright (C) 1998 MUG Deutschland
8: * Copyright (C) 2023, 2025 Coherent Logic Development LLC
9: *
10: *
11: * This file is part of FreeM.
12: *
13: * FreeM is free software: you can redistribute it and/or modify
14: * it under the terms of the GNU Affero Public License as published by
15: * the Free Software Foundation, either version 3 of the License, or
16: * (at your option) any later version.
17: *
18: * FreeM is distributed in the hope that it will be useful,
19: * but WITHOUT ANY WARRANTY; without even the implied warranty of
20: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21: * GNU Affero Public License for more details.
22: *
23: * You should have received a copy of the GNU Affero Public License
24: * along with FreeM. If not, see <https://www.gnu.org/licenses/>.
25: *
26: * $Log: mcommand.h,v $
27: * Revision 1.6 2025/05/18 18:15:38 snw
28: * Add ZEDIT command for editing routines
29: *
30: * Revision 1.5 2025/04/10 01:24:38 snw
31: * Remove C++ style comments
32: *
33: * Revision 1.4 2025/04/02 03:02:42 snw
34: * Stop requiring users to pass -e to fmadm when -u or -g are passed
35: *
36: * Revision 1.3 2025/03/09 19:50:47 snw
37: * Second phase of REUSE compliance and header reformat
38: *
39: *
40: * SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
41: * SPDX-License-Identifier: AGPL-3.0-or-later
42: **/
43:
44: #if !defined(_FREEM_MCOMMAND_H)
45: # define _FREEM_MCOMMAND_H
46:
47: /* M tokens */
48: #define ABLOCK 0
49: #define ASSIGN 'a'
50: #define ASTART 1
51: #define ASTOP 2
52: #define AUNBLOCK 3
53: #define BREAK 'b'
54: #define CLOSE 'c'
55: #define CONST 24
56: #define DO 'd'
57: #define DO_BLOCK 4
58: #define ELSE 'e'
59: #define ESTART 5
60: #define ESTOP 6
61: #define ETRIGGER 7
62: #define FOR 'f' /* ALSO in symtab.c */
63: #define GOTO 'g'
64: #define HA 'h'
65: #define HALT 8
66: #define HANG 9
67: #define IF 'i'
68: #define JOB 'j'
69: #define KILL 'k'
70: #define KVALUE 10
71: #define KSUBSC 11
72: #define LOCK 'l'
73: #define MERGE 'm'
74: #define MAP 26
75: #define UNMAP 27
76: #define NEWCMD 'n'
77: #define OPEN 'o'
78: #define QUIT 'q'
79: #define READ 'r'
80: #define RLOAD 12
81: #define RSAVE 13
82: #define SET 's'
83: #define TCOMMIT 14
84: #define THEN 15
85: #define TROLLBACK 17
86: #define TSTART 18
87: #define USE 'u'
88: #define VIEW 'v'
89: #define WRITE 'w'
90: #define XECUTE 'x'
91: #define ZBREAK 'B'
92: #define ZEDIT 'E'
93: #define ZGO 'G'
94: #define ZHALT 'H'
95: #define ZINSERT 'I'
96: #define ZJOB 'J'
97: #define ZLOAD 'L'
98: #define ZNAMESPACE 'N' /* formerly ZNEW */
99: #define ZPRINT 'P'
100: #define ZQUIT 'Q'
101: #define ZREMOVE 'R'
102: #define ZSAVE 'S'
103: #define ZTRAP 'T'
104: #define ZWRITE 'W'
105: #define WATCH 20
106: #define ASSERT_TKN 21
107: #define OO_USING 22
108: #define OO_WITH 23
109: #define PRIVATE SP
110: #define THROW 25
111:
112: #define RA_CONTINUE 0
113: #define RA_PRIVATE 1
114: #define RA_NEXTCMND 2
115: #define RA_SKIPLINE 3
116:
117: typedef short MRESULT;
118: typedef short MACTION;
119:
120: extern MRESULT mcmd_tokenize(MACTION *ra, char *tmp3, char *deferrable_codptr, char *deferrable_code, int *j);
121: extern MRESULT cmd_map(MACTION *ra);
122: extern MRESULT cmd_unmap(MACTION *ra);
123: extern MRESULT cmd_then(MACTION *ra, int *then_ctr);
124: extern MRESULT cmd_throw(MACTION *ra);
125: extern MRESULT cmd_const(MACTION *ra);
126: extern MRESULT cmd_kvalue(MACTION *ra);
127: extern MRESULT cmd_ksubscripts(MACTION *ra);
128: extern MRESULT cmd_tstart(MACTION *ra);
129: extern MRESULT cmd_tcommit(MACTION *ra);
130: extern MRESULT cmd_trollback(MACTION *ra);
131: /* TODO: cmd_set */
132: extern MRESULT cmd_if(MACTION *ra);
133: extern MRESULT cmd_using(MACTION *ra);
134: extern MRESULT cmd_with(MACTION *ra);
135: extern MRESULT cmd_write(MACTION *ra, int *i);
136: extern MRESULT cmd_else(MACTION *ra);
137: extern MRESULT cmd_read(MACTION *ra);
138: extern MRESULT cmd_zedit(MACTION *ra);
139:
140: #define MRESCHECK(ra) {\
141: if (merr () > OK) goto err; \
142: switch (ra) { \
143: case RA_CONTINUE: \
144: break; \
145: case RA_NEXTCMND: \
146: goto next_cmnd; \
147: case RA_PRIVATE: \
148: goto private; \
149: case RA_SKIPLINE: \
150: goto skip_line; \
151: } \
152: }
153:
154: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>