prefixed many functions and classes with QSE_EXPORT
This commit is contained in:
parent
b062a1fd30
commit
acdd3a7a1c
@ -1140,7 +1140,9 @@ typedef struct mpi_t mpi_t;
|
||||
|
||||
static void open_mpi (mpi_t* mpi, int argc, qse_achar_t* argv[])
|
||||
{
|
||||
#if defined(USE_LTDL)
|
||||
lt_dladvise adv;
|
||||
#endif
|
||||
|
||||
qse_memset (mpi, 0, QSE_SIZEOF(*mpi));
|
||||
|
||||
|
56
qse/configure
vendored
56
qse/configure
vendored
@ -16942,6 +16942,62 @@ eval "LTDLOPEN=\"$libname_spec\""
|
||||
|
||||
|
||||
|
||||
if test "x$with_included_ltdl" != "xyes"; then
|
||||
save_CFLAGS="$CFLAGS"
|
||||
save_LDFLAGS="$LDFLAGS"
|
||||
CFLAGS="$CFLAGS $LTDLINCL"
|
||||
LDFLAGS="$LDFLAGS $LIBLTDL"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lt_dladvise_init in -lltdl" >&5
|
||||
$as_echo_n "checking for lt_dladvise_init in -lltdl... " >&6; }
|
||||
if ${ac_cv_lib_ltdl_lt_dladvise_init+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lltdl $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* 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 lt_dladvise_init ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return lt_dladvise_init ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_lib_ltdl_lt_dladvise_init=yes
|
||||
else
|
||||
ac_cv_lib_ltdl_lt_dladvise_init=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ltdl_lt_dladvise_init" >&5
|
||||
$as_echo "$ac_cv_lib_ltdl_lt_dladvise_init" >&6; }
|
||||
if test "x$ac_cv_lib_ltdl_lt_dladvise_init" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_LIBLTDL 1
|
||||
_ACEOF
|
||||
|
||||
LIBS="-lltdl $LIBS"
|
||||
|
||||
else
|
||||
as_fn_error $? "installed libltdl is too old" "$LINENO" 5
|
||||
fi
|
||||
|
||||
LDFLAGS="$save_LDFLAGS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
fi
|
||||
|
||||
if test "$ac_test_CFLAGS" != "set"
|
||||
then
|
||||
if test "$GCC" = "yes"
|
||||
|
@ -48,6 +48,18 @@ dnl so i use the classic 'subproject' type here
|
||||
LT_CONFIG_LTDL_DIR([libltdl])
|
||||
LTDL_INIT
|
||||
|
||||
dnl The lt_dladvise_init symbol was added with libtool-2.2
|
||||
if test "x$with_included_ltdl" != "xyes"; then
|
||||
save_CFLAGS="$CFLAGS"
|
||||
save_LDFLAGS="$LDFLAGS"
|
||||
CFLAGS="$CFLAGS $LTDLINCL"
|
||||
LDFLAGS="$LDFLAGS $LIBLTDL"
|
||||
AC_CHECK_LIB([ltdl], [lt_dladvise_init], [],
|
||||
[AC_MSG_ERROR([installed libltdl is too old])])
|
||||
LDFLAGS="$save_LDFLAGS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
fi
|
||||
|
||||
dnl overrides the default CFLAGS setting
|
||||
if test "$ac_test_CFLAGS" != "set"
|
||||
then
|
||||
|
@ -39,7 +39,7 @@ QSE_BEGIN_NAMESPACE(QSE)
|
||||
/// The Awk class implements an AWK interpreter by wrapping around
|
||||
/// #qse_awk_t and #qse_awk_rtx_t.
|
||||
///
|
||||
class Awk: public Mmged
|
||||
class QSE_EXPORT Awk: public Mmged
|
||||
{
|
||||
public:
|
||||
typedef qse_htb_t htb_t;
|
||||
@ -171,7 +171,7 @@ public:
|
||||
/// source script I/O. The Awk::parse function requires a concrete
|
||||
/// object instantiated from its child class.
|
||||
///
|
||||
class Source
|
||||
class QSE_EXPORT Source
|
||||
{
|
||||
public:
|
||||
///
|
||||
@ -187,7 +187,7 @@ public:
|
||||
/// The Data class encapsulates information passed in and out
|
||||
/// for source script I/O.
|
||||
///
|
||||
class Data
|
||||
class QSE_EXPORT Data
|
||||
{
|
||||
public:
|
||||
friend class Awk;
|
||||
@ -254,7 +254,7 @@ public:
|
||||
};
|
||||
|
||||
protected:
|
||||
class NoSource: public Source
|
||||
class QSE_EXPORT NoSource: public Source
|
||||
{
|
||||
public:
|
||||
int open (Data& io) { return -1; }
|
||||
@ -269,7 +269,7 @@ public:
|
||||
/// operations. The Console, File, Pipe classes implement more specific
|
||||
/// I/O operations by inheriting this class.
|
||||
///
|
||||
class RIOBase
|
||||
class QSE_EXPORT RIOBase
|
||||
{
|
||||
protected:
|
||||
RIOBase (Run* run, rio_arg_t* riod);
|
||||
@ -302,7 +302,7 @@ public:
|
||||
/// The Pipe class encapsulates the pipe operations indicated by
|
||||
/// the | and || operators.
|
||||
///
|
||||
class Pipe: public RIOBase
|
||||
class QSE_EXPORT Pipe: public RIOBase
|
||||
{
|
||||
public:
|
||||
friend class Awk;
|
||||
@ -330,7 +330,7 @@ public:
|
||||
CLOSE_WRITE = QSE_AWK_RIO_CLOSE_WRITE
|
||||
};
|
||||
|
||||
class Handler
|
||||
class QSE_EXPORT Handler
|
||||
{
|
||||
public:
|
||||
virtual int open (Pipe& io) = 0;
|
||||
@ -360,7 +360,7 @@ public:
|
||||
///
|
||||
/// The File class encapsulates file operations by inheriting RIOBase.
|
||||
///
|
||||
class File: public RIOBase
|
||||
class QSE_EXPORT File: public RIOBase
|
||||
{
|
||||
public:
|
||||
friend class Awk;
|
||||
@ -372,7 +372,7 @@ public:
|
||||
APPEND = QSE_AWK_RIO_FILE_APPEND
|
||||
};
|
||||
|
||||
class Handler
|
||||
class QSE_EXPORT Handler
|
||||
{
|
||||
public:
|
||||
virtual int open (File& io) = 0;
|
||||
@ -393,7 +393,7 @@ public:
|
||||
/// The Console class encapsulates the console operations by
|
||||
/// inheriting RIOBase.
|
||||
///
|
||||
class Console: public RIOBase
|
||||
class QSE_EXPORT Console: public RIOBase
|
||||
{
|
||||
public:
|
||||
friend class Awk;
|
||||
@ -404,7 +404,7 @@ public:
|
||||
WRITE = QSE_AWK_RIO_CONSOLE_WRITE
|
||||
};
|
||||
|
||||
class Handler
|
||||
class QSE_EXPORT Handler
|
||||
{
|
||||
public:
|
||||
virtual int open (Console& io) = 0;
|
||||
@ -433,7 +433,7 @@ public:
|
||||
/// The Value class wraps around #qse_awk_val_t to provide a more
|
||||
/// comprehensive interface.
|
||||
///
|
||||
class Value
|
||||
class QSE_EXPORT Value
|
||||
{
|
||||
public:
|
||||
friend class Awk;
|
||||
@ -455,7 +455,7 @@ public:
|
||||
///
|
||||
/// The Index class encapsulates an index of an arrayed value.
|
||||
///
|
||||
class Index: protected qse_cstr_t
|
||||
class QSE_EXPORT Index: protected qse_cstr_t
|
||||
{
|
||||
public:
|
||||
friend class Value;
|
||||
@ -512,7 +512,7 @@ public:
|
||||
///
|
||||
/// Represents a numeric index of an arrayed value
|
||||
///
|
||||
class IntIndex: public Index
|
||||
class QSE_EXPORT IntIndex: public Index
|
||||
{
|
||||
public:
|
||||
IntIndex (long_t num);
|
||||
@ -540,7 +540,7 @@ public:
|
||||
/// The IndexIterator class is a helper class to make simple
|
||||
/// iteration over array elements.
|
||||
///
|
||||
class IndexIterator: public qse_awk_val_map_itr_t
|
||||
class QSE_EXPORT IndexIterator: public qse_awk_val_map_itr_t
|
||||
{
|
||||
public:
|
||||
friend class Value;
|
||||
@ -769,7 +769,7 @@ public:
|
||||
/// The Run class wraps around #qse_awk_rtx_t to represent the
|
||||
/// runtime context.
|
||||
///
|
||||
class Run
|
||||
class QSE_EXPORT Run
|
||||
{
|
||||
protected:
|
||||
friend class Awk;
|
||||
|
@ -63,13 +63,13 @@ QSE_BEGIN_NAMESPACE(QSE)
|
||||
/// primitive methods, and implementing the file handler, the pipe handler,
|
||||
/// and common intrinsic functions.
|
||||
///
|
||||
class StdAwk: public Awk
|
||||
class QSE_EXPORT StdAwk: public Awk
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// The SourceFile class implements script I/O from and to a file.
|
||||
///
|
||||
class SourceFile: public Source
|
||||
class QSE_EXPORT SourceFile: public Source
|
||||
{
|
||||
public:
|
||||
SourceFile (const char_t* name, qse_cmgr_t* cmgr = QSE_NULL):
|
||||
@ -93,7 +93,7 @@ public:
|
||||
/// The SourceString class implements script input from a string.
|
||||
/// Deparsing is not supported.
|
||||
///
|
||||
class SourceString: public Source
|
||||
class QSE_EXPORT SourceString: public Source
|
||||
{
|
||||
public:
|
||||
SourceString (const char_t* str): str (str) {}
|
||||
|
@ -212,8 +212,7 @@ typedef struct qse_awk_val_str_t qse_awk_val_str_t;
|
||||
struct qse_awk_val_rex_t
|
||||
{
|
||||
QSE_AWK_VAL_HDR;
|
||||
qse_char_t* ptr;
|
||||
qse_size_t len;
|
||||
qse_xstr_t str;
|
||||
void* code;
|
||||
};
|
||||
typedef struct qse_awk_val_rex_t qse_awk_val_rex_t;
|
||||
@ -1335,22 +1334,20 @@ typedef struct qse_awk_nrflt_t qse_awk_nrflt_t;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
QSE_DEFINE_COMMON_FUNCTIONS (awk)
|
||||
|
||||
/** represents a nil value */
|
||||
extern qse_awk_val_t* qse_awk_val_nil;
|
||||
QSE_EXPORT extern qse_awk_val_t* qse_awk_val_nil;
|
||||
|
||||
/** represents an empty string */
|
||||
extern qse_awk_val_t* qse_awk_val_zls;
|
||||
QSE_EXPORT extern qse_awk_val_t* qse_awk_val_zls;
|
||||
|
||||
/** represents a numeric value -1 */
|
||||
extern qse_awk_val_t* qse_awk_val_negone;
|
||||
QSE_EXPORT extern qse_awk_val_t* qse_awk_val_negone;
|
||||
|
||||
/** represents a numeric value 0 */
|
||||
extern qse_awk_val_t* qse_awk_val_zero;
|
||||
QSE_EXPORT extern qse_awk_val_t* qse_awk_val_zero;
|
||||
|
||||
/** represents a numeric value 1 */
|
||||
extern qse_awk_val_t* qse_awk_val_one;
|
||||
QSE_EXPORT extern qse_awk_val_t* qse_awk_val_one;
|
||||
|
||||
/**
|
||||
* The qse_awk_open() function creates a new qse_awk_t object. The object
|
||||
@ -1376,7 +1373,7 @@ extern qse_awk_val_t* qse_awk_val_one;
|
||||
*
|
||||
* @return a pointer to a qse_awk_t object on success, #QSE_NULL on failure.
|
||||
*/
|
||||
qse_awk_t* qse_awk_open (
|
||||
QSE_EXPORT qse_awk_t* qse_awk_open (
|
||||
qse_mmgr_t* mmgr, /**< memory manager */
|
||||
qse_size_t xtnsize, /**< extension size in bytes */
|
||||
qse_awk_prm_t* prm /**< pointer to a primitive function structure */
|
||||
@ -1386,14 +1383,27 @@ qse_awk_t* qse_awk_open (
|
||||
* The qse_awk_close() function destroys a qse_awk_t object.
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int qse_awk_close (
|
||||
QSE_EXPORT int qse_awk_close (
|
||||
qse_awk_t* awk /**< awk */
|
||||
);
|
||||
|
||||
QSE_EXPORT void qse_awk_setmmgr (
|
||||
qse_awk_t* awk,
|
||||
qse_mmgr_t* mmgr
|
||||
);
|
||||
|
||||
QSE_EXPORT qse_mmgr_t* qse_awk_getmmgr (
|
||||
qse_awk_t* awk
|
||||
);
|
||||
|
||||
QSE_EXPORT void* qse_awk_getxtn (
|
||||
qse_awk_t* awk
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_awk_getprm() function gets primitive functions
|
||||
*/
|
||||
qse_awk_prm_t* qse_awk_getprm (
|
||||
QSE_EXPORT qse_awk_prm_t* qse_awk_getprm (
|
||||
qse_awk_t* awk
|
||||
);
|
||||
|
||||
@ -1405,14 +1415,14 @@ qse_awk_prm_t* qse_awk_getprm (
|
||||
*
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int qse_awk_clear (
|
||||
QSE_EXPORT int qse_awk_clear (
|
||||
qse_awk_t* awk
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_awk_geterrstr() gets an error string getter.
|
||||
*/
|
||||
qse_awk_errstr_t qse_awk_geterrstr (
|
||||
QSE_EXPORT qse_awk_errstr_t qse_awk_geterrstr (
|
||||
const qse_awk_t* awk /**< awk */
|
||||
);
|
||||
|
||||
@ -1440,7 +1450,7 @@ qse_awk_errstr_t qse_awk_geterrstr (
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
void qse_awk_seterrstr (
|
||||
QSE_EXPORT void qse_awk_seterrstr (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
qse_awk_errstr_t errstr /**< error string getter */
|
||||
);
|
||||
@ -1450,7 +1460,7 @@ void qse_awk_seterrstr (
|
||||
* occurred.
|
||||
* @return error number
|
||||
*/
|
||||
qse_awk_errnum_t qse_awk_geterrnum (
|
||||
QSE_EXPORT qse_awk_errnum_t qse_awk_geterrnum (
|
||||
const qse_awk_t* awk /**< awk */
|
||||
);
|
||||
|
||||
@ -1458,7 +1468,7 @@ qse_awk_errnum_t qse_awk_geterrnum (
|
||||
* The qse_awk_geterrloc() function returns the location where the
|
||||
* last error has occurred.
|
||||
*/
|
||||
const qse_awk_loc_t* qse_awk_geterrloc (
|
||||
QSE_EXPORT const qse_awk_loc_t* qse_awk_geterrloc (
|
||||
const qse_awk_t* awk /**< awk */
|
||||
);
|
||||
|
||||
@ -1468,7 +1478,7 @@ const qse_awk_loc_t* qse_awk_geterrloc (
|
||||
* #QSE_NULL if the error occurred in the main script.
|
||||
* @return error message
|
||||
*/
|
||||
const qse_char_t* qse_awk_geterrmsg (
|
||||
QSE_EXPORT const qse_char_t* qse_awk_geterrmsg (
|
||||
const qse_awk_t* awk /**< awk */
|
||||
);
|
||||
|
||||
@ -1476,7 +1486,7 @@ const qse_char_t* qse_awk_geterrmsg (
|
||||
* The qse_awk_geterrinf() function copies error information into memory
|
||||
* pointed to by @a errinf from @a awk.
|
||||
*/
|
||||
void qse_awk_geterrinf (
|
||||
QSE_EXPORT void qse_awk_geterrinf (
|
||||
const qse_awk_t* awk, /**< awk */
|
||||
qse_awk_errinf_t* errinf /**< error information buffer */
|
||||
);
|
||||
@ -1487,7 +1497,7 @@ void qse_awk_geterrinf (
|
||||
* error number @a errnum requires one or more arguments to format an
|
||||
* error message.
|
||||
*/
|
||||
void qse_awk_seterrnum (
|
||||
QSE_EXPORT void qse_awk_seterrnum (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
qse_awk_errnum_t errnum, /**< error number */
|
||||
const qse_cstr_t* errarg /**< argument array for formatting
|
||||
@ -1499,7 +1509,7 @@ void qse_awk_seterrnum (
|
||||
* may be useful if you want to set a custom error message rather than letting
|
||||
* it automatically formatted.
|
||||
*/
|
||||
void qse_awk_seterrinf (
|
||||
QSE_EXPORT void qse_awk_seterrinf (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
const qse_awk_errinf_t* errinf /**< error information */
|
||||
);
|
||||
@ -1507,7 +1517,7 @@ void qse_awk_seterrinf (
|
||||
/**
|
||||
* The qse_awk_geterror() function gets error information via parameters.
|
||||
*/
|
||||
void qse_awk_geterror (
|
||||
QSE_EXPORT void qse_awk_geterror (
|
||||
const qse_awk_t* awk, /**< awk */
|
||||
qse_awk_errnum_t* errnum, /**< error number */
|
||||
const qse_char_t** errmsg, /**< error message */
|
||||
@ -1517,7 +1527,7 @@ void qse_awk_geterror (
|
||||
/**
|
||||
* The qse_awk_seterror() function sets error information.
|
||||
*/
|
||||
void qse_awk_seterror (
|
||||
QSE_EXPORT void qse_awk_seterror (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
qse_awk_errnum_t errnum, /**< error number */
|
||||
const qse_cstr_t* errarg, /**< argument array for formatting
|
||||
@ -1525,13 +1535,13 @@ void qse_awk_seterror (
|
||||
const qse_awk_loc_t* errloc /**< error location */
|
||||
);
|
||||
|
||||
int qse_awk_getopt (
|
||||
QSE_EXPORT int qse_awk_getopt (
|
||||
qse_awk_t* awk,
|
||||
qse_awk_opt_t id,
|
||||
void* value
|
||||
);
|
||||
|
||||
int qse_awk_setopt (
|
||||
QSE_EXPORT int qse_awk_setopt (
|
||||
qse_awk_t* awk,
|
||||
qse_awk_opt_t id,
|
||||
const void* value
|
||||
@ -1542,14 +1552,14 @@ int qse_awk_setopt (
|
||||
* and returns the pointer to it. If no callback set can be popped,
|
||||
* it returns #QSE_NULL.
|
||||
*/
|
||||
qse_awk_ecb_t* qse_awk_popecb (
|
||||
QSE_EXPORT qse_awk_ecb_t* qse_awk_popecb (
|
||||
qse_awk_t* awk /**< awk */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_awk_pushecb() function register a runtime callback set.
|
||||
*/
|
||||
void qse_awk_pushecb (
|
||||
QSE_EXPORT void qse_awk_pushecb (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
qse_awk_ecb_t* ecb /**< callback set */
|
||||
);
|
||||
@ -1558,7 +1568,7 @@ void qse_awk_pushecb (
|
||||
* The qse_awk_addgbl() function adds an intrinsic global variable.
|
||||
* @return the ID of the global variable added on success, -1 on failure.
|
||||
*/
|
||||
int qse_awk_addgbl (
|
||||
QSE_EXPORT int qse_awk_addgbl (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
const qse_char_t* name, /**< variable name */
|
||||
qse_size_t len /**< name length */
|
||||
@ -1568,7 +1578,7 @@ int qse_awk_addgbl (
|
||||
* The qse_awk_delgbl() function deletes an intrinsic global variable by name.
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int qse_awk_delgbl (
|
||||
QSE_EXPORT int qse_awk_delgbl (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
const qse_char_t* name, /**< variable name */
|
||||
qse_size_t len /**< name length */
|
||||
@ -1579,7 +1589,7 @@ int qse_awk_delgbl (
|
||||
* variable.
|
||||
* @return number >= 0 on success, -1 on failure
|
||||
*/
|
||||
int qse_awk_findgbl (
|
||||
QSE_EXPORT int qse_awk_findgbl (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
const qse_char_t* name, /**< variable name */
|
||||
qse_size_t len /**< name length */
|
||||
@ -1588,7 +1598,7 @@ int qse_awk_findgbl (
|
||||
/**
|
||||
* The qse_awk_addfnc() function adds an intrinsic function.
|
||||
*/
|
||||
void* qse_awk_addfnc (
|
||||
QSE_EXPORT void* qse_awk_addfnc (
|
||||
qse_awk_t* awk,
|
||||
const qse_char_t* name,
|
||||
qse_size_t name_len,
|
||||
@ -1603,7 +1613,7 @@ void* qse_awk_addfnc (
|
||||
* The qse_awk_delfnc() function deletes an intrinsic function by name.
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int qse_awk_delfnc (
|
||||
QSE_EXPORT int qse_awk_delfnc (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
const qse_char_t* name, /**< function name */
|
||||
qse_size_t len /**< name length */
|
||||
@ -1612,7 +1622,7 @@ int qse_awk_delfnc (
|
||||
/**
|
||||
* The qse_awk_clrfnc() function deletes all intrinsic functions
|
||||
*/
|
||||
void qse_awk_clrfnc (
|
||||
QSE_EXPORT void qse_awk_clrfnc (
|
||||
qse_awk_t* awk /**< awk */
|
||||
);
|
||||
|
||||
@ -1657,7 +1667,7 @@ void qse_awk_clrfnc (
|
||||
*
|
||||
* @return 0 on success, -1 on failure.
|
||||
*/
|
||||
int qse_awk_parse (
|
||||
QSE_EXPORT int qse_awk_parse (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
qse_awk_sio_t* sio /**< source script I/O handler */
|
||||
);
|
||||
@ -1666,7 +1676,7 @@ int qse_awk_parse (
|
||||
* The qse_awk_allocmem() function allocates dynamic memory.
|
||||
* @return a pointer to a memory block on success, #QSE_NULL on failure
|
||||
*/
|
||||
void* qse_awk_allocmem (
|
||||
QSE_EXPORT void* qse_awk_allocmem (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
qse_size_t size /**< size of memory to allocate in bytes */
|
||||
);
|
||||
@ -1675,7 +1685,7 @@ void* qse_awk_allocmem (
|
||||
* The qse_awk_reallocmem() function resizes a dynamic memory block.
|
||||
* @return a pointer to a memory block on success, #QSE_NULL on failure
|
||||
*/
|
||||
void* qse_awk_reallocmem (
|
||||
QSE_EXPORT void* qse_awk_reallocmem (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
void* ptr, /**< memory block */
|
||||
qse_size_t size /**< new block size in bytes */
|
||||
@ -1686,7 +1696,7 @@ void* qse_awk_reallocmem (
|
||||
* the size of @a size bytes and initializes it with 0.
|
||||
* @return a pointer to a memory block on success, #QSE_NULL on failure
|
||||
*/
|
||||
void* qse_awk_callocmem (
|
||||
QSE_EXPORT void* qse_awk_callocmem (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
qse_size_t size /**< size of memory to allocate in bytes */
|
||||
);
|
||||
@ -1694,7 +1704,7 @@ void* qse_awk_callocmem (
|
||||
/**
|
||||
* The qse_awk_freemem() function frees dynamic memory allocated.
|
||||
*/
|
||||
void qse_awk_freemem (
|
||||
QSE_EXPORT void qse_awk_freemem (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
void* ptr /**< memory block to free */
|
||||
);
|
||||
@ -1708,7 +1718,7 @@ void qse_awk_freemem (
|
||||
* @return a pointer to a new string duplicated of @a s on success,
|
||||
* #QSE_NULL on failure.
|
||||
*/
|
||||
qse_char_t* qse_awk_strdup (
|
||||
QSE_EXPORT qse_char_t* qse_awk_strdup (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
const qse_char_t* str /**< string pointer */
|
||||
);
|
||||
@ -1722,7 +1732,7 @@ qse_char_t* qse_awk_strdup (
|
||||
* @return a pointer to a new string duplicated of @a s on success,
|
||||
* #QSE_NULL on failure.
|
||||
*/
|
||||
qse_char_t* qse_awk_strxdup (
|
||||
QSE_EXPORT qse_char_t* qse_awk_strxdup (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
const qse_char_t* str, /**< string pointer */
|
||||
qse_size_t len /**< string length */
|
||||
@ -1736,7 +1746,7 @@ qse_char_t* qse_awk_strxdup (
|
||||
* @return pointer to a duplicated string on success,
|
||||
* #QSE_NULL on failure.
|
||||
*/
|
||||
qse_char_t* qse_awk_cstrdup (
|
||||
QSE_EXPORT qse_char_t* qse_awk_cstrdup (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
const qse_cstr_t* str /**< string */
|
||||
);
|
||||
@ -1744,7 +1754,7 @@ qse_char_t* qse_awk_cstrdup (
|
||||
/**
|
||||
* The qse_awk_strxtolong() function converts a string to an integer.
|
||||
*/
|
||||
qse_long_t qse_awk_strxtolong (
|
||||
QSE_EXPORT qse_long_t qse_awk_strxtolong (
|
||||
qse_awk_t* awk,
|
||||
const qse_char_t* str,
|
||||
qse_size_t len,
|
||||
@ -1756,7 +1766,7 @@ qse_long_t qse_awk_strxtolong (
|
||||
* The qse_awk_strxtoflt() function converts a string to a floating-point
|
||||
* number.
|
||||
*/
|
||||
qse_flt_t qse_awk_strxtoflt (
|
||||
QSE_EXPORT qse_flt_t qse_awk_strxtoflt (
|
||||
qse_awk_t* awk,
|
||||
const qse_char_t* str,
|
||||
qse_size_t len,
|
||||
@ -1766,7 +1776,7 @@ qse_flt_t qse_awk_strxtoflt (
|
||||
/**
|
||||
* The qse_awk_longtostr() functon convers an integer to a string.
|
||||
*/
|
||||
qse_size_t qse_awk_longtostr (
|
||||
QSE_EXPORT qse_size_t qse_awk_longtostr (
|
||||
qse_awk_t* awk,
|
||||
qse_long_t value,
|
||||
int radix,
|
||||
@ -1784,7 +1794,7 @@ qse_size_t qse_awk_longtostr (
|
||||
*
|
||||
* @return new runtime context on success, #QSE_NULL on failure
|
||||
*/
|
||||
qse_awk_rtx_t* qse_awk_rtx_open (
|
||||
QSE_EXPORT qse_awk_rtx_t* qse_awk_rtx_open (
|
||||
qse_awk_t* awk, /**< awk */
|
||||
qse_size_t xtn, /**< size of extension in bytes */
|
||||
qse_awk_rio_t* rio /**< runtime IO handlers */
|
||||
@ -1793,7 +1803,7 @@ qse_awk_rtx_t* qse_awk_rtx_open (
|
||||
/**
|
||||
* The qse_awk_rtx_close() function destroys a runtime context.
|
||||
*/
|
||||
void qse_awk_rtx_close (
|
||||
QSE_EXPORT void qse_awk_rtx_close (
|
||||
qse_awk_rtx_t* rtx /**< runtime context */
|
||||
);
|
||||
|
||||
@ -1817,7 +1827,7 @@ void qse_awk_rtx_close (
|
||||
*
|
||||
* @return return value on success, #QSE_NULL on failure.
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_loop (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_loop (
|
||||
qse_awk_rtx_t* rtx /**< runtime context */
|
||||
);
|
||||
|
||||
@ -1826,7 +1836,7 @@ qse_awk_val_t* qse_awk_rtx_loop (
|
||||
* and returns the pointer to it if one is found. It returns #QSE_NULL if
|
||||
* it fails to find a function by the @a name.
|
||||
*/
|
||||
qse_awk_fun_t* qse_awk_rtx_findfun (
|
||||
QSE_EXPORT qse_awk_fun_t* qse_awk_rtx_findfun (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
const qse_char_t* name /**< function name */
|
||||
);
|
||||
@ -1836,11 +1846,11 @@ qse_awk_fun_t* qse_awk_rtx_findfun (
|
||||
* the structure pointed to by @a fun.
|
||||
* @sa qse_awk_rtx_call
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_callfun (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_awk_fun_t* fun, /**< function */
|
||||
qse_awk_val_t** args, /**< arguments to the function */
|
||||
qse_size_t nargs /**< the number of arguments */
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_callfun (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_awk_fun_t* fun, /**< function */
|
||||
qse_awk_val_t* args[], /**< arguments to the function */
|
||||
qse_size_t nargs /**< the number of arguments */
|
||||
);
|
||||
|
||||
/**
|
||||
@ -1864,11 +1874,11 @@ qse_awk_val_t* qse_awk_rtx_callfun (
|
||||
*
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_call (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
const qse_char_t* name, /**< function name */
|
||||
qse_awk_val_t** args, /**< arguments to the function */
|
||||
qse_size_t nargs /**< the number of arguments */
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_call (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
const qse_char_t* name, /**< function name */
|
||||
qse_awk_val_t* args[], /**< arguments to the function */
|
||||
qse_size_t nargs /**< the number of arguments */
|
||||
);
|
||||
|
||||
/**
|
||||
@ -1877,18 +1887,18 @@ qse_awk_val_t* qse_awk_rtx_call (
|
||||
* from the null-terminated strings and calls qse_awk_rtx_call() with the
|
||||
* values created.
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_callwithstrs (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
const qse_char_t* name, /**< function name */
|
||||
const qse_char_t** args, /**< arguments to the function */
|
||||
qse_size_t nargs /**< the number of arguments */
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_callwithstrs (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
const qse_char_t* name, /**< function name */
|
||||
const qse_char_t* args[], /**< arguments to the function */
|
||||
qse_size_t nargs /**< the number of arguments */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_awk_stopall() function aborts all active runtime contexts
|
||||
* associated with @a awk.
|
||||
*/
|
||||
void qse_awk_stopall (
|
||||
QSE_EXPORT void qse_awk_stopall (
|
||||
qse_awk_t* awk /**< awk */
|
||||
);
|
||||
|
||||
@ -1896,7 +1906,7 @@ void qse_awk_stopall (
|
||||
* The qse_awk_rtx_isstop() function tests if qse_awk_rtx_stop() has been
|
||||
* called.
|
||||
*/
|
||||
int qse_awk_rtx_isstop (
|
||||
QSE_EXPORT int qse_awk_rtx_isstop (
|
||||
qse_awk_rtx_t* rtx /**< runtime context */
|
||||
);
|
||||
|
||||
@ -1904,7 +1914,7 @@ int qse_awk_rtx_isstop (
|
||||
* The qse_awk_rtx_stop() function causes an active runtime context @a rtx to
|
||||
* be aborted.
|
||||
*/
|
||||
void qse_awk_rtx_stop (
|
||||
QSE_EXPORT void qse_awk_rtx_stop (
|
||||
qse_awk_rtx_t* rtx /**< runtime context */
|
||||
);
|
||||
|
||||
@ -1912,7 +1922,7 @@ void qse_awk_rtx_stop (
|
||||
* The qse_awk_rtx_getrio() function copies runtime I/O handlers
|
||||
* to the memory buffer pointed to by @a rio.
|
||||
*/
|
||||
void qse_awk_rtx_getrio (
|
||||
QSE_EXPORT void qse_awk_rtx_getrio (
|
||||
qse_awk_rtx_t* rtx,
|
||||
qse_awk_rio_t* rio
|
||||
);
|
||||
@ -1921,7 +1931,7 @@ void qse_awk_rtx_getrio (
|
||||
* The qse_awk_rtx_getrio() function sets runtime I/O handlers
|
||||
* with the functions pointed to by @a rio.
|
||||
*/
|
||||
void qse_awk_rtx_setrio (
|
||||
QSE_EXPORT void qse_awk_rtx_setrio (
|
||||
qse_awk_rtx_t* rtx,
|
||||
const qse_awk_rio_t* rio
|
||||
);
|
||||
@ -1931,14 +1941,14 @@ void qse_awk_rtx_setrio (
|
||||
* and returns the pointer to it. If no callback set can be popped,
|
||||
* it returns #QSE_NULL.
|
||||
*/
|
||||
qse_awk_rtx_ecb_t* qse_awk_rtx_popecb (
|
||||
QSE_EXPORT qse_awk_rtx_ecb_t* qse_awk_rtx_popecb (
|
||||
qse_awk_rtx_t* rtx /**< runtime context */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_awk_rtx_pushecb() function register a runtime callback set.
|
||||
*/
|
||||
void qse_awk_rtx_pushecb (
|
||||
QSE_EXPORT void qse_awk_rtx_pushecb (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_awk_rtx_ecb_t* ecb /**< callback set */
|
||||
);
|
||||
@ -1947,14 +1957,14 @@ void qse_awk_rtx_pushecb (
|
||||
* The qse_awk_rtx_getnargs() gets the number of arguments passed to an
|
||||
* intrinsic functon.
|
||||
*/
|
||||
qse_size_t qse_awk_rtx_getnargs (
|
||||
QSE_EXPORT qse_size_t qse_awk_rtx_getnargs (
|
||||
qse_awk_rtx_t* rtx
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_awk_rtx_getarg() function gets an argument passed to qse_awk_run().
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_getarg (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_getarg (
|
||||
qse_awk_rtx_t* rtx,
|
||||
qse_size_t idx
|
||||
);
|
||||
@ -1964,7 +1974,7 @@ qse_awk_val_t* qse_awk_rtx_getarg (
|
||||
* pointer to the internal value of SUBSEP. It's a specialized
|
||||
* version of qse_awk_rtx_getgbl (rtx, QSE_AWK_GBL_SUBSEP).
|
||||
*/
|
||||
const qse_xstr_t* qse_awk_rtx_getsubsep (
|
||||
QSE_EXPORT const qse_xstr_t* qse_awk_rtx_getsubsep (
|
||||
qse_awk_rtx_t* rtx /**< runtime context */
|
||||
);
|
||||
|
||||
@ -1975,9 +1985,9 @@ const qse_xstr_t* qse_awk_rtx_getsubsep (
|
||||
* This function never fails so long as the ID is valid. Otherwise,
|
||||
* you may get into trouble.
|
||||
*
|
||||
* @return a value pointer
|
||||
* @return value pointer
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_getgbl (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_getgbl (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
int id /**< global variable ID */
|
||||
);
|
||||
@ -1985,7 +1995,7 @@ qse_awk_val_t* qse_awk_rtx_getgbl (
|
||||
/**
|
||||
* The qse_awk_rtx_setgbl() sets the value of a global variable.
|
||||
*/
|
||||
int qse_awk_rtx_setgbl (
|
||||
QSE_EXPORT int qse_awk_rtx_setgbl (
|
||||
qse_awk_rtx_t* rtx,
|
||||
int id,
|
||||
qse_awk_val_t* val
|
||||
@ -1999,7 +2009,7 @@ int qse_awk_rtx_setgbl (
|
||||
* The qse_awk_rtx_setretval() will update its reference count properly
|
||||
* once the return value is set.
|
||||
*/
|
||||
void qse_awk_rtx_setretval (
|
||||
QSE_EXPORT void qse_awk_rtx_setretval (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_awk_val_t* val /**< return value */
|
||||
);
|
||||
@ -2007,7 +2017,7 @@ void qse_awk_rtx_setretval (
|
||||
/**
|
||||
* The qse_awk_rtx_setfilename() function sets FILENAME.
|
||||
*/
|
||||
int qse_awk_rtx_setfilename (
|
||||
QSE_EXPORT int qse_awk_rtx_setfilename (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
const qse_char_t* str, /**< name pointer */
|
||||
qse_size_t len /**< name length */
|
||||
@ -2016,7 +2026,7 @@ int qse_awk_rtx_setfilename (
|
||||
/**
|
||||
* The qse_awk_rtx_setofilename() function sets OFILENAME.
|
||||
*/
|
||||
int qse_awk_rtx_setofilename (
|
||||
QSE_EXPORT int qse_awk_rtx_setofilename (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
const qse_char_t* str, /**< name pointer */
|
||||
qse_size_t len /**< name length */
|
||||
@ -2026,7 +2036,7 @@ int qse_awk_rtx_setofilename (
|
||||
* The qse_awk_rtx_getawk() function gets the owner of a runtime context @a rtx.
|
||||
* @return owner of a runtime context @a rtx.
|
||||
*/
|
||||
qse_awk_t* qse_awk_rtx_getawk (
|
||||
QSE_EXPORT qse_awk_t* qse_awk_rtx_getawk (
|
||||
qse_awk_rtx_t* rtx /**< runtime context */
|
||||
);
|
||||
|
||||
@ -2034,21 +2044,21 @@ qse_awk_t* qse_awk_rtx_getawk (
|
||||
* The qse_awk_rtx_getmmgr() function gets the memory manager of a runtime
|
||||
* context.
|
||||
*/
|
||||
qse_mmgr_t* qse_awk_rtx_getmmgr (
|
||||
QSE_EXPORT qse_mmgr_t* qse_awk_rtx_getmmgr (
|
||||
qse_awk_rtx_t* rtx /**< runtime context */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_awk_rtx_getxtn() function gets the pointer to the extension block.
|
||||
*/
|
||||
void* qse_awk_rtx_getxtn (
|
||||
QSE_EXPORT void* qse_awk_rtx_getxtn (
|
||||
qse_awk_rtx_t* rtx /**< runtime context */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_awk_rtx_getnvmap() gets the map of named variables
|
||||
*/
|
||||
qse_htb_t* qse_awk_rtx_getnvmap (
|
||||
QSE_EXPORT qse_htb_t* qse_awk_rtx_getnvmap (
|
||||
qse_awk_rtx_t* rtx /**< runtime context */
|
||||
);
|
||||
|
||||
@ -2057,7 +2067,7 @@ qse_htb_t* qse_awk_rtx_getnvmap (
|
||||
* occurred during runtime.
|
||||
* @return error number
|
||||
*/
|
||||
qse_awk_errnum_t qse_awk_rtx_geterrnum (
|
||||
QSE_EXPORT qse_awk_errnum_t qse_awk_rtx_geterrnum (
|
||||
const qse_awk_rtx_t* rtx /**< runtime context */
|
||||
);
|
||||
|
||||
@ -2066,7 +2076,7 @@ qse_awk_errnum_t qse_awk_rtx_geterrnum (
|
||||
* occurred during runtime. The
|
||||
* @return error location
|
||||
*/
|
||||
const qse_awk_loc_t* qse_awk_rtx_geterrloc (
|
||||
QSE_EXPORT const qse_awk_loc_t* qse_awk_rtx_geterrloc (
|
||||
const qse_awk_rtx_t* rtx /**< runtime context */
|
||||
);
|
||||
|
||||
@ -2075,7 +2085,7 @@ const qse_awk_loc_t* qse_awk_rtx_geterrloc (
|
||||
* error occurred during runtime.
|
||||
* @return error message
|
||||
*/
|
||||
const qse_char_t* qse_awk_rtx_geterrmsg (
|
||||
QSE_EXPORT const qse_char_t* qse_awk_rtx_geterrmsg (
|
||||
const qse_awk_rtx_t* rtx /**< runtime context */
|
||||
);
|
||||
|
||||
@ -2083,7 +2093,7 @@ const qse_char_t* qse_awk_rtx_geterrmsg (
|
||||
* The qse_awk_rtx_geterrinf() function copies error information into memory
|
||||
* pointed to by @a errinf from a runtime context @a rtx.
|
||||
*/
|
||||
void qse_awk_rtx_geterrinf (
|
||||
QSE_EXPORT void qse_awk_rtx_geterrinf (
|
||||
const qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_awk_errinf_t* errinf /**< error information */
|
||||
);
|
||||
@ -2094,7 +2104,7 @@ void qse_awk_rtx_geterrinf (
|
||||
* to by @a errnum; the error message pointer into memory pointed to by
|
||||
* @a errmsg; the error line into memory pointed to by @a errlin.
|
||||
*/
|
||||
void qse_awk_rtx_geterror (
|
||||
QSE_EXPORT void qse_awk_rtx_geterror (
|
||||
const qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_awk_errnum_t* errnum, /**< error number */
|
||||
const qse_char_t** errmsg, /**< error message */
|
||||
@ -2105,7 +2115,7 @@ void qse_awk_rtx_geterror (
|
||||
* The qse_awk_rtx_seterrnum() function sets the error information omitting
|
||||
* the error location.
|
||||
*/
|
||||
void qse_awk_rtx_seterrnum (
|
||||
QSE_EXPORT void qse_awk_rtx_seterrnum (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_awk_errnum_t errnum, /**< error number */
|
||||
const qse_cstr_t* errarg /**< arguments to format error message */
|
||||
@ -2114,7 +2124,7 @@ void qse_awk_rtx_seterrnum (
|
||||
/**
|
||||
* The qse_awk_rtx_seterrinf() function sets error information.
|
||||
*/
|
||||
void qse_awk_rtx_seterrinf (
|
||||
QSE_EXPORT void qse_awk_rtx_seterrinf (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
const qse_awk_errinf_t* errinf /**< error information */
|
||||
);
|
||||
@ -2122,7 +2132,7 @@ void qse_awk_rtx_seterrinf (
|
||||
/**
|
||||
* The qse_awk_rtx_seterror() function sets error information.
|
||||
*/
|
||||
void qse_awk_rtx_seterror (
|
||||
QSE_EXPORT void qse_awk_rtx_seterror (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_awk_errnum_t errnum, /**< error number */
|
||||
const qse_cstr_t* errarg, /**< argument array for formatting
|
||||
@ -2134,7 +2144,7 @@ void qse_awk_rtx_seterror (
|
||||
* The qse_awk_rtx_clrrec() function clears the input record ($0)
|
||||
* and fields ($1 to $N).
|
||||
*/
|
||||
int qse_awk_rtx_clrrec (
|
||||
QSE_EXPORT int qse_awk_rtx_clrrec (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
int skip_inrec_line
|
||||
);
|
||||
@ -2143,7 +2153,7 @@ int qse_awk_rtx_clrrec (
|
||||
* The qse_awk_rtx_setrec() function sets the input record ($0) or
|
||||
* input fields ($1 to $N).
|
||||
*/
|
||||
int qse_awk_rtx_setrec (
|
||||
QSE_EXPORT int qse_awk_rtx_setrec (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_size_t idx, /**< 0 for $0, N for $N */
|
||||
const qse_cstr_t* str /**< string */
|
||||
@ -2154,7 +2164,7 @@ int qse_awk_rtx_setrec (
|
||||
* It always returns the pointer to the statically allocated
|
||||
* nil value. So it never fails.
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_makenilval (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makenilval (
|
||||
qse_awk_rtx_t* rtx
|
||||
);
|
||||
|
||||
@ -2162,7 +2172,7 @@ qse_awk_val_t* qse_awk_rtx_makenilval (
|
||||
* The qse_awk_rtx_makeintval() function creates an integer value.
|
||||
* @return value on success, QSE_NULL on failure
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_makeintval (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makeintval (
|
||||
qse_awk_rtx_t* rtx,
|
||||
qse_long_t v
|
||||
);
|
||||
@ -2171,7 +2181,7 @@ qse_awk_val_t* qse_awk_rtx_makeintval (
|
||||
* The qse_awk_rtx_makefltval() function creates a floating-point value.
|
||||
* @return value on success, QSE_NULL on failure
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_makefltval (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makefltval (
|
||||
qse_awk_rtx_t* rtx,
|
||||
qse_flt_t v
|
||||
);
|
||||
@ -2180,7 +2190,7 @@ qse_awk_val_t* qse_awk_rtx_makefltval (
|
||||
* The qse_awk_rtx_makestrvalwithstr() function creates a string value.
|
||||
* @return value on success, QSE_NULL on failure
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_makestrvalwithstr (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makestrvalwithstr (
|
||||
qse_awk_rtx_t* rtx,
|
||||
const qse_char_t* str
|
||||
);
|
||||
@ -2190,7 +2200,7 @@ qse_awk_val_t* qse_awk_rtx_makestrvalwithstr (
|
||||
* from a null-terminated multibyte string.
|
||||
* @return value on success, QSE_NULL on failure
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_makestrvalwithmbs (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makestrvalwithmbs (
|
||||
qse_awk_rtx_t* rtx,
|
||||
const qse_mchar_t* mbs
|
||||
);
|
||||
@ -2200,7 +2210,7 @@ qse_awk_val_t* qse_awk_rtx_makestrvalwithmbs (
|
||||
* from a null-terminated wide-character string.
|
||||
* @return value on success, QSE_NULL on failure
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_makestrvalwithwcs (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makestrvalwithwcs (
|
||||
qse_awk_rtx_t* rtx,
|
||||
const qse_wchar_t* wcs
|
||||
);
|
||||
@ -2209,17 +2219,17 @@ qse_awk_val_t* qse_awk_rtx_makestrvalwithwcs (
|
||||
* The qse_awk_rtx_makestrvalwithcstr() function creates a string value.
|
||||
* @return value on success, QSE_NULL on failure
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_makestrvalwithcstr (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makestrvalwithcstr (
|
||||
qse_awk_rtx_t* rtx,
|
||||
const qse_cstr_t* str
|
||||
);
|
||||
|
||||
qse_awk_val_t* qse_awk_rtx_makestrvalwithmcstr (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makestrvalwithmcstr (
|
||||
qse_awk_rtx_t* rtx,
|
||||
const qse_mcstr_t* mcstr
|
||||
);
|
||||
|
||||
qse_awk_val_t* qse_awk_rtx_makestrvalwithwcstr (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makestrvalwithwcstr (
|
||||
qse_awk_rtx_t* rtx,
|
||||
const qse_wcstr_t* wcstr
|
||||
);
|
||||
@ -2228,7 +2238,7 @@ qse_awk_val_t* qse_awk_rtx_makestrvalwithwcstr (
|
||||
* The qse_awk_rtx_makestrval() function creates a string value.
|
||||
* @return value on success, QSE_NULL on failure
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_makestrval (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makestrval (
|
||||
qse_awk_rtx_t* rtx,
|
||||
const qse_char_t* str,
|
||||
qse_size_t len
|
||||
@ -2239,7 +2249,7 @@ qse_awk_val_t* qse_awk_rtx_makestrval (
|
||||
* two strings.
|
||||
* @return value on success, QSE_NULL on failure
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_makestrval2 (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makestrval2 (
|
||||
qse_awk_rtx_t* rtx,
|
||||
const qse_char_t* str1,
|
||||
qse_size_t len1,
|
||||
@ -2253,7 +2263,7 @@ qse_awk_val_t* qse_awk_rtx_makestrval2 (
|
||||
* is 1.
|
||||
* @return value on success, QSE_NULL on failure
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_makenstrvalwithcstr (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makenstrvalwithcstr (
|
||||
qse_awk_rtx_t* rtx,
|
||||
const qse_cstr_t* str
|
||||
);
|
||||
@ -2262,10 +2272,9 @@ qse_awk_val_t* qse_awk_rtx_makenstrvalwithcstr (
|
||||
* The qse_awk_rtx_makerexval() function creates a regular expression value.
|
||||
* @return value on success, QSE_NULL on failure
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_makerexval (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makerexval (
|
||||
qse_awk_rtx_t* rtx,
|
||||
const qse_char_t* buf,
|
||||
qse_size_t len,
|
||||
const qse_cstr_t* str,
|
||||
void* code
|
||||
);
|
||||
|
||||
@ -2273,11 +2282,11 @@ qse_awk_val_t* qse_awk_rtx_makerexval (
|
||||
* The qse_awk_rtx_makemapval() function creates an empty map value.
|
||||
* @return value on success, QSE_NULL on failure
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_makemapval (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makemapval (
|
||||
qse_awk_rtx_t* rtx
|
||||
);
|
||||
|
||||
qse_awk_val_t* qse_awk_rtx_makemapvalwithdata (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makemapvalwithdata (
|
||||
qse_awk_rtx_t* rtx,
|
||||
qse_awk_val_map_data_t data[]
|
||||
);
|
||||
@ -2287,7 +2296,7 @@ qse_awk_val_t* qse_awk_rtx_makemapvalwithdata (
|
||||
* You must make sure that the type of @a map is #QSE_AWK_VAL_MAP.
|
||||
* @return value @a v on success, #QSE_NULL on failure.
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_setmapvalfld (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_setmapvalfld (
|
||||
qse_awk_rtx_t* rtx,
|
||||
qse_awk_val_t* map,
|
||||
const qse_char_t* kptr,
|
||||
@ -2302,7 +2311,7 @@ qse_awk_val_t* qse_awk_rtx_setmapvalfld (
|
||||
* to #QSE_AWK_EINVAL. The function does not fail for other reasons.
|
||||
* @return field value on success, #QSE_NULL on failure.
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_getmapvalfld (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_getmapvalfld (
|
||||
qse_awk_rtx_t* rtx,
|
||||
qse_awk_val_t* map,
|
||||
const qse_char_t* kptr,
|
||||
@ -2315,7 +2324,7 @@ qse_awk_val_t* qse_awk_rtx_getmapvalfld (
|
||||
* @a itr to #QSE_NULL if the map contains no pair. Otherwise, it returns
|
||||
* @a itr pointing to the first pair.
|
||||
*/
|
||||
qse_awk_val_map_itr_t* qse_awk_rtx_getfirstmapvalitr (
|
||||
QSE_EXPORT qse_awk_val_map_itr_t* qse_awk_rtx_getfirstmapvalitr (
|
||||
qse_awk_rtx_t* rtx,
|
||||
qse_awk_val_t* map,
|
||||
qse_awk_val_map_itr_t* itr
|
||||
@ -2327,7 +2336,7 @@ qse_awk_val_map_itr_t* qse_awk_rtx_getfirstmapvalitr (
|
||||
* field of @a itr to #QSE_NULL if @a itr points to the last pair.
|
||||
* Otherwise, it returns @a itr pointing to the next pair.
|
||||
*/
|
||||
qse_awk_val_map_itr_t* qse_awk_rtx_getnextmapvalitr (
|
||||
QSE_EXPORT qse_awk_val_map_itr_t* qse_awk_rtx_getnextmapvalitr (
|
||||
qse_awk_rtx_t* rtx,
|
||||
qse_awk_val_t* map,
|
||||
qse_awk_val_map_itr_t* itr
|
||||
@ -2338,7 +2347,7 @@ qse_awk_val_map_itr_t* qse_awk_rtx_getnextmapvalitr (
|
||||
* The qse_awk_rtx_makerefval() function creates a reference value.
|
||||
* @return value on success, QSE_NULL on failure
|
||||
*/
|
||||
qse_awk_val_t* qse_awk_rtx_makerefval (
|
||||
QSE_EXPORT qse_awk_val_t* qse_awk_rtx_makerefval (
|
||||
qse_awk_rtx_t* rtx,
|
||||
int id,
|
||||
qse_awk_val_t** adr
|
||||
@ -2350,7 +2359,7 @@ qse_awk_val_t* qse_awk_rtx_makerefval (
|
||||
* is closed.
|
||||
* @return QSE_TRUE if @a val is static, QSE_FALSE if @a val is false
|
||||
*/
|
||||
int qse_awk_rtx_isstaticval (
|
||||
QSE_EXPORT int qse_awk_rtx_isstaticval (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_awk_val_t* val /**< value to check */
|
||||
);
|
||||
@ -2359,7 +2368,7 @@ int qse_awk_rtx_isstaticval (
|
||||
* The qse_awk_rtx_refupval() function increments a reference count of a
|
||||
* value @a val.
|
||||
*/
|
||||
void qse_awk_rtx_refupval (
|
||||
QSE_EXPORT void qse_awk_rtx_refupval (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_awk_val_t* val /**< value */
|
||||
);
|
||||
@ -2368,7 +2377,7 @@ void qse_awk_rtx_refupval (
|
||||
* The qse_awk_rtx_refdownval() function decrements a reference count of
|
||||
* a value @a val. It destroys the value if it has reached the count of 0.
|
||||
*/
|
||||
void qse_awk_rtx_refdownval (
|
||||
QSE_EXPORT void qse_awk_rtx_refdownval (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_awk_val_t* val /**< value pointer */
|
||||
);
|
||||
@ -2378,7 +2387,7 @@ void qse_awk_rtx_refdownval (
|
||||
* a value @a val. It does not destroy the value if it has reached the
|
||||
* count of 0.
|
||||
*/
|
||||
void qse_awk_rtx_refdownval_nofree (
|
||||
QSE_EXPORT void qse_awk_rtx_refdownval_nofree (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_awk_val_t* val /**< value pointer */
|
||||
);
|
||||
@ -2387,7 +2396,7 @@ void qse_awk_rtx_refdownval_nofree (
|
||||
* The qse_awk_rtx_valtobool() function converts a value @a val to a boolean
|
||||
* value.
|
||||
*/
|
||||
int qse_awk_rtx_valtobool (
|
||||
QSE_EXPORT int qse_awk_rtx_valtobool (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
const qse_awk_val_t* val /**< value pointer */
|
||||
);
|
||||
@ -2474,7 +2483,7 @@ int qse_awk_rtx_valtobool (
|
||||
*
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int qse_awk_rtx_valtostr (
|
||||
QSE_EXPORT int qse_awk_rtx_valtostr (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
const qse_awk_val_t* val, /**< value to convert */
|
||||
qse_awk_rtx_valtostr_out_t* out /**< output buffer */
|
||||
@ -2497,19 +2506,19 @@ int qse_awk_rtx_valtostr (
|
||||
* @return character pointer to a string converted on success,
|
||||
* #QSE_NULL on failure
|
||||
*/
|
||||
qse_char_t* qse_awk_rtx_valtostrdup (
|
||||
QSE_EXPORT qse_char_t* qse_awk_rtx_valtostrdup (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
const qse_awk_val_t* val, /**< value to convert */
|
||||
qse_size_t* len /**< result length */
|
||||
);
|
||||
|
||||
qse_mchar_t* qse_awk_rtx_valtombsdup (
|
||||
QSE_EXPORT qse_mchar_t* qse_awk_rtx_valtombsdup (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
const qse_awk_val_t* val, /**< value to convert */
|
||||
qse_size_t* len /**< result length */
|
||||
);
|
||||
|
||||
qse_wchar_t* qse_awk_rtx_valtowcsdup (
|
||||
QSE_EXPORT qse_wchar_t* qse_awk_rtx_valtowcsdup (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
const qse_awk_val_t* val, /**< value to convert */
|
||||
qse_size_t* len /**< result length */
|
||||
@ -2538,20 +2547,20 @@ qse_wchar_t* qse_awk_rtx_valtowcsdup (
|
||||
* @return -1 on failure, 0 if converted to a long number, 1 if converted to
|
||||
* a floating-point number.
|
||||
*/
|
||||
int qse_awk_rtx_valtonum (
|
||||
QSE_EXPORT int qse_awk_rtx_valtonum (
|
||||
qse_awk_rtx_t* rtx,
|
||||
const qse_awk_val_t* val,
|
||||
qse_long_t* l,
|
||||
qse_flt_t* r
|
||||
);
|
||||
|
||||
int qse_awk_rtx_valtolong (
|
||||
QSE_EXPORT int qse_awk_rtx_valtolong (
|
||||
qse_awk_rtx_t* rtx,
|
||||
const qse_awk_val_t* val,
|
||||
qse_long_t* l
|
||||
);
|
||||
|
||||
int qse_awk_rtx_valtoflt (
|
||||
QSE_EXPORT int qse_awk_rtx_valtoflt (
|
||||
qse_awk_rtx_t* rtx,
|
||||
const qse_awk_val_t* val,
|
||||
qse_flt_t* r
|
||||
@ -2571,7 +2580,7 @@ int qse_awk_rtx_valtoflt (
|
||||
* 1 if converted to a floating-point number
|
||||
* -1 on error.
|
||||
*/
|
||||
int qse_awk_rtx_strtonum (
|
||||
QSE_EXPORT int qse_awk_rtx_strtonum (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
int strict, /**< determines to perform strict check */
|
||||
const qse_char_t* ptr, /**< points to a string to convert */
|
||||
@ -2584,18 +2593,18 @@ int qse_awk_rtx_strtonum (
|
||||
* The qse_awk_rtx_hashval() functions hashes a simple value
|
||||
* to a positive integer. It returns -1 for a inhashable value.
|
||||
*/
|
||||
qse_long_t qse_awk_rtx_hashval (
|
||||
QSE_EXPORT qse_long_t qse_awk_rtx_hashval (
|
||||
qse_awk_rtx_t* rtx,
|
||||
qse_awk_val_t* v
|
||||
);
|
||||
|
||||
|
||||
void qse_awk_rtx_setnrflt (
|
||||
QSE_EXPORT void qse_awk_rtx_setnrflt (
|
||||
qse_awk_rtx_t* rtx,
|
||||
const qse_awk_nrflt_t* nrflt
|
||||
);
|
||||
|
||||
void qse_awk_rtx_getnrflt (
|
||||
QSE_EXPORT void qse_awk_rtx_getnrflt (
|
||||
qse_awk_rtx_t* rtx,
|
||||
qse_awk_nrflt_t* nrflt
|
||||
);
|
||||
@ -2605,7 +2614,7 @@ void qse_awk_rtx_getnrflt (
|
||||
* using the memory manager associated with a runtime context @a rtx.
|
||||
* @return the pointer to a memory block on success, #QSE_NULL on failure.
|
||||
*/
|
||||
void* qse_awk_rtx_allocmem (
|
||||
QSE_EXPORT void* qse_awk_rtx_allocmem (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_size_t size /**< block size in bytes */
|
||||
);
|
||||
@ -2616,7 +2625,7 @@ void* qse_awk_rtx_allocmem (
|
||||
* a runtime context @a rtx.
|
||||
* @return the pointer to a memory block on success, #QSE_NULL on failure.
|
||||
*/
|
||||
void* qse_awk_rtx_reallocmem (
|
||||
QSE_EXPORT void* qse_awk_rtx_reallocmem (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
void* ptr, /**< memory block */
|
||||
qse_size_t size /**< block size in bytes */
|
||||
@ -2627,7 +2636,7 @@ void* qse_awk_rtx_reallocmem (
|
||||
* the size of @a size bytes and initializes it with 0.
|
||||
* @return a pointer to a memory block on success, #QSE_NULL on failure
|
||||
*/
|
||||
void* qse_awk_rtx_callocmem (
|
||||
QSE_EXPORT void* qse_awk_rtx_callocmem (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
qse_size_t size /**< block size in bytes */
|
||||
);
|
||||
@ -2636,7 +2645,7 @@ void* qse_awk_rtx_callocmem (
|
||||
* The qse_awk_rtx_freemem() function frees a memory block pointed to by @a ptr
|
||||
* using the memory manager of a runtime ocntext @a rtx.
|
||||
*/
|
||||
void qse_awk_rtx_freemem (
|
||||
QSE_EXPORT void qse_awk_rtx_freemem (
|
||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||
void* ptr /**< memory block pointer */
|
||||
);
|
||||
|
@ -105,7 +105,7 @@ extern "C" {
|
||||
* standard intrinsic functions like atan, system, etc. Use this function
|
||||
* over qse_awk_open() if you don't need finer-grained customization.
|
||||
*/
|
||||
qse_awk_t* qse_awk_openstd (
|
||||
QSE_EXPORT qse_awk_t* qse_awk_openstd (
|
||||
qse_size_t xtnsize /**< extension size in bytes */
|
||||
);
|
||||
|
||||
@ -114,7 +114,7 @@ qse_awk_t* qse_awk_openstd (
|
||||
* user-defined memory manager. It is equivalent to qse_awk_openstd(),
|
||||
* except that you can specify your own memory manager.
|
||||
*/
|
||||
qse_awk_t* qse_awk_openstdwithmmgr (
|
||||
QSE_EXPORT qse_awk_t* qse_awk_openstdwithmmgr (
|
||||
qse_mmgr_t* mmgr, /**< memory manager */
|
||||
qse_size_t xtnsize /**< extension size in bytes */
|
||||
);
|
||||
@ -124,7 +124,7 @@ qse_awk_t* qse_awk_openstdwithmmgr (
|
||||
* Note that you must not call qse_awk_getxtn() for an awk object
|
||||
* created with qse_awk_openstd() and qse_awk_openstdwithmmgr().
|
||||
*/
|
||||
void* qse_awk_getxtnstd (
|
||||
QSE_EXPORT void* qse_awk_getxtnstd (
|
||||
qse_awk_t* awk
|
||||
);
|
||||
|
||||
@ -149,7 +149,7 @@ void* qse_awk_getxtnstd (
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
int qse_awk_parsestd (
|
||||
QSE_EXPORT int qse_awk_parsestd (
|
||||
qse_awk_t* awk,
|
||||
qse_awk_parsestd_t* in,
|
||||
qse_awk_parsestd_t* out
|
||||
@ -161,7 +161,7 @@ int qse_awk_parsestd (
|
||||
* the lifetime of the runtime context created. The @a cmgr is set to the
|
||||
* streams created with @a icf and @a ocf if it is not #QSE_NULL.
|
||||
*/
|
||||
qse_awk_rtx_t* qse_awk_rtx_openstd (
|
||||
QSE_EXPORT qse_awk_rtx_t* qse_awk_rtx_openstd (
|
||||
qse_awk_t* awk,
|
||||
qse_size_t xtnsize,
|
||||
const qse_char_t* id,
|
||||
@ -173,7 +173,7 @@ qse_awk_rtx_t* qse_awk_rtx_openstd (
|
||||
/**
|
||||
* The qse_awk_rtx_getxtnstd() function gets the pointer to extension space.
|
||||
*/
|
||||
void* qse_awk_rtx_getxtnstd (
|
||||
QSE_EXPORT void* qse_awk_rtx_getxtnstd (
|
||||
qse_awk_rtx_t* rtx
|
||||
);
|
||||
|
||||
@ -184,7 +184,7 @@ void* qse_awk_rtx_getxtnstd (
|
||||
* @a ioname if #QSE_CHAR_IS_WCHAR is defined. It always returns #QSE_NULL
|
||||
* if #QSE_CHAR_IS_MCHAR is defined.
|
||||
*/
|
||||
qse_cmgr_t* qse_awk_rtx_getcmgrstd (
|
||||
QSE_EXPORT qse_cmgr_t* qse_awk_rtx_getcmgrstd (
|
||||
qse_awk_rtx_t* rtx,
|
||||
const qse_char_t* ioname
|
||||
);
|
||||
|
@ -316,15 +316,6 @@
|
||||
#define QSE_DEFINE_COMMON_FIELDS(name) \
|
||||
qse_mmgr_t* mmgr;
|
||||
|
||||
|
||||
#define QSE_BEGIN_CLASS(name) \
|
||||
typedef struct name name; \
|
||||
struct name \
|
||||
{ \
|
||||
qse_mmgr_t* mmgr; \
|
||||
|
||||
#define QSE_END_CLASS(name) };
|
||||
|
||||
/**
|
||||
* The QSE_DEFINE_COMMON_FUNCTIONS() macro defines common object functions.
|
||||
* - @code void qse_xxx_setmmgr (qse_xxx_t* xxx, qse_mmgr_t* mmgr); @endcode
|
||||
@ -342,12 +333,6 @@ void qse_##name##_setmmgr (qse_##name##_t* name, qse_mmgr_t* mmgr); \
|
||||
qse_mmgr_t* qse_##name##_getmmgr (qse_##name##_t* name); \
|
||||
void* qse_##name##_getxtn (qse_##name##_t* name);
|
||||
|
||||
|
||||
/**
|
||||
* The QSE_MMGR() macro gets the memory manager field from an object.
|
||||
*/
|
||||
#define QSE_MMGR(obj) ((obj)->mmgr)
|
||||
|
||||
/**
|
||||
* The QSE_XTN() macro is a convenience macro to retrieve the pointer to
|
||||
* extension space located at the end of an object. The type of the object
|
||||
@ -362,11 +347,11 @@ void* qse_##name##_getxtn (qse_##name##_t* name);
|
||||
#define QSE_IMPLEMENT_COMMON_FUNCTIONS(name) \
|
||||
void qse_##name##_setmmgr (qse_##name##_t* name, qse_mmgr_t* mmgr) \
|
||||
{ \
|
||||
QSE_MMGR(name) = mmgr; \
|
||||
(name)->mmgr = mmgr; \
|
||||
} \
|
||||
qse_mmgr_t* qse_##name##_getmmgr (qse_##name##_t* name) \
|
||||
{ \
|
||||
return QSE_MMGR(name); \
|
||||
return (name)->mmgr; \
|
||||
} \
|
||||
void* qse_##name##_getxtn (qse_##name##_t* name) \
|
||||
{ \
|
||||
|
@ -71,7 +71,7 @@ struct qse_htrd_recbs_t
|
||||
|
||||
struct qse_htrd_t
|
||||
{
|
||||
QSE_DEFINE_COMMON_FIELDS (htrd)
|
||||
qse_mmgr_t* mmgr;
|
||||
qse_htrd_errnum_t errnum;
|
||||
int option;
|
||||
|
||||
@ -111,12 +111,10 @@ struct qse_htrd_t
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
QSE_DEFINE_COMMON_FUNCTIONS (htrd)
|
||||
|
||||
/**
|
||||
* The qse_htrd_open() function creates a htrd processor.
|
||||
*/
|
||||
qse_htrd_t* qse_htrd_open (
|
||||
QSE_EXPORT qse_htrd_t* qse_htrd_open (
|
||||
qse_mmgr_t* mmgr, /**< memory manager */
|
||||
qse_size_t xtnsize /**< extension size in bytes */
|
||||
);
|
||||
@ -124,37 +122,50 @@ qse_htrd_t* qse_htrd_open (
|
||||
/**
|
||||
* The qse_htrd_close() function destroys a htrd processor.
|
||||
*/
|
||||
void qse_htrd_close (
|
||||
QSE_EXPORT void qse_htrd_close (
|
||||
qse_htrd_t* htrd
|
||||
);
|
||||
|
||||
int qse_htrd_init (
|
||||
QSE_EXPORT int qse_htrd_init (
|
||||
qse_htrd_t* htrd,
|
||||
qse_mmgr_t* mmgr
|
||||
);
|
||||
|
||||
void qse_htrd_fini (
|
||||
QSE_EXPORT void qse_htrd_fini (
|
||||
qse_htrd_t* htrd
|
||||
);
|
||||
|
||||
void qse_htrd_clear (
|
||||
QSE_EXPORT void qse_htrd_setmmgr (
|
||||
qse_htrd_t* htrd,
|
||||
qse_mmgr_t* mmgr
|
||||
);
|
||||
|
||||
QSE_EXPORT qse_mmgr_t* qse_htrd_getmmgr (
|
||||
qse_htrd_t* htrd
|
||||
);
|
||||
|
||||
QSE_EXPORT void* qse_htrd_getxtn (
|
||||
qse_htrd_t* htrd
|
||||
);
|
||||
|
||||
int qse_htrd_getoption (
|
||||
QSE_EXPORT void qse_htrd_clear (
|
||||
qse_htrd_t* htrd
|
||||
);
|
||||
|
||||
QSE_EXPORT int qse_htrd_getoption (
|
||||
qse_htrd_t* htrd
|
||||
);
|
||||
|
||||
void qse_htrd_setoption (
|
||||
QSE_EXPORT void qse_htrd_setoption (
|
||||
qse_htrd_t* htrd,
|
||||
int opts
|
||||
);
|
||||
|
||||
const qse_htrd_recbs_t* qse_htrd_getrecbs (
|
||||
QSE_EXPORT const qse_htrd_recbs_t* qse_htrd_getrecbs (
|
||||
qse_htrd_t* htrd
|
||||
);
|
||||
|
||||
void qse_htrd_setrecbs (
|
||||
QSE_EXPORT void qse_htrd_setrecbs (
|
||||
qse_htrd_t* htrd,
|
||||
const qse_htrd_recbs_t* recbs
|
||||
);
|
||||
@ -163,7 +174,7 @@ void qse_htrd_setrecbs (
|
||||
* The qse_htrd_feed() function accepts htrd request octets and invokes a
|
||||
* callback function if it has processed a proper htrd request.
|
||||
*/
|
||||
int qse_htrd_feed (
|
||||
QSE_EXPORT int qse_htrd_feed (
|
||||
qse_htrd_t* htrd, /**< htrd */
|
||||
const qse_mchar_t* req, /**< request octets */
|
||||
qse_size_t len /**< number of octets */
|
||||
@ -174,11 +185,11 @@ int qse_htrd_feed (
|
||||
* if the current response should be processed until the
|
||||
* connection is closed.
|
||||
*/
|
||||
int qse_htrd_halt (
|
||||
QSE_EXPORT int qse_htrd_halt (
|
||||
qse_htrd_t* htrd
|
||||
);
|
||||
|
||||
int qse_htrd_scanqparam (
|
||||
QSE_EXPORT int qse_htrd_scanqparam (
|
||||
qse_htrd_t* http,
|
||||
const qse_mcstr_t* cstr
|
||||
);
|
||||
|
@ -151,48 +151,48 @@ typedef int (*qse_htre_header_walker_t) (
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int qse_htre_init (
|
||||
QSE_EXPORT int qse_htre_init (
|
||||
qse_htre_t* re,
|
||||
qse_mmgr_t* mmgr
|
||||
);
|
||||
|
||||
void qse_htre_fini (
|
||||
QSE_EXPORT void qse_htre_fini (
|
||||
qse_htre_t* re
|
||||
);
|
||||
|
||||
void qse_htre_clear (
|
||||
QSE_EXPORT void qse_htre_clear (
|
||||
qse_htre_t* re
|
||||
);
|
||||
|
||||
int qse_htre_setstrfromcstr (
|
||||
QSE_EXPORT int qse_htre_setstrfromcstr (
|
||||
qse_htre_t* re,
|
||||
qse_mbs_t* str,
|
||||
const qse_mcstr_t* cstr
|
||||
);
|
||||
|
||||
int qse_htre_setstrfromxstr (
|
||||
QSE_EXPORT int qse_htre_setstrfromxstr (
|
||||
qse_htre_t* re,
|
||||
qse_mbs_t* str,
|
||||
const qse_mxstr_t* xstr
|
||||
);
|
||||
|
||||
const qse_htre_hdrval_t* qse_htre_getheaderval (
|
||||
QSE_EXPORT const qse_htre_hdrval_t* qse_htre_getheaderval (
|
||||
const qse_htre_t* re,
|
||||
const qse_mchar_t* key
|
||||
);
|
||||
|
||||
const qse_htre_hdrval_t* qse_htre_gettrailerval (
|
||||
QSE_EXPORT const qse_htre_hdrval_t* qse_htre_gettrailerval (
|
||||
const qse_htre_t* re,
|
||||
const qse_mchar_t* key
|
||||
);
|
||||
|
||||
int qse_htre_walkheaders (
|
||||
QSE_EXPORT int qse_htre_walkheaders (
|
||||
qse_htre_t* re,
|
||||
qse_htre_header_walker_t walker,
|
||||
void* ctx
|
||||
);
|
||||
|
||||
int qse_htre_walktrailers (
|
||||
QSE_EXPORT int qse_htre_walktrailers (
|
||||
qse_htre_t* re,
|
||||
qse_htre_header_walker_t walker,
|
||||
void* ctx
|
||||
@ -205,25 +205,25 @@ int qse_htre_walktrailers (
|
||||
* content buffer.
|
||||
* @return 1 on success, -1 on failure, 0 if adding is skipped.
|
||||
*/
|
||||
int qse_htre_addcontent (
|
||||
QSE_EXPORT int qse_htre_addcontent (
|
||||
qse_htre_t* re,
|
||||
const qse_mchar_t* ptr,
|
||||
qse_size_t len
|
||||
);
|
||||
|
||||
void qse_htre_completecontent (
|
||||
QSE_EXPORT void qse_htre_completecontent (
|
||||
qse_htre_t* re
|
||||
);
|
||||
|
||||
void qse_htre_discardcontent (
|
||||
QSE_EXPORT void qse_htre_discardcontent (
|
||||
qse_htre_t* re
|
||||
);
|
||||
|
||||
void qse_htre_unsetconcb (
|
||||
QSE_EXPORT void qse_htre_unsetconcb (
|
||||
qse_htre_t* re
|
||||
);
|
||||
|
||||
void qse_htre_setconcb (
|
||||
QSE_EXPORT void qse_htre_setconcb (
|
||||
qse_htre_t* re,
|
||||
qse_htre_concb_t concb,
|
||||
void* ctx
|
||||
|
@ -158,57 +158,57 @@ typedef struct qse_http_range_t qse_http_range_t;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int qse_comparehttpversions (
|
||||
QSE_EXPORT int qse_comparehttpversions (
|
||||
const qse_http_version_t* v1,
|
||||
const qse_http_version_t* v2
|
||||
);
|
||||
|
||||
const qse_mchar_t* qse_httpstatustombs (
|
||||
QSE_EXPORT const qse_mchar_t* qse_httpstatustombs (
|
||||
int code
|
||||
);
|
||||
|
||||
const qse_mchar_t* qse_httpmethodtombs (
|
||||
QSE_EXPORT const qse_mchar_t* qse_httpmethodtombs (
|
||||
qse_http_method_t type
|
||||
);
|
||||
|
||||
qse_http_method_t qse_mbstohttpmethod (
|
||||
QSE_EXPORT qse_http_method_t qse_mbstohttpmethod (
|
||||
const qse_mchar_t* name
|
||||
);
|
||||
|
||||
qse_http_method_t qse_mcstrtohttpmethod (
|
||||
QSE_EXPORT qse_http_method_t qse_mcstrtohttpmethod (
|
||||
const qse_mcstr_t* name
|
||||
);
|
||||
|
||||
int qse_parsehttprange (
|
||||
QSE_EXPORT int qse_parsehttprange (
|
||||
const qse_mchar_t* str,
|
||||
qse_http_range_t* range
|
||||
);
|
||||
|
||||
int qse_parsehttptime (
|
||||
QSE_EXPORT int qse_parsehttptime (
|
||||
const qse_mchar_t* str,
|
||||
qse_ntime_t* nt
|
||||
);
|
||||
|
||||
qse_mchar_t* qse_fmthttptime (
|
||||
QSE_EXPORT qse_mchar_t* qse_fmthttptime (
|
||||
qse_ntime_t nt,
|
||||
qse_mchar_t* buf,
|
||||
qse_size_t bufsz
|
||||
);
|
||||
|
||||
/* percent-decode a string */
|
||||
qse_size_t qse_perdechttpstr (
|
||||
QSE_EXPORT qse_size_t qse_perdechttpstr (
|
||||
const qse_mchar_t* str,
|
||||
qse_mchar_t* buf
|
||||
);
|
||||
|
||||
|
||||
/* percent-encode a string */
|
||||
qse_size_t qse_perenchttpstr (
|
||||
QSE_EXPORT qse_size_t qse_perenchttpstr (
|
||||
const qse_mchar_t* str,
|
||||
qse_mchar_t* buf
|
||||
);
|
||||
|
||||
qse_mchar_t* qse_perenchttpstrdup (
|
||||
QSE_EXPORT qse_mchar_t* qse_perenchttpstrdup (
|
||||
const qse_mchar_t* str,
|
||||
qse_mmgr_t* mmgr
|
||||
);
|
||||
|
@ -508,12 +508,10 @@ typedef enum qse_httpd_server_optstd_t qse_httpd_server_optstd_t;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
QSE_DEFINE_COMMON_FUNCTIONS (httpd)
|
||||
|
||||
/**
|
||||
* The qse_httpd_open() function creates a httpd processor.
|
||||
*/
|
||||
qse_httpd_t* qse_httpd_open (
|
||||
QSE_EXPORT qse_httpd_t* qse_httpd_open (
|
||||
qse_mmgr_t* mmgr, /**< memory manager */
|
||||
qse_size_t xtnsize /**< extension size in bytes */
|
||||
);
|
||||
@ -521,24 +519,37 @@ qse_httpd_t* qse_httpd_open (
|
||||
/**
|
||||
* The qse_httpd_close() function destroys a httpd processor.
|
||||
*/
|
||||
void qse_httpd_close (
|
||||
QSE_EXPORT void qse_httpd_close (
|
||||
qse_httpd_t* httpd
|
||||
);
|
||||
|
||||
qse_httpd_errnum_t qse_httpd_geterrnum (
|
||||
QSE_EXPORT void qse_httpd_setmmgr (
|
||||
qse_httpd_t* httpd,
|
||||
qse_mmgr_t* mmgr
|
||||
);
|
||||
|
||||
QSE_EXPORT qse_mmgr_t* qse_httpd_getmmgr (
|
||||
qse_httpd_t* httpd
|
||||
);
|
||||
|
||||
QSE_EXPORT void* qse_httpd_getxtn (
|
||||
qse_httpd_t* httpd
|
||||
);
|
||||
|
||||
void qse_httpd_seterrnum (
|
||||
QSE_EXPORT qse_httpd_errnum_t qse_httpd_geterrnum (
|
||||
qse_httpd_t* httpd
|
||||
);
|
||||
|
||||
QSE_EXPORT void qse_httpd_seterrnum (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_errnum_t errnum
|
||||
);
|
||||
|
||||
int qse_httpd_getoption (
|
||||
QSE_EXPORT int qse_httpd_getoption (
|
||||
qse_httpd_t* httpd
|
||||
);
|
||||
|
||||
void qse_httpd_setoption (
|
||||
QSE_EXPORT void qse_httpd_setoption (
|
||||
qse_httpd_t* httpd,
|
||||
int option
|
||||
);
|
||||
@ -548,14 +559,14 @@ void qse_httpd_setoption (
|
||||
* and returns the pointer to it. If no callback set can be popped,
|
||||
* it returns #QSE_NULL.
|
||||
*/
|
||||
qse_httpd_ecb_t* qse_httpd_popecb (
|
||||
QSE_EXPORT qse_httpd_ecb_t* qse_httpd_popecb (
|
||||
qse_httpd_t* httpd /**< httpd */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_httpd_pushecb() function register a runtime callback set.
|
||||
*/
|
||||
void qse_httpd_pushecb (
|
||||
QSE_EXPORT void qse_httpd_pushecb (
|
||||
qse_httpd_t* httpd, /**< httpd */
|
||||
qse_httpd_ecb_t* ecb /**< callback set */
|
||||
);
|
||||
@ -563,7 +574,7 @@ void qse_httpd_pushecb (
|
||||
/**
|
||||
* The qse_httpd_loop() function starts a httpd server loop.
|
||||
*/
|
||||
int qse_httpd_loop (
|
||||
QSE_EXPORT int qse_httpd_loop (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_scb_t* scb,
|
||||
qse_httpd_rcb_t* rcb,
|
||||
@ -573,30 +584,30 @@ int qse_httpd_loop (
|
||||
/**
|
||||
* The qse_httpd_stop() function requests to stop qse_httpd_loop()
|
||||
*/
|
||||
void qse_httpd_stop (
|
||||
QSE_EXPORT void qse_httpd_stop (
|
||||
qse_httpd_t* httpd
|
||||
);
|
||||
|
||||
#define qse_httpd_getserverxtn(httpd,server) ((void*)(server+1))
|
||||
|
||||
qse_httpd_server_t* qse_httpd_attachserver (
|
||||
QSE_EXPORT qse_httpd_server_t* qse_httpd_attachserver (
|
||||
qse_httpd_t* httpd,
|
||||
const qse_httpd_server_t* tmpl,
|
||||
qse_httpd_server_predetach_t predetach,
|
||||
qse_size_t xtnsize
|
||||
);
|
||||
|
||||
void qse_httpd_detachserver (
|
||||
QSE_EXPORT void qse_httpd_detachserver (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_server_t* server
|
||||
);
|
||||
|
||||
void qse_httpd_discardcontent (
|
||||
QSE_EXPORT void qse_httpd_discardcontent (
|
||||
qse_httpd_t* httpd,
|
||||
qse_htre_t* req
|
||||
);
|
||||
|
||||
void qse_httpd_completecontent (
|
||||
QSE_EXPORT void qse_httpd_completecontent (
|
||||
qse_httpd_t* httpd,
|
||||
qse_htre_t* req
|
||||
);
|
||||
@ -606,7 +617,7 @@ void qse_httpd_completecontent (
|
||||
* The qse_httpd_setname() function changes the string
|
||||
* to be used as the value for the server header.
|
||||
*/
|
||||
void qse_httpd_setname (
|
||||
QSE_EXPORT void qse_httpd_setname (
|
||||
qse_httpd_t* httpd,
|
||||
const qse_mchar_t* name
|
||||
);
|
||||
@ -617,7 +628,7 @@ void qse_httpd_setname (
|
||||
* pointer to the string used as the value for the server
|
||||
* header.
|
||||
*/
|
||||
qse_mchar_t* qse_httpd_getname (
|
||||
QSE_EXPORT qse_mchar_t* qse_httpd_getname (
|
||||
qse_httpd_t* httpd
|
||||
);
|
||||
|
||||
@ -626,7 +637,7 @@ qse_mchar_t* qse_httpd_getname (
|
||||
* to a string and stores it in a built-in buffer.
|
||||
* If @a nt is QSE_NULL, the current time is used.
|
||||
*/
|
||||
const qse_mchar_t* qse_httpd_fmtgmtimetobb (
|
||||
QSE_EXPORT const qse_mchar_t* qse_httpd_fmtgmtimetobb (
|
||||
qse_httpd_t* httpd,
|
||||
const qse_ntime_t* nt,
|
||||
int idx
|
||||
@ -634,7 +645,7 @@ const qse_mchar_t* qse_httpd_fmtgmtimetobb (
|
||||
|
||||
#define qse_httpd_gettaskxtn(httpd,task) ((void*)(task+1))
|
||||
|
||||
qse_httpd_task_t* qse_httpd_entask (
|
||||
QSE_EXPORT qse_httpd_task_t* qse_httpd_entask (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_client_t* client,
|
||||
qse_httpd_task_t* pred,
|
||||
@ -644,14 +655,14 @@ qse_httpd_task_t* qse_httpd_entask (
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
qse_httpd_task_t* qse_httpd_entaskdisconnect (
|
||||
QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskdisconnect (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_client_t* client,
|
||||
qse_httpd_task_t* pred
|
||||
);
|
||||
|
||||
|
||||
qse_httpd_task_t* qse_httpd_entaskformat (
|
||||
QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskformat (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_client_t* client,
|
||||
qse_httpd_task_t* pred,
|
||||
@ -661,7 +672,7 @@ qse_httpd_task_t* qse_httpd_entaskformat (
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
qse_httpd_task_t* qse_httpd_entasktext (
|
||||
QSE_EXPORT qse_httpd_task_t* qse_httpd_entasktext (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_client_t* client,
|
||||
qse_httpd_task_t* pred,
|
||||
@ -670,7 +681,7 @@ qse_httpd_task_t* qse_httpd_entasktext (
|
||||
qse_htre_t* req
|
||||
);
|
||||
|
||||
qse_httpd_task_t* qse_httpd_entaskerr (
|
||||
QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskerr (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_client_t* client,
|
||||
qse_httpd_task_t* pred,
|
||||
@ -678,7 +689,7 @@ qse_httpd_task_t* qse_httpd_entaskerr (
|
||||
qse_htre_t* req
|
||||
);
|
||||
|
||||
qse_httpd_task_t* qse_httpd_entaskcontinue (
|
||||
QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskcontinue (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_client_t* client,
|
||||
qse_httpd_task_t* pred,
|
||||
@ -688,7 +699,7 @@ qse_httpd_task_t* qse_httpd_entaskcontinue (
|
||||
/**
|
||||
* The qse_httpd_entaskauth() function adds a basic authorization task.
|
||||
*/
|
||||
qse_httpd_task_t* qse_httpd_entaskauth (
|
||||
QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskauth (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_client_t* client,
|
||||
qse_httpd_task_t* pred,
|
||||
@ -696,7 +707,7 @@ qse_httpd_task_t* qse_httpd_entaskauth (
|
||||
qse_htre_t* req
|
||||
);
|
||||
|
||||
qse_httpd_task_t* qse_httpd_entaskreloc (
|
||||
QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskreloc (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_client_t* client,
|
||||
qse_httpd_task_t* pred,
|
||||
@ -704,7 +715,7 @@ qse_httpd_task_t* qse_httpd_entaskreloc (
|
||||
qse_htre_t* req
|
||||
);
|
||||
|
||||
qse_httpd_task_t* qse_httpd_entaskredir (
|
||||
QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskredir (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_client_t* client,
|
||||
qse_httpd_task_t* pred,
|
||||
@ -713,14 +724,14 @@ qse_httpd_task_t* qse_httpd_entaskredir (
|
||||
);
|
||||
|
||||
|
||||
qse_httpd_task_t* qse_httpd_entasknomod (
|
||||
QSE_EXPORT qse_httpd_task_t* qse_httpd_entasknomod (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_client_t* client,
|
||||
qse_httpd_task_t* pred,
|
||||
qse_htre_t* req
|
||||
);
|
||||
|
||||
qse_httpd_task_t* qse_httpd_entaskdir (
|
||||
QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskdir (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_client_t* client,
|
||||
qse_httpd_task_t* pred,
|
||||
@ -728,7 +739,7 @@ qse_httpd_task_t* qse_httpd_entaskdir (
|
||||
qse_htre_t* req
|
||||
);
|
||||
|
||||
qse_httpd_task_t* qse_httpd_entaskfile (
|
||||
QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskfile (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_client_t* client,
|
||||
qse_httpd_task_t* pred,
|
||||
@ -737,7 +748,7 @@ qse_httpd_task_t* qse_httpd_entaskfile (
|
||||
qse_htre_t* req
|
||||
);
|
||||
|
||||
qse_httpd_task_t* qse_httpd_entaskcgi (
|
||||
QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskcgi (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_client_t* client,
|
||||
qse_httpd_task_t* pred,
|
||||
@ -749,7 +760,7 @@ qse_httpd_task_t* qse_httpd_entaskcgi (
|
||||
qse_htre_t* req
|
||||
);
|
||||
|
||||
qse_httpd_task_t* qse_httpd_entaskproxy (
|
||||
QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskproxy (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_client_t* client,
|
||||
qse_httpd_task_t* pred,
|
||||
@ -760,7 +771,7 @@ qse_httpd_task_t* qse_httpd_entaskproxy (
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
qse_httpd_task_t* qse_httpd_entaskrsrc (
|
||||
QSE_EXPORT qse_httpd_task_t* qse_httpd_entaskrsrc (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_client_t* client,
|
||||
qse_httpd_task_t* pred,
|
||||
@ -770,64 +781,64 @@ qse_httpd_task_t* qse_httpd_entaskrsrc (
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
void* qse_httpd_allocmem (
|
||||
QSE_EXPORT void* qse_httpd_allocmem (
|
||||
qse_httpd_t* httpd,
|
||||
qse_size_t size
|
||||
);
|
||||
|
||||
void* qse_httpd_reallocmem (
|
||||
QSE_EXPORT void* qse_httpd_reallocmem (
|
||||
qse_httpd_t* httpd,
|
||||
void* ptr,
|
||||
qse_size_t size
|
||||
);
|
||||
|
||||
void qse_httpd_freemem (
|
||||
QSE_EXPORT void qse_httpd_freemem (
|
||||
qse_httpd_t* httpd,
|
||||
void* ptr
|
||||
);
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
qse_httpd_t* qse_httpd_openstd (
|
||||
QSE_EXPORT qse_httpd_t* qse_httpd_openstd (
|
||||
qse_size_t xtnsize
|
||||
);
|
||||
|
||||
qse_httpd_t* qse_httpd_openstdwithmmgr (
|
||||
QSE_EXPORT qse_httpd_t* qse_httpd_openstdwithmmgr (
|
||||
qse_mmgr_t* mmgr,
|
||||
qse_size_t xtnsize
|
||||
);
|
||||
|
||||
void* qse_httpd_getxtnstd (
|
||||
QSE_EXPORT void* qse_httpd_getxtnstd (
|
||||
qse_httpd_t* httpd
|
||||
);
|
||||
|
||||
qse_httpd_server_t* qse_httpd_attachserverstd (
|
||||
QSE_EXPORT qse_httpd_server_t* qse_httpd_attachserverstd (
|
||||
qse_httpd_t* httpd,
|
||||
const qse_char_t* uri,
|
||||
qse_httpd_server_predetach_t predetach,
|
||||
qse_size_t xtnsize
|
||||
);
|
||||
|
||||
int qse_httpd_getserveroptstd (
|
||||
QSE_EXPORT int qse_httpd_getserveroptstd (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_server_t* server,
|
||||
qse_httpd_server_optstd_t id,
|
||||
void* value
|
||||
);
|
||||
|
||||
int qse_httpd_setserveroptstd (
|
||||
QSE_EXPORT int qse_httpd_setserveroptstd (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_server_t* server,
|
||||
qse_httpd_server_optstd_t id,
|
||||
const void* value
|
||||
);
|
||||
|
||||
void* qse_httpd_getserverxtnstd (
|
||||
QSE_EXPORT void* qse_httpd_getserverxtnstd (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_server_t* server
|
||||
);
|
||||
|
||||
int qse_httpd_loopstd (
|
||||
QSE_EXPORT int qse_httpd_loopstd (
|
||||
qse_httpd_t* httpd,
|
||||
qse_ntime_t timeout
|
||||
);
|
||||
|
@ -134,93 +134,104 @@ typedef struct qse_upxd_cbs_t qse_upxd_cbs_t;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
QSE_DEFINE_COMMON_FUNCTIONS (upxd)
|
||||
|
||||
qse_upxd_t* qse_upxd_open (
|
||||
QSE_EXPORT qse_upxd_t* qse_upxd_open (
|
||||
qse_mmgr_t* mmgr, /**< memory manager */
|
||||
qse_size_t xtnsize /**< extension size in bytes */
|
||||
);
|
||||
|
||||
void qse_upxd_close (
|
||||
QSE_EXPORT void qse_upxd_close (
|
||||
qse_upxd_t* upxd
|
||||
);
|
||||
|
||||
qse_upxd_errnum_t qse_upxd_geterrnum (
|
||||
QSE_EXPORT qse_upxd_errnum_t qse_upxd_geterrnum (
|
||||
qse_upxd_t* upxd
|
||||
);
|
||||
|
||||
void qse_upxd_seterrnum (
|
||||
QSE_EXPORT void qse_upxd_seterrnum (
|
||||
qse_upxd_t* upxd,
|
||||
qse_upxd_errnum_t errnum
|
||||
);
|
||||
|
||||
qse_upxd_cbs_t* qse_upxd_getcbs (
|
||||
QSE_EXPORT void qse_upxd_setmmgr (
|
||||
qse_upxd_t* upxd,
|
||||
qse_mmgr_t* mmgr
|
||||
);
|
||||
|
||||
QSE_EXPORT qse_mmgr_t* qse_upxd_getmmgr (
|
||||
qse_upxd_t* upxd
|
||||
);
|
||||
|
||||
QSE_EXPORT void* qse_upxd_getxtn (
|
||||
qse_upxd_t* upxd
|
||||
);
|
||||
|
||||
void qse_upxd_setcbs (
|
||||
QSE_EXPORT qse_upxd_cbs_t* qse_upxd_getcbs (
|
||||
qse_upxd_t* upxd
|
||||
);
|
||||
|
||||
QSE_EXPORT void qse_upxd_setcbs (
|
||||
qse_upxd_t* upxd,
|
||||
qse_upxd_cbs_t* cbs
|
||||
);
|
||||
|
||||
void* qse_upxd_allocmem (
|
||||
QSE_EXPORT void* qse_upxd_allocmem (
|
||||
qse_upxd_t* upxd,
|
||||
qse_size_t size
|
||||
);
|
||||
|
||||
void* qse_upxd_reallocmem (
|
||||
QSE_EXPORT void* qse_upxd_reallocmem (
|
||||
qse_upxd_t* upxd,
|
||||
void* ptr,
|
||||
qse_size_t size
|
||||
);
|
||||
|
||||
void qse_upxd_freemem (
|
||||
QSE_EXPORT void qse_upxd_freemem (
|
||||
qse_upxd_t* upxd,
|
||||
void* ptr
|
||||
);
|
||||
|
||||
qse_upxd_server_t* qse_upxd_addserver (
|
||||
QSE_EXPORT qse_upxd_server_t* qse_upxd_addserver (
|
||||
qse_upxd_t* upxd,
|
||||
const qse_nwad_t* nwad,
|
||||
const qse_char_t* dev
|
||||
);
|
||||
|
||||
void qse_upxd_delserver (
|
||||
QSE_EXPORT void qse_upxd_delserver (
|
||||
qse_upxd_t* upxd,
|
||||
qse_upxd_server_t* server
|
||||
);
|
||||
|
||||
void* qse_upxd_getserverctx (
|
||||
QSE_EXPORT void* qse_upxd_getserverctx (
|
||||
qse_upxd_t* upxd,
|
||||
qse_upxd_server_t* server
|
||||
);
|
||||
|
||||
void qse_upxd_setserverctx (
|
||||
QSE_EXPORT void qse_upxd_setserverctx (
|
||||
qse_upxd_t* upxd,
|
||||
qse_upxd_server_t* server,
|
||||
void* ctx
|
||||
);
|
||||
|
||||
void qse_upxd_stop (
|
||||
QSE_EXPORT void qse_upxd_stop (
|
||||
qse_upxd_t* upxd
|
||||
);
|
||||
|
||||
int qse_upxd_loop (
|
||||
QSE_EXPORT int qse_upxd_loop (
|
||||
qse_upxd_t* upxd,
|
||||
qse_ntime_t timeout
|
||||
);
|
||||
|
||||
int qse_upxd_enableserver (
|
||||
QSE_EXPORT int qse_upxd_enableserver (
|
||||
qse_upxd_t* upxd,
|
||||
qse_upxd_server_t* server
|
||||
);
|
||||
|
||||
int qse_upxd_disableserver (
|
||||
QSE_EXPORT int qse_upxd_disableserver (
|
||||
qse_upxd_t* upxd,
|
||||
qse_upxd_server_t* server
|
||||
);
|
||||
|
||||
int qse_upxd_poll (
|
||||
QSE_EXPORT int qse_upxd_poll (
|
||||
qse_upxd_t* upxd,
|
||||
qse_ntime_t timeout
|
||||
);
|
||||
|
@ -392,20 +392,17 @@ typedef void (*qse_sed_exec_tracer_t) (
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
QSE_DEFINE_COMMON_FUNCTIONS (sed)
|
||||
|
||||
/**
|
||||
* The qse_sed_open() function creates a stream editor object. A memory
|
||||
* manager provided is used to allocate and destory the object and any dynamic
|
||||
* data through out its lifetime. An extension area is allocated if an
|
||||
* extension size greater than 0 is specified. You can access it with the
|
||||
* qse_sed_getxtn() function and use it to store arbitrary data associated
|
||||
* with the object. See #QSE_DEFINE_COMMON_FUNCTIONS() for qse_sed_getxtn().
|
||||
* When done, you should destroy the object with the qse_sed_close() function
|
||||
* to avoid any resource leaks including memory.
|
||||
* with the object. When done, you should destroy the object with the
|
||||
* qse_sed_close() function to avoid any resource leaks including memory.
|
||||
* @return pointer to a stream editor on success, QSE_NULL on failure
|
||||
*/
|
||||
qse_sed_t* qse_sed_open (
|
||||
QSE_EXPORT qse_sed_t* qse_sed_open (
|
||||
qse_mmgr_t* mmgr, /**< memory manager */
|
||||
qse_size_t xtnsize /**< extension size in bytes */
|
||||
);
|
||||
@ -413,23 +410,36 @@ qse_sed_t* qse_sed_open (
|
||||
/**
|
||||
* The qse_sed_close() function destroys a stream editor.
|
||||
*/
|
||||
void qse_sed_close (
|
||||
QSE_EXPORT void qse_sed_close (
|
||||
qse_sed_t* sed /**< stream editor */
|
||||
);
|
||||
|
||||
QSE_EXPORT void qse_sed_setmmgr (
|
||||
qse_sed_t* sed,
|
||||
qse_mmgr_t* mmgr
|
||||
);
|
||||
|
||||
QSE_EXPORT qse_mmgr_t* qse_sed_getmmgr (
|
||||
qse_sed_t* sed
|
||||
);
|
||||
|
||||
QSE_EXPORT void* qse_sed_getxtn (
|
||||
qse_sed_t* sed
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_sed_getoption() function retrieves the current options set in
|
||||
* a stream editor.
|
||||
* @return 0 or a number OR'ed of #qse_sed_option_t values
|
||||
*/
|
||||
int qse_sed_getoption (
|
||||
QSE_EXPORT int qse_sed_getoption (
|
||||
const qse_sed_t* sed /**< stream editor */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_sed_setoption() function sets the option code.
|
||||
*/
|
||||
void qse_sed_setoption (
|
||||
QSE_EXPORT void qse_sed_setoption (
|
||||
qse_sed_t* sed, /**< stream editor */
|
||||
int opt /**< 0 or a number OR'ed of #qse_sed_option_t values */
|
||||
);
|
||||
@ -437,7 +447,7 @@ void qse_sed_setoption (
|
||||
/**
|
||||
* The qse_sed_geterrstr() gets an error string getter.
|
||||
*/
|
||||
qse_sed_errstr_t qse_sed_geterrstr (
|
||||
QSE_EXPORT qse_sed_errstr_t qse_sed_geterrstr (
|
||||
const qse_sed_t* sed /**< stream editor */
|
||||
);
|
||||
|
||||
@ -465,7 +475,7 @@ qse_sed_errstr_t qse_sed_geterrstr (
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
void qse_sed_seterrstr (
|
||||
QSE_EXPORT void qse_sed_seterrstr (
|
||||
qse_sed_t* sed, /**< stream editor */
|
||||
qse_sed_errstr_t errstr /**< an error string getter */
|
||||
);
|
||||
@ -474,7 +484,7 @@ void qse_sed_seterrstr (
|
||||
* The qse_sed_geterrnum() function gets the number of the last error.
|
||||
* @return the number of the last error
|
||||
*/
|
||||
qse_sed_errnum_t qse_sed_geterrnum (
|
||||
QSE_EXPORT qse_sed_errnum_t qse_sed_geterrnum (
|
||||
const qse_sed_t* sed /**< stream editor */
|
||||
);
|
||||
|
||||
@ -483,7 +493,7 @@ qse_sed_errnum_t qse_sed_geterrnum (
|
||||
* has occurred.
|
||||
* @return error location
|
||||
*/
|
||||
const qse_sed_loc_t* qse_sed_geterrloc (
|
||||
QSE_EXPORT const qse_sed_loc_t* qse_sed_geterrloc (
|
||||
const qse_sed_t* sed /**< stream editor */
|
||||
);
|
||||
|
||||
@ -491,7 +501,7 @@ const qse_sed_loc_t* qse_sed_geterrloc (
|
||||
* The qse_sed_geterrmsg() function gets a string describing the last error.
|
||||
* @return a pointer to an error message
|
||||
*/
|
||||
const qse_char_t* qse_sed_geterrmsg (
|
||||
QSE_EXPORT const qse_char_t* qse_sed_geterrmsg (
|
||||
const qse_sed_t* sed /**< stream editor */
|
||||
);
|
||||
|
||||
@ -500,7 +510,7 @@ const qse_char_t* qse_sed_geterrmsg (
|
||||
* and an error message. The information is set to the memory area pointed
|
||||
* to by each parameter.
|
||||
*/
|
||||
void qse_sed_geterror (
|
||||
QSE_EXPORT void qse_sed_geterror (
|
||||
const qse_sed_t* sed, /**< stream editor */
|
||||
qse_sed_errnum_t* errnum, /**< error number */
|
||||
const qse_char_t** errmsg, /**< error message */
|
||||
@ -511,7 +521,7 @@ void qse_sed_geterror (
|
||||
* The qse_sed_seterrnum() function sets error information omitting error
|
||||
* location.
|
||||
*/
|
||||
void qse_sed_seterrnum (
|
||||
QSE_EXPORT void qse_sed_seterrnum (
|
||||
qse_sed_t* sed, /**< stream editor */
|
||||
qse_sed_errnum_t errnum, /**< error number */
|
||||
const qse_cstr_t* errarg /**< argument for formatting error message */
|
||||
@ -521,7 +531,7 @@ void qse_sed_seterrnum (
|
||||
* The qse_sed_seterrmsg() function sets error information with a customized
|
||||
* message for a given error number.
|
||||
*/
|
||||
void qse_sed_seterrmsg (
|
||||
QSE_EXPORT void qse_sed_seterrmsg (
|
||||
qse_sed_t* sed, /**< stream editor */
|
||||
qse_sed_errnum_t errnum, /**< error number */
|
||||
const qse_char_t* errmsg, /**< error message */
|
||||
@ -533,7 +543,7 @@ void qse_sed_seterrmsg (
|
||||
* an error message. An error string is composed of a formatting string
|
||||
* and an array of formatting parameters.
|
||||
*/
|
||||
void qse_sed_seterror (
|
||||
QSE_EXPORT void qse_sed_seterror (
|
||||
qse_sed_t* sed, /**< stream editor */
|
||||
qse_sed_errnum_t errnum, /**< error number */
|
||||
const qse_cstr_t* errarg, /**< array of arguments for formatting
|
||||
@ -546,14 +556,14 @@ void qse_sed_seterror (
|
||||
* and returns the pointer to it. If no callback set can be popped,
|
||||
* it returns #QSE_NULL.
|
||||
*/
|
||||
qse_sed_ecb_t* qse_sed_popecb (
|
||||
QSE_EXPORT qse_sed_ecb_t* qse_sed_popecb (
|
||||
qse_sed_t* sed /**< sed */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_sed_pushecb() function register a runtime callback set.
|
||||
*/
|
||||
void qse_sed_pushecb (
|
||||
QSE_EXPORT void qse_sed_pushecb (
|
||||
qse_sed_t* sed, /**< sed */
|
||||
qse_sed_ecb_t* ecb /**< callback set */
|
||||
);
|
||||
@ -562,7 +572,7 @@ void qse_sed_pushecb (
|
||||
* The qse_sed_comp() function compiles editing commands into an internal form.
|
||||
* @return 0 on success, -1 on error
|
||||
*/
|
||||
int qse_sed_comp (
|
||||
QSE_EXPORT int qse_sed_comp (
|
||||
qse_sed_t* sed, /**< stream editor */
|
||||
qse_sed_io_impl_t inf /**< script stream reader */
|
||||
);
|
||||
@ -571,7 +581,7 @@ int qse_sed_comp (
|
||||
* The qse_sed_exec() function executes the compiled commands.
|
||||
* @return 0 on success, -1 on error
|
||||
*/
|
||||
int qse_sed_exec (
|
||||
QSE_EXPORT int qse_sed_exec (
|
||||
qse_sed_t* sed, /**< stream editor */
|
||||
qse_sed_io_impl_t inf, /**< stream reader */
|
||||
qse_sed_io_impl_t outf /**< stream writer */
|
||||
@ -581,14 +591,14 @@ int qse_sed_exec (
|
||||
* The qse_sed_stop() function breaks running loop in qse_sed_exec().
|
||||
* It doesn't affect blocking calls in stream handlers.
|
||||
*/
|
||||
void qse_sed_stop (
|
||||
QSE_EXPORT void qse_sed_stop (
|
||||
qse_sed_t* sed /**< stream editor */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_sed_isstop() functions tests if qse_sed_stop() is called.
|
||||
*/
|
||||
int qse_sed_isstop (
|
||||
QSE_EXPORT int qse_sed_isstop (
|
||||
qse_sed_t* sed /**< stream editor */
|
||||
);
|
||||
|
||||
@ -596,7 +606,7 @@ int qse_sed_isstop (
|
||||
* The qse_sed_getlformatter() function gets the text formatter for the 'l'
|
||||
* command.
|
||||
*/
|
||||
qse_sed_lformatter_t qse_sed_getlformatter (
|
||||
QSE_EXPORT qse_sed_lformatter_t qse_sed_getlformatter (
|
||||
qse_sed_t* sed /**< stream editor */
|
||||
);
|
||||
|
||||
@ -605,7 +615,7 @@ qse_sed_lformatter_t qse_sed_getlformatter (
|
||||
* command. The text formatter must output the text with a character writer
|
||||
* provided and return -1 on failure and 0 on success.
|
||||
*/
|
||||
void qse_sed_setlformatter (
|
||||
QSE_EXPORT void qse_sed_setlformatter (
|
||||
qse_sed_t* sed, /**< stream editor */
|
||||
qse_sed_lformatter_t lformatter /**< text formatter */
|
||||
);
|
||||
@ -614,7 +624,7 @@ void qse_sed_setlformatter (
|
||||
* The qse_sed_getcompid() function returns the latest
|
||||
* identifier successfully set with qse_sed_setcompid().
|
||||
*/
|
||||
const qse_char_t* qse_sed_getcompid (
|
||||
QSE_EXPORT const qse_char_t* qse_sed_getcompid (
|
||||
qse_sed_t* sed
|
||||
);
|
||||
|
||||
@ -627,7 +637,7 @@ const qse_char_t* qse_sed_getcompid (
|
||||
* If this function fails, the location set in the command
|
||||
* may be wrong.
|
||||
*/
|
||||
const qse_char_t* qse_sed_setcompid (
|
||||
QSE_EXPORT const qse_char_t* qse_sed_setcompid (
|
||||
qse_sed_t* sed,
|
||||
const qse_char_t* id
|
||||
);
|
||||
@ -636,14 +646,14 @@ const qse_char_t* qse_sed_setcompid (
|
||||
* The qse_sed_getlinnum() function gets the current input line number.
|
||||
* @return current input line number
|
||||
*/
|
||||
qse_size_t qse_sed_getlinenum (
|
||||
QSE_EXPORT qse_size_t qse_sed_getlinenum (
|
||||
qse_sed_t* sed /**< stream editor */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_sed_setlinenum() function changes the current input line number.
|
||||
*/
|
||||
void qse_sed_setlinenum (
|
||||
QSE_EXPORT void qse_sed_setlinenum (
|
||||
qse_sed_t* sed, /**< stream editor */
|
||||
qse_size_t num /**< a line number */
|
||||
);
|
||||
@ -653,7 +663,7 @@ void qse_sed_setlinenum (
|
||||
* The qse_sed_getexectracer() function returns the execution tracer
|
||||
* function.
|
||||
*/
|
||||
qse_sed_exec_tracer_t qse_sed_getexectracer (
|
||||
QSE_EXPORT qse_sed_exec_tracer_t qse_sed_getexectracer (
|
||||
qse_sed_t* sed
|
||||
);
|
||||
|
||||
@ -661,7 +671,7 @@ qse_sed_exec_tracer_t qse_sed_getexectracer (
|
||||
* The qse_sed_getexectracer() function sets a hook function via which
|
||||
* you can trace commands being executed.
|
||||
*/
|
||||
void qse_sed_setexectracer (
|
||||
QSE_EXPORT void qse_sed_setexectracer (
|
||||
qse_sed_t* sed,
|
||||
qse_sed_exec_tracer_t tracer
|
||||
);
|
||||
|
@ -73,7 +73,7 @@ extern "C" {
|
||||
* to get the pointer to the extension area.
|
||||
* @return pointer to a stream editor on success, #QSE_NULL on failure.
|
||||
*/
|
||||
qse_sed_t* qse_sed_openstd (
|
||||
QSE_EXPORT qse_sed_t* qse_sed_openstd (
|
||||
qse_size_t xtnsize /**< extension size in bytes */
|
||||
);
|
||||
|
||||
@ -84,7 +84,7 @@ qse_sed_t* qse_sed_openstd (
|
||||
* not qse_getxtn() to get the pointer to the extension area.
|
||||
* @return pointer to a stream editor on success, #QSE_NULL on failure.
|
||||
*/
|
||||
qse_sed_t* qse_sed_openstdwithmmgr (
|
||||
QSE_EXPORT qse_sed_t* qse_sed_openstdwithmmgr (
|
||||
qse_mmgr_t* mmgr, /**< memory manager */
|
||||
qse_size_t xtnsize /**< extension size in bytes */
|
||||
);
|
||||
@ -94,7 +94,7 @@ qse_sed_t* qse_sed_openstdwithmmgr (
|
||||
* Note that you must not call qse_sed_getxtn() for a stream editor
|
||||
* created with qse_sed_openstd() and qse_sed_openstdwithmmgr().
|
||||
*/
|
||||
void* qse_sed_getxtnstd (
|
||||
QSE_EXPORT void* qse_sed_getxtnstd (
|
||||
qse_sed_t* sed /**< stream editor */
|
||||
);
|
||||
|
||||
@ -109,7 +109,7 @@ void* qse_sed_getxtnstd (
|
||||
*
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int qse_sed_compstd (
|
||||
QSE_EXPORT int qse_sed_compstd (
|
||||
qse_sed_t* sed, /**< stream editor */
|
||||
qse_sed_iostd_t in[], /**< input scripts */
|
||||
qse_size_t* count /**< number of input scripts opened */
|
||||
@ -125,7 +125,7 @@ int qse_sed_compstd (
|
||||
* the default interface. It calls cmgr->mbtowc() for conversion.
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int qse_sed_compstdfile (
|
||||
QSE_EXPORT int qse_sed_compstdfile (
|
||||
qse_sed_t* sed,
|
||||
const qse_char_t* infile,
|
||||
qse_cmgr_t* cmgr
|
||||
@ -136,7 +136,7 @@ int qse_sed_compstdfile (
|
||||
* in a null-terminated string pointed to by @a script.
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int qse_sed_compstdstr (
|
||||
QSE_EXPORT int qse_sed_compstdstr (
|
||||
qse_sed_t* sed,
|
||||
const qse_char_t* script
|
||||
);
|
||||
@ -156,7 +156,7 @@ int qse_sed_compstdstr (
|
||||
*
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int qse_sed_execstd (
|
||||
QSE_EXPORT int qse_sed_execstd (
|
||||
qse_sed_t* sed,
|
||||
qse_sed_iostd_t in[],
|
||||
qse_sed_iostd_t* out
|
||||
@ -171,7 +171,7 @@ int qse_sed_execstd (
|
||||
*
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int qse_sed_execstdfile (
|
||||
QSE_EXPORT int qse_sed_execstdfile (
|
||||
qse_sed_t* sed,
|
||||
const qse_char_t* infile,
|
||||
const qse_char_t* outfile,
|
||||
|
@ -36,6 +36,10 @@
|
||||
#if defined(_WIN32)
|
||||
# include <windows.h>
|
||||
# include <tchar.h>
|
||||
# if defined(QSE_HAVE_CONFIG_H)
|
||||
# include <ltdl.h>
|
||||
# define USE_LTDL
|
||||
# endif
|
||||
#elif defined(__OS2__)
|
||||
# define INCL_DOSPROCESS
|
||||
# define INCL_DOSERRORS
|
||||
@ -420,19 +424,11 @@ int StdAwk::make_additional_globals (Run* run)
|
||||
int StdAwk::rand (Run& run, Value& ret, const Value* args, size_t nargs,
|
||||
const char_t* name, size_t len)
|
||||
{
|
||||
#if (QSE_SIZEOF_ULONG_T == 2)
|
||||
# define RANDV_MAX 0x7FFFl
|
||||
#elif (QSE_SIZEOF_ULONG_T == 4)
|
||||
# define RANDV_MAX 0x7FFFFFFFl
|
||||
#elif (QSE_SIZEOF_ULONG_T == 8)
|
||||
# define RANDV_MAX 0x7FFFFFFFFFFFFFFl
|
||||
#else
|
||||
# error Unsupported
|
||||
#endif
|
||||
|
||||
#define RANDV_MAX QSE_TYPE_MAX(long_t)
|
||||
this->prand = qse_randxsulong (this->prand);
|
||||
long_t randv = this->prand % RANDV_MAX;
|
||||
return ret.setFlt ((flt_t)randv / RANDV_MAX);
|
||||
#undef RANDV_MAX
|
||||
}
|
||||
|
||||
int StdAwk::srand (Run& run, Value& ret, const Value* args, size_t nargs,
|
||||
@ -1400,19 +1396,7 @@ StdAwk::flt_t StdAwk::sqrt (flt_t x)
|
||||
|
||||
void* StdAwk::modopen (const qse_char_t* dir, const qse_char_t* name)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
/*TODO: implemente this - use LoadLibrary... */
|
||||
this->setError (QSE_AWK_ENOIMPL);
|
||||
return -1;
|
||||
#elif defined(__OS2__)
|
||||
/*TODO: implemente this */
|
||||
this->setError (QSE_AWK_ENOIMPL);
|
||||
return -1;
|
||||
#elif defined(__DOS__)
|
||||
/*TODO: implemente this */
|
||||
this->setError (QSE_AWK_ENOIMPL);
|
||||
return -1;
|
||||
#else
|
||||
#if defined(USE_LTDL)
|
||||
|
||||
void* h;
|
||||
qse_mchar_t* modpath;
|
||||
@ -1445,32 +1429,43 @@ void* StdAwk::modopen (const qse_char_t* dir, const qse_char_t* name)
|
||||
|
||||
return h;
|
||||
|
||||
#elif defined(_WIN32)
|
||||
/*TODO: implemente this - use LoadLibrary... */
|
||||
this->setError (QSE_AWK_ENOIMPL);
|
||||
return QSE_NULL;
|
||||
#elif defined(__OS2__)
|
||||
/*TODO: implemente this */
|
||||
this->setError (QSE_AWK_ENOIMPL);
|
||||
return QSE_NULL;
|
||||
#elif defined(__DOS__)
|
||||
/*TODO: implemente this */
|
||||
this->setError (QSE_AWK_ENOIMPL);
|
||||
return QSE_NULL;
|
||||
#else
|
||||
|
||||
this->setError (QSE_AWK_ENOIMPL);
|
||||
return QSE_NULL;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void StdAwk::modclose (void* handle)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
/*TODO: implemente this */
|
||||
#if defined(USE_LTDL)
|
||||
lt_dlclose ((lt_dlhandle)handle);
|
||||
#elif defined(_WIN32)
|
||||
FreeLibrary ((HMODULE)handle);
|
||||
#elif defined(__OS2__)
|
||||
/*TODO: implemente this */
|
||||
#elif defined(__DOS__)
|
||||
/*TODO: implemente this */
|
||||
#else
|
||||
lt_dlclose ((lt_dlhandle)handle);
|
||||
/* nothing to do */
|
||||
#endif
|
||||
}
|
||||
|
||||
void* StdAwk::modsym (void* handle, const qse_char_t* name)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
/*TODO: implemente this */
|
||||
#elif defined(__OS2__)
|
||||
/*TODO: implemente this */
|
||||
#elif defined(__DOS__)
|
||||
/*TODO: implemente this */
|
||||
#else
|
||||
|
||||
void* s;
|
||||
qse_mchar_t* mname;
|
||||
|
||||
@ -1485,7 +1480,19 @@ void* StdAwk::modsym (void* handle, const qse_char_t* name)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(USE_LTDL)
|
||||
s = lt_dlsym ((lt_dlhandle)handle, mname);
|
||||
#elif defined(_WIN32)
|
||||
s = (void*)GetProcAddress ((HMODULE)handle, mname);
|
||||
#elif defined(__OS2__)
|
||||
/*TODO: implemente this */
|
||||
s = QSE_NULL;
|
||||
#elif defined(__DOS__)
|
||||
/*TODO: implemente this */
|
||||
s = QSE_NULL;
|
||||
#else
|
||||
s = QSE_NULL;
|
||||
#endif
|
||||
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
/* nothing to do */
|
||||
@ -1495,7 +1502,6 @@ void* StdAwk::modsym (void* handle, const qse_char_t* name)
|
||||
|
||||
return s;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int StdAwk::SourceFile::open (Data& io)
|
||||
|
@ -20,8 +20,6 @@
|
||||
|
||||
#include "awk.h"
|
||||
|
||||
QSE_IMPLEMENT_COMMON_FUNCTIONS (awk)
|
||||
|
||||
static void free_fun (qse_htb_t* map, void* vptr, qse_size_t vlen)
|
||||
{
|
||||
qse_awk_t* awk = *(qse_awk_t**)QSE_XTN(map);
|
||||
@ -410,6 +408,21 @@ int qse_awk_clear (qse_awk_t* awk)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void qse_awk_setmmgr (qse_awk_t* awk, qse_mmgr_t* mmgr)
|
||||
{
|
||||
awk->mmgr = mmgr;
|
||||
}
|
||||
|
||||
qse_mmgr_t* qse_awk_getmmgr (qse_awk_t* awk)
|
||||
{
|
||||
return awk->mmgr;
|
||||
}
|
||||
|
||||
void* qse_awk_getxtn (qse_awk_t* awk)
|
||||
{
|
||||
return QSE_XTN (awk);
|
||||
}
|
||||
|
||||
qse_awk_prm_t* qse_awk_getprm (qse_awk_t* awk)
|
||||
{
|
||||
return &awk->prm;
|
||||
|
@ -114,7 +114,7 @@ struct qse_awk_tok_t
|
||||
|
||||
struct qse_awk_t
|
||||
{
|
||||
QSE_DEFINE_COMMON_FIELDS (sed)
|
||||
qse_mmgr_t* mmgr;
|
||||
|
||||
/* primitive functions */
|
||||
qse_awk_prm_t prm;
|
||||
|
@ -4278,9 +4278,9 @@ static qse_awk_nde_t* parse_primary_rex (qse_awk_t* awk, const qse_awk_loc_t* x
|
||||
|
||||
nde->type = QSE_AWK_NDE_REX;
|
||||
nde->loc = *xloc;
|
||||
nde->len = QSE_STR_LEN(awk->tok.name);
|
||||
nde->ptr = qse_awk_cstrdup (awk, QSE_STR_CSTR(awk->tok.name));
|
||||
if (nde->ptr == QSE_NULL) goto oops;
|
||||
nde->str.len = QSE_STR_LEN(awk->tok.name);
|
||||
nde->str.ptr = qse_awk_cstrdup (awk, QSE_STR_CSTR(awk->tok.name));
|
||||
if (nde->str.ptr == QSE_NULL) goto oops;
|
||||
|
||||
nde->code = QSE_AWK_BUILDREX (awk,
|
||||
QSE_STR_PTR(awk->tok.name), QSE_STR_LEN(awk->tok.name),
|
||||
@ -4298,7 +4298,7 @@ static qse_awk_nde_t* parse_primary_rex (qse_awk_t* awk, const qse_awk_loc_t* x
|
||||
oops:
|
||||
QSE_ASSERT (nde != QSE_NULL);
|
||||
if (nde->code) QSE_AWK_FREEREX (awk, nde->code);
|
||||
if (nde->ptr) QSE_AWK_FREE (awk, nde->ptr);
|
||||
if (nde->str.ptr) QSE_AWK_FREE (awk, nde->str.ptr);
|
||||
QSE_AWK_FREE (awk, nde);
|
||||
return QSE_NULL;
|
||||
}
|
||||
|
@ -1511,7 +1511,7 @@ qse_awk_fun_t* qse_awk_rtx_findfun (qse_awk_rtx_t* rtx, const qse_char_t* name)
|
||||
/* call an AWK function by the function structure */
|
||||
qse_awk_val_t* qse_awk_rtx_callfun (
|
||||
qse_awk_rtx_t* rtx, qse_awk_fun_t* fun,
|
||||
qse_awk_val_t** args, qse_size_t nargs)
|
||||
qse_awk_val_t* args[], qse_size_t nargs)
|
||||
{
|
||||
struct capture_retval_data_t crdata;
|
||||
qse_awk_val_t* v;
|
||||
@ -1583,7 +1583,7 @@ qse_awk_val_t* qse_awk_rtx_callfun (
|
||||
/* call an AWK function by name */
|
||||
qse_awk_val_t* qse_awk_rtx_call (
|
||||
qse_awk_rtx_t* rtx, const qse_char_t* name,
|
||||
qse_awk_val_t** args, qse_size_t nargs)
|
||||
qse_awk_val_t* args[], qse_size_t nargs)
|
||||
{
|
||||
qse_awk_fun_t* fun;
|
||||
|
||||
@ -1595,7 +1595,7 @@ qse_awk_val_t* qse_awk_rtx_call (
|
||||
|
||||
qse_awk_val_t* qse_awk_rtx_callwithstrs (
|
||||
qse_awk_rtx_t* rtx, const qse_char_t* name,
|
||||
const qse_char_t** args, qse_size_t nargs)
|
||||
const qse_char_t* args[], qse_size_t nargs)
|
||||
{
|
||||
qse_size_t i;
|
||||
qse_awk_val_t** v, * ret;
|
||||
@ -6157,12 +6157,8 @@ static qse_awk_val_t* eval_int (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
|
||||
qse_awk_val_t* val;
|
||||
|
||||
val = qse_awk_rtx_makeintval (run, ((qse_awk_nde_int_t*)nde)->val);
|
||||
if (val == QSE_NULL)
|
||||
{
|
||||
ADJERR_LOC (run, &nde->loc);
|
||||
return QSE_NULL;
|
||||
}
|
||||
((qse_awk_val_int_t*)val)->nde = nde;
|
||||
if (val == QSE_NULL) ADJERR_LOC (run, &nde->loc);
|
||||
else ((qse_awk_val_int_t*)val)->nde = nde;
|
||||
|
||||
return val;
|
||||
}
|
||||
@ -6172,12 +6168,8 @@ static qse_awk_val_t* eval_real (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
|
||||
qse_awk_val_t* val;
|
||||
|
||||
val = qse_awk_rtx_makefltval (run, ((qse_awk_nde_flt_t*)nde)->val);
|
||||
if (val == QSE_NULL)
|
||||
{
|
||||
ADJERR_LOC (run, &nde->loc);
|
||||
return QSE_NULL;
|
||||
}
|
||||
((qse_awk_val_flt_t*)val)->nde = nde;
|
||||
if (val == QSE_NULL) ADJERR_LOC (run, &nde->loc);
|
||||
else ((qse_awk_val_flt_t*)val)->nde = nde;
|
||||
|
||||
return val;
|
||||
}
|
||||
@ -6189,11 +6181,7 @@ static qse_awk_val_t* eval_str (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
|
||||
val = qse_awk_rtx_makestrval (run,
|
||||
((qse_awk_nde_str_t*)nde)->ptr,
|
||||
((qse_awk_nde_str_t*)nde)->len);
|
||||
if (val == QSE_NULL)
|
||||
{
|
||||
ADJERR_LOC (run, &nde->loc);
|
||||
return QSE_NULL;
|
||||
}
|
||||
if (val == QSE_NULL) ADJERR_LOC (run, &nde->loc);
|
||||
|
||||
return val;
|
||||
}
|
||||
@ -6203,14 +6191,9 @@ static qse_awk_val_t* eval_rex (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
|
||||
qse_awk_val_t* val;
|
||||
|
||||
val = qse_awk_rtx_makerexval (run,
|
||||
((qse_awk_nde_rex_t*)nde)->ptr,
|
||||
((qse_awk_nde_rex_t*)nde)->len,
|
||||
&((qse_awk_nde_rex_t*)nde)->str,
|
||||
((qse_awk_nde_rex_t*)nde)->code);
|
||||
if (val == QSE_NULL)
|
||||
{
|
||||
ADJERR_LOC (run, &nde->loc);
|
||||
return QSE_NULL;
|
||||
}
|
||||
if (val == QSE_NULL) ADJERR_LOC (run, &nde->loc);
|
||||
|
||||
return val;
|
||||
}
|
||||
@ -6558,7 +6541,7 @@ read_again:
|
||||
|
||||
#ifdef DEBUG_RUN
|
||||
qse_dprintf (QSE_T("record len = %d str=[%.*s]\n"),
|
||||
(int)QSE_STR_LEN(buf), (int)QSE_STR_LEN(buf), QSE_STR_PTR(buf));
|
||||
(int)QSE_STR_LEN(buf), (int)QSE_STR_LEN(buf), QSE_STR_PTR(buf));
|
||||
#endif
|
||||
if (n == 0)
|
||||
{
|
||||
|
@ -40,8 +40,12 @@
|
||||
#if defined(_WIN32)
|
||||
# include <windows.h>
|
||||
# include <tchar.h>
|
||||
# if defined(QSE_HAVE_CONFIG_H)
|
||||
# include <ltdl.h>
|
||||
# define USE_LTDL
|
||||
# endif
|
||||
#elif defined(__OS2__)
|
||||
# define INCL_DOSPROCESS
|
||||
# define INCL_DOSMODULEMGR
|
||||
# define INCL_DOSERRORS
|
||||
# include <os2.h>
|
||||
#elif defined(__DOS__)
|
||||
@ -52,7 +56,7 @@
|
||||
# define USE_LTDL
|
||||
#endif
|
||||
|
||||
#ifndef QSE_HAVE_CONFIG_H
|
||||
#if !defined(QSE_HAVE_CONFIG_H)
|
||||
# if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
||||
# define HAVE_POW
|
||||
# define HAVE_FMOD
|
||||
@ -313,25 +317,13 @@ static int custom_awk_sprintf (
|
||||
static void* custom_awk_modopen (
|
||||
qse_awk_t* awk, const qse_char_t* dir, const qse_char_t* name)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
/*TODO: implemente this - use LoadLibrary... */
|
||||
qse_awk_seterrnum (awk, QSE_AWK_ENOIMPL, QSE_NULL);
|
||||
return -1;
|
||||
#elif defined(__OS2__)
|
||||
/*TODO: implemente this */
|
||||
qse_awk_seterrnum (awk, QSE_AWK_ENOIMPL, QSE_NULL);
|
||||
return -1;
|
||||
#elif defined(__DOS__)
|
||||
/*TODO: implemente this */
|
||||
qse_awk_seterrnum (awk, QSE_AWK_ENOIMPL, QSE_NULL);
|
||||
return -1;
|
||||
#else
|
||||
|
||||
#if defined(USE_LTDL)
|
||||
void* h;
|
||||
qse_mchar_t* modpath;
|
||||
const qse_char_t* tmp[5];
|
||||
int count = 0;
|
||||
const qse_char_t* tmp[6];
|
||||
int count;
|
||||
|
||||
count = 0;
|
||||
if (dir && dir[0] != QSE_T('\0'))
|
||||
{
|
||||
tmp[count++] = dir;
|
||||
@ -358,38 +350,102 @@ static void* custom_awk_modopen (
|
||||
|
||||
return h;
|
||||
|
||||
#elif defined(_WIN32)
|
||||
HMODULE h;
|
||||
qse_char_t* path;
|
||||
const qse_char_t* tmp[5];
|
||||
int count = 0;
|
||||
|
||||
if (dir && dir[0] != QSE_T('\0'))
|
||||
{
|
||||
tmp[count++] = dir;
|
||||
tmp[count++] = QSE_T("/");
|
||||
}
|
||||
|
||||
tmp[count++] = QSE_T("libawk");
|
||||
tmp[count++] = name;
|
||||
tmp[count] = QSE_NULL;
|
||||
|
||||
path = qse_stradup (tmp, QSE_NULL, awk->mmgr);
|
||||
if (!path)
|
||||
{
|
||||
qse_awk_seterrnum (awk, QSE_AWK_ENOMEM, QSE_NULL);
|
||||
return QSE_NULL;
|
||||
}
|
||||
|
||||
h = LoadLibrary (path);
|
||||
|
||||
QSE_MMGR_FREE (awk->mmgr, path);
|
||||
|
||||
return h;
|
||||
#elif defined(__OS2__)
|
||||
HMODULE h;
|
||||
qse_mchar_t* modpath;
|
||||
const qse_char_t* tmp[6];
|
||||
int count;
|
||||
|
||||
count = 0;
|
||||
if (dir && dir[0] != QSE_T('\0'))
|
||||
{
|
||||
tmp[count++] = dir;
|
||||
tmp[count++] = QSE_T("/");
|
||||
}
|
||||
tmp[count++] = QSE_T("libawk");
|
||||
tmp[count++] = name;
|
||||
tmp[count] = QSE_NULL;
|
||||
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
modpath = qse_mbsadup (tmp, QSE_NULL, awk->mmgr);
|
||||
#else
|
||||
modpath = qse_wcsatombsdup (tmp, QSE_NULL, awk->mmgr);
|
||||
#endif
|
||||
if (!modpath)
|
||||
{
|
||||
qse_awk_seterrnum (awk, QSE_AWK_ENOMEM, QSE_NULL);
|
||||
return QSE_NULL;
|
||||
}
|
||||
|
||||
if (DosLoadModule (errbuf, QSE_COUNTOF(errbuf), modpath, &h) != NO_ERROR) h = QSE_NULL;
|
||||
|
||||
QSE_MMGR_FREE (awk->mmgr, modpath);
|
||||
|
||||
return h;
|
||||
|
||||
#elif defined(__DOS__)
|
||||
|
||||
/*TODO: implemente this */
|
||||
qse_awk_seterrnum (awk, QSE_AWK_ENOIMPL, QSE_NULL);
|
||||
return -1;
|
||||
|
||||
#else
|
||||
qse_awk_seterrnum (awk, QSE_AWK_ENOIMPL, QSE_NULL);
|
||||
return QSE_NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void custom_awk_modclose (qse_awk_t* awk, void* handle)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
/*TODO: implemente this */
|
||||
#if defined(USE_LTDL)
|
||||
lt_dlclose (handle);
|
||||
#elif defined(_WIN32)
|
||||
FreeLibrary ((HMODULE)handle);
|
||||
#elif defined(__OS2__)
|
||||
/*TODO: implemente this */
|
||||
DosFreeModule ((HMODULE)handle);
|
||||
#elif defined(__DOS__)
|
||||
/*TODO: implemente this */
|
||||
#else
|
||||
lt_dlclose (handle);
|
||||
/* nothing to do */
|
||||
#endif
|
||||
}
|
||||
|
||||
static void* custom_awk_modsym (qse_awk_t* awk, void* handle, const qse_char_t* name)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
/*TODO: implemente this */
|
||||
#elif defined(__OS2__)
|
||||
/*TODO: implemente this */
|
||||
#elif defined(__DOS__)
|
||||
/*TODO: implemente this */
|
||||
#else
|
||||
|
||||
void* s;
|
||||
qse_mchar_t* mname;
|
||||
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
mname = name;
|
||||
#else
|
||||
#else
|
||||
mname = qse_wcstombsdup (name, QSE_NULL, awk->mmgr);
|
||||
if (!mname)
|
||||
{
|
||||
@ -398,17 +454,30 @@ static void* custom_awk_modsym (qse_awk_t* awk, void* handle, const qse_char_t*
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(USE_LTDL)
|
||||
s = lt_dlsym (handle, mname);
|
||||
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
#elif defined(_WIN32)
|
||||
s = GetProcAddress ((HMODULE)handle, mname);
|
||||
|
||||
#elif defined(__OS2__)
|
||||
if (DosQueryProcAddr ((HMODULE)handle, 0, mname, (PFN*)&s) != NO_ERROR) s = QSE_NULL;
|
||||
|
||||
#elif defined(__DOS__)
|
||||
/*TODO: implemente this */
|
||||
s = QSE_NULL;
|
||||
#else
|
||||
s = QSE_NULL;
|
||||
#endif
|
||||
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
/* nothing to do */
|
||||
#else
|
||||
#else
|
||||
QSE_MMGR_FREE (awk->mmgr, mname);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return s;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static int add_globals (qse_awk_t* awk);
|
||||
@ -2098,16 +2167,7 @@ void* qse_awk_rtx_getxtnstd (qse_awk_rtx_t* rtx)
|
||||
|
||||
static int fnc_rand (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||
{
|
||||
#if (QSE_SIZEOF_ULONG_T == 2)
|
||||
# define RANDV_MAX 0x7FFFl
|
||||
#elif (QSE_SIZEOF_ULONG_T == 4)
|
||||
# define RANDV_MAX 0x7FFFFFFFl
|
||||
#elif (QSE_SIZEOF_ULONG_T == 8)
|
||||
# define RANDV_MAX 0x7FFFFFFFFFFFFFFl
|
||||
#else
|
||||
# error Unsupported
|
||||
#endif
|
||||
|
||||
#define RANDV_MAX QSE_TYPE_MAX(qse_long_t)
|
||||
qse_awk_val_t* r;
|
||||
qse_long_t randv;
|
||||
rxtn_t* rxtn;
|
||||
@ -2122,6 +2182,7 @@ static int fnc_rand (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||
|
||||
qse_awk_rtx_setretval (rtx, r);
|
||||
return 0;
|
||||
#undef RANDV_MAX
|
||||
}
|
||||
|
||||
static int fnc_srand (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||
|
@ -406,8 +406,8 @@ static int print_expr (qse_awk_t* awk, qse_awk_nde_t* nde)
|
||||
{
|
||||
PUT_SRCSTR (awk, QSE_T("/"));
|
||||
PUT_SRCSTRN (awk,
|
||||
((qse_awk_nde_rex_t*)nde)->ptr,
|
||||
((qse_awk_nde_rex_t*)nde)->len);
|
||||
((qse_awk_nde_rex_t*)nde)->str.ptr,
|
||||
((qse_awk_nde_rex_t*)nde)->str.len);
|
||||
PUT_SRCSTR (awk, QSE_T("/"));
|
||||
break;
|
||||
}
|
||||
@ -1306,7 +1306,7 @@ void qse_awk_clrpt (qse_awk_t* awk, qse_awk_nde_t* tree)
|
||||
case QSE_AWK_NDE_REX:
|
||||
{
|
||||
QSE_AWK_FREEREX (awk, ((qse_awk_nde_rex_t*)p)->code);
|
||||
QSE_AWK_FREE (awk, ((qse_awk_nde_rex_t*)p)->ptr);
|
||||
QSE_AWK_FREE (awk, ((qse_awk_nde_rex_t*)p)->str.ptr);
|
||||
QSE_AWK_FREE (awk, p);
|
||||
break;
|
||||
}
|
||||
|
@ -154,8 +154,7 @@ struct qse_awk_nde_str_t
|
||||
struct qse_awk_nde_rex_t
|
||||
{
|
||||
QSE_AWK_NDE_HDR;
|
||||
qse_char_t* ptr;
|
||||
qse_size_t len;
|
||||
qse_xstr_t str;
|
||||
void* code;
|
||||
};
|
||||
|
||||
|
@ -416,7 +416,7 @@ qse_awk_val_t* qse_awk_rtx_makenstrvalwithcstr (qse_awk_rtx_t* rtx, const qse_cs
|
||||
}
|
||||
|
||||
qse_awk_val_t* qse_awk_rtx_makerexval (
|
||||
qse_awk_rtx_t* rtx, const qse_char_t* buf, qse_size_t len, void* code)
|
||||
qse_awk_rtx_t* rtx, const qse_cstr_t* str, void* code)
|
||||
{
|
||||
qse_awk_val_rex_t* val;
|
||||
qse_size_t totsz;
|
||||
@ -426,7 +426,7 @@ qse_awk_val_t* qse_awk_rtx_makerexval (
|
||||
* - a raw string plus with added a terminating '\0'
|
||||
* the total size is just large enough for all these.
|
||||
*/
|
||||
totsz = QSE_SIZEOF(*val) + (QSE_SIZEOF(*buf) * (len + 1));
|
||||
totsz = QSE_SIZEOF(*val) + (QSE_SIZEOF(*str->ptr) * (str->len + 1));
|
||||
val = (qse_awk_val_rex_t*) QSE_AWK_ALLOC (rtx->awk, totsz);
|
||||
if (val == QSE_NULL)
|
||||
{
|
||||
@ -437,10 +437,10 @@ qse_awk_val_t* qse_awk_rtx_makerexval (
|
||||
val->type = QSE_AWK_VAL_REX;
|
||||
val->ref = 0;
|
||||
val->nstr = 0;
|
||||
val->len = len;
|
||||
val->str.len = str->len;
|
||||
|
||||
val->ptr = (qse_char_t*)(val + 1);
|
||||
qse_strncpy (val->ptr, buf, len);
|
||||
val->str.ptr = (qse_char_t*)(val + 1);
|
||||
qse_strncpy (val->str.ptr, str->ptr, str->len);
|
||||
|
||||
val->code = code;
|
||||
|
||||
@ -898,7 +898,7 @@ int qse_awk_rtx_valtobool (qse_awk_rtx_t* run, const qse_awk_val_t* val)
|
||||
case QSE_AWK_VAL_STR:
|
||||
return ((qse_awk_val_str_t*)val)->val.len > 0;
|
||||
case QSE_AWK_VAL_REX: /* TODO: is this correct? */
|
||||
return ((qse_awk_val_rex_t*)val)->len > 0;
|
||||
return ((qse_awk_val_rex_t*)val)->str.len > 0;
|
||||
case QSE_AWK_VAL_MAP:
|
||||
return 0; /* TODO: is this correct? */
|
||||
case QSE_AWK_VAL_REF:
|
||||
|
@ -23,8 +23,6 @@
|
||||
#include <qse/cmn/path.h>
|
||||
#include "../cmn/mem.h"
|
||||
|
||||
QSE_IMPLEMENT_COMMON_FUNCTIONS (htrd)
|
||||
|
||||
static const qse_mchar_t NUL = QSE_MT('\0');
|
||||
|
||||
#define CONSUME_UNTIL_CLOSE (1 << 0)
|
||||
@ -450,6 +448,21 @@ void qse_htrd_clear (qse_htrd_t* htrd)
|
||||
clear_feed (htrd);
|
||||
}
|
||||
|
||||
void qse_htrd_setmmgr (qse_htrd_t* htrd, qse_mmgr_t* mmgr)
|
||||
{
|
||||
htrd->mmgr = mmgr;
|
||||
}
|
||||
|
||||
qse_mmgr_t* qse_htrd_getmmgr (qse_htrd_t* htrd)
|
||||
{
|
||||
return htrd->mmgr;
|
||||
}
|
||||
|
||||
void* qse_htrd_getxtn (qse_htrd_t* htrd)
|
||||
{
|
||||
return QSE_XTN (htrd);
|
||||
}
|
||||
|
||||
int qse_htrd_getoption (qse_htrd_t* htrd)
|
||||
{
|
||||
return htrd->option;
|
||||
|
@ -34,8 +34,6 @@ struct htrd_xtn_t
|
||||
qse_httpd_client_t* client;
|
||||
};
|
||||
|
||||
QSE_IMPLEMENT_COMMON_FUNCTIONS (httpd)
|
||||
|
||||
static void free_server_list (qse_httpd_t* httpd);
|
||||
static int perform_client_task (
|
||||
qse_httpd_t* httpd, void* mux, qse_ubi_t handle, int mask, void* cbarg);
|
||||
@ -101,6 +99,21 @@ void qse_httpd_seterrnum (qse_httpd_t* httpd, qse_httpd_errnum_t errnum)
|
||||
httpd->errnum = errnum;
|
||||
}
|
||||
|
||||
void qse_httpd_setmmgr (qse_httpd_t* httpd, qse_mmgr_t* mmgr)
|
||||
{
|
||||
httpd->mmgr = mmgr;
|
||||
}
|
||||
|
||||
qse_mmgr_t* qse_httpd_getmmgr (qse_httpd_t* httpd)
|
||||
{
|
||||
return httpd->mmgr;
|
||||
}
|
||||
|
||||
void* qse_httpd_getxtn (qse_httpd_t* httpd)
|
||||
{
|
||||
return QSE_XTN (httpd);
|
||||
}
|
||||
|
||||
int qse_httpd_getoption (qse_httpd_t* httpd)
|
||||
{
|
||||
return httpd->option;
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
struct qse_httpd_t
|
||||
{
|
||||
QSE_DEFINE_COMMON_FIELDS (httpd)
|
||||
qse_mmgr_t* mmgr;
|
||||
qse_httpd_errnum_t errnum;
|
||||
qse_httpd_ecb_t* ecb; /* event callbacks */
|
||||
qse_httpd_scb_t* scb; /* system callbacks */
|
||||
|
@ -21,8 +21,6 @@
|
||||
#include "upxd.h"
|
||||
#include <qse/cmn/str.h>
|
||||
|
||||
QSE_IMPLEMENT_COMMON_FUNCTIONS (upxd)
|
||||
|
||||
static void disable_all_servers (qse_upxd_t* upxd);
|
||||
static void free_all_servers (qse_upxd_t* upxd);
|
||||
static qse_upxd_server_session_t* find_server_session (
|
||||
@ -75,6 +73,22 @@ void qse_upxd_fini (qse_upxd_t* upxd)
|
||||
free_all_servers (upxd);
|
||||
}
|
||||
|
||||
|
||||
void qse_upxd_setmmgr (qse_upxd_t* upxd, qse_mmgr_t* mmgr)
|
||||
{
|
||||
upxd->mmgr = mmgr;
|
||||
}
|
||||
|
||||
qse_mmgr_t* qse_upxd_getmmgr (qse_upxd_t* upxd)
|
||||
{
|
||||
return upxd->mmgr;
|
||||
}
|
||||
|
||||
void* qse_upxd_getxtn (qse_upxd_t* upxd)
|
||||
{
|
||||
return QSE_XTN (upxd);
|
||||
}
|
||||
|
||||
qse_upxd_errnum_t qse_upxd_geterrnum (qse_upxd_t* upxd)
|
||||
{
|
||||
return upxd->errnum;
|
||||
|
@ -71,7 +71,7 @@ struct qse_upxd_server_session_t
|
||||
|
||||
struct qse_upxd_t
|
||||
{
|
||||
QSE_DEFINE_COMMON_FIELDS (upxd)
|
||||
qse_mmgr_t* mmgr;
|
||||
qse_upxd_errnum_t errnum;
|
||||
|
||||
int stopreq;
|
||||
|
@ -35,8 +35,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
QSE_IMPLEMENT_COMMON_FUNCTIONS (sed)
|
||||
|
||||
static void free_command (qse_sed_t* sed, qse_sed_cmd_t* cmd);
|
||||
static void free_all_command_blocks (qse_sed_t* sed);
|
||||
static void free_all_cids (qse_sed_t* sed);
|
||||
@ -145,6 +143,21 @@ void qse_sed_fini (qse_sed_t* sed)
|
||||
qse_str_fini (&sed->tmp.rex);
|
||||
}
|
||||
|
||||
void qse_sed_setmmgr (qse_sed_t* sed, qse_mmgr_t* mmgr)
|
||||
{
|
||||
sed->mmgr = mmgr;
|
||||
}
|
||||
|
||||
qse_mmgr_t* qse_sed_getmmgr (qse_sed_t* sed)
|
||||
{
|
||||
return sed->mmgr;
|
||||
}
|
||||
|
||||
void* qse_sed_getxtn (qse_sed_t* sed)
|
||||
{
|
||||
return QSE_XTN (sed);
|
||||
}
|
||||
|
||||
void qse_sed_setoption (qse_sed_t* sed, int option)
|
||||
{
|
||||
sed->option = option;
|
||||
@ -3958,7 +3971,7 @@ int qse_sed_exec (qse_sed_t* sed, qse_sed_io_impl_t inf, qse_sed_io_impl_t outf)
|
||||
sed->e.in.len = 0;
|
||||
sed->e.in.pos = 0;
|
||||
sed->e.in.num = 0;
|
||||
if (qse_str_init (&sed->e.in.line, QSE_MMGR(sed), 256) <= -1)
|
||||
if (qse_str_init (&sed->e.in.line, sed->mmgr, 256) <= -1)
|
||||
{
|
||||
qse_map_fini (&sed->e.out.files);
|
||||
SETERR0 (sed, QSE_SED_ENOMEM, QSE_NULL);
|
||||
|
@ -79,7 +79,7 @@ struct qse_sed_unknown_cid_t
|
||||
*/
|
||||
struct qse_sed_t
|
||||
{
|
||||
QSE_DEFINE_COMMON_FIELDS (sed)
|
||||
qse_mmgr_t* mmgr;
|
||||
|
||||
qse_sed_errstr_t errstr; /**< error string getter */
|
||||
qse_sed_errnum_t errnum; /**< stores an error number */
|
||||
|
@ -9,21 +9,20 @@ moddir = $(libdir)/qse
|
||||
mod_LTLIBRARIES = libawksys.la
|
||||
|
||||
libawksys_la_SOURCES = sys.c
|
||||
libawksys_la_LDFLAGS = -L$(abs_builddir)/../../lib/cmn -L$(abs_builddir)/../../lib/awk -L$(libdir) -version-info 1:0:0 -no-undefined
|
||||
libawksys_la_LDFLAGS = -L$(abs_builddir)/../../lib/cmn -L$(abs_builddir)/../../lib/awk -L$(libdir) -no-undefined -version-info 1:0:0
|
||||
libawksys_la_LIBADD = -lqseawk -lqsecmn
|
||||
|
||||
if HAVE_LIBUCI
|
||||
mod_LTLIBRARIES += libawkuci.la
|
||||
libawkuci_la_SOURCES = uci.c
|
||||
libawkuci_la_LDFLAGS = -L$(abs_builddir)/../../lib/cmn -L$(abs_builddir)/../../lib/awk -L$(libdir) -version-info 1:0:0 -no-undefined
|
||||
libawkuci_la_LDFLAGS = -L$(abs_builddir)/../../lib/cmn -L$(abs_builddir)/../../lib/awk -L$(libdir) -no-undefined -version-info 1:0:0
|
||||
libawkuci_la_LIBADD = -lqseawk -lqsecmn $(UCI_LIBS)
|
||||
endif
|
||||
|
||||
|
||||
if HAVE_C_MPI
|
||||
mod_LTLIBRARIES += libawkmpi.la
|
||||
libawkmpi_la_CPPFLAGS = $(AM_CPPFLAGS) $(MPI_CFLAGS)
|
||||
libawkmpi_la_SOURCES = mpi.c
|
||||
libawkmpi_la_LDFLAGS = -L$(abs_builddir)/../../lib/cmn -L$(abs_builddir)/../../lib/awk -L$(libdir) -version-info 1:0:0 -no-undefined $(MPI_CLDFLAGS)
|
||||
libawkmpi_la_LDFLAGS = -L$(abs_builddir)/../../lib/cmn -L$(abs_builddir)/../../lib/awk -L$(libdir) -no-undefined -version-info 1:0:0 $(MPI_CLDFLAGS)
|
||||
libawkmpi_la_LIBADD = -lqseawk -lqsecmn
|
||||
endif
|
||||
|
@ -303,14 +303,14 @@ AM_CPPFLAGS = \
|
||||
moddir = $(libdir)/qse
|
||||
mod_LTLIBRARIES = libawksys.la $(am__append_1) $(am__append_2)
|
||||
libawksys_la_SOURCES = sys.c
|
||||
libawksys_la_LDFLAGS = -L$(abs_builddir)/../../lib/cmn -L$(abs_builddir)/../../lib/awk -L$(libdir) -version-info 1:0:0 -no-undefined
|
||||
libawksys_la_LDFLAGS = -L$(abs_builddir)/../../lib/cmn -L$(abs_builddir)/../../lib/awk -L$(libdir) -no-undefined -version-info 1:0:0
|
||||
libawksys_la_LIBADD = -lqseawk -lqsecmn
|
||||
@HAVE_LIBUCI_TRUE@libawkuci_la_SOURCES = uci.c
|
||||
@HAVE_LIBUCI_TRUE@libawkuci_la_LDFLAGS = -L$(abs_builddir)/../../lib/cmn -L$(abs_builddir)/../../lib/awk -L$(libdir) -version-info 1:0:0 -no-undefined
|
||||
@HAVE_LIBUCI_TRUE@libawkuci_la_LDFLAGS = -L$(abs_builddir)/../../lib/cmn -L$(abs_builddir)/../../lib/awk -L$(libdir) -no-undefined -version-info 1:0:0
|
||||
@HAVE_LIBUCI_TRUE@libawkuci_la_LIBADD = -lqseawk -lqsecmn $(UCI_LIBS)
|
||||
@HAVE_C_MPI_TRUE@libawkmpi_la_CPPFLAGS = $(AM_CPPFLAGS) $(MPI_CFLAGS)
|
||||
@HAVE_C_MPI_TRUE@libawkmpi_la_SOURCES = mpi.c
|
||||
@HAVE_C_MPI_TRUE@libawkmpi_la_LDFLAGS = -L$(abs_builddir)/../../lib/cmn -L$(abs_builddir)/../../lib/awk -L$(libdir) -version-info 1:0:0 -no-undefined $(MPI_CLDFLAGS)
|
||||
@HAVE_C_MPI_TRUE@libawkmpi_la_LDFLAGS = -L$(abs_builddir)/../../lib/cmn -L$(abs_builddir)/../../lib/awk -L$(libdir) -no-undefined -version-info 1:0:0 $(MPI_CLDFLAGS)
|
||||
@HAVE_C_MPI_TRUE@libawkmpi_la_LIBADD = -lqseawk -lqsecmn
|
||||
all: all-am
|
||||
|
||||
|
@ -221,7 +221,7 @@ static void unload (qse_awk_mod_t* mod, qse_awk_t* awk)
|
||||
/* TODO: anything */
|
||||
}
|
||||
|
||||
int load (qse_awk_mod_t* mod, qse_awk_t* awk)
|
||||
QSE_EXPORT int load (qse_awk_mod_t* mod, qse_awk_t* awk)
|
||||
{
|
||||
mod->query = query;
|
||||
mod->unload = unload;
|
||||
@ -244,7 +244,7 @@ int load (qse_awk_mod_t* mod, qse_awk_t* awk)
|
||||
* and the module wasn't built. So you can't access mpi::xxx symbols either
|
||||
*/
|
||||
|
||||
int mpi_init (int argc, qse_achar_t* argv[])
|
||||
QSE_EXPORT int mpi_init (int argc, qse_achar_t* argv[])
|
||||
{
|
||||
int rx;
|
||||
|
||||
@ -258,7 +258,7 @@ int mpi_init (int argc, qse_achar_t* argv[])
|
||||
return rx;
|
||||
}
|
||||
|
||||
void mpi_fini (void)
|
||||
QSE_EXPORT void mpi_fini (void)
|
||||
{
|
||||
MPI_Finalize ();
|
||||
}
|
||||
|
@ -52,12 +52,14 @@ static int fnc_getpid (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||
qse_awk_val_t* retv;
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* TOOD: implement this*/
|
||||
pid = -1;
|
||||
pid = GetCurrentProcessId();
|
||||
|
||||
#elif defined(__OS2__)
|
||||
/* TOOD: implement this*/
|
||||
pid = -1;
|
||||
PTIB tib;
|
||||
PPIB pib;
|
||||
|
||||
pid = (DosGetInfoBlocks (&tib, &pib) == NO_ERROR)?
|
||||
pib->pib_ulpid: -1;
|
||||
|
||||
#elif defined(__DOS__)
|
||||
/* TOOD: implement this*/
|
||||
@ -245,7 +247,7 @@ static fnctab_t fnctab[] =
|
||||
# define SIGALRM 14
|
||||
#endif
|
||||
#if !defined(SIGTERM)
|
||||
# define SIGKILL 15
|
||||
# define SIGTERM 15
|
||||
#endif
|
||||
|
||||
static inttab_t inttab[] =
|
||||
@ -316,7 +318,7 @@ static void unload (qse_awk_mod_t* mod, qse_awk_t* awk)
|
||||
/* TODO: anything */
|
||||
}
|
||||
|
||||
int load (qse_awk_mod_t* mod, qse_awk_t* awk)
|
||||
QSE_EXPORT int load (qse_awk_mod_t* mod, qse_awk_t* awk)
|
||||
{
|
||||
mod->query = query;
|
||||
mod->unload = unload;
|
||||
|
@ -1306,7 +1306,7 @@ static void unload (qse_awk_mod_t* mod, qse_awk_t* awk)
|
||||
qse_rbt_close (rbt);
|
||||
}
|
||||
|
||||
int load (qse_awk_mod_t* mod, qse_awk_t* awk)
|
||||
QSE_EXPORT int load (qse_awk_mod_t* mod, qse_awk_t* awk)
|
||||
{
|
||||
qse_rbt_t* rbt;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user