mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.11.0t7.1
This commit is contained in:
7
CHANGES
7
CHANGES
@@ -96,6 +96,13 @@ Following is the change from calc version 2.11.0t7 to date:
|
|||||||
|
|
||||||
A call of errmax(-1) will prevent errcount from aborting calc.
|
A call of errmax(-1) will prevent errcount from aborting calc.
|
||||||
|
|
||||||
|
Add the function stoponerror(n) which, as the name implies, controls
|
||||||
|
if calc stop on an error based on the value of n:
|
||||||
|
|
||||||
|
n > 0 stop on error even if -c was given on the command line
|
||||||
|
n == 0 if -c, continue, without -c, stop
|
||||||
|
n < 0 continue on error, even if -c was given on the command line
|
||||||
|
|
||||||
|
|
||||||
Following is the change from calc version 2.11.0t1 to 2.11.0t6.3:
|
Following is the change from calc version 2.11.0t1 to 2.11.0t6.3:
|
||||||
|
|
||||||
|
30
calc.c
30
calc.c
@@ -50,6 +50,7 @@ extern int p_flag; /* TRUE => pipe mode */
|
|||||||
extern int q_flag; /* TRUE => don't execute rc files */
|
extern int q_flag; /* TRUE => don't execute rc files */
|
||||||
extern int u_flag; /* TRUE => unbuffer stdin and stdout */
|
extern int u_flag; /* TRUE => unbuffer stdin and stdout */
|
||||||
extern int d_flag; /* TRUE => disable heading, lib_debug == 0 */
|
extern int d_flag; /* TRUE => disable heading, lib_debug == 0 */
|
||||||
|
extern int stoponerror; /* >0 => stop, <0 => continue, ==0 => use -c */
|
||||||
|
|
||||||
extern char *pager; /* $PAGER or default */
|
extern char *pager; /* $PAGER or default */
|
||||||
extern int stdin_tty; /* TRUE if stdin is a tty */
|
extern int stdin_tty; /* TRUE if stdin is a tty */
|
||||||
@@ -268,9 +269,17 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (start_done == 1) {
|
if (start_done == 1) {
|
||||||
fprintf(stderr, "Execution error in rcfiles\n");
|
fprintf(stderr, "Execution error in rcfiles\n");
|
||||||
if (c_flag)
|
if ((c_flag && !stoponerror) || stoponerror < 0) {
|
||||||
getcommands(FALSE);
|
getcommands(FALSE);
|
||||||
start_done = 2;
|
start_done = 2;
|
||||||
|
} else {
|
||||||
|
if ((havecommands && !i_flag) || !stdin_tty)
|
||||||
|
start_done = 7;
|
||||||
|
else if (havecommands)
|
||||||
|
start_done = 4;
|
||||||
|
else
|
||||||
|
start_done = 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (start_done == 2) {
|
if (start_done == 2) {
|
||||||
if (havecommands) {
|
if (havecommands) {
|
||||||
@@ -282,12 +291,18 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (start_done == 3) {
|
if (start_done == 3) {
|
||||||
fprintf(stderr, "Execution error in commands\n");
|
fprintf(stderr, "Execution error in commands\n");
|
||||||
if (c_flag)
|
if ((c_flag && !stoponerror) || stoponerror < 0) {
|
||||||
getcommands(FALSE);
|
getcommands(FALSE);
|
||||||
else
|
|
||||||
closeinput();
|
|
||||||
start_done = 4;
|
start_done = 4;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
closeinput();
|
||||||
|
if (!stdin_tty || !i_flag)
|
||||||
|
start_done = 7;
|
||||||
|
else
|
||||||
|
start_done = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (start_done == 4) {
|
if (start_done == 4) {
|
||||||
if (stdin_tty && ((havecommands && !i_flag) || p_flag))
|
if (stdin_tty && ((havecommands && !i_flag) || p_flag))
|
||||||
start_done = 6;
|
start_done = 6;
|
||||||
@@ -295,9 +310,12 @@ main(int argc, char **argv)
|
|||||||
openterminal();
|
openterminal();
|
||||||
}
|
}
|
||||||
else if (start_done == 5) {
|
else if (start_done == 5) {
|
||||||
if (!stdin_tty && !c_flag) {
|
if (!stdin_tty && (!c_flag || stoponerror) && stoponerror >= 0) {
|
||||||
start_done = 6;
|
start_done = 7;
|
||||||
}
|
}
|
||||||
|
else if ((c_flag && !stoponerror) || stoponerror < 0)
|
||||||
|
getcommands(FALSE);
|
||||||
|
else
|
||||||
reinitialize();
|
reinitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -829,6 +829,8 @@ getstatement(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *d
|
|||||||
printeol = TRUE;
|
printeol = TRUE;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
switch (gettoken()) {
|
switch (gettoken()) {
|
||||||
|
case T_RIGHTPAREN:
|
||||||
|
case T_RIGHTBRACKET:
|
||||||
case T_RIGHTBRACE:
|
case T_RIGHTBRACE:
|
||||||
case T_NEWLINE:
|
case T_NEWLINE:
|
||||||
case T_EOF:
|
case T_EOF:
|
||||||
|
28
func.c
28
func.c
@@ -84,6 +84,8 @@ extern void matrandperm(MATRIX *M);
|
|||||||
extern void listrandperm(LIST *lp);
|
extern void listrandperm(LIST *lp);
|
||||||
extern int idungetc(FILEID id, int ch);
|
extern int idungetc(FILEID id, int ch);
|
||||||
|
|
||||||
|
extern int stoponerror;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if HZ & CLK_TCK are not defined, pick typical values, hope for the best
|
* if HZ & CLK_TCK are not defined, pick typical values, hope for the best
|
||||||
@@ -4476,6 +4478,30 @@ f_errmax(int count, VALUE **vals)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
f_stoponerror(int count, VALUE **vals)
|
||||||
|
{
|
||||||
|
int oldval;
|
||||||
|
VALUE *vp;
|
||||||
|
VALUE result;
|
||||||
|
|
||||||
|
oldval = stoponerror;
|
||||||
|
if (count > 0) {
|
||||||
|
vp = vals[0];
|
||||||
|
|
||||||
|
if (vp->v_type != V_NUM || qisfrac(vp->v_num) ||
|
||||||
|
zge31b(vp->v_num->num))
|
||||||
|
fprintf(stderr,
|
||||||
|
"Out-of-range arg for stoponerror ignored\n");
|
||||||
|
else
|
||||||
|
stoponerror = (int) ztoi(vp->v_num->num);
|
||||||
|
}
|
||||||
|
|
||||||
|
result.v_type = V_NUM;
|
||||||
|
result.v_num = itoq((long) oldval);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
f_fclose(int count, VALUE **vals)
|
f_fclose(int count, VALUE **vals)
|
||||||
{
|
{
|
||||||
@@ -7206,6 +7232,8 @@ static CONST struct builtin builtins[] = {
|
|||||||
"seed the random() function"},
|
"seed the random() function"},
|
||||||
{"ssq", 1, IN, 0, OP_NOP, 0, f_ssq,
|
{"ssq", 1, IN, 0, OP_NOP, 0, f_ssq,
|
||||||
"sum of squares of values"},
|
"sum of squares of values"},
|
||||||
|
{"stoponerror", 0, 1, 0, OP_NOP, 0, f_stoponerror,
|
||||||
|
"assign value to stoponerror flag"},
|
||||||
{"str", 1, 1, 0, OP_NOP, 0, f_str,
|
{"str", 1, 1, 0, OP_NOP, 0, f_str,
|
||||||
"simple value converted to string"},
|
"simple value converted to string"},
|
||||||
{"strcat", 1,IN, 0, OP_NOP, 0, f_strcat,
|
{"strcat", 1,IN, 0, OP_NOP, 0, f_strcat,
|
||||||
|
@@ -84,6 +84,7 @@ int q_flag = FALSE; /* TRUE => don't execute rc files */
|
|||||||
int u_flag = FALSE; /* TRUE => unbuffer stdin and stdout */
|
int u_flag = FALSE; /* TRUE => unbuffer stdin and stdout */
|
||||||
int d_flag = FALSE; /* TRUE => disable heading, lib_debug == 0 */
|
int d_flag = FALSE; /* TRUE => disable heading, lib_debug == 0 */
|
||||||
|
|
||||||
|
int stoponerror = FALSE; /* >0 => stop, <0 => continue on error */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* global values
|
* global values
|
||||||
|
@@ -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 "7" /* test number or empty string if no patch */
|
#define MINOR_PATCH "7.1" /* test number or empty string if no patch */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* calc version constants
|
* calc version constants
|
||||||
@@ -80,7 +80,3 @@ version(void)
|
|||||||
*/
|
*/
|
||||||
return stored_version;
|
return stored_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* END CODE */
|
|
||||||
|
Reference in New Issue
Block a user