guile-user
[Top][All Lists]
Advanced

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

[guile/scwm] SCM_HOOKP changed?


From: P Pareit
Subject: [guile/scwm] SCM_HOOKP changed?
Date: Sun, 15 Sep 2002 15:01:24 +0200
User-agent: KMail/1.4.2

Hey,

I have a lot of code depending on SCM_HOOKP, has SCM_HOOKP changed in any way?
I also seen it is not documented, so I guess it should not be used, is 
scm_hook_p the right alternative?

The following program should show my problem:

// make-hook test program
//

#include <stdio.h>
#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(void* closure, int argc, char** argv)
{
#ifndef SCM_MAGIC_SNARFER
#include "main.x"
#endif
  if (!SCM_HOOKP(error_hook)) {
    fprintf(stderr, "SCM_HOOKP(error_hook) returns false!\n");
  }
  if (!scm_hook_p(error_hook)) {
    fprintf(stderr, "scm_hook_p(error_hook) returns false!\n");
  }
}

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

and can be compiled with the following 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

pieter;




reply via email to

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