1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "wxexpr.h"
16 // For compilers that support precompilation, includes "wx/wx.h".
17 #include "wx/wxprec.h"
31 #include "wx/wxexpr.h"
33 extern "C" void add_expr(char *);
34 extern "C" void LexFromFile(FILE *fd
);
35 extern "C" void LexFromString(char *buf
);
37 wxExprDatabase
*thewxExprDatabase
= NULL
;
38 wxExprErrorHandler currentwxExprErrorHandler
;
40 IMPLEMENT_DYNAMIC_CLASS(wxExprDatabase
, wxList
)
42 wxExpr::wxExpr(const wxString
& functor
)
49 wxExpr
*pfunctor
= new wxExpr(wxExprWord
, functor
);
54 wxExpr::wxExpr(wxExprType the_type
, const wxString
& word_or_string
)
61 value
.word
= copystring((const char *)word_or_string
);
64 value
.string
= copystring((const char *)word_or_string
);
79 wxExpr::wxExpr(wxExprType the_type
, char *word_or_string
, bool allocate
)
86 value
.word
= allocate
? copystring(word_or_string
) : word_or_string
;
89 value
.string
= allocate
? copystring(word_or_string
) : word_or_string
;
104 wxExpr::wxExpr(long the_integer
)
106 type
= wxExprInteger
;
107 value
.integer
= the_integer
;
112 wxExpr::wxExpr(float the_real
)
115 value
.real
= the_real
;
120 wxExpr::wxExpr(wxList
*the_list
)
127 wxExpr
*listExpr
= new wxExpr(wxExprList
);
129 wxNode
*node
= the_list
->First();
132 wxExpr
*expr
= (wxExpr
*)node
->Data();
133 listExpr
->Append(expr
);
141 wxExpr::~wxExpr(void)
152 delete[] value
.string
;
162 wxExpr
*expr
= value
.first
;
165 wxExpr
*expr1
= expr
->next
;
172 case wxExprNull
: break;
176 void wxExpr::Append(wxExpr
*expr
)
186 void wxExpr::Insert(wxExpr
*expr
)
188 expr
->next
= value
.first
;
195 wxExpr
*wxExpr::Copy(void) const
197 // This seems to get round an optimizer bug when
198 // using Watcom C++ 10a in WIN32 compilation mode.
199 // If these lines not present, the type seems to be
200 // interpreted wrongly as an integer.
201 // I don't want to turn optimization off since it's needed
202 // for reading in files quickly.
203 #if defined(__WATCOMC__)
211 return new wxExpr(value
.integer
);
213 return new wxExpr(value
.real
);
215 return new wxExpr(wxExprString
, wxString(value
.string
));
217 return new wxExpr(wxExprWord
, wxString(value
.word
));
220 wxExpr
*expr
= value
.first
;
221 wxExpr
*new_list
= new wxExpr(wxExprList
);
224 wxExpr
*expr2
= expr
->Copy();
225 new_list
->Append(expr2
);
237 // Get the wxExpr (containing (= wxExpr Value) form) for the given word
238 // or string, assuming that we have Attribute=Value, ...
239 wxExpr
*wxExpr::GetAttributeValueNode(const wxString
& word
) const // Use only for a clause or list
241 if (type
!= wxExprList
)
244 wxExpr
*expr
= value
.first
;
247 if (expr
->type
== wxExprList
)
249 wxExpr
*firstNode
= expr
->value
.first
;
250 if ((firstNode
->type
== wxExprWord
) && (firstNode
->value
.word
[0] == '='))
252 wxExpr
*secondNode
= firstNode
->next
;
253 if ((secondNode
->type
== wxExprWord
) &&
254 (strcmp((const char *)word
, secondNode
->value
.word
) == 0))
265 // Get the value (in wxExpr form) for the given word or string, assuming
266 // that we have Attribute=Value, ...
267 wxExpr
*wxExpr::AttributeValue(const wxString
& word
) const // Use only for a clause or list
269 if (type
!= wxExprList
)
272 wxExpr
*attExpr
= GetAttributeValueNode(word
);
273 if (attExpr
&& attExpr
->value
.first
&& attExpr
->value
.first
->next
)
274 return attExpr
->value
.first
->next
->next
;
278 wxString
wxExpr::Functor(void) const // Use only for a clause
280 if ((type
!= wxExprList
) || !value
.first
)
283 if (value
.first
->type
== wxExprWord
)
284 return wxString(value
.first
->value
.word
);
289 bool wxExpr::IsFunctor(const wxString
& f
) const // Use only for a clause
291 if ((type
!= wxExprList
) || !value
.first
)
294 return (value
.first
->type
== wxExprWord
&&
295 (strcmp((const char *)f
, value
.first
->value
.word
) == 0));
298 // Return nth argument of a clause (starting from 1)
299 wxExpr
*wxExpr::Arg(wxExprType theType
, int arg
) const
301 wxExpr
*expr
= value
.first
;
303 for (i
= 1; i
< arg
; i
++)
307 if (expr
&& (expr
->type
== theType
))
313 // Return nth argument of a list expression (starting from zero)
314 wxExpr
*wxExpr::Nth(int arg
) const
316 if (type
!= wxExprList
)
319 wxExpr
*expr
= value
.first
;
321 for (i
= 0; i
< arg
; i
++)
332 // Returns the number of elements in a list expression
333 int wxExpr::Number(void) const
335 if (type
!= wxExprList
)
339 wxExpr
*expr
= value
.first
;
348 void wxExpr::DeleteAttributeValue(const wxString
& attribute
)
350 if (type
!= wxExprList
)
353 wxExpr
*expr
= value
.first
;
354 wxExpr
*lastExpr
= this;
357 if (expr
->type
== wxExprList
)
359 wxExpr
*firstNode
= expr
->value
.first
;
360 if ((firstNode
->type
== wxExprWord
) && (firstNode
->value
.word
[0] == '='))
362 wxExpr
*secondNode
= firstNode
->next
;
363 if ((secondNode
->type
== wxExprWord
) &&
364 (strcmp((const char *)attribute
, secondNode
->value
.word
) == 0))
366 wxExpr
*nextExpr
= expr
->next
;
369 lastExpr
->next
= nextExpr
;
384 void wxExpr::AddAttributeValue(const wxString
& attribute
, wxExpr
*val
)
386 if (type
!= wxExprList
)
388 // cout << "Error! tried to add an attribute-value pair to a nonlist wxExpr expression\n";
391 // Warning - existing code may assume that any existing value
392 // is deleted first. For efficiency, we leave this to the application.
393 // DeleteAttributeValue(attribute);
395 wxExpr
*patt
= new wxExpr(wxExprWord
, attribute
);
396 wxExpr
*pequals
= new wxExpr(wxExprWord
, "=");
398 wxExpr
*listExpr
= new wxExpr(wxExprList
);
400 listExpr
->Append(pequals
);
401 listExpr
->Append(patt
);
402 listExpr
->Append(val
);
407 void wxExpr::AddAttributeValue(const wxString
& attribute
, long val
)
409 if (type
!= wxExprList
)
411 // cout << "Error! tried to add an attribute-value pair to a nonlist wxExpr expression\n";
414 // Warning - existing code may assume that any existing value
415 // is deleted first. For efficiency, we leave this to the application.
416 // DeleteAttributeValue(attribute);
418 wxExpr
*patt
= new wxExpr(wxExprWord
, attribute
);
419 wxExpr
*pval
= new wxExpr(val
);
420 wxExpr
*pequals
= new wxExpr(wxExprWord
, "=");
422 wxExpr
*listExpr
= new wxExpr(wxExprList
);
424 listExpr
->Append(pequals
);
425 listExpr
->Append(patt
);
426 listExpr
->Append(pval
);
431 void wxExpr::AddAttributeValue(const wxString
& attribute
, float val
)
433 if (type
!= wxExprList
)
435 // cout << "Error! tried to add an attribute-value pair to a nonlist wxExpr expression\n";
439 // DeleteAttributeValue(attribute);
440 wxExpr
*patt
= new wxExpr(wxExprWord
, attribute
);
441 wxExpr
*pval
= new wxExpr(val
);
442 wxExpr
*pequals
= new wxExpr(wxExprWord
, "=");
444 wxExpr
*listExpr
= new wxExpr(wxExprList
);
446 listExpr
->Append(pequals
);
447 listExpr
->Append(patt
);
448 listExpr
->Append(pval
);
453 void wxExpr::AddAttributeValueString(const wxString
& attribute
, const wxString
& val
)
455 if (type
!= wxExprList
)
457 // cout << "Error! tried to add an attribute-value pair to a nonlist wxExpr expression\n";
461 // DeleteAttributeValue(attribute);
463 wxExpr
*patt
= new wxExpr(wxExprWord
, attribute
);
464 wxExpr
*pval
= new wxExpr(wxExprString
, val
);
465 wxExpr
*pequals
= new wxExpr(wxExprWord
, "=");
467 wxExpr
*listExpr
= new wxExpr(wxExprList
);
469 listExpr
->Append(pequals
);
470 listExpr
->Append(patt
);
471 listExpr
->Append(pval
);
476 void wxExpr::AddAttributeValueWord(const wxString
& attribute
, const wxString
& val
)
478 if (type
!= wxExprList
)
480 // cout << "Error! tried to add an attribute-value pair to a nonlist wxExpr expression\n";
484 // DeleteAttributeValue(attribute);
486 wxExpr
*patt
= new wxExpr(wxExprWord
, attribute
);
487 wxExpr
*pval
= new wxExpr(wxExprWord
, val
);
488 wxExpr
*pequals
= new wxExpr(wxExprWord
, "=");
490 wxExpr
*listExpr
= new wxExpr(wxExprList
);
492 listExpr
->Append(pequals
);
493 listExpr
->Append(patt
);
494 listExpr
->Append(pval
);
499 void wxExpr::AddAttributeValue(const wxString
& attribute
, wxList
*val
)
501 if (type
!= wxExprList
)
503 // cout << "Error! tried to add an attribute-value pair to a nonlist wxExpr expression\n";
509 // DeleteAttributeValue(attribute);
511 wxExpr
*patt
= new wxExpr(wxExprWord
, attribute
);
512 wxExpr
*pval
= new wxExpr(val
);
513 wxExpr
*pequals
= new wxExpr(wxExprWord
, "=");
515 wxExpr
*listExpr
= new wxExpr(wxExprList
);
517 listExpr
->Append(pequals
);
518 listExpr
->Append(patt
);
519 listExpr
->Append(pval
);
524 void wxExpr::AddAttributeValueStringList(const wxString
& attribute
, wxList
*string_list
)
526 if (type
!= wxExprList
)
528 // cout << "Error! tried to add an attribute-value pair to a nonlist wxExpr expression\n";
534 // DeleteAttributeValue(attribute);
536 // First make a list of wxExpr strings
537 wxExpr
*listExpr
= new wxExpr(wxExprList
);
538 wxNode
*node
= string_list
->First();
541 char *string
= (char *)node
->Data();
542 wxExpr
*expr
= new wxExpr(wxExprString
, wxString(string
));
543 listExpr
->Append(expr
);
547 // Now make an (=, Att, Value) triple
548 wxExpr
*patt
= new wxExpr(wxExprWord
, attribute
);
549 wxExpr
*pequals
= new wxExpr(wxExprWord
, "=");
551 wxExpr
*listExpr2
= new wxExpr(wxExprList
);
553 listExpr2
->Append(pequals
);
554 listExpr2
->Append(patt
);
555 listExpr2
->Append(listExpr
);
560 bool wxExpr::GetAttributeValue(const wxString
& att
, int& var
) const
562 wxExpr
*expr
= AttributeValue(att
);
564 if (expr
&& (expr
->Type() == wxExprInteger
|| expr
->Type() == wxExprReal
))
566 var
= (int)(expr
->IntegerValue());
573 bool wxExpr::GetAttributeValue(const wxString
& att
, long& var
) const
575 wxExpr
*expr
= AttributeValue(att
);
577 if (expr
&& (expr
->Type() == wxExprInteger
|| expr
->Type() == wxExprReal
))
579 var
= expr
->IntegerValue();
586 bool wxExpr::GetAttributeValue(const wxString
& att
, float& var
) const
588 wxExpr
*expr
= AttributeValue(att
);
589 if (expr
&& (expr
->Type() == wxExprInteger
|| expr
->Type() == wxExprReal
))
591 var
= expr
->RealValue();
598 bool wxExpr::GetAttributeValue(const wxString
& att
, wxString
& var
) const // Word OR string -> string
600 wxExpr
*expr
= AttributeValue(att
);
601 if (expr
&& expr
->Type() == wxExprWord
)
603 var
= expr
->WordValue();
606 else if (expr
&& expr
->Type() == wxExprString
)
608 var
= expr
->StringValue();
615 bool wxExpr::GetAttributeValue(const wxString
& att
, wxExpr
**var
) const
617 wxExpr
*expr
= AttributeValue(att
);
627 bool wxExpr::GetAttributeValueStringList(const wxString
& att
, wxList
*var
) const
629 wxExpr
*expr
= AttributeValue(att
);
630 if (expr
&& expr
->Type() == wxExprList
)
632 wxExpr
*string_expr
= expr
->value
.first
;
635 if (string_expr
->Type() == wxExprString
)
636 var
->Append((wxObject
*)copystring(string_expr
->StringValue()));
638 string_expr
= string_expr
->next
;
647 void wxExpr::AssignAttributeValue(char *att
, char **var
) const
650 if (GetAttributeValue(att
, str
))
654 *var
= copystring((const char *) str
);
658 void wxExpr::WriteClause(ostream
& stream
) // Write this expression as a top-level clause
660 if (type
!= wxExprList
)
663 wxExpr
*node
= value
.first
;
666 node
->WriteExpr(stream
);
674 node
->WriteExpr(stream
);
676 if (node
) stream
<< ",\n";
683 void wxExpr::WriteExpr(ostream
& stream
) // Write as any other subexpression
685 // This seems to get round an optimizer bug when
686 // using Watcom C++ 10a in WIN32 compilation mode.
687 // If these lines not present, the type seems to be
688 // interpreted wrongly as an integer.
689 // I don't want to turn optimization off since it's needed
690 // for reading in files quickly.
691 #if defined(__WATCOMC__)
700 stream
<< value
.integer
;
705 float f
= value
.real
;
706 /* Now the parser can cope with this.
707 // Prevent printing in 'e' notation. Any better way?
708 if (fabs(f) < 0.00001)
712 sprintf(buf
, "%.6g", f
);
720 int len
= strlen(value
.string
);
721 for (i
= 0; i
< len
; i
++)
723 char ch
= value
.string
[i
];
724 if (ch
== '"' || ch
== '\\')
734 bool quote_it
= FALSE
;
735 int len
= strlen(value
.word
);
736 if ((len
== 0) || (len
> 0 && (value
.word
[0] > 64 && value
.word
[0] < 91)))
741 for (i
= 0; i
< len
; i
++)
742 if ((!isalpha(value
.word
[i
])) && (!isdigit(value
.word
[i
])) &&
743 (value
.word
[i
] != '_'))
744 { quote_it
= TRUE
; i
= len
; }
750 stream
<< value
.word
;
763 wxExpr
*expr
= value
.first
;
765 if ((expr
->Type() == wxExprWord
) && (strcmp(expr
->WordValue(), "=") == 0))
767 wxExpr
*arg1
= expr
->next
;
768 wxExpr
*arg2
= arg1
->next
;
769 arg1
->WriteExpr(stream
);
771 arg2
->WriteExpr(stream
);
778 expr
->WriteExpr(stream
);
780 if (expr
) stream
<< ", ";
787 case wxExprNull
: break;
791 void wxExpr::WriteLispExpr(ostream
& stream
)
797 stream
<< value
.integer
;
802 stream
<< value
.real
;
807 stream
<< "\"" << value
.string
<< "\"";
812 stream
<< value
.word
;
817 wxExpr
*expr
= value
.first
;
822 expr
->WriteLispExpr(stream
);
824 if (expr
) stream
<< " ";
830 case wxExprNull
: break;
834 // wxExpr 'database' (list of expressions)
835 wxExprDatabase::wxExprDatabase(wxExprErrorHandler handler
)
839 currentwxExprErrorHandler
= handler
;
843 wxExprDatabase::wxExprDatabase(wxExprType type
, const wxString
& attribute
, int size
,
844 wxExprErrorHandler handler
)
847 attribute_to_hash
= attribute
;
848 if (type
== wxExprString
)
849 hash_table
= new wxHashTable(wxKEY_STRING
, size
);
850 else if (type
== wxExprInteger
)
851 hash_table
= new wxHashTable(wxKEY_INTEGER
, size
);
852 else hash_table
= NULL
;
854 currentwxExprErrorHandler
= handler
;
858 wxExprDatabase::~wxExprDatabase(void)
865 void wxExprDatabase::BeginFind(void) // Initialise a search
870 wxExpr
*wxExprDatabase::FindClause(long id
) // Find a term based on an integer id attribute
871 // e.g. node(id=23, type=rectangle, ....).
873 wxExpr
*found
= NULL
;
874 while (position
&& !found
)
876 wxExpr
*term
= (wxExpr
*)position
->Data();
878 if (term
->Type() == wxExprList
)
880 wxExpr
*value
= term
->AttributeValue("id");
881 if (value
->Type() == wxExprInteger
&& value
->IntegerValue() == id
)
884 position
= position
->Next();
889 // Find on basis of attribute/value pairs, e.g. type=rectangle
890 wxExpr
*wxExprDatabase::FindClause(const wxString
& word
, const wxString
& val
)
892 wxExpr
*found
= NULL
;
893 while (position
&& !found
)
895 wxExpr
*term
= (wxExpr
*)position
->Data();
897 if (term
->Type() == wxExprList
)
899 wxExpr
*value
= term
->AttributeValue(word
);
900 if ((value
->Type() == wxExprWord
&& value
->WordValue() == val
) ||
901 (value
->Type() == wxExprString
&& value
->StringValue() == val
))
904 position
= position
->Next();
909 wxExpr
*wxExprDatabase::FindClause(const wxString
& word
, long val
)
911 wxExpr
*found
= NULL
;
912 while (position
&& !found
)
914 wxExpr
*term
= (wxExpr
*)position
->Data();
916 if (term
->Type() == wxExprList
)
918 wxExpr
*value
= term
->AttributeValue(word
);
919 if ((value
->Type() == wxExprInteger
) && (value
->IntegerValue() == val
))
922 position
= position
->Next();
927 wxExpr
*wxExprDatabase::FindClause(const wxString
& word
, float val
)
929 wxExpr
*found
= NULL
;
930 while (position
&& !found
)
932 wxExpr
*term
= (wxExpr
*)position
->Data();
934 if (term
->Type() == wxExprList
)
936 wxExpr
*value
= term
->AttributeValue(word
);
937 if ((value
->Type() == wxExprReal
) && (value
->RealValue() == val
))
940 position
= position
->Next();
945 wxExpr
*wxExprDatabase::FindClauseByFunctor(const wxString
& functor
)
947 wxExpr
*found
= NULL
;
948 while (position
&& !found
)
950 wxExpr
*term
= (wxExpr
*)position
->Data();
952 if (term
->Type() == wxExprList
)
954 if (term
->Functor() == functor
)
957 position
= position
->Next();
962 // If hashing is on, must store in hash table too
963 void wxExprDatabase::Append(wxExpr
*clause
)
965 wxList::Append((wxObject
*)clause
);
968 wxString
functor(clause
->Functor());
969 wxExpr
*expr
= clause
->AttributeValue(attribute_to_hash
);
972 long functor_key
= hash_table
->MakeKey((char *)(const char *)functor
);
974 if (expr
&& expr
->Type() == wxExprString
)
976 value_key
= hash_table
->MakeKey((char *)(const char *)expr
->StringValue());
977 hash_table
->Put(functor_key
+ value_key
, (char *)(const char *)expr
->StringValue(), (wxObject
*)clause
);
979 else if (expr
&& expr
->Type() == wxExprInteger
)
981 value_key
= expr
->IntegerValue();
982 hash_table
->Put(functor_key
+ value_key
, expr
->IntegerValue(), (wxObject
*)clause
);
989 wxExpr
*wxExprDatabase::HashFind(const wxString
& functor
, long value
) const
991 long key
= hash_table
->MakeKey((char *)(const char *)functor
) + value
;
993 // The key alone isn't guaranteed to be unique:
994 // must supply value too. Let's assume the value of the
995 // id is going to be reasonably unique.
996 return (wxExpr
*)hash_table
->Get(key
, value
);
999 wxExpr
*wxExprDatabase::HashFind(const wxString
& functor
, const wxString
& value
) const
1001 long key
= hash_table
->MakeKey((char *)(const char *)functor
) + hash_table
->MakeKey((char *)(const char *)value
);
1002 return (wxExpr
*)hash_table
->Get(key
, (char *)(const char *)value
);
1005 void wxExprDatabase::ClearDatabase(void)
1008 wxNode
*node
= First();
1011 wxExpr
*expr
= (wxExpr
*)node
->Data();
1018 hash_table
->Clear();
1021 bool wxExprDatabase::Read(const wxString
& filename
)
1025 FILE *f
= fopen((const char *)filename
, "r");
1028 thewxExprDatabase
= this;
1035 return (noErrors
== 0);
1043 bool wxExprDatabase::ReadFromString(const wxString
& buffer
)
1046 thewxExprDatabase
= this;
1048 LexFromString((char *)(const char *)buffer
);
1051 return (noErrors
== 0);
1054 bool wxExprDatabase::Write(const wxString
& fileName
)
1056 ofstream
str((char *)(const char *)fileName
);
1062 bool wxExprDatabase::Write(ostream
& stream
)
1065 wxNode
*node
= First();
1068 wxExpr
*expr
= (wxExpr
*)node
->Data();
1069 expr
->WriteClause(stream
);
1070 node
= node
->Next();
1072 return (noErrors
== 0);
1075 void wxExprDatabase::WriteLisp(ostream
& stream
)
1078 wxNode
*node
= First();
1081 wxExpr
*expr
= (wxExpr
*)node
->Data();
1082 expr
->WriteLispExpr(stream
);
1084 node
= node
->Next();
1088 void add_expr(wxExpr
* expr
)
1090 thewxExprDatabase
->Append(expr
);
1094 bool wxExprIsFunctor(wxExpr
*expr
, const wxString
& functor
)
1096 if (expr
&& (expr
->Type() == wxExprList
))
1098 wxExpr
*first_expr
= expr
->value
.first
;
1100 if (first_expr
&& (first_expr
->Type() == wxExprWord
) &&
1101 (first_expr
->WordValue() == functor
))
1111 * Called from parser
1115 char *make_integer(char *str
)
1117 wxExpr
*x
= new wxExpr(atol(str
));
1122 char *make_real(char *str1
, char *str2
)
1126 sprintf(buf
, "%s.%s", str1
, str2
);
1127 float f
= (float)atof(buf
);
1128 wxExpr
*x
= new wxExpr(f
);
1133 // extern "C" double exp10(double);
1135 char *make_exp(char *str1
, char *str2
)
1137 double mantissa
= (double)atoi(str1
);
1138 double exponent
= (double)atoi(str2
);
1140 double d
= mantissa
* pow(10.0, exponent
);
1142 wxExpr
*x
= new wxExpr((float)d
);
1147 char *make_exp2(char *str1
, char *str2
, char *str3
)
1151 sprintf(buf
, "%s.%s", str1
, str2
);
1152 double mantissa
= (double)atof(buf
);
1153 double exponent
= (double)atoi(str3
);
1155 double d
= mantissa
* pow(10.0, exponent
);
1157 wxExpr
*x
= new wxExpr((float)d
);
1162 char *make_word(char *str
)
1164 wxExpr
*x
= new wxExpr(wxExprWord
, str
);
1168 char *make_string(char *str
)
1173 str
++; /* skip leading quote */
1174 len
= strlen(str
) - 1; /* ignore trailing quote */
1176 s
= new char[len
+ 1];
1179 for(i
=0; i
<len
; i
++)
1181 if (str
[i
] == '\\' && str
[i
+1] == '"')
1186 else if (str
[i
] == '\\' && str
[i
+1] == '\\')
1197 wxExpr
*x
= new wxExpr(wxExprString
, s
, FALSE
);
1201 char *proio_cons(char * ccar
, char * ccdr
)
1203 wxExpr
*car
= (wxExpr
*)ccar
;
1204 wxExpr
*cdr
= (wxExpr
*)ccdr
;
1208 cdr
= new wxExpr(wxExprList
);
1215 void process_command(char * cexpr
)
1217 wxExpr
*expr
= (wxExpr
*)cexpr
;
1221 void syntax_error(char *s
)
1223 if (currentwxExprErrorHandler
)
1224 (void)(*(currentwxExprErrorHandler
))(WXEXPR_ERROR_SYNTAX
, "syntax error");
1225 if (thewxExprDatabase
) thewxExprDatabase
->noErrors
+= 1;
1230 // char *__cdecl strdup(const char *s)
1231 WXDLLEXPORT
char *strdup(const char *s
)
1233 int len
= strlen(s
);
1234 char *new_s
= (char *)malloc(sizeof(char)*(len
+1));