2 mala.c - standalone MaLa interpreter
4 Copyright (C) 2004, 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.
25 mala_actioninit my_actions
[] =
27 MALA_SUBSTITUTE_PARSER("--MALA-VERSION","MaLa 0.2 ("__DATE__
" "__TIME__
")"),
28 MALA_SUBSTITUTE_PARSER("-V","--version"),
29 MALA_EXPAND_PARSER("--version",("--PRINTL", "--MALA-VERSION")),
35 main(int argc
, char * argv
[])
40 my_engine
= mala_engine_new ();
41 mala_module_std_init (my_engine
);
42 mala_engine_actions_register (my_engine
, my_actions
);
43 mala_engine_ppexpand_define (my_engine
, "--COMMANDLINE", argc
- 1, argv
+ 1);
44 mala_engine_pushback_word (my_engine
, "--COMMANDLINE");
45 mala_engine_run (my_engine
);
48 fprintf (stderr
, "%-8s:\n", mala_engine_state_str (my_engine
));
50 ret
= mala_engine_state_get (my_engine
);
51 if (ret
> MALA_EFAULT
)
53 mala_engine_dumpprogram (my_engine
, stderr
, "", " ");
56 else if (! mala_stringlist_is_empty (&my_engine
->arguments
))
58 mala_engine_dumpargs (my_engine
, stdout
, "", " ");
61 mala_engine_free (my_engine
);
62 return ret
== MALA_CONTINUE
? 0 : ret
;
70 // c-file-style: "gnu"
72 // arch-tag: 0aebb81a-80ba-46d5-9738-4af8f3ceffc9