// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
-// Licence: wxWindows license
+// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma hdrstop
#endif
-#include <fstream.h>
+#if wxUSE_IOSTREAMH
+ #include <fstream.h>
+#else
+ #include <fstream>
+#endif
+
#include <stdarg.h>
#include <ctype.h>
#include <string.h>
extern "C" void LexFromFile(FILE *fd);
extern "C" void LexFromString(char *buf);
+
wxExprDatabase *thewxExprDatabase = NULL;
wxExprErrorHandler currentwxExprErrorHandler;
-IMPLEMENT_DYNAMIC_CLASS(wxExprDatabase, wxList)
-
wxExpr::wxExpr(const wxString& functor)
{
type = wxExprList;
next = NULL;
}
-wxExpr::wxExpr(float the_real)
+wxExpr::wxExpr(double the_real)
{
type = wxExprReal;
value.real = the_real;
Append(listExpr);
}
-void wxExpr::AddAttributeValue(const wxString& attribute, float val)
+void wxExpr::AddAttributeValue(const wxString& attribute, double val)
{
if (type != wxExprList)
{
}
bool wxExpr::GetAttributeValue(const wxString& att, float& var) const
+{
+ wxExpr *expr = AttributeValue(att);
+ if (expr && (expr->Type() == wxExprInteger || expr->Type() == wxExprReal))
+ {
+ var = (float) expr->RealValue();
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+bool wxExpr::GetAttributeValue(const wxString& att, double& var) const
{
wxExpr *expr = AttributeValue(att);
if (expr && (expr->Type() == wxExprInteger || expr->Type() == wxExprReal))
}
case wxExprReal:
{
- float f = value.real;
+ double f = value.real;
/* Now the parser can cope with this.
// Prevent printing in 'e' notation. Any better way?
if (fabs(f) < 0.00001)
}
}
-// wxExpr 'database' (list of expressions)
+/*
+ * wxExpr 'database' (list of expressions)
+ */
+
+#if !USE_SHARED_LIBRARIES
+IMPLEMENT_DYNAMIC_CLASS(wxExprDatabase, wxList)
+#endif
+
wxExprDatabase::wxExprDatabase(wxExprErrorHandler handler)
{
position = NULL;
return found;
}
-wxExpr *wxExprDatabase::FindClause(const wxString& word, float val)
+wxExpr *wxExprDatabase::FindClause(const wxString& word, double val)
{
wxExpr *found = NULL;
while (position && !found)
*
*/
-char *make_integer(char *str)
+char *wxmake_integer(char *str)
{
wxExpr *x = new wxExpr(atol(str));
return (char *)x;
}
-char *make_real(char *str1, char *str2)
+char *wxmake_real(char *str1, char *str2)
{
char buf[50];
sprintf(buf, "%s.%s", str1, str2);
- float f = (float)atof(buf);
+ double f = (double)atof(buf);
wxExpr *x = new wxExpr(f);
return (char *)x;
// extern "C" double exp10(double);
-char *make_exp(char *str1, char *str2)
+char *wxmake_exp(char *str1, char *str2)
{
double mantissa = (double)atoi(str1);
double exponent = (double)atoi(str2);
double d = mantissa * pow(10.0, exponent);
- wxExpr *x = new wxExpr((float)d);
+ wxExpr *x = new wxExpr(d);
return (char *)x;
}
-char *make_exp2(char *str1, char *str2, char *str3)
+char *wxmake_exp2(char *str1, char *str2, char *str3)
{
char buf[50];
double d = mantissa * pow(10.0, exponent);
- wxExpr *x = new wxExpr((float)d);
+ wxExpr *x = new wxExpr(d);
return (char *)x;
}
-char *make_word(char *str)
+char *wxmake_word(char *str)
{
wxExpr *x = new wxExpr(wxExprWord, str);
return (char *)x;
}
-char *make_string(char *str)
+char *wxmake_string(char *str)
{
char *s, *t;
int len, i;
add_expr(expr);
}
-void syntax_error(char *s)
+void syntax_error(char *WXUNUSED(s))
{
if (currentwxExprErrorHandler)
(void)(*(currentwxExprErrorHandler))(WXEXPR_ERROR_SYNTAX, "syntax error");