add PIC_USE_CALLCC flag
This commit is contained in:
+13
-8
@@ -2,20 +2,25 @@
|
||||
* See Copyright Notice in picrin.h
|
||||
*/
|
||||
|
||||
/** enable libc */
|
||||
/**
|
||||
* enable libc
|
||||
*/
|
||||
|
||||
/* When PIC_USE_LIBC=0, users must supply panicf which never returns. */
|
||||
/* #define PIC_USE_LIBC 1 */
|
||||
|
||||
/** enable specific features */
|
||||
/**
|
||||
* enable specific features
|
||||
*/
|
||||
|
||||
/* #define PIC_USE_CALLCC 1 */
|
||||
/* #define PIC_USE_READ 1 */
|
||||
/* #define PIC_USE_WRITE 1 */
|
||||
/* #define PIC_USE_EVAL 1 */
|
||||
/* #define PIC_USE_FILE 1 */
|
||||
|
||||
/** essential external functions */
|
||||
/* #define PIC_JMPBUF jmp_buf */
|
||||
/* #define PIC_SETJMP(pic, buf) setjmp(buf) */
|
||||
/* #define PIC_LONGJMP(pic, buf, val) longjmp((buf), (val)) */
|
||||
/* #define PIC_ABORT(pic) abort() */
|
||||
/**
|
||||
* I/O configuration
|
||||
*/
|
||||
|
||||
/** I/O configuration */
|
||||
/* #define PIC_BUFSIZ 1024 */
|
||||
|
||||
@@ -306,7 +306,7 @@ pic_value pic_make_error(pic_state *, const char *type, const char *msg, pic_val
|
||||
extern void pic_exit_try(pic_state *); \
|
||||
extern pic_value pic_abort_try(pic_state *); \
|
||||
PIC_JMPBUF *jmp = pic_prepare_try(pic); \
|
||||
if (PIC_SETJMP(pic, *jmp) == 0) { \
|
||||
if (PIC_SETJMP(*jmp) == 0) { \
|
||||
pic_enter_try(pic);
|
||||
#define pic_catch(e) pic_catch_(e, PIC_GENSYM(label))
|
||||
#define pic_catch_(e, label) \
|
||||
|
||||
@@ -9,9 +9,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#if PIC_USE_LIBC
|
||||
void *pic_default_allocf(void *, void *, size_t);
|
||||
#endif
|
||||
|
||||
#if PIC_USE_FILE
|
||||
pic_value pic_fopen(pic_state *, FILE *, const char *mode);
|
||||
#endif
|
||||
|
||||
|
||||
+13
-11
@@ -8,6 +8,10 @@
|
||||
# define PIC_USE_LIBC 1
|
||||
#endif
|
||||
|
||||
#ifndef PIC_USE_CALLCC
|
||||
# define PIC_USE_CALLCC 1
|
||||
#endif
|
||||
|
||||
#ifndef PIC_USE_READ
|
||||
# define PIC_USE_READ 1
|
||||
#endif
|
||||
@@ -30,20 +34,18 @@
|
||||
#if !PIC_USE_LIBC && PIC_USE_FILE
|
||||
# error PIC_USE_FILE requires PIC_USE_LIBC
|
||||
#endif
|
||||
#if !PIC_USE_LIBC && PIC_USE_CALLCC
|
||||
# error PIC_USE_CALLCC requires PIC_USE_LIBC
|
||||
#endif
|
||||
|
||||
#ifndef PIC_JMPBUF
|
||||
#if PIC_USE_CALLCC
|
||||
# include <setjmp.h>
|
||||
# define PIC_JMPBUF jmp_buf
|
||||
#endif
|
||||
|
||||
#ifndef PIC_SETJMP
|
||||
# include <setjmp.h>
|
||||
# define PIC_SETJMP(pic, buf) setjmp(buf)
|
||||
#endif
|
||||
|
||||
#ifndef PIC_LONGJMP
|
||||
# include <setjmp.h>
|
||||
# define PIC_LONGJMP(pic, buf, val) longjmp((buf), (val))
|
||||
# define PIC_SETJMP(buf) setjmp(buf)
|
||||
# define PIC_LONGJMP(buf, val) longjmp((buf), (val))
|
||||
#else
|
||||
# define PIC_JMPBUF char
|
||||
# define PIC_SETJMP(buf) 0
|
||||
#endif
|
||||
|
||||
#ifndef PIC_ABORT
|
||||
|
||||
Reference in New Issue
Block a user