guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [guile/scwm] What argument type does scm_make_hook expects?


From: P Pareit
Subject: Re: [guile/scwm] What argument type does scm_make_hook expects?
Date: Fri, 13 Sep 2002 18:56:07 +0200
User-agent: KMail/1.4.2

>
> Hey,
>
> I get the following error:
>
> ERROR: In procedure make-hook:
> ERROR: Wrong type argument in position ~A: ~S
> Program exited with code 02.
>
> scm_make_hook gets called like this:
>
> SCWM_GLOBAL_HOOK(error_hook, "error-hook", 1, "...);
>
> which expands to the following code during snarfing:
>
> #define SCWM_GLOBAL_HOOK(var, name, args, docstring) \
> SCM_VARIABLE_INIT(var, name, scm_make_hook(SCM_MAKINUM(args)))
>
> which gets expanded by guile-snarf to the following code:
>
>  error_hook =3D scm_permanent_object (scm_c_define ("error-hook",=20
> scm_make_hook((((SCM) ((((scm_t_signed_bits) (1)) << 2) + 2))))));;
>
> If I step through the code, I can see the argument does not pass this
> validation in the function scm_make_hook at hooks.c:
>
>       SCM_VALIDATE_INUM_COPY (SCM_ARG1, n_args, n);
>
> =46rom what I understand, SCM_VALIDATE_INUM_COPY first validates that
> n_args is an INUM (which I think it is as I create it with SCM_MAKINUM)
> and then copy's the number to the c-type int n.
>
> What am I missing, or doing wrong?
>

In re to myself, this is a test program, that does all the same things but 
does NOT show up the problematic behavior:

// main.c
// make-hook test program
//

#include <libguile.h>

#ifndef SCM_MAGIC_SNARFER
#define SCWM_GLOBAL_HOOK(var, name, args, docstring) \
SCM var
#else
#define SCWM_GLOBAL_HOOK(var, name, args, docstring) \
SCM_VARIABLE_INIT(var, name, scm_make_hook(SCM_MAKINUM(args)))
#endif

SCWM_GLOBAL_HOOK(error_hook, "error-hook", 1, "...");

void inner_main()
{
#ifndef SCM_MAGIC_SNARFER
#include "main.x"
#endif
}

int main(int argc, char* argv[])
{
  scm_boot_guile(argc, argv, inner_main, NULL);
}

compiled with the following Makefile:

#
## Makefile
#
test: main.o
        gcc -g -o test main.c `guile-config link`

main.o: main.c main.x
        gcc -g -c main.c `guile-config compile`

main.x: main.c
        guile-snarf -o main.x main.c

clean:
        rm -f *.o
        rm -f *.x

Things I should test more?

pieter;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]