From 20d0dcb2e023206f4e3d5c9d935ef907d989c656 Mon Sep 17 00:00:00 2001
From: Andy Pugh <andy@bodgesoc.org>
Date: Sat, 23 Apr 2011 19:32:14 +0100
Subject: [PATCH 2/2] Allow the use of pointers in "variable" declarations in comp modules.
 Writing Hostmot2 sub-drivers in comp requires that it be possible to create u32
 pointers that can be registered to TRAM. This patch simply allows * as part of
 a variable name (but removes it from the def/undef in the genereated C).
 It is possible to do the same with the "option data" statement and a struct,
 but this might puzzle folk in the future (and is marked as deprecated)

Signed-off-by: Andy Pugh <andy@bodgesoc.org>
---
 src/hal/utils/comp.g |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
 mode change 100644 => 100755 src/hal/utils/comp.g

diff --git a/src/hal/utils/comp.g b/src/hal/utils/comp.g
old mode 100644
new mode 100755
index 7146dc7..b781534
--- a/src/hal/utils/comp.g
+++ b/src/hal/utils/comp.g
@@ -30,7 +30,7 @@ parser Hal:
     token PARAMDIRECTION: "rw|r"
     token PINDIRECTION: "in|out|io"
     token TYPE: "float|bit|signed|unsigned|u32|s32"
-    token NAME: "[a-zA-Z_][a-zA-Z0-9_]*"
+    token NAME: "[a-zA-Z_*][a-zA-Z0-9_*]*"
     token HALNAME: "[#a-zA-Z_][-#a-zA-Z0-9_.]*"
     token FPNUMBER: "-?([0-9]*\.[0-9]+|[0-9]+\.?)([Ee][+-]?[0-9]+)?f?"
     token NUMBER: "0x[0-9a-fA-F]+|[+-]?[0-9]+"
@@ -587,8 +587,8 @@ static int comp_id;
                 print >>f, "#define %s (inst->%s)" % (to_c(name), to_c(name))
 
         for type, name, array, value in variables:
-            print >>f, "#undef %s" % name
-            print >>f, "#define %s (inst->%s)" % (name, name)
+            print >>f, "#undef %s" % name.replace("*","")
+            print >>f, "#define %s (inst->%s)" % (name.replace("*",""), name.replace("*",""))
 
         if has_data:
             print >>f, "#undef data"
-- 
1.7.0.4

