From a99a3400e7fc80d437382fe3e461b435d3111dad Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Sat, 30 Oct 1999 18:19:55 -0700 Subject: [PATCH] Release calc version 2.11.0t8.9.1 --- CHANGES | 14 ++++++++++++++ config.c | 29 ++++++++++++++++++++++++++--- config.h | 12 +++++++----- help/config | 9 +++++++++ lib/Makefile | 2 +- lib/regress.cal | 28 +++++++++++++++++++++++++++- lib/test8400.cal | 16 ++++++++++++++++ opcodes.c | 2 +- quickhash.c | 1 + version.c | 2 +- 10 files changed, 103 insertions(+), 12 deletions(-) create mode 100644 lib/test8400.cal diff --git a/CHANGES b/CHANGES index 00fa70a..15f1733 100644 --- a/CHANGES +++ b/CHANGES @@ -151,6 +151,20 @@ Following is the change from calc version 2.11.0t8 to date: Fixed a bug, reported by Michael Somos , which prevented calc -m from being used. + The config("verbose_quit") will control the printing of the message: + + Quit or abort executed + + when a non-interactive ABORT, QUIT or EXIT is encounted. By default, + config("verbose_quit") is TRUE and the message is printed. If one does: + + config("verbose_quit", 0) + + the message is disabled. + + Added 8400 regression test set and test8400.cal to test the new + quit and config("verbose_quit") functionality. + Fixed misc compiler warnings. diff --git a/config.c b/config.c index 1e03256..ce2178c 100644 --- a/config.c +++ b/config.c @@ -55,6 +55,7 @@ NAMETYPE configs[] = { {"lib_debug", CONFIG_LIB_DEBUG}, {"calc_debug", CONFIG_CALC_DEBUG}, {"user_debug", CONFIG_USER_DEBUG}, + {"verbose_quit",CONFIG_VERBOSE_QUIT}, {NULL, 0} }; @@ -95,7 +96,8 @@ CONFIG oldstd = { /* backward compatible standard configuration */ BLK_FMT_HD_STYLE, /* block output format */ 3, /* calc library debug level */ 0, /* internal calc debug level */ - 0 /* user defined debug level */ + 0, /* user defined debug level */ + TRUE /* print Quit or abort executed messages */ }; CONFIG newstd = { /* new non-backward compatible configuration */ MODE_INITIAL, /* current output mode */ @@ -130,7 +132,8 @@ CONFIG newstd = { /* new non-backward compatible configuration */ BLK_FMT_HD_STYLE, /* block output format */ 3, /* calc library debug level */ 0, /* internal calc debug level */ - 0 /* user defined debug level */ + 0, /* user defined debug level */ + TRUE /* print Quit or abort executed messages */ }; CONFIG *conf = NULL; /* loaded in at startup - current configuration */ @@ -848,6 +851,21 @@ setconfig(int type, VALUE *vp) conf->user_debug = temp; break; + case CONFIG_VERBOSE_QUIT: + if (vp->v_type == V_NUM) { + q = vp->v_num; + conf->verbose_quit = !qiszero(q); + } else if (vp->v_type == V_STR) { + temp = truthtype(vp->v_str->s_str); + if (temp < 0) { + math_error("Illegal truth value" + "for verbose_quit"); + /*NOTREACHED*/ + } + conf->verbose_quit = (int)temp; + } + break; + default: math_error("Setting illegal config parameter"); /*NOTREACHED*/ @@ -1119,6 +1137,10 @@ config_value(CONFIG *cfg, int type, VALUE *vp) i = cfg->user_debug; break; + case CONFIG_VERBOSE_QUIT: + i = cfg->verbose_quit; + break; + default: math_error("Getting illegal CONFIG element"); /*NOTREACHED*/ @@ -1194,5 +1216,6 @@ config_cmp(CONFIG *cfg1, CONFIG *cfg2) cfg1->blkfmt != cfg2->blkfmt || cfg1->lib_debug != cfg2->lib_debug || cfg1->calc_debug != cfg2->calc_debug || - cfg1->user_debug != cfg2->user_debug; + cfg1->user_debug != cfg2->user_debug || + cfg1->verbose_quit != cfg2->verbose_quit; } diff --git a/config.h b/config.h index 4dfafe3..73442d0 100644 --- a/config.h +++ b/config.h @@ -80,6 +80,7 @@ #define CONFIG_LIB_DEBUG 30 #define CONFIG_CALC_DEBUG 31 #define CONFIG_USER_DEBUG 32 +#define CONFIG_VERBOSE_QUIT 33 /* @@ -114,8 +115,8 @@ struct config { LEN sq2; /* size of number to use square algorithm 2 */ LEN pow2; /* size of modulus to use REDC for powers */ LEN redc2; /* size of modulus to use REDC algorithm 2 */ - int tilde_ok; /* ok to print a tilde on aproximations */ - int tab_ok; /* ok to print tab before numeric values */ + BOOL tilde_ok; /* ok to print a tilde on aproximations */ + BOOL tab_ok; /* ok to print tab before numeric values */ long quomod; /* quomod() default rounding mode */ long quo; /* quotent // default rounding mode */ long mod; /* mod % default rounding mode */ @@ -125,18 +126,19 @@ struct config { long cfsim; /* cfsim() default rounding mode */ long outround; /* output default rounding mode */ long round; /* round()/bround() default rounding mode */ - int leadzero; /* ok to print leading 0 before decimal pt */ - int fullzero; /* ok to print trailing 0's */ + BOOL leadzero; /* ok to print leading 0 before decimal pt */ + BOOL fullzero; /* ok to print trailing 0's */ long maxscancount; /* max scan errors before abort */ char *prompt1; /* normal prompt */ char *prompt2; /* prompt when inside multi-line input */ int blkmaxprint; /* octets of a block to print, 0 => all */ - int blkverbose; /* TRUE => print all lines if a block */ + BOOL blkverbose; /* TRUE => print all lines if a block */ int blkbase; /* block output base */ int blkfmt; /* block output style */ int lib_debug; /* library debug, see LIB_DEBUG_XXX below */ int calc_debug; /* internal debug, see CALC_DEBUG_XXX below */ int user_debug; /* user defined debug value: 0 default */ + BOOL verbose_quit; /* TRUE => print Quit or abort executed msg */ }; typedef struct config CONFIG; diff --git a/help/config b/help/config index 6ffbf67..eda40ae 100644 --- a/help/config +++ b/help/config @@ -43,6 +43,7 @@ Configuration parameters "lib_debug" controls library script debug information "calc_debug" controls internal calc debug information "user_debug" for user defined debug information + "verbose_quit" TRUE=>print message on empty quit or abort The "all" config value allows one to save/restore the configuration @@ -375,6 +376,14 @@ Configuration parameters slower operation or more memory usage, and a particular value (like -1 or 0) corresponding to "no tests". + The "verbose_quit" controls the print of the message: + + Quit or abort executed + + when a non-interactive quit or abort without an argument is encounted. + A quit of abort without an argument does not display a message when + invoked at the interactive level. + The following are synonyms for true: "on" "yes" "y" "true" "t" "1" any non-zero number diff --git a/lib/Makefile b/lib/Makefile index 14a9f66..b63f8b9 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -44,7 +44,7 @@ CALC_FILES= README bigprime.cal deg.cal ellip.cal lucas.cal lucas_chk.cal \ test2700.cal test3100.cal test3300.cal test3400.cal prompt.cal \ test3500.cal seedrandom.cal test4000.cal test4100.cal test4600.cal \ beer.cal hello.cal test5100.cal test5200.cal randombitrun.cal \ - randomrun.cal xx_print.cal natnumset.cal qtime.cal + randomrun.cal xx_print.cal natnumset.cal qtime.cal test8400.cal # These files are found (but not built) in the distribution # diff --git a/lib/regress.cal b/lib/regress.cal index fa028f8..16428b1 100644 --- a/lib/regress.cal +++ b/lib/regress.cal @@ -30,6 +30,7 @@ ecnt = 0; /* clear expected errcount() value */ initcfg = config("all", "oldstd"); /* set config to startup default */ initcfg = config("lib_debug", 0); /* disable lib startup messages */ initcfg = config("calc_debug", 0); /* disable internal debugging */ +initcnf = config("verbose_quit", 0); /* disable quit messages */ initcfg = config("all"); /* save state for later use */ print '003: parsed global definitions'; @@ -7159,6 +7160,21 @@ define test_somenew() print '189: parsed test_somenew()'; +/* + * test_quit - test the QUIT functionality + */ +define test_quit() +{ + print '8400: Starting test_quit'; + + quit; + prob('quit did not end the test_quit() function'); + + /* 8400 serise continued after return, do not print end here */ +} +print '190: parsed test_quit()'; + + /* * Reserved for top level test use */ @@ -7442,6 +7458,16 @@ vrfy(l8300(10) == 15, '8309: l8300(10) == 15'); print '8310: Ending define tests'; +/* + * quit tests + */ +print; +return test_quit(); +read -once test8400; +print '8402: read -once test8400'; +print '8403: Ending test_quit'; + + /* * read various calc libs * @@ -7455,7 +7481,7 @@ print '8310: Ending define tests'; * lucas_tbl.cal - duplicatres code already read by another file * regress.cal - this file * surd.cal - already read by this file - * testXXXX.cal - already read by this file + * test9999.cal - files of this form are already read by this file * xx_print.cal - prints a bunch of things when loaded * * We want to do this 2nd to last; ahead of any final cleanup and behind diff --git a/lib/test8400.cal b/lib/test8400.cal new file mode 100644 index 0000000..2c41de6 --- /dev/null +++ b/lib/test8400.cal @@ -0,0 +1,16 @@ +/* + * Copyright (c) 1999 Landon Curt Noll + * Permission is granted to use, distribute, or modify this source, + * provided that this copyright notice remains intact. + * + * By: Landon Curt Noll + * http://reality.sgi.com/chongo + * + * chongo /\../\ + * + * This library is used by the 8400 series of the regress.cal test suite. + */ + +print "8401: in test8400.cal"; +quit; +prob('quit did not end test8400.cal'); diff --git a/opcodes.c b/opcodes.c index c14173b..0d6202d 100644 --- a/opcodes.c +++ b/opcodes.c @@ -3138,7 +3138,7 @@ o_quit(FUNC *fp, long index) } if (cp) printf("%s\n", cp); - else + else if (conf->verbose_quit) printf("Quit or abort executed\n"); if (!inputisterminal() && fp->f_name[0] == '*') closeinput(); diff --git a/quickhash.c b/quickhash.c index 0e635bc..b12e693 100644 --- a/quickhash.c +++ b/quickhash.c @@ -407,6 +407,7 @@ config_hash(CONFIG *cfg, QCKHASH val) value = (((value>>5) | (value<<27)) ^ (USB32)cfg->lib_debug); value = (((value>>5) | (value<<27)) ^ (USB32)cfg->calc_debug); value = (((value>>5) | (value<<27)) ^ (USB32)cfg->user_debug); + value = (((value>>5) | (value<<27)) ^ (USB32)cfg->verbose_quit); /* * hash the built up scalar diff --git a/version.c b/version.c index 6c3ed23..8155709 100644 --- a/version.c +++ b/version.c @@ -12,7 +12,7 @@ #define MAJOR_VER 2 /* major version */ #define MINOR_VER 11 /* minor version */ #define MAJOR_PATCH 0 /* patch level or 0 if no patch */ -#define MINOR_PATCH "8.9" /* test number or empty string if no patch */ +#define MINOR_PATCH "8.9.1" /* test number or empty string if no patch */ /* * calc version constants