summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* * lib.c (simple_lazy_stream_func): Bugfix: close the streamKaz Kylheku2014-12-254-10/+28
| | | | | | | | | | if get_line returns nil. * stream.c (cat_get_line, cat_get_char, cat_get_byte): The catenated stream read operations close an exhausted stream before popping to the next one. * txr.1: Document closing behavior of catenated streams.
* * stream.c (stream_init): Register make_catenated_stream inKaz Kylheku2014-12-255-297/+313
| | | | | | | | a different form as cat-streams. * txr.1: Document cat-streams. * tl.vim, txr.vim: Regenerated.
* * txr.1: Small fix under get-lines.Kaz Kylheku2014-12-251-1/+1
|
* * eval.c (ap_s, ret_s, aret_s): New symbol variables.Kaz Kylheku2014-12-235-311/+372
| | | | | | | | | | | | (me_ret): Static function renamed to me_ret_aret. Handles ret and aret macro expansion. (eval_init): Initialize ap_s, ret_s and aret_s. Re-register ret macro using ret_s and bind to me_ret_aret. Register aret macro. * txr.1: Documented aret. * tl.vim, txr.vim: Regenerated.
* * eval.c (eval_init): Registered intrinsic function unique.Kaz Kylheku2014-12-237-18/+109
| | | | | | | | | | | * lib.c (unique): New function. (uniq): Becomes wrapper around unique. * lib.h (unique): Declared. * txr.1: Documented unique, and equivalence between uniq and unique. * tl.vim, txr.vim: Regenerated.
* * lib.c (func_n1ov, func_n2ov, func_n3ov): New functions.Kaz Kylheku2014-12-233-0/+30
| | | | * lib.h (func_n1ov, func_n2ov, func_n3ov): Declared.
* * lib.c (func_n0o): Useless, unused function removed.Kaz Kylheku2014-12-233-8/+6
| | | | * lib.h (func_n0o): Declaration removed.
* Syntax highlighting issue: keywords in braced variable syntaxKaz Kylheku2014-12-184-2/+16
| | | | | | | | | | not being recognized. * genvim.txr (txr_braced_ident): New match kind, specifically for a keyword. (txr_bracevar): Bracevar region contains txr_braced_indent. * txr.vim, tl.vim: Regenerated.
* * lib.c (copy): Support copying random state objectsKaz Kylheku2014-12-183-12/+28
| | | | | | vi make_random_state. * txr.1: Updated.
* * rand.c (rand32): Bugfix: if the seed object is a randomKaz Kylheku2014-12-173-6/+27
| | | | | | | | | state, we do not want to make the 8 calls to rand32 to mix up the state; we need are making a straight copy. * txr.1: Document the possibility that the seed object is a random state. Document the platform-independence of the integer seed.
* * rand.c (struct rand_state): Change cur member to unsigned.Kaz Kylheku2014-12-172-1/+6
| | | | This generates better code for rand32.
* * rand.c (rstate): New inline function.Kaz Kylheku2014-12-162-8/+17
| | | | | (rand32): Use inline function instead of macro. I compared gcc -O2 output on Intel: no difference.
* Factor out some compiling commands into macros.Kaz Kylheku2014-12-132-16/+33
| | | | | | | * Makefile (COMPILE_C, COMPILE_C_WITH_DEPS, LINK_PROG): New macro strings. (dbg/%.o, opt/*.o, %.o, $(PROG), $(PROG)-dbg, conftest, conftest2): These targets now use these commands.
* Build bugfix: if a config.h header exists in $(top_srcdir),Kaz Kylheku2014-12-123-88/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | then that header is used when building in a separate directory, instead of the config.h generated in that directory. To fix this, we move config.h into a config/ subdirectory. The $(top_srcdir)/config is not in the include search path when buiding in a separate build directory. While we are at it, let's move all the configure materials generated by the configure script into config/. * Makefile: include config/config.make at the top. Removing the rule which asserts the existence of configuration based on the presence of config.make. (CFLAGS): Add $(conf_dir) to include search path with -iquote. (notconfigured): New conditionally-defined target for producing the error message when the build system is not configured. (NL, DEP): New variables. ($(OBJS)): Make dependent on config/config.make and config/config.h with help of DEP macro. (opt/lex.yy.o, dbg/lex.yy.o): Express dependency using DEP. (y.tab.h): Split off as a dependent on y.tab.c rather than a co-target in the rule. The rule has a body to handle the situation when y.tab.h is missing for some reason, but y.tab.c already exists (and so won't be re-made, and so y.tab.h won't be remade). * configure: Require GNU Make 3.81 rather than 3.80. (conf_dir): New variable. (config_h, config_make, config_log): New variables. These are used in place of config.h, config.make and config.log. Add conf_dir to config.make variable.
* * configure: typo in message.Kaz Kylheku2014-12-111-1/+1
|
* * configure (have_git): New variable and configure test for git.Kaz Kylheku2014-12-113-0/+29
| | | | | * Makefile (SRCS): Only set if git is available. (enforce): Fail if we don't have git.
* Throwing away old dependency system.Kaz Kylheku2014-12-104-129/+47
| | | | | | | | | | | | | | | | | | | | | | * Makefile (DEPGEN): New macro variable. (OPT_OBJS, DBG_OBJS): Define with := assignment. (OBJS): New variable. (dbg/%.o, opt/*.o): Use -MMD and -MT options of gcc to generate dependencies. Also use DEPGEN macro to rewrite each dependency makefile's rule into a DEP_ variable assignment. (DEP_INSTANTIATE): New macro variable. (include dep.mk): Removed, replaced by eval hack that includes all the .d files and instantiates the rule from the DEP_ variable in each one. (opt/lex.yy.o, dbg/lex.yy.o): We need to hard code the dependency of these on y.tab.h, to force that header to generate. (DEP_opt/lex.yy.o, DEP_dbg/lex.yy.o): New variables, related to above. (depend): Target removed. * dep.mk: File removed. * depend.txr: File removed.
* * Makefile (ABBREV): Rewrite to take advantage of DEP_Kaz Kylheku2014-12-104-52/+112
| | | | | | | | | | | | | variables to remove the dependencies from the output. (ABBREV2): No longer needed, removed. (dbg/%.o, opt/%.o, %.o): Just use ABBREV instead of ABBREV2; it does the right thing. Dependency of objects on config.make removed. * dep.mk: Regenerated. Now provides variable assignments in addition to rules, and each object is made dependent on config.make. * depend.txr: Adjusted to generate dep.mk in new format.
* * Makefile (install-tests): Do not use option -c ofKaz Kylheku2014-12-092-2/+9
| | | | | | cpio (use old ASCII format). This was unintentional. On extract, use -m option to preserve timestamps, like we do in INSTALL.
* Test output goes to tst/ now.Kaz Kylheku2014-12-093-41/+69
| | | | | | | | | | | | | | | | | | | | | | | | | * Makefile (TESTS_OUT): We don't need to refer to top_srcdir. Add the tst/ prefix to .out paths. Find must be used with -H because tests is a symlink for out-of-tree build directories. (tests/*): All target-specific assignments are moved to tst/tests/* paths, and top_srcdir is no longer used in the right hand side values. (%.out): Becomes (tst/%.out). (%.ok): need to compute .expected name from .out differently to account for tst/ prefix. (tests.clean): Just remove the tst directory. (install-tests): Remove the tst directory first so test commands are forced to run (though it is a dry run). We no longer need to switch to top_srcdir to find the .txr files, nor do we have to filter out .out files from the tests tree. We no longer have to switch to top_srcdir in the recursive make. Also, show the installation of tests using ABBREV3. * configure: When configuring in a separate directory, symlink the tests directory back to the source tree. Since there are now three things being symlinked, rewrote that as a loop. The recommendation to build in a separate directory is just a note, not a warning.
* * Makefile (($TESTS_OUT)): Do not depend on $(PROG).Kaz Kylheku2014-12-092-3/+9
| | | | | | | This adds superfluous commands to run.sh under make install-tests, and is also inappropriate if a different txr binary is being tested. (install-tests): Do not override top_srcdir in the recursive make call; instead use -C to change to $(top_srcdir).
* * Makefile (all): Mark as phony target.Kaz Kylheku2014-12-092-0/+5
|
* Condensed make output.Kaz Kylheku2014-12-092-48/+83
| | | | | | | | | | | | | | | | * Makefile (VERBOSE): New variable. (V, ABBREV, ABBREV1, ABBREV3): New macro variables. (dbg/%.o, opt/%.o): Use V, ABBREV1 for concensed output. ($(PROG), $(PROG)-dbg, lex.yy.c, y.tab.c, %.out, %.ok, INSTALL): Likewise, but use ABBREV. (tests, GREP_CHECK, config.make, conftest.yacc, conftest.clean): Use $(V) instead of @. (tests.clean): Remove @; do not hide remove commands. (INSTALL): Use $(V) instead of @ and use ABBREV3 to provide condensed output. (install): Use $(V) on $(PREINSTALL) so we don't see : in the output. (install-tests): Put $(V) on all steps.
* Debug builds optional with --debug-also config option.Kaz Kylheku2014-12-073-2/+26
| | | | | | | | | * Makefile (PROG): Variable removed, now set in config.make. (all): Target now depends on $(BUILD_TARGETS) variable, set in config.make. * configure (debug_also) New variable. (gen_config_make): Generate PROG and BUILD_TARGETS variables.
* * arith.c (tofloat, toint): Handle characters.Kaz Kylheku2014-12-053-1/+36
| | | | | | Fix error message in toint wrongly identifying itself as tofloat. * txr.1: Document handling of characters.
* * eval.c (eval_init): Register in function as intrinsic.Kaz Kylheku2014-12-057-212/+351
| | | | | | | | | | * lib.c (in): New function. * lib.h (in): Declared. * txr.1: Documented in. * txr.vim, tl.vim: Regenerated.
* * lib.c (set_diff): Bugfix: use member rather than find,Kaz Kylheku2014-12-052-1/+6
| | | | so that a nil set element is handled properly.
* * Makefile (INSTALL): Bugfix: touch -r $(2) does not workKaz Kylheku2014-12-052-2/+9
| | | | | | right when $(2) is a wildcard like path/to/*.txr. It touches files in the source tree to the timestamp of the argument after -r. Putting in a shell loop to handle this.
* * Makefile (TESTS_TMP): New variable.Kaz Kylheku2014-12-052-8/+18
| | | | | | | | | | (TESTS_OUT): Depends on $(PROG). (TESTS_OK): Does not dependon $(PROG). (tests): Does not depend on tests.clean. (retest): Target removed. (%.out : %.txr): Generate to temporary file, then move to .out. (tests.clean): Remove $(TESTS_TMP).
* * Makefile (SRCS): Compute from top_srcdir, so we don't get a warningKaz Kylheku2014-12-052-2/+10
| | | | from git, and "make enforce" works from out of three builds.
* * configure: Bugfix: the "share" directory has to beKaz Kylheku2014-12-052-0/+8
| | | | | symbolically linked. Without this, tests which require txr to have access to its library do not work.
* TXR now builds optimized and debug at the same time.Kaz Kylheku2014-12-044-38/+107
| | | | | | | | | | | | | | | | | | | | | | | | Optimized object files are under opt/ and debug object files are under dbg/. The debug txr executable is called txr-dbg. * Makefile (CFLAGS): $(OPT_FLAGS) is omitted from CFLAGS, so we can expand it where appropriate. (ADD_CONF, EACH_CONF): New variables, used as macros. (DBG_OBJS, OPT_OBJS): New variables. (dbg/%.o, opt/%.o): New rules. (all): New target. ($(PROG)-dbg): New target. (clean): Remove the object directories with rm -rf. Remove $(PROG)-dbg. (depend): Pass $(OPT_OBJS) and $(DBG_OBJS) to depend.txr Also: various target-specific assignments for object files had to be split for rel and dbg. * depend.txr: Updated to handle dbg/ or rel/ prefix on object file paths. * dep.mk: Regenerated.
* * Makefile (clean): add tests.clean as prerequisite.Kaz Kylheku2014-12-042-4/+16
| | | | | (tests): Add tests.clean as prerequiste, remove rm command. (retest, tests.clean): New rules.
* * Makefile (tests/009/json.out): Use eager assignmentKaz Kylheku2014-12-042-1/+6
| | | | intead of lazy assignment to set TXR_ARGS.
* * Makefile (TXR): New variable. We use this to run txrKaz Kylheku2014-12-042-27/+60
| | | | | | | | | | | | | | | | | | | | | | | rather than ./$(PROG). This way we can override the variable from the command line if necessary. (TESTS): Variable removed. (TESTS_OUT, TESTS_OK): New variables, replace TESTS. (tests): Prerequisites is now $(TESTS_OK), which are actual timestamp files. Also depends on $(PROG). (tests/%/%): Target specific assignments are now for .out targets rather than .ok targets. (%.out): New pattern target, made from half of previous %.ok rule. (%.ok): Smaller rule, only performs diff between .out and .expected, and touches the .ok stamp. (%.expected): Bugfix: this rule now just copies .out to .expected, and its prerequisite is %.out rather than %.txr. Previously it tried to run txr, but it wouldn't use the correct options, which depended on the target-specific assignments for various .ok files. (install-tests): Bugfix: in the "make -s -n" call use the new TXR variable to specify the program's path. This fixes the issue that ./ was prepended to the txr commands, resulting in nonworking run.sh. (txr-manpage.html): Use TXR to invoke txr rather than PROG.
* * Makefile: Adding empty .SUFFIXES: to disable built-in suffixes.Kaz Kylheku2014-12-042-0/+12
| | | | | Also set MAKEFLAGS to disable all built-in rules. The only one rule we used is .c to .o, so we provide it ourselves.
* * eval.c (eval_init): Register lequal and gequal.Kaz Kylheku2014-11-277-222/+317
| | | | | | | | | | * lib.c (lequal, gequal, lequalv, gequalv): New functions. * lib.h (lequal, gequal, lequalv, gequalv): Declared. * txr.1: Documented lequal and gequal. * txr.vim, tl.vim: Regenerated.
* * eval.c (eval_init): Register less and greater toKaz Kylheku2014-11-275-6/+70
| | | | | | | | | | the lessv and greaterv functions instead of less and greater. * lib.c (lessv, greaterv): New functions. * lib.h (lessv, greaterv): Declared. * txr.1: Document variadic nature of less and greater.
* * eval.c (eval_init): Register sort-group.Kaz Kylheku2014-11-215-1/+53
| | | | | | | | * lib.c (sort_group): New function. * lib.h (sort_group): Declared. * txr.1: Documented.
* * lib.c (partition_star_func): Bugfix: doing rplaca(env, seq)Kaz Kylheku2014-11-212-8/+14
| | | | | | too early, before the loop which adjusts its value. Restructuring this slightly to avoid duplicated code, by moving the !first check later.
* * lib.c (partition_by_func): Rename one local variable for clarity.Kaz Kylheku2014-11-212-9/+14
| | | | | Remove unessential variable last, and move the next variable into loop scope.
* * arith.c (wrap_star, wrap): New functions.Kaz Kylheku2014-11-205-0/+86
| | | | | | | | * eval.c (eval_init): Registered wrap and wrap* intrinsics. * lib.h (wrap_star, wrap): Declared. * txr.1: wrap and wrap* documented.
* * arith.c (succ, ssucc, sssucc, pred, ppred, pppred): New functions.Kaz Kylheku2014-11-205-0/+84
| | | | | | | | * eval.c (eval_init): Register new functions as intrinsics. * lib.h (succ, ssucc, sssucc, pred, ppred, pppred): Declared. * txr.1: Documented.
* * lib.c (where): Argument order reversed, with compat support.Kaz Kylheku2014-11-204-3/+21
| | | | | | * lib.h (where): Declaration updated. * txr.1: Documented.
* * lib.c (sel): Accept a function in place of the index list.Kaz Kylheku2014-11-203-2/+23
| | | | * txr.1: Documented.
* * txr.1: Random fixes.Kaz Kylheku2014-11-171-3/+3
|
* * lib.c (split_str): If the separator string is empty,Kaz Kylheku2014-11-174-2/+67
| | | | | | | | | | then unless opt_compat is 100 or less, provide a more consistent behavior, rather than splitting the string into characters. This latter behavior was never documented. * txr.1: Documented. * dep.mk: Updated.
* * lib.c (max2, min2): Use the less comparison functionKaz Kylheku2014-11-154-10/+23
| | | | | | | | | for generic semantics. * lib.h (max2, min2): Parameter names changed to avoid suggesting that the operands are numbers. * txr.1: Documentation for min and max updated.
* * eval.c (opip_s, oand_s, chain_s, chand_s): New global variables.Kaz Kylheku2014-11-105-186/+332
| | | | | | | | | | | | (macro_form_p): Forward declaration added. (me_opip): New static function. (eval_init): Intern new symbols, register opip and oand macros to me_opip function. Use chain_s and chand_s in registration for chain and chand. * txr.1: Document opip and oand * tl.vim, txr.vim: Regenerated.
* * lib.c (sub, ref, refset, replace, update, search_list):Kaz Kylheku2014-11-062-6/+13
| | | | | | Fix cut and paste problem: type_mismatch argument expression referring to the C function cons rather than the intended object seq.