removed MOO_BQ().

changed the primitive value load method
This commit is contained in:
hyunghwan.chung 2019-10-26 14:34:19 +00:00
parent 3874483b23
commit 5004b39125
5 changed files with 22 additions and 33 deletions

View File

@ -3273,7 +3273,7 @@ moo_oop_t moo_bitorints (moo_t* moo, moo_oop_t x, moo_oop_t y)
v3 = v1 | v2; v3 = v1 | v2;
if (MOO_IN_SMOOI_RANGE(v3)) return MOO_SMOOI_TO_OOP(v3); if (MOO_IN_SMOOI_RANGE(v3)) return MOO_SMOOI_TO_OOP(v3);
return make_bigint_with_ooi (moo, v3); return make_bigint_with_ooi(moo, v3);
} }
else if (MOO_OOP_IS_SMOOI(x)) else if (MOO_OOP_IS_SMOOI(x))
{ {

View File

@ -10296,22 +10296,19 @@ static int __compile_pooldic_definition (moo_t* moo)
switch (pvbase->type) switch (pvbase->type)
{ {
case MOO_PV_INT: case MOO_PV_OOI:
{ {
moo_oocs_t x; tmp = moo_ooitoint(moo, (moo_ooi_t)pvbase->value);
x.ptr = moo_dupbtooocstr(moo, pvbase->vstr, &x.len);
if (!x.ptr) goto oops;
tmp = string_to_int(moo, &x, 0);
moo_freemem (moo, x.ptr);
if (tmp && MOO_OOP_IS_POINTER(tmp)) MOO_OBJ_SET_FLAGS_RDONLY (tmp, 1);
break; break;
} }
/* case MOO_PV_STR: case MOO_PV_OOW:
*/ {
tmp = moo_oowtoint(moo, (moo_oow_t)pvbase->value);
break;
}
/* TODO: support more types... MOO_PV_OOI_BCSTR, MOO_PV_OOI_UCSTR, MOO_PV_FPDEC_BCSTR, MOO_PV_BCSTR, MOO_PV_UCSTR, etc */
default: default:
moo_setsynerrbfmt (moo, MOO_SYNERR_STRING, TOKEN_LOC(moo), TOKEN_NAME(moo), "unsupported primitive value type - %d", pvbase->type); moo_setsynerrbfmt (moo, MOO_SYNERR_STRING, TOKEN_LOC(moo), TOKEN_NAME(moo), "unsupported primitive value type - %d", pvbase->type);
goto oops; goto oops;

View File

@ -1049,11 +1049,4 @@ typedef struct moo_t moo_t;
#define MOO_STATIC_ASSERT_EXPR(expr) ((void)MOO_SIZEOF(char[(expr)? 1: -1])) #define MOO_STATIC_ASSERT_EXPR(expr) ((void)MOO_SIZEOF(char[(expr)? 1: -1]))
/* =========================================================================
* QUOTING
* =========================================================================*/
#define MOO_BQ_(val) #val
#define MOO_BQ(val) MOO_BQ_(val)
#endif #endif

View File

@ -1334,16 +1334,16 @@ struct moo_pfinfo_t
enum moo_pvtype_t enum moo_pvtype_t
{ {
MOO_PV_INT, MOO_PV_OOI,
MOO_PV_STR, MOO_PV_OOW
MOO_PV_SYM /* TODO: more types */
}; };
typedef enum moo_pvtype_t moo_pvtype_t; typedef enum moo_pvtype_t moo_pvtype_t;
struct moo_pvbase_t struct moo_pvbase_t
{ {
moo_pvtype_t type; moo_pvtype_t type;
const void* vstr; const void* value;
}; };
typedef struct moo_pvbase_t moo_pvbase_t; typedef struct moo_pvbase_t moo_pvbase_t;

View File

@ -126,21 +126,20 @@ static moo_pfinfo_t pfinfos[] =
static moo_pvinfo_t pvinfos[] = static moo_pvinfo_t pvinfos[] =
{ {
{ "O_CLOEXEC", { MOO_PV_INT, MOO_BQ(O_CLOEXEC) } }, { "O_CLOEXEC", { MOO_PV_OOI, (const void*)O_CLOEXEC } },
{ "O_CREAT", { MOO_PV_INT, MOO_BQ(O_CREAT) } }, { "O_CREAT", { MOO_PV_OOI, (const void*)O_CREAT } },
{ "O_EXCL", { MOO_PV_INT, MOO_BQ(O_EXCL) } }, { "O_EXCL", { MOO_PV_OOI, (const void*)O_EXCL } },
{ "O_NOFOLLOW", { MOO_PV_INT, MOO_BQ(O_NOFOLLOW) } }, { "O_NOFOLLOW", { MOO_PV_OOI, (const void*)O_NOFOLLOW } },
{ "O_NONBLOCK", { MOO_PV_INT, MOO_BQ(O_NONBLOCK) } }, { "O_NONBLOCK", { MOO_PV_OOI, (const void*)O_NONBLOCK } },
{ "O_RDONLY", { MOO_PV_INT, MOO_BQ(O_RDONLY) } }, { "O_RDONLY", { MOO_PV_OOI, (const void*)O_RDONLY } },
{ "O_RDWR", { MOO_PV_INT, MOO_BQ(O_RDWR) } }, { "O_RDWR", { MOO_PV_OOI, (const void*)O_RDWR } },
{ "O_TRUNC", { MOO_PV_INT, MOO_BQ(O_TRUNC) } }, { "O_TRUNC", { MOO_PV_OOI, (const void*)O_TRUNC } },
{ "O_WRONLY", { MOO_PV_INT, MOO_BQ(O_WRONLY) } }, { "O_WRONLY", { MOO_PV_OOI, (const void*)O_WRONLY } }
}; };
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
static int import (moo_t* moo, moo_mod_t* mod, moo_oop_class_t _class) static int import (moo_t* moo, moo_mod_t* mod, moo_oop_class_t _class)
{ {
/*if (moo_setclasstrsize(moo, _class, MOO_SIZEOF(io_t), MOO_NULL) <= -1) return -1;*/
return 0; return 0;
} }