2 stringbucket.h - MaLa stringbuckets
4 Copyright (C) 2004, 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.
24 #include "mala_globals.c" // only extern declarations when included from here
26 NOBUG_DECLARE_FLAG(mala
);
27 NOBUG_DECLARE_FLAG(mala_acogc
);
28 NOBUG_DECLARE_FLAG(mala_engine
);
29 NOBUG_DECLARE_FLAG(mala_program
);
30 NOBUG_DECLARE_FLAG(mala_strings
);
31 NOBUG_DECLARE_FLAG(mala_stringlist
);
32 NOBUG_DECLARE_FLAG(mala_stringbucket
);
33 NOBUG_DECLARE_FLAG(mala_action
);
34 NOBUG_DECLARE_FLAG(mala_module
);
35 NOBUG_DECLARE_FLAG(mala_module_std
);
42 /* the first codes are the states of the MaLa VM and never returned from the engine*/ \
43 MALA_STATE(SUCCESS), /* final state / all succeeded */ \
44 MALA_STATE(LITERAL), /* don't evaluate argument */ \
45 MALA_STATE(MACRO), /* evaluated some new code */ \
46 MALA_STATE(BLOCK), /* block of code evaluated to a macro */ \
47 MALA_STATE(STATEMENT), /* evaluated to nothing, but had some side-effect */ \
48 MALA_STATE(REMOVE), /* tell a command to remove itself recursively */ \
49 MALA_STATE(START), /* start of the statemachine, nothing evaluated yet */ \
50 MALA_STATE(EXCEPTION), /* some error occured (in MaLa code) */ \
52 MALA_STATE(EFAULT), /* beyond are runtime errors */ \
53 MALA_STATE(ENOACTION), /* no action found, exception falltrough */ \
54 MALA_STATE(EACTIONUSED), /* action has childs or is linked to an engine */ \
55 MALA_STATE(ESYNTAX), /* Syntax error in expansion */ \
56 MALA_STATE(EINCOMPLETE), /* interrupted in interactive mode */ \
58 MALA_STATE(EFATAL), /* beyond are fatal errors */ \
59 MALA_STATE(EINIT), /* initialization didnt complete */ \
60 MALA_STATE(EALLOC), /* memory allocation problem */ \
61 MALA_STATE(ENOENV), /* no environment space left */ \
62 MALA_STATE(EPARSER), /* parser wrong or missing */ \
64 MALA_STATE(EINVALID), /* something is really wrong */ \
65 MALA_STATE(STATE_TABLE_SIZEOF)
68 #define MALA_STATE(s) MALA_##s
75 typedef enum mala_state_enum mala_state
;
80 MALA_NOTRACE
, // traceing off
81 MALA_TRACESOME
, // tracing only important things
82 MALA_TRACE
, // normal traceing
83 MALA_TRACEALL
// trace details
86 typedef enum mala_trace_enum mala_trace
;
88 enum mala_action_datatype_enum
92 MALA_DATA_STRINGPOINTER
,
96 typedef enum mala_action_datatype_enum mala_action_datatype
;
101 * datastructure and handle declarations
103 #define MALA_TYPEDEFS(name,Handle) \
104 typedef struct mala_##name##_struct mala_##name; \
105 typedef const mala_##name * const_Mala##Handle; \
106 typedef mala_##name * Mala##Handle; \
107 typedef mala_##name ** Mala##Handle##_ref; \
108 typedef const mala_##name ** const_Mala##Handle##_ref
110 MALA_TYPEDEFS(actioninit
,ActionInit
);
111 MALA_TYPEDEFS(action
,Action
);
112 MALA_TYPEDEFS(string
,String
);
113 MALA_TYPEDEFS(stringbucket
,StringBucket
);
114 MALA_TYPEDEFS(stringbucketnode
,StringBucketNode
);
115 MALA_TYPEDEFS(engine
,Engine
);
116 MALA_TYPEDEFS(program
,Program
);
117 MALA_TYPEDEFS(actiondesc
,ActionDesc
);
118 MALA_TYPEDEFS(stringlist
,StringList
);
121 typedef mala_state (*MalaParserFunc
) (MalaProgram prg
);
123 #define MALA_MUTATOR_BEGIN if (mala_program_state_get (prg) != MALA_REMOVE)
124 #define MALA_MUTATOR_END
126 #define MALA_PARSER_DEFINE(name) mala_state mala_##name##_parser (MalaProgram prg)
129 #endif /* MALA_TYPES_H */
134 // c-file-style: "gnu"
136 // arch-tag: ee20274c-3a62-4022-a312-59572f1ffdb9