mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
Compare commits
3 Commits
2.11.0t6
...
2.11.0t6.3
Author | SHA1 | Date | |
---|---|---|---|
|
0d37ccb019 | ||
|
d7d31e9246 | ||
|
2dc364ee9f |
17
CHANGES
17
CHANGES
@@ -35,8 +35,9 @@ Following is the change from calc version 2.11.0t1 to date:
|
|||||||
|
|
||||||
Reordered cc Makefile variable sets in the main Makefile.
|
Reordered cc Makefile variable sets in the main Makefile.
|
||||||
|
|
||||||
Fixed a bug and applied a fix that was reported by Ernest Bowen
|
Fixed a bug in hnrmod() and applied a fix that was reported by Ernest
|
||||||
<ernie@turing.une.edu.au>. Added regression tests 1103 to 1112.
|
Bowen <ernie@turing.une.edu.au>. Added regression tests 1103 to
|
||||||
|
1112 to confirm the fix.
|
||||||
|
|
||||||
Fixed a bug in version.c related to MINOR_PATCHs in both the
|
Fixed a bug in version.c related to MINOR_PATCHs in both the
|
||||||
empty and non-empty MINOR_PATCH cases.
|
empty and non-empty MINOR_PATCH cases.
|
||||||
@@ -174,6 +175,18 @@ Following is the change from calc version 2.11.0t1 to date:
|
|||||||
to correctly hash a V_STR value-type that has an \0 byte
|
to correctly hash a V_STR value-type that has an \0 byte
|
||||||
inside it.
|
inside it.
|
||||||
|
|
||||||
|
A patch from Ernest Bowen <ernie@turing.une.edu.au> now defines
|
||||||
|
special meaning to the first 2 bits of config("lib_debug"):
|
||||||
|
|
||||||
|
bit 0 set => messages printed when inputisterminal
|
||||||
|
bit 1 set => messages printed when reading from a file
|
||||||
|
|
||||||
|
The lib/regress.cal regression suite does:
|
||||||
|
|
||||||
|
config("lib_debug", -4);
|
||||||
|
|
||||||
|
to eliminate lib messages (both bit 0 and bit 1 are not set).
|
||||||
|
|
||||||
Fixed misc compile warnings and notices.
|
Fixed misc compile warnings and notices.
|
||||||
|
|
||||||
|
|
||||||
|
@@ -50,3 +50,6 @@ Installing calc in 4 easy steps:
|
|||||||
4) install calc:
|
4) install calc:
|
||||||
|
|
||||||
make install
|
make install
|
||||||
|
|
||||||
|
We suggest that you might want to read the README file and look at
|
||||||
|
the calc help subsystem. See the README file for details.
|
||||||
|
33
README
33
README
@@ -24,6 +24,39 @@ If you run into problems, see the BUGS file.
|
|||||||
|
|
||||||
=-=
|
=-=
|
||||||
|
|
||||||
|
Calc is distributed with an extensive collection of help files that
|
||||||
|
are accessible from the command line. The following assume that you
|
||||||
|
are running calc from the distribution directory or that you have
|
||||||
|
installed calc. In these examples, the ">" is the calc prompt, not
|
||||||
|
something that you type in.
|
||||||
|
|
||||||
|
For list of help topics:
|
||||||
|
|
||||||
|
> help
|
||||||
|
|
||||||
|
For overview of calc overview:
|
||||||
|
|
||||||
|
> help intro
|
||||||
|
> help overview
|
||||||
|
> help command
|
||||||
|
> help define
|
||||||
|
> help statement
|
||||||
|
> help variable
|
||||||
|
|
||||||
|
For list of builtin functions:
|
||||||
|
|
||||||
|
> help builtin
|
||||||
|
|
||||||
|
C programmers should note some unexpected differences in the calc syntax:
|
||||||
|
|
||||||
|
> help unexpected
|
||||||
|
|
||||||
|
Calc is shipped with a library of calc scripts. For a list see:
|
||||||
|
|
||||||
|
> help stdlib
|
||||||
|
|
||||||
|
=-=
|
||||||
|
|
||||||
See the file:
|
See the file:
|
||||||
|
|
||||||
help/todo
|
help/todo
|
||||||
|
6
addop.c
6
addop.c
@@ -164,7 +164,8 @@ endfunc(void)
|
|||||||
size += dumpop(&fp->f_opcodes[size]);
|
size += dumpop(&fp->f_opcodes[size]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inputisterminal() || conf->lib_debug >= 0) {
|
if ((inputisterminal() && conf->lib_debug & 1) ||
|
||||||
|
(!inputisterminal() && conf->lib_debug & 2)) {
|
||||||
printf("%s(", fp->f_name);
|
printf("%s(", fp->f_name);
|
||||||
for (index = 0; index < fp->f_paramcount; index++) {
|
for (index = 0; index < fp->f_paramcount; index++) {
|
||||||
if (index)
|
if (index)
|
||||||
@@ -237,7 +238,8 @@ rmuserfunc(char *name)
|
|||||||
return;
|
return;
|
||||||
freenumbers(functions[index]);
|
freenumbers(functions[index]);
|
||||||
free(functions[index]);
|
free(functions[index]);
|
||||||
if (inputisterminal() && conf->lib_debug >= 0)
|
if ((inputisterminal() && conf->lib_debug & 1) ||
|
||||||
|
(!inputisterminal() && conf->lib_debug & 2))
|
||||||
printf("%s() undefined\n", name);
|
printf("%s() undefined\n", name);
|
||||||
functions[index] = NULL;
|
functions[index] = NULL;
|
||||||
}
|
}
|
||||||
|
4
config.c
4
config.c
@@ -93,7 +93,7 @@ CONFIG oldstd = { /* backward compatible standard configuration */
|
|||||||
FALSE, /* skip duplicate block output lines */
|
FALSE, /* skip duplicate block output lines */
|
||||||
BLK_BASE_HEX, /* block octet print base */
|
BLK_BASE_HEX, /* block octet print base */
|
||||||
BLK_FMT_HD_STYLE, /* block output format */
|
BLK_FMT_HD_STYLE, /* block output format */
|
||||||
0, /* calc library debug level */
|
3, /* calc library debug level */
|
||||||
0, /* internal calc debug level */
|
0, /* internal calc debug level */
|
||||||
0 /* user defined debug level */
|
0 /* user defined debug level */
|
||||||
};
|
};
|
||||||
@@ -128,7 +128,7 @@ CONFIG newstd = { /* new non-backward compatible configuration */
|
|||||||
FALSE, /* skip duplicate block output lines */
|
FALSE, /* skip duplicate block output lines */
|
||||||
BLK_BASE_HEX, /* block octet print base */
|
BLK_BASE_HEX, /* block octet print base */
|
||||||
BLK_FMT_HD_STYLE, /* block output format */
|
BLK_FMT_HD_STYLE, /* block output format */
|
||||||
0, /* calc library debug level */
|
3, /* calc library debug level */
|
||||||
0, /* internal calc debug level */
|
0, /* internal calc debug level */
|
||||||
0 /* user defined debug level */
|
0 /* user defined debug level */
|
||||||
};
|
};
|
||||||
|
@@ -58,7 +58,7 @@ c_pzasusb8(char *name, int count, VALUE **vals)
|
|||||||
*/
|
*/
|
||||||
h = (USB8 *) z.v;
|
h = (USB8 *) z.v;
|
||||||
for (i=0; i < half_cnt; ++i) {
|
for (i=0; i < half_cnt; ++i) {
|
||||||
printf("%d:\t", i);
|
printf("%ld:\t", i);
|
||||||
for (j=0; j < half_len; ++j) {
|
for (j=0; j < half_len; ++j) {
|
||||||
printf("%02x", (int)(*h++));
|
printf("%02x", (int)(*h++));
|
||||||
}
|
}
|
||||||
|
2
endian.c
2
endian.c
@@ -76,5 +76,5 @@ main(void)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
/* exit(0); */
|
/* exit(0); */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
2
hash.c
2
hash.c
@@ -604,7 +604,7 @@ hash_str(int type, char *str, HASH *state)
|
|||||||
*/
|
*/
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* hash_STR - hash a STRING
|
* hash_STR - hash a STRING
|
||||||
|
@@ -8,7 +8,7 @@ Environment variables
|
|||||||
If this variable does not exist, a compiled value
|
If this variable does not exist, a compiled value
|
||||||
is used. Typically compiled in value is:
|
is used. Typically compiled in value is:
|
||||||
|
|
||||||
.:./lib:~/lib:${LIBDIR}/calc
|
.:./lib:~/lib:${LIBDIR}/calc:${LIBDIR}/custom
|
||||||
|
|
||||||
where ${LIBDIR} is usually:
|
where ${LIBDIR} is usually:
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
for and overview of the help system. The command:
|
for and overview of the help system. The command:
|
||||||
|
|
||||||
help builtins
|
help builtin
|
||||||
|
|
||||||
provides information on built-in mathematical functions, whereas:
|
provides information on built-in mathematical functions, whereas:
|
||||||
|
|
||||||
@@ -67,6 +67,10 @@
|
|||||||
It contains information about differences between C and calc
|
It contains information about differences between C and calc
|
||||||
that may surprize you.
|
that may surprize you.
|
||||||
|
|
||||||
|
To learn about calc library files that are shipped with calc, try:
|
||||||
|
|
||||||
|
help stdlib
|
||||||
|
|
||||||
A full and extensive overview of calc may be obtained by:
|
A full and extensive overview of calc may be obtained by:
|
||||||
|
|
||||||
help full
|
help full
|
||||||
|
51
lib/README
51
lib/README
@@ -1,10 +1,35 @@
|
|||||||
# Copyright (c) 1999 David I. Bell and Landon Curt Noll
|
To load a library, try:
|
||||||
# Permission is granted to use, distribute, or modify this source,
|
|
||||||
# provided that this copyright notice remains intact.
|
|
||||||
|
|
||||||
The following calc library files are provided because they serve as
|
read filename
|
||||||
examples of how use the calc language, and/or because the authors thought
|
|
||||||
them to be useful!
|
You to not need to add the .cal extension to the filename. Calc
|
||||||
|
will search along the $CALCPATH (see ``help environment'').
|
||||||
|
|
||||||
|
Normally a library will simply define some functions. By default,
|
||||||
|
most libraries will print out a short message when thei are read.
|
||||||
|
For example:
|
||||||
|
|
||||||
|
> read lucas
|
||||||
|
lucas(h,n) defined
|
||||||
|
gen_u0(h,n,v1) defined
|
||||||
|
gen_v1(h,n) defined
|
||||||
|
ldebug(funct,str) defined
|
||||||
|
|
||||||
|
will cause calc to load and execute the 'lucas.cal' library.
|
||||||
|
Executing the library will cause several functions to be defined.
|
||||||
|
Executing the lucas function
|
||||||
|
|
||||||
|
> lucas(149,60)
|
||||||
|
1
|
||||||
|
> lucas(146,61)
|
||||||
|
0
|
||||||
|
|
||||||
|
shows that 149*2^60-1 is prime whereas 146*2^61-1 is not.
|
||||||
|
|
||||||
|
=-=
|
||||||
|
|
||||||
|
Calc library files are provided because they serve as examples of how use
|
||||||
|
the calc language, and/or because the authors thought them to be useful!
|
||||||
|
|
||||||
If you write something that you think is useful, please send it to:
|
If you write something that you think is useful, please send it to:
|
||||||
|
|
||||||
@@ -12,7 +37,7 @@ If you write something that you think is useful, please send it to:
|
|||||||
|
|
||||||
By convention, a lib file only defines and/or initializes functions,
|
By convention, a lib file only defines and/or initializes functions,
|
||||||
objects and variables. (The regress.cal and testxxx.cal regression test
|
objects and variables. (The regress.cal and testxxx.cal regression test
|
||||||
suite is an exception.) Also by convention, an additional usage message
|
suite is an exception.) Also by convention, an additional usage message
|
||||||
regarding important object and functions is printed.
|
regarding important object and functions is printed.
|
||||||
|
|
||||||
If a lib file needs to load another lib file, it should use the -once
|
If a lib file needs to load another lib file, it should use the -once
|
||||||
@@ -63,6 +88,10 @@ something like:
|
|||||||
|
|
||||||
=-=
|
=-=
|
||||||
|
|
||||||
|
The following is a brief description of some of the calc library files
|
||||||
|
that are shipped with calc. See above for example of how to read in
|
||||||
|
and execute these files.
|
||||||
|
|
||||||
beer.cal
|
beer.cal
|
||||||
|
|
||||||
Calc's contribution to the 99 Bottles of Beer web page:
|
Calc's contribution to the 99 Bottles of Beer web page:
|
||||||
@@ -537,7 +566,7 @@ test3500.cal
|
|||||||
testh(str, n, N, verbose)
|
testh(str, n, N, verbose)
|
||||||
test3500(verbose, n, N)
|
test3500(verbose, n, N)
|
||||||
|
|
||||||
This script is used by regress.cal to test the functions frem,
|
This script is used by regress.cal to test the functions frem,
|
||||||
fcnt, gcdrem.
|
fcnt, gcdrem.
|
||||||
|
|
||||||
test4000.cal
|
test4000.cal
|
||||||
@@ -648,3 +677,9 @@ xx_print.cal
|
|||||||
error_print(a) defined
|
error_print(a) defined
|
||||||
|
|
||||||
Demo for the xx_print object routines.
|
Demo for the xx_print object routines.
|
||||||
|
|
||||||
|
=-=
|
||||||
|
|
||||||
|
# Copyright (c) 1999 David I. Bell and Landon Curt Noll
|
||||||
|
# Permission is granted to use, distribute, or modify this source,
|
||||||
|
# provided that this copyright notice remains intact.
|
||||||
|
@@ -28,7 +28,7 @@ global ecnt; /* expected value of errcount() */
|
|||||||
ecnt = 0; /* clear expected errcount() value */
|
ecnt = 0; /* clear expected errcount() value */
|
||||||
|
|
||||||
initcfg = config("all", "oldstd"); /* set config to startup default */
|
initcfg = config("all", "oldstd"); /* set config to startup default */
|
||||||
initcfg = config("lib_debug", -1); /* disable lib startup messages */
|
initcfg = config("lib_debug", -4); /* disable lib startup messages */
|
||||||
initcfg = config("calc_debug", 1); /* enable more internal debugging */
|
initcfg = config("calc_debug", 1); /* enable more internal debugging */
|
||||||
initcfg = config("all"); /* save state for later use */
|
initcfg = config("all"); /* save state for later use */
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
#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 "6" /* test number or empty string if no patch */
|
#define MINOR_PATCH "6.3" /* test number or empty string if no patch */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* calc version constants
|
* calc version constants
|
||||||
|
Reference in New Issue
Block a user