This patch adds the component prefix to EXTRA_SETUP in comp. This allows you to easily create pins in the EXTRA_SETUP function.

the EXTRA_SETUP() function now becomes:
static int extra_setup(struct state *inst, char *prefix, long extra_arg)

where prefix is the component prefix, e.g. 'mycomponent.0' or 'mycomponentname' if you are using names.

I have tested this by running make on the trunk and it doesn't appear to break any existing comps.

Les
>From cdea0276fd2453726218c6e0e5c8a81675ef8bb9 Mon Sep 17 00:00:00 2001
From: Les Newell <[email protected]>
Date: Fri, 17 Jul 2009 11:03:23 +0100
Subject: [PATCH] Changed EXTRA_SETUP() in comp to include the prefix
 This allows you to create your own pins in EXTRA_SETUP()

---
 src/hal/utils/comp.g |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/hal/utils/comp.g b/src/hal/utils/comp.g
index e714c26..b0f4b36 100644
--- a/src/hal/utils/comp.g
+++ b/src/hal/utils/comp.g
@@ -337,7 +337,7 @@ static int comp_id;
 
     print >>f, "static int get_data_size(void);"
     if options.get("extra_setup"):
-        print >>f, "static int extra_setup(struct state *inst, long extra_arg);"
+        print >>f, "static int extra_setup(struct state *inst, char *prefix, long extra_arg);"
     if options.get("extra_cleanup"):
         print >>f, "static void extra_cleanup(void);"
 
@@ -366,7 +366,7 @@ static int comp_id;
     if has_personality:
         print >>f, "    inst->_personality = personality;"
     if options.get("extra_setup"):
-        print >>f, "    r = extra_setup(inst, extra_arg);"
+        print >>f, "    r = extra_setup(inst, prefix, extra_arg);"
 	print >>f, "    if(r != 0) return r;"
     if has_personality:
         print >>f, "    personality = inst->_personality;"
@@ -557,7 +557,7 @@ static int comp_id;
         print >>f, "#undef FUNCTION"
         print >>f, "#define FUNCTION(name) static void name(struct state *inst, long period)"
         print >>f, "#undef EXTRA_SETUP"
-        print >>f, "#define EXTRA_SETUP() static int extra_setup(struct state *inst, long extra_arg)"
+        print >>f, "#define EXTRA_SETUP() static int extra_setup(struct state *inst, char *prefix, long extra_arg)"
         print >>f, "#undef EXTRA_CLEANUP"
         print >>f, "#define EXTRA_CLEANUP() static void extra_cleanup(void)"
         print >>f, "#undef fperiod"
-- 
1.5.4.3

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to