]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/parser.y
Committing in .
[wxWidgets.git] / src / common / parser.y
index 7600083ee7e17679adabf6d27ac2133c5b77008c..c922f8c04a8df2f8f1a419f2e019e6463b56e209 100644 (file)
@@ -1,8 +1,13 @@
+/* Version: $Id$ */
  %{
  %{
+#include "wx/setup.h"
 #include <string.h>
 #ifdef _MSC_VER
 #include <io.h>
 #endif
 #include <string.h>
 #ifdef _MSC_VER
 #include <io.h>
 #endif
+#if defined(__GNUWIN32__) && !defined(__TWIN32__)
+#include <sys/unistd.h>
+#endif
 
 #include "wx/expr.h"
 
 
 #include "wx/expr.h"
 
@@ -24,12 +29,7 @@ void yyerror(char *);
 /* You may need to put /DLEX_SCANNER in your makefile
  * if you're using LEX!
  */
 /* You may need to put /DLEX_SCANNER in your makefile
  * if you're using LEX!
  */
-#ifdef LEX_SCANNER
-/* int yyoutput(int); */
-void yyoutput(int);
-#else
 void yyoutput(int);
 void yyoutput(int);
-#endif
 
 #if defined(__cplusplus) || defined(__STDC__)
 #if defined(__cplusplus) && defined(__EXTERN_C__)
 
 #if defined(__cplusplus) || defined(__STDC__)
 #if defined(__cplusplus) && defined(__EXTERN_C__)
@@ -70,7 +70,7 @@ commands :    /* empty */
        ;
 
 command        :       WORD PERIOD
        ;
 
 command        :       WORD PERIOD
-                       {process_command(proio_cons(make_word($1), NULL)); free($1);}
+                       {process_command(proio_cons(wxmake_word($1), NULL)); free($1);}
         |       expr PERIOD
                        {process_command($1);}
        |       error PERIOD
         |       expr PERIOD
                        {process_command($1);}
        |       error PERIOD
@@ -78,15 +78,13 @@ command     :       WORD PERIOD
        ;
 
 expr   :       WORD OPEN arglist CLOSE 
        ;
 
 expr   :       WORD OPEN arglist CLOSE 
-                       {$$ = proio_cons(make_word($1), $3); free($1);}
-       |       OPEN_SQUARE CLOSE_SQUARE
-                        {$$ = proio_cons(NULL, NULL);}
+                       {$$ = proio_cons(wxmake_word($1), $3); free($1);}
        |       OPEN_SQUARE arglist CLOSE_SQUARE
                        {$$ = $2; }
        ;
 
 arglist        :
        |       OPEN_SQUARE arglist CLOSE_SQUARE
                        {$$ = $2; }
        ;
 
 arglist        :
-                       {$$ = NULL;}
+                       {$$ = proio_cons(NULL, NULL);}
        |       arg
                        {$$ = proio_cons($1, NULL);}
        |
        |       arg
                        {$$ = proio_cons($1, NULL);}
        |
@@ -95,24 +93,25 @@ arglist     :
        ;
 
 arg    :       WORD EQUALS arg1
        ;
 
 arg    :       WORD EQUALS arg1
-                       {$$ = proio_cons(make_word("="), proio_cons(make_word($1), proio_cons($3, NULL)));
+                       {$$ = proio_cons(wxmake_word("="), proio_cons(wxmake_word($1), proio_cons($3, NULL)));
                          free($1); }
        |       arg1
                        {$$ = $1; }
                          free($1); }
        |       arg1
                        {$$ = $1; }
+       ;
 
 arg1   :       WORD
 
 arg1   :       WORD
-                       {$$ = make_word($1); free($1);}
+                       {$$ = wxmake_word($1); free($1);}
        |       STRING
        |       STRING
-                       {$$ = make_string($1); free($1);}
+                       {$$ = wxmake_string($1); free($1);}
        |       INTEGER
        |       INTEGER
-                       {$$ = make_integer($1); free($1);}
+                       {$$ = wxmake_integer($1); free($1);}
        |       INTEGER PERIOD INTEGER
        |       INTEGER PERIOD INTEGER
-                       {$$ = make_real($1, $3); free($1); free($3); }
+                       {$$ = wxmake_real($1, $3); free($1); free($3); }
         |       INTEGER EXP INTEGER
         |       INTEGER EXP INTEGER
-                         {$$ = make_exp($1, $3); free($1); free($3); }
+                         {$$ = wxmake_exp($1, $3); free($1); free($3); }
         |
               INTEGER PERIOD INTEGER EXP INTEGER
         |
               INTEGER PERIOD INTEGER EXP INTEGER
-                         {$$ = make_exp2($1, $3, $5); free($1); free($3);
+                         {$$ = wxmake_exp2($1, $3, $5); free($1); free($3);
                                                                   free($5); }
 
        |       expr
                                                                   free($5); }
 
        |       expr
@@ -121,8 +120,15 @@ arg1       :       WORD
 
 %%
 
 
 %%
 
-#ifdef __WXGTK__
+/* We include lexer.c if we are building for gtk, wine or motif
+ * and also whenever we are using configure (marked by __WX_SETUP_H__) for,
+ * for example, cross compilation. */
+#if (defined(__WXGTK__) || defined(__WXWINE__) || defined(__WXMOTIF__)) || defined(__WX_SETUP_H__) && !defined(NO_CONFIGURE)
+#include "lexer.c"
+#elif defined(__WXMAC__) && defined(__APPLE__)
 #include "lexer.c"
 #include "lexer.c"
+#elif defined(__MWERKS__)
+#include "../common/cwlex_yy.c"
 #else
 #include "../common/lex_yy.c"
 #endif
 #else
 #include "../common/lex_yy.c"
 #endif
@@ -150,16 +156,29 @@ void yyerror(char *s)
  * the UNIX flex expects a proper function.
  */
 
  * the UNIX flex expects a proper function.
  */
 
-/* Not sure if __SC__ is the appropriate thing
- * to test
+/* At least on alphaev6-dec-osf4.0e yywrap() must be #define'd.
+ * RL: ... but on Debian/Alpha(linux) it must not, so hopefully
+ *     testing for __OSF__ here is what we really want.
  */
  */
-
-#ifndef __SC__
+#ifdef __OSF__
+#ifndef yywrap
+#define yywrap() 1
+#endif
+#else
+/* HH: Added test for __WX_SETUP_H__ for gnuwin builds
+ * using configure */ 
+#if !defined(__SC__) && !defined(__GNUWIN32__) 
 #ifdef USE_DEFINE
 #ifndef yywrap
 #define yywrap() 1
 #endif
 #ifdef USE_DEFINE
 #ifndef yywrap
 #define yywrap() 1
 #endif
-#else if !defined(__alpha) && !defined(__ultrix)
+#elif !defined(__ultrix)
+int yywrap() { return 1; }
+#elif defined(__VMS__)
+int yywrap() { return 1; }
+#endif
+#elif defined(__WX_SETUP_H__)
 int yywrap() { return 1; }
 #endif
 #endif
 int yywrap() { return 1; }
 #endif
 #endif
+