mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.11.0t9.4.2
This commit is contained in:
55
BUGS
55
BUGS
@@ -96,31 +96,36 @@ Known bugs:
|
||||
the terminal in a 'bad' state, as if stty -icanon -echo -echoe
|
||||
had been executed.
|
||||
|
||||
* Dec Alpha Linux compiling with gcc-2.95.1 (or gcc-2.95.2) and
|
||||
-O2 fails the version 2.11.0t8.10 regression test with:
|
||||
* Use of 'fmt' in the 2nd arg of printf() calls in c_sysinfo.c
|
||||
cause some compilers to issue warnings.
|
||||
|
||||
make -s check
|
||||
000: Beginning regression tests
|
||||
001: Some of these tests may take a while ...
|
||||
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)
|
||||
We are sure some more bugs exist. When you find them, please let
|
||||
us know! See the above for details on how to report and were to
|
||||
EMail your bug reports and hopefully patches to fix them.
|
||||
|
||||
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).
|
||||
Another work-a-round is not use gcc-2.95.1.
|
||||
Other items of note:
|
||||
|
||||
* 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
|
||||
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
|
||||
and without -std0:
|
||||
messages for calc version 2.11.0t9.4 using the Dec's cc with -O2:
|
||||
|
||||
600: Beginning test_bignums
|
||||
601: muldivcheck 1
|
||||
@@ -135,6 +140,12 @@ Known bugs:
|
||||
|
||||
it finally hangs at test 2000.
|
||||
|
||||
We are sure some more bugs exist. When you find them, please let
|
||||
us know! See the above for details on how to report and were to
|
||||
EMail your bug reports and hopefully patches to fix them.
|
||||
The work-a-round is to compile calc without the optimizer. If this
|
||||
happens to you, try compiling without -O and without -O2. I.e., in
|
||||
the Makefile, set:
|
||||
|
||||
DEBUG= -g
|
||||
|
||||
or set:
|
||||
|
||||
DEBUG=
|
||||
|
62
CHANGES
62
CHANGES
@@ -108,8 +108,7 @@ Following is the change from calc version 2.11.0t8.9.1 to date:
|
||||
in addition to pre-installing GNU-readline in your system to use
|
||||
this facility.
|
||||
|
||||
Changed the "object already defined" math_error message to a
|
||||
scanerror message.
|
||||
Changed the "object already defined" math_error to a scanerror message.
|
||||
|
||||
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
|
||||
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:
|
||||
|
||||
|
89
Makefile
89
Makefile
@@ -273,6 +273,18 @@ HAVE_URANDOM=
|
||||
HAVE_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
|
||||
# that are not alligned on a 32 bit boundary.
|
||||
#
|
||||
@@ -762,7 +774,7 @@ CC= ${PURIFY} ${LCC}
|
||||
#
|
||||
###
|
||||
#
|
||||
# RS6000 set
|
||||
# AIX RS/6000 set
|
||||
#
|
||||
#CCWARN=
|
||||
#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_unistd.h longbits.h longlong.h terminal.h calc_errno.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
|
||||
#
|
||||
@@ -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 \
|
||||
longlong.c have_offscl.c have_posscl.c have_memmv.c calc_errno.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
|
||||
# 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_stdvs.o have_varvs.o have_posscl.o have_memmv.o calc_errno.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
|
||||
#
|
||||
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 \
|
||||
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
|
||||
#
|
||||
UTIL_PROGS= align32 fposval have_uid_t longlong have_const \
|
||||
endian longbits have_newstr have_stdvs have_varvs calc_errno \
|
||||
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.
|
||||
#
|
||||
@@ -1128,13 +1141,14 @@ calc.1: calc.man ${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}
|
||||
${CC} ${CFLAGS} ${ALLOW_CUSTOM} -c custom.c
|
||||
|
||||
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}
|
||||
${CC} ${CFLAGS} ${ALLOW_CUSTOM} -c func.c
|
||||
@@ -1535,6 +1549,8 @@ longlong.h: longlong.c have_stdlib.h have_string.h ${MAKE_FILE}
|
||||
else \
|
||||
echo '#undef HAVE_LONGLONG' >> longlong.h; \
|
||||
echo '#define LONGLONG_BITS 0 /* no */' >> longlong.h; \
|
||||
echo '#undef LL_FORMAT' >> longlong.h; \
|
||||
echo '#undef L_FORMAT' >> longlong.h; \
|
||||
fi
|
||||
${Q}echo '' >> longlong.h
|
||||
${Q}echo '' >> longlong.h
|
||||
@@ -2174,6 +2190,45 @@ have_rusage.h: have_rusage.c ${MAKE_FILE}
|
||||
true; \
|
||||
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
|
||||
-${Q}rm -f args.h have_args
|
||||
${Q}echo 'forming args.h'
|
||||
@@ -3048,6 +3103,7 @@ addop.o: config.h
|
||||
addop.o: endian_calc.h
|
||||
addop.o: func.h
|
||||
addop.o: hash.h
|
||||
addop.o: have_const.h
|
||||
addop.o: have_malloc.h
|
||||
addop.o: have_memmv.h
|
||||
addop.o: have_newstr.h
|
||||
@@ -3104,6 +3160,7 @@ blkcpy.o: config.h
|
||||
blkcpy.o: endian_calc.h
|
||||
blkcpy.o: file.h
|
||||
blkcpy.o: hash.h
|
||||
blkcpy.o: have_const.h
|
||||
blkcpy.o: have_fpos.h
|
||||
blkcpy.o: have_malloc.h
|
||||
blkcpy.o: have_memmv.h
|
||||
@@ -3208,6 +3265,7 @@ codegen.o: config.h
|
||||
codegen.o: endian_calc.h
|
||||
codegen.o: func.h
|
||||
codegen.o: hash.h
|
||||
codegen.o: have_const.h
|
||||
codegen.o: have_malloc.h
|
||||
codegen.o: have_memmv.h
|
||||
codegen.o: have_newstr.h
|
||||
@@ -3292,6 +3350,7 @@ const.o: config.h
|
||||
const.o: const.c
|
||||
const.o: endian_calc.h
|
||||
const.o: hash.h
|
||||
const.o: have_const.h
|
||||
const.o: have_malloc.h
|
||||
const.o: have_memmv.h
|
||||
const.o: have_newstr.h
|
||||
@@ -3346,6 +3405,7 @@ file.o: file.c
|
||||
file.o: file.h
|
||||
file.o: fposval.h
|
||||
file.o: hash.h
|
||||
file.o: have_const.h
|
||||
file.o: have_fpos.h
|
||||
file.o: have_malloc.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_string.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_unistd.h
|
||||
have_ustat.o: have_ustat.c
|
||||
@@ -3463,6 +3524,7 @@ help.o: conf.h
|
||||
help.o: config.h
|
||||
help.o: endian_calc.h
|
||||
help.o: hash.h
|
||||
help.o: have_const.h
|
||||
help.o: have_malloc.h
|
||||
help.o: have_memmv.h
|
||||
help.o: have_newstr.h
|
||||
@@ -3488,10 +3550,12 @@ hist.o: cmath.h
|
||||
hist.o: config.h
|
||||
hist.o: endian_calc.h
|
||||
hist.o: hash.h
|
||||
hist.o: have_const.h
|
||||
hist.o: have_malloc.h
|
||||
hist.o: have_memmv.h
|
||||
hist.o: have_newstr.h
|
||||
hist.o: have_stdlib.h
|
||||
hist.o: have_strdup.h
|
||||
hist.o: have_string.h
|
||||
hist.o: have_unistd.h
|
||||
hist.o: hist.c
|
||||
@@ -3516,6 +3580,7 @@ input.o: conf.h
|
||||
input.o: config.h
|
||||
input.o: endian_calc.h
|
||||
input.o: hash.h
|
||||
input.o: have_const.h
|
||||
input.o: have_malloc.h
|
||||
input.o: have_memmv.h
|
||||
input.o: have_newstr.h
|
||||
@@ -3546,6 +3611,7 @@ label.o: config.h
|
||||
label.o: endian_calc.h
|
||||
label.o: func.h
|
||||
label.o: hash.h
|
||||
label.o: have_const.h
|
||||
label.o: have_malloc.h
|
||||
label.o: have_memmv.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_newstr.h
|
||||
lib_calc.o: have_stdlib.h
|
||||
lib_calc.o: have_strdup.h
|
||||
lib_calc.o: have_string.h
|
||||
lib_calc.o: have_unistd.h
|
||||
lib_calc.o: label.h
|
||||
@@ -3675,6 +3742,7 @@ math_error.o: cmath.h
|
||||
math_error.o: config.h
|
||||
math_error.o: endian_calc.h
|
||||
math_error.o: hash.h
|
||||
math_error.o: have_const.h
|
||||
math_error.o: have_malloc.h
|
||||
math_error.o: have_memmv.h
|
||||
math_error.o: have_newstr.h
|
||||
@@ -3725,6 +3793,7 @@ obj.o: config.h
|
||||
obj.o: endian_calc.h
|
||||
obj.o: func.h
|
||||
obj.o: hash.h
|
||||
obj.o: have_const.h
|
||||
obj.o: have_malloc.h
|
||||
obj.o: have_memmv.h
|
||||
obj.o: have_newstr.h
|
||||
@@ -4030,6 +4099,7 @@ string.o: cmath.h
|
||||
string.o: config.h
|
||||
string.o: endian_calc.h
|
||||
string.o: hash.h
|
||||
string.o: have_const.h
|
||||
string.o: have_malloc.h
|
||||
string.o: have_memmv.h
|
||||
string.o: have_newstr.h
|
||||
@@ -4055,6 +4125,7 @@ symbol.o: config.h
|
||||
symbol.o: endian_calc.h
|
||||
symbol.o: func.h
|
||||
symbol.o: hash.h
|
||||
symbol.o: have_const.h
|
||||
symbol.o: have_malloc.h
|
||||
symbol.o: have_memmv.h
|
||||
symbol.o: have_newstr.h
|
||||
@@ -4084,6 +4155,7 @@ token.o: cmath.h
|
||||
token.o: config.h
|
||||
token.o: endian_calc.h
|
||||
token.o: hash.h
|
||||
token.o: have_const.h
|
||||
token.o: have_malloc.h
|
||||
token.o: have_memmv.h
|
||||
token.o: have_newstr.h
|
||||
@@ -4143,6 +4215,7 @@ version.o: cmath.h
|
||||
version.o: config.h
|
||||
version.o: endian_calc.h
|
||||
version.o: hash.h
|
||||
version.o: have_const.h
|
||||
version.o: have_malloc.h
|
||||
version.o: have_memmv.h
|
||||
version.o: have_newstr.h
|
||||
|
9
calc.c
9
calc.c
@@ -39,9 +39,6 @@
|
||||
/*
|
||||
* 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 */
|
||||
|
||||
|
||||
@@ -153,7 +150,11 @@ main(int argc, char **argv)
|
||||
* we are too early in processing to call
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
3
calc.h
3
calc.h
@@ -14,6 +14,8 @@
|
||||
|
||||
#include "value.h"
|
||||
|
||||
#include "have_const.h"
|
||||
|
||||
|
||||
/*
|
||||
* Configuration definitions
|
||||
@@ -140,6 +142,7 @@ extern void givehelp(char *type);
|
||||
extern void libcalc_call_me_first(void);
|
||||
extern void libcalc_call_me_last(void);
|
||||
extern void showerrors(void);
|
||||
extern char *calc_strdup(CONST char *);
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
|
41
codegen.c
41
codegen.c
@@ -521,11 +521,9 @@ getonevariable(int symtype)
|
||||
* | BREAK ';'
|
||||
* | RETURN assignment ';'
|
||||
* | GOTO label ';'
|
||||
* | MAT name '[' value [ ':' value ] [',' value [ ':' value ] ] ']' ';'
|
||||
* | OBJ type '{' arg [ ',' arg ] ... '}' ] ';'
|
||||
* | OBJ type name [ ',' name ] ';'
|
||||
* | PRINT assignment [, assignment ] ... ';'
|
||||
* | QUIT [ string ] ';'
|
||||
* | ABORT [ string ] ';'
|
||||
* | SHOW item ';'
|
||||
* | body
|
||||
* | assignment ';'
|
||||
@@ -707,14 +705,14 @@ getstatement(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *d
|
||||
}
|
||||
}
|
||||
if (gettoken() != T_RIGHTPAREN) { /* have 'c' part */
|
||||
if (label1.l_offset <= 0)
|
||||
if (label1.l_offset < 0)
|
||||
addoplabel(OP_JUMP, &label3);
|
||||
setlabel(&label2);
|
||||
contlabel = &label2;
|
||||
rescantoken();
|
||||
(void) getexprlist();
|
||||
addop(OP_POP);
|
||||
if (label1.l_offset > 0)
|
||||
if (label1.l_offset >= 0)
|
||||
addoplabel(OP_JUMP, &label1);
|
||||
if (gettoken() != T_RIGHTPAREN) {
|
||||
(void) tokenmode(oldmode);
|
||||
@@ -734,15 +732,21 @@ getstatement(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *d
|
||||
case T_WHILE:
|
||||
oldmode = tokenmode(TM_DEFAULT);
|
||||
contlabel = &label1;
|
||||
breaklabel = &label2;
|
||||
clearlabel(contlabel);
|
||||
clearlabel(breaklabel);
|
||||
setlabel(contlabel);
|
||||
getcondition();
|
||||
if (gettoken() != T_SEMICOLON) {
|
||||
breaklabel = &label2;
|
||||
clearlabel(breaklabel);
|
||||
addoplabel(OP_JUMPZ, breaklabel);
|
||||
getstatement(contlabel, breaklabel, NULL_LABEL, NULL_LABEL);
|
||||
rescantoken();
|
||||
getstatement(contlabel, breaklabel,
|
||||
NULL_LABEL, NULL_LABEL);
|
||||
addoplabel(OP_JUMP, contlabel);
|
||||
setlabel(breaklabel);
|
||||
} else {
|
||||
addoplabel(OP_JUMPNZ, contlabel);
|
||||
}
|
||||
(void) tokenmode(oldmode);
|
||||
return;
|
||||
|
||||
@@ -1053,18 +1057,14 @@ getoneobj(long index, int symtype)
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine to collect a set of variables for the specified object type
|
||||
* and initialize them as being that type of object.
|
||||
* Here
|
||||
* objlist = name initlist [ ',' name initlist ] ... ';'.
|
||||
* 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.
|
||||
* Routine to assign a specified object-type value to each of a set of
|
||||
* variables in a "global", "local" or "static" declaration, or, if
|
||||
* symtype is SYM_UNDEFINED, to create one object value of the specified
|
||||
* type.
|
||||
*
|
||||
* given:
|
||||
* name object name
|
||||
* symtype type of symbol to collect for
|
||||
* symtype declaration type
|
||||
*/
|
||||
static void
|
||||
getobjvars(char *name, int symtype)
|
||||
@@ -1078,6 +1078,8 @@ getobjvars(char *name, int symtype)
|
||||
}
|
||||
for (;;) {
|
||||
getoneobj(index, symtype);
|
||||
if (symtype == SYM_UNDEFINED)
|
||||
return;
|
||||
if (gettoken() != T_COMMA) {
|
||||
rescantoken();
|
||||
return;
|
||||
@@ -1921,11 +1923,6 @@ getterm(void)
|
||||
|
||||
case T_MAT:
|
||||
getonematrix(SYM_UNDEFINED);
|
||||
while (gettoken() == T_COMMA) {
|
||||
addop(OP_POP);
|
||||
getonematrix(SYM_UNDEFINED);
|
||||
}
|
||||
rescantoken();
|
||||
type = EXPR_ASSIGN;
|
||||
break;
|
||||
|
||||
|
@@ -310,6 +310,15 @@ libcustcalc.a: ${CUSTCALC_OBJ} ${MAKE_FILE} ../Makefile
|
||||
ar qc libcustcalc.a ${CUSTCALC_OBJ}
|
||||
${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
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include "../config.h"
|
||||
#include "../calc.h"
|
||||
#include "../longbits.h"
|
||||
#define CHECK_L_FORMAT
|
||||
#include "../longlong.h"
|
||||
#include "../block.h"
|
||||
#include "../calcerr.h"
|
||||
@@ -306,17 +307,33 @@ static void
|
||||
dump_name_value(void)
|
||||
{
|
||||
struct infoname *p; /* current infoname */
|
||||
char *fmt; /* printf value format */
|
||||
|
||||
/* dump the entire table */
|
||||
for (p = sys_info; p->name != NULL; ++p) {
|
||||
if (p->str == NULL) {
|
||||
#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,
|
||||
(unsigned long)p->nmbr,
|
||||
(unsigned long)p->nmbr);
|
||||
#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,
|
||||
(unsigned long long)p->nmbr,
|
||||
(unsigned long long)p->nmbr);
|
||||
@@ -337,17 +354,33 @@ static void
|
||||
dump_mening_value(void)
|
||||
{
|
||||
struct infoname *p; /* current infoname */
|
||||
char *fmt; /* printf value format */
|
||||
|
||||
/* dump the entire table */
|
||||
for (p = sys_info; p->name != NULL; ++p) {
|
||||
if (p->str == NULL) {
|
||||
#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,
|
||||
(unsigned long)p->nmbr,
|
||||
(unsigned long)p->nmbr);
|
||||
#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,
|
||||
(unsigned long long)p->nmbr,
|
||||
(unsigned long long)p->nmbr);
|
||||
|
2
func.c
2
func.c
@@ -7339,7 +7339,7 @@ static CONST struct builtin builtins[] = {
|
||||
* See the builtin rule in the help/Makefile for details.
|
||||
*/
|
||||
#if defined(FUNCLIST)
|
||||
/*ARGSUSED */
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
62
have_strdup.c
Normal file
62
have_strdup.c
Normal 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;
|
||||
}
|
@@ -3,6 +3,5 @@ s/NUMBER[ ]*\*/int /
|
||||
s/NUMBER/int/
|
||||
s/STRINGHEAD/int/
|
||||
s/\(".*",.*,.*\),.*,.*,.*,.*,/\1, 0, 0, 0, 0,/
|
||||
s/showbuiltins/main/
|
||||
s/[ ][ ]*$//
|
||||
p
|
||||
|
@@ -50,6 +50,8 @@ Very High priority items:
|
||||
* Fix any 'Known bugs' as noted in the BUGS file or as
|
||||
displayed by 'calc help bugs'.
|
||||
|
||||
* Copyleft calc and place it under a LGPL.
|
||||
|
||||
=-=
|
||||
|
||||
High priority items:
|
||||
@@ -79,10 +81,9 @@ High priority items:
|
||||
then a $PAGER should be forked and execed after doing things such
|
||||
as closing open file descriptors that the $PAGER does not need.
|
||||
|
||||
* Inspect changes made since the last major calc release (the
|
||||
initial x.y.z version ... prior to any t sub-version) to help
|
||||
ensure that they have not introduced new or re-introduced old bugs
|
||||
into calc.
|
||||
* The arg passdown to the lower level Makfiles should be reviewed
|
||||
to determine which items really need to be passed down. The lower
|
||||
level Makefiles should default to the shipped values.
|
||||
|
||||
* Consider using configure to build the calc Makefile.
|
||||
|
||||
|
5
hist.c
5
hist.c
@@ -31,6 +31,11 @@
|
||||
#include "terminal.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)
|
||||
# include <termios.h>
|
||||
|
@@ -1694,6 +1694,7 @@ define test_obj()
|
||||
{
|
||||
static obj surd a;
|
||||
static obj surd b;
|
||||
local PP;
|
||||
|
||||
print '1800: Beginning object test';
|
||||
|
||||
@@ -1731,7 +1732,10 @@ define test_obj()
|
||||
vrfy(a <= a, '1828: a < a');
|
||||
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()';
|
||||
|
||||
@@ -4687,8 +4691,8 @@ define test_commaeq()
|
||||
/*
|
||||
* matrix assignment
|
||||
*/
|
||||
mat A[3] = {1,2,3}, B[2] = {1,2};
|
||||
print '5625: 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}, mat B[2] = {1,2}';
|
||||
vrfy(A[0] == 1, '5626: A[0] == 1');
|
||||
vrfy(B[1] == 2, '5627: B[1] == 2');
|
||||
|
||||
@@ -4916,8 +4920,8 @@ define test_assign(base, work)
|
||||
print base+3: ': X5800 = base+3';
|
||||
Y5800 = base+4;
|
||||
print base+4: ': Y5800 = base+4';
|
||||
obj xy5800 A={1,2}, B={3,4};
|
||||
print base+5: ': 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}, obj xy5000 B={3,4}';
|
||||
|
||||
/*
|
||||
* test assignment
|
||||
@@ -7381,7 +7385,10 @@ X5800 = obj xy5800 = {1,2};
|
||||
print '5864: X5800 = obj xy5800 = {1,2}';
|
||||
vrfy(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;
|
||||
return test_is();
|
||||
|
47
lib_calc.c
47
lib_calc.c
@@ -34,6 +34,11 @@
|
||||
#include "symbol.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"
|
||||
#if defined(HAVE_UNISTD_H)
|
||||
#include <unistd.h>
|
||||
@@ -431,3 +436,45 @@ run_state_name(run state)
|
||||
}
|
||||
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 */
|
||||
}
|
||||
|
14
longlong.c
14
longlong.c
@@ -62,8 +62,8 @@
|
||||
/*
|
||||
* have the compiler try its hand with unsigned and signed long longs
|
||||
*/
|
||||
unsigned long long val = 4294967297ULL;
|
||||
long long val2 = -4294967297LL;
|
||||
unsigned long long val = 0x1234567890123456ULL;
|
||||
long long val2 = -1311768467284833366LL; /* -0x1234567890123456 */
|
||||
|
||||
|
||||
int
|
||||
@@ -90,14 +90,20 @@ main(int argc, char **argv)
|
||||
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 */
|
||||
printf("#define HAVE_LONGLONG\n");
|
||||
printf("#define LONGLONG_BITS %d /* yes */\n",
|
||||
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); */
|
||||
|
10
obj.c
10
obj.c
@@ -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.
|
||||
* This converts the element index from the element table into an offset
|
||||
|
@@ -3773,11 +3773,14 @@ dumpop(unsigned long *pc)
|
||||
return 3;
|
||||
case OP_PRINT: case OP_JUMPZ: case OP_JUMPNZ: case OP_JUMP:
|
||||
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_ELEMVALUE: case OP_JUMPNN:
|
||||
printf(" %ld\n", *pc);
|
||||
return 2;
|
||||
case OP_OBJCREATE:
|
||||
printf(" %s\n", objtypename(*pc));
|
||||
return 2;
|
||||
case OP_NUMBER: case OP_IMAGINARY:
|
||||
qprintf(" %r", constvalue(*pc));
|
||||
printf("\n");
|
||||
|
3
seed.c
3
seed.c
@@ -53,9 +53,10 @@
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/resource.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/resource.h>
|
||||
#include <setjmp.h>
|
||||
#include "qmath.h"
|
||||
#include "longbits.h"
|
||||
|
5
symbol.c
5
symbol.c
@@ -175,7 +175,10 @@ showglobals(void)
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
printf(count ? "\n" : "No real-valued global variables\n");
|
||||
if (count == 0) {
|
||||
printf("No real-valued global variables\n");
|
||||
}
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
|
||||
|
1
value.h
1
value.h
@@ -451,6 +451,7 @@ extern int checkobject(char *name);
|
||||
extern void showobjfuncs(void);
|
||||
extern void showobjtypes(void);
|
||||
extern int findelement(char *name);
|
||||
extern char *objtypename(unsigned long index);
|
||||
extern int objoffset(OBJECT *op, long index);
|
||||
|
||||
|
||||
|
@@ -18,7 +18,7 @@ static char *program;
|
||||
#define MAJOR_VER 2 /* major version */
|
||||
#define MINOR_VER 11 /* minor version */
|
||||
#define MAJOR_PATCH 0 /* patch level or 0 if no patch */
|
||||
#define MINOR_PATCH "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
|
||||
|
Reference in New Issue
Block a user