Cafe Versioin 2.2-pre.1
山田邦博です。
Cafe の version up です。 Version 2.2-pre.1 となりました。
複素数を手軽に扱える(RPN)関数電卓です。
電気・電子工学の研究開発に携わる研究者、技術者のためのものです。
詳細は後続の投稿 DOC を参照するか、下記 web ペイジを参照して下さい。
http://www.tksa.gr.jp/king/Software/Cafe/Cafe.html
-...-
Version 2.2 の目論見:
本来スカラーを演算対象とした binary および unary operator の一群を配
列にまで拡張する。
今回の投稿では、まだ一部の binary operator ("*","/","+","-","^","%",
"//" および blank operator) にしか対応していませんが、とりあえず公開
しておきます。
良くある
$real_array1 + j*$real_array2
といった演算が簡単になりました。
-...-
アーカイブ:
----------
Cafe Ver.2.2-pre.1 の全てのファイルは
ftp://ftp.tksa.gr.jp/king/Cafe/Cafe_2.2-pre.1.tgz
にあります。
最新の Cafe (patch 版を含む)については
http://www.tksa.gr.jp/king/Software/
からたどって下さい。
-...-
以下に Ver.2.1-patch.1 に対する diff を最後に添付します。
文書(doc)は diff だけ、プログラム(bin)は diff+shar です。
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##### (BEGIN) cut here for documents #####
diff -ur Cafe_2.1-patch.1/doc/README.jp.txt Cafe_2.2-pre.1/doc/README.jp.txt
--- Cafe_2.1-patch.1/doc/README.jp.txt 2004-01-31 11:35:16.000000000 +0900
+++ Cafe_2.2-pre.1/doc/README.jp.txt 2004-11-05 00:57:38.000000000 +0900
@@ -5,7 +5,7 @@
山田邦博
YAMADA Kunihiro <king@tksa.gr.jp>
- 31 Jan.2004 (Release 2.1-patch.1)
+ 4 Nov.2004 (Release 2.2-pre.1)
Copyright policy: GNU GPL Ver.2
@@ -28,8 +28,8 @@
ることができます。 さらに、それらのコメントを検索できます。
エラー発生時にはバックトラックが行われ、その原因と場所が表示されます。
-Cafe Ver.2.1 の全てのファイルは
- ftp://ftp.tksa.gr.jp/king/Cafe/Cafe_2.1.tgz
+Cafe Ver.2.2-pre.1 の全てのファイルは
+ ftp://ftp.tksa.gr.jp/king/Cafe/Cafe_2.2-pre.1.tgz
にあります。
最新の Cafe については
@@ -66,6 +66,14 @@
(MUMBLE.jp.txt を参照)
+Version 2.2-pre.1 での変更点:
+----------------------------
+・システム内蔵の算術 binary operator の一部について、配列に対応した。
+ 対応した operator は "*","/","+","-","^","%","//" および blank
+ operator である。 これらの operator に関しては operand の一方あるいは
+ 両方が配列であることが許される。
+
+
Version 2.1 での主な変更点:
--------------------------
・Reference の扱いを、関数の引数を call by name で扱うためのものに限定
diff -ur Cafe_2.1-patch.1/doc/change.log Cafe_2.2-pre.1/doc/change.log
--- Cafe_2.1-patch.1/doc/change.log 2004-01-31 11:34:48.000000000 +0900
+++ Cafe_2.2-pre.1/doc/change.log 2004-11-05 01:23:25.000000000 +0900
@@ -1,3 +1,9 @@
+5 Nov.2004
+ Version 2.2-pre.1 : release
+
+24 Oct.2004
+ expand arithmetic operators for array.
+
31 Jan.2004
Version 2.1-patch.1 : released
##### (END) cut here for documents #####
-...-
##### (BEGIN) cut here for binaries #####
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2.1).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 2004-11-05 01:38 JST by <king@owlin>.
# Source directory was `/home/king/tmp'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 2576 -rw-r----- cafe.diff.bin
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
if test "$gettext_dir" = FAILED && test -f $dir/gettext \
&& ($dir/gettext --version >/dev/null 2>&1)
then
set `$dir/gettext --version 2>&1`
if test "$3" = GNU
then
gettext_dir=$dir
fi
fi
if test "$locale_dir" = FAILED && test -f $dir/shar \
&& ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
then
locale_dir=`$dir/shar --print-text-domain-dir`
fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
echo=echo
else
TEXTDOMAINDIR=$locale_dir
export TEXTDOMAINDIR
TEXTDOMAIN=sharutils
export TEXTDOMAIN
echo="$gettext_dir/gettext -s"
fi
if touch -am -t 200112312359.59 $$.touch >/dev/null 2>&1 && test ! -f 200112312359.59 -a -f $$.touch; then
shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'
elif touch -am 123123592001.59 $$.touch >/dev/null 2>&1 && test ! -f 123123592001.59 -a ! -f 123123592001.5 -a -f $$.touch; then
shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'
elif touch -am 1231235901 $$.touch >/dev/null 2>&1 && test ! -f 1231235901 -a -f $$.touch; then
shar_touch='touch -am $3$4$5$6$2 "$8"'
else
shar_touch=:
echo
$echo 'WARNING: not restoring timestamps. Consider getting and'
$echo "installing GNU \`touch', distributed in GNU File Utilities..."
echo
fi
rm -f 200112312359.59 123123592001.59 123123592001.5 1231235901 $$.touch
#
if mkdir _sh05031; then
$echo 'x -' 'creating lock directory'
else
$echo 'failed to create lock directory'
exit 1
fi
# ============= cafe.diff.bin ==============
if test -f 'cafe.diff.bin' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'cafe.diff.bin' '(file already exists)'
else
$echo 'x -' extracting 'cafe.diff.bin' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'cafe.diff.bin' &&
diff -ur Cafe_2.1-patch.1/lib/Cafe.pm Cafe_2.2-pre.1/lib/Cafe.pm
--- Cafe_2.1-patch.1/lib/Cafe.pm 2004-01-31 11:45:48.000000000 +0900
+++ Cafe_2.2-pre.1/lib/Cafe.pm 2004-11-05 00:56:08.000000000 +0900
@@ -29,6 +29,7 @@
X # 24 Dec 2003 Ver.2.1-pre.1 (Pre-released)
X # 3 Jan.2004 Ver.2.1 (Released)
X # 31 Jan.2004 Ver.2.1-patch.1 (Released)
+# 5 Nov.2004 Ver.2.2-pre.1 (Released)
X #
X
X
@@ -81,7 +82,7 @@
X ### Constants ###
X ###################
X
-my $VERSION = "2.1-patch.1";
+my $VERSION = "2.2-pre.1";
X
X my $INF = 1e9999999999;
X my $NAN = $INF - $INF;
@@ -709,12 +710,65 @@
X return ($left,$right)
X }
X
+sub _op_bin_arith ( $ );
+
X sub _op_bin_arith ( $ ) {
X my $opid = shift;
- my ($left,$right) = check_bin_num($opid);
- pushvstack(arith($left,$right,$opid));
+ my $right = popvstack();
+ my $left = popvstack();
+ if ($left->{type} eq "A") {
+ my $n = @{$left->{value}};
+ DIE("\"$opid\" : null array : \"$left->{name}\"\n",$left,$right)
+ unless $n > 0;
+ my $ans = makearray;
+ $left->{name} =~ /(\[.*)/;
+ $ans->{name} = $opid . ($1 ? $1 : "");
+ if ($right->{type} eq "A") {
+ DIE("\"$opid\" : incompatible arrays : \"$left->{name}\" and \"$right->{name}\"\n",
+ $left,$right)
+ unless $n == @{$right->{value}};
+ for (my $i=0; $i<$n; ++$i) {
+ pushvstack($left->{value}[$i]);
+ pushvstack($right->{value}[$i]);
+ _op_bin_arith($opid);
+ $ans->{value}[$i] = popvstack();
+ $ans->{value}[$i]->{name} = $ans->{name} . "\[$i\]";
+ }
+ pushvstack($ans);
+ } else {
+ for (my $i=0; $i<$n; ++$i) {
+ pushvstack($left->{value}[$i]);
+ pushvstack($right);
+ _op_bin_arith($opid);
+ $ans->{value}[$i] = popvstack();
+ $ans->{value}[$i]->{name} = $ans->{name} . "\[$i\]";
+ }
+ pushvstack($ans);
+ }
+ } elsif ($right->{type} eq "A") {
+ my $ans = makearray;
+ $right->{name} =~ /(\[.*)/;
+ $ans->{name} = $opid . ($1 ? $1 : "");
+ my $n = @{$right->{value}};
+ DIE("\"$opid\" : null array : \"$right->{name}\"\n",$left,$right)
+ unless $n > 0;
+ for (my $i=0; $i<$n; ++$i) {
+ pushvstack($left);
+ pushvstack($right->{value}[$i]);
+ _op_bin_arith($opid);
+ $ans->{value}[$i] = popvstack();
+ $ans->{value}[$i]->{name} = $ans->{name} . "\[$i\]";
+ }
+ pushvstack($ans);
+ } else {
+ pushvstack($left);
+ pushvstack($right);
+ check_bin_num($opid);
+ pushvstack(arith($left,$right,$opid));
+ }
X }
X
+
X sub op_add () { _op_bin_arith('+') }
X sub op_sub () { _op_bin_arith('-') }
X sub op_mul () { _op_bin_arith('*') }
SHAR_EOF
(set 20 04 11 05 01 26 55 'cafe.diff.bin'; eval "$shar_touch") &&
chmod 0640 'cafe.diff.bin' ||
$echo 'restore of' 'cafe.diff.bin' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'cafe.diff.bin:' 'MD5 check failed'
6aeac5314870f402ebe7e5ac7b89bb17 cafe.diff.bin
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'cafe.diff.bin'`"
test 2576 -eq "$shar_count" ||
$echo 'cafe.diff.bin:' 'original size' '2576,' 'current size' "$shar_count!"
fi
fi
rm -fr _sh05031
exit 0
Fnews-brouse 1.9(20180406) -- by Mizuno, MWE <mwe@ccsf.jp>
GnuPG Key ID = ECC8A735
GnuPG Key fingerprint = 9BE6 B9E9 55A5 A499 CD51 946E 9BDC 7870 ECC8 A735