Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package calc for openSUSE:Factory checked in at 2023-02-16 16:55:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/calc (Old) and /work/SRC/openSUSE:Factory/.calc.new.22824 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "calc" Thu Feb 16 16:55:52 2023 rev:33 rq:1065983 version:2.14.1.3 Changes: -------- --- /work/SRC/openSUSE:Factory/calc/calc.changes 2022-12-01 17:22:31.722661606 +0100 +++ /work/SRC/openSUSE:Factory/.calc.new.22824/calc.changes 2023-02-16 16:56:05.570758411 +0100 @@ -1,0 +2,9 @@ +Wed Feb 15 14:30:01 UTC 2023 - Michael Vetter <[email protected]> + +- Update to 2.14.1.3: + * Fixed missing <string.h include in have_fpos_pos.c. + * Change calc version from 2.14.1.2 to 2.14.2.3 as part of a test to + build calc RPMs on a reference RHEL8.7 platform (formerly a RHEL7.9 + platform). + +------------------------------------------------------------------- Old: ---- calc-2.14.1.2.tar.bz2 New: ---- calc-2.14.1.3.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ calc.spec ++++++ --- /var/tmp/diff_new_pack.ILLj83/_old 2023-02-16 16:56:06.162760778 +0100 +++ /var/tmp/diff_new_pack.ILLj83/_new 2023-02-16 16:56:06.170760810 +0100 @@ -1,7 +1,7 @@ # # spec file for package calc # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,10 +16,10 @@ # -%define soname 2_14_1_2 +%define soname 2_14_1_3 %define libname libcalc%{soname} Name: calc -Version: 2.14.1.2 +Version: 2.14.1.3 Release: 0 Summary: C-style arbitrary precision calculator License: LGPL-2.1-only ++++++ calc-2.14.1.2.tar.bz2 -> calc-2.14.1.3.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/CHANGES new/calc-2.14.1.3/CHANGES --- old/calc-2.14.1.2/CHANGES 2022-11-29 22:02:33.000000000 +0100 +++ new/calc-2.14.1.3/CHANGES 2023-02-15 00:40:58.000000000 +0100 @@ -1,3 +1,134 @@ +The following are the changes from calc version 2.14.2.3 to date: + + Fixed missing <string.h include in have_fpos_pos.c. + + Change calc version from 2.14.1.2 to 2.14.2.3 as part of a test to + build calc RPMs on a reference RHEL8.7 platform (formerly a RHEL7.9 + platform). + + +The following are the changes from calc version 2.14.2.0 to 2.14.1.2: + + Attempted to address a paranoid compiler warning -Wmaybe-uninitialized + in swap_HALF_in_ZVALUE() where the gcc compiler seems to ignore the + fact that calling not_reached() above the call to zcopyval() + should prevent dest from being NULL to the 1st zcopyval() call. + Thanks to <GitHub user mattdm> for raising this potential concern. + + Fixed a -Wuse-after-free warning that identified a call to realloc() + in find_tty_state() could move the fd_setup array. Thanks goes to + <GitHub user mattdm> for reporting this bug! + + In find_tty_state(), we changed how we expand fd_orig as an original + pre-modified copy of fd_setup. We realloc the fd_orig array and copy + the fd_setup into it first, before touching the fd_setup array. + + In pseudo_seed(), we removed a call to setjmp() that was only + there to add more information to mix into the seed. For compilers + such as gcc that used -Wclobbered, the call to setjmp() gave the + impression that the hash_val might be clobbered by a longjmp(). + Where there is no longjmp() that would use the previous setjmp(), + the gcc compiler has nil ways to notice that. So to avoid confusion + we removed the setjmp() call. Thanks to <GitHub user mattdm> for + raising this potential concern. + + Added config("tilde_space", boolean). The "tilde_space" controls + whether or not a space (' ') is printed after leading tilde ('~'). + By default, config("tilde_space") is false. + + For example, with the default, config("tilde_space", 0): + + ; 1/3 + ~0.33333333333333333333 + ; sqrt(7 + 5i,1e-100) + ~2.79305614578749801863+~0.89507688693280053094i + + With config("tilde_space", 1): + + ; 1/3 + ~ 0.33333333333333333333 + ; sqrt(7 + 5i,1e-100) + ~ 2.79305614578749801863+~ 0.89507688693280053094i + + NOTE: Use of config("tilde_space", 1) can break printing and scanning + of complex values via "%c". + + To enable "tilde_space", use config("tilde_space", 1) on the + command line and/or use config("tilde_space", 1),; in your ~/.calcrc. + Thanks goes to <GitHub use ljramalho> for this suggestion. + + Added config("tilde_space", boolean) to help/config, along with + a few few minor text improvements. Updated cal/regress to test + config("tilde_space"). + + For example, with the default, config("tilde_space", 0): + + ; pi(1e-50) + ~3.14159265358979323846 + + With config("tilde_space", 1): + + ; pi(1e-50) + ~ 3.14159265358979323846 + + Added config("fraction_space", boolean). The "fraction_space" controls + whether or not a space (' ') is printed before and after fractions. + By default, config("fraction_space") is false. + + For example, with the default, config("fraction_space", 0): + + ; base(1/3), + ; 1/7 + 1/7 + + With config("fraction_space", 1): + + ; base(1/3), + ; 1/7 + 1 / 7 + + NOTE: Use of config("fraction_space", 1) can break printing and scanning + of fractional values via "%r". + + NOTE: Use of config("fraction_space", 1) can break printing and scanning + of complex values via "%c". + + Added config("fraction_space", boolean) to help/config, along with + a few few minor text improvements. Updated cal/regress to test + config("tilde_space"). + + Added config("complex_space", boolean). The "complex_space" controls + whether or not a space (' ') is printed before and after the + or - + in complex values. + + By default, config("complex_space") is false. + + For example, with the default, config("complex_space", 0): + + ; asin(2) + 1.57079632679489661923-1.31695789692481670863i + + With config("complex_space", 1): + + ; asin(2) + 1.57079632679489661923 - 1.31695789692481670863i + + NOTE: Use of config("complex_space", 1) can break printing and scanning + of fractional values via "%r". + + NOTE: Use of config("complex_space", 1) can break printing and scanning + of complex values via "%c". + + Added config("complex_space", boolean) to help/config, along with + a few few minor text improvements. Updated cal/regress to test + config("complex_space"). + + Clarify in the calc man page, the relationship between -q and + calc start scripts such as the ~/.calcrc file. + + Fixed in the calc man page, the issue of -f not implying -q. + + The following are the changes from calc version 2.14.1.2 to date: Restored use of the #define FPOS_POS_LEN symbol. This refers to diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/COPYING new/calc-2.14.1.3/COPYING --- old/calc-2.14.1.2/COPYING 2021-11-08 03:58:52.000000000 +0100 +++ new/calc-2.14.1.3/COPYING 2022-12-08 23:28:35.000000000 +0100 @@ -6,7 +6,7 @@ This file is covered under the following Copyright: - Copyright (C) 1999-2021 Landon Curt Noll + Copyright (C) 1999-2022 Landon Curt Noll All rights reserved. Everyone is permitted to copy and distribute verbatim copies @@ -120,6 +120,7 @@ Copyright (C) year Ernest Bowen Copyright (C) year Petteri Kettunen and Landon Curt Noll Copyright (C) year Christoph Zurnieden + Copyright (C) year Landon Curt Noll and Thomas Jones-Low These files are not covered under one of the Copyrights listed above: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/Makefile new/calc-2.14.1.3/Makefile --- old/calc-2.14.1.2/Makefile 2022-11-29 22:08:18.000000000 +0100 +++ new/calc-2.14.1.3/Makefile 2023-02-15 00:45:37.000000000 +0100 @@ -1309,7 +1309,7 @@ # The default calc versions # -VERSION= 2.14.1.2 +VERSION= 2.14.1.3 # Names of shared libraries with versions # @@ -1811,7 +1811,7 @@ CCOPT= ${DEBUG} CCMISC= # -LCC= x86_64-w64-mingw32-gcc +LCC= cc CC= ${PURIFY} ${LCC} ${CCWERR} # endif @@ -2004,6 +2004,14 @@ # V=@: do not echo debug statements (quiet mode) # V=@ echo debug statements (debug / verbose mode) # +# To turn all messages, use: +# +# Q= +# H=@ +# S= +# E= +# V=@ +# #Q= Q=@ # @@ -3218,7 +3226,7 @@ ${TRUE}; \ fi -have_fpos_pos.h: have_fpos_pos.c have_fgetsetpos.h have_posscl.h \ +have_fpos_pos.h: have_fpos_pos.c have_fgetsetpos.h have_posscl.h have_string.h \ banned.h have_ban_pragma.h ${MAKE_FILE} ${LOC_MKF} ${Q} ${RM} -f fpos_tmp $@ ${H} echo 'forming $@' @@ -6283,6 +6291,7 @@ have_fpos_pos.o: have_fgetsetpos.h have_fpos_pos.o: have_fpos_pos.c have_fpos_pos.o: have_posscl.h +have_fpos_pos.o: have_string.h have_getpgid.o: banned.h have_getpgid.o: have_ban_pragma.h have_getpgid.o: have_getpgid.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/Makefile.simple new/calc-2.14.1.3/Makefile.simple --- old/calc-2.14.1.2/Makefile.simple 2022-11-29 22:08:18.000000000 +0100 +++ new/calc-2.14.1.3/Makefile.simple 2023-02-15 00:45:37.000000000 +0100 @@ -1151,7 +1151,7 @@ # The default calc versions # -VERSION= 2.14.1.2 +VERSION= 2.14.1.3 # Names of shared libraries with versions # @@ -1411,6 +1411,14 @@ # V=@: do not echo debug statements (quiet mode) # V=@ echo debug statements (debug / verbose mode) # +# To turn all messages, use: +# +# Q= +# H=@ +# S= +# E= +# V=@ +# #Q= Q=@ # @@ -2532,7 +2540,7 @@ ${TRUE}; \ fi -have_fpos_pos.h: have_fpos_pos.c have_fgetsetpos.h have_posscl.h \ +have_fpos_pos.h: have_fpos_pos.c have_fgetsetpos.h have_posscl.h have_string.h \ banned.h have_ban_pragma.h ${MAKE_FILE} ${LOC_MKF} ${Q} ${RM} -f fpos_tmp $@ ${H} echo 'forming $@' @@ -5551,6 +5559,7 @@ have_fpos_pos.o: have_fgetsetpos.h have_fpos_pos.o: have_fpos_pos.c have_fpos_pos.o: have_posscl.h +have_fpos_pos.o: have_string.h have_getpgid.o: banned.h have_getpgid.o: have_ban_pragma.h have_getpgid.o: have_getpgid.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/README.WINDOWS new/calc-2.14.1.3/README.WINDOWS --- old/calc-2.14.1.2/README.WINDOWS 2022-02-12 22:52:43.000000000 +0100 +++ new/calc-2.14.1.3/README.WINDOWS 2022-12-08 23:05:34.000000000 +0100 @@ -3,16 +3,8 @@ See the HOWTO.INSTALL file for information on how to build and install calc. See also the README file. -BTW: While we are unable to use Windows 11, we welcome - Windows 11 developers to try compiling calc natively - (instead of via a Linux virtual machine). If you are - able to compile Windows 11 natively, we would welcome - GitHub pull requests showing any needed modifications: - - https://github.com/lcn2/calc/pulls - Please also add notes to the 'Compiling calc under Windows 11' - section in README.WINDOWS file. + and 'Compiling with Cygwin' section in README.WINDOWS file. NOTE: The main developers do not have access to a Windows based platform. While we will make an effort to not break calc Windows based system, @@ -21,10 +13,18 @@ Of course you are welcome to send us any patches that fix your Windows build environment. + =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= =-= Compiling calc under Windows 11 =-= =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +BTW: While we are unable to use Windows 11, we welcome Windows 11 + developers to try compiling calc natively (instead of via a Linux + virtual machine). If you are able to compile Windows 11 natively, + we would welcome GitHub pull requests showing any needed modifications: + + https://github.com/lcn2/calc/pulls + We were given this advice from a Windows 11 developer: Windows 11 users could use Cygwin: @@ -34,66 +34,78 @@ IMPORTANT: While installing Cygwin, and during Cygwin Setup, be sure to select all the MinGW64 packages relating to gcc. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-= Compiling calc via virtual machine under Windows 11 =-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -We would prefer a Windows 11 solution that does not require a Windows 11 -developer to install a Linux virtual machine. Nevertheless, a Windows 11 -user might want to use the Microsoft Windows Subsystem (WSL) for Linux: + See the "Compiling with Cygwin" section below. - https://docs.microsoft.com/en-us/windows/wsl/ +NOTE: Compiling calc under Windows 11 is work in progress. If you run into + problems, consider the "Compiling with Cygwin" section below. - We have been told that you will need to turn on virtualization - to use this WSL subsystem. - -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-= Compiling calc under Windows 10 via Windows Subsystem for Linux (WSL) =-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -It has been reported that calc version 2.12.6.4 has been successfully -compiled, installed and running on Windows 10 on 2018 Jan 21. - -We were told: - - "The Windows Subsystem for Linux (WSL) is a new Windows 10 feature that - enables you to run native Linux command-line tools directly on Windows" - - https://docs.microsoft.com/cs-cz/windows/wsl/about =-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-= compiling with Cygwin =-= +=-= Compiling with Cygwin =-= =-=-=-=-=-=-=-=-=-=-=-=-=-=-= An effort is being made to allow windows users to compile calc using the Cygwin project (http://sources.redhat.com/cygwin/) with the GCC compiler -and Un*x tools for Windows. +and Unix tools for Windows. The major porting work for Cygwin was performed by Thomas Jones-Low (tjoneslo at softstart dot com). -In March 2009, Michael Penk (mpenk at wuska dot com) reported success in -installs under Cygwin: +In December 2022, GitHub user @Leoongithub successfully compiled +calc-2.14.1.2 under cygwin 2.924 (64 bit). The following are the +compilation steps that GitHub user @Leoongithub recommends: + +0. Install the latest version of cygwin (https://cygwin.com/install.html). + + NOTE: In addition to the default packages, you also need to check these + three packages: gcc-core, make, and libreadline-devel. The version + of these packages does not matter. Just choose the latest version. + + NOTE: The addition of "target=Cygwin" to make commands below + is done just in case the target is not set properly by make. + +1. Change (cd) into the top of the source code directory of calc. + + NOTE: The make command assume you are at the top of the calc source directory. + +2. make clobber target=Cygwin + + NOTE: This helps ensure that you are starting from a so-called "clean slate", + and that you have nothing hanging around from previous attempts to compile. + +3. make all target=Cygwin - On my fairly complete Cygwin installs, everything compiles, - checks, and installs correctly. My Cygwin is configured - in a very standard way (out of the box, using all of Cygwin's - defaults). The install worked on 5 different machines with - Cygwin on them: one XP home, one XP professional, and three - Vista professionals. + NOTE: If successful, you should have a calc executable. However that executable + may not be working properly. Advance to step (4) to test. -Using the calc Makefile, he did the following: +4. make chk target=Cygwin - make all target=Cygwin - make check - make install + NOTE: If you want this command be be verbose, try: -He also reports: + make check target=Cygwin - Of course, one should be logged in as an Administrator when - one builds and installs calc. + NOTE: This will run calc with the regress.cal regression suite. This step could take + for a while to run, depending on the speed/performance of your machine. + If all is well (all regression tests pass), you will see at the end: + + chk OK + + Otherwise you may see calc exit non-zero after it prints some lines with '****' + error messages followed by a line including a final error count of the form: + + **** 2 error(s) found \/++\/ + + If you see some errors that may relate to files and I/O, all may not be lost. + It could simply mean that your Windows environment is not conforming to standard + I/O and file operations. The calc mathematical engine may be just fine. On the + other hand if you see mathematical related regression test failures, this is + bad sign that your calc executable under Windows is not usable. + +5. make install target=Cygwin + + NOTE: This step is optional. While calc is usable at the top of the source code directory + of calc, installing calc may be of benefit so you can use calc elsewhere on your system. -He was compiling calc 2.12.4.0 with Cygwin version 1.5.25-15. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= =-= If all else fails, for Cygwin =-= @@ -118,6 +130,10 @@ source directory, edit them (if needed) and build using the Cygwin GCC compiler and Cygwin build environment. +NOTE: The use of win32_hsrc and this method has been deprecated. + It may go away once the Windows 11 methods are stable. + + =-=-=-=-=-=-=-=-=-=-=-=-=-=-= =-= compiling under DJGPP =-= =-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -178,8 +194,43 @@ Follow those recommendations. In cases where they conflict with the above Makefile list, follow the recommendation in the Makefile. +NOTE: The use of DJGPP and this method has been deprecated. + It may go away once the Windows 11 methods are stable. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +=-= Compiling calc via virtual machine under Windows 11 =-= +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +We would prefer a Windows 11 solution that does not require a Windows 11 +developer to install a Linux virtual machine. Nevertheless, a Windows 11 +user might want to use the Microsoft Windows Subsystem (WSL) for Linux: + + https://docs.microsoft.com/en-us/windows/wsl/ + + We have been told that you will need to turn on virtualization + to use this WSL subsystem. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +=-= Compiling calc under Windows 10 via Windows Subsystem for Linux (WSL) =-= +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +It has been reported that calc version 2.12.6.4 has been successfully +compiled, installed and running on Windows 10 on 2018 Jan 21. + +We were told: + + "The Windows Subsystem for Linux (WSL) is a new Windows 10 feature that + enables you to run native Linux command-line tools directly on Windows" + + https://docs.microsoft.com/cs-cz/windows/wsl/about + +NOTE: The use of calc under Windows 10 has been deprecated in favor of one + of the Windows 11 methods above. + -## Copyright (C) 2002-2009,2021 Landon Curt Noll and Thomas Jones-Low +## Copyright (C) 2002-2009,2021,2022 Landon Curt Noll and Thomas Jones-Low ## ## 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/byteswap.c new/calc-2.14.1.3/byteswap.c --- old/calc-2.14.1.2/byteswap.c 2022-11-29 00:06:42.000000000 +0100 +++ new/calc-2.14.1.3/byteswap.c 2022-12-03 18:17:31.000000000 +0100 @@ -575,7 +575,7 @@ /* * allocate the storage */ - dest = malloc(sizeof(ZVALUE)); + dest = calloc(1, sizeof(ZVALUE)); if (dest == NULL) { math_error("swap_HALF_in_ZVALUE: Not enough memory"); not_reached(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/cal/regress.cal new/calc-2.14.1.3/cal/regress.cal --- old/calc-2.14.1.2/cal/regress.cal 1970-01-01 01:00:00.000000000 +0100 +++ new/calc-2.14.1.3/cal/regress.cal 1970-01-01 01:00:00.000000000 +0100 @@ -541,7 +541,16 @@ vrfy(issimple(config("dupvar_warn")), '562: issimple(config("rdupvar_warn"))'); - print '563: Ending test_config'; + + /* test new space modes */ + vrfy(config("tilde_space") == 0, + '563: config("tilde_space") == 0'); + vrfy(config("fraction_space") == 0, + '564: config("fraction_space") == 0'); + vrfy(config("complex_space") == 0, + '565: config("complex_space") == 0'); + + print '566: Ending test_config'; } print '010: parsed test_config()'; @@ -3924,7 +3933,7 @@ vrfy(!iserror(p=fopen("tmp4200","r")), '4274: !iserror(p=fopen("tmp4200","r"))'); vrfy(!iserror(s=fgetline(p)), '4275: !iserror(s=fgetline(p))'); - vrfy(strcmp(s,"chongo") == 0, '4276: strcmp(s,"chongo") == 0'); + vrfy(strcmp(s,"chongo") == 0, '4276: strcmp(s,"chongo") == 0'); vrfy(!iserror(s=fgetfile(p)), '4277: !iserror(s=fgetfile(p))'); vrfy(strcmp(s,"w\0a\0s\nhere\n") == 0, '4278: strcmp(s,"w\0a\0s\nhere\n") == 0'); @@ -4296,84 +4305,119 @@ print '4804: c = config("display", 2)'; c = config("tilde", 0); print '4805: c = config("tilde", 0)'; + c = config("tilde_space", 1); + print '4806: c = config("tilde_space", 1)'; c = config("leadzero", 0); - print '4806: c = config("leadzero", 0)'; + print '4807: c = config("leadzero", 0)'; c = config("fullzero", 0); - print '4807: c = config("fullzero", 0)'; + print '4808: c = config("fullzero", 0)'; /* tests with tilde == 0 */ vrfy(strprintf("%d%d", 27, 29) == "2729", - '4808: strprintf("%d%d", 27, 29) == "2729"'); + '4809: strprintf("%d%d", 27, 29) == "2729"'); vrfy(strprintf("%5d%3d", 27, 29) == " 27 29", - '4809: strprintf("%5d%3d", 27, 29) == " 27 29"; '); + '4810: strprintf("%5d%3d", 27, 29) == " 27 29"; '); vrfy(strprintf("%-5d%-3d", 27, 29) == "27 29 ", - '4810: strprintf("%-5d%-3d", 27, 29) == "27 29 "'); + '4811: strprintf("%-5d%-3d", 27, 29) == "27 29 "'); vrfy(strprintf("%f", 1.375) == "1.38", - '4811: strprintf("%f", 1.375) == "1.38"'); + '4812: strprintf("%f", 1.375) == "1.38"'); vrfy(strprintf("%f", 1.385) == "1.38", - '4812: strprintf("%f", 1.385) == "1.38"'); + '4813: strprintf("%f", 1.385) == "1.38"'); vrfy(strprintf("%f", .375) == ".38", - '4813: strprintf("%f", .375) == ".38"'); + '4814: strprintf("%f", .375) == ".38"'); vrfy(strprintf("%f", .385) == ".38", - '4814: strprintf("%f", .385) == ".38"'); + '4815: strprintf("%f", .385) == ".38"'); /* tests with tilde == 1 */ c = config("tilde", 1); - print '4815: c = config("tilde", 1)'; - vrfy(strprintf("%f", 1.375) == "~1.38", - '4816: strprintf("%f", 1.375) == "~1.38"'); - vrfy(strprintf("%f", 27/29) == "~.93", - '4817: strprintf("%f", 27/29) == "~.93"'); + print '4816: c = config("tilde", 1)'; + vrfy(strprintf("%f", 1.375) == "~ 1.38", + '4817: strprintf("%f", 1.375) == "~ 1.38"'); + vrfy(strprintf("%f", 27/29) == "~ .93", + '4818: strprintf("%f", 27/29) == "~ .93"'); vrfy(strprintf("%r", 27/29) == "27/29", - '4818: strprintf("%r", 27/29) == "27/29"'); + '4819: strprintf("%r", 27/29) == "27/29"'); vrfy(strprintf("%o", 27/29) == "033/035", - '4819: strprintf("%o", 27/29) == "033/035"'); + '4820: strprintf("%o", 27/29) == "033/035"'); vrfy(strprintf("%x", 27/29) == "0x1b/0x1d", - '4820: strprintf("%x", 27/29) == "0x1b/0x1d"'); + '4821: strprintf("%x", 27/29) == "0x1b/0x1d"'); vrfy(strprintf("%b", 27/29) == "0b11011/0b11101", - '4821: strprintf("%b", 27/29) == "0b11011/0b11101"'); + '4822: strprintf("%b", 27/29) == "0b11011/0b11101"'); + vrfy(strprintf("%e", 12345) == "~ 1.23e4", + '4823: strprintf("%e", 12345) == "~ 1.23e4"'); + vrfy(strprintf("%g", .385) == "~ .38", + '4824: strprintf("%g", .385) == "~ .38"'); + vrfy(strprintf("%g", 385) == "~ 3.8e2", + '4825: strprintf("%g", 385) == "~ 3.8e2"'); + + /* tests with tilde == 1 and tilde_space == 0 */ + c = config("tilde_space", 0); + print '4826: c = config("tilde_space", 0)'; + vrfy(strprintf("%f", 1.375) == "~1.38", + '4827: strprintf("%f", 1.375) == "~1.38"'); + vrfy(strprintf("%f", 27/29) == "~.93", + '4828: strprintf("%f", 27/29) == "~.93"'); vrfy(strprintf("%e", 12345) == "~1.23e4", - '4822: strprintf("%e", 12345) == "~1.23e4"'); + '4829: strprintf("%e", 12345) == "~1.23e4"'); vrfy(strprintf("%g", .385) == "~.38", - '4823: strprintf("%g", .385) == "~.38"'); + '4830: strprintf("%g", .385) == "~.38"'); vrfy(strprintf("%g", 385) == "~3.8e2", - '4824: strprintf("%g", 385) == "~3.8e2"'); + '4831: strprintf("%g", 385) == "~3.8e2"'); + + /* tests with tilde_space == 0 */ + c = config("tilde_space", 1); + print '4832: c = config("tilde_space", 1)'; + vrfy(strprintf("%f", 1.375) == "~ 1.38", + '4833: strprintf("%f", 1.375) == "~ 1.38"'); + vrfy(strprintf("%f", 27/29) == "~ .93", + '4834: strprintf("%f", 27/29) == "~ .93"'); + vrfy(strprintf("%e", 12345) == "~ 1.23e4", + '4835: strprintf("%e", 12345) == "~ 1.23e4"'); + vrfy(strprintf("%g", .385) == "~ .38", + '4836: strprintf("%g", .385) == "~ .38"'); + vrfy(strprintf("%g", 385) == "~ 3.8e2", + '4837: strprintf("%g", 385) == "~ 3.8e2"'); /* mode tests with tilde == 0 */ c = config("tilde", 0); - print '4825: c = config("tilde", 0)'; + print '4838: c = config("tilde", 0)'; vrfy(strprintf("%e", 12345) == "1.23e4", - '4826: strprintf("%e", 12345) == "1.23e4"'); + '4839: strprintf("%e", 12345) == "1.23e4"'); vrfy(strprintf("%.3e", 12345) == "1.234e4", - '4827: strprintf("%.3e", 12345) == "1.234e4"'); + '4840: strprintf("%.3e", 12345) == "1.234e4"'); vrfy(strprintf("%e", .00012345) == "1.23e-4", - '4828: strprintf("%e", .00012345) == "1.23e-4"'); + '4841: strprintf("%e", .00012345) == "1.23e-4"'); vrfy(strprintf("%d %d", 27) == "27 ", - '4829: strprintf("%d %d", 27) == "27 "'); + '4842: strprintf("%d %d", 27) == "27 "'); vrfy(strprintf("%d", 27, 29) == "27", - '4830: strprintf("%d", 27, 29) == "27"'); + '4843: strprintf("%d", 27, 29) == "27"'); vrfy(strprintf("%r = %f", 27/29, 27/29) == "27/29 = .93", - '4831: strprintf("%r = %f", 27/29, 27/29) == "27/29 = .93"'); + '4844: strprintf("%r = %f", 27/29, 27/29) == "27/29 = .93"'); vrfy(strprintf("%s", "abc") == "abc", - '4832: strprintf("%s", "abc") == "abc"'); + '4845: strprintf("%s", "abc") == "abc"'); vrfy(strprintf("%f", "abc") == "abc", - '4833: strprintf("%f", "abc") == "abc"'); + '4846: strprintf("%f", "abc") == "abc"'); vrfy(strprintf("%e", "abc") == "abc", - '4834: strprintf("%e", "abc") == "abc"'); + '4847: strprintf("%e", "abc") == "abc"'); vrfy(strprintf("%5s", "abc") == " abc", - '4835: strprintf("%5s", "abc") == " abc"'); + '4848: strprintf("%5s", "abc") == " abc"'); vrfy(strprintf("%-5s", "abc") == "abc ", - '4836: strprintf("%-5s", "abc") == "abc "'); + '4849: strprintf("%-5s", "abc") == "abc "'); vrfy(strprintf("%g", .385) == ".38", - '4837: strprintf("%g", .385) == ".38"'); + '4850: strprintf("%g", .385) == ".38"'); vrfy(strprintf("%g", 385) == "3.8e2", - '4838: strprintf("%g", 385) == "3.8e2"'); + '4851: strprintf("%g", 385) == "3.8e2"'); + + c = config("fraction_space", 1); + print '4852: c = config("fraction_space", 1)'; + vrfy(strprintf("%r = %f", 27/29, 27/29) == "27 / 29 = .93", + '4853: strprintf("%r = %f", 27/29, 27/29) == "27 / 29 = .93"'); /* restore config */ c = config("all", callcfg); - print '4839: c = config("all", callcfg)'; + print '4854: c = config("all", callcfg)'; - print '4840: Ending test_strprintf'; + print '4855: Ending test_strprintf'; } print '088: parsed test_fileop()'; @@ -8129,7 +8173,7 @@ vrfy(config("dupvar_warn",0), '8652: config("dupvar_warn",0)'); vrfy(u_glob == 6, '8653: u_glob == 6'); global u_glob = 555; -print '8654: declare u_glob'; +print '8654: declare u_glob'; vrfy(u_glob == 555, '8655: u_glob == 555'); define func_8650(u_glob) { local u_glob; return u_glob; } print '8656: u_glob as both local and parameter'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/calc.man new/calc-2.14.1.3/calc.man --- old/calc-2.14.1.2/calc.man 2022-11-27 21:08:08.000000000 +0100 +++ new/calc-2.14.1.3/calc.man 2022-12-04 01:36:31.000000000 +0100 @@ -251,9 +251,6 @@ \fI#!${BINDIR}/calc\fP \fB\-q\fP \fB\-f\fP .fi .in -5n -.sp 1 -This allows the script to run independently of -startup scripts. .sp 1 See @@ -295,6 +292,24 @@ .BR "shell script mode" . .sp 1 +.B NOTE: +The use of +.BR \-f +does +.B NOT +imply +.BR \-q +and thus one would need to use +.sp 1 +.in +5n +.nf +\fIcalc\fP\ [optional_other_flags\ \&...] \fB\-q\fP \fB\-f\fP filename +.fi +.in -5n +.sp 1 +to disable the use of calc startup files as well. + +.sp 1 The use of .B \-f filename @@ -458,6 +473,13 @@ .TP .B \-q Disable the reading of the startup scripts. +.sp 1 +This allows the script to run independently of +startup scripts such those managed by the +.B $CALCRC +environment variable. +For example, this will disable the use of the common calcrc file +(usually ~/.calcrc). .TP .B \-s @@ -813,6 +835,23 @@ .B \-i is not given. .sp 1 +.B NOTE: +The use of +.BR \-f +does +.B NOT +imply +.BR \-q +and thus one would need to use +.sp 1 +.in +5n +.nf +\fIcalc\fP\ [optional_other_flags\ \&...] \fB\-q\fP \fB\-f\fP filename +.fi +.in -5n +.sp 1 +to disable the use of calc startup files as well. +.sp 1 For example, if the file .BR /tmp/mersenne : diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/comfunc.c new/calc-2.14.1.3/comfunc.c --- old/calc-2.14.1.2/comfunc.c 2022-01-22 08:11:08.000000000 +0100 +++ new/calc-2.14.1.3/comfunc.c 2022-12-04 01:40:05.000000000 +0100 @@ -1191,12 +1191,18 @@ qtmp = c->imag[0]; if (qiszero(&qtmp)) return; + if (conf->complex_space) { + math_chr(' '); + } if (!qiszero(c->real) && !qisneg(&qtmp)) math_chr('+'); if (qisneg(&qtmp)) { math_chr('-'); qtmp.num.sign = 0; } + if (conf->complex_space) { + math_chr(' '); + } qprintnum(&qtmp, MODE_DEFAULT, conf->outdigits); math_chr('i'); } @@ -1223,7 +1229,13 @@ zprintval(i->num, 0L, 0L); math_chr('i'); if (qisfrac(i)) { + if (conf->fraction_space) { + math_chr(' '); + } math_chr('/'); + if (conf->fraction_space) { + math_chr(' '); + } zprintval(i->den, 0L, 0L); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/config.c new/calc-2.14.1.3/config.c --- old/calc-2.14.1.2/config.c 2022-01-22 09:22:28.000000000 +0100 +++ new/calc-2.14.1.3/config.c 2022-12-04 09:39:32.000000000 +0100 @@ -93,6 +93,9 @@ {"pow2", CONFIG_POW2}, {"redc2", CONFIG_REDC2}, {"tilde", CONFIG_TILDE}, + {"tilde_space", CONFIG_TILDE_SPACE}, + {"fraction_space", CONFIG_FRACTION_SPACE}, + {"complex_space", CONFIG_COMPLEX_SPACE}, {"tab", CONFIG_TAB}, {"quomod", CONFIG_QUOMOD}, {"quo", CONFIG_QUO}, @@ -150,8 +153,11 @@ SQ_ALG2, /* size of number to use square alg 2 */ POW_ALG2, /* size of modulus to use REDC for powers */ REDC_ALG2, /* size of modulus to use REDC algorithm 2 */ - TRUE, /* OK to print a tilde on approximations */ - TRUE, /* OK to print tab before numeric values */ + TRUE, /* TRUE ==> print a tilde on approximations */ + FALSE, /* TRUE ==> print a space after tilde on approximations */ + FALSE, /* TRUE ==> print spaces around / in fractions */ + FALSE, /* TRUE ==> print spaces around + or - in complex values */ + TRUE, /* TRUE ==> print tab before numeric values */ 0, /* quomod() default rounding mode */ 2, /* quotient // default rounding mode */ 0, /* mod % default rounding mode */ @@ -161,8 +167,8 @@ 8, /* cfsim() default rounding mode */ 2, /* output default rounding mode */ 24, /* round()/bround() default rounding mode */ - FALSE, /* OK to print leading 0 before decimal pt */ - 0, /* OK to print trailing 0's */ + FALSE, /* TRUE ==> print leading 0 before decimal pt */ + 0, /* TRUE ==> print trailing 0's */ MAXSCANCOUNT, /* max scan errors before abort */ PROMPT1, /* normal prompt */ PROMPT2, /* prompt when inside multi-line input */ @@ -173,30 +179,30 @@ 0, /* internal calc debug level */ 3, /* calc resource file debug level */ 0, /* user defined debug level */ - FALSE, /* print Quit or abort executed messages */ + FALSE, /* TRUE ==> print Quit or abort executed messages */ CTRL_D_VIRGIN_EOF, /* ^D only exits on virgin lines */ NULL, /* our name */ NULL, /* basename of our name */ #if defined(_WIN32) || defined(_WIN64) - TRUE, /* running under windows */ + TRUE, /* TRUE ==> running under windows */ #else - FALSE, /* not using windows */ + FALSE, /* FALSE ==> not using windows */ #endif #if defined(__CYGWIN__) - TRUE, /* compiled under cygwin */ + TRUE, /* TRUE ==> compiled under cygwin */ #else - FALSE, /* not compiled with cygwin */ + FALSE, /* FALSE ==> not compiled with cygwin */ #endif #if defined(CUSTOM) - TRUE, /* compiled with -DCUSTOM */ + TRUE, /* TRUE ==> compiled with -DCUSTOM */ #else - FALSE, /* compiled without -DCUSTOM */ + FALSE, /* FALSE ==> compiled without -DCUSTOM */ #endif &allow_custom, /* *TRUE=> custom functions are enabled */ NULL, /* version */ BASEB, /* base for calculations */ - TRUE, /* warn when redeclaring */ - TRUE, /* warn when variable names collide */ + TRUE, /* TRUE ==> warn when redeclaring */ + TRUE, /* TRUE ==> warn when variable names collide */ }; CONFIG newstd = { /* new non-backward compatible configuration */ MODE_INITIAL, /* current output mode */ @@ -210,8 +216,11 @@ SQ_ALG2, /* size of number to use square alg 2 */ POW_ALG2, /* size of modulus to use REDC for powers */ REDC_ALG2, /* size of modulus to use REDC algorithm 2 */ - TRUE, /* OK to print a tilde on approximations */ - TRUE, /* OK to print tab before numeric values */ + TRUE, /* TRUE ==> print a tilde on approximations */ + FALSE, /* TRUE ==> print spaces around / in fractions */ + FALSE, /* TRUE ==> print a space after tilde on approximations */ + FALSE, /* TRUE ==> print spaces around + or - in complex values */ + TRUE, /* TRUE ==> print tab before numeric values */ 0, /* quomod() default rounding mode */ 2, /* quotient // default rounding mode */ 0, /* mod % default rounding mode */ @@ -221,8 +230,8 @@ 8, /* cfsim() default rounding mode */ 24, /* output default rounding mode */ 24, /* round()/bround() default rounding mode */ - TRUE, /* OK to print leading 0 before decimal pt */ - 0, /* OK to print trailing 0's */ + TRUE, /* TRUE ==> print leading 0 before decimal pt */ + 0, /* TRUE ==> print trailing 0's */ MAXSCANCOUNT, /* max scan errors before abort */ "; ", /* normal prompt */ ";; ", /* prompt when inside multi-line input */ @@ -233,30 +242,30 @@ 0, /* internal calc debug level */ 3, /* calc resource file debug level */ 0, /* user defined debug level */ - FALSE, /* print Quit or abort executed messages */ + FALSE, /* TRUE ==> print Quit or abort executed messages */ CTRL_D_VIRGIN_EOF, /* ^D only exits on virgin lines */ NULL, /* our name */ NULL, /* basename of our name */ #if defined(_WIN32) || defined(_WIN64) - TRUE, /* running under windows */ + TRUE, /* TRUE ==> running under windows */ #else - FALSE, /* not using windows */ + FALSE, /* FALSE ==> not using windows */ #endif #if defined(__CYGWIN__) - TRUE, /* compiled under cygwin */ + TRUE, /* TRUE ==> compiled under cygwin */ #else - FALSE, /* not compiled with cygwin */ + FALSE, /* FALSE ==> not compiled with cygwin */ #endif #if defined(CUSTOM) - TRUE, /* compiled with -DCUSTOM */ + TRUE, /* TRUE ==> compiled with -DCUSTOM */ #else - FALSE, /* compiled without -DCUSTOM */ + FALSE, /* FALSE ==> compiled without -DCUSTOM */ #endif - &allow_custom, /* *TRUE=> custom functions are enabled */ + &allow_custom, /* *TRUE ==> custom functions are enabled */ NULL, /* version */ BASEB, /* base for calculations */ - TRUE, /* warn when redeclaring */ - TRUE, /* warn when variable names collide */ + TRUE, /* TRUE ==> warn when redeclaring */ + TRUE, /* TRUE ==> warn when variable names collide */ }; CONFIG *conf = NULL; /* loaded in at startup - current configuration */ @@ -624,6 +633,48 @@ } break; + case CONFIG_TILDE_SPACE: + if (vp->v_type == V_NUM) { + q = vp->v_num; + conf->tilde_space = !qiszero(q); + } else if (vp->v_type == V_STR) { + temp = lookup_long(truth, vp->v_str->s_str); + if (temp < 0) { + math_error("Illegal truth value for tilde_space"); + not_reached(); + } + conf->tilde_space = (int)temp; + } + break; + + case CONFIG_FRACTION_SPACE: + if (vp->v_type == V_NUM) { + q = vp->v_num; + conf->fraction_space = !qiszero(q); + } else if (vp->v_type == V_STR) { + temp = lookup_long(truth, vp->v_str->s_str); + if (temp < 0) { + math_error("Illegal truth value for fraction_space"); + not_reached(); + } + conf->fraction_space = (int)temp; + } + break; + + case CONFIG_COMPLEX_SPACE: + if (vp->v_type == V_NUM) { + q = vp->v_num; + conf->complex_space = !qiszero(q); + } else if (vp->v_type == V_STR) { + temp = lookup_long(truth, vp->v_str->s_str); + if (temp < 0) { + math_error("Illegal truth value for complex_space"); + not_reached(); + } + conf->complex_space = (int)temp; + } + break; + case CONFIG_TAB: if (vp->v_type == V_NUM) { q = vp->v_num; @@ -1205,6 +1256,18 @@ i = (cfg->tilde_ok ? 1 : 0); break; + case CONFIG_TILDE_SPACE: + i = (cfg->tilde_space ? 1 : 0); + break; + + case CONFIG_FRACTION_SPACE: + i = (cfg->fraction_space ? 1 : 0); + break; + + case CONFIG_COMPLEX_SPACE: + i = (cfg->complex_space ? 1 : 0); + break; + case CONFIG_TAB: i = (cfg->tab_ok ? 1 : 0); break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/config.h new/calc-2.14.1.3/config.h --- old/calc-2.14.1.2/config.h 2021-12-06 03:25:30.000000000 +0100 +++ new/calc-2.14.1.3/config.h 2022-12-04 09:50:46.000000000 +0100 @@ -94,6 +94,9 @@ #define CONFIG_REDECL_WARN 44 #define CONFIG_DUPVAR_WARN 45 #define CONFIG_HZ 46 +#define CONFIG_TILDE_SPACE 47 +#define CONFIG_FRACTION_SPACE 48 +#define CONFIG_COMPLEX_SPACE 49 /* @@ -123,7 +126,7 @@ int outmode2; /* current secondary output mode */ LEN outdigits; /* current output digits for float or exp */ NUMBER *epsilon; /* default error for real functions */ - long epsilonprec; /* epsilon binary precision (tied to epsilon) */ + long epsilonprec; /* epsilon binary precision (tied to epsilon) */ FLAG traceflags; /* tracing flags */ LEN maxprint; /* number of elements to print */ LEN mul2; /* size of number to use multiply algorithm 2 */ @@ -131,6 +134,9 @@ LEN pow2; /* size of modulus to use REDC for powers */ LEN redc2; /* size of modulus to use REDC algorithm 2 */ BOOL tilde_ok; /* OK to print a tilde on approximations */ + BOOL tilde_space; /* print space after tilde on approximations */ + BOOL fraction_space; /* TRUE => print spaces around / in fractions */ + BOOL complex_space; /* TRUE => print spaces around + or - in complex values */ BOOL tab_ok; /* OK to print tab before numeric values */ LEN quomod; /* quomod() default rounding mode */ LEN quo; /* quotient // default rounding mode */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/custom/Makefile new/calc-2.14.1.3/custom/Makefile --- old/calc-2.14.1.2/custom/Makefile 2022-11-29 22:08:18.000000000 +0100 +++ new/calc-2.14.1.3/custom/Makefile 2023-02-15 00:45:37.000000000 +0100 @@ -474,7 +474,7 @@ # The default calc versions # -VERSION= 2.14.1.2 +VERSION= 2.14.1.3 # Names of shared libraries with versions # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/custom/Makefile.simple new/calc-2.14.1.3/custom/Makefile.simple --- old/calc-2.14.1.2/custom/Makefile.simple 2022-11-29 22:08:18.000000000 +0100 +++ new/calc-2.14.1.3/custom/Makefile.simple 2023-02-15 00:45:37.000000000 +0100 @@ -445,7 +445,7 @@ # The default calc versions # -VERSION= 2.14.1.2 +VERSION= 2.14.1.3 # Names of shared libraries with versions # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/hash.c new/calc-2.14.1.3/hash.c --- old/calc-2.14.1.2/hash.c 2022-01-22 08:12:30.000000000 +0100 +++ new/calc-2.14.1.3/hash.c 2022-12-03 23:20:01.000000000 +0100 @@ -956,6 +956,7 @@ state = hash_len(type, value->v_config->pow2, state); state = hash_len(type, value->v_config->redc2, state); state = hash_bool(type, value->v_config->tilde_ok, state); + state = hash_bool(type, value->v_config->tilde_space, state); state = hash_bool(type, value->v_config->tab_ok, state); state = hash_long(type, (long)value->v_config->quomod, state); state = hash_long(type, (long)value->v_config->quo, state); @@ -1001,6 +1002,7 @@ state = hash_int(type, value->v_config->baseb, state); state = hash_bool(type, value->v_config->redecl_warn, state); state = hash_bool(type, value->v_config->dupvar_warn, state); + state = hash_bool(type, value->v_config->fraction_space, state); break; case V_HASH: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/have_fpos_pos.c new/calc-2.14.1.3/have_fpos_pos.c --- old/calc-2.14.1.2/have_fpos_pos.c 2022-11-28 22:57:23.000000000 +0100 +++ new/calc-2.14.1.3/have_fpos_pos.c 2023-02-15 00:39:53.000000000 +0100 @@ -28,6 +28,10 @@ #include <stdio.h> #include "have_fgetsetpos.h" #include "have_posscl.h" +#include "have_string.h" +#ifdef HAVE_STRING_H +# include <string.h> +#endif #include "banned.h" /* include after system header <> includes */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/help/config new/calc-2.14.1.3/help/config --- old/calc-2.14.1.2/help/config 2021-12-06 08:03:23.000000000 +0100 +++ new/calc-2.14.1.3/help/config 2022-12-04 01:08:26.000000000 +0100 @@ -34,6 +34,7 @@ "pow2" sets size for alternate powering. "redc2" sets size for alternate REDC. "tilde" enable/disable printing of the roundoff '~' + "tilde_space" enable/disable printing space after roundoff tilde '~ ' "tab" enable/disable printing of leading tabs "quomod" sets rounding mode for quomod "quo" sets rounding mode for //, default for quo @@ -134,6 +135,7 @@ config("display", 50); 50 digits of output epsilon(epsilon() / 8); 3 bits more accuracy config("tilde", 0) disable roundoff tilde printing + config("tilde_space", 1) enable printing space after roundoff tilde config("tab", "off") disable leading tab printing =-= @@ -264,7 +266,7 @@ config("mul2", int) config("sq2", int) - Mul2 and sq2 specify the sizes of numbers at which calc switches + Both "mul2" and "sq2" specify the sizes of numbers at which calc switches from its first to its second algorithm for multiplying and squaring. The first algorithm is the usual method of cross multiplying, which runs in a time of O(N^2). The second method is a recursive and @@ -305,7 +307,7 @@ config("pow2", int) - Pow2 specifies the sizes of numbers at which calc switches from + The "pow2" specifies the sizes of numbers at which calc switches from its first to its second algorithm for calculating powers modulo another number. The first algorithm for calculating modular powers is by repeated squaring and multiplying and dividing by the modulus. @@ -334,7 +336,7 @@ config("redc2", int) - Redc2 specifies the sizes of numbers at which calc switches from + The "redc2" specifies the sizes of numbers at which calc switches from its first to its second algorithm when using the REDC algorithm. The first algorithm performs a multiply and a modular reduction together in one loop which runs in O(N^2). The second algorithm @@ -363,16 +365,48 @@ config("tilde", boolean) - Config("tilde") controls whether or not a leading tilde ('~') is + The "tilde" controls whether or not a leading tilde ('~') is printed to indicate that a number has not been printed exactly because the number of decimal digits required would exceed the - specified maximum number. The initial "tilde" value is 1. + specified maximum number. + + If config("tilde") is false, then config("tilde_space") has no effect. + + The initial "tilde" value is 1 (on). + + =-= + + config("tilde_space", boolean) + + The "tilde_space" controls whether or not a space (' ') is + printed after leading tilde ('~'). See config("tilde") above. + If config("tilde") is false, then config("tilde_space") has no effect. + + NOTE: Use of config("tilde_space", 1) can break printing and scanning + of complex values via "%c". + + The initial "tilde_space" value is 0 (off) + + =-= + + config("fraction_space", boolean) + + The "fraction_space" controls whether or not a space (' ') is + printed both before and after '/' when printing a fraction. + + NOTE: Use of config("fraction_space", 1) can break printing and scanning + of fractional values via "%r". + + NOTE: Use of config("fraction_space", 1) can break printing and scanning + of complex values via "%c". + + The initial "fraction_space" value is 0 (off). =-= config("tab", boolean) - Config ("tab") controls the printing of a tab before results + config("tab") controls the printing of a tab before results automatically displayed when working interactively. It does not affect the printing by the functions print, printf, etc. The initial "tab" value is 1. @@ -908,6 +942,7 @@ pow2 40 redc2 50 tilde 1 + tilde_space 0 tab 1 quomod 0 quo 2 @@ -944,6 +979,7 @@ redecl_warn 1 dupvar_warn 1 hz 100 + fraction_space 0 ; display() 20 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/lib_calc.c new/calc-2.14.1.3/lib_calc.c --- old/calc-2.14.1.2/lib_calc.c 2022-01-22 08:12:40.000000000 +0100 +++ new/calc-2.14.1.3/lib_calc.c 2022-12-03 20:30:23.000000000 +0100 @@ -321,6 +321,7 @@ if (d_flag) { conf->resource_debug = 0; conf->tilde_ok = 0; + conf->tilde_space = 0; } /* @@ -693,7 +694,7 @@ #else /* HAVE_STRDUP */ char *ret; /* return string */ - size_t s1_len; /* length of string to duplicate */ + size_t s1_len; /* length of string to duplicate */ /* * firewall @@ -737,7 +738,7 @@ find_tty_state(int fd) { int *new_fd_setup; /* new fd_setup array */ - ttystruct *new_fd_orig; /* new fd_orig array */ + ttystruct *new_fd_orig; /* new fd_orig array */ ttystruct *new_fd_cur; /* new fd_cur array */ int i; @@ -764,7 +765,7 @@ if (fd_orig == NULL) { return -1; } - fd_cur = (ttystruct *)malloc(sizeof(fd_orig[0])); + fd_cur = (ttystruct *)malloc(sizeof(fd_cur[0])); if (fd_cur == NULL) { return -1; } @@ -796,26 +797,35 @@ /* * no empty slots exist, realloc another slot */ + /* expand fd_orig as an original pre-modified copy of fd_setup */ + new_fd_orig = (ttystruct *)realloc(fd_orig, sizeof(fd_orig[0]) * + (fd_setup_len+1)); + if (new_fd_orig == NULL) { + return -1; + } + fd_orig = new_fd_orig; + memcpy(fd_orig, fd_setup, sizeof(fd_orig[0]) * (fd_setup_len+1)); + + /* expand fd_setup */ new_fd_setup = (int *)realloc(fd_setup, sizeof(fd_setup[0]) * (fd_setup_len+1)); if (new_fd_setup == NULL) { return -1; } + fd_setup = new_fd_setup; new_fd_setup[fd_setup_len] = -1; - new_fd_orig = (ttystruct *)realloc(fd_setup, sizeof(fd_orig[0]) * - (fd_setup_len+1)); - if (new_fd_orig == NULL) { - return -1; - } + + /* expand fd_cur */ new_fd_cur = (ttystruct *)realloc(fd_cur, sizeof(fd_cur[0]) * (fd_setup_len+1)); if (new_fd_cur == NULL) { return -1; } - fd_setup = new_fd_setup; - fd_orig = new_fd_orig; fd_cur = new_fd_cur; + + /* expand fd setup length */ ++fd_setup_len; + /* return the new slot */ return fd_setup_len-1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/qio.c new/calc-2.14.1.3/qio.c --- old/calc-2.14.1.2/qio.c 2022-01-22 08:12:58.000000000 +0100 +++ new/calc-2.14.1.3/qio.c 2022-12-03 23:20:05.000000000 +0100 @@ -201,16 +201,24 @@ } switch (outmode) { case MODE_INT: - if (conf->tilde_ok && qisfrac(q)) + if (conf->tilde_ok && qisfrac(q)) { PUTCHAR('~'); + if (conf->tilde_space && qisfrac(q)) { + PUTCHAR(' '); + } + } qprintfd(q, 0L); break; case MODE_REAL: prec = qdecplaces(q); if ((prec < 0) || (prec > outdigits)) { - if (conf->tilde_ok) + if (conf->tilde_ok) { PUTCHAR('~'); + if (conf->tilde_space) { + PUTCHAR(' '); + } + } } if (conf->fullzero || (prec < 0) || (prec > outdigits)) @@ -412,7 +420,13 @@ { zprintval(q->num, 0L, width); if (force || qisfrac(q)) { + if (conf->fraction_space) { + PUTCHAR(' '); + } PUTCHAR('/'); + if (conf->fraction_space) { + PUTCHAR(' '); + } zprintval(q->den, 0L, width); } } @@ -446,7 +460,13 @@ { zprintx(q->num, width); if (qisfrac(q)) { + if (conf->fraction_space) { + PUTCHAR(' '); + } PUTCHAR('/'); + if (conf->fraction_space) { + PUTCHAR(' '); + } zprintx(q->den, 0L); } } @@ -461,7 +481,13 @@ { zprintb(q->num, width); if (qisfrac(q)) { + if (conf->fraction_space) { + PUTCHAR(' '); + } PUTCHAR('/'); + if (conf->fraction_space) { + PUTCHAR(' '); + } zprintb(q->den, 0L); } } @@ -476,7 +502,13 @@ { zprinto(q->num, width); if (qisfrac(q)) { + if (conf->fraction_space) { + PUTCHAR(' '); + } PUTCHAR('/'); + if (conf->fraction_space) { + PUTCHAR(' '); + } zprinto(q->den, 0L); } } @@ -749,6 +781,12 @@ width1 = width - width2; } fitzprint(q->num, numdigits, width1); + if (conf->fraction_space) { + PUTCHAR(' '); + } PUTCHAR('/'); + if (conf->fraction_space) { + PUTCHAR(' '); + } fitzprint(q->den, dendigits, width2); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/quickhash.c new/calc-2.14.1.3/quickhash.c --- old/calc-2.14.1.2/quickhash.c 2022-01-22 08:13:07.000000000 +0100 +++ new/calc-2.14.1.3/quickhash.c 2022-12-03 20:31:20.000000000 +0100 @@ -439,6 +439,7 @@ value = (((value>>5) | (value<<27)) ^ (USB32)cfg->pow2); value = (((value>>5) | (value<<27)) ^ (USB32)cfg->redc2); value = (((value>>5) | (value<<27)) ^ (USB32)cfg->tilde_ok); + value = (((value>>5) | (value<<27)) ^ (USB32)cfg->tilde_space); value = (((value>>5) | (value<<27)) ^ (USB32)cfg->tab_ok); value = (((value>>5) | (value<<27)) ^ (USB32)cfg->quomod); value = (((value>>5) | (value<<27)) ^ (USB32)cfg->quo); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/seed.c new/calc-2.14.1.3/seed.c --- old/calc-2.14.1.2/seed.c 2021-12-09 10:38:42.000000000 +0100 +++ new/calc-2.14.1.3/seed.c 2022-12-03 19:39:55.000000000 +0100 @@ -592,7 +592,6 @@ sdata.size = sizeof(sdata); sdata.prev_hash64_copy = prev_hash64; /* load previous hash */ sdata.call_count_copy = ++call_count; /* update call count */ - (void) setjmp(sdata.env); #if defined(HAVE_ENVIRON) sdata.environ_copy = environ; #endif /* HAVE_ENVIRON */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.14.1.2/version.c new/calc-2.14.1.3/version.c --- old/calc-2.14.1.2/version.c 2022-11-29 02:31:47.000000000 +0100 +++ new/calc-2.14.1.3/version.c 2023-02-15 00:34:48.000000000 +0100 @@ -84,7 +84,7 @@ #define MAJOR_VER 2 /* major library version */ #define MINOR_VER 14 /* minor library version */ #define MAJOR_PATCH 1 /* major software version level */ -#define MINOR_PATCH 2 /* minor software version level */ +#define MINOR_PATCH 3 /* minor software version level */ /* @@ -108,7 +108,7 @@ char *Copyright = "\n" "calc - arbitrary precision calculator\n" "\n" - "Copyright (C) 1999-2021 David I. Bell, Landon Curt Noll " + "Copyright (C) 1999-2023 David I. Bell, Landon Curt Noll " "and Ernest Bowen\n" "\n" "Initial author: David I. Bell\n"
