From e95d66c3148a64b6fe1a6b2aa940ecc41867ce4a Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Thu, 20 Sep 2007 22:59:26 +0200 Subject: Fix the coercion rules for FLOAT and BOOLEAN values. darcs-hash:d24e207d8f1e0357c8a63ec058ec61318675e89f --- Objective-C/libobjcl.h | 8 ++++++++ Objective-C/libobjcl.m | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'Objective-C') 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; +} -- cgit v1.2.3