Re: passing flags to a function

2006-05-02 Thread Ludovic Courtès
Hi, Dan McMahill [EMAIL PROTECTED] writes: I can do something like SCM scm_myfn(SCM flags) { myfn (scm_num2int (flags, SCM_ARG1, myfn)); return SCM_BOOLEAN_T; } but I'm not sure of the best way to define the flags in scheme. Or maybe this is not the scheme way. What you

Re: passing flags to a function

2006-05-02 Thread Clinton Ebadi
On Tue, 2006-05-02 at 08:25 -0400, Dan McMahill wrote: Hello, I'm sure this is a very basic question about passing or-able flags to a function. In C I might do something like: ...snip... You can make the flags available to scheme as numbers, and then the Scheme users can use Guile's

Re: passing flags to a function

2006-05-02 Thread Dan McMahill
Ludovic Courtès wrote: Hi, Dan McMahill [EMAIL PROTECTED] writes: I can do something like SCM scm_myfn(SCM flags) { myfn (scm_num2int (flags, SCM_ARG1, myfn)); return SCM_BOOLEAN_T; } but I'm not sure of the best way to define the flags in scheme. Or maybe this is not the scheme way.

Re: passing flags to a function

2006-05-02 Thread Dan McMahill
Ludovic Courtès wrote: Hi, Dan McMahill [EMAIL PROTECTED] writes: Thanks for the reply. Could you show a short example of what the scheme function call might look like? Are you meaning (foo (list 'flag1 'flag2 'someotherflag)) Rather, it would look like: (foo 'flag1 'flag2

Re: passing flags to a function

2006-05-02 Thread Kevin Ryde
Dan McMahill [EMAIL PROTECTED] writes: SCM scm_myfn(SCM flags) { myfn (scm_num2int (flags, SCM_ARG1, myfn)); Various things in the guile core are done like that, stuff like O_RDWR for `open'. The list of symbols Ludovic described is done in the guile-gtk interface and works nicely too. If