From b698bb706067d911c62385b477684efea6aa983a Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 10 Dec 2013 08:07:33 -0800 Subject: syslog support; bitwise logior and logand functions become variadic. * Makefile: Use -iquote to restrict our #include search paths from being processed for #include <...>. Add syslog.o to OBJS-y if have_syslog is y. * configure (have_syslog): New variable, set by detecting syslog API. * eval.c (eval_init): logand and logior registrations changed to go to variadic versions. New syslog variables and functions registered. * lib.c (logandv, logiorv): New functions. * lib.h (logandv, logiorv): Declared. * txr.c (main): Call syslog_init. * syslog.c: New file. * syslog.h: New file. * txr.1: Updated. * txr.vim: Regenerated. --- arith.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'arith.c') diff --git a/arith.c b/arith.c index b1ae1677..a49fdf0c 100644 --- a/arith.c +++ b/arith.c @@ -1803,6 +1803,19 @@ bad3: uw_throwf(error_s, lit("ashift: non-integral operand ~s"), a, nao); } +val maskv(val bits) +{ + val accum = zero; + + for (; bits; bits = cdr(bits)) { + val num = car(bits); + val mask = ash(one, num); + accum = logior(accum, mask); + } + + return accum; +} + void arith_init(void) { mp_init(&NUM_MAX_MP); -- cgit v1.2.3