summaryrefslogtreecommitdiffstats
path: root/txr.c
Commit message (Collapse)AuthorAgeFilesLines
* * Makefile, arith.c, arith.h, combi.c, combi.h, configure, debug.c,Kaz Kylheku2014-07-231-16/+16
| | | | | | | | debug.h, eval.c, eval.h, filter.c, filter.h, gc.c, gc.h, hash.c, hash.h, lib.c, lib.h, match.c, match.h, parser.h, parser.l, parser.y, rand.c, rand.h, regex.c, regex.h, signal.c, signal.h, stream.c, stream.h, syslog.c, syslog.h, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h: Synchronize license header with LICENSE.
* * txr.c (txr_main): Allow Lisp code executed via -e and -p options toKaz Kylheku2014-07-141-2/+2
| | | | see the bindings set up by prior -D options.
* * Makefile: install the LICENSE and METALICENSE files into the dataKaz Kylheku2014-07-071-0/+39
| | | | | | | | | | | | directory. * txr.c (help): Help text updated to document --license option. (license): New function. (txr_main): Implement --license option. * unwind.h (uw_catch): Add cast to suppress warning about unused symbol. * txr.1: Document --license option.
* * Makefile: Install share/txr/stdlib/*.txr material.Kaz Kylheku2014-06-121-0/+3
| | | | | | | | | | | * match.c (do_txeval): If a variable is not in the bindings, fall back on treating it as a TXR Lisp dynamic variable. This allows us to refer to the stdlib variable from a quasistring in a @(load ...) directive. * txr.c (sysroot_init): Register new variable, *txr-version*. * share/txr/stdlib/ver.txr: New file.
* * Makefile (txr.o): Pass TXR_VER preprocessor symbol on gcc commandKaz Kylheku2014-06-111-1/+1
| | | | | | | | | | | | | | | | | | | | line. (PREINSTALL): New variable holding a step for the install recipe. (pax tar zip): New targets. * configure (txr_ver): Version now added to config.make, passed through to txr.c. (gen_config_make): bindir, datadir and mandir are established using gmake's regular macro assignment (=) rather than expanding assignment (:=). This allows us to override the prefix variable after configure time. * lib.h (wli_noex): New macro. (wli): Retarget to wli_noex, so that argument is subject to macro replacement. * txr.c (version): Use TXR_VER defined on compiler command line, rather than hard-coded string literal.
* 2014-06-10 Kaz Kylheku <kaz@kylheku.com>Kaz Kylheku2014-06-101-4/+4
| | | | | | | | | | | | | | | * Makefile (PROG): Removing ./ prefix from variable name; adding it to invocations of $(PROG) in some rules. (txr.o): Pass several strings as macros on the command line: TXR_REL_PATH, EXE_SUFF and PROG_NAME. * configure (bindir, datadir, mandir): These variables become just relative paths from the prefix. * txr.c (sysroot): Use the TXR_REL_PATH, EXE_SUFF and PROG_NAME preprocessor symbols defined on the command line to avoid hard-coding strings like "bin/txr" and "bin/txr.exe" which actually should reflect the value of the bindir variable.
* * txr.c (get_self_path): Fix spelling of GetModuleFileName.Kaz Kylheku2014-06-101-3/+10
| | | | | | Add missing parentheses in expression. (sysroot_init): On Windows, filter progpath to change backslashes to forward slashes.
* New variable stdlib, with a sysroot mechanism to computeKaz Kylheku2014-06-091-0/+79
| | | | | | | | | the path based on the "sysroot" where it is actually installed. * txr.c (progname_8u, progpath): New static variables. (get_self_path, sysroot_helper, sysroot, sysroot_init): New static functions. Sysroot creates a stdlib variable. (main): Initialize progname_u8 value, and call sysroot_init.
* * txr.c (txr_main): New option --args.Kaz Kylheku2014-06-091-0/+8
| | | | | | Also, put in missing check for -f being erroneously clumped. * txr.1: Documented.
* The dumping of bindings and printing of false must nowKaz Kylheku2014-06-091-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | be explicitly requested by the -B option. * match.c (opt_nobindings): Variable removed. (opt_print_bindings): New variable. (extract): Print bindings or "false" if opt_print_bindings is true. * stream.c (output_produced): Variable removed. (stdio_put_string, stdio_put_char, stdio_put_byte): Remove update of output_produced. * stream.h (output_produced): Declaration removed. * txr.1: Documentation updated. * txr.c (txr_main): Option 'b' does nothing. 'B', 'l', 'a', and '--lisp-bindings' set opt_print_bindings to 1. * txr.h (opt_nobindings): Declaration removed. (opt_print_bindings): Declared. * unwind.c (uw_throw): When exiting due to a query error or file error, print false when opt_print_bindings is true.
* Version 89txr-89Kaz Kylheku2014-05-101-1/+1
|
* Update year in --help message.Kaz Kylheku2014-04-071-1/+1
|
* Version 88txr-88Kaz Kylheku2014-04-041-1/+1
|
* Version 87.txr-87Kaz Kylheku2014-03-221-1/+1
|
* Version 86.txr-86Kaz Kylheku2014-03-161-1/+1
|
* Version 85.txr-85Kaz Kylheku2014-03-081-1/+1
|
* Version 84.txr-84Kaz Kylheku2014-03-071-1/+1
|
* * lib.c (upop): New function.Kaz Kylheku2014-03-071-8/+8
| | | | | | | | | | | | | | * lib.h (upop): Declared. * txr.c (txr_main): Two bugfixes. One is that the argument - was being pushed back twice resulting in *args* being ("-" "-"). This is because the option processing loop checked for "-" and pushed it back into args, and then some logic after the loop pushed arg back into args again. But, these pushes were wrong because they push back a different cons cell; we would like to be able to do (ldiff *full-args* *args*). This is solved by upop, which provides one element of undo. After upop, we can restore the prior list from the undo save location.
* * txr.c (txr_main): Don't push back arg into arg_list if arg is nil.Kaz Kylheku2014-03-051-2/+4
|
* Version 83txr-83Kaz Kylheku2014-03-021-1/+1
| | | | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version, set date. * configure (txr_ver): Bumped. * RELNOTES: Updated * dep.mk: Updated.
* Change in the design of how special variables work, to fix the brokenKaz Kylheku2014-02-281-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | re-binding. C code now has to go through the dynamic environment lookup to access things like *random-state*, or *stdout*. As part of this, I'm moving some intrinsic variable and function initializations out of eval.c and into their respective modules. Macros are are used to make global variables look like ordinary C variables. This is very similar to the errno trick in POSIX threads implementations. * eval.c (looup_var, lookup_var_l): Restructured to eliminate silly goto, the cobjp handling is gone. (reg_fun, reg_var): Internal function becomes external. reg_var registers a simple cons cell binding now, without any C pointer tricks to real C global variables. (c_var_mark): Static function removed. (c_var_ops): Static struct removed. (eval_init): Numerous initializations for streams, syslog, rand, signals and others moved to their respective modules. The new symbol variables user_package_s, keyword_package_s and system_package_s are interned here, and the variables are created in a special way. * eval.h (reg_var, reg_fun): Declared. * gc.c (prot1): Added assert that the loc pointer isn't null. This happened, and blew up during garbage collection. * lib.c (system_package, keyword_package, user_package): Variables removed these become macros. (system_package_var, keyword_package_var, user_package_var): New global variables. (system_package_s, keyword_package_s, user_package_s): New symbol globals. (get_user_package, get_system_package, get_keyword_package): New functions. (obj_init): Protect new variables. Initialization order of modules tweaked: the modules sig_init, stream_init, and rand_init are moved after eval_init because they register variables. * lib.h (keyword_package, system_pckage, user_package): Variables turned into macros. (system_package_var, keyword_package_var, user_package_var): Declared. (system_package_s, keyword_package_s, user_package_s): Declared. (get_user_package, get_system_package, get_keyword_package): Declared. * rand.c (struct random_state): Renamed to struct rand_state to avoid clash with new random_state macro. (random_state): Global variable removed. (random_state_s): New symbol global. (make_state, rand32, make_random_state, random_fixnum, random): Follow rename of struct random_state.
* Version 82.txr-82Kaz Kylheku2014-02-271-1/+1
|
* Version 81txr-81Kaz Kylheku2014-02-261-1/+1
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES, txr.vim: Updated.
* * eval.c (env_hash): new function.Kaz Kylheku2014-02-181-107/+78
| | | | | | | | | | | | | | | | (eval_init): Register env and env_hash functions. Register prog_args and prog_args_full as *args* and *full-args*. * lib.c (timegm_hack): Invalidate env_list, after mucking with the environment via setenv and unsetenv. * txr.c (prog_args_full, prog_args): New global variables. (txr_main): Command-line processing converted to use TXR's library. Populates prog_args_full and prog_args. * txr.h (prog_args_full, prog_args): Declared. * txr.1: Documented *args*, *full-args*, env and env-hash.
* Version 80txr-80Kaz Kylheku2014-02-171-1/+1
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES, txr.vim, dep.mk: Updated.
* Version 79txr-79Kaz Kylheku2014-02-111-1/+1
|
* Version 78.txr-78Kaz Kylheku2014-02-061-1/+1
|
* Version 77txr-77Kaz Kylheku2014-01-291-1/+1
|
* Version 76txr-76Kaz Kylheku2014-01-231-1/+1
|
* Changes to the list collection mechanism to improveKaz Kylheku2014-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the extension of list operations over vectors and strings. * eval.c (do_eval_args, bindings_helper, op_each, subst_vars, supplement_op_syms, mapcarv, mappendv): Switch from list_collect_* macros to functions. * lib.c (copy_list): Switch from list_collect* macros to functions. Use list_collect_nconc for the final terminator. Doing a copy there with list_collect_append was actually wasteful, and now that list_collect_append calls copy_list in places, it triggered runaway recursion. (make_like): Bugfix: list_vector was used instead of vector_list. (to_seq, list_collect, list_collect_nconc, list_collect_append): New functions. (append2, appendv, nappend2, sub_list, replace_list, ldiff, remq, remql, remqual, remove_if, keep_if, proper_plist_to_alist, improper_plist_to_alist, split_str, split_str_set, tok_str, list_str, chain, andf, orf, lis_vector, mapcar, mapcon, mappend, merge, set_diff, env): Switch from list_collect* macros to functions. (replace_str, replace_vec): Allow single item replacement sequence. * lib.h (to_seq): Declared. (list_collect, list_collect_nconc, list_collect_append): Macros removed, replaced by function declarations of the same name. These functions return the new ptail since they cannot assign to it, requiring all uses to be updated to do the assignment of the returned value. (list_collect_decl): Use val rather than obj_t *. * match.c (vars_to_bindings, h_coll, subst_vars, extract_vars, extract_bindings, do_output_line, do_output, v_gather, v_collect): Switch from list_collect* macros to functions. * parser.y (o_elems_transform): Likewise. * regex.c (dv_compile_regex, regsub): Likewise. * txr.c (txr_main): Likewise.
* * eval.c (eval_instrinsic): Changed to external linkage.Kaz Kylheku2014-01-221-15/+32
| | | | | | | | | * 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.
* Version 75.txr-75Kaz Kylheku2014-01-161-1/+1
|
* Version 74txr-74Kaz Kylheku2014-01-131-1/+1
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES, txr.vim, dep.mk: Updated.
* * configure: Generate HAVE_VALGRIND as #define-d to 1, rathernKaz Kylheku2014-01-101-1/+1
| | | | | | | | | | | | | | | than just fdefined. * gc.c: Use #if HAVE_VALGRIND instaed of #ifdef HAVE_VALGRIND, consistently with other HAVE_* config variables. * lib.c: Likewise. * lib.h: Likewise. * txr.c: Likewise. * txr.h: Likewise.
* Version 73txr-73Kaz Kylheku2014-01-081-1/+1
|
* Version 72txr-72Kaz Kylheku2013-12-171-1/+1
|
* First cut at signal handling support.Kaz Kylheku2013-12-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* * txr.c (txr_main): Change stderr to line buffered mode.Kaz Kylheku2013-12-111-0/+2
|
* Bumping copyrights to 2014 and expressing them as year ranges.Kaz Kylheku2013-12-101-1/+1
| | | | Fixing some errors in copyright comments.
* syslog support; bitwise logior and logand functions become variadic.Kaz Kylheku2013-12-101-0/+4
| | | | | | | | | | | | | | | | | | | | * 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.
* Version 71txr-71Kaz Kylheku2013-12-071-1/+1
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES: Updated.
* Fixing some old-style coding that became obsoleteKaz Kylheku2013-12-061-2/+1
| | | | | | | | | | | | 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.
* * eval.c (eval_init): Registered regex_parse as newKaz Kylheku2013-12-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* * configure: Added check to detect POSIX sleep function.Kaz Kylheku2013-11-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Version 70txr-70Kaz Kylheku2013-11-211-1/+1
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES: Updated.
* Version 69.txr-69Kaz Kylheku2013-10-231-1/+1
|
* Version 68.txr-68Kaz Kylheku2013-10-071-1/+1
|
* Version 67Kaz Kylheku2013-07-121-1/+1
| | | | | | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version, set date and documented string-cmp. * configure (txr_ver): Bumped. * eval.c (eval_init): Forgotten string-cmp registered as intrinsic. * txr.vim: Highlighting for string-cmp. * RELNOTES: Updated.
* Version 66.txr-66Kaz Kylheku2013-05-161-1/+1
|
* Version 65txr-65Kaz Kylheku2012-04-201-1/+1
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES: Updated.