This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

guile-snarf and C++


To reiterate my concerns about using guile w/ C++, here are the minimal
changes to guile to make things manageable for use with c++:

o fix snarf.h to not use the CPP in completely broken ways when trying
to determine a useful C++ prototype; see patch below

o Use ${CC:-gcc} instead of just gcc within guile-snarf:

#!/bin/sh
# FIXED VERSION OF GUILE-SNARF -- honours the CC environment variable
# so a make CC=g++ will work in a lot of cases
# Extract the initialization actions for builtin things.
${CC:-gcc} -E -DSCM_MAGIC_SNARFER "$@" | grep "^ *% *% *%" | sed -e "s/^ *% *% *%//"

Thanks,
Greg

patch to fix snarf.h follows:

*** snarf.h.orig        Wed Jul  1 15:39:23 1998
--- snarf.h     Wed Jul  1 15:40:22 1998
***************
*** 54,73 ****
        static char RANAME[]=STR
  #else
  #ifdef __cplusplus
- #if REQ == 0 && OPT == 0 && VAR == 0
  #define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN)  \
! %%%   scm_make_gsubr (RANAME, REQ, OPT, VAR, (SCM (*) (void)) CFN)
! #else
! #define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN)  \
! %%%   scm_make_gsubr (RANAME, REQ, OPT, VAR, (SCM (*) (SCM, ...)) CFN)
! #endif
! #if TYPE == scm_tc7_subr_0
! #define SCM_PROC1(RANAME, STR, TYPE, CFN)  \
! %%%   scm_make_subr(RANAME, TYPE, (SCM (*)(void)) CFN)
! #else
  #define SCM_PROC1(RANAME, STR, TYPE, CFN)  \
  %%%   scm_make_subr(RANAME, TYPE, (SCM (*)(...)) CFN)
- #endif
  #else /* __cplusplus */
  #define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN)  \
  %%%   scm_make_gsubr (RANAME, REQ, OPT, VAR, CFN)
--- 54,63 ----
        static char RANAME[]=STR
  #else
  #ifdef __cplusplus
  #define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN)  \
! %%%   scm_make_gsubr (RANAME, REQ, OPT, VAR, (SCM (*) (...)) CFN)
  #define SCM_PROC1(RANAME, STR, TYPE, CFN)  \
  %%%   scm_make_subr(RANAME, TYPE, (SCM (*)(...)) CFN)
  #else /* __cplusplus */
  #define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN)  \
  %%%   scm_make_gsubr (RANAME, REQ, OPT, VAR, CFN)