diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index b75de3b7c3..9f1aea52c0 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -10,6 +10,10 @@ // Licence: wxWindows license /////////////////////////////////////////////////////////////////////////////// +#ifdef __GNUG__ +#pragma implementation "fileconf.h" +#endif + // ============================================================================ // declarations // ============================================================================ diff --git a/src/common/lexer.l b/src/common/lexer.l new file mode 100644 index 0000000000..02e95f54a9 --- /dev/null +++ b/src/common/lexer.l @@ -0,0 +1,195 @@ +SIGN [+-] +DIGIT [0-9] +ALPHA [a-zA-Z_] +ALPHADIGIT [a-zA-Z_0-9] +STRINGCHAR [^"\\] +WORDCHAR [^'\\] + +%{ +/* + * File: lexer.l + * Description: Lexical analyser for PROLOGIO; can be used with + * either lex and flex. + */ +#include + +/* +++steve162e: added, otherwise, PROIO_input will be undefined (at least under LINUX) + please check, if this is also TRUE under other UNIXes. + */ + +#if defined(FLEX_SCANNER) && defined(_LINUX) +#define PROIO_input my_input +#endif +/* ---steve162e */ + +#include "wx/expr.h" + +#ifdef wx_x +extern char *malloc(); +#endif +#define Return(x) return x; + +#if defined(VMS) && !defined(strdup) +#define strdup(s) (strcpy((char *)malloc(strlen(s)+1), s)); +#endif + +static size_t lex_buffer_length = 0; +static const char *lex_buffer = NULL; +static size_t lex_string_ptr = 0; +static int lex_read_from_string = 0; + +static int my_input(void); +static int my_unput(char); + +#ifdef FLEX_SCANNER +#undef YY_INPUT +# define YY_INPUT(buf,result,max_size) \ + if (lex_read_from_string) \ + { int c = my_input(); result = (c == 0) ? YY_NULL : ((buf)[0]=(c), 1); } \ + else \ + if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ + YY_FATAL_ERROR( "read() in flex scanner failed" ); +#else +# undef unput +# define unput(_c) my_unput(_c) +#endif + +%} + +%% + +{SIGN}?{DIGIT}+ {yylval.s = strdup(yytext); Return(INTEGER);} + +"e" Return(EXP); + +{ALPHA}{ALPHADIGIT}* {yylval.s = strdup(yytext); Return(WORD);} + +"'"{WORDCHAR}*"'" {int len = strlen(yytext); + yytext[len-1] = 0; + yylval.s = strdup(yytext+1); + Return(WORD);} + +\"({STRINGCHAR}|\\\"|\|\\\\|\\)*\" {yylval.s = strdup(yytext); Return(STRING);} + +"(" Return(OPEN); + +")" Return(CLOSE); + +"," Return(COMMA); + +"[" Return(OPEN_SQUARE); + +"]" Return(CLOSE_SQUARE); + +"=" Return(EQUALS); + +"." Return(PERIOD); + +[ \t] ; + +\n ; + +"/*" { loop: +#ifdef __cplusplus + while (yyinput() != '*'); + switch (yyinput()) +#else + while (input() != '*'); + switch (input()) +#endif + { + case '/': break; + case '*': unput('*'); + default: goto loop; + } + } + +. Return(ERROR); + +%% + + +#ifdef FLEX_SCANNER +static int lex_input() { + return input(); +} +#else /* BSD/AT&T lex */ +#ifndef input +# error "Sorry, but need either flex or AT&T lex" +#endif +static int lex_input() { + return input(); +} +/* # undef unput +# define unput(_c) my_unput(_c) +*/ + +# undef input +# define input() my_input() +static int my_unput(char c) +{ + if (lex_read_from_string) { + /* Make sure we have something */ + if (lex_string_ptr) { + if (c == '\n') yylineno--; + lex_string_ptr--; + } + } else { + yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar; +/* unput(c); Causes infinite recursion! */ + } + return c; +} + +#endif + +/* Public */ +void LexFromFile(FILE *fd) +{ + lex_read_from_string = 0; + yyin = fd; + /* Don't know why this is necessary, but otherwise + * lex only works _once_! + */ +#ifdef FLEX_SCANNER + yyrestart(fd); + yy_init = 1; +#endif +} + +void LexFromString(char *buffer) +{ + lex_read_from_string = 1; + lex_buffer = buffer; + lex_buffer_length = strlen(buffer); + lex_string_ptr = 0; + /* Don't know why this is necessary, but otherwise + * lex only works _once_! + */ +#ifdef FLEX_SCANNER + yy_init = 1; +#endif +} + +static int my_input( void ) +{ + if (lex_read_from_string) { + if (lex_string_ptr == lex_buffer_length) + return 0; + else { + char c = lex_buffer[lex_string_ptr++]; +#ifndef FLEX_SCANNER + if (c == '\n') yylineno++; +#endif + return c; + } + } else { + return lex_input(); + } +} + +void wxExprCleanUp() +{ + if (yy_current_buffer) + yy_delete_buffer(yy_current_buffer); +} diff --git a/src/common/parser.y b/src/common/parser.y new file mode 100644 index 0000000000..1fb7dceb10 --- /dev/null +++ b/src/common/parser.y @@ -0,0 +1,157 @@ + %{ +#include +#include "wx/expr.h" + +#ifndef __EXTERN_C__ +#define __EXTERN_C__ 1 +#endif + +#if defined(__cplusplus) || defined(__STDC__) +#if defined(__cplusplus) && defined(__EXTERN_C__) +extern "C" { +#endif +#endif +int yylex(void); +int yylook(void); +int yywrap(void); +int yyback(int *, int); +void yyerror(char *); + +/* 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); +#endif + +#if defined(__cplusplus) || defined(__STDC__) +#if defined(__cplusplus) && defined(__EXTERN_C__) +} +#endif +#endif +%} + +%union { + char *s; +/* struct pexpr *expr; */ +} + + +%start commands + +%token INTEGER 1 +%token WORD 2 +%token STRING 3 +%token PERIOD 13 +%token OPEN 4 +%token CLOSE 5 +%token COMMA 6 +%token NEWLINE 7 +%token ERROR 8 +%token OPEN_SQUARE 9 +%token CLOSE_SQUARE 10 +%token EQUALS 11 +%token EXP 14 + +/* %type command expr arglist arg arg1 */ +%type command expr arglist arg arg1 + +%% + +commands : /* empty */ + | commands command + ; + +command : WORD PERIOD + {process_command(proio_cons(make_word($1), NULL)); free($1);} + | expr PERIOD + {process_command($1);} + | error PERIOD + {syntax_error("Unrecognized command.");} + ; + +expr : WORD OPEN arglist CLOSE + {$$ = proio_cons(make_word($1), $3); free($1);} + | OPEN_SQUARE CLOSE_SQUARE + {$$ = proio_cons(NULL, NULL);} + | OPEN_SQUARE arglist CLOSE_SQUARE + {$$ = $2; } + ; + +arglist : + {$$ = NULL;} + | arg + {$$ = proio_cons($1, NULL);} + | + arg COMMA arglist + {$$ = proio_cons($1, $3);} + ; + +arg : WORD EQUALS arg1 + {$$ = proio_cons(make_word("="), proio_cons(make_word($1), proio_cons($3, NULL))); + free($1); } + | arg1 + {$$ = $1; } + +arg1 : WORD + {$$ = make_word($1); free($1);} + | STRING + {$$ = make_string($1); free($1);} + | INTEGER + {$$ = make_integer($1); free($1);} + | INTEGER PERIOD INTEGER + {$$ = make_real($1, $3); free($1); free($3); } + | INTEGER EXP INTEGER + {$$ = make_exp($1, $3); free($1); free($3); } + | + INTEGER PERIOD INTEGER EXP INTEGER + {$$ = make_exp2($1, $3, $5); free($1); free($3); + free($5); } + + | expr + {$$ = $1;} + ; + +%% + +#include "../common/lex_yy.c" + +/* +void yyerror(s) +char *s; +{ + syntax_error(s); +} +*/ + +/* Ansi prototype. If this doesn't work for you... uncomment + the above instead. + */ + +void yyerror(char *s) +{ + syntax_error(s); +} + +/* + * Unfortunately, my DOS version of FLEX + * requires yywrap to be #def'ed, whereas + * the UNIX flex expects a proper function. + */ + +/* Not sure if __SC__ is the appropriate thing + * to test + */ + +#ifndef __SC__ +#ifdef USE_DEFINE +#ifndef yywrap +#define yywrap() 1 +#endif +#else if !defined(__alpha) && !defined(__ultrix) +int yywrap() { return 1; } +#endif +#endif diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 349d6f04a0..196f506ae7 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -10,7 +10,7 @@ ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ -#pragma implementation "utils.h" +#pragma implementation "utilscmn.h" #endif // For compilers that support precompilation, includes "wx.h". diff --git a/src/makeg95.env b/src/makeg95.env index bc5f856a47..3b37cdd321 100644 --- a/src/makeg95.env +++ b/src/makeg95.env @@ -59,12 +59,12 @@ RESFLAGS=--include-dir $(WXDIR)/include --define __WIN32__ --define __WIN95__ -- # Data General: -DDG # HP: -D_HPUX_SOURCE +a1 -Aa +d -z # IRIX: -mips2 -OPTIONS= -D__MINGW32__ # -D__EGCS__ +OPTIONS= # -D__MINGW32__ # -D__EGCS__ # Debugging information # AIX: comment out. # IRIX: -g3 -DEBUGFLAGS = -ggdb -D__DEBUG__ -DDEBUG=1 +DEBUGFLAGS = -ggdb -D__DEBUG__ # Debug/trace mode. 1 or more for debugging. DEBUG=0 diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index d3dcc65044..c64edd9f33 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -19,6 +19,7 @@ #ifdef __GNUG__ #pragma implementation "menu.h" +#pragma implementation "menuitem.h" #endif // For compilers that support precompilation, includes "wx.h". @@ -158,7 +159,7 @@ void wxMenu::Append(wxMenuItem *pItem) UINT id; wxMenu *SubMenu = pItem->GetSubMenu(); if ( SubMenu != NULL ) { - wxASSERT( SubMenu->m_hMenu != NULL ); + wxASSERT( SubMenu->m_hMenu != (WXHMENU) NULL ); id = (UINT)SubMenu->m_hMenu; diff --git a/src/msw/ole/dataobj.cpp b/src/msw/ole/dataobj.cpp index 941748b092..fd57f7de78 100644 --- a/src/msw/ole/dataobj.cpp +++ b/src/msw/ole/dataobj.cpp @@ -30,7 +30,7 @@ #include -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__GNUWIN32__) #include #include diff --git a/src/msw/regconf.cpp b/src/msw/regconf.cpp index f3a8bf71a3..c2d1d8e76b 100644 --- a/src/msw/regconf.cpp +++ b/src/msw/regconf.cpp @@ -9,6 +9,10 @@ // Licence: wxWindows license /////////////////////////////////////////////////////////////////////////////// +#ifdef __GNUG__ +#pragma implementation "regconf.h" +#endif + // ============================================================================ // declarations // ============================================================================ diff --git a/src/msw/statbr95.cpp b/src/msw/statbr95.cpp index 6f02d0aa57..e740741b31 100644 --- a/src/msw/statbr95.cpp +++ b/src/msw/statbr95.cpp @@ -9,6 +9,10 @@ // Licence: wxWindows license /////////////////////////////////////////////////////////////////////////////// +#ifdef __GNUG__ +#pragma implementation "statbr95.h" +#endif + // ============================================================================ // declarations // ============================================================================ diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index 899eb80eed..6ff8518ec4 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -10,7 +10,7 @@ ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ -#pragma implementation "utils.h" +#pragma implementation #endif // For compilers that support precompilation, includes "wx.h". @@ -134,10 +134,8 @@ long wxExecute(const wxString& command, bool sync, wxProcess *handler) *argp++ = '\0'; #ifdef __GNUWIN32__ - result = ShellExecute((HWND) (wxTheApp->GetTopWindow() ? (HWND) wxTheApp->GetT -opWindow()->GetHWND() : NULL), - (const wchar_t) "open", (const wchar_t) cl, (const wchar_t) arg -p,i + result = ShellExecute((HWND) (wxTheApp->GetTopWindow() ? (HWND) wxTheApp->GetTopWindow()->GetHWND() : NULL), + (const wchar_t) "open", (const wchar_t) cl, (const wchar_t) argp, (const wchar_t) NULL, SW_SHOWNORMAL); #else result = ShellExecute( (HWND) (wxTheApp->GetTopWindow() ? wxTheApp->GetTopWindow()->GetHWND() : NULL),