summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* * Makefile (SRCS): When top_srcdir is blank, elide the entireKaz Kylheku2015-08-072-1/+8
| | | | | --work-tree argument to git. On Cygwin, git throws a strange error message when --work-tree is given a blank argument.
* * stream.c: Include <wctype.h> header for iswprint.Kaz Kylheku2015-08-072-0/+6
| | | | Needed on Cygwin.
* * sysif.c (w_lstat): If we don't have S_IFLINK, implementKaz Kylheku2015-08-072-0/+9
| | | | w_lstat as an alias to w_stat. This helps build on MinGW.
* Change to different exception for debugger quit.Kaz Kylheku2015-08-072-1/+12
| | | | | | * debug.c (debug_quit_s): New global variable. (debug): Throw debug-quit, not query-error. (debug_init): Initialize debug_quit_s.
* * debug.c (help): Rearrange menu. Show missing quit command.Kaz Kylheku2015-08-062-3/+6
|
* Suppress debug stepping into auto-loaded library code.Kaz Kylheku2015-08-067-8/+86
| | | | | | | | | | | | | | | | | | | | | * debug.c (debug_set_state, debug_restore_state): New functions. * debug.h (debug_state_t): New type. (debug_set_state, debug_restore_state): Declared, and defined as dummy macros in non-debug-support build. * lisplib.c (opt_dbg_autoload): New global variable. (lisplib_try_load): Disable or enable debugging around library loading based on opt_dbg_autoload option. * lisplib.h (opt_dbg_autoload): Declared. * txr.c (help): List --debug-autoload option. (no_dbg_support): New static function to avoid repeated code. (txr_main): Add debugger option. Change duplicate no debug support error messages into calls to no_dbg_support. * txr.1: Document --debug-autoload
* * txr.c (txr_main): Bugfix: debugger long option nonfunctional.Kaz Kylheku2015-08-062-1/+5
|
* Better diagnosis for loose @ forms.Kaz Kylheku2015-08-063-4/+27
| | | | | | | | | | | | | * eval.c (op_meta_error): New static function. (eval_init): Register sys:var and sys:expr as operators that throw error. * parser.y (sym_helper): Take parser_t instead of scanner_t argument so we have access to the name and line number. Obtain scanner internally from parser. Add source location info to (sys:var ...) form. (symhlpr): Retarget macro to pass parser rather than scanner to sm_helper.
* * txr.1: Formatting issue in in-line code block under giterate.Kaz Kylheku2015-08-051-1/+1
|
* * txr.1: pppred formatting problem.Kaz Kylheku2015-08-051-1/+1
|
* New filesystem object testing functions.Kaz Kylheku2015-08-054-0/+339
| | | | | | | | | | * lisplib.c (path_test_set_entries, path_test_instantiate): New static functions. (dlt_register): Registered new functions to dl_table. * txr.1: Documented new functions. * share/txr/stdlib/path-test.tl: New file.
* Adding support for uid and gid manipulation.Kaz Kylheku2015-08-054-0/+187
| | | | | | | | | | | | * configure: Added check for geteuid and related functions. * sysif.c (getuid_wrap, geteuid_wrap, getgid_wrap, getegid_wrap, getgroups_wrap, setuid_wrap, seteuid_wrap, setgid_wrap, setegid_wrap): New static functions. (sysif_init): Register intrinsics getuid, geteuid, getgid, getegid, getgroups, setuid, seteuid, setgid, setegid. * txr.1: Documented new functions.
* New exception type: system-error.Kaz Kylheku2015-08-054-0/+13
| | | | | | | | | * lib.c (system_error_s): New symbol variable. (obj_init): Initialize new variable. * lib.h (system_error_s): Declared. * unwind.c (uw_init): Register system-error exception type.
* * stream.c (stream_init): Register get-indent-mode, set-indent-mode,Kaz Kylheku2015-08-053-1/+163
| | | | | | | | test-set-indent-mode, get-indent, set-indent, inc-indent and width-check intrinsic functions. Register indent-off, indent-data and indent-code variables. * txr.1: Documented stream output indentation API.
* * stream.c (width_check): Just use the publicKaz Kylheku2015-08-052-11/+10
| | | | | put_char function; no need to manipulate column or call put_indent.
* Better diagnostic in funcall family of functions.Kaz Kylheku2015-08-052-5/+22
| | | | | | * lib.c (wrongargs): New static function. (funcall, funcall2, funcall2, funcall3, funcall4): Use wrongargs.
* * eval.c (do_eval): Bugfix: though last_form_evaled isKaz Kylheku2015-08-052-0/+7
| | | | | saved and restored around the execution of a special operator, it is never set the current form.
* * eval.c (bind_args): Use new ~! for proper indentationKaz Kylheku2015-08-043-9/+17
| | | | | | | of multi-line context form. (apply): Use ~! for proper indentation of function code. * unwind.c (uw_throw): Use ~! for proper indentation of code.
* * stream.c (put_string): In indent mode, put_string hasKaz Kylheku2015-08-042-6/+16
| | | | | | | | to process all the characters as if by put_char, (which we now do literally that way). (set_indent_mode): Bugfix: no longer reset the column to zero when turning off indent mode. This is wrong since streams do column counting all the time.
* * stream.c (vformat): Implement ~! format directive for indentation.Kaz Kylheku2015-08-043-10/+80
| | | | | | | Allow negative widths to be specified with a leading minus sign, so that we can indent to the left. * txr.1: Document ~! format directive.
* * stream.c (put_string, put_char): Do not put out the indentationKaz Kylheku2015-08-042-2/+19
| | | | | immediately after outputting a newline. Rather, delay the output of the indentation until some output occurs at column zero.
* * stream.c (inc_indent): If a negative indentation increment goes belowKaz Kylheku2015-08-042-0/+10
| | | | | zero, clamp it at zero. (set_indent): Clamp indentation value to zero.
* * stream.c (vormat): Bugfix: when width specified as *Kaz Kylheku2015-08-042-1/+8
| | | | | | meets a negative argument, the width should be treated as positive and the field left aligned. Instead, the width is treated as zero.
* * stream.c (string_out_put_string): Do not return nil whenKaz Kylheku2015-08-042-2/+9
| | | | buffer calculations overflow, but throw exception.
* Remove useless return values and checks.Kaz Kylheku2015-08-043-78/+63
| | | | | | | | | | | | | | | * stream.c (vformat_align_pre, vformat_align_post): Change to void return. Do not check return value of put_char. (vformat_num, vformat_str): Change to void return. Do not check return value of vformat_align_pre, vformat_aign_post or put_char. (vformat): Do not check return value of vformat_str or vformat_num. nilout exit point no longer needed. (put_string): Do not intercept return value of ops->put_string. Return t. (put_char): Do not intercept return value of ops->put_char. Do not check return value of put_indent. Return t. * txr.1: Document t return of put-char, put-byte and put-string.
* * eval.c (func_get_name): New function.Kaz Kylheku2015-08-044-7/+84
| | | | | | | | | | | | (bind_args): Include the entire context form in argument mismatch errors. (apply): Include the function name, or else source code if it has no name, in argument mismatch erors. (eval_init): Register func-get-name intrinsic. * eval.h (func_get_name): Declared. * txr.1: Documented func-get-name.
* * eval.c (force): Default the new second argument of source_loc_str.Kaz Kylheku2015-08-047-22/+47
| | | | | | | | | | | | | | | | | | | (eval_error): Derive location of error from the last_form_evaled, if form doesn't have it. (eval_init): Re-register source-loc-str as binary with an optional arg. * match.c (debuglf, sem_error, file_err, typed_error): Default new argument of source_loc_str. * parser.h (source_loc_str): Declaration updated. * parser.l (source_loc_str): Take second argument which specifies alternative value if the source loc info is not found. * unwind.c (uw_throw): Simplify code thanks to source_loc_str default argument. * txr.1: Document new argument of source-loc-str.
* * hash.c (hash_revget): New function.Kaz Kylheku2015-08-045-0/+72
| | | | | | | | * hash.h (hash_revget): Declared. * eval.c (eval_init): Registered hash-revget intrinsic. * txr.1: Documented hash-revget.
* * stream.c (indent_mode_put_string): Function removed,Kaz Kylheku2015-08-043-64/+59
| | | | | | | logic hoisted into put_string. (put_string, put_char): Always count column, indent mode or not. * tests/009/json.expected: Updated.
* Define TXR_DBG macro when compiling debug build.Kaz Kylheku2015-08-033-3/+22
| | | | | | | | | * Makefile (dbg/%.o): Pass $(DBG_ONLY_FLAGS) to COMPILE_C_WITH_DEPS recipe macro. * configure (debug_only_flags): New macro. (gen_config_make): Generate DBG_ONLY_FLAGS. Add debug-only-flags to usage help text.
* Custom linker flags support.Christopher Meng2015-08-033-5/+27
| | | | | | | | | | | | * Makefile (PLATFORM_FLAGS): Rename to PLATFORM_CFLAGS. (LDFLAGS): New variable. Includes -lm and PLATFORM_CFLAGS. (LINK_PROG): Use $(LDFLAGS) instead of -lm. * configure (platform_flags): Renamed to platform_cflags. (platform_ldflags): New variable. (gen_config_make): Rename PLATFORM_CFLAGS and generate PLATFORM_LDFLAGS. Usage help text updated.
* Switching some globals to lexical and changing some names.Kaz Kylheku2015-08-0313-158/+240
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * arith.c (arith-init): Changing *flo-...* from special to lexical, and adding un-earmuffed variants. The earmuffed versions are obsolescent. Adding %pi% and %e% global lexicals. Earmuffed versions are also made global lexical, and obsolescent. * eval.c (lookup_global_var, lookup_global_var_l): New functions. (lookup_var): Uses lookup_global_var. (reg_varl): New function. (reg_var): Uses reg_var. (eval_init): Register global lexicals user-package, system-package and keyword-package. Old symbols with earmuffs are obsoleted, and also turned into global lexicals. (top-vb, top-fb): Changed to lexical. * eval.h (lookup_global_var, lookup_global_var_l, reg_varl): Declared. * genvim.txr: Scan ver.tl so that the lib-version variable is included. Extract reg_varl calls. * glob.c (glob_init): glob-err and other variables made lexical. * lib.c (get_user_package, get_system_package, get_keyword_package): Use lookup_global_var_l to avoid searching dynamic scope for lexicals which cannot be dynamically rebound. * share/txr/stdlib/ver.tl (lib-version): New global lexical variable. (*lib-version*): Turned lexical. Obsolescent. * signal.c (sig-init): sig-* variables turned lexical. * sysif.c (sysif-init): s-*, poll-* and w-* variables turned lexical. * syslog.c (syslog-init): log-* variables turned lexical. * txr.c (sysroot-init): stdlib and *txr-version* variables turned lexical. txr-version variable added, and *txr-version* is obsolescent. (txr-main): self-path variable added. *self-path* turns lexical and is obsolescent. * txr.1: Documentation updated. Lexical variables not referred to as special. Special variables referred to as special.
* * txr.c (txr_main): Bugfix: register *args-full*, the variableKaz Kylheku2015-08-032-0/+7
| | | | | described in the documentation! We keep *full-args* for backward compatibility, as an obsolescent feature.
* Introducing global lexicals: defvarl, defparml.Kaz Kylheku2015-08-033-19/+102
| | | | | | | | | | | | | | | | | | | | | * eval.c (defvarl_s, defparm_s, defparml_s, sys_mark_special_s): New symbol variables. (mark_special): Return val rather than void, since it's hoisted into Lisp domain now with func_n1. (op_defvar): Renamed to op_defvarl, and doesn't call mark_special. defvarl is now the special form for defining variables, and special marking is an embellishment added by macros. (me_defparm): Renamed to me_def_variable. Handles defvar, defparm and defparml. (do_expand): Expand defvarl, rather than defvar. (eval_init): Intern defvarl, defparm, defparml and mark-special symbols, and initialize corresponding globals. Register defvarl special operator, retiring defvar. Register defparm to me_def_variable, and register defvar and defparml to the same. * txr.1: Document support for global lexical scopes and the new macros.
* Support lstat and fstat.Kaz Kylheku2015-08-024-14/+106
| | | | | | | | | | | | | | | * stream.h (statf): Declaration removed. * sysif.c (w_stat): Function takes val instead of const wchar_t * as leftmost argument. (w_lstat, w_fstat): New static functions, with same interface as w_stat. (stat_to_list, stat_impl): New static functions. (statp, statl): New static functions. (statf): Function removed, name re-used for new static function. (sysif_init): stat intrinsic registered to statp function, not statf. lstat and fstat intrinsics registered to statl and statf. * txr.1: Documented lstat and fstat.
* Pass pretty flag to cobj print operation.Kaz Kylheku2015-08-017-16/+46
| | | | | | | | | | | | | | | | | | | | | * hash.c (hash_print_op): Take third argument, and call cobj_print_impl rather than cobj_print. * lib.c (cobj_print_op): Take third argument. The object class is * printed with obj_print_impl. (obj_print_impl): Static function becomes extern. Passes its pretty flag argument to cobj print virtual function. * lib.h (cobj_ops): print takes third argument. (cobj_print_op): Declaration updated. (obj_print_impl): Declared. * regex.c (regex_print): Takes third argument, and ignores it. * stream.c (stream_print_op, stdio_stream_print, cat_stream_print): Take third argument, and ignore it. * stream.h (stream_print_op): Declaration updated.
* * eval.c (special_p): Function renamed to special_var_p.Kaz Kylheku2015-08-013-7/+52
| | | | | | | | (expand_opt_params_rec, expand_vars): Follow rename of special_p. (eval_init): Register special-operator-p and special-var-p intrinsics. * txr.1: Document special-operator-p and special-var-p.
* Big TXR Lisp documentation rearrangement.Kaz Kylheku2015-08-012-6225/+6381
| | | | | * txr.1: Numerous sections moved around. Miscellaneous formatting and wording fixes. New sections under TXR Lisp intro section.
* string_output renamed to string_outKaz Kylheku2015-07-312-8/+17
| | | | | | | * stream.c (struct string_output): Renamed to string_out. (string_out_stream_destroy, string_out_byte_callback, string_out_put_char, strnig_out_put_string, string_out_put_byte, make_string_output_stream, get_string_from_stream): Follow rename.
* Simplify type check code in stream module.Kaz Kylheku2015-07-312-191/+117
| | | | | | | | | | | | | | | * stream.c (get_string_from_stream, get_list_from_stream, stream_set_prop, stream_get_prop, close_stream, get_line, get_char, get_byte, unget_char, unget_byte, put_string, put_char, put_byte, flush_stream, seek_stream): Use cobj_handle and cobj_ops instead of type_check and type_assert. (get_indent_mode, test_set_indent_mode, set_indent_mode, get_indent, set_indent, inc_indent, width_check): Use cobj_handle and cobj_ops instead of stream->co.handle and stream->co.ops for safety. (vformat, format): Use class_check instead of type_check and type_assert.
* Multi-line, indented printing of structure.Kaz Kylheku2015-07-3110-183/+429
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * eval.c (op_error): New static function. (macro_form_p, fboundp): Static to external. (special_operator_p): New function. (eval_init): Register macrolet and symacrolet to op_error. These are recognized and processed by expand, but we want them in the op table so they are reported by special_operator_p. * eval.h (fboundp, macro_form_p, special_operator_p): Declared. * hash.c (print_key_val): Break long lines on spaces between pairs with stream_width_check. (hash_print_op): Implement split and indented printing. * lib.c (obj_print_impl): New static function, resulting from a merge of obj_print and obj_pprint. Fixes some wrong-way recursion bugs: obj_pprint recursed into obj_print in some places. Adds support for multi-line printing of vectors and lists, with indentation using the new interfaces in streams. * stream.c (strm_base_init): Update initializer. (put_indent, indent_mode_put_string): New static functions. (put_string): Use indent_mode_put_string in either of the two indent modes. (put_char): Implement indent mode. (get_indent_mode, test_set_indent_mode, set_indent_mode, get_indent, set_indent, inc_indent, width_check): New functions. * stream.h (enum indent_mode): New. (struct strm_base): indent_on member becomes indent_mode. New members data_width and code_width. (get_indent_mode, test_set_indent_mode, set_indent_mode, get_indent, set_indent, inc_indent, width_check): Declared. * tests/009/json.expected: Updated. * tests/010/seq.expected: Likewise. * tests/011/macros-2.expected: Likewise.
* * filter.c, utf8.c: Fix bad indentation introduced in whitespaceKaz Kylheku2015-07-303-2/+7
| | | | fix on 2013-08-09.
* Correction to COBJ initialization pattern.Kaz Kylheku2015-07-304-46/+89
| | | | | | | | | | | | | In fact, the previosuly documented process is not correct and still leaves a corruption problem under generational GC (which has been the default for some time). * HACKING: Document flaw in the initialization pattern previously thought to be correct, and show fix. * hash.c (copy_hash): Fix instance of incorrect pattern. * regex.c (regex_compile): Likewise.
* * HACKING: Restore accidentally deleted document title.Kaz Kylheku2015-07-302-0/+9
|
* Deriving streams from the same base, soKaz Kylheku2015-07-294-124/+272
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | we can give streams some common slots. * stream.c (strm_base_init, strm_base_cleanup, strm_base_mark, stream_destroy_op, stream_mark_op): New functions. (null_ops): Switch to stream_destroy_op and stream_mark_op. (make_null_stream): Associate a strm_base instance with the cobj handle rather than a null pointer. (struct stdio_handle): Inherit struct strm_base. (stdio_stream_destroy): Clean up the strm_base part. (stdio_stream_mark): Mark the strm_base part. (make_stdio_stream_common): Initialize the strm_base part. (struct dir_handle): Inherit struct strm_base. (dir_destroy): Clean up the strm_base part. (dir_mark): Mark the strm_base part. (make_dir_stream): Initialize the strm_base part. (struct string_in): New structure. Replaces ad-hoc cons cell used for string input streams. (string_in_stream_mark): Mark new structure. (string_in_get_line, string_in_get_char, string_in_unget_char, string_in_get_prop, string_in_get_error, make_string_input_stream): Convert to new structure. (string_in_ops): Switch to stream_destroy_op. (struct byte_input): Inherit struct strm_base. (byte_in_stream_destroy): No need to check handle for null. No need to set handle to null after freeing: gc does it. Clean up the strm_base part. (byte_in_ops): Switch to stream_mark_op. (make_string_byte_input_stream): Initialize the strm_base part. (struct string_output): Inherit struct strm_base. (string_out_stream_destroy): No need to check handle for null since the logic elsewhere has changed. Clean up the strm_base part. No need to set handle to null. (string_out_ops): Switch to stream_mark_op. (make_string_output_stream): Initialize the strm_base part. (get_string_from_stream): Don't free the handle. Null out the buffer so->buf whose ownership passes to the string. (struct strlist_out): New structure. Replaces ad-hoc cons cell used for string list output stream. (strlist_mark): Renamed to strlist_out_mark. Mark the strm_base part. (strlist_out_put_string, strlist_out_put_char, make_strlist_output_stream, get_list_from_stream): Convert to new structure. (strlist_out_ops): Switch to stream_destroy_op. Follow rename of strlist_mark. (struct cat_strm): New structure, replacing ad-hoc list pointer
* * gc.c (finalize): Null out cobj handle after calling theKaz Kylheku2015-07-292-0/+6
| | | | destructor. This can catch some use-after-free errors.
* * stream.c (common_destroy): Function removed.Kaz Kylheku2015-07-292-7/+7
| | | | (stdio_stream_destroy, dir_destroy): Call close_stream directly.
* * stream.c: Rearranging definitions and declarations so thatKaz Kylheku2015-07-292-432/+438
| | | | | | code for each stream type is together. Moving catenated streams above utility functions, so they are together with other stream definitions.
* Centered fields in format.Kaz Kylheku2015-07-283-31/+96
| | | | | | | | | | | | * stream.c (enum align): New enum. (vformat_align_pre, vformat_align_post): New static functions. (vformat_num, vformat_str): Argument left renamed to align, and changed to enum align. vformat_align_pre and vformat_align_post are called to generate the correct padding for left, center and right alignment. (vformat): Two-valued local variable left turned into three-valued align. The ^ prefix on the width field is recognized. * txr.1: Documented ^ width prefix.
* * share/txr/stdlib/txr-case.tl (txr-case-impl): Bugfix,Kaz Kylheku2015-07-282-0/+6
| | | | handle nil case in recursion.