Remove files that were not part of the bc-1.06 import.
This commit is contained in:
parent
aa454a4b53
commit
f8be0f6af6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=86005
@ -1,341 +0,0 @@
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
|
@ -1,565 +0,0 @@
|
||||
From phil@cs.wwu.edu Mon Mar 20 23:13:22 1995
|
||||
Date: Mon, 20 Mar 1995 23:12:17 -0800
|
||||
From: Phil Nelson <phil@cs.wwu.edu>
|
||||
To: phil@steelhead.cs.wwu.edu
|
||||
Subject: [jhn@ironwood.cray.com: XPG4 bc(1) failures]
|
||||
|
||||
From: jhn@ironwood.cray.com (James Nordby)
|
||||
Subject: XPG4 bc(1) failures
|
||||
To: phil@cs.wwu.edu
|
||||
Date: Fri, 17 Mar 1995 12:14:13 -0600 (CST)
|
||||
X-Mailer: ELM [version 2.4 PL24-CRI-b]
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain; charset=US-ASCII
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Content-Length: 14277
|
||||
|
||||
|
||||
Phil,
|
||||
|
||||
Here are the test results I'm getting from the XPG4 test suite,
|
||||
with some explanation and fixes so far. Let me know what you
|
||||
think...
|
||||
|
||||
Thanks much,
|
||||
Jim Nordby (jhn@cray.com)
|
||||
|
||||
|
||||
-------- bc 08:38:34 --------
|
||||
|
||||
Assertion #20 (A): bc reads text files
|
||||
Expected exit code = 0; Received 139
|
||||
Standard output isn't the same as file 'bc_eso_20_1'
|
||||
diff of "out.stdout" and "bc_eso_20_1":
|
||||
*** out.stdout Fri Mar 17 08:39:22 1995
|
||||
--- bc_eso_20_1 Fri Mar 17 08:39:22 1995
|
||||
***************
|
||||
*** 0 ****
|
||||
--- 1,31 ----
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 11111111111111111111111111111111111111111111111111111111111111111111
|
||||
+ 1111111
|
||||
Assertion Result: FAIL
|
||||
|
||||
I couldn't reproduce this problem; when I rebuilt your bc and
|
||||
ran it, I got a different problem with printing out a large
|
||||
number. The XPG4 tests expected lines to be 70 characters
|
||||
long, INCLUDING the newline (this comes from the POSIX definition
|
||||
of a line). To fix it, I changed util.c like so:
|
||||
|
||||
*** util.c Thu Mar 16 10:47:36 1995
|
||||
--- util.c.old Thu Mar 16 10:50:10 1995
|
||||
***************
|
||||
*** 309,323 ****
|
||||
else
|
||||
{
|
||||
out_col++;
|
||||
- #ifdef _CRAY
|
||||
- /*
|
||||
- * XPG4 considers a line to include the <newline>;
|
||||
- * therefore we want 68 numerals, <backslash>, <newline>
|
||||
- */
|
||||
- if (out_col == 69)
|
||||
- #else
|
||||
if (out_col == 70)
|
||||
- #endif
|
||||
{
|
||||
putchar ('\\');
|
||||
putchar ('\n');
|
||||
--- 309,315 ----
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Assertion #42 (A): check reserved words
|
||||
Standard error isn't empty
|
||||
Contents of out.stderr:
|
||||
(standard_in) 6: syntax error
|
||||
(standard_in) 15: syntax error
|
||||
Standard output isn't the same as file 'bc_eso_42_1'
|
||||
diff of "out.stdout" and "bc_eso_42_1":
|
||||
*** out.stdout Fri Mar 17 08:39:43 1995
|
||||
--- bc_eso_42_1 Fri Mar 17 08:39:43 1995
|
||||
***************
|
||||
*** 1,2 ****
|
||||
--- 1,3 ----
|
||||
2
|
||||
1
|
||||
+ 0
|
||||
Assertion Result: FAIL
|
||||
|
||||
This one is debatable, based on the grammar in the POSIX manual.
|
||||
Here's the input file:
|
||||
|
||||
cat << \VSC-EOF > input
|
||||
define a() {
|
||||
auto b;
|
||||
for ( b = 0; b < 10; b++ ) {
|
||||
b;
|
||||
if ( b == 1 )
|
||||
break;
|
||||
}
|
||||
return ( 5 ) ;
|
||||
}
|
||||
ibase = 10;
|
||||
length ( obase );
|
||||
scale = 0;
|
||||
sqrt(1);
|
||||
while ( a() != 5 )
|
||||
VSC-EOF
|
||||
|
||||
They want these constructs to be accepted:
|
||||
|
||||
|
||||
if (b == 1)
|
||||
whatever;
|
||||
for (x = 0; x < 10; x++)
|
||||
whatever;
|
||||
while (x < 10)
|
||||
whatever;
|
||||
|
||||
rather than just
|
||||
|
||||
if (b == 1) {
|
||||
whatever
|
||||
}
|
||||
etc.
|
||||
|
||||
The grammar as it's currently worded requires a '{' before hitting
|
||||
a NEWLINE for these constructs. It's easy enough to change in bc.y
|
||||
(see below), but if I do change it, it still barfs on the last
|
||||
line of the file ( 'while (a() != 5)' ). Since the while lacks
|
||||
a body, it gives a syntax error; they're expecting a '0' to be
|
||||
returned. The grammar could be changed to support this, but is
|
||||
it a good idea?
|
||||
|
||||
|
||||
*** bc.y Thu Mar 16 10:47:20 1995
|
||||
--- bc.y.old Thu Mar 16 10:50:11 1995
|
||||
***************
|
||||
*** 142,150 ****
|
||||
| error statement
|
||||
{ $$ = $2; }
|
||||
;
|
||||
- allow_newlines : /* empty */
|
||||
- | NEWLINE allow_newlines
|
||||
- ;
|
||||
statement : Warranty
|
||||
{ warranty (""); }
|
||||
| Limits
|
||||
--- 142,147 ----
|
||||
***************
|
||||
*** 231,237 ****
|
||||
sprintf (genstr, "pJ%1d:N%1d:", $4, $7);
|
||||
generate (genstr);
|
||||
}
|
||||
! allow_newlines statement
|
||||
{
|
||||
sprintf (genstr, "J%1d:N%1d:",
|
||||
continue_label, break_label);
|
||||
--- 228,234 ----
|
||||
sprintf (genstr, "pJ%1d:N%1d:", $4, $7);
|
||||
generate (genstr);
|
||||
}
|
||||
! statement
|
||||
{
|
||||
sprintf (genstr, "J%1d:N%1d:",
|
||||
continue_label, break_label);
|
||||
***************
|
||||
*** 246,252 ****
|
||||
sprintf (genstr, "Z%1d:", if_label);
|
||||
generate (genstr);
|
||||
}
|
||||
! allow_newlines statement opt_else
|
||||
{
|
||||
sprintf (genstr, "N%1d:", if_label);
|
||||
generate (genstr);
|
||||
--- 243,249 ----
|
||||
sprintf (genstr, "Z%1d:", if_label);
|
||||
generate (genstr);
|
||||
}
|
||||
! statement opt_else
|
||||
{
|
||||
sprintf (genstr, "N%1d:", if_label);
|
||||
generate (genstr);
|
||||
***************
|
||||
*** 265,271 ****
|
||||
sprintf (genstr, "Z%1d:", break_label);
|
||||
generate (genstr);
|
||||
}
|
||||
! ')' allow_newlines statement
|
||||
{
|
||||
sprintf (genstr, "J%1d:N%1d:", $1, break_label);
|
||||
generate (genstr);
|
||||
--- 262,268 ----
|
||||
sprintf (genstr, "Z%1d:", break_label);
|
||||
generate (genstr);
|
||||
}
|
||||
! ')' statement
|
||||
{
|
||||
sprintf (genstr, "J%1d:N%1d:", $1, break_label);
|
||||
generate (genstr);
|
||||
|
||||
|
||||
|
||||
|
||||
Assertion #49 (A): check strings
|
||||
Expected exit code = 0; Received 1
|
||||
Standard error isn't empty
|
||||
Contents of out.stderr:
|
||||
File (NULL) is unavailable.
|
||||
Standard output isn't the same as file 'bc_eso_49_1'
|
||||
diff of "out.stdout" and "bc_eso_49_1":
|
||||
cmd-1794 diff: Missing newline at end of file 'bc_eso_49_1'.
|
||||
*** out.stdout Fri Mar 17 08:40:01 1995
|
||||
--- bc_eso_49_1 Fri Mar 17 08:40:01 1995
|
||||
***************
|
||||
*** 0 ****
|
||||
--- 1 ----
|
||||
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
*LINE CONTINUATION -aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
*LINE CONTINUATION -aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
Assertion Result: FAIL
|
||||
|
||||
This gist of this is that the standard expects numbers to
|
||||
be truncated to 70 characters, but STRINGS should not.
|
||||
My changes to fix this are:
|
||||
|
||||
|
||||
*** execute.c Thu Mar 16 13:06:39 1995
|
||||
--- execute.c.old Thu Mar 16 10:50:09 1995
|
||||
***************
|
||||
*** 208,218 ****
|
||||
case 'O' : /* Write a string to the output with processing. */
|
||||
while ((ch = byte(&pc)) != '"')
|
||||
if (ch != '\\')
|
||||
- #ifdef _CRAY
|
||||
- putchar (ch);
|
||||
- #else
|
||||
out_char (ch);
|
||||
- #endif
|
||||
else
|
||||
{
|
||||
ch = byte(&pc);
|
||||
--- 207,213 ----
|
||||
***************
|
||||
*** 219,234 ****
|
||||
if (ch == '"') break;
|
||||
switch (ch)
|
||||
{
|
||||
- #ifdef _CRAY
|
||||
- case 'a': putchar (007); break;
|
||||
- case 'b': putchar ('\b'); break;
|
||||
- case 'f': putchar ('\f'); break;
|
||||
- case 'n': putchar ('\n'); break;
|
||||
- case 'q': putchar ('"'); break;
|
||||
- case 'r': putchar ('\r'); break;
|
||||
- case 't': putchar ('\t'); break;
|
||||
- case '\\': putchar ('\\'); break;
|
||||
- #else
|
||||
case 'a': out_char (007); break;
|
||||
case 'b': out_char ('\b'); break;
|
||||
case 'f': out_char ('\f'); break;
|
||||
--- 214,219 ----
|
||||
***************
|
||||
*** 237,243 ****
|
||||
case 'r': out_char ('\r'); break;
|
||||
case 't': out_char ('\t'); break;
|
||||
case '\\': out_char ('\\'); break;
|
||||
- #endif
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
--- 222,227 ----
|
||||
***************
|
||||
*** 350,360 ****
|
||||
break;
|
||||
|
||||
case 'w' : /* Write a string to the output. */
|
||||
- #ifdef _CRAY
|
||||
- while ((ch = byte(&pc)) != '"') putchar (ch);
|
||||
- #else
|
||||
while ((ch = byte(&pc)) != '"') out_char (ch);
|
||||
- #endif
|
||||
if (interactive) fflush (stdout);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
Assertion #77 (C): output longer than 70 characters
|
||||
Standard output isn't the same as file 'bc_eso_77_1'
|
||||
diff of "out.stdout" and "bc_eso_77_1":
|
||||
*** out.stdout Fri Mar 17 08:41:13 1995
|
||||
--- bc_eso_77_1 Fri Mar 17 08:41:13 1995
|
||||
***************
|
||||
*** 1,2 ****
|
||||
! 3.3333333333333333333333333333333333333333333333333333333333333333333
|
||||
! 33333333333333333333333333333333
|
||||
--- 1,2 ----
|
||||
! 3.333333333333333333333333333333333333333333333333333333333333333333
|
||||
! 333333333333333333333333333333333
|
||||
Assertion Result: FAIL
|
||||
|
||||
Same as assertion #20 above...
|
||||
|
||||
|
||||
|
||||
|
||||
Assertion #92 (A): check %
|
||||
Standard output isn't the same as file 'bc_eso_92_1'
|
||||
diff of "out.stdout" and "bc_eso_92_1":
|
||||
*** out.stdout Fri Mar 17 08:41:33 1995
|
||||
--- bc_eso_92_1 Fri Mar 17 08:41:33 1995
|
||||
***************
|
||||
*** 4,8 ****
|
||||
4
|
||||
15
|
||||
1
|
||||
! 0
|
||||
! 0
|
||||
--- 4,8 ----
|
||||
4
|
||||
15
|
||||
1
|
||||
! 6
|
||||
! 5
|
||||
Assertion Result: FAIL
|
||||
|
||||
This one is a pain. The failing code looks like this:
|
||||
|
||||
scale = 4
|
||||
scale ( 5.000000 % 2.0 )
|
||||
scale ( 5.00 % 2.0 )
|
||||
|
||||
They expect '6' and '5' for output, instead of '0', based on
|
||||
the explanation of the modulus operator ("scale of the result
|
||||
shall be 'max(scale + scale(b), scale(a)'"), even though the
|
||||
result is a 0. I was able to fix this problem by the change
|
||||
below:
|
||||
|
||||
*** number.c Thu Mar 16 13:15:43 1995
|
||||
--- number.c.old Thu Mar 16 10:50:09 1995
|
||||
***************
|
||||
*** 614,623 ****
|
||||
case 0:
|
||||
/* They are equal! return zero! */
|
||||
diff = copy_num (_zero_);
|
||||
- #ifdef _CRAY
|
||||
- /* correct the scale here */
|
||||
- diff->n_scale = MAX (n1->n_scale, n2->n_scale);
|
||||
- #endif
|
||||
break;
|
||||
case 1:
|
||||
/* n2 is less than n1, subtract n2 from n1. */
|
||||
|
||||
but this causes another test failure that I haven't looked at.
|
||||
|
||||
|
||||
|
||||
|
||||
Assertion #130 (A): functions are call by value
|
||||
Standard output isn't the same as file 'bc_eso_130_1'
|
||||
diff of "out.stdout" and "bc_eso_130_1":
|
||||
*** out.stdout Fri Mar 17 08:42:24 1995
|
||||
--- bc_eso_130_1 Fri Mar 17 08:42:24 1995
|
||||
***************
|
||||
*** 4,10 ****
|
||||
5
|
||||
4
|
||||
0
|
||||
! 4
|
||||
3
|
||||
3
|
||||
5
|
||||
--- 4,10 ----
|
||||
5
|
||||
4
|
||||
0
|
||||
! 5
|
||||
3
|
||||
3
|
||||
5
|
||||
Assertion Result: FAIL
|
||||
|
||||
Assertion #131 (A): functions are call by value
|
||||
Standard output isn't the same as file 'bc_eso_131_1'
|
||||
diff of "out.stdout" and "bc_eso_131_1":
|
||||
*** out.stdout Fri Mar 17 08:42:28 1995
|
||||
--- bc_eso_131_1 Fri Mar 17 08:42:28 1995
|
||||
***************
|
||||
*** 4,10 ****
|
||||
5
|
||||
4
|
||||
0
|
||||
! 4
|
||||
3
|
||||
3
|
||||
5
|
||||
--- 4,10 ----
|
||||
5
|
||||
4
|
||||
0
|
||||
! 5
|
||||
3
|
||||
3
|
||||
5
|
||||
Assertion Result: FAIL
|
||||
|
||||
|
||||
Both of these are the 'arrays are passed by value' problem.
|
||||
One of the test cases is below:
|
||||
|
||||
cat << \VSC-EOF > bc_in_130_1
|
||||
a[0] = 3
|
||||
a[0]
|
||||
define b(a[]) {
|
||||
a[0]
|
||||
a[0] = 4
|
||||
a[0]
|
||||
}
|
||||
a[0]
|
||||
a[0] = 5
|
||||
a[0]
|
||||
b(a[])
|
||||
a[0]
|
||||
VSC-EOF
|
||||
|
||||
They expect the assignment of a[0] inside the b() function
|
||||
to not affect a[0] outside of the function.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Assertion #139 (A): check sin
|
||||
Standard output isn't the same as file 'bc_eso_139_1'
|
||||
diff of "out.stdout" and "bc_eso_139_1":
|
||||
*** out.stdout Fri Mar 17 08:42:40 1995
|
||||
--- bc_eso_139_1 Fri Mar 17 08:42:39 1995
|
||||
***************
|
||||
*** 1,5 ****
|
||||
0
|
||||
! 20
|
||||
1.68294196961579301330
|
||||
20
|
||||
1.6829419696
|
||||
--- 1,5 ----
|
||||
0
|
||||
! 0
|
||||
1.68294196961579301330
|
||||
20
|
||||
1.6829419696
|
||||
Assertion Result: FAIL
|
||||
|
||||
Assertion #141 (A): check arctanngent
|
||||
Standard output isn't the same as file 'bc_eso_141_1'
|
||||
diff of "out.stdout" and "bc_eso_141_1":
|
||||
*** out.stdout Fri Mar 17 08:42:44 1995
|
||||
--- bc_eso_141_1 Fri Mar 17 08:42:44 1995
|
||||
***************
|
||||
*** 1,5 ****
|
||||
0
|
||||
! 20
|
||||
3.14159265358979323844
|
||||
20
|
||||
3.1415926532
|
||||
--- 1,5 ----
|
||||
0
|
||||
! 0
|
||||
3.14159265358979323844
|
||||
20
|
||||
3.1415926532
|
||||
Assertion Result: FAIL
|
||||
|
||||
Assertion #142 (A): check log
|
||||
Standard output isn't the same as file 'bc_eso_142_1'
|
||||
diff of "out.stdout" and "bc_eso_142_1":
|
||||
*** out.stdout Fri Mar 17 08:42:47 1995
|
||||
--- bc_eso_142_1 Fri Mar 17 08:42:47 1995
|
||||
***************
|
||||
*** 1,5 ****
|
||||
0
|
||||
! 20
|
||||
2.30258509299404568401
|
||||
20
|
||||
2.3025850929
|
||||
--- 1,5 ----
|
||||
0
|
||||
! 0
|
||||
2.30258509299404568401
|
||||
20
|
||||
2.3025850929
|
||||
Assertion Result: FAIL
|
||||
|
||||
Assertion #144 (A): check bessel
|
||||
Standard output isn't the same as file 'bc_eso_144_1'
|
||||
diff of "out.stdout" and "bc_eso_144_1":
|
||||
*** out.stdout Fri Mar 17 08:42:51 1995
|
||||
--- bc_eso_144_1 Fri Mar 17 08:42:51 1995
|
||||
***************
|
||||
*** 1,5 ****
|
||||
0
|
||||
! 20
|
||||
.57672480775687338720
|
||||
20
|
||||
.5767248077
|
||||
--- 1,5 ----
|
||||
0
|
||||
! 0
|
||||
.57672480775687338720
|
||||
20
|
||||
.5767248077
|
||||
Assertion Result: FAIL
|
||||
|
||||
All of these are the same. I'll give you the test case
|
||||
for 'sin'; what they're expecting is 0:
|
||||
|
||||
scale(s(0))
|
||||
|
||||
bc outputs '20' (which is the scale at the time), but the
|
||||
interpretation of the standard says that it should be '0',
|
||||
since s(0) is 0, and the scale of 0 is 0. I think that
|
||||
this interpretation disagrees with one of the previous
|
||||
assertions (assertion #92).
|
||||
|
||||
/* end of test results */
|
||||
|
||||
|
||||
|
||||
--
|
||||
Phil Nelson
|
||||
e-mail: phil@cs.wwu.edu
|
||||
http://www.cs.wwu.edu/~phil
|
||||
|
||||
|
@ -1,166 +0,0 @@
|
||||
/* bcdefs.h: The single file to include all constants and type definitions. */
|
||||
|
||||
/* This file is part of GNU bc.
|
||||
Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License , or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
You may contact the author by:
|
||||
e-mail: phil@cs.wwu.edu
|
||||
us-mail: Philip A. Nelson
|
||||
Computer Science Department, 9062
|
||||
Western Washington University
|
||||
Bellingham, WA 98226-9062
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
/* Include the configuration file. */
|
||||
#include "config.h"
|
||||
|
||||
/* Standard includes for all files. */
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#else
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
/* Include the other definitions. */
|
||||
#include "const.h"
|
||||
#include "number.h"
|
||||
|
||||
|
||||
/* These definitions define all the structures used in
|
||||
code and data storage. This includes the representation of
|
||||
labels. The "guiding" principle is to make structures that
|
||||
take a minimum of space when unused but can be built to contain
|
||||
the full structures. */
|
||||
|
||||
/* Labels are first. Labels are generated sequentially in functions
|
||||
and full code. They just "point" to a single bye in the code. The
|
||||
"address" is the byte number. The byte number is used to get an
|
||||
actual character pointer. */
|
||||
|
||||
typedef struct bc_label_group
|
||||
{
|
||||
long l_adrs [ BC_LABEL_GROUP ];
|
||||
struct bc_label_group *l_next;
|
||||
} bc_label_group;
|
||||
|
||||
/* Argument list. Recorded in the function so arguments can
|
||||
be checked at call time. */
|
||||
|
||||
typedef struct arg_list
|
||||
{
|
||||
int av_name;
|
||||
int arg_is_var; /* Extension ... variable parameters. */
|
||||
struct arg_list *next;
|
||||
} arg_list;
|
||||
|
||||
/* Each function has its own code segments and labels. There can be
|
||||
no jumps between functions so labels are unique to a function. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char f_defined; /* Is this function defined yet. */
|
||||
char *f_body[BC_MAX_SEGS];
|
||||
int f_code_size;
|
||||
bc_label_group *f_label;
|
||||
arg_list *f_params;
|
||||
arg_list *f_autos;
|
||||
} bc_function;
|
||||
|
||||
/* Code addresses. */
|
||||
typedef struct {
|
||||
int pc_func;
|
||||
int pc_addr;
|
||||
} program_counter;
|
||||
|
||||
|
||||
/* Variables are "pushable" (auto) and thus we need a stack mechanism.
|
||||
This is built into the variable record. */
|
||||
|
||||
typedef struct bc_var
|
||||
{
|
||||
bc_num v_value;
|
||||
struct bc_var *v_next;
|
||||
} bc_var;
|
||||
|
||||
|
||||
/* bc arrays can also be "auto" variables and thus need the same
|
||||
kind of stacking mechanisms. */
|
||||
|
||||
typedef struct bc_array_node
|
||||
{
|
||||
union
|
||||
{
|
||||
bc_num n_num [NODE_SIZE];
|
||||
struct bc_array_node *n_down [NODE_SIZE];
|
||||
} n_items;
|
||||
} bc_array_node;
|
||||
|
||||
typedef struct bc_array
|
||||
{
|
||||
bc_array_node *a_tree;
|
||||
short a_depth;
|
||||
} bc_array;
|
||||
|
||||
typedef struct bc_var_array
|
||||
{
|
||||
bc_array *a_value;
|
||||
char a_param;
|
||||
struct bc_var_array *a_next;
|
||||
} bc_var_array;
|
||||
|
||||
|
||||
/* For the stacks, execution and function, we need records to allow
|
||||
for arbitrary size. */
|
||||
|
||||
typedef struct estack_rec {
|
||||
bc_num s_num;
|
||||
struct estack_rec *s_next;
|
||||
} estack_rec;
|
||||
|
||||
typedef struct fstack_rec {
|
||||
int s_val;
|
||||
struct fstack_rec *s_next;
|
||||
} fstack_rec;
|
||||
|
||||
|
||||
/* The following are for the name tree. */
|
||||
|
||||
typedef struct id_rec {
|
||||
char *id; /* The program name. */
|
||||
/* A name == 0 => nothing assigned yet. */
|
||||
int a_name; /* The array variable name (number). */
|
||||
int f_name; /* The function name (number). */
|
||||
int v_name; /* The variable name (number). */
|
||||
short balance; /* For the balanced tree. */
|
||||
struct id_rec *left, *right; /* Tree pointers. */
|
||||
} id_rec;
|
||||
|
||||
|
||||
/* A list of files to process. */
|
||||
|
||||
typedef struct file_node {
|
||||
char *name;
|
||||
struct file_node *next;
|
||||
} file_node;
|
||||
|
@ -1,101 +0,0 @@
|
||||
/* const.h: Constants for bc. */
|
||||
|
||||
/* This file is part of GNU bc.
|
||||
Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License , or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
You may contact the author by:
|
||||
e-mail: phil@cs.wwu.edu
|
||||
us-mail: Philip A. Nelson
|
||||
Computer Science Department, 9062
|
||||
Western Washington University
|
||||
Bellingham, WA 98226-9062
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
|
||||
/* Define INT_MAX and LONG_MAX if not defined. Assuming 32 bits... */
|
||||
|
||||
#ifndef INT_MAX
|
||||
#define INT_MAX 0x7FFFFFFF
|
||||
#endif
|
||||
#ifndef LONG_MAX
|
||||
#define LONG_MAX 0x7FFFFFFF
|
||||
#endif
|
||||
|
||||
|
||||
/* Define constants in some reasonable size. The next 4 constants are
|
||||
POSIX constants. */
|
||||
|
||||
#ifdef BC_BASE_MAX
|
||||
/* <limits.h> on a POSIX.2 system may have defined these. Override. */
|
||||
# undef BC_BASE_MAX
|
||||
# undef BC_SCALE_MAX
|
||||
# undef BC_STRING_MAX
|
||||
# undef BC_DIM_MAX
|
||||
#endif
|
||||
|
||||
#define BC_BASE_MAX INT_MAX
|
||||
#define BC_SCALE_MAX INT_MAX
|
||||
#define BC_STRING_MAX INT_MAX
|
||||
|
||||
|
||||
/* Definitions for arrays. */
|
||||
|
||||
#define BC_DIM_MAX 65535 /* this should be NODE_SIZE^NODE_DEPTH-1 */
|
||||
|
||||
#define NODE_SIZE 16 /* Must be a power of 2. */
|
||||
#define NODE_MASK 0xf /* Must be NODE_SIZE-1. */
|
||||
#define NODE_SHIFT 4 /* Number of 1 bits in NODE_MASK. */
|
||||
#define NODE_DEPTH 4
|
||||
|
||||
|
||||
/* Other BC limits defined but not part of POSIX. */
|
||||
|
||||
#define BC_LABEL_GROUP 64
|
||||
#define BC_LABEL_LOG 6
|
||||
#define BC_MAX_SEGS 16 /* Code segments. */
|
||||
#define BC_SEG_SIZE 1024
|
||||
#define BC_SEG_LOG 10
|
||||
|
||||
/* Maximum number of variables, arrays and functions and the
|
||||
allocation increment for the dynamic arrays. */
|
||||
|
||||
#define MAX_STORE 32767
|
||||
#define STORE_INCR 32
|
||||
|
||||
/* Other interesting constants. */
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
/* for use with lookup (). */
|
||||
#define SIMPLE 0
|
||||
#define ARRAY 1
|
||||
#define FUNCT 2
|
||||
#define FUNCTDEF 3
|
||||
|
||||
#define EXTERN extern
|
||||
#ifdef __STDC__
|
||||
#define CONST const
|
||||
#define VOID void
|
||||
#else
|
||||
#define CONST
|
||||
#define VOID
|
||||
#endif
|
||||
|
||||
/* Include the version definition. */
|
||||
#include "version.h"
|
@ -1,147 +0,0 @@
|
||||
/* global.h: The global variables for bc. */
|
||||
|
||||
/* This file is part of GNU bc.
|
||||
Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License , or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
You may contact the author by:
|
||||
e-mail: phil@cs.wwu.edu
|
||||
us-mail: Philip A. Nelson
|
||||
Computer Science Department, 9062
|
||||
Western Washington University
|
||||
Bellingham, WA 98226-9062
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
|
||||
/* The current break level's lable. */
|
||||
EXTERN int break_label;
|
||||
|
||||
/* The current if statement's else label or label after else. */
|
||||
EXTERN int if_label;
|
||||
|
||||
/* The current for statement label for continuing the loop. */
|
||||
EXTERN int continue_label;
|
||||
|
||||
/* Next available label number. */
|
||||
EXTERN int next_label;
|
||||
|
||||
/* Byte code character storage. Used in many places for generation of code. */
|
||||
EXTERN char genstr[80];
|
||||
|
||||
/* Count of characters printed to the output in compile_only mode. */
|
||||
EXTERN int out_count;
|
||||
|
||||
/* Have we generated any code since the last initialization of the code
|
||||
generator. */
|
||||
EXTERN char did_gen;
|
||||
|
||||
/* Is this run an interactive execution. (Is stdin a terminal?) */
|
||||
EXTERN char interactive;
|
||||
|
||||
/* Just generate the byte code. -c flag. */
|
||||
EXTERN int compile_only;
|
||||
|
||||
/* Load the standard math functions. -l flag. */
|
||||
EXTERN int use_math;
|
||||
|
||||
/* Give a warning on use of any non-standard feature (non-POSIX). -w flag. */
|
||||
EXTERN int warn_not_std;
|
||||
|
||||
/* Accept POSIX bc only! -s flag. */
|
||||
EXTERN int std_only;
|
||||
|
||||
/* Don't print the banner at start up. -q flag. */
|
||||
EXTERN int quiet;
|
||||
|
||||
/* The list of file names to process. */
|
||||
EXTERN file_node *file_names;
|
||||
|
||||
/* The name of the current file being processed. */
|
||||
EXTERN char *file_name;
|
||||
|
||||
/* Is the current file a named file or standard input? */
|
||||
EXTERN char is_std_in;
|
||||
|
||||
/* global variables for the bc machine. All will be dynamic in size.*/
|
||||
/* Function storage. main is (0) and functions (1-f_count) */
|
||||
|
||||
EXTERN bc_function *functions;
|
||||
EXTERN char **f_names;
|
||||
EXTERN int f_count;
|
||||
|
||||
/* Variable stoarge and reverse names. */
|
||||
|
||||
EXTERN bc_var **variables;
|
||||
EXTERN char **v_names;
|
||||
EXTERN int v_count;
|
||||
|
||||
/* Array Variable storage and reverse names. */
|
||||
|
||||
EXTERN bc_var_array **arrays;
|
||||
EXTERN char **a_names;
|
||||
EXTERN int a_count;
|
||||
|
||||
/* Execution stack. */
|
||||
EXTERN estack_rec *ex_stack;
|
||||
|
||||
/* Function return stack. */
|
||||
EXTERN fstack_rec *fn_stack;
|
||||
|
||||
/* Current ibase, obase, scale, and n_history (if needed). */
|
||||
EXTERN int i_base;
|
||||
EXTERN int o_base;
|
||||
EXTERN int scale;
|
||||
#ifdef READLINE
|
||||
EXTERN int n_history;
|
||||
#endif
|
||||
|
||||
/* "Condition code" -- false (0) or true (1) */
|
||||
EXTERN char c_code;
|
||||
|
||||
/* Records the number of the runtime error. */
|
||||
EXTERN char runtime_error;
|
||||
|
||||
/* Holds the current location of execution. */
|
||||
EXTERN program_counter pc;
|
||||
|
||||
/* For POSIX bc, this is just for number output, not strings. */
|
||||
EXTERN int out_col;
|
||||
|
||||
/* Keeps track of the current number of characters per output line.
|
||||
This includes the \n at the end of the line. */
|
||||
EXTERN int line_size;
|
||||
|
||||
/* Input Line numbers and other error information. */
|
||||
EXTERN int line_no;
|
||||
EXTERN int had_error;
|
||||
|
||||
/* For larger identifiers, a tree, and how many "storage" locations
|
||||
have been allocated. */
|
||||
|
||||
EXTERN int next_array;
|
||||
EXTERN int next_func;
|
||||
EXTERN int next_var;
|
||||
|
||||
EXTERN id_rec *name_tree;
|
||||
|
||||
/* defined in number.c */
|
||||
extern bc_num _zero_;
|
||||
extern bc_num _one_;
|
||||
|
||||
/* For use with getopt. Do not declare them here.*/
|
||||
extern int optind;
|
||||
|
@ -1,171 +0,0 @@
|
||||
/* proto.h: Prototype function definitions for "external" functions. */
|
||||
|
||||
/* This file is part of GNU bc.
|
||||
Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License , or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
You may contact the author by:
|
||||
e-mail: phil@cs.wwu.edu
|
||||
us-mail: Philip A. Nelson
|
||||
Computer Science Department, 9062
|
||||
Western Washington University
|
||||
Bellingham, WA 98226-9062
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
/* For the pc version using k&r ACK. (minix1.5 and earlier.) */
|
||||
#ifdef SHORTNAMES
|
||||
#define init_numbers i_numbers
|
||||
#define push_constant push__constant
|
||||
#define load_const in_load_const
|
||||
#define yy_get_next_buffer yyget_next_buffer
|
||||
#define yy_init_buffer yyinit_buffer
|
||||
#define yy_last_accepting_state yylast_accepting_state
|
||||
#define arglist1 arg1list
|
||||
#endif
|
||||
|
||||
/* Include the standard library header files. */
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
/* Define the _PROTOTYPE macro if it is needed. */
|
||||
|
||||
#ifndef _PROTOTYPE
|
||||
#ifdef __STDC__
|
||||
#define _PROTOTYPE(func, args) func args
|
||||
#else
|
||||
#define _PROTOTYPE(func, args) func()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* From execute.c */
|
||||
_PROTOTYPE(void stop_execution, (int));
|
||||
_PROTOTYPE(unsigned char byte, (program_counter *pc));
|
||||
_PROTOTYPE(void execute, (void));
|
||||
_PROTOTYPE(char prog_char, (void));
|
||||
_PROTOTYPE(char input_char, (void));
|
||||
_PROTOTYPE(void push_constant, (char (*in_char)(void), int conv_base));
|
||||
_PROTOTYPE(void push_b10_const, (program_counter *pc));
|
||||
_PROTOTYPE(void assign, (int c_code));
|
||||
|
||||
/* From util.c */
|
||||
_PROTOTYPE(char *strcopyof, (char *str));
|
||||
_PROTOTYPE(arg_list *nextarg, (arg_list *args, int val, int is_var));
|
||||
_PROTOTYPE(char *arg_str, (arg_list *args));
|
||||
_PROTOTYPE(char *call_str, (arg_list *args));
|
||||
_PROTOTYPE(void free_args, (arg_list *args));
|
||||
_PROTOTYPE(void check_params, (arg_list *params, arg_list *autos));
|
||||
_PROTOTYPE(void init_gen, (void));
|
||||
_PROTOTYPE(void generate, (char *str));
|
||||
_PROTOTYPE(void run_code, (void));
|
||||
_PROTOTYPE(void out_char, (int ch));
|
||||
_PROTOTYPE(id_rec *find_id, (id_rec *tree, char *id));
|
||||
_PROTOTYPE(int insert_id_rec, (id_rec **root, id_rec *new_id));
|
||||
_PROTOTYPE(void init_tree, (void));
|
||||
_PROTOTYPE(int lookup, (char *name, int namekind));
|
||||
_PROTOTYPE(char *bc_malloc, (int));
|
||||
_PROTOTYPE(void out_of_memory, (void));
|
||||
_PROTOTYPE(void welcome, (void));
|
||||
_PROTOTYPE(void warranty, (char *));
|
||||
_PROTOTYPE(void limits, (void));
|
||||
_PROTOTYPE(void yyerror, (char *str ,...));
|
||||
_PROTOTYPE(void warn, (char *mesg ,...));
|
||||
_PROTOTYPE(void rt_error, (char *mesg ,...));
|
||||
_PROTOTYPE(void rt_warn, (char *mesg ,...));
|
||||
|
||||
/* From load.c */
|
||||
_PROTOTYPE(void init_load, (void));
|
||||
_PROTOTYPE(void addbyte, (int byte));
|
||||
_PROTOTYPE(void def_label, (long lab));
|
||||
_PROTOTYPE(long long_val, (char **str));
|
||||
_PROTOTYPE(void load_code, (char *code));
|
||||
|
||||
/* From main.c */
|
||||
_PROTOTYPE(int main, (int argc , char *argv []));
|
||||
_PROTOTYPE(int open_new_file, (void));
|
||||
_PROTOTYPE(void new_yy_file, (FILE *file));
|
||||
_PROTOTYPE(void use_quit, (int));
|
||||
|
||||
/* From number.c */
|
||||
_PROTOTYPE(void free_num, (bc_num *num));
|
||||
_PROTOTYPE(bc_num new_num, (int length, int scale));
|
||||
_PROTOTYPE(void init_numbers, (void));
|
||||
_PROTOTYPE(bc_num copy_num, (bc_num num));
|
||||
_PROTOTYPE(void init_num, (bc_num *num));
|
||||
_PROTOTYPE(void str2num, (bc_num *num, char *str, int scale));
|
||||
_PROTOTYPE(char *num2str, (bc_num num));
|
||||
_PROTOTYPE(void int2num, (bc_num *num, int val));
|
||||
_PROTOTYPE(long num2long, (bc_num num));
|
||||
_PROTOTYPE(int bc_compare, (bc_num n1, bc_num n2));
|
||||
_PROTOTYPE(char is_zero, (bc_num num));
|
||||
_PROTOTYPE(char is_neg, (bc_num num));
|
||||
_PROTOTYPE(void bc_add, (bc_num n1, bc_num n2, bc_num *result, int scale_min));
|
||||
_PROTOTYPE(void bc_sub, (bc_num n1, bc_num n2, bc_num *result, int scale_min));
|
||||
_PROTOTYPE(void bc_multiply, (bc_num n1, bc_num n2, bc_num *prod, int scale));
|
||||
_PROTOTYPE(int bc_divide, (bc_num n1, bc_num n2, bc_num *quot, int scale));
|
||||
_PROTOTYPE(int bc_modulo,
|
||||
(bc_num num1, bc_num num2, bc_num *result, int scale));
|
||||
_PROTOTYPE(int bc_divmod,
|
||||
(bc_num num1, bc_num num2, bc_num *quot, bc_num *rem, int scale));
|
||||
_PROTOTYPE(int bc_raisemod,
|
||||
(bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale));
|
||||
_PROTOTYPE(void bc_raise,
|
||||
(bc_num num1, bc_num num2, bc_num *result, int scale));
|
||||
_PROTOTYPE(int bc_sqrt, (bc_num *num, int scale));
|
||||
_PROTOTYPE(void out_long, (long val, int size, int space,
|
||||
void (*out_char)(int)));
|
||||
_PROTOTYPE(void out_num, (bc_num num, int o_base, void (* out_char)(int)));
|
||||
|
||||
|
||||
/* From storage.c */
|
||||
_PROTOTYPE(void init_storage, (void));
|
||||
_PROTOTYPE(void more_functions, (void));
|
||||
_PROTOTYPE(void more_variables, (void));
|
||||
_PROTOTYPE(void more_arrays, (void));
|
||||
_PROTOTYPE(void clear_func, (int func ));
|
||||
_PROTOTYPE(int fpop, (void));
|
||||
_PROTOTYPE(void fpush, (int val ));
|
||||
_PROTOTYPE(void pop, (void));
|
||||
_PROTOTYPE(void push_copy, (bc_num num ));
|
||||
_PROTOTYPE(void push_num, (bc_num num ));
|
||||
_PROTOTYPE(char check_stack, (int depth ));
|
||||
_PROTOTYPE(bc_var *get_var, (int var_name ));
|
||||
_PROTOTYPE(bc_num *get_array_num, (int var_index, long index ));
|
||||
_PROTOTYPE(void store_var, (int var_name ));
|
||||
_PROTOTYPE(void store_array, (int var_name ));
|
||||
_PROTOTYPE(void load_var, (int var_name ));
|
||||
_PROTOTYPE(void load_array, (int var_name ));
|
||||
_PROTOTYPE(void decr_var, (int var_name ));
|
||||
_PROTOTYPE(void decr_array, (int var_name ));
|
||||
_PROTOTYPE(void incr_var, (int var_name ));
|
||||
_PROTOTYPE(void incr_array, (int var_name ));
|
||||
_PROTOTYPE(void auto_var, (int name ));
|
||||
_PROTOTYPE(void free_a_tree, (bc_array_node *root, int depth ));
|
||||
_PROTOTYPE(void pop_vars, (arg_list *list ));
|
||||
_PROTOTYPE(void process_params, (program_counter *pc, int func ));
|
||||
|
||||
/* For the scanner and parser.... */
|
||||
_PROTOTYPE(int yyparse, (void));
|
||||
_PROTOTYPE(int yylex, (void));
|
||||
|
||||
/* Other things... */
|
||||
#ifndef HAVE_UNISTD_H
|
||||
_PROTOTYPE (int getopt, (int, char *[], CONST char *));
|
||||
#endif
|
@ -1,28 +0,0 @@
|
||||
/* version.h: version information for GNU bc and GNU dc */
|
||||
|
||||
/* This file is part of GNU bc and GNU dc.
|
||||
* Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you can either send email to this
|
||||
* program's author (see below) or write to: The Free Software Foundation,
|
||||
* Inc.; 675 Mass Ave. Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#define BC_VERSION \
|
||||
"bc 1.05\n\
|
||||
Copyright 1991, 1992, 1993, 1994, 1997, 1998 Free Software Foundation, Inc."
|
||||
|
||||
#define DC_VERSION \
|
||||
"dc 1.2 (GNU bc 1.05)\n\
|
||||
Copyright 1994, 1997, 1998 Free Software Foundation, Inc."
|
Loading…
Reference in New Issue
Block a user