[opengtl-commits] [723] new symbol generation based on the list of parameters ( this is needed for overloaded function support)

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 723
Author:   cyrille
Date:     2009-04-11 17:29:25 +0200 (Sat, 11 Apr 2009)

Log Message:
-----------
new symbol generation based on the list of parameters (this is needed for overloaded function support)
module data now contains a list of function
overloaded function is now fully supported

Modified Paths:
--------------
    trunk/OpenGTL/OpenCTL/OpenCTL/Module.cpp
    trunk/OpenGTL/OpenCTL/OpenCTL/Module.h
    trunk/OpenGTL/OpenCTL/OpenCTL/Program.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/CompilerBase_p.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/Function_p.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/Function_p.h
    trunk/OpenGTL/OpenGTL/GTLCore/ModuleData_p.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/ModuleData_p.h
    trunk/OpenGTL/OpenGTL/GTLCore/ParserBase_p.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/Type.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/Type_p.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/Type_p.h
    trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Kernel_p.cpp


Modified: trunk/OpenGTL/OpenCTL/OpenCTL/Module.cpp
===================================================================
--- trunk/OpenGTL/OpenCTL/OpenCTL/Module.cpp	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenCTL/OpenCTL/Module.cpp	2009-04-11 15:29:25 UTC (rev 723)
@@ -110,7 +110,11 @@
 {
   if( d->moduleData )
   {
-    return d->moduleData->function( nameSpace(), name);
+    const std::list<GTLCore::Function*>* f = d->moduleData->function( nameSpace(), name);
+    if(f and f->size() == 1 )
+    {
+      return f->front();
+    }
   }
   return 0;
 }

Modified: trunk/OpenGTL/OpenCTL/OpenCTL/Module.h
===================================================================
--- trunk/OpenGTL/OpenCTL/OpenCTL/Module.h	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenCTL/OpenCTL/Module.h	2009-04-11 15:29:25 UTC (rev 723)
@@ -64,7 +64,7 @@
        * @param name the name of the function
        * @return the function with the given name
        */
-      const GTLCore::Function* function(const GTLCore::String& name) const;
+      /*GTL_DEPRECATED */const GTLCore::Function* function(const GTLCore::String& name) const;
       /**
        * Start the compilation of the module.
        */

Modified: trunk/OpenGTL/OpenCTL/OpenCTL/Program.cpp
===================================================================
--- trunk/OpenGTL/OpenCTL/OpenCTL/Program.cpp	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenCTL/OpenCTL/Program.cpp	2009-04-11 15:29:25 UTC (rev 723)
@@ -121,7 +121,7 @@
     d->moduleData = new GTLCore::ModuleData( d->module );
     const GTLCore::Function* functionDef = module->function( functionName );
     if( not functionDef ) return;
-    llvm::Function* function = d->module->getFunction( GTLCore::Function::Data::symbolName( GTLCore::ScopedName( "", functionName), functionDef->parameters() ) );
+    llvm::Function* function = d->module->getFunction( GTLCore::Function::Data::symbolName( GTLCore::ScopedName( "", functionName), functionDef->returnType(),functionDef->parameters() ) );
     if(function)
     {
       GTLCore::CodeGenerator cg( d->moduleData );

Modified: trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp	2009-04-11 15:29:25 UTC (rev 723)
@@ -107,7 +107,7 @@
   // Generate the full function
   const llvm::Type* returnType = m_function->returnType()->d->asArgumentType();
   llvm::FunctionType* definitionType = llvm::FunctionType::get( returnType, params, false );
-  GTLCore::String fullFunctionName = GTLCore::Function::Data::symbolName( m_function->name(), m_function->parameters());
+  GTLCore::String fullFunctionName = GTLCore::Function::Data::symbolName( m_function->name(), m_function->returnType(), m_function->parameters());
   llvm::Function* fullFunction = _codeGenerator->createFunction(definitionType, fullFunctionName );
   functions[ params.size() ] = fullFunction;
   std::vector< Parameter > gtlParams = m_function->parameters(); // Use a copy of this to create the symbol name
@@ -121,7 +121,7 @@
     llvm::FunctionType* definitionType = llvm::FunctionType::get( m_function->returnType()->d->type(), params, false );
     // Create the function
     llvm::Function* function = _codeGenerator->createFunction( definitionType, 
-        GTLCore::Function::Data::symbolName(m_function->name() , gtlParams ) );
+        GTLCore::Function::Data::symbolName(m_function->name(), m_function->returnType(), gtlParams ) );
     GenerationContext generationContext( _codeGenerator, function, m_function, _module);
     // Create a block for the call to the function with one more parameter
     llvm::BasicBlock* BB = llvm::BasicBlock::Create("CallForwarder");

Modified: trunk/OpenGTL/OpenGTL/GTLCore/CompilerBase_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/CompilerBase_p.cpp	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenGTL/GTLCore/CompilerBase_p.cpp	2009-04-11 15:29:25 UTC (rev 723)
@@ -128,8 +128,6 @@
     funcs.push_back(func);
     d->functions[name] = funcs;
   } else {
-    // TODO check that this overload of the function doesn't already exists
-    
     foreach( GTLCore::Function* function, it->second)
     {
       if( function->returnType() == func->returnType() and function->parameters().size() == func->parameters().size() )
@@ -150,6 +148,7 @@
     }
     
     it->second.push_back(func);
+    GTL_ASSERT(it->second.size() > 1 );
   }
     return true;
 }

Modified: trunk/OpenGTL/OpenGTL/GTLCore/Function_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Function_p.cpp	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Function_p.cpp	2009-04-11 15:29:25 UTC (rev 723)
@@ -28,6 +28,7 @@
 #include "Parameter.h"
 
 #include "Debug.h"
+#include "Macros_p.h"
 #include "ModuleData_p.h"
 #include "ScopedName.h"
 #include "Value.h"
@@ -72,9 +73,16 @@
   return m_functions[count];
 }
 
-GTLCore::String Function::Data::symbolName( const ScopedName& _functionName, const std::vector< Parameter >& _parameters )
+GTLCore::String Function::Data::symbolName( const ScopedName& _functionName, const GTLCore::Type* _returnType, const std::vector< Parameter >& _parameters )
 {
-  return _functionName.nameSpace() + "_" + _functionName.name() + GTLCore::String::number( (int)_parameters.size() );
+  GTLCore::String functionSymbolName = _functionName.nameSpace() + "_" + _functionName.name() + "_" + _returnType->d->symbolName();
+  
+  foreach( const Parameter& param, _parameters)
+  {
+    functionSymbolName += "_" + param.type()->d->symbolName();
+  }
+  
+  return functionSymbolName;
 }
 
 Function* Function::Private::createExternalFunction(ModuleData* _module, const Function* _functionToCopy )
@@ -84,7 +92,8 @@
   std::vector<llvm::Function*> functions(max + 1);
   for(int i = min; i <= max; ++i)
   {
-    GTLCore::String _symbolName = GTLCore::Function::Data::symbolName( _functionToCopy->name(), _functionToCopy->parameters() ); // FIXME I have a doubt that it works for functions with default argument
+    GTLCore::String _symbolName = GTLCore::Function::Data::symbolName( _functionToCopy->name(), _functionToCopy->returnType(), _functionToCopy->parameters() ); // FIXME I have a doubt that it works for functions with default argument
+    GTL_DEBUG(_symbolName);
     const llvm::Function* func = _functionToCopy->d->data->function( i );
     const llvm::FunctionType *FTy =
     llvm::cast<llvm::FunctionType>(llvm::cast<llvm::PointerType>(func->getType())->getElementType());

Modified: trunk/OpenGTL/OpenGTL/GTLCore/Function_p.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Function_p.h	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Function_p.h	2009-04-11 15:29:25 UTC (rev 723)
@@ -81,7 +81,7 @@
       /**
        * @return the symbol name for the function with the given scoped name and parameters
        */
-      static String symbolName( const ScopedName& _functionName, const std::vector< Parameter >& _parameters );
+      static String symbolName( const GTLCore::ScopedName& _functionName, const GTLCore::Type* _returnType, const std::vector< GTLCore::Parameter >& _parameters );
     private:
       std::vector< Parameter > m_parameters;
       std::vector<llvm::Function*> m_functions;

Modified: trunk/OpenGTL/OpenGTL/GTLCore/ModuleData_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/ModuleData_p.cpp	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenGTL/GTLCore/ModuleData_p.cpp	2009-04-11 15:29:25 UTC (rev 723)
@@ -46,9 +46,13 @@
 
 ModuleData::~ModuleData()
 {
-  for( std::map<ScopedName, Function*>::iterator it = m_functions.begin();
+  for( std::map<ScopedName, std::list<Function*>* >::iterator it = m_functions.begin();
        it != m_functions.end(); ++it)
   {
+    foreach( Function* function, *it->second )
+    {
+      delete function;
+    }
     delete it->second;
   }
   delete m_llvmModule;
@@ -58,18 +62,22 @@
 bool ModuleData::appendFunction(const ScopedName& name, Function* function)
 {
   GTL_DEBUG(name);
-  if( m_functions.find(name) != m_functions.end())
+  if( m_functions.find(name) == m_functions.end())
   {
-    return false;
+    std::list<Function*>* functions = new std::list<Function*>();
+    functions->push_back(function);
+    m_functions[name] = functions;
+  } else {
+    // TODO might be worth to check that the function doesn't exist allready
+    m_functions[name]->push_back(function);
   }
-  m_functions[name] = function;
   return true;
 }
 
-Function* ModuleData::function(const String& _currentNameSpace, const String& _name)
+const std::list<Function*>* ModuleData::function(const String& _currentNameSpace, const String& _name)
 {
   GTL_DEBUG( _currentNameSpace << "::" << _name );
-  for( std::map<ScopedName, Function*>::iterator it = m_functions.begin();
+  for( std::map<ScopedName, std::list<Function*>*>::iterator it = m_functions.begin();
        it != m_functions.end(); ++it)
   {
     GTL_DEBUG( it->first );
@@ -83,9 +91,9 @@
   return 0;
 }
 
-Function* ModuleData::function(const ScopedName& name)
+const std::list<Function*>* ModuleData::function(const ScopedName& name)
 {
-  std::map<ScopedName, Function*>::iterator it = m_functions.find(name);
+  std::map<ScopedName, std::list<Function*>* >::iterator it = m_functions.find(name);
   if( it == m_functions.end())
   {
     return 0;
@@ -98,10 +106,13 @@
 {
   std::list<Function*> functions;
   GTL_DEBUG( m_functions.size());
-  for( std::map<ScopedName, Function*>::iterator it = m_functions.begin();
+  for( std::map<ScopedName, std::list<Function*>*>::iterator it = m_functions.begin();
        it != m_functions.end(); ++it)
   {
-    functions.push_back(it->second);
+    foreach(Function* function, *it->second)
+    {
+      functions.push_back(function);
+    }
   }
   return functions;
 }

Modified: trunk/OpenGTL/OpenGTL/GTLCore/ModuleData_p.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/ModuleData_p.h	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenGTL/GTLCore/ModuleData_p.h	2009-04-11 15:29:25 UTC (rev 723)
@@ -42,8 +42,8 @@
       ModuleData( llvm::Module* llvmModule);
       ~ModuleData();
       bool appendFunction(const ScopedName& name, Function* function);
-      Function* function(const String& _currentNameSpace, const String& _name);
-      Function* function(const ScopedName& name);
+      const std::list<Function*>* function(const String& _currentNameSpace, const String& _name);
+      const std::list<Function*>* function(const ScopedName& name);
       std::list<Function*> functions();
       std::map< ScopedName, llvm::Constant* > constants() { return m_constants; }
       void addConstant( const ScopedName& _scopedName, llvm::Constant* _constant )
@@ -62,7 +62,7 @@
     private:
       llvm::Module* m_llvmModule;
       llvm::Module* m_llvmLinkedModule;
-      std::map<ScopedName, Function*> m_functions;
+      std::map<ScopedName, std::list<Function*>* > m_functions;
       TypesManager* m_typesManager;
       std::map< ScopedName, llvm::Constant* > m_constants;
       std::list< const llvm::Module* > m_linkModuleWith;

Modified: trunk/OpenGTL/OpenGTL/GTLCore/ParserBase_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/ParserBase_p.cpp	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenGTL/GTLCore/ParserBase_p.cpp	2009-04-11 15:29:25 UTC (rev 723)
@@ -1451,7 +1451,6 @@
     }
     *_selectedFunction = function;
   } else {
-    GTL_ABORT("Unimplemented");
     GTLCore::Function* bestFunction = 0;
     int bestLosslessConversionCount = _expressions.size() + 1;
     int bestLossConversionCount = _expressions.size() + 1;

Modified: trunk/OpenGTL/OpenGTL/GTLCore/Type.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Type.cpp	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Type.cpp	2009-04-11 15:29:25 UTC (rev 723)
@@ -105,7 +105,7 @@
 {
   GTL_DEBUG("Create type for " << _dataType);
   GTL_ASSERT(_dataType != STRUCTURE and _dataType != ARRAY and _dataType != VECTOR );
-  if(_dataType == STRUCTURE or _dataType == ARRAY)
+  if(_dataType == STRUCTURE or _dataType == ARRAY or _dataType == VECTOR)
   {
     d->dataType = UNDEFINED;
   }
@@ -129,6 +129,7 @@
     types.push_back(it->type()->d->type());
   }
   d->setType(llvm::StructType::get(types));
+  d->m_symbolName = "struct_" + _structName;
 }
 
 Type::Type(const Type* _arrayType) : d(new Private)
@@ -141,6 +142,7 @@
   types.push_back(llvm::Type::Int32Ty);
   types.push_back( llvm::PointerType::get( _arrayType->d->type(), 0));
   d->setType( llvm::StructType::get(types));
+  d->m_symbolName = "array_" + _arrayType->d->symbolName();
 }
 
 Type::Type(int _size, const Type* _vectorType) : d(new Private)
@@ -149,6 +151,7 @@
   d->arrayType = _vectorType;
   d->vectorSize = _size;
   d->setType( llvm::VectorType::get( _vectorType->d->type(), d->vectorSize ) );
+  d->m_symbolName = "vector" + String::number(_size) + "_" + _vectorType->d->symbolName();
 }
 
 void Type::init(DataType _dataType)

Modified: trunk/OpenGTL/OpenGTL/GTLCore/Type_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Type_p.cpp	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Type_p.cpp	2009-04-11 15:29:25 UTC (rev 723)
@@ -87,33 +87,51 @@
       break;
     case Type::BOOLEAN:
       m_type = llvm::IntegerType::get(1);
+      m_symbolName = "b";
       break;
     case Type::INTEGER8:
+      m_symbolName = "i8";
+      m_type = llvm::Type::Int8Ty;
+      break;
     case Type::UNSIGNED_INTEGER8:
       m_type = llvm::Type::Int8Ty;
+      m_symbolName = "ui8";
       break;
     case Type::INTEGER16:
+      m_type = llvm::Type::Int16Ty;
+      m_symbolName = "i16";
+      break;
     case Type::UNSIGNED_INTEGER16:
       m_type = llvm::Type::Int16Ty;
+      m_symbolName = "ui16";
       break;
     case Type::INTEGER32:
+      m_type = llvm::Type::Int32Ty;
+      m_symbolName = "i32";
+      break;
     case Type::UNSIGNED_INTEGER32:
       m_type = llvm::Type::Int32Ty;
+      m_symbolName = "ui32";
       break;
     case Type::HALF: // HALF are stored in unsigned int16
       m_type = llvm::Type::Int16Ty;
+      m_symbolName = "f16";
       break;
     case Type::DOUBLE:
       m_type = llvm::Type::DoubleTy;
+      m_symbolName = "f64";
       break;
     case Type::FLOAT:
       m_type = llvm::Type::FloatTy;
+      m_symbolName = "f32";
       break;
     case Type::VOID:
       m_type = llvm::Type::VoidTy;
+      m_symbolName = "v";
       break;
     case Type::POINTER:
       m_type = llvm::PointerType::get(llvm::Type::Int8Ty, 0);
+      m_symbolName = "p";
       break;
     default:
       m_type = 0;
@@ -298,3 +316,8 @@
       return 0;
   }
 }
+
+const GTLCore::String& Type::Private::symbolName() const
+{
+  return m_symbolName;
+}

Modified: trunk/OpenGTL/OpenGTL/GTLCore/Type_p.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Type_p.h	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Type_p.h	2009-04-11 15:29:25 UTC (rev 723)
@@ -142,6 +142,7 @@
        * @return the subtype at a given index
        */
       const GTLCore::Type* subtypeAt( unsigned int _index );
+      const GTLCore::String& symbolName() const;
     private:
       void setType( const llvm::Type* _type);
       const llvm::Type* m_type;
@@ -149,6 +150,7 @@
       unsigned int vectorSize;
       const Type* arrayType;
       GTLCore::String structName;
+      GTLCore::String m_symbolName;
       std::vector<StructDataMember>* structDataMembers;
       std::vector<Type::StructFunctionMember>* structFunctionMembers;
       std::vector<Type::StructFunctionMember>* structPrivateFunctionMembers;

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.cpp	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.cpp	2009-04-11 15:29:25 UTC (rev 723)
@@ -260,8 +260,9 @@
     GTLCore::VariableNG* resultVar = new GTLCore::VariableNG( _kernel->d->outputPixelType(), false, false );
   resultVar->initialise( generationContext, initialBlock, GTLCore::ExpressionResult(), std::list<llvm::Value*>());
   // Get the evaluatePixel function
-    GTLCore::Function* ePFunction = moduleData->function( _kernel->name(), "evaluatePixel" );
-    SHIVA_ASSERT( ePFunction );
+    const std::list<GTLCore::Function*>* ePFunctions = moduleData->function( _kernel->name(), "evaluatePixel" );
+    SHIVA_ASSERT( ePFunctions );
+    GTLCore::Function* ePFunction = ePFunctions->front();
     unsigned int countArguments = ePFunction->parameters().size();
     
   // Create the list of parameters for the evaluatePixel function

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.cpp	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.cpp	2009-04-11 15:29:25 UTC (rev 723)
@@ -191,6 +191,7 @@
     std::list<GTLCore::Function*> functions = library->functions();
     foreach( GTLCore::Function* function, functions )
     {
+      SHIVA_DEBUG(function->name());
       GTLCore::Function* newFunction = GTLCore::Function::Private::createExternalFunction( d->moduleData, function );
       declareFunction( newFunction->name(), newFunction );
       functionsToDelete().push_back( newFunction );

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp	2009-04-11 15:29:25 UTC (rev 723)
@@ -85,10 +85,10 @@
   // Create the generateEvaluatePixeles LLVM function
   d->evaluatePixelesFunction = CodeGenerator::generateEvaluatePixeles( this, Library::d->count_channels_generic );
   // Call evaluateDepends as needed
-  GTLCore::Function* evaluateDependentsFunc = Library::d->m_moduleData->function( name(), "evaluateDependents");
-  if( evaluateDependentsFunc )
+  const std::list<GTLCore::Function*>* evaluateDependentsFuncs = Library::d->m_moduleData->function( name(), "evaluateDependents");
+  if( evaluateDependentsFuncs )
   {
-
+    GTLCore::Function* evaluateDependentsFunc = evaluateDependentsFuncs->front();
     void (*func)() = (void (*)())GTLCore::VirtualMachine::instance()->getPointerToFunction( evaluateDependentsFunc, 0 );
     (*func)();
   }
@@ -129,8 +129,9 @@
 int Kernel::runTest() const
 {
   SHIVA_ASSERT( isCompiled() );
-  const GTLCore::Function* f = Library::d->m_moduleData->function( name(), "runTest");
-  SHIVA_ASSERT( f );
+  const std::list<GTLCore::Function*>* fs = Library::d->m_moduleData->function( name(), "runTest");
+  SHIVA_ASSERT( fs );
+  GTLCore::Function* f = fs->front();
   GTLCore::Value v = f->call( std::vector< GTLCore::Value >() );
   return v.asInt32();
 }
@@ -142,7 +143,9 @@
 
 GTLCore::Region Kernel::needed( GTLCore::Region output_region, int input_index, const std::list< GTLCore::Region>& input_DOD)
 {
-  GTLCore::Function* neededFunction = Library::d->m_moduleData->function( name(),"needed");
+  const std::list<GTLCore::Function*>* neededFunctions = Library::d->m_moduleData->function( name(),"needed");
+  GTL_ASSERT( neededFunctions );
+  GTLCore::Function* neededFunction = neededFunctions->front();
   RegionWrap* (*func)( RegionWrap*, int, ArrayWrap* ) = ( RegionWrap* (*)( RegionWrap*, int, ArrayWrap* ) )GTLCore::VirtualMachine::instance()->getPointerToFunction( neededFunction, 3);
   RegionWrap* rwrap = (*func)( regionToRegionWrap( output_region ), input_index, regionListToArrayWrap( input_DOD ) );
   
@@ -158,7 +161,9 @@
 
 GTLCore::Region Kernel::changed( GTLCore::Region changed_input_region, int input_index, const std::list< GTLCore::Region>& input_DOD)
 {
-  GTLCore::Function* changedFunction = Library::d->m_moduleData->function( name(), "changed");
+  const std::list<GTLCore::Function*>* changedFunctions = Library::d->m_moduleData->function( name(), "changed");
+  GTL_ASSERT(changedFunctions);
+  GTLCore::Function* changedFunction = changedFunctions->front();
   RegionWrap* (*func)( RegionWrap*, int, ArrayWrap* ) = ( RegionWrap* (*)( RegionWrap*, int, ArrayWrap* ) )GTLCore::VirtualMachine::instance()->getPointerToFunction( changedFunction, 3);
   ArrayWrap* aw = regionListToArrayWrap( input_DOD );
   RegionWrap* rwrap = (*func)( regionToRegionWrap( changed_input_region ), input_index, aw ); // TODO leak
@@ -176,15 +181,16 @@
 
 GTLCore::Region Kernel::generated()
 {
- GTLCore::Function* f = Library::d->m_moduleData->function( name(), "generated");
- SHIVA_ASSERT( f );
+  const std::list<GTLCore::Function*>*  fs = Library::d->m_moduleData->function( name(), "generated");
+  SHIVA_ASSERT( fs );
+  GTLCore::Function* f = fs->front();
 
- RegionWrap* (*func)() = (RegionWrap* (*)())GTLCore::VirtualMachine::instance()->getPointerToFunction( f, 0 );
- 
- RegionWrap* rwrap = (*func)();
- GTLCore::Region region = regionWrapToRegion( rwrap );
- gtlFree( rwrap );
- return region;
+  RegionWrap* (*func)() = (RegionWrap* (*)())GTLCore::VirtualMachine::instance()->getPointerToFunction( f, 0 );
+  
+  RegionWrap* rwrap = (*func)();
+  GTLCore::Region region = regionWrapToRegion( rwrap );
+  gtlFree( rwrap );
+  return region;
 }
 
 bool Kernel::hasGeneratedFunction() const

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Kernel_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Kernel_p.cpp	2009-04-11 13:53:23 UTC (rev 722)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Kernel_p.cpp	2009-04-11 15:29:25 UTC (rev 723)
@@ -55,7 +55,9 @@
 void Kernel::Private::determineTypes()
 {
   m_inputsTypes.clear();
-  GTLCore::Function* ePFunction = self->Library::d->m_moduleData->function( self->name(), "evaluatePixel" );
+  const std::list<GTLCore::Function*>*  ePFunctions = self->Library::d->m_moduleData->function( self->name(), "evaluatePixel" );
+  GTL_ASSERT(ePFunctions);
+  GTLCore::Function* ePFunction = ePFunctions->front();
   bool hasOutput = false;
   foreach( GTLCore::Parameter arg, ePFunction->parameters() )
   {


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/