fixed files for an old compiler
This commit is contained in:
parent
284a0b18be
commit
28ad5392c8
@ -1314,3 +1314,19 @@ oops:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#if defined(FAKE_SOCKET)
|
||||
socket () {}
|
||||
listen () {}
|
||||
accept () {}
|
||||
recvfrom () {}
|
||||
connect () {}
|
||||
getsockopt () {}
|
||||
recv () {}
|
||||
setsockopt () {}
|
||||
send () {}
|
||||
bind () {}
|
||||
shutdown () {}
|
||||
|
||||
void* memmove (void* x, void* y, size_t z) {}
|
||||
#endif
|
||||
|
16
qse/configure
vendored
16
qse/configure
vendored
@ -17579,7 +17579,19 @@ _ACEOF
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in timegm timelocal
|
||||
for ac_func in lstat fchmod fsync ftruncate
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in timegm timelocal localtime_r gettimeofday settimeofday
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
@ -17651,7 +17663,7 @@ _ACEOF
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in _vsnprintf _vsnwprintf
|
||||
for ac_func in snprintf _vsnprintf _vsnwprintf
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
|
@ -144,13 +144,14 @@ AC_CHECK_FUNCS([mbsnrtowcs mbsrtowcs wcsnrtombs wcsrtombs])
|
||||
AC_CHECK_FUNCS([wctype iswctype wctrans towctrans])
|
||||
AC_CHECK_FUNCS([isblank iswblank])
|
||||
AC_CHECK_FUNCS([lseek64 stat64 fstat64 lstat64 ftruncate64 readdir64 dirfd])
|
||||
AC_CHECK_FUNCS([timegm timelocal])
|
||||
AC_CHECK_FUNCS([lstat fchmod fsync ftruncate])
|
||||
AC_CHECK_FUNCS([timegm timelocal localtime_r gettimeofday settimeofday])
|
||||
AC_CHECK_FUNCS([utime utimes])
|
||||
AC_CHECK_FUNCS([sysconf prctl fdopendir setrlimit getrlimit])
|
||||
AC_CHECK_FUNCS([backtrace backtrace_symbols])
|
||||
AC_CHECK_FUNCS([fork vfork posix_spawn gettid nanosleep select])
|
||||
AC_CHECK_FUNCS([makecontext swapcontext getcontext setcontext])
|
||||
AC_CHECK_FUNCS([_vsnprintf _vsnwprintf])
|
||||
AC_CHECK_FUNCS([snprintf _vsnprintf _vsnwprintf])
|
||||
|
||||
OLDLIBS="$LIBS"
|
||||
LIBS="$LIBM $LIBS"
|
||||
|
@ -167,11 +167,13 @@ available for the native makefile for Watcom C/C++ for OS/2 only.
|
||||
ln -sf sys/net net
|
||||
|
||||
- Specify GREP if configure fails to find an acceptable grep.
|
||||
- Specify RANLIB to /bin/true.
|
||||
/bin/ranlib ended up like this: *ranlib: .libs/libqsecmn.a: not an archive*
|
||||
- Build in the source tree. Building outside the source tree is likely to fail
|
||||
for dificiency of the bundled make utility.
|
||||
- Do not include -g in CFLAGS.
|
||||
|
||||
./configure GREP=/bin/grep CFLAGS=""
|
||||
./configure GREP=/bin/grep RANLIB=/bin/true CFLAGS=""
|
||||
|
||||
- Change RANLIB from "ranlib" to "true" in libltdl/libtool.
|
||||
|
||||
|
@ -24,11 +24,9 @@
|
||||
#include <qse/types.h>
|
||||
#include <qse/macros.h>
|
||||
|
||||
/** @file
|
||||
/** \file
|
||||
* This file provides functions, types, macros for
|
||||
* multibyte/wide-character conversion based on system locale.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -39,9 +37,9 @@ typedef struct qse_mbstate_t qse_mbstate_t;
|
||||
struct qse_mbstate_t
|
||||
{
|
||||
#if defined(QSE_SIZEOF_MBSTATE_T) && (QSE_SIZEOF_MBSTATE_T > 0)
|
||||
char dummy[QSE_SIZEOF_MBSTATE_T];
|
||||
qse_uint8_t dummy[QSE_SIZEOF_MBSTATE_T];
|
||||
#else
|
||||
char dummy[1];
|
||||
qse_uint8_t dummy[1];
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -78,7 +76,7 @@ QSE_EXPORT qse_size_t qse_slwcrtoslmb (
|
||||
* It returns 0 if an invalid multibyte sequence is detected, mblen + 1 if the
|
||||
* sequence is incomplete. It returns the number of bytes processed to form a
|
||||
* wide character.
|
||||
* @note This function can not handle conversion producing non-initial
|
||||
* \note This function can not handle conversion producing non-initial
|
||||
* states. For each call, it assumes initial state.
|
||||
*/
|
||||
QSE_EXPORT qse_size_t qse_slmbtoslwc (
|
||||
@ -92,7 +90,7 @@ QSE_EXPORT qse_size_t qse_slmbtoslwc (
|
||||
* It returns 0 if the wide character is illegal, mblen + 1 if mblen is not
|
||||
* large enough to hold the multibyte sequence. On successful conversion, it
|
||||
* returns the number of bytes in the sequence.
|
||||
* @note This function can not handle conversion producing non-initial
|
||||
* \note This function can not handle conversion producing non-initial
|
||||
* states. For each call, it assumes initial state.
|
||||
*/
|
||||
QSE_EXPORT qse_size_t qse_slwctoslmb (
|
||||
@ -103,12 +101,12 @@ QSE_EXPORT qse_size_t qse_slwctoslmb (
|
||||
|
||||
/**
|
||||
* The qse_slmblen() function scans a multibyte sequence to get the number of
|
||||
* bytes needed to form a wide character. It does not scan more than @a mblen
|
||||
* bytes needed to form a wide character. It does not scan more than \a mblen
|
||||
* bytes.
|
||||
* @return number of bytes processed on success,
|
||||
* \return number of bytes processed on success,
|
||||
* 0 for invalid sequences,
|
||||
* mblen + 1 for incomplete sequences
|
||||
* @note This function can not handle conversion producing non-initial
|
||||
* \note This function can not handle conversion producing non-initial
|
||||
* states. For each call, it assumes initial state.
|
||||
*/
|
||||
QSE_EXPORT qse_size_t qse_slmblen (
|
||||
|
@ -200,6 +200,9 @@
|
||||
/* Define to 1 if you have the `expq' function. */
|
||||
#undef HAVE_EXPQ
|
||||
|
||||
/* Define to 1 if you have the `fchmod' function. */
|
||||
#undef HAVE_FCHMOD
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
@ -236,6 +239,12 @@
|
||||
/* Define to 1 if you have the `fstat64' function. */
|
||||
#undef HAVE_FSTAT64
|
||||
|
||||
/* Define to 1 if you have the `fsync' function. */
|
||||
#undef HAVE_FSYNC
|
||||
|
||||
/* Define to 1 if you have the `ftruncate' function. */
|
||||
#undef HAVE_FTRUNCATE
|
||||
|
||||
/* Define to 1 if you have the `ftruncate64' function. */
|
||||
#undef HAVE_FTRUNCATE64
|
||||
|
||||
@ -254,6 +263,9 @@
|
||||
/* Define to 1 if you have the `gettid' function. */
|
||||
#undef HAVE_GETTID
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if you have the <ifaddrs.h> header file. */
|
||||
#undef HAVE_IFADDRS_H
|
||||
|
||||
@ -302,6 +314,9 @@
|
||||
/* Define to 1 if you have the <linux/sockios.h> header file. */
|
||||
#undef HAVE_LINUX_SOCKIOS_H
|
||||
|
||||
/* Define to 1 if you have the `localtime_r' function. */
|
||||
#undef HAVE_LOCALTIME_R
|
||||
|
||||
/* Define to 1 if you have the `log' function. */
|
||||
#undef HAVE_LOG
|
||||
|
||||
@ -329,6 +344,9 @@
|
||||
/* Define to 1 if you have the `lseek64' function. */
|
||||
#undef HAVE_LSEEK64
|
||||
|
||||
/* Define to 1 if you have the `lstat' function. */
|
||||
#undef HAVE_LSTAT
|
||||
|
||||
/* Define to 1 if you have the `lstat64' function. */
|
||||
#undef HAVE_LSTAT64
|
||||
|
||||
@ -455,6 +473,9 @@
|
||||
/* Define to 1 if you have the `setrlimit' function. */
|
||||
#undef HAVE_SETRLIMIT
|
||||
|
||||
/* Define to 1 if you have the `settimeofday' function. */
|
||||
#undef HAVE_SETTIMEOFDAY
|
||||
|
||||
/* Define if you have the shl_load function. */
|
||||
#undef HAVE_SHL_LOAD
|
||||
|
||||
@ -485,6 +506,9 @@
|
||||
/* Define to 1 if you have the `sinq' function. */
|
||||
#undef HAVE_SINQ
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the <spawn.h> header file. */
|
||||
#undef HAVE_SPAWN_H
|
||||
|
||||
|
@ -601,7 +601,7 @@ int qse_awk_fnc_split (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||
qse_awk_val_t* a0, * a1, * a2, * t1, * t2;
|
||||
qse_awk_val_type_t a1_vtype, a2_vtype, t1_vtype;
|
||||
|
||||
qse_cstr_t str = { QSE_NULL, 0 };
|
||||
qse_cstr_t str;
|
||||
qse_cstr_t fs;
|
||||
qse_char_t* fs_free = QSE_NULL;
|
||||
const qse_char_t* p;
|
||||
@ -615,6 +615,9 @@ int qse_awk_fnc_split (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||
qse_awk_errnum_t errnum;
|
||||
int x;
|
||||
|
||||
str.ptr = QSE_NULL;
|
||||
str.len = 0;
|
||||
|
||||
nargs = qse_awk_rtx_getnargs (rtx);
|
||||
QSE_ASSERT (nargs >= 2 && nargs <= 3);
|
||||
|
||||
@ -881,7 +884,7 @@ static int __substitute (qse_awk_rtx_t* rtx, qse_awk_int_t max_count)
|
||||
qse_awk_val_type_t a0_vtype;
|
||||
|
||||
qse_cstr_t s0, s2;
|
||||
qse_cstr_t s1 = { QSE_NULL, 0 };
|
||||
qse_cstr_t s1;
|
||||
const qse_char_t* s2_end;
|
||||
|
||||
qse_char_t* s0_free = QSE_NULL;
|
||||
@ -897,6 +900,9 @@ static int __substitute (qse_awk_rtx_t* rtx, qse_awk_int_t max_count)
|
||||
|
||||
qse_awk_int_t sub_count;
|
||||
|
||||
s1.ptr = QSE_NULL;
|
||||
s1.len = 0;
|
||||
|
||||
nargs = qse_awk_rtx_getnargs (rtx);
|
||||
QSE_ASSERT (nargs >= 2 && nargs <= 3);
|
||||
|
||||
|
@ -1194,8 +1194,10 @@ static int matchtre (
|
||||
qse_cstr_t submat[9], qse_awk_errnum_t* errnum)
|
||||
{
|
||||
int n;
|
||||
qse_tre_match_t match[10] = { { 0, 0 }, };
|
||||
/*qse_tre_match_t match[10] = { { 0, 0 }, };*/
|
||||
qse_tre_match_t match[10];
|
||||
|
||||
QSE_MEMSET (match, 0, QSE_SIZEOF(match));
|
||||
n = qse_tre_execx (tre, str->ptr, str->len, match, QSE_COUNTOF(match), opt);
|
||||
if (n <= -1)
|
||||
{
|
||||
|
@ -1016,8 +1016,12 @@ static int parse_progunit (qse_awk_t* awk)
|
||||
if (MATCH(awk,TOK_NEWLINE) || MATCH(awk,TOK_SEMICOLON) || MATCH(awk,TOK_EOF))
|
||||
{
|
||||
/* blockless pattern */
|
||||
int eof = MATCH(awk,TOK_EOF);
|
||||
qse_awk_loc_t ploc = awk->ptok.loc;
|
||||
int eof;
|
||||
qse_awk_loc_t ploc;
|
||||
|
||||
|
||||
eof = MATCH(awk,TOK_EOF);
|
||||
ploc = awk->ptok.loc;
|
||||
|
||||
awk->parse.id.block = PARSE_ACTION_BLOCK;
|
||||
if (parse_action_block (awk, ptn, 1) == QSE_NULL)
|
||||
@ -1351,8 +1355,9 @@ static qse_awk_nde_t* parse_function (qse_awk_t* awk)
|
||||
static qse_awk_nde_t* parse_begin (qse_awk_t* awk)
|
||||
{
|
||||
qse_awk_nde_t* nde;
|
||||
qse_awk_loc_t xloc = awk->tok.loc;
|
||||
qse_awk_loc_t xloc;
|
||||
|
||||
xloc = awk->tok.loc;
|
||||
QSE_ASSERT (MATCH(awk,TOK_LBRACE));
|
||||
|
||||
if (get_token(awk) <= -1) return QSE_NULL;
|
||||
@ -1376,8 +1381,9 @@ static qse_awk_nde_t* parse_begin (qse_awk_t* awk)
|
||||
static qse_awk_nde_t* parse_end (qse_awk_t* awk)
|
||||
{
|
||||
qse_awk_nde_t* nde;
|
||||
qse_awk_loc_t xloc = awk->tok.loc;
|
||||
qse_awk_loc_t xloc;
|
||||
|
||||
xloc = awk->tok.loc;
|
||||
QSE_ASSERT (MATCH(awk,TOK_LBRACE));
|
||||
|
||||
if (get_token(awk) <= -1) return QSE_NULL;
|
||||
@ -1402,8 +1408,9 @@ static qse_awk_chain_t* parse_action_block (
|
||||
{
|
||||
qse_awk_nde_t* nde;
|
||||
qse_awk_chain_t* chain;
|
||||
qse_awk_loc_t xloc = awk->tok.loc;
|
||||
qse_awk_loc_t xloc;
|
||||
|
||||
xloc = awk->tok.loc;
|
||||
if (blockless) nde = QSE_NULL;
|
||||
else
|
||||
{
|
||||
@ -1563,7 +1570,8 @@ static qse_awk_nde_t* parse_block (
|
||||
{
|
||||
/* parse an actual statement in a block */
|
||||
{
|
||||
qse_awk_loc_t sloc = awk->tok.loc;
|
||||
qse_awk_loc_t sloc;
|
||||
sloc = awk->tok.loc;
|
||||
nde = parse_statement (awk, &sloc);
|
||||
}
|
||||
|
||||
@ -2155,7 +2163,9 @@ static qse_awk_nde_t* parse_if (qse_awk_t* awk, const qse_awk_loc_t* xloc)
|
||||
if (get_token(awk) <= -1) goto oops;
|
||||
|
||||
{
|
||||
qse_awk_loc_t eloc = awk->tok.loc;
|
||||
qse_awk_loc_t eloc;
|
||||
|
||||
eloc = awk->tok.loc;
|
||||
else_part = parse_statement (awk, &eloc);
|
||||
if (else_part == QSE_NULL) goto oops;
|
||||
}
|
||||
@ -2330,7 +2340,9 @@ static qse_awk_nde_t* parse_for (qse_awk_t* awk, const qse_awk_loc_t* xloc)
|
||||
if (!MATCH(awk,TOK_RPAREN))
|
||||
{
|
||||
{
|
||||
qse_awk_loc_t eloc = awk->tok.loc;
|
||||
qse_awk_loc_t eloc;
|
||||
|
||||
eloc = awk->tok.loc;
|
||||
incr = parse_expr_withdc (awk, &eloc);
|
||||
if (incr == QSE_NULL) goto oops;
|
||||
}
|
||||
@ -2511,7 +2523,9 @@ static qse_awk_nde_t* parse_return (qse_awk_t* awk, const qse_awk_loc_t* xloc)
|
||||
}
|
||||
else
|
||||
{
|
||||
qse_awk_loc_t eloc = awk->tok.loc;
|
||||
qse_awk_loc_t eloc;
|
||||
|
||||
eloc = awk->tok.loc;
|
||||
val = parse_expr_withdc (awk, &eloc);
|
||||
if (val == QSE_NULL)
|
||||
{
|
||||
@ -2549,7 +2563,9 @@ static qse_awk_nde_t* parse_exit (qse_awk_t* awk, const qse_awk_loc_t* xloc)
|
||||
}
|
||||
else
|
||||
{
|
||||
qse_awk_loc_t eloc = awk->tok.loc;
|
||||
qse_awk_loc_t eloc;
|
||||
|
||||
eloc = awk->tok.loc;
|
||||
val = parse_expr_withdc (awk, &eloc);
|
||||
if (val == QSE_NULL)
|
||||
{
|
||||
@ -2812,7 +2828,7 @@ static qse_awk_nde_t* parse_print (qse_awk_t* awk, const qse_awk_loc_t* xloc)
|
||||
{
|
||||
int i;
|
||||
qse_awk_nde_exp_t* ep = (qse_awk_nde_exp_t*)args_tail;
|
||||
struct
|
||||
static struct
|
||||
{
|
||||
int opc;
|
||||
int out;
|
||||
@ -2847,8 +2863,7 @@ static qse_awk_nde_t* parse_print (qse_awk_t* awk, const qse_awk_loc_t* xloc)
|
||||
{
|
||||
qse_awk_nde_t* tmp;
|
||||
|
||||
if (tab[i].opt &&
|
||||
!(awk->opt.trait&tab[i].opt)) break;
|
||||
if (tab[i].opt && !(awk->opt.trait & tab[i].opt)) break;
|
||||
|
||||
tmp = args_tail;
|
||||
|
||||
@ -3073,7 +3088,9 @@ static qse_awk_nde_t* parse_statement (
|
||||
else if (MATCH(awk,TOK_LBRACE))
|
||||
{
|
||||
/* a block statemnt { ... } */
|
||||
qse_awk_loc_t tloc = awk->ptok.loc;
|
||||
qse_awk_loc_t tloc;
|
||||
|
||||
tloc = awk->ptok.loc;
|
||||
if (get_token(awk) <= -1) return QSE_NULL;
|
||||
nde = parse_block_dc (awk, &tloc, 0);
|
||||
}
|
||||
@ -3085,8 +3102,11 @@ static qse_awk_nde_t* parse_statement (
|
||||
* statement id can be changed in parse_statement_nb.
|
||||
* it will, in turn, call parse_statement which will
|
||||
* eventually change the statement id. */
|
||||
int old_id = awk->parse.id.stmt;
|
||||
qse_awk_loc_t tloc = awk->tok.loc;
|
||||
int old_id;
|
||||
qse_awk_loc_t tloc;
|
||||
|
||||
old_id = awk->parse.id.stmt;
|
||||
tloc = awk->tok.loc;
|
||||
|
||||
/* set the current statement id */
|
||||
awk->parse.id.stmt = awk->tok.type;
|
||||
@ -3238,7 +3258,9 @@ static qse_awk_nde_t* parse_expr (
|
||||
}
|
||||
|
||||
{
|
||||
qse_awk_loc_t eloc = awk->tok.loc;
|
||||
qse_awk_loc_t eloc;
|
||||
|
||||
eloc = awk->tok.loc;
|
||||
y = parse_expr_withdc (awk, &eloc);
|
||||
}
|
||||
if (y == QSE_NULL)
|
||||
@ -5215,7 +5237,9 @@ static qse_awk_nde_t* parse_hashidx (
|
||||
}
|
||||
|
||||
{
|
||||
qse_awk_loc_t eloc = awk->tok.loc;
|
||||
qse_awk_loc_t eloc;
|
||||
|
||||
eloc = awk->tok.loc;
|
||||
tmp = parse_expr_withdc (awk, &eloc);
|
||||
}
|
||||
if (tmp == QSE_NULL)
|
||||
@ -6709,24 +6733,16 @@ static qse_awk_mod_t* query_module (
|
||||
qse_awk_mod_spec_t spec;
|
||||
qse_size_t buflen;
|
||||
/*qse_char_t buf[64 + 15] = QSE_T("_qse_awk_mod_");*/
|
||||
qse_char_t buf[64 + 15] =
|
||||
{
|
||||
QSE_T('_'),
|
||||
QSE_T('q'),
|
||||
QSE_T('s'),
|
||||
QSE_T('e'),
|
||||
QSE_T('_'),
|
||||
QSE_T('a'),
|
||||
QSE_T('w'),
|
||||
QSE_T('k'),
|
||||
QSE_T('_'),
|
||||
QSE_T('m'),
|
||||
QSE_T('o'),
|
||||
QSE_T('d'),
|
||||
QSE_T('_')
|
||||
/* the terminating null isn't needed */
|
||||
};
|
||||
|
||||
/* maximum module name length is 64. 15 is decomposed to 13 + 1 + 1.
|
||||
* 13 for _qse_awk_mod_t
|
||||
* 1 for _ at the end when qse_awk_mod_xxx_ is attempted.
|
||||
* 1 for the terminating '\0'
|
||||
*/
|
||||
qse_char_t buf[64 + 15];
|
||||
|
||||
/* the terminating null isn't needed in buf here */
|
||||
QSE_MEMCPY (buf, QSE_T("_qse_awk_mod_"), QSE_SIZEOF(qse_char_t) * 13);
|
||||
if (segs[0].len > QSE_COUNTOF(buf) - 15)
|
||||
{
|
||||
/* module name too long */
|
||||
|
@ -1262,36 +1262,34 @@ static int defaultify_globals (qse_awk_rtx_t* rtx)
|
||||
struct gtab_t
|
||||
{
|
||||
int idx;
|
||||
const qse_char_t* str;
|
||||
} gtab[] =
|
||||
const qse_char_t* str[2];
|
||||
};
|
||||
static struct gtab_t gtab[7] =
|
||||
{
|
||||
{ QSE_AWK_GBL_CONVFMT, DEFAULT_CONVFMT },
|
||||
{ QSE_AWK_GBL_FILENAME, QSE_NULL },
|
||||
{ QSE_AWK_GBL_OFILENAME, QSE_NULL },
|
||||
{ QSE_AWK_GBL_OFMT, DEFAULT_OFMT },
|
||||
{ QSE_AWK_GBL_OFS, DEFAULT_OFS },
|
||||
{ QSE_AWK_GBL_ORS, DEFAULT_ORS },
|
||||
{ QSE_AWK_GBL_SUBSEP, DEFAULT_SUBSEP },
|
||||
{ QSE_AWK_GBL_CONVFMT, { DEFAULT_CONVFMT, DEFAULT_CONVFMT } },
|
||||
{ QSE_AWK_GBL_FILENAME, { QSE_NULL, QSE_NULL } },
|
||||
{ QSE_AWK_GBL_OFILENAME, { QSE_NULL, QSE_NULL } },
|
||||
{ QSE_AWK_GBL_OFMT, { DEFAULT_OFMT, DEFAULT_OFMT } },
|
||||
{ QSE_AWK_GBL_OFS, { DEFAULT_OFS, DEFAULT_OFS } },
|
||||
{ QSE_AWK_GBL_ORS, { DEFAULT_ORS, DEFAULT_ORS_CRLF } },
|
||||
{ QSE_AWK_GBL_SUBSEP, { DEFAULT_SUBSEP, DEFAULT_SUBSEP } },
|
||||
};
|
||||
|
||||
qse_awk_val_t* tmp;
|
||||
qse_size_t i, j;
|
||||
int stridx;
|
||||
|
||||
if (rtx->awk->opt.trait & QSE_AWK_CRLF)
|
||||
{
|
||||
/* ugly */
|
||||
gtab[5].str = DEFAULT_ORS_CRLF;
|
||||
}
|
||||
|
||||
stridx = (rtx->awk->opt.trait & QSE_AWK_CRLF)? 1: 0;
|
||||
for (i = 0; i < QSE_COUNTOF(gtab); i++)
|
||||
{
|
||||
if (gtab[i].str == QSE_NULL || gtab[i].str[0] == QSE_T('\0'))
|
||||
if (gtab[i].str[stridx] == QSE_NULL || gtab[i].str[stridx][0] == QSE_T('\0'))
|
||||
{
|
||||
tmp = qse_awk_val_zls;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = qse_awk_rtx_makestrvalwithstr (rtx, gtab[i].str);
|
||||
tmp = qse_awk_rtx_makestrvalwithstr (rtx, gtab[i].str[stridx]);
|
||||
if (tmp == QSE_NULL) return -1;
|
||||
}
|
||||
|
||||
@ -1303,8 +1301,7 @@ static int defaultify_globals (qse_awk_rtx_t* rtx)
|
||||
{
|
||||
for (j = 0; j < i; j++)
|
||||
{
|
||||
qse_awk_rtx_setgbl (
|
||||
rtx, gtab[i].idx, qse_awk_val_nil);
|
||||
qse_awk_rtx_setgbl (rtx, gtab[i].idx, qse_awk_val_nil);
|
||||
}
|
||||
|
||||
qse_awk_rtx_refdownval (rtx, tmp);
|
||||
|
@ -24,7 +24,7 @@ noinst_HEADERS = \
|
||||
tre.h \
|
||||
tre-ast.h \
|
||||
tre-compile.h \
|
||||
tre-match-utils.h \
|
||||
tre-match-ut.h \
|
||||
tre-parse.h \
|
||||
tre-stack.h
|
||||
|
||||
@ -64,7 +64,7 @@ libqsecmn_la_SOURCES = \
|
||||
nwio.c \
|
||||
oht.c \
|
||||
opt.c \
|
||||
path-basename.c \
|
||||
path-base.c \
|
||||
path-canon.c \
|
||||
pio.c \
|
||||
pma.c \
|
||||
@ -111,8 +111,8 @@ libqsecmn_la_SOURCES = \
|
||||
tre.c \
|
||||
tre-ast.c \
|
||||
tre-compile.c \
|
||||
tre-match-backtrack.c \
|
||||
tre-match-parallel.c \
|
||||
tre-match-bt.c \
|
||||
tre-match-pa.c \
|
||||
tre-parse.c \
|
||||
tre-stack.c \
|
||||
uri.c \
|
||||
|
@ -110,16 +110,15 @@ am__libqsecmn_la_SOURCES_DIST = alg-base64.c alg-rand.c alg-search.c \
|
||||
fma.c fmt-intmax.c fmt-out.c fs.c fs-err.c fs-move.c glob.c \
|
||||
hton.c ipad.c lda.c main.c mb8.c mbwc.c mbwc-str.c mem.c mux.c \
|
||||
nwad.c nwad-skad.c nwif.c nwif-cfg.c nwio.c oht.c opt.c \
|
||||
path-basename.c path-canon.c pio.c pma.c rbt.c rex.c sck.c \
|
||||
sio.c sll.c slmb.c str-beg.c str-cat.c str-chr.c str-cnv.c \
|
||||
str-cmp.c str-cpy.c str-del.c str-dup.c str-dyn.c str-end.c \
|
||||
str-excl.c str-fcpy.c str-fmt.c str-fnmat.c str-incl.c \
|
||||
str-join.c str-len.c str-pac.c str-pbrk.c str-put.c str-rev.c \
|
||||
str-rot.c str-set.c str-spl.c str-spn.c str-str.c str-subst.c \
|
||||
str-tok.c str-trm.c str-word.c task.c time.c tio.c tmr.c tre.c \
|
||||
tre-ast.c tre-compile.c tre-match-backtrack.c \
|
||||
tre-match-parallel.c tre-parse.c tre-stack.c uri.c utf8.c \
|
||||
xma.c uni.c cp949.c cp950.c
|
||||
path-base.c path-canon.c pio.c pma.c rbt.c rex.c sck.c sio.c \
|
||||
sll.c slmb.c str-beg.c str-cat.c str-chr.c str-cnv.c str-cmp.c \
|
||||
str-cpy.c str-del.c str-dup.c str-dyn.c str-end.c str-excl.c \
|
||||
str-fcpy.c str-fmt.c str-fnmat.c str-incl.c str-join.c \
|
||||
str-len.c str-pac.c str-pbrk.c str-put.c str-rev.c str-rot.c \
|
||||
str-set.c str-spl.c str-spn.c str-str.c str-subst.c str-tok.c \
|
||||
str-trm.c str-word.c task.c time.c tio.c tmr.c tre.c tre-ast.c \
|
||||
tre-compile.c tre-match-bt.c tre-match-pa.c tre-parse.c \
|
||||
tre-stack.c uri.c utf8.c xma.c uni.c cp949.c cp950.c
|
||||
@ENABLE_BUNDLED_UNICODE_TRUE@am__objects_1 = uni.lo
|
||||
@ENABLE_XCMGRS_TRUE@am__objects_2 = cp949.lo cp950.lo
|
||||
am_libqsecmn_la_OBJECTS = alg-base64.lo alg-rand.lo alg-search.lo \
|
||||
@ -127,18 +126,17 @@ am_libqsecmn_la_OBJECTS = alg-base64.lo alg-rand.lo alg-search.lo \
|
||||
htb.lo fio.lo fma.lo fmt-intmax.lo fmt-out.lo fs.lo fs-err.lo \
|
||||
fs-move.lo glob.lo hton.lo ipad.lo lda.lo main.lo mb8.lo \
|
||||
mbwc.lo mbwc-str.lo mem.lo mux.lo nwad.lo nwad-skad.lo nwif.lo \
|
||||
nwif-cfg.lo nwio.lo oht.lo opt.lo path-basename.lo \
|
||||
path-canon.lo pio.lo pma.lo rbt.lo rex.lo sck.lo sio.lo sll.lo \
|
||||
slmb.lo str-beg.lo str-cat.lo str-chr.lo str-cnv.lo str-cmp.lo \
|
||||
nwif-cfg.lo nwio.lo oht.lo opt.lo path-base.lo path-canon.lo \
|
||||
pio.lo pma.lo rbt.lo rex.lo sck.lo sio.lo sll.lo slmb.lo \
|
||||
str-beg.lo str-cat.lo str-chr.lo str-cnv.lo str-cmp.lo \
|
||||
str-cpy.lo str-del.lo str-dup.lo str-dyn.lo str-end.lo \
|
||||
str-excl.lo str-fcpy.lo str-fmt.lo str-fnmat.lo str-incl.lo \
|
||||
str-join.lo str-len.lo str-pac.lo str-pbrk.lo str-put.lo \
|
||||
str-rev.lo str-rot.lo str-set.lo str-spl.lo str-spn.lo \
|
||||
str-str.lo str-subst.lo str-tok.lo str-trm.lo str-word.lo \
|
||||
task.lo time.lo tio.lo tmr.lo tre.lo tre-ast.lo tre-compile.lo \
|
||||
tre-match-backtrack.lo tre-match-parallel.lo tre-parse.lo \
|
||||
tre-stack.lo uri.lo utf8.lo xma.lo $(am__objects_1) \
|
||||
$(am__objects_2)
|
||||
tre-match-bt.lo tre-match-pa.lo tre-parse.lo tre-stack.lo \
|
||||
uri.lo utf8.lo xma.lo $(am__objects_1) $(am__objects_2)
|
||||
libqsecmn_la_OBJECTS = $(am_libqsecmn_la_OBJECTS)
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
@ -408,7 +406,7 @@ noinst_HEADERS = \
|
||||
tre.h \
|
||||
tre-ast.h \
|
||||
tre-compile.h \
|
||||
tre-match-utils.h \
|
||||
tre-match-ut.h \
|
||||
tre-parse.h \
|
||||
tre-stack.h
|
||||
|
||||
@ -416,17 +414,16 @@ libqsecmn_la_SOURCES = alg-base64.c alg-rand.c alg-search.c alg-sort.c \
|
||||
assert.c chr.c dir.c dll.c env.c gdl.c htb.c fio.c fma.c \
|
||||
fmt-intmax.c fmt-out.c fs.c fs-err.c fs-move.c glob.c hton.c \
|
||||
ipad.c lda.c main.c mb8.c mbwc.c mbwc-str.c mem.c mux.c nwad.c \
|
||||
nwad-skad.c nwif.c nwif-cfg.c nwio.c oht.c opt.c \
|
||||
path-basename.c path-canon.c pio.c pma.c rbt.c rex.c sck.c \
|
||||
sio.c sll.c slmb.c str-beg.c str-cat.c str-chr.c str-cnv.c \
|
||||
str-cmp.c str-cpy.c str-del.c str-dup.c str-dyn.c str-end.c \
|
||||
str-excl.c str-fcpy.c str-fmt.c str-fnmat.c str-incl.c \
|
||||
str-join.c str-len.c str-pac.c str-pbrk.c str-put.c str-rev.c \
|
||||
str-rot.c str-set.c str-spl.c str-spn.c str-str.c str-subst.c \
|
||||
str-tok.c str-trm.c str-word.c task.c time.c tio.c tmr.c tre.c \
|
||||
tre-ast.c tre-compile.c tre-match-backtrack.c \
|
||||
tre-match-parallel.c tre-parse.c tre-stack.c uri.c utf8.c \
|
||||
xma.c $(am__append_1) $(am__append_2)
|
||||
nwad-skad.c nwif.c nwif-cfg.c nwio.c oht.c opt.c path-base.c \
|
||||
path-canon.c pio.c pma.c rbt.c rex.c sck.c sio.c sll.c slmb.c \
|
||||
str-beg.c str-cat.c str-chr.c str-cnv.c str-cmp.c str-cpy.c \
|
||||
str-del.c str-dup.c str-dyn.c str-end.c str-excl.c str-fcpy.c \
|
||||
str-fmt.c str-fnmat.c str-incl.c str-join.c str-len.c \
|
||||
str-pac.c str-pbrk.c str-put.c str-rev.c str-rot.c str-set.c \
|
||||
str-spl.c str-spn.c str-str.c str-subst.c str-tok.c str-trm.c \
|
||||
str-word.c task.c time.c tio.c tmr.c tre.c tre-ast.c \
|
||||
tre-compile.c tre-match-bt.c tre-match-pa.c tre-parse.c \
|
||||
tre-stack.c uri.c utf8.c xma.c $(am__append_1) $(am__append_2)
|
||||
libqsecmn_la_LDFLAGS = -version-info 1:0:0 -no-undefined
|
||||
libqsecmn_la_LIBADD = $(SOCKET_LIBS) $(QUADMATH_LIBS)
|
||||
@ENABLE_CXX_TRUE@libqsecmnxx_la_SOURCES = \
|
||||
@ -550,7 +547,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nwio.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oht.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opt.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path-basename.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path-base.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path-canon.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pma.Plo@am__quote@
|
||||
@ -596,8 +593,8 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmr.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tre-ast.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tre-compile.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tre-match-backtrack.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tre-match-parallel.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tre-match-bt.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tre-match-pa.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tre-parse.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tre-stack.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tre.Plo@am__quote@
|
||||
|
@ -1135,11 +1135,17 @@ int qse_fio_truncate (qse_fio_t* fio, qse_fio_off_t size)
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
|
||||
#elif defined(HAVE_FTRUNCATE)
|
||||
|
||||
int n;
|
||||
n = QSE_FTRUNCATE (fio->handle, size);
|
||||
if (n <= -1) fio->errnum = syserr_to_errnum (errno);
|
||||
return n;
|
||||
|
||||
#else
|
||||
fio->errnum = QSE_FIO_ENOIMPL;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1526,11 +1532,16 @@ int qse_fio_chmod (qse_fio_t* fio, int mode)
|
||||
fio->errnum = QSE_FIO_ENOIMPL;
|
||||
return (qse_fio_off_t)-1;
|
||||
|
||||
#else
|
||||
#elif defined(HAVE_FCHMOD)
|
||||
int n;
|
||||
n = QSE_FCHMOD (fio->handle, mode);
|
||||
if (n <= -1) fio->errnum = syserr_to_errnum (errno);
|
||||
return n;
|
||||
|
||||
#else
|
||||
fio->errnum = QSE_FIO_ENOIMPL;
|
||||
return -1;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1569,12 +1580,16 @@ int qse_fio_sync (qse_fio_t* fio)
|
||||
fio->errnum = QSE_FIO_ENOIMPL;
|
||||
return (qse_fio_off_t)-1;
|
||||
|
||||
#else
|
||||
#elif defined(HAVE_FSYNC)
|
||||
|
||||
int n;
|
||||
n = QSE_FSYNC (fio->handle);
|
||||
if (n <= -1) fio->errnum = syserr_to_errnum (errno);
|
||||
return n;
|
||||
#else
|
||||
|
||||
fio->errnum = QSE_FIO_ENOIMPL;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -26,12 +26,15 @@
|
||||
#include "mem.h"
|
||||
#include "fmt.h"
|
||||
|
||||
#include <stdio.h> /* for snrintf() */
|
||||
#include <stdio.h> /* for snrintf(). used for floating-point number formatting */
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && (__WATCOMC__ < 1200))
|
||||
# define snprintf _snprintf
|
||||
# if !defined(HAVE_SNPRINTF)
|
||||
# define HAVE_SNPRINTF
|
||||
# endif
|
||||
#endif
|
||||
#if defined(HAVE_QUADMATH_H)
|
||||
# include <quadmath.h> /* for quadmath_snprintf */
|
||||
# include <quadmath.h> /* for quadmath_snprintf() */
|
||||
#endif
|
||||
/* TODO: remove stdio.h and quadmath.h once snprintf gets replaced by own
|
||||
floting-point conversion implementation*/
|
||||
|
@ -553,17 +553,18 @@ reswitch:
|
||||
long double v_ld;
|
||||
double v_d;
|
||||
int dtype = 0;
|
||||
qse_size_t newcapa;
|
||||
|
||||
if (lm_flag & LF_J)
|
||||
{
|
||||
#if (QSE_SIZEOF___FLOAT128 > 0) && defined(HAVE_QUADMATH_SNPRINTF) && (QSE_SIZEOF_FLTMAX_T == QSE_SIZEOF___FLOAT128)
|
||||
v_qd = va_arg (ap, qse_fltmax_t);
|
||||
dtype = LF_QD;
|
||||
#elif QSE_SIZEOF_FLTMAX_T == QSE_SIZEOF_DOUBLE
|
||||
v_d = va_arg (ap, qse_fltmax_t);
|
||||
#elif QSE_SIZEOF_FLTMAX_T == QSE_SIZEOF_LONG_DOUBLE
|
||||
v_ld = va_arg (ap, qse_fltmax_t);
|
||||
dtype = LF_LD;
|
||||
#elif QSE_SIZEOF_FLTMAX_T == QSE_SIZEOF_DOUBLE
|
||||
v_d = va_arg (ap, qse_fltmax_t);
|
||||
#else
|
||||
#error Unsupported qse_flt_t
|
||||
#endif
|
||||
@ -571,11 +572,16 @@ reswitch:
|
||||
else if (lm_flag & LF_Z)
|
||||
{
|
||||
/* qse_flt_t is limited to double or long double */
|
||||
#if QSE_SIZEOF_FLT_T == QSE_SIZEOF_LONG_DOUBLE
|
||||
|
||||
/* precedence goes to double if sizeof(double) == sizeof(long double)
|
||||
* for example, %Lf didn't work on some old platforms.
|
||||
* so i prefer the format specifier with no modifier.
|
||||
*/
|
||||
#if QSE_SIZEOF_FLT_T == QSE_SIZEOF_DOUBLE
|
||||
v_d = va_arg (ap, qse_flt_t);
|
||||
#elif QSE_SIZEOF_FLT_T == QSE_SIZEOF_LONG_DOUBLE
|
||||
v_ld = va_arg (ap, qse_flt_t);
|
||||
dtype = LF_LD;
|
||||
#elif QSE_SIZEOF_FLT_T == QSE_SIZEOF_DOUBLE
|
||||
v_d = va_arg (ap, qse_flt_t);
|
||||
#else
|
||||
#error Unsupported qse_flt_t
|
||||
#endif
|
||||
@ -656,18 +662,47 @@ reswitch:
|
||||
fltfmt.ptr[fmtlen++] = ch;
|
||||
fltfmt.ptr[fmtlen] = QSE_MT('\0');
|
||||
|
||||
#if defined(HAVE_SNPRINTF)
|
||||
/* nothing special here */
|
||||
#else
|
||||
/* best effort to avoid buffer overflow when no snprintf is available.
|
||||
* i really can't do much if it happens. */
|
||||
newcapa = precision + width + 32;
|
||||
if (fltout.capa < newcapa)
|
||||
{
|
||||
QSE_ASSERT (fltout.ptr == fltout.sbuf);
|
||||
|
||||
fltout.ptr = QSE_MMGR_ALLOC (QSE_MMGR_GETDFL(), QSE_SIZEOF(char_t) * (newcapa + 1));
|
||||
if (fltout.ptr == QSE_NULL) goto oops;
|
||||
fltout.capa = newcapa;
|
||||
}
|
||||
#endif
|
||||
|
||||
while (1)
|
||||
{
|
||||
qse_size_t newcapa;
|
||||
|
||||
if (dtype == LF_LD)
|
||||
{
|
||||
#if defined(HAVE_SNPRINTF)
|
||||
q = snprintf ((qse_mchar_t*)fltout.ptr, fltout.capa + 1, fltfmt.ptr, v_ld);
|
||||
#else
|
||||
q = sprintf ((qse_mchar_t*)fltout.ptr, fltfmt.ptr, v_ld);
|
||||
#endif
|
||||
}
|
||||
#if (QSE_SIZEOF___FLOAT128 > 0) && defined(HAVE_QUADMATH_SNPRINTF)
|
||||
else if (dtype == LF_QD)
|
||||
{
|
||||
q = quadmath_snprintf ((qse_mchar_t*)fltout.ptr, fltout.capa + 1, fltfmt.ptr, v_qd);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
#if defined(HAVE_SNPRINTF)
|
||||
q = snprintf ((qse_mchar_t*)fltout.ptr, fltout.capa + 1, fltfmt.ptr, v_d);
|
||||
#else
|
||||
q = sprintf ((qse_mchar_t*)fltout.ptr, fltfmt.ptr, v_d);
|
||||
#endif
|
||||
}
|
||||
if (q <= -1) goto oops;
|
||||
if (q <= fltout.capa) break;
|
||||
|
||||
|
@ -223,14 +223,22 @@ int qse_fs_move (
|
||||
|
||||
/* use lstat because we need to move the symbolic link
|
||||
* itself if the file is a symbolic link */
|
||||
#if defined(HAVE_LSTAT)
|
||||
if (QSE_LSTAT (fop.old_path, &fop.old_stat) == -1)
|
||||
#else
|
||||
if (QSE_STAT (fop.old_path, &fop.old_stat) == -1) /* is this ok to use stat? */
|
||||
#endif
|
||||
{
|
||||
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
||||
goto oops;
|
||||
}
|
||||
else fop.flags |= FOP_OLD_STAT;
|
||||
|
||||
#if defined(HAVE_LSTAT)
|
||||
if (QSE_LSTAT (fop.new_path, &fop.new_stat) == -1)
|
||||
#else
|
||||
if (QSE_STAT (fop.new_path, &fop.new_stat) == -1)
|
||||
#endif
|
||||
{
|
||||
if (errno == ENOENT)
|
||||
{
|
||||
|
@ -586,7 +586,11 @@ qse_fs_ent_t* qse_fs_read (qse_fs_t* fs, int flags)
|
||||
return QSE_NULL;
|
||||
}
|
||||
|
||||
#if defined(HAVE_LSTAT)
|
||||
x = QSE_LSTAT (mfname, &st);
|
||||
#else
|
||||
x = QSE_STAT (mfname, &st);
|
||||
#endif
|
||||
QSE_MMGR_FREE (fs->mmgr, mfname);
|
||||
|
||||
if (x == -1)
|
||||
|
@ -185,7 +185,13 @@ static int path_exists (glob_t* g, const qse_char_t* name)
|
||||
if (mptr == QSE_NULL) return -1;
|
||||
#endif
|
||||
|
||||
return (lstat (mptr, &st) == 0)? 1: 0;
|
||||
#if defined(HAVE_LSTAT)
|
||||
return (QSE_LSTAT (mptr, &st) == 0)? 1: 0;
|
||||
#else
|
||||
/* use stat() if no lstat() is available. */
|
||||
return (QSE_STAT (mptr, &st) == 0)? 1: 0;
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
|
||||
#endif
|
||||
|
@ -606,7 +606,7 @@ static void* mmgr_alloc (qse_mmgr_t* mmgr, qse_size_t n)
|
||||
#if defined(_WIN32)
|
||||
HANDLE heap;
|
||||
heap = GetProcessHeap ();
|
||||
if (heap == NULL) return QSE_NULL;
|
||||
if (!heap) return QSE_NULL;
|
||||
return HeapAlloc (heap, 0, n);
|
||||
#else
|
||||
/* TODO: need to rewrite this for __OS2__ using DosAllocMem()? */
|
||||
@ -619,12 +619,17 @@ static void* mmgr_realloc (qse_mmgr_t* mmgr, void* ptr, qse_size_t n)
|
||||
#if defined(_WIN32)
|
||||
HANDLE heap;
|
||||
heap = GetProcessHeap ();
|
||||
if (heap == NULL) return QSE_NULL;
|
||||
if (!heap) return QSE_NULL;
|
||||
|
||||
return ptr? HeapReAlloc (heap, 0, ptr, n):
|
||||
HeapAlloc (heap, 0, n);
|
||||
#else
|
||||
return realloc (ptr, n);
|
||||
/* realloc() on some old systems doesn't work like
|
||||
* modern realloc() when ptr is NULL. let's divert
|
||||
* it to malloc() explicitly in such a case */
|
||||
|
||||
/*return realloc (ptr, n);*/
|
||||
return ptr? realloc (ptr, n): malloc (n);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,9 @@
|
||||
# include <tcp.h> /* watt-32 */
|
||||
# undef AF_UNIX
|
||||
#else
|
||||
# if defined(HAVE_SYS_TYPES_H)
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
# if defined(HAVE_SYS_UN_H)
|
||||
|
@ -475,6 +475,8 @@ static int get_highest_fd (void)
|
||||
return maxfd;
|
||||
}
|
||||
|
||||
/* TODO: should i also use getdtablesize() if available? */
|
||||
|
||||
#if defined(HAVE_GETRLIMIT)
|
||||
if (QSE_GETRLIMIT (RLIMIT_NOFILE, &rlim) <= -1 ||
|
||||
rlim.rlim_max == RLIM_INFINITY)
|
||||
|
@ -895,31 +895,19 @@ static qse_rex_node_t* comp_atom (comp_t* com)
|
||||
default:
|
||||
if (com->rex->option & QSE_REX_STRICT)
|
||||
{
|
||||
static qse_char_t spc[] =
|
||||
/* check if a special charcter is at the
|
||||
* position that requires a normal character. */
|
||||
switch (com->c.value)
|
||||
{
|
||||
QSE_T(')'),
|
||||
QSE_T('?'),
|
||||
QSE_T('*'),
|
||||
QSE_T('+'),
|
||||
QSE_T('{'),
|
||||
QSE_T('\0')
|
||||
};
|
||||
case QSE_T('{'):
|
||||
/* { is a normal charcter when bound is disabled */
|
||||
if (com->rex->option & QSE_REX_NOBOUND) break;
|
||||
|
||||
static qse_char_t nobound_spc[] =
|
||||
{
|
||||
QSE_T(')'),
|
||||
QSE_T('?'),
|
||||
QSE_T('*'),
|
||||
QSE_T('+'),
|
||||
QSE_T('\0')
|
||||
};
|
||||
|
||||
const qse_char_t* ptr;
|
||||
|
||||
ptr = (com->rex->option & QSE_REX_NOBOUND)? nobound_spc: spc;
|
||||
|
||||
if (qse_strchr (ptr, com->c.value))
|
||||
{
|
||||
case QSE_T(')'):
|
||||
case QSE_T('?'):
|
||||
case QSE_T('*'):
|
||||
case QSE_T('+'):
|
||||
/* it's at the wrong postion */
|
||||
com->rex->errnum = QSE_REX_ESPCAWP;
|
||||
return QSE_NULL;
|
||||
}
|
||||
|
@ -270,19 +270,25 @@ qse_size_t qse_slmbrlen (
|
||||
|
||||
qse_size_t qse_slmbtoslwc (const qse_mchar_t* mb, qse_size_t mbl, qse_wchar_t* wc)
|
||||
{
|
||||
qse_mbstate_t state = { { 0, } };
|
||||
/*qse_mbstate_t state = { { 0, } };*/
|
||||
qse_mbstate_t state;
|
||||
QSE_MEMSET (&state, 0, QSE_SIZEOF(state));
|
||||
return qse_slmbrtoslwc (mb, mbl, wc, &state);
|
||||
}
|
||||
|
||||
qse_size_t qse_slwctoslmb (qse_wchar_t wc, qse_mchar_t* mb, qse_size_t mbl)
|
||||
{
|
||||
qse_mbstate_t state = { { 0, } };
|
||||
/*qse_mbstate_t state = { { 0, } };*/
|
||||
qse_mbstate_t state;
|
||||
QSE_MEMSET (&state, 0, QSE_SIZEOF(state));
|
||||
return qse_slwcrtoslmb (wc, mb, mbl, &state);
|
||||
}
|
||||
|
||||
qse_size_t qse_slmblen (const qse_mchar_t* mb, qse_size_t mbl)
|
||||
{
|
||||
qse_mbstate_t state = { { 0, } };
|
||||
/*qse_mbstate_t state = { { 0, } };*/
|
||||
qse_mbstate_t state;
|
||||
QSE_MEMSET (&state, 0, QSE_SIZEOF(state));
|
||||
return qse_slmbrlen (mb, mbl, &state);
|
||||
}
|
||||
|
||||
|
@ -246,6 +246,18 @@
|
||||
# define QSE_SETTIMEOFDAY(tv,tz) settimeofday(tv,tz)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_time) && defined(QSE_USE_SYSCALL)
|
||||
# define QSE_TIME(tv) syscall(SYS_time,tv)
|
||||
#else
|
||||
# define QSE_TIME(tv) time(tv)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_stime) && defined(QSE_USE_SYSCALL)
|
||||
# define QSE_STIME(tv) syscall(SYS_stime,tv)
|
||||
#else
|
||||
# define QSE_STIME(tv) stime(tv)
|
||||
#endif
|
||||
|
||||
#if defined(SYS_getrlimit) && defined(QSE_USE_SYSCALL)
|
||||
# define QSE_GETRLIMIT(res,lim) syscall(SYS_getrlimit,res,lim)
|
||||
#else
|
||||
|
@ -161,7 +161,8 @@ int qse_gettime (qse_ntime_t* t)
|
||||
tv->nsec = 0;
|
||||
|
||||
return 0;
|
||||
#else
|
||||
|
||||
#elif defined(HAVE_GETTIMEOFDAY)
|
||||
struct timeval tv;
|
||||
int n;
|
||||
|
||||
@ -172,6 +173,12 @@ int qse_gettime (qse_ntime_t* t)
|
||||
t->sec = tv.tv_sec;
|
||||
t->nsec = QSE_USEC_TO_NSEC(tv.tv_usec);
|
||||
return 0;
|
||||
|
||||
#else
|
||||
t->sec = QSE_TIME (QSE_NULL);
|
||||
t->nsec = 0;
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -229,7 +236,7 @@ int qse_settime (const qse_ntime_t* t)
|
||||
|
||||
return 0;
|
||||
|
||||
#else
|
||||
#elif defined(HAVE_SETTIMEOFDAY)
|
||||
struct timeval tv;
|
||||
int n;
|
||||
|
||||
@ -249,6 +256,12 @@ int qse_settime (const qse_ntime_t* t)
|
||||
n = QSE_SETTIMEOFDAY (&tv, QSE_NULL);
|
||||
if (n == -1) return -1;
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
time_t tv;
|
||||
tv = t->sec;
|
||||
return (QSE_STIME (&tv) == -1)? -1: 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -343,9 +356,12 @@ int qse_localtime (const qse_ntime_t* nt, qse_btime_t* bt)
|
||||
# else
|
||||
# error Please support other compilers
|
||||
# endif
|
||||
#else
|
||||
#elif defined(HAVE_LOCALTIME_R)
|
||||
struct tm btm;
|
||||
tm = localtime_r (&t, &btm);
|
||||
#else
|
||||
/* thread unsafe */
|
||||
tm = localtime (&t);
|
||||
#endif
|
||||
if (tm == QSE_NULL) return -1;
|
||||
|
||||
|
@ -99,8 +99,11 @@ static qse_tmr_index_t sift_up (qse_tmr_t* tmr, qse_tmr_index_t index, int notif
|
||||
parent = HEAP_PARENT(index);
|
||||
if (index > 0 && YOUNGER_THAN(&tmr->event[index], &tmr->event[parent]))
|
||||
{
|
||||
qse_tmr_event_t item = tmr->event[index];
|
||||
qse_size_t old_index = index;
|
||||
qse_tmr_event_t item;
|
||||
qse_size_t old_index;
|
||||
|
||||
item = tmr->event[index];
|
||||
old_index = index;
|
||||
|
||||
do
|
||||
{
|
||||
@ -131,8 +134,11 @@ static qse_tmr_index_t sift_down (qse_tmr_t* tmr, qse_tmr_index_t index, int not
|
||||
|
||||
if (index < base) /* at least 1 child is under the 'index' positmrn */
|
||||
{
|
||||
qse_tmr_event_t item = tmr->event[index];
|
||||
qse_size_t old_index = index;
|
||||
qse_tmr_event_t item;
|
||||
qse_size_t old_index;
|
||||
|
||||
item = tmr->event[index];
|
||||
old_index = index;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "tre.h"
|
||||
#include "tre-match-utils.h"
|
||||
#include "tre-match-ut.h"
|
||||
|
||||
typedef struct
|
||||
{
|
@ -69,7 +69,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "tre.h"
|
||||
#include "tre-match-utils.h"
|
||||
#include "tre-match-ut.h"
|
||||
|
||||
typedef struct
|
||||
{
|
@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
tre-match-utils.h - TRE matcher helper definitions
|
||||
tre-match-ut.h - TRE matcher helper definitions
|
||||
|
||||
This is the license, copyright notice, and disclaimer for TRE, a regex
|
||||
matching package (library and tools) with support for approximate
|
@ -339,7 +339,9 @@ static int matchtre (
|
||||
#else
|
||||
|
||||
int n;
|
||||
qse_tre_match_t match[10] = { { 0, 0 }, };
|
||||
/*qse_tre_match_t match[10] = { { 0, 0 }, };*/
|
||||
qse_tre_match_t match[10];
|
||||
QSE_MEMSET (match, 0, QSE_SIZEOF(match));
|
||||
|
||||
n = qse_tre_execx (tre, str->ptr, str->len, match, QSE_COUNTOF(match), opt);
|
||||
if (n <= -1)
|
||||
@ -1336,7 +1338,11 @@ do { \
|
||||
static int get_subst (qse_sed_t* sed, qse_sed_cmd_t* cmd)
|
||||
{
|
||||
qse_cint_t c, delim;
|
||||
qse_str_t* t[2] = { QSE_NULL, QSE_NULL };
|
||||
|
||||
/*qse_str_t* t[2] = { QSE_NULL, QSE_NULL };*/
|
||||
qse_str_t* t[2];
|
||||
t[0] = QSE_NULL;
|
||||
t[1] = QSE_NULL;
|
||||
|
||||
c = CURSC (sed);
|
||||
CHECK_CMDIC (sed, cmd, c, goto oops);
|
||||
|
Loading…
Reference in New Issue
Block a user