You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(15) |
Feb
(26) |
Mar
(97) |
Apr
(224) |
May
(226) |
Jun
|
Jul
(3) |
Aug
(22) |
Sep
(48) |
Oct
|
Nov
|
Dec
(38) |
2004 |
Jan
(28) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(37) |
Jul
|
Aug
(73) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <bl...@us...> - 2003-04-06 16:17:22
|
Update of /cvsroot/cpptool/rfta/include/rfta/refactoring In directory sc8-pr-cvs1:/tmp/cvs-serv7316/include/rfta/refactoring Modified Files: InlineTempRefactoring.h Log Message: * modified variable decl child node range. It now encompass the ', ' that follow the variable declaration. Index: InlineTempRefactoring.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/InlineTempRefactoring.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InlineTempRefactoring.h 30 Dec 2002 10:44:58 -0000 1.1 --- InlineTempRefactoring.h 6 Apr 2003 16:17:19 -0000 1.2 *************** *** 51,54 **** --- 51,55 ---- void calculateTempDeclRange(); //< finds the source range of the temporary declaration bool isInitializerAtomic(); //< does check the initializer for being an atomic value or not + int findTempIndexInDeclaration(); void checkForVariableAssignments(); *************** *** 58,65 **** ToolsBox::ASTNodes occurrences_; //< occurences of the temporary variable ASTNodePtr localeVariableNode_; //< ast node of the identifier at selection ! ASTNodePtr temporaryDecl; //< ast node of the declaration of the selected identifier ASTNodePtr initValue_; //< ast node of the initializer that initializes the selected variable ! SourceRange rangeOfTempDeclaration; //< Range of temporary declaration that is inlined (this range can be erased after inlining) ! bool tempDeclaredInMiddle; //< true if the temporary is declared between other variables. }; --- 59,65 ---- ToolsBox::ASTNodes occurrences_; //< occurences of the temporary variable ASTNodePtr localeVariableNode_; //< ast node of the identifier at selection ! ASTNodePtr temporaryDecl_; //< ast node of the declaration of the selected identifier ASTNodePtr initValue_; //< ast node of the initializer that initializes the selected variable ! SourceRange rangeOfTempDeclaration_; //< Range of temporary declaration that is inlined (this range can be erased after inlining) }; |
From: <bl...@us...> - 2003-04-06 16:17:22
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv7316/src/rfta Modified Files: InlineTempRefactoring.cpp InlineTempRefactoringTest.cpp Log Message: * modified variable decl child node range. It now encompass the ', ' that follow the variable declaration. Index: InlineTempRefactoring.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/InlineTempRefactoring.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** InlineTempRefactoring.cpp 5 Apr 2003 12:13:36 -0000 1.6 --- InlineTempRefactoring.cpp 6 Apr 2003 16:17:18 -0000 1.7 *************** *** 122,130 **** // check for initializer property and throw exception if not found ! if (!temporaryDecl->hasProperty(ASTNodeProperties::variableInitializerProperty)) throw RefactoringError( RefactoringError::identifierIsNotInitialized ); ASTNodePtr initializerNode_; ! initializerNode_ = temporaryDecl->getProperty(ASTNodeProperties::variableInitializerProperty); // check for value expression: --- 122,130 ---- // check for initializer property and throw exception if not found ! if (!temporaryDecl_->hasProperty(ASTNodeProperties::variableInitializerProperty)) throw RefactoringError( RefactoringError::identifierIsNotInitialized ); ASTNodePtr initializerNode_; ! initializerNode_ = temporaryDecl_->getProperty(ASTNodeProperties::variableInitializerProperty); // check for value expression: *************** *** 166,170 **** // get the expression this variable belongs to: ASTNodePtr parentExpr = boost::make_shared((*it)->getParentNode()); ! if ( parentExpr != temporaryDecl) { bool go_deeper = false; --- 166,170 ---- // get the expression this variable belongs to: ASTNodePtr parentExpr = boost::make_shared((*it)->getParentNode()); ! if ( parentExpr != temporaryDecl_) { bool go_deeper = false; *************** *** 256,264 **** try { ! temporaryDecl = context.getLocalVariableIdentifierDeclaration( localeVariableNode_ ); ASTNodePtr compoundNode = sourceNode_->getChildAt(0); ToolsBox::getLocalVariableOccurrences( compoundNode, ! temporaryDecl, sourceNode_, context, --- 256,264 ---- try { ! temporaryDecl_ = context.getLocalVariableIdentifierDeclaration( localeVariableNode_ ); ASTNodePtr compoundNode = sourceNode_->getChildAt(0); ToolsBox::getLocalVariableOccurrences( compoundNode, ! temporaryDecl_, sourceNode_, context, *************** *** 275,339 **** * or if it's part of a declaration for more than one variable. */ ! void InlineTempRefactoring::calculateTempDeclRange() { - tempDeclaredInMiddle = false; - // remove the declaration of the temporary: ! ASTNodePtr decl_expr = boost::make_shared(temporaryDecl->getParentNode()); ! int countVarDecl = 0; ! for (int j = 0; j < decl_expr->getChildCount(); j++ ) { - if (decl_expr->getChildAt(j)->getType() == ASTNodeTypes::variableDeclExpression ) - countVarDecl++; - } - // check number of variables declared in this declaration: - if ( countVarDecl == 1) // Temp is declared in its own declaration expression, range is the full expression ! rangeOfTempDeclaration = decl_expr->getRange(); ! else ! { // Temp is declared together with other variables, we need to calculate the range ! ASTNodePtr tempVarNameNode = temporaryDecl->getProperty(ASTNodeProperties::variableNameProperty); ! // find out the declaration just before the temporary is declared: ! int tempVarBegin = tempVarNameNode->getRange().getStartIndex(); ! int tempVarEnd = initValue_->getRange().getEndIndex(); ! int lastChildEndBefore = 0; ! int firstChildStartAfter = decl_expr->getRange().getEndIndex() - 1; // ends just before the semicolon ! bool childDeclaredAfterTemp = false; ! for (int j = 0; j < decl_expr->getChildCount(); j++ ) ! { ! ASTNodePtr child = decl_expr->getChildAt(j); ! if ( temporaryDecl == child ) continue; ! ASTNodePtr childNameNode = child->getProperty(ASTNodeProperties::variableNameProperty); ! ! int childEndIndex = child->getRange().getEndIndex(); ! int childStartIndex = childNameNode->getRange().getStartIndex(); ! ! // check if the current child is the last before the temporary: ! if ( childEndIndex < tempVarBegin && childEndIndex > lastChildEndBefore ) ! lastChildEndBefore = childEndIndex; ! // check if the current child is declared after the temporary: ! if ( childStartIndex > tempVarEnd && firstChildStartAfter > childStartIndex ) ! { ! childDeclaredAfterTemp = true; ! firstChildStartAfter = childStartIndex; ! } ! } ! ! // temp is declared between other in case: ! // there're declaration after its declaration && it is not the first ! tempDeclaredInMiddle = childDeclaredAfterTemp && ( lastChildEndBefore != 0 ); ! // check if temporary is declared as first: ! if ( lastChildEndBefore==0 ) ! lastChildEndBefore = tempVarBegin; // in this case delete range beginning at the temp-var-name ! ! // calculate the range: ! SourceRange merged ( lastChildEndBefore , firstChildStartAfter - lastChildEndBefore ); ! rangeOfTempDeclaration = merged; ! } } bool InlineTempRefactoring::isInitializerAtomic() { --- 275,327 ---- * or if it's part of a declaration for more than one variable. */ ! void ! InlineTempRefactoring::calculateTempDeclRange() { // remove the declaration of the temporary: ! ASTNodePtr decl_expr = boost::make_shared(temporaryDecl_->getParentNode()); ! if ( decl_expr->getChildCount() == 1) { // Temp is declared in its own declaration expression, range is the full expression ! rangeOfTempDeclaration_ = decl_expr->getRange(); ! return; ! } ! // Temp is declared together with other variables, we need to calculate the range ! ASTNodePtr tempVarNameNode = temporaryDecl_->getProperty(ASTNodeProperties::variableNameProperty); ! int startIndex = temporaryDecl_->getRange().getStartIndex(); ! int endIndex = temporaryDecl_->getRange().getEndIndex(); ! int varDeclIndex = findTempIndexInDeclaration(); ! if ( varDeclIndex == decl_expr->getChildCount()-1 ) ! { ! ASTNodePtr previousVarNode = decl_expr->getChildAt( varDeclIndex -1 ); ! ASTNodePtr previousEndNode = previousVarNode->getProperty( ASTNodeProperties::typeDeclSuffixProperty ); ! if ( !previousEndNode ) ! previousEndNode = previousVarNode->getProperty( ASTNodeProperties::variableNameProperty ); ! startIndex = previousEndNode->getRange().getEndIndex(); ! } ! rangeOfTempDeclaration_ = SourceRange( startIndex, endIndex - startIndex ); } + + int + InlineTempRefactoring::findTempIndexInDeclaration() + { + ASTNodePtr tempVarNameNode = temporaryDecl_->getProperty( ASTNodeProperties::variableNameProperty ); + ASTNodePtr decl_expr = boost::make_shared( temporaryDecl_->getParentNode() ); + for ( int index =0; index < decl_expr->getChildCount(); ++index ) + { + ASTNodePtr childNode = decl_expr->getChildAt( index ); + ASTNodePtr childNameNode = childNode->getProperty(ASTNodeProperties::variableNameProperty); + if ( tempVarNameNode->getRange() == childNameNode->getRange() ) + return index; + } + + // should never happen + throw std::logic_error( "InlineTempRefactoring::findTempIndexInDeclaration(): declared local variable not found" ); + } + + bool InlineTempRefactoring::isInitializerAtomic() { *************** *** 361,368 **** calculateTempDeclRange(); ! if (tempDeclaredInMiddle) ! transforms.add( *new ReplaceTextTransform( rangeOfTempDeclaration , " , " ) ); ! else ! transforms.add( *new ReplaceTextTransform( rangeOfTempDeclaration , "" ) ); std::string newtext; --- 349,353 ---- calculateTempDeclRange(); ! transforms.add( *new ReplaceTextTransform( rangeOfTempDeclaration_ , "" ) ); std::string newtext; *************** *** 381,385 **** { ASTNodePtr parentExpr = boost::make_shared((*it)->getParentNode()); ! if ( parentExpr != temporaryDecl) { SourceRange range = (*it)->getRange(); --- 366,370 ---- { ASTNodePtr parentExpr = boost::make_shared((*it)->getParentNode()); ! if ( parentExpr != temporaryDecl_) { SourceRange range = (*it)->getRange(); Index: InlineTempRefactoringTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/InlineTempRefactoringTest.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** InlineTempRefactoringTest.cpp 5 Apr 2003 12:13:36 -0000 1.4 --- InlineTempRefactoringTest.cpp 6 Apr 2003 16:17:19 -0000 1.5 *************** *** 226,230 **** builder_->add( "{" ! " double y;" ); builder_->addKeyingMid( " double z , ", "x"," = 4;" , "selection" ); builder_->add( " y += y * x;"); --- 226,230 ---- builder_->add( "{" ! " double y;" ); builder_->addKeyingMid( " double z , ", "x"," = 4;" , "selection" ); builder_->add( " y += y * x;"); *************** *** 275,279 **** "{" " double y;" ); ! builder_->addKeyingMid( " double v , ", "x"," = 4, z;", "selection" ); builder_->add( " y += y * x;"); builder_->add( --- 275,279 ---- "{" " double y;" ); ! builder_->addKeyingMid( " double v, ", "x"," = 4, z;", "selection" ); builder_->add( " y += y * x;"); builder_->add( *************** *** 285,289 **** std::string expectedSource( "{" ! " double y; double v , z;" " y += y * 4;" " return 4 * getQuantity();" --- 285,289 ---- std::string expectedSource( "{" ! " double y; double v, z;" " y += y * 4;" " return 4 * getQuantity();" |
From: <bl...@us...> - 2003-04-06 15:11:26
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv11410/src/rfta Modified Files: CodeModelGeneratorTest.cpp CodeWriterInsertTest.cpp CodeWriterTest.cpp CodeWriterTestBase.cpp Log Message: * declarator are stored using smart pointer in declarator expression (more robust) Index: CodeModelGeneratorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeModelGeneratorTest.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CodeModelGeneratorTest.cpp 24 Mar 2003 07:57:51 -0000 1.4 --- CodeModelGeneratorTest.cpp 6 Apr 2003 15:11:23 -0000 1.5 *************** *** 54,65 **** RFTA_ASSERT_EQUAL( 1, declExpression->getDeclaratorCount() ); ! const CodeModel::Declarator &declarator = declExpression->getDeclaratorAt(0); ! RFTA_ASSERT_EQUAL( "", declarator.getType() ); ! RFTA_ASSERT_EQUAL( "", declarator.getTypeSuffix() ); ! RFTA_ASSERT_EQUAL( "x", declarator.getName() ); ! CPPUNIT_ASSERT( declarator.hasInitializer() ); CodeModel::AssignInitializerExpression &initializer = ! dynamic_cast<CodeModel::AssignInitializerExpression &>( *declarator.getInitializer() ); RFTA_ASSERT_EQUAL( "3", initializer.getValue()->getSourceText() ); } --- 54,65 ---- RFTA_ASSERT_EQUAL( 1, declExpression->getDeclaratorCount() ); ! CodeModel::DeclaratorPtr declarator = declExpression->getDeclaratorAt(0); ! RFTA_ASSERT_EQUAL( "", declarator->getType() ); ! RFTA_ASSERT_EQUAL( "", declarator->getTypeSuffix() ); ! RFTA_ASSERT_EQUAL( "x", declarator->getName() ); ! CPPUNIT_ASSERT( declarator->hasInitializer() ); CodeModel::AssignInitializerExpression &initializer = ! dynamic_cast<CodeModel::AssignInitializerExpression &>( *(declarator->getInitializer()) ); RFTA_ASSERT_EQUAL( "3", initializer.getValue()->getSourceText() ); } Index: CodeWriterInsertTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeWriterInsertTest.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CodeWriterInsertTest.cpp 24 Mar 2003 07:57:51 -0000 1.7 --- CodeWriterInsertTest.cpp 6 Apr 2003 15:11:23 -0000 1.8 *************** *** 282,286 **** CodeModel::DeclaratorExpressionPtr declarators( new CodeModel::DeclaratorExpression( makeTypePart( "int " ) ) ); ! CodeModel::Declarator declarator( "", "var", "[3]" ); declarators->appendDeclarator( declarator ); CodeModel::StatementPtr declarationStatement( new CodeModel::DeclarationStatement( declarators ) ); --- 282,286 ---- CodeModel::DeclaratorExpressionPtr declarators( new CodeModel::DeclaratorExpression( makeTypePart( "int " ) ) ); ! CodeModel::DeclaratorPtr declarator( new CodeModel::Declarator( "", "var", "[3]" ) ); declarators->appendDeclarator( declarator ); CodeModel::StatementPtr declarationStatement( new CodeModel::DeclarationStatement( declarators ) ); Index: CodeWriterTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeWriterTest.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** CodeWriterTest.cpp 18 Mar 2003 22:37:48 -0000 1.32 --- CodeWriterTest.cpp 6 Apr 2003 15:11:23 -0000 1.33 *************** *** 127,134 **** CodeModel::DeclaratorExpression &declExpression = *declStatement.getDeclaration(); RFTA_ASSERT_EQUAL( 1, declExpression.getDeclaratorCount() ); ! const CodeModel::Declarator &xDecl = declExpression.getDeclaratorAt(0); ! CPPUNIT_ASSERT( xDecl.hasInitializer() ); CodeModel::AssignInitializerExpression &xValueInitializer = ! dynamic_cast<CodeModel::AssignInitializerExpression &>( *xDecl.getInitializer() ); CodeModel::ExpressionPtr xValue = xValueInitializer.getValue(); --- 127,134 ---- CodeModel::DeclaratorExpression &declExpression = *declStatement.getDeclaration(); RFTA_ASSERT_EQUAL( 1, declExpression.getDeclaratorCount() ); ! CodeModel::DeclaratorPtr xDecl = declExpression.getDeclaratorAt(0); ! CPPUNIT_ASSERT( xDecl->hasInitializer() ); CodeModel::AssignInitializerExpression &xValueInitializer = ! dynamic_cast<CodeModel::AssignInitializerExpression &>( *(xDecl->getInitializer()) ); CodeModel::ExpressionPtr xValue = xValueInitializer.getValue(); Index: CodeWriterTestBase.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeWriterTestBase.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CodeWriterTestBase.cpp 5 Apr 2003 18:29:01 -0000 1.5 --- CodeWriterTestBase.cpp 6 Apr 2003 15:11:23 -0000 1.6 *************** *** 16,20 **** { SourceBasedTestBase::setUp(); ! compound_ = 0; document_.reset(); writer_.reset(); --- 16,20 ---- { SourceBasedTestBase::setUp(); ! compound_.reset(); document_.reset(); writer_.reset(); *************** *** 27,31 **** writer_.reset(); document_.reset(); ! compound_ = 0; SourceBasedTestBase::tearDown(); } --- 27,31 ---- writer_.reset(); document_.reset(); ! compound_.reset(); SourceBasedTestBase::tearDown(); } |
From: <bl...@us...> - 2003-04-06 15:10:05
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv10762/src/rftaparser Modified Files: SourceRange.cpp SourceRangeTest.cpp Log Message: * fixed bug in SourceRange::contains() Index: SourceRange.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/SourceRange.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SourceRange.cpp 22 Dec 2002 16:03:53 -0000 1.1 --- SourceRange.cpp 6 Apr 2003 15:09:58 -0000 1.2 *************** *** 73,78 **** SourceRange::contains( const SourceRange &other ) const { return other.startIndex_ >= startIndex_ && ! other.startIndex_ + other.length_ <= startIndex_ + length_; } --- 73,84 ---- SourceRange::contains( const SourceRange &other ) const { + if ( isEmpty() ) + return false; + + if ( other.isEmpty() && other.startIndex_ == getEndIndex() ) + return false; + return other.startIndex_ >= startIndex_ && ! other.getEndIndex() <= getEndIndex(); } Index: SourceRangeTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/SourceRangeTest.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SourceRangeTest.cpp 22 Dec 2002 16:03:53 -0000 1.1 --- SourceRangeTest.cpp 6 Apr 2003 15:09:59 -0000 1.2 *************** *** 65,73 **** SourceRange r_1_5( 1, 5 ); SourceRange r_2_3( 2, 3 ); ! SourceRange r_3_3( 3, 3); CPPUNIT_ASSERT( r_1_5.contains( r_2_3 ) ); CPPUNIT_ASSERT( r_1_5.contains( r_3_3 ) ); CPPUNIT_ASSERT( r_3_3.contains( r_3_3 ) ); CPPUNIT_ASSERT( ! r_2_3.contains( r_3_3 ) ); } --- 65,81 ---- SourceRange r_1_5( 1, 5 ); SourceRange r_2_3( 2, 3 ); ! SourceRange r_3_3( 3, 3 ); ! SourceRange r_6_0( 6, 0 ); ! SourceRange r_1_0( 1, 0 ); ! SourceRange r_5_0( 5, 0 ); CPPUNIT_ASSERT( r_1_5.contains( r_2_3 ) ); CPPUNIT_ASSERT( r_1_5.contains( r_3_3 ) ); CPPUNIT_ASSERT( r_3_3.contains( r_3_3 ) ); CPPUNIT_ASSERT( ! r_2_3.contains( r_3_3 ) ); + CPPUNIT_ASSERT( !r_1_5.contains( r_6_0 ) ); + CPPUNIT_ASSERT( r_1_5.contains( r_1_0 ) ); + CPPUNIT_ASSERT( r_1_5.contains( r_5_0 ) ); + CPPUNIT_ASSERT( !r_1_0.contains( r_1_0 ) ); + CPPUNIT_ASSERT( !r_6_0.contains( r_1_5 ) ); } |
From: <bl...@us...> - 2003-04-06 07:42:19
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv13033/src/rfta Modified Files: CodeModel.cpp CodeModelExpressions.cpp CodeRewriter.cpp Log Message: * declarator are stored using smart pointer in declarator expression (more robust) Index: CodeModel.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeModel.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CodeModel.cpp 24 Mar 2003 07:57:51 -0000 1.9 --- CodeModel.cpp 6 Apr 2003 07:42:16 -0000 1.10 *************** *** 318,322 **** for ( int index = 0; index < expression->getChildCount(); ++index ) { ! const Declarator &declarator = makeVariableDeclarator( expression->getChildAt( index ) ); --- 318,322 ---- for ( int index = 0; index < expression->getChildCount(); ++index ) { ! DeclaratorPtr declarator = makeVariableDeclarator( expression->getChildAt( index ) ); *************** *** 340,344 **** ! const Declarator Generator::makeVariableDeclarator( const ASTNodePtr &node ) { --- 340,344 ---- ! DeclaratorPtr Generator::makeVariableDeclarator( const ASTNodePtr &node ) { *************** *** 359,366 **** node->getProperty( ASTNodeProperties::variableInitializerProperty ); if ( !initializerNode ) ! return Declarator( type, name, typeSuffix ); ExpressionPtr initializer = makeVariableInitializerExpression( initializerNode ); ! return Declarator( type, name, typeSuffix, initializer ); } --- 359,366 ---- node->getProperty( ASTNodeProperties::variableInitializerProperty ); if ( !initializerNode ) ! return DeclaratorPtr( new Declarator( type, name, typeSuffix ) ); ExpressionPtr initializer = makeVariableInitializerExpression( initializerNode ); ! return DeclaratorPtr( new Declarator( type, name, typeSuffix, initializer ) ); } Index: CodeModelExpressions.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeModelExpressions.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** CodeModelExpressions.cpp 6 Apr 2003 07:20:23 -0000 1.11 --- CodeModelExpressions.cpp 6 Apr 2003 07:42:16 -0000 1.12 *************** *** 107,118 **** ! Declarator & ! DeclaratorExpression::getDeclaratorAt( int index ) ! { ! return declarators_.at( index ); ! } ! ! ! const Declarator & DeclaratorExpression::getDeclaratorAt( int index ) const { --- 107,111 ---- ! DeclaratorPtr DeclaratorExpression::getDeclaratorAt( int index ) const { *************** *** 123,127 **** void DeclaratorExpression::insertDeclaratorAt( int index, ! const Declarator &declarator ) { declarators_.insert( declarators_.begin() + index, declarator ); --- 116,120 ---- void DeclaratorExpression::insertDeclaratorAt( int index, ! const DeclaratorPtr &declarator ) { declarators_.insert( declarators_.begin() + index, declarator ); *************** *** 130,134 **** void ! DeclaratorExpression::appendDeclarator( const Declarator &declarator ) { declarators_.push_back( declarator ); --- 123,127 ---- void ! DeclaratorExpression::appendDeclarator( const DeclaratorPtr &declarator ) { declarators_.push_back( declarator ); Index: CodeRewriter.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeRewriter.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** CodeRewriter.cpp 6 Apr 2003 07:20:23 -0000 1.35 --- CodeRewriter.cpp 6 Apr 2003 07:42:16 -0000 1.36 *************** *** 349,356 **** insertText( declarators->getPrimaryType()->getTypeText() ); ! const Declarator &declarator = declarators->getDeclaratorAt(0); ! insertText( declarator.getType() ); ! insertText( declarator.getName() ); ! insertText( declarator.getTypeSuffix() ); endInsertNewStatement(); --- 349,356 ---- insertText( declarators->getPrimaryType()->getTypeText() ); ! DeclaratorPtr declarator = declarators->getDeclaratorAt(0); ! insertText( declarator->getType() ); ! insertText( declarator->getName() ); ! insertText( declarator->getTypeSuffix() ); endInsertNewStatement(); |
From: <bl...@us...> - 2003-04-06 07:42:19
|
Update of /cvsroot/cpptool/rfta/include/rfta/refactoring In directory sc8-pr-cvs1:/tmp/cvs-serv13033/include/rfta/refactoring Modified Files: CodeModel.h CodeModelExpressions.h Log Message: * declarator are stored using smart pointer in declarator expression (more robust) Index: CodeModel.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModel.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CodeModel.h 24 Mar 2003 07:57:49 -0000 1.3 --- CodeModel.h 6 Apr 2003 07:42:16 -0000 1.4 *************** *** 56,60 **** TypePartPtr getDeclaratorPrimaryType( const ASTNodePtr &declaratorNode ); ! const Declarator makeVariableDeclarator( const ASTNodePtr &variableDeclaratorNode ); ExpressionPtr makeVariableInitializerExpression( const ASTNodePtr &initializerNode ); --- 56,60 ---- TypePartPtr getDeclaratorPrimaryType( const ASTNodePtr &declaratorNode ); ! DeclaratorPtr makeVariableDeclarator( const ASTNodePtr &variableDeclaratorNode ); ExpressionPtr makeVariableInitializerExpression( const ASTNodePtr &initializerNode ); Index: CodeModelExpressions.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModelExpressions.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** CodeModelExpressions.h 6 Apr 2003 07:20:23 -0000 1.13 --- CodeModelExpressions.h 6 Apr 2003 07:42:16 -0000 1.14 *************** *** 76,84 **** int getDeclaratorCount() const; ! Declarator &getDeclaratorAt( int index ); ! const Declarator &getDeclaratorAt( int index ) const; void insertDeclaratorAt( int index, ! const Declarator &declarator ); ! void appendDeclarator( const Declarator &declarator ); void removeDeclaratorAt( int index ); --- 76,83 ---- int getDeclaratorCount() const; ! DeclaratorPtr getDeclaratorAt( int index ) const; void insertDeclaratorAt( int index, ! const DeclaratorPtr &declarator ); ! void appendDeclarator( const DeclaratorPtr &declarator ); void removeDeclaratorAt( int index ); *************** *** 87,91 **** private: ! typedef std::vector<Declarator> Declarators; Declarators declarators_; ChangeTracker<TypePartPtr> primaryTypeTracker_; --- 86,90 ---- private: ! typedef std::vector<DeclaratorPtr> Declarators; Declarators declarators_; ChangeTracker<TypePartPtr> primaryTypeTracker_; |
From: <bl...@us...> - 2003-04-06 07:42:19
|
Update of /cvsroot/cpptool/rfta/src/pyrfta In directory sc8-pr-cvs1:/tmp/cvs-serv13033/src/pyrfta Modified Files: ExposeExpressions.cpp Log Message: * declarator are stored using smart pointer in declarator expression (more robust) Index: ExposeExpressions.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/pyrfta/ExposeExpressions.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExposeExpressions.cpp 6 Apr 2003 07:20:23 -0000 1.1 --- ExposeExpressions.cpp 6 Apr 2003 07:42:16 -0000 1.2 *************** *** 27,31 **** ; - const Declarator &(DeclaratorExpression::*mfGetDeclaratorAt)( int ) const = &DeclaratorExpression::getDeclaratorAt; class_<DeclaratorExpression, DeclaratorExpressionPtr, bases<Expression>, boost::noncopyable>( "DeclaratorExpression", init<TypePartPtr>() ) --- 27,30 ---- *************** *** 33,37 **** .add_property( "primaryTypeChange", &DeclaratorExpression::getPrimaryTypeChange ) .def( "getDeclaratorCount", &DeclaratorExpression::getDeclaratorCount ) ! // .def( "getDeclaratorAt", mfGetDeclaratorAt ) // return policity => need by ref .def( "insertDeclaratorAt", &DeclaratorExpression::insertDeclaratorAt ) .def( "appendDeclarator", &DeclaratorExpression::appendDeclarator ) --- 32,36 ---- .add_property( "primaryTypeChange", &DeclaratorExpression::getPrimaryTypeChange ) .def( "getDeclaratorCount", &DeclaratorExpression::getDeclaratorCount ) ! .def( "getDeclaratorAt", &DeclaratorExpression::getDeclaratorAt ) .def( "insertDeclaratorAt", &DeclaratorExpression::insertDeclaratorAt ) .def( "appendDeclarator", &DeclaratorExpression::appendDeclarator ) |
From: <bl...@us...> - 2003-04-06 07:20:26
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv8832/src/rfta Modified Files: CodeModelExpressions.cpp CodeRewriter.cpp CodeRewriter.h Log Message: * added working python binding for code model expression Index: CodeModelExpressions.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeModelExpressions.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** CodeModelExpressions.cpp 24 Mar 2003 07:57:51 -0000 1.10 --- CodeModelExpressions.cpp 6 Apr 2003 07:20:23 -0000 1.11 *************** *** 69,73 **** GenericExpression::accept( ExpressionVisitor &visitor ) { ! visitor.visit( *this ); } --- 69,73 ---- GenericExpression::accept( ExpressionVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 146,150 **** DeclaratorExpression::accept( ExpressionVisitor &visitor ) { ! visitor.visit( *this ); } --- 146,150 ---- DeclaratorExpression::accept( ExpressionVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 273,277 **** void ! ConstructorInitializerExpression::setParemeters( const ExpressionPtr ¶meters ) { parameters_ = parameters; --- 273,277 ---- void ! ConstructorInitializerExpression::setParameters( const ExpressionPtr ¶meters ) { parameters_ = parameters; *************** *** 282,286 **** ConstructorInitializerExpression::accept( ExpressionVisitor &visitor ) { ! visitor.visit( *this ); } --- 282,286 ---- ConstructorInitializerExpression::accept( ExpressionVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 312,316 **** AssignInitializerExpression::accept( ExpressionVisitor &visitor ) { ! visitor.visit( *this ); } --- 312,316 ---- AssignInitializerExpression::accept( ExpressionVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 320,324 **** DefaultConditionExpression::accept( ExpressionVisitor &visitor ) { ! visitor.visit( *this ); } --- 320,324 ---- DefaultConditionExpression::accept( ExpressionVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 327,331 **** NullExpression::accept( ExpressionVisitor &visitor ) { ! visitor.visit( *this ); } --- 327,331 ---- NullExpression::accept( ExpressionVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } Index: CodeRewriter.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeRewriter.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** CodeRewriter.cpp 5 Apr 2003 18:29:01 -0000 1.34 --- CodeRewriter.cpp 6 Apr 2003 07:20:23 -0000 1.35 *************** *** 633,637 **** void ! CodeRewriter::visit( AssignInitializerExpression &expression ) { } --- 633,637 ---- void ! CodeRewriter::visit( const AssignInitializerExpressionPtr &expression ) { } *************** *** 639,643 **** void ! CodeRewriter::visit( ConstructorInitializerExpression &expression ) { } --- 639,643 ---- void ! CodeRewriter::visit( const ConstructorInitializerExpressionPtr &expression ) { } *************** *** 645,649 **** void ! CodeRewriter::visit( DeclaratorExpression &expression ) { } --- 645,649 ---- void ! CodeRewriter::visit( const DeclaratorExpressionPtr &expression ) { } *************** *** 651,655 **** void ! CodeRewriter::visit( DefaultConditionExpression &expression ) { } --- 651,655 ---- void ! CodeRewriter::visit( const DefaultConditionExpressionPtr &expression ) { } *************** *** 657,661 **** void ! CodeRewriter::visit( Expression &expression ) { } --- 657,661 ---- void ! CodeRewriter::visit( const ExpressionPtr &expression ) { } *************** *** 663,674 **** void ! CodeRewriter::visit( GenericExpression &expression ) { if ( isInserting() ) ! insertText( expression.getValueText() ); else { ! replaceText( expression.getSourceRange(), ! expression.getValueText() ); } } --- 663,674 ---- void ! CodeRewriter::visit( const GenericExpressionPtr &expression ) { if ( isInserting() ) ! insertText( expression->getValueText() ); else { ! replaceText( expression->getSourceRange(), ! expression->getValueText() ); } } *************** *** 676,680 **** void ! CodeRewriter::visit( NullExpression &expression ) { } --- 676,680 ---- void ! CodeRewriter::visit( const NullExpressionPtr &expression ) { } Index: CodeRewriter.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeRewriter.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** CodeRewriter.h 5 Apr 2003 18:29:01 -0000 1.14 --- CodeRewriter.h 6 Apr 2003 07:20:23 -0000 1.15 *************** *** 53,63 **** // overridden from ExpressionVisitor ! void visit( AssignInitializerExpression &expression ); ! void visit( ConstructorInitializerExpression &expression ); ! void visit( DeclaratorExpression &expression ); ! void visit( DefaultConditionExpression &expression ); ! void visit( Expression &expression ); ! void visit( GenericExpression &expression ); ! void visit( NullExpression &expression ); private: --- 53,63 ---- // overridden from ExpressionVisitor ! void visit( const AssignInitializerExpressionPtr &expression ); ! void visit( const ConstructorInitializerExpressionPtr &expression ); ! void visit( const DeclaratorExpressionPtr &expression ); ! void visit( const DefaultConditionExpressionPtr &expression ); ! void visit( const ExpressionPtr &expression ); ! void visit( const GenericExpressionPtr &expression ); ! void visit( const NullExpressionPtr &expression ); private: |
From: <bl...@us...> - 2003-04-06 07:20:26
|
Update of /cvsroot/cpptool/rfta/src/pyrfta In directory sc8-pr-cvs1:/tmp/cvs-serv8832/src/pyrfta Modified Files: ExposeStatements.cpp ExposeStatements2.cpp ExposeStatements3.cpp ExposeVisitors.cpp Forwards.h pyrfta.cpp pyrfta.dsp Added Files: ExposeExpressions.cpp ExposeExpressions2.cpp Log Message: * added working python binding for code model expression --- NEW FILE: ExposeExpressions.cpp --- #include "Forwards.h" #include <boost/python.hpp> #include <rfta/refactoring/CodeModelStatements.h> #include <rfta/refactoring/CodeModelExpressions.h> using namespace boost::python; using namespace Refactoring::CodeModel; void exposeExpressions() { void (Expression::*mfAcceptExpressionVisitor)( ExpressionVisitor & ) = &Expression::accept; class_<Expression, bases<Element>, boost::noncopyable >( "Expression", no_init ) .def( "accept", mfAcceptExpressionVisitor ) ; class_<GenericExpression, GenericExpressionPtr, bases<Expression>, boost::noncopyable >( "GenericExpression", init< optional<std::string> >() ) .add_property( "valueText", &GenericExpression::getValueText, &GenericExpression::setValueText ) .def( "getValueChange", &GenericExpression::getValueChange ) ; class_<TypePart, TypePartPtr, bases<Element>, boost::noncopyable>( "TypePart", init< optional<std::string> >() ) .add_property( "typeText", &TypePart::getTypeText ) ; const Declarator &(DeclaratorExpression::*mfGetDeclaratorAt)( int ) const = &DeclaratorExpression::getDeclaratorAt; class_<DeclaratorExpression, DeclaratorExpressionPtr, bases<Expression>, boost::noncopyable>( "DeclaratorExpression", init<TypePartPtr>() ) .add_property( "primaryType", &DeclaratorExpression::getPrimaryType, &DeclaratorExpression::setPrimaryType ) .add_property( "primaryTypeChange", &DeclaratorExpression::getPrimaryTypeChange ) .def( "getDeclaratorCount", &DeclaratorExpression::getDeclaratorCount ) // .def( "getDeclaratorAt", mfGetDeclaratorAt ) // return policity => need by ref .def( "insertDeclaratorAt", &DeclaratorExpression::insertDeclaratorAt ) .def( "appendDeclarator", &DeclaratorExpression::appendDeclarator ) .def( "removeDeclaratorAt", &DeclaratorExpression::removeDeclaratorAt ) ; } --- NEW FILE: ExposeExpressions2.cpp --- #include "Forwards.h" #include <boost/python.hpp> #include <rfta/refactoring/CodeModelStatements.h> #include <rfta/refactoring/CodeModelExpressions.h> using namespace boost::python; using namespace Refactoring::CodeModel; void exposeExpressions2() { // Not derived from Element at the time class_<Declarator, DeclaratorPtr, bases<Element>, boost::noncopyable>( "Declarator", init<std::string, std::string, std::string>() ) .def( init<std::string, std::string, std::string, ExpressionPtr>() ) .add_property( "type", &Declarator::getType, &Declarator::setType ) .add_property( "typeSuffix", &Declarator::getTypeSuffix, &Declarator::setTypeSuffix ) .add_property( "getName", &Declarator::getName, &Declarator::setName ) .def( "hasInitializer", &Declarator::hasInitializer ) .add_property( "initializer", &Declarator::getInitializer, &Declarator::setInitializer ) ; class_<ConstructorInitializerExpression, ConstructorInitializerExpressionPtr, bases<Expression>, boost::noncopyable>( "ConstructorInitializerExpression", init<ExpressionPtr>() ) .add_property( "parameters", &ConstructorInitializerExpression::getParameters, &ConstructorInitializerExpression::setParameters ) ; class_<AssignInitializerExpression, AssignInitializerExpressionPtr, bases<Expression>, boost::noncopyable>( "AssignInitializerExpression", init<ExpressionPtr>() ) .add_property( "value", &AssignInitializerExpression::getValue, &AssignInitializerExpression::setValue ) ; class_<DefaultConditionExpression, DefaultConditionExpressionPtr, bases<Expression>, boost::noncopyable>( "DefaultConditionExpression" ) ; class_<NullExpression, NullExpressionPtr, bases<Expression>, boost::noncopyable>( "NullExpression" ) ; } Index: ExposeStatements.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/pyrfta/ExposeStatements.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExposeStatements.cpp 5 Apr 2003 18:29:01 -0000 1.1 --- ExposeStatements.cpp 6 Apr 2003 07:20:23 -0000 1.2 *************** *** 2,6 **** #include <boost/python.hpp> #include <rfta/refactoring/CodeModelStatements.h> - #include <rfta/refactoring/CodeModelExpressions.h> using namespace boost::python; --- 2,5 ---- Index: ExposeStatements2.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/pyrfta/ExposeStatements2.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExposeStatements2.cpp 5 Apr 2003 18:29:01 -0000 1.1 --- ExposeStatements2.cpp 6 Apr 2003 07:20:23 -0000 1.2 *************** *** 2,6 **** #include <boost/python.hpp> #include <rfta/refactoring/CodeModelStatements.h> - #include <rfta/refactoring/CodeModelExpressions.h> using namespace boost::python; --- 2,5 ---- Index: ExposeStatements3.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/pyrfta/ExposeStatements3.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExposeStatements3.cpp 5 Apr 2003 18:29:01 -0000 1.1 --- ExposeStatements3.cpp 6 Apr 2003 07:20:23 -0000 1.2 *************** *** 2,6 **** #include <boost/python.hpp> #include <rfta/refactoring/CodeModelStatements.h> - #include <rfta/refactoring/CodeModelExpressions.h> using namespace boost::python; --- 2,5 ---- Index: ExposeVisitors.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/pyrfta/ExposeVisitors.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExposeVisitors.cpp 5 Apr 2003 18:29:01 -0000 1.1 --- ExposeVisitors.cpp 6 Apr 2003 07:20:23 -0000 1.2 *************** *** 109,143 **** } ! void visit( AssignInitializerExpression &expression ) { call_method<void>( self, "visitAssignInitializerExpression", object(expression) ); } ! void visit( ConstructorInitializerExpression &expression ) { call_method<void>( self, "visitConstructorInitializerExpression", object(expression) ); } ! void visit( DeclaratorExpression &expression ) { call_method<void>( self, "visitDeclaratorExpression", object(expression) ); } ! void visit( DefaultConditionExpression &expression ) { call_method<void>( self, "visitDefaultConditionExpression", object(expression) ); } ! void visit( Expression &expression ) { call_method<void>( self, "visitExpression", object(expression) ); } ! void visit( GenericExpression &expression ) { call_method<void>( self, "visitGenericExpression", object(expression) ); } ! void visit( NullExpression &expression ) { call_method<void>( self, "visitNullExpression", object(expression) ); --- 109,143 ---- } ! void visit( const AssignInitializerExpressionPtr &expression ) { call_method<void>( self, "visitAssignInitializerExpression", object(expression) ); } ! void visit( const ConstructorInitializerExpressionPtr &expression ) { call_method<void>( self, "visitConstructorInitializerExpression", object(expression) ); } ! void visit( const DeclaratorExpressionPtr &expression ) { call_method<void>( self, "visitDeclaratorExpression", object(expression) ); } ! void visit( const DefaultConditionExpressionPtr &expression ) { call_method<void>( self, "visitDefaultConditionExpression", object(expression) ); } ! void visit( const ExpressionPtr &expression ) { call_method<void>( self, "visitExpression", object(expression) ); } ! void visit( const GenericExpressionPtr &expression ) { call_method<void>( self, "visitGenericExpression", object(expression) ); } ! void visit( const NullExpressionPtr &expression ) { call_method<void>( self, "visitNullExpression", object(expression) ); *************** *** 165,169 **** ; ! // class_<ExpressionVisitor, ExpressionVisitorWrap, boost::noncopyable>( "ExpressionVisitor", no_init ) ; --- 165,169 ---- ; ! class_<ExpressionVisitor, ExpressionVisitorWrap, boost::noncopyable>( "ExpressionVisitor" ) ; Index: Forwards.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/pyrfta/Forwards.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Forwards.h 5 Apr 2003 18:29:01 -0000 1.1 --- Forwards.h 6 Apr 2003 07:20:23 -0000 1.2 *************** *** 8,11 **** --- 8,13 ---- void exposeStatements3(); void exposeVisitors(); + void exposeExpressions(); + void exposeExpressions2(); Index: pyrfta.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/pyrfta/pyrfta.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pyrfta.cpp 5 Apr 2003 18:29:01 -0000 1.4 --- pyrfta.cpp 6 Apr 2003 07:20:23 -0000 1.5 *************** *** 99,102 **** --- 99,105 ---- exposeStatements3(); exposeVisitors(); + exposeExpressions(); + exposeExpressions2(); + class_<B, boost::shared_ptr<B> >( "B", init<int>() ) .def( "accept", &B::accept ) Index: pyrfta.dsp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/pyrfta/pyrfta.dsp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pyrfta.dsp 5 Apr 2003 18:29:01 -0000 1.3 --- pyrfta.dsp 6 Apr 2003 07:20:23 -0000 1.4 *************** *** 112,115 **** --- 112,123 ---- # Begin Source File + SOURCE=.\ExposeExpressions.cpp + # End Source File + # Begin Source File + + SOURCE=.\ExposeExpressions2.cpp + # End Source File + # Begin Source File + SOURCE=.\ExposeStatements.cpp # End Source File |
From: <bl...@us...> - 2003-04-06 07:20:26
|
Update of /cvsroot/cpptool/rfta/src/pyrfta/pytest In directory sc8-pr-cvs1:/tmp/cvs-serv8832/src/pyrfta/pytest Modified Files: test.py Log Message: * added working python binding for code model expression Index: test.py =================================================================== RCS file: /cvsroot/cpptool/rfta/src/pyrfta/pytest/test.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test.py 5 Apr 2003 18:29:01 -0000 1.1 --- test.py 6 Apr 2003 07:20:23 -0000 1.2 *************** *** 25,26 **** --- 25,39 ---- + class EVisitor(ExpressionVisitor): + def visitGenericExpression( self, expression ): + print "generic expression visited : ", expression.valueText + + def visitNullExpression( self, expression ): + print "null expression visited : " + + evisitor = EVisitor() + eNull = NullExpression() + eNull.accept( evisitor ) + + eGeneric = GenericExpression( "x = 3" ) + eGeneric.accept( evisitor ) \ No newline at end of file |
From: <bl...@us...> - 2003-04-06 07:20:26
|
Update of /cvsroot/cpptool/rfta/include/rfta/refactoring In directory sc8-pr-cvs1:/tmp/cvs-serv8832/include/rfta/refactoring Modified Files: CodeModelExpressions.h CodeModelForward.h CodeModelVisitor.h Log Message: * added working python binding for code model expression Index: CodeModelExpressions.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModelExpressions.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** CodeModelExpressions.h 1 Apr 2003 08:29:48 -0000 1.12 --- CodeModelExpressions.h 6 Apr 2003 07:20:23 -0000 1.13 *************** *** 134,138 **** ExpressionPtr getParameters() const; ! void setParemeters( const ExpressionPtr ¶meters ); // overridden from Expression --- 134,138 ---- ExpressionPtr getParameters() const; ! void setParameters( const ExpressionPtr ¶meters ); // overridden from Expression Index: CodeModelForward.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModelForward.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** CodeModelForward.h 5 Apr 2003 18:28:57 -0000 1.12 --- CodeModelForward.h 6 Apr 2003 07:20:23 -0000 1.13 *************** *** 73,76 **** --- 73,83 ---- typedef boost::shared_ptr<Expression> ExpressionPtr; + typedef boost::shared_ptr<AssignInitializerExpression> AssignInitializerExpressionPtr; + typedef boost::shared_ptr<ConstructorInitializerExpression> ConstructorInitializerExpressionPtr; + typedef boost::shared_ptr<Declarator> DeclaratorPtr; + typedef boost::shared_ptr<DefaultConditionExpression> DefaultConditionExpressionPtr; + typedef boost::shared_ptr<GenericExpression> GenericExpressionPtr; + typedef boost::shared_ptr<NullExpression> NullExpressionPtr; + } // namespace CodeModel Index: CodeModelVisitor.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModelVisitor.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CodeModelVisitor.h 5 Apr 2003 18:28:57 -0000 1.4 --- CodeModelVisitor.h 6 Apr 2003 07:20:23 -0000 1.5 *************** *** 44,54 **** } ! virtual void visit( AssignInitializerExpression &expression ) =0; ! virtual void visit( ConstructorInitializerExpression &expression ) =0; ! virtual void visit( DeclaratorExpression &expression ) =0; ! virtual void visit( DefaultConditionExpression &expression ) =0; ! virtual void visit( Expression &expression ) =0; ! virtual void visit( GenericExpression &expression ) =0; ! virtual void visit( NullExpression &expression ) =0; }; --- 44,54 ---- } ! virtual void visit( const AssignInitializerExpressionPtr &expression ) =0; ! virtual void visit( const ConstructorInitializerExpressionPtr &expression ) =0; ! virtual void visit( const DeclaratorExpressionPtr &expression ) =0; ! virtual void visit( const DefaultConditionExpressionPtr &expression ) =0; ! virtual void visit( const ExpressionPtr &expression ) =0; ! virtual void visit( const GenericExpressionPtr &expression ) =0; ! virtual void visit( const NullExpressionPtr &expression ) =0; }; |
From: <bl...@us...> - 2003-04-05 18:29:30
|
Update of /cvsroot/cpptool/rfta/include/xtl In directory sc8-pr-cvs1:/tmp/cvs-serv28468/include/xtl Modified Files: .cvsignore Added Files: IntrusiveCount.h Log Message: * added working python binding for code model statement --- NEW FILE: IntrusiveCount.h --- #ifndef XTL_INTRUSIVECOUNT_H_INCLUDED #define XTL_INTRUSIVECOUNT_H_INCLUDED #include <boost/detail/lightweight_mutex.hpp> namespace boost { class IntrusiveCount; void intrusive_ptr_add_ref( IntrusiveCount *count ); void intrusive_ptr_release( IntrusiveCount *count ); class IntrusiveCount { public: friend void ::boost::intrusive_ptr_add_ref( IntrusiveCount *count ); friend void ::boost::intrusive_ptr_release( IntrusiveCount *count ); IntrusiveCount() : count_( 0 ) { } virtual ~IntrusiveCount() { } int intrusiveCount() const { MutexType::scoped_lock lockGuard( lock_ ); return count_; } //private: // no friend template on VC56 void intrusiveAddRef() { MutexType::scoped_lock lockGuard( lock_ ); ++count_; } void intrusiveRelease() { int newCount; { MutexType::scoped_lock lockGuard( lock_ ); newCount = --count_; } if ( newCount == 0 ) destructThis(); } private: virtual void destructThis() { delete this; } private: typedef boost::detail::lightweight_mutex MutexType; mutable MutexType lock_; int count_; }; inline void intrusive_ptr_add_ref( IntrusiveCount *count ) { count->intrusiveAddRef(); } inline void intrusive_ptr_release( IntrusiveCount *count ) { count->intrusiveRelease(); } } // namespace boost namespace Xtl { using ::boost::IntrusiveCount; } // namespace Xtl #endif // XTL_INTRUSIVECOUNT_H_INCLUDED Index: .cvsignore =================================================================== RCS file: /cvsroot/cpptool/rfta/include/xtl/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 16 Mar 2003 07:36:39 -0000 1.1 --- .cvsignore 5 Apr 2003 18:28:57 -0000 1.2 *************** *** 1 **** ! *.h --- 1,2 ---- ! SequenceMap.h ! |
From: <bl...@us...> - 2003-04-05 18:29:30
|
Update of /cvsroot/cpptool/rfta/include/rfta/refactoring In directory sc8-pr-cvs1:/tmp/cvs-serv28468/include/rfta/refactoring Modified Files: CodeModelElement.h CodeModelForward.h CodeModelStatements.h CodeModelVisitor.h Log Message: * added working python binding for code model statement Index: CodeModelElement.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModelElement.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** CodeModelElement.h 1 Apr 2003 08:29:48 -0000 1.12 --- CodeModelElement.h 5 Apr 2003 18:28:57 -0000 1.13 *************** *** 9,12 **** --- 9,14 ---- #include <rfta/parser/SourceRange.h> #include <rfta/parser/ASTNodeForward.h> + #include <boost/enable_shared_from_this.hpp> + #include <boost/utility.hpp> #include <stdexcept> *************** *** 16,20 **** /// This class represents ! class RFTA_API Element { public: --- 18,23 ---- /// This class represents ! class RFTA_API Element : public boost::enable_shared_from_this<Element> ! , public boost::noncopyable { public: *************** *** 41,44 **** --- 44,54 ---- virtual void accept( ElementVisitor &visitor ); + + protected: + template<typename ThisType> + boost::shared_ptr<ThisType> makeSharedFromThis( ThisType *thisPointer ) + { + return boost::static_pointer_cast<ThisType>( shared_from_this() ); + } private: Index: CodeModelForward.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModelForward.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** CodeModelForward.h 24 Mar 2003 07:57:49 -0000 1.11 --- CodeModelForward.h 5 Apr 2003 18:28:57 -0000 1.12 *************** *** 8,12 **** #include <rfta/refactoring/Config.h> #include <boost/shared_ptr.hpp> - #include <boost/weak_ptr.hpp> namespace Refactoring { namespace CodeModel { --- 8,11 ---- *************** *** 20,24 **** class CaseStatement; class CompoundStatement; - class ConditionStatement; class ContinueStatement; class DeclarationStatement; --- 19,22 ---- *************** *** 26,39 **** class DoStatement; class ExpressionStatement; - class FlowControlStatement; class ForStatement; class GotoStatement; class IfStatement; - class IterationStatement; class LabelStatement; class NullStatement; class ReturnStatement; class Statement; - class SwitchLabelStatement; class SwitchStatement; class WhileStatement; --- 24,34 ---- *************** *** 52,55 **** --- 47,70 ---- class ElementVisitor; + + typedef boost::shared_ptr<BreakStatement> BreakStatementPtr; + typedef boost::shared_ptr<CaseStatement> CaseStatementPtr; + typedef boost::shared_ptr<CompoundStatement> CompoundStatementPtr; + typedef boost::shared_ptr<ContinueStatement> ContinueStatementPtr; + typedef boost::shared_ptr<DeclarationStatement> DeclarationStatementPtr; + typedef boost::shared_ptr<DefaultStatement> DefaultStatementPtr; + typedef boost::shared_ptr<DoStatement> DoStatementPtr; + typedef boost::shared_ptr<ExpressionStatement> ExpressionStatementPtr; + typedef boost::shared_ptr<ForStatement> ForStatementPtr; + typedef boost::shared_ptr<GotoStatement> GotoStatementPtr; + typedef boost::shared_ptr<IfStatement> IfStatementPtr; + typedef boost::shared_ptr<LabelStatement> LabelStatementPtr; + typedef boost::shared_ptr<NullStatement> NullStatementPtr; + typedef boost::shared_ptr<ReturnStatement> ReturnStatementPtr; + typedef boost::shared_ptr<Statement> StatementPtr; + typedef boost::shared_ptr<SwitchStatement> SwitchStatementPtr; + typedef boost::shared_ptr<WhileStatement> WhileStatementPtr; + + typedef boost::shared_ptr<Element> ElementPtr; typedef boost::shared_ptr<Label> LabelPtr; *************** *** 57,68 **** typedef boost::shared_ptr<DeclaratorExpression> DeclaratorExpressionPtr; typedef boost::shared_ptr<Expression> ExpressionPtr; - typedef boost::shared_ptr<DoStatement> DoStatementPtr; - typedef boost::shared_ptr<WhileStatement> WhileStatementPtr; - typedef boost::shared_ptr<ForStatement> ForStatementPtr; - typedef boost::weak_ptr<Expression> ExpressionWeakPtr; - typedef boost::shared_ptr<CompoundStatement> CompoundStatementPtr; - typedef boost::shared_ptr<Statement> StatementPtr; - typedef boost::weak_ptr<Statement> StatementWeakPtr; - typedef boost::shared_ptr<DeclaratorExpression> DeclaratorExpressionPtr; --- 72,75 ---- Index: CodeModelStatements.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModelStatements.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** CodeModelStatements.h 1 Apr 2003 08:43:05 -0000 1.18 --- CodeModelStatements.h 5 Apr 2003 18:28:57 -0000 1.19 *************** *** 86,92 **** Change getConditionChange() const; - - // overriden from Statement - void accept( StatementVisitor &visitor ); protected: // overridden from CodeElement --- 86,89 ---- *************** *** 115,119 **** --- 112,118 ---- bool hasElseStatement() const; + StatementPtr getElseStatement() const; + void setElseStatement( const StatementPtr &statement ); *************** *** 143,149 **** Change getIteratedStatementChange() const; - - // overriden from Statement - void accept( StatementVisitor &visitor ); protected: // overridden from CodeElement --- 142,145 ---- *************** *** 216,220 **** CompoundStatementPtr getStatements() const; ! void setStatement( const CompoundStatementPtr &statements ); // overriden from Statement --- 212,216 ---- CompoundStatementPtr getStatements() const; ! void setStatements( const CompoundStatementPtr &statements ); // overriden from Statement *************** *** 229,249 **** ! class RFTA_API FlowControlStatement : public Statement ! { ! public: ! // overriden from Statement ! void accept( StatementVisitor &visitor ); ! }; ! ! ! class RFTA_API SwitchLabelStatement : public Statement ! { ! public: ! // overriden from Statement ! void accept( StatementVisitor &visitor ); ! }; ! ! ! class RFTA_API CaseStatement : public SwitchLabelStatement { public: --- 225,229 ---- ! class RFTA_API CaseStatement : public Statement { public: *************** *** 267,271 **** ! class RFTA_API DefaultStatement : public SwitchLabelStatement { public: --- 247,251 ---- ! class RFTA_API DefaultStatement : public Statement { public: *************** *** 275,279 **** ! class RFTA_API BreakStatement : public FlowControlStatement { public: --- 255,259 ---- ! class RFTA_API BreakStatement : public Statement { public: *************** *** 283,287 **** ! class RFTA_API ContinueStatement : public FlowControlStatement { public: --- 263,267 ---- ! class RFTA_API ContinueStatement : public Statement { public: *************** *** 291,295 **** ! class RFTA_API ReturnStatement : public FlowControlStatement { public: --- 271,275 ---- ! class RFTA_API ReturnStatement : public Statement { public: *************** *** 377,381 **** ! class RFTA_API LabelHolderStatement { public: --- 357,361 ---- ! class RFTA_API LabelHolderStatement : public Statement { public: *************** *** 398,403 **** ! class RFTA_API LabelStatement : public Statement ! , public LabelHolderStatement { public: --- 378,382 ---- ! class RFTA_API LabelStatement : public LabelHolderStatement { public: *************** *** 409,414 **** ! class RFTA_API GotoStatement : public FlowControlStatement ! , public LabelHolderStatement { public: --- 388,392 ---- ! class RFTA_API GotoStatement : public LabelHolderStatement { public: Index: CodeModelVisitor.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModelVisitor.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CodeModelVisitor.h 16 Mar 2003 16:18:39 -0000 1.3 --- CodeModelVisitor.h 5 Apr 2003 18:28:57 -0000 1.4 *************** *** 18,41 **** } ! virtual void visit( BreakStatement &statement ) =0; ! virtual void visit( CaseStatement &statement ) =0; ! virtual void visit( CompoundStatement &statement ) =0; ! virtual void visit( ConditionStatement &statement ) =0; ! virtual void visit( ContinueStatement &statement ) =0; ! virtual void visit( DefaultStatement &statement ) =0; ! virtual void visit( DeclarationStatement &statement ) =0; ! virtual void visit( DoStatement &statement ) =0; ! virtual void visit( ExpressionStatement &statement ) =0; ! virtual void visit( FlowControlStatement &statement ) =0; ! virtual void visit( ForStatement &statement ) =0; ! virtual void visit( GotoStatement &statement ) =0; ! virtual void visit( IfStatement &statement ) =0; ! virtual void visit( IterationStatement &statement ) =0; ! virtual void visit( LabelStatement &statement ) =0; ! virtual void visit( NullStatement &statement ) =0; ! virtual void visit( ReturnStatement &statement ) =0; ! virtual void visit( SwitchLabelStatement &statement ) =0; ! virtual void visit( SwitchStatement &statement ) =0; ! virtual void visit( WhileStatement &statement ) =0; }; --- 18,37 ---- } ! virtual void visit( const BreakStatementPtr &statement ) =0; ! virtual void visit( const CaseStatementPtr &statement ) =0; ! virtual void visit( const CompoundStatementPtr &statement ) =0; ! virtual void visit( const ContinueStatementPtr &statement ) =0; ! virtual void visit( const DefaultStatementPtr &statement ) =0; ! virtual void visit( const DeclarationStatementPtr &statement ) =0; ! virtual void visit( const DoStatementPtr &statement ) =0; ! virtual void visit( const ExpressionStatementPtr &statement ) =0; ! virtual void visit( const ForStatementPtr &statement ) =0; ! virtual void visit( const GotoStatementPtr &statement ) =0; ! virtual void visit( const IfStatementPtr &statement ) =0; ! virtual void visit( const LabelStatementPtr &statement ) =0; ! virtual void visit( const NullStatementPtr &statement ) =0; ! virtual void visit( const ReturnStatementPtr &statement ) =0; ! virtual void visit( const SwitchStatementPtr &statement ) =0; ! virtual void visit( const WhileStatementPtr &statement ) =0; }; |
From: <bl...@us...> - 2003-04-05 18:29:29
|
Update of /cvsroot/cpptool/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv28468 Modified Files: README Log Message: * added working python binding for code model statement Index: README =================================================================== RCS file: /cvsroot/cpptool/rfta/README,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README 1 Apr 2003 18:49:02 -0000 1.4 --- README 5 Apr 2003 18:28:57 -0000 1.5 *************** *** 3,7 **** To compile the project, you need to grab boost library release 1.30. ! It can be found at http://boost.org. The boost archive has the following structure: --- 3,7 ---- To compile the project, you need to grab boost library release 1.30. ! It can be found at http://wwww.boost.org. The boost archive has the following structure: |
From: <bl...@us...> - 2003-04-05 18:29:05
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv28468/src/rftaparser Modified Files: rftaparser.dsp Log Message: * added working python binding for code model statement Index: rftaparser.dsp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/rftaparser.dsp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** rftaparser.dsp 1 Apr 2003 18:22:57 -0000 1.31 --- rftaparser.dsp 5 Apr 2003 18:29:01 -0000 1.32 *************** *** 126,129 **** --- 126,133 ---- # Begin Source File + SOURCE=..\..\include\xtl\IntrusiveCount.h + # End Source File + # Begin Source File + SOURCE=..\..\include\xtl\VirtualFunctor.h # End Source File |
From: <bl...@us...> - 2003-04-05 18:29:05
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv28468/src/rfta Modified Files: CodeModelStatements.cpp CodeRewriter.cpp CodeRewriter.h CodeWriterTestBase.cpp Log Message: * added working python binding for code model statement Index: CodeModelStatements.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeModelStatements.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** CodeModelStatements.cpp 18 Mar 2003 22:37:47 -0000 1.16 --- CodeModelStatements.cpp 5 Apr 2003 18:29:01 -0000 1.17 *************** *** 102,106 **** CompoundStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( *this ); } --- 102,106 ---- CompoundStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 158,168 **** void - ConditionStatement::accept( StatementVisitor &visitor ) - { - visitor.visit( *this ); - } - - - void ConditionStatement::setElementIsFromSource() { --- 158,161 ---- *************** *** 242,246 **** IfStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( *this ); } --- 235,239 ---- IfStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 286,297 **** void - IterationStatement::accept( StatementVisitor &visitor ) - { - ConditionStatement::accept( visitor ); - visitor.visit( *this ); - } - - - void IterationStatement::setElementIsFromSource() { --- 279,282 ---- *************** *** 312,317 **** WhileStatement::accept( StatementVisitor &visitor ) { ! IterationStatement::accept( visitor ); ! visitor.visit( *this ); } --- 297,301 ---- WhileStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 328,333 **** DoStatement::accept( StatementVisitor &visitor ) { ! IterationStatement::accept( visitor ); ! visitor.visit( *this ); } --- 312,316 ---- DoStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 390,395 **** ForStatement::accept( StatementVisitor &visitor ) { ! IterationStatement::accept( visitor ); ! visitor.visit( *this ); } --- 373,377 ---- ForStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 421,425 **** void ! SwitchStatement::setStatement( const CompoundStatementPtr &statements ) { statementsTracker_.setElement( statements ); --- 403,407 ---- void ! SwitchStatement::setStatements( const CompoundStatementPtr &statements ) { statementsTracker_.setElement( statements ); *************** *** 430,435 **** SwitchStatement::accept( StatementVisitor &visitor ) { ! ConditionStatement::accept( visitor ); ! visitor.visit( *this ); } --- 412,416 ---- SwitchStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 444,455 **** - void - SwitchLabelStatement::accept( StatementVisitor &visitor ) - { - visitor.visit( *this ); - } - - - CaseStatement::CaseStatement( const ExpressionPtr &conditionValue ) : conditionValueTracker_( conditionValue ) --- 425,428 ---- *************** *** 482,487 **** CaseStatement::accept( StatementVisitor &visitor ) { ! SwitchLabelStatement::accept( visitor ); ! visitor.visit( *this ); } --- 455,459 ---- CaseStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 498,511 **** DefaultStatement::accept( StatementVisitor &visitor ) { ! SwitchLabelStatement::accept( visitor ); ! visitor.visit( *this ); ! } ! ! ! ! void ! FlowControlStatement::accept( StatementVisitor &visitor ) ! { ! visitor.visit( *this ); } --- 470,474 ---- DefaultStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 515,520 **** BreakStatement::accept( StatementVisitor &visitor ) { ! FlowControlStatement::accept( visitor ); ! visitor.visit( *this ); } --- 478,482 ---- BreakStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 524,529 **** ContinueStatement::accept( StatementVisitor &visitor ) { ! FlowControlStatement::accept( visitor ); ! visitor.visit( *this ); } --- 486,490 ---- ContinueStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 572,577 **** ReturnStatement::accept( StatementVisitor &visitor ) { ! FlowControlStatement::accept( visitor ); ! visitor.visit( *this ); } --- 533,537 ---- ReturnStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 615,619 **** ExpressionStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( *this ); } --- 575,579 ---- ExpressionStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 651,655 **** DeclarationStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( *this ); } --- 611,615 ---- DeclarationStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 659,663 **** NullStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( *this ); } --- 619,623 ---- NullStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 719,723 **** LabelStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( *this ); } --- 679,683 ---- LabelStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } *************** *** 732,737 **** GotoStatement::accept( StatementVisitor &visitor ) { ! FlowControlStatement::accept( visitor ); ! visitor.visit( *this ); } --- 692,696 ---- GotoStatement::accept( StatementVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } Index: CodeRewriter.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeRewriter.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** CodeRewriter.cpp 24 Mar 2003 07:57:51 -0000 1.33 --- CodeRewriter.cpp 5 Apr 2003 18:29:01 -0000 1.34 *************** *** 31,38 **** void ! CodeRewriter::rewrite( Statement &statement, TextDocument &document ) { ! statement.accept( *this ); transforms_.apply( document ); --- 31,38 ---- void ! CodeRewriter::rewrite( const StatementPtr &statement, TextDocument &document ) { ! statement->accept( *this ); transforms_.apply( document ); *************** *** 242,246 **** void ! CodeRewriter::visit( BreakStatement &statement ) { if ( isInserting() ) --- 242,246 ---- void ! CodeRewriter::visit( const BreakStatementPtr &statement ) { if ( isInserting() ) *************** *** 254,258 **** void ! CodeRewriter::visit( CaseStatement &statement ) { if ( isInserting() ) --- 254,258 ---- void ! CodeRewriter::visit( const CaseStatementPtr &statement ) { if ( isInserting() ) *************** *** 262,267 **** } ! handleMandatoryChange( statement.getConditionChange(), ! *statement.getConditionValue() ); if ( isInserting() ) --- 262,267 ---- } ! handleMandatoryChange( statement->getConditionChange(), ! *statement->getConditionValue() ); if ( isInserting() ) *************** *** 271,275 **** void ! CodeRewriter::visit( CompoundStatement &statement ) { IndentLevelManager::IndentRestorer restorer( indentManager_ ); --- 271,275 ---- void ! CodeRewriter::visit( const CompoundStatementPtr &statement ) { IndentLevelManager::IndentRestorer restorer( indentManager_ ); *************** *** 281,293 **** indentManager_.enterNewCompoundStatement(); } ! else if ( statement.isFromSource() ) { ! nextStatementInsertionPos = statement.getSourceRange().getStartIndex() + 1; indentManager_.enterExistingCompoundStatement( nextStatementInsertionPos - 1 ); } ! for ( int index =0; index < statement.getChangeCount(); ++index ) { ! CompoundStatement::StatementChange change = statement.getChangeAt( index ); if ( change.type_ == Change::removed ) { --- 281,293 ---- indentManager_.enterNewCompoundStatement(); } ! else if ( statement->isFromSource() ) { ! nextStatementInsertionPos = statement->getSourceRange().getStartIndex() + 1; indentManager_.enterExistingCompoundStatement( nextStatementInsertionPos - 1 ); } ! for ( int index =0; index < statement->getChangeCount(); ++index ) { ! CompoundStatement::StatementChange change = statement->getChangeAt( index ); if ( change.type_ == Change::removed ) { *************** *** 316,326 **** void ! CodeRewriter::visit( ConditionStatement &statement ) ! { ! } ! ! ! void ! CodeRewriter::visit( ContinueStatement &statement ) { if ( isInserting() ) --- 316,320 ---- void ! CodeRewriter::visit( const ContinueStatementPtr &statement ) { if ( isInserting() ) *************** *** 334,338 **** void ! CodeRewriter::visit( DefaultStatement &statement ) { if ( isInserting() ) --- 328,332 ---- void ! CodeRewriter::visit( const DefaultStatementPtr &statement ) { if ( isInserting() ) *************** *** 346,354 **** void ! CodeRewriter::visit( DeclarationStatement &statement ) { if ( isInserting() ) { ! DeclaratorExpressionPtr declarators = statement.getDeclaration(); beginInsertNewStatement(); --- 340,348 ---- void ! CodeRewriter::visit( const DeclarationStatementPtr &statement ) { if ( isInserting() ) { ! DeclaratorExpressionPtr declarators = statement->getDeclaration(); beginInsertNewStatement(); *************** *** 366,373 **** void ! CodeRewriter::visit( DoStatement &statement ) { IndentLevelManager::IndentRestorer restorer( indentManager_ ); ! StatementPtr iteratedStatement = statement.getIteratedStatement(); if ( isInserting() ) { --- 360,367 ---- void ! CodeRewriter::visit( const DoStatementPtr &statement ) { IndentLevelManager::IndentRestorer restorer( indentManager_ ); ! StatementPtr iteratedStatement = statement->getIteratedStatement(); if ( isInserting() ) { *************** *** 378,384 **** else indentManager_.enterExistingDoStatement( iteratedStatement, ! statement.getSourceRange().getStartIndex() ); ! handleMandatoryChange( statement.getIteratedStatementChange(), *iteratedStatement, statementDelete ); --- 372,378 ---- else indentManager_.enterExistingDoStatement( iteratedStatement, ! statement->getSourceRange().getStartIndex() ); ! handleMandatoryChange( statement->getIteratedStatementChange(), *iteratedStatement, statementDelete ); *************** *** 392,397 **** } ! handleMandatoryChange( statement.getConditionChange(), ! *statement.getCondition(), bracedExpressionDelete ); --- 386,391 ---- } ! handleMandatoryChange( statement->getConditionChange(), ! *statement->getCondition(), bracedExpressionDelete ); *************** *** 405,415 **** void ! CodeRewriter::visit( ExpressionStatement &statement ) { if ( isInserting() ) beginInsertNewStatement(); ! handleMandatoryChange( statement.getExpressionChange(), ! *statement.getExpression() ); if ( isInserting() ) --- 399,409 ---- void ! CodeRewriter::visit( const ExpressionStatementPtr &statement ) { if ( isInserting() ) beginInsertNewStatement(); ! handleMandatoryChange( statement->getExpressionChange(), ! *statement->getExpression() ); if ( isInserting() ) *************** *** 419,429 **** void ! CodeRewriter::visit( FlowControlStatement &statement ) ! { ! } ! ! ! void ! CodeRewriter::visit( ForStatement &statement ) { if ( isInserting() ) --- 413,417 ---- void ! CodeRewriter::visit( const ForStatementPtr &statement ) { if ( isInserting() ) *************** *** 433,438 **** } ! handleMandatoryChange( statement.getDeclarationChange(), ! *statement.getDeclaration(), trailingExpressionDelete ); --- 421,426 ---- } ! handleMandatoryChange( statement->getDeclarationChange(), ! *statement->getDeclaration(), trailingExpressionDelete ); *************** *** 440,445 **** insertText( ";" ); ! handleMandatoryChange( statement.getConditionChange(), ! *statement.getCondition(), trailingExpressionDelete ); --- 428,433 ---- insertText( ";" ); ! handleMandatoryChange( statement->getConditionChange(), ! *statement->getCondition(), trailingExpressionDelete ); *************** *** 447,456 **** insertText( ";" ); ! handleMandatoryChange( statement.getIterationChange(), ! *statement.getIteration(), bracedExpressionDelete ); IndentLevelManager::IndentRestorer restorer( indentManager_ ); ! StatementPtr iteratedStatement = statement.getIteratedStatement(); if ( isInserting() ) { --- 435,444 ---- insertText( ";" ); ! handleMandatoryChange( statement->getIterationChange(), ! *statement->getIteration(), bracedExpressionDelete ); IndentLevelManager::IndentRestorer restorer( indentManager_ ); ! StatementPtr iteratedStatement = statement->getIteratedStatement(); if ( isInserting() ) { *************** *** 460,466 **** else indentManager_.enterExistingForStatement( iteratedStatement, ! statement.getSourceRange().getStartIndex() ); ! handleMandatoryChange( statement.getIteratedStatementChange(), *iteratedStatement, statementDelete ); --- 448,454 ---- else indentManager_.enterExistingForStatement( iteratedStatement, ! statement->getSourceRange().getStartIndex() ); ! handleMandatoryChange( statement->getIteratedStatementChange(), *iteratedStatement, statementDelete ); *************** *** 469,483 **** void ! CodeRewriter::visit( GotoStatement &statement ) { if ( isInserting() ) { beginInsertNewStatement(); ! insertText( "goto " + statement.getLabel()->getLabelName() ); } /* // Need to add visitor for Label... ! // insertText( "goto " + statement.getLabel()->getLabelName() ); ! handleMandatoryChange( statement.getLabelChange(), ! *statement.getLabel(), trailingExpressionDelete ); */ --- 457,471 ---- void ! CodeRewriter::visit( const GotoStatementPtr &statement ) { if ( isInserting() ) { beginInsertNewStatement(); ! insertText( "goto " + statement->getLabel()->getLabelName() ); } /* // Need to add visitor for Label... ! // insertText( "goto " + statement->getLabel()->getLabelName() ); ! handleMandatoryChange( statement->getLabelChange(), ! *statement->getLabel(), trailingExpressionDelete ); */ *************** *** 488,492 **** void ! CodeRewriter::visit( IfStatement &statement ) { if ( isInserting() ) --- 476,480 ---- void ! CodeRewriter::visit( const IfStatementPtr &statement ) { if ( isInserting() ) *************** *** 495,500 **** insertText( "if ( " ); } ! handleMandatoryChange( statement.getConditionChange(), ! *statement.getCondition() ); IndentLevelManager::IndentRestorer restorer( indentManager_ ); --- 483,488 ---- insertText( "if ( " ); } ! handleMandatoryChange( statement->getConditionChange(), ! *statement->getCondition() ); IndentLevelManager::IndentRestorer restorer( indentManager_ ); *************** *** 504,516 **** indentManager_.enterNewIfStatement(); } ! else if ( statement.isFromSource() ) ! indentManager_.enterExistingIfStatement( statement.getSourceRange().getStartIndex() ); ! Change thenChange = statement.getThenStatementChange(); handleMandatoryChange( thenChange, ! *statement.getThenStatement(), statementDelete ); ! Change elseChange = statement.getElseStatementChange(); if ( isUpdating() && !elseChange.isUnmodified() ) { --- 492,504 ---- indentManager_.enterNewIfStatement(); } ! else if ( statement->isFromSource() ) ! indentManager_.enterExistingIfStatement( statement->getSourceRange().getStartIndex() ); ! Change thenChange = statement->getThenStatementChange(); handleMandatoryChange( thenChange, ! *statement->getThenStatement(), statementDelete ); ! Change elseChange = statement->getElseStatementChange(); if ( isUpdating() && !elseChange.isUnmodified() ) { *************** *** 521,526 **** startIndex = thenChange.oldRange_.getEndIndex(); else ! startIndex = statement.getThenStatement()->getSourceRange().getEndIndex(); ! int endIndex = statement.getSourceRange().getEndIndex(); deleteText( SourceRange( startIndex, endIndex - startIndex ) ); } --- 509,514 ---- startIndex = thenChange.oldRange_.getEndIndex(); else ! startIndex = statement->getThenStatement()->getSourceRange().getEndIndex(); ! int endIndex = statement->getSourceRange().getEndIndex(); deleteText( SourceRange( startIndex, endIndex - startIndex ) ); } *************** *** 535,543 **** currentInsertionPos_ = thenChange.oldRange_.getEndIndex(); else ! currentInsertionPos_ = statement.getThenStatement()->getSourceRange().getEndIndex(); } } ! if ( statement.hasElseStatement() ) { restorer.restoreIndentLevel(); --- 523,531 ---- currentInsertionPos_ = thenChange.oldRange_.getEndIndex(); else ! currentInsertionPos_ = statement->getThenStatement()->getSourceRange().getEndIndex(); } } ! if ( statement->hasElseStatement() ) { restorer.restoreIndentLevel(); *************** *** 559,563 **** ModeModifier mode( mode_, elseMode ); ! statement.getElseStatement()->accept( *this ); } } --- 547,551 ---- ModeModifier mode( mode_, elseMode ); ! statement->getElseStatement()->accept( *this ); } } *************** *** 565,582 **** void ! CodeRewriter::visit( IterationStatement &statement ) ! { ! } ! ! ! void ! CodeRewriter::visit( LabelStatement &statement ) { ! insertText( "\n" + statement.getLabel()->getLabelName() + ":" ); } void ! CodeRewriter::visit( NullStatement &statement ) { if ( isInserting() ) --- 553,564 ---- void ! CodeRewriter::visit( const LabelStatementPtr &statement ) { ! insertText( "\n" + statement->getLabel()->getLabelName() + ":" ); } void ! CodeRewriter::visit( const NullStatementPtr &statement ) { if ( isInserting() ) *************** *** 589,593 **** void ! CodeRewriter::visit( ReturnStatement &statement ) { const std::string keyWord( "return" ); --- 571,575 ---- void ! CodeRewriter::visit( const ReturnStatementPtr &statement ) { const std::string keyWord( "return" ); *************** *** 598,605 **** } ! handleOptionalChange( statement.getValueChange(), ! statement.getValue(), " ", ! statement.getSourceRange().getStartIndex() + keyWord.length(), trailingExpressionDelete ); --- 580,587 ---- } ! handleOptionalChange( statement->getValueChange(), ! statement->getValue(), " ", ! statement->getSourceRange().getStartIndex() + keyWord.length(), trailingExpressionDelete ); *************** *** 610,631 **** void ! CodeRewriter::visit( SwitchLabelStatement &statement ) ! { ! } ! ! ! void ! CodeRewriter::visit( SwitchStatement &statement ) { beginInsertNewStatement(); insertText( "switch ( " ); ! statement.getCondition()->accept( *this ); insertText( " )" ); ! statement.getStatements()->accept( *this ); } void ! CodeRewriter::visit( WhileStatement &statement ) { if ( isInserting() ) --- 592,607 ---- void ! CodeRewriter::visit( const SwitchStatementPtr &statement ) { beginInsertNewStatement(); insertText( "switch ( " ); ! statement->getCondition()->accept( *this ); insertText( " )" ); ! statement->getStatements()->accept( *this ); } void ! CodeRewriter::visit( const WhileStatementPtr &statement ) { if ( isInserting() ) *************** *** 635,644 **** } ! handleMandatoryChange( statement.getConditionChange(), ! *statement.getCondition(), bracedExpressionDelete ); IndentLevelManager::IndentRestorer restorer( indentManager_ ); ! StatementPtr iteratedStatement = statement.getIteratedStatement(); if ( isInserting() ) { --- 611,620 ---- } ! handleMandatoryChange( statement->getConditionChange(), ! *statement->getCondition(), bracedExpressionDelete ); IndentLevelManager::IndentRestorer restorer( indentManager_ ); ! StatementPtr iteratedStatement = statement->getIteratedStatement(); if ( isInserting() ) { *************** *** 648,654 **** else indentManager_.enterExistingWhileStatement( iteratedStatement, ! statement.getSourceRange().getStartIndex() ); ! handleMandatoryChange( statement.getIteratedStatementChange(), *iteratedStatement, statementDelete ); --- 624,630 ---- else indentManager_.enterExistingWhileStatement( iteratedStatement, ! statement->getSourceRange().getStartIndex() ); ! handleMandatoryChange( statement->getIteratedStatementChange(), *iteratedStatement, statementDelete ); Index: CodeRewriter.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeRewriter.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** CodeRewriter.h 16 Mar 2003 20:32:43 -0000 1.13 --- CodeRewriter.h 5 Apr 2003 18:29:01 -0000 1.14 *************** *** 30,58 **** virtual ~CodeRewriter(); ! void rewrite( Statement &statement, TextDocument &document ); private: // overridden from StatementVisitor ! void visit( BreakStatement &statement ); ! void visit( CaseStatement &statement ); ! void visit( CompoundStatement &statement ); ! void visit( ConditionStatement &statement ); ! void visit( ContinueStatement &statement ); ! void visit( DefaultStatement &statement ); ! void visit( DeclarationStatement &statement ); ! void visit( DoStatement &statement ); ! void visit( ExpressionStatement &statement ); ! void visit( FlowControlStatement &statement ); ! void visit( ForStatement &statement ); ! void visit( GotoStatement &statement ); ! void visit( IfStatement &statement ); ! void visit( IterationStatement &statement ); ! void visit( LabelStatement &statement ); ! void visit( NullStatement &statement ); ! void visit( ReturnStatement &statement ); ! void visit( SwitchLabelStatement &statement ); ! void visit( SwitchStatement &statement ); ! void visit( WhileStatement &statement ); // overridden from ExpressionVisitor --- 30,54 ---- virtual ~CodeRewriter(); ! void rewrite( const StatementPtr &statement, TextDocument &document ); private: // overridden from StatementVisitor ! void visit( const BreakStatementPtr &statement ); ! void visit( const CaseStatementPtr &statement ); ! void visit( const CompoundStatementPtr &statement ); ! void visit( const ContinueStatementPtr &statement ); ! void visit( const DefaultStatementPtr &statement ); ! void visit( const DeclarationStatementPtr &statement ); ! void visit( const DoStatementPtr &statement ); ! void visit( const ExpressionStatementPtr &statement ); ! void visit( const ForStatementPtr &statement ); ! void visit( const GotoStatementPtr &statement ); ! void visit( const IfStatementPtr &statement ); ! void visit( const LabelStatementPtr &statement ); ! void visit( const NullStatementPtr &statement ); ! void visit( const ReturnStatementPtr &statement ); ! void visit( const SwitchStatementPtr &statement ); ! void visit( const WhileStatementPtr &statement ); // overridden from ExpressionVisitor Index: CodeWriterTestBase.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeWriterTestBase.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CodeWriterTestBase.cpp 24 Mar 2003 07:57:51 -0000 1.4 --- CodeWriterTestBase.cpp 5 Apr 2003 18:29:01 -0000 1.5 *************** *** 16,20 **** { SourceBasedTestBase::setUp(); ! compound_.reset(); document_.reset(); writer_.reset(); --- 16,20 ---- { SourceBasedTestBase::setUp(); ! compound_ = 0; document_.reset(); writer_.reset(); *************** *** 27,31 **** writer_.reset(); document_.reset(); ! compound_.reset(); SourceBasedTestBase::tearDown(); } --- 27,31 ---- writer_.reset(); document_.reset(); ! compound_ = 0; SourceBasedTestBase::tearDown(); } *************** *** 49,53 **** { writer_.reset( new CodeModel::CodeRewriter( source_, 2 ) ); ! writer_->rewrite( *compound_, *document_ ); } --- 49,53 ---- { writer_.reset( new CodeModel::CodeRewriter( source_, 2 ) ); ! writer_->rewrite( compound_, *document_ ); } |
From: <bl...@us...> - 2003-04-05 18:29:04
|
Update of /cvsroot/cpptool/rfta/src/pyrfta/pytest In directory sc8-pr-cvs1:/tmp/cvs-serv28468/src/pyrfta/pytest Added Files: test.py Log Message: * added working python binding for code model statement --- NEW FILE: test.py --- from pyrfta import * class Visitor(StatementVisitor): def visitNullStatement( self, statement ): print "null statement visited" def visitReturnStatement( self, statement ): print "return statement visited" if statement.hasValue(): print " => has value" def visitLabelStatement( self, statement ): print "label statement visited : ", statement.label.labelName visitor = Visitor() sNull = NullStatement() sNull.accept( visitor ) sReturn = ReturnStatement() sReturn.accept( visitor ) sLabel = LabelStatement( Label("toto" ) ) sLabel.accept( visitor ) |
Update of /cvsroot/cpptool/rfta/src/pyrfta In directory sc8-pr-cvs1:/tmp/cvs-serv28468/src/pyrfta Modified Files: pyrfta.cpp pyrfta.dsp Added Files: ExposeBase.cpp ExposeStatements.cpp ExposeStatements2.cpp ExposeStatements3.cpp ExposeVisitors.cpp Forwards.h Log Message: * added working python binding for code model statement --- NEW FILE: ExposeBase.cpp --- #include "Forwards.h" #include <boost/python.hpp> #include <rfta/refactoring/CodeModelElement.h> using namespace boost::python; using namespace Refactoring::CodeModel; using Refactoring::SourceRange; void exposeBase() { class_<Change>( "Change" ) .def( init<Change::ChangeType, Refactoring::SourceRange>() ) .def( "wasReplaced", &Change::wasReplaced ) .def( "wasRemoved", &Change::wasRemoved ) .def( "wasAdded", &Change::wasAdded ) .def( "isUnmodified", &Change::isUnmodified ) .def_readwrite( "type", &Change::type_ ) .def_readwrite( "oldRange", &Change::oldRange_ ) ; enum_<Change::ChangeType>( "ChangeType" ) .value( "added", Change::added ) .value( "replaced", Change::replaced ) .value( "removed", Change::removed ) .value( "unmodified", Change::unmodified ) ; class_<SourceRange>( "SourceRange" ) .def( init<int,int>() ) .def( "moveStartIndexBy", &SourceRange::moveStartIndexBy ) .add_property( "startIndex", &SourceRange::getStartIndex ) .add_property( "endIndex", &SourceRange::getEndIndex ) .add_property( "length", &SourceRange::getLength, &SourceRange::setLength ) .def( "isEmpty", &SourceRange::isEmpty ) .def( "contains", &SourceRange::contains ) .def( "overlap", &SourceRange::overlap ) .def( "toString", &SourceRange::toString ) // should use str(self) .def( self == self ) .def( self < self ) ; void (Element::*mfAcceptElementVisitor)( ElementVisitor & ) = &Element::accept; class_<Element, ElementPtr, boost::noncopyable>( "Element" ) .def( "isFromSource", &Element::isFromSource ) .def( "getSourceText", &Element::getSourceText ) .def( "getSourceRange", &Element::getSourceRange ) // .def( "setSource", &Element::setSource ) // .def( "accept", mfAcceptElementVisitor ) ; } --- NEW FILE: ExposeStatements.cpp --- #include "Forwards.h" #include <boost/python.hpp> #include <rfta/refactoring/CodeModelStatements.h> #include <rfta/refactoring/CodeModelExpressions.h> using namespace boost::python; using namespace Refactoring::CodeModel; void exposeStatements() { void (Statement::*mfAcceptStatementVisitor)( StatementVisitor & ) = &Statement::accept; class_<Statement, bases<Element>, boost::noncopyable >( "Statement", no_init ) .def( "accept", mfAcceptStatementVisitor ) ; class_<CompoundStatement::StatementChange, bases<Change> >( "CompoundStatementChange", init<Change::ChangeType, StatementPtr>() ) // .def_readwrite( "statement", &CompoundStatement::StatementChange::statement_ ) ; class_<CompoundStatement, CompoundStatementPtr, bases<Statement>, boost::noncopyable >( "CompoundStatement" ) .def( "removeStatementAt", &CompoundStatement::removeStatementAt ) .def( "appendStatement", &CompoundStatement::appendStatement ) .def( "insertStatementAt", &CompoundStatement::insertStatementAt ) .def( "setStatementAt", &CompoundStatement::setStatementAt ) .def( "getStatementCount", &CompoundStatement::getStatementCount ) .def( "getStatementAt", &CompoundStatement::getStatementAt ) .def( "getChangeCount", &CompoundStatement::getChangeCount ) .def( "getChangeAt", &CompoundStatement::getChangeAt ) ; class_<ConditionStatement, bases<Statement>, boost::noncopyable>( "ConditionStatement", no_init ) .def( "getCondition", &ConditionStatement::getCondition ) .def( "setCondition", &ConditionStatement::setCondition ) .def( "getConditionChange", &ConditionStatement::getConditionChange ) ; class_<IfStatement, IfStatementPtr, bases<ConditionStatement>, boost::noncopyable>( "IfStatement", init<ExpressionPtr, StatementPtr>() ) .def( init<ExpressionPtr, StatementPtr, StatementPtr>() ) .def( "getThenStatement", &IfStatement::getThenStatement ) .def( "setThenStatement", &IfStatement::setThenStatement ) .def( "getThenStatementChange", &IfStatement::getThenStatementChange ) .def( "hasElseStatement", &IfStatement::hasElseStatement ) .def( "getElseStatement", &IfStatement::getElseStatement ) .def( "setElseStatement", &IfStatement::setElseStatement ) .def( "getElseStatementChange", &IfStatement::getElseStatementChange ) .def( "getThenStatement", &IfStatement::getThenStatement ) .def( "getThenStatement", &IfStatement::getThenStatement ) ; class_<IterationStatement, bases<ConditionStatement>, boost::noncopyable >( "IterationStatement", no_init ) .def( "getIteratedStatement", &IterationStatement::getIteratedStatement ) .def( "setIteratedStatement", &IterationStatement::setIteratedStatement ) .def( "getIteratedStatementChange", &IterationStatement::getIteratedStatementChange ) ; } --- NEW FILE: ExposeStatements2.cpp --- #include "Forwards.h" #include <boost/python.hpp> #include <rfta/refactoring/CodeModelStatements.h> #include <rfta/refactoring/CodeModelExpressions.h> using namespace boost::python; using namespace Refactoring::CodeModel; void exposeStatements2() { class_<WhileStatement, WhileStatementPtr, bases<IterationStatement>, boost::noncopyable >( "WhileStatement", init<ExpressionPtr, StatementPtr>() ) ; class_<DoStatement, DoStatementPtr, bases<IterationStatement>, boost::noncopyable >( "DoStatement", init<ExpressionPtr, StatementPtr>() ) ; class_<ForStatement, ForStatementPtr, bases<IterationStatement>, boost::noncopyable >( "ForStatement", init<ExpressionPtr, ExpressionPtr, ExpressionPtr, StatementPtr>() ) .def( "getDeclaration", &ForStatement::getDeclaration ) .def( "setDeclaration", &ForStatement::setDeclaration ) .def( "getDeclarationChange", &ForStatement::getDeclarationChange ) .def( "getIteration", &ForStatement::getIteration ) .def( "setIteration", &ForStatement::setIteration ) .def( "getIterationChange", &ForStatement::getIterationChange ) ; class_<SwitchStatement, SwitchStatementPtr, bases<ConditionStatement>, boost::noncopyable >( "SwitchStatement", init<ExpressionPtr, CompoundStatementPtr>() ) .def( "getStatements", &SwitchStatement::getStatements ) .def( "setStatements", &SwitchStatement::setStatements ) ; class_<CaseStatement, CaseStatementPtr, bases<Statement>, boost::noncopyable >( "CaseStatement", init<ExpressionPtr>() ) .def( "getConditionValue", &CaseStatement::getConditionValue ) .def( "setConditionValue", &CaseStatement::setConditionValue ) .def( "getConditionChange", &CaseStatement::getConditionChange ) ; class_<DefaultStatement, DefaultStatementPtr, bases<Statement>, boost::noncopyable >( "DefaultStatement" ) ; class_<BreakStatement, BreakStatementPtr, bases<Statement>, boost::noncopyable >( "BreakStatement" ) ; class_<ContinueStatement, ContinueStatementPtr, bases<Statement>, boost::noncopyable >( "ContinueStatement" ) ; } --- NEW FILE: ExposeStatements3.cpp --- #include "Forwards.h" #include <boost/python.hpp> #include <rfta/refactoring/CodeModelStatements.h> #include <rfta/refactoring/CodeModelExpressions.h> using namespace boost::python; using namespace Refactoring::CodeModel; void exposeStatements3() { class_<ReturnStatement, ReturnStatementPtr, bases<Statement>, boost::noncopyable >( "ReturnStatement" ) .def( init<ExpressionPtr>() ) .def( "hasValue", &ReturnStatement::hasValue ) .def( "getValue", &ReturnStatement::getValue ) .def( "setValue", &ReturnStatement::setValue ) .def( "getValueChange", &ReturnStatement::getValueChange ) ; class_<ExpressionStatement, ExpressionStatementPtr, bases<Statement>, boost::noncopyable >( "ExpressionStatement", init<ExpressionPtr>() ) .def( "getExpression", &ExpressionStatement::getExpression ) .def( "setExpression", &ExpressionStatement::setExpression ) .def( "getExpressionChange", &ExpressionStatement::getExpressionChange ) ; class_<Label, LabelPtr, bases<Element>, boost::noncopyable >( "Label" ) .def( init<std::string>() ) .add_property( "labelName", &Label::getLabelName ) ; class_<LabelStatement, LabelStatementPtr, bases<Statement>, boost::noncopyable >( "LabelStatement", init<LabelPtr>() ) .add_property( "label", &LabelStatement::getLabel, &LabelStatement::setLabel ) ; class_<GotoStatement, GotoStatementPtr, bases<Statement>, boost::noncopyable >( "GotoStatement", init<LabelPtr>() ) .add_property( "label", &LabelStatement::getLabel, &LabelStatement::setLabel ) ; class_<NullStatement, NullStatementPtr, bases<Statement>, boost::noncopyable >( "NullStatement" ) ; } --- NEW FILE: ExposeVisitors.cpp --- #include "Forwards.h" #include <boost/python.hpp> #include <rfta/refactoring/CodeModelVisitor.h> using namespace boost::python; using namespace Refactoring::CodeModel; class StatementVisitorWrap : public StatementVisitor { public: PyObject *self; StatementVisitorWrap( PyObject *self_ ) : self(self_) { } void visit( const BreakStatementPtr &statement ) { call_method<void>( self, "visitBreakStatement", object(statement) ); } void visit( const CaseStatementPtr &statement ) { call_method<void>( self, "visitCaseStatement", object(statement) ); } void visit( const CompoundStatementPtr &statement ) { call_method<void>( self, "visitCompoundStatement", object(statement) ); } void visit( const ContinueStatementPtr &statement ) { call_method<void>( self, "visitContinueStatement", object(statement) ); } void visit( const DefaultStatementPtr &statement ) { call_method<void>( self, "visitDefaultStatement", object(statement) ); } void visit( const DeclarationStatementPtr &statement ) { call_method<void>( self, "visitDeclarationStatement", object(statement) ); } void visit( const DoStatementPtr &statement ) { call_method<void>( self, "visitDoStatement", object(statement) ); } void visit( const ExpressionStatementPtr &statement ) { call_method<void>( self, "visitExpressionStatement", object(statement) ); } void visit( const ForStatementPtr &statement ) { call_method<void>( self, "visitForStatementStatement", object(statement) ); } void visit( const GotoStatementPtr &statement ) { call_method<void>( self, "visitGotoStatement", object(statement) ); } void visit( const IfStatementPtr &statement ) { call_method<void>( self, "visitIfStatement", object(statement) ); } void visit( const LabelStatementPtr &statement ) { call_method<void>( self, "visitLabelStatement", object(statement) ); } void visit( const NullStatementPtr &statement ) { call_method<void>( self, "visitNullStatement", object(statement) ); } void visit( const ReturnStatementPtr &statement ) { call_method<void>( self, "visitReturnStatement", object(statement) ); } void visit( const SwitchStatementPtr &statement ) { call_method<void>( self, "visitSwitchStatement", object(statement) ); } void visit( const WhileStatementPtr &statement ) { call_method<void>( self, "visitWhileStatement", object(statement) ); } }; class ExpressionVisitorWrap : public ExpressionVisitor { public: PyObject *self; ExpressionVisitorWrap( PyObject *self_ ) : self(self_) { } void visit( AssignInitializerExpression &expression ) { call_method<void>( self, "visitAssignInitializerExpression", object(expression) ); } void visit( ConstructorInitializerExpression &expression ) { call_method<void>( self, "visitConstructorInitializerExpression", object(expression) ); } void visit( DeclaratorExpression &expression ) { call_method<void>( self, "visitDeclaratorExpression", object(expression) ); } void visit( DefaultConditionExpression &expression ) { call_method<void>( self, "visitDefaultConditionExpression", object(expression) ); } void visit( Expression &expression ) { call_method<void>( self, "visitExpression", object(expression) ); } void visit( GenericExpression &expression ) { call_method<void>( self, "visitGenericExpression", object(expression) ); } void visit( NullExpression &expression ) { call_method<void>( self, "visitNullExpression", object(expression) ); } }; class ElementVisitorWrap : public ElementVisitor , public StatementVisitorWrap , public ExpressionVisitorWrap { ElementVisitorWrap( PyObject *self_ ) : StatementVisitorWrap( self_ ) , ExpressionVisitorWrap( self_ ) { } }; void exposeVisitors() { class_<StatementVisitor, StatementVisitorWrap, boost::noncopyable>( "StatementVisitor" ) ; // class_<ExpressionVisitor, ExpressionVisitorWrap, boost::noncopyable>( "ExpressionVisitor", no_init ) ; // class_<ElementVisitor, ElementVisitorWrap, boost::noncopyable>( "ElementVisitor", no_init ) ; } --- NEW FILE: Forwards.h --- #ifndef PYRFTA_FORWARDS_INCLUDED #define PYRFTA_FORWARDS_INCLUDED void exposeBase(); void exposeStatements(); void exposeStatements2(); void exposeStatements3(); void exposeVisitors(); #endif // PYRFTA_FORWARDS_INCLUDED Index: pyrfta.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/pyrfta/pyrfta.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pyrfta.cpp 2 Apr 2003 16:22:54 -0000 1.3 --- pyrfta.cpp 5 Apr 2003 18:29:01 -0000 1.4 *************** *** 1,7 **** #include <boost/python.hpp> ! #include <rfta/refactoring/CodeModelVisitor.h> ! #include <rfta/refactoring/CodeModelStatements.h> ! #include <rfta/refactoring/CodeModelExpressions.h> ! #include <rfta/refactoring/PlainTextDocument.h> // Notes: compiler memory allocation limits was reached after declaring two classes. --- 1,6 ---- #include <boost/python.hpp> ! #include "Forwards.h" ! ! #include <iostream> // Notes: compiler memory allocation limits was reached after declaring two classes. *************** *** 10,336 **** using namespace boost::python; - using namespace Refactoring::CodeModel; - using Refactoring::SourceRange; ! /* Boost.Python documentation bug: ! ! ** Virtual Functions with Default Implementations ! struct BaseWrap : Base ! { ! BaseWrap(PyObject* self_) ! : self(self_) {} ! int f() { return call_method<int>(self, "f"); } ! int default_f() { return Base::f(); } // <<=== ***ADDED*** ! PyObject* self; ! }; ! ! The following constructor is missing for successful compilation with VC6: ! ! BaseWrap(PyObject* self_, const Base &other) ! : Base(other) ! , self(self_) {} ! */ ! class StatementVisitorWrap : public StatementVisitor { public: ! PyObject *self; ! ! StatementVisitorWrap( PyObject *self_ ) ! : self(self_) ! { ! } ! ! void visit( BreakStatement &statement ) ! { ! call_method<void>( self, "visitBreakStatement" ); ! } ! ! void visit( CaseStatement &statement ) ! { ! call_method<void>( self, "visitCaseStatement" ); ! } ! ! void visit( CompoundStatement &statement ) ! { ! call_method<void>( self, "visitCompoundStatement" ); ! } ! ! void visit( ConditionStatement &statement ) ! { ! call_method<void>( self, "visitConditionStatement" ); ! } ! ! void visit( ContinueStatement &statement ) ! { ! call_method<void>( self, "visitContinueStatement" ); ! } ! ! void visit( DefaultStatement &statement ) ! { ! call_method<void>( self, "visitDefaultStatement" ); ! } ! ! void visit( DeclarationStatement &statement ) ! { ! call_method<void>( self, "visitDeclarationStatement" ); ! } ! ! void visit( DoStatement &statement ) ! { ! call_method<void>( self, "visitDoStatement" ); ! } ! ! void visit( ExpressionStatement &statement ) ! { ! call_method<void>( self, "visitExpressionStatement" ); ! } ! ! void visit( FlowControlStatement &statement ) ! { ! call_method<void>( self, "visitFlowControlStatement" ); ! } ! ! void visit( ForStatement &statement ) ! { ! call_method<void>( self, "visitForStatementStatement" ); ! } ! ! void visit( GotoStatement &statement ) ! { ! call_method<void>( self, "visitGotoStatement" ); ! } ! ! void visit( IfStatement &statement ) ! { ! call_method<void>( self, "visitIfStatement" ); ! } ! ! void visit( IterationStatement &statement ) ! { ! call_method<void>( self, "visitIterationStatement" ); ! } ! ! void visit( LabelStatement &statement ) { - call_method<void>( self, "visitLabelStatement" ); } ! void visit( NullStatement &statement ) ! { ! call_method<void>( self, "visitNullStatement" ); ! } - void visit( ReturnStatement &statement ) - { - call_method<void>( self, "visitReturnStatement" ); - } ! void visit( SwitchLabelStatement &statement ) ! { ! call_method<void>( self, "visitSwitchLabelStatement" ); ! } ! void visit( SwitchStatement &statement ) { - call_method<void>( self, "visitSwitchStatement" ); } ! void visit( WhileStatement &statement ) { ! call_method<void>( self, "visitWhileStatement" ); } }; ! class ExpressionVisitorWrap : public ExpressionVisitor { public: - PyObject *self; ! ExpressionVisitorWrap( PyObject *self_ ) ! : self(self_) ! { ! } ! ! void visit( AssignInitializerExpression &expression ) ! { ! call_method<void>( self, "visitAssignInitializerExpression" ); ! } ! ! void visit( ConstructorInitializerExpression &expression ) { ! call_method<void>( self, "visitConstructorInitializerExpression" ); } ! void visit( DeclaratorExpression &expression ) { ! call_method<void>( self, "visitDeclaratorExpression" ); } ! void visit( DefaultConditionExpression &expression ) { ! call_method<void>( self, "visitDefaultConditionExpression" ); } ! void visit( Expression &expression ) { ! call_method<void>( self, "visitExpression" ); } ! void visit( GenericExpression &expression ) { ! call_method<void>( self, "visitGenericExpression" ); } ! void visit( NullExpression &expression ) { ! call_method<void>( self, "visitNullExpression" ); } - }; - ! class ElementVisitorWrap : public ElementVisitor ! , public StatementVisitorWrap ! , public ExpressionVisitorWrap ! { ! ElementVisitorWrap( PyObject *self_ ) ! : StatementVisitorWrap( self_ ) ! , ExpressionVisitorWrap( self_ ) ! { ! } }; ! ! void statementAccept( StatementVisitor &visitor ) { ! // statement->accept( visitor ); } - - - - struct Base - { - virtual int f() - { - return 1; - } - }; - - int call_f(Base& b) { return b.f(); } - - - struct BaseWrap : Base - { - BaseWrap(PyObject* self_) - : self(self_) {} - BaseWrap(PyObject* self_, const Base &other) - : Base(other) - , self(self_) {} - int f() { return call_method<int>(self, "f"); } - int default_f() { return Base::f(); } // <<=== ***ADDED*** - PyObject* self; - }; - - - BOOST_PYTHON_MODULE(pyrfta) { ! class_<Base, BaseWrap>("Base") ! .def("f", &Base::f, &BaseWrap::default_f) ! ; ! def("call_f", call_f); ! ! ! ! class_<Change>( "Change" ) ! .def( init<Change::ChangeType, Refactoring::SourceRange>() ) ! .def( "wasReplaced", &Change::wasReplaced ) ! .def( "wasRemoved", &Change::wasRemoved ) ! .def( "wasAdded", &Change::wasAdded ) ! .def( "isUnmodified", &Change::isUnmodified ) ! .def_readwrite( "type", &Change::type_ ) ! .def_readwrite( "oldRange", &Change::oldRange_ ) ! ; ! ! enum_<Change::ChangeType>( "ChangeType" ) ! .value( "added", Change::added ) ! .value( "replaced", Change::replaced ) ! .value( "removed", Change::removed ) ! .value( "unmodified", Change::unmodified ) ! ; ! ! class_<SourceRange>( "SourceRange" ) ! .def( init<int,int>() ) ! .def( "moveStartIndexBy", &SourceRange::moveStartIndexBy ) ! .add_property( "startIndex", &SourceRange::getStartIndex ) ! .add_property( "endIndex", &SourceRange::getEndIndex ) ! .add_property( "length", &SourceRange::getLength, &SourceRange::setLength ) ! .def( "isEmpty", &SourceRange::isEmpty ) ! .def( "contains", &SourceRange::contains ) ! .def( "overlap", &SourceRange::overlap ) ! .def( "toString", &SourceRange::toString ) // should use str(self) ! .def( self == self ) ! .def( self < self ) ! ; ! ! class_<StatementVisitor, StatementVisitorWrap, boost::noncopyable>( "StatementVisitor" ) ! ; ! ! // class_<ExpressionVisitor, ExpressionVisitorWrap, boost::noncopyable>( "ExpressionVisitor", no_init ) ! ; ! ! // class_<ElementVisitor, ElementVisitorWrap, boost::noncopyable>( "ElementVisitor", no_init ) ! ; ! ! void (Element::*mfAcceptElementVisitor)( ElementVisitor & ) = &Element::accept; ! class_<Element>( "Element" ) ! .def( "isFromSource", &Element::isFromSource ) ! .def( "getSourceText", &Element::getSourceText ) ! .def( "getSourceRange", &Element::getSourceRange ) ! // .def( "setSource", &Element::setSource ) ! // .def( "accept", mfAcceptElementVisitor ) ! ; ! ! void (Statement::*mfAcceptStatementVisitor)( StatementVisitor & ) = &Statement::accept; ! class_<Statement, bases<Element>, boost::noncopyable >( "Statement", no_init ) ! .def( "accept", mfAcceptStatementVisitor ) ! ; ! ! ! class_<NullStatement, bases<Statement> >( "NullStatement" ) ! ; ! ! class_<Label, bases<Element> >( "Label" ) ! .def( init<std::string>() ) ! .add_property( "labelName", &Label::getLabelName ) ; ! class_<LabelHolderStatement>( "LabelHolderStatement", init<LabelPtr>() ) ! .add_property( "label", &LabelHolderStatement::getLabel, &LabelHolderStatement::setLabel ) ; ! class_<LabelStatement, bases<Statement,LabelHolderStatement> >( "LabelStatement", init<LabelPtr>() ) ; - - def( "statementAccept", &statementAccept ); } - - - /* - class Visitor(StatementVisitor): - ... def __init__( self ): - ... pass - ... - ... def visitNullStatement( self, statement ): - ... print "NullStatement visited" - ... - ... v = Visitor() - ... s = NullStatement() - */ \ No newline at end of file --- 9,114 ---- using namespace boost::python; ! #include <boost/shared_ptr.hpp> ! #include <boost/enable_shared_from_this.hpp> ! class B; ! typedef boost::shared_ptr<B> BPtr; ! class AVisitor { public: ! virtual ~AVisitor() { } ! virtual void f( const BPtr &b ) = 0; ! }; ! class AVisitorWrap : public AVisitor ! { ! public: ! PyObject *self_; ! AVisitorWrap( PyObject *self ) : self_( self ) { } ! void f( const BPtr &b ) { ! call_method<void>( self_, "f", object( b ) ); } }; ! class B : public boost::enable_shared_from_this<B> { public: ! B( int value ) : value_( value ) { ! static int serial = 0; ! serial_ = ++serial; ! std::cout << "B Constructed( " << value_ << " ) : #" << serial_ << std::endl; } ! ~B() { ! std::cout << "B Destroyed( " << value_ << " ) : #" << serial_ << std::endl; } ! void accept( AVisitor &visitor ) { ! visitor.f( shared_from_this() ); } ! int getValue() const { ! return value_; } ! long useCount() const { ! return shared_from_this().use_count(); } ! int serial() const { ! return serial_; } ! int value_; ! int serial_; }; ! BPtr makeB( int value ) { ! return BPtr( new B( value ) ); } BOOST_PYTHON_MODULE(pyrfta) { ! exposeBase(); ! exposeStatements(); ! exposeStatements2(); ! exposeStatements3(); ! exposeVisitors(); ! class_<B, boost::shared_ptr<B> >( "B", init<int>() ) ! .def( "accept", &B::accept ) ! .def( "count", &B::useCount ) ! .def( "serial", &B::serial ) ! .add_property( "value", &B::getValue ) ! // .def_readonly( "value", &B::value_ ) // Not compiling !!! ; ! class_<AVisitor, AVisitorWrap, boost::noncopyable>( "AVisitor" ) ; ! def( "makeB", &makeB ) ; } Index: pyrfta.dsp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/pyrfta/pyrfta.dsp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pyrfta.dsp 1 Apr 2003 18:22:56 -0000 1.2 --- pyrfta.dsp 5 Apr 2003 18:29:01 -0000 1.3 *************** *** 44,48 **** # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PYRFTA_EXPORTS" /YX /FD /c ! # ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "../../include" /D "NDEBUG" /D "BOOST_PYTHON_STATIC_LINK" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "BOOST_PYTHON_DYNAMIC_LIB" /D "_USRDLL" /YX /FD /Zm200 /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 --- 44,48 ---- # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PYRFTA_EXPORTS" /YX /FD /c ! # ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "../../include" /D "NDEBUG" /D "BOOST_PYTHON_STATIC_LINK" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "BOOST_PYTHON_DYNAMIC_LIB" /D "_USRDLL" /YX /FD /Zm500 /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 *************** *** 75,79 **** # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PYRFTA_EXPORTS" /YX /FD /GZ /c ! # ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "BOOST_PYTHON_DYNAMIC_LIB" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /Zm200 /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 --- 75,79 ---- # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PYRFTA_EXPORTS" /YX /FD /GZ /c ! # ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "BOOST_PYTHON_DYNAMIC_LIB" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /Zm500 /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 *************** *** 98,101 **** --- 98,133 ---- # Name "pyrfta - Win32 Release" # Name "pyrfta - Win32 Debug" + # Begin Group "pytest" + + # PROP Default_Filter "" + # Begin Source File + + SOURCE=.\pytest\test.py + # End Source File + # End Group + # Begin Source File + + SOURCE=.\ExposeBase.cpp + # End Source File + # Begin Source File + + SOURCE=.\ExposeStatements.cpp + # End Source File + # Begin Source File + + SOURCE=.\ExposeStatements2.cpp + # End Source File + # Begin Source File + + SOURCE=.\ExposeStatements3.cpp + # End Source File + # Begin Source File + + SOURCE=.\ExposeVisitors.cpp + # End Source File + # Begin Source File + + SOURCE=.\Forwards.h + # End Source File # Begin Source File |
From: <bl...@us...> - 2003-04-05 18:29:03
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin In directory sc8-pr-cvs1:/tmp/cvs-serv28468/src/eclipseplugin Modified Files: eclipseplugin.dsp Log Message: * added working python binding for code model statement Index: eclipseplugin.dsp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/eclipseplugin/eclipseplugin.dsp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** eclipseplugin.dsp 15 Feb 2003 13:30:52 -0000 1.1 --- eclipseplugin.dsp 5 Apr 2003 18:29:00 -0000 1.2 *************** *** 43,47 **** # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ECLIPSEPLUGIN_EXPORTS" /YX /FD /c ! # ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /I "../../deplib/cppunit/include" /I "../../deplib/boostcvs" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ECLIPSEPLUGIN_EXPORTS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 --- 43,47 ---- # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ECLIPSEPLUGIN_EXPORTS" /YX /FD /c ! # ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "../../include" /I "../../deplib/cppunit/include" /I "../../deplib/boostcvs" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ECLIPSEPLUGIN_EXPORTS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 *************** *** 56,62 **** # Begin Special Build Tool ProjDir=. ! TargetDir=\Projects\Cpptool\rfta\build\eclipseplugin\Release SOURCE="$(InputPath)" ! PostBuild_Cmds=copy $(TargetDir)\eclipseplugin.dll $(ProjDir)\plugincode\ # End Special Build Tool --- 56,62 ---- # Begin Special Build Tool ProjDir=. ! TargetDir=\prg\vc\Rfta\build\eclipseplugin\Release SOURCE="$(InputPath)" ! PostBuild_Cmds=copy $(TargetDir)\eclipseplugin.dll $(ProjDir)\plugincode\ # End Special Build Tool *************** *** 89,93 **** # Begin Special Build Tool ProjDir=. ! TargetDir=\Projects\Cpptool\rfta\build\eclipseplugin\Debug SOURCE="$(InputPath)" PostBuild_Cmds=copy $(TargetDir)\eclipseplugin_d.dll $(ProjDir)\plugincode --- 89,93 ---- # Begin Special Build Tool ProjDir=. ! TargetDir=\prg\vc\Rfta\build\eclipseplugin\Debug SOURCE="$(InputPath)" PostBuild_Cmds=copy $(TargetDir)\eclipseplugin_d.dll $(ProjDir)\plugincode |
From: <bl...@us...> - 2003-04-05 18:29:03
|
Update of /cvsroot/cpptool/rfta/src In directory sc8-pr-cvs1:/tmp/cvs-serv28468/src Modified Files: rfta.opt Log Message: * added working python binding for code model statement Index: rfta.opt =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta.opt,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 Binary files /tmp/cvss8ykWc and /tmp/cvseicVdh differ |
From: <bl...@us...> - 2003-04-05 18:26:11
|
Update of /cvsroot/cpptool/rfta/src/pyrfta/pytest In directory sc8-pr-cvs1:/tmp/cvs-serv27666/pytest Log Message: Directory /cvsroot/cpptool/rfta/src/pyrfta/pytest added to the repository |
From: <net...@us...> - 2003-04-05 12:14:49
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv16977/src/rfta Modified Files: RenameTempRefactoringTest.h RenameTempRefactoringTest.cpp RenameTempRefactoring.cpp Log Message: bugfix + new tests for bug Index: RenameTempRefactoringTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/RenameTempRefactoringTest.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RenameTempRefactoringTest.h 19 Dec 2002 20:17:33 -0000 1.8 --- RenameTempRefactoringTest.h 5 Apr 2003 12:14:45 -0000 1.9 *************** *** 25,28 **** --- 25,29 ---- CPPUNIT_TEST( testRenameSkippingSubScope ); CPPUNIT_TEST( testRenameInVariableInitializer ); + CPPUNIT_TEST( testSelectInSubScope ); CPPUNIT_TEST_SUITE_END(); *************** *** 44,47 **** --- 45,50 ---- void testRenameSkippingSubScope(); void testRenameInVariableInitializer(); + + void testSelectInSubScope(); private: Index: RenameTempRefactoringTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/RenameTempRefactoringTest.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** RenameTempRefactoringTest.cpp 22 Dec 2002 15:47:34 -0000 1.14 --- RenameTempRefactoringTest.cpp 5 Apr 2003 12:14:45 -0000 1.15 *************** *** 208,211 **** --- 208,246 ---- } + void + RenameTempRefactoringTest::testSelectInSubScope() + { + builder_->add( + "{" + " double x = getPrice();" + " x += x * rate;"); + builder_->add( + " if ( needTaxes() )" + " {" + " int z = "); + builder_->addKeyingMid( "", "x", " * taxeRate;", "selection" ); + + builder_->add(" setTaxes( x );" + " }" + " return x * getQuantity();" + "}" ); + + applyRefactoring( "price", "x" ); + + std::string expectedSource( + "{" + " double price = getPrice();" + " price += price * rate;" + " if ( needTaxes() )" + " {" + " int z = price * taxeRate;" + " setTaxes( price );" + " }" + " return price * getQuantity();" + "}" ); + std::string actualSource( document_->getAllText() ); + RFTA_ASSERT_EQUAL( expectedSource, actualSource ); + } + } // namespace Refactoring Index: RenameTempRefactoring.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/RenameTempRefactoring.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** RenameTempRefactoring.cpp 22 Dec 2002 16:03:52 -0000 1.14 --- RenameTempRefactoring.cpp 5 Apr 2003 12:14:45 -0000 1.15 *************** *** 73,95 **** blanker.blank(); ! int compoundStartIndex = ! ToolsBox::findCompoundBefore( blankedSource, temporaryLocation_ ); ! if ( compoundStartIndex < 0 ) ! throw RefactoringError( RefactoringError::temporaryNotInFunctionBody ); ! sourceNode_ = SourceASTNode::create( blankedSource, source ); ! ParseContext context( sourceNode_ ); ! StatementParser parser( context, ! sourceNode_->getBlankedSourceStart() + ! compoundStartIndex, ! sourceNode_->getBlankedSourceEnd() ); ! parser.parse(); ! // don't bother with lazy parsing for now... ! MaxLODMutator mutator; ! mutator.mutate( sourceNode_, sourceNode_ ); ! findLocaleVariableOccurrences(); } --- 73,128 ---- blanker.blank(); ! int start_at = temporaryLocation_; ! bool extend_scope = false; ! do ! { ! // find the compound statement where the temporary is located: ! int compoundStartIndex = ! ToolsBox::findCompoundBefore( blankedSource, start_at ); ! if ( compoundStartIndex < 0 ) ! throw RefactoringError( RefactoringError::temporaryNotInFunctionBody ); ! // 'lazy' parse the source ! sourceNode_ = SourceASTNode::create( blankedSource, source ); ! ParseContext context( sourceNode_ ); ! StatementParser parser( context, ! sourceNode_->getBlankedSourceStart() + ! compoundStartIndex, ! sourceNode_->getBlankedSourceEnd() ); ! try { ! parser.parse(); ! // do mutate to highest level until we know how to do it 'lazy' ! MaxLODMutator mutator; ! mutator.mutate( sourceNode_, sourceNode_ ); ! } ! catch (ParserError e) ! { ! // tried to parse outside a function body ? ! // TODO: is this change of the exception ok ? (AndreBaresel) ! throw RefactoringError( RefactoringError::identifierIsNotLocalVariable); ! } ! try { ! // find all occurrences of the temporary. ! findLocaleVariableOccurrences(); ! extend_scope= false; ! } ! catch (RefactoringError e) ! { ! if (e.getCause() == RefactoringError::identifierIsNotLocalVariable) ! { ! start_at = compoundStartIndex-1; ! if (start_at>=0) ! { ! extend_scope= true; ! continue; ! } ! } ! throw e; ! } ! } ! while (extend_scope); } |
From: <net...@us...> - 2003-04-05 12:13:39
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv16599/src/rfta Modified Files: InlineTempRefactoringTest.h InlineTempRefactoringTest.cpp InlineTempRefactoring.cpp Log Message: bugfix + new tests for bug Index: InlineTempRefactoringTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/InlineTempRefactoringTest.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** InlineTempRefactoringTest.h 30 Dec 2002 10:44:08 -0000 1.2 --- InlineTempRefactoringTest.h 5 Apr 2003 12:13:36 -0000 1.3 *************** *** 22,26 **** CPPUNIT_TEST( testThrowNoInitializer ); CPPUNIT_TEST( testThrowInitializerNotSupported ); ! CPPUNIT_TEST( testThrowVariableAssigned ); CPPUNIT_TEST( testDetectComplexVariableAssignments ); CPPUNIT_TEST( testMultipleDeclarationInitLast ); --- 22,26 ---- CPPUNIT_TEST( testThrowNoInitializer ); CPPUNIT_TEST( testThrowInitializerNotSupported ); ! CPPUNIT_TEST( testThrowVariableAssigned ); CPPUNIT_TEST( testDetectComplexVariableAssignments ); CPPUNIT_TEST( testMultipleDeclarationInitLast ); *************** *** 28,31 **** --- 28,33 ---- CPPUNIT_TEST( testMultipleDeclarationInitMiddle ); CPPUNIT_TEST( testInitExpression ); + CPPUNIT_TEST( testSelectInSubScope ); + CPPUNIT_TEST( testThrowNoDeclaration ); CPPUNIT_TEST_SUITE_END(); *************** *** 53,56 **** --- 55,61 ---- void testInitExpression(); + + void testSelectInSubScope(); + void testThrowNoDeclaration(); private: Index: InlineTempRefactoringTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/InlineTempRefactoringTest.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** InlineTempRefactoringTest.cpp 30 Dec 2002 13:57:22 -0000 1.3 --- InlineTempRefactoringTest.cpp 5 Apr 2003 12:13:36 -0000 1.4 *************** *** 317,320 **** --- 317,362 ---- } + void + InlineTempRefactoringTest::testSelectInSubScope() + { + builder_->add( + "{" + " double y,x = 4;" ); + builder_->addKeyingMid( " {y += y * ","x",";}", "selection" ); + + builder_->add( + " return x * getQuantity();" + "}" ); + + applyRefactoring( "x" ); + + std::string expectedSource( + "{" + " double y;" + " {y += y * 4;}" + " return 4 * getQuantity();" + "}" ); + std::string actualSource( document_->getAllText() ); + RFTA_ASSERT_EQUAL( expectedSource, actualSource ); + } + + void + InlineTempRefactoringTest::testThrowNoDeclaration() + { + builder_->add( + "namespace xx { int x;" + "int func() { double y;" ); + builder_->addKeyingMid( " {y += y * ","x",";}", "selection" ); + + builder_->add( + " return x * getQuantity();" + "}" ); + + builder_->add( + "}"); + + applyRefactoringExpectThrow( "x", RefactoringError::identifierIsNotLocalVariable, CPPUNIT_SOURCELINE() ); + } + } // namespace Refactoring Index: InlineTempRefactoring.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/InlineTempRefactoring.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** InlineTempRefactoring.cpp 15 Mar 2003 16:57:39 -0000 1.5 --- InlineTempRefactoring.cpp 5 Apr 2003 12:13:36 -0000 1.6 *************** *** 11,14 **** --- 11,15 ---- #include <rfta/parser/ParseContext.h> #include <rfta/parser/StatementParser.h> + #include <rfta/parser/ParserError.h> #include <rfta/parser/MaxLODMutator.h> #include <rfta/parser/ExpressionOperationMutator.h> *************** *** 19,23 **** #include "TransformList.h" - namespace Refactoring { --- 20,23 ---- *************** *** 72,97 **** blanker.blank(); ! // find the compound statement where the temporary is located: ! int compoundStartIndex = ! ToolsBox::findCompoundBefore( blankedSource, temporaryLocation_ ); ! if ( compoundStartIndex < 0 ) ! throw RefactoringError( RefactoringError::temporaryNotInFunctionBody ); ! // 'lazy' parse the source ! sourceNode_ = SourceASTNode::create( blankedSource, source ); ! ParseContext context( sourceNode_ ); ! StatementParser parser( context, ! sourceNode_->getBlankedSourceStart() + ! compoundStartIndex, ! sourceNode_->getBlankedSourceEnd() ); ! parser.parse(); ! // do mutate to highest level until we know how to do it 'lazy' ! MaxLODMutator mutator; ! mutator.mutate( sourceNode_, sourceNode_ ); ! // find all occurrences of the temporary. ! findLocaleVariableOccurrences(); // check for initializer property and throw exception if not found --- 72,123 ---- blanker.blank(); ! int start_at = temporaryLocation_; ! bool scope_extended = false; ! while (true) ! { ! // find the compound statement where the temporary is located: ! int compoundStartIndex = ! ToolsBox::findCompoundBefore( blankedSource, start_at ); ! if ( compoundStartIndex < 0 ) ! throw RefactoringError( RefactoringError::temporaryNotInFunctionBody ); ! // 'lazy' parse the source ! sourceNode_ = SourceASTNode::create( blankedSource, source ); ! ParseContext context( sourceNode_ ); ! StatementParser parser( context, ! sourceNode_->getBlankedSourceStart() + ! compoundStartIndex, ! sourceNode_->getBlankedSourceEnd() ); ! try { ! parser.parse(); ! // do mutate to highest level until we know how to do it 'lazy' ! MaxLODMutator mutator; ! mutator.mutate( sourceNode_, sourceNode_ ); ! } ! catch (ParserError e) ! { ! // tried to parse outside a function body ? ! // TODO: is this change of the exception ok ? (AndreBaresel) ! throw RefactoringError( RefactoringError::identifierIsNotLocalVariable); ! } ! try { ! // find all occurrences of the temporary. ! findLocaleVariableOccurrences(); ! break; ! } ! catch (RefactoringError e) ! { ! if (e.getCause() == RefactoringError::identifierIsNotLocalVariable) ! { ! start_at = compoundStartIndex-1; ! if (start_at>=0) ! continue; ! } ! throw e; ! } ! } // check for initializer property and throw exception if not found |
From: <net...@us...> - 2003-04-05 12:13:11
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv16396/src/rfta Modified Files: IdentifierResolverTest.h IdentifierResolverTest.cpp Log Message: corrected the test routine Index: IdentifierResolverTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/IdentifierResolverTest.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IdentifierResolverTest.h 31 Jan 2003 21:37:54 -0000 1.4 --- IdentifierResolverTest.h 5 Apr 2003 12:12:57 -0000 1.5 *************** *** 27,31 **** CPPUNIT_TEST( testForScope ); CPPUNIT_TEST( testSwitchScope ); ! // CPPUNIT_TEST( testBug1 ); CPPUNIT_TEST_SUITE_END(); --- 27,31 ---- CPPUNIT_TEST( testForScope ); CPPUNIT_TEST( testSwitchScope ); ! CPPUNIT_TEST( testBug1 ); CPPUNIT_TEST_SUITE_END(); Index: IdentifierResolverTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/IdentifierResolverTest.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IdentifierResolverTest.cpp 31 Jan 2003 21:37:54 -0000 1.5 --- IdentifierResolverTest.cpp 5 Apr 2003 12:13:00 -0000 1.6 *************** *** 258,263 **** builder_->addKeyingMid( "std::vector<int> ", "bigBuffer", ";", "bigBuffer.0" ); builder_->add( "{" ); ! builder_->addKeyingMid( " KTEST_ASSERT_EQUAL( ", "index", ", ", "index.1" ); ! builder_->addKeyingMid( "", "bigBuffer", "[index] );", "bigBuffer.1" ); builder_->add( "}" ); --- 258,265 ---- builder_->addKeyingMid( "std::vector<int> ", "bigBuffer", ";", "bigBuffer.0" ); builder_->add( "{" ); ! builder_->addKeyingMid( " ","KTEST_ASSERT_EQUAL","( ", "ktest.0" ); ! builder_->addKeyingMid( "", "index", ", ", "index.1" ); ! builder_->addKeyingMid( "", "bigBuffer", "", "bigBuffer.1" ); ! builder_->addKeyingMid( "[", "index", "] );", "index.2" ); builder_->add( "}" ); *************** *** 267,272 **** --- 269,276 ---- strategy_->enterNewLocalVariableScope(); + strategy_->resolveUnqualifiedIdentifier( getIdentifierNode( "ktest.0" ) ); strategy_->resolveUnqualifiedIdentifier( getIdentifierNode( "index.1" ) ); strategy_->resolveUnqualifiedIdentifier( getIdentifierNode( "bigBuffer.1" ) ); + strategy_->resolveUnqualifiedIdentifier( getIdentifierNode( "index.2" ) ); strategy_->exitLocalVariableScope(); |
From: <bl...@us...> - 2003-04-05 11:23:28
|
Update of /cvsroot/cpptool/rfta/deplib/boostcvs/libs/filesystem/doc In directory sc8-pr-cvs1:/tmp/cvs-serv1289/deplib/boostcvs/libs/filesystem/doc Added Files: convenience.htm Log Message: * upgraded to the official boost 1.30 filesystem --- NEW FILE: convenience.htm --- <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <link rel="stylesheet" type="text/css" href="../../boost.css"> <title>Boost Filesystem convenience.hpp Header</title> </head> <body bgcolor="#FFFFFF"> <h1> <img border="0" src="../../../c++boost.gif" align="center" width="277" height="86"><a href="../../../boost/filesystem/convenience.hpp">boost/filesystem/convenience.hpp</a></h1> <p>Header <a href="../../../boost/filesystem/convenience.hpp">convenience.hpp</a> provides convenience functions that combine lower-level functions in useful ways.</p> <h2>Contents</h2> <dl class="index"> <dt><a href="#create_directories">create_directories</a> </ol> <h2 id="create_directoies">create_directories</h2> <blockquote> <p><code>void create_directories( const path & ph );</code></p> <p><b>Precondition:</b> <code>ph.empty() || <br> forall p: p == ph || is_parent(p, ph): is_directory(p) || !exists( p )</code> </p> <p><b>Postcondition:</b> <code>exists(ph) && is_directory(ph)</code></p> <p>Contributed by Vladimir Prus.</p> </blockquote> <hr> <p>© Copyright Beman Dawes, 2002</p> <p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->23 December, 2002<!--webbot bot="Timestamp" endspan i-checksum="38510" --></p> <p> </p> </body> </html> |