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