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_engine
);
28 NOBUG_DECLARE_FLAG(mala_program
);
29 NOBUG_DECLARE_FLAG(mala_strings
);
30 NOBUG_DECLARE_FLAG(mala_stringlist
);
31 NOBUG_DECLARE_FLAG(mala_stringbucket
);
32 NOBUG_DECLARE_FLAG(mala_action
);
33 NOBUG_DECLARE_FLAG(mala_module
);
34 NOBUG_DECLARE_FLAG(mala_module_std
);
41 /* the first codes are the states of the MaLa VM and never returned from the engine*/ \
42 MALA_STATE(FINISH), /* never reached state, full evaluation */ \
43 MALA_STATE(LITERAL), /* don't evaluate argument */ \
44 MALA_STATE(FAILURE), /* last comand returned false */ \
45 MALA_STATE(SUCCESS), /* last comand returned true */ \
46 MALA_STATE(CONTINUE), /* command not fully evaluated yet, or removed itself */ \
47 MALA_STATE(LIST), /* evaluated to a list */ \
48 MALA_STATE(MACRO), /* evaluated to a macro */ \
49 MALA_STATE(START), /* start of the statemachine, nothing evaluated yet */ \
50 MALA_STATE(REMOVE), /* no sideeffects remove including arguments */ \
51 MALA_STATE(EXCEPTION), /* some error occured (in MaLa code) */ \
53 MALA_STATE(EFAULT), /* beyond are runtime errors */ \
54 MALA_STATE(ENOACTION), /* no action found, exception falltrough */ \
55 MALA_STATE(EACTIONUSED), /* action has childs or is linked to an engine */ \
56 MALA_STATE(ESYNTAX), /* Syntax error in expansion */ \
57 MALA_STATE(EINCOMPLETE), /* interrupted in interactive mode */ \
59 MALA_STATE(EFATAL), /* beyond are fatal errors */ \
60 MALA_STATE(EINIT), /* initialization didnt complete */ \
61 MALA_STATE(EALLOC), /* memory allocation problem */ \
62 MALA_STATE(ENOENV), /* no environment space left */ \
63 MALA_STATE(EPARSER), /* parser wrong or missing */ \
65 MALA_STATE(EINVALID), /* something is really wrong */ \
66 MALA_STATE(STATE_TABLE_SIZEOF)
69 #define MALA_STATE(s) MALA_##s
76 typedef enum mala_state_enum mala_state
;
81 MALA_NOTRACE
, // traceing off
82 MALA_TRACESOME
, // tracing only important things
83 MALA_TRACE
, // normal traceing
84 MALA_TRACEALL
// trace details
87 typedef enum mala_trace_enum mala_trace
;
89 enum mala_action_datatype_enum
93 MALA_DATA_STRINGPOINTER
,
97 typedef enum mala_action_datatype_enum mala_action_datatype
;
102 * datastructure and handle declarations
104 #define MALA_TYPEDEFS(name,Handle) \
105 typedef struct mala_##name##_struct mala_##name; \
106 typedef const mala_##name * const_Mala##Handle; \
107 typedef mala_##name * Mala##Handle; \
108 typedef mala_##name ** Mala##Handle##_ref; \
109 typedef const mala_##name ** const_Mala##Handle##_ref
111 MALA_TYPEDEFS(actioninit
,ActionInit
);
112 MALA_TYPEDEFS(action
,Action
);
113 MALA_TYPEDEFS(string
,String
);
114 MALA_TYPEDEFS(stringbucket
,StringBucket
);
115 MALA_TYPEDEFS(stringbucketnode
,StringBucketNode
);
116 MALA_TYPEDEFS(engine
,Engine
);
117 MALA_TYPEDEFS(program
,Program
);
118 MALA_TYPEDEFS(actiondesc
,ActionDesc
);
119 MALA_TYPEDEFS(stringlist
,StringList
);
122 typedef mala_state (*MalaParserFunc
) (MalaProgram prg
);
124 #define MALA_MUTATOR_BEGIN if (mala_program_state_get (prg) != MALA_REMOVE)
125 #define MALA_MUTATOR_END
127 #define MALA_PARSER_DEFINE(name) mala_state mala_##name##_parser (MalaProgram prg)
130 #endif /* MALA_TYPES_H */
135 // c-file-style: "gnu"
137 // arch-tag: ee20274c-3a62-4022-a312-59572f1ffdb9