mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Changes as per calc 2.12.7.3
This commit is contained in:
48
BUGS
48
BUGS
@@ -80,6 +80,54 @@ Known bugs:
|
|||||||
The output of the alg_config.cal resource file is bogus.
|
The output of the alg_config.cal resource file is bogus.
|
||||||
We would welcome a replacement for this code.
|
We would welcome a replacement for this code.
|
||||||
|
|
||||||
|
Calc shell scripts do not read from stdin properly,
|
||||||
|
we all as a number of the cscript examples.
|
||||||
|
|
||||||
|
The argv() function is behaving differently
|
||||||
|
when run in calc shell script mode:
|
||||||
|
|
||||||
|
When calc is run as:
|
||||||
|
|
||||||
|
calc -s a bb ccc
|
||||||
|
|
||||||
|
and given this input on the command prompt:
|
||||||
|
|
||||||
|
print "config(\"program\")=", config("program");
|
||||||
|
print "argv()=", argv();
|
||||||
|
argc = argv();
|
||||||
|
for (i=0; i < argc; ++i) {
|
||||||
|
print "argv(":i:")=", argv(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
calc prints:
|
||||||
|
|
||||||
|
config("program")= calc
|
||||||
|
argv()= 3
|
||||||
|
argv(0)= a
|
||||||
|
argv(1)= bb
|
||||||
|
argv(2)= ccc
|
||||||
|
|
||||||
|
but when it is run as a script called ./simple:
|
||||||
|
|
||||||
|
#!/usr/local/bin/calc -q -s -f
|
||||||
|
print "config(\"program\")=", config("program");
|
||||||
|
print "argv()=", argv();
|
||||||
|
argc = argv();
|
||||||
|
for (i=0; i < argc; ++i) {
|
||||||
|
print "argv(":i:")=", argv(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
under Linux prints:
|
||||||
|
|
||||||
|
config("program")= /usr/bin/calc
|
||||||
|
argv()= 4
|
||||||
|
argv(0)= ./simple
|
||||||
|
argv(1)= a
|
||||||
|
argv(2)= bb
|
||||||
|
argv(3)= ccc
|
||||||
|
|
||||||
|
and under macOS simply enters into interactive mode.
|
||||||
|
|
||||||
We are sure some more bugs exist. When you find them, please let
|
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
|
us know! See the above for details on how to report and were to
|
||||||
EMail your bug reports and hopefully patches to fix them.
|
EMail your bug reports and hopefully patches to fix them.
|
||||||
|
21
CHANGES
21
CHANGES
@@ -18,6 +18,27 @@ The following are the changes from calc version 2.12.7.1 to date:
|
|||||||
Fixed a segfault when getpwuid() returned NULL during initialization.
|
Fixed a segfault when getpwuid() returned NULL during initialization.
|
||||||
Thanks goes to baratharon GitHub user for reporting this issue.
|
Thanks goes to baratharon GitHub user for reporting this issue.
|
||||||
|
|
||||||
|
Requiring calc shell scripts to use -s -f at the end of the
|
||||||
|
initial #! line.
|
||||||
|
|
||||||
|
Fixed /tmp/mersenne example in calc(1) man page.
|
||||||
|
|
||||||
|
Added make variable ${ARCH_CFLAGS}. The ${ARCH_CFLAGS} is
|
||||||
|
added after ${CCMISC} and before ${EXTRA_CFLAGS} when building
|
||||||
|
the ${CFLAGS} for compiling C code. are ${CC} when compiling
|
||||||
|
C files. The default value is:
|
||||||
|
|
||||||
|
ARCH_CFLAGS= -march=native
|
||||||
|
|
||||||
|
which directs C compiler to compile for the native machine.
|
||||||
|
To disable use of '-march=native', set ARCH_CFLAGS to the empty
|
||||||
|
string as in:
|
||||||
|
|
||||||
|
make all ARCH_CFLAGS=
|
||||||
|
|
||||||
|
To make calc RPMs more portable, they are compiled with an
|
||||||
|
empty ARCH_CFLAGS.
|
||||||
|
|
||||||
|
|
||||||
The following are the changes from calc version 2.12.6.10: to 2.12.7.0:
|
The following are the changes from calc version 2.12.6.10: to 2.12.7.0:
|
||||||
|
|
||||||
|
@@ -1054,7 +1054,7 @@ EXT=
|
|||||||
|
|
||||||
# The default calc versions
|
# The default calc versions
|
||||||
#
|
#
|
||||||
VERSION= 2.12.7.2
|
VERSION= 2.12.7.3
|
||||||
|
|
||||||
# Names of shared libraries with versions
|
# Names of shared libraries with versions
|
||||||
#
|
#
|
||||||
@@ -1116,16 +1116,26 @@ STRIP= strip
|
|||||||
EXTRA_CFLAGS=
|
EXTRA_CFLAGS=
|
||||||
EXTRA_LDFLAGS=
|
EXTRA_LDFLAGS=
|
||||||
|
|
||||||
|
# Architecture compile flags
|
||||||
|
#
|
||||||
|
# The ARCH_CFLAGS are ${CC} when compiling C files. They follow
|
||||||
|
# CCMISC and preceed EXTRA_CFLAGS.
|
||||||
|
#
|
||||||
|
ARCH_CFLAGS= -march=native
|
||||||
|
#ARCH_CFLAGS=
|
||||||
|
|
||||||
# COMMON_CFLAGS are the common ${CC} flags used for all programs, both
|
# COMMON_CFLAGS are the common ${CC} flags used for all programs, both
|
||||||
# intermediate and final calc and calc related programs
|
# intermediate and final calc and calc related programs
|
||||||
#
|
#
|
||||||
#if 0 /* start of skip for non-Gnu makefiles */
|
#if 0 /* start of skip for non-Gnu makefiles */
|
||||||
ifdef ALLOW_CUSTOM
|
ifdef ALLOW_CUSTOM
|
||||||
#endif /* end of skip for non-Gnu makefiles */
|
#endif /* end of skip for non-Gnu makefiles */
|
||||||
COMMON_CFLAGS= -DCALC_SRC ${ALLOW_CUSTOM} ${CCWARN} ${CCMISC} ${EXTRA_CFLAGS}
|
COMMON_CFLAGS= -DCALC_SRC ${ALLOW_CUSTOM} ${CCWARN} \
|
||||||
|
${CCMISC} ${ARCH_CFLAGS} ${EXTRA_CFLAGS}
|
||||||
#if 0 /* start of skip for non-Gnu makefiles */
|
#if 0 /* start of skip for non-Gnu makefiles */
|
||||||
else
|
else
|
||||||
COMMON_CFLAGS= -DCALC_SRC -UCUSTOM ${CCWARN} ${CCMISC} ${EXTRA_CFLAGS}
|
COMMON_CFLAGS= -DCALC_SRC -UCUSTOM ${CCWARN} \
|
||||||
|
${CCMISC} ${ARCH_CFLAGS} ${EXTRA_CFLAGS}
|
||||||
endif
|
endif
|
||||||
#endif /* end of skip for non-Gnu makefiles */
|
#endif /* end of skip for non-Gnu makefiles */
|
||||||
|
|
||||||
@@ -1900,6 +1910,7 @@ SAMPLE_OBJ= sample_many.o sample_rand.o
|
|||||||
CUSTOM_PASSDOWN= \
|
CUSTOM_PASSDOWN= \
|
||||||
ALLOW_CUSTOM="${ALLOW_CUSTOM}" \
|
ALLOW_CUSTOM="${ALLOW_CUSTOM}" \
|
||||||
AR=${AR} \
|
AR=${AR} \
|
||||||
|
ARCH_CFLAGS=${ARCH_CFLAGS} \
|
||||||
AWK=${AWK} \
|
AWK=${AWK} \
|
||||||
BINDIR="${BINDIR}" \
|
BINDIR="${BINDIR}" \
|
||||||
BLD_TYPE="${BLD_TYPE}" \
|
BLD_TYPE="${BLD_TYPE}" \
|
||||||
@@ -4041,6 +4052,7 @@ env:
|
|||||||
@echo 'ALIGN32=${ALIGN32}'; echo ''
|
@echo 'ALIGN32=${ALIGN32}'; echo ''
|
||||||
@echo 'ALLOW_CUSTOM=${ALLOW_CUSTOM}'; echo ''
|
@echo 'ALLOW_CUSTOM=${ALLOW_CUSTOM}'; echo ''
|
||||||
@echo 'AR=${AR}'; echo ''
|
@echo 'AR=${AR}'; echo ''
|
||||||
|
@echo 'ARCH_CFLAGS=${ARCH_CFLAGS}'; echo ''
|
||||||
@echo 'AWK=${AWK}'; echo ''
|
@echo 'AWK=${AWK}'; echo ''
|
||||||
@echo 'BINDIR=${BINDIR}'; echo ''
|
@echo 'BINDIR=${BINDIR}'; echo ''
|
||||||
@echo 'BLD_TYPE=${BLD_TYPE}'; echo ''
|
@echo 'BLD_TYPE=${BLD_TYPE}'; echo ''
|
||||||
|
2
calc.c
2
calc.c
@@ -449,7 +449,7 @@ main(int argc, char **argv)
|
|||||||
"\t[-O] [-p] [-q] [-s] [-u] [-v] "
|
"\t[-O] [-p] [-q] [-s] [-u] [-v] "
|
||||||
"[--] [calc_cmd ...]\n"
|
"[--] [calc_cmd ...]\n"
|
||||||
"usage: %s ... -f filename\n"
|
"usage: %s ... -f filename\n"
|
||||||
"1st cscript line: #/path/to/calc ... -f\n",
|
"1st cscript line: #/path/to/calc ... -s -f\n",
|
||||||
program, program);
|
program, program);
|
||||||
exit(20);
|
exit(20);
|
||||||
}
|
}
|
||||||
|
64
calc.man
64
calc.man
@@ -50,7 +50,7 @@ calc \- arbitrary precision calculator
|
|||||||
.RB [ [\-\-]\ calc_cmd\ \&.\|.\|. ]
|
.RB [ [\-\-]\ calc_cmd\ \&.\|.\|. ]
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp
|
.sp
|
||||||
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP
|
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-s\fP \fB\-f\fP
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\&
|
\&
|
||||||
.br
|
.br
|
||||||
@@ -219,24 +219,29 @@ The getenv() builtin will still return values, however.
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-f
|
.B \-f
|
||||||
|
This flag is normally only with calc shell scripts.
|
||||||
|
.sp 1
|
||||||
This flag is required when using calc in
|
This flag is required when using calc in
|
||||||
.BR "shell script mode" .
|
.BR "shell script mode" .
|
||||||
It must be at the end of the initial
|
It must be at the end of the initial
|
||||||
.B #!
|
.B #!
|
||||||
line of the script.
|
line of the script
|
||||||
|
and must be immedately preceeded by the
|
||||||
|
.B \-s
|
||||||
|
flag.
|
||||||
.sp 1
|
.sp 1
|
||||||
This flag is normally only at the end of a calc shell script.
|
|
||||||
If the first line of an executable file begins
|
If the first line of an executable file begins
|
||||||
.B #!
|
.B #!
|
||||||
followed by the absolute pathname of the
|
followed by the absolute pathname of the
|
||||||
.B calc
|
.B calc
|
||||||
program and the flag
|
program and if the first line ends with the two flags
|
||||||
|
.B \-s
|
||||||
.B \-f
|
.B \-f
|
||||||
as in:
|
as in:
|
||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP
|
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-s\fP \fB\-f\fP
|
||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
@@ -270,7 +275,7 @@ on the command line:
|
|||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
\fIcalc\fP\ [other_flags\ \&...] \fB\-f\fP filename
|
\fIcalc\fP\ [other_flags\ \&...] \fB\-s\fP \fB\-f\fP filename
|
||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
@@ -283,6 +288,16 @@ Use of
|
|||||||
.B \-f
|
.B \-f
|
||||||
implies
|
implies
|
||||||
.BR \-s .
|
.BR \-s .
|
||||||
|
However in a calc shell script,
|
||||||
|
one must include
|
||||||
|
.B \-f
|
||||||
|
before
|
||||||
|
.B \-s
|
||||||
|
on the initial
|
||||||
|
.B #!
|
||||||
|
line.
|
||||||
|
|
||||||
|
.sp 1
|
||||||
In addition,
|
In addition,
|
||||||
.B \-d
|
.B \-d
|
||||||
and
|
and
|
||||||
@@ -753,25 +768,28 @@ If the first line of an executable file begins
|
|||||||
.B #!
|
.B #!
|
||||||
followed by the absolute pathname of the
|
followed by the absolute pathname of the
|
||||||
.B calc
|
.B calc
|
||||||
program and the flag
|
program and the first line ends with the two flags
|
||||||
|
.B \-s
|
||||||
.B \-f
|
.B \-f
|
||||||
as in:
|
as in:
|
||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP
|
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-s\fP \fB\-f\fP
|
||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
the rest of the file will be processed in
|
the rest of the file will be processed in
|
||||||
.BR "shell script mode" .
|
.BR "shell script mode" .
|
||||||
Note that
|
Note that
|
||||||
|
.B \-s
|
||||||
.B \-f
|
.B \-f
|
||||||
must at the end of the initial ``#!'' line.
|
must at the end of the initial ``#!'' line.
|
||||||
Any other optional
|
Any other optional
|
||||||
.B "other_flags"
|
.B "other_flags"
|
||||||
must come before
|
must come before
|
||||||
the
|
the
|
||||||
|
.B \-s
|
||||||
.BR \-f .
|
.BR \-f .
|
||||||
.sp 1
|
.sp 1
|
||||||
In
|
In
|
||||||
@@ -803,18 +821,26 @@ the file
|
|||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
\fI#!${BINDIR}/calc\fP\ \&\fB\-q\fP \fB\-f\fP
|
\fI#!${BINDIR}/calc\fP\ \&\fB\-q\fP \&\fB\-s\fP \fB\-f\fP
|
||||||
#
|
|
||||||
# mersenne - an example of a calc \fBshell script file\fP
|
/* setup */
|
||||||
|
argc = argv();
|
||||||
|
program = argv(0);
|
||||||
|
stderr = files(2);
|
||||||
|
|
||||||
/* parse args */
|
/* parse args */
|
||||||
if (argv() != 1) {
|
if (argc != 2) {
|
||||||
fprintf(files(2), "usage: %s exp\\n", config("program"));
|
fprintf(stderr, "usage: %s exp\n", program);
|
||||||
|
abort "must give one exponent arg";
|
||||||
|
}
|
||||||
|
exp = eval(argv(1));
|
||||||
|
if (!isint(exp) || exp < 0) {
|
||||||
|
fprintf(stderr, "%s: exp must be non-negative integer\n", program);
|
||||||
abort "must give one exponent arg";
|
abort "must give one exponent arg";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print the mersenne number */
|
/* print the mersenne number */
|
||||||
print "2^": argv(0) : "-1 =", 2^eval(argv(0))-1;
|
print "2^": exp : "-1 =", 2^exp-1;
|
||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
@@ -844,9 +870,9 @@ will print:
|
|||||||
.sp 1
|
.sp 1
|
||||||
Note that because
|
Note that because
|
||||||
.B \-s
|
.B \-s
|
||||||
is assumed in
|
is required in
|
||||||
.B "shell script mode"
|
.B "shell script mode"
|
||||||
and non-dashed args are made available as
|
non-dashed args are made available as
|
||||||
strings via the
|
strings via the
|
||||||
.BR argv ()
|
.BR argv ()
|
||||||
builtin function.
|
builtin function.
|
||||||
@@ -854,16 +880,16 @@ Therefore:
|
|||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
2^eval(argv(0))-1
|
2^eval(argv(1))-1
|
||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
will print the decimal value of 2^n-1
|
will print the decimal value of 2^n-1
|
||||||
but
|
whereas
|
||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
2^argv(0)-1
|
2^argv(1)-1
|
||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
|
28
calc.spec.in
28
calc.spec.in
@@ -32,7 +32,7 @@
|
|||||||
Summary: Arbitrary precision calculator.
|
Summary: Arbitrary precision calculator.
|
||||||
Name: calc
|
Name: calc
|
||||||
Version: <<<PROJECT_VERSION>>>
|
Version: <<<PROJECT_VERSION>>>
|
||||||
Release: 12
|
Release: 13
|
||||||
License: LGPL
|
License: LGPL
|
||||||
Group: Applications/Engineering
|
Group: Applications/Engineering
|
||||||
Source: http://www.isthe.com/chongo/src/calc/%{name}-%{version}.tar.bz2
|
Source: http://www.isthe.com/chongo/src/calc/%{name}-%{version}.tar.bz2
|
||||||
@@ -76,48 +76,48 @@ For the latest calc release, see the project home page:
|
|||||||
|
|
||||||
%build
|
%build
|
||||||
echo '-=- calc.spec beginning make clobber -=-'
|
echo '-=- calc.spec beginning make clobber -=-'
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ clobber
|
MANDIR=%{_mandir}/man1 EXT= V=@ clobber
|
||||||
echo '-=- calc.spec ending make clobber -=-'
|
echo '-=- calc.spec ending make clobber -=-'
|
||||||
echo '-=- calc.spec beginning make calc-static-only -=-'
|
echo '-=- calc.spec beginning make calc-static-only -=-'
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ calc-static-only BLD_TYPE=calc-static-only
|
MANDIR=%{_mandir}/man1 EXT= V=@ calc-static-only BLD_TYPE=calc-static-only
|
||||||
echo '-=- calc.spec ending make calc-static-only -=-'
|
echo '-=- calc.spec ending make calc-static-only -=-'
|
||||||
echo '-=- calc.spec beginning make rpm-hide-static -=-'
|
echo '-=- calc.spec beginning make rpm-hide-static -=-'
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-hide-static
|
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-hide-static
|
||||||
echo '-=- calc.spec ending make rpm-hide-static -=-'
|
echo '-=- calc.spec ending make rpm-hide-static -=-'
|
||||||
echo '-=- calc.spec beginning make clobber (again) -=-'
|
echo '-=- calc.spec beginning make clobber (again) -=-'
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ clobber
|
MANDIR=%{_mandir}/man1 EXT= V=@ clobber
|
||||||
echo '-=- calc.spec ending make clobber (again) -=-'
|
echo '-=- calc.spec ending make clobber (again) -=-'
|
||||||
echo '-=- calc.spec beginning make calc-dynamic-only -=-'
|
echo '-=- calc.spec beginning make calc-dynamic-only -=-'
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ calc-dynamic-only \
|
MANDIR=%{_mandir}/man1 EXT= V=@ calc-dynamic-only \
|
||||||
BLD_TYPE=calc-dynamic-only LD_SHARE=
|
BLD_TYPE=calc-dynamic-only LD_SHARE=
|
||||||
echo '-=- calc.spec ending make calc-dynamic-only -=-'
|
echo '-=- calc.spec ending make calc-dynamic-only -=-'
|
||||||
echo '-=- calc.spec beginning make chk -=-'
|
echo '-=- calc.spec beginning make chk -=-'
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ chk
|
MANDIR=%{_mandir}/man1 EXT= V=@ chk
|
||||||
echo '-=- calc.spec ending make chk -=-'
|
echo '-=- calc.spec ending make chk -=-'
|
||||||
echo '-=- calc.spec beginning make rpm-unhide-static -=-'
|
echo '-=- calc.spec beginning make rpm-unhide-static -=-'
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-unhide-static
|
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-unhide-static
|
||||||
echo '-=- calc.spec ending make rpm-unhide-static -=-'
|
echo '-=- calc.spec ending make rpm-unhide-static -=-'
|
||||||
echo '-=- calc.spec beginning make rpm-clean-static -=-'
|
echo '-=- calc.spec beginning make rpm-clean-static -=-'
|
||||||
make -j1 BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-clean-static
|
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-clean-static
|
||||||
echo '-=- calc.spec ending make rpm-clean-static -=-'
|
echo '-=- calc.spec ending make rpm-clean-static -=-'
|
||||||
echo '-=- calc.spec beginning make rpm-chk-static -=-'
|
echo '-=- calc.spec beginning make rpm-chk-static -=-'
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-chk-static
|
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-chk-static
|
||||||
echo '-=- calc.spec ending make rpm-chk-static -=-'
|
echo '-=- calc.spec ending make rpm-chk-static -=-'
|
||||||
@@ -125,7 +125,7 @@ echo '-=- calc.spec ending make rpm-chk-static -=-'
|
|||||||
%install
|
%install
|
||||||
echo '-=- calc.spec beginning make install -=-'
|
echo '-=- calc.spec beginning make install -=-'
|
||||||
mkdir -p %{_buildroot}
|
mkdir -p %{_buildroot}
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ install
|
MANDIR=%{_mandir}/man1 EXT= V=@ install
|
||||||
echo '-=- calc.spec ending make install -=-'
|
echo '-=- calc.spec ending make install -=-'
|
||||||
@@ -165,6 +165,12 @@ echo '-=- calc.spec beginning make clean -=-'
|
|||||||
%attr(644, root, root) %{_libdir}/libcustcalc.a
|
%attr(644, root, root) %{_libdir}/libcustcalc.a
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sun Mar 24 2019 cLandon Curt Noll http://www.isthe.com/chongo
|
||||||
|
- Release: 13
|
||||||
|
- Disable compiling with the default ARCH_CFLAGS= -march=native
|
||||||
|
by clearking the ARCH_CFLAGS value in order to maximize
|
||||||
|
the RPM binary protability.
|
||||||
|
|
||||||
* Mon Sep 01 2014 Landon Curt Noll http://www.isthe.com/chongo
|
* Mon Sep 01 2014 Landon Curt Noll http://www.isthe.com/chongo
|
||||||
- Release: 12
|
- Release: 12
|
||||||
- Removed use of %{?_smp_mflags}. On Ubuntu 14.04, the -j2
|
- Removed use of %{?_smp_mflags}. On Ubuntu 14.04, the -j2
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
* ... ...
|
* ... ...
|
||||||
* x5 y5 z5 w5 point 5 in R^4
|
* x5 y5 z5 w5 point 5 in R^4
|
||||||
*
|
*
|
||||||
* Copyright (C) 2001,2014 Landon Curt Noll
|
* Copyright (C) 2001,2014,2019 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* 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
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -37,9 +37,11 @@
|
|||||||
* parse args
|
* parse args
|
||||||
*/
|
*/
|
||||||
argc = argv();
|
argc = argv();
|
||||||
if (argc != 25) {
|
stderr = files(2);
|
||||||
fprintf(files(2), "usage: %s x0 y0 z0 w0 x1 y1 z1 w1 ... x5 y5 z5 w5\n",
|
program = argv(0);
|
||||||
argv(0));
|
if (argc != 24) {
|
||||||
|
fprintf(stderr, "usage: %s x0 y0 z0 w0 x1 y1 z1 w1 ... x5 y5 z5 w5\n",
|
||||||
|
program);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
x0 = eval(argv(1));
|
x0 = eval(argv(1));
|
||||||
|
@@ -199,7 +199,7 @@ SCRIPT= 4dsphere fproduct mersenne piforever plus powerterm \
|
|||||||
simple square
|
simple square
|
||||||
|
|
||||||
SCRIPT_SRC= 4dsphere.calc fproduct.calc mersenne.calc \
|
SCRIPT_SRC= 4dsphere.calc fproduct.calc mersenne.calc \
|
||||||
piforever.calc plus.calc powerterm.calc simple.calc square.calc
|
piforever.calc plus.calc powerterm.calc simple.calc
|
||||||
|
|
||||||
# These files are found (but not built) in the distribution
|
# These files are found (but not built) in the distribution
|
||||||
#
|
#
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
* filename where to write the product, use - for stdout
|
* filename where to write the product, use - for stdout
|
||||||
* term ... terms to multiply
|
* term ... terms to multiply
|
||||||
*
|
*
|
||||||
* Copyright (C) 2001,2014 Landon Curt Noll
|
* Copyright (C) 2001,2014,2019 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* 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
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -35,8 +35,10 @@
|
|||||||
* parse args
|
* parse args
|
||||||
*/
|
*/
|
||||||
argc = argv();
|
argc = argv();
|
||||||
|
stderr = files(2);
|
||||||
|
program = argv(0);
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
fprintf(files(2), "usage: %s term [term ...]\n", argv(0));
|
fprintf(stderr, "usage: %s term [term ...]\n", program);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
filename = argv(1);
|
filename = argv(1);
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* mersenne - print the value of a mersenne number
|
* mersenne - print the value of a mersenne number
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007,2014 Landon Curt Noll
|
* Copyright (C) 1999-2007,2014,2019 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* 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
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -32,13 +32,16 @@
|
|||||||
/*
|
/*
|
||||||
* parse args
|
* parse args
|
||||||
*/
|
*/
|
||||||
if (argv() != 2) {
|
argc = argv();
|
||||||
|
stderr = files(2);
|
||||||
|
program = argv(0);
|
||||||
|
if (argc != 2) {
|
||||||
/* we include the name of this script in the error message */
|
/* we include the name of this script in the error message */
|
||||||
fprintf(files(2), "usage: %s exp\n", config("program"));
|
fprintf(stderr, "usage: %s exp\n", program);
|
||||||
abort "wrong number of args";
|
abort "wrong number of args";
|
||||||
}
|
}
|
||||||
|
|
||||||
global n = eval(argv(1));
|
n = eval(argv(1));
|
||||||
|
|
||||||
if (!isint(n) || n <= 0) {
|
if (!isint(n) || n <= 0) {
|
||||||
quit "Argument to be a positive integer";
|
quit "Argument to be a positive integer";
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/local/src/bin/calc/calc -q -f
|
#!/usr/local/src/bin/calc/calc -q -s -f
|
||||||
/*
|
/*
|
||||||
* piforever - print digits of pi forever (or as long as your mem/cpu allow)
|
* piforever - print digits of pi forever (or as long as your mem/cpu allow)
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007,2014 Landon Curt Noll
|
* Copyright (C) 1999-2007,2014,2019 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* 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
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/local/src/bin/calc/calc -q -f
|
#!/usr/local/src/bin/calc/calc -q -s -f
|
||||||
/*
|
/*
|
||||||
* plus - add two or more arguments together
|
* plus - add two or more arguments together
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007,2014 Landon Curt Noll
|
* Copyright (C) 1999-2007,2014,2019 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* 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
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -32,9 +32,12 @@
|
|||||||
/*
|
/*
|
||||||
* parse args
|
* parse args
|
||||||
*/
|
*/
|
||||||
if (argv() < 2) {
|
argc = argv();
|
||||||
|
stderr = files(2);
|
||||||
|
program = argv(0);
|
||||||
|
if (argc < 2) {
|
||||||
/* we include the name of this script in the error message */
|
/* we include the name of this script in the error message */
|
||||||
fprintf(files(2), "usage: %s value ...\n", config("program"));
|
fprintf(stderr, "usage: %s value ...\n", program);
|
||||||
abort "not enough args";
|
abort "not enough args";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
* base_limit largest base we will consider (def: 10000)
|
* base_limit largest base we will consider (def: 10000)
|
||||||
* value value to convert into sums of powers of integers
|
* value value to convert into sums of powers of integers
|
||||||
*
|
*
|
||||||
* Copyright (C) 2001,2014 Landon Curt Noll
|
* Copyright (C) 2001,2014,2019 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the powerterm of the version 2.1 of the GNU Lesser General Public License
|
* the powerterm of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -35,28 +35,31 @@
|
|||||||
/*
|
/*
|
||||||
* parse args
|
* parse args
|
||||||
*/
|
*/
|
||||||
|
argc = argv();
|
||||||
|
stderr = files(2);
|
||||||
|
program = argv(0);
|
||||||
config("verbose_quit", 0),;
|
config("verbose_quit", 0),;
|
||||||
base_lim = 10000; /* default: highest base we will consider */
|
base_lim = 10000; /* default: highest base we will consider */
|
||||||
if (argv() < 2 || argv() > 3) {
|
if (argc < 2 || argc > 3) {
|
||||||
fprintf(files(2), "usage: %s [base_limit] value\n", argv(0));
|
fprintf(stderr, "usage: %s [base_limit] value\n", program);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if (argv() == 3) {
|
if (argc == 3) {
|
||||||
x = eval(argv(2));
|
x = eval(argv(2));
|
||||||
base_lim = eval(argv(1));
|
base_lim = eval(argv(1));
|
||||||
} else {
|
} else {
|
||||||
x = eval(argv(1));
|
x = eval(argv(1));
|
||||||
}
|
}
|
||||||
if (! isint(x)) {
|
if (! isint(x)) {
|
||||||
fprintf(files(2), "%s: value must be an integer\n");
|
fprintf(stderr, "%s: value must be an integer\n", program);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if (! isint(base_lim)) {
|
if (! isint(base_lim)) {
|
||||||
fprintf(files(2), "%s: base limit must be an integer\n");
|
fprintf(stderr, "%s: base limit must be an integer\n", program);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if (base_lim <= 1) {
|
if (base_lim <= 1) {
|
||||||
fprintf(files(2), "%s: base limit is too small\n");
|
fprintf(stderr, "%s: base limit is too small\n", program);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
++base_lim;
|
++base_lim;
|
||||||
|
10
cscript/simple.calc
Normal file → Executable file
10
cscript/simple.calc
Normal file → Executable file
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/local/src/bin/calc/calc -q -f
|
#!/usr/local/src/bin/calc/calc -q -s -f
|
||||||
/*
|
/*
|
||||||
* simple - an example of a simple calc shell script
|
* simple - an example of a simple calc shell script
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007,2014 Landon Curt Noll
|
* Copyright (C) 1999-2007,2014,2019 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* 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
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -30,3 +30,9 @@
|
|||||||
* This is an example of a simple calc shell script.
|
* This is an example of a simple calc shell script.
|
||||||
*/
|
*/
|
||||||
print "This simple calc shell script works!"
|
print "This simple calc shell script works!"
|
||||||
|
print "config(\"program\")=", config("program");
|
||||||
|
print "argv()=", argv();
|
||||||
|
argc = argv();
|
||||||
|
for (i=0; i < argc; ++i) {
|
||||||
|
print "argv(":i:")=", argv(i);
|
||||||
|
}
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/local/src/bin/calc/calc -q -f
|
#!/usr/local/src/bin/calc/calc -q -s -f
|
||||||
/*
|
/*
|
||||||
* sqaure - print the squares of input values
|
* sqaure - print the squares of input values
|
||||||
*
|
*
|
||||||
* Copyright (C) 2000-2007,2014 Ernest Bowen
|
* Copyright (C) 2000-2007,2014,2019 Ernest Bowen
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* 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
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -33,10 +33,6 @@
|
|||||||
* cat file | ./square
|
* cat file | ./square
|
||||||
* echo "123" | ./square
|
* echo "123" | ./square
|
||||||
*
|
*
|
||||||
* Within calc:
|
|
||||||
*
|
|
||||||
* > read square
|
|
||||||
*
|
|
||||||
* With input from a terminal, there is no prompt but each non-empty
|
* With input from a terminal, there is no prompt but each non-empty
|
||||||
* line of input is evaluated as a calc expression and if it can be
|
* line of input is evaluated as a calc expression and if it can be
|
||||||
* calculated, the square of the value of that expression is displayed.
|
* calculated, the square of the value of that expression is displayed.
|
||||||
@@ -59,6 +55,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
global s;
|
while (s = fgetline(files(0))) {
|
||||||
while ((s = prompt("")))
|
|
||||||
print "\t":eval(s)^2;
|
print "\t":eval(s)^2;
|
||||||
|
}
|
||||||
|
@@ -348,7 +348,7 @@ EXT=
|
|||||||
|
|
||||||
# The default calc versions
|
# The default calc versions
|
||||||
#
|
#
|
||||||
VERSION= 2.12.7.2
|
VERSION= 2.12.7.3
|
||||||
|
|
||||||
# Names of shared libraries with versions
|
# Names of shared libraries with versions
|
||||||
#
|
#
|
||||||
|
@@ -348,7 +348,7 @@ EXT=
|
|||||||
|
|
||||||
# The default calc versions
|
# The default calc versions
|
||||||
#
|
#
|
||||||
VERSION= 2.12.7.2
|
VERSION= 2.12.7.3
|
||||||
|
|
||||||
# Names of shared libraries with versions
|
# Names of shared libraries with versions
|
||||||
#
|
#
|
||||||
|
@@ -45,7 +45,7 @@ static char *program;
|
|||||||
#define MAJOR_VER 2 /* major library version */
|
#define MAJOR_VER 2 /* major library version */
|
||||||
#define MINOR_VER 12 /* minor library version */
|
#define MINOR_VER 12 /* minor library version */
|
||||||
#define MAJOR_PATCH 7 /* major software level under library version */
|
#define MAJOR_PATCH 7 /* major software level under library version */
|
||||||
#define MINOR_PATCH 2 /* minor software level or 0 if not patched */
|
#define MINOR_PATCH 3 /* minor software level or 0 if not patched */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user