summaryrefslogtreecommitdiff
path: root/codegen.py
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2010-06-09 12:37:58 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2010-06-09 12:37:58 +0100
commitc333d8475087106e17905a61b9662aa55fae1d2e (patch)
tree0c4635f528642f691a67393ef956c612bd60a4a5 /codegen.py
parent19ec7d0a82fb62a74582be54c3dfa8512583311b (diff)
downloadrabbitmq-server-c333d8475087106e17905a61b9662aa55fae1d2e.tar.gz
enclosed generated specs in -ifdefs
Diffstat (limited to 'codegen.py')
-rw-r--r--codegen.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/codegen.py b/codegen.py
index 86d10f39..1e20f99a 100644
--- a/codegen.py
+++ b/codegen.py
@@ -425,6 +425,7 @@ def genHrl(spec):
print "-record('P_%s', {%s})." % (erlangize(c.name), fieldNameList(c.fields))
print "%% Various types"
+ print "-ifdef(use_specs)."
print prettyType("amqp_method_name()",
[m.erlangName() for m in methods])
print prettyType("amqp_method()",
@@ -444,17 +445,15 @@ def genHrl(spec):
["'%s'" % erlangConstantName(c).lower() for (c, v, cls) in spec.constants])
print prettyType("amqp_exception_code()",
["%i" % v for (c, v, cls) in spec.constants])
- # classIds = set()
- # for m in methods:
- # classIds.add(m.klass.index)
- # print prettyType("amqp_class_id()",
- # ["%i" % ci for ci in classIds])
+ print "-endif. % use_specs"
def genSpec(spec):
methods = spec.allMethods()
printFileHeader()
print """% Hard-coded types
+-ifdef(use_specs).
+
-type(amqp_field_type() ::
'longstr' | 'signedint' | 'decimal' | 'timestamp' |
'table' | 'byte' | 'double' | 'float' | 'long' |
@@ -487,6 +486,8 @@ def genSpec(spec):
print prettyType("amqp_class_id()",
["%i" % ci for ci in classIds])
+ print "-endif. % use_specs"
+
def generateErl(specPath):
genErl(AmqpSpec(specPath))