summaryrefslogtreecommitdiff
path: root/codegen.py
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2010-02-17 15:56:38 +0000
committerMatthew Sackman <matthew@lshift.net>2010-02-17 15:56:38 +0000
commit7fc3228a0ede49b24ec8b1ce90433e05577c701b (patch)
tree8d18b06be0acbe541ec92636c34dede2b5491068 /codegen.py
parent756aef9f9f8b4995352bbe62a57b44e0284a9448 (diff)
downloadrabbitmq-server-7fc3228a0ede49b24ec8b1ce90433e05577c701b.tar.gz
Add support for extracting field names for class properties
Diffstat (limited to 'codegen.py')
-rw-r--r--codegen.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/codegen.py b/codegen.py
index 91c70e81..d3b70d6c 100644
--- a/codegen.py
+++ b/codegen.py
@@ -291,6 +291,9 @@ def genErl(spec):
print 'amqp_exception(?%s) -> %s;' % \
(n, n.lower())
+ def genClassPropsFieldnames(cls):
+ print "class_properties_fieldnames('P_%s') -> %s;" % (erlangize(cls.name), fieldNameList(cls.fields))
+
methods = spec.allMethods()
printFileHeader()
@@ -310,6 +313,7 @@ def genErl(spec):
-export([encode_properties/1]).
-export([lookup_amqp_exception/1]).
-export([amqp_exception/1]).
+-export([class_properties_fieldnames/1]).
bitvalue(true) -> 1;
bitvalue(false) -> 0;
@@ -354,6 +358,9 @@ bitvalue(undefined) -> 0.
for(c,v,cls) in spec.constants: genAmqpException(c,v,cls)
print "amqp_exception(_Code) -> undefined."
+ for c in spec.allClasses(): genClassPropsFieldnames(c)
+ print "class_properties_fieldnames(PropName) -> exit({unknown_class_properties_name, PropName})."
+
def genHrl(spec):
def erlType(domain):
return erlangTypeMap[spec.resolveDomain(domain)]