From 6896d02e5bdb2deb0f0b3d3becfe55dd9981a78b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 29 Oct 2019 06:36:13 -0700 Subject: naming: get the -func out, at least some of it. The code base contains a lot of irksome _func which should be _fun, and also the public functions func-get-form and func-get-name are irksomely named. As a first step, we can fix parameters which carry this suffix. * glob.c (global_wrap): errfunc argument renamed to errfun. * glob.h (global_wrap): Likewise. * hash.h (hash_uni, hash_isec): join_func argument renamed to joinfun. * hash.h (hash_uni, hash_isec): Likewise. * txr.1: fixed gen-func typo. Arguments renamed in descriptions of hash-uni, hash-isec, iff, iffi, glob, and ftw. --- glob.c | 4 ++-- glob.h | 2 +- hash.c | 12 ++++++------ hash.h | 4 ++-- txr.1 | 58 +++++++++++++++++++++++++++++----------------------------- 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/glob.c b/glob.c index b7e10152..dae05fb7 100644 --- a/glob.c +++ b/glob.c @@ -65,7 +65,7 @@ static int errfunc_thunk(const char *errpath, int errcode) return result ? 1 : 0; } -val glob_wrap(val pattern, val flags, val errfunc) +val glob_wrap(val pattern, val flags, val errfun) { cnum c_flags = c_num(default_arg(flags, zero)); char *pat_u8 = utf8_dup_to(c_str(pattern)); @@ -77,7 +77,7 @@ val glob_wrap(val pattern, val flags, val errfunc) "its error callback function"), nao); } - s_errfunc = default_null_arg(errfunc); + s_errfunc = default_null_arg(errfun); (void) glob(pat_u8, c_flags, s_errfunc ? errfunc_thunk : 0, &gl); diff --git a/glob.h b/glob.h index c5d6438b..eaaa81a0 100644 --- a/glob.h +++ b/glob.h @@ -25,5 +25,5 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -val glob_wrap(val pattern, val flags, val errfunc); +val glob_wrap(val pattern, val flags, val errfun); void glob_init(void); diff --git a/hash.c b/hash.c index e85efa03..b7320ba6 100644 --- a/hash.c +++ b/hash.c @@ -1533,7 +1533,7 @@ val hash_alist(val hash) return make_lazy_cons_car(func_f1(iter, hash_alist_lazy), cell); } -val hash_uni(val hash1, val hash2, val join_func) +val hash_uni(val hash1, val hash2, val joinfun) { val self = lit("hash-uni"); struct hash *h1 = coerce(struct hash *, cobj_handle(self, hash1, hash_s)); @@ -1558,7 +1558,7 @@ val hash_uni(val hash1, val hash2, val join_func) entry; entry = hash_next(hiter)) { - if (missingp(join_func)) { + if (missingp(joinfun)) { sethash(hout, us_car(entry), us_cdr(entry)); } else { val new_p; @@ -1566,7 +1566,7 @@ val hash_uni(val hash1, val hash2, val join_func) if (new_p) sethash(hout, us_car(entry), us_cdr(entry)); else - set(ptr, funcall2(join_func, us_cdr(entry), deref(ptr))); + set(ptr, funcall2(joinfun, us_cdr(entry), deref(ptr))); } } @@ -1633,7 +1633,7 @@ val hash_symdiff(val hash1, val hash2) } } -val hash_isec(val hash1, val hash2, val join_func) +val hash_isec(val hash1, val hash2, val joinfun) { val self = lit("hash-isec"); struct hash *h1 = coerce(struct hash *, cobj_handle(self, hash1, hash_s)); @@ -1653,10 +1653,10 @@ val hash_isec(val hash1, val hash2, val join_func) { val found = gethash_e(self, hash2, us_car(entry)); if (found) { - if (missingp(join_func)) + if (missingp(joinfun)) sethash(hout, us_car(entry), us_cdr(entry)); else - sethash(hout, us_car(entry), funcall2(join_func, us_cdr(entry), us_cdr(found))); + sethash(hout, us_car(entry), funcall2(joinfun, us_cdr(entry), us_cdr(found))); } } diff --git a/hash.h b/hash.h index 869e6fbd..84045156 100644 --- a/hash.h +++ b/hash.h @@ -68,10 +68,10 @@ val hash_keys(val hash); val hash_values(val hash); val hash_pairs(val hash); val hash_alist(val hash); -val hash_uni(val hash1, val hash2, val join_func); +val hash_uni(val hash1, val hash2, val joinfun); val hash_diff(val hash1, val hash2); val hash_symdiff(val hash1, val hash2); -val hash_isec(val hash1, val hash2, val join_func); +val hash_isec(val hash1, val hash2, val joinfun); val hash_subset(val hash1, val hash2); val hash_proper_subset(val hash1, val hash2); val hash_update(val hash, val fun); diff --git a/txr.1 b/txr.1 index 9c8fb220..18e8cf73 100644 --- a/txr.1 +++ b/txr.1 @@ -21308,7 +21308,7 @@ then returns the empty list .code nil instead of a lazy list. Otherwise, it instantiates a lazy list, and invokes the -.code gen-func +.code gen-fun to populate it with the first item. The @@ -45191,10 +45191,10 @@ or .coNP Functions @, hash-uni @, hash-diff @ hash-symdiff and @ hash-isec .synb -.mets (hash-uni < hash1 < hash2 <> [ join-func ]) +.mets (hash-uni < hash1 < hash2 <> [ joinfun ]) .mets (hash-diff < hash1 << hash2 ) .mets (hash-symdiff < hash1 << hash2 ) -.mets (hash-isec < hash1 < hash2 <> [ join-func ]) +.mets (hash-isec < hash1 < hash2 <> [ joinfun ]) .syne .desc These functions perform basic set operations on hash tables in a nondestructive @@ -45231,12 +45231,12 @@ and .metn hash2 , then it occurs only once in the resulting hash. In this case, if the -.meta join-func +.meta joinfun argument is not given, the value associated with this key is the one from .metn hash1 . If -.meta join-func +.meta joinfun is specified then it is called with two arguments: the respective data items from .meta hash1 @@ -45283,12 +45283,12 @@ only those keys which occur both in and .metn hash2 . If -.meta join-func +.meta joinfun is not specified, the values selected for these common keys are those from .metn hash1 . If -.meta join-func +.meta joinfun is specified, then for each key which occurs in both .meta hash1 and @@ -47125,8 +47125,8 @@ and then inverts the result as if by application of the .coNP Functions @ iff and @ iffi .synb -.mets (iff < cond-func >> [ then-func <> [ else-func ]]) -.mets (iffi < cond-func < then-func <> [ else-func ]) +.mets (iff < condfun >> [ thenfun <> [ elsefun ]]) +.mets (iffi < condfun < thenfun <> [ elsefun ]) .syne .desc The @@ -47137,18 +47137,18 @@ operator. It accepts functional arguments and returns a function. The resulting function takes its arguments, if any, and applies them to -.metn cond-func . +.metn condfun . If -.meta cond-func +.meta condfun yields true, then the arguments are passed to -.meta then-func +.meta thenfun and the resulting value is returned. Otherwise the arguments are passed to -.meta else-func +.meta elsefun and the resulting value is returned. If -.meta then-func +.meta thenfun is omitted then .code identity is used as default. This omission is not permitted by @@ -47157,7 +47157,7 @@ only .codn iff . If -.meta else-func +.meta elsefun needs to be called, but is omitted, then .code nil is returned. @@ -47168,9 +47168,9 @@ function differs from .code iff only in the defaulting behavior with respect to the -.meta else-func +.meta elsefun argument. If -.meta else-func +.meta elsefun is omitted in a call to .code iffi then the default function is @@ -58920,7 +58920,7 @@ implementation of .coNP Function @ glob .synb -.mets (glob < pattern >> [ flags <> [ error-func ]]) +.mets (glob < pattern >> [ flags <> [ errfun ]]) .syne .desc The @@ -58945,7 +58945,7 @@ values of the variables and others. If the -.meta error-func +.meta errfun argument is specified, it gives a callback function which is invoked when .code glob @@ -58958,18 +58958,18 @@ Boolean. If the function returns true, then will terminate. The -.meta error-func +.meta errfun may terminate the traversal by a nonlocal exit, such as by throwing an exception or performing a block return. The -.meta error-func +.meta errfun may not re-enter the .code glob function. This situation is detected and diagnosed by an exception. The -.meta error-func +.meta errfun may not capture a continuation across the error boundary. That is to say, code invoked from the error may not capture a continuation up to a prompt which surrounds the @@ -59105,8 +59105,8 @@ These variables correspond to the C constants .coNP Function @ ftw .synb -.mets (ftw < path-or-list < callback-func >> [ flags <> [ nopenfd ]]) -.mets >> [ callback-func < path < type < stat-struct < level << base ] +.mets (ftw < path-or-list < callbackfun >> [ flags <> [ nopenfd ]]) +.mets >> [ callbackfun < path < type < stat-struct < level << base ] .syne .desc The @@ -59178,7 +59178,7 @@ argument and bitmask arguments. For each visited entry, it calls the supplied -.meta callback-func +.meta callbackfun function, which receives five arguments. The @@ -59250,22 +59250,22 @@ upon successful completion and on failure. If .code ftw is terminated by a return value from -.metn callback-func , +.metn callbackfun , then that value is returned. Such a value is always a nonzero integer. The -.meta callback-func +.meta callbackfun may terminate the traversal by a nonlocal exit, such as by throwing an exception or performing a block return. The -.meta callback-func +.meta callbackfun may not re-enter the .code ftw function. This situation is detected and diagnosed by an exception. The -.meta callback-func +.meta callbackfun may not capture a continuation across the callback boundary. That is to say, code invoked from the callback may not capture a continuation up to a prompt which surrounds the -- cgit v1.2.3