From 9986f6e23e756cc9a3198be6a4f31ca79d847c73 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 10 May 2009 19:01:38 -0500 Subject: [PATCH] Fix bool type on PowerPC --- basis/alien/c-types/c-types.factor | 9 +++++---- basis/cpu/ppc/ppc.factor | 8 +++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/basis/alien/c-types/c-types.factor b/basis/alien/c-types/c-types.factor index 6067c90f2d..df5a5bbba8 100755 --- a/basis/alien/c-types/c-types.factor +++ b/basis/alien/c-types/c-types.factor @@ -259,8 +259,9 @@ M: long-long-type box-return ( type -- ) [ dup c-setter '[ _ [ 0 @ ] keep ] ] bi (( value -- c-ptr )) define-inline ; -: c-bool> ( int -- ? ) - 0 = not ; inline +: >c-bool ( ? -- int ) 1 0 ? ; inline + +: c-bool> ( int -- ? ) 0 = not ; inline : define-primitive-type ( type name -- ) [ typedef ] @@ -409,8 +410,8 @@ CONSTANT: primitive-types "uchar" define-primitive-type - [ alien-unsigned-1 zero? not ] >>getter - [ [ 1 0 ? ] 2dip set-alien-unsigned-1 ] >>setter + [ alien-unsigned-1 c-bool> ] >>getter + [ [ >c-bool ] 2dip set-alien-unsigned-1 ] >>setter 1 >>size 1 >>align "box_boolean" >>boxer diff --git a/basis/cpu/ppc/ppc.factor b/basis/cpu/ppc/ppc.factor index 442dd8e7ea..314ea830f8 100644 --- a/basis/cpu/ppc/ppc.factor +++ b/basis/cpu/ppc/ppc.factor @@ -713,4 +713,10 @@ USE: vocabs.loader } cond "complex-double" c-type t >>return-in-registers? drop -"bool" c-type 4 >>size 4 >>align drop \ No newline at end of file + +"bool" c-type +4 >>size +4 >>align +[ alien-unsigned-1 c-bool> ] >>getter +[ [ >c-bool ] 2dip set-alien-unsigned-1 ] >>setter +drop \ No newline at end of file