GCC 4.2.0 release miscellaneous support libraries.

This commit is contained in:
Alexander Kabaev 2007-05-19 01:27:20 +00:00
parent 00e4af377d
commit c7ca977ef2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/gcc/dist/; revision=169695
319 changed files with 175655 additions and 0 deletions

View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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
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) <year> <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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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) year 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.

View File

@ -0,0 +1,317 @@
2007-05-13 Release Manager
* GCC 4.2.0 released.
2007-05-04 Mark Mitchell <mark@codesourcery.com>
* demangle.h: Change license to LGPL + exception.
2007-02-09 Joseph S. Myers <joseph@codesourcery.com>
* libiberty.h (pex_write_input): Remove prototype.
2006-04-11 Jim Blandy <jimb@codesourcery.com>
* libiberty.h (pex_input_file, pex_input_pipe): New declarations.
2006-01-18 DJ Delorie <dj@redhat.com>
* md5.h: Include ansidecl.h
2006-01-09 Bob Wilson <bob.wilson@acm.org>
* xtensa-config.h (XCHAL_HAVE_MUL32_HIGH): Define.
2005-12-30 Bob Wilson <bob.wilson@acm.org>
* xtensa-config.h (XCHAL_HAVE_WIDE_BRANCHES): New.
2005-12-10 Terry Laurenzo <tlaurenzo@gmail.com>
PR java/9861
* demangle.h : Add DMGL_RET_POSTFIX define to enable alternative
output format for return types
2005-10-31 Mark Kettenis <kettenis@gnu.org>
* floatformat.h (enum floatformat_byteorders): Add
floatformat_vax.
(floatformat_vax_aingle, floatformat_vax_double): Declare.
2005-09-26 Mark Mitchell <mark@codesourcery.com>
* libiberty.h (expandargv): New function.
2005-08-17 Mark Kettenis <kettenis@gnu.org>
* floatformat.h (struct floatformat): Change type of large
argument for is_valid member to `const void *'.
(floatformat_to_double): Change type of second argument to `const
void *'.
(floatformat_from_double): Change type of last argument to `void
*'.
(floatformat_is_valid): Change type of last argument to `const
void *'.
2005-07-12 Ben Elliston <bje@au.ibm.com>
* xregex2.h (regexec): Qualify this prototype with __extension__
when compiling with GNU C.
2005-07-03 Steve Ellcey <sje@cup.hp.com>
PR other/13906
* ansidecl.h (ATTRIBUTE_ALIGNED_ALIGNOF): New.
* md5.h (md5_uintptr): New.
(md5_ctx): Align buffer field.
2005-06-30 Daniel Berlin <dberlin@dberlin.org>
* hashtab.h (HTAB_DELETED_ENTRY): New macro.
(HTAB_EMPTY_ENTRY): New macro.
2005-06-20 Geoffrey Keating <geoffk@apple.com>
* libiberty.h (strverscmp): Prototype.
2005-06-06 Gabriel Dos Reis <gdr@integrable-solutions.net>
* libiberty.h (XOBFINISH): New.
2005-06-01 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* libiberty.h (vsnprintf): Add format attribute.
2005-05-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* ansidecl.h: Add ATTRIBUTE_FPTR_PRINTF.
2005-05-28 Eli Zaretskii <eliz@gnu.org>
* libiberty.h: (snprintf) [!HAVE_DECL_SNPRINTF]: Declare if
needed.
(vsnprintf) [!HAVE_DECL_VSNPRINTF]: Declare if needed.
2005-05-25 Richard Henderson <rth@redhat.com>
* demangle.h (DEMANGLE_COMPONENT_HIDDEN_ALIAS): New.
2005-05-24 Gabriel Dos Reis <gdr@integrable-solutions.net>
* libiberty.h (ACONCAT): Properly cast value of alloca().
* ansidecl.h (ATTRIBUTE_UNUSED_LABEL): Don't define if
__cplusplus.
2005-05-12 Steve Ellcey <sje@cup.hp.com>
libiberty.h: Do not define empty basename prototype.
2005-05-10 Nick Clifton <nickc@redhat.com>
* Update the address and phone number of the FSF organization in
the GPL notices in the following files:
COPYING, ansidecl.h, bfdlink.h, bout.h, demangle.h, dis-asm.h,
dyn-string.h, fibheap.h, filenames.h, floatformat.h,
fnmatch.h, gdbm.h, getopt.h, hashtab.h, hp-symtab.h, ieee.h,
libiberty.h, md5.h, oasys.h, objalloc.h, obstack.h, os9k.h,
partition.h, progress.h, safe-ctype.h, sort.h, splay-tree.h,
symcat.h, ternary.h, xregex2.h, xtensa-config.h,
xtensa-isa-internal.h, xtensa-isa.h
2005-04-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* libiberty.h (unlock_std_streams): New.
2005-04-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* hashtab.h, libiberty.h, objalloc.h, splay-tree.h, ternary.h:
Don't use the PTR macro.
* sort.h: Don't use the PARAMS macro.
2005-04-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* libiberty.h (unlock_stream): New.
2005-04-13 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* libiberty.h (fopen_unlocked, fdopen_unlocked, freopen_unlocked):
Remove parameter names.
2005-04-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* libiberty.h (fopen_unlocked, fdopen_unlocked, freopen_unlocked):
Provide prototypes for new functions.
2005-03-29 Ian Lance Taylor <ian@airs.com>
* libiberty.h: Fix indentation.
2005-03-28 Ian Lance Taylor <ian@airs.com>
* libiberty.h: Include <stdio.h>.
(PEX_RECORD_TIMES, PEX_USE_PIPES, PEX_SAVE_TEMPS): Define.
(PEX_LAST, PEX_SEARCH, PEX_SUFFIX, PEX_STDERR_TO_STDOUT): Define.
(PEX_BINARY_INPUT, PEX_BINARY_OUTPUT): Define.
(pex_init, pex_run, pex_read_output): Declare.
(pex_get_status, pex_get_times, pex_free, pex_one): Declare.
(struct pex_time): Define.
2005-03-28 Mark Mitchell <mark@codesourcery.com>
* libiberty.h (ffs): Declare, if necessary.
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* xregex2.h (_RE_ARGS): Remove definition and uses.
2005-03-27 Gabriel Dos Reis <gdr@integreable-solutions.net>
* ternary.h: Don't use PARAMS anymore.
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* partition.h: Remove use of PARAMS.
* obstack.h: Remove conditional prototypes __STDC__.
* objalloc.h: Remove use of PARAMS.
* splay-tree.h: Likewise.
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* md5.h: Remove definition and uses of __P.
* dyn-string.h: Remove uses of PARAMS.
* fibheap.h: Likewise.
* floatformat.h: Likewise.
* hashtab.h: Likewise.
2005-03-26 Gabriel Dos Reis <gdr@integrable-solutions.net>
* demangle.h: Remove uses of PARAMS.
* libiberty.h (ANSI_PROTOTYPES): Remove guard since
ANSI_PROTOTYPES is always assumed.
Remove uses of PARAMS throughout.
2005-03-24 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* libiberty.h (xstrndup): Declare.
2005-03-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* libiberty.h (make_relative_prefix): Add ATTRIBUTE_MALLOC.
2005-03-09 Mark Mitchell <mark@codesourcery.com>
* libiberty.h (gettimeofday): Declare.
2005-03-01 Jan Beulich <jbeulich@novell.com>
* libiberty.h: Declare unlink_if_ordinary.
2005-02-14 Paolo Bonzini <bonzini@gnu.org>
PR bootstrap/19818
* ansidecl.h (PARAMS): Guard from redefinition.
2004-12-11 Ben Elliston <bje@au.ibm.com>
* fibheap.h (struct fibnode): Only use unsigned long bitfields
when __GNUC__ is defined and ints are less than 32-bits wide.
2004-10-07 Bob Wilson <bob.wilson@acm.org>
* xtensa-config.h (XSHAL_USE_ABSOLUTE_LITERALS,
XCHAL_HAVE_PREDICTED_BRANCHES, XCHAL_INST_FETCH_WIDTH): New.
(XCHAL_EXTRA_SA_SIZE, XCHAL_EXTRA_SA_ALIGN): Delete.
2004-09-13 Aaron W. LaFramboise <aaronavay62@aaronwl.com>
* libiberty.h (basename): Prototype for __MINGW32__.
2004-09-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* ansidecl.h (ATTRIBUTE_SENTINEL): Define.
* libiberty.h (concat, reconcat, concat_length, concat_copy,
concat_copy2): Use ATTRIBUTE_SENTINEL.
2004-08-02 Gabriel Dos Reis <gdr@integrable-solutions.net>
* libiberty.h (XDELETE, XDELETEVEC, XRESIZEVEC): Remove any
const-qualification before disposal.
2004-07-24 Bernardo Innocenti <bernie@develer.com>
* ansidecl.h (ARG_UNUSED): New Macro.
2004-07-24 Bernardo Innocenti <bernie@develer.com>
* libiberty.h (XNEW, XCNEW, XNEWVEC, XCNEWVEC, XOBNEW): Move here from
libcpp/internal.h.
(XDELETE, XRESIZEVEC, XDELETEVEC, XNEWVAR, XCNEWVAR, XRESIZEVAR): New
macros.
2004-07-21 Paolo Bonzini <bonzini@gnu.org>
* ansidecl.h (ATTRIBUTE_PURE): New.
2004-07-13 Bernardo Innocenti <bernie@develer.com>
* libiberty.h (ASTRDUP): Add casts required for stricter
type conversion rules of C++.
* obstack.h (obstack_free): Likewise.
2004-05-04 Andreas Jaeger <aj@suse.de>
* demangle.h: Do not use C++ reserved keyword typename as
parameter for cplus_demangle_fill_builtin_type.
2004-04-22 Richard Henderson <rth@redhat.com>
* hashtab.h (struct htab): Add size_prime_index.
2004-04-13 Jeff Law <law@redhat.com>
* hashtab.h (htab_remove_elt_with_hash): Prototype new function.
2004-03-30 Zack Weinberg <zack@codesourcery.com>
* hashtab.h, splay-tree.h: Use new shorter form of GTY markers.
2004-02-24 Ian Lance Taylor <ian@wasabisystems.com>
* dyn-string.h: Update copyright date.
2004-02-23 Ian Lance Taylor <ian@wasabisystems.com>
* dyn-string.h: Remove test of IN_LIBGCC2 and IN_GLIBCPP_V3 and
the associated #defines.
2004-01-12 Ian Lance Taylor <ian@wasabisystems.com>
* demangle.h: Instead of checking ANSI_PROTOTYPES, just include
"libiberty.h".
* demangle.h: If ANSI_PROTOTYPES is defined, include <stddef.h>.
* demangle.h (enum demangle_component_type): Define.
(struct demangle_operator_info): Declare.
(struct demangle_builtin_type_info): Declare.
(struct demangle_component): Define.
(cplus_demangle_fill_component): Declare.
(cplus_demangle_fill_name): Declare.
(cplus_demangle_fill_builtin_type): Declare.
(cplus_demangle_fill_operator): Declare.
(cplus_demangle_fill_extended_operator): Declare.
(cplus_demangle_fill_ctor, cplus_demangle_fill_dtor): Declare.
(cplus_demangle_v3_components): Declare.
(cplus_demangle_print): Declare.
For older changes see ChangeLog-9103
Local Variables:
mode: change-log
left-margin: 8
fill-column: 74
version-control: never
End:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,371 @@
/* ANSI and traditional C compatability macros
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of the GNU C Library.
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* ANSI and traditional C compatibility macros
ANSI C is assumed if __STDC__ is #defined.
Macro ANSI C definition Traditional C definition
----- ---- - ---------- ----------- - ----------
ANSI_PROTOTYPES 1 not defined
PTR `void *' `char *'
PTRCONST `void *const' `char *'
LONG_DOUBLE `long double' `double'
const not defined `'
volatile not defined `'
signed not defined `'
VA_START(ap, var) va_start(ap, var) va_start(ap)
Note that it is safe to write "void foo();" indicating a function
with no return value, in all K+R compilers we have been able to test.
For declaring functions with prototypes, we also provide these:
PARAMS ((prototype))
-- for functions which take a fixed number of arguments. Use this
when declaring the function. When defining the function, write a
K+R style argument list. For example:
char *strcpy PARAMS ((char *dest, char *source));
...
char *
strcpy (dest, source)
char *dest;
char *source;
{ ... }
VPARAMS ((prototype, ...))
-- for functions which take a variable number of arguments. Use
PARAMS to declare the function, VPARAMS to define it. For example:
int printf PARAMS ((const char *format, ...));
...
int
printf VPARAMS ((const char *format, ...))
{
...
}
For writing functions which take variable numbers of arguments, we
also provide the VA_OPEN, VA_CLOSE, and VA_FIXEDARG macros. These
hide the differences between K+R <varargs.h> and C89 <stdarg.h> more
thoroughly than the simple VA_START() macro mentioned above.
VA_OPEN and VA_CLOSE are used *instead of* va_start and va_end.
Immediately after VA_OPEN, put a sequence of VA_FIXEDARG calls
corresponding to the list of fixed arguments. Then use va_arg
normally to get the variable arguments, or pass your va_list object
around. You do not declare the va_list yourself; VA_OPEN does it
for you.
Here is a complete example:
int
printf VPARAMS ((const char *format, ...))
{
int result;
VA_OPEN (ap, format);
VA_FIXEDARG (ap, const char *, format);
result = vfprintf (stdout, format, ap);
VA_CLOSE (ap);
return result;
}
You can declare variables either before or after the VA_OPEN,
VA_FIXEDARG sequence. Also, VA_OPEN and VA_CLOSE are the beginning
and end of a block. They must appear at the same nesting level,
and any variables declared after VA_OPEN go out of scope at
VA_CLOSE. Unfortunately, with a K+R compiler, that includes the
argument list. You can have multiple instances of VA_OPEN/VA_CLOSE
pairs in a single function in case you need to traverse the
argument list more than once.
For ease of writing code which uses GCC extensions but needs to be
portable to other compilers, we provide the GCC_VERSION macro that
simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various
wrappers around __attribute__. Also, __extension__ will be #defined
to nothing if it doesn't work. See below.
This header also defines a lot of obsolete macros:
CONST, VOLATILE, SIGNED, PROTO, EXFUN, DEFUN, DEFUN_VOID,
AND, DOTS, NOARGS. Don't use them. */
#ifndef _ANSIDECL_H
#define _ANSIDECL_H 1
/* Every source file includes this file,
so they will all get the switch for lint. */
/* LINTLIBRARY */
/* Using MACRO(x,y) in cpp #if conditionals does not work with some
older preprocessors. Thus we can't define something like this:
#define HAVE_GCC_VERSION(MAJOR, MINOR) \
(__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR)))
and then test "#if HAVE_GCC_VERSION(2,7)".
So instead we use the macro below and test it against specific values. */
/* This macro simplifies testing whether we are using gcc, and if it
is of a particular minimum version. (Both major & minor numbers are
significant.) This macro will evaluate to 0 if we are not using
gcc at all. */
#ifndef GCC_VERSION
#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
#endif /* GCC_VERSION */
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32) || (defined(__alpha) && defined(__cplusplus))
/* All known AIX compilers implement these things (but don't always
define __STDC__). The RISC/OS MIPS compiler defines these things
in SVR4 mode, but does not define __STDC__. */
/* eraxxon@alumni.rice.edu: The Compaq C++ compiler, unlike many other
C++ compilers, does not define __STDC__, though it acts as if this
was so. (Verified versions: 5.7, 6.2, 6.3, 6.5) */
#define ANSI_PROTOTYPES 1
#define PTR void *
#define PTRCONST void *const
#define LONG_DOUBLE long double
/* PARAMS is often defined elsewhere (e.g. by libintl.h), so wrap it in
a #ifndef. */
#ifndef PARAMS
#define PARAMS(ARGS) ARGS
#endif
#define VPARAMS(ARGS) ARGS
#define VA_START(VA_LIST, VAR) va_start(VA_LIST, VAR)
/* variadic function helper macros */
/* "struct Qdmy" swallows the semicolon after VA_OPEN/VA_FIXEDARG's
use without inhibiting further decls and without declaring an
actual variable. */
#define VA_OPEN(AP, VAR) { va_list AP; va_start(AP, VAR); { struct Qdmy
#define VA_CLOSE(AP) } va_end(AP); }
#define VA_FIXEDARG(AP, T, N) struct Qdmy
#undef const
#undef volatile
#undef signed
/* inline requires special treatment; it's in C99, and GCC >=2.7 supports
it too, but it's not in C89. */
#undef inline
#if __STDC_VERSION__ > 199901L
/* it's a keyword */
#else
# if GCC_VERSION >= 2007
# define inline __inline__ /* __inline__ prevents -pedantic warnings */
# else
# define inline /* nothing */
# endif
#endif
/* These are obsolete. Do not use. */
#ifndef IN_GCC
#define CONST const
#define VOLATILE volatile
#define SIGNED signed
#define PROTO(type, name, arglist) type name arglist
#define EXFUN(name, proto) name proto
#define DEFUN(name, arglist, args) name(args)
#define DEFUN_VOID(name) name(void)
#define AND ,
#define DOTS , ...
#define NOARGS void
#endif /* ! IN_GCC */
#else /* Not ANSI C. */
#undef ANSI_PROTOTYPES
#define PTR char *
#define PTRCONST PTR
#define LONG_DOUBLE double
#define PARAMS(args) ()
#define VPARAMS(args) (va_alist) va_dcl
#define VA_START(va_list, var) va_start(va_list)
#define VA_OPEN(AP, VAR) { va_list AP; va_start(AP); { struct Qdmy
#define VA_CLOSE(AP) } va_end(AP); }
#define VA_FIXEDARG(AP, TYPE, NAME) TYPE NAME = va_arg(AP, TYPE)
/* some systems define these in header files for non-ansi mode */
#undef const
#undef volatile
#undef signed
#undef inline
#define const
#define volatile
#define signed
#define inline
#ifndef IN_GCC
#define CONST
#define VOLATILE
#define SIGNED
#define PROTO(type, name, arglist) type name ()
#define EXFUN(name, proto) name()
#define DEFUN(name, arglist, args) name arglist args;
#define DEFUN_VOID(name) name()
#define AND ;
#define DOTS
#define NOARGS
#endif /* ! IN_GCC */
#endif /* ANSI C. */
/* Define macros for some gcc attributes. This permits us to use the
macros freely, and know that they will come into play for the
version of gcc in which they are supported. */
#if (GCC_VERSION < 2007)
# define __attribute__(x)
#endif
/* Attribute __malloc__ on functions was valid as of gcc 2.96. */
#ifndef ATTRIBUTE_MALLOC
# if (GCC_VERSION >= 2096)
# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
# else
# define ATTRIBUTE_MALLOC
# endif /* GNUC >= 2.96 */
#endif /* ATTRIBUTE_MALLOC */
/* Attributes on labels were valid as of gcc 2.93. */
#ifndef ATTRIBUTE_UNUSED_LABEL
# if (!defined (__cplusplus) && GCC_VERSION >= 2093)
# define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
# else
# define ATTRIBUTE_UNUSED_LABEL
# endif /* !__cplusplus && GNUC >= 2.93 */
#endif /* ATTRIBUTE_UNUSED_LABEL */
#ifndef ATTRIBUTE_UNUSED
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif /* ATTRIBUTE_UNUSED */
/* Before GCC 3.4, the C++ frontend couldn't parse attributes placed after the
identifier name. */
#if ! defined(__cplusplus) || (GCC_VERSION >= 3004)
# define ARG_UNUSED(NAME) NAME ATTRIBUTE_UNUSED
#else /* !__cplusplus || GNUC >= 3.4 */
# define ARG_UNUSED(NAME) NAME
#endif /* !__cplusplus || GNUC >= 3.4 */
#ifndef ATTRIBUTE_NORETURN
#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
#endif /* ATTRIBUTE_NORETURN */
/* Attribute `nonnull' was valid as of gcc 3.3. */
#ifndef ATTRIBUTE_NONNULL
# if (GCC_VERSION >= 3003)
# define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))
# else
# define ATTRIBUTE_NONNULL(m)
# endif /* GNUC >= 3.3 */
#endif /* ATTRIBUTE_NONNULL */
/* Attribute `pure' was valid as of gcc 3.0. */
#ifndef ATTRIBUTE_PURE
# if (GCC_VERSION >= 3000)
# define ATTRIBUTE_PURE __attribute__ ((__pure__))
# else
# define ATTRIBUTE_PURE
# endif /* GNUC >= 3.0 */
#endif /* ATTRIBUTE_PURE */
/* Use ATTRIBUTE_PRINTF when the format specifier must not be NULL.
This was the case for the `printf' format attribute by itself
before GCC 3.3, but as of 3.3 we need to add the `nonnull'
attribute to retain this behavior. */
#ifndef ATTRIBUTE_PRINTF
#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m)
#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
#define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5)
#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
#endif /* ATTRIBUTE_PRINTF */
/* Use ATTRIBUTE_FPTR_PRINTF when the format attribute is to be set on
a function pointer. Format attributes were allowed on function
pointers as of gcc 3.1. */
#ifndef ATTRIBUTE_FPTR_PRINTF
# if (GCC_VERSION >= 3001)
# define ATTRIBUTE_FPTR_PRINTF(m, n) ATTRIBUTE_PRINTF(m, n)
# else
# define ATTRIBUTE_FPTR_PRINTF(m, n)
# endif /* GNUC >= 3.1 */
# define ATTRIBUTE_FPTR_PRINTF_1 ATTRIBUTE_FPTR_PRINTF(1, 2)
# define ATTRIBUTE_FPTR_PRINTF_2 ATTRIBUTE_FPTR_PRINTF(2, 3)
# define ATTRIBUTE_FPTR_PRINTF_3 ATTRIBUTE_FPTR_PRINTF(3, 4)
# define ATTRIBUTE_FPTR_PRINTF_4 ATTRIBUTE_FPTR_PRINTF(4, 5)
# define ATTRIBUTE_FPTR_PRINTF_5 ATTRIBUTE_FPTR_PRINTF(5, 6)
#endif /* ATTRIBUTE_FPTR_PRINTF */
/* Use ATTRIBUTE_NULL_PRINTF when the format specifier may be NULL. A
NULL format specifier was allowed as of gcc 3.3. */
#ifndef ATTRIBUTE_NULL_PRINTF
# if (GCC_VERSION >= 3003)
# define ATTRIBUTE_NULL_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
# else
# define ATTRIBUTE_NULL_PRINTF(m, n)
# endif /* GNUC >= 3.3 */
# define ATTRIBUTE_NULL_PRINTF_1 ATTRIBUTE_NULL_PRINTF(1, 2)
# define ATTRIBUTE_NULL_PRINTF_2 ATTRIBUTE_NULL_PRINTF(2, 3)
# define ATTRIBUTE_NULL_PRINTF_3 ATTRIBUTE_NULL_PRINTF(3, 4)
# define ATTRIBUTE_NULL_PRINTF_4 ATTRIBUTE_NULL_PRINTF(4, 5)
# define ATTRIBUTE_NULL_PRINTF_5 ATTRIBUTE_NULL_PRINTF(5, 6)
#endif /* ATTRIBUTE_NULL_PRINTF */
/* Attribute `sentinel' was valid as of gcc 3.5. */
#ifndef ATTRIBUTE_SENTINEL
# if (GCC_VERSION >= 3005)
# define ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__))
# else
# define ATTRIBUTE_SENTINEL
# endif /* GNUC >= 3.5 */
#endif /* ATTRIBUTE_SENTINEL */
#ifndef ATTRIBUTE_ALIGNED_ALIGNOF
# if (GCC_VERSION >= 3000)
# define ATTRIBUTE_ALIGNED_ALIGNOF(m) __attribute__ ((__aligned__ (__alignof__ (m))))
# else
# define ATTRIBUTE_ALIGNED_ALIGNOF(m)
# endif /* GNUC >= 3.0 */
#endif /* ATTRIBUTE_ALIGNED_ALIGNOF */
/* We use __extension__ in some places to suppress -pedantic warnings
about GCC extensions. This feature didn't work properly before
gcc 2.8. */
#if GCC_VERSION < 2008
#define __extension__
#endif
#endif /* ansidecl.h */

View File

@ -0,0 +1,545 @@
/* Defs for interface to demanglers.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002,
2003, 2004, 2005, 2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License
as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
In addition to the permissions in the GNU Library General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file into
combinations with other programs, and to distribute those
combinations without any restriction coming from the use of this
file. (The Library Public License restrictions do apply in other
respects; for example, they cover modification of the file, and
distribution when not linked into a combined executable.)
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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
#if !defined (DEMANGLE_H)
#define DEMANGLE_H
#include "libiberty.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Options passed to cplus_demangle (in 2nd parameter). */
#define DMGL_NO_OPTS 0 /* For readability... */
#define DMGL_PARAMS (1 << 0) /* Include function args */
#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */
#define DMGL_JAVA (1 << 2) /* Demangle as Java rather than C++. */
#define DMGL_VERBOSE (1 << 3) /* Include implementation details. */
#define DMGL_TYPES (1 << 4) /* Also try to demangle type encodings. */
#define DMGL_RET_POSTFIX (1 << 5) /* Print function return types (when
present) after function signature */
#define DMGL_AUTO (1 << 8)
#define DMGL_GNU (1 << 9)
#define DMGL_LUCID (1 << 10)
#define DMGL_ARM (1 << 11)
#define DMGL_HP (1 << 12) /* For the HP aCC compiler;
same as ARM except for
template arguments, etc. */
#define DMGL_EDG (1 << 13)
#define DMGL_GNU_V3 (1 << 14)
#define DMGL_GNAT (1 << 15)
/* If none of these are set, use 'current_demangling_style' as the default. */
#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT)
/* Enumeration of possible demangling styles.
Lucid and ARM styles are still kept logically distinct, even though
they now both behave identically. The resulting style is actual the
union of both. I.E. either style recognizes both "__pt__" and "__rf__"
for operator "->", even though the first is lucid style and the second
is ARM style. (FIXME?) */
extern enum demangling_styles
{
no_demangling = -1,
unknown_demangling = 0,
auto_demangling = DMGL_AUTO,
gnu_demangling = DMGL_GNU,
lucid_demangling = DMGL_LUCID,
arm_demangling = DMGL_ARM,
hp_demangling = DMGL_HP,
edg_demangling = DMGL_EDG,
gnu_v3_demangling = DMGL_GNU_V3,
java_demangling = DMGL_JAVA,
gnat_demangling = DMGL_GNAT
} current_demangling_style;
/* Define string names for the various demangling styles. */
#define NO_DEMANGLING_STYLE_STRING "none"
#define AUTO_DEMANGLING_STYLE_STRING "auto"
#define GNU_DEMANGLING_STYLE_STRING "gnu"
#define LUCID_DEMANGLING_STYLE_STRING "lucid"
#define ARM_DEMANGLING_STYLE_STRING "arm"
#define HP_DEMANGLING_STYLE_STRING "hp"
#define EDG_DEMANGLING_STYLE_STRING "edg"
#define GNU_V3_DEMANGLING_STYLE_STRING "gnu-v3"
#define JAVA_DEMANGLING_STYLE_STRING "java"
#define GNAT_DEMANGLING_STYLE_STRING "gnat"
/* Some macros to test what demangling style is active. */
#define CURRENT_DEMANGLING_STYLE current_demangling_style
#define AUTO_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_AUTO)
#define GNU_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU)
#define LUCID_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_LUCID)
#define ARM_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_ARM)
#define HP_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_HP)
#define EDG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_EDG)
#define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3)
#define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA)
#define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT)
/* Provide information about the available demangle styles. This code is
pulled from gdb into libiberty because it is useful to binutils also. */
extern const struct demangler_engine
{
const char *const demangling_style_name;
const enum demangling_styles demangling_style;
const char *const demangling_style_doc;
} libiberty_demanglers[];
extern char *
cplus_demangle (const char *mangled, int options);
extern int
cplus_demangle_opname (const char *opname, char *result, int options);
extern const char *
cplus_mangle_opname (const char *opname, int options);
/* Note: This sets global state. FIXME if you care about multi-threading. */
extern void
set_cplus_marker_for_demangling (int ch);
extern enum demangling_styles
cplus_demangle_set_style (enum demangling_styles style);
extern enum demangling_styles
cplus_demangle_name_to_style (const char *name);
/* V3 ABI demangling entry points, defined in cp-demangle.c. */
extern char*
cplus_demangle_v3 (const char* mangled, int options);
extern char*
java_demangle_v3 (const char* mangled);
enum gnu_v3_ctor_kinds {
gnu_v3_complete_object_ctor = 1,
gnu_v3_base_object_ctor,
gnu_v3_complete_object_allocating_ctor
};
/* Return non-zero iff NAME is the mangled form of a constructor name
in the G++ V3 ABI demangling style. Specifically, return an `enum
gnu_v3_ctor_kinds' value indicating what kind of constructor
it is. */
extern enum gnu_v3_ctor_kinds
is_gnu_v3_mangled_ctor (const char *name);
enum gnu_v3_dtor_kinds {
gnu_v3_deleting_dtor = 1,
gnu_v3_complete_object_dtor,
gnu_v3_base_object_dtor
};
/* Return non-zero iff NAME is the mangled form of a destructor name
in the G++ V3 ABI demangling style. Specifically, return an `enum
gnu_v3_dtor_kinds' value, indicating what kind of destructor
it is. */
extern enum gnu_v3_dtor_kinds
is_gnu_v3_mangled_dtor (const char *name);
/* The V3 demangler works in two passes. The first pass builds a tree
representation of the mangled name, and the second pass turns the
tree representation into a demangled string. Here we define an
interface to permit a caller to build their own tree
representation, which they can pass to the demangler to get a
demangled string. This can be used to canonicalize user input into
something which the demangler might output. It could also be used
by other demanglers in the future. */
/* These are the component types which may be found in the tree. Many
component types have one or two subtrees, referred to as left and
right (a component type with only one subtree puts it in the left
subtree). */
enum demangle_component_type
{
/* A name, with a length and a pointer to a string. */
DEMANGLE_COMPONENT_NAME,
/* A qualified name. The left subtree is a class or namespace or
some such thing, and the right subtree is a name qualified by
that class. */
DEMANGLE_COMPONENT_QUAL_NAME,
/* A local name. The left subtree describes a function, and the
right subtree is a name which is local to that function. */
DEMANGLE_COMPONENT_LOCAL_NAME,
/* A typed name. The left subtree is a name, and the right subtree
describes that name as a function. */
DEMANGLE_COMPONENT_TYPED_NAME,
/* A template. The left subtree is a template name, and the right
subtree is a template argument list. */
DEMANGLE_COMPONENT_TEMPLATE,
/* A template parameter. This holds a number, which is the template
parameter index. */
DEMANGLE_COMPONENT_TEMPLATE_PARAM,
/* A constructor. This holds a name and the kind of
constructor. */
DEMANGLE_COMPONENT_CTOR,
/* A destructor. This holds a name and the kind of destructor. */
DEMANGLE_COMPONENT_DTOR,
/* A vtable. This has one subtree, the type for which this is a
vtable. */
DEMANGLE_COMPONENT_VTABLE,
/* A VTT structure. This has one subtree, the type for which this
is a VTT. */
DEMANGLE_COMPONENT_VTT,
/* A construction vtable. The left subtree is the type for which
this is a vtable, and the right subtree is the derived type for
which this vtable is built. */
DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE,
/* A typeinfo structure. This has one subtree, the type for which
this is the tpeinfo structure. */
DEMANGLE_COMPONENT_TYPEINFO,
/* A typeinfo name. This has one subtree, the type for which this
is the typeinfo name. */
DEMANGLE_COMPONENT_TYPEINFO_NAME,
/* A typeinfo function. This has one subtree, the type for which
this is the tpyeinfo function. */
DEMANGLE_COMPONENT_TYPEINFO_FN,
/* A thunk. This has one subtree, the name for which this is a
thunk. */
DEMANGLE_COMPONENT_THUNK,
/* A virtual thunk. This has one subtree, the name for which this
is a virtual thunk. */
DEMANGLE_COMPONENT_VIRTUAL_THUNK,
/* A covariant thunk. This has one subtree, the name for which this
is a covariant thunk. */
DEMANGLE_COMPONENT_COVARIANT_THUNK,
/* A Java class. This has one subtree, the type. */
DEMANGLE_COMPONENT_JAVA_CLASS,
/* A guard variable. This has one subtree, the name for which this
is a guard variable. */
DEMANGLE_COMPONENT_GUARD,
/* A reference temporary. This has one subtree, the name for which
this is a temporary. */
DEMANGLE_COMPONENT_REFTEMP,
/* A hidden alias. This has one subtree, the encoding for which it
is providing alternative linkage. */
DEMANGLE_COMPONENT_HIDDEN_ALIAS,
/* A standard substitution. This holds the name of the
substitution. */
DEMANGLE_COMPONENT_SUB_STD,
/* The restrict qualifier. The one subtree is the type which is
being qualified. */
DEMANGLE_COMPONENT_RESTRICT,
/* The volatile qualifier. The one subtree is the type which is
being qualified. */
DEMANGLE_COMPONENT_VOLATILE,
/* The const qualifier. The one subtree is the type which is being
qualified. */
DEMANGLE_COMPONENT_CONST,
/* The restrict qualifier modifying a member function. The one
subtree is the type which is being qualified. */
DEMANGLE_COMPONENT_RESTRICT_THIS,
/* The volatile qualifier modifying a member function. The one
subtree is the type which is being qualified. */
DEMANGLE_COMPONENT_VOLATILE_THIS,
/* The const qualifier modifying a member function. The one subtree
is the type which is being qualified. */
DEMANGLE_COMPONENT_CONST_THIS,
/* A vendor qualifier. The left subtree is the type which is being
qualified, and the right subtree is the name of the
qualifier. */
DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL,
/* A pointer. The one subtree is the type which is being pointed
to. */
DEMANGLE_COMPONENT_POINTER,
/* A reference. The one subtree is the type which is being
referenced. */
DEMANGLE_COMPONENT_REFERENCE,
/* A complex type. The one subtree is the base type. */
DEMANGLE_COMPONENT_COMPLEX,
/* An imaginary type. The one subtree is the base type. */
DEMANGLE_COMPONENT_IMAGINARY,
/* A builtin type. This holds the builtin type information. */
DEMANGLE_COMPONENT_BUILTIN_TYPE,
/* A vendor's builtin type. This holds the name of the type. */
DEMANGLE_COMPONENT_VENDOR_TYPE,
/* A function type. The left subtree is the return type. The right
subtree is a list of ARGLIST nodes. Either or both may be
NULL. */
DEMANGLE_COMPONENT_FUNCTION_TYPE,
/* An array type. The left subtree is the dimension, which may be
NULL, or a string (represented as DEMANGLE_COMPONENT_NAME), or an
expression. The right subtree is the element type. */
DEMANGLE_COMPONENT_ARRAY_TYPE,
/* A pointer to member type. The left subtree is the class type,
and the right subtree is the member type. CV-qualifiers appear
on the latter. */
DEMANGLE_COMPONENT_PTRMEM_TYPE,
/* An argument list. The left subtree is the current argument, and
the right subtree is either NULL or another ARGLIST node. */
DEMANGLE_COMPONENT_ARGLIST,
/* A template argument list. The left subtree is the current
template argument, and the right subtree is either NULL or
another TEMPLATE_ARGLIST node. */
DEMANGLE_COMPONENT_TEMPLATE_ARGLIST,
/* An operator. This holds information about a standard
operator. */
DEMANGLE_COMPONENT_OPERATOR,
/* An extended operator. This holds the number of arguments, and
the name of the extended operator. */
DEMANGLE_COMPONENT_EXTENDED_OPERATOR,
/* A typecast, represented as a unary operator. The one subtree is
the type to which the argument should be cast. */
DEMANGLE_COMPONENT_CAST,
/* A unary expression. The left subtree is the operator, and the
right subtree is the single argument. */
DEMANGLE_COMPONENT_UNARY,
/* A binary expression. The left subtree is the operator, and the
right subtree is a BINARY_ARGS. */
DEMANGLE_COMPONENT_BINARY,
/* Arguments to a binary expression. The left subtree is the first
argument, and the right subtree is the second argument. */
DEMANGLE_COMPONENT_BINARY_ARGS,
/* A trinary expression. The left subtree is the operator, and the
right subtree is a TRINARY_ARG1. */
DEMANGLE_COMPONENT_TRINARY,
/* Arguments to a trinary expression. The left subtree is the first
argument, and the right subtree is a TRINARY_ARG2. */
DEMANGLE_COMPONENT_TRINARY_ARG1,
/* More arguments to a trinary expression. The left subtree is the
second argument, and the right subtree is the third argument. */
DEMANGLE_COMPONENT_TRINARY_ARG2,
/* A literal. The left subtree is the type, and the right subtree
is the value, represented as a DEMANGLE_COMPONENT_NAME. */
DEMANGLE_COMPONENT_LITERAL,
/* A negative literal. Like LITERAL, but the value is negated.
This is a minor hack: the NAME used for LITERAL points directly
to the mangled string, but since negative numbers are mangled
using 'n' instead of '-', we want a way to indicate a negative
number which involves neither modifying the mangled string nor
allocating a new copy of the literal in memory. */
DEMANGLE_COMPONENT_LITERAL_NEG
};
/* Types which are only used internally. */
struct demangle_operator_info;
struct demangle_builtin_type_info;
/* A node in the tree representation is an instance of a struct
demangle_component. Note that the field names of the struct are
not well protected against macros defined by the file including
this one. We can fix this if it ever becomes a problem. */
struct demangle_component
{
/* The type of this component. */
enum demangle_component_type type;
union
{
/* For DEMANGLE_COMPONENT_NAME. */
struct
{
/* A pointer to the name (which need not NULL terminated) and
its length. */
const char *s;
int len;
} s_name;
/* For DEMANGLE_COMPONENT_OPERATOR. */
struct
{
/* Operator. */
const struct demangle_operator_info *op;
} s_operator;
/* For DEMANGLE_COMPONENT_EXTENDED_OPERATOR. */
struct
{
/* Number of arguments. */
int args;
/* Name. */
struct demangle_component *name;
} s_extended_operator;
/* For DEMANGLE_COMPONENT_CTOR. */
struct
{
/* Kind of constructor. */
enum gnu_v3_ctor_kinds kind;
/* Name. */
struct demangle_component *name;
} s_ctor;
/* For DEMANGLE_COMPONENT_DTOR. */
struct
{
/* Kind of destructor. */
enum gnu_v3_dtor_kinds kind;
/* Name. */
struct demangle_component *name;
} s_dtor;
/* For DEMANGLE_COMPONENT_BUILTIN_TYPE. */
struct
{
/* Builtin type. */
const struct demangle_builtin_type_info *type;
} s_builtin;
/* For DEMANGLE_COMPONENT_SUB_STD. */
struct
{
/* Standard substitution string. */
const char* string;
/* Length of string. */
int len;
} s_string;
/* For DEMANGLE_COMPONENT_TEMPLATE_PARAM. */
struct
{
/* Template parameter index. */
long number;
} s_number;
/* For other types. */
struct
{
/* Left (or only) subtree. */
struct demangle_component *left;
/* Right subtree. */
struct demangle_component *right;
} s_binary;
} u;
};
/* People building mangled trees are expected to allocate instances of
struct demangle_component themselves. They can then call one of
the following functions to fill them in. */
/* Fill in most component types with a left subtree and a right
subtree. Returns non-zero on success, zero on failure, such as an
unrecognized or inappropriate component type. */
extern int
cplus_demangle_fill_component (struct demangle_component *fill,
enum demangle_component_type,
struct demangle_component *left,
struct demangle_component *right);
/* Fill in a DEMANGLE_COMPONENT_NAME. Returns non-zero on success,
zero for bad arguments. */
extern int
cplus_demangle_fill_name (struct demangle_component *fill,
const char *, int);
/* Fill in a DEMANGLE_COMPONENT_BUILTIN_TYPE, using the name of the
builtin type (e.g., "int", etc.). Returns non-zero on success,
zero if the type is not recognized. */
extern int
cplus_demangle_fill_builtin_type (struct demangle_component *fill,
const char *type_name);
/* Fill in a DEMANGLE_COMPONENT_OPERATOR, using the name of the
operator and the number of arguments which it takes (the latter is
used to disambiguate operators which can be both binary and unary,
such as '-'). Returns non-zero on success, zero if the operator is
not recognized. */
extern int
cplus_demangle_fill_operator (struct demangle_component *fill,
const char *opname, int args);
/* Fill in a DEMANGLE_COMPONENT_EXTENDED_OPERATOR, providing the
number of arguments and the name. Returns non-zero on success,
zero for bad arguments. */
extern int
cplus_demangle_fill_extended_operator (struct demangle_component *fill,
int numargs,
struct demangle_component *nm);
/* Fill in a DEMANGLE_COMPONENT_CTOR. Returns non-zero on success,
zero for bad arguments. */
extern int
cplus_demangle_fill_ctor (struct demangle_component *fill,
enum gnu_v3_ctor_kinds kind,
struct demangle_component *name);
/* Fill in a DEMANGLE_COMPONENT_DTOR. Returns non-zero on success,
zero for bad arguments. */
extern int
cplus_demangle_fill_dtor (struct demangle_component *fill,
enum gnu_v3_dtor_kinds kind,
struct demangle_component *name);
/* This function translates a mangled name into a struct
demangle_component tree. The first argument is the mangled name.
The second argument is DMGL_* options. This returns a pointer to a
tree on success, or NULL on failure. On success, the third
argument is set to a block of memory allocated by malloc. This
block should be passed to free when the tree is no longer
needed. */
extern struct demangle_component *
cplus_demangle_v3_components (const char *mangled, int options, void **mem);
/* This function takes a struct demangle_component tree and returns
the corresponding demangled string. The first argument is DMGL_*
options. The second is the tree to demangle. The third is a guess
at the length of the demangled string, used to initially allocate
the return buffer. The fourth is a pointer to a size_t. On
success, this function returns a buffer allocated by malloc(), and
sets the size_t pointed to by the fourth argument to the size of
the allocated buffer (not the length of the returned string). On
failure, this function returns NULL, and sets the size_t pointed to
by the fourth argument to 0 for an invalid tree, or to 1 for a
memory allocation error. */
extern char *
cplus_demangle_print (int options,
const struct demangle_component *tree,
int estimated_length,
size_t *p_allocated_size);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* DEMANGLE_H */

View File

@ -0,0 +1,60 @@
/* An abstract string datatype.
Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
Contributed by Mark Mitchell (mark@markmitchell.com).
This file is part of GCC.
GCC 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.
GCC 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 GCC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
typedef struct dyn_string
{
int allocated; /* The amount of space allocated for the string. */
int length; /* The actual length of the string. */
char *s; /* The string itself, NUL-terminated. */
}* dyn_string_t;
/* The length STR, in bytes, not including the terminating NUL. */
#define dyn_string_length(STR) \
((STR)->length)
/* The NTBS in which the contents of STR are stored. */
#define dyn_string_buf(STR) \
((STR)->s)
/* Compare DS1 to DS2 with strcmp. */
#define dyn_string_compare(DS1, DS2) \
(strcmp ((DS1)->s, (DS2)->s))
extern int dyn_string_init (struct dyn_string *, int);
extern dyn_string_t dyn_string_new (int);
extern void dyn_string_delete (dyn_string_t);
extern char *dyn_string_release (dyn_string_t);
extern dyn_string_t dyn_string_resize (dyn_string_t, int);
extern void dyn_string_clear (dyn_string_t);
extern int dyn_string_copy (dyn_string_t, dyn_string_t);
extern int dyn_string_copy_cstr (dyn_string_t, const char *);
extern int dyn_string_prepend (dyn_string_t, dyn_string_t);
extern int dyn_string_prepend_cstr (dyn_string_t, const char *);
extern int dyn_string_insert (dyn_string_t, int, dyn_string_t);
extern int dyn_string_insert_cstr (dyn_string_t, int, const char *);
extern int dyn_string_insert_char (dyn_string_t, int, int);
extern int dyn_string_append (dyn_string_t, dyn_string_t);
extern int dyn_string_append_cstr (dyn_string_t, const char *);
extern int dyn_string_append_char (dyn_string_t, int);
extern int dyn_string_substring (dyn_string_t, dyn_string_t, int, int);
extern int dyn_string_eq (dyn_string_t, dyn_string_t);

View File

@ -0,0 +1,86 @@
/* A Fibonacci heap datatype.
Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Daniel Berlin (dan@cgsoftware.com).
This file is part of GCC.
GCC 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.
GCC 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 GCC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
/* Fibonacci heaps are somewhat complex, but, there's an article in
DDJ that explains them pretty well:
http://www.ddj.com/articles/1997/9701/9701o/9701o.htm?topic=algoritms
Introduction to algorithms by Corman and Rivest also goes over them.
The original paper that introduced them is "Fibonacci heaps and their
uses in improved network optimization algorithms" by Tarjan and
Fredman (JACM 34(3), July 1987).
Amortized and real worst case time for operations:
ExtractMin: O(lg n) amortized. O(n) worst case.
DecreaseKey: O(1) amortized. O(lg n) worst case.
Insert: O(2) amortized. O(1) actual.
Union: O(1) amortized. O(1) actual. */
#ifndef _FIBHEAP_H_
#define _FIBHEAP_H_
#include "ansidecl.h"
typedef long fibheapkey_t;
typedef struct fibheap
{
size_t nodes;
struct fibnode *min;
struct fibnode *root;
} *fibheap_t;
typedef struct fibnode
{
struct fibnode *parent;
struct fibnode *child;
struct fibnode *left;
struct fibnode *right;
fibheapkey_t key;
void *data;
#if defined (__GNUC__) && (!defined (SIZEOF_INT) || SIZEOF_INT < 4)
__extension__ unsigned long int degree : 31;
__extension__ unsigned long int mark : 1;
#else
unsigned int degree : 31;
unsigned int mark : 1;
#endif
} *fibnode_t;
extern fibheap_t fibheap_new (void);
extern fibnode_t fibheap_insert (fibheap_t, fibheapkey_t, void *);
extern int fibheap_empty (fibheap_t);
extern fibheapkey_t fibheap_min_key (fibheap_t);
extern fibheapkey_t fibheap_replace_key (fibheap_t, fibnode_t,
fibheapkey_t);
extern void *fibheap_replace_key_data (fibheap_t, fibnode_t,
fibheapkey_t, void *);
extern void *fibheap_extract_min (fibheap_t);
extern void *fibheap_min (fibheap_t);
extern void *fibheap_replace_data (fibheap_t, fibnode_t, void *);
extern void *fibheap_delete_node (fibheap_t, fibnode_t);
extern void fibheap_delete (fibheap_t);
extern fibheap_t fibheap_union (fibheap_t, fibheap_t);
#endif /* _FIBHEAP_H_ */

View File

@ -0,0 +1,51 @@
/* Macros for taking apart, interpreting and processing file names.
These are here because some non-Posix (a.k.a. DOSish) systems have
drive letter brain-damage at the beginning of an absolute file name,
use forward- and back-slash in path names interchangeably, and
some of them have case-insensitive file names.
Copyright 2000, 2001 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef FILENAMES_H
#define FILENAMES_H
#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__)
#ifndef HAVE_DOS_BASED_FILE_SYSTEM
#define HAVE_DOS_BASED_FILE_SYSTEM 1
#endif
#define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\')
/* Note that IS_ABSOLUTE_PATH accepts d:foo as well, although it is
only semi-absolute. This is because the users of IS_ABSOLUTE_PATH
want to know whether to prepend the current working directory to
a file name, which should not be done with a name like d:foo. */
#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (((f)[0]) && ((f)[1] == ':')))
#define FILENAME_CMP(s1, s2) strcasecmp(s1, s2)
#else /* not DOSish */
#define IS_DIR_SEPARATOR(c) ((c) == '/')
#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]))
#define FILENAME_CMP(s1, s2) strcmp(s1, s2)
#endif /* not DOSish */
#endif /* FILENAMES_H */

View File

@ -0,0 +1,140 @@
/* IEEE floating point support declarations, for GDB, the GNU Debugger.
Copyright 1991, 1994, 1995, 1997, 2000, 2003, 2005
Free Software Foundation, Inc.
This file is part of GDB.
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#if !defined (FLOATFORMAT_H)
#define FLOATFORMAT_H 1
#include "ansidecl.h"
/* A floatformat consists of a sign bit, an exponent and a mantissa. Once the
bytes are concatenated according to the byteorder flag, then each of those
fields is contiguous. We number the bits with 0 being the most significant
(i.e. BITS_BIG_ENDIAN type numbering), and specify which bits each field
contains with the *_start and *_len fields. */
/* What is the order of the bytes? */
enum floatformat_byteorders {
/* Standard little endian byte order.
EX: 1.2345678e10 => 00 00 80 c5 e0 fe 06 42 */
floatformat_little,
/* Standard big endian byte order.
EX: 1.2345678e10 => 42 06 fe e0 c5 80 00 00 */
floatformat_big,
/* Little endian byte order but big endian word order.
EX: 1.2345678e10 => e0 fe 06 42 00 00 80 c5 */
floatformat_littlebyte_bigword,
/* VAX byte order. Little endian byte order with 16-bit words. The
following example is an illustration of the byte order only; VAX
doesn't have a fully IEEE compliant floating-point format.
EX: 1.2345678e10 => 80 c5 00 00 06 42 e0 fe */
floatformat_vax
};
enum floatformat_intbit { floatformat_intbit_yes, floatformat_intbit_no };
struct floatformat
{
enum floatformat_byteorders byteorder;
unsigned int totalsize; /* Total size of number in bits */
/* Sign bit is always one bit long. 1 means negative, 0 means positive. */
unsigned int sign_start;
unsigned int exp_start;
unsigned int exp_len;
/* Bias added to a "true" exponent to form the biased exponent. It
is intentionally signed as, otherwize, -exp_bias can turn into a
very large number (e.g., given the exp_bias of 0x3fff and a 64
bit long, the equation (long)(1 - exp_bias) evaluates to
4294950914) instead of -16382). */
int exp_bias;
/* Exponent value which indicates NaN. This is the actual value stored in
the float, not adjusted by the exp_bias. This usually consists of all
one bits. */
unsigned int exp_nan;
unsigned int man_start;
unsigned int man_len;
/* Is the integer bit explicit or implicit? */
enum floatformat_intbit intbit;
/* Internal name for debugging. */
const char *name;
/* Validator method. */
int (*is_valid) (const struct floatformat *fmt, const void *from);
};
/* floatformats for IEEE single and double, big and little endian. */
extern const struct floatformat floatformat_ieee_single_big;
extern const struct floatformat floatformat_ieee_single_little;
extern const struct floatformat floatformat_ieee_double_big;
extern const struct floatformat floatformat_ieee_double_little;
/* floatformat for ARM IEEE double, little endian bytes and big endian words */
extern const struct floatformat floatformat_ieee_double_littlebyte_bigword;
/* floatformats for VAX. */
extern const struct floatformat floatformat_vax_f;
extern const struct floatformat floatformat_vax_d;
extern const struct floatformat floatformat_vax_g;
/* floatformats for various extendeds. */
extern const struct floatformat floatformat_i387_ext;
extern const struct floatformat floatformat_m68881_ext;
extern const struct floatformat floatformat_i960_ext;
extern const struct floatformat floatformat_m88110_ext;
extern const struct floatformat floatformat_m88110_harris_ext;
extern const struct floatformat floatformat_arm_ext_big;
extern const struct floatformat floatformat_arm_ext_littlebyte_bigword;
/* IA-64 Floating Point register spilt into memory. */
extern const struct floatformat floatformat_ia64_spill_big;
extern const struct floatformat floatformat_ia64_spill_little;
extern const struct floatformat floatformat_ia64_quad_big;
extern const struct floatformat floatformat_ia64_quad_little;
/* Convert from FMT to a double.
FROM is the address of the extended float.
Store the double in *TO. */
extern void
floatformat_to_double (const struct floatformat *, const void *, double *);
/* The converse: convert the double *FROM to FMT
and store where TO points. */
extern void
floatformat_from_double (const struct floatformat *, const double *, void *);
/* Return non-zero iff the data at FROM is a valid number in format FMT. */
extern int
floatformat_is_valid (const struct floatformat *fmt, const void *from);
#endif /* defined (FLOATFORMAT_H) */

View File

@ -0,0 +1,70 @@
/* Copyright 1991, 1992, 1993, 1996 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
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, write to the Free Software
Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
#ifndef _FNMATCH_H
#define _FNMATCH_H 1
#ifdef __cplusplus
extern "C" {
#endif
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
#undef __P
#define __P(args) args
#else /* Not C++ or ANSI C. */
#undef __P
#define __P(args) ()
/* We can get away without defining `const' here only because in this file
it is used only inside the prototype for `fnmatch', which is elided in
non-ANSI C where `const' is problematical. */
#endif /* C++ or ANSI C. */
/* We #undef these before defining them because some losing systems
(HP-UX A.08.07 for example) define these in <unistd.h>. */
#undef FNM_PATHNAME
#undef FNM_NOESCAPE
#undef FNM_PERIOD
/* Bits set in the FLAGS argument to `fnmatch'. */
#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */
#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */
#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE)
#define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
#define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */
#define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
#endif
/* Value returned by `fnmatch' if STRING does not match PATTERN. */
#define FNM_NOMATCH 1
/* Match STRING against the filename pattern PATTERN,
returning zero if it matches, FNM_NOMATCH if not. */
extern int fnmatch __P ((const char *__pattern, const char *__string,
int __flags));
#ifdef __cplusplus
}
#endif
#endif /* fnmatch.h */

View File

@ -0,0 +1,144 @@
/* Declarations for getopt.
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 2000,
2002 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org.
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, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
USA. */
#ifndef _GETOPT_H
#define _GETOPT_H 1
#ifdef __cplusplus
extern "C" {
#endif
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
extern int opterr;
/* Set to an option character which was unrecognized. */
extern int optopt;
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
zero.
The field `has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to
a compiled-in constant, such as set a value from `optarg', set the
option's `flag' field to zero and its `val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
struct option
{
#if defined (__STDC__) && __STDC__
const char *name;
#else
char *name;
#endif
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the `has_arg' field of `struct option'. */
#define no_argument 0
#define required_argument 1
#define optional_argument 2
#if defined (__STDC__) && __STDC__
/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is
undefined, we haven't run the autoconf check so provide the
declaration without arguments. If it is 0, we checked and failed
to find the declaration so provide a fully prototyped one. If it
is 1, we found it so don't provide any declaration at all. */
#if !HAVE_DECL_GETOPT
#if defined (__GNU_LIBRARY__) || defined (HAVE_DECL_GETOPT)
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in unistd.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else
#ifndef __cplusplus
extern int getopt ();
#endif /* __cplusplus */
#endif
#endif /* !HAVE_DECL_GETOPT */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
extern int getopt_long_only (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind);
/* Internal only. Users should not call this directly. */
extern int _getopt_internal (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind,
int long_only);
#else /* not __STDC__ */
extern int getopt ();
extern int getopt_long ();
extern int getopt_long_only ();
extern int _getopt_internal ();
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* getopt.h */

View File

@ -0,0 +1,206 @@
/* An expandable hash tables datatype.
Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Vladimir Makarov (vmakarov@cygnus.com).
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This package implements basic hash table functionality. It is possible
to search for an entry, create an entry and destroy an entry.
Elements in the table are generic pointers.
The size of the table is not fixed; if the occupancy of the table
grows too high the hash table will be expanded.
The abstract data implementation is based on generalized Algorithm D
from Knuth's book "The art of computer programming". Hash table is
expanded by creation of new hash table and transferring elements from
the old table to the new table. */
#ifndef __HASHTAB_H__
#define __HASHTAB_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "ansidecl.h"
#ifndef GTY
#define GTY(X)
#endif
/* The type for a hash code. */
typedef unsigned int hashval_t;
/* Callback function pointer types. */
/* Calculate hash of a table entry. */
typedef hashval_t (*htab_hash) (const void *);
/* Compare a table entry with a possible entry. The entry already in
the table always comes first, so the second element can be of a
different type (but in this case htab_find and htab_find_slot
cannot be used; instead the variants that accept a hash value
must be used). */
typedef int (*htab_eq) (const void *, const void *);
/* Cleanup function called whenever a live element is removed from
the hash table. */
typedef void (*htab_del) (void *);
/* Function called by htab_traverse for each live element. The first
arg is the slot of the element (which can be passed to htab_clear_slot
if desired), the second arg is the auxiliary pointer handed to
htab_traverse. Return 1 to continue scan, 0 to stop. */
typedef int (*htab_trav) (void **, void *);
/* Memory-allocation function, with the same functionality as calloc().
Iff it returns NULL, the hash table implementation will pass an error
code back to the user, so if your code doesn't handle errors,
best if you use xcalloc instead. */
typedef void *(*htab_alloc) (size_t, size_t);
/* We also need a free() routine. */
typedef void (*htab_free) (void *);
/* Memory allocation and deallocation; variants which take an extra
argument. */
typedef void *(*htab_alloc_with_arg) (void *, size_t, size_t);
typedef void (*htab_free_with_arg) (void *, void *);
/* This macro defines reserved value for empty table entry. */
#define HTAB_EMPTY_ENTRY ((PTR) 0)
/* This macro defines reserved value for table entry which contained
a deleted element. */
#define HTAB_DELETED_ENTRY ((PTR) 1)
/* Hash tables are of the following type. The structure
(implementation) of this type is not needed for using the hash
tables. All work with hash table should be executed only through
functions mentioned below. The size of this structure is subject to
change. */
struct htab GTY(())
{
/* Pointer to hash function. */
htab_hash hash_f;
/* Pointer to comparison function. */
htab_eq eq_f;
/* Pointer to cleanup function. */
htab_del del_f;
/* Table itself. */
void ** GTY ((use_param, length ("%h.size"))) entries;
/* Current size (in entries) of the hash table. */
size_t size;
/* Current number of elements including also deleted elements. */
size_t n_elements;
/* Current number of deleted elements in the table. */
size_t n_deleted;
/* The following member is used for debugging. Its value is number
of all calls of `htab_find_slot' for the hash table. */
unsigned int searches;
/* The following member is used for debugging. Its value is number
of collisions fixed for time of work with the hash table. */
unsigned int collisions;
/* Pointers to allocate/free functions. */
htab_alloc alloc_f;
htab_free free_f;
/* Alternate allocate/free functions, which take an extra argument. */
void * GTY((skip)) alloc_arg;
htab_alloc_with_arg alloc_with_arg_f;
htab_free_with_arg free_with_arg_f;
/* Current size (in entries) of the hash table, as an index into the
table of primes. */
unsigned int size_prime_index;
};
typedef struct htab *htab_t;
/* An enum saying whether we insert into the hash table or not. */
enum insert_option {NO_INSERT, INSERT};
/* The prototypes of the package functions. */
extern htab_t htab_create_alloc (size_t, htab_hash,
htab_eq, htab_del,
htab_alloc, htab_free);
extern htab_t htab_create_alloc_ex (size_t, htab_hash,
htab_eq, htab_del,
void *, htab_alloc_with_arg,
htab_free_with_arg);
/* Backward-compatibility functions. */
extern htab_t htab_create (size_t, htab_hash, htab_eq, htab_del);
extern htab_t htab_try_create (size_t, htab_hash, htab_eq, htab_del);
extern void htab_set_functions_ex (htab_t, htab_hash,
htab_eq, htab_del,
void *, htab_alloc_with_arg,
htab_free_with_arg);
extern void htab_delete (htab_t);
extern void htab_empty (htab_t);
extern void * htab_find (htab_t, const void *);
extern void ** htab_find_slot (htab_t, const void *, enum insert_option);
extern void * htab_find_with_hash (htab_t, const void *, hashval_t);
extern void ** htab_find_slot_with_hash (htab_t, const void *,
hashval_t, enum insert_option);
extern void htab_clear_slot (htab_t, void **);
extern void htab_remove_elt (htab_t, void *);
extern void htab_remove_elt_with_hash (htab_t, void *, hashval_t);
extern void htab_traverse (htab_t, htab_trav, void *);
extern void htab_traverse_noresize (htab_t, htab_trav, void *);
extern size_t htab_size (htab_t);
extern size_t htab_elements (htab_t);
extern double htab_collisions (htab_t);
/* A hash function for pointers. */
extern htab_hash htab_hash_pointer;
/* An equality function for pointers. */
extern htab_eq htab_eq_pointer;
/* A hash function for null-terminated strings. */
extern hashval_t htab_hash_string (const void *);
/* An iterative hash function for arbitrary data. */
extern hashval_t iterative_hash (const void *, size_t, hashval_t);
/* Shorthand for hashing something with an intrinsic size. */
#define iterative_hash_object(OB,INIT) iterative_hash (&OB, sizeof (OB), INIT)
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __HASHTAB_H */

View File

@ -0,0 +1,621 @@
/* Function declarations for libiberty.
Copyright 2001, 2002, 2005 Free Software Foundation, Inc.
Note - certain prototypes declared in this header file are for
functions whoes implementation copyright does not belong to the
FSF. Those prototypes are present in this file for reference
purposes only and their presence in this file should not construed
as an indication of ownership by the FSF of the implementation of
those functions in any way or form whatsoever.
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, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA.
Written by Cygnus Support, 1994.
The libiberty library provides a number of functions which are
missing on some operating systems. We do not declare those here,
to avoid conflicts with the system header files on operating
systems that do support those functions. In this file we only
declare those functions which are specific to libiberty. */
#ifndef LIBIBERTY_H
#define LIBIBERTY_H
#ifdef __cplusplus
extern "C" {
#endif
#include "ansidecl.h"
/* Get a definition for size_t. */
#include <stddef.h>
/* Get a definition for va_list. */
#include <stdarg.h>
#include <stdio.h>
/* If the OS supports it, ensure that the supplied stream is setup to
avoid any multi-threaded locking. Otherwise leave the FILE pointer
unchanged. If the stream is NULL do nothing. */
extern void unlock_stream (FILE *);
/* If the OS supports it, ensure that the standard I/O streams, stdin,
stdout and stderr are setup to avoid any multi-threaded locking.
Otherwise do nothing. */
extern void unlock_std_streams (void);
/* Open and return a FILE pointer. If the OS supports it, ensure that
the stream is setup to avoid any multi-threaded locking. Otherwise
return the FILE pointer unchanged. */
extern FILE *fopen_unlocked (const char *, const char *);
extern FILE *fdopen_unlocked (int, const char *);
extern FILE *freopen_unlocked (const char *, const char *, FILE *);
/* Build an argument vector from a string. Allocates memory using
malloc. Use freeargv to free the vector. */
extern char **buildargv (const char *) ATTRIBUTE_MALLOC;
/* Free a vector returned by buildargv. */
extern void freeargv (char **);
/* Duplicate an argument vector. Allocates memory using malloc. Use
freeargv to free the vector. */
extern char **dupargv (char **) ATTRIBUTE_MALLOC;
/* Expand "@file" arguments in argv. */
extern void expandargv PARAMS ((int *, char ***));
/* Return the last component of a path name. Note that we can't use a
prototype here because the parameter is declared inconsistently
across different systems, sometimes as "char *" and sometimes as
"const char *" */
/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is
undefined, we haven't run the autoconf check so provide the
declaration without arguments. If it is 0, we checked and failed
to find the declaration so provide a fully prototyped one. If it
is 1, we found it so don't provide any declaration at all. */
#if !HAVE_DECL_BASENAME
#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) || defined (HAVE_DECL_BASENAME)
extern char *basename (const char *);
#else
/* Do not allow basename to be used if there is no prototype seen. We
either need to use the above prototype or have one from
autoconf which would result in HAVE_DECL_BASENAME being set. */
#define basename basename_cannot_be_used_without_a_prototype
#endif
#endif
/* A well-defined basename () that is always compiled in. */
extern const char *lbasename (const char *);
/* A well-defined realpath () that is always compiled in. */
extern char *lrealpath (const char *);
/* Concatenate an arbitrary number of strings. You must pass NULL as
the last argument of this function, to terminate the list of
strings. Allocates memory using xmalloc. */
extern char *concat (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_SENTINEL;
/* Concatenate an arbitrary number of strings. You must pass NULL as
the last argument of this function, to terminate the list of
strings. Allocates memory using xmalloc. The first argument is
not one of the strings to be concatenated, but if not NULL is a
pointer to be freed after the new string is created, similar to the
way xrealloc works. */
extern char *reconcat (char *, const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_SENTINEL;
/* Determine the length of concatenating an arbitrary number of
strings. You must pass NULL as the last argument of this function,
to terminate the list of strings. */
extern unsigned long concat_length (const char *, ...) ATTRIBUTE_SENTINEL;
/* Concatenate an arbitrary number of strings into a SUPPLIED area of
memory. You must pass NULL as the last argument of this function,
to terminate the list of strings. The supplied memory is assumed
to be large enough. */
extern char *concat_copy (char *, const char *, ...) ATTRIBUTE_SENTINEL;
/* Concatenate an arbitrary number of strings into a GLOBAL area of
memory. You must pass NULL as the last argument of this function,
to terminate the list of strings. The supplied memory is assumed
to be large enough. */
extern char *concat_copy2 (const char *, ...) ATTRIBUTE_SENTINEL;
/* This is the global area used by concat_copy2. */
extern char *libiberty_concat_ptr;
/* Concatenate an arbitrary number of strings. You must pass NULL as
the last argument of this function, to terminate the list of
strings. Allocates memory using alloca. The arguments are
evaluated twice! */
#define ACONCAT(ACONCAT_PARAMS) \
(libiberty_concat_ptr = (char *) alloca (concat_length ACONCAT_PARAMS + 1), \
concat_copy2 ACONCAT_PARAMS)
/* Check whether two file descriptors refer to the same file. */
extern int fdmatch (int fd1, int fd2);
/* Return the position of the first bit set in the argument. */
/* Prototypes vary from system to system, so we only provide a
prototype on systems where we know that we need it. */
#if defined (HAVE_DECL_FFS) && !HAVE_DECL_FFS
extern int ffs(int);
#endif
/* Get the working directory. The result is cached, so don't call
chdir() between calls to getpwd(). */
extern char * getpwd (void);
/* Get the current time. */
/* Prototypes vary from system to system, so we only provide a
prototype on systems where we know that we need it. */
#ifdef __MINGW32__
/* Forward declaration to avoid #include <sys/time.h>. */
struct timeval;
extern int gettimeofday (struct timeval *, void *);
#endif
/* Get the amount of time the process has run, in microseconds. */
extern long get_run_time (void);
/* Generate a relocated path to some installation directory. Allocates
return value using malloc. */
extern char *make_relative_prefix (const char *, const char *,
const char *) ATTRIBUTE_MALLOC;
/* Choose a temporary directory to use for scratch files. */
extern char *choose_temp_base (void) ATTRIBUTE_MALLOC;
/* Return a temporary file name or NULL if unable to create one. */
extern char *make_temp_file (const char *) ATTRIBUTE_MALLOC;
/* Remove a link to a file unless it is special. */
extern int unlink_if_ordinary (const char *);
/* Allocate memory filled with spaces. Allocates using malloc. */
extern const char *spaces (int count);
/* Return the maximum error number for which strerror will return a
string. */
extern int errno_max (void);
/* Return the name of an errno value (e.g., strerrno (EINVAL) returns
"EINVAL"). */
extern const char *strerrno (int);
/* Given the name of an errno value, return the value. */
extern int strtoerrno (const char *);
/* ANSI's strerror(), but more robust. */
extern char *xstrerror (int);
/* Return the maximum signal number for which strsignal will return a
string. */
extern int signo_max (void);
/* Return a signal message string for a signal number
(e.g., strsignal (SIGHUP) returns something like "Hangup"). */
/* This is commented out as it can conflict with one in system headers.
We still document its existence though. */
/*extern const char *strsignal (int);*/
/* Return the name of a signal number (e.g., strsigno (SIGHUP) returns
"SIGHUP"). */
extern const char *strsigno (int);
/* Given the name of a signal, return its number. */
extern int strtosigno (const char *);
/* Register a function to be run by xexit. Returns 0 on success. */
extern int xatexit (void (*fn) (void));
/* Exit, calling all the functions registered with xatexit. */
extern void xexit (int status) ATTRIBUTE_NORETURN;
/* Set the program name used by xmalloc. */
extern void xmalloc_set_program_name (const char *);
/* Report an allocation failure. */
extern void xmalloc_failed (size_t) ATTRIBUTE_NORETURN;
/* Allocate memory without fail. If malloc fails, this will print a
message to stderr (using the name set by xmalloc_set_program_name,
if any) and then call xexit. */
extern void *xmalloc (size_t) ATTRIBUTE_MALLOC;
/* Reallocate memory without fail. This works like xmalloc. Note,
realloc type functions are not suitable for attribute malloc since
they may return the same address across multiple calls. */
extern void *xrealloc (void *, size_t);
/* Allocate memory without fail and set it to zero. This works like
xmalloc. */
extern void *xcalloc (size_t, size_t) ATTRIBUTE_MALLOC;
/* Copy a string into a memory buffer without fail. */
extern char *xstrdup (const char *) ATTRIBUTE_MALLOC;
/* Copy at most N characters from string into a buffer without fail. */
extern char *xstrndup (const char *, size_t) ATTRIBUTE_MALLOC;
/* Copy an existing memory buffer to a new memory buffer without fail. */
extern void *xmemdup (const void *, size_t, size_t) ATTRIBUTE_MALLOC;
/* Physical memory routines. Return values are in BYTES. */
extern double physmem_total (void);
extern double physmem_available (void);
/* These macros provide a K&R/C89/C++-friendly way of allocating structures
with nice encapsulation. The XDELETE*() macros are technically
superfluous, but provided here for symmetry. Using them consistently
makes it easier to update client code to use different allocators such
as new/delete and new[]/delete[]. */
/* Scalar allocators. */
#define XNEW(T) ((T *) xmalloc (sizeof (T)))
#define XCNEW(T) ((T *) xcalloc (1, sizeof (T)))
#define XDELETE(P) free ((void*) (P))
/* Array allocators. */
#define XNEWVEC(T, N) ((T *) xmalloc (sizeof (T) * (N)))
#define XCNEWVEC(T, N) ((T *) xcalloc ((N), sizeof (T)))
#define XRESIZEVEC(T, P, N) ((T *) xrealloc ((void *) (P), sizeof (T) * (N)))
#define XDELETEVEC(P) free ((void*) (P))
/* Allocators for variable-sized structures and raw buffers. */
#define XNEWVAR(T, S) ((T *) xmalloc ((S)))
#define XCNEWVAR(T, S) ((T *) xcalloc (1, (S)))
#define XRESIZEVAR(T, P, S) ((T *) xrealloc ((P), (S)))
/* Type-safe obstack allocator. */
#define XOBNEW(O, T) ((T *) obstack_alloc ((O), sizeof (T)))
#define XOBFINISH(O, T) ((T) obstack_finish ((O)))
/* hex character manipulation routines */
#define _hex_array_size 256
#define _hex_bad 99
extern const unsigned char _hex_value[_hex_array_size];
extern void hex_init (void);
#define hex_p(c) (hex_value (c) != _hex_bad)
/* If you change this, note well: Some code relies on side effects in
the argument being performed exactly once. */
#define hex_value(c) ((unsigned int) _hex_value[(unsigned char) (c)])
/* Flags for pex_init. These are bits to be or'ed together. */
/* Record subprocess times, if possible. */
#define PEX_RECORD_TIMES 0x1
/* Use pipes for communication between processes, if possible. */
#define PEX_USE_PIPES 0x2
/* Save files used for communication between processes. */
#define PEX_SAVE_TEMPS 0x4
/* Prepare to execute one or more programs, with standard output of
each program fed to standard input of the next.
FLAGS As above.
PNAME The name of the program to report in error messages.
TEMPBASE A base name to use for temporary files; may be NULL to
use a random name.
Returns NULL on error. */
extern struct pex_obj *pex_init (int flags, const char *pname,
const char *tempbase);
/* Flags for pex_run. These are bits to be or'ed together. */
/* Last program in pipeline. Standard output of program goes to
OUTNAME, or, if OUTNAME is NULL, to standard output of caller. Do
not set this if you want to call pex_read_output. After this is
set, pex_run may no longer be called with the same struct
pex_obj. */
#define PEX_LAST 0x1
/* Search for program in executable search path. */
#define PEX_SEARCH 0x2
/* OUTNAME is a suffix. */
#define PEX_SUFFIX 0x4
/* Send program's standard error to standard output. */
#define PEX_STDERR_TO_STDOUT 0x8
/* Input file should be opened in binary mode. This flag is ignored
on Unix. */
#define PEX_BINARY_INPUT 0x10
/* Output file should be opened in binary mode. This flag is ignored
on Unix. For proper behaviour PEX_BINARY_INPUT and
PEX_BINARY_OUTPUT have to match appropriately--i.e., a call using
PEX_BINARY_OUTPUT should be followed by a call using
PEX_BINARY_INPUT. */
#define PEX_BINARY_OUTPUT 0x20
/* Execute one program. Returns NULL on success. On error returns an
error string (typically just the name of a system call); the error
string is statically allocated.
OBJ Returned by pex_init.
FLAGS As above.
EXECUTABLE The program to execute.
ARGV NULL terminated array of arguments to pass to the program.
OUTNAME Sets the output file name as follows:
PEX_SUFFIX set (OUTNAME may not be NULL):
TEMPBASE parameter to pex_init not NULL:
Output file name is the concatenation of TEMPBASE
and OUTNAME.
TEMPBASE is NULL:
Output file name is a random file name ending in
OUTNAME.
PEX_SUFFIX not set:
OUTNAME not NULL:
Output file name is OUTNAME.
OUTNAME NULL, TEMPBASE not NULL:
Output file name is randomly chosen using
TEMPBASE.
OUTNAME NULL, TEMPBASE NULL:
Output file name is randomly chosen.
If PEX_LAST is not set, the output file name is the
name to use for a temporary file holding stdout, if
any (there will not be a file if PEX_USE_PIPES is set
and the system supports pipes). If a file is used, it
will be removed when no longer needed unless
PEX_SAVE_TEMPS is set.
If PEX_LAST is set, and OUTNAME is not NULL, standard
output is written to the output file name. The file
will not be removed. If PEX_LAST and PEX_SUFFIX are
both set, TEMPBASE may not be NULL.
ERRNAME If not NULL, this is the name of a file to which
standard error is written. If NULL, standard error of
the program is standard error of the caller.
ERR On an error return, *ERR is set to an errno value, or
to 0 if there is no relevant errno.
*/
extern const char *pex_run (struct pex_obj *obj, int flags,
const char *executable, char * const *argv,
const char *outname, const char *errname,
int *err);
/* As for pex_run (), but takes an extra parameter to enable the
environment for the child process to be specified.
ENV The environment for the child process, specified as
an array of character pointers. Each element of the
array should point to a string of the form VAR=VALUE,
with the exception of the last element which must be
a null pointer.
*/
extern const char *pex_run_in_environment (struct pex_obj *obj, int flags,
const char *executable,
char * const *argv,
char * const *env,
const char *outname,
const char *errname, int *err);
/* Return a stream for a temporary file to pass to the first program
in the pipeline as input. The file name is chosen as for pex_run.
pex_run closes the file automatically; don't close it yourself. */
extern FILE *pex_input_file (struct pex_obj *obj, int flags,
const char *in_name);
/* Return a stream for a pipe connected to the standard input of the
first program in the pipeline. You must have passed
`PEX_USE_PIPES' to `pex_init'. Close the returned stream
yourself. */
extern FILE *pex_input_pipe (struct pex_obj *obj, int binary);
/* Read the standard output of the last program to be executed.
pex_run can not be called after this. BINARY should be non-zero if
the file should be opened in binary mode; this is ignored on Unix.
Returns NULL on error. Don't call fclose on the returned FILE; it
will be closed by pex_free. */
extern FILE *pex_read_output (struct pex_obj *, int binary);
/* Return exit status of all programs in VECTOR. COUNT indicates the
size of VECTOR. The status codes in the vector are in the order of
the calls to pex_run. Returns 0 on error, 1 on success. */
extern int pex_get_status (struct pex_obj *, int count, int *vector);
/* Return times of all programs in VECTOR. COUNT indicates the size
of VECTOR. struct pex_time is really just struct timeval, but that
is not portable to all systems. Returns 0 on error, 1 on
success. */
struct pex_time
{
unsigned long user_seconds;
unsigned long user_microseconds;
unsigned long system_seconds;
unsigned long system_microseconds;
};
extern int pex_get_times (struct pex_obj *, int count,
struct pex_time *vector);
/* Clean up a pex_obj. */
extern void pex_free (struct pex_obj *);
/* Just execute one program. Return value is as for pex_run.
FLAGS Combination of PEX_SEARCH and PEX_STDERR_TO_STDOUT.
EXECUTABLE As for pex_run.
ARGV As for pex_run.
PNAME As for pex_init.
OUTNAME As for pex_run when PEX_LAST is set.
ERRNAME As for pex_run.
STATUS Set to exit status on success.
ERR As for pex_run.
*/
extern const char *pex_one (int flags, const char *executable,
char * const *argv, const char *pname,
const char *outname, const char *errname,
int *status, int *err);
/* pexecute and pwait are the old pexecute interface, still here for
backward compatibility. Don't use these for new code. Instead,
use pex_init/pex_run/pex_get_status/pex_free, or pex_one. */
/* Definitions used by the pexecute routine. */
#define PEXECUTE_FIRST 1
#define PEXECUTE_LAST 2
#define PEXECUTE_ONE (PEXECUTE_FIRST + PEXECUTE_LAST)
#define PEXECUTE_SEARCH 4
#define PEXECUTE_VERBOSE 8
/* Execute a program. */
extern int pexecute (const char *, char * const *, const char *,
const char *, char **, char **, int);
/* Wait for pexecute to finish. */
extern int pwait (int, int *, int);
#if !HAVE_DECL_ASPRINTF
/* Like sprintf but provides a pointer to malloc'd storage, which must
be freed by the caller. */
extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
#endif
#if !HAVE_DECL_VASPRINTF
/* Like vsprintf but provides a pointer to malloc'd storage, which
must be freed by the caller. */
extern int vasprintf (char **, const char *, va_list) ATTRIBUTE_PRINTF(2,0);
#endif
#if defined(HAVE_DECL_SNPRINTF) && !HAVE_DECL_SNPRINTF
/* Like sprintf but prints at most N characters. */
extern int snprintf (char *, size_t, const char *, ...) ATTRIBUTE_PRINTF_3;
#endif
#if defined(HAVE_DECL_VSNPRINTF) && !HAVE_DECL_VSNPRINTF
/* Like vsprintf but prints at most N characters. */
extern int vsnprintf (char *, size_t, const char *, va_list) ATTRIBUTE_PRINTF(3,0);
#endif
#if defined(HAVE_DECL_STRVERSCMP) && !HAVE_DECL_STRVERSCMP
/* Compare version strings. */
extern int strverscmp (const char *, const char *);
#endif
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
/* Drastically simplified alloca configurator. If we're using GCC,
we use __builtin_alloca; otherwise we use the C alloca. The C
alloca is always available. You can override GCC by defining
USE_C_ALLOCA yourself. The canonical autoconf macro C_ALLOCA is
also set/unset as it is often used to indicate whether code needs
to call alloca(0). */
extern void *C_alloca (size_t) ATTRIBUTE_MALLOC;
#undef alloca
#if GCC_VERSION >= 2000 && !defined USE_C_ALLOCA
# define alloca(x) __builtin_alloca(x)
# undef C_ALLOCA
# define ASTRDUP(X) \
(__extension__ ({ const char *const libiberty_optr = (X); \
const unsigned long libiberty_len = strlen (libiberty_optr) + 1; \
char *const libiberty_nptr = (char *const) alloca (libiberty_len); \
(char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len); }))
#else
# define alloca(x) C_alloca(x)
# undef USE_C_ALLOCA
# define USE_C_ALLOCA 1
# undef C_ALLOCA
# define C_ALLOCA 1
extern const char *libiberty_optr;
extern char *libiberty_nptr;
extern unsigned long libiberty_len;
# define ASTRDUP(X) \
(libiberty_optr = (X), \
libiberty_len = strlen (libiberty_optr) + 1, \
libiberty_nptr = (char *) alloca (libiberty_len), \
(char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len))
#endif
#ifdef __cplusplus
}
#endif
#endif /* ! defined (LIBIBERTY_H) */

View File

@ -0,0 +1,141 @@
/* md5.h - Declaration of functions and data types used for MD5 sum
computing library functions.
Copyright 1995, 1996, 2000 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
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, write to the Free Software Foundation,
Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _MD5_H
#define _MD5_H 1
#include <stdio.h>
#if defined HAVE_LIMITS_H || _LIBC
# include <limits.h>
#endif
#include "ansidecl.h"
/* The following contortions are an attempt to use the C preprocessor
to determine an unsigned integral type that is 32 bits wide. An
alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
doing that would require that the configure script compile and *run*
the resulting executable. Locally running cross-compiled executables
is usually not possible. */
#ifdef _LIBC
# include <sys/types.h>
typedef u_int32_t md5_uint32;
typedef uintptr_t md5_uintptr;
#else
# define INT_MAX_32_BITS 2147483647
/* If UINT_MAX isn't defined, assume it's a 32-bit type.
This should be valid for all systems GNU cares about because
that doesn't include 16-bit systems, and only modern systems
(that certainly have <limits.h>) have 64+-bit integral types. */
# ifndef INT_MAX
# define INT_MAX INT_MAX_32_BITS
# endif
# if INT_MAX == INT_MAX_32_BITS
typedef unsigned int md5_uint32;
# else
# if SHRT_MAX == INT_MAX_32_BITS
typedef unsigned short md5_uint32;
# else
# if LONG_MAX == INT_MAX_32_BITS
typedef unsigned long md5_uint32;
# else
/* The following line is intended to evoke an error.
Using #error is not portable enough. */
"Cannot determine unsigned 32-bit data type."
# endif
# endif
# endif
/* We have to make a guess about the integer type equivalent in size
to pointers which should always be correct. */
typedef unsigned long int md5_uintptr;
#endif
/* Structure to save state of computation between the single steps. */
struct md5_ctx
{
md5_uint32 A;
md5_uint32 B;
md5_uint32 C;
md5_uint32 D;
md5_uint32 total[2];
md5_uint32 buflen;
char buffer[128] ATTRIBUTE_ALIGNED_ALIGNOF(md5_uint32);
};
/*
* The following three functions are build up the low level used in
* the functions `md5_stream' and `md5_buffer'.
*/
/* Initialize structure containing state of computation.
(RFC 1321, 3.3: Step 3) */
extern void md5_init_ctx (struct md5_ctx *ctx);
/* Starting with the result of former calls of this function (or the
initialization function update the context for the next LEN bytes
starting at BUFFER.
It is necessary that LEN is a multiple of 64!!! */
extern void md5_process_block (const void *buffer, size_t len,
struct md5_ctx *ctx);
/* Starting with the result of former calls of this function (or the
initialization function update the context for the next LEN bytes
starting at BUFFER.
It is NOT required that LEN is a multiple of 64. */
extern void md5_process_bytes (const void *buffer, size_t len,
struct md5_ctx *ctx);
/* Process the remaining bytes in the buffer and put result from CTX
in first 16 bytes following RESBUF. The result is always in little
endian byte order, so that a byte-wise output yields to the wanted
ASCII representation of the message digest.
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
extern void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf);
/* Put result from CTX in first 16 bytes following RESBUF. The result is
always in little endian byte order, so that a byte-wise output yields
to the wanted ASCII representation of the message digest.
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
extern void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf);
/* Compute MD5 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */
extern int md5_stream (FILE *stream, void *resblock);
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
extern void *md5_buffer (const char *buffer, size_t len, void *resblock);
#endif

View File

@ -0,0 +1,115 @@
/* objalloc.h -- routines to allocate memory for objects
Copyright 1997, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Solutions.
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, write to the Free Software
Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
#ifndef OBJALLOC_H
#define OBJALLOC_H
#include "ansidecl.h"
/* These routines allocate space for an object. The assumption is
that the object will want to allocate space as it goes along, but
will never want to free any particular block. There is a function
to free a block, which also frees all more recently allocated
blocks. There is also a function to free all the allocated space.
This is essentially a specialization of obstacks. The main
difference is that a block may not be allocated a bit at a time.
Another difference is that these routines are always built on top
of malloc, and always pass an malloc failure back to the caller,
unlike more recent versions of obstacks. */
/* This is what an objalloc structure looks like. Callers should not
refer to these fields, nor should they allocate these structure
themselves. Instead, they should only create them via
objalloc_init, and only access them via the functions and macros
listed below. The structure is only defined here so that we can
access it via macros. */
struct objalloc
{
char *current_ptr;
unsigned int current_space;
void *chunks;
};
/* Work out the required alignment. */
struct objalloc_align { char x; double d; };
#if defined (__STDC__) && __STDC__
#ifndef offsetof
#include <stddef.h>
#endif
#endif
#ifndef offsetof
#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
#endif
#define OBJALLOC_ALIGN offsetof (struct objalloc_align, d)
/* Create an objalloc structure. Returns NULL if malloc fails. */
extern struct objalloc *objalloc_create (void);
/* Allocate space from an objalloc structure. Returns NULL if malloc
fails. */
extern void *_objalloc_alloc (struct objalloc *, unsigned long);
/* The macro version of objalloc_alloc. We only define this if using
gcc, because otherwise we would have to evaluate the arguments
multiple times, or use a temporary field as obstack.h does. */
#if defined (__GNUC__) && defined (__STDC__) && __STDC__
/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
does not implement __extension__. But that compiler doesn't define
__GNUC_MINOR__. */
#if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__)
#define __extension__
#endif
#define objalloc_alloc(o, l) \
__extension__ \
({ struct objalloc *__o = (o); \
unsigned long __len = (l); \
if (__len == 0) \
__len = 1; \
__len = (__len + OBJALLOC_ALIGN - 1) &~ (OBJALLOC_ALIGN - 1); \
(__len <= __o->current_space \
? (__o->current_ptr += __len, \
__o->current_space -= __len, \
(void *) (__o->current_ptr - __len)) \
: _objalloc_alloc (__o, __len)); })
#else /* ! __GNUC__ */
#define objalloc_alloc(o, l) _objalloc_alloc ((o), (l))
#endif /* ! __GNUC__ */
/* Free an entire objalloc structure. */
extern void objalloc_free (struct objalloc *);
/* Free a block allocated by objalloc_alloc. This also frees all more
recently allocated blocks. */
extern void objalloc_free_block (struct objalloc *, void *);
#endif /* OBJALLOC_H */

View File

@ -0,0 +1,545 @@
/* obstack.h - object stack macros
Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org.
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, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
USA. */
/* Summary:
All the apparent functions defined here are macros. The idea
is that you would use these pre-tested macros to solve a
very specific set of problems, and they would run fast.
Caution: no side-effects in arguments please!! They may be
evaluated MANY times!!
These macros operate a stack of objects. Each object starts life
small, and may grow to maturity. (Consider building a word syllable
by syllable.) An object can move while it is growing. Once it has
been "finished" it never changes address again. So the "top of the
stack" is typically an immature growing object, while the rest of the
stack is of mature, fixed size and fixed address objects.
These routines grab large chunks of memory, using a function you
supply, called `obstack_chunk_alloc'. On occasion, they free chunks,
by calling `obstack_chunk_free'. You must define them and declare
them before using any obstack macros.
Each independent stack is represented by a `struct obstack'.
Each of the obstack macros expects a pointer to such a structure
as the first argument.
One motivation for this package is the problem of growing char strings
in symbol tables. Unless you are "fascist pig with a read-only mind"
--Gosper's immortal quote from HAKMEM item 154, out of context--you
would not like to put any arbitrary upper limit on the length of your
symbols.
In practice this often means you will build many short symbols and a
few long symbols. At the time you are reading a symbol you don't know
how long it is. One traditional method is to read a symbol into a
buffer, realloc()ating the buffer every time you try to read a symbol
that is longer than the buffer. This is beaut, but you still will
want to copy the symbol from the buffer to a more permanent
symbol-table entry say about half the time.
With obstacks, you can work differently. Use one obstack for all symbol
names. As you read a symbol, grow the name in the obstack gradually.
When the name is complete, finalize it. Then, if the symbol exists already,
free the newly read name.
The way we do this is to take a large chunk, allocating memory from
low addresses. When you want to build a symbol in the chunk you just
add chars above the current "high water mark" in the chunk. When you
have finished adding chars, because you got to the end of the symbol,
you know how long the chars are, and you can create a new object.
Mostly the chars will not burst over the highest address of the chunk,
because you would typically expect a chunk to be (say) 100 times as
long as an average object.
In case that isn't clear, when we have enough chars to make up
the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed)
so we just point to it where it lies. No moving of chars is
needed and this is the second win: potentially long strings need
never be explicitly shuffled. Once an object is formed, it does not
change its address during its lifetime.
When the chars burst over a chunk boundary, we allocate a larger
chunk, and then copy the partly formed object from the end of the old
chunk to the beginning of the new larger chunk. We then carry on
accreting characters to the end of the object as we normally would.
A special macro is provided to add a single char at a time to a
growing object. This allows the use of register variables, which
break the ordinary 'growth' macro.
Summary:
We allocate large chunks.
We carve out one object at a time from the current chunk.
Once carved, an object never moves.
We are free to append data of any size to the currently
growing object.
Exactly one object is growing in an obstack at any one time.
You can run one obstack per control block.
You may have as many control blocks as you dare.
Because of the way we do it, you can `unwind' an obstack
back to a previous state. (You may remove objects much
as you would with a stack.)
*/
/* Don't do the contents of this file more than once. */
#ifndef _OBSTACK_H
#define _OBSTACK_H 1
#ifdef __cplusplus
extern "C" {
#endif
/* We use subtraction of (char *) 0 instead of casting to int
because on word-addressable machines a simple cast to int
may ignore the byte-within-word field of the pointer. */
#ifndef __PTR_TO_INT
# define __PTR_TO_INT(P) ((P) - (char *) 0)
#endif
#ifndef __INT_TO_PTR
# define __INT_TO_PTR(P) ((P) + (char *) 0)
#endif
/* We need the type of the resulting object. If __PTRDIFF_TYPE__ is
defined, as with GNU C, use that; that way we don't pollute the
namespace with <stddef.h>'s symbols. Otherwise, if <stddef.h> is
available, include it and use ptrdiff_t. In traditional C, long is
the best that we can do. */
#ifdef __PTRDIFF_TYPE__
# define PTR_INT_TYPE __PTRDIFF_TYPE__
#else
# ifdef HAVE_STDDEF_H
# include <stddef.h>
# define PTR_INT_TYPE ptrdiff_t
# else
# define PTR_INT_TYPE long
# endif
#endif
#if defined _LIBC || defined HAVE_STRING_H
# include <string.h>
# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
#else
# ifdef memcpy
# define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N))
# else
# define _obstack_memcpy(To, From, N) bcopy ((char *)(From), (To), (N))
# endif
#endif
struct _obstack_chunk /* Lives at front of each chunk. */
{
char *limit; /* 1 past end of this chunk */
struct _obstack_chunk *prev; /* address of prior chunk or NULL */
char contents[4]; /* objects begin here */
};
struct obstack /* control current object in current chunk */
{
long chunk_size; /* preferred size to allocate chunks in */
struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */
char *object_base; /* address of object we are building */
char *next_free; /* where to add next char to current object */
char *chunk_limit; /* address of char after current chunk */
PTR_INT_TYPE temp; /* Temporary for some macros. */
int alignment_mask; /* Mask of alignment for each object. */
/* These prototypes vary based on `use_extra_arg', and we use
casts to the prototypeless function type in all assignments,
but having prototypes here quiets -Wstrict-prototypes. */
struct _obstack_chunk *(*chunkfun) (void *, long);
void (*freefun) (void *, struct _obstack_chunk *);
void *extra_arg; /* first arg for chunk alloc/dealloc funcs */
unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */
unsigned maybe_empty_object:1;/* There is a possibility that the current
chunk contains a zero-length object. This
prevents freeing the chunk if we allocate
a bigger chunk to replace it. */
unsigned alloc_failed:1; /* No longer used, as we now call the failed
handler on error, but retained for binary
compatibility. */
};
/* Declare the external functions we use; they are in obstack.c. */
extern void _obstack_newchunk (struct obstack *, int);
extern void _obstack_free (struct obstack *, void *);
extern int _obstack_begin (struct obstack *, int, int,
void *(*) (long), void (*) (void *));
extern int _obstack_begin_1 (struct obstack *, int, int,
void *(*) (void *, long),
void (*) (void *, void *), void *);
extern int _obstack_memory_used (struct obstack *);
/* Do the function-declarations after the structs
but before defining the macros. */
void obstack_init (struct obstack *obstack);
void * obstack_alloc (struct obstack *obstack, int size);
void * obstack_copy (struct obstack *obstack, void *address, int size);
void * obstack_copy0 (struct obstack *obstack, void *address, int size);
void obstack_free (struct obstack *obstack, void *block);
void obstack_blank (struct obstack *obstack, int size);
void obstack_grow (struct obstack *obstack, void *data, int size);
void obstack_grow0 (struct obstack *obstack, void *data, int size);
void obstack_1grow (struct obstack *obstack, int data_char);
void obstack_ptr_grow (struct obstack *obstack, void *data);
void obstack_int_grow (struct obstack *obstack, int data);
void * obstack_finish (struct obstack *obstack);
int obstack_object_size (struct obstack *obstack);
int obstack_room (struct obstack *obstack);
void obstack_make_room (struct obstack *obstack, int size);
void obstack_1grow_fast (struct obstack *obstack, int data_char);
void obstack_ptr_grow_fast (struct obstack *obstack, void *data);
void obstack_int_grow_fast (struct obstack *obstack, int data);
void obstack_blank_fast (struct obstack *obstack, int size);
void * obstack_base (struct obstack *obstack);
void * obstack_next_free (struct obstack *obstack);
int obstack_alignment_mask (struct obstack *obstack);
int obstack_chunk_size (struct obstack *obstack);
int obstack_memory_used (struct obstack *obstack);
/* Error handler called when `obstack_chunk_alloc' failed to allocate
more memory. This can be set to a user defined function. The
default action is to print a message and abort. */
extern void (*obstack_alloc_failed_handler) (void);
/* Exit value used when `print_and_abort' is used. */
extern int obstack_exit_failure;
/* Pointer to beginning of object being allocated or to be allocated next.
Note that this might not be the final address of the object
because a new chunk might be needed to hold the final size. */
#define obstack_base(h) ((h)->object_base)
/* Size for allocating ordinary chunks. */
#define obstack_chunk_size(h) ((h)->chunk_size)
/* Pointer to next byte not yet allocated in current chunk. */
#define obstack_next_free(h) ((h)->next_free)
/* Mask specifying low bits that should be clear in address of an object. */
#define obstack_alignment_mask(h) ((h)->alignment_mask)
/* To prevent prototype warnings provide complete argument list in
standard C version. */
# define obstack_init(h) \
_obstack_begin ((h), 0, 0, \
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
# define obstack_begin(h, size) \
_obstack_begin ((h), (size), 0, \
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
_obstack_begin ((h), (size), (alignment), \
(void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun))
# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
_obstack_begin_1 ((h), (size), (alignment), \
(void *(*) (void *, long)) (chunkfun), \
(void (*) (void *, void *)) (freefun), (arg))
# define obstack_chunkfun(h, newchunkfun) \
((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun))
# define obstack_freefun(h, newfreefun) \
((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))
#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar))
#define obstack_blank_fast(h,n) ((h)->next_free += (n))
#define obstack_memory_used(h) _obstack_memory_used (h)
#if defined __GNUC__ && defined __STDC__ && __STDC__
/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
does not implement __extension__. But that compiler doesn't define
__GNUC_MINOR__. */
# if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__)
# define __extension__
# endif
/* For GNU C, if not -traditional,
we can define these macros to compute all args only once
without using a global variable.
Also, we can avoid using the `temp' slot, to make faster code. */
# define obstack_object_size(OBSTACK) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
(unsigned) (__o->next_free - __o->object_base); })
# define obstack_room(OBSTACK) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
(unsigned) (__o->chunk_limit - __o->next_free); })
# define obstack_make_room(OBSTACK,length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
int __len = (length); \
if (__o->chunk_limit - __o->next_free < __len) \
_obstack_newchunk (__o, __len); \
(void) 0; })
# define obstack_empty_p(OBSTACK) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
(__o->chunk->prev == 0 && __o->next_free - __o->chunk->contents == 0); })
# define obstack_grow(OBSTACK,where,length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
int __len = (length); \
if (__o->next_free + __len > __o->chunk_limit) \
_obstack_newchunk (__o, __len); \
_obstack_memcpy (__o->next_free, (where), __len); \
__o->next_free += __len; \
(void) 0; })
# define obstack_grow0(OBSTACK,where,length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
int __len = (length); \
if (__o->next_free + __len + 1 > __o->chunk_limit) \
_obstack_newchunk (__o, __len + 1); \
_obstack_memcpy (__o->next_free, (where), __len); \
__o->next_free += __len; \
*(__o->next_free)++ = 0; \
(void) 0; })
# define obstack_1grow(OBSTACK,datum) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + 1 > __o->chunk_limit) \
_obstack_newchunk (__o, 1); \
obstack_1grow_fast (__o, datum); \
(void) 0; })
/* These assume that the obstack alignment is good enough for pointers or ints,
and that the data added so far to the current object
shares that much alignment. */
# define obstack_ptr_grow(OBSTACK,datum) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
_obstack_newchunk (__o, sizeof (void *)); \
obstack_ptr_grow_fast (__o, datum); })
# define obstack_int_grow(OBSTACK,datum) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + sizeof (int) > __o->chunk_limit) \
_obstack_newchunk (__o, sizeof (int)); \
obstack_int_grow_fast (__o, datum); })
# define obstack_ptr_grow_fast(OBSTACK,aptr) \
__extension__ \
({ struct obstack *__o1 = (OBSTACK); \
*(const void **) __o1->next_free = (aptr); \
__o1->next_free += sizeof (const void *); \
(void) 0; })
# define obstack_int_grow_fast(OBSTACK,aint) \
__extension__ \
({ struct obstack *__o1 = (OBSTACK); \
*(int *) __o1->next_free = (aint); \
__o1->next_free += sizeof (int); \
(void) 0; })
# define obstack_blank(OBSTACK,length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
int __len = (length); \
if (__o->chunk_limit - __o->next_free < __len) \
_obstack_newchunk (__o, __len); \
obstack_blank_fast (__o, __len); \
(void) 0; })
# define obstack_alloc(OBSTACK,length) \
__extension__ \
({ struct obstack *__h = (OBSTACK); \
obstack_blank (__h, (length)); \
obstack_finish (__h); })
# define obstack_copy(OBSTACK,where,length) \
__extension__ \
({ struct obstack *__h = (OBSTACK); \
obstack_grow (__h, (where), (length)); \
obstack_finish (__h); })
# define obstack_copy0(OBSTACK,where,length) \
__extension__ \
({ struct obstack *__h = (OBSTACK); \
obstack_grow0 (__h, (where), (length)); \
obstack_finish (__h); })
/* The local variable is named __o1 to avoid a name conflict
when obstack_blank is called. */
# define obstack_finish(OBSTACK) \
__extension__ \
({ struct obstack *__o1 = (OBSTACK); \
void *value; \
value = (void *) __o1->object_base; \
if (__o1->next_free == value) \
__o1->maybe_empty_object = 1; \
__o1->next_free \
= __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\
& ~ (__o1->alignment_mask)); \
if (__o1->next_free - (char *)__o1->chunk \
> __o1->chunk_limit - (char *)__o1->chunk) \
__o1->next_free = __o1->chunk_limit; \
__o1->object_base = __o1->next_free; \
value; })
# define obstack_free(OBSTACK, OBJ) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
void *__obj = (void *) (OBJ); \
if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \
__o->next_free = __o->object_base = (char *) __obj; \
else (obstack_free) (__o, __obj); })
#else /* not __GNUC__ or not __STDC__ */
# define obstack_object_size(h) \
(unsigned) ((h)->next_free - (h)->object_base)
# define obstack_room(h) \
(unsigned) ((h)->chunk_limit - (h)->next_free)
# define obstack_empty_p(h) \
((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0)
/* Note that the call to _obstack_newchunk is enclosed in (..., 0)
so that we can avoid having void expressions
in the arms of the conditional expression.
Casting the third operand to void was tried before,
but some compilers won't accept it. */
# define obstack_make_room(h,length) \
( (h)->temp = (length), \
(((h)->next_free + (h)->temp > (h)->chunk_limit) \
? (_obstack_newchunk ((h), (h)->temp), 0) : 0))
# define obstack_grow(h,where,length) \
( (h)->temp = (length), \
(((h)->next_free + (h)->temp > (h)->chunk_limit) \
? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
_obstack_memcpy ((h)->next_free, (where), (h)->temp), \
(h)->next_free += (h)->temp)
# define obstack_grow0(h,where,length) \
( (h)->temp = (length), \
(((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \
? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \
_obstack_memcpy ((h)->next_free, (where), (h)->temp), \
(h)->next_free += (h)->temp, \
*((h)->next_free)++ = 0)
# define obstack_1grow(h,datum) \
( (((h)->next_free + 1 > (h)->chunk_limit) \
? (_obstack_newchunk ((h), 1), 0) : 0), \
obstack_1grow_fast (h, datum))
# define obstack_ptr_grow(h,datum) \
( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \
? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \
obstack_ptr_grow_fast (h, datum))
# define obstack_int_grow(h,datum) \
( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \
? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \
obstack_int_grow_fast (h, datum))
# define obstack_ptr_grow_fast(h,aptr) \
(((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr))
# define obstack_int_grow_fast(h,aint) \
(((int *) ((h)->next_free += sizeof (int)))[-1] = (aptr))
# define obstack_blank(h,length) \
( (h)->temp = (length), \
(((h)->chunk_limit - (h)->next_free < (h)->temp) \
? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
obstack_blank_fast (h, (h)->temp))
# define obstack_alloc(h,length) \
(obstack_blank ((h), (length)), obstack_finish ((h)))
# define obstack_copy(h,where,length) \
(obstack_grow ((h), (where), (length)), obstack_finish ((h)))
# define obstack_copy0(h,where,length) \
(obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
# define obstack_finish(h) \
( ((h)->next_free == (h)->object_base \
? (((h)->maybe_empty_object = 1), 0) \
: 0), \
(h)->temp = __PTR_TO_INT ((h)->object_base), \
(h)->next_free \
= __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \
& ~ ((h)->alignment_mask)), \
(((h)->next_free - (char *) (h)->chunk \
> (h)->chunk_limit - (char *) (h)->chunk) \
? ((h)->next_free = (h)->chunk_limit) : 0), \
(h)->object_base = (h)->next_free, \
__INT_TO_PTR ((h)->temp))
# define obstack_free(h,obj) \
( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
? (int) ((h)->next_free = (h)->object_base \
= (h)->temp + (char *) (h)->chunk) \
: (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
#endif /* not __GNUC__ or not __STDC__ */
#ifdef __cplusplus
} /* C++ */
#endif
#endif /* obstack.h */

View File

@ -0,0 +1,82 @@
/* List implementation of a partition of consecutive integers.
Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by CodeSourcery, LLC.
This file is part of GCC.
GCC 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.
GCC 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 GCC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
/* This package implements a partition of consecutive integers. The
elements are partitioned into classes. Each class is represented
by one of its elements, the canonical element, which is chosen
arbitrarily from elements in the class. The principal operations
on a partition are FIND, which takes an element, determines its
class, and returns the canonical element for that class, and UNION,
which unites the two classes that contain two given elements into a
single class.
The list implementation used here provides constant-time finds. By
storing the size of each class with the class's canonical element,
it is able to perform unions over all the classes in the partition
in O (N log N) time. */
#ifndef _PARTITION_H
#define _PARTITION_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "ansidecl.h"
#include <stdio.h>
struct partition_elem
{
/* The canonical element that represents the class containing this
element. */
int class_element;
/* The next element in this class. Elements in each class form a
circular list. */
struct partition_elem* next;
/* The number of elements in this class. Valid only if this is the
canonical element for its class. */
unsigned class_count;
};
typedef struct partition_def
{
/* The number of elements in this partition. */
int num_elements;
/* The elements in the partition. */
struct partition_elem elements[1];
} *partition;
extern partition partition_new (int);
extern void partition_delete (partition);
extern int partition_union (partition, int, int);
extern void partition_print (partition, FILE*);
/* Returns the canonical element corresponding to the class containing
ELEMENT__ in PARTITION__. */
#define partition_find(partition__, element__) \
((partition__)->elements[(element__)].class_element)
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _PARTITION_H */

View File

@ -0,0 +1,119 @@
/* <ctype.h> replacement macros.
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
Contributed by Zack Weinberg <zackw@stanford.edu>.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
Libiberty 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
/* This is a compatible replacement of the standard C library's <ctype.h>
with the following properties:
- Implements all isxxx() macros required by C99.
- Also implements some character classes useful when
parsing C-like languages.
- Does not change behavior depending on the current locale.
- Behaves properly for all values in the range of a signed or
unsigned char.
To avoid conflicts, this header defines the isxxx functions in upper
case, e.g. ISALPHA not isalpha. */
#ifndef SAFE_CTYPE_H
#define SAFE_CTYPE_H
#ifdef isalpha
#error "safe-ctype.h and ctype.h may not be used simultaneously"
#endif
/* Determine host character set. */
#define HOST_CHARSET_UNKNOWN 0
#define HOST_CHARSET_ASCII 1
#define HOST_CHARSET_EBCDIC 2
#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
&& 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21
# define HOST_CHARSET HOST_CHARSET_ASCII
#else
# if '\n' == 0x15 && ' ' == 0x40 && '0' == 0xF0 \
&& 'A' == 0xC1 && 'a' == 0x81 && '!' == 0x5A
# define HOST_CHARSET HOST_CHARSET_EBCDIC
# else
# define HOST_CHARSET HOST_CHARSET_UNKNOWN
# endif
#endif
/* Categories. */
enum {
/* In C99 */
_sch_isblank = 0x0001, /* space \t */
_sch_iscntrl = 0x0002, /* nonprinting characters */
_sch_isdigit = 0x0004, /* 0-9 */
_sch_islower = 0x0008, /* a-z */
_sch_isprint = 0x0010, /* any printing character including ' ' */
_sch_ispunct = 0x0020, /* all punctuation */
_sch_isspace = 0x0040, /* space \t \n \r \f \v */
_sch_isupper = 0x0080, /* A-Z */
_sch_isxdigit = 0x0100, /* 0-9A-Fa-f */
/* Extra categories useful to cpplib. */
_sch_isidst = 0x0200, /* A-Za-z_ */
_sch_isvsp = 0x0400, /* \n \r */
_sch_isnvsp = 0x0800, /* space \t \f \v \0 */
/* Combinations of the above. */
_sch_isalpha = _sch_isupper|_sch_islower, /* A-Za-z */
_sch_isalnum = _sch_isalpha|_sch_isdigit, /* A-Za-z0-9 */
_sch_isidnum = _sch_isidst|_sch_isdigit, /* A-Za-z0-9_ */
_sch_isgraph = _sch_isalnum|_sch_ispunct, /* isprint and not space */
_sch_iscppsp = _sch_isvsp|_sch_isnvsp, /* isspace + \0 */
_sch_isbasic = _sch_isprint|_sch_iscppsp /* basic charset of ISO C
(plus ` and @) */
};
/* Character classification. */
extern const unsigned short _sch_istable[256];
#define _sch_test(c, bit) (_sch_istable[(c) & 0xff] & (unsigned short)(bit))
#define ISALPHA(c) _sch_test(c, _sch_isalpha)
#define ISALNUM(c) _sch_test(c, _sch_isalnum)
#define ISBLANK(c) _sch_test(c, _sch_isblank)
#define ISCNTRL(c) _sch_test(c, _sch_iscntrl)
#define ISDIGIT(c) _sch_test(c, _sch_isdigit)
#define ISGRAPH(c) _sch_test(c, _sch_isgraph)
#define ISLOWER(c) _sch_test(c, _sch_islower)
#define ISPRINT(c) _sch_test(c, _sch_isprint)
#define ISPUNCT(c) _sch_test(c, _sch_ispunct)
#define ISSPACE(c) _sch_test(c, _sch_isspace)
#define ISUPPER(c) _sch_test(c, _sch_isupper)
#define ISXDIGIT(c) _sch_test(c, _sch_isxdigit)
#define ISIDNUM(c) _sch_test(c, _sch_isidnum)
#define ISIDST(c) _sch_test(c, _sch_isidst)
#define IS_ISOBASIC(c) _sch_test(c, _sch_isbasic)
#define IS_VSPACE(c) _sch_test(c, _sch_isvsp)
#define IS_NVSPACE(c) _sch_test(c, _sch_isnvsp)
#define IS_SPACE_OR_NUL(c) _sch_test(c, _sch_iscppsp)
/* Character transformation. */
extern const unsigned char _sch_toupper[256];
extern const unsigned char _sch_tolower[256];
#define TOUPPER(c) _sch_toupper[(c) & 0xff]
#define TOLOWER(c) _sch_tolower[(c) & 0xff]
#endif /* SAFE_CTYPE_H */

View File

@ -0,0 +1,48 @@
/* Sorting algorithms.
Copyright (C) 2000, 2002 Free Software Foundation, Inc.
Contributed by Mark Mitchell <mark@codesourcery.com>.
This file is part of GCC.
GCC 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.
GCC 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 GCC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
#ifndef SORT_H
#define SORT_H
#include <sys/types.h> /* For size_t */
#ifdef __STDC__
#include <stddef.h>
#endif /* __STDC__ */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "ansidecl.h"
/* Sort an array of pointers. */
extern void sort_pointers (size_t, void **, void **);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SORT_H */

View File

@ -0,0 +1,144 @@
/* A splay-tree datatype.
Copyright 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
Contributed by Mark Mitchell (mark@markmitchell.com).
This file is part of GCC.
GCC 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.
GCC 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 GCC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
/* For an easily readable description of splay-trees, see:
Lewis, Harry R. and Denenberg, Larry. Data Structures and Their
Algorithms. Harper-Collins, Inc. 1991.
The major feature of splay trees is that all basic tree operations
are amortized O(log n) time for a tree with n nodes. */
#ifndef _SPLAY_TREE_H
#define _SPLAY_TREE_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "ansidecl.h"
#ifndef GTY
#define GTY(X)
#endif
/* Use typedefs for the key and data types to facilitate changing
these types, if necessary. These types should be sufficiently wide
that any pointer or scalar can be cast to these types, and then
cast back, without loss of precision. */
typedef unsigned long int splay_tree_key;
typedef unsigned long int splay_tree_value;
/* Forward declaration for a node in the tree. */
typedef struct splay_tree_node_s *splay_tree_node;
/* The type of a function which compares two splay-tree keys. The
function should return values as for qsort. */
typedef int (*splay_tree_compare_fn) (splay_tree_key, splay_tree_key);
/* The type of a function used to deallocate any resources associated
with the key. */
typedef void (*splay_tree_delete_key_fn) (splay_tree_key);
/* The type of a function used to deallocate any resources associated
with the value. */
typedef void (*splay_tree_delete_value_fn) (splay_tree_value);
/* The type of a function used to iterate over the tree. */
typedef int (*splay_tree_foreach_fn) (splay_tree_node, void*);
/* The type of a function used to allocate memory for tree root and
node structures. The first argument is the number of bytes needed;
the second is a data pointer the splay tree functions pass through
to the allocator. This function must never return zero. */
typedef void *(*splay_tree_allocate_fn) (int, void *);
/* The type of a function used to free memory allocated using the
corresponding splay_tree_allocate_fn. The first argument is the
memory to be freed; the latter is a data pointer the splay tree
functions pass through to the freer. */
typedef void (*splay_tree_deallocate_fn) (void *, void *);
/* The nodes in the splay tree. */
struct splay_tree_node_s GTY(())
{
/* The key. */
splay_tree_key GTY ((use_param1)) key;
/* The value. */
splay_tree_value GTY ((use_param2)) value;
/* The left and right children, respectively. */
splay_tree_node GTY ((use_params)) left;
splay_tree_node GTY ((use_params)) right;
};
/* The splay tree itself. */
struct splay_tree_s GTY(())
{
/* The root of the tree. */
splay_tree_node GTY ((use_params)) root;
/* The comparision function. */
splay_tree_compare_fn comp;
/* The deallocate-key function. NULL if no cleanup is necessary. */
splay_tree_delete_key_fn delete_key;
/* The deallocate-value function. NULL if no cleanup is necessary. */
splay_tree_delete_value_fn delete_value;
/* Allocate/free functions, and a data pointer to pass to them. */
splay_tree_allocate_fn allocate;
splay_tree_deallocate_fn deallocate;
void * GTY((skip)) allocate_data;
};
typedef struct splay_tree_s *splay_tree;
extern splay_tree splay_tree_new (splay_tree_compare_fn,
splay_tree_delete_key_fn,
splay_tree_delete_value_fn);
extern splay_tree splay_tree_new_with_allocator (splay_tree_compare_fn,
splay_tree_delete_key_fn,
splay_tree_delete_value_fn,
splay_tree_allocate_fn,
splay_tree_deallocate_fn,
void *);
extern void splay_tree_delete (splay_tree);
extern splay_tree_node splay_tree_insert (splay_tree,
splay_tree_key,
splay_tree_value);
extern void splay_tree_remove (splay_tree, splay_tree_key);
extern splay_tree_node splay_tree_lookup (splay_tree, splay_tree_key);
extern splay_tree_node splay_tree_predecessor (splay_tree, splay_tree_key);
extern splay_tree_node splay_tree_successor (splay_tree, splay_tree_key);
extern splay_tree_node splay_tree_max (splay_tree);
extern splay_tree_node splay_tree_min (splay_tree);
extern int splay_tree_foreach (splay_tree, splay_tree_foreach_fn, void*);
extern int splay_tree_compare_ints (splay_tree_key, splay_tree_key);
extern int splay_tree_compare_pointers (splay_tree_key, splay_tree_key);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _SPLAY_TREE_H */

View File

@ -0,0 +1,49 @@
/* Symbol concatenation utilities.
Copyright (C) 1998, 2000 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; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef SYM_CAT_H
#define SYM_CAT_H
#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
#define CONCAT2(a,b) a##b
#define CONCAT3(a,b,c) a##b##c
#define CONCAT4(a,b,c,d) a##b##c##d
#define STRINGX(s) #s
#else
/* Note one should never pass extra whitespace to the CONCATn macros,
e.g. CONCAT2(foo, bar) because traditonal C will keep the space between
the two labels instead of concatenating them. Instead, make sure to
write CONCAT2(foo,bar). */
#define CONCAT2(a,b) a/**/b
#define CONCAT3(a,b,c) a/**/b/**/c
#define CONCAT4(a,b,c,d) a/**/b/**/c/**/d
#define STRINGX(s) "s"
#endif
#define XCONCAT2(a,b) CONCAT2(a,b)
#define XCONCAT3(a,b,c) CONCAT3(a,b,c)
#define XCONCAT4(a,b,c,d) CONCAT4(a,b,c,d)
/* Note the layer of indirection here is typically used to allow
stringification of the expansion of macros. I.e. "#define foo
bar", "XSTRING(foo)", to yield "bar". Be aware that this only
works for __STDC__, not for traditional C which will still resolve
to "foo". */
#define XSTRING(s) STRINGX(s)
#endif /* SYM_CAT_H */

View File

@ -0,0 +1,51 @@
/* ternary.h - Ternary Search Trees
Copyright 2001 Free Software Foundation, Inc.
Contributed by Daniel Berlin (dan@cgsoftware.com)
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, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
USA. */
#ifndef TERNARY_H_
#define TERNARY_H_
/* Ternary search trees */
typedef struct ternary_node_def *ternary_tree;
typedef struct ternary_node_def
{
char splitchar;
ternary_tree lokid;
ternary_tree eqkid;
ternary_tree hikid;
}
ternary_node;
/* Insert string S into tree P, associating it with DATA.
Return the data in the tree associated with the string if it's
already there, and replace is 0.
Otherwise, replaces if it it exists, inserts if it doesn't, and
returns the data you passed in. */
void *ternary_insert (ternary_tree *p, const char *s,
void *data, int replace);
/* Delete the ternary search tree rooted at P.
Does NOT delete the data you associated with the strings. */
void ternary_cleanup (ternary_tree p);
/* Search the ternary tree for string S, returning the data associated
with it if found. */
void *ternary_search (const ternary_node *p, const char *s);
#endif

View File

@ -0,0 +1,28 @@
/* This file redefines all regex external names before including
a renamed copy of glibc's regex.h. */
#ifndef _XREGEX_H
#define _XREGEX_H 1
# define regfree xregfree
# define regexec xregexec
# define regcomp xregcomp
# define regerror xregerror
# define re_set_registers xre_set_registers
# define re_match_2 xre_match_2
# define re_match xre_match
# define re_search xre_search
# define re_compile_pattern xre_compile_pattern
# define re_set_syntax xre_set_syntax
# define re_search_2 xre_search_2
# define re_compile_fastmap xre_compile_fastmap
# define re_syntax_options xre_syntax_options
# define re_max_failures xre_max_failures
# define _REGEX_RE_COMP
# define re_comp xre_comp
# define re_exec xre_exec
#include "xregex2.h"
#endif /* xregex.h */

View File

@ -0,0 +1,565 @@
/* Definitions for data structures and routines for the regular
expression library, version 0.12.
Copyright (C) 1985, 1989, 1990, 1991, 1992, 1993, 1995, 1996, 1997,
1998, 2000, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA. */
#ifndef _REGEX_H
#define _REGEX_H 1
/* Allow the use in C++ code. */
#ifdef __cplusplus
extern "C" {
#endif
/* POSIX says that <sys/types.h> must be included (by the caller) before
<regex.h>. */
#if !defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE && defined VMS
/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
should be there. */
# include <stddef.h>
#endif
/* The following two types have to be signed and unsigned integer type
wide enough to hold a value of a pointer. For most ANSI compilers
ptrdiff_t and size_t should be likely OK. Still size of these two
types is 2 for Microsoft C. Ugh... */
typedef long int s_reg_t;
typedef unsigned long int active_reg_t;
/* The following bits are used to determine the regexp syntax we
recognize. The set/not-set meanings are chosen so that Emacs syntax
remains the value 0. The bits are given in alphabetical order, and
the definitions shifted by one from the previous bit; thus, when we
add or remove a bit, only one other definition need change. */
typedef unsigned long int reg_syntax_t;
/* If this bit is not set, then \ inside a bracket expression is literal.
If set, then such a \ quotes the following character. */
#define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
/* If this bit is not set, then + and ? are operators, and \+ and \? are
literals.
If set, then \+ and \? are operators and + and ? are literals. */
#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
/* If this bit is set, then character classes are supported. They are:
[:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
[:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
If not set, then character classes are not supported. */
#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
/* If this bit is set, then ^ and $ are always anchors (outside bracket
expressions, of course).
If this bit is not set, then it depends:
^ is an anchor if it is at the beginning of a regular
expression or after an open-group or an alternation operator;
$ is an anchor if it is at the end of a regular expression, or
before a close-group or an alternation operator.
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
POSIX draft 11.2 says that * etc. in leading positions is undefined.
We already implemented a previous draft which made those constructs
invalid, though, so we haven't changed the code back. */
#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
/* If this bit is set, then special characters are always special
regardless of where they are in the pattern.
If this bit is not set, then special characters are special only in
some contexts; otherwise they are ordinary. Specifically,
* + ? and intervals are only special when not after the beginning,
open-group, or alternation operator. */
#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
/* If this bit is set, then *, +, ?, and { cannot be first in an re or
immediately after an alternation or begin-group operator. */
#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
/* If this bit is set, then . matches newline.
If not set, then it doesn't. */
#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
/* If this bit is set, then . doesn't match NUL.
If not set, then it does. */
#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
/* If this bit is set, nonmatching lists [^...] do not match newline.
If not set, they do. */
#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
/* If this bit is set, either \{...\} or {...} defines an
interval, depending on RE_NO_BK_BRACES.
If not set, \{, \}, {, and } are literals. */
#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
/* If this bit is set, +, ? and | aren't recognized as operators.
If not set, they are. */
#define RE_LIMITED_OPS (RE_INTERVALS << 1)
/* If this bit is set, newline is an alternation operator.
If not set, newline is literal. */
#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
/* If this bit is set, then `{...}' defines an interval, and \{ and \}
are literals.
If not set, then `\{...\}' defines an interval. */
#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
/* If this bit is set, (...) defines a group, and \( and \) are literals.
If not set, \(...\) defines a group, and ( and ) are literals. */
#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
/* If this bit is set, then \<digit> matches <digit>.
If not set, then \<digit> is a back-reference. */
#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
/* If this bit is set, then | is an alternation operator, and \| is literal.
If not set, then \| is an alternation operator, and | is literal. */
#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
/* If this bit is set, then an ending range point collating higher
than the starting range point, as in [z-a], is invalid.
If not set, then when ending range point collates higher than the
starting range point, the range is ignored. */
#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
/* If this bit is set, then an unmatched ) is ordinary.
If not set, then an unmatched ) is invalid. */
#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
/* If this bit is set, succeed as soon as we match the whole pattern,
without further backtracking. */
#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
/* If this bit is set, do not process the GNU regex operators.
If not set, then the GNU regex operators are recognized. */
#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
/* If this bit is set, turn on internal regex debugging.
If not set, and debugging was on, turn it off.
This only works if regex.c is compiled -DDEBUG.
We define this bit always, so that all that's needed to turn on
debugging is to recompile regex.c; the calling code can always have
this bit set, and it won't affect anything in the normal case. */
#define RE_DEBUG (RE_NO_GNU_OPS << 1)
/* If this bit is set, a syntactically invalid interval is treated as
a string of ordinary characters. For example, the ERE 'a{1' is
treated as 'a\{1'. */
#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
/* This global variable defines the particular regexp syntax to use (for
some interfaces). When a regexp is compiled, the syntax used is
stored in the pattern buffer, so changing this does not affect
already-compiled regexps. */
extern reg_syntax_t re_syntax_options;
/* Define combinations of the above bits for the standard possibilities.
(The [[[ comments delimit what gets put into the Texinfo file, so
don't delete them!) */
/* [[[begin syntaxes]]] */
#define RE_SYNTAX_EMACS 0
#define RE_SYNTAX_AWK \
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
| RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \
| RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
#define RE_SYNTAX_GNU_AWK \
((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \
& ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS))
#define RE_SYNTAX_POSIX_AWK \
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
| RE_INTERVALS | RE_NO_GNU_OPS)
#define RE_SYNTAX_GREP \
(RE_BK_PLUS_QM | RE_CHAR_CLASSES \
| RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
| RE_NEWLINE_ALT)
#define RE_SYNTAX_EGREP \
(RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
| RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
| RE_NEWLINE_ALT | RE_NO_BK_PARENS \
| RE_NO_BK_VBAR)
#define RE_SYNTAX_POSIX_EGREP \
(RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES \
| RE_INVALID_INTERVAL_ORD)
/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
/* Syntax bits common to both basic and extended POSIX regex syntax. */
#define _RE_SYNTAX_POSIX_COMMON \
(RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
| RE_INTERVALS | RE_NO_EMPTY_RANGES)
#define RE_SYNTAX_POSIX_BASIC \
(_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
isn't minimal, since other operators, such as \`, aren't disabled. */
#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
(_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
#define RE_SYNTAX_POSIX_EXTENDED \
(_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
| RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
| RE_NO_BK_PARENS | RE_NO_BK_VBAR \
| RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD)
/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is
removed and RE_NO_BK_REFS is added. */
#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
(_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
| RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
| RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
/* [[[end syntaxes]]] */
/* Maximum number of duplicates an interval can allow. Some systems
(erroneously) define this in other header files, but we want our
value, so remove any previous define. */
#ifdef RE_DUP_MAX
# undef RE_DUP_MAX
#endif
/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */
#define RE_DUP_MAX (0x7fff)
/* POSIX `cflags' bits (i.e., information for `regcomp'). */
/* If this bit is set, then use extended regular expression syntax.
If not set, then use basic regular expression syntax. */
#define REG_EXTENDED 1
/* If this bit is set, then ignore case when matching.
If not set, then case is significant. */
#define REG_ICASE (REG_EXTENDED << 1)
/* If this bit is set, then anchors do not match at newline
characters in the string.
If not set, then anchors do match at newlines. */
#define REG_NEWLINE (REG_ICASE << 1)
/* If this bit is set, then report only success or fail in regexec.
If not set, then returns differ between not matching and errors. */
#define REG_NOSUB (REG_NEWLINE << 1)
/* POSIX `eflags' bits (i.e., information for regexec). */
/* If this bit is set, then the beginning-of-line operator doesn't match
the beginning of the string (presumably because it's not the
beginning of a line).
If not set, then the beginning-of-line operator does match the
beginning of the string. */
#define REG_NOTBOL 1
/* Like REG_NOTBOL, except for the end-of-line. */
#define REG_NOTEOL (1 << 1)
/* If any error codes are removed, changed, or added, update the
`re_error_msg' table in regex.c. */
typedef enum
{
#ifdef _XOPEN_SOURCE
REG_ENOSYS = -1, /* This will never happen for this implementation. */
#endif
REG_NOERROR = 0, /* Success. */
REG_NOMATCH, /* Didn't find a match (for regexec). */
/* POSIX regcomp return error codes. (In the order listed in the
standard.) */
REG_BADPAT, /* Invalid pattern. */
REG_ECOLLATE, /* Not implemented. */
REG_ECTYPE, /* Invalid character class name. */
REG_EESCAPE, /* Trailing backslash. */
REG_ESUBREG, /* Invalid back reference. */
REG_EBRACK, /* Unmatched left bracket. */
REG_EPAREN, /* Parenthesis imbalance. */
REG_EBRACE, /* Unmatched \{. */
REG_BADBR, /* Invalid contents of \{\}. */
REG_ERANGE, /* Invalid range end. */
REG_ESPACE, /* Ran out of memory. */
REG_BADRPT, /* No preceding re for repetition op. */
/* Error codes we've added. */
REG_EEND, /* Premature end. */
REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
} reg_errcode_t;
/* This data structure represents a compiled pattern. Before calling
the pattern compiler, the fields `buffer', `allocated', `fastmap',
`translate', and `no_sub' can be set. After the pattern has been
compiled, the `re_nsub' field is available. All other fields are
private to the regex routines. */
#ifndef RE_TRANSLATE_TYPE
# define RE_TRANSLATE_TYPE char *
#endif
struct re_pattern_buffer
{
/* [[[begin pattern_buffer]]] */
/* Space that holds the compiled pattern. It is declared as
`unsigned char *' because its elements are
sometimes used as array indexes. */
unsigned char *buffer;
/* Number of bytes to which `buffer' points. */
unsigned long int allocated;
/* Number of bytes actually used in `buffer'. */
unsigned long int used;
/* Syntax setting with which the pattern was compiled. */
reg_syntax_t syntax;
/* Pointer to a fastmap, if any, otherwise zero. re_search uses
the fastmap, if there is one, to skip over impossible
starting points for matches. */
char *fastmap;
/* Either a translate table to apply to all characters before
comparing them, or zero for no translation. The translation
is applied to a pattern when it is compiled and to a string
when it is matched. */
RE_TRANSLATE_TYPE translate;
/* Number of subexpressions found by the compiler. */
size_t re_nsub;
/* Zero if this pattern cannot match the empty string, one else.
Well, in truth it's used only in `re_search_2', to see
whether or not we should use the fastmap, so we don't set
this absolutely perfectly; see `re_compile_fastmap' (the
`duplicate' case). */
unsigned can_be_null : 1;
/* If REGS_UNALLOCATED, allocate space in the `regs' structure
for `max (RE_NREGS, re_nsub + 1)' groups.
If REGS_REALLOCATE, reallocate space if necessary.
If REGS_FIXED, use what's there. */
#define REGS_UNALLOCATED 0
#define REGS_REALLOCATE 1
#define REGS_FIXED 2
unsigned regs_allocated : 2;
/* Set to zero when `regex_compile' compiles a pattern; set to one
by `re_compile_fastmap' if it updates the fastmap. */
unsigned fastmap_accurate : 1;
/* If set, `re_match_2' does not return information about
subexpressions. */
unsigned no_sub : 1;
/* If set, a beginning-of-line anchor doesn't match at the
beginning of the string. */
unsigned not_bol : 1;
/* Similarly for an end-of-line anchor. */
unsigned not_eol : 1;
/* If true, an anchor at a newline matches. */
unsigned newline_anchor : 1;
/* [[[end pattern_buffer]]] */
};
typedef struct re_pattern_buffer regex_t;
/* Type for byte offsets within the string. POSIX mandates this. */
typedef int regoff_t;
/* This is the structure we store register match data in. See
regex.texinfo for a full description of what registers match. */
struct re_registers
{
unsigned num_regs;
regoff_t *start;
regoff_t *end;
};
/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
`re_match_2' returns information about at least this many registers
the first time a `regs' structure is passed. */
#ifndef RE_NREGS
# define RE_NREGS 30
#endif
/* POSIX specification for registers. Aside from the different names than
`re_registers', POSIX uses an array of structures, instead of a
structure of arrays. */
typedef struct
{
regoff_t rm_so; /* Byte offset from string's start to substring's start. */
regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
} regmatch_t;
/* Declarations for routines. */
/* To avoid duplicating every routine declaration -- once with a
prototype (if we are ANSI), and once without (if we aren't) -- we
use the following macro to declare argument types. This
unfortunately clutters up the declarations a bit, but I think it's
worth it. */
/* Sets the current default syntax to SYNTAX, and return the old syntax.
You can also simply assign to the `re_syntax_options' variable. */
extern reg_syntax_t re_set_syntax (reg_syntax_t syntax);
/* Compile the regular expression PATTERN, with length LENGTH
and syntax given by the global `re_syntax_options', into the buffer
BUFFER. Return NULL if successful, and an error string if not. */
extern const char *re_compile_pattern (const char *pattern, size_t length,
struct re_pattern_buffer *buffer);
/* Compile a fastmap for the compiled pattern in BUFFER; used to
accelerate searches. Return 0 if successful and -2 if was an
internal error. */
extern int re_compile_fastmap (struct re_pattern_buffer *buffer);
/* Search in the string STRING (with length LENGTH) for the pattern
compiled into BUFFER. Start searching at position START, for RANGE
characters. Return the starting position of the match, -1 for no
match, or -2 for an internal error. Also return register
information in REGS (if REGS and BUFFER->no_sub are nonzero). */
extern int re_search (struct re_pattern_buffer *buffer, const char *string,
int length, int start, int range,
struct re_registers *regs);
/* Like `re_search', but search in the concatenation of STRING1 and
STRING2. Also, stop searching at index START + STOP. */
extern int re_search_2 (struct re_pattern_buffer *buffer, const char *string1,
int length1, const char *string2, int length2,
int start, int range, struct re_registers *regs,
int stop);
/* Like `re_search', but return how many characters in STRING the regexp
in BUFFER matched, starting at position START. */
extern int re_match (struct re_pattern_buffer *buffer, const char *string,
int length, int start, struct re_registers *regs);
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
extern int re_match_2 (struct re_pattern_buffer *buffer, const char *string1,
int length1, const char *string2, int length2,
int start, struct re_registers *regs, int stop);
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
ENDS. Subsequent matches using BUFFER and REGS will use this memory
for recording register information. STARTS and ENDS must be
allocated with malloc, and must each be at least `NUM_REGS * sizeof
(regoff_t)' bytes long.
If NUM_REGS == 0, then subsequent matches should allocate their own
register data.
Unless this function is called, the first search or match using
PATTERN_BUFFER will allocate its own register data, without
freeing the old data. */
extern void re_set_registers (struct re_pattern_buffer *buffer,
struct re_registers *regs,
unsigned num_regs, regoff_t *starts,
regoff_t *ends);
#if defined _REGEX_RE_COMP || defined _LIBC
# ifndef _CRAY
/* 4.2 bsd compatibility. */
extern char *re_comp (const char *);
extern int re_exec (const char *);
# endif
#endif
/* GCC 2.95 and later have "__restrict"; C99 compilers have
"restrict", and "configure" may have defined "restrict". */
#ifndef __restrict
# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
# if defined restrict || 199901L <= __STDC_VERSION__
# define __restrict restrict
# else
# define __restrict
# endif
# endif
#endif
/* GCC 3.1 and later support declaring arrays as non-overlapping
using the syntax array_name[restrict] */
#ifndef __restrict_arr
# if ! (3 < __GNUC__ || (3 == __GNUC__ && 1 <= __GNUC_MINOR__)) || defined (__GNUG__)
# define __restrict_arr
# else
# define __restrict_arr __restrict
# endif
#endif
/* POSIX compatibility. */
extern int regcomp (regex_t *__restrict __preg,
const char *__restrict __pattern,
int __cflags);
#if (__GNUC__)
__extension__
#endif
extern int regexec (const regex_t *__restrict __preg,
const char *__restrict __string, size_t __nmatch,
regmatch_t __pmatch[__restrict_arr],
int __eflags);
extern size_t regerror (int __errcode, const regex_t *__preg,
char *__errbuf, size_t __errbuf_size);
extern void regfree (regex_t *__preg);
#ifdef __cplusplus
}
#endif /* C++ */
#endif /* regex.h */
/*
Local variables:
make-backup-files: t
version-control: t
trim-versions-without-asking: nil
End:
*/

View File

@ -0,0 +1,148 @@
/* Xtensa configuration settings.
Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
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, write to the Free Software
Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef XTENSA_CONFIG_H
#define XTENSA_CONFIG_H
/* The macros defined here match those with the same names in the Xtensa
compile-time HAL (Hardware Abstraction Layer). Please refer to the
Xtensa System Software Reference Manual for documentation of these
macros. */
#undef XCHAL_HAVE_BE
#define XCHAL_HAVE_BE 1
#undef XCHAL_HAVE_DENSITY
#define XCHAL_HAVE_DENSITY 1
#undef XCHAL_HAVE_CONST16
#define XCHAL_HAVE_CONST16 0
#undef XCHAL_HAVE_ABS
#define XCHAL_HAVE_ABS 1
#undef XCHAL_HAVE_ADDX
#define XCHAL_HAVE_ADDX 1
#undef XCHAL_HAVE_L32R
#define XCHAL_HAVE_L32R 1
#undef XSHAL_USE_ABSOLUTE_LITERALS
#define XSHAL_USE_ABSOLUTE_LITERALS 0
#undef XCHAL_HAVE_MAC16
#define XCHAL_HAVE_MAC16 0
#undef XCHAL_HAVE_MUL16
#define XCHAL_HAVE_MUL16 0
#undef XCHAL_HAVE_MUL32
#define XCHAL_HAVE_MUL32 0
#undef XCHAL_HAVE_MUL32_HIGH
#define XCHAL_HAVE_MUL32_HIGH 0
#undef XCHAL_HAVE_DIV32
#define XCHAL_HAVE_DIV32 0
#undef XCHAL_HAVE_NSA
#define XCHAL_HAVE_NSA 1
#undef XCHAL_HAVE_MINMAX
#define XCHAL_HAVE_MINMAX 0
#undef XCHAL_HAVE_SEXT
#define XCHAL_HAVE_SEXT 0
#undef XCHAL_HAVE_LOOPS
#define XCHAL_HAVE_LOOPS 1
#undef XCHAL_HAVE_BOOLEANS
#define XCHAL_HAVE_BOOLEANS 0
#undef XCHAL_HAVE_FP
#define XCHAL_HAVE_FP 0
#undef XCHAL_HAVE_FP_DIV
#define XCHAL_HAVE_FP_DIV 0
#undef XCHAL_HAVE_FP_RECIP
#define XCHAL_HAVE_FP_RECIP 0
#undef XCHAL_HAVE_FP_SQRT
#define XCHAL_HAVE_FP_SQRT 0
#undef XCHAL_HAVE_FP_RSQRT
#define XCHAL_HAVE_FP_RSQRT 0
#undef XCHAL_HAVE_WINDOWED
#define XCHAL_HAVE_WINDOWED 1
#undef XCHAL_HAVE_WIDE_BRANCHES
#define XCHAL_HAVE_WIDE_BRANCHES 0
#undef XCHAL_HAVE_PREDICTED_BRANCHES
#define XCHAL_HAVE_PREDICTED_BRANCHES 0
#undef XCHAL_ICACHE_SIZE
#define XCHAL_ICACHE_SIZE 8192
#undef XCHAL_DCACHE_SIZE
#define XCHAL_DCACHE_SIZE 8192
#undef XCHAL_ICACHE_LINESIZE
#define XCHAL_ICACHE_LINESIZE 16
#undef XCHAL_DCACHE_LINESIZE
#define XCHAL_DCACHE_LINESIZE 16
#undef XCHAL_ICACHE_LINEWIDTH
#define XCHAL_ICACHE_LINEWIDTH 4
#undef XCHAL_DCACHE_LINEWIDTH
#define XCHAL_DCACHE_LINEWIDTH 4
#undef XCHAL_DCACHE_IS_WRITEBACK
#define XCHAL_DCACHE_IS_WRITEBACK 0
#undef XCHAL_HAVE_MMU
#define XCHAL_HAVE_MMU 1
#undef XCHAL_MMU_MIN_PTE_PAGE_SIZE
#define XCHAL_MMU_MIN_PTE_PAGE_SIZE 12
#undef XCHAL_HAVE_DEBUG
#define XCHAL_HAVE_DEBUG 1
#undef XCHAL_NUM_IBREAK
#define XCHAL_NUM_IBREAK 2
#undef XCHAL_NUM_DBREAK
#define XCHAL_NUM_DBREAK 2
#undef XCHAL_DEBUGLEVEL
#define XCHAL_DEBUGLEVEL 4
#undef XCHAL_INST_FETCH_WIDTH
#define XCHAL_INST_FETCH_WIDTH 4
#endif /* !XTENSA_CONFIG_H */

View File

@ -0,0 +1,949 @@
2007-05-13 Release Manager
* GCC 4.2.0 released.
2007-04-23 Tom Tromey <tromey@redhat.com>
PR preprocessor/30468:
* mkdeps.c (apply_vpath): Strip successive '/'s if we stripped
'./'.
2006-12-29 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/29612
* directives.c (do_linemarker): Set pfile->buffer->sysp always, not
only when new_sysp is non-zero.
2006-10-12 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/28709
* macro.c (paste_tokens): Do error reporting here, use BUF with the
spelled LHS token as opposed to spelling it again.
(paste_all_tokens): Don't report errors here, just break on failure.
2006-10-10 Brooks Moses <bmoses@stanford.edu>
* Makefile.in: Added empty "pdf" target.
2006-09-22 Geoffrey Keating <geoffk@apple.com>
* configure.ac: Make need_64_bit_hwint case for x86-darwin
match exactly the glob in gcc/config.gcc.
* configure: Regenerate.
2006-09-13 Joseph S. Myers <joseph@codesourcery.com>
PR c/28768
PR preprocessor/14634
* lex.c (lex_string): Pedwarn for unterminated literals.
2006-09-08 Eric Christopher <echristo@apple.com>
* configure.ac: Add 64-bit HWI support for i?86-darwin.
2006-08-14 Steve Ellcey <sje@cup.hp.com>
PR c++/28288
PR c++/14556
* include/cpplib.h: Remove <?, >?, <?=, and >?= tokens.
(CPP_LAST_EQ): Change.
(CPP_LAST_PUNCTUATOR): Change.
* expr.c (cpp_operator): Remove MIN and MAX.
(reduce): Remove CPP_MIN and CPP_MAX.
(num_binary_op): Ditto.
* lex.c (_cpp_lex_direct): Ditto.
(cpp_avoid_paste): Remove ? as legal symbol after > or <.
2006-06-09 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/27746
* directives.c (do_pragma): Handle pragma with valid namespace
and invalid name coming from macro expansion.
* directives.c (destringize_and_run): Initialize next field in
context.
PR c/27747
PR c++/27748
* directives.c (destringize_and_run): Set NO_EXPAND on the
tokens.
* macro.c (_cpp_backup_tokens): Fix comment typo.
2006-05-31 Daniel Jacobowitz <dan@codesourcery.com>
* Makefile.in (CATALOGS): Add po/ prefix.
* configure: Regenerated.
2006-05-23 Carlos O'Donell <carlos@codesourcery.com>
* Makefile.in: Add install-html target. Add install-html to .PHONY
2006-02-17 Grigory Zagorodnev <grigory_zagorodnev@linux.intel.com>
* macro.c (_cpp_builtin_macro_text): Handle BT_TIMESTAMP.
* files.c (_cpp_get_file_stat): New function.
* include/cpplib.h (builtin_type): Add BT_TIMESTAMP.
* init.c (builtin_array): Add support for __TIMESTAMP__/BT_TIMESTAMP.
* internal.h (_cpp_get_file_stat): Prototype.
(struct cpp_buffer): Add timestamp.
2006-01-23 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/25717
* init.c (cpp_init_builtins): If __STDC__ will not change value
between system headers and other sources, define it as a normal
macro rather than a builtin.
* macro.c (_cpp_builtin_macro_text) <case BT_STDC>: Only check
cpp_in_system_header condition.
2006-01-05 Paolo Bonzini <bonzini@gnu.org>
* Makefile.in: Use -MMD instead of -MD.
2006-01-04 Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
Richard Henderson <rth@redhat.com>
Merge from gomp branch:
* directives.c (struct pragma_entry): Add is_deferred. Add ident
entry to value union.
(end_directive): Don't eat the line if in_deferred_pragma.
(run_directive): Remove pragma hacks.
(insert_pragma_entry): Remove.
(new_pragma_entry): New.
(register_pragma_1): Split out of register_pragma. Only handle
the lookup tree and return the new entry.
(cpp_register_pragma): Fill in the pragma entry here.
(cpp_register_deferred_pragma): New.
(register_pragma_internal): New.
(_cpp_init_internal_pragmas): Use register_pragma_internal.
(do_pragma): Allow pragma expansion after namespace. For deferred
pragmas, don't slurp the line into a string.
(destringize_and_run): Save tokens for deferred pragmas.
(cpp_handle_deferred_pragma): Remove.
* macro.c (builtin_macro): Remove pragma token hack.
(_cpp_push_token_context): Rename from push_token_context and export.
* internal.h (struct lexer_state): Add pragma_allow_expansion.
(_cpp_push_token_context): Declare.
* lex.c (_cpp_lex_token): Allow _cpp_handle_directive to return
a token. Update the line number correctly if so.
(_cpp_lex_direct): Emit CPP_PRAGMA_EOL tokens.
(cpp_token_val_index): Return CPP_TOKEN_FLD_PRAGMA for pragmas.
* include/cpplib.h (PRAGMA_EOL): New.
(CPP_TOKEN_FLD_PRAGMA): New.
(struct cpp_token): Add val.pragma.
(struct cpp_options): Remove defer_pragmas.
(cpp_handle_deferred_pragma): Remove.
(cpp_register_deferred_pragma): Declare.
2006-01-01 Jakub Jelinek <jakub@redhat.com>
PR c++/25294
* directives.c (do_pragma): If pragma line ends with multi-line
block comment, end the saved deferred pragma string before that
comment. Handle embedded '\0' chars on the pragma line.
2005-12-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/23333
* include/cpplib.h: Add PURE_ZERO to flags for the cpp_token structure.
2005-12-07 Jon Grimm <jgrimm2@us.ibm.com>
Ben Elliston <bje@au.ibm.com>
* include/cpplib.h (CPP_N_DFLOAT): New.
* expr.c (interpret_float_suffix): Identify df, dd, and dl
suffixes as decimal floating point constants.
(cpp_classify_number): Disallow hexadecimal DFP constants.
2005-11-14 Gerald Pfeifer <gerald@pfeifer.com>
Ian Lance Taylor <ian@airs.com>
* include/cpplib.h (struct cpp_callbacks): Annotate error with
ATTRIBUTE_FPTR_PRINTF(3,0) instead of ATTRIBUTE_PRINTF(3,0).
2005-11-09 Per Bothner <per@bothner.com>
Uros Bizjak <uros@kss-loka.si>
PR c/24101
* init.c (read_original_filename): Temporarily set
state.in_directive before calling _cpp_lex_direct for
CPP_HASH tokens.
2005-11-03 James E Wilson <wilson@specifix.com>
PR preprocessor/24202
* files.c (_cpp_pop_file_buffer): Set buffer_valid to false.
2005-11-04 Joseph S. Myers <joseph@codesourcery.com>
* include/cpplib.h (struct cpp_callbacks): Make error take
va_list* parameter.
* errors.c (cpp_error): Update call to callback.
2005-11-03 Andrew Pinski <pinskia@physics.uc.edu>
PR preprocessor/22042
* macro.c (_cpp_builtin_macro_text): Lower the needed max
buffer size.
(cpp_quote_string): Don't octalify non printable
charactors.
2005-11-03 Joseph S. Myers <joseph@codesourcery.com>
PR c++/17964
* include/cpplib.h (struct cpp_options): Add client_diagnostic.
(struct cpp_callbacks): Add error.
* errors.c (cpp_error): If client_diagnostic, use error callback.
* charset.c (convert_escape): Don't use %03o in diagnostic.
2005-10-21 James E Wilson <wilson@specifix.com>
PR preprocessor/15220
* files.c (_cpp_find_file): New parameter angle_brackets. Fix all
callers. Pass to open_file_failed.
(open_file_failed): New parameter angle_brackets. Fix all callers.
Use in print_dep assignment.
* init.c (cpp_read_main_file): Pass additional arg to _cpp_find_file.
* internal.h (_cpp_find_file): Add new parm to declaration.
2005-10-08 Kazu Hirata <kazu@codesourcery.com>
* configure.ac: Require 64-bit int for arm*-*-*eabi*.
* configure: Regenerate.
2005-10-04 Ian Lance Taylor <ian@airs.com>
PR preprocessor/13726
* directives.c (check_eol_return_comments): New static function.
(parse_include): Add buf parameter. Change all callers.
(do_include_common): If not discard comments, turn on
save_comments. Pass collected comments to include callback.
* include/cpplib.h (struct cpp_callbacks): Add new parameter to
include callback: cpp_token list.
2005-09-20 Joseph S. Myers <joseph@codesourcery.com>
* include/cpplib.h (struct cpp_options): Add extended_identifiers.
* init.c (struct lang_flags, lang_defaults): Add
extended_identifiers.
(cpp_set_lang): Use it.
* lex.c (forms_identifier_p): Check extended_identifiers.
2005-08-30 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/20348
PR preprocessor/20356
* files.c (_cpp_find_file, search_cache): Revert 2004-06-26 and
2004-06-05 changes.
2005-07-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* configure.ac (ACX_PROG_CC_WARNING_OPTS): add
-Wmissing-format-attribute.
* configure: Regenerate.
2005-06-29 Kelley Cook <kcook@gcc.gnu.org>
* all files: Update FSF address in copyright headers.
* makeucnid.c (write_copyright): Update outputted FSF address.
2005-06-13 Zack Weinberg <zack@codesourcery.com>
* configure.ac: Invoke ZW_CREATE_DEPDIR and
ZW_PROG_COMPILER_DEPENDENCIES.
* aclocal.m4, configure: Regenerate.
* Makefile.in (DEPMODE, DEPDIR, depcomp, COMPILE.base, COMPILE):
New variables.
(distclean): Clean up $(DEPDIR) and its contents.
(.c.o): Use $(COMPILE).
Include $(DEPDIR)/*.Po for most object->header dependencies.
2005-05-28 Gabriel Dos Reis <gdr@integrable-solutions.net>
* configure.ac: Check declarations for asprintf and vasprintf.
* config.in: Regenerate.
* configure: Likewise.
* charset.c (conversion_loop): Use XRESIZEVEC.
(convert_no_conversion): Likewise.
(convert_using_iconv): Likewise.
(init_iconv_desc): Cast return value of alloca.
(cpp_host_to_exec_charset): Use XNEWVEC.
(emit_numeric_escape): Use XRESIZEVEC.
(cpp_interpret_string): Use XNEWVEC.
(cpp_interpret_string): Use XRESIZEVEC.
(_cpp_interpret_identifier): Cast return value of alloca.
(_cpp_convert_input): Use XNEWVEC and XRESIZEVEC.
* directives.c (glue_header_name): Use XNEWVEC and XRESIZEVEC.
(parse_include): Use XNEWVEC.
(insert_pragma_entry): Rename local variable "new" to
"new_entry".
(save_registered_pragmas): Cast return value of xmemdup.
(destringize_and_run): Same for alloca.
(parse_assertion): Likewise.
(do_assert): Cast allocated storage to proper type.
(cpp_define): Likewise.
(_cpp_define_builtin): Likewise.
(cpp_undef): Likewise.
(handle_assertion): Likewise.
(cpp_push_buffer): Rename local variable "new" to "new_buffer".
* expr.c (CPP_UPLUS): Cast value to type cpp_ttype.
(CPP_UMINUS): Likewise.
(struct cpp_operator): Rename from struct operator.
(_cpp_expand_op_stack): Use XRESIZEVEC.
* files.c (pch_open_file): Use XNEWVEC.
(pch_open_file): Use XRESIZEVEC.
(read_file_guts): Use XNEWVEC and XRESIZEVEC.
(dir_name_of_file): Use XNEWVEC.
(make_cpp_file): Use XCNEW.
(make_cpp_dir): Likewise.
(allocate_file_hash_entries): USE XNEWVEC.
(cpp_included): Cast return value of htab_find_with_hash.
(append_file_to_dir): Use XNEWVEC.
(read_filename_string): Likewise. Use XRESIZEVEC too.
(read_name_map): Cast return value of alloca. Use XRESIZEVEC.
(remap_filename): Use XNEWVEC.
(struct pchf_entry): Move definition out of struct pchf_data.
(_cpp_save_file_entries): Use XCNEWVAR.
(_cpp_read_file_entries): Use XNEWVAR.
* identifiers.c (alloc_node): Use XOBNEW.
* init.c (cpp_create_reader): Use XCNEW.
(cpp_init_builtins): Cast of b->value to enum builtin_type.
(read_original_directory): Cast return value of alloca.
* lex.c (add_line_note): Use XRESIZEVEC.
(warn_about_normalization): Use XNEWVEC.
(_cpp_lex_direct): Cast node->directive_index to (enum cpp_ttype).
(new_buff): Use XNEWVEC.
* line-map.c (linemap_add): Use XRESIZEVEC.
* macro.c (builtin_macro): Cast return value of alloca.
(paste_tokens): Likewise.
(expand_arg): Use XNEWVEC and XRESIZEVEC.
(_cpp_save_parameter): Use XRESIZEVEC.
(create_iso_definition): Cast allocated storage to proper type.
(_cpp_create_definition): Likewise.
(cpp_macro_definition): Use XRESIZEVEC.
* makedepend.c (add_clm): Use XNEW.
(add_dir): Likewise.
* mkdeps.c (munge): Use XNEWVEC.
(deps_init): Use XCNEW.
(deps_add_target): Use XRESIZEVEC.
(deps_add_default_target): Cast return value of alloca.
(deps_add_dep): Use XRESIZEVEC.
(deps_add_vpath): Likewise. Use XNEWVEC too.
(deps_restore): Likewise.
* pch.c (save_idents): Use XNEW and XNEWVEC.
(cpp_save_state): Use XNEW.
(count_defs): Cast return value of htab_find.
(write_defs): Likewise.
(cpp_write_pch_deps): Use XNEWVEC.
(collect_ht_nodes): Use XRESIZEVEC.
(cpp_valid_state): Use XNEWVEC.
(save_macros): Use XRESIZEVEC. Cast return value of xmemdup.
* symtab.c (ht_create): Use XCNEW.
(ht_lookup_with_hash): Cast return value of obstack_copy0.
(ht_expand): Use XCNEWVEC.
* system.h (HAVE_DESIGNATED_INITIALIZERS): False if __cplusplus.
(bool): Do not define if __cplusplus.
2005-05-12 Zack Weinberg <zack@codesourcery.com>
* directives.c (#sccs table entry): Mark IN_I, consistent with #ident.
(do_sccs): Delete function definition, #define to do_ident.
(do_ident): Don't hardwire directive name.
2005-05-12 Ryota Kunisawa <kunisawa@access.co.jp>
PR bootstrap/21230
* configure: Regenerate.
2005-04-27 Andris Pavenis <pavenis@latnet.lv>
* files.c: Include io.h for DJGPP to get prototype of setmode.
2005-04-19 Per Bothner <per@bothner.com>
PR preprocessor/20907
* line-map.c (linemap_line_start): Fix bug when we need to increse
column_bits but can re-use the current line_map.
2005-04-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* system.h (fopen, fdopen, freopen): Define these to the unlocked
libiberty functions.
2005-04-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* configure.ac (libcpp_UNLOCKED_FUNCS): New.
(AC_CHECK_FUNCS, AC_CHECK_DECLS): Check for libcpp_UNLOCKED_FUNCS.
* system.h (putchar, getc, getchar, clearerr, feof, fileno,
fflush, fgetc, fgets, ferror, fread): Redefine to the associated
_unlocked function.
(fwrite_unlocked): Fix prototype.
* configure, config.in: Regenerate.
2005-04-05 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/19475
* macro.c (create_iso_definition): For < ISO C99, don't
pedwarn if there is no whitespace between macro name and its
replacement, but the replacement starts with a basic character
set character.
2005-03-28 Andreas Jaeger <aj@suse.de>
* lex.c (warn_about_normalization): Cast field width to int to
avoid warning.
2005-03-19 Joseph S. Myers <joseph@codesourcery.com>
* configure.ac: Consistently use solaris2.1[0-9]* instead of
solaris2.1[0-9].
* configure: Regenerate.
2005-03-15 Geoffrey Keating <geoffk@apple.com>
* charset.c (_cpp_valid_ucn): In identifiers, reject a partial
UCN rather than printing an error.
2005-03-14 Geoffrey Keating <geoffk@apple.com>
* lex.c (forms_identifier_p): Disable UCNs in C89 mode.
2005-03-14 Geoffrey Keating <geoffk@apple.com>
* init.c (cpp_create_reader): Default warn_normalize to normalized_C.
* charset.c: Update for new format of ucnid.h.
(ucn_valid_in_identifier): Update for new format of ucnid.h.
Add NST parameter, and update it; update callers.
(cpp_valid_ucn): Add NST parameter, update callers. Replace abort
with cpp_error.
(convert_ucn): Pass normalize_state to cpp_valid_ucn.
* internal.h (struct normalize_state): New.
(INITIAL_NORMALIZE_STATE): New.
(NORMALIZE_STATE_RESULT): New.
(NORMALIZE_STATE_UPDATE_IDNUM): New.
(_cpp_valid_ucn): New.
* lex.c (warn_about_normalization): New.
(forms_identifier_p): Add normalize_state parameter, update callers.
(lex_identifier): Add normalize_state parameter, update callers. Keep
the state current.
(lex_number): Likewise.
(_cpp_lex_direct): Pass normalize_state to subroutines. Check
it with warn_about_normalization.
* makeucnid.c: New.
* ucnid.h: Replace.
* ucnid.pl: Remove.
* ucnid.tab: Make appropriate for input to makeucnid.c. Remove
comments about obsolete version of C++.
* include/cpplib.h (enum cpp_normalize_level): New.
(struct cpp_options): Add warn_normalize field.
2005-03-11 Geoffrey Keating <geoffk@apple.com>
* directives.c (glue_header_name): Update call to cpp_spell_token.
* internal.h (_cpp_interpret_identifier): New.
* charset.c (_cpp_interpret_identifier): New.
(_cpp_valid_ucn): Allow UCN version of '$'.
* lex.c (lex_identifier): Add extra parameter to indicate if initial
character was '$' or '\'. Support identifiers with UCNs.
(forms_identifier_p): Allow UCNs.
(_cpp_lex_direct): Pass extra parameter to lex_identifier.
(utf8_to_ucn): New.
(cpp_spell_token): Add FORSTRING parameter. Use it.
(cpp_token_as_text): Update call to cpp_spell_token.
(cpp_output_token): Write UCNs back out.
(stringify_arg): Update call to cpp_spell_token.
(paste_tokens): Likewise.
(cpp_macro_definition): Likewise.
* macro.c (stringify_arg): Likewise.
(paste_tokens): Likewise.
(cpp_macro_definition): Likewise.
* include/cpplib.h: Add parameter to cpp_spell_token.
2005-03-04 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/20282
PR bootstrap/20305
* macro.c (replace_args, cpp_get_token): Copy whole
cpp_token_u instead of just cpp_string field from it.
2005-02-28 Devang Patel <dpatel@apple.com>
* directives.c (do_line): Save sysp early before line table is
realloc'ed.
2005-02-20 Zack Weinberg <zack@codesourcery.com>
PR 18785
* charset.c (LAST_POSSIBLY_BASIC_SOURCE_CHAR): New helper macro.
(cpp_host_to_exec_charset): New function.
* include/cpplib.h: Declare cpp_host_to_exec_charset.
2005-02-19 Devang Patel <dpatel@apple.com>
* charset.c (_cpp_convert_input): Check '\r' before inserting
'\n' at the end.
2005-02-15 Eric Christopher <echristo@redhat.com>
PR preprocessor/19077
* macro.c (cpp_macro_definition): Move handling of whitespace
to PREV_WHITE conditional. Remove overloading of len
variable.
2005-02-14 Kazu Hirata <kazu@cs.umass.edu>
* directives.c, files.c, init.c, internal.h, macro.c, pch.c,
traditional.c: Update copyright.
2005-02-14 Paolo Bonzini <bonzini@gnu.org>
PR bootstrap/19818
* configure.ac: Check for declaration of basename and getopt.
* config.in: Regenerate.
* configure: Regenerate.
* internal.h (ustrcspn): New.
* macro.c (create_iso_definition): Fix allocation of memory.
(padding_token): Add cast to remove const-ness.
* pch.c (cpp_read_state): Use ustrcspn.
2005-02-08 Mike Stump <mrs@apple.com>
* files.c (pchf_adder): Remove.
(struct pchf_adder_info): Likewise.
(_cpp_save_file_entries): Write out all files so that #import works.
2005-01-23 Joseph S. Myers <joseph@codesourcery.com>
* configure: Regenerate.
2005-01-11 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
* include/cpplib.h (c_lang): Fix comment to say cpp_create_reader.
* include/cpplib.h: Also update copyright years.
2005-01-03 Geoffrey Keating <geoffk@apple.com>
* files.c (_cpp_find_file): Add files found by search_path_exhausted
to the list of all files.
2005-01-01 Gabriel Dos Reis <gdr@integrable-solutions.net>
* internal.h: Update references to Cpp lib filenames.
* directives.c: Likewise.
* init.c: Likewise.
* macro.c: Likewise.
* traditional.c: Likewise.
2004-12-15 Eric Botcazou <ebotcazou@libertysurf.fr>
PR preprocessor/15167
* files.c (destroy_cpp_file): New function.
(should_stack_file): Make a new file if the
compared file is still stacked.
2004-11-28 Nathanael Nerode <neroden@gcc.gnu.org>
PR preprocessor/17610
* directives.c (do_include_common): Error out if an empty filename
is given for #include (or #include_next or #import).
2004-11-27 Roger Sayle <roger@eyesopen.com>
Zack Weinberg <zack@codesourcery.com>
* internal.h: Replace all uses of uchar with unsigned char.
* include/cpp-id-data.h: Likewise. Guard typedef of uchar
with !IN_GCC, so uchar is only defined whilst building libcpp.
2004-11-24 Kelley Cook <kcook@gcc.gnu.org>
* aclocal.m4: Regenerate.
2004-11-24 Roger Sayle <roger@eyesopen.com>
PR preprocessor/15824
* configure.ac: Correct HAVE_UCHAR test to #include <sys/types.h>
directly, instead of the non-existant "system.h" and "ansidecl.h".
* configure: Regenerate.
2004-11-23 Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* internal.h (struct lexer_state): Add in_deferred_pragma.
* directives.c (struct pragma_entry): Add allow_expansion.
(insert_pragma_entry): Take allow_expansion flag.
(register_pragma): Likewise.
(cpp_register_pragma): Likewise.
(_cpp_init_internal_pragmas): Update calls to cpp_register_pragma.
(do_pragma): Honor allow_expansion.
(cpp_handle_deferred_pragma): Set in_deferred_pragma.
* include/cpplib.h (cpp_register_pragma): Update prototype.
2004-11-18 Daniel Jacobowitz <dan@codesourcery.com>
Mark Mitchell <mark@codesourcery.com>
* configure.ac (i[34567]86-*-solaris2.1[0-9]*): Set
need_64bit_hwint=yes.
* configure: Regenerate.
2004-11-09 Joseph S. Myers <joseph@codesourcery.com>
* Makefile.in ($(PACKAGE).pot): New rule. Depend on
po/$(PACKAGE).pot.
(po/$(PACKAGE).pot): Use ":" instead of "," in --keyword
arguments. Add keywords _, N_, SYNTAX_ERROR and SYNTAX_ERROR2.
Remove local srcdir path from generated file.
2004-11-04 Zack Weinberg <zack@codesourcery.com>
Gerald Pfeifer <gerald@pfeifer.com>
* internal.h (HAVE_ICONV): Undefine if we do not have HAVE_ICONV_H
as well.
2004-10-27 Zack Weinberg <zack@codesourcery.com>
PR 18075
* directives.c (do_pragma): Do not defer pragmas which are unknown.
(cpp_handle_deferred_pragma): Add cast to silence warning.
2004-10-14 Joseph S. Myers <jsm@polyomino.org.uk>
* errors.c (_cpp_begin_message): Print "error: " for errors.
2004-10-10 Andreas Jaeger <aj@suse.de>
* makedepend.c: Include mkdeps.h for prototype of deps_add_vpath.
* Makefile.in (makedepend.o): Add dependency on mkdeps.h.
2004-10-08 Andrew Pinski <pinskia@physics.uc.edu>
* pch.c (cpp_write_pch_state): Remove variable z as it is not
used.
(cpp_read_state): Remove unused variables, m, d and mac_count.
2004-09-29 Per Bothner <per@bothner.com>
* directives.c (cpp_handle_deferred_pragma): Save, clear and restore
cb.line_change. Otherwise do_pragma will call the line_change
call-back with a meaningless line number.
2004-09-24 Zack Weinberg <zack@codesourcery.com>
* configure.ac: Move AC_PROG_MAKE_SET, AC_PROG_INSTALL to
programs cluster. Use ACX_PROG_CC_WARNING_OPTS,
ACX_PROG_CC_WARNING_ALMOST_PEDANTIC, ACX_PROG_CC_WARNINGS_ARE_ERRORS.
* aclocal.m4, configure: Regenerate.
* init.c: Include localedir.h.
* Makefile.in (WARN_CFLAGS, ALL_CFLAGS): New variables.
(DEFS): Delete.
(.c.o): Use $(ALL_CFLAGS).
(localedir.h, localedir.hs): New rules.
(clean): Use rm -rf to remove directories.
(distclean): Also delete localedir.h and localedir.hs.
(init.o): Update dependencies.
2004-09-22 Kelley Cook <kcook@gcc.gnu.org>
* Makefile.in (aclocal.m4): Update dependencies.
* configure.ac (AC_CONFIG_MACRO_DIR): New.
* aclocal.m4, configure: Regenerate.
2004-09-17 Zack Weinberg <zack@codesourcery.com>
* charset.c (_cpp_destroy_iconv, emit_numeric_escape)
(_cpp_convert_input, _cpp_default_encoding): Add comments.
Some other comments in this file also tweaked.
* directives.c (do_pragma): Save current buffer position
before lexing the pragma keywords; don't call
_cpp_backup_tokens in the defer_pragmas case.
2004-09-15 Per Bothner <per@bothner.com>
* include/line-map.h (line_map_start): Add parameter names so
preceding comment makes sense.
(linemap_add): Remove from comment mention of non-existing parameter.
2004-09-09 Matt Austern <austern@apple.com>
Zack Weinberg <zack@codesourcery.com>
* include/cpplib.h (TTYPE_TABLE): Remove CPP_ and SPELL_
prefixes throughout. Add entry for PRAGMA. Remove
unnecessary "= 0" from EQ.
(enum cpp_ttype): Adjust OP and TK definitions to restore
prefixes, via token-paste.
(CPP_LAST_EQ, CPP_FIRST_DIGRAPH, CPP_LAST_PUNCTUATOR, CPP_LAST_CPP_OP):
Change from #defines to additional cpp_ttype enumerators.
(struct cpp_options): Add defer_pragmas.
(cpp_handle_deferred_pragma): Prototype new interface.
* internal.h (struct cpp_reader): Add directive_result.
* directives.c (struct pragma_entry): Add is_internal field;
give boolean fields type bool.
(start_directive): Initialize pfile->directive_result.type.
(_cpp_do__Pragma): Likewise.
(run_directive): Do not crash if pfile->buffer->prev is NULL.
(insert_pragma_entry): Add 'internal' argument; set new->is_internal
from it.
(register_pragma): New static function, bulk of former
cpp_register_pragma here; add 'internal' argument, pass along
to insert_pragma_entry.
(cpp_register_pragma): Now a wrapper around register_pragma which
always passes false for 'internal' argument.
(_cpp_init_internal_pragmas): Call register_pragma directly, passing
true for 'internal'.
(do_pragma): If CPP_OPTION (pfile, defer_pragmas) and this isn't
an internal pragma, save text till the end of the line as a CPP_PRAGMA
token instead of executing the pragma.
(cpp_handle_deferred_pragma): New interface.
* lex.c (token_spellings): Adjust OP and TK definitions to
match changes to cpplib.h.
(_cpp_lex_token): Check for a directive-result token and
return it if present.
(cpp_token_val_index): Handle CPP_PRAGMA.
* macro.c (cpp_builtin_macro_text): Correct comment.
(builtin_macro): Handle directive-result tokens from _cpp_do__Pragma.
2004-09-06 Serge Belyshev <belyshev@lubercy.com>
PR preprocessor/14699
* symtab.c (ht_dump_statistics): Change type of sum_of_squares
from size_t to double.
2004-08-28 Andreas Schwab <schwab@suse.de>
Andreas Jaeger <aj@suse.de>
* configure.ac: Set PACKAGE correctly.
* configure: Regenerated.
2004-08-25 Paolo Bonzini <bonzini@gnu.org>
* Makefile.in: Add back top_builddir.
2004-08-25 Paolo Bonzini <bonzini@gnu.org>
* configure.ac: Replace Automake macro invocations
with manual Autoconf checks and substitutions.
* configure: Regenerate.
* aclocal.m4: Regenerate.
* config.in: Regenerate.
* Makefile.am: Removed.
* Makefile.in: Heavy simplification and reorganization.
2004-08-09 Mark Mitchell <mark@codesourcery.com>
* configure.ac (arm*-*-eabi*): New target.
(arm*-*-symbianelf*): Likewise.
* configure: Regenerated.
2004-07-24 Bernardo Innocenti <bernie@develer.com>
* internal.h (xnew, xcnew, xnewvec, xcnewvec, xobnew): Remove.
* directives.c: Use XNEW-family macros from libiberty.
* lex.c: Likewise.
* macro.c: Likewise.
* cpplib.h (cpp_deps_style): Export enum with name.
2004-07-23 Matthias Klose <doko@debian.org>
* init.c (init_library): Use PACKAGE for the text domain.
2004-07-16 Andris Pavenis <pavenis@latnet.lv>
PR preprocessor/16366
* internal.h (struct cpp_reader): New field dir_hash.
* files.c (make_cpp_dir): Use dir_hash, not file_hash.
(_cpp_init_files, _cpp_cleanup_files): Update for new field.
2004-07-04 Neil Booth <neil@duron.akihabara.co.uk>
PR preprocessor/16192
PR preprocessor/15913
PR preprocessor/15572
* expr.c (_cpp_parse_expr): Handle remaining cases where an
expression is missing.
* init.c (post_options): Traditional cpp doesn't do // comments.
2004-06-30 Per Bothner <per@bothner.com>
* include/line-map.h (fileline): Remove old typedef.
* internal.h (struct cpp_reader): Use source_location typedef instead.
2004-06-26 Zack Weinberg <zack@codesourcery.com>
Partially revert patch of 2004-06-05.
* files.c (search_cache): Remove pfile argument. Don't check
for file that would be found by "" or <> search here...
(_cpp_find_file): ...do it here, before calling find_file_in_dir.
Do not apply directory-of-current-file correction to files
found by this check. Rearrange code slightly.
2004-06-21 Geoffrey Keating <geoffk@apple.com>
* files.c (should_stack_file): Correct swapped parameters to call
to cb.read_pch.
* pch.c (cpp_valid_state): Handle -fpreprocessed.
2004-06-15 Paolo Bonzini <bonzini@gnu.org>
* Makefile.in: Regenerate with automake 1.8.5.
* aclocal.m4: Likewise.
* configure: Regenerate.
2004-06-11 Zack Weinberg <zack@codesourcery.com>
* configure.ac: Don't invoke ACX_HEADER_STDBOOL.
* configure, config.in: Regenerate.
* system.h: Unconditionally define bool as unsigned char,
BOOL_BITFIELD as unsigned int.
* .cvsignore: New file.
2004-06-09 Geoffrey Keating <geoffk@apple.com>
* traditional.c (push_replacement_text): Set macro->traditional.
(save_replacement_text): Likewise.
* pch.c (cpp_write_pch_state): Don't write list of defined macros.
(struct save_macro_item): Delete.
(struct save_macro_data): Use a character array not the previous
structured format.
(save_macros): Save macro as text not as internal structures.
(cpp_prepare_state): Update for changes to save_macro_data.
(cpp_read_state): Don't read macros defined in PCH. Restore
-D macros as text.
* macro.c (create_iso_definition): Honour alloc_subobject.
Clear traditional flag.
(_cpp_create_definition): Honour alloc_subobject.
* lex.c (cpp_token_val_index): New.
* internal.h: Include cpp-id-data.h.
(uchar): Move definition to cpp-id-data.h.
(U): Likewise.
(cpp_macro): Likewise.
* directives.c (struct answer): Move to cpp-id-data.h.
(do_assert): Honour alloc_subobject.
* include/symtab.h (struct ht): Add field 'alloc_subobject'.
* include/cpplib.h (struct cpp_string): Add GTY marker.
(enum cpp_token_fld_kind): New.
(struct cpp_token): Add GTY markers.
(cpp_token_val_index): Prototype.
(CPP_HASHNODE_VALUE_IDX): New.
(struct cpp_hashnode): Don't skip fields of 'value' when marking.
* include/cpp-id-data.h: New file.
2004-06-09 Paolo Bonzini <bonzini@gnu.org>
* Makefile.am (all-local): New.
* Makefile.in: Regenerate.
2004-06-06 Roger Sayle <roger@eyesopen.com>
* Makefile.am (LIBICONV): Declare.
(makedepend_LDADD): Use LIBICONV.
* Makefile.in: Regenerate.
2004-06-05 Andrew Pinski <pinskia@physics.uc.edu>
* Makefile.am (LIBINTL): Declare
(makedepend_LDADD): Use LIBINTL.
* Makefile.in: Regenerate.
2004-06-05 Zack Weinberg <zack@codesourcery.com>
* Makefile.am: Add makedepend.
* Makefile.in, aclocal.m4: Regenerate.
* charset.c: Insert a space to avoid a warning.
* directives.c: Include mkdeps.h.
(_cpp_handle_directive): Reenable macro expander if appropriate.
(undefine_macros): Inline body of _cpp_free_definition for speed.
Do not call undef callback or _cpp_warn_if_unused_macro.
(cpp_get_deps): New interface.
* files.c (search_cache): Add pfile argument. Check for file
that would be found by "" or <> search here...
(_cpp_find_file): ...not here. Correct recorded start_dir of
files found by directory-of-current-file search that would be
found by "" or <> search.
* init.c (cpp_add_dependency_target): Delete.
* internal.h (struct lexer_state): Add discarding_output flag.
* lex.c (lex_identifier): Compute hash function while scanning.
* macro.c (cpp_scan_nooutput): Disable macro expansion outside
directives.
* makedepend.c: New file.
* mkdeps.c (struct deps): Add vpath vector.
(apply_vpath, deps_add_vpath): New function.
(deps_free): Free vpath vector.
(deps_add_dep, deps_add_target): Use apply_vpath.
* symtab.c (calc_hash): Use HT_HASHSTEP and HT_FINISH.
(ht_lookup_with_hash): New function.
* cpplib.h, mkdeps.h: Update prototypes.
* symtab.h: Update prototypes.
(HT_HASHSTEP, HT_FINISH): New macros.
2004-05-29 Geoffrey Keating <geoffk@apple.com>
* symtab.c (ht_create): Set entries_owned.
(ht_destroy): Honour entries_owned.
(ht_expand): Likewise.
(ht_load): New.
* include/symtab.h (struct ht): New field 'entries_owned'
(ht_load): New prototype.
2004-05-26 Paolo Bonzini <bonzini@gnu.org>
PR bootstrap/15651
* configure.ac: Fix m4 quoting when picking
the size of HOST_WIDE_INT.
* configure: Regenerate.
2004-05-25 Paolo Bonzini <bonzini@gnu.org>
* Makefile.am: the correct directory for
gettext include files is given by @INCINTL@.
* Makefile.in: Regenerate.
2004-05-24 Paolo Bonzini <bonzini@gnu.org>
* system.h [!ENABLE_NLS]: dgettext takes two
parameters.
2004-05-23 Paolo Bonzini <bonzini@gnu.org>
Moved libcpp from the gcc subdirectory to the toplevel.
* Makefile.am: New file.
* Makefile.in: Regenerate.
* configure.ac: New file.
* configure: Regenerate.
* config.in: Regenerate.
* charset.c: Moved from gcc/cppcharset.c. Add note about
brokenness of input charset detection. Adjust for change
in name of cppucnid.h.
* errors.c: Moved from gcc/cpperror.c. Do not include intl.h.
* expr.c: Moved from gcc/cppexp.c.
* files.c: Moved from gcc/cppfiles.c. Do not include intl.h.
Remove #define of O_BINARY, it is in system.h.
* identifiers.c: Moved from gcc/cpphash.c.
* internal.h: Moved from gcc/cpphash.h. Change header
guard name. All other files adjusted to match name change.
* init.c: Moved from gcc/cppinit.c.
(init_library) [ENABLE_NLS]: Call bindtextdomain.
* lex.c: Moved from gcc/cpplex.c.
* directives.c: Moved from gcc/cpplib.c.
* macro.c: Moved from gcc/cppmacro.c.
* pch.c: Moved from gcc/cpppch.c. Do not include intl.h.
* traditional.c: Moved from gcc/cpptrad.c.
* ucnid.h: Moved from gcc/cppucnid.h. Change header
guard name.
* ucnid.pl: Moved from gcc/cppucnid.pl.
* ucnid.tab: Moved from gcc/cppucnid.tab. Change header
guard name.
* symtab.c: Moved from gcc/hashtable.c.
* line-map.c: Moved from gcc. Do not include intl.h.
* mkdeps.c: Moved from gcc.
* system.h: New file.
* include/cpplib.h: Moved from gcc. Change header guard name.
* include/line-map.h: Moved from gcc. Change header guard name.
* include/mkdeps.h: Moved from gcc. Change header guard name.
* include/symtab.h: Moved from gcc/hashtable.h. Change header
guard name.

View File

@ -0,0 +1,249 @@
# @configure_input@
# Makefile for libcpp. Run 'configure' to generate Makefile from Makefile.in
# Copyright (C) 2004 Free Software Foundation, Inc.
#This file is part of libcpp.
#libcpp 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.
#libcpp 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 libcpp; see the file COPYING. If not, write to
#the Free Software Foundation, 51 Franklin Street, Fifth Floor,
#Boston MA 02110-1301, USA.
@SET_MAKE@
srcdir = @srcdir@
top_builddir = .
VPATH = @srcdir@
INSTALL = @INSTALL@
AR = ar
ARFLAGS = cru
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
CATALOGS = $(patsubst %,po/%,@CATALOGS@)
CC = @CC@
CFLAGS = @CFLAGS@
WARN_CFLAGS = @WARN_CFLAGS@ @WARN_PEDANTIC@ @WERROR@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
EXEEXT = @EXEEXT@
GMSGFMT = @GMSGFMT@
INCINTL = @INCINTL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
LDFLAGS = @LDFLAGS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
SHELL = @SHELL@
USED_CATALOGS = @USED_CATALOGS@
XGETTEXT = @XGETTEXT@
DEPMODE = @CCDEPMODE@
DEPDIR = @DEPDIR@
datadir = @datadir@
exec_prefix = @prefix@
libdir = @libdir@
localedir = $(datadir)/locale
prefix = @prefix@
MSGMERGE = msgmerge
mkinstalldirs = $(SHELL) $(srcdir)/../mkinstalldirs
depcomp = $(SHELL) $(srcdir)/../depcomp
INCLUDES = -I$(srcdir) -I. -I$(srcdir)/../include @INCINTL@ \
-I$(srcdir)/include
ALL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(INCLUDES) $(CPPFLAGS)
libcpp_a_OBJS = charset.o directives.o errors.o expr.o files.o \
identifiers.o init.o lex.o line-map.o macro.o mkdeps.o \
pch.o symtab.o traditional.o
makedepend_OBJS = makedepend.o
libcpp_a_SOURCES = charset.c directives.c errors.c expr.c files.c \
identifiers.c init.c lex.c line-map.c macro.c mkdeps.c \
pch.c symtab.c traditional.c
all: libcpp.a makedepend$(EXEEXT) $(USED_CATALOGS)
.SUFFIXES:
.SUFFIXES: .c .gmo .o .obj .po .pox
libcpp.a: $(libcpp_a_OBJS)
-rm -f libcpp.a
$(AR) $(ARFLAGS) libcpp.a $(libcpp_a_OBJS)
$(RANLIB) libcpp.a
makedepend$(EXEEXT): $(makedepend_OBJS) libcpp.a ../libiberty/libiberty.a
@rm -f makedepend$(EXEEXT)
$(CC) $(CFLAGS) $(LDFLAGS) -o makedepend$(EXEEXT) \
$(makedepend_OBJS) libcpp.a ../libiberty/libiberty.a \
$(LIBINTL) $(LIBICONV)
# Rules to rebuild the configuration
Makefile: $(srcdir)/Makefile.in config.status
$(SHELL) ./config.status Makefile
config.status: $(srcdir)/configure
$(SHELL) ./config.status --recheck
$(srcdir)/configure: @MAINT@ $(srcdir)/aclocal.m4
cd $(srcdir) && $(AUTOCONF)
$(srcdir)/aclocal.m4: @MAINT@ $(srcdir)/../config/acx.m4 \
$(srcdir)/../config/gettext-sister.m4 $(srcdir)/../config/iconv.m4 \
$(srcdir)/../config/codeset.m4 $(srcdir)/../config/lib-ld.m4 \
$(srcdir)/../config/lib-link.m4 $(srcdir)/../config/lib-prefix.m4 \
$(srcdir)/configure.ac
cd $(srcdir) && $(ACLOCAL) -I ../config
config.h: stamp-h1
test -f config.h || (rm -f stamp-h1 && $(MAKE) stamp-h1)
stamp-h1: $(srcdir)/config.in config.status
-rm -f stamp-h1
$(SHELL) ./config.status config.h
$(srcdir)/config.in: @MAINT@ $(srcdir)/configure
cd $(srcdir) && $(AUTOHEADER)
-rm -f stamp-h1
# It is not possible to get LOCALEDIR defined in config.h because
# the value it needs to be defined to is only determined in the
# Makefile. Hence we do this instead.
localedir.h: localedir.hs; @true
localedir.hs: Makefile
echo "#define LOCALEDIR \"$(localedir)\"" > localedir.new
$(srcdir)/../move-if-change localedir.new localedir.h
echo timestamp > localedir.hs
# Installation rules and other phony targets
# These rule has to look for .gmo modules in both srcdir and
# the cwd, and has to check that we actually have a catalog
# for each language, in case they weren't built or included
# with the distribution.
installdirs:
@$(mkinstalldirs) $(DESTDIR)$(datadir); \
cats="$(CATALOGS)"; for cat in $$cats; do \
lang=`basename $$cat | sed 's/\.gmo$$//'`; \
if [ -f $$cat ] || [ -f $(srcdir)/$$cat ]; then \
dir=$(localedir)/$$lang/LC_MESSAGES; \
$(mkinstalldirs) $(DESTDIR)$$dir || exit 1; \
fi; \
done
install-strip install: all installdirs
cats="$(CATALOGS)"; for cat in $$cats; do \
lang=`basename $$cat | sed 's/\.gmo$$//'`; \
if [ -f $$cat ]; then :; \
elif [ -f $(srcdir)/$$cat ]; then cat=$(srcdir)/$$cat; \
else continue; \
fi; \
dir=$(localedir)/$$lang/LC_MESSAGES; \
echo $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
$(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
done
mostlyclean:
-rm -f *.o
clean: mostlyclean
-rm -rf makedepend$(EXEEXT) libcpp.a $(srcdir)/autom4te.cache
distclean: clean
-rm -f config.h stamp-h1 config.status config.cache config.log \
configure.lineno configure.status.lineno Makefile localedir.h \
localedir.hs $(DEPDIR)/*.Po
-rmdir $(DEPDIR)
maintainer-clean: distclean
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-rm -f $(srcdir)/configure $(srcdir)/aclocal.m4
check:
installcheck:
dvi:
pdf:
html:
info:
install-info:
install-man:
install-html:
update-po: $(CATALOGS:.gmo=.pox)
.PHONY: installdirs install install-strip mostlyclean clean distclean \
maintainer-clean check installcheck dvi pdf html info install-info \
install-man update-po install-html
# Dependency rule.
COMPILE.base = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(ALL_CFLAGS) -c
ifeq ($(DEPMODE),depmode=gcc3)
COMPILE = $(COMPILE.base) -o $@ -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Po
else
COMPILE = source='$<' object='$@' libtool=no DEPDIR=$(DEPDIR) $(DEPMODE) \
$(depcomp) $(COMPILE.base)
endif
# Implicit rules and I18N
.c.o:
$(COMPILE) $<
# N.B. We do not attempt to copy these into $(srcdir).
.po.gmo:
-test -d po || mkdir po
$(GMSGFMT) --statistics -o $@ $<
# The new .po has to be gone over by hand, so we deposit it into
# build/po with a different extension.
# If build/po/$(PACKAGE).pot exists, use it (it was just created),
# else use the one in srcdir.
.po.pox:
-test -d po || mkdir po
$(MSGMERGE) $< `if test -f po/$(PACKAGE).pot; \
then echo po/$(PACKAGE).pot; \
else echo $(srcdir)/po/$(PACKAGE).pot; fi` -o $@
# Rule for regenerating the message template.
$(PACKAGE).pot: po/$(PACKAGE).pot
po/$(PACKAGE).pot: $(libcpp_a_SOURCES)
-test -d $(srcdir)/po || mkdir $(srcdir)/po
$(XGETTEXT) --default-domain=$(PACKAGE) \
--keyword=_ --keyword=N_ \
--keyword=cpp_error:3 --keyword=cpp_errno:3 \
--keyword=cpp_error_with_line:5 \
--keyword=SYNTAX_ERROR --keyword=SYNTAX_ERROR2 \
--copyright-holder="Free Software Foundation, Inc." \
--msgid-bugs-address="http://gcc.gnu.org/bugs.html" \
--language=c -o po/$(PACKAGE).pot.tmp $^
sed 's:$(srcdir)/::g' <po/$(PACKAGE).pot.tmp >po/$(PACKAGE).pot
rm po/$(PACKAGE).pot.tmp
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
# Dependencies
-include $(patsubst %.o, $(DEPDIR)/%.Po, $(libcpp_a_OBJS) $(makedepend_OBJS))
# Dependencies on generated headers have to be explicit.
init.o: localedir.h

23
contrib/gcclibs/libcpp/aclocal.m4 vendored Normal file
View File

@ -0,0 +1,23 @@
# generated automatically by aclocal 1.9.3 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
# Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_include([../config/acx.m4])
m4_include([../config/codeset.m4])
m4_include([../config/depstand.m4])
m4_include([../config/gettext-sister.m4])
m4_include([../config/iconv.m4])
m4_include([../config/lead-dot.m4])
m4_include([../config/lib-ld.m4])
m4_include([../config/lib-link.m4])
m4_include([../config/lib-prefix.m4])
m4_include([../config/warnings.m4])

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,282 @@
/* config.in. Generated from configure.ac by autoheader. */
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
#undef CRAY_STACKSEG_END
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* Define if you want more run-time sanity checks. */
#undef ENABLE_CHECKING
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
/* Define to 1 if you have `alloca', as a function or macro. */
#undef HAVE_ALLOCA
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the `clearerr_unlocked' function. */
#undef HAVE_CLEARERR_UNLOCKED
/* Define to 1 if you have the declaration of `abort', and to 0 if you don't.
*/
#undef HAVE_DECL_ABORT
/* Define to 1 if you have the declaration of `asprintf', and to 0 if you
don't. */
#undef HAVE_DECL_ASPRINTF
/* Define to 1 if you have the declaration of `basename', and to 0 if you
don't. */
#undef HAVE_DECL_BASENAME
/* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_CLEARERR_UNLOCKED
/* Define to 1 if you have the declaration of `errno', and to 0 if you don't.
*/
#undef HAVE_DECL_ERRNO
/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you
don't. */
#undef HAVE_DECL_FEOF_UNLOCKED
/* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FERROR_UNLOCKED
/* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FFLUSH_UNLOCKED
/* Define to 1 if you have the declaration of `fgetc_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FGETC_UNLOCKED
/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FGETS_UNLOCKED
/* Define to 1 if you have the declaration of `fileno_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FILENO_UNLOCKED
/* Define to 1 if you have the declaration of `fprintf_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FPRINTF_UNLOCKED
/* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FPUTC_UNLOCKED
/* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FPUTS_UNLOCKED
/* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FREAD_UNLOCKED
/* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_FWRITE_UNLOCKED
/* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_GETCHAR_UNLOCKED
/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
don't. */
#undef HAVE_DECL_GETC_UNLOCKED
/* Define to 1 if you have the declaration of `getopt', and to 0 if you don't.
*/
#undef HAVE_DECL_GETOPT
/* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if
you don't. */
#undef HAVE_DECL_PUTCHAR_UNLOCKED
/* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you
don't. */
#undef HAVE_DECL_PUTC_UNLOCKED
/* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
don't. */
#undef HAVE_DECL_VASPRINTF
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the `feof_unlocked' function. */
#undef HAVE_FEOF_UNLOCKED
/* Define to 1 if you have the `ferror_unlocked' function. */
#undef HAVE_FERROR_UNLOCKED
/* Define to 1 if you have the `fflush_unlocked' function. */
#undef HAVE_FFLUSH_UNLOCKED
/* Define to 1 if you have the `fgetc_unlocked' function. */
#undef HAVE_FGETC_UNLOCKED
/* Define to 1 if you have the `fgets_unlocked' function. */
#undef HAVE_FGETS_UNLOCKED
/* Define to 1 if you have the `fileno_unlocked' function. */
#undef HAVE_FILENO_UNLOCKED
/* Define to 1 if you have the `fprintf_unlocked' function. */
#undef HAVE_FPRINTF_UNLOCKED
/* Define to 1 if you have the `fputc_unlocked' function. */
#undef HAVE_FPUTC_UNLOCKED
/* Define to 1 if you have the `fputs_unlocked' function. */
#undef HAVE_FPUTS_UNLOCKED
/* Define to 1 if you have the `fread_unlocked' function. */
#undef HAVE_FREAD_UNLOCKED
/* Define to 1 if you have the `fwrite_unlocked' function. */
#undef HAVE_FWRITE_UNLOCKED
/* Define to 1 if you have the `getchar_unlocked' function. */
#undef HAVE_GETCHAR_UNLOCKED
/* Define to 1 if you have the `getc_unlocked' function. */
#undef HAVE_GETC_UNLOCKED
/* Define if you have the iconv() function. */
#undef HAVE_ICONV
/* Define to 1 if you have the <iconv.h> header file. */
#undef HAVE_ICONV_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
#undef HAVE_LANGINFO_CODESET
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if libc includes obstacks. */
#undef HAVE_OBSTACK
/* Define to 1 if you have the `putchar_unlocked' function. */
#undef HAVE_PUTCHAR_UNLOCKED
/* Define to 1 if you have the `putc_unlocked' function. */
#undef HAVE_PUTC_UNLOCKED
/* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define if <sys/types.h> defines \`uchar'. */
#undef HAVE_UCHAR
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the widest efficient host integer type at least as wide as the
target's size_t type. */
#undef HOST_WIDE_INT
/* Define as const if the declaration of iconv() needs const. */
#undef ICONV_CONST
/* Define to the name of this package. */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of a `int', as computed by sizeof. */
#undef SIZEOF_INT
/* The size of a `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you can safely include both <string.h> and <strings.h>. */
#undef STRING_WITH_STRINGS
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
/* Define to `long' if <sys/types.h> does not define. */
#undef off_t
/* Define to `unsigned' if <sys/types.h> does not define. */
#undef size_t

9562
contrib/gcclibs/libcpp/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,151 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(cpplib, [ ], gcc-bugs@gcc.gnu.org, cpplib)
AC_CONFIG_SRCDIR(ucnid.h)
AC_CONFIG_MACRO_DIR(../config)
AC_CANONICAL_SYSTEM
# Checks for programs.
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_CC
AC_PROG_RANLIB
MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
AC_CHECK_PROGS([ACLOCAL], [aclocal], [$MISSING aclocal])
AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf])
AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader])
# Figure out what compiler warnings we can enable.
# See config/warnings.m4 for details.
ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wold-style-definition \
-Wmissing-format-attribute])
ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
# Only enable with --enable-werror-always until existing warnings are
# corrected.
ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
# Dependency checking.
ZW_CREATE_DEPDIR
ZW_PROG_COMPILER_DEPENDENCIES([CC])
# Checks for header files.
AC_HEADER_TIME
ACX_HEADER_STRING
AC_CHECK_HEADERS(iconv.h locale.h fcntl.h limits.h stddef.h \
stdlib.h strings.h string.h sys/file.h unistd.h)
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_FUNC_OBSTACK
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
define(libcpp_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl
fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl
fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
putchar_unlocked putc_unlocked)
AC_CHECK_FUNCS(libcpp_UNLOCKED_FUNCS)
AC_CHECK_DECLS(m4_split(m4_normalize(abort asprintf basename errno getopt \
libcpp_UNLOCKED_FUNCS vasprintf)))
# Checks for library functions.
AC_FUNC_ALLOCA
AC_HEADER_STDC
AM_LANGINFO_CODESET
ZW_GNU_GETTEXT_SISTER_DIR
AC_CACHE_CHECK(for uchar, gcc_cv_type_uchar,
[AC_TRY_COMPILE([
#include <sys/types.h>
],
[if ((uchar *)0) return 0;
if (sizeof(uchar)) return 0;],
ac_cv_type_uchar=yes, ac_cv_type_uchar=no)])
if test $ac_cv_type_uchar = yes; then
AC_DEFINE(HAVE_UCHAR, 1,
[Define if <sys/types.h> defines \`uchar'.])
fi
AM_ICONV
# More defines and substitutions.
PACKAGE="$PACKAGE_TARNAME"
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define to the name of this package.])
AC_SUBST(PACKAGE)
if test "x$enable_nls" != xno; then
USED_CATALOGS='$(CATALOGS)'
else
USED_CATALOGS=
fi
AC_SUBST(USED_CATALOGS)
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode enable rules only needed by maintainers],,
enable_maintainer_mode=no)
if test "x$enable_maintainer_mode" = xno; then
MAINT='#'
else
MAINT=
fi
AC_SUBST(MAINT)
AC_ARG_ENABLE(checking,
[ --enable-checking enable expensive run-time checks],,
enable_checking=no)
if test $enable_checking != no ; then
AC_DEFINE(ENABLE_CHECKING, 1,
[Define if you want more run-time sanity checks.])
fi
m4_changequote(,)
case $target in
alpha*-*-* | \
arm*-*-*eabi* | \
arm*-*-symbianelf* | \
x86_64-*-* | \
ia64-*-* | \
hppa*64*-*-* | parisc*64*-*-* | \
i[34567]86-*-darwin* | \
i[34567]86-*-solaris2.1[0-9]* | \
mips*-*-* | \
mmix-*-* | \
powerpc*-*-* | \
rs6000*-*-* | \
s390*-*-* | \
sparc64*-*-* | ultrasparc-*-freebsd* | \
sparcv9-*-solaris2* | \
sparc-*-solaris2.[789] | sparc-*-solaris2.1[0-9]* | \
sh[123456789l]*-*-*)
need_64bit_hwint=yes ;;
*)
need_64bit_hwint=no ;;
esac
case $need_64bit_hwint:$ac_cv_sizeof_long in
*:8 | no:*) host_wide_int=long ;;
*) host_wide_int='long long' ;;
esac
m4_changequote([,])
AC_DEFINE_UNQUOTED(HOST_WIDE_INT, $host_wide_int,
[Define to the widest efficient host integer type at least
as wide as the target's size_t type.])
# Output.
AC_CONFIG_HEADERS(config.h:config.in, [echo timestamp > stamp-h1])
AC_CONFIG_FILES(Makefile)
AC_OUTPUT

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,189 @@
/* Default error handlers for CPP Library.
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000,
2001, 2002, 2004 Free Software Foundation, Inc.
Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
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, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
#include "config.h"
#include "system.h"
#include "cpplib.h"
#include "internal.h"
static void print_location (cpp_reader *, source_location, unsigned int);
/* Print the logical file location (LINE, COL) in preparation for a
diagnostic. Outputs the #include chain if it has changed. A line
of zero suppresses the include stack, and outputs the program name
instead. */
static void
print_location (cpp_reader *pfile, source_location line, unsigned int col)
{
if (line == 0)
fprintf (stderr, "%s: ", progname);
else
{
const struct line_map *map;
unsigned int lin;
map = linemap_lookup (pfile->line_table, line);
linemap_print_containing_files (pfile->line_table, map);
lin = SOURCE_LINE (map, line);
if (col == 0)
{
col = SOURCE_COLUMN (map, line);
if (col == 0)
col = 1;
}
if (lin == 0)
fprintf (stderr, "%s:", map->to_file);
else if (CPP_OPTION (pfile, show_column) == 0)
fprintf (stderr, "%s:%u:", map->to_file, lin);
else
fprintf (stderr, "%s:%u:%u:", map->to_file, lin, col);
fputc (' ', stderr);
}
}
/* Set up for a diagnostic: print the file and line, bump the error
counter, etc. SRC_LOC is the logical line number; zero means to print
at the location of the previously lexed token, which tends to be
the correct place by default. The column number can be specified either
using COLUMN or (if COLUMN==0) extracting SOURCE_COLUMN from SRC_LOC.
(This may seem redundant, but is useful when pre-scanning (cleaning) a line,
when we haven't yet verified whether the current line_map has a
big enough max_column_hint.)
Returns 0 if the error has been suppressed. */
int
_cpp_begin_message (cpp_reader *pfile, int code,
source_location src_loc, unsigned int column)
{
int level = CPP_DL_EXTRACT (code);
switch (level)
{
case CPP_DL_WARNING:
case CPP_DL_PEDWARN:
if (cpp_in_system_header (pfile)
&& ! CPP_OPTION (pfile, warn_system_headers))
return 0;
/* Fall through. */
case CPP_DL_WARNING_SYSHDR:
if (CPP_OPTION (pfile, warnings_are_errors)
|| (level == CPP_DL_PEDWARN && CPP_OPTION (pfile, pedantic_errors)))
{
if (CPP_OPTION (pfile, inhibit_errors))
return 0;
level = CPP_DL_ERROR;
pfile->errors++;
}
else if (CPP_OPTION (pfile, inhibit_warnings))
return 0;
break;
case CPP_DL_ERROR:
if (CPP_OPTION (pfile, inhibit_errors))
return 0;
/* ICEs cannot be inhibited. */
case CPP_DL_ICE:
pfile->errors++;
break;
}
print_location (pfile, src_loc, column);
if (CPP_DL_WARNING_P (level))
fputs (_("warning: "), stderr);
else if (level == CPP_DL_ICE)
fputs (_("internal error: "), stderr);
else
fputs (_("error: "), stderr);
return 1;
}
/* Don't remove the blank before do, as otherwise the exgettext
script will mistake this as a function definition */
#define v_message(msgid, ap) \
do { vfprintf (stderr, _(msgid), ap); putc ('\n', stderr); } while (0)
/* Exported interface. */
/* Print an error at the location of the previously lexed token. */
void
cpp_error (cpp_reader * pfile, int level, const char *msgid, ...)
{
source_location src_loc;
va_list ap;
va_start (ap, msgid);
if (CPP_OPTION (pfile, client_diagnostic))
pfile->cb.error (pfile, level, _(msgid), &ap);
else
{
if (CPP_OPTION (pfile, traditional))
{
if (pfile->state.in_directive)
src_loc = pfile->directive_line;
else
src_loc = pfile->line_table->highest_line;
}
else
{
src_loc = pfile->cur_token[-1].src_loc;
}
if (_cpp_begin_message (pfile, level, src_loc, 0))
v_message (msgid, ap);
}
va_end (ap);
}
/* Print an error at a specific location. */
void
cpp_error_with_line (cpp_reader *pfile, int level,
source_location src_loc, unsigned int column,
const char *msgid, ...)
{
va_list ap;
va_start (ap, msgid);
if (_cpp_begin_message (pfile, level, src_loc, column))
v_message (msgid, ap);
va_end (ap);
}
void
cpp_errno (cpp_reader *pfile, int level, const char *msgid)
{
if (msgid[0] == '\0')
msgid = _("stdout");
cpp_error (pfile, level, "%s: %s", msgid, xstrerror (errno));
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,118 @@
/* Hash tables for the CPP library.
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1998,
1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
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, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
#include "config.h"
#include "system.h"
#include "cpplib.h"
#include "internal.h"
static cpp_hashnode *alloc_node (hash_table *);
/* Return an identifier node for hashtable.c. Used by cpplib except
when integrated with the C front ends. */
static cpp_hashnode *
alloc_node (hash_table *table)
{
cpp_hashnode *node;
node = XOBNEW (&table->pfile->hash_ob, cpp_hashnode);
memset (node, 0, sizeof (cpp_hashnode));
return node;
}
/* Set up the identifier hash table. Use TABLE if non-null, otherwise
create our own. */
void
_cpp_init_hashtable (cpp_reader *pfile, hash_table *table)
{
struct spec_nodes *s;
if (table == NULL)
{
pfile->our_hashtable = 1;
table = ht_create (13); /* 8K (=2^13) entries. */
table->alloc_node = (hashnode (*) (hash_table *)) alloc_node;
_obstack_begin (&pfile->hash_ob, 0, 0,
(void *(*) (long)) xmalloc,
(void (*) (void *)) free);
}
table->pfile = pfile;
pfile->hash_table = table;
/* Now we can initialize things that use the hash table. */
_cpp_init_directives (pfile);
_cpp_init_internal_pragmas (pfile);
s = &pfile->spec_nodes;
s->n_defined = cpp_lookup (pfile, DSC("defined"));
s->n_true = cpp_lookup (pfile, DSC("true"));
s->n_false = cpp_lookup (pfile, DSC("false"));
s->n__VA_ARGS__ = cpp_lookup (pfile, DSC("__VA_ARGS__"));
s->n__VA_ARGS__->flags |= NODE_DIAGNOSTIC;
}
/* Tear down the identifier hash table. */
void
_cpp_destroy_hashtable (cpp_reader *pfile)
{
if (pfile->our_hashtable)
{
ht_destroy (pfile->hash_table);
obstack_free (&pfile->hash_ob, 0);
}
}
/* Returns the hash entry for the STR of length LEN, creating one
if necessary. */
cpp_hashnode *
cpp_lookup (cpp_reader *pfile, const unsigned char *str, unsigned int len)
{
/* ht_lookup cannot return NULL. */
return CPP_HASHNODE (ht_lookup (pfile->hash_table, str, len, HT_ALLOC));
}
/* Determine whether the str STR, of length LEN, is a defined macro. */
int
cpp_defined (cpp_reader *pfile, const unsigned char *str, int len)
{
cpp_hashnode *node;
node = CPP_HASHNODE (ht_lookup (pfile->hash_table, str, len, HT_NO_INSERT));
/* If it's of type NT_MACRO, it cannot be poisoned. */
return node && node->type == NT_MACRO;
}
/* For all nodes in the hashtable, callback CB with parameters PFILE,
the node, and V. */
void
cpp_forall_identifiers (cpp_reader *pfile, cpp_cb cb, void *v)
{
/* We don't need a proxy since the hash table's identifier comes
first in cpp_hashnode. */
ht_forall (pfile->hash_table, (ht_cb) cb, v);
}

View File

@ -0,0 +1,78 @@
/* Structures that hang off cpp_identifier, for PCH.
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004 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, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#include "cpplib.h"
#if !defined (HAVE_UCHAR) && !defined (IN_GCC)
typedef unsigned char uchar;
#endif
#define U (const unsigned char *) /* Intended use: U"string" */
/* Chained list of answers to an assertion. */
struct answer GTY(())
{
struct answer *next;
unsigned int count;
cpp_token GTY ((length ("%h.count"))) first[1];
};
/* Each macro definition is recorded in a cpp_macro structure.
Variadic macros cannot occur with traditional cpp. */
struct cpp_macro GTY(())
{
/* Parameters, if any. */
cpp_hashnode ** GTY ((nested_ptr (union tree_node,
"%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL",
"%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"),
length ("%h.paramc")))
params;
/* Replacement tokens (ISO) or replacement text (traditional). See
comment at top of cpptrad.c for how traditional function-like
macros are encoded. */
union cpp_macro_u
{
cpp_token * GTY ((tag ("0"), length ("%0.count"))) tokens;
const unsigned char * GTY ((tag ("1"))) text;
} GTY ((desc ("%1.traditional"))) exp;
/* Definition line number. */
source_location line;
/* Number of tokens in expansion, or bytes for traditional macros. */
unsigned int count;
/* Number of parameters. */
unsigned short paramc;
/* If a function-like macro. */
unsigned int fun_like : 1;
/* If a variadic macro. */
unsigned int variadic : 1;
/* If macro defined in system header. */
unsigned int syshdr : 1;
/* Nonzero if it has been expanded or had its existence tested. */
unsigned int used : 1;
/* Indicate which field of 'exp' is in use. */
unsigned int traditional : 1;
};

View File

@ -0,0 +1,853 @@
/* Definitions for CPP library.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005
Free Software Foundation, Inc.
Written by Per Bothner, 1994-95.
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, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
#ifndef LIBCPP_CPPLIB_H
#define LIBCPP_CPPLIB_H
#include <sys/types.h>
#include "symtab.h"
#include "line-map.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct cpp_reader cpp_reader;
typedef struct cpp_buffer cpp_buffer;
typedef struct cpp_options cpp_options;
typedef struct cpp_token cpp_token;
typedef struct cpp_string cpp_string;
typedef struct cpp_hashnode cpp_hashnode;
typedef struct cpp_macro cpp_macro;
typedef struct cpp_callbacks cpp_callbacks;
typedef struct cpp_dir cpp_dir;
struct answer;
struct _cpp_file;
/* The first three groups, apart from '=', can appear in preprocessor
expressions (+= and -= are used to indicate unary + and - resp.).
This allows a lookup table to be implemented in _cpp_parse_expr.
The first group, to CPP_LAST_EQ, can be immediately followed by an
'='. The lexer needs operators ending in '=', like ">>=", to be in
the same order as their counterparts without the '=', like ">>".
See the cpp_operator table optab in expr.c if you change the order or
add or remove anything in the first group. */
#define TTYPE_TABLE \
OP(EQ, "=") \
OP(NOT, "!") \
OP(GREATER, ">") /* compare */ \
OP(LESS, "<") \
OP(PLUS, "+") /* math */ \
OP(MINUS, "-") \
OP(MULT, "*") \
OP(DIV, "/") \
OP(MOD, "%") \
OP(AND, "&") /* bit ops */ \
OP(OR, "|") \
OP(XOR, "^") \
OP(RSHIFT, ">>") \
OP(LSHIFT, "<<") \
\
OP(COMPL, "~") \
OP(AND_AND, "&&") /* logical */ \
OP(OR_OR, "||") \
OP(QUERY, "?") \
OP(COLON, ":") \
OP(COMMA, ",") /* grouping */ \
OP(OPEN_PAREN, "(") \
OP(CLOSE_PAREN, ")") \
TK(EOF, NONE) \
OP(EQ_EQ, "==") /* compare */ \
OP(NOT_EQ, "!=") \
OP(GREATER_EQ, ">=") \
OP(LESS_EQ, "<=") \
\
/* These two are unary + / - in preprocessor expressions. */ \
OP(PLUS_EQ, "+=") /* math */ \
OP(MINUS_EQ, "-=") \
\
OP(MULT_EQ, "*=") \
OP(DIV_EQ, "/=") \
OP(MOD_EQ, "%=") \
OP(AND_EQ, "&=") /* bit ops */ \
OP(OR_EQ, "|=") \
OP(XOR_EQ, "^=") \
OP(RSHIFT_EQ, ">>=") \
OP(LSHIFT_EQ, "<<=") \
/* Digraphs together, beginning with CPP_FIRST_DIGRAPH. */ \
OP(HASH, "#") /* digraphs */ \
OP(PASTE, "##") \
OP(OPEN_SQUARE, "[") \
OP(CLOSE_SQUARE, "]") \
OP(OPEN_BRACE, "{") \
OP(CLOSE_BRACE, "}") \
/* The remainder of the punctuation. Order is not significant. */ \
OP(SEMICOLON, ";") /* structure */ \
OP(ELLIPSIS, "...") \
OP(PLUS_PLUS, "++") /* increment */ \
OP(MINUS_MINUS, "--") \
OP(DEREF, "->") /* accessors */ \
OP(DOT, ".") \
OP(SCOPE, "::") \
OP(DEREF_STAR, "->*") \
OP(DOT_STAR, ".*") \
OP(ATSIGN, "@") /* used in Objective-C */ \
\
TK(NAME, IDENT) /* word */ \
TK(AT_NAME, IDENT) /* @word - Objective-C */ \
TK(NUMBER, LITERAL) /* 34_be+ta */ \
\
TK(CHAR, LITERAL) /* 'char' */ \
TK(WCHAR, LITERAL) /* L'char' */ \
TK(OTHER, LITERAL) /* stray punctuation */ \
\
TK(STRING, LITERAL) /* "string" */ \
TK(WSTRING, LITERAL) /* L"string" */ \
TK(OBJC_STRING, LITERAL) /* @"string" - Objective-C */ \
TK(HEADER_NAME, LITERAL) /* <stdio.h> in #include */ \
\
TK(COMMENT, LITERAL) /* Only if output comments. */ \
/* SPELL_LITERAL happens to DTRT. */ \
TK(MACRO_ARG, NONE) /* Macro argument. */ \
TK(PRAGMA, NONE) /* Only for deferred pragmas. */ \
TK(PRAGMA_EOL, NONE) /* End-of-line for deferred pragmas. */ \
TK(PADDING, NONE) /* Whitespace for -E. */
#define OP(e, s) CPP_ ## e,
#define TK(e, s) CPP_ ## e,
enum cpp_ttype
{
TTYPE_TABLE
N_TTYPES,
/* Positions in the table. */
CPP_LAST_EQ = CPP_LSHIFT,
CPP_FIRST_DIGRAPH = CPP_HASH,
CPP_LAST_PUNCTUATOR= CPP_ATSIGN,
CPP_LAST_CPP_OP = CPP_LESS_EQ
};
#undef OP
#undef TK
/* C language kind, used when calling cpp_create_reader. */
enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_STDC89, CLK_STDC94, CLK_STDC99,
CLK_GNUCXX, CLK_CXX98, CLK_ASM};
/* Payload of a NUMBER, STRING, CHAR or COMMENT token. */
struct cpp_string GTY(())
{
unsigned int len;
const unsigned char *text;
};
/* Flags for the cpp_token structure. */
#define PREV_WHITE (1 << 0) /* If whitespace before this token. */
#define DIGRAPH (1 << 1) /* If it was a digraph. */
#define STRINGIFY_ARG (1 << 2) /* If macro argument to be stringified. */
#define PASTE_LEFT (1 << 3) /* If on LHS of a ## operator. */
#define NAMED_OP (1 << 4) /* C++ named operators. */
#define NO_EXPAND (1 << 5) /* Do not macro-expand this token. */
#define BOL (1 << 6) /* Token at beginning of line. */
#define PURE_ZERO (1 << 7) /* Single 0 digit, used by the C++ frontend,
set in c-lex.c. */
/* Specify which field, if any, of the cpp_token union is used. */
enum cpp_token_fld_kind {
CPP_TOKEN_FLD_NODE,
CPP_TOKEN_FLD_SOURCE,
CPP_TOKEN_FLD_STR,
CPP_TOKEN_FLD_ARG_NO,
CPP_TOKEN_FLD_PRAGMA,
CPP_TOKEN_FLD_NONE
};
/* A preprocessing token. This has been carefully packed and should
occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts. */
struct cpp_token GTY(())
{
source_location src_loc; /* Location of first char of token. */
ENUM_BITFIELD(cpp_ttype) type : CHAR_BIT; /* token type */
unsigned char flags; /* flags - see above */
union cpp_token_u
{
/* An identifier. */
cpp_hashnode *
GTY ((nested_ptr (union tree_node,
"%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL",
"%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"),
tag ("CPP_TOKEN_FLD_NODE")))
node;
/* Inherit padding from this token. */
cpp_token * GTY ((tag ("CPP_TOKEN_FLD_SOURCE"))) source;
/* A string, or number. */
struct cpp_string GTY ((tag ("CPP_TOKEN_FLD_STR"))) str;
/* Argument no. for a CPP_MACRO_ARG. */
unsigned int GTY ((tag ("CPP_TOKEN_FLD_ARG_NO"))) arg_no;
/* Caller-supplied identifier for a CPP_PRAGMA. */
unsigned int GTY ((tag ("CPP_TOKEN_FLD_PRAGMA"))) pragma;
} GTY ((desc ("cpp_token_val_index (&%1)"))) val;
};
/* Say which field is in use. */
extern enum cpp_token_fld_kind cpp_token_val_index (cpp_token *tok);
/* A type wide enough to hold any multibyte source character.
cpplib's character constant interpreter requires an unsigned type.
Also, a typedef for the signed equivalent.
The width of this type is capped at 32 bits; there do exist targets
where wchar_t is 64 bits, but only in a non-default mode, and there
would be no meaningful interpretation for a wchar_t value greater
than 2^32 anyway -- the widest wide-character encoding around is
ISO 10646, which stops at 2^31. */
#if CHAR_BIT * SIZEOF_INT >= 32
# define CPPCHAR_SIGNED_T int
#elif CHAR_BIT * SIZEOF_LONG >= 32
# define CPPCHAR_SIGNED_T long
#else
# error "Cannot find a least-32-bit signed integer type"
#endif
typedef unsigned CPPCHAR_SIGNED_T cppchar_t;
typedef CPPCHAR_SIGNED_T cppchar_signed_t;
/* Style of header dependencies to generate. */
enum cpp_deps_style { DEPS_NONE = 0, DEPS_USER, DEPS_SYSTEM };
/* The possible normalization levels, from most restrictive to least. */
enum cpp_normalize_level {
/* In NFKC. */
normalized_KC = 0,
/* In NFC. */
normalized_C,
/* In NFC, except for subsequences where being in NFC would make
the identifier invalid. */
normalized_identifier_C,
/* Not normalized at all. */
normalized_none
};
/* This structure is nested inside struct cpp_reader, and
carries all the options visible to the command line. */
struct cpp_options
{
/* Characters between tab stops. */
unsigned int tabstop;
/* The language we're preprocessing. */
enum c_lang lang;
/* Nonzero means use extra default include directories for C++. */
unsigned char cplusplus;
/* Nonzero means handle cplusplus style comments. */
unsigned char cplusplus_comments;
/* Nonzero means define __OBJC__, treat @ as a special token, and
use the OBJC[PLUS]_INCLUDE_PATH environment variable. */
unsigned char objc;
/* Nonzero means don't copy comments into the output file. */
unsigned char discard_comments;
/* Nonzero means don't copy comments into the output file during
macro expansion. */
unsigned char discard_comments_in_macro_exp;
/* Nonzero means process the ISO trigraph sequences. */
unsigned char trigraphs;
/* Nonzero means process the ISO digraph sequences. */
unsigned char digraphs;
/* Nonzero means to allow hexadecimal floats and LL suffixes. */
unsigned char extended_numbers;
/* Nonzero means print names of header files (-H). */
unsigned char print_include_names;
/* Nonzero means cpp_pedwarn causes a hard error. */
unsigned char pedantic_errors;
/* Nonzero means don't print warning messages. */
unsigned char inhibit_warnings;
/* Nonzero means complain about deprecated features. */
unsigned char warn_deprecated;
/* Nonzero means don't suppress warnings from system headers. */
unsigned char warn_system_headers;
/* Nonzero means don't print error messages. Has no option to
select it, but can be set by a user of cpplib (e.g. fix-header). */
unsigned char inhibit_errors;
/* Nonzero means warn if slash-star appears in a comment. */
unsigned char warn_comments;
/* Nonzero means warn if a user-supplied include directory does not
exist. */
unsigned char warn_missing_include_dirs;
/* Nonzero means warn if there are any trigraphs. */
unsigned char warn_trigraphs;
/* Nonzero means warn about multicharacter charconsts. */
unsigned char warn_multichar;
/* Nonzero means warn about various incompatibilities with
traditional C. */
unsigned char warn_traditional;
/* Nonzero means warn about long long numeric constants. */
unsigned char warn_long_long;
/* Nonzero means warn about text after an #endif (or #else). */
unsigned char warn_endif_labels;
/* Nonzero means warn about implicit sign changes owing to integer
promotions. */
unsigned char warn_num_sign_change;
/* Zero means don't warn about __VA_ARGS__ usage in c89 pedantic mode.
Presumably the usage is protected by the appropriate #ifdef. */
unsigned char warn_variadic_macros;
/* Nonzero means turn warnings into errors. */
unsigned char warnings_are_errors;
/* Nonzero means we should look for header.gcc files that remap file
names. */
unsigned char remap;
/* Zero means dollar signs are punctuation. */
unsigned char dollars_in_ident;
/* Nonzero means UCNs are accepted in identifiers. */
unsigned char extended_identifiers;
/* True if we should warn about dollars in identifiers or numbers
for this translation unit. */
unsigned char warn_dollars;
/* Nonzero means warn if undefined identifiers are evaluated in an #if. */
unsigned char warn_undef;
/* Nonzero means warn of unused macros from the main file. */
unsigned char warn_unused_macros;
/* Nonzero for the 1999 C Standard, including corrigenda and amendments. */
unsigned char c99;
/* Nonzero if we are conforming to a specific C or C++ standard. */
unsigned char std;
/* Nonzero means give all the error messages the ANSI standard requires. */
unsigned char pedantic;
/* Nonzero means we're looking at already preprocessed code, so don't
bother trying to do macro expansion and whatnot. */
unsigned char preprocessed;
/* Print column number in error messages. */
unsigned char show_column;
/* Nonzero means handle C++ alternate operator names. */
unsigned char operator_names;
/* True for traditional preprocessing. */
unsigned char traditional;
/* Holds the name of the target (execution) character set. */
const char *narrow_charset;
/* Holds the name of the target wide character set. */
const char *wide_charset;
/* Holds the name of the input character set. */
const char *input_charset;
/* The minimum permitted level of normalization before a warning
is generated. */
enum cpp_normalize_level warn_normalize;
/* True to warn about precompiled header files we couldn't use. */
bool warn_invalid_pch;
/* True if dependencies should be restored from a precompiled header. */
bool restore_pch_deps;
/* Dependency generation. */
struct
{
/* Style of header dependencies to generate. */
enum cpp_deps_style style;
/* Assume missing files are generated files. */
bool missing_files;
/* Generate phony targets for each dependency apart from the first
one. */
bool phony_targets;
/* If true, no dependency is generated on the main file. */
bool ignore_main_file;
} deps;
/* Target-specific features set by the front end or client. */
/* Precision for target CPP arithmetic, target characters, target
ints and target wide characters, respectively. */
size_t precision, char_precision, int_precision, wchar_precision;
/* True means chars (wide chars) are unsigned. */
bool unsigned_char, unsigned_wchar;
/* True if the most significant byte in a word has the lowest
address in memory. */
bool bytes_big_endian;
/* Nonzero means __STDC__ should have the value 0 in system headers. */
unsigned char stdc_0_in_system_headers;
/* True means error callback should be used for diagnostics. */
bool client_diagnostic;
};
/* Callback for header lookup for HEADER, which is the name of a
source file. It is used as a method of last resort to find headers
that are not otherwise found during the normal include processing.
The return value is the malloced name of a header to try and open,
if any, or NULL otherwise. This callback is called only if the
header is otherwise unfound. */
typedef const char *(*missing_header_cb)(cpp_reader *, const char *header, cpp_dir **);
/* Call backs to cpplib client. */
struct cpp_callbacks
{
/* Called when a new line of preprocessed output is started. */
void (*line_change) (cpp_reader *, const cpp_token *, int);
/* Called when switching to/from a new file.
The line_map is for the new file. It is NULL if there is no new file.
(In C this happens when done with <built-in>+<command line> and also
when done with a main file.) This can be used for resource cleanup. */
void (*file_change) (cpp_reader *, const struct line_map *);
void (*dir_change) (cpp_reader *, const char *);
void (*include) (cpp_reader *, unsigned int, const unsigned char *,
const char *, int, const cpp_token **);
void (*define) (cpp_reader *, unsigned int, cpp_hashnode *);
void (*undef) (cpp_reader *, unsigned int, cpp_hashnode *);
void (*ident) (cpp_reader *, unsigned int, const cpp_string *);
void (*def_pragma) (cpp_reader *, unsigned int);
int (*valid_pch) (cpp_reader *, const char *, int);
void (*read_pch) (cpp_reader *, const char *, int, const char *);
missing_header_cb missing_header;
/* Called to emit a diagnostic if client_diagnostic option is true.
This callback receives the translated message. */
void (*error) (cpp_reader *, int, const char *, va_list *)
ATTRIBUTE_FPTR_PRINTF(3,0);
};
/* Chain of directories to look for include files in. */
struct cpp_dir
{
/* NULL-terminated singly-linked list. */
struct cpp_dir *next;
/* NAME of the directory, NUL-terminated. */
char *name;
unsigned int len;
/* One if a system header, two if a system header that has extern
"C" guards for C++. */
unsigned char sysp;
/* Mapping of file names for this directory for MS-DOS and related
platforms. A NULL-terminated array of (from, to) pairs. */
const char **name_map;
/* Routine to construct pathname, given the search path name and the
HEADER we are trying to find, return a constructed pathname to
try and open. If this is NULL, the constructed pathname is as
constructed by append_file_to_dir. */
char *(*construct) (const char *header, cpp_dir *dir);
/* The C front end uses these to recognize duplicated
directories in the search path. */
ino_t ino;
dev_t dev;
/* Is this a user-supplied directory? */
bool user_supplied_p;
};
/* Name under which this program was invoked. */
extern const char *progname;
/* The structure of a node in the hash table. The hash table has
entries for all identifiers: either macros defined by #define
commands (type NT_MACRO), assertions created with #assert
(NT_ASSERTION), or neither of the above (NT_VOID). Builtin macros
like __LINE__ are flagged NODE_BUILTIN. Poisoned identifiers are
flagged NODE_POISONED. NODE_OPERATOR (C++ only) indicates an
identifier that behaves like an operator such as "xor".
NODE_DIAGNOSTIC is for speed in lex_token: it indicates a
diagnostic may be required for this node. Currently this only
applies to __VA_ARGS__ and poisoned identifiers. */
/* Hash node flags. */
#define NODE_OPERATOR (1 << 0) /* C++ named operator. */
#define NODE_POISONED (1 << 1) /* Poisoned identifier. */
#define NODE_BUILTIN (1 << 2) /* Builtin macro. */
#define NODE_DIAGNOSTIC (1 << 3) /* Possible diagnostic when lexed. */
#define NODE_WARN (1 << 4) /* Warn if redefined or undefined. */
#define NODE_DISABLED (1 << 5) /* A disabled macro. */
#define NODE_MACRO_ARG (1 << 6) /* Used during #define processing. */
/* Different flavors of hash node. */
enum node_type
{
NT_VOID = 0, /* No definition yet. */
NT_MACRO, /* A macro of some form. */
NT_ASSERTION /* Predicate for #assert. */
};
/* Different flavors of builtin macro. _Pragma is an operator, but we
handle it with the builtin code for efficiency reasons. */
enum builtin_type
{
BT_SPECLINE = 0, /* `__LINE__' */
BT_DATE, /* `__DATE__' */
BT_FILE, /* `__FILE__' */
BT_BASE_FILE, /* `__BASE_FILE__' */
BT_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */
BT_TIME, /* `__TIME__' */
BT_STDC, /* `__STDC__' */
BT_PRAGMA, /* `_Pragma' operator */
BT_TIMESTAMP /* `__TIMESTAMP__' */
};
#define CPP_HASHNODE(HNODE) ((cpp_hashnode *) (HNODE))
#define HT_NODE(NODE) ((ht_identifier *) (NODE))
#define NODE_LEN(NODE) HT_LEN (&(NODE)->ident)
#define NODE_NAME(NODE) HT_STR (&(NODE)->ident)
/* Specify which field, if any, of the union is used. */
enum {
NTV_MACRO,
NTV_ANSWER,
NTV_BUILTIN,
NTV_ARGUMENT,
NTV_NONE
};
#define CPP_HASHNODE_VALUE_IDX(HNODE) \
((HNODE.flags & NODE_MACRO_ARG) ? NTV_ARGUMENT \
: HNODE.type == NT_MACRO ? ((HNODE.flags & NODE_BUILTIN) \
? NTV_BUILTIN : NTV_MACRO) \
: HNODE.type == NT_ASSERTION ? NTV_ANSWER \
: NTV_NONE)
/* The common part of an identifier node shared amongst all 3 C front
ends. Also used to store CPP identifiers, which are a superset of
identifiers in the grammatical sense. */
union _cpp_hashnode_value GTY(())
{
/* If a macro. */
cpp_macro * GTY((tag ("NTV_MACRO"))) macro;
/* Answers to an assertion. */
struct answer * GTY ((tag ("NTV_ANSWER"))) answers;
/* Code for a builtin macro. */
enum builtin_type GTY ((tag ("NTV_BUILTIN"))) builtin;
/* Macro argument index. */
unsigned short GTY ((tag ("NTV_ARGUMENT"))) arg_index;
};
struct cpp_hashnode GTY(())
{
struct ht_identifier ident;
unsigned int is_directive : 1;
unsigned int directive_index : 7; /* If is_directive,
then index into directive table.
Otherwise, a NODE_OPERATOR. */
unsigned char rid_code; /* Rid code - for front ends. */
ENUM_BITFIELD(node_type) type : 8; /* CPP node type. */
unsigned char flags; /* CPP flags. */
union _cpp_hashnode_value GTY ((desc ("CPP_HASHNODE_VALUE_IDX (%1)"))) value;
};
/* Call this first to get a handle to pass to other functions.
If you want cpplib to manage its own hashtable, pass in a NULL
pointer. Otherwise you should pass in an initialized hash table
that cpplib will share; this technique is used by the C front
ends. */
extern cpp_reader *cpp_create_reader (enum c_lang, struct ht *,
struct line_maps *);
/* Call this to change the selected language standard (e.g. because of
command line options). */
extern void cpp_set_lang (cpp_reader *, enum c_lang);
/* Set the include paths. */
extern void cpp_set_include_chains (cpp_reader *, cpp_dir *, cpp_dir *, int);
/* Call these to get pointers to the options, callback, and deps
structures for a given reader. These pointers are good until you
call cpp_finish on that reader. You can either edit the callbacks
through the pointer returned from cpp_get_callbacks, or set them
with cpp_set_callbacks. */
extern cpp_options *cpp_get_options (cpp_reader *);
extern cpp_callbacks *cpp_get_callbacks (cpp_reader *);
extern void cpp_set_callbacks (cpp_reader *, cpp_callbacks *);
extern struct deps *cpp_get_deps (cpp_reader *);
/* This function reads the file, but does not start preprocessing. It
returns the name of the original file; this is the same as the
input file, except for preprocessed input. This will generate at
least one file change callback, and possibly a line change callback
too. If there was an error opening the file, it returns NULL. */
extern const char *cpp_read_main_file (cpp_reader *, const char *);
/* Set up built-ins like __FILE__. */
extern void cpp_init_builtins (cpp_reader *, int);
/* This is called after options have been parsed, and partially
processed. */
extern void cpp_post_options (cpp_reader *);
/* Set up translation to the target character set. */
extern void cpp_init_iconv (cpp_reader *);
/* Call this to finish preprocessing. If you requested dependency
generation, pass an open stream to write the information to,
otherwise NULL. It is your responsibility to close the stream.
Returns cpp_errors (pfile). */
extern int cpp_finish (cpp_reader *, FILE *deps_stream);
/* Call this to release the handle at the end of preprocessing. Any
use of the handle after this function returns is invalid. Returns
cpp_errors (pfile). */
extern void cpp_destroy (cpp_reader *);
/* Error count. */
extern unsigned int cpp_errors (cpp_reader *);
extern unsigned int cpp_token_len (const cpp_token *);
extern unsigned char *cpp_token_as_text (cpp_reader *, const cpp_token *);
extern unsigned char *cpp_spell_token (cpp_reader *, const cpp_token *,
unsigned char *, bool);
extern void cpp_register_pragma (cpp_reader *, const char *, const char *,
void (*) (cpp_reader *), bool);
extern void cpp_register_deferred_pragma (cpp_reader *, const char *,
const char *, unsigned, bool, bool);
extern int cpp_avoid_paste (cpp_reader *, const cpp_token *,
const cpp_token *);
extern const cpp_token *cpp_get_token (cpp_reader *);
extern const unsigned char *cpp_macro_definition (cpp_reader *,
const cpp_hashnode *);
extern void _cpp_backup_tokens (cpp_reader *, unsigned int);
/* Evaluate a CPP_CHAR or CPP_WCHAR token. */
extern cppchar_t cpp_interpret_charconst (cpp_reader *, const cpp_token *,
unsigned int *, int *);
/* Evaluate a vector of CPP_STRING or CPP_WSTRING tokens. */
extern bool cpp_interpret_string (cpp_reader *,
const cpp_string *, size_t,
cpp_string *, bool);
extern bool cpp_interpret_string_notranslate (cpp_reader *,
const cpp_string *, size_t,
cpp_string *, bool);
/* Convert a host character constant to the execution character set. */
extern cppchar_t cpp_host_to_exec_charset (cpp_reader *, cppchar_t);
/* Used to register macros and assertions, perhaps from the command line.
The text is the same as the command line argument. */
extern void cpp_define (cpp_reader *, const char *);
extern void cpp_assert (cpp_reader *, const char *);
extern void cpp_undef (cpp_reader *, const char *);
extern void cpp_unassert (cpp_reader *, const char *);
/* Undefine all macros and assertions. */
extern void cpp_undef_all (cpp_reader *);
extern cpp_buffer *cpp_push_buffer (cpp_reader *, const unsigned char *,
size_t, int);
extern int cpp_defined (cpp_reader *, const unsigned char *, int);
/* A preprocessing number. Code assumes that any unused high bits of
the double integer are set to zero. */
typedef unsigned HOST_WIDE_INT cpp_num_part;
typedef struct cpp_num cpp_num;
struct cpp_num
{
cpp_num_part high;
cpp_num_part low;
bool unsignedp; /* True if value should be treated as unsigned. */
bool overflow; /* True if the most recent calculation overflowed. */
};
/* cpplib provides two interfaces for interpretation of preprocessing
numbers.
cpp_classify_number categorizes numeric constants according to
their field (integer, floating point, or invalid), radix (decimal,
octal, hexadecimal), and type suffixes. */
#define CPP_N_CATEGORY 0x000F
#define CPP_N_INVALID 0x0000
#define CPP_N_INTEGER 0x0001
#define CPP_N_FLOATING 0x0002
#define CPP_N_WIDTH 0x00F0
#define CPP_N_SMALL 0x0010 /* int, float. */
#define CPP_N_MEDIUM 0x0020 /* long, double. */
#define CPP_N_LARGE 0x0040 /* long long, long double. */
#define CPP_N_RADIX 0x0F00
#define CPP_N_DECIMAL 0x0100
#define CPP_N_HEX 0x0200
#define CPP_N_OCTAL 0x0400
#define CPP_N_UNSIGNED 0x1000 /* Properties. */
#define CPP_N_IMAGINARY 0x2000
#define CPP_N_DFLOAT 0x4000
/* Classify a CPP_NUMBER token. The return value is a combination of
the flags from the above sets. */
extern unsigned cpp_classify_number (cpp_reader *, const cpp_token *);
/* Evaluate a token classified as category CPP_N_INTEGER. */
extern cpp_num cpp_interpret_integer (cpp_reader *, const cpp_token *,
unsigned int type);
/* Sign extend a number, with PRECISION significant bits and all
others assumed clear, to fill out a cpp_num structure. */
cpp_num cpp_num_sign_extend (cpp_num, size_t);
/* Diagnostic levels. To get a diagnostic without associating a
position in the translation unit with it, use cpp_error_with_line
with a line number of zero. */
/* Warning, an error with -Werror. */
#define CPP_DL_WARNING 0x00
/* Same as CPP_DL_WARNING, except it is not suppressed in system headers. */
#define CPP_DL_WARNING_SYSHDR 0x01
/* Warning, an error with -pedantic-errors or -Werror. */
#define CPP_DL_PEDWARN 0x02
/* An error. */
#define CPP_DL_ERROR 0x03
/* An internal consistency check failed. Prints "internal error: ",
otherwise the same as CPP_DL_ERROR. */
#define CPP_DL_ICE 0x04
/* Extracts a diagnostic level from an int. */
#define CPP_DL_EXTRACT(l) (l & 0xf)
/* Nonzero if a diagnostic level is one of the warnings. */
#define CPP_DL_WARNING_P(l) (CPP_DL_EXTRACT (l) >= CPP_DL_WARNING \
&& CPP_DL_EXTRACT (l) <= CPP_DL_PEDWARN)
/* Output a diagnostic of some kind. */
extern void cpp_error (cpp_reader *, int, const char *msgid, ...)
ATTRIBUTE_PRINTF_3;
/* Output a diagnostic with "MSGID: " preceding the
error string of errno. No location is printed. */
extern void cpp_errno (cpp_reader *, int, const char *msgid);
/* Same as cpp_error, except additionally specifies a position as a
(translation unit) physical line and physical column. If the line is
zero, then no location is printed. */
extern void cpp_error_with_line (cpp_reader *, int, source_location, unsigned,
const char *msgid, ...) ATTRIBUTE_PRINTF_5;
/* In cpplex.c */
extern int cpp_ideq (const cpp_token *, const char *);
extern void cpp_output_line (cpp_reader *, FILE *);
extern void cpp_output_token (const cpp_token *, FILE *);
extern const char *cpp_type2name (enum cpp_ttype);
/* Returns the value of an escape sequence, truncated to the correct
target precision. PSTR points to the input pointer, which is just
after the backslash. LIMIT is how much text we have. WIDE is true
if the escape sequence is part of a wide character constant or
string literal. Handles all relevant diagnostics. */
extern cppchar_t cpp_parse_escape (cpp_reader *, const unsigned char ** pstr,
const unsigned char *limit, int wide);
/* In cpphash.c */
/* Lookup an identifier in the hashtable. Puts the identifier in the
table if it is not already there. */
extern cpp_hashnode *cpp_lookup (cpp_reader *, const unsigned char *,
unsigned int);
typedef int (*cpp_cb) (cpp_reader *, cpp_hashnode *, void *);
extern void cpp_forall_identifiers (cpp_reader *, cpp_cb, void *);
/* In cppmacro.c */
extern void cpp_scan_nooutput (cpp_reader *);
extern int cpp_sys_macro_p (cpp_reader *);
extern unsigned char *cpp_quote_string (unsigned char *, const unsigned char *,
unsigned int);
/* In cppfiles.c */
extern bool cpp_included (cpp_reader *, const char *);
extern void cpp_make_system_header (cpp_reader *, int, int);
extern bool cpp_push_include (cpp_reader *, const char *);
extern void cpp_change_file (cpp_reader *, enum lc_reason, const char *);
extern const char *cpp_get_path (struct _cpp_file *);
extern cpp_dir *cpp_get_dir (struct _cpp_file *);
extern cpp_buffer *cpp_get_buffer (cpp_reader *);
extern struct _cpp_file *cpp_get_file (cpp_buffer *);
extern cpp_buffer *cpp_get_prev (cpp_buffer *);
/* In cpppch.c */
struct save_macro_data;
extern int cpp_save_state (cpp_reader *, FILE *);
extern int cpp_write_pch_deps (cpp_reader *, FILE *);
extern int cpp_write_pch_state (cpp_reader *, FILE *);
extern int cpp_valid_state (cpp_reader *, const char *, int);
extern void cpp_prepare_state (cpp_reader *, struct save_macro_data **);
extern int cpp_read_state (cpp_reader *, const char *, FILE *,
struct save_macro_data *);
#ifdef __cplusplus
}
#endif
#endif /* ! LIBCPP_CPPLIB_H */

View File

@ -0,0 +1,180 @@
/* Map logical line numbers to (source file, line number) pairs.
Copyright (C) 2001, 2003, 2004
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, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
#ifndef LIBCPP_LINE_MAP_H
#define LIBCPP_LINE_MAP_H
/* Reason for adding a line change with add_line_map (). LC_ENTER is
when including a new file, e.g. a #include directive in C.
LC_LEAVE is when reaching a file's end. LC_RENAME is when a file
name or line number changes for neither of the above reasons
(e.g. a #line directive in C). */
enum lc_reason {LC_ENTER = 0, LC_LEAVE, LC_RENAME};
/* A logical line/column number, i.e. an "index" into a line_map. */
/* Long-term, we want to use this to replace struct location_s (in input.h),
and effectively typedef source_location location_t. */
typedef unsigned int source_location;
/* Physical source file TO_FILE at line TO_LINE at column 0 is represented
by the logical START_LOCATION. TO_LINE+L at column C is represented by
START_LOCATION+(L*(1<<column_bits))+C, as long as C<(1<<column_bits),
and the result_location is less than the next line_map's start_location.
(The top line is line 1 and the leftmost column is column 1; line/column 0
means "entire file/line" or "unknown line/column" or "not applicable".)
INCLUDED_FROM is an index into the set that gives the line mapping
at whose end the current one was included. File(s) at the bottom
of the include stack have this set to -1. REASON is the reason for
creation of this line map, SYSP is one for a system header, two for
a C system header file that therefore needs to be extern "C"
protected in C++, and zero otherwise. */
struct line_map
{
const char *to_file;
unsigned int to_line;
source_location start_location;
int included_from;
ENUM_BITFIELD (lc_reason) reason : CHAR_BIT;
/* The sysp field isn't really needed now that it's in cpp_buffer. */
unsigned char sysp;
/* Number of the low-order source_location bits used for a column number. */
unsigned int column_bits : 8;
};
/* A set of chronological line_map structures. */
struct line_maps
{
struct line_map *maps;
unsigned int allocated;
unsigned int used;
unsigned int cache;
/* The most recently listed include stack, if any, starts with
LAST_LISTED as the topmost including file. -1 indicates nothing
has been listed yet. */
int last_listed;
/* Depth of the include stack, including the current file. */
unsigned int depth;
/* If true, prints an include trace a la -H. */
bool trace_includes;
/* Highest source_location "given out". */
source_location highest_location;
/* Start of line of highest source_location "given out". */
source_location highest_line;
/* The maximum column number we can quickly allocate. Higher numbers
may require allocating a new line_map. */
unsigned int max_column_hint;
};
/* Initialize a line map set. */
extern void linemap_init (struct line_maps *);
/* Free a line map set. */
extern void linemap_free (struct line_maps *);
/* Check for and warn about line_maps entered but not exited. */
extern void linemap_check_files_exited (struct line_maps *);
/* Return a source_location for the start (i.e. column==0) of
(physical) line TO_LINE in the current source file (as in the
most recent linemap_add). MAX_COLUMN_HINT is the highest column
number we expect to use in this line (but it does not change
the highest_location). */
extern source_location linemap_line_start
(struct line_maps *set, unsigned int to_line, unsigned int max_column_hint);
/* Add a mapping of logical source line to physical source file and
line number.
The text pointed to by TO_FILE must have a lifetime
at least as long as the final call to lookup_line (). An empty
TO_FILE means standard input. If reason is LC_LEAVE, and
TO_FILE is NULL, then TO_FILE, TO_LINE and SYSP are given their
natural values considering the file we are returning to.
A call to this function can relocate the previous set of
maps, so any stored line_map pointers should not be used. */
extern const struct line_map *linemap_add
(struct line_maps *, enum lc_reason, unsigned int sysp,
const char *to_file, unsigned int to_line);
/* Given a logical line, returns the map from which the corresponding
(source file, line) pair can be deduced. */
extern const struct line_map *linemap_lookup
(struct line_maps *, source_location);
/* Print the file names and line numbers of the #include commands
which led to the map MAP, if any, to stderr. Nothing is output if
the most recently listed stack is the same as the current one. */
extern void linemap_print_containing_files (struct line_maps *,
const struct line_map *);
/* Converts a map and a source_location to source line. */
#define SOURCE_LINE(MAP, LINE) \
((((LINE) - (MAP)->start_location) >> (MAP)->column_bits) + (MAP)->to_line)
#define SOURCE_COLUMN(MAP, LINE) \
(((LINE) - (MAP)->start_location) & ((1 << (MAP)->column_bits) - 1))
/* Returns the last source line within a map. This is the (last) line
of the #include, or other directive, that caused a map change. */
#define LAST_SOURCE_LINE(MAP) \
SOURCE_LINE (MAP, LAST_SOURCE_LINE_LOCATION (MAP))
#define LAST_SOURCE_LINE_LOCATION(MAP) \
((((MAP)[1].start_location - 1 - (MAP)->start_location) \
& ~((1 << (MAP)->column_bits) - 1)) \
+ (MAP)->start_location)
/* Returns the map a given map was included from. */
#define INCLUDED_FROM(SET, MAP) (&(SET)->maps[(MAP)->included_from])
/* Nonzero if the map is at the bottom of the include stack. */
#define MAIN_FILE_P(MAP) ((MAP)->included_from < 0)
/* Set LOC to a source position that is the same line as the most recent
linemap_line_start, but with the specified TO_COLUMN column number. */
#define LINEMAP_POSITION_FOR_COLUMN(LOC, SET, TO_COLUMN) { \
unsigned int to_column = (TO_COLUMN); \
struct line_maps *set = (SET); \
if (__builtin_expect (to_column >= set->max_column_hint, 0)) \
(LOC) = linemap_position_for_column (set, to_column); \
else { \
source_location r = set->highest_line; \
r = r + to_column; \
if (r >= set->highest_location) \
set->highest_location = r; \
(LOC) = r; \
}}
extern source_location
linemap_position_for_column (struct line_maps *set, unsigned int to_column);
#endif /* !LIBCPP_LINE_MAP_H */

View File

@ -0,0 +1,79 @@
/* Dependency generator for Makefile fragments.
Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
Contributed by Zack Weinberg, Mar 2000
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, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
#ifndef LIBCPP_MKDEPS_H
#define LIBCPP_MKDEPS_H
/* This is the data structure used by all the functions in mkdeps.c.
It's quite straightforward, but should be treated as opaque. */
struct deps;
/* Create a deps buffer. */
extern struct deps *deps_init (void);
/* Destroy a deps buffer. */
extern void deps_free (struct deps *);
/* Add a set of "vpath" directories. The second argument is a colon-
separated list of pathnames, like you would set Make's VPATH
variable to. If a dependency or target name begins with any of
these pathnames (and the next path element is not "..") that
pathname is stripped off. */
extern void deps_add_vpath (struct deps *, const char *);
/* Add a target (appears on left side of the colon) to the deps list. Takes
a boolean indicating whether to quote the target for MAKE. */
extern void deps_add_target (struct deps *, const char *, int);
/* Sets the default target if none has been given already. An empty
string as the default target is interpreted as stdin. */
extern void deps_add_default_target (struct deps *, const char *);
/* Add a dependency (appears on the right side of the colon) to the
deps list. Dependencies will be printed in the order that they
were entered with this function. By convention, the first
dependency entered should be the primary source file. */
extern void deps_add_dep (struct deps *, const char *);
/* Write out a deps buffer to a specified file. The third argument
is the number of columns to word-wrap at (0 means don't wrap). */
extern void deps_write (const struct deps *, FILE *, unsigned int);
/* Write out a deps buffer to a file, in a form that can be read back
with deps_restore. Returns nonzero on error, in which case the
error number will be in errno. */
extern int deps_save (struct deps *, FILE *);
/* Read back dependency information written with deps_save into
the deps buffer. The third argument may be NULL, in which case
the dependency information is just skipped, or it may be a filename,
in which case that filename is skipped. */
extern int deps_restore (struct deps *, FILE *, const char *);
/* For each dependency *except the first*, emit a dummy rule for that
file, causing it to depend on nothing. This is used to work around
the intermediate-file deletion misfeature in Make, in some
automatic dependency schemes. */
extern void deps_phony_targets (const struct deps *, FILE *);
#endif /* ! LIBCPP_MKDEPS_H */

View File

@ -0,0 +1,96 @@
/* Hash tables.
Copyright (C) 2000, 2001, 2003, 2004 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, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef LIBCPP_SYMTAB_H
#define LIBCPP_SYMTAB_H
#include "obstack.h"
#define GTY(x) /* nothing */
/* This is what each hash table entry points to. It may be embedded
deeply within another object. */
typedef struct ht_identifier ht_identifier;
struct ht_identifier GTY(())
{
const unsigned char *str;
unsigned int len;
unsigned int hash_value;
};
#define HT_LEN(NODE) ((NODE)->len)
#define HT_STR(NODE) ((NODE)->str)
typedef struct ht hash_table;
typedef struct ht_identifier *hashnode;
enum ht_lookup_option {HT_NO_INSERT = 0, HT_ALLOC, HT_ALLOCED};
/* An identifier hash table for cpplib and the front ends. */
struct ht
{
/* Identifiers are allocated from here. */
struct obstack stack;
hashnode *entries;
/* Call back, allocate a node. */
hashnode (*alloc_node) (hash_table *);
/* Call back, allocate something that hangs off a node like a cpp_macro.
NULL means use the usual allocator. */
void * (*alloc_subobject) (size_t);
unsigned int nslots; /* Total slots in the entries array. */
unsigned int nelements; /* Number of live elements. */
/* Link to reader, if any. For the benefit of cpplib. */
struct cpp_reader *pfile;
/* Table usage statistics. */
unsigned int searches;
unsigned int collisions;
/* Should 'entries' be freed when it is no longer needed? */
bool entries_owned;
};
/* Initialize the hashtable with 2 ^ order entries. */
extern hash_table *ht_create (unsigned int order);
/* Frees all memory associated with a hash table. */
extern void ht_destroy (hash_table *);
extern hashnode ht_lookup (hash_table *, const unsigned char *,
size_t, enum ht_lookup_option);
extern hashnode ht_lookup_with_hash (hash_table *, const unsigned char *,
size_t, unsigned int,
enum ht_lookup_option);
#define HT_HASHSTEP(r, c) ((r) * 67 + ((c) - 113));
#define HT_HASHFINISH(r, len) ((r) + (len))
/* For all nodes in TABLE, make a callback. The callback takes
TABLE->PFILE, the node, and a PTR, and the callback sequence stops
if the callback returns zero. */
typedef int (*ht_cb) (struct cpp_reader *, hashnode, const void *);
extern void ht_forall (hash_table *, ht_cb, const void *);
/* Restore the hash table. */
extern void ht_load (hash_table *ht, hashnode *entries,
unsigned int nslots, unsigned int nelements, bool own);
/* Dump allocation statistics to stderr. */
extern void ht_dump_statistics (hash_table *);
#endif /* LIBCPP_SYMTAB_H */

View File

@ -0,0 +1,638 @@
/* CPP Library.
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Per Bothner, 1994-95.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
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, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#include "config.h"
#include "system.h"
#include "cpplib.h"
#include "internal.h"
#include "mkdeps.h"
#include "localedir.h"
static void init_library (void);
static void mark_named_operators (cpp_reader *);
static void read_original_filename (cpp_reader *);
static void read_original_directory (cpp_reader *);
static void post_options (cpp_reader *);
/* If we have designated initializers (GCC >2.7) these tables can be
initialized, constant data. Otherwise, they have to be filled in at
runtime. */
#if HAVE_DESIGNATED_INITIALIZERS
#define init_trigraph_map() /* Nothing. */
#define TRIGRAPH_MAP \
__extension__ const uchar _cpp_trigraph_map[UCHAR_MAX + 1] = {
#define END };
#define s(p, v) [p] = v,
#else
#define TRIGRAPH_MAP uchar _cpp_trigraph_map[UCHAR_MAX + 1] = { 0 }; \
static void init_trigraph_map (void) { \
unsigned char *x = _cpp_trigraph_map;
#define END }
#define s(p, v) x[p] = v;
#endif
TRIGRAPH_MAP
s('=', '#') s(')', ']') s('!', '|')
s('(', '[') s('\'', '^') s('>', '}')
s('/', '\\') s('<', '{') s('-', '~')
END
#undef s
#undef END
#undef TRIGRAPH_MAP
/* A set of booleans indicating what CPP features each source language
requires. */
struct lang_flags
{
char c99;
char cplusplus;
char extended_numbers;
char extended_identifiers;
char std;
char cplusplus_comments;
char digraphs;
};
static const struct lang_flags lang_defaults[] =
{ /* c99 c++ xnum xid std // digr */
/* GNUC89 */ { 0, 0, 1, 0, 0, 1, 1 },
/* GNUC99 */ { 1, 0, 1, 0, 0, 1, 1 },
/* STDC89 */ { 0, 0, 0, 0, 1, 0, 0 },
/* STDC94 */ { 0, 0, 0, 0, 1, 0, 1 },
/* STDC99 */ { 1, 0, 1, 0, 1, 1, 1 },
/* GNUCXX */ { 0, 1, 1, 0, 0, 1, 1 },
/* CXX98 */ { 0, 1, 1, 0, 1, 1, 1 },
/* ASM */ { 0, 0, 1, 0, 0, 1, 0 }
/* xid should be 1 for GNUC99, STDC99, GNUCXX and CXX98 when no
longer experimental (when all uses of identifiers in the compiler
have been audited for correct handling of extended
identifiers). */
};
/* Sets internal flags correctly for a given language. */
void
cpp_set_lang (cpp_reader *pfile, enum c_lang lang)
{
const struct lang_flags *l = &lang_defaults[(int) lang];
CPP_OPTION (pfile, lang) = lang;
CPP_OPTION (pfile, c99) = l->c99;
CPP_OPTION (pfile, cplusplus) = l->cplusplus;
CPP_OPTION (pfile, extended_numbers) = l->extended_numbers;
CPP_OPTION (pfile, extended_identifiers) = l->extended_identifiers;
CPP_OPTION (pfile, std) = l->std;
CPP_OPTION (pfile, trigraphs) = l->std;
CPP_OPTION (pfile, cplusplus_comments) = l->cplusplus_comments;
CPP_OPTION (pfile, digraphs) = l->digraphs;
}
/* Initialize library global state. */
static void
init_library (void)
{
static int initialized = 0;
if (! initialized)
{
initialized = 1;
/* Set up the trigraph map. This doesn't need to do anything if
we were compiled with a compiler that supports C99 designated
initializers. */
init_trigraph_map ();
#ifdef ENABLE_NLS
(void) bindtextdomain (PACKAGE, LOCALEDIR);
#endif
}
}
/* Initialize a cpp_reader structure. */
cpp_reader *
cpp_create_reader (enum c_lang lang, hash_table *table,
struct line_maps *line_table)
{
cpp_reader *pfile;
/* Initialize this instance of the library if it hasn't been already. */
init_library ();
pfile = XCNEW (cpp_reader);
cpp_set_lang (pfile, lang);
CPP_OPTION (pfile, warn_multichar) = 1;
CPP_OPTION (pfile, discard_comments) = 1;
CPP_OPTION (pfile, discard_comments_in_macro_exp) = 1;
CPP_OPTION (pfile, show_column) = 1;
CPP_OPTION (pfile, tabstop) = 8;
CPP_OPTION (pfile, operator_names) = 1;
CPP_OPTION (pfile, warn_trigraphs) = 2;
CPP_OPTION (pfile, warn_endif_labels) = 1;
CPP_OPTION (pfile, warn_deprecated) = 1;
CPP_OPTION (pfile, warn_long_long) = !CPP_OPTION (pfile, c99);
CPP_OPTION (pfile, dollars_in_ident) = 1;
CPP_OPTION (pfile, warn_dollars) = 1;
CPP_OPTION (pfile, warn_variadic_macros) = 1;
CPP_OPTION (pfile, warn_normalize) = normalized_C;
/* Default CPP arithmetic to something sensible for the host for the
benefit of dumb users like fix-header. */
CPP_OPTION (pfile, precision) = CHAR_BIT * sizeof (long);
CPP_OPTION (pfile, char_precision) = CHAR_BIT;
CPP_OPTION (pfile, wchar_precision) = CHAR_BIT * sizeof (int);
CPP_OPTION (pfile, int_precision) = CHAR_BIT * sizeof (int);
CPP_OPTION (pfile, unsigned_char) = 0;
CPP_OPTION (pfile, unsigned_wchar) = 1;
CPP_OPTION (pfile, bytes_big_endian) = 1; /* does not matter */
/* Default to no charset conversion. */
CPP_OPTION (pfile, narrow_charset) = _cpp_default_encoding ();
CPP_OPTION (pfile, wide_charset) = 0;
/* Default the input character set to UTF-8. */
CPP_OPTION (pfile, input_charset) = _cpp_default_encoding ();
/* A fake empty "directory" used as the starting point for files
looked up without a search path. Name cannot be '/' because we
don't want to prepend anything at all to filenames using it. All
other entries are correct zero-initialized. */
pfile->no_search_path.name = (char *) "";
/* Initialize the line map. */
pfile->line_table = line_table;
/* Initialize lexer state. */
pfile->state.save_comments = ! CPP_OPTION (pfile, discard_comments);
/* Set up static tokens. */
pfile->avoid_paste.type = CPP_PADDING;
pfile->avoid_paste.val.source = NULL;
pfile->eof.type = CPP_EOF;
pfile->eof.flags = 0;
/* Create a token buffer for the lexer. */
_cpp_init_tokenrun (&pfile->base_run, 250);
pfile->cur_run = &pfile->base_run;
pfile->cur_token = pfile->base_run.base;
/* Initialize the base context. */
pfile->context = &pfile->base_context;
pfile->base_context.macro = 0;
pfile->base_context.prev = pfile->base_context.next = 0;
/* Aligned and unaligned storage. */
pfile->a_buff = _cpp_get_buff (pfile, 0);
pfile->u_buff = _cpp_get_buff (pfile, 0);
/* The expression parser stack. */
_cpp_expand_op_stack (pfile);
/* Initialize the buffer obstack. */
_obstack_begin (&pfile->buffer_ob, 0, 0,
(void *(*) (long)) xmalloc,
(void (*) (void *)) free);
_cpp_init_files (pfile);
_cpp_init_hashtable (pfile, table);
return pfile;
}
/* Free resources used by PFILE. Accessing PFILE after this function
returns leads to undefined behavior. Returns the error count. */
void
cpp_destroy (cpp_reader *pfile)
{
cpp_context *context, *contextn;
tokenrun *run, *runn;
free (pfile->op_stack);
while (CPP_BUFFER (pfile) != NULL)
_cpp_pop_buffer (pfile);
if (pfile->out.base)
free (pfile->out.base);
if (pfile->macro_buffer)
{
free (pfile->macro_buffer);
pfile->macro_buffer = NULL;
pfile->macro_buffer_len = 0;
}
if (pfile->deps)
deps_free (pfile->deps);
obstack_free (&pfile->buffer_ob, 0);
_cpp_destroy_hashtable (pfile);
_cpp_cleanup_files (pfile);
_cpp_destroy_iconv (pfile);
_cpp_free_buff (pfile->a_buff);
_cpp_free_buff (pfile->u_buff);
_cpp_free_buff (pfile->free_buffs);
for (run = &pfile->base_run; run; run = runn)
{
runn = run->next;
free (run->base);
if (run != &pfile->base_run)
free (run);
}
for (context = pfile->base_context.next; context; context = contextn)
{
contextn = context->next;
free (context);
}
free (pfile);
}
/* This structure defines one built-in identifier. A node will be
entered in the hash table under the name NAME, with value VALUE.
There are two tables of these. builtin_array holds all the
"builtin" macros: these are handled by builtin_macro() in
macro.c. Builtin is somewhat of a misnomer -- the property of
interest is that these macros require special code to compute their
expansions. The value is a "builtin_type" enumerator.
operator_array holds the C++ named operators. These are keywords
which act as aliases for punctuators. In C++, they cannot be
altered through #define, and #if recognizes them as operators. In
C, these are not entered into the hash table at all (but see
<iso646.h>). The value is a token-type enumerator. */
struct builtin
{
const uchar *name;
unsigned short len;
unsigned short value;
};
#define B(n, t) { DSC(n), t }
static const struct builtin builtin_array[] =
{
B("__TIMESTAMP__", BT_TIMESTAMP),
B("__TIME__", BT_TIME),
B("__DATE__", BT_DATE),
B("__FILE__", BT_FILE),
B("__BASE_FILE__", BT_BASE_FILE),
B("__LINE__", BT_SPECLINE),
B("__INCLUDE_LEVEL__", BT_INCLUDE_LEVEL),
/* Keep builtins not used for -traditional-cpp at the end, and
update init_builtins() if any more are added. */
B("_Pragma", BT_PRAGMA),
B("__STDC__", BT_STDC),
};
static const struct builtin operator_array[] =
{
B("and", CPP_AND_AND),
B("and_eq", CPP_AND_EQ),
B("bitand", CPP_AND),
B("bitor", CPP_OR),
B("compl", CPP_COMPL),
B("not", CPP_NOT),
B("not_eq", CPP_NOT_EQ),
B("or", CPP_OR_OR),
B("or_eq", CPP_OR_EQ),
B("xor", CPP_XOR),
B("xor_eq", CPP_XOR_EQ)
};
#undef B
/* Mark the C++ named operators in the hash table. */
static void
mark_named_operators (cpp_reader *pfile)
{
const struct builtin *b;
for (b = operator_array;
b < (operator_array + ARRAY_SIZE (operator_array));
b++)
{
cpp_hashnode *hp = cpp_lookup (pfile, b->name, b->len);
hp->flags |= NODE_OPERATOR;
hp->is_directive = 0;
hp->directive_index = b->value;
}
}
/* Read the builtins table above and enter them, and language-specific
macros, into the hash table. HOSTED is true if this is a hosted
environment. */
void
cpp_init_builtins (cpp_reader *pfile, int hosted)
{
const struct builtin *b;
size_t n = ARRAY_SIZE (builtin_array);
if (CPP_OPTION (pfile, traditional))
n -= 2;
else if (! CPP_OPTION (pfile, stdc_0_in_system_headers)
|| CPP_OPTION (pfile, std))
{
n--;
_cpp_define_builtin (pfile, "__STDC__ 1");
}
for (b = builtin_array; b < builtin_array + n; b++)
{
cpp_hashnode *hp = cpp_lookup (pfile, b->name, b->len);
hp->type = NT_MACRO;
hp->flags |= NODE_BUILTIN | NODE_WARN;
hp->value.builtin = (enum builtin_type) b->value;
}
if (CPP_OPTION (pfile, cplusplus))
_cpp_define_builtin (pfile, "__cplusplus 1");
else if (CPP_OPTION (pfile, lang) == CLK_ASM)
_cpp_define_builtin (pfile, "__ASSEMBLER__ 1");
else if (CPP_OPTION (pfile, lang) == CLK_STDC94)
_cpp_define_builtin (pfile, "__STDC_VERSION__ 199409L");
else if (CPP_OPTION (pfile, c99))
_cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L");
if (hosted)
_cpp_define_builtin (pfile, "__STDC_HOSTED__ 1");
else
_cpp_define_builtin (pfile, "__STDC_HOSTED__ 0");
if (CPP_OPTION (pfile, objc))
_cpp_define_builtin (pfile, "__OBJC__ 1");
}
/* Sanity-checks are dependent on command-line options, so it is
called as a subroutine of cpp_read_main_file (). */
#if ENABLE_CHECKING
static void sanity_checks (cpp_reader *);
static void sanity_checks (cpp_reader *pfile)
{
cppchar_t test = 0;
size_t max_precision = 2 * CHAR_BIT * sizeof (cpp_num_part);
/* Sanity checks for assumptions about CPP arithmetic and target
type precisions made by cpplib. */
test--;
if (test < 1)
cpp_error (pfile, CPP_DL_ICE, "cppchar_t must be an unsigned type");
if (CPP_OPTION (pfile, precision) > max_precision)
cpp_error (pfile, CPP_DL_ICE,
"preprocessor arithmetic has maximum precision of %lu bits;"
" target requires %lu bits",
(unsigned long) max_precision,
(unsigned long) CPP_OPTION (pfile, precision));
if (CPP_OPTION (pfile, precision) < CPP_OPTION (pfile, int_precision))
cpp_error (pfile, CPP_DL_ICE,
"CPP arithmetic must be at least as precise as a target int");
if (CPP_OPTION (pfile, char_precision) < 8)
cpp_error (pfile, CPP_DL_ICE, "target char is less than 8 bits wide");
if (CPP_OPTION (pfile, wchar_precision) < CPP_OPTION (pfile, char_precision))
cpp_error (pfile, CPP_DL_ICE,
"target wchar_t is narrower than target char");
if (CPP_OPTION (pfile, int_precision) < CPP_OPTION (pfile, char_precision))
cpp_error (pfile, CPP_DL_ICE,
"target int is narrower than target char");
/* This is assumed in eval_token() and could be fixed if necessary. */
if (sizeof (cppchar_t) > sizeof (cpp_num_part))
cpp_error (pfile, CPP_DL_ICE,
"CPP half-integer narrower than CPP character");
if (CPP_OPTION (pfile, wchar_precision) > BITS_PER_CPPCHAR_T)
cpp_error (pfile, CPP_DL_ICE,
"CPP on this host cannot handle wide character constants over"
" %lu bits, but the target requires %lu bits",
(unsigned long) BITS_PER_CPPCHAR_T,
(unsigned long) CPP_OPTION (pfile, wchar_precision));
}
#else
# define sanity_checks(PFILE)
#endif
/* This is called after options have been parsed, and partially
processed. */
void
cpp_post_options (cpp_reader *pfile)
{
sanity_checks (pfile);
post_options (pfile);
/* Mark named operators before handling command line macros. */
if (CPP_OPTION (pfile, cplusplus) && CPP_OPTION (pfile, operator_names))
mark_named_operators (pfile);
}
/* Setup for processing input from the file named FNAME, or stdin if
it is the empty string. Return the original filename
on success (e.g. foo.i->foo.c), or NULL on failure. */
const char *
cpp_read_main_file (cpp_reader *pfile, const char *fname)
{
if (CPP_OPTION (pfile, deps.style) != DEPS_NONE)
{
if (!pfile->deps)
pfile->deps = deps_init ();
/* Set the default target (if there is none already). */
deps_add_default_target (pfile->deps, fname);
}
pfile->main_file
= _cpp_find_file (pfile, fname, &pfile->no_search_path, false, 0);
if (_cpp_find_failed (pfile->main_file))
return NULL;
_cpp_stack_file (pfile, pfile->main_file, false);
/* For foo.i, read the original filename foo.c now, for the benefit
of the front ends. */
if (CPP_OPTION (pfile, preprocessed))
{
read_original_filename (pfile);
fname = pfile->line_table->maps[pfile->line_table->used-1].to_file;
}
return fname;
}
/* For preprocessed files, if the first tokens are of the form # NUM.
handle the directive so we know the original file name. This will
generate file_change callbacks, which the front ends must handle
appropriately given their state of initialization. */
static void
read_original_filename (cpp_reader *pfile)
{
const cpp_token *token, *token1;
/* Lex ahead; if the first tokens are of the form # NUM, then
process the directive, otherwise back up. */
token = _cpp_lex_direct (pfile);
if (token->type == CPP_HASH)
{
pfile->state.in_directive = 1;
token1 = _cpp_lex_direct (pfile);
_cpp_backup_tokens (pfile, 1);
pfile->state.in_directive = 0;
/* If it's a #line directive, handle it. */
if (token1->type == CPP_NUMBER)
{
_cpp_handle_directive (pfile, token->flags & PREV_WHITE);
read_original_directory (pfile);
return;
}
}
/* Backup as if nothing happened. */
_cpp_backup_tokens (pfile, 1);
}
/* For preprocessed files, if the tokens following the first filename
line is of the form # <line> "/path/name//", handle the
directive so we know the original current directory. */
static void
read_original_directory (cpp_reader *pfile)
{
const cpp_token *hash, *token;
/* Lex ahead; if the first tokens are of the form # NUM, then
process the directive, otherwise back up. */
hash = _cpp_lex_direct (pfile);
if (hash->type != CPP_HASH)
{
_cpp_backup_tokens (pfile, 1);
return;
}
token = _cpp_lex_direct (pfile);
if (token->type != CPP_NUMBER)
{
_cpp_backup_tokens (pfile, 2);
return;
}
token = _cpp_lex_direct (pfile);
if (token->type != CPP_STRING
|| ! (token->val.str.len >= 5
&& token->val.str.text[token->val.str.len-2] == '/'
&& token->val.str.text[token->val.str.len-3] == '/'))
{
_cpp_backup_tokens (pfile, 3);
return;
}
if (pfile->cb.dir_change)
{
char *debugdir = (char *) alloca (token->val.str.len - 3);
memcpy (debugdir, (const char *) token->val.str.text + 1,
token->val.str.len - 4);
debugdir[token->val.str.len - 4] = '\0';
pfile->cb.dir_change (pfile, debugdir);
}
}
/* This is called at the end of preprocessing. It pops the last
buffer and writes dependency output, and returns the number of
errors.
Maybe it should also reset state, such that you could call
cpp_start_read with a new filename to restart processing. */
int
cpp_finish (cpp_reader *pfile, FILE *deps_stream)
{
/* Warn about unused macros before popping the final buffer. */
if (CPP_OPTION (pfile, warn_unused_macros))
cpp_forall_identifiers (pfile, _cpp_warn_if_unused_macro, NULL);
/* lex.c leaves the final buffer on the stack. This it so that
it returns an unending stream of CPP_EOFs to the client. If we
popped the buffer, we'd dereference a NULL buffer pointer and
segfault. It's nice to allow the client to do worry-free excess
cpp_get_token calls. */
while (pfile->buffer)
_cpp_pop_buffer (pfile);
/* Don't write the deps file if there are errors. */
if (CPP_OPTION (pfile, deps.style) != DEPS_NONE
&& deps_stream && pfile->errors == 0)
{
deps_write (pfile->deps, deps_stream, 72);
if (CPP_OPTION (pfile, deps.phony_targets))
deps_phony_targets (pfile->deps, deps_stream);
}
/* Report on headers that could use multiple include guards. */
if (CPP_OPTION (pfile, print_include_names))
_cpp_report_missing_guards (pfile);
return pfile->errors;
}
static void
post_options (cpp_reader *pfile)
{
/* -Wtraditional is not useful in C++ mode. */
if (CPP_OPTION (pfile, cplusplus))
CPP_OPTION (pfile, warn_traditional) = 0;
/* Permanently disable macro expansion if we are rescanning
preprocessed text. Read preprocesed source in ISO mode. */
if (CPP_OPTION (pfile, preprocessed))
{
pfile->state.prevent_expansion = 1;
CPP_OPTION (pfile, traditional) = 0;
}
if (CPP_OPTION (pfile, warn_trigraphs) == 2)
CPP_OPTION (pfile, warn_trigraphs) = !CPP_OPTION (pfile, trigraphs);
if (CPP_OPTION (pfile, traditional))
{
CPP_OPTION (pfile, cplusplus_comments) = 0;
/* Traditional CPP does not accurately track column information. */
CPP_OPTION (pfile, show_column) = 0;
CPP_OPTION (pfile, trigraphs) = 0;
CPP_OPTION (pfile, warn_trigraphs) = 0;
}
}

View File

@ -0,0 +1,670 @@
/* Part of CPP library.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
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, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* This header defines all the internal data structures and functions
that need to be visible across files. It should not be used outside
cpplib. */
#ifndef LIBCPP_INTERNAL_H
#define LIBCPP_INTERNAL_H
#include "symtab.h"
#include "cpp-id-data.h"
#ifndef HAVE_ICONV_H
#undef HAVE_ICONV
#endif
#if HAVE_ICONV
#include <iconv.h>
#else
#define HAVE_ICONV 0
typedef int iconv_t; /* dummy */
#endif
struct directive; /* Deliberately incomplete. */
struct pending_option;
struct op;
struct _cpp_strbuf;
typedef bool (*convert_f) (iconv_t, const unsigned char *, size_t,
struct _cpp_strbuf *);
struct cset_converter
{
convert_f func;
iconv_t cd;
};
#define BITS_PER_CPPCHAR_T (CHAR_BIT * sizeof (cppchar_t))
/* Test if a sign is valid within a preprocessing number. */
#define VALID_SIGN(c, prevc) \
(((c) == '+' || (c) == '-') && \
((prevc) == 'e' || (prevc) == 'E' \
|| (((prevc) == 'p' || (prevc) == 'P') \
&& CPP_OPTION (pfile, extended_numbers))))
#define CPP_OPTION(PFILE, OPTION) ((PFILE)->opts.OPTION)
#define CPP_BUFFER(PFILE) ((PFILE)->buffer)
#define CPP_BUF_COLUMN(BUF, CUR) ((CUR) - (BUF)->line_base)
#define CPP_BUF_COL(BUF) CPP_BUF_COLUMN(BUF, (BUF)->cur)
#define CPP_INCREMENT_LINE(PFILE, COLS_HINT) do { \
const struct line_maps *line_table = PFILE->line_table; \
const struct line_map *map = &line_table->maps[line_table->used-1]; \
unsigned int line = SOURCE_LINE (map, line_table->highest_line); \
linemap_line_start (PFILE->line_table, line + 1, COLS_HINT); \
} while (0)
/* Maximum nesting of cpp_buffers. We use a static limit, partly for
efficiency, and partly to limit runaway recursion. */
#define CPP_STACK_MAX 200
/* Host alignment handling. */
struct dummy
{
char c;
union
{
double d;
int *p;
} u;
};
#define DEFAULT_ALIGNMENT offsetof (struct dummy, u)
#define CPP_ALIGN2(size, align) (((size) + ((align) - 1)) & ~((align) - 1))
#define CPP_ALIGN(size) CPP_ALIGN2 (size, DEFAULT_ALIGNMENT)
#define _cpp_mark_macro_used(NODE) do { \
if ((NODE)->type == NT_MACRO && !((NODE)->flags & NODE_BUILTIN)) \
(NODE)->value.macro->used = 1; } while (0)
/* A generic memory buffer, and operations on it. */
typedef struct _cpp_buff _cpp_buff;
struct _cpp_buff
{
struct _cpp_buff *next;
unsigned char *base, *cur, *limit;
};
extern _cpp_buff *_cpp_get_buff (cpp_reader *, size_t);
extern void _cpp_release_buff (cpp_reader *, _cpp_buff *);
extern void _cpp_extend_buff (cpp_reader *, _cpp_buff **, size_t);
extern _cpp_buff *_cpp_append_extend_buff (cpp_reader *, _cpp_buff *, size_t);
extern void _cpp_free_buff (_cpp_buff *);
extern unsigned char *_cpp_aligned_alloc (cpp_reader *, size_t);
extern unsigned char *_cpp_unaligned_alloc (cpp_reader *, size_t);
#define BUFF_ROOM(BUFF) (size_t) ((BUFF)->limit - (BUFF)->cur)
#define BUFF_FRONT(BUFF) ((BUFF)->cur)
#define BUFF_LIMIT(BUFF) ((BUFF)->limit)
/* #include types. */
enum include_type {IT_INCLUDE, IT_INCLUDE_NEXT, IT_IMPORT, IT_CMDLINE};
union utoken
{
const cpp_token *token;
const cpp_token **ptoken;
};
/* A "run" of tokens; part of a chain of runs. */
typedef struct tokenrun tokenrun;
struct tokenrun
{
tokenrun *next, *prev;
cpp_token *base, *limit;
};
/* Accessor macros for struct cpp_context. */
#define FIRST(c) ((c)->u.iso.first)
#define LAST(c) ((c)->u.iso.last)
#define CUR(c) ((c)->u.trad.cur)
#define RLIMIT(c) ((c)->u.trad.rlimit)
typedef struct cpp_context cpp_context;
struct cpp_context
{
/* Doubly-linked list. */
cpp_context *next, *prev;
union
{
/* For ISO macro expansion. Contexts other than the base context
are contiguous tokens. e.g. macro expansions, expanded
argument tokens. */
struct
{
union utoken first;
union utoken last;
} iso;
/* For traditional macro expansion. */
struct
{
const unsigned char *cur;
const unsigned char *rlimit;
} trad;
} u;
/* If non-NULL, a buffer used for storage related to this context.
When the context is popped, the buffer is released. */
_cpp_buff *buff;
/* For a macro context, the macro node, otherwise NULL. */
cpp_hashnode *macro;
/* True if utoken element is token, else ptoken. */
bool direct_p;
};
struct lexer_state
{
/* Nonzero if first token on line is CPP_HASH. */
unsigned char in_directive;
/* Nonzero if in a directive that will handle padding tokens itself.
#include needs this to avoid problems with computed include and
spacing between tokens. */
unsigned char directive_wants_padding;
/* True if we are skipping a failed conditional group. */
unsigned char skipping;
/* Nonzero if in a directive that takes angle-bracketed headers. */
unsigned char angled_headers;
/* Nonzero if in a #if or #elif directive. */
unsigned char in_expression;
/* Nonzero to save comments. Turned off if discard_comments, and in
all directives apart from #define. */
unsigned char save_comments;
/* Nonzero if lexing __VA_ARGS__ is valid. */
unsigned char va_args_ok;
/* Nonzero if lexing poisoned identifiers is valid. */
unsigned char poisoned_ok;
/* Nonzero to prevent macro expansion. */
unsigned char prevent_expansion;
/* Nonzero when parsing arguments to a function-like macro. */
unsigned char parsing_args;
/* Nonzero if prevent_expansion is true only because output is
being discarded. */
unsigned char discarding_output;
/* Nonzero to skip evaluating part of an expression. */
unsigned int skip_eval;
/* Nonzero when handling a deferred pragma. */
unsigned char in_deferred_pragma;
/* Nonzero if the deferred pragma being handled allows macro expansion. */
unsigned char pragma_allow_expansion;
};
/* Special nodes - identifiers with predefined significance. */
struct spec_nodes
{
cpp_hashnode *n_defined; /* defined operator */
cpp_hashnode *n_true; /* C++ keyword true */
cpp_hashnode *n_false; /* C++ keyword false */
cpp_hashnode *n__VA_ARGS__; /* C99 vararg macros */
};
typedef struct _cpp_line_note _cpp_line_note;
struct _cpp_line_note
{
/* Location in the clean line the note refers to. */
const unsigned char *pos;
/* Type of note. The 9 'from' trigraph characters represent those
trigraphs, '\\' an escaped newline, ' ' an escaped newline with
intervening space, and anything else is invalid. */
unsigned int type;
};
/* Represents the contents of a file cpplib has read in. */
struct cpp_buffer
{
const unsigned char *cur; /* Current location. */
const unsigned char *line_base; /* Start of current physical line. */
const unsigned char *next_line; /* Start of to-be-cleaned logical line. */
const unsigned char *buf; /* Entire character buffer. */
const unsigned char *rlimit; /* Writable byte at end of file. */
_cpp_line_note *notes; /* Array of notes. */
unsigned int cur_note; /* Next note to process. */
unsigned int notes_used; /* Number of notes. */
unsigned int notes_cap; /* Size of allocated array. */
struct cpp_buffer *prev;
/* Pointer into the file table; non-NULL if this is a file buffer.
Used for include_next and to record control macros. */
struct _cpp_file *file;
/* Saved value of __TIMESTAMP__ macro - date and time of last modification
of the assotiated file. */
const unsigned char *timestamp;
/* Value of if_stack at start of this file.
Used to prohibit unmatched #endif (etc) in an include file. */
struct if_stack *if_stack;
/* True if we need to get the next clean line. */
bool need_line;
/* True if we have already warned about C++ comments in this file.
The warning happens only for C89 extended mode with -pedantic on,
or for -Wtraditional, and only once per file (otherwise it would
be far too noisy). */
unsigned int warned_cplusplus_comments : 1;
/* True if we don't process trigraphs and escaped newlines. True
for preprocessed input, command line directives, and _Pragma
buffers. */
unsigned int from_stage3 : 1;
/* At EOF, a buffer is automatically popped. If RETURN_AT_EOF is
true, a CPP_EOF token is then returned. Otherwise, the next
token from the enclosing buffer is returned. */
unsigned int return_at_eof : 1;
/* One for a system header, two for a C system header file that therefore
needs to be extern "C" protected in C++, and zero otherwise. */
unsigned char sysp;
/* The directory of the this buffer's file. Its NAME member is not
allocated, so we don't need to worry about freeing it. */
struct cpp_dir dir;
/* Descriptor for converting from the input character set to the
source character set. */
struct cset_converter input_cset_desc;
};
/* A cpp_reader encapsulates the "state" of a pre-processor run.
Applying cpp_get_token repeatedly yields a stream of pre-processor
tokens. Usually, there is only one cpp_reader object active. */
struct cpp_reader
{
/* Top of buffer stack. */
cpp_buffer *buffer;
/* Overlaid buffer (can be different after processing #include). */
cpp_buffer *overlaid_buffer;
/* Lexer state. */
struct lexer_state state;
/* Source line tracking. */
struct line_maps *line_table;
/* The line of the '#' of the current directive. */
source_location directive_line;
/* Memory buffers. */
_cpp_buff *a_buff; /* Aligned permanent storage. */
_cpp_buff *u_buff; /* Unaligned permanent storage. */
_cpp_buff *free_buffs; /* Free buffer chain. */
/* Context stack. */
struct cpp_context base_context;
struct cpp_context *context;
/* If in_directive, the directive if known. */
const struct directive *directive;
/* Token generated while handling a directive, if any. */
cpp_token directive_result;
/* Search paths for include files. */
struct cpp_dir *quote_include; /* "" */
struct cpp_dir *bracket_include; /* <> */
struct cpp_dir no_search_path; /* No path. */
/* Chain of all hashed _cpp_file instances. */
struct _cpp_file *all_files;
struct _cpp_file *main_file;
/* File and directory hash table. */
struct htab *file_hash;
struct htab *dir_hash;
struct file_hash_entry *file_hash_entries;
unsigned int file_hash_entries_allocated, file_hash_entries_used;
/* Nonzero means don't look for #include "foo" the source-file
directory. */
bool quote_ignores_source_dir;
/* Nonzero if any file has contained #pragma once or #import has
been used. */
bool seen_once_only;
/* Multiple include optimization. */
const cpp_hashnode *mi_cmacro;
const cpp_hashnode *mi_ind_cmacro;
bool mi_valid;
/* Lexing. */
cpp_token *cur_token;
tokenrun base_run, *cur_run;
unsigned int lookaheads;
/* Nonzero prevents the lexer from re-using the token runs. */
unsigned int keep_tokens;
/* Error counter for exit code. */
unsigned int errors;
/* Buffer to hold macro definition string. */
unsigned char *macro_buffer;
unsigned int macro_buffer_len;
/* Descriptor for converting from the source character set to the
execution character set. */
struct cset_converter narrow_cset_desc;
/* Descriptor for converting from the source character set to the
wide execution character set. */
struct cset_converter wide_cset_desc;
/* Date and time text. Calculated together if either is requested. */
const unsigned char *date;
const unsigned char *time;
/* EOF token, and a token forcing paste avoidance. */
cpp_token avoid_paste;
cpp_token eof;
/* Opaque handle to the dependencies of mkdeps.c. */
struct deps *deps;
/* Obstack holding all macro hash nodes. This never shrinks.
See identifiers.c */
struct obstack hash_ob;
/* Obstack holding buffer and conditional structures. This is a
real stack. See directives.c. */
struct obstack buffer_ob;
/* Pragma table - dynamic, because a library user can add to the
list of recognized pragmas. */
struct pragma_entry *pragmas;
/* Call backs to cpplib client. */
struct cpp_callbacks cb;
/* Identifier hash table. */
struct ht *hash_table;
/* Expression parser stack. */
struct op *op_stack, *op_limit;
/* User visible options. */
struct cpp_options opts;
/* Special nodes - identifiers with predefined significance to the
preprocessor. */
struct spec_nodes spec_nodes;
/* Whether cpplib owns the hashtable. */
bool our_hashtable;
/* Traditional preprocessing output buffer (a logical line). */
struct
{
unsigned char *base;
unsigned char *limit;
unsigned char *cur;
source_location first_line;
} out;
/* Used for buffer overlays by traditional.c. */
const unsigned char *saved_cur, *saved_rlimit, *saved_line_base;
/* A saved list of the defined macros, for dependency checking
of precompiled headers. */
struct cpp_savedstate *savedstate;
};
/* Character classes. Based on the more primitive macros in safe-ctype.h.
If the definition of `numchar' looks odd to you, please look up the
definition of a pp-number in the C standard [section 6.4.8 of C99].
In the unlikely event that characters other than \r and \n enter
the set is_vspace, the macro handle_newline() in lex.c must be
updated. */
#define _dollar_ok(x) ((x) == '$' && CPP_OPTION (pfile, dollars_in_ident))
#define is_idchar(x) (ISIDNUM(x) || _dollar_ok(x))
#define is_numchar(x) ISIDNUM(x)
#define is_idstart(x) (ISIDST(x) || _dollar_ok(x))
#define is_numstart(x) ISDIGIT(x)
#define is_hspace(x) ISBLANK(x)
#define is_vspace(x) IS_VSPACE(x)
#define is_nvspace(x) IS_NVSPACE(x)
#define is_space(x) IS_SPACE_OR_NUL(x)
/* This table is constant if it can be initialized at compile time,
which is the case if cpp was compiled with GCC >=2.7, or another
compiler that supports C99. */
#if HAVE_DESIGNATED_INITIALIZERS
extern const unsigned char _cpp_trigraph_map[UCHAR_MAX + 1];
#else
extern unsigned char _cpp_trigraph_map[UCHAR_MAX + 1];
#endif
/* Macros. */
static inline int cpp_in_system_header (cpp_reader *);
static inline int
cpp_in_system_header (cpp_reader *pfile)
{
return pfile->buffer ? pfile->buffer->sysp : 0;
}
#define CPP_PEDANTIC(PF) CPP_OPTION (PF, pedantic)
#define CPP_WTRADITIONAL(PF) CPP_OPTION (PF, warn_traditional)
/* In errors.c */
extern int _cpp_begin_message (cpp_reader *, int,
source_location, unsigned int);
/* In macro.c */
extern void _cpp_free_definition (cpp_hashnode *);
extern bool _cpp_create_definition (cpp_reader *, cpp_hashnode *);
extern void _cpp_pop_context (cpp_reader *);
extern void _cpp_push_text_context (cpp_reader *, cpp_hashnode *,
const unsigned char *, size_t);
extern bool _cpp_save_parameter (cpp_reader *, cpp_macro *, cpp_hashnode *);
extern bool _cpp_arguments_ok (cpp_reader *, cpp_macro *, const cpp_hashnode *,
unsigned int);
extern const unsigned char *_cpp_builtin_macro_text (cpp_reader *,
cpp_hashnode *);
extern int _cpp_warn_if_unused_macro (cpp_reader *, cpp_hashnode *, void *);
extern void _cpp_push_token_context (cpp_reader *, cpp_hashnode *,
const cpp_token *, unsigned int);
/* In identifiers.c */
extern void _cpp_init_hashtable (cpp_reader *, hash_table *);
extern void _cpp_destroy_hashtable (cpp_reader *);
/* In files.c */
typedef struct _cpp_file _cpp_file;
extern _cpp_file *_cpp_find_file (cpp_reader *, const char *, cpp_dir *,
bool, int);
extern bool _cpp_find_failed (_cpp_file *);
extern void _cpp_mark_file_once_only (cpp_reader *, struct _cpp_file *);
extern void _cpp_fake_include (cpp_reader *, const char *);
extern bool _cpp_stack_file (cpp_reader *, _cpp_file*, bool);
extern bool _cpp_stack_include (cpp_reader *, const char *, int,
enum include_type);
extern int _cpp_compare_file_date (cpp_reader *, const char *, int);
extern void _cpp_report_missing_guards (cpp_reader *);
extern void _cpp_init_files (cpp_reader *);
extern void _cpp_cleanup_files (cpp_reader *);
extern void _cpp_pop_file_buffer (cpp_reader *, struct _cpp_file *);
extern bool _cpp_save_file_entries (cpp_reader *pfile, FILE *f);
extern bool _cpp_read_file_entries (cpp_reader *, FILE *);
extern struct stat *_cpp_get_file_stat (_cpp_file *);
/* In expr.c */
extern bool _cpp_parse_expr (cpp_reader *);
extern struct op *_cpp_expand_op_stack (cpp_reader *);
/* In lex.c */
extern void _cpp_process_line_notes (cpp_reader *, int);
extern void _cpp_clean_line (cpp_reader *);
extern bool _cpp_get_fresh_line (cpp_reader *);
extern bool _cpp_skip_block_comment (cpp_reader *);
extern cpp_token *_cpp_temp_token (cpp_reader *);
extern const cpp_token *_cpp_lex_token (cpp_reader *);
extern cpp_token *_cpp_lex_direct (cpp_reader *);
extern int _cpp_equiv_tokens (const cpp_token *, const cpp_token *);
extern void _cpp_init_tokenrun (tokenrun *, unsigned int);
/* In init.c. */
extern void _cpp_maybe_push_include_file (cpp_reader *);
/* In directives.c */
extern int _cpp_test_assertion (cpp_reader *, unsigned int *);
extern int _cpp_handle_directive (cpp_reader *, int);
extern void _cpp_define_builtin (cpp_reader *, const char *);
extern char ** _cpp_save_pragma_names (cpp_reader *);
extern void _cpp_restore_pragma_names (cpp_reader *, char **);
extern void _cpp_do__Pragma (cpp_reader *);
extern void _cpp_init_directives (cpp_reader *);
extern void _cpp_init_internal_pragmas (cpp_reader *);
extern void _cpp_do_file_change (cpp_reader *, enum lc_reason, const char *,
unsigned int, unsigned int);
extern void _cpp_pop_buffer (cpp_reader *);
/* In traditional.c. */
extern bool _cpp_scan_out_logical_line (cpp_reader *, cpp_macro *);
extern bool _cpp_read_logical_line_trad (cpp_reader *);
extern void _cpp_overlay_buffer (cpp_reader *pfile, const unsigned char *,
size_t);
extern void _cpp_remove_overlay (cpp_reader *);
extern bool _cpp_create_trad_definition (cpp_reader *, cpp_macro *);
extern bool _cpp_expansions_different_trad (const cpp_macro *,
const cpp_macro *);
extern unsigned char *_cpp_copy_replacement_text (const cpp_macro *,
unsigned char *);
extern size_t _cpp_replacement_text_len (const cpp_macro *);
/* In charset.c. */
/* The normalization state at this point in the sequence.
It starts initialized to all zeros, and at the end
'level' is the normalization level of the sequence. */
struct normalize_state
{
/* The previous character. */
cppchar_t previous;
/* The combining class of the previous character. */
unsigned char prev_class;
/* The lowest normalization level so far. */
enum cpp_normalize_level level;
};
#define INITIAL_NORMALIZE_STATE { 0, 0, normalized_KC }
#define NORMALIZE_STATE_RESULT(st) ((st)->level)
/* We saw a character that matches ISIDNUM(), update a
normalize_state appropriately. */
#define NORMALIZE_STATE_UPDATE_IDNUM(st) \
((st)->previous = 0, (st)->prev_class = 0)
extern cppchar_t _cpp_valid_ucn (cpp_reader *, const unsigned char **,
const unsigned char *, int,
struct normalize_state *state);
extern void _cpp_destroy_iconv (cpp_reader *);
extern unsigned char *_cpp_convert_input (cpp_reader *, const char *,
unsigned char *, size_t, size_t,
off_t *);
extern const char *_cpp_default_encoding (void);
extern cpp_hashnode * _cpp_interpret_identifier (cpp_reader *pfile,
const unsigned char *id,
size_t len);
/* Utility routines and macros. */
#define DSC(str) (const unsigned char *)str, sizeof str - 1
/* These are inline functions instead of macros so we can get type
checking. */
static inline int ustrcmp (const unsigned char *, const unsigned char *);
static inline int ustrncmp (const unsigned char *, const unsigned char *,
size_t);
static inline size_t ustrlen (const unsigned char *);
static inline unsigned char *uxstrdup (const unsigned char *);
static inline unsigned char *ustrchr (const unsigned char *, int);
static inline int ufputs (const unsigned char *, FILE *);
/* Use a const char for the second parameter since it is usually a literal. */
static inline int ustrcspn (const unsigned char *, const char *);
static inline int
ustrcmp (const unsigned char *s1, const unsigned char *s2)
{
return strcmp ((const char *)s1, (const char *)s2);
}
static inline int
ustrncmp (const unsigned char *s1, const unsigned char *s2, size_t n)
{
return strncmp ((const char *)s1, (const char *)s2, n);
}
static inline int
ustrcspn (const unsigned char *s1, const char *s2)
{
return strcspn ((const char *)s1, s2);
}
static inline size_t
ustrlen (const unsigned char *s1)
{
return strlen ((const char *)s1);
}
static inline unsigned char *
uxstrdup (const unsigned char *s1)
{
return (unsigned char *) xstrdup ((const char *)s1);
}
static inline unsigned char *
ustrchr (const unsigned char *s1, int c)
{
return (unsigned char *) strchr ((const char *)s1, c);
}
static inline int
ufputs (const unsigned char *s, FILE *f)
{
return fputs ((const char *)s, f);
}
#endif /* ! LIBCPP_INTERNAL_H */

1707
contrib/gcclibs/libcpp/lex.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,348 @@
/* Map logical line numbers to (source file, line number) pairs.
Copyright (C) 2001, 2003, 2004
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, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
#include "config.h"
#include "system.h"
#include "line-map.h"
static void trace_include (const struct line_maps *, const struct line_map *);
/* Initialize a line map set. */
void
linemap_init (struct line_maps *set)
{
set->maps = NULL;
set->allocated = 0;
set->used = 0;
set->last_listed = -1;
set->trace_includes = false;
set->depth = 0;
set->cache = 0;
set->highest_location = 0;
set->highest_line = 0;
set->max_column_hint = 0;
}
/* Check for and warn about line_maps entered but not exited. */
void
linemap_check_files_exited (struct line_maps *set)
{
struct line_map *map;
/* Depending upon whether we are handling preprocessed input or
not, this can be a user error or an ICE. */
for (map = &set->maps[set->used - 1]; ! MAIN_FILE_P (map);
map = INCLUDED_FROM (set, map))
fprintf (stderr, "line-map.c: file \"%s\" entered but not left\n",
map->to_file);
}
/* Free a line map set. */
void
linemap_free (struct line_maps *set)
{
if (set->maps)
{
linemap_check_files_exited (set);
free (set->maps);
}
}
/* Add a mapping of logical source line to physical source file and
line number.
The text pointed to by TO_FILE must have a lifetime
at least as long as the final call to lookup_line (). An empty
TO_FILE means standard input. If reason is LC_LEAVE, and
TO_FILE is NULL, then TO_FILE, TO_LINE and SYSP are given their
natural values considering the file we are returning to.
FROM_LINE should be monotonic increasing across calls to this
function. A call to this function can relocate the previous set of
A call to this function can relocate the previous set of
maps, so any stored line_map pointers should not be used. */
const struct line_map *
linemap_add (struct line_maps *set, enum lc_reason reason,
unsigned int sysp, const char *to_file, unsigned int to_line)
{
struct line_map *map;
source_location start_location = set->highest_location + 1;
if (set->used && start_location < set->maps[set->used - 1].start_location)
abort ();
if (set->used == set->allocated)
{
set->allocated = 2 * set->allocated + 256;
set->maps = XRESIZEVEC (struct line_map, set->maps, set->allocated);
}
map = &set->maps[set->used];
if (to_file && *to_file == '\0')
to_file = "<stdin>";
/* If we don't keep our line maps consistent, we can easily
segfault. Don't rely on the client to do it for us. */
if (set->depth == 0)
reason = LC_ENTER;
else if (reason == LC_LEAVE)
{
struct line_map *from;
bool error;
if (MAIN_FILE_P (map - 1))
{
if (to_file == NULL)
{
set->depth--;
return NULL;
}
error = true;
reason = LC_RENAME;
from = map - 1;
}
else
{
from = INCLUDED_FROM (set, map - 1);
error = to_file && strcmp (from->to_file, to_file);
}
/* Depending upon whether we are handling preprocessed input or
not, this can be a user error or an ICE. */
if (error)
fprintf (stderr, "line-map.c: file \"%s\" left but not entered\n",
to_file);
/* A TO_FILE of NULL is special - we use the natural values. */
if (error || to_file == NULL)
{
to_file = from->to_file;
to_line = SOURCE_LINE (from, from[1].start_location);
sysp = from->sysp;
}
}
map->reason = reason;
map->sysp = sysp;
map->start_location = start_location;
map->to_file = to_file;
map->to_line = to_line;
set->cache = set->used++;
map->column_bits = 0;
set->highest_location = start_location;
set->highest_line = start_location;
set->max_column_hint = 0;
if (reason == LC_ENTER)
{
map->included_from = set->depth == 0 ? -1 : (int) (set->used - 2);
set->depth++;
if (set->trace_includes)
trace_include (set, map);
}
else if (reason == LC_RENAME)
map->included_from = map[-1].included_from;
else if (reason == LC_LEAVE)
{
set->depth--;
map->included_from = INCLUDED_FROM (set, map - 1)->included_from;
}
return map;
}
source_location
linemap_line_start (struct line_maps *set, unsigned int to_line,
unsigned int max_column_hint)
{
struct line_map *map = &set->maps[set->used - 1];
source_location highest = set->highest_location;
source_location r;
unsigned int last_line = SOURCE_LINE (map, set->highest_line);
int line_delta = to_line - last_line;
bool add_map = false;
if (line_delta < 0
|| (line_delta > 10 && line_delta * map->column_bits > 1000)
|| (max_column_hint >= (1U << map->column_bits))
|| (max_column_hint <= 80 && map->column_bits >= 10))
{
add_map = true;
}
else
max_column_hint = set->max_column_hint;
if (add_map)
{
int column_bits;
if (max_column_hint > 100000 || highest > 0xC0000000)
{
/* If the column number is ridiculous or we've allocated a huge
number of source_locations, give up on column numbers. */
max_column_hint = 0;
if (highest >0xF0000000)
return 0;
column_bits = 0;
}
else
{
column_bits = 7;
while (max_column_hint >= (1U << column_bits))
column_bits++;
max_column_hint = 1U << column_bits;
}
/* Allocate the new line_map. However, if the current map only has a
single line we can sometimes just increase its column_bits instead. */
if (line_delta < 0
|| last_line != map->to_line
|| SOURCE_COLUMN (map, highest) >= (1U << column_bits))
map = (struct line_map*) linemap_add (set, LC_RENAME, map->sysp,
map->to_file, to_line);
map->column_bits = column_bits;
r = map->start_location + ((to_line - map->to_line) << column_bits);
}
else
r = highest - SOURCE_COLUMN (map, highest)
+ (line_delta << map->column_bits);
set->highest_line = r;
if (r > set->highest_location)
set->highest_location = r;
set->max_column_hint = max_column_hint;
return r;
}
source_location
linemap_position_for_column (struct line_maps *set, unsigned int to_column)
{
source_location r = set->highest_line;
if (to_column >= set->max_column_hint)
{
if (r >= 0xC000000 || to_column > 100000)
{
/* Running low on source_locations - disable column numbers. */
return r;
}
else
{
struct line_map *map = &set->maps[set->used - 1];
r = linemap_line_start (set, SOURCE_LINE (map, r), to_column + 50);
}
}
r = r + to_column;
if (r >= set->highest_location)
set->highest_location = r;
return r;
}
/* Given a logical line, returns the map from which the corresponding
(source file, line) pair can be deduced. Since the set is built
chronologically, the logical lines are monotonic increasing, and so
the list is sorted and we can use a binary search. */
const struct line_map *
linemap_lookup (struct line_maps *set, source_location line)
{
unsigned int md, mn, mx;
const struct line_map *cached;
mn = set->cache;
mx = set->used;
cached = &set->maps[mn];
/* We should get a segfault if no line_maps have been added yet. */
if (line >= cached->start_location)
{
if (mn + 1 == mx || line < cached[1].start_location)
return cached;
}
else
{
mx = mn;
mn = 0;
}
while (mx - mn > 1)
{
md = (mn + mx) / 2;
if (set->maps[md].start_location > line)
mx = md;
else
mn = md;
}
set->cache = mn;
return &set->maps[mn];
}
/* Print the file names and line numbers of the #include commands
which led to the map MAP, if any, to stderr. Nothing is output if
the most recently listed stack is the same as the current one. */
void
linemap_print_containing_files (struct line_maps *set,
const struct line_map *map)
{
if (MAIN_FILE_P (map) || set->last_listed == map->included_from)
return;
set->last_listed = map->included_from;
map = INCLUDED_FROM (set, map);
fprintf (stderr, _("In file included from %s:%u"),
map->to_file, LAST_SOURCE_LINE (map));
while (! MAIN_FILE_P (map))
{
map = INCLUDED_FROM (set, map);
/* Translators note: this message is used in conjunction
with "In file included from %s:%ld" and some other
tricks. We want something like this:
| In file included from sys/select.h:123,
| from sys/types.h:234,
| from userfile.c:31:
| bits/select.h:45: <error message here>
with all the "from"s lined up.
The trailing comma is at the beginning of this message,
and the trailing colon is not translated. */
fprintf (stderr, _(",\n from %s:%u"),
map->to_file, LAST_SOURCE_LINE (map));
}
fputs (":\n", stderr);
}
/* Print an include trace, for e.g. the -H option of the preprocessor. */
static void
trace_include (const struct line_maps *set, const struct line_map *map)
{
unsigned int i = set->depth;
while (--i)
putc ('.', stderr);
fprintf (stderr, " %s\n", map->to_file);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,206 @@
/* Dependency generator utility.
Copyright (C) 2004 Free Software Foundation, Inc.
Contributed by Zack Weinberg, May 2004
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, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
#include "config.h"
#include "system.h"
#include "line-map.h"
#include "cpplib.h"
#include "getopt.h"
#include "mkdeps.h"
const char *progname;
const char *vpath;
static const char *output_file;
static bool had_errors;
/* Option lists, to give to cpplib before each input file. */
struct cmd_line_macro
{
struct cmd_line_macro *next;
bool is_undef;
const char *macro;
};
static struct cmd_line_macro *cmd_line_macros;
static cpp_dir *cmd_line_searchpath;
static void
add_clm (const char *macro, bool is_undef)
{
struct cmd_line_macro *clm = XNEW (struct cmd_line_macro);
clm->next = cmd_line_macros;
clm->is_undef = is_undef;
clm->macro = macro;
cmd_line_macros = clm;
}
static void
add_dir (char *name, bool sysp)
{
cpp_dir *dir = XNEW (cpp_dir);
dir->next = cmd_line_searchpath;
dir->name = name;
dir->sysp = sysp;
dir->construct = 0;
dir->user_supplied_p = 1;
cmd_line_searchpath = dir;
}
/* Command line processing. */
static void ATTRIBUTE_NORETURN
usage (int errcode)
{
fprintf (stderr,
"usage: %s [-vh] [-V vpath] [-Dname[=def]...] [-Uname] [-Idir...] [-o file] sources...\n",
progname);
exit (errcode);
}
static int
parse_options (int argc, char **argv)
{
static const struct option longopts[] = {
{ "--help", no_argument, 0, 'h' },
{ 0, 0, 0, 0 }
};
for (;;)
switch (getopt_long (argc, argv, "hD:U:I:J:o:V:", longopts, 0))
{
case 'h': usage (0);
case 'D': add_clm (optarg, false); break;
case 'U': add_clm (optarg, true); break;
case 'I': add_dir (optarg, false); break;
case 'J': add_dir (optarg, true); break;
case 'o':
if (output_file)
{
fprintf (stderr, "%s: too many output files\n", progname);
usage (2);
}
output_file = optarg;
break;
case 'V':
if (vpath)
{
fprintf (stderr, "%s: too many vpaths\n", progname);
usage (2);
}
vpath = optarg;
break;
case '?':
usage (2); /* getopt has issued the error message. */
case -1: /* end of options */
if (optind == argc)
{
fprintf (stderr, "%s: no input files\n", progname);
usage (2);
}
return optind;
default:
abort ();
}
}
/* Set up cpplib from command line options. */
static cpp_reader *
reader_init (struct line_maps *line_table)
{
cpp_reader *reader;
cpp_options *options;
linemap_init (line_table);
reader = cpp_create_reader (CLK_GNUC89, 0, line_table);
/* Ignore warnings and errors (we don't have access to system
headers). Request dependency output. */
options = cpp_get_options (reader);
options->inhibit_warnings = 1;
options->inhibit_errors = 1;
options->deps.style = DEPS_USER;
/* Further initialization. */
cpp_post_options (reader);
cpp_init_iconv (reader);
cpp_set_include_chains (reader, cmd_line_searchpath, cmd_line_searchpath,
false);
if (vpath)
{
struct deps *deps = cpp_get_deps (reader);
deps_add_vpath (deps, vpath);
}
return reader;
}
/* Process one input source file. */
static void
process_file (const char *file)
{
struct line_maps line_table;
cpp_reader *reader = reader_init (&line_table);
if (!cpp_read_main_file (reader, file))
had_errors = true;
else
{
struct cmd_line_macro *clm;
cpp_init_builtins (reader, true);
for (clm = cmd_line_macros; clm; clm = clm->next)
(clm->is_undef ? cpp_undef : cpp_define) (reader, clm->macro);
cpp_scan_nooutput (reader);
if (cpp_finish (reader, stdout))
had_errors = true;
}
cpp_destroy (reader);
linemap_free (&line_table);
}
/* Master control. */
int
main(int argc, char **argv)
{
int first_input, i;
progname = argv[0];
xmalloc_set_program_name (progname);
first_input = parse_options (argc, argv);
if (output_file)
if (!freopen (output_file, "w", stdout))
{
perror (output_file);
return 1;
}
for (i = first_input; i < argc; i++)
process_file (argv[i]);
return had_errors;
}

View File

@ -0,0 +1,342 @@
/* Make ucnid.h from various sources.
Copyright (C) 2005 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, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Run this program as
./makeucnid ucnid.tab UnicodeData.txt DerivedNormalizationProps.txt \
> ucnid.h
*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdbool.h>
#include <stdlib.h>
enum {
C99 = 1,
CXX = 2,
digit = 4,
not_NFC = 8,
not_NFKC = 16,
maybe_not_NFC = 32
};
static unsigned flags[65536];
static unsigned short decomp[65536][2];
static unsigned char combining_value[65536];
/* Die! */
static void
fail (const char *s)
{
fprintf (stderr, "%s\n", s);
exit (1);
}
/* Read ucnid.tab and set the C99 and CXX flags in header[]. */
static void
read_ucnid (const char *fname)
{
FILE *f = fopen (fname, "r");
unsigned fl = 0;
if (!f)
fail ("opening ucnid.tab");
for (;;)
{
char line[256];
if (!fgets (line, sizeof (line), f))
break;
if (strcmp (line, "[C99]\n") == 0)
fl = C99;
else if (strcmp (line, "[CXX]\n") == 0)
fl = CXX;
else if (isxdigit (line[0]))
{
char *l = line;
while (*l)
{
unsigned long start, end;
char *endptr;
start = strtoul (l, &endptr, 16);
if (endptr == l || (*endptr != '-' && ! isspace (*endptr)))
fail ("parsing ucnid.tab [1]");
l = endptr;
if (*l != '-')
end = start;
else
{
end = strtoul (l + 1, &endptr, 16);
if (end < start)
fail ("parsing ucnid.tab, end before start");
l = endptr;
if (! isspace (*l))
fail ("parsing ucnid.tab, junk after range");
}
while (isspace (*l))
l++;
if (end > 0xFFFF)
fail ("parsing ucnid.tab, end too large");
while (start <= end)
flags[start++] |= fl;
}
}
}
if (ferror (f))
fail ("reading ucnid.tab");
fclose (f);
}
/* Read UnicodeData.txt and set the 'digit' flag, and
also fill in the 'decomp' table to be the decompositions of
characters for which both the character decomposed and all the code
points in the decomposition are either C99 or CXX. */
static void
read_table (char *fname)
{
FILE * f = fopen (fname, "r");
if (!f)
fail ("opening UnicodeData.txt");
for (;;)
{
char line[256];
unsigned long codepoint, this_decomp[4];
char *l;
int i;
int decomp_useful;
if (!fgets (line, sizeof (line), f))
break;
codepoint = strtoul (line, &l, 16);
if (l == line || *l != ';')
fail ("parsing UnicodeData.txt, reading code point");
if (codepoint > 0xffff || ! (flags[codepoint] & (C99 | CXX)))
continue;
do {
l++;
} while (*l != ';');
/* Category value; things starting with 'N' are numbers of some
kind. */
if (*++l == 'N')
flags[codepoint] |= digit;
do {
l++;
} while (*l != ';');
/* Canonical combining class; in NFC/NFKC, they must be increasing
(or zero). */
if (! isdigit (*++l))
fail ("parsing UnicodeData.txt, combining class not number");
combining_value[codepoint] = strtoul (l, &l, 10);
if (*l++ != ';')
fail ("parsing UnicodeData.txt, junk after combining class");
/* Skip over bidi value. */
do {
l++;
} while (*l != ';');
/* Decomposition mapping. */
decomp_useful = flags[codepoint];
if (*++l == '<') /* Compatibility mapping. */
continue;
for (i = 0; i < 4; i++)
{
if (*l == ';')
break;
if (!isxdigit (*l))
fail ("parsing UnicodeData.txt, decomposition format");
this_decomp[i] = strtoul (l, &l, 16);
decomp_useful &= flags[this_decomp[i]];
while (isspace (*l))
l++;
}
if (i > 2) /* Decomposition too long. */
fail ("parsing UnicodeData.txt, decomposition too long");
if (decomp_useful)
while (--i >= 0)
decomp[codepoint][i] = this_decomp[i];
}
if (ferror (f))
fail ("reading UnicodeData.txt");
fclose (f);
}
/* Read DerivedNormalizationProps.txt and set the flags that say whether
a character is in NFC, NFKC, or is context-dependent. */
static void
read_derived (const char *fname)
{
FILE * f = fopen (fname, "r");
if (!f)
fail ("opening DerivedNormalizationProps.txt");
for (;;)
{
char line[256];
unsigned long start, end;
char *l;
bool not_NFC_p, not_NFKC_p, maybe_not_NFC_p;
if (!fgets (line, sizeof (line), f))
break;
not_NFC_p = (strstr (line, "; NFC_QC; N") != NULL);
not_NFKC_p = (strstr (line, "; NFKC_QC; N") != NULL);
maybe_not_NFC_p = (strstr (line, "; NFC_QC; M") != NULL);
if (! not_NFC_p && ! not_NFKC_p && ! maybe_not_NFC_p)
continue;
start = strtoul (line, &l, 16);
if (l == line)
fail ("parsing DerivedNormalizationProps.txt, reading start");
if (start > 0xffff)
continue;
if (*l == '.' && l[1] == '.')
end = strtoul (l + 2, &l, 16);
else
end = start;
while (start <= end)
flags[start++] |= ((not_NFC_p ? not_NFC : 0)
| (not_NFKC_p ? not_NFKC : 0)
| (maybe_not_NFC_p ? maybe_not_NFC : 0)
);
}
if (ferror (f))
fail ("reading DerivedNormalizationProps.txt");
fclose (f);
}
/* Write out the table.
The table consists of two words per entry. The first word is the flags
for the unicode code points up to and including the second word. */
static void
write_table (void)
{
unsigned i;
unsigned last_flag = flags[0];
bool really_safe = decomp[0][0] == 0;
unsigned char last_combine = combining_value[0];
for (i = 1; i <= 65536; i++)
if (i == 65536
|| (flags[i] != last_flag && ((flags[i] | last_flag) & (C99 | CXX)))
|| really_safe != (decomp[i][0] == 0)
|| combining_value[i] != last_combine)
{
printf ("{ %s|%s|%s|%s|%s|%s|%s, %3d, %#06x },\n",
last_flag & C99 ? "C99" : " 0",
last_flag & digit ? "DIG" : " 0",
last_flag & CXX ? "CXX" : " 0",
really_safe ? "CID" : " 0",
last_flag & not_NFC ? " 0" : "NFC",
last_flag & not_NFKC ? " 0" : "NKC",
last_flag & maybe_not_NFC ? "CTX" : " 0",
combining_value[i - 1],
i - 1);
last_flag = flags[i];
last_combine = combining_value[0];
really_safe = decomp[i][0] == 0;
}
}
/* Print out the huge copyright notice. */
static void
write_copyright (void)
{
static const char copyright[] = "\
/* Unicode characters and various properties.\n\
Copyright (C) 2003, 2005 Free Software Foundation, Inc.\n\
\n\
This program is free software; you can redistribute it and/or modify it\n\
under the terms of the GNU General Public License as published by the\n\
Free Software Foundation; either version 2, or (at your option) any\n\
later version.\n\
\n\
This program is distributed in the hope that it will be useful,\n\
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\
\n\
You should have received a copy of the GNU General Public License\n\
along with this program; if not, write to the Free Software\n\
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\
\n\
\n\
Copyright (C) 1991-2005 Unicode, Inc. All rights reserved.\n\
Distributed under the Terms of Use in\n\
http://www.unicode.org/copyright.html.\n\
\n\
Permission is hereby granted, free of charge, to any person\n\
obtaining a copy of the Unicode data files and any associated\n\
documentation (the \"Data Files\") or Unicode software and any\n\
associated documentation (the \"Software\") to deal in the Data Files\n\
or Software without restriction, including without limitation the\n\
rights to use, copy, modify, merge, publish, distribute, and/or\n\
sell copies of the Data Files or Software, and to permit persons to\n\
whom the Data Files or Software are furnished to do so, provided\n\
that (a) the above copyright notice(s) and this permission notice\n\
appear with all copies of the Data Files or Software, (b) both the\n\
above copyright notice(s) and this permission notice appear in\n\
associated documentation, and (c) there is clear notice in each\n\
modified Data File or in the Software as well as in the\n\
documentation associated with the Data File(s) or Software that the\n\
data or software has been modified.\n\
\n\
THE DATA FILES AND SOFTWARE ARE PROVIDED \"AS IS\", WITHOUT WARRANTY\n\
OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n\
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n\
NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE\n\
COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR\n\
ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY\n\
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n\
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\n\
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\n\
OF THE DATA FILES OR SOFTWARE.\n\
\n\
Except as contained in this notice, the name of a copyright holder\n\
shall not be used in advertising or otherwise to promote the sale,\n\
use or other dealings in these Data Files or Software without prior\n\
written authorization of the copyright holder. */\n";
puts (copyright);
}
/* Main program. */
int
main(int argc, char ** argv)
{
if (argc != 4)
fail ("too few arguments to makeucn");
read_ucnid (argv[1]);
read_table (argv[2]);
read_derived (argv[3]);
write_copyright ();
write_table ();
return 0;
}

View File

@ -0,0 +1,418 @@
/* Dependency generator for Makefile fragments.
Copyright (C) 2000, 2001, 2003, 2007 Free Software Foundation, Inc.
Contributed by Zack Weinberg, Mar 2000
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, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
#include "config.h"
#include "system.h"
#include "mkdeps.h"
/* Keep this structure local to this file, so clients don't find it
easy to start making assumptions. */
struct deps
{
const char **targetv;
unsigned int ntargets; /* number of slots actually occupied */
unsigned int targets_size; /* amt of allocated space - in words */
const char **depv;
unsigned int ndeps;
unsigned int deps_size;
const char **vpathv;
size_t *vpathlv;
unsigned int nvpaths;
unsigned int vpaths_size;
};
static const char *munge (const char *);
/* Given a filename, quote characters in that filename which are
significant to Make. Note that it's not possible to quote all such
characters - e.g. \n, %, *, ?, [, \ (in some contexts), and ~ are
not properly handled. It isn't possible to get this right in any
current version of Make. (??? Still true? Old comment referred to
3.76.1.) */
static const char *
munge (const char *filename)
{
int len;
const char *p, *q;
char *dst, *buffer;
for (p = filename, len = 0; *p; p++, len++)
{
switch (*p)
{
case ' ':
case '\t':
/* GNU make uses a weird quoting scheme for white space.
A space or tab preceded by 2N+1 backslashes represents
N backslashes followed by space; a space or tab
preceded by 2N backslashes represents N backslashes at
the end of a file name; and backslashes in other
contexts should not be doubled. */
for (q = p - 1; filename <= q && *q == '\\'; q--)
len++;
len++;
break;
case '$':
/* '$' is quoted by doubling it. */
len++;
break;
}
}
/* Now we know how big to make the buffer. */
buffer = XNEWVEC (char, len + 1);
for (p = filename, dst = buffer; *p; p++, dst++)
{
switch (*p)
{
case ' ':
case '\t':
for (q = p - 1; filename <= q && *q == '\\'; q--)
*dst++ = '\\';
*dst++ = '\\';
break;
case '$':
*dst++ = '$';
break;
default:
/* nothing */;
}
*dst = *p;
}
*dst = '\0';
return buffer;
}
/* If T begins with any of the partial pathnames listed in d->vpathv,
then advance T to point beyond that pathname. */
static const char *
apply_vpath (struct deps *d, const char *t)
{
if (d->vpathv)
{
unsigned int i;
for (i = 0; i < d->nvpaths; i++)
{
if (!strncmp (d->vpathv[i], t, d->vpathlv[i]))
{
const char *p = t + d->vpathlv[i];
if (!IS_DIR_SEPARATOR (*p))
goto not_this_one;
/* Do not simplify $(vpath)/../whatever. ??? Might not
be necessary. */
if (p[1] == '.' && p[2] == '.' && IS_DIR_SEPARATOR (p[3]))
goto not_this_one;
/* found a match */
t = t + d->vpathlv[i] + 1;
break;
}
not_this_one:;
}
}
/* Remove leading ./ in any case. */
while (t[0] == '.' && IS_DIR_SEPARATOR (t[1]))
{
t += 2;
/* If we removed a leading ./, then also remove any /s after the
first. */
while (IS_DIR_SEPARATOR (t[0]))
++t;
}
return t;
}
/* Public routines. */
struct deps *
deps_init (void)
{
return XCNEW (struct deps);
}
void
deps_free (struct deps *d)
{
unsigned int i;
if (d->targetv)
{
for (i = 0; i < d->ntargets; i++)
free ((void *) d->targetv[i]);
free (d->targetv);
}
if (d->depv)
{
for (i = 0; i < d->ndeps; i++)
free ((void *) d->depv[i]);
free (d->depv);
}
if (d->vpathv)
{
for (i = 0; i < d->nvpaths; i++)
free ((void *) d->vpathv[i]);
free (d->vpathv);
free (d->vpathlv);
}
free (d);
}
/* Adds a target T. We make a copy, so it need not be a permanent
string. QUOTE is true if the string should be quoted. */
void
deps_add_target (struct deps *d, const char *t, int quote)
{
if (d->ntargets == d->targets_size)
{
d->targets_size = d->targets_size * 2 + 4;
d->targetv = XRESIZEVEC (const char *, d->targetv, d->targets_size);
}
t = apply_vpath (d, t);
if (quote)
t = munge (t); /* Also makes permanent copy. */
else
t = xstrdup (t);
d->targetv[d->ntargets++] = t;
}
/* Sets the default target if none has been given already. An empty
string as the default target in interpreted as stdin. The string
is quoted for MAKE. */
void
deps_add_default_target (struct deps *d, const char *tgt)
{
/* Only if we have no targets. */
if (d->ntargets)
return;
if (tgt[0] == '\0')
deps_add_target (d, "-", 1);
else
{
#ifndef TARGET_OBJECT_SUFFIX
# define TARGET_OBJECT_SUFFIX ".o"
#endif
const char *start = lbasename (tgt);
char *o = (char *) alloca (strlen (start)
+ strlen (TARGET_OBJECT_SUFFIX) + 1);
char *suffix;
strcpy (o, start);
suffix = strrchr (o, '.');
if (!suffix)
suffix = o + strlen (o);
strcpy (suffix, TARGET_OBJECT_SUFFIX);
deps_add_target (d, o, 1);
}
}
void
deps_add_dep (struct deps *d, const char *t)
{
t = munge (apply_vpath (d, t)); /* Also makes permanent copy. */
if (d->ndeps == d->deps_size)
{
d->deps_size = d->deps_size * 2 + 8;
d->depv = XRESIZEVEC (const char *, d->depv, d->deps_size);
}
d->depv[d->ndeps++] = t;
}
void
deps_add_vpath (struct deps *d, const char *vpath)
{
const char *elem, *p;
char *copy;
size_t len;
for (elem = vpath; *elem; elem = p)
{
for (p = elem; *p && *p != ':'; p++);
len = p - elem;
copy = XNEWVEC (char, len + 1);
memcpy (copy, elem, len);
copy[len] = '\0';
if (*p == ':')
p++;
if (d->nvpaths == d->vpaths_size)
{
d->vpaths_size = d->vpaths_size * 2 + 8;
d->vpathv = XRESIZEVEC (const char *, d->vpathv, d->vpaths_size);
d->vpathlv = XRESIZEVEC (size_t, d->vpathlv, d->vpaths_size);
}
d->vpathv[d->nvpaths] = copy;
d->vpathlv[d->nvpaths] = len;
d->nvpaths++;
}
}
void
deps_write (const struct deps *d, FILE *fp, unsigned int colmax)
{
unsigned int size, i, column;
column = 0;
if (colmax && colmax < 34)
colmax = 34;
for (i = 0; i < d->ntargets; i++)
{
size = strlen (d->targetv[i]);
column += size;
if (colmax && column > colmax)
{
fputs (" \\\n ", fp);
column = 1 + size;
}
if (i)
{
putc (' ', fp);
column++;
}
fputs (d->targetv[i], fp);
}
putc (':', fp);
putc (' ', fp);
column += 2;
for (i = 0; i < d->ndeps; i++)
{
size = strlen (d->depv[i]);
column += size;
if (colmax && column > colmax)
{
fputs (" \\\n ", fp);
column = 1 + size;
}
if (i)
{
putc (' ', fp);
column++;
}
fputs (d->depv[i], fp);
}
putc ('\n', fp);
}
void
deps_phony_targets (const struct deps *d, FILE *fp)
{
unsigned int i;
for (i = 1; i < d->ndeps; i++)
{
putc ('\n', fp);
fputs (d->depv[i], fp);
putc (':', fp);
putc ('\n', fp);
}
}
/* Write out a deps buffer to a file, in a form that can be read back
with deps_restore. Returns nonzero on error, in which case the
error number will be in errno. */
int
deps_save (struct deps *deps, FILE *f)
{
unsigned int i;
/* The cppreader structure contains makefile dependences. Write out this
structure. */
/* The number of dependences. */
if (fwrite (&deps->ndeps, sizeof (deps->ndeps), 1, f) != 1)
return -1;
/* The length of each dependence followed by the string. */
for (i = 0; i < deps->ndeps; i++)
{
size_t num_to_write = strlen (deps->depv[i]);
if (fwrite (&num_to_write, sizeof (size_t), 1, f) != 1)
return -1;
if (fwrite (deps->depv[i], num_to_write, 1, f) != 1)
return -1;
}
return 0;
}
/* Read back dependency information written with deps_save into
the deps buffer. The third argument may be NULL, in which case
the dependency information is just skipped, or it may be a filename,
in which case that filename is skipped. */
int
deps_restore (struct deps *deps, FILE *fd, const char *self)
{
unsigned int i, count;
size_t num_to_read;
size_t buf_size = 512;
char *buf = XNEWVEC (char, buf_size);
/* Number of dependences. */
if (fread (&count, 1, sizeof (count), fd) != sizeof (count))
return -1;
/* The length of each dependence string, followed by the string. */
for (i = 0; i < count; i++)
{
/* Read in # bytes in string. */
if (fread (&num_to_read, 1, sizeof (size_t), fd) != sizeof (size_t))
return -1;
if (buf_size < num_to_read + 1)
{
buf_size = num_to_read + 1 + 127;
buf = XRESIZEVEC (char, buf, buf_size);
}
if (fread (buf, 1, num_to_read, fd) != num_to_read)
return -1;
buf[num_to_read] = '\0';
/* Generate makefile dependencies from .pch if -nopch-deps. */
if (self != NULL && strcmp (buf, self) != 0)
deps_add_dep (deps, buf);
}
free (buf);
return 0;
}

View File

@ -0,0 +1,698 @@
/* Part of CPP library. (Precompiled header reading/writing.)
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
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, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#include "config.h"
#include "system.h"
#include "cpplib.h"
#include "internal.h"
#include "hashtab.h"
#include "mkdeps.h"
static int write_macdef (cpp_reader *, cpp_hashnode *, void *);
static int save_idents (cpp_reader *, cpp_hashnode *, void *);
static hashval_t hashmem (const void *, size_t);
static hashval_t cpp_string_hash (const void *);
static int cpp_string_eq (const void *, const void *);
static int count_defs (cpp_reader *, cpp_hashnode *, void *);
static int comp_hashnodes (const void *, const void *);
static int collect_ht_nodes (cpp_reader *, cpp_hashnode *, void *);
static int write_defs (cpp_reader *, cpp_hashnode *, void *);
static int save_macros (cpp_reader *, cpp_hashnode *, void *);
/* This structure represents a macro definition on disk. */
struct macrodef_struct
{
unsigned int definition_length;
unsigned short name_length;
unsigned short flags;
};
/* This is how we write out a macro definition.
Suitable for being called by cpp_forall_identifiers. */
static int
write_macdef (cpp_reader *pfile, cpp_hashnode *hn, void *file_p)
{
FILE *f = (FILE *) file_p;
switch (hn->type)
{
case NT_VOID:
if (! (hn->flags & NODE_POISONED))
return 1;
case NT_MACRO:
if ((hn->flags & NODE_BUILTIN))
return 1;
{
struct macrodef_struct s;
const unsigned char *defn;
s.name_length = NODE_LEN (hn);
s.flags = hn->flags & NODE_POISONED;
if (hn->type == NT_MACRO)
{
defn = cpp_macro_definition (pfile, hn);
s.definition_length = ustrlen (defn);
}
else
{
defn = NODE_NAME (hn);
s.definition_length = s.name_length;
}
if (fwrite (&s, sizeof (s), 1, f) != 1
|| fwrite (defn, 1, s.definition_length, f) != s.definition_length)
{
cpp_errno (pfile, CPP_DL_ERROR,
"while writing precompiled header");
return 0;
}
}
return 1;
case NT_ASSERTION:
/* Not currently implemented. */
return 1;
default:
abort ();
}
}
/* This structure records the names of the defined macros.
It's also used as a callback structure for size_initial_idents
and save_idents. */
struct cpp_savedstate
{
/* A hash table of the defined identifiers. */
htab_t definedhash;
/* The size of the definitions of those identifiers (the size of
'definedstrs'). */
size_t hashsize;
/* Number of definitions */
size_t n_defs;
/* Array of definitions. In cpp_write_pch_deps it is used for sorting. */
cpp_hashnode **defs;
/* Space for the next definition. Definitions are null-terminated
strings. */
unsigned char *definedstrs;
};
/* Save this identifier into the state: put it in the hash table,
put the definition in 'definedstrs'. */
static int
save_idents (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn, void *ss_p)
{
struct cpp_savedstate *const ss = (struct cpp_savedstate *)ss_p;
if (hn->type != NT_VOID)
{
struct cpp_string news;
void **slot;
news.len = NODE_LEN (hn);
news.text= NODE_NAME (hn);
slot = htab_find_slot (ss->definedhash, &news, INSERT);
if (*slot == NULL)
{
struct cpp_string *sp;
unsigned char *text;
sp = XNEW (struct cpp_string);
*slot = sp;
sp->len = NODE_LEN (hn);
sp->text = text = XNEWVEC (unsigned char, NODE_LEN (hn));
memcpy (text, NODE_NAME (hn), NODE_LEN (hn));
}
}
return 1;
}
/* Hash some memory in a generic way. */
static hashval_t
hashmem (const void *p_p, size_t sz)
{
const unsigned char *p = (const unsigned char *)p_p;
size_t i;
hashval_t h;
h = 0;
for (i = 0; i < sz; i++)
h = h * 67 - (*p++ - 113);
return h;
}
/* Hash a cpp string for the hashtable machinery. */
static hashval_t
cpp_string_hash (const void *a_p)
{
const struct cpp_string *a = (const struct cpp_string *) a_p;
return hashmem (a->text, a->len);
}
/* Compare two cpp strings for the hashtable machinery. */
static int
cpp_string_eq (const void *a_p, const void *b_p)
{
const struct cpp_string *a = (const struct cpp_string *) a_p;
const struct cpp_string *b = (const struct cpp_string *) b_p;
return (a->len == b->len
&& memcmp (a->text, b->text, a->len) == 0);
}
/* Save the current definitions of the cpp_reader for dependency
checking purposes. When writing a precompiled header, this should
be called at the same point in the compilation as cpp_valid_state
would be called when reading the precompiled header back in. */
int
cpp_save_state (cpp_reader *r, FILE *f)
{
/* Save the list of non-void identifiers for the dependency checking. */
r->savedstate = XNEW (struct cpp_savedstate);
r->savedstate->definedhash = htab_create (100, cpp_string_hash,
cpp_string_eq, NULL);
cpp_forall_identifiers (r, save_idents, r->savedstate);
/* Write out the list of defined identifiers. */
cpp_forall_identifiers (r, write_macdef, f);
return 0;
}
/* Calculate the 'hashsize' field of the saved state. */
static int
count_defs (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn, void *ss_p)
{
struct cpp_savedstate *const ss = (struct cpp_savedstate *)ss_p;
switch (hn->type)
{
case NT_MACRO:
if (hn->flags & NODE_BUILTIN)
return 1;
/* else fall through. */
case NT_VOID:
{
struct cpp_string news;
void **slot;
news.len = NODE_LEN (hn);
news.text = NODE_NAME (hn);
slot = (void **) htab_find (ss->definedhash, &news);
if (slot == NULL)
{
ss->hashsize += NODE_LEN (hn) + 1;
ss->n_defs += 1;
}
}
return 1;
case NT_ASSERTION:
/* Not currently implemented. */
return 1;
default:
abort ();
}
}
/* Collect the identifiers into the state's string table. */
static int
write_defs (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn, void *ss_p)
{
struct cpp_savedstate *const ss = (struct cpp_savedstate *)ss_p;
switch (hn->type)
{
case NT_MACRO:
if (hn->flags & NODE_BUILTIN)
return 1;
/* else fall through. */
case NT_VOID:
{
struct cpp_string news;
void **slot;
news.len = NODE_LEN (hn);
news.text = NODE_NAME (hn);
slot = (void **) htab_find (ss->definedhash, &news);
if (slot == NULL)
{
ss->defs[ss->n_defs] = hn;
ss->n_defs += 1;
}
}
return 1;
case NT_ASSERTION:
/* Not currently implemented. */
return 1;
default:
abort ();
}
}
/* Comparison function for qsort. The arguments point to pointers of
type ht_hashnode *. */
static int
comp_hashnodes (const void *px, const void *py)
{
cpp_hashnode *x = *(cpp_hashnode **) px;
cpp_hashnode *y = *(cpp_hashnode **) py;
return ustrcmp (NODE_NAME (x), NODE_NAME (y));
}
/* Write out the remainder of the dependency information. This should be
called after the PCH is ready to be saved. */
int
cpp_write_pch_deps (cpp_reader *r, FILE *f)
{
struct macrodef_struct z;
struct cpp_savedstate *const ss = r->savedstate;
unsigned char *definedstrs;
size_t i;
/* Collect the list of identifiers which have been seen and
weren't defined to anything previously. */
ss->hashsize = 0;
ss->n_defs = 0;
cpp_forall_identifiers (r, count_defs, ss);
ss->defs = XNEWVEC (cpp_hashnode *, ss->n_defs);
ss->n_defs = 0;
cpp_forall_identifiers (r, write_defs, ss);
/* Sort the list, copy it into a buffer, and write it out. */
qsort (ss->defs, ss->n_defs, sizeof (cpp_hashnode *), &comp_hashnodes);
definedstrs = ss->definedstrs = XNEWVEC (unsigned char, ss->hashsize);
for (i = 0; i < ss->n_defs; ++i)
{
size_t len = NODE_LEN (ss->defs[i]);
memcpy (definedstrs, NODE_NAME (ss->defs[i]), len + 1);
definedstrs += len + 1;
}
memset (&z, 0, sizeof (z));
z.definition_length = ss->hashsize;
if (fwrite (&z, sizeof (z), 1, f) != 1
|| fwrite (ss->definedstrs, ss->hashsize, 1, f) != 1)
{
cpp_errno (r, CPP_DL_ERROR, "while writing precompiled header");
return -1;
}
free (ss->definedstrs);
/* Free the saved state. */
free (ss);
r->savedstate = NULL;
return 0;
}
/* Write out the definitions of the preprocessor, in a form suitable for
cpp_read_state. */
int
cpp_write_pch_state (cpp_reader *r, FILE *f)
{
if (!r->deps)
r->deps = deps_init ();
if (deps_save (r->deps, f) != 0)
{
cpp_errno (r, CPP_DL_ERROR, "while writing precompiled header");
return -1;
}
if (! _cpp_save_file_entries (r, f))
{
cpp_errno (r, CPP_DL_ERROR, "while writing precompiled header");
return -1;
}
return 0;
}
/* Data structure to transform hash table nodes into a sorted list */
struct ht_node_list
{
/* Array of nodes */
cpp_hashnode **defs;
/* Number of nodes in the array */
size_t n_defs;
/* Size of the allocated array */
size_t asize;
};
/* Callback for collecting identifiers from hash table */
static int
collect_ht_nodes (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn,
void *nl_p)
{
struct ht_node_list *const nl = (struct ht_node_list *)nl_p;
if (hn->type != NT_VOID || hn->flags & NODE_POISONED)
{
if (nl->n_defs == nl->asize)
{
nl->asize *= 2;
nl->defs = XRESIZEVEC (cpp_hashnode *, nl->defs, nl->asize);
}
nl->defs[nl->n_defs] = hn;
++nl->n_defs;
}
return 1;
}
/* Return nonzero if FD is a precompiled header which is consistent
with the preprocessor's current definitions. It will be consistent
when:
- anything that was defined just before the PCH was generated
is defined the same way now; and
- anything that was not defined then, but is defined now, was not
used by the PCH.
NAME is used to print warnings if `warn_invalid_pch' is set in the
reader's flags.
*/
int
cpp_valid_state (cpp_reader *r, const char *name, int fd)
{
struct macrodef_struct m;
size_t namebufsz = 256;
unsigned char *namebuf = XNEWVEC (unsigned char, namebufsz);
unsigned char *undeftab = NULL;
struct ht_node_list nl = { 0, 0, 0 };
unsigned char *first, *last;
unsigned int i;
/* Read in the list of identifiers that must be defined
Check that they are defined in the same way. */
for (;;)
{
cpp_hashnode *h;
const unsigned char *newdefn;
if (read (fd, &m, sizeof (m)) != sizeof (m))
goto error;
if (m.name_length == 0)
break;
/* If this file is already preprocessed, there won't be any
macros defined, and that's OK. */
if (CPP_OPTION (r, preprocessed))
{
if (lseek (fd, m.definition_length, SEEK_CUR) == -1)
goto error;
continue;
}
if (m.definition_length > namebufsz)
{
free (namebuf);
namebufsz = m.definition_length + 256;
namebuf = XNEWVEC (unsigned char, namebufsz);
}
if ((size_t)read (fd, namebuf, m.definition_length)
!= m.definition_length)
goto error;
h = cpp_lookup (r, namebuf, m.name_length);
if (m.flags & NODE_POISONED
|| h->type != NT_MACRO
|| h->flags & NODE_POISONED)
{
if (CPP_OPTION (r, warn_invalid_pch))
cpp_error (r, CPP_DL_WARNING_SYSHDR,
"%s: not used because `%.*s' not defined",
name, m.name_length, namebuf);
goto fail;
}
newdefn = cpp_macro_definition (r, h);
if (m.definition_length != ustrlen (newdefn)
|| memcmp (namebuf, newdefn, m.definition_length) != 0)
{
if (CPP_OPTION (r, warn_invalid_pch))
cpp_error (r, CPP_DL_WARNING_SYSHDR,
"%s: not used because `%.*s' defined as `%s' not `%.*s'",
name, m.name_length, namebuf, newdefn + m.name_length,
m.definition_length - m.name_length,
namebuf + m.name_length);
goto fail;
}
}
free (namebuf);
namebuf = NULL;
/* Read in the list of identifiers that must not be defined.
Check that they really aren't. */
undeftab = XNEWVEC (unsigned char, m.definition_length);
if ((size_t) read (fd, undeftab, m.definition_length) != m.definition_length)
goto error;
/* Collect identifiers from the current hash table. */
nl.n_defs = 0;
nl.asize = 10;
nl.defs = XNEWVEC (cpp_hashnode *, nl.asize);
cpp_forall_identifiers (r, &collect_ht_nodes, &nl);
qsort (nl.defs, nl.n_defs, sizeof (cpp_hashnode *), &comp_hashnodes);
/* Loop through nl.defs and undeftab, both of which are sorted lists.
There should be no matches. */
first = undeftab;
last = undeftab + m.definition_length;
i = 0;
while (first < last && i < nl.n_defs)
{
int cmp = ustrcmp (first, NODE_NAME (nl.defs[i]));
if (cmp < 0)
first += ustrlen (first) + 1;
else if (cmp > 0)
++i;
else
{
if (CPP_OPTION (r, warn_invalid_pch))
cpp_error (r, CPP_DL_WARNING_SYSHDR,
"%s: not used because `%s' is defined",
name, first);
goto fail;
}
}
free(nl.defs);
free (undeftab);
/* We win! */
return 0;
error:
cpp_errno (r, CPP_DL_ERROR, "while reading precompiled header");
return -1;
fail:
if (namebuf != NULL)
free (namebuf);
if (undeftab != NULL)
free (undeftab);
if (nl.defs != NULL)
free (nl.defs);
return 1;
}
/* Save all the existing macros. */
struct save_macro_data
{
uchar **defns;
size_t count;
size_t array_size;
char **saved_pragmas;
};
/* Save the definition of a single macro, so that it will persist
across a PCH restore. Because macro data is in GCed memory, which
will be blown away by PCH, it must be temporarily copied to
malloced memory. (The macros will refer to identifier nodes which
are also GCed and so on, so the copying is done by turning them
into self-contained strings.) The assumption is that most macro
definitions will come from the PCH file, not from the compilation
before the PCH file is loaded, so it doesn't matter that this is
a little expensive.
It would reduce the cost even further if macros defined in the PCH
file were not saved in this way, but this is not done (yet), except
for builtins, and for #assert by default. */
static int
save_macros (cpp_reader *r, cpp_hashnode *h, void *data_p)
{
struct save_macro_data *data = (struct save_macro_data *)data_p;
if (h->type != NT_VOID
&& (h->flags & NODE_BUILTIN) == 0)
{
if (data->count == data->array_size)
{
data->array_size *= 2;
data->defns = XRESIZEVEC (uchar *, data->defns, (data->array_size));
}
switch (h->type)
{
case NT_ASSERTION:
/* Not currently implemented. */
return 1;
case NT_MACRO:
{
const uchar * defn = cpp_macro_definition (r, h);
size_t defnlen = ustrlen (defn);
data->defns[data->count] = (uchar *) xmemdup (defn, defnlen,
defnlen + 2);
data->defns[data->count][defnlen] = '\n';
}
break;
default:
abort ();
}
data->count++;
}
return 1;
}
/* Prepare to restore the state, by saving the currently-defined
macros in 'data'. */
void
cpp_prepare_state (cpp_reader *r, struct save_macro_data **data)
{
struct save_macro_data *d = XNEW (struct save_macro_data);
d->array_size = 512;
d->defns = XNEWVEC (uchar *, d->array_size);
d->count = 0;
cpp_forall_identifiers (r, save_macros, d);
d->saved_pragmas = _cpp_save_pragma_names (r);
*data = d;
}
/* Given a precompiled header that was previously determined to be valid,
apply all its definitions (and undefinitions) to the current state.
DEPNAME is passed to deps_restore. */
int
cpp_read_state (cpp_reader *r, const char *name, FILE *f,
struct save_macro_data *data)
{
size_t i;
struct lexer_state old_state;
/* Restore spec_nodes, which will be full of references to the old
hashtable entries and so will now be invalid. */
{
struct spec_nodes *s = &r->spec_nodes;
s->n_defined = cpp_lookup (r, DSC("defined"));
s->n_true = cpp_lookup (r, DSC("true"));
s->n_false = cpp_lookup (r, DSC("false"));
s->n__VA_ARGS__ = cpp_lookup (r, DSC("__VA_ARGS__"));
}
old_state = r->state;
r->state.in_directive = 1;
r->state.prevent_expansion = 1;
r->state.angled_headers = 0;
/* Run through the carefully-saved macros, insert them. */
for (i = 0; i < data->count; i++)
{
cpp_hashnode *h;
size_t namelen;
uchar *defn;
namelen = ustrcspn (data->defns[i], "( \n");
h = cpp_lookup (r, data->defns[i], namelen);
defn = data->defns[i] + namelen;
/* The PCH file is valid, so we know that if there is a definition
from the PCH file it must be the same as the one we had
originally, and so do not need to restore it. */
if (h->type == NT_VOID)
{
if (cpp_push_buffer (r, defn, ustrchr (defn, '\n') - defn, true)
!= NULL)
{
_cpp_clean_line (r);
if (!_cpp_create_definition (r, h))
abort ();
_cpp_pop_buffer (r);
}
else
abort ();
}
free (data->defns[i]);
}
r->state = old_state;
_cpp_restore_pragma_names (r, data->saved_pragmas);
free (data);
if (deps_restore (r->deps, f, CPP_OPTION (r, restore_pch_deps) ? name : NULL)
!= 0)
goto error;
if (! _cpp_read_file_entries (r, f))
goto error;
return 0;
error:
cpp_errno (r, CPP_DL_ERROR, "while reading precompiled header");
return -1;
}

View File

@ -0,0 +1,335 @@
/* Hash tables.
Copyright (C) 2000, 2001, 2003, 2004 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, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
#include "config.h"
#include "system.h"
#include "symtab.h"
/* The code below is a specialization of Vladimir Makarov's expandable
hash tables (see libiberty/hashtab.c). The abstraction penalty was
too high to continue using the generic form. This code knows
intrinsically how to calculate a hash value, and how to compare an
existing entry with a potential new one. Also, the ability to
delete members from the table has been removed. */
static unsigned int calc_hash (const unsigned char *, size_t);
static void ht_expand (hash_table *);
static double approx_sqrt (double);
/* Calculate the hash of the string STR of length LEN. */
static unsigned int
calc_hash (const unsigned char *str, size_t len)
{
size_t n = len;
unsigned int r = 0;
while (n--)
r = HT_HASHSTEP (r, *str++);
return HT_HASHFINISH (r, len);
}
/* Initialize an identifier hashtable. */
hash_table *
ht_create (unsigned int order)
{
unsigned int nslots = 1 << order;
hash_table *table;
table = XCNEW (hash_table);
/* Strings need no alignment. */
_obstack_begin (&table->stack, 0, 0,
(void *(*) (long)) xmalloc,
(void (*) (void *)) free);
obstack_alignment_mask (&table->stack) = 0;
table->entries = XCNEWVEC (hashnode, nslots);
table->entries_owned = true;
table->nslots = nslots;
return table;
}
/* Frees all memory associated with a hash table. */
void
ht_destroy (hash_table *table)
{
obstack_free (&table->stack, NULL);
if (table->entries_owned)
free (table->entries);
free (table);
}
/* Returns the hash entry for the a STR of length LEN. If that string
already exists in the table, returns the existing entry, and, if
INSERT is CPP_ALLOCED, frees the last obstack object. If the
identifier hasn't been seen before, and INSERT is CPP_NO_INSERT,
returns NULL. Otherwise insert and returns a new entry. A new
string is alloced if INSERT is CPP_ALLOC, otherwise INSERT is
CPP_ALLOCED and the item is assumed to be at the top of the
obstack. */
hashnode
ht_lookup (hash_table *table, const unsigned char *str, size_t len,
enum ht_lookup_option insert)
{
return ht_lookup_with_hash (table, str, len, calc_hash (str, len),
insert);
}
hashnode
ht_lookup_with_hash (hash_table *table, const unsigned char *str,
size_t len, unsigned int hash,
enum ht_lookup_option insert)
{
unsigned int hash2;
unsigned int index;
size_t sizemask;
hashnode node;
sizemask = table->nslots - 1;
index = hash & sizemask;
table->searches++;
node = table->entries[index];
if (node != NULL)
{
if (node->hash_value == hash
&& HT_LEN (node) == (unsigned int) len
&& !memcmp (HT_STR (node), str, len))
{
if (insert == HT_ALLOCED)
/* The string we search for was placed at the end of the
obstack. Release it. */
obstack_free (&table->stack, (void *) str);
return node;
}
/* hash2 must be odd, so we're guaranteed to visit every possible
location in the table during rehashing. */
hash2 = ((hash * 17) & sizemask) | 1;
for (;;)
{
table->collisions++;
index = (index + hash2) & sizemask;
node = table->entries[index];
if (node == NULL)
break;
if (node->hash_value == hash
&& HT_LEN (node) == (unsigned int) len
&& !memcmp (HT_STR (node), str, len))
{
if (insert == HT_ALLOCED)
/* The string we search for was placed at the end of the
obstack. Release it. */
obstack_free (&table->stack, (void *) str);
return node;
}
}
}
if (insert == HT_NO_INSERT)
return NULL;
node = (*table->alloc_node) (table);
table->entries[index] = node;
HT_LEN (node) = (unsigned int) len;
node->hash_value = hash;
if (insert == HT_ALLOC)
HT_STR (node) = (const unsigned char *) obstack_copy0 (&table->stack,
str, len);
else
HT_STR (node) = str;
if (++table->nelements * 4 >= table->nslots * 3)
/* Must expand the string table. */
ht_expand (table);
return node;
}
/* Double the size of a hash table, re-hashing existing entries. */
static void
ht_expand (hash_table *table)
{
hashnode *nentries, *p, *limit;
unsigned int size, sizemask;
size = table->nslots * 2;
nentries = XCNEWVEC (hashnode, size);
sizemask = size - 1;
p = table->entries;
limit = p + table->nslots;
do
if (*p)
{
unsigned int index, hash, hash2;
hash = (*p)->hash_value;
index = hash & sizemask;
if (nentries[index])
{
hash2 = ((hash * 17) & sizemask) | 1;
do
{
index = (index + hash2) & sizemask;
}
while (nentries[index]);
}
nentries[index] = *p;
}
while (++p < limit);
if (table->entries_owned)
free (table->entries);
table->entries_owned = true;
table->entries = nentries;
table->nslots = size;
}
/* For all nodes in TABLE, callback CB with parameters TABLE->PFILE,
the node, and V. */
void
ht_forall (hash_table *table, ht_cb cb, const void *v)
{
hashnode *p, *limit;
p = table->entries;
limit = p + table->nslots;
do
if (*p)
{
if ((*cb) (table->pfile, *p, v) == 0)
break;
}
while (++p < limit);
}
/* Restore the hash table. */
void
ht_load (hash_table *ht, hashnode *entries,
unsigned int nslots, unsigned int nelements,
bool own)
{
if (ht->entries_owned)
free (ht->entries);
ht->entries = entries;
ht->nslots = nslots;
ht->nelements = nelements;
ht->entries_owned = own;
}
/* Dump allocation statistics to stderr. */
void
ht_dump_statistics (hash_table *table)
{
size_t nelts, nids, overhead, headers;
size_t total_bytes, longest;
double sum_of_squares, exp_len, exp_len2, exp2_len;
hashnode *p, *limit;
#define SCALE(x) ((unsigned long) ((x) < 1024*10 \
? (x) \
: ((x) < 1024*1024*10 \
? (x) / 1024 \
: (x) / (1024*1024))))
#define LABEL(x) ((x) < 1024*10 ? ' ' : ((x) < 1024*1024*10 ? 'k' : 'M'))
total_bytes = longest = sum_of_squares = nids = 0;
p = table->entries;
limit = p + table->nslots;
do
if (*p)
{
size_t n = HT_LEN (*p);
total_bytes += n;
sum_of_squares += (double) n * n;
if (n > longest)
longest = n;
nids++;
}
while (++p < limit);
nelts = table->nelements;
overhead = obstack_memory_used (&table->stack) - total_bytes;
headers = table->nslots * sizeof (hashnode);
fprintf (stderr, "\nString pool\nentries\t\t%lu\n",
(unsigned long) nelts);
fprintf (stderr, "identifiers\t%lu (%.2f%%)\n",
(unsigned long) nids, nids * 100.0 / nelts);
fprintf (stderr, "slots\t\t%lu\n",
(unsigned long) table->nslots);
fprintf (stderr, "bytes\t\t%lu%c (%lu%c overhead)\n",
SCALE (total_bytes), LABEL (total_bytes),
SCALE (overhead), LABEL (overhead));
fprintf (stderr, "table size\t%lu%c\n",
SCALE (headers), LABEL (headers));
exp_len = (double)total_bytes / (double)nelts;
exp2_len = exp_len * exp_len;
exp_len2 = (double) sum_of_squares / (double) nelts;
fprintf (stderr, "coll/search\t%.4f\n",
(double) table->collisions / (double) table->searches);
fprintf (stderr, "ins/search\t%.4f\n",
(double) nelts / (double) table->searches);
fprintf (stderr, "avg. entry\t%.2f bytes (+/- %.2f)\n",
exp_len, approx_sqrt (exp_len2 - exp2_len));
fprintf (stderr, "longest entry\t%lu\n",
(unsigned long) longest);
#undef SCALE
#undef LABEL
}
/* Return the approximate positive square root of a number N. This is for
statistical reports, not code generation. */
static double
approx_sqrt (double x)
{
double s, d;
if (x < 0)
abort ();
if (x == 0)
return 0;
s = x;
do
{
d = (s * s - x) / (2 * s);
s -= d;
}
while (d > .0001);
return s;
}

View File

@ -0,0 +1,425 @@
/* Get common system includes and various definitions and declarations based
on autoconf macros.
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of libcpp (aka cpplib).
GCC 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.
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#ifndef LIBCPP_SYSTEM_H
#define LIBCPP_SYSTEM_H
/* We must include stdarg.h before stdio.h. */
#include <stdarg.h>
#ifdef HAVE_STDDEF_H
# include <stddef.h>
#endif
#include <stdio.h>
/* Define a generic NULL if one hasn't already been defined. */
#ifndef NULL
#define NULL 0
#endif
/* Use the unlocked open routines from libiberty. */
#define fopen(PATH,MODE) fopen_unlocked(PATH,MODE)
#define fdopen(FILDES,MODE) fdopen_unlocked(FILDES,MODE)
#define freopen(PATH,MODE,STREAM) freopen_unlocked(PATH,MODE,STREAM)
/* The compiler is not a multi-threaded application and therefore we
do not have to use the locking functions. In fact, using the locking
functions can cause the compiler to be significantly slower under
I/O bound conditions (such as -g -O0 on very large source files).
HAVE_DECL_PUTC_UNLOCKED actually indicates whether or not the stdio
code is multi-thread safe by default. If it is set to 0, then do
not worry about using the _unlocked functions.
fputs_unlocked, fwrite_unlocked, and fprintf_unlocked are
extensions and need to be prototyped by hand (since we do not
define _GNU_SOURCE). */
#if defined HAVE_DECL_PUTC_UNLOCKED && HAVE_DECL_PUTC_UNLOCKED
# ifdef HAVE_PUTC_UNLOCKED
# undef putc
# define putc(C, Stream) putc_unlocked (C, Stream)
# endif
# ifdef HAVE_PUTCHAR_UNLOCKED
# undef putchar
# define putchar(C) putchar_unlocked (C)
# endif
# ifdef HAVE_GETC_UNLOCKED
# undef getc
# define getc(Stream) getc_unlocked (Stream)
# endif
# ifdef HAVE_GETCHAR_UNLOCKED
# undef getchar
# define getchar() getchar_unlocked ()
# endif
# ifdef HAVE_FPUTC_UNLOCKED
# undef fputc
# define fputc(C, Stream) fputc_unlocked (C, Stream)
# endif
# ifdef HAVE_CLEARERR_UNLOCKED
# undef clearerr
# define clearerr(Stream) clearerr_unlocked (Stream)
# if defined (HAVE_DECL_CLEARERR_UNLOCKED) && !HAVE_DECL_CLEARERR_UNLOCKED
extern void clearerr_unlocked (FILE *);
# endif
# endif
# ifdef HAVE_FEOF_UNLOCKED
# undef feof
# define feof(Stream) feof_unlocked (Stream)
# if defined (HAVE_DECL_FEOF_UNLOCKED) && !HAVE_DECL_FEOF_UNLOCKED
extern int feof_unlocked (FILE *);
# endif
# endif
# ifdef HAVE_FILENO_UNLOCKED
# undef fileno
# define fileno(Stream) fileno_unlocked (Stream)
# if defined (HAVE_DECL_FILENO_UNLOCKED) && !HAVE_DECL_FILENO_UNLOCKED
extern int fileno_unlocked (FILE *);
# endif
# endif
# ifdef HAVE_FFLUSH_UNLOCKED
# undef fflush
# define fflush(Stream) fflush_unlocked (Stream)
# if defined (HAVE_DECL_FFLUSH_UNLOCKED) && !HAVE_DECL_FFLUSH_UNLOCKED
extern int fflush_unlocked (FILE *);
# endif
# endif
# ifdef HAVE_FGETC_UNLOCKED
# undef fgetc
# define fgetc(Stream) fgetc_unlocked (Stream)
# if defined (HAVE_DECL_FGETC_UNLOCKED) && !HAVE_DECL_FGETC_UNLOCKED
extern int fgetc_unlocked (FILE *);
# endif
# endif
# ifdef HAVE_FGETS_UNLOCKED
# undef fgets
# define fgets(S, n, Stream) fgets_unlocked (S, n, Stream)
# if defined (HAVE_DECL_FGETS_UNLOCKED) && !HAVE_DECL_FGETS_UNLOCKED
extern char *fgets_unlocked (char *, int, FILE *);
# endif
# endif
# ifdef HAVE_FPUTS_UNLOCKED
# undef fputs
# define fputs(String, Stream) fputs_unlocked (String, Stream)
# if defined (HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED
extern int fputs_unlocked (const char *, FILE *);
# endif
# endif
# ifdef HAVE_FERROR_UNLOCKED
# undef ferror
# define ferror(Stream) ferror_unlocked (Stream)
# if defined (HAVE_DECL_FERROR_UNLOCKED) && !HAVE_DECL_FERROR_UNLOCKED
extern int ferror_unlocked (FILE *);
# endif
# endif
# ifdef HAVE_FREAD_UNLOCKED
# undef fread
# define fread(Ptr, Size, N, Stream) fread_unlocked (Ptr, Size, N, Stream)
# if defined (HAVE_DECL_FREAD_UNLOCKED) && !HAVE_DECL_FREAD_UNLOCKED
extern size_t fread_unlocked (void *, size_t, size_t, FILE *);
# endif
# endif
# ifdef HAVE_FWRITE_UNLOCKED
# undef fwrite
# define fwrite(Ptr, Size, N, Stream) fwrite_unlocked (Ptr, Size, N, Stream)
# if defined (HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED
extern size_t fwrite_unlocked (const void *, size_t, size_t, FILE *);
# endif
# endif
# ifdef HAVE_FPRINTF_UNLOCKED
# undef fprintf
/* We can't use a function-like macro here because we don't know if
we have varargs macros. */
# define fprintf fprintf_unlocked
# if defined (HAVE_DECL_FPRINTF_UNLOCKED) && !HAVE_DECL_FPRINTF_UNLOCKED
extern int fprintf_unlocked (FILE *, const char *, ...);
# endif
# endif
#endif
/* ??? Glibc's fwrite/fread_unlocked macros cause
"warning: signed and unsigned type in conditional expression". */
#undef fread_unlocked
#undef fwrite_unlocked
#include <sys/types.h>
#include <errno.h>
#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
extern int errno;
#endif
/* Some of glibc's string inlines cause warnings. Plus we'd rather
rely on (and therefore test) GCC's string builtins. */
#define __NO_STRING_INLINES
#ifdef STRING_WITH_STRINGS
# include <string.h>
# include <strings.h>
#else
# ifdef HAVE_STRING_H
# include <string.h>
# else
# ifdef HAVE_STRINGS_H
# include <strings.h>
# endif
# endif
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#if HAVE_LIMITS_H
# include <limits.h>
#endif
/* Infrastructure for defining missing _MAX and _MIN macros. Note that
macros defined with these cannot be used in #if. */
/* The extra casts work around common compiler bugs. */
#define INTTYPE_SIGNED(t) (! ((t) 0 < (t) -1))
/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
It is necessary at least when t == time_t. */
#define INTTYPE_MINIMUM(t) ((t) (INTTYPE_SIGNED (t) \
? ~ (t) 0 << (sizeof(t) * CHAR_BIT - 1) : (t) 0))
#define INTTYPE_MAXIMUM(t) ((t) (~ (t) 0 - INTTYPE_MINIMUM (t)))
/* Use that infrastructure to provide a few constants. */
#ifndef UCHAR_MAX
# define UCHAR_MAX INTTYPE_MAXIMUM (unsigned char)
#endif
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# ifdef HAVE_TIME_H
# include <time.h>
# endif
# endif
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#else
# ifdef HAVE_SYS_FILE_H
# include <sys/file.h>
# endif
#endif
#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif
#ifdef HAVE_LANGINFO_CODESET
# include <langinfo.h>
#endif
#ifndef HAVE_SETLOCALE
# define setlocale(category, locale) (locale)
#endif
#ifdef ENABLE_NLS
#include <libintl.h>
#else
/* Stubs. */
# undef dgettext
# define dgettext(package, msgid) (msgid)
#endif
#ifndef _
# define _(msgid) dgettext (PACKAGE, msgid)
#endif
#ifndef N_
# define N_(msgid) msgid
#endif
/* Some systems define these in, e.g., param.h. We undefine these names
here to avoid the warnings. We prefer to use our definitions since we
know they are correct. */
#undef MIN
#undef MAX
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
/* The HAVE_DECL_* macros are three-state, undefined, 0 or 1. If they
are defined to 0 then we must provide the relevant declaration
here. These checks will be in the undefined state while configure
is running so be careful to test "defined (HAVE_DECL_*)". */
#if defined (HAVE_DECL_ABORT) && !HAVE_DECL_ABORT
extern void abort (void);
#endif
#if HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
/* Test if something is a normal file. */
#ifndef S_ISREG
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
/* Test if something is a directory. */
#ifndef S_ISDIR
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
/* Test if something is a character special file. */
#ifndef S_ISCHR
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#endif
/* Test if something is a block special file. */
#ifndef S_ISBLK
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#endif
/* Test if something is a socket. */
#ifndef S_ISSOCK
# ifdef S_IFSOCK
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
# else
# define S_ISSOCK(m) 0
# endif
#endif
/* Test if something is a FIFO. */
#ifndef S_ISFIFO
# ifdef S_IFIFO
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
# else
# define S_ISFIFO(m) 0
# endif
#endif
/* Approximate O_NOCTTY and O_BINARY. */
#ifndef O_NOCTTY
#define O_NOCTTY 0
#endif
#ifndef O_BINARY
# define O_BINARY 0
#endif
/* Filename handling macros. */
#include "filenames.h"
/* Get libiberty declarations. */
#include "libiberty.h"
#include "safe-ctype.h"
/* 1 if we have C99 designated initializers.
??? C99 designated initializers are not supported by most C++
compilers, including G++. -- gdr, 2005-05-18 */
#if !defined(HAVE_DESIGNATED_INITIALIZERS)
#define HAVE_DESIGNATED_INITIALIZERS \
((!defined(__cplusplus) && (GCC_VERSION >= 2007)) \
|| (__STDC_VERSION__ >= 199901L))
#endif
/* Be conservative and only use enum bitfields with GCC.
FIXME: provide a complete autoconf test for buggy enum bitfields. */
#if (GCC_VERSION > 2000)
#define ENUM_BITFIELD(TYPE) __extension__ enum TYPE
#else
#define ENUM_BITFIELD(TYPE) unsigned int
#endif
#ifndef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
#endif
/* __builtin_expect(A, B) evaluates to A, but notifies the compiler that
the most likely value of A is B. This feature was added at some point
between 2.95 and 3.0. Let's use 3.0 as the lower bound for now. */
#if (GCC_VERSION < 3000)
#define __builtin_expect(a, b) (a)
#endif
/* Provide a fake boolean type. We make no attempt to use the
C99 _Bool, as it may not be available in the bootstrap compiler,
and even if it is, it is liable to be buggy.
This must be after all inclusion of system headers, as some of
them will mess us up. */
#undef bool
#undef true
#undef false
#undef TRUE
#undef FALSE
#ifndef __cplusplus
#define bool unsigned char
#endif
#define true 1
#define false 0
/* Some compilers do not allow the use of unsigned char in bitfields. */
#define BOOL_BITFIELD unsigned int
/* Poison identifiers we do not want to use. */
#if (GCC_VERSION >= 3000)
#undef calloc
#undef strdup
#undef malloc
#undef realloc
#pragma GCC poison calloc strdup
#pragma GCC poison malloc realloc
/* Libiberty macros that are no longer used in GCC. */
#undef ANSI_PROTOTYPES
#undef PTR_CONST
#undef LONG_DOUBLE
#undef VPARAMS
#undef VA_OPEN
#undef VA_FIXEDARG
#undef VA_CLOSE
#undef VA_START
#pragma GCC poison ANSI_PROTOTYPES PTR_CONST LONG_DOUBLE VPARAMS VA_OPEN \
VA_FIXEDARG VA_CLOSE VA_START
/* Note: not all uses of the `index' token (e.g. variable names and
structure members) have been eliminated. */
#undef bcopy
#undef bzero
#undef bcmp
#undef rindex
#pragma GCC poison bcopy bzero bcmp rindex
#endif /* GCC >= 3.0 */
#endif /* ! LIBCPP_SYSTEM_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,801 @@
/* Unicode characters and various properties.
Copyright (C) 2003, 2005 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, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Copyright (C) 1991-2005 Unicode, Inc. All rights reserved.
Distributed under the Terms of Use in
http://www.unicode.org/copyright.html.
Permission is hereby granted, free of charge, to any person
obtaining a copy of the Unicode data files and any associated
documentation (the "Data Files") or Unicode software and any
associated documentation (the "Software") to deal in the Data Files
or Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, and/or
sell copies of the Data Files or Software, and to permit persons to
whom the Data Files or Software are furnished to do so, provided
that (a) the above copyright notice(s) and this permission notice
appear with all copies of the Data Files or Software, (b) both the
above copyright notice(s) and this permission notice appear in
associated documentation, and (c) there is clear notice in each
modified Data File or in the Software as well as in the
documentation associated with the Data File(s) or Software that the
data or software has been modified.
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY
OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR
ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
OF THE DATA FILES OR SOFTWARE.
Except as contained in this notice, the name of a copyright holder
shall not be used in advertising or otherwise to promote the sale,
use or other dealings in these Data Files or Software without prior
written authorization of the copyright holder. */
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x00a9 },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x00aa },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x00b4 },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x00b5 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x00b6 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x00b7 },
{ 0| 0| 0|CID|NFC| 0| 0, 0, 0x00b9 },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x00ba },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x00bf },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x00d6 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x00d7 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x00f6 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x00f7 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0131 },
{ C99| 0|CXX|CID|NFC| 0| 0, 0, 0x0133 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x013e },
{ C99| 0|CXX|CID|NFC| 0| 0, 0, 0x0140 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0148 },
{ C99| 0|CXX|CID|NFC| 0| 0, 0, 0x0149 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x017e },
{ C99| 0|CXX|CID|NFC| 0| 0, 0, 0x017f },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x01c3 },
{ C99| 0|CXX|CID|NFC| 0| 0, 0, 0x01cc },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x01f0 },
{ C99| 0|CXX|CID|NFC| 0| 0, 0, 0x01f3 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x01f5 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x01f9 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0217 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x024f },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x02a8 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x02af },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x02b8 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x02ba },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x02bb },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x02bc },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x02c1 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x02cf },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x02d1 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x02df },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x02e4 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0379 },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x037a },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0383 },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0x0384 },
{ 0| 0| 0|CID|NFC| 0| 0, 0, 0x0385 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0386 },
{ 0| 0| 0|CID| 0| 0| 0, 0, 0x0387 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x038a },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x038b },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x038c },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x038d },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x03a1 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x03a2 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x03ce },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x03cf },
{ C99| 0|CXX|CID|NFC| 0| 0, 0, 0x03d6 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x03d9 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x03da },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x03db },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x03dc },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x03dd },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x03de },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x03df },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x03e0 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x03e1 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x03ef },
{ C99| 0|CXX|CID|NFC| 0| 0, 0, 0x03f2 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x03f3 },
{ 0| 0| 0|CID|NFC| 0| 0, 0, 0x0400 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x040c },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0x040d },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x040e },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x044f },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0450 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x045c },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x045d },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0481 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x048f },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x04c4 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x04c6 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x04c8 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x04ca },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x04cc },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x04cf },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x04eb },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x04ed },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x04f5 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x04f7 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x04f9 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0530 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0556 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0558 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0559 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0560 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0586 },
{ C99| 0|CXX|CID|NFC| 0| 0, 0, 0x0587 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x05af },
{ C99| 0| 0|CID|NFC|NKC| 0, 10, 0x05b0 },
{ C99| 0| 0|CID|NFC|NKC| 0, 11, 0x05b1 },
{ C99| 0| 0|CID|NFC|NKC| 0, 12, 0x05b2 },
{ C99| 0| 0|CID|NFC|NKC| 0, 13, 0x05b3 },
{ C99| 0| 0|CID|NFC|NKC| 0, 14, 0x05b4 },
{ C99| 0| 0|CID|NFC|NKC| 0, 15, 0x05b5 },
{ C99| 0| 0|CID|NFC|NKC| 0, 16, 0x05b6 },
{ C99| 0| 0|CID|NFC|NKC| 0, 17, 0x05b7 },
{ C99| 0| 0|CID|NFC|NKC| 0, 18, 0x05b8 },
{ C99| 0| 0|CID|NFC|NKC| 0, 19, 0x05b9 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x05ba },
{ C99| 0| 0|CID|NFC|NKC| 0, 20, 0x05bb },
{ C99| 0| 0|CID|NFC|NKC| 0, 21, 0x05bc },
{ C99| 0| 0|CID|NFC|NKC| 0, 22, 0x05bd },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x05be },
{ C99| 0| 0|CID|NFC|NKC| 0, 23, 0x05bf },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x05c0 },
{ C99| 0| 0|CID|NFC|NKC| 0, 24, 0x05c1 },
{ C99| 0| 0|CID|NFC|NKC| 0, 25, 0x05c2 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x05cf },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x05ea },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x05ef },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x05f2 },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0x05f4 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0620 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x063a },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x063f },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x064a },
{ C99| 0|CXX|CID|NFC|NKC| 0, 27, 0x064b },
{ C99| 0|CXX|CID|NFC|NKC| 0, 28, 0x064c },
{ C99| 0|CXX|CID|NFC|NKC| 0, 29, 0x064d },
{ C99| 0|CXX|CID|NFC|NKC| 0, 30, 0x064e },
{ C99| 0|CXX|CID|NFC|NKC| 0, 31, 0x064f },
{ C99| 0|CXX|CID|NFC|NKC| 0, 32, 0x0650 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 33, 0x0651 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 34, 0x0652 },
{ 0| 0| 0|CID|NFC|NKC|CTX, 0, 0x065f },
{ C99|DIG| 0|CID|NFC|NKC| 0, 0, 0x0669 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x066f },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0674 },
{ C99| 0|CXX|CID|NFC| 0| 0, 0, 0x0678 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x06b7 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x06b9 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x06be },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x06bf },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x06ce },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x06cf },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x06d5 },
{ C99| 0| 0|CID|NFC|NKC| 0, 230, 0x06d6 },
{ C99| 0| 0|CID|NFC|NKC| 0, 230, 0x06d7 },
{ C99| 0| 0|CID|NFC|NKC| 0, 230, 0x06d8 },
{ C99| 0| 0|CID|NFC|NKC| 0, 230, 0x06d9 },
{ C99| 0| 0|CID|NFC|NKC| 0, 230, 0x06da },
{ C99| 0| 0|CID|NFC|NKC| 0, 230, 0x06db },
{ C99| 0| 0|CID|NFC|NKC| 0, 230, 0x06dc },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x06e4 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x06e6 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 230, 0x06e7 },
{ C99| 0| 0|CID|NFC|NKC| 0, 230, 0x06e8 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x06e9 },
{ C99| 0| 0|CID|NFC|NKC| 0, 220, 0x06ea },
{ C99| 0| 0|CID|NFC|NKC| 0, 230, 0x06eb },
{ C99| 0| 0|CID|NFC|NKC| 0, 230, 0x06ec },
{ C99| 0| 0|CID|NFC|NKC| 0, 220, 0x06ed },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x06ef },
{ C99|DIG| 0|CID|NFC|NKC| 0, 0, 0x06f9 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0900 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0903 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0904 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0939 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x093c },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x094c },
{ C99| 0| 0|CID|NFC|NKC| 0, 9, 0x094d },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x094f },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0950 },
{ C99| 0| 0|CID|NFC|NKC| 0, 230, 0x0951 },
{ C99| 0| 0|CID|NFC|NKC| 0, 220, 0x0952 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0957 },
{ C99| 0|CXX|CID| 0| 0| 0, 0, 0x095f },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0962 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0963 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0965 },
{ C99|DIG| 0|CID|NFC|NKC| 0, 0, 0x096f },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0980 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0983 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0984 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x098c },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x098e },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0990 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0992 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x09a8 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x09a9 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x09b0 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x09b1 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x09b2 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x09b5 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x09b9 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x09bd },
{ C99| 0| 0|CID|NFC|NKC|CTX, 0, 0x09be },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x09c4 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x09c6 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x09c8 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x09ca },
{ C99| 0| 0| 0|NFC|NKC| 0, 0, 0x09cb },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x09cc },
{ C99| 0| 0|CID|NFC|NKC| 0, 9, 0x09cd },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x09db },
{ C99| 0|CXX|CID| 0| 0| 0, 0, 0x09dd },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x09de },
{ C99| 0|CXX|CID| 0| 0| 0, 0, 0x09df },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x09e1 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x09e3 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x09e5 },
{ C99|DIG| 0|CID|NFC|NKC| 0, 0, 0x09ef },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x09f1 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a01 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0a02 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a04 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0a0a },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a0e },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0a10 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a12 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0a28 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a29 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0a30 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a31 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0a32 },
{ C99| 0|CXX|CID| 0| 0| 0, 0, 0x0a33 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a34 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0a35 },
{ C99| 0|CXX|CID| 0| 0| 0, 0, 0x0a36 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a37 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0a39 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a3d },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0a42 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a46 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0a48 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a4a },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0a4c },
{ C99| 0| 0|CID|NFC|NKC| 0, 9, 0x0a4d },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a58 },
{ C99| 0|CXX|CID| 0| 0| 0, 0, 0x0a5b },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0a5c },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a5d },
{ C99| 0|CXX|CID| 0| 0| 0, 0, 0x0a5e },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a65 },
{ C99|DIG| 0|CID|NFC|NKC| 0, 0, 0x0a6f },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a73 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0a74 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a80 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0a83 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a84 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0a8b },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a8c },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0a8d },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a8e },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0a91 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0a92 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0aa8 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0aa9 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0ab0 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0ab1 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0ab3 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0ab4 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0ab9 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0abc },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0ac5 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0ac6 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0ac9 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0aca },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0acc },
{ C99| 0| 0|CID|NFC|NKC| 0, 9, 0x0acd },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0acf },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0ad0 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0adf },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0ae0 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0ae5 },
{ C99|DIG| 0|CID|NFC|NKC| 0, 0, 0x0aef },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b00 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0b03 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b04 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0b0c },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b0e },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0b10 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b12 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0b28 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b29 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0b30 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b31 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0b33 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b35 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0b39 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b3c },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0b3d },
{ C99| 0| 0|CID|NFC|NKC|CTX, 0, 0x0b3e },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0b43 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b46 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0b48 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b4a },
{ C99| 0| 0| 0|NFC|NKC| 0, 0, 0x0b4b },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0b4c },
{ C99| 0| 0|CID|NFC|NKC| 0, 9, 0x0b4d },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b5b },
{ C99| 0|CXX|CID| 0| 0| 0, 0, 0x0b5d },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b5e },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0b61 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b65 },
{ C99|DIG| 0|CID|NFC|NKC| 0, 0, 0x0b6f },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b81 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0b83 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b84 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0b8a },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b8d },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0b90 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b91 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0b95 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b98 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0b9a },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b9b },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0b9c },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0b9d },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0b9f },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0ba2 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0ba4 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0ba7 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0baa },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0bad },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0bb5 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0bb6 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0bb9 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0bbd },
{ C99| 0| 0|CID|NFC|NKC|CTX, 0, 0x0bbe },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0bc2 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0bc5 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0bc8 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0bc9 },
{ C99| 0| 0| 0|NFC|NKC| 0, 0, 0x0bcb },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0bcc },
{ C99| 0| 0|CID|NFC|NKC| 0, 9, 0x0bcd },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0be6 },
{ C99|DIG| 0|CID|NFC|NKC| 0, 0, 0x0bef },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0c00 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0c03 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0c04 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0c0c },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0c0d },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0c10 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0c11 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0c28 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0c29 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0c33 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0c34 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0c39 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0c3d },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0c44 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0c45 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0c48 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0c49 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0c4c },
{ C99| 0| 0|CID|NFC|NKC| 0, 9, 0x0c4d },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0c5f },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0c61 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0c65 },
{ C99|DIG| 0|CID|NFC|NKC| 0, 0, 0x0c6f },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0c81 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0c83 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0c84 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0c8c },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0c8d },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0c90 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0c91 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0ca8 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0ca9 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0cb3 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0cb4 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0cb9 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0cbd },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0cc1 },
{ C99| 0| 0|CID|NFC|NKC|CTX, 0, 0x0cc2 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0cc4 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0cc5 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0cc8 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0cc9 },
{ C99| 0| 0| 0|NFC|NKC| 0, 0, 0x0cca },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0ccc },
{ C99| 0| 0|CID|NFC|NKC| 0, 9, 0x0ccd },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0cdd },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0cde },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0cdf },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0ce1 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0ce5 },
{ C99|DIG| 0|CID|NFC|NKC| 0, 0, 0x0cef },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0d01 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0d03 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0d04 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0d0c },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0d0d },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0d10 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0d11 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0d28 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0d29 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0d39 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0d3d },
{ C99| 0| 0|CID|NFC|NKC|CTX, 0, 0x0d3e },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0d43 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0d45 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0d48 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0d49 },
{ C99| 0| 0| 0|NFC|NKC| 0, 0, 0x0d4b },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0d4c },
{ C99| 0| 0|CID|NFC|NKC| 0, 9, 0x0d4d },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0d5f },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0d61 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0d65 },
{ C99|DIG| 0|CID|NFC|NKC| 0, 0, 0x0d6f },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0e00 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0e30 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0e31 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0e32 },
{ C99| 0|CXX|CID|NFC| 0| 0, 0, 0x0e33 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0e37 },
{ C99| 0| 0|CID|NFC|NKC| 0, 103, 0x0e38 },
{ C99| 0| 0|CID|NFC|NKC| 0, 103, 0x0e39 },
{ C99| 0| 0|CID|NFC|NKC| 0, 9, 0x0e3a },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0e3f },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0e46 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0e47 },
{ C99| 0| 0|CID|NFC|NKC| 0, 107, 0x0e48 },
{ C99| 0| 0|CID|NFC|NKC| 0, 107, 0x0e49 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0e4e },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0x0e4f },
{ C99|DIG|CXX|CID|NFC|NKC| 0, 0, 0x0e59 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0e5b },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0e80 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0e82 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0e83 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0e84 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0e86 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0e88 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0e89 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0e8a },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0e8c },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0e8d },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0e93 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0e97 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0e98 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0e9f },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0ea0 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0ea3 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0ea4 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0ea5 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0ea6 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0ea7 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0ea9 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0eab },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0eac },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0eae },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0x0eaf },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0eb0 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0eb1 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0eb2 },
{ C99| 0|CXX|CID|NFC| 0| 0, 0, 0x0eb3 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0eb7 },
{ C99| 0| 0|CID|NFC|NKC| 0, 118, 0x0eb8 },
{ C99| 0| 0|CID|NFC|NKC| 0, 118, 0x0eb9 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0eba },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0ebc },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0ebd },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0ebf },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0ec4 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0ec5 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x0ec6 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0ec7 },
{ C99| 0| 0|CID|NFC|NKC| 0, 122, 0x0ec8 },
{ C99| 0| 0|CID|NFC|NKC| 0, 122, 0x0ec9 },
{ C99| 0| 0|CID|NFC|NKC| 0, 122, 0x0eca },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0ecd },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0ecf },
{ C99|DIG| 0|CID|NFC|NKC| 0, 0, 0x0ed9 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0edb },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x0edd },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0eff },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0f00 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0f17 },
{ C99| 0| 0|CID|NFC|NKC| 0, 220, 0x0f18 },
{ C99| 0| 0|CID|NFC|NKC| 0, 220, 0x0f19 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0f1f },
{ C99|DIG| 0|CID|NFC|NKC| 0, 0, 0x0f33 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0f34 },
{ C99| 0| 0|CID|NFC|NKC| 0, 220, 0x0f35 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0f36 },
{ C99| 0| 0|CID|NFC|NKC| 0, 220, 0x0f37 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0f38 },
{ C99| 0| 0|CID|NFC|NKC| 0, 216, 0x0f39 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0f3d },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0f42 },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x0f43 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0f47 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0f48 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0f4c },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x0f4d },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0f51 },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x0f52 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0f56 },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x0f57 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0f5b },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x0f5c },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0f68 },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x0f69 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0f70 },
{ C99| 0| 0|CID|NFC|NKC| 0, 129, 0x0f71 },
{ C99| 0| 0|CID|NFC|NKC| 0, 130, 0x0f72 },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x0f73 },
{ C99| 0| 0|CID|NFC|NKC| 0, 132, 0x0f74 },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x0f76 },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x0f77 },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x0f78 },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x0f79 },
{ C99| 0| 0|CID|NFC|NKC| 0, 130, 0x0f7a },
{ C99| 0| 0|CID|NFC|NKC| 0, 130, 0x0f7b },
{ C99| 0| 0|CID|NFC|NKC| 0, 130, 0x0f7c },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0f7f },
{ C99| 0| 0|CID|NFC|NKC| 0, 130, 0x0f80 },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x0f81 },
{ C99| 0| 0|CID|NFC|NKC| 0, 230, 0x0f82 },
{ C99| 0| 0|CID|NFC|NKC| 0, 230, 0x0f83 },
{ C99| 0| 0|CID|NFC|NKC| 0, 9, 0x0f84 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0f85 },
{ C99| 0| 0|CID|NFC|NKC| 0, 230, 0x0f86 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0f8b },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0f8f },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0f92 },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x0f93 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0f95 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0f96 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0f97 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0f98 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0f9c },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x0f9d },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0fa1 },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x0fa2 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0fa6 },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x0fa7 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0fab },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x0fac },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0fad },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0fb0 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x0fb7 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x0fb8 },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x0fb9 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x109f },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x10c5 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x10cf },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x10f6 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x10ff },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0x1159 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1160 },
{ 0| 0|CXX|CID|NFC|NKC|CTX, 0, 0x1175 },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0x11a2 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x11a7 },
{ 0| 0|CXX|CID|NFC|NKC|CTX, 0, 0x11c2 },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0x11f9 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1dff },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1e99 },
{ C99| 0|CXX|CID|NFC| 0| 0, 0, 0x1e9a },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x1e9b },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1e9f },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1ef9 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1eff },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1f15 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1f17 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1f1d },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1f1f },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1f45 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1f47 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1f4d },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1f4f },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1f57 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1f58 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1f59 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1f5a },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1f5b },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1f5c },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1f5d },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1f5e },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1f70 },
{ C99| 0|CXX| 0| 0| 0| 0, 0, 0x1f71 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1f72 },
{ C99| 0|CXX| 0| 0| 0| 0, 0, 0x1f73 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1f74 },
{ C99| 0|CXX| 0| 0| 0| 0, 0, 0x1f75 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1f76 },
{ C99| 0|CXX| 0| 0| 0| 0, 0, 0x1f77 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1f78 },
{ C99| 0|CXX| 0| 0| 0| 0, 0, 0x1f79 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1f7a },
{ C99| 0|CXX| 0| 0| 0| 0, 0, 0x1f7b },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1f7c },
{ C99| 0|CXX| 0| 0| 0| 0, 0, 0x1f7d },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1f7f },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1fb4 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1fb5 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1fba },
{ C99| 0|CXX| 0| 0| 0| 0, 0, 0x1fbb },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1fbc },
{ 0| 0| 0|CID|NFC| 0| 0, 0, 0x1fbd },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x1fbe },
{ 0| 0| 0|CID|NFC| 0| 0, 0, 0x1fc1 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1fc4 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1fc5 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1fc8 },
{ C99| 0|CXX| 0| 0| 0| 0, 0, 0x1fc9 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1fca },
{ C99| 0|CXX| 0| 0| 0| 0, 0, 0x1fcb },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1fcc },
{ 0| 0| 0|CID|NFC| 0| 0, 0, 0x1fcf },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1fd2 },
{ C99| 0|CXX| 0| 0| 0| 0, 0, 0x1fd3 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1fd5 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1fda },
{ C99| 0|CXX| 0| 0| 0| 0, 0, 0x1fdb },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1fdf },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1fe2 },
{ C99| 0|CXX| 0| 0| 0| 0, 0, 0x1fe3 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1fea },
{ C99| 0|CXX| 0| 0| 0| 0, 0, 0x1feb },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1fec },
{ 0| 0| 0|CID|NFC| 0| 0, 0, 0x1ff1 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1ff4 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x1ff5 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1ff8 },
{ C99| 0|CXX| 0| 0| 0| 0, 0, 0x1ff9 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1ffa },
{ C99| 0|CXX| 0| 0| 0| 0, 0, 0x1ffb },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x1ffc },
{ 0| 0| 0|CID| 0| 0| 0, 0, 0x203e },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x2040 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x207e },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x207f },
{ 0| 0| 0|CID|NFC| 0| 0, 0, 0x2101 },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x2102 },
{ 0| 0| 0|CID|NFC| 0| 0, 0, 0x2106 },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x2107 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x2109 },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x2113 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x2114 },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x2115 },
{ 0| 0| 0|CID|NFC| 0| 0, 0, 0x2117 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x2118 },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x211d },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x2123 },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x2124 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x2125 },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x2126 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x2127 },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x2128 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x2129 },
{ C99| 0| 0|CID| 0| 0| 0, 0, 0x212a },
{ C99| 0| 0| 0| 0| 0| 0, 0, 0x212b },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x212d },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x212e },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x2131 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x2132 },
{ C99| 0| 0|CID|NFC| 0| 0, 0, 0x2138 },
{ 0| 0| 0|CID|NFC| 0| 0, 0, 0x215f },
{ C99|DIG| 0|CID|NFC| 0| 0, 0, 0x217f },
{ C99|DIG| 0|CID|NFC|NKC| 0, 0, 0x2182 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x3004 },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0x3006 },
{ C99|DIG| 0|CID|NFC|NKC| 0, 0, 0x3007 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x3020 },
{ C99|DIG| 0|CID|NFC|NKC| 0, 0, 0x3029 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x3040 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x3093 },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0x3094 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x309a },
{ C99| 0|CXX|CID|NFC| 0| 0, 0, 0x309c },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0x309e },
{ 0| 0| 0|CID|NFC| 0| 0, 0, 0x30a0 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x30f6 },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0x30fa },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x30fc },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0x30fe },
{ 0| 0| 0|CID|NFC| 0| 0, 0, 0x3104 },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x312c },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0x4dff },
{ C99| 0|CXX|CID|NFC|NKC| 0, 0, 0x9fa5 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xabff },
{ C99| 0| 0|CID|NFC|NKC| 0, 0, 0xd7a3 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xf8ff },
{ 0| 0|CXX| 0| 0| 0| 0, 0, 0xfa0d },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0xfa0f },
{ 0| 0|CXX| 0| 0| 0| 0, 0, 0xfa10 },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0xfa11 },
{ 0| 0|CXX| 0| 0| 0| 0, 0, 0xfa12 },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0xfa14 },
{ 0| 0|CXX| 0| 0| 0| 0, 0, 0xfa1e },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0xfa1f },
{ 0| 0|CXX| 0| 0| 0| 0, 0, 0xfa20 },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0xfa21 },
{ 0| 0|CXX| 0| 0| 0| 0, 0, 0xfa22 },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0xfa24 },
{ 0| 0|CXX| 0| 0| 0| 0, 0, 0xfa26 },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0xfa29 },
{ 0| 0|CXX| 0| 0| 0| 0, 0, 0xfa2d },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xfb1e },
{ 0| 0|CXX|CID| 0| 0| 0, 0, 0xfb1f },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0xfb29 },
{ 0| 0|CXX|CID| 0| 0| 0, 0, 0xfb36 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xfb37 },
{ 0| 0|CXX|CID| 0| 0| 0, 0, 0xfb3c },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xfb3d },
{ 0| 0|CXX|CID| 0| 0| 0, 0, 0xfb3e },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xfb3f },
{ 0| 0|CXX|CID| 0| 0| 0, 0, 0xfb41 },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0xfb42 },
{ 0| 0|CXX|CID| 0| 0| 0, 0, 0xfb44 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xfb45 },
{ 0| 0|CXX|CID| 0| 0| 0, 0, 0xfb4e },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0xfbb1 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xfbd2 },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0xfd3d },
{ 0| 0|CXX|CID|NFC|NKC| 0, 0, 0xfd3f },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xfd4f },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0xfd8f },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xfd91 },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0xfdc7 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xfdef },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0xfdfb },
{ 0| 0| 0|CID|NFC| 0| 0, 0, 0xfe6f },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0xfe72 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xfe73 },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0xfe74 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xfe75 },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0xfefc },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xff20 },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0xff3a },
{ 0| 0| 0|CID|NFC| 0| 0, 0, 0xff40 },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0xff5a },
{ 0| 0| 0|CID|NFC| 0| 0, 0, 0xff65 },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0xffbe },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xffc1 },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0xffc7 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xffc9 },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0xffcf },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xffd1 },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0xffd7 },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xffd9 },
{ 0| 0|CXX|CID|NFC| 0| 0, 0, 0xffdc },
{ 0| 0| 0|CID|NFC|NKC| 0, 0, 0xffff },

View File

@ -0,0 +1,211 @@
; Table of UCNs which are valid in identifiers.
; Copyright (C) 2003, 2005 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, write to the Free Software
; Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
;
; This file reproduces the table in ISO/IEC 9899:1999 (C99) Annex
; D, which is itself a reproduction from ISO/IEC TR 10176:1998, and
; the similar table from ISO/IEC 14882:1988 (C++98) Annex E, which is
; a reproduction of ISO/IEC PDTR 10176. Unfortunately these tables
; are not identical.
[C99]
; Latin
00aa 00ba 00c0-00d6 00d8-00f6 00f8-01f5 01fa-0217 0250-02a8 1e00-1e9b
1ea0-1ef9 207f
; Greek
0386 0388-038a 038c 038e-03a1 03a3-03ce 03d0-03d6 03da 03dc 03de 03e0
03e2-03f3 1f00-1f15 1f18-1f1d 1f20-1f45 1f48-1f4d 1f50-1f57 1f59 1f5b
1f5d 1f5f-1f7d 1f80-1fb4 1fb6-1fbc 1fc2-1fc4 1fc6-1fcc 1fd0-1fd3
1fd6-1fdb 1fe0-1fec 1ff2-1ff4 1ff6-1ffc
; Cyrillic
0401-040c 040e-044f 0451-045c 045e-0481 0490-04c4 04c7-04c8 04cb-04cc
04d0-04eb 04ee-04f5 04f8-04f9
; Armenian
0531-0556 0561-0587
; Hebrew
05b0-05b9 05bb-05bd 05bf 05c1-05c2 05d0-05ea 05f0-05f2
; Arabic
0621-063a 0640-0652 0670-06b7 06ba-06be 06c0-06ce 06d0-06dc 06e5-06e8
06ea-06ed
; Devanagari
0901-0903 0905-0939 093e-094d 0950-0952 0958-0963
; Bengali
0981-0983 0985-098c 098f-0990 0993-09a8 09aa-09b0 09b2 09b6-09b9
09be-09c4 09c7-09c8 09cb-09cd 09dc-09dd 09df-09e3 09f0-09f1
; Gurmukhi
0a02 0a05-0a0a 0a0f-0a10 0a13-0a28 0a2a-0a30 0a32-0a33 0a35-0a36
0a38-0a39 0a3e-0a42 0a47-0a48 0a4b-0a4d 0a59-0a5c 0a5e 0a74
; Gujarati
0a81-0a83 0a85-0a8b 0a8d 0a8f-0a91 0a93-0aa8 0aaa-0ab0 0ab2-0ab3
0ab5-0ab9 0abd-0ac5 0ac7-0ac9 0acb-0acd 0ad0 0ae0
; Oriya
0b01-0b03 0b05-0b0c 0b0f-0b10 0b13-0b28 0b2a-0b30 0b32-0b33 0b36-0b39
0b3e-0b43 0b47-0b48 0b4b-0b4d 0b5c-0b5d 0b5f-0b61
; Tamil
0b82-0b83 0b85-0b8a 0b8e-0b90 0b92-0b95 0b99-0b9a 0b9c 0b9e-0b9f
0ba3-0ba4 0ba8-0baa 0bae-0bb5 0bb7-0bb9 0bbe-0bc2 0bc6-0bc8 0bca-0bcd
; Telugu
0c01-0c03 0c05-0c0c 0c0e-0c10 0c12-0c28 0c2a-0c33 0c35-0c39 0c3e-0c44
0c46-0c48 0c4a-0c4d 0c60-0c61
; Kannada
0c82-0c83 0c85-0c8c 0c8e-0c90 0c92-0ca8 0caa-0cb3 0cb5-0cb9 0cbe-0cc4
0cc6-0cc8 0cca-0ccd 0cde 0ce0-0ce1
; Malayalam
0d02-0d03 0d05-0d0c 0d0e-0d10 0d12-0d28 0d2a-0d39 0d3e-0d43 0d46-0d48
0d4a-0d4d 0d60-0d61
# CORRECTION: exclude 0e50-0e59 from the Thai range as it also appears
# in the Digits range below.
; Thai
0e01-0e3a 0e40-0e49 0e5a-0e5b
; Lao
0e81-0e82 0e84 0e87-0e88 0e8a 0e8d 0e94-0e97 0e99-0e9f 0ea1-0ea3 0ea5
0ea7 0eaa-0eab 0ead-0eae 0eb0-0eb9 0ebb-0ebd 0ec0-0ec4 0ec6 0ec8-0ecd
0edc-0edd
; Tibetan
0f00 0f18-0f19 0f35 0f37 0f39 0f3e-0f47 0f49-0f69 0f71-0f84 0f86-0f8b
0f90-0f95 0f97 0f99-0fad 0fb1-0fb7 0fb9
; Georgian
10a0-10c5 10d0-10f6
; Hiragana
3041-3093 309b-309c
; Katakana
30a1-30f6 30fb-30fc
; Bopomofo
3105-312c
; CJK Unified Ideographs
4e00-9fa5
; Hangul
ac00-d7a3
; Special characters
00b5 00b7 02b0-02b8 02bb 02bd-02c1 02d0-02d1 02e0-02e4 037a 0559 093d
0b3d 1fbe 203f-2040 2102 2107 210a-2113 2115 2118-211d 2124 2126 2128
212a-2131 2133-2138 2160-2182 3005-3007 3021-3029
; Digits
0660-0669 06f0-06f9 0966-096f 09e6-09ef 0a66-0a6f 0ae6-0aef 0b66-0b6f
0be7-0bef 0c66-0c6f 0ce6-0cef 0d66-0d6f 0e50-0e59 0ed0-0ed9 0f20-0f33
[CXX]
; Latin
00c0-00d6 00d8-00f6 00f8-01f5 01fa-0217 0250-02a8 1e00-1e9a 1ea0-1ef9
; Greek
0384 0388-038a 038c 038e-03a1 03a3-03ce 03d0-03d6 03da 03dc 03de 03e0
03e2-03f3 1f00-1f15 1f18-1f1d 1f20-1f45 1f48-1f4d 1f50-1f57 1f59 1f5b
1f5d 1f5f-1f7d 1f80-1fb4 1fb6-1fbc 1fc2-1fc4 1fc6-1fcc 1fd0-1fd3
1fd6-1fdb 1fe0-1fec 1ff2-1ff4 1ff6-1ffc
; Cyrillic
0401-040d 040f-044f 0451-045c 045e-0481 0490-04c4 04c7-04c8 04cb-04cc
04d0-04eb 04ee-04f5 04f8-04f9
; Armenian
0531-0556 0561-0587
; Hebrew
05d0-05ea 05f0-05f4
; Arabic
0621-063a 0640-0652 0670-06b7 06ba-06be 06c0-06ce 06e5-06e7
; Devanagari
0905-0939 0958-0962
; Bengali
0985-098c 098f-0990 0993-09a8 09aa-09b0 09b2 09b6-09b9 09dc-09dd
09df-09e1 09f0-09f1
; Gurmukhi
0a05-0a0a 0a0f-0a10 0a13-0a28 0a2a-0a30 0a32-0a33 0a35-0a36 0a38-0a39
0a59-0a5c 0a5e
; Gujarati
0a85-0a8b 0a8d 0a8f-0a91 0a93-0aa8 0aaa-0ab0 0ab2-0ab3 0ab5-0ab9 0ae0
; Oriya
0b05-0b0c 0b0f-0b10 0b13-0b28 0b2a-0b30 0b32-0b33 0b36-0b39 0b5c-0b5d
0b5f-0b61
; Tamil
0b85-0b8a 0b8e-0b90 0b92-0b95 0b99-0b9a 0b9c 0b9e-0b9f 0ba3-0ba4
0ba8-0baa 0bae-0bb5 0bb7-0bb9
; Telugu
0c05-0c0c 0c0e-0c10 0c12-0c28 0c2a-0c33 0c35-0c39 0c60-0c61
; Kannada
0c85-0c8c 0c8e-0c90 0c92-0ca8 0caa-0cb3 0cb5-0cb9 0ce0-0ce1
; Malayalam
0d05-0d0c 0d0e-0d10 0d12-0d28 0d2a-0d39 0d60-0d61
; Thai
0e01-0e30 0e32-0e33 0e40-0e46 0e4f-0e5b
; Digits
0e50-0e59
; Lao
0e81-0e82 0e84 0e87-0e88 0e8a 0e8d 0e94-0e97 0e99-0e9f 0ea1-0ea3 0ea5
0ea7 0eaa-0eab 0ead-0eb0 0eb2 0eb3 0ebd 0ec0-0ec4 0ec6
; Georgian
10a0-10c5 10d0-10f6
; Hiragana
3041-3094 309b-309e
; Katakana
30a1-30fe
; Bopomofo
3105-312c
; Hangul
1100-1159 1161-11a2 11a8-11f9
; CJK Unified Ideographs
f900-fa2d fb1f-fb36 fb38-fb3c fb3e fb40-fb41 fb42-fb44 fb46-fbb1
fbd3-fd3f fd50-fd8f fd92-fdc7 fdf0-fdfb fe70-fe72 fe74 fe76-fefc
ff21-ff3a ff41-ff5a ff66-ffbe ffc2-ffc7 ffca-ffcf ffd2-ffd7
ffda-ffdc 4e00-9fa5

View File

@ -0,0 +1,174 @@
2007-05-13 Release Manager
* GCC 4.2.0 released.
2007-03-08 Ben Elliston <bje@au.ibm.com>
* decContext.c, decContext.h, decDPD.h, decimal128.c,
decimal128.h, decimal32.c, decimal32.h, decimal64.c, decimal64.h,
decLibrary.c, decNumber.c, decNumber.h, decNumberLocal.h,
decRound.c, decRound.h, decUtility.c, decUtility.h: Add
libgcc-style license exception clause.
2006-10-10 Brooks Moses <bmoses@stanford.edu>
* Makefile.in: Added empty "pdf" target.
2006-09-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* decNumber.c (decNumberPower): Constify.
* decNumber.h (decNumberPower): Likewise.
2006-09-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* configure.ac (ACX_PROG_CC_WARNING_OPTS): Add -Wcast-qual.
* configure, config.in: Regenerate.
* decContext.c (decContextStatusToString): Constify.
* decContext.h (decContextStatusToString): Likewise.
* decNumber.c (decNumberToString, decNumberToEngString,
decNumberAbs, decNumberAdd, decNumberCompare, decNumberDivide,
decNumberDivideInteger, decNumberMax, decNumberMin,
decNumberMinus, decNumberPlus, decNumberMultiply,
decNumberNormalize, decNumberQuantize, decNumberRescale,
decNumberRemainder, decNumberRemainderNear,
decNumberSameQuantum, decNumberSquareRoot, decNumberSubtract,
decNumberToIntegralValue, decNumberCopy, decToString, decAddOp,
decDivideOp, decMultiplyOp, decQuantizeOp, decCompareOp,
decCompare, decUnitCompare, decUnitAddSub, decRoundOperand,
decCopyFit, decSetCoeff, decGetInt, decNaNs, decGetDigits,
decNumberShow, decDumpAr, decCheckOperands, decCheckNumber):
Likewise.
* decNumber.h (decNumberToString, decNumberToEngString,
decNumberAbs, decNumberAdd, decNumberCompare, decNumberDivide,
decNumberDivideInteger, decNumberMax, decNumberMin,
decNumberMinus, decNumberMultiply, decNumberNormalize,
decNumberPlus, decNumberQuantize, decNumberRemainder,
decNumberRemainderNear, decNumberRescale,
decNumberSameQuantum, decNumberSquareRoot, decNumberSubtract,
decNumberToIntegralValue, decNumberCopy): Likewise.
* decUtility.c (decDensePackCoeff, decDenseUnpackCoeff):
Likewise.
* decUtility.h (decDensePackCoeff, decDenseUnpackCoeff):
Likewise.
* decimal128.c (decimal128FromNumber, decimal128ToNumber,
decimal128ToString, decimal128ToEngString, decimal128Show):
Likewise.
* decimal128.h (decimal128ToString, decimal128ToEngString,
decimal128FromNumber, decimal128ToNumber): Likewise.
* decimal32.c (decimal32FromNumber, decimal32ToNumber,
decimal32ToString, decimal32ToEngString, decimal32Show):
Likewise.
* decimal32.h (decimal32ToString, decimal32ToEngString,
decimal32FromNumber, decimal32ToNumber): Likewise.
* decimal64.c (decimal64FromNumber, decimal64ToNumber,
decimal64ToString, decimal64ToEngString, decimal64Show):
Likewise.
* decimal64.h (decimal64ToString, decimal64ToEngString,
decimal64FromNumber, decimal64ToNumber): Likewise.
2006-08-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* decContext.c (decContextSetStatusFromString): Constify.
* decContext.h (decContextSetStatusFromString): Likewise.
* decNumber.c (decNumberFromString): Likewise.
* decNumber.h (decNumberFromString): Likewise.
* decimal128.c (decimal128FromString): Likewise.
* decimal128.h (decimal128FromString): Likewise.
* decimal32.c (decimal32FromString): Likewise.
* decimal32.h (decimal32FromString): Likewise.
* decimal64.c (decimal64FromString): Likewise.
* decimal64.h (decimal64FromString): Likewise.
2006-07-25 Paolo Bonzini <bonzini@gnu.org>
PR build/26188
* configure: Regenerate.
2006-06-23 Ben Elliston <bje@au.ibm.com>
* decNumber.h (decNumberNegate): Remove.
2006-05-23 Carlos O'Donell <carlos@codesourcery.com>
* Makefile.in: Add install-html target. Add install-html to .PHONY
2006-02-06 Ben Elliston <bje@au.ibm.com>
* decLibrary.c (__dec_byte_swap): Use uint32_t for argument and
return types.
2006-01-03 Roger Sayle <roger@eyesopen.com>
Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* decNumber.c (__NO_STRING_INLINES): Define to prevent glibc macro
definition of strcpy from generating compilation warnings.
2006-01-02 Paolo Bonzini <bonzini@gnu.org>
PR target/25259
* configure.ac: Use GCC_HEADER_STDINT.
* decContext.h: Include gstdint.h.
* aclocal.m4: Regenerate.
* configure: Regenerate.
2005-12-20 Roger Sayle <roger@eyesopen.com>
* decNumber.c (decStrEq): Cast string contents to unsigned char
instead of int before calling tolower.
2005-12-20 Roger Sayle <roger@eyesopen.com>
* decNumber.c (decStrEq): Cast operands to int before calling
tolower to avoid compilation warnings on Tru64.
2005-12-05 Ben Elliston <bje@au.ibm.com>
* Makefile.in (clean): Remove stray reference to libcpp.a.
* decimal128.h, decContext.c, decRound.c, decimal32.c,
decNumber.c, decContext.h, decimal64.c, decimal32.h, decNumber.h,
decimal64.h, decUtility.c, decLibrary.c, configure.ac,
decNumberLocal.h, decUtility.h, decDPD.h, decimal128.c: Update FSF
office address.
2005-12-01 Ben Elliston <bje@au.ibm.com>
* Makefile.in (libdecnumber_a_SOURCES): Drop decLibrary.c.
* decUtility.c (__dec_byte_swap): Move from here ..
* decLibrary.c: .. to here.
2005-11-23 Gerald Pfeifer <gerald@pfeifer.com>
* decContext.h: Properly guard inclusion of stdint.h
* decContext.c: Include config.h
* decLibrary.c: Ditto.
* decNumber.c: Ditto.
* decRound.c: Ditto.
* decUtility.c: Ditto.
* decimal32.c: Ditto.
* decimal64.c: Ditto.
* decimal128.c: Ditto.
2005-11-29 Ben Elliston <bje@au.ibm.com>
* decUtility.c: Remove redundant #includes.
* decUtility.h (__dec_byte_swap): Remove prototype.
2005-11-29 Ben Elliston <bje@au.ibm.com>
* configure.ac: New file.
* aclocal.m4: Likewise.
* Makefile.in: Likewise.
* configure: Generate.
* config.in: Likewise.
2005-11-29 Ben Elliston <bje@au.ibm.com>
* decimal32.h, decimal64.h, decimal128.h: New.
* decimal32.c, decimal64.c, decimal128.c: Likewise.
* decContext.c, decContext.h: Likewise.
* decUtility.c, decUtility.h: Likewise.
* decNumber.c, decNumber.h, decNumberLocal.h: Likewise.
* decDPD.h: Likewise.
* decLibrary.c, decRound.c: Likewise.

View File

@ -0,0 +1,156 @@
# @configure_input@
# Makefile for libdecnumber. Run 'configure' to generate Makefile from Makefile.in
# Copyright (C) 2005 Free Software Foundation, Inc.
#This file is part of GCC.
#GCC 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.
#GCC 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 GCC; see the file COPYING. If not, write to
#the Free Software Foundation, 51 Franklin Street, Fifth Floor,
#Boston MA 02110-1301, USA.
@SET_MAKE@
srcdir = @srcdir@
top_builddir = .
VPATH = @srcdir@
INSTALL = @INSTALL@
AR = ar
ARFLAGS = cru
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
CC = @CC@
CFLAGS = @CFLAGS@
WARN_CFLAGS = @WARN_CFLAGS@ @WARN_PEDANTIC@ @WERROR@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBICONV = @LIBICONV@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
SHELL = @SHELL@
datadir = @datadir@
exec_prefix = @prefix@
libdir = @libdir@
localedir = $(datadir)/locale
prefix = @prefix@
INCLUDES = -I$(srcdir) -I.
ALL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(INCLUDES) $(CPPFLAGS)
libdecnumber_a_OBJS = decNumber.o decContext.o decUtility.o \
decimal32.o decimal64.o decimal128.o
libdecnumber_a_SOURCES = decContext.c decContext.h decDPD.h \
decNumber.c decNumber.h decNumberLocal.h \
decUtility.c decUtility.h \
decRound.c decimal128.c decimal128.h decimal32.c decimal32.h \
decimal64.c decimal64.h
all: libdecnumber.a
.SUFFIXES:
.SUFFIXES: .c .o .obj
libdecnumber.a: $(libdecnumber_a_OBJS)
-rm -f $@
$(AR) $(ARFLAGS) $@ $(libdecnumber_a_OBJS)
$(RANLIB) $@
# Rules to rebuild the configuration
Makefile: $(srcdir)/Makefile.in config.status
$(SHELL) ./config.status Makefile
config.status: $(srcdir)/configure
$(SHELL) ./config.status --recheck
$(srcdir)/configure: @MAINT@ $(srcdir)/aclocal.m4
cd $(srcdir) && $(AUTOCONF)
$(srcdir)/aclocal.m4: @MAINT@ $(srcdir)/../config/acx.m4 \
$(srcdir)/../config/warnings.m4 \
$(srcdir)/configure.ac
cd $(srcdir) && $(ACLOCAL) -I ../config
config.h: stamp-h1
test -f config.h || (rm -f stamp-h1 && $(MAKE) stamp-h1)
stamp-h1: $(srcdir)/config.in config.status
-rm -f stamp-h1
$(SHELL) ./config.status config.h
$(srcdir)/config.in: @MAINT@ $(srcdir)/configure
cd $(srcdir) && $(AUTOHEADER)
-rm -f stamp-h1
# Dependencies.
decContext.o: decContext.c decContext.h decNumberLocal.h
decNumber.o: decNumber.c decNumber.h decContext.h decNumberLocal.h
decimal32.o: decimal32.c decNumber.h decContext.h decNumberLocal.h \
decimal32.h decUtility.h
decimal64.o: decimal64.c decNumber.h decContext.h decNumberLocal.h \
decimal64.h decUtility.h
decimal128.o: decimal128.c decNumber.h decNumberLocal.h decimal128.h \
decUtility.h
# Other miscellaneous targets.
mostlyclean:
-rm -f *.o
clean: mostlyclean
-rm -rf makedepend$(EXEEXT) libdecnumber.a $(srcdir)/autom4te.cache
distclean: clean
-rm -f config.h stamp-h1 config.status config.cache config.log \
configure.lineno configure.status.lineno Makefile localedir.h \
localedir.hs
maintainer-clean: distclean
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-rm -f $(srcdir)/configure $(srcdir)/aclocal.m4
check:
installcheck:
dvi:
pdf:
html:
info:
install-info:
install-man:
install-html:
install:
.PHONY: installdirs install install-strip mostlyclean clean distclean \
maintainer-clean check installcheck dvi pdf html info install-info \
install-man update-po install-html
COMPILE = source='$<' object='$@' libtool=no $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(ALL_CFLAGS) -c
# Implicit rules
.c.o:
$(COMPILE) $<
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

15
contrib/gcclibs/libdecnumber/aclocal.m4 vendored Normal file
View File

@ -0,0 +1,15 @@
# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_include([../config/stdint.m4])
m4_include([../config/warnings.m4])

View File

@ -0,0 +1,76 @@
/* config.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of a `char', as computed by sizeof. */
#undef SIZEOF_CHAR
/* The size of a `int', as computed by sizeof. */
#undef SIZEOF_INT
/* The size of a `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of a `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* The size of a `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `long' if <sys/types.h> does not define. */
#undef off_t

8880
contrib/gcclibs/libdecnumber/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,78 @@
# configure.ac for libdecnumber -*- Autoconf -*-
# Process this file with autoconf to generate a configuration script.
# Copyright 2005, 2006 Free Software Foundation, Inc.
# This file is part of GCC.
# GCC 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.
# GCC 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 GCC; see the file COPYING. If not, write to the Free
# Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
AC_PREREQ(2.59)
AC_INIT(libdecnumber, [ ], gcc-bugs@gcc.gnu.org, libdecnumber)
AC_CONFIG_SRCDIR(decNumber.h)
AC_CONFIG_MACRO_DIR(../config)
# Checks for programs.
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_RANLIB
MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
AC_CHECK_PROGS([ACLOCAL], [aclocal], [$MISSING aclocal])
AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf])
AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader])
# Figure out what compiler warnings we can enable.
# See config/warnings.m4 for details.
ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wold-style-definition \
-Wmissing-format-attribute -Wcast-qual])
ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
# Only enable with --enable-werror-always until existing warnings are
# corrected.
ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
# Checks for header files.
AC_CHECK_HEADERS(ctype.h stddef.h string.h stdio.h)
GCC_HEADER_STDINT(gstdint.h)
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
# Checks for library functions.
AC_HEADER_STDC
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode enable rules only needed by maintainers],,
enable_maintainer_mode=no)
if test "x$enable_maintainer_mode" = xno; then
MAINT='#'
else
MAINT=
fi
AC_SUBST(MAINT)
# Output.
AC_CONFIG_HEADERS(config.h:config.in, [echo timestamp > stamp-h1])
AC_CONFIG_FILES(Makefile)
AC_OUTPUT

View File

@ -0,0 +1,228 @@
/* Decimal context module for the decNumber C Library.
Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by IBM Corporation. Author Mike Cowlishaw.
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License,
the Free Software Foundation gives you unlimited permission to link
the compiled version of this file into combinations with other
programs, and to distribute those combinations without any
restriction coming from the use of this file. (The General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into a combine executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
/* This module compirises the routines for handling the arithmetic
context structures. */
#include <string.h> /* for strcmp */
#include "config.h"
#include "decContext.h" /* context and base types */
#include "decNumberLocal.h" /* decNumber local types, etc. */
/* ------------------------------------------------------------------ */
/* decContextDefault -- initialize a context structure */
/* */
/* context is the structure to be initialized */
/* kind selects the required set of default values, one of: */
/* DEC_INIT_BASE -- select ANSI X3-274 defaults */
/* DEC_INIT_DECIMAL32 -- select IEEE 754r defaults, 32-bit */
/* DEC_INIT_DECIMAL64 -- select IEEE 754r defaults, 64-bit */
/* DEC_INIT_DECIMAL128 -- select IEEE 754r defaults, 128-bit */
/* For any other value a valid context is returned, but with */
/* Invalid_operation set in the status field. */
/* returns a context structure with the appropriate initial values. */
/* ------------------------------------------------------------------ */
decContext *
decContextDefault (decContext * context, Int kind)
{
/* set defaults... */
context->digits = 9; /* 9 digits */
context->emax = DEC_MAX_EMAX; /* 9-digit exponents */
context->emin = DEC_MIN_EMIN; /* .. balanced */
context->round = DEC_ROUND_HALF_UP; /* 0.5 rises */
context->traps = DEC_Errors; /* all but informational */
context->status = 0; /* cleared */
context->clamp = 0; /* no clamping */
#if DECSUBSET
context->extended = 0; /* cleared */
#endif
switch (kind)
{
case DEC_INIT_BASE:
/* [use defaults] */
break;
case DEC_INIT_DECIMAL32:
context->digits = 7; /* digits */
context->emax = 96; /* Emax */
context->emin = -95; /* Emin */
context->round = DEC_ROUND_HALF_EVEN; /* 0.5 to nearest even */
context->traps = 0; /* no traps set */
context->clamp = 1; /* clamp exponents */
#if DECSUBSET
context->extended = 1; /* set */
#endif
break;
case DEC_INIT_DECIMAL64:
context->digits = 16; /* digits */
context->emax = 384; /* Emax */
context->emin = -383; /* Emin */
context->round = DEC_ROUND_HALF_EVEN; /* 0.5 to nearest even */
context->traps = 0; /* no traps set */
context->clamp = 1; /* clamp exponents */
#if DECSUBSET
context->extended = 1; /* set */
#endif
break;
case DEC_INIT_DECIMAL128:
context->digits = 34; /* digits */
context->emax = 6144; /* Emax */
context->emin = -6143; /* Emin */
context->round = DEC_ROUND_HALF_EVEN; /* 0.5 to nearest even */
context->traps = 0; /* no traps set */
context->clamp = 1; /* clamp exponents */
#if DECSUBSET
context->extended = 1; /* set */
#endif
break;
default: /* invalid Kind */
/* use defaults, and .. */
decContextSetStatus (context, DEC_Invalid_operation); /* trap */
}
return context;
} /* decContextDefault */
/* ------------------------------------------------------------------ */
/* decContextStatusToString -- convert status flags to a string */
/* */
/* context is a context with valid status field */
/* */
/* returns a constant string describing the condition. If multiple */
/* (or no) flags are set, a generic constant message is returned. */
/* ------------------------------------------------------------------ */
const char *
decContextStatusToString (const decContext * context)
{
Int status = context->status;
if (status == DEC_Conversion_syntax)
return DEC_Condition_CS;
if (status == DEC_Division_by_zero)
return DEC_Condition_DZ;
if (status == DEC_Division_impossible)
return DEC_Condition_DI;
if (status == DEC_Division_undefined)
return DEC_Condition_DU;
if (status == DEC_Inexact)
return DEC_Condition_IE;
if (status == DEC_Insufficient_storage)
return DEC_Condition_IS;
if (status == DEC_Invalid_context)
return DEC_Condition_IC;
if (status == DEC_Invalid_operation)
return DEC_Condition_IO;
#if DECSUBSET
if (status == DEC_Lost_digits)
return DEC_Condition_LD;
#endif
if (status == DEC_Overflow)
return DEC_Condition_OV;
if (status == DEC_Clamped)
return DEC_Condition_PA;
if (status == DEC_Rounded)
return DEC_Condition_RO;
if (status == DEC_Subnormal)
return DEC_Condition_SU;
if (status == DEC_Underflow)
return DEC_Condition_UN;
if (status == 0)
return DEC_Condition_ZE;
return DEC_Condition_MU; /* Multiple errors */
} /* decContextStatusToString */
/* ------------------------------------------------------------------ */
/* decContextSetStatusFromString -- set status from a string */
/* */
/* context is the controlling context */
/* string is a string exactly equal to one that might be returned */
/* by decContextStatusToString */
/* */
/* The status bit corresponding to the string is set, and a trap */
/* is raised if appropriate. */
/* */
/* returns the context structure, unless the string is equal to */
/* DEC_Condition_MU or is not recognized. In these cases NULL is */
/* returned. */
/* ------------------------------------------------------------------ */
decContext *
decContextSetStatusFromString (decContext * context, const char *string)
{
if (strcmp (string, DEC_Condition_CS) == 0)
return decContextSetStatus (context, DEC_Conversion_syntax);
if (strcmp (string, DEC_Condition_DZ) == 0)
return decContextSetStatus (context, DEC_Division_by_zero);
if (strcmp (string, DEC_Condition_DI) == 0)
return decContextSetStatus (context, DEC_Division_impossible);
if (strcmp (string, DEC_Condition_DU) == 0)
return decContextSetStatus (context, DEC_Division_undefined);
if (strcmp (string, DEC_Condition_IE) == 0)
return decContextSetStatus (context, DEC_Inexact);
if (strcmp (string, DEC_Condition_IS) == 0)
return decContextSetStatus (context, DEC_Insufficient_storage);
if (strcmp (string, DEC_Condition_IC) == 0)
return decContextSetStatus (context, DEC_Invalid_context);
if (strcmp (string, DEC_Condition_IO) == 0)
return decContextSetStatus (context, DEC_Invalid_operation);
#if DECSUBSET
if (strcmp (string, DEC_Condition_LD) == 0)
return decContextSetStatus (context, DEC_Lost_digits);
#endif
if (strcmp (string, DEC_Condition_OV) == 0)
return decContextSetStatus (context, DEC_Overflow);
if (strcmp (string, DEC_Condition_PA) == 0)
return decContextSetStatus (context, DEC_Clamped);
if (strcmp (string, DEC_Condition_RO) == 0)
return decContextSetStatus (context, DEC_Rounded);
if (strcmp (string, DEC_Condition_SU) == 0)
return decContextSetStatus (context, DEC_Subnormal);
if (strcmp (string, DEC_Condition_UN) == 0)
return decContextSetStatus (context, DEC_Underflow);
if (strcmp (string, DEC_Condition_ZE) == 0)
return context;
return NULL; /* Multiple status, or unknown */
} /* decContextSetStatusFromString */
/* ------------------------------------------------------------------ */
/* decContextSetStatus -- set status and raise trap if appropriate */
/* */
/* context is the controlling context */
/* status is the DEC_ exception code */
/* returns the context structure */
/* */
/* Control may never return from this routine, if there is a signal */
/* handler and it takes a long jump. */
/* ------------------------------------------------------------------ */
decContext *
decContextSetStatus (decContext * context, uInt status)
{
context->status |= status;
if (status & context->traps)
raise (SIGFPE);
return context;
} /* decContextSetStatus */

View File

@ -0,0 +1,187 @@
/* Decimal Context module header for the decNumber C Library
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
Contributed by IBM Corporation. Author Mike Cowlishaw.
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License,
the Free Software Foundation gives you unlimited permission to link
the compiled version of this file into combinations with other
programs, and to distribute those combinations without any
restriction coming from the use of this file. (The General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into a combine executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
/* ------------------------------------------------------------------ */
/* */
/* Context must always be set correctly: */
/* */
/* digits -- must be in the range 1 through 999999999 */
/* emax -- must be in the range 0 through 999999999 */
/* emin -- must be in the range 0 through -999999999 */
/* round -- must be one of the enumerated rounding modes */
/* traps -- only defined bits may be set */
/* status -- [any bits may be cleared, but not set, by user] */
/* clamp -- must be either 0 or 1 */
/* extended -- must be either 0 or 1 [present only if DECSUBSET] */
/* */
/* ------------------------------------------------------------------ */
#if !defined(DECCONTEXT)
#define DECCONTEXT
#define DECCNAME "decContext" /* Short name */
#define DECCFULLNAME "Decimal Context Descriptor" /* Verbose name */
#define DECCAUTHOR "Mike Cowlishaw" /* Who to blame */
#include "gstdint.h" /* C99 standard integers */
#include <signal.h> /* for traps */
/* Conditional code flag -- set this to 0 for best performance */
#define DECSUBSET 0 /* 1 to enable subset arithmetic */
/* Context for operations, with associated constants */
enum rounding
{
DEC_ROUND_CEILING, /* round towards +infinity */
DEC_ROUND_UP, /* round away from 0 */
DEC_ROUND_HALF_UP, /* 0.5 rounds up */
DEC_ROUND_HALF_EVEN, /* 0.5 rounds to nearest even */
DEC_ROUND_HALF_DOWN, /* 0.5 rounds down */
DEC_ROUND_DOWN, /* round towards 0 (truncate) */
DEC_ROUND_FLOOR, /* round towards -infinity */
DEC_ROUND_MAX /* enum must be less than this */
};
typedef struct
{
int32_t digits; /* working precision */
int32_t emax; /* maximum positive exponent */
int32_t emin; /* minimum negative exponent */
enum rounding round; /* rounding mode */
uint32_t traps; /* trap-enabler flags */
uint32_t status; /* status flags */
uint8_t clamp; /* flag: apply IEEE exponent clamp */
#if DECSUBSET
uint8_t extended; /* flag: special-values allowed */
#endif
} decContext;
/* Maxima and Minima */
#define DEC_MAX_DIGITS 999999999
#define DEC_MIN_DIGITS 1
#define DEC_MAX_EMAX 999999999
#define DEC_MIN_EMAX 0
#define DEC_MAX_EMIN 0
#define DEC_MIN_EMIN -999999999
/* Trap-enabler and Status flags (exceptional conditions), and their names */
/* Top byte is reserved for internal use */
#define DEC_Conversion_syntax 0x00000001
#define DEC_Division_by_zero 0x00000002
#define DEC_Division_impossible 0x00000004
#define DEC_Division_undefined 0x00000008
#define DEC_Insufficient_storage 0x00000010 /* [used if malloc fails] */
#define DEC_Inexact 0x00000020
#define DEC_Invalid_context 0x00000040
#define DEC_Invalid_operation 0x00000080
#if DECSUBSET
#define DEC_Lost_digits 0x00000100
#endif
#define DEC_Overflow 0x00000200
#define DEC_Clamped 0x00000400
#define DEC_Rounded 0x00000800
#define DEC_Subnormal 0x00001000
#define DEC_Underflow 0x00002000
/* IEEE 854 groupings for the flags */
/* [DEC_Clamped, DEC_Lost_digits, DEC_Rounded, and DEC_Subnormal are */
/* not in IEEE 854] */
#define DEC_IEEE_854_Division_by_zero (DEC_Division_by_zero)
#if DECSUBSET
#define DEC_IEEE_854_Inexact (DEC_Inexact | DEC_Lost_digits)
#else
#define DEC_IEEE_854_Inexact (DEC_Inexact)
#endif
#define DEC_IEEE_854_Invalid_operation (DEC_Conversion_syntax | \
DEC_Division_impossible | \
DEC_Division_undefined | \
DEC_Insufficient_storage | \
DEC_Invalid_context | \
DEC_Invalid_operation)
#define DEC_IEEE_854_Overflow (DEC_Overflow)
#define DEC_IEEE_854_Underflow (DEC_Underflow)
/* flags which are normally errors (results are qNaN, infinite, or 0) */
#define DEC_Errors (DEC_IEEE_854_Division_by_zero | \
DEC_IEEE_854_Invalid_operation | \
DEC_IEEE_854_Overflow | DEC_IEEE_854_Underflow)
/* flags which cause a result to become qNaN */
#define DEC_NaNs DEC_IEEE_854_Invalid_operation
/* flags which are normally for information only (have finite results) */
#if DECSUBSET
#define DEC_Information (DEC_Clamped | DEC_Rounded | DEC_Inexact \
| DEC_Lost_digits)
#else
#define DEC_Information (DEC_Clamped | DEC_Rounded | DEC_Inexact)
#endif
/* name strings for the exceptional conditions */
#define DEC_Condition_CS "Conversion syntax"
#define DEC_Condition_DZ "Division by zero"
#define DEC_Condition_DI "Division impossible"
#define DEC_Condition_DU "Division undefined"
#define DEC_Condition_IE "Inexact"
#define DEC_Condition_IS "Insufficient storage"
#define DEC_Condition_IC "Invalid context"
#define DEC_Condition_IO "Invalid operation"
#if DECSUBSET
#define DEC_Condition_LD "Lost digits"
#endif
#define DEC_Condition_OV "Overflow"
#define DEC_Condition_PA "Clamped"
#define DEC_Condition_RO "Rounded"
#define DEC_Condition_SU "Subnormal"
#define DEC_Condition_UN "Underflow"
#define DEC_Condition_ZE "No status"
#define DEC_Condition_MU "Multiple status"
#define DEC_Condition_Length 21 /* length of the longest string, */
/* including terminator */
/* Initialization descriptors, used by decContextDefault */
#define DEC_INIT_BASE 0
#define DEC_INIT_DECIMAL32 32
#define DEC_INIT_DECIMAL64 64
#define DEC_INIT_DECIMAL128 128
/* decContext routines */
#ifdef IN_LIBGCC2
#define decContextDefault __decContextDefault
#define decContextSetStatus __decContextSetStatus
#define decContextStatusToString __decContextStatusToString
#define decContextSetStatusFromString __decContextSetStatusFromString
#endif
decContext *decContextDefault (decContext *, int32_t);
decContext *decContextSetStatus (decContext *, uint32_t);
const char *decContextStatusToString (const decContext *);
decContext *decContextSetStatusFromString (decContext *, const char *);
#endif

View File

@ -0,0 +1,534 @@
/* Binary Coded Decimal <--> Densely Packed Decimal lookup tables.
Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by IBM Corporation. Author Mike Cowlishaw.
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License,
the Free Software Foundation gives you unlimited permission to link
the compiled version of this file into combinations with other
programs, and to distribute those combinations without any
restriction coming from the use of this file. (The General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into a combine executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
/* ------------------------------------------------------------------------ */
/* For details, see: http://www2.hursley.ibm.com/decimal/DPDecimal.html */
/* */
/* This include file defines conversion tables for DPD, as follows. */
/* */
/* uint16_t BCD2DPD[2458]; // BCD -> DPD (0x999 => 2457) */
/* uint16_t DPD2BCD[1024]; // DPD -> BCD (0x3FF => 0x999) */
/* uint16_t BIN2DPD[1000]; // BIN -> DPD (999 => 2457) */
/* uint16_t DPD2BIN[1024]; // DPD -> BIN (0x3FF => 999) */
/* */
/* In all cases the result (10 bits or 12 bits, or binary) is right-aligned */
/* in the table entry. */
/* */
/* To use a table, its name, prefixed with DEC_, must be defined with a */
/* value of 1 before this header file is included. For example: */
/* #define DEC_BCD2DPD 1 */
/* ------------------------------------------------------------------------ */
#if DEC_BCD2DPD==1
const uint16_t BCD2DPD[2458] = { 0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 0, 0, 0, 0, 0, 0, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 0, 0, 0, 0, 0, 0, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 0, 0, 0, 0, 0,
0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 0, 0,
0, 0, 0, 0, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 0, 0, 0, 0, 0, 0, 80, 81, 82, 83, 84, 85,
86, 87, 88, 89, 0, 0, 0, 0, 0, 0, 96, 97, 98,
99, 100, 101, 102, 103, 104, 105, 0, 0, 0, 0, 0, 0,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 0, 0, 0,
0, 0, 0, 10, 11, 42, 43, 74, 75, 106, 107, 78, 79,
0, 0, 0, 0, 0, 0, 26, 27, 58, 59, 90, 91, 122,
123, 94, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 42, 43, 74,
75, 106, 107, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 0, 0,
0, 0, 0, 0, 144, 145, 146, 147, 148, 149, 150, 151, 152,
153, 0, 0, 0, 0, 0, 0, 160, 161, 162, 163, 164, 165,
166, 167, 168, 169, 0, 0, 0, 0, 0, 0, 176, 177, 178,
179, 180, 181, 182, 183, 184, 185, 0, 0, 0, 0, 0, 0,
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 0, 0, 0,
0, 0, 0, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
0, 0, 0, 0, 0, 0, 224, 225, 226, 227, 228, 229, 230,
231, 232, 233, 0, 0, 0, 0, 0, 0, 240, 241, 242, 243,
244, 245, 246, 247, 248, 249, 0, 0, 0, 0, 0, 0, 138,
139, 170, 171, 202, 203, 234, 235, 206, 207, 0, 0, 0, 0,
0, 0, 154, 155, 186, 187, 218, 219, 250, 251, 222, 223, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 138, 139, 170, 171, 202, 203, 234, 235, 206,
207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 256, 257, 258,
259, 260, 261, 262, 263, 264, 265, 0, 0, 0, 0, 0, 0,
272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 0, 0, 0,
0, 0, 0, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297,
0, 0, 0, 0, 0, 0, 304, 305, 306, 307, 308, 309, 310,
311, 312, 313, 0, 0, 0, 0, 0, 0, 320, 321, 322, 323,
324, 325, 326, 327, 328, 329, 0, 0, 0, 0, 0, 0, 336,
337, 338, 339, 340, 341, 342, 343, 344, 345, 0, 0, 0, 0,
0, 0, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 0,
0, 0, 0, 0, 0, 368, 369, 370, 371, 372, 373, 374, 375,
376, 377, 0, 0, 0, 0, 0, 0, 266, 267, 298, 299, 330,
331, 362, 363, 334, 335, 0, 0, 0, 0, 0, 0, 282, 283,
314, 315, 346, 347, 378, 379, 350, 351, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
266, 267, 298, 299, 330, 331, 362, 363, 334, 335, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 384, 385, 386, 387, 388, 389, 390,
391, 392, 393, 0, 0, 0, 0, 0, 0, 400, 401, 402, 403,
404, 405, 406, 407, 408, 409, 0, 0, 0, 0, 0, 0, 416,
417, 418, 419, 420, 421, 422, 423, 424, 425, 0, 0, 0, 0,
0, 0, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 0,
0, 0, 0, 0, 0, 448, 449, 450, 451, 452, 453, 454, 455,
456, 457, 0, 0, 0, 0, 0, 0, 464, 465, 466, 467, 468,
469, 470, 471, 472, 473, 0, 0, 0, 0, 0, 0, 480, 481,
482, 483, 484, 485, 486, 487, 488, 489, 0, 0, 0, 0, 0,
0, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 0, 0,
0, 0, 0, 0, 394, 395, 426, 427, 458, 459, 490, 491, 462,
463, 0, 0, 0, 0, 0, 0, 410, 411, 442, 443, 474, 475,
506, 507, 478, 479, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 394, 395, 426, 427,
458, 459, 490, 491, 462, 463, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 0,
0, 0, 0, 0, 0, 528, 529, 530, 531, 532, 533, 534, 535,
536, 537, 0, 0, 0, 0, 0, 0, 544, 545, 546, 547, 548,
549, 550, 551, 552, 553, 0, 0, 0, 0, 0, 0, 560, 561,
562, 563, 564, 565, 566, 567, 568, 569, 0, 0, 0, 0, 0,
0, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 0, 0,
0, 0, 0, 0, 592, 593, 594, 595, 596, 597, 598, 599, 600,
601, 0, 0, 0, 0, 0, 0, 608, 609, 610, 611, 612, 613,
614, 615, 616, 617, 0, 0, 0, 0, 0, 0, 624, 625, 626,
627, 628, 629, 630, 631, 632, 633, 0, 0, 0, 0, 0, 0,
522, 523, 554, 555, 586, 587, 618, 619, 590, 591, 0, 0, 0,
0, 0, 0, 538, 539, 570, 571, 602, 603, 634, 635, 606, 607,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 522, 523, 554, 555, 586, 587, 618, 619,
590, 591, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 640, 641,
642, 643, 644, 645, 646, 647, 648, 649, 0, 0, 0, 0, 0,
0, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 0, 0,
0, 0, 0, 0, 672, 673, 674, 675, 676, 677, 678, 679, 680,
681, 0, 0, 0, 0, 0, 0, 688, 689, 690, 691, 692, 693,
694, 695, 696, 697, 0, 0, 0, 0, 0, 0, 704, 705, 706,
707, 708, 709, 710, 711, 712, 713, 0, 0, 0, 0, 0, 0,
720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 0, 0, 0,
0, 0, 0, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745,
0, 0, 0, 0, 0, 0, 752, 753, 754, 755, 756, 757, 758,
759, 760, 761, 0, 0, 0, 0, 0, 0, 650, 651, 682, 683,
714, 715, 746, 747, 718, 719, 0, 0, 0, 0, 0, 0, 666,
667, 698, 699, 730, 731, 762, 763, 734, 735, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 650, 651, 682, 683, 714, 715, 746, 747, 718, 719, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 768, 769, 770, 771, 772, 773,
774, 775, 776, 777, 0, 0, 0, 0, 0, 0, 784, 785, 786,
787, 788, 789, 790, 791, 792, 793, 0, 0, 0, 0, 0, 0,
800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 0, 0, 0,
0, 0, 0, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825,
0, 0, 0, 0, 0, 0, 832, 833, 834, 835, 836, 837, 838,
839, 840, 841, 0, 0, 0, 0, 0, 0, 848, 849, 850, 851,
852, 853, 854, 855, 856, 857, 0, 0, 0, 0, 0, 0, 864,
865, 866, 867, 868, 869, 870, 871, 872, 873, 0, 0, 0, 0,
0, 0, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 0,
0, 0, 0, 0, 0, 778, 779, 810, 811, 842, 843, 874, 875,
846, 847, 0, 0, 0, 0, 0, 0, 794, 795, 826, 827, 858,
859, 890, 891, 862, 863, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 778, 779, 810,
811, 842, 843, 874, 875, 846, 847, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905,
0, 0, 0, 0, 0, 0, 912, 913, 914, 915, 916, 917, 918,
919, 920, 921, 0, 0, 0, 0, 0, 0, 928, 929, 930, 931,
932, 933, 934, 935, 936, 937, 0, 0, 0, 0, 0, 0, 944,
945, 946, 947, 948, 949, 950, 951, 952, 953, 0, 0, 0, 0,
0, 0, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 0,
0, 0, 0, 0, 0, 976, 977, 978, 979, 980, 981, 982, 983,
984, 985, 0, 0, 0, 0, 0, 0, 992, 993, 994, 995, 996,
997, 998, 999, 1000, 1001, 0, 0, 0, 0, 0, 0, 1008, 1009,
1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 0, 0, 0, 0, 0,
0, 906, 907, 938, 939, 970, 971, 1002, 1003, 974, 975, 0, 0,
0, 0, 0, 0, 922, 923, 954, 955, 986, 987, 1018, 1019, 990,
991, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 906, 907, 938, 939, 970, 971, 1002,
1003, 974, 975, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12,
13, 268, 269, 524, 525, 780, 781, 46, 47, 0, 0, 0, 0,
0, 0, 28, 29, 284, 285, 540, 541, 796, 797, 62, 63, 0,
0, 0, 0, 0, 0, 44, 45, 300, 301, 556, 557, 812, 813,
302, 303, 0, 0, 0, 0, 0, 0, 60, 61, 316, 317, 572,
573, 828, 829, 318, 319, 0, 0, 0, 0, 0, 0, 76, 77,
332, 333, 588, 589, 844, 845, 558, 559, 0, 0, 0, 0, 0,
0, 92, 93, 348, 349, 604, 605, 860, 861, 574, 575, 0, 0,
0, 0, 0, 0, 108, 109, 364, 365, 620, 621, 876, 877, 814,
815, 0, 0, 0, 0, 0, 0, 124, 125, 380, 381, 636, 637,
892, 893, 830, 831, 0, 0, 0, 0, 0, 0, 14, 15, 270,
271, 526, 527, 782, 783, 110, 111, 0, 0, 0, 0, 0, 0,
30, 31, 286, 287, 542, 543, 798, 799, 126, 127, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 14, 15, 270, 271, 526, 527, 782, 783, 110, 111, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 140, 141, 396, 397, 652,
653, 908, 909, 174, 175, 0, 0, 0, 0, 0, 0, 156, 157,
412, 413, 668, 669, 924, 925, 190, 191, 0, 0, 0, 0, 0,
0, 172, 173, 428, 429, 684, 685, 940, 941, 430, 431, 0, 0,
0, 0, 0, 0, 188, 189, 444, 445, 700, 701, 956, 957, 446,
447, 0, 0, 0, 0, 0, 0, 204, 205, 460, 461, 716, 717,
972, 973, 686, 687, 0, 0, 0, 0, 0, 0, 220, 221, 476,
477, 732, 733, 988, 989, 702, 703, 0, 0, 0, 0, 0, 0,
236, 237, 492, 493, 748, 749, 1004, 1005, 942, 943, 0, 0, 0,
0, 0, 0, 252, 253, 508, 509, 764, 765, 1020, 1021, 958, 959,
0, 0, 0, 0, 0, 0, 142, 143, 398, 399, 654, 655, 910,
911, 238, 239, 0, 0, 0, 0, 0, 0, 158, 159, 414, 415,
670, 671, 926, 927, 254, 255
};
#endif
#if DEC_DPD2BCD==1
const uint16_t DPD2BCD[1024] = { 0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 128, 129, 2048, 2049, 2176, 2177, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 144, 145, 2064, 2065, 2192, 2193, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 130, 131, 2080, 2081, 2056,
2057, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 146, 147,
2096, 2097, 2072, 2073, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 132, 133, 2112, 2113, 136, 137, 80, 81, 82, 83, 84, 85,
86, 87, 88, 89, 148, 149, 2128, 2129, 152, 153, 96, 97, 98,
99, 100, 101, 102, 103, 104, 105, 134, 135, 2144, 2145, 2184, 2185,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 150, 151, 2160,
2161, 2200, 2201, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
384, 385, 2304, 2305, 2432, 2433, 272, 273, 274, 275, 276, 277, 278,
279, 280, 281, 400, 401, 2320, 2321, 2448, 2449, 288, 289, 290, 291,
292, 293, 294, 295, 296, 297, 386, 387, 2336, 2337, 2312, 2313, 304,
305, 306, 307, 308, 309, 310, 311, 312, 313, 402, 403, 2352, 2353,
2328, 2329, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 388,
389, 2368, 2369, 392, 393, 336, 337, 338, 339, 340, 341, 342, 343,
344, 345, 404, 405, 2384, 2385, 408, 409, 352, 353, 354, 355, 356,
357, 358, 359, 360, 361, 390, 391, 2400, 2401, 2440, 2441, 368, 369,
370, 371, 372, 373, 374, 375, 376, 377, 406, 407, 2416, 2417, 2456,
2457, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 640, 641,
2050, 2051, 2178, 2179, 528, 529, 530, 531, 532, 533, 534, 535, 536,
537, 656, 657, 2066, 2067, 2194, 2195, 544, 545, 546, 547, 548, 549,
550, 551, 552, 553, 642, 643, 2082, 2083, 2088, 2089, 560, 561, 562,
563, 564, 565, 566, 567, 568, 569, 658, 659, 2098, 2099, 2104, 2105,
576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 644, 645, 2114,
2115, 648, 649, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601,
660, 661, 2130, 2131, 664, 665, 608, 609, 610, 611, 612, 613, 614,
615, 616, 617, 646, 647, 2146, 2147, 2184, 2185, 624, 625, 626, 627,
628, 629, 630, 631, 632, 633, 662, 663, 2162, 2163, 2200, 2201, 768,
769, 770, 771, 772, 773, 774, 775, 776, 777, 896, 897, 2306, 2307,
2434, 2435, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 912,
913, 2322, 2323, 2450, 2451, 800, 801, 802, 803, 804, 805, 806, 807,
808, 809, 898, 899, 2338, 2339, 2344, 2345, 816, 817, 818, 819, 820,
821, 822, 823, 824, 825, 914, 915, 2354, 2355, 2360, 2361, 832, 833,
834, 835, 836, 837, 838, 839, 840, 841, 900, 901, 2370, 2371, 904,
905, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 916, 917,
2386, 2387, 920, 921, 864, 865, 866, 867, 868, 869, 870, 871, 872,
873, 902, 903, 2402, 2403, 2440, 2441, 880, 881, 882, 883, 884, 885,
886, 887, 888, 889, 918, 919, 2418, 2419, 2456, 2457, 1024, 1025, 1026,
1027, 1028, 1029, 1030, 1031, 1032, 1033, 1152, 1153, 2052, 2053, 2180,
2181,
1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1168, 1169,
2068,
2069, 2196, 2197, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064,
1065,
1154, 1155, 2084, 2085, 2120, 2121, 1072, 1073, 1074, 1075, 1076, 1077,
1078,
1079, 1080, 1081, 1170, 1171, 2100, 2101, 2136, 2137, 1088, 1089, 1090,
1091,
1092, 1093, 1094, 1095, 1096, 1097, 1156, 1157, 2116, 2117, 1160, 1161,
1104,
1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1172, 1173, 2132,
2133,
1176, 1177, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129,
1158,
1159, 2148, 2149, 2184, 2185, 1136, 1137, 1138, 1139, 1140, 1141, 1142,
1143,
1144, 1145, 1174, 1175, 2164, 2165, 2200, 2201, 1280, 1281, 1282, 1283,
1284,
1285, 1286, 1287, 1288, 1289, 1408, 1409, 2308, 2309, 2436, 2437, 1296,
1297,
1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1424, 1425, 2324, 2325,
2452,
2453, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1410,
1411,
2340, 2341, 2376, 2377, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335,
1336,
1337, 1426, 1427, 2356, 2357, 2392, 2393, 1344, 1345, 1346, 1347, 1348,
1349,
1350, 1351, 1352, 1353, 1412, 1413, 2372, 2373, 1416, 1417, 1360, 1361,
1362,
1363, 1364, 1365, 1366, 1367, 1368, 1369, 1428, 1429, 2388, 2389, 1432,
1433,
1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1414, 1415,
2404,
2405, 2440, 2441, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400,
1401,
1430, 1431, 2420, 2421, 2456, 2457, 1536, 1537, 1538, 1539, 1540, 1541,
1542,
1543, 1544, 1545, 1664, 1665, 2054, 2055, 2182, 2183, 1552, 1553, 1554,
1555,
1556, 1557, 1558, 1559, 1560, 1561, 1680, 1681, 2070, 2071, 2198, 2199,
1568,
1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1666, 1667, 2086,
2087,
2152, 2153, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593,
1682,
1683, 2102, 2103, 2168, 2169, 1600, 1601, 1602, 1603, 1604, 1605, 1606,
1607,
1608, 1609, 1668, 1669, 2118, 2119, 1672, 1673, 1616, 1617, 1618, 1619,
1620,
1621, 1622, 1623, 1624, 1625, 1684, 1685, 2134, 2135, 1688, 1689, 1632,
1633,
1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1670, 1671, 2150, 2151,
2184,
2185, 1648, 1649, 1650, 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1686,
1687,
2166, 2167, 2200, 2201, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799,
1800,
1801, 1920, 1921, 2310, 2311, 2438, 2439, 1808, 1809, 1810, 1811, 1812,
1813,
1814, 1815, 1816, 1817, 1936, 1937, 2326, 2327, 2454, 2455, 1824, 1825,
1826,
1827, 1828, 1829, 1830, 1831, 1832, 1833, 1922, 1923, 2342, 2343, 2408,
2409,
1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1938, 1939,
2358,
2359, 2424, 2425, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864,
1865,
1924, 1925, 2374, 2375, 1928, 1929, 1872, 1873, 1874, 1875, 1876, 1877,
1878,
1879, 1880, 1881, 1940, 1941, 2390, 2391, 1944, 1945, 1888, 1889, 1890,
1891,
1892, 1893, 1894, 1895, 1896, 1897, 1926, 1927, 2406, 2407, 2440, 2441,
1904,
1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1942, 1943, 2422,
2423,
2456, 2457
};
#endif
#if DEC_BIN2DPD==1
const uint16_t BIN2DPD[1000] = { 0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 32,
33, 34, 35, 36, 37, 38, 39, 40, 41, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 70,
71, 72, 73, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 112, 113, 114,
115, 116, 117, 118, 119, 120, 121, 10, 11, 42, 43, 74, 75,
106, 107, 78, 79, 26, 27, 58, 59, 90, 91, 122, 123, 94,
95, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 144, 145,
146, 147, 148, 149, 150, 151, 152, 153, 160, 161, 162, 163, 164,
165, 166, 167, 168, 169, 176, 177, 178, 179, 180, 181, 182, 183,
184, 185, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 208,
209, 210, 211, 212, 213, 214, 215, 216, 217, 224, 225, 226, 227,
228, 229, 230, 231, 232, 233, 240, 241, 242, 243, 244, 245, 246,
247, 248, 249, 138, 139, 170, 171, 202, 203, 234, 235, 206, 207,
154, 155, 186, 187, 218, 219, 250, 251, 222, 223, 256, 257, 258,
259, 260, 261, 262, 263, 264, 265, 272, 273, 274, 275, 276, 277,
278, 279, 280, 281, 288, 289, 290, 291, 292, 293, 294, 295, 296,
297, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 320, 321,
322, 323, 324, 325, 326, 327, 328, 329, 336, 337, 338, 339, 340,
341, 342, 343, 344, 345, 352, 353, 354, 355, 356, 357, 358, 359,
360, 361, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 266,
267, 298, 299, 330, 331, 362, 363, 334, 335, 282, 283, 314, 315,
346, 347, 378, 379, 350, 351, 384, 385, 386, 387, 388, 389, 390,
391, 392, 393, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409,
416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 432, 433, 434,
435, 436, 437, 438, 439, 440, 441, 448, 449, 450, 451, 452, 453,
454, 455, 456, 457, 464, 465, 466, 467, 468, 469, 470, 471, 472,
473, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 496, 497,
498, 499, 500, 501, 502, 503, 504, 505, 394, 395, 426, 427, 458,
459, 490, 491, 462, 463, 410, 411, 442, 443, 474, 475, 506, 507,
478, 479, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 528,
529, 530, 531, 532, 533, 534, 535, 536, 537, 544, 545, 546, 547,
548, 549, 550, 551, 552, 553, 560, 561, 562, 563, 564, 565, 566,
567, 568, 569, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585,
592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 608, 609, 610,
611, 612, 613, 614, 615, 616, 617, 624, 625, 626, 627, 628, 629,
630, 631, 632, 633, 522, 523, 554, 555, 586, 587, 618, 619, 590,
591, 538, 539, 570, 571, 602, 603, 634, 635, 606, 607, 640, 641,
642, 643, 644, 645, 646, 647, 648, 649, 656, 657, 658, 659, 660,
661, 662, 663, 664, 665, 672, 673, 674, 675, 676, 677, 678, 679,
680, 681, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 704,
705, 706, 707, 708, 709, 710, 711, 712, 713, 720, 721, 722, 723,
724, 725, 726, 727, 728, 729, 736, 737, 738, 739, 740, 741, 742,
743, 744, 745, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761,
650, 651, 682, 683, 714, 715, 746, 747, 718, 719, 666, 667, 698,
699, 730, 731, 762, 763, 734, 735, 768, 769, 770, 771, 772, 773,
774, 775, 776, 777, 784, 785, 786, 787, 788, 789, 790, 791, 792,
793, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 816, 817,
818, 819, 820, 821, 822, 823, 824, 825, 832, 833, 834, 835, 836,
837, 838, 839, 840, 841, 848, 849, 850, 851, 852, 853, 854, 855,
856, 857, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 880,
881, 882, 883, 884, 885, 886, 887, 888, 889, 778, 779, 810, 811,
842, 843, 874, 875, 846, 847, 794, 795, 826, 827, 858, 859, 890,
891, 862, 863, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905,
912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 928, 929, 930,
931, 932, 933, 934, 935, 936, 937, 944, 945, 946, 947, 948, 949,
950, 951, 952, 953, 960, 961, 962, 963, 964, 965, 966, 967, 968,
969, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 992, 993,
994, 995, 996, 997, 998, 999, 1000, 1001, 1008, 1009, 1010, 1011, 1012,
1013, 1014, 1015, 1016, 1017, 906, 907, 938, 939, 970, 971, 1002, 1003,
974, 975, 922, 923, 954, 955, 986, 987, 1018, 1019, 990, 991, 12,
13, 268, 269, 524, 525, 780, 781, 46, 47, 28, 29, 284, 285,
540, 541, 796, 797, 62, 63, 44, 45, 300, 301, 556, 557, 812,
813, 302, 303, 60, 61, 316, 317, 572, 573, 828, 829, 318, 319,
76, 77, 332, 333, 588, 589, 844, 845, 558, 559, 92, 93, 348,
349, 604, 605, 860, 861, 574, 575, 108, 109, 364, 365, 620, 621,
876, 877, 814, 815, 124, 125, 380, 381, 636, 637, 892, 893, 830,
831, 14, 15, 270, 271, 526, 527, 782, 783, 110, 111, 30, 31,
286, 287, 542, 543, 798, 799, 126, 127, 140, 141, 396, 397, 652,
653, 908, 909, 174, 175, 156, 157, 412, 413, 668, 669, 924, 925,
190, 191, 172, 173, 428, 429, 684, 685, 940, 941, 430, 431, 188,
189, 444, 445, 700, 701, 956, 957, 446, 447, 204, 205, 460, 461,
716, 717, 972, 973, 686, 687, 220, 221, 476, 477, 732, 733, 988,
989, 702, 703, 236, 237, 492, 493, 748, 749, 1004, 1005, 942, 943,
252, 253, 508, 509, 764, 765, 1020, 1021, 958, 959, 142, 143, 398,
399, 654, 655, 910, 911, 238, 239, 158, 159, 414, 415, 670, 671,
926, 927, 254, 255
};
#endif
#if DEC_DPD2BIN==1
const uint16_t DPD2BIN[1024] = { 0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 80, 81, 800, 801, 880, 881, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 90, 91, 810, 811, 890, 891, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 82, 83, 820, 821, 808,
809, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 92, 93,
830, 831, 818, 819, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 84, 85, 840, 841, 88, 89, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 94, 95, 850, 851, 98, 99, 60, 61, 62,
63, 64, 65, 66, 67, 68, 69, 86, 87, 860, 861, 888, 889,
70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 96, 97, 870,
871, 898, 899, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
180, 181, 900, 901, 980, 981, 110, 111, 112, 113, 114, 115, 116,
117, 118, 119, 190, 191, 910, 911, 990, 991, 120, 121, 122, 123,
124, 125, 126, 127, 128, 129, 182, 183, 920, 921, 908, 909, 130,
131, 132, 133, 134, 135, 136, 137, 138, 139, 192, 193, 930, 931,
918, 919, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 184,
185, 940, 941, 188, 189, 150, 151, 152, 153, 154, 155, 156, 157,
158, 159, 194, 195, 950, 951, 198, 199, 160, 161, 162, 163, 164,
165, 166, 167, 168, 169, 186, 187, 960, 961, 988, 989, 170, 171,
172, 173, 174, 175, 176, 177, 178, 179, 196, 197, 970, 971, 998,
999, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 280, 281,
802, 803, 882, 883, 210, 211, 212, 213, 214, 215, 216, 217, 218,
219, 290, 291, 812, 813, 892, 893, 220, 221, 222, 223, 224, 225,
226, 227, 228, 229, 282, 283, 822, 823, 828, 829, 230, 231, 232,
233, 234, 235, 236, 237, 238, 239, 292, 293, 832, 833, 838, 839,
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 284, 285, 842,
843, 288, 289, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259,
294, 295, 852, 853, 298, 299, 260, 261, 262, 263, 264, 265, 266,
267, 268, 269, 286, 287, 862, 863, 888, 889, 270, 271, 272, 273,
274, 275, 276, 277, 278, 279, 296, 297, 872, 873, 898, 899, 300,
301, 302, 303, 304, 305, 306, 307, 308, 309, 380, 381, 902, 903,
982, 983, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 390,
391, 912, 913, 992, 993, 320, 321, 322, 323, 324, 325, 326, 327,
328, 329, 382, 383, 922, 923, 928, 929, 330, 331, 332, 333, 334,
335, 336, 337, 338, 339, 392, 393, 932, 933, 938, 939, 340, 341,
342, 343, 344, 345, 346, 347, 348, 349, 384, 385, 942, 943, 388,
389, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 394, 395,
952, 953, 398, 399, 360, 361, 362, 363, 364, 365, 366, 367, 368,
369, 386, 387, 962, 963, 988, 989, 370, 371, 372, 373, 374, 375,
376, 377, 378, 379, 396, 397, 972, 973, 998, 999, 400, 401, 402,
403, 404, 405, 406, 407, 408, 409, 480, 481, 804, 805, 884, 885,
410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 490, 491, 814,
815, 894, 895, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429,
482, 483, 824, 825, 848, 849, 430, 431, 432, 433, 434, 435, 436,
437, 438, 439, 492, 493, 834, 835, 858, 859, 440, 441, 442, 443,
444, 445, 446, 447, 448, 449, 484, 485, 844, 845, 488, 489, 450,
451, 452, 453, 454, 455, 456, 457, 458, 459, 494, 495, 854, 855,
498, 499, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 486,
487, 864, 865, 888, 889, 470, 471, 472, 473, 474, 475, 476, 477,
478, 479, 496, 497, 874, 875, 898, 899, 500, 501, 502, 503, 504,
505, 506, 507, 508, 509, 580, 581, 904, 905, 984, 985, 510, 511,
512, 513, 514, 515, 516, 517, 518, 519, 590, 591, 914, 915, 994,
995, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 582, 583,
924, 925, 948, 949, 530, 531, 532, 533, 534, 535, 536, 537, 538,
539, 592, 593, 934, 935, 958, 959, 540, 541, 542, 543, 544, 545,
546, 547, 548, 549, 584, 585, 944, 945, 588, 589, 550, 551, 552,
553, 554, 555, 556, 557, 558, 559, 594, 595, 954, 955, 598, 599,
560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 586, 587, 964,
965, 988, 989, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579,
596, 597, 974, 975, 998, 999, 600, 601, 602, 603, 604, 605, 606,
607, 608, 609, 680, 681, 806, 807, 886, 887, 610, 611, 612, 613,
614, 615, 616, 617, 618, 619, 690, 691, 816, 817, 896, 897, 620,
621, 622, 623, 624, 625, 626, 627, 628, 629, 682, 683, 826, 827,
868, 869, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 692,
693, 836, 837, 878, 879, 640, 641, 642, 643, 644, 645, 646, 647,
648, 649, 684, 685, 846, 847, 688, 689, 650, 651, 652, 653, 654,
655, 656, 657, 658, 659, 694, 695, 856, 857, 698, 699, 660, 661,
662, 663, 664, 665, 666, 667, 668, 669, 686, 687, 866, 867, 888,
889, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 696, 697,
876, 877, 898, 899, 700, 701, 702, 703, 704, 705, 706, 707, 708,
709, 780, 781, 906, 907, 986, 987, 710, 711, 712, 713, 714, 715,
716, 717, 718, 719, 790, 791, 916, 917, 996, 997, 720, 721, 722,
723, 724, 725, 726, 727, 728, 729, 782, 783, 926, 927, 968, 969,
730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 792, 793, 936,
937, 978, 979, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749,
784, 785, 946, 947, 788, 789, 750, 751, 752, 753, 754, 755, 756,
757, 758, 759, 794, 795, 956, 957, 798, 799, 760, 761, 762, 763,
764, 765, 766, 767, 768, 769, 786, 787, 966, 967, 988, 989, 770,
771, 772, 773, 774, 775, 776, 777, 778, 779, 796, 797, 976, 977,
998, 999
};
#endif

View File

@ -0,0 +1,110 @@
/* Temporary library support for decimal floating point.
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License,
the Free Software Foundation gives you unlimited permission to link
the compiled version of this file into combinations with other
programs, and to distribute those combinations without any
restriction coming from the use of this file. (The General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into a combine executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#include "config.h"
#include "decContext.h"
#include "decimal128.h"
#include "decimal64.h"
#include "decimal32.h"
void __host_to_ieee_32 (_Decimal32, decimal32 *);
void __host_to_ieee_64 (_Decimal64, decimal64 *);
void __host_to_ieee_128 (_Decimal128, decimal128 *);
extern int isinfd32 (_Decimal32);
extern int isinfd64 (_Decimal64);
extern int isinfd128 (_Decimal128);
extern void __dfp_enable_traps (void);
extern void __dfp_raise (int exception __attribute__ ((unused)));
int
isinfd32 (_Decimal32 arg)
{
decNumber dn;
decimal32 d32;
__host_to_ieee_32 (arg, &d32);
decimal32ToNumber (&d32, &dn);
return (decNumberIsInfinite (&dn));
}
int
isinfd64 (_Decimal64 arg)
{
decNumber dn;
decimal64 d64;
__host_to_ieee_64 (arg, &d64);
decimal64ToNumber (&d64, &dn);
return (decNumberIsInfinite (&dn));
}
int
isinfd128 (_Decimal128 arg)
{
decNumber dn;
decimal128 d128;
__host_to_ieee_128 (arg, &d128);
decimal128ToNumber (&d128, &dn);
return (decNumberIsInfinite (&dn));
}
int __dfp_traps;
void
__dfp_enable_traps (void)
{
__dfp_traps = 1;
}
void
__dfp_raise (int exception __attribute__ ((unused)))
{
raise (SIGFPE);
}
uint32_t
__dec_byte_swap (uint32_t in)
{
uint32_t out = 0;
unsigned char *p = (unsigned char *) &out;
union {
uint32_t i;
unsigned char b[4];
} u;
u.i = in;
p[0] = u.b[3];
p[1] = u.b[2];
p[2] = u.b[1];
p[3] = u.b[0];
return out;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,194 @@
/* Decimal Number module header for the decNumber C Library
Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by IBM Corporation. Author Mike Cowlishaw.
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License,
the Free Software Foundation gives you unlimited permission to link
the compiled version of this file into combinations with other
programs, and to distribute those combinations without any
restriction coming from the use of this file. (The General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into a combine executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#if !defined(DECNUMBER)
#define DECNUMBER
#define DECNAME "decNumber" /* Short name */
#define DECVERSION "decNumber 3.24" /* Version [16 max.] */
#define DECFULLNAME "Decimal Number Module" /* Verbose name */
#define DECAUTHOR "Mike Cowlishaw" /* Who to blame */
#if !defined(DECCONTEXT)
#include "decContext.h"
#endif
/* Bit settings for decNumber.bits */
#define DECNEG 0x80 /* Sign; 1=negative, 0=positive or zero */
#define DECINF 0x40 /* 1=Infinity */
#define DECNAN 0x20 /* 1=NaN */
#define DECSNAN 0x10 /* 1=sNaN */
/* The remaining bits are reserved; they must be 0 */
#define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value */
/* DECNUMDIGITS is the default number of digits we can hold in the */
/* structure. If undefined, 1 is assumed and it is assumed that the */
/* structure will be immediately followed by extra space (if */
/* required). DECNUMDIGITS is always >0. */
#if !defined(DECNUMDIGITS)
#define DECNUMDIGITS 1
#endif
/* Define the decNumber data structure. The size and shape of the */
/* units array in the structure is determined by the following */
/* constant. This must not be changed without recompiling the */
/* decNumber library modules. */
#define DECDPUN 4 /* Decimal Digits Per UNit [must be in */
/* range 1-9; power of 2 recommended]. */
/* The size (integer data type) of each unit is determined by the */
/* number of digits it will hold. */
#if DECDPUN<=2
#define decNumberUnit uint8_t
#elif DECDPUN<=4
#define decNumberUnit uint16_t
#else
#define decNumberUnit uint32_t
#endif
/* The number of decNumberUnits we need is ceiling of DECNUMDIGITS/DECDPUN */
#define DECNUMUNITS ((DECNUMDIGITS+DECDPUN-1)/DECDPUN)
/* The data structure... */
typedef struct
{
int32_t digits; /* Count of digits in the coefficient; >0 */
int32_t exponent; /* Unadjusted exponent, unbiased, in */
/* range: -1999999997 through 999999999 */
uint8_t bits; /* Indicator bits (see above) */
decNumberUnit lsu[DECNUMUNITS]; /* Coefficient, from least significant unit */
} decNumber;
/* Notes: */
/* 1. If digits is > DECDPUN then there will be more than one */
/* decNumberUnits immediately following the first element of lsu. */
/* These contain the remaining (more significant) digits of the */
/* number, and may be in the lsu array, or may be guaranteed by */
/* some other mechanism (such as being contained in another */
/* structure, or being overlaid on dynamically allocated storage). */
/* */
/* Each integer of the coefficient (except the possibly the last) */
/* contains DECDPUN digits (e.g., a value in the range 0 through */
/* 99999999 if DECDPUN is 8, or 0 through 9999 if DECDPUN is 4). */
/* */
/* 2. A decNumber converted to a string may need up to digits+14 */
/* characters. The worst cases (non-exponential and exponential */
/* formats) are: -0.00000{9...}# */
/* and: -9.{9...}E+999999999# (where # is '\0') */
/* ------------------------------------------------------------------ */
/* decNumber public functions and macros */
/* ------------------------------------------------------------------ */
#ifdef IN_LIBGCC2
#define decNumberFromString __decNumberFromString
#define decNumberToString __decNumberToString
#define decNumberToEngString __decNumberToEngString
#define decNumberAbs __decNumberAbs
#define decNumberAdd __decNumberAdd
#define decNumberCompare __decNumberCompare
#define decNumberDivide __decNumberDivide
#define decNumberDivideInteger __decNumberDivideInteger
#define decNumberMax __decNumberMax
#define decNumberMin __decNumberMin
#define decNumberMinus __decNumberMinus
#define decNumberMultiply __decNumberMultiply
#define decNumberNormalize __decNumberNormalize
#define decNumberPlus __decNumberPlus
#define decNumberPower __decNumberPower
#define decNumberQuantize __decNumberQuantize
#define decNumberRemainder __decNumberRemainder
#define decNumberRemainderNear __decNumberRemainderNear
#define decNumberRescale __decNumberRescale
#define decNumberSameQuantum __decNumberSameQuantum
#define decNumberSquareRoot __decNumberSquareRoot
#define decNumberSubtract __decNumberSubtract
#define decNumberToIntegralValue __decNumberToIntegralValue
#define decNumberCopy __decNumberCopy
#define decNumberTrim __decNumberTrim
#define decNumberVersion __decNumberVersion
#define decNumberZero __decNumberZero
#endif
/* Conversions */
decNumber *decNumberFromString (decNumber *, const char *, decContext *);
char *decNumberToString (const decNumber *, char *);
char *decNumberToEngString (const decNumber *, char *);
/* Operators */
decNumber *decNumberAbs (decNumber *, const decNumber *, decContext *);
decNumber *decNumberAdd (decNumber *, const decNumber *,
const decNumber *, decContext *);
decNumber *decNumberCompare (decNumber *, const decNumber *,
const decNumber *, decContext *);
decNumber *decNumberDivide (decNumber *, const decNumber *,
const decNumber *, decContext *);
decNumber *decNumberDivideInteger (decNumber *, const decNumber *,
const decNumber *, decContext *);
decNumber *decNumberMax (decNumber *, const decNumber *,
const decNumber *, decContext *);
decNumber *decNumberMin (decNumber *, const decNumber *,
const decNumber *, decContext *);
decNumber *decNumberMinus (decNumber *, const decNumber *, decContext *);
decNumber *decNumberMultiply (decNumber *, const decNumber *,
const decNumber *, decContext *);
decNumber *decNumberNormalize (decNumber *, const decNumber *, decContext *);
decNumber *decNumberPlus (decNumber *, const decNumber *, decContext *);
decNumber *decNumberPower (decNumber *, const decNumber *,
const decNumber *, decContext *);
decNumber *decNumberQuantize (decNumber *, const decNumber *,
const decNumber *, decContext *);
decNumber *decNumberRemainder (decNumber *, const decNumber *,
const decNumber *, decContext *);
decNumber *decNumberRemainderNear (decNumber *, const decNumber *,
const decNumber *, decContext *);
decNumber *decNumberRescale (decNumber *, const decNumber *,
const decNumber *, decContext *);
decNumber *decNumberSameQuantum (decNumber *, const decNumber *, const decNumber *);
decNumber *decNumberSquareRoot (decNumber *, const decNumber *, decContext *);
decNumber *decNumberSubtract (decNumber *, const decNumber *,
const decNumber *, decContext *);
decNumber *decNumberToIntegralValue (decNumber *, const decNumber *, decContext *);
/* Utilities */
decNumber *decNumberCopy (decNumber *, const decNumber *);
decNumber *decNumberTrim (decNumber *);
const char *decNumberVersion (void);
decNumber *decNumberZero (decNumber *);
/* Macros */
#define decNumberIsZero(dn) (*(dn)->lsu==0 \
&& (dn)->digits==1 \
&& (((dn)->bits&DECSPECIAL)==0))
#define decNumberIsNegative(dn) (((dn)->bits&DECNEG)!=0)
#define decNumberIsNaN(dn) (((dn)->bits&(DECNAN|DECSNAN))!=0)
#define decNumberIsInfinite(dn) (((dn)->bits&DECINF)!=0)
#endif

View File

@ -0,0 +1,136 @@
/* decNumber package local type, tuning, and macro definitions.
Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by IBM Corporation. Author Mike Cowlishaw.
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License,
the Free Software Foundation gives you unlimited permission to link
the compiled version of this file into combinations with other
programs, and to distribute those combinations without any
restriction coming from the use of this file. (The General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into a combine executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
/* ------------------------------------------------------------------ */
/* This header file is included by all modules in the decNumber */
/* library, and contains local type definitions, tuning parameters, */
/* etc. It must only be included once, and should not need to be */
/* used by application programs. decNumber.h must be included first. */
/* ------------------------------------------------------------------ */
#if !defined(DECNUMBERLOC)
#define DECNUMBERLOC
#define DECNLAUTHOR "Mike Cowlishaw" /* Who to blame */
/* Local names for common types -- decNumber modules do not use int or
long directly */
#define Flag uint8_t
#define Byte int8_t
#define uByte uint8_t
#define Short int16_t
#define uShort uint16_t
#define Int int32_t
#define uInt uint32_t
#define Unit decNumberUnit
/* Tuning parameter */
#define DECBUFFER 36 /* Maximum size basis for local buffers. */
/* Should be a common maximum precision */
/* rounded up to a multiple of 4; must */
/* be non-negative. */
/* Conditional code flags -- set these to 0 for best performance */
#define DECCHECK 0 /* 1 to enable robust checking */
#define DECALLOC 0 /* 1 to enable memory allocation accounting */
#define DECTRACE 0 /* 1 to trace critical intermediates, etc. */
/* Development use defines */
#if DECALLOC
/* if these interfere with your C includes, just comment them out */
#define int ? /* enable to ensure we do not use plain C */
#define long ?? /* .. 'int' or 'long' types from here on */
#endif
/* Limits and constants */
#define DECNUMMAXP 999999999 /* maximum precision we can handle (9 digits) */
#define DECNUMMAXE 999999999 /* maximum adjusted exponent ditto (9 digits) */
#define DECNUMMINE -999999999 /* minimum adjusted exponent ditto (9 digits) */
#if (DECNUMMAXP != DEC_MAX_DIGITS)
#error Maximum digits mismatch
#endif
#if (DECNUMMAXE != DEC_MAX_EMAX)
#error Maximum exponent mismatch
#endif
#if (DECNUMMINE != DEC_MIN_EMIN)
#error Minimum exponent mismatch
#endif
/* Set DECDPUNMAX -- the maximum integer that fits in DECDPUN digits */
#if DECDPUN==1
#define DECDPUNMAX 9
#elif DECDPUN==2
#define DECDPUNMAX 99
#elif DECDPUN==3
#define DECDPUNMAX 999
#elif DECDPUN==4
#define DECDPUNMAX 9999
#elif DECDPUN==5
#define DECDPUNMAX 99999
#elif DECDPUN==6
#define DECDPUNMAX 999999
#elif DECDPUN==7
#define DECDPUNMAX 9999999
#elif DECDPUN==8
#define DECDPUNMAX 99999999
#elif DECDPUN==9
#define DECDPUNMAX 999999999
#elif defined(DECDPUN)
#error DECDPUN must be in the range 1-9
#endif
/* ----- Shared data ----- */
/* The powers of of ten array (powers[n]==10**n, 0<=n<=10) */
extern const uInt powers[];
/* ----- Macros ----- */
/* ISZERO -- return true if decNumber dn is a zero */
/* [performance-critical in some situations] */
#define ISZERO(dn) decNumberIsZero(dn) /* now just a local name */
/* X10 and X100 -- multiply integer i by 10 or 100 */
/* [shifts are usually faster than multiply; could be conditional] */
#define X10(i) (((i)<<1)+((i)<<3))
#define X100(i) (((i)<<2)+((i)<<5)+((i)<<6))
/* D2U -- return the number of Units needed to hold d digits */
#if DECDPUN==8
#define D2U(d) ((unsigned)((d)+7)>>3)
#elif DECDPUN==4
#define D2U(d) ((unsigned)((d)+3)>>2)
#else
#define D2U(d) (((d)+DECDPUN-1)/DECDPUN)
#endif
#else
#error decNumberLocal included more than once
#endif

View File

@ -0,0 +1,102 @@
/* Temporary support for a libc-like fp environment for decimal float.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License,
the Free Software Foundation gives you unlimited permission to link
the compiled version of this file into combinations with other
programs, and to distribute those combinations without any
restriction coming from the use of this file. (The General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into a combine executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#include "config.h"
#include "decContext.h"
#define FE_DEC_DOWNWARD 0
#define FE_DEC_TONEAREST 1
#define FE_DEC_TONEARESTFROMZERO 2
#define FE_DEC_TOWARDZERO 3
#define FE_DEC_UPWARD 4
#define FE_DEC_MAX 5
extern void __dfp_set_round (int);
extern int __dfp_get_round (void);
extern enum rounding __decGetRound (void);
/* FIXME: these should be in thread-local storage for runtime support. */
static enum rounding __dfp_rounding_mode = DEC_ROUND_HALF_EVEN;
/* Set the decNumber rounding mode from the FE_DEC_* value in MODE. */
void
__dfp_set_round (int mode)
{
switch (mode)
{
case FE_DEC_DOWNWARD:
__dfp_rounding_mode = DEC_ROUND_FLOOR; break;
case FE_DEC_TONEAREST:
__dfp_rounding_mode = DEC_ROUND_HALF_EVEN; break;
case FE_DEC_TONEARESTFROMZERO:
__dfp_rounding_mode = DEC_ROUND_HALF_UP; break;
case FE_DEC_TOWARDZERO:
__dfp_rounding_mode = DEC_ROUND_DOWN; break;
case FE_DEC_UPWARD:
__dfp_rounding_mode = DEC_ROUND_CEILING; break;
default:
/* We can't use assert in libgcc, so just return the default mode. */
__dfp_rounding_mode = DEC_ROUND_HALF_EVEN; break;
}
}
/* Return the decNumber rounding mode as an FE_DEC_* value. */
int
__dfp_get_round (void)
{
int mode;
switch (__dfp_rounding_mode)
{
case DEC_ROUND_FLOOR:
mode = FE_DEC_DOWNWARD; break;
case DEC_ROUND_HALF_EVEN:
mode = FE_DEC_TONEAREST; break;
case DEC_ROUND_HALF_UP:
mode = FE_DEC_TONEARESTFROMZERO; break;
case DEC_ROUND_DOWN:
mode = FE_DEC_TOWARDZERO; break;
case DEC_ROUND_CEILING:
mode = FE_DEC_UPWARD; break;
default:
/* We shouldn't get here, but can't use assert in libgcc. */
mode = -1;
}
return mode;
}
/* Return the decNumber version of the current rounding mode. */
enum rounding
__decGetRound (void)
{
return __dfp_rounding_mode;
}

View File

@ -0,0 +1,360 @@
/* Utility functions for decimal floating point support via decNumber.
Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by IBM Corporation. Author Mike Cowlishaw.
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License,
the Free Software Foundation gives you unlimited permission to link
the compiled version of this file into combinations with other
programs, and to distribute those combinations without any
restriction coming from the use of this file. (The General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into a combine executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#include "config.h"
#include "decNumber.h" /* base number library */
#include "decNumberLocal.h" /* decNumber local types, etc. */
#include "decUtility.h" /* utility routines */
/* ================================================================== */
/* Shared utility routines */
/* ================================================================== */
/* define and include the conversion tables to use */
#define DEC_BIN2DPD 1 /* used for all sizes */
#if DECDPUN==3
#define DEC_DPD2BIN 1
#else
#define DEC_DPD2BCD 1
#endif
#include "decDPD.h" /* lookup tables */
/* The maximum number of decNumberUnits we need for a working copy of */
/* the units array is the ceiling of digits/DECDPUN, where digits is */
/* the maximum number of digits in any of the formats for which this */
/* is used. We do not want to include decimal128.h, so, as a very */
/* special case, that number is defined here. */
#define DECMAX754 34
#define DECMAXUNITS ((DECMAX754+DECDPUN-1)/DECDPUN)
/* ------------------------------------------------------------------ */
/* decDensePackCoeff -- densely pack coefficient into DPD form */
/* */
/* dn is the source number (assumed valid, max DECMAX754 digits) */
/* bytes is the target's byte array */
/* len is length of target format's byte array */
/* shift is the number of 0 digits to add on the right (normally 0) */
/* */
/* The coefficient must be known small enough to fit, and is filled */
/* in from the right (least significant first). Note that the full */
/* coefficient is copied, including the leading 'odd' digit. This */
/* digit is retrieved and packed into the combination field by the */
/* caller. */
/* */
/* shift is used for 'fold-down' padding. */
/* */
/* No error is possible. */
/* ------------------------------------------------------------------ */
void
decDensePackCoeff (const decNumber * dn, uByte * bytes, Int len, Int shift)
{
Int cut; /* work */
Int n; /* output bunch counter */
Int digits = dn->digits; /* digit countdown */
uInt dpd; /* densely packed decimal value */
uInt bin; /* binary value 0-999 */
uByte *bout; /* -> current output byte */
const Unit *inu = dn->lsu; /* -> current input unit */
Unit uar[DECMAXUNITS]; /* working copy of units, iff shifted */
#if DECDPUN!=3 /* not fast path */
Unit in; /* current input unit */
#endif
if (shift != 0)
{ /* shift towards most significant required */
/* shift the units array to the left by pad digits and copy */
/* [this code is a special case of decShiftToMost, which could */
/* be used instead if exposed and the array were copied first] */
Unit *target, *first; /* work */
const Unit *source; /* work */
uInt next = 0; /* work */
source = dn->lsu + D2U (digits) - 1; /* where msu comes from */
first = uar + D2U (digits + shift) - 1; /* where msu will end up */
target = uar + D2U (digits) - 1 + D2U (shift); /* where upper part of first cut goes */
cut = (DECDPUN - shift % DECDPUN) % DECDPUN;
for (; source >= dn->lsu; source--, target--)
{
/* split the source Unit and accumulate remainder for next */
uInt rem = *source % powers[cut];
next += *source / powers[cut];
if (target <= first)
*target = (Unit) next; /* write to target iff valid */
next = rem * powers[DECDPUN - cut]; /* save remainder for next Unit */
}
/* propagate remainder to one below and clear the rest */
for (; target >= uar; target--)
{
*target = (Unit) next;
next = 0;
}
digits += shift; /* add count (shift) of zeros added */
inu = uar; /* use units in working array */
}
/* densely pack the coefficient into the byte array, starting from
the right (optionally padded) */
bout = &bytes[len - 1]; /* rightmost result byte for phase */
#if DECDPUN!=3 /* not fast path */
in = *inu; /* prime */
cut = 0; /* at lowest digit */
bin = 0; /* [keep compiler quiet] */
#endif
for (n = 0; digits > 0; n++)
{ /* each output bunch */
#if DECDPUN==3 /* fast path, 3-at-a-time */
bin = *inu; /* 3 ready for convert */
digits -= 3; /* [may go negative] */
inu++; /* may need another */
#else /* must collect digit-by-digit */
Unit dig; /* current digit */
Int j; /* digit-in-bunch count */
for (j = 0; j < 3; j++)
{
#if DECDPUN<=4
Unit temp = (Unit) ((uInt) (in * 6554) >> 16);
dig = (Unit) (in - X10 (temp));
in = temp;
#else
dig = in % 10;
in = in / 10;
#endif
if (j == 0)
bin = dig;
else if (j == 1)
bin += X10 (dig);
else /* j==2 */
bin += X100 (dig);
digits--;
if (digits == 0)
break; /* [also protects *inu below] */
cut++;
if (cut == DECDPUN)
{
inu++;
in = *inu;
cut = 0;
}
}
#endif
/* here we have 3 digits in bin, or have used all input digits */
dpd = BIN2DPD[bin];
/* write bunch (bcd) to byte array */
switch (n & 0x03)
{ /* phase 0-3 */
case 0:
*bout = (uByte) dpd; /* [top 2 bits truncated] */
bout--;
*bout = (uByte) (dpd >> 8);
break;
case 1:
*bout |= (uByte) (dpd << 2);
bout--;
*bout = (uByte) (dpd >> 6);
break;
case 2:
*bout |= (uByte) (dpd << 4);
bout--;
*bout = (uByte) (dpd >> 4);
break;
case 3:
*bout |= (uByte) (dpd << 6);
bout--;
*bout = (uByte) (dpd >> 2);
bout--;
break;
} /* switch */
} /* n bunches */
return;
}
/* ------------------------------------------------------------------ */
/* decDenseUnpackCoeff -- unpack a format's coefficient */
/* */
/* byte is the source's byte array */
/* len is length of the source's byte array */
/* dn is the target number, with 7, 16, or 34-digit space. */
/* bunches is the count of DPD groups in the decNumber (2, 5, or 11)*/
/* odd is 1 if there is a non-zero leading 10-bit group containing */
/* a single digit, 0 otherwise */
/* */
/* (This routine works on a copy of the number, if necessary, where */
/* an extra 10-bit group is prefixed to the coefficient continuation */
/* to hold the most significant digit if the latter is non-0.) */
/* */
/* dn->digits is set, but not the sign or exponent. */
/* No error is possible [the redundant 888 codes are allowed]. */
/* ------------------------------------------------------------------ */
void
decDenseUnpackCoeff (const uByte * bytes, Int len, decNumber * dn,
Int bunches, Int odd)
{
uInt dpd = 0; /* collector for 10 bits */
Int n; /* counter */
const uByte *bin; /* -> current input byte */
Unit *uout = dn->lsu; /* -> current output unit */
Unit out = 0; /* accumulator */
Int cut = 0; /* power of ten in current unit */
Unit *last = uout; /* will be unit containing msd */
#if DECDPUN!=3
uInt bcd; /* BCD result */
uInt nibble; /* work */
#endif
/* Expand the densely-packed integer, right to left */
bin = &bytes[len - 1]; /* next input byte to use */
for (n = 0; n < bunches + odd; n++)
{ /* N bunches of 10 bits */
/* assemble the 10 bits */
switch (n & 0x03)
{ /* phase 0-3 */
case 0:
dpd = *bin;
bin--;
dpd |= (*bin & 0x03) << 8;
break;
case 1:
dpd = (unsigned) *bin >> 2;
bin--;
dpd |= (*bin & 0x0F) << 6;
break;
case 2:
dpd = (unsigned) *bin >> 4;
bin--;
dpd |= (*bin & 0x3F) << 4;
break;
case 3:
dpd = (unsigned) *bin >> 6;
bin--;
dpd |= (*bin) << 2;
bin--;
break;
} /*switch */
#if DECDPUN==3
if (dpd == 0)
*uout = 0;
else
{
*uout = DPD2BIN[dpd]; /* convert 10 bits to binary 0-999 */
last = uout; /* record most significant unit */
}
uout++;
#else /* DECDPUN!=3 */
if (dpd == 0)
{ /* fastpath [e.g., leading zeros] */
cut += 3;
for (; cut >= DECDPUN;)
{
cut -= DECDPUN;
*uout = out;
uout++;
out = 0;
}
continue;
}
bcd = DPD2BCD[dpd]; /* convert 10 bits to 12 bits BCD */
/* now split the 3 BCD nibbles into bytes, and accumulate into units */
/* If this is the last bunch and it is an odd one, we only have one */
/* nibble to handle [extras could overflow a Unit] */
nibble = bcd & 0x000f;
if (nibble)
{
last = uout;
out = (Unit) (out + nibble * powers[cut]);
}
cut++;
if (cut == DECDPUN)
{
*uout = out;
uout++;
cut = 0;
out = 0;
}
if (n < bunches)
{
nibble = bcd & 0x00f0;
if (nibble)
{
nibble >>= 4;
last = uout;
out = (Unit) (out + nibble * powers[cut]);
}
cut++;
if (cut == DECDPUN)
{
*uout = out;
uout++;
cut = 0;
out = 0;
}
nibble = bcd & 0x0f00;
if (nibble)
{
nibble >>= 8;
last = uout;
out = (Unit) (out + nibble * powers[cut]);
}
cut++;
if (cut == DECDPUN)
{
*uout = out;
uout++;
cut = 0;
out = 0;
}
}
#endif
} /* n */
if (cut != 0)
*uout = out; /* write out final unit */
/* here, last points to the most significant unit with digits */
/* we need to inspect it to get final digits count */
dn->digits = (last - dn->lsu) * DECDPUN; /* floor of digits */
for (cut = 0; cut < DECDPUN; cut++)
{
if (*last < powers[cut])
break;
dn->digits++;
}
if (dn->digits == 0)
dn->digits++; /* zero has one digit */
return;
}

View File

@ -0,0 +1,37 @@
/* Utility functions for decimal floating point support via decNumber.
Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by IBM Corporation. Author Mike Cowlishaw.
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License,
the Free Software Foundation gives you unlimited permission to link
the compiled version of this file into combinations with other
programs, and to distribute those combinations without any
restriction coming from the use of this file. (The General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into a combine executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#ifdef IN_LIBGCC2
#define decDensePackCoeff __decDensePackCoeff
#define decDenseUnpackCoeff __decDenseUnpackCoeff
#endif
extern void decDensePackCoeff (const decNumber *, uByte *, Int, Int);
extern void decDenseUnpackCoeff (const uByte *, Int, decNumber *, Int, Int);

View File

@ -0,0 +1,347 @@
/* Decimal 128-bit format module from the decNumber C Library.
Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by IBM Corporation. Author Mike Cowlishaw.
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License,
the Free Software Foundation gives you unlimited permission to link
the compiled version of this file into combinations with other
programs, and to distribute those combinations without any
restriction coming from the use of this file. (The General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into a combine executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
/* ------------------------------------------------------------------ */
/* This module comprises the routines for decimal128 format numbers. */
/* Conversions are supplied to and from decNumber and String. */
/* */
/* No arithmetic routines are included; decNumber provides these. */
/* */
/* Error handling is the same as decNumber (qv.). */
/* ------------------------------------------------------------------ */
#include <string.h> /* [for memset/memcpy] */
#include <stdio.h> /* [for printf] */
#define DECNUMDIGITS 34 /* we need decNumbers with space for 34 */
#include "config.h"
#include "decNumber.h" /* base number library */
#include "decNumberLocal.h" /* decNumber local types, etc. */
#include "decimal128.h" /* our primary include */
#include "decUtility.h" /* utility routines */
#if DECTRACE || DECCHECK
void decimal128Show (const decimal128 *); /* for debug */
void decNumberShow (const decNumber *); /* .. */
#endif
/* Useful macro */
/* Clear a structure (e.g., a decNumber) */
#define DEC_clear(d) memset(d, 0, sizeof(*d))
/* ------------------------------------------------------------------ */
/* decimal128FromNumber -- convert decNumber to decimal128 */
/* */
/* ds is the target decimal128 */
/* dn is the source number (assumed valid) */
/* set is the context, used only for reporting errors */
/* */
/* The set argument is used only for status reporting and for the */
/* rounding mode (used if the coefficient is more than DECIMAL128_Pmax*/
/* digits or an overflow is detected). If the exponent is out of the */
/* valid range then Overflow or Underflow will be raised. */
/* After Underflow a subnormal result is possible. */
/* */
/* DEC_Clamped is set if the number has to be 'folded down' to fit, */
/* by reducing its exponent and multiplying the coefficient by a */
/* power of ten, or if the exponent on a zero had to be clamped. */
/* ------------------------------------------------------------------ */
decimal128 *
decimal128FromNumber (decimal128 * d128, const decNumber * dn, decContext * set)
{
uInt status = 0; /* status accumulator */
Int pad = 0; /* coefficient pad digits */
decNumber dw; /* work */
decContext dc; /* .. */
uByte isneg = dn->bits & DECNEG; /* non-0 if original sign set */
uInt comb, exp; /* work */
/* If the number is finite, and has too many digits, or the exponent */
/* could be out of range then we reduce the number under the */
/* appropriate constraints */
if (!(dn->bits & DECSPECIAL))
{ /* not a special value */
Int ae = dn->exponent + dn->digits - 1; /* adjusted exponent */
if (dn->digits > DECIMAL128_Pmax /* too many digits */
|| ae > DECIMAL128_Emax /* likely overflow */
|| ae < DECIMAL128_Emin)
{ /* likely underflow */
decContextDefault (&dc, DEC_INIT_DECIMAL128); /* [no traps] */
dc.round = set->round; /* use supplied rounding */
decNumberPlus (&dw, dn, &dc); /* (round and check) */
/* [this changes -0 to 0, but it will be restored below] */
status |= dc.status; /* save status */
dn = &dw; /* use the work number */
}
/* [this could have pushed number to Infinity or zero, so this */
/* rounding must be done before we generate the decimal128] */
}
DEC_clear (d128); /* clean the target */
if (dn->bits & DECSPECIAL)
{ /* a special value */
uByte top; /* work */
if (dn->bits & DECINF)
top = DECIMAL_Inf;
else
{ /* sNaN or qNaN */
if ((*dn->lsu != 0 || dn->digits > 1) /* non-zero coefficient */
&& (dn->digits < DECIMAL128_Pmax))
{ /* coefficient fits */
decDensePackCoeff (dn, d128->bytes, sizeof (d128->bytes), 0);
}
if (dn->bits & DECNAN)
top = DECIMAL_NaN;
else
top = DECIMAL_sNaN;
}
d128->bytes[0] = top;
}
else if (decNumberIsZero (dn))
{ /* a zero */
/* set and clamp exponent */
if (dn->exponent < -DECIMAL128_Bias)
{
exp = 0;
status |= DEC_Clamped;
}
else
{
exp = dn->exponent + DECIMAL128_Bias; /* bias exponent */
if (exp > DECIMAL128_Ehigh)
{ /* top clamp */
exp = DECIMAL128_Ehigh;
status |= DEC_Clamped;
}
}
comb = (exp >> 9) & 0x18; /* combination field */
d128->bytes[0] = (uByte) (comb << 2);
exp &= 0xfff; /* remaining exponent bits */
decimal128SetExpCon (d128, exp);
}
else
{ /* non-zero finite number */
uInt msd; /* work */
/* we have a dn that fits, but it may need to be padded */
exp = (uInt) (dn->exponent + DECIMAL128_Bias); /* bias exponent */
if (exp > DECIMAL128_Ehigh)
{ /* fold-down case */
pad = exp - DECIMAL128_Ehigh;
exp = DECIMAL128_Ehigh; /* [to maximum] */
status |= DEC_Clamped;
}
decDensePackCoeff (dn, d128->bytes, sizeof (d128->bytes), pad);
/* save and clear the top digit */
msd = ((unsigned) d128->bytes[1] << 2) & 0x0c; /* top 2 bits */
msd |= ((unsigned) d128->bytes[2] >> 6); /* low 2 bits */
d128->bytes[1] &= 0xfc;
d128->bytes[2] &= 0x3f;
/* create the combination field */
if (msd >= 8)
comb = 0x18 | (msd & 0x01) | ((exp >> 11) & 0x06);
else
comb = (msd & 0x07) | ((exp >> 9) & 0x18);
d128->bytes[0] = (uByte) (comb << 2);
exp &= 0xfff; /* remaining exponent bits */
decimal128SetExpCon (d128, exp);
}
if (isneg)
decimal128SetSign (d128, 1);
if (status != 0)
decContextSetStatus (set, status); /* pass on status */
/* decimal128Show(d128); */
return d128;
}
/* ------------------------------------------------------------------ */
/* decimal128ToNumber -- convert decimal128 to decNumber */
/* d128 is the source decimal128 */
/* dn is the target number, with appropriate space */
/* No error is possible. */
/* ------------------------------------------------------------------ */
decNumber *
decimal128ToNumber (const decimal128 * d128, decNumber * dn)
{
uInt msd; /* coefficient MSD */
decimal128 wk; /* working copy, if needed */
uInt top = d128->bytes[0] & 0x7f; /* top byte, less sign bit */
decNumberZero (dn); /* clean target */
/* set the sign if negative */
if (decimal128Sign (d128))
dn->bits = DECNEG;
if (top >= 0x78)
{ /* is a special */
if ((top & 0x7c) == (DECIMAL_Inf & 0x7c))
dn->bits |= DECINF;
else if ((top & 0x7e) == (DECIMAL_NaN & 0x7e))
dn->bits |= DECNAN;
else
dn->bits |= DECSNAN;
msd = 0; /* no top digit */
}
else
{ /* have a finite number */
uInt comb = top >> 2; /* combination field */
uInt exp; /* exponent */
if (comb >= 0x18)
{
msd = 8 + (comb & 0x01);
exp = (comb & 0x06) << 11; /* MSBs */
}
else
{
msd = comb & 0x07;
exp = (comb & 0x18) << 9;
}
dn->exponent = exp + decimal128ExpCon (d128) - DECIMAL128_Bias; /* remove bias */
}
/* get the coefficient, unless infinite */
if (!(dn->bits & DECINF))
{
Int bunches = DECIMAL128_Pmax / 3; /* coefficient full bunches to convert */
Int odd = 0; /* assume MSD is 0 (no odd bunch) */
if (msd != 0)
{ /* coefficient has leading non-0 digit */
/* make a copy of the decimal128, with an extra bunch which has */
/* the top digit ready for conversion */
wk = *d128; /* take a copy */
wk.bytes[0] = 0; /* clear all but coecon */
wk.bytes[1] = 0; /* .. */
wk.bytes[2] &= 0x3f; /* .. */
wk.bytes[1] |= (msd >> 2); /* and prefix MSD */
wk.bytes[2] |= (msd << 6); /* .. */
odd++; /* indicate the extra */
d128 = &wk; /* use the work copy */
}
decDenseUnpackCoeff (d128->bytes, sizeof (d128->bytes), dn, bunches,
odd);
}
/* decNumberShow(dn); */
return dn;
}
/* ------------------------------------------------------------------ */
/* to-scientific-string -- conversion to numeric string */
/* to-engineering-string -- conversion to numeric string */
/* */
/* decimal128ToString(d128, string); */
/* decimal128ToEngString(d128, string); */
/* */
/* d128 is the decimal128 format number to convert */
/* string is the string where the result will be laid out */
/* */
/* string must be at least 24 characters */
/* */
/* No error is possible, and no status can be set. */
/* ------------------------------------------------------------------ */
char *
decimal128ToString (const decimal128 * d128, char *string)
{
decNumber dn; /* work */
decimal128ToNumber (d128, &dn);
decNumberToString (&dn, string);
return string;
}
char *
decimal128ToEngString (const decimal128 * d128, char *string)
{
decNumber dn; /* work */
decimal128ToNumber (d128, &dn);
decNumberToEngString (&dn, string);
return string;
}
/* ------------------------------------------------------------------ */
/* to-number -- conversion from numeric string */
/* */
/* decimal128FromString(result, string, set); */
/* */
/* result is the decimal128 format number which gets the result of */
/* the conversion */
/* *string is the character string which should contain a valid */
/* number (which may be a special value) */
/* set is the context */
/* */
/* The context is supplied to this routine is used for error handling */
/* (setting of status and traps) and for the rounding mode, only. */
/* If an error occurs, the result will be a valid decimal128 NaN. */
/* ------------------------------------------------------------------ */
decimal128 *
decimal128FromString (decimal128 * result, const char *string, decContext * set)
{
decContext dc; /* work */
decNumber dn; /* .. */
decContextDefault (&dc, DEC_INIT_DECIMAL128); /* no traps, please */
dc.round = set->round; /* use supplied rounding */
decNumberFromString (&dn, string, &dc); /* will round if needed */
decimal128FromNumber (result, &dn, &dc);
if (dc.status != 0)
{ /* something happened */
decContextSetStatus (set, dc.status); /* .. pass it on */
}
return result;
}
#if DECTRACE || DECCHECK
/* ------------------------------------------------------------------ */
/* decimal128Show -- display a single in hexadecimal [debug aid] */
/* d128 -- the number to show */
/* ------------------------------------------------------------------ */
/* Also shows sign/cob/expconfields extracted */
void
decimal128Show (const decimal128 * d128)
{
char buf[DECIMAL128_Bytes * 2 + 1];
Int i, j;
j = 0;
for (i = 0; i < DECIMAL128_Bytes; i++)
{
sprintf (&buf[j], "%02x", d128->bytes[i]);
j = j + 2;
}
printf (" D128> %s [S:%d Cb:%02x E:%d]\n", buf,
decimal128Sign (d128), decimal128Comb (d128),
decimal128ExpCon (d128));
}
#endif

View File

@ -0,0 +1,122 @@
/* Decimal 128-bit format module header for the decNumber C Library
Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by IBM Corporation. Author Mike Cowlishaw.
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License,
the Free Software Foundation gives you unlimited permission to link
the compiled version of this file into combinations with other
programs, and to distribute those combinations without any
restriction coming from the use of this file. (The General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into a combine executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#if !defined(DECIMAL128)
#define DECIMAL128
#define DEC128NAME "decimal128" /* Short name */
#define DEC128FULLNAME "Decimal 128-bit Number" /* Verbose name */
#define DEC128AUTHOR "Mike Cowlishaw" /* Who to blame */
#if defined(DECIMAL32)
#error decimal128.h must precede decimal32.h for correct DECNUMDIGITS
#else
#if defined(DECIMAL64)
#error decimal128.h must precede decimal64.h for correct DECNUMDIGITS
#endif
#endif
/* parameters for decimal128s */
#define DECIMAL128_Bytes 16 /* length */
#define DECIMAL128_Pmax 34 /* maximum precision (digits) */
#define DECIMAL128_Emax 6144 /* maximum adjusted exponent */
#define DECIMAL128_Emin -6143 /* minimum adjusted exponent */
#define DECIMAL128_Bias 6176 /* bias for the exponent */
#define DECIMAL128_String 43 /* maximum string length, +1 */
/* highest biased exponent (Elimit-1) */
#define DECIMAL128_Ehigh (DECIMAL128_Emax+DECIMAL128_Bias-DECIMAL128_Pmax+1)
#ifndef DECNUMDIGITS
#define DECNUMDIGITS DECIMAL128_Pmax /* size if not already defined */
#endif
#ifndef DECNUMBER
#include "decNumber.h" /* context and number library */
#endif
/* Decimal 128-bit type, accessible by bytes */
typedef struct
{
uint8_t bytes[DECIMAL128_Bytes]; /* decimal128: 1, 5, 12, 110 bits */
} decimal128;
/* special values [top byte excluding sign bit; last two bits are
don't-care for Infinity on input, last bit don't-care for NaN] */
#if !defined(DECIMAL_NaN)
#define DECIMAL_NaN 0x7c /* 0 11111 00 NaN */
#define DECIMAL_sNaN 0x7e /* 0 11111 10 sNaN */
#define DECIMAL_Inf 0x78 /* 0 11110 00 Infinity */
#endif
/* Macros for accessing decimal128 fields. These assume the argument
is a reference (pointer) to the decimal128 structure */
/* Get sign */
#define decimal128Sign(d) ((unsigned)(d)->bytes[0]>>7)
/* Get combination field */
#define decimal128Comb(d) (((d)->bytes[0] & 0x7c)>>2)
/* Get exponent continuation [does not remove bias] */
#define decimal128ExpCon(d) ((((d)->bytes[0] & 0x03)<<10) \
| ((unsigned)(d)->bytes[1]<<2) \
| ((unsigned)(d)->bytes[2]>>6))
/* Set sign [this assumes sign previously 0] */
#define decimal128SetSign(d, b) { \
(d)->bytes[0]|=((unsigned)(b)<<7);}
/* Set exponent continuation [does not apply bias] */
/* This assumes range has been checked and exponent previously 0; */
/* type of exponent must be unsigned */
#define decimal128SetExpCon(d, e) { \
(d)->bytes[0]|=(uint8_t)((e)>>10); \
(d)->bytes[1] =(uint8_t)(((e)&0x3fc)>>2); \
(d)->bytes[2]|=(uint8_t)(((e)&0x03)<<6);}
/* ------------------------------------------------------------------ */
/* Routines */
/* ------------------------------------------------------------------ */
#ifdef IN_LIBGCC2
#define decimal128FromString __decimal128FromString
#define decimal128ToString __decimal128ToString
#define decimal128ToEngString __decimal128ToEngString
#define decimal128FromNumber __decimal128FromNumber
#define decimal128ToNumber __decimal128ToNumber
#endif
/* String conversions */
decimal128 *decimal128FromString (decimal128 *, const char *, decContext *);
char *decimal128ToString (const decimal128 *, char *);
char *decimal128ToEngString (const decimal128 *, char *);
/* decNumber conversions */
decimal128 *decimal128FromNumber (decimal128 *, const decNumber *, decContext *);
decNumber *decimal128ToNumber (const decimal128 *, decNumber *);
#endif

View File

@ -0,0 +1,337 @@
/* Decimal 32-bit format module for the decNumber C Library
Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by IBM Corporation. Author Mike Cowlishaw.
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License,
the Free Software Foundation gives you unlimited permission to link
the compiled version of this file into combinations with other
programs, and to distribute those combinations without any
restriction coming from the use of this file. (The General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into a combine executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
/* ------------------------------------------------------------------ */
/* This module comprises the routines for decimal32 format numbers. */
/* Conversions are supplied to and from decNumber and String. */
/* */
/* No arithmetic routines are included; decNumber provides these. */
/* */
/* Error handling is the same as decNumber (qv.). */
/* ------------------------------------------------------------------ */
#include <string.h> /* [for memset/memcpy] */
#include <stdio.h> /* [for printf] */
#define DECNUMDIGITS 7 /* we need decNumbers with space for 7 */
#include "config.h"
#include "decNumber.h" /* base number library */
#include "decNumberLocal.h" /* decNumber local types, etc. */
#include "decimal32.h" /* our primary include */
#include "decUtility.h" /* utility routines */
#if DECTRACE || DECCHECK
void decimal32Show (const decimal32 *); /* for debug */
void decNumberShow (const decNumber *); /* .. */
#endif
/* Useful macro */
/* Clear a structure (e.g., a decNumber) */
#define DEC_clear(d) memset(d, 0, sizeof(*d))
/* ------------------------------------------------------------------ */
/* decimal32FromNumber -- convert decNumber to decimal32 */
/* */
/* ds is the target decimal32 */
/* dn is the source number (assumed valid) */
/* set is the context, used only for reporting errors */
/* */
/* The set argument is used only for status reporting and for the */
/* rounding mode (used if the coefficient is more than DECIMAL32_Pmax */
/* digits or an overflow is detected). If the exponent is out of the */
/* valid range then Overflow or Underflow will be raised. */
/* After Underflow a subnormal result is possible. */
/* */
/* DEC_Clamped is set if the number has to be 'folded down' to fit, */
/* by reducing its exponent and multiplying the coefficient by a */
/* power of ten, or if the exponent on a zero had to be clamped. */
/* ------------------------------------------------------------------ */
decimal32 *
decimal32FromNumber (decimal32 * d32, const decNumber * dn, decContext * set)
{
uInt status = 0; /* status accumulator */
Int pad = 0; /* coefficient pad digits */
decNumber dw; /* work */
decContext dc; /* .. */
uByte isneg = dn->bits & DECNEG; /* non-0 if original sign set */
uInt comb, exp; /* work */
/* If the number is finite, and has too many digits, or the exponent */
/* could be out of range then we reduce the number under the */
/* appropriate constraints */
if (!(dn->bits & DECSPECIAL))
{ /* not a special value */
Int ae = dn->exponent + dn->digits - 1; /* adjusted exponent */
if (dn->digits > DECIMAL32_Pmax /* too many digits */
|| ae > DECIMAL32_Emax /* likely overflow */
|| ae < DECIMAL32_Emin)
{ /* likely underflow */
decContextDefault (&dc, DEC_INIT_DECIMAL32); /* [no traps] */
dc.round = set->round; /* use supplied rounding */
decNumberPlus (&dw, dn, &dc); /* (round and check) */
/* [this changes -0 to 0, but it will be restored below] */
status |= dc.status; /* save status */
dn = &dw; /* use the work number */
}
/* [this could have pushed number to Infinity or zero, so this */
/* rounding must be done before we generate the decimal32] */
}
DEC_clear (d32); /* clean the target */
if (dn->bits & DECSPECIAL)
{ /* a special value */
uByte top; /* work */
if (dn->bits & DECINF)
top = DECIMAL_Inf;
else
{ /* sNaN or qNaN */
if ((*dn->lsu != 0 || dn->digits > 1) /* non-zero coefficient */
&& (dn->digits < DECIMAL32_Pmax))
{ /* coefficient fits */
decDensePackCoeff (dn, d32->bytes, sizeof (d32->bytes), 0);
}
if (dn->bits & DECNAN)
top = DECIMAL_NaN;
else
top = DECIMAL_sNaN;
}
d32->bytes[0] = top;
}
else if (decNumberIsZero (dn))
{ /* a zero */
/* set and clamp exponent */
if (dn->exponent < -DECIMAL32_Bias)
{
exp = 0;
status |= DEC_Clamped;
}
else
{
exp = dn->exponent + DECIMAL32_Bias; /* bias exponent */
if (exp > DECIMAL32_Ehigh)
{ /* top clamp */
exp = DECIMAL32_Ehigh;
status |= DEC_Clamped;
}
}
comb = (exp >> 3) & 0x18; /* combination field */
d32->bytes[0] = (uByte) (comb << 2);
exp &= 0x3f; /* remaining exponent bits */
decimal32SetExpCon (d32, exp);
}
else
{ /* non-zero finite number */
uInt msd; /* work */
/* we have a dn that fits, but it may need to be padded */
exp = (uInt) (dn->exponent + DECIMAL32_Bias); /* bias exponent */
if (exp > DECIMAL32_Ehigh)
{ /* fold-down case */
pad = exp - DECIMAL32_Ehigh;
exp = DECIMAL32_Ehigh; /* [to maximum] */
status |= DEC_Clamped;
}
decDensePackCoeff (dn, d32->bytes, sizeof (d32->bytes), pad);
/* save and clear the top digit */
msd = ((unsigned) d32->bytes[1] >> 4);
d32->bytes[1] &= 0x0f;
/* create the combination field */
if (msd >= 8)
comb = 0x18 | (msd & 0x01) | ((exp >> 5) & 0x06);
else
comb = (msd & 0x07) | ((exp >> 3) & 0x18);
d32->bytes[0] = (uByte) (comb << 2);
exp &= 0x3f; /* remaining exponent bits */
decimal32SetExpCon (d32, exp);
}
if (isneg)
decimal32SetSign (d32, 1);
if (status != 0)
decContextSetStatus (set, status); /* pass on status */
/*decimal32Show(d32); */
return d32;
}
/* ------------------------------------------------------------------ */
/* decimal32ToNumber -- convert decimal32 to decNumber */
/* d32 is the source decimal32 */
/* dn is the target number, with appropriate space */
/* No error is possible. */
/* ------------------------------------------------------------------ */
decNumber *
decimal32ToNumber (const decimal32 * d32, decNumber * dn)
{
uInt msd; /* coefficient MSD */
decimal32 wk; /* working copy, if needed */
uInt top = d32->bytes[0] & 0x7f; /* top byte, less sign bit */
decNumberZero (dn); /* clean target */
/* set the sign if negative */
if (decimal32Sign (d32))
dn->bits = DECNEG;
if (top >= 0x78)
{ /* is a special */
if ((top & 0x7c) == (DECIMAL_Inf & 0x7c))
dn->bits |= DECINF;
else if ((top & 0x7e) == (DECIMAL_NaN & 0x7e))
dn->bits |= DECNAN;
else
dn->bits |= DECSNAN;
msd = 0; /* no top digit */
}
else
{ /* have a finite number */
uInt comb = top >> 2; /* combination field */
uInt exp; /* working exponent */
if (comb >= 0x18)
{
msd = 8 + (comb & 0x01);
exp = (comb & 0x06) << 5; /* MSBs */
}
else
{
msd = comb & 0x07;
exp = (comb & 0x18) << 3;
}
dn->exponent = exp + decimal32ExpCon (d32) - DECIMAL32_Bias; /* remove bias */
}
/* get the coefficient, unless infinite */
if (!(dn->bits & DECINF))
{
Int bunches = DECIMAL32_Pmax / 3; /* coefficient full bunches to convert */
Int odd = 0; /* assume MSD is 0 (no odd bunch) */
if (msd != 0)
{ /* coefficient has leading non-0 digit */
/* make a copy of the decimal32, with an extra bunch which has */
/* the top digit ready for conversion */
wk = *d32; /* take a copy */
wk.bytes[0] = 0; /* clear all but coecon */
wk.bytes[1] &= 0x0f; /* .. */
wk.bytes[1] |= (msd << 4); /* and prefix MSD */
odd++; /* indicate the extra */
d32 = &wk; /* use the work copy */
}
decDenseUnpackCoeff (d32->bytes, sizeof (d32->bytes), dn, bunches, odd);
}
return dn;
}
/* ------------------------------------------------------------------ */
/* to-scientific-string -- conversion to numeric string */
/* to-engineering-string -- conversion to numeric string */
/* */
/* decimal32ToString(d32, string); */
/* decimal32ToEngString(d32, string); */
/* */
/* d32 is the decimal32 format number to convert */
/* string is the string where the result will be laid out */
/* */
/* string must be at least 24 characters */
/* */
/* No error is possible, and no status can be set. */
/* ------------------------------------------------------------------ */
char *
decimal32ToString (const decimal32 * d32, char *string)
{
decNumber dn; /* work */
decimal32ToNumber (d32, &dn);
decNumberToString (&dn, string);
return string;
}
char *
decimal32ToEngString (const decimal32 * d32, char *string)
{
decNumber dn; /* work */
decimal32ToNumber (d32, &dn);
decNumberToEngString (&dn, string);
return string;
}
/* ------------------------------------------------------------------ */
/* to-number -- conversion from numeric string */
/* */
/* decimal32FromString(result, string, set); */
/* */
/* result is the decimal32 format number which gets the result of */
/* the conversion */
/* *string is the character string which should contain a valid */
/* number (which may be a special value) */
/* set is the context */
/* */
/* The context is supplied to this routine is used for error handling */
/* (setting of status and traps) and for the rounding mode, only. */
/* If an error occurs, the result will be a valid decimal32 NaN. */
/* ------------------------------------------------------------------ */
decimal32 *
decimal32FromString (decimal32 * result, const char *string, decContext * set)
{
decContext dc; /* work */
decNumber dn; /* .. */
decContextDefault (&dc, DEC_INIT_DECIMAL32); /* no traps, please */
dc.round = set->round; /* use supplied rounding */
decNumberFromString (&dn, string, &dc); /* will round if needed */
decimal32FromNumber (result, &dn, &dc);
if (dc.status != 0)
{ /* something happened */
decContextSetStatus (set, dc.status); /* .. pass it on */
}
return result;
}
#if DECTRACE || DECCHECK
/* ------------------------------------------------------------------ */
/* decimal32Show -- display a single in hexadecimal [debug aid] */
/* d32 -- the number to show */
/* ------------------------------------------------------------------ */
/* Also shows sign/cob/expconfields extracted */
void
decimal32Show (const decimal32 * d32)
{
char buf[DECIMAL32_Bytes * 2 + 1];
Int i, j;
j = 0;
for (i = 0; i < DECIMAL32_Bytes; i++)
{
sprintf (&buf[j], "%02x", d32->bytes[i]);
j = j + 2;
}
printf (" D32> %s [S:%d Cb:%02x E:%d]\n", buf,
decimal32Sign (d32), decimal32Comb (d32), decimal32ExpCon (d32));
}
#endif

View File

@ -0,0 +1,112 @@
/* Decimal 32-bit format module header for the decNumber C Library
Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by IBM Corporation. Author Mike Cowlishaw.
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License,
the Free Software Foundation gives you unlimited permission to link
the compiled version of this file into combinations with other
programs, and to distribute those combinations without any
restriction coming from the use of this file. (The General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into a combine executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#if !defined(DECIMAL32)
#define DECIMAL32
#define DEC32NAME "decimal32" /* Short name */
#define DEC32FULLNAME "Decimal 32-bit Number" /* Verbose name */
#define DEC32AUTHOR "Mike Cowlishaw" /* Who to blame */
/* parameters for decimal32s */
#define DECIMAL32_Bytes 4 /* length */
#define DECIMAL32_Pmax 7 /* maximum precision (digits) */
#define DECIMAL32_Emax 96 /* maximum adjusted exponent */
#define DECIMAL32_Emin -95 /* minimum adjusted exponent */
#define DECIMAL32_Bias 101 /* bias for the exponent */
#define DECIMAL32_String 15 /* maximum string length, +1 */
/* highest biased exponent (Elimit-1) */
#define DECIMAL32_Ehigh (DECIMAL32_Emax+DECIMAL32_Bias-DECIMAL32_Pmax+1)
#ifndef DECNUMDIGITS
#define DECNUMDIGITS DECIMAL32_Pmax /* size if not already defined */
#endif
#ifndef DECNUMBER
#include "decNumber.h" /* context and number library */
#endif
/* Decimal 32-bit type, accessible by bytes */
typedef struct
{
uint8_t bytes[DECIMAL32_Bytes]; /* decimal32: 1, 5, 6, 20 bits */
} decimal32;
/* special values [top byte excluding sign bit; last two bits are
don't-care for Infinity on input, last bit don't-care for NaN] */
#if !defined(DECIMAL_NaN)
#define DECIMAL_NaN 0x7c /* 0 11111 00 NaN */
#define DECIMAL_sNaN 0x7e /* 0 11111 10 sNaN */
#define DECIMAL_Inf 0x78 /* 0 11110 00 Infinity */
#endif
/* Macros for accessing decimal32 fields. These assume the argument
is a reference (pointer) to the decimal32 structure */
/* Get sign */
#define decimal32Sign(d) ((unsigned)(d)->bytes[0]>>7)
/* Get combination field */
#define decimal32Comb(d) (((d)->bytes[0] & 0x7c)>>2)
/* Get exponent continuation [does not remove bias] */
#define decimal32ExpCon(d) ((((d)->bytes[0] & 0x03)<<4) \
| ((unsigned)(d)->bytes[1]>>4))
/* Set sign [this assumes sign previously 0] */
#define decimal32SetSign(d, b) { \
(d)->bytes[0]|=((unsigned)(b)<<7);}
/* Set exponent continuation [does not apply bias] */
/* This assumes range has been checked and exponent previously 0; */
/* type of exponent must be unsigned */
#define decimal32SetExpCon(d, e) { \
(d)->bytes[0]|=(uint8_t)((e)>>4); \
(d)->bytes[1]|=(uint8_t)(((e)&0x0F)<<4);}
/* ------------------------------------------------------------------ */
/* Routines */
/* ------------------------------------------------------------------ */
#ifdef IN_LIBGCC2
#define decimal32FromString __decimal32FromString
#define decimal32ToString __decimal32ToString
#define decimal32ToEngString __decimal32ToEngString
#define decimal32FromNumber __decimal32FromNumber
#define decimal32ToNumber __decimal32ToNumber
#endif
/* String conversions. */
decimal32 *decimal32FromString (decimal32 *, const char *, decContext *);
char *decimal32ToString (const decimal32 *, char *);
char *decimal32ToEngString (const decimal32 *, char *);
/* decNumber conversions. */
decimal32 *decimal32FromNumber (decimal32 *, const decNumber *, decContext *);
decNumber *decimal32ToNumber (const decimal32 *, decNumber *);
#endif

View File

@ -0,0 +1,337 @@
/* Decimal 64-bit format module for the decNumber C Library
Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by IBM Corporation. Author Mike Cowlishaw.
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License,
the Free Software Foundation gives you unlimited permission to link
the compiled version of this file into combinations with other
programs, and to distribute those combinations without any
restriction coming from the use of this file. (The General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into a combine executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
/* ------------------------------------------------------------------ */
/* This module comprises the routines for decimal64 format numbers. */
/* Conversions are supplied to and from decNumber and String. */
/* */
/* No arithmetic routines are included; decNumber provides these. */
/* */
/* Error handling is the same as decNumber (qv.). */
/* ------------------------------------------------------------------ */
#include <string.h> /* [for memset/memcpy] */
#include <stdio.h> /* [for printf] */
#define DECNUMDIGITS 16 /* we need decNumbers with space for 16 */
#include "config.h"
#include "decNumber.h" /* base number library */
#include "decNumberLocal.h" /* decNumber local types, etc. */
#include "decimal64.h" /* our primary include */
#include "decUtility.h" /* utility routines */
#if DECTRACE || DECCHECK
void decimal64Show (const decimal64 *); /* for debug */
void decNumberShow (const decNumber *); /* .. */
#endif
/* Useful macro */
/* Clear a structure (e.g., a decNumber) */
#define DEC_clear(d) memset(d, 0, sizeof(*d))
/* ------------------------------------------------------------------ */
/* decimal64FromNumber -- convert decNumber to decimal64 */
/* */
/* ds is the target decimal64 */
/* dn is the source number (assumed valid) */
/* set is the context, used only for reporting errors */
/* */
/* The set argument is used only for status reporting and for the */
/* rounding mode (used if the coefficient is more than DECIMAL64_Pmax */
/* digits or an overflow is detected). If the exponent is out of the */
/* valid range then Overflow or Underflow will be raised. */
/* After Underflow a subnormal result is possible. */
/* */
/* DEC_Clamped is set if the number has to be 'folded down' to fit, */
/* by reducing its exponent and multiplying the coefficient by a */
/* power of ten, or if the exponent on a zero had to be clamped. */
/* ------------------------------------------------------------------ */
decimal64 *
decimal64FromNumber (decimal64 * d64, const decNumber * dn, decContext * set)
{
uInt status = 0; /* status accumulator */
Int pad = 0; /* coefficient pad digits */
decNumber dw; /* work */
decContext dc; /* .. */
uByte isneg = dn->bits & DECNEG; /* non-0 if original sign set */
uInt comb, exp; /* work */
/* If the number is finite, and has too many digits, or the exponent */
/* could be out of range then we reduce the number under the */
/* appropriate constraints */
if (!(dn->bits & DECSPECIAL))
{ /* not a special value */
Int ae = dn->exponent + dn->digits - 1; /* adjusted exponent */
if (dn->digits > DECIMAL64_Pmax /* too many digits */
|| ae > DECIMAL64_Emax /* likely overflow */
|| ae < DECIMAL64_Emin)
{ /* likely underflow */
decContextDefault (&dc, DEC_INIT_DECIMAL64); /* [no traps] */
dc.round = set->round; /* use supplied rounding */
decNumberPlus (&dw, dn, &dc); /* (round and check) */
/* [this changes -0 to 0, but it will be restored below] */
status |= dc.status; /* save status */
dn = &dw; /* use the work number */
}
/* [this could have pushed number to Infinity or zero, so this */
/* rounding must be done before we generate the decimal64] */
}
DEC_clear (d64); /* clean the target */
if (dn->bits & DECSPECIAL)
{ /* a special value */
uByte top; /* work */
if (dn->bits & DECINF)
top = DECIMAL_Inf;
else
{ /* sNaN or qNaN */
if ((*dn->lsu != 0 || dn->digits > 1) /* non-zero coefficient */
&& (dn->digits < DECIMAL64_Pmax))
{ /* coefficient fits */
decDensePackCoeff (dn, d64->bytes, sizeof (d64->bytes), 0);
}
if (dn->bits & DECNAN)
top = DECIMAL_NaN;
else
top = DECIMAL_sNaN;
}
d64->bytes[0] = top;
}
else if (decNumberIsZero (dn))
{ /* a zero */
/* set and clamp exponent */
if (dn->exponent < -DECIMAL64_Bias)
{
exp = 0;
status |= DEC_Clamped;
}
else
{
exp = dn->exponent + DECIMAL64_Bias; /* bias exponent */
if (exp > DECIMAL64_Ehigh)
{ /* top clamp */
exp = DECIMAL64_Ehigh;
status |= DEC_Clamped;
}
}
comb = (exp >> 5) & 0x18; /* combination field */
d64->bytes[0] = (uByte) (comb << 2);
exp &= 0xff; /* remaining exponent bits */
decimal64SetExpCon (d64, exp);
}
else
{ /* non-zero finite number */
uInt msd; /* work */
/* we have a dn that fits, but it may need to be padded */
exp = (uInt) (dn->exponent + DECIMAL64_Bias); /* bias exponent */
if (exp > DECIMAL64_Ehigh)
{ /* fold-down case */
pad = exp - DECIMAL64_Ehigh;
exp = DECIMAL64_Ehigh; /* [to maximum] */
status |= DEC_Clamped;
}
decDensePackCoeff (dn, d64->bytes, sizeof (d64->bytes), pad);
/* save and clear the top digit */
msd = ((unsigned) d64->bytes[1] >> 2) & 0x0f;
d64->bytes[1] &= 0x03;
/* create the combination field */
if (msd >= 8)
comb = 0x18 | (msd & 0x01) | ((exp >> 7) & 0x06);
else
comb = (msd & 0x07) | ((exp >> 5) & 0x18);
d64->bytes[0] = (uByte) (comb << 2);
exp &= 0xff; /* remaining exponent bits */
decimal64SetExpCon (d64, exp);
}
if (isneg)
decimal64SetSign (d64, 1);
if (status != 0)
decContextSetStatus (set, status); /* pass on status */
/*decimal64Show(d64); */
return d64;
}
/* ------------------------------------------------------------------ */
/* decimal64ToNumber -- convert decimal64 to decNumber */
/* d64 is the source decimal64 */
/* dn is the target number, with appropriate space */
/* No error is possible. */
/* ------------------------------------------------------------------ */
decNumber *
decimal64ToNumber (const decimal64 * d64, decNumber * dn)
{
uInt msd; /* coefficient MSD */
decimal64 wk; /* working copy, if needed */
uInt top = d64->bytes[0] & 0x7f; /* top byte, less sign bit */
decNumberZero (dn); /* clean target */
/* set the sign if negative */
if (decimal64Sign (d64))
dn->bits = DECNEG;
if (top >= 0x78)
{ /* is a special */
if ((top & 0x7c) == (DECIMAL_Inf & 0x7c))
dn->bits |= DECINF;
else if ((top & 0x7e) == (DECIMAL_NaN & 0x7e))
dn->bits |= DECNAN;
else
dn->bits |= DECSNAN;
msd = 0; /* no top digit */
}
else
{ /* have a finite number */
uInt comb = top >> 2; /* combination field */
uInt exp; /* exponent */
if (comb >= 0x18)
{
msd = 8 + (comb & 0x01);
exp = (comb & 0x06) << 7; /* MSBs */
}
else
{
msd = comb & 0x07;
exp = (comb & 0x18) << 5;
}
dn->exponent = exp + decimal64ExpCon (d64) - DECIMAL64_Bias; /* remove bias */
}
/* get the coefficient, unless infinite */
if (!(dn->bits & DECINF))
{
Int bunches = DECIMAL64_Pmax / 3; /* coefficient full bunches to convert */
Int odd = 0; /* assume MSD is 0 (no odd bunch) */
if (msd != 0)
{ /* coefficient has leading non-0 digit */
/* make a copy of the decimal64, with an extra bunch which has */
/* the top digit ready for conversion */
wk = *d64; /* take a copy */
wk.bytes[0] = 0; /* clear all but coecon */
wk.bytes[1] &= 0x03; /* .. */
wk.bytes[1] |= (msd << 2); /* and prefix MSD */
odd++; /* indicate the extra */
d64 = &wk; /* use the work copy */
}
decDenseUnpackCoeff (d64->bytes, sizeof (d64->bytes), dn, bunches, odd);
}
return dn;
}
/* ------------------------------------------------------------------ */
/* to-scientific-string -- conversion to numeric string */
/* to-engineering-string -- conversion to numeric string */
/* */
/* decimal64ToString(d64, string); */
/* decimal64ToEngString(d64, string); */
/* */
/* d64 is the decimal64 format number to convert */
/* string is the string where the result will be laid out */
/* */
/* string must be at least 24 characters */
/* */
/* No error is possible, and no status can be set. */
/* ------------------------------------------------------------------ */
char *
decimal64ToString (const decimal64 * d64, char *string)
{
decNumber dn; /* work */
decimal64ToNumber (d64, &dn);
decNumberToString (&dn, string);
return string;
}
char *
decimal64ToEngString (const decimal64 * d64, char *string)
{
decNumber dn; /* work */
decimal64ToNumber (d64, &dn);
decNumberToEngString (&dn, string);
return string;
}
/* ------------------------------------------------------------------ */
/* to-number -- conversion from numeric string */
/* */
/* decimal64FromString(result, string, set); */
/* */
/* result is the decimal64 format number which gets the result of */
/* the conversion */
/* *string is the character string which should contain a valid */
/* number (which may be a special value) */
/* set is the context */
/* */
/* The context is supplied to this routine is used for error handling */
/* (setting of status and traps) and for the rounding mode, only. */
/* If an error occurs, the result will be a valid decimal64 NaN. */
/* ------------------------------------------------------------------ */
decimal64 *
decimal64FromString (decimal64 * result, const char *string, decContext * set)
{
decContext dc; /* work */
decNumber dn; /* .. */
decContextDefault (&dc, DEC_INIT_DECIMAL64); /* no traps, please */
dc.round = set->round; /* use supplied rounding */
decNumberFromString (&dn, string, &dc); /* will round if needed */
decimal64FromNumber (result, &dn, &dc);
if (dc.status != 0)
{ /* something happened */
decContextSetStatus (set, dc.status); /* .. pass it on */
}
return result;
}
#if DECTRACE || DECCHECK
/* ------------------------------------------------------------------ */
/* decimal64Show -- display a single in hexadecimal [debug aid] */
/* d64 -- the number to show */
/* ------------------------------------------------------------------ */
/* Also shows sign/cob/expconfields extracted */
void
decimal64Show (const decimal64 * d64)
{
char buf[DECIMAL64_Bytes * 2 + 1];
Int i, j;
j = 0;
for (i = 0; i < DECIMAL64_Bytes; i++)
{
sprintf (&buf[j], "%02x", d64->bytes[i]);
j = j + 2;
}
printf (" D64> %s [S:%d Cb:%02x E:%d]\n", buf,
decimal64Sign (d64), decimal64Comb (d64), decimal64ExpCon (d64));
}
#endif

View File

@ -0,0 +1,116 @@
/* Decimal 64-bit format module header for the decNumber C Library
Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by IBM Corporation. Author Mike Cowlishaw.
This file is part of GCC.
GCC 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.
In addition to the permissions in the GNU General Public License,
the Free Software Foundation gives you unlimited permission to link
the compiled version of this file into combinations with other
programs, and to distribute those combinations without any
restriction coming from the use of this file. (The General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into a combine executable.)
GCC 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 GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#if !defined(DECIMAL64)
#define DECIMAL64
#define DEC64NAME "decimal64" /* Short name */
#define DEC64FULLNAME "Decimal 64-bit Number" /* Verbose name */
#define DEC64AUTHOR "Mike Cowlishaw" /* Who to blame */
#if defined(DECIMAL32)
#error decimal64.h must precede decimal32.h for correct DECNUMDIGITS
#endif
/* parameters for decimal64s */
#define DECIMAL64_Bytes 8 /* length */
#define DECIMAL64_Pmax 16 /* maximum precision (digits) */
#define DECIMAL64_Emax 384 /* maximum adjusted exponent */
#define DECIMAL64_Emin -383 /* minimum adjusted exponent */
#define DECIMAL64_Bias 398 /* bias for the exponent */
#define DECIMAL64_String 24 /* maximum string length, +1 */
/* highest biased exponent (Elimit-1) */
#define DECIMAL64_Ehigh (DECIMAL64_Emax+DECIMAL64_Bias-DECIMAL64_Pmax+1)
#ifndef DECNUMDIGITS
#define DECNUMDIGITS DECIMAL64_Pmax /* size if not already defined */
#endif
#ifndef DECNUMBER
#include "decNumber.h" /* context and number library */
#endif
/* Decimal 64-bit type, accessible by bytes */
typedef struct
{
uint8_t bytes[DECIMAL64_Bytes]; /* decimal64: 1, 5, 8, 50 bits */
} decimal64;
/* special values [top byte excluding sign bit; last two bits are
don't-care for Infinity on input, last bit don't-care for NaN] */
#if !defined(DECIMAL_NaN)
#define DECIMAL_NaN 0x7c /* 0 11111 00 NaN */
#define DECIMAL_sNaN 0x7e /* 0 11111 10 sNaN */
#define DECIMAL_Inf 0x78 /* 0 11110 00 Infinity */
#endif
/* Macros for accessing decimal64 fields. These assume the argument
is a reference (pointer) to the decimal64 structure */
/* Get sign */
#define decimal64Sign(d) ((unsigned)(d)->bytes[0]>>7)
/* Get combination field */
#define decimal64Comb(d) (((d)->bytes[0] & 0x7c)>>2)
/* Get exponent continuation [does not remove bias] */
#define decimal64ExpCon(d) ((((d)->bytes[0] & 0x03)<<6) \
| ((unsigned)(d)->bytes[1]>>2))
/* Set sign [this assumes sign previously 0] */
#define decimal64SetSign(d, b) { \
(d)->bytes[0]|=((unsigned)(b)<<7);}
/* Set exponent continuation [does not apply bias] */
/* This assumes range has been checked and exponent previously 0; type */
/* of exponent must be unsigned */
#define decimal64SetExpCon(d, e) { \
(d)->bytes[0]|=(uint8_t)((e)>>6); \
(d)->bytes[1]|=(uint8_t)(((e)&0x3F)<<2);}
/* ------------------------------------------------------------------ */
/* Routines */
/* ------------------------------------------------------------------ */
#ifdef IN_LIBGCC2
#define decimal64FromString __decimal64FromString
#define decimal64ToString __decimal64ToString
#define decimal64ToEngString __decimal64ToEngString
#define decimal64FromNumber __decimal64FromNumber
#define decimal64ToNumber __decimal64ToNumber
#endif
/* String conversions */
decimal64 *decimal64FromString (decimal64 *, const char *, decContext *);
char *decimal64ToString (const decimal64 *, char *);
char *decimal64ToEngString (const decimal64 *, char *);
/* decNumber conversions */
decimal64 *decimal64FromNumber (decimal64 *, const decNumber *, decContext *);
decNumber *decimal64ToNumber (const decimal64 *, decNumber *);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,99 @@
## Process this file with automake to produce Makefile.in
ACLOCAL_AMFLAGS = -I ../config
SUBDIRS = testsuite
## May be used by toolexeclibdir.
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
config_path = @config_path@
search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) $(top_srcdir)
fincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/finclude
libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
empty =
space = $(empty) $(empty)
VPATH = $(subst $(space),:,$(strip $(search_path)))
AM_CPPFLAGS = $(addprefix -I, $(search_path))
AM_CFLAGS = $(XCFLAGS)
AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
toolexeclib_LTLIBRARIES = libgomp.la
nodist_toolexeclib_HEADERS = libgomp.spec
if LIBGOMP_BUILD_VERSIONED_SHLIB
libgomp_version_script = -Wl,--version-script,$(top_srcdir)/libgomp.map
else
libgomp_version_script =
endif
libgomp_version_info = -version-info $(libtool_VERSION)
libgomp_la_LDFLAGS = $(libgomp_version_info) $(libgomp_version_script)
libgomp_la_SOURCES = alloc.c barrier.c critical.c env.c error.c iter.c \
loop.c ordered.c parallel.c sections.c single.c team.c work.c \
lock.c mutex.c proc.c sem.c bar.c time.c fortran.c
nodist_noinst_HEADERS = libgomp_f.h
nodist_libsubinclude_HEADERS = omp.h
if USE_FORTRAN
nodist_finclude_HEADERS = omp_lib.h omp_lib.f90 omp_lib.mod omp_lib_kinds.mod
endif
omp_lib_kinds.mod: omp_lib.mod
:
omp_lib.mod: omp_lib.f90
$(FC) $(FCFLAGS) -fsyntax-only omp_lib.f90
fortran.lo: libgomp_f.h
fortran.o: libgomp_f.h
env.lo: libgomp_f.h
env.o: libgomp_f.h
# No install-html target
.PHONY: install-html
install-html:
# Automake Documentation:
# If your package has Texinfo files in many directories, you can use the
# variable TEXINFO_TEX to tell Automake where to find the canonical
# `texinfo.tex' for your package. The value of this variable should be
# the relative path from the current `Makefile.am' to `texinfo.tex'.
TEXINFO_TEX = ../gcc/doc/include/texinfo.tex
# Defines info, dvi, pdf and html targets
MAKEINFOFLAGS = -I $(srcdir)/../gcc/doc/include
info_TEXINFOS = libgomp.texi
# AM_CONDITIONAL on configure option --generated-files-in-srcdir
if GENINSRC
STAMP_GENINSRC = stamp-geninsrc
else
STAMP_GENINSRC =
endif
# AM_CONDITIONAL on configure check ACX_CHECK_PROG_VER([MAKEINFO])
if BUILD_INFO
STAMP_BUILD_INFO = stamp-build-info
else
STAMP_BUILD_INFO =
endif
all-local: $(STAMP_GENINSRC)
stamp-geninsrc: libgomp.info
cp -p $(top_builddir)/libgomp.info $(srcdir)/libgomp.info
@touch $@
libgomp.info: $(STAMP_BUILD_INFO)
stamp-build-info: libgomp.texi
$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) -o libgomp.info $(srcdir)/libgomp.texi
@touch $@
CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) libgomp.info
MAINTAINERCLEANFILES = $(srcdir)/libgomp.info

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,303 @@
dnl ----------------------------------------------------------------------
dnl This whole bit snagged from libgfortran.
dnl Check whether the target supports __sync_*_compare_and_swap.
AC_DEFUN([LIBGOMP_CHECK_SYNC_BUILTINS], [
AC_CACHE_CHECK([whether the target supports __sync_*_compare_and_swap],
have_sync_builtins, [
AC_TRY_LINK([], [int foo, bar; bar = __sync_val_compare_and_swap(&foo, 0, 1);],
have_sync_builtins=yes, have_sync_builtins=no)])
if test $have_sync_builtins = yes; then
AC_DEFINE(HAVE_SYNC_BUILTINS, 1,
[Define to 1 if the target supports __sync_*_compare_and_swap])
fi])
dnl Check whether the target supports hidden visibility.
AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_VISIBILITY], [
AC_CACHE_CHECK([whether the target supports hidden visibility],
have_attribute_visibility, [
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
[], have_attribute_visibility=yes,
have_attribute_visibility=no)
CFLAGS="$save_CFLAGS"])
if test $have_attribute_visibility = yes; then
AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
[Define to 1 if the target supports __attribute__((visibility(...))).])
fi])
dnl Check whether the target supports dllexport
AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_DLLEXPORT], [
AC_CACHE_CHECK([whether the target supports dllexport],
have_attribute_dllexport, [
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([void __attribute__((dllexport)) foo(void) { }],
[], have_attribute_dllexport=yes,
have_attribute_dllexport=no)
CFLAGS="$save_CFLAGS"])
if test $have_attribute_dllexport = yes; then
AC_DEFINE(HAVE_ATTRIBUTE_DLLEXPORT, 1,
[Define to 1 if the target supports __attribute__((dllexport)).])
fi])
dnl Check whether the target supports symbol aliases.
AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_ALIAS], [
AC_CACHE_CHECK([whether the target supports symbol aliases],
have_attribute_alias, [
AC_TRY_LINK([
void foo(void) { }
extern void bar(void) __attribute__((alias("foo")));],
[bar();], have_attribute_alias=yes, have_attribute_alias=no)])
if test $have_attribute_alias = yes; then
AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
[Define to 1 if the target supports __attribute__((alias(...))).])
fi])
sinclude(../libtool.m4)
dnl The lines below arrange for aclocal not to bring an installed
dnl libtool.m4 into aclocal.m4, while still arranging for automake to
dnl add a definition of LIBTOOL to Makefile.in.
ifelse(,,,[AC_SUBST(LIBTOOL)
AC_DEFUN([AM_PROG_LIBTOOL])
AC_DEFUN([AC_LIBTOOL_DLOPEN])
AC_DEFUN([AC_PROG_LD])
])
dnl ----------------------------------------------------------------------
dnl This whole bit snagged from libstdc++-v3.
dnl
dnl LIBGOMP_ENABLE
dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
dnl
dnl See docs/html/17_intro/configury.html#enable for documentation.
dnl
m4_define([LIBGOMP_ENABLE],[dnl
m4_define([_g_switch],[--enable-$1])dnl
m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
AC_ARG_ENABLE($1,_g_help,
m4_bmatch([$5],
[^permit ],
[[
case "$enableval" in
m4_bpatsubst([$5],[permit ])) ;;
*) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
dnl Idea for future: generate a URL pointing to
dnl "onlinedocs/configopts.html#whatever"
esac
]],
[^$],
[[
case "$enableval" in
yes|no) ;;
*) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
esac
]],
[[$5]]),
[enable_]m4_bpatsubst([$1],-,_)[=][$2])
m4_undefine([_g_switch])dnl
m4_undefine([_g_help])dnl
])
dnl
dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
dnl the native linker is in use, all variables will be defined to something
dnl safe (like an empty string).
dnl
dnl Defines:
dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible
dnl OPT_LDFLAGS='-Wl,-O1' if possible
dnl LD (as a side effect of testing)
dnl Sets:
dnl with_gnu_ld
dnl libgomp_gnu_ld_version (possibly)
dnl
dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
dnl set libgomp_gnu_ld_version to 12345. Zeros cause problems.
dnl
AC_DEFUN([LIBGOMP_CHECK_LINKER_FEATURES], [
# If we're not using GNU ld, then there's no point in even trying these
# tests. Check for that first. We should have already tested for gld
# by now (in libtool), but require it now just to be safe...
test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
AC_REQUIRE([AC_PROG_LD])
AC_REQUIRE([AC_PROG_AWK])
# The name set by libtool depends on the version of libtool. Shame on us
# for depending on an impl detail, but c'est la vie. Older versions used
# ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
# top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
# makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
# set (hence we're using an older libtool), then set it.
if test x${with_gnu_ld+set} != xset; then
if test x${ac_cv_prog_gnu_ld+set} != xset; then
# We got through "ac_require(ac_prog_ld)" and still not set? Huh?
with_gnu_ld=no
else
with_gnu_ld=$ac_cv_prog_gnu_ld
fi
fi
# Start by getting the version number. I think the libtool test already
# does some of this, but throws away the result.
changequote(,)
ldver=`$LD --version 2>/dev/null | head -1 | \
sed -e 's/GNU ld \(version \)\{0,1\}\(([^)]*) \)\{0,1\}\([0-9.][0-9.]*\).*/\3/'`
changequote([,])
libgomp_gnu_ld_version=`echo $ldver | \
$AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
# Set --gc-sections.
if test "$with_gnu_ld" = "notbroken"; then
# GNU ld it is! Joy and bunny rabbits!
# All these tests are for C++; save the language and the compiler flags.
# Need to do this so that g++ won't try to link in libstdc++
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS='-x c++ -Wl,--gc-sections'
# Check for -Wl,--gc-sections
# XXX This test is broken at the moment, as symbols required for linking
# are now in libsupc++ (not built yet). In addition, this test has
# cored on solaris in the past. In addition, --gc-sections doesn't
# really work at the moment (keeps on discarding used sections, first
# .eh_frame and now some of the glibc sections for iconv).
# Bzzzzt. Thanks for playing, maybe next time.
AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
AC_TRY_RUN([
int main(void)
{
try { throw 1; }
catch (...) { };
return 0;
}
], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
else
# this is the suspicious part
CFLAGS=''
fi
if test "$ac_sectionLDflags" = "yes"; then
SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
fi
AC_MSG_RESULT($ac_sectionLDflags)
fi
# Set linker optimization flags.
if test x"$with_gnu_ld" = x"yes"; then
OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
fi
AC_SUBST(SECTION_LDFLAGS)
AC_SUBST(OPT_LDFLAGS)
])
dnl
dnl Add version tags to symbols in shared library (or not), additionally
dnl marking other symbols as private/local (or not).
dnl
dnl --enable-symvers=style adds a version script to the linker call when
dnl creating the shared library. The choice of version script is
dnl controlled by 'style'.
dnl --disable-symvers does not.
dnl + Usage: LIBGOMP_ENABLE_SYMVERS[(DEFAULT)]
dnl Where DEFAULT is either 'yes' or 'no'. Passing `yes' tries to
dnl choose a default style based on linker characteristics. Passing
dnl 'no' disables versioning.
dnl
AC_DEFUN([LIBGOMP_ENABLE_SYMVERS], [
LIBGOMP_ENABLE(symvers,yes,[=STYLE],
[enables symbol versioning of the shared library],
[permit yes|no|gnu])
# If we never went through the LIBGOMP_CHECK_LINKER_FEATURES macro, then we
# don't know enough about $LD to do tricks...
AC_REQUIRE([LIBGOMP_CHECK_LINKER_FEATURES])
# FIXME The following test is too strict, in theory.
if test $enable_shared = no ||
test "x$LD" = x ||
test x$libgomp_gnu_ld_version = x; then
enable_symvers=no
fi
# Check to see if libgcc_s exists, indicating that shared libgcc is possible.
if test $enable_symvers != no; then
AC_MSG_CHECKING([for shared libgcc])
ac_save_CFLAGS="$CFLAGS"
CFLAGS=' -lgcc_s'
AC_TRY_LINK(, [return 0;], libgomp_shared_libgcc=yes, libgomp_shared_libgcc=no)
CFLAGS="$ac_save_CFLAGS"
if test $libgomp_shared_libgcc = no; then
cat > conftest.c <<EOF
int main (void) { return 0; }
EOF
changequote(,)dnl
libgomp_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
-shared -shared-libgcc -o conftest.so \
conftest.c -v 2>&1 >/dev/null \
| sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
changequote([,])dnl
rm -f conftest.c conftest.so
if test x${libgomp_libgcc_s_suffix+set} = xset; then
CFLAGS=" -lgcc_s$libgomp_libgcc_s_suffix"
AC_TRY_LINK(, [return 0;], libgomp_shared_libgcc=yes)
CFLAGS="$ac_save_CFLAGS"
fi
fi
AC_MSG_RESULT($libgomp_shared_libgcc)
fi
# For GNU ld, we need at least this version. The format is described in
# LIBGOMP_CHECK_LINKER_FEATURES above.
libgomp_min_gnu_ld_version=21400
# XXXXXXXXXXX libgomp_gnu_ld_version=21390
# Check to see if unspecified "yes" value can win, given results above.
# Change "yes" into either "no" or a style name.
if test $enable_symvers = yes; then
if test $with_gnu_ld = yes &&
test $libgomp_shared_libgcc = yes;
then
if test $libgomp_gnu_ld_version -ge $libgomp_min_gnu_ld_version ; then
enable_symvers=gnu
else
# The right tools, the right setup, but too old. Fallbacks?
AC_MSG_WARN(=== Linker version $libgomp_gnu_ld_version is too old for)
AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
AC_MSG_WARN(=== You would need to upgrade your binutils to version)
AC_MSG_WARN(=== $libgomp_min_gnu_ld_version or later and rebuild GCC.)
if test $libgomp_gnu_ld_version -ge 21200 ; then
# Globbing fix is present, proper block support is not.
dnl AC_MSG_WARN([=== Dude, you are soooo close. Maybe we can fake it.])
dnl enable_symvers=???
AC_MSG_WARN([=== Symbol versioning will be disabled.])
enable_symvers=no
else
# 2.11 or older.
AC_MSG_WARN([=== Symbol versioning will be disabled.])
enable_symvers=no
fi
fi
else
# just fail for now
AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
AC_MSG_WARN([=== either you are not using a supported linker, or you are])
AC_MSG_WARN([=== not building a shared libgcc_s (which is required).])
AC_MSG_WARN([=== Symbol versioning will be disabled.])
enable_symvers=no
fi
fi
AM_CONDITIONAL(LIBGOMP_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
])

866
contrib/gcclibs/libgomp/aclocal.m4 vendored Normal file
View File

@ -0,0 +1,866 @@
# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.9.6])])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 7
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])
AC_SUBST([$1_FALSE])
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 8
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh.
touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
case $depmode in
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
none) break ;;
esac
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this.
if depmode=$depmode \
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#serial 3
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[for mf in $CONFIG_FILES; do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# So let's grep whole file.
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 12
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.58])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
# test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" &&
test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
])
])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$1 | $1:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
AC_DEFUN([AM_MAINTAINER_MODE],
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer],
USE_MAINTAINER_MODE=$enableval,
USE_MAINTAINER_MODE=no)
AC_MSG_RESULT([$USE_MAINTAINER_MODE])
AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST(MAINT)dnl
]
)
AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo done
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# We grep out `Entering directory' and `Leaving directory'
# messages which can occur if `w' ends up in MAKEFLAGS.
# In particular we don't look at `^make:' because GNU make might
# be invoked under some other name (usually "gmake"), in which
# case it prints its new name instead of `make'.
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
am__include=include
am__quote=
_am_result=GNU
fi
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
am__include=.include
am__quote="\""
_am_result=BSD
fi
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it supports --run.
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
fi
])
# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_MKDIR_P
# ---------------
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
#
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
# created by `make install' are always world readable, even if the
# installer happens to have an overly restrictive umask (e.g. 077).
# This was a mistake. There are at least two reasons why we must not
# use `-m 0755':
# - it causes special bits like SGID to be ignored,
# - it may be too restrictive (some setups expect 775 directories).
#
# Do not use -m 0755 and let people choose whatever they expect by
# setting umask.
#
# We cannot accept any implementation of `mkdir' that recognizes `-p'.
# Some implementations (such as Solaris 8's) are not thread-safe: if a
# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
# concurrently, both version can detect that a/ is missing, but only
# one can create it and the other will error out. Consequently we
# restrict ourselves to GNU make (using the --version option ensures
# this.)
AC_DEFUN([AM_PROG_MKDIR_P],
[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
# We used to keeping the `.' as first argument, in order to
# allow $(mkdir_p) to be used without argument. As in
# $(mkdir_p) $(somedir)
# where $(somedir) is conditionally defined. However this is wrong
# for two reasons:
# 1. if the package is installed by a user who cannot write `.'
# make install will fail,
# 2. the above comment should most certainly read
# $(mkdir_p) $(DESTDIR)$(somedir)
# so it does not work when $(somedir) is undefined and
# $(DESTDIR) is not.
# To support the latter case, we have to write
# test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
# so the `.' trick is pointless.
mkdir_p='mkdir -p --'
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
for d in ./-p ./--version;
do
test -d $d && rmdir $d
done
# $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
if test -f "$ac_aux_dir/mkinstalldirs"; then
mkdir_p='$(mkinstalldirs)'
else
mkdir_p='$(install_sh) -d'
fi
fi
AC_SUBST([mkdir_p])])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# ------------------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT(yes)])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of `v7', `ustar', or `pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility.
AM_MISSING_PROG([AMTAR], [tar])
m4_if([$1], [v7],
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of `-'.
for _am_tool in $_am_tools
do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar;
do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([../config/acx.m4])
m4_include([../config/depstand.m4])
m4_include([../config/enable.m4])
m4_include([../config/lead-dot.m4])
m4_include([../config/multi.m4])
m4_include([../config/stdint.m4])
m4_include([../config/tls.m4])
m4_include([acinclude.m4])

View File

@ -0,0 +1,61 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Libgomp 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 Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with libgomp; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* As a special exception, if you link this library with other files, some
of which are compiled with GCC, to produce an executable, this library
does not by itself cause the resulting executable to be covered by the
GNU General Public License. This exception does not however invalidate
any other reasons why the executable file might be covered by the GNU
General Public License. */
/* This file contains wrappers for the system allocation routines. Most
places in the OpenMP API do not make any provision for failure, so in
general we cannot allow memory allocation to fail. */
#include "libgomp.h"
#include <stdlib.h>
void *
gomp_malloc (size_t size)
{
void *ret = malloc (size);
if (ret == NULL)
gomp_fatal ("Out of memory allocating %lu bytes", (unsigned long) size);
return ret;
}
void *
gomp_malloc_cleared (size_t size)
{
void *ret = calloc (1, size);
if (ret == NULL)
gomp_fatal ("Out of memory allocating %lu bytes", (unsigned long) size);
return ret;
}
void *
gomp_realloc (void *old, size_t size)
{
void *ret = realloc (old, size);
if (ret == NULL)
gomp_fatal ("Out of memory allocating %lu bytes", (unsigned long) size);
return ret;
}

View File

@ -0,0 +1,44 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Libgomp 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 Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with libgomp; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* As a special exception, if you link this library with other files, some
of which are compiled with GCC, to produce an executable, this library
does not by itself cause the resulting executable to be covered by the
GNU General Public License. This exception does not however invalidate
any other reasons why the executable file might be covered by the GNU
General Public License. */
/* This file handles the BARRIER construct. */
#include "libgomp.h"
void
GOMP_barrier (void)
{
struct gomp_thread *thr = gomp_thread ();
struct gomp_team *team = thr->ts.team;
/* It is legal to have orphaned barriers. */
if (team == NULL)
return;
gomp_barrier_wait (&team->barrier);
}

View File

@ -0,0 +1,103 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if the target supports __attribute__((alias(...))). */
#undef HAVE_ATTRIBUTE_ALIAS
/* Define to 1 if the target supports __attribute__((dllexport)). */
#undef HAVE_ATTRIBUTE_DLLEXPORT
/* Define to 1 if the target supports __attribute__((visibility(...))). */
#undef HAVE_ATTRIBUTE_VISIBILITY
/* Define if the POSIX Semaphores do not work on your system. */
#undef HAVE_BROKEN_POSIX_SEMAPHORES
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
/* Define to 1 if you have the `getloadavg' function. */
#undef HAVE_GETLOADAVG
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <semaphore.h> header file. */
#undef HAVE_SEMAPHORE_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if the target supports __sync_*_compare_and_swap */
#undef HAVE_SYNC_BUILTINS
/* Define to 1 if you have the <sys/loadavg.h> header file. */
#undef HAVE_SYS_LOADAVG_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if the target supports thread-local storage. */
#undef HAVE_TLS
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of a `char', as computed by sizeof. */
#undef SIZEOF_CHAR
/* The size of a `int', as computed by sizeof. */
#undef SIZEOF_INT
/* The size of a `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of a `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* The size of a `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Version number of package */
#undef VERSION

View File

@ -0,0 +1,76 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Libgomp 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 Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with libgomp; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* As a special exception, if you link this library with other files, some
of which are compiled with GCC, to produce an executable, this library
does not by itself cause the resulting executable to be covered by the
GNU General Public License. This exception does not however invalidate
any other reasons why the executable file might be covered by the GNU
General Public License. */
/* Provide target-specific access to the futex system call. */
#ifndef SYS_futex
#define SYS_futex 394
#endif
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
static inline void
futex_wait (int *addr, int val)
{
register long sc_0 __asm__("$0");
register long sc_16 __asm__("$16");
register long sc_17 __asm__("$17");
register long sc_18 __asm__("$18");
register long sc_19 __asm__("$19");
sc_0 = SYS_futex;
sc_16 = (long) addr;
sc_17 = FUTEX_WAIT;
sc_18 = val;
sc_19 = 0;
__asm volatile ("callsys"
: "=r" (sc_0), "=r"(sc_19)
: "0"(sc_0), "r" (sc_16), "r"(sc_17), "r"(sc_18), "1"(sc_19)
: "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8",
"$22", "$23", "$24", "$25", "$27", "$28", "memory");
}
static inline void
futex_wake (int *addr, int count)
{
register long sc_0 __asm__("$0");
register long sc_16 __asm__("$16");
register long sc_17 __asm__("$17");
register long sc_18 __asm__("$18");
register long sc_19 __asm__("$19");
sc_0 = SYS_futex;
sc_16 = (long) addr;
sc_17 = FUTEX_WAKE;
sc_18 = count;
__asm volatile ("callsys"
: "=r" (sc_0), "=r"(sc_19)
: "0"(sc_0), "r" (sc_16), "r"(sc_17), "r"(sc_18)
: "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8",
"$22", "$23", "$24", "$25", "$27", "$28", "memory");
}

View File

@ -0,0 +1,64 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Libgomp 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 Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with libgomp; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* As a special exception, if you link this library with other files, some
of which are compiled with GCC, to produce an executable, this library
does not by itself cause the resulting executable to be covered by the
GNU General Public License. This exception does not however invalidate
any other reasons why the executable file might be covered by the GNU
General Public License. */
/* This is a Linux specific implementation of a barrier synchronization
mechanism for libgomp. This type is private to the library. This
implementation uses atomic instructions and the futex syscall. */
#include "libgomp.h"
#include "futex.h"
#include <limits.h>
void
gomp_barrier_wait_end (gomp_barrier_t *bar, bool last)
{
if (last)
{
bar->generation++;
futex_wake (&bar->generation, INT_MAX);
}
else
{
unsigned int generation = bar->generation;
gomp_mutex_unlock (&bar->mutex);
do
futex_wait (&bar->generation, generation);
while (bar->generation == generation);
}
if (__sync_add_and_fetch (&bar->arrived, -1) == 0)
gomp_mutex_unlock (&bar->mutex);
}
void
gomp_barrier_wait (gomp_barrier_t *barrier)
{
gomp_barrier_wait_end (barrier, gomp_barrier_wait_start (barrier));
}

View File

@ -0,0 +1,75 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Libgomp 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 Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with libgomp; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* As a special exception, if you link this library with other files, some
of which are compiled with GCC, to produce an executable, this library
does not by itself cause the resulting executable to be covered by the
GNU General Public License. This exception does not however invalidate
any other reasons why the executable file might be covered by the GNU
General Public License. */
/* This is a Linux specific implementation of a barrier synchronization
mechanism for libgomp. This type is private to the library. This
implementation uses atomic instructions and the futex syscall. */
#ifndef GOMP_BARRIER_H
#define GOMP_BARRIER_H 1
#include "mutex.h"
typedef struct
{
gomp_mutex_t mutex;
unsigned total;
unsigned arrived;
int generation;
} gomp_barrier_t;
static inline void gomp_barrier_init (gomp_barrier_t *bar, unsigned count)
{
gomp_mutex_init (&bar->mutex);
bar->total = count;
bar->arrived = 0;
bar->generation = 0;
}
static inline void gomp_barrier_reinit (gomp_barrier_t *bar, unsigned count)
{
gomp_mutex_lock (&bar->mutex);
bar->total = count;
gomp_mutex_unlock (&bar->mutex);
}
static inline void gomp_barrier_destroy (gomp_barrier_t *bar)
{
/* Before destroying, make sure all threads have left the barrier. */
gomp_mutex_lock (&bar->mutex);
}
extern void gomp_barrier_wait (gomp_barrier_t *);
extern void gomp_barrier_wait_end (gomp_barrier_t *, bool);
static inline bool gomp_barrier_wait_start (gomp_barrier_t *bar)
{
gomp_mutex_lock (&bar->mutex);
return ++bar->arrived == bar->total;
}
#endif /* GOMP_BARRIER_H */

View File

@ -0,0 +1,71 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Libgomp 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 Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with libgomp; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* As a special exception, if you link this library with other files, some
of which are compiled with GCC, to produce an executable, this library
does not by itself cause the resulting executable to be covered by the
GNU General Public License. This exception does not however invalidate
any other reasons why the executable file might be covered by the GNU
General Public License. */
/* Provide target-specific access to the futex system call. */
#include <sys/syscall.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
static inline void
sys_futex0(int *addr, int op, int val)
{
register long out0 asm ("out0") = (long) addr;
register long out1 asm ("out1") = op;
register long out2 asm ("out2") = val;
register long out3 asm ("out3") = 0;
register long r15 asm ("r15") = SYS_futex;
__asm __volatile ("break 0x100000"
: "=r"(r15), "=r"(out0), "=r"(out1), "=r"(out2), "=r"(out3)
: "r"(r15), "r"(out0), "r"(out1), "r"(out2), "r"(out3)
: "memory", "r8", "r10", "out4", "out5", "out6", "out7",
/* Non-stacked integer registers, minus r8, r10, r15. */
"r2", "r3", "r9", "r11", "r12", "r13", "r14", "r16", "r17", "r18",
"r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27",
"r28", "r29", "r30", "r31",
/* Predicate registers. */
"p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15",
/* Non-rotating fp registers. */
"f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
/* Branch registers. */
"b6");
}
static inline void
futex_wait (int *addr, int val)
{
sys_futex0 (addr, FUTEX_WAIT, val);
}
static inline void
futex_wake (int *addr, int count)
{
sys_futex0 (addr, FUTEX_WAKE, count);
}

View File

@ -0,0 +1,182 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Libgomp 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 Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with libgomp; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* As a special exception, if you link this library with other files, some
of which are compiled with GCC, to produce an executable, this library
does not by itself cause the resulting executable to be covered by the
GNU General Public License. This exception does not however invalidate
any other reasons why the executable file might be covered by the GNU
General Public License. */
/* This is a Linux specific implementation of the public OpenMP locking
primitives. This implementation uses atomic instructions and the futex
syscall. */
#include "libgomp.h"
#include <string.h>
#include <unistd.h>
#include <sys/syscall.h>
#include "futex.h"
/* The internal gomp_mutex_t and the external non-recursive omp_lock_t
have the same form. Re-use it. */
void
omp_init_lock (omp_lock_t *lock)
{
gomp_mutex_init (lock);
}
void
omp_destroy_lock (omp_lock_t *lock)
{
gomp_mutex_destroy (lock);
}
void
omp_set_lock (omp_lock_t *lock)
{
gomp_mutex_lock (lock);
}
void
omp_unset_lock (omp_lock_t *lock)
{
gomp_mutex_unlock (lock);
}
int
omp_test_lock (omp_lock_t *lock)
{
return __sync_bool_compare_and_swap (lock, 0, 1);
}
/* The external recursive omp_nest_lock_t form requires additional work. */
/* We need an integer to uniquely identify this thread. Most generally
this is the thread's TID, which ideally we'd get this straight from
the TLS block where glibc keeps it. Unfortunately, we can't get at
that directly.
If we don't support (or have disabled) TLS, one function call is as
good (or bad) as any other. Use the syscall all the time.
On an ILP32 system (defined here as not LP64), we can make do with
any thread-local pointer. Ideally we'd use the TLS base address,
since that requires the least amount of arithmetic, but that's not
always available directly. Make do with the gomp_thread pointer
since it's handy. */
#if !defined (HAVE_TLS)
static inline int gomp_tid (void)
{
return syscall (SYS_gettid);
}
#elif !defined(__LP64__)
static inline int gomp_tid (void)
{
return (int) gomp_thread ();
}
#else
static __thread int tid_cache;
static inline int gomp_tid (void)
{
int tid = tid_cache;
if (__builtin_expect (tid == 0, 0))
tid_cache = tid = syscall (SYS_gettid);
return tid;
}
#endif
void
omp_init_nest_lock (omp_nest_lock_t *lock)
{
memset (lock, 0, sizeof (lock));
}
void
omp_destroy_nest_lock (omp_nest_lock_t *lock)
{
}
void
omp_set_nest_lock (omp_nest_lock_t *lock)
{
int otid, tid = gomp_tid ();
while (1)
{
otid = __sync_val_compare_and_swap (&lock->owner, 0, tid);
if (otid == 0)
{
lock->count = 1;
return;
}
if (otid == tid)
{
lock->count++;
return;
}
futex_wait (&lock->owner, otid);
}
}
void
omp_unset_nest_lock (omp_nest_lock_t *lock)
{
/* ??? Validate that we own the lock here. */
if (--lock->count == 0)
{
__sync_lock_release (&lock->owner);
futex_wake (&lock->owner, 1);
}
}
int
omp_test_nest_lock (omp_nest_lock_t *lock)
{
int otid, tid = gomp_tid ();
otid = __sync_val_compare_and_swap (&lock->owner, 0, tid);
if (otid == 0)
{
lock->count = 1;
return 1;
}
if (otid == tid)
return ++lock->count;
return 0;
}
ialias (omp_init_lock)
ialias (omp_init_nest_lock)
ialias (omp_destroy_lock)
ialias (omp_destroy_nest_lock)
ialias (omp_set_lock)
ialias (omp_set_nest_lock)
ialias (omp_unset_lock)
ialias (omp_unset_nest_lock)
ialias (omp_test_lock)
ialias (omp_test_nest_lock)

View File

@ -0,0 +1,52 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Libgomp 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 Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with libgomp; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* As a special exception, if you link this library with other files, some
of which are compiled with GCC, to produce an executable, this library
does not by itself cause the resulting executable to be covered by the
GNU General Public License. This exception does not however invalidate
any other reasons why the executable file might be covered by the GNU
General Public License. */
/* This is a Linux specific implementation of a mutex synchronization
mechanism for libgomp. This type is private to the library. This
implementation uses atomic instructions and the futex syscall. */
#include "libgomp.h"
#include "futex.h"
void
gomp_mutex_lock_slow (gomp_mutex_t *mutex)
{
do
{
int oldval = __sync_val_compare_and_swap (mutex, 1, 2);
if (oldval != 0)
futex_wait (mutex, 2);
}
while (!__sync_bool_compare_and_swap (mutex, 0, 2));
}
void
gomp_mutex_unlock_slow (gomp_mutex_t *mutex)
{
futex_wake (mutex, 1);
}

View File

@ -0,0 +1,63 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Libgomp 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 Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with libgomp; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* As a special exception, if you link this library with other files, some
of which are compiled with GCC, to produce an executable, this library
does not by itself cause the resulting executable to be covered by the
GNU General Public License. This exception does not however invalidate
any other reasons why the executable file might be covered by the GNU
General Public License. */
/* This is a Linux specific implementation of a mutex synchronization
mechanism for libgomp. This type is private to the library. This
implementation uses atomic instructions and the futex syscall. */
#ifndef GOMP_MUTEX_H
#define GOMP_MUTEX_H 1
typedef int gomp_mutex_t;
#define GOMP_MUTEX_INIT_0 1
static inline void gomp_mutex_init (gomp_mutex_t *mutex)
{
*mutex = 0;
}
extern void gomp_mutex_lock_slow (gomp_mutex_t *mutex);
static inline void gomp_mutex_lock (gomp_mutex_t *mutex)
{
if (!__sync_bool_compare_and_swap (mutex, 0, 1))
gomp_mutex_lock_slow (mutex);
}
extern void gomp_mutex_unlock_slow (gomp_mutex_t *mutex);
static inline void gomp_mutex_unlock (gomp_mutex_t *mutex)
{
int val = __sync_lock_test_and_set (mutex, 0);
if (__builtin_expect (val > 1, 0))
gomp_mutex_unlock_slow (mutex);
}
static inline void gomp_mutex_destroy (gomp_mutex_t *mutex)
{
}
#endif /* GOMP_MUTEX_H */

View File

@ -0,0 +1,10 @@
/* This header is used during the build process to find the size and
alignment of the public OpenMP locks, so that we can export data
structures without polluting the namespace.
When using the Linux futex primitive, non-recursive locks require
only one int. Recursive locks require we identify the owning thread
and so require two ints. */
typedef int omp_lock_t;
typedef struct { int owner, count; } omp_nest_lock_t;

View File

@ -0,0 +1,70 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Libgomp 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 Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with libgomp; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* As a special exception, if you link this library with other files, some
of which are compiled with GCC, to produce an executable, this library
does not by itself cause the resulting executable to be covered by the
GNU General Public License. This exception does not however invalidate
any other reasons why the executable file might be covered by the GNU
General Public License. */
/* Provide target-specific access to the futex system call. */
#include <sys/syscall.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
static inline void
sys_futex0 (int *addr, int op, int val)
{
register long int r0 __asm__ ("r0");
register long int r3 __asm__ ("r3");
register long int r4 __asm__ ("r4");
register long int r5 __asm__ ("r5");
register long int r6 __asm__ ("r6");
r0 = SYS_futex;
r3 = (long) addr;
r4 = op;
r5 = val;
r6 = 0;
/* ??? The powerpc64 sysdep.h file clobbers ctr; the powerpc32 sysdep.h
doesn't. It doesn't much matter for us. In the interest of unity,
go ahead and clobber it always. */
__asm volatile ("sc"
: "=r"(r0), "=r"(r3), "=r"(r4), "=r"(r5), "=r"(r6)
: "r"(r0), "r"(r3), "r"(r4), "r"(r5), "r"(r6)
: "r7", "r8", "r9", "r10", "r11", "r12",
"cr0", "ctr", "memory");
}
static inline void
futex_wait (int *addr, int val)
{
sys_futex0 (addr, FUTEX_WAIT, val);
}
static inline void
futex_wake (int *addr, int count)
{
sys_futex0 (addr, FUTEX_WAKE, count);
}

View File

@ -0,0 +1,64 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by Jakub Jelinek <jakub@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Libgomp 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 Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with libgomp; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* As a special exception, if you link this library with other files, some
of which are compiled with GCC, to produce an executable, this library
does not by itself cause the resulting executable to be covered by the
GNU General Public License. This exception does not however invalidate
any other reasons why the executable file might be covered by the GNU
General Public License. */
/* Provide target-specific access to the futex system call. */
#include <sys/syscall.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
static inline void
sys_futex0 (int *addr, int op, int val)
{
register long int gpr2 __asm__ ("2");
register long int gpr3 __asm__ ("3");
register long int gpr4 __asm__ ("4");
register long int gpr5 __asm__ ("5");
gpr2 = (long) addr;
gpr3 = op;
gpr4 = val;
gpr5 = 0;
__asm volatile ("svc %b1"
: "=d" (gpr2)
: "i" (SYS_futex),
"0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
: "memory");
}
static inline void
futex_wait (int *addr, int val)
{
sys_futex0 (addr, FUTEX_WAIT, val);
}
static inline void
futex_wake (int *addr, int count)
{
sys_futex0 (addr, FUTEX_WAKE, count);
}

View File

@ -0,0 +1,65 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Libgomp 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 Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with libgomp; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* As a special exception, if you link this library with other files, some
of which are compiled with GCC, to produce an executable, this library
does not by itself cause the resulting executable to be covered by the
GNU General Public License. This exception does not however invalidate
any other reasons why the executable file might be covered by the GNU
General Public License. */
/* This is a Linux specific implementation of a semaphore synchronization
mechanism for libgomp. This type is private to the library. This
implementation uses atomic instructions and the futex syscall. */
#include "libgomp.h"
#include "futex.h"
void
gomp_sem_wait_slow (gomp_sem_t *sem)
{
while (1)
{
int val = __sync_val_compare_and_swap (sem, 0, -1);
if (val > 0)
{
if (__sync_bool_compare_and_swap (sem, val, val - 1))
return;
}
futex_wait (sem, -1);
}
}
void
gomp_sem_post_slow (gomp_sem_t *sem)
{
int old, tmp = *sem, wake;
do
{
old = tmp;
wake = old > 0 ? old + 1 : 1;
tmp = __sync_val_compare_and_swap (sem, old, wake);
}
while (old != tmp);
futex_wake (sem, wake);
}

View File

@ -0,0 +1,60 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Libgomp 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 Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with libgomp; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* As a special exception, if you link this library with other files, some
of which are compiled with GCC, to produce an executable, this library
does not by itself cause the resulting executable to be covered by the
GNU General Public License. This exception does not however invalidate
any other reasons why the executable file might be covered by the GNU
General Public License. */
/* This is a Linux specific implementation of a semaphore synchronization
mechanism for libgomp. This type is private to the library. This
implementation uses atomic instructions and the futex syscall. */
#ifndef GOMP_SEM_H
#define GOMP_SEM_H 1
typedef int gomp_sem_t;
static inline void gomp_sem_init (gomp_sem_t *sem, int value)
{
*sem = value;
}
extern void gomp_sem_wait_slow (gomp_sem_t *);
static inline void gomp_sem_wait (gomp_sem_t *sem)
{
if (!__sync_bool_compare_and_swap (sem, 1, 0))
gomp_sem_wait_slow (sem);
}
extern void gomp_sem_post_slow (gomp_sem_t *);
static inline void gomp_sem_post (gomp_sem_t *sem)
{
if (!__sync_bool_compare_and_swap (sem, 0, 1))
gomp_sem_post_slow (sem);
}
static inline void gomp_sem_destroy (gomp_sem_t *sem)
{
}
#endif /* GOMP_SEM_H */

View File

@ -0,0 +1,80 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by Jakub Jelinek <jakub@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Libgomp 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 Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with libgomp; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* As a special exception, if you link this library with other files, some
of which are compiled with GCC, to produce an executable, this library
does not by itself cause the resulting executable to be covered by the
GNU General Public License. This exception does not however invalidate
any other reasons why the executable file might be covered by the GNU
General Public License. */
/* Provide target-specific access to the futex system call. */
#include <sys/syscall.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
static inline void
sys_futex0 (int *addr, int op, int val)
{
register long int g1 __asm__ ("g1");
register long int o0 __asm__ ("o0");
register long int o1 __asm__ ("o1");
register long int o2 __asm__ ("o2");
register long int o3 __asm__ ("o3");
g1 = SYS_futex;
o0 = (long) addr;
o1 = op;
o2 = val;
o3 = 0;
#ifdef __arch64__
# define SYSCALL_STRING "ta\t0x6d"
#else
# define SYSCALL_STRING "ta\t0x10"
#endif
__asm volatile (SYSCALL_STRING
: "=r" (g1), "=r" (o0)
: "0" (g1), "1" (o0), "r" (o1), "r" (o2), "r" (o3)
: "g2", "g3", "g4", "g5", "g6",
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
"f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
#ifdef __arch64__
"f32", "f34", "f36", "f38", "f40", "f42", "f44", "f46",
"f48", "f50", "f52", "f54", "f56", "f58", "f60", "f62",
#endif
"cc", "memory");
}
static inline void
futex_wait (int *addr, int val)
{
sys_futex0 (addr, FUTEX_WAIT, val);
}
static inline void
futex_wake (int *addr, int count)
{
sys_futex0 (addr, FUTEX_WAKE, count);
}

View File

@ -0,0 +1,110 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Libgomp 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 Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with libgomp; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* As a special exception, if you link this library with other files, some
of which are compiled with GCC, to produce an executable, this library
does not by itself cause the resulting executable to be covered by the
GNU General Public License. This exception does not however invalidate
any other reasons why the executable file might be covered by the GNU
General Public License. */
/* Provide target-specific access to the futex system call. */
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#ifdef __LP64__
# ifndef SYS_futex
# define SYS_futex 202
# endif
static inline void
futex_wait (int *addr, int val)
{
register long r10 __asm__("%r10") = 0;
long res;
__asm volatile ("syscall"
: "=a" (res)
: "0"(SYS_futex), "D" (addr), "S"(FUTEX_WAIT),
"d"(val), "r"(r10)
: "r11", "rcx", "memory");
}
static inline void
futex_wake (int *addr, int count)
{
long res;
__asm volatile ("syscall"
: "=a" (res)
: "0"(SYS_futex), "D" (addr), "S"(FUTEX_WAKE), "d"(count)
: "r11", "rcx", "memory");
}
#else
# ifndef SYS_futex
# define SYS_futex 240
# endif
# ifdef __PIC__
static inline void
sys_futex0 (int *addr, int op, int val)
{
long res;
__asm volatile ("xchgl\t%%ebx, %2\n\t"
"int\t$0x80\n\t"
"xchgl\t%%ebx, %2"
: "=a" (res)
: "0"(SYS_futex), "r" (addr), "c"(op),
"d"(val), "S"(0)
: "memory");
}
# else
static inline void
sys_futex0 (int *addr, int op, int val)
{
long res;
__asm volatile ("int $0x80"
: "=a" (res)
: "0"(SYS_futex), "b" (addr), "c"(op),
"d"(val), "S"(0)
: "memory");
}
# endif /* __PIC__ */
static inline void
futex_wait (int *addr, int val)
{
sys_futex0 (addr, FUTEX_WAIT, val);
}
static inline void
futex_wake (int *addr, int count)
{
sys_futex0 (addr, FUTEX_WAKE, count);
}
#endif /* __LP64__ */

Some files were not shown because too many files have changed in this diff Show More