fixed a bug in matching zero occurrence in a group

This commit is contained in:
hyung-hwan 2009-06-19 06:08:06 +00:00
parent 944a492c88
commit cf606b6819
20 changed files with 972 additions and 145 deletions

View File

@ -32,15 +32,6 @@
# include <errno.h>
#endif
#if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG)
# define _CRTDBG_MAP_ALLOC
# include <crtdbg.h>
#endif
#if defined(__linux) && defined(_DEBUG)
# include <mcheck.h>
#endif
class TestAwk;
#ifdef _WIN32
static BOOL WINAPI stop_run (DWORD ctrl_type);
@ -78,11 +69,7 @@ public:
if (heap == QSE_NULL) return -1;
#endif
#if defined(_MSC_VER) && (_MSC_VER<1400)
int n = StdAwk::open ();
#else
int n = QSE::StdAwk::open ();
#endif
if (n == -1)
{
#ifdef _WIN32
@ -106,11 +93,7 @@ public:
return 0;
failure:
#if defined(_MSC_VER) && (_MSC_VER<1400)
StdAwk::close ();
#else
QSE::StdAwk::close ();
#endif
#ifdef _WIN32
HeapDestroy (heap);
@ -121,11 +104,7 @@ public:
void close ()
{
#if defined(_MSC_VER) && (_MSC_VER<1400)
StdAwk::close ();
#else
QSE::StdAwk::close ();
#endif
numConInFiles = 0;
numConOutFiles = 0;
@ -240,11 +219,7 @@ public:
{
srcInName = in;
srcOutName = out;
#if defined(_MSC_VER) && (_MSC_VER<1400)
return StdAwk::parse ();
#else
return QSE::StdAwk::parse ();
#endif
}
protected:
@ -359,21 +334,15 @@ protected:
// console io handlers
int openConsole (Console& io)
{
#if defined(_MSC_VER) && (_MSC_VER<1400)
StdAwk::Console::Mode mode = io.getMode();
#else
QSE::StdAwk::Console::Mode mode = io.getMode();
#endif
FILE* fp = QSE_NULL;
const char_t* fn = QSE_NULL;
switch (mode)
{
#if defined(_MSC_VER) && (_MSC_VER<1400)
case StdAwk::Console::READ:
#else
case QSE::StdAwk::Console::READ:
#endif
if (numConInFiles == 0) fp = stdin;
else
{
@ -382,11 +351,8 @@ protected:
}
break;
#if defined(_MSC_VER) && (_MSC_VER<1400)
case StdAwk::Console::WRITE:
#else
case QSE::StdAwk::Console::WRITE:
#endif
if (numConOutFiles == 0) fp = stdout;
else
{
@ -509,11 +475,8 @@ protected:
int nextConsole (Console& io)
{
#if defined(_MSC_VER) && (_MSC_VER<1400)
StdAwk::Console::Mode mode = io.getMode();
#else
QSE::StdAwk::Console::Mode mode = io.getMode();
#endif
ConTrack* t = (ConTrack*)io.getHandle();
FILE* ofp = t->handle;
FILE* nfp = QSE_NULL;
@ -521,21 +484,15 @@ protected:
switch (mode)
{
#if defined(_MSC_VER) && (_MSC_VER<1400)
case StdAwk::Console::READ:
#else
case QSE::StdAwk::Console::READ:
#endif
if (t->nextConIdx >= numConInFiles) return 0;
fn = conInFile[t->nextConIdx];
nfp = qse_fopen (fn, QSE_T("r"));
break;
#if defined(_MSC_VER) && (_MSC_VER<1400)
case StdAwk::Console::WRITE:
#else
case QSE::StdAwk::Console::WRITE:
#endif
if (t->nextConIdx >= numConOutFiles) return 0;
fn = conOutFile[t->nextConIdx];
nfp = qse_fopen (fn, QSE_T("w"));
@ -679,39 +636,6 @@ static void unset_intr_run (void)
#endif
}
#ifndef NDEBUG
void qse_assert_abort (void)
{
abort ();
}
void qse_assert_printf (const qse_char_t* fmt, ...)
{
va_list ap;
#ifdef _WIN32
int n;
qse_char_t buf[1024];
#endif
va_start (ap, fmt);
#if defined(_WIN32)
n = _vsntprintf (buf, QSE_COUNTOF(buf), fmt, ap);
if (n < 0) buf[QSE_COUNTOF(buf)-1] = QSE_T('\0');
#if defined(_MSC_VER) && (_MSC_VER<1400)
MessageBox (NULL, buf,
QSE_T("Assertion Failure"), MB_OK|MB_ICONERROR);
#else
MessageBox (NULL, buf,
QSE_T("\uB2DD\uAE30\uB9AC \uC870\uB610"), MB_OK|MB_ICONERROR);
#endif
#else
qse_vprintf (fmt, ap);
#endif
va_end (ap);
}
#endif
static void print_error (const qse_char_t* msg)
{
qse_printf (QSE_T("Error: %s\n"), msg);
@ -956,29 +880,7 @@ static int awk_main (int argc, qse_char_t* argv[])
return 0;
}
extern "C" int qse_main (int argc, qse_achar_t* argv[])
int qse_main (int argc, qse_achar_t* argv[])
{
int n;
#if defined(__linux) && defined(_DEBUG)
mtrace ();
#endif
#if defined(_WIN32) && defined(_DEBUG) && defined(_MSC_VER)
_CrtSetDbgFlag (_CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF);
#endif
n = qse_runmain (argc,argv,awk_main);
#if defined(__linux) && defined(_DEBUG)
muntrace ();
#endif
#if defined(_WIN32) && defined(_DEBUG)
/* #if defined(_MSC_VER)
_CrtDumpMemoryLeaks ();
#endif */
_tprintf (_T("Press ENTER to quit\n"));
getchar ();
#endif
return n;
return qse_runmain (argc,argv,awk_main);
}

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.c 199 2009-06-14 08:40:52Z hyunghwan.chung $
* $Id: awk.c 204 2009-06-18 12:08:06Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -600,6 +600,10 @@ static int awk_main (int argc, qse_char_t* argv[])
struct argout_t ao;
int ret = 0;
/* TODO: change it to support multiple source files */
qse_awk_parsestd_in_t psin;
qse_awk_parsestd_out_t psout;
qse_memset (&ao, 0, QSE_SIZEOF(ao));
i = handle_args (argc, argv, &ao);
@ -616,10 +620,6 @@ static int awk_main (int argc, qse_char_t* argv[])
awk = open_awk ();
if (awk == QSE_NULL) return -1;
/* TODO: change it to support multiple source files */
qse_awk_parsestd_in_t psin;
qse_awk_parsestd_out_t psout;
psin.type = ao.ist;
if (ao.ist == QSE_AWK_PARSESTD_CP) psin.u.cp = ao.isp.str;
else psin.u.file = ao.isp.files[0];

840
qse/configure vendored
View File

@ -16643,9 +16643,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# fi
#fi
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE -DQSE_HAVE_CONFIG_H"
OBJCFLAGS="$OBJCFLAGS -D_LARGEFILE64_SOURCE -DQSE_HAVE_CONFIG_H"
CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE -DQSE_HAVE_CONFIG_H"
CFLAGS="$CFLAGS -DQSE_HAVE_CONFIG_H"
OBJCFLAGS="$OBJCFLAGS -DQSE_HAVE_CONFIG_H"
CXXFLAGS="$CXXFLAGS -DQSE_HAVE_CONFIG_H"
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
OBJCFLAGS="$OBJCFLAGS -D_LARGEFILE64_SOURCE"
CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE"
case "$host" in
*-*-mingw*|*-*-cygwin*)
@ -17787,6 +17791,108 @@ done
for ac_func in wctrans towctrans
do
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
$as_echo_n "checking for $ac_func... " >&6; }
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
$as_echo_n "(cached) " >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $ac_func
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$ac_func || defined __stub___$ac_func
choke me
#endif
int
main ()
{
return $ac_func ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
eval "$as_ac_var=yes"
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
ac_res=`eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'`
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
as_val=`eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'`
if test "x$as_val" = x""yes; then
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_func in lseek64 stat64 fstat64 ftruncate64
@ -23911,6 +24017,724 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:$LINENO: checking size of off_t" >&5
$as_echo_n "checking size of off_t... " >&6; }
if test "${ac_cv_sizeof_off_t+set}" = set; then
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then
# Depending upon the size, compute the lo and hi bounds.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) >= 0)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_lo=0 ac_mid=0
while :; do
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_hi=$ac_mid; break
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo=`expr $ac_mid + 1`
if test $ac_lo -le $ac_mid; then
ac_lo= ac_hi=
break
fi
ac_mid=`expr 2 '*' $ac_mid + 1`
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) < 0)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_hi=-1 ac_mid=-1
while :; do
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) >= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_lo=$ac_mid; break
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_hi=`expr '(' $ac_mid ')' - 1`
if test $ac_mid -le $ac_hi; then
ac_lo= ac_hi=
break
fi
ac_mid=`expr 2 '*' $ac_mid`
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo= ac_hi=
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# Binary search between lo and hi bounds.
while test "x$ac_lo" != "x$ac_hi"; do
ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_hi=$ac_mid
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo=`expr '(' $ac_mid ')' + 1`
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
case $ac_lo in
?*) ac_cv_sizeof_off_t=$ac_lo;;
'') if test "$ac_cv_type_off_t" = yes; then
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off_t)
See \`config.log' for more details." >&5
$as_echo "$as_me: error: cannot compute sizeof (off_t)
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }; }
else
ac_cv_sizeof_off_t=0
fi ;;
esac
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
static long int longval () { return (long int) (sizeof (off_t)); }
static unsigned long int ulongval () { return (long int) (sizeof (off_t)); }
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
FILE *f = fopen ("conftest.val", "w");
if (! f)
return 1;
if (((long int) (sizeof (off_t))) < 0)
{
long int i = longval ();
if (i != ((long int) (sizeof (off_t))))
return 1;
fprintf (f, "%ld", i);
}
else
{
unsigned long int i = ulongval ();
if (i != ((long int) (sizeof (off_t))))
return 1;
fprintf (f, "%lu", i);
}
/* Do not output a trailing newline, as this causes \r\n confusion
on some platforms. */
return ferror (f) || fclose (f) != 0;
;
return 0;
}
_ACEOF
rm -f conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_sizeof_off_t=`cat conftest.val`
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
if test "$ac_cv_type_off_t" = yes; then
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off_t)
See \`config.log' for more details." >&5
$as_echo "$as_me: error: cannot compute sizeof (off_t)
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }; }
else
ac_cv_sizeof_off_t=0
fi
fi
rm -rf conftest.dSYM
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
rm -f conftest.val
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5
$as_echo "$ac_cv_sizeof_off_t" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_OFF_T $ac_cv_sizeof_off_t
_ACEOF
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:$LINENO: checking size of off64_t" >&5
$as_echo_n "checking size of off64_t... " >&6; }
if test "${ac_cv_sizeof_off64_t+set}" = set; then
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then
# Depending upon the size, compute the lo and hi bounds.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) >= 0)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_lo=0 ac_mid=0
while :; do
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_hi=$ac_mid; break
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo=`expr $ac_mid + 1`
if test $ac_lo -le $ac_mid; then
ac_lo= ac_hi=
break
fi
ac_mid=`expr 2 '*' $ac_mid + 1`
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) < 0)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_hi=-1 ac_mid=-1
while :; do
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) >= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_lo=$ac_mid; break
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_hi=`expr '(' $ac_mid ')' - 1`
if test $ac_mid -le $ac_hi; then
ac_lo= ac_hi=
break
fi
ac_mid=`expr 2 '*' $ac_mid`
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo= ac_hi=
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# Binary search between lo and hi bounds.
while test "x$ac_lo" != "x$ac_hi"; do
ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((long int) (sizeof (off64_t))) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_hi=$ac_mid
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo=`expr '(' $ac_mid ')' + 1`
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
case $ac_lo in
?*) ac_cv_sizeof_off64_t=$ac_lo;;
'') if test "$ac_cv_type_off64_t" = yes; then
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off64_t)
See \`config.log' for more details." >&5
$as_echo "$as_me: error: cannot compute sizeof (off64_t)
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }; }
else
ac_cv_sizeof_off64_t=0
fi ;;
esac
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
static long int longval () { return (long int) (sizeof (off64_t)); }
static unsigned long int ulongval () { return (long int) (sizeof (off64_t)); }
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
FILE *f = fopen ("conftest.val", "w");
if (! f)
return 1;
if (((long int) (sizeof (off64_t))) < 0)
{
long int i = longval ();
if (i != ((long int) (sizeof (off64_t))))
return 1;
fprintf (f, "%ld", i);
}
else
{
unsigned long int i = ulongval ();
if (i != ((long int) (sizeof (off64_t))))
return 1;
fprintf (f, "%lu", i);
}
/* Do not output a trailing newline, as this causes \r\n confusion
on some platforms. */
return ferror (f) || fclose (f) != 0;
;
return 0;
}
_ACEOF
rm -f conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_sizeof_off64_t=`cat conftest.val`
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
if test "$ac_cv_type_off64_t" = yes; then
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off64_t)
See \`config.log' for more details." >&5
$as_echo "$as_me: error: cannot compute sizeof (off64_t)
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }; }
else
ac_cv_sizeof_off64_t=0
fi
fi
rm -rf conftest.dSYM
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
rm -f conftest.val
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_off64_t" >&5
$as_echo "$ac_cv_sizeof_off64_t" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_OFF64_T $ac_cv_sizeof_off64_t
_ACEOF
cat >>confdefs.h <<_ACEOF
@ -23988,6 +24812,16 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
cat >>confdefs.h <<_ACEOF
#define QSE_SIZEOF_OFF_T ${ac_cv_sizeof_off_t}
_ACEOF
cat >>confdefs.h <<_ACEOF
#define QSE_SIZEOF_OFF64_T ${ac_cv_sizeof_off64_t}
_ACEOF
cat >>confdefs.h <<_ACEOF
#define QSE_VERSION "${VERSION}"

View File

@ -68,10 +68,15 @@ AC_SUBST(LIBTOOL_DEPS)
# fi
#fi
dnl indicate the existence of config.h
CFLAGS="$CFLAGS -DQSE_HAVE_CONFIG_H"
OBJCFLAGS="$OBJCFLAGS -DQSE_HAVE_CONFIG_H"
CXXFLAGS="$CXXFLAGS -DQSE_HAVE_CONFIG_H"
dnl make visible the 64-bit interface to the file system
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE -DQSE_HAVE_CONFIG_H"
OBJCFLAGS="$OBJCFLAGS -D_LARGEFILE64_SOURCE -DQSE_HAVE_CONFIG_H"
CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE -DQSE_HAVE_CONFIG_H"
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
OBJCFLAGS="$OBJCFLAGS -D_LARGEFILE64_SOURCE"
CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE"
dnl define the WIN32 conditional if necessary
case "$host" in
@ -101,6 +106,7 @@ dnl check functions
AC_CHECK_FUNCS([uselocale])
AC_CHECK_FUNCS([mbrlen mbrtowc wcrtomb])
AC_CHECK_FUNCS([mbsnrtowcs mbsrtowcs wcsnrtombs wcsrtombs])
AC_CHECK_FUNCS([wctrans towctrans])
AC_CHECK_FUNCS([lseek64 stat64 fstat64 ftruncate64])
AC_CHECK_FUNCS([timegm timelocal])
AC_CHECK_FUNCS([utime utimes])
@ -130,6 +136,8 @@ AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(long double)
AC_CHECK_SIZEOF(wchar_t)
AC_CHECK_SIZEOF(off_t)
AC_CHECK_SIZEOF(off64_t)
AC_DEFINE_UNQUOTED(QSE_SIZEOF_CHAR, ${ac_cv_sizeof_char}, [sizeof(char)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_SHORT, ${ac_cv_sizeof_short}, [sizeof(short)])
@ -146,6 +154,8 @@ AC_DEFINE_UNQUOTED(QSE_SIZEOF_FLOAT, ${ac_cv_sizeof_float}, [sizeof(float)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_DOUBLE, ${ac_cv_sizeof_double}, [sizeof(double)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_LONG_DOUBLE, ${ac_cv_sizeof_long_double}, [sizeof(long double)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_WCHAR_T, ${ac_cv_sizeof_wchar_t}, [sizeof(wchar_t)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_OFF_T, ${ac_cv_sizeof_off_t}, [sizeof(off_t)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_OFF64_T, ${ac_cv_sizeof_off64_t}, [sizeof(off64_t)])
AC_DEFINE_UNQUOTED(QSE_VERSION, "${VERSION}", [package version])
AC_DEFINE_UNQUOTED(QSE_VERSION_MAJOR, $(echo ${VERSION} | cut -d. -f1), [major version number])

View File

@ -1,6 +1,6 @@
# EXTRA_DIST = README
SUBDIRS = cmn utl awk lsp
SUBDIRS = cmn sed awk lsp utl
pkginclude_HEADERS = config.h.in conf_msw.h conf_vms.h types.h macros.h pack1.h unpack.h

View File

@ -211,7 +211,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
# EXTRA_DIST = README
SUBDIRS = cmn utl awk lsp
SUBDIRS = cmn sed awk lsp utl
pkginclude_HEADERS = config.h.in conf_msw.h conf_vms.h types.h \
macros.h pack1.h unpack.h $(am__append_1)
CLEANFILES = *dist

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.hpp 202 2009-06-16 06:05:40Z hyunghwan.chung $
* $Id: Awk.hpp 204 2009-06-18 12:08:06Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -29,6 +29,11 @@
QSE_BEGIN_NAMESPACE(QSE)
/////////////////////////////////
/**
* @example Awk.cpp
* This program demonstrates how to build a complete awk interpreter in C++.
*/
/**
* Represents the AWK interpreter engine
*/

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h 202 2009-06-16 06:05:40Z hyunghwan.chung $
* $Id: awk.h 204 2009-06-18 12:08:06Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -27,6 +27,8 @@
/** @file
* An embeddable AWK interpreter is defined in this header files.
*
* @example awk.c
* This program demonstrates how to build a complete awk interpreter.
* @example awk01.c
* This program demonstrates how to use qse_awk_rtx_loop().
* @example awk02.c
@ -55,13 +57,13 @@ typedef struct qse_awk_rtx_t qse_awk_rtx_t; /* (R)untime con(T)e(X)t */
#if QSE_SIZEOF_INT == 2
# define QSE_AWK_VAL_HDR \
unsigned int type: 3; \
unsigned int ref: 11 \
unsigned int nstr: 2;
unsigned int ref: 11; \
unsigned int nstr: 2
#else
# define QSE_AWK_VAL_HDR \
unsigned int type: 3; \
unsigned int ref: 27; \
unsigned int nstr: 2;
unsigned int nstr: 2
#endif
#define QSE_AWK_VAL_TYPE(x) ((x)->type)
@ -160,7 +162,6 @@ struct qse_awk_val_ref_t
};
typedef struct qse_awk_val_ref_t qse_awk_val_ref_t;
typedef qse_real_t (*qse_awk_pow_t) (
qse_awk_t* awk,
qse_real_t x,

View File

@ -1,5 +1,5 @@
/*
* $Id: fio.h 75 2009-02-22 14:10:34Z hyunghwan.chung $
* $Id: fio.h 204 2009-06-18 12:08:06Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -80,7 +80,18 @@ enum qse_fio_mode_t
#endif
/* file offset */
typedef qse_int64_t qse_fio_off_t;
#if defined(QSE_HAVE_INT64_T) && (QSE_SIZEOF_OFF64_T==8)
typedef qse_int64_t qse_fio_off_t;
#elif defined(QSE_HAVE_INT64_T) && (QSE_SIZEOF_OFF_T==8)
typedef qse_int64_t qse_fio_off_t;
#elif defined(QSE_HAVE_INT32_T) && (QSE_SIZEOF_OFF_T==4)
typedef qse_int32_t qse_fio_off_t;
#elif defined(QSE_HAVE_INT16_T) && (QSE_SIZEOF_OFF_T==2)
typedef qse_int16_t qse_fio_off_t;
#else
# error Unsupported platform
#endif
typedef enum qse_fio_seek_origin_t qse_fio_ori_t;
typedef struct qse_fio_t qse_fio_t;

View File

@ -165,6 +165,9 @@
/* Define to 1 if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define to 1 if you have the `towctrans' function. */
#undef HAVE_TOWCTRANS
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
@ -195,6 +198,9 @@
/* Define to 1 if you have the `wcsrtombs' function. */
#undef HAVE_WCSRTOMBS
/* Define to 1 if you have the `wctrans' function. */
#undef HAVE_WCTRANS
/* Define to 1 if you have the <wctype.h> header file. */
#undef HAVE_WCTYPE_H
@ -259,6 +265,12 @@
/* sizeof(long long) */
#undef QSE_SIZEOF_LONG_LONG
/* sizeof(off64_t) */
#undef QSE_SIZEOF_OFF64_T
/* sizeof(off_t) */
#undef QSE_SIZEOF_OFF_T
/* sizeof(short) */
#undef QSE_SIZEOF_SHORT
@ -319,6 +331,12 @@
/* The size of `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG
/* The size of `off64_t', as computed by sizeof. */
#undef SIZEOF_OFF64_T
/* The size of `off_t', as computed by sizeof. */
#undef SIZEOF_OFF_T
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT

View File

@ -1,5 +1,5 @@
/*
* $Id: types.h 186 2009-06-06 13:42:57Z hyunghwan.chung $
* $Id: types.h 204 2009-06-18 12:08:06Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -116,9 +116,13 @@ typedef enum qse_tri_t qse_tri_t;
* The qse_uint8_t type defines an 8-bit unsigned integer type.
*/
#if QSE_SIZEOF_CHAR == 1
# define QSE_HAVE_INT8_T
# define QSE_HAVE_UINT8_T
typedef char qse_int8_t;
typedef unsigned char qse_uint8_t;
#elif QSE_SIZEOF___INT8 == 1
# define QSE_HAVE_INT8_T
# define QSE_HAVE_UINT8_T
typedef __int8 qse_int8_t;
typedef unsigned __int8 qse_uint8_t;
#endif
@ -130,9 +134,13 @@ typedef enum qse_tri_t qse_tri_t;
* The qse_uint16_t type defines an 16-bit unsigned integer type.
*/
#if QSE_SIZEOF_SHORT == 2
# define QSE_HAVE_INT16_T
# define QSE_HAVE_UINT16_T
typedef short qse_int16_t;
typedef unsigned short qse_uint16_t;
#elif QSE_SIZEOF___INT16 == 2
# define QSE_HAVE_INT16_T
# define QSE_HAVE_UINT16_T
typedef __int16 qse_int16_t;
typedef unsigned __int16 qse_uint16_t;
#endif
@ -144,12 +152,18 @@ typedef enum qse_tri_t qse_tri_t;
* The qse_uint32_t type defines an 32-bit unsigned integer type.
*/
#if QSE_SIZEOF_INT == 4
# define QSE_HAVE_INT32_T
# define QSE_HAVE_UINT32_T
typedef int qse_int32_t;
typedef unsigned int qse_uint32_t;
#elif QSE_SIZEOF_LONG == 4
# define QSE_HAVE_INT32_T
# define QSE_HAVE_UINT32_T
typedef long qse_int32_t;
typedef unsigned long qse_uint32_t;
#elif QSE_SIZEOF___INT32 == 4
# define QSE_HAVE_INT32_T
# define QSE_HAVE_UINT32_T
typedef __int32 qse_int32_t;
typedef unsigned __int32 qse_uint32_t;
#endif
@ -265,7 +279,7 @@ typedef int qse_mcint_t;
* #QSE_WCHAR_EOF.
*/
#if defined(__cplusplus) && \
(!defined(_MSC_VER) || \
(!(defined(_MSC_VER) || defined(_SCO_DS)) || \
(defined(_MSC_VER) && defined(_NATIVE_WCHAR_T_DEFINED)))
/* C++ */

View File

@ -4,7 +4,7 @@ AUTOMAKE_OPTIONS = nostdinc
AM_CPPFLAGS = -I$(top_srcdir)/include
lib_LTLIBRARIES = libqseawk.la
libqseawk_la_SOURCES = awk.c err.c tree.c parse.c run.c rec.c val.c fnc.c misc.c rio.c std.c awk.h rio.h val.h fnc.h misc.h parse.h run.h tree.h
libqseawk_la_SOURCES = awk.c err.c tree.c parse.c run.c rec.c val.c fnc.c misc.c rio.c std.c awk.h err.h rio.h val.h fnc.h misc.h parse.h run.h tree.h
libqseawk_la_LDFLAGS = -L../cmn -version-info 1:0:0 -no-undefined
libqseawk_la_LIBADD = -lqsecmn $(LIBM)

View File

@ -237,7 +237,7 @@ top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = nostdinc
AM_CPPFLAGS = -I$(top_srcdir)/include
lib_LTLIBRARIES = libqseawk.la $(am__append_1)
libqseawk_la_SOURCES = awk.c err.c tree.c parse.c run.c rec.c val.c fnc.c misc.c rio.c std.c awk.h rio.h val.h fnc.h misc.h parse.h run.h tree.h
libqseawk_la_SOURCES = awk.c err.c tree.c parse.c run.c rec.c val.c fnc.c misc.c rio.c std.c awk.h err.h rio.h val.h fnc.h misc.h parse.h run.h tree.h
libqseawk_la_LDFLAGS = -L../cmn -version-info 1:0:0 -no-undefined
libqseawk_la_LIBADD = -lqsecmn $(LIBM)
@ENABLE_CXX_TRUE@libqseawk___la_SOURCES = Awk.cpp StdAwk.cpp

View File

@ -1,5 +1,5 @@
/*
* $Id: parse.c 199 2009-06-14 08:40:52Z hyunghwan.chung $
* $Id: parse.c 204 2009-06-18 12:08:06Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -4516,10 +4516,12 @@ static qse_awk_nde_t* parse_print (qse_awk_t* awk, qse_size_t line, int type)
{
if (ep->opcode == tab[i].opc)
{
qse_awk_nde_t* tmp;
if (tab[i].opt &&
!(awk->option&tab[i].opt)) break;
qse_awk_nde_t* tmp = args_tail;
tmp = args_tail;
if (tail_prev != QSE_NULL)
tail_prev->next = ep->left;
@ -4963,6 +4965,7 @@ static int get_token (qse_awk_t* awk)
else
{
int i;
qse_char_t cc;
static struct
{
qse_char_t c;
@ -4995,7 +4998,7 @@ static int get_token (qse_awk_t* awk)
}
}
qse_char_t cc = (qse_char_t)c;
cc = (qse_char_t)c;
SETERRARG (awk, QSE_AWK_ELXCHR, awk->token.line, &cc, 1);
return -1;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: run.c 202 2009-06-16 06:05:40Z hyunghwan.chung $
* $Id: run.c 204 2009-06-18 12:08:06Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -1469,9 +1469,12 @@ qse_awk_val_t* qse_awk_rtx_call (
qse_awk_fun_t* fun;
struct capture_retval_data_t crdata;
qse_awk_val_t* v;
struct pafv pafv = { args, nargs };
struct pafv pafv/*= { args, nargs }*/;
qse_awk_nde_call_t call;
pafv.args = args;
pafv.nargs = nargs;
if (rtx->exit_level >= EXIT_NEXT)
{
/* cannot call the function again when exit() is called

View File

@ -1,5 +1,5 @@
/*
* $Id: std.c 202 2009-06-16 06:05:40Z hyunghwan.chung $
* $Id: std.c 204 2009-06-18 12:08:06Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -956,8 +956,9 @@ static int fnc_math_1 (
}
else
{
float (*rf) (float);
QSE_ASSERT (type == FNC_MATH_F);
float (*rf) (float) = (float(*)(float))f;
rf = (float(*)(float))f;
r = qse_awk_rtx_makerealval (run, rf(rv));
}
@ -1008,8 +1009,9 @@ static int fnc_math_2 (
}
else
{
float (*rf) (float,float);
QSE_ASSERT (type == FNC_MATH_F);
float (*rf) (float,float) = (float(*)(float,float))f;
rf = (float(*)(float,float))f;
r = qse_awk_rtx_makerealval (run, rf(rv0,rv1));
}

View File

@ -1,5 +1,5 @@
/*
* $Id: chr.c 127 2009-05-07 13:15:04Z hyunghwan.chung $
* $Id: chr.c 204 2009-06-18 12:08:06Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -113,6 +113,7 @@ qse_bool_t qse_ccls_is (qse_cint_t c, qse_ccls_id_t type)
qse_cint_t qse_ccls_to (qse_cint_t c, qse_ccls_id_t type)
{
#ifdef HAVE_WCTRANS
static const char* name[] =
{
"toupper",
@ -126,10 +127,16 @@ qse_cint_t qse_ccls_to (qse_cint_t c, qse_ccls_id_t type)
};
QSE_ASSERTX (type >= QSE_CCLS_UPPER && type <= QSE_CCLS_LOWER,
"The character type should be one of QSE_CCLS_UPPER and QSE_CCLS_LOWER");
"The type should be one of QSE_CCLS_UPPER and QSE_CCLS_LOWER");
if (desc[type] == (wctrans_t)0) desc[type] = wctrans(name[type]);
return towctrans (c, desc[type]);
#else
QSE_ASSERTX (type >= QSE_CCLS_UPPER && type <= QSE_CCLS_LOWER,
"The type should be one of QSE_CCLS_UPPER and QSE_CCLS_LOWER");
return (type == QSE_CCLS_UPPER)? towupper(c): towlower(c);
#endif
}
#else

View File

@ -1,5 +1,5 @@
/*
* $Id: chr_cnv.c 76 2009-02-22 14:18:06Z hyunghwan.chung $
* $Id: chr_cnv.c 204 2009-06-18 12:08:06Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -80,6 +80,15 @@ qse_size_t qse_wctomb (qse_wchar_t wc, qse_mchar_t* mb, qse_size_t mblen)
* of a character.
*/
#ifdef _SCO_DS
/* SCO defines MB_CUR_MAX as shown below:
* extern unsigned char __ctype[];
* #define MB_CUR_MAX ((int)__ctype[520])
* Some hacks are needed for compilation with a C89 compiler. */
# undef MB_CUR_MAX
# define MB_CUR_MAX 32
#endif
if (mblen < MB_CUR_MAX)
{
qse_mchar_t buf[MB_CUR_MAX];

View File

@ -1,5 +1,5 @@
/*
* $Id: fio.c 193 2009-06-08 13:09:01Z hyunghwan.chung $
* $Id: fio.c 204 2009-06-18 12:08:06Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -29,6 +29,9 @@
# include <sys/types.h>
# include <fcntl.h>
# include <limits.h>
# ifndef PATH_MAX
# define PATH_MAX 2048
# endif
#endif
QSE_IMPLEMENT_COMMON_FUNCTIONS (fio)

View File

@ -1,5 +1,5 @@
/*
* $Id: rex.c 203 2009-06-17 12:43:50Z hyunghwan.chung $
* $Id: rex.c 204 2009-06-18 12:08:06Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -1726,7 +1726,12 @@ static const qse_byte_t* match_group (
mat2.match_ptr = mat->match_ptr;
while (si < cp->ubound)
{
if (mat2.match_ptr >= matcher->match.str.end) break;
/* for eol($) check, it should not break when
* mat2.match_ptr == matcher->match.str.end.
* matcher->match.str.end is one character past the
* actual end */
/*if (mat2.match_ptr >= matcher->match.str.end) break;*/
if (mat2.match_ptr > matcher->match.str.end) break;
if (match_pattern (matcher, p, &mat2) == QSE_NULL)
{