| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* eval.c (eval_init): expo registered as intrinsic exp.
* lib.h (expo): Declared.
* txr.1: Added to stub heading.
* txr.vim: Highlighting for exp.
|
| |
| |
| |
| |
| | |
Not all numbers are integers now, and that situation
requires an integer.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
with no decimal point like 1E1.
* stream.c: (vformat): Keep track of whether or not precision was
given in precision_p local variable.
When printing #<bad-float> pass a precision of 0
to vformat_str, not precision, since precision does not apply.
In ~f and ~e, if the precision was not given, default
it to 3.
Restructured float printing in ~a and ~s. It now just uses sprintf's %g
with a precision. If user does not specify precision, it defaults
to DBL_DIG to print the number with reasonable accuracy.
A .0 is added if it sprintf produces an integer, and the conversion
is ~s rather than ~a.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
for the integer square root.
* arith.c (sqroot_fixnum): Renamed back to isqrt_fixnum.
(sqroot): Rewritten to handle only floating-point square root.
(isqrt): New function, based on previous sqroot,
handles only integers.
* eval.c (eval_init): New intrinsic, isqrt.
* lib.h (isqrt): New declaration.
* txr.1: Doc stubs.
* txr.vim: Highlighting for isqrt.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* eval.c (eval_init): New intrinsic functions registered:
floor, ceil, sin, cons, atan, log.
* lib.h (floorf, ceili, sine, cosi, atang, loga): Declared.
* txr.1: Doc stub section for new functions.
* txr.vim: Highighting added.
|
| |
| |
| |
| |
| |
| |
| |
| | |
that doesn't begin with a digit, it's most likely NaN or Inf.
We can turn that into an exception.
* stream.c (vformat): If sprintf produces a non-number,
turn it into the printed representation #<bad-float>.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
(divi): Uses to_float.
(zerop, gt, lt, ge, le, expt): Floating support.
(isqrt_fixnum): Static function renamed to sqroot_fixnum.
(isqrt): Renamed to sqroot. Floating support.
(evenp, oddp, exptmod, gcd): Work with integers, not floats.
* eval.c (eval_init): intrinsic registration of sqrt follows rename of
isqrt to sqroot.
* lib.h (isqrt): Declaration replaced.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* eval.c (eval_init): divi registered as / intrinsic.
* lib.h (divi): Declared.
* txr.1: divi added to stub heading.
* txr.vim: / operator highlighted.
|
| | |
|
| | |
|
| |
| |
| |
| | |
which are already implied by the switch case.
|
| |
| |
| |
| |
| |
| | |
float-str, int-flo and flo-int.
* txr.vim: Highlighting for new functions.
|
| |
| |
| |
| |
| | |
* arith.c (plus, minus): Eliminated some unnecessary (double) casts.
(abso, mul): Floating support.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* parser.l: FLO and FLODOT cases had to be reordered because
the lex trailing context counts as part of the match length,
causing 3.0 to be matched as three characters with 0 as
the trailing context. The cases are split up to eliminate
a flex warning.
* stream.c (vformat): Support bignum in floating point
conversion. Bugfixes: floating point conversion was
accessing obj->fl.n instead of using n.
Changed some if/else ladders to switches.
|
| |
| |
| |
| |
| |
| |
| |
| | |
(minus): Floating point support.
* mpi-patches/mpi-to-double (mp_to_double): Re-apply lost
bugfix: index incremented instead of decremented.
Didn't refresh patch last time, then did a make distclean.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* parser.l (SGN, EXP, DIG): New regex definitions.
(FLO): Do not recognize numbers of the form 123.
Decimal point must be followed either by exponent, or digits
(which may then be followed by an exponent).
(FLODOT): New token type, recognizes 123.
(grammar): Recognize FLODOT as a floating point number,
only if it not trailed by another dot, and
recognize FLO unconditionally.
|
| |
| |
| |
| | |
and float-bignum cases.
|
| |
| |
| |
| | |
overrun. IEEE double floats can go to e+-308.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* eval.c (eval_init): flo-int registered as intrinsic.
* lib.h (flo_int): Declared.
* mpi-patches/series: Added mpi-to-double to patch stack.
(mp_to_double): New MPI function.
* mpi-patches/mpi-to-double: New file.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
result is in the fixnum range.
Implemented FLNUM cases, except for adding a FLNUM
to BGNUM.
(minus, mul): Use num_fast when the cnum value is in the fixnum range.
(int_flo): New function.
* eval.c (eval_init): Register int-flo intrinsic.
* lib.c (c_flo): New function.
* lib.h (TYPE_SHIFT, TYPE_PAIR): New macros, carried over
from the lazy strings branch.
(c_flo, int_flo): Declared.
|
| |
| |
| |
| | |
to allow leading or trailing decimal.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
are now printing floating point numbers into it, letting
the C library handle precision which can generate many digits.
We cap the precision at at 128. New format specifiers ~e
and ~f implemented, which loosely correspond to those of printf.
The ~s and ~a directives handle floats similarly to ~g in
printf, except that they ensure that a decimal point is printed
for the non-exponential notation.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
version of intptr_t is available and should be generated in config.h
as uintptr_t.
* eval.c (eval_init): New intrinsic functions floatp,
integerp, flo-str.
* gc.c (finalize): Handle FLNUM case. Rearranged
cases so that all trivially returning cases are
together.
(mark): Handle FLNUM case.
* hash.c (hash_double): New function.
(equal_hash): Handle FLNUM via hash_double.
(eql_hash): Likewise.
* lib.c: <math.h> is included.
(float_s): New symbol variable.
(code2type, equal): Handle FLNUM case in switch.
(integerp): New function; does the same thing
as integerp before.
(numberp): Returns t for floats.
(flo, floatp, flo_str): New functions.
(obj_init): Initialize new float_s variable.
(obj_print, obj_pprint): Handle FLNUM case in switch.
Printing does not work yet; needs work in stream.c.
* lib.h (enum type): New enumeration FLNUM.
(struct flonum): New struct type.
(union obj): New member, fl.
(float_s, flo, floatp, integerp, flo_str): Declared.
* parser.l (FLO): New token pattern definition.
Scans to a NUMBER token.
Corrected uses of yylval.num to yylval.val.
* parser.y (%union): Removed num member from yystype.
|
|/
|
|
|
|
|
| |
the module file name, not only the line number. Breakpoints work on
source locations rather than line numbers. Boy, this was easy.
Keep the breakpoint list free of duplicates. Issue a message
if a nonexistent breakpoint is asked to be deleted.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
so we make the second one optional.
* filter.c (topercent_k, frompercent_k): New keyword
variables.
(url_encode, url_decode): Take a second parameter, space_plus.
This determines whether or not to apply the rule that
a space encodes as a + character.
(filter_init): Initialize new keyword variables, and register :topercent
and :frompercent filters. Fix the previous registrations of :tourl and
:fromurl using currying.
* filter.h (urlencode, urldecode): Declarations updated.
(topercent_k, frompercent_k): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
simpler. A pseudo type code is introduced called NIL with value 0.
* lib.h (enum type): New enumeration value, NIL.
(type): Function accepts object nil and maps it to code NIL.
* eval.c (dwim_loc, op_dwim): test for nil obj and goto hack is gone,
just handle NIL in the switch.
* gc.c (make_obj, mark): Handle new NIL type code in switch.
* hash.c (equal_hash): Handle NIL in the switch instead of nil test.
* lib.c (code2type): Map new NIL type code to null.
(typeof, typecheck): Code simplified.
(class_check, car): Move nil test into switch.
(eql, equal, consp, bignump, stringp, lazy_stringp,
symbolp, functionp, vectorp, cobjp): Simplified.
(length, sub, ref, refset, replace, obj_print, obj_pprint): Handle NIL
in switch instead of nil test. goto hack removed from refset.
* match.c (do_match_line, do_output_line): switch condition simplified.
* regex.c (regexp): Simplified.
(regex_nfa): Assert condition simplified.
|
|
|
|
|
| |
(html_hex_continue): Use digit_value instead of hex digits string
literal.
|
|
|
|
|
|
| |
function, if any, is treated as variadic. Subsequent
functions are monadic.
(chain, chainv): Turn do_chain into variadic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
chain, andf, orf, iff.
* lib.c (chainv): New function.
(do_and, do_or): Generalized to handle functions of
any arguments via apply.
(andf, orf): Turn do_and and do_or into variadic function instead of a
monadic function.
(do_iff): New static function.
(andv, orv, iff): New functions.
* lib.h (chainv, andv, orv, iff): New functions declared.
* txr.1: Doc stubs created.
* txr.vim: Updated.
|
| |
|
|
|
|
| |
leading to unbounded recursion.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* txr.c (version): Bumped.
* txr.1: Bumped version and set date.
* configure (txr_ver): Bumped.
* eval.c (op_modplace): Fix warning about uninitialized variable.
No bug.
* filter.c: gcc compilation regresion: missing <stdio.h> breaks inclusion
of "stream.h" header. Strangely, didn't show up when configured for
compiling with g++ on Ubuntu.
* match.c (match_filter): Fixed ununsed variable warning.
* txr.vim: Bunch of missing keywords added.
* dep.mk: Regenerated.
|
|
|
|
|
|
|
|
| |
* tests/010/block.txr: New file.
* tests/010/reghash.expected: New file.
* tests/010/reghash.txr: New file.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
quasiquoting. We cannot use the same symbol for the
literal form from the parser, and for the expanded form,
because this creates a confusion when there are multiple
nestings of quasiquote expansion.
* eval.c (vector_lit_s, vector_list_s, hash_lit_s): New symbol
variables.
(hash_construct_s): Relocated here from hash.c.
(expand_qquote): Part of bugfix: look for hash_lit_s
instead of has_construct_s. Translate to a hash_construct_s
form which is no longer recognizes as a hash literal.
Implementing recognition of a quasiquote vector literal,
handled similarly.
(eval_init): Initialize vector_lit_s, vector_list_s,
hash_list_s and hash_lit_s.
Use vector_list_s when registering vector_list function.
* eval.h (vector_lit_s, vector_list_s, hash_lit_s,
hash_constuct_s): Declared.
* hash.c (hash_construct_s): Variable removed
and relocated into eval.c.
(hash_init): Initialization of hash_construct_s removed.
* hash.h (hash_construct_s): Declaration removed.
* parser.y: (vector): Action updated to generate
a (vec-lit ...) form if the object contains unquotes,
otherwise generate a vector object.
(hash): Generate hash-lit form, not a
hash-construct form.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to express dynamic hash table construction
* eval.c (expand_qquote): Recognize hash-construct
forms: expand the hash arguments and pairs separately,
then rewrite to a new hash-construct form.
(eval-init): hash-construct intrinsic function added.
* hash.c (hash_construct_s): New symbol variable.
(hash_construct): New function.
(hash_init): Initialize hash_construct_s.
* hash.h (hash_construct_s, hash_construct): Declared.
* parser.y (hash): Rule rewritten to emit either a literal
hash table object, or a hash-construct form, based on
whether quasiquote unquotes occur within the syntax.
(hash_from_notation): Function removed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (print_key_val, hash_print_op): New static functions.
(hash_ops): hash_print_op wired in in place of cobj_print_op.
* parser.l (HASH_H): New token recognized.
* parser.y (HASH_H): New terminal symbol.
(hash): New nonterminal symbol.
(expr): Acquires hash as a constituent.
(hash_from_notation): New static function.
* txr.1: Hash syntax described.
* txr.vim: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Blocks no longer extend to the end of the surrounding
scope.
* match.c (v_block): Rewrite for new syntax.
* parser.l (BLOCK): New token type handled.
* parser.y (BLOCK): New token.
(block_clause): New nonterminal grammar symbol.
(clause): Collateral fix: replaced a bunch of
list(X, nao) forms with cons(X, nil).
Introduced block_clause as a constituent of clause.
* txr.1: Revamped documentation of block, and
wrote about using blocks for reducing nested
skips and reducing backtracking in general.
|
|
|
|
|
|
| |
for the current way in which an identifier token is recognized.
As a result @(collect-ing) was being interpreted as @(collect -ing).
It should be the complement of NSCHR.
|
|
|
|
|
|
| |
can now be a function of one argument which maps
the original piece of text matched by the regex
to a replacement text.
|
| |
|
|
|
|
|
|
| |
consider data sent to std_error to be output for the purposes of
the output_produced flag. Otherwise the program behavior changes
in -v mode; it will not print bindings.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): New intrinsic functions: url-encode, url-decode.
* filter.c (tourl_k, fromurl_k): New keyword variables.
(is_url_reserved, digit_value): New static functions.
(url_encode, url_decode): New functions.
(filter_init): Intialize new keyword variables and register
new :tourl and :fromurl filters.
* filter.h (tourl_k, fromurl_k, url_encode, url_decode): Declared.
* txr.1: Updated.
* txr.vim: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
function. This must not flush out more than one character out of this
small buffer, except when we are flushing out the last data.
The correct operation is predicated on the assumption that
a complete character can be pulled out. That's why we move the
buffer to the front after consuming it, and do not automatically
flush until there are four bytes.
(string_out_put_string): We loop the call to string_out_byte_flush
here because when a request comes in to write a Unicode character,
we flush all the bytes, even if the tail of those bytes forms
an incomplete sequence that turns into U+DCxx codes.
(get_string_from_stream): Use the same loop termination test
as in string_out_put_string, for consistency. In that function
it is needed to prevent infinite looping in the case when
the string_out_put_string is being called from string_out_byte_flush
and is thus re-entering it.
* tests/010/strstream.expected: New file.
* tests/010/strstream.txr: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This does the Right Thing with a mixture of bytes and characters.
Incomplete byte sequences.
* stream.c (struct strm_ops): Changing byte argument of put_byte
to int, since the put_byte API function can just pass down that
value after validating it.
(stdio_handle): Use available typedef.
(stdio_put_byte): Follow interface change in strm_ops.
Do not validate the range of a byte; the put_byte higher
level function does that now.
(struct string_output): New members: ud, byte_buf, head, tail.
(string_out_byte_callback, string_out_byte_flush): New static
functions.
(string_out_put_string): Flush any UTF-8 bytes in the byte buffer
before putting the string.
(string_out_put_byte): New static function, implementation for
put_byte on string output streams.
(string_out_ops): string_out_put_byte wired in.
(make_string_output_stream): Initialize new members of
of struct string_output.
(get_string_from_stream): Flush any UTF-8 bytes in the byte buffer
before retrieving the string.
(put_byte): Validate that the byte is in range. Pass byte
as C int down to the put_byte virtual.
|
|
|
|
|
| |
* stream.c (byte_in_stream_destroy): New function.
(byte_in_ops): Use new function instead of noop stub.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (cons_find): New function.
(expand_op): Use cons_find rather than tree_find to look for
rest_gensym.
* regex.c (regsub): Rearranged arguments so that the string
is last. This is better for partial evaluaton via the op
operator.
* regex.h (regsub): Updated declaration.
|