1 |
/* |
2 |
* HT Editor |
3 |
* parsehelper.h |
4 |
* |
5 |
* Copyright (C) 2003 Stefan Weyergraf |
6 |
* |
7 |
* This program is free software; you can redistribute it and/or modify |
8 |
* it under the terms of the GNU General Public License version 2 as |
9 |
* published by the Free Software Foundation. |
10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 |
*/ |
20 |
|
21 |
#ifndef __PARSEHELPER_H__ |
22 |
#define __PARSEHELPER_H__ |
23 |
|
24 |
/*#define EVAL_DEBUG*/ |
25 |
|
26 |
#ifdef __cplusplus |
27 |
extern "C" { |
28 |
#endif /* __cplusplus */ |
29 |
|
30 |
#include <math.h> |
31 |
#include <stdarg.h> |
32 |
#include <stdio.h> |
33 |
#include <stdlib.h> |
34 |
#include <string.h> |
35 |
|
36 |
#include "debugtype.h" |
37 |
|
38 |
#include "lex.h" |
39 |
|
40 |
/* |
41 |
* |
42 |
*/ |
43 |
|
44 |
#define MAX_FUNCNAME_LEN 16 |
45 |
#define MAX_SYMBOLNAME_LEN 32 |
46 |
#define MAX_ERRSTR_LEN 128 |
47 |
|
48 |
/* |
49 |
* ERROR HANDLING |
50 |
*/ |
51 |
void clear_eval_error(); |
52 |
int get_eval_error(char **str, int *pos); |
53 |
void set_eval_error(char *errmsg); |
54 |
|
55 |
/* |
56 |
* SCALARLIST |
57 |
*/ |
58 |
void scalarlist_set(struct eval_scalarlist *l, struct eval_scalar *s); |
59 |
void scalarlist_concat(struct eval_scalarlist *l, struct eval_scalarlist *a, struct eval_scalarlist *b); |
60 |
void scalarlist_destroy(struct eval_scalarlist *l); |
61 |
void scalarlist_destroy_flat(struct eval_scalarlist *l); |
62 |
|
63 |
/* |
64 |
* |
65 |
*/ |
66 |
void create_command(struct eval_command *result, eval_commandtype type, int args, ...); |
67 |
void create_func_call(struct eval_scalar *result, const char *name, int args, ...); |
68 |
void create_func_call_list(struct eval_scalar *result, const char *name, struct eval_scalarlist *args); |
69 |
|
70 |
/* |
71 |
* SCALAR |
72 |
*/ |
73 |
void scalar_destroy(struct eval_scalar *s); |
74 |
|
75 |
int eval_parse(struct eval_command *r, const char *str); |
76 |
|
77 |
#ifdef __cplusplus |
78 |
} |
79 |
#endif /* __cplusplus */ |
80 |
|
81 |
#endif /* __PARSEHELPER_H__ */ |