removed a few global variables including qse_awk_val_zero, qse_awk_val_one, qse_awk_val_negone. substituted QSE_AWK_VAL_ZERO/ONE/NEGONE marcos.
redefined QUICKINT related macros
This commit is contained in:
parent
d92d534986
commit
448735d4cb
@ -383,7 +383,7 @@ int qse_awk_rtx_clrrec (qse_awk_rtx_t* run, int skip_inrec_line)
|
||||
run->inrec.nflds = 0;
|
||||
|
||||
if (qse_awk_rtx_setgbl (
|
||||
run, QSE_AWK_GBL_NF, qse_awk_val_zero) == -1)
|
||||
run, QSE_AWK_GBL_NF, QSE_AWK_VAL_ZERO) == -1)
|
||||
{
|
||||
/* first of all, this should never happen.
|
||||
* if it happened, it would return an error
|
||||
|
@ -1244,7 +1244,7 @@ static int prepare_globals (qse_awk_rtx_t* rtx)
|
||||
|
||||
/* override NF to zero */
|
||||
if (qse_awk_rtx_setgbl (
|
||||
rtx, QSE_AWK_GBL_NF, qse_awk_val_zero) <= -1) goto oops;
|
||||
rtx, QSE_AWK_GBL_NF, QSE_AWK_VAL_ZERO) <= -1) goto oops;
|
||||
|
||||
/* return success */
|
||||
return 0;
|
||||
@ -1252,7 +1252,7 @@ static int prepare_globals (qse_awk_rtx_t* rtx)
|
||||
oops:
|
||||
/* restore the stack_top this way instead of calling __raw_pop()
|
||||
* as many times as successful __raw_push(). it is ok because
|
||||
* the values pushed so far are qse_awk_val_nils and qse_awk_val_zeros.
|
||||
* the values pushed so far are qse_awk_val_nils and QSE_AWK_VAL_ZEROs.
|
||||
*/
|
||||
rtx->stack_top = saved_stack_top;
|
||||
return -1;
|
||||
@ -3946,7 +3946,7 @@ static qse_awk_val_t* eval_binop_lor (
|
||||
qse_awk_rtx_refupval (run, lv);
|
||||
if (qse_awk_rtx_valtobool (run, lv))
|
||||
{
|
||||
res = qse_awk_val_one;
|
||||
res = QSE_AWK_VAL_ONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3960,7 +3960,7 @@ static qse_awk_val_t* eval_binop_lor (
|
||||
qse_awk_rtx_refupval (run, rv);
|
||||
|
||||
res = qse_awk_rtx_valtobool(run,rv)?
|
||||
qse_awk_val_one: qse_awk_val_zero;
|
||||
QSE_AWK_VAL_ONE: QSE_AWK_VAL_ZERO;
|
||||
qse_awk_rtx_refdownval (run, rv);
|
||||
}
|
||||
|
||||
@ -3999,7 +3999,7 @@ static qse_awk_val_t* eval_binop_land (
|
||||
qse_awk_rtx_refupval (run, lv);
|
||||
if (!qse_awk_rtx_valtobool (run, lv))
|
||||
{
|
||||
res = qse_awk_val_zero;
|
||||
res = QSE_AWK_VAL_ZERO;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4012,7 +4012,7 @@ static qse_awk_val_t* eval_binop_land (
|
||||
}
|
||||
qse_awk_rtx_refupval (run, rv);
|
||||
|
||||
res = qse_awk_rtx_valtobool(run,rv)? qse_awk_val_one: qse_awk_val_zero;
|
||||
res = qse_awk_rtx_valtobool(run,rv)? QSE_AWK_VAL_ONE: QSE_AWK_VAL_ZERO;
|
||||
qse_awk_rtx_refdownval (run, rv);
|
||||
}
|
||||
|
||||
@ -4064,7 +4064,7 @@ static qse_awk_val_t* eval_binop_in (
|
||||
{
|
||||
if (str != idxbuf) QSE_AWK_FREE (run->awk, str);
|
||||
qse_awk_rtx_refdownval (run, rv);
|
||||
return qse_awk_val_zero;
|
||||
return QSE_AWK_VAL_ZERO;
|
||||
}
|
||||
else if (rvtype == QSE_AWK_VAL_MAP)
|
||||
{
|
||||
@ -4073,7 +4073,7 @@ static qse_awk_val_t* eval_binop_in (
|
||||
|
||||
map = ((qse_awk_val_map_t*)rv)->map;
|
||||
res = (qse_htb_search (map, str, len) == QSE_NULL)?
|
||||
qse_awk_val_zero: qse_awk_val_one;
|
||||
QSE_AWK_VAL_ZERO: QSE_AWK_VAL_ONE;
|
||||
|
||||
if (str != idxbuf) QSE_AWK_FREE (run->awk, str);
|
||||
qse_awk_rtx_refdownval (run, rv);
|
||||
@ -4584,13 +4584,13 @@ static int teq_val (qse_awk_rtx_t* rtx, qse_awk_val_t* left, qse_awk_val_t* righ
|
||||
static qse_awk_val_t* eval_binop_teq (
|
||||
qse_awk_rtx_t* rtx, qse_awk_val_t* left, qse_awk_val_t* right)
|
||||
{
|
||||
return teq_val (rtx, left, right)? qse_awk_val_one: qse_awk_val_zero;
|
||||
return teq_val (rtx, left, right)? QSE_AWK_VAL_ONE: QSE_AWK_VAL_ZERO;
|
||||
}
|
||||
|
||||
static qse_awk_val_t* eval_binop_tne (
|
||||
qse_awk_rtx_t* rtx, qse_awk_val_t* left, qse_awk_val_t* right)
|
||||
{
|
||||
return teq_val (rtx, left, right)? qse_awk_val_zero: qse_awk_val_one;
|
||||
return teq_val (rtx, left, right)? QSE_AWK_VAL_ZERO: QSE_AWK_VAL_ONE;
|
||||
}
|
||||
|
||||
static qse_awk_val_t* eval_binop_eq (
|
||||
@ -4598,7 +4598,7 @@ static qse_awk_val_t* eval_binop_eq (
|
||||
{
|
||||
int n = __cmp_val (rtx, left, right);
|
||||
if (n == CMP_ERROR) return QSE_NULL;
|
||||
return (n == 0)? qse_awk_val_one: qse_awk_val_zero;
|
||||
return (n == 0)? QSE_AWK_VAL_ONE: QSE_AWK_VAL_ZERO;
|
||||
}
|
||||
|
||||
static qse_awk_val_t* eval_binop_ne (
|
||||
@ -4606,7 +4606,7 @@ static qse_awk_val_t* eval_binop_ne (
|
||||
{
|
||||
int n = __cmp_val (rtx, left, right);
|
||||
if (n == CMP_ERROR) return QSE_NULL;
|
||||
return (n != 0)? qse_awk_val_one: qse_awk_val_zero;
|
||||
return (n != 0)? QSE_AWK_VAL_ONE: QSE_AWK_VAL_ZERO;
|
||||
}
|
||||
|
||||
static qse_awk_val_t* eval_binop_gt (
|
||||
@ -4614,7 +4614,7 @@ static qse_awk_val_t* eval_binop_gt (
|
||||
{
|
||||
int n = __cmp_val (rtx, left, right);
|
||||
if (n == CMP_ERROR) return QSE_NULL;
|
||||
return (n > 0)? qse_awk_val_one: qse_awk_val_zero;
|
||||
return (n > 0)? QSE_AWK_VAL_ONE: QSE_AWK_VAL_ZERO;
|
||||
}
|
||||
|
||||
static qse_awk_val_t* eval_binop_ge (
|
||||
@ -4622,7 +4622,7 @@ static qse_awk_val_t* eval_binop_ge (
|
||||
{
|
||||
int n = __cmp_val (rtx, left, right);
|
||||
if (n == CMP_ERROR) return QSE_NULL;
|
||||
return (n >= 0)? qse_awk_val_one: qse_awk_val_zero;
|
||||
return (n >= 0)? QSE_AWK_VAL_ONE: QSE_AWK_VAL_ZERO;
|
||||
}
|
||||
|
||||
static qse_awk_val_t* eval_binop_lt (
|
||||
@ -4630,7 +4630,7 @@ static qse_awk_val_t* eval_binop_lt (
|
||||
{
|
||||
int n = __cmp_val (rtx, left, right);
|
||||
if (n == CMP_ERROR) return QSE_NULL;
|
||||
return (n < 0)? qse_awk_val_one: qse_awk_val_zero;
|
||||
return (n < 0)? QSE_AWK_VAL_ONE: QSE_AWK_VAL_ZERO;
|
||||
}
|
||||
|
||||
static qse_awk_val_t* eval_binop_le (
|
||||
@ -4638,7 +4638,7 @@ static qse_awk_val_t* eval_binop_le (
|
||||
{
|
||||
int n = __cmp_val (rtx, left, right);
|
||||
if (n == CMP_ERROR) return QSE_NULL;
|
||||
return (n <= 0)? qse_awk_val_one: qse_awk_val_zero;
|
||||
return (n <= 0)? QSE_AWK_VAL_ONE: QSE_AWK_VAL_ZERO;
|
||||
}
|
||||
|
||||
static qse_awk_val_t* eval_binop_lshift (
|
||||
@ -6142,7 +6142,7 @@ static qse_awk_val_t* eval_int (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
|
||||
|
||||
val = qse_awk_rtx_makeintval (run, ((qse_awk_nde_int_t*)nde)->val);
|
||||
if (val == QSE_NULL) ADJERR_LOC (run, &nde->loc);
|
||||
else if (IS_REAL_POINTER(val)) ((qse_awk_val_int_t*)val)->nde = nde;
|
||||
else if (QSE_AWK_VTR_IS_POINTER(val)) ((qse_awk_val_int_t*)val)->nde = nde;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
@ -2346,11 +2346,11 @@ done:
|
||||
qse_awk_rtx_refupval (rtx, rv);
|
||||
ret = qse_awk_rtx_setrefval (rtx, (qse_awk_val_ref_t*)qse_awk_rtx_getarg (rtx, 2), rv);
|
||||
qse_awk_rtx_refdownval (rtx, rv);
|
||||
if (ret >= 0) qse_awk_rtx_setretval (rtx, qse_awk_val_zero);
|
||||
if (ret >= 0) qse_awk_rtx_setretval (rtx, QSE_AWK_VAL_ZERO);
|
||||
}
|
||||
else
|
||||
{
|
||||
qse_awk_rtx_setretval (rtx, qse_awk_val_negone);
|
||||
qse_awk_rtx_setretval (rtx, QSE_AWK_VAL_NEGONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,45 +39,6 @@ static qse_awk_val_str_t awk_zls = { QSE_AWK_VAL_STR, 0, 1, 0, { QSE_T(""), 0 }
|
||||
qse_awk_val_t* qse_awk_val_nil = (qse_awk_val_t*)&awk_nil;
|
||||
qse_awk_val_t* qse_awk_val_zls = (qse_awk_val_t*)&awk_zls;
|
||||
|
||||
/*
|
||||
* qse_awk_makeintval() returns a quickint pointer
|
||||
* for the value of -1, 0, 1. these static pointers
|
||||
* are kind of unnecesary for the quickint potiners.
|
||||
* let me keep this table until i redefine
|
||||
* qse_awk_val_negone, qse_awk_val_zero, qse_awk_val_one
|
||||
* to proper quickint pointer values.
|
||||
*
|
||||
* #define qse_awk_val_zero (qse_awk_val_t*)((qse_uintptr)VAL_TYPE_BITS_QUICKINT)
|
||||
* #define qse_awk_val_one (qse_awk_val_t*)(((qse_uintptr)1 << NUM_TYPE_BITS) | VAL_TYPE_BITS_QUICKINT)
|
||||
* #define qse_awk_val_negone (qse_awk_val_t*)(((qse_uintptr)1 << NUM_TYPE_BITS) | VAL_TYPE_BITS_QUICKINT | VAL_SIGN_BIT)
|
||||
*/
|
||||
static qse_awk_val_int_t awk_int[] =
|
||||
{
|
||||
/* type ref stat nstr val nde */
|
||||
{ QSE_AWK_VAL_INT, 0, 1, 0, -1, QSE_NULL },
|
||||
{ QSE_AWK_VAL_INT, 0, 1, 0, 0, QSE_NULL },
|
||||
{ QSE_AWK_VAL_INT, 0, 1, 0, 1, QSE_NULL }
|
||||
};
|
||||
|
||||
qse_awk_val_t* qse_awk_val_negone = (qse_awk_val_t*)&awk_int[0];
|
||||
qse_awk_val_t* qse_awk_val_zero = (qse_awk_val_t*)&awk_int[1];
|
||||
qse_awk_val_t* qse_awk_val_one = (qse_awk_val_t*)&awk_int[2];
|
||||
|
||||
static QSE_INLINE qse_awk_val_t* quickint_to_pointer (qse_awk_int_t v)
|
||||
{
|
||||
qse_uintptr_t r;
|
||||
|
||||
if (v < 0)
|
||||
{
|
||||
r = (((qse_uintptr_t)-v) << VAL_NUM_TYPE_BITS) | VAL_TYPE_BITS_QUICKINT | VAL_SIGN_BIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
r = ((qse_uintptr_t)v << VAL_NUM_TYPE_BITS) | VAL_TYPE_BITS_QUICKINT;
|
||||
}
|
||||
|
||||
return (qse_awk_val_t*)r;
|
||||
}
|
||||
|
||||
qse_awk_val_t* qse_getawknilval (void)
|
||||
{
|
||||
@ -98,17 +59,7 @@ qse_awk_val_t* qse_awk_rtx_makeintval (qse_awk_rtx_t* rtx, qse_awk_int_t v)
|
||||
{
|
||||
qse_awk_val_int_t* val;
|
||||
|
||||
if (IS_QUICKINT(v)) return quickint_to_pointer(v);
|
||||
|
||||
#if 0
|
||||
/* this is not necesary as the numbers in awk_int are
|
||||
* covered by QUICKINTs */
|
||||
if (v >= awk_int[0].i_val &&
|
||||
v <= awk_int[QSE_COUNTOF(awk_int)-1].i_val)
|
||||
{
|
||||
return (qse_awk_val_t*)&awk_int[v-awk_int[0].i_val];
|
||||
}
|
||||
#endif
|
||||
if (QSE_AWK_IN_QUICKINT_RANGE(v)) return QSE_AWK_QUICKINT_TO_VTR(v);
|
||||
|
||||
if (rtx->vmgr.ifree == QSE_NULL)
|
||||
{
|
||||
@ -775,7 +726,7 @@ qse_awk_val_t* qse_awk_rtx_makefunval (
|
||||
|
||||
int QSE_INLINE qse_awk_rtx_isstaticval (qse_awk_rtx_t* rtx, qse_awk_val_t* val)
|
||||
{
|
||||
return IS_REAL_POINTER(val) && IS_STATICVAL(val);
|
||||
return QSE_AWK_VTR_IS_POINTER(val) && IS_STATICVAL(val);
|
||||
}
|
||||
|
||||
int qse_awk_rtx_getvaltype (qse_awk_rtx_t* rtx, qse_awk_val_t* val)
|
||||
@ -793,7 +744,7 @@ void qse_awk_rtx_freeval (qse_awk_rtx_t* rtx, qse_awk_val_t* val, int cache)
|
||||
{
|
||||
qse_awk_val_type_t vtype;
|
||||
|
||||
if (IS_REAL_POINTER(val))
|
||||
if (QSE_AWK_VTR_IS_POINTER(val))
|
||||
{
|
||||
if (IS_STATICVAL(val)) return;
|
||||
|
||||
@ -888,7 +839,7 @@ void qse_awk_rtx_freeval (qse_awk_rtx_t* rtx, qse_awk_val_t* val, int cache)
|
||||
|
||||
void qse_awk_rtx_refupval (qse_awk_rtx_t* rtx, qse_awk_val_t* val)
|
||||
{
|
||||
if (IS_REAL_POINTER(val))
|
||||
if (QSE_AWK_VTR_IS_POINTER(val))
|
||||
{
|
||||
if (IS_STATICVAL(val)) return;
|
||||
|
||||
@ -903,7 +854,7 @@ void qse_awk_rtx_refupval (qse_awk_rtx_t* rtx, qse_awk_val_t* val)
|
||||
|
||||
void qse_awk_rtx_refdownval (qse_awk_rtx_t* rtx, qse_awk_val_t* val)
|
||||
{
|
||||
if (IS_REAL_POINTER(val))
|
||||
if (QSE_AWK_VTR_IS_POINTER(val))
|
||||
{
|
||||
if (IS_STATICVAL(val)) return;
|
||||
|
||||
@ -926,7 +877,7 @@ void qse_awk_rtx_refdownval (qse_awk_rtx_t* rtx, qse_awk_val_t* val)
|
||||
|
||||
void qse_awk_rtx_refdownval_nofree (qse_awk_rtx_t* rtx, qse_awk_val_t* val)
|
||||
{
|
||||
if (IS_REAL_POINTER(val))
|
||||
if (QSE_AWK_VTR_IS_POINTER(val))
|
||||
{
|
||||
if (IS_STATICVAL(val)) return;
|
||||
|
||||
|
@ -66,51 +66,67 @@ struct qse_awk_val_rchunk_t
|
||||
* add a field to indicate if a value is static.
|
||||
*
|
||||
|
||||
#define IS_STATICVAL(val) \
|
||||
((val) == QSE_NULL || \
|
||||
(val) == qse_awk_val_nil || \
|
||||
(val) == qse_awk_val_zls || \
|
||||
(val) == qse_awk_val_zero || \
|
||||
(val) == qse_awk_val_one || \
|
||||
((val) >= (qse_awk_val_t*)&awk_int[0] && \
|
||||
(val) <= (qse_awk_val_t*)&awk_int[QSE_COUNTOF(awk_int)-1]))
|
||||
#define IS_STATICVAL(val) ((val) == QSE_NULL || (val) == qse_awk_val_nil || (val) == qse_awk_val_zls)
|
||||
*/
|
||||
#define IS_STATICVAL(val) ((val)->stat)
|
||||
|
||||
|
||||
|
||||
/* qse_awk_val_t pointer encoding assumes the pointer is an even number.
|
||||
* i shift an integer within a certain range and set bit 0 to 1 to
|
||||
* encode it in a pointer. (vtr = value pointer).
|
||||
*
|
||||
* is this a safe assumption? do i have to use memalign or write my own
|
||||
* aligned malloc()? */
|
||||
#define VAL_NUM_TYPE_BITS 1
|
||||
#define VAL_MASK_TYPE_BITS 1
|
||||
#define QSE_AWK_VTR_NUM_TYPE_BITS 1
|
||||
#define QSE_AWK_VTR_MASK_TYPE_BITS 1
|
||||
|
||||
#define VAL_TYPE_BITS_POINTER 0
|
||||
#define VAL_TYPE_BITS_QUICKINT 1
|
||||
#define VAL_SIGN_BIT ((qse_uintptr_t)1 << (QSE_SIZEOF_UINTPTR_T * 8 - 1))
|
||||
#define QSE_AWK_VTR_TYPE_BITS_POINTER 0
|
||||
#define QSE_AWK_VTR_TYPE_BITS_QUICKINT 1
|
||||
#define QSE_AWK_VTR_SIGN_BIT ((qse_uintptr_t)1 << (QSE_SIZEOF_UINTPTR_T * 8 - 1))
|
||||
|
||||
/* shrink the bit range by 1 more bit to ease signbit handling.
|
||||
* i want abs(max) == abs(min).
|
||||
* i don't want abs(max) + 1 == abs(min). e.g min: -32768, max: 32767
|
||||
*/
|
||||
#define QUICKINT_MAX ((qse_awk_int_t)((~(qse_uintptr_t)0) >> (VAL_NUM_TYPE_BITS + 1)))
|
||||
#define QUICKINT_MIN (-QUICKINT_MAX)
|
||||
#define QSE_AWK_QUICKINT_MAX ((qse_awk_int_t)((~(qse_uintptr_t)0) >> (QSE_AWK_VTR_NUM_TYPE_BITS + 1)))
|
||||
#define QSE_AWK_QUICKINT_MIN (-QSE_AWK_QUICKINT_MAX)
|
||||
#define QSE_AWK_IN_QUICKINT_RANGE(i) ((i) >= QSE_AWK_QUICKINT_MIN && (i) <= QSE_AWK_QUICKINT_MAX)
|
||||
|
||||
#define IS_QUICKINT(i) ((i) >= QUICKINT_MIN && (i) <= QUICKINT_MAX)
|
||||
#define QSE_AWK_VTR_TYPE_BITS(p) (((qse_uintptr_t)(p)) & QSE_AWK_VTR_MASK_TYPE_BITS)
|
||||
#define QSE_AWK_VTR_IS_POINTER(p) (QSE_AWK_VTR_TYPE_BITS(p) == QSE_AWK_VTR_TYPE_BITS_POINTER)
|
||||
#define QSE_AWK_VTR_IS_QUICKINT(p) (QSE_AWK_VTR_TYPE_BITS(p) == QSE_AWK_VTR_TYPE_BITS_QUICKINT)
|
||||
|
||||
#define POINTER_TYPE_BITS(p) (((qse_uintptr_t)(p)) & VAL_MASK_TYPE_BITS)
|
||||
#define IS_REAL_POINTER(p) (POINTER_TYPE_BITS(p) == VAL_TYPE_BITS_POINTER)
|
||||
#define IS_QUICKINT_POINTER(p) (POINTER_TYPE_BITS(p) == VAL_TYPE_BITS_QUICKINT)
|
||||
#define QSE_AWK_QUICKINT_TO_VTR_POSITIVE(i) \
|
||||
(((qse_uintptr_t)(i) << QSE_AWK_VTR_NUM_TYPE_BITS) | QSE_AWK_VTR_TYPE_BITS_QUICKINT)
|
||||
|
||||
#define QSE_AWK_QUICKINT_TO_VTR_NEGATIVE(i) \
|
||||
((((qse_uintptr_t)-(i)) << QSE_AWK_VTR_NUM_TYPE_BITS) | QSE_AWK_VTR_TYPE_BITS_QUICKINT | QSE_AWK_VTR_SIGN_BIT)
|
||||
|
||||
#define QSE_AWK_QUICKINT_TO_VTR(i) \
|
||||
((qse_awk_val_t*)(((i) < 0)? QSE_AWK_QUICKINT_TO_VTR_NEGATIVE(i): QSE_AWK_QUICKINT_TO_VTR_POSITIVE(i)))
|
||||
|
||||
#define QSE_AWK_VTR_ZERO ((qse_awk_val_t*)QSE_AWK_QUICKINT_TO_VTR_POSITIVE(0))
|
||||
#define QSE_AWK_VTR_ONE ((qse_awk_val_t*)QSE_AWK_QUICKINT_TO_VTR_POSITIVE(1))
|
||||
#define QSE_AWK_VTR_NEGONE ((qse_awk_val_t*)QSE_AWK_QUICKINT_TO_VTR_NEGATIVE(-1))
|
||||
|
||||
/* sizeof(qse_intptr_t) may not be the same as sizeof(qse_awk_int_t).
|
||||
* so step-by-step type conversions are needed.
|
||||
* e.g) pointer to uintptr_t, uintptr_t to intptr_t, intptr_t to awk_int_t */
|
||||
#define POSITIVE_QUICKINT_FROM_POINTER(p) ((qse_intptr_t)((qse_uintptr_t)(p) >> VAL_NUM_TYPE_BITS))
|
||||
#define NEGATIVE_QUICKINT_FROM_POINTER(p) (-(qse_intptr_t)(((qse_uintptr_t)(p) & ~VAL_SIGN_BIT) >> VAL_NUM_TYPE_BITS))
|
||||
#define GET_QUICKINT_FROM_POINTER(p) (((qse_uintptr_t)(p) & VAL_SIGN_BIT)? NEGATIVE_QUICKINT_FROM_POINTER(p): POSITIVE_QUICKINT_FROM_POINTER(p))
|
||||
#define QSE_AWK_VTR_TO_QUICKINT_POSITIVE(p) \
|
||||
((qse_intptr_t)((qse_uintptr_t)(p) >> QSE_AWK_VTR_NUM_TYPE_BITS))
|
||||
#define QSE_AWK_VTR_TO_QUICKINT_NEGATIVE(p) \
|
||||
(-(qse_intptr_t)(((qse_uintptr_t)(p) & ~QSE_AWK_VTR_SIGN_BIT) >> QSE_AWK_VTR_NUM_TYPE_BITS))
|
||||
#define QSE_AWK_VTR_TO_QUICKINT(p) \
|
||||
(((qse_uintptr_t)(p) & QSE_AWK_VTR_SIGN_BIT)? QSE_AWK_VTR_TO_QUICKINT_NEGATIVE(p): QSE_AWK_VTR_TO_QUICKINT_POSITIVE(p))
|
||||
|
||||
#define QSE_AWK_RTX_GETVALTYPE(rtx,p) (IS_QUICKINT_POINTER(p)? QSE_AWK_VAL_INT: (p)->v_type)
|
||||
#define QSE_AWK_RTX_GETINTFROMVAL(rtx,p) ((IS_QUICKINT_POINTER(p)? (qse_awk_int_t)GET_QUICKINT_FROM_POINTER(p): ((qse_awk_val_int_t*)(p))->i_val))
|
||||
|
||||
#define QSE_AWK_RTX_GETVALTYPE(rtx,p) (QSE_AWK_VTR_IS_QUICKINT(p)? QSE_AWK_VAL_INT: (p)->v_type)
|
||||
#define QSE_AWK_RTX_GETINTFROMVAL(rtx,p) ((QSE_AWK_VTR_IS_QUICKINT(p)? (qse_awk_int_t)QSE_AWK_VTR_TO_QUICKINT(p): ((qse_awk_val_int_t*)(p))->i_val))
|
||||
|
||||
|
||||
#define QSE_AWK_VAL_ZERO QSE_AWK_VTR_ZERO
|
||||
#define QSE_AWK_VAL_ONE QSE_AWK_VTR_ONE
|
||||
#define QSE_AWK_VAL_NEGONE QSE_AWK_VTR_NEGONE
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
@ -122,15 +138,6 @@ extern qse_awk_val_t* qse_awk_val_nil;
|
||||
/* represents an empty string */
|
||||
extern qse_awk_val_t* qse_awk_val_zls;
|
||||
|
||||
/* represents a numeric value -1 */
|
||||
extern qse_awk_val_t* qse_awk_val_negone;
|
||||
|
||||
/* represents a numeric value 0 */
|
||||
extern qse_awk_val_t* qse_awk_val_zero;
|
||||
|
||||
/* represents a numeric value 1 */
|
||||
extern qse_awk_val_t* qse_awk_val_one;
|
||||
|
||||
|
||||
void qse_awk_rtx_freeval (
|
||||
qse_awk_rtx_t* rtx,
|
||||
|
Loading…
Reference in New Issue
Block a user