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]

totally insane



Please excuse my ignorance, but can someone tell me whether the code
here, inside the "#ifdef __cplusplus" conditional, is actually valid
C++?

If so, that is some of the strangest syntax I've ever seen --- can you
really put a conditional which tests the values of macro arguments on
the *outside* of the macro?  The scope of a macro's arguments extends
beyond its definition...

Or was the author just feeling Martian that day?


#ifndef SCM_MAGIC_SNARFER
#define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN)  \
	static char RANAME[]=STR
#define SCM_PROC1(RANAME, STR, TYPE, CFN)  \
	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)
#define SCM_PROC1(RANAME, STR, TYPE, CFN)  \
%%%	scm_make_subr(RANAME, TYPE, CFN)
#endif /* __cplusplus */
#endif