added qse_awk_setopt()/qse_awk_getopt().

deleted qse_awk_getoption()/qse_awk_setoption()/qse_awk_setmaxdepth()/qse_awk_getmaxdepth().
redefined enumeration types related to the functions added or deleted above.
moved fnc_sleep from cmd/awk/awk.c to mod/awk/sys.c
managed to get external module call working in the primitive level
This commit is contained in:
hyung-hwan 2012-10-21 16:19:03 +00:00
parent 11b9829c9b
commit ff13bf4668
37 changed files with 1758 additions and 414 deletions

View File

@ -2,7 +2,7 @@ AUTOMAKE_OPTION = foreign
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = LICENSE
SUBDIRS = include lib cmd
SUBDIRS = include lib cmd mod
DIST_SUBDIRS = $(SUBDIRS) regress samples doc tools
distclean-local:

View File

@ -264,7 +264,7 @@ top_srcdir = @top_srcdir@
AUTOMAKE_OPTION = foreign
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = LICENSE
SUBDIRS = include lib cmd
SUBDIRS = include lib cmd mod
DIST_SUBDIRS = $(SUBDIRS) regress samples doc tools
all: all-recursive

View File

@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = nostdinc
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(includedir)
-I$(includedir)
#####################################################################3

View File

@ -249,7 +249,7 @@ AUTOMAKE_OPTIONS = nostdinc
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(includedir)
-I$(includedir)
qseawk_SOURCES = awk.c
qseawk_LDFLAGS = -L../../lib/awk -L../../lib/cmn -L$(libdir)

View File

@ -54,6 +54,8 @@
#else
# include <unistd.h>
# include <errno.h>
# include <ltdl.h>
# define USE_LTDL
#endif
#if defined(ENABLE_MPI)
@ -356,41 +358,6 @@ static void on_statement (qse_awk_rtx_t* rtx, qse_awk_nde_t* nde)
}
#endif
static int fnc_sleep (qse_awk_rtx_t* run, const qse_cstr_t* fnm)
{
qse_size_t nargs;
qse_awk_val_t* a0;
qse_long_t lv;
qse_flt_t rv;
qse_awk_val_t* r;
int n;
nargs = qse_awk_rtx_getnargs (run);
QSE_ASSERT (nargs == 1);
a0 = qse_awk_rtx_getarg (run, 0);
n = qse_awk_rtx_valtonum (run, a0, &lv, &rv);
if (n == -1) return -1;
if (n == 1) lv = (qse_long_t)rv;
#if defined(_WIN32)
Sleep ((DWORD)(lv * 1000));
n = 0;
#elif defined(__OS2__)
DosSleep ((ULONG)(lv * 1000));
n = 0;
#else
n = sleep (lv);
#endif
r = qse_awk_rtx_makeintval (run, n);
if (r == QSE_NULL) return -1;
qse_awk_rtx_setretval (run, r);
return 0;
}
static void print_version (void)
{
qse_printf (QSE_T("QSEAWK version %hs\n"), QSE_PACKAGE_VERSION);
@ -1050,24 +1017,22 @@ static int awk_main (int argc, qse_char_t* argv[])
goto oops;
}
i = qse_awk_getoption (awk);
qse_awk_getopt (awk, QSE_AWK_TRAIT, &i);
if (arg.opton) i |= arg.opton;
if (arg.optoff) i &= ~arg.optoff;
qse_awk_setoption (awk, i);
qse_awk_setopt (awk, QSE_AWK_TRAIT, &i);
/* TODO: get depth from command line */
qse_awk_setmaxdepth (
awk, QSE_AWK_DEPTH_BLOCK_PARSE | QSE_AWK_DEPTH_EXPR_PARSE, 50);
qse_awk_setmaxdepth (
awk, QSE_AWK_DEPTH_BLOCK_RUN | QSE_AWK_DEPTH_EXPR_RUN, 500);
qse_awk_setmaxdepth (awk, QSE_AWK_DEPTH_INCLUDE, 32);
if (qse_awk_addfnc (awk,
QSE_T("sleep"), 5, 0,
1, 1, QSE_NULL, fnc_sleep) == QSE_NULL)
{
print_awkerr (awk);
goto oops;
qse_size_t tmp;
tmp = 50;
qse_awk_setopt (awk, QSE_AWK_DEPTH_BLOCK_PARSE, &tmp);
qse_awk_setopt (awk, QSE_AWK_DEPTH_EXPR_PARSE, &tmp);
tmp = 500;
qse_awk_setopt (awk, QSE_AWK_DEPTH_BLOCK_RUN, &tmp);
qse_awk_setopt (awk, QSE_AWK_DEPTH_EXPR_RUN, &tmp);
tmp = 64;
qse_awk_setopt (awk, QSE_AWK_DEPTH_INCLUDE, &tmp);
}
qse_awk_seterrnum (awk, QSE_AWK_ENOERR, QSE_NULL);
@ -1202,8 +1167,16 @@ int qse_main (int argc, qse_achar_t* argv[])
MPI_Comm_set_errhandler (MPI_COMM_WORLD, MPI_ERRORS_RETURN);
#endif
#if defined(USE_LTDL)
lt_dlinit ();
#endif
ret = qse_runmain (argc, argv, awk_main);
#if defined(USE_LTDL)
lt_dlexit ();
#endif
#if defined(ENABLE_MPI)
MPI_Finalize ();
oops:

4
qse/configure vendored
View File

@ -19092,7 +19092,7 @@ QSE_PROJECT_AUTHOR="${PACKAGE_BUGREPORT}"
QSE_PROJECT_URL="${PACKAGE_URL}"
ac_config_files="$ac_config_files Makefile README include/Makefile include/qse/Makefile include/qse/cmn/Makefile include/qse/awk/Makefile include/qse/sed/Makefile include/qse/stx/Makefile include/qse/net/Makefile lib/Makefile lib/cmn/Makefile lib/awk/Makefile lib/sed/Makefile lib/stx/Makefile lib/net/Makefile cmd/Makefile cmd/awk/Makefile cmd/sed/Makefile cmd/stx/Makefile samples/Makefile samples/cmn/Makefile samples/awk/Makefile samples/sed/Makefile samples/net/Makefile regress/Makefile regress/awk/Makefile regress/awk/regress.sh regress/sed/Makefile regress/sed/regress.sh doc/Makefile doc/page/Makefile doc/image/Makefile doc/Doxyfile tools/Makefile"
ac_config_files="$ac_config_files Makefile README include/Makefile include/qse/Makefile include/qse/cmn/Makefile include/qse/awk/Makefile include/qse/sed/Makefile include/qse/stx/Makefile include/qse/net/Makefile lib/Makefile lib/cmn/Makefile lib/awk/Makefile lib/sed/Makefile lib/stx/Makefile lib/net/Makefile cmd/Makefile cmd/awk/Makefile cmd/sed/Makefile cmd/stx/Makefile mod/Makefile mod/awk/Makefile samples/Makefile samples/cmn/Makefile samples/awk/Makefile samples/sed/Makefile samples/net/Makefile regress/Makefile regress/awk/Makefile regress/awk/regress.sh regress/sed/Makefile regress/sed/regress.sh doc/Makefile doc/page/Makefile doc/image/Makefile doc/Doxyfile tools/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@ -20242,6 +20242,8 @@ do
"cmd/awk/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/awk/Makefile" ;;
"cmd/sed/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/sed/Makefile" ;;
"cmd/stx/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/stx/Makefile" ;;
"mod/Makefile") CONFIG_FILES="$CONFIG_FILES mod/Makefile" ;;
"mod/awk/Makefile") CONFIG_FILES="$CONFIG_FILES mod/awk/Makefile" ;;
"samples/Makefile") CONFIG_FILES="$CONFIG_FILES samples/Makefile" ;;
"samples/cmn/Makefile") CONFIG_FILES="$CONFIG_FILES samples/cmn/Makefile" ;;
"samples/awk/Makefile") CONFIG_FILES="$CONFIG_FILES samples/awk/Makefile" ;;

View File

@ -405,6 +405,8 @@ AC_CONFIG_FILES([
cmd/awk/Makefile
cmd/sed/Makefile
cmd/stx/Makefile
mod/Makefile
mod/awk/Makefile
samples/Makefile
samples/cmn/Makefile
samples/awk/Makefile

View File

@ -53,11 +53,16 @@ public:
typedef qse_awk_errstr_t errstr_t;
typedef qse_awk_errinf_t errinf_t;
/// The depth_t type redefines #qse_awk_depth_t.
typedef qse_awk_depth_t depth_t;
/// The option_t type redefines #qse_awk_option_t.
typedef qse_awk_option_t option_t;
enum depth_t
{
DEPTH_INCLUDE = QSE_AWK_DEPTH_INCLUDE,
DEPTH_BLOCK_PARSE = QSE_AWK_DEPTH_BLOCK_PARSE,
DEPTH_BLOCK_RUN = QSE_AWK_DEPTH_BLOCK_RUN,
DEPTH_EXPR_PARSE = QSE_AWK_DEPTH_EXPR_PARSE,
DEPTH_EXPR_RUN = QSE_AWK_DEPTH_EXPR_RUN,
DEPTH_REX_BUILD = QSE_AWK_DEPTH_REX_BUILD,
DEPTH_REX_MATCH = QSE_AWK_DEPTH_REX_MATCH
};
/// The gbl_id_t type redefines #qse_awk_gbl_id_t.
typedef qse_awk_gbl_id_t gbl_id_t;
@ -948,16 +953,16 @@ public:
///
///
/// The getOption() function gets the current options.
/// @return 0 or current options ORed of #option_t enumerators.
/// The getTrait() function gets the current options.
/// @return current traits
///
int getOption () const;
int getTrait () const;
///
/// The setOption() function changes the current options.
/// The setTrait() function changes the current traits.
///
void setOption (
int opt ///< options ORed of #option_t enumerators.
void setTrait (
int trait
);
///
@ -965,7 +970,7 @@ public:
/// for operations identified by @a ids.
///
void setMaxDepth (
int ids, ///< number ORed of #depth_t enumerators
depth_t id, ///< depth identifier
size_t depth ///< new depth
);
@ -974,7 +979,7 @@ public:
/// type identified by @a id.
///
size_t getMaxDepth (
depth_t id ///< operation identifier
depth_t id ///< depth identifier
) const;
///

View File

@ -391,6 +391,7 @@ typedef qse_flt_t (*qse_awk_math2_t) (
);
#if 0
typedef void* (*qse_awk_buildrex_t) (
qse_awk_t* awk,
const qse_char_t* ptn,
@ -416,6 +417,7 @@ typedef qse_bool_t (*qse_awk_isemptyrex_t) (
qse_awk_t* awk,
void* code
);
#endif
/**
* The qse_awk_fnc_impl_t type defines a intrinsic function handler.
@ -809,11 +811,26 @@ struct qse_awk_rtx_ecb_t
/* ------------------------------------------------------------------------ */
enum qse_awk_opt_t
{
QSE_AWK_TRAIT = 0,
QSE_AWK_DEPTH_INCLUDE,
QSE_AWK_DEPTH_BLOCK_PARSE,
QSE_AWK_DEPTH_BLOCK_RUN,
QSE_AWK_DEPTH_EXPR_PARSE,
QSE_AWK_DEPTH_EXPR_RUN,
QSE_AWK_DEPTH_REX_BUILD,
QSE_AWK_DEPTH_REX_MATCH
};
typedef enum qse_awk_opt_t qse_awk_opt_t;
/* ------------------------------------------------------------------------ */
/**
* The qse_awk_option_t type defines various options to change the behavior
* The qse_awk_trait_t type defines various options to change the behavior
* of #qse_awk_t.
*/
enum qse_awk_option_t
enum qse_awk_trait_t
{
/**
* allows undeclared variables and implicit concatenation
@ -942,7 +959,8 @@ enum qse_awk_option_t
QSE_AWK_NEWLINE | QSE_AWK_PABLOCK |
QSE_AWK_STRIPSTRSPC | QSE_AWK_STRICTNAMING
};
typedef enum qse_awk_option_t qse_awk_option_t;
/* ------------------------------------------------------------------------ */
/**
* The qse_awk_errnum_t type defines error codes.
@ -1106,22 +1124,6 @@ typedef const qse_char_t* (*qse_awk_errstr_t) (
qse_awk_errnum_t num /**< error number */
);
/**
* The qse_awk_depth_t type defines operation types requiring recursion depth
* control.
*/
enum qse_awk_depth_t
{
QSE_AWK_DEPTH_BLOCK_PARSE = (1 << 0),
QSE_AWK_DEPTH_BLOCK_RUN = (1 << 1),
QSE_AWK_DEPTH_EXPR_PARSE = (1 << 2),
QSE_AWK_DEPTH_EXPR_RUN = (1 << 3),
QSE_AWK_DEPTH_REX_BUILD = (1 << 4),
QSE_AWK_DEPTH_REX_MATCH = (1 << 5),
QSE_AWK_DEPTH_INCLUDE = (1 << 6)
};
typedef enum qse_awk_depth_t qse_awk_depth_t;
/**
* The qse_awk_gbl_id_t type defines intrinsic globals variable IDs.
*/
@ -1435,41 +1437,16 @@ void qse_awk_seterror (
const qse_awk_loc_t* errloc /**< error location */
);
/**
* The qse_awk_getoption() function gets the current options set.
* @return 0 or a number ORed of #qse_awk_option_t enumerators.
*/
int qse_awk_getoption (
const qse_awk_t* awk /**< awk */
int qse_awk_getopt (
qse_awk_t* awk,
qse_awk_opt_t id,
void* value
);
/**
* The qse_awk_setoption() function sets the options.
*/
void qse_awk_setoption (
qse_awk_t* awk, /**< awk */
int opt /**< 0 or a number ORed of
* #qse_awk_option_t enumerators */
);
/**
* The qse_awk_getmaxdepth() function gets the current maximum recursing depth
* for a specified operation @a type.
* @return maximum depth
*/
qse_size_t qse_awk_getmaxdepth (
const qse_awk_t* awk, /**< awk */
qse_awk_depth_t type /**< operation type */
);
/**
* The qse_awk_setmaxdepth() function sets the maximum recursing depth for
* operations indicated by @a types.
*/
void qse_awk_setmaxdepth (
qse_awk_t* awk, /**< awk */
int types, /**< number ORed of #qse_awk_depth_t enumerators */
qse_size_t depth /**< maximum depth */
int qse_awk_setopt (
qse_awk_t* awk,
qse_awk_opt_t id,
const void* value
);
/**

View File

@ -44,6 +44,13 @@
*
*/
enum qse_awk_optstd_t
{
QSE_AWK_MODDIR = 0
};
typedef enum qse_awk_optstd_t qse_awk_optstd_t;
/**
* The qse_awk_parsestd_type_t type defines the types of source I/O.
*/
@ -128,6 +135,18 @@ void* qse_awk_getxtnstd (
qse_awk_t* awk
);
int qse_awk_getoptstd (
qse_awk_t* awk,
qse_awk_optstd_t id,
void* value
);
int qse_awk_setoptstd (
qse_awk_t* awk,
qse_awk_optstd_t id,
const void* value
);
/**
* The qse_awk_parsestd() functions parses source script.
* The code below shows how to parse a literal string 'BEGIN { print 10; }'

View File

@ -812,14 +812,14 @@ int qse_httpd_getserveroptstd (
qse_httpd_t* httpd,
qse_httpd_server_t* server,
qse_httpd_server_optstd_t id,
void** value
void* value
);
int qse_httpd_setserveroptstd (
qse_httpd_t* httpd,
qse_httpd_server_t* server,
qse_httpd_server_optstd_t id,
void* value
const void* value
);
void* qse_httpd_getserverxtnstd (

View File

@ -1306,28 +1306,33 @@ void Awk::fini_runctx ()
}
}
int Awk::getOption () const
int Awk::getTrait () const
{
QSE_ASSERT (awk != QSE_NULL);
return qse_awk_getoption (awk);
int val;
qse_awk_getopt (awk, QSE_AWK_TRAIT, &val);
return val;
}
void Awk::setOption (int opt)
void Awk::setTrait (int trait)
{
QSE_ASSERT (awk != QSE_NULL);
qse_awk_setoption (awk, opt);
}
void Awk::setMaxDepth (int ids, size_t depth)
{
QSE_ASSERT (awk != QSE_NULL);
qse_awk_setmaxdepth (awk, ids, depth);
qse_awk_setopt (awk, QSE_AWK_TRAIT, &trait);
}
Awk::size_t Awk::getMaxDepth (depth_t id) const
{
QSE_ASSERT (awk != QSE_NULL);
return qse_awk_getmaxdepth (awk, id);
size_t depth;
qse_awk_getopt (awk, (qse_awk_opt_t)id, &depth);
return depth;
}
void Awk::setMaxDepth (depth_t id, size_t depth)
{
QSE_ASSERT (awk != QSE_NULL);
qse_awk_setopt (awk, (qse_awk_opt_t)id, &depth);
}
int Awk::dispatch_function (Run* run, const cstr_t* name)

View File

@ -3,7 +3,8 @@ AUTOMAKE_OPTIONS = nostdinc
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(includedir)
-I$(includedir) \
-DDEFAULT_MODDIR=\"$(libdir)/qseawk\"
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 err.h rio.h val.h fnc.h misc.h parse.h run.h tree.h

View File

@ -290,7 +290,8 @@ AUTOMAKE_OPTIONS = nostdinc
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(includedir)
-I$(includedir) \
-DDEFAULT_MODDIR=\"$(libdir)/qseawk\"
lib_LTLIBRARIES = libqseawk.la $(am__append_1) $(am__append_2)
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

View File

@ -185,7 +185,7 @@ StdAwk::Run* StdAwk::parse (Source& in, Source& out)
// parse() result.
qse_htb_clear (&this->cmgrtab);
}
else if (run && (this->getOption() & QSE_AWK_RIO))
else if (run && (this->getTrait() & QSE_AWK_RIO))
{
// it initialized cmgrtab only if QSE_AWK_RIO is set.
// but if you call parse() multiple times while

View File

@ -209,9 +209,9 @@ qse_awk_t* qse_awk_open (qse_mmgr_t* mmgr, qse_size_t xtnsize, qse_awk_prm_t* pr
qse_lda_setscale (awk->parse.params, QSE_SIZEOF(qse_char_t));
qse_lda_setcopier (awk->parse.params, QSE_LDA_COPIER_INLINE);
awk->option = QSE_AWK_CLASSIC;
awk->opt.trait = QSE_AWK_CLASSIC;
#if defined(__OS2__) || defined(_WIN32) || defined(__DOS__)
awk->option |= QSE_AWK_CRLF;
awk->opt.trait |= QSE_AWK_CRLF;
#endif
awk->errinf.num = QSE_AWK_ENOERR;
@ -316,10 +316,10 @@ int qse_awk_clear (qse_awk_t* awk)
qse_htb_clear (awk->parse.funs);
awk->parse.nlcls_max = 0;
awk->parse.depth.cur.block = 0;
awk->parse.depth.cur.loop = 0;
awk->parse.depth.cur.expr = 0;
awk->parse.depth.cur.incl = 0;
awk->parse.depth.block = 0;
awk->parse.depth.loop = 0;
awk->parse.depth.expr = 0;
awk->parse.depth.incl = 0;
/* clear parse trees */
/*awk->tree.ngbls_base = 0;
@ -387,71 +387,59 @@ qse_awk_prm_t* qse_awk_getprm (qse_awk_t* awk)
return &awk->prm;
}
int qse_awk_getoption (const qse_awk_t* awk)
int qse_awk_setopt (qse_awk_t* awk, qse_awk_opt_t id, const void* value)
{
return awk->option;
switch (id)
{
case QSE_AWK_TRAIT:
awk->opt.trait = *(const int*)value;
return 0;
case QSE_AWK_DEPTH_INCLUDE:
case QSE_AWK_DEPTH_BLOCK_PARSE:
case QSE_AWK_DEPTH_BLOCK_RUN:
case QSE_AWK_DEPTH_EXPR_PARSE:
case QSE_AWK_DEPTH_EXPR_RUN:
case QSE_AWK_DEPTH_REX_BUILD:
case QSE_AWK_DEPTH_REX_MATCH:
awk->opt.depth.a[id - QSE_AWK_DEPTH_INCLUDE] = *(const qse_size_t*)value;
return 0;
}
qse_awk_seterrnum (awk, QSE_AWK_EINVAL, QSE_NULL);
return -1;
}
void qse_awk_setoption (qse_awk_t* awk, int opt)
int qse_awk_getopt (qse_awk_t* awk, qse_awk_opt_t id, void* value)
{
awk->option = opt;
switch (id)
{
case QSE_AWK_TRAIT:
*(int*)value = awk->opt.trait;
return 0;
case QSE_AWK_DEPTH_INCLUDE:
case QSE_AWK_DEPTH_BLOCK_PARSE:
case QSE_AWK_DEPTH_BLOCK_RUN:
case QSE_AWK_DEPTH_EXPR_PARSE:
case QSE_AWK_DEPTH_EXPR_RUN:
case QSE_AWK_DEPTH_REX_BUILD:
case QSE_AWK_DEPTH_REX_MATCH:
*(qse_size_t*)value = awk->opt.depth.a[id - QSE_AWK_DEPTH_INCLUDE];
return 0;
};
qse_awk_seterrnum (awk, QSE_AWK_EINVAL, QSE_NULL);
return -1;
}
void qse_awk_stopall (qse_awk_t* awk)
{
awk->stopall = QSE_TRUE;
qse_awk_seterrnum (awk, QSE_AWK_EINVAL, QSE_NULL);
return -1;
}
qse_size_t qse_awk_getmaxdepth (const qse_awk_t* awk, qse_awk_depth_t type)
{
return (type == QSE_AWK_DEPTH_BLOCK_PARSE)? awk->parse.depth.max.block:
(type == QSE_AWK_DEPTH_BLOCK_RUN)? awk->run.depth.max.block:
(type == QSE_AWK_DEPTH_EXPR_PARSE)? awk->parse.depth.max.expr:
(type == QSE_AWK_DEPTH_EXPR_RUN)? awk->run.depth.max.expr:
(type == QSE_AWK_DEPTH_REX_BUILD)? awk->rex.depth.max.build:
(type == QSE_AWK_DEPTH_REX_MATCH)? awk->rex.depth.max.match:
(type == QSE_AWK_DEPTH_INCLUDE)? awk->parse.depth.max.incl: 0;
}
void qse_awk_setmaxdepth (qse_awk_t* awk, int types, qse_size_t depth)
{
if (types & QSE_AWK_DEPTH_BLOCK_PARSE)
{
awk->parse.depth.max.block = depth;
}
if (types & QSE_AWK_DEPTH_EXPR_PARSE)
{
awk->parse.depth.max.expr = depth;
}
if (types & QSE_AWK_DEPTH_BLOCK_RUN)
{
awk->run.depth.max.block = depth;
}
if (types & QSE_AWK_DEPTH_EXPR_RUN)
{
awk->run.depth.max.expr = depth;
}
if (types & QSE_AWK_DEPTH_REX_BUILD)
{
awk->rex.depth.max.build = depth;
}
if (types & QSE_AWK_DEPTH_REX_MATCH)
{
awk->rex.depth.max.match = depth;
}
if (types & QSE_AWK_DEPTH_INCLUDE)
{
awk->parse.depth.max.incl = depth;
}
}
qse_awk_ecb_t* qse_awk_popecb (qse_awk_t* awk)
{
qse_awk_ecb_t* top = awk->ecb;

View File

@ -119,7 +119,24 @@ struct qse_awk_t
qse_awk_prm_t prm;
/* options */
int option;
struct
{
int trait;
union
{
qse_size_t a[7];
struct
{
qse_size_t incl;
qse_size_t block_parse;
qse_size_t block_run;
qse_size_t expr_parse;
qse_size_t expr_run;
qse_size_t rex_build;
qse_size_t rex_match;
} s;
} depth;
} opt;
/* parse tree */
qse_awk_tree_t tree;
@ -136,20 +153,10 @@ struct qse_awk_t
struct
{
struct
{
qse_size_t block;
qse_size_t loop;
qse_size_t expr; /* expression */
qse_size_t incl;
} cur;
struct
{
qse_size_t block;
qse_size_t expr;
qse_size_t incl;
} max;
qse_size_t block;
qse_size_t loop;
qse_size_t expr; /* expression */
qse_size_t incl;
} depth;
/* function calls */
@ -201,30 +208,6 @@ struct qse_awk_t
qse_htb_t* user;
} fnc;
struct
{
struct
{
struct
{
qse_size_t block;
qse_size_t expr;
} max;
} depth;
} run;
struct
{
struct
{
struct
{
qse_size_t build;
qse_size_t match;
} max;
} depth;
} rex;
struct
{
qse_char_t fmt[1024];
@ -360,17 +343,8 @@ struct qse_awk_rtx_t
struct
{
struct
{
qse_size_t block;
qse_size_t expr; /* expression */
} cur;
struct
{
qse_size_t block;
qse_size_t expr;
} max;
qse_size_t block;
qse_size_t expr; /* expression */
} depth;
qse_awk_errinf_t errinf;

View File

@ -206,7 +206,7 @@ qse_awk_fnc_t* qse_awk_getfnc (
for (fnc = sys_fnc; fnc->name.ptr != QSE_NULL; fnc++)
{
if (fnc->valid != 0 &&
(awk->option & fnc->valid) != fnc->valid) continue;
(awk->opt.trait & fnc->valid) != fnc->valid) continue;
if (qse_strxncmp (
fnc->name.ptr, fnc->name.len,
@ -217,7 +217,7 @@ qse_awk_fnc_t* qse_awk_getfnc (
if (pair == QSE_NULL) return QSE_NULL;
fnc = (qse_awk_fnc_t*)QSE_HTB_VPTR(pair);
if (fnc->valid != 0 && (awk->option & fnc->valid) == 0) return QSE_NULL;
if (fnc->valid != 0 && (awk->opt.trait & fnc->valid) == 0) return QSE_NULL;
return fnc;
}

View File

@ -68,7 +68,7 @@ qse_long_t qse_awk_strxtolong (
p = str;
end = str + len;
if (awk->option & QSE_AWK_STRIPSTRSPC)
if (awk->opt.trait & QSE_AWK_STRIPSTRSPC)
{
/* strip off leading spaces */
while (p < end && QSE_AWK_ISSPACE(awk,*p)) p++;
@ -195,7 +195,7 @@ qse_flt_t qse_awk_strtoreal (qse_awk_t* awk, const qse_char_t* str)
p = str;
if (awk->option & QSE_AWK_STRIPSTRSPC)
if (awk->opt.trait & QSE_AWK_STRIPSTRSPC)
{
/* strip off leading spaces */
while (QSE_AWK_ISSPACE(awk,*p)) p++;
@ -891,7 +891,7 @@ qse_char_t* qse_awk_rtx_strxntokbyrex (
cursub.ptr++;
cursub.len--;
}
else if (rtx->awk->option & QSE_AWK_STRIPRECSPC)
else if (rtx->awk->opt.trait & QSE_AWK_STRIPRECSPC)
{
/* match at the beginning of the input string */
if (match.ptr == substr)
@ -941,7 +941,7 @@ exit_loop:
/* the match is all spaces */
*errnum = QSE_AWK_ENOERR;
if (rtx->awk->option & QSE_AWK_STRIPRECSPC)
if (rtx->awk->opt.trait & QSE_AWK_STRIPRECSPC)
{
/* if the match reached the last character in the input string,
* it returns QSE_NULL to terminate tokenization. */
@ -1070,8 +1070,8 @@ void* qse_awk_buildrex (
void* p;
p = qse_buildrex (
awk->mmgr, awk->rex.depth.max.build,
((awk->option&QSE_AWK_REXBOUND)? 0: QSE_REX_NOBOUND),
awk->mmgr, awk->opt.depth.s.rex_build,
((awk->opt.trait&QSE_AWK_REXBOUND)? 0: QSE_REX_NOBOUND),
ptn, len, &err
);
if (p == QSE_NULL) *errnum = QSE_AWK_REXERRTOERR(err);
@ -1087,7 +1087,7 @@ int qse_awk_matchrex (
qse_rex_errnum_t err;
x = qse_matchrex (
awk->mmgr, awk->rex.depth.max.match,
awk->mmgr, awk->opt.depth.s.rex_match,
code, option, str, substr, match, &err);
if (x <= -1) *errnum = QSE_AWK_REXERRTOERR(err);
return x;

View File

@ -370,7 +370,7 @@ static global_t gtab[] =
(MATCH((awk),TOK_SEMICOLON) || MATCH((awk),TOK_NEWLINE))
#define MATCH_TERMINATOR_RBRACE(awk) \
((awk->option & QSE_AWK_NEWLINE) && MATCH((awk),TOK_RBRACE))
((awk->opt.trait & QSE_AWK_NEWLINE) && MATCH((awk),TOK_RBRACE))
#define MATCH_TERMINATOR(awk) \
(MATCH_TERMINATOR_NORMAL(awk) || MATCH_TERMINATOR_RBRACE(awk))
@ -545,8 +545,8 @@ static int parse (qse_awk_t* awk)
if (parse_progunit(awk) == QSE_NULL) goto oops;
}
if ((awk->option & QSE_AWK_EXPLICIT) &&
!(awk->option & QSE_AWK_IMPLICIT))
if ((awk->opt.trait & QSE_AWK_EXPLICIT) &&
!(awk->opt.trait & QSE_AWK_IMPLICIT))
{
/* ensure that all functions called are defined
* in the EXPLICIT-only mode */
@ -652,8 +652,8 @@ int qse_awk_parse (qse_awk_t* awk, qse_awk_sio_t* sio)
return -1;
}
QSE_ASSERT (awk->parse.depth.cur.loop == 0);
QSE_ASSERT (awk->parse.depth.cur.expr == 0);
QSE_ASSERT (awk->parse.depth.loop == 0);
QSE_ASSERT (awk->parse.depth.expr == 0);
qse_awk_clear (awk);
qse_htb_clear (awk->sio.names);
@ -663,8 +663,8 @@ int qse_awk_parse (qse_awk_t* awk, qse_awk_sio_t* sio)
n = parse (awk);
if (n == 0 && awk->sio.outf != QSE_NULL) n = deparse (awk);
QSE_ASSERT (awk->parse.depth.cur.loop == 0);
QSE_ASSERT (awk->parse.depth.cur.expr == 0);
QSE_ASSERT (awk->parse.depth.loop == 0);
QSE_ASSERT (awk->parse.depth.expr == 0);
return n;
}
@ -738,7 +738,7 @@ static int begin_include (qse_awk_t* awk)
arg->next = awk->sio.inp;
awk->sio.inp = arg;
awk->parse.depth.cur.incl++;
awk->parse.depth.incl++;
awk->sio.inp->line = 1;
awk->sio.inp->colm = 1;
@ -776,7 +776,7 @@ static int end_include (qse_awk_t* awk)
QSE_ASSERT (cur->name != QSE_NULL);
QSE_MMGR_FREE (awk->mmgr, cur);
awk->parse.depth.cur.incl--;
awk->parse.depth.incl--;
if (x != 0)
{
@ -800,10 +800,10 @@ static qse_awk_t* parse_progunit (qse_awk_t* awk)
function name (parameter-list) { statement }
*/
QSE_ASSERT (awk->parse.depth.cur.loop == 0);
QSE_ASSERT (awk->parse.depth.loop == 0);
retry:
if ((awk->option & QSE_AWK_EXPLICIT) && MATCH(awk,TOK_GLOBAL))
if ((awk->opt.trait & QSE_AWK_EXPLICIT) && MATCH(awk,TOK_GLOBAL))
{
qse_size_t ngbls;
@ -828,11 +828,10 @@ retry:
if (MATCH(awk,TOK_INCLUDE))
{
if (awk->parse.depth.max.incl > 0 &&
awk->parse.depth.cur.incl >= awk->parse.depth.max.incl)
if (awk->opt.depth.s.incl > 0 &&
awk->parse.depth.incl >= awk->opt.depth.s.incl)
{
SETERR_LOC (
awk, QSE_AWK_EINCLTD, &awk->ptok.loc);
SETERR_LOC (awk, QSE_AWK_EINCLTD, &awk->ptok.loc);
return QSE_NULL;
}
@ -870,7 +869,7 @@ retry:
}
else if (MATCH(awk,TOK_BEGIN))
{
if ((awk->option & QSE_AWK_PABLOCK) == 0)
if ((awk->opt.trait & QSE_AWK_PABLOCK) == 0)
{
SETERR_TOK (awk, QSE_AWK_EKWFNC);
return QSE_NULL;
@ -898,7 +897,7 @@ retry:
}
else if (MATCH(awk,TOK_END))
{
if ((awk->option & QSE_AWK_PABLOCK) == 0)
if ((awk->opt.trait & QSE_AWK_PABLOCK) == 0)
{
SETERR_TOK (awk, QSE_AWK_EKWFNC);
return QSE_NULL;
@ -927,7 +926,7 @@ retry:
else if (MATCH(awk,TOK_LBRACE))
{
/* patternless block */
if ((awk->option & QSE_AWK_PABLOCK) == 0)
if ((awk->opt.trait & QSE_AWK_PABLOCK) == 0)
{
SETERR_TOK (awk, QSE_AWK_EKWFNC);
return QSE_NULL;
@ -955,7 +954,7 @@ retry:
qse_awk_nde_t* ptn;
qse_awk_loc_t eloc;
if ((awk->option & QSE_AWK_PABLOCK) == 0)
if ((awk->opt.trait & QSE_AWK_PABLOCK) == 0)
{
SETERR_TOK (awk, QSE_AWK_EKWFNC);
return QSE_NULL;
@ -1012,7 +1011,7 @@ retry:
}
}
if ((awk->option & QSE_AWK_RIO) != QSE_AWK_RIO)
if ((awk->opt.trait & QSE_AWK_RIO) != QSE_AWK_RIO)
{
/* blockless pattern requires QSE_AWK_RIO
* to be ON because the implicit block is
@ -1158,7 +1157,7 @@ static qse_awk_nde_t* parse_function (qse_awk_t* awk)
/* check if a parameter conflicts with the function
* name or other parameters */
if (((awk->option & QSE_AWK_STRICTNAMING) &&
if (((awk->opt.trait & QSE_AWK_STRICTNAMING) &&
qse_strxncmp (pa, pal, name.ptr, name.len) == 0) ||
qse_lda_search (awk->parse.params, 0, pa, pal) != QSE_LDA_NIL)
{
@ -1428,7 +1427,7 @@ static qse_awk_nde_t* parse_block (
nlcls_max = awk->parse.nlcls_max;
/* local variable declarations */
if (awk->option & QSE_AWK_EXPLICIT)
if (awk->opt.trait & QSE_AWK_EXPLICIT)
{
while (1)
{
@ -1579,16 +1578,16 @@ static qse_awk_nde_t* parse_block_dc (
{
qse_awk_nde_t* nde;
if (awk->parse.depth.max.block > 0 &&
awk->parse.depth.cur.block >= awk->parse.depth.max.block)
if (awk->opt.depth.s.block_parse > 0 &&
awk->parse.depth.block >= awk->opt.depth.s.block_parse)
{
SETERR_LOC (awk, QSE_AWK_EBLKNST, xloc);
return QSE_NULL;
}
awk->parse.depth.cur.block++;
awk->parse.depth.block++;
nde = parse_block (awk, xloc, istop);
awk->parse.depth.cur.block--;
awk->parse.depth.block--;
return nde;
}
@ -1636,7 +1635,7 @@ static void adjust_static_globals (qse_awk_t* awk)
for (id = QSE_AWK_MIN_GBL_ID; id <= QSE_AWK_MAX_GBL_ID; id++)
{
if (gtab[id].valid != 0 &&
(awk->option & gtab[id].valid) != gtab[id].valid)
(awk->opt.trait & gtab[id].valid) != gtab[id].valid)
{
QSE_LDA_DLEN(awk->parse.gbls,id) = 0;
}
@ -1951,7 +1950,7 @@ static qse_awk_t* collect_locals (
}
}
if (awk->option & QSE_AWK_STRICTNAMING)
if (awk->opt.trait & QSE_AWK_STRICTNAMING)
{
/* check if it conflicts with the owning function */
if (awk->tree.cur_fun.ptr != QSE_NULL)
@ -2425,7 +2424,7 @@ static qse_awk_nde_t* parse_break (qse_awk_t* awk, const qse_awk_loc_t* xloc)
qse_awk_nde_break_t* nde;
QSE_ASSERT (awk->ptok.type == TOK_BREAK);
if (awk->parse.depth.cur.loop <= 0)
if (awk->parse.depth.loop <= 0)
{
SETERR_LOC (awk, QSE_AWK_EBREAK, xloc);
return QSE_NULL;
@ -2451,7 +2450,7 @@ static qse_awk_nde_t* parse_continue (qse_awk_t* awk, const qse_awk_loc_t* xloc)
qse_awk_nde_continue_t* nde;
QSE_ASSERT (awk->ptok.type == TOK_CONTINUE);
if (awk->parse.depth.cur.loop <= 0)
if (awk->parse.depth.loop <= 0)
{
SETERR_LOC (awk, QSE_AWK_ECONTINUE, xloc);
return QSE_NULL;
@ -2788,7 +2787,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->option&tab[i].opt)) break;
!(awk->opt.trait&tab[i].opt)) break;
tmp = args_tail;
@ -2811,7 +2810,7 @@ static qse_awk_nde_t* parse_print (qse_awk_t* awk, const qse_awk_loc_t* xloc)
out_type = MATCH(awk,TOK_GT)? QSE_AWK_OUT_FILE:
MATCH(awk,TOK_RS)? QSE_AWK_OUT_APFILE:
MATCH(awk,TOK_BOR)? QSE_AWK_OUT_PIPE:
((awk->option & QSE_AWK_RWPIPE) &&
((awk->opt.trait & QSE_AWK_RWPIPE) &&
MATCH(awk,TOK_LOR))? QSE_AWK_OUT_RWPIPE:
QSE_AWK_OUT_CONSOLE;
@ -2870,9 +2869,9 @@ static qse_awk_nde_t* parse_statement_nb (
{
if (get_token(awk) <= -1) return QSE_NULL;
awk->parse.depth.cur.loop++;
awk->parse.depth.loop++;
nde = parse_while (awk, xloc);
awk->parse.depth.cur.loop--;
awk->parse.depth.loop--;
return nde;
}
@ -2880,9 +2879,9 @@ static qse_awk_nde_t* parse_statement_nb (
{
if (get_token(awk) <= -1) return QSE_NULL;
awk->parse.depth.cur.loop++;
awk->parse.depth.loop++;
nde = parse_for (awk, xloc);
awk->parse.depth.cur.loop--;
awk->parse.depth.loop--;
return nde;
}
@ -2892,9 +2891,9 @@ static qse_awk_nde_t* parse_statement_nb (
{
if (get_token(awk) <= -1) return QSE_NULL;
awk->parse.depth.cur.loop++;
awk->parse.depth.loop++;
nde = parse_dowhile (awk, xloc);
awk->parse.depth.cur.loop--;
awk->parse.depth.loop--;
return nde;
}
@ -2938,7 +2937,7 @@ static qse_awk_nde_t* parse_statement_nb (
if (get_token(awk) <= -1) return QSE_NULL;
nde = parse_delete (awk, xloc);
}
else if (!(awk->option & QSE_AWK_TOLERANT))
else if (!(awk->opt.trait & QSE_AWK_TOLERANT))
{
/* in the non-tolerant mode, we treat print and printf
* as a separate statement */
@ -3214,16 +3213,16 @@ static qse_awk_nde_t* parse_expr_dc (
{
qse_awk_nde_t* nde;
if (awk->parse.depth.max.expr > 0 &&
awk->parse.depth.cur.expr >= awk->parse.depth.max.expr)
if (awk->opt.depth.s.expr_parse > 0 &&
awk->parse.depth.expr >= awk->opt.depth.s.expr_parse)
{
SETERR_LOC (awk, QSE_AWK_EEXPRNST, xloc);
return QSE_NULL;
}
awk->parse.depth.cur.expr++;
awk->parse.depth.expr++;
nde = parse_expr (awk, xloc);
awk->parse.depth.cur.expr--;
awk->parse.depth.expr--;
return nde;
}
@ -3781,7 +3780,7 @@ static qse_awk_nde_t* parse_relational (
};
return parse_binary (awk, xloc, 0, map,
((awk->option & QSE_AWK_EXTRAOPS)? parse_shift: parse_concat));
((awk->opt.trait & QSE_AWK_EXTRAOPS)? parse_shift: parse_concat));
}
static qse_awk_nde_t* parse_shift (
@ -3822,12 +3821,12 @@ static qse_awk_nde_t* parse_concat (
MATCH(awk,TOK_PLUSPLUS) ||
MATCH(awk,TOK_MINUSMINUS) ||
MATCH(awk,TOK_LNOT) ||
((awk->option & QSE_AWK_TOLERANT) &&
((awk->opt.trait & QSE_AWK_TOLERANT) &&
(awk->tok.type == TOK_PRINT || awk->tok.type == TOK_PRINTF)) ||
awk->tok.type >= TOK_GETLINE)
{
/* TODO: is the check above sufficient? */
if (!(awk->option & QSE_AWK_IMPLICIT)) break;
if (!(awk->opt.trait & QSE_AWK_IMPLICIT)) break;
}
else break;
@ -3892,14 +3891,14 @@ static qse_awk_nde_t* parse_unary (
opcode = (MATCH(awk,TOK_PLUS))? QSE_AWK_UNROP_PLUS:
(MATCH(awk,TOK_MINUS))? QSE_AWK_UNROP_MINUS:
(MATCH(awk,TOK_LNOT))? QSE_AWK_UNROP_LNOT:
((awk->option & QSE_AWK_EXTRAOPS) && MATCH(awk,TOK_TILDE))?
((awk->opt.trait & QSE_AWK_EXTRAOPS) && MATCH(awk,TOK_TILDE))?
QSE_AWK_UNROP_BNOT: -1;
/*if (opcode <= -1) return parse_increment (awk);*/
if (opcode <= -1) return parse_exponent (awk, xloc);
if (awk->parse.depth.max.expr > 0 &&
awk->parse.depth.cur.expr >= awk->parse.depth.max.expr)
if (awk->opt.depth.s.expr_parse > 0 &&
awk->parse.depth.expr >= awk->opt.depth.s.expr_parse)
{
SETERR_LOC (awk, QSE_AWK_EEXPRNST, xloc);
return QSE_NULL;
@ -3907,10 +3906,10 @@ static qse_awk_nde_t* parse_unary (
if (get_token(awk) <= -1) return QSE_NULL;
awk->parse.depth.cur.expr++;
awk->parse.depth.expr++;
uloc = awk->tok.loc;
left = parse_unary (awk, &uloc);
awk->parse.depth.cur.expr--;
awk->parse.depth.expr--;
if (left == QSE_NULL) return QSE_NULL;
fold = -1;
@ -4044,13 +4043,13 @@ static qse_awk_nde_t* parse_unary_exp (
opcode = (MATCH(awk,TOK_PLUS))? QSE_AWK_UNROP_PLUS:
(MATCH(awk,TOK_MINUS))? QSE_AWK_UNROP_MINUS:
(MATCH(awk,TOK_LNOT))? QSE_AWK_UNROP_LNOT:
((awk->option & QSE_AWK_EXTRAOPS) && MATCH(awk,TOK_TILDE))?
((awk->opt.trait & QSE_AWK_EXTRAOPS) && MATCH(awk,TOK_TILDE))?
QSE_AWK_UNROP_BNOT: -1;
if (opcode <= -1) return parse_increment (awk, xloc);
if (awk->parse.depth.max.expr > 0 &&
awk->parse.depth.cur.expr >= awk->parse.depth.max.expr)
if (awk->opt.depth.s.expr_parse > 0 &&
awk->parse.depth.expr >= awk->opt.depth.s.expr_parse)
{
SETERR_LOC (awk, QSE_AWK_EEXPRNST, xloc);
return QSE_NULL;
@ -4058,10 +4057,10 @@ static qse_awk_nde_t* parse_unary_exp (
if (get_token(awk) <= -1) return QSE_NULL;
awk->parse.depth.cur.expr++;
awk->parse.depth.expr++;
uloc = awk->tok.loc;
left = parse_unary (awk, &uloc);
awk->parse.depth.cur.expr--;
awk->parse.depth.expr--;
if (left == QSE_NULL) return QSE_NULL;
nde = (qse_awk_nde_exp_t*)
@ -4109,7 +4108,7 @@ static qse_awk_nde_t* parse_increment (
opcode2 = MATCH(awk,TOK_PLUSPLUS)? QSE_AWK_INCOP_PLUS:
MATCH(awk,TOK_MINUSMINUS)? QSE_AWK_INCOP_MINUS: -1;
if ((awk->option & QSE_AWK_EXPLICIT) && !(awk->option & QSE_AWK_IMPLICIT))
if ((awk->opt.trait & QSE_AWK_EXPLICIT) && !(awk->opt.trait & QSE_AWK_IMPLICIT))
{
if (opcode1 != -1 && opcode2 != -1)
{
@ -4487,9 +4486,9 @@ static qse_awk_nde_t* parse_primary_nogetline (
if ((awk->parse.id.stmt != TOK_PRINT &&
awk->parse.id.stmt != TOK_PRINTF) ||
awk->parse.depth.cur.expr != 1)
awk->parse.depth.expr != 1)
{
if (!(awk->option & QSE_AWK_TOLERANT) &&
if (!(awk->opt.trait & QSE_AWK_TOLERANT) &&
!MATCH(awk,TOK_IN))
{
qse_awk_clrpt (awk, nde);
@ -4576,7 +4575,7 @@ static qse_awk_nde_t* parse_primary_nogetline (
return (qse_awk_nde_t*)nde;
}
else if (awk->option & QSE_AWK_TOLERANT)
else if (awk->opt.trait & QSE_AWK_TOLERANT)
{
/* in the tolerant mode, we treat print and printf
* as a function like getline */
@ -4618,7 +4617,7 @@ static qse_awk_nde_t* parse_primary (
{
int intype = -1;
if (awk->option & QSE_AWK_RIO)
if (awk->opt.trait & QSE_AWK_RIO)
{
if (MATCH(awk,TOK_BOR))
{
@ -4626,7 +4625,7 @@ static qse_awk_nde_t* parse_primary (
}
else if (MATCH(awk,TOK_LOR))
{
if (awk->option & QSE_AWK_RWPIPE)
if (awk->opt.trait & QSE_AWK_RWPIPE)
intype = QSE_AWK_IN_RWPIPE;
}
}
@ -4742,8 +4741,8 @@ static qse_awk_nde_t* parse_variable (
{
qse_awk_nde_var_t* nde;
if ((awk->option & QSE_AWK_EXPLICIT) &&
!(awk->option & QSE_AWK_IMPLICIT))
if ((awk->opt.trait & QSE_AWK_EXPLICIT) &&
!(awk->opt.trait & QSE_AWK_IMPLICIT))
{
/* if explicit only, the concatenation operator(.)
* must be used. so it is obvious that it is a function
@ -4908,7 +4907,7 @@ static qse_awk_nde_t* parse_primary_ident_noseg (
);
}
}
else if (awk->option & QSE_AWK_IMPLICIT)
else if (awk->opt.trait & QSE_AWK_IMPLICIT)
{
/* if the name is followed by ( without no spaces
* in the implicit mode, the name is considered a function
@ -5202,7 +5201,7 @@ static qse_awk_nde_t* parse_hashidx (
return (qse_awk_nde_t*)nde;
}
if (awk->option & QSE_AWK_IMPLICIT)
if (awk->opt.trait & QSE_AWK_IMPLICIT)
{
int fnname = isfnname (awk, name, namelen);
switch (fnname)
@ -5663,7 +5662,7 @@ static int skip_spaces (qse_awk_t* awk)
{
qse_cint_t c = awk->sio.last.c;
if (awk->option & QSE_AWK_NEWLINE)
if (awk->opt.trait & QSE_AWK_NEWLINE)
{
do
{
@ -5724,7 +5723,7 @@ static int skip_comment (qse_awk_t* awk)
do { GET_CHAR_TO (awk, c); }
while (c != QSE_T('\n') && c != QSE_CHAR_EOF);
if (!(awk->option & QSE_AWK_NEWLINE)) GET_CHAR (awk);
if (!(awk->opt.trait & QSE_AWK_NEWLINE)) GET_CHAR (awk);
return 1; /* comment by # */
}
@ -5863,7 +5862,7 @@ static int get_symbols (qse_awk_t* awk, qse_cint_t c, qse_awk_tok_t* tok)
for (p = ops; p->str != QSE_NULL; )
{
if (p->opt == 0 || (awk->option & p->opt))
if (p->opt == 0 || (awk->opt.trait & p->opt))
{
if (p->str[idx] == QSE_T('\0'))
{
@ -6105,7 +6104,7 @@ static int classify_ident (
else
{
if (kwp->valid != 0 &&
(awk->option & kwp->valid) != kwp->valid)
(awk->opt.trait & kwp->valid) != kwp->valid)
break;
return kwp->type;
@ -6187,8 +6186,8 @@ static int deparse (qse_awk_t* awk)
for (i = awk->tree.ngbls_base; i < awk->tree.ngbls - 1; i++)
{
if ((awk->option & QSE_AWK_EXPLICIT) &&
!(awk->option & QSE_AWK_IMPLICIT))
if ((awk->opt.trait & QSE_AWK_EXPLICIT) &&
!(awk->opt.trait & QSE_AWK_IMPLICIT))
{
/* use the actual name if no named variable
* is allowed */
@ -6215,8 +6214,8 @@ static int deparse (qse_awk_t* awk)
EXIT_DEPARSE ();
}
if ((awk->option & QSE_AWK_EXPLICIT) &&
!(awk->option & QSE_AWK_IMPLICIT))
if ((awk->opt.trait & QSE_AWK_EXPLICIT) &&
!(awk->opt.trait & QSE_AWK_IMPLICIT))
{
if (qse_awk_putsrcstrn (awk,
QSE_LDA_DPTR(awk->parse.gbls,i),
@ -6237,7 +6236,7 @@ static int deparse (qse_awk_t* awk)
}
}
if (awk->option & QSE_AWK_CRLF)
if (awk->opt.trait & QSE_AWK_CRLF)
{
if (qse_awk_putsrcstr (awk, QSE_T(";\r\n\r\n")) <= -1)
{
@ -6274,7 +6273,7 @@ static int deparse (qse_awk_t* awk)
if (qse_awk_putsrcstr (awk, QSE_T(" ")) <= -1) EXIT_DEPARSE ();
if (qse_awk_prnnde (awk, nde) <= -1) EXIT_DEPARSE ();
if (awk->option & QSE_AWK_CRLF)
if (awk->opt.trait & QSE_AWK_CRLF)
{
if (put_char (awk, QSE_T('\r')) <= -1) EXIT_DEPARSE ();
}
@ -6294,7 +6293,7 @@ static int deparse (qse_awk_t* awk)
if (chain->action == QSE_NULL)
{
/* blockless pattern */
if (awk->option & QSE_AWK_CRLF)
if (awk->opt.trait & QSE_AWK_CRLF)
{
if (put_char (awk, QSE_T('\r')) <= -1)
EXIT_DEPARSE ();
@ -6314,7 +6313,7 @@ static int deparse (qse_awk_t* awk)
EXIT_DEPARSE ();
}
if (awk->option & QSE_AWK_CRLF)
if (awk->opt.trait & QSE_AWK_CRLF)
{
if (put_char (awk, QSE_T('\r')) <= -1)
EXIT_DEPARSE ();
@ -6337,7 +6336,7 @@ static int deparse (qse_awk_t* awk)
if (qse_awk_prnnde (awk, nde) <= -1) EXIT_DEPARSE ();
/*
if (awk->option & QSE_AWK_CRLF)
if (awk->opt.trait & QSE_AWK_CRLF)
{
if (put_char (awk, QSE_T('\r')) <= -1) EXIT_DEPARSE ();
}
@ -6409,12 +6408,12 @@ static qse_htb_walk_t deparse_func (
}
PUT_S (df, QSE_T(")"));
if (df->awk->option & QSE_AWK_CRLF) PUT_C (df, QSE_T('\r'));
if (df->awk->opt.trait & QSE_AWK_CRLF) PUT_C (df, QSE_T('\r'));
PUT_C (df, QSE_T('\n'));
if (qse_awk_prnpt (df->awk, fun->body) <= -1) return -1;
if (df->awk->option & QSE_AWK_CRLF)
if (df->awk->opt.trait & QSE_AWK_CRLF)
{
PUT_C (df, QSE_T('\r'));
}

View File

@ -382,7 +382,7 @@ int qse_awk_rtx_readio (
if (QSE_STR_LASTCHAR(buf) == QSE_T('\n'))
{
QSE_STR_LEN(buf) -= 1;
if (run->awk->option & QSE_AWK_CRLF)
if (run->awk->opt.trait & QSE_AWK_CRLF)
{
/* drop preceding CR */
if (QSE_STR_LEN(buf) > 0 &&
@ -494,7 +494,7 @@ int qse_awk_rtx_readio (
/* we don't drop CR from the record buffer
* if we're in CRLF mode. POINT-X */
if (!(run->awk->option & QSE_AWK_CRLF))
if (!(run->awk->opt.trait & QSE_AWK_CRLF))
QSE_STR_LEN(buf) -= 1;
}
@ -502,7 +502,7 @@ int qse_awk_rtx_readio (
{
/* we got a blank line */
if (run->awk->option & QSE_AWK_CRLF)
if (run->awk->opt.trait & QSE_AWK_CRLF)
{
if (QSE_STR_LEN(buf) > 0 &&
QSE_STR_LASTCHAR(buf) == QSE_T('\r'))

View File

@ -656,7 +656,7 @@ int qse_awk_rtx_setofilename (
qse_awk_val_t* tmp;
int n;
if (rtx->awk->option & QSE_AWK_NEXTOFILE)
if (rtx->awk->opt.trait & QSE_AWK_NEXTOFILE)
{
if (len == 0) tmp = qse_awk_val_zls;
else
@ -895,11 +895,6 @@ static int init_rtx (qse_awk_rtx_t* rtx, qse_awk_t* awk, qse_awk_rio_t* rio)
rtx->gbl.fs = QSE_NULL;
rtx->gbl.ignorecase = 0;
rtx->depth.max.block = awk->run.depth.max.block;
rtx->depth.max.expr = awk->run.depth.max.expr;
rtx->depth.cur.block = 0;
rtx->depth.cur.expr = 0;
return 0;
oops_7:
@ -1154,7 +1149,7 @@ static int defaultify_globals (qse_awk_rtx_t* rtx)
qse_awk_val_t* tmp;
qse_size_t i, j;
if (rtx->awk->option & QSE_AWK_CRLF)
if (rtx->awk->opt.trait & QSE_AWK_CRLF)
{
/* ugly */
gtab[5].str = DEFAULT_ORS_CRLF;
@ -1310,7 +1305,7 @@ static qse_awk_val_t* run_bpae_loop (qse_awk_rtx_t* rtx)
if (ret <= -1 && rtx->errinf.num == QSE_AWK_ENOERR)
{
/* an error is returned with no error number set.
* this feature is used by eval_expression() to
* this trait is used by eval_expression() to
* abort the evaluation when exit() is executed
* during function evaluation */
ret = 0;
@ -1329,7 +1324,7 @@ static qse_awk_val_t* run_bpae_loop (qse_awk_rtx_t* rtx)
if (ret <= -1 && rtx->errinf.num == QSE_AWK_ENOERR)
{
/* an error is returned with no error number set.
* this feature is used by eval_expression() to
* this trait is used by eval_expression() to
* abort the evaluation when exit() is executed
* during function evaluation */
ret = 0;
@ -1361,7 +1356,7 @@ static qse_awk_val_t* run_bpae_loop (qse_awk_rtx_t* rtx)
if (ret <= -1 && rtx->errinf.num == QSE_AWK_ENOERR)
{
/* an error is returned with no error number set.
* this feature is used by eval_expression() to
* this trait is used by eval_expression() to
* abort the evaluation when exit() is executed
* during function evaluation */
ret = 0;
@ -1715,16 +1710,16 @@ static int run_block (qse_awk_rtx_t* rtx, qse_awk_nde_blk_t* nde)
{
int n;
if (rtx->depth.max.block > 0 &&
rtx->depth.cur.block >= rtx->depth.max.block)
if (rtx->awk->opt.depth.s.block_run > 0 &&
rtx->depth.block >= rtx->awk->opt.depth.s.block_run)
{
SETERR_LOC (rtx, QSE_AWK_EBLKNST, &nde->loc);
return -1;;
}
rtx->depth.cur.block++;
rtx->depth.block++;
n = run_block0 (rtx, nde);
rtx->depth.cur.block--;
rtx->depth.block--;
return n;
}
@ -1897,12 +1892,12 @@ static int run_statement (qse_awk_rtx_t* rtx, qse_awk_nde_t* nde)
break;
case QSE_AWK_NDE_PRINT:
if (rtx->awk->option & QSE_AWK_TOLERANT) goto __fallback__;
if (rtx->awk->opt.trait & QSE_AWK_TOLERANT) goto __fallback__;
xret = run_print (rtx, (qse_awk_nde_print_t*)nde);
break;
case QSE_AWK_NDE_PRINTF:
if (rtx->awk->option & QSE_AWK_TOLERANT) goto __fallback__;
if (rtx->awk->opt.trait & QSE_AWK_TOLERANT) goto __fallback__;
xret = run_printf (rtx, (qse_awk_nde_print_t*)nde);
break;
@ -2245,7 +2240,7 @@ static int run_return (qse_awk_rtx_t* run, qse_awk_nde_return_t* nde)
val = eval_expression (run, nde->val);
if (val == QSE_NULL) return -1;
if ((run->awk->option & QSE_AWK_MAPTOVAR) == 0)
if ((run->awk->opt.trait & QSE_AWK_MAPTOVAR) == 0)
{
if (val->type == QSE_AWK_VAL_MAP)
{
@ -2627,14 +2622,16 @@ static int run_delete (qse_awk_rtx_t* rtx, qse_awk_nde_delete_t* nde)
case QSE_AWK_NDE_LCLIDX:
case QSE_AWK_NDE_ARGIDX:
return run_delete_nonnamed (rtx, var);
default:
QSE_ASSERTX (
!"should never happen - wrong target for delete",
"the delete statement cannot be called with other nodes than the variables such as a named variable, a named indexed variable, etc");
SETERR_LOC (rtx, QSE_AWK_EBADARG, &var->loc);
return -1;
}
QSE_ASSERTX (
!"should never happen - wrong target for delete",
"the delete statement cannot be called with other nodes than the variables such as a named variable, a named indexed variable, etc");
SETERR_LOC (rtx, QSE_AWK_EBADARG, &var->loc);
return -1;
}
static int run_reset (qse_awk_rtx_t* rtx, qse_awk_nde_reset_t* nde)
@ -2771,7 +2768,7 @@ static int run_print (qse_awk_rtx_t* rtx, qse_awk_nde_print_t* nde)
QSE_STR_LEN(&rtx->inrec.line));
if (n <= -1 /*&& rtx->errinf.num != QSE_AWK_EIOIMPL*/)
{
if (rtx->awk->option & QSE_AWK_TOLERANT)
if (rtx->awk->opt.trait & QSE_AWK_TOLERANT)
{
xret = PRINT_IOERR;
}
@ -2807,7 +2804,7 @@ static int run_print (qse_awk_rtx_t* rtx, qse_awk_nde_print_t* nde)
rtx->gbl.ofs.len);
if (n <= -1 /*&& rtx->errinf.num != QSE_AWK_EIOIMPL*/)
{
if (rtx->awk->option & QSE_AWK_TOLERANT)
if (rtx->awk->opt.trait & QSE_AWK_TOLERANT)
{
xret = PRINT_IOERR;
}
@ -2832,7 +2829,7 @@ static int run_print (qse_awk_rtx_t* rtx, qse_awk_nde_print_t* nde)
rtx, nde->out_type, dst, v);
if (n <= -1 /*&& rtx->errinf.num != QSE_AWK_EIOIMPL*/)
{
if (rtx->awk->option & QSE_AWK_TOLERANT)
if (rtx->awk->opt.trait & QSE_AWK_TOLERANT)
{
xret = PRINT_IOERR;
}
@ -2855,7 +2852,7 @@ static int run_print (qse_awk_rtx_t* rtx, qse_awk_nde_print_t* nde)
rtx->gbl.ors.ptr, rtx->gbl.ors.len);
if (n <= -1 /*&& rtx->errinf.num != QSE_AWK_EIOIMPL*/)
{
if (rtx->awk->option & QSE_AWK_TOLERANT)
if (rtx->awk->opt.trait & QSE_AWK_TOLERANT)
{
xret = PRINT_IOERR;
}
@ -2971,7 +2968,7 @@ static int run_printf (qse_awk_rtx_t* rtx, qse_awk_nde_print_t* nde)
n = qse_awk_rtx_writeio_val (rtx, nde->out_type, dst, v);
if (n <= -1 /*&& rtx->errinf.num != QSE_AWK_EIOIMPL*/)
{
if (rtx->awk->option & QSE_AWK_TOLERANT)
if (rtx->awk->opt.trait & QSE_AWK_TOLERANT)
{
xret = PRINT_IOERR;
}
@ -3010,7 +3007,7 @@ static int run_printf (qse_awk_rtx_t* rtx, qse_awk_nde_print_t* nde)
/*skip_write:*/
if (qse_awk_rtx_flushio (rtx, nde->out_type, dst) <= -1)
{
if (rtx->awk->option & QSE_AWK_TOLERANT)
if (rtx->awk->opt.trait & QSE_AWK_TOLERANT)
{
xret = PRINT_IOERR;
}
@ -3040,7 +3037,7 @@ static int output_formatted (
n = qse_awk_rtx_writeio_str (rtx, out_type, dst, ptr, len);
if (n <= -1 /*&& rtx->errinf.num != QSE_AWK_EIOIMPL*/)
{
if (rtx->awk->option & QSE_AWK_TOLERANT)
if (rtx->awk->opt.trait & QSE_AWK_TOLERANT)
{
return PRINT_IOERR;
}
@ -3314,7 +3311,7 @@ static qse_awk_val_t* do_assignment (
var->type == QSE_AWK_NDE_LCL ||
var->type == QSE_AWK_NDE_ARG)
{
if ((run->awk->option & QSE_AWK_MAPTOVAR) == 0)
if ((run->awk->opt.trait & QSE_AWK_MAPTOVAR) == 0)
{
if (val->type == QSE_AWK_VAL_MAP)
{
@ -3375,7 +3372,7 @@ static qse_awk_val_t* do_assignment_scalar (
QSE_ASSERT (var->idx == QSE_NULL);
QSE_ASSERT (
(run->awk->option & QSE_AWK_MAPTOVAR) ||
(run->awk->opt.trait & QSE_AWK_MAPTOVAR) ||
val->type != QSE_AWK_VAL_MAP);
switch (var->type)
@ -4008,7 +4005,7 @@ static int __cmp_int_str (
int n;
/* SCO CC doesn't seem to handle right->nstr > 0 properly */
if (rtx->awk->option & QSE_AWK_NCMPONSTR || right->nstr /*> 0*/)
if (rtx->awk->opt.trait & QSE_AWK_NCMPONSTR || right->nstr /*> 0*/)
{
qse_long_t ll;
qse_flt_t rr;
@ -4094,7 +4091,7 @@ static int __cmp_flt_str (
int n;
/* SCO CC doesn't seem to handle right->nstr > 0 properly */
if (rtx->awk->option & QSE_AWK_NCMPONSTR || right->nstr /*> 0*/)
if (rtx->awk->opt.trait & QSE_AWK_NCMPONSTR || right->nstr /*> 0*/)
{
const qse_char_t* end;
qse_flt_t rr;

View File

@ -112,7 +112,13 @@ typedef struct xtn_t
int gbl_environ;
int gbl_procinfo;
struct
{
qse_xstr_t moddir;
} opt;
qse_rbt_t modtab;
qse_awk_ecb_t ecb;
} xtn_t;
@ -152,6 +158,12 @@ typedef struct ioattr_t
int tmout[4];
} ioattr_t;
typedef struct mod_data_t
{
lt_dlhandle dh;
qse_awk_mod_query_t query;
} mod_data_t;
static ioattr_t* get_ioattr (qse_htb_t* tab, const qse_char_t* ptr, qse_size_t len);
static qse_flt_t custom_awk_pow (qse_awk_t* awk, qse_flt_t x, qse_flt_t y)
@ -335,6 +347,10 @@ static void fini_xtn (qse_awk_t* awk)
{
xtn_t* xtn;
xtn = (xtn_t*) QSE_XTN (awk);
if (xtn->opt.moddir.ptr)
QSE_MMGR_FREE (awk->mmgr, xtn->opt.moddir.ptr);
qse_rbt_fini (&xtn->modtab);
}
@ -383,11 +399,15 @@ qse_awk_t* qse_awk_openstdwithmmgr (qse_mmgr_t* mmgr, qse_size_t xtnsize)
/* TODO: change the way to set this... */
awk->mod = &awk_mod;
if (qse_rbt_init (&xtn->modtab, mmgr, QSE_SIZEOF(qse_char_t), 0) <= -1)
if (qse_rbt_init (&xtn->modtab, mmgr, QSE_SIZEOF(qse_char_t), 1) <= -1)
{
qse_awk_close (awk);
return QSE_NULL;
}
qse_rbt_setmancbs (
&xtn->modtab,
qse_getrbtmancbs(QSE_RBT_MANCBS_INLINE_COPIERS)
);
xtn->ecb.close = fini_xtn;
xtn->ecb.clear = clear_xtn;
@ -401,6 +421,65 @@ void* qse_awk_getxtnstd (qse_awk_t* awk)
return (void*)((xtn_t*)QSE_XTN(awk) + 1);
}
int qse_awk_getoptstd (qse_awk_t* awk, qse_awk_optstd_t id, void* value)
{
xtn_t* xtn;
xtn = (xtn_t*) QSE_XTN (awk);
switch (id)
{
case QSE_AWK_MODDIR:
{
*(const qse_char_t**)value = xtn->opt.moddir.ptr;
return 0;
}
}
qse_awk_seterrnum (awk, QSE_AWK_EINVAL, QSE_NULL);
return -1;
}
int qse_awk_setoptstd (qse_awk_t* awk, qse_awk_optstd_t id, const void* value)
{
xtn_t* xtn;
xtn = (xtn_t*) QSE_XTN (awk);
switch (id)
{
case QSE_AWK_MODDIR:
{
qse_xstr_t tmp;
if (value)
{
tmp.ptr = qse_strdup (value, awk->mmgr);
if (tmp.ptr == QSE_NULL)
{
qse_awk_seterrnum (awk, QSE_AWK_ENOMEM, QSE_NULL);
return -1;
}
tmp.len = qse_strlen (tmp.ptr);
}
else
{
tmp.ptr = QSE_NULL;
tmp.len = 0;
}
if (xtn->opt.moddir.ptr)
QSE_MMGR_FREE (awk->mmgr, xtn->opt.moddir.ptr);
xtn->opt.moddir = tmp;
return 0;
}
}
qse_awk_seterrnum (awk, QSE_AWK_EINVAL, QSE_NULL);
return -1;
}
static qse_sio_t* open_sio (qse_awk_t* awk, const qse_char_t* file, int flags)
{
qse_sio_t* sio;
@ -1940,7 +2019,7 @@ qse_awk_rtx_t* qse_awk_rtx_openstd (
rxtn = (rxtn_t*) QSE_XTN (rtx);
if (rtx->awk->option & QSE_AWK_RIO)
if (rtx->awk->opt.trait & QSE_AWK_RIO)
{
if (qse_htb_init (
&rxtn->cmgrtab, awk->mmgr, 256, 70,
@ -2476,9 +2555,11 @@ static int query_module (
qse_awk_t* awk, const qse_char_t* name, qse_awk_mod_info_t* info)
{
const qse_char_t* dc;
qse_awk_mod_query_t query;
xtn_t* xtn;
qse_rbt_pair_t* pair;
qse_size_t namelen;
mod_data_t md;
qse_cstr_t ea;
xtn = (xtn_t*)QSE_XTN(awk);
@ -2486,6 +2567,8 @@ static int query_module (
dc = qse_strstr (name, QSE_T("::"));
QSE_ASSERT (dc != QSE_NULL);
namelen = dc - name;
#if defined(_WIN32)
/*TODO: implemente this */
qse_awk_seterrnum (awk, QSE_AWK_ENOIMPL, QSE_NULL);
@ -2499,20 +2582,56 @@ static int query_module (
return -1;
#else
pair = qse_rbt_search (&xtn->modtab, name, dc - name);
pair = qse_rbt_search (&xtn->modtab, name, namelen);
if (pair)
{
/*query = QSE_RBT_VPTR(pair)->query;*/
md = *(mod_data_t*)QSE_RBT_VPTR(pair);
}
else
{
void* dh;
const qse_mchar_t* mod;
qse_mchar_t* mod;
#if defined(QSE_CHAR_IS_MCHAR)
qse_mcstr_t tmp[5] =
{
{ QSE_WT(""), 0 },
{ QSE_WT("/"), 0 },
{ QSE_MT("lib"), 3 },
{ QSE_NULL, 0 },
{ QSE_NULL, 0 }
};
#else
qse_wcstr_t tmp[5] =
{
{ QSE_WT(""), 0 },
{ QSE_WT("/"), 0 },
{ QSE_WT("lib"), 3 },
{ QSE_NULL, 0 },
{ QSE_NULL, 0 }
};
#endif
if (xtn->opt.moddir.len > 0)
{
tmp[0].ptr = xtn->opt.moddir.ptr;
tmp[0].len = xtn->opt.moddir.len;
tmp[1].len = 1;
}
#if defined(DEFAULT_MODDIR)
else
{
tmp[0].ptr = QSE_T(DEFAULT_MODDIR);
tmp[0].len = qse_strlen(tmp[0].ptr);
tmp[1].len = 1;
}
#endif
tmp[3].ptr = name;
tmp[3].len = namelen;
#if defined(QSE_CHAR_IS_MCHAR)
mod = qse_mbsxdup (name, dc - name, QSE_NULL, awk->mmgr);
mod = qse_mbsxadup (tmp, QSE_NULL, awk->mmgr);
#else
mod = qse_wcsntombsdup (name, dc - name, QSE_NULL, awk->mmgr);
mod = qse_wcsnatombsdup (tmp, QSE_NULL, awk->mmgr);
#endif
if (!mod)
{
@ -2520,25 +2639,41 @@ static int query_module (
return -1;
}
dh = lt_dlopen (mod);
md.dh = lt_dlopenext (mod);
QSE_MMGR_FREE (awk->mmgr, mod);
if (!dh)
if (!md.dh)
{
ea.ptr = name;
ea.len = namelen;
qse_awk_seterror (awk, QSE_AWK_ENOENT, &ea, QSE_NULL);
return -1;
}
query = lt_dlsym (dh, QSE_MT("query"));
if (!query)
md.query = lt_dlsym (md.dh, QSE_MT("query"));
if (!md.query)
{
lt_dlclose (dh);
lt_dlclose (md.dh);
ea.ptr = QSE_MT("query");
ea.len = 5;
qse_awk_seterror (awk, QSE_AWK_ENOENT, &ea, QSE_NULL);
return -1;
}
/*
md.init = lt_dlsym (md.dh, QSE_MT("init"));
md.fini = lt_dlsym (md.dh, QSE_MT("fini"));
*/
if (qse_rbt_insert (&xtn->modtab, (void*)name, namelen, &md, QSE_SIZEOF(md)) == QSE_NULL)
{
qse_awk_seterrnum (awk, QSE_AWK_ENOMEM, QSE_NULL);
lt_dlclose (md.dh);
return -1;
}
}
return query (awk, dc + 2, info);
return md.query (awk, dc + 2, info);
#endif
}
static int init_module (qse_awk_t* awk, qse_awk_rtx_t* rtx)

View File

@ -109,7 +109,7 @@ static const qse_char_t* print_outop_str[] =
)
#define PUT_NL(awk) QSE_BLOCK (\
if (awk->option & QSE_AWK_CRLF) PUT_SRCSTR (awk, QSE_T("\r")); \
if (awk->opt.trait & QSE_AWK_CRLF) PUT_SRCSTR (awk, QSE_T("\r")); \
PUT_SRCSTR (awk, QSE_T("\n")); \
)
@ -226,7 +226,7 @@ static int print_expr (qse_awk_t* awk, qse_awk_nde_t* nde)
QSE_ASSERT (px->left->next == QSE_NULL);
PUT_SRCSTR (awk, QSE_T(" "));
PUT_SRCSTR (awk, binop_str[px->opcode][(awk->option & QSE_AWK_IMPLICIT)? 0: 1]);
PUT_SRCSTR (awk, binop_str[px->opcode][(awk->opt.trait & QSE_AWK_IMPLICIT)? 0: 1]);
PUT_SRCSTR (awk, QSE_T(" "));
if (px->right->type == QSE_AWK_NDE_ASS)
@ -478,8 +478,8 @@ static int print_expr (qse_awk_t* awk, qse_awk_nde_t* nde)
if (px->id.idxa != (qse_size_t)-1)
{
if ((awk->option & QSE_AWK_EXPLICIT) &&
!(awk->option & QSE_AWK_IMPLICIT))
if ((awk->opt.trait & QSE_AWK_EXPLICIT) &&
!(awk->opt.trait & QSE_AWK_IMPLICIT))
{
/* no implicit(named) variable is allowed.
* use the actual name */
@ -520,8 +520,8 @@ static int print_expr (qse_awk_t* awk, qse_awk_nde_t* nde)
if (px->id.idxa != (qse_size_t)-1)
{
if ((awk->option & QSE_AWK_EXPLICIT) &&
!(awk->option & QSE_AWK_IMPLICIT))
if ((awk->opt.trait & QSE_AWK_EXPLICIT) &&
!(awk->opt.trait & QSE_AWK_IMPLICIT))
{
/* no implicit(named) variable is allowed.
* use the actual name */

View File

@ -2230,7 +2230,7 @@ nomem_after_attach:
int qse_httpd_getserveroptstd (
qse_httpd_t* httpd, qse_httpd_server_t* server,
qse_httpd_server_optstd_t id, void** value)
qse_httpd_server_optstd_t id, void* value)
{
server_xtn_t* server_xtn;
@ -2243,14 +2243,14 @@ int qse_httpd_getserveroptstd (
case QSE_HTTPD_SERVER_AUTH:
case QSE_HTTPD_SERVER_ERRCSS:
case QSE_HTTPD_SERVER_DIRCSS:
*value = (void*)server_xtn->cfg[id - QSE_HTTPD_SERVER_DOCROOT];
*(qse_mchar_t**)value = server_xtn->cfg[id - QSE_HTTPD_SERVER_DOCROOT];
return 0;
case QSE_HTTPD_SERVER_CBSTD:
case QSE_HTTPD_SERVER_CGISTD:
case QSE_HTTPD_SERVER_MIMESTD:
case QSE_HTTPD_SERVER_IDXSTD:
*value = (void*)server_xtn->cfg2.a[id - QSE_HTTPD_SERVER_CBSTD];
*(qse_mchar_t**)value = (void*)server_xtn->cfg2.a[id - QSE_HTTPD_SERVER_CBSTD];
return 0;
}
@ -2260,7 +2260,7 @@ int qse_httpd_getserveroptstd (
int qse_httpd_setserveroptstd (
qse_httpd_t* httpd, qse_httpd_server_t* server,
qse_httpd_server_optstd_t id, void* value)
qse_httpd_server_optstd_t id, const void* value)
{
server_xtn_t* server_xtn;
qse_mchar_t* mctmp;

2
qse/mod/Makefile.am Normal file
View File

@ -0,0 +1,2 @@
SUBDIRS = awk
DIST_SUBDIRS = $(SUBDIRS)

601
qse/mod/Makefile.in Normal file
View File

@ -0,0 +1,601 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = mod
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/qse/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_MODE = @BUILD_MODE@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHAR_MODE = @CHAR_MODE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_CXX = @HAVE_CXX@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MPICC = @MPICC@
MPI_CFLAGS = @MPI_CFLAGS@
MPI_CLDFLAGS = @MPI_CLDFLAGS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@
PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@
PACKAGE_VERSION_PATCH = @PACKAGE_VERSION_PATCH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
QSE_PROJECT_AUTHOR = @QSE_PROJECT_AUTHOR@
QSE_PROJECT_URL = @QSE_PROJECT_URL@
QSE_SIZEOF_CHAR = @QSE_SIZEOF_CHAR@
QSE_SIZEOF_DOUBLE = @QSE_SIZEOF_DOUBLE@
QSE_SIZEOF_FLOAT = @QSE_SIZEOF_FLOAT@
QSE_SIZEOF_INT = @QSE_SIZEOF_INT@
QSE_SIZEOF_LONG = @QSE_SIZEOF_LONG@
QSE_SIZEOF_LONG_DOUBLE = @QSE_SIZEOF_LONG_DOUBLE@
QSE_SIZEOF_LONG_LONG = @QSE_SIZEOF_LONG_LONG@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
RANLIB = @RANLIB@
RM = @RM@
RMDIR = @RMDIR@
SED = @SED@
SENDFILE_LIBS = @SENDFILE_LIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOCKET_LIBS = @SOCKET_LIBS@
SSL_LIBS = @SSL_LIBS@
STRIP = @STRIP@
TRUE = @TRUE@
UNICOWS_LIBS = @UNICOWS_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = awk
DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mod/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign mod/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-generic clean-libtool \
ctags ctags-recursive distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

13
qse/mod/awk/Makefile.am Normal file
View File

@ -0,0 +1,13 @@
AUTOMAKE_OPTIONS = nostdinc
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(includedir)
moddir = $(libdir)/qseawk
mod_LTLIBRARIES = libsys.la
libsys_la_SOURCES = sys.c
libsys_la_LDFLAGS = -L$(abs_builddir)/../../lib/cmn -L$(abs_builddir)/../../lib/awk -L$(libdir) -version-info 1:0:0 -no-undefined
libsys_la_LIBADD = -lqseawk -lqsecmn

580
qse/mod/awk/Makefile.in Normal file
View File

@ -0,0 +1,580 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = mod/awk
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/qse/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(moddir)"
LTLIBRARIES = $(mod_LTLIBRARIES)
libsys_la_DEPENDENCIES =
am_libsys_la_OBJECTS = sys.lo
libsys_la_OBJECTS = $(am_libsys_la_OBJECTS)
libsys_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libsys_la_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES =
depcomp = $(SHELL) $(top_srcdir)/ac/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libsys_la_SOURCES)
DIST_SOURCES = $(libsys_la_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_MODE = @BUILD_MODE@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHAR_MODE = @CHAR_MODE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_CXX = @HAVE_CXX@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MPICC = @MPICC@
MPI_CFLAGS = @MPI_CFLAGS@
MPI_CLDFLAGS = @MPI_CLDFLAGS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@
PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@
PACKAGE_VERSION_PATCH = @PACKAGE_VERSION_PATCH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
QSE_PROJECT_AUTHOR = @QSE_PROJECT_AUTHOR@
QSE_PROJECT_URL = @QSE_PROJECT_URL@
QSE_SIZEOF_CHAR = @QSE_SIZEOF_CHAR@
QSE_SIZEOF_DOUBLE = @QSE_SIZEOF_DOUBLE@
QSE_SIZEOF_FLOAT = @QSE_SIZEOF_FLOAT@
QSE_SIZEOF_INT = @QSE_SIZEOF_INT@
QSE_SIZEOF_LONG = @QSE_SIZEOF_LONG@
QSE_SIZEOF_LONG_DOUBLE = @QSE_SIZEOF_LONG_DOUBLE@
QSE_SIZEOF_LONG_LONG = @QSE_SIZEOF_LONG_LONG@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
RANLIB = @RANLIB@
RM = @RM@
RMDIR = @RMDIR@
SED = @SED@
SENDFILE_LIBS = @SENDFILE_LIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOCKET_LIBS = @SOCKET_LIBS@
SSL_LIBS = @SSL_LIBS@
STRIP = @STRIP@
TRUE = @TRUE@
UNICOWS_LIBS = @UNICOWS_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = nostdinc
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(includedir)
moddir = $(libdir)/qseawk
mod_LTLIBRARIES = libsys.la
libsys_la_SOURCES = sys.c
libsys_la_LDFLAGS = -L$(abs_builddir)/../../lib/cmn -L$(abs_builddir)/../../lib/awk -L$(libdir) -version-info 1:0:0 -no-undefined
libsys_la_LIBADD = -lqseawk -lqsecmn
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mod/awk/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign mod/awk/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-modLTLIBRARIES: $(mod_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(moddir)" || $(MKDIR_P) "$(DESTDIR)$(moddir)"
@list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moddir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moddir)"; \
}
uninstall-modLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(mod_LTLIBRARIES)'; test -n "$(moddir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moddir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moddir)/$$f"; \
done
clean-modLTLIBRARIES:
-test -z "$(mod_LTLIBRARIES)" || rm -f $(mod_LTLIBRARIES)
@list='$(mod_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libsys.la: $(libsys_la_OBJECTS) $(libsys_la_DEPENDENCIES) $(EXTRA_libsys_la_DEPENDENCIES)
$(libsys_la_LINK) -rpath $(moddir) $(libsys_la_OBJECTS) $(libsys_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sys.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
for dir in "$(DESTDIR)$(moddir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool clean-modLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-modLTLIBRARIES
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-modLTLIBRARIES
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-modLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-modLTLIBRARIES install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-modLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

71
qse/mod/awk/sys.c Normal file
View File

@ -0,0 +1,71 @@
#include <qse/awk/awk.h>
#include <qse/cmn/str.h>
#if defined(_WIN32)
# include <windows.h>
# include <process.h>
#elif defined(__OS2__)
# define INCL_DOSPROCESS
# define INCL_DOSEXCEPTIONS
# define INCL_ERRORS
# include <os2.h>
#elif defined(__DOS__)
# include <dos.h>
#else
# include <unistd.h>
# include <errno.h>
#endif
static int fnc_sleep (qse_awk_rtx_t* run, const qse_cstr_t* fnm)
{
qse_size_t nargs;
qse_awk_val_t* a0;
qse_long_t lv;
qse_flt_t rv;
qse_awk_val_t* r;
int n;
nargs = qse_awk_rtx_getnargs (run);
QSE_ASSERT (nargs == 1);
a0 = qse_awk_rtx_getarg (run, 0);
n = qse_awk_rtx_valtonum (run, a0, &lv, &rv);
if (n == -1) return -1;
if (n == 1) lv = (qse_long_t)rv;
#if defined(_WIN32)
Sleep ((DWORD)(lv * 1000));
n = 0;
#elif defined(__OS2__)
DosSleep ((ULONG)(lv * 1000));
n = 0;
#else
n = sleep (lv);
#endif
r = qse_awk_rtx_makeintval (run, n);
if (r == QSE_NULL) return -1;
qse_awk_rtx_setretval (run, r);
return 0;
}
int query (qse_awk_t* awk, const qse_char_t* name, qse_awk_mod_info_t* info)
{
qse_cstr_t ea;
if (qse_strcmp (name, QSE_T("sleep")) == 0)
{
info->type = QSE_AWK_MOD_FNC;
info->u.f.arg.min = 1;
info->u.f.arg.max = 1;
info->u.f.impl = fnc_sleep;
return 0;
}
ea.ptr = name;
ea.len = qse_strlen(name);
qse_awk_seterror (awk, QSE_AWK_ENOENT, &ea, QSE_NULL);
return -1;
}

View File

@ -45,7 +45,7 @@ int main ()
qse_awk_parsestd_t psin;
int ret, i;
int ret, i, opt;
/* create a main processor */
awk = qse_awk_openstd (0);
@ -55,8 +55,10 @@ int main ()
ret = -1; goto oops;
}
qse_awk_getopt (awk, QSE_AWK_TRAIT, &opt);
/* don't allow BEGIN, END, pattern-action blocks */
qse_awk_setoption (awk, qse_awk_getoption(awk) & ~QSE_AWK_PABLOCK);
opt &= ~QSE_AWK_PABLOCK;
qse_awk_setopt (awk, QSE_AWK_TRAIT, &opt);
psin.type = QSE_AWK_PARSESTD_STR;
psin.u.str.ptr = src;

View File

@ -49,14 +49,13 @@ int main ()
ret = -1; goto oops;
}
opt = qse_awk_getoption(awk);
qse_awk_getopt (awk, QSE_AWK_TRAIT, &opt);
/* don't allow BEGIN, END, pattern-action blocks */
opt &= ~QSE_AWK_PABLOCK;
/* enable ** */
opt |= QSE_AWK_EXTRAOPS;
qse_awk_setopt (awk, QSE_AWK_TRAIT, &opt);
qse_awk_setoption (awk, opt);
psin.type = QSE_AWK_PARSESTD_STR;
psin.u.str.ptr = src;

View File

@ -136,8 +136,8 @@ static int awk_main (int argc, qse_char_t* argv[])
int ret = awk.open();
// allow returning a map from a function and enable 'reset'
awk.setOption (
awk.getOption() |
awk.setTrait (
awk.getTrait() |
QSE_AWK_MAPTOVAR |
QSE_AWK_RESET);

View File

@ -356,7 +356,7 @@ static int awk_main_2 (MyAwk& awk, int argc, qse_char_t* argv[])
cmdline_t cmdline;
int n;
awk.setOption (awk.getOption() | QSE_AWK_INCLUDE |
awk.setTrait (awk.getTrait() | QSE_AWK_INCLUDE |
QSE_AWK_MAPTOVAR | QSE_AWK_RWPIPE | QSE_AWK_EXTRAOPS);
// ARGV[0]

View File

@ -41,7 +41,7 @@ int main ()
qse_awk_rtx_t* rtx = QSE_NULL;
qse_awk_val_t* retv;
qse_awk_parsestd_t psin;
int ret = -1;
int ret = -1, opt;
const qse_char_t* output_files[] =
{
@ -63,7 +63,9 @@ int main ()
goto oops;
}
qse_awk_setoption (awk, qse_awk_getoption(awk) | QSE_AWK_NEXTOFILE);
qse_awk_getopt (awk, QSE_AWK_TRAIT, &opt);
opt |= QSE_AWK_NEXTOFILE;
qse_awk_setopt (awk, QSE_AWK_TRAIT, &opt);
psin.type = QSE_AWK_PARSESTD_STR;
psin.u.str.ptr = src;

View File

@ -54,16 +54,14 @@ int main ()
ret = -1; goto oops;
}
opt = qse_awk_getoption(awk);
qse_awk_getopt (awk, QSE_AWK_TRAIT, &opt);
/* don't allow BEGIN, END, pattern-action blocks */
opt &= ~QSE_AWK_PABLOCK;
/* can assign a map to a variable */
opt |= QSE_AWK_MAPTOVAR;
/* enable ** */
opt |= QSE_AWK_EXTRAOPS;
qse_awk_setoption (awk, opt);
qse_awk_setopt (awk, QSE_AWK_TRAIT, &opt);
psin.type = QSE_AWK_PARSESTD_STR;
psin.u.str.ptr = src;

View File

@ -79,8 +79,6 @@ int main ()
goto oops;
}
//qse_awk_setoption (awk, qse_awk_getoption(awk) | QSE_AWK_RWPIPE);
psin.type = QSE_AWK_PARSESTD_STR;
psin.u.str.ptr = src;
psin.u.str.len = qse_strlen(src);