Package init

This commit is contained in:
overweight 2019-09-30 10:32:18 -04:00
commit 57cb39a497
4 changed files with 146 additions and 0 deletions

58
bc-1.06-dc_ibase.patch Normal file
View File

@ -0,0 +1,58 @@
--- bc-1.06/dc/numeric.c.dc_ibase 2007-08-22 08:37:57.000000000 +0200
+++ bc-1.06/dc/numeric.c 2007-08-22 08:37:40.000000000 +0200
@@ -285,6 +285,8 @@ dc_getnum DC_DECLARG((input, ibase, read
int digit;
int decimal;
int c;
+ int c_buff = 0;
+ int multi = 0;
bc_init_num(&tmp);
bc_init_num(&build);
@@ -302,6 +304,9 @@ dc_getnum DC_DECLARG((input, ibase, read
}
while (isspace(c))
c = (*input)();
+ c_buff = (*input)();
+ if (isdigit(c_buff) || ('A' <= c_buff && c_buff <= 'F') || c_buff == '.')
+ multi = 1;
for (;;){
if (isdigit(c))
digit = c - '0';
@@ -309,10 +314,15 @@ dc_getnum DC_DECLARG((input, ibase, read
digit = 10 + c - 'A';
else
break;
- c = (*input)();
+ digit = multi ? (digit >= ibase ? ibase -1 : digit) : digit;
bc_int2num(&tmp, digit);
bc_multiply(result, base, &result, 0);
bc_add(result, tmp, &result, 0);
+ if (c_buff) {
+ c = c_buff;
+ c_buff = 0;
+ } else
+ c = (*input)();
}
if (c == '.'){
bc_free_num(&build);
@@ -321,13 +331,18 @@ dc_getnum DC_DECLARG((input, ibase, read
build = bc_copy_num(_zero_);
decimal = 0;
for (;;){
- c = (*input)();
+ if (c_buff) {
+ c = c_buff;
+ c_buff = 0;
+ } else
+ c = (*input)();
if (isdigit(c))
digit = c - '0';
else if ('A' <= c && c <= 'F')
digit = 10 + c - 'A';
else
break;
+ digit = digit >= ibase ? ibase -1 : digit;
bc_int2num(&tmp, digit);
bc_multiply(build, base, &build, 0);
bc_add(build, tmp, &build, 0);

24
bc-1.06.95-doc.patch Normal file
View File

@ -0,0 +1,24 @@
diff -up wrk/doc/bc.1.wrk wrk/doc/bc.1
--- wrk/doc/bc.1.wrk 2013-10-02 13:36:52.066295450 +0200
+++ wrk/doc/bc.1 2013-10-02 13:35:22.738553712 +0200
@@ -174,6 +174,8 @@ The result of the expression is the sum
The result of the expression is the difference of the two expressions.
.IP "expr * expr"
The result of the expression is the product of the two expressions.
+If a and b are the scales of the two expressions, then the scale of the result is:
+min(a+b,max(scale,a,b))
.IP "expr / expr"
The result of the expression is the quotient of the two expressions.
The scale of the result is the value of the variable \fBscale\fR.
diff -up wrk/doc/bc.texi.wrk wrk/doc/bc.texi
--- wrk/doc/bc.texi.wrk 2013-10-02 13:17:01.743765518 +0200
+++ wrk/doc/bc.texi 2013-10-02 13:21:04.479870656 +0200
@@ -290,6 +290,8 @@ The result of the expression is the diff
@item expr * expr
The result of the expression is the product of the two expressions.
+If a and b are the scales of the two expressions, then the scale of the result is:
+min(a+b,max(@var{scale},a,b))
@item expr / expr
The result of the expression is the quotient of the two expressions.

BIN
bc-1.07.1.tar.gz Normal file

Binary file not shown.

64
bc.spec Normal file
View File

@ -0,0 +1,64 @@
Name: bc
Version: 1.07.1
Release: 8
Summary: An arbitrary precision numeric processing language.
License: GPLv2+
URL: http://www.gnu.org/software/bc/
Source0: https://ftp.gnu.org/gnu/bc/%{name}-%{version}.tar.gz
Patch0: bc-1.06-dc_ibase.patch
Patch1: bc-1.06.95-doc.patch
BuildRequires: gcc readline-devel flex bison texinfo ed
Requires(post): info
Requires(preun):info
%description
bc is an arbitrary precision numeric processing language. Syntax
is similar to C, but differs in many substantial areas. It supports
interactive execution of statements. bc is a utility included in the
POSIX P1003.2/D11 draft standard.
%package_help
%prep
%autosetup -p1
%build
%configure --with-readline
%make_build
%install
%make_install
rm -rf %{buildroot}%{_infodir}/dir
%post help
%install_info %{_infodir}/bc.info.gz
%install_info %{_infodir}/dc.info.gz
%preun help
if [ $1 = 0 ];then
%install_info_rm %{_infodir}/bc.info.gz
%install_info_rm %{_infodir}/dc.info.gz
fi;
%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog
%license COPYING COPYING.LIB
%{_bindir}/{bc,dc}
%files help
%doc FAQ NEWS README
%{_mandir}/man1/{bc*,dc*}
%{_infodir}/{bc*,dc*}
%doc Examples/
%changelog
* Sun Sep 29 2019 shenyangyang <shenyangyang4@huawei.com> - 1.07.1-8
- Type:NA
- ID:NA
- SUG:NA
- DESC:add license files
* Wed Sep 04 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.07.1-7
- Package Init