summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* * txr.vim: regenerated.Kaz Kylheku2014-03-231-106/+107
|
* * eval.c (eval_init): Register last function as intrinsic.Kaz Kylheku2014-03-235-0/+34
| | | | | | | | * lib.c (last): New function. * lib.h (last): Declared. * txr.1: Documented last.
* * eval.c (eval_init): Register empty as intrinsic.Kaz Kylheku2014-03-235-3/+67
| | | | | | | | | | | | * lib.c (copy): Bugfix: handle lazy strings. Also, handle hash tables via copy_hash. (length): Bugifx: handle lazy strings. Also, handle hash tables via hash_count. (empty): New function. * lib.h (empty): Declared. * txr.1: Documented.
* * eval.c (not_s): New symbol var.Kaz Kylheku2014-03-233-5/+72
| | | | | | | (me_unless, me_while, m_until): New static functions. (eval_init): Register macros unless, while and until. * txr.1: Document unless, while and until.
* Version 87.txr-87Kaz Kylheku2014-03-226-5/+45
|
* * utf8.c (w_fopen, w_popen, w_freopen, w_remove, w_rename): RevertKaz Kylheku2014-03-222-20/+5
| | | | 2014-03-14 changes.
* txr.1: Improve dwim operator description.Kaz Kylheku2014-03-221-11/+28
|
* * eval.c (me_when): New static function.Kaz Kylheku2014-03-223-0/+29
| | | | | | (eval_init): Register "when" macro. * txr.1: Documented when macro.
* Second round of bugfixing on the theme of the previous commit.Kaz Kylheku2014-03-202-19/+70
| | | | | | | | | | | | | | Here were are changing the output clause to recognize all special clause tokens that are not used in output and turning them into regular Lisp. So @(if a b c) in an output clause works once again, recognized as IF exprs_opt ')' syntax, and turned into Lisp. Other things work that didn't work before like @(and), @(or) and so forth. * parser.y (make_expr): New static function. (not_a_clause): New nonterminal. (out_clause): Remove error-catching productions for match-side clauses. (o_elems): Now consists of a mixture of o_elems and not_a_clause's.
* Fixing gaping bug in the handling of @-delimited expressionsKaz Kylheku2014-03-202-24/+40
| | | | | | | | | | | | | | | within quasiliterals. This has been a problem for years. Quasiliteral strings existed very early before TXR Lisp was introduced. So it made sense that when @ is seen in a quasiliteral, the lexical analyzer pushed into the SPECIAL state in which directives are recognized, like in the pattern language. I noticed this because there is an @(if) directive now, which prevents `@(if ...)` from being valid. * parser.l (QSPECIAL): New scanner state. This is a state similar to SPECIAL that we enter into when @ is seen in a QSLIT state. In this state we recognize constructs like braced variables, but not certain other features like directives.
* Fix iskeyword so /= and / are highlighted properly.Kaz Kylheku2014-03-192-10/+10
|
* * arith.c (int_flo): Fix non-handling of negative values.Kaz Kylheku2014-03-192-4/+8
|
* * arith.c (tofloat, toint): New functions.Kaz Kylheku2014-03-195-0/+91
| | | | | | | | | * arith.h (tofloat, toint): Declared. * eval.c (eval_init): tofloat and toint registered as intrinsics. * txr.1: Documented.
* ChangeLog: fix wrong date in entry for Version 86.Kaz Kylheku2014-03-191-1/+1
|
* Version 86.txr-86Kaz Kylheku2014-03-166-6/+89
|
* * stream.c (win_make_cmdline): I think I cracked the code ofKaz Kylheku2014-03-162-1/+16
| | | | | | | | | | | passing escaped arguments to Microsoft's popen and system functions. The first argument cannot be quoted, but the subsequent ones can. It is the quoting of the first argument that causes the whole thing to be quoted. So we just avoid quoting the first argument. (If it has spaces, too bad; don't do that). (open_process): Fix neglected optional argument handling in Windows version of this function.
* * configure: Detect _wspawn* functions.Kaz Kylheku2014-03-163-0/+51
| | | | * stream.c (run): Implement using _wspawnvp on MinGW.
* Document that leading whitespace before a backslash lineKaz Kylheku2014-03-151-2/+15
| | | | continuator is also deleted in string literals.
* * parser.l: Bugfix. When handling a backslash-newline continuationKaz Kylheku2014-03-155-11/+36
| | | | | | | | | | | | | | | | in the SPECIAL, NESTED and BRACED states, do not pop the state in all three, only in SPECIAL (to terminate the @\ continuation). * txr.1: Eliminate wrong claim that string literals do not split across lines, which is directly contradicted two paragraphs later. Document that quasiliterals also split. * genvim.txr (txr_regex, txl_regex): These definitions change from "syn match" to "syn region" so that the backslash-newline continuation can be properly handled. (txr_string, txr_quasilit): Correctly handle split literals. * txr.vim: Regenerated.
* * parser.y (text): Allow the EMPTY token (the @(empty) syntax)Kaz Kylheku2014-03-153-1/+14
| | | | | | to be a text. * txr.1: Documented @(empty).
* * parser.l (regex_parse, lisp_parse): Fix neglected handling ofKaz Kylheku2014-03-143-2/+14
| | | | | | | | optional arguments. This problem can cause the symbol : to be planted as the std_error stream, resulting in an error loop that blows the stack. * regex.c (regex_compile): Likewise.
* * utf8.c (w_fopen, w_popen, w_freopen, w_remove, w_rename): WeKaz Kylheku2014-03-142-0/+26
| | | | | have similar functions in the MSVCRT library used by MinGW, so if _WIN32 is defined, our functions now just wrap those.
* * stream.c (run): Fix MinGW build failures. The run function doesn'tKaz Kylheku2014-03-142-1/+6
| | | | work right with arguments, though: the win command line is broken.
* * eval.c (eval_init): Make seed argument optional in make-random-state.Kaz Kylheku2014-03-144-9/+52
| | | | | | | | | | | | | | | * rand.c (make_random_state): Do argument defaulting on seed. Also, mix getpid() into the seed. (random_fixnum): Bugfix: do proper defaulting on optional agument, rather than relying on nil. (random): Fix 2014-02-05 regression. This was totally broken, ignoring the random state passed in and using the global random state. This function must only use the state passed in; there is no defaulting to the global random state. * txr.1: Documenting that seed is optional in make-random-state. Describing what guarantees can be expected with regard to calls made close together temporally.
* * parser.y: nuke tabs.Kaz Kylheku2014-03-131-9/+9
|
* Implementing @(if)/@(elif)/@(else) in the pattern language.Kaz Kylheku2014-03-136-16/+173
| | | | | | | | | | | | | | | | Input side for now; output later. * parser.y (if_clause, elif_clauses_opt, else_clause_opt): New nonterminals. (IF, ELIF, ELSE): New tokens. (yybadtoken): Handle IF, ELIF, ELSE. * parser.l: Recognize and return new tokens IF, ELIF and ELSE. * txr.1: Documented. * genvim.txr: Updated with if, elsif and else directive keywords. * txr.vim: Regenerated
* * txr.vim: Update.Kaz Kylheku2014-03-131-36/+37
|
* On platforms with sigaltstack, TXR programs can now catch theKaz Kylheku2014-03-135-1/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | segmentation fault that occurs when running out of stack space, and escape by throwing an exception. Also, bugfix: save and restore the gc enable/disable state. Without this, if we are ever running cod in a gc disabled state and it jumps out, gc stays disabled. * configure: added check for sigaltstack. * gc.h (gc_enabled): Declaration added for existing variable. * signal.c (is_cpu_exception): New static function. (sig_handler): For cpu_exception type signals that pertain to the execution of some instruction, turn on async_sig_enabled, so that the signal is not deferred. Otherwise we will just return without calling the user-defined handler, restart the instruction and get into a loop. Also, disable gc around the handler just in case. One issue is that we might be on an alternate stack, which gc won't like. (setup_alt_stack, teardown_alt_stack): New static functions. (set_sig_handler): If we have sigaltstack, and are asked to set up a SEGV handler, then set it up on the alternate stack. * signal.h (extended_jmp_buf): Adding new member, gc. (extended_setjmp, extended_longjmp): use gc member to save and restore the gc_enable state across setjmp and longjmp.
* * stream.c (open_process): If execvp fails, use errno as theKaz Kylheku2014-03-133-5/+118
| | | | | | exit status. (sh, run): New static functions. (stream_init): sh and run registered as intrinsics.
* * lib.c (iffi): Bugfix: was still using incorrect, outdated optionalKaz Kylheku2014-03-122-2/+6
| | | | argument defaulting logic.
* * eval.c (plus_s, prof_s): New symbol global variables.Kaz Kylheku2014-03-1210-60/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (op_prof, me_pprof): New static functions. (eval_init): Intern prof symbol, store in prof_s. Captured interned + symbol in plus_s. Register prof operator and pprof macro. * gc.c (gc_bytes): New global variable. (more): Use nse function chk_malloc_gc_more instead of chk_malloc. (make_obj): Increment gc_bytes. * lib.c (malloc_bytes): New global variable. (chk_malloc, chk_realloc): Increment malloc_bytes. (chk_calloc): Bugfix: incorrect size in recursion into oom_realloc. Incorrect calculation of malloc_high_bound. Increment malloc_bytes. (chk_malloc_gc_more): New function. * lib.h (alloc_bytes_t): New typedef. (malloc_bytes, gc_bytes): Declared. (chk_malloc_gc_more): Declared. * stream.c (format_s): New symbol global. (stream_init): format_s inited. format_s used to register formatv function. * stream.h (format_s): Declared. * txr.1: Documented prof and pprof. * genvim.txr: Recognize reg_fun calls with intern followed by a preceding assignment or other syntax. * txr.vim: Updated.
* * configure: new test for fcntl.Kaz Kylheku2014-03-113-1/+48
| | | | | | | | | | | * stream.c (open_process): Fixed off-by one erroneous value of nargs, causing memory leak of one string. Fixed memory leak on fork failure. Fixed a deadlock that can occur in the pipe close function when multiple pipes are in existence. This is fixed by setting the FD_CLOEXEC flag on the pipe file descriptor. Without this, one child process can hold another's pipe open, causing that other one not to terminate when we're trying to shut it down, resulting in that child blocked on a write, while we block on waitpid.
* * stream.c (open_process): In the event of fdopen failure,Kaz Kylheku2014-03-112-1/+12
| | | | | | kill the child process less abruptly by hitting it with SIGINT and SIGTERM, rather than with SIGKILL. Also, collect the child process with waitpid.
* * eval.c (eval_init): Registration of url_encode and url_decodeKaz Kylheku2014-03-116-82/+282
| | | | | | | | | | | | | | | | moved to filter.c. * filter.c (trie_compress_intrinsic, html_encode, html_decode): New static functions. (filter_init): Register make_trie, trie_add, trie_compress_intrinsic, filter_string_tree, filter_equal, html_encode and html_decode as intrinsics. Move registration of url_encode and url_decode here. * genvim.txr: Look for registrations in filter.c too. * txr.1: Documented. * txr.vim: Updated.
* * stream.c (open_process): Close the original pipe file descriptorKaz Kylheku2014-03-112-0/+10
| | | | | in the child process after dup2-ing it to standard input or standard output, so the child doesn't have to references to the pipe.
* * stream.c (pipe_close): Restructured the function a bit.Kaz Kylheku2014-03-103-22/+51
| | | | | | | | | | Do not throw exceptions for normal process terminations, only for abnormal ones (terminated by a signal). Return the termination status instead of just t. * txr.1: Fixed the neglected documentation of the optional boolean argument of close-stream. Described the behaviors with regard to pipes in more detail.
* * match.c (v_trailer): Fix segfault. The code whichKaz Kylheku2014-03-092-1/+8
| | | | | | helps implement the special interaction between @(accept) and @(trailer) was not handling the situation when there is not current unwind exit point.
* * parser.l: Syntactic tweak. Do not allow the "extra"Kaz Kylheku2014-03-092-2/+10
| | | | | | | constituent chars # or ^ to start the symbol name after an @. Prior to this change @^a is a "meta-symbol" whose name is "^a", but ^a is the ^ quasiquote notation followed by symbol a. After this change @^a is meta, applied to quasiquote-a.
* * lib.c (lazy_sub_str): Bugfix: "from" was mistakenly usedKaz Kylheku2014-03-093-2/+10
| | | | | | | in the adjustment of the "to" value. * match.c (search_form): Use predefined constants for -1 and 1 instead of calling num.
* Fixing broken processing of horizontal matching acrossKaz Kylheku2014-03-092-2/+24
| | | | | | | | | | | | | | long lines produced by @(freeform). Once the matching passes about 4000 characters, the "consume_prefix" function kicks in to save memory. Then any code which is not properly written to handle this displaced situation will break. * match.c (h_text, h_var, h_coll, h_parallel, h_fun): Bugfix. The recursive calls to match_line return an absolute position. From this value we must subtract c->base if we are to compare it with c->pos, or update c->pos. If we use the absolute value, we are abruptly jumping ahead in the data.
* Issue: match_regex and search_regex were continuing to feed charactersKaz Kylheku2014-03-092-20/+65
| | | | | | | | | | | | | | | | | | | | to the regex machine even when there is no transition available. This was due to the broken return value protocol of regex_machine_feed. For instance for the regex / +/ (one or more spaces), after matching some spaces, it would report REGM_INCOMPLETE for additional non-space characters, never reporting REGM_FAIL. * regex.c (regm_result_t): Block comment added, documenting protocol. (regex_machine_feed): Return REGM_FAIL if there are no transitions for the given character, even a partial match has been recorded. This is a signal to stop feeding more characters. At that point, the function can be called with a null character to distinguish the three cases: fail, partial or full match. (search_regex): Now when the search loop gets a REGM_FAIL, it can no longer assume that nothing was matched and the search must restart at the next position. Upon the REGM_FAIL signal, it is necesary to seal the search by feeding in the 0 character. Only if that returns REGM_FAIL is it a no match situation. Otherwise it is actually a match!
* Version 85.txr-85Kaz Kylheku2014-03-085-4/+30
|
* * genvim.txr: Handle variable definition without embedded intern.Kaz Kylheku2014-03-081-0/+3
|
* * txr.1: Added missing documentation for @(forget)/@(local).Kaz Kylheku2014-03-082-0/+77
|
* * rand.c (rand_init): Oops! Spectacular silliness hereKaz Kylheku2014-03-082-3/+10
| | | | | | | broke the symbol module: two intern calls in consecutive lines, one for the name without "earmuffs", one with, leading to the situation that the C code looks for a dynamic variable that does not exist.
* * match.c (LOG_MATCH, LOG_MISMATCH): Wouldn't you know it;Kaz Kylheku2014-03-072-2/+11
| | | | | | | | the format strings in these macros contained a workaround for the broken * variable field width syntax, specifying ~*~a where the extra ~ in the middle just feeds a character that the broken state machine expects. These workarounds broke when I fixed the formatting, making -v mode useless.
* Version 84.txr-84Kaz Kylheku2014-03-076-17/+83
|
* * lib.c (upop): New function.Kaz Kylheku2014-03-074-8/+31
| | | | | | | | | | | | | | * lib.h (upop): Declared. * txr.c (txr_main): Two bugfixes. One is that the argument - was being pushed back twice resulting in *args* being ("-" "-"). This is because the option processing loop checked for "-" and pushed it back into args, and then some logic after the loop pushed arg back into args again. But, these pushes were wrong because they push back a different cons cell; we would like to be able to do (ldiff *full-args* *args*). This is solved by upop, which provides one element of undo. After upop, we can restore the prior list from the undo save location.
* * lib.c (assert_s): New global variable.Kaz Kylheku2014-03-066-11/+148
| | | | | | | | | | | | | | | (obj_init): Intern assert symbol, store in assert_s. * lib.h (assert_s): Declared. * match.c (typed_error, v_assert, h_assert): New static functions. (dir_tables_init): Register v_assert and h_assert. Register assert_s as non-data-matching directive. * unwind.c (uw_init): Register assert as a subtype of error. * txr.1: Describe assert.
* * match.c: (v_next): Set the "curfile" in the context to "env" whenKaz Kylheku2014-03-062-1/+9
| | | | | | scanning environment. (open_data_source): Regression: was not setting c->curfile when opening anything.