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

[goops] adding a number class with generic methods

2006-05-02 Thread Marco Maggi
Hi, I am trying to add a new number class, export generic methods from a module and import them into another one. If I ignore the GOOPS tutorial and read only the reference, it is my understanting that I should do: ;; ;; exporting.scm

potential memory leak in do loop

2006-05-02 Thread Stephane Chatigny
Hello, I use the MIT MPB package on a machine running guile 1.6 and Debian-Linux 3.1r0a. Apparently, I generate a memory link while executing a do loop (although I have not tracked the memory usage yet). When I run the loop, the process is aborted before the end of the iteration.

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

Re: potential memory leak in do loop

2006-05-02 Thread Kevin Ryde
Stephane Chatigny [EMAIL PROTECTED] writes: (although I have not tracked the memory usage yet). You'll probably have to use one of the various malloc debugging packages to find who has allocated the memory that's never freed, to see who's supposed to be responsible for that.

Re: [goops] adding a number class with generic methods

2006-05-02 Thread Marco Maggi
[EMAIL PROTECTED] wrote: I do not understand why the first solution does not work; I've tried different combinations of functions but there is something I am missing. Damn... it seems to work if I do not EXPORT the generic methods. -- Marco Maggi