# HG changeset patch
# User lbessard
# Date 1169126304 -3600
# Node ID 94212a58c097bbccaf179aa08e82500d73617b2f
# Parent  94c8205229948f56af196dcdfe95b47d246fc99c
gen_cfile.py modified for avoiding possible conflict in mapped variable names

diff -r 94c820522994 -r 94212a58c097 objdictgen/gen_cfile.py
--- a/objdictgen/gen_cfile.py	Thu Jan 11 11:08:56 2007 +0100
+++ b/objdictgen/gen_cfile.py	Thu Jan 18 14:18:24 2007 +0100
@@ -222,6 +222,7 @@
                     strIndex += "                    };\n"
             else:
                 
+                texts["parent"] = FormatName(entry_infos["name"])
                 # Entry type is ARRAY
                 for subIndex, value in enumerate(values):
                     texts["subIndex"] = subIndex
@@ -243,13 +244,12 @@
                             texts["comment"] = "\t// %s"%str(value)
                         texts["name"] = FormatName(subentry_infos["name"])
                         if index in variablelist:
-                            strDeclareHeader += "extern %(subIndexType)s %(name)s%(suffixe)s;\t\t// Mapped at index 0x%(index)04X, subindex 0x%(subIndex)02X\n"%texts
-                            mappedVariableContent += "%(subIndexType)s %(name)s%(suffixe)s = %(value)s;\t\t// Mapped at index 0x%(index)04X, subindex 0x%(subIndex)02X\n"%texts
+                            strDeclareHeader += "extern %(subIndexType)s %(parent)s_%(name)s%(suffixe)s;\t\t// Mapped at index 0x%(index)04X, subindex 0x%(subIndex)02X\n"%texts
+                            mappedVariableContent += "%(subIndexType)s %(parent)s_%(name)s%(suffixe)s = %(value)s;\t\t// Mapped at index 0x%(index)04X, subindex 0x%(subIndex)02X\n"%texts
                         else:
                             strIndex += "                    %(subIndexType)s %(NodeName)s_obj%(index)04X_%(name)s%(suffixe)s = %(value)s;%(comment)s\n"%texts
                 if callbacks:
-                    texts["name"] = FormatName(entry_infos["name"])
-                    strDeclareHeader += "extern ODCallback_t %(name)s_callbacks[];\t\t// Callbacks of index0x%(index)04X\n"%texts
+                    strDeclareHeader += "extern ODCallback_t %(parent)s_callbacks[];\t\t// Callbacks of index0x%(index)04X\n"%texts
         
         # Generating Dictionary C++ entry
         if callbacks: