Commit Graph

78 Commits (master)

Author SHA1 Message Date
Bart Schaefer 6c50d15562 52597: fix character counts in context of operator and operand errors 3 months ago
Bart Schaefer 1f861ceba1 52492: prevent indexing error on recursive arithmetic in array subscript
Operator returns error when operand returns error
4 months ago
Bart Schaefer 4345eed1fe 51887: namespaces recognized in math, incorrect usages rejected. 11 months ago
Oliver Kiddle a73c705b0c 51212: remove STOUC() macro
This served as a workaround for ancient compilers where casts to
unsigned char were broken.
1 year ago
Oliver Kiddle b3519a9603 49611 based on 49590 (Martijn Dekker): disable Inf and NaN in math expressions for sh emulation 3 years ago
Dimitris Apostolou 356dcb20ce github #82: Fix typos 3 years ago
Vincent Lefevre 4fa4dcad17 48723: locale-safe recognition of "Inf" and "NaN" constants in math 3 years ago
Jun-ichi Takimoto 0f62e07c80 48389: getkeystring() should not return ptr to local var
Now it returns NULL if called with GETKEY_SINGLE_CHAR and next character
is not found. Caller must check the return value.
3 years ago
Peter Stephenson af1c009c3e 46079: Ignore double quotes in math expressions.
Treat as white space.

This is required for compatibility and previously had no use in zsh
as it generated an error.
4 years ago
Daniel Shahaf 581585dfc6 45343: Queue signals around arithmetic evaluations
The queueing added in execarith() in 45083 is reverted since the callee
does this now.
4 years ago
Martijn Dekker 4215fcb107 43944: apply NO_UNSET consistently to arithmeitc 5 years ago
Peter Stephenson 225b35c907 43261: Fix unary minus with base.
Apply unary minus to a complete lexical constant rather than the
first component that comes along.
6 years ago
Jun-ichi Takimoto baedd62f0d 43219 (except term{cap,info}.c): fix several memory leaks 6 years ago
Oliver Kiddle a93abe1170 42488: test cases for 42369 and address some issues in the code 6 years ago
Oliver Kiddle 373efa085d Nelson H. F. Beebe: 19597 (rebased 42369): return Inf, NaN etc from floating point operations instead of errors to allow non-stop IEEE 754 arithmetic 6 years ago
Peter Stephenson ea5b38935a 41641: Some math operations shouldn't be lvalues.
This includes pre- and post- increment and decrement.  Simply
mark all values after operations as rvalues.
7 years ago
Peter Stephenson f3f8537cfa 40760: Always tokenize unquoted - to Dash.
This fixes use of pattern match character ranges in unusual contexts.

Attempt to detect a tokenized - in cases where we don't care.
7 years ago
Peter Stephenson 47c05f6b66 40622 with typos fixed: functions -Ms.
This adds the capability for mathematical functions based on shell
functions to have a string argument.  Module functions have had
this for a long time.
7 years ago
Peter Stephenson de9effbce6 37018: Make WARNCREATEGLOBAL more consistent.
Wd don't need separate math handling any more, and can make it
output the function name in all cases.
9 years ago
Barton E. Schaefer b970ef6ef5 unposted: strdup should be ztrdup 9 years ago
Daniel Shahaf 2654cb43f6 36651: WARN_CREATE_GLOBAL += math expressions
Without this, '() { (( x=42 )) }' and '() { for (( i=0; … )) }' wouldn't warn
about $x and $i, respectively, being created global.
9 years ago
Peter Stephenson 099e717c15 35359: Improved math parsing and errors.
Check for bogus trailing ")" at end of top-level parse.

Extend some math error messages to indicate they are math errors.
9 years ago
Peter Stephenson 493fe2b444 unposted: rewrite Nularg math handling to be like other cases 9 years ago
Peter Stephenson 2ef4b38461 34892 (slightly tweaked): math evaluation fix
An empty expression resulting from substitution includes a
Nularg, which needs handling the same as an empty string.
9 years ago
Peter Stephenson 3a99ef322d 34280: more widespread use of FORCE_FLOAT.
Add the case of variables read for use in arithmetic expressions.
9 years ago
Peter Stephenson 5f4325a0a4 Propagate float/integer type in arithmetic assignment.
Add test.

Mention this and also floating point mod change in README.
9 years ago
Barton E. Schaefer 39a6e8a7f5 34230: call fmod() for modulo with floats 9 years ago
Peter Stephenson a8927bf27b 33793: add 0b binary interpretation to integer constants 10 years ago
Peter Stephenson 22b8fd6da9 32299: add use of underscores on arithmetic output for spacing 10 years ago
Peter Stephenson 4c611f9323 31982: detection of floating point constants was problematic.
Remove the cause and fix the original problem with floating point
numbers with leading zeros (users/17445) a different way.
11 years ago
Peter Stephenson f77a7a5b18 31937: zle -Fw uses widget semantics for file descriptor handler 11 years ago
Bart Schaefer f4b0833270 31353: fix handling of floating point in ternary 11 years ago
Mikael Magnusson 1d3d92a0c9 31140: avoid crash when hitting recursion limit 11 years ago
Peter Stephenson 3def943d04 users/17665: add FORCE_FLOAT option 11 years ago
Bart Schaefer 431c22024d users/17445: fix handling of leading zeroes in floating point 12 years ago
Peter Stephenson e550c98d69 30647, 30649: allow underscores in numeric constants 12 years ago
Peter Stephenson 361e171672 30656: prevent SIGFPE in division by -1 by multiplying instead 12 years ago
Peter Stephenson 962624e8c3 29491: remove some variables set but not used 13 years ago
Mikael Magnusson bd2d0636d2 29329: fix undefined behaviour in math.c 13 years ago
Mikael Magnusson 72cb7cfc6f 29307, 29308 + replies: Fix some doubled words in docs and comments. 13 years ago
Peter Stephenson e6f14352d6 28037: improved error messages for module autoloads
of math functions and builtins
14 years ago
Peter Stephenson f02778f83c 27611: cache parameter values in math eval so subscripts are eval'd once 15 years ago
Peter Stephenson 3c248a0de4 25905: fix and test doubled-hash radix output 16 years ago
Peter Stephenson b2d08a2155 25744: dynamic named directories and further doshfunc() simplification 16 years ago
Peter Stephenson 2920c227d3 25677: add %x and %I prompt escapes for shell source code debugging
tidy up interface to doshfunc()
16 years ago
Peter Stephenson 8a4af211c3 25149: add C_PRECEDENCES option to make arithmetic have C/Perl precedence 16 years ago
Peter Stephenson 1c29f641c6 Mikael: 25143: spelling corrections
25144: report supported bases
25139: fix number
16 years ago
Peter Stephenson b86c191af5 25025: check radix for integer constants is between 2 and 36 inclusive 16 years ago
Peter Stephenson c2c50bd0a0 23553: bit missed out 17 years ago
Peter Stephenson 2c92d005d7 23165: fix problems with bases: error if over 36 and don't interpret octal 18 years ago