From 65552ff85e5d758160d4ba74c60b30a8dbe4a695 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 1 Jan 2020 14:16:01 +0000 Subject: [PATCH] minor code fix --- hawk/lib/err.c | 4 ++-- hawk/lib/generrcode.awk | 6 +++--- hawk/lib/genoptcode.awk | 6 +++--- hawk/lib/hawk-mtx.h | 2 +- hawk/lib/mod-dir.c | 24 ++++++++++++------------ hawk/lib/mod-str.c | 6 +++--- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/hawk/lib/err.c b/hawk/lib/err.c index 1f4c35a0..2b81b496 100644 --- a/hawk/lib/err.c +++ b/hawk/lib/err.c @@ -365,7 +365,7 @@ void hawk_seterror (hawk_t* hawk, hawk_errnum_t errnum, const hawk_oocs_t* errar errfmt = hawk_geterrstr(hawk)(hawk, errnum); HAWK_ASSERT (errfmt != HAWK_NULL); /* TODO: this change is buggy... copying won't process arguments... - qse_strxfncpy (hawk->_gem.errmsg, HAWK_COUNTOF(hawk->_gem.errmsg), errfmt, errarg); + hawk_strxfncpy (hawk->_gem.errmsg, HAWK_COUNTOF(hawk->_gem.errmsg), errfmt, errarg); */ hawk_copy_oocstr(hawk->_gem.errmsg, HAWK_COUNTOF(hawk->_gem.errmsg), errfmt); /* TODO: remove awk_rtx_seterror() and substitute hawk_rtx_seterrfmt()/seterrbfmt()/seterrufmt() */ @@ -542,7 +542,7 @@ void hawk_rtx_seterror (hawk_rtx_t* rtx, hawk_errnum_t errnum, const hawk_oocs_t errfmt = hawk_geterrstr(hawk_rtx_gethawk(rtx))(hawk_rtx_gethawk(rtx), errnum); HAWK_ASSERT (errfmt != HAWK_NULL); /* TODO: this change is buggy... copying won't process arguments... - qse_strxfncpy (rtx->_gem.errmsg, HAWK_COUNTOF(rtx->_gem.errmsg), errfmt, errarg); + hawk_strxfncpy (rtx->_gem.errmsg, HAWK_COUNTOF(rtx->_gem.errmsg), errfmt, errarg); */ hawk_copy_oocstr(rtx->_gem.errmsg, HAWK_COUNTOF(rtx->_gem.errmsg), errfmt); /* TODO: remove awk_rtx_seterror() and substitute hawk_rtx_seterrfmt()/seterrbfmt()/seterrufmt() */ diff --git a/hawk/lib/generrcode.awk b/hawk/lib/generrcode.awk index cf0679a4..c70c8c46 100644 --- a/hawk/lib/generrcode.awk +++ b/hawk/lib/generrcode.awk @@ -10,7 +10,7 @@ BEGIN { tab4="\t\t\t"; } -/^[[:space:]]*enum[[:space:]]+qse_awk_errnum_t[[:space:]]*$/ { +/^[[:space:]]*enum[[:space:]]+hawk_errnum_t[[:space:]]*$/ { collect=1; print tab3 "// generated by generrcode.awk"; print tab3 "enum ErrorNumber"; @@ -24,10 +24,10 @@ collect && /^[[:space:]]*};[[:space:]]*$/ { collect=0; } -collect && /^[[:space:]]*QSE_AWK_E[[:alnum:]]+/ { +collect && /^[[:space:]]*HAWK_E[[:alnum:]]+/ { split ($1, flds, ","); name=flds[1]; - print tab4 "ERR_" substr (name,10,length(name)-9) " = " name ","; + print tab4 "ERR_" substr (name,7,length(name)-6) " = " name ","; } diff --git a/hawk/lib/genoptcode.awk b/hawk/lib/genoptcode.awk index 900c5f48..a7c649ea 100644 --- a/hawk/lib/genoptcode.awk +++ b/hawk/lib/genoptcode.awk @@ -10,7 +10,7 @@ BEGIN { tab4="\t\t\t"; } -/^[[:space:]]*enum[[:space:]]+qse_awk_option_t[[:space:]]*$/ { +/^[[:space:]]*enum[[:space:]]+hawk_trait_t[[:space:]]*$/ { collect=1; print tab3 "// generated by genoptcode.awk"; print tab3 "enum Option"; @@ -24,10 +24,10 @@ collect && /^[[:space:]]*};[[:space:]]*$/ { collect=0; } -collect && /^[[:space:]]*QSE_AWK_[[:alnum:]]+/ { +collect && /^[[:space:]]*HAWK_[[:alnum:]]+/ { split ($1, flds, ","); name=flds[1]; - print tab4 "OPT_" substr (name,9,length(name)-8) " = " name ","; + print tab4 "TRAIT_" substr (name,6,length(name)-5) " = " name ","; } diff --git a/hawk/lib/hawk-mtx.h b/hawk/lib/hawk-mtx.h index 432fd5ef..ce7c7f03 100644 --- a/hawk/lib/hawk-mtx.h +++ b/hawk/lib/hawk-mtx.h @@ -12,7 +12,7 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EQSERESS OR + THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, diff --git a/hawk/lib/mod-dir.c b/hawk/lib/mod-dir.c index 626f7c51..55f92312 100644 --- a/hawk/lib/mod-dir.c +++ b/hawk/lib/mod-dir.c @@ -56,7 +56,7 @@ enum DIR_EMAPTOSCALAR }; -static int dir_err_to_errnum (qse_dir_errnum_t num) +static int dir_err_to_errnum (hawk_dir_errnum_t num) { switch (num) { @@ -100,7 +100,7 @@ static int awk_err_to_errnum (hawk_errnum_t num) } } -#define __IMAP_NODE_T_DATA qse_dir_t* ctx; +#define __IMAP_NODE_T_DATA hawk_dir_t* ctx; #define __IMAP_LIST_T_DATA int errnum; #define __IMAP_LIST_T dir_list_t #define __IMAP_NODE_T dir_node_t @@ -111,7 +111,7 @@ static int awk_err_to_errnum (hawk_errnum_t num) static dir_node_t* new_dir_node (hawk_rtx_t* rtx, dir_list_t* list, const hawk_ooch_t* path, hawk_int_t flags) { dir_node_t* node; - qse_dir_errnum_t oe; + hawk_dir_errnum_t oe; node = __new_dir_node(rtx, list); if (!node) @@ -120,7 +120,7 @@ static dir_node_t* new_dir_node (hawk_rtx_t* rtx, dir_list_t* list, const hawk_o return HAWK_NULL; } - node->ctx = qse_dir_open(hawk_rtx_getmmgr(rtx), 0, path, flags, &oe); + node->ctx = hawk_dir_open(hawk_rtx_getmmgr(rtx), 0, path, flags, &oe); if (!node->ctx) { list->errnum = dir_err_to_errnum(oe); @@ -135,7 +135,7 @@ static void free_dir_node (hawk_rtx_t* rtx, dir_list_t* list, dir_node_t* node) { if (node->ctx) { - qse_dir_close(node->ctx); + hawk_dir_close(node->ctx); node->ctx = HAWK_NULL; } __free_dir_node (rtx, list, node); @@ -160,9 +160,9 @@ static int reset_byid (hawk_rtx_t* rtx, dir_list_t* list, hawk_int_t id, const h { if (id >= 0 && id < list->map.high && list->map.tab[id]) { - if (qse_dir_reset(list->map.tab[id]->ctx, path) <= -1) + if (hawk_dir_reset(list->map.tab[id]->ctx, path) <= -1) { - list->errnum = dir_err_to_errnum (qse_dir_geterrnum (list->map.tab[id]->ctx)); + list->errnum = dir_err_to_errnum (hawk_dir_geterrnum (list->map.tab[id]->ctx)); return -1; } return 0; @@ -179,13 +179,13 @@ static int read_byid (hawk_rtx_t* rtx, dir_list_t* list, hawk_int_t id, hawk_val if (id >= 0 && id < list->map.high && list->map.tab[id]) { int y; - qse_dir_ent_t ent; + hawk_dir_ent_t ent; hawk_val_t* tmp; - y = qse_dir_read(list->map.tab[id]->ctx, &ent); + y = hawk_dir_read(list->map.tab[id]->ctx, &ent); if (y <= -1) { - list->errnum = dir_err_to_errnum(qse_dir_geterrnum (list->map.tab[id]->ctx)); + list->errnum = dir_err_to_errnum(hawk_dir_geterrnum (list->map.tab[id]->ctx)); return -1; } @@ -456,7 +456,7 @@ static int query (hawk_mod_t* mod, hawk_t* awk, const hawk_ooch_t* name, hawk_mo { mid = left + (right - left) / 2; - n = qse_strcmp (fnctab[mid].name, name); + n = hawk_strcmp (fnctab[mid].name, name); if (n > 0) right = mid - 1; else if (n < 0) left = mid + 1; else @@ -472,7 +472,7 @@ static int query (hawk_mod_t* mod, hawk_t* awk, const hawk_ooch_t* name, hawk_mo { mid = left + (right - left) / 2; - n = qse_strcmp (inttab[mid].name, name); + n = hawk_strcmp (inttab[mid].name, name); if (n > 0) right = mid - 1; else if (n < 0) left = mid + 1; else diff --git a/hawk/lib/mod-str.c b/hawk/lib/mod-str.c index 266477da..ed793167 100644 --- a/hawk/lib/mod-str.c +++ b/hawk/lib/mod-str.c @@ -88,7 +88,7 @@ static int trim (hawk_rtx_t* rtx, int flags) hawk_ooch_t* npath; path.ptr = hawk_rtx_getvaloocstr(rtx, a0, &path.len); if (!path.ptr) return -1; - /* because qse_strxtrmx() returns the pointer and the length without + /* because hawk_strxtrmx() returns the pointer and the length without * affecting the string given, it's safe to pass the original value. * hawk_rtx_getvaloocstr() doesn't duplicate the value if it's of * the string type. */ @@ -371,7 +371,7 @@ static int fnc_frommbs (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi) a1 = hawk_rtx_getarg(rtx, 1); enc.ptr = hawk_rtx_getvaloocstr(rtx, a1, &enc.len); if (!enc.ptr) return -1; - /* if encoding name is an empty string, qse_Findcmgr() returns the default cmgr. + /* if encoding name is an empty string, hawk_findcmgr() returns the default cmgr. * i don't want that behavior. */ cmgr = (enc.len > 0 && enc.len == hawk_count_oocstr(enc.ptr))? hawk_get_cmgr_by_name(enc.ptr): HAWK_NULL; hawk_rtx_freevaloocstr (rtx, a1, enc.ptr); @@ -427,7 +427,7 @@ static int fnc_tombs (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi) a1 = hawk_rtx_getarg(rtx, 1); enc.ptr = hawk_rtx_getvaloocstr(rtx, a1, &enc.len); if (!enc.ptr) return -1; - /* if encoding name is an empty string, qse_Findcmgr() returns the default cmgr. + /* if encoding name is an empty string, hawk_findcmgr() returns the default cmgr. * i don't want that behavior. */ cmgr = (enc.len > 0 && enc.len == hawk_count_oocstr(enc.ptr))? hawk_get_cmgr_by_name(enc.ptr): HAWK_NULL; hawk_rtx_freevaloocstr (rtx, a1, enc.ptr);