diff --git a/CHANGES b/CHANGES index 4c3f227..ac6a679 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,54 @@ -The following are the changes from calc version 2.11.8.0 to date: +The following are the changes from calc version 2.11.9 to date: + + Fixed calc man page examples to move -f to the end of the line. + Thanks goes to Michael Somos for pointing this out. + + Linux and gcc now compiled with -Wall -W -Wno-comment. + + Fixed a post increment that was reported by R. Trinler and fixed by Ernest Bowen . + + Fixed pi.cal to not depend on the buggy pre-2.11.9 post increment + behavior. + + Added config("cygwin") to determine if calc was compiled under Cygwin. + The config("cygwin") is a read-only configuration value that is 1 + when calc was compiled under Cygwin and 0 otherwise. Regression + tests 949 and 950 are skipped when config("cygwin") is true. + + The Makefile variable HAVE_NO_IMPLICIT is empty by default so that + the Makefile will test if the compiler has a -Wno-implicit flag. + + Added HAVE_UNUSED Makefile variable. If HAVE_UNUSED is empty, + then the Makefile will run the have_unused program to determine + if the unused attribute is supported. If HAVE_UNUSED is set to + -DHAVE_NO_UNUSED, then the unused attribute will not be used. + + The Makefile builds have_unused.h which defines, if the unused + attribute is supported: + + #define HAVE_UNUSED /* yes */ + #define UNUSED __attribute__((unused)) /* yes */ + + or defines, if the unused is not supported (or if the Makefile + variable is HAVE_UNUSED= -DHAVE_NO_UNUSED): + + #undef HAVE_UNUSED /* no */ + #define UNUSED /* no */ + + Fixed numerous warnings about comparison between signed and unsigned + value warnings and unused parameter warnings in version.c, zrand.c, + string.c, shs1.c, shs.c, qtrans.c, qmath.c, qfunc.c, md5.c, matfunc.c, + hist.c, file.c, const.c, blkcpy.c, seed.c, opcodes.c, func.c, qio.c, + zrandom.c, custom/c_argv.c, custom/c_devnull.c, custom/c_help.c, + custom/c_sysinfo.c, addop.c and calc.c. + + Fixed some typos in this CHANGES file. + + +The following are the changes from calc version 2.11.8.0 to 2.11.8.1: Updated HOWTO.INSTALL to reflect the new RPM files. @@ -13,7 +63,7 @@ The following are the changes from calc version 2.11.8.0 to date: have not changed. By default, NO_HASH_CPU_OPTIMIZATION is NOT defined and the slightly faster expression is used. - A slight modification of what was known as the "calc new stardard" + A slight modification of what was known as the "calc new standard" configuration (calc -n or config("all", "newstd")) is now the default calc configuration. The flag: @@ -46,9 +96,10 @@ The following are the changes from calc version 2.11.8.0 to date: Fixed a bug in the evaluation of tanh(1e-23) with an epsilon(1e-100). Thanks goes to Dmitry G. Baksheyev - for reprting the problem, and thanks goes to Ernest Bowen + for reporting the problem, and thanks goes to Ernest Bowen for the fix. + The following are the changes from calc version 2.11.7.0 to 2.11.7.1: Added support to build calc RPMs thanks to Petteri Kettunen @@ -236,7 +287,7 @@ The following are the changes from calc version 2.11.5.5 to 2.11.5.9: Updated README.WINDOWS to include information on building with DJGPP. - The pld folks are building RPMs based on our calc distrbutions. + The pld folks are building RPMs based on our calc distributions. See: ftp://ftp.pld.org.pl/dists/ra/PLD/i686/PLD/RPMS or http://ftp.pld.org.pl/dists/ra/PLD/i686/PLD/RPMS more information. We appreciate their work in this regard. In the next release, we @@ -318,7 +369,7 @@ The following are the changes from calc version 2.11.5t4.1 to 2.11.5t4.4: which calc will be installed. The calc install is performed under $T, the calc build is performed under /. The purpose for $T is to allow someone to install calc somewhere other than into the system area. - For examplewhen forming the calc rpm, the Makefile is called with + For example when forming the calc rpm, the Makefile is called with T=$RPM_BUILD_ROOT. If $T is empty, calc is installed under /. Removed all echo_XXX rules except for echo_inst_files from lower @@ -326,13 +377,13 @@ The following are the changes from calc version 2.11.5t4.1 to 2.11.5t4.4: with T=$RPM_BUILD_ROOT. Updated LIBRARY file with instructions related to -DCALC_SRC, - the new default include file locatin and -lcustcalc. + the new default include file location and -lcustcalc. The following are the changes from calc version 2.11.5t3 to 2.11.5t4: - The Makefile will now send both stdout and sterr to /dev/null - when compiling hsrc intermeriates. + The Makefile will now send both stdout and stderr to /dev/null + when compiling hsrc intermediates. The config("verbose_quit") value was restored to a default value of FALSE. @@ -379,7 +430,7 @@ The following are the changes from calc version 2.11.5t3 to 2.11.5t4: The Makefile variable ${TOPDIR} is no longer used. In some places it has been replaced by a new Makefile variable ${SHAREDIR}. Some - of the old TOPDIR functionality has beenn replaced by ${CSHAREDIR}. + of the old TOPDIR functionality has been replaced by ${CSHAREDIR}. The install rules no longer remove old obsolete files. We assume that these old files have long since vanished! :-) @@ -469,7 +520,7 @@ The following are the changes from calc version 2.11.5t0 to 2.11.5t1.1: Added HAVE_MALLOC_H, HAVE_STDLIB_H, HAVE_STRING_H, HAVE_TIMES_H, HAVE_SYS_TIMES_H, HAVE_TIME_H, HAVE_SYS_TIME_H, HAVE_UNISTD_H - and HAVE_URANDOM to the Makefile. If these symcols are empty, + and HAVE_URANDOM to the Makefile. If these symbols are empty, then the Makefile looks for the appropriate system include file. If they are YES, then the Makefile will assume they exist. If they are NO, then the Makefile will assume they do not exist. @@ -490,7 +541,7 @@ The following are the changes from calc version 2.11.5t0 to 2.11.5t1.1: under the win32 directory. Added FPOS_POS_BITS, OFF_T_BITS, DEV_BITS and INODE_BITS Makefile - symbiols to allow one to force the size of a file position, file + symbols to allow one to force the size of a file position, file offset, dev and inode value. Leaving these values blank will Makefile to determine their size. @@ -642,7 +693,7 @@ The following are the changes from calc version 2.11.3t0 to 2.11.4: calc -q -i "define f(x) = x^2;" To achieve this, the use of getopts() in calc.c has been dropped in - favour of direct reading of the arguments produced by the shell. + favor of direct reading of the arguments produced by the shell. In effect, until a "--" or "-s" or a calc command (recognized by not starting with '-') is encountered, the quotation signs in command lines like the above example are ignored. Dropping getopts() @@ -771,7 +822,7 @@ The following are the changes from calc version 2.11.3t0 to 2.11.4: (11) The effect of config("trace", 8) which displays opcodes of functions as they are successfully defined has been restricted to - functions defioed with explicit use of "define". Thus, it has been + functions defined with explicit use of "define". Thus, it has been deactivated for the ephemeral functions used for evaluation of calc command lines or eval() functions. @@ -910,7 +961,7 @@ The following are the changes from calc version 2.11.1 to 2.11.1t2.2: #! files calc shell script Renamed 'help stdlib' to 'help resource'. The 'help stdlib' is - aliased to 'help resource' for ard compatibility. + aliased to 'help resource' for arg compatibility. Renamed config("lib_debug") to config("resource_debug"). The config("lib_debug") will have the same effect as @@ -940,7 +991,7 @@ The following are the changes from calc version 2.11.0t10 to 2.11.0t11: Misc code cleanup. Removed dead code. Removed trailing whitespace. Fixed whitespace to make the best use of 8 character tabs. - Fixed some bugs relaing to '// and %' in combination with some + Fixed some bugs relating to '// and %' in combination with some of the the rounding modes based on a patch from Ernest Bowen . @@ -950,7 +1001,7 @@ The following are the changes from calc version 2.11.0t10 to 2.11.0t11: Minor typos fixed in regress.cal - Added 8500 test serise and test8500.cal to perform more extensive + Added 8500 test series and test8500.cal to perform more extensive tests on // and % with various rounding modes. The 'unused value ignored' messages now start with Line 999: instead @@ -1188,7 +1239,7 @@ The following are the changes from calc version 2.11.0t8.9.1 to 2.11.0t9.4.5: Quit or abort executed - when a non-interactive ABORT, QUIT or EXIT is encounted. By default, + when a non-interactive ABORT, QUIT or EXIT is encountered. By default, config("verbose_quit") is TRUE and the message is printed. If one does: config("verbose_quit", 0) @@ -1327,11 +1378,11 @@ The following are the changes from calc version 2.11.0t8.9.1 to 2.11.0t9.4.5: by default is /usr/local/include. Include files previously installed directly under ${LIBDIR} will be removed. - Added the piforever() funcion to lib/pi.cal. It was written by + Added the piforever() function to lib/pi.cal. It was written by Klaus Alexander Seistrup and was inspired by an algorithm conceived by Lambert Meertens. (See also the ABC Programmer's Handbook, by Geurts, Meertens & Pemberton, published - by Prentice-Hall (UK) Ltd., 1990.) The piforever() funcion prints + by Prentice-Hall (UK) Ltd., 1990.) The piforever() function prints digits of pi for as long as your memory and system uptime allows. :-) Fixed the URLs found thruout the source and documentation which did @@ -1345,7 +1396,7 @@ The following are the changes from calc version 2.11.0t8.9.1 to 2.11.0t9.4.5: + comma operator + separator of arguments in a function call - + separator of arguments in a defintion + + separator of arguments in a definition etc. The expression (mat A[2]), B[3] returns B[3], assuming B already @@ -1388,7 +1439,7 @@ The following are the changes from calc version 2.11.0t8.9.1 to 2.11.0t9.4.5: of including longlong.h will help detect when a system can deal with 'long long' but not '%lld' in printf. If a system with 'long long' uses '%ld' to print a 64 bit value, then l_format will be > 0; - othewise if "%lld" is required, l_format will be < 0. + otherwise if "%lld" is required, l_format will be < 0. Added HAVE_STRDUP Makefile variable as well as the have_strdup.c program that forms the have_strdup.h file. The have_strdup.h file @@ -1397,7 +1448,7 @@ The following are the changes from calc version 2.11.0t8.9.1 to 2.11.0t9.4.5: the real strdup() function. Calc no longer makes use of sys_errlist and sys_nerr. Some systems - no longer suppor these values (even though they should from a + no longer support these values (even though they should from a legacy prospective). Calc now relies on the fact that strerror() will return NULL of no such system error exists. System errors >= 10000 will be considered calc errors instead. The Makefile symbol @@ -1416,7 +1467,7 @@ The following are the changes from calc version 2.11.0t8.9.1 to 2.11.0t9.4.5: to V_NOSUBTYPE thruout the source code. Established a separate calc-bugs address from the calc-tester - maining list. Using anti-spam address forms in order to try and + mailing list. Using anti-spam address forms in order to try and stay under the radar of spammers as much as one can do so. @@ -1466,7 +1517,7 @@ The following are the changes from calc version 2.11.0t8 to 2.11.0t8.9: Misc source file cleanup for things such as } else { style consistency. - Fixed the basis for FNV-1 hashes. Piror to this fix, the hash() + Fixed the basis for FNV-1 hashes. Prior to this fix, the hash() builtin produced FNV hash values that did not match the FNV-1 algorithm as specified in: @@ -1489,7 +1540,7 @@ The following are the changes from calc version 2.11.0t8 to 2.11.0t8.9: and: {static a = 5} define f(x) = a + x; - String constants can now be concatenated. For exmaple: + String constants can now be concatenated. For example: s = "curds" ' and ' "whey"; @@ -1558,7 +1609,7 @@ The following are the changes from calc version 2.11.0t8 to 2.11.0t8.9: an error while processing 'args' and drops into interactive mode without the terminal bindings being set. - Added patch from Ernest Bowen to extablish the abort command as + Added patch from Ernest Bowen to establish the abort command as well as to clarify the roles of quit and exit. See the help/command file for details. @@ -1705,11 +1756,11 @@ The following are the changes from calc version 2.11.0t7 to 2.11.0t7.5: compile is invoked. Only the source that must be compiled and run on the local machine use ${LCC}; everything else uses ${CC}. - Fixed memory buffer ovreread problem in eatstring() in token.c. + Fixed memory buffer related problem in eatstring() in token.c. Fixed memory leaks related to putenv(). - Fixed memory leaks realted to srandom(). + Fixed memory leaks related to srandom(). Fixed compilation warnings and problems on BSDI. @@ -2011,13 +2062,13 @@ The following are the changes from calc version 2.10.3t5.34 to 2.10.3t5.37: Fixed the order of prints in regress.cal. By convention, a print of a test line happens after the test. This is because function parsed messages occur after the function is parsed. Also the - boolean tesrt of vrfy happens before any print statement. - Therefore a non-test line is tested and printed as follows: + boolean test will verify before any print statements. Therefore + a non-test line is tested and printed as follows: y = sha(); print '7125: y = sha()'; - The perm(a,b) and comb(a,b) have been extented to arbitrary real a and + The perm(a,b) and comb(a,b) have been extended to arbitrary real a and integer b. Fixed a bug in minv(). @@ -2091,7 +2142,7 @@ The following are the changes from calc version 2.10.3t5.34 to 2.10.3t5.37: A = B results in A referring to exactly the same string as B rather than to - a copy of what is in B. Thie is like the use of character-pointers in + a copy of what is in B. This is like the use of character-pointers in C, as in char *s1, *s2; @@ -2304,7 +2355,7 @@ The following are the changes from calc version 2.10.3t5.34 to 2.10.3t5.37: if n is negative. I've changed the definitions of head and tail for lists to be consistent with this interpretation of negative n. - (23) Similarly I've left strpos ezsentially as at present, but search + (23) Similarly I've left strpos essentially as at present, but search and rsearch have been extended to strings. For example, search(A, B, m, n) @@ -2761,16 +2812,16 @@ The following are the changes from calc version 2.10.3t5.28 to 2.10.3t5.33: (11) storing the most recently calculated value of qpi(epsilon)i and epsilon so that when called again with the same epsilon it - is copied rather than recalculateed. + is copied rather than recalculated. (12) defining trace() for square matrices (13) expression in parentheses may now be followed by a qualifier - computible with its type + computable with its type When an expression in parentheses evaluates to an lvalue whose current value is a matrix, list or object, it may - now be followed by a qualifier computible with its type. + now be followed by a qualifier compatible with its type. For example: @@ -2842,7 +2893,7 @@ The following are the changes from calc version 2.10.3t5.28 to 2.10.3t5.33: define f(x) = 5 + x; - Fixed bug with lowhex2bin converstion in lib_util.c. It did not + Fixed bug with lowhex2bin conversation in lib_util.c. It did not correctly convert from hex ASCII to binary values due to a table loading error. @@ -2905,7 +2956,7 @@ The following are the changes from calc version 2.10.3t5.11 to 2.10.3t5.27: blocks that have been created, blocks(id) returns the named block with identifying index id. - Removed the artifical limit of 20 named blocks. + Removed the artificial limit of 20 named blocks. Added name() builtin to return the name of a type of value as a string. @@ -2968,7 +3019,7 @@ The following are the changes from calc version 2.10.3t5.11 to 2.10.3t5.27: Moved blkcpy() routines have been moved to blkcpy.[ch]. - The blkcpy() & copy() builtings can not copy to/from numbers. + The blkcpy() & copy() builtins can not copy to/from numbers. For purposes of the copy, only the numerator is ignored. Resolved a number of missing symbols for libcalc users. @@ -3114,7 +3165,7 @@ The following are the changes from calc version 2.10.3t5.1 to 2.10.3t5.10: surprises that C programmers may encounter. Updated the 'help', 'intro' and 'overview' to reflect the - full ilst of non-builtin function help files. Reorered the + full list of non-builtin function help files. Reorered the 'full' help file. The blkalloc() builtin has been renamed blk(). @@ -3162,13 +3213,13 @@ The following are the changes from calc version 2.10.3t5.1 to 2.10.3t5.10: Added ${LD_DEBUG} Makefile variable to allow for additional libraries to be compiled into calc ... for debugging purposes. - In most cases, LD_DEBUG= is sufficent. + In most cases, LD_DEBUG= is sufficient. Added ${CALC_ENV} makefile variable to allow for particular environment variables to be supplied for make {check,chk,debug}. - In most cases, CALC_ENV= CALCPATH=./lib is sufficent. + In most cases, CALC_ENV= CALCPATH=./lib is sufficient. - Added ${CALC_LIBS} to list the libaraies created and used to + Added ${CALC_LIBS} to list the libraries created and used to build calc. The CALC_LIBS= custom/libcustcalc.a libcalc.a is standard for everyone. @@ -3187,14 +3238,14 @@ The following are the changes from calc version 2.10.3t5.1 to 2.10.3t5.10: The *.c should do that instead where it is reasonable. To avoid symbol conflicts, *.h files produced and shipped - with calc are inclosed that as similar to the following: + with calc are enclosed that as similar to the following: #if !defined(__CALC_H__) #define __CALC_H__ .. #endif /* !__CALC_H__ */ - Added memsize(x) builtin to print the best aproximation of the + Added memsize(x) builtin to print the best approximation of the size of 'x' including overhead. The sizeof(x) builtin attempts to cover just the storage of the value and not the overhead. Because -1, 0 and 1 ZVALUES are static common values, sizeof(x) @@ -3219,7 +3270,7 @@ The following are the changes from calc version 2.10.3t4.16 to 2.10.3t5.0: Added more error() and errno() regression tests. The convention of using the global variable lib_debug at the - end of calc librar scripts has been replaced with config("lib_debug"). + end of calc library scripts has been replaced with config("lib_debug"). The "lib_debug" is reserved by convention for calc library scripts. This config parameter takes the place of the lib_debug global variable. By convention, "lib_debug" has the following meanings: @@ -3273,7 +3324,7 @@ The following are the changes from calc version 2.10.3t4.16 to 2.10.3t5.0: >0 a greater degree of debugging is performed and more verbose messages are printed - Added more code that is deading with the BLOCK type. + Added more code related to the BLOCK type. Added blkalloc() builtin. @@ -3318,14 +3369,14 @@ The following are the changes from calc version 2.10.3t4.16 to 2.10.3t5.0: arg is "-f", then 'no-such-file' errors are ignored. Added errcount([count]) builtin to return or set the error - counter. Added errmax([limit]) to rturn or set the error + counter. Added errmax([limit]) to return or set the error count limiter. Added -n as a calc command line option. This has the effect of calling config("all", "newstd") at startup time. Added -e as a calc command line option to ignore all environment - varialbes at startup time. The getenv() builtin function will + variables at startup time. The getenv() builtin function will still return values, however. Added -i as a calc command line option. This has the effect @@ -3508,7 +3559,7 @@ The following are the changes from calc version 2.10.3t3 to 2.10.3t4.15: The "blkverbose" determines if all lines, including duplicates should be printed. If TRUE, then all lines are printed. If false, - duplicate lines are skipped and only a "*" is printed in a sytle + duplicate lines are skipped and only a "*" is printed in a style similar to od. This config value has not meaning if "blkfmt" is "str". The default value for "blkverbose" is FALSE: duplicate lines are not printed. @@ -3581,7 +3632,7 @@ The following are the changes from calc version 2.10.3t0 to 2.10.3t2: A lot of work was performed on the code generation by Ernest Bowen . Declarations no longer - need to precese code: + need to precede code: define f(x) { local i = x^2; @@ -3715,7 +3766,7 @@ The following are the changes from calc version 2.10.3t0 to 2.10.3t2: "break", "continue", or "goto", so that only one jump opcode is required. - A label can now be immediately by a rightbrace. For example: + A label can now be immediately by a right-brace. For example: define test_newop3(x) {if (x < 0) goto l132; ++x; l132: return x;} @@ -3973,7 +4024,7 @@ The following are the changes from calc version 2.10.2t25 to 2.10.2t32: creates four static variables, the first "a" having a very short and useless life. - Added new tests to verify the new assugnments above. + Added new tests to verify the new assignments above. Added the builtin test(x) which returns 1 or 0 according as x tests as true or false for conditions. @@ -4014,7 +4065,7 @@ The following are the changes from calc version 2.10.2t4 to 2.10.2t24: so that the entire make is verbose and a constructed files are printed - Improved instuctions in 'BUGS' section on reporting problems. + Improved instructions in 'BUGS' section on reporting problems. In particular we made it easy for people to send in a full diagnostic output by sending 'debug.out' which is made as follows: @@ -4029,13 +4080,13 @@ The following are the changes from calc version 2.10.2t4 to 2.10.2t24: Attempting to rewind a file this is not open generates an error. - Noted conversion problems in file.c in tripple X comments. + Noted conversion problems in file.c in triple X comments. - Some extremely braindead shells cannot correctly deal with if - cluases that do not have a non-empty else statement. Their + Some extremely brain dead shells cannot correctly deal with if + clauses that do not have a non-empty else statement. Their exit bogosity results in make problems. As a work-a-round, Makefile if clauses have 'else true;' clauses for if statements - that previously did not have an else cluause. + that previously did not have an else clause. Fixed problems where the input stack depth reached the 10 levels. @@ -4150,7 +4201,7 @@ The following are the changes from calc version 2.10.2t4 to 2.10.2t24: A = {{1,2}, {3,4}}; The config("trace", 8) causes opcodes of newly defined functions - are displayed. Also show can now show the opcides for a function. + are displayed. Also show can now show the opcodes for a function. For example: config("trace", 8); @@ -4256,9 +4307,9 @@ The following are the changes from calc version 2.10.2t4 to 2.10.2t24: Added rm("file") builtin to remove a file. The regress test sections that create files also use rm() to remove - them before and afterwards. + them before and afterward. - Added 4400-4500 set to test new mat and obj initializaion rules. + Added 4400-4500 set to test new mat and obj initialization rules. Added 4600 to test version file operations. @@ -4274,7 +4325,7 @@ The following are the changes from calc version 2.10.2t4 to 2.10.2t24: Renumbered some of the early regress.cal test numbers to make room for more tests. Fixed all out of sequence test numbers. Fixed some - malformatted regression reports. + malformed regression reports. Renamed STSIZE_BITS to OFF_T_BITS. Renamed SWAP_HALF_IN_STSIZE to SWAP_HALF_IN_OFF_T. @@ -4365,7 +4416,7 @@ The following are the changes from calc version 2.10.2t1 to 2.10.2t3: tries "w" and "r", and if none work, gives up. This avoids having "open" files with null fp. - The buildin rewind() calls the C rewind() function, but one may + The builtin rewind() calls the C rewind() function, but one may now rewind several files at once by a call like rewind(f1, f2). With no argument, rewind() rewinds all open files with id >= 3. @@ -4388,7 +4439,7 @@ The following are the changes from calc version 2.10.2t1 to 2.10.2t3: y = fgetstr(f); /* returns "Curt" */ z = fgetstr(f); /* returns "Noll" */ - The buildin fgetfield() returns the next field of non-whitepsace + The builtin fgetfield() returns the next field of non-whitepsace characters. The builtins scan(), fscan(), strscan() read tokens (fields of @@ -4412,10 +4463,10 @@ The following are the changes from calc version 2.10.2t1 to 2.10.2t3: or -1 if x is a file but not open. If s is a string, size(s) returns characters in s. - Added buildin access("foo", "w") returns the null value if a file - "foo" exists and is writeable. + Added builtin access("foo", "w") returns the null value if a file + "foo" exists and is writable. - Some systems has a libc symbolc qadd() that conflicted with calc's + Some systems has a libc symbolic qadd() that conflicted with calc's qadd function. To avoid this, qadd() has been renamed to qqadd(). The calc error codes are produced from the the calcerr.tbl file. @@ -4570,9 +4621,9 @@ The following are the changes from calc version 2.10.1t20 to 2.10.1t20: A new "bignum" algorithm for evaluating pmod(x,k,m) when - N >= config("pow2"). For the multiplications and squarings + N >= config("pow2"). For the multiplications and squaring modulo m, or their equivalent, when N >= config("redc2"), - calc has used evaluations correponding to rcout(x * y, m), + calc has used evaluations corresponding to rcout(x * y, m), for which the runtime is essentially that of three multiplications. @@ -4645,7 +4696,7 @@ The following are the changes from calc version 2.10.1t11 to 2.10.1t19: cmp(a,b) = sgn(re(a) - re(b)) + sgn(im(a) - im(b)) * 1i - The cmp help file has been uptdated. + The cmp help file has been updated. Change HASH type to QCKHASH. The HASH type is a name better suited for the upcoming one-way hash interface. @@ -4705,7 +4756,7 @@ The following are the changes from calc version 2.10.1t11 to 2.10.1t19: prompt "; " (allows full line cut/paste) more ";; " (allows full line cut/paste) - The "newstd" is a (hopefully) more perferred configuration than the + The "newstd" is a (hopefully) more preferred configuration than the historic default. The fposval.h file defines DEV_BITS and INODE_BITS giving the @@ -4724,7 +4775,7 @@ The following are the changes from calc version 2.10.1t11 to 2.10.1t19: state or RANDOM state. The lib/cryrand.cal library now no longer keeps the Blum prime - factors used to formt he Blum modulus. The default modulus has + factors used to form he Blum modulus. The default modulus has been expanded to 1062 bits product of two Blum primes. The function hash_init() is called to initialize the hash function @@ -4755,7 +4806,7 @@ The following are the changes from calc version 2.10.1t11 to 2.10.1t19: help/poly file. Added poly.c. - Fixes and performance improvemtns to det(). Renamed atoq() and atoz() to str2q() and str2z() to avoid conflicts @@ -4829,7 +4880,7 @@ The following are the changes from calc version 2.10.0t13 to 2.10.1t10: signed and unsigned values. The longbits.h will define HAVE_B64 with a 64 bit type (long or - longlong) is available. If one is, then SB64 abd US64 typedefs + longlong) is available. If one is, then SB64 and US64 typedefs are declared. The U(x) and L(x) macros only used to define 33 to 64 bit signed @@ -4858,7 +4909,7 @@ The following are the changes from calc version 2.10.0t13 to 2.10.1t10: The CALCBINDINGS file is searched for along the CALCPATH. The Makefile defines the default CALCBINDINGS is "bindings" (or "altbind") which - is now usualy found in ./lib or ${LIBDIR}. + is now usually found in ./lib or ${LIBDIR}. Per Ernest Bowen , an optional third argument was added sqrt() so that in sqrt(x,y,z), y and z have @@ -4866,7 +4917,7 @@ The following are the changes from calc version 2.10.0t13 to 2.10.1t10: what is being approximated is the sqrt of x. Another difference is that two more bits of z are used in sqrt: bit 5 gives the option of exact results when they exist (the value of y is then ignored) and - bit 6 returns the nonprincipal root rather than the principal value. + bit 6 returns the non-principal root rather than the principal value. If commands are given on the command line, leading tabs are not printed in output. Giving a command on the command line implies @@ -4906,7 +4957,7 @@ The following are the changes from calc version 2.10.0t13 to 2.10.1t10: 6 do not execute any program 7 allow everything (default mode) - Thus if one wished to run calc from a privledged user, one might + Thus if one wished to run calc from a privileged user, one might want to use -m 0 in an effort to make calc more secure. The -m flags for reading and writing apply on open. @@ -4922,7 +4973,7 @@ The following are the changes from calc version 2.10.0t13 to 2.10.1t10: The maximum command line size it MAXCMD (16384) bytes. Calc objects to command lines that are longer. - The -u flag cause calc to unbuffer stdin and stdout. + The -u flag cause calc to un-buffer stdin and stdout. Added more help files. Improved other help files. @@ -5006,7 +5057,7 @@ The following are the changes from calc version 2.9.3t9.2+ to 2.9.3t10: Makefile symbol. Removed alloc.c. Added getenv("name"), putenv("name=val") and putenv("name, "val") - builts for environment variable support thanks to "Dr." "D.J." Picton + builds for environment variable support thanks to "Dr." "D.J." Picton . Added system("shell command") builtin to execute shell commands, @@ -5051,7 +5102,7 @@ The following are the changes from calc version 2.9.3t9.2+ to 2.9.3t10: Expanded the regress.cal regression test suite. - Fixed -- and ++ with respect to objects and asignment (see the 2300 + Fixed -- and ++ with respect to objects and assignment (see the 2300 series in regress.cal). Added isident(m) to determine if m is an identity matrix. @@ -5232,7 +5283,7 @@ The following are the changes from calc version 2.9.3t8 to 2.9.3t9.2: The cryrand.cal library has been modified to use the builtin rand() number generator. The output of this generator is - different from pervious versions of this generator because + different from previous versions of this generator because the rand() builtin does not match the additive 55 / shuffle generators from the old cryrand.cal file. @@ -5392,8 +5443,8 @@ The following are the changes from calc version 2.9.2 to 2.9.3t7: 1/4 < sup(abs(appr(x,e) - x))/e <= 1/2. - Here 'sup' denotes the supremum or least upper bound over values of x. - Previousld calc did: 1/4 <= sup(abs(appr(x,e) - x))/e < 1. + Here 'sup' denotes the least upper bound over values of x (supremum). + Previously calc did: 1/4 <= sup(abs(appr(x,e) - x))/e < 1. Certain 64 bit processors such as the Alpha are now supported. @@ -5581,8 +5632,8 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1: easily extracted and used in other programs. Two new library files have been added: chrem.cal and cryrand.cal. - The first of these solves the chinese remainder problem for a set - of modulos and remainders. The second of these implements several + The first of these solves the Chinese remainder problem for a set + of modulo's and remainders. The second of these implements several very good random number generators for large numbers. A small bug which allowed division by zero was fixed. @@ -5612,8 +5663,8 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1: ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.60 $ -## @(#) $Id: CHANGES,v 29.60 2003/08/26 04:35:45 chongo Exp $ +## @(#) $Revision: 29.63 $ +## @(#) $Id: CHANGES,v 29.63 2004/02/23 09:23:39 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $ ## ## Under source code control: 1993/06/02 18:12:57 diff --git a/Makefile b/Makefile index 5f5b9a4..2147767 100644 --- a/Makefile +++ b/Makefile @@ -26,8 +26,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -MAKEFILE_REV= $$Revision: 29.62 $$ -# @(#) $Id: Makefile.ship,v 29.62 2003/02/25 17:38:22 chongo Exp $ +MAKEFILE_REV= $$Revision: 29.68 $$ +# @(#) $Id: Makefile.ship,v 29.68 2004/02/23 09:30:32 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $ # # Under source code control: 1990/02/15 01:48:41 @@ -549,13 +549,28 @@ HAVE_UNISTD_H= # Determine if our compiler allows the -Wno-implicit flag # -# HAVE_NO_IMPLICIT= Our compiler does not have -Wno-implicit flags +# HAVE_NO_IMPLICIT= let the Makefile test the -Wno-implicit flag # HAVE_NO_IMPLICIT= NO Our compiler does not have -Wno-implicit flags # HAVE_NO_IMPLICIT= YES Our compiler has a -Wno-implicit flag # -# HAVE_NO_IMPLICIT= +# Select HAVE_NO_IMPLICIT= for DJGPP. +# +HAVE_NO_IMPLICIT= # HAVE_NO_IMPLICIT= NO -HAVE_NO_IMPLICIT= YES +# HAVE_NO_IMPLICIT= YES + +# Determine if our compiler allows the unused attribute +# +# If HAVE_UNUSED is empty, this Makefile will run the have_unused program +# to determine if the unused attribute is supported. If HAVE_UNUSED is set to +# -DHAVE_NO_UNUSED, then the unused attribute will not be used. +# +# Select HAVE_UNUSED= for DJGPP. +# +# If in doubt, leave HAVE_UNUSED empty and this Makefile will figure it out. +# +HAVE_UNUSED= +#HAVE_UNUSED= -DHAVE_NO_UNUSED # System include files # @@ -985,7 +1000,7 @@ MKDIR_ARG= -p # For better performance, set the following above: DEBUG= -O2 -g3 # You might even try: DEBUG= -O3 -g3 # -CCWARN= -Wall -Wno-comment +CCWARN= -Wall -W -Wno-comment CCOPT= ${DEBUG} ${NO_SHARED} CCMISC= # @@ -1005,7 +1020,7 @@ CC= ${PURIFY} ${LCC} # For better performance, set the following above: DEBUG= -O2 -g3 # You might even try: DEBUG= -O3 -g3 # -#CCWARN= -Wall -Wno-comment +#CCWARN= -Wall -W -Wno-comment #CCOPT= ${DEBUG} ${NO_SHARED} #CCMISC= # @@ -1265,7 +1280,7 @@ BUILD_H_SRC= align32.h args.h calcerr.h conf.h endian_calc.h \ have_unistd.h longbits.h longlong.h terminal.h \ have_ustat.h have_getsid.h have_getpgid.h \ have_gettime.h have_getprid.h have_urandom.h have_rusage.h \ - have_strdup.h + have_strdup.h have_unused.h # we build these .c files during the make # @@ -1280,7 +1295,7 @@ UTIL_C_SRC= align32.c endian.c longbits.c have_newstr.c have_uid_t.c \ have_fpos_pos.c longlong.c have_offscl.c have_posscl.c have_memmv.c \ have_ustat.c have_getsid.c have_getpgid.c \ have_gettime.c have_getprid.c have_rusage.c have_strdup.c \ - no_implicit.c + no_implicit.c have_unused.c # these awk and sed tools are used in the process of building BUILD_H_SRC # and BUILD_C_SRC @@ -1297,7 +1312,7 @@ UTIL_OBJS= endian.o longbits.o have_newstr.o have_uid_t.o \ try_strarg.o have_stdvs.o have_varvs.o have_posscl.o have_memmv.o \ have_ustat.o have_getsid.o have_getpgid.o \ have_gettime.o have_getprid.o ver_calc.o have_rusage.o have_strdup.o \ - no_implicit.o + no_implicit.o have_unused.o # these temp files may be created (and removed) during the build of BUILD_C_SRC # @@ -1311,7 +1326,7 @@ UTIL_PROGS= align32 fposval have_uid_t longlong have_const \ endian longbits have_newstr have_stdvs have_varvs \ have_ustat have_getsid have_getpgid \ have_gettime have_getprid ver_calc have_strdup \ - no_implicit no_implicit.arg + no_implicit no_implicit.arg have_unused # The complete list of Makefile vars passed down to custom/Makefile. # @@ -1555,7 +1570,7 @@ func.o: func.c ${MAKE_FILE} ${CC} ${CFLAGS} ${ALLOW_CUSTOM} -c func.c seed.o: seed.c no_implicit.arg ${MAKE_FILE} - ${CC} ${CFLAGS} "`cat no_implicit.arg`" -c seed.c + ${CC} ${CFLAGS} `cat no_implicit.arg` -c seed.c ## # @@ -2886,13 +2901,15 @@ no_implicit.arg: no_implicit.c ${MAKE_FILE} -${Q}rm -f no_implicit no_implicit.o no_implicit.arg ${Q}echo 'forming no_implicit.arg' -${Q}if [ X"${HAVE_NO_IMPLICIT}" = X"YES" ]; then \ + echo ""'-Wno-implicit' > no_implicit.arg; \ + elif [ X"${HAVE_NO_IMPLICIT}" = X"NO" ]; then \ + touch no_implicit.arg; \ + else \ ${LCC} -Wno-implicit ${ICFLAGS} -DHAVE_NO_IMPLICIT \ no_implicit.c -c >/dev/null 2>&1; \ ${LCC} ${ILDFLAGS} no_implicit.o -o no_implicit >/dev/null 2>&1; \ ${SHELL} -c "./no_implicit > no_implicit.arg 2>/dev/null" \ >/dev/null 2>&1; true; \ - else \ - touch no_implicit.arg; \ fi ${Q}echo 'no_implicit.arg formed' -@if [ -z "${Q}" ]; then \ @@ -2905,6 +2922,46 @@ no_implicit.arg: no_implicit.c ${MAKE_FILE} true; \ fi +have_unused.h: have_unused.c ${MAKE_FILE} + -${Q}rm -f have_unused have_unused.o unused_tmp have_unused.h + ${Q}echo 'forming have_unused.h' + ${Q}echo '/*' > have_unused.h + ${Q}echo ' * DO NOT EDIT -- generated by the Makefile' >> have_unused.h + ${Q}echo ' */' >> have_unused.h + ${Q}echo '' >> have_unused.h + ${Q}echo '' >> have_unused.h + ${Q}echo '#if !defined(__HAVE_UNUSED_H__)' >> have_unused.h + ${Q}echo '#define __HAVE_UNUSED_H__' >> have_unused.h + ${Q}echo '' >> have_unused.h + ${Q}echo '' >> have_unused.h + ${Q}echo '/* do we have/want the unused attribute? */' >> have_unused.h + -${Q}rm -f have_unused.o have_unused + -${Q}${LCC} ${ICFLAGS} ${HAVE_UNUSED} have_unused.c -c \ + >/dev/null 2>&1; true + -${Q}${LCC} ${ILDFLAGS} have_unused.o -o have_unused \ + >/dev/null 2>&1; true + -${Q}${SHELL} -c "./have_unused > unused_tmp 2>/dev/null" \ + >/dev/null 2>&1; true + -${Q}if [ -s unused_tmp ]; then \ + cat unused_tmp >> have_unused.h; \ + else \ + echo '#undef HAVE_UNUSED /* no */' >> have_unused.h; \ + fi + ${Q}echo '' >> have_unused.h + ${Q}echo '' >> have_unused.h + ${Q}echo '#endif /* !__HAVE_UNUSED_H__ */' >> have_unused.h + -${Q}rm -f have_unused have_unused.o unused_tmp + ${Q}echo 'have_unused.h formed' + -@if [ -z "${Q}" ]; then \ + echo ''; \ + echo '=-=-= start of $@ =-=-='; \ + cat $@; \ + echo '=-=-= end of $@ =-=-='; \ + echo ''; \ + else \ + true; \ + fi + ## # # Build .h files for windoz based systems @@ -3147,7 +3204,7 @@ h_list: # print the calc version # -ver_calc: version.c +ver_calc: version.c have_unused.h -rm -f $@ ${LCC} ${ICFLAGS} -DCALC_VER ${ILDFLAGS} version.c -o $@ @@ -3907,6 +3964,7 @@ calc.o: have_strdup.h calc.o: have_string.h calc.o: have_uid_t.h calc.o: have_unistd.h +calc.o: have_unused.h calc.o: hist.h calc.o: label.h calc.o: longbits.h @@ -4134,6 +4192,7 @@ func.o: have_strdup.h func.o: have_string.h func.o: have_times.h func.o: have_unistd.h +func.o: have_unused.h func.o: label.h func.o: longbits.h func.o: md5.h @@ -4200,6 +4259,7 @@ have_stdvs.o: have_unistd.h have_strdup.o: have_strdup.c have_uid_t.o: have_uid_t.c have_uid_t.o: have_unistd.h +have_unused.o: have_unused.c have_ustat.o: have_ustat.c have_varvs.o: have_string.h have_varvs.o: have_unistd.h @@ -4249,6 +4309,7 @@ hist.o: have_stdlib.h hist.o: have_strdup.h hist.o: have_string.h hist.o: have_unistd.h +hist.o: have_unused.h hist.o: hist.c hist.o: hist.h hist.o: longbits.h @@ -4418,6 +4479,7 @@ matfunc.o: have_memmv.h matfunc.o: have_newstr.h matfunc.o: have_stdlib.h matfunc.o: have_string.h +matfunc.o: have_unused.h matfunc.o: longbits.h matfunc.o: matfunc.c matfunc.o: md5.h @@ -4533,6 +4595,7 @@ opcodes.o: have_memmv.h opcodes.o: have_newstr.h opcodes.o: have_stdlib.h opcodes.o: have_string.h +opcodes.o: have_unused.h opcodes.o: hist.h opcodes.o: label.h opcodes.o: longbits.h @@ -4633,6 +4696,7 @@ qio.o: have_memmv.h qio.o: have_newstr.h qio.o: have_stdlib.h qio.o: have_string.h +qio.o: have_unused.h qio.o: longbits.h qio.o: nametype.h qio.o: qio.c @@ -4944,6 +5008,7 @@ version.o: have_memmv.h version.o: have_newstr.h version.o: have_stdlib.h version.o: have_string.h +version.o: have_unused.h version.o: longbits.h version.o: md5.h version.o: nametype.h @@ -5067,6 +5132,7 @@ zrand.o: have_memmv.h zrand.o: have_newstr.h zrand.o: have_stdlib.h zrand.o: have_string.h +zrand.o: have_unused.h zrand.o: longbits.h zrand.o: md5.h zrand.o: nametype.h @@ -5093,6 +5159,7 @@ zrandom.o: have_memmv.h zrandom.o: have_newstr.h zrandom.o: have_stdlib.h zrandom.o: have_string.h +zrandom.o: have_unused.h zrandom.o: longbits.h zrandom.o: md5.h zrandom.o: nametype.h diff --git a/addop.c b/addop.c index 903ad75..a3eb98d 100644 --- a/addop.c +++ b/addop.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: addop.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: addop.c,v 29.4 2004/02/23 07:25:16 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/addop.c,v $ * * Under source code control: 1990/02/15 01:48:10 @@ -44,7 +44,7 @@ #define OPCODEALLOCSIZE 100 /* reallocate size for opcodes in functions */ -static long maxopcodes; /* number of opcodes available */ +static unsigned long maxopcodes;/* number of opcodes available */ static long newindex; /* index of new function */ static char *newname; /* name of new function */ static long oldop; /* previous opcode */ @@ -185,7 +185,7 @@ endfunc(void) { register FUNC *fp; /* function just finished */ unsigned long size; /* size of just created function */ - long index; + unsigned long index; if (oldop != OP_RETURN) { addop(OP_UNDEF); @@ -302,7 +302,7 @@ void freefunc(FUNC *fp) { long index; - long i; + unsigned long i; if (fp == NULL) return; @@ -383,7 +383,7 @@ clearopt(void) FUNC * findfunc(long index) { - if ((unsigned long) index >= funccount) { + if (index >= funccount) { math_error("Undefined function"); /*NOTREACHED*/ } diff --git a/blkcpy.c b/blkcpy.c index 05149f6..6b678a1 100644 --- a/blkcpy.c +++ b/blkcpy.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: blkcpy.c,v 29.3 2001/04/10 22:06:46 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: blkcpy.c,v 29.4 2004/02/23 07:47:31 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/blkcpy.c,v $ * * Under source code control: 1997/04/18 20:41:26 @@ -287,13 +287,13 @@ copymat2mat(MATRIX *smat, long ssi, long num, MATRIX *dmat, long dsi) if (num < 0) num = smat->m_size - ssi; - if ((USB32) ssi + num > smat->m_size) + if (ssi + num > smat->m_size) return E_COPY5; if (num == 0) return 0; if (dsi < 0) dsi = 0; - if ((USB32) dsi + num > dmat->m_size) + if (dsi + num > dmat->m_size) return E_COPY7; vtemp = (VALUE *) malloc(num * sizeof(VALUE)); if (vtemp == NULL) { @@ -335,13 +335,13 @@ copyblk2mat(BLOCK *blk, long ssi, long num, MATRIX *dmat, long dsi) return E_COPY2; if (num < 0) num = blk->datalen - ssi; - if ((USB32) ssi + num > blk->datalen) + if (ssi + num > blk->datalen) return E_COPY5; if (num == 0) return 0; if (dsi < 0) dsi = 0; - if ((USB32) dsi + num > dmat->m_size) + if (dsi + num > dmat->m_size) return E_COPY7; op = blk->data + ssi; vtemp = (VALUE *) malloc(num * sizeof(VALUE)); @@ -389,7 +389,7 @@ copymat2blk(MATRIX *smat, long ssi, long num, BLOCK *dblk, long dsi, BOOL norelo num = smat->m_size - ssi; if (num == 0) return 0; - if ((USB32) ssi + num > smat->m_size) + if (ssi + num > smat->m_size) return E_COPY5; if (dsi < 0) dsi = dblk->datalen; @@ -436,11 +436,11 @@ copymat2list(MATRIX *smat, long ssi, long num, LIST *lp, long dsi) num = smat->m_size - ssi; if (num == 0) return 0; - if ((USB32) ssi + num > smat->m_size) + if (ssi + num > smat->m_size) return E_COPY5; if (dsi < 0) dsi = 0; - if ((USB32) dsi + num > lp->l_count) + if (dsi + num > lp->l_count) return E_COPY7; vtemp = (VALUE *) malloc(num * sizeof(VALUE)); if (vtemp == NULL) { @@ -484,11 +484,11 @@ copylist2mat(LIST *lp, long ssi, long num, MATRIX *dmat, long dsi) num = lp->l_count - ssi; if (num == 0) return 0; - if ((USB32) ssi + num > lp->l_count) + if (ssi + num > lp->l_count) return E_COPY5; if (dsi < 0) dsi = 0; - if ((USB32) dsi + num > dmat->m_size) + if (dsi + num > dmat->m_size) return E_COPY7; vtemp = (VALUE *) malloc(num * sizeof(VALUE)); if (vtemp == NULL) { @@ -533,11 +533,11 @@ copylist2list(LIST *slp, long ssi, long num, LIST *dlp, long dsi) num = slp->l_count - ssi; if (num == 0) return 0; - if ((USB32) ssi + num > slp->l_count) + if (ssi + num > slp->l_count) return E_COPY5; if (dsi < 0) dsi = 0; - if ((USB32) dsi + num > dlp->l_count) + if (dsi + num > dlp->l_count) return E_COPY7; vtemp = (VALUE *) malloc(num * sizeof(VALUE)); if (vtemp == NULL) { @@ -572,7 +572,7 @@ copyblk2file(BLOCK *sblk, long ssi, long num, FILEID id, long dsi) { FILEIO *fiop; FILE *fp; - unsigned int numw; + long numw; if (ssi > sblk->datalen) return E_COPY2; @@ -609,7 +609,7 @@ copyfile2blk(FILEID id, long ssi, long num, BLOCK *dblk, long dsi, BOOL noreloc) { FILEIO *fiop; FILE *fp; - unsigned int numw; + long numw; ZVALUE fsize; long filelen; long newlen; @@ -639,7 +639,7 @@ copyfile2blk(FILEID id, long ssi, long num, BLOCK *dblk, long dsi, BOOL noreloc) num = filelen - ssi; if (num == 0) return 0; - if ((USB32) ssi + num > filelen) + if (ssi + num > filelen) return E_COPY5; if (fseek(fp, ssi, 0)) /* using system fseek XXX */ return E_COPYF2; @@ -677,7 +677,7 @@ copystr2file(STRING *str, long ssi, long num, FILEID id, long dsi) { long len; FILEIO *fiop; - unsigned int numw; + long numw; FILE *fp; len = str->s_len; @@ -688,7 +688,7 @@ copystr2file(STRING *str, long ssi, long num, FILEID id, long dsi) num = len - ssi; if (num <= 0) /* Nothing to be copied */ return 0; - if ((USB32) ssi + num > len) + if (ssi + num > len) return E_COPY5; /* Insufficient memory in str */ fiop = findid(id, TRUE); if (fiop == NULL) @@ -726,7 +726,7 @@ copyblk2blk(BLOCK *sblk, long ssi, long num, BLOCK *dblk, long dsi, BOOL noreloc num = sblk->datalen - ssi; if (num == 0) /* Nothing to be copied */ return 0; - if ((unsigned int) ssi + num > sblk->datalen) + if (ssi + num > sblk->datalen) return E_COPY5; if (dsi < 0) dsi = dblk->datalen; @@ -888,7 +888,7 @@ copyostr2blk(char *str,long ssi,long num,BLOCK *dblk,long dsi,BOOL noreloc) if (ssi > len) return E_COPY2; - if (num < 0 || (unsigned long) ssi + num > len) + if (num < 0 || ssi + num > len) num = len - ssi; if (num <= 0) /* Nothing to be copied */ return 0; @@ -991,7 +991,7 @@ copynum2blk(NUMBER *snum, long ssi, long num, BLOCK *dblk, long dsi, BOOL norelo num = snum->num.len - ssi; if (num == 0) /* Nothing to be copied */ return 0; - if ((unsigned long) ssi + num > snum->num.len) + if (ssi + num > snum->num.len) return E_COPY5; if (dsi < 0) dsi = dblk->datalen; @@ -1044,7 +1044,7 @@ copyblk2num(BLOCK *sblk, long ssi, long num, NUMBER *dnum, long dsi, NUMBER **re num = sblk->datalen - ssi; if (num == 0) /* Nothing to be copied */ return 0; - if ((unsigned long) ssi + num > sblk->datalen) + if (ssi + num > sblk->datalen) return E_COPY5; if (dsi < 0) dsi = dnum->num.len; diff --git a/cal/pi.cal b/cal/pi.cal index 1c66fa3..eac5c1f 100644 --- a/cal/pi.cal +++ b/cal/pi.cal @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: pi.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: pi.cal,v 29.3 2004/02/23 06:06:38 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/pi.cal,v $ * * Under source code control: 1991/05/22 21:56:37 @@ -61,7 +61,7 @@ define qpi(epsilon) yn = sqrt2 - 1; an = 6 - 4 * sqrt2; tn = 2; - for (count = 0; count < niter; count++) { + for (count = 0; count < niter; ++count) { ym = yn; am = an; tn *= 4; @@ -104,7 +104,8 @@ define piforever() * Next approximation */ p = k * k; - q = k + k++; + q = k << 1; + ++k; a2 = a; b2 = b; diff --git a/cal/regress.cal b/cal/regress.cal index 25db62a..0abf184 100644 --- a/cal/regress.cal +++ b/cal/regress.cal @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.17 $ - * @(#) $Id: regress.cal,v 29.17 2003/06/10 21:17:55 chongo Exp $ + * @(#) $Revision: 29.18 $ + * @(#) $Id: regress.cal,v 29.18 2004/02/23 05:58:45 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $ * * Under source code control: 1990/02/15 01:50:36 @@ -1002,9 +1002,9 @@ define test_functions() vrfy(strpos(a, "abc") == 1, '946: strpos(a, "abc") == 1'); vrfy(strpos(a, "xyz") == 0, '947: strpos(a, "xyz") == 0'); vrfy(strpos(a, a) == 1, '948: strpos(a, a) == 1'); - if (config("windows")) { - print '949: test skipped for windows systems'; - print '950: test skipped for windows systems'; + if (config("windows") || config("cygwin")) { + print '949: test skipped for windows or cygwin systems'; + print '950: test skipped for windows or cygwin systems'; } else { vrfy(system("") == 0, '949: system("") == 0'); vrfy(system("true") == 0, '950: system("true") == 0'); @@ -2210,6 +2210,7 @@ print '033: read -once test2300'; define test_xx_incdec() { local A, B; + local n; print '2300: Beginning object increment/decrement test'; @@ -2242,6 +2243,20 @@ define test_xx_incdec() vrfy(ckmat(B,1,2,3) == 1, '2314: ckmat(B,1,2,3) == 1'); + n = 1; + print '2315: n = 1'; + vrfy(n + n + n + n++ == 4, + '2316: n + n + n + n++ == 4'); + vrfy(n == 2, '2317: n == 2'); + n = 1; + print '2318: n = 1'; + vrfy(n + n + n++ == 3, '2319: n + n + n++ == 3'); + vrfy(n == 2, '2320: n == 2'); + n = 1; + print '2321: n = 1'; + vrfy(n + n++ == 2, '2322: n + n++ == 3'); + vrfy(n == 2, '2323: n == 2'); + print '2315: Ending object increment/decrement test'; } print '034: parsed test_xx_incdec()'; diff --git a/calc.c b/calc.c index 4c0c355..dc41634 100644 --- a/calc.c +++ b/calc.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.9 $ - * @(#) $Id: calc.c,v 29.9 2003/08/26 04:36:10 chongo Exp $ + * @(#) $Revision: 29.10 $ + * @(#) $Id: calc.c,v 29.10 2004/02/23 09:21:35 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $ * * Under source code control: 1990/02/15 01:48:11 @@ -83,6 +83,8 @@ # define strdup(x) calc_strdup((CONST char *)(x)) #endif /* HAVE_STRDUP */ +#include "have_unused.h" + /* * static definitions and functions @@ -706,7 +708,7 @@ main(int argc, char **argv) */ /*ARGSUSED*/ static void -intint(int arg) +intint(int UNUSED arg) { (void) signal(SIGINT, intint); if (inputwait || (++abortlevel >= ABORT_NOW)) { diff --git a/calc.man b/calc.man index 9b83e3d..47833d7 100644 --- a/calc.man +++ b/calc.man @@ -15,8 +15,8 @@ .\" received a copy with calc; if not, write to Free Software Foundation, Inc. .\" 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. .\" -.\" @(#) $Revision: 29.11 $ -.\" @(#) $Id: calc.man,v 29.11 2003/08/26 04:36:10 chongo Exp $ +.\" @(#) $Revision: 29.12 $ +.\" @(#) $Id: calc.man,v 29.12 2004/02/23 05:21:24 chongo Exp $ .\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $ .\" .\" Under source code control: 1991/07/23 05:48:26 @@ -54,7 +54,7 @@ calc \- arbitrary precision calculator .RB [ calc_cmd\ \&.\|.\|. ] .in -5n .sp -\fI#!${BINDIR}/calc\fP\ \fB\-f\fP\ [other_flags\ \&...] +\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP\ .SH DESCRIPTION \& .br @@ -588,7 +588,7 @@ as in: .sp 1 .in +5n .nf -\fI#!${BINDIR}/calc\fP\ \fB\-f\fP\ [other_flags\ \&...] +\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP\ .fi .in -5n .sp 1 @@ -634,7 +634,7 @@ the file .sp 1 .in +5n .nf -\fI#!${BINDIR}/calc\fP\ \fB\-f\fP\ \&\fB\-q\fP +\fI#!${BINDIR}/calc\fP\ \&\fB\-q\fP \fB\-f\fP\ # # mersenne - an example of a calc \fBshell script file\fP diff --git a/codegen.c b/codegen.c index 4d62bfb..671542e 100644 --- a/codegen.c +++ b/codegen.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.7 $ - * @(#) $Id: codegen.c,v 29.7 2002/07/10 11:51:51 chongo Exp $ + * @(#) $Revision: 29.8 $ + * @(#) $Id: codegen.c,v 29.8 2004/02/23 05:39:35 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/codegen.c,v $ * * Under source code control: 1990/02/15 01:48:13 @@ -1749,6 +1749,8 @@ getrelation(void) rescantoken(); return type; } + if (islvalue(type)) + addop(OP_GETVALUE); (void) getsum(); addop(op); return EXPR_RVALUE; @@ -1788,6 +1790,8 @@ getsum(void) rescantoken(); return type; } + if (islvalue(type)) + addop(OP_GETVALUE); (void) getproduct(); addop(op); type = EXPR_RVALUE; @@ -1817,6 +1821,8 @@ getproduct(void) rescantoken(); return type; } + if (islvalue(type)) + addop(OP_GETVALUE); (void) getorexpr(); addop(op); type = EXPR_RVALUE; @@ -1836,6 +1842,8 @@ getorexpr(void) type = getandexpr(); while (gettoken() == T_OR) { + if (islvalue(type)) + addop(OP_GETVALUE); (void) getandexpr(); addop(OP_OR); type = EXPR_RVALUE; @@ -1867,6 +1875,8 @@ getandexpr(void) rescantoken(); return type; } + if (islvalue(type)) + addop(OP_GETVALUE); (void) getshiftexpr(); addop(op); type = EXPR_RVALUE; @@ -1919,6 +1929,8 @@ getshiftexpr(void) rescantoken(); return type; } + if (islvalue(type)) + addop(OP_GETVALUE); (void) getshiftexpr(); addop(op); return EXPR_RVALUE; diff --git a/config.c b/config.c index 4468240..38b2e02 100644 --- a/config.c +++ b/config.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.10 $ - * @(#) $Id: config.c,v 29.10 2003/08/26 04:36:10 chongo Exp $ + * @(#) $Revision: 29.12 $ + * @(#) $Id: config.c,v 29.12 2004/02/23 05:59:50 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $ * * Under source code control: 1991/07/20 00:21:56 @@ -92,6 +92,7 @@ NAMETYPE configs[] = { {"program", CONFIG_PROGRAM}, {"basename", CONFIG_BASENAME}, {"windows", CONFIG_WINDOWS}, + {"cygwin", CONFIG_CYGWIN}, {"version", CONFIG_VERSION}, {NULL, 0} }; @@ -143,6 +144,11 @@ CONFIG oldstd = { /* backward compatible standard configuration */ TRUE, /* running under windows */ #else FALSE, /* congrats, you are not using windows */ +#endif +#if defined(__CYGWIN__) + TRUE, /* compiled under cygwin */ +#else + FALSE, /* not compiled with cygwin */ #endif NULL /* version */ }; @@ -189,6 +195,11 @@ CONFIG newstd = { /* new non-backward compatible configuration */ TRUE, /* running under windows */ #else FALSE, /* congrats, you are not using windows */ +#endif +#if defined(__CYGWIN__) + TRUE, /* compiled under cygwin */ +#else + FALSE, /* not compiled with cygwin */ #endif NULL /* version */ }; @@ -857,6 +868,10 @@ setconfig(int type, VALUE *vp) math_error("The windows config parameter is read-only"); /*NOTREACHED*/ + case CONFIG_CYGWIN: + math_error("The cygwin config parameter is read-only"); + /*NOTREACHED*/ + case CONFIG_VERSION: math_error("The version config parameter is read-only"); /*NOTREACHED*/ @@ -1239,6 +1254,14 @@ config_value(CONFIG *cfg, int type, VALUE *vp) } return; + case CONFIG_CYGWIN: + if (cfg->cygwin) { + vp->v_num = itoq(1); + } else { + vp->v_num = itoq(0); + } + return; + case CONFIG_VERSION: vp->v_type = V_STR; if (cfg->version == NULL) { diff --git a/config.h b/config.h index ffbb73c..164fb25 100644 --- a/config.h +++ b/config.h @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.13 $ - * @(#) $Id: config.h,v 29.13 2003/08/26 04:36:10 chongo Exp $ + * @(#) $Revision: 29.15 $ + * @(#) $Id: config.h,v 29.15 2004/02/23 06:08:29 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $ * * Under source code control: 1995/11/01 22:20:17 @@ -78,19 +78,20 @@ #define CONFIG_MORE 25 #define CONFIG_BLKMAXPRINT 26 #define CONFIG_BLKVERBOSE 27 -#define CONFIG_BLKBASE 28 -#define CONFIG_BLKFMT 29 +#define CONFIG_BLKBASE 28 +#define CONFIG_BLKFMT 29 #define CONFIG_RESOURCE_DEBUG 30 #define CONFIG_LIB_DEBUG CONFIG_RESOURCE_DEBUG #define CONFIG_CALC_DEBUG 31 #define CONFIG_USER_DEBUG 32 #define CONFIG_VERBOSE_QUIT 33 -#define CONFIG_CTRL_D 34 -#define CONFIG_PROGRAM 35 -#define CONFIG_BASENAME 36 -#define CONFIG_VERSION 37 -#define CONFIG_WINDOWS 38 +#define CONFIG_CTRL_D 34 +#define CONFIG_PROGRAM 35 +#define CONFIG_BASENAME 36 +#define CONFIG_VERSION 37 +#define CONFIG_WINDOWS 38 #define CONFIG_MODE2 39 +#define CONFIG_CYGWIN 40 /* @@ -155,6 +156,7 @@ struct config { char *program; /* our name */ char *base_name; /* basename of our name */ BOOL windows; /* TRUE => running under MS windows */ + BOOL cygwin; /* TRUE => compiled with cygwin */ char *version; /* calc version string */ }; typedef struct config CONFIG; diff --git a/const.c b/const.c index 093b741..b22ba11 100644 --- a/const.c +++ b/const.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: const.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: const.c,v 29.3 2004/02/23 07:50:41 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/const.c,v $ * * Under source code control: 1990/02/15 01:48:14 @@ -34,7 +34,7 @@ #define CONSTALLOCSIZE 400 /* number of constants to allocate */ -static long constcount; /* number of constants defined */ +static unsigned long constcount;/* number of constants defined */ static long constavail; /* number of constants available */ static NUMBER **consttable; /* table of constants */ @@ -92,7 +92,7 @@ addqconstant(NUMBER *q) { register NUMBER **tp; /* pointer to current number */ register NUMBER *t; /* number being tested */ - long index; /* index into constant table */ + unsigned long index; /* index into constant table */ long numlen; /* numerator length */ long denlen; /* denominator length */ HALF numlow; /* bottom value of numerator */ @@ -221,7 +221,7 @@ trimconstants(void) void showconstants(void) { - long index; + unsigned long index; NUMBER **qp; long count; diff --git a/custom/Makefile b/custom/Makefile index b2e1c5b..f3dfedd 100644 --- a/custom/Makefile +++ b/custom/Makefile @@ -18,8 +18,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.20 $ -# @(#) $Id: Makefile,v 29.20 2003/01/14 02:18:45 chongo Exp $ +# @(#) $Revision: 29.21 $ +# @(#) $Id: Makefile,v 29.21 2004/02/23 09:23:08 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile,v $ # # Under source code control: 1997/03/09 02:28:54 @@ -765,6 +765,7 @@ c_argv.o: ../have_memmv.h c_argv.o: ../have_newstr.h c_argv.o: ../have_stdlib.h c_argv.o: ../have_string.h +c_argv.o: ../have_unused.h c_argv.o: ../longbits.h c_argv.o: ../md5.h c_argv.o: ../nametype.h @@ -791,6 +792,7 @@ c_devnull.o: ../have_memmv.h c_devnull.o: ../have_newstr.h c_devnull.o: ../have_stdlib.h c_devnull.o: ../have_string.h +c_devnull.o: ../have_unused.h c_devnull.o: ../longbits.h c_devnull.o: ../md5.h c_devnull.o: ../nametype.h @@ -817,6 +819,7 @@ c_help.o: ../have_memmv.h c_help.o: ../have_newstr.h c_help.o: ../have_stdlib.h c_help.o: ../have_string.h +c_help.o: ../have_unused.h c_help.o: ../longbits.h c_help.o: ../md5.h c_help.o: ../nametype.h @@ -843,6 +846,7 @@ c_pzasusb8.o: ../have_memmv.h c_pzasusb8.o: ../have_newstr.h c_pzasusb8.o: ../have_stdlib.h c_pzasusb8.o: ../have_string.h +c_pzasusb8.o: ../have_unused.h c_pzasusb8.o: ../longbits.h c_pzasusb8.o: ../md5.h c_pzasusb8.o: ../nametype.h @@ -872,6 +876,7 @@ c_sysinfo.o: ../have_memmv.h c_sysinfo.o: ../have_newstr.h c_sysinfo.o: ../have_stdlib.h c_sysinfo.o: ../have_string.h +c_sysinfo.o: ../have_unused.h c_sysinfo.o: ../hist.h c_sysinfo.o: ../longbits.h c_sysinfo.o: ../longlong.h diff --git a/custom/c_argv.c b/custom/c_argv.c index 63a8d3b..4776f6a 100644 --- a/custom/c_argv.c +++ b/custom/c_argv.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: c_argv.c,v 29.2 2000/06/07 14:03:03 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: c_argv.c,v 29.3 2004/02/23 09:19:18 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_argv.c,v $ * * Under source code control: 1997/03/09 20:27:37 @@ -40,6 +40,8 @@ #include "../config.h" #include "../calc.h" +#include "../have_unused.h" + /* * c_argv - a custom function display info about its args * @@ -51,7 +53,7 @@ */ /*ARGSUSED*/ VALUE -c_argv(char *name, int count, VALUE **vals) +c_argv(char UNUSED *name, int count, VALUE **vals) { VALUE result; /* what we will return */ ZVALUE zfilelen; /* length of a file as a ZVALUE */ diff --git a/custom/c_devnull.c b/custom/c_devnull.c index 3e96760..b4da4bc 100644 --- a/custom/c_devnull.c +++ b/custom/c_devnull.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: c_devnull.c,v 29.2 2000/06/07 14:03:03 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: c_devnull.c,v 29.3 2004/02/23 09:19:18 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_devnull.c,v $ * * Under source code control: 1997/03/09 17:49:12 @@ -36,6 +36,8 @@ #include "../value.h" #include "../custom.h" +#include "../have_unused.h" + /* * c_devnull - a custom function that does nothing @@ -45,7 +47,7 @@ */ /*ARGSUSED*/ VALUE -c_devnull(char *name, int count, VALUE **vals) +c_devnull(char UNUSED *name, int UNUSED count, VALUE UNUSED **vals) { VALUE result; /* what we will return */ diff --git a/custom/c_help.c b/custom/c_help.c index d32b8dd..e52019c 100644 --- a/custom/c_help.c +++ b/custom/c_help.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: c_help.c,v 29.2 2000/06/07 14:03:03 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: c_help.c,v 29.3 2004/02/23 09:19:18 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_help.c,v $ * * Under source code control: 1997/03/09 05:25:41 @@ -36,6 +36,8 @@ #include "../value.h" #include "../custom.h" +#include "../have_unused.h" + /* * c_help - custom help function @@ -56,7 +58,7 @@ */ /*ARGSUSED*/ VALUE -c_help(char *name, int count, VALUE **vals) +c_help(char UNUSED *name, int UNUSED count, VALUE **vals) { VALUE result; /* what we will return */ diff --git a/custom/c_pzasusb8.c b/custom/c_pzasusb8.c index e308d4f..6c3111d 100644 --- a/custom/c_pzasusb8.c +++ b/custom/c_pzasusb8.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: c_pzasusb8.c,v 29.2 2000/06/07 14:03:03 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: c_pzasusb8.c,v 29.3 2004/02/23 09:19:18 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_pzasusb8.c,v $ * * Under source code control: 1999/10/06 03:12:25 @@ -37,6 +37,8 @@ #include "../custom.h" #include "../zmath.h" +#include "../have_unused.h" + /* * c_pzasusb8 - print numereator as a string of USB8s * @@ -49,7 +51,7 @@ */ /*ARGSUSED*/ VALUE -c_pzasusb8(char *name, int count, VALUE **vals) +c_pzasusb8(char UNUSED *name, int UNUSED count, VALUE **vals) { VALUE result; /* what we will return */ ZVALUE z; /* numerator of the value */ diff --git a/custom/c_sysinfo.c b/custom/c_sysinfo.c index 50cb7b0..f7b43f7 100644 --- a/custom/c_sysinfo.c +++ b/custom/c_sysinfo.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.6 $ - * @(#) $Id: c_sysinfo.c,v 29.6 2003/06/10 21:44:17 chongo Exp $ + * @(#) $Revision: 29.7 $ + * @(#) $Id: c_sysinfo.c,v 29.7 2004/02/23 09:19:18 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_sysinfo.c,v $ * * Under source code control: 1997/03/09 23:14:40 @@ -53,6 +53,8 @@ #include "../zrand.h" #include "../zrandom.h" +#include "../have_unused.h" + /* * sys_info - names and values of selected #defines @@ -179,7 +181,7 @@ static void dump_mening_value(void); /* custom("sysinfo", 2) */ */ /*ARGSUSED*/ VALUE -c_sysinfo(char *name, int count, VALUE **vals) +c_sysinfo(char UNUSED *name, int count, VALUE **vals) { VALUE result; /* what we will return */ struct infoname *p; /* current infoname */ diff --git a/file.c b/file.c index c62627d..ea01092 100644 --- a/file.c +++ b/file.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.7 $ - * @(#) $Id: file.c,v 29.7 2001/04/10 22:06:46 chongo Exp $ + * @(#) $Revision: 29.8 $ + * @(#) $Id: file.c,v 29.8 2004/02/23 07:53:12 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/file.c,v $ * * Under source code control: 1991/07/20 00:21:56 @@ -810,7 +810,7 @@ idprintf(FILEID id, char *fmt, int count, VALUE **vals) VALUE *vp; char *str; int ch; - unsigned long len; + long len; int oldmode, newmode; long olddigits, newdigits; long width, precision; diff --git a/func.c b/func.c index 7db75d5..2e3c828 100644 --- a/func.c +++ b/func.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.12 $ - * @(#) $Id: func.c,v 29.12 2002/12/29 09:20:25 chongo Exp $ + * @(#) $Revision: 29.13 $ + * @(#) $Id: func.c,v 29.13 2004/02/23 07:25:41 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $ * * Under source code control: 1990/02/15 01:48:15 @@ -84,6 +84,7 @@ #endif #include "have_const.h" +#include "have_unused.h" #include "calc.h" #include "calcerr.h" #include "opcodes.h" @@ -307,7 +308,7 @@ f_display(int count, VALUE **vals) /*ARGSUSED*/ static VALUE -f_null(int count, VALUE **vals) +f_null(int UNUSED count, VALUE UNUSED **vals) { VALUE res; @@ -4729,7 +4730,7 @@ f_list(int count, VALUE **vals) /*ARGSUSED*/ static VALUE -f_assoc(int count, VALUE **vals) +f_assoc(int UNUSED count, VALUE UNUSED **vals) { VALUE result; diff --git a/have_unused.c b/have_unused.c new file mode 100644 index 0000000..f929467 --- /dev/null +++ b/have_unused.c @@ -0,0 +1,89 @@ +/* + * have_unused - Determine if we want or can support the unused attribute + * + * Copyright (C) 2004 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. + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + * @(#) $Revision: 29.2 $ + * @(#) $Id: have_unused.c,v 29.2 2004/02/23 08:35:42 chongo Exp $ + * @(#) $Source: /usr/local/src/cmd/calc/RCS/have_unused.c,v $ + * + * Under source code control: 2004/02/22 22:36:10 + * File existed as early as: 2004 + * + * chongo /\oo/\ http://www.isthe.com/chongo/ + * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ + */ + +/* + * usage: + * have_unused + * + * Not all compilers support the unused attribute, so this may not compile + * on your system. + * + * This prog outputs several defines: + * + * HAVE_UNUSED + * defined ==> ok to use unused + * undefined ==> do not use unused + * + * UNUSED + * unused ==> use unused + * (nothing) ==> unused not used + */ + + +#include + +#if !defined(HAVE_NO_UNUSED) + +/* make sure that we can use the __attribute__((unused)) in #define's */ +#undef UNUSED +#define UNUSED __attribute__((unused)) + +/* + * unused_str - a function with an unused argument + */ +static char * +unused_str(char UNUSED *str) +{ + return "__attribute__((unused))"; +} + +#endif /* !HAVE_NO_UNUSED */ + + +int +main(void) +{ +#if defined(HAVE_NO_UNUSED) + + printf("#undef HAVE_UNUSED /* no */\n"); + printf("#undef UNUSED\n"); + printf("#define UNUSED /* no */\n"); + +#else /* HAVE_NO_UNUSED */ + + printf("#define HAVE_UNUSED /* yes */\n"); + printf("#undef UNUSED\n"); + printf("#define UNUSED %s /* yes */\n", unused_str(NULL)); + +#endif /* HAVE_NO_UNUSED */ + + /* exit(0); */ + return 0; +} diff --git a/help/config b/help/config index 97aafe6..91e9e4d 100644 --- a/help/config +++ b/help/config @@ -49,6 +49,7 @@ Configuration parameters "program" Read-only calc program or shell script path "basename" Read-only basename of the program value "windows" Read-only indicator of MS windows + "cygwin" TRUE=>calc compiled with cygwin, Read-only "version" Read-only calc version The "all" config value allows one to save/restore the configuration @@ -699,6 +700,16 @@ Detailed config descriptions Returns TRUE if you are running on a MS windows system, false if you are running on an operating system that does not hate you. + This config parameter is read-only and cannot be set. + + =-= + + config("cygwin") <== NOTE: This is a read-only config value + + Returns TRUE if you calc was compiled with cygwin, false otherwise. + + This config parameter is read-only and cannot be set. + =-= config("version") <== NOTE: This is a read-only config value @@ -725,8 +736,8 @@ Detailed config descriptions ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.7 $ -## @(#) $Id: config,v 29.7 2002/12/29 08:32:04 chongo Exp $ +## @(#) $Revision: 29.8 $ +## @(#) $Id: config,v 29.8 2004/02/23 05:59:22 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/config,v $ ## ## Under source code control: 1991/07/21 04:37:17 diff --git a/hist.c b/hist.c index dfb5ca5..12f7aa3 100644 --- a/hist.c +++ b/hist.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: hist.c,v 29.3 2001/03/17 21:31:47 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: hist.c,v 29.4 2004/02/23 07:54:24 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/hist.c,v $ * * Under source code control: 1993/05/02 20:09:19 @@ -67,6 +67,8 @@ # include #endif +#include "have_unused.h" + #if !defined(USE_READLINE) extern FILE *curstream(void); @@ -1489,7 +1491,7 @@ my_stifle_history (void) int -hist_init(char *filename) +hist_init(char UNUSED *filename) { /* used when parsing conditionals in ~/.inputrc */ rl_readline_name = "calc"; diff --git a/matfunc.c b/matfunc.c index 9e87b36..e1429a6 100644 --- a/matfunc.c +++ b/matfunc.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: matfunc.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: matfunc.c,v 29.3 2004/02/23 07:55:54 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/matfunc.c,v $ * * Under source code control: 1990/02/15 01:48:18 @@ -36,6 +36,8 @@ #include "zrand.h" #include "calcerr.h" +#include "have_unused.h" + extern long irand(long s); static void matswaprow(MATRIX *m, long r1, long r2); @@ -853,7 +855,7 @@ matfrac(MATRIX *m) */ /*ARGSUSED*/ VALUE * -matindex(MATRIX *mp, BOOL create, long dim, VALUE *indices) +matindex(MATRIX *mp, BOOL UNUSED create, long dim, VALUE *indices) { NUMBER *q; /* index value */ VALUE *vp; diff --git a/md5.c b/md5.c index f242579..1d00f73 100644 --- a/md5.c +++ b/md5.c @@ -10,8 +10,8 @@ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * @(#) $Revision: 29.1 $ - * @(#) $Id: md5.c,v 29.1 1999/12/14 09:16:12 chongo Exp $ + * @(#) $Revision: 29.2 $ + * @(#) $Id: md5.c,v 29.2 2004/02/23 07:58:06 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/md5.c,v $ * * This file is not covered under version 2.1 of the GNU LGPL. @@ -432,7 +432,7 @@ static void MD5_note(int special, HASH *state) { MD5_CTX *dig = &state->h_union.h_md5; /* digest state */ - int i; + unsigned int i; /* * change state to reflect a special value @@ -463,7 +463,7 @@ static void MD5_type(int type, HASH *state) { MD5_CTX *dig = &state->h_union.h_md5; /* digest state */ - int i; + unsigned int i; /* * ignore NUMBER and COMPLEX @@ -531,7 +531,7 @@ MD5_final_state(HASH *state) { MD5_CTX *dig = &state->h_union.h_md5; /* digest state */ ZVALUE ret; /* return ZVALUE of completed hash state */ - int i; + unsigned int i; /* * malloc and initialize if state is NULL @@ -571,7 +571,7 @@ MD5_final_state(HASH *state) } #endif - for (i=0; i < ret.len; ++i) { + for (i=0; i < (unsigned int)ret.len; ++i) { ret.v[ret.len-i-1] = ((HALF*)dig->digest)[i]; } diff --git a/obj.c b/obj.c index b287199..d5b9ce4 100644 --- a/obj.c +++ b/obj.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: obj.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: obj.c,v 29.3 2004/02/23 09:13:15 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/obj.c,v $ * * Under source code control: 1990/02/15 01:48:19 @@ -115,7 +115,7 @@ static struct objectinfo { {1, A_VALUE, ERR_NONE, "backslash", "unary backslash op"}, {2, A_VALUE, ERR_NONE, "setminus", "binary backslash op"}, {1, A_VALUE, ERR_NONE, "plus", "unary + op"}, - {0, 0, 0, NULL} + {0, 0, 0, NULL, NULL} }; diff --git a/opcodes.c b/opcodes.c index 50d0082..d29274d 100644 --- a/opcodes.c +++ b/opcodes.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: opcodes.c,v 29.4 2001/04/25 07:16:26 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: opcodes.c,v 29.5 2004/02/23 07:34:08 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/opcodes.c,v $ * * Under source code control: 1990/02/15 01:48:19 @@ -48,6 +48,8 @@ #include "block.h" #include "string.h" +#include "have_unused.h" + #define QUICKLOCALS 20 /* local vars to handle quickly */ @@ -115,7 +117,7 @@ extern void setconfig(int type, VALUE *vp); void initstack(void) { - int i; + unsigned int i; /* on first init, setup the stack array */ if (stack == NULL) { @@ -163,7 +165,7 @@ o_localaddr(FUNC *fp, VALUE *locals, long index) /*ARGSUSED*/ static void -o_globaladdr(FUNC *fp, GLOBAL *sp) +o_globaladdr(FUNC UNUSED *fp, GLOBAL *sp) { if (sp == NULL) { math_error("Global variable \"%s\" not initialized", sp->g_name); @@ -178,9 +180,9 @@ o_globaladdr(FUNC *fp, GLOBAL *sp) /*ARGSUSED*/ static void -o_paramaddr(FUNC *fp, int argcount, VALUE *args, long index) +o_paramaddr(FUNC UNUSED *fp, int argcount, VALUE *args, long index) { - if ((unsigned long)index >= argcount) { + if ((long)index >= argcount) { math_error("Bad parameter index"); /*NOTREACHED*/ } @@ -210,7 +212,7 @@ o_localvalue(FUNC *fp, VALUE *locals, long index) /*ARGSUSED*/ static void -o_globalvalue(FUNC *fp, GLOBAL *sp) +o_globalvalue(FUNC UNUSED *fp, GLOBAL *sp) { if (sp == NULL) { math_error("Global variable not defined"); @@ -222,9 +224,9 @@ o_globalvalue(FUNC *fp, GLOBAL *sp) /*ARGSUSED*/ static void -o_paramvalue(FUNC *fp, int argcount, VALUE *args, long index) +o_paramvalue(FUNC UNUSED *fp, int argcount, VALUE *args, long index) { - if ((unsigned long)index >= argcount) { + if ((long)index >= argcount) { math_error("Bad parameter index"); /*NOTREACHED*/ } @@ -267,7 +269,7 @@ o_argvalue(FUNC *fp, int argcount, VALUE *args) /*ARGSUSED*/ static void -o_number(FUNC *fp, long arg) +o_number(FUNC UNUSED *fp, long arg) { NUMBER *q; @@ -285,7 +287,7 @@ o_number(FUNC *fp, long arg) /*ARGSUSED*/ static void -o_imaginary(FUNC *fp, long arg) +o_imaginary(FUNC UNUSED *fp, long arg) { NUMBER *q; COMPLEX *c; @@ -312,7 +314,7 @@ o_imaginary(FUNC *fp, long arg) /*ARGSUSED*/ static void -o_string(FUNC *fp, long arg) +o_string(FUNC UNUSED *fp, long arg) { stack++; stack->v_str = slink(findstring(arg)); @@ -332,7 +334,7 @@ o_undef(void) /*ARGSUSED*/ static void -o_matcreate(FUNC *fp, long dim) +o_matcreate(FUNC UNUSED *fp, long dim) { register MATRIX *mp; /* matrix being defined */ NUMBER *num1; /* first number from stack */ @@ -400,7 +402,7 @@ o_matcreate(FUNC *fp, long dim) /*ARGSUSED*/ static void -o_eleminit(FUNC *fp, long index) +o_eleminit(FUNC UNUSED *fp, long index) { VALUE *vp; static VALUE *oldvp; @@ -501,7 +503,7 @@ o_eleminit(FUNC *fp, long index) */ /*ARGSUSED*/ static void -o_indexaddr(FUNC *fp, long dim, long writeflag) +o_indexaddr(FUNC UNUSED *fp, long dim, long writeflag) { int i; BOOL flag; @@ -653,7 +655,7 @@ o_indexaddr(FUNC *fp, long dim, long writeflag) /*ARGSUSED*/ static void -o_elemaddr(FUNC *fp, long index) +o_elemaddr(FUNC UNUSED *fp, long index) { VALUE *vp; MATRIX *mp; @@ -708,7 +710,7 @@ o_elemvalue(FUNC *fp, long index) /*ARGSUSED*/ static void -o_objcreate(FUNC *fp, long arg) +o_objcreate(FUNC UNUSED *fp, long arg) { stack++; stack->v_type = V_OBJ; @@ -2558,7 +2560,7 @@ o_return(void) /*ARGSUSED*/ static void -o_jumpz(FUNC *fp, BOOL *dojump) +o_jumpz(FUNC UNUSED *fp, BOOL *dojump) { VALUE *vp; int i; /* result of comparison */ @@ -2582,7 +2584,7 @@ o_jumpz(FUNC *fp, BOOL *dojump) /*ARGSUSED*/ static void -o_jumpnz(FUNC *fp, BOOL *dojump) +o_jumpnz(FUNC UNUSED *fp, BOOL *dojump) { VALUE *vp; int i; /* result of comparison */ @@ -2609,7 +2611,7 @@ o_jumpnz(FUNC *fp, BOOL *dojump) */ /*ARGSUSED*/ static void -o_jumpnn(FUNC *fp, BOOL *dojump) +o_jumpnn(FUNC UNUSED *fp, BOOL *dojump) { if (stack->v_addr->v_type) { *dojump = TRUE; @@ -2620,7 +2622,7 @@ o_jumpnn(FUNC *fp, BOOL *dojump) /*ARGSUSED*/ static void -o_condorjump(FUNC *fp, BOOL *dojump) +o_condorjump(FUNC UNUSED *fp, BOOL *dojump) { VALUE *vp; @@ -2646,7 +2648,7 @@ o_condorjump(FUNC *fp, BOOL *dojump) /*ARGSUSED*/ static void -o_condandjump(FUNC *fp, BOOL *dojump) +o_condandjump(FUNC UNUSED *fp, BOOL *dojump) { VALUE *vp; @@ -2677,7 +2679,7 @@ o_condandjump(FUNC *fp, BOOL *dojump) */ /*ARGSUSED*/ static void -o_casejump(FUNC *fp, BOOL *dojump) +o_casejump(FUNC UNUSED *fp, BOOL *dojump) { VALUE *v1, *v2; int r; @@ -2699,7 +2701,7 @@ o_casejump(FUNC *fp, BOOL *dojump) /*ARGSUSED*/ static void -o_jump(FUNC *fp, BOOL *dojump) +o_jump(FUNC UNUSED *fp, BOOL *dojump) { *dojump = TRUE; } @@ -2719,7 +2721,7 @@ o_usercall(FUNC *fp, long index, long argcount) /*ARGSUSED*/ static void -o_call(FUNC *fp, long index, long argcount) +o_call(FUNC UNUSED *fp, long index, long argcount) { VALUE result; @@ -3073,7 +3075,7 @@ o_rightshift(void) /*ARGSUSED*/ static void -o_debug(FUNC *fp, long line) +o_debug(FUNC UNUSED *fp, long line) { funcline = line; if (abortlevel >= ABORT_STATEMENT) { @@ -3104,7 +3106,7 @@ o_printresult(void) /*ARGSUSED*/ static void -o_print(FUNC *fp, long flags) +o_print(FUNC UNUSED *fp, long flags) { VALUE *vp; @@ -3138,7 +3140,7 @@ o_printspace(void) /*ARGSUSED*/ static void -o_printstring(FUNC *fp, long index) +o_printstring(FUNC UNUSED *fp, long index) { STRING *s; char *cp; @@ -3437,7 +3439,7 @@ o_initfill(void) static void o_show(FUNC *fp, long arg) { - int size; + unsigned int size; switch((int) arg) { case 1: showbuiltins(); return; @@ -3662,7 +3664,7 @@ calculate(FUNC *fp, int argcount) long oldline; /* old value of line counter */ unsigned int opnum; /* current opcode number */ int origargcount; /* original number of arguments */ - int i; /* loop counter */ + unsigned int i; /* loop counter */ BOOL dojump; /* TRUE if jump is to occur */ char *oldname; /* old function name being executed */ VALUE *beginstack; /* beginning of stack frame */ @@ -3677,7 +3679,7 @@ calculate(FUNC *fp, int argcount) go = TRUE; ++calc_depth; origargcount = argcount; - while (argcount < fp->f_paramcount) { + while ((unsigned)argcount < fp->f_paramcount) { stack++; stack->v_type = V_NULL; stack->v_subtype = V_NOSUBTYPE; diff --git a/qfunc.c b/qfunc.c index e1f3cae..f71abbe 100644 --- a/qfunc.c +++ b/qfunc.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.5 $ - * @(#) $Id: qfunc.c,v 29.5 2003/01/26 19:41:35 chongo Exp $ + * @(#) $Revision: 29.6 $ + * @(#) $Id: qfunc.c,v 29.6 2004/02/23 07:59:46 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qfunc.c,v $ * * Under source code control: 1990/02/15 01:48:20 @@ -1740,7 +1740,7 @@ qgcdrem(NUMBER *q1, NUMBER *q2) NUMBER * qlowfactor(NUMBER *q1, NUMBER *q2) { - long count; + unsigned long count; if (qisfrac(q1) || qisfrac(q2)) { math_error("Non-integers for lowfactor"); diff --git a/qio.c b/qio.c index 5b74558..cb51449 100644 --- a/qio.c +++ b/qio.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: qio.c,v 29.4 2002/12/29 09:20:25 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: qio.c,v 29.5 2004/02/23 09:10:59 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qio.c,v $ * * Under source code control: 1993/07/30 19:42:46 @@ -32,6 +32,8 @@ #include "config.h" #include "args.h" +#include "have_unused.h" + #define PUTCHAR(ch) math_chr(ch) #define PUTSTR(str) math_str(str) @@ -299,7 +301,7 @@ qprintff(NUMBER *q, long width, long precision) */ /*ARGSUSED*/ void -qprintfe(NUMBER *q, long width, long precision) +qprintfe(NUMBER *q, long UNUSED width, long precision) { long exponent; NUMBER q2; diff --git a/qmath.c b/qmath.c index 882055a..0a10245 100644 --- a/qmath.c +++ b/qmath.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: qmath.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: qmath.c,v 29.4 2004/02/23 08:07:43 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qmath.c,v $ * * Under source code control: 1990/02/15 01:48:21 @@ -1296,7 +1296,7 @@ qreli(NUMBER *q, long n) if (n == 0) return (q->num.sign ? -1 : 0); - if (q->num.sign != n < 0) + if (q->num.sign != (n < 0)) return ((n < 0) ? 1 : -1); itoz(n, &z1); diff --git a/qtrans.c b/qtrans.c index 5cc72a3..fc174ec 100644 --- a/qtrans.c +++ b/qtrans.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: qtrans.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: qtrans.c,v 29.4 2004/02/23 08:12:43 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qtrans.c,v $ * * Under source code control: 1990/02/15 01:48:22 @@ -479,7 +479,8 @@ qacos(NUMBER *q, NUMBER *epsilon) NUMBER * qatan(NUMBER *q, NUMBER *epsilon) { - long m, k, i, d; + long m, k, i; + FULL d; ZVALUE X, D, DD, sum, mul, term, ztmp1, ztmp2; NUMBER *qtmp, *res; BOOL sign; diff --git a/shs.c b/shs.c index 7f53af1..0b4c214 100644 --- a/shs.c +++ b/shs.c @@ -31,8 +31,8 @@ * Based on Version 2.11 (09 Mar 1995) from Landon Curt Noll's * (http://www.isthe.com/chongo/) shs hash program. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: shs.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: shs.c,v 29.3 2004/02/23 08:14:15 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/shs.c,v $ * * This file is not covered under version 2.1 of the GNU LGPL. @@ -286,7 +286,7 @@ shsUpdate(HASH *state, USB8 *buffer, USB32 count) USB32 datalen = dig->datalen; USB32 cpylen; #if CALC_BYTE_ORDER == LITTLE_ENDIAN - int i; + unsigned int i; #endif /* @@ -365,7 +365,7 @@ shsFinal(HASH *state) USB32 highBitcount; USB8 *data = (USB8 *) dig->data; #if CALC_BYTE_ORDER == LITTLE_ENDIAN - int i; + unsigned int i; #endif /* @@ -433,7 +433,7 @@ shs_chkpt(HASH *state) { SHS_INFO *dig = &state->h_union.h_shs; /* digest state */ #if CALC_BYTE_ORDER == LITTLE_ENDIAN - int i; + unsigned int i; #endif /* @@ -478,7 +478,7 @@ static void shs_note(int special, HASH *state) { SHS_INFO *dig = &state->h_union.h_shs; /* digest state */ - int i; + unsigned int i; /* * change state to reflect a special value @@ -509,7 +509,7 @@ static void shs_type(int type, HASH *state) { SHS_INFO *dig = &state->h_union.h_shs; /* digest state */ - int i; + unsigned int i; /* * ignore NUMBER and COMPLEX diff --git a/shs1.c b/shs1.c index ae9f8f6..c4974f4 100644 --- a/shs1.c +++ b/shs1.c @@ -22,8 +22,8 @@ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: shs1.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: shs1.c,v 29.3 2004/02/23 08:15:52 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/shs1.c,v $ * * This file is not covered under version 2.1 of the GNU LGPL. @@ -261,7 +261,7 @@ shs1Update(HASH *state, USB8 *buffer, USB32 count) USB32 datalen = dig->datalen; USB32 cpylen; #if CALC_BYTE_ORDER == LITTLE_ENDIAN - int i; + unsigned int i; #endif /* @@ -341,7 +341,7 @@ shs1Final(HASH *state) USB32 highBitcount; USB8 *data = (USB8 *) dig->data; #if CALC_BYTE_ORDER == LITTLE_ENDIAN - int i; + unsigned int i; #endif /* Pad to end of chunk */ @@ -411,7 +411,7 @@ shs1_chkpt(HASH *state) { SHS1_INFO *dig = &state->h_union.h_shs1; /* digest state */ #if CALC_BYTE_ORDER == LITTLE_ENDIAN - int i; + unsigned int i; #endif /* @@ -455,7 +455,7 @@ static void shs1_note(int special, HASH *state) { SHS1_INFO *dig = &state->h_union.h_shs1; /* digest state */ - int i; + unsigned int i; /* * change state to reflect a special value @@ -486,7 +486,7 @@ static void shs1_type(int type, HASH *state) { SHS1_INFO *dig = &state->h_union.h_shs1; /* digest state */ - int i; + unsigned int i; /* * ignore NUMBER and COMPLEX diff --git a/string.c b/string.c index 48ecdf4..d5cb2a9 100644 --- a/string.c +++ b/string.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: string.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: string.c,v 29.3 2004/02/23 08:18:27 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/string.c,v $ * * Under source code control: 1990/02/15 01:48:10 @@ -184,7 +184,7 @@ namestr(STRINGHEAD *hp, long n) { register char *str; /* current string */ - if ((unsigned long)n >= hp->h_count) + if (n >= hp->h_count) return ""; str = hp->h_list; while (*str) { diff --git a/version.c b/version.c index 00c08a5..8ab7dc8 100644 --- a/version.c +++ b/version.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.48 $ - * @(#) $Id: version.c,v 29.48 2003/08/26 04:35:32 chongo Exp $ + * @(#) $Revision: 29.49 $ + * @(#) $Id: version.c,v 29.49 2004/02/23 08:23:19 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $ * * Under source code control: 1990/05/22 11:00:58 @@ -43,10 +43,12 @@ static char *program; # include "calc.h" #endif +#include "have_unused.h" + #define MAJOR_VER 2 /* major version */ #define MINOR_VER 11 /* minor version */ -#define MAJOR_PATCH 8 /* patch level or 0 if no patch */ -#define MINOR_PATCH 1 /* test number or 0 if no minor patch */ +#define MAJOR_PATCH 9 /* patch level or 0 if no patch */ +#define MINOR_PATCH 0 /* test number or 0 if no minor patch */ /* @@ -96,8 +98,9 @@ char *Copyright = "\n" #if !defined(HAVE_SNPRINTF) /* Simulate snprintf with vsprintf, hoping that BUFSIZ is large enough. */ #include +/*ARGSUSED*/ int -snprintf (char *buf, size_t n, const char *fmt, ...) +snprintf (char *buf, size_t UNUSED n, const char *fmt, ...) { int retval; va_list arg; diff --git a/win32/have_unused.h b/win32/have_unused.h new file mode 100644 index 0000000..986cded --- /dev/null +++ b/win32/have_unused.h @@ -0,0 +1,16 @@ +/* + * DO NOT EDIT -- generated by the Makefile + */ + + +#if !defined(__HAVE_UNUSED_H__) +#define __HAVE_UNUSED_H__ + + +/* do we have/want the unused attribute? */ +#define HAVE_UNUSED /* yes */ +#undef UNUSED +#define UNUSED __attribute__((unused)) /* yes */ + + +#endif /* !__HAVE_UNUSED_H__ */ diff --git a/zrand.c b/zrand.c index 12b1e4d..c9a24ad 100644 --- a/zrand.c +++ b/zrand.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.5 $ - * @(#) $Id: zrand.c,v 29.5 2003/01/14 00:54:24 chongo Exp $ + * @(#) $Revision: 29.6 $ + * @(#) $Id: zrand.c,v 29.6 2004/02/23 08:22:22 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zrand.c,v $ * * Under source code control: 1995/01/07 09:45:25 @@ -357,6 +357,7 @@ #include "zrand.h" #include "have_const.h" +#include "have_unused.h" /* @@ -860,7 +861,7 @@ randreseed64(ZVALUE seed, ZVALUE *res) /* * form chunk mod 2^64 */ - if (chunk.len > SHALFS) { + if (chunk.len > (SB32)SHALFS) { /* result is too large, reduce to 64 bits */ v64 = alloc(SHALFS); memcpy(v64, chunk.v, SHALFS*sizeof(HALF)); @@ -2104,7 +2105,7 @@ randcmp(CONST RAND *s1, CONST RAND *s2) */ /*ARGSUSED*/ void -randprint(CONST RAND *state, int flags) +randprint(CONST RAND UNUSED *state, int UNUSED flags) { math_str("RAND state"); } diff --git a/zrandom.c b/zrandom.c index 7f41388..63ea813 100644 --- a/zrandom.c +++ b/zrandom.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: zrandom.c,v 29.4 2002/12/29 06:35:08 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: zrandom.c,v 29.5 2004/02/23 09:12:13 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zrandom.c,v $ * * Under source code control: 1997/02/15 04:01:56 @@ -1084,6 +1084,7 @@ #include "zrandom.h" #include "have_const.h" +#include "have_unused.h" /* @@ -2489,7 +2490,7 @@ randomcmp(CONST RANDOM *s1, CONST RANDOM *s2) */ /*ARGSUSED*/ void -randomprint(CONST RANDOM *state, int flags) +randomprint(CONST RANDOM UNUSED *state, int UNUSED flags) { math_str("RANDOM state"); }