summaryrefslogtreecommitdiff
path: root/codegen.py
diff options
context:
space:
mode:
authorMichael Bridgen <mikeb@lshift.net>2010-08-01 23:00:44 +0100
committerMichael Bridgen <mikeb@lshift.net>2010-08-01 23:00:44 +0100
commitb5a6465dd30da72a30d0027d3da79afbbcbab4f9 (patch)
treea5615135bcf2dab8f04f2eac4b2e14f4da27ad3b /codegen.py
parent357b7dad9e68c8f8799f0bf23501368cfaef94d7 (diff)
parentdf11cdaf73e3d984a40d719ad170cabc6f24c5ba (diff)
downloadrabbitmq-server-bug14647.tar.gz
Merge default to get json filename changesbug14647
Diffstat (limited to 'codegen.py')
-rw-r--r--codegen.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/codegen.py b/codegen.py
index 1244aae1..230d785e 100644
--- a/codegen.py
+++ b/codegen.py
@@ -315,11 +315,16 @@ def genErl(spec):
methods = spec.allMethods()
printFileHeader()
- print """-module(rabbit_framing).
--include("rabbit_framing.hrl").
-
+ module = "rabbit_framing_amqp_%d_%d" % (spec.major, spec.minor)
+ if spec.revision != 0:
+ module = "%s_%d" % (module, spec.revision)
+ if module == "rabbit_framing_amqp_8_0":
+ module = "rabbit_framing_amqp_0_8"
+ print "-module(%s)." % module
+ print """-include("rabbit_framing.hrl").
+
+-export([version/0]).
-export([lookup_method_name/1]).
-
-export([method_id/1]).
-export([method_has_content/1]).
-export([is_method_synchronous/1]).
@@ -395,6 +400,7 @@ def genErl(spec):
print """
%% Method signatures
-ifdef(use_specs).
+-spec(version/0 :: () -> {non_neg_integer(), non_neg_integer(), non_neg_integer()}).
-spec(lookup_method_name/1 :: (amqp_method()) -> amqp_method_name()).
-spec(method_id/1 :: (amqp_method_name()) -> amqp_method()).
-spec(method_has_content/1 :: (amqp_method_name()) -> boolean()).
@@ -413,6 +419,10 @@ bitvalue(true) -> 1;
bitvalue(false) -> 0;
bitvalue(undefined) -> 0.
"""
+ version = "{%d, %d, %d}" % (spec.major, spec.minor, spec.revision)
+ if version == '{8, 0, 0}': version = '{0, 8, 0}'
+ print "version() -> %s." % (version)
+
for m in methods: genLookupMethodName(m)
print "lookup_method_name({_ClassId, _MethodId} = Id) -> exit({unknown_method_id, Id})."
@@ -471,8 +481,6 @@ def genHrl(spec):
methods = spec.allMethods()
printFileHeader()
- print "-define(PROTOCOL_VERSION_MAJOR, %d)." % (spec.major)
- print "-define(PROTOCOL_VERSION_MINOR, %d)." % (spec.minor)
print "-define(PROTOCOL_PORT, %d)." % (spec.port)
for (c,v,cls) in spec.constants: