X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fd15d8f1b0b437312a117b7e4509708a22e30806..4f6aed9c6a21d4bc732579aa564adf4cdb2c9aab:/src/common/wxexpr.cpp diff --git a/src/common/wxexpr.cpp b/src/common/wxexpr.cpp index 67e5f100e7..bbfce13288 100644 --- a/src/common/wxexpr.cpp +++ b/src/common/wxexpr.cpp @@ -275,12 +275,12 @@ wxExpr *wxExpr::AttributeValue(const wxString& word) const // Use only for a cla wxString wxExpr::Functor(void) const // Use only for a clause { if ((type != wxExprList) || !value.first) - return wxString(_T("")); + return wxString(wxT("")); if (value.first->type == wxExprWord) return wxString(value.first->value.word); else - return wxString(_T("")); + return wxString(wxT("")); } bool wxExpr::IsFunctor(const wxString& f) const // Use only for a clause @@ -390,7 +390,7 @@ void wxExpr::AddAttributeValue(const wxString& attribute, wxExpr *val) // DeleteAttributeValue(attribute); wxExpr *patt = new wxExpr(wxExprWord, attribute); - wxExpr *pequals = new wxExpr(wxExprWord, _T("=")); + wxExpr *pequals = new wxExpr(wxExprWord, wxT("=")); wxExpr *listExpr = new wxExpr(wxExprList); @@ -414,7 +414,7 @@ void wxExpr::AddAttributeValue(const wxString& attribute, long val) wxExpr *patt = new wxExpr(wxExprWord, attribute); wxExpr *pval = new wxExpr(val); - wxExpr *pequals = new wxExpr(wxExprWord, _T("=")); + wxExpr *pequals = new wxExpr(wxExprWord, wxT("=")); wxExpr *listExpr = new wxExpr(wxExprList); @@ -436,7 +436,7 @@ void wxExpr::AddAttributeValue(const wxString& attribute, double val) // DeleteAttributeValue(attribute); wxExpr *patt = new wxExpr(wxExprWord, attribute); wxExpr *pval = new wxExpr(val); - wxExpr *pequals = new wxExpr(wxExprWord, _T("=")); + wxExpr *pequals = new wxExpr(wxExprWord, wxT("=")); wxExpr *listExpr = new wxExpr(wxExprList); @@ -459,7 +459,7 @@ void wxExpr::AddAttributeValueString(const wxString& attribute, const wxString& wxExpr *patt = new wxExpr(wxExprWord, attribute); wxExpr *pval = new wxExpr(wxExprString, val); - wxExpr *pequals = new wxExpr(wxExprWord, _T("=")); + wxExpr *pequals = new wxExpr(wxExprWord, wxT("=")); wxExpr *listExpr = new wxExpr(wxExprList); @@ -482,7 +482,7 @@ void wxExpr::AddAttributeValueWord(const wxString& attribute, const wxString& va wxExpr *patt = new wxExpr(wxExprWord, attribute); wxExpr *pval = new wxExpr(wxExprWord, val); - wxExpr *pequals = new wxExpr(wxExprWord, _T("=")); + wxExpr *pequals = new wxExpr(wxExprWord, wxT("=")); wxExpr *listExpr = new wxExpr(wxExprList); @@ -507,7 +507,7 @@ void wxExpr::AddAttributeValue(const wxString& attribute, wxList *val) wxExpr *patt = new wxExpr(wxExprWord, attribute); wxExpr *pval = new wxExpr(val); - wxExpr *pequals = new wxExpr(wxExprWord, _T("=")); + wxExpr *pequals = new wxExpr(wxExprWord, wxT("=")); wxExpr *listExpr = new wxExpr(wxExprList); @@ -543,7 +543,7 @@ void wxExpr::AddAttributeValueStringList(const wxString& attribute, wxList *stri // Now make an (=, Att, Value) triple wxExpr *patt = new wxExpr(wxExprWord, attribute); - wxExpr *pequals = new wxExpr(wxExprWord, _T("=")); + wxExpr *pequals = new wxExpr(wxExprWord, wxT("=")); wxExpr *listExpr2 = new wxExpr(wxExprList); @@ -769,7 +769,7 @@ void wxExpr::WriteExpr(FILE* stream) // Write as any other subexpression { wxExpr *expr = value.first; - if ((expr->Type() == wxExprWord) && (wxStrcmp(expr->WordValue(), _T("=")) == 0)) + if ((expr->Type() == wxExprWord) && (wxStrcmp(expr->WordValue(), wxT("=")) == 0)) { wxExpr *arg1 = expr->next; wxExpr *arg2 = arg1->next; @@ -796,61 +796,11 @@ void wxExpr::WriteExpr(FILE* stream) // Write as any other subexpression } } -void wxExpr::WriteLispExpr(FILE* stream) -{ - switch (type) - { - case wxExprInteger: - { - fprintf( stream, "%ld", value.integer ); - break; - } - case wxExprReal: - { - fprintf( stream, "%.6g", value.real ); - break; - } - case wxExprString: - { - fprintf( stream, "\"" ); - const wxWX2MBbuf val = wxConvLibc.cWX2MB(value.string); - fprintf( stream, (const char*) val ); - fprintf( stream, "\"" ); - break; - } - case wxExprWord: - { - const wxWX2MBbuf val = wxConvLibc.cWX2MB(value.word); - fprintf( stream, (const char*) val ); - break; - } - case wxExprList: - { - wxExpr *expr = value.first; - - fprintf( stream, "(" ); - while (expr) - { - expr->WriteLispExpr(stream); - expr = expr->next; - if (expr) - fprintf( stream, " " ); - } - - fprintf( stream, ")" ); - break; - } - case wxExprNull: break; - } -} - /* * wxExpr 'database' (list of expressions) */ -#if !USE_SHARED_LIBRARIES IMPLEMENT_DYNAMIC_CLASS(wxExprDatabase, wxList) -#endif wxExprDatabase::wxExprDatabase(wxExprErrorHandler handler) { @@ -1066,7 +1016,7 @@ bool wxExprDatabase::ReadFromString(const wxString& buffer) thewxExprDatabase = this; const wxWX2MBbuf buf = buffer.mb_str(); - LexFromString(MBSTRINGCAST buf); + LexFromString(wxMBSTRINGCAST buf); yyparse(); wxExprCleanUp(); return (noErrors == 0); @@ -1079,7 +1029,9 @@ bool wxExprDatabase::Write(const wxString& fileName) if (!stream) return FALSE; - return Write(stream); + bool success = Write(stream); + fclose(stream); + return success; } bool wxExprDatabase::Write(FILE *stream) @@ -1095,19 +1047,6 @@ bool wxExprDatabase::Write(FILE *stream) return (noErrors == 0); } -void wxExprDatabase::WriteLisp(FILE* stream) -{ - noErrors = 0; - wxNode *node = First(); - while (node) - { - wxExpr *expr = (wxExpr *)node->Data(); - expr->WriteLispExpr(stream); - fprintf( stream, "\n\n" ); - node = node->Next(); - } -} - void add_expr(wxExpr * expr) { thewxExprDatabase->Append(expr); @@ -1202,21 +1141,21 @@ char *wxmake_string(char *str) t = s; for(i=1; i