[opengtl-commits] [620] fix LightParser with real word kernel with more than one function, and with function body

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


Revision: 620
Author:   cyrille
Date:     2009-03-14 14:47:19 +0100 (Sat, 14 Mar 2009)

Log Message:
-----------
fix LightParser with real word kernel with more than one function, and with function body

Modified Paths:
--------------
    trunk/OpenGTL/OpenShiva/OpenShiva/LightParser_p.cpp
    trunk/OpenGTL/OpenShiva/tests/library/TestSource.h


Modified: trunk/OpenGTL/OpenShiva/OpenShiva/LightParser_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/LightParser_p.cpp	2009-03-14 13:13:47 UTC (rev 619)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/LightParser_p.cpp	2009-03-14 13:47:19 UTC (rev 620)
@@ -98,9 +98,11 @@
         case GTLCore::Token::DEPENDENT:
         case GTLCore::Token::CONST:
           eatUntil(GTLCore::Token::SEMI, GTLCore::Token::SEMI);
+          getNextToken(); // eath the ';'
           break;
         case GTLCore::Token::STRUCT:
           eatUntil(GTLCore::Token::ENDBRACE, GTLCore::Token::ENDBRACE);
+          getNextToken(); // eat the '}'
           getNextToken(); // eat the ';'
           break;
         default:
@@ -159,10 +161,18 @@
                     d->inputImageTypes.push_back(image);
                   }
                   eatUntil( GTLCore::Token::ENDBRACE, GTLCore::Token::COMA );
+                  if(currentToken().type == GTLCore::Token::COMA )
+                  {
+                    getNextToken(); // eat the ','
+                  }
+                } else {
+                  getNextToken();
                 }
               }
+              getNextToken(); // eat the ')'
             } else {
               eatUntil( GTLCore::Token::ENDBRACKET, GTLCore::Token::ENDBRACKET );
+              getNextToken(); // eath the ')'
             }
             eatLoopOf( GTLCore::Token::STARTBRACE, GTLCore::Token::ENDBRACE );
           }
@@ -181,7 +191,6 @@
   {
     getNextToken();
   }
-  getNextToken();
 }
 
 void LightParser::eatLoopOf( GTLCore::Token::Type start, GTLCore::Token::Type end)

Modified: trunk/OpenGTL/OpenShiva/tests/library/TestSource.h
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/library/TestSource.h	2009-03-14 13:13:47 UTC (rev 619)
+++ trunk/OpenGTL/OpenShiva/tests/library/TestSource.h	2009-03-14 13:47:19 UTC (rev 620)
@@ -43,8 +43,19 @@
       {
         GTLCore::String sourceCodeFilter = "\
   kernel myFilter { \
+    float length( float2 v) \
+    { \
+      v *= v; \
+      return sqrt( v[0] + v[1] ); \
+    } \
     void evaluatePixel(image2 im1, out pixel3 result) \
-    { } \
+    { \
+      im1 = result; \
+    } \
+    region changed(region changed_input_region, int input_index, region input_DOD[]) \
+    { \
+      return changed_input_region; \
+    } \
   }";
         OpenShiva::Source sourceFilter;
         sourceFilter.setSource(sourceCodeFilter);


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