Release calc version 2.11.0t9.4.2

This commit is contained in:
Landon Curt Noll
1999-11-09 05:29:05 -08:00
parent 7cb0a77c25
commit 82ff31f246
22 changed files with 457 additions and 127 deletions

55
BUGS
View File

@@ -96,31 +96,36 @@ Known bugs:
the terminal in a 'bad' state, as if stty -icanon -echo -echoe the terminal in a 'bad' state, as if stty -icanon -echo -echoe
had been executed. had been executed.
* Dec Alpha Linux compiling with gcc-2.95.1 (or gcc-2.95.2) and * Use of 'fmt' in the 2nd arg of printf() calls in c_sysinfo.c
-O2 fails the version 2.11.0t8.10 regression test with: cause some compilers to issue warnings.
make -s check We are sure some more bugs exist. When you find them, please let
000: Beginning regression tests us know! See the above for details on how to report and were to
001: Some of these tests may take a while ... EMail your bug reports and hopefully patches to fix them.
002: Within each section, output should be numbered sequentially
003: parsed global definitions
004: parsed vrfy()
005: parsed prob(str)
006: parsed getglobalvar()
007: parsed test_booleans()
008: parsed test_variables()
make: *** [check] Segmentation fault (core dumped)
Other programs have reported problems when compiling -O2 with =-=
gcc-2.95.1 on the Alpha and Mips.
One work-a-round is to not compile with -O2 (perhaps just -O). Other items of note:
Another work-a-round is not use gcc-2.95.1.
* There is a bug in gcc-2.95 that causes calc, when compiled with -O2,
to fail the regression test. The work-a-round is to compile with -O
or to use gcc-2.96 or later.
* There is a bug in some versions of the Dec/Compaq cc for the Alpha
where the following:
#include <stdio.h>
#define SVAL(a,b) (unsigned long)(0x ## a ## b ## ULL)
main(){SVAL(b8a8aeb0,8168eadc);}
fails because it puts a space inside the concatenated hex. Calc
has code that is affected by this bug. This bug has been reported
to Compaq and may be fixed in the future. A work-a-round is to
compile with cc -std0 or to use a later version of their compiler.
* On a Digital UNIX V4.0F (Rev. 1229) on a 500 Mhz 21264, make check * On a Digital UNIX V4.0F (Rev. 1229) on a 500 Mhz 21264, make check
dies a horrible death starting in test 600 and 622 gives 100s of dies a horrible death starting in test 600 and 622 gives 100s of
messages for calc version 2.11.0t9.2 using the Dec's cc with -O2 messages for calc version 2.11.0t9.4 using the Dec's cc with -O2:
and without -std0:
600: Beginning test_bignums 600: Beginning test_bignums
601: muldivcheck 1 601: muldivcheck 1
@@ -135,6 +140,12 @@ Known bugs:
it finally hangs at test 2000. it finally hangs at test 2000.
We are sure some more bugs exist. When you find them, please let The work-a-round is to compile calc without the optimizer. If this
us know! See the above for details on how to report and were to happens to you, try compiling without -O and without -O2. I.e., in
EMail your bug reports and hopefully patches to fix them. the Makefile, set:
DEBUG= -g
or set:
DEBUG=

140
CHANGES
View File

@@ -2,14 +2,14 @@ Following is the change from calc version 2.11.0t8.9.1 to date:
The config("verbose_quit") will control the printing of the message: The config("verbose_quit") will control the printing of the message:
Quit or abort executed 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 encounted. By default,
config("verbose_quit") is TRUE and the message is printed. If one does: config("verbose_quit") is TRUE and the message is printed. If one does:
config("verbose_quit", 0) config("verbose_quit", 0)
the message is disabled. the message is disabled.
Added 8400 regression test set and test8400.cal to test the new Added 8400 regression test set and test8400.cal to test the new
quit and config("verbose_quit") functionality. quit and config("verbose_quit") functionality.
@@ -33,34 +33,34 @@ Following is the change from calc version 2.11.0t8.9.1 to date:
When prompt() occurs while reading a file, it will take input from When prompt() occurs while reading a file, it will take input from
the terminal rather than taking it from a file. For example: the terminal rather than taking it from a file. For example:
/* This demonstrates the use of prompt() and some other things */ /* This demonstrates the use of prompt() and some other things */
config("verbose_quit", 0); config("verbose_quit", 0);
define getnumber() { define getnumber() {
local x; local x;
for (;;) { for (;;) {
x = eval(prompt(">>> ")); x = eval(prompt(">>> "));
if (isnum(x)) if (isnum(x))
return x; return x;
print "Not a number! Try again"; print "Not a number! Try again";
}
} }
} print "This will display the sqrt of each number you enter";
print "This will display the sqrt of each number you enter"; print "Enter quit to stop";
print "Enter quit to stop"; for (;;) {
for (;;) { print sqrt(getnumber());
print sqrt(getnumber()); }
} print "Good bye";
print "Good bye";
Comments entered at input terminal level may be spread over several Comments entered at input terminal level may be spread over several
lines. For example: lines. For example:
/* /*
* Assume that this calc script is called: comment.cal * Assume that this calc script is called: comment.cal
* Then these commands now work: * Then these commands now work:
* cat comment.cal | calc * cat comment.cal | calc
* calc < comment.cal * calc < comment.cal
*/ */
print "Hello"; print "Hello";
Added: Added:
@@ -95,21 +95,20 @@ Following is the change from calc version 2.11.0t8.9.1 to date:
GNU-readline. Note that GNU-readline is not shipped with calc. GNU-readline. Note that GNU-readline is not shipped with calc.
His patch only provides the hooks to use it. One must comment out: His patch only provides the hooks to use it. One must comment out:
USE_READLINE= USE_READLINE=
READLINE_LIB= READLINE_LIB=
READLINE_INCLUDE= READLINE_INCLUDE=
and comment in: and comment in:
USE_READLINE= -DUSE_READLINE USE_READLINE= -DUSE_READLINE
READLINE_LIB= -lreadline -lhistory READLINE_LIB= -lreadline -lhistory
READLINE_INCLUDE= -I/usr/include/readline READLINE_INCLUDE= -I/usr/include/readline
in addition to pre-installing GNU-readline in your system to use in addition to pre-installing GNU-readline in your system to use
this facility. this facility.
Changed the "object already defined" math_error message to a Changed the "object already defined" math_error to a scanerror message.
scanerror message.
Removed the limit on the number of object types. Removed the limit on the number of object types.
@@ -154,6 +153,65 @@ Following is the change from calc version 2.11.0t8.9.1 to date:
Fixed the URLs found thruout the source and documentation which did Fixed the URLs found thruout the source and documentation which did
not and in /, but should for performance and server load reasons. not and in /, but should for performance and server load reasons.
Cleaned up and improved handling of "mat" and "obj". The comma in:
mat A[2], B[3];
is changed to whatever is appropriate in the context:
+ comma operator
+ separator of arguments in a function call
+ separator of arguments in a defintion
etc.
The expression (mat A[2]), B[3] returns B[3], assuming B already
exists as something created by a statement like: global mat B[4].
What used to be done by the expression:
mat A[2], B[3]
will now require something like:
mat A[2], mat B[3] or A = mat[2], B = mat[3]
For example, if obj point and obj pair are known types, the
following is now allowed:
L = list(mat[2], mat[3], obj point, obj pair)
As another example, the following is allowed:
define f(a = mat[2] = {3,4}) = 5 * a;
as well as the following:
obj point {x,y}, PP = obj pair {A,B} = {obj point, obj point}
which creates two object types at compile time and when executed,
assigns a pair-object value to a variable PP.
Fixed a bug whereby a for loop would behave incorrectly. For example:
config("trace", 2),
global x;
define f() {for ( ; x > 0; x--) {print x;}}
x = 5, f()
will stop after printing 1 instead of looping forever.
Added values l_format, which when CHECK_L_FORMAT is defined ahead
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.
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
will define HAVE_STRDUP is the system has strdup(). If HAVE_STRDUP
is not defined, then calc will use calc_strdup() to simulate
the real strdup() function.
Following is the change from calc version 2.11.0t8 to 2.11.0t8.9: Following is the change from calc version 2.11.0t8 to 2.11.0t8.9:

View File

@@ -273,6 +273,18 @@ HAVE_URANDOM=
HAVE_GETRUSAGE= HAVE_GETRUSAGE=
#HAVE_GETRUSAGE= -DHAVE_NO_GETRUSAGE #HAVE_GETRUSAGE= -DHAVE_NO_GETRUSAGE
# Determine if we have strdup()
#
# If HAVE_STRDUP is empty, this makefile will run the have_memmv program
# to determine if strdup() is supported. If HAVE_STRDUP is set to
# -DHAVE_NO_STRDUP, then calc will use internal functions to simulate
# the memory move function that does correct overlapping memory modes.
#
# If in doubt, leave HAVE_STRDUP empty and this Makefile will figure it out.
#
HAVE_STRDUP=
#HAVE_STRDUP= -DHAVE_NO_STRDUP
# Some architectures such as Sparc do not allow one to access 32 bit values # Some architectures such as Sparc do not allow one to access 32 bit values
# that are not alligned on a 32 bit boundary. # that are not alligned on a 32 bit boundary.
# #
@@ -762,7 +774,7 @@ CC= ${PURIFY} ${LCC}
# #
### ###
# #
# RS6000 set # AIX RS/6000 set
# #
#CCWARN= #CCWARN=
#CCOPT= ${DEBUG} ${NO_SHARED} #CCOPT= ${DEBUG} ${NO_SHARED}
@@ -932,7 +944,8 @@ BUILD_H_SRC= align32.h args.h calcerr.h conf.h endian_calc.h \
have_stdlib.h have_string.h have_times.h have_uid_t.h \ have_stdlib.h have_string.h have_times.h have_uid_t.h \
have_unistd.h longbits.h longlong.h terminal.h calc_errno.h \ have_unistd.h longbits.h longlong.h terminal.h calc_errno.h \
have_ustat.h have_getsid.h have_getpgid.h \ have_ustat.h have_getsid.h have_getpgid.h \
have_gettime.h have_getprid.h have_urandom.h have_rusage.h have_gettime.h have_getprid.h have_urandom.h have_rusage.h \
have_strdup.h
# we build these .c files during the make # we build these .c files during the make
# #
@@ -946,7 +959,7 @@ UTIL_C_SRC= align32.c endian.c longbits.c have_newstr.c have_uid_t.c \
have_const.c have_stdvs.c have_varvs.c fposval.c have_fpos.c \ have_const.c have_stdvs.c have_varvs.c fposval.c have_fpos.c \
longlong.c have_offscl.c have_posscl.c have_memmv.c calc_errno.c \ longlong.c have_offscl.c have_posscl.c have_memmv.c calc_errno.c \
have_ustat.c have_getsid.c have_getpgid.c \ have_ustat.c have_getsid.c have_getpgid.c \
have_gettime.c have_getprid.c have_rusage.c have_gettime.c have_getprid.c have_rusage.c have_strdup.c
# these awk and sed tools are used in the process of building BUILD_H_SRC # these awk and sed tools are used in the process of building BUILD_H_SRC
# and BUILD_C_SRC # and BUILD_C_SRC
@@ -962,20 +975,20 @@ UTIL_OBJS= endian.o longbits.o have_newstr.o have_uid_t.o \
have_const.o fposval.o have_fpos.o longlong.o try_strarg.o \ have_const.o fposval.o have_fpos.o longlong.o try_strarg.o \
have_stdvs.o have_varvs.o have_posscl.o have_memmv.o calc_errno.o \ have_stdvs.o have_varvs.o have_posscl.o have_memmv.o calc_errno.o \
have_ustat.o have_getsid.o have_getpgid.o \ have_ustat.o have_getsid.o have_getpgid.o \
have_gettime.o have_getprid.o ver_calc.o have_rusage.o have_gettime.o have_getprid.o ver_calc.o have_rusage.o have_strdup.o
# these temp files may be created (and removed) during the build of BUILD_C_SRC # these temp files may be created (and removed) during the build of BUILD_C_SRC
# #
UTIL_TMP= ll_tmp fpos_tmp fposv_tmp const_tmp uid_tmp newstr_tmp vs_tmp \ UTIL_TMP= ll_tmp fpos_tmp fposv_tmp const_tmp uid_tmp newstr_tmp vs_tmp \
calc_errno_tmp memmv_tmp offscl_tmp posscl_tmp newstr_tmp \ calc_errno_tmp memmv_tmp offscl_tmp posscl_tmp newstr_tmp \
getsid_tmp gettime_tmp getprid_tmp rusage_tmp getsid_tmp gettime_tmp getprid_tmp rusage_tmp strdup_tmp
# these utility progs may be used in the process of building BUILD_H_SRC # these utility progs may be used in the process of building BUILD_H_SRC
# #
UTIL_PROGS= align32 fposval have_uid_t longlong have_const \ UTIL_PROGS= align32 fposval have_uid_t longlong have_const \
endian longbits have_newstr have_stdvs have_varvs calc_errno \ endian longbits have_newstr have_stdvs have_varvs calc_errno \
have_ustat have_getsid have_getpgid \ have_ustat have_getsid have_getpgid \
have_gettime have_getprid ver_calc have_gettime have_getprid ver_calc have_strdup
# These files are required by the regress.cal regression test. # These files are required by the regress.cal regression test.
# #
@@ -1128,13 +1141,14 @@ calc.1: calc.man ${MAKE_FILE}
## ##
calc.o: calc.c ${MAKE_FILE} calc.o: calc.c ${MAKE_FILE}
${CC} ${CFLAGS} ${CCOPT} ${ALLOW_CUSTOM} -c calc.c ${CC} ${CFLAGS} ${ALLOW_CUSTOM} -c calc.c
custom.o: custom.c ${MAKE_FILE} custom.o: custom.c ${MAKE_FILE}
${CC} ${CFLAGS} ${ALLOW_CUSTOM} -c custom.c ${CC} ${CFLAGS} ${ALLOW_CUSTOM} -c custom.c
hist.o: hist.c ${MAKE_FILE} hist.o: hist.c ${MAKE_FILE}
${CC} ${CFLAGS} ${TERMCONTROL} ${USE_READLINE} ${READLINE_INCLUDE} -c hist.c ${CC} ${CFLAGS} ${TERMCONTROL} ${USE_READLINE} ${READLINE_INCLUDE} \
-c hist.c
func.o: func.c ${MAKE_FILE} func.o: func.c ${MAKE_FILE}
${CC} ${CFLAGS} ${ALLOW_CUSTOM} -c func.c ${CC} ${CFLAGS} ${ALLOW_CUSTOM} -c func.c
@@ -1535,6 +1549,8 @@ longlong.h: longlong.c have_stdlib.h have_string.h ${MAKE_FILE}
else \ else \
echo '#undef HAVE_LONGLONG' >> longlong.h; \ echo '#undef HAVE_LONGLONG' >> longlong.h; \
echo '#define LONGLONG_BITS 0 /* no */' >> longlong.h; \ echo '#define LONGLONG_BITS 0 /* no */' >> longlong.h; \
echo '#undef LL_FORMAT' >> longlong.h; \
echo '#undef L_FORMAT' >> longlong.h; \
fi fi
${Q}echo '' >> longlong.h ${Q}echo '' >> longlong.h
${Q}echo '' >> longlong.h ${Q}echo '' >> longlong.h
@@ -2174,6 +2190,45 @@ have_rusage.h: have_rusage.c ${MAKE_FILE}
true; \ true; \
fi fi
have_strdup.h: have_strdup.c ${MAKE_FILE}
-${Q}rm -f have_strdup have_strdup.o strdup_tmp have_strdup.h
${Q}echo 'forming have_strdup.h'
${Q}echo '/*' > have_strdup.h
${Q}echo ' * DO NOT EDIT -- generated by the Makefile' >> have_strdup.h
${Q}echo ' */' >> have_strdup.h
${Q}echo '' >> have_strdup.h
${Q}echo '' >> have_strdup.h
${Q}echo '#if !defined(__HAVE_RUSAGE_H__)' >> have_strdup.h
${Q}echo '#define __HAVE_RUSAGE_H__' >> have_strdup.h
${Q}echo '' >> have_strdup.h
${Q}echo '' >> have_strdup.h
${Q}echo '/* do we have or want getstrdup()? */' >> have_strdup.h
-${Q}rm -f have_strdup.o have_strdup
-${Q}${LCC} ${ICFLAGS} ${HAVE_STRDUP} have_strdup.c -c 2>/dev/null; \
true
-${Q}${LCC} ${ILDFLAGS} have_strdup.o -o have_strdup 2>/dev/null; true
-${Q}${SHELL} -c "./have_strdup > strdup_tmp 2>/dev/null" \
>/dev/null 2>&1; true
-${Q}if [ -s strdup_tmp ]; then \
cat strdup_tmp >> have_strdup.h; \
else \
echo '#undef HAVE_STRDUP /* no */' >> have_strdup.h; \
fi
${Q}echo '' >> have_strdup.h
${Q}echo '' >> have_strdup.h
${Q}echo '#endif /* !__HAVE_RUSAGE_H__ */' >> have_strdup.h
-${Q}rm -f have_strdup have_strdup.o strdup_tmp
${Q}echo 'have_strdup.h formed'
-@if [ -z "${Q}" ]; then \
echo ''; \
echo '=-=-= start of $@ =-=-='; \
cat $@; \
echo '=-=-= end of $@ =-=-='; \
echo ''; \
else \
true; \
fi
args.h: have_stdvs.c have_varvs.c have_string.h have_unistd.h have_string.h args.h: have_stdvs.c have_varvs.c have_string.h have_unistd.h have_string.h
-${Q}rm -f args.h have_args -${Q}rm -f args.h have_args
${Q}echo 'forming args.h' ${Q}echo 'forming args.h'
@@ -3048,6 +3103,7 @@ addop.o: config.h
addop.o: endian_calc.h addop.o: endian_calc.h
addop.o: func.h addop.o: func.h
addop.o: hash.h addop.o: hash.h
addop.o: have_const.h
addop.o: have_malloc.h addop.o: have_malloc.h
addop.o: have_memmv.h addop.o: have_memmv.h
addop.o: have_newstr.h addop.o: have_newstr.h
@@ -3104,6 +3160,7 @@ blkcpy.o: config.h
blkcpy.o: endian_calc.h blkcpy.o: endian_calc.h
blkcpy.o: file.h blkcpy.o: file.h
blkcpy.o: hash.h blkcpy.o: hash.h
blkcpy.o: have_const.h
blkcpy.o: have_fpos.h blkcpy.o: have_fpos.h
blkcpy.o: have_malloc.h blkcpy.o: have_malloc.h
blkcpy.o: have_memmv.h blkcpy.o: have_memmv.h
@@ -3208,6 +3265,7 @@ codegen.o: config.h
codegen.o: endian_calc.h codegen.o: endian_calc.h
codegen.o: func.h codegen.o: func.h
codegen.o: hash.h codegen.o: hash.h
codegen.o: have_const.h
codegen.o: have_malloc.h codegen.o: have_malloc.h
codegen.o: have_memmv.h codegen.o: have_memmv.h
codegen.o: have_newstr.h codegen.o: have_newstr.h
@@ -3292,6 +3350,7 @@ const.o: config.h
const.o: const.c const.o: const.c
const.o: endian_calc.h const.o: endian_calc.h
const.o: hash.h const.o: hash.h
const.o: have_const.h
const.o: have_malloc.h const.o: have_malloc.h
const.o: have_memmv.h const.o: have_memmv.h
const.o: have_newstr.h const.o: have_newstr.h
@@ -3346,6 +3405,7 @@ file.o: file.c
file.o: file.h file.o: file.h
file.o: fposval.h file.o: fposval.h
file.o: hash.h file.o: hash.h
file.o: have_const.h
file.o: have_fpos.h file.o: have_fpos.h
file.o: have_malloc.h file.o: have_malloc.h
file.o: have_memmv.h file.o: have_memmv.h
@@ -3447,6 +3507,7 @@ have_rusage.o: have_rusage.c
have_stdvs.o: have_stdvs.c have_stdvs.o: have_stdvs.c
have_stdvs.o: have_string.h have_stdvs.o: have_string.h
have_stdvs.o: have_unistd.h 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_uid_t.c
have_uid_t.o: have_unistd.h have_uid_t.o: have_unistd.h
have_ustat.o: have_ustat.c have_ustat.o: have_ustat.c
@@ -3463,6 +3524,7 @@ help.o: conf.h
help.o: config.h help.o: config.h
help.o: endian_calc.h help.o: endian_calc.h
help.o: hash.h help.o: hash.h
help.o: have_const.h
help.o: have_malloc.h help.o: have_malloc.h
help.o: have_memmv.h help.o: have_memmv.h
help.o: have_newstr.h help.o: have_newstr.h
@@ -3488,10 +3550,12 @@ hist.o: cmath.h
hist.o: config.h hist.o: config.h
hist.o: endian_calc.h hist.o: endian_calc.h
hist.o: hash.h hist.o: hash.h
hist.o: have_const.h
hist.o: have_malloc.h hist.o: have_malloc.h
hist.o: have_memmv.h hist.o: have_memmv.h
hist.o: have_newstr.h hist.o: have_newstr.h
hist.o: have_stdlib.h hist.o: have_stdlib.h
hist.o: have_strdup.h
hist.o: have_string.h hist.o: have_string.h
hist.o: have_unistd.h hist.o: have_unistd.h
hist.o: hist.c hist.o: hist.c
@@ -3516,6 +3580,7 @@ input.o: conf.h
input.o: config.h input.o: config.h
input.o: endian_calc.h input.o: endian_calc.h
input.o: hash.h input.o: hash.h
input.o: have_const.h
input.o: have_malloc.h input.o: have_malloc.h
input.o: have_memmv.h input.o: have_memmv.h
input.o: have_newstr.h input.o: have_newstr.h
@@ -3546,6 +3611,7 @@ label.o: config.h
label.o: endian_calc.h label.o: endian_calc.h
label.o: func.h label.o: func.h
label.o: hash.h label.o: hash.h
label.o: have_const.h
label.o: have_malloc.h label.o: have_malloc.h
label.o: have_memmv.h label.o: have_memmv.h
label.o: have_newstr.h label.o: have_newstr.h
@@ -3580,6 +3646,7 @@ lib_calc.o: have_malloc.h
lib_calc.o: have_memmv.h lib_calc.o: have_memmv.h
lib_calc.o: have_newstr.h lib_calc.o: have_newstr.h
lib_calc.o: have_stdlib.h lib_calc.o: have_stdlib.h
lib_calc.o: have_strdup.h
lib_calc.o: have_string.h lib_calc.o: have_string.h
lib_calc.o: have_unistd.h lib_calc.o: have_unistd.h
lib_calc.o: label.h lib_calc.o: label.h
@@ -3675,6 +3742,7 @@ math_error.o: cmath.h
math_error.o: config.h math_error.o: config.h
math_error.o: endian_calc.h math_error.o: endian_calc.h
math_error.o: hash.h math_error.o: hash.h
math_error.o: have_const.h
math_error.o: have_malloc.h math_error.o: have_malloc.h
math_error.o: have_memmv.h math_error.o: have_memmv.h
math_error.o: have_newstr.h math_error.o: have_newstr.h
@@ -3725,6 +3793,7 @@ obj.o: config.h
obj.o: endian_calc.h obj.o: endian_calc.h
obj.o: func.h obj.o: func.h
obj.o: hash.h obj.o: hash.h
obj.o: have_const.h
obj.o: have_malloc.h obj.o: have_malloc.h
obj.o: have_memmv.h obj.o: have_memmv.h
obj.o: have_newstr.h obj.o: have_newstr.h
@@ -4030,6 +4099,7 @@ string.o: cmath.h
string.o: config.h string.o: config.h
string.o: endian_calc.h string.o: endian_calc.h
string.o: hash.h string.o: hash.h
string.o: have_const.h
string.o: have_malloc.h string.o: have_malloc.h
string.o: have_memmv.h string.o: have_memmv.h
string.o: have_newstr.h string.o: have_newstr.h
@@ -4055,6 +4125,7 @@ symbol.o: config.h
symbol.o: endian_calc.h symbol.o: endian_calc.h
symbol.o: func.h symbol.o: func.h
symbol.o: hash.h symbol.o: hash.h
symbol.o: have_const.h
symbol.o: have_malloc.h symbol.o: have_malloc.h
symbol.o: have_memmv.h symbol.o: have_memmv.h
symbol.o: have_newstr.h symbol.o: have_newstr.h
@@ -4084,6 +4155,7 @@ token.o: cmath.h
token.o: config.h token.o: config.h
token.o: endian_calc.h token.o: endian_calc.h
token.o: hash.h token.o: hash.h
token.o: have_const.h
token.o: have_malloc.h token.o: have_malloc.h
token.o: have_memmv.h token.o: have_memmv.h
token.o: have_newstr.h token.o: have_newstr.h
@@ -4143,6 +4215,7 @@ version.o: cmath.h
version.o: config.h version.o: config.h
version.o: endian_calc.h version.o: endian_calc.h
version.o: hash.h version.o: hash.h
version.o: have_const.h
version.o: have_malloc.h version.o: have_malloc.h
version.o: have_memmv.h version.o: have_memmv.h
version.o: have_newstr.h version.o: have_newstr.h

9
calc.c
View File

@@ -39,9 +39,6 @@
/* /*
* static definitions and functions * static definitions and functions
*/ */
static char *usage = "usage: %s [-c] [-C] [-d] [-e] [-h] [-i] [-m mode]\n"
"\t[-D calc_debug[:lib_debug:[user_debug]]]\n"
"\t[-n] [-p] [-q] [-u] [-v] [[--] calc_cmd ...]\n";
static void intint(int arg); /* interrupt routine */ static void intint(int arg); /* interrupt routine */
@@ -153,7 +150,11 @@ main(int argc, char **argv)
* we are too early in processing to call * we are too early in processing to call
* libcalc_call_me_last() - nothing to cleanup * libcalc_call_me_last() - nothing to cleanup
*/ */
fprintf(stderr, usage, program); fprintf(stderr,
"usage: %s [-c] [-C] [-d] [-e] [-h] [-i] [-m mode]\n"
"\t[-D calc_debug[:lib_debug:[user_debug]]]\n"
"\t[-n] [-p] [-q] [-u] [-v] [[--] calc_cmd ...]\n",
program);
exit(1); exit(1);
} }
} }

3
calc.h
View File

@@ -14,6 +14,8 @@
#include "value.h" #include "value.h"
#include "have_const.h"
/* /*
* Configuration definitions * Configuration definitions
@@ -140,6 +142,7 @@ extern void givehelp(char *type);
extern void libcalc_call_me_first(void); extern void libcalc_call_me_first(void);
extern void libcalc_call_me_last(void); extern void libcalc_call_me_last(void);
extern void showerrors(void); extern void showerrors(void);
extern char *calc_strdup(CONST char *);
/* /*
* Initialization * Initialization

View File

@@ -263,7 +263,7 @@ ungetfunction(void)
return; return;
default: default:
scanerror(T_SEMICOLON, scanerror(T_SEMICOLON,
"Non-name arg for undefine"); "Non-name arg for undefine");
return; return;
} }
} }
@@ -521,11 +521,9 @@ getonevariable(int symtype)
* | BREAK ';' * | BREAK ';'
* | RETURN assignment ';' * | RETURN assignment ';'
* | GOTO label ';' * | GOTO label ';'
* | MAT name '[' value [ ':' value ] [',' value [ ':' value ] ] ']' ';'
* | OBJ type '{' arg [ ',' arg ] ... '}' ] ';'
* | OBJ type name [ ',' name ] ';'
* | PRINT assignment [, assignment ] ... ';' * | PRINT assignment [, assignment ] ... ';'
* | QUIT [ string ] ';' * | QUIT [ string ] ';'
* | ABORT [ string ] ';'
* | SHOW item ';' * | SHOW item ';'
* | body * | body
* | assignment ';' * | assignment ';'
@@ -707,14 +705,14 @@ getstatement(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *d
} }
} }
if (gettoken() != T_RIGHTPAREN) { /* have 'c' part */ if (gettoken() != T_RIGHTPAREN) { /* have 'c' part */
if (label1.l_offset <= 0) if (label1.l_offset < 0)
addoplabel(OP_JUMP, &label3); addoplabel(OP_JUMP, &label3);
setlabel(&label2); setlabel(&label2);
contlabel = &label2; contlabel = &label2;
rescantoken(); rescantoken();
(void) getexprlist(); (void) getexprlist();
addop(OP_POP); addop(OP_POP);
if (label1.l_offset > 0) if (label1.l_offset >= 0)
addoplabel(OP_JUMP, &label1); addoplabel(OP_JUMP, &label1);
if (gettoken() != T_RIGHTPAREN) { if (gettoken() != T_RIGHTPAREN) {
(void) tokenmode(oldmode); (void) tokenmode(oldmode);
@@ -734,15 +732,21 @@ getstatement(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *d
case T_WHILE: case T_WHILE:
oldmode = tokenmode(TM_DEFAULT); oldmode = tokenmode(TM_DEFAULT);
contlabel = &label1; contlabel = &label1;
breaklabel = &label2;
clearlabel(contlabel); clearlabel(contlabel);
clearlabel(breaklabel);
setlabel(contlabel); setlabel(contlabel);
getcondition(); getcondition();
addoplabel(OP_JUMPZ, breaklabel); if (gettoken() != T_SEMICOLON) {
getstatement(contlabel, breaklabel, NULL_LABEL, NULL_LABEL); breaklabel = &label2;
addoplabel(OP_JUMP, contlabel); clearlabel(breaklabel);
setlabel(breaklabel); addoplabel(OP_JUMPZ, breaklabel);
rescantoken();
getstatement(contlabel, breaklabel,
NULL_LABEL, NULL_LABEL);
addoplabel(OP_JUMP, contlabel);
setlabel(breaklabel);
} else {
addoplabel(OP_JUMPNZ, contlabel);
}
(void) tokenmode(oldmode); (void) tokenmode(oldmode);
return; return;
@@ -1053,18 +1057,14 @@ getoneobj(long index, int symtype)
} }
/* /*
* Routine to collect a set of variables for the specified object type * Routine to assign a specified object-type value to each of a set of
* and initialize them as being that type of object. * variables in a "global", "local" or "static" declaration, or, if
* Here * symtype is SYM_UNDEFINED, to create one object value of the specified
* objlist = name initlist [ ',' name initlist ] ... ';'. * type.
* If symtype is SYM_UNDEFINED, then this is an OBJ statement where the
* values can be any variable expression, and no symbols are to be defined.
* Otherwise this is part of a declaration, and the variables must be raw
* symbol names which are defined with the specified symbol type.
* *
* given: * given:
* name object name * name object name
* symtype type of symbol to collect for * symtype declaration type
*/ */
static void static void
getobjvars(char *name, int symtype) getobjvars(char *name, int symtype)
@@ -1078,6 +1078,8 @@ getobjvars(char *name, int symtype)
} }
for (;;) { for (;;) {
getoneobj(index, symtype); getoneobj(index, symtype);
if (symtype == SYM_UNDEFINED)
return;
if (gettoken() != T_COMMA) { if (gettoken() != T_COMMA) {
rescantoken(); rescantoken();
return; return;
@@ -1921,11 +1923,6 @@ getterm(void)
case T_MAT: case T_MAT:
getonematrix(SYM_UNDEFINED); getonematrix(SYM_UNDEFINED);
while (gettoken() == T_COMMA) {
addop(OP_POP);
getonematrix(SYM_UNDEFINED);
}
rescantoken();
type = EXPR_ASSIGN; type = EXPR_ASSIGN;
break; break;

View File

@@ -310,6 +310,15 @@ libcustcalc.a: ${CUSTCALC_OBJ} ${MAKE_FILE} ../Makefile
ar qc libcustcalc.a ${CUSTCALC_OBJ} ar qc libcustcalc.a ${CUSTCALC_OBJ}
${RANLIB} libcustcalc.a ${RANLIB} libcustcalc.a
##
#
# Special .o files
#
##
c_sysinfo.o: c_sysinfo.c ${MAKE_FILE}
${CC} ${CFLAGS} c_sysinfo.c -c
## ##
# #
# used by the upper level Makefile # used by the upper level Makefile

View File

@@ -33,6 +33,7 @@
#include "../config.h" #include "../config.h"
#include "../calc.h" #include "../calc.h"
#include "../longbits.h" #include "../longbits.h"
#define CHECK_L_FORMAT
#include "../longlong.h" #include "../longlong.h"
#include "../block.h" #include "../block.h"
#include "../calcerr.h" #include "../calcerr.h"
@@ -306,17 +307,33 @@ static void
dump_name_value(void) dump_name_value(void)
{ {
struct infoname *p; /* current infoname */ struct infoname *p; /* current infoname */
char *fmt; /* printf value format */
/* dump the entire table */ /* dump the entire table */
for (p = sys_info; p->name != NULL; ++p) { for (p = sys_info; p->name != NULL; ++p) {
if (p->str == NULL) { if (p->str == NULL) {
#if LONG_BITS == FULL_BITS || FULL_BITS == 32 || !defined(HAVE_LONGLONG) #if LONG_BITS == FULL_BITS || FULL_BITS == 32 || !defined(HAVE_LONGLONG)
printf("%s%-23s\t%-8lu\t(0x%lx)\n", fmt = "%s%-23s\t%-8lu\t(0x%lx)\n";
printf(fmt,
(conf->tab_ok ? "\t" : ""), p->name, (conf->tab_ok ? "\t" : ""), p->name,
(unsigned long)p->nmbr, (unsigned long)p->nmbr,
(unsigned long)p->nmbr); (unsigned long)p->nmbr);
#else #else
printf("%s%-23s\t%-8llu\t(0x%llx)\n", /*
* Determine of %ld can print a 64 bit long long.
*
* Some systems that can make use of %ld to print a
* a 64 bit value do not support the %lld type.
* So we will only try %lld if %ld does not work.
*/
if (l_format < 0) {
/* %ld prints lower 32 bits only, use %lld */
fmt = "%s%-23s\t%-8llu\t(0x%llx)\n";
} else {
/* %ld prints all 64 bits, use %ld */
fmt = "%s%-23s\t%-8lu\t(0x%lx)\n";
}
printf(fmt,
(conf->tab_ok ? "\t" : ""), p->name, (conf->tab_ok ? "\t" : ""), p->name,
(unsigned long long)p->nmbr, (unsigned long long)p->nmbr,
(unsigned long long)p->nmbr); (unsigned long long)p->nmbr);
@@ -337,17 +354,33 @@ static void
dump_mening_value(void) dump_mening_value(void)
{ {
struct infoname *p; /* current infoname */ struct infoname *p; /* current infoname */
char *fmt; /* printf value format */
/* dump the entire table */ /* dump the entire table */
for (p = sys_info; p->name != NULL; ++p) { for (p = sys_info; p->name != NULL; ++p) {
if (p->str == NULL) { if (p->str == NULL) {
#if LONG_BITS == FULL_BITS || FULL_BITS == 32 || !defined(HAVE_LONGLONG) #if LONG_BITS == FULL_BITS || FULL_BITS == 32 || !defined(HAVE_LONGLONG)
printf("%s%-36.36s\t%-8lu\t(0x%lx)\n", fmt = "%s%-36.36s\t%-8lu\t(0x%lx)\n";
printf(fmt,
(conf->tab_ok ? "\t" : ""), p->meaning, (conf->tab_ok ? "\t" : ""), p->meaning,
(unsigned long)p->nmbr, (unsigned long)p->nmbr,
(unsigned long)p->nmbr); (unsigned long)p->nmbr);
#else #else
printf("%s%-36.36s\t%-8llu\t(0x%llx)\n", /*
* Determine of %ld can print a 64 bit long long.
*
* Some systems that can make use of %ld to print a
* a 64 bit value do not support the %lld type.
* So we will only try %lld if %ld does not work.
*/
if (l_format < 0) {
/* %ld prints lower 32 bits only, use %lld */
fmt = "%s%-36.36s\t%-8llu\t(0x%llx)\n";
} else {
/* %ld prints all 64 bits, use %ld */
fmt = "%s%-36.36s\t%-8lu\t(0x%lx)\n";
}
printf(fmt,
(conf->tab_ok ? "\t" : ""), p->meaning, (conf->tab_ok ? "\t" : ""), p->meaning,
(unsigned long long)p->nmbr, (unsigned long long)p->nmbr,
(unsigned long long)p->nmbr); (unsigned long long)p->nmbr);

2
func.c
View File

@@ -7339,7 +7339,7 @@ static CONST struct builtin builtins[] = {
* See the builtin rule in the help/Makefile for details. * See the builtin rule in the help/Makefile for details.
*/ */
#if defined(FUNCLIST) #if defined(FUNCLIST)
/*ARGSUSED */ /*ARGSUSED*/
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {

62
have_strdup.c Normal file
View File

@@ -0,0 +1,62 @@
/*
* have_strdup - Determine if we strdup()
*
* usage:
* have_strdup
*
* Not all systems have the strdup() function, so this may not
* compile on your system.
*
* This prog outputs several defines:
*
* HAVE_STRDUP
* defined ==> use strdup()
* undefined ==> do not call or cannot call strdup()
*/
/*
* Copyright (c) 1999 by Landon Curt Noll. All Rights Reserved.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby granted,
* provided that the above copyright, this permission notice and text
* this comment, and the disclaimer below appear in all of the following:
*
* supporting documentation
* source copies
* source works derived from this source
* binaries derived from this source or from derived source
*
* LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
* EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* chongo was here /\../\
*/
#include <string.h>
int
main(void)
{
#if defined(HAVE_NO_STRDUP)
printf("#undef HAVE_STRDUP /* no */\n");
#else /* HAVE_NO_STRDUP */
char *p;
p = strdup("#define HAVE_STRDUP /* yes */");
if (p != NULL) {
printf("%s\n", p);
}
#endif /* HAVE_NO_STRDUP */
/* exit(0); */
return 0;
}

View File

@@ -3,6 +3,5 @@ s/NUMBER[ ]*\*/int /
s/NUMBER/int/ s/NUMBER/int/
s/STRINGHEAD/int/ s/STRINGHEAD/int/
s/\(".*",.*,.*\),.*,.*,.*,.*,/\1, 0, 0, 0, 0,/ s/\(".*",.*,.*\),.*,.*,.*,.*,/\1, 0, 0, 0, 0,/
s/showbuiltins/main/
s/[ ][ ]*$// s/[ ][ ]*$//
p p

View File

@@ -50,6 +50,8 @@ Very High priority items:
* Fix any 'Known bugs' as noted in the BUGS file or as * Fix any 'Known bugs' as noted in the BUGS file or as
displayed by 'calc help bugs'. displayed by 'calc help bugs'.
* Copyleft calc and place it under a LGPL.
=-= =-=
High priority items: High priority items:
@@ -79,10 +81,9 @@ High priority items:
then a $PAGER should be forked and execed after doing things such then a $PAGER should be forked and execed after doing things such
as closing open file descriptors that the $PAGER does not need. as closing open file descriptors that the $PAGER does not need.
* Inspect changes made since the last major calc release (the * The arg passdown to the lower level Makfiles should be reviewed
initial x.y.z version ... prior to any t sub-version) to help to determine which items really need to be passed down. The lower
ensure that they have not introduced new or re-introduced old bugs level Makefiles should default to the shipped values.
into calc.
* Consider using configure to build the calc Makefile. * Consider using configure to build the calc Makefile.

5
hist.c
View File

@@ -31,6 +31,11 @@
#include "terminal.h" #include "terminal.h"
#include "have_string.h" #include "have_string.h"
#include "have_strdup.h"
#if !defined(HAVE_STRDUP)
# define strdup(x) calc_strdup((CONST char *)(x))
#endif /* HAVE_STRDUP */
#if defined(USE_TERMIOS) #if defined(USE_TERMIOS)
# include <termios.h> # include <termios.h>

View File

@@ -1694,6 +1694,7 @@ define test_obj()
{ {
static obj surd a; static obj surd a;
static obj surd b; static obj surd b;
local PP;
print '1800: Beginning object test'; print '1800: Beginning object test';
@@ -1731,7 +1732,10 @@ define test_obj()
vrfy(a <= a, '1828: a < a'); vrfy(a <= a, '1828: a < a');
vrfy(isobj(a) == 1, '1829: isobj(a) == 1'); vrfy(isobj(a) == 1, '1829: isobj(a) == 1');
print '1830: Ending object test'; obj pt {x,y}, PP = obj pair {A,B} = {obj pt, obj pt};
print '1830: obj pt {x,y}, PP = obj pair {A,B} = {obj pt, obj pt}';
print '1831: Ending object test';
} }
print '028: parsed test_obj()'; print '028: parsed test_obj()';
@@ -4687,8 +4691,8 @@ define test_commaeq()
/* /*
* matrix assignment * matrix assignment
*/ */
mat A[3] = {1,2,3}, B[2] = {1,2}; mat A[3] = {1,2,3}, mat B[2] = {1,2};
print '5625: mat A[3] = {1,2,3}, B[2] = {1,2}'; print '5625: mat A[3] = {1,2,3}, mat B[2] = {1,2}';
vrfy(A[0] == 1, '5626: A[0] == 1'); vrfy(A[0] == 1, '5626: A[0] == 1');
vrfy(B[1] == 2, '5627: B[1] == 2'); vrfy(B[1] == 2, '5627: B[1] == 2');
@@ -4916,8 +4920,8 @@ define test_assign(base, work)
print base+3: ': X5800 = base+3'; print base+3: ': X5800 = base+3';
Y5800 = base+4; Y5800 = base+4;
print base+4: ': Y5800 = base+4'; print base+4: ': Y5800 = base+4';
obj xy5800 A={1,2}, B={3,4}; obj xy5800 A={1,2}, obj xy5800 B={3,4};
print base+5: ': obj xy5800 A={1,2}, B={3,4}'; print base+5: ': obj xy5800 A={1,2}, obj xy5000 B={3,4}';
/* /*
* test assignment * test assignment
@@ -7372,7 +7376,7 @@ vrfy(X5800 == (obj xy5800 = {3,9}),
'5859: X5800 == (obj xy5800 = {3,9})'); '5859: X5800 == (obj xy5800 = {3,9})');
vrfy(errno() > 0, '5860: errno() > 0'); vrfy(errno() > 0, '5860: errno() > 0');
vrfy(strerror() == "Incompatible types for =", vrfy(strerror() == "Incompatible types for =",
'5861: strerror() == "Incompatible types for ="'); '5861: strerror() == "Incompatible types for ="');
X5800 = 2; X5800 = 2;
print '5862: X5800 = 2'; print '5862: X5800 = 2';
vrfy(X5800 == (obj xy5800 = {2,0}), vrfy(X5800 == (obj xy5800 = {2,0}),
@@ -7381,7 +7385,10 @@ X5800 = obj xy5800 = {1,2};
print '5864: X5800 = obj xy5800 = {1,2}'; print '5864: X5800 = obj xy5800 = {1,2}';
vrfy(X5800 == (obj xy5800 = {1,2}), vrfy(X5800 == (obj xy5800 = {1,2}),
'5865: X5800 == (obj xy5800 = {1,2})'); '5865: X5800 == (obj xy5800 = {1,2})');
print '5866: End of 5800 sequence'; define f5800(a8500 = mat[2] = {3,4}) = 5 * a8500;
print '5866: define f5800(a8500 = mat[2] = {3,4}) = 5 * a8500;'
vrfy(f5800() == (mat[] = {15,20}),'5867: f5800() == (mat[] = {15,20})');
print '5868: End of 5800 sequence';
print; print;
return test_is(); return test_is();

View File

@@ -34,6 +34,11 @@
#include "symbol.h" #include "symbol.h"
#include "func.h" #include "func.h"
#include "have_strdup.h"
#if !defined(HAVE_STRDUP)
# define strdup(x) calc_strdup((CONST char *)(x))
#endif /* HAVE_STRDUP */
#include "have_unistd.h" #include "have_unistd.h"
#if defined(HAVE_UNISTD_H) #if defined(HAVE_UNISTD_H)
#include <unistd.h> #include <unistd.h>
@@ -339,7 +344,7 @@ initenv(void)
/* determine the $HOME value */ /* determine the $HOME value */
c = getenv(HOME); c = getenv(HOME);
home = ((no_env || c == NULL) ? NULL : strdup(c)); home = ((no_env || c == NULL) ? NULL : strdup(c));
if (home == NULL || home[0] == '\0') { if (home == NULL || home[0] == '\0') {
ent = (struct passwd *)getpwuid(geteuid()); ent = (struct passwd *)getpwuid(geteuid());
if (ent == NULL) { if (ent == NULL) {
@@ -431,3 +436,45 @@ run_state_name(run state)
} }
return "RUN_invalid"; return "RUN_invalid";
} }
/*
* calc_strdup - calc interface to provide or simulate strdup()
*/
char *
calc_strdup(CONST char *s1)
{
#if defined(HAVE_STRDUP)
return strdup(s1);
#else /* HAVE_STRDUP */
char *ret; /* return string */
/*
* firewall
*/
if (s1 == NULL) {
return NULL;
}
/*
* allocate duplicate storage
*/
ret = (char *)malloc(sizeof(char) * (strlen(s1)+1));
/*
* if we have storage, duplicate the string
*/
if (ret != NULL) {
strcpy(ret, s1);
}
/*
* return the new string, or NULL if malloc failed
*/
return ret;
#endif /* HAVE_STRDUP */
}

View File

@@ -62,8 +62,8 @@
/* /*
* have the compiler try its hand with unsigned and signed long longs * have the compiler try its hand with unsigned and signed long longs
*/ */
unsigned long long val = 4294967297ULL; unsigned long long val = 0x1234567890123456ULL;
long long val2 = -4294967297LL; long long val2 = -1311768467284833366LL; /* -0x1234567890123456 */
int int
@@ -90,14 +90,20 @@ main(int argc, char **argv)
if (longlong_bits > 0) { if (longlong_bits > 0) {
/* /*
* if size is longer than an unsigned long, use it * if size is longer than an unsigned long,
* and the negative 'long long' works, then use long long's
*/ */
if (longlong_bits > sizeof(unsigned long)*8) { if (longlong_bits > sizeof(unsigned long)*8 && val2 < 0) {
/* use long long length */ /* use long long length */
printf("#define HAVE_LONGLONG\n"); printf("#define HAVE_LONGLONG\n");
printf("#define LONGLONG_BITS %d /* yes */\n", printf("#define LONGLONG_BITS %d /* yes */\n",
longlong_bits); longlong_bits);
printf("\n/* does %%lld work or does %%ld? */\n");
printf("#if defined(CHECK_L_FORMAT)\n");
printf("long long l_format = %ld;\n", val);
printf("#endif /* CHECK_L_FORMAT */\n");
} }
} }
/* exit(0); */ /* exit(0); */

10
obj.c
View File

@@ -579,6 +579,16 @@ findelement(char *name)
} }
/*
* Returns the name of object type with specified index
*/
char *
objtypename(unsigned long index)
{
return namestr(&objectnames, (long)index);
}
/* /*
* Return the value table offset to be used for an object element name. * Return the value table offset to be used for an object element name.
* This converts the element index from the element table into an offset * This converts the element index from the element table into an offset

View File

@@ -3773,11 +3773,14 @@ dumpop(unsigned long *pc)
return 3; return 3;
case OP_PRINT: case OP_JUMPZ: case OP_JUMPNZ: case OP_JUMP: case OP_PRINT: case OP_JUMPZ: case OP_JUMPNZ: case OP_JUMP:
case OP_CONDORJUMP: case OP_CONDANDJUMP: case OP_CASEJUMP: case OP_CONDORJUMP: case OP_CONDANDJUMP: case OP_CASEJUMP:
case OP_INITSTATIC: case OP_MATCREATE: case OP_OBJCREATE: case OP_INITSTATIC: case OP_MATCREATE:
case OP_SHOW: case OP_ELEMINIT: case OP_ELEMADDR: case OP_SHOW: case OP_ELEMINIT: case OP_ELEMADDR:
case OP_ELEMVALUE: case OP_JUMPNN: case OP_ELEMVALUE: case OP_JUMPNN:
printf(" %ld\n", *pc); printf(" %ld\n", *pc);
return 2; return 2;
case OP_OBJCREATE:
printf(" %s\n", objtypename(*pc));
return 2;
case OP_NUMBER: case OP_IMAGINARY: case OP_NUMBER: case OP_IMAGINARY:
qprintf(" %r", constvalue(*pc)); qprintf(" %r", constvalue(*pc));
printf("\n"); printf("\n");

3
seed.c
View File

@@ -53,9 +53,10 @@
*/ */
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/resource.h>
#include <time.h> #include <time.h>
#include <sys/time.h>
#include <sys/times.h> #include <sys/times.h>
#include <sys/resource.h>
#include <setjmp.h> #include <setjmp.h>
#include "qmath.h" #include "qmath.h"
#include "longbits.h" #include "longbits.h"

View File

@@ -175,7 +175,10 @@ showglobals(void)
printf("\n"); printf("\n");
} }
} }
printf(count ? "\n" : "No real-valued global variables\n"); if (count == 0) {
printf("No real-valued global variables\n");
}
putchar('\n');
} }

View File

@@ -451,6 +451,7 @@ extern int checkobject(char *name);
extern void showobjfuncs(void); extern void showobjfuncs(void);
extern void showobjtypes(void); extern void showobjtypes(void);
extern int findelement(char *name); extern int findelement(char *name);
extern char *objtypename(unsigned long index);
extern int objoffset(OBJECT *op, long index); extern int objoffset(OBJECT *op, long index);

View File

@@ -18,7 +18,7 @@ static char *program;
#define MAJOR_VER 2 /* major version */ #define MAJOR_VER 2 /* major version */
#define MINOR_VER 11 /* minor version */ #define MINOR_VER 11 /* minor version */
#define MAJOR_PATCH 0 /* patch level or 0 if no patch */ #define MAJOR_PATCH 0 /* patch level or 0 if no patch */
#define MINOR_PATCH "9.4.1" /* test number or empty string if no patch */ #define MINOR_PATCH "9.4.2" /* test number or empty string if no patch */
/* /*
* calc version constants * calc version constants