summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Adding pset operator.Kaz Kylheku2015-05-093-1/+29
| | | | | | * place.tl (pset): New macro. * lisplib.c (set_place_dlt_entries): Add pset.
* * place.tl (set): Take multiple place/value pairs. Allow zeroKaz Kylheku2015-05-092-3/+15
| | | | arguments.
* Crack down on redefinitions of built-ins.Kaz Kylheku2015-05-087-23/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | * eval.c (builtin, eval_initing): New global variable. (op_defun, op_defmacro): During initialization, record functions and macros in builtin hash. (builtin_reject_test): New static function. (expand_macrolet): Perform builtin reject test for fbind, lbind, and macrolet. (regfun, reg_mac): Add symbol to builtin hash. (eval_init): GC-protect new hash table variable and initialize it. Set eval_initing to true over eval initialization. The flip function is renamed fo flipargs. (eval_compat_fixup): New function, for dealing with the operator/function conflict over flip. * eval.h (eval_compat_fixup): Declared. * lib.c (compat_fixup): Call eval_compat_fixup. * tests/011/macros-2.txr: This test was defining a macro called while which is now illegal. Renamed to whilst. * tests/011/macros-2.expected: Regenerated. * txr.1: Function flip renamed to flipargs and documented in Compatibility section.
* * Makefile (LISP_TO_C_STRING): Strip comments, but not comment lines,Kaz Kylheku2015-05-078-13/+45
| | | | | | | | | | | | | | | | | | so line numbers don't change. * eval.c (eval_init): Fix registrations of lisp-parse and read. * lisplib.c (place_instantiate): Give name to parsed string stream using new lisp_parse argument. * parser.c (lisp_parse): Takes new argument to override name. * parser.h (lisp_parse): Declaration updated. * txr.c (txr_main): Call lisp_parse with four args, defaulting the new one. * txr.1: Documented new argument.
* single-body-form-fixupKaz Kylheku2015-05-261-48/+48
|
* New macro-based framework for assignment places.Kaz Kylheku2015-05-0614-318/+715
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The operators set, inc, dec, pop and others are now macros which generate code, rather than built-in special forms that use "C magic". Moreover, new such macros are easy to write, and several new ones are already available. Moreover, new kinds of assignable places are easy to create. * place.tl: New file. * lisplib.c, lisplib.h: New files. * Makefile (OBJS): New target, lisplib.o. (GEN_HDRS): New variable. (LISP_TO_C_STRING): New recipe macro, with rule. (clean): Remove generated headers named in $(GEN_HDRS). * eval.c (dec_s, push_s, pop_s, flip_s, del_s): Variables removed. (setq_s): New variable. (lookup_var, lokup_sym_lisp_1, lookup_var_l, lookup_fun, lookup_mac, lookup_symac, lookup_symac_lisp1): Trigger the delayed loading of libraries for undefined global symbols, and re-try the lookup. (op_modplace, dwim_loc, force_l): Static functions removed. (op_setq): New static function. (eval_init): Initialize setq_s; remove initializations of removed variables; remove registrations for op_modplace; add registration for sys:setq, sys:rplaca, sys:rplacd, sys:dwim-set and sys:dwim-del intrinsics. Call lisplib_init to initialize the dynamic library loading module. * lib.c (sys_rplaca, sys_rplacd): New functions, differing in return value from rplaca and rplacd. (ref, refset): Handle hash table. (dwim_set, dwim_del): New functions. * lib.h (sys_rplaca, sys_rplacd, dwim_set, dwim_del): Declared. * genvim.txr: Include place.tl in scan. * tests/010/seq.txr: The del operator test case no longer throws at run-time but at macro-expansion time, so the test case is simply removed. * tests/010/seq.expected: Updated output. * tests/011/macros-2.txr: Reset *gensym-counter* to zero, because the textual output of the test case includes gensyms, whose numberings fluctuate with the content of the new Lisp library material. * tests/011/macros-2.expected: Updated output.
* * gc.c (make_obj, gc): Move resetting of prev_malloc_bytesKaz Kylheku2015-05-062-2/+6
| | | | out of make_obj into gc.
* Do some cleanup in progn-like form sequences.Kaz Kylheku2015-05-052-9/+53
| | | | | | * eval.c (expand_progn): New function. (do_expand): Use expand_progn for constructs which have an implicit progn body.
* Deal with bad quote syntax.Kaz Kylheku2015-05-033-2/+15
| | | | | | | * eval.c (op_quote): Throw error on bad syntax. * lib.c (obj_print, obj_pprint): Do not hide bad quote syntax using ' notation; print it using ordinary notation.
* Move initialization calls to more suitable place.Kaz Kylheku2015-05-013-9/+20
| | | | | | | | * lib.c (init): Initialize parser, syslog and glob modules here. * txr.c (main): Remove initialization of parser, syslog and glob modules from here.
* * signal.h (sig_save_disable): Bugfix: macro enablingKaz Kylheku2015-05-012-1/+6
| | | | rather than disabling async signals.
* Fix corruption triggered by extended gc disabling.Kaz Kylheku2015-05-013-39/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The issue is that when gc is disabled, the gc function does nothing. But various code depends on calls to gc() doing something, like making space available in various static arrays. When gc is disabled for long periods, there are issues, like array overruns. * gc.c (gc): Must no longer be called at all if gc_enabled is false, and asserts that it is true. Callers must check the gc_enabled flag and implement appropriate cases. (make_obj): Only call gc when gc_enabled is true. If there is no space in the freshobj array after trying gc, or gc couldn't be tried because it is disabled, then schedule a full gc. (gc_set): If the checkobj array is full, only call gc if gc is enabled, otherwise schedule a full_gc. (gc_mutated): Do not assume that the mutobj array has room for another object; only set the object's generation to -1 and put it into the array if there is room. Similarly to gc_set, do a gc if there is no room, but if gc is not enabled, then schedule a full gc. (gc_wrap): Only call gc if gc_enabled is true, and return t in that case rathe than nil. * txr.1: Document return value of sys:gc function.
* Fix source location for dangling unquotes and splices.Kaz Kylheku2015-04-302-10/+34
| | | | | | | | | | * parser.y (grammar): Propagate the parser line number to the unquote or splice form, if it has not received location info from its operand (because its operand is an atom). In the quasi_item case, we also use rlcp_tree to make sure the info is propagated through the list being consed up. (rlcp_tree): Bugfix: propagate the source location info to every cons in the list itself, not just into their cars.
* Improved syntax checking: defun, flet, labels, lambda.Kaz Kylheku2015-04-292-48/+91
| | | | | | | | | | | | | | * eval.c (check_lambda_list): New static function. (op_defun): Argument list checking moved into check_lambda_list, which is called for defun out of do_expand. Name checks moved into do_expand. Thus, defun is checked earlier, at expansion time. (me_flet_labels): Check the lambda list of each lexical function with check_lambda_list. (do_expand): Check the syntax of the lambda form, and the validity of its argument list. Check the name of a defun or defmacro for validity. Check the validity of the defun argument list.
* Bugfix: cannot print (lambda . 42) structure.Kaz Kylheku2015-04-292-2/+9
| | | | | * lib.c (obj_print, obj_pprint): Fix mistake in the test for properly formed lambda syntax whcih is printed specially.
* Adding poll function.Kaz Kylheku2015-04-285-1/+191
| | | | | | | | | | | | | | * configure: Check for the poll function and set HAVE_POLL accordingly in config.h. * stream.h (fd_k): External declaration added. * sysif.c (poll_wrap): New function. (sysif_init): Registered poll-in, poll-out, poll-err, poll-pri, poll-rdhup, poll-nval, poll-rdband, poll-wrband variables and poll function. * txr.1: Documented poll.
* Version 107.txr-107Kaz Kylheku2015-04-267-170/+204
|
* Allow (force ...) to be an assignable place.Kaz Kylheku2015-04-253-12/+42
| | | | | | | | | | | | | | This allows mlet variables to be assignable. * eval.c (force_s): New global variable. (op_modplace): Handle force form. (me_mlet): Use force_s symbol. (force_l): New static function. (eval_init): Initialize force_s variable. Use it in registration of force function. * txr.1: Remove text in mlet definition that variables are not assignable. Replace with note about an unspecified behavior.
* Introducing mlet macro.Kaz Kylheku2015-04-253-1/+175
| | | | | | | * eval.c (me_mlet): New static function. (eval_init): Registered mlet macro. * txr.1: Documented mlet.
* * lib.c (symbol_package): If the argument is nil, returnKaz Kylheku2015-04-252-1/+7
| | | | | the user package directly, not the value of the *user-package* variable.
* Remove silly package lookup from keywordp.Kaz Kylheku2015-04-253-2/+14
| | | | | | | | | | This tiny change yields a 165% (2.65X) speedup in the tst/tests/011/mandel.txr test case. * lib.c (keywordp): Use keyword_package_var instead of the keyword_package macro which looks up the global environment. * parser.y (sym_helper): Likewise.
* Regression: runaway allocation of heaps.Kaz Kylheku2015-04-242-1/+13
| | | | | | | | | | * gc.c (make_obj): Fix regression introduced on 2014-10-18, released in TXR 100. Because make_obj discontinues placing objects into the freshobj_array when the full_gc flag has been set, it is incorrect to allocate another heap when the free list is exhausted and the freshobj_array has room remaining. It has room remaining because it is disused.
* * gc.c (make_obj, gc): The check for insufficient space in freshobjKaz Kylheku2015-04-242-3/+9
| | | | array after a gc is moved into the gc function.
* * gc.c (gc): Minor off-by-one: compare gc_counter to FULL_GC_INTERVALKaz Kylheku2015-04-242-1/+6
| | | | rather than FULL_GC_INTERVAL - 1, since it is pre-incremented.
* * txr.1: lconsp: unterminated syntax block.Kaz Kylheku2015-04-231-0/+1
|
* * txr.1: name typo in lcons sample implementation.Kaz Kylheku2015-04-231-1/+1
|
* Switch to in-tree mpi directory.Kaz Kylheku2015-04-2224-1884/+20
| | | | | | | | | | | | | | | | * Makefile (CFLAGS, MPI_OBJS): Refer to mpi directory without version number. (repatch): Target removed. (distclean): Don't try to remove old unpacked tarball mpi directory. * configure (mpi_version, have_quilt, have_patch): Variables removed. (gen_config_make): Do not generate mpi_version make variable. Do not test for quilt or patch. No longer extract MPI tarball or try to apply patches. * mpi-1.8.6.tar.gz: File removed. * mpi-patches: Directory and all files under it removed.
* eliminate-locale-dependencies patchKaz Kylheku2015-04-221-9/+14
| | | | | | | Eliminating dependencies on locale-dependent C functions. * mpi/mpi.c (s_mp_tovalue, s_mp_todigit): Avoid tolower, toupper, islower and isupper.
* add-bitops patchKaz Kylheku2015-04-222-0/+441
| | | | | | | | | | | Adding bit operations to MPI. * mpi/mpi.c (MAX, MIN): New macros. (mp_2comp, mp_and, mp_or, mp_xor, mp_comp, mp_trunc, mp_shift, mp_bit): New functions. * mpi/mpi.h (mp_2comp, mp_and, mp_or, mp_xor, mp_comp, mp_trunc, mp_shift, mp_bit): Declared.
* fix-ctype-warnings patchKaz Kylheku2015-04-221-3/+3
| | | | | * mpi/mpi.c (s_mp_tovalue): Argument changes from char to int, fixing some compiler warnings.
* mpi-to-double patchKaz Kylheku2015-04-222-0/+29
| | | | | | * mpi/mpi.c (mp_to_double): New function. * mpi/mpi.h (mp_to_double): Declared.
* faster-square-root patchKaz Kylheku2015-04-221-74/+70
| | | | | * mpi/mpi.c (s_highest_bit_mp, s_mp_set_bit): New functions. (mp_sqrt): Rewrite with more efficient algorithm.
* shrink-mpi-int patchKaz Kylheku2015-04-221-0/+5
| | | | | | * mpi/mpi.h (mp_int): Depending on the relative size of int and pointers, turn the sign and alloc fields into bitfields, so that the structure is three words wide and therefore fits into a TXR obj_t heap object.
* bit-search-optimizations patchKaz Kylheku2015-04-221-30/+232
| | | | | * mpi/mpi.c (s_highest_bit): New static function. (s_mp_norm, s_mp_ispow2): Use s_highest_bit instead of looping over bits.
* fix-bad-shifts patchKaz Kylheku2015-04-221-5/+5
| | | | | | * mpi/mpi.c (mp_div_d, s_mp_mod_2d, s_mp_mul_2d, s_mp_div_2d, s_mp_2expt): Fixing incorrect digit-wide left shifts whre the operand is not widened to the mp_digit type.
* mpi-set-double-intptr patchKaz Kylheku2015-04-222-0/+33
| | | | | | * mpi/mpi.c (mp_set_double_intptr): New function. * mpi/mpi.h (mp_set_double_intptr): Declared.
* mpi-set-mpi-word patchKaz Kylheku2015-04-222-0/+10
| | | | | | * mpi/mpi.c (mp_set_word): New function. * mpi/mpi.h (mp_set_word): Declared.
* fix-mult-bug patchKaz Kylheku2015-04-221-6/+6
| | | | | | | | Fixing bugs in MPI whereby two digits are multiplied together, but neither operand is cast to the double digit type, so that the result is truncated. * mpi/mpi.c (s_mp_mul_d, s_mp_mul, s_mp_sqr): Add casts to achieve multiplication of the proper width.
* add-mpi-toradix-with-case patchKaz Kylheku2015-04-222-4/+10
| | | | | | | | * mpi/mpi.c (mp_toradix_case): New function based on mp_toradix. Takes an argument whether to use lower case digits. (mp_toradix): Reduced to wrapper for mp_toradix_case. * mpi/mpi.h (mp_toradix_case): Declared.
* add-mp-hash patchKaz Kylheku2015-04-222-0/+30
| | | | | | * mpi/mpi.c (mp_hash): New function. * mpi/mpi.c (mp_hash): Declared.
* export-mp-eq patchKaz Kylheku2015-04-222-8/+4
| | | | | | * mpi/mpi.c (MP_LT, MP_EQ, MP_GT): Preprocessor symbols removed. * mpi/mpi.h (MP_LT, MP_EQ, MP_GT): Preprocessor symbols added.
* add-mp-set-intptr patchKaz Kylheku2015-04-222-0/+55
| | | | | | * mpi/mpi.c (mp_set_intptr, mp_get_intptr): New functions. * mpi/mpi.h (mp_set_intptr, mp_get_intptr): Declared.
* use-txr-allocator patchKaz Kylheku2015-04-221-6/+9
| | | | | | | | | * mpi/mpi.c (mem_t): TXR's mem_t typedef repeated here. (chk_calloc): New external declaration, to avoid including our entire lib.h header. (s_mp_alloc): Macro retargetted to use chk_calloc. (mp_init_size, mp_init_copy, mp_copy, s_mp_grow, s_mp_copy): Return value casts added.
* fix-warnings patchKaz Kylheku2015-04-222-7/+7
| | | | | | | * mpi/mpi.c (mp_to_unsigned_bin, s_mp_mod_2d): Fix signed/unsigned warning. (mp_toradix): Fix shadowing local variable name warning. * mpi/mplogic.c (mpl_num_set, mpl_num_clear): Fix signed/unsigned warning.
* config-types patchKaz Kylheku2015-04-223-13/+54
| | | | | | | | * mpi/mpi-types.h: Rewritten by hand to use make use of information produced by TXR's configure script into config/config.h. * mpi/mpi.c, mpi/mplogic.c: Include the config.h header, now needed by mpi-types.h.
* Bringing MPI library out of tarball into GIT.Kaz Kylheku2015-04-229-0/+5597
| | | | Importing 1.8.6 upstream baseline, minus unwanted stuff.
* delay/force overhaul.Kaz Kylheku2015-04-222-7/+45
| | | | | | | | | | | | | * eval.c (promise_forced_s, promise_inprogress_s): New symbol variables. (me_delay): Change representation of promises so that the original delay form is stashed there for better reporting in the force function. Also, propagate the debug info from the second argument of the form to the entire form; otherwise it will inherit it from elsewhere. (force): Rewritten to follow new three-state representation to detect the recursive case and diagnose it. (eval_init): Register new symbol variables.
* * txr.1: Fix formatting issuesKaz Kylheku2015-04-221-10/+10
| | | | whilet, whenlet, iflet, for*
* ChangeLog fixup: "Version 106" missing.Kaz Kylheku2015-04-211-0/+2
|
* Version 106.txr-106Kaz Kylheku2015-04-215-4/+105
|