From b9cfb7a7ad2cb64cba3d1863feee63338b49e5eb Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 27 Aug 2015 07:28:34 -0700 Subject: Renaming c_true to tnil. Macros called c_* should produce C counterparts of Lisp val objects, like c_num and c_str. * lib.h (c_true): Renamed to tnil. * eval.c (lexical_var_p, lexical_fun_p): c_true to tnil. * lib.c (less, chr_isalnum, chr_isalnum, chr_isalpha, chr_isascii, chr_iscntrl, chr_isdigit, chr_isgraph, chr_islower, chr_isprint, chr_ispunct, chr_isspace, chr_isblank, chr_isunisp, chr_isupper, chr_isxdigit, chr_toupper, keywordp): Likewise. * stream.c (catenated_stream_p): Likewise. * sysif.c (wifexited, wifsignaled, wcoredump, wifstopped, wifcontinued): Likewise. --- eval.c | 4 ++-- lib.c | 32 ++++++++++++++++---------------- lib.h | 2 +- stream.c | 2 +- sysif.c | 10 +++++----- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/eval.c b/eval.c index 0c5ed46b..54df59b8 100644 --- a/eval.c +++ b/eval.c @@ -368,7 +368,7 @@ static val lexical_var_p(val menv, val sym) val binding = assoc(sym, menv->e.vbindings); if (binding) /* special_s: see make_var_shadowing_env */ - return c_true(cdr(binding) == special_s); + return tnil(cdr(binding) == special_s); return lexical_var_p(menv->e.up_env, sym); } } @@ -385,7 +385,7 @@ static val lexical_fun_p(val menv, val sym) val binding = assoc(sym, menv->e.fbindings); if (binding) /* special_s: see make_var_shadowing_env */ - return c_true(cdr(binding) == special_s); + return tnil(cdr(binding) == special_s); return lexical_fun_p(menv->e.up_env, sym); } } diff --git a/lib.c b/lib.c index b8000fe0..11a4da5f 100644 --- a/lib.c +++ b/lib.c @@ -3432,7 +3432,7 @@ val less(val left, val right) return nil; } - return c_true (lenl < lenr); + return tnil(lenl < lenr); } case FUN: case PKG: @@ -3533,72 +3533,72 @@ wchar_t c_chr(val chr) val chr_isalnum(val ch) { - return c_true(iswalnum(c_chr(ch))); + return tnil(iswalnum(c_chr(ch))); } val chr_isalpha(val ch) { - return c_true(iswalpha(c_chr(ch))); + return tnil(iswalpha(c_chr(ch))); } val chr_isascii(val ch) { - return c_true(c_chr(ch) >= 0 && c_chr(ch) < 128); + return tnil(c_chr(ch) >= 0 && c_chr(ch) < 128); } val chr_iscntrl(val ch) { - return c_true(iswcntrl(c_chr(ch))); + return tnil(iswcntrl(c_chr(ch))); } val chr_isdigit(val ch) { - return c_true(iswdigit(c_chr(ch))); + return tnil(iswdigit(c_chr(ch))); } val chr_isgraph(val ch) { - return c_true(iswgraph(c_chr(ch))); + return tnil(iswgraph(c_chr(ch))); } val chr_islower(val ch) { - return c_true(iswlower(c_chr(ch))); + return tnil(iswlower(c_chr(ch))); } val chr_isprint(val ch) { - return c_true(iswprint(c_chr(ch))); + return tnil(iswprint(c_chr(ch))); } val chr_ispunct(val ch) { - return c_true(iswpunct(c_chr(ch))); + return tnil(iswpunct(c_chr(ch))); } val chr_isspace(val ch) { - return c_true(iswspace(c_chr(ch))); + return tnil(iswspace(c_chr(ch))); } val chr_isblank(val ch) { - return c_true(ch == chr(' ') || ch == chr('\t')); + return tnil(ch == chr(' ') || ch == chr('\t')); } val chr_isunisp(val ch) { - return c_true(wcschr(spaces, c_chr(ch))); + return tnil(wcschr(spaces, c_chr(ch))); } val chr_isupper(val ch) { - return c_true(iswupper(c_chr(ch))); + return tnil(iswupper(c_chr(ch))); } val chr_isxdigit(val ch) { - return c_true(iswxdigit(c_chr(ch))); + return tnil(iswxdigit(c_chr(ch))); } val chr_toupper(val ch) @@ -3844,7 +3844,7 @@ val symbolp(val sym) val keywordp(val sym) { - return c_true(sym && symbolp(sym) && sym->s.package == keyword_package_var); + return tnil(sym && symbolp(sym) && sym->s.package == keyword_package_var); } loc get_user_package(void) diff --git a/lib.h b/lib.h index 6372370c..56d1b5f1 100644 --- a/lib.h +++ b/lib.h @@ -927,7 +927,7 @@ INLINE int null_or_missing_p(val v) { return (nilp(v) || missingp(v)); } #define and3(a, b, c) ((a) && (b) ? (c) : nil) -#define c_true(c_cond) ((c_cond) ? t : nil) +#define tnil(c_cond) ((c_cond) ? t : nil) INLINE val default_arg(val arg, val dfl) { diff --git a/stream.c b/stream.c index cde7e5b8..fe250f70 100644 --- a/stream.c +++ b/stream.c @@ -1870,7 +1870,7 @@ val make_catenated_stream_v(struct args *streams) val catenated_stream_p(val obj) { - return if2(streamp(obj), c_true(obj->co.ops == &cat_stream_ops.cobj_ops)); + return if2(streamp(obj), tnil(obj->co.ops == &cat_stream_ops.cobj_ops)); } val catenated_stream_push(val new_stream, val cat_stream) diff --git a/sysif.c b/sysif.c index f8360a69..355eecd6 100644 --- a/sysif.c +++ b/sysif.c @@ -424,7 +424,7 @@ static val wait_wrap(val pid, val flags) static val wifexited(val status) { int s = c_num(if3(consp(status), cdr(status), status)); - return c_true(WIFEXITED(s)); + return tnil(WIFEXITED(s)); } static val wexitstatus(val status) @@ -436,7 +436,7 @@ static val wexitstatus(val status) static val wifsignaled(val status) { int s = c_num(if3(consp(status), cdr(status), status)); - return c_true(WIFSIGNALED(s)); + return tnil(WIFSIGNALED(s)); } static val wtermsig(val status) @@ -449,14 +449,14 @@ static val wtermsig(val status) static val wcoredump(val status) { int s = c_num(if3(consp(status), cdr(status), status)); - return c_true(WCOREDUMP(s)); + return tnil(WCOREDUMP(s)); } #endif static val wifstopped(val status) { int s = c_num(if3(consp(status), cdr(status), status)); - return c_true(WIFSTOPPED(s)); + return tnil(WIFSTOPPED(s)); } static val wstopsig(val status) @@ -469,7 +469,7 @@ static val wstopsig(val status) static val wifcontinued(val status) { int s = c_num(if3(consp(status), cdr(status), status)); - return c_true(WIFCONTINUED(s)); + return tnil(WIFCONTINUED(s)); } #endif -- cgit v1.2.3