aboutsummaryrefslogtreecommitdiff
path: root/tools/namespacer.py
diff options
context:
space:
mode:
authorAlon Zakai <azakai@mozilla.com>2010-11-06 11:48:23 -0700
committerAlon Zakai <azakai@mozilla.com>2010-11-06 11:48:23 -0700
commit38cf88b3607066a9fa1d3f7ca0518e2bc9844ff6 (patch)
tree9922c65c3a96701ae0a591535990f8bab5cbd67c /tools/namespacer.py
parent906a8745c2a70d3bf797bce28c5c0ba055f8b98a (diff)
working integration test
Diffstat (limited to 'tools/namespacer.py')
-rw-r--r--tools/namespacer.py28
1 files changed, 9 insertions, 19 deletions
diff --git a/tools/namespacer.py b/tools/namespacer.py
index 2fae222d..507c580c 100644
--- a/tools/namespacer.py
+++ b/tools/namespacer.py
@@ -51,25 +51,15 @@ for line in data:
currspace = space
for part in funcparts[:-1]:
currspace = currspace.setdefault(part, {})
- currspace.setdefault(funcparts[-1], []).append((realname,params));
-
-def clean(currspace):
- if type(currspace) is list:
- if len(currspace) == 1:
- return currspace[0][0]
- else:
- ret = {}
- for item in currspace:
- i = str(len(ret)/2)
- ret[i] = item[0]
- ret[i + '_params'] = item[1]
- return ret
- else:
- for key in currspace.keys():
- currspace[key] = clean(currspace[key])
- return currspace
-
-space = clean(space)
+
+ i = 0
+ base = funcparts[-1]
+ while funcparts[-1] in currspace:
+ funcparts[-1] = base + '_' + str(i)
+ currspace[funcparts[-1]] = realname
+ currspace[funcparts[-1] + '_params'] = params
+ if funcparts[-1] == funcparts[-2]:
+ currspace['__alloc__'] = 'function() { return _malloc(_struct_%s___SIZE) }' % funcparts[-1]
def finalize(line):
try: