fixes
This commit is contained in:
parent
3aaa5f29b3
commit
716629f761
|
@ -41,7 +41,7 @@ typedef struct value {
|
||||||
uint64_t v;
|
uint64_t v;
|
||||||
#else
|
#else
|
||||||
union {
|
union {
|
||||||
void *data;
|
void *p;
|
||||||
double f;
|
double f;
|
||||||
int i;
|
int i;
|
||||||
char c;
|
char c;
|
||||||
|
|
|
@ -52,7 +52,6 @@ pic_init_core(pic_state *pic)
|
||||||
|
|
||||||
pic_init_bool(pic); DONE;
|
pic_init_bool(pic); DONE;
|
||||||
pic_init_pair(pic); DONE;
|
pic_init_pair(pic); DONE;
|
||||||
pic_init_port(pic); DONE;
|
|
||||||
pic_init_number(pic); DONE;
|
pic_init_number(pic); DONE;
|
||||||
pic_init_proc(pic); DONE;
|
pic_init_proc(pic); DONE;
|
||||||
pic_init_symbol(pic); DONE;
|
pic_init_symbol(pic); DONE;
|
||||||
|
@ -69,6 +68,9 @@ pic_init_core(pic_state *pic)
|
||||||
#if PIC_USE_CONT
|
#if PIC_USE_CONT
|
||||||
pic_init_cont(pic); DONE;
|
pic_init_cont(pic); DONE;
|
||||||
#endif
|
#endif
|
||||||
|
#if PIC_USE_PORT
|
||||||
|
pic_init_port(pic); DONE;
|
||||||
|
#endif
|
||||||
#if PIC_USE_READ
|
#if PIC_USE_READ
|
||||||
pic_init_read(pic); DONE;
|
pic_init_read(pic); DONE;
|
||||||
#endif
|
#endif
|
||||||
|
@ -161,9 +163,6 @@ pic_open(pic_allocf allocf, void *userdata, pic_panicf panicf)
|
||||||
pic->halt = obj_value(pic, proc);
|
pic->halt = obj_value(pic, proc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* panic handler */
|
|
||||||
pic->panicf = NULL;
|
|
||||||
|
|
||||||
/* turn on GC */
|
/* turn on GC */
|
||||||
pic->gc_enable = true;
|
pic->gc_enable = true;
|
||||||
|
|
||||||
|
|
|
@ -273,12 +273,12 @@ pic_vstrf_value(pic_state *pic, const char *fmt, va_list ap)
|
||||||
}
|
}
|
||||||
case 'p': {
|
case 'p': {
|
||||||
static const char digits[] = "0123456789abcdef";
|
static const char digits[] = "0123456789abcdef";
|
||||||
static const size_t bufsiz = sizeof(long) * CHAR_BIT / 4;
|
#define MAXLEN (sizeof(long) * CHAR_BIT / 4)
|
||||||
unsigned long vp = (unsigned long) va_arg(ap, void*);
|
unsigned long vp = (unsigned long) va_arg(ap, void*);
|
||||||
char buf[2 + bufsiz + 1] = "0x", *p = buf + 2;
|
char buf[2 + MAXLEN + 1] = "0x", *p = buf + 2;
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < bufsiz; ++i) {
|
for (i = 0; i < MAXLEN; ++i) {
|
||||||
p[bufsiz - i - 2] = digits[vp % 16];
|
p[MAXLEN - i - 2] = digits[vp % 16];
|
||||||
vp /= 16;
|
vp /= 16;
|
||||||
}
|
}
|
||||||
p[i] = '\0';
|
p[i] = '\0';
|
||||||
|
|
|
@ -42,7 +42,7 @@ enum {
|
||||||
PIC_STATIC_INLINE void
|
PIC_STATIC_INLINE void
|
||||||
make_value(struct value *v, int type)
|
make_value(struct value *v, int type)
|
||||||
{
|
{
|
||||||
static const struct value zero = { 0 };
|
static const struct value zero = { {0}, 0 };
|
||||||
*v = zero;
|
*v = zero;
|
||||||
v->type = type;
|
v->type = type;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ make_float_value(struct value *v, double f)
|
||||||
v->u.f = f;
|
v->u.f = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
PIC_STATIC_INLINE struct value
|
PIC_STATIC_INLINE void
|
||||||
make_char_value(struct value *v, char c)
|
make_char_value(struct value *v, char c)
|
||||||
{
|
{
|
||||||
make_value(v, PIC_TYPE_CHAR);
|
make_value(v, PIC_TYPE_CHAR);
|
||||||
|
|
Loading…
Reference in New Issue