diff options
Diffstat (limited to 'cppawk-include/cons-priv.h')
-rw-r--r-- | cppawk-include/cons-priv.h | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/cppawk-include/cons-priv.h b/cppawk-include/cons-priv.h index 8a57215..3ce5873 100644 --- a/cppawk-include/cons-priv.h +++ b/cppawk-include/cons-priv.h @@ -216,6 +216,7 @@ function __box_str(__str) { return "T" __str } +#define __box_str(str) ("T" (str)) function __box_sym(__name) { @@ -382,16 +383,37 @@ function __slow_equal(__obj1, __obj2, } if (__tc1 == "T") - return __unbox(__obj1) == __obj2; + return __numberp(__obj2) ? 0 : (__obj1 == __box_str(__obj2)) if (__tc2 == "T") - return __obj1 == __unbox(__obj2); + return __numberp(__obj1) ? 0 : (__box_str(__obj1) == __obj2) - if (__numberp(__obj1) && __numberp(__obj2)) { + if (__numberp(__obj1) && __numberp(__obj2)) return __obj1 + 0 == __obj2 + 0 + + return 0 +} + +function __equalize(__obj, + __tc, __str) +{ + if (!__present(__obj)) + return "" + + __tc = __typecode(__obj) + + __case (__tc) { + __of("C") + __cret (__cons(__equalize(__car(__obj)), + __equalize(__cdr(__obj)))) + __of("T", "S", "U", "") + __cret (__obj) } - return 0; + if (__numberp(__obj)) + return __obj + 0 + + return __box_str(__obj) } function __pack(__stk, __item) |