| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile (OBJS-y): Include signal.o if have_posix_sigs is "y".
* configure (have_posix_sigs): New variable, set by detecting POSIX
signal stuff.
* dep.mk: Regenerated.
* arith.c, debug.c, eval.c, filter.c, hash.c, match.c, parser.y,
parser.l, rand.c, regex.c, syslog.c, txr.c, utf8.c: Include new
signal.h header, now required by unwind, and the <signal.h> system
header.
* eval.c (exit_wrap): New function.
(eval_init): New functions registered as intrinsics: exit_wrap,
set_sig_handler, get_sig_handler, sig_check.
* gc.c (release): Unused functions removed.
* gc.h (release): Declaration removed.
* lib.c (init): Call sig_init.
* stream.c (set_putc, se_getc, se_fflush): New static functions.
(stdio_put_char_callback, stdio_get_char_callback, stdio_put_byte,
stdio_flush, stdio_get_byte): Use new functions to enable
signals when blocked on I/O.
(tail_strategy): Allow signals across sleep.
(pipev_close): Allow signals across waitpid.
(se_pclose): New static function.
(pipe_close): Use new function to enable signals across pclose.
* unwind.c (uw_unwind_to_exit_point): use extended_longjmp instead of
longjmp.
* unwind.h (struct uw_block, struct uw_catch): jb member changes from
jmp_buf to extended_jmp_buf.
(uw_block_begin, uw_simple_catch_begin, uw_catch_begin): Use
extended_setjmp instead of setjmp.
* signal.c: New file.
* signal.h: New file.
|
|
|
|
|
| |
include <assert.h> since none of these modules uses the standard C
assert macro.
|
|
|
|
| |
Fixing some errors in copyright comments.
|
|
|
|
|
|
|
|
|
|
|
|
| |
stream_get_prop and stream_set_prop as intrinsics.
* stream.c (stream_get_prop): New function.
* stream.h (stream_get_prop): Declared.
* syslog.c (syslog_get_prop): Bugfix: check for prio_k not real_time_k.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
around November 2009.
* lib.c (lazy_str): Use the efficient lit("...") that
doesn't allocate memory instead of string(L"...").
(lazy_str_get_trailing_list): Likewise.
* stream.c (open_process): Likewise.
* txr.c (remove_hash_bang_line): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
intrinsic function and std_null as new variable.
* parser.h (yylex_destroy): Existing function declared.
* parser.l (regex_parse): New function.
New lexical syntax added which returns SECRET_ESCAPE_R.
* parser.y (SECRET_ESCAPE_R): New token.
(spec): Added syntactic variant which lets us
smuggle a regex into the parser easily.
* stream.c:x (std_null): New global variable.
(null_stream_print): New static function.
(null_ops): New static structure.
(make_null_stream): New function.
(stream_init): Protect and initialize std_null.
* stream.h (std_null, make_null_stream): Declared.
* txr.1: New features documented: regex-parse, *stdnull*.
* txr.c (txr_main): Call yylex_destroy after parsing the program now
that I know about this function; this can free up some memory.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
in the case that the stream's FILE * handle is null. This handles
opening the file for the first time.
(make_stdio_stream_common): Do not use the FILE * handle if it is null.
(open_tail): Do not open the file immediately and error out.
This is undesirable because log files might not exist at the time
open_tail is called on them. Instead, produce a stream which contains
a null file handle, and use tail_strategy to poll for the file
to come into existence.
* utf8.c (w_freopen): Just in case freopen doesn't like a null
pointer for the existing stream, use fopen instead if that is the case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is that accurate lazy lists are not suitable for
real time use, where we want the TXR program to respond immediately
to matching some datum.
I'm implementing a simple, naive variant of lazy stream lists
which simply populates the lazy cons by reading from the stream when
the car or cdr fields are accessed. This type of stream can never
be nil (empty list) even if the file is empty; in that case
it will be (nil) and in general, it will have a spurious nil
item at the end instead of ending in a string.
(An adjustment was made in match.c to detect this; more
will be needed.)
I'm adding attributes to streams so streams can now have a
"real-time" attribute. When a lazy string list is constructed over
a real-time stream, the simple implementation is used.
File streams are automatically real-time if (on Unix) they are tied
to tty streams. Tail streams are also real-time.
More work is needed to achieve the goal of this change,
but this is a big step in the right direction.
* configure: Detect isatty function.
* lib.c (simple_lazy_stream_func): New static function.
(lazy_stream_cons): Use simple implementation for real-time streams.
* match.c (match_files): Do not call match_line_completely
with a data line that is nil (as a result of simple lazy list
over a real-time stream). A nil item in a lazy list of strings
is treated as eof.
* stream.c (real_time_k): New symbol variable.
(struct strm_ops): New members: get_prop, set_prop.
(struct stdio_handle): New member: is_real_time.
(stdio_get_prop, stdio_set_prop): New static function.
(stdio_ops, tail_ops, pipe_ops): stdio_get_prop and
stdio_set_prop funtions wired in.
(make_stdio_stream_common): Attribute streams as real-time
if they are tty devices.
(make_tail_stream): Tail streams are real-time attributed.
(stream_set_prop, real_time_stream_p): New functions.
(stream_init): Initialize real_time_k.
* stream.h (real_time_k): Declared.
(real_time_stream_p, stream_set_prop): Likewise.
|
|
|
|
|
|
| |
(tail_strategy): Handle the situation when the file disappears. We
cannot throw an error, but must poll the filesystem
for the file to reappear.
|
|
|
|
| |
mode member of struct stdio_ops to nil.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(stdio_stream_mark): Mark the new member during gc.
(stdio_seek): When we seek, we should reset the utf8 machine.
(tail_strategy): New function.
(tail_get_line, tail_get_char, tail_get_byte): Use
tail_strategy for polling the file at EOF.
(open_tail): Store the mode in the file handle.
* utf8.c (w_freopen): New function.
* utf8.h (w_freopen): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile (conftest.clean): Use @ to suppress output.
* configure (have_unistd): New variable. Set true by every successful
test that compiles something that contains #include <unistd.h>.
HAVE_UNISTD_H is conditionally generated in config.h based on this variable.
Minor cleanup.
* parser.l: Inclusion of <unistd.h> wrapped in #if/#endif.
* stream.c: Conditional inclusion of <unistd.h> based on new HAVE_UNISTD_H symbol.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register new open_tail function as intrinsic.
* match.c (complex_snarf, complex_stream): Update calls to
make_stdio_stream and make_pipe_stream to take fewer arguments.
(match_files): Support a stream object as a data source specification
in place of a string.
* parser.l (parse_reset): Update call to make_stdio_stream to take
fewer arguments.
* stream.c: Inclusion of <unistd.h> made properly conditional.
(struct stdio_handle): pid member defined as pid_t only if we have fork
functionality, otherwise defined as int.
(tail_get_line, tail_get_char, tail_get_byte): New static functions.
(tail_ops): New static structure.
(make_stdio_stream_common): New static structure.
(make_stdio_stream, make_pipe_stream): These functions lose the input
and output parameters, which ended up never used. Reimplemented
in terms of new common function.
(make_tail_stream): New function.
(make_pipevp_stream): Reimplemented in terms of new common function.
(open_file, open_command): Simplified by removal of useless local
variables and their computation, which used to be extra arguments to
make_stdio_stream and make_pipe_stream.
(open_tail): New function.
(stream_init): Calls to make_stdio_stream updated.
* stream.h (make_stdio_stream, make_pipe_stream): Declarations updated.
(make_tail_stream, open_tail): Declared.
* txr.c (txr_main): Calls to make_stdio_stream updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bugfix in stdio_flush: check FILE * handle for null.
Minor cleanups.
* eval.c (eval_init): Register seek_stream as intrinsic.
* stream.c (from_start_k, from_current_k, from_end_k): New symbol
variables.
(strm_whence): New enum.
(strm_ops): New member, seek.
(stdio_maybe_write_error): Renamed to stdio_maybe_error; takes
new string argument to describe action.
(stdio_put_string, stdio_put_char, stdio_put_byte): Updated call to
stdio_maybe_error.
(stdio_flush): Updated call to stdio_maybe_error. Check
handle for null.
(stdio_seek): New static function.
(stdio_ops): Added stdio_seek.
(pipe_ops, string_in_ops, byte_in_ops, string_out_ops,
strlist_out_ops, dir_ops): Added explicit zero entries and comments for
unimplemented functions.
(seek_stream): New function.
(stream_init): New keyword symbols interned.
* stream.h (from_start_k, from_current_k, from_end_k): New
variables declared.
(dev_k, ino_k, mode_k, nlink_k, uid_k, gid_k, rdev_k, size_k,
blksize_k, blocks_k, atime_k, mtime_k, ctime_k, s_ifmt, s_iflnk,
s_ifreg, s_ifblk, s_ifdir, s_ifchr, s_ififo, s_isuid, s_isgid, s_isvtx,
s_irwxu, s_irusr, s_iwusr, s_ixusr, s_irwxg, s_irgrp,
s_iwgrp): Existing extern variables declared.
(seek_stream): New function declared.
* txr.1: Documented seek-stream.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Registered logtest.
Registered s-ifmt, s-iflnk, s-ifreg, s-ifblk, s-ifdir,
s-ifchr, s-ififo, s-isuid, s-isgid, s-isvtx, s-irwxu,
s-irusr, s-iwusr, s-ixusr, s-irwxg, s-irgrp, s-iwgrp,
s-ixgrp, s-irwxo, s-iroth, s-iwoth, s-ixoth variables.
* lib.h (logtest): Declared.
* stream.c (s_ifmt, s_ifsock, s_iflnk, s_ifreg, s_ifblk,
s_ifdir, s_ifchr, s_ififo, s_isuid, s_isgid, s_isvtx, s_irwxu, s_irusr,
s_iwusr, s_ixusr, s_irwxg, s_irgrp, s_iwgrp, s_ixgrp, s_irwxo, s_iroth,
s_iwoth, s_ixoth): New global variables.
* stream.h (s_ifmt, s_ifsock, s_iflnk, s_ifreg, s_ifblk,
s_ifdir, s_ifchr, s_ififo, s_isuid, s_isgid, s_isvtx, s_irwxu, s_irusr,
s_iwusr, s_ixusr, s_irwxg, s_irgrp, s_iwgrp, s_ixgrp, s_irwxo, s_iroth,
s_iwoth, s_ixoth): Declared.
* txr.1: Documented logtest and s-* variables for stat,
as well as open-file and open-directory.
|
|
|
|
|
|
|
|
|
| |
point integer, .0 is now always shown if the precision is not given,
or if it is given and nonzero. Previous behavior of ~s was add .0 only
when a precision is not specified. The new behavior is more
sensible and consistent with documentation.
* txr.1: Typo fixed in related documentation.
|
|
|
|
|
|
|
|
| |
integers in hex. When we use the printf's %x conversion specifiers for
fixnums, we get incorrect results when the values are negative, because
the argument is actually treated as an unsigned integer.
The end result is that (format t "~x" -1) produces FFFFFFFF
rather than -1. Also, merged together mindless code duplication.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c: New intrinsic functions "stat" and "prop".
* stream.c: Include <sys/stat.h> if we have it.
(w_stat, statf): New functions.
(val dev_k, ino_k, mode_k, nlink_k, uid_k,
val gid_k, rdev_k, size_k, blksize_k, blocks_k;
val atime_k, mtime_k, ctime_k): New sybol variables.
(stream_init): Intern new keywords symbols.
* stream.h (statf): Declared.
* txr.1: prop documented. Stub for stat created.
|
|
|
|
|
|
|
| |
apply field formatting to the object not only if a nonzero width has
been specified, but also if precision has been specified.
* txr.1: documented stream global variables and format.
|
|
|
|
|
|
|
|
|
|
|
|
| |
intrinsics. open-pipe is now deprecated but stays for backward
compatibility as a synonym for open-command.
* stream.c (open_pipe): Renamed to open_command.
(open_pipevp): Renamed to open_process.
* stream.h (open_pipe, open_pipevp): Declarations updated.
* txr.1: Documentation headings updated.
|
|
|
|
| |
as first element of argv.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
does not have for or exec. We could use CreateProcess and CreatePipe,
et cetera, but it won't buy us anything because the whole point
of this function is to improve the argument passing, and CreateProcess
takes a single command line string, not too different from popen.
* stream.c (pipev_close, make_pipev_stream): Surrounded with
HAVE_FORK_STUFF ifdef.
(pipe_close): Choice of close strategy conditional on HAVE_FORK_STUFF.
(open_pipev): Conditionally defined in two ways now.
(win_escape_arg, win_make_cmdline): New static functions.
|
|
|
|
| |
* stream.c (w_opendir): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
that popen accepts a complete command. We need something which
accepts a program name, and a list of arguments, so that
we don't have to assemble together a correctly quoted string.
popen needs an alternative interface resembling execvp.
* eval.c (eval_init): New intrinsic registered, open-pipe-args.
* stream.c (struct stdio_handle): New member, pid.
(stdio_stream_print): Print the pid, if it is nonzero.
(pipevp_close): New close function.
(pipe_close): If h->pid is nonzero, it's a new-style pipe, which
must be closed with pipev_close.
(make_stdio_stream, make_pipe_stream): Initialize new stdio_handle
member to zero.
(make_pipevp_stream): New static function.
(open_pipevp): New function.
* stream.h (open_pipevp): Declared.
* txr.1: open-pipe-args added to stub section heading.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile (EXTRA_FLAGS): Handy new variable for additional
ad-hoc CFLAGS. Needed by a new test in configure.
* configure: Check for annoying warnings about char being used
as an array subscript when calling the macros from <ctype.h>.
If this occurs, suppress it by #undef-ing the macros.
(lang_flags): Switching fromm _XOPEN_SOURCE to _XOPEN_SOURCE=2
because this is needed on NetBSD to obtain declarations of
popen and pclose.
* stream.c (pipe_close): If we don't have the WIFCONTINUED macro,
then define it to expand to zero. It's absent on NetBSD and they
already seem to have a hack for this because there is a warning about
the function not being defined, but then the program links anyway.
Let's do it properly and not rely on their hack.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
causes CONFIG_GEN_GC to be defined as 1 in config.h.
* eval.c (op_defvar, dwim_loc, op_modplace, transform_op): Handle
mutating assignments via set macro.
(op_dohash): Inform gc about mutated variables. TODO here.
* filter.c (trie_add, trie_compress): Handle mutating assignments
via set macro.
* gc.c (BACKPTR_VEC_SIZE, FULL_GC_INTERVAL): New preprocessor symbols.
(backptr, backptr_idx, partial_gc_count, full): New static variables.
(make_obj): Initialize generation to zero.
(gc): Added logic for deciding between full and partial gc.
(gc_set, gc_mutated): New functions.
* gc.h (gc_set, gc_mutated): Declared.
* hash.c (hash_mark): Changed useless use of vecref_l to vecref.
(gethash_f): Use set when assigning through *found since it
is a possible mutation.
* lib.c (car_l, cdr_l, vecref_l): Got rid of loc macro uses. Using the
value properly is going to be the caller's responsibility.
(push): push may be a mutation, so use set.
(intern): Uset set to mutate a hash entry.
(acons_new_l, aconsq_new_l): Use set when replacing *list.
* lib.h (PTR_BIT): New preprocessor symbol.
(obj_common): New macro for defining common object fields.
type_t is split into two bitfields, half a pointer wide,
allowing for generation to be represented.
(struct any, struct cons, struct string, struct sym, struct package,
struct func, struct vec, struct lazy_cons, struct cobj, struct env,
struct bignum, struct flonum): Use obj_common macro to defined
common fields.
(loc): Macro removed.
(set, mut): Macros conditionally defined for real functionality.
(list_collect, list_collect_nconc, list_collect_append): Replace
mutating operations with set.
* match.c (dest_set, v_cat, v_output, v_filter): Replace
mutating operations with set.
* stream.c (string_in_get_line, string_in_get_char,
strlist_out_put_string, strlist_out_put_char): Replace mutating
operations with set.
* unwind.c (uw_register_subtype): Replace mutating operation with set.
|
|
|
|
|
|
|
| |
implementations with regard to printing floating point exponents.
by deleting any plus sign and leading zeros after the 'e'.
* tests/009/json.expected: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
with no decimal point like 1E1.
* stream.c: (vformat): Keep track of whether or not precision was
given in precision_p local variable.
When printing #<bad-float> pass a precision of 0
to vformat_str, not precision, since precision does not apply.
In ~f and ~e, if the precision was not given, default
it to 3.
Restructured float printing in ~a and ~s. It now just uses sprintf's %g
with a precision. If user does not specify precision, it defaults
to DBL_DIG to print the number with reasonable accuracy.
A .0 is added if it sprintf produces an integer, and the conversion
is ~s rather than ~a.
|
|
|
|
|
|
|
|
| |
that doesn't begin with a digit, it's most likely NaN or Inf.
We can turn that into an exception.
* stream.c (vformat): If sprintf produces a non-number,
turn it into the printed representation #<bad-float>.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.l: FLO and FLODOT cases had to be reordered because
the lex trailing context counts as part of the match length,
causing 3.0 to be matched as three characters with 0 as
the trailing context. The cases are split up to eliminate
a flex warning.
* stream.c (vformat): Support bignum in floating point
conversion. Bugfixes: floating point conversion was
accessing obj->fl.n instead of using n.
Changed some if/else ladders to switches.
|
|
|
|
| |
overrun. IEEE double floats can go to e+-308.
|
|
|
|
|
|
|
|
|
|
| |
are now printing floating point numbers into it, letting
the C library handle precision which can generate many digits.
We cap the precision at at 128. New format specifiers ~e
and ~f implemented, which loosely correspond to those of printf.
The ~s and ~a directives handle floats similarly to ~g in
printf, except that they ensure that a decimal point is printed
for the non-exponential notation.
|
|
|
|
|
|
| |
consider data sent to std_error to be output for the purposes of
the output_produced flag. Otherwise the program behavior changes
in -v mode; it will not print bindings.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
function. This must not flush out more than one character out of this
small buffer, except when we are flushing out the last data.
The correct operation is predicated on the assumption that
a complete character can be pulled out. That's why we move the
buffer to the front after consuming it, and do not automatically
flush until there are four bytes.
(string_out_put_string): We loop the call to string_out_byte_flush
here because when a request comes in to write a Unicode character,
we flush all the bytes, even if the tail of those bytes forms
an incomplete sequence that turns into U+DCxx codes.
(get_string_from_stream): Use the same loop termination test
as in string_out_put_string, for consistency. In that function
it is needed to prevent infinite looping in the case when
the string_out_put_string is being called from string_out_byte_flush
and is thus re-entering it.
* tests/010/strstream.expected: New file.
* tests/010/strstream.txr: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This does the Right Thing with a mixture of bytes and characters.
Incomplete byte sequences.
* stream.c (struct strm_ops): Changing byte argument of put_byte
to int, since the put_byte API function can just pass down that
value after validating it.
(stdio_handle): Use available typedef.
(stdio_put_byte): Follow interface change in strm_ops.
Do not validate the range of a byte; the put_byte higher
level function does that now.
(struct string_output): New members: ud, byte_buf, head, tail.
(string_out_byte_callback, string_out_byte_flush): New static
functions.
(string_out_put_string): Flush any UTF-8 bytes in the byte buffer
before putting the string.
(string_out_put_byte): New static function, implementation for
put_byte on string output streams.
(string_out_ops): string_out_put_byte wired in.
(make_string_output_stream): Initialize new members of
of struct string_output.
(get_string_from_stream): Flush any UTF-8 bytes in the byte buffer
before retrieving the string.
(put_byte): Validate that the byte is in range. Pass byte
as C int down to the put_byte virtual.
|
|
|
|
|
| |
* stream.c (byte_in_stream_destroy): New function.
(byte_in_ops): Use new function instead of noop stub.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
that output has taken place and suppress the printing of bindings.
* debug.c (debug): std_output replaced with std_debug.
* eval.c (eval_init): Registered new *stddebug* variable.
* stream.c (std_debug): New variable.
(stdio_put_string): Check that stream is other than
std_debug, to determine that output has taken place.
* stream.h (std_debug): Declared.
* txr.1: Added *stddebug* to documentation stub heading.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.h: Likewise.
* debug.c: Added copyright header.
* debug.h: Updated copyright year.
* eval.c: Likewise.
* eval.h: Likewise.
* filter.c: Likewise.
* filter.h: Likewise.
* gc.c: Likewise.
* gc.h: Likewise.
* hash.c: Likewise.
* hash.h: Likewise.
* lib.c: Likewise.
* lib.h: Likewise.
* match.c: Likewise.
* match.h: Likewise.
* parser.h: Likewise.
* regex.c: Likewise.
* regex.h: Likewise.
* stream.c: Likewise.
* stream.h: Likewise.
* txr.c: Likewise, and e-mail address.
* txr.h: Updated copyright year.
* unwind.c: Likewise.
* unwind.h: Likewise.
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (struct strm_ops): New member, put_byte.
(stdio_put_byte): New function.
(stdio_ops, pipe_ops, string_in_ops, byte_in_ops,
string_out_ops, strlist_out_ops, dir_ops): Updated.
(put_byte): New function.
* stream.h (put_byte): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* debug.c (help, show_bindings): put_string arguments reversed.
* eval.c (bind_args): Support colon notation in interpreted
function lambda lists for optional arguments. Improved error checking.
(apply): Allow optional arguments to be left out.
(dwim_loc): Reversed arguments to replace_str, replace_vec,
replace_list.
(eval_init): Numerous intrinsics now have arguments that are optional.
New function rand introduced which reverses arguments relative to
random. New intrinsic function hash introduced for alternative
construction of hashes.
* gc.c (sweep): Reversed arguments to put_char.
* hash.c (weak_keys_k, weak_vals_k, equal_based_k): New keyword
symbol variables.
(hashv): New function.
(hash_init): Intern new symbols.
* hash.h (weak_keys_k, weak_vals_k, equal_based_k, hashv): Declared.
* lib.c (colon_k): New keyword symbol variable.
(replace_list, replace_str, replace_vec): Arguments rearranged.
(tree_find): testfun becomes optional argument.
(int_str): base becomes optional argument.
(func_f0, func_f1, func_f2, func_f3, func_f4, func_n0,
func_n1, func_n2, func_n3, func_n4, func_f0v, func_f1v,
func_f2v, func_f3v, func_f4v, func_n0v, func_n1v,
func_n2v, func_n3v, func_n4v, func_interp): Initialize optargs to zero.
(func_n0o, func_n1o, func_n2o, func_n3o, func_n4o): New functions.
(cobj_print_op): Reversed arguments to put_string.
(find): testfun and keyfun become optional arguments.
(replace): Parameters rearranged and arguments rearranged in calls to
replace_list, replace_str and replace_vec.
(obj_init): colon_k initialized.
(obj_print, obj_pprint): Arguments reversed, and stream defaults
to std_output. Arguments reversed in calls to put_char and put_string.
(dump): Arguments reversed in call to put_char.
* lib.h (struct func): sizes of minparam, fixparam bitfields
adjusted. New bitfield optargs. New unnamed bitfield added so
the previous ones add up to 16 bits.
(colon_k): Declared.
(func_n0o, func_n1o, func_n2o, func_n3o, func_n4o): Declared.
(replace_list, replace_str, replace_vec, replace): Declarations updated.
* match.c (debuglf, dump_shell_string, dump_byte_string, dump_var,
do_output_line, extract): Reversed arguments to put_char and
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
or not. This is now done right inside the standard output stream.
* match.c (output_produced): Variable removed.
(complex_open): Assignment to output_produced removed.
* stream.c (output_produced): New global variable.
(stdio_put_string, stdio_put_char): Set output_produced
to t if the target of the output is stdout.
* stream.h (output_produced): Declared.
* txr.h (output_produced): Declaration removed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* match.c (v_do): Store match context.
(match_fun): New function.
* match.h (match_fun): Declared.
* stream.c (streamp): New function.
* stream.h (streamp): Declared.
* txr.1: Stub section for match-fun.
* txr.vim: Highlight match-fun.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
character literals as hex escapes, followed by semicolon if
necessary. Don't use iswprint function since it is locale-specific
and concludes that non-ASCII characters are unprintable.
Changed print syntax for lazy strings.
(obj_pprint): Changed print syntax for lazy strings.
* parser.l: Bugfix in hex/octal character constant.
num_esc(yytext) was called rather than num_esc(yytext+1).
* parser.y (chrlit): Bugfix: missing case for hex and octal
constants which are given by a LITCHAR token.
* stream.c (vformat): Bugfix: strings were being printed as if using ~a
even under ~s.
|
|
|
|
|
|
|
| |
the object is not a string or number, then print it to a string
and treat it as a string, adjusting it within the field.
Also, do not simply abort on an unknown format directive
but throw a proper exception.
|
|
|
|
|
| |
using < rather than '-'. The +, space and leading 0 are
specified on the precision, not the width.
|
|
|
|
|
| |
strings are printed the same way under ~s and ~a. The only difference
is printing other kinds of objects.
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (format_num): New argument: sign character.
Rewrote to handle precision, width, zero padding and
leading sign similarly to printf.
(vformat): New syntax accepted: a space or + before
the width specifies that a positive sign is to be
explicitly written as a space or + character.
Pass one more argument to vormat_num calls.
Bugfix: go back to vf_init state after processing ~~.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bignums, based on Michael Fromberger's MPI library, are integrated
into the input syntax, stream output, equality testing, the garbage
collector, and hashing.
The plus operation handles transitions between fixnums and bignums.
Other operations are still fixnum only.
* Makefile (CFLAGS): Add mpi directory to include file search.
(OBJS): Include new arith.o module and all of MPI_OBJS.
(MPI_OBJS, MPI_OBJS_BASE): New variables.
* configure (mpi_version, have_quilt, have_patch): New variables.
Script detects whether patch and quilt are available. Unpacks
mpi library, applies patches. Detects 128 bit integer type.
Records more information in config.h about the sizes of types.
* dep.mk: Updated.
* depend.txr: Make work with paths that have directory components.
* eval.c (eval_init): Rename of nump to fixnump.
* gc.c (finalize, mark_obj): Handle BGNUM case.
* hash.c: (hash_c_str): Changed to return unsigned long
instead of long.
(equal_hash): Handle BGNUM case.
(eql_hash): Handle bignums with equal-hash, but other
objects as eq.
* lib.c (num_s): Variable renamed to fixnum_s.
(bignum_s): New symbol variable.
(code2type): Follow rename of num_s. Handle BGNUM case.
(typeof): Follow rename of num_s.
(eql): Handle bignums using equal, and other types using eq.
(equal): Handle BGNUM case.
(chk_calloc): New function.
(c_num): Wording change in error message: is not a fixnum.
(nump): Renamed to fixnump.
(bignump): New function.
(plus): Function removed, reimplemented in arith.c.
(int_str): Handle integers which are too large for wcstol
using bignum conversion. Base 0 is no longer passed to
wcstol but converted to 10 because the special semantics
for 0 would be inconsistent for bignums.
(obj_init): Follow rename of num_s. Initialize bignum_s.
|