shelf merge "tests"
[mala.git] / tests / test-mala_stdmodule.c
blob72d9dbb797d139044ddef3f05f32fa3048eb5e2e
1 /*
2 test-mala_stdmodule.c - MaLa stdandard module test suite
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.
19 #include <assert.h>
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <nobug.h>
23 #include <acogc.h>
25 #include "mala.h"
26 #include "std.h"
28 mala_actioninit my_actions[] =
30 MALA_PARSER_SUBSTITUTE("--PP-COMMANDLINE","STEP WORKS"),
31 MALA_PARSER_SUBSTITUTE("--test","HEY_TEST_SUCCEEDED"),
32 //MALA_PARSER_BRIEF("--test","brief explanation of test"),
33 //MALA_PARSER_HELP("--test",("--PRINTL","long help for test")),
35 //MALA_EXPAND_PARSER("--testtwo",("HEY", "TEST","SUCCEEDED")),
36 //MALA_PARSER_BRIEF("--testtwo","brief explanation if testtwo"),
37 //MALA_PARSER_HELP("--testtwo",("--PRINTL","long help for testtwo")),
39 MALA_ACTIONS_END
42 int
43 main(int argc, char * argv[])
45 MalaEngine my_engine;
47 (void) argc;
48 (void) argv;
50 my_engine = mala_engine_new ();
52 mala_module_std_init (my_engine);
54 mala_engine_actions_register (my_engine, my_actions);
56 //TODO mala_engine_action_new_cstr (my_engine, "--ARGV0", mala_substitute_parser, argv[0]);
58 //llist args;
59 //llist_init (&args);
60 // TODO ACOGC_ROOT_REGISTER (args, mala_acogc_stringlist_mark, &my_engine->gcroot, NULL);
62 //mala_stringlist_append_cstrs (&args, argc - 1, argv + 1, my_engine);
64 // run the preprocessor on the list
65 //if (!llist_is_empty (&args))
66 // {
67 // mala_stringlist_head_new (&args, my_engine->common_string[MALA_STRING_PP_COMMANDLINE], my_engine);
69 // mala_program pp;
70 // mala_program_init (&pp, &args, my_engine);
71 //program does not need to be marked ACOGC_ROOT_REGISTER (pp, mala_acogc_program_mark, &my_engine->gcroot, NULL);
73 // mala_program_run (&pp);
75 //mala_engine_run_list (my_engine, list);
76 // }
78 //mala_stringlist_dump (&args, stdout, "", "%s ", "\n");
80 // safe the list as --COMMANDLINE
81 //mala_engine_action_new_list (my_engine, "--COMMANDLINE", mala_expand_parser, list);
83 // TODO ACOGC_ROOT_UNREGISTER (args, &my_engine->gcroot);
86 //mala_engine_ppexpand_define (my_engine, "--PROGRAM", argc - 1, argv + 1);
88 //mala_engine_step (my_engine);
89 //pptr = mala_stringlist_head ( mala_engine_getprogram (my_engine));
90 //mala_engine_arg_eval (my_engine, &pptr, 0, 1, NULL);
92 //mala_engine_dumpargs (my_engine, stdout, "arg: ", "\n");
93 //mala_engine_dumpprogram (my_engine, stdout, "prg: ", "\n");
96 //printf ("variable: %s\n", getenv ("variable"));
97 //printf ("negated: %d\n", mala_engine_negated (my_engine));
98 printf ("state: %s\n", mala_engine_state_str (my_engine));
100 mala_engine_free (my_engine);
101 return 0;
107 // Local Variables:
108 // mode: C
109 // c-file-style: "gnu"
110 // End:
111 // arch-tag: 56bcc0c2-d247-4a47-95dc-a460f26a444b
112 // end_of_file