2 engine.h - MaLa core engine
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.
23 #include "mala_types.h"
24 #include "stringbucket.h"
25 #include "stringlist.h"
28 enum mala_common_strings_enum
33 MALA_STRING_EXCLAMATIONMARK
,
35 MALA_STRING_FLAG_EXCLAM_EXPANSION
,
36 MALA_STRING_FLAG_NO_EXPANSION
,
37 MALA_STRING_FLAG_NUMSPLIT_EXPANSION
,
38 MALA_STRING_FLAG_CHAR_EXPANSION
,
39 MALA_STRING_FLAG_ASSIGN_EXPANSION
,
40 MALA_STRING_FLAG_SETENV_EXPANSION
,
41 MALA_STRING_FLAG_ENVVAR_EXPANSION
,
42 MALA_STRING_FLAG_UNDERSCORE_EXPANSION
,
43 MALA_STRING_FLAG_BRACKET_EXPANSION
,
44 MALA_STRING_FLAG_ASSIGN_CONTRACTION
,
45 MALA_MAX_COMMON_STRING
54 struct mala_engine_struct
57 * every tokenized word is collected in 'words'
58 * actions can be bound to these words through the strings user variable
60 mala_stringbucket words
;
61 mala_stringlist program
;
62 mala_stringlist arguments
;
64 MalaString common_string
[MALA_MAX_COMMON_STRING
];
66 /*TODO static ringbuffer char ringbuffer *[10] */
88 mala_engine_new_main (int (*initfunc
) (MalaEngine
),
89 int argc
, char ** argv
,
90 mala_actioninit
* actions_init
);
94 mala_engine_free (MalaEngine self
);
97 mala_engine_register_actions (MalaEngine
, MalaActionInit
);
100 mala_engine_pushback_program (MalaEngine self
, int args
, char ** argv
);
103 mala_engine_getprogram (MalaEngine self
);
106 mala_engine_state_get (MalaEngine self
);
109 mala_engine_clearstate (MalaEngine self
);
112 mala_engine_negated (MalaEngine self
);
115 mala_engine_clear_negated (MalaEngine self
);
118 mala_engine_dumpprogram (MalaEngine self
, const char * prefix
, const char * suffix
);
121 mala_engine_dumpargs (MalaEngine self
, const char * prefix
, const char * suffix
);
124 mala_engine_run (MalaEngine self
);
127 mala_engine_eval (MalaEngine self
, MalaStringListNode_ref pptr
);
130 //mala_engine_expansions (MalaEngine self, MalaStringListNode_ref pptr);
134 mala_engine_string_istrue (MalaEngine self
, MalaString str
);
137 mala_engine_check_expansionflag (MalaEngine self
, int flag
);
143 mala_engine_new_initfunc (int (*initfunc
) (MalaEngine
));
148 mala_engine_pushfront_program (MalaEngine self
, int args
, const char ** argv
);
151 mala_engine_add_action (MalaEngine self
, const t_uchar
* key
, void* data
,
152 MalaParserFunc
, MalaDataDestructor
);
155 mala_engine_erase_action (MalaEngine
, const t_uchar
* key
);
158 mala_engine_eval (MalaEngine self
, LList pptr
);
161 mala_engine_deepeval (MalaEngine self
, LList pptr
);
164 mala_engine_run (MalaEngine
);
166 mala_engine_exception (MalaEngine
, LList begin
, LList end
, const char *);
169 mala_engine_action_new (MalaEngine
, t_uchar
** name
, void** data
,
170 MalaParserFunc parser
, MalaDataDestructor destructor
);
173 mala_engine_check_expansionflag (MalaEngine self
, const t_uchar
* name
);
176 mala_engine_getaction (MalaEngine
, const t_uchar
* name
);
179 mala_engine_getprevaction (MalaEngine
, const t_uchar
* name
);
187 #endif /*MALA_ENGINE_H*/
191 // c-file-style: "gnu"
193 // arch-tag: 47d718f6-e397-400c-93a6-bc71f475c0c7