added qse_awk_valtolong() and qse_awk_valtoreal() for convenience

This commit is contained in:
hyung-hwan 2011-07-25 08:24:13 +00:00
parent b67f0ccd42
commit 5464fecddc
11 changed files with 247 additions and 238 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk.h 516 2011-07-23 09:03:48Z hyunghwan.chung $ * $Id: awk.h 518 2011-07-24 14:24:13Z hyunghwan.chung $
* *
Copyright 2006-2011 Chung, Hyung-Hwan. Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE. This file is part of QSE.
@ -578,7 +578,8 @@ typedef qse_ssize_t (*qse_awk_rio_fun_t) (
); );
/** /**
* The qse_awk_prm_t type defines primitive functions * The qse_awk_prm_t type defines primitive functions required to perform
* a set of primitive operations.
*/ */
struct qse_awk_prm_t struct qse_awk_prm_t
{ {
@ -586,8 +587,8 @@ struct qse_awk_prm_t
struct struct
{ {
qse_awk_math2_t pow; qse_awk_math2_t pow; /**< floating-point power function */
qse_awk_math2_t mod; qse_awk_math2_t mod; /**< floating-point remainder function */
qse_awk_math1_t sin; qse_awk_math1_t sin;
qse_awk_math1_t cos; qse_awk_math1_t cos;
qse_awk_math1_t tan; qse_awk_math1_t tan;
@ -2214,6 +2215,18 @@ int qse_awk_rtx_valtonum (
qse_real_t* r qse_real_t* r
); );
int qse_awk_rtx_valtolong (
qse_awk_rtx_t* rtx,
const qse_awk_val_t* val,
qse_long_t* l
);
int qse_awk_rtx_valtoreal (
qse_awk_rtx_t* rtx,
const qse_awk_val_t* val,
qse_real_t* r
);
/** /**
* The qse_awk_rtx_strtonum() function converts a string to a number. * The qse_awk_rtx_strtonum() function converts a string to a number.
* A numeric string in the valid decimal, hexadecimal(0x), binary(0b), * A numeric string in the valid decimal, hexadecimal(0x), binary(0b),

View File

@ -1,5 +1,5 @@
/* /*
* $Id: Awk.cpp 516 2011-07-23 09:03:48Z hyunghwan.chung $ * $Id: Awk.cpp 518 2011-07-24 14:24:13Z hyunghwan.chung $
* *
Copyright 2006-2011 Chung, Hyung-Hwan. Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE. This file is part of QSE.
@ -381,14 +381,12 @@ int Awk::Value::getInt (long_t* v) const
val->type != QSE_AWK_VAL_NIL && val->type != QSE_AWK_VAL_NIL &&
val->type != QSE_AWK_VAL_MAP) val->type != QSE_AWK_VAL_MAP)
{ {
real_t rv; int n = qse_awk_rtx_valtolong (run->rtx, val, &lv);
int n = qse_awk_rtx_valtonum (run->rtx, val, &lv, &rv);
if (n <= -1) if (n <= -1)
{ {
run->awk->retrieveError (run); run->awk->retrieveError (run);
return -1; return -1;
} }
if (n >= 1) lv = (long_t)rv;
} }
*v = lv; *v = lv;
@ -405,14 +403,12 @@ int Awk::Value::getReal (real_t* v) const
val->type != QSE_AWK_VAL_NIL && val->type != QSE_AWK_VAL_NIL &&
val->type != QSE_AWK_VAL_MAP) val->type != QSE_AWK_VAL_MAP)
{ {
long_t lv; int n = qse_awk_rtx_valtoreal (run->rtx, val, &rv);
int n = qse_awk_rtx_valtonum (run->rtx, val, &lv, &rv);
if (n <= -1) if (n <= -1)
{ {
run->awk->retrieveError (run); run->awk->retrieveError (run);
return -1; return -1;
} }
if (n == 0) rv = (real_t)lv;
} }
*v = rv; *v = rv;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: fnc.c 474 2011-05-23 16:52:37Z hyunghwan.chung $ * $Id: fnc.c 518 2011-07-24 14:24:13Z hyunghwan.chung $
* *
Copyright 2006-2011 Chung, Hyung-Hwan. Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE. This file is part of QSE.
@ -434,13 +434,11 @@ static int fnc_index (qse_awk_rtx_t* rtx, const qse_cstr_t* fnm)
if (nargs >= 3) if (nargs >= 3)
{ {
qse_awk_val_t* a2; qse_awk_val_t* a2;
qse_real_t rv;
int n; int n;
a2 = qse_awk_rtx_getarg (rtx, 2); a2 = qse_awk_rtx_getarg (rtx, 2);
n = qse_awk_rtx_valtonum (rtx, a2, &start, &rv); n = qse_awk_rtx_valtolong (rtx, a2, &start);
if (n <= -1) return -1; if (n <= -1) return -1;
if (n >= 1) start = (qse_long_t)rv;
} }
if (a0->type == QSE_AWK_VAL_STR) if (a0->type == QSE_AWK_VAL_STR)
@ -534,7 +532,6 @@ static int fnc_substr (qse_awk_rtx_t* rtx, const qse_cstr_t* fnm)
qse_char_t* str; qse_char_t* str;
qse_size_t len; qse_size_t len;
qse_long_t lindex, lcount; qse_long_t lindex, lcount;
qse_real_t rindex, rcount;
int n; int n;
nargs = qse_awk_rtx_getnargs (rtx); nargs = qse_awk_rtx_getnargs (rtx);
@ -555,25 +552,23 @@ static int fnc_substr (qse_awk_rtx_t* rtx, const qse_cstr_t* fnm)
if (str == QSE_NULL) return -1; if (str == QSE_NULL) return -1;
} }
n = qse_awk_rtx_valtonum (rtx, a1, &lindex, &rindex); n = qse_awk_rtx_valtolong (rtx, a1, &lindex);
if (n <= -1) if (n <= -1)
{ {
if (a0->type != QSE_AWK_VAL_STR) QSE_AWK_FREE (rtx->awk, str); if (a0->type != QSE_AWK_VAL_STR) QSE_AWK_FREE (rtx->awk, str);
return -1; return -1;
} }
if (n == 1) lindex = (qse_long_t)rindex;
if (a2 == QSE_NULL) lcount = (qse_long_t)len; if (a2 == QSE_NULL) lcount = (qse_long_t)len;
else else
{ {
n = qse_awk_rtx_valtonum (rtx, a2, &lcount, &rcount); n = qse_awk_rtx_valtolong (rtx, a2, &lcount);
if (n <= -1) if (n <= -1)
{ {
if (a0->type != QSE_AWK_VAL_STR) if (a0->type != QSE_AWK_VAL_STR)
QSE_AWK_FREE (rtx->awk, str); QSE_AWK_FREE (rtx->awk, str);
return -1; return -1;
} }
if (n == 1) lcount = (qse_long_t)rcount;
} }
lindex = lindex - 1; lindex = lindex - 1;
@ -1217,12 +1212,10 @@ static int fnc_match (qse_awk_rtx_t* rtx, const qse_cstr_t* fnm)
else else
#endif #endif
{ {
qse_real_t rv;
/* if the 3rd parameter is not an array, /* if the 3rd parameter is not an array,
* it is treated as a match start index */ * it is treated as a match start index */
n = qse_awk_rtx_valtonum (rtx, a2, &start, &rv); n = qse_awk_rtx_valtolong (rtx, a2, &start);
if (n <= -1) return -1; if (n <= -1) return -1;
if (n >= 1) start = (qse_long_t)rv;
} }
} }
@ -1401,7 +1394,6 @@ static int fnc_math_1 (
{ {
qse_size_t nargs; qse_size_t nargs;
qse_awk_val_t* a0; qse_awk_val_t* a0;
qse_long_t lv;
qse_real_t rv; qse_real_t rv;
qse_awk_val_t* r; qse_awk_val_t* r;
int n; int n;
@ -1411,9 +1403,8 @@ static int fnc_math_1 (
a0 = qse_awk_rtx_getarg (rtx, 0); a0 = qse_awk_rtx_getarg (rtx, 0);
n = qse_awk_rtx_valtonum (rtx, a0, &lv, &rv); n = qse_awk_rtx_valtoreal (rtx, a0, &rv);
if (n <= -1) return -1; if (n <= -1) return -1;
if (n == 0) rv = (qse_real_t)lv;
r = qse_awk_rtx_makerealval (rtx, f (rtx->awk, rv)); r = qse_awk_rtx_makerealval (rtx, f (rtx->awk, rv));
if (r == QSE_NULL) return -1; if (r == QSE_NULL) return -1;
@ -1427,7 +1418,6 @@ static int fnc_math_2 (
{ {
qse_size_t nargs; qse_size_t nargs;
qse_awk_val_t* a0, * a1; qse_awk_val_t* a0, * a1;
qse_long_t lv0, lv1;
qse_real_t rv0, rv1; qse_real_t rv0, rv1;
qse_awk_val_t* r; qse_awk_val_t* r;
int n; int n;
@ -1438,13 +1428,11 @@ static int fnc_math_2 (
a0 = qse_awk_rtx_getarg (rtx, 0); a0 = qse_awk_rtx_getarg (rtx, 0);
a1 = qse_awk_rtx_getarg (rtx, 1); a1 = qse_awk_rtx_getarg (rtx, 1);
n = qse_awk_rtx_valtonum (rtx, a0, &lv0, &rv0); n = qse_awk_rtx_valtoreal (rtx, a0, &rv0);
if (n <= -1) return -1; if (n <= -1) return -1;
if (n == 0) rv0 = (qse_real_t)lv0;
n = qse_awk_rtx_valtonum (rtx, a1, &lv1, &rv1); n = qse_awk_rtx_valtoreal (rtx, a1, &rv1);
if (n <= -1) return -1; if (n <= -1) return -1;
if (n == 0) rv1 = (qse_real_t)lv1;
r = qse_awk_rtx_makerealval (rtx, f (rtx->awk, rv0, rv1)); r = qse_awk_rtx_makerealval (rtx, f (rtx->awk, rv0, rv1));
if (r == QSE_NULL) return -1; if (r == QSE_NULL) return -1;
@ -1491,7 +1479,6 @@ static int fnc_int (qse_awk_rtx_t* run, const qse_cstr_t* fnm)
qse_size_t nargs; qse_size_t nargs;
qse_awk_val_t* a0; qse_awk_val_t* a0;
qse_long_t lv; qse_long_t lv;
qse_real_t rv;
qse_awk_val_t* r; qse_awk_val_t* r;
int n; int n;
@ -1500,9 +1487,8 @@ static int fnc_int (qse_awk_rtx_t* run, const qse_cstr_t* fnm)
a0 = qse_awk_rtx_getarg (run, 0); a0 = qse_awk_rtx_getarg (run, 0);
n = qse_awk_rtx_valtonum (run, a0, &lv, &rv); n = qse_awk_rtx_valtolong (run, a0, &lv);
if (n <= -1) return -1; if (n <= -1) return -1;
if (n == 1) lv = (qse_long_t)rv;
r = qse_awk_rtx_makeintval (run, lv); r = qse_awk_rtx_makeintval (run, lv);
if (r == QSE_NULL) return -1; if (r == QSE_NULL) return -1;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: parse.c 517 2011-07-23 16:17:15Z hyunghwan.chung $ * $Id: parse.c 518 2011-07-24 14:24:13Z hyunghwan.chung $
* *
Copyright 2006-2011 Chung, Hyung-Hwan. Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE. This file is part of QSE.
@ -4057,11 +4057,10 @@ static qse_awk_nde_t* parse_unary (
folded.r = !((qse_awk_nde_real_t*)left)->val; folded.r = !((qse_awk_nde_real_t*)left)->val;
break; break;
/*
case QSE_AWK_UNROP_BNOT: case QSE_AWK_UNROP_BNOT:
folded.r = ~((qse_awk_nde_real_t*)left)->val; folded.l = ~((qse_long_t)((qse_awk_nde_real_t*)left)->val);
fold = QSE_AWK_NDE_INT;
break; break;
*/
default: default:
fold = -1; fold = -1;
@ -4072,26 +4071,72 @@ static qse_awk_nde_t* parse_unary (
switch (fold) switch (fold)
{ {
case QSE_AWK_NDE_INT: case QSE_AWK_NDE_INT:
QSE_ASSERT (left->type == fold); if (left->type == fold)
((qse_awk_nde_int_t*)left)->val = folded.l;
if (((qse_awk_nde_int_t*)left)->str)
{ {
QSE_AWK_FREE (awk, ((qse_awk_nde_int_t*)left)->str); ((qse_awk_nde_int_t*)left)->val = folded.l;
((qse_awk_nde_int_t*)left)->str = QSE_NULL; if (((qse_awk_nde_int_t*)left)->str)
((qse_awk_nde_int_t*)left)->len = 0; {
QSE_AWK_FREE (awk, ((qse_awk_nde_int_t*)left)->str);
((qse_awk_nde_int_t*)left)->str = QSE_NULL;
((qse_awk_nde_int_t*)left)->len = 0;
}
return left;
}
else
{
qse_awk_nde_int_t* tmp;
QSE_ASSERT (left->type == QSE_AWK_NDE_REAL);
qse_awk_clrpt (awk, left);
tmp = (qse_awk_nde_int_t*) QSE_AWK_ALLOC (
awk, QSE_SIZEOF(qse_awk_nde_int_t));
if (tmp == QSE_NULL)
{
SETERR_LOC (awk, QSE_AWK_ENOMEM, xloc);
return QSE_NULL;
}
QSE_MEMSET (tmp, 0, QSE_SIZEOF(qse_awk_nde_int_t));
tmp->type = QSE_AWK_NDE_INT;
tmp->loc = *xloc;
tmp->val = folded.l;
return (qse_awk_nde_t*)tmp;
} }
return left;
case QSE_AWK_NDE_REAL: case QSE_AWK_NDE_REAL:
QSE_ASSERT (left->type == fold); if (left->type == fold)
((qse_awk_nde_real_t*)left)->val = folded.r;
if (((qse_awk_nde_real_t*)left)->str)
{ {
QSE_AWK_FREE (awk, ((qse_awk_nde_real_t*)left)->str); ((qse_awk_nde_real_t*)left)->val = folded.r;
((qse_awk_nde_real_t*)left)->str = QSE_NULL; if (((qse_awk_nde_real_t*)left)->str)
((qse_awk_nde_real_t*)left)->len = 0; {
QSE_AWK_FREE (awk, ((qse_awk_nde_real_t*)left)->str);
((qse_awk_nde_real_t*)left)->str = QSE_NULL;
((qse_awk_nde_real_t*)left)->len = 0;
}
return left;
}
else
{
qse_awk_nde_real_t* tmp;
QSE_ASSERT (left->type == QSE_AWK_NDE_INT);
qse_awk_clrpt (awk, left);
tmp = (qse_awk_nde_real_t*) QSE_AWK_ALLOC (
awk, QSE_SIZEOF(qse_awk_nde_real_t));
if (tmp == QSE_NULL)
{
SETERR_LOC (awk, QSE_AWK_ENOMEM, xloc);
return QSE_NULL;
}
QSE_MEMSET (tmp, 0, QSE_SIZEOF(qse_awk_nde_real_t));
tmp->type = QSE_AWK_NDE_REAL;
tmp->loc = *xloc;
tmp->val = folded.r;
return (qse_awk_nde_t*)tmp;
} }
return left;
default: default:
{ {

View File

@ -1,5 +1,5 @@
/* /*
* $Id: run.c 517 2011-07-23 16:17:15Z hyunghwan.chung $ * $Id: run.c 518 2011-07-24 14:24:13Z hyunghwan.chung $
* *
Copyright 2006-2011 Chung, Hyung-Hwan. Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE. This file is part of QSE.
@ -368,11 +368,9 @@ static int set_global (
{ {
int n; int n;
qse_long_t lv; qse_long_t lv;
qse_real_t rv;
n = qse_awk_rtx_valtonum (rtx, val, &lv, &rv); n = qse_awk_rtx_valtolong (rtx, val, &lv);
if (n == -1) return -1; if (n <= -1) return -1;
if (n == 1) lv = (qse_long_t)rv;
rtx->gbl.fnr = lv; rtx->gbl.fnr = lv;
break; break;
@ -444,11 +442,9 @@ static int set_global (
{ {
int n; int n;
qse_long_t lv; qse_long_t lv;
qse_real_t rv;
n = qse_awk_rtx_valtonum (rtx, val, &lv, &rv); n = qse_awk_rtx_valtolong (rtx, val, &lv);
if (n <= -1) return -1; if (n <= -1) return -1;
if (n == 1) lv = (qse_long_t)rv;
if (lv < (qse_long_t)rtx->inrec.nflds) if (lv < (qse_long_t)rtx->inrec.nflds)
{ {
@ -469,11 +465,9 @@ static int set_global (
{ {
int n; int n;
qse_long_t lv; qse_long_t lv;
qse_real_t rv;
n = qse_awk_rtx_valtonum (rtx, val, &lv, &rv); n = qse_awk_rtx_valtolong (rtx, val, &lv);
if (n <= -1) return -1; if (n <= -1) return -1;
if (n == 1) lv = (qse_long_t)rv;
rtx->gbl.nr = lv; rtx->gbl.nr = lv;
break; break;
@ -3607,7 +3601,6 @@ static qse_awk_val_t* do_assignment_pos (
{ {
qse_awk_val_t* v; qse_awk_val_t* v;
qse_long_t lv; qse_long_t lv;
qse_real_t rv;
qse_xstr_t str; qse_xstr_t str;
int n; int n;
@ -3615,15 +3608,15 @@ static qse_awk_val_t* do_assignment_pos (
if (v == QSE_NULL) return QSE_NULL; if (v == QSE_NULL) return QSE_NULL;
qse_awk_rtx_refupval (run, v); qse_awk_rtx_refupval (run, v);
n = qse_awk_rtx_valtonum (run, v, &lv, &rv); n = qse_awk_rtx_valtolong (run, v, &lv);
qse_awk_rtx_refdownval (run, v); qse_awk_rtx_refdownval (run, v);
if (n == -1) if (n <= -1)
{ {
SETERR_LOC (run, QSE_AWK_EPOSIDX, &pos->loc); SETERR_LOC (run, QSE_AWK_EPOSIDX, &pos->loc);
return QSE_NULL; return QSE_NULL;
} }
if (n == 1) lv = (qse_long_t)rv;
if (!IS_VALID_POSIDX(lv)) if (!IS_VALID_POSIDX(lv))
{ {
SETERR_LOC (run, QSE_AWK_EPOSIDX, &pos->loc); SETERR_LOC (run, QSE_AWK_EPOSIDX, &pos->loc);
@ -3925,80 +3918,46 @@ static qse_awk_val_t* eval_binop_in (
static qse_awk_val_t* eval_binop_bor ( static qse_awk_val_t* eval_binop_bor (
qse_awk_rtx_t* rtx, qse_awk_val_t* left, qse_awk_val_t* right) qse_awk_rtx_t* rtx, qse_awk_val_t* left, qse_awk_val_t* right)
{ {
int n1, n2, n3;
qse_long_t l1, l2; qse_long_t l1, l2;
qse_real_t r1, r2;
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1); if (qse_awk_rtx_valtolong (rtx, left, &l1) <= -1 ||
n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2); qse_awk_rtx_valtolong (rtx, right, &l2) <= -1)
if (n1 == -1 || n2 == -1)
{ {
SETERR_COD (rtx, QSE_AWK_EOPERAND); SETERR_COD (rtx, QSE_AWK_EOPERAND);
return QSE_NULL; return QSE_NULL;
} }
n3 = n1 + (n2 << 1); return qse_awk_rtx_makeintval (rtx, l1 | l2);
QSE_ASSERT (n3 >= 0 && n3 <= 3);
return qse_awk_rtx_makeintval (rtx,
(n3 == 0)? ((qse_long_t)l1 | (qse_long_t)l2):
(n3 == 1)? ((qse_long_t)r1 | (qse_long_t)l2):
(n3 == 2)? ((qse_long_t)l1 | (qse_long_t)r2):
((qse_long_t)r1 | (qse_long_t)r2));
} }
static qse_awk_val_t* eval_binop_bxor ( static qse_awk_val_t* eval_binop_bxor (
qse_awk_rtx_t* rtx, qse_awk_val_t* left, qse_awk_val_t* right) qse_awk_rtx_t* rtx, qse_awk_val_t* left, qse_awk_val_t* right)
{ {
int n1, n2, n3;
qse_long_t l1, l2; qse_long_t l1, l2;
qse_real_t r1, r2;
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1); if (qse_awk_rtx_valtolong (rtx, left, &l1) <= -1 ||
n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2); qse_awk_rtx_valtolong (rtx, right, &l2) <= -1)
if (n1 == -1 || n2 == -1)
{ {
SETERR_COD (rtx, QSE_AWK_EOPERAND); SETERR_COD (rtx, QSE_AWK_EOPERAND);
return QSE_NULL; return QSE_NULL;
} }
n3 = n1 + (n2 << 1); return qse_awk_rtx_makeintval (rtx, l1 ^ l2);
QSE_ASSERT (n3 >= 0 && n3 <= 3);
return qse_awk_rtx_makeintval (rtx,
(n3 == 0)? ((qse_long_t)l1 ^ (qse_long_t)l2):
(n3 == 1)? ((qse_long_t)r1 ^ (qse_long_t)l2):
(n3 == 2)? ((qse_long_t)l1 ^ (qse_long_t)r2):
((qse_long_t)r1 ^ (qse_long_t)r2));
} }
static qse_awk_val_t* eval_binop_band ( static qse_awk_val_t* eval_binop_band (
qse_awk_rtx_t* rtx, qse_awk_val_t* left, qse_awk_val_t* right) qse_awk_rtx_t* rtx, qse_awk_val_t* left, qse_awk_val_t* right)
{ {
int n1, n2, n3;
qse_long_t l1, l2; qse_long_t l1, l2;
qse_real_t r1, r2;
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1); if (qse_awk_rtx_valtolong (rtx, left, &l1) <= -1 ||
n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2); qse_awk_rtx_valtolong (rtx, right, &l2) <= -1)
if (n1 == -1 || n2 == -1)
{ {
SETERR_COD (rtx, QSE_AWK_EOPERAND); SETERR_COD (rtx, QSE_AWK_EOPERAND);
return QSE_NULL; return QSE_NULL;
} }
n3 = n1 + (n2 << 1); return qse_awk_rtx_makeintval (rtx, l1 & l2);
QSE_ASSERT (n3 >= 0 && n3 <= 3);
return qse_awk_rtx_makeintval (rtx,
(n3 == 0)? ((qse_long_t)l1 & (qse_long_t)l2):
(n3 == 1)? ((qse_long_t)r1 & (qse_long_t)l2):
(n3 == 2)? ((qse_long_t)l1 & (qse_long_t)r2):
((qse_long_t)r1 & (qse_long_t)r2));
} }
static int __cmp_nil_nil ( static int __cmp_nil_nil (
@ -4376,58 +4335,31 @@ static qse_awk_val_t* eval_binop_le (
static qse_awk_val_t* eval_binop_lshift ( static qse_awk_val_t* eval_binop_lshift (
qse_awk_rtx_t* rtx, qse_awk_val_t* left, qse_awk_val_t* right) qse_awk_rtx_t* rtx, qse_awk_val_t* left, qse_awk_val_t* right)
{ {
int n1, n2, n3;
qse_long_t l1, l2; qse_long_t l1, l2;
qse_real_t r1, r2;
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1); if (qse_awk_rtx_valtolong (rtx, left, &l1) <= -1 ||
n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2); qse_awk_rtx_valtolong (rtx, right, &l2) <= -1)
if (n1 == -1 || n2 == -1)
{ {
SETERR_COD (rtx, QSE_AWK_EOPERAND); SETERR_COD (rtx, QSE_AWK_EOPERAND);
return QSE_NULL; return QSE_NULL;
} }
n3 = n1 + (n2 << 1); return qse_awk_rtx_makeintval (rtx, l1 << l2);
if (n3 == 0)
{
return qse_awk_rtx_makeintval (rtx, (qse_long_t)l1<<(qse_long_t)l2);
}
else
{
SETERR_COD (rtx, QSE_AWK_EOPERAND);
return QSE_NULL;
}
} }
static qse_awk_val_t* eval_binop_rshift ( static qse_awk_val_t* eval_binop_rshift (
qse_awk_rtx_t* rtx, qse_awk_val_t* left, qse_awk_val_t* right) qse_awk_rtx_t* rtx, qse_awk_val_t* left, qse_awk_val_t* right)
{ {
int n1, n2, n3;
qse_long_t l1, l2; qse_long_t l1, l2;
qse_real_t r1, r2;
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1); if (qse_awk_rtx_valtolong (rtx, left, &l1) <= -1 ||
n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2); qse_awk_rtx_valtolong (rtx, right, &l2) <= -1)
if (n1 == -1 || n2 == -1)
{ {
SETERR_COD (rtx, QSE_AWK_EOPERAND); SETERR_COD (rtx, QSE_AWK_EOPERAND);
return QSE_NULL; return QSE_NULL;
} }
n3 = n1 + (n2 << 1); return qse_awk_rtx_makeintval (rtx, l1 >> l2);
if (n3 == 0)
{
return qse_awk_rtx_makeintval (
rtx, (qse_long_t)l1>>(qse_long_t)l2);
}
else
{
SETERR_COD (rtx, QSE_AWK_EOPERAND);
return QSE_NULL;
}
} }
static qse_awk_val_t* eval_binop_plus ( static qse_awk_val_t* eval_binop_plus (
@ -4440,7 +4372,7 @@ static qse_awk_val_t* eval_binop_plus (
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1); n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1);
n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2); n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2);
if (n1 == -1 || n2 == -1) if (n1 <= -1 || n2 <= -1)
{ {
SETERR_COD (rtx, QSE_AWK_EOPERAND); SETERR_COD (rtx, QSE_AWK_EOPERAND);
return QSE_NULL; return QSE_NULL;
@ -4471,7 +4403,7 @@ static qse_awk_val_t* eval_binop_minus (
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1); n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1);
n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2); n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2);
if (n1 == -1 || n2 == -1) if (n1 <= -1 || n2 <= -1)
{ {
SETERR_COD (rtx, QSE_AWK_EOPERAND); SETERR_COD (rtx, QSE_AWK_EOPERAND);
return QSE_NULL; return QSE_NULL;
@ -4495,7 +4427,7 @@ static qse_awk_val_t* eval_binop_mul (
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1); n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1);
n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2); n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2);
if (n1 == -1 || n2 == -1) if (n1 <= -1 || n2 <= -1)
{ {
SETERR_COD (rtx, QSE_AWK_EOPERAND); SETERR_COD (rtx, QSE_AWK_EOPERAND);
return QSE_NULL; return QSE_NULL;
@ -4520,7 +4452,7 @@ static qse_awk_val_t* eval_binop_div (
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1); n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1);
n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2); n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2);
if (n1 == -1 || n2 == -1) if (n1 <= -1 || n2 <= -1)
{ {
SETERR_COD (rtx, QSE_AWK_EOPERAND); SETERR_COD (rtx, QSE_AWK_EOPERAND);
return QSE_NULL; return QSE_NULL;
@ -4578,7 +4510,7 @@ static qse_awk_val_t* eval_binop_idiv (
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1); n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1);
n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2); n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2);
if (n1 == -1 || n2 == -1) if (n1 <= -1 || n2 <= -1)
{ {
SETERR_COD (rtx, QSE_AWK_EOPERAND); SETERR_COD (rtx, QSE_AWK_EOPERAND);
return QSE_NULL; return QSE_NULL;
@ -4631,7 +4563,7 @@ static qse_awk_val_t* eval_binop_mod (
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1); n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1);
n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2); n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2);
if (n1 == -1 || n2 == -1) if (n1 <= -1 || n2 <= -1)
{ {
SETERR_COD (rtx, QSE_AWK_EOPERAND); SETERR_COD (rtx, QSE_AWK_EOPERAND);
return QSE_NULL; return QSE_NULL;
@ -4690,7 +4622,7 @@ static qse_awk_val_t* eval_binop_exp (
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1); n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1);
n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2); n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2);
if (n1 == -1 || n2 == -1) if (n1 <= -1 || n2 <= -1)
{ {
SETERR_COD (rtx, QSE_AWK_EOPERAND); SETERR_COD (rtx, QSE_AWK_EOPERAND);
return QSE_NULL; return QSE_NULL;
@ -5001,7 +4933,7 @@ static qse_awk_val_t* eval_unary (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
{ {
case QSE_AWK_UNROP_MINUS: case QSE_AWK_UNROP_MINUS:
n = qse_awk_rtx_valtonum (run, left, &l, &r); n = qse_awk_rtx_valtonum (run, left, &l, &r);
if (n == -1) goto exit_func; if (n <= -1) goto exit_func;
res = (n == 0)? qse_awk_rtx_makeintval (run, -l): res = (n == 0)? qse_awk_rtx_makeintval (run, -l):
qse_awk_rtx_makerealval (run, -r); qse_awk_rtx_makerealval (run, -r);
@ -5016,7 +4948,7 @@ static qse_awk_val_t* eval_unary (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
else else
{ {
n = qse_awk_rtx_valtonum (run, left, &l, &r); n = qse_awk_rtx_valtonum (run, left, &l, &r);
if (n == -1) goto exit_func; if (n <= -1) goto exit_func;
res = (n == 0)? qse_awk_rtx_makeintval (run, !l): res = (n == 0)? qse_awk_rtx_makeintval (run, !l):
qse_awk_rtx_makerealval (run, !r); qse_awk_rtx_makerealval (run, !r);
@ -5024,16 +4956,15 @@ static qse_awk_val_t* eval_unary (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
break; break;
case QSE_AWK_UNROP_BNOT: case QSE_AWK_UNROP_BNOT:
n = qse_awk_rtx_valtonum (run, left, &l, &r); n = qse_awk_rtx_valtolong (run, left, &l);
if (n == -1) goto exit_func; if (n <= -1) goto exit_func;
if (n == 1) l = (qse_long_t)r;
res = qse_awk_rtx_makeintval (run, ~l); res = qse_awk_rtx_makeintval (run, ~l);
break; break;
case QSE_AWK_UNROP_PLUS: case QSE_AWK_UNROP_PLUS:
n = qse_awk_rtx_valtonum (run, left, &l, &r); n = qse_awk_rtx_valtonum (run, left, &l, &r);
if (n == -1) goto exit_func; if (n <= -1) goto exit_func;
res = (n == 0)? qse_awk_rtx_makeintval (run, l): res = (n == 0)? qse_awk_rtx_makeintval (run, l):
qse_awk_rtx_makerealval (run, r); qse_awk_rtx_makerealval (run, r);
@ -5102,7 +5033,7 @@ static qse_awk_val_t* eval_incpre (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
int n; int n;
n = qse_awk_rtx_valtonum (run, left, &v1, &v2); n = qse_awk_rtx_valtonum (run, left, &v1, &v2);
if (n == -1) if (n <= -1)
{ {
qse_awk_rtx_refdownval (run, left); qse_awk_rtx_refdownval (run, left);
ADJERR_LOC (run, &nde->loc); ADJERR_LOC (run, &nde->loc);
@ -5275,7 +5206,7 @@ static qse_awk_val_t* eval_incpst (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
int n; int n;
n = qse_awk_rtx_valtonum (run, left, &v1, &v2); n = qse_awk_rtx_valtonum (run, left, &v1, &v2);
if (n == -1) if (n <= -1)
{ {
qse_awk_rtx_refdownval (run, left); qse_awk_rtx_refdownval (run, left);
ADJERR_LOC (run, &nde->loc); ADJERR_LOC (run, &nde->loc);
@ -6012,7 +5943,6 @@ static int get_reference (
{ {
int n; int n;
qse_long_t lv; qse_long_t lv;
qse_real_t rv;
qse_awk_val_t* v; qse_awk_val_t* v;
/* the position number is returned for the positional /* the position number is returned for the positional
@ -6021,15 +5951,15 @@ static int get_reference (
if (v == QSE_NULL) return -1; if (v == QSE_NULL) return -1;
qse_awk_rtx_refupval (run, v); qse_awk_rtx_refupval (run, v);
n = qse_awk_rtx_valtonum (run, v, &lv, &rv); n = qse_awk_rtx_valtolong (run, v, &lv);
qse_awk_rtx_refdownval (run, v); qse_awk_rtx_refdownval (run, v);
if (n == -1) if (n <= -1)
{ {
SETERR_LOC (run, QSE_AWK_EPOSIDX, &nde->loc); SETERR_LOC (run, QSE_AWK_EPOSIDX, &nde->loc);
return -1; return -1;
} }
if (n == 1) lv = (qse_long_t)rv;
if (!IS_VALID_POSIDX(lv)) if (!IS_VALID_POSIDX(lv))
{ {
SETERR_LOC (run, QSE_AWK_EPOSIDX, &nde->loc); SETERR_LOC (run, QSE_AWK_EPOSIDX, &nde->loc);
@ -6281,21 +6211,19 @@ static qse_awk_val_t* eval_pos (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
qse_awk_nde_pos_t* pos = (qse_awk_nde_pos_t*)nde; qse_awk_nde_pos_t* pos = (qse_awk_nde_pos_t*)nde;
qse_awk_val_t* v; qse_awk_val_t* v;
qse_long_t lv; qse_long_t lv;
qse_real_t rv;
int n; int n;
v = eval_expression (run, pos->val); v = eval_expression (run, pos->val);
if (v == QSE_NULL) return QSE_NULL; if (v == QSE_NULL) return QSE_NULL;
qse_awk_rtx_refupval (run, v); qse_awk_rtx_refupval (run, v);
n = qse_awk_rtx_valtonum (run, v, &lv, &rv); n = qse_awk_rtx_valtolong (run, v, &lv);
qse_awk_rtx_refdownval (run, v); qse_awk_rtx_refdownval (run, v);
if (n == -1) if (n <= -1)
{ {
SETERR_LOC (run, QSE_AWK_EPOSIDX, &nde->loc); SETERR_LOC (run, QSE_AWK_EPOSIDX, &nde->loc);
return QSE_NULL; return QSE_NULL;
} }
if (n == 1) lv = (qse_long_t)rv;
if (lv < 0) if (lv < 0)
{ {
@ -6734,36 +6662,37 @@ qse_char_t* qse_awk_rtx_format (
qse_size_t stack_arg_idx = 1; qse_size_t stack_arg_idx = 1;
qse_awk_val_t* val; qse_awk_val_t* val;
#define OUT_CHAR(c) \ #define OUT_CHAR(c) QSE_BLOCK( \
do { \ if (qse_str_ccat (out, (c)) == -1) \
if (qse_str_ccat (out, (c)) == -1) \ { \
{ \ SETERR_COD (rtx, QSE_AWK_ENOMEM); \
SETERR_COD (rtx, QSE_AWK_ENOMEM); \ return QSE_NULL; \
return QSE_NULL; \ } \
} \ )
} while (0)
#define FMT_CHAR(c) \ #define FMT_CHAR(c) QSE_BLOCK( \
do { \ if (qse_str_ccat (fbu, (c)) == -1) \
if (qse_str_ccat (fbu, (c)) == -1) \ { \
{ \ SETERR_COD (rtx, QSE_AWK_ENOMEM); \
SETERR_COD (rtx, QSE_AWK_ENOMEM); \ return QSE_NULL; \
return QSE_NULL; \ } \
} \ )
} while (0)
#define GROW(buf) \ #define GROW(buf) QSE_BLOCK( \
do { \ if ((buf)->ptr != QSE_NULL) \
if ((buf)->ptr != QSE_NULL) \ { \
{ \ QSE_AWK_FREE (rtx->awk, (buf)->ptr); \
QSE_AWK_FREE (rtx->awk, (buf)->ptr); \ (buf)->ptr = QSE_NULL; \
(buf)->ptr = QSE_NULL; \ } \
} \ (buf)->len += (buf)->inc; \
(buf)->len += (buf)->inc; \ (buf)->ptr = (qse_char_t*)QSE_AWK_ALLOC ( \
(buf)->ptr = (qse_char_t*)QSE_AWK_ALLOC ( \ rtx->awk, (buf)->len * QSE_SIZEOF(qse_char_t)); \
rtx->awk, (buf)->len * QSE_SIZEOF(qse_char_t)); \ if ((buf)->ptr == QSE_NULL) \
if ((buf)->ptr == QSE_NULL) (buf)->len = 0; \ { \
} while (0) SETERR_COD (rtx, QSE_AWK_ENOMEM); \
(buf)->len = 0; \
} \
)
QSE_ASSERTX (rtx->format.tmp.ptr != QSE_NULL, QSE_ASSERTX (rtx->format.tmp.ptr != QSE_NULL,
"run->format.tmp.ptr should have been assigned a pointer to a block of memory before this function has been called"); "run->format.tmp.ptr should have been assigned a pointer to a block of memory before this function has been called");
@ -6808,7 +6737,6 @@ qse_char_t* qse_awk_rtx_format (
if (i < fmt_len && fmt[i] == QSE_T('*')) if (i < fmt_len && fmt[i] == QSE_T('*'))
{ {
qse_awk_val_t* v; qse_awk_val_t* v;
qse_real_t r;
qse_char_t* p; qse_char_t* p;
int n; int n;
@ -6840,11 +6768,9 @@ qse_char_t* qse_awk_rtx_format (
} }
qse_awk_rtx_refupval (rtx, v); qse_awk_rtx_refupval (rtx, v);
n = qse_awk_rtx_valtonum (rtx, v, &width, &r); n = qse_awk_rtx_valtolong (rtx, v, &width);
qse_awk_rtx_refdownval (rtx, v); qse_awk_rtx_refdownval (rtx, v);
if (n <= -1) return QSE_NULL;
if (n == -1) return QSE_NULL;
if (n == 1) width = (qse_long_t)r;
do do
{ {
@ -6904,7 +6830,6 @@ qse_char_t* qse_awk_rtx_format (
if (i < fmt_len && fmt[i] == QSE_T('*')) if (i < fmt_len && fmt[i] == QSE_T('*'))
{ {
qse_awk_val_t* v; qse_awk_val_t* v;
qse_real_t r;
qse_char_t* p; qse_char_t* p;
int n; int n;
@ -6936,28 +6861,18 @@ qse_char_t* qse_awk_rtx_format (
} }
qse_awk_rtx_refupval (rtx, v); qse_awk_rtx_refupval (rtx, v);
n = qse_awk_rtx_valtonum (rtx, v, &prec, &r); n = qse_awk_rtx_valtolong (rtx, v, &prec);
qse_awk_rtx_refdownval (rtx, v); qse_awk_rtx_refdownval (rtx, v);
if (n <= -1) return QSE_NULL;
if (n == -1) return QSE_NULL;
if (n == 1) prec = (qse_long_t)r;
do do
{ {
n = rtx->awk->prm.sprintf ( n = qse_awk_sprintlong (
rtx->awk, rtx->awk,
rtx->format.tmp.ptr, rtx->format.tmp.ptr,
rtx->format.tmp.len, rtx->format.tmp.len,
#if QSE_SIZEOF_LONG_LONG > 0 prec
QSE_T("%lld"), (long long)prec );
#elif QSE_SIZEOF___INT64 > 0
QSE_T("%I64d"), (__int64)prec
#elif QSE_SIZEOF_LONG > 0
QSE_T("%ld"), (long)prec
#elif QSE_SIZEOF_INT > 0
QSE_T("%d"), (int)prec
#endif
);
if (n == -1) if (n == -1)
{ {
GROW (&rtx->format.tmp); GROW (&rtx->format.tmp);
@ -6966,7 +6881,6 @@ qse_char_t* qse_awk_rtx_format (
SETERR_COD (rtx, QSE_AWK_ENOMEM); SETERR_COD (rtx, QSE_AWK_ENOMEM);
return QSE_NULL; return QSE_NULL;
} }
continue; continue;
} }
@ -7007,7 +6921,6 @@ qse_char_t* qse_awk_rtx_format (
{ {
qse_awk_val_t* v; qse_awk_val_t* v;
qse_long_t l; qse_long_t l;
qse_real_t r;
qse_char_t* p; qse_char_t* p;
int n; int n;
@ -7057,11 +6970,9 @@ qse_char_t* qse_awk_rtx_format (
} }
qse_awk_rtx_refupval (rtx, v); qse_awk_rtx_refupval (rtx, v);
n = qse_awk_rtx_valtonum (rtx, v, &l, &r); n = qse_awk_rtx_valtolong (rtx, v, &l);
qse_awk_rtx_refdownval (rtx, v); qse_awk_rtx_refdownval (rtx, v);
if (n <= -1) return QSE_NULL;
if (n == -1) return QSE_NULL;
if (n == 1) l = (qse_long_t)r;
do do
{ {
@ -7079,7 +6990,7 @@ qse_char_t* qse_awk_rtx_format (
#elif QSE_SIZEOF_INT > 0 #elif QSE_SIZEOF_INT > 0
(int)l (int)l
#endif #endif
); );
if (n == -1) if (n == -1)
{ {
@ -7109,7 +7020,6 @@ qse_char_t* qse_awk_rtx_format (
fmt[i] == QSE_T('f')) fmt[i] == QSE_T('f'))
{ {
qse_awk_val_t* v; qse_awk_val_t* v;
qse_long_t l;
qse_real_t r; qse_real_t r;
qse_char_t* p; qse_char_t* p;
int n; int n;
@ -7145,11 +7055,9 @@ qse_char_t* qse_awk_rtx_format (
} }
qse_awk_rtx_refupval (rtx, v); qse_awk_rtx_refupval (rtx, v);
n = qse_awk_rtx_valtonum (rtx, v, &l, &r); n = qse_awk_rtx_valtoreal (rtx, v, &r);
qse_awk_rtx_refdownval (rtx, v); qse_awk_rtx_refdownval (rtx, v);
if (n <= -1) return QSE_NULL;
if (n == -1) return QSE_NULL;
if (n == 0) r = (qse_real_t)l;
do do
{ {

View File

@ -1,5 +1,5 @@
/* /*
* $Id: std.c 516 2011-07-23 09:03:48Z hyunghwan.chung $ * $Id: std.c 518 2011-07-24 14:24:13Z hyunghwan.chung $
* *
Copyright 2006-2011 Chung, Hyung-Hwan. Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE. This file is part of QSE.
@ -1394,7 +1394,6 @@ static int fnc_srand (qse_awk_rtx_t* run, const qse_cstr_t* fnm)
qse_size_t nargs; qse_size_t nargs;
qse_awk_val_t* a0; qse_awk_val_t* a0;
qse_long_t lv; qse_long_t lv;
qse_real_t rv;
qse_awk_val_t* r; qse_awk_val_t* r;
int n; int n;
unsigned int prev; unsigned int prev;
@ -1409,22 +1408,19 @@ static int fnc_srand (qse_awk_rtx_t* run, const qse_cstr_t* fnm)
if (nargs == 1) if (nargs == 1)
{ {
a0 = qse_awk_rtx_getarg (run, 0); a0 = qse_awk_rtx_getarg (run, 0);
n = qse_awk_rtx_valtolong (run, a0, &lv);
n = qse_awk_rtx_valtonum (run, a0, &lv, &rv);
if (n <= -1) return -1; if (n <= -1) return -1;
if (n >= 1) lv = (qse_long_t)rv;
rxtn->seed = lv; rxtn->seed = lv;
} }
else else
{ {
qse_ntime_t now; qse_ntime_t now;
if (qse_gettime(&now) <= -1) rxtn->seed >>= 1; if (qse_gettime(&now) <= -1) rxtn->seed >>= 1;
else rxtn->seed = (unsigned int)now; else rxtn->seed = (unsigned int)now;
} }
srand (rxtn->seed); srand (rxtn->seed);
r = qse_awk_rtx_makeintval (run, prev); r = qse_awk_rtx_makeintval (run, prev);
if (r == QSE_NULL) return -1; if (r == QSE_NULL) return -1;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: val.c 484 2011-05-25 15:32:10Z hyunghwan.chung $ * $Id: val.c 518 2011-07-24 14:24:13Z hyunghwan.chung $
* *
Copyright 2006-2011 Chung, Hyung-Hwan. Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE. This file is part of QSE.
@ -1173,6 +1173,35 @@ int qse_awk_rtx_valtonum (
return -1; /* error */ return -1; /* error */
} }
int qse_awk_rtx_valtolong (
qse_awk_rtx_t* rtx, const qse_awk_val_t* v, qse_long_t* l)
{
int n;
qse_real_t r;
n = qse_awk_rtx_valtonum (rtx, v, l, &r);
if (n == 1)
{
*l = (qse_long_t)r;
n = 0;
}
return n;
}
int qse_awk_rtx_valtoreal (
qse_awk_rtx_t* rtx, const qse_awk_val_t* v, qse_real_t* r)
{
int n;
qse_long_t l;
n = qse_awk_rtx_valtonum (rtx, v, &l, r);
if (n == 0) *r = (qse_real_t)l;
else if (n == 1) n = 0;
return n;
}
int qse_awk_rtx_strtonum ( int qse_awk_rtx_strtonum (
qse_awk_rtx_t* rtx, int strict, qse_awk_rtx_t* rtx, int strict,
const qse_char_t* ptr, qse_size_t len, const qse_char_t* ptr, qse_size_t len,

View File

@ -1,5 +1,5 @@
/* /*
* $Id: htrd.c 341 2008-08-20 10:58:19Z baconevi $ * $Id$
* *
Copyright 2006-2011 Chung, Hyung-Hwan. Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE. This file is part of QSE.

View File

@ -1,5 +1,21 @@
/* /*
* $Id$ * $Id$
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
QSE is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
QSE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with QSE. If not, see <htrd://www.gnu.org/licenses/>.
*/ */
#include <qse/net/htre.h> #include <qse/net/htre.h>

View File

@ -1,5 +1,5 @@
/* /*
* $Id: http.c 341 2008-08-20 10:58:19Z baconevi $ * $Id$
* *
Copyright 2006-2011 Chung, Hyung-Hwan. Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE. This file is part of QSE.

View File

@ -1,3 +1,23 @@
/*
* $Id$
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
QSE is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
QSE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with QSE. If not, see <htrd://www.gnu.org/licenses/>.
*/
#include "httpd.h" #include "httpd.h"
#include "../cmn/mem.h" #include "../cmn/mem.h"
#include <qse/cmn/str.h> #include <qse/cmn/str.h>