summaryrefslogtreecommitdiffstats
path: root/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* New tests for chmod.Kaz Kyheku2020-02-071-0/+2
| | | | | | | | | | | | | | | | The chmod fixes in the previous several commits were caught by this. * Makefile (tst/tests/018/chmod.ok): Set up TXR_ARGS for this test to give it the location of the temporary file to use as the object for testing permissions. (tst/tests/018): Disable TXR_DBG_OPTS for new directory. * tests/018/chmod.tl: New file. * tests/018/chmod.expected: Likewise. * tests/perm.tl: Likewise.
* build: drop config.log in favor of reconfigureKaz Kyheku2020-01-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | The configure command line is now turned into an executable script called reconfigure which can be invoked to repeat the config. * Makefile (distclean): Whether in a configured or state or not, try to remove reconfigure. In the configured state, don't remove config.log. (If distclean is invoked when not configured, the config.* pattern will remove config.log). * configure: rewrite the logic which turns the command line into text. It is now robust against spaces, quotes and meta-charaters. Moreover, the printed representation is chosen according to good heuristics to minimize unnecessary quoting and escaping. The config line is written into an executable script called reconfigure. This is now done twice; it is done immediately, so that we save the command line even if the configure subsequently fails. A comment is added to reconfigure indicating that configure didn't succeed. Then after a successful run through the tests, we save it again, without the cautionary comment. Help texts updated.
* build: deal with the mess of new Bison warnings.Kaz Kylheku2020-01-101-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | Newer versions of Bison produce spurious warnings in Yacc mode about %pure-parser being not POSIX conforming and also deprecated. Plus some strange fluff about "fix-its" that can be applied if option --update is specified. Let's detect at configure time whether the Yacc program being used is actually Bison 3.0 or greater, and if so, give it some flags to shut up these warnings. * Makefile (YACC_FLAGS): New variable, conditionally set based on yacc_is_newer_bison, also new variable, that being generated into config.make. (y.tab.c): Invoke $(TXR_YACC) with $(YACC_FLAGS). (conftest.yacc-version): New phony target for running Yacc with --version, out of the configure script. * configure (yacc_is_newer_bison): New variable. (gen_config_make): Generate yacc_is_newer_bison make variable. New test for whether Yacc is Bison. If so, and the version is >= 3.0, sets the yacc_is_newer_bison variable to y.
* Copyright year bump 2020.Kaz Kylheku2019-12-311-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, 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/debugger.tl, share/txr/stdlib/defset.tl, share/txr/stdlib/doloop.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/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, 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: Extended copyright notices to 2020.
* New data type: tnode.Kaz Kylheku2019-09-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Binary search tree nodes are being added as a basic heap data type. The C type tag is TNOD, and the Lisp type is tnode. Binary search tree nodes have three elements: a key, a left child and a right child. The printed notation is #N(key left right). Quasiquoting is supported: ^#N(,foo ,bar) but not splicing. Because tnodes have three elements, they they fit into TXR's four-word heap cell, not requiring any additional memory allocation. These nodes are going to be the basis for a binary search tree container, which will use the scapegoat tree algorithm for maintaining balance. * tree.c, tree.h: New files. * Makefile (OBJS): Adding tree.o. * eval.c (expand_qquote_rec): Recurse through tnode cells, so unquotes work inside #N syntax. * gc.c (finalize): Add TNOD to no-op case in switch; tnodes don't require finalization. (mark_obj): Traverse tnode cell. * hash.c (equal_hash): Add TNOD case. * lib.c (tnode_s): New symbol variable. (seq_kind_tab): New entry for TNOD, mapping to SEQ_NOTSEQ. (code2type, equal): Handle TNOD. (obj_init): Initialize tnode_s variable. (obj_print_impl, populate_obj_hash): Handle TNOD. (init): Call tree_init function in tree.c. * lib.h (enum type, type_t): New enumeration TNOD. (struct tnod): New struct type. (union obj, obj_t): New union member tn of type struct tnod. (tnode_s): Declard. * parserc.c (circ_backpatch): Handle TNOD, so circular notation works through tnode cells. * parser.l (grammar): Recognize #N prefix, mapping to HASH_N token. * parser.y (HASH_N): New grammar terminal symbol. (tnode): New nonterminal symbol. (i_expr, n_expr): Add tnode cases to productions. (yybadtoken): Map HASH_N to "#N" string.
* build: clean target should remove run.shKaz Kylheku2019-09-091-2/+2
| | | | | * Makefile (clean): If it exists, remove the temporary run.sh that is generated by the install-tests target.
* build: bugfix: compiler opts duplicated; remove_flags broken.Kaz Kylheku2019-08-251-1/+1
| | | | | | * Makefile (TXR_CFLAGS): Use := operator rather than += when filtering out REMOVE_FLAGS, or else REMOVE_FLAGS are not really removed, and we duplicate all the flags.
* New: MD5 digest functions.Kaz Kylheku2019-08-231-1/+1
| | | | | | | | | | | | | | | | | * Makefile (OBJS): New object file, chksums/md5.o. * chksum.c (sha256_ensure_buf): Renamed to chksum_ensure_buf and made generic so MD5 code can borrow it. (sha256_stream, sha256): Call chksum_ensure_buf instead of sha256_ensure_buf, passing in new length and hash name parameters. (md5_stream_impl, md5_buf, md5_str): New static functions. (md5_stream, md5): New functions. (chksum_init): Register md5-stream and md5 intrinsics. * chksum.h (md5_stream, md5): Declared. * chksums/md5.c, chksums/md5.h: New files.
* tests: add test related to recent @(collect) change.Kaz Kylheku2019-08-121-0/+2
| | | | | | | | | | | This test will misbehave on TXR without the previous fix; it will not collect columns of data which keep the corresponding rows items together. * tests/002/variant, tests/002/variant.expected, tests/002/variant.txr: New files. * Makefile (TXR_ARGS, TXR_OPTS): Override for new test.
* tests: add @{var1 var2} match test.Kaz Kylheku2019-07-031-0/+1
| | | | | | | | | | | | | | * tests/001/query-5.txr: New file. * tests/001/query-5.expected: New file. * Makefile (tst/tests/001/query-5.ok): Pass -B to txr for this new test. * tests/017/glob-carray.expected: Updated, because the glob test globs over the contents of tests/001 directory. * tests/017/glob-zarray.expected: Likewise.
* New: CRC-32 functions.Kaz Kylheku2019-06-241-1/+1
| | | | | | | | | | | | * Makefile (OBJS): Add chksums/crc32.o. * chksum.c (crc32_stream, crc32): New functions. (chksum_init): Register crc32-stream and crc32 intrinsic functions. * chksums/crc32.c, chksums/crc32.h: New files. * txr.1: Documented.
* * Makefile (OBJS): New objects chksum.o and chksums/sha256.o.Kaz Kylheku2019-06-231-1/+1
| | | | | | | | | | * chksum.c, chksum.h, chksums/sha256.c, chksums/sha256.h: New files. * lib.c (init): Call chksum_init. * txr.1: Documented. * LICENSE: Add SHA-256 copyright notice.
* Makefile: non-configured distclean removes tlo's.Kaz Kylheku2019-06-121-1/+1
| | | | | | * Makefile (distclean): distclean target for not-configured state removes .tlo files by wildcard, including the old .tlo2 files that we used to generate once.
* build: allow $(pwd)/configure to work.Kaz Kylheku2019-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | When the build is being done in the source directory, allow the configure script to be executed via path names other than just ./configure, such as an absolute path. Some distros use this. * configure (build_in_srcdir): New variable. (inode): New function. Rather than checking whether "$source_dir" is ".", we test whether they are the same inode. If they are the same, we now also set the build_in_srcdir variable in addition to generating the usual warning. (gen_config_make): Propagate the build_in_srcdir into config.make. * Makefile: use the build_in_srcdir variable from config.make to determine whether we are building in the source directory, rather than relying on top_srcdir being blank.
* build: remove nonexistent config option.Kaz Kylheku2019-02-261-2/+2
| | | | | | * Makefile (dbg/%-win.o, opt/%-win.o): Don't pass CONFIG_WIN_MAIN=1 preprocessor symbol; it's not referenced anywhere, and never has been.
* build: get rid of .tlo2 files.Kaz Kylheku2019-02-081-12/+3
| | | | | | | | | | | | | | | After the defvar bugfix in the previous commit, the only differences between .tlo and .tlo2 files are the names of a few gensyms here and there. In other words, they are identical code; therefore, there is no point in compiling them. * Makefile (STDLIB_TLOS2): Variable removed. (%.tlo2): Implicit rule removed. (stage1 stage2): Phony targets removed. (all): Directly depends on $(STDLIB_TLOS) without stage1 intermediary. (clean-tlo): Don't remove $(STDLIB_TLOS2).
* install: broken when using separate build dir.Kaz Kylheku2019-01-251-2/+1
| | | | | | | | * Makefile (install): Drop the $(top_srcdir) prefix from share/txr/stdlib materials. This fails for the .tlo files which are only found in the build directory, not the source directory. The .txr and .tl files are found in both, thanks to symlinks; for those it works either way.
* mpi: remove unused mplogic module.Kaz Kylheku2019-01-181-1/+1
| | | | * Makefile (MPI_OBJ_BASE): remove mplogic.o.
* Copyright year bump 2019.Kaz Kylheku2019-01-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h, arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h, filter.c, filter.h, 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, 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/doloop.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/path-test.tl, share/txr/stdlib/place.tl, share/txr/stdlib/pmac.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, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c, vm.h, vmop.h, win/cleansvg.txr: Extended Copyright line to 2018.
* bugfix: LDFLAGS not pulled in.Kaz Kylheku2018-12-121-1/+1
| | | | | * Makefile (TXR_LDFLAGS): Fix use of wrong assignment operator which clobbers the previous assignment of $(LDFLAGS).
* More reasonable fallback for self path.Kaz Kylheku2018-05-041-2/+4
| | | | | | | | | | | | | | | | * Makefile (opt/txr.o, dbg/txr.o): Set up TXR_REL_PATH preprocessor symbol on command line which specifies the hard installation path derived from the configure prefix. * txr.c (get_self_path): The fallback implementation simply returns TXR_REL_PATH. This will work if in fact the executable is installed at that path. What it means is that the build of TXR which uses this fallback get_self_path will not support relocation: the installation cannot be moved to another directory, yet still find its supporting files. This is better than what we are replacing: not working even in the original installation directory, if not invoked by an absolute path.
* Makefile: use order-only between early and late tlo-s.Kaz Kylheku2018-04-291-1/+1
| | | | | | | | | * Makefile: make STDLIB_EARLY_TLOS order-only prerequisites of STDLIB_LATE_TLOS, rather than conventional prerequisites. This means that the early tlo-s are built or rebuilt before the late ones, but there is no other dependency expressed: an update of early tlo-s doesn't force late tlo-s to be out-of-date and updated also.
* build: fix failure due to .tlo compilation order.Kaz Kylheku2018-04-261-0/+6
| | | | | | | | | | | | | On newer GNU Make versions, $(wildcard ...) doesn't sort its results, and so we compile .tlo files in an arbitrary order. For the most part, this is fine. However, there is a complicated circular dependency involving the error.tl file requiring it to be compiled first. * Makefile (STLIB_EARLY_PATS, STDLIB_EARLY_TLOS, STDLIB_LATE_TLOS): New variables. Use these to express a dependency which causes error.tlo to be built first.
* build: remove dubious license header from y.tab.c.Kaz Kylheku2018-04-161-0/+10
| | | | | | | | | | | | | | | | | | | | | | | The GNU Bison parser has a GPL header in the parser skeleton which gets copied to the generated parser. The GPL asserts that the entire file falls under the GPL (but as a special exception, it may be used in any manner whatsoever in a program, as long as it isn't used as the skeleton of a parser generator). The GPL assertion is false; the file is not entirely derived from the skeleton but contains code directly copied from parser.y, as well as tables generated from parser.y's original grammar. Since we are definitely not using this as a parser skeleton for a parser generator and are thus allowed to do whatever we want such as compiling this into proprietary object files, I'm removing the copyright header as a build step. You never know; someone could package up a built directory of TXR containing a Bison-generated y.tab.c, and then it looks like there is a GPL-ed file in the project. * Makefile (CM): New variable, needed for interpolating literal commas into macro calls. (BS_LIC_FROM, BS_LIC_TO): New variables. (y.tab.c): Filter y.tab.c to remove GPL comment.
* Makefile: bugfix: shell quoting issue in macro.Kaz Kylheku2018-04-161-1/+1
| | | | | | | | | | * Makefile (SH): The $(1) macro argument is substituted into a shell '...' quote. It may contain single quotes itself, so these have to be mapped to the famous '\'' sequence. Currently, only one SH call has '...' syntax in it: one in the y.tab.c rule which calls sed -e '/yyparse/d'. That works anyway, and the quotes could be removed from it; but let's fix the SH macro.
* build: compiling Lisp requires ./txr to exist.Kaz Kylheku2018-04-121-2/+2
| | | | | | | | * Makfile (%.tlo, %.tlo2): We take advantage of Gmake's order-only prerequisites to express this dependency. This means that .tlo and .tlo2 files are not considered outdated when $(PROG) is newer; it only ensures that $(PROG) cannot be missing when a .tlo or .tlo2 must be updated.
* build: prevent make parallelization.Kaz Kylheku2018-04-121-0/+2
| | | | | | * Makefile: add .NOTPARALLEL: special target. This Makfile doesn't support parallel builds; it relies on left-to-right execution of prerequisites in some places.
* build: don't rebuild tlo's all the time.Kaz Kylheku2018-04-071-2/+2
| | | | | | | | * Makefile (%.tlo, %.tlo2): Drop dependency on $(TXR). Of course, the dependency is strictly correct, but most changes to TXR are irrelevant. Moreover, not all relevant dependencies are in place anyway; if we change compile.tl, only the compile.tlo is recompiled.
* stdlib: all code read under sys package.Kaz Kylheku2018-04-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Another part of the preparation for an upcoming change. All library code is now read in the sys package, so any symbols that are interned (local variables and whatnot) are in sys and will not be exposed to user code. We have to overcome some annoyances to achieve this: - We have to stay away from the symbols exp or var, because they are now sys:exp and sys:var with their special meaning. - Instances in which a symbol of the same name exists in both sys and usr present a problem; the plain symbol now is the usr one. For instance rplaca will refer to sys:rplaca, so a small amount of code has to explicitly use usr:rplaca. * Makefile (COMPILE_TL): Change to the sys package before compiling library code. * lisplib.c (lisplib_try_load): Bind *package* to the system package. * share/txr/stdlib/asm.tl, share/txr/stdlib/compiler.tl: Remove in-package macro invocation; we don't need this since all files are loaded or compiled in the sys package. * share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl, share/txr/stdlib/conv.tl, share/txr/stdlib/doloop.tl, share/txr/stdlib/error.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/path-test.tl, share/txr/stdlib/place.tl, share/txr/stdlib/pmac.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/ver.tl, share/txr/stdlib/with-resources.tl, share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl: Deal with the various usr versus sys symbol issues.
* build: support compiling stdlib.Kaz Kylheku2018-04-051-5/+30
| | | | | | | | | | | | * Makefile (STDLIB_SRCS, STDLIB_TLOS, STDLIB_TLOS2): New variables. (COMPILE_TL): New recipe macro. (%.tlo, %.tlo2): New pattern rules. (all): Depend on new stage1 and stage2 targets. (stage1, stage2): New phony targets. (clean): Add clean-tlo dependency. (clean-tlo): New phony target. (install): Install .tlo files also.
* New: virtual machine with assembler.Kaz Kylheku2018-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is the start of compiler work to make TXR Lisp execute faster. In six days of part time work, we now have a register-style virtual machine with 32 instructions, handling exceptions, unwind-protect, lexical closures, and global environment access/mutation. We have a complete assembler and disassembler for this machine. The assembler supports labels with forward referencing with backpatching, and features pseudo-ops: for instance the (mov ...) pseudo-instruction chooses one of three kinds of specific move instruction based on the operands. * Makelfile (OBJS): Add vm.o. * eval.c (lookup_sym_lisp1): Static function becomes external; the virtual machine needs to use this to support that style of lookup. * genvmop.txr: New file. This is the generator for the "vmop.h" header. * lib.c (func_vm): New function. (generic_funcall): Handle the FVM function type via new vm_execute_closure function. In the variadic case, we want to avoid the argument copying which we do for the sake of C functions that get their fixed arguments directly, and then just the trailing arguments. Thus the code is restructured a bit in order to switch twice on the function type. (init): Call vm_init. * lib.h (functype_t): New enum member FVM. (struct func): New member in the .f union: vm_desc. (func_vm): Declared. * lisplib.c (set_dlt_entries_impl): New static function, formed from set_dlt_entries. (set_dlt_entries): Reduced to wrapper for set_dlt_entries_impl, passing in the user package. (set_dlt_entries_sys): New static function: like set_dlt_entries but targetting the sys package. (asm_instantiate, asm_set_entries): New static functions. (lisplib_init): Auto-load the sys:assembler class. * share/txr/stdlib/asm.tl: New file. * vm.c, vm.h, vmop.h: New files.
* Copyright year bump 2018.Kaz Kylheku2018-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h, arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.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, lib.c, lib.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/awk.tl, share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl, share/txr/stdlib/conv.tl, share/txr/stdlib/doloop.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/path-test.tl, share/txr/stdlib/place.tl, share/txr/stdlib/pmac.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/txr-case.tl, share/txr/stdlib/type.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, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, win/cleansvg.txr: Extended Copyright line to 2018.
* New feature: structure delegate streams.Kaz Kylheku2017-12-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new kind of stream object which redirects its operations to the methods of a structure. * Makefile (OBJS): New object file, strudel.o. * lib.c (init): Call new strudel_init function. * lisplib.c (stream_wrap_set_entries, stream_wrap_instantiate): New static functions. (lisplib_init): Arrange for autloading of new stream-wrap.tl. * share/txr/stdlib/stream-wrap.tl: New file. * stream.c (put_string_s, put_char_s, put_byte_s, get_line_s, get_char_s, get_byte_s, unget_char_s, unget_byte_s, put_buf_s, fill_buf_s, flush_s, seek_s, truncate_s, get_prop_s, set_prop_s, get_error_s, get_error_str_s, clear_error_s, get_fd_s): New symbol variables. (stream_init): New symbol variables initialized. Numerous functions registered via these variables now rather than intern(...) expressions. * stream.h (put_string_s, put_char_s, put_byte_s, get_line_s, get_char_s, get_byte_s, unget_char_s, unget_byte_s, put_buf_s, fill_buf_s, flush_s, seek_s, truncate_s, get_prop_s, set_prop_s, get_error_s, get_error_str_s, clear_error_s, get_fd_s): Declared. * strudel.c, strudel.h: New files.
* Makefile: further improvement of tests.Kaz Kylheku2017-10-251-32/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is that if a test is interrupted, it will not be re-run because the .ok stamp file depends only on an .out file, and that has been successfully created. We completely remove .out files from the rule tree. Quite simply, the output of a test is the .ok stamp. If that is out of date or doesn't exist, the test is run. Generation of the .out is just a side effect. * Makefile (TESTS_OK): Calculate this variable directly from the wildcard over .txr and .tl files..directly rather than from TESTS_OUT. (TESTS_OUT): Variable removed. (TXR_OPTS, TXR_ARGS): The target-specific assignments of these variables for specific tests is now done against .ok stamp file targets rather than .out targets. (TST_EXPECTED, TST_OUT): New helper variables for condensing repeated instances of some syntax. (tst/%.out): Both of these rules are turned into rules which target tst/%.ok. The .out files are just a side effect; the goal is to update the stamp. If an .out file is removed, the test won't be re-run; only if an .ok file is removed, or any of the real prerequisites change. (%.ok): This rule disappears, and its body containing the conditional stamp file touch is moved into both tst/%.ok rules.
* Makefile: fix silliness in "tests" target.Kaz Kylheku2017-10-251-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Last I addressed this, I didn't get it quite right. The problem is that the .out files are being removed when a test fails, which is annoying. The whole redirection of test results to a temp file which is then renamed is silly. Now, the .out files are preserved. Whether or not a test passed depends on whether or not the .ok stamp file is created or updated, so it doesn't matter whether an .out file exists or not. Also, tests are made dependent on the executable, and on the .expected files. If the executable is newer than the test outputs, all the tests will re-run. Also, if any .expected file is touched, the corresponding test will be re-run. * Makefile (clean): Do not remove $(TESTS_TMP). (TESTS_TMP): Variable removed. (tst/%.out): In both rules that run the test and make .out files simply redirect the output directly to the .out file represented as the $@ target. This is how it was before, once upon a time. (%.ok): Do not remove the .out file represdented by $< if the test fails; it is sufficient not to create/touch the .ok stamp file.
* Makefile: improve command abbreviation.Kaz Kylheku2017-10-251-4/+8
| | | | | | | | | | | | For all build steps other than linking, print only the leftmost prerequisite of the target. * Makefile (ABBREV): The macro references $< rather than $^, and hence longer needs the $(DEP_$@) filtering. (ABBREVN): New macro, identical to previous ABBREV, modulo a whitespace fix: removal of a stray tab character. (LINK_PROG): For linking, use ABBREVN so that all the object files are shown.
* Makefile: clean temporary file used in testing.Kaz Kylheku2017-09-281-0/+1
| | | | * Makefile (clean): Remove $(TESTS_TMP) if it exists.
* Makefile: print failing command in condensed mode.Kaz Kylheku2017-09-281-63/+82
| | | | | | | | | | | | | | | | | | When make output is condensed, showing a summary of each build step in the style "CC txr.c -> opt/txr.o", as is the case by default, the failing build command is now shown. Previously, a failed build had to be re-invoked with make VERBOSE=y to show the failing command. * Makefile (SH): New macro. (COMPILE_C, COMPILE_C_WITH_DEPS, LINK_PROG, WINDRES, INSTALL): These macros now invoke commands via SH rather than directly. (lex.yy.c, y.tab.h, y.tab.c, install-tests, %): Recipes for these targets use SH macro for executing shell commands rather than specifying them directly. (tst/%.out, %.ok, %.expected): These test-related pattern rules also use SH.
* configure: deal with non-standard libffi installations.Kaz Kylheku2017-07-041-0/+4
| | | | | | | | | | | | | | | | | This addresses a failure to build with libffi on Arch Linux, reported by Joe Eib. * Makefile (opt/ffi.o, dbg/ffi.o): Pull LIBFFI_CFLAGS into TXR_CFLAGS for just these object files. * configure (have_pkgconfig, libffi_cflags): New variables. (gen_config_make): Create new Makefile variable, LIBFFI_CFLAGS, from libffi_cflags. New configure test to detect pkg-config. Libffi test falls back on using pkg-config to test for existence of the library and to get the cflags and ldflags. Any needed cflags end up in LIBFFI_CFLAGS and are used only when compiling ffi.c.
* ffi: retain some functionality if libffi missing.Kaz Kylheku2017-06-101-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The FFI module is more than just foreign calls and callbacks; it provides a type system and operations for working with binary data. None of it depends on libffi being present and so shouldn't be disabled if libffi is not available. * Makefile (ffi.o): Unconditionally link this object file, not subject to the have_libffi variable. * configure (have_libffi): Variable removed. (gen_config_make): Do not generate a have_libffi variable into config.make, since nothing needs it. * ffi.c (ffi_type): Fake ffi_type defined if libffi is missing. (FFI_TYPE_STRUCT): Fake macro. (ffi_type ffi_type_void, ffi_type_pointer, ffi_type_sint, ffi_type ffi_type_schar, ffi_type_uchar, ffi_type ffi_type_sshort, ffi_type_ushort, ffi_type ffi_type_sint, ffi_type_uint, ffi_type ffi_type_slong, ffi_type_ulong, ffi_type ffi_type_sint8, ffi_type_uint8, ffi_type ffi_type_sint16, ffi_type_uint16, ffi_type ffi_type_sint32, ffi_type_uint32, ffi_type ffi_type_sint64, ffi_type_uint64, ffi_type ffi_type_float, ffi_type_double): Fake libffi type objects, so that code which references these things will build without modification. (ffi_get_type): Function only defined if we have libffi. (ffi_type_struct_destroy_op, ffi_struct_clone, make_ffi_type_struct, ffi_array_clone, make_ffi_type_array): Don't work with ffi_type's element array if we don't have libffi; our fake ffi_type doesn't have such an array. (struct txr_ffi_closure): Type only defined if we have libffi. (ffi_closure_struct, ffi_closure_struct_checked, ffi_closure_print_op, ffi_closure_destroy_op, ffi_closure_mark_op, ffi_closure_put): Functions only defined if we have libffi. (ffi_closure_ops): Static structure only defined if we have libffi. (ffi_init_types): Don't register a closure type if we don't have libffi. (struct txr_ffi_call_desc): Don't define type if we don't have libffi. (ffi_call_desc, ffi_call_desc_checked, ffi_call_desc_print_op, ffi_call_desc_destroy_op, ffi_call_desc_mark_op, ffi_make_call_desc, ffi_call_wrap, ffi_closure_dispatch, ffi_closure_dispatch_safe, ffi_make_closure, ffi_closure_get_fptr): Functions only defined if we have libffi. (ffi_call_desc_ops): Static structure only defined if we have libffi. (ffi_init): Only register ffi-make-call-desc, ffi-call, and ffi-make-closure if we have libffi. * lib.c: Include "ffi.h" header unconditionally. (generic_funcall, ref, refset, int): Remove #if HAVE_LIBFFI.
* make tests: remove failed .out.Kaz Kylheku2017-05-271-1/+4
| | | | | | | | * Makefile (%.ok): If the .out file differs from .expected, don't just fail this rule. Remove the .out file also, so that when "make tests" is repeated, the test is re-run to regenerate it. Otherwise "make tests" will only run diff again on the previously generated .out file.
* tests: first FFI regression test case.Kaz Kylheku2017-05-131-0/+1
| | | | | | | | | | | * tests/017/qsort.expected: New file. * tests/017/qsort.tl: New file. * tests/common.tl (libc): New function. * Makefile (tst/tests/017/%): Clear TXR_DBG_OPTS so the GC stress test isn't applied to tests in this directory.
* Start of FFI implementation based on libffi.Kaz Kylheku2017-04-241-0/+1
| | | | | | | | | | | | * Makefile (OBJS): Add ffi.o. * configure (have_libffi): New variable. (gen_config_make): Generate have_libffi make variable. New check for availability of libffi. * ffi.c, ffi.h: New files. * lib.c (init): Call ffi_init.
* Continuing implementation of buffers.Kaz Kylheku2017-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile (OBJS): New objects itypes.o and buf.o. * buf.c, buf.h: New files. * itypes.c, itypes.h: New files. * lib.c (obj_print_impl): Handle BUF via buf_print and buf_pprint. (init): Call itypes_init and buf_init. * parser.h (end_of_buflit): Declared. * parser.l (BUFLIT): New exclusive state. (grammar): New rules for recognizing start of buffer literal and its interior. (end_of_buflit): New function. * parser.y (HASH_B_QUOTE): New token. (buflit, buflit_items, buflit_item): New nonterminals and corresponding grammar rules. (i_expr, n_expr): These symbols now generate a buflit; a buffer literal is a kind of expression. (yybadtoken): Handle HASH_B_QUOTE case.
* Makefile: detect when y.tab.h doesn't change.Kaz Kylheku2017-04-191-0/+5
| | | | | | | | | | | | | | | | When we touch the parser.y file, yacc regenerates y.tab.h. Then everything which depends on that is rebuilt. However, this is not necessary if the parser.y change doesn't actually modify the contents of y.tab.h. A build system based on file hashes wouldn't have this problem, but make works strictly with modification timestamps. * Makefile (y.tab.c): Preserve the old y.tab.h, if it exists, as y.tab.h.old. Then if the new y.tab.h is exactly the same according to cmp, restore the old y.tab.h in its place. (clean): Remove y.tab.h.old.
* Protect internal symbols from uninterning.Kaz Kylheku2017-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | Issue: TXR holds numerous symbol references in global variables, like list_s. These variables are not registered as root pointers with the garbage collector. This is normally okay because symbols are reachable via packages. However, if such a symbol is uninterned, that causes an integrity problem. Solution: protect those symbols from being removed from their packages. * Makefile (OBJS): Add protsym.o. * genprotsym.txr, protsym.c: New files. * lib.c (prot_sym_check): New static function. (use_sym, uintern, rehome_sym): Use prot_sym_check to implement a defense against internal symbols being booted out of their package.
* Get rid of config/ directory.Kaz Kylheku2017-03-311-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | We revert back to config.h, config.make and config.log just being in the root of the build directory, rather than in a config/ subdirectory, like it was until mid 2014. That change was done for the sake of the tainting problem: a build directory picking up the wrong config.h from a source directory that is itself in the a configured state. * Makefile: Include config.make rather than config/config.make. (TXR_CFLAGS): Remove config directory from include file search path. (OBJS, EXTRA_OBJS, y.tab.c, y.tab.h, lex.yy.c): Dependencies on config.h and config.make adjusted to point to new location. (distclean): Use rm -f on config.*, not rm -rf; we don't expect there to be a directory matching that pattern. Remove config.h, config.make and config.log rather than config directory. Extend the generic distclean to remove opt and dbg, because this change will trigger its use and lingering .d files in opt and dbg will break the build. Remove txr-win.exe and txr-dbg-win.exe in generic distclean. * configure (conf_dir, config_h, config_make, config_log): Variables gone, replaced by hard-coded strings everywhere. Generate config.make, config.log and config.h in the current directory rather than a subdirectory. Do not generate a conf_dir variable into config.make.
* build: defend against $(top_srcdir) interference.Kaz Kylheku2017-03-311-0/+11
| | | | | | | | | | | * Makefile (tainted): New top target added in a situation when an out-of-tree build is tainted by a configuration in the original tree. The problem is that .c files which have an #include "y.tab.h" or #include "config.h" get these headers from the same directory where they reside. This is processed ahead of any -iquote directories. If a "config.h" exists in $(top_srcdir), files include that in spite of "-iquote ." on the compiler command line.
* Fix broken out-of-tree build.Kaz Kylheku2017-03-311-1/+2
| | | | | | | | | | | Reported by Marco Wahl. When building in a separate directory, the y.tab.h file isn't found because the current directory is not searched by the compiler. It searches only the original source tree and the local config directory. * Makefile (TXR_CFLAGS): We must have . in the include file search path otherwise files can only find y.tab.h when it's in the same directory where they are.
* Icon refresh.Kaz Kylheku2017-03-151-1/+1
| | | | | | | | | | | | | | | | | I lost the original vector graphic inputs that went into the icon. This is a superior re-make. Better artwork, better post-processing quality, more sizes. * Makefile (win/%.res): Add win/*.ico as a pattern prerequisite, so that the resource file is regenerated when the icon changes. * win/txr.ico: Updated icon, now in sizes 16, 32, 48, 64, 96, 128, 192 and 256. * win/txr.xcf: Updated GIMP file. * win/txr.svg: New file.