summaryrefslogtreecommitdiffstats
path: root/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* build: split tlos into three groups rather than two.Kaz Kylheku2024-06-301-2/+5
| | | | | | | | | | | | It seems that there are several more .tlo files that we should compile earlier for a better build time. * Makefile (STDLIB_MIDDLE_TLOS): New variable. We include error.tlo in here because a new circular dependency has been revealed involving usr:catch. (STDLIB_LATE_TLOS): Also exclude STDLIB_MIDDLE_TLOS. (all): Depend on STDLIB_MIDDLE_TLOS between the early and late ones.
* build: include place.tlo among early tlo's.Kaz Kylheku2024-03-081-1/+2
| | | | | | * Makefile (STDLIB_EARLY_TLOS): Include place.tlo between compiler.tlo and asm.tlo. If place is built late, it has a bad impact on the build time.
* Copyright year bump 2024.Kaz Kylheku2024-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * LICENSE, LICENSE-CYG, METALICENSE, Makefile, alloca.h, args.c, args.h, arith.c, arith.h, autoload.c, autoload.h, buf.c, buf.h, cadr.c, cadr.h, chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, gzio.c, gzio.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c, lib.h, linenoise/linenoise.c, linenoise/linenoise.h, match.c, match.h, parser.c, parser.h, parser.l, parser.y, psquare.h, rand.c, rand.h, regex.c, regex.h, signal.c, signal.h, socket.c, socket.h, stdlib/arith-each.tl, stdlib/asm.tl, stdlib/awk.tl, stdlib/build.tl, stdlib/cadr.tl, stdlib/compiler.tl, stdlib/constfun.tl, stdlib/conv.tl, stdlib/copy-file.tl, stdlib/csort.tl, stdlib/debugger.tl, stdlib/defset.tl, stdlib/doloop.tl, stdlib/each-prod.tl, stdlib/error.tl, stdlib/except.tl, stdlib/expander-let.tl, stdlib/ffi.tl, stdlib/getopts.tl, stdlib/getput.tl, stdlib/glob.tl, stdlib/hash.tl, stdlib/ifa.tl, stdlib/keyparams.tl, stdlib/load-args.tl, stdlib/match.tl, stdlib/op.tl, stdlib/optimize.tl, stdlib/package.tl, stdlib/param.tl, stdlib/path-test.tl, stdlib/pic.tl, stdlib/place.tl, stdlib/pmac.tl, stdlib/quips.tl, stdlib/save-exe.tl, stdlib/socket.tl, stdlib/stream-wrap.tl, stdlib/struct.tl, stdlib/tagbody.tl, stdlib/termios.tl, stdlib/trace.tl, stdlib/txr-case.tl, stdlib/type.tl, stdlib/vm-param.tl, stdlib/with-resources.tl, stdlib/with-stream.tl, stdlib/yield.tl, stream.c, stream.h, struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h, syslog.c, syslog.h, termios.c, termios.h, time.c, time.h, tree.c, tree.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c, vm.h, vmop.h, win/cleansvg.txr, y.tab.c.shipped: Copyright year bumped to 2024.
* build: wrong build order of STDLIB_EARLY_TLOS.Kaz Kylheku2024-01-051-5/+2
| | | | | | | | | | | | | | | | | The STDLIB_EARLY_TLOS are not being built in the intended order for several reasons. Firstly, the list is built by filtering STDLIB_TLOS which are in an order pulled by the wildcard command. Secondly, the order-only rule isn't preserving the order among the early tlos, only ensuring that those members of STDLIB_TLOS which occur in STDLIB_EARLY_TLOS are built before the others. * Makefile (STDLIB_EARLY_PATS): Variable removed. (STDLIB_EARLY_TLOS): Specified directly rather than via filtering. (all): Don't depend on $(STDLIB_TLOS) but rather on $(STDLIB_EARLY_TLOS) and $(STDLIB_LATE_TLOS) in that order. ($(STDLIB_LATE_TLOS):): Ordering rule removed.
* build: automate clean-up of shipped scanner and parserKaz Kylheku2023-12-281-2/+1
| | | | | | | | | | * Makefile (shipped): Copy the shipped materials unconditionally, rather than checking if they are different. If a patch exists for a shipped file, then apply it. * lex.yy.c.shipped, y.tab.c.shipped: Updated. * lex.yy.c.patch, y.tab.c.patch: New files.
* Makefile: operands reversed in abbreviated output.Kaz Kylheku2023-12-201-1/+1
| | | | | | * Makefile (shipped): This rule works correctly but shows, for instance, COPY lex.yy.c.shipped -> lex.yy.c. which is backwards. Let's fix it.
* build: misspelled PLATFORM_LDLIBS.Kaz Kylheku2023-10-061-1/+1
| | | | | | * Makefile (TXR_LDLIBS): Fix PLAFORM_LDLIBS typo in definition of variable. This typo renders ineffective the --platform-ldlibs option of the configure script.
* build: set DELETE_ON_ERROR in Makefile.Kaz Kylheku2023-09-221-0/+2
| | | | | | | * Makefile (.DELETE_ON_ERROR): Special target added. The GNU Make manual says that this is what we always want. Without this, a partially generated txr-manpage.html target is not removed if the recipe happens to die.
* build: remove mkdir commands from build steps.Kaz Kylheku2023-08-111-3/+8
| | | | | | | | | | | | | | * Makefile (COMPILE_C_WITH_DEPS, WINDRES): Do not call mkdir. (win/%.res): Express dependency on existence of win subdirectory in the build directory. We use an order-only prerequisite, so that timestamps are not compared. We don't want to be rebuilding objects if the directory they are in has a newer timestamp, which is often the case. (OBJS): Extract the relative directory paths from $(OBJS), and make each directory the target of a rule which creates it. Then, make each target in $(OBJS) dependent (order-only) on the directory into which it will be placed, so before that object is built, the directory gets created with mkdir -p.
* build: remove cruft, simplifying dep generation.Kaz Kylheku2023-08-111-34/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | We get rid of the sed-based processing which produces .v files from .d files. The only purpose of the variable assignments in the .v files ended up being a filter expression in the ABBREVN macro. I think the idea here was to show all the direct prerequisites of the target, suppressing the ones computed by generated dependency rules. * Makefile (ABBREVN): Just use $^ instead filtering out $^ using the $(DEP_$@) computed variable that holds all the dependencies. I don't see an issue. This is only used for linking and it correctly shows the .o files. (DEPGEN): Macro removed. (COMPILE_C_WITH_DEPS): Remove call to DEPGEN, removing an ugly sed step from the compilation of each file. (NL, CM, DEP): Macros removed. (OBJS, EXTRA_OBJS): Directly write rule which makes all objects depend on config.make. (opt/lex.yy.o, opt/txr.o, opt/match.o, opt/parser.o, opt/y.tab.o, dbg/lex.yy.o, dbg/txr.o, dbg/match.o, dbg/parser.o, dbg/y.tab.o): Explicitly write direct rules for these so the parser generation is correctly hooked into the dependency graph.
* build: speed up bootstrap compilation of stdlib.Kaz Kylheku2023-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | The compilation of stdlib from source code (an initial state when no .tlo files exist obtained by "make clean" or "make clean-tlo") is very sensitive to the file order. If the compiler and optimize modules are compiled late, it slows down the build greatly. The compiler mainly executes the code in the files compiler.tl, param.tl, optimize.tl and asm.tl. These should be compiled first, and I empirically determined the best order. * Makefile (STDLIB_EARLY_PATS): Remove error.tlo. The circular dependency involving error.tl doesn't seem to be an issue any more. A while ago I addressed some circular dependencies in stdlib that prevented it from being usable uncompiled; make tests didn't pass with a source-only stdlib. We instead repurpose STDLIB_EARLY_PATS to specify the four modules that should compile first, in their desired order, at least if parallel make is not being used.
* Adding SHA-1 hash.Kaz Kylheku2023-07-081-2/+2
| | | | | | | | | | | | | | | | | | * chksums/sha1.c, chksums/sha1.h: New files. * LICENSE, METALICENSE: Mention new code. * chksum.c (sha1_ctx_s, sha1_ctx_cls): New static variables. (chksum_init): Register sha-ctx symbol, and sha_ctx_s COBJ class. Register sha1-stream, sha1, sha1-begin, sha1-hash and sha1-end intrinsics. (sha1_stream_impl, sha1_stream, sha1_szmax_upd, sha1_buf, sha1_str, sha1, sha1_ops, sha1_begin, sha1_utf8_byte_callback, sha1_hash, sha1_end): These functions and variables are generated by a call to the cksum_impl macro. * Makefile (OBJS): add chksums/sha1.o object file.
* Copyright year bump 2023.Kaz Kylheku2023-01-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * LICENSE, LICENSE-CYG, METALICENSE, Makefile, alloca.h, args.c, args.h, arith.c, arith.h, autoload.c, autoload.h, buf.c, buf.h, cadr.c, cadr.h, chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, gzio.c, gzio.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lex.yy.c.shipped, lib.c, lib.h, linenoise/linenoise.c, linenoise/linenoise.h, match.c, match.h, parser.c, parser.h, parser.l, parser.y, protsym.c, psquare.h, rand.c, rand.h, regex.c, regex.h, signal.c, signal.h, socket.c, socket.h, stdlib/arith-each.tl, stdlib/asm.tl, stdlib/awk.tl, stdlib/build.tl, stdlib/cadr.tl, stdlib/compiler.tl, stdlib/constfun.tl, stdlib/conv.tl, stdlib/copy-file.tl, stdlib/debugger.tl, stdlib/defset.tl, stdlib/doloop.tl, stdlib/each-prod.tl, stdlib/error.tl, stdlib/except.tl, stdlib/ffi.tl, stdlib/getopts.tl, stdlib/getput.tl, stdlib/hash.tl, stdlib/ifa.tl, stdlib/keyparams.tl, stdlib/match.tl, stdlib/op.tl, stdlib/optimize.tl, stdlib/package.tl, stdlib/param.tl, stdlib/path-test.tl, stdlib/pic.tl, stdlib/place.tl, stdlib/pmac.tl, stdlib/quips.tl, stdlib/save-exe.tl, stdlib/socket.tl, stdlib/stream-wrap.tl, stdlib/struct.tl, stdlib/tagbody.tl, stdlib/termios.tl, stdlib/trace.tl, stdlib/txr-case.tl, stdlib/type.tl, stdlib/vm-param.tl, stdlib/with-resources.tl, stdlib/with-stream.tl, stdlib/yield.tl, stream.c, stream.h, struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h, syslog.c, syslog.h, termios.c, termios.h, time.c, time.h, tree.c, tree.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c, vm.h, vmop.h, win/cleansvg.txr, y.tab.c.shipped: Copyright year bumped to 2023.
* build: remove .tlo.tmp file before compiling.Kaz Kylheku2022-09-151-0/+1
| | | | | | | | | * Makefile (COMPILE_TL): Before we invoke txr --compile, let's make sure there isn't a .tmp file left over by a previous failed compile job. Otherwise --compile will consider that to be an up-to-date compiled file due to its newer timestamp relative to the .tl file, and we end up renaming that to .tlo.
* build: handle hard link failure in make install.Kaz Kylheku2022-08-091-1/+1
| | | | | | | | | * Makefile (HARDLINK): Print a diagnostic if the link command fails and ignore the situation. Hard links are restricted on Android. On that platform, txr being available under the names txrlisp and txrvm is likely of limited utility, so we won't waste space by making copies of the executable.
* Install a txrlisp hard link.Kaz Kylheku2022-07-211-0/+13
| | | | | | | | | | | | | | | | | | * Makefile (LN): New variable. On platforms where you can't hard link, this can be replaced with some other command. Possibly "true" not to have the alternative executable name created at all. (HARDLINK): New macro. (install): Use HARDLINK to create a link named txrlisp pointing to the same file as txr in the destination directory. * txr.c (txr_main): If the executable ends with "lisp" (or "lisp.exe" on Windows), then default the txr_lisp_p variable to t, which has the effect as if --lisp had been processed. * txr.1: Documented.
* txr: fix --free-all crash due to atexit order.Kaz Kylheku2022-06-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The --free-all feature is broken. It is needed for confirming lack of memory leaks during development. What breaks it is the atexit call to run_load_hooks in eval.c, which occurs after the atexit call to free_all in txr.c which blows everything away. * Makefile (tst/tests/019/load-hook.ok): Let's put --free-all on this test case, because it has to with the load hooks. Make no mistake though: everything crashes with --free-all, not this test case specifically. * txr.c (opt_free_all): New global variable. (free_all): Free resources only if opt_free_all is true. Lose the paranoid called flag. (main): Register free_all with atexit before callilng init. This ensures that it will be called after any atexit handlers registered as part of init, like the one in sysif.c and eval.c. (txr_main): The --free-all option now just sets opt_free_all. * txr.h (opt_free_all): Declared.
* First cut at new feature: gzip streams.Kaz Kylheku2022-05-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile (OBJS): Conditionally include new gzio.o object file. * configure: Detect external zlib, setting up new have_zlib variable in config.make, HAVE_ZLIB in config.h, and also -lz in conf_ldlibs. * gzio.[ch]: New files, implementing the stream abstraction over the gzip file I/O routines in zlib. * stream.h (struct stdio_mode): New gzip flag and gzlevel bitfield to hold a value 0 to 9. (stdio_mode_init_blank, stdio_mode_init_r, stdio_mode_init_rpb): Update intializers to cover new bitfield members. * stream.c: Include <zlib.h> and "gzio.h" if HAVE_ZLIB. (do_parse_mode): Recognize new mode modifier letter "z", setting the gzip flag in the mode structure. If it's followed by a digit, set the gziplevel to that value. (format_mode): Don't output "b" letter for binary mode if gzip is set, because gzopen interprets "b" differently. Don't put out "t" if gzip is set. If gzip mode is specified, do put out the level. If gzip is set, and gziplevel is nonzero then encode the level: gzopen will understand it. (open_file): If gzip mode is requested, then open the file using gzopen mode, a new function in gzio.c. The return a gzio stream based on the returned gzip file handle. However, if we are reading, and the gzip stream indicates that it's not decompressing anything, then we close it and open the file using an ordinary stream. (stream_init): Call gzio_init if HAVE_ZLIB is true. This is done here because the module is integrated with stream.c, and also so that lib.c doesn't have to know about HAVE_ZLIB and <zlib.h>.
* New options: --in-package and --compile.Kaz Kylheku2022-05-121-2/+1
| | | | | | | | | * txr.c (help): Mention new options. (do_compile_opt, do_in_package_opt): New static functions. (txr_main): Implement options. * Makefile (COMPILE_TL): Use the options instead of -e. * txr.1: Document.
* lisplib: rename to autoload.Kaz Kylheku2022-02-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | * Makefile (OBJS): rename lisplib.o to autoload.o. * lisplib.c: Renamed to autoload.c. (lisplib_init_tables): Renamed to autoload_init_tables. (lisplib_init): Renamed to autoload_init, and calls autoload_init_tables. (lisplib_try_load): Renamed to autoload_try. (autoload_try_fun, autoload_try_var, autloload_try_slot, autoload_try_struct, autoload_try_keyword): Follow rename. * lisplib.h: Renamed to autoload.h. (lisplib_init): Renamed to autoload_init. * eval.c: Include autoload.h. (eval_init): Follow rename of lisplib_init. * gencadr.txr: include "autoload.h" * cadr.c: Regenerated.
* tests: don't run tets/012/stack.tl if built with ubsan.Kaz Kylheku2022-02-141-0/+4
| | | | | | | | | * configure (have_ubsan): New variable. This is set to y in the ubsan test, if detected. (gen_config_make): Add have_ubsan variable to config.make. * Makefile (TESTS_OK): If have_ubsan is true, filter out the ../012/stack.ok target that calls for that test case.
* Copyright year bump 2022.Kaz Kylheku2022-01-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *LICENSE, LICENSE-CYG, METALICENSE, Makefile, alloca.h, args.c, args.h, arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lex.yy.c.shipped, lib.c, lib.h, linenoise/linenoise.c, linenoise/linenoise.h, lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h, parser.l, parser.y, protsym.c, psquare.h, rand.c, rand.h, regex.c, regex.h, signal.c, signal.h, socket.c, socket.h, stdlib/arith-each.tl, stdlib/asm.tl, stdlib/awk.tl, stdlib/build.tl, stdlib/cadr.tl, stdlib/compiler.tl, stdlib/constfun.tl, stdlib/conv.tl, stdlib/copy-file.tl, stdlib/debugger.tl, stdlib/defset.tl, stdlib/doloop.tl, stdlib/each-prod.tl, stdlib/error.tl, stdlib/except.tl, stdlib/ffi.tl, stdlib/getopts.tl, stdlib/getput.tl, stdlib/hash.tl, stdlib/ifa.tl, stdlib/keyparams.tl, stdlib/match.tl, stdlib/op.tl, stdlib/optimize.tl, stdlib/package.tl, stdlib/param.tl, stdlib/path-test.tl, stdlib/pic.tl, stdlib/place.tl, stdlib/pmac.tl, stdlib/quips.tl, stdlib/save-exe.tl, stdlib/socket.tl, stdlib/stream-wrap.tl, stdlib/struct.tl, stdlib/tagbody.tl, stdlib/termios.tl, stdlib/trace.tl, stdlib/txr-case.tl, stdlib/type.tl, stdlib/vm-param.tl, stdlib/with-resources.tl, stdlib/with-stream.tl, stdlib/yield.tl, stream.c, stream.h, struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h, syslog.c, syslog.h, termios.c, termios.h, time.c, time.h, tree.c, tree.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c, vm.h, vmop.h, win/cleansvg.txr, y.tab.c.shipped: Copyright year bumped to 2022.
* build: support CPPFLAGS.Kaz Kylheku2022-01-051-2/+2
| | | | | | | | | | | | | * Makefile (TXR_CFLAGS): Pull in $(CPPFLAGS) also. It seems some distros like Gentoo are relying on programs to interpolate CPPFLAGS, and use this variable for passing preprocessor-level options like -Dfoo=bar. This is an incredibly bad, unnecessary idea, but let's play along. Now because we are merging this into TXR_CFLAGS, it means that these preprocessor-only flags are used for linking, when nothing is being preprocessed, which makes no sense. However, GNU Make's built-in recipe for linking C code seems to do the same thing.
* Makefile: way to clean only C sources.Kaz Kylheku2021-12-291-1/+3
| | | | | | | * Makefile (clean-c): New target, complementary to clean-tlo, to only clean the C object files, executables and related materials, without touching the .tlo files. (clean): Depend on clean-c; body entirely moved into clean-c.
* math: quantile estimator using P-Squared algorithm.Kaz Kylheku2021-09-221-1/+1
| | | | | | | | | | | | | | | | | | | * Makefile (psquare.o): New object file. * arith.c (psq_ops): New static structure. (quant_fun): New static function. (quantile): New function. (arith_init): Register quantile intrinsic. * arith.h (quantile): Declared. * psquare.c, psquare.h: New files. * tests/016/arith.tl: New tests. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* tests: no gc torture for tests/019.Kaz Kylheku2021-09-071-0/+1
| | | | | | * Makefile (tst/tests/019/%): Clear TXR_DBG_OPTS for this recently introduced directory, so txr isn't run with --gc-debug.
* Makefile: whitespace fix.Kaz Kylheku2021-08-291-3/+3
| | | | | * Makefile (SRCS): Fix mixture of tabs and spaces, and bad alignment, reported by Paul A. Patience.
* listener: unbundle from termios.Kaz Kylheku2021-08-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes the conceptual issue that when there is no termios support (HAVE_TERMIOS is absent/false), then there is no listener at all, even though the listener supports plain mode that doesn't require termios. * Makefile (linenoise/linenoise.o): Link in unconditionally, not subject to have_termios. * linenoise.c: Include termios-related header only if HAVE_TERMIOS. (struct lino_state): Define the completion_callback and orig_termios members only if HAVE_TERMIOS. (wcnsprintf, atexit_handler, enable_raw_mode, disable_raw_mode, get_cursor_position, get_columns, lino_clear_screen, refresh_line, handle_resize, generate_beep, delete_undo, free_undo_stack, record_undo, record_triv_undo, remove_noop_undo, restore_undo, undo_subst_hist_idx, undo_renumber_hist_idx, free_completions, sync_data_to_buf, compare_completions, complete_line, lino_set_completion_cb, lino_add_completion, next_hist_match, copy_display_params, history_search, ab_init, ab_append, ab_free, sync_data_to_buf, copy_display_params, refresh_singleline, col_offset_in_str, refresh_multiline, refresh_line, move_cursor_multiline, move_cursor, scan_match_rev, scan_rev, scan_match_fwd, scan_fwd, find_nearest_paren, usec_delay, paren_jump, flash, yank, yank_by_ptr, update_sel, clear_sel, yank_sel, delete_sel, edit_insert, edit_insert_str, edit_move_left, edit_move_right, edit_move_home, edit_move_sol, edit_move_end, edit_move_eol, edit_move_matching_paren, edit_history_next, edit_delete, edit_backspace, edit_delete_prev_all, edit_delete_to_eol, edit_delete_prev_word, edit_delete_line, tr, char, edit_in_editor, edit, sigwinch_handler): Functions defined only if HAVE_TERMIOS. (struct abuf, struct row_values): Struct types defined only if HAVE_TERMIOS. (screen_rows): Defined only if HAVE_TERMIOS. (linenoise): Support only noninteractive read loop unless HAVE_TERMIOS. (lino_make): If HAVE_TERMIOS is false, then set the noninteractive flag, so the linenoise function enters the plain-mode loop. (lino_cleanup, lino_hist_add): Add #ifdefs to avoid calling nonexistent functions when HAVE_TERMIOS is false. * linenoise/linenoise.h (struct lino_completions, lino_compl_cb_t): Define these types only if HAVE_TERMIOS. (lino_set_completion_cb, lino_add_completion): Declare only if HAVE_TERMIOS. * parser.c: Include linenoise/linenoise.h unconditionally. (report_security_problem, load_rcfile, repl_intr, read_eval_ret_last, get_home_path, repl_warning, is_balanced_line, hist_save): Now define regardless of HAVE_TERMIOS. (repl): Define regardless of HAVE_TERMIOS, but don't set completion or atom callback if HAVE_TERMIOS is false. * parser.h (repl): Declare unconditionally, not subject to HAVE_TERMIOS. * txr.c (if_termios): New macro. (opt_noninteractive): Initialize to 1 if HAVE_TERMIOS is false. (help): Text about entering into listener mode is always present now, even in a build withou HAVE_TERMIOS. (banner): Function is always defined. If we don't HAVE_TERMIOS, then the unused string literal that will never be printed is replaced by nil. (hint): Function removed. (txr_main): Blocks conditional on HAVE_TERMIOS that either call banner and go to the repl, or else call hint and exit, are reduced to unconditionally calling banner and going to the repl. All #if HAVE_TERMIOS blocks are similarly replaced with just the HAVE_TERMIOS case.
* license: reformat to fit 80 columns.Kaz Kylheku2021-08-161-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile, alloca.h, args.c, args.h, arith.c, arith.h, buf.c, buf.h, chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c, combi.h, debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h, parser.l, parser.y, rand.c, rand.h, regex.c, regex.h, signal.c, signal.h, socket.c, socket.h, stdlib/asm.tl, stdlib/awk.tl, stdlib/build.tl, stdlib/compiler.tl, stdlib/constfun.tl, stdlib/conv.tl, stdlib/copy-file.tl, stdlib/debugger.tl, stdlib/defset.tl, stdlib/doloop.tl, stdlib/each-prod.tl, stdlib/error.tl, stdlib/except.tl, stdlib/ffi.tl, stdlib/getopts.tl, stdlib/getput.tl, stdlib/hash.tl, stdlib/ifa.tl, stdlib/keyparams.tl, stdlib/match.tl, stdlib/op.tl, stdlib/optimize.tl, stdlib/package.tl, stdlib/param.tl, stdlib/path-test.tl, stdlib/pic.tl, stdlib/place.tl, stdlib/pmac.tl, stdlib/quips.tl, stdlib/save-exe.tl, stdlib/socket.tl, stdlib/stream-wrap.tl, stdlib/struct.tl, stdlib/tagbody.tl, stdlib/termios.tl, stdlib/trace.tl, stdlib/txr-case.tl, stdlib/type.tl, stdlib/vm-param.tl, stdlib/with-resources.tl, stdlib/with-stream.tl, stdlib/yield.tl, stream.c, stream.h, struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h, syslog.c, syslog.h, termios.c, termios.h, time.c, time.h, tree.c, tree.h, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c, vm.h, vmop.h: License reformatted. * lex.yy.c.shipped, y.tab.c.shipped, y.tab.h.shipped: Updated.
* txr: @(eof) takes argument for binding termination status.Kaz Kylheku2021-08-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We extend the matching context structures to keep track of the underlying stream from which lines are being taken via the lazy list. Then the implementation of the @(eof) directive, when it hits the eof condition, can use this stream to gain access to the termination status. * match.c (match_line_ctx, match_files_ctx): New member, stream. (ml_all): Take stream argument and initialize new member. (h_call, do_match_line): Pass stream argument to h_call. (mf_all, mf_file_data): Take stream argument and initialize new member. (mf_from_ml): Propagate stream from line context to file context. (freeform_prepare, v_next_impl, match_filter, match_fun, extract): Pass stream argument where now needed. (v_eof): Implement termination status binding via the stream stored in the context. (open_data_source): Store stream in match files context. * tests/010/eof-status.txr: New file. * tests/010/eof-status.expected: New file. * Makefile (tst/tests/010/eof-status.ok): -B option for new test. * txr.1: Documented eof directive, argument and all. * stdlib/doc-syms.tl: Updated.
* doc: reproducible PDF.Kaz Kylheku2021-07-171-0/+1
| | | | | | | * Makefile (txr-manpage.pdf): If SOURCE_DATE_EPOCH exists, then run pdf-clobber-stamps.tl. * pdf-clobber-stamps.tl: New file.
* build: recompile txr.c if build_id changes.Kaz Kylheku2021-07-141-2/+9
| | | | | | | | | | | | | | | | | | With this change, it is possible to make build_id=abcd to rebuild TXR with the given build ID. Any changes in the value of a dynamic, git-generated build_id will likewise trigger a rebuild. * Makefile (old_build_id): New variable. We read the old build ID from a file called .build_id in the build directory. If it differs from the current expanded ID, build_id_exp, we remove the object files affected by build_id. In all cases, we then write the current build ID into the .build_id file. (clean, distclean): Remove .build_id.
* tests: .txr tests can skip using exit code 13.Kaz Kylheku2021-07-121-5/+6
| | | | | * Makefile (tst/%.ok): If a .txr test terminates with status 13, that indicates that it should be skipped.
* New: build-id feature.Kaz Kylheku2021-07-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | A build-id is a string optionally embedded into TXR at build time which can be displayed with a command line option. It can help developers who are juggling multiple builds in their workspace to identify what they are running. * Makefile (txr.o, txr-win.o): If a build_id has been defined, then define the TXR_BUILD_ID macro on the command line when compiling these object files. * configure (build_id): New variable. (help) Describe build_id. (gen_config_make): Generate build_id and build_id_exp make variables. * txr.1: Documented --build-id option. * tsr.c (build_id): Conditionally defined global variable. (help): Brief help string for --build-id. (txr_main): Process --build-id option.
* build: update some targets.Paul A. Patience2021-07-051-10/+15
| | | | | | | | | | | | * Makefile (tainted): Fix typo. Reword sentence. (rebuild): Remove obsolete references to repatch target. (clean, distclean): Remove tst directory. Separate directory removals from file removals. Remove txr-manpage.html and txr-manpage.pdf in both distclean targets. In non-configured distclean, correct the removal of .tlo files to be from the stdlib directory rather than from share (and limit the pattern to *.tlo rather than *.tlo*, since .tlo2 files are no longer generated); and explicitly remove config.h and config.make, just like the configured distclean.
* install-tests: use relative path in run.sh.Kaz Kylheku2021-06-241-1/+1
| | | | | | | | * Makefile (install-tests): In the generated run.sh, let's allow flexibility in the installation location of the tests by avoiding a cd to an absolute path where the tests are assumed to be installed. Let's assume that they are installed relative to where the run.sh script is, and cd there.
* file layout: moving share/txr/stdlib to stdlib.Kaz Kylheku2021-06-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This affects run-time also. Txr installations where the executable is not in directory ending in ${bindir} will look for stdlib rather than share/txr/stdlib, relative to the determined installation directory. * txr.c (sysroot_init): If we detect relative to the short name, or fall back on the program directory, use stdlib rather than share/txr/stdlib as the stdlib_path. * INSTALL: Update some installation notes not to refer to share/txr/stdlib but stdlib. * Makefile (STDLIB_SRCS): Refer to stdlib, not share/txr/stdlib. (clean): In unconfigured mode, remove the old share/txr/stdlib entirely. Remove .tlo files from stdlib. (install): Install lib materials from stdlib. * txr.1: Updated documentation under Deployment Directory Structure. * share/txr/stdlib/{asm,awk,build,cadr}.tl: Renamed to stdlib/{asm,awk,build,cadr}.tl. * share/txr/stdlib/{compiler,conv,copy-file,debugger}.tl: Renamed to stdlib/{compiler,conv,copy-file,debugger}.tl. * share/txr/stdlib/{defset,doc-lookup,doc-syms,doloop}.tl: Renamed to stdlib/{defset,doc-lookup,doc-syms,doloop}.tl. * share/txr/stdlib/{each-prod,error,except,ffi}.tl: Renamed to stdlib/{each-prod,error,except,ffi}.tl. * share/txr/stdlib/{getopts,getput,hash,ifa}.tl: Renamed to stdlib/{getopts,getput,hash,ifa}.tl. * share/txr/stdlib/{keyparams,match,op,optimize}.tl: Renamed to stdlib/{keyparams,match,op,optimize}.tl. * share/txr/stdlib/{package,param,path-test,pic}.tl: Renamed to stdlib/{package,param,path-test,pic}.tl. * share/txr/stdlib/{place,pmac,quips,save-exe}.tl: Renamed to stdlib/{place,pmac,quips,save-exe}.tl. * share/txr/stdlib/{socket,stream-wrap,struct,tagbody}.tl: Renamed to stdlib/{socket,stream-wrap,struct,tagbody}.tl. * share/txr/stdlib/{termios,trace,txr-case,type}.tl: Renamed to stdlib/{termios,trace,txr-case,type}.tl. * share/txr/stdlib/{ver,vm-param,with-resources,with-stream}.tl: Renamed to stdlib/{ver,vm-param,with-resources,with-stream}.tl. * share/txr/stdlib/yield.tl: Renamed to stdlib/yield.tl. * share/txr/stdlib/{txr-case,ver}.txr: Renamed to stdlib/{txr-case,ver}.txr. * gencadr.txr: Update to stdlib/place.tl. * genman.txr: Update to stdlib/cadr.tl.
* build: improved mechanism for copying .shipped files.Kaz Kylheku2021-06-011-3/+9
| | | | | | | | | | | * Makefile (SHIPPED): New variable, holds names of files that get copied to a .shipped suffix and commited to the repo. (ABBREV3SH): New macro, version of ABBREV3 that doesn't assume it is expanding an entire recipe line, and thus can be embedded into shell commands. (%.shipped): Rule removed. (shipped): New rule that prints what it is copying. Non-maintainer version of rule errors out.
* build: produce output when copying .shipped files.Kaz Kylheku2021-06-011-0/+1
| | | | | | | | | * Makefile (%.shipped): Call the ABBREV macro to produce output when "make *.shipped" is invoked, otherwise unless VERBOSE=1 is used, it works silently. This is only in maintainer mode. The rule in regular mode has the ABBREV call. (But should we have that rule at all outside of maintainer mode?)
* tests: implicitly generate empty .expected files.Kaz Kylheku2021-04-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makefile (%.expected): New implicit rule. Whenever a test requires a .expected file, if it is missing, we create an empty one. This file will be treated as an intermediate by GNU Make, which means that it will be deleted when make terminates. * tests/012/compile.tl: Some of the .tl files no longer have an .expected file, so we have to test for that in the catenating logic. * tests/008/call-2.expected, * tests/008/no-stdin-hang.expected, * tests/011/macros-3.expected, * tests/011/patmatch.expected, * tests/012/aseq.expected, * tests/012/ashwin.expected, * tests/012/compile.tl, * tests/012/cont.expected, * tests/012/defset.expected, * tests/012/ifa.expected, * tests/012/oop-seq.expected, * tests/012/parse.expected, * tests/012/quasi.expected, * tests/012/quine.expected, * tests/012/seq.expected, * tests/012/struct.expected, * tests/012/stslot.expected, * tests/014/dgram-stream.expected, * tests/014/in6addr-str.expected, * tests/014/inaddr-str.expected, * tests/014/socket-basic.expected, * tests/015/awk-fconv.expected, * tests/015/split.expected, * tests/015/trim.expected, * tests/016/arith.expected, * tests/016/ud-arith.expected, * tests/017/ffi-misc.expected, * tests/018/chmod.expected: Empty file deleted.
* build: calm restless yacc.Kaz Kylheku2021-04-081-6/+1
| | | | | | | | | | * Makefile (%.tab.c %.tab.h): Remove the trick of keeping the old y.tab.h file if it has not changed. This was once a good idea, but now that we have a proper grouped targets pattern rule which knows that y.tab.h depends on and is produced from parser.y, the trick causes y.tab.h to be perpetually out of date due to its old time stamp, and so yacc is run on every build.
* M1: Fix sed issue.Kaz Kylheku2021-03-241-1/+5
| | | | | | | | | | | | | | | | | The MacOS sed doesn't accept semicolon termination for commands involving defining labels or branching to labels. This is not a new issue, but it is revealed on newer MacOS because the sed now complains about unused labels. In the sed command ':x; /whatever/ { ...; tx }', everything after the initial : is interpreted as a label. * Makefile (DEPGEN): Split the sed command's syntax up into logical lines using multiple -e commands, applying some formatting with indentation to try to keep it readable. It looks like multiple -e options just glue together to make a program, as if they were lines of code; one -e can define a label referenced by another, and even the closing brace can be treated as a separate command.
* build: use yacc pattern rule with "y" as stem.Kaz Kylheku2021-03-221-9/+1
| | | | | | | | | | | | | | | | Thanks to a recent discussion in the GNU Make mailing list about some issue related to grouped patterns, I hit upon the realization that the rule y.tab.h y.tab.c: parser.y has a common stem, y, which can be exploited to write a pattern rule. This is only active in maintainer mode; in user mode, the y.tab.h and y.tab.c are separately produced from .shipped files. * Makefile (y.tab.h): Eliminate rule which detects a removed y.tab.h. (y.tab.c): Delete rule, replacing with new rule. (%.tab.c %.tab.h): New pattern rule, which groups the targets together.
* tests: fix retest logic for parallel operation.Kaz Kylheku2021-03-161-7/+5
| | | | | | | | | I'm giving up and just using a recursive make invocation for the "retest" target. * Makefile (retest): Depend on nothing. Remove the tst directory and invoke make tests recursively. (tests.clean): Target removed.
* build: cautiously allow parallel builds.Kaz Kylheku2021-03-011-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Over two years ago, I disabled parallel building with a .NOTPARALLEL: directive in the Makefile, due to some rules that depended on order of updates of their prerequisites. Today the situation is better. It looks like there are just a few rules that have to be fixed, all in the area of executing tests. Let us not enable that by default, though, to protect downstream users from themselves. Some operating system distribution builds optimistically run make -j N on all the packages, and then have to deal with sporadic breakages when some of those packages have parallel build bugs. We can prevent TXR from ever being implicated in such a breakage by turning off parallel building even if make -j requests it. There will now be a ./configure --parallelmake option to allow parallel builds, off by default. The --maintainer configuration mode will flip that default; configuring in maintainer mode will enable parallel builds, unless explicitly disabled with --no-parallelmake. * Makefile (.NOTPARALLEL): Conditionally assert, if parallelmake is false. (tst/tests/014/dgram-stream.ok, tst/tests/014/socket-basic.ok): Enforce order between these two tests. They clash in their use of network ports so cannot run at the same time. (test.clean): test.clean must finish executing before tests; enforce order. * configure (parallelmake, parallelmake_given): New variables. (help text): Add parallelmake option to help. (gen_config_make): Generate the parallelmake make variable into config.make. New script section, defaulting parallelmake to y in maintainer mode.
* txr: pattern function calls are non-matching.Kaz Kylheku2021-02-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch causes TXR to treat calls to verticatl functions, as well as the @(call) directive to be considered non-matching directives, so that opening the data source is deferred. This allows included .txr files to call the funtions that they define, without the side effect of standard input being read. * match.c (open_data_source): Function refactored to reduce duplication. c->data is checked first, and if it is not t, nothing is done, making the function cheaper in the frequent case. The non_matching_dir condition changes. We now check that the first element of the first spec is a non-nil symbol. If it has a function binding as a vertical function, then that is considered non_matching. (dir_tables_init): Treat @(call) as a non-matching directive. * Makefile (tst/tests/008/no-stdin-hang.ok): Add -n argument for non-interactive, which will cause stdin to be read in that test case if there is a regression in this change. If make tests is run in a terminal, this will hang make tests. * tests/no-stdin-hang.txr: New file. * tests/no-stdin-hang.expected: New file.
* @(rebind): bugfix: don't clobber right side variable.Kaz Kylheku2021-01-301-0/+1
| | | | | | | | | | | | | | | | | | | | | * Makefile (tst/tests/000/binding.ok): Pass -B to txr for this new test. * match.c (v_rebind): Fix gaping copy-and-paste bug here, which causes rebind to take on the behavior of local/forget; it takes all symbols that appear as its arguments from the environment and produces an environment in which they don't exist. What we want is to remove the left variables from the environment, and since that is a nested pattern, the right way to do that is to flatten it. Bug reported by Frank Schwidom. * tests/000/binding.txr: New file. * tests/000/binding.expected: New file. * txr.1: Improve documentation of @(rebind), also making improvements in @(set) documentation.
* build: add rule for updating .shipped material.Kaz Kylheku2021-01-241-0/+3
| | | | * Makefile (%.shipped): New pattern rule.
* build: support linker flags/libs separation.Kaz Kylheku2021-01-141-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Our build system lumps all linker options together. The correct way is that linker flags are separated info flags and libs. Also, we respond to the LDFLAGS variable but ignore LDLIBS which is incorrect. Other issues are fixed. All that is fixed here. * Makefile (TXR_CFLAGS): Interpolate $(CFLAGS) last, so that options coming from CFLAGS can override previous options. (TXR_LDFLAGS): Interpolate $(LDFLAGS) last; same reason. (TXR_LDLIBS): New variable. (LINK_PROG): Put $(TXR_LDFLAGS) with the options, before the -o, and put $(TXR_LDLIBS) at the end. * configure (conf_ldlibs, platform_ldlibs): New variables. (usage text): Document platform-ldlibs and adjust documentation of platform-ldflags. (gen_config_make): Generate PLATFORM_LDLIBS and CONF_LDLIBS now needed by Makefile. (mainline): Adjusts various recipes to use conf_ldlibs instead of conf_ldflags, or in some cases both. In the case of libffi where we use pkg-config, we use the special pgk-config options to separately extract the flags and libs. We use EXTRA_LDLIBS instead of EXTRA_LDFLAGS in some conftest invocations, as necessary.
* Copyright year bump 2021.Kaz Kylheku2021-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * METALICENSE: 2020 copyrights bumped to 2021. Added note about SHA-256 routines from Colin Percival. * LICENSE, LICENSE-CYG, Makefile, alloca.h, args.c, args.h, arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lex.yy.c.shipped, lib.c, lib.h, linenoise/linenoise.c, linenoise/linenoise.h, lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h, parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c, regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl, share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl, share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl, share/txr/stdlib/copy-file.tl, share/txr/stdlib/debugger.tl, share/txr/stdlib/defset.tl, share/txr/stdlib/doloop.tl, share/txr/stdlib/each-prod.tl, share/txr/stdlib/error.tl, share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl, share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl, share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl, share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl, share/txr/stdlib/package.tl, share/txr/stdlib/param.tl, share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl, share/txr/stdlib/pmac.tl, share/txr/stdlib/quips.tl, share/txr/stdlib/save-exe.tl, share/txr/stdlib/socket.tl, share/txr/stdlib/stream-wrap.tl, share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl, share/txr/stdlib/termios.tl, share/txr/stdlib/trace.tl, share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl, share/txr/stdlib/vm-param.tl, share/txr/stdlib/with-resources.tl, share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl, signal.c, signal.h, socket.c, socket.h, stream.c, stream.h, struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h, syslog.c, syslog.h, termios.c, termios.h, time.c, time.h, tree.c, tree.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c, vm.h, vmop.h, win/cleansvg.txr, y.tab.c.shipped: Copyright year bumped to 2021.