summaryrefslogtreecommitdiff
path: root/codegen.py
diff options
context:
space:
mode:
authorDavid R. MacIver <david.maciver@lshift.net>2010-01-22 14:25:31 +0000
committerDavid R. MacIver <david.maciver@lshift.net>2010-01-22 14:25:31 +0000
commit233b3b5efcc74b81aef7b619d807f48efbf07a88 (patch)
tree877d4439b4542e2b63229217280847fac0ac6499 /codegen.py
parent841c0d6da2cd067354a393b0f5be2264137941e1 (diff)
parent3da3fe70f3ca2fcb8debbc23a7a92447b83f555b (diff)
downloadrabbitmq-server-233b3b5efcc74b81aef7b619d807f48efbf07a88.tar.gz
merge of default into amqp_0_9_1. Not quite working yet, but runs and passes some tests
Diffstat (limited to 'codegen.py')
-rw-r--r--codegen.py25
1 files changed, 6 insertions, 19 deletions
diff --git a/codegen.py b/codegen.py
index 52c45a95..3608f4c2 100644
--- a/codegen.py
+++ b/codegen.py
@@ -244,19 +244,10 @@ def genErl(spec):
print 'lookup_amqp_exception(%s) -> {%s, ?%s, <<"%s">>};' % \
(n.lower(), hardErrorBoolStr, n, n)
- def genIsAmqpHardErrorCode(c,v,cls):
- mCls = messageConstantClass(cls)
- if mCls == 'SOFT_ERROR' : genIsAmqpHardErrorCode1(c,'false')
- elif mCls == 'HARD_ERROR' : genIsAmqpHardErrorCode1(c,'true')
- elif mCls == '' : pass
- else: raise 'Unkown constant class', cls
-
- def genIsAmqpHardErrorCode1(c,hardErrorBoolStr):
+ def genAmqpException(c,v,cls):
n = erlangConstantName(c)
- print 'is_amqp_hard_error_code(?%s) -> %s;' % \
- (n, hardErrorBoolStr)
- print 'is_amqp_hard_error_code(%s) -> %s;' % \
- (n.lower(), hardErrorBoolStr)
+ print 'amqp_exception(?%s) -> %s;' % \
+ (n, n.lower())
methods = spec.allMethods()
@@ -274,7 +265,7 @@ def genErl(spec):
-export([encode_method_fields/1]).
-export([encode_properties/1]).
-export([lookup_amqp_exception/1]).
--export([is_amqp_hard_error_code/1]).
+-export([amqp_exception/1]).
bitvalue(true) -> 1;
bitvalue(false) -> 0;
@@ -313,12 +304,8 @@ bitvalue(undefined) -> 0.
print " rabbit_log:warning(\"Unknown AMQP error code '~p'~n\", [Code]),"
print " {true, ?INTERNAL_ERROR, <<\"INTERNAL_ERROR\">>}."
- for(c,v,cls) in spec.constants: genIsAmqpHardErrorCode(c,v,cls)
- print "is_amqp_hard_error_code(Code) when is_integer(Code) ->"
- print " true;"
- print "is_amqp_hard_error_code(Code) ->"
- print " rabbit_log:warning(\"Unknown AMQP error code '~p'~n\", [Code]),"
- print " true."
+ for(c,v,cls) in spec.constants: genAmqpException(c,v,cls)
+ print "amqp_exception(_Code) -> undefined."
def genHrl(spec):
def erlType(domain):