From: Michal Rokos Date: 2002-01-29T16:59:21+09:00 Subject: Re: ruby extensions in C and booleans Hello, Martin Maciaszek wrote: > On second thought I noticed that bf is still a ruby > representation of a boolean. I searched in "Programming Ruby" and > ruby.h but couldn't find a macro to convert this boolean to a C > representation of a boolean. From ruby.h Qfalse is 0 --- #define Qfalse 0 Qtrue is 2 --- #define Qtrue 2 Since 'C' has no special type for TRUE/FALSE, most of implementation uses FALSE=0, TRUE anything else. So there is no need to convert it, but maybe you would like make it more 'clean' or use TRUE=1 (not TRUE=2 as it is). The solution is: .... { int ok; ok = (bf == Qtrue) ? 1 : 0; /* is bf TRUE? if so, set ok to 1. else to 0;*/ ..... } Does this help? Michal -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Michal Rokos Czech Technical University, Prague E-mail: m.rokos@sh.cvut.cz Jabber: majkl@jabber.cz, ICQ: 36118339 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-