mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.11.0t9.1
This commit is contained in:
44
BUGS
44
BUGS
@@ -68,32 +68,6 @@ importantly, fixes (in the form of a context diff patch) to:
|
|||||||
|
|
||||||
Known bugs:
|
Known bugs:
|
||||||
|
|
||||||
None. :-)
|
|
||||||
|
|
||||||
We are sure some more bugs exist. When you find them, please let
|
|
||||||
us know! See the above for details on how to report and were to
|
|
||||||
EMail your bug reports and hopefully patches to fix them.
|
|
||||||
|
|
||||||
=-=
|
|
||||||
|
|
||||||
Calc Mis-features:
|
|
||||||
|
|
||||||
* The following shell command (written in sh,ksh,bash-like form) works:
|
|
||||||
|
|
||||||
calc '/*
|
|
||||||
* comment
|
|
||||||
*/
|
|
||||||
print 2+3;'
|
|
||||||
|
|
||||||
However this (also written in sh,ksh,bash-like form) does not work:
|
|
||||||
|
|
||||||
echo '/*
|
|
||||||
* comment
|
|
||||||
*/
|
|
||||||
print 2+3;' | calc
|
|
||||||
|
|
||||||
The 2nd example will result in an 'Unterminated comment' error.
|
|
||||||
|
|
||||||
* Calc does not support the #! exec method. For example of the
|
* Calc does not support the #! exec method. For example of the
|
||||||
following is placed in an executable file (assume the path to
|
following is placed in an executable file (assume the path to
|
||||||
calc is correct) called /tmp/xyzzy:
|
calc is correct) called /tmp/xyzzy:
|
||||||
@@ -107,3 +81,21 @@ Calc Mis-features:
|
|||||||
Will result in '"tmp" is undefined' and '"xyzzy" is undefined'
|
Will result in '"tmp" is undefined' and '"xyzzy" is undefined'
|
||||||
error messages because calc considers $0 as an expression to
|
error messages because calc considers $0 as an expression to
|
||||||
evaluate.
|
evaluate.
|
||||||
|
|
||||||
|
* The following file:
|
||||||
|
|
||||||
|
/* this is bugdemo.cal */
|
||||||
|
x = eval(prompt(">>> "));
|
||||||
|
print x;
|
||||||
|
|
||||||
|
when executed as:
|
||||||
|
|
||||||
|
calc read bugdemo.cal
|
||||||
|
|
||||||
|
will obtain a prompt from the terminal, print the value but leave
|
||||||
|
the terminal in a 'bad' state, as if stty -icanon -echo -echoe
|
||||||
|
had been executed.
|
||||||
|
|
||||||
|
We are sure some more bugs exist. When you find them, please let
|
||||||
|
us know! See the above for details on how to report and were to
|
||||||
|
EMail your bug reports and hopefully patches to fix them.
|
||||||
|
39
CHANGES
39
CHANGES
@@ -25,6 +25,45 @@ Following is the change from calc version 2.11.0t8.9.1 to date:
|
|||||||
run in non-interactively / without a TTY such as under Debian's
|
run in non-interactively / without a TTY such as under Debian's
|
||||||
build daemon.
|
build daemon.
|
||||||
|
|
||||||
|
The eval(str) builtin will return an error-value rather than cause
|
||||||
|
an execution error str has a scan-error.
|
||||||
|
|
||||||
|
Declaration are permitted to end with EOF as well as a newline or ';'.
|
||||||
|
|
||||||
|
When prompt() occurs in reading a file, it will take inout from
|
||||||
|
the terminal rather than taking it from a file. For example,
|
||||||
|
this script, when read, now works:
|
||||||
|
|
||||||
|
/* This demonstrates the use of prompt() and some other things */
|
||||||
|
config("verbose_quit", 0);
|
||||||
|
define getnumber() {
|
||||||
|
local x;
|
||||||
|
for (;;) {
|
||||||
|
x = eval(prompt(">>> "));
|
||||||
|
if (isnum(x))
|
||||||
|
return x;
|
||||||
|
print "Not a number! Try again";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "This will display the sqrt of each number you enter";
|
||||||
|
print "Enter quit to stop";
|
||||||
|
for (;;) {
|
||||||
|
print sqrt(getnumber());
|
||||||
|
}
|
||||||
|
print "Good bye";
|
||||||
|
|
||||||
|
Comments entered at inputisterminal level may be spread over several
|
||||||
|
lines. For example:
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These commands work given the file: comment.cal
|
||||||
|
*
|
||||||
|
* cat comment.cal | calc
|
||||||
|
* calc < comment.cal
|
||||||
|
*/
|
||||||
|
print "Hello";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Following is the change from calc version 2.11.0t8 to 2.11.0t8.9:
|
Following is the change from calc version 2.11.0t8 to 2.11.0t8.9:
|
||||||
|
|
||||||
|
@@ -409,6 +409,7 @@ getdeclarations(int symtype)
|
|||||||
case T_NEWLINE:
|
case T_NEWLINE:
|
||||||
case T_SEMICOLON:
|
case T_SEMICOLON:
|
||||||
case T_RIGHTBRACE:
|
case T_RIGHTBRACE:
|
||||||
|
case T_EOF:
|
||||||
rescantoken();
|
rescantoken();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
13
func.c
13
func.c
@@ -155,6 +155,7 @@ f_eval(VALUE *vp)
|
|||||||
VALUE result;
|
VALUE result;
|
||||||
char *str;
|
char *str;
|
||||||
long num;
|
long num;
|
||||||
|
int temp;
|
||||||
|
|
||||||
if (vp->v_type != V_STR)
|
if (vp->v_type != V_STR)
|
||||||
return error_value(E_EVAL2);
|
return error_value(E_EVAL2);
|
||||||
@@ -168,7 +169,10 @@ f_eval(VALUE *vp)
|
|||||||
}
|
}
|
||||||
oldfunc = curfunc;
|
oldfunc = curfunc;
|
||||||
enterfilescope();
|
enterfilescope();
|
||||||
|
temp = stoponerror;
|
||||||
|
stoponerror = -1;
|
||||||
if (evaluate(TRUE)) {
|
if (evaluate(TRUE)) {
|
||||||
|
stoponerror = temp;
|
||||||
closeinput();
|
closeinput();
|
||||||
exitfilescope();
|
exitfilescope();
|
||||||
freevalue(stack--);
|
freevalue(stack--);
|
||||||
@@ -181,6 +185,7 @@ f_eval(VALUE *vp)
|
|||||||
free(newfunc);
|
free(newfunc);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
stoponerror = temp;
|
||||||
closeinput();
|
closeinput();
|
||||||
exitfilescope();
|
exitfilescope();
|
||||||
newfunc = curfunc;
|
newfunc = curfunc;
|
||||||
@@ -203,11 +208,11 @@ f_prompt(VALUE *vp)
|
|||||||
unsigned int len;
|
unsigned int len;
|
||||||
|
|
||||||
result.v_type = V_STR;
|
result.v_type = V_STR;
|
||||||
if (inputisterminal()) {
|
openterminal();
|
||||||
printvalue(vp, PRINT_SHORT);
|
printvalue(vp, PRINT_SHORT);
|
||||||
math_flush();
|
math_flush();
|
||||||
}
|
|
||||||
cp = nextline();
|
cp = nextline();
|
||||||
|
closeinput();
|
||||||
if (cp == NULL) {
|
if (cp == NULL) {
|
||||||
math_error("End of file while prompting");
|
math_error("End of file while prompting");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
@@ -3128,8 +3128,7 @@ o_quit(FUNC *fp, long index)
|
|||||||
s = findstring(index);
|
s = findstring(index);
|
||||||
cp = s->s_str;
|
cp = s->s_str;
|
||||||
}
|
}
|
||||||
if (inputisterminal() && (fp->f_name[0] == '*')
|
if (inputisterminal() && !strcmp(fp->f_name, "*")) {
|
||||||
&& (fp->f_name[1] == '\0')) {
|
|
||||||
if (cp)
|
if (cp)
|
||||||
printf("%s\n", cp);
|
printf("%s\n", cp);
|
||||||
hist_term();
|
hist_term();
|
||||||
@@ -3144,7 +3143,7 @@ o_quit(FUNC *fp, long index)
|
|||||||
printf("%s\n", cp);
|
printf("%s\n", cp);
|
||||||
else if (conf->verbose_quit)
|
else if (conf->verbose_quit)
|
||||||
printf("Quit or abort executed\n");
|
printf("Quit or abort executed\n");
|
||||||
if (!inputisterminal() && fp->f_name[0] == '*')
|
if (!inputisterminal() && !strcmp(fp->f_name, "*"))
|
||||||
closeinput();
|
closeinput();
|
||||||
go = FALSE;
|
go = FALSE;
|
||||||
}
|
}
|
||||||
|
14
token.c
14
token.c
@@ -335,22 +335,22 @@ static void
|
|||||||
eatcomment(void)
|
eatcomment(void)
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
setprompt(conf->prompt2);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ch = nextchar();
|
ch = nextchar();
|
||||||
if (ch == '*') {
|
if (ch == '*') {
|
||||||
ch = nextchar();
|
ch = nextchar();
|
||||||
if (ch == '/')
|
if (ch == '/')
|
||||||
return;
|
break;
|
||||||
reread();
|
reread();
|
||||||
}
|
}
|
||||||
if ((ch == EOF) || (ch == '\0') ||
|
if (ch == EOF || ch == '\0') {
|
||||||
(newlines && (ch == '\n') && inputisterminal())) {
|
fprintf(stderr, "Unterminated comment ignored\n");
|
||||||
reread();
|
reread();
|
||||||
scanerror(T_NULL, "Unterminated comment");
|
break;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setprompt(conf->prompt1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
#define MAJOR_VER 2 /* major version */
|
#define MAJOR_VER 2 /* major version */
|
||||||
#define MINOR_VER 11 /* minor version */
|
#define MINOR_VER 11 /* minor version */
|
||||||
#define MAJOR_PATCH 0 /* patch level or 0 if no patch */
|
#define MAJOR_PATCH 0 /* patch level or 0 if no patch */
|
||||||
#define MINOR_PATCH "9" /* test number or empty string if no patch */
|
#define MINOR_PATCH "9.1" /* test number or empty string if no patch */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* calc version constants
|
* calc version constants
|
||||||
|
Reference in New Issue
Block a user