summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Version 245txr-245Kaz Kylheku2020-10-104-9/+36
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. Fixed repeated word in documentation under env-hash. * share/txr/stdlib/ver.tl: Bumped from incorrect 243 value to 245.
* chmod: disable some chmod tests on Cygwin.Kaz Kylheku2020-12-241-21/+26
| | | | | | | * tests/018/chmod.tl: Certain chmod test cases no longer work on Cygwin. The issue is the chmod system call. It produces completely nonsensical results in some cases. We disable these test cases on Cygwin.
* linenoise: fix: int used instead of wchar_t.Kaz Kylheku2020-12-241-2/+2
| | | | | * linenoise.c (scan_match_rev, scan_match_fwd): The value of s[i] must be captured in a wchar_t, not int.
* android: fix socket module, failing tests.Kaz Kylheku2020-12-235-15/+18
| | | | | | | | | | | | | * socket.c: Add missing #include <netinet/in.h>. * tests/017/glob-carray.tl, tests/017/glob-zarray.tl: Use same definition for struct glob as Cygwin. Both are of BSD origin. * tests/017/realpath.tl: Do not test on Android. * tests/common.tl (os-symbol): Detect Android and return :android. (libc): Handle :android.
* configure: don't disable PIE on Android.Kaz Kylheku2020-12-231-25/+29
| | | | | | | * configure: Move how-to-disable-PIE check below plaform detections, where we know whether we have Android or not. On Android, we can't disable PIE; non-PIE executables are not supported. Let's cross our fingers things work.
* build: Android support.Kaz Kylheku2020-12-232-0/+22
| | | | | | | | | | * Makefile (conftest.android): New helper target for testing for Android toolchain, via presence of __ANDROID__ preprocessor symbol, similarly to how we detect Darwin. * configure: New test for Android. This is mutually exclusive agains Darwin. On Android, we add some necessary feature selection macros to the compiler command line.
* configure: rename darwin variable.Kaz Kylheku2020-12-231-3/+3
| | | | * configure (need_darwin_c_source): Renamed to darwin_target.
* configure: get rid of -Wold-style-declarationKaz Kylheku2020-12-231-1/+1
| | | | | | | | * configure (diag_flags): Remove the -Wold-style-declaration option. It is not useful, unlike -Wold-style-definition; it warns agains some unspecified old style usages, like storage class specifiers not being first. Moreover, clang 10 does not recognize this option and complains.
* configure: relax to C99 for regular users.Kaz Kylheku2020-12-221-2/+9
| | | | | | | | | | | The code will continue to stick to C90, but requesting C90 compatibility from GCC may break for downstream users in some environments that don't support C90 in their header files. * configure (lang_flags): Remove -ansi option from here. (usage): Help text for maintainer mode updated. (mainline): Add -std=c++98 to the front of lang_flags if compiling as C++, -std=c90 in maintainer mode, else -std=c99.
* configure: C++ fix for recently added C flags.Kaz Kylheku2020-12-221-0/+1
| | | | | | | * configure: When we detect we are using C++, we filter out certain C-only compiler options. TO that list, we must add a pattern that gets rid of the recently added -Wold-style-definitions and -Wold-style-declarations.
* configure: C++ fix for type size detection case.Kaz Kylheku2020-12-221-4/+4
| | | | | | | | | | * configure: The new logic for detecting type sizes introduced in October, replacing the old nm-based trick, doesn't work with C++. An anonymous structure is being used to define an object with linkage: we fix that by giving the structure a tag name which be. C++ also doesn't like a one-character string literal like "\n" being used to initialize a char [1] array, so we make it [2].
* shipped lexer: fix misleading indentation.Kaz Kylheku2020-12-221-5/+5
| | | | | * lex.yy.c.shippped (YY_DECL): Fix some bad indentation, most likely caused by using a mixture of tabs and spaces.
* int-flo: bugfix on 64 bitKaz Kylheku2020-12-221-2/+9
| | | | | | | | | | | | | | | * arith.c (int_flo): On 64 bit, we incorrectly handle the positive floating-point values which correspond to (expt 2 63) and (expt 2 64). This is because in the range check which detects whether a double value lands into the cnum or ucnum range, the 64 bit INT_PTR_MAX and UINT_PTR_MAX have no exact equivalent in the double type and are being converted to double values which are greater. That then causes the range check to incorrectly include double values that are actually out of range for the conversion to the cnum or ucnum type, causing bogus values. The quickest fix would be to use < comparison for a half-open range, but that sacrifices two double values on 32 bit, unnecessarily sending them to the text-based conversion code. So instead, let's subtract margins from the range constants on 64 bit.
* build: add more warnings against ancient C.Kaz Kylheku2020-12-131-1/+3
| | | | | | * configure (diag_flags): Add warning options agains defining an old style C function, and against obsolecent features in declarations.
* txr, eval: eliminate some func_n1 calls.Kaz Kylheku2020-12-102-5/+5
| | | | | | | | | * match.c (do_output_line, do_repeat, v_deffiler): Replace func_n1(cdr) and func_n1(rest) with cdr_f. * eval.c (eval_init): Replace func_n1(car) and func_n1(cdr) with car_f and cdr_f. Should have been done in 2011 when this was done for the registrations of car and cdr.
* New quip: inspired by dumb phone messages.Kaz Kylheku2020-12-101-0/+1
| | | | * share/txr/stdlib/quips.tl (sys:%quips%): New entry.
* mpi: small rearrangement in is-power-of-two function.Kaz Kylheku2020-11-221-4/+2
| | | | | | * mpi.c (s_mp_ispow2): Delay call to s_highest_bit until that value is actually needed. Perhaps the compiler does the code motion, but let's write the code that way.
* printer: no leading zeros in hex chars.Kaz Kylheku2020-11-171-9/+6
| | | | | | | | * lib.c (obj_print_impl): Drop the complicated logic for printing a character as 2, 4 or 6 hex digits. All characters that must print using the #\x notation are jus printed using the ~X format specifier with no precision or leading zeros, which will use just as many digits as are required.
* quips: three new entries.Kaz Kylheku2020-11-161-0/+3
| | | | * share/txr/stdlib/quips.tl (sys:%quips%): Add new quips.
* time: indentation fix.Kaz Kylheku2020-10-161-12/+12
| | | | * time.c (timegm_hack): Use two space indentation, not four.
* time: don't emulate setenv with putenvKaz Kylheku2020-10-161-20/+13
| | | | | | | | * time.c (setenv, unsetenv): Removed. (timegm_hack): Now defined earnestly only if HAVE_SETENV is true, otherwise a stub is defined that throws an error. (time_init): Don't register make-time-utc intrinsic if we don't have a timegm function.
* sysif: respect HAVE_SETENV.Kaz Kylheku2020-10-161-0/+6
| | | | | | | | * sysif.c (setenv_wrap, unsetenv_wrap): Now surrounded with #if HAVE_SETENV ... #endif, an existing feature detection macro. (sysif_init): Only register setenv and unsetenv functions if HAVE_SETENV is true.
* env-hash: now persistent and synced with setenv.Kaz Kylheku2020-10-162-19/+108
| | | | | | | | | | | | | | * sysif.c (env_hash): Function renamed to get_env_hash and a static variable named env_hash introduced. Function returns a previously allocated hash table, if it exists, except in compat mode. (getenv_wrap): Stash the result into the hash also. (setenv_wrap): Keep the hash up-to-date with the action of setenv. (unsetenv_wrap): Also delete from the hash. (sysif_init): Protect the env_hash variable from gc. * txr.1: Documented, with compat notes.
* doc: add missing detail to env function.Kaz Kylheku2020-10-161-0/+8
| | | | | | * txr.1: The env function actually returns a cached list. Spell out that the function is not required to construct a new list.
* env: move function to sysif.cKaz Kylheku2020-10-165-38/+39
| | | | | | | | | | | | | | | | | * lib.c (env_list): Static variable removed; now appears in sysif.c (env): Function removed; now in sysif.c. (obj_init): Don't gc-protect env_list here any more. * lib.h (env): Declaration removed. * match.c: Must include "sysif.h" now for env. * sysif.c (env_list): Static variable moved here. (env): Function moved here. (sysif_init): env_list gc-protected here. * sysif.h (env): Declared.
* struct: bad object in two diagnostics.Kaz Kylheku2020-10-161-2/+2
| | | | | | | * struct.c (umethod_fun, umethod_args_fun): The env function is being used as an object, passed to the ~a conversion specifier of the formatter. The correct argument is the sym variable.
* Version 244txr-244Kaz Kylheku2020-10-105-438/+489
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* time: Solaris fix: don't assign to env_list.Kaz Kylheku2020-10-101-1/+0
| | | | | | | | | | * time.c (env_list): The env_list variable is static in lib.c. The idea here was that since we modified the environment with setenv, we should invalidate the env hash which stores a cached copy of it. However, the setenv library function that is exposed to programs neglects to do this, which is a much larger issue. Let's delete the assignment to env_list and deal with the whole issue later.
* mapcar: regression: not not converting to left typeKaz Kylheku2020-10-101-1/+2
| | | | | | * eval.c (map_common): Save the leftmost arg in a local variable, and refer to that in the make_like call. The bug here is that the args get zapped to nil.
* configure: replace nm-based trick for sizesKaz Kylheku2020-10-092-82/+63
| | | | | | | | | | | | | | | | | | | | | | | | The trick of declaring static arrays whose size is the value of an integer is not working with newer gcc 10 on Cygwin, because that compiler is rearranging the order of the arrays and adding padding. Basically, the writing on the wall is that this is not a good approach. I'm switching to a different approach. By initializing a suitable C structure (which contains character arrays) in a particular way, we can create a .o file in which a shell script is embedded. We can pull out the shell script and evaluate it to get the sizes of types. * Makefile (conftest.syms): Rule removed. (conftest.clean): Don't remove conftest.syms. * configure (conftest_syms, read_syms): Functions removed. (LANG, LC_ALL): New environment variables. This is needed because we are using tr to process a binary file; we can't have it trying to decode multi-byte characters. (mainline): Use new trick for obtaining variables like SIZEOF_INT.
* compiler: bump up compiled file version to 5.1.Kaz Kylheku2020-10-091-1/+1
| | | | | | | | | | | | | * share/txr/stdlib/compiler.tl (%tlo-ver%): Bump minor version from 0 to 1. Because the major version doesn't change, these files will be loaded by TXR 216 through 243, because those versions only look at the major number. The upcoming 244 will continue to do that. What the minor number increase indicates is that the compiled files do not use the deprecated movi instruction group. If a future version of TXR removes the instructions from the VM, it will then insist on only loading version 5 files if the minor number is at least 1. Version 5.0 files will be rejected, as will version 4 or lower.
* doc: missing info about compiled file version 5.Kaz Kylheku2020-10-091-1/+3
| | | | | * txr.1: TXR 216 bumped the compiled file version from 4 to 5, but this was not documented.
* random: use nanoseconds for seeding.Kaz Kylheku2020-10-071-1/+1
| | | | | * rand.c (make_random_state): Use time_sec_nsec to obtain a time with nanoseconds, instead of time_sec_usec.
* New function: time-nsec.Kaz Kylheku2020-10-074-1/+54
| | | | | | | | | | | | * configure: Test for clock_gettime, generating HAVE_CLOCK_GETTIME symbol in config.h. * time.c (time_sec_nsec): New function. (time_init): time-nsec intrinsic registered. * time.h (time_sec_nsec): Declared. * txr.1: Documented.
* time: move time functions out of lib.c into time.c.Kaz Kylheku2020-10-078-488/+567
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile (OBJS): Add new time.o. * eval.c (eval_init): Registration of time functions is removed from here; it is done in time_init now, in time.c. * hash.c: Must #include "time.h" now. * lib.c (time_s, time_local_s, time_utc_s, time_string_s, time_parse_s, year_s, month_s, day_s, hour_s, min_s, sec_s, dst_s, gmtoff_s, zone_s): Variable definitions removed. These are now in time.c. Also declared in time.h. (time_sec, time_sec_usec, gmtime_r, localtime_r, string_time, time_string_local, time_string_utc, broken_time_list, tm_to_time_struct, broken_time_struct, time_fields_local, time_fields_utc, time_struct_local, time_struct_utc, time_fields_to_tm, time_struct_to_tm, make_time_impl, make_time, epoch_tm, strptime_wrap, time_parse, setenv, unsetenv, timegm_hack, make_time_utc, time_meth, time_string_meth, time_parse_meth, time_parse_local, time_parse_utc): Functions removed. These are now in time.c. (time_init): Removed, and now in time.c as an external function. * lib.h (time_sec, time_sec_usec, time_string_local, time_string_utc, time_fields_local, time_fields_utc, time_struct_local, time_struct_utc, make_time, make_time_utc, time_parse, time_parse_local, time_parse_utc): Declarations removed. Now in time.h. * rand.c: Must #include "time.h" now. * time.c: New file. * time.h: New file.
* random: correctly refer to WELL512a everywhere.Kaz Kylheku2020-10-072-6/+6
| | | | | | * rand.c: Refer to "WELL512a" in comment, not "WELL 512". * txr.1: Replace "WELL 512" with "WELL512a" everywhere.
* random: add tests validating WELL512a.Kaz Kylheku2020-10-072-0/+24
| | | | | | * tests/013/well512a.tl: New file. * tests/013/well512a.expected: New file.
* random: bugfix: incorrect WELL512a.Kaz Kylheku2020-10-073-65/+98
| | | | | | | | | | | | | | | | | | | * rand.c (rand32_bug): New static function formed by renaming the original buggy rand32. (rand32_good): Copy of rand32 with two bugfixes. The term involving variable r2 must be only left shifted by 28 bits, and not xor-ed with the original value. The order of operations is wrong in the term that contains the & operation. (rand32): New static function pointer variable, serving as the rand32 function. Points to rand32_good by default. (rand_compat_fixup): Test for 243 or lower compatibility, under which rand32 is made point to rand32_bug. This is done before the call to make_random_state for replacing *random-state*, which has to use the old function. * txr.1: compat note added. * tests/013/maze.expected: Updated.
* doc: out of order compat entries.Kaz Kylheku2020-10-071-6/+6
| | | | * txr.1: Fix out-of-order compatibility 247 and 242 entries.
* METALICENSE: paragraph about Bison.Kaz Kylheku2020-10-071-0/+13
| | | | | | * METALICENSE: Include a paragraph explaining the special circumstances regarding the shipping the Bison-generated y.tab.c and y.tab.h files.
* quips: four new entries.Kaz Kylheku2020-10-061-0/+4
| | | | * share/txr/stdlib/quips.tl (sys:%quips%): Add four quips.
* New functions trim-left and trim-right.Kaz Kylheku2020-10-054-0/+140
| | | | | | | | | * regex.c (trim_left, trim_right): New static functions. (regex_init): New intrinsics registered. * tests/015/trim.tl, tests/015/trim.expected: New files. * txr.1: Documented.
* quips: two new entries.Kaz Kylheku2020-10-051-0/+2
| | | | * share/txr/stdlib/quips.tl (sys:%quips%): Add two quips.
* New: quip function for random humor.Kaz Kylheku2020-10-043-0/+122
| | | | | | | | | | | | Add this to your .txr_profile startup file. * lisplib.c (quips_instantiate, quips_set_entries): New static functions. (lisplib_init): Register autoloading of quip. * share/txr/stdlib/quips.tl: New file. * txr.1: Documented.
* configure: quote more characters in cmdlineKaz Kylheku2020-10-021-1/+1
| | | | | | | * configure: When calculating the cmdline variable from the positional parameters, there are more shell-special characters that require quoting: parentheses, braces, redirection operators, the semicolon and the hash comment.
* compiler: don't use move immediate instructions.Kaz Kylheku2020-10-012-5/+0
| | | | | | | | | | | | * share/txr/stdlib/compiler.tl (comp-atom): Remove the special case for small fixnums and characters which encodes their value in a movi instruction as an immediate operand. This means that now these operands go into D registers, like all other literals. * share/txr/stdlib/vm-param.tl (%imm-width%): Remove this constant, reprensenting the maximum bit width of an immediate operand.
* vm: deprecate move-immediate instructions.Kaz Kylheku2020-10-013-4/+10
| | | | | | | | | | | | | | | | | | | The movrsi, movrmi and movrbi (move immediate {small, medium, big} to register) instructions are becoming deprecated. The reasoning is that character and fixnum operands can just go into a VM descriptor's data vector (D registers). Then they can be referenced directly without wastefully issuing an extra instruction. * genvmop.txr: Add a deprecated comment next to the enum constants of deprecated opcodes. * share/txr/stdlib/asm.tl (oc-base): Add Boolean property which indicates that an opcode is deprecated. This is a static class variable, defaulting to nil in the base class. (op-movrsi, op-movsmi, op-movrbi): Override base class deprecated property with a true value. * vmop.h: Regenerated.
* genvmop.txr: stop using :vars.Kaz Kylheku2020-10-011-1/+1
| | | | | * genvmop.txr: :vars removed from @(repeat) syntax. It is no longer required as of the previous commit's fix.
* txr: bugfix: repeat not finding Lisp vars in brace.Kaz Kylheku2020-10-012-10/+18
| | | | | | | | | | | | | | | | | | | The following does not work and is fixed here: @(output) @(repeat) @{lisp-expr ...} @(end) When a Lisp expression occurs in a braced expansion syntax, it is not not traversed to find variables. * parser.y (extract_vars): Treat the second element of a sys:var as a Lisp expression, and find variables. Don't do this in 128 or older compatibility mode, because then that is a TXR expression. * y.tab.c.shipped: Regenerated.
* configure: only detect lex in maintainer mode.Kaz Kylheku2020-09-242-24/+32
| | | | | | | | | * Makefile (lex.yy.c): Move rule into maintainer conditional. * configure: Describe maintainer variable in help text. Move lex check into maintainer conditional. * lex.yy.c.shipped: New file.