Changes to make xlisp.h usable in C++ code...

1) #include guard
2) "C" linkage for all function declarations
3) some uses of const
This commit is contained in:
Paul Licameli 2018-02-27 13:51:10 -05:00
parent 5aa70545d5
commit 6b2a219e26
2 changed files with 15 additions and 3 deletions

View File

@ -504,7 +504,7 @@ FUNDEF init_funtab[] = {
FUNDEF *funtab = init_funtab;
static size_t szfuntab = sizeof(init_funtab) / sizeof(*init_funtab);
int xlbindfunctions(FUNDEF *functions, size_t nfunctions)
int xlbindfunctions(const FUNDEF *functions, size_t nfunctions)
{
/* This is written very generally, imposing no fixed upper limit on the
growth of the table. But perhaps a lightweight alternative with such a

View File

@ -13,6 +13,13 @@ HISTORY
/* system specific definitions */
#ifndef __XLISP__
#define __XLISP__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h> /* needed for getenv(); note that this was a problem
for PMAX implementation, but I assume PMAX is obsolete now.
- RBD 16apr04 */
@ -366,7 +373,7 @@ void dbg_gc_xlsave(LVAL *n);
/* function definition structure */
typedef struct {
char *fd_name; /* function name */
const char *fd_name; /* function name */
int fd_type; /* function type */
LVAL (*fd_subr)(void); /* function entry point */
} FUNDEF;
@ -676,7 +683,7 @@ void xlsymbols(void);
false if table limits would be exceeded and the table remains unchanged
Call this, any number of times, before calling xlisp_main_init
*/
int xlbindfunctions(FUNDEF *functions, size_t nfunctions);
int xlbindfunctions(const FUNDEF *functions, size_t nfunctions);
/* xlio.c */
@ -1032,3 +1039,8 @@ void localinit(void);
void localsymbols(void);
void print_local_gc_info(void);
#ifdef __cplusplus
}
#endif
#endif