From 0836d3e31901cac1b1c09d86a6557a2654806a90 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 2 Feb 2009 04:12:49 +0000 Subject: [PATCH] added more documentation --- qse/README | 11 +- qse/doc/robodoc.rc | 2 +- qse/include/qse/awk/awk.h | 285 +++++++++++++++++++++---------------- qse/include/qse/cmn/fio.h | 8 +- qse/include/qse/cmn/lda.h | 46 +----- qse/include/qse/cmn/map.h | 96 ++++--------- qse/include/qse/cmn/opt.h | 30 ++-- qse/include/qse/cmn/pio.h | 46 +++--- qse/include/qse/cmn/sll.h | 85 +++++------ qse/include/qse/cmn/str.h | 128 +++++++---------- qse/include/qse/cmn/time.h | 18 +-- qse/include/qse/cmn/tio.h | 161 ++++++++++----------- qse/include/qse/macros.h | 32 ++++- qse/include/qse/types.h | 49 +++---- qse/lib/awk/Awk.cpp | 20 +-- qse/lib/awk/awk.c | 28 ++-- qse/lib/awk/parse.c | 2 +- qse/lib/awk/run.c | 6 +- qse/lib/awk/val.c | 8 +- qse/lib/cmn/fio.c | 2 +- qse/lib/cmn/lda.c | 17 +-- qse/lib/cmn/map.c | 21 +-- qse/lib/cmn/pio.c | 4 +- qse/lib/cmn/sll.c | 17 +-- qse/lib/cmn/str_dyn.c | 17 +-- qse/lib/cmn/tio.c | 12 +- 26 files changed, 520 insertions(+), 631 deletions(-) diff --git a/qse/README b/qse/README index 9031afcd..b0a4322a 100644 --- a/qse/README +++ b/qse/README @@ -1,8 +1,15 @@ QSE provides a script engine for various scripting languages. It aims to produce a script engine framework that can be embedded into an application. A hosting application can access various aspects of the embedded script engine and vice versa. -[INSTALL] +<< INSTALL >> Cross compiling for WIN32 with MINGW32 -./configure --host=i586-mingw32msvc --target=i586-mingw32msvc --enable-syscall + + ./configure --host=i586-mingw32msvc --target=i586-mingw32msvc --enable-syscall make + +<< DOCUMENTATION >> + +Generate the API documents with robodoc. + + robodoc --rc doc/robodoc.rc --src include/qse --doc ./doc/qse --multidoc --index --html --source_line_numbers --nopre diff --git a/qse/doc/robodoc.rc b/qse/doc/robodoc.rc index e562d9f4..beaf8f4f 100644 --- a/qse/doc/robodoc.rc +++ b/qse/doc/robodoc.rc @@ -20,7 +20,7 @@ item order: SYNOPSIS DESCRIPTION INPUT - INTPUTS + INPUTS OUTPUT OUTPUTS RETURN diff --git a/qse/include/qse/awk/awk.h b/qse/include/qse/awk/awk.h index 80b93294..b2c3221c 100644 --- a/qse/include/qse/awk/awk.h +++ b/qse/include/qse/awk/awk.h @@ -24,7 +24,7 @@ #include #include -/****o* qse.awk/awk interpreter +/****o* awk/awk interpreter * DESCRIPTION * The library includes an AWK interpreter that can be embedded into other * applications or can run stand-alone. @@ -36,7 +36,7 @@ typedef struct qse_awk_t qse_awk_t; typedef struct qse_awk_rtx_t qse_awk_rtx_t; /* (R)untime con(T)e(X)t */ typedef struct qse_awk_val_t qse_awk_val_t; -typedef struct qse_awk_eio_t qse_awk_eio_t; /* External IO */ +typedef struct qse_awk_eio_t qse_awk_eio_t; /* (E)xternal (IO) */ typedef struct qse_awk_prmfns_t qse_awk_prmfns_t; typedef struct qse_awk_srcios_t qse_awk_srcios_t; @@ -44,18 +44,31 @@ typedef struct qse_awk_runios_t qse_awk_runios_t; typedef struct qse_awk_runcbs_t qse_awk_runcbs_t; typedef struct qse_awk_rexfns_t qse_awk_rexfns_t; -typedef qse_real_t (*qse_awk_pow_t) (void* data, qse_real_t x, qse_real_t y); +typedef qse_real_t (*qse_awk_pow_t) ( + void* data, + qse_real_t x, + qse_real_t y +); + typedef int (*qse_awk_sprintf_t) ( - void* data, qse_char_t* buf, qse_size_t size, - const qse_char_t* fmt, ...); + void* data, + qse_char_t* buf, + qse_size_t size, + const qse_char_t* fmt, + ... +); typedef qse_ssize_t (*qse_awk_io_t) ( - int cmd, void* arg, qse_char_t* data, qse_size_t count); + int cmd, + void* arg, + qse_char_t* data, + qse_size_t count +); struct qse_awk_eio_t { qse_awk_rtx_t* rtx; /* [IN] */ - int type; /* [IN] console, file, coproc, pipe */ + int type; /* [IN] console, file, pipe */ int mode; /* [IN] read, write, etc */ qse_char_t* name; /* [IN] */ void* data; /* [IN] */ @@ -100,7 +113,6 @@ struct qse_awk_srcios_t struct qse_awk_runios_t { qse_awk_io_t pipe; - qse_awk_io_t coproc; qse_awk_io_t file; qse_awk_io_t console; void* data; @@ -128,19 +140,34 @@ struct qse_awk_runcbs_t struct qse_awk_rexfns_t { + /* TODO: implement functions to get/set rexfns */ void* (*build) ( - qse_awk_t* awk, const qse_char_t* ptn, - qse_size_t len, int* errnum); + qse_awk_t* awk, + const qse_char_t* ptn, + qse_size_t len, + int* errnum + ); int (*match) ( - qse_awk_t* awk, void* code, int option, - const qse_char_t* str, qse_size_t len, - const qse_char_t** mptr, qse_size_t* mlen, - int* errnum); + qse_awk_t* awk, + void* code, + int option, + const qse_char_t* str, + qse_size_t len, + const qse_char_t** mptr, + qse_size_t* mlen, + int* errnum + ); - void (*free) (qse_awk_t* awk, void* code); + void (*free) ( + qse_awk_t* awk, + void* code + ); - qse_bool_t (*isempty) (qse_awk_t* awk, void* code); + qse_bool_t (*isempty) ( + qse_awk_t* awk, + void* code + ); }; /* io function commands */ @@ -471,7 +498,7 @@ enum qse_awk_val_ref_id_t enum qse_awk_rtx_valtostr_opt_t { QSE_AWK_VALTOSTR_CLEAR = (1 << 0), - QSE_AWK_VALTOSTR_FIXED = (1 << 1),/* this overrides CLEAR */ + QSE_AWK_VALTOSTR_FIXED = (1 << 1), /* this overrides CLEAR */ QSE_AWK_VALTOSTR_PRINT = (1 << 2) }; @@ -571,6 +598,7 @@ struct qse_awk_val_ref_t * directly. */ qse_awk_val_t** adr; }; + #ifdef __cplusplus extern "C" { #endif @@ -590,75 +618,76 @@ extern qse_awk_val_t* qse_awk_val_zero; /** represents a numeric value 1 */ extern qse_awk_val_t* qse_awk_val_one; -/****f* qse.awk/qse_awk_open +/****f* awk/qse_awk_open * NAME * qse_awk_open - create an awk object - * * DESCRIPTION * The qse_awk_open() function creates a new qse_awk_t instance. * The instance created can be passed to other qse_awk_xxx() functions and * is valid until it is successfully destroyed using the qse_qse_close() * function. - * * RETURN - * The qse_awk_open() function returns the pointer to an qse_awk_t instance + * The qse_awk_open() function returns the pointer to a qse_awk_t instance * on success and QSE_NULL on failure. - * * SYNOPSIS */ qse_awk_t* qse_awk_open ( qse_mmgr_t* mmgr /* a memory manager */, - qse_size_t xtnsize /* size of extension area in bytes */ + qse_size_t xtnsize /* the size of extension in bytes */ ); /******/ -/****f* qse.awk/qse_awk_close +/****f* awk/qse_awk_close * NAME * qse_awk_close - destroy an awk object - * - * An qse_awk_t instance should be destroyed using the qse_awk_close() function - * when finished being used. The instance passed is not valid any more once - * the function returns success. - * + * DESCRIPTION + * A qse_awk_t instance must be destroyed using the qse_awk_close() function + * when finished being used. The instance passed is not valid any more once + * the function returns success. * RETURN * 0 on success, -1 on failure - * * SYNOPSIS */ int qse_awk_close ( - qse_awk_t* awk /* an awk object */ + qse_awk_t* awk ); /******/ -/****f* qse.awk/qse_awk_getmmgr +/****f* awk/qse_awk_getmmgr * NAME * qse_awk_getmmgr - get the memory manager - * * DESCRIPTION * The qse_awk_getmmgr() function returns the pointer to the memory manager. - * * SYNOPSIS */ qse_mmgr_t* qse_awk_getmmgr ( - qse_awk_t* awk /* an awk object */ + qse_awk_t* awk ); /******/ +/****f* awk/qse_awk_setmmgr + * NAME + * qse_awk_setmmgr - set the extension + * DESCRIPTION + * The qse_awk_setmmgr() specify the memory manager to use. As the memory + * manager is specified into qse_awk_open(), you are not encouraged to change + * it by calling this function. Doing so may cause a lot of problems. + * SYNOPSIS + */ void qse_awk_setmmgr ( - qse_awk_t* awk, + qse_awk_t* awk, qse_mmgr_t* mmgr ); +/******/ -/****f* qse.awk/qse_awk_getxtn +/****f* awk/qse_awk_getxtn * NAME * qse_awk_getxtn - get the extension - * * DESCRIPTION * The extension area is allocated in the qse_awk_open() function when it is * given a positive extension size. The pointer to the beginning of the area * can be acquired using the qse_awk_getxtn() function and be utilized * for various purposes. - * * SYNOPSIS */ void* qse_awk_getxtn ( @@ -666,39 +695,53 @@ void* qse_awk_getxtn ( ); /******/ +/****f* awk/qse_awk_getccls + * NAME + * qse_awk_getccls - get a character classifier + * SYNOPSIS + */ qse_ccls_t* qse_awk_getccls ( qse_awk_t* awk ); +/******/ -/* - * set the character classfier +/****f* awk/qse_awk_setccls + * NAME + * qse_awk_setccls - set the character classfier + * SYNOPSIS */ void qse_awk_setccls ( - /* the pointer to an qse_awk_t instance */ - qse_awk_t* awk, - /* the pointer to a character classfiler */ - qse_ccls_t* ccls + qse_awk_t* awk, + qse_ccls_t* ccls ); +/******/ +/****f* awk/qse_awk_getprmfns + * NAME + * qse_awk_getprmfns - get primitive functions + * SYNOPSIS + */ qse_awk_prmfns_t* qse_awk_getprmfns ( qse_awk_t* awk ); +/******/ -/* - * set primitive functions +/****f* awk/qse_awk_setprmfns + * NAME + * qse_awk_setprmfns - set primitive functions + * SYNOPSIS */ void qse_awk_setprmfns ( - /* the pointer to an qse_awk_t instance */ - qse_awk_t* awk, - /* the pointer to a primitive function structure */ + qse_awk_t* awk, qse_awk_prmfns_t* prmfns ); +/******/ -/****f* qse.awk/qse_awk_clear +/****f* awk/qse_awk_clear * NAME * qse_awk_clear - clear a qse_awk_t object * DESCRIPTION - * If you want to reuse an qse_awk_t instance that finished being used, + * If you want to reuse a qse_awk_t instance that finished being used, * you may call qse_awk_close instead of destroying and creating a new * qse_awk_t instance using qse_awk_close() and qse_awk_open(). * RETURN @@ -710,7 +753,7 @@ int qse_awk_clear ( ); /******/ -/****f* qse.awk/qse_awk_geterrstr +/****f* awk/qse_awk_geterrstr * NAME * qse_awk_geterrstr - get a format string for an error * DESCRIPTION @@ -724,7 +767,7 @@ const qse_char_t* qse_awk_geterrstr ( ); /******/ -/****f* qse.awk/qse_awk_seterrstr +/****f* awk/qse_awk_seterrstr * NAME * qse_awk_geterrstr - set a format string for an error * DESCRIPTION @@ -779,11 +822,25 @@ void qse_awk_seterror ( qse_size_t argcnt ); -int qse_awk_getoption (qse_awk_t* awk); -void qse_awk_setoption (qse_awk_t* awk, int opt); +int qse_awk_getoption ( + qse_awk_t* awk +); -qse_size_t qse_awk_getmaxdepth (qse_awk_t* awk, int type); -void qse_awk_setmaxdepth (qse_awk_t* awk, int types, qse_size_t depth); +void qse_awk_setoption ( + qse_awk_t* awk, + int opt +); + +qse_size_t qse_awk_getmaxdepth ( + qse_awk_t* awk, + int type +); + +void qse_awk_setmaxdepth ( + qse_awk_t* awk, + int types, + qse_size_t depth +); int qse_awk_getword ( qse_awk_t* awk, @@ -794,9 +851,9 @@ int qse_awk_getword ( ); int qse_awk_unsetword ( - qse_awk_t* awk, + qse_awk_t* awk, const qse_char_t* kw, - qse_size_t len + qse_size_t len ); void qse_awk_unsetallwords ( @@ -817,7 +874,7 @@ void qse_awk_unsetallwords ( * RETURN: 0 on success, -1 on failure */ int qse_awk_setword ( - /* the pointer to an qse_awk_t instance */ + /* the pointer to a qse_awk_t instance */ qse_awk_t* awk, /* the pointer to an old keyword */ const qse_char_t* okw, @@ -829,21 +886,12 @@ int qse_awk_setword ( qse_size_t nlen ); -/* - * set the customized regular processing routine. (TODO: NOT YET IMPLEMENTED) - * - * RETURNS 0 on success, -1 on failure - */ -int qse_awk_setrexfns (qse_awk_t* awk, qse_awk_rexfns_t* rexfns); - -/****f* qse.awk/qse_awk_addglobal +/****f* awk/qse_awk_addglobal * NAME * qse_awk_addglobal - add an intrinsic global variable. - * * RETURN - * On success, the ID of the global variable added is returned. - * On failure, -1 is returned. - * + * The qse_awk_addglobal() function returns the ID of the global variable + * added on success and -1 on failure. * SYNOPSIS */ int qse_awk_addglobal ( @@ -853,10 +901,9 @@ int qse_awk_addglobal ( ); /******/ -/****f* qse.awk/qse_awk_delglobal +/****f* awk/qse_awk_delglobal * NAME * qse_awk_delglobal - delete an instrinsic global variable. - * * SYNOPSIS */ int qse_awk_delglobal ( @@ -866,10 +913,9 @@ int qse_awk_delglobal ( ); /******/ -/****f* qse.awk/qse_awk_parse +/****f* awk/qse_awk_parse * NAME * qse_awk_parse - parse source code - * * SYNOPSIS */ int qse_awk_parse ( @@ -879,10 +925,9 @@ int qse_awk_parse ( /******/ -/****f* qse.awk/qse_awk_opensimple +/****f* awk/qse_awk_opensimple * NAME * qse_awk_opensimple - create an awk object - * * SYNOPSIS */ qse_awk_t* qse_awk_opensimple ( @@ -890,10 +935,9 @@ qse_awk_t* qse_awk_opensimple ( ); /******/ -/****f* qse.awk/qse_awk_parsesimple +/****f* awk/qse_awk_parsesimple * NAME * qse_awk_parsesimple - parse source code - * * SYNOPSIS */ int qse_awk_parsesimple ( @@ -904,10 +948,9 @@ int qse_awk_parsesimple ( ); /******/ -/****f* qse.awk/qse_awk_runsimple +/****f* awk/qse_awk_runsimple * NAME * qse_awk_runsimple - run a parsed program - * * SYNOPSIS */ int qse_awk_runsimple ( @@ -917,11 +960,10 @@ int qse_awk_runsimple ( ); /******/ -/****f* qse.awk/qse_awk_run +/****f* awk/qse_awk_run * NAME * qse_awk_run - execute a parsed program * DESCRIPTION - * The qse_awk_run() function returns 0 on success and -1 on failure. * A runtime context is required for it to start running the program. * Once a runtime context is created, the program starts to run. * The failure of context creation is reported by the return value of -1. @@ -967,22 +1009,22 @@ void qse_awk_clrfnc ( qse_awk_t* awk ); -/****f* qse.awk/qse_awk_rtx_stopall +/****f* awk/qse_awk_stopall * NAME - * qse_awk_rtx_stop - stop all runtime contexts + * qse_awk_stopall - stop all runtime contexts * DESCRIPTION - * The qse_awk_rtx_stopall() function aborts all active qse_awk_run() functions + * The qse_awk_stopall() function aborts all active qse_awk_run() functions * invoked with the awk parameter. * SYNOPSIS */ -void qse_awk_rtx_stopall ( +void qse_awk_stopall ( qse_awk_t* awk ); /******/ -/****f* qse.awk/qse_awk_shouldstop +/****f* awk/qse_awk_shouldstop * NAME - * qse_awk_rtx_stop - test if qse_awk_rtx_stop() is called + * qse_awk_shouldstop - test if qse_awk_rtx_stop() is called * SYNOPSIS */ qse_bool_t qse_awk_rtx_shouldstop ( @@ -990,7 +1032,7 @@ qse_bool_t qse_awk_rtx_shouldstop ( ); /******/ -/****f* qse.awk/qse_awk_rtx_stop +/****f* awk/qse_awk_rtx_stop * NAME * qse_awk_rtx_stop - stop a runtime context * DESCRIPTION @@ -1003,7 +1045,7 @@ void qse_awk_rtx_stop ( ); /******/ -/****f* qse.awk/qse_awk_rtx_getnargs +/****f* awk/qse_awk_rtx_getnargs * NAME * qse_awk_rtx_getnargs - get the number of arguments passed to qse_awk_run() * SYNOPSIS @@ -1013,7 +1055,7 @@ qse_size_t qse_awk_rtx_getnargs ( ); /******/ -/****f* qse.awk/qse_awk_rtx_getarg +/****f* awk/qse_awk_rtx_getarg * NAME * qse_awk_rtx_getarg - get an argument passed to qse_awk_run * SYNOPSIS @@ -1024,18 +1066,16 @@ qse_awk_val_t* qse_awk_rtx_getarg ( ); /******/ -/****f* qse.awk/qse_awk_rtx_getglobal +/****f* awk/qse_awk_rtx_getglobal * NAME * qse_awk_rtx_getglobal - gets the value of a global variable - * - * PARAMETERS - * id - A global variable id. An ID is one of the predefined global - * variable IDs or the value returned by qse_awk_addglobal(). - * + * INPUTS + * * rtx - a runtime context + * * id - a global variable ID. It is one of the predefined global + * variable IDs or a value returned by qse_awk_addglobal(). * RETURN * The pointer to a value is returned. This function never fails - * so long as id is valid. Otherwise, you may fall into trouble. - * + * so long as the ID is valid. Otherwise, you may fall into trouble. * SYNOPSIS */ qse_awk_val_t* qse_awk_rtx_getglobal ( @@ -1044,10 +1084,9 @@ qse_awk_val_t* qse_awk_rtx_getglobal ( ); /******/ -/****f* qse.awk/qse_awk_rtx_setglobal +/****f* awk/qse_awk_rtx_setglobal * NAME * qse_awk_rtx_setglobal - set the value of a global variable - * * SYNOPSIS */ int qse_awk_rtx_setglobal ( @@ -1057,7 +1096,7 @@ int qse_awk_rtx_setglobal ( ); /******/ -/****f* qse.awk/qse_awk_rtx_setretval +/****f* awk/qse_awk_rtx_setretval * NAME * qse_awk_rtx_setretval - set the return value * DESCRIPTION @@ -1075,7 +1114,7 @@ void qse_awk_rtx_setretval ( ); /******/ -/****f* qse.awk/qse_awk_rtx_setfilename +/****f* awk/qse_awk_rtx_setfilename * NAME * qse_awk_rtx_setfilename - set FILENAME * SYNOPSIS @@ -1087,7 +1126,7 @@ int qse_awk_rtx_setfilename ( ); /******/ -/****f* qse.awk/qse_awk_rtx_setofilename +/****f* awk/qse_awk_rtx_setofilename * NAME * qse_awk_rtx_setofilename - set OFILENAME * SYNOPSIS @@ -1099,7 +1138,7 @@ int qse_awk_rtx_setofilename ( ); /******/ -/****f* qse.awk/qse_awk_rtx_getawk +/****f* awk/qse_awk_rtx_getawk * NAME * qse_awk_rtx_getawk - get the owning awk object * SYNOPSIS @@ -1109,7 +1148,7 @@ qse_awk_t* qse_awk_rtx_getawk ( ); /******/ -/****f* qse.awk/qse_awk_rtx_getmmgr +/****f* awk/qse_awk_rtx_getmmgr * NAME * qse_awk_rtx_getmmgr - get the memory manager of a runtime context * SYNOPSIS @@ -1119,7 +1158,7 @@ qse_mmgr_t* qse_awk_rtx_getmmgr ( ); /******/ -/****f* qse.awk/qse_awk_rtx_getdata +/****f* awk/qse_awk_rtx_getdata * NAME * qse_awk_rtx_getdata - get the user-specified data for a runtime context * SYNOPSIS @@ -1129,7 +1168,7 @@ void* qse_awk_rtx_getdata ( ); /******/ -/****f* qse.awk/qse_awk_rtx_getnvmap +/****f* awk/qse_awk_rtx_getnvmap * NAME * qse_awk_rtx_getnvmap - get the map of named variables * SYNOPSIS @@ -1139,7 +1178,7 @@ qse_map_t* qse_awk_rtx_getnvmap ( ); /******/ -/****f* qse.awk/qse_awk_rtx_geterrnum +/****f* awk/qse_awk_rtx_geterrnum * NAME * qse_awk_rtx_geterrnum - get the error number of a runtime context * SYNOPSIS @@ -1198,7 +1237,7 @@ int qse_awk_rtx_setrec ( qse_size_t len ); -/****f* qse.awk/qse_awk_alloc +/****f* awk/qse_awk_alloc * NAME * qse_awk_alloc - allocate dynamic memory * RETURN @@ -1206,41 +1245,41 @@ int qse_awk_rtx_setrec ( * SYNOPSIS */ void* qse_awk_alloc ( - qse_awk_t* awk /* the pointer to an qse_awk_t instance */, + qse_awk_t* awk /* the pointer to a qse_awk_t instance */, qse_size_t size /* the size of memory to allocate in bytes */ ); /******/ -/****f* qse.awk/qse_awk_free +/****f* awk/qse_awk_free * NAME * qse_awk_free - free dynamic memory * SYNOPSIS */ void qse_awk_free ( - qse_awk_t* awk /* the pointer to an qse_awk_t instance */, + qse_awk_t* awk /* the pointer to a qse_awk_t instance */, void* ptr /* the pointer to the memory area to free */ ); /******/ -/****f* qse.awk/qse_awk_strdup +/****f* awk/qse_awk_strdup * NAME * qse_awk_strdup - duplicate a null-terminated string * DESCRIPTION * The qse_awk_strdup() function is used to duplicate a string using * the memory manager used by the associated qse_awk_t instance. * The new string should be freed using the qse_awk_free() function. - * RETURNS + * RETURN * The qse_awk_strdup() function returns the pointer to a new string which * is a duplicate of the string s. It returns QSE_NULL on failure. * SYNOPSIS */ qse_char_t* qse_awk_strdup ( - qse_awk_t* awk /* the pointer to an qse_awk_t instance */, + qse_awk_t* awk /* the pointer to a qse_awk_t instance */, const qse_char_t* str /* the pointer to a string */ ); /******/ -/****f* qse.awk/qse_awk_strxdup +/****f* awk/qse_awk_strxdup * NAME * qse_awk_strxdup - duplicate a length-delimited string * DESCRIPTION @@ -1248,7 +1287,7 @@ qse_char_t* qse_awk_strdup ( * is as long as len characters using the memory manager used by the * qse_awk_t instance. The new string should be freed using the qse_awk_free() * function. - * RETURNS + * RETURN * The qse_awk_strxdup() function returns the pointer to a new string which * is a duplicate of the string s on success. It returns QSE_NULL on failure. * SYNOPSIS @@ -1374,7 +1413,7 @@ qse_char_t* qse_awk_rtx_valtostr ( qse_size_t* len ); -/****f* qse.awk/qse_awk_rtx_valtonum +/****f* awk/qse_awk_rtx_valtonum * NAME * qse_awk_rtx_valtonum - convert a value to a number * DESCRIPTION @@ -1404,7 +1443,7 @@ int qse_awk_rtx_valtonum ( ); /******/ -/****f* qse.awk/qse_awk_rtx_strtonum +/****f* awk/qse_awk_rtx_strtonum * NAME * qse_awk_rtx_strtonum - convert a string to a number * SYNOPSIS diff --git a/qse/include/qse/cmn/fio.h b/qse/include/qse/cmn/fio.h index 9438b963..b27ffdd6 100644 --- a/qse/include/qse/cmn/fio.h +++ b/qse/include/qse/cmn/fio.h @@ -91,7 +91,7 @@ struct qse_fio_t /* note that qse_fio_t is instantiated statically * in sio.c. make sure that you update the static instantiation * when you change the structure of qse_fio_t */ - QSE_DEFINE_STD_FIELDS (fio) + QSE_DEFINE_COMMON_FIELDS (fio) int errnum; qse_fio_hnd_t handle; qse_tio_t* tio; @@ -112,9 +112,9 @@ struct qse_fio_lck_t extern "C" { #endif -QSE_DEFINE_STD_FUNCTIONS (fio) +QSE_DEFINE_COMMON_FUNCTIONS (fio) -/****f* qse.fio/qse_fio_open +/****f* qse.cmn.fio/qse_fio_open * NAME * qse_fio_open - open a file * @@ -133,7 +133,7 @@ qse_fio_t* qse_fio_open ( ); /******/ -/****f* qse.fio/qse_fio_close +/****f* qse.cmn.fio/qse_fio_close * NAME * qse_fio_close - close a file * diff --git a/qse/include/qse/cmn/lda.h b/qse/include/qse/cmn/lda.h index 5fe5e5a3..8667f66b 100644 --- a/qse/include/qse/cmn/lda.h +++ b/qse/include/qse/cmn/lda.h @@ -25,7 +25,7 @@ /****o* qse.cmn.lda/linear dynamic array * DESCRIPTION * provides a linear dynamic array. It grows as more items - * are added. T + * are added. * * #include ****** @@ -54,9 +54,6 @@ typedef enum qse_lda_walk_t qse_lda_walk_t; #define QSE_LDA_DPTR(lda,index) ((lda)->node[index]->dptr) #define QSE_LDA_DLEN(lda,index) ((lda)->node[index]->dlen) -#define QSE_LDA_MMGR(lda) ((lda)->mmgr) -#define QSE_LDA_XTN(lda) ((void*)(((qse_lda_t*)lda) + 1)) - #define QSE_LDA_COPIER(lda) ((lda)->copier) #define QSE_LDA_FREEER(lda) ((lda)->freeer) #define QSE_LDA_COMPER(lda) ((lda)->comper) @@ -178,7 +175,7 @@ typedef qse_lda_walk_t (*qse_lda_walker_t) ( */ struct qse_lda_t { - qse_mmgr_t* mmgr; /* memory manager */ + QSE_DEFINE_COMMON_FIELDS (lda) qse_lda_copier_t copier; /* data copier */ qse_lda_freeer_t freeer; /* data freeer */ @@ -209,6 +206,8 @@ struct qse_lda_node_t extern "C" { #endif +QSE_DEFINE_COMMON_FUNCTIONS (lda) + /****f* qse.cmn.lda/qse_lda_open * NAME * qse_lda_open - create a linear dynamic array @@ -257,43 +256,6 @@ void qse_lda_fini ( ); /******/ -/****f* qse.cmn.lda/qse_lda_getxtn - * NAME - * qse_lda_getxtn - get the pointer to the extension - * - * DESCRIPTION - * The qse_lda_getxtn() function returns the pointer to the extension. - * - * SYNOPSIS - */ -void* qse_lda_getxtn ( - qse_lda_t* lda /* a linear dynamic array */ -); -/******/ - -/****f* qse.cmn.lda/qse_lda_getmmgr - * NAME - * qse_lda_getmmgr - get the memory manager - * - * SYNOPSIS - */ -qse_mmgr_t* qse_lda_getmmgr ( - qse_lda_t* lda /* a linear dynamic array */ -); -/******/ - -/****f* qse.cmn.lda/qse_lda_setmmgr - * NAME - * qse_lda_setmmgr - set the memory manager - * - * SYNOPSIS - */ -void qse_lda_setmmgr ( - qse_lda_t* lda /* a linear dynamic array */, - qse_mmgr_t* mmgr /* a memory manager */ -); -/******/ - int qse_lda_getscale ( qse_lda_t* lda /* a lda */ ); diff --git a/qse/include/qse/cmn/map.h b/qse/include/qse/cmn/map.h index dfd0a867..016ae5d0 100644 --- a/qse/include/qse/cmn/map.h +++ b/qse/include/qse/cmn/map.h @@ -28,11 +28,6 @@ * chained under the same bucket. * * #include - * - * EXAMPLES - * void f (void) - * { - * } ****** */ @@ -190,15 +185,16 @@ struct qse_map_pair_t */ struct qse_map_t { - qse_mmgr_t* mmgr; + QSE_DEFINE_COMMON_FIELDS (map) + qse_map_copier_t copier[2]; qse_map_freeer_t freeer[2]; - qse_map_hasher_t hasher; /* key hasher */ - qse_map_comper_t comper; /* key comparator */ - qse_map_keeper_t keeper; /* value keeper */ - qse_map_sizer_t sizer; /* bucket capacity recalculator */ - qse_byte_t scale[2]; /* length scale */ - qse_byte_t factor; /* load factor */ + qse_map_hasher_t hasher; /* key hasher */ + qse_map_comper_t comper; /* key comparator */ + qse_map_keeper_t keeper; /* value keeper */ + qse_map_sizer_t sizer; /* bucket capacity recalculator */ + qse_byte_t scale[2]; /* length scale */ + qse_byte_t factor; /* load factor */ qse_byte_t filler0; qse_size_t size; qse_size_t capa; @@ -213,10 +209,8 @@ struct qse_map_t /****d* qse.cmn.map/QSE_MAP_SIZE * NAME * QSE_MAP_SIZE - get the number of pairs - * * DESCRIPTION * The QSE_MAP_SIZE() macro returns the number of pairs in a map. - * * SYNOPSIS */ #define QSE_MAP_SIZE(m) ((m)->size) @@ -234,9 +228,6 @@ struct qse_map_t #define QSE_MAP_CAPA(m) ((m)->capa) /*****/ -#define QSE_MAP_MMGR(m) ((m)->mmgr) -#define QSE_MAP_XTN(m) ((void*)(((qse_map_t*)m) + 1)) - #define QSE_MAP_KCOPIER(m) ((m)->copier[QSE_MAP_KEY]) #define QSE_MAP_VCOPIER(m) ((m)->copier[QSE_MAP_VAL]) #define QSE_MAP_KFREEER(m) ((m)->freeer[QSE_MAP_KEY]) @@ -260,33 +251,31 @@ struct qse_map_t extern "C" { #endif +QSE_DEFINE_COMMON_FUNCTIONS (map) + /****f* qse.cmn.map/qse_map_open * NAME * qse_map_open - creates a hash map - * * DESCRIPTION * The qse_map_open() function creates a hash map with a dynamic array * bucket and a list of values chained. The initial capacity should be larger * than 0. The load factor should be between 0 and 100 inclusive and the load * factor of 0 disables bucket resizing. If you need extra space associated * with a map, you may pass a non-zero value as the second parameter. - * The QSE_MAP_XTN() macro and the qse_map_getxtn() function - * return the pointer to the beginning of the extension. - * + * The QSE_MAP_XTN() macro and the qse_map_getxtn() function return the + * pointer to the beginning of the extension. * RETURN * The qse_map_open() function returns an qse_map_t pointer on success and * QSE_NULL on failure. - * * SEE ALSO * QSE_MAP_XTN, qse_map_getxtn - * * SYNOPSIS */ qse_map_t* qse_map_open ( - qse_mmgr_t* mmgr /* a memory manager */, - qse_size_t ext /* extension size in bytes */, - qse_size_t capa /* initial capacity */, - int factor /* load factor */ + qse_mmgr_t* mmgr /* a memory manager */, + qse_size_t ext /* extension size in bytes */, + qse_size_t capa /* initial capacity */, + int factor /* load factor */ ); /******/ @@ -294,10 +283,8 @@ qse_map_t* qse_map_open ( /****f* qse.cmn.map/qse_map_close * NAME * qse_map_close - destroy a hash map - * * DESCRIPTION * The qse_map_close() function destroys a hash map. - * * SYNOPSIS */ void qse_map_close ( @@ -306,29 +293,16 @@ void qse_map_close ( /******/ qse_map_t* qse_map_init ( - qse_map_t* map, + qse_map_t* map, qse_mmgr_t* mmgr, - qse_size_t capa, - int factor + qse_size_t capa, + int factor ); void qse_map_fini ( qse_map_t* map ); -void* qse_map_getxtn ( - qse_map_t* map -); - -qse_mmgr_t* qse_map_getmmgr ( - qse_map_t* map -); - -void qse_map_setmmgr ( - qse_map_t* map, - qse_mmgr_t* mmgr -); - /* get the number of key/value pairs in a map */ qse_size_t qse_map_getsize ( qse_map_t* map /* a map */ @@ -450,58 +424,43 @@ void qse_map_setsizer ( qse_map_sizer_t sizer ); -int qse_map_put ( - qse_map_t* map, - void* kptr, - qse_size_t klen, - void* vptr, - qse_size_t vlen, - qse_map_pair_t** px -); - /****f* qse.cmn.map/qse_map_search * NAME * qse_map_search - find a pair with a matching key - * * DESCRIPTION * The qse_map_search() function searches a map to find a pair with a * matching key. It returns the pointer to the pair found. If it fails * to find one, it returns QSE_NULL. - * * RETURN * The qse_map_search() function returns the pointer to the pair with a * maching key, and QSE_NULL if no match is found. - * * SYNOPSIS */ qse_map_pair_t* qse_map_search ( - qse_map_t* map /* a map */, - const void* kptr /* the pointer to a key */, - qse_size_t klen /* the size of the key in bytes */ + qse_map_t* map /* a map */, + const void* kptr /* the pointer to a key */, + qse_size_t klen /* the size of the key in bytes */ ); /******/ /****f* qse.cmn.map/qse_map_upsert * NAME * qse_map_upsert - update an existing pair or inesrt a new pair - * * DESCRIPTION * The qse_map_upsert() function searches a map for the pair with a matching * key. If one is found, it updates the pair. Otherwise, it inserts a new * pair with a key and a value. It returns the pointer to the pair updated * or inserted. - * * RETURN * The qse_map_upsert() function returns a pointer to the updated or inserted * pair on success, and QSE_NULL on failure. - * * SYNOPSIS */ qse_map_pair_t* qse_map_upsert ( qse_map_t* map /* a map */, - void* kptr /* the pointer to a key */, + void* kptr /* the pointer to a key */, qse_size_t klen /* the length of the key in bytes */, - void* vptr /* the pointer to a value */, + void* vptr /* the pointer to a value */, qse_size_t vlen /* the length of the value in bytes */ ); /******/ @@ -509,23 +468,20 @@ qse_map_pair_t* qse_map_upsert ( /****f* qse.cmn.map/qse_map_insert * NAME * qse_map_insert - insert a new pair with a key and a value - * * DESCRIPTION * The qse_map_insert() function inserts a new pair with the key and the value * given. If there exists a pair with the key given, the function returns * QSE_NULL without channging the value. - * * RETURN * The qse_map_insert() function returns a pointer to the pair created on * success, and QSE_NULL on failure. - * * SYNOPSIS */ qse_map_pair_t* qse_map_insert ( qse_map_t* map /* a map */, - void* kptr /* the pointer to a key */, + void* kptr /* the pointer to a key */, qse_size_t klen /* the length of the key in bytes */, - void* vptr /* the pointer to a value */, + void* vptr /* the pointer to a value */, qse_size_t vlen /* the length of the value in bytes */ ); /******/ diff --git a/qse/include/qse/cmn/opt.h b/qse/include/qse/cmn/opt.h index 65a53712..946f19b0 100644 --- a/qse/include/qse/cmn/opt.h +++ b/qse/include/qse/cmn/opt.h @@ -25,31 +25,43 @@ typedef struct qse_opt_t qse_opt_t; typedef struct qse_opt_lng_t qse_opt_lng_t; +/****t* qse.cmn.opt/qse_opt_lng_t + * NAME + * qse_opt_lng_t - define a long option + * SYNOPSIS + */ struct qse_opt_lng_t { const qse_char_t* str; - qse_cint_t val; + qse_cint_t val; }; +/*****/ +/****t* qse.cmn.opt/qse_opt_t + * NAME + * qse_opt_t - define a command line option table + * SYNOPSIS + */ struct qse_opt_t { /* input */ const qse_char_t* str; /* option string */ - qse_opt_lng_t* lng; /* long options */ + qse_opt_lng_t* lng; /* long options */ /* output */ - qse_cint_t opt; /* character checked for validity */ - qse_char_t* arg; /* argument associated with an option */ + qse_cint_t opt; /* character checked for validity */ + qse_char_t* arg; /* argument associated with an option */ /* output */ const qse_char_t* lngopt; /* input + output */ - int ind; /* index into parent argv vector */ + int ind; /* index into parent argv vector */ /* input + output - internal*/ - qse_char_t* cur; + qse_char_t* cur; }; +/******/ #ifdef __cplusplus extern "C" { @@ -57,8 +69,10 @@ extern "C" { /****f* qse.cmn.opt/qse_getopt * NAME - * qse_getopt - parse command line options - * + * qse_getopt - process command line options + * DESCRIPTION + * The qse_getopt() function returns QSE_CHAR_EOF when it finishes processing + * command line options. The return values of QSE_T('?') indicates an error. * SYNOPSIS */ qse_cint_t qse_getopt ( diff --git a/qse/include/qse/cmn/pio.h b/qse/include/qse/cmn/pio.h index a5c83e8a..2443149d 100644 --- a/qse/include/qse/cmn/pio.h +++ b/qse/include/qse/cmn/pio.h @@ -101,15 +101,21 @@ struct qse_pio_pin_t qse_pio_t* self; }; +/****s* cmn/qse_pio_t + * NAME + * qse_pio_t - define an pipe IO type + * SYNOPSIS + */ struct qse_pio_t { - QSE_DEFINE_STD_FIELDS(pio) + QSE_DEFINE_COMMON_FIELDS(pio) int flags; qse_pio_err_t errnum; qse_pio_pid_t child; qse_pio_pin_t pin[3]; }; +/*****/ #define QSE_PIO_ERRNUM(pio) ((pio)->errnum) #define QSE_PIO_FLAGS(pio) ((pio)->flags) @@ -120,9 +126,9 @@ struct qse_pio_t extern "C" { #endif -QSE_DEFINE_STD_FUNCTIONS (pio) +QSE_DEFINE_COMMON_FUNCTIONS (pio) -/****f* qse.cmn.pio/qse_pio_open +/****f* cmn/qse_pio_open * NAME * qse_pio_open - open pipes to a child process * @@ -140,7 +146,7 @@ qse_pio_t* qse_pio_open ( ); /******/ -/****f* qse.cmn.pio/qse_pio_close +/****f* cmn/qse_pio_close * NAME * qse_pio_close - close pipes to a child process * @@ -151,7 +157,7 @@ void qse_pio_close ( ); /******/ -/****f* qse.cmn/pio/qse_pio_init +/****f* cmn/qse_pio_init * NAME * qse_pio_init - initialize pipes to a child process * @@ -165,7 +171,7 @@ qse_pio_t* qse_pio_init ( ); /******/ -/****f* qse.cmn/pio/qse_pio_fini +/****f* cmn/qse_pio_fini * NAME * qse_pio_fini - finalize pipes to a child process * @@ -186,7 +192,7 @@ void qse_pio_setflags ( int op ); -/****f* qse.cmn.pio/qse_pio_geterrnum +/****f* cmn/qse_pio_geterrnum * NAME * qse_pio_geterrnum - get an error code * @@ -197,7 +203,7 @@ qse_pio_err_t qse_pio_geterrnum ( ); /******/ -/****f* qse.cmn.pio/qse_pio_geterrstr +/****f* cmn/qse_pio_geterrmsg * NAME * qse_pio_geterrstr - transllate an error code to a string * @@ -212,7 +218,7 @@ const qse_char_t* qse_pio_geterrstr ( ); /******/ -/****f* qse.cmn.pio/qse_pio_gethandle +/****f* cmn/qse_pio_gethandle * NAME * qse_pio_gethandle - get native handle * @@ -224,7 +230,7 @@ qse_pio_hnd_t qse_pio_gethandle ( ); /******/ -/****f* qse.cmn.pio/qse_pio_getchild +/****f* cmn/qse_pio_getchild * NAME * qse_pio_getchild - get the PID of a child process * @@ -235,10 +241,9 @@ qse_pio_pid_t qse_pio_getchild ( ); /******/ -/****f* qse.cmn.pio/qse_pio_read +/****f* cmn/qse_pio_read * NAME * qse_pio_read - read data - * * SYNOPSIS */ qse_ssize_t qse_pio_read ( @@ -249,14 +254,12 @@ qse_ssize_t qse_pio_read ( ); /******/ -/****f* qse.cmn.pio/qse_pio_write +/****f* cmn/qse_pio_write * NAME * qse_pio_write - write data - * * DESCRIPTION * If the parameter 'size' is zero, qse_pio_write() closes the the writing * stream causing the child process reach the end of the stream. - * * SYNOPSIS */ qse_ssize_t qse_pio_write ( @@ -267,7 +270,7 @@ qse_ssize_t qse_pio_write ( ); /******/ -/****f* qse.cmn.pio/qse_pio_flush +/****f* cmn/qse_pio_flush * NAME * qse_pio_flush - flush data * @@ -279,7 +282,7 @@ qse_ssize_t qse_pio_flush ( ); /*****/ -/****f* qse.cmn.pio/qse_pio_end +/****f* cmn/qse_pio_end * NAME * qse_pio_end - close native handle * @@ -291,10 +294,9 @@ void qse_pio_end ( ); /******/ -/****f* qse.cmn.pio/qse_pio_wait +/****f* cmn/qse_pio_wait * NAME * qse_pio_wait - wait for a child process - * * DESCRIPTION * QSE_PIO_WAIT_NORETRY causes the function to return an error and set the * errnum field to QSE_PIO_EINTR if the underlying system call is interrupted. @@ -302,12 +304,10 @@ void qse_pio_end ( * When QSE_PIO_WAIT_NOBLOCK is used, the return value of 256 indicates that * the child process has not terminated. If the flag is not used, 256 is never * returned. - * * RETURN * -1 on error, 256 if the child is alive and QSE_PIO_NOBLOCK is used, * a number between 0 and 255 inclusive if the child process ends normally, * 256 + signal number if the child process is terminated by a signal. - * * SYNOPSIS */ int qse_pio_wait ( @@ -315,15 +315,13 @@ int qse_pio_wait ( ); /******/ -/****f* qse.cmn.pio/qse_pio_kill +/****f* cmn/qse_pio_kill * NAME * qse_pio_kill - terminate the child process - * * NOTES * You should know the danger of calling this function as the function can * kill a process that is not your child process if it has terminated but * there is a new process with the same process handle. - * * SYNOPSIS */ int qse_pio_kill ( diff --git a/qse/include/qse/cmn/sll.h b/qse/include/qse/cmn/sll.h index 142bf300..c8ea86af 100644 --- a/qse/include/qse/cmn/sll.h +++ b/qse/include/qse/cmn/sll.h @@ -22,13 +22,19 @@ #include #include +/****o* qse.cmn.sll/singly linked list + * DESCRIPTION + * provides a singly linked list + * + * #include + ****** + */ + /****t* qse.cmn.sll/qse_sll_walk_t * NAME * qse_sll_walk_t - define return values for qse_sll_walker_t - * * SEE ALSO - * qse_sll_walk, qse_sll_walker_t - * + * qse_sll_walker_t * SYNOPSIS */ enum qse_sll_walk_t @@ -45,7 +51,6 @@ typedef enum qse_sll_walk_t qse_sll_walk_t; /****b* qse.cmn.sll/qse_sll_copier_t * NAME * qse_sll_copier_t - define a node contruction callback - * * DESCRIPTION * The qse_sll_copier_t defines a callback function for node construction. * A node is contructed when a user adds data to a list. The user can @@ -54,14 +59,12 @@ typedef enum qse_sll_walk_t qse_sll_walk_t; * the data length into a node. A special copier QSE_SLL_COPIER_INLINE copies * the contents of the data a user provided into the node. You can use the * qse_sll_setcopier() function to change the copier. - * + * * A copier should return the pointer to the copied data. If it fails to copy * data, it may return QSE_NULL. You need to set a proper freeer to free up * memory allocated for copy. - * * SEE ALSO * qse_sll_setcopier, qse_sll_getcopier, QSE_SLL_COPIER - * * SYNOPSIS */ typedef void* (*qse_sll_copier_t) ( @@ -140,7 +143,7 @@ typedef qse_sll_walk_t (*qse_sll_walker_t) ( */ struct qse_sll_t { - qse_mmgr_t* mmgr; /* memory manager */ + QSE_DEFINE_COMMON_FIELDS (sll) qse_sll_copier_t copier; /* data copier */ qse_sll_freeer_t freeer; /* data freeer */ @@ -153,17 +156,14 @@ struct qse_sll_t }; /******/ -/****s* qse.cmn.sll/qse_sll_node_t +/****s* cmn/qse_sll_node_t * NAME * qse_sll_node_t - define a list node - * * DESCRIPTION * The qse_sll_node_t type defines a list node containing a data pointer and * and data length. - * * SEE ALSO * QSE_SLL_DPTR, QSE_SLL_DLEN, QSE_SLL_NEXT - * * SYNOPSIS */ struct qse_sll_node_t @@ -177,8 +177,6 @@ struct qse_sll_node_t #define QSE_SLL_COPIER_SIMPLE ((qse_sll_copier_t)1) #define QSE_SLL_COPIER_INLINE ((qse_sll_copier_t)2) -#define QSE_SLL_MMGR(sll) ((sll)->mmgr) -#define QSE_SLL_XTN(s) ((void*)(((qse_sll_t*)s) + 1)) #define QSE_SLL_COPIER(sll) ((sll)->copier) #define QSE_SLL_FREEER(sll) ((sll)->freeer) #define QSE_SLL_COMPER(sll) ((sll)->comper) @@ -188,14 +186,36 @@ struct qse_sll_node_t #define QSE_SLL_SIZE(sll) ((sll)->size) #define QSE_SLL_SCALE(sll) ((sll)->scale) +/****d* cmn/QSE_SLL_DPTR + * NAME + * QSE_SLL_DPTR - get the data pointer in a node + * SYNOPSIS + */ #define QSE_SLL_DPTR(node) ((node)->dptr) +/******/ + +/****d* cmn/QSE_SLL_DLEN + * NAME + * QSE_SLL_DLEN - get the length of data in a node + * SYNOPSIS + */ #define QSE_SLL_DLEN(node) ((node)->dlen) +/******/ + +/****d* cmn/QSE_SLL_NEXT + * NAME + * QSE_SLL_NEXT - get the next node + * SYNOPSIS + */ #define QSE_SLL_NEXT(node) ((node)->next) +/******/ #ifdef __cplusplus extern "C" { #endif +QSE_DEFINE_COMMON_FUNCTIONS (sll) + /****f* qse.cmn.sll/qse_sll_open * NAME * qse_sll_open - create a singly linked list with extension area @@ -274,43 +294,6 @@ void qse_sll_fini ( ); /******/ -/****f* qse.cmn.sll/qse_sll_getxtn - * NAME - * qse_sll_getxtn - get the pointer to the extension - * - * DESCRIPTION - * The qse_sll_getxtn() function returns the pointer to the extension. - * - * SYNOPSIS - */ -void* qse_sll_getxtn ( - qse_sll_t* sll /* a singly linked list */ -); -/******/ - -/****f* qse.cmn.sll/qse_sll_getmmgr - * NAME - * qse_sll_getmmgr - get the memory manager - * - * SYNOPSIS - */ -qse_mmgr_t* qse_sll_getmmgr ( - qse_sll_t* sll /* a singly linked list */ -); -/******/ - -/****f* qse.cmn.sll/qse_sll_setmmgr - * NAME - * qse_sll_setmmgr - set the memory manager - * - * SYNOPSIS - */ -void qse_sll_setmmgr ( - qse_sll_t* sll /* a singly linked list */, - qse_mmgr_t* mmgr /* a memory manager */ -); -/******/ - /****f* qse.cmn.sll/qse_sll_getsize * NAME * qse_sll_getsize - get the number of nodes diff --git a/qse/include/qse/cmn/str.h b/qse/include/qse/cmn/str.h index f4b9d0c3..29f4050e 100644 --- a/qse/include/qse/cmn/str.h +++ b/qse/include/qse/cmn/str.h @@ -22,7 +22,7 @@ #include #include -/****o* qse.cmn.str/string +/****o* cmn/string * DESCRIPTION * defines various functions, types, macros to manipulate * strings. @@ -31,11 +31,6 @@ * dealing with a string pointer and length. * * #include - * - * EXAMPLES - * void f (void) - * { - * } ****** */ @@ -44,23 +39,26 @@ #define QSE_STR_PTR(s) ((s)->ptr) #define QSE_STR_CAPA(s) ((s)->capa) #define QSE_STR_CHAR(s,idx) ((s)->ptr[idx]) - -#define QSE_STR_MMGR(s) ((s)->mmgr) -#define QSE_STR_XTN(s) ((void*)(((qse_str_t*)s) + 1)) #define QSE_STR_SIZER(s) ((s)->sizer) typedef struct qse_str_t qse_str_t; typedef qse_size_t (*qse_str_sizer_t) (qse_str_t* data, qse_size_t hint); +/****s* cmn/qse_str_t + * NAME + * qse_str_t - define a dynamically resizable string + * SYNOPSIS + */ struct qse_str_t { - qse_mmgr_t* mmgr; - qse_str_sizer_t sizer; + QSE_DEFINE_COMMON_FIELDS (str) - qse_char_t* ptr; - qse_size_t len; - qse_size_t capa; + qse_str_sizer_t sizer; + qse_char_t* ptr; + qse_size_t len; + qse_size_t capa; }; +/******/ /* int qse_chartonum (qse_char_t c, int base) */ #define QSE_CHARTONUM(c,base) \ @@ -145,10 +143,9 @@ int qse_strxncmp ( int qse_strcasecmp ( const qse_char_t* s1, const qse_char_t* s2, qse_ccls_t* ccls); -/****f* qse.cmn.str/qse_strxncasecmp +/****f* cmn/qse_strxncasecmp * NAME * qse_strxncasecmp - compare strings ignoring case - * * DESCRIPTION * The qse_strxncasecmp() function compares characters at the same position * in each string after converting them to the same case temporarily. @@ -160,22 +157,19 @@ int qse_strcasecmp ( * For two strings to be equal, they need to have the same length and all * characters in the first string should be equal to their counterpart in the * second string. - * * RETURN * The qse_strxncasecmp() returns 0 if two strings are equal, a positive * number if the first string is larger, -1 if the second string is larger. - * * EXAMPLES * qse_strxncasecmp (QSE_T("foo"), 3, QSE_T("FoO"), 3, QSE_CCLS_GETDFL()); - * * SYNOPSIS */ int qse_strxncasecmp ( - const qse_char_t* s1 /* the pointer to the first string */, - qse_size_t len1 /* the length of the first string */, - const qse_char_t* s2 /* the pointer to the second string */, - qse_size_t len2 /* the length of the second string */, - qse_ccls_t* ccls /* character class handler */ + const qse_char_t* s1 /* the pointer to the first string */, + qse_size_t len1 /* the length of the first string */, + const qse_char_t* s2 /* the pointer to the second string */, + qse_size_t len2 /* the length of the second string */, + qse_ccls_t* ccls /* character class handler */ ); /******/ @@ -241,6 +235,8 @@ qse_long_t qse_strxtolong (const qse_char_t* str, qse_size_t len); qse_uint_t qse_strxtouint (const qse_char_t* str, qse_size_t len); qse_ulong_t qse_strxtoulong (const qse_char_t* str, qse_size_t len); +QSE_DEFINE_COMMON_FUNCTIONS (str) + qse_str_t* qse_str_open ( qse_mmgr_t* mmgr, qse_size_t ext, @@ -264,7 +260,7 @@ void qse_str_fini ( qse_str_t* str ); -/****f* qse.cmn.str/qse_str_yield +/****f* cmn/qse_str_yield * NAME * qse_str_yield - yield the buffer * @@ -279,52 +275,40 @@ void qse_str_fini ( * SYNOPSIS */ int qse_str_yield ( - qse_str_t* str /* a dynamic string */, - qse_xstr_t* buf /* the pointer to a qse_xstr_t variable */, - int new_capa /* new capacity in number of characters */ + qse_str_t* str /* a dynamic string */, + qse_xstr_t* buf /* the pointer to a qse_xstr_t variable */, + int new_capa /* new capacity in number of characters */ ); /******/ -void* qse_str_getxtn ( - qse_str_t* str -); - -qse_mmgr_t* qse_str_getmmgr ( - qse_str_t* str -); - -void qse_str_setmmgr ( - qse_str_t* str, - qse_mmgr_t* mmgr -); - -/* - * NAME: get the sizer - * - * DESCRIPTION: - * The qse_str_getsizer() function returns the sizer specified. - * - * RETURNS: a sizer function set or QSE_NULL if no sizer is set. +/****f* cmn/qse_str_getsizer + * NAME + * qse_str_getsizer - get the sizer + * RETURN + * a sizer function set or QSE_NULL if no sizer is set. */ qse_str_sizer_t qse_str_getsizer ( - qse_str_t* str /* a dynamic string */ + qse_str_t* str ); +/******/ -/* - * NAME: specify a sizer - * - * DESCRIPTION: +/****f* cmn/qse_str_setsizer + * NAME + * qse_str_setsizer - specify a sizer + * DESCRIPTION * The qse_str_setsizer() function specify a new sizer for a dynamic string. * With no sizer specified, the dynamic string doubles the current buffer * when it needs to increase its size. The sizer function is passed a dynamic * string and the minimum capacity required to hold data after resizing. * The string is truncated if the sizer function returns a smaller number * than the hint passed. + * SYNOPSIS */ void qse_str_setsizer ( - qse_str_t* str /* a dynamic string */, - qse_str_sizer_t sizer /* a sizer function */ + qse_str_t* str, + qse_str_sizer_t sizer ); +/******/ /* * NAME: get capacity @@ -396,10 +380,9 @@ qse_size_t qse_str_nccat ( qse_size_t len ); -/****f* qse.cmn.str/qse_strspl +/****f* cmn/qse_strspl * NAME * qse_strspl - split a string - * * SYNOPSIS */ int qse_strspl ( @@ -411,10 +394,9 @@ int qse_strspl ( ); /******/ -/****f* qse.cmn.str/qse_mbstowcs +/****f* cmn/qse_mbstowcs * NAME * qse_mbstowcs - convert a multibyte string to a wide character string - * * SYNOPSIS */ qse_size_t qse_mbstowcs ( @@ -424,13 +406,11 @@ qse_size_t qse_mbstowcs ( ); /******/ -/****f* qse.cmn.str/qse_mbsntowcsn +/****f* cmn/qse_mbsntowcsn * NAME * qse_mbsntowcsn - convert a multibyte string to a wide character string - * * RETURN * The qse_mbstowcs() function returns the number of bytes handled. - * * SYNOPSIS */ qse_size_t qse_mbsntowcsn ( @@ -441,20 +421,17 @@ qse_size_t qse_mbsntowcsn ( ); /******/ -/****f* qse.cmn.str/qse_wcstombslen +/****f* cmn/qse_wcstombslen * NAME * qse_wcstombslen - get the length - * * DESCRIPTION * The qse_wcstombslen() function scans a null-terminated wide character * string to get the total number of multibyte characters that it can be * converted to. The resulting number of characters is stored into memory * pointed to by mbslen. - * * RETURN * The qse_wcstombslen() function returns the number of wide characters * handled. - * * SYNOPSIS */ qse_size_t qse_wcstombslen ( @@ -463,20 +440,17 @@ qse_size_t qse_wcstombslen ( ); /******/ -/****f* qse.cmn.str/qse_wcsntombsnlen +/****f* cmn/qse_wcsntombsnlen * NAME * qse_wcsntombsnlen - get the length - * * DESCRIPTION * The qse_wcsntombsnlen() function scans a wide character wcs as long as * wcslen characters to get the get the total number of multibyte characters * that it can be converted to. The resulting number of characters is stored * into memory pointed to by mbslen. - * * RETURN * The qse_wcsntombsnlen() function returns the number of wide characters * handled. - * * SYNOPSIS */ qse_size_t qse_wcsntombsnlen ( @@ -486,10 +460,9 @@ qse_size_t qse_wcsntombsnlen ( ); /******/ -/****f* qse.cmn.str/qse_wcstombs +/****f* cmn/qse_wcstombs * NAME * qse_wcstombs - convert a wide character string to a multibyte string. - * * DESCRIPTION * The qse_wcstombs() function converts a null-terminated wide character * string to a multibyte string and stores it into the buffer pointed to @@ -499,10 +472,8 @@ qse_size_t qse_wcsntombsnlen ( * It may not null-terminate the resulting multibyte string if the buffer * is not large enough. You can check if the resulting mbslen is equal to * the input mbslen to know it. - * * RETURN * The qse_wcstombs() function returns the number of wide characters handled. - * * SYNOPSIS */ qse_size_t qse_wcstombs ( @@ -510,14 +481,13 @@ qse_size_t qse_wcstombs ( qse_mchar_t* mbs, qse_size_t* mbslen ); +/******/ -/****f* qse.cmn.str/qse_wcsntombsn +/****f* cmn/qse_wcsntombsn * NAME * qse_wcstombs - convert a wide character string to a multibyte string - * * RETURN * The qse_wcstombs() function returns the number of wide characters handled. - * * SYNOPSIS */ qse_size_t qse_wcsntombsn ( @@ -528,15 +498,13 @@ qse_size_t qse_wcsntombsn ( ); /******/ -/****f* qse.cmn.str/qse_wcstombs_strict +/****f* cmn/qse_wcstombs_strict * NAME * qse_wcstombs_strict - convert a wide character string to a multibyte string. - * * DESCRIPTION * The qse_wcstombs_strict() function performs the same as the qse_wcsmbs() * function except that it returns an error if it can't fully convert the * input string and/or the buffer is not large enough. - * * RETURN * The qse_wcstombs_strict() function returns 0 on success and -1 on failure. * SYNOPSIS diff --git a/qse/include/qse/cmn/time.h b/qse/include/qse/cmn/time.h index 74fc4cac..070372c6 100644 --- a/qse/include/qse/cmn/time.h +++ b/qse/include/qse/cmn/time.h @@ -72,10 +72,9 @@ struct qse_btime_t extern "C" { #endif -/****f* qse.cmn/qse_gettime +/****f* qse.cmn.time/qse_gettime * NAME * qse_gettime - get the current time - * * SYNPOSIS */ int qse_gettime ( @@ -83,10 +82,9 @@ int qse_gettime ( ); /******/ -/****f* qse.cmn/qse_settime +/****f* qse.cmn.time/qse_settime * NAME * qse_settime - set the current time - * * SYNOPSIS */ int qse_settime ( @@ -95,10 +93,9 @@ int qse_settime ( /******/ -/****f* qse.cmn/qse_gmtime +/****f* qse.cmn.time/qse_gmtime * NAME * qse_gmtime - convert numeric time to broken-down time - * * SYNOPSIS */ int qse_gmtime ( @@ -107,10 +104,9 @@ int qse_gmtime ( ); /******/ -/****f* qse.cmn/qse_localtime +/****f* qse.cmn.time/qse_localtime * NAME * qse_localtime - convert numeric time to broken-down time - * * SYNOPSIS */ int qse_localtime ( @@ -119,7 +115,7 @@ int qse_localtime ( ); /******/ -/****f* qse.cmn/qse_timegm +/****f* qse.cmn.time/qse_timegm * NAME * qse_timegm - convert broken-down time to numeric time * @@ -131,7 +127,7 @@ int qse_timegm ( ); /******/ -/****f* qse.cmn/qse_timelocal +/****f* qse.cmn.time/qse_timelocal * NAME * qse_timelocal - convert broken-down time to numeric time * @@ -143,7 +139,7 @@ int qse_timelcoal ( ); /******/ -/****f* qse.cmn/qse_strftime +/****f* qse.cmn.time/qse_strftime * NAME * qse_strftime - format time * diff --git a/qse/include/qse/cmn/tio.h b/qse/include/qse/cmn/tio.h index 68f94d11..590bacf6 100644 --- a/qse/include/qse/cmn/tio.h +++ b/qse/include/qse/cmn/tio.h @@ -60,32 +60,35 @@ enum QSE_TIO_IO_DATA }; - -#define QSE_TIO_MMGR(tio) ((tio)->mmgr) -#define QSE_TIO_XTN(s) ((void*)(((qse_tio_t*)s) + 1)) #define QSE_TIO_ERRNUM(tio) ((tio)->errnum) -/* - * TYPE: qse_tio_t - * Defines the tio type - * - * DESCRIPTION: - * defines a generic type for text-based IO. When qse_char_t is - * qse_mchar_t, it handles any byte streams. When qse_char_t is qse_wchar_t, - * it handles utf-8 byte streams. - */ typedef struct qse_tio_t qse_tio_t; -/* - * TYPE: qse_tio_io_t - * Defines a user-defines IO handler +/****t* cmn/qse_tio_io_t + * NAME + * qse_tio_io_t - define a text IO handler type + * SYNOPSIS */ typedef qse_ssize_t (*qse_tio_io_t) ( - int cmd, void* arg, void* data, qse_size_t size); + int cmd, + void* arg, + void* data, + qse_size_t size +); +/******/ +/****s* cmn/qse_tio_t + * NAME + * qse_tio_t - define a text IO type + * DESCRIPTION + * The qse_tio_t type defines a generic type for text IO. When qse_char_t is + * qse_mchar_t, it handles any byte streams. When qse_char_t is qse_wchar_t, + * it handles a multi-byte stream converted to a wide character stream. + * SYNOPSIS + */ struct qse_tio_t { - QSE_DEFINE_STD_FIELDS (tio) + QSE_DEFINE_COMMON_FIELDS (tio) qse_tio_err_t errnum; /* io functions */ @@ -103,38 +106,57 @@ struct qse_tio_t qse_mchar_t inbuf[QSE_TIO_MAX_INBUF_LEN]; qse_mchar_t outbuf[QSE_TIO_MAX_OUTBUF_LEN]; }; +/******/ #ifdef __cplusplus extern "C" { #endif -QSE_DEFINE_STD_FUNCTIONS (tio) +QSE_DEFINE_COMMON_FUNCTIONS (tio) -/* - * FUNCTION: qse_tio_open +/****f* cmn/qse_tio_open + * NAME + * qse_tio_open - create an text IO processor + * SYNOPSIS */ qse_tio_t* qse_tio_open ( qse_mmgr_t* mmgr, qse_size_t ext ); +/******/ -/* - * FUNCTION: qse_tio_close +/****f* cmn/qse_tio_close + * NAME + * qse_tio_close - destroy an text IO processor + * SYNOPSIS */ int qse_tio_close ( qse_tio_t* tio ); +/******/ +/****f* cmn/qse_tio_init + * NAME + * qse_tio_init - initialize an text IO processor + * SYNOPSIS + */ qse_tio_t* qse_tio_init ( qse_tio_t* tip, qse_mmgr_t* mmgr ); +/******/ +/****f* cmn/qse_tio_fini + * NAME + * qse_tio_fini - finalize an text IO processor + * SYNOPSIS + */ int qse_tio_fini ( qse_tio_t* tio ); +/******/ -/****f* qse.cmn.tio/qse_tio_geterrnum +/****f* cmn/qse_tio_geterrnum * NAME * qse_tio_geterrnum - get an error code * @@ -145,92 +167,75 @@ qse_tio_err_t qse_tio_geterrnum ( ); /******/ -/* - * FUNCTION: qse_tio_geterrstr - * Translates an error code to a string - * - * PARAMETERS: - * tio - a tio object - * - * RETURNS: - * A pointer to a constant string describing the last error occurred +/****f* cmn/qse_tio_geterrmsg + * NAME + * qse_tio_geterrmsg - translate an error code to a string + * RETURN + * A pointer to a constant string describing the last error occurred. */ -const qse_char_t* qse_tio_geterrstr ( +const qse_char_t* qse_tio_geterrmsg ( qse_tio_t* tio ); +/******/ -/* - * FUNCTION: qse_tio_attachin - * Attaches an input handler function - * - * PARAMETERS: - * tio - a tio object - * input - input handler function - * arg - user data to be passed to the input handler - * - * RETURNS: +/****f* cmn/qse_tio_attachin + * NAME + * qse_tio_attachin - attaches an input handler + * RETURN * 0 on success, -1 on failure + * SYNOPSIS */ int qse_tio_attachin ( qse_tio_t* tio, qse_tio_io_t input, void* arg ); +/******/ -/* - * FUNCTION: qse_tio_detachin - * Detaches an input handler function - * - * PARAMETERS: - * tio - a tio object - * - * RETURNS: +/****f* cmn/qse_tio_detachin + * NAME + * qse_tio_detachin - detach an input handler + * RETURN * 0 on success, -1 on failure + * SYNOPSIS */ int qse_tio_detachin ( qse_tio_t* tio ); +/******/ -/* - * FUNCTION: qse_tio_attachout - * Attaches an output handler function - * - * PARAMETERS: - * tio - a tio object - * output - output handler function - * arg - user data to be passed to the output handler - * - * RETURNS: +/****f* cmn/qse_tio_attachout + * NAME + * qse_tio_attachout - attaches an output handler + * RETURN * 0 on success, -1 on failure + * SYNOPSIS */ int qse_tio_attachout ( qse_tio_t* tio, qse_tio_io_t output, void* arg ); +/******/ -/* - * FUNCTION: qse_tio_detachout - * Detaches an output handler function - * - * PARAMETERS: - * tio - a tio object - * - * RETURNS: +/****f* cmn/qse_tio_detachout + * NAME + * qse_tio_detachout - detaches an output handler + * RETURN * 0 on success, -1 on failure + * SYNOPSIS */ int qse_tio_detachout ( qse_tio_t* tio ); +/******/ -/****f* qse.cmn.tio/qse_tio_flush +/****f* cmn/qse_tio_flush * NAME * qse_tio_flush - flush the output buffer - * * RETURNS * The qse_tio_flush() function return the number of bytes written on * success, -1 on failure. - * * SYNOPSIS */ qse_ssize_t qse_tio_flush ( @@ -238,10 +243,9 @@ qse_ssize_t qse_tio_flush ( ); /******/ -/****f* qse.cmn.tio/qse_tio_purge +/****f* cmn/qse_tio_purge * NAME - * qse_tio_purge - erase input and output buffered - * + * qse_tio_purge - empty input and output buffers * SYNOPSIS */ void qse_tio_purge ( @@ -249,10 +253,9 @@ void qse_tio_purge ( ); /******/ -/****f* qse.cmn.tio/qse_tio_read +/****f* cmn/qse_tio_read * NAME * qse_tio_read - read text - * * SYNOPSIS */ qse_ssize_t qse_tio_read ( @@ -262,14 +265,12 @@ qse_ssize_t qse_tio_read ( ); /******/ -/****f* qse.cmn.tio/qse_tio_write +/****f* cmn/qse_tio_write * NAME * qse_tio_write - write text - * * DESCRIPTION * If the size paramenter is (qse_size_t)-1, the function treats the data * parameter as a pointer to a null-terminated string. - * * SYNOPSIS */ qse_ssize_t qse_tio_write ( diff --git a/qse/include/qse/macros.h b/qse/include/qse/macros.h index 241f92eb..11d506d9 100644 --- a/qse/include/qse/macros.h +++ b/qse/include/qse/macros.h @@ -16,7 +16,7 @@ # define QSE_NULL ((void*)0) #endif -/****d* ase/QSE_TRUE,QSE_FALSE +/****d* qse/QSE_TRUE,qse/QSE_FALSE * NAME * QSE_TRUE - represent a boolean true * QSE_FALSE - represent a boolean false @@ -26,7 +26,7 @@ #define QSE_FALSE (0 != 0) -/****d* ase/QSE_ALIVE,QSE_ZOMBIE,QSE_DEAD +/****d* qse/QSE_ALIVE,qse/QSE_ZOMBIE,qse/QSE_DEAD * NAME * QSE_ALIVE - represent a living state * QSE_ZOMBIE - represent a zombie state @@ -38,8 +38,8 @@ #define QSE_DEAD -1 -#define AES_MCHAR_EOF ((qse_mcint_t)-1) -#define AES_WCHAR_EOF ((qse_wcint_t)-1) +#define QSE_MCHAR_EOF ((qse_mcint_t)-1) +#define QSE_WCHAR_EOF ((qse_wcint_t)-1) #define QSE_CHAR_EOF ((qse_cint_t)-1) #define QSE_SIZEOF(n) (sizeof(n)) @@ -157,15 +157,32 @@ # define QSE_END_NAMESPACE2(y,x) }} #endif -#define QSE_DEFINE_STD_FIELDS(name) \ +/****d* qse/QSE_DEFINE_COMMON_FIELDS + * NAME + * QSE_DEFINE_COMMON_FIELDS - define common fields + * SYNOPSIS + */ +#define QSE_DEFINE_COMMON_FIELDS(name) \ qse_mmgr_t* mmgr; +/******/ -#define QSE_DEFINE_STD_FUNCTIONS(name) \ +/****d* qse/QSE_DEFINE_COMMON_FUNCTIONS + * NAME + * QSE_DEFINE_COMMON_FUNCTIONS - define common functions + * SYNOPSIS + */ +#define QSE_DEFINE_COMMON_FUNCTIONS(name) \ 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); +/******/ -#define QSE_IMPLEMENT_STD_FUNCTIONS(name) \ +/****d* qse/QSE_IMPLEMENT_COMMON_FUNCTIONS + * NAME + * QSE_IMPLEMENT_COMMON_FUNCTIONS - implement common functions + * SYNOPSIS + */ +#define QSE_IMPLEMENT_COMMON_FUNCTIONS(name) \ void qse_##name##_setmmgr (qse_##name##_t* name, qse_mmgr_t* mmgr) \ { \ name->mmgr = mmgr; \ @@ -178,5 +195,6 @@ void* qse_##name##_getxtn (qse_##name##_t* name) \ { \ return (void*)(name + 1); \ } +/******/ #endif diff --git a/qse/include/qse/types.h b/qse/include/qse/types.h index 6ef719b6..a70c83f0 100644 --- a/qse/include/qse/types.h +++ b/qse/include/qse/types.h @@ -7,7 +7,7 @@ #ifndef _QSE_TYPES_H_ #define _QSE_TYPES_H_ -/****o* ase/basic types +/****o* qse/basic types * DESCRIPTION * defines various common basic types. They are designed to be * cross-platform. These types are preferred over native data types in many @@ -30,7 +30,7 @@ # error unsupported operating system #endif -/****t* ase/qse_bool_t +/****t* qse/qse_bool_t * NAME * qse_bool_t - define a boolean type * DESCRIPTION @@ -40,7 +40,7 @@ */ typedef int qse_bool_t; -/****t* ase/qse_tri_t +/****t* qse/qse_tri_t * NAME * qse_tri_t - define a tri-state type * DESCRIPTION @@ -50,7 +50,7 @@ typedef int qse_bool_t; */ typedef int qse_tri_t; -/****t* ase/qse_int_t,qse_uint_t +/****t* qse/qse_int_t,qse/qse_uint_t * NAME * qse_int_t - define a signed integer type as large as a pointer type * qse_uint_t - define an unsigned integer type as large as a pointer type @@ -82,7 +82,7 @@ typedef int qse_tri_t; # error unsupported pointer size #endif -/****t* ase/qse_long_t,qse_ulong_t +/****t* qse/qse_long_t,qse/qse_ulong_t * NAME * qse_long_t - define the largest signed integer type supported * qse_ulong_t - define the largest unsigned integer type supported @@ -99,7 +99,7 @@ typedef int qse_tri_t; typedef unsigned long qse_ulong_t; #endif -/****t* ase/qse_int8_t,qse_uint8_t +/****t* qse/qse_int8_t,qse/qse_uint8_t * NAME * qse_int8_t - define an 8-bit signed integer type * qse_uint8_t - define an 8-bit unsigned integer type @@ -113,7 +113,7 @@ typedef int qse_tri_t; typedef unsigned __int8 qse_uint8_t; #endif -/****t* ase/qse_int16_t,qse_uint16_t +/****t* qse/qse_int16_t,qse/qse_uint16_t * NAME * qse_int16_t - define a 16-bit signed integer type * qse_uint16_t - define a 16-bit unsigned integer type @@ -127,7 +127,7 @@ typedef int qse_tri_t; typedef unsigned __int16 qse_uint16_t; #endif -/****t* ase/qse_int32_t,qse_uint32_t +/****t* qse/qse_int32_t,qse/qse_uint32_t * NAME * qse_int32_t - define a 32-bit signed integer type * qse_uint32_t - define a 32-bit unsigned integer type @@ -144,7 +144,7 @@ typedef int qse_tri_t; typedef unsigned __int32 qse_uint32_t; #endif -/****t* ase/qse_int64_t,qse_uint64_t +/****t* qse/qse_int64_t,qse/qse_uint64_t * NAME * qse_int64_t - define a 64-bit signed integer type * qse_uint64_t - define a 64-bit unsigned integer type @@ -194,14 +194,14 @@ typedef int qse_tri_t; typedef unsigned __int128 qse_uint128_t; #endif -/****t* ase/qse_byte_t +/****t* qse/qse_byte_t * NAME * qse_byte_t - define a byte type ****** */ typedef qse_uint8_t qse_byte_t; -/****t* ase/qse_size_t +/****t* qse/qse_size_t * NAME * qse_size_t - define an unsigned integer type that can hold a pointer value ****** @@ -212,14 +212,14 @@ typedef qse_uint8_t qse_byte_t; typedef qse_uint_t qse_size_t; #endif -/****t* ase/qse_ssize_t +/****t* qse/qse_ssize_t * NAME * qse_ssize_t - define an signed integer type that can hold a pointer value ****** */ typedef qse_int_t qse_ssize_t; -/****t* ase/qse_word_t +/****t* qse/qse_word_t * NAME * qse_word_t - define an integer type identical to qse_uint_t ****** @@ -240,7 +240,7 @@ typedef qse_uint_t qse_word_t; typedef double qse_real_t; #endif -/****t* ase/qse_mchar_t,qse_mcint_t +/****t* qse/qse_mchar_t,qse/qse_mcint_t * NAME * qse_mchar_t - define a multi-byte character * qse_mcint_t - define a type that can hold qse_mchar_t and QSE_MCHAR_EOF @@ -249,7 +249,7 @@ typedef qse_uint_t qse_word_t; typedef char qse_mchar_t; typedef int qse_mcint_t; -/****t* ase/qse_wchar_t,qse_wcint_t +/****t* qse/qse_wchar_t,qse/qse_wcint_t * NAME * qse_wchar_t - define a wide character * qse_wcint_t - define a type that can hold qse_wchar_t and QSE_WCHAR_EOF @@ -308,7 +308,7 @@ typedef int qse_mcint_t; # error unsupported size of wchar_t #endif -/****t* ase/qse_char_t,qse_cint_t +/****t* qse/qse_char_t,qse/qse_cint_t * NAME * qse_char_t - define a character * qse_cint_t - define a type that can hold qse_char_t and QSE_CHAR_EOF @@ -350,10 +350,9 @@ typedef struct qse_cstr_t qse_cstr_t; typedef struct qse_mmgr_t qse_mmgr_t; typedef struct qse_ccls_t qse_ccls_t; -/****t* ase/qse_xstr_t +/****t* qse/qse_xstr_t * NAME * qse_xstr_t - combine a pointer and length - * * SYNOPSIS */ struct qse_xstr_t @@ -363,10 +362,9 @@ struct qse_xstr_t }; /******/ -/****t* ase/qse_cstr_t +/****t* qse/qse_cstr_t * NAME * qse_cstr_t - combine a constant pointer and length - * * SYNOPSIS */ struct qse_cstr_t @@ -376,10 +374,9 @@ struct qse_cstr_t }; /******/ -/****t* ase/qse_mmgr_t +/****t* qse/qse_mmgr_t * NAME * qse_mmgr_t - define a memory manager - * * SYNOPSIS */ struct qse_mmgr_t @@ -391,10 +388,9 @@ struct qse_mmgr_t }; /******/ -/****t* ase/qse_ccls_type_t +/****t* qse/qse_ccls_type_t * NAME * qse_ccls_type_t - define character class types - * * SYNOPSIS */ enum qse_ccls_type_t @@ -415,10 +411,9 @@ enum qse_ccls_type_t typedef enum qse_ccls_type_t qse_ccls_type_t; -/****t* ase/qse_ccls_t +/****t* qse/qse_ccls_t * NAME - * qse_mmgr_t - define a character class handler - * + * qse_mmgr_t - define a character classifier * SYNOPSIS */ struct qse_ccls_t diff --git a/qse/lib/awk/Awk.cpp b/qse/lib/awk/Awk.cpp index a54913f8..7f83465d 100644 --- a/qse/lib/awk/Awk.cpp +++ b/qse/lib/awk/Awk.cpp @@ -92,7 +92,7 @@ Awk::EIO::operator Awk::eio_t* () const Awk::EIO::operator Awk::run_t* () const { - return eio->run; + return eio->rtx; } ////////////////////////////////////////////////////////////////// @@ -142,12 +142,12 @@ int Awk::Console::setFileName (const char_t* name) if (eio->mode == READ) { return qse_awk_rtx_setfilename ( - eio->run, name, qse_strlen(name)); + eio->rtx, name, qse_strlen(name)); } else { return qse_awk_rtx_setofilename ( - eio->run, name, qse_strlen(name)); + eio->rtx, name, qse_strlen(name)); } } @@ -156,12 +156,12 @@ int Awk::Console::setFNR (long_t fnr) qse_awk_val_t* tmp; int n; - tmp = qse_awk_rtx_makeintval (eio->run, fnr); + tmp = qse_awk_rtx_makeintval (eio->rtx, fnr); if (tmp == QSE_NULL) return -1; - qse_awk_rtx_refupval (eio->run, tmp); - n = qse_awk_rtx_setglobal (eio->run, QSE_AWK_GLOBAL_FNR, tmp); - qse_awk_rtx_refdownval (eio->run, tmp); + qse_awk_rtx_refupval (eio->rtx, tmp); + n = qse_awk_rtx_setglobal (eio->rtx, QSE_AWK_GLOBAL_FNR, tmp); + qse_awk_rtx_refdownval (eio->rtx, tmp); return n; } @@ -1204,7 +1204,7 @@ int Awk::open () return -1; } - *(Awk**)QSE_MAP_XTN(functionMap) = this; + *(Awk**)qse_map_getxtn(functionMap) = this; qse_map_setcopier (functionMap, QSE_MAP_KEY, QSE_MAP_COPIER_INLINE); qse_map_setfreeer (functionMap, QSE_MAP_VAL, freeFunctionMapValue); qse_map_setscale (functionMap, QSE_MAP_KEY, QSE_SIZEOF(qse_char_t)); @@ -1402,7 +1402,7 @@ int Awk::run (const char_t* main, const char_t** args, size_t nargs) void Awk::stop () { QSE_ASSERT (awk != QSE_NULL); - qse_awk_rtx_stopall (awk); + qse_awk_stopall (awk); } int Awk::dispatchFunction (Run* run, const char_t* name, size_t len) @@ -1717,7 +1717,7 @@ int Awk::functionHandler ( void Awk::freeFunctionMapValue (map_t* map, void* dptr, size_t dlen) { //Awk* awk = (Awk*)owner; - Awk* awk = *(Awk**)QSE_MAP_XTN(map); + Awk* awk = *(Awk**)qse_map_getxtn(map); qse_awk_free (awk->awk, dptr); } diff --git a/qse/lib/awk/awk.c b/qse/lib/awk/awk.c index ae6ca1a4..fb77f041 100644 --- a/qse/lib/awk/awk.c +++ b/qse/lib/awk/awk.c @@ -35,7 +35,7 @@ static void free_fun (qse_map_t* map, void* vptr, qse_size_t vlen) { - qse_awk_t* awk = *(qse_awk_t**)QSE_MAP_XTN(map); + qse_awk_t* awk = *(qse_awk_t**)qse_map_getxtn(map); qse_awk_fun_t* f = (qse_awk_fun_t*)vptr; /* f->name doesn't have to be freed */ @@ -47,7 +47,7 @@ static void free_fun (qse_map_t* map, void* vptr, qse_size_t vlen) static void free_fnc (qse_map_t* map, void* vptr, qse_size_t vlen) { - qse_awk_t* awk = *(qse_awk_t**)QSE_MAP_XTN(map); + qse_awk_t* awk = *(qse_awk_t**)qse_map_getxtn(map); qse_awk_fnc_t* f = (qse_awk_fnc_t*)vptr; QSE_AWK_FREE (awk, f); @@ -78,7 +78,7 @@ qse_awk_t* qse_awk_open (qse_mmgr_t* mmgr, qse_size_t ext) awk->wtab = qse_map_open (mmgr, QSE_SIZEOF(awk), 512, 70); if (awk->wtab == QSE_NULL) goto oops; - *(qse_awk_t**)QSE_MAP_XTN(awk->wtab) = awk; + *(qse_awk_t**)qse_map_getxtn(awk->wtab) = awk; qse_map_setcopier (awk->wtab, QSE_MAP_KEY, QSE_MAP_COPIER_INLINE); qse_map_setcopier (awk->wtab, QSE_MAP_VAL, QSE_MAP_COPIER_INLINE); qse_map_setscale (awk->wtab, QSE_MAP_KEY, QSE_SIZEOF(qse_char_t)); @@ -86,7 +86,7 @@ qse_awk_t* qse_awk_open (qse_mmgr_t* mmgr, qse_size_t ext) awk->rwtab = qse_map_open (mmgr, QSE_SIZEOF(awk), 512, 70); if (awk->rwtab == QSE_NULL) goto oops; - *(qse_awk_t**)QSE_MAP_XTN(awk->rwtab) = awk; + *(qse_awk_t**)qse_map_getxtn(awk->rwtab) = awk; qse_map_setcopier (awk->rwtab, QSE_MAP_KEY, QSE_MAP_COPIER_INLINE); qse_map_setcopier (awk->rwtab, QSE_MAP_VAL, QSE_MAP_COPIER_INLINE); qse_map_setscale (awk->rwtab, QSE_MAP_KEY, QSE_SIZEOF(qse_char_t)); @@ -95,21 +95,21 @@ qse_awk_t* qse_awk_open (qse_mmgr_t* mmgr, qse_size_t ext) /* TODO: initial map size?? */ awk->tree.funs = qse_map_open (mmgr, QSE_SIZEOF(awk), 512, 70); if (awk->tree.funs == QSE_NULL) goto oops; - *(qse_awk_t**)QSE_MAP_XTN(awk->tree.funs) = awk; + *(qse_awk_t**)qse_map_getxtn(awk->tree.funs) = awk; qse_map_setcopier (awk->tree.funs, QSE_MAP_KEY, QSE_MAP_COPIER_INLINE); qse_map_setfreeer (awk->tree.funs, QSE_MAP_VAL, free_fun); qse_map_setscale (awk->tree.funs, QSE_MAP_KEY, QSE_SIZEOF(qse_char_t)); awk->parse.funs = qse_map_open (mmgr, QSE_SIZEOF(awk), 256, 70); if (awk->parse.funs == QSE_NULL) goto oops; - *(qse_awk_t**)QSE_MAP_XTN(awk->parse.funs) = awk; + *(qse_awk_t**)qse_map_getxtn(awk->parse.funs) = awk; qse_map_setcopier (awk->parse.funs, QSE_MAP_KEY, QSE_MAP_COPIER_INLINE); qse_map_setcopier (awk->parse.funs, QSE_MAP_VAL, QSE_MAP_COPIER_INLINE); qse_map_setscale (awk->parse.funs, QSE_MAP_KEY, QSE_SIZEOF(qse_char_t)); awk->parse.named = qse_map_open (mmgr, QSE_SIZEOF(awk), 256, 70); if (awk->parse.named == QSE_NULL) goto oops; - *(qse_awk_t**)QSE_MAP_XTN(awk->parse.named) = awk; + *(qse_awk_t**)qse_map_getxtn(awk->parse.named) = awk; qse_map_setcopier (awk->parse.named, QSE_MAP_KEY, QSE_MAP_COPIER_INLINE); qse_map_setcopier (awk->parse.named, QSE_MAP_VAL, QSE_MAP_COPIER_INLINE); qse_map_setscale (awk->parse.named, QSE_MAP_KEY, QSE_SIZEOF(qse_char_t)); @@ -122,15 +122,15 @@ qse_awk_t* qse_awk_open (qse_mmgr_t* mmgr, qse_size_t ext) awk->parse.locals == QSE_NULL || awk->parse.params == QSE_NULL) goto oops; - *(qse_awk_t**)QSE_LDA_XTN(awk->parse.globals) = awk; + *(qse_awk_t**)qse_lda_getxtn(awk->parse.globals) = awk; qse_lda_setcopier (awk->parse.globals, QSE_LDA_COPIER_INLINE); qse_lda_setscale (awk->parse.globals, QSE_SIZEOF(qse_char_t)); - *(qse_awk_t**)QSE_LDA_XTN(awk->parse.locals) = awk; + *(qse_awk_t**)qse_lda_getxtn(awk->parse.locals) = awk; qse_lda_setcopier (awk->parse.locals, QSE_LDA_COPIER_INLINE); qse_lda_setscale (awk->parse.locals, QSE_SIZEOF(qse_char_t)); - *(qse_awk_t**)QSE_LDA_XTN(awk->parse.params) = awk; + *(qse_awk_t**)qse_lda_getxtn(awk->parse.params) = awk; qse_lda_setcopier (awk->parse.params, QSE_LDA_COPIER_INLINE); qse_lda_setscale (awk->parse.params, QSE_SIZEOF(qse_char_t)); @@ -168,7 +168,7 @@ qse_awk_t* qse_awk_open (qse_mmgr_t* mmgr, qse_size_t ext) awk->fnc.sys = QSE_NULL; awk->fnc.user = qse_map_open (mmgr, QSE_SIZEOF(awk), 512, 70); if (awk->fnc.user == QSE_NULL) goto oops; - *(qse_awk_t**)QSE_MAP_XTN(awk->fnc.user) = awk; + *(qse_awk_t**)qse_map_getxtn(awk->fnc.user) = awk; qse_map_setcopier (awk->fnc.user, QSE_MAP_KEY, QSE_MAP_COPIER_INLINE); qse_map_setfreeer (awk->fnc.user, QSE_MAP_VAL, free_fnc); qse_map_setscale (awk->fnc.user, QSE_MAP_KEY, QSE_SIZEOF(qse_char_t)); @@ -366,7 +366,7 @@ void qse_awk_setoption (qse_awk_t* awk, int opt) } -void qse_awk_rtx_stopall (qse_awk_t* awk) +void qse_awk_stopall (qse_awk_t* awk) { awk->stopall = QSE_TRUE; } @@ -448,7 +448,8 @@ int qse_awk_setword (qse_awk_t* awk, return 0; } -/* TODO: XXXX */ +#if 0 +/* TODO: qse_awk_setrexfns... */ int qse_awk_setrexfns (qse_awk_t* awk, qse_awk_rexfns_t* rexfns) { if (rexfns->build == QSE_NULL || @@ -463,3 +464,4 @@ int qse_awk_setrexfns (qse_awk_t* awk, qse_awk_rexfns_t* rexfns) awk->rexfns = rexfns; return 0; } +#endif diff --git a/qse/lib/awk/parse.c b/qse/lib/awk/parse.c index ed33a397..e627d76a 100644 --- a/qse/lib/awk/parse.c +++ b/qse/lib/awk/parse.c @@ -1445,7 +1445,7 @@ struct check_global_t static qse_lda_walk_t check_global (qse_lda_t* lda, qse_size_t index, void* arg) { qse_cstr_t tmp; - qse_awk_t* awk = *(qse_awk_t**)QSE_LDA_XTN(lda); + qse_awk_t* awk = *(qse_awk_t**)qse_lda_getxtn(lda); check_global_t* cg = (check_global_t*)arg; tmp.ptr = QSE_LDA_DPTR(lda,index); diff --git a/qse/lib/awk/run.c b/qse/lib/awk/run.c index 07365410..4de53747 100644 --- a/qse/lib/awk/run.c +++ b/qse/lib/awk/run.c @@ -740,13 +740,13 @@ qse_bool_t qse_awk_rtx_shouldstop (qse_awk_rtx_t* run) static void free_namedval (qse_map_t* map, void* dptr, qse_size_t dlen) { qse_awk_rtx_refdownval ( - *(qse_awk_rtx_t**)QSE_MAP_XTN(map), dptr); + *(qse_awk_rtx_t**)qse_map_getxtn(map), dptr); } static void same_namedval (qse_map_t* map, void* dptr, qse_size_t dlen) { qse_awk_rtx_refdownval_nofree ( - *(qse_awk_rtx_t**)QSE_MAP_XTN(map), dptr); + *(qse_awk_rtx_t**)qse_map_getxtn(map), dptr); } static int init_run ( @@ -813,7 +813,7 @@ static int init_run ( qse_awk_seterror (awk, QSE_AWK_ENOMEM, 0, QSE_NULL, 0); return -1; } - *(qse_awk_rtx_t**)QSE_MAP_XTN(run->named) = run; + *(qse_awk_rtx_t**)qse_map_getxtn(run->named) = run; qse_map_setcopier (run->named, QSE_MAP_KEY, QSE_MAP_COPIER_INLINE); qse_map_setfreeer (run->named, QSE_MAP_VAL, free_namedval); qse_map_setkeeper (run->named, same_namedval); diff --git a/qse/lib/awk/val.c b/qse/lib/awk/val.c index 229fb515..4c679e86 100644 --- a/qse/lib/awk/val.c +++ b/qse/lib/awk/val.c @@ -445,7 +445,7 @@ static void same_mapval (void* run, void* v) */ static void free_mapval (qse_map_t* map, void* dptr, qse_size_t dlen) { - qse_awk_rtx_t* run = *(qse_awk_rtx_t**)QSE_MAP_XTN(map); + qse_awk_rtx_t* run = *(qse_awk_rtx_t**)qse_map_getxtn(map); #ifdef DEBUG_VAL qse_dprintf (QSE_T("refdown in map free...")); @@ -458,7 +458,7 @@ static void free_mapval (qse_map_t* map, void* dptr, qse_size_t dlen) static void same_mapval (qse_map_t* map, void* dptr, qse_size_t dlen) { - qse_awk_rtx_t* run = *(qse_awk_rtx_t**)QSE_MAP_XTN(map); + qse_awk_rtx_t* run = *(qse_awk_rtx_t**)qse_map_getxtn(map); #ifdef DEBUG_VAL qse_dprintf (QSE_T("refdown nofree in map free...")); qse_awk_dprintval (run, dptr); @@ -516,7 +516,7 @@ qse_awk_val_t* qse_awk_rtx_makemapval (qse_awk_rtx_t* run) qse_awk_rtx_seterrnum (run, QSE_AWK_ENOMEM); return QSE_NULL; } - *(qse_awk_rtx_t**)QSE_MAP_XTN(val->map) = run; + *(qse_awk_rtx_t**)qse_map_getxtn(val->map) = run; /* the key is copied inline into a pair and is freed when the pair * is destroyed */ @@ -1156,7 +1156,7 @@ static qse_map_walk_t print_pair ( { qse_awk_rtx_t* run = (qse_awk_rtx_t*)arg; - QSE_ASSERT (run == *(qse_awk_rtx_t**)QSE_MAP_XTN(map)); + QSE_ASSERT (run == *(qse_awk_rtx_t**)qse_map_getxtn(map)); DPRINTF (DCUSTOM, QSE_T(" %.*s=>"), (int)QSE_MAP_KLEN(pair), QSE_MAP_KPTR(pair)); diff --git a/qse/lib/cmn/fio.c b/qse/lib/cmn/fio.c index 7d65599e..37c040fb 100644 --- a/qse/lib/cmn/fio.c +++ b/qse/lib/cmn/fio.c @@ -31,7 +31,7 @@ # include #endif -QSE_IMPLEMENT_STD_FUNCTIONS (fio) +QSE_IMPLEMENT_COMMON_FUNCTIONS (fio) static qse_ssize_t fio_input (int cmd, void* arg, void* buf, qse_size_t size); static qse_ssize_t fio_output (int cmd, void* arg, void* buf, qse_size_t size); diff --git a/qse/lib/cmn/lda.c b/qse/lib/cmn/lda.c index 83c1283f..170fe913 100644 --- a/qse/lib/cmn/lda.c +++ b/qse/lib/cmn/lda.c @@ -19,6 +19,8 @@ #include #include "mem.h" +QSE_IMPLEMENT_COMMON_FUNCTIONS (lda) + #define lda_t qse_lda_t #define node_t qse_lda_node_t #define copier_t qse_lda_copier_t @@ -150,21 +152,6 @@ void qse_lda_fini (lda_t* lda) } } -void* qse_lda_getxtn (lda_t* lda) -{ - return lda + 1; -} - -mmgr_t* qse_lda_getmmgr (lda_t* lda) -{ - return lda->mmgr; -} - -void qse_lda_setmmgr (lda_t* lda, mmgr_t* mmgr) -{ - lda->mmgr = mmgr; -} - int qse_lda_getscale (lda_t* lda) { return lda->scale; diff --git a/qse/lib/cmn/map.c b/qse/lib/cmn/map.c index 46d28152..385c7ccd 100644 --- a/qse/lib/cmn/map.c +++ b/qse/lib/cmn/map.c @@ -19,6 +19,8 @@ #include #include "mem.h" +QSE_IMPLEMENT_COMMON_FUNCTIONS (map) + #define map_t qse_map_t #define pair_t qse_map_pair_t #define copier_t qse_map_copier_t @@ -286,21 +288,6 @@ void qse_map_fini (map_t* map) QSE_MMGR_FREE (map->mmgr, map->bucket); } -void* qse_map_getxtn (map_t* map) -{ - return map + 1; -} - -mmgr_t* qse_map_getmmgr (map_t* map) -{ - return map->mmgr; -} - -void qse_map_setmmgr (map_t* map, mmgr_t* mmgr) -{ - map->mmgr = mmgr; -} - int qse_map_getscale (map_t* map, qse_map_id_t id) { QSE_ASSERTX (id == QSE_MAP_KEY || id == QSE_MAP_VAL, @@ -424,7 +411,7 @@ pair_t* qse_map_search (map_t* map, const void* kptr, size_t klen) return QSE_NULL; } -int qse_map_put ( +static int map_put ( map_t* map, void* kptr, size_t klen, void* vptr, size_t vlen, pair_t** px) { @@ -487,7 +474,7 @@ pair_t* qse_map_upsert ( int n; pair_t* px; - n = qse_map_put (map, kptr, klen, vptr, vlen, &px); + n = map_put (map, kptr, klen, vptr, vlen, &px); if (n < 0) return QSE_NULL; return px; } diff --git a/qse/lib/cmn/pio.c b/qse/lib/cmn/pio.c index 7cd72274..35c2f64d 100644 --- a/qse/lib/cmn/pio.c +++ b/qse/lib/cmn/pio.c @@ -29,7 +29,7 @@ # include #endif -QSE_IMPLEMENT_STD_FUNCTIONS (pio) +QSE_IMPLEMENT_COMMON_FUNCTIONS (pio) static qse_ssize_t pio_input (int cmd, void* arg, void* buf, qse_size_t size); static qse_ssize_t pio_output (int cmd, void* arg, void* buf, qse_size_t size); @@ -420,6 +420,8 @@ qse_pio_err_t qse_pio_geterrnum (qse_pio_t* pio) return pio->errnum; } +/* TODO: qse_pio_geterrmsg (qse_pio_t* pio) */ + const qse_char_t* qse_pio_geterrstr (qse_pio_t* pio) { static const qse_char_t* __errstr[] = diff --git a/qse/lib/cmn/sll.c b/qse/lib/cmn/sll.c index 6448c7fd..b62a6b0a 100644 --- a/qse/lib/cmn/sll.c +++ b/qse/lib/cmn/sll.c @@ -19,6 +19,8 @@ #include #include "mem.h" +QSE_IMPLEMENT_COMMON_FUNCTIONS (sll) + #define sll_t qse_sll_t #define node_t qse_sll_node_t #define copier_t qse_sll_copier_t @@ -137,21 +139,6 @@ void qse_sll_fini (sll_t* sll) qse_sll_clear (sll); } -void* qse_sll_getxtn (sll_t* sll) -{ - return sll + 1; -} - -mmgr_t* qse_sll_getmmgr (sll_t* sll) -{ - return sll->mmgr; -} - -void qse_sll_setmmgr (sll_t* sll, mmgr_t* mmgr) -{ - sll->mmgr = mmgr; -} - int qse_sll_getscale (sll_t* sll) { return sll->scale; diff --git a/qse/lib/cmn/str_dyn.c b/qse/lib/cmn/str_dyn.c index 5a82c571..300197b4 100644 --- a/qse/lib/cmn/str_dyn.c +++ b/qse/lib/cmn/str_dyn.c @@ -19,6 +19,8 @@ #include #include "mem.h" +QSE_IMPLEMENT_COMMON_FUNCTIONS (str) + qse_str_t* qse_str_open (qse_mmgr_t* mmgr, qse_size_t ext, qse_size_t capa) { qse_str_t* str; @@ -104,21 +106,6 @@ int qse_str_yield (qse_str_t* str, qse_xstr_t* buf, int new_capa) return 0; } -void* qse_str_getxtn (qse_str_t* str) -{ - return str + 1; -} - -qse_mmgr_t* qse_str_getmmgr (qse_str_t* str) -{ - return str->mmgr; -} - -void qse_str_setmmgr (qse_str_t* str, qse_mmgr_t* mmgr) -{ - str->mmgr = mmgr; -} - qse_str_sizer_t qse_str_getsizer (qse_str_t* str) { return str->sizer; diff --git a/qse/lib/cmn/tio.c b/qse/lib/cmn/tio.c index cc4ffa78..f277996b 100644 --- a/qse/lib/cmn/tio.c +++ b/qse/lib/cmn/tio.c @@ -19,7 +19,7 @@ #include #include "mem.h" -QSE_IMPLEMENT_STD_FUNCTIONS (tio) +QSE_IMPLEMENT_COMMON_FUNCTIONS (tio) qse_tio_t* qse_tio_open (qse_mmgr_t* mmgr, qse_size_t ext) { @@ -90,9 +90,9 @@ qse_tio_err_t qse_tio_geterrnum (qse_tio_t* tio) return tio->errnum; } -const qse_char_t* qse_tio_geterrstr (qse_tio_t* tio) +const qse_char_t* qse_tio_geterrmsg (qse_tio_t* tio) { - static const qse_char_t* __errstr[] = + static const qse_char_t* __errmsg[] = { QSE_T("no error"), QSE_T("out of memory"), @@ -111,9 +111,9 @@ const qse_char_t* qse_tio_geterrstr (qse_tio_t* tio) QSE_T("unknown error") }; - return __errstr[ - (tio->errnum < 0 || tio->errnum >= QSE_COUNTOF(__errstr))? - QSE_COUNTOF(__errstr) - 1: tio->errnum]; + return __errmsg[ + (tio->errnum < 0 || tio->errnum >= QSE_COUNTOF(__errmsg))? + QSE_COUNTOF(__errmsg) - 1: tio->errnum]; } int qse_tio_attachin (qse_tio_t* tio, qse_tio_io_t input, void* arg)