2 std_init.c - MaLa standard module initialization table
4 Copyright (C) 2005, Christian Thaeter <chth@gmx.net>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License version 2 as
8 published by the Free Software Foundation.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, contact me.
27 mala_actioninit std_actions
[] =
30 MALA_PARSER("--", mala__parser, NULL, NULL, NULL),
31 MALA_PARSER_BRIEF("--", ""),
32 // MALA_PARSER_HELP("--", ("TODO")),
33 MALA_PARSER_SIGNATURE_TYPE("--", ("")),
34 MALA_PARSER_SIGNATURE_USAGE("--", ("")),
35 MALA_PARSER_RESULT_TYPE("--", ("")),
36 MALA_PARSER_RESULT_USAGE("--", ("")),
39 MALA_PARSER("--CHILDOF", mala__parser, NULL, NULL, NULL),
40 MALA_PARSER_BRIEF("--", ""),
41 // MALA_PARSER_HELP("--", ("TODO")),
42 MALA_PARSER_SIGNATURE_TYPE("--", ("")),
43 MALA_PARSER_SIGNATURE_USAGE("--", ("")),
44 MALA_PARSER_RESULT_TYPE("--", ("")),
45 MALA_PARSER_RESULT_USAGE("--", ("")),
47 MALA_PARSER("--FOREACH-WORD", mala_foreach_word_parser, NULL, NULL, NULL),
48 MALA_PARSER_BRIEF("--", ""),
49 // MALA_PARSER_HELP("--", ("TODO")),
50 MALA_PARSER_SIGNATURE_TYPE("--", ("")),
51 MALA_PARSER_SIGNATURE_USAGE("--", ("")),
52 MALA_PARSER_RESULT_TYPE("--", ("")),
53 MALA_PARSER_RESULT_USAGE("--", ("")),
56 MALA_SUBSTITUTE_PARSER("--MALA-VERSION","MaLa 0.2 ("__DATE__
" "__TIME__
")"),
57 MALA_PARSER_BRIEF("--MALA-VERSION", "Holds the version"),
58 //MALA_PARSER_HELP("--FOREACH-WORD", ("")),
60 MALA_PARSER("--FOREACH-WORD", mala_foreach_word_parser
, NULL
, NULL
, NULL
),
61 MALA_PARSER_BRIEF("--FOREACH-WORD", "applies an action to each word of a macro/expansion"),
62 // MALA_PARSER_HELP("--FOREACH-WORD", ("TODO")),
63 MALA_PARSER_SIGNATURE_TYPE("--FOREACH-WORD", ("DEFINED-ACTION", "MACRO")),
64 MALA_PARSER_SIGNATURE_USAGE("--FOREACH-WORD", ("Action to be applied",
65 "Macro consists of words on which the action"
66 " should be appied")),
67 MALA_PARSER_RESULT_TYPE("--FOREACH-WORD", ("SEQUENCE")),
68 MALA_PARSER_RESULT_USAGE("--FOREACH-WORD", ("Expansion which applies the Action to the macro")),
70 MALA_PARSER("--DEF", mala_macrodef_parser
, NULL
, NULL
, NULL
),
71 MALA_PARSER_BRIEF("--DEF", "defines a new macro"),
72 // MALA_PARSER_HELP("--DEF", ("TODO")),
73 MALA_PARSER_SIGNATURE_TYPE("--DEF", ("ACTION", "WORD-OR-BLOCK")),
74 MALA_PARSER_SIGNATURE_USAGE("--DEF", ("Word to be defined",
75 "Definition as word, or block with optional"
77 MALA_PARSER_RESULT_TYPE("--DEF", ("VOID")),
79 MALA_PARSER("--END", mala_end_parser
, NULL
, NULL
, NULL
),
80 MALA_PARSER_BRIEF("--END", "closes a block"),
81 // MALA_PARSER_HELP("--END", ("TODO")),
82 MALA_PARSER_SIGNATURE_TYPE("--END", ("VOID")),
83 MALA_PARSER_RESULT_TYPE("--END", ("ERROR")),
84 MALA_PARSER_RESULT_USAGE("--END", ("an --END without a matching --BEGIN raises an error")),
86 MALA_PARSER("--EXCEPTION", mala_exception_parser
, NULL
, NULL
, NULL
),
87 MALA_PARSER_BRIEF("--EXCEPTION", "defines a new macro"),
88 // MALA_PARSER_HELP("--EXCEPTION", ("TODO")),
89 // MALA_PARSER_SIGNATURE_TYPE("--", ("")),
90 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
91 // MALA_PARSER_RESULT_TYPE("--", ("")),
92 // MALA_PARSER_RESULT_USAGE("--", ("")),
94 MALA_PARSER("--DEL", mala_macrodelete_parser
, NULL
, NULL
, NULL
),
95 MALA_PARSER_BRIEF("--DEL", "delete a macro"),
96 // MALA_PARSER_HELP("--DEL", ("TODO")),
97 // MALA_PARSER_SIGNATURE_TYPE("--", ("")),
98 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
99 // MALA_PARSER_RESULT_TYPE("--", ("")),
100 // MALA_PARSER_RESULT_USAGE("--", ("")),
102 MALA_PARSER("--BEGIN", mala_begin_parser
, NULL
, NULL
, NULL
),
103 MALA_PARSER_BRIEF("--BEGIN", "starts a block of code"),
104 // MALA_PARSER_HELP("--BEGIN", ("TODO")),
105 MALA_PARSER_SIGNATURE_TYPE("--BEGIN", ("WORDS","END")),
106 MALA_PARSER_RESULT_TYPE("--BEGIN", ("BLOCK")),
107 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
108 // MALA_PARSER_RESULT_USAGE("--", ("")),
110 MALA_EXPAND_PARSER("--IFDEF", ("--IF", "--DEFINED")),
111 MALA_PARSER_BRIEF("--IFDEF", "tests if a word is defined as macro"),
112 // MALA_PARSER_HELP("--NOT", ("TODO")),
113 // MALA_PARSER_SIGNATURE_TYPE("--", ("")),
114 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
115 // MALA_PARSER_RESULT_TYPE("--", ("")),
116 // MALA_PARSER_RESULT_USAGE("--", ("")),
118 MALA_PARSER("--DEFINED", mala_defined_parser
, NULL
, NULL
, NULL
),
119 MALA_PARSER_BRIEF("--DEFINED", "tests if a word is defined as macro"),
120 // MALA_PARSER_HELP("--NOT", ("TODO")),
121 // MALA_PARSER_SIGNATURE_TYPE("--", ("")),
122 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
123 // MALA_PARSER_RESULT_TYPE("--", ("")),
124 // MALA_PARSER_RESULT_USAGE("--", ("")),
126 MALA_PARSER("--IF", mala_if_parser
, NULL
, NULL
, NULL
),
127 MALA_PARSER_BRIEF("--IF", "executes some code if a condition succeeded"),
128 // MALA_PARSER_HELP("--NOT", ("TODO")),
129 // MALA_PARSER_SIGNATURE_TYPE("--", ("")),
130 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
131 // MALA_PARSER_RESULT_TYPE("--", ("")),
132 // MALA_PARSER_RESULT_USAGE("--", ("")),
134 MALA_PARSER("--ELSE", mala_else_parser
, NULL
, NULL
, NULL
),
135 MALA_PARSER_BRIEF("--ELSE", "executes some code when the former macro failed"),
136 // MALA_PARSER_HELP("--NOT", ("TODO")),
137 // MALA_PARSER_SIGNATURE_TYPE("--", ("")),
138 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
139 // MALA_PARSER_RESULT_TYPE("--", ("")),
140 // MALA_PARSER_RESULT_USAGE("--", ("")),
143 MALA_PARSER("--NOT", mala_not_parser
, NULL
, NULL
, NULL
),
144 MALA_PARSER_BRIEF("--NOT", "negates logic"),
145 // MALA_PARSER_HELP("--NOT", ("TODO")),
146 // MALA_PARSER_SIGNATURE_TYPE("--", ("")),
147 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
148 // MALA_PARSER_RESULT_TYPE("--", ("")),
149 // MALA_PARSER_RESULT_USAGE("--", ("")),
151 MALA_PARSER("--LITERAL", mala_literal_parser
, NULL
, NULL
, NULL
),
152 MALA_PARSER_BRIEF("--LITERAL", "Treats the next word literally"),
153 // MALA_PARSER_HELP("--LITERAL", ("TODO")),
154 // MALA_PARSER_SIGNATURE_TYPE("--", ("")),
155 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
156 // MALA_PARSER_RESULT_TYPE("--", ("")),
157 // MALA_PARSER_RESULT_USAGE("--", ("")),
159 MALA_SUBSTITUTE_PARSER("--DEFAULT-PARSER","--LITERAL"),
160 MALA_PARSER_BRIEF("--DEFAULT-PARSER", "is used for any word which has no associated action"),
161 // MALA_PARSER_HELP("--DEFAULT-PARSER", ("TODO")),
162 // MALA_PARSER_SIGNATURE_TYPE("--", ("")),
163 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
164 // MALA_PARSER_RESULT_TYPE("--", ("")),
165 // MALA_PARSER_RESULT_USAGE("--", ("")),
167 MALA_PARSER("--NL", mala_newline_parser
, NULL
, NULL
, NULL
),
168 MALA_PARSER_BRIEF("--NL", "prints a newline"),
169 // MALA_PARSER_HELP("--NL", ("TODO")),
170 MALA_PARSER_RESULT_USAGE("--NL", ("")),
172 MALA_MACRO_PARSER("--PRINTL",("--PRINT", "--LITERAL", "%1", "--NL")),
173 MALA_PARSER_BRIEF("--PRINTL", "prints a textline to stdout"),
174 // MALA_PARSER_HELP("--PRINTL", ("TODO")),
175 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
176 // MALA_PARSER_RESULT_USAGE("--", ("")),
177 MALA_PARSER_SIGNATURE_TYPE("--PRINTL", ("WORD-OR-BLOCK")),
178 MALA_PARSER_RESULT_TYPE("--PRINTL", ("VOID")),
180 MALA_PARSER("--PRINT", mala_print_parser
, NULL
, NULL
, NULL
),
181 MALA_PARSER_BRIEF("--PRINT", "prints to stdout"),
182 // MALA_PARSER_HELP("--PRINT", ("TODO")),
183 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
184 // MALA_PARSER_RESULT_USAGE("--", ("")),
185 MALA_PARSER_SIGNATURE_TYPE("--PRINT", ("WORD-OR-BLOCK")),
186 MALA_PARSER_RESULT_TYPE("--PRINT", ("VOID")),
188 MALA_PARSER("--PRINTWRAPED",mala_printwraped_parser
, NULL
, NULL
, NULL
),
189 MALA_PARSER_BRIEF("--PRINTWRAPED", "prints formatted text"),
190 MALA_PARSER_HELP("--PRINTWRAPED", ("Wraps some text to fit nicely on the screen. Tabulators become aligned. The last tabulator delimited field of a line will be printed word-wraped and indented.")),
191 MALA_PARSER_SIGNATURE_USAGE("--PRINTWRAPED",
192 ("Columns available on the screen",
193 "Lines available on the screen",
194 "Indent of the block in characters",
195 "Tabwidth to be used",
196 "Text to be printed")),
197 // //MALA_PARSER_RESULT_USAGE("--PRINTWRAPED", ("TODO")),
198 MALA_PARSER_SIGNATURE_TYPE("--PRINTWRAPED",
205 MALA_PARSER("--SLEEP",mala_sleep_parser
, NULL
, NULL
, NULL
),
206 MALA_PARSER_BRIEF("--SLEEP", "delays execution for some time"),
207 MALA_PARSER_HELP("--SLEEP", ("The program will be suspended for some time, the time might be specified as fraction of seconds\t example: 9.5")),
208 MALA_PARSER_SIGNATURE_USAGE("--SLEEP",("Seconds to sleep")),
209 // //MALA_PARSER_RESULT_USAGE("--PRINTWRAPED", ("TODO")),
210 MALA_PARSER_SIGNATURE_TYPE("--SLEEP", ("DURATION")),
212 MALA_PARSER("--TRACE",mala_trace_parser
, NULL
, NULL
, NULL
),
213 MALA_PARSER_BRIEF("--TRACE", "controls the trace mode of the MaLa VM"),
214 //MALA_PARSER_HELP("--TRACE", ("The program will be suspended for some time, the time might be specified as fraction of seconds\t example: 9.5")),
215 //MALA_PARSER_SIGNATURE_USAGE("--SLEEP",("Seconds to sleep")),
216 // //MALA_PARSER_RESULT_USAGE("--PRINTWRAPED", ("TODO")),
217 //MALA_PARSER_SIGNATURE_TYPE("--SLEEP", ("DURATION")),
219 // MALA_PARSER("--EVAL",mala_eval_parser, NULL, NULL, NULL),
220 // MALA_PARSER_BRIEF("--EVAL",""),
221 // MALA_PARSER_HELP("--EVAL",("blah")),
222 // MALA_PARSER_SIGNATURE_TYPE("--", ("")),
223 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
224 // MALA_PARSER_RESULT_TYPE("--", ("")),
225 // MALA_PARSER_RESULT_USAGE("--", ("")),
227 MALA_PASS_PARSER("--PASS"),
228 MALA_PARSER_BRIEF("--PASS","does nothing"),
229 MALA_PARSER_HELP("--PASS",("--HELP-ACTION","blah")),
230 // MALA_PARSER_SIGNATURE_TYPE("--", ("")),
231 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
232 // MALA_PARSER_RESULT_TYPE("--", ("")),
233 // MALA_PARSER_RESULT_USAGE("--", ("")),
235 MALA_TRUE_PARSER("--FLAG-NUMSPLIT-EXPANSION"),
236 // MALA_PARSER_BRIEF("--FLAG-NUMSPLIT-EXPANSION", "TODO"),
237 // MALA_PARSER_HELP("--FLAG-NUMSPLIT-EXPANSION", ("TODO")),
239 MALA_TRUE_PARSER("--FLAG-LITERAL-EXPANSION"),
240 MALA_PARSER_BRIEF("--FLAG-LITERAL-EXPANSION",
241 "words beginning with a single backquote will be "
242 "preprocessed as '--LITERAL' 'theword'"),
243 // MALA_PARSER_HELP("--FLAG-LITERAL-EXPANSION", ("TODO")),
245 MALA_TRUE_PARSER("--FLAG-EXCLAM-EXPANSION"),
246 MALA_PARSER_BRIEF("--FLAG-EXCLAM-EXPANSION",
247 "a single ! will be preprocessed as --NOT"),
248 // MALA_PARSER_HELP("--FLAG-EXCLAM-EXPANSION", ("TODO")),
250 MALA_TRUE_PARSER("--FLAG-NO-EXPANSION"),
251 // MALA_PARSER_BRIEF("--", ""),
252 //// MALA_PARSER_HELP("--", ("TODO")),
254 MALA_TRUE_PARSER("--FLAG-ASSIGN-EXPANSION"),
255 // MALA_PARSER_BRIEF("--", ""),
256 //// MALA_PARSER_HELP("--", ("TODO")),
258 MALA_TRUE_PARSER("--FLAG-ENVVAR-EXPANSION"),
259 // MALA_PARSER_BRIEF("--", ""),
260 //// MALA_PARSER_HELP("--", ("TODO")),
262 MALA_TRUE_PARSER("--FLAG-CHAR-EXPANSION"),
263 // MALA_PARSER_BRIEF("--", ""),
264 //// MALA_PARSER_HELP("--", ("TODO")),
266 MALA_TRUE_PARSER("--FLAG-UNDERSCORE-EXPANSION"),
267 // MALA_PARSER_BRIEF("--", ""),
268 //// MALA_PARSER_HELP("--", ("TODO")),
270 MALA_TRUE_PARSER("--FLAG-SETENV-EXPANSION"),
271 // MALA_PARSER_BRIEF("--", ""),
272 //// MALA_PARSER_HELP("--", ("TODO")),
274 MALA_TRUE_PARSER("--FLAG-BRACKET-EXPANSION"),
275 // MALA_PARSER_BRIEF("--", ""),
276 //// MALA_PARSER_HELP("--", ("TODO")),
278 MALA_TRUE_PARSER("--FLAG-ASSIGN-CONTRACTION"),
279 // MALA_PARSER_BRIEF("--", ""),
280 //// MALA_PARSER_HELP("--", ("TODO")),
282 MALA_SUBSTITUTE_PARSER("--BRIEF-ACTION","--PRINTL"),
283 // MALA_PARSER_BRIEF("--", ""),
284 //// MALA_PARSER_HELP("--", ("TODO")),
285 // MALA_PARSER_SIGNATURE_TYPE("--", ("")),
286 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
287 // MALA_PARSER_RESULT_TYPE("--", ("")),
288 // MALA_PARSER_RESULT_USAGE("--", ("")),
290 MALA_SUBSTITUTE_PARSER("--HELP-ACTION","--PRINTL"),
291 // MALA_PARSER_BRIEF("--", ""),
292 //// MALA_PARSER_HELP("--", ("TODO")),
293 // MALA_PARSER_SIGNATURE_TYPE("--", ("")),
294 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
295 // MALA_PARSER_RESULT_TYPE("--", ("")),
296 // MALA_PARSER_RESULT_USAGE("--", ("")),
299 // TODO to strings module
300 MALA_MACRO_PARSER("--CAT",("%1%2")),
301 MALA_PARSER_BRIEF("--CAT", "concatenates two words"),
302 // MALA_PARSER_HELP("--CAT", ("TODO")),
303 // MALA_PARSER_SIGNATURE_TYPE("--", ("")),
304 // MALA_PARSER_SIGNATURE_USAGE("--", ("")),
305 // MALA_PARSER_RESULT_TYPE("--", ("")),
306 // MALA_PARSER_RESULT_USAGE("--", ("")),
309 MALA_EXPAND_PARSER("TESTLIST",("TEST","LIST")),
317 mala_module_std_init (MalaEngine self
)
319 mala_module_std_types_init (self
);
320 mala_module_std_help_init (self
);
321 mala_engine_actions_register (self
, std_actions
);
329 // c-file-style: "gnu"
331 // arch-tag: e6d43941-2533-4f28-863e-2dd3128e58bb