diff options
| author | Vlad Alexandru Ionescu <vlad@rabbitmq.com> | 2010-09-16 16:46:19 +0100 |
|---|---|---|
| committer | Vlad Alexandru Ionescu <vlad@rabbitmq.com> | 2010-09-16 16:46:19 +0100 |
| commit | 4f1c7fdf5107df1ebe16dc239858de39bd7b900f (patch) | |
| tree | fad3e6ad8a84bcddcbee6b9423eadfb86fc7ed6c /codegen.py | |
| parent | 7549aa28632606b314c4f2371900320a5a18d0d9 (diff) | |
| parent | 4e517eae89a3ecfd2b7017b714afaf1c8b5f4969 (diff) | |
| download | rabbitmq-server-git-4f1c7fdf5107df1ebe16dc239858de39bd7b900f.tar.gz | |
merging in from default
Diffstat (limited to 'codegen.py')
| -rw-r--r-- | codegen.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/codegen.py b/codegen.py index 6042e78fcd..4fdbec554f 100644 --- a/codegen.py +++ b/codegen.py @@ -320,9 +320,15 @@ 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([lookup_class_name/1]). @@ -401,13 +407,15 @@ 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()). -spec(is_method_synchronous/1 :: (amqp_method_record()) -> boolean()). -spec(method_record/1 :: (amqp_method_name()) -> amqp_method_record()). -spec(method_fieldnames/1 :: (amqp_method_name()) -> [amqp_method_field_name()]). --spec(decode_method_fields/2 :: (amqp_method_name(), binary()) -> amqp_method_record()). +-spec(decode_method_fields/2 :: + (amqp_method_name(), binary()) -> amqp_method_record() | rabbit_types:connection_exit()). -spec(decode_properties/2 :: (non_neg_integer(), binary()) -> amqp_property_record()). -spec(encode_method_fields/1 :: (amqp_method_record()) -> binary()). -spec(encode_properties/1 :: (amqp_method_record()) -> binary()). @@ -419,6 +427,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})." @@ -480,8 +492,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: |
