summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2012-11-03 21:04:32 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2012-11-03 21:04:32 +0000
commitcabb62c333032ec5a1a499e2336d8c6bb10aa580 (patch)
tree8f3eeb751d21276c861dc5cd3da2252295edc350
parent1a583b92379645f98c37be43894649c2f49f62ee (diff)
downloadrabbitmq-server-cabb62c333032ec5a1a499e2336d8c6bb10aa580.tar.gz
ditch superfluous type mapping in codegen
-rw-r--r--codegen.py27
-rw-r--r--src/rabbit_binary_generator.erl6
2 files changed, 9 insertions, 24 deletions
diff --git a/codegen.py b/codegen.py
index 9483e854..68f530c2 100644
--- a/codegen.py
+++ b/codegen.py
@@ -24,18 +24,6 @@ from amqp_codegen import *
import string
import re
-erlangTypeMap = {
- 'octet': 'octet',
- 'shortstr': 'shortstr',
- 'longstr': 'longstr',
- 'short': 'shortint',
- 'long': 'longint',
- 'longlong': 'longlongint',
- 'bit': 'bit',
- 'table': 'table',
- 'timestamp': 'timestamp',
-}
-
# Coming up with a proper encoding of AMQP tables in JSON is too much
# hassle at this stage. Given that the only default value we are
# interested in is for the empty table, we only support that.
@@ -123,7 +111,7 @@ def printFileHeader():
def genErl(spec):
def erlType(domain):
- return erlangTypeMap[spec.resolveDomain(domain)]
+ return erlangize(spec.resolveDomain(domain))
def fieldTypeList(fields):
return '[' + ', '.join([erlType(f.domain) for f in fields]) + ']'
@@ -186,11 +174,11 @@ def genErl(spec):
return p+'Len:32/unsigned, '+p+':'+p+'Len/binary'
elif type == 'octet':
return p+':8/unsigned'
- elif type == 'shortint':
+ elif type == 'short':
return p+':16/unsigned'
- elif type == 'longint':
+ elif type == 'long':
return p+':32/unsigned'
- elif type == 'longlongint':
+ elif type == 'longlong':
return p+':64/unsigned'
elif type == 'timestamp':
return p+':64/unsigned'
@@ -350,8 +338,8 @@ def genErl(spec):
'table' | 'byte' | 'double' | 'float' | 'long' |
'short' | 'bool' | 'binary' | 'void' | 'array').
-type(amqp_property_type() ::
- 'shortstr' | 'longstr' | 'octet' | 'shortint' | 'longint' |
- 'longlongint' | 'timestamp' | 'bit' | 'table').
+ 'shortstr' | 'longstr' | 'octet' | 'short' | 'long' |
+ 'longlong' | 'timestamp' | 'bit' | 'table').
-type(amqp_table() :: [{binary(), amqp_field_type(), amqp_value()}]).
-type(amqp_array() :: [{amqp_field_type(), amqp_value()}]).
@@ -497,9 +485,6 @@ shortstr_size(S) ->
print "amqp_exception(_Code) -> undefined."
def genHrl(spec):
- def erlType(domain):
- return erlangTypeMap[spec.resolveDomain(domain)]
-
def fieldNameList(fields):
return ', '.join([erlangize(f.name) for f in fields])
diff --git a/src/rabbit_binary_generator.erl b/src/rabbit_binary_generator.erl
index 6b6b395a..2ece8696 100644
--- a/src/rabbit_binary_generator.erl
+++ b/src/rabbit_binary_generator.erl
@@ -215,9 +215,9 @@ encode_property(shortstr, String) ->
encode_property(longstr, String) -> Len = size(String),
<<Len:32, String:Len/binary>>;
encode_property(octet, Int) -> <<Int:8/unsigned>>;
-encode_property(shortint, Int) -> <<Int:16/unsigned>>;
-encode_property(longint, Int) -> <<Int:32/unsigned>>;
-encode_property(longlongint, Int) -> <<Int:64/unsigned>>;
+encode_property(short, Int) -> <<Int:16/unsigned>>;
+encode_property(long, Int) -> <<Int:32/unsigned>>;
+encode_property(longlong, Int) -> <<Int:64/unsigned>>;
encode_property(timestamp, Int) -> <<Int:64/unsigned>>;
encode_property(table, Table) -> table_to_binary(Table).