add PIC_USE_FILE and PIC_USE_READ flags

This commit is contained in:
Yuichi Nishiwaki
2017-04-15 01:06:33 +09:00
parent 4e4360a0e8
commit 70e2a8cbba
8 changed files with 52 additions and 44 deletions
+2 -3
View File
@@ -5,12 +5,11 @@
/** enable libc */
/* #define PIC_USE_LIBC 1 */
/** enable stdio */
/* #define PIC_USE_STDIO 1 */
/** enable specific features */
/* #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 */
-2
View File
@@ -15,8 +15,6 @@ void *pic_default_allocf(void *, void *, size_t);
pic_value pic_fopen(pic_state *, FILE *, const char *mode);
#endif
pic_value pic_read(pic_state *, pic_value port);
/* for debug */
#if PIC_USE_WRITE
+17 -3
View File
@@ -8,8 +8,8 @@
# define PIC_USE_LIBC 1
#endif
#ifndef PIC_USE_STDIO
# define PIC_USE_STDIO 1
#ifndef PIC_USE_READ
# define PIC_USE_READ 1
#endif
#ifndef PIC_USE_WRITE
@@ -20,6 +20,17 @@
# define PIC_USE_EVAL 1
#endif
#ifndef PIC_USE_FILE
# define PIC_USE_FILE 1
#endif
#if !PIC_USE_READ && PIC_USE_EVAL
# error PIC_USE_EVAL requires PIC_USE_READ
#endif
#if !PIC_USE_LIBC && PIC_USE_FILE
# error PIC_USE_FILE requires PIC_USE_LIBC
#endif
#ifndef PIC_JMPBUF
# include <setjmp.h>
# define PIC_JMPBUF jmp_buf
@@ -383,8 +394,11 @@ pic_atod(const char *str)
return atof(str);
}
#if PIC_USE_STDIO
#if PIC_USE_FILE
# include <stdio.h>
#endif
#if PIC_USE_LIBC
PIC_STATIC_INLINE void
pic_dtoa(double dval, char *buf)