Annotation of freem/src/mcommand.h, revision 1.5
1.1 snw 1: /*
1.5 ! snw 2: * $Id: mcommand.h,v 1.4 2025/04/02 03:02:42 snw Exp $
1.1 snw 3: * Generic stuff for handling M commands
4: *
5: *
1.2 snw 6: * Author: Serena Willis <snw@coherent-logic.com>
1.1 snw 7: * Copyright (C) 1998 MUG Deutschland
1.3 snw 8: * Copyright (C) 2023, 2025 Coherent Logic Development LLC
1.1 snw 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: *
1.4 snw 26: * $Log: mcommand.h,v $
1.5 ! snw 27: * Revision 1.4 2025/04/02 03:02:42 snw
! 28: * Stop requiring users to pass -e to fmadm when -u or -g are passed
! 29: *
1.4 snw 30: * Revision 1.3 2025/03/09 19:50:47 snw
31: * Second phase of REUSE compliance and header reformat
32: *
1.3 snw 33: *
34: * SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
35: * SPDX-License-Identifier: AGPL-3.0-or-later
1.1 snw 36: **/
37:
38: #if !defined(_FREEM_MCOMMAND_H)
39: # define _FREEM_MCOMMAND_H
40:
41: /* M tokens */
42: #define ABLOCK 0
43: #define ASSIGN 'a'
44: #define ASTART 1
45: #define ASTOP 2
46: #define AUNBLOCK 3
47: #define BREAK 'b'
48: #define CLOSE 'c'
49: #define CONST 24
50: #define DO 'd'
51: #define DO_BLOCK 4
52: #define ELSE 'e'
53: #define ESTART 5
54: #define ESTOP 6
55: #define ETRIGGER 7
56: #define FOR 'f' /* ALSO in symtab.c */
57: #define GOTO 'g'
58: #define HA 'h'
59: #define HALT 8
60: #define HANG 9
61: #define IF 'i'
62: #define JOB 'j'
63: #define KILL 'k'
64: #define KVALUE 10
65: #define KSUBSC 11
66: #define LOCK 'l'
67: #define MERGE 'm'
68: #define MAP 26
69: #define UNMAP 27
70: #define NEWCMD 'n'
71: #define OPEN 'o'
72: #define QUIT 'q'
73: #define READ 'r'
74: #define RLOAD 12
75: #define RSAVE 13
76: #define SET 's'
77: #define TCOMMIT 14
78: #define THEN 15
79: #define TROLLBACK 17
80: #define TSTART 18
81: #define USE 'u'
82: #define VIEW 'v'
83: #define WRITE 'w'
84: #define XECUTE 'x'
85: #define ZBREAK 'B'
86: #define ZGO 'G'
87: #define ZHALT 'H'
88: #define ZINSERT 'I'
89: #define ZJOB 'J'
90: #define ZLOAD 'L'
1.5 ! snw 91: #define ZNAMESPACE 'N' /* formerly ZNEW */
1.1 snw 92: #define ZPRINT 'P'
93: #define ZQUIT 'Q'
94: #define ZREMOVE 'R'
95: #define ZSAVE 'S'
96: #define ZTRAP 'T'
97: #define ZWRITE 'W'
98: #define WATCH 20
99: #define ASSERT_TKN 21
100: #define OO_USING 22
101: #define OO_WITH 23
102: #define PRIVATE SP
103: #define THROW 25
104:
105: #define RA_CONTINUE 0
106: #define RA_PRIVATE 1
107: #define RA_NEXTCMND 2
108: #define RA_SKIPLINE 3
109:
110: typedef short MRESULT;
111: typedef short MACTION;
112:
113: extern MRESULT mcmd_tokenize(MACTION *ra, char *tmp3, char *deferrable_codptr, char *deferrable_code, int *j);
114: extern MRESULT cmd_map(MACTION *ra);
115: extern MRESULT cmd_unmap(MACTION *ra);
116: extern MRESULT cmd_then(MACTION *ra, int *then_ctr);
117: extern MRESULT cmd_throw(MACTION *ra);
118: extern MRESULT cmd_const(MACTION *ra);
119: extern MRESULT cmd_kvalue(MACTION *ra);
120: extern MRESULT cmd_ksubscripts(MACTION *ra);
121: extern MRESULT cmd_tstart(MACTION *ra);
122: extern MRESULT cmd_tcommit(MACTION *ra);
123: extern MRESULT cmd_trollback(MACTION *ra);
124: /* TODO: cmd_set */
125: extern MRESULT cmd_if(MACTION *ra);
126: extern MRESULT cmd_using(MACTION *ra);
127: extern MRESULT cmd_with(MACTION *ra);
128: extern MRESULT cmd_write(MACTION *ra, int *i);
129: extern MRESULT cmd_else(MACTION *ra);
130: extern MRESULT cmd_read(MACTION *ra);
131:
132: #define MRESCHECK(ra) {\
133: if (merr () > OK) goto err; \
134: switch (ra) { \
135: case RA_CONTINUE: \
136: break; \
137: case RA_NEXTCMND: \
138: goto next_cmnd; \
139: case RA_PRIVATE: \
140: goto private; \
141: case RA_SKIPLINE: \
142: goto skip_line; \
143: } \
144: }
145:
146: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>