[opengtl-commits] [191] add a function to kernels that allows to test the shiva programming language

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


Revision: 191
Author:   cyrille
Date:     2008-06-14 11:06:21 +0200 (Sat, 14 Jun 2008)

Log Message:
-----------
add a function to kernels that allows to test the shiva programming language

Modified Paths:
--------------
    trunk/OpenGTL/OpenShiva/CMakeLists.txt
    trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.h


Modified: trunk/OpenGTL/OpenShiva/CMakeLists.txt
===================================================================
--- trunk/OpenGTL/OpenShiva/CMakeLists.txt	2008-06-13 22:48:58 UTC (rev 190)
+++ trunk/OpenGTL/OpenShiva/CMakeLists.txt	2008-06-14 09:06:21 UTC (rev 191)
@@ -2,6 +2,7 @@
 
 set(SHIVAC "${CMAKE_CURRENT_BINARY_DIR}/tools/compiler/shivac")
 set(SHIVAI "${CMAKE_CURRENT_BINARY_DIR}/tools/interpreter/shivai")
+set(SHIVATESTER "${CMAKE_CURRENT_BINARY_DIR}/tools/tester/shivatester")
 
 
 set(OPENSHIVA_VERSION ${OPENGTL_VERSION})

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp	2008-06-13 22:48:58 UTC (rev 190)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp	2008-06-14 09:06:21 UTC (rev 191)
@@ -26,9 +26,11 @@
 #include <llvm/ModuleProvider.h>
 
 #include "GTLCore/ErrorMessage.h"
+#include "GTLCore/Function.h"
 #include "GTLCore/ModuleData_p.h"
 #include "GTLCore/PixelDescription.h"
 #include "GTLCore/Type.h"
+#include "GTLCore/Value.h"
 #include "GTLCore/VirtualMachine_p.h"
 
 #include "Debug.h"
@@ -144,6 +146,15 @@
   
 }
 
+int Kernel::runTest() const
+{
+  SHIVA_ASSERT( isCompiled() );
+  const GTLCore::Function* f = d->moduleData->function( "MyKernel", "runTest");
+  SHIVA_ASSERT( f );
+  GTLCore::Value v = f->call( std::vector< GTLCore::Value >() );
+  return v.asInt32();
+}
+
 GTLCore::String Kernel::compilationErrorsMessage() const
 {
   std::ostringstream os;

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.h	2008-06-13 22:48:58 UTC (rev 190)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.h	2008-06-14 09:06:21 UTC (rev 191)
@@ -79,7 +79,10 @@
       GTLCore::String asmSourceCode() const;
     public: // Function call
       void evaluatePixel( const std::list< AbstractImage* >& _inputImages, AbstractImage* _outputImage) const;
-      
+      /**
+       * Run the function called "int runTest()" in the Kernel.
+       */
+      int runTest() const;
     private:
       struct Private;
       Private * const d;


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