[opengtl-commits] [479] load libraries in openshiva

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


Revision: 479
Author:   cyrille
Date:     2008-11-16 22:41:52 +0100 (Sun, 16 Nov 2008)

Log Message:
-----------
load libraries in openshiva

Modified Paths:
--------------
    trunk/OpenGTL/OpenCTL/OpenCTL/ModulesManager.cpp
    trunk/OpenGTL/OpenCTL/OpenCTL/ModulesManager.h
    trunk/OpenGTL/OpenGTL/GTLCore/Function.h
    trunk/OpenGTL/OpenGTL/GTLCore/Token_p.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/Token_p.h
    trunk/OpenGTL/OpenShiva/OpenShiva/CMakeLists.txt
    trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.h
    trunk/OpenGTL/OpenShiva/OpenShiva/Lexer_p.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Library.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Library.h
    trunk/OpenGTL/OpenShiva/OpenShiva/Library_p.h
    trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.cpp

Added Paths:
-----------
    trunk/OpenGTL/OpenShiva/OpenShiva/LibrariesManager.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/LibrariesManager.h

Removed Paths:
-------------
    trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.h
    trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager_p.h


Modified: trunk/OpenGTL/OpenCTL/OpenCTL/ModulesManager.cpp
===================================================================
--- trunk/OpenGTL/OpenCTL/OpenCTL/ModulesManager.cpp	2008-11-16 13:23:41 UTC (rev 478)
+++ trunk/OpenGTL/OpenCTL/OpenCTL/ModulesManager.cpp	2008-11-16 21:41:52 UTC (rev 479)
@@ -70,7 +70,7 @@
     if(path.exists() and path.canRead())
     {
       m = new Module( name );
-      registerModule( m );
+      registerModule( name, m );
       m->loadFromFile( path.c_str());
       break;
     }
@@ -79,9 +79,9 @@
   return m;
 }
 
-void ModulesManager::registerModule(Module* m )
+void ModulesManager::registerModule(const GTLCore::String& name, Module* m )
 {
-  d->modules[ m->name() ] = m;
+  d->modules[ name ] = m;
 }
 
 void ModulesManager::addDirectory(const GTLCore::String& directory)

Modified: trunk/OpenGTL/OpenCTL/OpenCTL/ModulesManager.h
===================================================================
--- trunk/OpenGTL/OpenCTL/OpenCTL/ModulesManager.h	2008-11-16 13:23:41 UTC (rev 478)
+++ trunk/OpenGTL/OpenCTL/OpenCTL/ModulesManager.h	2008-11-16 21:41:52 UTC (rev 479)
@@ -63,7 +63,7 @@
       /**
        * This function will register a module for later use.
        */
-      void registerModule(Module* );
+      void registerModule(const GTLCore::String& name, Module* );
       /**
        * Add a directory to the list of directory that get searched for modules.
        */

Modified: trunk/OpenGTL/OpenGTL/GTLCore/Function.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Function.h	2008-11-16 13:23:41 UTC (rev 478)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Function.h	2008-11-16 21:41:52 UTC (rev 479)
@@ -31,6 +31,7 @@
 namespace OpenShiva {
   class CodeGenerator;
   class Wrapper;
+  class Compiler;
 }
 
 namespace GTLCore {
@@ -57,6 +58,7 @@
       friend class OpenShiva::Wrapper;
       friend class CodeGenerator;
       friend class OpenShiva::CodeGenerator;
+      friend class OpenShiva::Compiler;
       friend class VirtualMachine;
       class Data;
     public:

Modified: trunk/OpenGTL/OpenGTL/GTLCore/Token_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Token_p.cpp	2008-11-16 13:23:41 UTC (rev 478)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Token_p.cpp	2008-11-16 21:41:52 UTC (rev 479)
@@ -153,6 +153,8 @@
       return "int4";
     case KERNEL:
       return "kernel";
+    case LIBRARY:
+      return "library";
     case LONG:
       return "long";
     case RETURN:

Modified: trunk/OpenGTL/OpenGTL/GTLCore/Token_p.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Token_p.h	2008-11-16 13:23:41 UTC (rev 478)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Token_p.h	2008-11-16 21:41:52 UTC (rev 479)
@@ -101,6 +101,7 @@
       INT3,
       INT4,
       KERNEL,
+      LIBRARY,
       LONG,
       RETURN,
       SHORT,

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/CMakeLists.txt
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/CMakeLists.txt	2008-11-16 13:23:41 UTC (rev 478)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/CMakeLists.txt	2008-11-16 21:41:52 UTC (rev 479)
@@ -14,6 +14,7 @@
   PixelConvertExpressionFactory_p.cpp
   Kernel_p.cpp
   Library.cpp
+  LibrariesManager.cpp
 # Wrap
   wrappers/ImageWrap_p.cpp
   wrappers/PixelWrap_p.cpp

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.cpp	2008-11-16 13:23:41 UTC (rev 478)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.cpp	2008-11-16 21:41:52 UTC (rev 479)
@@ -28,11 +28,16 @@
 #include "GTLCore/CodeGenerator_p.h"
 #include "GTLCore/ModuleData_p.h"
 #include "GTLCore/ErrorMessage.h"
+#include "GTLCore/Function.h"
 #include "GTLCore/Optimiser_p.h"
 #include "GTLCore/Type.h"
+#include "GTLCore/Macros_p.h"
+#include "GTLCore/Function_p.h"
 
 #include "Debug.h"
 #include "Lexer_p.h"
+#include "Library.h"
+#include "LibrariesManager.h"
 #include "Parser_p.h"
 
 using namespace OpenShiva;
@@ -43,13 +48,17 @@
   GTLCore::CodeGenerator* codeGenerator;
   Lexer* lexer;
   Parser* parser;
+  int channelsNb;
+  bool isKernel;
 };
 
-Compiler::Compiler() : d(new Private)
+Compiler::Compiler( bool _isKernel, int _channelsNb ) : d(new Private)
 {
   d->module = 0;
   d->moduleData = 0;
   d->codeGenerator = 0;
+  d->channelsNb = _channelsNb;
+  d->isKernel = _isKernel;
 }
 
 Compiler::~Compiler()
@@ -57,6 +66,11 @@
   delete d;
 }
 
+bool Compiler::isKernel() const
+{
+  return d->isKernel;
+}
+
 bool Compiler::compile(const GTLCore::String& _sourceCode, const GTLCore::String& _kernelName, GTLCore::ModuleData* _moduleData, GTLCore::String& _nameSpace)
 {
   SHIVA_DEBUG("Compile: " << _kernelName << " : " << _sourceCode);
@@ -144,7 +158,30 @@
 
 bool Compiler::importModule(const GTLCore::String& name)
 {
-  return false;
+  Library* library = LibrariesManager::instance()->loadLibrary( name, d->channelsNb );
+  if( library )
+  {
+    if(not library->isCompiled())
+    {
+      library->compile();
+      if(not library->isCompiled())
+      {
+        SHIVA_DEBUG("Compilation error: " << std::endl << library->compilationErrorsMessage() ); // TODO: report the error
+        appendErrors( library->compilationErrors() );
+        return false;
+      }
+    }
+    d->moduleData->linkWith( library->data()->llvmModule() );
+    // Append the function coming from the imported module
+    std::list<GTLCore::Function*> functions = library->functions();
+    foreach( GTLCore::Function* function, functions )
+    {
+      GTLCore::Function* newFunction = GTLCore::Function::Private::createExternalFunction( d->moduleData, function );
+      declareFunction( newFunction->name(), newFunction );
+      functionsToDelete().push_back( newFunction );
+    }
+  }
+  return library;
 }
 
 GTLCore::TypeManager* Compiler::typeManager()

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.h	2008-11-16 13:23:41 UTC (rev 478)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.h	2008-11-16 21:41:52 UTC (rev 479)
@@ -28,14 +28,18 @@
 }
 
 namespace OpenShiva {
-  
+  /**
+   * @internal
+   * @ingroup OpenShiva
+   */
   class Compiler : public GTLCore::CompilerBase {
     public:
-      Compiler();
+      Compiler( bool _isKernel, int _channelsNb );
       ~Compiler();
       bool compile(const GTLCore::String& _sourceCode, const GTLCore::String& _kernelName, GTLCore::ModuleData* _moduleData, GTLCore::String& _nameSpace);
       bool importModule(const GTLCore::String& name);
       virtual GTLCore::TypeManager* typeManager();
+      bool isKernel() const;
     public:
       GTLCore::AST::Expression* standardConstant( const GTLCore::String& _name );
     private:

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Lexer_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Lexer_p.cpp	2008-11-16 13:23:41 UTC (rev 478)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Lexer_p.cpp	2008-11-16 21:41:52 UTC (rev 479)
@@ -54,6 +54,7 @@
     IDENTIFIER_IS_KEYWORD( "or", OR );
     IDENTIFIER_IS_KEYWORD( "not", NOT );
     IDENTIFIER_IS_KEYWORD( "kernel", KERNEL );
+    IDENTIFIER_IS_KEYWORD( "library", LIBRARY );
     IDENTIFIER_IS_KEYWORD( "bool", BOOL );
     IDENTIFIER_IS_KEYWORD( "bool2", BOOL2 );
     IDENTIFIER_IS_KEYWORD( "bool3", BOOL3 );

Copied: trunk/OpenGTL/OpenShiva/OpenShiva/LibrariesManager.cpp (from rev 477, trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.cpp)
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/LibrariesManager.cpp	                        (rev 0)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/LibrariesManager.cpp	2008-11-16 21:41:52 UTC (rev 479)
@@ -0,0 +1,98 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "LibrariesManager.h"
+
+#include <map>
+
+// LLVM
+#include <llvm/System/Path.h>
+
+#include "Debug.h"
+#include "Library.h"
+
+using namespace OpenShiva;
+
+struct LibrariesManager::Private {
+  std::map<GTLCore::String, Library*> libraries;
+  std::list<GTLCore::String> directories;
+  static LibrariesManager* s_instance;
+  
+};
+
+LibrariesManager* LibrariesManager::Private::s_instance = 0;
+
+LibrariesManager::LibrariesManager() : d(new Private)
+{
+  addDirectory(".");
+}
+
+void LibrariesManager::addDirectory(const GTLCore::String& directory)
+{
+  d->directories.push_back( directory );
+}
+
+Library* LibrariesManager::library(const GTLCore::String& name, int _channelsNb)
+{
+  std::map<GTLCore::String, Library*>::iterator it = d->libraries.find(name);
+  if( it == d->libraries.end())
+  {
+    return 0;
+  }
+  return it->second;
+}
+
+
+Library* LibrariesManager::loadLibrary( const GTLCore::String& name, int _channelsNb)
+{
+  Library* l = library( name, _channelsNb );
+  if(not l )
+  {
+    GTLCore::String sourceName = name + ".shiva";
+    for( std::list<GTLCore::String>::iterator it = d->directories.begin();
+        it != d->directories.end(); ++it )
+    {
+      llvm::sys::Path path( *it );
+      path.appendComponent( sourceName);
+      SHIVA_DEBUG("try " << path.c_str() );
+      if(path.exists() and path.canRead())
+      {
+        l = new Library( false, _channelsNb );
+        registerLibrary( name, l );
+        l->loadFromFile( path.c_str());
+        break;
+      }
+    }
+  }
+  return l;
+}
+
+void LibrariesManager::registerLibrary(const GTLCore::String& name, Library* l)
+{
+  d->libraries[ name ] = l;
+}
+
+LibrariesManager* LibrariesManager::instance()
+{
+  if( not Private::s_instance )
+  {
+    Private::s_instance = new LibrariesManager;
+  }
+  return Private::s_instance;
+}


Property changes on: trunk/OpenGTL/OpenShiva/OpenShiva/LibrariesManager.cpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: trunk/OpenGTL/OpenShiva/OpenShiva/LibrariesManager.h (from rev 477, trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.h)
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/LibrariesManager.h	                        (rev 0)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/LibrariesManager.h	2008-11-16 21:41:52 UTC (rev 479)
@@ -0,0 +1,60 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _OPENSHIVA_LIBRARY_MANAGER_H_
+#define _OPENSHIVA_LIBRARY_MANAGER_H_
+
+#include <GTLCore/String.h>
+
+namespace OpenShiva {
+  class Library;
+  /**
+   * @ingroup OpenShiva
+   */
+  class LibrariesManager {
+    private:
+      LibrariesManager();
+      ~LibrariesManager();
+    public:
+      /**
+       * @return a library if it's already loaded or return 0
+       */
+      Library* library(const GTLCore::String& name, int _channelsNb);
+      /**
+       * Add a directory to the list of directory that get searched for library.
+       */
+      void addDirectory(const GTLCore::String& directory);
+      void registerLibrary(const GTLCore::String& name, Library* );
+      /**
+       * Load a library with the given name.
+       */
+      Library* loadLibrary( const GTLCore::String& directory, int _channelsNb);
+    public:
+      /**
+       * @return the instance to the singleton \ref LibraryManager
+       */
+      static LibrariesManager* instance();
+    private:
+      struct Private;
+      Private* const d;
+  };
+  
+};
+
+#endif


Property changes on: trunk/OpenGTL/OpenShiva/OpenShiva/LibrariesManager.h
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Library.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Library.cpp	2008-11-16 13:23:41 UTC (rev 478)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Library.cpp	2008-11-16 21:41:52 UTC (rev 479)
@@ -55,6 +55,7 @@
   d->moduleProvider = 0;
   d->m_moduleData = 0;
   d->count_channels_generic = _channelsNb;
+  d->isKernel = _isKernel;
 }
 
 Library::~Library()
@@ -114,7 +115,7 @@
   if(d->source.empty()) return;
   cleanup();
   d->m_moduleData = new GTLCore::ModuleData(new llvm::Module(d->name));
-  Compiler c;
+  Compiler c( d->isKernel,  d->count_channels_generic );
   Wrapper::fillTypeManager( d->m_moduleData, d->m_moduleData->typeManager(), c.convertCenter() , d->count_channels_generic );
   GTLCore::String nameSpace;
   bool result = c.compile( d->source, d->name, d->m_moduleData, nameSpace );
@@ -169,3 +170,12 @@
   return d->m_moduleData->asCCode();
 }
 
+const GTLCore::ModuleData* Library::data() const
+{
+  return d->m_moduleData;
+}
+
+std::list<GTLCore::Function*> Library::functions()
+{
+  return d->m_moduleData->functions();
+}

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Library.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Library.h	2008-11-16 13:23:41 UTC (rev 478)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Library.h	2008-11-16 21:41:52 UTC (rev 479)
@@ -24,6 +24,8 @@
 
 namespace GTLCore {
   class ErrorMessage;
+  class ModuleData;
+  class Function;
 }
 
 namespace OpenShiva {
@@ -33,7 +35,7 @@
    */
   class Library {
     friend class Kernel;
-    friend class LibraryManager;
+    friend class LibrariesManager;
       Library( bool _isKernel, int _channelsNb );
       ~Library();
     private:
@@ -76,6 +78,16 @@
        * @return the C source code, it's mostly usefull for testing purpose
        */
       GTLCore::String cSourceCode() const;
+      /**
+       * @return a pointer to the internal Data of this module (the class Module::Data
+       *         is not part of the public API and therefor there is no reason for you
+       *         to use that function).
+       */
+      const GTLCore::ModuleData* data() const;
+      /**
+       * @return the list of functions available in this module.
+       */
+      std::list<GTLCore::Function*> functions();
     private:
       struct Private;
       Private* const d;

Deleted: trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.cpp	2008-11-16 13:23:41 UTC (rev 478)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.cpp	2008-11-16 21:41:52 UTC (rev 479)
@@ -1,32 +0,0 @@
-/*
- *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * either version 2, or (at your option) any later version of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "LibraryManager.h"
-#include "LibraryManager_p.h"
-
-using namespace OpenShiva;
-
-LibraryManager::LibraryManager()
-{
-}
-
-void LibraryManager::addDirectory(const GTLCore::String& directory)
-{
-  
-}

Deleted: trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.h	2008-11-16 13:23:41 UTC (rev 478)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.h	2008-11-16 21:41:52 UTC (rev 479)
@@ -1,49 +0,0 @@
-/*
- *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * either version 2, or (at your option) any later version of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _OPENSHIVA_LIBRARY_MANAGER_H_
-#define _OPENSHIVA_LIBRARY_MANAGER_H_
-
-namespace OpenShiva {
-  /**
-   * @ingroup OpenShiva
-   */
-  class LibraryManager {
-    private:
-      LibraryManager();
-      ~LibraryManager();
-    public:
-      
-      /**
-       * Add a directory to the list of directory that get searched for library.
-       */
-      void addDirectory(const GTLCore::String& directory);
-    public:
-      /**
-       * @return the instance to the singleton \ref LibraryManager
-       */
-      static LibraryManager* instance();
-    private:
-      struct Private;
-      Private* const d;
-  };
-  
-};
-
-#endif

Deleted: trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager_p.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager_p.h	2008-11-16 13:23:41 UTC (rev 478)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager_p.h	2008-11-16 21:41:52 UTC (rev 479)
@@ -1,36 +0,0 @@
-/*
- *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * either version 2, or (at your option) any later version of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _OPENSHIVA_LIBRARY_MANAGER_P_H_
-#define _OPENSHIVA_LIBRARY_MANAGER_P_H_
-
-#include "LibraryManager.h"
-
-namespace OpenShiva {
-
-  struct LibraryManger::Private {
-//   std::map<GTLCore::String, Module*> modules;
-    std::list<GTLCore::String> directories;
-    static LibraryManger* s_instance;
-    
-  };
-
-}
-
-#endif

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Library_p.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Library_p.h	2008-11-16 13:23:41 UTC (rev 478)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Library_p.h	2008-11-16 21:41:52 UTC (rev 479)
@@ -43,6 +43,7 @@
     llvm::ModuleProvider* moduleProvider;
     GTLCore::ModuleData* m_moduleData;
     int count_channels_generic;
+    bool isKernel;
   };
 }
 

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.cpp	2008-11-16 13:23:41 UTC (rev 478)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.cpp	2008-11-16 21:41:52 UTC (rev 479)
@@ -68,7 +68,8 @@
     checkNextTokenIsSemi();
     getNextToken();
   }
-  if(isOfType( currentToken(), GTLCore::Token::KERNEL ) )
+  if( (d->compiler->isKernel() and isOfType( currentToken(), GTLCore::Token::KERNEL ) )
+      or isOfType( currentToken(), GTLCore::Token::LIBRARY ) )
   {
     getNextToken();
     if( isOfType( currentToken(), GTLCore::Token::IDENTIFIER ) )


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