changeset 27:7f879b938ead

Added Patch #include
author lionel auroux <lionel.auroux@gmail.com>
date Sat, 07 Jan 2012 20:46:46 +0100
parents ecf2a0e61fff
children ed3247946305
files include_in_template_chunks.patch series
diffstat 2 files changed, 94 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include_in_template_chunks.patch	Sat Jan 07 20:46:46 2012 +0100
@@ -0,0 +1,93 @@
+# HG changeset patch
+# Parent 33bf887e240c8c5aa843193ac5ec24663dc7eb8b
+Add #include in template chunks
+
+diff --git a/rathaxes/compiler/rtxParse/rtx.cwp b/rathaxes/compiler/rtxParse/rtx.cwp
+--- a/rathaxes/compiler/rtxParse/rtx.cwp
++++ b/rathaxes/compiler/rtxParse/rtx.cwp
+@@ -1,11 +1,22 @@
+ #include "cnorm.cwp"
+ 
++#ignore["rathaxes"] ::= 
++[
++	["//" ->[['\r']? '\n']]
++	| ["/*" ->"*/"]
++	| ' '
++	| '\t'
++	| '\n'
++	| '\r'
++	| '\f' // form feed, sometimes Windows kernel headers have this character.
++]+:skip
++;
+ /* root of grammar */
+ #overload
+ translation_unit ::=
+     => traceLine("PARSE!");
+     #try
+-        #ignore
++        #ignore("rathaxes")
+         #check(cnormNodeRoot(this))
+         [
+             rtx_declaration(this)
+diff --git a/rathaxes/compiler/rtxParse/rtxBack.cwp b/rathaxes/compiler/rtxParse/rtxBack.cwp
+--- a/rathaxes/compiler/rtxParse/rtxBack.cwp
++++ b/rathaxes/compiler/rtxParse/rtxBack.cwp
+@@ -189,7 +189,32 @@
+     /* The two following lines prevent artefacts (by failing previous alternative) */
+     =>clearVariable(theBody);
+     #check(cnormNodeBlock(theBody))
+-    compound_statement(theBody)
++    rtx_chunk_compound_statement(theBody)
++;
++
++rtx_chunk_compound_statement(theBlock : node) ::=
++'{'
++/**/	#check(cnormNodeBlock(theBlock, true))
++	rtx_chunk_block_item_list(theBlock) 
++'}'
++;
++
++rtx_chunk_block_item_list(theBlock : node) ::=
++[
++	line_of_code(theBlock)
++        | '#' 
++        [// TODO: Add Define with chunks variables detections/substitutions
++        "include" 
++                [
++                ['"' -> '"' | '<' -> '>' ]:sFile
++                ]
++/**/    #pushItem(theBlock.block)
++/**/    => local lastNode;
++/**/	#check(cnormNodeBlock_GetLastNode(theBlock, lastNode))
++/**/    => local sData = "\n#include " + sFile + " \n";
++/**/    => cnormNode_Raw(lastNode, sData);
++        ]
++]*
+ ;
+  
+ rtx_stmt<"chunk">(theBlock : node) ::=
+diff --git a/rathaxes/compiler/rtxTpl/rtxIntrospect.inc.cws b/rathaxes/compiler/rtxTpl/rtxIntrospect.inc.cws
+--- a/rathaxes/compiler/rtxTpl/rtxIntrospect.inc.cws
++++ b/rathaxes/compiler/rtxTpl/rtxIntrospect.inc.cws
+@@ -469,6 +469,10 @@
+  * Expression type code introspection function
+  *
+  */
++function rtxIntrospect_expr<"__raw__">(local_node : node, theChunk : node, blockIds : node)
++{/*nothing to do*/
++}
++
+ function rtxIntrospect_expr<"__terminal__">(local_node : node, theChunk : node,
+                                             blockIds : node)
+ {
+diff --git a/rathaxes/samples/helloworld/main.blt b/rathaxes/samples/helloworld/main.blt
+--- a/rathaxes/samples/helloworld/main.blt
++++ b/rathaxes/samples/helloworld/main.blt
+@@ -44,7 +44,6 @@
+     {
+         chunk Main::include_headers
+         {
+-            /* Won't be printed because # is not supported yet */
+             #include <stdlib.h>
+             typedef int stdlib_include_stamp;
+         }
--- a/series	Sat Jan 07 12:46:45 2012 +0100
+++ b/series	Sat Jan 07 20:46:46 2012 +0100
@@ -3,3 +3,4 @@
 rathaxes_start_to_implement_pci_stuff_in_the_lkm.patch
 rathaxes_start_to_implement_the_ethernet_subsystem_in_the_lkm.patch
 rathaxes_start_to_implement_sk_buff_in_the_lkm.patch
+include_in_template_chunks.patch