diff options
author | Michele Calgaro <[email protected]> | 2019-04-21 23:22:20 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2019-04-21 23:22:20 +0900 |
commit | dba036816b279bc1539a9f3894fbc414665d2bce (patch) | |
tree | 29e4bf00bafe515e7afdd02168d65a47a3f9fbc0 /tqtinterface/qt4/src/tqmoc | |
parent | 6f1b4f0c7505a049d992a33f6e409b7c75732d4b (diff) | |
download | experimental-dba036816b279bc1539a9f3894fbc414665d2bce.tar.gz experimental-dba036816b279bc1539a9f3894fbc414665d2bce.zip |
Removed unnecessary and/or TDE-unrelated code.
Signed-off-by: Michele Calgaro <[email protected]>
Signed-off-by: Slávek Banko <[email protected]>
Diffstat (limited to 'tqtinterface/qt4/src/tqmoc')
-rw-r--r-- | tqtinterface/qt4/src/tqmoc/README | 24 | ||||
-rw-r--r-- | tqtinterface/qt4/src/tqmoc/tqmoc.l | 498 | ||||
-rw-r--r-- | tqtinterface/qt4/src/tqmoc/tqmoc.pro | 65 | ||||
-rw-r--r-- | tqtinterface/qt4/src/tqmoc/tqmoc.y | 3636 | ||||
-rw-r--r-- | tqtinterface/qt4/src/tqmoc/tqmoc_lex.cpp | 3319 | ||||
-rw-r--r-- | tqtinterface/qt4/src/tqmoc/tqmoc_yacc.cpp | 6463 | ||||
-rw-r--r-- | tqtinterface/qt4/src/tqmoc/tqmoc_yacc.h | 185 |
7 files changed, 0 insertions, 14190 deletions
diff --git a/tqtinterface/qt4/src/tqmoc/README b/tqtinterface/qt4/src/tqmoc/README deleted file mode 100644 index cf07c8a..0000000 --- a/tqtinterface/qt4/src/tqmoc/README +++ /dev/null @@ -1,24 +0,0 @@ -This directory contains the source code for the Qt Meta Object -Compiler (tqmoc). - -The files tqmoc_yacc.cpp, tqmoc_yacc.h and tqmoc_lex.cpp are generated by -lex and yacc from tqmoc.l and tqmoc.y. - -To compile the tqmoc program from scratch, you need lex and yacc. These -tools are preinstalled on most Unix systems, often as symbolic links -to flex and byacc or bison. - -If you run Windows, you can install the Cygwin32 package available at -ftp://ftp.cygnus.com/pub/gnu-win32/win32. - -yacc -d tqmoc.y -mv y.tab.c tqmoc_yacc.cpp -mv y.tab.h tqmoc_yacc.h - - - - - - -lex -o tqmoc_lex.cpp tqmoc.l -yacc -d -o tqmoc_yacc.cpp tqmoc.y diff --git a/tqtinterface/qt4/src/tqmoc/tqmoc.l b/tqtinterface/qt4/src/tqmoc/tqmoc.l deleted file mode 100644 index d26951a..0000000 --- a/tqtinterface/qt4/src/tqmoc/tqmoc.l +++ /dev/null @@ -1,498 +0,0 @@ -/**************************************************************************** -** -** Lexical analyzer for meta object compiler -** -** Created : 930417 -** -** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. -** -** This file is part of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at [email protected]. -** -** This file may be used under the terms of the TQ Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -*****************************************************************************/ - -%{ -#ifdef TQMOC_YACC_CODE - -#ifdef TQMOC_MWERKS_PLUGIN -#ifdef TQ_OS_MAC9 -# define isascii(c) ((int)( (unsigned int) (c) <= (unsigned char)0x7F )) -#endif -const char *buf_buffer = NULL; -long buf_size_total = 0, buf_index = 0; -#define YY_INPUT(buf, result, max_size) \ - { \ - if(buf_index < buf_size_total ) { \ - while(!isascii(buf_buffer[buf_index])) buf_index++; \ - int ms = ((max_size < buf_size_total) ? max_size : buf_size_total); \ - for(result = 0; result < ms; result++) { \ - char c = buf_buffer[buf_index + result]; \ - if(!isascii(c)) { \ - buf_index++; \ - break; \ - } \ - buf[result] = c == '\r' ? '\n' : c; \ - } \ - buf_index += result; \ - } else result = YY_NULL; \ - } -#endif - -#include "tqstring.h" - - -#define input yyinput // yyinput in C++ - -#define X if(lexDebug){fprintf(stderr,"LEX (%i) : %s\n",lineNo,yytext);}; -#define Y if(lexDebug){fprintf(stderr,"LEX (%i) : %s\n",lineNo,yytext);}; -/* -#define Y if(lexDebug){fprintf(stderr,"LEX (%i) : %s updates level to %i\n"\ - ,lineNo,yytext,templLevel);}; -*/ -#define Z if(lexDebug){fprintf(stderr,"LEX (%i) : skipped the string %s\"\n"\ - ,lineNo,yytext);}; -#define BEGIN_INSIDE - - -#define linput() \ - ( (c = input()) == '\n' ? (lineNo++, c) : (c == EOF) ? 0 : c ) - -#include <string.h> -#include <stdlib.h> - -int classPLevel = 1; /* Depth of nested curly braces in IN_CLASS */ -int namespacePLevel = 1; /* Depth of nested curly braces in IN_NAMESPACE */ -int expLevel = 1; /* Depth of nested parentheses in IN_EXPR */ -int enumLevel = 1; /* Depth of nested parentheses in IN_ENUM */ -int fctLevel = 1; /* Depth of nested parentheses in IN_FCT */ -int templLevel = 1; /* Depth of levels in IN_TEMPL_ARGS */ - -int lastState = 0; /* Remembers the state when a - TQMOC_SKIP_BEGIN is encountered */ -int skipLevel = 0; /* Depth of TQMOC_SKIP_BEGINs */ - -class TQString; - -extern void addExpressionChar( const char ); -extern void addExpressionString( const char * ); -extern void tqmoc_warn( const char *msg ); -%} - -%start OUTSIDE TQT_DEF IN_CLASS IN_NAMESPACE IN_ENUM IN_EXPR IN_DEF_ARG IN_FCT IN_TEMPL_ARGS GIMME_SEMICOLON SKIP IN_PROPERTY IN_CLASSINFO - -ALMOSTSTRING \"([^"\n\\]|\\(.|\n))* -STRING {ALMOSTSTRING}\" - -%% - -<OUTSIDE>"class" { X; - BEGIN TQT_DEF; - return CLASS; } -<OUTSIDE>"namespace" { X; - BEGIN TQT_DEF; - return NAMESPACE; } -<OUTSIDE>"using" { X; - BEGIN TQT_DEF; - return USING; } -<OUTSIDE>"template" { X; - BEGIN TQT_DEF; - return TEMPLATE; } -<TQT_DEF>"TQ_OBJECT" { X; return TQ_OBJECT; } -<TQT_DEF>"tqsignals" { X; return SIGNALS; } -<TQT_DEF>"tqslots" { X; return SLOTS; } -<TQT_DEF>"TQ_CLASSINFO" { X; return TQ_CLASSINFO; } -<TQT_DEF>"Q_PROPERTY" { X; return Q_PROPERTY; } -<TQT_DEF>"TQ_OVERRIDE" { X; return TQ_OVERRIDE; } -<TQT_DEF>"TQ_ENUMS" { X; return TQ_ENUMS; } -<TQT_DEF>"TQ_SETS" { X; return TQ_SETS; } - -<IN_FCT>"{" { fctLevel++;Y; } -<IN_FCT>"}" { fctLevel--;Y;if (fctLevel==0){X;return '}';}} -<IN_CLASS>"{" { classPLevel++;Y; } -<IN_CLASS>"}" { classPLevel--;Y;if (classPLevel == 0) - {X;return '}';} } -<IN_CLASS>"public" { X;if( classPLevel == 1 ) return PUBLIC; } -<IN_CLASS>"protected" { X;if( classPLevel == 1 ) return PROTECTED; } -<IN_CLASS>"private" { X;if( classPLevel == 1 ) return PRIVATE; } -<IN_CLASS>"tqsignals" { X;if( classPLevel == 1 ) return SIGNALS; } -<IN_CLASS>"tqslots" { X;if( classPLevel == 1 ) return SLOTS; } -<IN_CLASS>"TQ_CLASSINFO" { X;if( classPLevel == 1 ) return TQ_CLASSINFO; } -<IN_CLASS>"TQ_OBJECT" { X; - if ( classPLevel == 1 ) - return TQ_OBJECT; - else if ( classPLevel > 1 ) - tqmoc_warn( "Cannot use TQ_OBJECT in nested class." ); - } -<IN_CLASS>"Q_PROPERTY" { X;if( classPLevel == 1 ) return Q_PROPERTY; } -<IN_CLASS>"TQ_OVERRIDE" { X;if( classPLevel == 1 ) return TQ_OVERRIDE; } -<IN_CLASS>"TQ_ENUMS" { X;if( classPLevel == 1 ) return TQ_ENUMS; } -<IN_CLASS>"TQ_SETS" { X;if( classPLevel == 1 ) return TQ_SETS; } - -<IN_NAMESPACE>"{" { namespacePLevel++;Y; } -<IN_NAMESPACE>"}" { namespacePLevel--;Y;if (namespacePLevel == 0) - {X;return '}';}} -<IN_NAMESPACE>"class" { X; - BEGIN TQT_DEF; - return CLASS; } -<IN_NAMESPACE>"template" { X; - BEGIN TQT_DEF; - return TEMPLATE; } -<IN_NAMESPACE>"namespace" { X; - BEGIN TQT_DEF; - return NAMESPACE; } -<IN_NAMESPACE>"using" { X; - BEGIN TQT_DEF; - return USING; } - -<IN_PROPERTY>"(" { X; return '('; } -<IN_PROPERTY>")" { X; return ')'; } -<IN_PROPERTY>"READ" { X; return READ; } -<IN_PROPERTY>"WRITE" { X; return WRITE; } -<IN_PROPERTY>"STORED" { X; return STORED; } -<IN_PROPERTY>"RESET" { X; return RESET; } -<IN_PROPERTY>"DESIGNABLE" { X; return DESIGNABLE; } -<IN_PROPERTY>"SCRIPTABLE" { X; return SCRIPTABLE; } - - -<IN_EXPR>"(" { expLevel++;X; } -<IN_EXPR>")" { expLevel--;Y;if (expLevel == 0) - { X; BEGIN TQT_DEF; return ')';} } -<IN_EXPR>"[" { expLevel++;X; } -<IN_EXPR>"]" { expLevel--;X;if (expLevel == 0) - { X; BEGIN TQT_DEF; return ']';} } -<IN_EXPR>"," { if (expLevel == 0) - { X; BEGIN TQT_DEF; return ',' ;} } -<IN_EXPR>";" { if (expLevel == 0) - { X; BEGIN TQT_DEF; return ';' ;} } -<IN_DEF_ARG>"(" { expLevel++;X; } -<IN_DEF_ARG>")" { expLevel--;Y;if (expLevel == 0) - { X; BEGIN TQT_DEF; return ')';} } -<IN_DEF_ARG>"[" { expLevel++;X; } -<IN_DEF_ARG>"]" { expLevel--;X;if (expLevel == 0) - { X; BEGIN TQT_DEF; return ']';} } -<IN_DEF_ARG>"," { if (expLevel <= 1) - { X; BEGIN TQT_DEF; return ',' ;} } -<IN_DEF_ARG>";" { if (expLevel == 0) - { X; BEGIN TQT_DEF; return ';' ;} } -<IN_ENUM>"(" { enumLevel++;X; } -<IN_ENUM>")" { enumLevel--;X; } -<IN_ENUM>"[" { enumLevel++;X; } -<IN_ENUM>"]" { enumLevel--;X } -<IN_ENUM>"," { if (enumLevel == 0) - { X; BEGIN TQT_DEF; return ',' ;} } -<IN_ENUM>";" { if (enumLevel == 0) - { X; BEGIN TQT_DEF; return ';' ;} } -<IN_ENUM>"}" { if (enumLevel == 0) - { X; BEGIN TQT_DEF; return '}' ;} } -<IN_TEMPL_ARGS>[[(<] { templLevel++; - Y; - addExpressionChar( yytext[0] ); - } -<IN_TEMPL_ARGS>[])>] { templLevel--; - Y; - if ( templLevel == 0 ) { - X; - BEGIN TQT_DEF; - return yytext[0]; - } else { - addExpressionChar( yytext[0] ); - } - } -<TQT_DEF>"friend" { X;return FRIEND; } -<TQT_DEF>"typedef" { X;return TYPEDEF; } -<TQT_DEF>"auto" { X;return AUTO; } -<TQT_DEF>"register" { X;return REGISTER; } -<TQT_DEF>"static" { X;return STATIC; } -<TQT_DEF>"extern" { X;return EXTERN; } -<TQT_DEF>"inline" { X;return INLINE; } -<TQT_DEF>"__inline__" { X;return INLINE; } -<TQT_DEF>"virtual" { X;return VIRTUAL; } -<TQT_DEF>"const" { X;return CONST; } -<TQT_DEF>"volatile" { X;return VOLATILE; } -<TQT_DEF>"char" { X;return CHAR; } -<TQT_DEF>"short" { X;return SHORT; } -<TQT_DEF>"int" { X;return INT; } -<TQT_DEF>"long" { X;return LONG; } -<TQT_DEF>"signed" { X;return SIGNED; } -<TQT_DEF>"unsigned" { X;return UNSIGNED; } -<TQT_DEF>"float" { X;return FLOAT; } -<TQT_DEF>"double" { X;return DOUBLE; } -<TQT_DEF>"void" { X;return VOID; } -<TQT_DEF>"enum" { X;return ENUM; } -<TQT_DEF>"class" { X;return CLASS; } -<TQT_DEF>"struct" { X;return STRUCT; } -<TQT_DEF>"union" { X;return UNION; } -<TQT_DEF>"asm" { X;return ASM; } -<TQT_DEF>"private" { X;return PRIVATE; } -<TQT_DEF>"protected" { X;return PROTECTED; } -<TQT_DEF>"public" { X;return PUBLIC; } -<TQT_DEF>"operator" { X;return OPERATOR; } -<TQT_DEF>"::" { X;return DBL_COLON; } -<TQT_DEF>"..." { X;return TRIPLE_DOT; } -<TQT_DEF>"template" { X;return TEMPLATE; } -<TQT_DEF>"mutable" { X;return MUTABLE; } -<TQT_DEF>"throw" { X;return THROW; } -<TQT_DEF>"using" { X;return USING; } -<TQT_DEF>"namespace" { X;return NAMESPACE; } - -<TQT_DEF>[_a-zA-Z][_a-zA-Z0-9]* { - X; - yylval.string = qstrdup(yytext); - return IDENTIFIER; - } - -<IN_PROPERTY>[_a-zA-Z][_a-zA-Z0-9]* { - X; - yylval.string = qstrdup(yytext); - return IDENTIFIER; - } - -<IN_CLASSINFO>"(" { X; return '('; } -<IN_CLASSINFO>")" { X; return ')'; } -<IN_CLASSINFO>"," { X; return ','; } - -<IN_CLASSINFO>{ALMOSTSTRING} { - X; - yylval.string = qstrdup( yytext + 1 ); - input(); /* discard the '"' */ - return STRING; - } - -<OUTSIDE>[_a-zA-Z][_a-zA-Z0-9]* ; -<IN_CLASS>[_a-zA-Z][_a-zA-Z0-9]* ; -<IN_NAMESPACE>[_a-zA-Z][_a-zA-Z0-9]* ; - -<OUTSIDE>{STRING} { /* discard strings */ - Z; - } - -<IN_CLASS>{STRING} { /* discard strings */ - Z; - } - -<IN_NAMESPACE>{STRING} { /* discard strings */ - Z; - } - -<IN_FCT>{ALMOSTSTRING} { /* discard strings */ - Z; - addExpressionString( yytext ); - input(); /* discard the '"' */ - } - - -<IN_TEMPL_ARGS>{ALMOSTSTRING} { - X; - addExpressionString( yytext ); - input(); /* discard the '"' */ - return STRING; - } - -<TQT_DEF>{ALMOSTSTRING} { - X; - yylval.string = qstrdup( yytext + 1 ); - input(); /* discard the '"' */ - return STRING; - } - -<TQT_DEF>'.' { X; - yylval.char_val = yytext[1]; - return CHAR_VAL; - } - -<TQT_DEF>'\\a' { X; - yylval.char_val = '\a'; - return CHAR_VAL; - } - -<TQT_DEF>'\\b' { X; - yylval.char_val = '\b'; - return CHAR_VAL; - } - -<TQT_DEF>'\\f' { X; - yylval.char_val = '\f'; - return CHAR_VAL; - } - -<TQT_DEF>'\\n' { X; - yylval.char_val = '\n'; - return CHAR_VAL; - } - -<TQT_DEF>'\\r' { X; - yylval.char_val = '\r'; - return CHAR_VAL; - } - -<TQT_DEF>'\\t' { X; - yylval.char_val = '\t'; - return CHAR_VAL; - } - -<TQT_DEF>'\\v' { X; - yylval.char_val = '\v'; - return CHAR_VAL; - } - -<TQT_DEF>'\\\\' { X; - yylval.char_val = '\\'; - return CHAR_VAL; - } - -<TQT_DEF>'\\?' { X; - yylval.char_val = '\?'; - return CHAR_VAL; - } - -<TQT_DEF>'\\'' { X; - yylval.char_val = '\''; - return CHAR_VAL; - } - -<TQT_DEF>'\\\"' { X; - yylval.char_val = '\"'; /* " */ - return CHAR_VAL; - } - -<TQT_DEF>'\\0' { X; - yylval.char_val = '\0'; - return CHAR_VAL; - } - -<TQT_DEF>'\\[0-7]+' { X; - yylval.char_val = - (char)strtol( &yytext[1], 0, 8 ); - return CHAR_VAL; - } - -<TQT_DEF>'\\x[0-9a-fA-F]+' { X; - yylval.char_val = - (char)strtol( &yytext[2], 0, 16 ); - return CHAR_VAL; - } - -<TQT_DEF>'\\.' { X; - yylval.char_val = ' '; - return CHAR_VAL; - } - -<TQT_DEF>[0-9]+ { X; - yylval.int_val = atoi(yytext); - return INT_VAL; - } - -<TQT_DEF>[0-9]+\.[0-9]* { X; - yylval.double_val = atof(yytext); - return DOUBLE_VAL; - } - -<TQT_DEF>\.[0-9]+ { X; - yylval.double_val = atof(yytext); - return DOUBLE_VAL; - } - - -^#define.*\\$ { /* skip multi-line macro-definitions */ - int c, c1; - input(); /* Discard the '\n'. */ - do { - c1=' '; - while((c = linput()) != '\n' && c != 0) c1=c; - if (c == 0) break; - } while(c1=='\\'); - unput(c); /* put back the '\n' or the EOF */ - } - -^[ \t]*#.* { /* preprocessor commands are skipped */} -"//"[^\n]* { /* C++ comment */ - TQCString s = yytext; - if ( s.contains( "TQMOC_SKIP_BEGIN" ) ) { - skipLevel++; - if ( skipLevel == 1 ) { - lastState = YYSTATE; - BEGIN SKIP; - } - } else - if ( s.contains( "TQMOC_SKIP_END" ) ) { - if ( skipLevel == 0 ) { - tqmoc_warn(" TQMOC_SKIP_END without TQMOC_SKIP_BEGIN"); - } else { - skipLevel--; - if ( skipLevel == 0 ) { - BEGIN lastState; - } - } - } - } -"/*" { /* C comment */ - int c = ' '; - do { - if ( c!= '*' ) { - while((c = linput()) != '*' && c != 0) - ; - } - if (c == 0) break; - } while(((c = linput())) != '/' && c != 0); - if (c == 0) - unput(c); - } - -<IN_TEMPL_ARGS>. { addExpressionChar( yytext[0] ); } - -<IN_TEMPL_ARGS>[ \t\r\b\f]+ { - /* spaces are important in template args, - e.g. Foo<const int> */ - addExpressionChar( yytext[0] ); } -[ \t\r\b\f]+ ; -<IN_CLASS>. ; -<IN_NAMESPACE>. ; -<IN_FCT>. ; -<IN_EXPR>. { addExpressionChar( yytext[0] ); } -<IN_DEF_ARG>. ; -<IN_ENUM>. { addExpressionChar( yytext[0] ); } -<OUTSIDE>. ; -<SKIP>. ; -<TQT_DEF>. { - X; - return yytext[0]; - } -<GIMME_SEMICOLON>. { - X; - return ';'; - } -\n { - lineNo++; - } - - -%% - -#endif // TQMOC_YACC_CODE diff --git a/tqtinterface/qt4/src/tqmoc/tqmoc.pro b/tqtinterface/qt4/src/tqmoc/tqmoc.pro deleted file mode 100644 index b4762db..0000000 --- a/tqtinterface/qt4/src/tqmoc/tqmoc.pro +++ /dev/null @@ -1,65 +0,0 @@ -TEMPLATE = app -TARGET = tqmoc - -CONFIG = console release qtinc yacc lex_included yacc_no_name_mangle -DEFINES += TQT_TQMOC TQT_NO_CODECS TQT_LITE_UNICODE TQT_NO_COMPONENT \ - TQT_NO_STL TQT_NO_COMPRESS -win32:DEFINES += TQT_NODLL -DESTDIR = ../../bin - - -INCLUDEPATH += $$TQT_SOURCE_TREE/include ../tools . -DEPENDPATH += $$TQT_SOURCE_TREE/include ../tools . -LIBS = -OBJECTS_DIR = . -SOURCES = ../tools/tqbuffer.cpp \ - ../tools/tqptrcollection.cpp \ - ../tools/tqcstring.cpp \ - ../tools/tqdatastream.cpp \ - ../tools/tqdatetime.cpp \ - ../tools/tqfile.cpp \ - ../tools/tqdir.cpp \ - ../tools/tqfileinfo.cpp \ - ../tools/tqgarray.cpp \ - ../tools/tqgdict.cpp \ - ../tools/tqglist.cpp \ - ../tools/tqglobal.cpp \ - ../tools/tqgvector.cpp \ - ../tools/tqiodevice.cpp \ - ../tools/tqregexp.cpp \ - ../tools/tqstring.cpp \ - ../tools/tqlocale.cpp \ - ../tools/tqunicodetables.cpp \ - ../tools/tqstringlist.cpp \ - ../tools/tqtextstream.cpp \ - ../tools/tqbitarray.cpp \ - ../tools/tqmap.cpp \ - ../tools/tqgcache.cpp \ - ../codecs/tqtextcodec.cpp \ - ../codecs/tqutfcodec.cpp - -isEmpty(TQT_PRODUCT)|contains(TQT_PRODUCT, qt-internal) { - LEXSOURCES = tqmoc.l - YACCSOURCES = tqmoc.y -} else { - SOURCES += tqmoc_yacc.cpp -} - -unix:SOURCES += ../tools/tqfile_unix.cpp ../tools/tqdir_unix.cpp ../tools/tqfileinfo_unix.cpp -win32:SOURCES += ../tools/tqfile_win.cpp ../tools/tqdir_win.cpp ../tools/tqfileinfo_win.cpp -macx:LIBS += -framework Carbon - -target.path=$$bins.path -INSTALLS += target - -*-mwerks { - TEMPLATE = lib - TARGET = McMoc - CONFIG -= static - CONFIG += shared plugin - DEFINES += TQMOC_MWERKS_PLUGIN - MWERKSDIR = $TQT_SOURCE_TREE/util/mwerks_plugin - INCLUDEPATH += $$MWERKSDIR/Headers - LIBS += $$MWERKSDIR/Libraries/PluginLib4.shlb - SOURCES += mwerks_mac.cpp -} diff --git a/tqtinterface/qt4/src/tqmoc/tqmoc.y b/tqtinterface/qt4/src/tqmoc/tqmoc.y deleted file mode 100644 index 927ec47..0000000 --- a/tqtinterface/qt4/src/tqmoc/tqmoc.y +++ /dev/null @@ -1,3636 +0,0 @@ -/**************************************************************************** -** -** Parser and code generator for meta object compiler -** -** Created : 930417 -** -** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. -** -** This file is part of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at [email protected]. -** -** This file may be used under the terms of the TQ Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -** -------------------------------------------------------------------------- -** -** This compiler reads a C++ header file with class definitions and ouputs -** C++ code to build a meta class. The meta data includes public methods -** (not constructors, destructors or operator functions), tqsignals and slot -** definitions. The output file should be compiled and linked into the -** target application. -** -** C++ header files are assumed to have correct syntax, and we are therefore -** doing less strict checking than C++ compilers. -** -** The C++ grammar has been adopted from the "The Annotated C++ Reference -** Manual" (ARM), by Ellis and Stroustrup (Addison Wesley, 1992). -** -** Notice that this code is not possible to compile with GNU bison, instead -** use standard AT&T yacc or Berkeley yacc. -*****************************************************************************/ - -%{ -#define TQMOC_YACC_CODE -void yyerror( const char *msg ); - -#include "tqplatformdefs.h" -#include "tqasciidict.h" -#include "tqdatetime.h" -#include "tqdict.h" -#include "tqfile.h" -#include "tqdir.h" -#include "tqptrlist.h" -#include "tqregexp.h" -#include "tqstrlist.h" -#ifdef TQMOC_MWERKS_PLUGIN -# ifdef TQ_OS_MACX -# undef OLD_DEBUG -# ifdef DEBUG -# define OLD_DEBUG DEBUG -# undef DEBUG -# endif -# define DEBUG 0 -# ifndef __IMAGECAPTURE__ -# define __IMAGECAPTURE__ -# endif -# include <Carbon/Carbon.h> -# endif -# include "mwerks_mac.h" -#endif - -#include <ctype.h> -#include <stdio.h> -#include <stdlib.h> - -#if defined CONST -#undef CONST -#endif -#if defined VOID -#undef VOID -#endif - -bool isEnumType( const char* type ); -int enumIndex( const char* type ); -bool isVariantType( const char* type ); -int qvariant_nameToType( const char* name ); -static void init(); // initialize -static void initClass(); // prepare for new class -static void generateClass(); // generate C++ code for class -static void initExpression(); // prepare for new expression -static void enterNameSpace( const char *name = 0 ); -static void leaveNameSpace(); -static void selectOutsideClassState(); -static void registerClassInNamespace(); -static bool suppress_func_warn = FALSE; -static void func_warn( const char *msg ); -static void tqmoc_warn( const char *msg ); -static void tqmoc_err( const char *s ); -static void tqmoc_err( const char *s1, const char *s2 ); -static void operatorError(); -static void checkPropertyName( const char* ident ); - -static const char* const utype_map[] = -{ - "bool", - "int", - "double", - "TQString", - "TQVariant", - 0 -}; - -inline bool isIdentChar( char x ) -{ // Avoid bug in isalnum - return x == '_' || (x >= '0' && x <= '9') || - (x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z'); -} - -bool validUType( TQCString ctype ) -{ - if ( ctype.left(6) == "const " ) - ctype = ctype.mid( 6, ctype.length() - 6 ); - if ( ctype.right(1) == "&" ) - ctype = ctype.left( ctype.length() - 1 ); - else if ( ctype.right(1) == "*" ) - return TRUE; - - int i = -1; - while ( utype_map[++i] ) - if ( ctype == utype_map[i] ) - return TRUE; - - return isEnumType( ctype ); -} - -TQCString castToUType( TQCString ctype ) -{ - if ( ctype.right(1) == "&" ) - ctype = ctype.left( ctype.length() - 1 ); - if( ctype.right(1) == "]") { - int lb = ctype.findRev('['); - if(lb != -1) - ctype = ctype.left(lb) + "*"; - } - return ctype; -} - -TQCString rawUType( TQCString ctype ) -{ - ctype = castToUType( ctype ); - if ( ctype.left(6) == "const " ) - ctype = ctype.mid( 6, ctype.length() - 6 ); - return ctype; -} - -TQCString uType( TQCString ctype ) -{ - if ( !validUType( ctype ) ) { - if ( isVariantType( rawUType(ctype) ) ) - return "varptr"; - else - return "ptr"; - } - if ( ctype.left(6) == "const " ) - ctype = ctype.mid( 6, ctype.length() - 6 ); - if ( ctype.right(1) == "&" ) { - ctype = ctype.left( ctype.length() - 1 ); - } else if ( ctype.right(1) == "*" ) { - TQCString raw = ctype.left( ctype.length() - 1 ); - ctype = "ptr"; - if ( raw == "char" ) - ctype = "charstar"; - else if ( raw == "TQUnknownInterface" ) - ctype = "iface"; - else if ( raw == "TQDispatchInterface" ) - ctype = "idisp"; - else if ( isVariantType( raw ) ) - ctype = "varptr"; - } - if ( isEnumType( ctype ) ) - ctype = "enum"; - return ctype; -} - -bool isInOut( TQCString ctype ) -{ - if ( ctype.left(6) == "const " ) - return FALSE; - if ( ctype.right(1) == "&" ) - return TRUE; - if ( ctype.right(2) == "**" ) - return TRUE; - return FALSE; -} - -TQCString uTypeExtra( TQCString ctype ) -{ - TQCString typeExtra = "0"; - if ( !validUType( ctype ) ) { - if ( isVariantType( rawUType(ctype) ) ) - typeExtra.sprintf("\"\\x%02x\"", qvariant_nameToType( rawUType(ctype) ) ); - else - typeExtra.sprintf( "\"%s\"", rawUType(ctype).data() ); - return typeExtra; - } - if ( ctype.left(6) == "const " ) - ctype = ctype.mid( 6, ctype.length() - 6 ); - if ( ctype.right(1) == "&" ) - ctype = ctype.left( ctype.length() - 1 ); - if ( ctype.right(1) == "*" ) { - TQCString raw = ctype.left( ctype.length() - 1 ); - ctype = "ptr"; - if ( raw == "char" ) - ; - else if ( isVariantType( raw ) ) - typeExtra.sprintf("\"\\x%02x\"", qvariant_nameToType( raw ) ); - else - typeExtra.sprintf( "\"%s\"", raw.stripWhiteSpace().data() ); - - } else if ( isEnumType( ctype ) ) { - int idx = enumIndex( ctype ); - if ( idx >= 0 ) { - typeExtra.sprintf( "&enum_tbl[%d]", enumIndex( ctype ) ); - } else { - typeExtra.sprintf( "parentObject->enumerator(\"%s\", TRUE )", ctype.data() ); - } - typeExtra = - "\n#ifndef TQT_NO_PROPERTIES\n\t " + typeExtra + - "\n#else" - "\n\t 0" - "\n#endif // TQT_NO_PROPERTIES\n\t "; - } - return typeExtra; -} - -/* - Attention! - This table is copied from qvariant.cpp. If you change - one, change both. -*/ -static const int ntypes = 35; -static const char* const type_map[ntypes] = -{ - 0, - "TQMap<TQString,TQVariant>", - "TQValueList<TQVariant>", - "TQString", - "TQStringList", - "TQFont", - "TQPixmap", - "TQBrush", - "TQRect", - "TQSize", - "TQColor", - "TQPalette", - "TQColorGroup", - "TQIconSet", - "TQPoint", - "TQImage", - "int", - "uint", - "bool", - "double", - "TQCString", - "TQPointArray", - "TQRegion", - "TQBitmap", - "TQCursor", - "TQSizePolicy", - "TQDate", - "TQTime", - "TQDateTime", - "TQByteArray", - "TQBitArray", - "TQKeySequence", - "TQPen", - "TQ_LLONG", - "TQ_ULLONG" -}; - -int qvariant_nameToType( const char* name ) -{ - for ( int i = 0; i < ntypes; i++ ) { - if ( !qstrcmp( type_map[i], name ) ) - return i; - } - return 0; -} - -/* - Returns TRUE if the type is a TQVariant types. -*/ -bool isVariantType( const char* type ) -{ - return qvariant_nameToType( type ) != 0; -} - -/* - Replaces '>>' with '> >' (as in 'TQValueList<TQValueList<double> >'). - This function must be called to produce valid C++ code. However, - the string representation still uses '>>'. -*/ -void fixRightAngles( TQCString *str ) -{ - str->replace( TQRegExp(">>"), "> >" ); -} - -static TQCString rmWS( const char * ); - -enum Access { Private, Protected, Public }; - - -class Argument // single arg meta data -{ -public: - Argument( const char *left, const char *right, const char* argName = 0, bool isDefaultArgument = FALSE ) - { - leftType = rmWS( left ); - rightType = rmWS( right ); - if ( leftType == "void" && rightType.isEmpty() ) - leftType = ""; - - int len = leftType.length(); - - /* - Convert 'char const *' into 'const char *'. Start at index 1, - not 0, because 'const char *' is already OK. - */ - for ( int i = 1; i < len; i++ ) { - if ( leftType[i] == 'c' && - strncmp(leftType.data() + i + 1, "onst", 4) == 0 - && (i + 5 >= len || !isIdentChar(leftType[i + 5])) - && !isIdentChar(i-1) - ) { - leftType.remove( i, 5 ); - if ( leftType[i - 1] == ' ' ) - leftType.remove( i - 1, 1 ); - leftType.prepend( "const " ); - break; - } - - /* - We musn't convert 'char * const *' into 'const char **' - and we must beware of 'Bar<const Bla>'. - */ - if ( leftType[i] == '&' || leftType[i] == '*' || - leftType[i] == '<' ) - break; - } - - name = argName; - isDefault = isDefaultArgument; - } - - TQCString leftType; - TQCString rightType; - TQCString name; - bool isDefault; -}; - -class ArgList : public TQPtrList<Argument> { // member function arg list -public: - ArgList() { setAutoDelete( TRUE ); } - ~ArgList() { clear(); } - - /* the clone has one default argument less, the orignal has all default arguments removed */ - ArgList* magicClone() { - ArgList* l = new ArgList; - bool firstDefault = FALSE; - for ( first(); current(); next() ) { - bool isDefault = current()->isDefault; - if ( !firstDefault && isDefault ) { - isDefault = FALSE; - firstDefault = TRUE; - } - l->append( new Argument( current()->leftType, current()->rightType, current()->name, isDefault ) ); - } - for ( first(); current(); ) { - if ( current()->isDefault ) - remove(); - else - next(); - } - return l; - } - - bool hasDefaultArguments() { - for ( Argument* a = first(); a; a = next() ) { - if ( a->isDefault ) - return TRUE; - } - return FALSE; - } - -}; - - -struct Function // member function meta data -{ - Access access; - TQCString qualifier; // const or volatile - TQCString name; - TQCString type; - TQCString signature; - int lineNo; - ArgList *args; - Function() { args=0;} - ~Function() { delete args; } - const char* accessAsString() { - switch ( access ) { - case Private: return "Private"; - case Protected: return "Protected"; - default: return "Public"; - } - } -}; - -class FuncList : public TQPtrList<Function> { // list of member functions -public: - FuncList( bool autoDelete = FALSE ) { setAutoDelete( autoDelete ); } - - FuncList find( const char* name ) - { - FuncList result; - for ( TQPtrListIterator<Function> it(*this); it.current(); ++it ) { - if ( it.current()->name == name ) - result.append( it.current() ); - } - return result; - } -}; - -class Enum : public TQStrList -{ -public: - TQCString name; - bool set; -}; - -class EnumList : public TQPtrList<Enum> { // list of property enums -public: - EnumList() { setAutoDelete(TRUE); } -}; - - -struct Property -{ - Property( int l, const char* t, const char* n, const char* s, const char* g, const char* r, - const TQCString& st, const TQCString& d, const TQCString& sc, bool ov ) - : lineNo(l), type(t), name(n), set(s), get(g), reset(r), setfunc(0), getfunc(0), - sspec(Unspecified), gspec(Unspecified), stored( st ), - designable( d ), scriptable( sc ), override( ov ), oredEnum( -1 ) - { - /* - The Q_PROPERTY construct cannot contain any commas, since - commas separate macro arguments. We therefore expect users - to type "TQMap" instead of "TQMap<TQString, TQVariant>". For - coherence, we also expect the same for - TQValueList<TQVariant>, the other template class supported by - TQVariant. - */ - if ( type == "TQMap" ) { - type = "TQMap<TQString,TQVariant>"; - } else if ( type == "TQValueList" ) { - type = "TQValueList<TQVariant>"; - } else if ( type == "LongLong" ) { - type = "TQ_LLONG"; - } else if ( type == "ULongLong" ) { - type = "TQ_ULLONG"; - } - } - - int lineNo; - TQCString type; - TQCString name; - TQCString set; - TQCString get; - TQCString reset; - TQCString stored; - TQCString designable; - TQCString scriptable; - bool override; - - Function* setfunc; - Function* getfunc; - - int oredEnum; // If the enums item may be ored. That means the data type is int. - // Allowed values are 1 (True), 0 (False), and -1 (Unset) - TQCString enumsettype; // contains the set function type in case of oredEnum - TQCString enumgettype; // contains the get function type in case of oredEnum - - enum Specification { Unspecified, Class, Reference, Pointer, ConstCharStar }; - Specification sspec; - Specification gspec; - - bool stdSet() { - TQCString s = "set"; - s += toupper( name[0] ); - s += name.mid( 1 ); - return s == set; - } - - static const char* specToString( Specification s ) - { - switch ( s ) { - case Class: - return "Class"; - case Reference: - return "Reference"; - case Pointer: - return "Pointer"; - case ConstCharStar: - return "ConstCharStar"; - default: - return "Unspecified"; - } - } -}; - -class PropList : public TQPtrList<Property> { // list of properties -public: - PropList() { setAutoDelete( TRUE ); } -}; - - -struct ClassInfo -{ - ClassInfo( const char* n, const char* v ) - : name(n), value(v) - {} - TQCString name; - TQCString value; -}; - -class ClassInfoList : public TQPtrList<ClassInfo> { // list of class infos -public: - ClassInfoList() { setAutoDelete( TRUE ); } -}; - -class parser_reg { - public: - parser_reg(); - ~parser_reg(); - - // some temporary values - TQCString tmpExpression; // Used to store the characters the lexer - // is currently skipping (see addExpressionChar and friends) - TQCString fileName; // file name - TQCString outputFile; // output file name - TQCString pchFile; // name of PCH file (used on Windows) - TQStrList includeFiles; // name of #include files - TQCString includePath; // #include file path - TQCString qtPath; // #include qt file path - int gen_count; //number of classes generated - bool noInclude; // no #include <filename> - bool generatedCode; // no code generated - bool tqmocError; // tqmoc parsing error occurred - bool hasVariantIncluded; //whether or not qvariant.h was included yet - TQCString className; // name of parsed class - TQCString superClassName; // name of first super class - TQStrList multipleSuperClasses; // other superclasses - FuncList tqsignals; // signal interface - FuncList tqslots; // tqslots interface - FuncList propfuncs; // all possible property access functions - FuncList funcs; // all parsed functions, including tqsignals - EnumList enums; // enums used in properties - PropList props; // list of all properties - ClassInfoList infos; // list of all class infos - -// Used to store the values in the Q_PROPERTY macro - TQCString propWrite; // set function - TQCString propRead; // get function - TQCString propReset; // reset function - TQCString propStored; // - TQCString propDesignable; // "true", "false" or function or empty if not specified - TQCString propScriptable; // "true", "false" or function or empty if not specified - bool propOverride; // Wether OVERRIDE was detected - - TQStrList qtEnums; // Used to store the contents of TQ_ENUMS - TQStrList qtSets; // Used to store the contents of TQ_SETS - -}; - -static parser_reg *g = 0; - -ArgList *addArg( Argument * ); // add arg to tmpArgList - -enum Member { SignalMember, - SlotMember, - PropertyCandidateMember - }; - -void addMember( Member ); // add tmpFunc to current class -void addEnum(); // add tmpEnum to current class - -char *stradd( const char *, const char * ); // add two strings -char *stradd( const char *, const char *, // add three strings - const char * ); -char *stradd( const char *, const char *, // adds 4 strings - const char *, const char * ); - -char *straddSpc( const char *, const char * ); -char *straddSpc( const char *, const char *, - const char * ); -char *straddSpc( const char *, const char *, - const char *, const char * ); - -extern int yydebug; -bool lexDebug = FALSE; -int lineNo; // current line number -bool errorControl = FALSE; // controled errors -bool displayWarnings = TRUE; -bool skipClass; // don't generate for class -bool skipFunc; // don't generate for func -bool templateClass; // class is a template -bool templateClassOld; // previous class is a template - -ArgList *tmpArgList; // current argument list -Function *tmpFunc; // current member function -Enum *tmpEnum; // current enum -Access tmpAccess; // current access permission -Access subClassPerm; // current access permission - -bool TQ_OBJECTdetected; // TRUE if current class - // contains the TQ_OBJECT macro -bool Q_PROPERTYdetected; // TRUE if current class - // contains at least one Q_PROPERTY, - // TQ_OVERRIDE, TQ_SETS or TQ_ENUMS macro -bool tmpPropOverride; // current property override setting - -int tmpYYStart; // Used to store the lexers current mode -int tmpYYStart2; // Used to store the lexers current mode - // (if tmpYYStart is already used) - -// if the format revision changes, you MUST change it in qmetaobject.h too -const int formatRevision = 26; // tqmoc output format revision - -// if the flags change, you HAVE to change it in qmetaobject.h too -enum Flags { - Invalid = 0x00000000, - Readable = 0x00000001, - Writable = 0x00000002, - EnumOrSet = 0x00000004, - UnresolvedEnum = 0x00000008, - StdSet = 0x00000100, - Override = 0x00000200, - NotDesignable = 0x00001000, - DesignableOverride = 0x00002000, - NotScriptable = 0x00004000, - ScriptableOverride = 0x00008000, - NotStored = 0x00010000, - StoredOverride = 0x00020000 -}; - - -#ifdef YYBISON -# if defined(TQ_OS_WIN32) -# include <io.h> -# undef isatty -extern "C" int hack_isatty( int ) - { - return 0; - } -# define isatty hack_isatty -# else -# include <unistd.h> -# endif - -# define YYDEBUG 1 -# include "tqmoc_yacc.h" -# include "tqmoc_lex.cpp" -#endif //YYBISON -%} - - - - -%union { - char char_val; - int int_val; - double double_val; - char *string; - Access access; - Function *function; - ArgList *arg_list; - Argument *arg; -} - -%start declaration_seq - -%token <char_val> CHAR_VAL /* value types */ -%token <int_val> INT_VAL -%token <double_val> DOUBLE_VAL -%token <string> STRING -%token <string> IDENTIFIER /* identifier string */ - -%token FRIEND /* declaration keywords */ -%token TYPEDEF -%token AUTO -%token REGISTER -%token STATIC -%token EXTERN -%token INLINE -%token VIRTUAL -%token CONST -%token VOLATILE -%token CHAR -%token SHORT -%token INT -%token LONG -%token SIGNED -%token UNSIGNED -%token FLOAT -%token DOUBLE -%token VOID -%token ENUM -%token CLASS -%token STRUCT -%token UNION -%token ASM -%token PRIVATE -%token PROTECTED -%token PUBLIC -%token OPERATOR -%token DBL_COLON -%token TRIPLE_DOT -%token TEMPLATE -%token NAMESPACE -%token USING -%token MUTABLE -%token THROW - -%token SIGNALS -%token SLOTS -%token TQ_OBJECT -%token Q_PROPERTY -%token TQ_OVERRIDE -%token TQ_CLASSINFO -%token TQ_ENUMS -%token TQ_SETS - -%token READ -%token WRITE -%token STORED -%token DESIGNABLE -%token SCRIPTABLE -%token RESET - -%type <string> class_name -%type <string> template_class_name -%type <string> template_spec -%type <string> opt_base_spec - -%type <string> base_spec -%type <string> base_list -%type <string> qt_macro_name -%type <string> base_specifier -%type <access> access_specifier -%type <string> fct_name -%type <string> type_name -%type <string> simple_type_names -%type <string> simple_type_name -%type <string> class_key -%type <string> complete_class_name -%type <string> qualified_class_name -%type <string> elaborated_type_specifier -%type <string> whatever - -%type <arg_list> argument_declaration_list -%type <arg_list> arg_declaration_list -%type <arg_list> arg_declaration_list_opt -%type <string> abstract_decl_opt -%type <string> abstract_decl -%type <arg> argument_declaration -%type <arg> opt_exception_argument -%type <string> cv_qualifier_list_opt -%type <string> cv_qualifier_list -%type <string> cv_qualifier -%type <string> decl_specifiers -%type <string> decl_specifier -%type <string> decl_specs_opt -%type <string> decl_specs -%type <string> type_specifier -%type <string> fct_specifier -%type <string> declarator -%type <string> ptr_operator -%type <string> ptr_operators -%type <string> ptr_operators_opt - -%type <string> dname - -%% -declaration_seq: /* empty */ - | declaration_seq declaration - ; - -declaration: class_def -/* | template_declaration */ - | namespace_def - | namespace_alias_def - | using_declaration - | using_directive - ; - -namespace_def: named_namespace_def - | unnamed_namespace_def - ; - -named_namespace_def: NAMESPACE - IDENTIFIER { enterNameSpace($2); } - '{' { BEGIN IN_NAMESPACE; } - namespace_body - '}' { leaveNameSpace(); - selectOutsideClassState(); - } - ; - -unnamed_namespace_def: NAMESPACE { enterNameSpace(); } - '{' { BEGIN IN_NAMESPACE; } - namespace_body - '}' { leaveNameSpace(); - selectOutsideClassState(); - } - ; - -namespace_body: declaration_seq - ; - -namespace_alias_def: NAMESPACE IDENTIFIER '=' complete_class_name ';' - { selectOutsideClassState(); } - ; - - -using_directive: USING NAMESPACE { selectOutsideClassState(); } /* Skip namespace */ - ; - -using_declaration: USING IDENTIFIER { selectOutsideClassState(); } - | USING DBL_COLON { selectOutsideClassState(); } - ; - -class_def: { initClass(); } - class_specifier ';' { generateClass(); - registerClassInNamespace(); - selectOutsideClassState(); } - ; - - -/***** r.17.1 (ARM p.387 ): Keywords *****/ - -class_name: IDENTIFIER { $$ = $1; } - | template_class_name { $$ = $1; } - ; - -template_class_name: IDENTIFIER '<' template_args '>' - { g->tmpExpression = rmWS( g->tmpExpression ); - $$ = stradd( $1, "<", - g->tmpExpression, ">" ); } - ; - -/* - template_args skips all characters until it encounters a ">" (it - handles and discards sublevels of parentheses). Since the rule is - empty it must be used with care! -*/ - -template_args: /* empty */ { initExpression(); - templLevel = 1; - BEGIN IN_TEMPL_ARGS; } - ; - -/***** r.17.2 (ARM p.388): Expressions *****/ - - -/* const_expression skips all characters until it encounters either one - of "]", ")" or "," (it handles and discards sublevels of parentheses). - Since the rule is empty it must be used with care! -*/ - -const_expression: /* empty */ { initExpression(); - BEGIN IN_EXPR; } - ; - -/* def_argument is just like const expression but handles the "," - slightly differently. It was added for 3.0 as quick solution. TODO: - merge with const_expression. - */ - -def_argument: /* empty */ { BEGIN IN_DEF_ARG; } - ; - -enumerator_expression: /* empty */ { initExpression(); - BEGIN IN_ENUM; } - ; - -/***** r.17.3 (ARM p.391): Declarations *****/ - -decl_specifier: storage_class_specifier { $$ = ""; } - | type_specifier { $$ = $1; } - | fct_specifier { $$ = ""; } - | FRIEND { skipFunc = TRUE; $$ = ""; } - | TYPEDEF { skipFunc = TRUE; $$ = ""; } - ; - -decl_specifiers: decl_specs_opt type_name decl_specs_opt - { $$ = straddSpc($1,$2,$3); } - ; -decl_specs_opt: /* empty */ { $$ = ""; } - | decl_specs { $$ = $1; } - ; - -decl_specs: decl_specifier { $$ = $1; } - | decl_specs decl_specifier { $$ = straddSpc($1,$2); } - ; - -storage_class_specifier: AUTO - | REGISTER - | STATIC { skipFunc = TRUE; } - | EXTERN - ; - -fct_specifier: INLINE { } - | VIRTUAL { } - ; - -type_specifier: CONST { $$ = "const"; } - | VOLATILE { $$ = "volatile"; } - ; - -type_name: elaborated_type_specifier { $$ = $1; } - | complete_class_name { $$ = $1; } - | simple_type_names { $$ = $1; } - ; - -simple_type_names: simple_type_names simple_type_name - { $$ = straddSpc($1,$2); } - | simple_type_name { $$ = $1; } - ; - -simple_type_name: CHAR { $$ = "char"; } - | SHORT { $$ = "short"; } - | INT { $$ = "int"; } - | LONG { $$ = "long"; } - | SIGNED { $$ = "signed"; } - | UNSIGNED { $$ = "unsigned"; } - | FLOAT { $$ = "float"; } - | DOUBLE { $$ = "double"; } - | VOID { $$ = "void"; } - ; - -template_spec: TEMPLATE '<' template_args '>' - { g->tmpExpression = rmWS( g->tmpExpression ); - $$ = stradd( "template<", - g->tmpExpression, ">" ); } - ; - -opt_template_spec: /* empty */ - | template_spec { templateClassOld = templateClass; - templateClass = TRUE; - } - ; - - -class_key: opt_template_spec CLASS { $$ = "class"; } - | opt_template_spec STRUCT { $$ = "struct"; } - ; - -complete_class_name: qualified_class_name { $$ = $1; } - | DBL_COLON qualified_class_name - { $$ = stradd( "::", $2 ); } - ; - -qualified_class_name: qualified_class_name DBL_COLON class_name - { $$ = stradd( $1, "::", $3 );} - | class_name { $$ = $1; } - ; - -elaborated_type_specifier: - class_key IDENTIFIER { $$ = straddSpc($1,$2); } - | ENUM IDENTIFIER { $$ = stradd("enum ",$2); } - | UNION IDENTIFIER { $$ = stradd("union ",$2); } - ; - -/***** r.17.4 (ARM p.393): Declarators *****/ - -argument_declaration_list: arg_declaration_list_opt triple_dot_opt { $$ = $1;} - | arg_declaration_list ',' TRIPLE_DOT { $$ = $1; - func_warn("Ellipsis not supported" - " in tqsignals and tqslots.\n" - "Ellipsis argument ignored."); } - ; - -arg_declaration_list_opt: /* empty */ { $$ = tmpArgList; } - | arg_declaration_list { $$ = $1; } - ; - -opt_exception_argument: /* empty */ { $$ = 0; } - | argument_declaration - ; - -triple_dot_opt: /* empty */ - | TRIPLE_DOT { func_warn("Ellipsis not supported" - " in tqsignals and tqslots.\n" - "Ellipsis argument ignored."); } - - ; - -arg_declaration_list: arg_declaration_list - ',' - argument_declaration { $$ = addArg($3); } - | argument_declaration { $$ = addArg($1); } - ; - -argument_declaration: decl_specifiers abstract_decl_opt - { $$ = new Argument(straddSpc($1,$2),""); } - | decl_specifiers abstract_decl_opt - '=' { expLevel = 1; } - def_argument - { $$ = new Argument(straddSpc($1,$2),"", 0, TRUE ); } - | decl_specifiers abstract_decl_opt dname - abstract_decl_opt - { $$ = new Argument(straddSpc($1,$2),$4, $3); } - | decl_specifiers abstract_decl_opt dname - abstract_decl_opt - '=' { expLevel = 1; } - def_argument - { $$ = new Argument(straddSpc($1,$2),$4, $3, TRUE); } - ; - - -abstract_decl_opt: /* empty */ { $$ = ""; } - | abstract_decl { $$ = $1; } - ; - -abstract_decl: abstract_decl ptr_operator - { $$ = straddSpc($1,$2); } - | '[' { expLevel = 1; } - const_expression ']' - { $$ = stradd( "[", - g->tmpExpression = - g->tmpExpression.stripWhiteSpace(), "]" ); } - | abstract_decl '[' { expLevel = 1; } - const_expression ']' - { $$ = stradd( $1,"[", - g->tmpExpression = - g->tmpExpression.stripWhiteSpace(),"]" ); } - | ptr_operator { $$ = $1; } - | '(' abstract_decl ')' { $$ = $2; } - ; - -declarator: dname { $$ = ""; } - | declarator ptr_operator - { $$ = straddSpc($1,$2);} - | declarator '[' { expLevel = 1; } - const_expression ']' - { $$ = stradd( $1,"[", - g->tmpExpression = - g->tmpExpression.stripWhiteSpace(),"]" ); } - | '(' declarator ')' { $$ = $2; } - ; - -dname: IDENTIFIER - ; - -fct_decl: '(' - argument_declaration_list - ')' - cv_qualifier_list_opt - ctor_initializer_opt - exception_spec_opt - opt_identifier - fct_body_or_semicolon - { tmpFunc->args = $2; - tmpFunc->qualifier = $4; } - ; - -fct_name: IDENTIFIER /* NOTE: simplified! */ - | IDENTIFIER array_decls - { func_warn("Variable as signal or slot."); } - | IDENTIFIER '=' { expLevel=0; } - const_expression /* probably const member */ - { skipFunc = TRUE; } - | IDENTIFIER array_decls '=' { expLevel=0; } - const_expression /* probably const member */ - { skipFunc = TRUE; } - ; - - -array_decls: '[' { expLevel = 1; } - const_expression ']' - | array_decls '[' { expLevel = 1; } - const_expression ']' - - ; - -ptr_operators_opt: /* empty */ { $$ = ""; } - | ptr_operators { $$ = $1; } - ; - -ptr_operators: ptr_operator { $$ = $1; } - | ptr_operators ptr_operator { $$ = straddSpc($1,$2);} - ; - -ptr_operator: '*' cv_qualifier_list_opt { $$ = straddSpc("*",$2);} - | '&' cv_qualifier_list_opt { $$ = stradd("&",$2);} -/*! | complete_class_name - DBL_COLON - '*' - cv_qualifier_list_opt { $$ = stradd($1,"::*",$4); }*/ - ; - -cv_qualifier_list_opt: /* empty */ { $$ = ""; } - | cv_qualifier_list { $$ = $1; } - ; - -cv_qualifier_list: cv_qualifier { $$ = $1; } - | cv_qualifier_list cv_qualifier - { $$ = straddSpc($1,$2); } - ; - -cv_qualifier: CONST { $$ = "const"; } - | VOLATILE { $$ = "volatile"; } - ; - -fct_body_or_semicolon: ';' - | fct_body - | '=' INT_VAL ';' /* abstract func, INT_VAL = 0 */ - ; - -fct_body: '{' { BEGIN IN_FCT; fctLevel = 1;} - '}' { BEGIN TQT_DEF; } - ; - - -/***** r.17.5 (ARM p.395): Class Declarations *****/ - -class_specifier: full_class_head - '{' { BEGIN IN_CLASS; - classPLevel = 1; - } - opt_obj_member_list - '}' { BEGIN TQT_DEF; } /*catch ';'*/ - | class_head { BEGIN TQT_DEF; /* -- " -- */ - skipClass = TRUE; } - | class_head '*' IDENTIFIER { BEGIN TQT_DEF; /* -- " -- */ - skipClass = TRUE; } - | class_head '&' IDENTIFIER { BEGIN TQT_DEF; /* -- " -- */ - skipClass = TRUE; } - | class_head - '(' IDENTIFIER ')' /* TQt macro name */ - { BEGIN TQT_DEF; /* catch ';' */ - skipClass = TRUE; } - | template_spec whatever { skipClass = TRUE; - BEGIN GIMME_SEMICOLON; } - ; - -whatever: IDENTIFIER - | simple_type_name - | type_specifier - | storage_class_specifier { $$ = ""; } - | fct_specifier - ; - - -class_head: class_key - qualified_class_name { g->className = $2; - fprintf( stderr, "FOUND CLASS [1]: %s\n", (const char*)g->className ); - if ( g->className == "TQObject" ) - TQ_OBJECTdetected = TRUE; - } - | class_key - IDENTIFIER /* possible DLL EXPORT macro */ - class_name { g->className = $3; - fprintf( stderr, "FOUND CLASS [2]: %s\n", (const char*)g->className ); - if ( g->className == "TQObject" ) - TQ_OBJECTdetected = TRUE; - } - ; - -full_class_head: class_head - opt_base_spec { g->superClassName = $2; } - ; - -nested_class_head: class_key - qualified_class_name - opt_base_spec { templateClass = templateClassOld; } - ; - -exception_spec_opt: /* empty */ - | exception_spec - ; - -/* looser than the real thing */ -exception_spec: THROW '(' opt_exception_argument ')' - ; - -ctor_initializer_opt: /* empty */ - | ctor_initializer - ; - -ctor_initializer: ':' mem_initializer_list - ; - -mem_initializer_list: mem_initializer - | mem_initializer ',' mem_initializer_list - ; - -/* complete_class_name also represents IDENTIFIER */ -mem_initializer: complete_class_name '(' { expLevel = 1; } - const_expression ')' - ; - - -opt_base_spec: /* empty */ { $$ = 0; } - | base_spec { $$ = $1; } - ; - -opt_obj_member_list: /* empty */ - | obj_member_list - ; - -obj_member_list: obj_member_list obj_member_area - | obj_member_area - ; - - -qt_access_specifier: access_specifier { tmpAccess = $1; } - | SLOTS { tqmoc_err( "Missing access specifier" - " before \"tqslots:\"." ); } - ; - -obj_member_area: qt_access_specifier { BEGIN TQT_DEF; } - slot_area - | SIGNALS { BEGIN TQT_DEF; } - ':' opt_signal_declarations - | TQ_OBJECT { - if ( tmpAccess ) - tqmoc_warn("TQ_OBJECT is not in the private" - " section of the class.\n" - "TQ_OBJECT is a macro that resets" - " access permission to \"private\"."); - TQ_OBJECTdetected = TRUE; - } - | Q_PROPERTY { tmpYYStart = YY_START; - tmpPropOverride = FALSE; - BEGIN IN_PROPERTY; } - '(' property ')' { - BEGIN tmpYYStart; - } - opt_property_candidates - | TQ_OVERRIDE { tmpYYStart = YY_START; - tmpPropOverride = TRUE; - BEGIN IN_PROPERTY; } - '(' property ')' { - BEGIN tmpYYStart; - } - opt_property_candidates - | TQ_CLASSINFO { tmpYYStart = YY_START; BEGIN IN_CLASSINFO; } - '(' STRING ',' STRING ')' - { - g->infos.append( new ClassInfo( $4, $6 ) ); - BEGIN tmpYYStart; - } - opt_property_candidates - | TQ_ENUMS { tmpYYStart = YY_START; BEGIN IN_PROPERTY; } - '(' qt_enums ')' { - Q_PROPERTYdetected = TRUE; - BEGIN tmpYYStart; - } - opt_property_candidates - | TQ_SETS { tmpYYStart = YY_START; BEGIN IN_PROPERTY; } - '(' qt_sets ')' { - Q_PROPERTYdetected = TRUE; - BEGIN tmpYYStart; - } - opt_property_candidates - ; - -slot_area: SIGNALS ':' { tqmoc_err( "Signals cannot " - "have access specifiers" ); } - | SLOTS ':' opt_slot_declarations - | ':' { if ( tmpAccess == Public && Q_PROPERTYdetected ) - BEGIN TQT_DEF; - else - BEGIN IN_CLASS; - suppress_func_warn = TRUE; - } - opt_property_candidates - { - suppress_func_warn = FALSE; - } - | IDENTIFIER { BEGIN IN_CLASS; - if ( classPLevel != 1 ) - tqmoc_warn( "unexpected access" - "specifier" ); - } - ; - -opt_property_candidates: /*empty*/ - | property_candidate_declarations - ; - -property_candidate_declarations: property_candidate_declarations property_candidate_declaration - | property_candidate_declaration - ; - -property_candidate_declaration: signal_or_slot { addMember( PropertyCandidateMember ); } - ; - -opt_signal_declarations: /* empty */ - | signal_declarations - ; - -signal_declarations: signal_declarations signal_declaration - | signal_declaration - ; - - -signal_declaration: signal_or_slot { addMember( SignalMember ); } - ; - -opt_slot_declarations: /* empty */ - | slot_declarations - ; - -slot_declarations: slot_declarations slot_declaration - | slot_declaration - ; - -slot_declaration: signal_or_slot { addMember( SlotMember ); } - ; - -opt_semicolons: /* empty */ - | opt_semicolons ';' - ; - -base_spec: ':' base_list { $$=$2; } - ; - -base_list : base_list ',' base_specifier { g->multipleSuperClasses.append( $3 ); } - | base_specifier - ; - -qt_macro_name: IDENTIFIER '(' IDENTIFIER ')' - { $$ = stradd( $1, "(", $3, ")" ); } - | IDENTIFIER '(' simple_type_name ')' - { $$ = stradd( $1, "(", $3, ")" ); } - ; - -base_specifier: complete_class_name {$$=$1;} - | VIRTUAL access_specifier complete_class_name {$$=$3;} - | VIRTUAL complete_class_name {$$=$2;} - | access_specifier VIRTUAL complete_class_name {$$=$3;} - | access_specifier complete_class_name {$$=$2;} - | qt_macro_name {$$=$1;} - | VIRTUAL access_specifier qt_macro_name {$$=$3;} - | VIRTUAL qt_macro_name {$$=$2;} - | access_specifier VIRTUAL qt_macro_name {$$=$3;} - | access_specifier qt_macro_name {$$=$2;} - ; - -access_specifier: PRIVATE { $$=Private; } - | PROTECTED { $$=Protected; } - | PUBLIC { $$=Public; } - ; - -operator_name: decl_specs_opt IDENTIFIER ptr_operators_opt { } - | decl_specs_opt simple_type_name ptr_operators_opt { } - | '+' - | '-' - | '*' - | '/' - | '%' - | '^' - | '&' - | '|' - | '~' - | '!' - | '=' - | '<' - | '>' - | '+' '=' - | '-' '=' - | '*' '=' - | '/' '=' - | '%' '=' - | '^' '=' - | '&' '=' - | '|' '=' - | '~' '=' - | '!' '=' - | '=' '=' - | '<' '=' - | '>' '=' - | '<' '<' - | '>' '>' - | '<' '<' '=' - | '>' '>' '=' - | '&' '&' - | '|' '|' - | '+' '+' - | '-' '-' - | ',' - | '-' '>' '*' - | '-' '>' - | '(' ')' - | '[' ']' - ; - - -opt_virtual: /* empty */ - | VIRTUAL - ; - -type_and_name: type_name fct_name - { tmpFunc->type = $1; - tmpFunc->name = $2; } - | fct_name - { tmpFunc->type = "int"; - tmpFunc->name = $1; - if ( tmpFunc->name == g->className ) - func_warn( "Constructors cannot be" - " tqsignals or tqslots."); - } - | opt_virtual '~' fct_name - { tmpFunc->type = "void"; - tmpFunc->name = "~"; - tmpFunc->name += $3; - func_warn( "Destructors cannot be" - " tqsignals or tqslots."); - } - | decl_specs type_name decl_specs_opt - ptr_operators_opt fct_name - { - char *tmp = - straddSpc($1,$2,$3,$4); - tmpFunc->type = rmWS(tmp); - delete [] tmp; - tmpFunc->name = $5; } - | decl_specs type_name /* probably friend decl */ - { skipFunc = TRUE; } - | type_name ptr_operators fct_name - { tmpFunc->type = - straddSpc($1,$2); - tmpFunc->name = $3; } - | type_name decl_specs ptr_operators_opt - fct_name - { tmpFunc->type = - straddSpc($1,$2,$3); - tmpFunc->name = $4; } - | type_name OPERATOR operator_name - { operatorError(); } - | OPERATOR operator_name - { operatorError(); } - | decl_specs type_name decl_specs_opt - ptr_operators_opt OPERATOR operator_name - { operatorError(); } - | type_name ptr_operators OPERATOR operator_name - { operatorError(); } - | type_name decl_specs ptr_operators_opt - OPERATOR operator_name - { operatorError(); } - ; - - -signal_or_slot: type_and_name fct_decl opt_semicolons - | type_and_name opt_bitfield ';' opt_semicolons - { func_warn("Unexpected variable declaration."); } - | type_and_name opt_bitfield ','member_declarator_list - ';' opt_semicolons - { func_warn("Unexpected variable declaration."); } - | enum_specifier opt_identifier ';' opt_semicolons - { func_warn("Unexpected enum declaration."); } - | USING complete_class_name ';' opt_semicolons - { func_warn("Unexpected using declaration."); } - | USING NAMESPACE complete_class_name ';' opt_semicolons - { func_warn("Unexpected using declaration."); } - | NAMESPACE IDENTIFIER '{' - { classPLevel++; - tqmoc_err("Unexpected namespace declaration."); } - | nested_class_head ';' opt_semicolons - { func_warn("Unexpected class declaration.");} - | nested_class_head - '{' { func_warn("Unexpected class declaration."); - BEGIN IN_FCT; fctLevel=1; - } - '}' { BEGIN TQT_DEF; } - ';' opt_semicolons - ; - - -member_declarator_list: member_declarator - | member_declarator_list ',' member_declarator - ; - -member_declarator: declarator { } - | IDENTIFIER ':' { expLevel = 0; } - const_expression - | ':' { expLevel = 0; } - const_expression - ; - -opt_bitfield: /* empty */ - | ':' { expLevel = 0; } - const_expression - ; - - -enum_specifier: ENUM enum_tail - ; - -/* optional final comma at the end of an enum list. Not really C++ but -some people still use it */ -opt_komma: /*empty*/ - | ',' - ; - -enum_tail: IDENTIFIER '{' enum_list opt_komma - '}' { BEGIN TQT_DEF; - if ( tmpAccess == Public) { - tmpEnum->name = $1; - addEnum(); - } - } - | '{' enum_list opt_komma - '}' { tmpEnum->clear();} - ; - -opt_identifier: /* empty */ - | IDENTIFIER { } - ; - -enum_list: /* empty */ - | enumerator - | enum_list ',' enumerator - ; - -enumerator: IDENTIFIER { if ( tmpAccess == Public) tmpEnum->append( $1 ); } - | IDENTIFIER '=' { enumLevel=0; } - enumerator_expression { if ( tmpAccess == Public) tmpEnum->append( $1 ); } - ; - -property: IDENTIFIER IDENTIFIER - { - g->propWrite = ""; - g->propRead = ""; - g->propOverride = tmpPropOverride; - g->propReset = ""; - if ( g->propOverride ) { - g->propStored = ""; - g->propDesignable = ""; - g->propScriptable = ""; - } else { - g->propStored = "true"; - g->propDesignable = "true"; - g->propScriptable = "true"; - } - } - prop_statements - { - if ( g->propRead.isEmpty() && !g->propOverride ) - tqmoc_err( "A property must at least feature a read method." ); - checkPropertyName( $2 ); - Q_PROPERTYdetected = TRUE; - // Avoid duplicates - for( TQPtrListIterator<Property> lit( g->props ); lit.current(); ++lit ) { - if ( lit.current()->name == $2 ) { - if ( displayWarnings ) - tqmoc_err( "Property '%s' defined twice.", - (const char*)lit.current()->name ); - } - } - g->props.append( new Property( lineNo, $1, $2, - g->propWrite, g->propRead, g->propReset, - g->propStored, g->propDesignable, - g->propScriptable, g->propOverride ) ); - } - ; - -prop_statements: /* empty */ - | READ IDENTIFIER prop_statements { g->propRead = $2; } - | WRITE IDENTIFIER prop_statements { g->propWrite = $2; } - | RESET IDENTIFIER prop_statements { g->propReset = $2; } - | STORED IDENTIFIER prop_statements { g->propStored = $2; } - | DESIGNABLE IDENTIFIER prop_statements { g->propDesignable = $2; } - | SCRIPTABLE IDENTIFIER prop_statements { g->propScriptable = $2; } - ; - -qt_enums: /* empty */ { } - | IDENTIFIER qt_enums { g->qtEnums.append( $1 ); } - ; - -qt_sets: /* empty */ { } - | IDENTIFIER qt_sets { g->qtSets.append( $1 ); } - ; - -%% - -#ifndef YYBISON -# if defined(TQ_OS_WIN32) -# include <io.h> -# undef isatty -extern "C" int hack_isatty( int ) -{ - return 0; -} -# define isatty hack_isatty -# else -# include <unistd.h> -# endif -# include "tqmoc_lex.cpp" -#endif //YYBISON - -void cleanup(); -TQCString combinePath( const char *, const char * ); - -FILE *out; // output file - -parser_reg::parser_reg() : funcs(TRUE) -{ - gen_count = 0; - noInclude = FALSE; // no #include <filename> - generatedCode = FALSE; // no code generated - tqmocError = FALSE; // tqmoc parsing error occurred - hasVariantIncluded = FALSE; -} - - -parser_reg::~parser_reg() -{ - tqslots.clear(); - tqsignals.clear(); - propfuncs.clear(); - funcs.clear(); - infos.clear(); - props.clear(); - infos.clear(); -} - -int yyparse(); - -void replace( char *s, char c1, char c2 ); - -void setDefaultIncludeFile() -{ - if ( g->includeFiles.isEmpty() ) { - if ( g->includePath.isEmpty() ) { - if ( !g->fileName.isEmpty() && !g->outputFile.isEmpty() ) { - g->includeFiles.append( combinePath(g->fileName, g->outputFile) ); - } else { - g->includeFiles.append( g->fileName ); - } - } else { - g->includeFiles.append( combinePath(g->fileName, g->fileName) ); - } - } -} - -#ifdef TQ_CC_MSVC -#define ErrorFormatString "%s(%d):" -#else -#define ErrorFormatString "%s:%d:" -#endif - -#ifndef TQMOC_MWERKS_PLUGIN -int main( int argc, char **argv ) -{ - init(); - - bool autoInclude = TRUE; - const char *error = 0; - g->qtPath = ""; - for ( int n=1; n<argc && error==0; n++ ) { - TQCString arg = argv[n]; - if ( arg[0] == '-' ) { // option - TQCString opt = arg.tqstringFromPos(1); - if ( opt[0] == 'o' ) { // output redirection - if ( opt[1] == '\0' ) { - if ( !(n < argc-1) ) { - error = "Missing output file name"; - break; - } - g->outputFile = argv[++n]; - } else - g->outputFile = opt.tqstringFromPos(1); - } else if ( opt == "i" ) { // no #include statement - g->noInclude = TRUE; - autoInclude = FALSE; - } else if ( opt[0] == 'f' ) { // produce #include statement - g->noInclude = FALSE; - autoInclude = FALSE; - if ( opt[1] ) // -fsomething.h - g->includeFiles.append( opt.tqstringFromPos(1) ); - } else if ( opt == "pch" ) { // produce #include statement for PCH - if ( !(n < argc-1) ) { - error = "Missing name of PCH file"; - break; - } - g->pchFile = argv[++n]; - } else if ( opt[0] == 'p' ) { // include file path - if ( opt[1] == '\0' ) { - if ( !(n < argc-1) ) { - error = "Missing path name for the -p option."; - break; - } - g->includePath = argv[++n]; - } else { - g->includePath = opt.tqstringFromPos(1); - } - } else if ( opt[0] == 'q' ) { // qt include file path - if ( opt[1] == '\0' ) { - if ( !(n < argc-1) ) { - error = "Missing path name for the -q option."; - break; - } - g->qtPath = argv[++n]; - } else { - g->qtPath = opt.tqstringFromPos(1); - } - replace(g->qtPath.data(),'\\','/'); - if ( g->qtPath.right(1) != "/" ) - g->qtPath += '/'; - } else if ( opt == "v" ) { // version number - fprintf( stderr, "TQt Meta Object Compiler version %d" - " (TQt %s)\n", formatRevision, - TQT_VERSION_STR ); - cleanup(); - return 1; - } else if ( opt == "k" ) { // stop on errors - errorControl = TRUE; - } else if ( opt == "nw" ) { // don't display warnings - displayWarnings = FALSE; - } else if ( opt == "ldbg" ) { // lex debug output - lexDebug = TRUE; - } else if ( opt == "ydbg" ) { // yacc debug output - yydebug = TRUE; - } else { - error = "Invalid argument"; - } - } else { - if ( !g->fileName.isNull() ) // can handle only one file - error = "Too many input files specified"; - else - g->fileName = arg.copy(); - } - } - - if ( autoInclude ) { - int ppos = g->fileName.findRev('.'); - if ( ppos != -1 && tolower( g->fileName[ppos + 1] ) == 'h' ) - g->noInclude = FALSE; - else - g->noInclude = TRUE; - } - setDefaultIncludeFile(); - - if ( g->fileName.isNull() && !error ) { - g->fileName = "standard input"; - yyin = stdin; - } else if ( argc < 2 || error ) { // incomplete/wrong args - fprintf( stderr, "TQt meta object compiler\n" ); - if ( error ) - fprintf( stderr, "tqmoc: %s\n", error ); - fprintf( stderr, "Usage: tqmoc [options] <header-file>\n" - "\t-o file Write output to file rather than stdout\n" - "\t-f[file] Force #include, optional file name\n" - "\t-p path Path prefix for included file\n" - "\t-i Do not generate an #include statement\n" - "\t-k Do not stop on errors\n" - "\t-nw Do not display warnings\n" - "\t-v Display version of tqmoc\n" ); - cleanup(); - return 1; - } else { - yyin = fopen( (const char *)g->fileName, "r" ); - if ( !yyin ) { - fprintf( stderr, "tqmoc: %s: No such file\n", (const char*)g->fileName); - cleanup(); - return 1; - } - } - if ( !g->outputFile.isEmpty() ) { // output file specified - out = fopen( (const char *)g->outputFile, "w" ); // create output file - if ( !out ) { - fprintf( stderr, "tqmoc: Cannot create %s\n", - (const char*)g->outputFile ); - cleanup(); - return 1; - } - } else { // use stdout - out = stdout; - } - yyparse(); - fclose( yyin ); - if ( !g->outputFile.isNull() ) - fclose( out ); - - if ( !g->generatedCode && displayWarnings && !g->tqmocError ) { - fprintf( stderr, ErrorFormatString" Warning: %s\n", g->fileName.data(), 0, - "No relevant classes found. No output generated." ); - } - - int ret = g->tqmocError ? 1 : 0; - cleanup(); - return ret; -} -#else -bool qt_is_gui_used = FALSE; -#include <ctype.h> -#include <stdio.h> -#include <string.h> -#ifdef TQ_OS_MAC9 -# include <Files.h> -# include <Strings.h> -# include <Errors.h> -# include "Aliases.h" -#endif -#include "CWPluginErrors.h" -#include <CWPlugins.h> -#include "DropInCompilerLinker.h" -#include <stat.h> - -const unsigned char *p_str(const char *, int =-1); - -CWPluginContext g_ctx; - -tqmoc_status do_tqmoc( CWPluginContext ctx, const TQCString &fin, const TQCString &fout, CWFileSpec *dspec, bool i) -{ - init(); - - g_ctx = ctx; - g->noInclude = i; - g->fileName = fin; - g->outputFile = fout; - - setDefaultIncludeFile(); - - CWFileInfo fi; - memset(&fi, 0, sizeof(fi)); - fi.fullsearch = TRUE; - fi.dependencyType = cwNormalDependency; - fi.isdependentoffile = kCurrentCompiledFile; - if(CWFindAndLoadFile( ctx, fin.data(), &fi) != cwNoErr) { - cleanup(); - return tqmoc_no_source; - } - - if(dspec) { - memcpy(dspec, &fi.filespec, sizeof(fi.filespec)); - const unsigned char *f = p_str(fout.data()); - memcpy(dspec->name, f, f[0]+1); - free(f); - } - buf_size_total = fi.filedatalength; - buf_buffer = fi.filedata; - - TQCString path(""); - AliasHandle alias; - Str63 str; - AliasInfoType x = 1; - char tmp[sizeof(Str63)+2]; - if(NewAlias( NULL, &fi.filespec, &alias) != noErr) { - cleanup(); - return tqmoc_general_error; - } - for(;;) { - GetAliasInfo(alias, x++, str); - if(!str[0]) - break; - strncpy((char *)tmp, (const char *)str+1, str[0]); - tmp[str[0]] = '\0'; - path.prepend(":"); - path.prepend((char *)tmp); - } - path.prepend("MacOS 9:"); //FIXME - - TQString inpath = path + fin, outpath = path + fout; - struct stat istat, ostat; - if(stat(inpath, &istat) == -1) { - cleanup(); - return tqmoc_no_source; - } - if(stat(outpath, &ostat) == 0 && istat.st_mtime < ostat.st_mtime) { - cleanup(); - return tqmoc_not_time; - } - - unlink(outpath.data()); - out = fopen(outpath.data(), "w+"); - if(!out) { - cleanup(); - return tqmoc_general_error; - } - - yyparse(); - if(out != stdout) - fclose(out); - - if(g->tqmocError || !g->generatedCode) { - unlink(outpath.data()); - tqmoc_status ret = !g->generatedCode ? tqmoc_no_qobject : tqmoc_parse_error; - cleanup(); - return ret; - } - - cleanup(); - return tqmoc_success; -} -#endif -void replace( char *s, char c1, char c2 ) -{ - if ( !s ) - return; - while ( *s ) { - if ( *s == c1 ) - *s = c2; - s++; - } -} - -/* - This function looks at two file names and returns the name of the - infile with a path relative to outfile. - - Examples: - - /tmp/abc, /tmp/bcd -> abc - xyz/a/bc, xyz/b/ac -> ../a/bc - /tmp/abc, xyz/klm -> /tmp/abc - */ - -TQCString combinePath( const char *infile, const char *outfile ) -{ - TQFileInfo inFileInfo( TQDir::current(), TQFile::decodeName(infile) ); - TQFileInfo outFileInfo( TQDir::current(), TQFile::decodeName(outfile) ); - int numCommonComponents = 0; - - TQStringList inSplitted = - TQStringList::split( '/', inFileInfo.dir().canonicalPath(), TRUE ); - TQStringList outSplitted = - TQStringList::split( '/', outFileInfo.dir().canonicalPath(), TRUE ); - - while ( !inSplitted.isEmpty() && !outSplitted.isEmpty() && - inSplitted.first() == outSplitted.first() ) { - inSplitted.remove( inSplitted.begin() ); - outSplitted.remove( outSplitted.begin() ); - numCommonComponents++; - } - - if ( numCommonComponents < 2 ) { - /* - The paths don't have the same drive, or they don't have the - same root directory. Use an absolute path. - */ - return TQFile::encodeName( inFileInfo.absFilePath() ); - } else { - /* - The paths have something in common. Use a path relative to - the output file. - */ - while ( !outSplitted.isEmpty() ) { - outSplitted.remove( outSplitted.begin() ); - inSplitted.prepend( ".." ); - } - inSplitted.append( inFileInfo.fileName() ); - return TQFile::encodeName( inSplitted.join("/") ); - } -} - - -#define getenv hack_getenv // workaround for byacc -char *getenv() { return 0; } -char *getenv( const char * ) { return 0; } - -void init() // initialize -{ - BEGIN OUTSIDE; - if(g) - delete g; - g = new parser_reg; - lineNo = 1; - skipClass = FALSE; - skipFunc = FALSE; - tmpArgList = new ArgList; - tmpFunc = new Function; - tmpEnum = new Enum; - -#ifdef TQMOC_MWERKS_PLUGIN - buf_buffer = NULL; - buf_index = 0; - buf_size_total = 0; -#endif -} - -void cleanup() -{ - delete g; - g = NULL; - -#ifdef TQMOC_MWERKS_PLUGIN - if(buf_buffer && g_ctx) - CWReleaseFileText(g_ctx, buf_buffer); -#endif -} - -void initClass() // prepare for new class -{ - tmpAccess = Private; - subClassPerm = Private; - TQ_OBJECTdetected = FALSE; - Q_PROPERTYdetected = FALSE; - skipClass = FALSE; - templateClass = FALSE; - g->tqslots.clear(); - g->tqsignals.clear(); - g->propfuncs.clear(); - g->enums.clear(); - g->funcs.clear(); - g->props.clear(); - g->infos.clear(); - g->qtSets.clear(); - g->qtEnums.clear(); - g->multipleSuperClasses.clear(); -} - -struct NamespaceInfo -{ - TQCString name; - int pLevelOnEntering; // Parenthesis level on entering the namespace - TQDict<char> definedClasses; // Classes defined in the namespace -}; - -TQPtrList<NamespaceInfo> namespaces; - -void enterNameSpace( const char *name ) // prepare for new class -{ - static bool first = TRUE; - if ( first ) { - namespaces.setAutoDelete( TRUE ); - first = FALSE; - } - - NamespaceInfo *tmp = new NamespaceInfo; - if ( name ) - tmp->name = name; - tmp->pLevelOnEntering = namespacePLevel; - namespaces.append( tmp ); -} - -void leaveNameSpace() // prepare for new class -{ - NamespaceInfo *tmp = namespaces.last(); - namespacePLevel = tmp->pLevelOnEntering; - namespaces.remove(); -} - -TQCString nameTQualifier() -{ - TQPtrListIterator<NamespaceInfo> iter( namespaces ); - NamespaceInfo *tmp; - TQCString qualifier = ""; - for( ; (tmp = iter.current()) ; ++iter ) { - if ( !tmp->name.isNull() ) { // If not unnamed namespace - qualifier += tmp->name; - qualifier += "::"; - } - } - return qualifier; -} - -int openNameSpaceForMetaObject( FILE *out ) -{ - int levels = 0; - TQPtrListIterator<NamespaceInfo> iter( namespaces ); - NamespaceInfo *tmp; - TQCString indent = ""; - for( ; (tmp = iter.current()) ; ++iter ) { - if ( !tmp->name.isNull() ) { // If not unnamed namespace - fprintf( out, "%snamespace %s {\n", (const char *)indent, - (const char *) tmp->name ); - indent += " "; - levels++; - } - } - TQCString nm = g->className; - int pos; - while( (pos = nm.find( "::" )) != -1 ) { - TQCString spaceName = nm.left( pos ); - nm = nm.right( nm.length() - pos - 2 ); - if ( !spaceName.isEmpty() ) { - fprintf( out, "%snamespace %s {\n", (const char *)indent, - (const char *) spaceName ); - indent += " "; - levels++; - } - } - return levels; -} - -void closeNameSpaceForMetaObject( FILE *out, int levels ) -{ - int i; - for( i = 0 ; i < levels ; i++ ) - fprintf( out, "}" ); - if ( levels ) - fprintf( out, "\n" ); - -} - -void selectOutsideClassState() -{ - if ( namespaces.count() == 0 ) - BEGIN OUTSIDE; - else - BEGIN IN_NAMESPACE; -} - -void registerClassInNamespace() -{ - if ( namespaces.count() == 0 ) - return; - namespaces.last()->definedClasses.insert((const char *)g->className,(char*)1); -} - -// -// Remove white space from SIGNAL and SLOT names. -// This function has been copied from qobject.cpp. -// - -inline bool isSpace( char x ) -{ -#if defined(TQ_CC_BOR) - /* - Borland C++ 4.5 has a weird isspace() bug. - isspace() usually works, but not here. - This implementation is sufficient for our internal use: rmWS() - */ - return (uchar) x <= 32; -#else - return isspace( (uchar) x ); -#endif -} - -static TQCString rmWS( const char *src ) -{ - TQCString result( tqstrlen(src)+1 ); - char *d = result.data(); - char *s = (char *)src; - char last = 0; - while( *s && isSpace(*s) ) // skip leading space - s++; - while ( *s ) { - while ( *s && !isSpace(*s) ) - last = *d++ = *s++; - while ( *s && isSpace(*s) ) - s++; - if ( *s && isIdentChar(*s) && isIdentChar(last) ) - last = *d++ = ' '; - } - result.truncate( (int)(d - result.data()) ); - return result; -} - - -void initExpression() -{ - g->tmpExpression = ""; -} - -void addExpressionString( const char *s ) -{ - g->tmpExpression += s; -} - -void addExpressionChar( const char c ) -{ - g->tmpExpression += c; -} - -void yyerror( const char *msg ) // print yacc error message -{ - g->tqmocError = TRUE; -#ifndef TQMOC_MWERKS_PLUGIN - fprintf( stderr, ErrorFormatString" Error: %s\n", g->fileName.data(), lineNo, msg ); -#else - char msg2[200]; - sprintf(msg2, ErrorFormatString" Error: %s", g->fileName.data(), lineNo, msg); - CWReportMessage(g_ctx, NULL, msg2, NULL, messagetypeError, 0); -#endif - if ( errorControl ) { - if ( !g->outputFile.isEmpty() && yyin && fclose(yyin) == 0 ) - remove( g->outputFile ); - exit( -1 ); - } -} - -void tqmoc_err( const char *s ) -{ - yyerror( s ); -} - -void tqmoc_err( const char *s1, const char *s2 ) -{ - static char tmp[1024]; - sprintf( tmp, s1, s2 ); - yyerror( tmp ); -} - -void tqmoc_warn( const char *msg ) -{ - if ( displayWarnings ) - fprintf( stderr, ErrorFormatString" Warning: %s\n", g->fileName.data(), lineNo, msg); -} - -void tqmoc_warn( char *s1, char *s2 ) -{ - static char tmp[1024]; - sprintf( tmp, s1, s2 ); - if ( displayWarnings ) - fprintf( stderr, ErrorFormatString" Warning: %s\n", g->fileName.data(), lineNo, tmp); -} - -void func_warn( const char *msg ) -{ - if ( !suppress_func_warn ) - tqmoc_warn( msg ); - skipFunc = TRUE; -} - -void operatorError() -{ - if ( !suppress_func_warn ) - tqmoc_warn("Operator functions cannot be tqsignals or tqslots."); - skipFunc = TRUE; -} - -#ifndef yywrap -int yywrap() // more files? -{ - return 1; // end of file -} -#endif - -char *stradd( const char *s1, const char *s2 ) // adds two strings -{ - char *n = new char[tqstrlen(s1)+tqstrlen(s2)+1]; - qstrcpy( n, s1 ); - strcat( n, s2 ); - return n; -} - -char *stradd( const char *s1, const char *s2, const char *s3 )// adds 3 strings -{ - char *n = new char[tqstrlen(s1)+tqstrlen(s2)+tqstrlen(s3)+1]; - qstrcpy( n, s1 ); - strcat( n, s2 ); - strcat( n, s3 ); - return n; -} - -char *stradd( const char *s1, const char *s2, - const char *s3, const char *s4 )// adds 4 strings -{ - char *n = new char[tqstrlen(s1)+tqstrlen(s2)+tqstrlen(s3)+tqstrlen(s4)+1]; - qstrcpy( n, s1 ); - strcat( n, s2 ); - strcat( n, s3 ); - strcat( n, s4 ); - return n; -} - - -char *straddSpc( const char *s1, const char *s2 ) -{ - char *n = new char[tqstrlen(s1)+tqstrlen(s2)+2]; - qstrcpy( n, s1 ); - strcat( n, " " ); - strcat( n, s2 ); - return n; -} - -char *straddSpc( const char *s1, const char *s2, const char *s3 ) -{ - char *n = new char[tqstrlen(s1)+tqstrlen(s2)+tqstrlen(s3)+3]; - qstrcpy( n, s1 ); - strcat( n, " " ); - strcat( n, s2 ); - strcat( n, " " ); - strcat( n, s3 ); - return n; -} - -char *straddSpc( const char *s1, const char *s2, - const char *s3, const char *s4 ) -{ - char *n = new char[tqstrlen(s1)+tqstrlen(s2)+tqstrlen(s3)+tqstrlen(s4)+4]; - qstrcpy( n, s1 ); - strcat( n, " " ); - strcat( n, s2 ); - strcat( n, " " ); - strcat( n, s3 ); - strcat( n, " " ); - strcat( n, s4 ); - return n; -} - -// Generate C++ code for building member function table - - -/* - We call B::qt_invoke() rather than A::B::qt_invoke() to - work around a bug in MSVC 6. The bug occurs if the - super-class is in a namespace and the sub-class isn't. - - Exception: If the superclass has the same name as the subclass, we - want non-MSVC users to have a working generated files. -*/ -TQCString purestSuperClassName() -{ - TQCString sc = g->superClassName; - TQCString c = g->className; - /* - Make sure qualified template arguments (e.g., foo<bar::baz>) - don't interfere. - */ - int pos = sc.findRev( "::", sc.find( '<' ) ); - if ( pos != -1 ) { - sc = sc.right( sc.length() - pos - 2 ); - pos = c.findRev( "::" ); - if ( pos != -1 ) - c = c.right( c.length() - pos - 2 ); - if ( sc == c ) - sc = g->superClassName; - } - return sc; -} - -TQCString callablePurestSuperClassName() -{ - TQCString sc = purestSuperClassName(); -// if (sc.find("TQ") != 0) { - return TQCString("static_cast<TQObject*>(static_cast<TQT_BASE_OBJECT_NAME*>(this))->"); -// } -// else { -// return TQCString(sc + "::"); -// } -} - -TQCString qualifiedClassName() -{ - return nameTQualifier() + g->className; -} - -TQCString callableQualifiedClassName() -{ - TQCString sc = qualifiedClassName(); -// if (sc.find("TQ") != 0) { - return TQCString("static_cast<TQObject*>(static_cast<TQT_BASE_OBJECT_NAME*>(this))->"); -// } -// else { -// return TQCString(sc + "::"); -// } -} - -const int Slot_Num = 1; -const int Signal_Num = 2; -const int Prop_Num = 3; - -void generateFuncs( FuncList *list, const char *functype, int num ) -{ - Function *f; - for ( f=list->first(); f; f=list->next() ) { - bool hasReturnValue = f->type != "void" && (validUType( f->type ) || isVariantType( f->type) ); - - if ( hasReturnValue || !f->args->isEmpty() ) { - fprintf( out, " static const TQUParameter param_%s_%d[] = {\n", functype, list->at() ); - if ( hasReturnValue ) { - if ( validUType( f->type ) ) - fprintf( out, "\t{ 0, &static_TQUType_%s, %s, TQUParameter::Out }", uType(f->type).data(), uTypeExtra(f->type).data() ); - else - fprintf( out, "\t{ 0, &static_TQUType_TQVariant, %s, TQUParameter::Out }", uTypeExtra(f->type).data() ); - if ( !f->args->isEmpty() ) - fprintf( out, ",\n" ); - } - Argument* a = f->args->first(); - while ( a ) { - TQCString type = a->leftType + ' ' + a->rightType; - type = type.simplifyWhiteSpace(); - if( a->name.isEmpty() ) - fprintf( out, "\t{ 0, &static_TQUType_%s, %s, TQUParameter::%s }", - uType( type ).data(), uTypeExtra( type ).data(), - isInOut( type ) ? "InOut" : "In" ); - else - fprintf( out, "\t{ \"%s\", &static_TQUType_%s, %s, TQUParameter::%s }", - a->name.data(), uType( type ).data(), uTypeExtra( type ).data(), - isInOut( type ) ? "InOut" : "In" ); - a = f->args->next(); - if ( a ) - fprintf( out, ",\n" ); - } - fprintf( out, "\n };\n"); - } - - fprintf( out, " static const TQUMethod %s_%d = {", functype, list->at() ); - int n = f->args->count(); - if ( hasReturnValue ) - n++; - fprintf( out, "\"%s\", %d,", f->name.data(), n ); - if ( n ) - fprintf( out, " param_%s_%d };\n", functype, list->at() ); - else - fprintf( out, " 0 };\n" ); - - TQCString typstr = ""; - int count = 0; - Argument *a = f->args->first(); - while ( a ) { - if ( !a->leftType.isEmpty() || ! a->rightType.isEmpty() ) { - if ( count++ ) - typstr += ","; - typstr += a->leftType; - typstr += a->rightType; - } - a = f->args->next(); - } - f->signature = f->name; - f->signature += "("; - f->signature += typstr; - f->signature += ")"; - } - if ( list->count() ) { - fprintf(out," static const TQMetaData %s_tbl[] = {\n", functype ); - f = list->first(); - while ( f ) { - fprintf( out, "\t{ \"%s\",", f->signature.data() ); - fprintf( out, " &%s_%d,", functype, list->at() ); - fprintf( out, " TQMetaData::%s }", f->accessAsString() ); - f = list->next(); - if ( f ) - fprintf( out, ",\n"); - } - fprintf( out, "\n };\n" ); - } -} - - -int enumIndex( const char* type ) -{ - int index = 0; - for( TQPtrListIterator<Enum> lit( g->enums ); lit.current(); ++lit ) { - if ( lit.current()->name == type ) - return index; - index++; - } - return -1; -} - -bool isEnumType( const char* type ) -{ - return enumIndex( type ) >= 0 || ( g->qtEnums.contains( type ) || g->qtSets.contains( type ) ); -} - -bool isPropertyType( const char* type ) -{ - if ( isVariantType( type ) ) - return TRUE; - - return isEnumType( type ); -} - -int generateEnums() -{ - if ( g->enums.count() == 0 ) - return 0; - - fprintf( out, "#ifndef TQT_NO_PROPERTIES\n" ); - int i = 0; - for ( TQPtrListIterator<Enum> it( g->enums ); it.current(); ++it, ++i ) { - fprintf( out, " static const TQMetaEnum::Item enum_%i[] = {\n", i ); - int k = 0; - for( TQStrListIterator eit( *it.current() ); eit.current(); ++eit, ++k ) { - if ( k ) - fprintf( out, ",\n" ); - fprintf( out, "\t{ \"%s\", (int) %s::%s }", eit.current(), (const char*) g->className, eit.current() ); - } - fprintf( out, "\n };\n" ); - } - fprintf( out, " static const TQMetaEnum enum_tbl[] = {\n" ); - i = 0; - for ( TQPtrListIterator<Enum> it2( g->enums ); it2.current(); ++it2, ++i ) { - if ( i ) - fprintf( out, ",\n" ); - fprintf( out, "\t{ \"%s\", %u, enum_%i, %s }", - (const char*)it2.current()->name, - it2.current()->count(), - i, - it2.current()->set ? "TRUE" : "FALSE" ); - } - fprintf( out, "\n };\n" ); - fprintf( out, "#endif // TQT_NO_PROPERTIES\n" ); - - return g->enums.count(); -} - -int generateProps() -{ - // - // Resolve and verify property access functions - // - for( TQPtrListIterator<Property> it( g->props ); it.current(); ) { - Property* p = it.current(); - ++it; - - // verify get function - if ( !p->get.isEmpty() ) { - FuncList candidates = g->propfuncs.find( p->get ); - for ( Function* f = candidates.first(); f; f = candidates.next() ) { - if ( f->qualifier != "const" ) // get functions must be const - continue; - if ( f->args && !f->args->isEmpty() ) // and must not take any arguments - continue; - TQCString tmp = f->type; - Property::Specification spec = Property::Unspecified; - if ( p->type == "TQCString" && (tmp == "const char*" || tmp == "const char *" ) ) { - tmp = "TQCString"; - spec = Property::ConstCharStar; - } else if ( tmp.right(1) == "&" ) { - tmp = tmp.left( tmp.length() - 1 ); - spec = Property::Reference; - } else if ( tmp.right(1) == "*" ) { - tmp = tmp.left( tmp.length() - 1 ); - spec = Property::Pointer; - } else { - spec = Property::Class; - } - if ( tmp.left(6) == "const " ) - tmp = tmp.mid( 6, tmp.length() - 6 ); - tmp = tmp.simplifyWhiteSpace(); - if ( p->type == tmp ) { - // If it is an enum then it may not be a set - bool ok = TRUE; - for( TQPtrListIterator<Enum> lit( g->enums ); lit.current(); ++lit ) - if ( lit.current()->name == p->type && lit.current()->set ) - ok = FALSE; - if ( !ok ) continue; - p->gspec = spec; - p->getfunc = f; - p->oredEnum = 0; - break; - } - else if ( !isVariantType( p->type ) ) { - if ( tmp == "int" || tmp == "uint" || tmp == "unsigned int" ) { - // Test whether the enum is really a set (unfortunately we don't know enums of super classes) - bool ok = TRUE; - for( TQPtrListIterator<Enum> lit( g->enums ); lit.current(); ++lit ) - if ( lit.current()->name == p->type && !lit.current()->set ) - ok = FALSE; - if ( !ok ) continue; - p->gspec = spec; - p->getfunc = f; - p->oredEnum = 1; - p->enumgettype = tmp; - } - } - } - if ( p->getfunc == 0 ) { - if ( displayWarnings ) { - - // Is the type a set, that means, mentioned in TQ_SETS? - bool set = FALSE; - for( TQPtrListIterator<Enum> lit( g->enums ); lit.current(); ++lit ) - if ( lit.current()->name == p->type && lit.current()->set ) - set = TRUE; - - fprintf( stderr, ErrorFormatString" Warning: Property '%s' not available.\n", - g->fileName.data(), p->lineNo, (const char*) p->name ); - fprintf( stderr, " Have been looking for public get functions \n"); - if ( !set ) { - fprintf( stderr, - " %s %s() const\n" - " %s& %s() const\n" - " const %s& %s() const\n" - " %s* %s() const\n", - (const char*) p->type, (const char*) p->get, - (const char*) p->type, (const char*) p->get, - (const char*) p->type, (const char*) p->get, - (const char*) p->type, (const char*) p->get ); - } - if ( set || !isPropertyType( p->type ) ) { - fprintf( stderr, - " int %s() const\n" - " uint %s() const\n" - " unsigned int %s() const\n", - (const char*) p->get, - (const char*) p->get, - (const char*) p->get ); - } - if ( p->type == "TQCString" ) - fprintf( stderr, " const char* %s() const\n", - (const char*)p->get ); - - if ( candidates.isEmpty() ) { - fprintf( stderr, " but found nothing.\n"); - } else { - fprintf( stderr, " but only found the mismatching candidate(s)\n"); - for ( Function* f = candidates.first(); f; f = candidates.next() ) { - TQCString typstr = ""; - Argument *a = f->args->first(); - int count = 0; - while ( a ) { - if ( !a->leftType.isEmpty() || ! a->rightType.isEmpty() ) { - if ( count++ ) - typstr += ","; - typstr += a->leftType; - typstr += a->rightType; - } - a = f->args->next(); - } - fprintf( stderr, " %s:%d: %s %s(%s) %s\n", g->fileName.data(), f->lineNo, - (const char*) f->type,(const char*) f->name, (const char*) typstr, - f->qualifier.isNull()?"":(const char*) f->qualifier ); - } - } - } - } - } - - // verify set function - if ( !p->set.isEmpty() ) { - FuncList candidates = g->propfuncs.find( p->set ); - for ( Function* f = candidates.first(); f; f = candidates.next() ) { - if ( !f->args || f->args->isEmpty() ) - continue; - TQCString tmp = f->args->first()->leftType; - tmp = tmp.simplifyWhiteSpace(); - Property::Specification spec = Property::Unspecified; - if ( tmp.right(1) == "&" ) { - tmp = tmp.left( tmp.length() - 1 ); - spec = Property::Reference; - } - else { - spec = Property::Class; - } - if ( p->type == "TQCString" && (tmp == "const char*" || tmp == "const char *" ) ) { - tmp = "TQCString"; - spec = Property::ConstCharStar; - } - if ( tmp.left(6) == "const " ) - tmp = tmp.mid( 6, tmp.length() - 6 ); - tmp = tmp.simplifyWhiteSpace(); - - if ( p->type == tmp && f->args->count() == 1 ) { - // If it is an enum then it may not be a set - if ( p->oredEnum == 1 ) - continue; - bool ok = TRUE; - for( TQPtrListIterator<Enum> lit( g->enums ); lit.current(); ++lit ) - if ( lit.current()->name == p->type && lit.current()->set ) - ok = FALSE; - if ( !ok ) continue; - p->sspec = spec; - p->setfunc = f; - p->oredEnum = 0; - break; - } else if ( !isVariantType( p->type ) && f->args->count() == 1 ) { - if ( tmp == "int" || tmp == "uint" || tmp == "unsigned int" ) { - if ( p->oredEnum == 0 ) - continue; - // Test wether the enum is really a set (unfortunately we don't know enums of super classes) - bool ok = TRUE; - for( TQPtrListIterator<Enum> lit( g->enums ); lit.current(); ++lit ) - if ( lit.current()->name == p->type && !lit.current()->set ) - ok = FALSE; - if ( !ok ) continue; - p->sspec = spec; - p->setfunc = f; - p->oredEnum = 1; - p->enumsettype = tmp; - } - } - } - if ( p->setfunc == 0 ) { - if ( displayWarnings ) { - - // Is the type a set, that means, mentioned in TQ_SETS ? - bool set = FALSE; - for( TQPtrListIterator<Enum> lit( g->enums ); lit.current(); ++lit ) - if ( lit.current()->name == p->type && lit.current()->set ) - set = TRUE; - - fprintf( stderr, ErrorFormatString" Warning: Property '%s' not writable.\n", - g->fileName.data(), p->lineNo, (const char*) p->name ); - fprintf( stderr, " Have been looking for public set functions \n"); - if ( !set && p->oredEnum != 1 ) { - fprintf( stderr, - " void %s( %s )\n" - " void %s( %s& )\n" - " void %s( const %s& )\n", - (const char*) p->set, (const char*) p->type, - (const char*) p->set, (const char*) p->type, - (const char*) p->set, (const char*) p->type ); - } - if ( set || ( !isPropertyType( p->type ) && p->oredEnum != 0 ) ) { - fprintf( stderr, - " void %s( int )\n" - " void %s( uint )\n" - " void %s( unsigned int )\n", - (const char*) p->set, - (const char*) p->set, - (const char*) p->set ); - } - - if ( p->type == "TQCString" ) - fprintf( stderr, " void %s( const char* ) const\n", - (const char*) p->set ); - - if ( !candidates.isEmpty() ) { - fprintf( stderr, " but only found the mismatching candidate(s)\n"); - for ( Function* f = candidates.first(); f; f = candidates.next() ) { - TQCString typstr = ""; - Argument *a = f->args->first(); - int count = 0; - while ( a ) { - if ( !a->leftType.isEmpty() || ! a->rightType.isEmpty() ) { - if ( count++ ) - typstr += ","; - typstr += a->leftType; - typstr += a->rightType; - } - a = f->args->next(); - } - fprintf( stderr, " %s:%d: %s %s(%s)\n", g->fileName.data(), f->lineNo, - (const char*) f->type,(const char*) f->name, (const char*) typstr ); - } - } - } - } - } - } - - // - // Create meta data - // - if ( g->props.count() ) { - if ( displayWarnings && !TQ_OBJECTdetected ) - tqmoc_err("The declaration of the class \"%s\" contains properties" - " but no TQ_OBJECT macro.", g->className.data()); - - fprintf( out, "#ifndef TQT_NO_PROPERTIES\n" ); - - fprintf( out, " static const TQMetaProperty props_tbl[%d] = {\n ", g->props.count() ); - for( TQPtrListIterator<Property> it( g->props ); it.current(); ++it ) { - - fprintf( out, "\t{ \"%s\",\"%s\", ", it.current()->type.data(), it.current()->name.data() ); - int flags = Invalid; - if ( !isVariantType( it.current()->type ) ) { - flags |= EnumOrSet; - if ( !isEnumType( it.current()->type ) ) - flags |= UnresolvedEnum; - } else { - flags |= qvariant_nameToType( it.current()->type ) << 24; - } - if ( it.current()->getfunc ) - flags |= Readable; - if ( it.current()->setfunc ) { - flags |= Writable; - if ( it.current()->stdSet() ) - flags |= StdSet; - } - if ( it.current()->override ) - flags |= Override; - - if ( it.current()->designable.isEmpty() ) - flags |= DesignableOverride; - else if ( it.current()->designable == "false" ) - flags |= NotDesignable; - - if ( it.current()->scriptable.isEmpty() ) - flags |= ScriptableOverride; - else if ( it.current()->scriptable == "false" ) - flags |= NotScriptable; - - if ( it.current()->stored.isEmpty() ) - flags |= StoredOverride; - else if ( it.current()->stored == "false" ) - flags |= NotStored; - - - fprintf( out, "0x%.4x, ", flags ); - fprintf( out, "&%s::metaObj, ", (const char*) qualifiedClassName() ); - if ( !isVariantType( it.current()->type ) ) { - int enumpos = -1; - int k = 0; - for( TQPtrListIterator<Enum> eit( g->enums ); eit.current(); ++eit, ++k ) { - if ( eit.current()->name == it.current()->type ) - enumpos = k; - } - - // Is it an enum of this class ? - if ( enumpos != -1 ) - fprintf( out, "&enum_tbl[%i], ", enumpos ); - else - fprintf( out, "0, "); - } else { - fprintf( out, "0, "); - } - fprintf( out, "-1 }" ); - if ( !it.atLast() ) - fprintf( out, ",\n" ); - else - fprintf( out, "\n" ); - } - fprintf( out, " };\n" ); - fprintf( out, "#endif // TQT_NO_PROPERTIES\n" ); - } - - return g->props.count(); -} - - - -int generateClassInfos() -{ - if ( g->infos.isEmpty() ) - return 0; - - if ( displayWarnings && !TQ_OBJECTdetected ) - tqmoc_err("The declaration of the class \"%s\" contains class infos" - " but no TQ_OBJECT macro.", g->className.data()); - - fprintf( out, " static const TQClassInfo classinfo_tbl[] = {\n" ); - int i = 0; - for( TQPtrListIterator<ClassInfo> it( g->infos ); it.current(); ++it, ++i ) { - if ( i ) - fprintf( out, ",\n" ); - fprintf( out, "\t{ \"%s\", \"%s\" }", it.current()->name.data(),it.current()->value.data() ); - } - fprintf( out, "\n };\n" ); - return i; -} - - -void generateClass() // generate C++ source code for a class -{ - const char *hdr1 = "/****************************************************************************\n" - "** %s meta object code from reading C++ file '%s'\n**\n"; - const char *hdr2 = "** Created: %s\n"; - const char *hdr3 = "** WARNING! All changes made in this file will be lost!\n"; - const char *hdr4 = "*****************************************************************************/\n\n"; - int i; - - if ( skipClass ) // don't generate for class - return; - - if ( !TQ_OBJECTdetected ) { - if ( g->tqsignals.count() == 0 && g->tqslots.count() == 0 && g->props.count() == 0 && g->infos.count() == 0 ) - return; - if ( displayWarnings && (g->tqsignals.count() + g->tqslots.count()) != 0 ) - tqmoc_err("The declaration of the class \"%s\" contains tqsignals " - "or tqslots\n\t but no TQ_OBJECT macro.", g->className.data()); - } else { - if ( g->superClassName.isEmpty() ) - tqmoc_err("The declaration of the class \"%s\" contains the\n" - "\tTQ_OBJECT macro but does not inherit from any class!\n" - "\tInherit from TQObject or one of its descendants" - " or remove TQ_OBJECT.", g->className.data() ); - } - if ( templateClass ) { // don't generate for class - tqmoc_err( "Sorry, TQt does not support templates that contain\n" - "\ttqsignals, tqslots or TQ_OBJECT." ); - return; - } - g->generatedCode = TRUE; - g->gen_count++; - - if ( g->gen_count == 1 ) { // first class to be generated - TQDateTime dt = TQDateTime::tqcurrentDateTime(); - TQCString dstr = dt.toString().ascii(); - TQCString fn = g->fileName; - i = g->fileName.length()-1; - while ( i>0 && g->fileName[i-1] != '/' && g->fileName[i-1] != '\\' ) - i--; // skip path - if ( i >= 0 ) - fn = g->fileName.tqstringFromPos(i); - fprintf( out, hdr1, (const char*)qualifiedClassName(),(const char*)fn); - fprintf( out, hdr2, (const char*)dstr ); - fprintf( out, hdr3 ); - fprintf( out, hdr4 ); - - if ( !g->noInclude ) { - /* - The header file might be a TQt header file with - TQT_NO_COMPAT macros around tqsignals, tqslots or - properties. Without the #undef, we cannot compile the - TQt library with TQT_NO_COMPAT defined. - - Header files of libraries build around TQt can also use - TQT_NO_COMPAT, so this #undef might be beneficial to - users of TQt, and not only to developers of TQt. - */ - fprintf( out, "#undef TQT_NO_COMPAT\n" ); - - if ( !g->pchFile.isEmpty() ) - fprintf( out, "#include \"%s\" // PCH include\n", (const char*)g->pchFile ); - if ( !g->includePath.isEmpty() && g->includePath.right(1) != "/" ) - g->includePath += "/"; - - g->includeFiles.first(); - while ( g->includeFiles.current() ) { - TQCString inc = g->includeFiles.current(); - if ( inc[0] != '<' && inc[0] != '"' ) { - if ( !g->includePath.isEmpty() && g->includePath != "./" ) - inc.prepend( g->includePath ); - inc = "\"" + inc + "\""; - } - fprintf( out, "#include %s\n", (const char *)inc ); - g->includeFiles.next(); - } - } - fprintf( out, "#include <%stqmetaobject.h>\n", (const char*)g->qtPath ); - fprintf( out, "#include <%stqapplication.h>\n\n", (const char*)g->qtPath ); - fprintf( out, "#include <%sprivate/tqucomextra_p.h>\n", (const char*)g->qtPath ); - fprintf( out, "#if !defined(TQ_TQMOC_OUTPUT_REVISION) || (TQ_TQMOC_OUTPUT_REVISION != %d)\n", formatRevision ); - fprintf( out, "#error \"This file was generated using the tqmoc from %s." - " It\"\n#error \"cannot be used with the include files from" - " this version of TQt.\"\n#error \"(The tqmoc has changed too" - " much.)\"\n", TQT_VERSION_STR ); - fprintf( out, "#endif\n\n" ); - } else { - fprintf( out, "\n\n" ); - } - - if ( !g->hasVariantIncluded ) { - bool needToIncludeVariant = !g->props.isEmpty(); - for ( Function* f =g->tqslots.first(); f && !needToIncludeVariant; f=g->tqslots.next() ) - needToIncludeVariant = ( f->type != "void" && !validUType( f->type ) && isVariantType( f->type) ); - - if ( needToIncludeVariant ) { - fprintf( out, "#include <%stqvariant.h>\n", (const char*)g->qtPath ); - g->hasVariantIncluded = TRUE; - } - } - - bool isTQObject = g->className == "TQObject" ; - - -// -// Generate virtual function className() -// - fprintf( out, "const char *%s::className() const\n{\n ", - (const char*)qualifiedClassName() ); - fprintf( out, "return \"%s\";\n}\n\n", (const char*)qualifiedClassName() ); - -// -// Generate static metaObj variable -// - fprintf( out, "TQMetaObject *%s::metaObj = 0;\n", (const char*)qualifiedClassName()); - -// -// Generate static cleanup object variable -// - TQCString cleanup = qualifiedClassName().copy(); - for ( int cnpos = 0; cnpos < cleanup.length(); cnpos++ ) { - if ( cleanup[cnpos] == ':' ) - cleanup[cnpos] = '_'; - } - - fprintf( out, "static TQMetaObjectCleanUp cleanUp_%s( \"%s\", &%s::staticMetaObject );\n\n", (const char*)cleanup, (const char*)qualifiedClassName(), (const char*)qualifiedClassName() ); - -// -// Generate tr and trUtf8 member functions -// - fprintf( out, "#ifndef TQT_NO_TRANSLATION\n" ); - fprintf( out, "TQString %s::tr( const char *s, const char *c )\n{\n", - (const char*)qualifiedClassName() ); - fprintf( out, " if ( tqApp )\n" ); - fprintf( out, "\treturn tqApp->translate( \"%s\", s, c," - " TQApplication::DefaultCodec );\n", - (const char*)qualifiedClassName() ); - fprintf( out, " else\n" ); - fprintf( out, "\treturn TQString::tqfromLatin1( s );\n"); - fprintf( out, "}\n" ); - fprintf( out, "#ifndef TQT_NO_TRANSLATION_UTF8\n" ); - fprintf( out, "TQString %s::trUtf8( const char *s, const char *c )\n{\n", - (const char*)qualifiedClassName() ); - fprintf( out, " if ( tqApp )\n" ); - fprintf( out, "\treturn tqApp->translate( \"%s\", s, c," - " TQApplication::UnicodeUTF8 );\n", - (const char*)qualifiedClassName() ); - fprintf( out, " else\n" ); - fprintf( out, "\treturn TQString::fromUtf8( s );\n" ); - fprintf( out, "}\n" ); - fprintf( out, "#endif // TQT_NO_TRANSLATION_UTF8\n\n" ); - fprintf( out, "#endif // TQT_NO_TRANSLATION\n\n" ); - -// -// Generate staticMetaObject member function -// - fprintf( out, "TQMetaObject* %s::staticMetaObject()\n{\n", (const char*)qualifiedClassName() ); - fprintf( out, " if ( metaObj )\n\treturn metaObj;\n" ); - if ( isTQObject ) - fprintf( out, " TQMetaObject* parentObject = staticTQtMetaObject();\n" ); - else if ( !g->superClassName.isEmpty() ) - if (g->superClassName.find("TQ") == 0) { // [FIXME] Verify that this will always be able to detect a TQt base class, even if intermediate classes do not start with TQ - fprintf( out, " TQMetaObject* parentObject = %s::staticMetaObject();\n", (const char*)g->superClassName ); - } - else { - fprintf( out, " TQMetaObject* parentObject = 0;\n" ); - } - else - fprintf( out, " TQMetaObject* parentObject = 0;\n" ); - -// -// Build the classinfo array -// - int n_infos = generateClassInfos(); - -// Build the enums array -// Enums HAVE to be generated BEFORE the properties and tqslots -// - int n_enums = generateEnums(); - -// -// Build tqslots array in staticMetaObject() -// - generateFuncs( &g->tqslots, "slot", Slot_Num ); - -// -// Build tqsignals array in staticMetaObject() -// - generateFuncs( &g->tqsignals, "signal", Signal_Num ); - -// -// Build property array in staticMetaObject() -// - int n_props = generateProps(); - -// -// Finally code to create and return meta object -// - fprintf( out, " metaObj = TQMetaObject::new_metaobject(\n" - "\t\"%s\", parentObject,\n", (const char*)qualifiedClassName() ); - - if ( g->tqslots.count() ) - fprintf( out, "\tslot_tbl, %d,\n", g->tqslots.count() ); - else - fprintf( out, "\t0, 0,\n" ); - - if ( g->tqsignals.count() ) - fprintf( out, "\tsignal_tbl, %d,\n", g->tqsignals.count() ); - else - fprintf( out, "\t0, 0,\n" ); - - fprintf( out, "#ifndef TQT_NO_PROPERTIES\n" ); - if ( n_props ) - fprintf( out, "\tprops_tbl, %d,\n", n_props ); - else - fprintf( out, "\t0, 0,\n" ); - if ( n_enums ) - fprintf( out, "\tenum_tbl, %d,\n", n_enums ); - else - fprintf( out, "\t0, 0,\n" ); - fprintf( out, "#endif // TQT_NO_PROPERTIES\n" ); - - if ( n_infos ) - fprintf( out, "\tclassinfo_tbl, %d );\n", n_infos ); - else - fprintf( out, "\t0, 0 );\n" ); - - -// -// Setup cleanup handler and return meta object -// - fprintf( out, " cleanUp_%s.setMetaObject( metaObj );\n", cleanup.data() ); - fprintf( out, " return metaObj;\n}\n" ); - -// -// End of function staticMetaObject() -// - -// -// Generate smart cast function -// - fprintf( out, "\nvoid* %s::qt_cast( const char* clname )\n{\n", - (const char*)qualifiedClassName() ); - fprintf( out, " if ( !qstrcmp( clname, \"%s\" ) )\n" - "\treturn this;\n", - (const char*)qualifiedClassName() ); - for ( const char* cname = g->multipleSuperClasses.first(); cname; cname = g->multipleSuperClasses.next() ) { - fprintf( out, " if ( !qstrcmp( clname, \"%s\" ) )\n", cname); - TQCString fixed(cname); - while (fixed.find(">>") != -1) - fixed = fixed.replace(">>", "> >"); - fprintf( out, "\treturn (%s*)this;\n", fixed.data()); - } - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, " return %sqt_cast( clname );\n", - (const char*)callablePurestSuperClassName() ); - else - fprintf( out, " return 0;\n" ); - fprintf( out, "}\n" ); - -// -// Generate internal signal functions -// - Function *f; - f = g->tqsignals.first(); // make internal signal methods - static bool included_list_headers = FALSE; - int sigindex = 0; - while ( f ) { - TQCString argstr; - char buf[12]; - Argument *a = f->args->first(); - int offset = 0; - const char *predef_call_func = 0; - bool hasReturnValue = f->type != "void" && (validUType( f->type ) || isVariantType( f->type) ); - if ( hasReturnValue ) { - ; // no predefined function available - } else if ( !a ) { - predef_call_func = "activate_signal"; - } else if ( f->args->count() == 1 ) { - TQCString ctype = (a->leftType + ' ' + a->rightType).simplifyWhiteSpace(); - if ( !isInOut( ctype ) ) { - TQCString utype = uType( ctype ); - if ( utype == "bool" ) - predef_call_func = "activate_signal_bool"; - else if ( utype == "TQString" || utype == "int" || utype == "double" ) - predef_call_func = "activate_signal"; - } - } - - if ( !predef_call_func && !included_list_headers ) { - // yes we need it, because otherwise TQT_VERSION may not be defined - fprintf( out, "\n#include <%stqobjectdefs.h>\n", (const char*)g->qtPath ); - fprintf( out, "#include <%stqsignalslotimp.h>\n", (const char*)g->qtPath ); - included_list_headers = TRUE; - } - - while ( a ) { // argument list - if ( !a->leftType.isEmpty() || !a->rightType.isEmpty() ) { - argstr += a->leftType; - argstr += " "; - sprintf( buf, "t%d", offset++ ); - argstr += buf; - argstr += a->rightType; - a = f->args->next(); - if ( a ) - argstr += ", "; - } else { - a = f->args->next(); - } - } - - fixRightAngles( &argstr ); - - fprintf( out, "\n// SIGNAL %s\n", (const char*)f->name ); - fprintf( out, "%s %s::%s(", (const char*) f->type, - (const char*)qualifiedClassName(), - (const char*)f->name ); - - if ( argstr.isEmpty() ) - fprintf( out, ")\n{\n" ); - else - fprintf( out, " %s )\n{\n", (const char*)argstr ); - - if ( predef_call_func ) { - fprintf( out, " %s%s( staticMetaObject()->signalOffset() + %d", (const char *) callablePurestSuperClassName(), predef_call_func, sigindex ); - if ( !argstr.isEmpty() ) - fprintf( out, ", t0" ); - fprintf( out, " );\n}\n" ); - } else { - if ( hasReturnValue ) - fprintf( out, " %s something;\n", f->type.data() ); - int nargs = f->args->count(); - fprintf( out, " if ( tqsignalsBlocked() )\n\treturn%s;\n", hasReturnValue ? " something" : "" ); - fprintf( out, " TQConnectionList *clist = tqreceivers( staticMetaObject()->signalOffset() + %d );\n", - sigindex ); - fprintf( out, " if ( !clist )\n\treturn%s;\n", hasReturnValue ? " something" : "" ); - fprintf( out, " TQUObject o[%d];\n", f->args->count() + 1 ); - - // initialize return value to something - if ( hasReturnValue ) { - if ( validUType( f->type ) ) { - TQCString utype = uType( f->type ); - fprintf( out, " static_TQUType_%s.set(o,something);\n", utype.data() ); - } else if ( uType( f->type ) == "varptr" ) { - fprintf( out, " static_TQUType_varptr.set(o,&something);\n" ); - } else { - fprintf( out, " static_TQUType_ptr.set(o,&something);\n" ); - } - } - - // initialize arguments - if ( !f->args->isEmpty() ) { - offset = 0; - Argument* a = f->args->first(); - while ( a ) { - TQCString type = a->leftType + ' ' + a->rightType; - type = type.simplifyWhiteSpace(); - if ( validUType( type ) ) { - TQCString utype = uType( type ); - fprintf( out, " static_TQUType_%s.set(o+%d,t%d);\n", utype.data(), offset+1, offset ); - } else if ( uType( type ) == "varptr" ) { - fprintf( out, " static_TQUType_varptr.set(o+%d,&t%d);\n", offset+1, offset ); - } else { - fprintf( out, " static_TQUType_ptr.set(o+%d,&t%d);\n", offset+1, offset ); - } - a = f->args->next(); - offset++; - } - } - fprintf( out, " activate_signal( clist, o );\n" ); - - // get return values from inOut parameters - if ( !f->args->isEmpty() ) { - offset = 0; - Argument* a = f->args->first(); - while ( a ) { - TQCString type = a->leftType + ' ' + a->rightType; - type = type.simplifyWhiteSpace(); - if ( validUType( type ) && isInOut( type ) ) { - TQCString utype = uType( type ); - if ( utype == "enum" ) - fprintf( out, " t%d = (%s)static_TQUType_%s.get(o+%d);\n", offset, type.data(), utype.data(), offset+1 ); - else if ( utype == "ptr" && type.right(2) == "**" ) - fprintf( out, " if (t%d) *t%d = *(%s)static_TQUType_ptr.get(o+%d);\n", offset, offset, type.data(), offset+1 ); - else - fprintf( out, " t%d = static_TQUType_%s.get(o+%d);\n", offset, utype.data(), offset+1 ); - } - a = f->args->next(); - offset++; - } - } - - // get and return return value - if ( hasReturnValue ) { - TQCString utype = uType( f->type ); - if ( utype == "enum" || utype == "ptr" || utype == "varptr" ) // need cast - fprintf( out, " return (%s)static_TQUType_%s.get(o);\n", f->type.data(), utype.data() ); - else - fprintf( out, " return static_TQUType_%s.get(o);\n", utype.data() ); - } - - fprintf( out, "}\n" ); - } - - f = g->tqsignals.next(); - sigindex++; - } - - -// -// Generate internal qt_invoke() function -// - fprintf( out, "\nbool %s::qt_invoke( int _id, TQUObject* _o )\n{\n", qualifiedClassName().data() ); - - if( !g->tqslots.isEmpty() ) { - fprintf( out, " switch ( _id - staticMetaObject()->slotOffset() ) {\n" ); - int slotindex = -1; - for ( f = g->tqslots.first(); f; f = g->tqslots.next() ) { - slotindex ++; - if ( f->type == "void" && f->args->isEmpty() ) { - fprintf( out, " case %d: %s(); break;\n", slotindex, f->name.data() ); - continue; - } - - fprintf( out, " case %d: ", slotindex ); - bool hasReturnValue = FALSE; - bool hasVariantReturn = FALSE; - if ( f->type != "void" ) { - if ( validUType( f->type )) { - hasReturnValue = TRUE; - fprintf( out, "static_TQUType_%s.set(_o,", uType(f->type).data() ); - } else if ( isVariantType( f->type ) ) { - hasReturnValue = hasVariantReturn = TRUE; - // do not need special handling for bool since this is handled as utype - fprintf( out, "static_TQUType_TQVariant.set(_o,TQVariant(" ); - } - } - int offset = 0; - fprintf( out, "%s(", f->name.data() ); - Argument* a = f->args->first(); - while ( a ) { - TQCString type = a->leftType + ' ' + a->rightType; - type = type.simplifyWhiteSpace(); - fixRightAngles( &type ); - if ( validUType( type ) ) { - TQCString utype = uType( type ); - if ( utype == "ptr" || utype == "varptr" || utype == "enum" ) - fprintf( out, "(%s)static_TQUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); - else - fprintf( out, "(%s)static_TQUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); - } else { - TQCString castType = castToUType( type ); - if(castType == type) - fprintf( out, "(%s)(*((%s*)static_TQUType_ptr.get(_o+%d)))", type.data(), - castType.data(), offset+1 ); - else - fprintf( out, "(%s)*((%s*)static_TQUType_ptr.get(_o+%d))", type.data(), - castType.data(), offset+1 ); - } - a = f->args->next(); - if ( a ) - fprintf( out, "," ); - offset++; - } - fprintf( out, ")" ); - if ( hasReturnValue ) - fprintf( out, ")" ); - if ( hasVariantReturn ) - fprintf( out, ")" ); - fprintf( out, "; break;\n" ); - } - fprintf( out, " default:\n" ); - - if ( !g->superClassName.isEmpty() && !isTQObject ) { - fprintf( out, "\treturn %sqt_invoke( _id, _o );\n", - (const char *) callablePurestSuperClassName() ); - } else { - fprintf( out, "\treturn FALSE;\n" ); - } - fprintf( out, " }\n" ); - fprintf( out, " return TRUE;\n}\n" ); - } else { - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, " return %sqt_invoke(_id,_o);\n}\n", - (const char *) callablePurestSuperClassName() ); - else - fprintf( out, " return FALSE;\n}\n" ); - } - - -// -// Generate internal qt_emit() function -// - fprintf( out, "\nbool %s::qt_emit( int _id, TQUObject* _o )\n{\n", qualifiedClassName().data() ); - - if ( !g->tqsignals.isEmpty() ) { - fprintf( out, " switch ( _id - staticMetaObject()->signalOffset() ) {\n" ); - int signalindex = -1; - for ( f = g->tqsignals.first(); f; f = g->tqsignals.next() ) { - signalindex++; - if ( f->type == "void" && f->args->isEmpty() ) { - fprintf( out, " case %d: %s(); break;\n", signalindex, f->name.data() ); - continue; - } - - fprintf( out, " case %d: ", signalindex ); - bool hasReturnValue = FALSE; - if ( f->type != "void" && validUType( f->type )) { - hasReturnValue = TRUE; - fprintf( out, "static_TQUType_%s.set(_o,", uType(f->type).data() ); - } - int offset = 0; - fprintf( out, "%s(", f->name.data() ); - Argument* a = f->args->first(); - while ( a ) { - TQCString type = a->leftType + ' ' + a->rightType; - type = type.simplifyWhiteSpace(); - fixRightAngles( &type ); - if ( validUType( type ) ) { - TQCString utype = uType( type ); - if ( utype == "ptr" || utype == "varptr" || utype == "enum" ) - fprintf( out, "(%s)static_TQUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); - else - fprintf( out, "(%s)static_TQUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); - } else { - TQCString castType = castToUType( type ); - if(castType == type) - fprintf( out, "(%s)(*((%s*)static_TQUType_ptr.get(_o+%d)))", type.data(), - castType.data(), offset+1 ); - else - fprintf( out, "(%s)*((%s*)static_TQUType_ptr.get(_o+%d))", type.data(), - castType.data(), offset+1 ); - } - a = f->args->next(); - if ( a ) - fprintf( out, "," ); - offset++; - } - fprintf( out, ")" ); - if ( hasReturnValue ) - fprintf( out, ")" ); - fprintf( out, "; break;\n" ); - } - fprintf( out, " default:\n" ); - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, "\treturn %sqt_emit(_id,_o);\n", - (const char *) callablePurestSuperClassName() ); - else - fprintf( out, "\treturn FALSE;\n" ); - fprintf( out, " }\n" ); - fprintf( out, " return TRUE;\n}\n" ); - } else { - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, " return %sqt_emit(_id,_o);\n}\n", - (const char *) callablePurestSuperClassName() ); - else - fprintf( out, " return FALSE;\n}\n" ); - } - - - fprintf( out, "#ifndef TQT_NO_PROPERTIES\n" ); -// -// Generate internal qt_property() functions -// - - fprintf( out, "\nbool %s::qt_property( int id, int f, TQVariant* v)\n{\n", qualifiedClassName().data() ); - - if ( !g->props.isEmpty() ) { - fprintf( out, " switch ( id - staticMetaObject()->propertyOffset() ) {\n" ); - int propindex = -1; - bool need_resolve = FALSE; - - for( TQPtrListIterator<Property> it( g->props ); it.current(); ++it ){ - propindex ++; - fprintf( out, " case %d: ", propindex ); - fprintf( out, "switch( f ) {\n" ); - - uint flag_break = 0; - uint flag_propagate = 0; - - if ( it.current()->setfunc ) { - fprintf( out, "\tcase 0: %s(", it.current()->setfunc->name.data() ); - TQCString type = it.current()->type.copy(); // detach on purpose - if ( it.current()->oredEnum ) - type = it.current()->enumsettype; - if ( type == "uint" ) - fprintf( out, "v->asUInt()" ); - else if ( type == "unsigned int" ) - fprintf( out, "(uint)v->asUInt()" ); - else if ( type == "TQMap<TQString,TQVariant>" ) - fprintf( out, "v->asMap()" ); - else if ( type == "TQValueList<TQVariant>" ) - fprintf( out, "v->asList()" ); - else if ( type == "TQ_LLONG" ) - fprintf( out, "v->asLongLong()" ); - else if ( type == "TQ_ULLONG" ) - fprintf( out, "v->asULongLong()" ); - else if ( isVariantType( type ) ) { - if (( type[0] == 'T' ) && ( type[1] == 'Q' )) - type = type.mid(2); - else - type[0] = toupper( type[0] ); - fprintf( out, "v->as%s()", type.data() ); - } else { - fprintf( out, "(%s&)v->asInt()", type.data() ); - } - fprintf( out, "); break;\n" ); - - } else if ( it.current()->override ) { - flag_propagate |= 1 << (0+1); - } - if ( it.current()->getfunc ) { - if ( it.current()->gspec == Property::Pointer ) - fprintf( out, "\tcase 1: if ( this->%s() ) *v = TQVariant( %s*%s()%s ); break;\n", - it.current()->getfunc->name.data(), - !isVariantType( it.current()->type ) ? "(int)" : "", - it.current()->getfunc->name.data(), - it.current()->type == "bool" ? ", 0" : "" ); - else - fprintf( out, "\tcase 1: *v = TQVariant( %sthis->%s()%s ); break;\n", - !isVariantType( it.current()->type ) ? "(int)" : "", - it.current()->getfunc->name.data(), - it.current()->type == "bool" ? ", 0" : "" ); - } else if ( it.current()->override ) { - flag_propagate |= 1<< (1+1); - } - - if ( !it.current()->reset.isEmpty() ) - fprintf( out, "\tcase 2: this->%s(); break;\n", it.current()->reset.data() ); - - if ( it.current()->designable.isEmpty() ) - flag_propagate |= 1 << (3+1); - else if ( it.current()->designable == "true" ) - flag_break |= 1 << (3+1); - else if ( it.current()->designable != "false" ) - fprintf( out, "\tcase 3: return this->%s();\n", it.current()->designable.data() ); - - if ( it.current()->scriptable.isEmpty() ) - flag_propagate |= 1 << (4+1); - else if ( it.current()->scriptable == "true" ) - flag_break |= 1 << (4+1); - else if ( it.current()->scriptable != "false" ) - fprintf( out, "\tcase 4: return this->%s();\n", it.current()->scriptable.data() ); - - if ( it.current()->stored.isEmpty() ) - flag_propagate |= 1 << (5+1); - else if ( it.current()->stored == "true" ) - flag_break |= 1 << (5+1); - else if ( it.current()->stored != "false" ) - fprintf( out, "\tcase 5: return this->%s();\n", it.current()->stored.data() ); - - int i = 0; - if ( flag_propagate != 0 ) { - fprintf( out, "\t" ); - for ( i = 0; i <= 5; i++ ) { - if ( flag_propagate & (1 << (i+1) ) ) - fprintf( out, "case %d: ", i ); - } - if (!g->superClassName.isEmpty() && !isTQObject ) { - fprintf( out, "goto resolve;\n" ); - need_resolve = TRUE; - } else { - fprintf( out, " return FALSE;\n" ); - } - } - if ( flag_break != 0 ) { - fprintf( out, "\t" ); - for ( i = 0; i <= 5; i++ ) { - if ( flag_break & (1 << (i+1) ) ) - fprintf( out, "case %d: ", i ); - } - fprintf( out, "break;\n"); - } - - fprintf( out, "\tdefault: return FALSE;\n } break;\n" ); - } - fprintf( out, " default:\n" ); - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, "\treturn %sqt_property( id, f, v );\n", - (const char *) callablePurestSuperClassName() ); - else - fprintf( out, "\treturn FALSE;\n" ); - fprintf( out, " }\n" ); - fprintf( out, " return TRUE;\n" ); - - if ( need_resolve ) - fprintf( out, "resolve:\n return %sqt_property( staticMetaObject()->resolveProperty(id), f, v );\n", - (const char *) callablePurestSuperClassName() ); - fprintf( out, "}\n" ); - } else { - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, " return %sqt_property( id, f, v);\n}\n", - (const char *) callablePurestSuperClassName() ); - else - fprintf( out, " return FALSE;\n}\n" ); - } - - fprintf( out, "\nbool %s::qt_static_property( TQObject* , int , int , TQVariant* ){ return FALSE; }\n", qualifiedClassName().data() ); - fprintf( out, "#endif // TQT_NO_PROPERTIES\n" ); -} - - -ArgList *addArg( Argument *a ) // add argument to list -{ - if ( (!a->leftType.isEmpty() || !a->rightType.isEmpty() ) ) //filter out truely void arguments - tmpArgList->append( a ); - return tmpArgList; -} - -void addEnum() -{ - // Avoid duplicates - for( TQPtrListIterator<Enum> lit( g->enums ); lit.current(); ++lit ) { - if ( lit.current()->name == tmpEnum->name ) - { - if ( displayWarnings ) - tqmoc_err( "Enum %s defined twice.", (const char*)tmpEnum->name ); - } - } - - // Only look at types mentioned in TQ_ENUMS and TQ_SETS - if ( g->qtEnums.contains( tmpEnum->name ) || g->qtSets.contains( tmpEnum->name ) ) - { - g->enums.append( tmpEnum ); - if ( g->qtSets.contains( tmpEnum->name ) ) - tmpEnum->set = TRUE; - else - tmpEnum->set = FALSE; - } - else - delete tmpEnum; - tmpEnum = new Enum; -} - -void addMember( Member m ) -{ - if ( skipFunc ) { - tmpFunc->args = tmpArgList; // just to be sure - delete tmpFunc; - tmpArgList = new ArgList; // ugly but works - tmpFunc = new Function; - skipFunc = FALSE; - return; - } - - tmpFunc->type = tmpFunc->type.simplifyWhiteSpace(); - tmpFunc->access = tmpAccess; - tmpFunc->args = tmpArgList; - tmpFunc->lineNo = lineNo; - - for ( ;; ) { - g->funcs.append( tmpFunc ); - - if ( m == SignalMember ) { - g->tqsignals.append( tmpFunc ); - break; - } else { - if ( m == SlotMember ) - g->tqslots.append( tmpFunc ); - // PropertyCandidateMember or SlotMember - if ( !tmpFunc->name.isEmpty() && tmpFunc->access == Public ) - g->propfuncs.append( tmpFunc ); - if ( !tmpFunc->args || !tmpFunc->args->hasDefaultArguments() ) - break; - tmpFunc = new Function( *tmpFunc ); - tmpFunc->args = tmpFunc->args->magicClone(); - } - } - - skipFunc = FALSE; - tmpFunc = new Function; - tmpArgList = new ArgList; -} - -void checkPropertyName( const char* ident ) -{ - if ( ident[0] == '_' ) { - tqmoc_err( "Invalid property name '%s'.", ident ); - return; - } -} diff --git a/tqtinterface/qt4/src/tqmoc/tqmoc_lex.cpp b/tqtinterface/qt4/src/tqmoc/tqmoc_lex.cpp deleted file mode 100644 index 09016ba..0000000 --- a/tqtinterface/qt4/src/tqmoc/tqmoc_lex.cpp +++ /dev/null @@ -1,3319 +0,0 @@ -#line 2 "tqmoc_lex.cpp" - -#line 4 "tqmoc_lex.cpp" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include <stdlib.h> - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include <inttypes.h> -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -extern int yyleng; - -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); - -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); - -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -typedef unsigned char YY_CHAR; - -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; - -typedef int yy_state_type; - -extern int yylineno; - -int yylineno = 1; - -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 151 -#define YY_END_OF_BUFFER 152 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[624] = - { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 152, 151, - 139, 150, 151, 139, 134, 146, 139, 146, 146, 105, - 105, 105, 105, 105, 139, 134, 148, 139, 113, 148, - 148, 148, 130, 148, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 139, 134, 140, 139, 140, 140, 106, - 106, 106, 106, 15, 16, 139, 134, 141, 139, 141, - 141, 107, 107, 107, 107, 107, 28, 29, 139, 134, - - 145, 139, 54, 55, 58, 145, 59, 56, 57, 60, - 139, 134, 143, 139, 42, 43, 46, 143, 47, 44, - 45, 139, 134, 144, 139, 48, 49, 52, 144, 53, - 50, 51, 139, 134, 142, 139, 111, 142, 13, 14, - 139, 134, 137, 137, 112, 61, 62, 137, 137, 134, - 149, 139, 149, 139, 134, 147, 139, 147, 139, 134, - 34, 35, 100, 100, 100, 100, 100, 104, 101, 102, - 103, 139, 136, 135, 139, 134, 134, 134, 0, 108, - 0, 105, 105, 105, 105, 105, 113, 0, 0, 123, - 0, 0, 132, 131, 130, 92, 99, 99, 99, 99, - - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, 0, 109, - 0, 106, 106, 106, 106, 106, 0, 110, 0, 107, - 107, 107, 107, 107, 111, 0, 138, 112, 0, 138, - 100, 100, 100, 100, 100, 100, 104, 0, 135, 134, - 105, 105, 105, 105, 114, 0, 0, 114, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, - 131, 99, 99, 87, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 76, 99, 99, 99, 99, 99, - - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 106, 106, 106, - 106, 106, 107, 107, 107, 107, 100, 100, 100, 100, - 100, 100, 134, 105, 105, 105, 105, 129, 125, 124, - 126, 0, 127, 122, 115, 116, 117, 118, 119, 120, - 121, 0, 99, 99, 99, 99, 99, 99, 65, 74, - 99, 99, 99, 83, 99, 99, 99, 99, 77, 99, - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, 99, 82, - 99, 106, 106, 106, 106, 106, 106, 106, 106, 106, - - 106, 107, 107, 107, 107, 100, 36, 100, 100, 100, - 100, 134, 1, 105, 105, 3, 127, 128, 99, 99, - 99, 99, 99, 99, 99, 84, 72, 99, 99, 80, - 99, 99, 99, 99, 99, 99, 99, 99, 99, 75, - 99, 99, 99, 99, 96, 99, 99, 99, 86, 99, - 97, 99, 99, 106, 106, 106, 106, 106, 106, 106, - 106, 106, 106, 106, 30, 107, 107, 33, 100, 39, - 100, 100, 37, 134, 105, 105, 99, 99, 99, 99, - 99, 99, 99, 81, 68, 63, 69, 99, 99, 99, - 99, 99, 90, 99, 78, 67, 85, 99, 99, 99, - - 99, 99, 99, 99, 106, 106, 106, 106, 106, 106, - 106, 106, 17, 106, 106, 107, 107, 100, 100, 38, - 134, 105, 105, 99, 99, 99, 99, 99, 12, 99, - 95, 99, 99, 88, 99, 99, 99, 99, 7, 64, - 99, 71, 99, 106, 106, 106, 106, 106, 27, 19, - 106, 106, 21, 107, 107, 100, 100, 134, 134, 105, - 4, 99, 11, 99, 99, 99, 99, 99, 91, 99, - 66, 94, 99, 79, 73, 106, 26, 106, 106, 106, - 106, 106, 107, 31, 100, 100, 133, 2, 99, 5, - 99, 99, 99, 98, 89, 6, 106, 23, 106, 106, - - 18, 20, 32, 100, 100, 99, 99, 99, 70, 106, - 106, 106, 40, 41, 99, 10, 9, 106, 25, 24, - 8, 22, 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, - 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 1, 5, 6, 1, 1, 1, 7, 8, - 9, 10, 1, 11, 1, 12, 13, 14, 15, 15, - 15, 15, 15, 15, 15, 16, 16, 17, 18, 19, - 1, 20, 1, 1, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 28, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 28, 43, 28, - 44, 45, 46, 1, 47, 1, 48, 49, 50, 51, - - 52, 53, 54, 55, 56, 28, 28, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 28, 71, 1, 72, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst flex_int32_t yy_meta[73] = - { 0, - 1, 1, 1, 2, 3, 1, 4, 1, 1, 1, - 1, 1, 1, 5, 5, 5, 1, 1, 1, 1, - 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 1, 1, 1, 6, 5, 5, 5, - 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 1, 1 - } ; - -static yyconst flex_int16_t yy_base[651] = - { 0, - 0, 3, 16, 5, 88, 9, 160, 232, 304, 178, - 375, 446, 183, 517, 252, 562, 209, 213, 607, 652, - 255, 286, 270, 388, 698, 187, 394, 407, 1202, 1203, - 180, 1203, 185, 379, 1150, 1203, 186, 219, 187, 0, - 1143, 1151, 1146, 1133, 420, 1145, 1203, 200, 1150, 221, - 413, 197, 418, 1177, 0, 1157, 1145, 203, 380, 1131, - 161, 237, 1131, 1129, 1122, 1139, 1125, 216, 1133, 386, - 391, 227, 344, 460, 1133, 1203, 206, 257, 404, 0, - 1147, 373, 1120, 1203, 1203, 465, 1130, 1203, 442, 433, - 459, 0, 1123, 1131, 1126, 1113, 1203, 1203, 471, 1125, - - 1203, 473, 1203, 1203, 1203, 469, 1203, 1203, 1203, 1203, - 478, 1124, 1203, 483, 1203, 1203, 1203, 478, 1203, 1203, - 1203, 491, 1123, 1203, 493, 1203, 1203, 1203, 488, 1203, - 1203, 1203, 497, 1122, 1203, 502, 1127, 496, 1203, 1203, - 505, 1120, 1203, 510, 1125, 1203, 1203, 504, 530, 1118, - 1203, 513, 514, 535, 1117, 1203, 537, 521, 540, 1116, - 1203, 1203, 0, 1141, 1140, 385, 1127, 1118, 1203, 1203, - 1203, 542, 1203, 0, 545, 0, 0, 1110, 465, 1203, - 1157, 0, 1112, 1101, 1100, 1101, 1111, 545, 1148, 1147, - 766, 1141, 538, 541, 562, 1203, 0, 1105, 1095, 1092, - - 1084, 1100, 1099, 1087, 1079, 1078, 1078, 1082, 1085, 230, - 1081, 1074, 1080, 1085, 400, 1087, 1081, 1074, 1079, 332, - 1074, 1068, 1066, 1068, 503, 1072, 1064, 525, 484, 1203, - 1122, 0, 1078, 427, 1075, 1059, 517, 1203, 1118, 0, - 1073, 1062, 1061, 1062, 1072, 579, 583, 1071, 583, 587, - 0, 1077, 368, 1077, 1079, 1083, 1066, 587, 0, 1057, - 1045, 1056, 1046, 1047, 1203, 1098, 1097, 1096, 587, 589, - 1095, 1094, 1093, 1092, 1091, 1090, 1089, 1088, 1087, 1203, - 583, 594, 1034, 0, 1032, 1028, 1026, 1025, 1039, 1029, - 1034, 1037, 1032, 1027, 0, 1028, 1033, 1028, 1016, 1011, - - 1012, 1019, 1019, 1011, 1014, 1007, 1005, 1009, 1009, 557, - 1016, 1007, 1010, 1006, 999, 1012, 1014, 599, 994, 995, - 1002, 574, 994, 1005, 995, 996, 1025, 1029, 1027, 1022, - 1013, 1010, 992, 983, 982, 988, 990, 1203, 1203, 1203, - 1203, 628, 1203, 1203, 1203, 1203, 1203, 1203, 1203, 1203, - 1203, 1036, 1011, 1008, 538, 1003, 1014, 981, 0, 0, - 973, 971, 978, 0, 971, 968, 973, 972, 0, 981, - 965, 980, 979, 974, 969, 960, 958, 970, 965, 970, - 962, 950, 963, 956, 964, 955, 959, 958, 945, 0, - 945, 978, 975, 599, 970, 981, 957, 952, 947, 948, - - 941, 936, 935, 941, 943, 969, 0, 956, 959, 968, - 967, 932, 0, 929, 941, 0, 1203, 1203, 967, 947, - 956, 960, 950, 944, 926, 0, 0, 929, 921, 0, - 928, 926, 920, 915, 910, 909, 919, 911, 890, 0, - 899, 899, 877, 893, 0, 877, 870, 875, 0, 860, - 0, 863, 850, 884, 857, 861, 809, 798, 791, 763, - 777, 776, 765, 758, 0, 761, 773, 0, 787, 0, - 779, 793, 0, 764, 765, 747, 772, 777, 783, 770, - 771, 767, 745, 0, 0, 0, 0, 751, 754, 741, - 748, 734, 0, 746, 0, 0, 0, 732, 748, 731, - - 741, 741, 735, 734, 752, 757, 763, 750, 751, 747, - 732, 718, 0, 734, 715, 730, 712, 755, 754, 0, - 729, 722, 645, 657, 656, 670, 655, 666, 0, 638, - 0, 639, 625, 0, 635, 623, 633, 627, 0, 0, - 632, 0, 630, 643, 642, 656, 641, 652, 0, 0, - 624, 618, 0, 624, 621, 648, 647, 623, 591, 615, - 0, 637, 0, 625, 634, 625, 612, 600, 0, 599, - 0, 0, 585, 0, 0, 619, 0, 608, 617, 608, - 593, 577, 587, 0, 607, 594, 1203, 0, 590, 0, - 594, 568, 558, 0, 0, 0, 567, 0, 548, 530, - - 0, 0, 0, 533, 477, 439, 433, 388, 0, 361, - 276, 232, 0, 0, 219, 0, 0, 189, 0, 0, - 0, 0, 1203, 835, 841, 847, 853, 859, 865, 871, - 877, 883, 889, 895, 897, 903, 909, 911, 917, 919, - 925, 927, 933, 939, 941, 947, 953, 959, 962, 967 - } ; - -static yyconst flex_int16_t yy_def[651] = - { 0, - 624, 624, 623, 3, 623, 5, 625, 625, 623, 9, - 626, 626, 627, 627, 628, 628, 629, 629, 630, 630, - 631, 631, 632, 632, 623, 25, 624, 624, 623, 623, - 623, 623, 623, 623, 633, 623, 623, 634, 623, 635, - 635, 635, 635, 635, 623, 633, 623, 623, 636, 637, - 623, 623, 623, 623, 638, 638, 638, 638, 638, 638, - 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - 638, 638, 638, 623, 633, 623, 623, 639, 623, 640, - 640, 640, 640, 623, 623, 623, 633, 623, 623, 641, - 623, 642, 642, 642, 642, 642, 623, 623, 623, 633, - - 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 633, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 633, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 633, 623, 623, 643, 623, 623, 623, - 623, 633, 623, 623, 644, 623, 623, 623, 623, 633, - 623, 623, 623, 623, 633, 623, 623, 623, 623, 633, - 623, 623, 645, 645, 645, 645, 645, 646, 623, 623, - 623, 623, 623, 647, 623, 633, 633, 633, 634, 623, - 634, 635, 635, 635, 635, 635, 636, 636, 623, 623, - 648, 623, 623, 623, 623, 623, 638, 638, 638, 638, - - 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - 638, 638, 638, 638, 638, 638, 638, 638, 639, 623, - 639, 640, 640, 640, 640, 640, 641, 623, 641, 642, - 642, 642, 642, 642, 643, 643, 623, 644, 644, 623, - 645, 645, 645, 645, 645, 645, 646, 646, 647, 633, - 635, 635, 635, 635, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623, 623, 623, 623, 649, 623, - 623, 638, 638, 638, 638, 638, 638, 638, 638, 638, - 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - - 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - 638, 638, 638, 638, 638, 638, 638, 640, 640, 640, - 640, 640, 642, 642, 642, 642, 645, 645, 645, 645, - 645, 645, 633, 635, 635, 635, 635, 623, 623, 623, - 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 649, 638, 638, 638, 638, 638, 638, 638, 638, - 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - 638, 640, 640, 640, 640, 640, 640, 640, 640, 640, - - 640, 642, 642, 642, 642, 645, 645, 645, 645, 645, - 645, 633, 635, 635, 635, 635, 623, 623, 638, 638, - 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - 638, 638, 638, 640, 640, 640, 640, 640, 640, 640, - 640, 640, 640, 640, 642, 642, 642, 642, 645, 645, - 645, 645, 645, 633, 635, 635, 638, 638, 638, 638, - 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - - 638, 638, 638, 638, 640, 640, 640, 640, 640, 640, - 640, 640, 640, 640, 640, 642, 642, 645, 645, 645, - 650, 635, 635, 638, 638, 638, 638, 638, 638, 638, - 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - 638, 638, 638, 640, 640, 640, 640, 640, 640, 640, - 640, 640, 640, 642, 642, 645, 645, 650, 650, 635, - 635, 638, 638, 638, 638, 638, 638, 638, 638, 638, - 638, 638, 638, 638, 638, 640, 640, 640, 640, 640, - 640, 640, 642, 642, 645, 645, 623, 635, 638, 638, - 638, 638, 638, 638, 638, 638, 640, 640, 640, 640, - - 640, 640, 642, 645, 645, 638, 638, 638, 638, 640, - 640, 640, 645, 645, 638, 638, 638, 640, 640, 640, - 638, 640, 0, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623, 623, 623, 623, 623, 623 - } ; - -static yyconst flex_int16_t yy_nxt[1276] = - { 0, - 623, 31, 31, 32, 31, 34, 32, 45, 35, 623, - 46, 74, 33, 623, 75, 33, 36, 37, 37, 32, - 38, 36, 36, 36, 36, 36, 36, 36, 39, 36, - 36, 36, 36, 36, 36, 36, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 36, - 36, 36, 40, 40, 40, 41, 40, 40, 40, 40, - 40, 40, 40, 40, 42, 40, 40, 40, 40, 40, - 43, 44, 40, 40, 40, 40, 36, 36, 47, 48, - 48, 32, 49, 47, 50, 47, 47, 47, 47, 51, - - 52, 53, 53, 53, 54, 47, 47, 47, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 56, 55, 55, 55, - 55, 47, 47, 47, 57, 58, 55, 59, 60, 61, - 62, 55, 55, 63, 64, 65, 66, 67, 68, 55, - 69, 70, 71, 72, 73, 55, 55, 55, 47, 47, - 76, 77, 77, 32, 78, 76, 76, 76, 76, 76, - 76, 76, 79, 76, 76, 76, 76, 76, 76, 76, - 99, 172, 172, 100, 114, 114, 32, 172, 172, 34, - 115, 116, 35, 117, 173, 118, 173, 174, 81, 174, - - 119, 172, 172, 76, 76, 76, 173, 172, 172, 174, - 136, 136, 32, 137, 136, 141, 32, 137, 142, 206, - 82, 138, 622, 180, 83, 138, 120, 190, 121, 207, - 84, 85, 76, 77, 86, 32, 78, 87, 76, 76, - 76, 76, 76, 76, 79, 76, 76, 76, 76, 76, - 76, 76, 621, 125, 125, 32, 152, 152, 32, 126, - 127, 230, 128, 181, 129, 191, 200, 153, 201, 130, - 81, 157, 157, 32, 620, 76, 76, 76, 215, 139, - 140, 216, 158, 139, 140, 225, 294, 152, 154, 32, - 226, 155, 82, 208, 295, 131, 83, 132, 153, 209, - - 619, 231, 84, 85, 88, 89, 89, 32, 90, 88, - 88, 88, 88, 88, 88, 88, 91, 88, 88, 88, - 88, 88, 88, 88, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 88, 88, 88, - 92, 92, 92, 93, 92, 92, 92, 92, 92, 92, - 92, 92, 94, 92, 92, 92, 92, 92, 95, 96, - 92, 92, 92, 92, 97, 98, 102, 102, 32, 306, - 172, 175, 103, 104, 176, 105, 618, 106, 328, 157, - 159, 32, 107, 160, 307, 31, 31, 32, 168, 227, - - 158, 169, 170, 228, 171, 329, 33, 254, 31, 34, - 32, 168, 35, 173, 169, 170, 174, 171, 108, 33, - 109, 172, 175, 255, 192, 176, 193, 193, 193, 194, - 617, 195, 195, 195, 202, 234, 203, 238, 235, 204, - 218, 219, 221, 172, 172, 222, 110, 102, 111, 32, - 220, 112, 223, 103, 104, 300, 105, 616, 106, 301, - 224, 172, 175, 107, 615, 176, 172, 175, 173, 180, - 176, 174, 172, 175, 172, 172, 176, 239, 173, 172, - 175, 174, 319, 176, 172, 172, 320, 173, 230, 108, - 174, 109, 172, 175, 172, 172, 176, 173, 172, 175, - - 174, 614, 176, 172, 172, 173, 172, 175, 174, 181, - 176, 247, 247, 173, 172, 172, 174, 110, 114, 122, - 32, 238, 123, 173, 115, 116, 174, 117, 231, 118, - 173, 247, 250, 174, 119, 176, 172, 175, 172, 172, - 176, 172, 175, 172, 172, 176, 172, 175, 187, 187, - 176, 193, 193, 193, 281, 281, 281, 613, 312, 421, - 120, 239, 121, 125, 133, 32, 313, 134, 612, 126, - 127, 611, 128, 194, 129, 195, 195, 195, 422, 130, - 316, 317, 245, 245, 247, 247, 248, 248, 247, 250, - 257, 257, 176, 341, 587, 343, 281, 281, 281, 610, - - 342, 342, 342, 342, 609, 131, 608, 132, 144, 144, - 32, 145, 383, 384, 146, 147, 353, 607, 354, 148, - 456, 392, 606, 393, 605, 146, 147, 355, 356, 400, - 401, 357, 394, 395, 417, 559, 396, 604, 603, 457, - 602, 342, 342, 601, 600, 599, 598, 597, 596, 595, - 146, 594, 147, 144, 149, 32, 145, 150, 593, 146, - 147, 592, 591, 590, 148, 589, 588, 559, 586, 585, - 146, 147, 584, 583, 582, 581, 580, 579, 578, 577, - 576, 575, 574, 573, 572, 571, 570, 569, 568, 567, - 566, 565, 564, 563, 562, 146, 561, 147, 30, 31, - - 31, 32, 30, 30, 30, 161, 162, 30, 30, 30, - 33, 30, 30, 30, 30, 30, 30, 30, 163, 163, - 163, 164, 163, 163, 163, 163, 163, 163, 163, 163, - 163, 163, 163, 163, 165, 166, 163, 163, 163, 167, - 163, 30, 30, 30, 163, 163, 163, 163, 163, 163, - 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, - 163, 163, 163, 163, 163, 163, 163, 163, 30, 30, - 267, 560, 268, 559, 557, 556, 555, 554, 553, 269, - 270, 552, 551, 550, 549, 548, 547, 546, 545, 544, - 543, 542, 541, 540, 539, 538, 537, 536, 535, 534, - - 533, 532, 531, 530, 529, 528, 527, 526, 525, 524, - 271, 523, 522, 272, 273, 521, 520, 519, 274, 518, - 517, 516, 515, 514, 275, 513, 512, 511, 276, 510, - 277, 509, 278, 508, 279, 30, 30, 30, 30, 30, - 30, 80, 80, 80, 80, 80, 80, 101, 101, 101, - 101, 101, 101, 113, 113, 113, 113, 113, 113, 124, - 124, 124, 124, 124, 124, 135, 135, 135, 135, 135, - 135, 143, 143, 143, 143, 143, 143, 151, 151, 151, - 151, 151, 151, 156, 156, 156, 156, 156, 156, 177, - 507, 177, 177, 177, 177, 179, 506, 179, 179, 179, - - 179, 182, 182, 187, 505, 504, 187, 187, 187, 189, - 503, 189, 189, 189, 189, 197, 197, 229, 502, 229, - 229, 229, 229, 232, 232, 237, 501, 237, 237, 237, - 237, 240, 240, 245, 500, 499, 245, 245, 245, 248, - 498, 497, 248, 248, 248, 251, 251, 257, 496, 495, - 257, 257, 257, 259, 494, 259, 259, 259, 259, 266, - 493, 266, 266, 266, 266, 352, 352, 558, 492, 558, - 558, 558, 558, 491, 490, 489, 488, 487, 486, 485, - 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, - 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, - - 464, 463, 462, 461, 460, 459, 458, 455, 454, 453, - 452, 451, 450, 449, 448, 447, 446, 445, 444, 443, - 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, - 432, 431, 430, 429, 428, 427, 426, 425, 424, 423, - 420, 419, 418, 416, 415, 414, 413, 412, 411, 410, - 409, 408, 407, 406, 405, 404, 403, 402, 399, 398, - 397, 391, 390, 389, 388, 387, 386, 385, 382, 381, - 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, - 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, - 360, 359, 358, 338, 351, 350, 349, 348, 347, 346, - - 345, 344, 340, 339, 338, 337, 336, 335, 334, 333, - 258, 332, 331, 330, 327, 249, 246, 326, 325, 324, - 323, 237, 322, 321, 318, 229, 315, 314, 311, 310, - 309, 308, 305, 304, 303, 302, 299, 298, 297, 296, - 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, - 283, 282, 280, 265, 265, 188, 264, 263, 262, 261, - 179, 260, 258, 256, 253, 252, 178, 178, 178, 249, - 178, 246, 178, 178, 178, 178, 244, 243, 242, 241, - 178, 236, 233, 178, 217, 214, 213, 212, 211, 210, - 205, 199, 198, 196, 188, 178, 186, 185, 184, 183, - - 178, 623, 29, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623 - } ; - -static yyconst flex_int16_t yy_chk[1276] = - { 0, - 0, 1, 1, 1, 2, 2, 2, 4, 2, 0, - 4, 6, 1, 0, 6, 2, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 10, 31, 31, 10, 13, 13, 13, 37, 37, 26, - 13, 13, 26, 13, 33, 13, 39, 33, 7, 39, - - 13, 48, 48, 7, 7, 7, 52, 77, 77, 52, - 17, 17, 17, 17, 18, 18, 18, 18, 18, 61, - 7, 17, 618, 38, 7, 18, 13, 50, 13, 61, - 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 615, 15, 15, 15, 21, 21, 21, 15, - 15, 78, 15, 38, 15, 50, 58, 21, 58, 15, - 8, 23, 23, 23, 612, 8, 8, 8, 68, 17, - 17, 68, 23, 18, 18, 72, 210, 22, 22, 22, - 72, 22, 8, 62, 210, 15, 8, 15, 22, 62, - - 611, 78, 8, 8, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 11, 11, 11, 220, - 34, 34, 11, 11, 34, 11, 610, 11, 253, 24, - 24, 24, 11, 24, 220, 27, 27, 27, 27, 73, - - 24, 27, 27, 73, 27, 253, 27, 166, 28, 28, - 28, 28, 28, 79, 28, 28, 79, 28, 11, 28, - 11, 45, 45, 166, 51, 45, 51, 51, 51, 53, - 608, 53, 53, 53, 59, 82, 59, 90, 82, 59, - 70, 70, 71, 89, 89, 71, 11, 12, 12, 12, - 70, 12, 71, 12, 12, 215, 12, 607, 12, 215, - 71, 74, 74, 12, 606, 74, 86, 86, 91, 179, - 86, 91, 99, 99, 102, 102, 99, 90, 106, 111, - 111, 106, 234, 111, 114, 114, 234, 118, 229, 12, - 118, 12, 122, 122, 125, 125, 122, 129, 133, 133, - - 129, 605, 133, 136, 136, 138, 141, 141, 138, 179, - 141, 144, 144, 148, 152, 152, 148, 12, 14, 14, - 14, 237, 14, 153, 14, 14, 153, 14, 229, 14, - 158, 149, 149, 158, 14, 149, 154, 154, 157, 157, - 154, 159, 159, 172, 172, 159, 175, 175, 188, 188, - 175, 193, 193, 193, 194, 194, 194, 604, 225, 355, - 14, 237, 14, 16, 16, 16, 225, 16, 600, 16, - 16, 599, 16, 195, 16, 195, 195, 195, 355, 16, - 228, 228, 246, 246, 247, 247, 249, 249, 250, 250, - 258, 258, 250, 269, 559, 270, 281, 281, 281, 597, - - 269, 269, 270, 270, 593, 16, 592, 16, 19, 19, - 19, 19, 310, 310, 19, 19, 282, 591, 282, 19, - 394, 318, 589, 318, 586, 19, 19, 282, 282, 322, - 322, 282, 318, 318, 342, 559, 318, 585, 583, 394, - 582, 342, 342, 581, 580, 579, 578, 576, 573, 570, - 19, 568, 19, 20, 20, 20, 20, 20, 567, 20, - 20, 566, 565, 564, 20, 562, 560, 558, 557, 556, - 20, 20, 555, 554, 552, 551, 548, 547, 546, 545, - 544, 543, 541, 538, 537, 536, 535, 533, 532, 530, - 528, 527, 526, 525, 524, 20, 523, 20, 25, 25, - - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 191, 522, 191, 521, 519, 518, 517, 516, 515, 191, - 191, 514, 512, 511, 510, 509, 508, 507, 506, 505, - 504, 503, 502, 501, 500, 499, 498, 494, 492, 491, - - 490, 489, 488, 483, 482, 481, 480, 479, 478, 477, - 191, 476, 475, 191, 191, 474, 472, 471, 191, 469, - 467, 466, 464, 463, 191, 462, 461, 460, 191, 459, - 191, 458, 191, 457, 191, 624, 624, 624, 624, 624, - 624, 625, 625, 625, 625, 625, 625, 626, 626, 626, - 626, 626, 626, 627, 627, 627, 627, 627, 627, 628, - 628, 628, 628, 628, 628, 629, 629, 629, 629, 629, - 629, 630, 630, 630, 630, 630, 630, 631, 631, 631, - 631, 631, 631, 632, 632, 632, 632, 632, 632, 633, - 456, 633, 633, 633, 633, 634, 455, 634, 634, 634, - - 634, 635, 635, 636, 454, 453, 636, 636, 636, 637, - 452, 637, 637, 637, 637, 638, 638, 639, 450, 639, - 639, 639, 639, 640, 640, 641, 448, 641, 641, 641, - 641, 642, 642, 643, 447, 446, 643, 643, 643, 644, - 444, 443, 644, 644, 644, 645, 645, 646, 442, 441, - 646, 646, 646, 647, 439, 647, 647, 647, 647, 648, - 438, 648, 648, 648, 648, 649, 649, 650, 437, 650, - 650, 650, 650, 436, 435, 434, 433, 432, 431, 429, - 428, 425, 424, 423, 422, 421, 420, 419, 415, 414, - 412, 411, 410, 409, 408, 406, 405, 404, 403, 402, - - 401, 400, 399, 398, 397, 396, 395, 393, 392, 391, - 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, - 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, - 368, 367, 366, 365, 363, 362, 361, 358, 357, 356, - 354, 353, 352, 337, 336, 335, 334, 333, 332, 331, - 330, 329, 328, 327, 326, 325, 324, 323, 321, 320, - 319, 317, 316, 315, 314, 313, 312, 311, 309, 308, - 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, - 297, 296, 294, 293, 292, 291, 290, 289, 288, 287, - 286, 285, 283, 279, 278, 277, 276, 275, 274, 273, - - 272, 271, 268, 267, 266, 264, 263, 262, 261, 260, - 257, 256, 255, 254, 252, 248, 245, 244, 243, 242, - 241, 239, 236, 235, 233, 231, 227, 226, 224, 223, - 222, 221, 219, 218, 217, 216, 214, 213, 212, 211, - 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, - 199, 198, 192, 190, 189, 187, 186, 185, 184, 183, - 181, 178, 168, 167, 165, 164, 160, 155, 150, 145, - 142, 137, 134, 123, 112, 100, 96, 95, 94, 93, - 87, 83, 81, 75, 69, 67, 66, 65, 64, 63, - 60, 57, 56, 54, 49, 46, 44, 43, 42, 41, - - 35, 29, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, - 623, 623, 623, 623, 623 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "tqmoc.l" -/**************************************************************************** -** -** Lexical analyzer for meta object compiler -** -** Created : 930417 -** -** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. -** -** This file is part of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at [email protected]. -** -** This file may be used under the terms of the TQ Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -*****************************************************************************/ -#line 42 "tqmoc.l" -#ifdef TQMOC_YACC_CODE - -#ifdef TQMOC_MWERKS_PLUGIN -#ifdef TQ_OS_MAC9 -# define isascii(c) ((int)( (unsigned int) (c) <= (unsigned char)0x7F )) -#endif -const char *buf_buffer = NULL; -long buf_size_total = 0, buf_index = 0; -#define YY_INPUT(buf, result, max_size) \ - { \ - if(buf_index < buf_size_total ) { \ - while(!isascii(buf_buffer[buf_index])) buf_index++; \ - int ms = ((max_size < buf_size_total) ? max_size : buf_size_total); \ - for(result = 0; result < ms; result++) { \ - char c = buf_buffer[buf_index + result]; \ - if(!isascii(c)) { \ - buf_index++; \ - break; \ - } \ - buf[result] = c == '\r' ? '\n' : c; \ - } \ - buf_index += result; \ - } else result = YY_NULL; \ - } -#endif - -#include "tqstring.h" - - -#define input yyinput // yyinput in C++ - -#define X if(lexDebug){fprintf(stderr,"LEX (%i) : %s\n",lineNo,yytext);}; -#define Y if(lexDebug){fprintf(stderr,"LEX (%i) : %s\n",lineNo,yytext);}; -/* -#define Y if(lexDebug){fprintf(stderr,"LEX (%i) : %s updates level to %i\n"\ - ,lineNo,yytext,templLevel);}; -*/ -#define Z if(lexDebug){fprintf(stderr,"LEX (%i) : skipped the string %s\"\n"\ - ,lineNo,yytext);}; -#define BEGIN_INSIDE - - -#define linput() \ - ( (c = input()) == '\n' ? (lineNo++, c) : (c == EOF) ? 0 : c ) - -#include <string.h> -#include <stdlib.h> - -int classPLevel = 1; /* Depth of nested curly braces in IN_CLASS */ -int namespacePLevel = 1; /* Depth of nested curly braces in IN_NAMESPACE */ -int expLevel = 1; /* Depth of nested parentheses in IN_EXPR */ -int enumLevel = 1; /* Depth of nested parentheses in IN_ENUM */ -int fctLevel = 1; /* Depth of nested parentheses in IN_FCT */ -int templLevel = 1; /* Depth of levels in IN_TEMPL_ARGS */ - -int lastState = 0; /* Remembers the state when a - TQMOC_SKIP_BEGIN is encountered */ -int skipLevel = 0; /* Depth of TQMOC_SKIP_BEGINs */ - -class TQString; - -extern void addExpressionChar( const char ); -extern void addExpressionString( const char * ); -extern void tqmoc_warn( const char *msg ); - -#line 1057 "tqmoc_lex.cpp" - -#define INITIAL 0 -#define OUTSIDE 1 -#define TQT_DEF 2 -#define IN_CLASS 3 -#define IN_NAMESPACE 4 -#define IN_ENUM 5 -#define IN_EXPR 6 -#define IN_DEF_ARG 7 -#define IN_FCT 8 -#define IN_TEMPL_ARGS 9 -#define GIMME_SEMICOLON 10 -#define SKIP 11 -#define IN_PROPERTY 12 -#define IN_CLASSINFO 13 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include <unistd.h> -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int yylex_destroy (void ); - -int yyget_debug (void ); - -void yyset_debug (int debug_flag ); - -YY_EXTRA_TYPE yyget_extra (void ); - -void yyset_extra (YY_EXTRA_TYPE user_defined ); - -FILE *yyget_in (void ); - -void yyset_in (FILE * in_str ); - -FILE *yyget_out (void ); - -void yyset_out (FILE * out_str ); - -int yyget_leng (void ); - -char *yyget_text (void ); - -int yyget_lineno (void ); - -void yyset_lineno (int line_number ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap (void ); -#else -extern int yywrap (void ); -#endif -#endif - - static void yyunput (int c,char *buf_ptr ); - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ -\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex (void); - -#define YY_DECL int yylex (void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - if ( yyleng > 0 ) \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 113 "tqmoc.l" - - -#line 1263 "tqmoc_lex.cpp" - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_load_buffer_state( ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); - yy_current_state += YY_AT_BOL(); -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 624 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 1203 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 115 "tqmoc.l" -{ X; - BEGIN TQT_DEF; - return CLASS; } - YY_BREAK -case 2: -YY_RULE_SETUP -#line 118 "tqmoc.l" -{ X; - BEGIN TQT_DEF; - return NAMESPACE; } - YY_BREAK -case 3: -YY_RULE_SETUP -#line 121 "tqmoc.l" -{ X; - BEGIN TQT_DEF; - return USING; } - YY_BREAK -case 4: -YY_RULE_SETUP -#line 124 "tqmoc.l" -{ X; - BEGIN TQT_DEF; - return TEMPLATE; } - YY_BREAK -case 5: -YY_RULE_SETUP -#line 127 "tqmoc.l" -{ X; return TQ_OBJECT; } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 128 "tqmoc.l" -{ X; return SIGNALS; } - YY_BREAK -case 7: -YY_RULE_SETUP -#line 129 "tqmoc.l" -{ X; return SLOTS; } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 130 "tqmoc.l" -{ X; return TQ_CLASSINFO; } - YY_BREAK -case 9: -YY_RULE_SETUP -#line 131 "tqmoc.l" -{ X; return Q_PROPERTY; } - YY_BREAK -case 10: -YY_RULE_SETUP -#line 132 "tqmoc.l" -{ X; return TQ_OVERRIDE; } - YY_BREAK -case 11: -YY_RULE_SETUP -#line 133 "tqmoc.l" -{ X; return TQ_ENUMS; } - YY_BREAK -case 12: -YY_RULE_SETUP -#line 134 "tqmoc.l" -{ X; return TQ_SETS; } - YY_BREAK -case 13: -YY_RULE_SETUP -#line 136 "tqmoc.l" -{ fctLevel++;Y; } - YY_BREAK -case 14: -YY_RULE_SETUP -#line 137 "tqmoc.l" -{ fctLevel--;Y;if (fctLevel==0){X;return '}';}} - YY_BREAK -case 15: -YY_RULE_SETUP -#line 138 "tqmoc.l" -{ classPLevel++;Y; } - YY_BREAK -case 16: -YY_RULE_SETUP -#line 139 "tqmoc.l" -{ classPLevel--;Y;if (classPLevel == 0) - {X;return '}';} } - YY_BREAK -case 17: -YY_RULE_SETUP -#line 141 "tqmoc.l" -{ X;if( classPLevel == 1 ) return PUBLIC; } - YY_BREAK -case 18: -YY_RULE_SETUP -#line 142 "tqmoc.l" -{ X;if( classPLevel == 1 ) return PROTECTED; } - YY_BREAK -case 19: -YY_RULE_SETUP -#line 143 "tqmoc.l" -{ X;if( classPLevel == 1 ) return PRIVATE; } - YY_BREAK -case 20: -YY_RULE_SETUP -#line 144 "tqmoc.l" -{ X;if( classPLevel == 1 ) return SIGNALS; } - YY_BREAK -case 21: -YY_RULE_SETUP -#line 145 "tqmoc.l" -{ X;if( classPLevel == 1 ) return SLOTS; } - YY_BREAK -case 22: -YY_RULE_SETUP -#line 146 "tqmoc.l" -{ X;if( classPLevel == 1 ) return TQ_CLASSINFO; } - YY_BREAK -case 23: -YY_RULE_SETUP -#line 147 "tqmoc.l" -{ X; - if ( classPLevel == 1 ) - return TQ_OBJECT; - else if ( classPLevel > 1 ) - tqmoc_warn( "Cannot use TQ_OBJECT in nested class." ); - } - YY_BREAK -case 24: -YY_RULE_SETUP -#line 153 "tqmoc.l" -{ X;if( classPLevel == 1 ) return Q_PROPERTY; } - YY_BREAK -case 25: -YY_RULE_SETUP -#line 154 "tqmoc.l" -{ X;if( classPLevel == 1 ) return TQ_OVERRIDE; } - YY_BREAK -case 26: -YY_RULE_SETUP -#line 155 "tqmoc.l" -{ X;if( classPLevel == 1 ) return TQ_ENUMS; } - YY_BREAK -case 27: -YY_RULE_SETUP -#line 156 "tqmoc.l" -{ X;if( classPLevel == 1 ) return TQ_SETS; } - YY_BREAK -case 28: -YY_RULE_SETUP -#line 158 "tqmoc.l" -{ namespacePLevel++;Y; } - YY_BREAK -case 29: -YY_RULE_SETUP -#line 159 "tqmoc.l" -{ namespacePLevel--;Y;if (namespacePLevel == 0) - {X;return '}';}} - YY_BREAK -case 30: -YY_RULE_SETUP -#line 161 "tqmoc.l" -{ X; - BEGIN TQT_DEF; - return CLASS; } - YY_BREAK -case 31: -YY_RULE_SETUP -#line 164 "tqmoc.l" -{ X; - BEGIN TQT_DEF; - return TEMPLATE; } - YY_BREAK -case 32: -YY_RULE_SETUP -#line 167 "tqmoc.l" -{ X; - BEGIN TQT_DEF; - return NAMESPACE; } - YY_BREAK -case 33: -YY_RULE_SETUP -#line 170 "tqmoc.l" -{ X; - BEGIN TQT_DEF; - return USING; } - YY_BREAK -case 34: -YY_RULE_SETUP -#line 174 "tqmoc.l" -{ X; return '('; } - YY_BREAK -case 35: -YY_RULE_SETUP -#line 175 "tqmoc.l" -{ X; return ')'; } - YY_BREAK -case 36: -YY_RULE_SETUP -#line 176 "tqmoc.l" -{ X; return READ; } - YY_BREAK -case 37: -YY_RULE_SETUP -#line 177 "tqmoc.l" -{ X; return WRITE; } - YY_BREAK -case 38: -YY_RULE_SETUP -#line 178 "tqmoc.l" -{ X; return STORED; } - YY_BREAK -case 39: -YY_RULE_SETUP -#line 179 "tqmoc.l" -{ X; return RESET; } - YY_BREAK -case 40: -YY_RULE_SETUP -#line 180 "tqmoc.l" -{ X; return DESIGNABLE; } - YY_BREAK -case 41: -YY_RULE_SETUP -#line 181 "tqmoc.l" -{ X; return SCRIPTABLE; } - YY_BREAK -case 42: -YY_RULE_SETUP -#line 184 "tqmoc.l" -{ expLevel++;X; } - YY_BREAK -case 43: -YY_RULE_SETUP -#line 185 "tqmoc.l" -{ expLevel--;Y;if (expLevel == 0) - { X; BEGIN TQT_DEF; return ')';} } - YY_BREAK -case 44: -YY_RULE_SETUP -#line 187 "tqmoc.l" -{ expLevel++;X; } - YY_BREAK -case 45: -YY_RULE_SETUP -#line 188 "tqmoc.l" -{ expLevel--;X;if (expLevel == 0) - { X; BEGIN TQT_DEF; return ']';} } - YY_BREAK -case 46: -YY_RULE_SETUP -#line 190 "tqmoc.l" -{ if (expLevel == 0) - { X; BEGIN TQT_DEF; return ',' ;} } - YY_BREAK -case 47: -YY_RULE_SETUP -#line 192 "tqmoc.l" -{ if (expLevel == 0) - { X; BEGIN TQT_DEF; return ';' ;} } - YY_BREAK -case 48: -YY_RULE_SETUP -#line 194 "tqmoc.l" -{ expLevel++;X; } - YY_BREAK -case 49: -YY_RULE_SETUP -#line 195 "tqmoc.l" -{ expLevel--;Y;if (expLevel == 0) - { X; BEGIN TQT_DEF; return ')';} } - YY_BREAK -case 50: -YY_RULE_SETUP -#line 197 "tqmoc.l" -{ expLevel++;X; } - YY_BREAK -case 51: -YY_RULE_SETUP -#line 198 "tqmoc.l" -{ expLevel--;X;if (expLevel == 0) - { X; BEGIN TQT_DEF; return ']';} } - YY_BREAK -case 52: -YY_RULE_SETUP -#line 200 "tqmoc.l" -{ if (expLevel <= 1) - { X; BEGIN TQT_DEF; return ',' ;} } - YY_BREAK -case 53: -YY_RULE_SETUP -#line 202 "tqmoc.l" -{ if (expLevel == 0) - { X; BEGIN TQT_DEF; return ';' ;} } - YY_BREAK -case 54: -YY_RULE_SETUP -#line 204 "tqmoc.l" -{ enumLevel++;X; } - YY_BREAK -case 55: -YY_RULE_SETUP -#line 205 "tqmoc.l" -{ enumLevel--;X; } - YY_BREAK -case 56: -YY_RULE_SETUP -#line 206 "tqmoc.l" -{ enumLevel++;X; } - YY_BREAK -case 57: -YY_RULE_SETUP -#line 207 "tqmoc.l" -{ enumLevel--;X } - YY_BREAK -case 58: -YY_RULE_SETUP -#line 208 "tqmoc.l" -{ if (enumLevel == 0) - { X; BEGIN TQT_DEF; return ',' ;} } - YY_BREAK -case 59: -YY_RULE_SETUP -#line 210 "tqmoc.l" -{ if (enumLevel == 0) - { X; BEGIN TQT_DEF; return ';' ;} } - YY_BREAK -case 60: -YY_RULE_SETUP -#line 212 "tqmoc.l" -{ if (enumLevel == 0) - { X; BEGIN TQT_DEF; return '}' ;} } - YY_BREAK -case 61: -YY_RULE_SETUP -#line 214 "tqmoc.l" -{ templLevel++; - Y; - addExpressionChar( yytext[0] ); - } - YY_BREAK -case 62: -YY_RULE_SETUP -#line 218 "tqmoc.l" -{ templLevel--; - Y; - if ( templLevel == 0 ) { - X; - BEGIN TQT_DEF; - return yytext[0]; - } else { - addExpressionChar( yytext[0] ); - } - } - YY_BREAK -case 63: -YY_RULE_SETUP -#line 228 "tqmoc.l" -{ X;return FRIEND; } - YY_BREAK -case 64: -YY_RULE_SETUP -#line 229 "tqmoc.l" -{ X;return TYPEDEF; } - YY_BREAK -case 65: -YY_RULE_SETUP -#line 230 "tqmoc.l" -{ X;return AUTO; } - YY_BREAK -case 66: -YY_RULE_SETUP -#line 231 "tqmoc.l" -{ X;return REGISTER; } - YY_BREAK -case 67: -YY_RULE_SETUP -#line 232 "tqmoc.l" -{ X;return STATIC; } - YY_BREAK -case 68: -YY_RULE_SETUP -#line 233 "tqmoc.l" -{ X;return EXTERN; } - YY_BREAK -case 69: -YY_RULE_SETUP -#line 234 "tqmoc.l" -{ X;return INLINE; } - YY_BREAK -case 70: -YY_RULE_SETUP -#line 235 "tqmoc.l" -{ X;return INLINE; } - YY_BREAK -case 71: -YY_RULE_SETUP -#line 236 "tqmoc.l" -{ X;return VIRTUAL; } - YY_BREAK -case 72: -YY_RULE_SETUP -#line 237 "tqmoc.l" -{ X;return CONST; } - YY_BREAK -case 73: -YY_RULE_SETUP -#line 238 "tqmoc.l" -{ X;return VOLATILE; } - YY_BREAK -case 74: -YY_RULE_SETUP -#line 239 "tqmoc.l" -{ X;return CHAR; } - YY_BREAK -case 75: -YY_RULE_SETUP -#line 240 "tqmoc.l" -{ X;return SHORT; } - YY_BREAK -case 76: -YY_RULE_SETUP -#line 241 "tqmoc.l" -{ X;return INT; } - YY_BREAK -case 77: -YY_RULE_SETUP -#line 242 "tqmoc.l" -{ X;return LONG; } - YY_BREAK -case 78: -YY_RULE_SETUP -#line 243 "tqmoc.l" -{ X;return SIGNED; } - YY_BREAK -case 79: -YY_RULE_SETUP -#line 244 "tqmoc.l" -{ X;return UNSIGNED; } - YY_BREAK -case 80: -YY_RULE_SETUP -#line 245 "tqmoc.l" -{ X;return FLOAT; } - YY_BREAK -case 81: -YY_RULE_SETUP -#line 246 "tqmoc.l" -{ X;return DOUBLE; } - YY_BREAK -case 82: -YY_RULE_SETUP -#line 247 "tqmoc.l" -{ X;return VOID; } - YY_BREAK -case 83: -YY_RULE_SETUP -#line 248 "tqmoc.l" -{ X;return ENUM; } - YY_BREAK -case 84: -YY_RULE_SETUP -#line 249 "tqmoc.l" -{ X;return CLASS; } - YY_BREAK -case 85: -YY_RULE_SETUP -#line 250 "tqmoc.l" -{ X;return STRUCT; } - YY_BREAK -case 86: -YY_RULE_SETUP -#line 251 "tqmoc.l" -{ X;return UNION; } - YY_BREAK -case 87: -YY_RULE_SETUP -#line 252 "tqmoc.l" -{ X;return ASM; } - YY_BREAK -case 88: -YY_RULE_SETUP -#line 253 "tqmoc.l" -{ X;return PRIVATE; } - YY_BREAK -case 89: -YY_RULE_SETUP -#line 254 "tqmoc.l" -{ X;return PROTECTED; } - YY_BREAK -case 90: -YY_RULE_SETUP -#line 255 "tqmoc.l" -{ X;return PUBLIC; } - YY_BREAK -case 91: -YY_RULE_SETUP -#line 256 "tqmoc.l" -{ X;return OPERATOR; } - YY_BREAK -case 92: -YY_RULE_SETUP -#line 257 "tqmoc.l" -{ X;return DBL_COLON; } - YY_BREAK -case 93: -YY_RULE_SETUP -#line 258 "tqmoc.l" -{ X;return TRIPLE_DOT; } - YY_BREAK -case 94: -YY_RULE_SETUP -#line 259 "tqmoc.l" -{ X;return TEMPLATE; } - YY_BREAK -case 95: -YY_RULE_SETUP -#line 260 "tqmoc.l" -{ X;return MUTABLE; } - YY_BREAK -case 96: -YY_RULE_SETUP -#line 261 "tqmoc.l" -{ X;return THROW; } - YY_BREAK -case 97: -YY_RULE_SETUP -#line 262 "tqmoc.l" -{ X;return USING; } - YY_BREAK -case 98: -YY_RULE_SETUP -#line 263 "tqmoc.l" -{ X;return NAMESPACE; } - YY_BREAK -case 99: -YY_RULE_SETUP -#line 265 "tqmoc.l" -{ - X; - yylval.string = qstrdup(yytext); - return IDENTIFIER; - } - YY_BREAK -case 100: -YY_RULE_SETUP -#line 271 "tqmoc.l" -{ - X; - yylval.string = qstrdup(yytext); - return IDENTIFIER; - } - YY_BREAK -case 101: -YY_RULE_SETUP -#line 277 "tqmoc.l" -{ X; return '('; } - YY_BREAK -case 102: -YY_RULE_SETUP -#line 278 "tqmoc.l" -{ X; return ')'; } - YY_BREAK -case 103: -YY_RULE_SETUP -#line 279 "tqmoc.l" -{ X; return ','; } - YY_BREAK -case 104: -/* rule 104 can match eol */ -YY_RULE_SETUP -#line 281 "tqmoc.l" -{ - X; - yylval.string = qstrdup( yytext + 1 ); - input(); /* discard the '"' */ - return STRING; - } - YY_BREAK -case 105: -YY_RULE_SETUP -#line 288 "tqmoc.l" -; - YY_BREAK -case 106: -YY_RULE_SETUP -#line 289 "tqmoc.l" -; - YY_BREAK -case 107: -YY_RULE_SETUP -#line 290 "tqmoc.l" -; - YY_BREAK -case 108: -/* rule 108 can match eol */ -YY_RULE_SETUP -#line 292 "tqmoc.l" -{ /* discard strings */ - Z; - } - YY_BREAK -case 109: -/* rule 109 can match eol */ -YY_RULE_SETUP -#line 296 "tqmoc.l" -{ /* discard strings */ - Z; - } - YY_BREAK -case 110: -/* rule 110 can match eol */ -YY_RULE_SETUP -#line 300 "tqmoc.l" -{ /* discard strings */ - Z; - } - YY_BREAK -case 111: -/* rule 111 can match eol */ -YY_RULE_SETUP -#line 304 "tqmoc.l" -{ /* discard strings */ - Z; - addExpressionString( yytext ); - input(); /* discard the '"' */ - } - YY_BREAK -case 112: -/* rule 112 can match eol */ -YY_RULE_SETUP -#line 311 "tqmoc.l" -{ - X; - addExpressionString( yytext ); - input(); /* discard the '"' */ - return STRING; - } - YY_BREAK -case 113: -/* rule 113 can match eol */ -YY_RULE_SETUP -#line 318 "tqmoc.l" -{ - X; - yylval.string = qstrdup( yytext + 1 ); - input(); /* discard the '"' */ - return STRING; - } - YY_BREAK -case 114: -YY_RULE_SETUP -#line 325 "tqmoc.l" -{ X; - yylval.char_val = yytext[1]; - return CHAR_VAL; - } - YY_BREAK -case 115: -YY_RULE_SETUP -#line 330 "tqmoc.l" -{ X; - yylval.char_val = '\a'; - return CHAR_VAL; - } - YY_BREAK -case 116: -YY_RULE_SETUP -#line 335 "tqmoc.l" -{ X; - yylval.char_val = '\b'; - return CHAR_VAL; - } - YY_BREAK -case 117: -YY_RULE_SETUP -#line 340 "tqmoc.l" -{ X; - yylval.char_val = '\f'; - return CHAR_VAL; - } - YY_BREAK -case 118: -YY_RULE_SETUP -#line 345 "tqmoc.l" -{ X; - yylval.char_val = '\n'; - return CHAR_VAL; - } - YY_BREAK -case 119: -YY_RULE_SETUP -#line 350 "tqmoc.l" -{ X; - yylval.char_val = '\r'; - return CHAR_VAL; - } - YY_BREAK -case 120: -YY_RULE_SETUP -#line 355 "tqmoc.l" -{ X; - yylval.char_val = '\t'; - return CHAR_VAL; - } - YY_BREAK -case 121: -YY_RULE_SETUP -#line 360 "tqmoc.l" -{ X; - yylval.char_val = '\v'; - return CHAR_VAL; - } - YY_BREAK -case 122: -YY_RULE_SETUP -#line 365 "tqmoc.l" -{ X; - yylval.char_val = '\\'; - return CHAR_VAL; - } - YY_BREAK -case 123: -YY_RULE_SETUP -#line 370 "tqmoc.l" -{ X; - yylval.char_val = '\?'; - return CHAR_VAL; - } - YY_BREAK -case 124: -YY_RULE_SETUP -#line 375 "tqmoc.l" -{ X; - yylval.char_val = '\''; - return CHAR_VAL; - } - YY_BREAK -case 125: -YY_RULE_SETUP -#line 380 "tqmoc.l" -{ X; - yylval.char_val = '\"'; /* " */ - return CHAR_VAL; - } - YY_BREAK -case 126: -YY_RULE_SETUP -#line 385 "tqmoc.l" -{ X; - yylval.char_val = '\0'; - return CHAR_VAL; - } - YY_BREAK -case 127: -YY_RULE_SETUP -#line 390 "tqmoc.l" -{ X; - yylval.char_val = - (char)strtol( &yytext[1], 0, 8 ); - return CHAR_VAL; - } - YY_BREAK -case 128: -YY_RULE_SETUP -#line 396 "tqmoc.l" -{ X; - yylval.char_val = - (char)strtol( &yytext[2], 0, 16 ); - return CHAR_VAL; - } - YY_BREAK -case 129: -YY_RULE_SETUP -#line 402 "tqmoc.l" -{ X; - yylval.char_val = ' '; - return CHAR_VAL; - } - YY_BREAK -case 130: -YY_RULE_SETUP -#line 407 "tqmoc.l" -{ X; - yylval.int_val = atoi(yytext); - return INT_VAL; - } - YY_BREAK -case 131: -YY_RULE_SETUP -#line 412 "tqmoc.l" -{ X; - yylval.double_val = atof(yytext); - return DOUBLE_VAL; - } - YY_BREAK -case 132: -YY_RULE_SETUP -#line 417 "tqmoc.l" -{ X; - yylval.double_val = atof(yytext); - return DOUBLE_VAL; - } - YY_BREAK -case 133: -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 423 "tqmoc.l" -{ /* skip multi-line macro-definitions */ - int c, c1; - input(); /* Discard the '\n'. */ - do { - c1=' '; - while((c = linput()) != '\n' && c != 0) c1=c; - if (c == 0) break; - } while(c1=='\\'); - unput(c); /* put back the '\n' or the EOF */ - } - YY_BREAK -case 134: -YY_RULE_SETUP -#line 434 "tqmoc.l" -{ /* preprocessor commands are skipped */} - YY_BREAK -case 135: -YY_RULE_SETUP -#line 435 "tqmoc.l" -{ /* C++ comment */ - TQCString s = yytext; - if ( s.contains( "TQMOC_SKIP_BEGIN" ) ) { - skipLevel++; - if ( skipLevel == 1 ) { - lastState = YYSTATE; - BEGIN SKIP; - } - } else - if ( s.contains( "TQMOC_SKIP_END" ) ) { - if ( skipLevel == 0 ) { - tqmoc_warn(" TQMOC_SKIP_END without TQMOC_SKIP_BEGIN"); - } else { - skipLevel--; - if ( skipLevel == 0 ) { - BEGIN lastState; - } - } - } - } - YY_BREAK -case 136: -YY_RULE_SETUP -#line 455 "tqmoc.l" -{ /* C comment */ - int c = ' '; - do { - if ( c!= '*' ) { - while((c = linput()) != '*' && c != 0) - ; - } - if (c == 0) break; - } while(((c = linput())) != '/' && c != 0); - if (c == 0) - unput(c); - } - YY_BREAK -case 137: -YY_RULE_SETUP -#line 468 "tqmoc.l" -{ addExpressionChar( yytext[0] ); } - YY_BREAK -case 138: -YY_RULE_SETUP -#line 470 "tqmoc.l" -{ - /* spaces are important in template args, - e.g. Foo<const int> */ - addExpressionChar( yytext[0] ); } - YY_BREAK -case 139: -YY_RULE_SETUP -#line 474 "tqmoc.l" -; - YY_BREAK -case 140: -YY_RULE_SETUP -#line 475 "tqmoc.l" -; - YY_BREAK -case 141: -YY_RULE_SETUP -#line 476 "tqmoc.l" -; - YY_BREAK -case 142: -YY_RULE_SETUP -#line 477 "tqmoc.l" -; - YY_BREAK -case 143: -YY_RULE_SETUP -#line 478 "tqmoc.l" -{ addExpressionChar( yytext[0] ); } - YY_BREAK -case 144: -YY_RULE_SETUP -#line 479 "tqmoc.l" -; - YY_BREAK -case 145: -YY_RULE_SETUP -#line 480 "tqmoc.l" -{ addExpressionChar( yytext[0] ); } - YY_BREAK -case 146: -YY_RULE_SETUP -#line 481 "tqmoc.l" -; - YY_BREAK -case 147: -YY_RULE_SETUP -#line 482 "tqmoc.l" -; - YY_BREAK -case 148: -YY_RULE_SETUP -#line 483 "tqmoc.l" -{ - X; - return yytext[0]; - } - YY_BREAK -case 149: -YY_RULE_SETUP -#line 487 "tqmoc.l" -{ - X; - return ';'; - } - YY_BREAK -case 150: -/* rule 150 can match eol */ -YY_RULE_SETUP -#line 491 "tqmoc.l" -{ - lineNo++; - } - YY_BREAK -case 151: -YY_RULE_SETUP -#line 496 "tqmoc.l" -ECHO; - YY_BREAK -#line 2301 "tqmoc_lex.cpp" -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(OUTSIDE): -case YY_STATE_EOF(TQT_DEF): -case YY_STATE_EOF(IN_CLASS): -case YY_STATE_EOF(IN_NAMESPACE): -case YY_STATE_EOF(IN_ENUM): -case YY_STATE_EOF(IN_EXPR): -case YY_STATE_EOF(IN_DEF_ARG): -case YY_STATE_EOF(IN_FCT): -case YY_STATE_EOF(IN_TEMPL_ARGS): -case YY_STATE_EOF(GIMME_SEMICOLON): -case YY_STATE_EOF(SKIP): -case YY_STATE_EOF(IN_PROPERTY): -case YY_STATE_EOF(IN_CLASSINFO): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of yylex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (void) -{ - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), (size_t) num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (void) -{ - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = (yy_start); - yy_current_state += YY_AT_BOL(); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 624 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 624 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 623); - - return yy_is_jam ? 0 : yy_current_state; -} - - static void yyunput (int c, register char * yy_bp ) -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart(yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); - - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void yyrestart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void yy_load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ - void yy_delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); - - yyfree((void *) b ); -} - -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - yy_flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void yy_flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack (void) -{ - int num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) -{ - - return yy_scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int yyget_lineno (void) -{ - - return yylineno; -} - -/** Get the input stream. - * - */ -FILE *yyget_in (void) -{ - return yyin; -} - -/** Get the output stream. - * - */ -FILE *yyget_out (void) -{ - return yyout; -} - -/** Get the length of the current token. - * - */ -int yyget_leng (void) -{ - return yyleng; -} - -/** Get the current token. - * - */ - -char *yyget_text (void) -{ - return yytext; -} - -/** Set the current line number. - * @param line_number - * - */ -void yyset_lineno (int line_number ) -{ - - yylineno = line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in (FILE * in_str ) -{ - yyin = in_str ; -} - -void yyset_out (FILE * out_str ) -{ - yyout = out_str ; -} - -int yyget_debug (void) -{ - return yy_flex_debug; -} - -void yyset_debug (int bdebug ) -{ - yy_flex_debug = bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = (FILE *) 0; - yyout = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *yyrealloc (void * ptr, yy_size_t size ) -{ - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void yyfree (void * ptr ) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 496 "tqmoc.l" - - - -#endif // TQMOC_YACC_CODE - diff --git a/tqtinterface/qt4/src/tqmoc/tqmoc_yacc.cpp b/tqtinterface/qt4/src/tqmoc/tqmoc_yacc.cpp deleted file mode 100644 index 21f7dc1..0000000 --- a/tqtinterface/qt4/src/tqmoc/tqmoc_yacc.cpp +++ /dev/null @@ -1,6463 +0,0 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ - -/* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.4.1" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - -/* Using locations. */ -#define YYLSP_NEEDED 0 - - - -/* Copy the first part of user declarations. */ - -/* Line 189 of yacc.c */ -#line 57 "tqmoc.y" - -#define TQMOC_YACC_CODE -void yyerror( const char *msg ); - -#include "tqplatformdefs.h" -#include "tqasciidict.h" -#include "tqdatetime.h" -#include "tqdict.h" -#include "tqfile.h" -#include "tqdir.h" -#include "tqptrlist.h" -#include "tqregexp.h" -#include "tqstrlist.h" -#ifdef TQMOC_MWERKS_PLUGIN -# ifdef TQ_OS_MACX -# undef OLD_DEBUG -# ifdef DEBUG -# define OLD_DEBUG DEBUG -# undef DEBUG -# endif -# define DEBUG 0 -# ifndef __IMAGECAPTURE__ -# define __IMAGECAPTURE__ -# endif -# include <Carbon/Carbon.h> -# endif -# include "mwerks_mac.h" -#endif - -#include <ctype.h> -#include <stdio.h> -#include <stdlib.h> - -#if defined CONST -#undef CONST -#endif -#if defined VOID -#undef VOID -#endif - -bool isEnumType( const char* type ); -int enumIndex( const char* type ); -bool isVariantType( const char* type ); -int qvariant_nameToType( const char* name ); -static void init(); // initialize -static void initClass(); // prepare for new class -static void generateClass(); // generate C++ code for class -static void initExpression(); // prepare for new expression -static void enterNameSpace( const char *name = 0 ); -static void leaveNameSpace(); -static void selectOutsideClassState(); -static void registerClassInNamespace(); -static bool suppress_func_warn = FALSE; -static void func_warn( const char *msg ); -static void tqmoc_warn( const char *msg ); -static void tqmoc_err( const char *s ); -static void tqmoc_err( const char *s1, const char *s2 ); -static void operatorError(); -static void checkPropertyName( const char* ident ); - -static const char* const utype_map[] = -{ - "bool", - "int", - "double", - "TQString", - "TQVariant", - 0 -}; - -inline bool isIdentChar( char x ) -{ // Avoid bug in isalnum - return x == '_' || (x >= '0' && x <= '9') || - (x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z'); -} - -bool validUType( TQCString ctype ) -{ - if ( ctype.left(6) == "const " ) - ctype = ctype.mid( 6, ctype.length() - 6 ); - if ( ctype.right(1) == "&" ) - ctype = ctype.left( ctype.length() - 1 ); - else if ( ctype.right(1) == "*" ) - return TRUE; - - int i = -1; - while ( utype_map[++i] ) - if ( ctype == utype_map[i] ) - return TRUE; - - return isEnumType( ctype ); -} - -TQCString castToUType( TQCString ctype ) -{ - if ( ctype.right(1) == "&" ) - ctype = ctype.left( ctype.length() - 1 ); - if( ctype.right(1) == "]") { - int lb = ctype.findRev('['); - if(lb != -1) - ctype = ctype.left(lb) + "*"; - } - return ctype; -} - -TQCString rawUType( TQCString ctype ) -{ - ctype = castToUType( ctype ); - if ( ctype.left(6) == "const " ) - ctype = ctype.mid( 6, ctype.length() - 6 ); - return ctype; -} - -TQCString uType( TQCString ctype ) -{ - if ( !validUType( ctype ) ) { - if ( isVariantType( rawUType(ctype) ) ) - return "varptr"; - else - return "ptr"; - } - if ( ctype.left(6) == "const " ) - ctype = ctype.mid( 6, ctype.length() - 6 ); - if ( ctype.right(1) == "&" ) { - ctype = ctype.left( ctype.length() - 1 ); - } else if ( ctype.right(1) == "*" ) { - TQCString raw = ctype.left( ctype.length() - 1 ); - ctype = "ptr"; - if ( raw == "char" ) - ctype = "charstar"; - else if ( raw == "TQUnknownInterface" ) - ctype = "iface"; - else if ( raw == "TQDispatchInterface" ) - ctype = "idisp"; - else if ( isVariantType( raw ) ) - ctype = "varptr"; - } - if ( isEnumType( ctype ) ) - ctype = "enum"; - return ctype; -} - -bool isInOut( TQCString ctype ) -{ - if ( ctype.left(6) == "const " ) - return FALSE; - if ( ctype.right(1) == "&" ) - return TRUE; - if ( ctype.right(2) == "**" ) - return TRUE; - return FALSE; -} - -TQCString uTypeExtra( TQCString ctype ) -{ - TQCString typeExtra = "0"; - if ( !validUType( ctype ) ) { - if ( isVariantType( rawUType(ctype) ) ) - typeExtra.sprintf("\"\\x%02x\"", qvariant_nameToType( rawUType(ctype) ) ); - else - typeExtra.sprintf( "\"%s\"", rawUType(ctype).data() ); - return typeExtra; - } - if ( ctype.left(6) == "const " ) - ctype = ctype.mid( 6, ctype.length() - 6 ); - if ( ctype.right(1) == "&" ) - ctype = ctype.left( ctype.length() - 1 ); - if ( ctype.right(1) == "*" ) { - TQCString raw = ctype.left( ctype.length() - 1 ); - ctype = "ptr"; - if ( raw == "char" ) - ; - else if ( isVariantType( raw ) ) - typeExtra.sprintf("\"\\x%02x\"", qvariant_nameToType( raw ) ); - else - typeExtra.sprintf( "\"%s\"", raw.stripWhiteSpace().data() ); - - } else if ( isEnumType( ctype ) ) { - int idx = enumIndex( ctype ); - if ( idx >= 0 ) { - typeExtra.sprintf( "&enum_tbl[%d]", enumIndex( ctype ) ); - } else { - typeExtra.sprintf( "parentObject->enumerator(\"%s\", TRUE )", ctype.data() ); - } - typeExtra = - "\n#ifndef TQT_NO_PROPERTIES\n\t " + typeExtra + - "\n#else" - "\n\t 0" - "\n#endif // TQT_NO_PROPERTIES\n\t "; - } - return typeExtra; -} - -/* - Attention! - This table is copied from qvariant.cpp. If you change - one, change both. -*/ -static const int ntypes = 35; -static const char* const type_map[ntypes] = -{ - 0, - "TQMap<TQString,TQVariant>", - "TQValueList<TQVariant>", - "TQString", - "TQStringList", - "TQFont", - "TQPixmap", - "TQBrush", - "TQRect", - "TQSize", - "TQColor", - "TQPalette", - "TQColorGroup", - "TQIconSet", - "TQPoint", - "TQImage", - "int", - "uint", - "bool", - "double", - "TQCString", - "TQPointArray", - "TQRegion", - "TQBitmap", - "TQCursor", - "TQSizePolicy", - "TQDate", - "TQTime", - "TQDateTime", - "TQByteArray", - "TQBitArray", - "TQKeySequence", - "TQPen", - "TQ_LLONG", - "TQ_ULLONG" -}; - -int qvariant_nameToType( const char* name ) -{ - for ( int i = 0; i < ntypes; i++ ) { - if ( !qstrcmp( type_map[i], name ) ) - return i; - } - return 0; -} - -/* - Returns TRUE if the type is a TQVariant types. -*/ -bool isVariantType( const char* type ) -{ - return qvariant_nameToType( type ) != 0; -} - -/* - Replaces '>>' with '> >' (as in 'TQValueList<TQValueList<double> >'). - This function must be called to produce valid C++ code. However, - the string representation still uses '>>'. -*/ -void fixRightAngles( TQCString *str ) -{ - str->replace( TQRegExp(">>"), "> >" ); -} - -static TQCString rmWS( const char * ); - -enum Access { Private, Protected, Public }; - - -class Argument // single arg meta data -{ -public: - Argument( const char *left, const char *right, const char* argName = 0, bool isDefaultArgument = FALSE ) - { - leftType = rmWS( left ); - rightType = rmWS( right ); - if ( leftType == "void" && rightType.isEmpty() ) - leftType = ""; - - int len = leftType.length(); - - /* - Convert 'char const *' into 'const char *'. Start at index 1, - not 0, because 'const char *' is already OK. - */ - for ( int i = 1; i < len; i++ ) { - if ( leftType[i] == 'c' && - strncmp(leftType.data() + i + 1, "onst", 4) == 0 - && (i + 5 >= len || !isIdentChar(leftType[i + 5])) - && !isIdentChar(i-1) - ) { - leftType.remove( i, 5 ); - if ( leftType[i - 1] == ' ' ) - leftType.remove( i - 1, 1 ); - leftType.prepend( "const " ); - break; - } - - /* - We musn't convert 'char * const *' into 'const char **' - and we must beware of 'Bar<const Bla>'. - */ - if ( leftType[i] == '&' || leftType[i] == '*' || - leftType[i] == '<' ) - break; - } - - name = argName; - isDefault = isDefaultArgument; - } - - TQCString leftType; - TQCString rightType; - TQCString name; - bool isDefault; -}; - -class ArgList : public TQPtrList<Argument> { // member function arg list -public: - ArgList() { setAutoDelete( TRUE ); } - ~ArgList() { clear(); } - - /* the clone has one default argument less, the orignal has all default arguments removed */ - ArgList* magicClone() { - ArgList* l = new ArgList; - bool firstDefault = FALSE; - for ( first(); current(); next() ) { - bool isDefault = current()->isDefault; - if ( !firstDefault && isDefault ) { - isDefault = FALSE; - firstDefault = TRUE; - } - l->append( new Argument( current()->leftType, current()->rightType, current()->name, isDefault ) ); - } - for ( first(); current(); ) { - if ( current()->isDefault ) - remove(); - else - next(); - } - return l; - } - - bool hasDefaultArguments() { - for ( Argument* a = first(); a; a = next() ) { - if ( a->isDefault ) - return TRUE; - } - return FALSE; - } - -}; - - -struct Function // member function meta data -{ - Access access; - TQCString qualifier; // const or volatile - TQCString name; - TQCString type; - TQCString signature; - int lineNo; - ArgList *args; - Function() { args=0;} - ~Function() { delete args; } - const char* accessAsString() { - switch ( access ) { - case Private: return "Private"; - case Protected: return "Protected"; - default: return "Public"; - } - } -}; - -class FuncList : public TQPtrList<Function> { // list of member functions -public: - FuncList( bool autoDelete = FALSE ) { setAutoDelete( autoDelete ); } - - FuncList find( const char* name ) - { - FuncList result; - for ( TQPtrListIterator<Function> it(*this); it.current(); ++it ) { - if ( it.current()->name == name ) - result.append( it.current() ); - } - return result; - } -}; - -class Enum : public TQStrList -{ -public: - TQCString name; - bool set; -}; - -class EnumList : public TQPtrList<Enum> { // list of property enums -public: - EnumList() { setAutoDelete(TRUE); } -}; - - -struct Property -{ - Property( int l, const char* t, const char* n, const char* s, const char* g, const char* r, - const TQCString& st, const TQCString& d, const TQCString& sc, bool ov ) - : lineNo(l), type(t), name(n), set(s), get(g), reset(r), setfunc(0), getfunc(0), - sspec(Unspecified), gspec(Unspecified), stored( st ), - designable( d ), scriptable( sc ), override( ov ), oredEnum( -1 ) - { - /* - The Q_PROPERTY construct cannot contain any commas, since - commas separate macro arguments. We therefore expect users - to type "TQMap" instead of "TQMap<TQString, TQVariant>". For - coherence, we also expect the same for - TQValueList<TQVariant>, the other template class supported by - TQVariant. - */ - if ( type == "TQMap" ) { - type = "TQMap<TQString,TQVariant>"; - } else if ( type == "TQValueList" ) { - type = "TQValueList<TQVariant>"; - } else if ( type == "LongLong" ) { - type = "TQ_LLONG"; - } else if ( type == "ULongLong" ) { - type = "TQ_ULLONG"; - } - } - - int lineNo; - TQCString type; - TQCString name; - TQCString set; - TQCString get; - TQCString reset; - TQCString stored; - TQCString designable; - TQCString scriptable; - bool override; - - Function* setfunc; - Function* getfunc; - - int oredEnum; // If the enums item may be ored. That means the data type is int. - // Allowed values are 1 (True), 0 (False), and -1 (Unset) - TQCString enumsettype; // contains the set function type in case of oredEnum - TQCString enumgettype; // contains the get function type in case of oredEnum - - enum Specification { Unspecified, Class, Reference, Pointer, ConstCharStar }; - Specification sspec; - Specification gspec; - - bool stdSet() { - TQCString s = "set"; - s += toupper( name[0] ); - s += name.mid( 1 ); - return s == set; - } - - static const char* specToString( Specification s ) - { - switch ( s ) { - case Class: - return "Class"; - case Reference: - return "Reference"; - case Pointer: - return "Pointer"; - case ConstCharStar: - return "ConstCharStar"; - default: - return "Unspecified"; - } - } -}; - -class PropList : public TQPtrList<Property> { // list of properties -public: - PropList() { setAutoDelete( TRUE ); } -}; - - -struct ClassInfo -{ - ClassInfo( const char* n, const char* v ) - : name(n), value(v) - {} - TQCString name; - TQCString value; -}; - -class ClassInfoList : public TQPtrList<ClassInfo> { // list of class infos -public: - ClassInfoList() { setAutoDelete( TRUE ); } -}; - -class parser_reg { - public: - parser_reg(); - ~parser_reg(); - - // some temporary values - TQCString tmpExpression; // Used to store the characters the lexer - // is currently skipping (see addExpressionChar and friends) - TQCString fileName; // file name - TQCString outputFile; // output file name - TQCString pchFile; // name of PCH file (used on Windows) - TQStrList includeFiles; // name of #include files - TQCString includePath; // #include file path - TQCString qtPath; // #include qt file path - int gen_count; //number of classes generated - bool noInclude; // no #include <filename> - bool generatedCode; // no code generated - bool tqmocError; // tqmoc parsing error occurred - bool hasVariantIncluded; //whether or not qvariant.h was included yet - TQCString className; // name of parsed class - TQCString superClassName; // name of first super class - TQStrList multipleSuperClasses; // other superclasses - FuncList tqsignals; // signal interface - FuncList tqslots; // tqslots interface - FuncList propfuncs; // all possible property access functions - FuncList funcs; // all parsed functions, including tqsignals - EnumList enums; // enums used in properties - PropList props; // list of all properties - ClassInfoList infos; // list of all class infos - -// Used to store the values in the Q_PROPERTY macro - TQCString propWrite; // set function - TQCString propRead; // get function - TQCString propReset; // reset function - TQCString propStored; // - TQCString propDesignable; // "true", "false" or function or empty if not specified - TQCString propScriptable; // "true", "false" or function or empty if not specified - bool propOverride; // Wether OVERRIDE was detected - - TQStrList qtEnums; // Used to store the contents of TQ_ENUMS - TQStrList qtSets; // Used to store the contents of TQ_SETS - -}; - -static parser_reg *g = 0; - -ArgList *addArg( Argument * ); // add arg to tmpArgList - -enum Member { SignalMember, - SlotMember, - PropertyCandidateMember - }; - -void addMember( Member ); // add tmpFunc to current class -void addEnum(); // add tmpEnum to current class - -char *stradd( const char *, const char * ); // add two strings -char *stradd( const char *, const char *, // add three strings - const char * ); -char *stradd( const char *, const char *, // adds 4 strings - const char *, const char * ); - -char *straddSpc( const char *, const char * ); -char *straddSpc( const char *, const char *, - const char * ); -char *straddSpc( const char *, const char *, - const char *, const char * ); - -extern int yydebug; -bool lexDebug = FALSE; -int lineNo; // current line number -bool errorControl = FALSE; // controled errors -bool displayWarnings = TRUE; -bool skipClass; // don't generate for class -bool skipFunc; // don't generate for func -bool templateClass; // class is a template -bool templateClassOld; // previous class is a template - -ArgList *tmpArgList; // current argument list -Function *tmpFunc; // current member function -Enum *tmpEnum; // current enum -Access tmpAccess; // current access permission -Access subClassPerm; // current access permission - -bool TQ_OBJECTdetected; // TRUE if current class - // contains the TQ_OBJECT macro -bool Q_PROPERTYdetected; // TRUE if current class - // contains at least one Q_PROPERTY, - // TQ_OVERRIDE, TQ_SETS or TQ_ENUMS macro -bool tmpPropOverride; // current property override setting - -int tmpYYStart; // Used to store the lexers current mode -int tmpYYStart2; // Used to store the lexers current mode - // (if tmpYYStart is already used) - -// if the format revision changes, you MUST change it in qmetaobject.h too -const int formatRevision = 26; // tqmoc output format revision - -// if the flags change, you HAVE to change it in qmetaobject.h too -enum Flags { - Invalid = 0x00000000, - Readable = 0x00000001, - Writable = 0x00000002, - EnumOrSet = 0x00000004, - UnresolvedEnum = 0x00000008, - StdSet = 0x00000100, - Override = 0x00000200, - NotDesignable = 0x00001000, - DesignableOverride = 0x00002000, - NotScriptable = 0x00004000, - ScriptableOverride = 0x00008000, - NotStored = 0x00010000, - StoredOverride = 0x00020000 -}; - - -#ifdef YYBISON -# if defined(TQ_OS_WIN32) -# include <io.h> -# undef isatty -extern "C" int hack_isatty( int ) - { - return 0; - } -# define isatty hack_isatty -# else -# include <unistd.h> -# endif - -# define YYDEBUG 1 -# include "tqmoc_yacc.h" -# include "tqmoc_lex.cpp" -#endif //YYBISON - - -/* Line 189 of yacc.c */ -#line 706 "tqmoc_yacc.cpp" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - CHAR_VAL = 258, - INT_VAL = 259, - DOUBLE_VAL = 260, - STRING = 261, - IDENTIFIER = 262, - FRIEND = 263, - TYPEDEF = 264, - AUTO = 265, - REGISTER = 266, - STATIC = 267, - EXTERN = 268, - INLINE = 269, - VIRTUAL = 270, - CONST = 271, - VOLATILE = 272, - CHAR = 273, - SHORT = 274, - INT = 275, - LONG = 276, - SIGNED = 277, - UNSIGNED = 278, - FLOAT = 279, - DOUBLE = 280, - VOID = 281, - ENUM = 282, - CLASS = 283, - STRUCT = 284, - UNION = 285, - ASM = 286, - PRIVATE = 287, - PROTECTED = 288, - PUBLIC = 289, - OPERATOR = 290, - DBL_COLON = 291, - TRIPLE_DOT = 292, - TEMPLATE = 293, - NAMESPACE = 294, - USING = 295, - MUTABLE = 296, - THROW = 297, - SIGNALS = 298, - SLOTS = 299, - TQ_OBJECT = 300, - Q_PROPERTY = 301, - TQ_OVERRIDE = 302, - TQ_CLASSINFO = 303, - TQ_ENUMS = 304, - TQ_SETS = 305, - READ = 306, - WRITE = 307, - STORED = 308, - DESIGNABLE = 309, - SCRIPTABLE = 310, - RESET = 311 - }; -#endif -/* Tokens. */ -#define CHAR_VAL 258 -#define INT_VAL 259 -#define DOUBLE_VAL 260 -#define STRING 261 -#define IDENTIFIER 262 -#define FRIEND 263 -#define TYPEDEF 264 -#define AUTO 265 -#define REGISTER 266 -#define STATIC 267 -#define EXTERN 268 -#define INLINE 269 -#define VIRTUAL 270 -#define CONST 271 -#define VOLATILE 272 -#define CHAR 273 -#define SHORT 274 -#define INT 275 -#define LONG 276 -#define SIGNED 277 -#define UNSIGNED 278 -#define FLOAT 279 -#define DOUBLE 280 -#define VOID 281 -#define ENUM 282 -#define CLASS 283 -#define STRUCT 284 -#define UNION 285 -#define ASM 286 -#define PRIVATE 287 -#define PROTECTED 288 -#define PUBLIC 289 -#define OPERATOR 290 -#define DBL_COLON 291 -#define TRIPLE_DOT 292 -#define TEMPLATE 293 -#define NAMESPACE 294 -#define USING 295 -#define MUTABLE 296 -#define THROW 297 -#define SIGNALS 298 -#define SLOTS 299 -#define TQ_OBJECT 300 -#define Q_PROPERTY 301 -#define TQ_OVERRIDE 302 -#define TQ_CLASSINFO 303 -#define TQ_ENUMS 304 -#define TQ_SETS 305 -#define READ 306 -#define WRITE 307 -#define STORED 308 -#define DESIGNABLE 309 -#define SCRIPTABLE 310 -#define RESET 311 - - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -{ - -/* Line 214 of yacc.c */ -#line 692 "tqmoc.y" - - char char_val; - int int_val; - double double_val; - char *string; - Access access; - Function *function; - ArgList *arg_list; - Argument *arg; - - - -/* Line 214 of yacc.c */ -#line 867 "tqmoc_yacc.cpp" -} YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - - -/* Copy the second part of user declarations. */ - - -/* Line 264 of yacc.c */ -#line 879 "tqmoc_yacc.cpp" - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if YYENABLE_NLS -# if ENABLE_NLS -# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) -# endif -# endif -# ifndef YY_ -# define YY_(msgid) msgid -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) -#else -# define YYUSE(e) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) -#else -static int -YYID (yyi) - int yyi; -#endif -{ - return yyi; -} -#endif - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined _STDLIB_H \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) - -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 2 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 612 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 79 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 140 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 329 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 492 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 311 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 78, 2, 2, 2, 74, 69, 2, - 66, 67, 68, 71, 63, 72, 2, 73, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 70, 60, - 61, 59, 62, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 64, 2, 65, 75, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 57, 76, 58, 77, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56 -}; - -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint16 yyprhs[] = -{ - 0, 0, 3, 4, 7, 9, 11, 13, 15, 17, - 19, 21, 22, 23, 31, 32, 33, 40, 42, 48, - 51, 54, 57, 58, 62, 64, 66, 71, 72, 73, - 74, 75, 77, 79, 81, 83, 85, 89, 90, 92, - 94, 97, 99, 101, 103, 105, 107, 109, 111, 113, - 115, 117, 119, 122, 124, 126, 128, 130, 132, 134, - 136, 138, 140, 142, 147, 148, 150, 153, 156, 158, - 161, 165, 167, 170, 173, 176, 179, 183, 184, 186, - 187, 189, 190, 192, 196, 198, 201, 202, 208, 213, - 214, 222, 223, 225, 228, 229, 234, 235, 241, 243, - 247, 249, 252, 253, 259, 263, 265, 274, 276, 279, - 280, 285, 286, 292, 293, 298, 299, 305, 306, 308, - 310, 313, 316, 319, 320, 322, 324, 327, 329, 331, - 333, 335, 339, 340, 344, 345, 351, 353, 357, 361, - 366, 369, 371, 373, 375, 377, 379, 382, 386, 389, - 393, 394, 396, 401, 402, 404, 407, 409, 413, 414, - 420, 421, 423, 424, 426, 429, 431, 433, 435, 436, - 440, 441, 446, 448, 449, 450, 458, 459, 460, 468, - 469, 470, 480, 481, 482, 490, 491, 492, 500, 503, - 507, 508, 512, 514, 515, 517, 520, 522, 524, 525, - 527, 530, 532, 534, 535, 537, 540, 542, 544, 545, - 548, 551, 555, 557, 562, 567, 569, 573, 576, 580, - 583, 585, 589, 592, 596, 599, 601, 603, 605, 609, - 613, 615, 617, 619, 621, 623, 625, 627, 629, 631, - 633, 635, 637, 639, 642, 645, 648, 651, 654, 657, - 660, 663, 666, 669, 672, 675, 678, 681, 684, 688, - 692, 695, 698, 701, 704, 706, 710, 713, 716, 719, - 720, 722, 725, 727, 731, 737, 740, 744, 749, 753, - 756, 763, 768, 774, 778, 783, 790, 795, 800, 806, - 810, 814, 815, 816, 824, 826, 830, 832, 833, 838, - 839, 843, 844, 845, 849, 852, 853, 855, 861, 866, - 867, 869, 870, 872, 876, 878, 879, 884, 885, 890, - 891, 895, 899, 903, 907, 911, 915, 916, 919, 920 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int16 yyrhs[] = -{ - 80, 0, -1, -1, 80, 81, -1, 93, -1, 82, - -1, 90, -1, 92, -1, 91, -1, 83, -1, 86, - -1, -1, -1, 39, 7, 84, 57, 85, 89, 58, - -1, -1, -1, 39, 87, 57, 88, 89, 58, -1, - 80, -1, 39, 7, 59, 114, 60, -1, 40, 39, - -1, 40, 7, -1, 40, 36, -1, -1, 94, 148, - 60, -1, 7, -1, 96, -1, 7, 61, 97, 62, - -1, -1, -1, -1, -1, 105, -1, 107, -1, 106, - -1, 8, -1, 9, -1, 103, 108, 103, -1, -1, - 104, -1, 101, -1, 104, 101, -1, 10, -1, 11, - -1, 12, -1, 13, -1, 14, -1, 15, -1, 16, - -1, 17, -1, 116, -1, 114, -1, 109, -1, 109, - 110, -1, 110, -1, 18, -1, 19, -1, 20, -1, - 21, -1, 22, -1, 23, -1, 24, -1, 25, -1, - 26, -1, 38, 61, 97, 62, -1, -1, 111, -1, - 112, 28, -1, 112, 29, -1, 115, -1, 36, 115, - -1, 115, 36, 95, -1, 95, -1, 113, 7, -1, - 27, 7, -1, 30, 7, -1, 118, 120, -1, 121, - 63, 37, -1, -1, 121, -1, -1, 122, -1, -1, - 37, -1, 121, 63, 122, -1, 122, -1, 102, 125, - -1, -1, 102, 125, 59, 123, 99, -1, 102, 125, - 131, 125, -1, -1, 102, 125, 131, 125, 59, 124, - 99, -1, -1, 126, -1, 126, 141, -1, -1, 64, - 127, 98, 65, -1, -1, 126, 64, 128, 98, 65, - -1, 141, -1, 66, 126, 67, -1, 131, -1, 129, - 141, -1, -1, 129, 64, 130, 98, 65, -1, 66, - 129, 67, -1, 7, -1, 66, 117, 67, 142, 156, - 154, 210, 145, -1, 7, -1, 7, 136, -1, -1, - 7, 59, 134, 98, -1, -1, 7, 136, 59, 135, - 98, -1, -1, 64, 137, 98, 65, -1, -1, 136, - 64, 138, 98, 65, -1, -1, 140, -1, 141, -1, - 140, 141, -1, 68, 142, -1, 69, 142, -1, -1, - 143, -1, 144, -1, 143, 144, -1, 16, -1, 17, - -1, 60, -1, 146, -1, 59, 4, 60, -1, -1, - 57, 147, 58, -1, -1, 152, 57, 149, 162, 58, - -1, 151, -1, 151, 68, 7, -1, 151, 69, 7, - -1, 151, 66, 7, 67, -1, 111, 150, -1, 7, - -1, 110, -1, 107, -1, 105, -1, 106, -1, 113, - 115, -1, 113, 7, 95, -1, 151, 161, -1, 113, - 115, 161, -1, -1, 155, -1, 42, 66, 119, 67, - -1, -1, 157, -1, 70, 158, -1, 159, -1, 159, - 63, 158, -1, -1, 114, 66, 160, 98, 67, -1, - -1, 190, -1, -1, 163, -1, 163, 165, -1, 165, - -1, 194, -1, 44, -1, -1, 164, 166, 178, -1, - -1, 43, 167, 70, 183, -1, 45, -1, -1, -1, - 46, 168, 66, 214, 67, 169, 180, -1, -1, -1, - 47, 170, 66, 214, 67, 171, 180, -1, -1, -1, - 48, 172, 66, 6, 63, 6, 67, 173, 180, -1, - -1, -1, 49, 174, 66, 217, 67, 175, 180, -1, - -1, -1, 50, 176, 66, 218, 67, 177, 180, -1, - 43, 70, -1, 44, 70, 186, -1, -1, 70, 179, - 180, -1, 7, -1, -1, 181, -1, 181, 182, -1, - 182, -1, 198, -1, -1, 184, -1, 184, 185, -1, - 185, -1, 198, -1, -1, 187, -1, 187, 188, -1, - 188, -1, 198, -1, -1, 189, 60, -1, 70, 191, - -1, 191, 63, 193, -1, 193, -1, 7, 66, 7, - 67, -1, 7, 66, 110, 67, -1, 114, -1, 15, - 194, 114, -1, 15, 114, -1, 194, 15, 114, -1, - 194, 114, -1, 192, -1, 15, 194, 192, -1, 15, - 192, -1, 194, 15, 192, -1, 194, 192, -1, 32, - -1, 33, -1, 34, -1, 103, 7, 139, -1, 103, - 110, 139, -1, 71, -1, 72, -1, 68, -1, 73, - -1, 74, -1, 75, -1, 69, -1, 76, -1, 77, - -1, 78, -1, 59, -1, 61, -1, 62, -1, 71, - 59, -1, 72, 59, -1, 68, 59, -1, 73, 59, - -1, 74, 59, -1, 75, 59, -1, 69, 59, -1, - 76, 59, -1, 77, 59, -1, 78, 59, -1, 59, - 59, -1, 61, 59, -1, 62, 59, -1, 61, 61, - -1, 62, 62, -1, 61, 61, 59, -1, 62, 62, - 59, -1, 69, 69, -1, 76, 76, -1, 71, 71, - -1, 72, 72, -1, 63, -1, 72, 62, 68, -1, - 72, 62, -1, 66, 67, -1, 64, 65, -1, -1, - 15, -1, 108, 133, -1, 133, -1, 196, 77, 133, - -1, 104, 108, 103, 139, 133, -1, 104, 108, -1, - 108, 140, 133, -1, 108, 104, 139, 133, -1, 108, - 35, 195, -1, 35, 195, -1, 104, 108, 103, 139, - 35, 195, -1, 108, 140, 35, 195, -1, 108, 104, - 139, 35, 195, -1, 197, 132, 189, -1, 197, 205, - 60, 189, -1, 197, 205, 63, 201, 60, 189, -1, - 207, 210, 60, 189, -1, 40, 114, 60, 189, -1, - 40, 39, 114, 60, 189, -1, 39, 7, 57, -1, - 153, 60, 189, -1, -1, -1, 153, 57, 199, 58, - 200, 60, 189, -1, 202, -1, 201, 63, 202, -1, - 129, -1, -1, 7, 70, 203, 98, -1, -1, 70, - 204, 98, -1, -1, -1, 70, 206, 98, -1, 27, - 209, -1, -1, 63, -1, 7, 57, 211, 208, 58, - -1, 57, 211, 208, 58, -1, -1, 7, -1, -1, - 212, -1, 211, 63, 212, -1, 7, -1, -1, 7, - 59, 213, 100, -1, -1, 7, 7, 215, 216, -1, - -1, 51, 7, 216, -1, 52, 7, 216, -1, 56, - 7, 216, -1, 53, 7, 216, -1, 54, 7, 216, - -1, 55, 7, 216, -1, -1, 7, 217, -1, -1, - 7, 218, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 807, 807, 808, 811, 813, 814, 815, 816, 819, - 820, 824, 825, 823, 832, 833, 832, 840, 843, 848, - 851, 852, 855, 855, 864, 865, 868, 880, 893, 902, - 905, 911, 912, 913, 914, 915, 918, 921, 922, 925, - 926, 929, 930, 931, 932, 935, 936, 939, 940, 943, - 944, 945, 948, 950, 953, 954, 955, 956, 957, 958, - 959, 960, 961, 964, 970, 971, 977, 978, 981, 982, - 986, 988, 992, 993, 994, 999, 1000, 1006, 1007, 1010, - 1011, 1014, 1015, 1021, 1024, 1027, 1030, 1029, 1033, 1038, - 1036, 1044, 1045, 1048, 1050, 1050, 1055, 1055, 1060, 1061, - 1064, 1065, 1067, 1067, 1072, 1075, 1078, 1090, 1091, 1093, - 1093, 1096, 1096, 1102, 1102, 1104, 1104, 1109, 1110, 1113, - 1114, 1117, 1118, 1125, 1126, 1129, 1130, 1134, 1135, 1138, - 1139, 1140, 1143, 1143, 1151, 1150, 1156, 1158, 1160, 1162, - 1166, 1170, 1171, 1172, 1173, 1174, 1178, 1184, 1193, 1197, - 1202, 1203, 1207, 1210, 1211, 1214, 1217, 1218, 1222, 1222, - 1227, 1228, 1231, 1232, 1235, 1236, 1240, 1241, 1245, 1245, - 1247, 1247, 1249, 1257, 1260, 1257, 1264, 1267, 1264, 1271, - 1273, 1271, 1278, 1279, 1278, 1284, 1285, 1284, 1292, 1294, - 1295, 1295, 1305, 1312, 1313, 1316, 1317, 1320, 1323, 1324, - 1327, 1328, 1332, 1335, 1336, 1339, 1340, 1343, 1346, 1347, - 1350, 1353, 1354, 1357, 1359, 1363, 1364, 1365, 1366, 1367, - 1368, 1369, 1370, 1371, 1372, 1375, 1376, 1377, 1380, 1381, - 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, - 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, - 1402, 1403, 1404, 1405, 1406, 1407, 1408, 1409, 1410, 1411, - 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419, 1420, 1424, - 1425, 1428, 1431, 1438, 1445, 1453, 1455, 1459, 1464, 1466, - 1468, 1471, 1473, 1479, 1480, 1482, 1485, 1487, 1489, 1491, - 1494, 1497, 1500, 1496, 1505, 1506, 1509, 1510, 1510, 1512, - 1512, 1516, 1517, 1517, 1522, 1527, 1528, 1531, 1538, 1542, - 1543, 1546, 1547, 1548, 1551, 1552, 1552, 1557, 1556, 1593, - 1594, 1595, 1596, 1597, 1598, 1599, 1602, 1603, 1606, 1607 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "CHAR_VAL", "INT_VAL", "DOUBLE_VAL", - "STRING", "IDENTIFIER", "FRIEND", "TYPEDEF", "AUTO", "REGISTER", - "STATIC", "EXTERN", "INLINE", "VIRTUAL", "CONST", "VOLATILE", "CHAR", - "SHORT", "INT", "LONG", "SIGNED", "UNSIGNED", "FLOAT", "DOUBLE", "VOID", - "ENUM", "CLASS", "STRUCT", "UNION", "ASM", "PRIVATE", "PROTECTED", - "PUBLIC", "OPERATOR", "DBL_COLON", "TRIPLE_DOT", "TEMPLATE", "NAMESPACE", - "USING", "MUTABLE", "THROW", "SIGNALS", "SLOTS", "TQ_OBJECT", - "Q_PROPERTY", "TQ_OVERRIDE", "TQ_CLASSINFO", "TQ_ENUMS", "TQ_SETS", - "READ", "WRITE", "STORED", "DESIGNABLE", "SCRIPTABLE", "RESET", "'{'", - "'}'", "'='", "';'", "'<'", "'>'", "','", "'['", "']'", "'('", "')'", - "'*'", "'&'", "':'", "'+'", "'-'", "'/'", "'%'", "'^'", "'|'", "'~'", - "'!'", "$accept", "declaration_seq", "declaration", "namespace_def", - "named_namespace_def", "$@1", "$@2", "unnamed_namespace_def", "$@3", - "$@4", "namespace_body", "namespace_alias_def", "using_directive", - "using_declaration", "class_def", "$@5", "class_name", - "template_class_name", "template_args", "const_expression", - "def_argument", "enumerator_expression", "decl_specifier", - "decl_specifiers", "decl_specs_opt", "decl_specs", - "storage_class_specifier", "fct_specifier", "type_specifier", - "type_name", "simple_type_names", "simple_type_name", "template_spec", - "opt_template_spec", "class_key", "complete_class_name", - "qualified_class_name", "elaborated_type_specifier", - "argument_declaration_list", "arg_declaration_list_opt", - "opt_exception_argument", "triple_dot_opt", "arg_declaration_list", - "argument_declaration", "$@6", "$@7", "abstract_decl_opt", - "abstract_decl", "$@8", "$@9", "declarator", "$@10", "dname", "fct_decl", - "fct_name", "$@11", "$@12", "array_decls", "$@13", "$@14", - "ptr_operators_opt", "ptr_operators", "ptr_operator", - "cv_qualifier_list_opt", "cv_qualifier_list", "cv_qualifier", - "fct_body_or_semicolon", "fct_body", "$@15", "class_specifier", "$@16", - "whatever", "class_head", "full_class_head", "nested_class_head", - "exception_spec_opt", "exception_spec", "ctor_initializer_opt", - "ctor_initializer", "mem_initializer_list", "mem_initializer", "$@17", - "opt_base_spec", "opt_obj_member_list", "obj_member_list", - "qt_access_specifier", "obj_member_area", "$@18", "$@19", "$@20", "$@21", - "$@22", "$@23", "$@24", "$@25", "$@26", "$@27", "$@28", "$@29", - "slot_area", "$@30", "opt_property_candidates", - "property_candidate_declarations", "property_candidate_declaration", - "opt_signal_declarations", "signal_declarations", "signal_declaration", - "opt_slot_declarations", "slot_declarations", "slot_declaration", - "opt_semicolons", "base_spec", "base_list", "qt_macro_name", - "base_specifier", "access_specifier", "operator_name", "opt_virtual", - "type_and_name", "signal_or_slot", "$@31", "$@32", - "member_declarator_list", "member_declarator", "$@33", "$@34", - "opt_bitfield", "$@35", "enum_specifier", "opt_komma", "enum_tail", - "opt_identifier", "enum_list", "enumerator", "$@36", "property", "$@37", - "prop_statements", "qt_enums", "qt_sets", 0 -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 123, 125, 61, - 59, 60, 62, 44, 91, 93, 40, 41, 42, 38, - 58, 43, 45, 47, 37, 94, 124, 126, 33 -}; -# endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 79, 80, 80, 81, 81, 81, 81, 81, 82, - 82, 84, 85, 83, 87, 88, 86, 89, 90, 91, - 92, 92, 94, 93, 95, 95, 96, 97, 98, 99, - 100, 101, 101, 101, 101, 101, 102, 103, 103, 104, - 104, 105, 105, 105, 105, 106, 106, 107, 107, 108, - 108, 108, 109, 109, 110, 110, 110, 110, 110, 110, - 110, 110, 110, 111, 112, 112, 113, 113, 114, 114, - 115, 115, 116, 116, 116, 117, 117, 118, 118, 119, - 119, 120, 120, 121, 121, 122, 123, 122, 122, 124, - 122, 125, 125, 126, 127, 126, 128, 126, 126, 126, - 129, 129, 130, 129, 129, 131, 132, 133, 133, 134, - 133, 135, 133, 137, 136, 138, 136, 139, 139, 140, - 140, 141, 141, 142, 142, 143, 143, 144, 144, 145, - 145, 145, 147, 146, 149, 148, 148, 148, 148, 148, - 148, 150, 150, 150, 150, 150, 151, 151, 152, 153, - 154, 154, 155, 156, 156, 157, 158, 158, 160, 159, - 161, 161, 162, 162, 163, 163, 164, 164, 166, 165, - 167, 165, 165, 168, 169, 165, 170, 171, 165, 172, - 173, 165, 174, 175, 165, 176, 177, 165, 178, 178, - 179, 178, 178, 180, 180, 181, 181, 182, 183, 183, - 184, 184, 185, 186, 186, 187, 187, 188, 189, 189, - 190, 191, 191, 192, 192, 193, 193, 193, 193, 193, - 193, 193, 193, 193, 193, 194, 194, 194, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 196, - 196, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 198, 198, 198, 198, 198, 198, 198, - 198, 199, 200, 198, 201, 201, 202, 203, 202, 204, - 202, 205, 206, 205, 207, 208, 208, 209, 209, 210, - 210, 211, 211, 211, 212, 213, 212, 215, 214, 216, - 216, 216, 216, 216, 216, 216, 217, 217, 218, 218 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 0, 2, 1, 1, 1, 1, 1, 1, - 1, 0, 0, 7, 0, 0, 6, 1, 5, 2, - 2, 2, 0, 3, 1, 1, 4, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 3, 0, 1, 1, - 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 4, 0, 1, 2, 2, 1, 2, - 3, 1, 2, 2, 2, 2, 3, 0, 1, 0, - 1, 0, 1, 3, 1, 2, 0, 5, 4, 0, - 7, 0, 1, 2, 0, 4, 0, 5, 1, 3, - 1, 2, 0, 5, 3, 1, 8, 1, 2, 0, - 4, 0, 5, 0, 4, 0, 5, 0, 1, 1, - 2, 2, 2, 0, 1, 1, 2, 1, 1, 1, - 1, 3, 0, 3, 0, 5, 1, 3, 3, 4, - 2, 1, 1, 1, 1, 1, 2, 3, 2, 3, - 0, 1, 4, 0, 1, 2, 1, 3, 0, 5, - 0, 1, 0, 1, 2, 1, 1, 1, 0, 3, - 0, 4, 1, 0, 0, 7, 0, 0, 7, 0, - 0, 9, 0, 0, 7, 0, 0, 7, 2, 3, - 0, 3, 1, 0, 1, 2, 1, 1, 0, 1, - 2, 1, 1, 0, 1, 2, 1, 1, 0, 2, - 2, 3, 1, 4, 4, 1, 3, 2, 3, 2, - 1, 3, 2, 3, 2, 1, 1, 1, 3, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, - 2, 2, 2, 2, 1, 3, 2, 2, 2, 0, - 1, 2, 1, 3, 5, 2, 3, 4, 3, 2, - 6, 4, 5, 3, 4, 6, 4, 4, 5, 3, - 3, 0, 0, 7, 1, 3, 1, 0, 4, 0, - 3, 0, 0, 3, 2, 0, 1, 5, 4, 0, - 1, 0, 1, 3, 1, 0, 4, 0, 4, 0, - 3, 3, 3, 3, 3, 3, 0, 2, 0, 2 -}; - -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint16 yydefact[] = -{ - 2, 22, 1, 14, 0, 3, 5, 9, 10, 6, - 8, 7, 4, 64, 11, 0, 20, 21, 19, 0, - 65, 0, 0, 0, 136, 0, 0, 0, 15, 27, - 141, 41, 42, 43, 44, 45, 46, 47, 48, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 144, 145, - 143, 142, 140, 66, 67, 24, 71, 25, 146, 23, - 0, 0, 0, 0, 148, 161, 134, 24, 0, 0, - 68, 12, 2, 0, 27, 147, 0, 0, 137, 138, - 24, 0, 225, 226, 227, 215, 210, 220, 212, 0, - 162, 69, 18, 2, 22, 0, 63, 0, 70, 139, - 0, 217, 222, 0, 0, 0, 219, 224, 170, 167, - 172, 173, 176, 179, 182, 185, 0, 163, 168, 165, - 166, 0, 16, 26, 0, 0, 216, 221, 211, 218, - 223, 0, 0, 0, 0, 0, 0, 135, 164, 0, - 13, 213, 214, 198, 0, 0, 0, 326, 328, 192, - 0, 0, 190, 169, 24, 34, 35, 46, 0, 0, - 37, 0, 0, 39, 64, 31, 33, 32, 0, 51, - 53, 65, 0, 50, 49, 272, 0, 171, 199, 201, - 0, 301, 202, 309, 0, 0, 0, 0, 326, 0, - 328, 0, 188, 203, 193, 109, 113, 108, 73, 311, - 304, 74, 240, 241, 242, 264, 0, 0, 232, 236, - 230, 231, 233, 234, 235, 237, 238, 239, 0, 38, - 279, 0, 0, 0, 0, 40, 37, 0, 107, 37, - 123, 123, 117, 271, 0, 119, 52, 72, 160, 291, - 208, 200, 0, 37, 302, 208, 0, 310, 0, 317, - 174, 177, 0, 327, 183, 329, 186, 189, 204, 206, - 207, 191, 194, 196, 197, 28, 28, 111, 115, 311, - 314, 305, 312, 253, 254, 256, 255, 257, 268, 267, - 245, 249, 260, 243, 262, 244, 266, 263, 246, 247, - 248, 250, 261, 251, 252, 117, 117, 289, 0, 208, - 73, 117, 72, 278, 127, 128, 121, 124, 125, 122, - 0, 118, 37, 276, 120, 149, 0, 290, 273, 91, - 64, 0, 81, 78, 84, 28, 283, 208, 0, 208, - 319, 193, 193, 0, 193, 193, 205, 195, 110, 0, - 28, 28, 305, 315, 306, 0, 258, 259, 265, 228, - 229, 208, 287, 0, 126, 37, 277, 281, 292, 209, - 94, 0, 85, 92, 98, 37, 123, 82, 75, 37, - 303, 284, 105, 0, 299, 296, 100, 0, 294, 286, - 0, 0, 0, 0, 0, 0, 318, 175, 178, 180, - 184, 187, 114, 112, 0, 0, 30, 313, 308, 288, - 37, 274, 282, 0, 28, 0, 105, 86, 91, 96, - 93, 36, 153, 76, 83, 297, 0, 28, 102, 101, - 208, 0, 319, 319, 319, 319, 319, 319, 193, 116, - 307, 316, 280, 208, 0, 99, 29, 88, 28, 0, - 150, 154, 28, 104, 300, 28, 285, 295, 320, 321, - 323, 324, 325, 322, 181, 293, 95, 87, 89, 0, - 0, 155, 156, 0, 309, 151, 298, 0, 29, 97, - 158, 0, 37, 0, 103, 90, 28, 157, 0, 80, - 132, 0, 129, 106, 130, 0, 152, 0, 0, 159, - 133, 131 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 94, 5, 6, 7, 27, 93, 8, 15, 72, - 95, 9, 10, 11, 12, 13, 56, 57, 73, 338, - 457, 431, 163, 319, 218, 164, 165, 166, 167, 168, - 169, 170, 171, 21, 172, 173, 70, 174, 321, 322, - 478, 368, 323, 324, 436, 468, 362, 363, 404, 438, - 375, 445, 376, 245, 175, 265, 340, 197, 266, 341, - 310, 311, 235, 306, 307, 308, 483, 484, 487, 23, - 90, 52, 24, 25, 176, 464, 465, 440, 441, 461, - 462, 476, 64, 116, 117, 118, 119, 139, 131, 132, - 331, 133, 332, 134, 428, 135, 334, 136, 335, 153, - 194, 261, 262, 263, 177, 178, 179, 257, 258, 259, - 317, 65, 86, 87, 88, 89, 220, 180, 181, 264, - 316, 403, 377, 378, 442, 417, 246, 325, 183, 345, - 200, 248, 271, 272, 396, 185, 330, 386, 189, 191 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -356 -static const yytype_int16 yypact[] = -{ - -356, 61, -356, 35, 83, -356, -356, -356, -356, -356, - -356, -356, -356, 12, 37, -9, -356, -356, -356, 21, - 469, 112, 100, 53, 118, 63, 36, 67, -356, -356, - -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, - -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, - -356, -356, -356, -356, -356, 9, -356, -356, 113, -356, - 153, 155, 207, 99, -356, -356, -356, 120, 231, 215, - 113, -356, -356, 218, -356, -356, 231, 209, -356, -356, - -22, 176, -356, -356, -356, -356, 244, -356, -356, 20, - 493, 113, -356, -356, -6, 247, -356, 253, -356, -356, - 489, -356, -356, 101, 99, 101, -356, -356, -356, -356, - -356, -356, -356, -356, -356, -356, 283, 493, -356, -356, - -356, 284, -356, -356, 276, 285, -356, -356, -356, -356, - -356, 281, 288, 289, 290, 292, 293, -356, -356, 23, - -356, -356, -356, 243, 364, 364, 366, 369, 372, -356, - 315, 316, -356, -356, 314, -356, -356, 306, 16, 380, - 156, 381, 87, -356, 385, -356, -356, -356, 277, 526, - -356, -356, 382, -356, -356, -356, 138, -356, 243, -356, - 337, 73, -356, 384, 409, 351, 352, 359, 369, 357, - 372, 358, -356, 243, 243, -356, -356, 46, 370, 419, - -356, -356, 379, 97, 164, -356, 374, 375, 388, 43, - -13, -21, 416, 418, 438, -31, 439, 440, 498, 451, - -356, 386, 36, 442, 434, -356, 287, 437, 91, 156, - 174, 174, 313, -356, 29, -356, -356, 68, -17, -356, - -356, -356, 494, 323, -356, -356, 214, -356, 443, -356, - -356, -356, 500, -356, -356, -356, -356, -356, 243, -356, - -356, -356, 243, -356, -356, -356, -356, -356, -356, 419, - 445, 465, -356, -356, -356, 470, -356, 471, -356, -356, - -356, -356, -356, -356, -356, -356, 432, -356, -356, -356, - -356, -356, -356, -356, -356, 137, 137, -356, 472, -356, - -356, 137, -356, -356, -356, -356, -356, 174, -356, -356, - 19, 137, 156, -356, -356, -356, 473, 474, -356, 135, - 410, 466, 516, 491, -356, -356, 474, -356, 22, -356, - 192, 243, 243, 468, 243, 243, -356, -356, -356, 490, - -356, -356, 465, -356, 419, 499, -356, -356, -356, -356, - -356, -356, 474, 25, -356, 156, -356, -356, -356, -356, - -356, 135, 10, 249, -356, 451, 174, -356, -356, 441, - -356, 474, 486, 8, -356, 280, -356, 256, -356, 474, - 551, 552, 553, 554, 555, 556, -356, -356, -356, -356, - -356, -356, -356, -356, 501, 506, -356, -356, -356, 474, - 156, -356, -356, 505, -356, 172, -356, -356, 135, -356, - -356, -356, 497, -356, -356, -356, 242, -356, -356, -356, - -356, 22, 192, 192, 192, 192, 192, 192, 243, -356, - -356, -356, -356, -356, 503, -356, -356, 510, -356, 36, - 528, -356, -356, -356, -356, -356, 474, -356, -356, -356, - -356, -356, -356, -356, -356, 474, -356, -356, -356, 507, - 508, -356, 512, 511, 384, -356, -356, 513, -356, -356, - -356, 36, 353, 117, -356, -356, -356, -356, 504, -356, - -356, 569, -356, -356, -356, 509, -356, 521, 520, -356, - -356, -356 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -356, 581, -356, -356, -356, -356, -356, -356, -356, -356, - 492, -356, -356, -356, -356, -356, 54, -356, 514, -260, - 114, -356, -133, -356, -223, -158, 563, 564, 566, -157, - -356, -16, 574, -356, -12, -26, -11, -356, -356, -356, - -356, -356, -356, -355, -356, -356, 181, 229, -356, -356, - 219, -356, 232, -356, -159, -356, -356, -356, -356, -356, - -180, 423, -216, -218, -356, 286, -356, -356, -356, -356, - -356, -356, -356, -356, -356, -356, -356, -356, -356, 124, - -356, -356, 360, -356, -356, -356, 479, -356, -356, -356, - -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, - -356, -310, -356, 335, -356, -356, 421, -356, -356, 342, - -240, -356, -356, 132, 502, -41, -221, -356, -356, -131, - -356, -356, -356, 180, -356, -356, -356, -356, -356, 260, - -356, 139, 336, 263, -356, 459, -356, 47, 420, 422 -}; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -276 -static const yytype_int16 yytable[] = -{ - 69, 22, 219, 301, 51, 326, 339, 226, 303, 233, - 232, 58, 182, 309, 414, 406, 67, 406, 314, 76, - 320, 387, 388, 198, 390, 391, 228, 80, 291, 372, - 149, 225, 228, 3, 4, 105, 228, 85, 285, 74, - 103, 286, 14, 67, 100, 292, 283, 182, 28, 120, - 19, 287, -17, 63, 355, 101, 68, 91, 284, 352, - 400, 2, 260, 106, 312, 370, 150, 151, 219, 407, - 74, 219, 68, 199, 373, 313, 120, 126, 85, 129, - 393, 394, 29, 318, 125, 219, 225, 371, 373, 379, - 16, 357, 374, 152, 67, 314, 26, 230, 231, 225, - 3, 4, 281, 364, -24, 267, 80, 55, 80, 75, - 268, 399, 282, 59, 81, 349, 350, 479, 454, 17, - 66, 353, 18, 68, 71, -24, 222, 260, -24, 74, - 98, 82, 83, 84, 402, 68, 223, 68, -24, 243, - 53, 54, 411, 244, 434, 364, 320, 410, 412, 76, - 195, 356, 227, 236, 219, 196, 274, 444, 275, 419, - 77, 238, 78, 365, 155, 156, 31, 32, 33, 34, - 35, 36, 37, 38, 480, -160, 481, 482, 459, 432, - 446, 74, 466, 80, 60, 467, 61, 62, 63, 410, - 304, 305, 364, 455, 401, 239, 298, 219, 240, 360, - 419, 361, 296, 230, 231, 230, 231, 219, 82, 83, - 84, 219, 68, 102, 79, 202, 485, 203, 204, 205, - 206, 107, 207, 276, 208, 209, 277, 210, 211, 212, - 213, 214, 215, 216, 217, 127, 409, 130, 67, 435, - 230, 231, 219, 380, 381, 382, 383, 384, 385, 320, - 154, 155, 156, 31, 32, 33, 34, 35, 157, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 158, -64, -64, 159, 327, 92, 99, 328, 160, 68, - 96, 19, 161, 162, 228, 155, 156, 31, 32, 33, - 34, 35, 36, 37, 38, 155, 156, 31, 32, 33, - 34, 35, 36, 37, 38, 122, 418, 104, 227, 443, - 230, 231, 229, 409, 219, 123, 420, 230, 231, 421, - -269, 155, 156, 31, 32, 33, 34, 35, 36, 37, - 38, 155, 156, 31, 32, 33, 34, 35, 36, 37, - 38, 137, 140, 141, 418, 230, 231, -275, 230, 231, - -275, 143, 142, -275, 144, 145, 146, -275, 147, 148, - -77, 155, 156, 31, 32, 33, 34, 35, 36, 37, - 38, 184, 187, 195, -107, 74, 188, -107, 196, 190, - -107, 230, 231, -270, -107, 192, 193, 201, 221, 237, - -77, 247, 67, 155, 156, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 224, 460, 242, 159, 249, 67, 250, 251, - -79, 68, 252, 19, 254, 256, 270, 269, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 224, 273, 278, - 159, 300, 279, 297, 302, 460, 68, 280, 19, 155, - 156, 31, 32, 33, 34, 35, 36, 37, 38, 155, - 156, 31, 32, 33, 34, 35, 36, 37, 38, 448, - 449, 450, 451, 452, 453, 288, 30, 289, 413, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 124, 290, 293, 294, - 348, 228, 299, 329, 343, 295, 333, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 82, 83, 84, 344, 346, - 347, 358, 351, 366, 359, 389, 108, 109, 110, 111, - 112, 113, 114, 115, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 367, 369, 392, 415, 398, 422, 423, - 424, 425, 426, 427, 430, 433, 429, 439, 456, 458, - 463, 486, 469, 488, 470, 471, 489, 472, 474, 490, - 491, 1, 475, 48, 49, 121, 50, 20, 97, 437, - 405, 234, 416, 354, 408, 477, 138, 337, 315, 241, - 336, 447, 395, 473, 186, 342, 128, 397, 253, 0, - 0, 0, 255 -}; - -static const yytype_int16 yycheck[] = -{ - 26, 13, 160, 226, 20, 245, 266, 164, 229, 168, - 168, 22, 143, 231, 369, 7, 7, 7, 234, 36, - 243, 331, 332, 7, 334, 335, 7, 7, 59, 7, - 7, 164, 7, 39, 40, 15, 7, 63, 59, 61, - 81, 62, 7, 7, 66, 76, 59, 178, 57, 90, - 38, 72, 58, 70, 35, 81, 36, 68, 71, 299, - 35, 0, 193, 89, 35, 325, 43, 44, 226, 59, - 61, 229, 36, 57, 66, 234, 117, 103, 104, 105, - 340, 341, 61, 242, 100, 243, 219, 327, 66, 329, - 7, 312, 70, 70, 7, 311, 59, 68, 69, 232, - 39, 40, 59, 319, 36, 59, 7, 7, 7, 55, - 64, 351, 69, 60, 15, 295, 296, 472, 428, 36, - 57, 301, 39, 36, 57, 57, 39, 258, 60, 61, - 76, 32, 33, 34, 355, 36, 162, 36, 70, 66, - 28, 29, 365, 70, 404, 361, 369, 363, 366, 36, - 59, 310, 164, 169, 312, 64, 59, 417, 61, 375, - 7, 172, 7, 320, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 57, 57, 59, 60, 438, 400, - 420, 61, 442, 7, 66, 445, 68, 69, 70, 405, - 16, 17, 408, 433, 353, 57, 222, 355, 60, 64, - 416, 66, 218, 68, 69, 68, 69, 365, 32, 33, - 34, 369, 36, 81, 7, 59, 476, 61, 62, 63, - 64, 89, 66, 59, 68, 69, 62, 71, 72, 73, - 74, 75, 76, 77, 78, 103, 64, 105, 7, 67, - 68, 69, 400, 51, 52, 53, 54, 55, 56, 472, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 60, 60, 67, 63, 35, 36, - 62, 38, 39, 40, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 58, 64, 63, 320, 67, - 68, 69, 35, 64, 472, 62, 60, 68, 69, 63, - 77, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 58, 58, 67, 64, 68, 69, 60, 68, 69, - 63, 70, 67, 66, 66, 66, 66, 70, 66, 66, - 37, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 7, 6, 59, 60, 61, 7, 63, 64, 7, - 66, 68, 69, 77, 70, 70, 70, 7, 7, 7, - 67, 7, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 439, 77, 30, 7, 7, 67, 67, - 67, 36, 63, 38, 67, 67, 7, 57, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 59, 65, - 30, 7, 67, 57, 7, 471, 36, 59, 38, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 422, - 423, 424, 425, 426, 427, 59, 7, 59, 37, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 7, 59, 59, 59, - 68, 7, 60, 60, 59, 7, 6, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 32, 33, 34, 63, 59, - 59, 58, 60, 67, 60, 67, 43, 44, 45, 46, - 47, 48, 49, 50, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 37, 63, 65, 70, 58, 7, 7, - 7, 7, 7, 7, 58, 60, 65, 70, 65, 59, - 42, 67, 65, 4, 66, 63, 67, 66, 65, 58, - 60, 0, 468, 20, 20, 93, 20, 13, 74, 408, - 361, 168, 373, 307, 362, 471, 117, 262, 238, 178, - 258, 421, 342, 464, 145, 269, 104, 344, 188, -1, - -1, -1, 190 -}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 80, 0, 39, 40, 81, 82, 83, 86, 90, - 91, 92, 93, 94, 7, 87, 7, 36, 39, 38, - 111, 112, 113, 148, 151, 152, 59, 84, 57, 61, - 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 105, 106, - 107, 110, 150, 28, 29, 7, 95, 96, 115, 60, - 66, 68, 69, 70, 161, 190, 57, 7, 36, 114, - 115, 57, 88, 97, 61, 95, 36, 7, 7, 7, - 7, 15, 32, 33, 34, 114, 191, 192, 193, 194, - 149, 115, 60, 85, 80, 89, 62, 97, 95, 67, - 66, 114, 192, 194, 63, 15, 114, 192, 43, 44, - 45, 46, 47, 48, 49, 50, 162, 163, 164, 165, - 194, 89, 58, 62, 7, 110, 114, 192, 193, 114, - 192, 167, 168, 170, 172, 174, 176, 58, 165, 166, - 58, 67, 67, 70, 66, 66, 66, 66, 66, 7, - 43, 44, 70, 178, 7, 8, 9, 15, 27, 30, - 35, 39, 40, 101, 104, 105, 106, 107, 108, 109, - 110, 111, 113, 114, 116, 133, 153, 183, 184, 185, - 196, 197, 198, 207, 7, 214, 214, 6, 7, 217, - 7, 218, 70, 70, 179, 59, 64, 136, 7, 57, - 209, 7, 59, 61, 62, 63, 64, 66, 68, 69, - 71, 72, 73, 74, 75, 76, 77, 78, 103, 104, - 195, 7, 39, 114, 27, 101, 108, 113, 7, 35, - 68, 69, 104, 133, 140, 141, 110, 7, 115, 57, - 60, 185, 77, 66, 70, 132, 205, 7, 210, 7, - 67, 67, 63, 217, 67, 218, 67, 186, 187, 188, - 198, 180, 181, 182, 198, 134, 137, 59, 64, 57, - 7, 211, 212, 59, 59, 61, 59, 62, 65, 67, - 59, 59, 69, 59, 71, 59, 62, 72, 59, 59, - 59, 59, 76, 59, 59, 7, 110, 57, 114, 60, - 7, 103, 7, 195, 16, 17, 142, 143, 144, 142, - 139, 140, 35, 133, 141, 161, 199, 189, 133, 102, - 103, 117, 118, 121, 122, 206, 189, 60, 63, 60, - 215, 169, 171, 6, 175, 177, 188, 182, 98, 98, - 135, 138, 211, 59, 63, 208, 59, 59, 68, 139, - 139, 60, 189, 139, 144, 35, 133, 195, 58, 60, - 64, 66, 125, 126, 141, 108, 67, 37, 120, 63, - 98, 189, 7, 66, 70, 129, 131, 201, 202, 189, - 51, 52, 53, 54, 55, 56, 216, 180, 180, 67, - 180, 180, 65, 98, 98, 208, 213, 212, 58, 189, - 35, 133, 195, 200, 127, 126, 7, 59, 131, 64, - 141, 103, 142, 37, 122, 70, 129, 204, 64, 141, - 60, 63, 7, 7, 7, 7, 7, 7, 173, 65, - 58, 100, 195, 60, 98, 67, 123, 125, 128, 70, - 156, 157, 203, 67, 98, 130, 189, 202, 216, 216, - 216, 216, 216, 216, 180, 189, 65, 99, 59, 98, - 114, 158, 159, 42, 154, 155, 98, 98, 124, 65, - 66, 63, 66, 210, 65, 99, 160, 158, 119, 122, - 57, 59, 60, 145, 146, 98, 67, 147, 4, 67, - 58, 60 -}; - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ - -#define YYFAIL goto yyerrlab - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - - -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () -#endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif -{ - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static char * -yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; - - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; - } -} -#endif /* YYERROR_VERBOSE */ - - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - YYUSE (yyvaluep); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } -} - -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - - -/* The lookahead symbol. */ -int yychar; - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; - - - -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ - -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void) -#else -int -yyparse () - -#endif -#endif -{ - - - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - yyssp = yyss; - yyvsp = yyvs; - - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - *++yyvsp = yylval; - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 11: - -/* Line 1455 of yacc.c */ -#line 824 "tqmoc.y" - { enterNameSpace((yyvsp[(2) - (2)].string)); } - break; - - case 12: - -/* Line 1455 of yacc.c */ -#line 825 "tqmoc.y" - { BEGIN IN_NAMESPACE; } - break; - - case 13: - -/* Line 1455 of yacc.c */ -#line 827 "tqmoc.y" - { leaveNameSpace(); - selectOutsideClassState(); - } - break; - - case 14: - -/* Line 1455 of yacc.c */ -#line 832 "tqmoc.y" - { enterNameSpace(); } - break; - - case 15: - -/* Line 1455 of yacc.c */ -#line 833 "tqmoc.y" - { BEGIN IN_NAMESPACE; } - break; - - case 16: - -/* Line 1455 of yacc.c */ -#line 835 "tqmoc.y" - { leaveNameSpace(); - selectOutsideClassState(); - } - break; - - case 18: - -/* Line 1455 of yacc.c */ -#line 844 "tqmoc.y" - { selectOutsideClassState(); } - break; - - case 19: - -/* Line 1455 of yacc.c */ -#line 848 "tqmoc.y" - { selectOutsideClassState(); } - break; - - case 20: - -/* Line 1455 of yacc.c */ -#line 851 "tqmoc.y" - { selectOutsideClassState(); } - break; - - case 21: - -/* Line 1455 of yacc.c */ -#line 852 "tqmoc.y" - { selectOutsideClassState(); } - break; - - case 22: - -/* Line 1455 of yacc.c */ -#line 855 "tqmoc.y" - { initClass(); } - break; - - case 23: - -/* Line 1455 of yacc.c */ -#line 856 "tqmoc.y" - { generateClass(); - registerClassInNamespace(); - selectOutsideClassState(); } - break; - - case 24: - -/* Line 1455 of yacc.c */ -#line 864 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 25: - -/* Line 1455 of yacc.c */ -#line 865 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 26: - -/* Line 1455 of yacc.c */ -#line 869 "tqmoc.y" - { g->tmpExpression = rmWS( g->tmpExpression ); - (yyval.string) = stradd( (yyvsp[(1) - (4)].string), "<", - g->tmpExpression, ">" ); } - break; - - case 27: - -/* Line 1455 of yacc.c */ -#line 880 "tqmoc.y" - { initExpression(); - templLevel = 1; - BEGIN IN_TEMPL_ARGS; } - break; - - case 28: - -/* Line 1455 of yacc.c */ -#line 893 "tqmoc.y" - { initExpression(); - BEGIN IN_EXPR; } - break; - - case 29: - -/* Line 1455 of yacc.c */ -#line 902 "tqmoc.y" - { BEGIN IN_DEF_ARG; } - break; - - case 30: - -/* Line 1455 of yacc.c */ -#line 905 "tqmoc.y" - { initExpression(); - BEGIN IN_ENUM; } - break; - - case 31: - -/* Line 1455 of yacc.c */ -#line 911 "tqmoc.y" - { (yyval.string) = ""; } - break; - - case 32: - -/* Line 1455 of yacc.c */ -#line 912 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 33: - -/* Line 1455 of yacc.c */ -#line 913 "tqmoc.y" - { (yyval.string) = ""; } - break; - - case 34: - -/* Line 1455 of yacc.c */ -#line 914 "tqmoc.y" - { skipFunc = TRUE; (yyval.string) = ""; } - break; - - case 35: - -/* Line 1455 of yacc.c */ -#line 915 "tqmoc.y" - { skipFunc = TRUE; (yyval.string) = ""; } - break; - - case 36: - -/* Line 1455 of yacc.c */ -#line 919 "tqmoc.y" - { (yyval.string) = straddSpc((yyvsp[(1) - (3)].string),(yyvsp[(2) - (3)].string),(yyvsp[(3) - (3)].string)); } - break; - - case 37: - -/* Line 1455 of yacc.c */ -#line 921 "tqmoc.y" - { (yyval.string) = ""; } - break; - - case 38: - -/* Line 1455 of yacc.c */ -#line 922 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 39: - -/* Line 1455 of yacc.c */ -#line 925 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 40: - -/* Line 1455 of yacc.c */ -#line 926 "tqmoc.y" - { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)); } - break; - - case 43: - -/* Line 1455 of yacc.c */ -#line 931 "tqmoc.y" - { skipFunc = TRUE; } - break; - - case 45: - -/* Line 1455 of yacc.c */ -#line 935 "tqmoc.y" - { } - break; - - case 46: - -/* Line 1455 of yacc.c */ -#line 936 "tqmoc.y" - { } - break; - - case 47: - -/* Line 1455 of yacc.c */ -#line 939 "tqmoc.y" - { (yyval.string) = "const"; } - break; - - case 48: - -/* Line 1455 of yacc.c */ -#line 940 "tqmoc.y" - { (yyval.string) = "volatile"; } - break; - - case 49: - -/* Line 1455 of yacc.c */ -#line 943 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 50: - -/* Line 1455 of yacc.c */ -#line 944 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 51: - -/* Line 1455 of yacc.c */ -#line 945 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 52: - -/* Line 1455 of yacc.c */ -#line 949 "tqmoc.y" - { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)); } - break; - - case 53: - -/* Line 1455 of yacc.c */ -#line 950 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 54: - -/* Line 1455 of yacc.c */ -#line 953 "tqmoc.y" - { (yyval.string) = "char"; } - break; - - case 55: - -/* Line 1455 of yacc.c */ -#line 954 "tqmoc.y" - { (yyval.string) = "short"; } - break; - - case 56: - -/* Line 1455 of yacc.c */ -#line 955 "tqmoc.y" - { (yyval.string) = "int"; } - break; - - case 57: - -/* Line 1455 of yacc.c */ -#line 956 "tqmoc.y" - { (yyval.string) = "long"; } - break; - - case 58: - -/* Line 1455 of yacc.c */ -#line 957 "tqmoc.y" - { (yyval.string) = "signed"; } - break; - - case 59: - -/* Line 1455 of yacc.c */ -#line 958 "tqmoc.y" - { (yyval.string) = "unsigned"; } - break; - - case 60: - -/* Line 1455 of yacc.c */ -#line 959 "tqmoc.y" - { (yyval.string) = "float"; } - break; - - case 61: - -/* Line 1455 of yacc.c */ -#line 960 "tqmoc.y" - { (yyval.string) = "double"; } - break; - - case 62: - -/* Line 1455 of yacc.c */ -#line 961 "tqmoc.y" - { (yyval.string) = "void"; } - break; - - case 63: - -/* Line 1455 of yacc.c */ -#line 965 "tqmoc.y" - { g->tmpExpression = rmWS( g->tmpExpression ); - (yyval.string) = stradd( "template<", - g->tmpExpression, ">" ); } - break; - - case 65: - -/* Line 1455 of yacc.c */ -#line 971 "tqmoc.y" - { templateClassOld = templateClass; - templateClass = TRUE; - } - break; - - case 66: - -/* Line 1455 of yacc.c */ -#line 977 "tqmoc.y" - { (yyval.string) = "class"; } - break; - - case 67: - -/* Line 1455 of yacc.c */ -#line 978 "tqmoc.y" - { (yyval.string) = "struct"; } - break; - - case 68: - -/* Line 1455 of yacc.c */ -#line 981 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 69: - -/* Line 1455 of yacc.c */ -#line 983 "tqmoc.y" - { (yyval.string) = stradd( "::", (yyvsp[(2) - (2)].string) ); } - break; - - case 70: - -/* Line 1455 of yacc.c */ -#line 987 "tqmoc.y" - { (yyval.string) = stradd( (yyvsp[(1) - (3)].string), "::", (yyvsp[(3) - (3)].string) );} - break; - - case 71: - -/* Line 1455 of yacc.c */ -#line 988 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 72: - -/* Line 1455 of yacc.c */ -#line 992 "tqmoc.y" - { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)); } - break; - - case 73: - -/* Line 1455 of yacc.c */ -#line 993 "tqmoc.y" - { (yyval.string) = stradd("enum ",(yyvsp[(2) - (2)].string)); } - break; - - case 74: - -/* Line 1455 of yacc.c */ -#line 994 "tqmoc.y" - { (yyval.string) = stradd("union ",(yyvsp[(2) - (2)].string)); } - break; - - case 75: - -/* Line 1455 of yacc.c */ -#line 999 "tqmoc.y" - { (yyval.arg_list) = (yyvsp[(1) - (2)].arg_list);} - break; - - case 76: - -/* Line 1455 of yacc.c */ -#line 1000 "tqmoc.y" - { (yyval.arg_list) = (yyvsp[(1) - (3)].arg_list); - func_warn("Ellipsis not supported" - " in tqsignals and tqslots.\n" - "Ellipsis argument ignored."); } - break; - - case 77: - -/* Line 1455 of yacc.c */ -#line 1006 "tqmoc.y" - { (yyval.arg_list) = tmpArgList; } - break; - - case 78: - -/* Line 1455 of yacc.c */ -#line 1007 "tqmoc.y" - { (yyval.arg_list) = (yyvsp[(1) - (1)].arg_list); } - break; - - case 79: - -/* Line 1455 of yacc.c */ -#line 1010 "tqmoc.y" - { (yyval.arg) = 0; } - break; - - case 82: - -/* Line 1455 of yacc.c */ -#line 1015 "tqmoc.y" - { func_warn("Ellipsis not supported" - " in tqsignals and tqslots.\n" - "Ellipsis argument ignored."); } - break; - - case 83: - -/* Line 1455 of yacc.c */ -#line 1023 "tqmoc.y" - { (yyval.arg_list) = addArg((yyvsp[(3) - (3)].arg)); } - break; - - case 84: - -/* Line 1455 of yacc.c */ -#line 1024 "tqmoc.y" - { (yyval.arg_list) = addArg((yyvsp[(1) - (1)].arg)); } - break; - - case 85: - -/* Line 1455 of yacc.c */ -#line 1028 "tqmoc.y" - { (yyval.arg) = new Argument(straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)),""); } - break; - - case 86: - -/* Line 1455 of yacc.c */ -#line 1030 "tqmoc.y" - { expLevel = 1; } - break; - - case 87: - -/* Line 1455 of yacc.c */ -#line 1032 "tqmoc.y" - { (yyval.arg) = new Argument(straddSpc((yyvsp[(1) - (5)].string),(yyvsp[(2) - (5)].string)),"", 0, TRUE ); } - break; - - case 88: - -/* Line 1455 of yacc.c */ -#line 1035 "tqmoc.y" - { (yyval.arg) = new Argument(straddSpc((yyvsp[(1) - (4)].string),(yyvsp[(2) - (4)].string)),(yyvsp[(4) - (4)].string), (yyvsp[(3) - (4)].string)); } - break; - - case 89: - -/* Line 1455 of yacc.c */ -#line 1038 "tqmoc.y" - { expLevel = 1; } - break; - - case 90: - -/* Line 1455 of yacc.c */ -#line 1040 "tqmoc.y" - { (yyval.arg) = new Argument(straddSpc((yyvsp[(1) - (7)].string),(yyvsp[(2) - (7)].string)),(yyvsp[(4) - (7)].string), (yyvsp[(3) - (7)].string), TRUE); } - break; - - case 91: - -/* Line 1455 of yacc.c */ -#line 1044 "tqmoc.y" - { (yyval.string) = ""; } - break; - - case 92: - -/* Line 1455 of yacc.c */ -#line 1045 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 93: - -/* Line 1455 of yacc.c */ -#line 1049 "tqmoc.y" - { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)); } - break; - - case 94: - -/* Line 1455 of yacc.c */ -#line 1050 "tqmoc.y" - { expLevel = 1; } - break; - - case 95: - -/* Line 1455 of yacc.c */ -#line 1052 "tqmoc.y" - { (yyval.string) = stradd( "[", - g->tmpExpression = - g->tmpExpression.stripWhiteSpace(), "]" ); } - break; - - case 96: - -/* Line 1455 of yacc.c */ -#line 1055 "tqmoc.y" - { expLevel = 1; } - break; - - case 97: - -/* Line 1455 of yacc.c */ -#line 1057 "tqmoc.y" - { (yyval.string) = stradd( (yyvsp[(1) - (5)].string),"[", - g->tmpExpression = - g->tmpExpression.stripWhiteSpace(),"]" ); } - break; - - case 98: - -/* Line 1455 of yacc.c */ -#line 1060 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 99: - -/* Line 1455 of yacc.c */ -#line 1061 "tqmoc.y" - { (yyval.string) = (yyvsp[(2) - (3)].string); } - break; - - case 100: - -/* Line 1455 of yacc.c */ -#line 1064 "tqmoc.y" - { (yyval.string) = ""; } - break; - - case 101: - -/* Line 1455 of yacc.c */ -#line 1066 "tqmoc.y" - { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string));} - break; - - case 102: - -/* Line 1455 of yacc.c */ -#line 1067 "tqmoc.y" - { expLevel = 1; } - break; - - case 103: - -/* Line 1455 of yacc.c */ -#line 1069 "tqmoc.y" - { (yyval.string) = stradd( (yyvsp[(1) - (5)].string),"[", - g->tmpExpression = - g->tmpExpression.stripWhiteSpace(),"]" ); } - break; - - case 104: - -/* Line 1455 of yacc.c */ -#line 1072 "tqmoc.y" - { (yyval.string) = (yyvsp[(2) - (3)].string); } - break; - - case 106: - -/* Line 1455 of yacc.c */ -#line 1086 "tqmoc.y" - { tmpFunc->args = (yyvsp[(2) - (8)].arg_list); - tmpFunc->qualifier = (yyvsp[(4) - (8)].string); } - break; - - case 108: - -/* Line 1455 of yacc.c */ -#line 1092 "tqmoc.y" - { func_warn("Variable as signal or slot."); } - break; - - case 109: - -/* Line 1455 of yacc.c */ -#line 1093 "tqmoc.y" - { expLevel=0; } - break; - - case 110: - -/* Line 1455 of yacc.c */ -#line 1095 "tqmoc.y" - { skipFunc = TRUE; } - break; - - case 111: - -/* Line 1455 of yacc.c */ -#line 1096 "tqmoc.y" - { expLevel=0; } - break; - - case 112: - -/* Line 1455 of yacc.c */ -#line 1098 "tqmoc.y" - { skipFunc = TRUE; } - break; - - case 113: - -/* Line 1455 of yacc.c */ -#line 1102 "tqmoc.y" - { expLevel = 1; } - break; - - case 115: - -/* Line 1455 of yacc.c */ -#line 1104 "tqmoc.y" - { expLevel = 1; } - break; - - case 117: - -/* Line 1455 of yacc.c */ -#line 1109 "tqmoc.y" - { (yyval.string) = ""; } - break; - - case 118: - -/* Line 1455 of yacc.c */ -#line 1110 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 119: - -/* Line 1455 of yacc.c */ -#line 1113 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 120: - -/* Line 1455 of yacc.c */ -#line 1114 "tqmoc.y" - { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string));} - break; - - case 121: - -/* Line 1455 of yacc.c */ -#line 1117 "tqmoc.y" - { (yyval.string) = straddSpc("*",(yyvsp[(2) - (2)].string));} - break; - - case 122: - -/* Line 1455 of yacc.c */ -#line 1118 "tqmoc.y" - { (yyval.string) = stradd("&",(yyvsp[(2) - (2)].string));} - break; - - case 123: - -/* Line 1455 of yacc.c */ -#line 1125 "tqmoc.y" - { (yyval.string) = ""; } - break; - - case 124: - -/* Line 1455 of yacc.c */ -#line 1126 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 125: - -/* Line 1455 of yacc.c */ -#line 1129 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 126: - -/* Line 1455 of yacc.c */ -#line 1131 "tqmoc.y" - { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)); } - break; - - case 127: - -/* Line 1455 of yacc.c */ -#line 1134 "tqmoc.y" - { (yyval.string) = "const"; } - break; - - case 128: - -/* Line 1455 of yacc.c */ -#line 1135 "tqmoc.y" - { (yyval.string) = "volatile"; } - break; - - case 132: - -/* Line 1455 of yacc.c */ -#line 1143 "tqmoc.y" - { BEGIN IN_FCT; fctLevel = 1;} - break; - - case 133: - -/* Line 1455 of yacc.c */ -#line 1144 "tqmoc.y" - { BEGIN TQT_DEF; } - break; - - case 134: - -/* Line 1455 of yacc.c */ -#line 1151 "tqmoc.y" - { BEGIN IN_CLASS; - classPLevel = 1; - } - break; - - case 135: - -/* Line 1455 of yacc.c */ -#line 1155 "tqmoc.y" - { BEGIN TQT_DEF; } - break; - - case 136: - -/* Line 1455 of yacc.c */ -#line 1156 "tqmoc.y" - { BEGIN TQT_DEF; /* -- " -- */ - skipClass = TRUE; } - break; - - case 137: - -/* Line 1455 of yacc.c */ -#line 1158 "tqmoc.y" - { BEGIN TQT_DEF; /* -- " -- */ - skipClass = TRUE; } - break; - - case 138: - -/* Line 1455 of yacc.c */ -#line 1160 "tqmoc.y" - { BEGIN TQT_DEF; /* -- " -- */ - skipClass = TRUE; } - break; - - case 139: - -/* Line 1455 of yacc.c */ -#line 1164 "tqmoc.y" - { BEGIN TQT_DEF; /* catch ';' */ - skipClass = TRUE; } - break; - - case 140: - -/* Line 1455 of yacc.c */ -#line 1166 "tqmoc.y" - { skipClass = TRUE; - BEGIN GIMME_SEMICOLON; } - break; - - case 144: - -/* Line 1455 of yacc.c */ -#line 1173 "tqmoc.y" - { (yyval.string) = ""; } - break; - - case 146: - -/* Line 1455 of yacc.c */ -#line 1179 "tqmoc.y" - { g->className = (yyvsp[(2) - (2)].string); - fprintf( stderr, "FOUND CLASS [1]: %s\n", (const char*)g->className ); - if ( g->className == "TQObject" ) - TQ_OBJECTdetected = TRUE; - } - break; - - case 147: - -/* Line 1455 of yacc.c */ -#line 1186 "tqmoc.y" - { g->className = (yyvsp[(3) - (3)].string); - fprintf( stderr, "FOUND CLASS [2]: %s\n", (const char*)g->className ); - if ( g->className == "TQObject" ) - TQ_OBJECTdetected = TRUE; - } - break; - - case 148: - -/* Line 1455 of yacc.c */ -#line 1194 "tqmoc.y" - { g->superClassName = (yyvsp[(2) - (2)].string); } - break; - - case 149: - -/* Line 1455 of yacc.c */ -#line 1199 "tqmoc.y" - { templateClass = templateClassOld; } - break; - - case 158: - -/* Line 1455 of yacc.c */ -#line 1222 "tqmoc.y" - { expLevel = 1; } - break; - - case 160: - -/* Line 1455 of yacc.c */ -#line 1227 "tqmoc.y" - { (yyval.string) = 0; } - break; - - case 161: - -/* Line 1455 of yacc.c */ -#line 1228 "tqmoc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 166: - -/* Line 1455 of yacc.c */ -#line 1240 "tqmoc.y" - { tmpAccess = (yyvsp[(1) - (1)].access); } - break; - - case 167: - -/* Line 1455 of yacc.c */ -#line 1241 "tqmoc.y" - { tqmoc_err( "Missing access specifier" - " before \"tqslots:\"." ); } - break; - - case 168: - -/* Line 1455 of yacc.c */ -#line 1245 "tqmoc.y" - { BEGIN TQT_DEF; } - break; - - case 170: - -/* Line 1455 of yacc.c */ -#line 1247 "tqmoc.y" - { BEGIN TQT_DEF; } - break; - - case 172: - -/* Line 1455 of yacc.c */ -#line 1249 "tqmoc.y" - { - if ( tmpAccess ) - tqmoc_warn("TQ_OBJECT is not in the private" - " section of the class.\n" - "TQ_OBJECT is a macro that resets" - " access permission to \"private\"."); - TQ_OBJECTdetected = TRUE; - } - break; - - case 173: - -/* Line 1455 of yacc.c */ -#line 1257 "tqmoc.y" - { tmpYYStart = YY_START; - tmpPropOverride = FALSE; - BEGIN IN_PROPERTY; } - break; - - case 174: - -/* Line 1455 of yacc.c */ -#line 1260 "tqmoc.y" - { - BEGIN tmpYYStart; - } - break; - - case 176: - -/* Line 1455 of yacc.c */ -#line 1264 "tqmoc.y" - { tmpYYStart = YY_START; - tmpPropOverride = TRUE; - BEGIN IN_PROPERTY; } - break; - - case 177: - -/* Line 1455 of yacc.c */ -#line 1267 "tqmoc.y" - { - BEGIN tmpYYStart; - } - break; - - case 179: - -/* Line 1455 of yacc.c */ -#line 1271 "tqmoc.y" - { tmpYYStart = YY_START; BEGIN IN_CLASSINFO; } - break; - - case 180: - -/* Line 1455 of yacc.c */ -#line 1273 "tqmoc.y" - { - g->infos.append( new ClassInfo( (yyvsp[(4) - (7)].string), (yyvsp[(6) - (7)].string) ) ); - BEGIN tmpYYStart; - } - break; - - case 182: - -/* Line 1455 of yacc.c */ -#line 1278 "tqmoc.y" - { tmpYYStart = YY_START; BEGIN IN_PROPERTY; } - break; - - case 183: - -/* Line 1455 of yacc.c */ -#line 1279 "tqmoc.y" - { - Q_PROPERTYdetected = TRUE; - BEGIN tmpYYStart; - } - break; - - case 185: - -/* Line 1455 of yacc.c */ -#line 1284 "tqmoc.y" - { tmpYYStart = YY_START; BEGIN IN_PROPERTY; } - break; - - case 186: - -/* Line 1455 of yacc.c */ -#line 1285 "tqmoc.y" - { - Q_PROPERTYdetected = TRUE; - BEGIN tmpYYStart; - } - break; - - case 188: - -/* Line 1455 of yacc.c */ -#line 1292 "tqmoc.y" - { tqmoc_err( "Signals cannot " - "have access specifiers" ); } - break; - - case 190: - -/* Line 1455 of yacc.c */ -#line 1295 "tqmoc.y" - { if ( tmpAccess == Public && Q_PROPERTYdetected ) - BEGIN TQT_DEF; - else - BEGIN IN_CLASS; - suppress_func_warn = TRUE; - } - break; - - case 191: - -/* Line 1455 of yacc.c */ -#line 1302 "tqmoc.y" - { - suppress_func_warn = FALSE; - } - break; - - case 192: - -/* Line 1455 of yacc.c */ -#line 1305 "tqmoc.y" - { BEGIN IN_CLASS; - if ( classPLevel != 1 ) - tqmoc_warn( "unexpected access" - "specifier" ); - } - break; - - case 197: - -/* Line 1455 of yacc.c */ -#line 1320 "tqmoc.y" - { addMember( PropertyCandidateMember ); } - break; - - case 202: - -/* Line 1455 of yacc.c */ -#line 1332 "tqmoc.y" - { addMember( SignalMember ); } - break; - - case 207: - -/* Line 1455 of yacc.c */ -#line 1343 "tqmoc.y" - { addMember( SlotMember ); } - break; - - case 210: - -/* Line 1455 of yacc.c */ -#line 1350 "tqmoc.y" - { (yyval.string)=(yyvsp[(2) - (2)].string); } - break; - - case 211: - -/* Line 1455 of yacc.c */ -#line 1353 "tqmoc.y" - { g->multipleSuperClasses.append( (yyvsp[(3) - (3)].string) ); } - break; - - case 213: - -/* Line 1455 of yacc.c */ -#line 1358 "tqmoc.y" - { (yyval.string) = stradd( (yyvsp[(1) - (4)].string), "(", (yyvsp[(3) - (4)].string), ")" ); } - break; - - case 214: - -/* Line 1455 of yacc.c */ -#line 1360 "tqmoc.y" - { (yyval.string) = stradd( (yyvsp[(1) - (4)].string), "(", (yyvsp[(3) - (4)].string), ")" ); } - break; - - case 215: - -/* Line 1455 of yacc.c */ -#line 1363 "tqmoc.y" - {(yyval.string)=(yyvsp[(1) - (1)].string);} - break; - - case 216: - -/* Line 1455 of yacc.c */ -#line 1364 "tqmoc.y" - {(yyval.string)=(yyvsp[(3) - (3)].string);} - break; - - case 217: - -/* Line 1455 of yacc.c */ -#line 1365 "tqmoc.y" - {(yyval.string)=(yyvsp[(2) - (2)].string);} - break; - - case 218: - -/* Line 1455 of yacc.c */ -#line 1366 "tqmoc.y" - {(yyval.string)=(yyvsp[(3) - (3)].string);} - break; - - case 219: - -/* Line 1455 of yacc.c */ -#line 1367 "tqmoc.y" - {(yyval.string)=(yyvsp[(2) - (2)].string);} - break; - - case 220: - -/* Line 1455 of yacc.c */ -#line 1368 "tqmoc.y" - {(yyval.string)=(yyvsp[(1) - (1)].string);} - break; - - case 221: - -/* Line 1455 of yacc.c */ -#line 1369 "tqmoc.y" - {(yyval.string)=(yyvsp[(3) - (3)].string);} - break; - - case 222: - -/* Line 1455 of yacc.c */ -#line 1370 "tqmoc.y" - {(yyval.string)=(yyvsp[(2) - (2)].string);} - break; - - case 223: - -/* Line 1455 of yacc.c */ -#line 1371 "tqmoc.y" - {(yyval.string)=(yyvsp[(3) - (3)].string);} - break; - - case 224: - -/* Line 1455 of yacc.c */ -#line 1372 "tqmoc.y" - {(yyval.string)=(yyvsp[(2) - (2)].string);} - break; - - case 225: - -/* Line 1455 of yacc.c */ -#line 1375 "tqmoc.y" - { (yyval.access)=Private; } - break; - - case 226: - -/* Line 1455 of yacc.c */ -#line 1376 "tqmoc.y" - { (yyval.access)=Protected; } - break; - - case 227: - -/* Line 1455 of yacc.c */ -#line 1377 "tqmoc.y" - { (yyval.access)=Public; } - break; - - case 228: - -/* Line 1455 of yacc.c */ -#line 1380 "tqmoc.y" - { } - break; - - case 229: - -/* Line 1455 of yacc.c */ -#line 1381 "tqmoc.y" - { } - break; - - case 271: - -/* Line 1455 of yacc.c */ -#line 1429 "tqmoc.y" - { tmpFunc->type = (yyvsp[(1) - (2)].string); - tmpFunc->name = (yyvsp[(2) - (2)].string); } - break; - - case 272: - -/* Line 1455 of yacc.c */ -#line 1432 "tqmoc.y" - { tmpFunc->type = "int"; - tmpFunc->name = (yyvsp[(1) - (1)].string); - if ( tmpFunc->name == g->className ) - func_warn( "Constructors cannot be" - " tqsignals or tqslots."); - } - break; - - case 273: - -/* Line 1455 of yacc.c */ -#line 1439 "tqmoc.y" - { tmpFunc->type = "void"; - tmpFunc->name = "~"; - tmpFunc->name += (yyvsp[(3) - (3)].string); - func_warn( "Destructors cannot be" - " tqsignals or tqslots."); - } - break; - - case 274: - -/* Line 1455 of yacc.c */ -#line 1447 "tqmoc.y" - { - char *tmp = - straddSpc((yyvsp[(1) - (5)].string),(yyvsp[(2) - (5)].string),(yyvsp[(3) - (5)].string),(yyvsp[(4) - (5)].string)); - tmpFunc->type = rmWS(tmp); - delete [] tmp; - tmpFunc->name = (yyvsp[(5) - (5)].string); } - break; - - case 275: - -/* Line 1455 of yacc.c */ -#line 1454 "tqmoc.y" - { skipFunc = TRUE; } - break; - - case 276: - -/* Line 1455 of yacc.c */ -#line 1456 "tqmoc.y" - { tmpFunc->type = - straddSpc((yyvsp[(1) - (3)].string),(yyvsp[(2) - (3)].string)); - tmpFunc->name = (yyvsp[(3) - (3)].string); } - break; - - case 277: - -/* Line 1455 of yacc.c */ -#line 1461 "tqmoc.y" - { tmpFunc->type = - straddSpc((yyvsp[(1) - (4)].string),(yyvsp[(2) - (4)].string),(yyvsp[(3) - (4)].string)); - tmpFunc->name = (yyvsp[(4) - (4)].string); } - break; - - case 278: - -/* Line 1455 of yacc.c */ -#line 1465 "tqmoc.y" - { operatorError(); } - break; - - case 279: - -/* Line 1455 of yacc.c */ -#line 1467 "tqmoc.y" - { operatorError(); } - break; - - case 280: - -/* Line 1455 of yacc.c */ -#line 1470 "tqmoc.y" - { operatorError(); } - break; - - case 281: - -/* Line 1455 of yacc.c */ -#line 1472 "tqmoc.y" - { operatorError(); } - break; - - case 282: - -/* Line 1455 of yacc.c */ -#line 1475 "tqmoc.y" - { operatorError(); } - break; - - case 284: - -/* Line 1455 of yacc.c */ -#line 1481 "tqmoc.y" - { func_warn("Unexpected variable declaration."); } - break; - - case 285: - -/* Line 1455 of yacc.c */ -#line 1484 "tqmoc.y" - { func_warn("Unexpected variable declaration."); } - break; - - case 286: - -/* Line 1455 of yacc.c */ -#line 1486 "tqmoc.y" - { func_warn("Unexpected enum declaration."); } - break; - - case 287: - -/* Line 1455 of yacc.c */ -#line 1488 "tqmoc.y" - { func_warn("Unexpected using declaration."); } - break; - - case 288: - -/* Line 1455 of yacc.c */ -#line 1490 "tqmoc.y" - { func_warn("Unexpected using declaration."); } - break; - - case 289: - -/* Line 1455 of yacc.c */ -#line 1492 "tqmoc.y" - { classPLevel++; - tqmoc_err("Unexpected namespace declaration."); } - break; - - case 290: - -/* Line 1455 of yacc.c */ -#line 1495 "tqmoc.y" - { func_warn("Unexpected class declaration.");} - break; - - case 291: - -/* Line 1455 of yacc.c */ -#line 1497 "tqmoc.y" - { func_warn("Unexpected class declaration."); - BEGIN IN_FCT; fctLevel=1; - } - break; - - case 292: - -/* Line 1455 of yacc.c */ -#line 1500 "tqmoc.y" - { BEGIN TQT_DEF; } - break; - - case 296: - -/* Line 1455 of yacc.c */ -#line 1509 "tqmoc.y" - { } - break; - - case 297: - -/* Line 1455 of yacc.c */ -#line 1510 "tqmoc.y" - { expLevel = 0; } - break; - - case 299: - -/* Line 1455 of yacc.c */ -#line 1512 "tqmoc.y" - { expLevel = 0; } - break; - - case 302: - -/* Line 1455 of yacc.c */ -#line 1517 "tqmoc.y" - { expLevel = 0; } - break; - - case 307: - -/* Line 1455 of yacc.c */ -#line 1532 "tqmoc.y" - { BEGIN TQT_DEF; - if ( tmpAccess == Public) { - tmpEnum->name = (yyvsp[(1) - (5)].string); - addEnum(); - } - } - break; - - case 308: - -/* Line 1455 of yacc.c */ -#line 1539 "tqmoc.y" - { tmpEnum->clear();} - break; - - case 310: - -/* Line 1455 of yacc.c */ -#line 1543 "tqmoc.y" - { } - break; - - case 314: - -/* Line 1455 of yacc.c */ -#line 1551 "tqmoc.y" - { if ( tmpAccess == Public) tmpEnum->append( (yyvsp[(1) - (1)].string) ); } - break; - - case 315: - -/* Line 1455 of yacc.c */ -#line 1552 "tqmoc.y" - { enumLevel=0; } - break; - - case 316: - -/* Line 1455 of yacc.c */ -#line 1553 "tqmoc.y" - { if ( tmpAccess == Public) tmpEnum->append( (yyvsp[(1) - (4)].string) ); } - break; - - case 317: - -/* Line 1455 of yacc.c */ -#line 1557 "tqmoc.y" - { - g->propWrite = ""; - g->propRead = ""; - g->propOverride = tmpPropOverride; - g->propReset = ""; - if ( g->propOverride ) { - g->propStored = ""; - g->propDesignable = ""; - g->propScriptable = ""; - } else { - g->propStored = "true"; - g->propDesignable = "true"; - g->propScriptable = "true"; - } - } - break; - - case 318: - -/* Line 1455 of yacc.c */ -#line 1573 "tqmoc.y" - { - if ( g->propRead.isEmpty() && !g->propOverride ) - tqmoc_err( "A property must at least feature a read method." ); - checkPropertyName( (yyvsp[(2) - (4)].string) ); - Q_PROPERTYdetected = TRUE; - // Avoid duplicates - for( TQPtrListIterator<Property> lit( g->props ); lit.current(); ++lit ) { - if ( lit.current()->name == (yyvsp[(2) - (4)].string) ) { - if ( displayWarnings ) - tqmoc_err( "Property '%s' defined twice.", - (const char*)lit.current()->name ); - } - } - g->props.append( new Property( lineNo, (yyvsp[(1) - (4)].string), (yyvsp[(2) - (4)].string), - g->propWrite, g->propRead, g->propReset, - g->propStored, g->propDesignable, - g->propScriptable, g->propOverride ) ); - } - break; - - case 320: - -/* Line 1455 of yacc.c */ -#line 1594 "tqmoc.y" - { g->propRead = (yyvsp[(2) - (3)].string); } - break; - - case 321: - -/* Line 1455 of yacc.c */ -#line 1595 "tqmoc.y" - { g->propWrite = (yyvsp[(2) - (3)].string); } - break; - - case 322: - -/* Line 1455 of yacc.c */ -#line 1596 "tqmoc.y" - { g->propReset = (yyvsp[(2) - (3)].string); } - break; - - case 323: - -/* Line 1455 of yacc.c */ -#line 1597 "tqmoc.y" - { g->propStored = (yyvsp[(2) - (3)].string); } - break; - - case 324: - -/* Line 1455 of yacc.c */ -#line 1598 "tqmoc.y" - { g->propDesignable = (yyvsp[(2) - (3)].string); } - break; - - case 325: - -/* Line 1455 of yacc.c */ -#line 1599 "tqmoc.y" - { g->propScriptable = (yyvsp[(2) - (3)].string); } - break; - - case 326: - -/* Line 1455 of yacc.c */ -#line 1602 "tqmoc.y" - { } - break; - - case 327: - -/* Line 1455 of yacc.c */ -#line 1603 "tqmoc.y" - { g->qtEnums.append( (yyvsp[(1) - (2)].string) ); } - break; - - case 328: - -/* Line 1455 of yacc.c */ -#line 1606 "tqmoc.y" - { } - break; - - case 329: - -/* Line 1455 of yacc.c */ -#line 1607 "tqmoc.y" - { g->qtSets.append( (yyvsp[(1) - (2)].string) ); } - break; - - - -/* Line 1455 of yacc.c */ -#line 4224 "tqmoc_yacc.cpp" - default: break; - } - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else - { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } - } -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - *++yyvsp = yylval; - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#if !defined(yyoverflow) || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - /* Make sure YYID is used. */ - return YYID (yyresult); -} - - - -/* Line 1675 of yacc.c */ -#line 1610 "tqmoc.y" - - -#ifndef YYBISON -# if defined(TQ_OS_WIN32) -# include <io.h> -# undef isatty -extern "C" int hack_isatty( int ) -{ - return 0; -} -# define isatty hack_isatty -# else -# include <unistd.h> -# endif -# include "tqmoc_lex.cpp" -#endif //YYBISON - -void cleanup(); -TQCString combinePath( const char *, const char * ); - -FILE *out; // output file - -parser_reg::parser_reg() : funcs(TRUE) -{ - gen_count = 0; - noInclude = FALSE; // no #include <filename> - generatedCode = FALSE; // no code generated - tqmocError = FALSE; // tqmoc parsing error occurred - hasVariantIncluded = FALSE; -} - - -parser_reg::~parser_reg() -{ - tqslots.clear(); - tqsignals.clear(); - propfuncs.clear(); - funcs.clear(); - infos.clear(); - props.clear(); - infos.clear(); -} - -int yyparse(); - -void replace( char *s, char c1, char c2 ); - -void setDefaultIncludeFile() -{ - if ( g->includeFiles.isEmpty() ) { - if ( g->includePath.isEmpty() ) { - if ( !g->fileName.isEmpty() && !g->outputFile.isEmpty() ) { - g->includeFiles.append( combinePath(g->fileName, g->outputFile) ); - } else { - g->includeFiles.append( g->fileName ); - } - } else { - g->includeFiles.append( combinePath(g->fileName, g->fileName) ); - } - } -} - -#ifdef TQ_CC_MSVC -#define ErrorFormatString "%s(%d):" -#else -#define ErrorFormatString "%s:%d:" -#endif - -#ifndef TQMOC_MWERKS_PLUGIN -int main( int argc, char **argv ) -{ - init(); - - bool autoInclude = TRUE; - const char *error = 0; - g->qtPath = ""; - for ( int n=1; n<argc && error==0; n++ ) { - TQCString arg = argv[n]; - if ( arg[0] == '-' ) { // option - TQCString opt = arg.tqstringFromPos(1); - if ( opt[0] == 'o' ) { // output redirection - if ( opt[1] == '\0' ) { - if ( !(n < argc-1) ) { - error = "Missing output file name"; - break; - } - g->outputFile = argv[++n]; - } else - g->outputFile = opt.tqstringFromPos(1); - } else if ( opt == "i" ) { // no #include statement - g->noInclude = TRUE; - autoInclude = FALSE; - } else if ( opt[0] == 'f' ) { // produce #include statement - g->noInclude = FALSE; - autoInclude = FALSE; - if ( opt[1] ) // -fsomething.h - g->includeFiles.append( opt.tqstringFromPos(1) ); - } else if ( opt == "pch" ) { // produce #include statement for PCH - if ( !(n < argc-1) ) { - error = "Missing name of PCH file"; - break; - } - g->pchFile = argv[++n]; - } else if ( opt[0] == 'p' ) { // include file path - if ( opt[1] == '\0' ) { - if ( !(n < argc-1) ) { - error = "Missing path name for the -p option."; - break; - } - g->includePath = argv[++n]; - } else { - g->includePath = opt.tqstringFromPos(1); - } - } else if ( opt[0] == 'q' ) { // qt include file path - if ( opt[1] == '\0' ) { - if ( !(n < argc-1) ) { - error = "Missing path name for the -q option."; - break; - } - g->qtPath = argv[++n]; - } else { - g->qtPath = opt.tqstringFromPos(1); - } - replace(g->qtPath.data(),'\\','/'); - if ( g->qtPath.right(1) != "/" ) - g->qtPath += '/'; - } else if ( opt == "v" ) { // version number - fprintf( stderr, "TQt Meta Object Compiler version %d" - " (TQt %s)\n", formatRevision, - TQT_VERSION_STR ); - cleanup(); - return 1; - } else if ( opt == "k" ) { // stop on errors - errorControl = TRUE; - } else if ( opt == "nw" ) { // don't display warnings - displayWarnings = FALSE; - } else if ( opt == "ldbg" ) { // lex debug output - lexDebug = TRUE; - } else if ( opt == "ydbg" ) { // yacc debug output - yydebug = TRUE; - } else { - error = "Invalid argument"; - } - } else { - if ( !g->fileName.isNull() ) // can handle only one file - error = "Too many input files specified"; - else - g->fileName = arg.copy(); - } - } - - if ( autoInclude ) { - int ppos = g->fileName.findRev('.'); - if ( ppos != -1 && tolower( g->fileName[ppos + 1] ) == 'h' ) - g->noInclude = FALSE; - else - g->noInclude = TRUE; - } - setDefaultIncludeFile(); - - if ( g->fileName.isNull() && !error ) { - g->fileName = "standard input"; - yyin = stdin; - } else if ( argc < 2 || error ) { // incomplete/wrong args - fprintf( stderr, "TQt meta object compiler\n" ); - if ( error ) - fprintf( stderr, "tqmoc: %s\n", error ); - fprintf( stderr, "Usage: tqmoc [options] <header-file>\n" - "\t-o file Write output to file rather than stdout\n" - "\t-f[file] Force #include, optional file name\n" - "\t-p path Path prefix for included file\n" - "\t-i Do not generate an #include statement\n" - "\t-k Do not stop on errors\n" - "\t-nw Do not display warnings\n" - "\t-v Display version of tqmoc\n" ); - cleanup(); - return 1; - } else { - yyin = fopen( (const char *)g->fileName, "r" ); - if ( !yyin ) { - fprintf( stderr, "tqmoc: %s: No such file\n", (const char*)g->fileName); - cleanup(); - return 1; - } - } - if ( !g->outputFile.isEmpty() ) { // output file specified - out = fopen( (const char *)g->outputFile, "w" ); // create output file - if ( !out ) { - fprintf( stderr, "tqmoc: Cannot create %s\n", - (const char*)g->outputFile ); - cleanup(); - return 1; - } - } else { // use stdout - out = stdout; - } - yyparse(); - fclose( yyin ); - if ( !g->outputFile.isNull() ) - fclose( out ); - - if ( !g->generatedCode && displayWarnings && !g->tqmocError ) { - fprintf( stderr, ErrorFormatString" Warning: %s\n", g->fileName.data(), 0, - "No relevant classes found. No output generated." ); - } - - int ret = g->tqmocError ? 1 : 0; - cleanup(); - return ret; -} -#else -bool qt_is_gui_used = FALSE; -#include <ctype.h> -#include <stdio.h> -#include <string.h> -#ifdef TQ_OS_MAC9 -# include <Files.h> -# include <Strings.h> -# include <Errors.h> -# include "Aliases.h" -#endif -#include "CWPluginErrors.h" -#include <CWPlugins.h> -#include "DropInCompilerLinker.h" -#include <stat.h> - -const unsigned char *p_str(const char *, int =-1); - -CWPluginContext g_ctx; - -tqmoc_status do_tqmoc( CWPluginContext ctx, const TQCString &fin, const TQCString &fout, CWFileSpec *dspec, bool i) -{ - init(); - - g_ctx = ctx; - g->noInclude = i; - g->fileName = fin; - g->outputFile = fout; - - setDefaultIncludeFile(); - - CWFileInfo fi; - memset(&fi, 0, sizeof(fi)); - fi.fullsearch = TRUE; - fi.dependencyType = cwNormalDependency; - fi.isdependentoffile = kCurrentCompiledFile; - if(CWFindAndLoadFile( ctx, fin.data(), &fi) != cwNoErr) { - cleanup(); - return tqmoc_no_source; - } - - if(dspec) { - memcpy(dspec, &fi.filespec, sizeof(fi.filespec)); - const unsigned char *f = p_str(fout.data()); - memcpy(dspec->name, f, f[0]+1); - free(f); - } - buf_size_total = fi.filedatalength; - buf_buffer = fi.filedata; - - TQCString path(""); - AliasHandle alias; - Str63 str; - AliasInfoType x = 1; - char tmp[sizeof(Str63)+2]; - if(NewAlias( NULL, &fi.filespec, &alias) != noErr) { - cleanup(); - return tqmoc_general_error; - } - for(;;) { - GetAliasInfo(alias, x++, str); - if(!str[0]) - break; - strncpy((char *)tmp, (const char *)str+1, str[0]); - tmp[str[0]] = '\0'; - path.prepend(":"); - path.prepend((char *)tmp); - } - path.prepend("MacOS 9:"); //FIXME - - TQString inpath = path + fin, outpath = path + fout; - struct stat istat, ostat; - if(stat(inpath, &istat) == -1) { - cleanup(); - return tqmoc_no_source; - } - if(stat(outpath, &ostat) == 0 && istat.st_mtime < ostat.st_mtime) { - cleanup(); - return tqmoc_not_time; - } - - unlink(outpath.data()); - out = fopen(outpath.data(), "w+"); - if(!out) { - cleanup(); - return tqmoc_general_error; - } - - yyparse(); - if(out != stdout) - fclose(out); - - if(g->tqmocError || !g->generatedCode) { - unlink(outpath.data()); - tqmoc_status ret = !g->generatedCode ? tqmoc_no_qobject : tqmoc_parse_error; - cleanup(); - return ret; - } - - cleanup(); - return tqmoc_success; -} -#endif -void replace( char *s, char c1, char c2 ) -{ - if ( !s ) - return; - while ( *s ) { - if ( *s == c1 ) - *s = c2; - s++; - } -} - -/* - This function looks at two file names and returns the name of the - infile with a path relative to outfile. - - Examples: - - /tmp/abc, /tmp/bcd -> abc - xyz/a/bc, xyz/b/ac -> ../a/bc - /tmp/abc, xyz/klm -> /tmp/abc - */ - -TQCString combinePath( const char *infile, const char *outfile ) -{ - TQFileInfo inFileInfo( TQDir::current(), TQFile::decodeName(infile) ); - TQFileInfo outFileInfo( TQDir::current(), TQFile::decodeName(outfile) ); - int numCommonComponents = 0; - - TQStringList inSplitted = - TQStringList::split( '/', inFileInfo.dir().canonicalPath(), TRUE ); - TQStringList outSplitted = - TQStringList::split( '/', outFileInfo.dir().canonicalPath(), TRUE ); - - while ( !inSplitted.isEmpty() && !outSplitted.isEmpty() && - inSplitted.first() == outSplitted.first() ) { - inSplitted.remove( inSplitted.begin() ); - outSplitted.remove( outSplitted.begin() ); - numCommonComponents++; - } - - if ( numCommonComponents < 2 ) { - /* - The paths don't have the same drive, or they don't have the - same root directory. Use an absolute path. - */ - return TQFile::encodeName( inFileInfo.absFilePath() ); - } else { - /* - The paths have something in common. Use a path relative to - the output file. - */ - while ( !outSplitted.isEmpty() ) { - outSplitted.remove( outSplitted.begin() ); - inSplitted.prepend( ".." ); - } - inSplitted.append( inFileInfo.fileName() ); - return TQFile::encodeName( inSplitted.join("/") ); - } -} - - -#define getenv hack_getenv // workaround for byacc -char *getenv() { return 0; } -char *getenv( const char * ) { return 0; } - -void init() // initialize -{ - BEGIN OUTSIDE; - if(g) - delete g; - g = new parser_reg; - lineNo = 1; - skipClass = FALSE; - skipFunc = FALSE; - tmpArgList = new ArgList; - tmpFunc = new Function; - tmpEnum = new Enum; - -#ifdef TQMOC_MWERKS_PLUGIN - buf_buffer = NULL; - buf_index = 0; - buf_size_total = 0; -#endif -} - -void cleanup() -{ - delete g; - g = NULL; - -#ifdef TQMOC_MWERKS_PLUGIN - if(buf_buffer && g_ctx) - CWReleaseFileText(g_ctx, buf_buffer); -#endif -} - -void initClass() // prepare for new class -{ - tmpAccess = Private; - subClassPerm = Private; - TQ_OBJECTdetected = FALSE; - Q_PROPERTYdetected = FALSE; - skipClass = FALSE; - templateClass = FALSE; - g->tqslots.clear(); - g->tqsignals.clear(); - g->propfuncs.clear(); - g->enums.clear(); - g->funcs.clear(); - g->props.clear(); - g->infos.clear(); - g->qtSets.clear(); - g->qtEnums.clear(); - g->multipleSuperClasses.clear(); -} - -struct NamespaceInfo -{ - TQCString name; - int pLevelOnEntering; // Parenthesis level on entering the namespace - TQDict<char> definedClasses; // Classes defined in the namespace -}; - -TQPtrList<NamespaceInfo> namespaces; - -void enterNameSpace( const char *name ) // prepare for new class -{ - static bool first = TRUE; - if ( first ) { - namespaces.setAutoDelete( TRUE ); - first = FALSE; - } - - NamespaceInfo *tmp = new NamespaceInfo; - if ( name ) - tmp->name = name; - tmp->pLevelOnEntering = namespacePLevel; - namespaces.append( tmp ); -} - -void leaveNameSpace() // prepare for new class -{ - NamespaceInfo *tmp = namespaces.last(); - namespacePLevel = tmp->pLevelOnEntering; - namespaces.remove(); -} - -TQCString nameTQualifier() -{ - TQPtrListIterator<NamespaceInfo> iter( namespaces ); - NamespaceInfo *tmp; - TQCString qualifier = ""; - for( ; (tmp = iter.current()) ; ++iter ) { - if ( !tmp->name.isNull() ) { // If not unnamed namespace - qualifier += tmp->name; - qualifier += "::"; - } - } - return qualifier; -} - -int openNameSpaceForMetaObject( FILE *out ) -{ - int levels = 0; - TQPtrListIterator<NamespaceInfo> iter( namespaces ); - NamespaceInfo *tmp; - TQCString indent = ""; - for( ; (tmp = iter.current()) ; ++iter ) { - if ( !tmp->name.isNull() ) { // If not unnamed namespace - fprintf( out, "%snamespace %s {\n", (const char *)indent, - (const char *) tmp->name ); - indent += " "; - levels++; - } - } - TQCString nm = g->className; - int pos; - while( (pos = nm.find( "::" )) != -1 ) { - TQCString spaceName = nm.left( pos ); - nm = nm.right( nm.length() - pos - 2 ); - if ( !spaceName.isEmpty() ) { - fprintf( out, "%snamespace %s {\n", (const char *)indent, - (const char *) spaceName ); - indent += " "; - levels++; - } - } - return levels; -} - -void closeNameSpaceForMetaObject( FILE *out, int levels ) -{ - int i; - for( i = 0 ; i < levels ; i++ ) - fprintf( out, "}" ); - if ( levels ) - fprintf( out, "\n" ); - -} - -void selectOutsideClassState() -{ - if ( namespaces.count() == 0 ) - BEGIN OUTSIDE; - else - BEGIN IN_NAMESPACE; -} - -void registerClassInNamespace() -{ - if ( namespaces.count() == 0 ) - return; - namespaces.last()->definedClasses.insert((const char *)g->className,(char*)1); -} - -// -// Remove white space from SIGNAL and SLOT names. -// This function has been copied from qobject.cpp. -// - -inline bool isSpace( char x ) -{ -#if defined(TQ_CC_BOR) - /* - Borland C++ 4.5 has a weird isspace() bug. - isspace() usually works, but not here. - This implementation is sufficient for our internal use: rmWS() - */ - return (uchar) x <= 32; -#else - return isspace( (uchar) x ); -#endif -} - -static TQCString rmWS( const char *src ) -{ - TQCString result( tqstrlen(src)+1 ); - char *d = result.data(); - char *s = (char *)src; - char last = 0; - while( *s && isSpace(*s) ) // skip leading space - s++; - while ( *s ) { - while ( *s && !isSpace(*s) ) - last = *d++ = *s++; - while ( *s && isSpace(*s) ) - s++; - if ( *s && isIdentChar(*s) && isIdentChar(last) ) - last = *d++ = ' '; - } - result.truncate( (int)(d - result.data()) ); - return result; -} - - -void initExpression() -{ - g->tmpExpression = ""; -} - -void addExpressionString( const char *s ) -{ - g->tmpExpression += s; -} - -void addExpressionChar( const char c ) -{ - g->tmpExpression += c; -} - -void yyerror( const char *msg ) // print yacc error message -{ - g->tqmocError = TRUE; -#ifndef TQMOC_MWERKS_PLUGIN - fprintf( stderr, ErrorFormatString" Error: %s\n", g->fileName.data(), lineNo, msg ); -#else - char msg2[200]; - sprintf(msg2, ErrorFormatString" Error: %s", g->fileName.data(), lineNo, msg); - CWReportMessage(g_ctx, NULL, msg2, NULL, messagetypeError, 0); -#endif - if ( errorControl ) { - if ( !g->outputFile.isEmpty() && yyin && fclose(yyin) == 0 ) - remove( g->outputFile ); - exit( -1 ); - } -} - -void tqmoc_err( const char *s ) -{ - yyerror( s ); -} - -void tqmoc_err( const char *s1, const char *s2 ) -{ - static char tmp[1024]; - sprintf( tmp, s1, s2 ); - yyerror( tmp ); -} - -void tqmoc_warn( const char *msg ) -{ - if ( displayWarnings ) - fprintf( stderr, ErrorFormatString" Warning: %s\n", g->fileName.data(), lineNo, msg); -} - -void tqmoc_warn( char *s1, char *s2 ) -{ - static char tmp[1024]; - sprintf( tmp, s1, s2 ); - if ( displayWarnings ) - fprintf( stderr, ErrorFormatString" Warning: %s\n", g->fileName.data(), lineNo, tmp); -} - -void func_warn( const char *msg ) -{ - if ( !suppress_func_warn ) - tqmoc_warn( msg ); - skipFunc = TRUE; -} - -void operatorError() -{ - if ( !suppress_func_warn ) - tqmoc_warn("Operator functions cannot be tqsignals or tqslots."); - skipFunc = TRUE; -} - -#ifndef yywrap -int yywrap() // more files? -{ - return 1; // end of file -} -#endif - -char *stradd( const char *s1, const char *s2 ) // adds two strings -{ - char *n = new char[tqstrlen(s1)+tqstrlen(s2)+1]; - qstrcpy( n, s1 ); - strcat( n, s2 ); - return n; -} - -char *stradd( const char *s1, const char *s2, const char *s3 )// adds 3 strings -{ - char *n = new char[tqstrlen(s1)+tqstrlen(s2)+tqstrlen(s3)+1]; - qstrcpy( n, s1 ); - strcat( n, s2 ); - strcat( n, s3 ); - return n; -} - -char *stradd( const char *s1, const char *s2, - const char *s3, const char *s4 )// adds 4 strings -{ - char *n = new char[tqstrlen(s1)+tqstrlen(s2)+tqstrlen(s3)+tqstrlen(s4)+1]; - qstrcpy( n, s1 ); - strcat( n, s2 ); - strcat( n, s3 ); - strcat( n, s4 ); - return n; -} - - -char *straddSpc( const char *s1, const char *s2 ) -{ - char *n = new char[tqstrlen(s1)+tqstrlen(s2)+2]; - qstrcpy( n, s1 ); - strcat( n, " " ); - strcat( n, s2 ); - return n; -} - -char *straddSpc( const char *s1, const char *s2, const char *s3 ) -{ - char *n = new char[tqstrlen(s1)+tqstrlen(s2)+tqstrlen(s3)+3]; - qstrcpy( n, s1 ); - strcat( n, " " ); - strcat( n, s2 ); - strcat( n, " " ); - strcat( n, s3 ); - return n; -} - -char *straddSpc( const char *s1, const char *s2, - const char *s3, const char *s4 ) -{ - char *n = new char[tqstrlen(s1)+tqstrlen(s2)+tqstrlen(s3)+tqstrlen(s4)+4]; - qstrcpy( n, s1 ); - strcat( n, " " ); - strcat( n, s2 ); - strcat( n, " " ); - strcat( n, s3 ); - strcat( n, " " ); - strcat( n, s4 ); - return n; -} - -// Generate C++ code for building member function table - - -/* - We call B::qt_invoke() rather than A::B::qt_invoke() to - work around a bug in MSVC 6. The bug occurs if the - super-class is in a namespace and the sub-class isn't. - - Exception: If the superclass has the same name as the subclass, we - want non-MSVC users to have a working generated files. -*/ -TQCString purestSuperClassName() -{ - TQCString sc = g->superClassName; - TQCString c = g->className; - /* - Make sure qualified template arguments (e.g., foo<bar::baz>) - don't interfere. - */ - int pos = sc.findRev( "::", sc.find( '<' ) ); - if ( pos != -1 ) { - sc = sc.right( sc.length() - pos - 2 ); - pos = c.findRev( "::" ); - if ( pos != -1 ) - c = c.right( c.length() - pos - 2 ); - if ( sc == c ) - sc = g->superClassName; - } - return sc; -} - -TQCString callablePurestSuperClassName() -{ - TQCString sc = purestSuperClassName(); -// if (sc.find("TQ") != 0) { - return TQCString("static_cast<TQObject*>(static_cast<TQT_BASE_OBJECT_NAME*>(this))->"); -// } -// else { -// return TQCString(sc + "::"); -// } -} - -TQCString qualifiedClassName() -{ - return nameTQualifier() + g->className; -} - -TQCString callableQualifiedClassName() -{ - TQCString sc = qualifiedClassName(); -// if (sc.find("TQ") != 0) { - return TQCString("static_cast<TQObject*>(static_cast<TQT_BASE_OBJECT_NAME*>(this))->"); -// } -// else { -// return TQCString(sc + "::"); -// } -} - -const int Slot_Num = 1; -const int Signal_Num = 2; -const int Prop_Num = 3; - -void generateFuncs( FuncList *list, const char *functype, int num ) -{ - Function *f; - for ( f=list->first(); f; f=list->next() ) { - bool hasReturnValue = f->type != "void" && (validUType( f->type ) || isVariantType( f->type) ); - - if ( hasReturnValue || !f->args->isEmpty() ) { - fprintf( out, " static const TQUParameter param_%s_%d[] = {\n", functype, list->at() ); - if ( hasReturnValue ) { - if ( validUType( f->type ) ) - fprintf( out, "\t{ 0, &static_TQUType_%s, %s, TQUParameter::Out }", uType(f->type).data(), uTypeExtra(f->type).data() ); - else - fprintf( out, "\t{ 0, &static_TQUType_TQVariant, %s, TQUParameter::Out }", uTypeExtra(f->type).data() ); - if ( !f->args->isEmpty() ) - fprintf( out, ",\n" ); - } - Argument* a = f->args->first(); - while ( a ) { - TQCString type = a->leftType + ' ' + a->rightType; - type = type.simplifyWhiteSpace(); - if( a->name.isEmpty() ) - fprintf( out, "\t{ 0, &static_TQUType_%s, %s, TQUParameter::%s }", - uType( type ).data(), uTypeExtra( type ).data(), - isInOut( type ) ? "InOut" : "In" ); - else - fprintf( out, "\t{ \"%s\", &static_TQUType_%s, %s, TQUParameter::%s }", - a->name.data(), uType( type ).data(), uTypeExtra( type ).data(), - isInOut( type ) ? "InOut" : "In" ); - a = f->args->next(); - if ( a ) - fprintf( out, ",\n" ); - } - fprintf( out, "\n };\n"); - } - - fprintf( out, " static const TQUMethod %s_%d = {", functype, list->at() ); - int n = f->args->count(); - if ( hasReturnValue ) - n++; - fprintf( out, "\"%s\", %d,", f->name.data(), n ); - if ( n ) - fprintf( out, " param_%s_%d };\n", functype, list->at() ); - else - fprintf( out, " 0 };\n" ); - - TQCString typstr = ""; - int count = 0; - Argument *a = f->args->first(); - while ( a ) { - if ( !a->leftType.isEmpty() || ! a->rightType.isEmpty() ) { - if ( count++ ) - typstr += ","; - typstr += a->leftType; - typstr += a->rightType; - } - a = f->args->next(); - } - f->signature = f->name; - f->signature += "("; - f->signature += typstr; - f->signature += ")"; - } - if ( list->count() ) { - fprintf(out," static const TQMetaData %s_tbl[] = {\n", functype ); - f = list->first(); - while ( f ) { - fprintf( out, "\t{ \"%s\",", f->signature.data() ); - fprintf( out, " &%s_%d,", functype, list->at() ); - fprintf( out, " TQMetaData::%s }", f->accessAsString() ); - f = list->next(); - if ( f ) - fprintf( out, ",\n"); - } - fprintf( out, "\n };\n" ); - } -} - - -int enumIndex( const char* type ) -{ - int index = 0; - for( TQPtrListIterator<Enum> lit( g->enums ); lit.current(); ++lit ) { - if ( lit.current()->name == type ) - return index; - index++; - } - return -1; -} - -bool isEnumType( const char* type ) -{ - return enumIndex( type ) >= 0 || ( g->qtEnums.contains( type ) || g->qtSets.contains( type ) ); -} - -bool isPropertyType( const char* type ) -{ - if ( isVariantType( type ) ) - return TRUE; - - return isEnumType( type ); -} - -int generateEnums() -{ - if ( g->enums.count() == 0 ) - return 0; - - fprintf( out, "#ifndef TQT_NO_PROPERTIES\n" ); - int i = 0; - for ( TQPtrListIterator<Enum> it( g->enums ); it.current(); ++it, ++i ) { - fprintf( out, " static const TQMetaEnum::Item enum_%i[] = {\n", i ); - int k = 0; - for( TQStrListIterator eit( *it.current() ); eit.current(); ++eit, ++k ) { - if ( k ) - fprintf( out, ",\n" ); - fprintf( out, "\t{ \"%s\", (int) %s::%s }", eit.current(), (const char*) g->className, eit.current() ); - } - fprintf( out, "\n };\n" ); - } - fprintf( out, " static const TQMetaEnum enum_tbl[] = {\n" ); - i = 0; - for ( TQPtrListIterator<Enum> it2( g->enums ); it2.current(); ++it2, ++i ) { - if ( i ) - fprintf( out, ",\n" ); - fprintf( out, "\t{ \"%s\", %u, enum_%i, %s }", - (const char*)it2.current()->name, - it2.current()->count(), - i, - it2.current()->set ? "TRUE" : "FALSE" ); - } - fprintf( out, "\n };\n" ); - fprintf( out, "#endif // TQT_NO_PROPERTIES\n" ); - - return g->enums.count(); -} - -int generateProps() -{ - // - // Resolve and verify property access functions - // - for( TQPtrListIterator<Property> it( g->props ); it.current(); ) { - Property* p = it.current(); - ++it; - - // verify get function - if ( !p->get.isEmpty() ) { - FuncList candidates = g->propfuncs.find( p->get ); - for ( Function* f = candidates.first(); f; f = candidates.next() ) { - if ( f->qualifier != "const" ) // get functions must be const - continue; - if ( f->args && !f->args->isEmpty() ) // and must not take any arguments - continue; - TQCString tmp = f->type; - Property::Specification spec = Property::Unspecified; - if ( p->type == "TQCString" && (tmp == "const char*" || tmp == "const char *" ) ) { - tmp = "TQCString"; - spec = Property::ConstCharStar; - } else if ( tmp.right(1) == "&" ) { - tmp = tmp.left( tmp.length() - 1 ); - spec = Property::Reference; - } else if ( tmp.right(1) == "*" ) { - tmp = tmp.left( tmp.length() - 1 ); - spec = Property::Pointer; - } else { - spec = Property::Class; - } - if ( tmp.left(6) == "const " ) - tmp = tmp.mid( 6, tmp.length() - 6 ); - tmp = tmp.simplifyWhiteSpace(); - if ( p->type == tmp ) { - // If it is an enum then it may not be a set - bool ok = TRUE; - for( TQPtrListIterator<Enum> lit( g->enums ); lit.current(); ++lit ) - if ( lit.current()->name == p->type && lit.current()->set ) - ok = FALSE; - if ( !ok ) continue; - p->gspec = spec; - p->getfunc = f; - p->oredEnum = 0; - break; - } - else if ( !isVariantType( p->type ) ) { - if ( tmp == "int" || tmp == "uint" || tmp == "unsigned int" ) { - // Test whether the enum is really a set (unfortunately we don't know enums of super classes) - bool ok = TRUE; - for( TQPtrListIterator<Enum> lit( g->enums ); lit.current(); ++lit ) - if ( lit.current()->name == p->type && !lit.current()->set ) - ok = FALSE; - if ( !ok ) continue; - p->gspec = spec; - p->getfunc = f; - p->oredEnum = 1; - p->enumgettype = tmp; - } - } - } - if ( p->getfunc == 0 ) { - if ( displayWarnings ) { - - // Is the type a set, that means, mentioned in TQ_SETS? - bool set = FALSE; - for( TQPtrListIterator<Enum> lit( g->enums ); lit.current(); ++lit ) - if ( lit.current()->name == p->type && lit.current()->set ) - set = TRUE; - - fprintf( stderr, ErrorFormatString" Warning: Property '%s' not available.\n", - g->fileName.data(), p->lineNo, (const char*) p->name ); - fprintf( stderr, " Have been looking for public get functions \n"); - if ( !set ) { - fprintf( stderr, - " %s %s() const\n" - " %s& %s() const\n" - " const %s& %s() const\n" - " %s* %s() const\n", - (const char*) p->type, (const char*) p->get, - (const char*) p->type, (const char*) p->get, - (const char*) p->type, (const char*) p->get, - (const char*) p->type, (const char*) p->get ); - } - if ( set || !isPropertyType( p->type ) ) { - fprintf( stderr, - " int %s() const\n" - " uint %s() const\n" - " unsigned int %s() const\n", - (const char*) p->get, - (const char*) p->get, - (const char*) p->get ); - } - if ( p->type == "TQCString" ) - fprintf( stderr, " const char* %s() const\n", - (const char*)p->get ); - - if ( candidates.isEmpty() ) { - fprintf( stderr, " but found nothing.\n"); - } else { - fprintf( stderr, " but only found the mismatching candidate(s)\n"); - for ( Function* f = candidates.first(); f; f = candidates.next() ) { - TQCString typstr = ""; - Argument *a = f->args->first(); - int count = 0; - while ( a ) { - if ( !a->leftType.isEmpty() || ! a->rightType.isEmpty() ) { - if ( count++ ) - typstr += ","; - typstr += a->leftType; - typstr += a->rightType; - } - a = f->args->next(); - } - fprintf( stderr, " %s:%d: %s %s(%s) %s\n", g->fileName.data(), f->lineNo, - (const char*) f->type,(const char*) f->name, (const char*) typstr, - f->qualifier.isNull()?"":(const char*) f->qualifier ); - } - } - } - } - } - - // verify set function - if ( !p->set.isEmpty() ) { - FuncList candidates = g->propfuncs.find( p->set ); - for ( Function* f = candidates.first(); f; f = candidates.next() ) { - if ( !f->args || f->args->isEmpty() ) - continue; - TQCString tmp = f->args->first()->leftType; - tmp = tmp.simplifyWhiteSpace(); - Property::Specification spec = Property::Unspecified; - if ( tmp.right(1) == "&" ) { - tmp = tmp.left( tmp.length() - 1 ); - spec = Property::Reference; - } - else { - spec = Property::Class; - } - if ( p->type == "TQCString" && (tmp == "const char*" || tmp == "const char *" ) ) { - tmp = "TQCString"; - spec = Property::ConstCharStar; - } - if ( tmp.left(6) == "const " ) - tmp = tmp.mid( 6, tmp.length() - 6 ); - tmp = tmp.simplifyWhiteSpace(); - - if ( p->type == tmp && f->args->count() == 1 ) { - // If it is an enum then it may not be a set - if ( p->oredEnum == 1 ) - continue; - bool ok = TRUE; - for( TQPtrListIterator<Enum> lit( g->enums ); lit.current(); ++lit ) - if ( lit.current()->name == p->type && lit.current()->set ) - ok = FALSE; - if ( !ok ) continue; - p->sspec = spec; - p->setfunc = f; - p->oredEnum = 0; - break; - } else if ( !isVariantType( p->type ) && f->args->count() == 1 ) { - if ( tmp == "int" || tmp == "uint" || tmp == "unsigned int" ) { - if ( p->oredEnum == 0 ) - continue; - // Test wether the enum is really a set (unfortunately we don't know enums of super classes) - bool ok = TRUE; - for( TQPtrListIterator<Enum> lit( g->enums ); lit.current(); ++lit ) - if ( lit.current()->name == p->type && !lit.current()->set ) - ok = FALSE; - if ( !ok ) continue; - p->sspec = spec; - p->setfunc = f; - p->oredEnum = 1; - p->enumsettype = tmp; - } - } - } - if ( p->setfunc == 0 ) { - if ( displayWarnings ) { - - // Is the type a set, that means, mentioned in TQ_SETS ? - bool set = FALSE; - for( TQPtrListIterator<Enum> lit( g->enums ); lit.current(); ++lit ) - if ( lit.current()->name == p->type && lit.current()->set ) - set = TRUE; - - fprintf( stderr, ErrorFormatString" Warning: Property '%s' not writable.\n", - g->fileName.data(), p->lineNo, (const char*) p->name ); - fprintf( stderr, " Have been looking for public set functions \n"); - if ( !set && p->oredEnum != 1 ) { - fprintf( stderr, - " void %s( %s )\n" - " void %s( %s& )\n" - " void %s( const %s& )\n", - (const char*) p->set, (const char*) p->type, - (const char*) p->set, (const char*) p->type, - (const char*) p->set, (const char*) p->type ); - } - if ( set || ( !isPropertyType( p->type ) && p->oredEnum != 0 ) ) { - fprintf( stderr, - " void %s( int )\n" - " void %s( uint )\n" - " void %s( unsigned int )\n", - (const char*) p->set, - (const char*) p->set, - (const char*) p->set ); - } - - if ( p->type == "TQCString" ) - fprintf( stderr, " void %s( const char* ) const\n", - (const char*) p->set ); - - if ( !candidates.isEmpty() ) { - fprintf( stderr, " but only found the mismatching candidate(s)\n"); - for ( Function* f = candidates.first(); f; f = candidates.next() ) { - TQCString typstr = ""; - Argument *a = f->args->first(); - int count = 0; - while ( a ) { - if ( !a->leftType.isEmpty() || ! a->rightType.isEmpty() ) { - if ( count++ ) - typstr += ","; - typstr += a->leftType; - typstr += a->rightType; - } - a = f->args->next(); - } - fprintf( stderr, " %s:%d: %s %s(%s)\n", g->fileName.data(), f->lineNo, - (const char*) f->type,(const char*) f->name, (const char*) typstr ); - } - } - } - } - } - } - - // - // Create meta data - // - if ( g->props.count() ) { - if ( displayWarnings && !TQ_OBJECTdetected ) - tqmoc_err("The declaration of the class \"%s\" contains properties" - " but no TQ_OBJECT macro.", g->className.data()); - - fprintf( out, "#ifndef TQT_NO_PROPERTIES\n" ); - - fprintf( out, " static const TQMetaProperty props_tbl[%d] = {\n ", g->props.count() ); - for( TQPtrListIterator<Property> it( g->props ); it.current(); ++it ) { - - fprintf( out, "\t{ \"%s\",\"%s\", ", it.current()->type.data(), it.current()->name.data() ); - int flags = Invalid; - if ( !isVariantType( it.current()->type ) ) { - flags |= EnumOrSet; - if ( !isEnumType( it.current()->type ) ) - flags |= UnresolvedEnum; - } else { - flags |= qvariant_nameToType( it.current()->type ) << 24; - } - if ( it.current()->getfunc ) - flags |= Readable; - if ( it.current()->setfunc ) { - flags |= Writable; - if ( it.current()->stdSet() ) - flags |= StdSet; - } - if ( it.current()->override ) - flags |= Override; - - if ( it.current()->designable.isEmpty() ) - flags |= DesignableOverride; - else if ( it.current()->designable == "false" ) - flags |= NotDesignable; - - if ( it.current()->scriptable.isEmpty() ) - flags |= ScriptableOverride; - else if ( it.current()->scriptable == "false" ) - flags |= NotScriptable; - - if ( it.current()->stored.isEmpty() ) - flags |= StoredOverride; - else if ( it.current()->stored == "false" ) - flags |= NotStored; - - - fprintf( out, "0x%.4x, ", flags ); - fprintf( out, "&%s::metaObj, ", (const char*) qualifiedClassName() ); - if ( !isVariantType( it.current()->type ) ) { - int enumpos = -1; - int k = 0; - for( TQPtrListIterator<Enum> eit( g->enums ); eit.current(); ++eit, ++k ) { - if ( eit.current()->name == it.current()->type ) - enumpos = k; - } - - // Is it an enum of this class ? - if ( enumpos != -1 ) - fprintf( out, "&enum_tbl[%i], ", enumpos ); - else - fprintf( out, "0, "); - } else { - fprintf( out, "0, "); - } - fprintf( out, "-1 }" ); - if ( !it.atLast() ) - fprintf( out, ",\n" ); - else - fprintf( out, "\n" ); - } - fprintf( out, " };\n" ); - fprintf( out, "#endif // TQT_NO_PROPERTIES\n" ); - } - - return g->props.count(); -} - - - -int generateClassInfos() -{ - if ( g->infos.isEmpty() ) - return 0; - - if ( displayWarnings && !TQ_OBJECTdetected ) - tqmoc_err("The declaration of the class \"%s\" contains class infos" - " but no TQ_OBJECT macro.", g->className.data()); - - fprintf( out, " static const TQClassInfo classinfo_tbl[] = {\n" ); - int i = 0; - for( TQPtrListIterator<ClassInfo> it( g->infos ); it.current(); ++it, ++i ) { - if ( i ) - fprintf( out, ",\n" ); - fprintf( out, "\t{ \"%s\", \"%s\" }", it.current()->name.data(),it.current()->value.data() ); - } - fprintf( out, "\n };\n" ); - return i; -} - - -void generateClass() // generate C++ source code for a class -{ - const char *hdr1 = "/****************************************************************************\n" - "** %s meta object code from reading C++ file '%s'\n**\n"; - const char *hdr2 = "** Created: %s\n"; - const char *hdr3 = "** WARNING! All changes made in this file will be lost!\n"; - const char *hdr4 = "*****************************************************************************/\n\n"; - int i; - - if ( skipClass ) // don't generate for class - return; - - if ( !TQ_OBJECTdetected ) { - if ( g->tqsignals.count() == 0 && g->tqslots.count() == 0 && g->props.count() == 0 && g->infos.count() == 0 ) - return; - if ( displayWarnings && (g->tqsignals.count() + g->tqslots.count()) != 0 ) - tqmoc_err("The declaration of the class \"%s\" contains tqsignals " - "or tqslots\n\t but no TQ_OBJECT macro.", g->className.data()); - } else { - if ( g->superClassName.isEmpty() ) - tqmoc_err("The declaration of the class \"%s\" contains the\n" - "\tTQ_OBJECT macro but does not inherit from any class!\n" - "\tInherit from TQObject or one of its descendants" - " or remove TQ_OBJECT.", g->className.data() ); - } - if ( templateClass ) { // don't generate for class - tqmoc_err( "Sorry, TQt does not support templates that contain\n" - "\ttqsignals, tqslots or TQ_OBJECT." ); - return; - } - g->generatedCode = TRUE; - g->gen_count++; - - if ( g->gen_count == 1 ) { // first class to be generated - TQDateTime dt = TQDateTime::tqcurrentDateTime(); - TQCString dstr = dt.toString().ascii(); - TQCString fn = g->fileName; - i = g->fileName.length()-1; - while ( i>0 && g->fileName[i-1] != '/' && g->fileName[i-1] != '\\' ) - i--; // skip path - if ( i >= 0 ) - fn = g->fileName.tqstringFromPos(i); - fprintf( out, hdr1, (const char*)qualifiedClassName(),(const char*)fn); - fprintf( out, hdr2, (const char*)dstr ); - fprintf( out, hdr3 ); - fprintf( out, hdr4 ); - - if ( !g->noInclude ) { - /* - The header file might be a TQt header file with - TQT_NO_COMPAT macros around tqsignals, tqslots or - properties. Without the #undef, we cannot compile the - TQt library with TQT_NO_COMPAT defined. - - Header files of libraries build around TQt can also use - TQT_NO_COMPAT, so this #undef might be beneficial to - users of TQt, and not only to developers of TQt. - */ - fprintf( out, "#undef TQT_NO_COMPAT\n" ); - - if ( !g->pchFile.isEmpty() ) - fprintf( out, "#include \"%s\" // PCH include\n", (const char*)g->pchFile ); - if ( !g->includePath.isEmpty() && g->includePath.right(1) != "/" ) - g->includePath += "/"; - - g->includeFiles.first(); - while ( g->includeFiles.current() ) { - TQCString inc = g->includeFiles.current(); - if ( inc[0] != '<' && inc[0] != '"' ) { - if ( !g->includePath.isEmpty() && g->includePath != "./" ) - inc.prepend( g->includePath ); - inc = "\"" + inc + "\""; - } - fprintf( out, "#include %s\n", (const char *)inc ); - g->includeFiles.next(); - } - } - fprintf( out, "#include <%stqmetaobject.h>\n", (const char*)g->qtPath ); - fprintf( out, "#include <%stqapplication.h>\n\n", (const char*)g->qtPath ); - fprintf( out, "#include <%sprivate/tqucomextra_p.h>\n", (const char*)g->qtPath ); - fprintf( out, "#if !defined(TQ_TQMOC_OUTPUT_REVISION) || (TQ_TQMOC_OUTPUT_REVISION != %d)\n", formatRevision ); - fprintf( out, "#error \"This file was generated using the tqmoc from %s." - " It\"\n#error \"cannot be used with the include files from" - " this version of TQt.\"\n#error \"(The tqmoc has changed too" - " much.)\"\n", TQT_VERSION_STR ); - fprintf( out, "#endif\n\n" ); - } else { - fprintf( out, "\n\n" ); - } - - if ( !g->hasVariantIncluded ) { - bool needToIncludeVariant = !g->props.isEmpty(); - for ( Function* f =g->tqslots.first(); f && !needToIncludeVariant; f=g->tqslots.next() ) - needToIncludeVariant = ( f->type != "void" && !validUType( f->type ) && isVariantType( f->type) ); - - if ( needToIncludeVariant ) { - fprintf( out, "#include <%stqvariant.h>\n", (const char*)g->qtPath ); - g->hasVariantIncluded = TRUE; - } - } - - bool isTQObject = g->className == "TQObject" ; - - -// -// Generate virtual function className() -// - fprintf( out, "const char *%s::className() const\n{\n ", - (const char*)qualifiedClassName() ); - fprintf( out, "return \"%s\";\n}\n\n", (const char*)qualifiedClassName() ); - -// -// Generate static metaObj variable -// - fprintf( out, "TQMetaObject *%s::metaObj = 0;\n", (const char*)qualifiedClassName()); - -// -// Generate static cleanup object variable -// - TQCString cleanup = qualifiedClassName().copy(); - for ( int cnpos = 0; cnpos < cleanup.length(); cnpos++ ) { - if ( cleanup[cnpos] == ':' ) - cleanup[cnpos] = '_'; - } - - fprintf( out, "static TQMetaObjectCleanUp cleanUp_%s( \"%s\", &%s::staticMetaObject );\n\n", (const char*)cleanup, (const char*)qualifiedClassName(), (const char*)qualifiedClassName() ); - -// -// Generate tr and trUtf8 member functions -// - fprintf( out, "#ifndef TQT_NO_TRANSLATION\n" ); - fprintf( out, "TQString %s::tr( const char *s, const char *c )\n{\n", - (const char*)qualifiedClassName() ); - fprintf( out, " if ( tqApp )\n" ); - fprintf( out, "\treturn tqApp->translate( \"%s\", s, c," - " TQApplication::DefaultCodec );\n", - (const char*)qualifiedClassName() ); - fprintf( out, " else\n" ); - fprintf( out, "\treturn TQString::tqfromLatin1( s );\n"); - fprintf( out, "}\n" ); - fprintf( out, "#ifndef TQT_NO_TRANSLATION_UTF8\n" ); - fprintf( out, "TQString %s::trUtf8( const char *s, const char *c )\n{\n", - (const char*)qualifiedClassName() ); - fprintf( out, " if ( tqApp )\n" ); - fprintf( out, "\treturn tqApp->translate( \"%s\", s, c," - " TQApplication::UnicodeUTF8 );\n", - (const char*)qualifiedClassName() ); - fprintf( out, " else\n" ); - fprintf( out, "\treturn TQString::fromUtf8( s );\n" ); - fprintf( out, "}\n" ); - fprintf( out, "#endif // TQT_NO_TRANSLATION_UTF8\n\n" ); - fprintf( out, "#endif // TQT_NO_TRANSLATION\n\n" ); - -// -// Generate staticMetaObject member function -// - fprintf( out, "TQMetaObject* %s::staticMetaObject()\n{\n", (const char*)qualifiedClassName() ); - fprintf( out, " if ( metaObj )\n\treturn metaObj;\n" ); - if ( isTQObject ) - fprintf( out, " TQMetaObject* parentObject = staticTQtMetaObject();\n" ); - else if ( !g->superClassName.isEmpty() ) - if (g->superClassName.find("TQ") == 0) { // [FIXME] Verify that this will always be able to detect a TQt base class, even if intermediate classes do not start with TQ - fprintf( out, " TQMetaObject* parentObject = %s::staticMetaObject();\n", (const char*)g->superClassName ); - } - else { - fprintf( out, " TQMetaObject* parentObject = 0;\n" ); - } - else - fprintf( out, " TQMetaObject* parentObject = 0;\n" ); - -// -// Build the classinfo array -// - int n_infos = generateClassInfos(); - -// Build the enums array -// Enums HAVE to be generated BEFORE the properties and tqslots -// - int n_enums = generateEnums(); - -// -// Build tqslots array in staticMetaObject() -// - generateFuncs( &g->tqslots, "slot", Slot_Num ); - -// -// Build tqsignals array in staticMetaObject() -// - generateFuncs( &g->tqsignals, "signal", Signal_Num ); - -// -// Build property array in staticMetaObject() -// - int n_props = generateProps(); - -// -// Finally code to create and return meta object -// - fprintf( out, " metaObj = TQMetaObject::new_metaobject(\n" - "\t\"%s\", parentObject,\n", (const char*)qualifiedClassName() ); - - if ( g->tqslots.count() ) - fprintf( out, "\tslot_tbl, %d,\n", g->tqslots.count() ); - else - fprintf( out, "\t0, 0,\n" ); - - if ( g->tqsignals.count() ) - fprintf( out, "\tsignal_tbl, %d,\n", g->tqsignals.count() ); - else - fprintf( out, "\t0, 0,\n" ); - - fprintf( out, "#ifndef TQT_NO_PROPERTIES\n" ); - if ( n_props ) - fprintf( out, "\tprops_tbl, %d,\n", n_props ); - else - fprintf( out, "\t0, 0,\n" ); - if ( n_enums ) - fprintf( out, "\tenum_tbl, %d,\n", n_enums ); - else - fprintf( out, "\t0, 0,\n" ); - fprintf( out, "#endif // TQT_NO_PROPERTIES\n" ); - - if ( n_infos ) - fprintf( out, "\tclassinfo_tbl, %d );\n", n_infos ); - else - fprintf( out, "\t0, 0 );\n" ); - - -// -// Setup cleanup handler and return meta object -// - fprintf( out, " cleanUp_%s.setMetaObject( metaObj );\n", cleanup.data() ); - fprintf( out, " return metaObj;\n}\n" ); - -// -// End of function staticMetaObject() -// - -// -// Generate smart cast function -// - fprintf( out, "\nvoid* %s::qt_cast( const char* clname )\n{\n", - (const char*)qualifiedClassName() ); - fprintf( out, " if ( !qstrcmp( clname, \"%s\" ) )\n" - "\treturn this;\n", - (const char*)qualifiedClassName() ); - for ( const char* cname = g->multipleSuperClasses.first(); cname; cname = g->multipleSuperClasses.next() ) { - fprintf( out, " if ( !qstrcmp( clname, \"%s\" ) )\n", cname); - TQCString fixed(cname); - while (fixed.find(">>") != -1) - fixed = fixed.replace(">>", "> >"); - fprintf( out, "\treturn (%s*)this;\n", fixed.data()); - } - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, " return %sqt_cast( clname );\n", - (const char*)callablePurestSuperClassName() ); - else - fprintf( out, " return 0;\n" ); - fprintf( out, "}\n" ); - -// -// Generate internal signal functions -// - Function *f; - f = g->tqsignals.first(); // make internal signal methods - static bool included_list_headers = FALSE; - int sigindex = 0; - while ( f ) { - TQCString argstr; - char buf[12]; - Argument *a = f->args->first(); - int offset = 0; - const char *predef_call_func = 0; - bool hasReturnValue = f->type != "void" && (validUType( f->type ) || isVariantType( f->type) ); - if ( hasReturnValue ) { - ; // no predefined function available - } else if ( !a ) { - predef_call_func = "activate_signal"; - } else if ( f->args->count() == 1 ) { - TQCString ctype = (a->leftType + ' ' + a->rightType).simplifyWhiteSpace(); - if ( !isInOut( ctype ) ) { - TQCString utype = uType( ctype ); - if ( utype == "bool" ) - predef_call_func = "activate_signal_bool"; - else if ( utype == "TQString" || utype == "int" || utype == "double" ) - predef_call_func = "activate_signal"; - } - } - - if ( !predef_call_func && !included_list_headers ) { - // yes we need it, because otherwise TQT_VERSION may not be defined - fprintf( out, "\n#include <%stqobjectdefs.h>\n", (const char*)g->qtPath ); - fprintf( out, "#include <%stqsignalslotimp.h>\n", (const char*)g->qtPath ); - included_list_headers = TRUE; - } - - while ( a ) { // argument list - if ( !a->leftType.isEmpty() || !a->rightType.isEmpty() ) { - argstr += a->leftType; - argstr += " "; - sprintf( buf, "t%d", offset++ ); - argstr += buf; - argstr += a->rightType; - a = f->args->next(); - if ( a ) - argstr += ", "; - } else { - a = f->args->next(); - } - } - - fixRightAngles( &argstr ); - - fprintf( out, "\n// SIGNAL %s\n", (const char*)f->name ); - fprintf( out, "%s %s::%s(", (const char*) f->type, - (const char*)qualifiedClassName(), - (const char*)f->name ); - - if ( argstr.isEmpty() ) - fprintf( out, ")\n{\n" ); - else - fprintf( out, " %s )\n{\n", (const char*)argstr ); - - if ( predef_call_func ) { - fprintf( out, " %s%s( staticMetaObject()->signalOffset() + %d", (const char *) callablePurestSuperClassName(), predef_call_func, sigindex ); - if ( !argstr.isEmpty() ) - fprintf( out, ", t0" ); - fprintf( out, " );\n}\n" ); - } else { - if ( hasReturnValue ) - fprintf( out, " %s something;\n", f->type.data() ); - int nargs = f->args->count(); - fprintf( out, " if ( tqsignalsBlocked() )\n\treturn%s;\n", hasReturnValue ? " something" : "" ); - fprintf( out, " TQConnectionList *clist = tqreceivers( staticMetaObject()->signalOffset() + %d );\n", - sigindex ); - fprintf( out, " if ( !clist )\n\treturn%s;\n", hasReturnValue ? " something" : "" ); - fprintf( out, " TQUObject o[%d];\n", f->args->count() + 1 ); - - // initialize return value to something - if ( hasReturnValue ) { - if ( validUType( f->type ) ) { - TQCString utype = uType( f->type ); - fprintf( out, " static_TQUType_%s.set(o,something);\n", utype.data() ); - } else if ( uType( f->type ) == "varptr" ) { - fprintf( out, " static_TQUType_varptr.set(o,&something);\n" ); - } else { - fprintf( out, " static_TQUType_ptr.set(o,&something);\n" ); - } - } - - // initialize arguments - if ( !f->args->isEmpty() ) { - offset = 0; - Argument* a = f->args->first(); - while ( a ) { - TQCString type = a->leftType + ' ' + a->rightType; - type = type.simplifyWhiteSpace(); - if ( validUType( type ) ) { - TQCString utype = uType( type ); - fprintf( out, " static_TQUType_%s.set(o+%d,t%d);\n", utype.data(), offset+1, offset ); - } else if ( uType( type ) == "varptr" ) { - fprintf( out, " static_TQUType_varptr.set(o+%d,&t%d);\n", offset+1, offset ); - } else { - fprintf( out, " static_TQUType_ptr.set(o+%d,&t%d);\n", offset+1, offset ); - } - a = f->args->next(); - offset++; - } - } - fprintf( out, " activate_signal( clist, o );\n" ); - - // get return values from inOut parameters - if ( !f->args->isEmpty() ) { - offset = 0; - Argument* a = f->args->first(); - while ( a ) { - TQCString type = a->leftType + ' ' + a->rightType; - type = type.simplifyWhiteSpace(); - if ( validUType( type ) && isInOut( type ) ) { - TQCString utype = uType( type ); - if ( utype == "enum" ) - fprintf( out, " t%d = (%s)static_TQUType_%s.get(o+%d);\n", offset, type.data(), utype.data(), offset+1 ); - else if ( utype == "ptr" && type.right(2) == "**" ) - fprintf( out, " if (t%d) *t%d = *(%s)static_TQUType_ptr.get(o+%d);\n", offset, offset, type.data(), offset+1 ); - else - fprintf( out, " t%d = static_TQUType_%s.get(o+%d);\n", offset, utype.data(), offset+1 ); - } - a = f->args->next(); - offset++; - } - } - - // get and return return value - if ( hasReturnValue ) { - TQCString utype = uType( f->type ); - if ( utype == "enum" || utype == "ptr" || utype == "varptr" ) // need cast - fprintf( out, " return (%s)static_TQUType_%s.get(o);\n", f->type.data(), utype.data() ); - else - fprintf( out, " return static_TQUType_%s.get(o);\n", utype.data() ); - } - - fprintf( out, "}\n" ); - } - - f = g->tqsignals.next(); - sigindex++; - } - - -// -// Generate internal qt_invoke() function -// - fprintf( out, "\nbool %s::qt_invoke( int _id, TQUObject* _o )\n{\n", qualifiedClassName().data() ); - - if( !g->tqslots.isEmpty() ) { - fprintf( out, " switch ( _id - staticMetaObject()->slotOffset() ) {\n" ); - int slotindex = -1; - for ( f = g->tqslots.first(); f; f = g->tqslots.next() ) { - slotindex ++; - if ( f->type == "void" && f->args->isEmpty() ) { - fprintf( out, " case %d: %s(); break;\n", slotindex, f->name.data() ); - continue; - } - - fprintf( out, " case %d: ", slotindex ); - bool hasReturnValue = FALSE; - bool hasVariantReturn = FALSE; - if ( f->type != "void" ) { - if ( validUType( f->type )) { - hasReturnValue = TRUE; - fprintf( out, "static_TQUType_%s.set(_o,", uType(f->type).data() ); - } else if ( isVariantType( f->type ) ) { - hasReturnValue = hasVariantReturn = TRUE; - // do not need special handling for bool since this is handled as utype - fprintf( out, "static_TQUType_TQVariant.set(_o,TQVariant(" ); - } - } - int offset = 0; - fprintf( out, "%s(", f->name.data() ); - Argument* a = f->args->first(); - while ( a ) { - TQCString type = a->leftType + ' ' + a->rightType; - type = type.simplifyWhiteSpace(); - fixRightAngles( &type ); - if ( validUType( type ) ) { - TQCString utype = uType( type ); - if ( utype == "ptr" || utype == "varptr" || utype == "enum" ) - fprintf( out, "(%s)static_TQUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); - else - fprintf( out, "(%s)static_TQUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); - } else { - TQCString castType = castToUType( type ); - if(castType == type) - fprintf( out, "(%s)(*((%s*)static_TQUType_ptr.get(_o+%d)))", type.data(), - castType.data(), offset+1 ); - else - fprintf( out, "(%s)*((%s*)static_TQUType_ptr.get(_o+%d))", type.data(), - castType.data(), offset+1 ); - } - a = f->args->next(); - if ( a ) - fprintf( out, "," ); - offset++; - } - fprintf( out, ")" ); - if ( hasReturnValue ) - fprintf( out, ")" ); - if ( hasVariantReturn ) - fprintf( out, ")" ); - fprintf( out, "; break;\n" ); - } - fprintf( out, " default:\n" ); - - if ( !g->superClassName.isEmpty() && !isTQObject ) { - fprintf( out, "\treturn %sqt_invoke( _id, _o );\n", - (const char *) callablePurestSuperClassName() ); - } else { - fprintf( out, "\treturn FALSE;\n" ); - } - fprintf( out, " }\n" ); - fprintf( out, " return TRUE;\n}\n" ); - } else { - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, " return %sqt_invoke(_id,_o);\n}\n", - (const char *) callablePurestSuperClassName() ); - else - fprintf( out, " return FALSE;\n}\n" ); - } - - -// -// Generate internal qt_emit() function -// - fprintf( out, "\nbool %s::qt_emit( int _id, TQUObject* _o )\n{\n", qualifiedClassName().data() ); - - if ( !g->tqsignals.isEmpty() ) { - fprintf( out, " switch ( _id - staticMetaObject()->signalOffset() ) {\n" ); - int signalindex = -1; - for ( f = g->tqsignals.first(); f; f = g->tqsignals.next() ) { - signalindex++; - if ( f->type == "void" && f->args->isEmpty() ) { - fprintf( out, " case %d: %s(); break;\n", signalindex, f->name.data() ); - continue; - } - - fprintf( out, " case %d: ", signalindex ); - bool hasReturnValue = FALSE; - if ( f->type != "void" && validUType( f->type )) { - hasReturnValue = TRUE; - fprintf( out, "static_TQUType_%s.set(_o,", uType(f->type).data() ); - } - int offset = 0; - fprintf( out, "%s(", f->name.data() ); - Argument* a = f->args->first(); - while ( a ) { - TQCString type = a->leftType + ' ' + a->rightType; - type = type.simplifyWhiteSpace(); - fixRightAngles( &type ); - if ( validUType( type ) ) { - TQCString utype = uType( type ); - if ( utype == "ptr" || utype == "varptr" || utype == "enum" ) - fprintf( out, "(%s)static_TQUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); - else - fprintf( out, "(%s)static_TQUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); - } else { - TQCString castType = castToUType( type ); - if(castType == type) - fprintf( out, "(%s)(*((%s*)static_TQUType_ptr.get(_o+%d)))", type.data(), - castType.data(), offset+1 ); - else - fprintf( out, "(%s)*((%s*)static_TQUType_ptr.get(_o+%d))", type.data(), - castType.data(), offset+1 ); - } - a = f->args->next(); - if ( a ) - fprintf( out, "," ); - offset++; - } - fprintf( out, ")" ); - if ( hasReturnValue ) - fprintf( out, ")" ); - fprintf( out, "; break;\n" ); - } - fprintf( out, " default:\n" ); - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, "\treturn %sqt_emit(_id,_o);\n", - (const char *) callablePurestSuperClassName() ); - else - fprintf( out, "\treturn FALSE;\n" ); - fprintf( out, " }\n" ); - fprintf( out, " return TRUE;\n}\n" ); - } else { - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, " return %sqt_emit(_id,_o);\n}\n", - (const char *) callablePurestSuperClassName() ); - else - fprintf( out, " return FALSE;\n}\n" ); - } - - - fprintf( out, "#ifndef TQT_NO_PROPERTIES\n" ); -// -// Generate internal qt_property() functions -// - - fprintf( out, "\nbool %s::qt_property( int id, int f, TQVariant* v)\n{\n", qualifiedClassName().data() ); - - if ( !g->props.isEmpty() ) { - fprintf( out, " switch ( id - staticMetaObject()->propertyOffset() ) {\n" ); - int propindex = -1; - bool need_resolve = FALSE; - - for( TQPtrListIterator<Property> it( g->props ); it.current(); ++it ){ - propindex ++; - fprintf( out, " case %d: ", propindex ); - fprintf( out, "switch( f ) {\n" ); - - uint flag_break = 0; - uint flag_propagate = 0; - - if ( it.current()->setfunc ) { - fprintf( out, "\tcase 0: %s(", it.current()->setfunc->name.data() ); - TQCString type = it.current()->type.copy(); // detach on purpose - if ( it.current()->oredEnum ) - type = it.current()->enumsettype; - if ( type == "uint" ) - fprintf( out, "v->asUInt()" ); - else if ( type == "unsigned int" ) - fprintf( out, "(uint)v->asUInt()" ); - else if ( type == "TQMap<TQString,TQVariant>" ) - fprintf( out, "v->asMap()" ); - else if ( type == "TQValueList<TQVariant>" ) - fprintf( out, "v->asList()" ); - else if ( type == "TQ_LLONG" ) - fprintf( out, "v->asLongLong()" ); - else if ( type == "TQ_ULLONG" ) - fprintf( out, "v->asULongLong()" ); - else if ( isVariantType( type ) ) { - if (( type[0] == 'T' ) && ( type[1] == 'Q' )) - type = type.mid(2); - else - type[0] = toupper( type[0] ); - fprintf( out, "v->as%s()", type.data() ); - } else { - fprintf( out, "(%s&)v->asInt()", type.data() ); - } - fprintf( out, "); break;\n" ); - - } else if ( it.current()->override ) { - flag_propagate |= 1 << (0+1); - } - if ( it.current()->getfunc ) { - if ( it.current()->gspec == Property::Pointer ) - fprintf( out, "\tcase 1: if ( this->%s() ) *v = TQVariant( %s*%s()%s ); break;\n", - it.current()->getfunc->name.data(), - !isVariantType( it.current()->type ) ? "(int)" : "", - it.current()->getfunc->name.data(), - it.current()->type == "bool" ? ", 0" : "" ); - else - fprintf( out, "\tcase 1: *v = TQVariant( %sthis->%s()%s ); break;\n", - !isVariantType( it.current()->type ) ? "(int)" : "", - it.current()->getfunc->name.data(), - it.current()->type == "bool" ? ", 0" : "" ); - } else if ( it.current()->override ) { - flag_propagate |= 1<< (1+1); - } - - if ( !it.current()->reset.isEmpty() ) - fprintf( out, "\tcase 2: this->%s(); break;\n", it.current()->reset.data() ); - - if ( it.current()->designable.isEmpty() ) - flag_propagate |= 1 << (3+1); - else if ( it.current()->designable == "true" ) - flag_break |= 1 << (3+1); - else if ( it.current()->designable != "false" ) - fprintf( out, "\tcase 3: return this->%s();\n", it.current()->designable.data() ); - - if ( it.current()->scriptable.isEmpty() ) - flag_propagate |= 1 << (4+1); - else if ( it.current()->scriptable == "true" ) - flag_break |= 1 << (4+1); - else if ( it.current()->scriptable != "false" ) - fprintf( out, "\tcase 4: return this->%s();\n", it.current()->scriptable.data() ); - - if ( it.current()->stored.isEmpty() ) - flag_propagate |= 1 << (5+1); - else if ( it.current()->stored == "true" ) - flag_break |= 1 << (5+1); - else if ( it.current()->stored != "false" ) - fprintf( out, "\tcase 5: return this->%s();\n", it.current()->stored.data() ); - - int i = 0; - if ( flag_propagate != 0 ) { - fprintf( out, "\t" ); - for ( i = 0; i <= 5; i++ ) { - if ( flag_propagate & (1 << (i+1) ) ) - fprintf( out, "case %d: ", i ); - } - if (!g->superClassName.isEmpty() && !isTQObject ) { - fprintf( out, "goto resolve;\n" ); - need_resolve = TRUE; - } else { - fprintf( out, " return FALSE;\n" ); - } - } - if ( flag_break != 0 ) { - fprintf( out, "\t" ); - for ( i = 0; i <= 5; i++ ) { - if ( flag_break & (1 << (i+1) ) ) - fprintf( out, "case %d: ", i ); - } - fprintf( out, "break;\n"); - } - - fprintf( out, "\tdefault: return FALSE;\n } break;\n" ); - } - fprintf( out, " default:\n" ); - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, "\treturn %sqt_property( id, f, v );\n", - (const char *) callablePurestSuperClassName() ); - else - fprintf( out, "\treturn FALSE;\n" ); - fprintf( out, " }\n" ); - fprintf( out, " return TRUE;\n" ); - - if ( need_resolve ) - fprintf( out, "resolve:\n return %sqt_property( staticMetaObject()->resolveProperty(id), f, v );\n", - (const char *) callablePurestSuperClassName() ); - fprintf( out, "}\n" ); - } else { - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, " return %sqt_property( id, f, v);\n}\n", - (const char *) callablePurestSuperClassName() ); - else - fprintf( out, " return FALSE;\n}\n" ); - } - - fprintf( out, "\nbool %s::qt_static_property( TQObject* , int , int , TQVariant* ){ return FALSE; }\n", qualifiedClassName().data() ); - fprintf( out, "#endif // TQT_NO_PROPERTIES\n" ); -} - - -ArgList *addArg( Argument *a ) // add argument to list -{ - if ( (!a->leftType.isEmpty() || !a->rightType.isEmpty() ) ) //filter out truely void arguments - tmpArgList->append( a ); - return tmpArgList; -} - -void addEnum() -{ - // Avoid duplicates - for( TQPtrListIterator<Enum> lit( g->enums ); lit.current(); ++lit ) { - if ( lit.current()->name == tmpEnum->name ) - { - if ( displayWarnings ) - tqmoc_err( "Enum %s defined twice.", (const char*)tmpEnum->name ); - } - } - - // Only look at types mentioned in TQ_ENUMS and TQ_SETS - if ( g->qtEnums.contains( tmpEnum->name ) || g->qtSets.contains( tmpEnum->name ) ) - { - g->enums.append( tmpEnum ); - if ( g->qtSets.contains( tmpEnum->name ) ) - tmpEnum->set = TRUE; - else - tmpEnum->set = FALSE; - } - else - delete tmpEnum; - tmpEnum = new Enum; -} - -void addMember( Member m ) -{ - if ( skipFunc ) { - tmpFunc->args = tmpArgList; // just to be sure - delete tmpFunc; - tmpArgList = new ArgList; // ugly but works - tmpFunc = new Function; - skipFunc = FALSE; - return; - } - - tmpFunc->type = tmpFunc->type.simplifyWhiteSpace(); - tmpFunc->access = tmpAccess; - tmpFunc->args = tmpArgList; - tmpFunc->lineNo = lineNo; - - for ( ;; ) { - g->funcs.append( tmpFunc ); - - if ( m == SignalMember ) { - g->tqsignals.append( tmpFunc ); - break; - } else { - if ( m == SlotMember ) - g->tqslots.append( tmpFunc ); - // PropertyCandidateMember or SlotMember - if ( !tmpFunc->name.isEmpty() && tmpFunc->access == Public ) - g->propfuncs.append( tmpFunc ); - if ( !tmpFunc->args || !tmpFunc->args->hasDefaultArguments() ) - break; - tmpFunc = new Function( *tmpFunc ); - tmpFunc->args = tmpFunc->args->magicClone(); - } - } - - skipFunc = FALSE; - tmpFunc = new Function; - tmpArgList = new ArgList; -} - -void checkPropertyName( const char* ident ) -{ - if ( ident[0] == '_' ) { - tqmoc_err( "Invalid property name '%s'.", ident ); - return; - } -} - diff --git a/tqtinterface/qt4/src/tqmoc/tqmoc_yacc.h b/tqtinterface/qt4/src/tqmoc/tqmoc_yacc.h deleted file mode 100644 index 553aa66..0000000 --- a/tqtinterface/qt4/src/tqmoc/tqmoc_yacc.h +++ /dev/null @@ -1,185 +0,0 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ - -/* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - CHAR_VAL = 258, - INT_VAL = 259, - DOUBLE_VAL = 260, - STRING = 261, - IDENTIFIER = 262, - FRIEND = 263, - TYPEDEF = 264, - AUTO = 265, - REGISTER = 266, - STATIC = 267, - EXTERN = 268, - INLINE = 269, - VIRTUAL = 270, - CONST = 271, - VOLATILE = 272, - CHAR = 273, - SHORT = 274, - INT = 275, - LONG = 276, - SIGNED = 277, - UNSIGNED = 278, - FLOAT = 279, - DOUBLE = 280, - VOID = 281, - ENUM = 282, - CLASS = 283, - STRUCT = 284, - UNION = 285, - ASM = 286, - PRIVATE = 287, - PROTECTED = 288, - PUBLIC = 289, - OPERATOR = 290, - DBL_COLON = 291, - TRIPLE_DOT = 292, - TEMPLATE = 293, - NAMESPACE = 294, - USING = 295, - MUTABLE = 296, - THROW = 297, - SIGNALS = 298, - SLOTS = 299, - TQ_OBJECT = 300, - Q_PROPERTY = 301, - TQ_OVERRIDE = 302, - TQ_CLASSINFO = 303, - TQ_ENUMS = 304, - TQ_SETS = 305, - READ = 306, - WRITE = 307, - STORED = 308, - DESIGNABLE = 309, - SCRIPTABLE = 310, - RESET = 311 - }; -#endif -/* Tokens. */ -#define CHAR_VAL 258 -#define INT_VAL 259 -#define DOUBLE_VAL 260 -#define STRING 261 -#define IDENTIFIER 262 -#define FRIEND 263 -#define TYPEDEF 264 -#define AUTO 265 -#define REGISTER 266 -#define STATIC 267 -#define EXTERN 268 -#define INLINE 269 -#define VIRTUAL 270 -#define CONST 271 -#define VOLATILE 272 -#define CHAR 273 -#define SHORT 274 -#define INT 275 -#define LONG 276 -#define SIGNED 277 -#define UNSIGNED 278 -#define FLOAT 279 -#define DOUBLE 280 -#define VOID 281 -#define ENUM 282 -#define CLASS 283 -#define STRUCT 284 -#define UNION 285 -#define ASM 286 -#define PRIVATE 287 -#define PROTECTED 288 -#define PUBLIC 289 -#define OPERATOR 290 -#define DBL_COLON 291 -#define TRIPLE_DOT 292 -#define TEMPLATE 293 -#define NAMESPACE 294 -#define USING 295 -#define MUTABLE 296 -#define THROW 297 -#define SIGNALS 298 -#define SLOTS 299 -#define TQ_OBJECT 300 -#define Q_PROPERTY 301 -#define TQ_OVERRIDE 302 -#define TQ_CLASSINFO 303 -#define TQ_ENUMS 304 -#define TQ_SETS 305 -#define READ 306 -#define WRITE 307 -#define STORED 308 -#define DESIGNABLE 309 -#define SCRIPTABLE 310 -#define RESET 311 - - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -{ - -/* Line 1676 of yacc.c */ -#line 692 "tqmoc.y" - - char char_val; - int int_val; - double double_val; - char *string; - Access access; - Function *function; - ArgList *arg_list; - Argument *arg; - - - -/* Line 1676 of yacc.c */ -#line 177 "tqmoc_yacc.h" -} YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - -extern YYSTYPE yylval; - - |