summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
...
* Default argument initializer scoping rule change, allowingKaz Kylheku2014-01-291-7/+17
| | | | | | | | | | | | | things like (defun foo (s : (l (length s))) ...). Default arguments can be initialized by expressions that refer to the arguments. * eval.c (bind_args): By means of a local array, defer the evaluation of optional argument init forms until the lexical environment, including all the parameters, is captured. Then valuates the forms in the array, and set the variable values. * txr.1: Clarify the new scoping rules.
* * eval.c (eval_init): Registered existing make_catenated_stream asKaz Kylheku2014-01-281-0/+40
| | | | | | | | | | | | | | intrinsic. * stream.c (cat_get_line, cat_get_char, cat_get_byte): Do not remove the last stream from the stream list, so that there is some stream object there which can take the unget-char or unget-byte operations. (cat_unget_byte, cat_unget_char): New static functions. (cat_stream_ops): unget_char and unget_byte function pointers filled in. * txr.1: Documented catenated-streams.
* * eval.c (meta_meta_p, meta_meta_strip): New static functions.Kaz Kylheku2014-01-281-1/+23
| | | | | | | | | | | | | | | (transform_op): Recognize compounded metas, and strip one level off. (eval_init): Intern sys:expand function so we have access to the form expander from TXR Lisp. * lib.c (obj_print, obj_pprint): Fix: wasn't rendering metanumbers. * parser.y (list): Support @ in front of anything. If it's an atom, treat it similarly to a metasymbol or metanumber. * txr.1: Documented meta-meta arguments in nested op. * genvim.txr, txr.vim: Support coloring for compounded meta syntax.
* * lib.c (reduce_left, reduce_right): changing the behavior so thatKaz Kylheku2014-01-271-21/+50
| | | | | | | | | the initial value is optional. this creates the possibility that the effective list of operands is empty, in which case the function must support a call with no arguments, just like in the common lisp reduce. * txr.1: rewrote reduce-left and reduce-right documentation.
* * regex.c (match_regex_right): Fix semantics of second argumentKaz Kylheku2014-01-271-5/+67
| | | | | | | | to something more useful. * regex.h (match_regex_right): Change name of parameter. * txr.1: Documented match-regex-right.
* * hash.c (hash_update): New function.Kaz Kylheku2014-01-241-0/+31
| | | | | | | | | | | | * hash.h (hash_update): Declared. * lib.c (update): New function. * lib.h (update): Declared. * eval.c (eval_init): Register hash_update and update as intrinsics. * txr.1: Documented.
* Version 76txr-76Kaz Kylheku2014-01-231-2/+2
|
* * eval.c (expand_op): Takes sym argument to distinguish op and do.Kaz Kylheku2014-01-231-1/+23
| | | | | | | | The dwim operator is deleted when the symbol is do. (expand): Expand do_s form with expand_op, not only op_s. Pass down symbol. * txr.1: Document do operator.
* * lib.c (conses, lazy_conses, func_set_env): New functions.Kaz Kylheku2014-01-231-1/+47
| | | | | | | | | | | (lazy_conses_func): New static function. * lib.h (conses, lazy_conses, func_set_env): Declared. * eval.c (eval_init): conses, lazy_conses and func_set_env registered as intrinsics. * txr.1: Documented.
* Support function versions of if, and, or so that partialKaz Kylheku2014-01-221-4/+37
| | | | | | | | | | | | | | evaluation like (op or @1 42) or (op if (eq @1 foo) bar xyzzy) is possible. * eval.c (do_eval): Change precedence between operator and function lookup to favor operators. This is important since there are several operators now which are also functions. (if_fun, or_fun, and_fun): New static functions. (eval_init): New functions registered as intrinsics. * txr.1: Documented that if, and, or exist as both functions and operators.
* * eval.c (eval_instrinsic): Changed to external linkage.Kaz Kylheku2014-01-221-0/+10
| | | | | | | | | * eval.h (eval_intrinsic): Declared. * txr.c (spec_file): Global variable removed. (txr_main): Support for -e and -p options. Minor code cleanup. * txr.1: Documented new options.
* * eval.c (mapcarv, mappendv): Convert output to type of leftmostKaz Kylheku2014-01-211-0/+9
| | | | | | | | | | | | | input sequence. * lib.c (make_like): New function. (reverse, remq, remql, remqual, remove_if, keep_if, mapcar, mapcon, mappend, set_diff): Convert output list to type of leftmost input sequence. * lib.h (make_like): Declared. * txr.1: Documented.
* * lib.c (car, cdr, ldiff): Extend to handle vectors and strings.Kaz Kylheku2014-01-211-0/+34
| | | | | | | Thereby, numerous previously list-only operations in TXR Lisp now magically handle strings and vectors. * txr.1: Documented.
* * lib.c (broken_down_time_list): New static function.Kaz Kylheku2014-01-201-0/+25
| | | | | | | | | | | (time_fields_local, time_fields_utc): New functions. * lib.h (time_fields_local, time_fields_utc): Declared. * eval.c (eval_init): Intern time_fields_local and time_fields_utc as intrinsic functions. * txr.1: Documented.
* * hash.c (group_by): New function.Kaz Kylheku2014-01-161-0/+31
| | | | | | | | * hash.h (group_by): Declared. * eval.c (eval_init): group_by registered as group-by intrinsic. * txr.1: Documented.
* Version 75.txr-75Kaz Kylheku2014-01-161-2/+2
|
* * eval.c (append_each_s, append_each_star_s): New symbol variables.Kaz Kylheku2014-01-151-13/+23
| | | | | | | | (op_each, expand): Support append-each and append-each*. (eval_init): Initialize new symbol variables, and register new operators. * txr.1: Document append-each and append-each*.
* * arith.c (atang2): New function.Kaz Kylheku2014-01-151-2/+4
| | | | | | | | * eval.c (eval_init): Register as atang2 as a atan2 intrinsic. * lib.h (atang2): Declared. * txr.1: Documented atan2.
* * txr.1: Wrote missing documentation for throw, throwf and error.Kaz Kylheku2014-01-141-0/+23
|
* Clarifications about unget-char and unget-byte.Kaz Kylheku2014-01-141-0/+15
|
* * eval.c (bind_args): Implemented default values for optionalKaz Kylheku2014-01-141-0/+6
| | | | | | | arguments. (op_defun): Permit the syntax. * txr.1: Documented.
* Support for pushing back bytes and characters into streams.Kaz Kylheku2014-01-131-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | * stream.c (null_ops, stdio_ops, tail_ops, pipe_ops, string_in_ops, byte_in_ops, string_out_ops, strlist_out_ops, dir_ops, cat_stream_ops): Structure definition updated with new initializers for two new virtuals. (stdio_handle): New member, unget_c. (snarf_line, stdio_get_char): Handle pushed-back character in h->unget_c. (stdio_unget_char, stdio_unget_byte, string_in_unget_char, byte_in_unget_byte): New static functions. (make_stdio_stream_common): Initialize unget_c member. (unget_char, unget_byte): New functions. * stream.h (struct strm_ops): New virtuals: unget_char and unget_byte. (unget_char, unget_byte): New functions declared. * syslog.c (syslog_strm_ops): Two new initializers. * eval.c (eval_init): Registered unget_char and unget_byte as intrinsics. * txr.1: Documented.
* Version 74txr-74Kaz Kylheku2014-01-131-2/+2
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES, txr.vim, dep.mk: Updated.
* * arith.c (rising_product): New static function.Kaz Kylheku2014-01-111-0/+31
| | | | | | | | | | (n_choose_k, n_perm_k): New functions. * arith.h (n_choose_k, n_perm_k): Declared. * eval.c (eval_init): New functions interned. * txr.1: Documented.
* * arith.c (to_float): Print function name as ~a rather than ~s,Kaz Kylheku2014-01-111-0/+14
| | | | | | | | | | | | so it doesn't have quotes around it. (cum_norm_dist): New function. * arith.h (cum_norm_dist): Declared. * eval.c: Include arith.h. (eval_init): Register cum_norm_dist as intrinsic. * txr.1: Documented cum-norm-dist.
* * eval.c (eval_init): Renaming lisp-parse to read; lisp-parseKaz Kylheku2014-01-101-7/+9
| | | | | | | | is retained as an obsolescent synonym. All arguments become optional. * parser.l (lisp_parse): Handle nil source. * txr.1: Updated.
* * match.c (do_txeval): Lift an annoying restriction in the patternKaz Kylheku2014-01-101-1/+5
| | | | | | | | | | language's expression evaluator. Whereas TXR Lisp expressions can be used int the pattern language, preceded by @, it was not possible to evaluate TXR Lisp variables this way. So instead of @var, some clumsy trick had to be used like @(identity var). This is not necessary any more. Code like @(next @*stdin*) will now work. * txr.1: Updated.
* Version 73txr-73Kaz Kylheku2014-01-081-2/+2
|
* Grammar.Kaz Kylheku2014-01-071-1/+1
|
* The lisp-parse function can now be called multiple timesKaz Kylheku2014-01-071-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on the same stream to extract multiple objects; the requirement that the stream must hold exactly one complete Lisp object with no following material is now lifted. * parser.l (YY_INPUT): Modified the macro so that it reads no more than one character. Though this probably makes the lexer less efficient, it gives us the important property that the lexer does not scan ahead into the input stream, hogging data into its buffer which is then destroyed. This is essential if the lisp-parse function is to support multiple calls to pull objects one by one out of a stream. * parser.y (spec): Use YYACCEPT in the SECRET_ESCAPE_E clause for pulling a single expression out of the token stream. YYACCEPT is a trick for not invoking the $accept : spec . $end production which is implicitly built into the grammar, and which causes a token of lookahead to occur. This allows us to read a full expression without stealing any further token: but only if the grammar is structured right. (exprs): This phrase structure now handles the DOTDOT syntax. There is no such thing as an expr DOTDOT expr expression any more; it is in the list syntax (and not supported in the dot position). (expr): Remove DOTDOT syntax. * txr.1: Updated description of .. syntax, and relaxed the description of lisp-parse since it now allows multiple calls to extract multiple objects.
* Version 72txr-72Kaz Kylheku2013-12-171-2/+2
|
* * eval.c (op_defvar): Fix the semantics to be similar to Common Lisp:Kaz Kylheku2013-12-171-0/+45
| | | | | | no effect if the variable already exists. * txr.1: Documented defvar and lisp-parse.
* * signal.c (sig_handler): Pass two arguments to signalKaz Kylheku2013-12-131-0/+26
| | | | | | | | | | | | | handler rather than 1. The new argument is the value t, telling the handler that it's asynchronously invoked in a real signal context. If the signal handler returns true, then mark it deferred so that it can re-trigger in a synchronous context. (sig_check): Pass nil as a the second argument to signal handlers, indicating that they are synchronously called, not in a signal handler context. * txr.1: Added documentation.
* * signal.c (set_sig_handler): Clear the deferred flagKaz Kylheku2013-12-131-1/+111
| | | | | | for a signal that is being set to ignored or default. * txr.1: Documented signals.
* * eval.c (eval_init): log_authpriv_v registered as log-authpriv.Kaz Kylheku2013-12-111-3/+12
| | | | | | | | | | * syslog.c (log_authpriv_v): New variable. (syslog_init): New variable initialized. * syslog.h (log_authpriv_v): Declared. * txr.1: Documented log-authpriv, and put in notes about testing for variables that may not be present, including log-perror.
* * eval.c (symbol_value, boundp, fboundp): New functions.Kaz Kylheku2013-12-111-6/+29
| | | | | | (eval_init): New functions registred as intrinsics. * txr.1: Documented.
* Bumping copyrights to 2014 and expressing them as year ranges.Kaz Kylheku2013-12-101-1/+1
| | | | Fixing some errors in copyright comments.
* * eval.c (eval_init): closelog_wrap interned.Kaz Kylheku2013-12-101-0/+12
| | | | | | | | * syslog.c (closelog_wrap): New function. * syslog.h (closelog_wrap): Declared. * txr.1: Documented.
* * eval.c (eval_init): Register streamp, real_time_stream_p,Kaz Kylheku2013-12-101-2/+91
| | | | | | | | | | | | 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.
* syslog support; bitwise logior and logand functions become variadic.Kaz Kylheku2013-12-101-3/+141
| | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Version 71txr-71Kaz Kylheku2013-12-071-2/+2
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES: Updated.
* * eval.c (eval_init): Update registration of regex-compileKaz Kylheku2013-12-061-5/+8
| | | | | | | | | | | | | | | | | | | to reflect that it has two arguments now. * parser.y (grammar): Update calls to regex_compile to pass two arguments. Since we don't expect regex_compile to parse, we specify the error stream as nil. (spec): The "secret syntax" for a regex is simplified not to include the slashes. This provides better diagnostics for unterminated syntax and requires less string processing to generate. Also, the form returned doesn't have the regex symbol consed onto it, which parse_regex just throws away. * regex.c (regex_compile): Now takes a stream argument. * regex.h (regex_compile): Declaration updated. * txr.1: Updated
* * regex.c (regex_compile): Handle string input.Kaz Kylheku2013-12-051-4/+11
| | | | | | | * regex.h (regex_compile): Don't call argument regex_sexp, since it can be a string. * txr.1: Updated.
* * eval.c (eval_init): Registered regex_parse as newKaz Kylheku2013-12-051-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* * eval.c (eval_init): New functions countqual, countql, countqKaz Kylheku2013-11-291-0/+33
| | | | | | | | | | and count_if registered as intrinsics. * lib.c (countqual, countql, countq, count_if): New functions. * lib.h (countqual, countql, countq, count_if): Declared. * txr.1: New functions documented.
* * configure (config_flags): New variable, allowing us toKaz Kylheku2013-11-291-2/+10
| | | | | | | | | | | | | | | | | | | have stricter diagnosis for configure tests. (have_timegm, need_svid_source, need_bsd_source): New variables. sys/stat.h test only declares static data and compiles an object file. Adding tests for timegm, tzset, setenv and unsetenv. * eval.c (eval_init): Register new intrinsic, make_time_utc. * lib.c (make_time_impl): New static function. (make_time): Reimplemented as call to make_time_impl. (timegm_hack): New conditionally-defined static function. (make_time_utc): New function. * lib.h (make_time_utc): Declared. * txr.1: make-time-utc documented.
* * configure: Detect the daemon function.Kaz Kylheku2013-11-281-0/+32
| | | | | | | | | | * eval.c: Include <unistd.h> conditionally. (errno_wrap, daemon_wrap): New functions. (eval_init): Registered errno_wrap and daemon_wrap as intrinsics under the names daemon and errno. * txr.1: Documented errno and daemon in new UNIX PROGRAMMING section.
* * txr.1: Documented open-tail and make-time.Kaz Kylheku2013-11-281-0/+57
|
* Stream-seeking functionality.Kaz Kylheku2013-11-261-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Version 70txr-70Kaz Kylheku2013-11-211-2/+2
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES: Updated.