diff options
Diffstat (limited to 'kalyptus/kalyptusCxxToSmoke.pm')
-rw-r--r-- | kalyptus/kalyptusCxxToSmoke.pm | 204 |
1 files changed, 102 insertions, 102 deletions
diff --git a/kalyptus/kalyptusCxxToSmoke.pm b/kalyptus/kalyptusCxxToSmoke.pm index 8549d39..3a1f53f 100644 --- a/kalyptus/kalyptusCxxToSmoke.pm +++ b/kalyptus/kalyptusCxxToSmoke.pm @@ -63,18 +63,18 @@ BEGIN # Mapping for iterproto, when making up the munged method names %mungedTypeMap = ( - 'QString' => '$', - 'QString*' => '$', - 'QString&' => '$', - 'QCString' => '$', - 'QCString*' => '$', - 'QCString&' => '$', - 'QByteArray' => '$', - 'QByteArray&' => '$', - 'QByteArray*' => '$', + 'TQString' => '$', + 'TQString*' => '$', + 'TQString&' => '$', + 'TQCString' => '$', + 'TQCString*' => '$', + 'TQCString&' => '$', + 'TQByteArray' => '$', + 'TQByteArray&' => '$', + 'TQByteArray*' => '$', 'char*' => '$', - 'QCOORD*' => '?', - 'QRgb*' => '?', + 'TQCOORD*' => '?', + 'TQRgb*' => '?', ); # Yes some of this is in kalyptusDataDict's ctypemap @@ -93,54 +93,54 @@ BEGIN 'unsigned long' => 'ulong', # Anything that is not known is mapped to void*, so no need for those here anymore -# 'QWSEvent*' => 'void*', -# 'QDiskFont*' => 'void*', +# 'TQWSEvent*' => 'void*', +# 'TQDiskFont*' => 'void*', # 'XEvent*' => 'void*', -# 'QStyleHintReturn*' => 'void*', +# 'TQStyleHintReturn*' => 'void*', # 'FILE*' => 'void*', -# 'QUnknownInterface*' => 'void*', +# 'TQUnknownInterface*' => 'void*', # 'GDHandle' => 'void*', # '_NPStream*' => 'void*', -# 'QTextFormat*' => 'void*', -# 'QTextDocument*' => 'void*', -# 'QTextCursor*' => 'void*', -# 'QTextParag**' => 'void*', -# 'QTextParag*' => 'void*', -# 'QRemoteInterface*' => 'void*', -# 'QSqlRecordPrivate*' => 'void*', -# 'QTSMFI' => 'void*', # QTextStream's QTSManip +# 'TQTextFormat*' => 'void*', +# 'TQTextDocument*' => 'void*', +# 'TQTextCursor*' => 'void*', +# 'TQTextParag**' => 'void*', +# 'TQTextParag*' => 'void*', +# 'TQRemoteInterface*' => 'void*', +# 'TQSqlRecordPrivate*' => 'void*', +# 'TQTSMFI' => 'void*', # TQTextStream's TQTSManip # 'const GUID&' => 'void*', -# 'QWidgetMapper*' => 'void*', +# 'TQWidgetMapper*' => 'void*', # 'MSG*' => 'void*', -# 'const QSqlFieldInfoList&' => 'void*', # QSqlRecordInfo - TODO (templates) +# 'const TQSqlFieldInfoList&' => 'void*', # TQSqlRecordInfo - TODO (templates) - 'QPtrCollection::Item' => 'void*', # to avoid a warning + 'TQPtrCollection::Item' => 'void*', # to avoid a warning 'mode_t' => 'long', - 'QProcess::PID' => 'long', - 'size_type' => 'int', # QSqlRecordInfo - 'Qt::ComparisonFlags' => 'uint', - 'Qt::ToolBarDock' => 'int', # compat thing, Qt shouldn't use it - 'QIODevice::Offset' => 'ulong', + 'TQProcess::PID' => 'long', + 'size_type' => 'int', # TQSqlRecordInfo + 'TQt::ComparisonFlags' => 'uint', + 'TQt::ToolBarDock' => 'int', # compat thing, TQt shouldn't use it + 'TQIODevice::Offset' => 'ulong', 'WState' => 'int', 'WId' => 'ulong', - 'QRgb' => 'uint', - 'QCOORD' => 'int', - 'QTSMFI' => 'int', - 'Qt::WState' => 'int', - 'Qt::WFlags' => 'int', - 'Qt::HANDLE' => 'uint', - 'QEventLoop::ProcessEventsFlags' => 'uint', - 'QStyle::SCFlags' => 'int', - 'QStyle::SFlags' => 'int', - 'Q_INT16' => 'short', - 'Q_INT32' => 'int', - 'Q_INT8' => 'char', - 'Q_LONG' => 'long', - 'Q_UINT16' => 'ushort', - 'Q_UINT32' => 'uint', - 'Q_UINT8' => 'uchar', - 'Q_ULONG' => 'long', + 'TQRgb' => 'uint', + 'TQCOORD' => 'int', + 'TQTSMFI' => 'int', + 'TQt::WState' => 'int', + 'TQt::WFlags' => 'int', + 'TQt::HANDLE' => 'uint', + 'TQEventLoop::ProcessEventsFlags' => 'uint', + 'TQStyle::SCFlags' => 'int', + 'TQStyle::SFlags' => 'int', + 'TTQ_INT16' => 'short', + 'TTQ_INT32' => 'int', + 'TTQ_INT8' => 'char', + 'TTQ_LONG' => 'long', + 'TTQ_UINT16' => 'ushort', + 'TTQ_UINT32' => 'uint', + 'TTQ_UINT8' => 'uchar', + 'TTQ_ULONG' => 'long', ); } @@ -155,10 +155,10 @@ sub writeDoc mkpath( $outputdir ) unless -f $outputdir; - # Define QPtrCollection::Item, for resolveType - unless ( kdocAstUtil::findRef( $rootnode, "QPtrCollection::Item" ) ) { - my $cNode = kdocAstUtil::findRef( $rootnode, "QPtrCollection" ); - warn "QPtrCollection not found" if (!$cNode); + # Define TQPtrCollection::Item, for resolveType + unless ( kdocAstUtil::findRef( $rootnode, "TQPtrCollection::Item" ) ) { + my $cNode = kdocAstUtil::findRef( $rootnode, "TQPtrCollection" ); + warn "TQPtrCollection not found" if (!$cNode); my $node = Ast::New( 'Item' ); $node->AddProp( "NodeType", "Forward" ); $node->AddProp( "Source", $cNode->{Source} ) if ($cNode); @@ -220,28 +220,28 @@ sub preParseClass if( $#{$classNode->{Kids}} < 0 || $classNode->{Access} eq "private" || - $classNode->{Access} eq "protected" || # e.g. QPixmap::QPixmapData + $classNode->{Access} eq "protected" || # e.g. TQPixmap::TQPixmapData exists $classNode->{Tmpl} || - # Don't generate standard bindings for QString, this class is handled as a native type - $className eq 'QString' || - $className eq 'QConstString' || - $className eq 'QCString' || + # Don't generate standard bindings for TQString, this class is handled as a native type + $className eq 'TQString' || + $className eq 'TQConstString' || + $className eq 'TQCString' || # Don't map classes which are really arrays - $className eq 'QStringList' || - $className eq 'QCanvasItemList' || - $className eq 'QWidgetList' || - $className eq 'QObjectList' || - $className eq 'QStrList' || + $className eq 'TQStringList' || + $className eq 'TQCanvasItemList' || + $className eq 'TQWidgetList' || + $className eq 'TQObjectList' || + $className eq 'TQStrList' || # Those are template related - $className eq 'QTSManip' || # cause compiler errors with several gcc versions - $className eq 'QGDict' || - $className eq 'QGList' || - $className eq 'QGVector' || - $className eq 'QStrIList' || - $className eq 'QStrIVec' || - $className eq 'QByteArray' || - $className eq 'QBitArray' || - $classNode->{NodeType} eq 'union' # Skip unions for now, e.g. QPDevCmdParam + $className eq 'TQTSManip' || # cause compiler errors with several gcc versions + $className eq 'TQGDict' || + $className eq 'TQGList' || + $className eq 'TQGVector' || + $className eq 'TQStrIList' || + $className eq 'TQStrIVec' || + $className eq 'TQByteArray' || + $className eq 'TQBitArray' || + $classNode->{NodeType} eq 'union' # Skip unions for now, e.g. TQPDevCmdParam ) { print STDERR "Skipping $className\n" if ($debug); print STDERR "Skipping union $className\n" if ( $classNode->{NodeType} eq 'union'); @@ -275,7 +275,7 @@ sub preParseClass my $name = $m->{astNodeName}; if( $m->{NodeType} eq "method" ) { - if ( $m->{ReturnType} eq 'typedef' # QFile's EncoderFn/DecoderFn callback, very badly parsed + if ( $m->{ReturnType} eq 'typedef' # TQFile's EncoderFn/DecoderFn callback, very badly parsed ) { $m->{NodeType} = 'deleted'; next; @@ -330,20 +330,20 @@ sub preParseClass } if ( $arg->{ArgType} eq '...' # refuse a method with variable arguments - or $arg->{ArgType} eq 'image_io_handler' # QImage's callback - or $arg->{ArgType} eq 'DecoderFn' # QFile's callback - or $arg->{ArgType} eq 'EncoderFn' # QFile's callback - or $arg->{ArgType} =~ /bool \(\*\)\(QObject/ # QMetaObject's ctor - or $arg->{ArgType} eq 'QtStaticMetaObjectFunction' # QMetaObjectCleanUp's ctor with func pointer - or $arg->{ArgType} eq 'const QTextItem&' # ref to a private class in 3.2.0b1 + or $arg->{ArgType} eq 'image_io_handler' # TQImage's callback + or $arg->{ArgType} eq 'DecoderFn' # TQFile's callback + or $arg->{ArgType} eq 'EncoderFn' # TQFile's callback + or $arg->{ArgType} =~ /bool \(\*\)\(TQObject/ # TQMetaObject's ctor + or $arg->{ArgType} eq 'TQtStaticMetaObjectFunction' # TQMetaObjectCleanUp's ctor with func pointer + or $arg->{ArgType} eq 'const TQTextItem&' # ref to a private class in 3.2.0b1 or $arg->{ArgType} eq 'FILE*' # won't be able to handle that I think ) { $m->{NodeType} = 'deleted'; } else { - # Resolve type in full, e.g. for QSessionManager::RestartHint - # (x_QSessionManager doesn't inherit QSessionManager) + # Resolve type in full, e.g. for TQSessionManager::RestartHint + # (x_TQSessionManager doesn't inherit TQSessionManager) $arg->{ArgType} = kalyptusDataDict::resolveType($arg->{ArgType}, $classNode, $rootnode); registerType( $arg->{ArgType} ); $argId++; @@ -368,7 +368,7 @@ sub preParseClass } elsif( $m->{NodeType} eq 'var' ) { my $varType = $m->{Type}; - # We are interested in public static vars, like QColor::blue + # We are interested in public static vars, like TQColor::blue if ( $varType =~ s/static\s+// && $m->{Access} ne 'private' ) { $varType =~ s/const\s+(.*)\s*&/$1/; @@ -423,8 +423,8 @@ sub preParseClass $methodNode->AddProp( "Access", "public" ); } - # If we have a private pure virtual, then the class can't be instanciated (e.g. QCanvasItem) - # Same if the class has only private constructors (e.g. QInputDialog) + # If we have a private pure virtual, then the class can't be instanciated (e.g. TQCanvasItem) + # Same if the class has only private constructors (e.g. TQInputDialog) $classNode->AddProp( "CanBeInstanciated", $hasPublicProtectedConstructor && !$hasPrivatePureVirtual ); # We will derive from the class only if it has public or protected constructors. @@ -434,9 +434,9 @@ sub preParseClass # We need a public dtor to destroy the object --- ### aren't protected dtors ok too ?? $classNode->AddProp( "HasPublicDestructor", $hasPublicDestructor ); - # Hack for QAsyncIO. We don't implement the "if a class has no explicit copy ctor, + # Hack for TQAsyncIO. We don't implement the "if a class has no explicit copy ctor, # then all of its member variables must be copiable, otherwise the class isn't copiable". - $hasPrivateCopyConstructor = 1 if ( $className eq 'QAsyncIO' ); + $hasPrivateCopyConstructor = 1 if ( $className eq 'TQAsyncIO' ); # Remember if this class can't be copied - it means all its descendants can't either $classNode->AddProp( "CanBeCopied", !$hasPrivateCopyConstructor ); @@ -536,7 +536,7 @@ my $fhn =1; # static print $fh $switchCode; print $fh "}\n\n"; } - #if ( $className =~ /^(QBrush|QColor|QCursor|QFont|QImage|QPalette|QPixmap|QPoint|QPointArray|QRect|QRegion|QSize|QWMatrix)$/ ) { + #if ( $className =~ /^(TQBrush|TQColor|TQCursor|TQFont|TQImage|TQPalette|TQPixmap|TQPoint|TQPointArray|TQRect|TQRegion|TQSize|TQWMatrix)$/ ) { # print XCPPFILE " const char *{serial} operator << () const : pig_serialize(\$this);\n"; # print XCPPFILE " void operator >> (const char *{serial}) : pig_deserialize(\$this, \$1);\n"; #} @@ -645,7 +645,7 @@ sub coerce_type($$$$) { } else { if ( $unionfield eq 's_class' or ( $unionfield eq 's_voidp' and $type ne 'void*' ) - or $type eq 'QString' ) { # hack + or $type eq 'TQString' ) { # hack $type =~ s/^const\s+//; if($new) { $code .= "(void*)new $type($var);\n"; @@ -661,7 +661,7 @@ sub coerce_type($$$$) { } # Generate the list of args casted to their real type, e.g. -# (QObject*)x[1].s_class,(QEvent*)x[2].s_class,x[3].s_int +# (TQObject*)x[1].s_class,(TQEvent*)x[2].s_class,x[3].s_int sub makeCastedArgList { my @castedList; @@ -689,7 +689,7 @@ sub makeCastedArgList } else { if ( $unionfield eq 's_class' or ( $unionfield eq 's_voidp' and $type ne 'void*' ) - or $type eq 'QString' ) { # hack + or $type eq 'TQString' ) { # hack $cast = "*($type *)"; } else { $cast = "($type)"; @@ -891,18 +891,18 @@ sub generateMethod($$$) # # Skip internal methods, which return unknown types # # Hmm, the C# bindings have a list of those too. -# return if ( $returnType =~ m/QGfx\s*\*/ ); +# return if ( $returnType =~ m/TQGfx\s*\*/ ); # return if ( $returnType eq 'CGContextRef' ); -# return if ( $returnType eq 'QWSDisplay *' ); +# return if ( $returnType eq 'TQWSDisplay *' ); # # This stuff needs callback, or ** # return if ( $name eq 'defineIOHandler' or $name eq 'qt_init_internal' ); # # Skip casting operators, but not == < etc. # return if ( $name =~ /operator \w+/ ); -# # QFile's EncoderFn/DecoderFn +# # TQFile's EncoderFn/DecoderFn # return if ( $name =~ /set[ED][ne]codingFunction/ ); -# # How to implement this? (QXmlDefaultHandler/QXmlEntityResolver::resolveEntity, needs A*&) -# return if ( $name eq 'resolveEntity' and $className =~ /^QXml/ ); -# return if ( $className eq 'QBitArray' && $m->{Access} eq 'protected' ); +# # How to implement this? (TQXmlDefaultHandler/TQXmlEntityResolver::resolveEntity, needs A*&) +# return if ( $name eq 'resolveEntity' and $className =~ /^TQXml/ ); +# return if ( $className eq 'TQBitArray' && $m->{Access} eq 'protected' ); #print STDERR "Tests passed, generating.\n"; @@ -1386,7 +1386,7 @@ sub registerType($$) { return; } - die if $type eq 'QTextEdit::UndoRedoInfo::Type'; + die if $type eq 'TQTextEdit::UndoRedoInfo::Type'; die if $type eq ''; my $realType = $type; @@ -1408,7 +1408,7 @@ sub registerType($$) { } # Apply typedefs, and store the resulting type. - # For instance, if $type was Q_UINT16&, realType will be ushort + # For instance, if $type was TTQ_UINT16&, realType will be ushort $allTypes{$type}{realType} = applyTypeDef( $realType ); # In the first phase we only create entries into allTypes. @@ -1506,9 +1506,9 @@ sub prepareCaseDict($) { # Don't generate bindings for pure virtuals - we can't call them ;) $ok = 0 if ( $ok && $m->{Flags} =~ "p" ); - # Bugfix for Qt-3.0.4: those methods are NOT implemented (report sent). - $ok = 0 if ( $ok && $className eq 'QLineEdit' && ( $name eq 'setPasswordChar' || $name eq 'passwordChar' ) ); - $ok = 0 if ( $ok && $className eq 'QWidgetItem' && $name eq 'widgetSizeHint' ); + # Bugfix for TQt-3.0.4: those methods are NOT implemented (report sent). + $ok = 0 if ( $ok && $className eq 'TQLineEdit' && ( $name eq 'setPasswordChar' || $name eq 'passwordChar' ) ); + $ok = 0 if ( $ok && $className eq 'TQWidgetItem' && $name eq 'widgetSizeHint' ); if ( !$ok ) { @@ -1615,7 +1615,7 @@ sub writeSmokeDataFile($) { for my $s (@super) { my $superClassName = join( "::", kdocAstUtil::heritage($s) ); next if !defined $classidx{$superClassName}; # inherits from unknown class, see below - next if $classidx{$superClassName} == $cur; # shouldn't happen in Qt + next if $classidx{$superClassName} == $cur; # shouldn't happen in TQt $cur = $classidx{$superClassName}; print OUT "\t case $cur: return (void*)($superClassName*)($className*)xptr;\n"; } @@ -1755,7 +1755,7 @@ sub writeSmokeDataFile($) { # First write the name print OUT "\t{ \"$type\", "; # Then write the classId (and find out the typeid at the same time) - if(exists $classidx{$realType}) { # this one first, we want t_class for QBlah* + if(exists $classidx{$realType}) { # this one first, we want t_class for TQBlah* $typeId = 't_class'; print OUT "$classidx{$realType}, "; } |