more ui tidyup
[gcalctool.git] / gcalctool / ce_parser.h
blob54483125c5a8cef0d140dda200a217ec156ba62d
2 /* $Header$
4 * Copyright (C) 2004-2007 Sami Pietila
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
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., 59 Temple Place - Suite 330, Boston, MA
19 * 02111-1307, USA.
22 #ifndef CE_PARSER_H
23 #define CE_PARSER_H
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <math.h>
29 #include <assert.h>
30 #include <errno.h>
31 #include "calctool.h"
32 #include "parser.h"
33 #include "parser_mac.h"
35 /* CE = Common expression */
37 extern struct parser_state parser_state;
39 int ceerror(); /* dummy definition TODO: this is a douple */
40 int ceparse(); /* dummy definition. */
41 int ceerror(char *s);
42 int ce_parse(char *expression, int result[MP_SIZE]);
43 int ce_udf_parse(char *expression);
45 void reset_ce_tokeniser();
47 /* UTILITY NEEDED BECAUSE GNU SOURCE NOT ALWAYS AVAILABLE. */
49 static inline char *
50 ce_strndup(char *str, int len)
52 char *dup;
54 if (len < 1) {
55 return(NULL);
58 dup = malloc(len+1);
59 memset(dup, 0, len+1);
60 strncpy(dup, str, len);
62 return(dup);
65 #endif