]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wxexpr.cpp
Moved wxWindow::SetSizeHints implementation to wxTopLevelWindow,
[wxWidgets.git] / src / common / wxexpr.cpp
index 2abeffce01c80097e41e101c424056b0cee24e86..70fb548e140379cd829e39ddaeb980bcf3d86459 100644 (file)
@@ -5,8 +5,8 @@
 // Modified by:
 // Created:     04/01/98
 // RCS-ID:      $Id$
-// Copyright:   (c) Julian Smart and Markus Holzem
-// Licence:     wxWindows license
+// Copyright:   (c) Julian Smart
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -20,6 +20,8 @@
 #pragma hdrstop
 #endif
 
+#if wxUSE_PROLOGIO
+
 #include <stdarg.h>
 #include <ctype.h>
 #include <string.h>
@@ -33,6 +35,77 @@ extern "C" void LexFromFile(FILE *fd);
 extern "C" void LexFromString(char *buf);
 
 
+
+/* Rename all YACC/LEX stuff or we'll conflict with other
+ * applications
+ */
+
+#define yyback PROIO_yyback
+#define yylook PROIO_yylook
+#define yywrap PROIO_yywrap
+#define yyoutput PROIO_yyoutput
+#define yylex PROIO_yylex
+#define yyerror PROIO_yyerror
+#define yyleng PROIO_yyleng
+#define yytext PROIO_yytext
+#define yymorfg PROIO_yymorfg
+#define yylineno PROIO_yylineno
+#define yytchar PROIO_yytchar
+#define yyin PROIO_yyin
+#define yyout PROIO_yyout
+#define yysvf PROIO_yysvf
+#define yyestate PROIO_yyestate
+#define yysvec PROIO_yysvec
+#define yybgin PROIO_yybgin
+#define yyprevious PROIO_yyprevious
+#define yylhs PROIO_yylhs
+#define yylen PROIO_yylen
+#define yydefred PROIO_yydefred
+#define yydgoto PROIO_yydgoto
+#define yysindex PROIO_yysindex
+#define yyrindex PROIO_yyrindex
+#define yygindex PROIO_yygindex
+#define yytable PROIO_yytable
+#define yycheck PROIO_yycheck
+#define yyname PROIO_yyname
+#define yyrule PROIO_yyrule
+#define yydebug PROIO_yydebug
+#define yynerrs PROIO_yynerrs
+#define yyerrflag PROIO_yyerrflag
+#define yychar PROIO_yychar
+#define yyvsp PROIO_yyvsp
+#define yyssp PROIO_yyssp
+#define yyval PROIO_yyval
+#define yylval PROIO_yylval
+#define yyss PROIO_yyss
+#define yyvs PROIO_yyvs
+#define yyparse PROIO_yyparse
+
+/* +++steve162e: more defines necessary */
+#define yy_init_buffer PROIO_yy_init_buffer
+#define yy_create_buffer PROIO_yy_create_buffer
+#define yy_load_buffer_state PROIO_yy_load_buffer_state
+#define yyrestart PROIO_yyrestart
+#define yy_switch_to_buffer PROIO_yy_switch_to_buffer
+#define yy_delete_buffer PROIO_yy_delete_buffer
+/* ---steve162e */
+
+/* WG 1/96: still more for flex 2.5 */
+#define yy_scan_buffer PROIO_scan_buffer
+#define yy_scan_string PROIO_scan_string
+#define yy_scan_bytes PROIO_scan_bytes
+#define yy_flex_debug PROIO_flex_debug
+#define yy_flush_buffer PROIO_flush_buffer
+#if !defined(__VISAGECPP__)
+/* multiply defined??? */
+#define yyleng PROIO_yyleng
+#define yytext PROIO_yytext
+#endif
+
+extern "C" WXDLLEXPORT_DATA(FILE*) yyin;
+extern "C" WXDLLEXPORT int yyparse(void);
+
+
 wxExprDatabase *thewxExprDatabase = NULL;
 wxExprErrorHandler currentwxExprErrorHandler;
 
@@ -123,12 +196,12 @@ wxExpr::wxExpr(wxList *the_list)
 
   wxExpr *listExpr = new wxExpr(wxExprList);
 
-  wxNode *node = the_list->First();
+  wxNode *node = the_list->GetFirst();
   while (node)
   {
-    wxExpr *expr = (wxExpr *)node->Data();
+    wxExpr *expr = (wxExpr *)node->GetData();
     listExpr->Append(expr);
-    node = node->Next();
+    node = node->GetNext();
   }
   Append(listExpr);
 
@@ -532,13 +605,13 @@ void wxExpr::AddAttributeValueStringList(const wxString& attribute, wxList *stri
 
   // First make a list of wxExpr strings
   wxExpr *listExpr = new wxExpr(wxExprList);
-  wxNode *node = string_list->First();
+  wxNode *node = string_list->GetFirst();
   while (node)
   {
-    char *string = (char *)node->Data();
+    wxChar *string = (wxChar*)node->GetData();
     wxExpr *expr = new wxExpr(wxExprString, wxString(string));
     listExpr->Append(expr);
-    node = node->Next();
+    node = node->GetNext();
   }
 
   // Now make an (=, Att, Value) triple
@@ -834,7 +907,7 @@ wxExprDatabase::~wxExprDatabase(void)
 
 void wxExprDatabase::BeginFind(void)          // Initialise a search
 {
-  position = First();
+  position = GetFirst();
 }
 
 wxExpr *wxExprDatabase::FindClause(long id)  // Find a term based on an integer id attribute
@@ -843,15 +916,15 @@ wxExpr *wxExprDatabase::FindClause(long id)  // Find a term based on an integer
   wxExpr *found = NULL;
   while (position && !found)
   {
-    wxExpr *term = (wxExpr *)position->Data();
+    wxExpr *term = (wxExpr *)position->GetData();
     
     if (term->Type() == wxExprList)
     {
-      wxExpr *value = term->AttributeValue("id");
+      wxExpr *value = term->AttributeValue(wxT("id"));
       if (value->Type() == wxExprInteger && value->IntegerValue() == id)
         found = term;
     }
-    position = position->Next();
+    position = position->GetNext();
   }
   return found;
 }
@@ -862,7 +935,7 @@ wxExpr *wxExprDatabase::FindClause(const wxString& word, const wxString& val)
   wxExpr *found = NULL;
   while (position && !found)
   {
-    wxExpr *term = (wxExpr *)position->Data();
+    wxExpr *term = (wxExpr *)position->GetData();
     
     if (term->Type() == wxExprList)
     {
@@ -871,7 +944,7 @@ wxExpr *wxExprDatabase::FindClause(const wxString& word, const wxString& val)
           (value->Type() == wxExprString && value->StringValue() == val))
         found = term;
     }
-    position = position->Next();
+    position = position->GetNext();
   }
   return found;
 }
@@ -881,7 +954,7 @@ wxExpr *wxExprDatabase::FindClause(const wxString& word, long val)
   wxExpr *found = NULL;
   while (position && !found)
   {
-    wxExpr *term = (wxExpr *)position->Data();
+    wxExpr *term = (wxExpr *)position->GetData();
     
     if (term->Type() == wxExprList)
     {
@@ -889,7 +962,7 @@ wxExpr *wxExprDatabase::FindClause(const wxString& word, long val)
       if ((value->Type() == wxExprInteger) && (value->IntegerValue() == val))
         found = term;
     }
-    position = position->Next();
+    position = position->GetNext();
   }
   return found;
 }
@@ -899,7 +972,7 @@ wxExpr *wxExprDatabase::FindClause(const wxString& word, double val)
   wxExpr *found = NULL;
   while (position && !found)
   {
-    wxExpr *term = (wxExpr *)position->Data();
+    wxExpr *term = (wxExpr *)position->GetData();
     
     if (term->Type() == wxExprList)
     {
@@ -907,7 +980,7 @@ wxExpr *wxExprDatabase::FindClause(const wxString& word, double val)
       if ((value->Type() == wxExprReal) && (value->RealValue() == val))
         found = term;
     }
-    position = position->Next();
+    position = position->GetNext();
   }
   return found;
 }
@@ -917,14 +990,14 @@ wxExpr *wxExprDatabase::FindClauseByFunctor(const wxString& functor)
   wxExpr *found = NULL;
   while (position && !found)
   {
-    wxExpr *term = (wxExpr *)position->Data();
+    wxExpr *term = (wxExpr *)position->GetData();
     
     if (term->Type() == wxExprList)
     {
       if (term->Functor() == functor)
         found = term;
     }
-    position = position->Next();
+    position = position->GetNext();
   }
   return found;
 }
@@ -975,13 +1048,13 @@ wxExpr *wxExprDatabase::HashFind(const wxString& functor, const wxString& value)
 void wxExprDatabase::ClearDatabase(void)
 {
   noErrors = 0;
-  wxNode *node = First();
+  wxNode *node = GetFirst();
   while (node)
   {
-    wxExpr *expr = (wxExpr *)node->Data();
+    wxExpr *expr = (wxExpr *)node->GetData();
     delete expr;
     delete node;
-    node = First();
+    node = GetFirst();
   }
 
   if (hash_table)
@@ -1037,12 +1110,12 @@ bool wxExprDatabase::Write(const wxString& fileName)
 bool wxExprDatabase::Write(FILE *stream)
 {
   noErrors = 0;
-  wxNode *node = First();
+  wxNode *node = GetFirst();
   while (node)
   {
-    wxExpr *expr = (wxExpr *)node->Data();
+    wxExpr *expr = (wxExpr *)node->GetData();
     expr->WriteClause(stream);
-    node = node->Next();
+    node = node->GetNext();
   }
   return (noErrors == 0);
 }
@@ -1123,7 +1196,7 @@ char *wxmake_exp2(char *str1, char *str2, char *str3)
 
 char *wxmake_word(char *str)
 {
-  wxExpr *x = new wxExpr(wxExprWord, str);
+  wxExpr *x = new wxExpr(wxExprWord, wxString(str, wxConvLibc).c_str());
   return (char *)x;
 }
 
@@ -1184,7 +1257,7 @@ void process_command(char * cexpr)
 void syntax_error(char *WXUNUSED(s))
 {
   if (currentwxExprErrorHandler)
-    (void)(*(currentwxExprErrorHandler))(WXEXPR_ERROR_SYNTAX, "syntax error");
+    (void)(*(currentwxExprErrorHandler))(WXEXPR_ERROR_SYNTAX, (char *)"syntax error");
   if (thewxExprDatabase) thewxExprDatabase->noErrors += 1;
 }
 
@@ -1201,3 +1274,5 @@ WXDLLEXPORT char *strdup(const char *s)
 #endif
 #endif
 
+#endif
+  // wxUSE_PROLOGIO