[opengtl-commits] [478] Start working on importing libraries: |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 478
Author: cyrille
Date: 2008-11-16 14:23:41 +0100 (Sun, 16 Nov 2008)
Log Message:
-----------
Start working on importing libraries:
* add an import test
* parse the import keyword
Modified Paths:
--------------
trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.cpp
trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.h
trunk/OpenGTL/OpenShiva/OpenShiva/Library.h
trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.cpp
trunk/OpenGTL/OpenShiva/tests/parse/CMakeLists.txt
Added Paths:
-----------
trunk/OpenGTL/OpenShiva/tests/parse/import.shiva
trunk/OpenGTL/OpenShiva/tests/parse/library.shiva
Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.cpp 2008-11-14 23:40:26 UTC (rev 477)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.cpp 2008-11-16 13:23:41 UTC (rev 478)
@@ -142,6 +142,11 @@
return mod;
}
+bool Compiler::importModule(const GTLCore::String& name)
+{
+ return false;
+}
+
GTLCore::TypeManager* Compiler::typeManager()
{
return d->moduleData->typeManager();
Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.h 2008-11-14 23:40:26 UTC (rev 477)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.h 2008-11-16 13:23:41 UTC (rev 478)
@@ -34,6 +34,7 @@
Compiler();
~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();
public:
GTLCore::AST::Expression* standardConstant( const GTLCore::String& _name );
Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Library.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Library.h 2008-11-14 23:40:26 UTC (rev 477)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Library.h 2008-11-16 13:23:41 UTC (rev 478)
@@ -27,6 +27,10 @@
}
namespace OpenShiva {
+ /**
+ *
+ * @ingroup OpenShiva
+ */
class Library {
friend class Kernel;
friend class LibraryManager;
Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.cpp 2008-11-14 23:40:26 UTC (rev 477)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.cpp 2008-11-16 13:23:41 UTC (rev 478)
@@ -37,7 +37,7 @@
struct Parser::Private {
GTLCore::String kernelName;
GTLCore::AST::Tree* tree;
- GTLCore::CompilerBase* compiler;
+ Compiler* compiler;
};
Parser::Parser( Compiler* _compiler , Lexer* _lexer) : ParserBase(_compiler, _lexer), d(new Private)
@@ -58,6 +58,16 @@
d->tree = new GTLCore::AST::Tree();
variablesManager()->startContext();
getNextToken();
+ while( currentToken().type == GTLCore::Token::IMPORT )
+ {
+ getNextToken();
+ if( isOfType( currentToken(), GTLCore::Token::STRING_CONSTANT ) )
+ {
+ d->compiler->importModule( currentToken().string );
+ }
+ checkNextTokenIsSemi();
+ getNextToken();
+ }
if(isOfType( currentToken(), GTLCore::Token::KERNEL ) )
{
getNextToken();
Modified: trunk/OpenGTL/OpenShiva/tests/parse/CMakeLists.txt
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/parse/CMakeLists.txt 2008-11-14 23:40:26 UTC (rev 477)
+++ trunk/OpenGTL/OpenShiva/tests/parse/CMakeLists.txt 2008-11-16 13:23:41 UTC (rev 478)
@@ -3,10 +3,11 @@
kernel.shiva
for.shiva
region.shiva
+ import.shiva
)
FOREACH( TEST_FILE ${TESTS_FILES} )
- ADD_TEST(${TEST_FILE} ${SHIVAC} ${CMAKE_CURRENT_SOURCE_DIR}/${TEST_FILE})
+ ADD_TEST(${TEST_FILE} ${SHIVAC} -L ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${TEST_FILE})
ENDFOREACH( TEST_FILE )
# set( TESTS_FAIL_FILES
Added: trunk/OpenGTL/OpenShiva/tests/parse/import.shiva
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/parse/import.shiva (rev 0)
+++ trunk/OpenGTL/OpenShiva/tests/parse/import.shiva 2008-11-16 13:23:41 UTC (rev 478)
@@ -0,0 +1,9 @@
+import "library";
+
+kernel Import
+{
+ void evaluatePixel(output pixel result)
+ {
+
+ }
+}
Added: trunk/OpenGTL/OpenShiva/tests/parse/library.shiva
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/parse/library.shiva (rev 0)
+++ trunk/OpenGTL/OpenShiva/tests/parse/library.shiva 2008-11-16 13:23:41 UTC (rev 478)
@@ -0,0 +1,3 @@
+library Library {
+
+}