diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2007-09-20 22:59:26 +0200 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2007-09-20 22:59:26 +0200 |
commit | e95d66c3148a64b6fe1a6b2aa940ecc41867ce4a (patch) | |
tree | 3e0c8b6b4c450647284fc6dede17d82dfc4b9d7d /Objective-C | |
parent | 07272baa7e714d2f1c2f1a7ba63bfc2317967fab (diff) |
Fix the coercion rules for FLOAT and BOOLEAN values.
darcs-hash:d24e207d8f1e0357c8a63ec058ec61318675e89f
Diffstat (limited to 'Objective-C')
-rw-r--r-- | Objective-C/libobjcl.h | 8 | ||||
-rw-r--r-- | Objective-C/libobjcl.m | 18 |
2 files changed, 26 insertions, 0 deletions
diff --git a/Objective-C/libobjcl.h b/Objective-C/libobjcl.h index a912748..8b37609 100644 --- a/Objective-C/libobjcl.h +++ b/Objective-C/libobjcl.h @@ -94,3 +94,11 @@ objcl_object_get_meta_class (id obj); id objcl_get_nil (void); + +/* In principle, we do not know whether a BOOL fits into a long. In + practise, it is very likely. */ +long +objcl_get_yes (); + +long +objcl_get_no (); diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m index eaffb8c..15855ed 100644 --- a/Objective-C/libobjcl.m +++ b/Objective-C/libobjcl.m @@ -457,3 +457,21 @@ objcl_get_nil (void) { return nil; } + + +long +objcl_get_yes () +{ + if (sizeof (YES) > sizeof (long)) + fprintf (stderr, "WARNING: objcl_get_yes: YES might not fit into a long.\n"); + return YES; +} + + +long +objcl_get_no () +{ + if (sizeof (NO) > sizeof (long)) + fprintf (stderr, "WARNING: objcl_get_no: NO might not fit into a long.\n"); + return NO; +} |