/usr/share/calc/help/eval is in apcalc-common 2.12.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | NAME
eval - evaluate a string
SYNOPSIS
eval(str)
TYPES
str string
return any
DESCRIPTION
For eval(str), the value of str is to be a string that could be the body
of the definition of a function f(). This string may declare local
variables and include keywords (while, for, ...) other than the
reserved keywords (define, show, help, read, write, show, cd) intended
for interactive use or for reading from a file.
If str is the empty string "", eval(str) returns the null value.
The call to eval(str) may return a value by explicit use of a return
statement: "return;" returns the null value, "return expr;" returns the
value of expr. If execution reaches the end of str and the
value on the execution stack is not null, eval(str) returns that value;
otherwise eval(str) returns the most recently saved value.
Each time eval(str) is called, a temporary function is compiled from
the commands in str, and if there are no syntax errors, this function
is then evaluated. If str contains syntax errors, eval(str) displays
the scanerror messages and returns the value error(49).
EXAMPLE
; str1 = "2 + 3"; print eval(str1);
5
; i = 10; str2 = "local i = 0; 7; while (i++ < 5) print i^2,:;"
; print i, eval(str2), i
10 1 4 9 16 25 7 10
(The print statements in str2 return the null value, so execution of
eval(str2) ends by returning the saved value 7. The global variable
i is unchanged.)
; eval("2 + ");
Missing expression
49
LIMITS
The string str in eval(str) should not include a call to itself as in
str = "2 + eval(str)"
For this str, eval(str) causes an "Evaluation stack depth exceeded" error.
Similarly, if str1 = "2 + eval(str2)", str2 should not include a call
to eval(str1), etc.
LINK LIBRARY
none
SEE ALSO
command, expression, define, prompt
## Copyright (C) 1999 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License
## as published by the Free Software Foundation.
##
## Calc is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
## Public License for more details.
##
## A copy of version 2.1 of the GNU Lesser General Public License is
## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## @(#) $Revision: 30.1 $
## @(#) $Id: eval,v 30.1 2007/03/16 11:10:42 chongo Exp $
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/eval,v $
##
## Under source code control: 1995/12/18 03:30:59
## File existed as early as: 1995
##
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|