From 587657561bb870d457a188a80bc0ce918ef5a0bd Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sun, 6 Oct 2024 17:29:49 +0900 Subject: Rename moc to tqmoc Signed-off-by: Michele Calgaro --- src/kernel/tqmetaobject.cpp | 8 +- src/kernel/tqobject.cpp | 4 +- src/kernel/tqobjectdefs.h | 2 +- src/kernel/tqprocess_unix.cpp | 2 +- src/kernel/tqt.h | 3 - src/kernel/tqvariant.cpp | 4 +- src/moc/README | 12 - src/moc/moc.l | 498 ---- src/moc/moc.pro | 65 - src/moc/moc.y | 3607 ----------------------- src/moc/moc_lex.cpp | 3315 --------------------- src/moc/moc_yacc.cpp | 6483 ----------------------------------------- src/moc/moc_yacc.h | 183 -- src/tmp/README | 2 +- src/tqmoc/README | 12 + src/tqmoc/tqmoc.l | 498 ++++ src/tqmoc/tqmoc.pro | 65 + src/tqmoc/tqmoc.y | 3607 +++++++++++++++++++++++ src/tqmoc/tqmoc_lex.cpp | 3315 +++++++++++++++++++++ src/tqmoc/tqmoc_yacc.cpp | 6483 +++++++++++++++++++++++++++++++++++++++++ src/tqmoc/tqmoc_yacc.h | 183 ++ src/widgets/tqtextedit.h | 2 +- 22 files changed, 14175 insertions(+), 14178 deletions(-) delete mode 100644 src/moc/README delete mode 100644 src/moc/moc.l delete mode 100644 src/moc/moc.pro delete mode 100644 src/moc/moc.y delete mode 100644 src/moc/moc_lex.cpp delete mode 100644 src/moc/moc_yacc.cpp delete mode 100644 src/moc/moc_yacc.h create mode 100644 src/tqmoc/README create mode 100644 src/tqmoc/tqmoc.l create mode 100644 src/tqmoc/tqmoc.pro create mode 100644 src/tqmoc/tqmoc.y create mode 100644 src/tqmoc/tqmoc_lex.cpp create mode 100644 src/tqmoc/tqmoc_yacc.cpp create mode 100644 src/tqmoc/tqmoc_yacc.h (limited to 'src') diff --git a/src/kernel/tqmetaobject.cpp b/src/kernel/tqmetaobject.cpp index 06fd7c86f..4e5686295 100644 --- a/src/kernel/tqmetaobject.cpp +++ b/src/kernel/tqmetaobject.cpp @@ -109,7 +109,7 @@ The number of pairs is returned by numClassInfo(), and values are returned by classInfo(). - \sa \link moc.html moc (Meta Object Compiler)\endlink + \sa \link tqmoc.html tqmoc (Meta Object Compiler)\endlink */ @@ -118,7 +118,7 @@ The private object. *****************************************************************************/ -// extra flags from moc.y +// extra flags from tqmoc.y enum Flags { Invalid = 0x00000000, Readable = 0x00000001, @@ -660,7 +660,7 @@ const TQMetaProperty* TQMetaObject::resolveProperty( const TQMetaProperty* p ) c \overload - The version of resolveProperty that is used by moc generated code + The version of resolveProperty that is used by tqmoc generated code */ int TQMetaObject::resolveProperty( int index ) const @@ -1197,7 +1197,7 @@ bool TQMetaProperty::reset( TQObject* o ) const #endif // TQT_NO_PROPERTIES /* - * TQMetaObjectCleanUp is used as static global object in the moc-generated cpp + * TQMetaObjectCleanUp is used as static global object in the tqmoc-generated cpp * files and deletes the TQMetaObject provided with setMetaObject. It sets the * TQObject reference to the metaObj to NULL when it is destroyed. */ diff --git a/src/kernel/tqobject.cpp b/src/kernel/tqobject.cpp index 3c0b0f3ba..85c69f8ba 100644 --- a/src/kernel/tqobject.cpp +++ b/src/kernel/tqobject.cpp @@ -388,7 +388,7 @@ TQMetaCallEvent::~TQMetaCallEvent() Notice that the TQ_OBJECT macro is mandatory for any object that implements signals, slots or properties. You also need to run the - \link moc.html moc program (Meta Object Compiler) \endlink on the + \link tqmoc.html tqmoc program (Meta Object Compiler) \endlink on the source file. We strongly recommend the use of this macro in \e all subclasses of TQObject regardless of whether or not they actually use signals, slots and properties, since failure to do so may lead @@ -3219,7 +3219,7 @@ TQVariant TQObject::property( const char *name ) const className(), name ); return v; } - TQObject* that = (TQObject*) this; // moc ensures constness for the tqt_property call + TQObject* that = (TQObject*) this; // tqmoc ensures constness for the tqt_property call that->tqt_property( id, 1, &v ); return v; } diff --git a/src/kernel/tqobjectdefs.h b/src/kernel/tqobjectdefs.h index 422299850..69d44d6bc 100644 --- a/src/kernel/tqobjectdefs.h +++ b/src/kernel/tqobjectdefs.h @@ -71,7 +71,7 @@ #endif // The following macros are our "extensions" to C++ -// They are used, strictly speaking, only by the moc. +// They are used, strictly speaking, only by tqmoc. struct TQUObject; #ifdef QT_MOC_CPP diff --git a/src/kernel/tqprocess_unix.cpp b/src/kernel/tqprocess_unix.cpp index d85b64d71..b9a79afda 100644 --- a/src/kernel/tqprocess_unix.cpp +++ b/src/kernel/tqprocess_unix.cpp @@ -1345,7 +1345,7 @@ void TQProcess::flushStdin() } /* - This private slot is only used under Windows (but moc does not know about #if + This private slot is only used under Windows (but tqmoc does not know about #if defined()). */ void TQProcess::timeout() diff --git a/src/kernel/tqt.h b/src/kernel/tqt.h index 665f07b1a..b4aa2c6d6 100644 --- a/src/kernel/tqt.h +++ b/src/kernel/tqt.h @@ -26,7 +26,4 @@ Boston, MA 02110-1301, USA. #define Qt TQt -#define tqmoc moc -#define TQMOC MOC - #endif /* TQT_H */ diff --git a/src/kernel/tqvariant.cpp b/src/kernel/tqvariant.cpp index e400dbd07..71175edac 100644 --- a/src/kernel/tqvariant.cpp +++ b/src/kernel/tqvariant.cpp @@ -984,10 +984,10 @@ void TQVariant::clear() /* Attention! - For dependency reasons, this table is duplicated in moc.y. If you + For dependency reasons, this table is duplicated in tqmoc.y. If you change one, change both. - (Search for the word 'Attention' in moc.y.) + (Search for the word 'Attention' in tqmoc.y.) */ static const int ntypes = 35; static const char* const type_map[ntypes] = diff --git a/src/moc/README b/src/moc/README deleted file mode 100644 index 4105ba68b..000000000 --- a/src/moc/README +++ /dev/null @@ -1,12 +0,0 @@ -This directory contains the source code for the TQt Meta Object -Compiler (moc). - -The files moc_yacc.cpp, moc_yacc.h and moc_lex.cpp are generated by -lex and yacc from moc.l and moc.y. - -To compile the moc 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. diff --git a/src/moc/moc.l b/src/moc/moc.l deleted file mode 100644 index b5388077f..000000000 --- a/src/moc/moc.l +++ /dev/null @@ -1,498 +0,0 @@ -/**************************************************************************** -** -** Lexical analyzer for meta object compiler -** -** Created : 930417 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** 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 sales@trolltech.com. -** -** This file may be used under the terms of the Q 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 MOC_YACC_CODE - -#ifdef MOC_MWERKS_PLUGIN -#ifdef Q_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 -#include - -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 - MOC_SKIP_BEGIN is encountered */ -int skipLevel = 0; /* Depth of MOC_SKIP_BEGINs */ - -class TQString; - -extern void addExpressionChar( const char ); -extern void addExpressionString( const char * ); -extern void moc_warn( const char *msg ); -%} - -%start OUTSIDE QT_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}\" - -%% - -"class" { X; - BEGIN QT_DEF; - return CLASS; } -"namespace" { X; - BEGIN QT_DEF; - return NAMESPACE; } -"using" { X; - BEGIN QT_DEF; - return USING; } -"template" { X; - BEGIN QT_DEF; - return TEMPLATE; } -"TQ_OBJECT" { X; return TQ_OBJECT; } -"signals" { X; return SIGNALS; } -"slots" { X; return SLOTS; } -"TQ_CLASSINFO" { X; return TQ_CLASSINFO; } -"TQ_PROPERTY" { X; return TQ_PROPERTY; } -"TQ_OVERRIDE" { X; return TQ_OVERRIDE; } -"TQ_ENUMS" { X; return TQ_ENUMS; } -"TQ_SETS" { X; return TQ_SETS; } - -"{" { fctLevel++;Y; } -"}" { fctLevel--;Y;if (fctLevel==0){X;return '}';}} -"{" { classPLevel++;Y; } -"}" { classPLevel--;Y;if (classPLevel == 0) - {X;return '}';} } -"public" { X;if( classPLevel == 1 ) return PUBLIC; } -"protected" { X;if( classPLevel == 1 ) return PROTECTED; } -"private" { X;if( classPLevel == 1 ) return PRIVATE; } -"signals" { X;if( classPLevel == 1 ) return SIGNALS; } -"slots" { X;if( classPLevel == 1 ) return SLOTS; } -"TQ_CLASSINFO" { X;if( classPLevel == 1 ) return TQ_CLASSINFO; } -"TQ_OBJECT" { X; - if ( classPLevel == 1 ) - return TQ_OBJECT; - else if ( classPLevel > 1 ) - moc_warn( "Cannot use TQ_OBJECT in nested class." ); - } -"TQ_PROPERTY" { X;if( classPLevel == 1 ) return TQ_PROPERTY; } -"TQ_OVERRIDE" { X;if( classPLevel == 1 ) return TQ_OVERRIDE; } -"TQ_ENUMS" { X;if( classPLevel == 1 ) return TQ_ENUMS; } -"TQ_SETS" { X;if( classPLevel == 1 ) return TQ_SETS; } - -"{" { namespacePLevel++;Y; } -"}" { namespacePLevel--;Y;if (namespacePLevel == 0) - {X;return '}';}} -"class" { X; - BEGIN QT_DEF; - return CLASS; } -"template" { X; - BEGIN QT_DEF; - return TEMPLATE; } -"namespace" { X; - BEGIN QT_DEF; - return NAMESPACE; } -"using" { X; - BEGIN QT_DEF; - return USING; } - -"(" { X; return '('; } -")" { X; return ')'; } -"READ" { X; return READ; } -"WRITE" { X; return WRITE; } -"STORED" { X; return STORED; } -"RESET" { X; return RESET; } -"DESIGNABLE" { X; return DESIGNABLE; } -"SCRIPTABLE" { X; return SCRIPTABLE; } - - -"(" { expLevel++;X; } -")" { expLevel--;Y;if (expLevel == 0) - { X; BEGIN QT_DEF; return ')';} } -"[" { expLevel++;X; } -"]" { expLevel--;X;if (expLevel == 0) - { X; BEGIN QT_DEF; return ']';} } -"," { if (expLevel == 0) - { X; BEGIN QT_DEF; return ',' ;} } -";" { if (expLevel == 0) - { X; BEGIN QT_DEF; return ';' ;} } -"(" { expLevel++;X; } -")" { expLevel--;Y;if (expLevel == 0) - { X; BEGIN QT_DEF; return ')';} } -"[" { expLevel++;X; } -"]" { expLevel--;X;if (expLevel == 0) - { X; BEGIN QT_DEF; return ']';} } -"," { if (expLevel <= 1) - { X; BEGIN QT_DEF; return ',' ;} } -";" { if (expLevel == 0) - { X; BEGIN QT_DEF; return ';' ;} } -"(" { enumLevel++;X; } -")" { enumLevel--;X; } -"[" { enumLevel++;X; } -"]" { enumLevel--;X } -"," { if (enumLevel == 0) - { X; BEGIN QT_DEF; return ',' ;} } -";" { if (enumLevel == 0) - { X; BEGIN QT_DEF; return ';' ;} } -"}" { if (enumLevel == 0) - { X; BEGIN QT_DEF; return '}' ;} } -[[(<] { templLevel++; - Y; - addExpressionChar( yytext[0] ); - } -[])>] { templLevel--; - Y; - if ( templLevel == 0 ) { - X; - BEGIN QT_DEF; - return yytext[0]; - } else { - addExpressionChar( yytext[0] ); - } - } -"friend" { X;return FRIEND; } -"typedef" { X;return TYPEDEF; } -"auto" { X;return AUTO; } -"register" { X;return REGISTER; } -"static" { X;return STATIC; } -"extern" { X;return EXTERN; } -"inline" { X;return INLINE; } -"__inline__" { X;return INLINE; } -"virtual" { X;return VIRTUAL; } -"const" { X;return CONST; } -"volatile" { X;return VOLATILE; } -"char" { X;return CHAR; } -"short" { X;return SHORT; } -"int" { X;return INT; } -"long" { X;return LONG; } -"signed" { X;return SIGNED; } -"unsigned" { X;return UNSIGNED; } -"float" { X;return FLOAT; } -"double" { X;return DOUBLE; } -"void" { X;return VOID; } -"enum" { X;return ENUM; } -"class" { X;return CLASS; } -"struct" { X;return STRUCT; } -"union" { X;return UNION; } -"asm" { X;return ASM; } -"private" { X;return PRIVATE; } -"protected" { X;return PROTECTED; } -"public" { X;return PUBLIC; } -"operator" { X;return OPERATOR; } -"::" { X;return DBL_COLON; } -"..." { X;return TRIPLE_DOT; } -"template" { X;return TEMPLATE; } -"mutable" { X;return MUTABLE; } -"throw" { X;return THROW; } -"using" { X;return USING; } -"namespace" { X;return NAMESPACE; } - -[_a-zA-Z][_a-zA-Z0-9]* { - X; - yylval.string = tqstrdup(yytext); - return IDENTIFIER; - } - -[_a-zA-Z][_a-zA-Z0-9]* { - X; - yylval.string = tqstrdup(yytext); - return IDENTIFIER; - } - -"(" { X; return '('; } -")" { X; return ')'; } -"," { X; return ','; } - -{ALMOSTSTRING} { - X; - yylval.string = tqstrdup( yytext + 1 ); - input(); /* discard the '"' */ - return STRING; - } - -[_a-zA-Z][_a-zA-Z0-9]* ; -[_a-zA-Z][_a-zA-Z0-9]* ; -[_a-zA-Z][_a-zA-Z0-9]* ; - -{STRING} { /* discard strings */ - Z; - } - -{STRING} { /* discard strings */ - Z; - } - -{STRING} { /* discard strings */ - Z; - } - -{ALMOSTSTRING} { /* discard strings */ - Z; - addExpressionString( yytext ); - input(); /* discard the '"' */ - } - - -{ALMOSTSTRING} { - X; - addExpressionString( yytext ); - input(); /* discard the '"' */ - return STRING; - } - -{ALMOSTSTRING} { - X; - yylval.string = tqstrdup( yytext + 1 ); - input(); /* discard the '"' */ - return STRING; - } - -'.' { X; - yylval.char_val = yytext[1]; - return CHAR_VAL; - } - -'\\a' { X; - yylval.char_val = '\a'; - return CHAR_VAL; - } - -'\\b' { X; - yylval.char_val = '\b'; - return CHAR_VAL; - } - -'\\f' { X; - yylval.char_val = '\f'; - return CHAR_VAL; - } - -'\\n' { X; - yylval.char_val = '\n'; - return CHAR_VAL; - } - -'\\r' { X; - yylval.char_val = '\r'; - return CHAR_VAL; - } - -'\\t' { X; - yylval.char_val = '\t'; - return CHAR_VAL; - } - -'\\v' { X; - yylval.char_val = '\v'; - return CHAR_VAL; - } - -'\\\\' { X; - yylval.char_val = '\\'; - return CHAR_VAL; - } - -'\\?' { X; - yylval.char_val = '\?'; - return CHAR_VAL; - } - -'\\'' { X; - yylval.char_val = '\''; - return CHAR_VAL; - } - -'\\\"' { X; - yylval.char_val = '\"'; /* " */ - return CHAR_VAL; - } - -'\\0' { X; - yylval.char_val = '\0'; - return CHAR_VAL; - } - -'\\[0-7]+' { X; - yylval.char_val = - (char)strtol( &yytext[1], 0, 8 ); - return CHAR_VAL; - } - -'\\x[0-9a-fA-F]+' { X; - yylval.char_val = - (char)strtol( &yytext[2], 0, 16 ); - return CHAR_VAL; - } - -'\\.' { X; - yylval.char_val = ' '; - return CHAR_VAL; - } - -[0-9]+ { X; - yylval.int_val = atoi(yytext); - return INT_VAL; - } - -[0-9]+\.[0-9]* { X; - yylval.double_val = atof(yytext); - return DOUBLE_VAL; - } - -\.[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( "MOC_SKIP_BEGIN" ) ) { - skipLevel++; - if ( skipLevel == 1 ) { - lastState = YYSTATE; - BEGIN SKIP; - } - } else - if ( s.contains( "MOC_SKIP_END" ) ) { - if ( skipLevel == 0 ) { - moc_warn(" MOC_SKIP_END without MOC_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); - } - -. { addExpressionChar( yytext[0] ); } - -[ \t\r\b\f]+ { - /* spaces are important in template args, - e.g. Foo */ - addExpressionChar( yytext[0] ); } -[ \t\r\b\f]+ ; -. ; -. ; -. ; -. { addExpressionChar( yytext[0] ); } -. ; -. { addExpressionChar( yytext[0] ); } -. ; -. ; -. { - X; - return yytext[0]; - } -. { - X; - return ';'; - } -\n { - lineNo++; - } - - -%% - -#endif // MOC_YACC_CODE diff --git a/src/moc/moc.pro b/src/moc/moc.pro deleted file mode 100644 index b8ff335d7..000000000 --- a/src/moc/moc.pro +++ /dev/null @@ -1,65 +0,0 @@ -TEMPLATE = app -TARGET = tqmoc - -CONFIG = console release qtinc yacc lex_included yacc_no_name_mangle -DEFINES += QT_MOC TQT_NO_CODECS QT_LITE_UNICODE TQT_NO_COMPONENT \ - TQT_NO_STL TQT_NO_COMPRESS -win32:DEFINES += QT_NODLL -DESTDIR = ../../bin - - -INCLUDEPATH += $$QT_SOURCE_TREE/include ../tools . -DEPENDPATH += $$QT_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(QT_PRODUCT)|contains(QT_PRODUCT, qt-internal) { - LEXSOURCES = moc.l - YACCSOURCES = moc.y -} else { - SOURCES += moc_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 += MOC_MWERKS_PLUGIN - MWERKSDIR = $QT_SOURCE_TREE/util/mwerks_plugin - INCLUDEPATH += $$MWERKSDIR/Headers - LIBS += $$MWERKSDIR/Libraries/PluginLib4.shlb - SOURCES += mwerks_mac.cpp -} diff --git a/src/moc/moc.y b/src/moc/moc.y deleted file mode 100644 index 7eb667842..000000000 --- a/src/moc/moc.y +++ /dev/null @@ -1,3607 +0,0 @@ -/**************************************************************************** -** -** Parser and code generator for meta object compiler -** -** Created : 930417 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** 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 sales@trolltech.com. -** -** This file may be used under the terms of the Q 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), signals 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 MOC_YACC_CODE -void yyerror( const char *msg ); - -#include "qplatformdefs.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 MOC_MWERKS_PLUGIN -# ifdef Q_OS_MACX -# undef OLD_DEBUG -# ifdef DEBUG -# define OLD_DEBUG DEBUG -# undef DEBUG -# endif -# define DEBUG 0 -# ifndef __IMAGECAPTURE__ -# define __IMAGECAPTURE__ -# endif -# include -# endif -# include "mwerks_mac.h" -#endif - -#include -#include -#include - -#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 tqvariant_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 moc_warn( const char *msg ); -static void moc_err( const char *s ); -static void moc_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\"", tqvariant_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\"", tqvariant_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 tqvariant.cpp. If you change - one, change both. -*/ -static const int ntypes = 35; -static const char* const type_map[ntypes] = -{ - 0, - "TQMap", - "TQValueList", - "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 tqvariant_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 tqvariant_nameToType( type ) != 0; -} - -/* - Replaces '>>' with '> >' (as in 'TQValueList >'). - 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'. - */ - if ( leftType[i] == '&' || leftType[i] == '*' || - leftType[i] == '<' ) - break; - } - - name = argName; - isDefault = isDefaultArgument; - } - - TQCString leftType; - TQCString rightType; - TQCString name; - bool isDefault; -}; - -class ArgList : public TQPtrList { // 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 { // list of member functions -public: - FuncList( bool autoDelete = FALSE ) { setAutoDelete( autoDelete ); } - - FuncList find( const char* name ) - { - FuncList result; - for ( TQPtrListIterator 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 { // 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 TQ_PROPERTY construct cannot contain any commas, since - commas separate macro arguments. We therefore expect users - to type "TQMap" instead of "TQMap". For - coherence, we also expect the same for - TQValueList, the other template class supported by - TQVariant. - */ - if ( type == "TQMap" ) { - type = "TQMap"; - } else if ( type == "TQValueList" ) { - type = "TQValueList"; - } 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 { // 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 { // 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 - bool generatedCode; // no code generated - bool mocError; // moc parsing error occurred - bool hasVariantIncluded; //whether or not tqvariant.h was included yet - TQCString className; // name of parsed class - TQCString superClassName; // name of first super class - TQStrList multipleSuperClasses; // other superclasses - FuncList signals; // signal interface - FuncList slots; // slots interface - FuncList propfuncs; // all possible property access functions - FuncList funcs; // all parsed functions, including signals - 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 TQ_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 TQ_PROPERTYdetected; // TRUE if current class - // contains at least one TQ_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 tqmetaobject.h too -const int formatRevision = 26; // moc output format revision - -// if the flags change, you HAVE to change it in tqmetaobject.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(Q_OS_WIN32) -# include -# undef isatty -extern "C" int hack_isatty( int ) - { - return 0; - } -# define isatty hack_isatty -# else -# include -# endif - -# define YYDEBUG 1 -# include "moc_yacc.h" -# include "moc_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 /* value types */ -%token INT_VAL -%token DOUBLE_VAL -%token STRING -%token 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 TQ_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 class_name -%type template_class_name -%type template_spec -%type opt_base_spec - -%type base_spec -%type base_list -%type qt_macro_name -%type base_specifier -%type access_specifier -%type fct_name -%type type_name -%type simple_type_names -%type simple_type_name -%type class_key -%type complete_class_name -%type qualified_class_name -%type elaborated_type_specifier -%type whatever - -%type argument_declaration_list -%type arg_declaration_list -%type arg_declaration_list_opt -%type abstract_decl_opt -%type abstract_decl -%type argument_declaration -%type opt_exception_argument -%type cv_qualifier_list_opt -%type cv_qualifier_list -%type cv_qualifier -%type decl_specifiers -%type decl_specifier -%type decl_specs_opt -%type decl_specs -%type type_specifier -%type fct_specifier -%type declarator -%type ptr_operator -%type ptr_operators -%type ptr_operators_opt - -%type 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 signals and slots.\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 signals and slots.\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 QT_DEF; } - ; - - -/***** r.17.5 (ARM p.395): Class Declarations *****/ - -class_specifier: full_class_head - '{' { BEGIN IN_CLASS; - classPLevel = 1; - } - opt_obj_member_list - '}' { BEGIN QT_DEF; } /*catch ';'*/ - | class_head { BEGIN QT_DEF; /* -- " -- */ - skipClass = TRUE; } - | class_head '*' IDENTIFIER { BEGIN QT_DEF; /* -- " -- */ - skipClass = TRUE; } - | class_head '&' IDENTIFIER { BEGIN QT_DEF; /* -- " -- */ - skipClass = TRUE; } - | class_head - '(' IDENTIFIER ')' /* TQt macro name */ - { BEGIN QT_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; - if ( g->className == "TQObject" ) - TQ_OBJECTdetected = TRUE; - } - | class_key - IDENTIFIER /* possible DLL EXPORT macro */ - class_name { g->className = $3; - 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 { moc_err( "Missing access specifier" - " before \"slots:\"." ); } - ; - -obj_member_area: qt_access_specifier { BEGIN QT_DEF; } - slot_area - | SIGNALS { BEGIN QT_DEF; } - ':' opt_signal_declarations - | TQ_OBJECT { - if ( tmpAccess ) - moc_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; - } - | TQ_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 ')' { - TQ_PROPERTYdetected = TRUE; - BEGIN tmpYYStart; - } - opt_property_candidates - | TQ_SETS { tmpYYStart = YY_START; BEGIN IN_PROPERTY; } - '(' qt_sets ')' { - TQ_PROPERTYdetected = TRUE; - BEGIN tmpYYStart; - } - opt_property_candidates - ; - -slot_area: SIGNALS ':' { moc_err( "Signals cannot " - "have access specifiers" ); } - | SLOTS ':' opt_slot_declarations - | ':' { if ( tmpAccess == Public && TQ_PROPERTYdetected ) - BEGIN QT_DEF; - else - BEGIN IN_CLASS; - suppress_func_warn = TRUE; - } - opt_property_candidates - { - suppress_func_warn = FALSE; - } - | IDENTIFIER { BEGIN IN_CLASS; - if ( classPLevel != 1 ) - moc_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" - " signals or slots."); - } - | opt_virtual '~' fct_name - { tmpFunc->type = "void"; - tmpFunc->name = "~"; - tmpFunc->name += $3; - func_warn( "Destructors cannot be" - " signals or slots."); - } - | 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++; - moc_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 QT_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 QT_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 ) - moc_err( "A property must at least feature a read method." ); - checkPropertyName( $2 ); - TQ_PROPERTYdetected = TRUE; - // Avoid duplicates - for( TQPtrListIterator lit( g->props ); lit.current(); ++lit ) { - if ( lit.current()->name == $2 ) { - if ( displayWarnings ) - moc_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(Q_OS_WIN32) -# include -# undef isatty -extern "C" int hack_isatty( int ) -{ - return 0; -} -# define isatty hack_isatty -# else -# include -# endif -# include "moc_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 - generatedCode = FALSE; // no code generated - mocError = FALSE; // moc parsing error occurred - hasVariantIncluded = FALSE; -} - - -parser_reg::~parser_reg() -{ - slots.clear(); - signals.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 Q_CC_MSVC -#define ErrorFormatString "%s(%d):" -#else -#define ErrorFormatString "%s:%d:" -#endif - -#ifndef MOC_MWERKS_PLUGIN -int main( int argc, char **argv ) -{ - init(); - - bool autoInclude = TRUE; - const char *error = 0; - g->qtPath = ""; - for ( int n=1; noutputFile = argv[++n]; - } else - g->outputFile = &opt[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[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[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[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, "moc: %s\n", error ); - fprintf( stderr, "Usage: moc [options] \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 moc\n" ); - cleanup(); - return 1; - } else { - yyin = fopen( (const char *)g->fileName, "r" ); - if ( !yyin ) { - fprintf( stderr, "moc: %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, "moc: 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->mocError ) { - fprintf( stderr, ErrorFormatString" Warning: %s\n", g->fileName.data(), 0, - "No relevant classes found. No output generated." ); - } - - int ret = g->mocError ? 1 : 0; - cleanup(); - return ret; -} -#else -bool tqt_is_gui_used = FALSE; -#include -#include -#include -#ifdef Q_OS_MAC9 -# include -# include -# include -# include "Aliases.h" -#endif -#include "CWPluginErrors.h" -#include -#include "DropInCompilerLinker.h" -#include - -const unsigned char *p_str(const char *, int =-1); - -CWPluginContext g_ctx; - -moc_status do_moc( 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 moc_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 moc_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 moc_no_source; - } - if(stat(outpath, &ostat) == 0 && istat.st_mtime < ostat.st_mtime) { - cleanup(); - return moc_not_time; - } - - unlink(outpath.data()); - out = fopen(outpath.data(), "w+"); - if(!out) { - cleanup(); - return moc_general_error; - } - - yyparse(); - if(out != stdout) - fclose(out); - - if(g->mocError || !g->generatedCode) { - unlink(outpath.data()); - moc_status ret = !g->generatedCode ? moc_no_qobject : moc_parse_error; - cleanup(); - return ret; - } - - cleanup(); - return moc_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 MOC_MWERKS_PLUGIN - buf_buffer = NULL; - buf_index = 0; - buf_size_total = 0; -#endif -} - -void cleanup() -{ - delete g; - g = NULL; - -#ifdef MOC_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; - TQ_PROPERTYdetected = FALSE; - skipClass = FALSE; - templateClass = FALSE; - g->slots.clear(); - g->signals.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 definedClasses; // Classes defined in the namespace -}; - -TQPtrList 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 nameQualifier() -{ - TQPtrListIterator 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 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 TQ_SIGNAL and TQ_SLOT names. -// This function has been copied from tqobject.cpp. -// - -inline bool isSpace( char x ) -{ -#if defined(Q_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->mocError = TRUE; -#ifndef MOC_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 moc_err( const char *s ) -{ - yyerror( s ); -} - -void moc_err( const char *s1, const char *s2 ) -{ - static char tmp[1024]; - sprintf( tmp, s1, s2 ); - yyerror( tmp ); -} - -void moc_warn( const char *msg ) -{ - if ( displayWarnings ) - fprintf( stderr, ErrorFormatString" Warning: %s\n", g->fileName.data(), lineNo, msg); -} - -void moc_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 ) - moc_warn( msg ); - skipFunc = TRUE; -} - -void operatorError() -{ - if ( !suppress_func_warn ) - moc_warn("Operator functions cannot be signals or slots."); - 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::tqt_invoke() rather than A::B::tqt_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) - 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 qualifiedClassName() -{ - return nameQualifier() + g->className; -} - -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_QUType_%s, %s, TQUParameter::Out }", uType(f->type).data(), uTypeExtra(f->type).data() ); - else - fprintf( out, "\t{ 0, &static_QUType_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_QUType_%s, %s, TQUParameter::%s }", - uType( type ).data(), uTypeExtra( type ).data(), - isInOut( type ) ? "InOut" : "In" ); - else - fprintf( out, "\t{ \"%s\", &static_QUType_%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 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 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 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 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 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 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 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 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 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 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 ) - moc_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 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 |= tqvariant_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 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 ) - moc_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 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 by: The TQt Meta Object Compiler version %d (TQt %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->signals.count() == 0 && g->slots.count() == 0 && g->props.count() == 0 && g->infos.count() == 0 ) - return; - if ( displayWarnings && (g->signals.count() + g->slots.count()) != 0 ) - moc_err("The declaration of the class \"%s\" contains signals " - "or slots\n\t but no TQ_OBJECT macro.", g->className.data()); - } else { - if ( g->superClassName.isEmpty() ) - moc_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 - moc_err( "Sorry, TQt does not support templates that contain\n" - "\tsignals, slots or TQ_OBJECT." ); - return; - } - g->generatedCode = TRUE; - g->gen_count++; - - if ( g->gen_count == 1 ) { // first class to be generated - 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[i]; - fprintf( out, hdr1, (const char*)qualifiedClassName(),(const char*)fn); - fprintf( out, hdr2, formatRevision, TQT_VERSION_STR ); - fprintf( out, "%s", hdr3 ); - fprintf( out, "%s", hdr4 ); - - if ( !g->noInclude ) { - /* - The header file might be a TQt header file with - TQT_NO_COMPAT macros around signals, slots 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 <%sntqapplication.h>\n\n", (const char*)g->qtPath ); - fprintf( out, "#include <%sprivate/tqucomextra_p.h>\n", (const char*)g->qtPath ); - fprintf( out, "#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != %d)\n", formatRevision ); - fprintf( out, "#error \"This file was generated using the moc from %s." - " It\"\n#error \"cannot be used with the include files from" - " this version of TQt.\"\n#error \"(The moc 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->slots.first(); f && !needToIncludeVariant; f=g->slots.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::fromLatin1( 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}\n" ); - fprintf( out, "#ifdef TQT_THREAD_SUPPORT\n if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->lock();\n" ); - fprintf( out, " if ( metaObj ) {\n\tif (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();\n\treturn metaObj;\n }\n#endif // TQT_THREAD_SUPPORT\n" ); - if ( isTQObject ) - fprintf( out, " TQMetaObject* parentObject = staticTQtMetaObject();\n" ); - else if ( !g->superClassName.isEmpty() ) - fprintf( out, " TQMetaObject* parentObject = %s::staticMetaObject();\n", (const char*)g->superClassName ); - 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 slots -// - int n_enums = generateEnums(); - -// -// Build slots array in staticMetaObject() -// - generateFuncs( &g->slots, "slot", Slot_Num ); - -// -// Build signals array in staticMetaObject() -// - generateFuncs( &g->signals, "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->slots.count() ) - fprintf( out, "\tslot_tbl, %d,\n", g->slots.count() ); - else - fprintf( out, "\t0, 0,\n" ); - - if ( g->signals.count() ) - fprintf( out, "\tsignal_tbl, %d,\n", g->signals.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, "#ifdef TQT_THREAD_SUPPORT\n if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();\n#endif // TQT_THREAD_SUPPORT\n" ); - fprintf( out, " return metaObj;\n}\n" ); - -// -// End of function staticMetaObject() -// - -// -// Generate smart cast function -// - fprintf( out, "\nvoid* %s::tqt_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 %s::tqt_cast( clname );\n", - (const char*)purestSuperClassName() ); - else - fprintf( out, " return 0;\n" ); - fprintf( out, "}\n" ); - -// -// Generate internal signal functions -// - Function *f; - f = g->signals.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// TQ_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( staticMetaObject()->signalOffset() + %d", 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 ( signalsBlocked() )\n\treturn%s;\n", hasReturnValue ? " something" : "" ); - fprintf( out, " TQConnectionList *clist = receivers( 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_QUType_%s.set(o,something);\n", utype.data() ); - } else if ( uType( f->type ) == "varptr" ) { - fprintf( out, " static_QUType_varptr.set(o,&something);\n" ); - } else { - fprintf( out, " static_QUType_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_QUType_%s.set(o+%d,t%d);\n", utype.data(), offset+1, offset ); - } else if ( uType( type ) == "varptr" ) { - fprintf( out, " static_QUType_varptr.set(o+%d,&t%d);\n", offset+1, offset ); - } else { - fprintf( out, " static_QUType_ptr.set(o+%d,&t%d);\n", offset+1, offset ); - } - a = f->args->next(); - offset++; - } - } - fprintf( out, " o[%d].isLastObject = true;\n", f->args->count() + 0 ); - 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_QUType_%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_QUType_ptr.get(o+%d);\n", offset, offset, type.data(), offset+1 ); - else - fprintf( out, " t%d = static_QUType_%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_QUType_%s.get(o);\n", f->type.data(), utype.data() ); - else - fprintf( out, " return static_QUType_%s.get(o);\n", utype.data() ); - } - - fprintf( out, "}\n" ); - } - - f = g->signals.next(); - sigindex++; - } - - -// -// Generate internal tqt_invoke() function -// - fprintf( out, "\nbool %s::tqt_invoke( int _id, TQUObject* _o )\n{\n", qualifiedClassName().data() ); - - if( !g->slots.isEmpty() ) { - fprintf( out, " switch ( _id - staticMetaObject()->slotOffset() ) {\n" ); - int slotindex = -1; - for ( f = g->slots.first(); f; f = g->slots.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_QUType_%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_QUType_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_QUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); - else - fprintf( out, "(%s)static_QUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); - } else { - TQCString castType = castToUType( type ); - if(castType == type) - fprintf( out, "(%s)(*((%s*)static_QUType_ptr.get(_o+%d)))", type.data(), - castType.data(), offset+1 ); - else - fprintf( out, "(%s)*((%s*)static_QUType_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 %s::tqt_invoke( _id, _o );\n", - (const char *) purestSuperClassName() ); - } else { - fprintf( out, "\treturn FALSE;\n" ); - } - fprintf( out, " }\n" ); - fprintf( out, " return TRUE;\n}\n" ); - } else { - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, " return %s::tqt_invoke(_id,_o);\n}\n", - (const char *) purestSuperClassName() ); - else - fprintf( out, " return FALSE;\n}\n" ); - } - - -// -// Generate internal tqt_emit() function -// - fprintf( out, "\nbool %s::tqt_emit( int _id, TQUObject* _o )\n{\n", qualifiedClassName().data() ); - - if ( !g->signals.isEmpty() ) { - fprintf( out, " switch ( _id - staticMetaObject()->signalOffset() ) {\n" ); - int signalindex = -1; - for ( f = g->signals.first(); f; f = g->signals.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_QUType_%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_QUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); - else - fprintf( out, "(%s)static_QUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); - } else { - TQCString castType = castToUType( type ); - if(castType == type) - fprintf( out, "(%s)(*((%s*)static_QUType_ptr.get(_o+%d)))", type.data(), - castType.data(), offset+1 ); - else - fprintf( out, "(%s)*((%s*)static_QUType_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 %s::tqt_emit(_id,_o);\n", - (const char *) purestSuperClassName() ); - else - fprintf( out, "\treturn FALSE;\n" ); - fprintf( out, " }\n" ); - fprintf( out, " return TRUE;\n}\n" ); - } else { - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, " return %s::tqt_emit(_id,_o);\n}\n", - (const char *) purestSuperClassName() ); - else - fprintf( out, " return FALSE;\n}\n" ); - } - - - fprintf( out, "#ifndef TQT_NO_PROPERTIES\n" ); -// -// Generate internal tqt_property() functions -// - - fprintf( out, "\nbool %s::tqt_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 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" ) - fprintf( out, "v->asMap()" ); - else if ( type == "TQValueList" ) - 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() ); break;\n", - it.current()->getfunc->name.data(), - !isVariantType( it.current()->type ) ? "(int)" : "", - it.current()->getfunc->name.data()); - else - fprintf( out, "\tcase 1: *v = TQVariant( %sthis->%s() ); break;\n", - !isVariantType( it.current()->type ) ? "(int)" : "", - it.current()->getfunc->name.data()); - } 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 %s::tqt_property( id, f, v );\n", - (const char *) purestSuperClassName() ); - else - fprintf( out, "\treturn FALSE;\n" ); - fprintf( out, " }\n" ); - fprintf( out, " return TRUE;\n" ); - - if ( need_resolve ) - fprintf( out, "resolve:\n return %s::tqt_property( staticMetaObject()->resolveProperty(id), f, v );\n", - (const char *) purestSuperClassName() ); - fprintf( out, "}\n" ); - } else { - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, " return %s::tqt_property( id, f, v);\n}\n", - (const char *) purestSuperClassName() ); - else - fprintf( out, " return FALSE;\n}\n" ); - } - - fprintf( out, "\nbool %s::tqt_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 lit( g->enums ); lit.current(); ++lit ) { - if ( lit.current()->name == tmpEnum->name ) - { - if ( displayWarnings ) - moc_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->signals.append( tmpFunc ); - break; - } else { - if ( m == SlotMember ) - g->slots.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] == '_' ) { - moc_err( "Invalid property name '%s'.", ident ); - return; - } -} diff --git a/src/moc/moc_lex.cpp b/src/moc/moc_lex.cpp deleted file mode 100644 index 0fcd62c21..000000000 --- a/src/moc/moc_lex.cpp +++ /dev/null @@ -1,3315 +0,0 @@ - -#line 3 "lex.yy.c" - -#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 -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . 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 -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[617] = - { 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, 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, 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, - 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, 7, 99, 99, 99, 96, 99, 86, - 99, 97, 99, 99, 106, 106, 106, 106, 106, 106, - 106, 106, 106, 106, 21, 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, 99, 78, 67, 85, 99, - - 99, 99, 99, 99, 106, 106, 106, 106, 106, 106, - 106, 106, 17, 106, 107, 107, 100, 100, 38, 134, - 105, 105, 99, 99, 99, 99, 99, 12, 99, 95, - 99, 99, 88, 99, 99, 6, 99, 64, 99, 71, - 99, 106, 106, 106, 106, 106, 27, 19, 106, 20, - 107, 107, 100, 100, 134, 134, 105, 4, 99, 11, - 99, 99, 99, 99, 99, 91, 99, 66, 94, 79, - 73, 106, 26, 106, 106, 106, 106, 107, 31, 100, - 100, 133, 2, 99, 5, 99, 99, 99, 98, 89, - 106, 23, 106, 106, 18, 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, 28, 62, 63, 64, 65, 66, 67, 68, - 69, 28, 70, 1, 71, 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[72] = - { 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, 1, - 1 - } ; - -static yyconst flex_int16_t yy_base[644] = - { 0, - 0, 3, 16, 5, 87, 9, 158, 229, 300, 176, - 370, 440, 181, 510, 249, 555, 207, 211, 600, 645, - 252, 281, 267, 383, 691, 185, 389, 402, 1191, 1192, - 178, 1192, 183, 220, 1139, 1192, 184, 372, 185, 0, - 1132, 1140, 1135, 1123, 416, 1134, 1192, 198, 1139, 243, - 409, 195, 414, 1166, 0, 1146, 1134, 196, 376, 1120, - 204, 229, 1120, 1118, 1112, 1128, 1114, 214, 1122, 383, - 400, 317, 339, 454, 1122, 1192, 204, 422, 399, 0, - 1136, 370, 240, 1192, 1192, 459, 1120, 1192, 461, 429, - 458, 0, 1113, 1121, 1116, 1104, 1192, 1192, 470, 1115, - - 1192, 475, 1192, 1192, 1192, 469, 1192, 1192, 1192, 1192, - 485, 1114, 1192, 478, 1192, 1192, 1192, 479, 1192, 1192, - 1192, 491, 1113, 1192, 493, 1192, 1192, 1192, 488, 1192, - 1192, 1192, 497, 1112, 1192, 502, 1117, 496, 1192, 1192, - 523, 1110, 1192, 505, 1115, 1192, 1192, 507, 528, 1108, - 1192, 530, 514, 533, 1107, 1192, 535, 530, 539, 1106, - 1192, 1192, 0, 1131, 1130, 427, 1117, 1108, 1192, 1192, - 1192, 544, 1192, 0, 546, 0, 0, 1100, 440, 1192, - 1147, 0, 1102, 1091, 1090, 1091, 1101, 546, 1138, 1137, - 758, 1131, 555, 560, 565, 1192, 0, 1095, 1085, 1082, - - 1075, 1090, 1089, 1077, 1070, 1069, 1069, 1072, 1075, 318, - 1071, 1065, 1070, 1075, 522, 1077, 1071, 1064, 1069, 1062, - 505, 1063, 1058, 1058, 427, 1062, 1055, 527, 465, 1192, - 1112, 0, 1068, 529, 1065, 1059, 1052, 470, 1192, 1107, - 0, 1062, 1051, 1050, 1051, 1061, 582, 588, 1060, 588, - 592, 0, 1066, 363, 1066, 1068, 1072, 1055, 592, 0, - 1046, 1035, 1045, 1035, 1036, 1192, 1087, 1086, 1085, 600, - 603, 1084, 1083, 1082, 1081, 1080, 1079, 1078, 1077, 1076, - 1192, 607, 601, 1023, 0, 1021, 1018, 1016, 1015, 1028, - 1018, 1023, 1026, 1021, 1016, 0, 1017, 1022, 1017, 1006, - - 1001, 1002, 1008, 1008, 1001, 1003, 997, 996, 994, 997, - 997, 1004, 995, 998, 994, 988, 1000, 1002, 607, 983, - 984, 990, 987, 981, 981, 991, 981, 982, 1011, 1015, - 1013, 1008, 999, 996, 978, 970, 969, 974, 976, 1192, - 1192, 1192, 1192, 645, 1192, 1192, 1192, 1192, 1192, 1192, - 1192, 1192, 1192, 1022, 997, 994, 584, 989, 1000, 967, - 0, 0, 960, 958, 964, 0, 958, 955, 959, 958, - 0, 967, 952, 966, 965, 960, 955, 947, 945, 564, - 945, 951, 956, 948, 937, 952, 943, 947, 946, 934, - 0, 934, 966, 963, 615, 958, 969, 945, 940, 935, - - 942, 926, 925, 924, 929, 931, 957, 0, 944, 947, - 956, 955, 920, 0, 917, 929, 0, 1192, 1192, 955, - 935, 944, 948, 938, 932, 914, 0, 0, 917, 909, - 0, 916, 914, 908, 899, 888, 882, 891, 890, 869, - 0, 875, 876, 0, 876, 854, 862, 0, 850, 0, - 838, 0, 848, 832, 861, 785, 793, 796, 785, 779, - 752, 765, 764, 756, 0, 0, 751, 762, 0, 776, - 0, 769, 781, 0, 752, 754, 737, 762, 767, 773, - 760, 761, 757, 735, 0, 0, 0, 0, 741, 744, - 731, 738, 725, 0, 736, 724, 0, 0, 0, 722, - - 732, 732, 726, 725, 743, 748, 754, 741, 742, 738, - 723, 710, 0, 708, 722, 705, 747, 746, 0, 721, - 714, 638, 650, 649, 663, 648, 659, 0, 631, 0, - 632, 619, 0, 628, 617, 0, 626, 0, 626, 0, - 624, 637, 636, 650, 635, 646, 0, 0, 618, 0, - 619, 616, 645, 644, 618, 584, 610, 0, 632, 0, - 618, 626, 606, 593, 586, 0, 583, 0, 0, 0, - 0, 604, 0, 592, 599, 590, 560, 548, 0, 541, - 534, 1192, 0, 529, 0, 536, 516, 497, 0, 0, - 489, 0, 478, 420, 0, 0, 429, 412, 394, 378, - - 347, 0, 272, 264, 223, 0, 0, 230, 0, 0, - 184, 0, 0, 0, 0, 1192, 826, 832, 838, 844, - 850, 856, 862, 868, 874, 880, 886, 888, 894, 900, - 902, 908, 910, 916, 918, 924, 930, 932, 938, 944, - 950, 953, 958 - } ; - -static yyconst flex_int16_t yy_def[644] = - { 0, - 617, 617, 616, 3, 616, 5, 618, 618, 616, 9, - 619, 619, 620, 620, 621, 621, 622, 622, 623, 623, - 624, 624, 625, 625, 616, 25, 617, 617, 616, 616, - 616, 616, 616, 616, 626, 616, 616, 627, 616, 628, - 628, 628, 628, 628, 616, 626, 616, 616, 629, 630, - 616, 616, 616, 616, 631, 631, 631, 631, 631, 631, - 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, - 631, 631, 631, 616, 626, 616, 616, 632, 616, 633, - 633, 633, 633, 616, 616, 616, 626, 616, 616, 634, - 616, 635, 635, 635, 635, 635, 616, 616, 616, 626, - - 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 626, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 626, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 616, 626, 616, 616, 636, 616, 616, 616, - 616, 626, 616, 616, 637, 616, 616, 616, 616, 626, - 616, 616, 616, 616, 626, 616, 616, 616, 616, 626, - 616, 616, 638, 638, 638, 638, 638, 639, 616, 616, - 616, 616, 616, 640, 616, 626, 626, 626, 627, 616, - 627, 628, 628, 628, 628, 628, 629, 629, 616, 616, - 641, 616, 616, 616, 616, 616, 631, 631, 631, 631, - - 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, - 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, - 631, 631, 631, 631, 631, 631, 631, 631, 632, 616, - 632, 633, 633, 633, 633, 633, 633, 634, 616, 634, - 635, 635, 635, 635, 635, 636, 636, 616, 637, 637, - 616, 638, 638, 638, 638, 638, 638, 639, 639, 640, - 626, 628, 628, 628, 628, 616, 616, 616, 616, 616, - 616, 616, 616, 616, 616, 616, 616, 616, 616, 642, - 616, 616, 631, 631, 631, 631, 631, 631, 631, 631, - 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, - - 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, - 631, 631, 631, 631, 631, 631, 631, 631, 633, 633, - 633, 633, 633, 633, 635, 635, 635, 635, 638, 638, - 638, 638, 638, 638, 626, 628, 628, 628, 628, 616, - 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 616, 642, 631, 631, 631, 631, 631, 631, - 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, - 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, - 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, - 631, 631, 633, 633, 633, 633, 633, 633, 633, 633, - - 633, 633, 635, 635, 635, 635, 638, 638, 638, 638, - 638, 638, 626, 628, 628, 628, 628, 616, 616, 631, - 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, - 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, - 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, - 631, 631, 631, 631, 633, 633, 633, 633, 633, 633, - 633, 633, 633, 633, 633, 635, 635, 635, 635, 638, - 638, 638, 638, 638, 626, 628, 628, 631, 631, 631, - 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, - 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, - - 631, 631, 631, 631, 633, 633, 633, 633, 633, 633, - 633, 633, 633, 633, 635, 635, 638, 638, 638, 643, - 628, 628, 631, 631, 631, 631, 631, 631, 631, 631, - 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, - 631, 633, 633, 633, 633, 633, 633, 633, 633, 633, - 635, 635, 638, 638, 643, 643, 628, 628, 631, 631, - 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, - 631, 633, 633, 633, 633, 633, 633, 635, 635, 638, - 638, 616, 628, 631, 631, 631, 631, 631, 631, 631, - 633, 633, 633, 633, 633, 635, 638, 638, 631, 631, - - 631, 631, 633, 633, 633, 638, 638, 631, 631, 631, - 633, 633, 633, 631, 633, 0, 616, 616, 616, 616, - 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 616 - } ; - -static yyconst flex_int16_t yy_nxt[1264] = - { 0, - 616, 31, 31, 32, 31, 34, 32, 45, 35, 616, - 46, 74, 33, 616, 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, 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, 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, 615, 82, 138, - 83, 172, 175, 138, 120, 176, 121, 84, 85, 76, - 77, 86, 32, 78, 87, 76, 76, 76, 76, 76, - 76, 79, 76, 76, 76, 76, 76, 76, 76, 190, - 125, 125, 32, 152, 152, 32, 126, 127, 200, 128, - 201, 129, 206, 614, 153, 613, 130, 81, 157, 157, - 32, 207, 76, 76, 76, 215, 139, 140, 216, 158, - 139, 140, 152, 154, 32, 208, 155, 191, 612, 82, - 209, 83, 131, 153, 132, 236, 237, 611, 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, 95, 96, 92, 92, 92, 92, 97, - 98, 102, 102, 32, 295, 225, 180, 103, 104, 226, - 105, 296, 106, 330, 157, 159, 32, 107, 160, 610, - 31, 31, 32, 168, 227, 158, 169, 170, 228, 171, - - 331, 33, 609, 31, 34, 32, 168, 35, 173, 169, - 170, 174, 171, 108, 33, 109, 181, 172, 175, 608, - 192, 176, 193, 193, 193, 194, 230, 195, 195, 195, - 202, 234, 203, 239, 235, 204, 607, 218, 219, 220, - 110, 102, 111, 32, 180, 112, 221, 103, 104, 255, - 105, 222, 106, 606, 223, 172, 175, 107, 605, 176, - 172, 175, 172, 172, 176, 256, 231, 173, 224, 230, - 174, 172, 175, 240, 239, 176, 172, 172, 173, 172, - 172, 174, 313, 108, 181, 109, 172, 175, 173, 314, - 176, 174, 172, 175, 172, 172, 176, 173, 172, 175, - - 174, 604, 176, 172, 172, 173, 248, 248, 174, 231, - 110, 114, 122, 32, 240, 123, 173, 115, 116, 174, - 117, 603, 118, 173, 172, 175, 174, 119, 176, 248, - 251, 172, 172, 176, 172, 175, 172, 172, 176, 173, - 172, 175, 174, 602, 176, 172, 172, 172, 175, 187, - 187, 176, 308, 120, 601, 121, 125, 133, 32, 600, - 134, 599, 126, 127, 598, 128, 309, 129, 193, 193, - 193, 597, 130, 282, 282, 282, 194, 301, 195, 195, - 195, 302, 317, 318, 320, 246, 246, 582, 321, 248, - 248, 249, 249, 248, 251, 258, 258, 176, 131, 596, - - 132, 144, 144, 32, 145, 422, 343, 146, 147, 345, - 595, 442, 148, 344, 344, 443, 344, 344, 146, 147, - 282, 282, 282, 355, 423, 356, 594, 593, 556, 393, - 592, 394, 591, 590, 357, 358, 457, 589, 359, 588, - 395, 396, 587, 146, 397, 147, 144, 149, 32, 145, - 150, 418, 146, 147, 586, 458, 585, 148, 344, 344, - 584, 583, 556, 146, 147, 581, 580, 579, 578, 577, - 576, 575, 574, 573, 572, 571, 570, 569, 568, 567, - 566, 565, 564, 563, 562, 561, 560, 559, 146, 558, - 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, - 30, 30, 268, 557, 269, 556, 554, 553, 552, 551, - 550, 270, 271, 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, 523, - - 522, 521, 272, 520, 519, 273, 274, 518, 517, 516, - 275, 515, 514, 513, 512, 511, 276, 510, 509, 277, - 508, 278, 507, 279, 506, 280, 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, 505, 177, 177, 177, 177, 179, 504, 179, 179, - 179, 179, 182, 182, 187, 503, 502, 187, 187, 187, - - 189, 501, 189, 189, 189, 189, 197, 197, 229, 500, - 229, 229, 229, 229, 232, 232, 238, 499, 238, 238, - 238, 238, 241, 241, 246, 498, 497, 246, 246, 246, - 249, 496, 495, 249, 249, 249, 252, 252, 258, 494, - 493, 258, 258, 258, 260, 492, 260, 260, 260, 260, - 267, 491, 267, 267, 267, 267, 354, 354, 555, 490, - 555, 555, 555, 555, 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, 456, 455, 454, 453, 452, - - 451, 450, 449, 448, 447, 446, 445, 444, 441, 440, - 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, - 429, 428, 427, 426, 425, 424, 421, 420, 419, 417, - 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, - 406, 405, 404, 403, 402, 401, 400, 399, 398, 392, - 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, - 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, - 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, - 361, 360, 340, 353, 352, 351, 350, 349, 348, 347, - 346, 342, 341, 340, 339, 338, 337, 336, 335, 259, - - 334, 333, 332, 329, 250, 247, 328, 327, 326, 325, - 238, 324, 323, 322, 319, 229, 316, 315, 312, 311, - 310, 307, 306, 305, 304, 303, 300, 299, 298, 297, - 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, - 284, 283, 281, 266, 266, 188, 265, 264, 263, 262, - 179, 261, 259, 257, 254, 253, 178, 178, 178, 250, - 178, 247, 178, 178, 178, 178, 245, 244, 243, 242, - 178, 233, 178, 217, 214, 213, 212, 211, 210, 205, - 199, 198, 196, 188, 178, 186, 185, 184, 183, 178, - 616, 29, 616, 616, 616, 616, 616, 616, 616, 616, - - 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 616 - } ; - -static yyconst flex_int16_t yy_chk[1264] = - { 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, 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, 611, 7, 17, - 7, 34, 34, 18, 13, 34, 13, 7, 7, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 50, - 15, 15, 15, 21, 21, 21, 15, 15, 58, 15, - 58, 15, 61, 608, 21, 605, 15, 8, 23, 23, - 23, 61, 8, 8, 8, 68, 17, 17, 68, 23, - 18, 18, 22, 22, 22, 62, 22, 50, 604, 8, - 62, 8, 15, 22, 15, 83, 83, 603, 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, 11, 11, 11, 210, 72, 38, 11, 11, 72, - 11, 210, 11, 254, 24, 24, 24, 11, 24, 601, - 27, 27, 27, 27, 73, 24, 27, 27, 73, 27, - - 254, 27, 600, 28, 28, 28, 28, 28, 79, 28, - 28, 79, 28, 11, 28, 11, 38, 45, 45, 599, - 51, 45, 51, 51, 51, 53, 78, 53, 53, 53, - 59, 82, 59, 90, 82, 59, 598, 70, 70, 70, - 11, 12, 12, 12, 179, 12, 70, 12, 12, 166, - 12, 71, 12, 597, 71, 74, 74, 12, 594, 74, - 86, 86, 89, 89, 86, 166, 78, 91, 71, 229, - 91, 99, 99, 90, 238, 99, 102, 102, 106, 114, - 114, 106, 225, 12, 179, 12, 111, 111, 118, 225, - 111, 118, 122, 122, 125, 125, 122, 129, 133, 133, - - 129, 593, 133, 136, 136, 138, 144, 144, 138, 229, - 12, 14, 14, 14, 238, 14, 148, 14, 14, 148, - 14, 591, 14, 153, 141, 141, 153, 14, 141, 149, - 149, 152, 152, 149, 154, 154, 157, 157, 154, 158, - 159, 159, 158, 588, 159, 172, 172, 175, 175, 188, - 188, 175, 221, 14, 587, 14, 16, 16, 16, 586, - 16, 584, 16, 16, 581, 16, 221, 16, 193, 193, - 193, 580, 16, 194, 194, 194, 195, 215, 195, 195, - 195, 215, 228, 228, 234, 247, 247, 556, 234, 248, - 248, 250, 250, 251, 251, 259, 259, 251, 16, 578, - - 16, 19, 19, 19, 19, 357, 270, 19, 19, 271, - 577, 380, 19, 270, 270, 380, 271, 271, 19, 19, - 282, 282, 282, 283, 357, 283, 576, 575, 556, 319, - 574, 319, 572, 567, 283, 283, 395, 565, 283, 564, - 319, 319, 563, 19, 319, 19, 20, 20, 20, 20, - 20, 344, 20, 20, 562, 395, 561, 20, 344, 344, - 559, 557, 555, 20, 20, 554, 553, 552, 551, 549, - 546, 545, 544, 543, 542, 541, 539, 537, 535, 534, - 532, 531, 529, 527, 526, 525, 524, 523, 20, 522, - 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, 191, 521, 191, 520, 518, 517, 516, 515, - 514, 191, 191, 512, 511, 510, 509, 508, 507, 506, - 505, 504, 503, 502, 501, 500, 496, 495, 493, 492, - 491, 490, 489, 484, 483, 482, 481, 480, 479, 478, - - 477, 476, 191, 475, 473, 191, 191, 472, 470, 468, - 191, 467, 464, 463, 462, 461, 191, 460, 459, 191, - 458, 191, 457, 191, 456, 191, 617, 617, 617, 617, - 617, 617, 618, 618, 618, 618, 618, 618, 619, 619, - 619, 619, 619, 619, 620, 620, 620, 620, 620, 620, - 621, 621, 621, 621, 621, 621, 622, 622, 622, 622, - 622, 622, 623, 623, 623, 623, 623, 623, 624, 624, - 624, 624, 624, 624, 625, 625, 625, 625, 625, 625, - 626, 455, 626, 626, 626, 626, 627, 454, 627, 627, - 627, 627, 628, 628, 629, 453, 451, 629, 629, 629, - - 630, 449, 630, 630, 630, 630, 631, 631, 632, 447, - 632, 632, 632, 632, 633, 633, 634, 446, 634, 634, - 634, 634, 635, 635, 636, 445, 443, 636, 636, 636, - 637, 442, 440, 637, 637, 637, 638, 638, 639, 439, - 438, 639, 639, 639, 640, 437, 640, 640, 640, 640, - 641, 436, 641, 641, 641, 641, 642, 642, 643, 435, - 643, 643, 643, 643, 434, 433, 432, 430, 429, 426, - 425, 424, 423, 422, 421, 420, 416, 415, 413, 412, - 411, 410, 409, 407, 406, 405, 404, 403, 402, 401, - 400, 399, 398, 397, 396, 394, 393, 392, 390, 389, - - 388, 387, 386, 385, 384, 383, 382, 381, 379, 378, - 377, 376, 375, 374, 373, 372, 370, 369, 368, 367, - 365, 364, 363, 360, 359, 358, 356, 355, 354, 339, - 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, - 328, 327, 326, 325, 324, 323, 322, 321, 320, 318, - 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, - 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, - 297, 295, 294, 293, 292, 291, 290, 289, 288, 287, - 286, 284, 280, 279, 278, 277, 276, 275, 274, 273, - 272, 269, 268, 267, 265, 264, 263, 262, 261, 258, - - 257, 256, 255, 253, 249, 246, 245, 244, 243, 242, - 240, 237, 236, 235, 233, 231, 227, 226, 224, 223, - 222, 220, 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, 81, 75, 69, 67, 66, 65, 64, 63, 60, - 57, 56, 54, 49, 46, 44, 43, 42, 41, 35, - 29, 616, 616, 616, 616, 616, 616, 616, 616, 616, - - 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, - 616, 616, 616 - } ; - -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 "moc.l" -/**************************************************************************** -** -** Lexical analyzer for meta object compiler -** -** Created : 930417 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** 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 sales@trolltech.com. -** -** This file may be used under the terms of the Q 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 "moc.l" -#ifdef MOC_YACC_CODE - -#ifdef MOC_MWERKS_PLUGIN -#ifdef Q_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 -#include - -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 - MOC_SKIP_BEGIN is encountered */ -int skipLevel = 0; /* Depth of MOC_SKIP_BEGINs */ - -class TQString; - -extern void addExpressionChar( const char ); -extern void addExpressionString( const char * ); -extern void moc_warn( const char *msg ); - -#line 1053 "lex.yy.c" - -#define INITIAL 0 -#define OUTSIDE 1 -#define QT_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 -#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 -{ - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; - -#line 113 "moc.l" - - -#line 1259 "lex.yy.c" - - 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 - { - 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 >= 617 ) - 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] != 1192 ); - -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 "moc.l" -{ X; - BEGIN QT_DEF; - return CLASS; } - YY_BREAK -case 2: -YY_RULE_SETUP -#line 118 "moc.l" -{ X; - BEGIN QT_DEF; - return NAMESPACE; } - YY_BREAK -case 3: -YY_RULE_SETUP -#line 121 "moc.l" -{ X; - BEGIN QT_DEF; - return USING; } - YY_BREAK -case 4: -YY_RULE_SETUP -#line 124 "moc.l" -{ X; - BEGIN QT_DEF; - return TEMPLATE; } - YY_BREAK -case 5: -YY_RULE_SETUP -#line 127 "moc.l" -{ X; return TQ_OBJECT; } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 128 "moc.l" -{ X; return SIGNALS; } - YY_BREAK -case 7: -YY_RULE_SETUP -#line 129 "moc.l" -{ X; return SLOTS; } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 130 "moc.l" -{ X; return TQ_CLASSINFO; } - YY_BREAK -case 9: -YY_RULE_SETUP -#line 131 "moc.l" -{ X; return TQ_PROPERTY; } - YY_BREAK -case 10: -YY_RULE_SETUP -#line 132 "moc.l" -{ X; return TQ_OVERRIDE; } - YY_BREAK -case 11: -YY_RULE_SETUP -#line 133 "moc.l" -{ X; return TQ_ENUMS; } - YY_BREAK -case 12: -YY_RULE_SETUP -#line 134 "moc.l" -{ X; return TQ_SETS; } - YY_BREAK -case 13: -YY_RULE_SETUP -#line 136 "moc.l" -{ fctLevel++;Y; } - YY_BREAK -case 14: -YY_RULE_SETUP -#line 137 "moc.l" -{ fctLevel--;Y;if (fctLevel==0){X;return '}';}} - YY_BREAK -case 15: -YY_RULE_SETUP -#line 138 "moc.l" -{ classPLevel++;Y; } - YY_BREAK -case 16: -YY_RULE_SETUP -#line 139 "moc.l" -{ classPLevel--;Y;if (classPLevel == 0) - {X;return '}';} } - YY_BREAK -case 17: -YY_RULE_SETUP -#line 141 "moc.l" -{ X;if( classPLevel == 1 ) return PUBLIC; } - YY_BREAK -case 18: -YY_RULE_SETUP -#line 142 "moc.l" -{ X;if( classPLevel == 1 ) return PROTECTED; } - YY_BREAK -case 19: -YY_RULE_SETUP -#line 143 "moc.l" -{ X;if( classPLevel == 1 ) return PRIVATE; } - YY_BREAK -case 20: -YY_RULE_SETUP -#line 144 "moc.l" -{ X;if( classPLevel == 1 ) return SIGNALS; } - YY_BREAK -case 21: -YY_RULE_SETUP -#line 145 "moc.l" -{ X;if( classPLevel == 1 ) return SLOTS; } - YY_BREAK -case 22: -YY_RULE_SETUP -#line 146 "moc.l" -{ X;if( classPLevel == 1 ) return TQ_CLASSINFO; } - YY_BREAK -case 23: -YY_RULE_SETUP -#line 147 "moc.l" -{ X; - if ( classPLevel == 1 ) - return TQ_OBJECT; - else if ( classPLevel > 1 ) - moc_warn( "Cannot use TQ_OBJECT in nested class." ); - } - YY_BREAK -case 24: -YY_RULE_SETUP -#line 153 "moc.l" -{ X;if( classPLevel == 1 ) return TQ_PROPERTY; } - YY_BREAK -case 25: -YY_RULE_SETUP -#line 154 "moc.l" -{ X;if( classPLevel == 1 ) return TQ_OVERRIDE; } - YY_BREAK -case 26: -YY_RULE_SETUP -#line 155 "moc.l" -{ X;if( classPLevel == 1 ) return TQ_ENUMS; } - YY_BREAK -case 27: -YY_RULE_SETUP -#line 156 "moc.l" -{ X;if( classPLevel == 1 ) return TQ_SETS; } - YY_BREAK -case 28: -YY_RULE_SETUP -#line 158 "moc.l" -{ namespacePLevel++;Y; } - YY_BREAK -case 29: -YY_RULE_SETUP -#line 159 "moc.l" -{ namespacePLevel--;Y;if (namespacePLevel == 0) - {X;return '}';}} - YY_BREAK -case 30: -YY_RULE_SETUP -#line 161 "moc.l" -{ X; - BEGIN QT_DEF; - return CLASS; } - YY_BREAK -case 31: -YY_RULE_SETUP -#line 164 "moc.l" -{ X; - BEGIN QT_DEF; - return TEMPLATE; } - YY_BREAK -case 32: -YY_RULE_SETUP -#line 167 "moc.l" -{ X; - BEGIN QT_DEF; - return NAMESPACE; } - YY_BREAK -case 33: -YY_RULE_SETUP -#line 170 "moc.l" -{ X; - BEGIN QT_DEF; - return USING; } - YY_BREAK -case 34: -YY_RULE_SETUP -#line 174 "moc.l" -{ X; return '('; } - YY_BREAK -case 35: -YY_RULE_SETUP -#line 175 "moc.l" -{ X; return ')'; } - YY_BREAK -case 36: -YY_RULE_SETUP -#line 176 "moc.l" -{ X; return READ; } - YY_BREAK -case 37: -YY_RULE_SETUP -#line 177 "moc.l" -{ X; return WRITE; } - YY_BREAK -case 38: -YY_RULE_SETUP -#line 178 "moc.l" -{ X; return STORED; } - YY_BREAK -case 39: -YY_RULE_SETUP -#line 179 "moc.l" -{ X; return RESET; } - YY_BREAK -case 40: -YY_RULE_SETUP -#line 180 "moc.l" -{ X; return DESIGNABLE; } - YY_BREAK -case 41: -YY_RULE_SETUP -#line 181 "moc.l" -{ X; return SCRIPTABLE; } - YY_BREAK -case 42: -YY_RULE_SETUP -#line 184 "moc.l" -{ expLevel++;X; } - YY_BREAK -case 43: -YY_RULE_SETUP -#line 185 "moc.l" -{ expLevel--;Y;if (expLevel == 0) - { X; BEGIN QT_DEF; return ')';} } - YY_BREAK -case 44: -YY_RULE_SETUP -#line 187 "moc.l" -{ expLevel++;X; } - YY_BREAK -case 45: -YY_RULE_SETUP -#line 188 "moc.l" -{ expLevel--;X;if (expLevel == 0) - { X; BEGIN QT_DEF; return ']';} } - YY_BREAK -case 46: -YY_RULE_SETUP -#line 190 "moc.l" -{ if (expLevel == 0) - { X; BEGIN QT_DEF; return ',' ;} } - YY_BREAK -case 47: -YY_RULE_SETUP -#line 192 "moc.l" -{ if (expLevel == 0) - { X; BEGIN QT_DEF; return ';' ;} } - YY_BREAK -case 48: -YY_RULE_SETUP -#line 194 "moc.l" -{ expLevel++;X; } - YY_BREAK -case 49: -YY_RULE_SETUP -#line 195 "moc.l" -{ expLevel--;Y;if (expLevel == 0) - { X; BEGIN QT_DEF; return ')';} } - YY_BREAK -case 50: -YY_RULE_SETUP -#line 197 "moc.l" -{ expLevel++;X; } - YY_BREAK -case 51: -YY_RULE_SETUP -#line 198 "moc.l" -{ expLevel--;X;if (expLevel == 0) - { X; BEGIN QT_DEF; return ']';} } - YY_BREAK -case 52: -YY_RULE_SETUP -#line 200 "moc.l" -{ if (expLevel <= 1) - { X; BEGIN QT_DEF; return ',' ;} } - YY_BREAK -case 53: -YY_RULE_SETUP -#line 202 "moc.l" -{ if (expLevel == 0) - { X; BEGIN QT_DEF; return ';' ;} } - YY_BREAK -case 54: -YY_RULE_SETUP -#line 204 "moc.l" -{ enumLevel++;X; } - YY_BREAK -case 55: -YY_RULE_SETUP -#line 205 "moc.l" -{ enumLevel--;X; } - YY_BREAK -case 56: -YY_RULE_SETUP -#line 206 "moc.l" -{ enumLevel++;X; } - YY_BREAK -case 57: -YY_RULE_SETUP -#line 207 "moc.l" -{ enumLevel--;X } - YY_BREAK -case 58: -YY_RULE_SETUP -#line 208 "moc.l" -{ if (enumLevel == 0) - { X; BEGIN QT_DEF; return ',' ;} } - YY_BREAK -case 59: -YY_RULE_SETUP -#line 210 "moc.l" -{ if (enumLevel == 0) - { X; BEGIN QT_DEF; return ';' ;} } - YY_BREAK -case 60: -YY_RULE_SETUP -#line 212 "moc.l" -{ if (enumLevel == 0) - { X; BEGIN QT_DEF; return '}' ;} } - YY_BREAK -case 61: -YY_RULE_SETUP -#line 214 "moc.l" -{ templLevel++; - Y; - addExpressionChar( yytext[0] ); - } - YY_BREAK -case 62: -YY_RULE_SETUP -#line 218 "moc.l" -{ templLevel--; - Y; - if ( templLevel == 0 ) { - X; - BEGIN QT_DEF; - return yytext[0]; - } else { - addExpressionChar( yytext[0] ); - } - } - YY_BREAK -case 63: -YY_RULE_SETUP -#line 228 "moc.l" -{ X;return FRIEND; } - YY_BREAK -case 64: -YY_RULE_SETUP -#line 229 "moc.l" -{ X;return TYPEDEF; } - YY_BREAK -case 65: -YY_RULE_SETUP -#line 230 "moc.l" -{ X;return AUTO; } - YY_BREAK -case 66: -YY_RULE_SETUP -#line 231 "moc.l" -{ X;return REGISTER; } - YY_BREAK -case 67: -YY_RULE_SETUP -#line 232 "moc.l" -{ X;return STATIC; } - YY_BREAK -case 68: -YY_RULE_SETUP -#line 233 "moc.l" -{ X;return EXTERN; } - YY_BREAK -case 69: -YY_RULE_SETUP -#line 234 "moc.l" -{ X;return INLINE; } - YY_BREAK -case 70: -YY_RULE_SETUP -#line 235 "moc.l" -{ X;return INLINE; } - YY_BREAK -case 71: -YY_RULE_SETUP -#line 236 "moc.l" -{ X;return VIRTUAL; } - YY_BREAK -case 72: -YY_RULE_SETUP -#line 237 "moc.l" -{ X;return CONST; } - YY_BREAK -case 73: -YY_RULE_SETUP -#line 238 "moc.l" -{ X;return VOLATILE; } - YY_BREAK -case 74: -YY_RULE_SETUP -#line 239 "moc.l" -{ X;return CHAR; } - YY_BREAK -case 75: -YY_RULE_SETUP -#line 240 "moc.l" -{ X;return SHORT; } - YY_BREAK -case 76: -YY_RULE_SETUP -#line 241 "moc.l" -{ X;return INT; } - YY_BREAK -case 77: -YY_RULE_SETUP -#line 242 "moc.l" -{ X;return LONG; } - YY_BREAK -case 78: -YY_RULE_SETUP -#line 243 "moc.l" -{ X;return SIGNED; } - YY_BREAK -case 79: -YY_RULE_SETUP -#line 244 "moc.l" -{ X;return UNSIGNED; } - YY_BREAK -case 80: -YY_RULE_SETUP -#line 245 "moc.l" -{ X;return FLOAT; } - YY_BREAK -case 81: -YY_RULE_SETUP -#line 246 "moc.l" -{ X;return DOUBLE; } - YY_BREAK -case 82: -YY_RULE_SETUP -#line 247 "moc.l" -{ X;return VOID; } - YY_BREAK -case 83: -YY_RULE_SETUP -#line 248 "moc.l" -{ X;return ENUM; } - YY_BREAK -case 84: -YY_RULE_SETUP -#line 249 "moc.l" -{ X;return CLASS; } - YY_BREAK -case 85: -YY_RULE_SETUP -#line 250 "moc.l" -{ X;return STRUCT; } - YY_BREAK -case 86: -YY_RULE_SETUP -#line 251 "moc.l" -{ X;return UNION; } - YY_BREAK -case 87: -YY_RULE_SETUP -#line 252 "moc.l" -{ X;return ASM; } - YY_BREAK -case 88: -YY_RULE_SETUP -#line 253 "moc.l" -{ X;return PRIVATE; } - YY_BREAK -case 89: -YY_RULE_SETUP -#line 254 "moc.l" -{ X;return PROTECTED; } - YY_BREAK -case 90: -YY_RULE_SETUP -#line 255 "moc.l" -{ X;return PUBLIC; } - YY_BREAK -case 91: -YY_RULE_SETUP -#line 256 "moc.l" -{ X;return OPERATOR; } - YY_BREAK -case 92: -YY_RULE_SETUP -#line 257 "moc.l" -{ X;return DBL_COLON; } - YY_BREAK -case 93: -YY_RULE_SETUP -#line 258 "moc.l" -{ X;return TRIPLE_DOT; } - YY_BREAK -case 94: -YY_RULE_SETUP -#line 259 "moc.l" -{ X;return TEMPLATE; } - YY_BREAK -case 95: -YY_RULE_SETUP -#line 260 "moc.l" -{ X;return MUTABLE; } - YY_BREAK -case 96: -YY_RULE_SETUP -#line 261 "moc.l" -{ X;return THROW; } - YY_BREAK -case 97: -YY_RULE_SETUP -#line 262 "moc.l" -{ X;return USING; } - YY_BREAK -case 98: -YY_RULE_SETUP -#line 263 "moc.l" -{ X;return NAMESPACE; } - YY_BREAK -case 99: -YY_RULE_SETUP -#line 265 "moc.l" -{ - X; - yylval.string = tqstrdup(yytext); - return IDENTIFIER; - } - YY_BREAK -case 100: -YY_RULE_SETUP -#line 271 "moc.l" -{ - X; - yylval.string = tqstrdup(yytext); - return IDENTIFIER; - } - YY_BREAK -case 101: -YY_RULE_SETUP -#line 277 "moc.l" -{ X; return '('; } - YY_BREAK -case 102: -YY_RULE_SETUP -#line 278 "moc.l" -{ X; return ')'; } - YY_BREAK -case 103: -YY_RULE_SETUP -#line 279 "moc.l" -{ X; return ','; } - YY_BREAK -case 104: -/* rule 104 can match eol */ -YY_RULE_SETUP -#line 281 "moc.l" -{ - X; - yylval.string = tqstrdup( yytext + 1 ); - input(); /* discard the '"' */ - return STRING; - } - YY_BREAK -case 105: -YY_RULE_SETUP -#line 288 "moc.l" -; - YY_BREAK -case 106: -YY_RULE_SETUP -#line 289 "moc.l" -; - YY_BREAK -case 107: -YY_RULE_SETUP -#line 290 "moc.l" -; - YY_BREAK -case 108: -/* rule 108 can match eol */ -YY_RULE_SETUP -#line 292 "moc.l" -{ /* discard strings */ - Z; - } - YY_BREAK -case 109: -/* rule 109 can match eol */ -YY_RULE_SETUP -#line 296 "moc.l" -{ /* discard strings */ - Z; - } - YY_BREAK -case 110: -/* rule 110 can match eol */ -YY_RULE_SETUP -#line 300 "moc.l" -{ /* discard strings */ - Z; - } - YY_BREAK -case 111: -/* rule 111 can match eol */ -YY_RULE_SETUP -#line 304 "moc.l" -{ /* discard strings */ - Z; - addExpressionString( yytext ); - input(); /* discard the '"' */ - } - YY_BREAK -case 112: -/* rule 112 can match eol */ -YY_RULE_SETUP -#line 311 "moc.l" -{ - X; - addExpressionString( yytext ); - input(); /* discard the '"' */ - return STRING; - } - YY_BREAK -case 113: -/* rule 113 can match eol */ -YY_RULE_SETUP -#line 318 "moc.l" -{ - X; - yylval.string = tqstrdup( yytext + 1 ); - input(); /* discard the '"' */ - return STRING; - } - YY_BREAK -case 114: -YY_RULE_SETUP -#line 325 "moc.l" -{ X; - yylval.char_val = yytext[1]; - return CHAR_VAL; - } - YY_BREAK -case 115: -YY_RULE_SETUP -#line 330 "moc.l" -{ X; - yylval.char_val = '\a'; - return CHAR_VAL; - } - YY_BREAK -case 116: -YY_RULE_SETUP -#line 335 "moc.l" -{ X; - yylval.char_val = '\b'; - return CHAR_VAL; - } - YY_BREAK -case 117: -YY_RULE_SETUP -#line 340 "moc.l" -{ X; - yylval.char_val = '\f'; - return CHAR_VAL; - } - YY_BREAK -case 118: -YY_RULE_SETUP -#line 345 "moc.l" -{ X; - yylval.char_val = '\n'; - return CHAR_VAL; - } - YY_BREAK -case 119: -YY_RULE_SETUP -#line 350 "moc.l" -{ X; - yylval.char_val = '\r'; - return CHAR_VAL; - } - YY_BREAK -case 120: -YY_RULE_SETUP -#line 355 "moc.l" -{ X; - yylval.char_val = '\t'; - return CHAR_VAL; - } - YY_BREAK -case 121: -YY_RULE_SETUP -#line 360 "moc.l" -{ X; - yylval.char_val = '\v'; - return CHAR_VAL; - } - YY_BREAK -case 122: -YY_RULE_SETUP -#line 365 "moc.l" -{ X; - yylval.char_val = '\\'; - return CHAR_VAL; - } - YY_BREAK -case 123: -YY_RULE_SETUP -#line 370 "moc.l" -{ X; - yylval.char_val = '\?'; - return CHAR_VAL; - } - YY_BREAK -case 124: -YY_RULE_SETUP -#line 375 "moc.l" -{ X; - yylval.char_val = '\''; - return CHAR_VAL; - } - YY_BREAK -case 125: -YY_RULE_SETUP -#line 380 "moc.l" -{ X; - yylval.char_val = '\"'; /* " */ - return CHAR_VAL; - } - YY_BREAK -case 126: -YY_RULE_SETUP -#line 385 "moc.l" -{ X; - yylval.char_val = '\0'; - return CHAR_VAL; - } - YY_BREAK -case 127: -YY_RULE_SETUP -#line 390 "moc.l" -{ X; - yylval.char_val = - (char)strtol( &yytext[1], 0, 8 ); - return CHAR_VAL; - } - YY_BREAK -case 128: -YY_RULE_SETUP -#line 396 "moc.l" -{ X; - yylval.char_val = - (char)strtol( &yytext[2], 0, 16 ); - return CHAR_VAL; - } - YY_BREAK -case 129: -YY_RULE_SETUP -#line 402 "moc.l" -{ X; - yylval.char_val = ' '; - return CHAR_VAL; - } - YY_BREAK -case 130: -YY_RULE_SETUP -#line 407 "moc.l" -{ X; - yylval.int_val = atoi(yytext); - return INT_VAL; - } - YY_BREAK -case 131: -YY_RULE_SETUP -#line 412 "moc.l" -{ X; - yylval.double_val = atof(yytext); - return DOUBLE_VAL; - } - YY_BREAK -case 132: -YY_RULE_SETUP -#line 417 "moc.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 "moc.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 "moc.l" -{ /* preprocessor commands are skipped */} - YY_BREAK -case 135: -YY_RULE_SETUP -#line 435 "moc.l" -{ /* C++ comment */ - TQCString s = yytext; - if ( s.contains( "MOC_SKIP_BEGIN" ) ) { - skipLevel++; - if ( skipLevel == 1 ) { - lastState = YYSTATE; - BEGIN SKIP; - } - } else - if ( s.contains( "MOC_SKIP_END" ) ) { - if ( skipLevel == 0 ) { - moc_warn(" MOC_SKIP_END without MOC_SKIP_BEGIN"); - } else { - skipLevel--; - if ( skipLevel == 0 ) { - BEGIN lastState; - } - } - } - } - YY_BREAK -case 136: -YY_RULE_SETUP -#line 455 "moc.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 "moc.l" -{ addExpressionChar( yytext[0] ); } - YY_BREAK -case 138: -YY_RULE_SETUP -#line 470 "moc.l" -{ - /* spaces are important in template args, - e.g. Foo */ - addExpressionChar( yytext[0] ); } - YY_BREAK -case 139: -YY_RULE_SETUP -#line 474 "moc.l" -; - YY_BREAK -case 140: -YY_RULE_SETUP -#line 475 "moc.l" -; - YY_BREAK -case 141: -YY_RULE_SETUP -#line 476 "moc.l" -; - YY_BREAK -case 142: -YY_RULE_SETUP -#line 477 "moc.l" -; - YY_BREAK -case 143: -YY_RULE_SETUP -#line 478 "moc.l" -{ addExpressionChar( yytext[0] ); } - YY_BREAK -case 144: -YY_RULE_SETUP -#line 479 "moc.l" -; - YY_BREAK -case 145: -YY_RULE_SETUP -#line 480 "moc.l" -{ addExpressionChar( yytext[0] ); } - YY_BREAK -case 146: -YY_RULE_SETUP -#line 481 "moc.l" -; - YY_BREAK -case 147: -YY_RULE_SETUP -#line 482 "moc.l" -; - YY_BREAK -case 148: -YY_RULE_SETUP -#line 483 "moc.l" -{ - X; - return yytext[0]; - } - YY_BREAK -case 149: -YY_RULE_SETUP -#line 487 "moc.l" -{ - X; - return ';'; - } - YY_BREAK -case 150: -/* rule 150 can match eol */ -YY_RULE_SETUP -#line 491 "moc.l" -{ - lineNo++; - } - YY_BREAK -case 151: -YY_RULE_SETUP -#line 496 "moc.l" -ECHO; - YY_BREAK -#line 2297 "lex.yy.c" -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(OUTSIDE): -case YY_STATE_EOF(QT_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) -{ - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = (yytext_ptr); - 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) -{ - yy_state_type yy_current_state; - 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 ) - { - 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 >= 617 ) - 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 ) -{ - int yy_is_jam; - char *yy_cp = (yy_c_buf_p); - - 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 >= 617 ) - 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 == 616); - - return yy_is_jam ? 0 : yy_current_state; -} - - static void yyunput (int c, char * yy_bp ) -{ - 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. */ - int number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - 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 ) -{ - 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 ) -{ - 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 "moc.l" - - - -#endif // MOC_YACC_CODE - diff --git a/src/moc/moc_yacc.cpp b/src/moc/moc_yacc.cpp deleted file mode 100644 index 83994e260..000000000 --- a/src/moc/moc_yacc.cpp +++ /dev/null @@ -1,6483 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.5. */ - -/* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2011 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 . */ - -/* 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.5" - -/* 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 268 of yacc.c */ -#line 57 "moc.y" - -#define MOC_YACC_CODE -void yyerror( const char *msg ); - -#include "qplatformdefs.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 MOC_MWERKS_PLUGIN -# ifdef Q_OS_MACX -# undef OLD_DEBUG -# ifdef DEBUG -# define OLD_DEBUG DEBUG -# undef DEBUG -# endif -# define DEBUG 0 -# ifndef __IMAGECAPTURE__ -# define __IMAGECAPTURE__ -# endif -# include -# endif -# include "mwerks_mac.h" -#endif - -#include -#include -#include - -#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 tqvariant_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 moc_warn( const char *msg ); -static void moc_err( const char *s ); -static void moc_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\"", tqvariant_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\"", tqvariant_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 tqvariant.cpp. If you change - one, change both. -*/ -static const int ntypes = 35; -static const char* const type_map[ntypes] = -{ - 0, - "TQMap", - "TQValueList", - "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 tqvariant_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 tqvariant_nameToType( type ) != 0; -} - -/* - Replaces '>>' with '> >' (as in 'TQValueList >'). - 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'. - */ - if ( leftType[i] == '&' || leftType[i] == '*' || - leftType[i] == '<' ) - break; - } - - name = argName; - isDefault = isDefaultArgument; - } - - TQCString leftType; - TQCString rightType; - TQCString name; - bool isDefault; -}; - -class ArgList : public TQPtrList { // 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 { // list of member functions -public: - FuncList( bool autoDelete = FALSE ) { setAutoDelete( autoDelete ); } - - FuncList find( const char* name ) - { - FuncList result; - for ( TQPtrListIterator 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 { // 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 TQ_PROPERTY construct cannot contain any commas, since - commas separate macro arguments. We therefore expect users - to type "TQMap" instead of "TQMap". For - coherence, we also expect the same for - TQValueList, the other template class supported by - TQVariant. - */ - if ( type == "TQMap" ) { - type = "TQMap"; - } else if ( type == "TQValueList" ) { - type = "TQValueList"; - } 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 { // 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 { // 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 - bool generatedCode; // no code generated - bool mocError; // moc parsing error occurred - bool hasVariantIncluded; //whether or not tqvariant.h was included yet - TQCString className; // name of parsed class - TQCString superClassName; // name of first super class - TQStrList multipleSuperClasses; // other superclasses - FuncList signals; // signal interface - FuncList slots; // slots interface - FuncList propfuncs; // all possible property access functions - FuncList funcs; // all parsed functions, including signals - 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 TQ_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 TQ_PROPERTYdetected; // TRUE if current class - // contains at least one TQ_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 tqmetaobject.h too -const int formatRevision = 26; // moc output format revision - -// if the flags change, you HAVE to change it in tqmetaobject.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(Q_OS_WIN32) -# include -# undef isatty -extern "C" int hack_isatty( int ) - { - return 0; - } -# define isatty hack_isatty -# else -# include -# endif - -# define YYDEBUG 1 -# include "moc_yacc.h" -# include "moc_lex.cpp" -#endif //YYBISON - - -/* Line 268 of yacc.c */ -#line 704 "moc_yacc" - -/* 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, - TQ_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 TQ_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 293 of yacc.c */ -#line 692 "moc.y" - - char char_val; - int int_val; - double double_val; - char *string; - Access access; - Function *function; - ArgList *arg_list; - Argument *arg; - - - -/* Line 293 of yacc.c */ -#line 865 "moc_yacc" -} 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 343 of yacc.c */ -#line 877 "moc_yacc" - -#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 /* 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 defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include /* 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 /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# 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 EXIT_SUCCESS \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (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 EXIT_SUCCESS && (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) - -# define YYCOPY_NEEDED 1 - -/* 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 - -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* 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 -#endif /* !YYCOPY_NEEDED */ - -/* 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, 1183, 1191, 1195, - 1200, 1201, 1205, 1208, 1209, 1212, 1215, 1216, 1220, 1220, - 1225, 1226, 1229, 1230, 1233, 1234, 1238, 1239, 1243, 1243, - 1245, 1245, 1247, 1255, 1258, 1255, 1262, 1265, 1262, 1269, - 1271, 1269, 1276, 1277, 1276, 1282, 1283, 1282, 1290, 1292, - 1293, 1293, 1303, 1310, 1311, 1314, 1315, 1318, 1321, 1322, - 1325, 1326, 1330, 1333, 1334, 1337, 1338, 1341, 1344, 1345, - 1348, 1351, 1352, 1355, 1357, 1361, 1362, 1363, 1364, 1365, - 1366, 1367, 1368, 1369, 1370, 1373, 1374, 1375, 1378, 1379, - 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, 1422, - 1423, 1426, 1429, 1436, 1443, 1451, 1453, 1457, 1462, 1464, - 1466, 1469, 1471, 1477, 1478, 1480, 1483, 1485, 1487, 1489, - 1492, 1495, 1498, 1494, 1503, 1504, 1507, 1508, 1508, 1510, - 1510, 1514, 1515, 1515, 1520, 1525, 1526, 1529, 1536, 1540, - 1541, 1544, 1545, 1546, 1549, 1550, 1550, 1555, 1554, 1591, - 1592, 1593, 1594, 1595, 1596, 1597, 1600, 1601, 1604, 1605 -}; -#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", - "TQ_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 reduction number in state STATE-NUM. - Performed 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 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 -}; - -#define yypact_value_is_default(yystate) \ - ((yystate) == (-356)) - -#define yytable_value_is_error(yytable_value) \ - YYID (0) - -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. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ - -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - 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 - - -/* This macro is provided for backward compatibility. */ - -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#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 /* 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 _DEFAULT_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 *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = 0; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - - for details. YYERROR is fine as it does not invoke this - function. - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - 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 yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* 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 = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; -} -#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. | -`----------*/ - -#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 (yypact_value_is_default (yyn)) - 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 (yytable_value_is_error (yyn)) - 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 1806 of yacc.c */ -#line 824 "moc.y" - { enterNameSpace((yyvsp[(2) - (2)].string)); } - break; - - case 12: - -/* Line 1806 of yacc.c */ -#line 825 "moc.y" - { BEGIN IN_NAMESPACE; } - break; - - case 13: - -/* Line 1806 of yacc.c */ -#line 827 "moc.y" - { leaveNameSpace(); - selectOutsideClassState(); - } - break; - - case 14: - -/* Line 1806 of yacc.c */ -#line 832 "moc.y" - { enterNameSpace(); } - break; - - case 15: - -/* Line 1806 of yacc.c */ -#line 833 "moc.y" - { BEGIN IN_NAMESPACE; } - break; - - case 16: - -/* Line 1806 of yacc.c */ -#line 835 "moc.y" - { leaveNameSpace(); - selectOutsideClassState(); - } - break; - - case 18: - -/* Line 1806 of yacc.c */ -#line 844 "moc.y" - { selectOutsideClassState(); } - break; - - case 19: - -/* Line 1806 of yacc.c */ -#line 848 "moc.y" - { selectOutsideClassState(); } - break; - - case 20: - -/* Line 1806 of yacc.c */ -#line 851 "moc.y" - { selectOutsideClassState(); } - break; - - case 21: - -/* Line 1806 of yacc.c */ -#line 852 "moc.y" - { selectOutsideClassState(); } - break; - - case 22: - -/* Line 1806 of yacc.c */ -#line 855 "moc.y" - { initClass(); } - break; - - case 23: - -/* Line 1806 of yacc.c */ -#line 856 "moc.y" - { generateClass(); - registerClassInNamespace(); - selectOutsideClassState(); } - break; - - case 24: - -/* Line 1806 of yacc.c */ -#line 864 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 25: - -/* Line 1806 of yacc.c */ -#line 865 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 26: - -/* Line 1806 of yacc.c */ -#line 869 "moc.y" - { g->tmpExpression = rmWS( g->tmpExpression ); - (yyval.string) = stradd( (yyvsp[(1) - (4)].string), "<", - g->tmpExpression, ">" ); } - break; - - case 27: - -/* Line 1806 of yacc.c */ -#line 880 "moc.y" - { initExpression(); - templLevel = 1; - BEGIN IN_TEMPL_ARGS; } - break; - - case 28: - -/* Line 1806 of yacc.c */ -#line 893 "moc.y" - { initExpression(); - BEGIN IN_EXPR; } - break; - - case 29: - -/* Line 1806 of yacc.c */ -#line 902 "moc.y" - { BEGIN IN_DEF_ARG; } - break; - - case 30: - -/* Line 1806 of yacc.c */ -#line 905 "moc.y" - { initExpression(); - BEGIN IN_ENUM; } - break; - - case 31: - -/* Line 1806 of yacc.c */ -#line 911 "moc.y" - { (yyval.string) = ""; } - break; - - case 32: - -/* Line 1806 of yacc.c */ -#line 912 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 33: - -/* Line 1806 of yacc.c */ -#line 913 "moc.y" - { (yyval.string) = ""; } - break; - - case 34: - -/* Line 1806 of yacc.c */ -#line 914 "moc.y" - { skipFunc = TRUE; (yyval.string) = ""; } - break; - - case 35: - -/* Line 1806 of yacc.c */ -#line 915 "moc.y" - { skipFunc = TRUE; (yyval.string) = ""; } - break; - - case 36: - -/* Line 1806 of yacc.c */ -#line 919 "moc.y" - { (yyval.string) = straddSpc((yyvsp[(1) - (3)].string),(yyvsp[(2) - (3)].string),(yyvsp[(3) - (3)].string)); } - break; - - case 37: - -/* Line 1806 of yacc.c */ -#line 921 "moc.y" - { (yyval.string) = ""; } - break; - - case 38: - -/* Line 1806 of yacc.c */ -#line 922 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 39: - -/* Line 1806 of yacc.c */ -#line 925 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 40: - -/* Line 1806 of yacc.c */ -#line 926 "moc.y" - { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)); } - break; - - case 43: - -/* Line 1806 of yacc.c */ -#line 931 "moc.y" - { skipFunc = TRUE; } - break; - - case 45: - -/* Line 1806 of yacc.c */ -#line 935 "moc.y" - { } - break; - - case 46: - -/* Line 1806 of yacc.c */ -#line 936 "moc.y" - { } - break; - - case 47: - -/* Line 1806 of yacc.c */ -#line 939 "moc.y" - { (yyval.string) = "const"; } - break; - - case 48: - -/* Line 1806 of yacc.c */ -#line 940 "moc.y" - { (yyval.string) = "volatile"; } - break; - - case 49: - -/* Line 1806 of yacc.c */ -#line 943 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 50: - -/* Line 1806 of yacc.c */ -#line 944 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 51: - -/* Line 1806 of yacc.c */ -#line 945 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 52: - -/* Line 1806 of yacc.c */ -#line 949 "moc.y" - { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)); } - break; - - case 53: - -/* Line 1806 of yacc.c */ -#line 950 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 54: - -/* Line 1806 of yacc.c */ -#line 953 "moc.y" - { (yyval.string) = "char"; } - break; - - case 55: - -/* Line 1806 of yacc.c */ -#line 954 "moc.y" - { (yyval.string) = "short"; } - break; - - case 56: - -/* Line 1806 of yacc.c */ -#line 955 "moc.y" - { (yyval.string) = "int"; } - break; - - case 57: - -/* Line 1806 of yacc.c */ -#line 956 "moc.y" - { (yyval.string) = "long"; } - break; - - case 58: - -/* Line 1806 of yacc.c */ -#line 957 "moc.y" - { (yyval.string) = "signed"; } - break; - - case 59: - -/* Line 1806 of yacc.c */ -#line 958 "moc.y" - { (yyval.string) = "unsigned"; } - break; - - case 60: - -/* Line 1806 of yacc.c */ -#line 959 "moc.y" - { (yyval.string) = "float"; } - break; - - case 61: - -/* Line 1806 of yacc.c */ -#line 960 "moc.y" - { (yyval.string) = "double"; } - break; - - case 62: - -/* Line 1806 of yacc.c */ -#line 961 "moc.y" - { (yyval.string) = "void"; } - break; - - case 63: - -/* Line 1806 of yacc.c */ -#line 965 "moc.y" - { g->tmpExpression = rmWS( g->tmpExpression ); - (yyval.string) = stradd( "template<", - g->tmpExpression, ">" ); } - break; - - case 65: - -/* Line 1806 of yacc.c */ -#line 971 "moc.y" - { templateClassOld = templateClass; - templateClass = TRUE; - } - break; - - case 66: - -/* Line 1806 of yacc.c */ -#line 977 "moc.y" - { (yyval.string) = "class"; } - break; - - case 67: - -/* Line 1806 of yacc.c */ -#line 978 "moc.y" - { (yyval.string) = "struct"; } - break; - - case 68: - -/* Line 1806 of yacc.c */ -#line 981 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 69: - -/* Line 1806 of yacc.c */ -#line 983 "moc.y" - { (yyval.string) = stradd( "::", (yyvsp[(2) - (2)].string) ); } - break; - - case 70: - -/* Line 1806 of yacc.c */ -#line 987 "moc.y" - { (yyval.string) = stradd( (yyvsp[(1) - (3)].string), "::", (yyvsp[(3) - (3)].string) );} - break; - - case 71: - -/* Line 1806 of yacc.c */ -#line 988 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 72: - -/* Line 1806 of yacc.c */ -#line 992 "moc.y" - { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)); } - break; - - case 73: - -/* Line 1806 of yacc.c */ -#line 993 "moc.y" - { (yyval.string) = stradd("enum ",(yyvsp[(2) - (2)].string)); } - break; - - case 74: - -/* Line 1806 of yacc.c */ -#line 994 "moc.y" - { (yyval.string) = stradd("union ",(yyvsp[(2) - (2)].string)); } - break; - - case 75: - -/* Line 1806 of yacc.c */ -#line 999 "moc.y" - { (yyval.arg_list) = (yyvsp[(1) - (2)].arg_list);} - break; - - case 76: - -/* Line 1806 of yacc.c */ -#line 1000 "moc.y" - { (yyval.arg_list) = (yyvsp[(1) - (3)].arg_list); - func_warn("Ellipsis not supported" - " in signals and slots.\n" - "Ellipsis argument ignored."); } - break; - - case 77: - -/* Line 1806 of yacc.c */ -#line 1006 "moc.y" - { (yyval.arg_list) = tmpArgList; } - break; - - case 78: - -/* Line 1806 of yacc.c */ -#line 1007 "moc.y" - { (yyval.arg_list) = (yyvsp[(1) - (1)].arg_list); } - break; - - case 79: - -/* Line 1806 of yacc.c */ -#line 1010 "moc.y" - { (yyval.arg) = 0; } - break; - - case 82: - -/* Line 1806 of yacc.c */ -#line 1015 "moc.y" - { func_warn("Ellipsis not supported" - " in signals and slots.\n" - "Ellipsis argument ignored."); } - break; - - case 83: - -/* Line 1806 of yacc.c */ -#line 1023 "moc.y" - { (yyval.arg_list) = addArg((yyvsp[(3) - (3)].arg)); } - break; - - case 84: - -/* Line 1806 of yacc.c */ -#line 1024 "moc.y" - { (yyval.arg_list) = addArg((yyvsp[(1) - (1)].arg)); } - break; - - case 85: - -/* Line 1806 of yacc.c */ -#line 1028 "moc.y" - { (yyval.arg) = new Argument(straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)),""); } - break; - - case 86: - -/* Line 1806 of yacc.c */ -#line 1030 "moc.y" - { expLevel = 1; } - break; - - case 87: - -/* Line 1806 of yacc.c */ -#line 1032 "moc.y" - { (yyval.arg) = new Argument(straddSpc((yyvsp[(1) - (5)].string),(yyvsp[(2) - (5)].string)),"", 0, TRUE ); } - break; - - case 88: - -/* Line 1806 of yacc.c */ -#line 1035 "moc.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 1806 of yacc.c */ -#line 1038 "moc.y" - { expLevel = 1; } - break; - - case 90: - -/* Line 1806 of yacc.c */ -#line 1040 "moc.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 1806 of yacc.c */ -#line 1044 "moc.y" - { (yyval.string) = ""; } - break; - - case 92: - -/* Line 1806 of yacc.c */ -#line 1045 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 93: - -/* Line 1806 of yacc.c */ -#line 1049 "moc.y" - { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)); } - break; - - case 94: - -/* Line 1806 of yacc.c */ -#line 1050 "moc.y" - { expLevel = 1; } - break; - - case 95: - -/* Line 1806 of yacc.c */ -#line 1052 "moc.y" - { (yyval.string) = stradd( "[", - g->tmpExpression = - g->tmpExpression.stripWhiteSpace(), "]" ); } - break; - - case 96: - -/* Line 1806 of yacc.c */ -#line 1055 "moc.y" - { expLevel = 1; } - break; - - case 97: - -/* Line 1806 of yacc.c */ -#line 1057 "moc.y" - { (yyval.string) = stradd( (yyvsp[(1) - (5)].string),"[", - g->tmpExpression = - g->tmpExpression.stripWhiteSpace(),"]" ); } - break; - - case 98: - -/* Line 1806 of yacc.c */ -#line 1060 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 99: - -/* Line 1806 of yacc.c */ -#line 1061 "moc.y" - { (yyval.string) = (yyvsp[(2) - (3)].string); } - break; - - case 100: - -/* Line 1806 of yacc.c */ -#line 1064 "moc.y" - { (yyval.string) = ""; } - break; - - case 101: - -/* Line 1806 of yacc.c */ -#line 1066 "moc.y" - { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string));} - break; - - case 102: - -/* Line 1806 of yacc.c */ -#line 1067 "moc.y" - { expLevel = 1; } - break; - - case 103: - -/* Line 1806 of yacc.c */ -#line 1069 "moc.y" - { (yyval.string) = stradd( (yyvsp[(1) - (5)].string),"[", - g->tmpExpression = - g->tmpExpression.stripWhiteSpace(),"]" ); } - break; - - case 104: - -/* Line 1806 of yacc.c */ -#line 1072 "moc.y" - { (yyval.string) = (yyvsp[(2) - (3)].string); } - break; - - case 106: - -/* Line 1806 of yacc.c */ -#line 1086 "moc.y" - { tmpFunc->args = (yyvsp[(2) - (8)].arg_list); - tmpFunc->qualifier = (yyvsp[(4) - (8)].string); } - break; - - case 108: - -/* Line 1806 of yacc.c */ -#line 1092 "moc.y" - { func_warn("Variable as signal or slot."); } - break; - - case 109: - -/* Line 1806 of yacc.c */ -#line 1093 "moc.y" - { expLevel=0; } - break; - - case 110: - -/* Line 1806 of yacc.c */ -#line 1095 "moc.y" - { skipFunc = TRUE; } - break; - - case 111: - -/* Line 1806 of yacc.c */ -#line 1096 "moc.y" - { expLevel=0; } - break; - - case 112: - -/* Line 1806 of yacc.c */ -#line 1098 "moc.y" - { skipFunc = TRUE; } - break; - - case 113: - -/* Line 1806 of yacc.c */ -#line 1102 "moc.y" - { expLevel = 1; } - break; - - case 115: - -/* Line 1806 of yacc.c */ -#line 1104 "moc.y" - { expLevel = 1; } - break; - - case 117: - -/* Line 1806 of yacc.c */ -#line 1109 "moc.y" - { (yyval.string) = ""; } - break; - - case 118: - -/* Line 1806 of yacc.c */ -#line 1110 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 119: - -/* Line 1806 of yacc.c */ -#line 1113 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 120: - -/* Line 1806 of yacc.c */ -#line 1114 "moc.y" - { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string));} - break; - - case 121: - -/* Line 1806 of yacc.c */ -#line 1117 "moc.y" - { (yyval.string) = straddSpc("*",(yyvsp[(2) - (2)].string));} - break; - - case 122: - -/* Line 1806 of yacc.c */ -#line 1118 "moc.y" - { (yyval.string) = stradd("&",(yyvsp[(2) - (2)].string));} - break; - - case 123: - -/* Line 1806 of yacc.c */ -#line 1125 "moc.y" - { (yyval.string) = ""; } - break; - - case 124: - -/* Line 1806 of yacc.c */ -#line 1126 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 125: - -/* Line 1806 of yacc.c */ -#line 1129 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 126: - -/* Line 1806 of yacc.c */ -#line 1131 "moc.y" - { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)); } - break; - - case 127: - -/* Line 1806 of yacc.c */ -#line 1134 "moc.y" - { (yyval.string) = "const"; } - break; - - case 128: - -/* Line 1806 of yacc.c */ -#line 1135 "moc.y" - { (yyval.string) = "volatile"; } - break; - - case 132: - -/* Line 1806 of yacc.c */ -#line 1143 "moc.y" - { BEGIN IN_FCT; fctLevel = 1;} - break; - - case 133: - -/* Line 1806 of yacc.c */ -#line 1144 "moc.y" - { BEGIN QT_DEF; } - break; - - case 134: - -/* Line 1806 of yacc.c */ -#line 1151 "moc.y" - { BEGIN IN_CLASS; - classPLevel = 1; - } - break; - - case 135: - -/* Line 1806 of yacc.c */ -#line 1155 "moc.y" - { BEGIN QT_DEF; } - break; - - case 136: - -/* Line 1806 of yacc.c */ -#line 1156 "moc.y" - { BEGIN QT_DEF; /* -- " -- */ - skipClass = TRUE; } - break; - - case 137: - -/* Line 1806 of yacc.c */ -#line 1158 "moc.y" - { BEGIN QT_DEF; /* -- " -- */ - skipClass = TRUE; } - break; - - case 138: - -/* Line 1806 of yacc.c */ -#line 1160 "moc.y" - { BEGIN QT_DEF; /* -- " -- */ - skipClass = TRUE; } - break; - - case 139: - -/* Line 1806 of yacc.c */ -#line 1164 "moc.y" - { BEGIN QT_DEF; /* catch ';' */ - skipClass = TRUE; } - break; - - case 140: - -/* Line 1806 of yacc.c */ -#line 1166 "moc.y" - { skipClass = TRUE; - BEGIN GIMME_SEMICOLON; } - break; - - case 144: - -/* Line 1806 of yacc.c */ -#line 1173 "moc.y" - { (yyval.string) = ""; } - break; - - case 146: - -/* Line 1806 of yacc.c */ -#line 1179 "moc.y" - { g->className = (yyvsp[(2) - (2)].string); - if ( g->className == "TQObject" ) - TQ_OBJECTdetected = TRUE; - } - break; - - case 147: - -/* Line 1806 of yacc.c */ -#line 1185 "moc.y" - { g->className = (yyvsp[(3) - (3)].string); - if ( g->className == "TQObject" ) - TQ_OBJECTdetected = TRUE; - } - break; - - case 148: - -/* Line 1806 of yacc.c */ -#line 1192 "moc.y" - { g->superClassName = (yyvsp[(2) - (2)].string); } - break; - - case 149: - -/* Line 1806 of yacc.c */ -#line 1197 "moc.y" - { templateClass = templateClassOld; } - break; - - case 158: - -/* Line 1806 of yacc.c */ -#line 1220 "moc.y" - { expLevel = 1; } - break; - - case 160: - -/* Line 1806 of yacc.c */ -#line 1225 "moc.y" - { (yyval.string) = 0; } - break; - - case 161: - -/* Line 1806 of yacc.c */ -#line 1226 "moc.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } - break; - - case 166: - -/* Line 1806 of yacc.c */ -#line 1238 "moc.y" - { tmpAccess = (yyvsp[(1) - (1)].access); } - break; - - case 167: - -/* Line 1806 of yacc.c */ -#line 1239 "moc.y" - { moc_err( "Missing access specifier" - " before \"slots:\"." ); } - break; - - case 168: - -/* Line 1806 of yacc.c */ -#line 1243 "moc.y" - { BEGIN QT_DEF; } - break; - - case 170: - -/* Line 1806 of yacc.c */ -#line 1245 "moc.y" - { BEGIN QT_DEF; } - break; - - case 172: - -/* Line 1806 of yacc.c */ -#line 1247 "moc.y" - { - if ( tmpAccess ) - moc_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 1806 of yacc.c */ -#line 1255 "moc.y" - { tmpYYStart = YY_START; - tmpPropOverride = FALSE; - BEGIN IN_PROPERTY; } - break; - - case 174: - -/* Line 1806 of yacc.c */ -#line 1258 "moc.y" - { - BEGIN tmpYYStart; - } - break; - - case 176: - -/* Line 1806 of yacc.c */ -#line 1262 "moc.y" - { tmpYYStart = YY_START; - tmpPropOverride = TRUE; - BEGIN IN_PROPERTY; } - break; - - case 177: - -/* Line 1806 of yacc.c */ -#line 1265 "moc.y" - { - BEGIN tmpYYStart; - } - break; - - case 179: - -/* Line 1806 of yacc.c */ -#line 1269 "moc.y" - { tmpYYStart = YY_START; BEGIN IN_CLASSINFO; } - break; - - case 180: - -/* Line 1806 of yacc.c */ -#line 1271 "moc.y" - { - g->infos.append( new ClassInfo( (yyvsp[(4) - (7)].string), (yyvsp[(6) - (7)].string) ) ); - BEGIN tmpYYStart; - } - break; - - case 182: - -/* Line 1806 of yacc.c */ -#line 1276 "moc.y" - { tmpYYStart = YY_START; BEGIN IN_PROPERTY; } - break; - - case 183: - -/* Line 1806 of yacc.c */ -#line 1277 "moc.y" - { - TQ_PROPERTYdetected = TRUE; - BEGIN tmpYYStart; - } - break; - - case 185: - -/* Line 1806 of yacc.c */ -#line 1282 "moc.y" - { tmpYYStart = YY_START; BEGIN IN_PROPERTY; } - break; - - case 186: - -/* Line 1806 of yacc.c */ -#line 1283 "moc.y" - { - TQ_PROPERTYdetected = TRUE; - BEGIN tmpYYStart; - } - break; - - case 188: - -/* Line 1806 of yacc.c */ -#line 1290 "moc.y" - { moc_err( "Signals cannot " - "have access specifiers" ); } - break; - - case 190: - -/* Line 1806 of yacc.c */ -#line 1293 "moc.y" - { if ( tmpAccess == Public && TQ_PROPERTYdetected ) - BEGIN QT_DEF; - else - BEGIN IN_CLASS; - suppress_func_warn = TRUE; - } - break; - - case 191: - -/* Line 1806 of yacc.c */ -#line 1300 "moc.y" - { - suppress_func_warn = FALSE; - } - break; - - case 192: - -/* Line 1806 of yacc.c */ -#line 1303 "moc.y" - { BEGIN IN_CLASS; - if ( classPLevel != 1 ) - moc_warn( "unexpected access" - "specifier" ); - } - break; - - case 197: - -/* Line 1806 of yacc.c */ -#line 1318 "moc.y" - { addMember( PropertyCandidateMember ); } - break; - - case 202: - -/* Line 1806 of yacc.c */ -#line 1330 "moc.y" - { addMember( SignalMember ); } - break; - - case 207: - -/* Line 1806 of yacc.c */ -#line 1341 "moc.y" - { addMember( SlotMember ); } - break; - - case 210: - -/* Line 1806 of yacc.c */ -#line 1348 "moc.y" - { (yyval.string)=(yyvsp[(2) - (2)].string); } - break; - - case 211: - -/* Line 1806 of yacc.c */ -#line 1351 "moc.y" - { g->multipleSuperClasses.append( (yyvsp[(3) - (3)].string) ); } - break; - - case 213: - -/* Line 1806 of yacc.c */ -#line 1356 "moc.y" - { (yyval.string) = stradd( (yyvsp[(1) - (4)].string), "(", (yyvsp[(3) - (4)].string), ")" ); } - break; - - case 214: - -/* Line 1806 of yacc.c */ -#line 1358 "moc.y" - { (yyval.string) = stradd( (yyvsp[(1) - (4)].string), "(", (yyvsp[(3) - (4)].string), ")" ); } - break; - - case 215: - -/* Line 1806 of yacc.c */ -#line 1361 "moc.y" - {(yyval.string)=(yyvsp[(1) - (1)].string);} - break; - - case 216: - -/* Line 1806 of yacc.c */ -#line 1362 "moc.y" - {(yyval.string)=(yyvsp[(3) - (3)].string);} - break; - - case 217: - -/* Line 1806 of yacc.c */ -#line 1363 "moc.y" - {(yyval.string)=(yyvsp[(2) - (2)].string);} - break; - - case 218: - -/* Line 1806 of yacc.c */ -#line 1364 "moc.y" - {(yyval.string)=(yyvsp[(3) - (3)].string);} - break; - - case 219: - -/* Line 1806 of yacc.c */ -#line 1365 "moc.y" - {(yyval.string)=(yyvsp[(2) - (2)].string);} - break; - - case 220: - -/* Line 1806 of yacc.c */ -#line 1366 "moc.y" - {(yyval.string)=(yyvsp[(1) - (1)].string);} - break; - - case 221: - -/* Line 1806 of yacc.c */ -#line 1367 "moc.y" - {(yyval.string)=(yyvsp[(3) - (3)].string);} - break; - - case 222: - -/* Line 1806 of yacc.c */ -#line 1368 "moc.y" - {(yyval.string)=(yyvsp[(2) - (2)].string);} - break; - - case 223: - -/* Line 1806 of yacc.c */ -#line 1369 "moc.y" - {(yyval.string)=(yyvsp[(3) - (3)].string);} - break; - - case 224: - -/* Line 1806 of yacc.c */ -#line 1370 "moc.y" - {(yyval.string)=(yyvsp[(2) - (2)].string);} - break; - - case 225: - -/* Line 1806 of yacc.c */ -#line 1373 "moc.y" - { (yyval.access)=Private; } - break; - - case 226: - -/* Line 1806 of yacc.c */ -#line 1374 "moc.y" - { (yyval.access)=Protected; } - break; - - case 227: - -/* Line 1806 of yacc.c */ -#line 1375 "moc.y" - { (yyval.access)=Public; } - break; - - case 228: - -/* Line 1806 of yacc.c */ -#line 1378 "moc.y" - { } - break; - - case 229: - -/* Line 1806 of yacc.c */ -#line 1379 "moc.y" - { } - break; - - case 271: - -/* Line 1806 of yacc.c */ -#line 1427 "moc.y" - { tmpFunc->type = (yyvsp[(1) - (2)].string); - tmpFunc->name = (yyvsp[(2) - (2)].string); } - break; - - case 272: - -/* Line 1806 of yacc.c */ -#line 1430 "moc.y" - { tmpFunc->type = "int"; - tmpFunc->name = (yyvsp[(1) - (1)].string); - if ( tmpFunc->name == g->className ) - func_warn( "Constructors cannot be" - " signals or slots."); - } - break; - - case 273: - -/* Line 1806 of yacc.c */ -#line 1437 "moc.y" - { tmpFunc->type = "void"; - tmpFunc->name = "~"; - tmpFunc->name += (yyvsp[(3) - (3)].string); - func_warn( "Destructors cannot be" - " signals or slots."); - } - break; - - case 274: - -/* Line 1806 of yacc.c */ -#line 1445 "moc.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 1806 of yacc.c */ -#line 1452 "moc.y" - { skipFunc = TRUE; } - break; - - case 276: - -/* Line 1806 of yacc.c */ -#line 1454 "moc.y" - { tmpFunc->type = - straddSpc((yyvsp[(1) - (3)].string),(yyvsp[(2) - (3)].string)); - tmpFunc->name = (yyvsp[(3) - (3)].string); } - break; - - case 277: - -/* Line 1806 of yacc.c */ -#line 1459 "moc.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 1806 of yacc.c */ -#line 1463 "moc.y" - { operatorError(); } - break; - - case 279: - -/* Line 1806 of yacc.c */ -#line 1465 "moc.y" - { operatorError(); } - break; - - case 280: - -/* Line 1806 of yacc.c */ -#line 1468 "moc.y" - { operatorError(); } - break; - - case 281: - -/* Line 1806 of yacc.c */ -#line 1470 "moc.y" - { operatorError(); } - break; - - case 282: - -/* Line 1806 of yacc.c */ -#line 1473 "moc.y" - { operatorError(); } - break; - - case 284: - -/* Line 1806 of yacc.c */ -#line 1479 "moc.y" - { func_warn("Unexpected variable declaration."); } - break; - - case 285: - -/* Line 1806 of yacc.c */ -#line 1482 "moc.y" - { func_warn("Unexpected variable declaration."); } - break; - - case 286: - -/* Line 1806 of yacc.c */ -#line 1484 "moc.y" - { func_warn("Unexpected enum declaration."); } - break; - - case 287: - -/* Line 1806 of yacc.c */ -#line 1486 "moc.y" - { func_warn("Unexpected using declaration."); } - break; - - case 288: - -/* Line 1806 of yacc.c */ -#line 1488 "moc.y" - { func_warn("Unexpected using declaration."); } - break; - - case 289: - -/* Line 1806 of yacc.c */ -#line 1490 "moc.y" - { classPLevel++; - moc_err("Unexpected namespace declaration."); } - break; - - case 290: - -/* Line 1806 of yacc.c */ -#line 1493 "moc.y" - { func_warn("Unexpected class declaration.");} - break; - - case 291: - -/* Line 1806 of yacc.c */ -#line 1495 "moc.y" - { func_warn("Unexpected class declaration."); - BEGIN IN_FCT; fctLevel=1; - } - break; - - case 292: - -/* Line 1806 of yacc.c */ -#line 1498 "moc.y" - { BEGIN QT_DEF; } - break; - - case 296: - -/* Line 1806 of yacc.c */ -#line 1507 "moc.y" - { } - break; - - case 297: - -/* Line 1806 of yacc.c */ -#line 1508 "moc.y" - { expLevel = 0; } - break; - - case 299: - -/* Line 1806 of yacc.c */ -#line 1510 "moc.y" - { expLevel = 0; } - break; - - case 302: - -/* Line 1806 of yacc.c */ -#line 1515 "moc.y" - { expLevel = 0; } - break; - - case 307: - -/* Line 1806 of yacc.c */ -#line 1530 "moc.y" - { BEGIN QT_DEF; - if ( tmpAccess == Public) { - tmpEnum->name = (yyvsp[(1) - (5)].string); - addEnum(); - } - } - break; - - case 308: - -/* Line 1806 of yacc.c */ -#line 1537 "moc.y" - { tmpEnum->clear();} - break; - - case 310: - -/* Line 1806 of yacc.c */ -#line 1541 "moc.y" - { } - break; - - case 314: - -/* Line 1806 of yacc.c */ -#line 1549 "moc.y" - { if ( tmpAccess == Public) tmpEnum->append( (yyvsp[(1) - (1)].string) ); } - break; - - case 315: - -/* Line 1806 of yacc.c */ -#line 1550 "moc.y" - { enumLevel=0; } - break; - - case 316: - -/* Line 1806 of yacc.c */ -#line 1551 "moc.y" - { if ( tmpAccess == Public) tmpEnum->append( (yyvsp[(1) - (4)].string) ); } - break; - - case 317: - -/* Line 1806 of yacc.c */ -#line 1555 "moc.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 1806 of yacc.c */ -#line 1571 "moc.y" - { - if ( g->propRead.isEmpty() && !g->propOverride ) - moc_err( "A property must at least feature a read method." ); - checkPropertyName( (yyvsp[(2) - (4)].string) ); - TQ_PROPERTYdetected = TRUE; - // Avoid duplicates - for( TQPtrListIterator lit( g->props ); lit.current(); ++lit ) { - if ( lit.current()->name == (yyvsp[(2) - (4)].string) ) { - if ( displayWarnings ) - moc_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 1806 of yacc.c */ -#line 1592 "moc.y" - { g->propRead = (yyvsp[(2) - (3)].string); } - break; - - case 321: - -/* Line 1806 of yacc.c */ -#line 1593 "moc.y" - { g->propWrite = (yyvsp[(2) - (3)].string); } - break; - - case 322: - -/* Line 1806 of yacc.c */ -#line 1594 "moc.y" - { g->propReset = (yyvsp[(2) - (3)].string); } - break; - - case 323: - -/* Line 1806 of yacc.c */ -#line 1595 "moc.y" - { g->propStored = (yyvsp[(2) - (3)].string); } - break; - - case 324: - -/* Line 1806 of yacc.c */ -#line 1596 "moc.y" - { g->propDesignable = (yyvsp[(2) - (3)].string); } - break; - - case 325: - -/* Line 1806 of yacc.c */ -#line 1597 "moc.y" - { g->propScriptable = (yyvsp[(2) - (3)].string); } - break; - - case 326: - -/* Line 1806 of yacc.c */ -#line 1600 "moc.y" - { } - break; - - case 327: - -/* Line 1806 of yacc.c */ -#line 1601 "moc.y" - { g->qtEnums.append( (yyvsp[(1) - (2)].string) ); } - break; - - case 328: - -/* Line 1806 of yacc.c */ -#line 1604 "moc.y" - { } - break; - - case 329: - -/* Line 1806 of yacc.c */ -#line 1605 "moc.y" - { g->qtSets.append( (yyvsp[(1) - (2)].string) ); } - break; - - - -/* Line 1806 of yacc.c */ -#line 4252 "moc_yacc" - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ - 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: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#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 (!yypact_value_is_default (yyn)) - { - 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) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - 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 2067 of yacc.c */ -#line 1608 "moc.y" - - -#ifndef YYBISON -# if defined(Q_OS_WIN32) -# include -# undef isatty -extern "C" int hack_isatty( int ) -{ - return 0; -} -# define isatty hack_isatty -# else -# include -# endif -# include "moc_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 - generatedCode = FALSE; // no code generated - mocError = FALSE; // moc parsing error occurred - hasVariantIncluded = FALSE; -} - - -parser_reg::~parser_reg() -{ - slots.clear(); - signals.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 Q_CC_MSVC -#define ErrorFormatString "%s(%d):" -#else -#define ErrorFormatString "%s:%d:" -#endif - -#ifndef MOC_MWERKS_PLUGIN -int main( int argc, char **argv ) -{ - init(); - - bool autoInclude = TRUE; - const char *error = 0; - g->qtPath = ""; - for ( int n=1; noutputFile = argv[++n]; - } else - g->outputFile = &opt[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[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[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[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, "moc: %s\n", error ); - fprintf( stderr, "Usage: moc [options] \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 moc\n" ); - cleanup(); - return 1; - } else { - yyin = fopen( (const char *)g->fileName, "r" ); - if ( !yyin ) { - fprintf( stderr, "moc: %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, "moc: 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->mocError ) { - fprintf( stderr, ErrorFormatString" Warning: %s\n", g->fileName.data(), 0, - "No relevant classes found. No output generated." ); - } - - int ret = g->mocError ? 1 : 0; - cleanup(); - return ret; -} -#else -bool tqt_is_gui_used = FALSE; -#include -#include -#include -#ifdef Q_OS_MAC9 -# include -# include -# include -# include "Aliases.h" -#endif -#include "CWPluginErrors.h" -#include -#include "DropInCompilerLinker.h" -#include - -const unsigned char *p_str(const char *, int =-1); - -CWPluginContext g_ctx; - -moc_status do_moc( 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 moc_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 moc_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 moc_no_source; - } - if(stat(outpath, &ostat) == 0 && istat.st_mtime < ostat.st_mtime) { - cleanup(); - return moc_not_time; - } - - unlink(outpath.data()); - out = fopen(outpath.data(), "w+"); - if(!out) { - cleanup(); - return moc_general_error; - } - - yyparse(); - if(out != stdout) - fclose(out); - - if(g->mocError || !g->generatedCode) { - unlink(outpath.data()); - moc_status ret = !g->generatedCode ? moc_no_qobject : moc_parse_error; - cleanup(); - return ret; - } - - cleanup(); - return moc_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 MOC_MWERKS_PLUGIN - buf_buffer = NULL; - buf_index = 0; - buf_size_total = 0; -#endif -} - -void cleanup() -{ - delete g; - g = NULL; - -#ifdef MOC_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; - TQ_PROPERTYdetected = FALSE; - skipClass = FALSE; - templateClass = FALSE; - g->slots.clear(); - g->signals.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 definedClasses; // Classes defined in the namespace -}; - -TQPtrList 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 nameQualifier() -{ - TQPtrListIterator 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 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 TQ_SIGNAL and TQ_SLOT names. -// This function has been copied from tqobject.cpp. -// - -inline bool isSpace( char x ) -{ -#if defined(Q_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->mocError = TRUE; -#ifndef MOC_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 moc_err( const char *s ) -{ - yyerror( s ); -} - -void moc_err( const char *s1, const char *s2 ) -{ - static char tmp[1024]; - sprintf( tmp, s1, s2 ); - yyerror( tmp ); -} - -void moc_warn( const char *msg ) -{ - if ( displayWarnings ) - fprintf( stderr, ErrorFormatString" Warning: %s\n", g->fileName.data(), lineNo, msg); -} - -void moc_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 ) - moc_warn( msg ); - skipFunc = TRUE; -} - -void operatorError() -{ - if ( !suppress_func_warn ) - moc_warn("Operator functions cannot be signals or slots."); - 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::tqt_invoke() rather than A::B::tqt_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) - 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 qualifiedClassName() -{ - return nameQualifier() + g->className; -} - -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_QUType_%s, %s, TQUParameter::Out }", uType(f->type).data(), uTypeExtra(f->type).data() ); - else - fprintf( out, "\t{ 0, &static_QUType_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_QUType_%s, %s, TQUParameter::%s }", - uType( type ).data(), uTypeExtra( type ).data(), - isInOut( type ) ? "InOut" : "In" ); - else - fprintf( out, "\t{ \"%s\", &static_QUType_%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 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 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 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 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 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 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 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 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 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 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 ) - moc_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 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 |= tqvariant_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 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 ) - moc_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 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 by: The TQt Meta Object Compiler version %d (TQt %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->signals.count() == 0 && g->slots.count() == 0 && g->props.count() == 0 && g->infos.count() == 0 ) - return; - if ( displayWarnings && (g->signals.count() + g->slots.count()) != 0 ) - moc_err("The declaration of the class \"%s\" contains signals " - "or slots\n\t but no TQ_OBJECT macro.", g->className.data()); - } else { - if ( g->superClassName.isEmpty() ) - moc_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 - moc_err( "Sorry, TQt does not support templates that contain\n" - "\tsignals, slots or TQ_OBJECT." ); - return; - } - g->generatedCode = TRUE; - g->gen_count++; - - if ( g->gen_count == 1 ) { // first class to be generated - 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[i]; - fprintf( out, hdr1, (const char*)qualifiedClassName(),(const char*)fn); - fprintf( out, hdr2, formatRevision, TQT_VERSION_STR ); - fprintf( out, "%s", hdr3 ); - fprintf( out, "%s", hdr4 ); - - if ( !g->noInclude ) { - /* - The header file might be a TQt header file with - TQT_NO_COMPAT macros around signals, slots 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 <%sntqapplication.h>\n\n", (const char*)g->qtPath ); - fprintf( out, "#include <%sprivate/tqucomextra_p.h>\n", (const char*)g->qtPath ); - fprintf( out, "#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != %d)\n", formatRevision ); - fprintf( out, "#error \"This file was generated using the moc from %s." - " It\"\n#error \"cannot be used with the include files from" - " this version of TQt.\"\n#error \"(The moc 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->slots.first(); f && !needToIncludeVariant; f=g->slots.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::fromLatin1( 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}\n" ); - fprintf( out, "#ifdef TQT_THREAD_SUPPORT\n if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->lock();\n" ); - fprintf( out, " if ( metaObj ) {\n\tif (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();\n\treturn metaObj;\n }\n#endif // TQT_THREAD_SUPPORT\n" ); - if ( isTQObject ) - fprintf( out, " TQMetaObject* parentObject = staticTQtMetaObject();\n" ); - else if ( !g->superClassName.isEmpty() ) - fprintf( out, " TQMetaObject* parentObject = %s::staticMetaObject();\n", (const char*)g->superClassName ); - 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 slots -// - int n_enums = generateEnums(); - -// -// Build slots array in staticMetaObject() -// - generateFuncs( &g->slots, "slot", Slot_Num ); - -// -// Build signals array in staticMetaObject() -// - generateFuncs( &g->signals, "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->slots.count() ) - fprintf( out, "\tslot_tbl, %d,\n", g->slots.count() ); - else - fprintf( out, "\t0, 0,\n" ); - - if ( g->signals.count() ) - fprintf( out, "\tsignal_tbl, %d,\n", g->signals.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, "#ifdef TQT_THREAD_SUPPORT\n if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();\n#endif // TQT_THREAD_SUPPORT\n" ); - fprintf( out, " return metaObj;\n}\n" ); - -// -// End of function staticMetaObject() -// - -// -// Generate smart cast function -// - fprintf( out, "\nvoid* %s::tqt_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 %s::tqt_cast( clname );\n", - (const char*)purestSuperClassName() ); - else - fprintf( out, " return 0;\n" ); - fprintf( out, "}\n" ); - -// -// Generate internal signal functions -// - Function *f; - f = g->signals.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// TQ_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( staticMetaObject()->signalOffset() + %d", 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 ( signalsBlocked() )\n\treturn%s;\n", hasReturnValue ? " something" : "" ); - fprintf( out, " TQConnectionList *clist = receivers( 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_QUType_%s.set(o,something);\n", utype.data() ); - } else if ( uType( f->type ) == "varptr" ) { - fprintf( out, " static_QUType_varptr.set(o,&something);\n" ); - } else { - fprintf( out, " static_QUType_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_QUType_%s.set(o+%d,t%d);\n", utype.data(), offset+1, offset ); - } else if ( uType( type ) == "varptr" ) { - fprintf( out, " static_QUType_varptr.set(o+%d,&t%d);\n", offset+1, offset ); - } else { - fprintf( out, " static_QUType_ptr.set(o+%d,&t%d);\n", offset+1, offset ); - } - a = f->args->next(); - offset++; - } - } - fprintf( out, " o[%d].isLastObject = true;\n", f->args->count() + 0 ); - 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_QUType_%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_QUType_ptr.get(o+%d);\n", offset, offset, type.data(), offset+1 ); - else - fprintf( out, " t%d = static_QUType_%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_QUType_%s.get(o);\n", f->type.data(), utype.data() ); - else - fprintf( out, " return static_QUType_%s.get(o);\n", utype.data() ); - } - - fprintf( out, "}\n" ); - } - - f = g->signals.next(); - sigindex++; - } - - -// -// Generate internal tqt_invoke() function -// - fprintf( out, "\nbool %s::tqt_invoke( int _id, TQUObject* _o )\n{\n", qualifiedClassName().data() ); - - if( !g->slots.isEmpty() ) { - fprintf( out, " switch ( _id - staticMetaObject()->slotOffset() ) {\n" ); - int slotindex = -1; - for ( f = g->slots.first(); f; f = g->slots.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_QUType_%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_QUType_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_QUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); - else - fprintf( out, "(%s)static_QUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); - } else { - TQCString castType = castToUType( type ); - if(castType == type) - fprintf( out, "(%s)(*((%s*)static_QUType_ptr.get(_o+%d)))", type.data(), - castType.data(), offset+1 ); - else - fprintf( out, "(%s)*((%s*)static_QUType_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 %s::tqt_invoke( _id, _o );\n", - (const char *) purestSuperClassName() ); - } else { - fprintf( out, "\treturn FALSE;\n" ); - } - fprintf( out, " }\n" ); - fprintf( out, " return TRUE;\n}\n" ); - } else { - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, " return %s::tqt_invoke(_id,_o);\n}\n", - (const char *) purestSuperClassName() ); - else - fprintf( out, " return FALSE;\n}\n" ); - } - - -// -// Generate internal tqt_emit() function -// - fprintf( out, "\nbool %s::tqt_emit( int _id, TQUObject* _o )\n{\n", qualifiedClassName().data() ); - - if ( !g->signals.isEmpty() ) { - fprintf( out, " switch ( _id - staticMetaObject()->signalOffset() ) {\n" ); - int signalindex = -1; - for ( f = g->signals.first(); f; f = g->signals.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_QUType_%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_QUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); - else - fprintf( out, "(%s)static_QUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); - } else { - TQCString castType = castToUType( type ); - if(castType == type) - fprintf( out, "(%s)(*((%s*)static_QUType_ptr.get(_o+%d)))", type.data(), - castType.data(), offset+1 ); - else - fprintf( out, "(%s)*((%s*)static_QUType_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 %s::tqt_emit(_id,_o);\n", - (const char *) purestSuperClassName() ); - else - fprintf( out, "\treturn FALSE;\n" ); - fprintf( out, " }\n" ); - fprintf( out, " return TRUE;\n}\n" ); - } else { - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, " return %s::tqt_emit(_id,_o);\n}\n", - (const char *) purestSuperClassName() ); - else - fprintf( out, " return FALSE;\n}\n" ); - } - - - fprintf( out, "#ifndef TQT_NO_PROPERTIES\n" ); -// -// Generate internal tqt_property() functions -// - - fprintf( out, "\nbool %s::tqt_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 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" ) - fprintf( out, "v->asMap()" ); - else if ( type == "TQValueList" ) - 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() ); break;\n", - it.current()->getfunc->name.data(), - !isVariantType( it.current()->type ) ? "(int)" : "", - it.current()->getfunc->name.data()); - else - fprintf( out, "\tcase 1: *v = TQVariant( %sthis->%s() ); break;\n", - !isVariantType( it.current()->type ) ? "(int)" : "", - it.current()->getfunc->name.data()); - } 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 %s::tqt_property( id, f, v );\n", - (const char *) purestSuperClassName() ); - else - fprintf( out, "\treturn FALSE;\n" ); - fprintf( out, " }\n" ); - fprintf( out, " return TRUE;\n" ); - - if ( need_resolve ) - fprintf( out, "resolve:\n return %s::tqt_property( staticMetaObject()->resolveProperty(id), f, v );\n", - (const char *) purestSuperClassName() ); - fprintf( out, "}\n" ); - } else { - if ( !g->superClassName.isEmpty() && !isTQObject ) - fprintf( out, " return %s::tqt_property( id, f, v);\n}\n", - (const char *) purestSuperClassName() ); - else - fprintf( out, " return FALSE;\n}\n" ); - } - - fprintf( out, "\nbool %s::tqt_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 lit( g->enums ); lit.current(); ++lit ) { - if ( lit.current()->name == tmpEnum->name ) - { - if ( displayWarnings ) - moc_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->signals.append( tmpFunc ); - break; - } else { - if ( m == SlotMember ) - g->slots.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] == '_' ) { - moc_err( "Invalid property name '%s'.", ident ); - return; - } -} - diff --git a/src/moc/moc_yacc.h b/src/moc/moc_yacc.h deleted file mode 100644 index 9f47feba0..000000000 --- a/src/moc/moc_yacc.h +++ /dev/null @@ -1,183 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.5. */ - -/* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2011 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 . */ - -/* 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, - TQ_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 TQ_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 2068 of yacc.c */ -#line 692 "moc.y" - - char char_val; - int int_val; - double double_val; - char *string; - Access access; - Function *function; - ArgList *arg_list; - Argument *arg; - - - -/* Line 2068 of yacc.c */ -#line 175 "moc_yacc.h" -} YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - -extern YYSTYPE yylval; - - diff --git a/src/tmp/README b/src/tmp/README index d9f9bac27..fb1136b5c 100644 --- a/src/tmp/README +++ b/src/tmp/README @@ -1 +1 @@ -This is a temporary directory for moc output +This is a temporary directory for tqmoc output diff --git a/src/tqmoc/README b/src/tqmoc/README new file mode 100644 index 000000000..988b2004d --- /dev/null +++ b/src/tqmoc/README @@ -0,0 +1,12 @@ +This directory contains the source code for the TQt 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. diff --git a/src/tqmoc/tqmoc.l b/src/tqmoc/tqmoc.l new file mode 100644 index 000000000..373c6712c --- /dev/null +++ b/src/tqmoc/tqmoc.l @@ -0,0 +1,498 @@ +/**************************************************************************** +** +** Lexical analyzer for meta object compiler +** +** Created : 930417 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** 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 sales@trolltech.com. +** +** This file may be used under the terms of the Q 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 Q_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 +#include + +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 + MOC_SKIP_BEGIN is encountered */ +int skipLevel = 0; /* Depth of MOC_SKIP_BEGINs */ + +class TQString; + +extern void addExpressionChar( const char ); +extern void addExpressionString( const char * ); +extern void tqmoc_warn( const char *msg ); +%} + +%start OUTSIDE QT_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}\" + +%% + +"class" { X; + BEGIN QT_DEF; + return CLASS; } +"namespace" { X; + BEGIN QT_DEF; + return NAMESPACE; } +"using" { X; + BEGIN QT_DEF; + return USING; } +"template" { X; + BEGIN QT_DEF; + return TEMPLATE; } +"TQ_OBJECT" { X; return TQ_OBJECT; } +"signals" { X; return SIGNALS; } +"slots" { X; return SLOTS; } +"TQ_CLASSINFO" { X; return TQ_CLASSINFO; } +"TQ_PROPERTY" { X; return TQ_PROPERTY; } +"TQ_OVERRIDE" { X; return TQ_OVERRIDE; } +"TQ_ENUMS" { X; return TQ_ENUMS; } +"TQ_SETS" { X; return TQ_SETS; } + +"{" { fctLevel++;Y; } +"}" { fctLevel--;Y;if (fctLevel==0){X;return '}';}} +"{" { classPLevel++;Y; } +"}" { classPLevel--;Y;if (classPLevel == 0) + {X;return '}';} } +"public" { X;if( classPLevel == 1 ) return PUBLIC; } +"protected" { X;if( classPLevel == 1 ) return PROTECTED; } +"private" { X;if( classPLevel == 1 ) return PRIVATE; } +"signals" { X;if( classPLevel == 1 ) return SIGNALS; } +"slots" { X;if( classPLevel == 1 ) return SLOTS; } +"TQ_CLASSINFO" { X;if( classPLevel == 1 ) return TQ_CLASSINFO; } +"TQ_OBJECT" { X; + if ( classPLevel == 1 ) + return TQ_OBJECT; + else if ( classPLevel > 1 ) + tqmoc_warn( "Cannot use TQ_OBJECT in nested class." ); + } +"TQ_PROPERTY" { X;if( classPLevel == 1 ) return TQ_PROPERTY; } +"TQ_OVERRIDE" { X;if( classPLevel == 1 ) return TQ_OVERRIDE; } +"TQ_ENUMS" { X;if( classPLevel == 1 ) return TQ_ENUMS; } +"TQ_SETS" { X;if( classPLevel == 1 ) return TQ_SETS; } + +"{" { namespacePLevel++;Y; } +"}" { namespacePLevel--;Y;if (namespacePLevel == 0) + {X;return '}';}} +"class" { X; + BEGIN QT_DEF; + return CLASS; } +"template" { X; + BEGIN QT_DEF; + return TEMPLATE; } +"namespace" { X; + BEGIN QT_DEF; + return NAMESPACE; } +"using" { X; + BEGIN QT_DEF; + return USING; } + +"(" { X; return '('; } +")" { X; return ')'; } +"READ" { X; return READ; } +"WRITE" { X; return WRITE; } +"STORED" { X; return STORED; } +"RESET" { X; return RESET; } +"DESIGNABLE" { X; return DESIGNABLE; } +"SCRIPTABLE" { X; return SCRIPTABLE; } + + +"(" { expLevel++;X; } +")" { expLevel--;Y;if (expLevel == 0) + { X; BEGIN QT_DEF; return ')';} } +"[" { expLevel++;X; } +"]" { expLevel--;X;if (expLevel == 0) + { X; BEGIN QT_DEF; return ']';} } +"," { if (expLevel == 0) + { X; BEGIN QT_DEF; return ',' ;} } +";" { if (expLevel == 0) + { X; BEGIN QT_DEF; return ';' ;} } +"(" { expLevel++;X; } +")" { expLevel--;Y;if (expLevel == 0) + { X; BEGIN QT_DEF; return ')';} } +"[" { expLevel++;X; } +"]" { expLevel--;X;if (expLevel == 0) + { X; BEGIN QT_DEF; return ']';} } +"," { if (expLevel <= 1) + { X; BEGIN QT_DEF; return ',' ;} } +";" { if (expLevel == 0) + { X; BEGIN QT_DEF; return ';' ;} } +"(" { enumLevel++;X; } +")" { enumLevel--;X; } +"[" { enumLevel++;X; } +"]" { enumLevel--;X } +"," { if (enumLevel == 0) + { X; BEGIN QT_DEF; return ',' ;} } +";" { if (enumLevel == 0) + { X; BEGIN QT_DEF; return ';' ;} } +"}" { if (enumLevel == 0) + { X; BEGIN QT_DEF; return '}' ;} } +[[(<] { templLevel++; + Y; + addExpressionChar( yytext[0] ); + } +[])>] { templLevel--; + Y; + if ( templLevel == 0 ) { + X; + BEGIN QT_DEF; + return yytext[0]; + } else { + addExpressionChar( yytext[0] ); + } + } +"friend" { X;return FRIEND; } +"typedef" { X;return TYPEDEF; } +"auto" { X;return AUTO; } +"register" { X;return REGISTER; } +"static" { X;return STATIC; } +"extern" { X;return EXTERN; } +"inline" { X;return INLINE; } +"__inline__" { X;return INLINE; } +"virtual" { X;return VIRTUAL; } +"const" { X;return CONST; } +"volatile" { X;return VOLATILE; } +"char" { X;return CHAR; } +"short" { X;return SHORT; } +"int" { X;return INT; } +"long" { X;return LONG; } +"signed" { X;return SIGNED; } +"unsigned" { X;return UNSIGNED; } +"float" { X;return FLOAT; } +"double" { X;return DOUBLE; } +"void" { X;return VOID; } +"enum" { X;return ENUM; } +"class" { X;return CLASS; } +"struct" { X;return STRUCT; } +"union" { X;return UNION; } +"asm" { X;return ASM; } +"private" { X;return PRIVATE; } +"protected" { X;return PROTECTED; } +"public" { X;return PUBLIC; } +"operator" { X;return OPERATOR; } +"::" { X;return DBL_COLON; } +"..." { X;return TRIPLE_DOT; } +"template" { X;return TEMPLATE; } +"mutable" { X;return MUTABLE; } +"throw" { X;return THROW; } +"using" { X;return USING; } +"namespace" { X;return NAMESPACE; } + +[_a-zA-Z][_a-zA-Z0-9]* { + X; + yylval.string = tqstrdup(yytext); + return IDENTIFIER; + } + +[_a-zA-Z][_a-zA-Z0-9]* { + X; + yylval.string = tqstrdup(yytext); + return IDENTIFIER; + } + +"(" { X; return '('; } +")" { X; return ')'; } +"," { X; return ','; } + +{ALMOSTSTRING} { + X; + yylval.string = tqstrdup( yytext + 1 ); + input(); /* discard the '"' */ + return STRING; + } + +[_a-zA-Z][_a-zA-Z0-9]* ; +[_a-zA-Z][_a-zA-Z0-9]* ; +[_a-zA-Z][_a-zA-Z0-9]* ; + +{STRING} { /* discard strings */ + Z; + } + +{STRING} { /* discard strings */ + Z; + } + +{STRING} { /* discard strings */ + Z; + } + +{ALMOSTSTRING} { /* discard strings */ + Z; + addExpressionString( yytext ); + input(); /* discard the '"' */ + } + + +{ALMOSTSTRING} { + X; + addExpressionString( yytext ); + input(); /* discard the '"' */ + return STRING; + } + +{ALMOSTSTRING} { + X; + yylval.string = tqstrdup( yytext + 1 ); + input(); /* discard the '"' */ + return STRING; + } + +'.' { X; + yylval.char_val = yytext[1]; + return CHAR_VAL; + } + +'\\a' { X; + yylval.char_val = '\a'; + return CHAR_VAL; + } + +'\\b' { X; + yylval.char_val = '\b'; + return CHAR_VAL; + } + +'\\f' { X; + yylval.char_val = '\f'; + return CHAR_VAL; + } + +'\\n' { X; + yylval.char_val = '\n'; + return CHAR_VAL; + } + +'\\r' { X; + yylval.char_val = '\r'; + return CHAR_VAL; + } + +'\\t' { X; + yylval.char_val = '\t'; + return CHAR_VAL; + } + +'\\v' { X; + yylval.char_val = '\v'; + return CHAR_VAL; + } + +'\\\\' { X; + yylval.char_val = '\\'; + return CHAR_VAL; + } + +'\\?' { X; + yylval.char_val = '\?'; + return CHAR_VAL; + } + +'\\'' { X; + yylval.char_val = '\''; + return CHAR_VAL; + } + +'\\\"' { X; + yylval.char_val = '\"'; /* " */ + return CHAR_VAL; + } + +'\\0' { X; + yylval.char_val = '\0'; + return CHAR_VAL; + } + +'\\[0-7]+' { X; + yylval.char_val = + (char)strtol( &yytext[1], 0, 8 ); + return CHAR_VAL; + } + +'\\x[0-9a-fA-F]+' { X; + yylval.char_val = + (char)strtol( &yytext[2], 0, 16 ); + return CHAR_VAL; + } + +'\\.' { X; + yylval.char_val = ' '; + return CHAR_VAL; + } + +[0-9]+ { X; + yylval.int_val = atoi(yytext); + return INT_VAL; + } + +[0-9]+\.[0-9]* { X; + yylval.double_val = atof(yytext); + return DOUBLE_VAL; + } + +\.[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( "MOC_SKIP_BEGIN" ) ) { + skipLevel++; + if ( skipLevel == 1 ) { + lastState = YYSTATE; + BEGIN SKIP; + } + } else + if ( s.contains( "MOC_SKIP_END" ) ) { + if ( skipLevel == 0 ) { + tqmoc_warn(" MOC_SKIP_END without MOC_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); + } + +. { addExpressionChar( yytext[0] ); } + +[ \t\r\b\f]+ { + /* spaces are important in template args, + e.g. Foo */ + addExpressionChar( yytext[0] ); } +[ \t\r\b\f]+ ; +. ; +. ; +. ; +. { addExpressionChar( yytext[0] ); } +. ; +. { addExpressionChar( yytext[0] ); } +. ; +. ; +. { + X; + return yytext[0]; + } +. { + X; + return ';'; + } +\n { + lineNo++; + } + + +%% + +#endif // TQMOC_YACC_CODE diff --git a/src/tqmoc/tqmoc.pro b/src/tqmoc/tqmoc.pro new file mode 100644 index 000000000..2a430efee --- /dev/null +++ b/src/tqmoc/tqmoc.pro @@ -0,0 +1,65 @@ +TEMPLATE = app +TARGET = tqmoc + +CONFIG = console release qtinc yacc lex_included yacc_no_name_mangle +DEFINES += QT_MOC TQT_NO_CODECS QT_LITE_UNICODE TQT_NO_COMPONENT \ + TQT_NO_STL TQT_NO_COMPRESS +win32:DEFINES += QT_NODLL +DESTDIR = ../../bin + + +INCLUDEPATH += $$QT_SOURCE_TREE/include ../tools . +DEPENDPATH += $$QT_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(QT_PRODUCT)|contains(QT_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 = $QT_SOURCE_TREE/util/mwerks_plugin + INCLUDEPATH += $$MWERKSDIR/Headers + LIBS += $$MWERKSDIR/Libraries/PluginLib4.shlb + SOURCES += mwerks_mac.cpp +} diff --git a/src/tqmoc/tqmoc.y b/src/tqmoc/tqmoc.y new file mode 100644 index 000000000..3309ee7b6 --- /dev/null +++ b/src/tqmoc/tqmoc.y @@ -0,0 +1,3607 @@ +/**************************************************************************** +** +** Parser and code generator for meta object compiler +** +** Created : 930417 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** 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 sales@trolltech.com. +** +** This file may be used under the terms of the Q 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), signals 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 "qplatformdefs.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 Q_OS_MACX +# undef OLD_DEBUG +# ifdef DEBUG +# define OLD_DEBUG DEBUG +# undef DEBUG +# endif +# define DEBUG 0 +# ifndef __IMAGECAPTURE__ +# define __IMAGECAPTURE__ +# endif +# include +# endif +# include "mwerks_mac.h" +#endif + +#include +#include +#include + +#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 tqvariant_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\"", tqvariant_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\"", tqvariant_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 tqvariant.cpp. If you change + one, change both. +*/ +static const int ntypes = 35; +static const char* const type_map[ntypes] = +{ + 0, + "TQMap", + "TQValueList", + "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 tqvariant_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 tqvariant_nameToType( type ) != 0; +} + +/* + Replaces '>>' with '> >' (as in 'TQValueList >'). + 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'. + */ + if ( leftType[i] == '&' || leftType[i] == '*' || + leftType[i] == '<' ) + break; + } + + name = argName; + isDefault = isDefaultArgument; + } + + TQCString leftType; + TQCString rightType; + TQCString name; + bool isDefault; +}; + +class ArgList : public TQPtrList { // 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 { // list of member functions +public: + FuncList( bool autoDelete = FALSE ) { setAutoDelete( autoDelete ); } + + FuncList find( const char* name ) + { + FuncList result; + for ( TQPtrListIterator 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 { // 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 TQ_PROPERTY construct cannot contain any commas, since + commas separate macro arguments. We therefore expect users + to type "TQMap" instead of "TQMap". For + coherence, we also expect the same for + TQValueList, the other template class supported by + TQVariant. + */ + if ( type == "TQMap" ) { + type = "TQMap"; + } else if ( type == "TQValueList" ) { + type = "TQValueList"; + } 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 { // 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 { // 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 + bool generatedCode; // no code generated + bool mocError; // moc parsing error occurred + bool hasVariantIncluded; //whether or not tqvariant.h was included yet + TQCString className; // name of parsed class + TQCString superClassName; // name of first super class + TQStrList multipleSuperClasses; // other superclasses + FuncList signals; // signal interface + FuncList slots; // slots interface + FuncList propfuncs; // all possible property access functions + FuncList funcs; // all parsed functions, including signals + 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 TQ_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 TQ_PROPERTYdetected; // TRUE if current class + // contains at least one TQ_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 tqmetaobject.h too +const int formatRevision = 26; // moc output format revision + +// if the flags change, you HAVE to change it in tqmetaobject.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(Q_OS_WIN32) +# include +# undef isatty +extern "C" int hack_isatty( int ) + { + return 0; + } +# define isatty hack_isatty +# else +# include +# 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 /* value types */ +%token INT_VAL +%token DOUBLE_VAL +%token STRING +%token 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 TQ_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 class_name +%type template_class_name +%type template_spec +%type opt_base_spec + +%type base_spec +%type base_list +%type qt_macro_name +%type base_specifier +%type access_specifier +%type fct_name +%type type_name +%type simple_type_names +%type simple_type_name +%type class_key +%type complete_class_name +%type qualified_class_name +%type elaborated_type_specifier +%type whatever + +%type argument_declaration_list +%type arg_declaration_list +%type arg_declaration_list_opt +%type abstract_decl_opt +%type abstract_decl +%type argument_declaration +%type opt_exception_argument +%type cv_qualifier_list_opt +%type cv_qualifier_list +%type cv_qualifier +%type decl_specifiers +%type decl_specifier +%type decl_specs_opt +%type decl_specs +%type type_specifier +%type fct_specifier +%type declarator +%type ptr_operator +%type ptr_operators +%type ptr_operators_opt + +%type 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 signals and slots.\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 signals and slots.\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 QT_DEF; } + ; + + +/***** r.17.5 (ARM p.395): Class Declarations *****/ + +class_specifier: full_class_head + '{' { BEGIN IN_CLASS; + classPLevel = 1; + } + opt_obj_member_list + '}' { BEGIN QT_DEF; } /*catch ';'*/ + | class_head { BEGIN QT_DEF; /* -- " -- */ + skipClass = TRUE; } + | class_head '*' IDENTIFIER { BEGIN QT_DEF; /* -- " -- */ + skipClass = TRUE; } + | class_head '&' IDENTIFIER { BEGIN QT_DEF; /* -- " -- */ + skipClass = TRUE; } + | class_head + '(' IDENTIFIER ')' /* TQt macro name */ + { BEGIN QT_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; + if ( g->className == "TQObject" ) + TQ_OBJECTdetected = TRUE; + } + | class_key + IDENTIFIER /* possible DLL EXPORT macro */ + class_name { g->className = $3; + 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 \"slots:\"." ); } + ; + +obj_member_area: qt_access_specifier { BEGIN QT_DEF; } + slot_area + | SIGNALS { BEGIN QT_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; + } + | TQ_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 ')' { + TQ_PROPERTYdetected = TRUE; + BEGIN tmpYYStart; + } + opt_property_candidates + | TQ_SETS { tmpYYStart = YY_START; BEGIN IN_PROPERTY; } + '(' qt_sets ')' { + TQ_PROPERTYdetected = TRUE; + BEGIN tmpYYStart; + } + opt_property_candidates + ; + +slot_area: SIGNALS ':' { tqmoc_err( "Signals cannot " + "have access specifiers" ); } + | SLOTS ':' opt_slot_declarations + | ':' { if ( tmpAccess == Public && TQ_PROPERTYdetected ) + BEGIN QT_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" + " signals or slots."); + } + | opt_virtual '~' fct_name + { tmpFunc->type = "void"; + tmpFunc->name = "~"; + tmpFunc->name += $3; + func_warn( "Destructors cannot be" + " signals or slots."); + } + | 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 QT_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 QT_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 ); + TQ_PROPERTYdetected = TRUE; + // Avoid duplicates + for( TQPtrListIterator 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(Q_OS_WIN32) +# include +# undef isatty +extern "C" int hack_isatty( int ) +{ + return 0; +} +# define isatty hack_isatty +# else +# include +# 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 + generatedCode = FALSE; // no code generated + mocError = FALSE; // moc parsing error occurred + hasVariantIncluded = FALSE; +} + + +parser_reg::~parser_reg() +{ + slots.clear(); + signals.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 Q_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; noutputFile = argv[++n]; + } else + g->outputFile = &opt[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[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[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[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] \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->mocError ) { + fprintf( stderr, ErrorFormatString" Warning: %s\n", g->fileName.data(), 0, + "No relevant classes found. No output generated." ); + } + + int ret = g->mocError ? 1 : 0; + cleanup(); + return ret; +} +#else +bool tqt_is_gui_used = FALSE; +#include +#include +#include +#ifdef Q_OS_MAC9 +# include +# include +# include +# include "Aliases.h" +#endif +#include "CWPluginErrors.h" +#include +#include "DropInCompilerLinker.h" +#include + +const unsigned char *p_str(const char *, int =-1); + +CWPluginContext g_ctx; + +tqmoc_status do_moc( 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->mocError || !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; + TQ_PROPERTYdetected = FALSE; + skipClass = FALSE; + templateClass = FALSE; + g->slots.clear(); + g->signals.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 definedClasses; // Classes defined in the namespace +}; + +TQPtrList 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 nameQualifier() +{ + TQPtrListIterator 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 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 TQ_SIGNAL and TQ_SLOT names. +// This function has been copied from tqobject.cpp. +// + +inline bool isSpace( char x ) +{ +#if defined(Q_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->mocError = 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 signals or slots."); + 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::tqt_invoke() rather than A::B::tqt_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) + 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 qualifiedClassName() +{ + return nameQualifier() + g->className; +} + +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_QUType_%s, %s, TQUParameter::Out }", uType(f->type).data(), uTypeExtra(f->type).data() ); + else + fprintf( out, "\t{ 0, &static_QUType_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_QUType_%s, %s, TQUParameter::%s }", + uType( type ).data(), uTypeExtra( type ).data(), + isInOut( type ) ? "InOut" : "In" ); + else + fprintf( out, "\t{ \"%s\", &static_QUType_%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 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 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 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 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 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 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 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 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 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 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 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 |= tqvariant_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 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 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 by: The TQt Meta Object Compiler version %d (TQt %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->signals.count() == 0 && g->slots.count() == 0 && g->props.count() == 0 && g->infos.count() == 0 ) + return; + if ( displayWarnings && (g->signals.count() + g->slots.count()) != 0 ) + tqmoc_err("The declaration of the class \"%s\" contains signals " + "or slots\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" + "\tsignals, slots or TQ_OBJECT." ); + return; + } + g->generatedCode = TRUE; + g->gen_count++; + + if ( g->gen_count == 1 ) { // first class to be generated + 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[i]; + fprintf( out, hdr1, (const char*)qualifiedClassName(),(const char*)fn); + fprintf( out, hdr2, formatRevision, TQT_VERSION_STR ); + fprintf( out, "%s", hdr3 ); + fprintf( out, "%s", hdr4 ); + + if ( !g->noInclude ) { + /* + The header file might be a TQt header file with + TQT_NO_COMPAT macros around signals, slots 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 <%sntqapplication.h>\n\n", (const char*)g->qtPath ); + fprintf( out, "#include <%sprivate/tqucomextra_p.h>\n", (const char*)g->qtPath ); + fprintf( out, "#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_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 \"(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->slots.first(); f && !needToIncludeVariant; f=g->slots.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::fromLatin1( 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}\n" ); + fprintf( out, "#ifdef TQT_THREAD_SUPPORT\n if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->lock();\n" ); + fprintf( out, " if ( metaObj ) {\n\tif (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();\n\treturn metaObj;\n }\n#endif // TQT_THREAD_SUPPORT\n" ); + if ( isTQObject ) + fprintf( out, " TQMetaObject* parentObject = staticTQtMetaObject();\n" ); + else if ( !g->superClassName.isEmpty() ) + fprintf( out, " TQMetaObject* parentObject = %s::staticMetaObject();\n", (const char*)g->superClassName ); + 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 slots +// + int n_enums = generateEnums(); + +// +// Build slots array in staticMetaObject() +// + generateFuncs( &g->slots, "slot", Slot_Num ); + +// +// Build signals array in staticMetaObject() +// + generateFuncs( &g->signals, "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->slots.count() ) + fprintf( out, "\tslot_tbl, %d,\n", g->slots.count() ); + else + fprintf( out, "\t0, 0,\n" ); + + if ( g->signals.count() ) + fprintf( out, "\tsignal_tbl, %d,\n", g->signals.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, "#ifdef TQT_THREAD_SUPPORT\n if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();\n#endif // TQT_THREAD_SUPPORT\n" ); + fprintf( out, " return metaObj;\n}\n" ); + +// +// End of function staticMetaObject() +// + +// +// Generate smart cast function +// + fprintf( out, "\nvoid* %s::tqt_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 %s::tqt_cast( clname );\n", + (const char*)purestSuperClassName() ); + else + fprintf( out, " return 0;\n" ); + fprintf( out, "}\n" ); + +// +// Generate internal signal functions +// + Function *f; + f = g->signals.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// TQ_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( staticMetaObject()->signalOffset() + %d", 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 ( signalsBlocked() )\n\treturn%s;\n", hasReturnValue ? " something" : "" ); + fprintf( out, " TQConnectionList *clist = receivers( 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_QUType_%s.set(o,something);\n", utype.data() ); + } else if ( uType( f->type ) == "varptr" ) { + fprintf( out, " static_QUType_varptr.set(o,&something);\n" ); + } else { + fprintf( out, " static_QUType_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_QUType_%s.set(o+%d,t%d);\n", utype.data(), offset+1, offset ); + } else if ( uType( type ) == "varptr" ) { + fprintf( out, " static_QUType_varptr.set(o+%d,&t%d);\n", offset+1, offset ); + } else { + fprintf( out, " static_QUType_ptr.set(o+%d,&t%d);\n", offset+1, offset ); + } + a = f->args->next(); + offset++; + } + } + fprintf( out, " o[%d].isLastObject = true;\n", f->args->count() + 0 ); + 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_QUType_%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_QUType_ptr.get(o+%d);\n", offset, offset, type.data(), offset+1 ); + else + fprintf( out, " t%d = static_QUType_%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_QUType_%s.get(o);\n", f->type.data(), utype.data() ); + else + fprintf( out, " return static_QUType_%s.get(o);\n", utype.data() ); + } + + fprintf( out, "}\n" ); + } + + f = g->signals.next(); + sigindex++; + } + + +// +// Generate internal tqt_invoke() function +// + fprintf( out, "\nbool %s::tqt_invoke( int _id, TQUObject* _o )\n{\n", qualifiedClassName().data() ); + + if( !g->slots.isEmpty() ) { + fprintf( out, " switch ( _id - staticMetaObject()->slotOffset() ) {\n" ); + int slotindex = -1; + for ( f = g->slots.first(); f; f = g->slots.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_QUType_%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_QUType_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_QUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); + else + fprintf( out, "(%s)static_QUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); + } else { + TQCString castType = castToUType( type ); + if(castType == type) + fprintf( out, "(%s)(*((%s*)static_QUType_ptr.get(_o+%d)))", type.data(), + castType.data(), offset+1 ); + else + fprintf( out, "(%s)*((%s*)static_QUType_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 %s::tqt_invoke( _id, _o );\n", + (const char *) purestSuperClassName() ); + } else { + fprintf( out, "\treturn FALSE;\n" ); + } + fprintf( out, " }\n" ); + fprintf( out, " return TRUE;\n}\n" ); + } else { + if ( !g->superClassName.isEmpty() && !isTQObject ) + fprintf( out, " return %s::tqt_invoke(_id,_o);\n}\n", + (const char *) purestSuperClassName() ); + else + fprintf( out, " return FALSE;\n}\n" ); + } + + +// +// Generate internal tqt_emit() function +// + fprintf( out, "\nbool %s::tqt_emit( int _id, TQUObject* _o )\n{\n", qualifiedClassName().data() ); + + if ( !g->signals.isEmpty() ) { + fprintf( out, " switch ( _id - staticMetaObject()->signalOffset() ) {\n" ); + int signalindex = -1; + for ( f = g->signals.first(); f; f = g->signals.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_QUType_%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_QUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); + else + fprintf( out, "(%s)static_QUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); + } else { + TQCString castType = castToUType( type ); + if(castType == type) + fprintf( out, "(%s)(*((%s*)static_QUType_ptr.get(_o+%d)))", type.data(), + castType.data(), offset+1 ); + else + fprintf( out, "(%s)*((%s*)static_QUType_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 %s::tqt_emit(_id,_o);\n", + (const char *) purestSuperClassName() ); + else + fprintf( out, "\treturn FALSE;\n" ); + fprintf( out, " }\n" ); + fprintf( out, " return TRUE;\n}\n" ); + } else { + if ( !g->superClassName.isEmpty() && !isTQObject ) + fprintf( out, " return %s::tqt_emit(_id,_o);\n}\n", + (const char *) purestSuperClassName() ); + else + fprintf( out, " return FALSE;\n}\n" ); + } + + + fprintf( out, "#ifndef TQT_NO_PROPERTIES\n" ); +// +// Generate internal tqt_property() functions +// + + fprintf( out, "\nbool %s::tqt_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 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" ) + fprintf( out, "v->asMap()" ); + else if ( type == "TQValueList" ) + 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() ); break;\n", + it.current()->getfunc->name.data(), + !isVariantType( it.current()->type ) ? "(int)" : "", + it.current()->getfunc->name.data()); + else + fprintf( out, "\tcase 1: *v = TQVariant( %sthis->%s() ); break;\n", + !isVariantType( it.current()->type ) ? "(int)" : "", + it.current()->getfunc->name.data()); + } 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 %s::tqt_property( id, f, v );\n", + (const char *) purestSuperClassName() ); + else + fprintf( out, "\treturn FALSE;\n" ); + fprintf( out, " }\n" ); + fprintf( out, " return TRUE;\n" ); + + if ( need_resolve ) + fprintf( out, "resolve:\n return %s::tqt_property( staticMetaObject()->resolveProperty(id), f, v );\n", + (const char *) purestSuperClassName() ); + fprintf( out, "}\n" ); + } else { + if ( !g->superClassName.isEmpty() && !isTQObject ) + fprintf( out, " return %s::tqt_property( id, f, v);\n}\n", + (const char *) purestSuperClassName() ); + else + fprintf( out, " return FALSE;\n}\n" ); + } + + fprintf( out, "\nbool %s::tqt_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 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->signals.append( tmpFunc ); + break; + } else { + if ( m == SlotMember ) + g->slots.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/src/tqmoc/tqmoc_lex.cpp b/src/tqmoc/tqmoc_lex.cpp new file mode 100644 index 000000000..aba3d5b48 --- /dev/null +++ b/src/tqmoc/tqmoc_lex.cpp @@ -0,0 +1,3315 @@ + +#line 3 "lex.yy.c" + +#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 +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . 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 +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[617] = + { 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, 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, 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, + 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, 7, 99, 99, 99, 96, 99, 86, + 99, 97, 99, 99, 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 21, 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, 99, 78, 67, 85, 99, + + 99, 99, 99, 99, 106, 106, 106, 106, 106, 106, + 106, 106, 17, 106, 107, 107, 100, 100, 38, 134, + 105, 105, 99, 99, 99, 99, 99, 12, 99, 95, + 99, 99, 88, 99, 99, 6, 99, 64, 99, 71, + 99, 106, 106, 106, 106, 106, 27, 19, 106, 20, + 107, 107, 100, 100, 134, 134, 105, 4, 99, 11, + 99, 99, 99, 99, 99, 91, 99, 66, 94, 79, + 73, 106, 26, 106, 106, 106, 106, 107, 31, 100, + 100, 133, 2, 99, 5, 99, 99, 99, 98, 89, + 106, 23, 106, 106, 18, 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, 28, 62, 63, 64, 65, 66, 67, 68, + 69, 28, 70, 1, 71, 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[72] = + { 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, 1, + 1 + } ; + +static yyconst flex_int16_t yy_base[644] = + { 0, + 0, 3, 16, 5, 87, 9, 158, 229, 300, 176, + 370, 440, 181, 510, 249, 555, 207, 211, 600, 645, + 252, 281, 267, 383, 691, 185, 389, 402, 1191, 1192, + 178, 1192, 183, 220, 1139, 1192, 184, 372, 185, 0, + 1132, 1140, 1135, 1123, 416, 1134, 1192, 198, 1139, 243, + 409, 195, 414, 1166, 0, 1146, 1134, 196, 376, 1120, + 204, 229, 1120, 1118, 1112, 1128, 1114, 214, 1122, 383, + 400, 317, 339, 454, 1122, 1192, 204, 422, 399, 0, + 1136, 370, 240, 1192, 1192, 459, 1120, 1192, 461, 429, + 458, 0, 1113, 1121, 1116, 1104, 1192, 1192, 470, 1115, + + 1192, 475, 1192, 1192, 1192, 469, 1192, 1192, 1192, 1192, + 485, 1114, 1192, 478, 1192, 1192, 1192, 479, 1192, 1192, + 1192, 491, 1113, 1192, 493, 1192, 1192, 1192, 488, 1192, + 1192, 1192, 497, 1112, 1192, 502, 1117, 496, 1192, 1192, + 523, 1110, 1192, 505, 1115, 1192, 1192, 507, 528, 1108, + 1192, 530, 514, 533, 1107, 1192, 535, 530, 539, 1106, + 1192, 1192, 0, 1131, 1130, 427, 1117, 1108, 1192, 1192, + 1192, 544, 1192, 0, 546, 0, 0, 1100, 440, 1192, + 1147, 0, 1102, 1091, 1090, 1091, 1101, 546, 1138, 1137, + 758, 1131, 555, 560, 565, 1192, 0, 1095, 1085, 1082, + + 1075, 1090, 1089, 1077, 1070, 1069, 1069, 1072, 1075, 318, + 1071, 1065, 1070, 1075, 522, 1077, 1071, 1064, 1069, 1062, + 505, 1063, 1058, 1058, 427, 1062, 1055, 527, 465, 1192, + 1112, 0, 1068, 529, 1065, 1059, 1052, 470, 1192, 1107, + 0, 1062, 1051, 1050, 1051, 1061, 582, 588, 1060, 588, + 592, 0, 1066, 363, 1066, 1068, 1072, 1055, 592, 0, + 1046, 1035, 1045, 1035, 1036, 1192, 1087, 1086, 1085, 600, + 603, 1084, 1083, 1082, 1081, 1080, 1079, 1078, 1077, 1076, + 1192, 607, 601, 1023, 0, 1021, 1018, 1016, 1015, 1028, + 1018, 1023, 1026, 1021, 1016, 0, 1017, 1022, 1017, 1006, + + 1001, 1002, 1008, 1008, 1001, 1003, 997, 996, 994, 997, + 997, 1004, 995, 998, 994, 988, 1000, 1002, 607, 983, + 984, 990, 987, 981, 981, 991, 981, 982, 1011, 1015, + 1013, 1008, 999, 996, 978, 970, 969, 974, 976, 1192, + 1192, 1192, 1192, 645, 1192, 1192, 1192, 1192, 1192, 1192, + 1192, 1192, 1192, 1022, 997, 994, 584, 989, 1000, 967, + 0, 0, 960, 958, 964, 0, 958, 955, 959, 958, + 0, 967, 952, 966, 965, 960, 955, 947, 945, 564, + 945, 951, 956, 948, 937, 952, 943, 947, 946, 934, + 0, 934, 966, 963, 615, 958, 969, 945, 940, 935, + + 942, 926, 925, 924, 929, 931, 957, 0, 944, 947, + 956, 955, 920, 0, 917, 929, 0, 1192, 1192, 955, + 935, 944, 948, 938, 932, 914, 0, 0, 917, 909, + 0, 916, 914, 908, 899, 888, 882, 891, 890, 869, + 0, 875, 876, 0, 876, 854, 862, 0, 850, 0, + 838, 0, 848, 832, 861, 785, 793, 796, 785, 779, + 752, 765, 764, 756, 0, 0, 751, 762, 0, 776, + 0, 769, 781, 0, 752, 754, 737, 762, 767, 773, + 760, 761, 757, 735, 0, 0, 0, 0, 741, 744, + 731, 738, 725, 0, 736, 724, 0, 0, 0, 722, + + 732, 732, 726, 725, 743, 748, 754, 741, 742, 738, + 723, 710, 0, 708, 722, 705, 747, 746, 0, 721, + 714, 638, 650, 649, 663, 648, 659, 0, 631, 0, + 632, 619, 0, 628, 617, 0, 626, 0, 626, 0, + 624, 637, 636, 650, 635, 646, 0, 0, 618, 0, + 619, 616, 645, 644, 618, 584, 610, 0, 632, 0, + 618, 626, 606, 593, 586, 0, 583, 0, 0, 0, + 0, 604, 0, 592, 599, 590, 560, 548, 0, 541, + 534, 1192, 0, 529, 0, 536, 516, 497, 0, 0, + 489, 0, 478, 420, 0, 0, 429, 412, 394, 378, + + 347, 0, 272, 264, 223, 0, 0, 230, 0, 0, + 184, 0, 0, 0, 0, 1192, 826, 832, 838, 844, + 850, 856, 862, 868, 874, 880, 886, 888, 894, 900, + 902, 908, 910, 916, 918, 924, 930, 932, 938, 944, + 950, 953, 958 + } ; + +static yyconst flex_int16_t yy_def[644] = + { 0, + 617, 617, 616, 3, 616, 5, 618, 618, 616, 9, + 619, 619, 620, 620, 621, 621, 622, 622, 623, 623, + 624, 624, 625, 625, 616, 25, 617, 617, 616, 616, + 616, 616, 616, 616, 626, 616, 616, 627, 616, 628, + 628, 628, 628, 628, 616, 626, 616, 616, 629, 630, + 616, 616, 616, 616, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 616, 626, 616, 616, 632, 616, 633, + 633, 633, 633, 616, 616, 616, 626, 616, 616, 634, + 616, 635, 635, 635, 635, 635, 616, 616, 616, 626, + + 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 626, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 626, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 616, 626, 616, 616, 636, 616, 616, 616, + 616, 626, 616, 616, 637, 616, 616, 616, 616, 626, + 616, 616, 616, 616, 626, 616, 616, 616, 616, 626, + 616, 616, 638, 638, 638, 638, 638, 639, 616, 616, + 616, 616, 616, 640, 616, 626, 626, 626, 627, 616, + 627, 628, 628, 628, 628, 628, 629, 629, 616, 616, + 641, 616, 616, 616, 616, 616, 631, 631, 631, 631, + + 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 631, 631, 631, 631, 631, 632, 616, + 632, 633, 633, 633, 633, 633, 633, 634, 616, 634, + 635, 635, 635, 635, 635, 636, 636, 616, 637, 637, + 616, 638, 638, 638, 638, 638, 638, 639, 639, 640, + 626, 628, 628, 628, 628, 616, 616, 616, 616, 616, + 616, 616, 616, 616, 616, 616, 616, 616, 616, 642, + 616, 616, 631, 631, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, + + 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 631, 631, 631, 631, 631, 633, 633, + 633, 633, 633, 633, 635, 635, 635, 635, 638, 638, + 638, 638, 638, 638, 626, 628, 628, 628, 628, 616, + 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 616, 642, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, + 631, 631, 633, 633, 633, 633, 633, 633, 633, 633, + + 633, 633, 635, 635, 635, 635, 638, 638, 638, 638, + 638, 638, 626, 628, 628, 628, 628, 616, 616, 631, + 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 631, 633, 633, 633, 633, 633, 633, + 633, 633, 633, 633, 633, 635, 635, 635, 635, 638, + 638, 638, 638, 638, 626, 628, 628, 631, 631, 631, + 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, + + 631, 631, 631, 631, 633, 633, 633, 633, 633, 633, + 633, 633, 633, 633, 635, 635, 638, 638, 638, 643, + 628, 628, 631, 631, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, + 631, 633, 633, 633, 633, 633, 633, 633, 633, 633, + 635, 635, 638, 638, 643, 643, 628, 628, 631, 631, + 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, + 631, 633, 633, 633, 633, 633, 633, 635, 635, 638, + 638, 616, 628, 631, 631, 631, 631, 631, 631, 631, + 633, 633, 633, 633, 633, 635, 638, 638, 631, 631, + + 631, 631, 633, 633, 633, 638, 638, 631, 631, 631, + 633, 633, 633, 631, 633, 0, 616, 616, 616, 616, + 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 616 + } ; + +static yyconst flex_int16_t yy_nxt[1264] = + { 0, + 616, 31, 31, 32, 31, 34, 32, 45, 35, 616, + 46, 74, 33, 616, 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, 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, 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, 615, 82, 138, + 83, 172, 175, 138, 120, 176, 121, 84, 85, 76, + 77, 86, 32, 78, 87, 76, 76, 76, 76, 76, + 76, 79, 76, 76, 76, 76, 76, 76, 76, 190, + 125, 125, 32, 152, 152, 32, 126, 127, 200, 128, + 201, 129, 206, 614, 153, 613, 130, 81, 157, 157, + 32, 207, 76, 76, 76, 215, 139, 140, 216, 158, + 139, 140, 152, 154, 32, 208, 155, 191, 612, 82, + 209, 83, 131, 153, 132, 236, 237, 611, 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, 95, 96, 92, 92, 92, 92, 97, + 98, 102, 102, 32, 295, 225, 180, 103, 104, 226, + 105, 296, 106, 330, 157, 159, 32, 107, 160, 610, + 31, 31, 32, 168, 227, 158, 169, 170, 228, 171, + + 331, 33, 609, 31, 34, 32, 168, 35, 173, 169, + 170, 174, 171, 108, 33, 109, 181, 172, 175, 608, + 192, 176, 193, 193, 193, 194, 230, 195, 195, 195, + 202, 234, 203, 239, 235, 204, 607, 218, 219, 220, + 110, 102, 111, 32, 180, 112, 221, 103, 104, 255, + 105, 222, 106, 606, 223, 172, 175, 107, 605, 176, + 172, 175, 172, 172, 176, 256, 231, 173, 224, 230, + 174, 172, 175, 240, 239, 176, 172, 172, 173, 172, + 172, 174, 313, 108, 181, 109, 172, 175, 173, 314, + 176, 174, 172, 175, 172, 172, 176, 173, 172, 175, + + 174, 604, 176, 172, 172, 173, 248, 248, 174, 231, + 110, 114, 122, 32, 240, 123, 173, 115, 116, 174, + 117, 603, 118, 173, 172, 175, 174, 119, 176, 248, + 251, 172, 172, 176, 172, 175, 172, 172, 176, 173, + 172, 175, 174, 602, 176, 172, 172, 172, 175, 187, + 187, 176, 308, 120, 601, 121, 125, 133, 32, 600, + 134, 599, 126, 127, 598, 128, 309, 129, 193, 193, + 193, 597, 130, 282, 282, 282, 194, 301, 195, 195, + 195, 302, 317, 318, 320, 246, 246, 582, 321, 248, + 248, 249, 249, 248, 251, 258, 258, 176, 131, 596, + + 132, 144, 144, 32, 145, 422, 343, 146, 147, 345, + 595, 442, 148, 344, 344, 443, 344, 344, 146, 147, + 282, 282, 282, 355, 423, 356, 594, 593, 556, 393, + 592, 394, 591, 590, 357, 358, 457, 589, 359, 588, + 395, 396, 587, 146, 397, 147, 144, 149, 32, 145, + 150, 418, 146, 147, 586, 458, 585, 148, 344, 344, + 584, 583, 556, 146, 147, 581, 580, 579, 578, 577, + 576, 575, 574, 573, 572, 571, 570, 569, 568, 567, + 566, 565, 564, 563, 562, 561, 560, 559, 146, 558, + 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, + 30, 30, 268, 557, 269, 556, 554, 553, 552, 551, + 550, 270, 271, 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, 523, + + 522, 521, 272, 520, 519, 273, 274, 518, 517, 516, + 275, 515, 514, 513, 512, 511, 276, 510, 509, 277, + 508, 278, 507, 279, 506, 280, 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, 505, 177, 177, 177, 177, 179, 504, 179, 179, + 179, 179, 182, 182, 187, 503, 502, 187, 187, 187, + + 189, 501, 189, 189, 189, 189, 197, 197, 229, 500, + 229, 229, 229, 229, 232, 232, 238, 499, 238, 238, + 238, 238, 241, 241, 246, 498, 497, 246, 246, 246, + 249, 496, 495, 249, 249, 249, 252, 252, 258, 494, + 493, 258, 258, 258, 260, 492, 260, 260, 260, 260, + 267, 491, 267, 267, 267, 267, 354, 354, 555, 490, + 555, 555, 555, 555, 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, 456, 455, 454, 453, 452, + + 451, 450, 449, 448, 447, 446, 445, 444, 441, 440, + 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, + 429, 428, 427, 426, 425, 424, 421, 420, 419, 417, + 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, + 406, 405, 404, 403, 402, 401, 400, 399, 398, 392, + 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, + 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, + 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, + 361, 360, 340, 353, 352, 351, 350, 349, 348, 347, + 346, 342, 341, 340, 339, 338, 337, 336, 335, 259, + + 334, 333, 332, 329, 250, 247, 328, 327, 326, 325, + 238, 324, 323, 322, 319, 229, 316, 315, 312, 311, + 310, 307, 306, 305, 304, 303, 300, 299, 298, 297, + 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, + 284, 283, 281, 266, 266, 188, 265, 264, 263, 262, + 179, 261, 259, 257, 254, 253, 178, 178, 178, 250, + 178, 247, 178, 178, 178, 178, 245, 244, 243, 242, + 178, 233, 178, 217, 214, 213, 212, 211, 210, 205, + 199, 198, 196, 188, 178, 186, 185, 184, 183, 178, + 616, 29, 616, 616, 616, 616, 616, 616, 616, 616, + + 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 616 + } ; + +static yyconst flex_int16_t yy_chk[1264] = + { 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, 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, 611, 7, 17, + 7, 34, 34, 18, 13, 34, 13, 7, 7, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 50, + 15, 15, 15, 21, 21, 21, 15, 15, 58, 15, + 58, 15, 61, 608, 21, 605, 15, 8, 23, 23, + 23, 61, 8, 8, 8, 68, 17, 17, 68, 23, + 18, 18, 22, 22, 22, 62, 22, 50, 604, 8, + 62, 8, 15, 22, 15, 83, 83, 603, 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, 11, 11, 11, 210, 72, 38, 11, 11, 72, + 11, 210, 11, 254, 24, 24, 24, 11, 24, 601, + 27, 27, 27, 27, 73, 24, 27, 27, 73, 27, + + 254, 27, 600, 28, 28, 28, 28, 28, 79, 28, + 28, 79, 28, 11, 28, 11, 38, 45, 45, 599, + 51, 45, 51, 51, 51, 53, 78, 53, 53, 53, + 59, 82, 59, 90, 82, 59, 598, 70, 70, 70, + 11, 12, 12, 12, 179, 12, 70, 12, 12, 166, + 12, 71, 12, 597, 71, 74, 74, 12, 594, 74, + 86, 86, 89, 89, 86, 166, 78, 91, 71, 229, + 91, 99, 99, 90, 238, 99, 102, 102, 106, 114, + 114, 106, 225, 12, 179, 12, 111, 111, 118, 225, + 111, 118, 122, 122, 125, 125, 122, 129, 133, 133, + + 129, 593, 133, 136, 136, 138, 144, 144, 138, 229, + 12, 14, 14, 14, 238, 14, 148, 14, 14, 148, + 14, 591, 14, 153, 141, 141, 153, 14, 141, 149, + 149, 152, 152, 149, 154, 154, 157, 157, 154, 158, + 159, 159, 158, 588, 159, 172, 172, 175, 175, 188, + 188, 175, 221, 14, 587, 14, 16, 16, 16, 586, + 16, 584, 16, 16, 581, 16, 221, 16, 193, 193, + 193, 580, 16, 194, 194, 194, 195, 215, 195, 195, + 195, 215, 228, 228, 234, 247, 247, 556, 234, 248, + 248, 250, 250, 251, 251, 259, 259, 251, 16, 578, + + 16, 19, 19, 19, 19, 357, 270, 19, 19, 271, + 577, 380, 19, 270, 270, 380, 271, 271, 19, 19, + 282, 282, 282, 283, 357, 283, 576, 575, 556, 319, + 574, 319, 572, 567, 283, 283, 395, 565, 283, 564, + 319, 319, 563, 19, 319, 19, 20, 20, 20, 20, + 20, 344, 20, 20, 562, 395, 561, 20, 344, 344, + 559, 557, 555, 20, 20, 554, 553, 552, 551, 549, + 546, 545, 544, 543, 542, 541, 539, 537, 535, 534, + 532, 531, 529, 527, 526, 525, 524, 523, 20, 522, + 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, 191, 521, 191, 520, 518, 517, 516, 515, + 514, 191, 191, 512, 511, 510, 509, 508, 507, 506, + 505, 504, 503, 502, 501, 500, 496, 495, 493, 492, + 491, 490, 489, 484, 483, 482, 481, 480, 479, 478, + + 477, 476, 191, 475, 473, 191, 191, 472, 470, 468, + 191, 467, 464, 463, 462, 461, 191, 460, 459, 191, + 458, 191, 457, 191, 456, 191, 617, 617, 617, 617, + 617, 617, 618, 618, 618, 618, 618, 618, 619, 619, + 619, 619, 619, 619, 620, 620, 620, 620, 620, 620, + 621, 621, 621, 621, 621, 621, 622, 622, 622, 622, + 622, 622, 623, 623, 623, 623, 623, 623, 624, 624, + 624, 624, 624, 624, 625, 625, 625, 625, 625, 625, + 626, 455, 626, 626, 626, 626, 627, 454, 627, 627, + 627, 627, 628, 628, 629, 453, 451, 629, 629, 629, + + 630, 449, 630, 630, 630, 630, 631, 631, 632, 447, + 632, 632, 632, 632, 633, 633, 634, 446, 634, 634, + 634, 634, 635, 635, 636, 445, 443, 636, 636, 636, + 637, 442, 440, 637, 637, 637, 638, 638, 639, 439, + 438, 639, 639, 639, 640, 437, 640, 640, 640, 640, + 641, 436, 641, 641, 641, 641, 642, 642, 643, 435, + 643, 643, 643, 643, 434, 433, 432, 430, 429, 426, + 425, 424, 423, 422, 421, 420, 416, 415, 413, 412, + 411, 410, 409, 407, 406, 405, 404, 403, 402, 401, + 400, 399, 398, 397, 396, 394, 393, 392, 390, 389, + + 388, 387, 386, 385, 384, 383, 382, 381, 379, 378, + 377, 376, 375, 374, 373, 372, 370, 369, 368, 367, + 365, 364, 363, 360, 359, 358, 356, 355, 354, 339, + 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, + 328, 327, 326, 325, 324, 323, 322, 321, 320, 318, + 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, + 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, + 297, 295, 294, 293, 292, 291, 290, 289, 288, 287, + 286, 284, 280, 279, 278, 277, 276, 275, 274, 273, + 272, 269, 268, 267, 265, 264, 263, 262, 261, 258, + + 257, 256, 255, 253, 249, 246, 245, 244, 243, 242, + 240, 237, 236, 235, 233, 231, 227, 226, 224, 223, + 222, 220, 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, 81, 75, 69, 67, 66, 65, 64, 63, 60, + 57, 56, 54, 49, 46, 44, 43, 42, 41, 35, + 29, 616, 616, 616, 616, 616, 616, 616, 616, 616, + + 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, + 616, 616, 616 + } ; + +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 "moc.l" +/**************************************************************************** +** +** Lexical analyzer for meta object compiler +** +** Created : 930417 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** 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 sales@trolltech.com. +** +** This file may be used under the terms of the Q 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 "moc.l" +#ifdef TQMOC_YACC_CODE + +#ifdef TQMOC_MWERKS_PLUGIN +#ifdef Q_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 +#include + +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 + MOC_SKIP_BEGIN is encountered */ +int skipLevel = 0; /* Depth of MOC_SKIP_BEGINs */ + +class TQString; + +extern void addExpressionChar( const char ); +extern void addExpressionString( const char * ); +extern void tqmoc_warn( const char *msg ); + +#line 1053 "lex.yy.c" + +#define INITIAL 0 +#define OUTSIDE 1 +#define QT_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 +#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 +{ + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + +#line 113 "moc.l" + + +#line 1259 "lex.yy.c" + + 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 + { + 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 >= 617 ) + 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] != 1192 ); + +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 "moc.l" +{ X; + BEGIN QT_DEF; + return CLASS; } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 118 "moc.l" +{ X; + BEGIN QT_DEF; + return NAMESPACE; } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 121 "moc.l" +{ X; + BEGIN QT_DEF; + return USING; } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 124 "moc.l" +{ X; + BEGIN QT_DEF; + return TEMPLATE; } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 127 "moc.l" +{ X; return TQ_OBJECT; } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 128 "moc.l" +{ X; return SIGNALS; } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 129 "moc.l" +{ X; return SLOTS; } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 130 "moc.l" +{ X; return TQ_CLASSINFO; } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 131 "moc.l" +{ X; return TQ_PROPERTY; } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 132 "moc.l" +{ X; return TQ_OVERRIDE; } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 133 "moc.l" +{ X; return TQ_ENUMS; } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 134 "moc.l" +{ X; return TQ_SETS; } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 136 "moc.l" +{ fctLevel++;Y; } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 137 "moc.l" +{ fctLevel--;Y;if (fctLevel==0){X;return '}';}} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 138 "moc.l" +{ classPLevel++;Y; } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 139 "moc.l" +{ classPLevel--;Y;if (classPLevel == 0) + {X;return '}';} } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 141 "moc.l" +{ X;if( classPLevel == 1 ) return PUBLIC; } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 142 "moc.l" +{ X;if( classPLevel == 1 ) return PROTECTED; } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 143 "moc.l" +{ X;if( classPLevel == 1 ) return PRIVATE; } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 144 "moc.l" +{ X;if( classPLevel == 1 ) return SIGNALS; } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 145 "moc.l" +{ X;if( classPLevel == 1 ) return SLOTS; } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 146 "moc.l" +{ X;if( classPLevel == 1 ) return TQ_CLASSINFO; } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 147 "moc.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 "moc.l" +{ X;if( classPLevel == 1 ) return TQ_PROPERTY; } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 154 "moc.l" +{ X;if( classPLevel == 1 ) return TQ_OVERRIDE; } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 155 "moc.l" +{ X;if( classPLevel == 1 ) return TQ_ENUMS; } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 156 "moc.l" +{ X;if( classPLevel == 1 ) return TQ_SETS; } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 158 "moc.l" +{ namespacePLevel++;Y; } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 159 "moc.l" +{ namespacePLevel--;Y;if (namespacePLevel == 0) + {X;return '}';}} + YY_BREAK +case 30: +YY_RULE_SETUP +#line 161 "moc.l" +{ X; + BEGIN QT_DEF; + return CLASS; } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 164 "moc.l" +{ X; + BEGIN QT_DEF; + return TEMPLATE; } + YY_BREAK +case 32: +YY_RULE_SETUP +#line 167 "moc.l" +{ X; + BEGIN QT_DEF; + return NAMESPACE; } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 170 "moc.l" +{ X; + BEGIN QT_DEF; + return USING; } + YY_BREAK +case 34: +YY_RULE_SETUP +#line 174 "moc.l" +{ X; return '('; } + YY_BREAK +case 35: +YY_RULE_SETUP +#line 175 "moc.l" +{ X; return ')'; } + YY_BREAK +case 36: +YY_RULE_SETUP +#line 176 "moc.l" +{ X; return READ; } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 177 "moc.l" +{ X; return WRITE; } + YY_BREAK +case 38: +YY_RULE_SETUP +#line 178 "moc.l" +{ X; return STORED; } + YY_BREAK +case 39: +YY_RULE_SETUP +#line 179 "moc.l" +{ X; return RESET; } + YY_BREAK +case 40: +YY_RULE_SETUP +#line 180 "moc.l" +{ X; return DESIGNABLE; } + YY_BREAK +case 41: +YY_RULE_SETUP +#line 181 "moc.l" +{ X; return SCRIPTABLE; } + YY_BREAK +case 42: +YY_RULE_SETUP +#line 184 "moc.l" +{ expLevel++;X; } + YY_BREAK +case 43: +YY_RULE_SETUP +#line 185 "moc.l" +{ expLevel--;Y;if (expLevel == 0) + { X; BEGIN QT_DEF; return ')';} } + YY_BREAK +case 44: +YY_RULE_SETUP +#line 187 "moc.l" +{ expLevel++;X; } + YY_BREAK +case 45: +YY_RULE_SETUP +#line 188 "moc.l" +{ expLevel--;X;if (expLevel == 0) + { X; BEGIN QT_DEF; return ']';} } + YY_BREAK +case 46: +YY_RULE_SETUP +#line 190 "moc.l" +{ if (expLevel == 0) + { X; BEGIN QT_DEF; return ',' ;} } + YY_BREAK +case 47: +YY_RULE_SETUP +#line 192 "moc.l" +{ if (expLevel == 0) + { X; BEGIN QT_DEF; return ';' ;} } + YY_BREAK +case 48: +YY_RULE_SETUP +#line 194 "moc.l" +{ expLevel++;X; } + YY_BREAK +case 49: +YY_RULE_SETUP +#line 195 "moc.l" +{ expLevel--;Y;if (expLevel == 0) + { X; BEGIN QT_DEF; return ')';} } + YY_BREAK +case 50: +YY_RULE_SETUP +#line 197 "moc.l" +{ expLevel++;X; } + YY_BREAK +case 51: +YY_RULE_SETUP +#line 198 "moc.l" +{ expLevel--;X;if (expLevel == 0) + { X; BEGIN QT_DEF; return ']';} } + YY_BREAK +case 52: +YY_RULE_SETUP +#line 200 "moc.l" +{ if (expLevel <= 1) + { X; BEGIN QT_DEF; return ',' ;} } + YY_BREAK +case 53: +YY_RULE_SETUP +#line 202 "moc.l" +{ if (expLevel == 0) + { X; BEGIN QT_DEF; return ';' ;} } + YY_BREAK +case 54: +YY_RULE_SETUP +#line 204 "moc.l" +{ enumLevel++;X; } + YY_BREAK +case 55: +YY_RULE_SETUP +#line 205 "moc.l" +{ enumLevel--;X; } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 206 "moc.l" +{ enumLevel++;X; } + YY_BREAK +case 57: +YY_RULE_SETUP +#line 207 "moc.l" +{ enumLevel--;X } + YY_BREAK +case 58: +YY_RULE_SETUP +#line 208 "moc.l" +{ if (enumLevel == 0) + { X; BEGIN QT_DEF; return ',' ;} } + YY_BREAK +case 59: +YY_RULE_SETUP +#line 210 "moc.l" +{ if (enumLevel == 0) + { X; BEGIN QT_DEF; return ';' ;} } + YY_BREAK +case 60: +YY_RULE_SETUP +#line 212 "moc.l" +{ if (enumLevel == 0) + { X; BEGIN QT_DEF; return '}' ;} } + YY_BREAK +case 61: +YY_RULE_SETUP +#line 214 "moc.l" +{ templLevel++; + Y; + addExpressionChar( yytext[0] ); + } + YY_BREAK +case 62: +YY_RULE_SETUP +#line 218 "moc.l" +{ templLevel--; + Y; + if ( templLevel == 0 ) { + X; + BEGIN QT_DEF; + return yytext[0]; + } else { + addExpressionChar( yytext[0] ); + } + } + YY_BREAK +case 63: +YY_RULE_SETUP +#line 228 "moc.l" +{ X;return FRIEND; } + YY_BREAK +case 64: +YY_RULE_SETUP +#line 229 "moc.l" +{ X;return TYPEDEF; } + YY_BREAK +case 65: +YY_RULE_SETUP +#line 230 "moc.l" +{ X;return AUTO; } + YY_BREAK +case 66: +YY_RULE_SETUP +#line 231 "moc.l" +{ X;return REGISTER; } + YY_BREAK +case 67: +YY_RULE_SETUP +#line 232 "moc.l" +{ X;return STATIC; } + YY_BREAK +case 68: +YY_RULE_SETUP +#line 233 "moc.l" +{ X;return EXTERN; } + YY_BREAK +case 69: +YY_RULE_SETUP +#line 234 "moc.l" +{ X;return INLINE; } + YY_BREAK +case 70: +YY_RULE_SETUP +#line 235 "moc.l" +{ X;return INLINE; } + YY_BREAK +case 71: +YY_RULE_SETUP +#line 236 "moc.l" +{ X;return VIRTUAL; } + YY_BREAK +case 72: +YY_RULE_SETUP +#line 237 "moc.l" +{ X;return CONST; } + YY_BREAK +case 73: +YY_RULE_SETUP +#line 238 "moc.l" +{ X;return VOLATILE; } + YY_BREAK +case 74: +YY_RULE_SETUP +#line 239 "moc.l" +{ X;return CHAR; } + YY_BREAK +case 75: +YY_RULE_SETUP +#line 240 "moc.l" +{ X;return SHORT; } + YY_BREAK +case 76: +YY_RULE_SETUP +#line 241 "moc.l" +{ X;return INT; } + YY_BREAK +case 77: +YY_RULE_SETUP +#line 242 "moc.l" +{ X;return LONG; } + YY_BREAK +case 78: +YY_RULE_SETUP +#line 243 "moc.l" +{ X;return SIGNED; } + YY_BREAK +case 79: +YY_RULE_SETUP +#line 244 "moc.l" +{ X;return UNSIGNED; } + YY_BREAK +case 80: +YY_RULE_SETUP +#line 245 "moc.l" +{ X;return FLOAT; } + YY_BREAK +case 81: +YY_RULE_SETUP +#line 246 "moc.l" +{ X;return DOUBLE; } + YY_BREAK +case 82: +YY_RULE_SETUP +#line 247 "moc.l" +{ X;return VOID; } + YY_BREAK +case 83: +YY_RULE_SETUP +#line 248 "moc.l" +{ X;return ENUM; } + YY_BREAK +case 84: +YY_RULE_SETUP +#line 249 "moc.l" +{ X;return CLASS; } + YY_BREAK +case 85: +YY_RULE_SETUP +#line 250 "moc.l" +{ X;return STRUCT; } + YY_BREAK +case 86: +YY_RULE_SETUP +#line 251 "moc.l" +{ X;return UNION; } + YY_BREAK +case 87: +YY_RULE_SETUP +#line 252 "moc.l" +{ X;return ASM; } + YY_BREAK +case 88: +YY_RULE_SETUP +#line 253 "moc.l" +{ X;return PRIVATE; } + YY_BREAK +case 89: +YY_RULE_SETUP +#line 254 "moc.l" +{ X;return PROTECTED; } + YY_BREAK +case 90: +YY_RULE_SETUP +#line 255 "moc.l" +{ X;return PUBLIC; } + YY_BREAK +case 91: +YY_RULE_SETUP +#line 256 "moc.l" +{ X;return OPERATOR; } + YY_BREAK +case 92: +YY_RULE_SETUP +#line 257 "moc.l" +{ X;return DBL_COLON; } + YY_BREAK +case 93: +YY_RULE_SETUP +#line 258 "moc.l" +{ X;return TRIPLE_DOT; } + YY_BREAK +case 94: +YY_RULE_SETUP +#line 259 "moc.l" +{ X;return TEMPLATE; } + YY_BREAK +case 95: +YY_RULE_SETUP +#line 260 "moc.l" +{ X;return MUTABLE; } + YY_BREAK +case 96: +YY_RULE_SETUP +#line 261 "moc.l" +{ X;return THROW; } + YY_BREAK +case 97: +YY_RULE_SETUP +#line 262 "moc.l" +{ X;return USING; } + YY_BREAK +case 98: +YY_RULE_SETUP +#line 263 "moc.l" +{ X;return NAMESPACE; } + YY_BREAK +case 99: +YY_RULE_SETUP +#line 265 "moc.l" +{ + X; + yylval.string = tqstrdup(yytext); + return IDENTIFIER; + } + YY_BREAK +case 100: +YY_RULE_SETUP +#line 271 "moc.l" +{ + X; + yylval.string = tqstrdup(yytext); + return IDENTIFIER; + } + YY_BREAK +case 101: +YY_RULE_SETUP +#line 277 "moc.l" +{ X; return '('; } + YY_BREAK +case 102: +YY_RULE_SETUP +#line 278 "moc.l" +{ X; return ')'; } + YY_BREAK +case 103: +YY_RULE_SETUP +#line 279 "moc.l" +{ X; return ','; } + YY_BREAK +case 104: +/* rule 104 can match eol */ +YY_RULE_SETUP +#line 281 "moc.l" +{ + X; + yylval.string = tqstrdup( yytext + 1 ); + input(); /* discard the '"' */ + return STRING; + } + YY_BREAK +case 105: +YY_RULE_SETUP +#line 288 "moc.l" +; + YY_BREAK +case 106: +YY_RULE_SETUP +#line 289 "moc.l" +; + YY_BREAK +case 107: +YY_RULE_SETUP +#line 290 "moc.l" +; + YY_BREAK +case 108: +/* rule 108 can match eol */ +YY_RULE_SETUP +#line 292 "moc.l" +{ /* discard strings */ + Z; + } + YY_BREAK +case 109: +/* rule 109 can match eol */ +YY_RULE_SETUP +#line 296 "moc.l" +{ /* discard strings */ + Z; + } + YY_BREAK +case 110: +/* rule 110 can match eol */ +YY_RULE_SETUP +#line 300 "moc.l" +{ /* discard strings */ + Z; + } + YY_BREAK +case 111: +/* rule 111 can match eol */ +YY_RULE_SETUP +#line 304 "moc.l" +{ /* discard strings */ + Z; + addExpressionString( yytext ); + input(); /* discard the '"' */ + } + YY_BREAK +case 112: +/* rule 112 can match eol */ +YY_RULE_SETUP +#line 311 "moc.l" +{ + X; + addExpressionString( yytext ); + input(); /* discard the '"' */ + return STRING; + } + YY_BREAK +case 113: +/* rule 113 can match eol */ +YY_RULE_SETUP +#line 318 "moc.l" +{ + X; + yylval.string = tqstrdup( yytext + 1 ); + input(); /* discard the '"' */ + return STRING; + } + YY_BREAK +case 114: +YY_RULE_SETUP +#line 325 "moc.l" +{ X; + yylval.char_val = yytext[1]; + return CHAR_VAL; + } + YY_BREAK +case 115: +YY_RULE_SETUP +#line 330 "moc.l" +{ X; + yylval.char_val = '\a'; + return CHAR_VAL; + } + YY_BREAK +case 116: +YY_RULE_SETUP +#line 335 "moc.l" +{ X; + yylval.char_val = '\b'; + return CHAR_VAL; + } + YY_BREAK +case 117: +YY_RULE_SETUP +#line 340 "moc.l" +{ X; + yylval.char_val = '\f'; + return CHAR_VAL; + } + YY_BREAK +case 118: +YY_RULE_SETUP +#line 345 "moc.l" +{ X; + yylval.char_val = '\n'; + return CHAR_VAL; + } + YY_BREAK +case 119: +YY_RULE_SETUP +#line 350 "moc.l" +{ X; + yylval.char_val = '\r'; + return CHAR_VAL; + } + YY_BREAK +case 120: +YY_RULE_SETUP +#line 355 "moc.l" +{ X; + yylval.char_val = '\t'; + return CHAR_VAL; + } + YY_BREAK +case 121: +YY_RULE_SETUP +#line 360 "moc.l" +{ X; + yylval.char_val = '\v'; + return CHAR_VAL; + } + YY_BREAK +case 122: +YY_RULE_SETUP +#line 365 "moc.l" +{ X; + yylval.char_val = '\\'; + return CHAR_VAL; + } + YY_BREAK +case 123: +YY_RULE_SETUP +#line 370 "moc.l" +{ X; + yylval.char_val = '\?'; + return CHAR_VAL; + } + YY_BREAK +case 124: +YY_RULE_SETUP +#line 375 "moc.l" +{ X; + yylval.char_val = '\''; + return CHAR_VAL; + } + YY_BREAK +case 125: +YY_RULE_SETUP +#line 380 "moc.l" +{ X; + yylval.char_val = '\"'; /* " */ + return CHAR_VAL; + } + YY_BREAK +case 126: +YY_RULE_SETUP +#line 385 "moc.l" +{ X; + yylval.char_val = '\0'; + return CHAR_VAL; + } + YY_BREAK +case 127: +YY_RULE_SETUP +#line 390 "moc.l" +{ X; + yylval.char_val = + (char)strtol( &yytext[1], 0, 8 ); + return CHAR_VAL; + } + YY_BREAK +case 128: +YY_RULE_SETUP +#line 396 "moc.l" +{ X; + yylval.char_val = + (char)strtol( &yytext[2], 0, 16 ); + return CHAR_VAL; + } + YY_BREAK +case 129: +YY_RULE_SETUP +#line 402 "moc.l" +{ X; + yylval.char_val = ' '; + return CHAR_VAL; + } + YY_BREAK +case 130: +YY_RULE_SETUP +#line 407 "moc.l" +{ X; + yylval.int_val = atoi(yytext); + return INT_VAL; + } + YY_BREAK +case 131: +YY_RULE_SETUP +#line 412 "moc.l" +{ X; + yylval.double_val = atof(yytext); + return DOUBLE_VAL; + } + YY_BREAK +case 132: +YY_RULE_SETUP +#line 417 "moc.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 "moc.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 "moc.l" +{ /* preprocessor commands are skipped */} + YY_BREAK +case 135: +YY_RULE_SETUP +#line 435 "moc.l" +{ /* C++ comment */ + TQCString s = yytext; + if ( s.contains( "MOC_SKIP_BEGIN" ) ) { + skipLevel++; + if ( skipLevel == 1 ) { + lastState = YYSTATE; + BEGIN SKIP; + } + } else + if ( s.contains( "MOC_SKIP_END" ) ) { + if ( skipLevel == 0 ) { + tqmoc_warn(" MOC_SKIP_END without MOC_SKIP_BEGIN"); + } else { + skipLevel--; + if ( skipLevel == 0 ) { + BEGIN lastState; + } + } + } + } + YY_BREAK +case 136: +YY_RULE_SETUP +#line 455 "moc.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 "moc.l" +{ addExpressionChar( yytext[0] ); } + YY_BREAK +case 138: +YY_RULE_SETUP +#line 470 "moc.l" +{ + /* spaces are important in template args, + e.g. Foo */ + addExpressionChar( yytext[0] ); } + YY_BREAK +case 139: +YY_RULE_SETUP +#line 474 "moc.l" +; + YY_BREAK +case 140: +YY_RULE_SETUP +#line 475 "moc.l" +; + YY_BREAK +case 141: +YY_RULE_SETUP +#line 476 "moc.l" +; + YY_BREAK +case 142: +YY_RULE_SETUP +#line 477 "moc.l" +; + YY_BREAK +case 143: +YY_RULE_SETUP +#line 478 "moc.l" +{ addExpressionChar( yytext[0] ); } + YY_BREAK +case 144: +YY_RULE_SETUP +#line 479 "moc.l" +; + YY_BREAK +case 145: +YY_RULE_SETUP +#line 480 "moc.l" +{ addExpressionChar( yytext[0] ); } + YY_BREAK +case 146: +YY_RULE_SETUP +#line 481 "moc.l" +; + YY_BREAK +case 147: +YY_RULE_SETUP +#line 482 "moc.l" +; + YY_BREAK +case 148: +YY_RULE_SETUP +#line 483 "moc.l" +{ + X; + return yytext[0]; + } + YY_BREAK +case 149: +YY_RULE_SETUP +#line 487 "moc.l" +{ + X; + return ';'; + } + YY_BREAK +case 150: +/* rule 150 can match eol */ +YY_RULE_SETUP +#line 491 "moc.l" +{ + lineNo++; + } + YY_BREAK +case 151: +YY_RULE_SETUP +#line 496 "moc.l" +ECHO; + YY_BREAK +#line 2297 "lex.yy.c" +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(OUTSIDE): +case YY_STATE_EOF(QT_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) +{ + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + 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) +{ + yy_state_type yy_current_state; + 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 ) + { + 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 >= 617 ) + 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 ) +{ + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); + + 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 >= 617 ) + 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 == 616); + + return yy_is_jam ? 0 : yy_current_state; +} + + static void yyunput (int c, char * yy_bp ) +{ + 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. */ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + 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 ) +{ + 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 ) +{ + 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 "moc.l" + + + +#endif // TQMOC_YACC_CODE + diff --git a/src/tqmoc/tqmoc_yacc.cpp b/src/tqmoc/tqmoc_yacc.cpp new file mode 100644 index 000000000..ea0f36a2d --- /dev/null +++ b/src/tqmoc/tqmoc_yacc.cpp @@ -0,0 +1,6483 @@ +/* A Bison parser, made by GNU Bison 2.5. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2011 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 . */ + +/* 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.5" + +/* 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 268 of yacc.c */ +#line 57 "tqmoc.y" + +#define TQMOC_YACC_CODE +void yyerror( const char *msg ); + +#include "qplatformdefs.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 Q_OS_MACX +# undef OLD_DEBUG +# ifdef DEBUG +# define OLD_DEBUG DEBUG +# undef DEBUG +# endif +# define DEBUG 0 +# ifndef __IMAGECAPTURE__ +# define __IMAGECAPTURE__ +# endif +# include +# endif +# include "mwerks_mac.h" +#endif + +#include +#include +#include + +#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 tqvariant_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\"", tqvariant_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\"", tqvariant_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 tqvariant.cpp. If you change + one, change both. +*/ +static const int ntypes = 35; +static const char* const type_map[ntypes] = +{ + 0, + "TQMap", + "TQValueList", + "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 tqvariant_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 tqvariant_nameToType( type ) != 0; +} + +/* + Replaces '>>' with '> >' (as in 'TQValueList >'). + 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'. + */ + if ( leftType[i] == '&' || leftType[i] == '*' || + leftType[i] == '<' ) + break; + } + + name = argName; + isDefault = isDefaultArgument; + } + + TQCString leftType; + TQCString rightType; + TQCString name; + bool isDefault; +}; + +class ArgList : public TQPtrList { // 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 { // list of member functions +public: + FuncList( bool autoDelete = FALSE ) { setAutoDelete( autoDelete ); } + + FuncList find( const char* name ) + { + FuncList result; + for ( TQPtrListIterator 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 { // 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 TQ_PROPERTY construct cannot contain any commas, since + commas separate macro arguments. We therefore expect users + to type "TQMap" instead of "TQMap". For + coherence, we also expect the same for + TQValueList, the other template class supported by + TQVariant. + */ + if ( type == "TQMap" ) { + type = "TQMap"; + } else if ( type == "TQValueList" ) { + type = "TQValueList"; + } 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 { // 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 { // 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 + bool generatedCode; // no code generated + bool mocError; // moc parsing error occurred + bool hasVariantIncluded; //whether or not tqvariant.h was included yet + TQCString className; // name of parsed class + TQCString superClassName; // name of first super class + TQStrList multipleSuperClasses; // other superclasses + FuncList signals; // signal interface + FuncList slots; // slots interface + FuncList propfuncs; // all possible property access functions + FuncList funcs; // all parsed functions, including signals + 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 TQ_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 TQ_PROPERTYdetected; // TRUE if current class + // contains at least one TQ_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 tqmetaobject.h too +const int formatRevision = 26; // moc output format revision + +// if the flags change, you HAVE to change it in tqmetaobject.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(Q_OS_WIN32) +# include +# undef isatty +extern "C" int hack_isatty( int ) + { + return 0; + } +# define isatty hack_isatty +# else +# include +# endif + +# define YYDEBUG 1 +# include "tqmoc_yacc.h" +# include "tqmoc_lex.cpp" +#endif //YYBISON + + +/* Line 268 of yacc.c */ +#line 704 "tqmoc_yacc" + +/* 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, + TQ_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 TQ_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 293 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 293 of yacc.c */ +#line 865 "tqmoc_yacc" +} 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 343 of yacc.c */ +#line 877 "tqmoc_yacc" + +#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 /* 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 defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* 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 /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# 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 EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS && (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 EXIT_SUCCESS && (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) + +# define YYCOPY_NEEDED 1 + +/* 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 + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* 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 +#endif /* !YYCOPY_NEEDED */ + +/* 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, 1183, 1191, 1195, + 1200, 1201, 1205, 1208, 1209, 1212, 1215, 1216, 1220, 1220, + 1225, 1226, 1229, 1230, 1233, 1234, 1238, 1239, 1243, 1243, + 1245, 1245, 1247, 1255, 1258, 1255, 1262, 1265, 1262, 1269, + 1271, 1269, 1276, 1277, 1276, 1282, 1283, 1282, 1290, 1292, + 1293, 1293, 1303, 1310, 1311, 1314, 1315, 1318, 1321, 1322, + 1325, 1326, 1330, 1333, 1334, 1337, 1338, 1341, 1344, 1345, + 1348, 1351, 1352, 1355, 1357, 1361, 1362, 1363, 1364, 1365, + 1366, 1367, 1368, 1369, 1370, 1373, 1374, 1375, 1378, 1379, + 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, 1422, + 1423, 1426, 1429, 1436, 1443, 1451, 1453, 1457, 1462, 1464, + 1466, 1469, 1471, 1477, 1478, 1480, 1483, 1485, 1487, 1489, + 1492, 1495, 1498, 1494, 1503, 1504, 1507, 1508, 1508, 1510, + 1510, 1514, 1515, 1515, 1520, 1525, 1526, 1529, 1536, 1540, + 1541, 1544, 1545, 1546, 1549, 1550, 1550, 1555, 1554, 1591, + 1592, 1593, 1594, 1595, 1596, 1597, 1600, 1601, 1604, 1605 +}; +#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", + "TQ_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 reduction number in state STATE-NUM. + Performed 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 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 +}; + +#define yypact_value_is_default(yystate) \ + ((yystate) == (-356)) + +#define yytable_value_is_error(yytable_value) \ + YYID (0) + +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. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ + +#define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + 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 + + +/* This macro is provided for backward compatibility. */ + +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#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 /* 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 _DEFAULT_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 *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = 0; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - Assume YYFAIL is not used. It's too flawed to consider. See + + for details. YYERROR is fine as it does not invoke this + function. + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + 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 yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* 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 = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#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. | +`----------*/ + +#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 (yypact_value_is_default (yyn)) + 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 (yytable_value_is_error (yyn)) + 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 1806 of yacc.c */ +#line 824 "tqmoc.y" + { enterNameSpace((yyvsp[(2) - (2)].string)); } + break; + + case 12: + +/* Line 1806 of yacc.c */ +#line 825 "tqmoc.y" + { BEGIN IN_NAMESPACE; } + break; + + case 13: + +/* Line 1806 of yacc.c */ +#line 827 "tqmoc.y" + { leaveNameSpace(); + selectOutsideClassState(); + } + break; + + case 14: + +/* Line 1806 of yacc.c */ +#line 832 "tqmoc.y" + { enterNameSpace(); } + break; + + case 15: + +/* Line 1806 of yacc.c */ +#line 833 "tqmoc.y" + { BEGIN IN_NAMESPACE; } + break; + + case 16: + +/* Line 1806 of yacc.c */ +#line 835 "tqmoc.y" + { leaveNameSpace(); + selectOutsideClassState(); + } + break; + + case 18: + +/* Line 1806 of yacc.c */ +#line 844 "tqmoc.y" + { selectOutsideClassState(); } + break; + + case 19: + +/* Line 1806 of yacc.c */ +#line 848 "tqmoc.y" + { selectOutsideClassState(); } + break; + + case 20: + +/* Line 1806 of yacc.c */ +#line 851 "tqmoc.y" + { selectOutsideClassState(); } + break; + + case 21: + +/* Line 1806 of yacc.c */ +#line 852 "tqmoc.y" + { selectOutsideClassState(); } + break; + + case 22: + +/* Line 1806 of yacc.c */ +#line 855 "tqmoc.y" + { initClass(); } + break; + + case 23: + +/* Line 1806 of yacc.c */ +#line 856 "tqmoc.y" + { generateClass(); + registerClassInNamespace(); + selectOutsideClassState(); } + break; + + case 24: + +/* Line 1806 of yacc.c */ +#line 864 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 25: + +/* Line 1806 of yacc.c */ +#line 865 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 26: + +/* Line 1806 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 1806 of yacc.c */ +#line 880 "tqmoc.y" + { initExpression(); + templLevel = 1; + BEGIN IN_TEMPL_ARGS; } + break; + + case 28: + +/* Line 1806 of yacc.c */ +#line 893 "tqmoc.y" + { initExpression(); + BEGIN IN_EXPR; } + break; + + case 29: + +/* Line 1806 of yacc.c */ +#line 902 "tqmoc.y" + { BEGIN IN_DEF_ARG; } + break; + + case 30: + +/* Line 1806 of yacc.c */ +#line 905 "tqmoc.y" + { initExpression(); + BEGIN IN_ENUM; } + break; + + case 31: + +/* Line 1806 of yacc.c */ +#line 911 "tqmoc.y" + { (yyval.string) = ""; } + break; + + case 32: + +/* Line 1806 of yacc.c */ +#line 912 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 33: + +/* Line 1806 of yacc.c */ +#line 913 "tqmoc.y" + { (yyval.string) = ""; } + break; + + case 34: + +/* Line 1806 of yacc.c */ +#line 914 "tqmoc.y" + { skipFunc = TRUE; (yyval.string) = ""; } + break; + + case 35: + +/* Line 1806 of yacc.c */ +#line 915 "tqmoc.y" + { skipFunc = TRUE; (yyval.string) = ""; } + break; + + case 36: + +/* Line 1806 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 1806 of yacc.c */ +#line 921 "tqmoc.y" + { (yyval.string) = ""; } + break; + + case 38: + +/* Line 1806 of yacc.c */ +#line 922 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 39: + +/* Line 1806 of yacc.c */ +#line 925 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 40: + +/* Line 1806 of yacc.c */ +#line 926 "tqmoc.y" + { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)); } + break; + + case 43: + +/* Line 1806 of yacc.c */ +#line 931 "tqmoc.y" + { skipFunc = TRUE; } + break; + + case 45: + +/* Line 1806 of yacc.c */ +#line 935 "tqmoc.y" + { } + break; + + case 46: + +/* Line 1806 of yacc.c */ +#line 936 "tqmoc.y" + { } + break; + + case 47: + +/* Line 1806 of yacc.c */ +#line 939 "tqmoc.y" + { (yyval.string) = "const"; } + break; + + case 48: + +/* Line 1806 of yacc.c */ +#line 940 "tqmoc.y" + { (yyval.string) = "volatile"; } + break; + + case 49: + +/* Line 1806 of yacc.c */ +#line 943 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 50: + +/* Line 1806 of yacc.c */ +#line 944 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 51: + +/* Line 1806 of yacc.c */ +#line 945 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 52: + +/* Line 1806 of yacc.c */ +#line 949 "tqmoc.y" + { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)); } + break; + + case 53: + +/* Line 1806 of yacc.c */ +#line 950 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 54: + +/* Line 1806 of yacc.c */ +#line 953 "tqmoc.y" + { (yyval.string) = "char"; } + break; + + case 55: + +/* Line 1806 of yacc.c */ +#line 954 "tqmoc.y" + { (yyval.string) = "short"; } + break; + + case 56: + +/* Line 1806 of yacc.c */ +#line 955 "tqmoc.y" + { (yyval.string) = "int"; } + break; + + case 57: + +/* Line 1806 of yacc.c */ +#line 956 "tqmoc.y" + { (yyval.string) = "long"; } + break; + + case 58: + +/* Line 1806 of yacc.c */ +#line 957 "tqmoc.y" + { (yyval.string) = "signed"; } + break; + + case 59: + +/* Line 1806 of yacc.c */ +#line 958 "tqmoc.y" + { (yyval.string) = "unsigned"; } + break; + + case 60: + +/* Line 1806 of yacc.c */ +#line 959 "tqmoc.y" + { (yyval.string) = "float"; } + break; + + case 61: + +/* Line 1806 of yacc.c */ +#line 960 "tqmoc.y" + { (yyval.string) = "double"; } + break; + + case 62: + +/* Line 1806 of yacc.c */ +#line 961 "tqmoc.y" + { (yyval.string) = "void"; } + break; + + case 63: + +/* Line 1806 of yacc.c */ +#line 965 "tqmoc.y" + { g->tmpExpression = rmWS( g->tmpExpression ); + (yyval.string) = stradd( "template<", + g->tmpExpression, ">" ); } + break; + + case 65: + +/* Line 1806 of yacc.c */ +#line 971 "tqmoc.y" + { templateClassOld = templateClass; + templateClass = TRUE; + } + break; + + case 66: + +/* Line 1806 of yacc.c */ +#line 977 "tqmoc.y" + { (yyval.string) = "class"; } + break; + + case 67: + +/* Line 1806 of yacc.c */ +#line 978 "tqmoc.y" + { (yyval.string) = "struct"; } + break; + + case 68: + +/* Line 1806 of yacc.c */ +#line 981 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 69: + +/* Line 1806 of yacc.c */ +#line 983 "tqmoc.y" + { (yyval.string) = stradd( "::", (yyvsp[(2) - (2)].string) ); } + break; + + case 70: + +/* Line 1806 of yacc.c */ +#line 987 "tqmoc.y" + { (yyval.string) = stradd( (yyvsp[(1) - (3)].string), "::", (yyvsp[(3) - (3)].string) );} + break; + + case 71: + +/* Line 1806 of yacc.c */ +#line 988 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 72: + +/* Line 1806 of yacc.c */ +#line 992 "tqmoc.y" + { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)); } + break; + + case 73: + +/* Line 1806 of yacc.c */ +#line 993 "tqmoc.y" + { (yyval.string) = stradd("enum ",(yyvsp[(2) - (2)].string)); } + break; + + case 74: + +/* Line 1806 of yacc.c */ +#line 994 "tqmoc.y" + { (yyval.string) = stradd("union ",(yyvsp[(2) - (2)].string)); } + break; + + case 75: + +/* Line 1806 of yacc.c */ +#line 999 "tqmoc.y" + { (yyval.arg_list) = (yyvsp[(1) - (2)].arg_list);} + break; + + case 76: + +/* Line 1806 of yacc.c */ +#line 1000 "tqmoc.y" + { (yyval.arg_list) = (yyvsp[(1) - (3)].arg_list); + func_warn("Ellipsis not supported" + " in signals and slots.\n" + "Ellipsis argument ignored."); } + break; + + case 77: + +/* Line 1806 of yacc.c */ +#line 1006 "tqmoc.y" + { (yyval.arg_list) = tmpArgList; } + break; + + case 78: + +/* Line 1806 of yacc.c */ +#line 1007 "tqmoc.y" + { (yyval.arg_list) = (yyvsp[(1) - (1)].arg_list); } + break; + + case 79: + +/* Line 1806 of yacc.c */ +#line 1010 "tqmoc.y" + { (yyval.arg) = 0; } + break; + + case 82: + +/* Line 1806 of yacc.c */ +#line 1015 "tqmoc.y" + { func_warn("Ellipsis not supported" + " in signals and slots.\n" + "Ellipsis argument ignored."); } + break; + + case 83: + +/* Line 1806 of yacc.c */ +#line 1023 "tqmoc.y" + { (yyval.arg_list) = addArg((yyvsp[(3) - (3)].arg)); } + break; + + case 84: + +/* Line 1806 of yacc.c */ +#line 1024 "tqmoc.y" + { (yyval.arg_list) = addArg((yyvsp[(1) - (1)].arg)); } + break; + + case 85: + +/* Line 1806 of yacc.c */ +#line 1028 "tqmoc.y" + { (yyval.arg) = new Argument(straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)),""); } + break; + + case 86: + +/* Line 1806 of yacc.c */ +#line 1030 "tqmoc.y" + { expLevel = 1; } + break; + + case 87: + +/* Line 1806 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 1806 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 1806 of yacc.c */ +#line 1038 "tqmoc.y" + { expLevel = 1; } + break; + + case 90: + +/* Line 1806 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 1806 of yacc.c */ +#line 1044 "tqmoc.y" + { (yyval.string) = ""; } + break; + + case 92: + +/* Line 1806 of yacc.c */ +#line 1045 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 93: + +/* Line 1806 of yacc.c */ +#line 1049 "tqmoc.y" + { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)); } + break; + + case 94: + +/* Line 1806 of yacc.c */ +#line 1050 "tqmoc.y" + { expLevel = 1; } + break; + + case 95: + +/* Line 1806 of yacc.c */ +#line 1052 "tqmoc.y" + { (yyval.string) = stradd( "[", + g->tmpExpression = + g->tmpExpression.stripWhiteSpace(), "]" ); } + break; + + case 96: + +/* Line 1806 of yacc.c */ +#line 1055 "tqmoc.y" + { expLevel = 1; } + break; + + case 97: + +/* Line 1806 of yacc.c */ +#line 1057 "tqmoc.y" + { (yyval.string) = stradd( (yyvsp[(1) - (5)].string),"[", + g->tmpExpression = + g->tmpExpression.stripWhiteSpace(),"]" ); } + break; + + case 98: + +/* Line 1806 of yacc.c */ +#line 1060 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 99: + +/* Line 1806 of yacc.c */ +#line 1061 "tqmoc.y" + { (yyval.string) = (yyvsp[(2) - (3)].string); } + break; + + case 100: + +/* Line 1806 of yacc.c */ +#line 1064 "tqmoc.y" + { (yyval.string) = ""; } + break; + + case 101: + +/* Line 1806 of yacc.c */ +#line 1066 "tqmoc.y" + { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string));} + break; + + case 102: + +/* Line 1806 of yacc.c */ +#line 1067 "tqmoc.y" + { expLevel = 1; } + break; + + case 103: + +/* Line 1806 of yacc.c */ +#line 1069 "tqmoc.y" + { (yyval.string) = stradd( (yyvsp[(1) - (5)].string),"[", + g->tmpExpression = + g->tmpExpression.stripWhiteSpace(),"]" ); } + break; + + case 104: + +/* Line 1806 of yacc.c */ +#line 1072 "tqmoc.y" + { (yyval.string) = (yyvsp[(2) - (3)].string); } + break; + + case 106: + +/* Line 1806 of yacc.c */ +#line 1086 "tqmoc.y" + { tmpFunc->args = (yyvsp[(2) - (8)].arg_list); + tmpFunc->qualifier = (yyvsp[(4) - (8)].string); } + break; + + case 108: + +/* Line 1806 of yacc.c */ +#line 1092 "tqmoc.y" + { func_warn("Variable as signal or slot."); } + break; + + case 109: + +/* Line 1806 of yacc.c */ +#line 1093 "tqmoc.y" + { expLevel=0; } + break; + + case 110: + +/* Line 1806 of yacc.c */ +#line 1095 "tqmoc.y" + { skipFunc = TRUE; } + break; + + case 111: + +/* Line 1806 of yacc.c */ +#line 1096 "tqmoc.y" + { expLevel=0; } + break; + + case 112: + +/* Line 1806 of yacc.c */ +#line 1098 "tqmoc.y" + { skipFunc = TRUE; } + break; + + case 113: + +/* Line 1806 of yacc.c */ +#line 1102 "tqmoc.y" + { expLevel = 1; } + break; + + case 115: + +/* Line 1806 of yacc.c */ +#line 1104 "tqmoc.y" + { expLevel = 1; } + break; + + case 117: + +/* Line 1806 of yacc.c */ +#line 1109 "tqmoc.y" + { (yyval.string) = ""; } + break; + + case 118: + +/* Line 1806 of yacc.c */ +#line 1110 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 119: + +/* Line 1806 of yacc.c */ +#line 1113 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 120: + +/* Line 1806 of yacc.c */ +#line 1114 "tqmoc.y" + { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string));} + break; + + case 121: + +/* Line 1806 of yacc.c */ +#line 1117 "tqmoc.y" + { (yyval.string) = straddSpc("*",(yyvsp[(2) - (2)].string));} + break; + + case 122: + +/* Line 1806 of yacc.c */ +#line 1118 "tqmoc.y" + { (yyval.string) = stradd("&",(yyvsp[(2) - (2)].string));} + break; + + case 123: + +/* Line 1806 of yacc.c */ +#line 1125 "tqmoc.y" + { (yyval.string) = ""; } + break; + + case 124: + +/* Line 1806 of yacc.c */ +#line 1126 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 125: + +/* Line 1806 of yacc.c */ +#line 1129 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 126: + +/* Line 1806 of yacc.c */ +#line 1131 "tqmoc.y" + { (yyval.string) = straddSpc((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].string)); } + break; + + case 127: + +/* Line 1806 of yacc.c */ +#line 1134 "tqmoc.y" + { (yyval.string) = "const"; } + break; + + case 128: + +/* Line 1806 of yacc.c */ +#line 1135 "tqmoc.y" + { (yyval.string) = "volatile"; } + break; + + case 132: + +/* Line 1806 of yacc.c */ +#line 1143 "tqmoc.y" + { BEGIN IN_FCT; fctLevel = 1;} + break; + + case 133: + +/* Line 1806 of yacc.c */ +#line 1144 "tqmoc.y" + { BEGIN QT_DEF; } + break; + + case 134: + +/* Line 1806 of yacc.c */ +#line 1151 "tqmoc.y" + { BEGIN IN_CLASS; + classPLevel = 1; + } + break; + + case 135: + +/* Line 1806 of yacc.c */ +#line 1155 "tqmoc.y" + { BEGIN QT_DEF; } + break; + + case 136: + +/* Line 1806 of yacc.c */ +#line 1156 "tqmoc.y" + { BEGIN QT_DEF; /* -- " -- */ + skipClass = TRUE; } + break; + + case 137: + +/* Line 1806 of yacc.c */ +#line 1158 "tqmoc.y" + { BEGIN QT_DEF; /* -- " -- */ + skipClass = TRUE; } + break; + + case 138: + +/* Line 1806 of yacc.c */ +#line 1160 "tqmoc.y" + { BEGIN QT_DEF; /* -- " -- */ + skipClass = TRUE; } + break; + + case 139: + +/* Line 1806 of yacc.c */ +#line 1164 "tqmoc.y" + { BEGIN QT_DEF; /* catch ';' */ + skipClass = TRUE; } + break; + + case 140: + +/* Line 1806 of yacc.c */ +#line 1166 "tqmoc.y" + { skipClass = TRUE; + BEGIN GIMME_SEMICOLON; } + break; + + case 144: + +/* Line 1806 of yacc.c */ +#line 1173 "tqmoc.y" + { (yyval.string) = ""; } + break; + + case 146: + +/* Line 1806 of yacc.c */ +#line 1179 "tqmoc.y" + { g->className = (yyvsp[(2) - (2)].string); + if ( g->className == "TQObject" ) + TQ_OBJECTdetected = TRUE; + } + break; + + case 147: + +/* Line 1806 of yacc.c */ +#line 1185 "tqmoc.y" + { g->className = (yyvsp[(3) - (3)].string); + if ( g->className == "TQObject" ) + TQ_OBJECTdetected = TRUE; + } + break; + + case 148: + +/* Line 1806 of yacc.c */ +#line 1192 "tqmoc.y" + { g->superClassName = (yyvsp[(2) - (2)].string); } + break; + + case 149: + +/* Line 1806 of yacc.c */ +#line 1197 "tqmoc.y" + { templateClass = templateClassOld; } + break; + + case 158: + +/* Line 1806 of yacc.c */ +#line 1220 "tqmoc.y" + { expLevel = 1; } + break; + + case 160: + +/* Line 1806 of yacc.c */ +#line 1225 "tqmoc.y" + { (yyval.string) = 0; } + break; + + case 161: + +/* Line 1806 of yacc.c */ +#line 1226 "tqmoc.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 166: + +/* Line 1806 of yacc.c */ +#line 1238 "tqmoc.y" + { tmpAccess = (yyvsp[(1) - (1)].access); } + break; + + case 167: + +/* Line 1806 of yacc.c */ +#line 1239 "tqmoc.y" + { tqmoc_err( "Missing access specifier" + " before \"slots:\"." ); } + break; + + case 168: + +/* Line 1806 of yacc.c */ +#line 1243 "tqmoc.y" + { BEGIN QT_DEF; } + break; + + case 170: + +/* Line 1806 of yacc.c */ +#line 1245 "tqmoc.y" + { BEGIN QT_DEF; } + break; + + case 172: + +/* Line 1806 of yacc.c */ +#line 1247 "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 1806 of yacc.c */ +#line 1255 "tqmoc.y" + { tmpYYStart = YY_START; + tmpPropOverride = FALSE; + BEGIN IN_PROPERTY; } + break; + + case 174: + +/* Line 1806 of yacc.c */ +#line 1258 "tqmoc.y" + { + BEGIN tmpYYStart; + } + break; + + case 176: + +/* Line 1806 of yacc.c */ +#line 1262 "tqmoc.y" + { tmpYYStart = YY_START; + tmpPropOverride = TRUE; + BEGIN IN_PROPERTY; } + break; + + case 177: + +/* Line 1806 of yacc.c */ +#line 1265 "tqmoc.y" + { + BEGIN tmpYYStart; + } + break; + + case 179: + +/* Line 1806 of yacc.c */ +#line 1269 "tqmoc.y" + { tmpYYStart = YY_START; BEGIN IN_CLASSINFO; } + break; + + case 180: + +/* Line 1806 of yacc.c */ +#line 1271 "tqmoc.y" + { + g->infos.append( new ClassInfo( (yyvsp[(4) - (7)].string), (yyvsp[(6) - (7)].string) ) ); + BEGIN tmpYYStart; + } + break; + + case 182: + +/* Line 1806 of yacc.c */ +#line 1276 "tqmoc.y" + { tmpYYStart = YY_START; BEGIN IN_PROPERTY; } + break; + + case 183: + +/* Line 1806 of yacc.c */ +#line 1277 "tqmoc.y" + { + TQ_PROPERTYdetected = TRUE; + BEGIN tmpYYStart; + } + break; + + case 185: + +/* Line 1806 of yacc.c */ +#line 1282 "tqmoc.y" + { tmpYYStart = YY_START; BEGIN IN_PROPERTY; } + break; + + case 186: + +/* Line 1806 of yacc.c */ +#line 1283 "tqmoc.y" + { + TQ_PROPERTYdetected = TRUE; + BEGIN tmpYYStart; + } + break; + + case 188: + +/* Line 1806 of yacc.c */ +#line 1290 "tqmoc.y" + { tqmoc_err( "Signals cannot " + "have access specifiers" ); } + break; + + case 190: + +/* Line 1806 of yacc.c */ +#line 1293 "tqmoc.y" + { if ( tmpAccess == Public && TQ_PROPERTYdetected ) + BEGIN QT_DEF; + else + BEGIN IN_CLASS; + suppress_func_warn = TRUE; + } + break; + + case 191: + +/* Line 1806 of yacc.c */ +#line 1300 "tqmoc.y" + { + suppress_func_warn = FALSE; + } + break; + + case 192: + +/* Line 1806 of yacc.c */ +#line 1303 "tqmoc.y" + { BEGIN IN_CLASS; + if ( classPLevel != 1 ) + tqmoc_warn( "unexpected access" + "specifier" ); + } + break; + + case 197: + +/* Line 1806 of yacc.c */ +#line 1318 "tqmoc.y" + { addMember( PropertyCandidateMember ); } + break; + + case 202: + +/* Line 1806 of yacc.c */ +#line 1330 "tqmoc.y" + { addMember( SignalMember ); } + break; + + case 207: + +/* Line 1806 of yacc.c */ +#line 1341 "tqmoc.y" + { addMember( SlotMember ); } + break; + + case 210: + +/* Line 1806 of yacc.c */ +#line 1348 "tqmoc.y" + { (yyval.string)=(yyvsp[(2) - (2)].string); } + break; + + case 211: + +/* Line 1806 of yacc.c */ +#line 1351 "tqmoc.y" + { g->multipleSuperClasses.append( (yyvsp[(3) - (3)].string) ); } + break; + + case 213: + +/* Line 1806 of yacc.c */ +#line 1356 "tqmoc.y" + { (yyval.string) = stradd( (yyvsp[(1) - (4)].string), "(", (yyvsp[(3) - (4)].string), ")" ); } + break; + + case 214: + +/* Line 1806 of yacc.c */ +#line 1358 "tqmoc.y" + { (yyval.string) = stradd( (yyvsp[(1) - (4)].string), "(", (yyvsp[(3) - (4)].string), ")" ); } + break; + + case 215: + +/* Line 1806 of yacc.c */ +#line 1361 "tqmoc.y" + {(yyval.string)=(yyvsp[(1) - (1)].string);} + break; + + case 216: + +/* Line 1806 of yacc.c */ +#line 1362 "tqmoc.y" + {(yyval.string)=(yyvsp[(3) - (3)].string);} + break; + + case 217: + +/* Line 1806 of yacc.c */ +#line 1363 "tqmoc.y" + {(yyval.string)=(yyvsp[(2) - (2)].string);} + break; + + case 218: + +/* Line 1806 of yacc.c */ +#line 1364 "tqmoc.y" + {(yyval.string)=(yyvsp[(3) - (3)].string);} + break; + + case 219: + +/* Line 1806 of yacc.c */ +#line 1365 "tqmoc.y" + {(yyval.string)=(yyvsp[(2) - (2)].string);} + break; + + case 220: + +/* Line 1806 of yacc.c */ +#line 1366 "tqmoc.y" + {(yyval.string)=(yyvsp[(1) - (1)].string);} + break; + + case 221: + +/* Line 1806 of yacc.c */ +#line 1367 "tqmoc.y" + {(yyval.string)=(yyvsp[(3) - (3)].string);} + break; + + case 222: + +/* Line 1806 of yacc.c */ +#line 1368 "tqmoc.y" + {(yyval.string)=(yyvsp[(2) - (2)].string);} + break; + + case 223: + +/* Line 1806 of yacc.c */ +#line 1369 "tqmoc.y" + {(yyval.string)=(yyvsp[(3) - (3)].string);} + break; + + case 224: + +/* Line 1806 of yacc.c */ +#line 1370 "tqmoc.y" + {(yyval.string)=(yyvsp[(2) - (2)].string);} + break; + + case 225: + +/* Line 1806 of yacc.c */ +#line 1373 "tqmoc.y" + { (yyval.access)=Private; } + break; + + case 226: + +/* Line 1806 of yacc.c */ +#line 1374 "tqmoc.y" + { (yyval.access)=Protected; } + break; + + case 227: + +/* Line 1806 of yacc.c */ +#line 1375 "tqmoc.y" + { (yyval.access)=Public; } + break; + + case 228: + +/* Line 1806 of yacc.c */ +#line 1378 "tqmoc.y" + { } + break; + + case 229: + +/* Line 1806 of yacc.c */ +#line 1379 "tqmoc.y" + { } + break; + + case 271: + +/* Line 1806 of yacc.c */ +#line 1427 "tqmoc.y" + { tmpFunc->type = (yyvsp[(1) - (2)].string); + tmpFunc->name = (yyvsp[(2) - (2)].string); } + break; + + case 272: + +/* Line 1806 of yacc.c */ +#line 1430 "tqmoc.y" + { tmpFunc->type = "int"; + tmpFunc->name = (yyvsp[(1) - (1)].string); + if ( tmpFunc->name == g->className ) + func_warn( "Constructors cannot be" + " signals or slots."); + } + break; + + case 273: + +/* Line 1806 of yacc.c */ +#line 1437 "tqmoc.y" + { tmpFunc->type = "void"; + tmpFunc->name = "~"; + tmpFunc->name += (yyvsp[(3) - (3)].string); + func_warn( "Destructors cannot be" + " signals or slots."); + } + break; + + case 274: + +/* Line 1806 of yacc.c */ +#line 1445 "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 1806 of yacc.c */ +#line 1452 "tqmoc.y" + { skipFunc = TRUE; } + break; + + case 276: + +/* Line 1806 of yacc.c */ +#line 1454 "tqmoc.y" + { tmpFunc->type = + straddSpc((yyvsp[(1) - (3)].string),(yyvsp[(2) - (3)].string)); + tmpFunc->name = (yyvsp[(3) - (3)].string); } + break; + + case 277: + +/* Line 1806 of yacc.c */ +#line 1459 "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 1806 of yacc.c */ +#line 1463 "tqmoc.y" + { operatorError(); } + break; + + case 279: + +/* Line 1806 of yacc.c */ +#line 1465 "tqmoc.y" + { operatorError(); } + break; + + case 280: + +/* Line 1806 of yacc.c */ +#line 1468 "tqmoc.y" + { operatorError(); } + break; + + case 281: + +/* Line 1806 of yacc.c */ +#line 1470 "tqmoc.y" + { operatorError(); } + break; + + case 282: + +/* Line 1806 of yacc.c */ +#line 1473 "tqmoc.y" + { operatorError(); } + break; + + case 284: + +/* Line 1806 of yacc.c */ +#line 1479 "tqmoc.y" + { func_warn("Unexpected variable declaration."); } + break; + + case 285: + +/* Line 1806 of yacc.c */ +#line 1482 "tqmoc.y" + { func_warn("Unexpected variable declaration."); } + break; + + case 286: + +/* Line 1806 of yacc.c */ +#line 1484 "tqmoc.y" + { func_warn("Unexpected enum declaration."); } + break; + + case 287: + +/* Line 1806 of yacc.c */ +#line 1486 "tqmoc.y" + { func_warn("Unexpected using declaration."); } + break; + + case 288: + +/* Line 1806 of yacc.c */ +#line 1488 "tqmoc.y" + { func_warn("Unexpected using declaration."); } + break; + + case 289: + +/* Line 1806 of yacc.c */ +#line 1490 "tqmoc.y" + { classPLevel++; + tqmoc_err("Unexpected namespace declaration."); } + break; + + case 290: + +/* Line 1806 of yacc.c */ +#line 1493 "tqmoc.y" + { func_warn("Unexpected class declaration.");} + break; + + case 291: + +/* Line 1806 of yacc.c */ +#line 1495 "tqmoc.y" + { func_warn("Unexpected class declaration."); + BEGIN IN_FCT; fctLevel=1; + } + break; + + case 292: + +/* Line 1806 of yacc.c */ +#line 1498 "tqmoc.y" + { BEGIN QT_DEF; } + break; + + case 296: + +/* Line 1806 of yacc.c */ +#line 1507 "tqmoc.y" + { } + break; + + case 297: + +/* Line 1806 of yacc.c */ +#line 1508 "tqmoc.y" + { expLevel = 0; } + break; + + case 299: + +/* Line 1806 of yacc.c */ +#line 1510 "tqmoc.y" + { expLevel = 0; } + break; + + case 302: + +/* Line 1806 of yacc.c */ +#line 1515 "tqmoc.y" + { expLevel = 0; } + break; + + case 307: + +/* Line 1806 of yacc.c */ +#line 1530 "tqmoc.y" + { BEGIN QT_DEF; + if ( tmpAccess == Public) { + tmpEnum->name = (yyvsp[(1) - (5)].string); + addEnum(); + } + } + break; + + case 308: + +/* Line 1806 of yacc.c */ +#line 1537 "tqmoc.y" + { tmpEnum->clear();} + break; + + case 310: + +/* Line 1806 of yacc.c */ +#line 1541 "tqmoc.y" + { } + break; + + case 314: + +/* Line 1806 of yacc.c */ +#line 1549 "tqmoc.y" + { if ( tmpAccess == Public) tmpEnum->append( (yyvsp[(1) - (1)].string) ); } + break; + + case 315: + +/* Line 1806 of yacc.c */ +#line 1550 "tqmoc.y" + { enumLevel=0; } + break; + + case 316: + +/* Line 1806 of yacc.c */ +#line 1551 "tqmoc.y" + { if ( tmpAccess == Public) tmpEnum->append( (yyvsp[(1) - (4)].string) ); } + break; + + case 317: + +/* Line 1806 of yacc.c */ +#line 1555 "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 1806 of yacc.c */ +#line 1571 "tqmoc.y" + { + if ( g->propRead.isEmpty() && !g->propOverride ) + tqmoc_err( "A property must at least feature a read method." ); + checkPropertyName( (yyvsp[(2) - (4)].string) ); + TQ_PROPERTYdetected = TRUE; + // Avoid duplicates + for( TQPtrListIterator 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 1806 of yacc.c */ +#line 1592 "tqmoc.y" + { g->propRead = (yyvsp[(2) - (3)].string); } + break; + + case 321: + +/* Line 1806 of yacc.c */ +#line 1593 "tqmoc.y" + { g->propWrite = (yyvsp[(2) - (3)].string); } + break; + + case 322: + +/* Line 1806 of yacc.c */ +#line 1594 "tqmoc.y" + { g->propReset = (yyvsp[(2) - (3)].string); } + break; + + case 323: + +/* Line 1806 of yacc.c */ +#line 1595 "tqmoc.y" + { g->propStored = (yyvsp[(2) - (3)].string); } + break; + + case 324: + +/* Line 1806 of yacc.c */ +#line 1596 "tqmoc.y" + { g->propDesignable = (yyvsp[(2) - (3)].string); } + break; + + case 325: + +/* Line 1806 of yacc.c */ +#line 1597 "tqmoc.y" + { g->propScriptable = (yyvsp[(2) - (3)].string); } + break; + + case 326: + +/* Line 1806 of yacc.c */ +#line 1600 "tqmoc.y" + { } + break; + + case 327: + +/* Line 1806 of yacc.c */ +#line 1601 "tqmoc.y" + { g->qtEnums.append( (yyvsp[(1) - (2)].string) ); } + break; + + case 328: + +/* Line 1806 of yacc.c */ +#line 1604 "tqmoc.y" + { } + break; + + case 329: + +/* Line 1806 of yacc.c */ +#line 1605 "tqmoc.y" + { g->qtSets.append( (yyvsp[(1) - (2)].string) ); } + break; + + + +/* Line 1806 of yacc.c */ +#line 4252 "tqmoc_yacc" + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + 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: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#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 (!yypact_value_is_default (yyn)) + { + 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) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + 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 2067 of yacc.c */ +#line 1608 "tqmoc.y" + + +#ifndef YYBISON +# if defined(Q_OS_WIN32) +# include +# undef isatty +extern "C" int hack_isatty( int ) +{ + return 0; +} +# define isatty hack_isatty +# else +# include +# 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 + generatedCode = FALSE; // no code generated + mocError = FALSE; // moc parsing error occurred + hasVariantIncluded = FALSE; +} + + +parser_reg::~parser_reg() +{ + slots.clear(); + signals.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 Q_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; noutputFile = argv[++n]; + } else + g->outputFile = &opt[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[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[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[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] \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->mocError ) { + fprintf( stderr, ErrorFormatString" Warning: %s\n", g->fileName.data(), 0, + "No relevant classes found. No output generated." ); + } + + int ret = g->mocError ? 1 : 0; + cleanup(); + return ret; +} +#else +bool tqt_is_gui_used = FALSE; +#include +#include +#include +#ifdef Q_OS_MAC9 +# include +# include +# include +# include "Aliases.h" +#endif +#include "CWPluginErrors.h" +#include +#include "DropInCompilerLinker.h" +#include + +const unsigned char *p_str(const char *, int =-1); + +CWPluginContext g_ctx; + +tqmoc_status do_moc( 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->mocError || !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; + TQ_PROPERTYdetected = FALSE; + skipClass = FALSE; + templateClass = FALSE; + g->slots.clear(); + g->signals.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 definedClasses; // Classes defined in the namespace +}; + +TQPtrList 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 nameQualifier() +{ + TQPtrListIterator 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 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 TQ_SIGNAL and TQ_SLOT names. +// This function has been copied from tqobject.cpp. +// + +inline bool isSpace( char x ) +{ +#if defined(Q_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->mocError = 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 signals or slots."); + 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::tqt_invoke() rather than A::B::tqt_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) + 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 qualifiedClassName() +{ + return nameQualifier() + g->className; +} + +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_QUType_%s, %s, TQUParameter::Out }", uType(f->type).data(), uTypeExtra(f->type).data() ); + else + fprintf( out, "\t{ 0, &static_QUType_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_QUType_%s, %s, TQUParameter::%s }", + uType( type ).data(), uTypeExtra( type ).data(), + isInOut( type ) ? "InOut" : "In" ); + else + fprintf( out, "\t{ \"%s\", &static_QUType_%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 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 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 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 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 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 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 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 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 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 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 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 |= tqvariant_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 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 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 by: The TQt Meta Object Compiler version %d (TQt %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->signals.count() == 0 && g->slots.count() == 0 && g->props.count() == 0 && g->infos.count() == 0 ) + return; + if ( displayWarnings && (g->signals.count() + g->slots.count()) != 0 ) + tqmoc_err("The declaration of the class \"%s\" contains signals " + "or slots\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" + "\tsignals, slots or TQ_OBJECT." ); + return; + } + g->generatedCode = TRUE; + g->gen_count++; + + if ( g->gen_count == 1 ) { // first class to be generated + 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[i]; + fprintf( out, hdr1, (const char*)qualifiedClassName(),(const char*)fn); + fprintf( out, hdr2, formatRevision, TQT_VERSION_STR ); + fprintf( out, "%s", hdr3 ); + fprintf( out, "%s", hdr4 ); + + if ( !g->noInclude ) { + /* + The header file might be a TQt header file with + TQT_NO_COMPAT macros around signals, slots 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 <%sntqapplication.h>\n\n", (const char*)g->qtPath ); + fprintf( out, "#include <%sprivate/tqucomextra_p.h>\n", (const char*)g->qtPath ); + fprintf( out, "#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_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 \"(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->slots.first(); f && !needToIncludeVariant; f=g->slots.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::fromLatin1( 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}\n" ); + fprintf( out, "#ifdef TQT_THREAD_SUPPORT\n if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->lock();\n" ); + fprintf( out, " if ( metaObj ) {\n\tif (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();\n\treturn metaObj;\n }\n#endif // TQT_THREAD_SUPPORT\n" ); + if ( isTQObject ) + fprintf( out, " TQMetaObject* parentObject = staticTQtMetaObject();\n" ); + else if ( !g->superClassName.isEmpty() ) + fprintf( out, " TQMetaObject* parentObject = %s::staticMetaObject();\n", (const char*)g->superClassName ); + 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 slots +// + int n_enums = generateEnums(); + +// +// Build slots array in staticMetaObject() +// + generateFuncs( &g->slots, "slot", Slot_Num ); + +// +// Build signals array in staticMetaObject() +// + generateFuncs( &g->signals, "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->slots.count() ) + fprintf( out, "\tslot_tbl, %d,\n", g->slots.count() ); + else + fprintf( out, "\t0, 0,\n" ); + + if ( g->signals.count() ) + fprintf( out, "\tsignal_tbl, %d,\n", g->signals.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, "#ifdef TQT_THREAD_SUPPORT\n if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();\n#endif // TQT_THREAD_SUPPORT\n" ); + fprintf( out, " return metaObj;\n}\n" ); + +// +// End of function staticMetaObject() +// + +// +// Generate smart cast function +// + fprintf( out, "\nvoid* %s::tqt_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 %s::tqt_cast( clname );\n", + (const char*)purestSuperClassName() ); + else + fprintf( out, " return 0;\n" ); + fprintf( out, "}\n" ); + +// +// Generate internal signal functions +// + Function *f; + f = g->signals.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// TQ_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( staticMetaObject()->signalOffset() + %d", 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 ( signalsBlocked() )\n\treturn%s;\n", hasReturnValue ? " something" : "" ); + fprintf( out, " TQConnectionList *clist = receivers( 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_QUType_%s.set(o,something);\n", utype.data() ); + } else if ( uType( f->type ) == "varptr" ) { + fprintf( out, " static_QUType_varptr.set(o,&something);\n" ); + } else { + fprintf( out, " static_QUType_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_QUType_%s.set(o+%d,t%d);\n", utype.data(), offset+1, offset ); + } else if ( uType( type ) == "varptr" ) { + fprintf( out, " static_QUType_varptr.set(o+%d,&t%d);\n", offset+1, offset ); + } else { + fprintf( out, " static_QUType_ptr.set(o+%d,&t%d);\n", offset+1, offset ); + } + a = f->args->next(); + offset++; + } + } + fprintf( out, " o[%d].isLastObject = true;\n", f->args->count() + 0 ); + 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_QUType_%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_QUType_ptr.get(o+%d);\n", offset, offset, type.data(), offset+1 ); + else + fprintf( out, " t%d = static_QUType_%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_QUType_%s.get(o);\n", f->type.data(), utype.data() ); + else + fprintf( out, " return static_QUType_%s.get(o);\n", utype.data() ); + } + + fprintf( out, "}\n" ); + } + + f = g->signals.next(); + sigindex++; + } + + +// +// Generate internal tqt_invoke() function +// + fprintf( out, "\nbool %s::tqt_invoke( int _id, TQUObject* _o )\n{\n", qualifiedClassName().data() ); + + if( !g->slots.isEmpty() ) { + fprintf( out, " switch ( _id - staticMetaObject()->slotOffset() ) {\n" ); + int slotindex = -1; + for ( f = g->slots.first(); f; f = g->slots.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_QUType_%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_QUType_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_QUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); + else + fprintf( out, "(%s)static_QUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); + } else { + TQCString castType = castToUType( type ); + if(castType == type) + fprintf( out, "(%s)(*((%s*)static_QUType_ptr.get(_o+%d)))", type.data(), + castType.data(), offset+1 ); + else + fprintf( out, "(%s)*((%s*)static_QUType_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 %s::tqt_invoke( _id, _o );\n", + (const char *) purestSuperClassName() ); + } else { + fprintf( out, "\treturn FALSE;\n" ); + } + fprintf( out, " }\n" ); + fprintf( out, " return TRUE;\n}\n" ); + } else { + if ( !g->superClassName.isEmpty() && !isTQObject ) + fprintf( out, " return %s::tqt_invoke(_id,_o);\n}\n", + (const char *) purestSuperClassName() ); + else + fprintf( out, " return FALSE;\n}\n" ); + } + + +// +// Generate internal tqt_emit() function +// + fprintf( out, "\nbool %s::tqt_emit( int _id, TQUObject* _o )\n{\n", qualifiedClassName().data() ); + + if ( !g->signals.isEmpty() ) { + fprintf( out, " switch ( _id - staticMetaObject()->signalOffset() ) {\n" ); + int signalindex = -1; + for ( f = g->signals.first(); f; f = g->signals.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_QUType_%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_QUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); + else + fprintf( out, "(%s)static_QUType_%s.get(_o+%d)", type.data(), utype.data(), offset+1 ); + } else { + TQCString castType = castToUType( type ); + if(castType == type) + fprintf( out, "(%s)(*((%s*)static_QUType_ptr.get(_o+%d)))", type.data(), + castType.data(), offset+1 ); + else + fprintf( out, "(%s)*((%s*)static_QUType_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 %s::tqt_emit(_id,_o);\n", + (const char *) purestSuperClassName() ); + else + fprintf( out, "\treturn FALSE;\n" ); + fprintf( out, " }\n" ); + fprintf( out, " return TRUE;\n}\n" ); + } else { + if ( !g->superClassName.isEmpty() && !isTQObject ) + fprintf( out, " return %s::tqt_emit(_id,_o);\n}\n", + (const char *) purestSuperClassName() ); + else + fprintf( out, " return FALSE;\n}\n" ); + } + + + fprintf( out, "#ifndef TQT_NO_PROPERTIES\n" ); +// +// Generate internal tqt_property() functions +// + + fprintf( out, "\nbool %s::tqt_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 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" ) + fprintf( out, "v->asMap()" ); + else if ( type == "TQValueList" ) + 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() ); break;\n", + it.current()->getfunc->name.data(), + !isVariantType( it.current()->type ) ? "(int)" : "", + it.current()->getfunc->name.data()); + else + fprintf( out, "\tcase 1: *v = TQVariant( %sthis->%s() ); break;\n", + !isVariantType( it.current()->type ) ? "(int)" : "", + it.current()->getfunc->name.data()); + } 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 %s::tqt_property( id, f, v );\n", + (const char *) purestSuperClassName() ); + else + fprintf( out, "\treturn FALSE;\n" ); + fprintf( out, " }\n" ); + fprintf( out, " return TRUE;\n" ); + + if ( need_resolve ) + fprintf( out, "resolve:\n return %s::tqt_property( staticMetaObject()->resolveProperty(id), f, v );\n", + (const char *) purestSuperClassName() ); + fprintf( out, "}\n" ); + } else { + if ( !g->superClassName.isEmpty() && !isTQObject ) + fprintf( out, " return %s::tqt_property( id, f, v);\n}\n", + (const char *) purestSuperClassName() ); + else + fprintf( out, " return FALSE;\n}\n" ); + } + + fprintf( out, "\nbool %s::tqt_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 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->signals.append( tmpFunc ); + break; + } else { + if ( m == SlotMember ) + g->slots.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/src/tqmoc/tqmoc_yacc.h b/src/tqmoc/tqmoc_yacc.h new file mode 100644 index 000000000..3a438d372 --- /dev/null +++ b/src/tqmoc/tqmoc_yacc.h @@ -0,0 +1,183 @@ +/* A Bison parser, made by GNU Bison 2.5. */ + +/* Bison interface for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2011 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 . */ + +/* 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, + TQ_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 TQ_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 2068 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 2068 of yacc.c */ +#line 175 "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; + + diff --git a/src/widgets/tqtextedit.h b/src/widgets/tqtextedit.h index f58b91d09..5ea273c6e 100644 --- a/src/widgets/tqtextedit.h +++ b/src/widgets/tqtextedit.h @@ -51,7 +51,7 @@ #ifndef TQT_NO_TEXTEDIT // uncomment below to enable optimization mode - also uncomment the -// optimDoAutoScroll() private slot since moc ignores #ifdefs.. +// optimDoAutoScroll() private slot since tqmoc ignores #ifdefs.. #define QT_TEXTEDIT_OPTIMIZATION class TQPainter; -- cgit v1.2.3