mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-07-10 13:29:52 -04:00
lubucl: Update from upstream v1.01 to v1.03
Should hopefully address the small pile of windows build warnings Change-Id: I0bc493ce5c76591eb2e663894702d003933fe14b
This commit is contained in:
parent
f69d40564d
commit
04a7a60f8b
74 changed files with 8168 additions and 1661 deletions
340
tools/ucl/acc/ACC_LICENSE
Normal file
340
tools/ucl/acc/ACC_LICENSE
Normal file
|
|
@ -0,0 +1,340 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 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) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
94
tools/ucl/acc/acc.h
Normal file
94
tools/ucl/acc/acc.h
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Possible configuration values:
|
||||
*
|
||||
* ACC_CONFIG_NO_HEADER
|
||||
* ACC_CONFIG_HEADER if given, then use this as <config.h>
|
||||
* ACC_CONFIG_INCLUDE include path to acc_ files
|
||||
*
|
||||
* ACC_CONFIG_PREFER___INT64 [acc_type.h]
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __ACC_H_INCLUDED
|
||||
#define __ACC_H_INCLUDED 1
|
||||
|
||||
#define ACC_VERSION 20040715L
|
||||
|
||||
#if !defined(ACC_CONFIG_INCLUDE)
|
||||
# define ACC_CONFIG_INCLUDE(file) file
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__CYGWIN32__) && !defined(__CYGWIN__)
|
||||
# define __CYGWIN__ __CYGWIN32__
|
||||
#endif
|
||||
#if defined(__IBMCPP__) && !defined(__IBMC__)
|
||||
# define __IBMC__ __IBMCPP__
|
||||
#endif
|
||||
#if defined(__ICL) && defined(_WIN32) && !defined(__INTEL_COMPILER)
|
||||
# define __INTEL_COMPILER __ICL
|
||||
#endif
|
||||
|
||||
#if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE)
|
||||
# define _ALL_SOURCE 1
|
||||
#endif
|
||||
|
||||
/* disable pedantic warnings for undefined preprocessing symbols */
|
||||
#if defined(__INTEL_COMPILER) && defined(__linux__)
|
||||
# pragma warning(disable: 193)
|
||||
#endif
|
||||
#if defined(__KEIL__) && defined(__C166__)
|
||||
# pragma warning disable = 322
|
||||
#elif 0 && defined(__C251__)
|
||||
# pragma warning disable = 322
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__)
|
||||
# if (_MSC_VER >= 1300)
|
||||
# pragma warning(disable: 4668)
|
||||
# endif
|
||||
#endif
|
||||
#if 0 && defined(__WATCOMC__)
|
||||
# if (__WATCOMC__ < 1060)
|
||||
# pragma warning 203 9
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#include <limits.h>
|
||||
#include ACC_CONFIG_INCLUDE("acc_init.h")
|
||||
#include ACC_CONFIG_INCLUDE("acc_os.h")
|
||||
#include ACC_CONFIG_INCLUDE("acc_cc.h")
|
||||
#include ACC_CONFIG_INCLUDE("acc_arch.h")
|
||||
#include ACC_CONFIG_INCLUDE("acc_mm.h")
|
||||
#include ACC_CONFIG_INCLUDE("acc_defs.h")
|
||||
|
||||
#if defined(ACC_CONFIG_NO_HEADER)
|
||||
#elif defined(ACC_CONFIG_HEADER)
|
||||
# include ACC_CONFIG_HEADER
|
||||
#else
|
||||
# include ACC_CONFIG_INCLUDE("acc_auto.h")
|
||||
#endif
|
||||
|
||||
#include ACC_CONFIG_INCLUDE("acc_type.h")
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
124
tools/ucl/acc/acc_arch.h
Normal file
124
tools/ucl/acc/acc_arch.h
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* CPU architecture - exactly one of:
|
||||
*
|
||||
* ACC_ARCH_UNKNOWN [default]
|
||||
* ACC_ARCH_ALPHA
|
||||
* ACC_ARCH_AMD64 aka x86-64 or ia32e
|
||||
* ACC_ARCH_C166
|
||||
* ACC_ARCH_IA16 Intel Architecture (8088, 8086, 80186, 80286)
|
||||
* ACC_ARCH_IA32 Intel Architecture (80386+)
|
||||
* ACC_ARCH_IA64 Intel Architecture (Itanium)
|
||||
* ACC_ARCH_M68K Motorola 680x0
|
||||
* ACC_ARCH_MCS251
|
||||
* ACC_ARCH_MCS51
|
||||
* ACC_ARCH_PPC64 Power PC
|
||||
* ACC_ARCH_SPARC64
|
||||
*
|
||||
* Optionally define one of:
|
||||
* ACC_ENDIAN_LITTLE_ENDIAN
|
||||
* ACC_ENDIAN_BIG_ENDIAN
|
||||
*
|
||||
* Note that this list is not exhaustive - actually we only really care
|
||||
* about architectures which allow unaligned memory access at reasonable
|
||||
* speed (for the moment this means IA16, IA32 and AMD64).
|
||||
*/
|
||||
|
||||
#if (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16)
|
||||
# define ACC_ARCH_IA16 1
|
||||
# define ACC_INFO_ARCH "ia16"
|
||||
#elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64)
|
||||
# define ACC_ARCH_AMD64 1
|
||||
# define ACC_INFO_ARCH "amd64"
|
||||
#elif (UINT_MAX <= ACC_0xffffL) && defined(__AVR__)
|
||||
# define ACC_ARCH_AVR 1
|
||||
# define ACC_INFO_ARCH "avr"
|
||||
#elif (UINT_MAX == ACC_0xffffL) && defined(__C166__)
|
||||
# define ACC_ARCH_C166 1
|
||||
# define ACC_INFO_ARCH "c166"
|
||||
#elif (UINT_MAX == ACC_0xffffL) && defined(__C251__)
|
||||
# define ACC_ARCH_MCS251 1
|
||||
# define ACC_INFO_ARCH "mcs-251"
|
||||
#elif (UINT_MAX == ACC_0xffffL) && defined(__C51__)
|
||||
# define ACC_ARCH_MCS51 1
|
||||
# define ACC_INFO_ARCH "mcs-51"
|
||||
#elif defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386)
|
||||
# define ACC_ARCH_IA32 1
|
||||
# define ACC_INFO_ARCH "ia32"
|
||||
#elif (ACC_CC_ZORTECHC && defined(__I86__))
|
||||
# define ACC_ARCH_IA32 1
|
||||
# define ACC_INFO_ARCH "ia32"
|
||||
#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
|
||||
# define ACC_ARCH_IA64 1
|
||||
# define ACC_INFO_ARCH "ia64"
|
||||
#elif (ACC_OS_DOS32 && ACC_CC_HIGHC) && defined(_I386)
|
||||
# define ACC_ARCH_IA32 1
|
||||
# define ACC_INFO_ARCH "ia32"
|
||||
#elif (ACC_OS_DOS32 || ACC_OS_OS2)
|
||||
# error "missing define for CPU architecture"
|
||||
#elif (ACC_OS_WIN32)
|
||||
# error "missing define for CPU architecture"
|
||||
#elif (ACC_OS_WIN64)
|
||||
/* # error "missing define for CPU architecture" */
|
||||
#elif (ACC_OS_TOS) || defined(__m68000__)
|
||||
# define ACC_ARCH_M68K 1
|
||||
# define ACC_INFO_ARCH "m68k"
|
||||
#elif defined(__alpha__) || defined(__alpha)
|
||||
# define ACC_ARCH_ALPHA 1
|
||||
# define ACC_INFO_ARCH "alpha"
|
||||
#elif defined(__ppc64__) || defined(__ppc64)
|
||||
# define ACC_ARCH_PPC64 1
|
||||
# define ACC_INFO_ARCH "ppc64"
|
||||
#elif defined(__sparc64__) || defined(__sparc64)
|
||||
# define ACC_ARCH_SPARC64 1
|
||||
# define ACC_INFO_ARCH "sparc64"
|
||||
#else
|
||||
# define ACC_ARCH_UNKNOWN 1
|
||||
# define ACC_INFO_ARCH "unknown"
|
||||
#endif
|
||||
|
||||
|
||||
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA16 || ACC_ARCH_IA32)
|
||||
# define ACC_ENDIAN_LITTLE_ENDIAN 1
|
||||
# define ACC_INFO_ENDIAN "little-endian"
|
||||
#elif (ACC_ARCH_M68K)
|
||||
# define ACC_ENDIAN_BIG_ENDIAN 1
|
||||
# define ACC_INFO_ENDIAN "big-endian"
|
||||
#endif
|
||||
|
||||
|
||||
#if (ACC_ARCH_IA16)
|
||||
# if (UINT_MAX != ACC_0xffffL)
|
||||
# error "this should not happen"
|
||||
# endif
|
||||
# if (ULONG_MAX != ACC_0xffffffffL)
|
||||
# error "this should not happen"
|
||||
# endif
|
||||
#endif
|
||||
#if (ACC_ARCH_IA32)
|
||||
# if (UINT_MAX != ACC_0xffffffffL)
|
||||
# error "this should not happen"
|
||||
# endif
|
||||
# if (ULONG_MAX != ACC_0xffffffffL)
|
||||
# error "this should not happen"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
660
tools/ucl/acc/acc_auto.h
Normal file
660
tools/ucl/acc/acc_auto.h
Normal file
|
|
@ -0,0 +1,660 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Possible configuration values:
|
||||
*
|
||||
* ACC_CONFIG_AUTO_NO_HEADERS
|
||||
* ACC_CONFIG_AUTO_NO_FUNCTIONS
|
||||
* ACC_CONFIG_AUTO_NO_SIZES
|
||||
*/
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// Checks for <stdint.h>
|
||||
**************************************************************************/
|
||||
|
||||
#if !defined(ACC_CONFIG_AUTO_NO_HEADERS)
|
||||
|
||||
#if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
|
||||
# if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1))
|
||||
# define HAVE_STDINT_H 1
|
||||
# endif
|
||||
#elif defined(__dietlibc__)
|
||||
# undef HAVE_STDINT_H /* incomplete */
|
||||
#elif (ACC_CC_BORLANDC) && (__BORLANDC__ >= 0x560)
|
||||
# undef HAVE_STDINT_H /* broken & incomplete */
|
||||
#elif (ACC_CC_DMC) && (__DMC__ >= 0x825)
|
||||
# define HAVE_STDINT_H 1
|
||||
#endif
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#endif /* !defined(ACC_CONFIG_AUTO_NO_HEADERS) */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// Checks for header files
|
||||
**************************************************************************/
|
||||
|
||||
#if !defined(ACC_CONFIG_AUTO_NO_HEADERS)
|
||||
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
#define HAVE_ASSERT_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_DIRENT_H 1
|
||||
#define HAVE_ERRNO_H 1
|
||||
#define HAVE_FCNTL_H 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define HAVE_MALLOC_H 1
|
||||
#define HAVE_MEMORY_H 1
|
||||
#define HAVE_SETJMP_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_STDDEF_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define HAVE_STDLIB_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_TIME_H 1
|
||||
#define HAVE_UNISTD_H 1
|
||||
#define HAVE_UTIME_H 1
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
#undef HAVE_ALLOCA_H
|
||||
#undef HAVE_CONIO_H
|
||||
#undef HAVE_DIRECT_H
|
||||
#undef HAVE_DOS_H
|
||||
#undef HAVE_IO_H
|
||||
#undef HAVE_SHARE_H
|
||||
#undef HAVE_STDINT_H
|
||||
#undef HAVE_STRINGS_H
|
||||
#undef HAVE_SYS_UTIME_H
|
||||
|
||||
|
||||
#if (ACC_OS_POSIX)
|
||||
# define HAVE_STRINGS_H 1
|
||||
# if (ACC_OS_POSIX_FREEBSD || ACC_OS_POSIX_MACOSX || ACC_OS_POSIX_OPENBSD)
|
||||
# undef HAVE_MALLOC_H /* deprecated */
|
||||
# elif (ACC_OS_POSIX_HPUX || ACC_OS_POSIX_INTERIX)
|
||||
# define HAVE_ALLOCA_H 1
|
||||
# endif
|
||||
# if (ACC_OS_POSIX_MACOSX && ACC_CC_MWERKS) && defined(__MSL__)
|
||||
/* FIXME ??? */
|
||||
# undef HAVE_SYS_TIME_H
|
||||
# undef HAVE_SYS_TYPES_H
|
||||
# endif
|
||||
#elif (ACC_OS_CYGWIN)
|
||||
# define HAVE_IO_H 1
|
||||
#elif (ACC_OS_EMX)
|
||||
# define HAVE_ALLOCA_H 1
|
||||
# define HAVE_IO_H 1
|
||||
#elif (ACC_OS_TOS && ACC_CC_GNUC)
|
||||
# if !defined(__MINT__)
|
||||
# undef HAVE_MALLOC_H
|
||||
# endif
|
||||
#elif (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
|
||||
# undef HAVE_DIRENT_H
|
||||
# undef HAVE_FCNTL_H
|
||||
# undef HAVE_MALLOC_H
|
||||
# undef HAVE_MEMORY_H
|
||||
# undef HAVE_UNISTD_H
|
||||
# undef HAVE_UTIME_H
|
||||
# undef HAVE_SYS_STAT_H
|
||||
# undef HAVE_SYS_TIME_H
|
||||
# undef HAVE_SYS_TYPES_H
|
||||
#endif
|
||||
|
||||
|
||||
/* DOS, OS/2 & Windows */
|
||||
#if (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
|
||||
#define HAVE_CONIO_H 1
|
||||
#define HAVE_DIRECT_H 1
|
||||
#define HAVE_DOS_H 1
|
||||
#define HAVE_IO_H 1
|
||||
#define HAVE_SHARE_H 1
|
||||
|
||||
#if (ACC_CC_AZTECC)
|
||||
# undef HAVE_CONIO_H
|
||||
# undef HAVE_DIRECT_H
|
||||
# undef HAVE_DIRENT_H
|
||||
# undef HAVE_MALLOC_H
|
||||
# undef HAVE_SHARE_H
|
||||
# undef HAVE_UNISTD_H
|
||||
# undef HAVE_UTIME_H
|
||||
# undef HAVE_SYS_STAT_H
|
||||
# undef HAVE_SYS_TIME_H
|
||||
# undef HAVE_SYS_TYPES_H
|
||||
#elif (ACC_CC_BORLANDC)
|
||||
# undef HAVE_UNISTD_H
|
||||
# undef HAVE_SYS_TIME_H
|
||||
# if (ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
# undef HAVE_DIRENT_H /* pulls in <windows.h>; use <dir.h> instead */
|
||||
# endif
|
||||
# if (__BORLANDC__ < 0x0400)
|
||||
# undef HAVE_DIRENT_H
|
||||
# undef HAVE_UTIME_H
|
||||
# endif
|
||||
#elif (ACC_CC_DMC)
|
||||
# undef HAVE_DIRENT_H /* not working */
|
||||
# undef HAVE_UNISTD_H /* not working */
|
||||
# define HAVE_SYS_DIRENT_H 1
|
||||
#elif (ACC_OS_DOS32 && ACC_CC_GNUC) && defined(__DJGPP__)
|
||||
#elif (ACC_OS_DOS32 && ACC_CC_HIGHC)
|
||||
# define HAVE_ALLOCA_H 1
|
||||
# undef HAVE_DIRENT_H
|
||||
# undef HAVE_UNISTD_H
|
||||
#elif (ACC_CC_IBMC && ACC_OS_OS2)
|
||||
# undef HAVE_DOS_H
|
||||
# undef HAVE_DIRENT_H
|
||||
# undef HAVE_UNISTD_H
|
||||
# undef HAVE_UTIME_H
|
||||
# undef HAVE_SYS_TIME_H
|
||||
# define HAVE_SYS_UTIME_H 1
|
||||
#elif (ACC_CC_INTELC || ACC_CC_MSC)
|
||||
# undef HAVE_DIRENT_H
|
||||
# undef HAVE_UNISTD_H
|
||||
# undef HAVE_UTIME_H
|
||||
# undef HAVE_SYS_TIME_H
|
||||
# define HAVE_SYS_UTIME_H 1
|
||||
#elif (ACC_CC_LCC)
|
||||
# undef HAVE_DIRENT_H
|
||||
# undef HAVE_DOS_H
|
||||
# undef HAVE_SYS_TIME_H
|
||||
#elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__MINGW32__)
|
||||
# undef HAVE_UTIME_H
|
||||
# define HAVE_SYS_UTIME_H 1
|
||||
#elif (ACC_OS_WIN32 && ACC_CC_MWERKS) && defined(__MSL__)
|
||||
# define HAVE_ALLOCA_H 1
|
||||
# undef HAVE_DOS_H
|
||||
# undef HAVE_SHARE_H
|
||||
# undef HAVE_SYS_TIME_H
|
||||
#elif (ACC_CC_NDPC)
|
||||
# undef HAVE_DIRENT_H
|
||||
# undef HAVE_DOS_H
|
||||
# undef HAVE_UNISTD_H
|
||||
# undef HAVE_UTIME_H
|
||||
# undef HAVE_SYS_TIME_H
|
||||
#elif (ACC_CC_PACIFICC)
|
||||
# undef HAVE_DIRECT_H
|
||||
# undef HAVE_DIRENT_H
|
||||
# undef HAVE_FCNTL_H
|
||||
# undef HAVE_IO_H
|
||||
# undef HAVE_MALLOC_H
|
||||
# undef HAVE_MEMORY_H
|
||||
# undef HAVE_SHARE_H
|
||||
# undef HAVE_UNISTD_H
|
||||
# undef HAVE_UTIME_H
|
||||
# undef HAVE_SYS_STAT_H
|
||||
# undef HAVE_SYS_TIME_H
|
||||
# undef HAVE_SYS_TYPES_H
|
||||
#elif (ACC_OS_WIN32 && ACC_CC_PELLESC)
|
||||
# undef HAVE_DIRENT_H
|
||||
# undef HAVE_DOS_H
|
||||
# undef HAVE_MALLOC_H
|
||||
# undef HAVE_SHARE_H
|
||||
# undef HAVE_UNISTD_H
|
||||
# undef HAVE_UTIME_H
|
||||
# undef HAVE_SYS_TIME_H
|
||||
# if (__POCC__ < 280)
|
||||
# else
|
||||
# define HAVE_SYS_UTIME_H 1
|
||||
# endif
|
||||
#elif (ACC_OS_WIN32 && ACC_CC_PGI) && defined(__MINGW32__)
|
||||
# undef HAVE_UTIME_H
|
||||
# define HAVE_SYS_UTIME_H 1
|
||||
#elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__PW32__)
|
||||
#elif (ACC_CC_SYMANTECC)
|
||||
# undef HAVE_DIRENT_H /* opendir() not implemented in libc */
|
||||
# undef HAVE_UNISTD_H /* not working */
|
||||
# if (__SC__ < 0x700)
|
||||
# undef HAVE_UTIME_H
|
||||
# undef HAVE_SYS_TIME_H
|
||||
# endif
|
||||
#elif (ACC_CC_TOPSPEEDC)
|
||||
# undef HAVE_DIRENT_H
|
||||
# undef HAVE_UNISTD_H
|
||||
# undef HAVE_UTIME_H
|
||||
# undef HAVE_SYS_STAT_H
|
||||
# undef HAVE_SYS_TIME_H
|
||||
# undef HAVE_SYS_TYPES_H
|
||||
#elif (ACC_CC_TURBOC)
|
||||
# undef HAVE_UNISTD_H
|
||||
# undef HAVE_SYS_TIME_H
|
||||
# undef HAVE_SYS_TYPES_H /* useless */
|
||||
# if (ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
# undef HAVE_DIRENT_H /* pulls in <windows.h>; use <dir.h> instead */
|
||||
# endif
|
||||
# if (__TURBOC__ < 0x0200)
|
||||
# undef HAVE_SIGNAL_H /* not working */
|
||||
# endif
|
||||
# if (__TURBOC__ < 0x0400)
|
||||
# undef HAVE_DIRECT_H
|
||||
# undef HAVE_DIRENT_H
|
||||
# undef HAVE_MALLOC_H
|
||||
# undef HAVE_MEMORY_H
|
||||
# undef HAVE_UTIME_H
|
||||
# endif
|
||||
#elif (ACC_CC_WATCOMC)
|
||||
# undef HAVE_DIRENT_H
|
||||
# undef HAVE_UTIME_H
|
||||
# undef HAVE_SYS_TIME_H
|
||||
# define HAVE_SYS_UTIME_H 1
|
||||
# if (__WATCOMC__ < 950)
|
||||
# undef HAVE_UNISTD_H
|
||||
# endif
|
||||
#elif (ACC_CC_ZORTECHC)
|
||||
# undef HAVE_DIRENT_H
|
||||
# undef HAVE_MEMORY_H
|
||||
# undef HAVE_UNISTD_H
|
||||
# undef HAVE_UTIME_H
|
||||
# undef HAVE_SYS_TIME_H
|
||||
#endif
|
||||
|
||||
#endif /* DOS, OS/2 & Windows */
|
||||
|
||||
|
||||
#if (HAVE_SYS_TIME_H && HAVE_TIME_H)
|
||||
# define TIME_WITH_SYS_TIME 1
|
||||
#endif
|
||||
|
||||
#endif /* !defined(ACC_CONFIG_AUTO_NO_HEADERS) */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// Checks for library functions
|
||||
**************************************************************************/
|
||||
|
||||
#if !defined(ACC_CONFIG_AUTO_NO_FUNCTIONS)
|
||||
|
||||
#define HAVE_ACCESS 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_ATEXIT 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_ATOL 1
|
||||
#define HAVE_CHMOD 1
|
||||
#define HAVE_CHOWN 1
|
||||
#define HAVE_CTIME 1
|
||||
#define HAVE_DIFFTIME 1
|
||||
#define HAVE_FILENO 1
|
||||
#define HAVE_FSTAT 1
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
#define HAVE_GMTIME 1
|
||||
#define HAVE_LOCALTIME 1
|
||||
#define HAVE_LONGJMP 1
|
||||
#define HAVE_LSTAT 1
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_MEMSET 1
|
||||
#define HAVE_MKTIME 1
|
||||
#define HAVE_QSORT 1
|
||||
#define HAVE_RAISE 1
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_SIGNAL 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_STAT 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRERROR 1
|
||||
#define HAVE_STRFTIME 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_TIME 1
|
||||
#define HAVE_UMASK 1
|
||||
#define HAVE_UTIME 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
|
||||
#if (ACC_OS_BEOS || ACC_OS_CYGWIN || ACC_OS_POSIX || ACC_OS_QNX)
|
||||
# define HAVE_STRCASECMP 1
|
||||
# define HAVE_STRNCASECMP 1
|
||||
#elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__PW32__)
|
||||
# define HAVE_STRCASECMP 1
|
||||
# define HAVE_STRNCASECMP 1
|
||||
#else
|
||||
# define HAVE_STRICMP 1
|
||||
# define HAVE_STRNICMP 1
|
||||
#endif
|
||||
|
||||
|
||||
#if (ACC_OS_POSIX)
|
||||
# if (ACC_CC_TINYC)
|
||||
# undef HAVE_ALLOCA
|
||||
# elif defined(__dietlibc__)
|
||||
# endif
|
||||
# if (ACC_OS_POSIX_MACOSX && ACC_CC_MWERKS) && defined(__MSL__)
|
||||
/* FIXME ??? */
|
||||
# undef HAVE_CHOWN
|
||||
# undef HAVE_LSTAT
|
||||
# endif
|
||||
#elif (ACC_OS_CYGWIN)
|
||||
# if (ACC_CC_GNUC < 0x025a00ul)
|
||||
# undef HAVE_GETTIMEOFDAY
|
||||
# undef HAVE_LSTAT
|
||||
# endif
|
||||
# if (ACC_CC_GNUC < 0x025f00ul)
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_VSNPRINTF
|
||||
# endif
|
||||
#elif (ACC_OS_EMX)
|
||||
# undef HAVE_CHOWN
|
||||
# undef HAVE_LSTAT
|
||||
#elif (ACC_OS_TOS && ACC_CC_GNUC)
|
||||
# if !defined(__MINT__)
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_VSNPRINTF
|
||||
# endif
|
||||
#elif (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
|
||||
# undef HAVE_ALLOCA
|
||||
# undef HAVE_ACCESS
|
||||
# undef HAVE_CHMOD
|
||||
# undef HAVE_CHOWN
|
||||
# undef HAVE_FSTAT
|
||||
# undef HAVE_GETTIMEOFDAY
|
||||
# undef HAVE_LSTAT
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_UMASK
|
||||
# undef HAVE_UTIME
|
||||
# undef HAVE_VSNPRINTF
|
||||
#endif
|
||||
|
||||
|
||||
/* DOS, OS/2 & Windows */
|
||||
#if (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
|
||||
#undef HAVE_CHOWN
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
#undef HAVE_LSTAT
|
||||
#undef HAVE_UMASK
|
||||
|
||||
#if (ACC_CC_AZTECC)
|
||||
# undef HAVE_ALLOCA
|
||||
# undef HAVE_DIFFTIME /* difftime() is in the math library */
|
||||
# undef HAVE_FSTAT
|
||||
# undef HAVE_STRDUP /* missing in 5.2a */
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_UTIME /* struct utimbuf is missing */
|
||||
# undef HAVE_VSNPRINTF
|
||||
#elif (ACC_CC_BORLANDC)
|
||||
# if (__BORLANDC__ < 0x0400)
|
||||
# undef HAVE_ALLOCA
|
||||
# undef HAVE_UTIME
|
||||
# endif
|
||||
# if ((__BORLANDC__ < 0x0410) && ACC_OS_WIN16)
|
||||
# undef HAVE_ALLOCA
|
||||
# endif
|
||||
# if (__BORLANDC__ < 0x0550)
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_VSNPRINTF
|
||||
# endif
|
||||
#elif (ACC_CC_DMC)
|
||||
# if (ACC_OS_WIN16)
|
||||
# undef HAVE_ALLOCA
|
||||
# endif
|
||||
# define snprintf _snprintf
|
||||
# define vsnprintf _vsnprintf
|
||||
#elif (ACC_OS_DOS32 && ACC_CC_GNUC) && defined(__DJGPP__)
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_VSNPRINTF
|
||||
#elif (ACC_OS_DOS32 && ACC_CC_HIGHC)
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_VSNPRINTF
|
||||
#elif (ACC_CC_IBMC)
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_VSNPRINTF
|
||||
#elif (ACC_CC_INTELC)
|
||||
# define snprintf _snprintf
|
||||
# define vsnprintf _vsnprintf
|
||||
#elif (ACC_CC_LCC)
|
||||
# define utime _utime
|
||||
#elif (ACC_CC_MSC)
|
||||
# if (_MSC_VER < 600)
|
||||
# undef HAVE_STRFTIME
|
||||
# endif
|
||||
# if (_MSC_VER < 700)
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_VSNPRINTF
|
||||
# else
|
||||
# define snprintf _snprintf
|
||||
# define vsnprintf _vsnprintf
|
||||
# endif
|
||||
# if ((_MSC_VER < 800) && ACC_OS_WIN16)
|
||||
# undef HAVE_ALLOCA
|
||||
# endif
|
||||
# if (ACC_ARCH_IA16) && defined(__cplusplus)
|
||||
# undef HAVE_LONGJMP
|
||||
# undef HAVE_SETJMP
|
||||
# endif
|
||||
#elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__MINGW32__)
|
||||
# if (ACC_CC_GNUC < 0x025f00ul)
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_VSNPRINTF
|
||||
# else
|
||||
# define snprintf _snprintf
|
||||
# define vsnprintf _vsnprintf
|
||||
# endif
|
||||
#elif (ACC_OS_WIN32 && ACC_CC_MWERKS) && defined(__MSL__)
|
||||
# if (__MSL__ < 0x8000ul)
|
||||
# undef HAVE_CHMOD /* <unix.h> which in turn pulls in <windows.h> */
|
||||
# endif
|
||||
#elif (ACC_CC_NDPC)
|
||||
# undef HAVE_ALLOCA
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_STRNICMP
|
||||
# undef HAVE_UTIME
|
||||
# undef HAVE_VSNPRINTF
|
||||
# if defined(__cplusplus)
|
||||
# undef HAVE_STAT
|
||||
# endif
|
||||
#elif (ACC_CC_PACIFICC)
|
||||
# undef HAVE_ACCESS
|
||||
# undef HAVE_ALLOCA
|
||||
# undef HAVE_CHMOD
|
||||
# undef HAVE_DIFFTIME
|
||||
# undef HAVE_FSTAT
|
||||
# undef HAVE_MKTIME
|
||||
# undef HAVE_RAISE
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_STRFTIME
|
||||
# undef HAVE_UTIME
|
||||
# undef HAVE_VSNPRINTF
|
||||
#elif (ACC_OS_WIN32 && ACC_CC_PELLESC)
|
||||
# if (__POCC__ < 280)
|
||||
# define alloca _alloca
|
||||
# undef HAVE_UTIME
|
||||
# endif
|
||||
#elif (ACC_OS_WIN32 && ACC_CC_PGI) && defined(__MINGW32__)
|
||||
# define snprintf _snprintf
|
||||
# define vsnprintf _vsnprintf
|
||||
#elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__PW32__)
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_VSNPRINTF
|
||||
#elif (ACC_CC_SYMANTECC)
|
||||
# if (ACC_OS_WIN16 && (ACC_MM_MEDIUM || ACC_MM_LARGE || ACC_MM_HUGE))
|
||||
# undef HAVE_ALLOCA
|
||||
# endif
|
||||
# if (__SC__ < 0x600)
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_VSNPRINTF
|
||||
# else
|
||||
# define snprintf _snprintf
|
||||
# define vsnprintf _vsnprintf
|
||||
# endif
|
||||
# if (__SC__ < 0x700)
|
||||
# undef HAVE_DIFFTIME /* difftime() is broken */
|
||||
# undef HAVE_UTIME /* struct utimbuf is missing */
|
||||
# endif
|
||||
#elif (ACC_CC_TOPSPEEDC)
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_VSNPRINTF
|
||||
#elif (ACC_CC_TURBOC)
|
||||
# undef HAVE_ALLOCA
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_VSNPRINTF
|
||||
# if (__TURBOC__ < 0x0200)
|
||||
# undef HAVE_RAISE
|
||||
# undef HAVE_SIGNAL
|
||||
# endif
|
||||
# if (__TURBOC__ < 0x0295)
|
||||
# undef HAVE_MKTIME
|
||||
# undef HAVE_STRFTIME
|
||||
# endif
|
||||
# if (__TURBOC__ < 0x0400)
|
||||
# undef HAVE_UTIME
|
||||
# endif
|
||||
#elif (ACC_CC_WATCOMC)
|
||||
# if (__WATCOMC__ < 1100)
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_VSNPRINTF
|
||||
# elif (__WATCOMC__ < 1200)
|
||||
# define snprintf _snprintf
|
||||
# define vsnprintf _vsnprintf
|
||||
# endif
|
||||
#elif (ACC_CC_ZORTECHC)
|
||||
# if (ACC_OS_WIN16 && (ACC_MM_MEDIUM || ACC_MM_LARGE || ACC_MM_HUGE))
|
||||
# undef HAVE_ALLOCA
|
||||
# endif
|
||||
# undef HAVE_DIFFTIME /* difftime() is broken */
|
||||
# undef HAVE_SNPRINTF
|
||||
# undef HAVE_UTIME /* struct utimbuf is missing */
|
||||
# undef HAVE_VSNPRINTF
|
||||
#endif
|
||||
|
||||
#endif /* DOS, OS/2 & Windows */
|
||||
|
||||
|
||||
#endif /* !defined(ACC_CONFIG_AUTO_NO_FUNCTIONS) */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// Checks for sizes
|
||||
**************************************************************************/
|
||||
|
||||
#if !defined(ACC_CONFIG_AUTO_NO_SIZES)
|
||||
|
||||
#define SIZEOF_SHORT (__ACC_SHORT_BIT / 8)
|
||||
#define SIZEOF_INT (__ACC_INT_BIT / 8)
|
||||
#define SIZEOF_LONG (__ACC_LONG_BIT / 8)
|
||||
|
||||
#if (ACC_OS_WIN64) /* LLP64 programming model */
|
||||
# define SIZEOF_PTRDIFF_T 8
|
||||
# define SIZEOF_SIZE_T 8
|
||||
# define SIZEOF_VOID_P 8
|
||||
#elif (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16)
|
||||
# define SIZEOF_SIZE_T 2
|
||||
# if (ACC_MM_TINY || ACC_MM_SMALL || ACC_MM_MEDIUM)
|
||||
# define SIZEOF_VOID_P 2
|
||||
# elif (ACC_MM_COMPACT || ACC_MM_LARGE || ACC_MM_HUGE)
|
||||
# define SIZEOF_VOID_P 4
|
||||
# else
|
||||
# error "ACC_MM"
|
||||
# endif
|
||||
# if (ACC_MM_TINY || ACC_MM_SMALL || ACC_MM_MEDIUM)
|
||||
# define SIZEOF_PTRDIFF_T 2
|
||||
# elif (ACC_MM_COMPACT || ACC_MM_LARGE)
|
||||
# if (ACC_CC_BORLANDC || ACC_CC_TURBOC)
|
||||
# define SIZEOF_PTRDIFF_T 4
|
||||
# else
|
||||
# define SIZEOF_PTRDIFF_T 2
|
||||
# endif
|
||||
# elif (ACC_MM_HUGE)
|
||||
# define SIZEOF_PTRDIFF_T 4
|
||||
# else
|
||||
# error "ACC_MM"
|
||||
# endif
|
||||
#elif (ACC_ARCH_AVR || ACC_ARCH_C166 || ACC_ARCH_MCS51 || ACC_ARCH_MCS251)
|
||||
# define SIZEOF_PTRDIFF_T 2
|
||||
# define SIZEOF_SIZE_T 2
|
||||
# define SIZEOF_VOID_P 2
|
||||
#else
|
||||
# define SIZEOF_PTRDIFF_T SIZEOF_LONG
|
||||
# define SIZEOF_SIZE_T SIZEOF_LONG
|
||||
# define SIZEOF_VOID_P SIZEOF_LONG
|
||||
#endif
|
||||
|
||||
#if !defined(SIZEOF_CHAR_P) && (SIZEOF_VOID_P > 0)
|
||||
# define SIZEOF_CHAR_P SIZEOF_VOID_P
|
||||
#endif
|
||||
|
||||
|
||||
#if ((SIZEOF_LONG) > 0 && (SIZEOF_LONG) < 8)
|
||||
#if (ACC_ARCH_IA16 && ACC_CC_DMC)
|
||||
#elif (ACC_CC_GNUC)
|
||||
# define SIZEOF_LONG_LONG 8
|
||||
# define SIZEOF_UNSIGNED_LONG_LONG 8
|
||||
#elif ((ACC_OS_WIN32 || ACC_OS_WIN64) && ACC_CC_MSC && (_MSC_VER >= 1400))
|
||||
# define SIZEOF_LONG_LONG 8
|
||||
# define SIZEOF_UNSIGNED_LONG_LONG 8
|
||||
#elif (ACC_OS_WIN64)
|
||||
# define SIZEOF___INT64 8
|
||||
# define SIZEOF_UNSIGNED___INT64 8
|
||||
#elif (ACC_ARCH_IA32 && (ACC_CC_DMC))
|
||||
# define SIZEOF_LONG_LONG 8
|
||||
# define SIZEOF_UNSIGNED_LONG_LONG 8
|
||||
#elif (ACC_ARCH_IA32 && (ACC_CC_SYMANTECC && (__SC__ >= 0x700)))
|
||||
# define SIZEOF_LONG_LONG 8
|
||||
# define SIZEOF_UNSIGNED_LONG_LONG 8
|
||||
#elif (ACC_ARCH_IA32 && (ACC_CC_INTELC && defined(__linux__)))
|
||||
# define SIZEOF_LONG_LONG 8
|
||||
# define SIZEOF_UNSIGNED_LONG_LONG 8
|
||||
#elif (ACC_ARCH_IA32 && (ACC_CC_MWERKS || ACC_CC_PELLESC || ACC_CC_PGI))
|
||||
# define SIZEOF_LONG_LONG 8
|
||||
# define SIZEOF_UNSIGNED_LONG_LONG 8
|
||||
#elif (ACC_ARCH_IA32 && (ACC_CC_INTELC || ACC_CC_MSC))
|
||||
# define SIZEOF___INT64 8
|
||||
# define SIZEOF_UNSIGNED___INT64 8
|
||||
#elif (ACC_ARCH_IA32 && (ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0520)))
|
||||
/* INFO: unsigned __int64 is somewhat broken in 0x0520; fixed in 0x0530 */
|
||||
# define SIZEOF___INT64 8
|
||||
# define SIZEOF_UNSIGNED___INT64 8
|
||||
#elif (ACC_ARCH_IA32 && (ACC_CC_WATCOMC && (__WATCOMC__ >= 1100)))
|
||||
# define SIZEOF___INT64 8
|
||||
# define SIZEOF_UNSIGNED___INT64 8
|
||||
#elif (ACC_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS == 64))
|
||||
# define SIZEOF___INT64 8
|
||||
# define SIZEOF_UNSIGNED___INT64 8
|
||||
#elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
# define SIZEOF_LONG_LONG 8
|
||||
# define SIZEOF_UNSIGNED_LONG_LONG 8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && defined(ACC_CC_GNUC)
|
||||
# if (ACC_CC_GNUC < 0x020800ul)
|
||||
# undef SIZEOF_LONG_LONG
|
||||
# undef SIZEOF_UNSIGNED_LONG_LONG
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* !defined(ACC_CONFIG_AUTO_NO_SIZES) */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// misc
|
||||
**************************************************************************/
|
||||
|
||||
#if defined(HAVE_SIGNAL) && !defined(RETSIGTYPE)
|
||||
# define RETSIGTYPE void
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
143
tools/ucl/acc/acc_cc.h
Normal file
143
tools/ucl/acc/acc_cc.h
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* C/C++ Compiler - exactly one of:
|
||||
*
|
||||
* ACC_CC_UNKNOWN [default]
|
||||
* ACC_CC_GNUC
|
||||
* ...
|
||||
*/
|
||||
|
||||
#if defined(CIL) && defined(_GNUCC) && defined(__GNUC__)
|
||||
# define ACC_CC_CILLY 1
|
||||
# define ACC_INFO_CC "Cilly"
|
||||
# define ACC_INFO_CCVER "unknown"
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
# define ACC_CC_INTELC 1
|
||||
# define ACC_INFO_CC "Intel C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__INTEL_COMPILER)
|
||||
#elif defined(__POCC__)
|
||||
# define ACC_CC_PELLESC 1
|
||||
# define ACC_INFO_CC "Pelles C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__POCC__)
|
||||
#elif defined(__GNUC__) && defined(__VERSION__)
|
||||
# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
|
||||
# define ACC_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__)
|
||||
# elif defined(__GNUC_MINOR__)
|
||||
# define ACC_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100)
|
||||
# else
|
||||
# define ACC_CC_GNUC (__GNUC__ * 0x10000L)
|
||||
# endif
|
||||
# define ACC_INFO_CC "gcc"
|
||||
# define ACC_INFO_CCVER __VERSION__
|
||||
#elif defined(__AZTEC_C__)
|
||||
# define ACC_CC_AZTECC 1
|
||||
# define ACC_INFO_CC "Aztec C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__AZTEC_C__)
|
||||
#elif defined(__BORLANDC__)
|
||||
# define ACC_CC_BORLANDC 1
|
||||
# define ACC_INFO_CC "Borland C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__BORLANDC__)
|
||||
#elif defined(__DMC__)
|
||||
# define ACC_CC_DMC 1
|
||||
# define ACC_INFO_CC "Digital Mars C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__DMC__)
|
||||
#elif defined(__DECC)
|
||||
# define ACC_CC_DECC 1
|
||||
# define ACC_INFO_CC "DEC C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__DECC)
|
||||
#elif defined(__HIGHC__)
|
||||
# define ACC_CC_HIGHC 1
|
||||
# define ACC_INFO_CC "MetaWare High C"
|
||||
# define ACC_INFO_CCVER "unknown"
|
||||
#elif defined(__IBMC__)
|
||||
# define ACC_CC_IBMC 1
|
||||
# define ACC_INFO_CC "IBM C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__IBMC__)
|
||||
#elif defined(__KEIL__) && defined(__C166__)
|
||||
# define ACC_CC_KEILC 1
|
||||
# define ACC_INFO_CC "Keil C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__C166__)
|
||||
#elif defined(__LCC__)
|
||||
# define ACC_CC_LCC 1
|
||||
# define ACC_INFO_CC "lcc"
|
||||
# define ACC_INFO_CCVER "unknown"
|
||||
#elif defined(_MSC_VER)
|
||||
# define ACC_CC_MSC 1
|
||||
# define ACC_INFO_CC "Microsoft C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(_MSC_VER)
|
||||
#elif defined(__MWERKS__)
|
||||
# define ACC_CC_MWERKS 1
|
||||
# define ACC_INFO_CC "Metrowerks C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__MWERKS__)
|
||||
#elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386)
|
||||
# define ACC_CC_NDPC 1
|
||||
# define ACC_INFO_CC "Microway NDP C"
|
||||
# define ACC_INFO_CCVER "unknown"
|
||||
#elif defined(__PACIFIC__)
|
||||
# define ACC_CC_PACIFICC 1
|
||||
# define ACC_INFO_CC "Pacific C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__PACIFIC__)
|
||||
#elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__))
|
||||
# define ACC_CC_PGI 1
|
||||
# define ACC_INFO_CC "Portland Group PGI C"
|
||||
# define ACC_INFO_CCVER "unknown"
|
||||
#elif defined(__PUREC__)
|
||||
# define ACC_CC_PUREC 1
|
||||
# define ACC_INFO_CC "Pure C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__PUREC__)
|
||||
#elif defined(__SC__)
|
||||
# define ACC_CC_SYMANTECC 1
|
||||
# define ACC_INFO_CC "Symantec C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__SC__)
|
||||
#elif defined(__SUNPRO_C)
|
||||
# define ACC_CC_SUNPROC 1
|
||||
# define ACC_INFO_CC "Sun C"
|
||||
# define ACC_INFO_CCVER "unknown"
|
||||
#elif defined(__TINYC__)
|
||||
# define ACC_CC_TINYC 1
|
||||
# define ACC_INFO_CC "Tiny C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__TINYC__)
|
||||
#elif defined(__TSC__)
|
||||
# define ACC_CC_TOPSPEEDC 1
|
||||
# define ACC_INFO_CC "TopSpeed C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__TSC__)
|
||||
#elif defined(__WATCOMC__)
|
||||
# define ACC_CC_WATCOMC 1
|
||||
# define ACC_INFO_CC "Watcom C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__WATCOMC__)
|
||||
#elif defined(__TURBOC__)
|
||||
# define ACC_CC_TURBOC 1
|
||||
# define ACC_INFO_CC "Turbo C"
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__TURBOC__)
|
||||
#elif defined(__ZTC__)
|
||||
# define ACC_CC_ZORTECHC 1
|
||||
# define ACC_INFO_CC "Zortech C"
|
||||
# if (__ZTC__ == 0x310)
|
||||
# define ACC_INFO_CCVER "0x310"
|
||||
# else
|
||||
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__ZTC__)
|
||||
# endif
|
||||
#else
|
||||
# define ACC_CC_UNKNOWN 1
|
||||
# define ACC_INFO_CC "unknown"
|
||||
# define ACC_INFO_CCVER "unknown"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
455
tools/ucl/acc/acc_chk.ch
Normal file
455
tools/ucl/acc/acc_chk.ch
Normal file
|
|
@ -0,0 +1,455 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
//
|
||||
**************************************************************************/
|
||||
|
||||
#if !defined(ACCCHK_ASSERT)
|
||||
# define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT(expr)
|
||||
#endif
|
||||
|
||||
/* compile-time sign */
|
||||
#if !defined(ACCCHK_ASSERT_SIGN_T)
|
||||
# define ACCCHK_ASSERT_SIGN_T(type,relop) \
|
||||
ACCCHK_ASSERT( (type) (-1) relop (type) 0 ) \
|
||||
ACCCHK_ASSERT( (type) (~(type)0) relop (type) 0 ) \
|
||||
ACCCHK_ASSERT( (type) (~(type)0) == (type) (-1) )
|
||||
#endif
|
||||
|
||||
#if !defined(ACCCHK_IS_SIGNED_T)
|
||||
# define ACCCHK_ASSERT_IS_SIGNED_T(type) ACCCHK_ASSERT_SIGN_T(type,<)
|
||||
#endif
|
||||
|
||||
#if !defined(ACCCHK_IS_UNSIGNED_T)
|
||||
# if (ACC_BROKEN_INTEGRAL_PROMOTION)
|
||||
# define ACCCHK_ASSERT_IS_UNSIGNED_T(type) \
|
||||
ACCCHK_ASSERT( (type) (-1) > (type) 0 )
|
||||
# else
|
||||
# define ACCCHK_ASSERT_IS_UNSIGNED_T(type) ACCCHK_ASSERT_SIGN_T(type,>)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// check preprocessor
|
||||
**************************************************************************/
|
||||
|
||||
#if (ACC_0xffffffffL - ACC_UINT32L_C(4294967294) != 1)
|
||||
# error "preprocessor error 1"
|
||||
#endif
|
||||
#if (ACC_0xffffffffL - ACC_UINT32L_C(0xfffffffd) != 2)
|
||||
# error "preprocessor error 2"
|
||||
#endif
|
||||
|
||||
|
||||
#define ACCCHK_VAL 1
|
||||
#define ACCCHK_TMP1 ACCCHK_VAL
|
||||
#undef ACCCHK_VAL
|
||||
#define ACCCHK_VAL 2
|
||||
#define ACCCHK_TMP2 ACCCHK_VAL
|
||||
#if (ACCCHK_TMP1 != 2)
|
||||
# error "preprocessor error 3a"
|
||||
#endif
|
||||
#if (ACCCHK_TMP2 != 2)
|
||||
# error "preprocessor error 3b"
|
||||
#endif
|
||||
#undef ACCCHK_VAL
|
||||
#if (ACCCHK_TMP2)
|
||||
# error "preprocessor error 3c"
|
||||
#endif
|
||||
#if (ACCCHK_TMP2 + 0 != 0)
|
||||
# error "preprocessor error 3d"
|
||||
#endif
|
||||
#undef ACCCHK_TMP1
|
||||
#undef ACCCHK_TMP2
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// check basic arithmetics
|
||||
**************************************************************************/
|
||||
|
||||
ACCCHK_ASSERT(1 == 1)
|
||||
|
||||
ACCCHK_ASSERT(__ACC_INT_MAX(2) == 1)
|
||||
ACCCHK_ASSERT(__ACC_INT_MAX(8) == 127)
|
||||
ACCCHK_ASSERT(__ACC_INT_MAX(16) == 32767)
|
||||
|
||||
ACCCHK_ASSERT(__ACC_UINT_MAX(2) == 3)
|
||||
ACCCHK_ASSERT(__ACC_UINT_MAX(16) == 0xffffU)
|
||||
ACCCHK_ASSERT(__ACC_UINT_MAX(32) == 0xffffffffUL)
|
||||
#if !defined(ACC_BROKEN_INTEGRAL_PROMOTION)
|
||||
ACCCHK_ASSERT(__ACC_UINT_MAX(__ACC_INT_BIT) == ~(0u))
|
||||
ACCCHK_ASSERT(__ACC_UINT_MAX(__ACC_LONG_BIT) == ~(0ul))
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// check basic types
|
||||
**************************************************************************/
|
||||
|
||||
ACCCHK_ASSERT_IS_SIGNED_T(signed char)
|
||||
ACCCHK_ASSERT_IS_UNSIGNED_T(unsigned char)
|
||||
ACCCHK_ASSERT(sizeof(signed char) == sizeof(char))
|
||||
ACCCHK_ASSERT(sizeof(unsigned char) == sizeof(char))
|
||||
ACCCHK_ASSERT(sizeof(char) == 1)
|
||||
#if (ACC_CC_CILLY)
|
||||
/* CIL is broken */
|
||||
#else
|
||||
ACCCHK_ASSERT(sizeof(char) == sizeof((char)0))
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
ACCCHK_ASSERT(sizeof('\0') == sizeof(char))
|
||||
#else
|
||||
# if (ACC_CC_DMC)
|
||||
/* Digital Mars C is broken */
|
||||
# else
|
||||
ACCCHK_ASSERT(sizeof('\0') == sizeof(int))
|
||||
# endif
|
||||
#endif
|
||||
#if defined(acc_alignof)
|
||||
ACCCHK_ASSERT(acc_alignof(char) == 1)
|
||||
ACCCHK_ASSERT(acc_alignof(signed char) == 1)
|
||||
ACCCHK_ASSERT(acc_alignof(unsigned char) == 1)
|
||||
#endif
|
||||
|
||||
ACCCHK_ASSERT_IS_SIGNED_T(short)
|
||||
ACCCHK_ASSERT_IS_UNSIGNED_T(unsigned short)
|
||||
ACCCHK_ASSERT(sizeof(short) == sizeof(unsigned short))
|
||||
ACCCHK_ASSERT(sizeof(short) >= 2)
|
||||
ACCCHK_ASSERT(sizeof(short) >= sizeof(char))
|
||||
#if (ACC_CC_CILLY)
|
||||
/* CIL is broken */
|
||||
#else
|
||||
ACCCHK_ASSERT(sizeof(short) == sizeof((short)0))
|
||||
#endif
|
||||
#if (SIZEOF_SHORT > 0)
|
||||
ACCCHK_ASSERT(sizeof(short) == SIZEOF_SHORT)
|
||||
#endif
|
||||
|
||||
ACCCHK_ASSERT_IS_SIGNED_T(int)
|
||||
ACCCHK_ASSERT_IS_UNSIGNED_T(unsigned int)
|
||||
ACCCHK_ASSERT(sizeof(int) == sizeof(unsigned int))
|
||||
ACCCHK_ASSERT(sizeof(int) >= 2)
|
||||
ACCCHK_ASSERT(sizeof(int) >= sizeof(short))
|
||||
ACCCHK_ASSERT(sizeof(int) == sizeof(0))
|
||||
ACCCHK_ASSERT(sizeof(int) == sizeof((int)0))
|
||||
#if (SIZEOF_INT > 0)
|
||||
ACCCHK_ASSERT(sizeof(int) == SIZEOF_INT)
|
||||
#endif
|
||||
|
||||
ACCCHK_ASSERT_IS_SIGNED_T(long)
|
||||
ACCCHK_ASSERT_IS_UNSIGNED_T(unsigned long)
|
||||
ACCCHK_ASSERT(sizeof(long) == sizeof(unsigned long))
|
||||
ACCCHK_ASSERT(sizeof(long) >= 4)
|
||||
ACCCHK_ASSERT(sizeof(long) >= sizeof(int))
|
||||
ACCCHK_ASSERT(sizeof(long) == sizeof(0L))
|
||||
ACCCHK_ASSERT(sizeof(long) == sizeof((long)0))
|
||||
#if (SIZEOF_LONG > 0)
|
||||
ACCCHK_ASSERT(sizeof(long) == SIZEOF_LONG)
|
||||
#endif
|
||||
|
||||
ACCCHK_ASSERT_IS_UNSIGNED_T(size_t)
|
||||
ACCCHK_ASSERT(sizeof(size_t) >= sizeof(int))
|
||||
ACCCHK_ASSERT(sizeof(size_t) == sizeof(sizeof(0))) /* sizeof() returns size_t */
|
||||
#if (SIZEOF_SIZE_T > 0)
|
||||
ACCCHK_ASSERT(sizeof(size_t) == SIZEOF_SIZE_T)
|
||||
#endif
|
||||
|
||||
ACCCHK_ASSERT_IS_SIGNED_T(ptrdiff_t)
|
||||
ACCCHK_ASSERT(sizeof(ptrdiff_t) >= sizeof(int))
|
||||
ACCCHK_ASSERT(sizeof(ptrdiff_t) >= sizeof(size_t))
|
||||
#if !defined(ACC_BROKEN_SIZEOF)
|
||||
ACCCHK_ASSERT(sizeof(ptrdiff_t) == sizeof((char*)0 - (char*)0))
|
||||
# if (ACC_HAVE_MM_HUGE_PTR)
|
||||
ACCCHK_ASSERT(4 == sizeof((char __huge*)0 - (char __huge*)0))
|
||||
# endif
|
||||
#endif
|
||||
#if (SIZEOF_PTRDIFF_T > 0)
|
||||
ACCCHK_ASSERT(sizeof(ptrdiff_t) == SIZEOF_PTRDIFF_T)
|
||||
#endif
|
||||
|
||||
ACCCHK_ASSERT(sizeof(void*) >= sizeof(char*))
|
||||
#if (SIZEOF_VOID_P > 0)
|
||||
ACCCHK_ASSERT(sizeof(void*) == SIZEOF_VOID_P)
|
||||
#endif
|
||||
#if (SIZEOF_CHAR_P > 0)
|
||||
ACCCHK_ASSERT(sizeof(char*) == SIZEOF_CHAR_P)
|
||||
#endif
|
||||
#if (ACC_HAVE_MM_HUGE_PTR)
|
||||
ACCCHK_ASSERT(4 == sizeof(void __huge*))
|
||||
ACCCHK_ASSERT(4 == sizeof(char __huge*))
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// check arithmetics
|
||||
**************************************************************************/
|
||||
|
||||
ACCCHK_ASSERT((((1u << 15) + 1) >> 15) == 1)
|
||||
ACCCHK_ASSERT((((1ul << 31) + 1) >> 31) == 1)
|
||||
|
||||
#if (ACC_CC_TURBOC && (__TURBOC__ < 0x0150))
|
||||
/* TC 1.0 bug, probably due to ACC_BROKEN_INTEGRAL_PROMOTION ?? */
|
||||
#else
|
||||
ACCCHK_ASSERT((1 << (8*SIZEOF_INT-1)) < 0)
|
||||
#endif
|
||||
ACCCHK_ASSERT((1u << (8*SIZEOF_INT-1)) > 0)
|
||||
|
||||
ACCCHK_ASSERT((1l << (8*SIZEOF_LONG-1)) < 0)
|
||||
ACCCHK_ASSERT((1ul << (8*SIZEOF_LONG-1)) > 0)
|
||||
|
||||
#if defined(acc_int32e_t)
|
||||
ACCCHK_ASSERT(sizeof(acc_int32e_t) == 4)
|
||||
ACCCHK_ASSERT(sizeof(acc_int32e_t) == SIZEOF_ACC_INT32E_T)
|
||||
ACCCHK_ASSERT(sizeof(acc_uint32e_t) == 4)
|
||||
ACCCHK_ASSERT(sizeof(acc_int32e_t) == sizeof(acc_uint32e_t))
|
||||
|
||||
ACCCHK_ASSERT_IS_SIGNED_T(acc_int32e_t)
|
||||
ACCCHK_ASSERT(((( (acc_int32e_t)1 << 30) + 1) >> 30) == 1)
|
||||
ACCCHK_ASSERT(((( ACC_INT32E_C(1) << 30) + 1) >> 30) == 1)
|
||||
|
||||
ACCCHK_ASSERT_IS_UNSIGNED_T(acc_uint32e_t)
|
||||
ACCCHK_ASSERT(((( (acc_uint32e_t)1 << 31) + 1) >> 31) == 1)
|
||||
ACCCHK_ASSERT(((( ACC_UINT32E_C(1) << 31) + 1) >> 31) == 1)
|
||||
|
||||
ACCCHK_ASSERT( (acc_int32e_t) (1 + ~(acc_int32e_t)0) == 0)
|
||||
#if defined(ACCCHK_CONFIG_PEDANTIC)
|
||||
/* compiler may warn about overflow */
|
||||
ACCCHK_ASSERT( (acc_uint32e_t)(1 + ~(acc_uint32e_t)0) == 0)
|
||||
#endif /* ACCCHK_CONFIG_PEDANTIC */
|
||||
|
||||
#if (SIZEOF_ACC_INT32E_T < SIZEOF_INT)
|
||||
ACCCHK_ASSERT(sizeof(ACC_INT32E_C(0)) == sizeof(int))
|
||||
ACCCHK_ASSERT(sizeof(ACC_UINT32E_C(0)) == sizeof(int))
|
||||
#else
|
||||
ACCCHK_ASSERT(sizeof(ACC_INT32E_C(0)) == SIZEOF_ACC_INT32E_T)
|
||||
ACCCHK_ASSERT(sizeof(ACC_UINT32E_C(0)) == SIZEOF_ACC_INT32E_T)
|
||||
#endif
|
||||
ACCCHK_ASSERT((ACC_INT32E_C(1) << (8*SIZEOF_ACC_INT32E_T-1)) < 0)
|
||||
ACCCHK_ASSERT((ACC_UINT32E_C(1) << (8*SIZEOF_ACC_INT32E_T-1)) > 0)
|
||||
ACCCHK_ASSERT((ACC_INT32E_C(1) << (int)(8*sizeof(ACC_INT32E_C(1))-1)) < 0)
|
||||
ACCCHK_ASSERT((ACC_UINT32E_C(1) << (int)(8*sizeof(ACC_UINT32E_C(1))-1)) > 0)
|
||||
ACCCHK_ASSERT(ACC_INT32E_C(2147483647) > 0)
|
||||
ACCCHK_ASSERT(ACC_INT32E_C(-2147483647) -1 < 0)
|
||||
ACCCHK_ASSERT(ACC_UINT32E_C(4294967295) > 0)
|
||||
ACCCHK_ASSERT(ACC_UINT32E_C(4294967295) == ACC_0xffffffffL)
|
||||
#endif
|
||||
|
||||
|
||||
ACCCHK_ASSERT(sizeof(acc_int32l_t) >= sizeof(int))
|
||||
#if defined(acc_int32e_t)
|
||||
ACCCHK_ASSERT(sizeof(acc_int32l_t) >= sizeof(acc_int32e_t))
|
||||
#endif
|
||||
|
||||
ACCCHK_ASSERT(sizeof(acc_int32l_t) >= 4)
|
||||
ACCCHK_ASSERT(sizeof(acc_int32l_t) == SIZEOF_ACC_INT32L_T)
|
||||
ACCCHK_ASSERT(sizeof(acc_uint32l_t) >= 4)
|
||||
ACCCHK_ASSERT(sizeof(acc_int32l_t) == sizeof(acc_uint32l_t))
|
||||
|
||||
ACCCHK_ASSERT_IS_SIGNED_T(acc_int32l_t)
|
||||
ACCCHK_ASSERT(((( (acc_int32l_t)1 << 30) + 1) >> 30) == 1)
|
||||
ACCCHK_ASSERT(((( ACC_INT32L_C(1) << 30) + 1) >> 30) == 1)
|
||||
|
||||
ACCCHK_ASSERT_IS_UNSIGNED_T(acc_uint32l_t)
|
||||
ACCCHK_ASSERT(((( (acc_uint32l_t)1 << 31) + 1) >> 31) == 1)
|
||||
ACCCHK_ASSERT(((( ACC_UINT32L_C(1) << 31) + 1) >> 31) == 1)
|
||||
|
||||
#if (SIZEOF_ACC_INT32L_T < SIZEOF_INT)
|
||||
ACCCHK_ASSERT(sizeof(ACC_INT32L_C(0)) == sizeof(int))
|
||||
ACCCHK_ASSERT(sizeof(ACC_UINT32L_C(0)) == sizeof(int))
|
||||
#else
|
||||
ACCCHK_ASSERT(sizeof(ACC_INT32L_C(0)) == SIZEOF_ACC_INT32L_T)
|
||||
ACCCHK_ASSERT(sizeof(ACC_UINT32L_C(0)) == SIZEOF_ACC_INT32L_T)
|
||||
#endif
|
||||
ACCCHK_ASSERT((ACC_INT32L_C(1) << (8*SIZEOF_ACC_INT32L_T-1)) < 0)
|
||||
ACCCHK_ASSERT((ACC_UINT32L_C(1) << (8*SIZEOF_ACC_INT32L_T-1)) > 0)
|
||||
ACCCHK_ASSERT((ACC_INT32L_C(1) << (int)(8*sizeof(ACC_INT32L_C(1))-1)) < 0)
|
||||
ACCCHK_ASSERT((ACC_UINT32L_C(1) << (int)(8*sizeof(ACC_UINT32L_C(1))-1)) > 0)
|
||||
ACCCHK_ASSERT(ACC_INT32L_C(2147483647) > 0)
|
||||
ACCCHK_ASSERT(ACC_INT32L_C(-2147483647) -1 < 0)
|
||||
ACCCHK_ASSERT(ACC_UINT32L_C(4294967295) > 0)
|
||||
ACCCHK_ASSERT(ACC_UINT32L_C(4294967295) == ACC_0xffffffffL)
|
||||
|
||||
|
||||
ACCCHK_ASSERT(sizeof(acc_int32f_t) >= sizeof(int))
|
||||
#if defined(acc_int32e_t)
|
||||
ACCCHK_ASSERT(sizeof(acc_int32f_t) >= sizeof(acc_int32e_t))
|
||||
#endif
|
||||
ACCCHK_ASSERT(sizeof(acc_int32f_t) >= sizeof(acc_int32l_t))
|
||||
|
||||
ACCCHK_ASSERT(sizeof(acc_int32f_t) >= 4)
|
||||
ACCCHK_ASSERT(sizeof(acc_int32f_t) >= sizeof(acc_int32l_t))
|
||||
ACCCHK_ASSERT(sizeof(acc_int32f_t) == SIZEOF_ACC_INT32F_T)
|
||||
ACCCHK_ASSERT(sizeof(acc_uint32f_t) >= 4)
|
||||
ACCCHK_ASSERT(sizeof(acc_uint32f_t) >= sizeof(acc_uint32l_t))
|
||||
ACCCHK_ASSERT(sizeof(acc_int32f_t) == sizeof(acc_uint32f_t))
|
||||
|
||||
ACCCHK_ASSERT_IS_SIGNED_T(acc_int32f_t)
|
||||
ACCCHK_ASSERT(((( (acc_int32f_t)1 << 30) + 1) >> 30) == 1)
|
||||
ACCCHK_ASSERT(((( ACC_INT32F_C(1) << 30) + 1) >> 30) == 1)
|
||||
|
||||
ACCCHK_ASSERT_IS_UNSIGNED_T(acc_uint32f_t)
|
||||
ACCCHK_ASSERT(((( (acc_uint32f_t)1 << 31) + 1) >> 31) == 1)
|
||||
ACCCHK_ASSERT(((( ACC_UINT32F_C(1) << 31) + 1) >> 31) == 1)
|
||||
|
||||
#if (SIZEOF_ACC_INT32F_T < SIZEOF_INT)
|
||||
ACCCHK_ASSERT(sizeof(ACC_INT32F_C(0)) == sizeof(int))
|
||||
ACCCHK_ASSERT(sizeof(ACC_UINT32F_C(0)) == sizeof(int))
|
||||
#else
|
||||
ACCCHK_ASSERT(sizeof(ACC_INT32F_C(0)) == SIZEOF_ACC_INT32F_T)
|
||||
ACCCHK_ASSERT(sizeof(ACC_UINT32F_C(0)) == SIZEOF_ACC_INT32F_T)
|
||||
#endif
|
||||
ACCCHK_ASSERT((ACC_INT32F_C(1) << (8*SIZEOF_ACC_INT32F_T-1)) < 0)
|
||||
ACCCHK_ASSERT((ACC_UINT32F_C(1) << (8*SIZEOF_ACC_INT32F_T-1)) > 0)
|
||||
ACCCHK_ASSERT((ACC_INT32F_C(1) << (int)(8*sizeof(ACC_INT32F_C(1))-1)) < 0)
|
||||
ACCCHK_ASSERT((ACC_UINT32F_C(1) << (int)(8*sizeof(ACC_UINT32F_C(1))-1)) > 0)
|
||||
ACCCHK_ASSERT(ACC_INT32F_C(2147483647) > 0)
|
||||
ACCCHK_ASSERT(ACC_INT32F_C(-2147483647) -1 < 0)
|
||||
ACCCHK_ASSERT(ACC_UINT32F_C(4294967295) > 0)
|
||||
ACCCHK_ASSERT(ACC_UINT32F_C(4294967295) == ACC_0xffffffffL)
|
||||
|
||||
|
||||
#if defined(acc_int64l_t)
|
||||
ACCCHK_ASSERT(sizeof(acc_int64l_t) >= 8)
|
||||
ACCCHK_ASSERT(sizeof(acc_int64l_t) == SIZEOF_ACC_INT64L_T)
|
||||
ACCCHK_ASSERT(sizeof(acc_uint64l_t) >= 8)
|
||||
ACCCHK_ASSERT(sizeof(acc_int64l_t) == sizeof(acc_uint64l_t))
|
||||
|
||||
ACCCHK_ASSERT_IS_SIGNED_T(acc_int64l_t)
|
||||
ACCCHK_ASSERT(((( (acc_int64l_t)1 << 62) + 1) >> 62) == 1)
|
||||
ACCCHK_ASSERT(((( ACC_INT64L_C(1) << 62) + 1) >> 62) == 1)
|
||||
|
||||
#if (ACC_CC_BORLANDC && (__BORLANDC__ < 0x0530))
|
||||
/* Borland C is broken */
|
||||
#else
|
||||
ACCCHK_ASSERT_IS_UNSIGNED_T(acc_uint64l_t)
|
||||
ACCCHK_ASSERT(ACC_UINT64L_C(18446744073709551615) > 0)
|
||||
#endif
|
||||
ACCCHK_ASSERT(((( (acc_uint64l_t)1 << 63) + 1) >> 63) == 1)
|
||||
ACCCHK_ASSERT(((( ACC_UINT64L_C(1) << 63) + 1) >> 63) == 1)
|
||||
|
||||
#if defined(ACCCHK_CONFIG_PEDANTIC)
|
||||
#if (ACC_CC_BORLANDC && (__BORLANDC__ < 0x0560))
|
||||
/* Borland C is broken */
|
||||
#elif (SIZEOF_ACC_INT64L_T < SIZEOF_INT)
|
||||
ACCCHK_ASSERT(sizeof(ACC_INT64L_C(0)) == sizeof(int))
|
||||
ACCCHK_ASSERT(sizeof(ACC_UINT64L_C(0)) == sizeof(int))
|
||||
#else
|
||||
ACCCHK_ASSERT(sizeof(ACC_INT64L_C(0)) == SIZEOF_ACC_INT64L_T)
|
||||
ACCCHK_ASSERT(sizeof(ACC_UINT64L_C(0)) == SIZEOF_ACC_INT64L_T)
|
||||
#endif
|
||||
#endif /* ACCCHK_CONFIG_PEDANTIC */
|
||||
ACCCHK_ASSERT((ACC_INT64L_C(1) << (8*SIZEOF_ACC_INT64L_T-1)) < 0)
|
||||
ACCCHK_ASSERT((ACC_UINT64L_C(1) << (8*SIZEOF_ACC_INT64L_T-1)) > 0)
|
||||
#if (ACC_CC_GNUC && (ACC_CC_GNUC < 0x020600ul))
|
||||
/* avoid pedantic warning */
|
||||
ACCCHK_ASSERT(ACC_INT64L_C(9223372036854775807) > ACC_INT64L_C(0))
|
||||
#else
|
||||
ACCCHK_ASSERT(ACC_INT64L_C(9223372036854775807) > 0)
|
||||
#endif
|
||||
ACCCHK_ASSERT(ACC_INT64L_C(-9223372036854775807) - 1 < 0)
|
||||
|
||||
ACCCHK_ASSERT( ACC_INT64L_C(9223372036854775807) % 2147483629l == 721)
|
||||
ACCCHK_ASSERT( ACC_INT64L_C(9223372036854775807) % 2147483647l == 1)
|
||||
ACCCHK_ASSERT(ACC_UINT64L_C(9223372036854775807) % 2147483629ul == 721)
|
||||
ACCCHK_ASSERT(ACC_UINT64L_C(9223372036854775807) % 2147483647ul == 1)
|
||||
#endif /* acc_int64l_t */
|
||||
|
||||
|
||||
ACCCHK_ASSERT_IS_SIGNED_T(acc_intptr_t)
|
||||
ACCCHK_ASSERT_IS_UNSIGNED_T(acc_uintptr_t)
|
||||
ACCCHK_ASSERT(sizeof(acc_intptr_t) >= sizeof(void *))
|
||||
ACCCHK_ASSERT(sizeof(acc_intptr_t) == SIZEOF_ACC_INTPTR_T)
|
||||
ACCCHK_ASSERT(sizeof(acc_intptr_t) == sizeof(acc_uintptr_t))
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// check memory model ACC_MM
|
||||
**************************************************************************/
|
||||
|
||||
#if (ACC_MM_FLAT)
|
||||
#if 0
|
||||
/* this is not a valid assumption -- disabled */
|
||||
ACCCHK_ASSERT(sizeof(void*) == sizeof(void (*)(void)))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (ACC_MM_TINY || ACC_MM_SMALL || ACC_MM_MEDIUM)
|
||||
ACCCHK_ASSERT(sizeof(void*) == 2)
|
||||
ACCCHK_ASSERT(sizeof(ptrdiff_t) == 2)
|
||||
#elif (ACC_MM_COMPACT || ACC_MM_LARGE || ACC_MM_HUGE)
|
||||
ACCCHK_ASSERT(sizeof(void*) == 4)
|
||||
#endif
|
||||
#if (ACC_MM_TINY || ACC_MM_SMALL || ACC_MM_COMPACT)
|
||||
ACCCHK_ASSERT(sizeof(void (*)(void)) == 2)
|
||||
#elif (ACC_MM_MEDIUM || ACC_MM_LARGE || ACC_MM_HUGE)
|
||||
ACCCHK_ASSERT(sizeof(void (*)(void)) == 4)
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// check ACC_ARCH and ACC_OS
|
||||
**************************************************************************/
|
||||
|
||||
#if (ACC_ARCH_IA16)
|
||||
ACCCHK_ASSERT(sizeof(size_t) == 2)
|
||||
ACCCHK_ASSERT(sizeof(acc_intptr_t) == sizeof(void *))
|
||||
#elif (ACC_ARCH_IA32 || ACC_ARCH_M68K)
|
||||
ACCCHK_ASSERT(sizeof(size_t) == 4)
|
||||
ACCCHK_ASSERT(sizeof(ptrdiff_t) == 4)
|
||||
ACCCHK_ASSERT(sizeof(acc_intptr_t) == sizeof(void *))
|
||||
#elif (ACC_ARCH_AMD64 || ACC_ARCH_IA64)
|
||||
ACCCHK_ASSERT(sizeof(size_t) == 8)
|
||||
ACCCHK_ASSERT(sizeof(ptrdiff_t) == 8)
|
||||
ACCCHK_ASSERT(sizeof(acc_intptr_t) == sizeof(void *))
|
||||
#endif
|
||||
|
||||
#if (ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_WIN32)
|
||||
ACCCHK_ASSERT(sizeof(size_t) == 4)
|
||||
ACCCHK_ASSERT(sizeof(ptrdiff_t) == 4)
|
||||
ACCCHK_ASSERT(sizeof(void (*)(void)) == 4)
|
||||
#elif (ACC_OS_WIN64)
|
||||
ACCCHK_ASSERT(sizeof(size_t) == 8)
|
||||
ACCCHK_ASSERT(sizeof(ptrdiff_t) == 8)
|
||||
ACCCHK_ASSERT(sizeof(void (*)(void)) == 8)
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// check promotion rules
|
||||
**************************************************************************/
|
||||
|
||||
#if (ACC_CC_NDPC)
|
||||
/* NDP C is broken */
|
||||
#else
|
||||
/* check that the compiler correctly casts signed to unsigned */
|
||||
ACCCHK_ASSERT( (int) ((unsigned char) ((signed char) -1)) == 255)
|
||||
#endif
|
||||
|
||||
#if (ACC_CC_KEILC)
|
||||
/* Keil C is broken */
|
||||
#elif (ACC_CC_NDPC)
|
||||
/* NDP C is broken */
|
||||
#elif !defined(ACC_BROKEN_INTEGRAL_PROMOTION) && (SIZEOF_INT > 1)
|
||||
/* check that the compiler correctly promotes integrals */
|
||||
ACCCHK_ASSERT( (((unsigned char)128) << (int)(8*sizeof(int)-8)) < 0)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
126
tools/ucl/acc/acc_chkr.ch
Normal file
126
tools/ucl/acc/acc_chkr.ch
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
//
|
||||
**************************************************************************/
|
||||
|
||||
#if !defined(__ACCCHKR_FUNCNAME)
|
||||
# define __ACCCHKR_FUNCNAME(f) accchkr_ ## f
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(ACCCHKR_ASSERT)
|
||||
|
||||
#if 0 || defined(ACCCHKR_CONFIG_DEBUG)
|
||||
|
||||
#include <stdio.h>
|
||||
static int __ACCCHKR_FUNCNAME(assert_fail)(const char* s, unsigned l)
|
||||
{
|
||||
fprintf(stderr, "ACCCHKR assertion failed in line %u: `%s'\n", l, s);
|
||||
return 0;
|
||||
}
|
||||
#define ACCCHKR_ASSERT(expr) ((expr) ? 1 : __ACCCHKR_FUNCNAME(assert_fail)(#expr,__LINE__))
|
||||
|
||||
#else
|
||||
|
||||
#define ACCCHKR_ASSERT(expr) ((expr) ? 1 : 0)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* avoid inlining */
|
||||
static int __ACCCHKR_FUNCNAME(schedule_insns_bug)(void);
|
||||
static int __ACCCHKR_FUNCNAME(strength_reduce_bug)(int*);
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// main entry
|
||||
**************************************************************************/
|
||||
|
||||
static int __ACCCHKR_FUNCNAME(check)(int r)
|
||||
{
|
||||
#if defined(ACC_ENDIAN_BIG_ENDIAN)
|
||||
{
|
||||
union { long l; unsigned char c[sizeof(long)]; } u;
|
||||
u.l = 0; u.c[sizeof(long)-1] = 0x80;
|
||||
r &= ACCCHKR_ASSERT(u.l == 128);
|
||||
u.l = 0; u.c[0] = 0x80;
|
||||
r &= ACCCHKR_ASSERT(u.l < 0);
|
||||
ACC_UNUSED(u);
|
||||
}
|
||||
#endif
|
||||
#if defined(ACC_ENDIAN_LITTLE_ENDIAN)
|
||||
{
|
||||
union { long l; unsigned char c[sizeof(long)]; } u;
|
||||
u.l = 0; u.c[0] = 0x80;
|
||||
r &= ACCCHKR_ASSERT(u.l == 128);
|
||||
u.l = 0; u.c[sizeof(long)-1] = 0x80;
|
||||
r &= ACCCHKR_ASSERT(u.l < 0);
|
||||
ACC_UNUSED(u);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* check for the gcc schedule-insns optimization bug */
|
||||
if (r == 1)
|
||||
{
|
||||
r &= ACCCHKR_ASSERT(!__ACCCHKR_FUNCNAME(schedule_insns_bug()));
|
||||
}
|
||||
|
||||
/* check for the gcc strength-reduce optimization bug */
|
||||
if (r == 1)
|
||||
{
|
||||
static int x[3];
|
||||
static unsigned xn = 3;
|
||||
register unsigned j;
|
||||
|
||||
for (j = 0; j < xn; j++)
|
||||
x[j] = (int)j - 3;
|
||||
r &= ACCCHKR_ASSERT(!__ACCCHKR_FUNCNAME(strength_reduce_bug(x)));
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
//
|
||||
**************************************************************************/
|
||||
|
||||
static int __ACCCHKR_FUNCNAME(schedule_insns_bug)(void)
|
||||
{
|
||||
const int a[] = {1, 2, 0}; const int* b;
|
||||
b = a; return (*b) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
static int __ACCCHKR_FUNCNAME(strength_reduce_bug)(int* x)
|
||||
{
|
||||
#if 0 && (ACC_CC_DMC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
||||
ACC_UNUSED(x); return 0;
|
||||
#else
|
||||
return x[0] != -3 || x[1] != -2 || x[2] != -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
157
tools/ucl/acc/acc_cxx.h
Normal file
157
tools/ucl/acc/acc_cxx.h
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __ACC_CXX_H_INCLUDED
|
||||
#define __ACC_CXX_H_INCLUDED 1
|
||||
#if defined(__cplusplus)
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// exception specification
|
||||
// ACC_CXX_NOTHROW
|
||||
**************************************************************************/
|
||||
|
||||
#if defined(ACC_CXX_NOTHROW)
|
||||
#elif (ACC_CC_GNUC && (ACC_CC_GNUC < 0x020800ul))
|
||||
#elif (ACC_CC_BORLANDC && (__BORLANDC__ < 0x0450))
|
||||
#elif (ACC_CC_HIGHC)
|
||||
#elif (ACC_CC_MSC && (_MSC_VER < 1100))
|
||||
#elif (ACC_CC_NDPC)
|
||||
#elif (ACC_CC_TURBOC)
|
||||
#elif (ACC_CC_WATCOMC && !defined(_CPPUNWIND))
|
||||
#elif (ACC_CC_ZORTECHC)
|
||||
#else
|
||||
# define ACC_CXX_NOTHROW throw()
|
||||
#endif
|
||||
|
||||
#if !defined(ACC_CXX_NOTHROW)
|
||||
# define ACC_CXX_NOTHROW
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// disable dynamic allocation of an object - private helpers
|
||||
// __ACC_CXX_DO_NEW
|
||||
// __ACC_CXX_DO_DELETE
|
||||
**************************************************************************/
|
||||
|
||||
#if defined(__ACC_CXX_DO_NEW)
|
||||
#elif (ACC_CC_NDPC || ACC_CC_PGI)
|
||||
# define __ACC_CXX_DO_NEW { return 0; }
|
||||
#else
|
||||
# define __ACC_CXX_DO_NEW ;
|
||||
#endif
|
||||
|
||||
|
||||
/* need an implementation in case a class has virtual members */
|
||||
#if defined(__ACC_CXX_DO_DELETE)
|
||||
#elif (ACC_CC_BORLANDC || ACC_CC_TURBOC)
|
||||
# define __ACC_CXX_DO_DELETE { }
|
||||
#else
|
||||
# define __ACC_CXX_DO_DELETE ACC_CXX_NOTHROW { }
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// disable dynamic allocation of an object
|
||||
// ACC_CXX_DISABLE_NEW_DELETE
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
#undef __ACC_CXX_HAVE_ARRAY_NEW
|
||||
#undef __ACC_CXX_HAVE_PLACEMENT_NEW
|
||||
#undef __ACC_CXX_HAVE_PLACEMENT_DELETE
|
||||
*/
|
||||
|
||||
#if (ACC_CC_BORLANDC && (__BORLANDC__ < 0x0450))
|
||||
#elif (ACC_CC_MSC && ACC_MM_HUGE)
|
||||
# define ACC_CXX_DISABLE_NEW_DELETE private:
|
||||
#elif (ACC_CC_MSC && (_MSC_VER < 1100))
|
||||
#elif (ACC_CC_NDPC)
|
||||
#elif (ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
||||
#elif (ACC_CC_TURBOC)
|
||||
#elif (ACC_CC_WATCOMC && (__WATCOMC__ < 1100))
|
||||
#else
|
||||
# define __ACC_CXX_HAVE_ARRAY_NEW 1
|
||||
#endif
|
||||
|
||||
#if (__ACC_CXX_HAVE_ARRAY_NEW)
|
||||
# define __ACC_CXX_HAVE_PLACEMENT_NEW 1
|
||||
#endif
|
||||
|
||||
#if (__ACC_CXX_HAVE_PLACEMENT_NEW)
|
||||
# if (ACC_CC_GNUC >= 0x030000ul)
|
||||
# define __ACC_CXX_HAVE_PLACEMENT_DELETE 1
|
||||
# elif (ACC_CC_INTELC)
|
||||
# define __ACC_CXX_HAVE_PLACEMENT_DELETE 1
|
||||
# elif (ACC_CC_MSC && (_MSC_VER >= 1200))
|
||||
# define __ACC_CXX_HAVE_PLACEMENT_DELETE 1
|
||||
# elif (ACC_CC_PGI)
|
||||
# define __ACC_CXX_HAVE_PLACEMENT_DELETE 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ACC_CXX_DISABLE_NEW_DELETE)
|
||||
#elif defined(new) || defined(delete)
|
||||
# define ACC_CXX_DISABLE_NEW_DELETE private:
|
||||
#elif (ACC_CC_GNUC && (ACC_CC_GNUC < 0x025b00ul))
|
||||
# define ACC_CXX_DISABLE_NEW_DELETE private:
|
||||
#elif (ACC_CC_HIGHC)
|
||||
# define ACC_CXX_DISABLE_NEW_DELETE private:
|
||||
#elif !defined(__ACC_CXX_HAVE_ARRAY_NEW)
|
||||
/* for old compilers use `protected' instead of `private' */
|
||||
# define ACC_CXX_DISABLE_NEW_DELETE \
|
||||
protected: static void operator delete(void*) __ACC_CXX_DO_DELETE \
|
||||
protected: static void* operator new(size_t) __ACC_CXX_DO_NEW \
|
||||
private:
|
||||
#else
|
||||
# define ACC_CXX_DISABLE_NEW_DELETE \
|
||||
protected: static void operator delete(void*) __ACC_CXX_DO_DELETE \
|
||||
static void operator delete[](void*) __ACC_CXX_DO_DELETE \
|
||||
private: static void* operator new(size_t) __ACC_CXX_DO_NEW \
|
||||
static void* operator new[](size_t) __ACC_CXX_DO_NEW
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// Assist the compiler by defining a unique location for vtables and RTTI.
|
||||
// Every class which has virtual member functions or derives from a class
|
||||
// with virtual members should put this macro at the very top of its
|
||||
// class declaration.
|
||||
// ACC_CXX_TRIGGER_FUNCTION
|
||||
**************************************************************************/
|
||||
|
||||
#if defined(ACC_CXX_TRIGGER_FUNCTION)
|
||||
#else
|
||||
# define ACC_CXX_TRIGGER_FUNCTION \
|
||||
protected: virtual const void* acc_cxx_trigger_function() const; \
|
||||
private:
|
||||
#endif
|
||||
|
||||
#if defined(ACC_CXX_TRIGGER_FUNCTION_IMPL)
|
||||
#else
|
||||
# define ACC_CXX_TRIGGER_FUNCTION_IMPL(klass) \
|
||||
const void* klass::acc_cxx_trigger_function() const { return 0; }
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __cplusplus */
|
||||
#endif /* already included */
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
193
tools/ucl/acc/acc_defs.h
Normal file
193
tools/ucl/acc/acc_defs.h
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// acc_alignof() / acc_inline
|
||||
************************************************************************/
|
||||
|
||||
#if (ACC_CC_CILLY || ACC_CC_GNUC || ACC_CC_PGI)
|
||||
# define acc_alignof(e) __alignof__(e)
|
||||
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 700))
|
||||
# define acc_alignof(e) __alignof__(e)
|
||||
#elif (ACC_CC_MSC && (_MSC_VER >= 1300))
|
||||
# define acc_alignof(e) __alignof(e)
|
||||
#endif
|
||||
|
||||
#if (ACC_CC_TURBOC && (__TURBOC__ <= 0x0295))
|
||||
#elif defined(__cplusplus)
|
||||
# define acc_inline inline
|
||||
#elif (ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0550))
|
||||
# define acc_inline __inline
|
||||
#elif (ACC_CC_CILLY || ACC_CC_GNUC || ACC_CC_PGI)
|
||||
# define acc_inline __inline__
|
||||
#elif (ACC_CC_DMC)
|
||||
# define acc_inline __inline
|
||||
#elif (ACC_CC_INTELC)
|
||||
# define acc_inline __inline
|
||||
#elif (ACC_CC_MSC && (_MSC_VER >= 900))
|
||||
# define acc_inline __inline
|
||||
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
# define acc_inline inline
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// ACC_UNUSED / ACC_UNUSED_FUNC
|
||||
************************************************************************/
|
||||
|
||||
#if !defined(ACC_UNUSED)
|
||||
# if (ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0600))
|
||||
# define ACC_UNUSED(var) ((void) &var)
|
||||
# elif (ACC_CC_BORLANDC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_TURBOC)
|
||||
# define ACC_UNUSED(var) if (&var) ; else
|
||||
# elif (ACC_CC_MSC && (_MSC_VER < 900))
|
||||
# define ACC_UNUSED(var) if (&var) ; else
|
||||
# elif (ACC_CC_GNUC)
|
||||
# define ACC_UNUSED(var) ((void) var)
|
||||
# elif (ACC_CC_KEILC)
|
||||
# define ACC_UNUSED(var)
|
||||
# else
|
||||
# define ACC_UNUSED(var) ((void) &var)
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(ACC_UNUSED_FUNC)
|
||||
# if (ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0600))
|
||||
# define ACC_UNUSED_FUNC(func) ((void) func)
|
||||
# elif (ACC_CC_BORLANDC || ACC_CC_NDPC || ACC_CC_TURBOC)
|
||||
# define ACC_UNUSED_FUNC(func) if (func) ; else
|
||||
# elif (ACC_CC_GNUC == 0x030400ul) && defined(__llvm__)
|
||||
# define ACC_UNUSED_FUNC(func) ((void) &func)
|
||||
# elif (ACC_CC_MSC && (_MSC_VER < 900))
|
||||
# define ACC_UNUSED_FUNC(func) if (func) ; else
|
||||
# elif (ACC_CC_MSC)
|
||||
# define ACC_UNUSED_FUNC(func) ((void) &func)
|
||||
# elif (ACC_CC_KEILC)
|
||||
# define ACC_UNUSED_FUNC(func)
|
||||
# else
|
||||
# define ACC_UNUSED_FUNC(func) ((void) func)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// compile-time-assertions
|
||||
************************************************************************/
|
||||
|
||||
/* This can be put into a header file but may get ignored by some compilers. */
|
||||
#if !defined(ACC_COMPILE_TIME_ASSERT_HEADER)
|
||||
# if (ACC_CC_AZTECC || ACC_CC_ZORTECHC)
|
||||
# define ACC_COMPILE_TIME_ASSERT_HEADER(e) extern int __acc_cta[1-!(e)];
|
||||
# elif (ACC_CC_DMC || ACC_CC_SYMANTECC)
|
||||
# define ACC_COMPILE_TIME_ASSERT_HEADER(e) extern int __acc_cta[1u-2*!(e)];
|
||||
# elif (ACC_CC_TURBOC && (__TURBOC__ == 0x0295))
|
||||
# define ACC_COMPILE_TIME_ASSERT_HEADER(e) extern int __acc_cta[1-!(e)];
|
||||
# else
|
||||
//# define ACC_COMPILE_TIME_ASSERT_HEADER(e) extern int __acc_cta[1-2*!(e)];
|
||||
# define ACC_COMPILE_TIME_ASSERT_HEADER(e)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* This must appear within a function body. */
|
||||
#if !defined(ACC_COMPILE_TIME_ASSERT)
|
||||
# if (ACC_CC_AZTECC)
|
||||
# define ACC_COMPILE_TIME_ASSERT(e) {typedef int __acc_cta_t[1-!(e)];}
|
||||
# elif (ACC_CC_DMC || ACC_CC_PACIFICC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
||||
# define ACC_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break;
|
||||
# elif (ACC_CC_MSC && (_MSC_VER < 900))
|
||||
# define ACC_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break;
|
||||
# elif (ACC_CC_TURBOC && (__TURBOC__ == 0x0295))
|
||||
# define ACC_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break;
|
||||
# else
|
||||
//# define ACC_COMPILE_TIME_ASSERT(e) {typedef int __acc_cta_t[1-2*!(e)];}
|
||||
# define ACC_COMPILE_TIME_ASSERT(e)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// macros
|
||||
************************************************************************/
|
||||
|
||||
#if !defined(__ACC_UINT_MAX)
|
||||
# define __ACC_INT_MAX(b) ((((1l << ((b)-2)) - 1l) * 2l) + 1l)
|
||||
# define __ACC_UINT_MAX(b) ((((1ul << ((b)-1)) - 1ul) * 2ul) + 1ul)
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// get sizes of builtin integral types from <limits.h>
|
||||
************************************************************************/
|
||||
|
||||
#if !defined(__ACC_SHORT_BIT)
|
||||
# if (USHRT_MAX == ACC_0xffffL)
|
||||
# define __ACC_SHORT_BIT 16
|
||||
# elif (USHRT_MAX == ACC_0xffffffffL)
|
||||
# define __ACC_SHORT_BIT 32
|
||||
# elif (USHRT_MAX == __ACC_UINT_MAX(64))
|
||||
# define __ACC_SHORT_BIT 64
|
||||
# elif (USHRT_MAX == __ACC_UINT_MAX(128))
|
||||
# define __ACC_SHORT_BIT 128
|
||||
# else
|
||||
# error "check your compiler installation: USHRT_MAX"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(__ACC_INT_BIT)
|
||||
# if (UINT_MAX == ACC_0xffffL)
|
||||
# define __ACC_INT_BIT 16
|
||||
# elif (UINT_MAX == ACC_0xffffffffL)
|
||||
# define __ACC_INT_BIT 32
|
||||
# elif (UINT_MAX == __ACC_UINT_MAX(64))
|
||||
# define __ACC_INT_BIT 64
|
||||
# elif (UINT_MAX == __ACC_UINT_MAX(128))
|
||||
# define __ACC_INT_BIT 128
|
||||
# else
|
||||
# error "check your compiler installation: UINT_MAX"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(__ACC_LONG_BIT)
|
||||
# if (ULONG_MAX == ACC_0xffffffffL)
|
||||
# define __ACC_LONG_BIT 32
|
||||
# elif (ULONG_MAX == __ACC_UINT_MAX(64))
|
||||
# define __ACC_LONG_BIT 64
|
||||
# elif (ULONG_MAX == __ACC_UINT_MAX(128))
|
||||
# define __ACC_LONG_BIT 128
|
||||
# else
|
||||
# error "check your compiler installation: ULONG_MAX"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// acc_auto.h supplements
|
||||
************************************************************************/
|
||||
|
||||
#if (ACC_OS_CYGWIN || (ACC_OS_EMX && defined(__RSXNT__)) || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
# if (ACC_CC_WATCOMC && (__WATCOMC__ < 1000))
|
||||
# elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__PW32__)
|
||||
/* ancient pw32 version */
|
||||
# elif ((ACC_OS_CYGWIN || defined(__MINGW32__)) && (ACC_CC_GNUC && (ACC_CC_GNUC < 0x025f00ul)))
|
||||
/* ancient cygwin/mingw version */
|
||||
# else
|
||||
# define ACC_HAVE_WINDOWS_H 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
67
tools/ucl/acc/acc_incd.h
Normal file
67
tools/ucl/acc/acc_incd.h
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __ACC_INCD_H_INCLUDED
|
||||
#define __ACC_INCD_H_INCLUDED 1
|
||||
|
||||
/* default system includes */
|
||||
/* see Autoconf:
|
||||
* headers.m4, _AC_INCLUDES_DEFAULT_REQUIREMENTS ac_includes_default
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#if defined(HAVE_TIME_H) && defined(__MSL__) && defined(__cplusplus)
|
||||
# include <time.h>
|
||||
#endif
|
||||
#if HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#if HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
# include <stddef.h>
|
||||
#else
|
||||
# if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
#endif
|
||||
#if HAVE_STRING_H
|
||||
# if !STDC_HEADERS && HAVE_MEMORY_H
|
||||
# include <memory.h>
|
||||
# endif
|
||||
# include <string.h>
|
||||
#endif
|
||||
#if HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#if HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#else
|
||||
# if HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
# endif
|
||||
#endif
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
87
tools/ucl/acc/acc_ince.h
Normal file
87
tools/ucl/acc/acc_ince.h
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __ACC_INCE_H_INCLUDED
|
||||
#define __ACC_INCE_H_INCLUDED 1
|
||||
|
||||
/* extra system includes */
|
||||
|
||||
#if defined(HAVE_STDARG_H)
|
||||
# include <stdarg.h>
|
||||
#endif
|
||||
#if defined(HAVE_CTYPE_H)
|
||||
# include <ctype.h>
|
||||
#endif
|
||||
#if defined(HAVE_ERRNO_H)
|
||||
# include <errno.h>
|
||||
#endif
|
||||
#if defined(HAVE_MALLOC_H)
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
#if defined(HAVE_ALLOCA_H)
|
||||
# include <alloca.h>
|
||||
#endif
|
||||
#if defined(HAVE_FCNTL_H)
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
#if defined(HAVE_DIRENT_H)
|
||||
# include <dirent.h>
|
||||
#endif
|
||||
#if defined(HAVE_SETJMP_H)
|
||||
# include <setjmp.h>
|
||||
#endif
|
||||
#if defined(HAVE_SIGNAL_H)
|
||||
# include <signal.h>
|
||||
#endif
|
||||
#if defined(TIME_WITH_SYS_TIME)
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
#elif defined(HAVE_TIME_H)
|
||||
# include <time.h>
|
||||
#endif
|
||||
#if defined(HAVE_UTIME_H)
|
||||
# include <utime.h>
|
||||
#elif defined(HAVE_SYS_UTIME_H)
|
||||
# include <sys/utime.h>
|
||||
#endif
|
||||
|
||||
/* DOS, OS/2 & Windows */
|
||||
#if defined(HAVE_IO_H)
|
||||
# include <io.h>
|
||||
#endif
|
||||
#if defined(HAVE_DOS_H)
|
||||
# include <dos.h>
|
||||
#endif
|
||||
#if defined(HAVE_DIRECT_H)
|
||||
# include <direct.h>
|
||||
#endif
|
||||
#if defined(HAVE_SHARE_H)
|
||||
# include <share.h>
|
||||
#endif
|
||||
#if defined(ACC_CC_NDPC)
|
||||
# include <os.h>
|
||||
#endif
|
||||
|
||||
/* TOS */
|
||||
#if defined(__TOS__) && (defined(__PUREC__) || defined(__TURBOC__))
|
||||
# include <ext.h>
|
||||
#endif
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
103
tools/ucl/acc/acc_inci.h
Normal file
103
tools/ucl/acc/acc_inci.h
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __ACC_INCI_H_INCLUDED
|
||||
#define __ACC_INCI_H_INCLUDED 1
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// internal system includes
|
||||
**************************************************************************/
|
||||
|
||||
#if (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
|
||||
# include <tos.h>
|
||||
#elif (ACC_HAVE_WINDOWS_H)
|
||||
# if 1 && !defined(WIN32_LEAN_AND_MEAN)
|
||||
# define WIN32_LEAN_AND_MEAN 1
|
||||
# endif
|
||||
# if 1 && !defined(_WIN32_WINNT)
|
||||
/* Restrict to a subset of Windows NT 4.0 header files */
|
||||
# define _WIN32_WINNT 0x0400
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# if (ACC_CC_BORLANDC || ACC_CC_TURBOC)
|
||||
# include <dir.h>
|
||||
# endif
|
||||
#elif (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_WIN16)
|
||||
# if (ACC_CC_AZTECC)
|
||||
# include <model.h>
|
||||
# include <stat.h>
|
||||
# elif (ACC_CC_BORLANDC || ACC_CC_TURBOC)
|
||||
# include <alloc.h>
|
||||
# include <dir.h>
|
||||
# elif (ACC_OS_DOS32 && ACC_CC_GNUC) && defined(__DJGPP__)
|
||||
# include <sys/exceptn.h>
|
||||
# elif (ACC_CC_PACIFICC)
|
||||
# include <unixio.h>
|
||||
# include <stat.h>
|
||||
# include <sys.h>
|
||||
# elif (ACC_CC_WATCOMC)
|
||||
# include <i86.h>
|
||||
# endif
|
||||
#elif (ACC_OS_OS216)
|
||||
# if (ACC_CC_WATCOMC)
|
||||
# include <i86.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
//
|
||||
**************************************************************************/
|
||||
|
||||
#if (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16)
|
||||
# if defined(FP_OFF)
|
||||
# define ACC_FP_OFF(x) FP_OFF(x)
|
||||
# elif defined(_FP_OFF)
|
||||
# define ACC_FP_OFF(x) _FP_OFF(x)
|
||||
# else
|
||||
# define ACC_FP_OFF(x) (((const unsigned __far*)&(x))[0])
|
||||
# endif
|
||||
# if defined(FP_SEG)
|
||||
# define ACC_FP_SEG(x) FP_SEG(x)
|
||||
# elif defined(_FP_SEG)
|
||||
# define ACC_FP_SEG(x) _FP_SEG(x)
|
||||
# else
|
||||
# define ACC_FP_SEG(x) (((const unsigned __far*)&(x))[1])
|
||||
# endif
|
||||
# if defined(MK_FP)
|
||||
# define ACC_MK_FP(s,o) MK_FP(s,o)
|
||||
# elif defined(_MK_FP)
|
||||
# define ACC_MK_FP(s,o) _MK_FP(s,o)
|
||||
# else
|
||||
# define ACC_MK_FP(s,o) ((void __far*)(((unsigned long)(s)<<16)+(unsigned)(o)))
|
||||
# endif
|
||||
# if 0
|
||||
# undef ACC_FP_OFF
|
||||
# undef ACC_FP_SEG
|
||||
# undef ACC_MK_FP
|
||||
# define ACC_FP_OFF(x) (((const unsigned __far*)&(x))[0])
|
||||
# define ACC_FP_SEG(x) (((const unsigned __far*)&(x))[1])
|
||||
# define ACC_MK_FP(s,o) ((void __far*)(((unsigned long)(s)<<16)+(unsigned)(o)))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
237
tools/ucl/acc/acc_init.h
Normal file
237
tools/ucl/acc/acc_init.h
Normal file
|
|
@ -0,0 +1,237 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// preprocessor
|
||||
************************************************************************/
|
||||
|
||||
/* workaround for preprocessor bugs in some compilers */
|
||||
#if 0
|
||||
#define ACC_0xffffL 0xfffful
|
||||
#define ACC_0xffffffffL 0xfffffffful
|
||||
#else
|
||||
#define ACC_0xffffL 65535ul
|
||||
#define ACC_0xffffffffL 4294967295ul
|
||||
#endif
|
||||
|
||||
/* some things we cannot work around */
|
||||
#if (ACC_0xffffL == ACC_0xffffffffL)
|
||||
# error "your preprocessor is broken 1"
|
||||
#endif
|
||||
#if (16ul * 16384ul != 262144ul)
|
||||
# error "your preprocessor is broken 2"
|
||||
#endif
|
||||
#if 0
|
||||
#if (32767 >= 4294967295ul)
|
||||
# error "your preprocessor is broken 3"
|
||||
#endif
|
||||
#if (65535u >= 4294967295ul)
|
||||
# error "your preprocessor is broken 4"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// try to detect specific compilers
|
||||
************************************************************************/
|
||||
|
||||
#if (UINT_MAX == ACC_0xffffL)
|
||||
#if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__)
|
||||
# if !defined(MSDOS)
|
||||
# define MSDOS 1
|
||||
# endif
|
||||
# if !defined(_MSDOS)
|
||||
# define _MSDOS 1
|
||||
# endif
|
||||
#elif defined(__VERSION) && defined(MB_LEN_MAX)
|
||||
# if (__VERSION == 520) && (MB_LEN_MAX == 1)
|
||||
# if !defined(__AZTEC_C__)
|
||||
# define __AZTEC_C__ __VERSION
|
||||
# endif
|
||||
# if !defined(__DOS__)
|
||||
# define __DOS__ 1
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// fix incorrect and missing stuff
|
||||
************************************************************************/
|
||||
|
||||
/* Microsoft C does not correctly define ptrdiff_t for
|
||||
* the 16-bit huge memory model.
|
||||
*/
|
||||
#if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == ACC_0xffffL)
|
||||
# define ptrdiff_t long
|
||||
# define _PTRDIFF_T_DEFINED
|
||||
#endif
|
||||
|
||||
|
||||
/* Fix old compiler versions. */
|
||||
#if (UINT_MAX == ACC_0xffffL)
|
||||
# undef __ACC_RENAME_A
|
||||
# undef __ACC_RENAME_B
|
||||
# if defined(__AZTEC_C__) && defined(__DOS__)
|
||||
# define __ACC_RENAME_A 1
|
||||
# elif defined(_MSC_VER) && defined(MSDOS)
|
||||
# if (_MSC_VER < 600)
|
||||
# define __ACC_RENAME_A 1
|
||||
# elif (_MSC_VER < 700)
|
||||
# define __ACC_RENAME_B 1
|
||||
# endif
|
||||
# elif defined(__TSC__) && defined(__OS2__)
|
||||
# define __ACC_RENAME_A 1
|
||||
# elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410)
|
||||
# define __ACC_RENAME_A 1
|
||||
# elif defined(__PACIFIC__) && defined(DOS)
|
||||
# if !defined(__far)
|
||||
# define __far far
|
||||
# endif
|
||||
# if !defined(__near)
|
||||
# define __near near
|
||||
# endif
|
||||
# endif
|
||||
# if defined(__ACC_RENAME_A)
|
||||
# if !defined(__cdecl)
|
||||
# define __cdecl cdecl
|
||||
# endif
|
||||
# if !defined(__far)
|
||||
# define __far far
|
||||
# endif
|
||||
# if !defined(__huge)
|
||||
# define __huge huge
|
||||
# endif
|
||||
# if !defined(__near)
|
||||
# define __near near
|
||||
# endif
|
||||
# if !defined(__pascal)
|
||||
# define __pascal pascal
|
||||
# endif
|
||||
# if !defined(__huge)
|
||||
# define __huge huge
|
||||
# endif
|
||||
# elif defined(__ACC_RENAME_B)
|
||||
# if !defined(__cdecl)
|
||||
# define __cdecl _cdecl
|
||||
# endif
|
||||
# if !defined(__far)
|
||||
# define __far _far
|
||||
# endif
|
||||
# if !defined(__huge)
|
||||
# define __huge _huge
|
||||
# endif
|
||||
# if !defined(__near)
|
||||
# define __near _near
|
||||
# endif
|
||||
# if !defined(__pascal)
|
||||
# define __pascal _pascal
|
||||
# endif
|
||||
# elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__)
|
||||
# if !defined(__cdecl)
|
||||
# define __cdecl cdecl
|
||||
# endif
|
||||
# if !defined(__pascal)
|
||||
# define __pascal pascal
|
||||
# endif
|
||||
# endif
|
||||
# undef __ACC_RENAME_A
|
||||
# undef __ACC_RENAME_B
|
||||
#endif
|
||||
|
||||
|
||||
#if (UINT_MAX == ACC_0xffffL)
|
||||
#if defined(__AZTEC_C__) && defined(__DOS__)
|
||||
# define ACC_BROKEN_CDECL_ALT_SYNTAX 1
|
||||
#elif defined(_MSC_VER) && defined(MSDOS)
|
||||
# if (_MSC_VER < 600)
|
||||
# define ACC_BROKEN_INTEGRAL_CONSTANTS 1
|
||||
# endif
|
||||
# if (_MSC_VER < 700)
|
||||
# define ACC_BROKEN_INTEGRAL_PROMOTION 1
|
||||
# define ACC_BROKEN_SIZEOF 1
|
||||
# endif
|
||||
#elif defined(__PACIFIC__) && defined(DOS)
|
||||
# define ACC_BROKEN_INTEGRAL_CONSTANTS 1
|
||||
#elif defined(__TURBOC__) && defined(__MSDOS__)
|
||||
# if (__TURBOC__ < 0x0150)
|
||||
# define ACC_BROKEN_CDECL_ALT_SYNTAX 1
|
||||
# define ACC_BROKEN_INTEGRAL_CONSTANTS 1
|
||||
# define ACC_BROKEN_INTEGRAL_PROMOTION 1
|
||||
# endif
|
||||
# if (__TURBOC__ < 0x0200)
|
||||
# define ACC_BROKEN_SIZEOF 1
|
||||
# endif
|
||||
# if (__TURBOC__ < 0x0400) && defined(__cplusplus)
|
||||
# define ACC_BROKEN_CDECL_ALT_SYNTAX 1
|
||||
# endif
|
||||
#elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__)
|
||||
# define ACC_BROKEN_CDECL_ALT_SYNTAX 1
|
||||
# define ACC_BROKEN_SIZEOF 1
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__WATCOMC__) && (__WATCOMC__ < 900)
|
||||
# define ACC_BROKEN_INTEGRAL_CONSTANTS 1
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// ANSI C preprocessor macros (cpp)
|
||||
************************************************************************/
|
||||
|
||||
#define ACC_CPP_STRINGIZE(x) #x
|
||||
#define ACC_CPP_MACRO_EXPAND(x) ACC_CPP_STRINGIZE(x)
|
||||
|
||||
/* concatenate */
|
||||
#define ACC_CPP_CONCAT2(a,b) a ## b
|
||||
#define ACC_CPP_CONCAT3(a,b,c) a ## b ## c
|
||||
#define ACC_CPP_CONCAT4(a,b,c,d) a ## b ## c ## d
|
||||
#define ACC_CPP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e
|
||||
|
||||
/* expand and concatenate (by using one level of indirection) */
|
||||
#define ACC_CPP_ECONCAT2(a,b) ACC_CPP_CONCAT2(a,b)
|
||||
#define ACC_CPP_ECONCAT3(a,b,c) ACC_CPP_CONCAT3(a,b,c)
|
||||
#define ACC_CPP_ECONCAT4(a,b,c,d) ACC_CPP_CONCAT4(a,b,c,d)
|
||||
#define ACC_CPP_ECONCAT5(a,b,c,d,e) ACC_CPP_CONCAT5(a,b,c,d,e)
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// stdc macros
|
||||
************************************************************************/
|
||||
|
||||
#if defined(__cplusplus)
|
||||
# undef __STDC_CONSTANT_MACROS
|
||||
# undef __STDC_LIMIT_MACROS
|
||||
# define __STDC_CONSTANT_MACROS 1
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// misc macros
|
||||
************************************************************************/
|
||||
|
||||
#if defined(__cplusplus)
|
||||
# define ACC_EXTERN_C extern "C"
|
||||
#else
|
||||
# define ACC_EXTERN_C extern
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
61
tools/ucl/acc/acc_lib.ch
Normal file
61
tools/ucl/acc/acc_lib.ch
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#if !defined(ACC_VERSION)
|
||||
# if defined ACC_CONFIG_INCLUDE
|
||||
# include ACC_CONFIG_INCLUDE("acc.h")
|
||||
# else
|
||||
# include "acc.h"
|
||||
# endif
|
||||
#endif
|
||||
#ifndef __ACC_INCD_H_INCLUDED
|
||||
# include ACC_CONFIG_INCLUDE("acc_incd.h")
|
||||
#endif
|
||||
#ifndef __ACC_INCE_H_INCLUDED
|
||||
# include ACC_CONFIG_INCLUDE("acc_ince.h")
|
||||
#endif
|
||||
#ifndef __ACC_INCI_H_INCLUDED
|
||||
# include ACC_CONFIG_INCLUDE("acc_inci.h")
|
||||
#endif
|
||||
#ifndef __ACC_LIB_H_INCLUDED
|
||||
# include ACC_CONFIG_INCLUDE("acc_lib.h")
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
#include ACC_CONFIG_INCLUDE("acclib/bele.ch")
|
||||
#include ACC_CONFIG_INCLUDE("acclib/hmemcpy.ch")
|
||||
#include ACC_CONFIG_INCLUDE("acclib/hstring.ch")
|
||||
#include ACC_CONFIG_INCLUDE("acclib/halloc.ch")
|
||||
#include ACC_CONFIG_INCLUDE("acclib/dosalloc.ch")
|
||||
#include ACC_CONFIG_INCLUDE("acclib/hfread.ch")
|
||||
#include ACC_CONFIG_INCLUDE("acclib/hread.ch")
|
||||
#include ACC_CONFIG_INCLUDE("acclib/opendir.ch")
|
||||
#include ACC_CONFIG_INCLUDE("acclib/rand.ch")
|
||||
#include ACC_CONFIG_INCLUDE("acclib/misc.ch")
|
||||
|
||||
#if 0
|
||||
/* modules which use floating point are not included by default */
|
||||
#include ACC_CONFIG_INCLUDE("acclib/uclock.ch")
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
526
tools/ucl/acc/acc_lib.h
Normal file
526
tools/ucl/acc/acc_lib.h
Normal file
|
|
@ -0,0 +1,526 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __ACC_LIB_H_INCLUDED
|
||||
#define __ACC_LIB_H_INCLUDED 1
|
||||
|
||||
|
||||
#if !defined(__ACCLIB_FUNCNAME)
|
||||
# define __ACCLIB_FUNCNAME(f) f
|
||||
#endif
|
||||
#if !defined(ACCLIB_EXTERN)
|
||||
# define ACCLIB_EXTERN(r,f) extern r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(__ACCLIB_CONST_CAST_RETURN)
|
||||
#if (ACC_CC_GNUC)
|
||||
# define __ACCLIB_CONST_CAST_RETURN(type,var) \
|
||||
{ union { type a; const type b; } u; u.b = (var); return u.a; }
|
||||
#else
|
||||
# define __ACCLIB_CONST_CAST_RETURN(type,var) return (type) (var);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if (ACC_OS_WIN64)
|
||||
# define acclib_handle_t acc_int64l_t
|
||||
# define acclib_uhandle_t acc_uint64l_t
|
||||
#elif (ACC_ARCH_IA32 && ACC_CC_MSC && (_MSC_VER >= 1300))
|
||||
typedef __w64 long acclib_handle_t;
|
||||
typedef __w64 unsigned long acclib_uhandle_t;
|
||||
# define acclib_handle_t acclib_handle_t
|
||||
# define acclib_uhandle_t acclib_uhandle_t
|
||||
#else
|
||||
# define acclib_handle_t long
|
||||
# define acclib_uhandle_t unsigned long
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// wrap <ctype.h>
|
||||
**************************************************************************/
|
||||
|
||||
#if 0
|
||||
ACCLIB_EXTERN(int, acc_ascii_digit) (int);
|
||||
ACCLIB_EXTERN(int, acc_ascii_islower) (int);
|
||||
ACCLIB_EXTERN(int, acc_ascii_isupper) (int);
|
||||
ACCLIB_EXTERN(int, acc_ascii_tolower) (int);
|
||||
ACCLIB_EXTERN(int, acc_ascii_toupper) (int);
|
||||
ACCLIB_EXTERN(int, acc_ascii_utolower) (int);
|
||||
ACCLIB_EXTERN(int, acc_ascii_utoupper) (int);
|
||||
#endif
|
||||
|
||||
#define acc_ascii_isdigit(c) (((unsigned)(c) - 48) < 10)
|
||||
#define acc_ascii_islower(c) (((unsigned)(c) - 97) < 26)
|
||||
#define acc_ascii_isupper(c) (((unsigned)(c) - 65) < 26)
|
||||
#define acc_ascii_tolower(c) ((int)(c) + (acc_ascii_isupper(c) << 5))
|
||||
#define acc_ascii_toupper(c) ((int)(c) - (acc_ascii_islower(c) << 5))
|
||||
|
||||
#define acc_ascii_utolower(c) acc_ascii_tolower((unsigned char)(c))
|
||||
#define acc_ascii_utoupper(c) acc_ascii_toupper((unsigned char)(c))
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// huge pointer layer
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef acc_hsize_t
|
||||
#if (ACC_HAVE_MM_HUGE_PTR)
|
||||
# define acc_hsize_t unsigned long
|
||||
# define acc_hvoid_p void __huge *
|
||||
# define acc_hchar_p char __huge *
|
||||
# define acc_hchar_pp char __huge * __huge *
|
||||
# define acc_hbyte_p unsigned char __huge *
|
||||
#else
|
||||
# define acc_hsize_t size_t
|
||||
# define acc_hvoid_p void *
|
||||
# define acc_hchar_p char *
|
||||
# define acc_hchar_pp char **
|
||||
# define acc_hbyte_p unsigned char *
|
||||
#endif
|
||||
#endif
|
||||
#ifndef ACC_FILE_P
|
||||
#define ACC_FILE_P FILE *
|
||||
#endif
|
||||
|
||||
/* halloc */
|
||||
ACCLIB_EXTERN(acc_hvoid_p, acc_halloc) (acc_hsize_t);
|
||||
ACCLIB_EXTERN(void, acc_hfree) (acc_hvoid_p);
|
||||
|
||||
/* dos_alloc */
|
||||
#if (ACC_OS_DOS16 || ACC_OS_OS216)
|
||||
ACCLIB_EXTERN(void __far*, acc_dos_alloc) (unsigned long);
|
||||
ACCLIB_EXTERN(int, acc_dos_free) (void __far*);
|
||||
#endif
|
||||
|
||||
/* string */
|
||||
ACCLIB_EXTERN(int, acc_hmemcmp) (const acc_hvoid_p, const acc_hvoid_p, acc_hsize_t);
|
||||
ACCLIB_EXTERN(acc_hvoid_p, acc_hmemcpy) (acc_hvoid_p, const acc_hvoid_p, acc_hsize_t);
|
||||
ACCLIB_EXTERN(acc_hvoid_p, acc_hmemmove) (acc_hvoid_p, const acc_hvoid_p, acc_hsize_t);
|
||||
ACCLIB_EXTERN(acc_hvoid_p, acc_hmemset) (acc_hvoid_p, int, acc_hsize_t);
|
||||
|
||||
/* string */
|
||||
ACCLIB_EXTERN(acc_hsize_t, acc_hstrlen) (const acc_hchar_p);
|
||||
ACCLIB_EXTERN(int, acc_hstrcmp) (const acc_hchar_p, const acc_hchar_p);
|
||||
ACCLIB_EXTERN(int, acc_hstrncmp)(const acc_hchar_p, const acc_hchar_p, acc_hsize_t);
|
||||
ACCLIB_EXTERN(int, acc_ascii_hstricmp) (const acc_hchar_p, const acc_hchar_p);
|
||||
ACCLIB_EXTERN(int, acc_ascii_hstrnicmp)(const acc_hchar_p, const acc_hchar_p, acc_hsize_t);
|
||||
ACCLIB_EXTERN(int, acc_ascii_hmemicmp) (const acc_hvoid_p, const acc_hvoid_p, acc_hsize_t);
|
||||
ACCLIB_EXTERN(acc_hchar_p, acc_hstrstr) (const acc_hchar_p, const acc_hchar_p);
|
||||
ACCLIB_EXTERN(acc_hchar_p, acc_ascii_hstristr) (const acc_hchar_p, const acc_hchar_p);
|
||||
ACCLIB_EXTERN(acc_hvoid_p, acc_hmemmem) (const acc_hvoid_p, acc_hsize_t, const acc_hvoid_p, acc_hsize_t);
|
||||
ACCLIB_EXTERN(acc_hvoid_p, acc_ascii_hmemimem) (const acc_hvoid_p, acc_hsize_t, const acc_hvoid_p, acc_hsize_t);
|
||||
ACCLIB_EXTERN(acc_hchar_p, acc_hstrcpy) (acc_hchar_p, const acc_hchar_p);
|
||||
ACCLIB_EXTERN(acc_hchar_p, acc_hstrcat) (acc_hchar_p, const acc_hchar_p);
|
||||
ACCLIB_EXTERN(acc_hsize_t, acc_hstrlcpy) (acc_hchar_p, const acc_hchar_p, acc_hsize_t);
|
||||
ACCLIB_EXTERN(acc_hsize_t, acc_hstrlcat) (acc_hchar_p, const acc_hchar_p, acc_hsize_t);
|
||||
ACCLIB_EXTERN(int, acc_hstrscpy) (acc_hchar_p, const acc_hchar_p, acc_hsize_t);
|
||||
ACCLIB_EXTERN(int, acc_hstrscat) (acc_hchar_p, const acc_hchar_p, acc_hsize_t);
|
||||
ACCLIB_EXTERN(acc_hchar_p, acc_hstrccpy) (acc_hchar_p, const acc_hchar_p, int);
|
||||
ACCLIB_EXTERN(acc_hvoid_p, acc_hmemccpy) (acc_hvoid_p, const acc_hvoid_p, int, acc_hsize_t);
|
||||
ACCLIB_EXTERN(acc_hchar_p, acc_hstrchr) (const acc_hchar_p, int);
|
||||
ACCLIB_EXTERN(acc_hchar_p, acc_hstrrchr) (const acc_hchar_p, int);
|
||||
ACCLIB_EXTERN(acc_hchar_p, acc_ascii_hstrichr) (const acc_hchar_p, int);
|
||||
ACCLIB_EXTERN(acc_hchar_p, acc_ascii_hstrrichr) (const acc_hchar_p, int);
|
||||
ACCLIB_EXTERN(acc_hvoid_p, acc_hmemchr) (const acc_hvoid_p, int, acc_hsize_t);
|
||||
ACCLIB_EXTERN(acc_hvoid_p, acc_hmemrchr) (const acc_hvoid_p, int, acc_hsize_t);
|
||||
ACCLIB_EXTERN(acc_hvoid_p, acc_ascii_hmemichr) (const acc_hvoid_p, int, acc_hsize_t);
|
||||
ACCLIB_EXTERN(acc_hvoid_p, acc_ascii_hmemrichr) (const acc_hvoid_p, int, acc_hsize_t);
|
||||
ACCLIB_EXTERN(acc_hsize_t, acc_hstrspn) (const acc_hchar_p, const acc_hchar_p);
|
||||
ACCLIB_EXTERN(acc_hsize_t, acc_hstrrspn) (const acc_hchar_p, const acc_hchar_p);
|
||||
ACCLIB_EXTERN(acc_hsize_t, acc_hstrcspn) (const acc_hchar_p, const acc_hchar_p);
|
||||
ACCLIB_EXTERN(acc_hsize_t, acc_hstrrcspn) (const acc_hchar_p, const acc_hchar_p);
|
||||
ACCLIB_EXTERN(acc_hchar_p, acc_hstrpbrk) (const acc_hchar_p, const acc_hchar_p);
|
||||
ACCLIB_EXTERN(acc_hchar_p, acc_hstrrpbrk) (const acc_hchar_p, const acc_hchar_p);
|
||||
ACCLIB_EXTERN(acc_hchar_p, acc_hstrsep) (acc_hchar_pp, const acc_hchar_p);
|
||||
ACCLIB_EXTERN(acc_hchar_p, acc_hstrrsep) (acc_hchar_pp, const acc_hchar_p);
|
||||
ACCLIB_EXTERN(acc_hchar_p, acc_ascii_hstrlwr) (acc_hchar_p);
|
||||
ACCLIB_EXTERN(acc_hchar_p, acc_ascii_hstrupr) (acc_hchar_p);
|
||||
ACCLIB_EXTERN(acc_hvoid_p, acc_ascii_hmemlwr) (acc_hvoid_p, acc_hsize_t);
|
||||
ACCLIB_EXTERN(acc_hvoid_p, acc_ascii_hmemupr) (acc_hvoid_p, acc_hsize_t);
|
||||
|
||||
/* stdio */
|
||||
ACCLIB_EXTERN(acc_hsize_t, acc_hfread) (ACC_FILE_P, acc_hvoid_p, acc_hsize_t);
|
||||
ACCLIB_EXTERN(acc_hsize_t, acc_hfwrite) (ACC_FILE_P, const acc_hvoid_p, acc_hsize_t);
|
||||
|
||||
/* io */
|
||||
#if (ACC_HAVE_MM_HUGE_PTR)
|
||||
ACCLIB_EXTERN(long, acc_hread) (int, acc_hvoid_p, long);
|
||||
ACCLIB_EXTERN(long, acc_hwrite) (int, const acc_hvoid_p, long);
|
||||
#endif
|
||||
ACCLIB_EXTERN(long, acc_safe_hread) (int, acc_hvoid_p, long);
|
||||
ACCLIB_EXTERN(long, acc_safe_hwrite) (int, const acc_hvoid_p, long);
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// wrap filename limits
|
||||
**************************************************************************/
|
||||
|
||||
/* maximum length of full pathname (excl. '\0') */
|
||||
#if !defined(ACC_FN_PATH_MAX)
|
||||
#if (ACC_OS_DOS16 || ACC_OS_WIN16)
|
||||
# define ACC_FN_PATH_MAX 143
|
||||
#elif (ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
# define ACC_FN_PATH_MAX 259
|
||||
#elif (ACC_OS_TOS)
|
||||
# define ACC_FN_PATH_MAX 259
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(ACC_FN_PATH_MAX)
|
||||
/* arbitrary limit for acclib implementation */
|
||||
# define ACC_FN_PATH_MAX 1024
|
||||
#endif
|
||||
|
||||
/* maximum length of a filename (a single path component) (excl. '\0') */
|
||||
#if !defined(ACC_FN_NAME_MAX)
|
||||
#if (ACC_OS_DOS16 || ACC_OS_WIN16)
|
||||
# define ACC_FN_NAME_MAX 12
|
||||
#elif (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
|
||||
# define ACC_FN_NAME_MAX 12
|
||||
#elif (ACC_OS_DOS32 && ACC_CC_GNUC) && defined(__DJGPP__)
|
||||
#elif (ACC_OS_DOS32)
|
||||
# define ACC_FN_NAME_MAX 12
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(ACC_FN_NAME_MAX)
|
||||
# define ACC_FN_NAME_MAX ACC_FN_PATH_MAX
|
||||
#endif
|
||||
|
||||
|
||||
#define ACC_FNMATCH_NOESCAPE 1
|
||||
#define ACC_FNMATCH_PATHNAME 2
|
||||
#define ACC_FNMATCH_PATHSTAR 4
|
||||
#define ACC_FNMATCH_PERIOD 8
|
||||
#define ACC_FNMATCH_ASCII_CASEFOLD 16
|
||||
ACCLIB_EXTERN(int, acc_fnmatch) (const acc_hchar_p, const acc_hchar_p, int);
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// wrap <dirent.h>
|
||||
**************************************************************************/
|
||||
|
||||
#undef __ACCLIB_USE_OPENDIR
|
||||
#if (HAVE_DIRENT_H || ACC_CC_WATCOMC)
|
||||
# define __ACCLIB_USE_OPENDIR 1
|
||||
# if (ACC_OS_DOS32 && defined(__BORLANDC__))
|
||||
# elif (ACC_OS_DOS32 && ACC_CC_GNUC) && defined(__DJGPP__)
|
||||
# elif (ACC_OS_OS2 || ACC_OS_OS216)
|
||||
# elif (ACC_OS_TOS && ACC_CC_GNUC)
|
||||
# elif (ACC_OS_WIN32 && !defined(ACC_HAVE_WINDOWS_H))
|
||||
# elif (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_TOS || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
# undef __ACCLIB_USE_OPENDIR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#if defined(__ACCLIB_USE_OPENDIR)
|
||||
void *u_dirp; /* private */
|
||||
# if (ACC_CC_WATCOMC)
|
||||
unsigned short f_time;
|
||||
unsigned short f_date;
|
||||
unsigned long f_size;
|
||||
# endif
|
||||
char f_name[ACC_FN_NAME_MAX+1];
|
||||
#elif (ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
acclib_handle_t u_handle; /* private */
|
||||
unsigned f_attr;
|
||||
unsigned f_size_low;
|
||||
unsigned f_size_high;
|
||||
char f_name[ACC_FN_NAME_MAX+1];
|
||||
#elif (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_TOS || ACC_OS_WIN16)
|
||||
char u_dta[21]; /* private */
|
||||
unsigned char f_attr;
|
||||
unsigned short f_time;
|
||||
unsigned short f_date;
|
||||
unsigned short f_size_low;
|
||||
unsigned short f_size_high;
|
||||
char f_name[ACC_FN_NAME_MAX+1];
|
||||
char u_dirp; /* private */
|
||||
#else
|
||||
void *u_dirp; /* private */
|
||||
char f_name[ACC_FN_NAME_MAX+1];
|
||||
#endif
|
||||
} acc_dir_t;
|
||||
|
||||
#ifndef acc_dir_p
|
||||
#define acc_dir_p acc_dir_t *
|
||||
#endif
|
||||
|
||||
ACCLIB_EXTERN(int, acc_opendir) (acc_dir_p, const char*);
|
||||
ACCLIB_EXTERN(int, acc_readdir) (acc_dir_p);
|
||||
ACCLIB_EXTERN(int, acc_closedir) (acc_dir_p);
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// wrap misc
|
||||
**************************************************************************/
|
||||
|
||||
#if (ACC_CC_GNUC) && (defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
# define acc_alloca(x) __builtin_alloca((x))
|
||||
#elif (ACC_CC_BORLANDC) && defined(__linux__)
|
||||
/* FIXME: alloca does not work */
|
||||
#elif (HAVE_ALLOCA)
|
||||
# define acc_alloca(x) alloca((x))
|
||||
#endif
|
||||
|
||||
#if (ACC_OS_DOS32 && ACC_CC_GNUC) && defined(__DJGPP__)
|
||||
# define acc_stackavail() stackavail()
|
||||
#elif (ACC_ARCH_IA16 && ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0410))
|
||||
# define acc_stackavail() stackavail()
|
||||
#elif (ACC_ARCH_IA16 && ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0400))
|
||||
# if (ACC_OS_WIN16) && (ACC_MM_TINY || ACC_MM_SMALL || ACC_MM_MEDIUM)
|
||||
# else
|
||||
# define acc_stackavail() stackavail()
|
||||
# endif
|
||||
#elif ((ACC_ARCH_IA16 || ACC_ARCH_IA32) && (ACC_CC_DMC || ACC_CC_SYMANTECC))
|
||||
# define acc_stackavail() stackavail()
|
||||
#elif ((ACC_ARCH_IA16) && ACC_CC_MSC && (_MSC_VER >= 700))
|
||||
# define acc_stackavail() _stackavail()
|
||||
#elif ((ACC_ARCH_IA16) && ACC_CC_MSC)
|
||||
# define acc_stackavail() stackavail()
|
||||
#elif ((ACC_ARCH_IA16 || ACC_ARCH_IA32) && ACC_CC_TURBOC && (__TURBOC__ >= 0x0450))
|
||||
# define acc_stackavail() stackavail()
|
||||
#elif (ACC_ARCH_IA16 && ACC_CC_TURBOC && (__TURBOC__ >= 0x0400))
|
||||
ACC_EXTERN_C size_t __cdecl stackavail(void);
|
||||
# define acc_stackavail() stackavail()
|
||||
#elif ((ACC_ARCH_IA16 || ACC_ARCH_IA32) && (ACC_CC_WATCOMC))
|
||||
# define acc_stackavail() stackavail()
|
||||
#elif (ACC_ARCH_IA16 && ACC_CC_ZORTECHC)
|
||||
# define acc_stackavail() _chkstack()
|
||||
#endif
|
||||
|
||||
ACCLIB_EXTERN(acclib_handle_t, acc_get_osfhandle) (int);
|
||||
ACCLIB_EXTERN(int, acc_isatty) (int);
|
||||
ACCLIB_EXTERN(int, acc_mkdir) (const char*, unsigned);
|
||||
ACCLIB_EXTERN(int, acc_response) (int*, char***);
|
||||
ACCLIB_EXTERN(int, acc_set_binmode) (int, int);
|
||||
|
||||
ACCLIB_EXTERN(acc_int32l_t, acc_muldiv32) (acc_int32l_t, acc_int32l_t, acc_int32l_t);
|
||||
ACCLIB_EXTERN(acc_uint32l_t, acc_umuldiv32) (acc_uint32l_t, acc_uint32l_t, acc_uint32l_t);
|
||||
|
||||
ACCLIB_EXTERN(void, acc_wildargv) (int*, char***);
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// uclock (real, i.e. "wall" clock)
|
||||
**************************************************************************/
|
||||
|
||||
#if defined(acc_int32e_t)
|
||||
ACCLIB_EXTERN(int, acc_tsc_read) (acc_uint32e_t*);
|
||||
ACCLIB_EXTERN(int, acc_tsc_read_add) (acc_uint32e_t*);
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct { /* all private */
|
||||
acclib_handle_t h;
|
||||
int mode;
|
||||
#if (ACC_HAVE_WINDOWS_H) && defined(acc_int64l_t)
|
||||
double qpf;
|
||||
#endif
|
||||
} acc_uclock_handle_t;
|
||||
|
||||
typedef struct { /* all private */
|
||||
union {
|
||||
acc_uint32l_t t32;
|
||||
#if !(ACC_OS_DOS16 || ACC_OS_WIN16)
|
||||
double td;
|
||||
# if defined(acc_int64l_t)
|
||||
acc_int64l_t t64;
|
||||
# endif
|
||||
#endif
|
||||
} ticks;
|
||||
#if (ACC_HAVE_WINDOWS_H) && defined(acc_int64l_t)
|
||||
acc_int64l_t qpc;
|
||||
#endif
|
||||
} acc_uclock_t;
|
||||
|
||||
#ifndef acc_uclock_handle_p
|
||||
#define acc_uclock_handle_p acc_uclock_handle_t *
|
||||
#endif
|
||||
#ifndef acc_uclock_p
|
||||
#define acc_uclock_p acc_uclock_t *
|
||||
#endif
|
||||
|
||||
ACCLIB_EXTERN(int, acc_uclock_open) (acc_uclock_handle_p);
|
||||
ACCLIB_EXTERN(int, acc_uclock_close) (acc_uclock_handle_p);
|
||||
ACCLIB_EXTERN(void, acc_uclock_read) (acc_uclock_handle_p, acc_uclock_p);
|
||||
ACCLIB_EXTERN(double, acc_uclock_get_elapsed) (acc_uclock_handle_p, const acc_uclock_p, const acc_uclock_p);
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// performance counters (virtual clock)
|
||||
**************************************************************************/
|
||||
|
||||
#if defined(acc_int64l_t)
|
||||
|
||||
typedef struct { /* all private */
|
||||
void* h;
|
||||
unsigned cpu_type, cpu_features, cpu_khz, cpu_nrctrs;
|
||||
const char* cpu_name;
|
||||
} acc_perfctr_handle_t;
|
||||
|
||||
typedef struct {
|
||||
acc_uint64l_t tsc;
|
||||
#if (ACC_OS_POSIX_LINUX)
|
||||
acc_uint64l_t pmc[18];
|
||||
#else
|
||||
acc_uint64l_t pmc[1];
|
||||
#endif
|
||||
} acc_perfctr_clock_t;
|
||||
|
||||
#ifndef acc_perfctr_handle_p
|
||||
#define acc_perfctr_handle_p acc_perfctr_handle_t *
|
||||
#endif
|
||||
#ifndef acc_perfctr_clock_p
|
||||
#define acc_perfctr_clock_p acc_perfctr_clock_t *
|
||||
#endif
|
||||
|
||||
ACCLIB_EXTERN(int, acc_perfctr_open) (acc_perfctr_handle_p);
|
||||
ACCLIB_EXTERN(int, acc_perfctr_close) (acc_perfctr_handle_p);
|
||||
ACCLIB_EXTERN(void, acc_perfctr_read) (acc_perfctr_handle_p, acc_perfctr_clock_p);
|
||||
ACCLIB_EXTERN(double, acc_perfctr_get_elapsed) (acc_perfctr_handle_p, const acc_perfctr_clock_p, const acc_perfctr_clock_p);
|
||||
ACCLIB_EXTERN(double, acc_perfctr_get_elapsed_tsc) (acc_perfctr_handle_p, acc_uint64l_t);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// Big Endian / Little Endian
|
||||
**************************************************************************/
|
||||
|
||||
ACCLIB_EXTERN(unsigned, acc_get_be16) (const acc_hvoid_p);
|
||||
ACCLIB_EXTERN(acc_uint32l_t, acc_get_be24) (const acc_hvoid_p);
|
||||
ACCLIB_EXTERN(acc_uint32l_t, acc_get_be32) (const acc_hvoid_p);
|
||||
ACCLIB_EXTERN(void, acc_set_be16) (acc_hvoid_p, unsigned);
|
||||
ACCLIB_EXTERN(void, acc_set_be24) (acc_hvoid_p, acc_uint32l_t);
|
||||
ACCLIB_EXTERN(void, acc_set_be32) (acc_hvoid_p, acc_uint32l_t);
|
||||
ACCLIB_EXTERN(unsigned, acc_get_le16) (const acc_hvoid_p);
|
||||
ACCLIB_EXTERN(acc_uint32l_t, acc_get_le24) (const acc_hvoid_p);
|
||||
ACCLIB_EXTERN(acc_uint32l_t, acc_get_le32) (const acc_hvoid_p);
|
||||
ACCLIB_EXTERN(void, acc_set_le16) (acc_hvoid_p, unsigned);
|
||||
ACCLIB_EXTERN(void, acc_set_le24) (acc_hvoid_p, acc_uint32l_t);
|
||||
ACCLIB_EXTERN(void, acc_set_le32) (acc_hvoid_p, acc_uint32l_t);
|
||||
#if defined(acc_uint64l_t)
|
||||
ACCLIB_EXTERN(acc_uint64l_t, acc_get_be64) (const acc_hvoid_p);
|
||||
ACCLIB_EXTERN(void, acc_set_be64) (acc_hvoid_p, acc_uint64l_t);
|
||||
ACCLIB_EXTERN(acc_uint64l_t, acc_get_le64) (const acc_hvoid_p);
|
||||
ACCLIB_EXTERN(void, acc_set_le64) (acc_hvoid_p, acc_uint64l_t);
|
||||
#endif
|
||||
|
||||
/* inline versions */
|
||||
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32)
|
||||
# define ACC_GET_LE16(p) (* (const unsigned short *) (p))
|
||||
# define ACC_GET_LE32(p) (* (const acc_uint32e_t *) (p))
|
||||
# define ACC_SET_LE16(p,v) (* (unsigned short *) (p) = (unsigned short) (v))
|
||||
# define ACC_SET_LE32(p,v) (* (acc_uint32e_t *) (p) = (acc_uint32e_t) (v))
|
||||
#endif
|
||||
#if (ACC_ARCH_AMD64)
|
||||
# define ACC_GET_LE64(p) (* (const acc_uint64l_t *) (p))
|
||||
# define ACC_SET_LE64(p,v) (* (acc_uint64l_t *) (p) = (acc_uint64l_t) (v))
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// getopt
|
||||
**************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
const char* name;
|
||||
int has_arg;
|
||||
int* flag;
|
||||
int val;
|
||||
} acc_getopt_longopt_t;
|
||||
#ifndef acc_getopt_longopt_p
|
||||
#define acc_getopt_longopt_p acc_getopt_longopt_t *
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int go_argc;
|
||||
char** go_argv;
|
||||
const char* go_shortopts;
|
||||
const acc_getopt_longopt_p longopts;
|
||||
#if (ACC_BROKEN_CDECL_ALT_SYNTAX)
|
||||
int __acc_cdecl_va (*go_error)(const char *, ...);
|
||||
#else
|
||||
int (__acc_cdecl_va *go_error)(const char *, ...);
|
||||
#endif
|
||||
} acc_getopt_t;
|
||||
#ifndef acc_getopt_p
|
||||
#define acc_getopt_p acc_getopt_t *
|
||||
#endif
|
||||
|
||||
ACCLIB_EXTERN(void, acc_getopt_init) (acc_getopt_p);
|
||||
ACCLIB_EXTERN(int, acc_getopt) (acc_getopt_p);
|
||||
ACCLIB_EXTERN(void, acc_getopt_close)(acc_getopt_p);
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// rand
|
||||
**************************************************************************/
|
||||
|
||||
typedef struct { /* all private */
|
||||
acc_uint32l_t seed;
|
||||
} acc_rand31_t;
|
||||
#ifndef acc_rand31_p
|
||||
#define acc_rand31_p acc_rand31_t *
|
||||
#endif
|
||||
ACCLIB_EXTERN(void, acc_srand31) (acc_rand31_p, acc_uint32l_t);
|
||||
ACCLIB_EXTERN(acc_uint32l_t, acc_rand31) (acc_rand31_p);
|
||||
|
||||
#if defined(acc_uint64l_t)
|
||||
typedef struct { /* all private */
|
||||
acc_uint64l_t seed;
|
||||
} acc_rand48_t;
|
||||
#ifndef acc_rand48_p
|
||||
#define acc_rand48_p acc_rand48_t *
|
||||
#endif
|
||||
ACCLIB_EXTERN(void, acc_srand48) (acc_rand48_p, acc_uint32l_t);
|
||||
ACCLIB_EXTERN(acc_uint32l_t, acc_rand48) (acc_rand48_p);
|
||||
ACCLIB_EXTERN(acc_uint32l_t, acc_rand48_r32) (acc_rand48_p);
|
||||
#endif
|
||||
|
||||
#if defined(acc_uint64l_t)
|
||||
typedef struct { /* all private */
|
||||
acc_uint64l_t seed;
|
||||
} acc_rand64_t;
|
||||
#ifndef acc_rand64_p
|
||||
#define acc_rand64_p acc_rand64_t *
|
||||
#endif
|
||||
ACCLIB_EXTERN(void, acc_srand64) (acc_rand64_p, acc_uint64l_t);
|
||||
ACCLIB_EXTERN(acc_uint32l_t, acc_rand64) (acc_rand64_p);
|
||||
ACCLIB_EXTERN(acc_uint32l_t, acc_rand64_r32) (acc_rand64_p);
|
||||
#endif
|
||||
|
||||
typedef struct { /* all private */
|
||||
unsigned n;
|
||||
acc_uint32l_t s[624];
|
||||
} acc_randmt_t;
|
||||
#ifndef acc_randmt_p
|
||||
#define acc_randmt_p acc_randmt_t *
|
||||
#endif
|
||||
ACCLIB_EXTERN(void, acc_srandmt) (acc_randmt_p, acc_uint32l_t);
|
||||
ACCLIB_EXTERN(acc_uint32l_t, acc_randmt) (acc_randmt_p);
|
||||
ACCLIB_EXTERN(acc_uint32l_t, acc_randmt_r32) (acc_randmt_p);
|
||||
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
199
tools/ucl/acc/acc_mm.h
Normal file
199
tools/ucl/acc/acc_mm.h
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Memory Model - exactly one of:
|
||||
*
|
||||
* ACC_MM_FLAT [default]
|
||||
* ACC_MM_TINY
|
||||
* ACC_MM_SMALL
|
||||
* ACC_MM_MEDIUM
|
||||
* ACC_MM_COMPACT
|
||||
* ACC_MM_LARGE
|
||||
* ACC_MM_HUGE
|
||||
*/
|
||||
|
||||
#if (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16)
|
||||
|
||||
#if (UINT_MAX != ACC_0xffffL)
|
||||
# error "this should not happen"
|
||||
#endif
|
||||
#if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM)
|
||||
# define ACC_MM_TINY 1
|
||||
#elif defined(__HUGE__) || defined(_HUGE_) || defined(M_I86HM) || defined(_M_I86HM)
|
||||
# define ACC_MM_HUGE 1
|
||||
#elif defined(__SMALL__) || defined(M_I86SM) || defined(_M_I86SM) || defined(SMALL_MODEL)
|
||||
# define ACC_MM_SMALL 1
|
||||
#elif defined(__MEDIUM__) || defined(M_I86MM) || defined(_M_I86MM)
|
||||
# define ACC_MM_MEDIUM 1
|
||||
#elif defined(__COMPACT__) || defined(M_I86CM) || defined(_M_I86CM)
|
||||
# define ACC_MM_COMPACT 1
|
||||
#elif defined(__LARGE__) || defined(M_I86LM) || defined(_M_I86LM) || defined(LARGE_MODEL)
|
||||
# define ACC_MM_LARGE 1
|
||||
#elif (ACC_CC_AZTECC)
|
||||
# if defined(_LARGE_CODE) && defined(_LARGE_DATA)
|
||||
# define ACC_MM_LARGE 1
|
||||
# elif defined(_LARGE_CODE)
|
||||
# define ACC_MM_MEDIUM 1
|
||||
# elif defined(_LARGE_DATA)
|
||||
# define ACC_MM_COMPACT 1
|
||||
# else
|
||||
# define ACC_MM_SMALL 1
|
||||
# endif
|
||||
#elif (ACC_CC_ZORTECHC && defined(__VCM__))
|
||||
# define ACC_MM_LARGE 1
|
||||
#else
|
||||
# error "unknown memory model"
|
||||
#endif
|
||||
|
||||
|
||||
/* ACC_HAVE_MM_HUGE_PTR ... working __huge pointers
|
||||
* ACC_HAVE_MM_HUGE_ARRAY ... char __huge x[256*1024L] works */
|
||||
#define ACC_HAVE_MM_HUGE_PTR 1
|
||||
#define ACC_HAVE_MM_HUGE_ARRAY 1
|
||||
|
||||
#if (ACC_MM_TINY)
|
||||
# undef ACC_HAVE_MM_HUGE_ARRAY
|
||||
#endif
|
||||
|
||||
#if (ACC_CC_AZTECC || ACC_CC_PACIFICC || ACC_CC_ZORTECHC)
|
||||
# undef ACC_HAVE_MM_HUGE_PTR
|
||||
# undef ACC_HAVE_MM_HUGE_ARRAY
|
||||
#elif (ACC_CC_DMC || ACC_CC_SYMANTECC)
|
||||
# undef ACC_HAVE_MM_HUGE_ARRAY
|
||||
#elif (ACC_CC_MSC && defined(_QC))
|
||||
# undef ACC_HAVE_MM_HUGE_ARRAY
|
||||
# if (_MSC_VER < 600)
|
||||
# undef ACC_HAVE_MM_HUGE_PTR
|
||||
# endif
|
||||
#elif (ACC_CC_TURBOC && (__TURBOC__ < 0x0295))
|
||||
# undef ACC_HAVE_MM_HUGE_ARRAY
|
||||
#elif (ACC_CC_WATCOMC && (__WATCOMC__ >= 1200))
|
||||
/* pointer arithmetics with __huge arrays seems broken in OpenWatcom 1.x */
|
||||
# undef ACC_HAVE_MM_HUGE_ARRAY
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#if (ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0200))
|
||||
extern void __near __cdecl _AHSHIFT(void);
|
||||
# define ACC_MM_AHSHIFT ((unsigned) _AHSHIFT)
|
||||
#elif (ACC_CC_DMC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
||||
extern void __near __cdecl _AHSHIFT(void);
|
||||
# define ACC_MM_AHSHIFT ((unsigned) _AHSHIFT)
|
||||
#elif (ACC_CC_MSC || ACC_CC_TOPSPEEDC)
|
||||
extern void __near __cdecl _AHSHIFT(void);
|
||||
# define ACC_MM_AHSHIFT ((unsigned) _AHSHIFT)
|
||||
#elif (ACC_CC_TURBOC && (__TURBOC__ >= 0x0295))
|
||||
extern void __near __cdecl _AHSHIFT(void);
|
||||
# define ACC_MM_AHSHIFT ((unsigned) _AHSHIFT)
|
||||
#elif ((ACC_CC_AZTECC || ACC_CC_PACIFICC || ACC_CC_TURBOC) && ACC_OS_DOS16)
|
||||
# define ACC_MM_AHSHIFT 12
|
||||
#elif (ACC_CC_WATCOMC)
|
||||
extern unsigned char _HShift;
|
||||
# define ACC_MM_AHSHIFT ((unsigned) _HShift)
|
||||
#else
|
||||
# error "FIXME - implement ACC_MM_AHSHIFT"
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#elif (ACC_ARCH_C166)
|
||||
#if !defined(__MODEL__)
|
||||
# error "FIXME - C166 __MODEL__"
|
||||
#elif ((__MODEL__) == 0)
|
||||
# define ACC_MM_SMALL 1
|
||||
#elif ((__MODEL__) == 1)
|
||||
# define ACC_MM_SMALL 1
|
||||
#elif ((__MODEL__) == 2)
|
||||
# define ACC_MM_LARGE 1
|
||||
#elif ((__MODEL__) == 3)
|
||||
# define ACC_MM_TINY 1
|
||||
#elif ((__MODEL__) == 4)
|
||||
# define ACC_MM_XTINY 1
|
||||
#elif ((__MODEL__) == 5)
|
||||
# define ACC_MM_XSMALL 1
|
||||
#else
|
||||
# error "FIXME - C166 __MODEL__"
|
||||
#endif
|
||||
|
||||
|
||||
#elif (ACC_ARCH_MCS251)
|
||||
#if !defined(__MODEL__)
|
||||
# error "FIXME - MCS251 __MODEL__"
|
||||
#elif ((__MODEL__) == 0)
|
||||
# define ACC_MM_SMALL 1
|
||||
#elif ((__MODEL__) == 2)
|
||||
# define ACC_MM_LARGE 1
|
||||
#elif ((__MODEL__) == 3)
|
||||
# define ACC_MM_TINY 1
|
||||
#elif ((__MODEL__) == 4)
|
||||
# define ACC_MM_XTINY 1
|
||||
#elif ((__MODEL__) == 5)
|
||||
# define ACC_MM_XSMALL 1
|
||||
#else
|
||||
# error "FIXME - MCS251 __MODEL__"
|
||||
#endif
|
||||
|
||||
|
||||
#elif (ACC_ARCH_MCS51)
|
||||
#if !defined(__MODEL__)
|
||||
# error "FIXME - MCS51 __MODEL__"
|
||||
#elif ((__MODEL__) == 1)
|
||||
# define ACC_MM_SMALL 1
|
||||
#elif ((__MODEL__) == 2)
|
||||
# define ACC_MM_LARGE 1
|
||||
#elif ((__MODEL__) == 3)
|
||||
# define ACC_MM_TINY 1
|
||||
#elif ((__MODEL__) == 4)
|
||||
# define ACC_MM_XTINY 1
|
||||
#elif ((__MODEL__) == 5)
|
||||
# define ACC_MM_XSMALL 1
|
||||
#else
|
||||
# error "FIXME - MCS51 __MODEL__"
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
# define ACC_MM_FLAT 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if (ACC_MM_FLAT)
|
||||
# define ACC_INFO_MM "flat"
|
||||
#elif (ACC_MM_TINY)
|
||||
# define ACC_INFO_MM "tiny"
|
||||
#elif (ACC_MM_SMALL)
|
||||
# define ACC_INFO_MM "small"
|
||||
#elif (ACC_MM_MEDIUM)
|
||||
# define ACC_INFO_MM "medium"
|
||||
#elif (ACC_MM_COMPACT)
|
||||
# define ACC_INFO_MM "compact"
|
||||
#elif (ACC_MM_LARGE)
|
||||
# define ACC_INFO_MM "large"
|
||||
#elif (ACC_MM_HUGE)
|
||||
# define ACC_INFO_MM "huge"
|
||||
#else
|
||||
# error "unknown memory model"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
203
tools/ucl/acc/acc_os.h
Normal file
203
tools/ucl/acc/acc_os.h
Normal file
|
|
@ -0,0 +1,203 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Operating System - exactly one of:
|
||||
*
|
||||
* ACC_OS_POSIX [default]
|
||||
* ACC_OS_AMIGAOS
|
||||
* ACC_OS_BEOS
|
||||
* ACC_OS_CYGWIN hybrid WIN32 and POSIX
|
||||
* ACC_OS_DOS16 16-bit DOS (segmented memory model)
|
||||
* ACC_OS_DOS32
|
||||
* ACC_OS_EMX hybrid OS/2, DOS32, WIN32 (with RSX) and POSIX
|
||||
* ACC_OS_MACCLASSIC Macintosh Classic
|
||||
* ACC_OS_PALMOS
|
||||
* ACC_OS_OS2 OS/2
|
||||
* ACC_OS_OS216 16-bit OS/2 1.x (segmented memory model)
|
||||
* ACC_OS_QNX
|
||||
* ACC_OS_RISCOS
|
||||
* ACC_OS_TOS Atari TOS / MiNT
|
||||
* ACC_OS_VMS
|
||||
* ACC_OS_WIN16 16-bit Windows 3.x (segmented memory model)
|
||||
* ACC_OS_WIN32
|
||||
* ACC_OS_WIN64 64-bit Windows (LLP64 programming model)
|
||||
*/
|
||||
|
||||
|
||||
#if defined(__CYGWIN__) && defined(__GNUC__)
|
||||
# define ACC_OS_CYGWIN 1
|
||||
# define ACC_INFO_OS "cygwin"
|
||||
#elif defined(__EMX__) && defined(__GNUC__)
|
||||
# define ACC_OS_EMX 1
|
||||
# define ACC_INFO_OS "emx"
|
||||
#elif defined(__BEOS__)
|
||||
# define ACC_OS_BEOS 1
|
||||
# define ACC_INFO_OS "beos"
|
||||
#elif defined(__QNX__)
|
||||
# define ACC_OS_QNX 1
|
||||
# define ACC_INFO_OS "qnx"
|
||||
#elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460)
|
||||
# define ACC_OS_DOS32 1
|
||||
# define ACC_INFO_OS "dos32"
|
||||
#elif defined(__BORLANDC__) && defined(__DPMI16__)
|
||||
# define ACC_OS_DOS16 1
|
||||
# define ACC_INFO_OS "dos16"
|
||||
#elif defined(__ZTC__) && defined(DOS386)
|
||||
# define ACC_OS_DOS32 1
|
||||
# define ACC_INFO_OS "dos32"
|
||||
#elif defined(__OS2__) || defined(__OS2V2__)
|
||||
# if (UINT_MAX == ACC_0xffffL)
|
||||
# define ACC_OS_OS216 1
|
||||
# define ACC_INFO_OS "os216"
|
||||
# elif (UINT_MAX == ACC_0xffffffffL)
|
||||
# define ACC_OS_OS2 1
|
||||
# define ACC_INFO_OS "os2"
|
||||
# else
|
||||
# error "check your limits.h header"
|
||||
# endif
|
||||
#elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64)
|
||||
# define ACC_OS_WIN64 1
|
||||
# define ACC_INFO_OS "win64"
|
||||
#elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__)
|
||||
# define ACC_OS_WIN32 1
|
||||
# define ACC_INFO_OS "win32"
|
||||
#elif defined(__MWERKS__) && defined(__INTEL__)
|
||||
# define ACC_OS_WIN32 1
|
||||
# define ACC_INFO_OS "win32"
|
||||
#elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows)
|
||||
# if (UINT_MAX == ACC_0xffffL)
|
||||
# define ACC_OS_WIN16 1
|
||||
# define ACC_INFO_OS "win16"
|
||||
# elif (UINT_MAX == ACC_0xffffffffL)
|
||||
# define ACC_OS_WIN32 1
|
||||
# define ACC_INFO_OS "win32"
|
||||
# else
|
||||
# error "check your limits.h header"
|
||||
# endif
|
||||
#elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS))
|
||||
# if (UINT_MAX == ACC_0xffffL)
|
||||
# define ACC_OS_DOS16 1
|
||||
# define ACC_INFO_OS "dos16"
|
||||
# elif (UINT_MAX == ACC_0xffffffffL)
|
||||
# define ACC_OS_DOS32 1
|
||||
# define ACC_INFO_OS "dos32"
|
||||
# else
|
||||
# error "check your limits.h header"
|
||||
# endif
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(__NT__) && (UINT_MAX == ACC_0xffffL)
|
||||
/* wcl: NT host defaults to DOS target */
|
||||
# define ACC_OS_DOS16 1
|
||||
# define ACC_INFO_OS "dos16"
|
||||
# elif defined(__NT__) && (__WATCOMC__ < 1100)
|
||||
/* wcl386: Watcom C 11 defines _WIN32 */
|
||||
# define ACC_OS_WIN32 1
|
||||
# define ACC_INFO_OS "win32"
|
||||
# else
|
||||
# error "please specify a target using the -bt compiler option"
|
||||
# endif
|
||||
#elif defined(__palmos__)
|
||||
# if (UINT_MAX == ACC_0xffffL)
|
||||
# define ACC_OS_PALMOS 1
|
||||
# define ACC_INFO_OS "palmos"
|
||||
# else
|
||||
# error "check your limits.h header"
|
||||
# endif
|
||||
#elif defined(__TOS__) || defined(__atarist__)
|
||||
# define ACC_OS_TOS 1
|
||||
# define ACC_INFO_OS "tos"
|
||||
#elif defined(macintosh) && !defined(__ppc__)
|
||||
# define ACC_OS_MACCLASSIC 1
|
||||
# define ACC_INFO_OS "macclassic"
|
||||
#elif defined(__VMS)
|
||||
# define ACC_OS_VMS 1
|
||||
# define ACC_INFO_OS "vms"
|
||||
#else
|
||||
# define ACC_OS_POSIX 1
|
||||
# define ACC_INFO_OS "posix"
|
||||
#endif
|
||||
|
||||
|
||||
#if (ACC_OS_POSIX)
|
||||
# if defined(_AIX) || defined(__AIX__) || defined(__aix__)
|
||||
# define ACC_OS_POSIX_AIX 1
|
||||
# define ACC_INFO_OS_POSIX "aix"
|
||||
# elif defined(__FreeBSD__)
|
||||
# define ACC_OS_POSIX_FREEBSD 1
|
||||
# define ACC_INFO_OS_POSIX "freebsd"
|
||||
# elif defined(__hpux__) || defined(__hpux)
|
||||
# define ACC_OS_POSIX_HPUX 1
|
||||
# define ACC_INFO_OS_POSIX "hpux"
|
||||
# elif defined(__INTERIX)
|
||||
# define ACC_OS_POSIX_INTERIX 1
|
||||
# define ACC_INFO_OS_POSIX "interix"
|
||||
# elif defined(__IRIX__) || defined(__irix__)
|
||||
# define ACC_OS_POSIX_IRIX 1
|
||||
# define ACC_INFO_OS_POSIX "irix"
|
||||
# elif defined(__linux__) || defined(__linux)
|
||||
# define ACC_OS_POSIX_LINUX 1
|
||||
# define ACC_INFO_OS_POSIX "linux"
|
||||
# elif defined(__APPLE__) || defined(__MACOS__)
|
||||
# define ACC_OS_POSIX_MACOSX 1
|
||||
# define ACC_INFO_OS_POSIX "macosx"
|
||||
# elif defined(__NetBSD__)
|
||||
# define ACC_OS_POSIX_NETBSD 1
|
||||
# define ACC_INFO_OS_POSIX "netbsd"
|
||||
# elif defined(__OpenBSD__)
|
||||
# define ACC_OS_POSIX_OPENBSD 1
|
||||
# define ACC_INFO_OS_POSIX "openbsd"
|
||||
# elif defined(__osf__)
|
||||
# define ACC_OS_POSIX_OSF 1
|
||||
# define ACC_INFO_OS_POSIX "osf"
|
||||
# elif defined(__solaris__) || defined(__sun)
|
||||
# if defined(__SVR4) || defined(__svr4__)
|
||||
# define ACC_OS_POSIX_SOLARIS 1
|
||||
# define ACC_INFO_OS_POSIX "solaris"
|
||||
# else
|
||||
# define ACC_OS_POSIX_SUNOS 1
|
||||
# define ACC_INFO_OS_POSIX "sunos"
|
||||
# endif
|
||||
# elif defined(__ultrix__) || defined(__ultrix)
|
||||
# define ACC_OS_POSIX_ULTRIX 1
|
||||
# define ACC_INFO_OS_POSIX "ultrix"
|
||||
# else
|
||||
# define ACC_OS_POSIX_UNKNOWN 1
|
||||
# define ACC_INFO_OS_POSIX "unknown"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#if (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16)
|
||||
# if (UINT_MAX != ACC_0xffffL)
|
||||
# error "this should not happen"
|
||||
# endif
|
||||
# if (ULONG_MAX != ACC_0xffffffffL)
|
||||
# error "this should not happen"
|
||||
# endif
|
||||
#endif
|
||||
#if (ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
# if (UINT_MAX != ACC_0xffffffffL)
|
||||
# error "this should not happen"
|
||||
# endif
|
||||
# if (ULONG_MAX != ACC_0xffffffffL)
|
||||
# error "this should not happen"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
321
tools/ucl/acc/acc_type.h
Normal file
321
tools/ucl/acc/acc_type.h
Normal file
|
|
@ -0,0 +1,321 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
#if (ACC_CC_GNUC >= 0x020800ul) /* 2.8.0 */
|
||||
# define __acc_gnuc_extension__ __extension__
|
||||
#else
|
||||
# define __acc_gnuc_extension__
|
||||
#endif
|
||||
|
||||
#if (SIZEOF_LONG_LONG > 0)
|
||||
__acc_gnuc_extension__ typedef long long acc_llong_t;
|
||||
#endif
|
||||
#if (SIZEOF_UNSIGNED_LONG_LONG > 0)
|
||||
__acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
|
||||
#endif
|
||||
|
||||
#if (!(SIZEOF_SHORT > 0 && SIZEOF_INT > 0 && SIZEOF_LONG > 0))
|
||||
# error "missing defines for sizes"
|
||||
#endif
|
||||
#if (!(SIZEOF_PTRDIFF_T > 0 && SIZEOF_SIZE_T > 0 && SIZEOF_VOID_P > 0 && SIZEOF_CHAR_P > 0))
|
||||
# error "missing defines for sizes"
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// some <stdint.h> types:
|
||||
// required: least & fast: acc_int32l_t, acc_int32f_t
|
||||
// optional: exact32 acc_int32e_t
|
||||
// optional: least64 acc_int64l_t
|
||||
************************************************************************/
|
||||
|
||||
/* acc_int32e_t is int32_t in <stdint.h> terminology */
|
||||
#if !defined(acc_int32e_t)
|
||||
#if (SIZEOF_INT == 4)
|
||||
# define acc_int32e_t int
|
||||
# define acc_uint32e_t unsigned int
|
||||
# define ACC_INT32E_C(c) c
|
||||
# define ACC_UINT32E_C(c) c##U
|
||||
#elif (SIZEOF_LONG == 4)
|
||||
# define acc_int32e_t long int
|
||||
# define acc_uint32e_t unsigned long int
|
||||
# define ACC_INT32E_C(c) c##L
|
||||
# define ACC_UINT32E_C(c) c##UL
|
||||
#elif (SIZEOF_SHORT == 4)
|
||||
# define acc_int32e_t short int
|
||||
# define acc_uint32e_t unsigned short int
|
||||
# define ACC_INT32E_C(c) c
|
||||
# define ACC_UINT32E_C(c) c##U
|
||||
#elif (SIZEOF_LONG_LONG == 4 && SIZEOF_UNSIGNED_LONG_LONG == 4)
|
||||
# define acc_int32e_t acc_llong_t
|
||||
# define acc_uint32e_t acc_ullong_t
|
||||
# define ACC_INT32E_C(c) c##LL
|
||||
# define ACC_UINT32E_C(c) c##ULL
|
||||
#elif (SIZEOF___INT32 == 4 && SIZEOF_UNSIGNED___INT32 == 4)
|
||||
# define acc_int32e_t __int32
|
||||
# define acc_uint32e_t unsigned __int32
|
||||
# if (SIZEOF_INT > 4)
|
||||
# define ACC_INT32E_C(c) c
|
||||
# define ACC_UINT32E_C(c) c##U
|
||||
# elif (SIZEOF_LONG > 4)
|
||||
# define ACC_INT32E_C(c) c##L
|
||||
# define ACC_UINT32E_C(c) c##UL
|
||||
# else
|
||||
# define ACC_INT32E_C(c) c##i32
|
||||
# define ACC_UINT32E_C(c) c##ui32
|
||||
# endif
|
||||
#else
|
||||
/* no exact 32-bit integral type on this machine */
|
||||
#endif
|
||||
#endif
|
||||
#if defined(acc_int32e_t)
|
||||
# define SIZEOF_ACC_INT32E_T 4
|
||||
#endif
|
||||
|
||||
|
||||
/* acc_int32l_t is int_least32_t in <stdint.h> terminology */
|
||||
#if !defined(acc_int32l_t)
|
||||
#if defined(acc_int32e_t)
|
||||
# define acc_int32l_t acc_int32e_t
|
||||
# define acc_uint32l_t acc_uint32e_t
|
||||
# define ACC_INT32L_C(c) ACC_INT32E_C(c)
|
||||
# define ACC_UINT32L_C(c) ACC_UINT32E_C(c)
|
||||
# define SIZEOF_ACC_INT32L_T SIZEOF_ACC_INT32E_T
|
||||
#elif (SIZEOF_INT > 4)
|
||||
# define acc_int32l_t int
|
||||
# define acc_uint32l_t unsigned int
|
||||
# define ACC_INT32L_C(c) c
|
||||
# define ACC_UINT32L_C(c) c##U
|
||||
# define SIZEOF_ACC_INT32L_T SIZEOF_INT
|
||||
#elif (SIZEOF_LONG > 4)
|
||||
# define acc_int32l_t long int
|
||||
# define acc_uint32l_t unsigned long int
|
||||
# define ACC_INT32L_C(c) c##L
|
||||
# define ACC_UINT32L_C(c) c##UL
|
||||
# define SIZEOF_ACC_INT32L_T SIZEOF_LONG
|
||||
#else
|
||||
# error "acc_int32l_t"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* acc_int32f_t is int_fast32_t in <stdint.h> terminology */
|
||||
#if !defined(acc_int32f_t)
|
||||
#if (SIZEOF_INT >= 4)
|
||||
# define acc_int32f_t int
|
||||
# define acc_uint32f_t unsigned int
|
||||
# define ACC_INT32F_C(c) c
|
||||
# define ACC_UINT32F_C(c) c##U
|
||||
# define SIZEOF_ACC_INT32F_T SIZEOF_INT
|
||||
#elif (SIZEOF_LONG >= 4)
|
||||
# define acc_int32f_t long int
|
||||
# define acc_uint32f_t unsigned long int
|
||||
# define ACC_INT32F_C(c) c##L
|
||||
# define ACC_UINT32F_C(c) c##UL
|
||||
# define SIZEOF_ACC_INT32F_T SIZEOF_LONG
|
||||
#elif defined(acc_int32e_t)
|
||||
# define acc_int32f_t acc_int32e_t
|
||||
# define acc_uint32f_t acc_uint32e_t
|
||||
# define ACC_INT32F_C(c) ACC_INT32E_C(c)
|
||||
# define ACC_UINT32F_C(c) ACC_UINT32E_C(c)
|
||||
# define SIZEOF_ACC_INT32F_T SIZEOF_ACC_INT32E_T
|
||||
#else
|
||||
# error "acc_int32f_t"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* acc_int64l_t is int_least64_t in <stdint.h> terminology */
|
||||
#if !defined(acc_int64l_t)
|
||||
#if (SIZEOF___INT64 >= 8 && SIZEOF_UNSIGNED___INT64 >= 8)
|
||||
# if (ACC_CC_BORLANDC) && !defined(ACC_CONFIG_PREFER___INT64)
|
||||
# define ACC_CONFIG_PREFER___INT64 1
|
||||
# endif
|
||||
#endif
|
||||
#if (SIZEOF_INT >= 8)
|
||||
# define acc_int64l_t int
|
||||
# define acc_uint64l_t unsigned int
|
||||
# define ACC_INT64L_C(c) c
|
||||
# define ACC_UINT64L_C(c) c##U
|
||||
# define SIZEOF_ACC_INT64L_T SIZEOF_INT
|
||||
#elif (SIZEOF_LONG >= 8)
|
||||
# define acc_int64l_t long int
|
||||
# define acc_uint64l_t unsigned long int
|
||||
# define ACC_INT64L_C(c) c##L
|
||||
# define ACC_UINT64L_C(c) c##UL
|
||||
# define SIZEOF_ACC_INT64L_T SIZEOF_LONG
|
||||
#elif (SIZEOF_LONG_LONG >= 8 && SIZEOF_UNSIGNED_LONG_LONG >= 8) && !defined(ACC_CONFIG_PREFER___INT64)
|
||||
# define acc_int64l_t acc_llong_t
|
||||
# define acc_uint64l_t acc_ullong_t
|
||||
# if (ACC_CC_BORLANDC)
|
||||
# define ACC_INT64L_C(c) ((c) + 0ll)
|
||||
# define ACC_UINT64L_C(c) ((c) + 0ull)
|
||||
# else
|
||||
# define ACC_INT64L_C(c) c##LL
|
||||
# define ACC_UINT64L_C(c) c##ULL
|
||||
# endif
|
||||
# define SIZEOF_ACC_INT64L_T SIZEOF_LONG_LONG
|
||||
#elif (SIZEOF___INT64 >= 8 && SIZEOF_UNSIGNED___INT64 >= 8)
|
||||
# define acc_int64l_t __int64
|
||||
# define acc_uint64l_t unsigned __int64
|
||||
# if (ACC_CC_BORLANDC)
|
||||
# define ACC_INT64L_C(c) ((c) + 0i64)
|
||||
# define ACC_UINT64L_C(c) ((c) + 0ui64)
|
||||
# else
|
||||
# define ACC_INT64L_C(c) c##i64
|
||||
# define ACC_UINT64L_C(c) c##ui64
|
||||
# endif
|
||||
# define SIZEOF_ACC_INT64L_T SIZEOF___INT64
|
||||
#else
|
||||
/* no least 64-bit integral type on this machine */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(acc_intptr_t)
|
||||
#if (ACC_ARCH_IA32 && ACC_CC_MSC && (_MSC_VER >= 1300))
|
||||
typedef __w64 int acc_intptr_t;
|
||||
typedef __w64 unsigned int acc_uintptr_t;
|
||||
# define acc_intptr_t acc_intptr_t
|
||||
# define acc_uintptr_t acc_uintptr_t
|
||||
# define SIZEOF_ACC_INTPTR_T SIZEOF_INT
|
||||
#elif (SIZEOF_INT >= SIZEOF_VOID_P)
|
||||
# define acc_intptr_t int
|
||||
# define acc_uintptr_t unsigned int
|
||||
# define SIZEOF_ACC_INTPTR_T SIZEOF_INT
|
||||
#elif (SIZEOF_LONG >= SIZEOF_VOID_P)
|
||||
# define acc_intptr_t long
|
||||
# define acc_uintptr_t unsigned long
|
||||
# define SIZEOF_ACC_INTPTR_T SIZEOF_LONG
|
||||
#elif (SIZEOF_ACC_INT64L_T >= SIZEOF_VOID_P)
|
||||
# define acc_intptr_t acc_int64l_t
|
||||
# define acc_uintptr_t acc_uint64l_t
|
||||
# define SIZEOF_ACC_INTPTR_T SIZEOF_ACC_INT64L_T
|
||||
#else
|
||||
# error "acc_intptr_t"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* workaround for broken compilers */
|
||||
#if (ACC_BROKEN_INTEGRAL_CONSTANTS)
|
||||
# undef ACC_INT32E_C
|
||||
# undef ACC_UINT32E_C
|
||||
# undef ACC_INT32L_C
|
||||
# undef ACC_UINT32L_C
|
||||
# undef ACC_INT32F_C
|
||||
# undef ACC_UINT32F_C
|
||||
# if (SIZEOF_INT == 4)
|
||||
# define ACC_INT32E_C(c) ((c) + 0)
|
||||
# define ACC_UINT32E_C(c) ((c) + 0U)
|
||||
# define ACC_INT32L_C(c) ((c) + 0)
|
||||
# define ACC_UINT32L_C(c) ((c) + 0U)
|
||||
# define ACC_INT32F_C(c) ((c) + 0)
|
||||
# define ACC_UINT32F_C(c) ((c) + 0U)
|
||||
# elif (SIZEOF_LONG == 4)
|
||||
# define ACC_INT32E_C(c) ((c) + 0L)
|
||||
# define ACC_UINT32E_C(c) ((c) + 0UL)
|
||||
# define ACC_INT32L_C(c) ((c) + 0L)
|
||||
# define ACC_UINT32L_C(c) ((c) + 0UL)
|
||||
# define ACC_INT32F_C(c) ((c) + 0L)
|
||||
# define ACC_UINT32F_C(c) ((c) + 0UL)
|
||||
# else
|
||||
# error "integral constants"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// calling conventions
|
||||
************************************************************************/
|
||||
|
||||
#if (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
# if (ACC_CC_GNUC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PACIFICC)
|
||||
# elif (ACC_CC_DMC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
||||
# define __acc_cdecl __cdecl
|
||||
# define __acc_cdecl_atexit
|
||||
# define __acc_cdecl_main __cdecl
|
||||
# if (ACC_OS_OS2 && (ACC_CC_DMC || ACC_CC_SYMANTECC))
|
||||
# define __acc_cdecl_qsort __pascal
|
||||
# elif (ACC_OS_OS2 && (ACC_CC_ZORTECHC))
|
||||
# define __acc_cdecl_qsort _stdcall
|
||||
# else
|
||||
# define __acc_cdecl_qsort __cdecl
|
||||
# endif
|
||||
# elif (ACC_CC_WATCOMC)
|
||||
# define __acc_cdecl __cdecl
|
||||
# else
|
||||
# define __acc_cdecl __cdecl
|
||||
# define __acc_cdecl_atexit __cdecl
|
||||
# define __acc_cdecl_main __cdecl
|
||||
# define __acc_cdecl_qsort __cdecl
|
||||
# endif
|
||||
# if (ACC_CC_GNUC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PACIFICC || ACC_CC_WATCOMC)
|
||||
# elif (ACC_OS_OS2 && (ACC_CC_DMC || ACC_CC_SYMANTECC))
|
||||
# define __acc_cdecl_sighandler __pascal
|
||||
# elif (ACC_OS_OS2 && (ACC_CC_ZORTECHC))
|
||||
# define __acc_cdecl_sighandler _stdcall
|
||||
# elif (ACC_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE)
|
||||
# define __acc_cdecl_sighandler __clrcall
|
||||
# elif (ACC_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700))
|
||||
# if defined(_DLL)
|
||||
# define __acc_cdecl_sighandler _far _cdecl _loadds
|
||||
# elif defined(_MT)
|
||||
# define __acc_cdecl_sighandler _far _cdecl
|
||||
# else
|
||||
# define __acc_cdecl_sighandler _cdecl
|
||||
# endif
|
||||
# else
|
||||
# define __acc_cdecl_sighandler __cdecl
|
||||
# endif
|
||||
#elif (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
|
||||
# define __acc_cdecl cdecl
|
||||
#endif
|
||||
|
||||
#if !defined(__acc_cdecl)
|
||||
# define __acc_cdecl
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_atexit)
|
||||
# define __acc_cdecl_atexit
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_main)
|
||||
# define __acc_cdecl_main
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_qsort)
|
||||
# define __acc_cdecl_qsort
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_sighandler)
|
||||
# define __acc_cdecl_sighandler
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_va)
|
||||
# define __acc_cdecl_va __acc_cdecl
|
||||
#endif
|
||||
|
||||
#if (ACC_BROKEN_CDECL_ALT_SYNTAX)
|
||||
typedef void __acc_cdecl_sighandler (*acc_sighandler_t)(int);
|
||||
#elif defined(RETSIGTYPE)
|
||||
typedef RETSIGTYPE (__acc_cdecl_sighandler *acc_sighandler_t)(int);
|
||||
#else
|
||||
typedef void (__acc_cdecl_sighandler *acc_sighandler_t)(int);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
250
tools/ucl/acc/acclib/bele.ch
Normal file
250
tools/ucl/acc/acclib/bele.ch
Normal file
|
|
@ -0,0 +1,250 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_BELE_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// be16 / be24 / be32
|
||||
**************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(unsigned, acc_get_be16) (const acc_hvoid_p p)
|
||||
{
|
||||
const acc_hbyte_p b = (const acc_hbyte_p) p;
|
||||
return ((unsigned)b[1]) | ((unsigned)b[0] << 8);
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(acc_uint32l_t, acc_get_be24) (const acc_hvoid_p p)
|
||||
{
|
||||
const acc_hbyte_p b = (const acc_hbyte_p) p;
|
||||
return ((acc_uint32l_t)b[2]) | ((acc_uint32l_t)b[1] << 8) | ((acc_uint32l_t)b[0] << 16);
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(acc_uint32l_t, acc_get_be32) (const acc_hvoid_p p)
|
||||
{
|
||||
const acc_hbyte_p b = (const acc_hbyte_p) p;
|
||||
return ((acc_uint32l_t)b[3]) | ((acc_uint32l_t)b[2] << 8) | ((acc_uint32l_t)b[1] << 16) | ((acc_uint32l_t)b[0] << 24);
|
||||
}
|
||||
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_set_be16) (acc_hvoid_p p, unsigned v)
|
||||
{
|
||||
acc_hbyte_p b = (acc_hbyte_p) p;
|
||||
b[1] = (unsigned char) ((v >> 0) & 0xff);
|
||||
b[0] = (unsigned char) ((v >> 8) & 0xff);
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_set_be24) (acc_hvoid_p p, acc_uint32l_t v)
|
||||
{
|
||||
acc_hbyte_p b = (acc_hbyte_p) p;
|
||||
b[2] = (unsigned char) ((v >> 0) & 0xff);
|
||||
b[1] = (unsigned char) ((v >> 8) & 0xff);
|
||||
b[0] = (unsigned char) ((v >> 16) & 0xff);
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_set_be32) (acc_hvoid_p p, acc_uint32l_t v)
|
||||
{
|
||||
acc_hbyte_p b = (acc_hbyte_p) p;
|
||||
b[3] = (unsigned char) ((v >> 0) & 0xff);
|
||||
b[2] = (unsigned char) ((v >> 8) & 0xff);
|
||||
b[1] = (unsigned char) ((v >> 16) & 0xff);
|
||||
b[0] = (unsigned char) ((v >> 24) & 0xff);
|
||||
}
|
||||
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(unsigned, acc_get_le16) (const acc_hvoid_p p)
|
||||
{
|
||||
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32)
|
||||
return (* (const unsigned short *) (p));
|
||||
#else
|
||||
const acc_hbyte_p b = (const acc_hbyte_p) p;
|
||||
return ((unsigned)b[0]) | ((unsigned)b[1] << 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(acc_uint32l_t, acc_get_le24) (const acc_hvoid_p p)
|
||||
{
|
||||
const acc_hbyte_p b = (const acc_hbyte_p) p;
|
||||
return ((acc_uint32l_t)b[0]) | ((acc_uint32l_t)b[1] << 8) | ((acc_uint32l_t)b[2] << 16);
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(acc_uint32l_t, acc_get_le32) (const acc_hvoid_p p)
|
||||
{
|
||||
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32)
|
||||
return (* (const acc_uint32e_t *) (p));
|
||||
#else
|
||||
const acc_hbyte_p b = (const acc_hbyte_p) p;
|
||||
return ((acc_uint32l_t)b[0]) | ((acc_uint32l_t)b[1] << 8) | ((acc_uint32l_t)b[2] << 16) | ((acc_uint32l_t)b[3] << 24);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// le16 / le24 / le32
|
||||
**************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_set_le16) (acc_hvoid_p p, unsigned v)
|
||||
{
|
||||
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32)
|
||||
(* (unsigned short *) (p) = (unsigned short) (v));
|
||||
#else
|
||||
acc_hbyte_p b = (acc_hbyte_p) p;
|
||||
b[0] = (unsigned char) ((v >> 0) & 0xff);
|
||||
b[1] = (unsigned char) ((v >> 8) & 0xff);
|
||||
#endif
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_set_le24) (acc_hvoid_p p, acc_uint32l_t v)
|
||||
{
|
||||
acc_hbyte_p b = (acc_hbyte_p) p;
|
||||
b[0] = (unsigned char) ((v >> 0) & 0xff);
|
||||
b[1] = (unsigned char) ((v >> 8) & 0xff);
|
||||
b[2] = (unsigned char) ((v >> 16) & 0xff);
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_set_le32) (acc_hvoid_p p, acc_uint32l_t v)
|
||||
{
|
||||
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32)
|
||||
(* (acc_uint32e_t *) (p) = (acc_uint32e_t) (v));
|
||||
#else
|
||||
acc_hbyte_p b = (acc_hbyte_p) p;
|
||||
b[0] = (unsigned char) ((v >> 0) & 0xff);
|
||||
b[1] = (unsigned char) ((v >> 8) & 0xff);
|
||||
b[2] = (unsigned char) ((v >> 16) & 0xff);
|
||||
b[3] = (unsigned char) ((v >> 24) & 0xff);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// be64
|
||||
**************************************************************************/
|
||||
|
||||
#if defined(acc_uint64l_t)
|
||||
|
||||
ACCLIB_PUBLIC(acc_uint64l_t, acc_get_be64) (const acc_hvoid_p p)
|
||||
{
|
||||
const acc_hbyte_p b = (const acc_hbyte_p) p;
|
||||
#if (SIZEOF_LONG >= 8) || (SIZEOF_SIZE_T >= 8)
|
||||
return ((acc_uint64l_t)b[7]) | ((acc_uint64l_t)b[6] << 8) | ((acc_uint64l_t)b[5] << 16) | ((acc_uint64l_t)b[4] << 24) | ((acc_uint64l_t)b[3] << 32) | ((acc_uint64l_t)b[2] << 40) | ((acc_uint64l_t)b[1] << 48) | ((acc_uint64l_t)b[0] << 56);
|
||||
#else
|
||||
acc_uint32l_t v0, v1;
|
||||
v1 = ((acc_uint32l_t)b[3]) | ((acc_uint32l_t)b[2] << 8) | ((acc_uint32l_t)b[1] << 16) | ((acc_uint32l_t)b[0] << 24);
|
||||
b += 4;
|
||||
v0 = ((acc_uint32l_t)b[3]) | ((acc_uint32l_t)b[2] << 8) | ((acc_uint32l_t)b[1] << 16) | ((acc_uint32l_t)b[0] << 24);
|
||||
return ((acc_uint64l_t)v0) | ((acc_uint64l_t)v1 << 32);
|
||||
#endif
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_set_be64) (acc_hvoid_p p, acc_uint64l_t v)
|
||||
{
|
||||
acc_hbyte_p b = (acc_hbyte_p) p;
|
||||
#if (SIZEOF_LONG >= 8) || (SIZEOF_SIZE_T >= 8)
|
||||
b[7] = (unsigned char) ((v >> 0) & 0xff);
|
||||
b[6] = (unsigned char) ((v >> 8) & 0xff);
|
||||
b[5] = (unsigned char) ((v >> 16) & 0xff);
|
||||
b[4] = (unsigned char) ((v >> 24) & 0xff);
|
||||
b[3] = (unsigned char) ((v >> 32) & 0xff);
|
||||
b[2] = (unsigned char) ((v >> 40) & 0xff);
|
||||
b[1] = (unsigned char) ((v >> 48) & 0xff);
|
||||
b[0] = (unsigned char) ((v >> 56) & 0xff);
|
||||
#else
|
||||
acc_uint32l_t x;
|
||||
x = (acc_uint32l_t) (v >> 0);
|
||||
b[7] = (unsigned char) ((x >> 0) & 0xff);
|
||||
b[6] = (unsigned char) ((x >> 8) & 0xff);
|
||||
b[5] = (unsigned char) ((x >> 16) & 0xff);
|
||||
b[4] = (unsigned char) ((x >> 24) & 0xff);
|
||||
x = (acc_uint32l_t) (v >> 32);
|
||||
b[3] = (unsigned char) ((x >> 0) & 0xff);
|
||||
b[2] = (unsigned char) ((x >> 8) & 0xff);
|
||||
b[1] = (unsigned char) ((x >> 16) & 0xff);
|
||||
b[0] = (unsigned char) ((x >> 24) & 0xff);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* acc_uint64l_t */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// le64
|
||||
**************************************************************************/
|
||||
|
||||
#if defined(acc_uint64l_t)
|
||||
|
||||
ACCLIB_PUBLIC(acc_uint64l_t, acc_get_le64) (const acc_hvoid_p p)
|
||||
{
|
||||
#if (ACC_ARCH_AMD64)
|
||||
return (* (const acc_uint64l_t *) (p));
|
||||
#elif (ACC_ARCH_IA32)
|
||||
const acc_uint32e_t* b = (const acc_uint32e_t*) p;
|
||||
return ((acc_uint64l_t)b[0]) | ((acc_uint64l_t)b[1] << 32);
|
||||
#elif (SIZEOF_LONG >= 8) || (SIZEOF_SIZE_T >= 8)
|
||||
const acc_hbyte_p b = (const acc_hbyte_p) p;
|
||||
return ((acc_uint64l_t)b[0]) | ((acc_uint64l_t)b[1] << 8) | ((acc_uint64l_t)b[2] << 16) | ((acc_uint64l_t)b[3] << 24) | ((acc_uint64l_t)b[4] << 32) | ((acc_uint64l_t)b[5] << 40) | ((acc_uint64l_t)b[6] << 48) | ((acc_uint64l_t)b[7] << 56);
|
||||
#else
|
||||
const acc_hbyte_p b = (const acc_hbyte_p) p;
|
||||
acc_uint32l_t v0, v1;
|
||||
v0 = ((acc_uint32l_t)b[0]) | ((acc_uint32l_t)b[1] << 8) | ((acc_uint32l_t)b[2] << 16) | ((acc_uint32l_t)b[3] << 24);
|
||||
b += 4;
|
||||
v1 = ((acc_uint32l_t)b[0]) | ((acc_uint32l_t)b[1] << 8) | ((acc_uint32l_t)b[2] << 16) | ((acc_uint32l_t)b[3] << 24);
|
||||
return ((acc_uint64l_t)v0) | ((acc_uint64l_t)v1 << 32);
|
||||
#endif
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_set_le64) (acc_hvoid_p p, acc_uint64l_t v)
|
||||
{
|
||||
#if (ACC_ARCH_AMD64)
|
||||
(* (acc_uint64l_t *) (p)) = v;
|
||||
#elif (ACC_ARCH_IA32)
|
||||
(((acc_uint32e_t *)(p))[0] = (acc_uint32e_t) (v >> 0));
|
||||
(((acc_uint32e_t *)(p))[1] = (acc_uint32e_t) (v >> 32));
|
||||
#elif (SIZEOF_LONG >= 8) || (SIZEOF_SIZE_T >= 8)
|
||||
acc_hbyte_p b = (acc_hbyte_p) p;
|
||||
b[0] = (unsigned char) ((v >> 0) & 0xff);
|
||||
b[1] = (unsigned char) ((v >> 8) & 0xff);
|
||||
b[2] = (unsigned char) ((v >> 16) & 0xff);
|
||||
b[3] = (unsigned char) ((v >> 24) & 0xff);
|
||||
b[4] = (unsigned char) ((v >> 32) & 0xff);
|
||||
b[5] = (unsigned char) ((v >> 40) & 0xff);
|
||||
b[6] = (unsigned char) ((v >> 48) & 0xff);
|
||||
b[7] = (unsigned char) ((v >> 56) & 0xff);
|
||||
#else
|
||||
acc_hbyte_p b = (acc_hbyte_p) p;
|
||||
acc_uint32l_t x;
|
||||
x = (acc_uint32l_t) (v >> 0);
|
||||
b[0] = (unsigned char) ((x >> 0) & 0xff);
|
||||
b[1] = (unsigned char) ((x >> 8) & 0xff);
|
||||
b[2] = (unsigned char) ((x >> 16) & 0xff);
|
||||
b[3] = (unsigned char) ((x >> 24) & 0xff);
|
||||
x = (acc_uint32l_t) (v >> 32);
|
||||
b[4] = (unsigned char) ((x >> 0) & 0xff);
|
||||
b[5] = (unsigned char) ((x >> 8) & 0xff);
|
||||
b[6] = (unsigned char) ((x >> 16) & 0xff);
|
||||
b[7] = (unsigned char) ((x >> 24) & 0xff);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* acc_uint64l_t */
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
106
tools/ucl/acc/acclib/dosalloc.ch
Normal file
106
tools/ucl/acc/acclib/dosalloc.ch
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_DOSALLOC_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
#if (ACC_OS_OS216)
|
||||
ACC_EXTERN_C unsigned short __far __pascal DosAllocHuge(unsigned short, unsigned short, unsigned short __far *, unsigned short, unsigned short);
|
||||
ACC_EXTERN_C unsigned short __far __pascal DosFreeSeg(unsigned short);
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// dos_alloc
|
||||
************************************************************************/
|
||||
|
||||
#if (ACC_OS_DOS16 || ACC_OS_WIN16)
|
||||
#if !defined(ACC_CC_AZTECC)
|
||||
|
||||
ACCLIB_PUBLIC(void __far*, acc_dos_alloc) (unsigned long size)
|
||||
{
|
||||
void __far* p = 0;
|
||||
union REGS ri, ro;
|
||||
|
||||
if ((long)size <= 0)
|
||||
return p;
|
||||
size = (size + 15) >> 4;
|
||||
if (size > 0xffffu)
|
||||
return p;
|
||||
ri.x.ax = 0x4800;
|
||||
ri.x.bx = (unsigned short) size;
|
||||
int86(0x21, &ri, &ro);
|
||||
if ((ro.x.cflag & 1) == 0) /* if carry flag not set */
|
||||
p = (void __far*) ACC_MK_FP(ro.x.ax, 0);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_dos_free) (void __far* p)
|
||||
{
|
||||
union REGS ri, ro;
|
||||
struct SREGS rs;
|
||||
|
||||
if (!p)
|
||||
return 0;
|
||||
if (ACC_FP_OFF(p) != 0)
|
||||
return -1;
|
||||
segread(&rs);
|
||||
ri.x.ax = 0x4900;
|
||||
rs.es = ACC_FP_SEG(p);
|
||||
int86x(0x21, &ri, &ro, &rs);
|
||||
if (ro.x.cflag & 1) /* if carry flag set */
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if (ACC_OS_OS216)
|
||||
|
||||
ACCLIB_PUBLIC(void __far*, acc_dos_alloc) (unsigned long size)
|
||||
{
|
||||
void __far* p = 0;
|
||||
unsigned short sel = 0;
|
||||
|
||||
if ((long)size <= 0)
|
||||
return p;
|
||||
if (DosAllocHuge((unsigned short)(size >> 16), (unsigned short)size, &sel, 0, 0) == 0)
|
||||
p = (void __far*) ACC_MK_FP(sel, 0);
|
||||
return p;
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_dos_free) (void __far* p)
|
||||
{
|
||||
if (!p)
|
||||
return 0;
|
||||
if (ACC_FP_OFF(p) != 0)
|
||||
return -1;
|
||||
if (DosFreeSeg(ACC_FP_SEG(p)) != 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
123
tools/ucl/acc/acclib/fnmatch.ch
Normal file
123
tools/ucl/acc/acclib/fnmatch.ch
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_FNMATCH_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
//
|
||||
**************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
const acc_hbyte_p s;
|
||||
const acc_hbyte_p s_start;
|
||||
int f;
|
||||
int f_escape;
|
||||
int f_casefold;
|
||||
} acc_fnmatch_internal_t;
|
||||
|
||||
|
||||
static int __ACCLIB_FUNCNAME(acc_fnmatch_internal) (const acc_hbyte_p p, acc_fnmatch_internal_t* a)
|
||||
{
|
||||
const acc_hbyte_p s = a->s;
|
||||
int f_pathname = (a->f & (ACC_FNMATCH_PATHNAME | ACC_FNMATCH_PATHSTAR));
|
||||
|
||||
while (*p) {
|
||||
switch (*p) {
|
||||
case '?': case '[':
|
||||
if (*s == 0) return 0;
|
||||
if (*s == '/' && f_pathname) return 0;
|
||||
if (*s == '.' && (a->f & ACC_FNMATCH_PERIOD) && (s == a->s_start || (f_pathname && s[-1] == '/'))) return 0;
|
||||
if (*p == '?') break;
|
||||
{
|
||||
int r = 0, fail = 0; unsigned char last = 0;
|
||||
if (*++p == '^' || *p == '!')
|
||||
fail = 1, ++p;
|
||||
do {
|
||||
switch (*p) {
|
||||
case 0:
|
||||
return -1;
|
||||
case '-':
|
||||
if (last == 0 || p[1] == ']') goto acc_label_default;
|
||||
if (a->f_escape && p[1] == '\\') ++p;
|
||||
if (*++p == 0) return -1;
|
||||
if (!a->f_casefold && last <= *s && *s <= *p) r = 1;
|
||||
else if (a->f_casefold && acc_ascii_tolower(last) <= acc_ascii_tolower(*s) && acc_ascii_tolower(*s) <= acc_ascii_tolower(*p)) r = 1;
|
||||
last = 0;
|
||||
continue;
|
||||
/* TODO: implement sets like [:alpha:] ??? */
|
||||
case '\\':
|
||||
if (a->f_escape && *++p == 0) return -1;
|
||||
default: acc_label_default:
|
||||
if (*s == *p) r = 1;
|
||||
else if (a->f_casefold && acc_ascii_tolower(*s) == acc_ascii_tolower(*p)) r = 1;
|
||||
break;
|
||||
}
|
||||
last = *p;
|
||||
} while (*++p != ']');
|
||||
if (r == fail)
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
case '*':
|
||||
while (*++p == '*') if (a->f & ACC_FNMATCH_PATHSTAR) f_pathname = 0;
|
||||
if (*s == '.' && (a->f & ACC_FNMATCH_PERIOD) && (s == a->s_start || (f_pathname && s[-1] == '/'))) return 0;
|
||||
if (*p == 0) {
|
||||
if (f_pathname) while (*s) if (*s++ == '/') return 0;
|
||||
return 1;
|
||||
}
|
||||
for ( ; *s; ++s) {
|
||||
int r;
|
||||
a->s = s; r = __ACCLIB_FUNCNAME(acc_fnmatch_internal)(p, a);
|
||||
switch (r) {
|
||||
case 0: if (*s == '/' && f_pathname) return 2; break;
|
||||
case 2: if (!f_pathname) break;
|
||||
default: return r;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
case '\\':
|
||||
if (a->f_escape && *++p == 0) return -1;
|
||||
default:
|
||||
if (*s == *p) break;
|
||||
if (a->f_casefold && acc_ascii_tolower(*s) == acc_ascii_tolower(*p)) break;
|
||||
return 0;
|
||||
}
|
||||
++p, ++s;
|
||||
}
|
||||
return *s == 0;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_fnmatch) (const acc_hchar_p p, const acc_hchar_p s, int flags)
|
||||
{
|
||||
int r;
|
||||
acc_fnmatch_internal_t args;
|
||||
args.s = args.s_start = (const acc_hbyte_p) s;
|
||||
args.f = flags;
|
||||
args.f_escape = !(flags & ACC_FNMATCH_NOESCAPE);
|
||||
args.f_casefold = (flags & ACC_FNMATCH_ASCII_CASEFOLD);
|
||||
r = __ACCLIB_FUNCNAME(acc_fnmatch_internal)((const acc_hbyte_p)p, &args);
|
||||
if (r < 0) return r;
|
||||
return r != 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
46
tools/ucl/acc/acclib/getopt.ch
Normal file
46
tools/ucl/acc/acclib/getopt.ch
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_GETOPT_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
//
|
||||
**************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_getopt_init) (acc_getopt_p go)
|
||||
{
|
||||
memset(po, 0, sizeof(*po));
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_getopt_close) (acc_getopt_p go)
|
||||
{
|
||||
memset(po, 0, sizeof(*po));
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_getopt) (acc_getopt_p go)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
157
tools/ucl/acc/acclib/halloc.ch
Normal file
157
tools/ucl/acc/acclib/halloc.ch
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_HALLOC_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
#if (ACC_HAVE_MM_HUGE_PTR)
|
||||
#if 1 && (ACC_OS_DOS16 && defined(BLX286))
|
||||
# define __ACCLIB_HALLOC_USE_DAH 1
|
||||
#elif 1 && (ACC_OS_DOS16 && defined(DOSX286))
|
||||
# define __ACCLIB_HALLOC_USE_DAH 1
|
||||
#elif 1 && (ACC_OS_OS216)
|
||||
# define __ACCLIB_HALLOC_USE_DAH 1
|
||||
#elif 1 && (ACC_OS_WIN16)
|
||||
# define __ACCLIB_HALLOC_USE_GA 1
|
||||
#elif 1 && (ACC_OS_DOS16) && (ACC_CC_BORLANDC) && defined(__DPMI16__)
|
||||
# define __ACCLIB_HALLOC_USE_GA 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if (__ACCLIB_HALLOC_USE_DAH)
|
||||
#if 0 && (ACC_OS_OS216)
|
||||
#include <os2.h>
|
||||
#else
|
||||
ACC_EXTERN_C unsigned short __far __pascal DosAllocHuge(unsigned short, unsigned short, unsigned short __far *, unsigned short, unsigned short);
|
||||
ACC_EXTERN_C unsigned short __far __pascal DosFreeSeg(unsigned short);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (__ACCLIB_HALLOC_USE_GA)
|
||||
#if 0
|
||||
#define STRICT 1
|
||||
#include <windows.h>
|
||||
#else
|
||||
ACC_EXTERN_C const void __near* __far __pascal GlobalAlloc(unsigned, unsigned long);
|
||||
ACC_EXTERN_C const void __near* __far __pascal GlobalFree(const void __near*);
|
||||
ACC_EXTERN_C unsigned long __far __pascal GlobalHandle(unsigned);
|
||||
ACC_EXTERN_C void __far* __far __pascal GlobalLock(const void __near*);
|
||||
ACC_EXTERN_C int __far __pascal GlobalUnlock(const void __near*);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// halloc
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(acc_hvoid_p, acc_halloc) (acc_hsize_t size)
|
||||
{
|
||||
acc_hvoid_p p = 0;
|
||||
|
||||
if (size <= 0)
|
||||
return p;
|
||||
|
||||
#if 0 && defined(__palmos__)
|
||||
p = MemPtrNew(size);
|
||||
#elif !defined(ACC_HAVE_MM_HUGE_PTR)
|
||||
if (size < (size_t) -1)
|
||||
p = malloc((size_t) size);
|
||||
#else
|
||||
if ((long)size <= 0)
|
||||
return p;
|
||||
{
|
||||
#if (__ACCLIB_HALLOC_USE_DAH)
|
||||
unsigned short sel = 0;
|
||||
if (DosAllocHuge((unsigned short)(size >> 16), (unsigned short)size, &sel, 0, 0) == 0)
|
||||
p = (acc_hvoid_p) ACC_MK_FP(sel, 0);
|
||||
#elif (__ACCLIB_HALLOC_USE_GA)
|
||||
const void __near* h = GlobalAlloc(2, size);
|
||||
if (h) {
|
||||
p = GlobalLock(h);
|
||||
if (p && ACC_FP_OFF(p) != 0) {
|
||||
GlobalUnlock(h);
|
||||
p = 0;
|
||||
}
|
||||
if (!p)
|
||||
GlobalFree(h);
|
||||
}
|
||||
#elif (ACC_CC_MSC && (_MSC_VER >= 700))
|
||||
p = _halloc(size, 1);
|
||||
#elif (ACC_CC_MSC || ACC_CC_WATCOMC)
|
||||
p = halloc(size, 1);
|
||||
#elif (ACC_CC_DMC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
||||
p = farmalloc(size);
|
||||
#elif (ACC_CC_BORLANDC || ACC_CC_TURBOC)
|
||||
p = farmalloc(size);
|
||||
#elif defined(ACC_CC_AZTECC)
|
||||
p = lmalloc(size);
|
||||
#else
|
||||
if (size < (size_t) -1)
|
||||
p = malloc((size_t) size);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_hfree) (acc_hvoid_p p)
|
||||
{
|
||||
if (!p)
|
||||
return;
|
||||
|
||||
#if 0 && defined(__palmos__)
|
||||
MemPtrFree(p);
|
||||
#elif !defined(ACC_HAVE_MM_HUGE_PTR)
|
||||
free(p);
|
||||
#else
|
||||
#if (__ACCLIB_HALLOC_USE_DAH)
|
||||
if (ACC_FP_OFF(p) == 0)
|
||||
DosFreeSeg((unsigned short) ACC_FP_SEG(p));
|
||||
#elif (__ACCLIB_HALLOC_USE_GA)
|
||||
if (ACC_FP_OFF(p) == 0) {
|
||||
const void __near* h = (const void __near*) (unsigned) GlobalHandle(ACC_FP_SEG(p));
|
||||
if (h) {
|
||||
GlobalUnlock(h);
|
||||
GlobalFree(h);
|
||||
}
|
||||
}
|
||||
#elif (ACC_CC_MSC && (_MSC_VER >= 700))
|
||||
_hfree(p);
|
||||
#elif (ACC_CC_MSC || ACC_CC_WATCOMC)
|
||||
hfree(p);
|
||||
#elif (ACC_CC_DMC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
||||
farfree((void __far*) p);
|
||||
#elif (ACC_CC_BORLANDC || ACC_CC_TURBOC)
|
||||
farfree((void __far*) p);
|
||||
#elif defined(ACC_CC_AZTECC)
|
||||
lfree(p);
|
||||
#else
|
||||
free(p);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
114
tools/ucl/acc/acclib/hfread.ch
Normal file
114
tools/ucl/acc/acclib/hfread.ch
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_HFREAD_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// huge pointer layer - stdio.h
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(acc_hsize_t, acc_hfread) (ACC_FILE_P fp, acc_hvoid_p buf, acc_hsize_t size)
|
||||
{
|
||||
#if (ACC_HAVE_MM_HUGE_PTR)
|
||||
#if (ACC_MM_TINY || ACC_MM_SMALL || ACC_MM_MEDIUM)
|
||||
#define __ACCLIB_REQUIRE_HMEMCPY_CH 1
|
||||
unsigned char tmp[512];
|
||||
acc_hsize_t l = 0;
|
||||
|
||||
while (l < size)
|
||||
{
|
||||
size_t n = size - l > sizeof(tmp) ? sizeof(tmp) : (size_t) (size - l);
|
||||
n = fread(tmp, 1, n, fp);
|
||||
if (n == 0)
|
||||
break;
|
||||
__ACCLIB_FUNCNAME(acc_hmemcpy)((acc_hbyte_p)buf + l, tmp, (acc_hsize_t)n);
|
||||
l += n;
|
||||
}
|
||||
return l;
|
||||
#elif (ACC_MM_COMPACT || ACC_MM_LARGE || ACC_MM_HUGE)
|
||||
acc_hbyte_p b = (acc_hbyte_p) buf;
|
||||
acc_hsize_t l = 0;
|
||||
|
||||
while (l < size)
|
||||
{
|
||||
size_t n;
|
||||
n = ACC_FP_OFF(b); n = (n <= 1) ? 0x8000u : (0u - n);
|
||||
if ((acc_hsize_t) n > size - l)
|
||||
n = (size_t) (size - l);
|
||||
n = fread((void __far*)b, 1, n, fp);
|
||||
if (n == 0)
|
||||
break;
|
||||
b += n; l += n;
|
||||
}
|
||||
return l;
|
||||
#else
|
||||
# error "unknown memory model"
|
||||
#endif
|
||||
#else
|
||||
return fread(buf, 1, size, fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hsize_t, acc_hfwrite) (ACC_FILE_P fp, const acc_hvoid_p buf, acc_hsize_t size)
|
||||
{
|
||||
#if (ACC_HAVE_MM_HUGE_PTR)
|
||||
#if (ACC_MM_TINY || ACC_MM_SMALL || ACC_MM_MEDIUM)
|
||||
#define __ACCLIB_REQUIRE_HMEMCPY_CH 1
|
||||
unsigned char tmp[512];
|
||||
acc_hsize_t l = 0;
|
||||
|
||||
while (l < size)
|
||||
{
|
||||
size_t n = size - l > sizeof(tmp) ? sizeof(tmp) : (size_t) (size - l);
|
||||
__ACCLIB_FUNCNAME(acc_hmemcpy)(tmp, (const acc_hbyte_p)buf + l, (acc_hsize_t)n);
|
||||
n = fwrite(tmp, 1, n, fp);
|
||||
if (n == 0)
|
||||
break;
|
||||
l += n;
|
||||
}
|
||||
return l;
|
||||
#elif (ACC_MM_COMPACT || ACC_MM_LARGE || ACC_MM_HUGE)
|
||||
const acc_hbyte_p b = (const acc_hbyte_p) buf;
|
||||
acc_hsize_t l = 0;
|
||||
|
||||
while (l < size)
|
||||
{
|
||||
size_t n;
|
||||
n = ACC_FP_OFF(b); n = (n <= 1) ? 0x8000u : (0u - n);
|
||||
if ((acc_hsize_t) n > size - l)
|
||||
n = (size_t) (size - l);
|
||||
n = fwrite((void __far*)b, 1, n, fp);
|
||||
if (n == 0)
|
||||
break;
|
||||
b += n; l += n;
|
||||
}
|
||||
return l;
|
||||
#else
|
||||
# error "unknown memory model"
|
||||
#endif
|
||||
#else
|
||||
return fwrite(buf, 1, size, fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
111
tools/ucl/acc/acclib/hmemcpy.ch
Normal file
111
tools/ucl/acc/acclib/hmemcpy.ch
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_HMEMCPY_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// memcmp, memcpy, memmove, memset
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_hmemcmp) (const acc_hvoid_p s1, const acc_hvoid_p s2, acc_hsize_t len)
|
||||
{
|
||||
#if (ACC_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMCMP)
|
||||
const acc_hbyte_p p1 = (const acc_hbyte_p) s1;
|
||||
const acc_hbyte_p p2 = (const acc_hbyte_p) s2;
|
||||
|
||||
if (len > 0) do
|
||||
{
|
||||
int d = *p1 - *p2;
|
||||
if (d != 0)
|
||||
return d;
|
||||
p1++; p2++;
|
||||
} while (--len > 0);
|
||||
return 0;
|
||||
#else
|
||||
return memcmp(s1, s2, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hvoid_p, acc_hmemcpy) (acc_hvoid_p dest, const acc_hvoid_p src, acc_hsize_t len)
|
||||
{
|
||||
#if (ACC_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMCPY)
|
||||
acc_hbyte_p p1 = (acc_hbyte_p) dest;
|
||||
const acc_hbyte_p p2 = (const acc_hbyte_p) src;
|
||||
|
||||
if (len <= 0 || p1 == p2)
|
||||
return dest;
|
||||
do
|
||||
*p1++ = *p2++;
|
||||
while (--len > 0);
|
||||
return dest;
|
||||
#else
|
||||
return memcpy(dest, src, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hvoid_p, acc_hmemmove) (acc_hvoid_p dest, const acc_hvoid_p src, acc_hsize_t len)
|
||||
{
|
||||
#if (ACC_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMMOVE)
|
||||
acc_hbyte_p p1 = (acc_hbyte_p) dest;
|
||||
const acc_hbyte_p p2 = (const acc_hbyte_p) src;
|
||||
|
||||
if (len <= 0 || p1 == p2)
|
||||
return dest;
|
||||
|
||||
if (p1 < p2)
|
||||
{
|
||||
do
|
||||
*p1++ = *p2++;
|
||||
while (--len > 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
p1 += len;
|
||||
p2 += len;
|
||||
do
|
||||
*--p1 = *--p2;
|
||||
while (--len > 0);
|
||||
}
|
||||
return dest;
|
||||
#else
|
||||
return memmove(dest, src, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hvoid_p, acc_hmemset) (acc_hvoid_p s, int c, acc_hsize_t len)
|
||||
{
|
||||
#if (ACC_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMSET)
|
||||
acc_hbyte_p p = (acc_hbyte_p) s;
|
||||
|
||||
if (len > 0) do
|
||||
*p++ = (unsigned char) c;
|
||||
while (--len > 0);
|
||||
return s;
|
||||
#else
|
||||
return memset(s, c, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
118
tools/ucl/acc/acclib/hread.ch
Normal file
118
tools/ucl/acc/acclib/hread.ch
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_HREAD_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// huge pointer layer - read/write
|
||||
************************************************************************/
|
||||
|
||||
#if (ACC_HAVE_MM_HUGE_PTR)
|
||||
|
||||
ACCLIB_PUBLIC(long, acc_hread) (int fd, acc_hvoid_p buf, long size)
|
||||
{
|
||||
#if (ACC_MM_TINY || ACC_MM_SMALL || ACC_MM_MEDIUM)
|
||||
#define __ACCLIB_REQUIRE_HMEMCPY_CH 1
|
||||
unsigned char tmp[512];
|
||||
long l = 0;
|
||||
|
||||
while (l < size)
|
||||
{
|
||||
int n = size - l > (long)sizeof(tmp) ? (int) sizeof(tmp) : (int) (size - l);
|
||||
n = read(fd, tmp, n);
|
||||
if (n == 0)
|
||||
break;
|
||||
if (n < 0)
|
||||
return -1;
|
||||
__ACCLIB_FUNCNAME(acc_hmemcpy)((acc_hbyte_p)buf + l, tmp, (acc_hsize_t)n);
|
||||
l += n;
|
||||
}
|
||||
return l;
|
||||
#elif (ACC_MM_COMPACT || ACC_MM_LARGE || ACC_MM_HUGE)
|
||||
acc_hbyte_p b = (acc_hbyte_p) buf;
|
||||
long l = 0;
|
||||
|
||||
while (l < size)
|
||||
{
|
||||
unsigned n;
|
||||
n = ACC_FP_OFF(b); n = (n <= 1) ? 0x8000u : (0u - n);
|
||||
if ((long) n > size - l)
|
||||
n = (unsigned) (size - l);
|
||||
n = read(fd, (void __far*)b, n);
|
||||
if (n == 0)
|
||||
break;
|
||||
if (n == (unsigned)-1)
|
||||
return -1;
|
||||
b += n; l += n;
|
||||
}
|
||||
return l;
|
||||
#else
|
||||
# error "unknown memory model"
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(long, acc_hwrite) (int fd, const acc_hvoid_p buf, long size)
|
||||
{
|
||||
#if (ACC_MM_TINY || ACC_MM_SMALL || ACC_MM_MEDIUM)
|
||||
#define __ACCLIB_REQUIRE_HMEMCPY_CH 1
|
||||
unsigned char tmp[512];
|
||||
long l = 0;
|
||||
|
||||
while (l < size)
|
||||
{
|
||||
int n = size - l > (long)sizeof(tmp) ? (int) sizeof(tmp) : (int) (size - l);
|
||||
__ACCLIB_FUNCNAME(acc_hmemcpy)(tmp, (const acc_hbyte_p)buf + l, (acc_hsize_t)n);
|
||||
n = write(fd, tmp, n);
|
||||
if (n == 0)
|
||||
break;
|
||||
if (n < 0)
|
||||
return -1;
|
||||
l += n;
|
||||
}
|
||||
return l;
|
||||
#elif (ACC_MM_COMPACT || ACC_MM_LARGE || ACC_MM_HUGE)
|
||||
const acc_hbyte_p b = (const acc_hbyte_p) buf;
|
||||
long l = 0;
|
||||
|
||||
while (l < size)
|
||||
{
|
||||
unsigned n;
|
||||
n = ACC_FP_OFF(b); n = (n <= 1) ? 0x8000u : (0u - n);
|
||||
if ((long) n > size - l)
|
||||
n = (unsigned) (size - l);
|
||||
n = write(fd, (void __far*)b, n);
|
||||
if (n == 0)
|
||||
break;
|
||||
if (n == (unsigned)-1)
|
||||
return -1;
|
||||
b += n; l += n;
|
||||
}
|
||||
return l;
|
||||
#else
|
||||
# error "unknown memory model"
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* #if (ACC_HAVE_MM_HUGE_PTR) */
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
97
tools/ucl/acc/acclib/hsread.ch
Normal file
97
tools/ucl/acc/acclib/hsread.ch
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_HSREAD_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// huge pointer layer - safe read/write
|
||||
// handles partial pipe writes and interrupted system calls
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(long, acc_safe_hread) (int fd, acc_hvoid_p buf, long size)
|
||||
{
|
||||
acc_hbyte_p b = (acc_hbyte_p) buf;
|
||||
long l = 0;
|
||||
int saved_errno;
|
||||
|
||||
saved_errno = errno;
|
||||
while (l < size)
|
||||
{
|
||||
long n = size - l;
|
||||
#if (ACC_HAVE_MM_HUGE_PTR)
|
||||
# define __ACCLIB_REQUIRE_HREAD_CH 1
|
||||
errno = 0; n = acc_hread(fd, b, n);
|
||||
#elif (ACC_OS_DOS32) && defined(__DJGPP__)
|
||||
errno = 0; n = _read(fd, b, n);
|
||||
#else
|
||||
errno = 0; n = read(fd, b, n);
|
||||
#endif
|
||||
if (n == 0)
|
||||
break;
|
||||
if (n < 0) {
|
||||
#if defined(EINTR)
|
||||
if (errno == (EINTR)) continue;
|
||||
#endif
|
||||
if (errno == 0) errno = 1;
|
||||
return l;
|
||||
}
|
||||
b += n; l += n;
|
||||
}
|
||||
errno = saved_errno;
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(long, acc_safe_hwrite) (int fd, const acc_hvoid_p buf, long size)
|
||||
{
|
||||
const acc_hbyte_p b = (const acc_hbyte_p) buf;
|
||||
long l = 0;
|
||||
int saved_errno;
|
||||
|
||||
saved_errno = errno;
|
||||
while (l < size)
|
||||
{
|
||||
long n = size - l;
|
||||
#if (ACC_HAVE_MM_HUGE_PTR)
|
||||
# define __ACCLIB_REQUIRE_HREAD_CH 1
|
||||
errno = 0; n = acc_hwrite(fd, b, n);
|
||||
#elif (ACC_OS_DOS32) && defined(__DJGPP__)
|
||||
errno = 0; n = _write(fd, b, n);
|
||||
#else
|
||||
errno = 0; n = write(fd, b, n);
|
||||
#endif
|
||||
if (n == 0)
|
||||
break;
|
||||
if (n < 0) {
|
||||
#if defined(EINTR)
|
||||
if (errno == (EINTR)) continue;
|
||||
#endif
|
||||
if (errno == 0) errno = 1;
|
||||
return l;
|
||||
}
|
||||
b += n; l += n;
|
||||
}
|
||||
errno = saved_errno;
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
566
tools/ucl/acc/acclib/hstring.ch
Normal file
566
tools/ucl/acc/acclib/hstring.ch
Normal file
|
|
@ -0,0 +1,566 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_HSTRING_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// strlen
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(acc_hsize_t, acc_hstrlen) (const acc_hchar_p s)
|
||||
{
|
||||
/* TODO: which one is the fastest generic version? */
|
||||
#if 1
|
||||
const acc_hchar_p start = s; while (*s) ++s;
|
||||
return (acc_hsize_t) (s - start);
|
||||
#elif 1
|
||||
acc_hsize_t n = 0; while (*s) ++s, ++n; return n;
|
||||
#elif 1
|
||||
acc_hsize_t n = 0; while (s[n]) ++n; return n;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// strcmp, strncmp, ascii_stricmp, ascii_strnicmp, ascii_memicmp
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_hstrcmp) (const acc_hchar_p p, const acc_hchar_p s)
|
||||
{
|
||||
for ( ; *p; ++p, ++s) {
|
||||
if (*p != *s)
|
||||
break;
|
||||
}
|
||||
return (unsigned char)*p - (unsigned char)*s;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_hstrncmp) (const acc_hchar_p p, const acc_hchar_p s, acc_hsize_t n)
|
||||
{
|
||||
for ( ; *p && n > 0; ++p, ++s, --n) {
|
||||
if (*p != *s)
|
||||
break;
|
||||
}
|
||||
return (unsigned char)*p - (unsigned char)*s;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_ascii_hstricmp) (const acc_hchar_p p, const acc_hchar_p s)
|
||||
{
|
||||
for ( ; *p; ++p, ++s) {
|
||||
if (*p != *s) {
|
||||
int d = acc_ascii_utolower(*p) - acc_ascii_utolower(*s);
|
||||
if (d != 0)
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return acc_ascii_utolower(*p) - acc_ascii_utolower(*s);
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_ascii_hstrnicmp) (const acc_hchar_p p, const acc_hchar_p s, acc_hsize_t n)
|
||||
{
|
||||
for ( ; *p && n > 0; ++p, ++s, --n) {
|
||||
if (*p != *s) {
|
||||
int d = acc_ascii_utolower(*p) - acc_ascii_utolower(*s);
|
||||
if (d != 0)
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return acc_ascii_utolower(*p) - acc_ascii_utolower(*s);
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_ascii_hmemicmp) (const acc_hvoid_p pp, const acc_hvoid_p ss, acc_hsize_t n)
|
||||
{
|
||||
const acc_hbyte_p p = (const acc_hbyte_p) pp;
|
||||
const acc_hbyte_p s = (const acc_hbyte_p) ss;
|
||||
for ( ; n > 0; ++p, ++s, --n) {
|
||||
if (*p != *s) {
|
||||
int d = acc_ascii_utolower(*p) - acc_ascii_utolower(*s);
|
||||
if (d != 0)
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return acc_ascii_utolower(*p) - acc_ascii_utolower(*s);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// strstr, ascii_stristr, memmem, ascii_memimem
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(acc_hchar_p, acc_hstrstr) (const acc_hchar_p p, const acc_hchar_p s)
|
||||
{
|
||||
acc_hsize_t pn = __ACCLIB_FUNCNAME(acc_hstrlen)(p);
|
||||
acc_hsize_t sn = __ACCLIB_FUNCNAME(acc_hstrlen)(s);
|
||||
return (acc_hchar_p) __ACCLIB_FUNCNAME(acc_hmemmem)(p, pn, s, sn);
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hchar_p, acc_ascii_hstristr) (const acc_hchar_p p, const acc_hchar_p s)
|
||||
{
|
||||
acc_hsize_t pn = __ACCLIB_FUNCNAME(acc_hstrlen)(p);
|
||||
acc_hsize_t sn = __ACCLIB_FUNCNAME(acc_hstrlen)(s);
|
||||
return (acc_hchar_p) __ACCLIB_FUNCNAME(acc_ascii_hmemimem)(p, pn, s, sn);
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hvoid_p, acc_hmemmem) (const acc_hvoid_p p, acc_hsize_t pn, const acc_hvoid_p s, acc_hsize_t sn)
|
||||
{
|
||||
#define __ACCLIB_REQUIRE_HMEMCPY_CH 1
|
||||
if (sn == 0) __ACCLIB_CONST_CAST_RETURN(acc_hvoid_p, p)
|
||||
for ( ; pn >= sn; --pn) {
|
||||
if (__ACCLIB_FUNCNAME(acc_hmemcmp)(p, s, sn) == 0)
|
||||
__ACCLIB_CONST_CAST_RETURN(acc_hvoid_p, p)
|
||||
p = (const acc_hbyte_p)p + 1;
|
||||
}
|
||||
return (acc_hvoid_p) 0;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hvoid_p, acc_ascii_hmemimem) (const acc_hvoid_p p, acc_hsize_t pn, const acc_hvoid_p s, acc_hsize_t sn)
|
||||
{
|
||||
if (sn == 0) __ACCLIB_CONST_CAST_RETURN(acc_hvoid_p, p)
|
||||
for ( ; pn >= sn; --pn) {
|
||||
if (__ACCLIB_FUNCNAME(acc_ascii_hmemicmp)(p, s, sn) == 0)
|
||||
__ACCLIB_CONST_CAST_RETURN(acc_hvoid_p, p)
|
||||
p = (const acc_hbyte_p)p + 1;
|
||||
}
|
||||
return (acc_hvoid_p) 0;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// strcpy, strcat
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(acc_hchar_p, acc_hstrcpy) (acc_hchar_p d, const acc_hchar_p s)
|
||||
{
|
||||
acc_hchar_p dest = d;
|
||||
while ((*d = *s) != 0) {
|
||||
++d; ++s;
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hchar_p, acc_hstrcat) (acc_hchar_p d, const acc_hchar_p s)
|
||||
{
|
||||
acc_hchar_p dest = d;
|
||||
while (*d) ++d;
|
||||
while ((*d = *s) != 0) {
|
||||
++d; ++s;
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// strlcpy, strlcat
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(acc_hsize_t, acc_hstrlcpy) (acc_hchar_p d, const acc_hchar_p s, acc_hsize_t size)
|
||||
{
|
||||
acc_hsize_t n = 0;
|
||||
if (n != size) {
|
||||
do {
|
||||
if ((*d = *s) == 0) return n;
|
||||
++d; ++s; ++n;
|
||||
} while (n != size);
|
||||
d[-1] = 0;
|
||||
}
|
||||
while (*s) ++s, ++n;
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hsize_t, acc_hstrlcat) (acc_hchar_p d, const acc_hchar_p s, acc_hsize_t size)
|
||||
{
|
||||
acc_hsize_t n = 0;
|
||||
while (*d && n != size) ++d, ++n;
|
||||
if (n != size) {
|
||||
do {
|
||||
if ((*d = *s) == 0) return n;
|
||||
++d; ++s; ++n;
|
||||
} while (n != size);
|
||||
d[-1] = 0;
|
||||
}
|
||||
while (*s) ++s, ++n;
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// strscpy, strscat
|
||||
// (same as strlcpy/strlcat, but just return -1 in case of failure)
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_hstrscpy) (acc_hchar_p d, const acc_hchar_p s, acc_hsize_t size)
|
||||
{
|
||||
acc_hsize_t n = 0;
|
||||
if (n != size) {
|
||||
do {
|
||||
if ((*d = *s) == 0) return 0;
|
||||
++d; ++s; ++n;
|
||||
} while (n != size);
|
||||
d[-1] = 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_hstrscat) (acc_hchar_p d, const acc_hchar_p s, acc_hsize_t size)
|
||||
{
|
||||
acc_hsize_t n = 0;
|
||||
while (*d && n != size) ++d, ++n;
|
||||
if (n != size) {
|
||||
do {
|
||||
if ((*d = *s) == 0) return 0;
|
||||
++d; ++s; ++n;
|
||||
} while (n != size);
|
||||
d[-1] = 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// strccpy, memccpy
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(acc_hchar_p, acc_hstrccpy) (acc_hchar_p d, const acc_hchar_p s, int c)
|
||||
{
|
||||
for (;;) {
|
||||
if ((*d = *s) == 0) break;
|
||||
if (*d++ == (char) c) return d;
|
||||
++s;
|
||||
}
|
||||
return (acc_hchar_p) 0;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hvoid_p, acc_hmemccpy) (acc_hvoid_p d, const acc_hvoid_p s, int c, acc_hsize_t n)
|
||||
{
|
||||
acc_hbyte_p a = (acc_hbyte_p) d;
|
||||
const acc_hbyte_p p = (const acc_hbyte_p) s;
|
||||
const acc_hbyte_p e = (const acc_hbyte_p) s + n;
|
||||
while (p != e) {
|
||||
if ((*a++ = *p++) == (unsigned char) c)
|
||||
return a;
|
||||
}
|
||||
return (acc_hvoid_p) 0;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// strchr, strrchr, ascii_strichr, ascii_strrichr
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(acc_hchar_p, acc_hstrchr) (const acc_hchar_p s, int c)
|
||||
{
|
||||
for ( ; *s; ++s) {
|
||||
if (*s == (char) c)
|
||||
__ACCLIB_CONST_CAST_RETURN(acc_hchar_p, s)
|
||||
}
|
||||
if ((char) c == 0) __ACCLIB_CONST_CAST_RETURN(acc_hchar_p, s)
|
||||
return (acc_hchar_p) 0;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hchar_p, acc_hstrrchr) (const acc_hchar_p s, int c)
|
||||
{
|
||||
const acc_hchar_p start = s;
|
||||
while (*s) ++s;
|
||||
if ((char) c == 0) __ACCLIB_CONST_CAST_RETURN(acc_hchar_p, s)
|
||||
for (;;) {
|
||||
if (s == start) break; --s;
|
||||
if (*s == (char) c)
|
||||
__ACCLIB_CONST_CAST_RETURN(acc_hchar_p, s)
|
||||
}
|
||||
return (acc_hchar_p) 0;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hchar_p, acc_ascii_hstrichr) (const acc_hchar_p s, int c)
|
||||
{
|
||||
c = acc_ascii_utolower(c);
|
||||
for ( ; *s; ++s) {
|
||||
if (acc_ascii_utolower(*s) == c)
|
||||
__ACCLIB_CONST_CAST_RETURN(acc_hchar_p, s)
|
||||
}
|
||||
if (c == 0) __ACCLIB_CONST_CAST_RETURN(acc_hchar_p, s)
|
||||
return (acc_hchar_p) 0;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hchar_p, acc_ascii_hstrrichr) (const acc_hchar_p s, int c)
|
||||
{
|
||||
const acc_hchar_p start = s;
|
||||
c = acc_ascii_utolower(c);
|
||||
while (*s) ++s;
|
||||
if (c == 0) __ACCLIB_CONST_CAST_RETURN(acc_hchar_p, s)
|
||||
for (;;) {
|
||||
if (s == start) break; --s;
|
||||
if (acc_ascii_utolower(*s) == c)
|
||||
__ACCLIB_CONST_CAST_RETURN(acc_hchar_p, s)
|
||||
}
|
||||
return (acc_hchar_p) 0;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// memchr, memrchr, ascii_memichr, ascii_memrichr
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(acc_hvoid_p, acc_hmemchr) (const acc_hvoid_p s, int c, acc_hsize_t n)
|
||||
{
|
||||
const acc_hbyte_p p = (const acc_hbyte_p) s;
|
||||
const acc_hbyte_p e = (const acc_hbyte_p) s + n;
|
||||
while (p != e) {
|
||||
if (*p == (unsigned char) c)
|
||||
__ACCLIB_CONST_CAST_RETURN(acc_hvoid_p, p)
|
||||
++p;
|
||||
}
|
||||
return (acc_hvoid_p) 0;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hvoid_p, acc_hmemrchr) (const acc_hvoid_p s, int c, acc_hsize_t n)
|
||||
{
|
||||
const acc_hbyte_p p = (const acc_hbyte_p) s + n;
|
||||
const acc_hbyte_p e = (const acc_hbyte_p) s;
|
||||
while (p != e) {
|
||||
--p;
|
||||
if (*p == (unsigned char) c)
|
||||
__ACCLIB_CONST_CAST_RETURN(acc_hvoid_p, p)
|
||||
}
|
||||
return (acc_hvoid_p) 0;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hvoid_p, acc_ascii_hmemichr) (const acc_hvoid_p s, int c, acc_hsize_t n)
|
||||
{
|
||||
const acc_hbyte_p p = (const acc_hbyte_p) s;
|
||||
const acc_hbyte_p e = (const acc_hbyte_p) s + n;
|
||||
c = acc_ascii_utolower(c);
|
||||
while (p != e) {
|
||||
if (acc_ascii_utolower(*p) == c)
|
||||
__ACCLIB_CONST_CAST_RETURN(acc_hvoid_p, p)
|
||||
++p;
|
||||
}
|
||||
return (acc_hvoid_p) 0;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hvoid_p, acc_ascii_hmemrichr) (const acc_hvoid_p s, int c, acc_hsize_t n)
|
||||
{
|
||||
const acc_hbyte_p p = (const acc_hbyte_p) s + n;
|
||||
const acc_hbyte_p e = (const acc_hbyte_p) s;
|
||||
c = acc_ascii_utolower(c);
|
||||
while (p != e) {
|
||||
--p;
|
||||
if (acc_ascii_utolower(*p) == c)
|
||||
__ACCLIB_CONST_CAST_RETURN(acc_hvoid_p, p)
|
||||
}
|
||||
return (acc_hvoid_p) 0;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// strspn, strrspn
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(acc_hsize_t, acc_hstrspn) (const acc_hchar_p s, const acc_hchar_p accept)
|
||||
{
|
||||
acc_hsize_t n = 0;
|
||||
for ( ; *s; ++s) {
|
||||
const acc_hchar_p a;
|
||||
for (a = accept; *a; ++a)
|
||||
if (*s == *a)
|
||||
goto acc_label_next;
|
||||
break;
|
||||
acc_label_next:
|
||||
++n;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hsize_t, acc_hstrrspn) (const acc_hchar_p s, const acc_hchar_p accept)
|
||||
{
|
||||
acc_hsize_t n = 0;
|
||||
const acc_hchar_p start = s;
|
||||
while (*s) ++s;
|
||||
for (;;) {
|
||||
const acc_hchar_p a;
|
||||
if (s == start) break; --s;
|
||||
for (a = accept; *a; ++a)
|
||||
if (*s == *a)
|
||||
goto acc_label_next;
|
||||
break;
|
||||
acc_label_next:
|
||||
++n;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// strcspn, strrcspn
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(acc_hsize_t, acc_hstrcspn) (const acc_hchar_p s, const acc_hchar_p reject)
|
||||
{
|
||||
acc_hsize_t n = 0;
|
||||
for ( ; *s; ++s, ++n) {
|
||||
const acc_hchar_p r;
|
||||
for (r = reject; *r; ++r)
|
||||
if (*s == *r)
|
||||
return n;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hsize_t, acc_hstrrcspn) (const acc_hchar_p s, const acc_hchar_p reject)
|
||||
{
|
||||
acc_hsize_t n = 0;
|
||||
const acc_hchar_p start = s;
|
||||
while (*s) ++s;
|
||||
for ( ; ; ++n) {
|
||||
const acc_hchar_p r;
|
||||
if (s == start) break; --s;
|
||||
for (r = reject; *r; ++r)
|
||||
if (*s == *r)
|
||||
return n;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// strpbrk, strrpbrk
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(acc_hchar_p, acc_hstrpbrk) (const acc_hchar_p s, const acc_hchar_p accept)
|
||||
{
|
||||
for ( ; *s; ++s) {
|
||||
const acc_hchar_p a;
|
||||
for (a = accept; *a; ++a) {
|
||||
if (*s == *a)
|
||||
__ACCLIB_CONST_CAST_RETURN(acc_hchar_p, s)
|
||||
}
|
||||
}
|
||||
return (acc_hchar_p) 0;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hchar_p, acc_hstrrpbrk) (const acc_hchar_p s, const acc_hchar_p accept)
|
||||
{
|
||||
const acc_hchar_p start = s;
|
||||
while (*s) ++s;
|
||||
for (;;) {
|
||||
const acc_hchar_p a;
|
||||
if (s == start) break; --s;
|
||||
for (a = accept; *a; ++a) {
|
||||
if (*s == *a)
|
||||
__ACCLIB_CONST_CAST_RETURN(acc_hchar_p, s)
|
||||
}
|
||||
}
|
||||
return (acc_hchar_p) 0;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// strsep, strrsep
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(acc_hchar_p, acc_hstrsep) (acc_hchar_pp ss, const acc_hchar_p delim)
|
||||
{
|
||||
acc_hchar_p s = *ss;
|
||||
if (s) {
|
||||
acc_hchar_p p = __ACCLIB_FUNCNAME(acc_hstrpbrk)(s, delim);
|
||||
if (p) *p++ = 0;
|
||||
*ss = p;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hchar_p, acc_hstrrsep) (acc_hchar_pp ss, const acc_hchar_p delim)
|
||||
{
|
||||
acc_hchar_p s = *ss;
|
||||
if (s) {
|
||||
acc_hchar_p p = __ACCLIB_FUNCNAME(acc_hstrrpbrk)(s, delim);
|
||||
if (p) {
|
||||
*p++ = 0;
|
||||
return p;
|
||||
}
|
||||
*ss = (acc_hchar_p) 0;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// ascii_strlwr, ascii_strupr, ascii_memlwr, ascii_memupr
|
||||
************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(acc_hchar_p, acc_ascii_hstrlwr) (acc_hchar_p s)
|
||||
{
|
||||
acc_hbyte_p p = (acc_hbyte_p) s;
|
||||
for ( ; *p; ++p)
|
||||
*p = (unsigned char) acc_ascii_utolower(*p);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hchar_p, acc_ascii_hstrupr) (acc_hchar_p s)
|
||||
{
|
||||
acc_hbyte_p p = (acc_hbyte_p) s;
|
||||
for ( ; *p; ++p)
|
||||
*p = (unsigned char) acc_ascii_utoupper(*p);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hvoid_p, acc_ascii_hmemlwr) (acc_hvoid_p s, acc_hsize_t n)
|
||||
{
|
||||
acc_hbyte_p p = (acc_hbyte_p) s;
|
||||
acc_hbyte_p e = (acc_hbyte_p) s + n;
|
||||
for ( ; p != e; ++p)
|
||||
*p = (unsigned char) acc_ascii_utolower(*p);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_hvoid_p, acc_ascii_hmemupr) (acc_hvoid_p s, acc_hsize_t n)
|
||||
{
|
||||
acc_hbyte_p p = (acc_hbyte_p) s;
|
||||
acc_hbyte_p e = (acc_hbyte_p) s + n;
|
||||
for ( ; p != e; ++p)
|
||||
*p = (unsigned char) acc_ascii_utoupper(*p);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
199
tools/ucl/acc/acclib/misc.ch
Normal file
199
tools/ucl/acc/acclib/misc.ch
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_MISC_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// wrap misc
|
||||
**************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(acclib_handle_t, acc_get_osfhandle) (int fd)
|
||||
{
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
#if (ACC_OS_CYGWIN)
|
||||
return get_osfhandle(fd);
|
||||
#elif (ACC_OS_EMX && defined(__RSXNT__))
|
||||
return -1; /* FIXME */
|
||||
#elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__PW32__)
|
||||
return -1; /* FIXME */
|
||||
#elif (ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
# if (ACC_CC_PELLESC && (__POCC__ < 280))
|
||||
return -1; /* FIXME */
|
||||
# elif (ACC_CC_WATCOMC && (__WATCOMC__ < 1000))
|
||||
return -1; /* FIXME */
|
||||
# elif (ACC_CC_WATCOMC && (__WATCOMC__ < 1100))
|
||||
return _os_handle(fd);
|
||||
# else
|
||||
return _get_osfhandle(fd);
|
||||
# endif
|
||||
#else
|
||||
return fd;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_set_binmode) (int fd, int binary)
|
||||
{
|
||||
#if (ACC_OS_TOS && defined(__MINT__))
|
||||
FILE* fp; int old_binary;
|
||||
if (fd == STDIN_FILENO) fp = stdin;
|
||||
else if (fd == STDOUT_FILENO) fp = stdout;
|
||||
else if (fd == STDERR_FILENO) fp = stderr;
|
||||
else return -1;
|
||||
old_binary = fp->__mode.__binary;
|
||||
__set_binmode(fp, binary ? 1 : 0);
|
||||
return old_binary ? 1 : 0;
|
||||
#elif (ACC_OS_TOS)
|
||||
ACC_UNUSED(fd); ACC_UNUSED(binary);
|
||||
return -1; /* FIXME */
|
||||
#elif (ACC_OS_DOS16 && (ACC_CC_AZTECC || ACC_CC_PACIFICC))
|
||||
ACC_UNUSED(fd); ACC_UNUSED(binary);
|
||||
return -1; /* FIXME */
|
||||
#elif (ACC_OS_DOS32 && ACC_CC_GNUC) && defined(__DJGPP__)
|
||||
int r; unsigned old_flags = __djgpp_hwint_flags;
|
||||
ACC_COMPILE_TIME_ASSERT(O_BINARY > 0)
|
||||
ACC_COMPILE_TIME_ASSERT(O_TEXT > 0)
|
||||
if (fd < 0) return -1;
|
||||
r = setmode(fd, binary ? O_BINARY : O_TEXT);
|
||||
if ((old_flags & 1u) != (__djgpp_hwint_flags & 1u))
|
||||
__djgpp_set_ctrl_c(!(old_flags & 1));
|
||||
if (r == -1) return -1;
|
||||
return (r & O_TEXT) ? 0 : 1;
|
||||
#elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__PW32__)
|
||||
if (fd < 0) return -1;
|
||||
ACC_UNUSED(binary);
|
||||
return 1;
|
||||
#elif (ACC_OS_DOS32 && ACC_CC_HIGHC)
|
||||
FILE* fp; int r;
|
||||
if (fd == fileno(stdin)) fp = stdin;
|
||||
else if (fd == fileno(stdout)) fp = stdout;
|
||||
else if (fd == fileno(stderr)) fp = stderr;
|
||||
else return -1;
|
||||
r = _setmode(fp, binary ? _BINARY : _TEXT);
|
||||
if (r == -1) return -1;
|
||||
return (r & _BINARY) ? 1 : 0;
|
||||
#elif (ACC_OS_WIN32 && ACC_CC_MWERKS) && defined(__MSL__)
|
||||
ACC_UNUSED(fd); ACC_UNUSED(binary);
|
||||
return -1; /* FIXME */
|
||||
#elif (ACC_OS_CYGWIN && (ACC_CC_GNUC < 0x025a00ul))
|
||||
ACC_UNUSED(fd); ACC_UNUSED(binary);
|
||||
return -1; /* FIXME */
|
||||
#elif (ACC_OS_CYGWIN || ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_EMX || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
int r;
|
||||
#if !defined(ACC_CC_ZORTECHC)
|
||||
ACC_COMPILE_TIME_ASSERT(O_BINARY > 0)
|
||||
#endif
|
||||
ACC_COMPILE_TIME_ASSERT(O_TEXT > 0)
|
||||
if (fd < 0) return -1;
|
||||
r = setmode(fd, binary ? O_BINARY : O_TEXT);
|
||||
if (r == -1) return -1;
|
||||
return (r & O_TEXT) ? 0 : 1;
|
||||
#else
|
||||
if (fd < 0) return -1;
|
||||
ACC_UNUSED(binary);
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_isatty) (int fd)
|
||||
{
|
||||
/* work around library implementations that think that
|
||||
* any character device like `nul' is a tty */
|
||||
if (fd < 0)
|
||||
return 0;
|
||||
#if (ACC_OS_DOS16 && !defined(ACC_CC_AZTECC))
|
||||
{
|
||||
union REGS ri, ro;
|
||||
ri.x.ax = 0x4400; ri.x.bx = fd;
|
||||
int86(0x21, &ri, &ro);
|
||||
if ((ro.x.cflag & 1) == 0) /* if carry flag not set */
|
||||
if ((ro.x.ax & 0x83) != 0x83)
|
||||
return 0;
|
||||
}
|
||||
#elif (ACC_OS_DOS32 && ACC_CC_WATCOMC)
|
||||
{
|
||||
union REGS ri, ro;
|
||||
ri.w.ax = 0x4400; ri.w.bx = (unsigned short) fd;
|
||||
int386(0x21, &ri, &ro);
|
||||
if ((ro.w.cflag & 1) == 0) /* if carry flag not set */
|
||||
if ((ro.w.ax & 0x83) != 0x83)
|
||||
return 0;
|
||||
}
|
||||
#elif (ACC_HAVE_WINDOWS_H)
|
||||
{
|
||||
acclib_handle_t h = __ACCLIB_FUNCNAME(acc_get_osfhandle)(fd);
|
||||
if ((HANDLE)h != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
DWORD d = 0;
|
||||
if (GetConsoleMode((HANDLE)h, &d) == 0)
|
||||
return 0; /* GetConsoleMode failed -> not a tty */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (isatty(fd)) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_mkdir) (const char* name, unsigned mode)
|
||||
{
|
||||
#if (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
|
||||
ACC_UNUSED(mode);
|
||||
return Dcreate(name);
|
||||
#elif (ACC_OS_DOS32 && ACC_CC_GNUC) && defined(__DJGPP__)
|
||||
return mkdir(name, mode);
|
||||
#elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__PW32__)
|
||||
return mkdir(name, mode);
|
||||
#elif (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
ACC_UNUSED(mode);
|
||||
# if (ACC_CC_HIGHC || ACC_CC_PACIFICC)
|
||||
return mkdir((char*) name);
|
||||
# else
|
||||
return mkdir(name);
|
||||
# endif
|
||||
#else
|
||||
return mkdir(name, mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_int32l_t, acc_muldiv32) (acc_int32l_t a, acc_int32l_t b, acc_int32l_t x)
|
||||
{
|
||||
acc_int32l_t r = 0;
|
||||
if (x == 0) return x;
|
||||
/* FIXME */
|
||||
ACC_UNUSED(a); ACC_UNUSED(b);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(acc_uint32l_t, acc_umuldiv32) (acc_uint32l_t a, acc_uint32l_t b, acc_uint32l_t x)
|
||||
{
|
||||
acc_uint32l_t r = 0;
|
||||
if (x == 0) return x;
|
||||
/* FIXME */
|
||||
ACC_UNUSED(a); ACC_UNUSED(b);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
255
tools/ucl/acc/acclib/opendir.ch
Normal file
255
tools/ucl/acc/acclib/opendir.ch
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_OPENDIR_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// wrap <dirent.h>
|
||||
**************************************************************************/
|
||||
|
||||
#if !defined(__ACCLIB_USE_OPENDIR)
|
||||
#if (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_TOS || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
|
||||
static int __ACCLIB_FUNCNAME(acc_opendir_init)(acc_dir_p f, const char* path, char* buf, size_t bufsize)
|
||||
{
|
||||
size_t l; char* p;
|
||||
f->f_name[0] = 0; buf[0] = 0;
|
||||
l = strlen(path);
|
||||
if (l == 0 || bufsize <= 4 || l >= bufsize - 4)
|
||||
return -1;
|
||||
strcpy(buf, path); p = buf + l;
|
||||
if (p[-1] == ':' || p[-1] == '\\' || p[-1] == '/')
|
||||
strcpy(p, "*.*");
|
||||
else
|
||||
strcpy(p, "\\*.*");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__ACCLIB_USE_OPENDIR)
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_opendir) (acc_dir_p f, const char* path)
|
||||
{
|
||||
f->u_dirp = opendir(path);
|
||||
if (!f->u_dirp)
|
||||
return -2;
|
||||
return __ACCLIB_FUNCNAME(acc_readdir)(f);
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_readdir) (acc_dir_p f)
|
||||
{
|
||||
const struct dirent* dp;
|
||||
f->f_name[0] = 0;
|
||||
if (!f->u_dirp)
|
||||
return -1;
|
||||
dp = (const struct dirent*) readdir((DIR*) f->u_dirp);
|
||||
if (!dp)
|
||||
return -1;
|
||||
if (!dp->d_name[0] || strlen(dp->d_name) >= sizeof(f->f_name))
|
||||
return -1;
|
||||
strcpy(f->f_name, dp->d_name);
|
||||
#if (ACC_CC_WATCOMC)
|
||||
ACC_COMPILE_TIME_ASSERT(sizeof(f->f_name) >= sizeof(dp->d_name))
|
||||
f->f_time = dp->d_time;
|
||||
f->f_date = dp->d_date;
|
||||
f->f_size = dp->d_size;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_closedir) (acc_dir_p f)
|
||||
{
|
||||
int r = -1;
|
||||
if (f->u_dirp)
|
||||
r = closedir((DIR*) f->u_dirp);
|
||||
f->u_dirp = 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
#elif (ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_opendir) (acc_dir_p f, const char* path)
|
||||
{
|
||||
WIN32_FIND_DATAA d;
|
||||
HANDLE h;
|
||||
if (__ACCLIB_FUNCNAME(acc_opendir_init)(f, path, f->f_name, sizeof(f->f_name)) != 0)
|
||||
return -1;
|
||||
h = FindFirstFileA(f->f_name, &d);
|
||||
f->f_name[0] = 0;
|
||||
if ((f->u_handle = (acclib_handle_t) h) == -1)
|
||||
return -1;
|
||||
if (!d.cFileName[0] || strlen(d.cFileName) >= sizeof(f->f_name))
|
||||
return -1;
|
||||
strcpy(f->f_name, d.cFileName);
|
||||
f->f_attr = d.dwFileAttributes;
|
||||
f->f_size_high = d.nFileSizeHigh;
|
||||
f->f_size_low = d.nFileSizeLow;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_readdir) (acc_dir_p f)
|
||||
{
|
||||
WIN32_FIND_DATAA d;
|
||||
f->f_name[0] = 0;
|
||||
if (f->u_handle == -1 || FindNextFileA((HANDLE) f->u_handle, &d) == 0)
|
||||
return -1;
|
||||
if (!d.cFileName[0] || strlen(d.cFileName) >= sizeof(f->f_name))
|
||||
return -1;
|
||||
strcpy(f->f_name, d.cFileName);
|
||||
f->f_attr = d.dwFileAttributes;
|
||||
f->f_size_high = d.nFileSizeHigh;
|
||||
f->f_size_low = d.nFileSizeLow;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_closedir) (acc_dir_p f)
|
||||
{
|
||||
int r = -1;
|
||||
if (f->u_handle != -1)
|
||||
r = FindClose((HANDLE) f->u_handle);
|
||||
f->u_handle = -1;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
#elif (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_WIN16)
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_opendir) (acc_dir_p f, const char* path)
|
||||
{
|
||||
char tmp[ACC_FN_PATH_MAX+1];
|
||||
int r;
|
||||
f->u_dirp = 0;
|
||||
if (__ACCLIB_FUNCNAME(acc_opendir_init)(f, path, tmp, sizeof(tmp)) != 0)
|
||||
return -1;
|
||||
#if (ACC_CC_AZTECC || ACC_CC_PACIFICC)
|
||||
r = -1;
|
||||
#elif (ACC_CC_BORLANDC || ACC_CC_TURBOC)
|
||||
r = findfirst(tmp, (struct ffblk*) f->u_dta, FA_HIDDEN|FA_SYSTEM|FA_RDONLY|FA_DIREC);
|
||||
#else
|
||||
r = _dos_findfirst(tmp, _A_HIDDEN|_A_SYSTEM|_A_RDONLY|_A_SUBDIR, (struct find_t*) f->u_dta);
|
||||
#endif
|
||||
if (r != 0) f->f_name[0] = 0;
|
||||
if (!f->f_name[0]) return -1;
|
||||
f->u_dirp = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_readdir) (acc_dir_p f)
|
||||
{
|
||||
int r;
|
||||
f->f_name[0] = 0;
|
||||
if (!f->u_dirp)
|
||||
return -1;
|
||||
#if (ACC_CC_AZTECC || ACC_CC_PACIFICC)
|
||||
r = -1;
|
||||
#elif (ACC_CC_BORLANDC || ACC_CC_TURBOC)
|
||||
r = findnext((struct ffblk*) f->u_dta);
|
||||
#else
|
||||
r = _dos_findnext((struct find_t*) f->u_dta);
|
||||
#endif
|
||||
if (r != 0) f->f_name[0] = 0;
|
||||
if (!f->f_name[0]) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_closedir) (acc_dir_p f)
|
||||
{
|
||||
ACC_COMPILE_TIME_ASSERT(sizeof(*f) == 44);
|
||||
f->f_name[0] = 0;
|
||||
f->u_dirp = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#elif (ACC_OS_TOS)
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_opendir) (acc_dir_p f, const char* path)
|
||||
{
|
||||
char tmp[ACC_FN_PATH_MAX+1];
|
||||
int r;
|
||||
DTA* olddta;
|
||||
f->u_dirp = 0;
|
||||
if (__ACCLIB_FUNCNAME(acc_opendir_init)(f, path, tmp, sizeof(tmp)) != 0)
|
||||
return -1;
|
||||
olddta = Fgetdta();
|
||||
Fsetdta((DTA*) f->u_dta);
|
||||
r = Fsfirst(tmp, FA_HIDDEN|FA_SYSTEM|FA_READONLY|FA_SUBDIR);
|
||||
Fsetdta(olddta);
|
||||
if (r != 0) f->f_name[0] = 0;
|
||||
if (!f->f_name[0]) return -1;
|
||||
f->u_dirp = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_readdir) (acc_dir_p f)
|
||||
{
|
||||
int r;
|
||||
DTA* olddta;
|
||||
f->f_name[0] = 0;
|
||||
if (!f->u_dirp)
|
||||
return -1;
|
||||
olddta = Fgetdta();
|
||||
Fsetdta((DTA*) f->u_dta);
|
||||
r = Fsnext();
|
||||
Fsetdta(olddta);
|
||||
if (r != 0) f->f_name[0] = 0;
|
||||
if (!f->f_name[0]) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_closedir) (acc_dir_p f)
|
||||
{
|
||||
ACC_COMPILE_TIME_ASSERT(sizeof(*f) == 44);
|
||||
f->f_name[0] = 0;
|
||||
f->u_dirp = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_opendir) (acc_dir_p f, const char* path)
|
||||
{
|
||||
ACC_UNUSED(path);
|
||||
f->f_name[0] = 0;
|
||||
return -3;
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_readdir) (acc_dir_p f)
|
||||
{
|
||||
f->f_name[0] = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_closedir) (acc_dir_p f)
|
||||
{
|
||||
f->u_dirp = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
157
tools/ucl/acc/acclib/perfctr.ch
Normal file
157
tools/ucl/acc/acclib/perfctr.ch
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_PERFCTR_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
#if (ACC_OS_POSIX_LINUX)
|
||||
/* see http://user.it.uu.se/~mikpe/linux/perfctr/ */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#include <libperfctr.h>
|
||||
}
|
||||
#else
|
||||
#include <libperfctr.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
//
|
||||
**************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_perfctr_open) (acc_perfctr_handle_p h)
|
||||
{
|
||||
memset(h, 0, sizeof(*h));
|
||||
#if (ACC_OS_POSIX_LINUX)
|
||||
{
|
||||
struct vperfctr* handle;
|
||||
struct perfctr_info info;
|
||||
struct vperfctr_control control;
|
||||
struct perfctr_cpu_control* const cc = &control.cpu_control;
|
||||
/* open */
|
||||
handle = vperfctr_open();
|
||||
if (!handle) goto error;
|
||||
/* get info */
|
||||
if (vperfctr_info(handle, &info) < 0) goto error;
|
||||
h->cpu_type = info.cpu_type;
|
||||
h->cpu_features = info.cpu_features;
|
||||
h->cpu_khz = info.cpu_khz;
|
||||
h->cpu_nrctrs = perfctr_info_nrctrs(&info);
|
||||
h->cpu_name = perfctr_info_cpu_name(&info);
|
||||
/* setup control */
|
||||
memset(&control, 0, sizeof(control));
|
||||
switch (h->cpu_type) {
|
||||
#if (ACC_ARCH_IA32)
|
||||
case PERFCTR_X86_WINCHIP_C6:
|
||||
case PERFCTR_X86_WINCHIP_2:
|
||||
break; /* no working TSC available */
|
||||
case PERFCTR_X86_AMD_K7:
|
||||
#endif
|
||||
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32)
|
||||
case PERFCTR_X86_AMD_K8:
|
||||
case PERFCTR_X86_AMD_K8C:
|
||||
cc->tsc_on = 1; cc->nractrs = 2;
|
||||
/* event 0xC0 (RETIRED_INSNS), count at CPL > 0, Enable */
|
||||
cc->pmc_map[0] = 0;
|
||||
cc->evntsel[0] = 0xC0 | (1 << 16) | (1 << 22);
|
||||
/* event 0xC1 (RETIRED_OPS), count at CPL > 0, Enable */
|
||||
cc->pmc_map[1] = 1;
|
||||
cc->evntsel[1] = 0xC1 | (1 << 16) | (1 << 22);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
cc->tsc_on = 1;
|
||||
break;
|
||||
}
|
||||
if (cc->nractrs > h->cpu_nrctrs) cc->nractrs = h->cpu_nrctrs;
|
||||
if (vperfctr_control(handle, &control) < 0) goto error;
|
||||
/* success */
|
||||
h->h = (void*) handle;
|
||||
return 0;
|
||||
error:
|
||||
if (handle) {
|
||||
vperfctr_stop(handle);
|
||||
vperfctr_close(handle);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_perfctr_close) (acc_perfctr_handle_p h)
|
||||
{
|
||||
if (h->h) {
|
||||
#if (ACC_OS_POSIX_LINUX)
|
||||
struct vperfctr* handle = (struct vperfctr*) h->h;
|
||||
vperfctr_stop(handle);
|
||||
vperfctr_close(handle);
|
||||
#endif
|
||||
h->h = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
//
|
||||
**************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_perfctr_read) (acc_perfctr_handle_p h, acc_perfctr_clock_p c)
|
||||
{
|
||||
if (h->h) {
|
||||
#if (ACC_OS_POSIX_LINUX)
|
||||
struct vperfctr* handle = (struct vperfctr*) h->h;
|
||||
vperfctr_read_ctrs(handle, (struct perfctr_sum_ctrs*) c);
|
||||
#else
|
||||
memset(c, 0, sizeof(*c));
|
||||
#endif
|
||||
} else
|
||||
memset(c, 0, sizeof(*c));
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
//
|
||||
**************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(double, acc_perfctr_get_elapsed) (acc_perfctr_handle_p h, const acc_perfctr_clock_p start, const acc_perfctr_clock_p stop)
|
||||
{
|
||||
#if (ACC_OS_POSIX_LINUX)
|
||||
acc_uint64l_t tsc = stop->tsc - start->tsc;
|
||||
return ((double)tsc / h->cpu_khz) / 1000.0;
|
||||
#else
|
||||
ACC_UNUSED(h); ACC_UNUSED(start); ACC_UNUSED(stop); return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(double, acc_perfctr_get_elapsed_tsc) (acc_perfctr_handle_p h, acc_uint64l_t tsc)
|
||||
{
|
||||
#if (ACC_OS_POSIX_LINUX)
|
||||
return ((double)tsc / h->cpu_khz) / 1000.0;
|
||||
#else
|
||||
ACC_UNUSED(h); ACC_UNUSED(tsc); return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
135
tools/ucl/acc/acclib/rand.ch
Normal file
135
tools/ucl/acc/acclib/rand.ch
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_RAND_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// some linear congruential pseudo random number generators (PRNG)
|
||||
**************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_srand31) (acc_rand31_p r, acc_uint32l_t seed)
|
||||
{
|
||||
r->seed = seed & ACC_UINT32L_C(0xffffffff);
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(acc_uint32l_t, acc_rand31) (acc_rand31_p r)
|
||||
{
|
||||
r->seed = r->seed * ACC_UINT32L_C(1103515245) + 12345;
|
||||
r->seed &= ACC_UINT32L_C(0x7fffffff);
|
||||
return r->seed;
|
||||
}
|
||||
|
||||
|
||||
#if defined(acc_uint64l_t)
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_srand48) (acc_rand48_p r, acc_uint32l_t seed)
|
||||
{
|
||||
r->seed = seed & ACC_UINT32L_C(0xffffffff);
|
||||
r->seed <<= 16; r->seed |= 0x330e;
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(acc_uint32l_t, acc_rand48) (acc_rand48_p r)
|
||||
{
|
||||
r->seed = r->seed * ACC_UINT64L_C(25214903917) + 11;
|
||||
r->seed &= ACC_UINT64L_C(0xffffffffffff);
|
||||
return (acc_uint32l_t) (r->seed >> 17);
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(acc_uint32l_t, acc_rand48_r32) (acc_rand48_p r)
|
||||
{
|
||||
r->seed = r->seed * ACC_UINT64L_C(25214903917) + 11;
|
||||
r->seed &= ACC_UINT64L_C(0xffffffffffff);
|
||||
return (acc_uint32l_t) (r->seed >> 16);
|
||||
}
|
||||
|
||||
#endif /* acc_uint64l_t */
|
||||
|
||||
|
||||
#if defined(acc_uint64l_t)
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_srand64) (acc_rand64_p r, acc_uint64l_t seed)
|
||||
{
|
||||
r->seed = seed & ACC_UINT64L_C(0xffffffffffffffff);
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(acc_uint32l_t, acc_rand64) (acc_rand64_p r)
|
||||
{
|
||||
r->seed = r->seed * ACC_UINT64L_C(6364136223846793005) + 1;
|
||||
#if (SIZEOF_ACC_INT64L_T > 8)
|
||||
r->seed &= ACC_UINT64L_C(0xffffffffffffffff);
|
||||
#endif
|
||||
return (acc_uint32l_t) (r->seed >> 33);
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(acc_uint32l_t, acc_rand64_r32) (acc_rand64_p r)
|
||||
{
|
||||
r->seed = r->seed * ACC_UINT64L_C(6364136223846793005) + 1;
|
||||
#if (SIZEOF_ACC_INT64L_T > 8)
|
||||
r->seed &= ACC_UINT64L_C(0xffffffffffffffff);
|
||||
#endif
|
||||
return (acc_uint32l_t) (r->seed >> 32);
|
||||
}
|
||||
|
||||
#endif /* acc_uint64l_t */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// mersenne twister PRNG
|
||||
**************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_srandmt) (acc_randmt_p r, acc_uint32l_t seed)
|
||||
{
|
||||
unsigned i = 0;
|
||||
do {
|
||||
r->s[i++] = (seed &= ACC_UINT32L_C(0xffffffff));
|
||||
seed ^= seed >> 30;
|
||||
seed = seed * ACC_UINT32L_C(0x6c078965) + i;
|
||||
} while (i != 624);
|
||||
r->n = i;
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(acc_uint32l_t, acc_randmt) (acc_randmt_p r)
|
||||
{
|
||||
return (__ACCLIB_FUNCNAME(acc_randmt_r32)(r)) >> 1;
|
||||
}
|
||||
|
||||
ACCLIB_PUBLIC(acc_uint32l_t, acc_randmt_r32) (acc_randmt_p r)
|
||||
{
|
||||
acc_uint32l_t v;
|
||||
if (r->n == 624) {
|
||||
int i = 0, j;
|
||||
r->n = 0;
|
||||
do {
|
||||
j = i - 623; if (j < 0) j += 624;
|
||||
v = (r->s[i] & ACC_UINT32L_C(0x80000000)) ^ (r->s[j] & ACC_UINT32L_C(0x7fffffff));
|
||||
j = i - 227; if (j < 0) j += 624;
|
||||
r->s[i] = r->s[j] ^ (v >> 1);
|
||||
if (v & 1) r->s[i] ^= ACC_UINT32L_C(0x9908b0df);
|
||||
} while (++i != 624);
|
||||
}
|
||||
v = r->s[r->n++];
|
||||
v ^= v >> 11; v ^= (v & ACC_UINT32L_C(0x013a58ad)) << 7;
|
||||
v ^= (v & ACC_UINT32L_C(0x0001df8c)) << 15; v ^= v >> 18;
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
116
tools/ucl/acc/acclib/rdtsc.ch
Normal file
116
tools/ucl/acc/acclib/rdtsc.ch
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_RDTSC_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
#if defined(acc_int32e_t)
|
||||
|
||||
|
||||
#if ((ACC_ARCH_AMD64 || ACC_ARCH_IA32) && ACC_CC_GNUC)
|
||||
# if (ACC_CC_GNUC >= 0x020000ul)
|
||||
# define __ACCLIB_RDTSC_REGS : : "r" (t) : "cc", "memory", "eax", "edx"
|
||||
# else
|
||||
# define __ACCLIB_RDTSC_REGS : : "r" (t) : "ax", "dx"
|
||||
# endif
|
||||
#elif (ACC_ARCH_IA32 && ACC_CC_INTELC) && defined(__linux__)
|
||||
# define __ACCLIB_RDTSC_REGS : : "r" (t) : "memory", "eax", "edx"
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// read TSC
|
||||
**************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_tsc_read) (acc_uint32e_t* t)
|
||||
{
|
||||
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32) && defined(__ACCLIB_RDTSC_REGS)
|
||||
__asm__ __volatile__(
|
||||
"clc \n" ".byte 0x0f, 0x31\n"
|
||||
"movl %%eax,(%0)\n" "movl %%edx,4(%0)\n"
|
||||
__ACCLIB_RDTSC_REGS
|
||||
);
|
||||
return 0;
|
||||
#elif (ACC_ARCH_IA32 && (ACC_OS_DOS32 || ACC_OS_WIN32) && (ACC_CC_DMC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_PELLESC))
|
||||
ACC_UNUSED(t);
|
||||
__asm {
|
||||
mov ecx, t
|
||||
clc
|
||||
# if (ACC_CC_MSC && (_MSC_VER < 1200))
|
||||
_emit 0x0f
|
||||
_emit 0x31
|
||||
# else
|
||||
rdtsc
|
||||
# endif
|
||||
mov [ecx], eax
|
||||
mov [ecx+4], edx
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
t[0] = t[1] = 0;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// read and add TSC
|
||||
**************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_tsc_read_add) (acc_uint32e_t* t)
|
||||
{
|
||||
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32) && defined(__ACCLIB_RDTSC_REGS)
|
||||
__asm__ __volatile__(
|
||||
"clc \n" ".byte 0x0f, 0x31\n"
|
||||
"addl %%eax,(%0)\n" "adcl $0,%%edx\n" "addl %%edx,4(%0)\n"
|
||||
__ACCLIB_RDTSC_REGS
|
||||
);
|
||||
return 0;
|
||||
#elif (ACC_ARCH_IA32 && (ACC_OS_DOS32 || ACC_OS_WIN32) && (ACC_CC_DMC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_PELLESC))
|
||||
ACC_UNUSED(t);
|
||||
__asm {
|
||||
mov ecx, t
|
||||
clc
|
||||
# if (ACC_CC_MSC && (_MSC_VER < 1200))
|
||||
_emit 0x0f
|
||||
_emit 0x31
|
||||
# else
|
||||
rdtsc
|
||||
# endif
|
||||
add [ecx], eax
|
||||
adc edx, 0
|
||||
add [ecx+4], edx
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
acc_uint32e_t v[2];
|
||||
int r;
|
||||
r = acc_tsc_read(v);
|
||||
t[0] += v[0];
|
||||
if (t[0] < v[0]) t[1] += 1;
|
||||
t[1] += v[1];
|
||||
return r;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif /* defined(acc_int32e_t) */
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
230
tools/ucl/acc/acclib/uclock.ch
Normal file
230
tools/ucl/acc/acclib/uclock.ch
Normal file
|
|
@ -0,0 +1,230 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_UCLOCK_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
#if (ACC_OS_DOS16 || ACC_OS_WIN16)
|
||||
#elif (ACC_OS_DOS32 && ACC_CC_GNUC) && defined(__DJGPP__)
|
||||
#elif (ACC_OS_CYGWIN || ACC_OS_WIN32 || ACC_OS_WIN64) && (ACC_HAVE_WINDOWS_H)
|
||||
# if defined(acc_int64l_t)
|
||||
/* See also: KB Q274323: PRB: Performance Counter Value May
|
||||
* Unexpectedly Leap Forward */
|
||||
# define __ACCLIB_UCLOCK_USE_QPC 1
|
||||
# endif
|
||||
/* fallbacks */
|
||||
# if ((ACC_CC_DMC && (__DMC__ < 0x838)) || ACC_CC_LCC)
|
||||
/* winmm.lib is missing */
|
||||
# define __ACCLIB_UCLOCK_USE_CLOCK 1
|
||||
# else
|
||||
# define __ACCLIB_UCLOCK_USE_WINMM 1
|
||||
# if (ACC_CC_MSC && (_MSC_VER >= 900))
|
||||
/* avoid `-W4' warnings in <mmsystem.h> */
|
||||
# pragma warning(disable: 4201)
|
||||
# elif (ACC_CC_MWERKS)
|
||||
/* avoid duplicate typedef in <mmsystem.h> */
|
||||
# define LPUINT __ACC_MMSYSTEM_H_LPUINT
|
||||
# endif
|
||||
# if 1
|
||||
# include <mmsystem.h>
|
||||
# else
|
||||
# if (ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_PELLESC)
|
||||
ACC_EXTERN_C __declspec(dllimport) unsigned long __stdcall timeGetTime(void);
|
||||
# else
|
||||
ACC_EXTERN_C unsigned long __stdcall timeGetTime(void);
|
||||
# endif
|
||||
# endif
|
||||
# if (ACC_CC_DMC)
|
||||
# pragma DMC includelib "winmm.lib"
|
||||
# elif (ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_PELLESC)
|
||||
# pragma comment(lib, "winmm.lib")
|
||||
# elif (ACC_CC_MWERKS && (__MWERKS__ >= 0x3000))
|
||||
# pragma comment(lib, "winmm.lib")
|
||||
# elif (ACC_CC_SYMANTECC)
|
||||
# pragma SC includelib "winmm.lib"
|
||||
# elif (ACC_CC_WATCOMC && (__WATCOMC__ >= 1050))
|
||||
# pragma library("winmm.lib")
|
||||
# endif
|
||||
# endif
|
||||
#elif (ACC_OS_EMX) && (ACC_HAVE_WINDOWS_H) && defined(acc_int64l_t)
|
||||
# define __ACCLIB_UCLOCK_USE_QPC 1
|
||||
#elif (ACC_OS_CYGWIN || ACC_OS_DOS32 || ACC_OS_EMX || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_TOS || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
# define __ACCLIB_UCLOCK_USE_CLOCK 1
|
||||
#endif
|
||||
|
||||
#if (__ACCLIB_UCLOCK_USE_CLOCK) && !defined(CLOCKS_PER_SEC)
|
||||
# if defined(CLK_TCK)
|
||||
# define CLOCKS_PER_SEC CLK_TCK
|
||||
# else
|
||||
# undef __ACCLIB_UCLOCK_USE_CLOCK
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
//
|
||||
**************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_uclock_open) (acc_uclock_handle_p h)
|
||||
{
|
||||
acc_uclock_t c;
|
||||
int i;
|
||||
|
||||
#if (__ACCLIB_UCLOCK_USE_QPC)
|
||||
LARGE_INTEGER li;
|
||||
h->qpf = 0.0;
|
||||
if (QueryPerformanceFrequency(&li) != 0) {
|
||||
h->qpf = (double) li.QuadPart;
|
||||
if (h->qpf <= 0.0 || QueryPerformanceCounter(&li) == 0) {
|
||||
h->qpf = 0.0;
|
||||
}
|
||||
}
|
||||
#elif (ACC_HAVE_WINDOWS_H) && defined(acc_int64l_t)
|
||||
h->qpf = 0.0;
|
||||
#endif
|
||||
h->h = 1;
|
||||
h->mode = 0;
|
||||
|
||||
/* warm up */
|
||||
i = 100;
|
||||
do {
|
||||
acc_uclock_read(h, &c);
|
||||
#if (__ACCLIB_UCLOCK_USE_QPC)
|
||||
if (h->qpf > 0.0 && c.qpc == 0) { h->qpf = 0.0; i = 100; }
|
||||
#endif
|
||||
} while (--i > 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ACCLIB_PUBLIC(int, acc_uclock_close) (acc_uclock_handle_p h)
|
||||
{
|
||||
h->h = 0;
|
||||
h->mode = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
//
|
||||
**************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(void, acc_uclock_read) (acc_uclock_handle_p h, acc_uclock_p c)
|
||||
{
|
||||
#if (__ACCLIB_UCLOCK_USE_QPC)
|
||||
if (h->qpf > 0.0) {
|
||||
LARGE_INTEGER li;
|
||||
if (QueryPerformanceCounter(&li) != 0) {
|
||||
c->qpc = (acc_int64l_t) li.QuadPart;
|
||||
if (c->qpc > 0)
|
||||
return;
|
||||
}
|
||||
c->qpc = 0; /* failed */
|
||||
}
|
||||
#elif (ACC_HAVE_WINDOWS_H) && defined(acc_int64l_t)
|
||||
/* c->qpc = 0; */
|
||||
#endif
|
||||
|
||||
{
|
||||
#if (ACC_OS_DOS16 || ACC_OS_WIN16)
|
||||
# if (ACC_CC_AZTECC)
|
||||
c->ticks.t32 = 0;
|
||||
# else
|
||||
union REGS ri, ro;
|
||||
ri.x.ax = 0x2c00; int86(0x21, &ri, &ro);
|
||||
c->ticks.t32 = ro.h.ch*60UL*60UL*100UL + ro.h.cl*60UL*100UL + ro.h.dh*100UL + ro.h.dl;
|
||||
# endif
|
||||
#elif (ACC_OS_DOS32 && ACC_CC_GNUC) && defined(__DJGPP__)
|
||||
c->ticks.t64 = uclock();
|
||||
#elif (__ACCLIB_UCLOCK_USE_CLOCK) && defined(acc_int64l_t)
|
||||
c->ticks.t64 = clock();
|
||||
#elif (__ACCLIB_UCLOCK_USE_CLOCK)
|
||||
c->ticks.t32 = clock();
|
||||
#elif (__ACCLIB_UCLOCK_USE_WINMM)
|
||||
c->ticks.t32 = timeGetTime();
|
||||
#elif (__ACCLIB_UCLOCK_USE_GETRUSAGE)
|
||||
struct rusage ru;
|
||||
if (getrusage(RUSAGE_SELF, &ru) != 0) c->ticks.rd = 0;
|
||||
else c->ticks.td = ru.ru_utime.tv_sec + ru.ru_utime.tv_usec / 1000000.0;
|
||||
#elif (HAVE_GETTIMEOFDAY)
|
||||
struct timeval tv;
|
||||
if (gettimeofday(&tv, 0) != 0) c->ticks.td = 0;
|
||||
else c->ticks.td = tv.tv_sec + tv.tv_usec / 1000000.0;
|
||||
#else
|
||||
ACC_UNUSED(c);
|
||||
#endif
|
||||
}
|
||||
ACC_UNUSED(h);
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
//
|
||||
**************************************************************************/
|
||||
|
||||
ACCLIB_PUBLIC(double, acc_uclock_get_elapsed) (acc_uclock_handle_p h, const acc_uclock_p start, const acc_uclock_p stop)
|
||||
{
|
||||
double d;
|
||||
|
||||
if (!h->h) {
|
||||
h->mode = -1;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
#if (__ACCLIB_UCLOCK_USE_QPC)
|
||||
if (h->qpf > 0.0) {
|
||||
h->mode = 1;
|
||||
if (start->qpc == 0 || stop->qpc == 0) return 0.0;
|
||||
return (double) (stop->qpc - start->qpc) / h->qpf;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (ACC_OS_DOS16 || ACC_OS_WIN16)
|
||||
h->mode = 2;
|
||||
d = (double) (stop->ticks.t32 - start->ticks.t32) / 100.0;
|
||||
if (d < 0.0) d += 86400.0; /* midnight passed */
|
||||
#elif (ACC_OS_DOS32 && ACC_CC_GNUC) && defined(__DJGPP__)
|
||||
h->mode = 3;
|
||||
d = (double) (stop->ticks.t64 - start->ticks.t64) / (UCLOCKS_PER_SEC);
|
||||
#elif (__ACCLIB_UCLOCK_USE_CLOCK) && defined(acc_int64l_t)
|
||||
h->mode = 4;
|
||||
d = (double) (stop->ticks.t64 - start->ticks.t64) / (CLOCKS_PER_SEC);
|
||||
#elif (__ACCLIB_UCLOCK_USE_CLOCK)
|
||||
h->mode = 5;
|
||||
d = (double) (stop->ticks.t32 - start->ticks.t32) / (CLOCKS_PER_SEC);
|
||||
#elif (__ACCLIB_UCLOCK_USE_WINMM)
|
||||
h->mode = 6;
|
||||
d = (double) (stop->ticks.t32 - start->ticks.t32) / 1000.0;
|
||||
#elif (__ACCLIB_UCLOCK_USE_GETRUSAGE)
|
||||
h->mode = 7;
|
||||
d = stop->ticks.td - start->ticks.td;
|
||||
#elif (HAVE_GETTIMEOFDAY)
|
||||
h->mode = 8;
|
||||
d = stop->ticks.td - start->ticks.td;
|
||||
#else
|
||||
h->mode = 0;
|
||||
d = 0.0;
|
||||
#endif
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
72
tools/ucl/acc/acclib/wildargv.ch
Normal file
72
tools/ucl/acc/acclib/wildargv.ch
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "ACC_LICENSE"
|
||||
for details.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/
|
||||
*/
|
||||
|
||||
|
||||
#define __ACCLIB_WILDARGV_CH_INCLUDED 1
|
||||
#if !defined(ACCLIB_PUBLIC)
|
||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
//
|
||||
**************************************************************************/
|
||||
|
||||
#if (ACC_OS_DOS16 || ACC_OS216 || ACC_OS_WIN16)
|
||||
#if 0 && (ACC_CC_MSC)
|
||||
|
||||
/* FIXME */
|
||||
ACC_EXTERN_C int __acc_cdecl __setargv(void);
|
||||
ACC_EXTERN_C int __acc_cdecl _setargv(void);
|
||||
ACC_EXTERN_C int __acc_cdecl _setargv(void) { return __setargv(); }
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if (ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
#if (ACC_CC_INTELC || ACC_CC_MSC)
|
||||
|
||||
ACC_EXTERN_C int __acc_cdecl __setargv(void);
|
||||
ACC_EXTERN_C int __acc_cdecl _setargv(void);
|
||||
ACC_EXTERN_C int __acc_cdecl _setargv(void) { return __setargv(); }
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if (ACC_OS_EMX)
|
||||
|
||||
#define __ACCLIB_HAVE_ACC_WILDARGV 1
|
||||
ACCLIB_PUBLIC(void, acc_wildargv) (int* argc, char*** argv)
|
||||
{
|
||||
_response(argc, argv);
|
||||
_wildcard(argc, argv);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(__ACCLIB_HAVE_ACC_WILDARGV)
|
||||
#define __ACCLIB_HAVE_ACC_WILDARGV 1
|
||||
ACCLIB_PUBLIC(void, acc_wildargv) (int* argc, char*** argv)
|
||||
{
|
||||
ACC_UNUSED(argc); ACC_UNUSED(argv);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
/* ucl.h -- prototypes for the UCL real-time data compression library
|
||||
/* ucl.h -- prototypes for the UCL data compression library
|
||||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
||||
|
|
@ -32,10 +34,10 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef __UCL_H
|
||||
#define __UCL_H
|
||||
#ifndef __UCL_H_INCLUDED
|
||||
#define __UCL_H_INCLUDED
|
||||
|
||||
#ifndef __UCLCONF_H
|
||||
#ifndef __UCLCONF_H_INCLUDED
|
||||
#include <ucl/uclconf.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -45,11 +47,13 @@ extern "C" {
|
|||
|
||||
|
||||
/***********************************************************************
|
||||
// Compression fine-tuning configuration.
|
||||
//
|
||||
// Pass a NULL pointer to the compression functions for default values.
|
||||
// Otherwise set all values to -1 [i.e. initialize the struct by a
|
||||
// `memset(x,0xff,sizeof(x))'] and then set the required values.
|
||||
************************************************************************/
|
||||
|
||||
/* note: to use default values pass -1, i.e. initialize
|
||||
* this struct by a memset(x,0xff,sizeof(x)) */
|
||||
struct ucl_compress_config_t
|
||||
{
|
||||
int bb_endian;
|
||||
|
|
@ -68,6 +72,9 @@ struct ucl_compress_config_t
|
|||
|
||||
/***********************************************************************
|
||||
// compressors
|
||||
//
|
||||
// Pass NULL for `cb' (no progress callback), `conf' (default compression
|
||||
// configuration) and `result' (no statistical result).
|
||||
************************************************************************/
|
||||
|
||||
UCL_EXTERN(int)
|
||||
|
|
@ -97,6 +104,11 @@ ucl_nrv2e_99_compress ( const ucl_bytep src, ucl_uint src_len,
|
|||
|
||||
/***********************************************************************
|
||||
// decompressors
|
||||
//
|
||||
// Always pass NULL for `wrkmem'. This parameter is for symetry
|
||||
// with my other compression libaries and is not used in UCL -
|
||||
// UCL does not need any additional memory (or even local stack space)
|
||||
// for decompression.
|
||||
************************************************************************/
|
||||
|
||||
UCL_EXTERN(int)
|
||||
|
|
@ -184,7 +196,9 @@ ucl_nrv2e_decompress_safe_le32 ( const ucl_bytep src, ucl_uint src_len,
|
|||
// test an overlapping in-place decompression within a buffer:
|
||||
// - try a virtual decompression from &buf[src_off] -> &buf[0]
|
||||
// - no data is actually written
|
||||
// - only the bytes at buf[src_off .. src_off+src_len] will get accessed
|
||||
// - only the bytes at buf[src_off..src_off+src_len-1] will get accessed
|
||||
//
|
||||
// NOTE: always pass NULL for `wrkmem' - see above.
|
||||
************************************************************************/
|
||||
|
||||
UCL_EXTERN(int)
|
||||
|
|
|
|||
320
tools/ucl/include/ucl/ucl_asm.h
Normal file
320
tools/ucl/include/ucl/ucl_asm.h
Normal file
|
|
@ -0,0 +1,320 @@
|
|||
/* ucl_asm.h -- assembler prototypes for the UCL data compression library
|
||||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library 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.
|
||||
|
||||
The UCL 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the UCL library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/ucl/
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __UCL_ASM_H_INCLUDED
|
||||
#define __UCL_ASM_H_INCLUDED
|
||||
|
||||
#ifndef __UCLCONF_H_INCLUDED
|
||||
#include <ucl/uclconf.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// NRV2B assembly decompressors
|
||||
************************************************************************/
|
||||
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_safe_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_fast_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_fast_safe_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_small_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_small_safe_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
|
||||
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_safe_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_fast_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_fast_safe_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_small_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_small_safe_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
|
||||
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_safe_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_fast_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_fast_safe_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_small_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2b_decompress_asm_small_safe_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// NRV2D assembly decompressors
|
||||
************************************************************************/
|
||||
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_safe_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_fast_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_fast_safe_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_small_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_small_safe_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
|
||||
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_safe_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_fast_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_fast_safe_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_small_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_small_safe_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
|
||||
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_safe_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_fast_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_fast_safe_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_small_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2d_decompress_asm_small_safe_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// NRV2E assembly decompressors
|
||||
************************************************************************/
|
||||
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_safe_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_fast_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_fast_safe_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_small_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_small_safe_8
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
|
||||
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_safe_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_fast_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_fast_safe_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_small_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_small_safe_le16
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
|
||||
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_safe_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_fast_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_fast_safe_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_small_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
UCL_EXTERN(int) ucl_nrv2e_decompress_asm_small_safe_le32
|
||||
(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// checksum and misc functions
|
||||
************************************************************************/
|
||||
|
||||
UCL_EXTERN(ucl_uint32)
|
||||
ucl_crc32_asm(ucl_uint32 _c, const ucl_bytep _buf, ucl_uint _len,
|
||||
const ucl_uint32p _crc_table);
|
||||
|
||||
UCL_EXTERN(ucl_uint32)
|
||||
ucl_crc32_asm_small(ucl_uint32 _c, const ucl_bytep _buf, ucl_uint _len);
|
||||
|
||||
UCL_EXTERN(int)
|
||||
ucl_cpuid_asm(ucl_uint32p /* ucl_uint32 info[16] */ );
|
||||
|
||||
UCL_EXTERN(unsigned)
|
||||
ucl_rdtsc_asm(ucl_uint32p /* ucl_uint32 ticks[2] */ );
|
||||
UCL_EXTERN(unsigned)
|
||||
ucl_rdtsc_add_asm(ucl_uint32p /* ucl_uint32 ticks[2] */ );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
/* uclconf.h -- configuration for the UCL real-time data compression library
|
||||
/* uclconf.h -- configuration for the UCL data compression library
|
||||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
||||
|
|
@ -32,12 +34,12 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef __UCLCONF_H
|
||||
#define __UCLCONF_H
|
||||
#ifndef __UCLCONF_H_INCLUDED
|
||||
#define __UCLCONF_H_INCLUDED
|
||||
|
||||
#define UCL_VERSION 0x010100L
|
||||
#define UCL_VERSION_STRING "1.01"
|
||||
#define UCL_VERSION_DATE "Jan 02 2002"
|
||||
#define UCL_VERSION 0x010300L
|
||||
#define UCL_VERSION_STRING "1.03"
|
||||
#define UCL_VERSION_DATE "Jul 20 2004"
|
||||
|
||||
/* internal Autoconf configuration file - only used when building UCL */
|
||||
#if defined(UCL_HAVE_CONFIG_H)
|
||||
|
|
@ -65,13 +67,14 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/* workaround a compiler bug under hpux 10.20 */
|
||||
#define UCL_0xffffL 65535ul
|
||||
#define UCL_0xffffffffL 4294967295ul
|
||||
|
||||
#if !defined(UCL_UINT32_C)
|
||||
# if (UINT_MAX < UCL_0xffffffffL)
|
||||
# define UCL_UINT32_C(c) c ## UL
|
||||
# else
|
||||
# define UCL_UINT32_C(c) c ## U
|
||||
# define UCL_UINT32_C(c) ((c) + 0U)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
@ -80,66 +83,103 @@ extern "C" {
|
|||
// architecture defines
|
||||
************************************************************************/
|
||||
|
||||
#if !defined(__UCL_WIN) && !defined(__UCL_DOS) && !defined(__UCL_OS2)
|
||||
# if defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows)
|
||||
# define __UCL_WIN
|
||||
# elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
|
||||
# define __UCL_WIN
|
||||
# elif defined(__NT__) || defined(__NT_DLL__) || defined(__WINDOWS_386__)
|
||||
# define __UCL_WIN
|
||||
# elif defined(__DOS__) || defined(__MSDOS__) || defined(MSDOS)
|
||||
# define __UCL_DOS
|
||||
# elif defined(__OS2__) || defined(__OS2V2__) || defined(OS2)
|
||||
# define __UCL_OS2
|
||||
# elif defined(__palmos__)
|
||||
# define __UCL_PALMOS
|
||||
# elif defined(__TOS__) || defined(__atarist__)
|
||||
# define __UCL_TOS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (UINT_MAX < UCL_0xffffffffL)
|
||||
# if defined(__UCL_WIN)
|
||||
# define __UCL_WIN16
|
||||
# elif defined(__UCL_DOS)
|
||||
# define __UCL_DOS16
|
||||
# elif defined(__UCL_PALMOS)
|
||||
# define __UCL_PALMOS16
|
||||
# elif defined(__UCL_TOS)
|
||||
# define __UCL_TOS16
|
||||
# elif defined(__C166__)
|
||||
#if (defined(__CYGWIN__) || defined(__CYGWIN32__)) && defined(__GNUC__)
|
||||
# define UCL_OS_CYGWIN 1
|
||||
#elif defined(__EMX__) && defined(__GNUC__)
|
||||
# define UCL_OS_EMX 1
|
||||
#elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460)
|
||||
# define UCL_OS_DOS32 1
|
||||
#elif defined(__BORLANDC__) && defined(__DPMI16__)
|
||||
# define UCL_OS_DOS16 1
|
||||
#elif defined(__ZTC__) && defined(DOS386)
|
||||
# define UCL_OS_DOS32 1
|
||||
#elif defined(__OS2__) || defined(__OS2V2__)
|
||||
# if (UINT_MAX == UCL_0xffffL)
|
||||
# define UCL_OS_OS216 1
|
||||
# elif (UINT_MAX == UCL_0xffffffffL)
|
||||
# define UCL_OS_OS2 1
|
||||
# else
|
||||
# error "16-bit target not supported - contact me for porting hints"
|
||||
# error "check your limits.h header"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(__UCL_i386)
|
||||
# if defined(__UCL_DOS) || defined(__UCL_WIN16)
|
||||
# define __UCL_i386
|
||||
# elif defined(__i386__) || defined(__386__) || defined(_M_IX86)
|
||||
# define __UCL_i386
|
||||
#elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64)
|
||||
# define UCL_OS_WIN64 1
|
||||
#elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__)
|
||||
# define UCL_OS_WIN32 1
|
||||
#elif defined(__MWERKS__) && defined(__INTEL__)
|
||||
# define UCL_OS_WIN32 1
|
||||
#elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows)
|
||||
# if (UINT_MAX == UCL_0xffffL)
|
||||
# define UCL_OS_WIN16 1
|
||||
# elif (UINT_MAX == UCL_0xffffffffL)
|
||||
# define UCL_OS_WIN32 1
|
||||
# else
|
||||
# error "check your limits.h header"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__UCL_STRICT_16BIT)
|
||||
# if (UINT_MAX < UCL_0xffffffffL)
|
||||
# include <ucl/ucl16bit.h>
|
||||
#elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS))
|
||||
# if (UINT_MAX == UCL_0xffffL)
|
||||
# define UCL_OS_DOS16 1
|
||||
# elif (UINT_MAX == UCL_0xffffffffL)
|
||||
# define UCL_OS_DOS32 1
|
||||
# else
|
||||
# error "check your limits.h header"
|
||||
# endif
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(__NT__) && (UINT_MAX == UCL_0xffffL)
|
||||
/* wcl: NT host defaults to DOS target */
|
||||
# define UCL_OS_DOS16 1
|
||||
# elif defined(__NT__) && (__WATCOMC__ < 1100)
|
||||
/* wcl386: Watcom C 11 defines _WIN32 */
|
||||
# define UCL_OS_WIN32 1
|
||||
# else
|
||||
# error "please specify a target using the -bt compiler option"
|
||||
# endif
|
||||
#elif defined(__palmos__)
|
||||
# if (UINT_MAX == UCL_0xffffL)
|
||||
# define UCL_OS_PALMOS 1
|
||||
# else
|
||||
# error "check your limits.h header"
|
||||
# endif
|
||||
#elif defined(__TOS__) || defined(__atarist__)
|
||||
# define UCL_OS_TOS 1
|
||||
#elif defined(macintosh)
|
||||
# define UCL_OS_MACCLASSIC 1
|
||||
#elif defined(__VMS)
|
||||
# define UCL_OS_VMS 1
|
||||
#else
|
||||
# define UCL_OS_POSIX 1
|
||||
#endif
|
||||
|
||||
/* memory checkers */
|
||||
#if !defined(__UCL_CHECKER)
|
||||
# if defined(__BOUNDS_CHECKING_ON)
|
||||
# define __UCL_CHECKER
|
||||
# define __UCL_CHECKER 1
|
||||
# elif defined(__CHECKER__)
|
||||
# define __UCL_CHECKER
|
||||
# define __UCL_CHECKER 1
|
||||
# elif defined(__INSURE__)
|
||||
# define __UCL_CHECKER
|
||||
# define __UCL_CHECKER 1
|
||||
# elif defined(__PURIFY__)
|
||||
# define __UCL_CHECKER
|
||||
# define __UCL_CHECKER 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* fix ancient compiler versions */
|
||||
#if (UINT_MAX == UCL_0xffffL)
|
||||
#if (defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410)) || (defined(MSDOS) && defined(_MSC_VER) && (_MSC_VER < 700))
|
||||
# if !defined(__cdecl)
|
||||
# define __cdecl cdecl
|
||||
# endif
|
||||
# if !defined(__far)
|
||||
# define __far far
|
||||
# endif
|
||||
# if !defined(__huge)
|
||||
# define __huge huge
|
||||
# endif
|
||||
# if !defined(__near)
|
||||
# define __near near
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// integral and pointer types
|
||||
|
|
@ -187,18 +227,16 @@ extern "C" {
|
|||
#if !defined(__UCL_MMODEL)
|
||||
# if (UCL_UINT_MAX <= UINT_MAX)
|
||||
# define __UCL_MMODEL
|
||||
# elif defined(__UCL_DOS16) || defined(__UCL_WIN16)
|
||||
# elif defined(UCL_OS_DOS16) || defined(UCL_OS_OS216) || defined(UCL_OS_WIN16)
|
||||
# define __UCL_MMODEL_HUGE 1
|
||||
# define __UCL_MMODEL __huge
|
||||
# define UCL_999_UNSUPPORTED
|
||||
# elif defined(__UCL_PALMOS16) || defined(__UCL_TOS16)
|
||||
# define __UCL_MMODEL
|
||||
# define ucl_uintptr_t unsigned long
|
||||
# else
|
||||
# error "__UCL_MMODEL"
|
||||
# define __UCL_MMODEL
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* no typedef here because of const-pointer issues */
|
||||
#define ucl_byte unsigned char __UCL_MMODEL
|
||||
#define ucl_bytep unsigned char __UCL_MMODEL *
|
||||
#define ucl_charp char __UCL_MMODEL *
|
||||
#define ucl_voidp void __UCL_MMODEL *
|
||||
|
|
@ -210,6 +248,8 @@ extern "C" {
|
|||
#define ucl_intp ucl_int __UCL_MMODEL *
|
||||
#define ucl_voidpp ucl_voidp __UCL_MMODEL *
|
||||
#define ucl_bytepp ucl_bytep __UCL_MMODEL *
|
||||
/* deprecated - use `ucl_bytep' instead of `ucl_byte *' */
|
||||
#define ucl_byte unsigned char __UCL_MMODEL
|
||||
|
||||
typedef int ucl_bool;
|
||||
|
||||
|
|
@ -218,7 +258,7 @@ typedef int ucl_bool;
|
|||
// function types
|
||||
************************************************************************/
|
||||
|
||||
/* linkage */
|
||||
/* name mangling */
|
||||
#if !defined(__UCL_EXTERN_C)
|
||||
# ifdef __cplusplus
|
||||
# define __UCL_EXTERN_C extern "C"
|
||||
|
|
@ -227,21 +267,18 @@ typedef int ucl_bool;
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/* calling conventions */
|
||||
/* calling convention */
|
||||
#if !defined(__UCL_CDECL)
|
||||
# if defined(__UCL_DOS16) || defined(__UCL_WIN16)
|
||||
# if defined(__GNUC__) || defined(__HIGHC__) || defined(__NDPC__)
|
||||
# define __UCL_CDECL
|
||||
# elif defined(UCL_OS_DOS16) || defined(UCL_OS_OS216) || defined(UCL_OS_WIN16)
|
||||
# define __UCL_CDECL __far __cdecl
|
||||
# elif defined(__UCL_i386) && defined(_MSC_VER)
|
||||
# elif defined(UCL_OS_DOS32) || defined(UCL_OS_OS2) || defined(UCL_OS_WIN32) || defined(UCL_OS_WIN64)
|
||||
# define __UCL_CDECL __cdecl
|
||||
# elif defined(__UCL_i386) && defined(__WATCOMC__)
|
||||
# define __UCL_CDECL __near __cdecl
|
||||
# else
|
||||
# define __UCL_CDECL
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(__UCL_ENTRY)
|
||||
# define __UCL_ENTRY __UCL_CDECL
|
||||
#endif
|
||||
|
||||
/* DLL export information */
|
||||
#if !defined(__UCL_EXPORT1)
|
||||
|
|
@ -251,24 +288,15 @@ typedef int ucl_bool;
|
|||
# define __UCL_EXPORT2
|
||||
#endif
|
||||
|
||||
/* calling convention for C functions */
|
||||
/* __cdecl calling convention for public C and assembly functions */
|
||||
#if !defined(UCL_PUBLIC)
|
||||
# define UCL_PUBLIC(_rettype) __UCL_EXPORT1 _rettype __UCL_EXPORT2 __UCL_ENTRY
|
||||
# define UCL_PUBLIC(_rettype) __UCL_EXPORT1 _rettype __UCL_EXPORT2 __UCL_CDECL
|
||||
#endif
|
||||
#if !defined(UCL_EXTERN)
|
||||
# define UCL_EXTERN(_rettype) __UCL_EXTERN_C UCL_PUBLIC(_rettype)
|
||||
#endif
|
||||
#if !defined(UCL_PRIVATE)
|
||||
# define UCL_PRIVATE(_rettype) static _rettype __UCL_ENTRY
|
||||
#endif
|
||||
|
||||
/* cdecl calling convention for assembler functions */
|
||||
#if !defined(UCL_PUBLIC_CDECL)
|
||||
# define UCL_PUBLIC_CDECL(_rettype) \
|
||||
__UCL_EXPORT1 _rettype __UCL_EXPORT2 __UCL_CDECL
|
||||
#endif
|
||||
#if !defined(UCL_EXTERN_CDECL)
|
||||
# define UCL_EXTERN_CDECL(_rettype) __UCL_EXTERN_C UCL_PUBLIC_CDECL(_rettype)
|
||||
# define UCL_PRIVATE(_rettype) static _rettype __UCL_CDECL
|
||||
#endif
|
||||
|
||||
/* C++ exception specification for extern "C" function types */
|
||||
|
|
@ -279,39 +307,38 @@ typedef int ucl_bool;
|
|||
# define UCL_NOTHROW
|
||||
#endif
|
||||
|
||||
|
||||
/* function types */
|
||||
typedef int
|
||||
(__UCL_ENTRY *ucl_compress_t) ( const ucl_bytep src, ucl_uint src_len,
|
||||
(__UCL_CDECL *ucl_compress_t) ( const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem );
|
||||
|
||||
typedef int
|
||||
(__UCL_ENTRY *ucl_decompress_t) ( const ucl_bytep src, ucl_uint src_len,
|
||||
(__UCL_CDECL *ucl_decompress_t) ( const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem );
|
||||
|
||||
typedef int
|
||||
(__UCL_ENTRY *ucl_optimize_t) ( ucl_bytep src, ucl_uint src_len,
|
||||
(__UCL_CDECL *ucl_optimize_t) ( ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem );
|
||||
|
||||
typedef int
|
||||
(__UCL_ENTRY *ucl_compress_dict_t)(const ucl_bytep src, ucl_uint src_len,
|
||||
(__UCL_CDECL *ucl_compress_dict_t)(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem,
|
||||
const ucl_bytep dict, ucl_uint dict_len );
|
||||
|
||||
typedef int
|
||||
(__UCL_ENTRY *ucl_decompress_dict_t)(const ucl_bytep src, ucl_uint src_len,
|
||||
(__UCL_CDECL *ucl_decompress_dict_t)(const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem,
|
||||
const ucl_bytep dict, ucl_uint dict_len );
|
||||
|
||||
|
||||
/* a progress indicator callback function */
|
||||
typedef struct
|
||||
{
|
||||
void (__UCL_ENTRY *callback) (ucl_uint, ucl_uint, int, ucl_voidp user);
|
||||
void (__UCL_CDECL *callback) (ucl_uint, ucl_uint, int, ucl_voidp);
|
||||
ucl_voidp user;
|
||||
}
|
||||
ucl_progress_callback_t;
|
||||
|
|
@ -375,17 +402,22 @@ UCL_EXTERN(ucl_uint32)
|
|||
ucl_adler32(ucl_uint32 _adler, const ucl_bytep _buf, ucl_uint _len);
|
||||
UCL_EXTERN(ucl_uint32)
|
||||
ucl_crc32(ucl_uint32 _c, const ucl_bytep _buf, ucl_uint _len);
|
||||
UCL_EXTERN(const ucl_uint32p)
|
||||
ucl_get_crc32_table(void);
|
||||
|
||||
/* memory allocation hooks */
|
||||
typedef ucl_voidp (__UCL_CDECL *ucl_malloc_hook_t) (ucl_uint);
|
||||
typedef void (__UCL_CDECL *ucl_free_hook_t) (ucl_voidp);
|
||||
UCL_EXTERN(void)
|
||||
ucl_set_malloc_hooks(ucl_malloc_hook_t, ucl_free_hook_t);
|
||||
UCL_EXTERN(void)
|
||||
ucl_get_malloc_hooks(ucl_malloc_hook_t*, ucl_free_hook_t*);
|
||||
|
||||
/* memory allocation functions */
|
||||
UCL_EXTERN(ucl_voidp) ucl_alloc(ucl_uint _nelems, ucl_uint _size);
|
||||
UCL_EXTERN(ucl_voidp) ucl_malloc(ucl_uint _size);
|
||||
UCL_EXTERN(void) ucl_free(ucl_voidp _ptr);
|
||||
UCL_EXTERN(ucl_voidp) ucl_malloc(ucl_uint);
|
||||
UCL_EXTERN(ucl_voidp) ucl_alloc(ucl_uint, ucl_uint);
|
||||
UCL_EXTERN(void) ucl_free(ucl_voidp);
|
||||
|
||||
typedef ucl_voidp (__UCL_ENTRY *ucl_alloc_hook_t) (ucl_uint, ucl_uint);
|
||||
typedef void (__UCL_ENTRY *ucl_free_hook_t) (ucl_voidp);
|
||||
|
||||
extern ucl_alloc_hook_t ucl_alloc_hook;
|
||||
extern ucl_free_hook_t ucl_free_hook;
|
||||
|
||||
/* misc. */
|
||||
UCL_EXTERN(ucl_bool) ucl_assert(int _expr);
|
||||
|
|
|
|||
|
|
@ -1,71 +0,0 @@
|
|||
/* uclutil.h -- utilities for the UCL real-time data compression library
|
||||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library 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.
|
||||
|
||||
The UCL 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the UCL library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/ucl/
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __UCLUTIL_H
|
||||
#define __UCLUTIL_H
|
||||
|
||||
#ifndef __UCLCONF_H
|
||||
#include <ucl/uclconf.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
UCL_EXTERN(ucl_uint)
|
||||
ucl_fread(FILE *f, ucl_voidp buf, ucl_uint size);
|
||||
UCL_EXTERN(ucl_uint)
|
||||
ucl_fwrite(FILE *f, const ucl_voidp buf, ucl_uint size);
|
||||
|
||||
|
||||
#if (UCL_UINT_MAX <= UINT_MAX)
|
||||
/* avoid problems with Win32 DLLs */
|
||||
# define ucl_fread(f,b,s) (fread(b,1,s,f))
|
||||
# define ucl_fwrite(f,b,s) (fwrite(b,1,s,f))
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/* lutil.h -- utilities
|
||||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library 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.
|
||||
|
||||
The UCL 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the UCL library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#if !defined(NO_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#if defined(HAVE_UNISTD_H) || defined(__DJGPP__) || defined(__EMX__)
|
||||
# include <unistd.h>
|
||||
#elif defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(__MINGW32__)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#if defined(HAVE_STAT)
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include <ucl/uclconf.h>
|
||||
#include <ucl/uclutil.h>
|
||||
|
||||
|
||||
/* some systems have a xmalloc in their C library... */
|
||||
#undef xmalloc
|
||||
#undef xfree
|
||||
#undef xread
|
||||
#undef xwrite
|
||||
#undef xputc
|
||||
#undef xgetc
|
||||
#undef xread32
|
||||
#undef xwrite32
|
||||
#define xmalloc my_xmalloc
|
||||
#define xfree my_xfree
|
||||
|
||||
|
||||
#define HEAP_ALLOC(var,size) \
|
||||
long __UCL_MMODEL var [ ((size) + (sizeof(long) - 1)) / sizeof(long) ]
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
|
||||
83
tools/ucl/portab.h
Normal file
83
tools/ucl/portab.h
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/* portab.h -- portability layer
|
||||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library 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.
|
||||
|
||||
The UCL 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the UCL library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/ucl/
|
||||
*/
|
||||
|
||||
|
||||
#include <ucl/uclconf.h>
|
||||
|
||||
#if 1
|
||||
|
||||
#include "portab_a.h"
|
||||
|
||||
#else
|
||||
|
||||
/* INFO:
|
||||
* The "portab_a.h" version above uses the ACC library to add
|
||||
* support for ancient systems (like 16-bit DOS) and to provide
|
||||
* some gimmicks like win32 high-resolution timers.
|
||||
* Still, on any halfway modern machine you can also use the
|
||||
* following pure ANSI-C code instead.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
|
||||
#define __acc_cdecl_main
|
||||
#define ACC_UNUSED(var) ((void) &var)
|
||||
|
||||
#if defined(WANT_UCL_MALLOC)
|
||||
# define ucl_malloc(a) (malloc(a))
|
||||
# define ucl_free(a) (free(a))
|
||||
#endif
|
||||
#if defined(WANT_UCL_FREAD)
|
||||
# define ucl_fread(f,b,s) (fread(b,1,s,f))
|
||||
# define ucl_fwrite(f,b,s) (fwrite(b,1,s,f))
|
||||
#endif
|
||||
#if defined(WANT_UCL_UCLOCK)
|
||||
# define ucl_uclock_handle_t int
|
||||
# define ucl_uclock_t double
|
||||
# define ucl_uclock_open(a) ((void)(a))
|
||||
# define ucl_uclock_close(a) ((void)(a))
|
||||
# define ucl_uclock_read(a,b) *(b) = (clock() / (double)(CLOCKS_PER_SEC))
|
||||
# define ucl_uclock_get_elapsed(a,b,c) (*(c) - *(b))
|
||||
#endif
|
||||
#if defined(WANT_UCL_WILDARGV)
|
||||
# define ucl_wildargv(a,b) ((void)0)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
|
||||
141
tools/ucl/portab_a.h
Normal file
141
tools/ucl/portab_a.h
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
/* portab_a.h -- advanced portability layer
|
||||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library 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.
|
||||
|
||||
The UCL 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the UCL library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/ucl/
|
||||
*/
|
||||
|
||||
|
||||
#include <ucl/uclconf.h>
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// use the ACC library for the hard work
|
||||
**************************************************************************/
|
||||
|
||||
#if defined(UCL_HAVE_CONFIG_H)
|
||||
# define ACC_CONFIG_NO_HEADER 1
|
||||
#endif
|
||||
#include "acc/acc.h"
|
||||
|
||||
#if (ACC_CC_MSC && (_MSC_VER >= 1000 && _MSC_VER < 1200))
|
||||
/* avoid `-W4' warnings in system header files */
|
||||
# pragma warning(disable: 4201 4214 4514)
|
||||
#endif
|
||||
#if (ACC_CC_MSC && (_MSC_VER >= 1300))
|
||||
/* avoid `-Wall' warnings in system header files */
|
||||
# pragma warning(disable: 4163 4255 4820)
|
||||
/* avoid warnings about inlining */
|
||||
# pragma warning(disable: 4710 4711)
|
||||
#endif
|
||||
#if (ACC_CC_MSC && (_MSC_VER >= 1400))
|
||||
/* avoid warnings when using "deprecated" POSIX functions */
|
||||
# pragma warning(disable: 4996)
|
||||
#endif
|
||||
|
||||
#include "acc/acc_incd.h"
|
||||
#include "acc/acc_ince.h"
|
||||
#if defined(__UCL_MMODEL_HUGE) || defined(WANT_UCL_UCLOCK) || defined(WANT_UCL_WILDARGV)
|
||||
# include "acc/acc_inci.h"
|
||||
# include "acc/acc_lib.h"
|
||||
#endif
|
||||
|
||||
#if defined(WANT_UCL_MALLOC)
|
||||
# if defined(__UCL_MMODEL_HUGE)
|
||||
# include "acc/acclib/halloc.ch"
|
||||
# else
|
||||
# define acc_halloc(a) (malloc(a))
|
||||
# define acc_hfree(a) (free(a))
|
||||
# endif
|
||||
#endif
|
||||
#if defined(WANT_UCL_FREAD)
|
||||
# if defined(__UCL_MMODEL_HUGE)
|
||||
# include "acc/acclib/hfread.ch"
|
||||
# else
|
||||
# define acc_hfread(f,b,s) (fread(b,1,s,f))
|
||||
# define acc_hfwrite(f,b,s) (fwrite(b,1,s,f))
|
||||
# endif
|
||||
#endif
|
||||
#if defined(WANT_UCL_UCLOCK)
|
||||
# include "acc/acclib/uclock.ch"
|
||||
#endif
|
||||
#if defined(WANT_UCL_WILDARGV)
|
||||
# include "acc/acclib/wildargv.ch"
|
||||
#endif
|
||||
#if (__ACCLIB_REQUIRE_HMEMCPY_CH) && !defined(__ACCLIB_HMEMCPY_CH_INCLUDED)
|
||||
# include "acc/acclib/hmemcpy.ch"
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// misc
|
||||
**************************************************************************/
|
||||
|
||||
/* turn on assertions */
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
|
||||
/* just in case */
|
||||
#undef xmalloc
|
||||
#undef xfree
|
||||
#undef xread
|
||||
#undef xwrite
|
||||
#undef xputc
|
||||
#undef xgetc
|
||||
#undef xread32
|
||||
#undef xwrite32
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// finally pull into the UCL namespace
|
||||
**************************************************************************/
|
||||
|
||||
#undef ucl_malloc
|
||||
#undef ucl_free
|
||||
#undef ucl_fread
|
||||
#undef ucl_fwrite
|
||||
#if defined(WANT_UCL_MALLOC)
|
||||
# define ucl_malloc(a) acc_halloc(a)
|
||||
# define ucl_free(a) acc_hfree(a)
|
||||
#endif
|
||||
#if defined(WANT_UCL_FREAD)
|
||||
# define ucl_fread(f,b,s) acc_hfread(f,b,s)
|
||||
# define ucl_fwrite(f,b,s) acc_hfwrite(f,b,s)
|
||||
#endif
|
||||
#if defined(WANT_UCL_UCLOCK)
|
||||
# define ucl_uclock_handle_t acc_uclock_handle_t
|
||||
# define ucl_uclock_t acc_uclock_t
|
||||
# define ucl_uclock_open(a) acc_uclock_open(a)
|
||||
# define ucl_uclock_close(a) acc_uclock_close(a)
|
||||
# define ucl_uclock_read(a,b) acc_uclock_read(a,b)
|
||||
# define ucl_uclock_get_elapsed(a,b,c) acc_uclock_get_elapsed(a,b,c)
|
||||
#endif
|
||||
#if defined(WANT_UCL_WILDARGV)
|
||||
# define ucl_wildargv(a,b) acc_wildargv(a,b)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
# \/ \/ \/ \/ \/
|
||||
#
|
||||
CFLAGS += -I../include
|
||||
CFLAGS += -I../include -I..
|
||||
|
||||
ifndef V
|
||||
SILENT = @
|
||||
|
|
@ -61,7 +61,7 @@ $(info Compiler creates $(COMPILETARGET) binaries)
|
|||
TARGET_DIR ?= $(shell pwd)/
|
||||
OBJDIR = $(TARGET_DIR)build$(RBARCH)
|
||||
|
||||
SOURCES = alloc.c io.c n2b_99.c n2b_d.c n2b_ds.c n2b_to.c n2d_99.c \
|
||||
SOURCES = alloc.c n2b_99.c n2b_d.c n2b_ds.c n2b_to.c n2d_99.c \
|
||||
n2d_d.c n2d_ds.c n2d_to.c n2e_99.c n2e_d.c n2e_ds.c n2e_to.c ucl_crc.c \
|
||||
ucl_init.c ucl_ptr.c ucl_str.c ucl_util.c #ucl_dll.c
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2003 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -28,50 +28,29 @@
|
|||
|
||||
#include "ucl_conf.h"
|
||||
|
||||
#if defined(HAVE_MALLOC_H)
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
#if defined(__palmos__)
|
||||
# include <System/MemoryMgr.h>
|
||||
#endif
|
||||
|
||||
|
||||
#undef ucl_alloc_hook
|
||||
#undef ucl_free_hook
|
||||
#undef ucl_alloc
|
||||
#undef ucl_malloc
|
||||
#undef ucl_free
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// implementation
|
||||
************************************************************************/
|
||||
|
||||
#if defined(__UCL_MMODEL_HUGE)
|
||||
|
||||
#define acc_hsize_t ucl_uint
|
||||
#define acc_hvoid_p ucl_voidp
|
||||
#define ACCLIB_PUBLIC(r,f) static r __UCL_CDECL f
|
||||
#define acc_halloc ucl_malloc_internal
|
||||
#define acc_hfree ucl_free_internal
|
||||
#include "acc/acclib/halloc.ch"
|
||||
#undef ACCLIB_PUBLIC
|
||||
|
||||
#else
|
||||
|
||||
UCL_PRIVATE(ucl_voidp)
|
||||
ucl_alloc_internal(ucl_uint nelems, ucl_uint size)
|
||||
ucl_malloc_internal(ucl_uint size)
|
||||
{
|
||||
ucl_voidp p = NULL;
|
||||
unsigned long s = (unsigned long) nelems * size;
|
||||
|
||||
if (nelems <= 0 || size <= 0 || s < nelems || s < size)
|
||||
return NULL;
|
||||
|
||||
#if defined(__palmos__)
|
||||
p = (ucl_voidp) MemPtrNew(s);
|
||||
#elif (UCL_UINT_MAX <= SIZE_T_MAX)
|
||||
if (s < SIZE_T_MAX)
|
||||
p = (ucl_voidp) malloc((size_t)s);
|
||||
#elif defined(HAVE_HALLOC) && defined(__DMC__)
|
||||
if (size < SIZE_T_MAX)
|
||||
p = (ucl_voidp) _halloc(nelems,(size_t)size);
|
||||
#elif defined(HAVE_HALLOC)
|
||||
if (size < SIZE_T_MAX)
|
||||
p = (ucl_voidp) halloc(nelems,(size_t)size);
|
||||
#else
|
||||
if (s < SIZE_T_MAX)
|
||||
p = (ucl_voidp) malloc((size_t)s);
|
||||
#endif
|
||||
|
||||
if (size < ~(ucl_uint)0)
|
||||
p = (ucl_voidp) malloc((size_t) size);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
@ -79,70 +58,65 @@ ucl_alloc_internal(ucl_uint nelems, ucl_uint size)
|
|||
UCL_PRIVATE(void)
|
||||
ucl_free_internal(ucl_voidp p)
|
||||
{
|
||||
if (!p)
|
||||
return;
|
||||
|
||||
#if defined(__palmos__)
|
||||
MemPtrFree(p);
|
||||
#elif (UCL_UINT_MAX <= SIZE_T_MAX)
|
||||
free(p);
|
||||
#elif defined(HAVE_HALLOC) && defined(__DMC__)
|
||||
_hfree(p);
|
||||
#elif defined(HAVE_HALLOC)
|
||||
hfree(p);
|
||||
#else
|
||||
free(p);
|
||||
#endif
|
||||
if (p)
|
||||
free(p);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// public interface using the global hooks
|
||||
************************************************************************/
|
||||
|
||||
/* global allocator hooks */
|
||||
ucl_alloc_hook_t ucl_alloc_hook = ucl_alloc_internal;
|
||||
ucl_free_hook_t ucl_free_hook = ucl_free_internal;
|
||||
static ucl_malloc_hook_t ucl_malloc_hook = ucl_malloc_internal;
|
||||
static ucl_free_hook_t ucl_free_hook = ucl_free_internal;
|
||||
|
||||
|
||||
UCL_PUBLIC(ucl_voidp)
|
||||
ucl_alloc(ucl_uint nelems, ucl_uint size)
|
||||
UCL_PUBLIC(void)
|
||||
ucl_set_malloc_hooks(ucl_malloc_hook_t a, ucl_free_hook_t f)
|
||||
{
|
||||
if (!ucl_alloc_hook)
|
||||
return NULL;
|
||||
ucl_malloc_hook = ucl_malloc_internal;
|
||||
ucl_free_hook = ucl_free_internal;
|
||||
if (a)
|
||||
ucl_malloc_hook = a;
|
||||
if (f)
|
||||
ucl_free_hook = f;
|
||||
}
|
||||
|
||||
return ucl_alloc_hook(nelems,size);
|
||||
UCL_PUBLIC(void)
|
||||
ucl_get_malloc_hooks(ucl_malloc_hook_t* a, ucl_free_hook_t* f)
|
||||
{
|
||||
if (a)
|
||||
*a = ucl_malloc_hook;
|
||||
if (f)
|
||||
*f = ucl_free_hook;
|
||||
}
|
||||
|
||||
|
||||
UCL_PUBLIC(ucl_voidp)
|
||||
ucl_malloc(ucl_uint size)
|
||||
{
|
||||
if (!ucl_alloc_hook)
|
||||
if (size <= 0)
|
||||
return NULL;
|
||||
return ucl_malloc_hook(size);
|
||||
}
|
||||
|
||||
#if defined(__palmos__)
|
||||
return ucl_alloc_hook(size,1);
|
||||
#elif (UCL_UINT_MAX <= SIZE_T_MAX)
|
||||
return ucl_alloc_hook(size,1);
|
||||
#elif defined(HAVE_HALLOC)
|
||||
/* use segment granularity by default */
|
||||
if (size + 15 > size) /* avoid overflow */
|
||||
return ucl_alloc_hook((size+15)/16,16);
|
||||
return ucl_alloc_hook(size,1);
|
||||
#else
|
||||
return ucl_alloc_hook(size,1);
|
||||
#endif
|
||||
UCL_PUBLIC(ucl_voidp)
|
||||
ucl_alloc(ucl_uint nelems, ucl_uint size)
|
||||
{
|
||||
ucl_uint s = nelems * size;
|
||||
if (nelems <= 0 || s / nelems != size)
|
||||
return NULL;
|
||||
return ucl_malloc(s);
|
||||
}
|
||||
|
||||
|
||||
UCL_PUBLIC(void)
|
||||
ucl_free(ucl_voidp p)
|
||||
{
|
||||
if (!ucl_free_hook)
|
||||
return;
|
||||
|
||||
ucl_free_hook(p);
|
||||
if (p)
|
||||
ucl_free_hook(p);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,81 +0,0 @@
|
|||
/* fake16.h -- fake the strict 16-bit memory model for test purposes
|
||||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library 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.
|
||||
|
||||
The UCL 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the UCL library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* NOTE:
|
||||
* this file is *only* for testing the strict 16-bit memory model
|
||||
* on a 32-bit machine. Because things like integral promotion,
|
||||
* size_t and ptrdiff_t cannot be faked this is no real substitute
|
||||
* for testing under a real 16-bit system.
|
||||
*
|
||||
* See also <ucl/ucl16bit.h>
|
||||
*
|
||||
* Usage: #include "src/fake16.h" at the top of <ucl/uclconf.h>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __UCLFAKE16BIT_H
|
||||
#define __UCLFAKE16BIT_H
|
||||
|
||||
#ifdef __UCLCONF_H
|
||||
# error "include this file before uclconf.h"
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#if (USHRT_MAX == 0xffff)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define __UCL16BIT_H /* do not use <ucl/ucl16bit.h> */
|
||||
|
||||
#define __UCL_STRICT_16BIT
|
||||
#define __UCL_FAKE_STRICT_16BIT
|
||||
|
||||
#define UCL_99_UNSUPPORTED
|
||||
#define UCL_999_UNSUPPORTED
|
||||
|
||||
typedef unsigned short ucl_uint;
|
||||
typedef short ucl_int;
|
||||
#define UCL_UINT_MAX USHRT_MAX
|
||||
#define UCL_INT_MAX SHRT_MAX
|
||||
|
||||
#if 1
|
||||
#define __UCL_NO_UNALIGNED
|
||||
#define __UCL_NO_ALIGNED
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2003 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -46,10 +46,10 @@
|
|||
(bb*=2,bb&0xffff ? (bb>>16)&1 : (ilen+=2,((bb=(src[ilen-2]+src[ilen-1]*256u)*2+1)>>16)&1))
|
||||
|
||||
|
||||
#if 1 && defined(UCL_UNALIGNED_OK_4) && (UCL_BYTE_ORDER == UCL_LITTLE_ENDIAN)
|
||||
#if 1 && (ACC_ENDIAN_LITTLE_ENDIAN) && defined(UA_GET4)
|
||||
#define getbit_le32(bb, bc, src, ilen) \
|
||||
(bc > 0 ? ((bb>>--bc)&1) : (bc=31,\
|
||||
bb=*(const ucl_uint32p)((src)+ilen),ilen+=4,(bb>>31)&1))
|
||||
bb=UA_GET4((src)+ilen),ilen+=4,(bb>>31)&1))
|
||||
#else
|
||||
#define getbit_le32(bb, bc, src, ilen) \
|
||||
(bc > 0 ? ((bb>>--bc)&1) : (bc=31,\
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
/* internal.h --
|
||||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library 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.
|
||||
|
||||
The UCL 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the UCL library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
*/
|
||||
|
||||
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the library and is subject
|
||||
to change.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __UCL_INTERNAL_H
|
||||
#define __UCL_INTERNAL_H
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
/* io.c -- io functions
|
||||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library 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.
|
||||
|
||||
The UCL 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the UCL library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/ucl/
|
||||
*/
|
||||
|
||||
|
||||
#include "ucl_conf.h"
|
||||
|
||||
#if !defined(NO_STDIO_H)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ucl/uclutil.h>
|
||||
|
||||
#undef ucl_fread
|
||||
#undef ucl_fwrite
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
UCL_PUBLIC(ucl_uint)
|
||||
ucl_fread(FILE *f, ucl_voidp s, ucl_uint len)
|
||||
{
|
||||
#if 1 && (UCL_UINT_MAX <= SIZE_T_MAX)
|
||||
return fread(s,1,len,f);
|
||||
#else
|
||||
ucl_byte *p = (ucl_byte *) s;
|
||||
ucl_uint l = 0;
|
||||
size_t k;
|
||||
unsigned char *b;
|
||||
unsigned char buf[512];
|
||||
|
||||
while (l < len)
|
||||
{
|
||||
k = len - l > sizeof(buf) ? sizeof(buf) : (size_t) (len - l);
|
||||
k = fread(buf,1,k,f);
|
||||
if (k <= 0)
|
||||
break;
|
||||
l += k;
|
||||
b = buf; do *p++ = *b++; while (--k > 0);
|
||||
}
|
||||
return l;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
UCL_PUBLIC(ucl_uint)
|
||||
ucl_fwrite(FILE *f, const ucl_voidp s, ucl_uint len)
|
||||
{
|
||||
#if 1 && (UCL_UINT_MAX <= SIZE_T_MAX)
|
||||
return fwrite(s,1,len,f);
|
||||
#else
|
||||
const ucl_byte *p = (const ucl_byte *) s;
|
||||
ucl_uint l = 0;
|
||||
size_t k, n;
|
||||
unsigned char *b;
|
||||
unsigned char buf[512];
|
||||
|
||||
while (l < len)
|
||||
{
|
||||
k = len - l > sizeof(buf) ? sizeof(buf) : (size_t) (len - l);
|
||||
b = buf; n = k; do *b++ = *p++; while (--n > 0);
|
||||
k = fwrite(buf,1,k,f);
|
||||
if (k <= 0)
|
||||
break;
|
||||
l += k;
|
||||
}
|
||||
return l;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif /* !defined(NO_STDIO_H) */
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -27,36 +27,26 @@
|
|||
|
||||
|
||||
|
||||
#include <ucl/uclconf.h>
|
||||
#include <ucl/ucl.h>
|
||||
#include "ucl_conf.h"
|
||||
|
||||
#if 0
|
||||
#undef UCL_DEBUG
|
||||
#define UCL_DEBUG
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if 0 && !defined(UCL_DEBUG)
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
#endif
|
||||
#include <ucl/ucl.h>
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
#if 0
|
||||
#define N (128*1024ul) /* size of ring buffer */
|
||||
#define SWD_USE_MALLOC 1
|
||||
#if (ACC_OS_DOS16)
|
||||
#define SWD_HMASK (s->hmask)
|
||||
#define HEAD2_VAR
|
||||
#define IF_HEAD2(s) if (s->use_head2)
|
||||
#else
|
||||
#define N (1024*1024ul) /* size of ring buffer */
|
||||
#define SWD_USE_MALLOC
|
||||
#define SWD_HSIZE 65536ul
|
||||
#define SWD_HMASK (UCL_UINT32_C(65535))
|
||||
#define IF_HEAD2(s)
|
||||
#endif
|
||||
#define THRESHOLD 1 /* lower limit for match length */
|
||||
#define F 2048 /* upper limit for match length */
|
||||
#define SWD_N (8*1024*1024ul) /* max. size of ring buffer */
|
||||
#define SWD_F 2048 /* upper limit for match length */
|
||||
#define SWD_THRESHOLD 1 /* lower limit for match length */
|
||||
|
||||
#if defined(NRV2B)
|
||||
# define UCL_COMPRESS_T ucl_nrv2b_t
|
||||
|
|
@ -78,20 +68,11 @@
|
|||
#endif
|
||||
#define ucl_swd_p ucl_swd_t * __UCL_MMODEL
|
||||
|
||||
#if 0
|
||||
# define HEAD3(b,p) \
|
||||
((((((ucl_uint32)b[p]<<3)^b[p+1])<<3)^b[p+2]) & (SWD_HSIZE-1))
|
||||
#endif
|
||||
#if 0 && defined(UCL_UNALIGNED_OK_4) && (UCL_BYTE_ORDER == UCL_LITTLE_ENDIAN)
|
||||
# define HEAD3(b,p) \
|
||||
(((* (ucl_uint32p) &b[p]) ^ ((* (ucl_uint32p) &b[p])>>10)) & (SWD_HSIZE-1))
|
||||
#endif
|
||||
|
||||
#include "ucl_mchw.ch"
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
// start-step-stop prefix coding
|
||||
************************************************************************/
|
||||
|
||||
static void code_prefix_ss11(UCL_COMPRESS_T *c, ucl_uint32 i)
|
||||
|
|
@ -232,12 +213,12 @@ code_match(UCL_COMPRESS_T *c, ucl_uint m_len, const ucl_uint m_off)
|
|||
#endif
|
||||
|
||||
c->last_m_off = m_off;
|
||||
UCL_UNUSED(m_low);
|
||||
ACC_UNUSED(m_low);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
code_run(UCL_COMPRESS_T *c, const ucl_byte *ii, ucl_uint lit)
|
||||
code_run(UCL_COMPRESS_T *c, const ucl_bytep ii, ucl_uint lit)
|
||||
{
|
||||
if (lit == 0)
|
||||
return;
|
||||
|
|
@ -376,17 +357,17 @@ ucl_nrv_99_compress ( const ucl_bytep in, ucl_uint in_len,
|
|||
const struct ucl_compress_config_p conf,
|
||||
ucl_uintp result)
|
||||
{
|
||||
const ucl_byte *ii;
|
||||
const ucl_bytep ii;
|
||||
ucl_uint lit;
|
||||
ucl_uint m_len, m_off;
|
||||
UCL_COMPRESS_T c_buffer;
|
||||
UCL_COMPRESS_T * const c = &c_buffer;
|
||||
#undef swd
|
||||
#if 1 && defined(SWD_USE_MALLOC)
|
||||
#undef s
|
||||
#if defined(SWD_USE_MALLOC)
|
||||
ucl_swd_t the_swd;
|
||||
# define swd (&the_swd)
|
||||
# define s (&the_swd)
|
||||
#else
|
||||
ucl_swd_p swd;
|
||||
ucl_swd_p s;
|
||||
#endif
|
||||
ucl_uint result_buffer[16];
|
||||
int r;
|
||||
|
|
@ -403,6 +384,7 @@ ucl_nrv_99_compress ( const ucl_bytep in, ucl_uint in_len,
|
|||
};
|
||||
const struct swd_config_t *sc;
|
||||
static const struct swd_config_t swd_config[10] = {
|
||||
#define F SWD_F
|
||||
/* faster compression */
|
||||
{ 0, 0, 0, 8, 4, 0, 48*1024L },
|
||||
{ 0, 0, 0, 16, 8, 0, 48*1024L },
|
||||
|
|
@ -413,8 +395,9 @@ ucl_nrv_99_compress ( const ucl_bytep in, ucl_uint in_len,
|
|||
{ 2, 8, 32, 128, 256, 0, 128*1024L },
|
||||
{ 2, 32, 128, F, 2048, 1, 128*1024L },
|
||||
{ 2, 32, 128, F, 2048, 1, 256*1024L },
|
||||
{ 2, F, F, F, 4096, 1, N }
|
||||
{ 2, F, F, F, 4096, 1, SWD_N }
|
||||
/* max. compression */
|
||||
#undef F
|
||||
};
|
||||
|
||||
if (level < 1 || level > 10)
|
||||
|
|
@ -422,6 +405,7 @@ ucl_nrv_99_compress ( const ucl_bytep in, ucl_uint in_len,
|
|||
sc = &swd_config[level - 1];
|
||||
|
||||
memset(c, 0, sizeof(*c));
|
||||
memset(&c->conf, 0xff, sizeof(c->conf));
|
||||
c->ip = c->in = in;
|
||||
c->in_end = in + in_len;
|
||||
c->out = out;
|
||||
|
|
@ -429,12 +413,11 @@ ucl_nrv_99_compress ( const ucl_bytep in, ucl_uint in_len,
|
|||
c->cb = cb;
|
||||
cb = NULL;
|
||||
c->result = result ? result : (ucl_uintp) result_buffer;
|
||||
memset(c->result, 0, 16*sizeof(*c->result));
|
||||
c->result[0] = c->result[2] = c->result[4] = UCL_UINT_MAX;
|
||||
result = NULL;
|
||||
memset(&c->conf, 0xff, sizeof(c->conf));
|
||||
ucl_memset(c->result, 0, 16*sizeof(*c->result));
|
||||
c->result[0] = c->result[2] = c->result[4] = UCL_UINT_MAX;
|
||||
if (conf)
|
||||
memcpy(&c->conf, conf, sizeof(c->conf));
|
||||
ucl_memcpy(&c->conf, conf, sizeof(c->conf));
|
||||
conf = NULL;
|
||||
r = bbConfig(c, 0, 8);
|
||||
if (r == 0)
|
||||
|
|
@ -446,39 +429,51 @@ ucl_nrv_99_compress ( const ucl_bytep in, ucl_uint in_len,
|
|||
ii = c->ip; /* point to start of literal run */
|
||||
lit = 0;
|
||||
|
||||
#if !defined(swd)
|
||||
swd = (ucl_swd_p) ucl_alloc(1, ucl_sizeof(*swd));
|
||||
if (!swd)
|
||||
#if !defined(s)
|
||||
s = (ucl_swd_p) ucl_malloc(ucl_sizeof(*s));
|
||||
if (!s)
|
||||
return UCL_E_OUT_OF_MEMORY;
|
||||
#endif
|
||||
swd->f = UCL_MIN(F, c->conf.max_match);
|
||||
swd->n = UCL_MIN(N, sc->max_offset);
|
||||
s->f = UCL_MIN((ucl_uint)SWD_F, c->conf.max_match);
|
||||
s->n = UCL_MIN((ucl_uint)SWD_N, sc->max_offset);
|
||||
s->hmask = UCL_UINT32_C(65535);
|
||||
#ifdef HEAD2_VAR
|
||||
s->use_head2 = 1;
|
||||
#if defined(ACC_MM_AHSHIFT)
|
||||
if (ACC_MM_AHSHIFT != 3) {
|
||||
s->hmask = 16 * 1024 - 1;
|
||||
s->use_head2 = 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if (c->conf.max_offset != UCL_UINT_MAX)
|
||||
swd->n = UCL_MIN(N, c->conf.max_offset);
|
||||
if (in_len >= 256 && in_len < swd->n)
|
||||
swd->n = in_len;
|
||||
if (swd->f < 8 || swd->n < 256)
|
||||
s->n = UCL_MIN(SWD_N, c->conf.max_offset);
|
||||
if (in_len < s->n)
|
||||
s->n = UCL_MAX(in_len, 256);
|
||||
if (s->f < 8 || s->n < 256)
|
||||
return UCL_E_INVALID_ARGUMENT;
|
||||
r = init_match(c,swd,NULL,0,sc->flags);
|
||||
r = init_match(c,s,NULL,0,sc->flags);
|
||||
if (r == UCL_E_OK && (SWD_HSIZE - 1 != s->hmask))
|
||||
r = UCL_E_ERROR;
|
||||
if (r != UCL_E_OK)
|
||||
{
|
||||
#if !defined(swd)
|
||||
ucl_free(swd);
|
||||
#if !defined(s)
|
||||
ucl_free(s);
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
if (sc->max_chain > 0)
|
||||
swd->max_chain = sc->max_chain;
|
||||
s->max_chain = sc->max_chain;
|
||||
if (sc->nice_length > 0)
|
||||
swd->nice_length = sc->nice_length;
|
||||
if (c->conf.max_match < swd->nice_length)
|
||||
swd->nice_length = c->conf.max_match;
|
||||
s->nice_length = sc->nice_length;
|
||||
if (c->conf.max_match < s->nice_length)
|
||||
s->nice_length = c->conf.max_match;
|
||||
|
||||
if (c->cb)
|
||||
(*c->cb->callback)(0,0,-1,c->cb->user);
|
||||
|
||||
c->last_m_off = 1;
|
||||
r = find_match(c,swd,0,0);
|
||||
r = find_match(c,s,0,0);
|
||||
if (r != UCL_E_OK)
|
||||
return r;
|
||||
while (c->look > 0)
|
||||
|
|
@ -487,7 +482,7 @@ ucl_nrv_99_compress ( const ucl_bytep in, ucl_uint in_len,
|
|||
ucl_uint max_ahead;
|
||||
int l1, l2;
|
||||
|
||||
c->codesize = c->bb_op - out;
|
||||
c->codesize = (ucl_uint) (c->bb_op - out);
|
||||
|
||||
m_len = c->m_len;
|
||||
m_off = c->m_off;
|
||||
|
|
@ -497,25 +492,25 @@ ucl_nrv_99_compress ( const ucl_bytep in, ucl_uint in_len,
|
|||
if (lit == 0)
|
||||
ii = c->bp;
|
||||
assert(ii + lit == c->bp);
|
||||
assert(swd->b_char == *(c->bp));
|
||||
assert(s->b_char == *(c->bp));
|
||||
|
||||
if (m_len < 2 || (m_len == 2 && (m_off > M2_MAX_OFFSET))
|
||||
|| m_off > c->conf.max_offset)
|
||||
{
|
||||
/* a literal */
|
||||
lit++;
|
||||
swd->max_chain = sc->max_chain;
|
||||
r = find_match(c,swd,1,0);
|
||||
s->max_chain = sc->max_chain;
|
||||
r = find_match(c,s,1,0);
|
||||
assert(r == 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* a match */
|
||||
#if defined(SWD_BEST_OFF)
|
||||
if (swd->use_best_off)
|
||||
better_match(swd,&m_len,&m_off);
|
||||
if (s->use_best_off)
|
||||
better_match(s,&m_len,&m_off);
|
||||
#endif
|
||||
assert_match(swd,m_len,m_off);
|
||||
assert_match(s,m_len,m_off);
|
||||
|
||||
/* shall we try a lazy match ? */
|
||||
ahead = 0;
|
||||
|
|
@ -530,16 +525,16 @@ ucl_nrv_99_compress ( const ucl_bytep in, ucl_uint in_len,
|
|||
/* yes, try a lazy match */
|
||||
l1 = len_of_coded_match(c,m_len,m_off);
|
||||
assert(l1 > 0);
|
||||
max_ahead = UCL_MIN(sc->try_lazy, m_len - 1);
|
||||
max_ahead = UCL_MIN((ucl_uint)sc->try_lazy, m_len - 1);
|
||||
}
|
||||
|
||||
while (ahead < max_ahead && c->look > m_len)
|
||||
{
|
||||
if (m_len >= sc->good_length)
|
||||
swd->max_chain = sc->max_chain >> 2;
|
||||
s->max_chain = sc->max_chain >> 2;
|
||||
else
|
||||
swd->max_chain = sc->max_chain;
|
||||
r = find_match(c,swd,1,0);
|
||||
s->max_chain = sc->max_chain;
|
||||
r = find_match(c,s,1,0);
|
||||
ahead++;
|
||||
|
||||
assert(r == 0);
|
||||
|
|
@ -549,8 +544,8 @@ ucl_nrv_99_compress ( const ucl_bytep in, ucl_uint in_len,
|
|||
if (c->m_len < 2)
|
||||
continue;
|
||||
#if defined(SWD_BEST_OFF)
|
||||
if (swd->use_best_off)
|
||||
better_match(swd,&c->m_len,&c->m_off);
|
||||
if (s->use_best_off)
|
||||
better_match(s,&c->m_len,&c->m_off);
|
||||
#endif
|
||||
l2 = len_of_coded_match(c,c->m_len,c->m_off);
|
||||
if (l2 < 0)
|
||||
|
|
@ -562,7 +557,7 @@ ucl_nrv_99_compress ( const ucl_bytep in, ucl_uint in_len,
|
|||
#endif
|
||||
{
|
||||
c->lazy++;
|
||||
assert_match(swd,c->m_len,c->m_off);
|
||||
assert_match(s,c->m_len,c->m_off);
|
||||
|
||||
#if 0
|
||||
if (l3 > 0)
|
||||
|
|
@ -591,8 +586,8 @@ ucl_nrv_99_compress ( const ucl_bytep in, ucl_uint in_len,
|
|||
|
||||
/* 2 - code match */
|
||||
code_match(c,m_len,m_off);
|
||||
swd->max_chain = sc->max_chain;
|
||||
r = find_match(c,swd,m_len,1+ahead);
|
||||
s->max_chain = sc->max_chain;
|
||||
r = find_match(c,s,m_len,1+ahead);
|
||||
assert(r == 0);
|
||||
|
||||
lazy_match_done: ;
|
||||
|
|
@ -615,8 +610,8 @@ lazy_match_done: ;
|
|||
bbFlushBits(c, 0);
|
||||
|
||||
assert(c->textsize == in_len);
|
||||
c->codesize = c->bb_op - out;
|
||||
*out_len = c->bb_op - out;
|
||||
c->codesize = (ucl_uint) (c->bb_op - out);
|
||||
*out_len = (ucl_uint) (c->bb_op - out);
|
||||
if (c->cb)
|
||||
(*c->cb->callback)(c->textsize,c->codesize,4,c->cb->user);
|
||||
|
||||
|
|
@ -628,12 +623,12 @@ lazy_match_done: ;
|
|||
#endif
|
||||
assert(c->lit_bytes + c->match_bytes == in_len);
|
||||
|
||||
swd_exit(swd);
|
||||
#if !defined(swd)
|
||||
ucl_free(swd);
|
||||
swd_exit(s);
|
||||
#if !defined(s)
|
||||
ucl_free(s);
|
||||
#endif
|
||||
return UCL_E_OK;
|
||||
#undef swd
|
||||
#undef s
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
#ifdef SAFE
|
||||
const ucl_uint oend = *dst_len;
|
||||
#endif
|
||||
UCL_UNUSED(wrkmem);
|
||||
ACC_UNUSED(wrkmem);
|
||||
|
||||
#ifdef TEST_OVERLAP
|
||||
src_len += src_off;
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
fail(olen > ilen, UCL_E_OVERLAP_OVERRUN);
|
||||
#else
|
||||
{
|
||||
const ucl_byte *m_pos;
|
||||
const ucl_bytep m_pos;
|
||||
m_pos = dst + olen - m_off;
|
||||
dst[olen++] = *m_pos++;
|
||||
do dst[olen++] = *m_pos++; while (--m_len > 0);
|
||||
|
|
@ -130,8 +130,8 @@
|
|||
|
||||
#ifndef getbit
|
||||
|
||||
#include <ucl/ucl.h>
|
||||
#include "ucl_conf.h"
|
||||
#include <ucl/ucl.h>
|
||||
#include "getbit.h"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -31,8 +31,8 @@
|
|||
// entries for the different bit-buffer sizes
|
||||
************************************************************************/
|
||||
|
||||
#include <ucl/ucl.h>
|
||||
#include "ucl_conf.h"
|
||||
#include <ucl/ucl.h>
|
||||
#include "getbit.h"
|
||||
|
||||
#define SAFE
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
#ifdef SAFE
|
||||
const ucl_uint oend = *dst_len;
|
||||
#endif
|
||||
UCL_UNUSED(wrkmem);
|
||||
ACC_UNUSED(wrkmem);
|
||||
|
||||
#ifdef TEST_OVERLAP
|
||||
src_len += src_off;
|
||||
|
|
@ -113,7 +113,7 @@
|
|||
fail(olen > ilen, UCL_E_OVERLAP_OVERRUN);
|
||||
#else
|
||||
{
|
||||
const ucl_byte *m_pos;
|
||||
const ucl_bytep m_pos;
|
||||
m_pos = dst + olen - m_off;
|
||||
dst[olen++] = *m_pos++;
|
||||
do dst[olen++] = *m_pos++; while (--m_len > 0);
|
||||
|
|
@ -135,8 +135,8 @@
|
|||
|
||||
#ifndef getbit
|
||||
|
||||
#include <ucl/ucl.h>
|
||||
#include "ucl_conf.h"
|
||||
#include <ucl/ucl.h>
|
||||
#include "getbit.h"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -31,8 +31,8 @@
|
|||
// entries for the different bit-buffer sizes
|
||||
************************************************************************/
|
||||
|
||||
#include <ucl/ucl.h>
|
||||
#include "ucl_conf.h"
|
||||
#include <ucl/ucl.h>
|
||||
#include "getbit.h"
|
||||
|
||||
#define SAFE
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
#ifdef SAFE
|
||||
const ucl_uint oend = *dst_len;
|
||||
#endif
|
||||
UCL_UNUSED(wrkmem);
|
||||
ACC_UNUSED(wrkmem);
|
||||
|
||||
#ifdef TEST_OVERLAP
|
||||
src_len += src_off;
|
||||
|
|
@ -116,7 +116,7 @@
|
|||
fail(olen > ilen, UCL_E_OVERLAP_OVERRUN);
|
||||
#else
|
||||
{
|
||||
const ucl_byte *m_pos;
|
||||
const ucl_bytep m_pos;
|
||||
m_pos = dst + olen - m_off;
|
||||
dst[olen++] = *m_pos++;
|
||||
do dst[olen++] = *m_pos++; while (--m_len > 0);
|
||||
|
|
@ -138,14 +138,14 @@
|
|||
|
||||
#ifndef getbit
|
||||
|
||||
#include <ucl/ucl.h>
|
||||
#include "ucl_conf.h"
|
||||
#include <ucl/ucl.h>
|
||||
#include "getbit.h"
|
||||
|
||||
|
||||
UCL_PUBLIC(int)
|
||||
ucl_nrv2e_decompress_8 ( const ucl_byte *src, ucl_uint src_len,
|
||||
ucl_byte *dst, ucl_uintp dst_len,
|
||||
ucl_nrv2e_decompress_8 ( const ucl_bytep src, ucl_uint src_len,
|
||||
ucl_bytep dst, ucl_uintp dst_len,
|
||||
ucl_voidp wrkmem )
|
||||
{
|
||||
#define getbit(bb) getbit_8(bb,src,ilen)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -31,8 +31,8 @@
|
|||
// entries for the different bit-buffer sizes
|
||||
************************************************************************/
|
||||
|
||||
#include <ucl/ucl.h>
|
||||
#include "ucl_conf.h"
|
||||
#include <ucl/ucl.h>
|
||||
#include "getbit.h"
|
||||
|
||||
#define SAFE
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/ucl/
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -34,81 +35,86 @@
|
|||
#ifndef __UCL_CONF_H
|
||||
#define __UCL_CONF_H
|
||||
|
||||
#if !defined(__UCL_IN_MINIUCL)
|
||||
# ifndef __UCLCONF_H
|
||||
# include <ucl/uclconf.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// memory checkers
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
#if defined(__BOUNDS_CHECKING_ON)
|
||||
# include <unchecked.h>
|
||||
#else
|
||||
# define BOUNDS_CHECKING_OFF_DURING(stmt) stmt
|
||||
# define BOUNDS_CHECKING_OFF_IN_EXPR(expr) (expr)
|
||||
#if defined(__UCLCONF_H_INCLUDED)
|
||||
# error "include this file first"
|
||||
#endif
|
||||
#include <ucl/uclconf.h>
|
||||
|
||||
#if defined(UCL_HAVE_CONFIG_H)
|
||||
# define ACC_CONFIG_NO_HEADER 1
|
||||
#endif
|
||||
#define __ACCLIB_FUNCNAME(f) error_do_not_use_acclib
|
||||
#include "acc/acc.h"
|
||||
|
||||
#if (ACC_CC_MSC && (_MSC_VER >= 1300))
|
||||
/* avoid `-Wall' warnings in system header files */
|
||||
# pragma warning(disable: 4820)
|
||||
/* avoid warnings about inlining */
|
||||
# pragma warning(disable: 4710 4711)
|
||||
#endif
|
||||
|
||||
#if defined(__UCL_MMODEL_HUGE) && (!ACC_HAVE_MM_HUGE_PTR)
|
||||
# error "this should not happen - check defines for __huge"
|
||||
#endif
|
||||
#if !defined(__UCL_MMODEL_HUGE) && defined(HAVE_MEMCMP)
|
||||
# define ucl_memcmp(a,b,c) memcmp(a,b,c)
|
||||
#endif
|
||||
#if !defined(__UCL_MMODEL_HUGE) && defined(HAVE_MEMCPY)
|
||||
# define ucl_memcpy(a,b,c) memcpy(a,b,c)
|
||||
#endif
|
||||
#if !defined(__UCL_MMODEL_HUGE) && defined(HAVE_MEMMOVE)
|
||||
# define ucl_memmove(a,b,c) memmove(a,b,c)
|
||||
#endif
|
||||
#if !defined(__UCL_MMODEL_HUGE) && defined(HAVE_MEMSET)
|
||||
# define ucl_memset(a,b,c) memset(a,b,c)
|
||||
#endif
|
||||
|
||||
#if (ACC_OS_DOS16 + 0 != UCL_OS_DOS16 + 0)
|
||||
# error "DOS16"
|
||||
#endif
|
||||
#if (ACC_OS_OS216 + 0 != UCL_OS_OS216 + 0)
|
||||
# error "OS216"
|
||||
#endif
|
||||
#if (ACC_OS_WIN16 + 0 != UCL_OS_WIN16 + 0)
|
||||
# error "WIN16"
|
||||
#endif
|
||||
#if (ACC_OS_DOS32 + 0 != UCL_OS_DOS32 + 0)
|
||||
# error "DOS32"
|
||||
#endif
|
||||
#if (ACC_OS_OS2 + 0 != UCL_OS_OS2 + 0)
|
||||
# error "DOS32"
|
||||
#endif
|
||||
#if (ACC_OS_WIN32 + 0 != UCL_OS_WIN32 + 0)
|
||||
# error "WIN32"
|
||||
#endif
|
||||
#if (ACC_OS_WIN64 + 0 != UCL_OS_WIN64 + 0)
|
||||
# error "WIN64"
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// autoconf section
|
||||
************************************************************************/
|
||||
|
||||
#if !defined(UCL_HAVE_CONFIG_H)
|
||||
# include <stddef.h> /* ptrdiff_t, size_t */
|
||||
# include <string.h> /* memcpy, memmove, memcmp, memset */
|
||||
# if !defined(NO_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
# define HAVE_MEMCMP
|
||||
# define HAVE_MEMCPY
|
||||
# define HAVE_MEMMOVE
|
||||
# define HAVE_MEMSET
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
# if defined(STDC_HEADERS)
|
||||
# include <string.h>
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
# if defined(HAVE_STDDEF_H)
|
||||
# include <stddef.h>
|
||||
# endif
|
||||
# if defined(HAVE_MEMORY_H)
|
||||
# include <memory.h>
|
||||
# endif
|
||||
#include "acc/acc_incd.h"
|
||||
#if (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16)
|
||||
# include "acc/acc_ince.h"
|
||||
# include "acc/acc_inci.h"
|
||||
#endif
|
||||
|
||||
#if defined(__UCL_DOS16) || defined(__UCL_WIN16)
|
||||
# define HAVE_MALLOC_H
|
||||
# define HAVE_HALLOC
|
||||
#endif
|
||||
|
||||
|
||||
#undef NDEBUG
|
||||
#if !defined(UCL_DEBUG)
|
||||
# define NDEBUG
|
||||
#endif
|
||||
#if 1 || defined(UCL_DEBUG) || !defined(NDEBUG)
|
||||
# if !defined(NO_STDIO_H)
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
# define NDEBUG 1
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
#if !defined(UCL_UNUSED)
|
||||
# define UCL_UNUSED(parm) (parm = parm)
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(__inline__) && !defined(__GNUC__)
|
||||
# if defined(__cplusplus)
|
||||
# define __inline__ inline
|
||||
#if (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16) && (ACC_CC_BORLANDC)
|
||||
# if (__BORLANDC__ >= 0x0450) /* v4.00 */
|
||||
# pragma option -h /* enable fast huge pointers */
|
||||
# else
|
||||
# define __inline__ /* nothing */
|
||||
# pragma option -h- /* disable fast huge pointers - compiler bug */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
@ -153,80 +159,6 @@
|
|||
#define UCL_UTYPE_MAX(b) (((1ul << (8*(b)-1)) - 1ul) + (1ul << (8*(b)-1)))
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
#if !defined(SIZEOF_UNSIGNED)
|
||||
# if (UINT_MAX == 0xffff)
|
||||
# define SIZEOF_UNSIGNED 2
|
||||
# elif (UINT_MAX == UCL_0xffffffffL)
|
||||
# define SIZEOF_UNSIGNED 4
|
||||
# elif (UINT_MAX >= UCL_0xffffffffL)
|
||||
# define SIZEOF_UNSIGNED 8
|
||||
# else
|
||||
# error "SIZEOF_UNSIGNED"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(SIZEOF_UNSIGNED_LONG)
|
||||
# if (ULONG_MAX == UCL_0xffffffffL)
|
||||
# define SIZEOF_UNSIGNED_LONG 4
|
||||
# elif (ULONG_MAX >= UCL_0xffffffffL)
|
||||
# define SIZEOF_UNSIGNED_LONG 8
|
||||
# else
|
||||
# error "SIZEOF_UNSIGNED_LONG"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(SIZEOF_SIZE_T)
|
||||
# define SIZEOF_SIZE_T SIZEOF_UNSIGNED_LONG
|
||||
#endif
|
||||
#if !defined(SIZE_T_MAX)
|
||||
# define SIZE_T_MAX UCL_UTYPE_MAX(SIZEOF_SIZE_T)
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// <string.h> section
|
||||
************************************************************************/
|
||||
|
||||
#if defined(NO_MEMCMP)
|
||||
# undef HAVE_MEMCMP
|
||||
#endif
|
||||
|
||||
#if (UCL_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMCMP)
|
||||
# define ucl_memcmp memcmp
|
||||
#endif
|
||||
#if (UCL_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMCPY)
|
||||
# define ucl_memcpy memcpy
|
||||
#endif
|
||||
#if (UCL_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMMOVE)
|
||||
# define ucl_memmove memmove
|
||||
#endif
|
||||
#if (UCL_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMSET)
|
||||
# define ucl_memset memset
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_MEMCMP)
|
||||
# undef memcmp
|
||||
# define memcmp ucl_memcmp
|
||||
#endif
|
||||
#if !defined(HAVE_MEMCPY)
|
||||
# undef memcpy
|
||||
# define memcpy ucl_memcpy
|
||||
#endif
|
||||
#if !defined(HAVE_MEMMOVE)
|
||||
# undef memmove
|
||||
# define memmove ucl_memmove
|
||||
#endif
|
||||
#if !defined(HAVE_MEMSET)
|
||||
# undef memset
|
||||
# define memset ucl_memset
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// compiler and architecture specific stuff
|
||||
************************************************************************/
|
||||
|
|
@ -236,81 +168,22 @@
|
|||
* even if it is allowed by your system.
|
||||
*/
|
||||
|
||||
#if 1 && defined(__UCL_i386) && (UINT_MAX == UCL_0xffffffffL)
|
||||
# if !defined(UCL_UNALIGNED_OK_2) && (USHRT_MAX == 0xffff)
|
||||
# define UCL_UNALIGNED_OK_2
|
||||
# endif
|
||||
# if !defined(UCL_UNALIGNED_OK_4) && (UCL_UINT32_MAX == UCL_0xffffffffL)
|
||||
# define UCL_UNALIGNED_OK_4
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(UCL_UNALIGNED_OK_2) || defined(UCL_UNALIGNED_OK_4)
|
||||
# if !defined(UCL_UNALIGNED_OK)
|
||||
# define UCL_UNALIGNED_OK
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__UCL_NO_UNALIGNED)
|
||||
# undef UCL_UNALIGNED_OK
|
||||
# undef UCL_UNALIGNED_OK_2
|
||||
# undef UCL_UNALIGNED_OK_4
|
||||
#endif
|
||||
|
||||
#if defined(UCL_UNALIGNED_OK_2) && (USHRT_MAX != 0xffff)
|
||||
# error "UCL_UNALIGNED_OK_2 must not be defined on this system"
|
||||
#endif
|
||||
#if defined(UCL_UNALIGNED_OK_4) && (UCL_UINT32_MAX != UCL_0xffffffffL)
|
||||
# error "UCL_UNALIGNED_OK_4 must not be defined on this system"
|
||||
#endif
|
||||
|
||||
|
||||
/* Many modern processors can transfer 32bit words much faster than
|
||||
* bytes - this can significantly speed decompression.
|
||||
*/
|
||||
|
||||
#if defined(__UCL_NO_ALIGNED)
|
||||
# undef UCL_ALIGNED_OK_4
|
||||
#endif
|
||||
|
||||
#if defined(UCL_ALIGNED_OK_4) && (UCL_UINT32_MAX != UCL_0xffffffffL)
|
||||
# error "UCL_ALIGNED_OK_4 must not be defined on this system"
|
||||
#endif
|
||||
|
||||
|
||||
/* Definitions for byte order, according to significance of bytes, from low
|
||||
* addresses to high addresses. The value is what you get by putting '4'
|
||||
* in the most significant byte, '3' in the second most significant byte,
|
||||
* '2' in the second least significant byte, and '1' in the least
|
||||
* significant byte.
|
||||
* The byte order is only needed if we use UCL_UNALIGNED_OK.
|
||||
*/
|
||||
|
||||
#define UCL_LITTLE_ENDIAN 1234
|
||||
#define UCL_BIG_ENDIAN 4321
|
||||
#define UCL_PDP_ENDIAN 3412
|
||||
|
||||
#if !defined(UCL_BYTE_ORDER)
|
||||
# if defined(MFX_BYTE_ORDER)
|
||||
# define UCL_BYTE_ORDER MFX_BYTE_ORDER
|
||||
# elif defined(__UCL_i386)
|
||||
# define UCL_BYTE_ORDER UCL_LITTLE_ENDIAN
|
||||
# elif defined(BYTE_ORDER)
|
||||
# define UCL_BYTE_ORDER BYTE_ORDER
|
||||
# elif defined(__BYTE_ORDER)
|
||||
# define UCL_BYTE_ORDER __BYTE_ORDER
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(UCL_BYTE_ORDER)
|
||||
# if (UCL_BYTE_ORDER != UCL_LITTLE_ENDIAN) && \
|
||||
(UCL_BYTE_ORDER != UCL_BIG_ENDIAN)
|
||||
# error "invalid UCL_BYTE_ORDER"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(UCL_UNALIGNED_OK) && !defined(UCL_BYTE_ORDER)
|
||||
# error "UCL_BYTE_ORDER is not defined"
|
||||
#undef UA_GET2
|
||||
#undef UA_SET2
|
||||
#undef UA_GET4
|
||||
#undef UA_SET4
|
||||
#if 1 && (ACC_ARCH_AMD64 || ACC_ARCH_IA32)
|
||||
# define UA_GET2(p) (* (const ucl_ushortp) (p))
|
||||
# define UA_SET2(p) (* (ucl_ushortp) (p))
|
||||
# define UA_GET4(p) (* (const acc_uint32e_t *) (p))
|
||||
# define UA_SET4(p) (* (acc_uint32e_t *) (p))
|
||||
#elif 0 && (ACC_ARCH_M68K) && (ACC_CC_GNUC >= 0x020900ul)
|
||||
typedef struct { unsigned short v; } __ucl_ua2_t __attribute__((__aligned__(1)));
|
||||
typedef struct { unsigned long v; } __ucl_ua4_t __attribute__((__aligned__(1)));
|
||||
# define UA_GET2(p) (((const __ucl_ua2_t *)(p))->v)
|
||||
# define UA_SET2(p) (((__ucl_ua2_t *)(p))->v)
|
||||
# define UA_GET4(p) (((const __ucl_ua4_t *)(p))->v)
|
||||
# define UA_SET4(p) (((__ucl_ua4_t *)(p))->v)
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -319,9 +192,7 @@
|
|||
************************************************************************/
|
||||
|
||||
__UCL_EXTERN_C int __ucl_init_done;
|
||||
__UCL_EXTERN_C const ucl_byte __ucl_copyright[];
|
||||
UCL_EXTERN(const ucl_byte *) ucl_copyright(void);
|
||||
__UCL_EXTERN_C const ucl_uint32 _ucl_crc32_table[256];
|
||||
UCL_EXTERN(const ucl_bytep) ucl_copyright(void);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
|
|
@ -331,18 +202,6 @@ __UCL_EXTERN_C const ucl_uint32 _ucl_crc32_table[256];
|
|||
#define _UCL_STRINGIZE(x) #x
|
||||
#define _UCL_MEXPAND(x) _UCL_STRINGIZE(x)
|
||||
|
||||
/* concatenate */
|
||||
#define _UCL_CONCAT2(a,b) a ## b
|
||||
#define _UCL_CONCAT3(a,b,c) a ## b ## c
|
||||
#define _UCL_CONCAT4(a,b,c,d) a ## b ## c ## d
|
||||
#define _UCL_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e
|
||||
|
||||
/* expand and concatenate (by using one level of indirection) */
|
||||
#define _UCL_ECONCAT2(a,b) _UCL_CONCAT2(a,b)
|
||||
#define _UCL_ECONCAT3(a,b,c) _UCL_CONCAT3(a,b,c)
|
||||
#define _UCL_ECONCAT4(a,b,c,d) _UCL_CONCAT4(a,b,c,d)
|
||||
#define _UCL_ECONCAT5(a,b,c,d,e) _UCL_CONCAT5(a,b,c,d,e)
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
|
|
@ -356,4 +215,3 @@ __UCL_EXTERN_C const ucl_uint32 _ucl_crc32_table[256];
|
|||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
|
||||
#include "ucl_conf.h"
|
||||
#include "ucl_util.h"
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
|
|
@ -36,7 +35,7 @@
|
|||
// see http://www.cdrom.com/pub/infozip/zlib/
|
||||
************************************************************************/
|
||||
|
||||
const ucl_uint32 _ucl_crc32_table[256] = {
|
||||
static const ucl_uint32 __ucl_crc32_table[256] = {
|
||||
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
|
||||
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
|
||||
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
|
||||
|
|
@ -92,12 +91,19 @@ const ucl_uint32 _ucl_crc32_table[256] = {
|
|||
};
|
||||
|
||||
|
||||
UCL_PUBLIC(const ucl_uint32p)
|
||||
ucl_get_crc32_table(void)
|
||||
{
|
||||
return __ucl_crc32_table;
|
||||
}
|
||||
|
||||
|
||||
#if 1
|
||||
#define UCL_DO1(buf,i) \
|
||||
crc = _ucl_crc32_table[((int)crc ^ buf[i]) & 0xff] ^ (crc >> 8)
|
||||
crc = table[((int)crc ^ buf[i]) & 0xff] ^ (crc >> 8)
|
||||
#else
|
||||
#define UCL_DO1(buf,i) \
|
||||
crc = _ucl_crc32_table[(unsigned char)((unsigned char)crc ^ buf[i])] ^ (crc >> 8)
|
||||
crc = table[(unsigned char)((unsigned char)crc ^ buf[i])] ^ (crc >> 8)
|
||||
#endif
|
||||
#define UCL_DO2(buf,i) UCL_DO1(buf,i); UCL_DO1(buf,i+1);
|
||||
#define UCL_DO4(buf,i) UCL_DO2(buf,i); UCL_DO2(buf,i+2);
|
||||
|
|
@ -108,11 +114,18 @@ const ucl_uint32 _ucl_crc32_table[256] = {
|
|||
UCL_PUBLIC(ucl_uint32)
|
||||
ucl_crc32(ucl_uint32 c, const ucl_bytep buf, ucl_uint len)
|
||||
{
|
||||
ucl_uint32 crc = (c & UCL_UINT32_C(0xffffffff)) ^ UCL_UINT32_C(0xffffffff);
|
||||
ucl_uint32 crc;
|
||||
#undef table
|
||||
#if 1
|
||||
# define table __ucl_crc32_table
|
||||
#else
|
||||
const ucl_uint32 * table = __ucl_crc32_table;
|
||||
#endif
|
||||
|
||||
if (buf == NULL)
|
||||
return 0;
|
||||
|
||||
crc = (c & UCL_UINT32_C(0xffffffff)) ^ UCL_UINT32_C(0xffffffff);
|
||||
if (len >= 16) do
|
||||
{
|
||||
UCL_DO16(buf,0);
|
||||
|
|
@ -127,6 +140,7 @@ ucl_crc32(ucl_uint32 c, const ucl_bytep buf, ucl_uint len)
|
|||
} while (len > 0);
|
||||
|
||||
return crc ^ UCL_UINT32_C(0xffffffff);
|
||||
#undef table
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -26,36 +26,27 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "ucl_conf.h"
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// Windows 16 bit + Watcom C + DLL
|
||||
************************************************************************/
|
||||
|
||||
#if defined(__UCL_WIN16) && defined(__WATCOMC__) && defined(__SW_BD)
|
||||
#if (ACC_OS_WIN16 && ACC_CC_WATCOMC) && defined(__SW_BD)
|
||||
|
||||
/* don't pull in <windows.h> - we don't need it */
|
||||
#if 0
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#pragma off (unreferenced);
|
||||
#if 0 && defined(WINVER)
|
||||
BOOL FAR PASCAL LibMain ( HANDLE hInstance, WORD wDataSegment,
|
||||
WORD wHeapSize, LPSTR lpszCmdLine )
|
||||
#else
|
||||
int __far __pascal LibMain ( int a, short b, short c, long d )
|
||||
#endif
|
||||
#pragma on (unreferenced);
|
||||
{
|
||||
ACC_UNUSED(a); ACC_UNUSED(b); ACC_UNUSED(c); ACC_UNUSED(d);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -27,27 +27,19 @@
|
|||
|
||||
|
||||
#include "ucl_conf.h"
|
||||
#include "ucl_util.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#if 0
|
||||
# define IS_SIGNED(type) (((type) (1ul << (8 * sizeof(type) - 1))) < 0)
|
||||
# define IS_UNSIGNED(type) (((type) (1ul << (8 * sizeof(type) - 1))) > 0)
|
||||
#else
|
||||
# define IS_SIGNED(type) (((type) (-1)) < ((type) 0))
|
||||
# define IS_UNSIGNED(type) (((type) (-1)) > ((type) 0))
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// Runtime check of the assumptions about the size of builtin types,
|
||||
// memory model, byte order and other low-level constructs.
|
||||
//
|
||||
// We are really paranoid here - UCL should either fail (or crash)
|
||||
// We are really paranoid here - UCL should either fail
|
||||
// at startup or not at all.
|
||||
//
|
||||
// Because of inlining much of these functions evaluates to nothing.
|
||||
// Because of inlining much of this evaluates to nothing at compile time.
|
||||
//
|
||||
// And while many of the tests seem highly obvious and redundant they are
|
||||
// here to catch compiler/optimizer bugs. Yes, these do exist.
|
||||
************************************************************************/
|
||||
|
||||
static ucl_bool schedule_insns_bug(void); /* avoid inlining */
|
||||
|
|
@ -55,6 +47,7 @@ static ucl_bool strength_reduce_bug(int *); /* avoid inlining */
|
|||
|
||||
|
||||
#if 0 || defined(UCL_DEBUG)
|
||||
#include <stdio.h>
|
||||
static ucl_bool __ucl_assert_fail(const char *s, unsigned line)
|
||||
{
|
||||
#if defined(__palmos__)
|
||||
|
|
@ -71,114 +64,28 @@ static ucl_bool __ucl_assert_fail(const char *s, unsigned line)
|
|||
|
||||
|
||||
/***********************************************************************
|
||||
// The next two functions should get completely optimized out of existance.
|
||||
// Some assertions are redundant - but included for clarity.
|
||||
// basic_check - compile time assertions
|
||||
************************************************************************/
|
||||
|
||||
static ucl_bool basic_integral_check(void)
|
||||
{
|
||||
ucl_bool r = 1;
|
||||
ucl_bool sanity;
|
||||
#if 1
|
||||
|
||||
/* paranoia */
|
||||
r &= __ucl_assert(CHAR_BIT == 8);
|
||||
r &= __ucl_assert(sizeof(char) == 1);
|
||||
r &= __ucl_assert(sizeof(short) >= 2);
|
||||
r &= __ucl_assert(sizeof(long) >= 4);
|
||||
r &= __ucl_assert(sizeof(int) >= sizeof(short));
|
||||
r &= __ucl_assert(sizeof(long) >= sizeof(int));
|
||||
#undef ACCCHK_ASSERT
|
||||
#define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT_HEADER(expr)
|
||||
|
||||
#include "acc/acc_chk.ch"
|
||||
|
||||
ACCCHK_ASSERT_IS_SIGNED_T(ucl_int)
|
||||
ACCCHK_ASSERT_IS_UNSIGNED_T(ucl_uint)
|
||||
|
||||
ACCCHK_ASSERT_IS_SIGNED_T(ucl_int32)
|
||||
ACCCHK_ASSERT_IS_UNSIGNED_T(ucl_uint32)
|
||||
ACCCHK_ASSERT((UCL_UINT32_C(1) << (int)(8*sizeof(UCL_UINT32_C(1))-1)) > 0)
|
||||
|
||||
ACCCHK_ASSERT_IS_UNSIGNED_T(ucl_uintptr_t)
|
||||
ACCCHK_ASSERT(sizeof(ucl_uintptr_t) >= sizeof(ucl_voidp))
|
||||
|
||||
r &= __ucl_assert(sizeof(ucl_uint32) >= 4);
|
||||
r &= __ucl_assert(sizeof(ucl_uint32) >= sizeof(unsigned));
|
||||
#if defined(__UCL_STRICT_16BIT)
|
||||
r &= __ucl_assert(sizeof(ucl_uint) == 2);
|
||||
#else
|
||||
r &= __ucl_assert(sizeof(ucl_uint) >= 4);
|
||||
r &= __ucl_assert(sizeof(ucl_uint) >= sizeof(unsigned));
|
||||
#endif
|
||||
|
||||
#if defined(SIZEOF_UNSIGNED)
|
||||
r &= __ucl_assert(SIZEOF_UNSIGNED == sizeof(unsigned));
|
||||
#endif
|
||||
#if defined(SIZEOF_UNSIGNED_LONG)
|
||||
r &= __ucl_assert(SIZEOF_UNSIGNED_LONG == sizeof(unsigned long));
|
||||
#endif
|
||||
#if defined(SIZEOF_UNSIGNED_SHORT)
|
||||
r &= __ucl_assert(SIZEOF_UNSIGNED_SHORT == sizeof(unsigned short));
|
||||
#endif
|
||||
#if !defined(__UCL_IN_MINIUCL)
|
||||
#if defined(SIZEOF_SIZE_T)
|
||||
r &= __ucl_assert(SIZEOF_SIZE_T == sizeof(size_t));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* assert the signedness of our integral types */
|
||||
sanity = IS_UNSIGNED(unsigned short) && IS_UNSIGNED(unsigned) &&
|
||||
IS_UNSIGNED(unsigned long) &&
|
||||
IS_SIGNED(short) && IS_SIGNED(int) && IS_SIGNED(long);
|
||||
if (sanity)
|
||||
{
|
||||
r &= __ucl_assert(IS_UNSIGNED(ucl_uint32));
|
||||
r &= __ucl_assert(IS_UNSIGNED(ucl_uint));
|
||||
r &= __ucl_assert(IS_SIGNED(ucl_int32));
|
||||
r &= __ucl_assert(IS_SIGNED(ucl_int));
|
||||
|
||||
r &= __ucl_assert(INT_MAX == UCL_STYPE_MAX(sizeof(int)));
|
||||
r &= __ucl_assert(UINT_MAX == UCL_UTYPE_MAX(sizeof(unsigned)));
|
||||
r &= __ucl_assert(LONG_MAX == UCL_STYPE_MAX(sizeof(long)));
|
||||
r &= __ucl_assert(ULONG_MAX == UCL_UTYPE_MAX(sizeof(unsigned long)));
|
||||
r &= __ucl_assert(SHRT_MAX == UCL_STYPE_MAX(sizeof(short)));
|
||||
r &= __ucl_assert(USHRT_MAX == UCL_UTYPE_MAX(sizeof(unsigned short)));
|
||||
r &= __ucl_assert(UCL_UINT32_MAX == UCL_UTYPE_MAX(sizeof(ucl_uint32)));
|
||||
r &= __ucl_assert(UCL_UINT_MAX == UCL_UTYPE_MAX(sizeof(ucl_uint)));
|
||||
#if !defined(__UCL_IN_MINIUCL)
|
||||
r &= __ucl_assert(SIZE_T_MAX == UCL_UTYPE_MAX(sizeof(size_t)));
|
||||
#endif
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
static ucl_bool basic_ptr_check(void)
|
||||
{
|
||||
ucl_bool r = 1;
|
||||
ucl_bool sanity;
|
||||
|
||||
r &= __ucl_assert(sizeof(char *) >= sizeof(int));
|
||||
r &= __ucl_assert(sizeof(ucl_byte *) >= sizeof(char *));
|
||||
|
||||
r &= __ucl_assert(sizeof(ucl_voidp) == sizeof(ucl_byte *));
|
||||
r &= __ucl_assert(sizeof(ucl_voidp) == sizeof(ucl_voidpp));
|
||||
r &= __ucl_assert(sizeof(ucl_voidp) == sizeof(ucl_bytepp));
|
||||
r &= __ucl_assert(sizeof(ucl_voidp) >= sizeof(ucl_uint));
|
||||
|
||||
r &= __ucl_assert(sizeof(ucl_ptr_t) == sizeof(ucl_voidp));
|
||||
r &= __ucl_assert(sizeof(ucl_ptr_t) >= sizeof(ucl_uint));
|
||||
|
||||
r &= __ucl_assert(sizeof(ucl_ptrdiff_t) >= 4);
|
||||
r &= __ucl_assert(sizeof(ucl_ptrdiff_t) >= sizeof(ptrdiff_t));
|
||||
|
||||
#if defined(SIZEOF_CHAR_P)
|
||||
r &= __ucl_assert(SIZEOF_CHAR_P == sizeof(char *));
|
||||
#endif
|
||||
#if defined(SIZEOF_PTRDIFF_T)
|
||||
r &= __ucl_assert(SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t));
|
||||
#endif
|
||||
|
||||
/* assert the signedness of our integral types */
|
||||
sanity = IS_UNSIGNED(unsigned short) && IS_UNSIGNED(unsigned) &&
|
||||
IS_UNSIGNED(unsigned long) &&
|
||||
IS_SIGNED(short) && IS_SIGNED(int) && IS_SIGNED(long);
|
||||
if (sanity)
|
||||
{
|
||||
r &= __ucl_assert(IS_UNSIGNED(ucl_ptr_t));
|
||||
r &= __ucl_assert(IS_SIGNED(ucl_ptrdiff_t));
|
||||
r &= __ucl_assert(IS_SIGNED(ucl_sptr_t));
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
#undef ACCCHK_ASSERT
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
|
|
@ -189,31 +96,25 @@ static ucl_bool ptr_check(void)
|
|||
{
|
||||
ucl_bool r = 1;
|
||||
int i;
|
||||
char _wrkmem[10 * sizeof(ucl_byte *) + sizeof(ucl_align_t)];
|
||||
unsigned char _wrkmem[10 * sizeof(ucl_bytep) + sizeof(ucl_align_t)];
|
||||
ucl_bytep wrkmem;
|
||||
ucl_bytepp dict;
|
||||
unsigned char x[4 * sizeof(ucl_align_t)];
|
||||
long d;
|
||||
ucl_align_t a;
|
||||
ucl_align_t u;
|
||||
|
||||
for (i = 0; i < (int) sizeof(x); i++)
|
||||
x[i] = UCL_BYTE(i);
|
||||
|
||||
wrkmem = UCL_PTR_ALIGN_UP((ucl_byte *)_wrkmem,sizeof(ucl_align_t));
|
||||
wrkmem = UCL_PTR_ALIGN_UP((ucl_bytep)_wrkmem, sizeof(ucl_align_t));
|
||||
|
||||
#if 0
|
||||
dict = (ucl_bytepp) wrkmem;
|
||||
#else
|
||||
/* Avoid a compiler warning on architectures that
|
||||
* do not allow unaligned access. */
|
||||
u.a_ucl_bytep = wrkmem; dict = u.a_ucl_bytepp;
|
||||
#endif
|
||||
dict = (ucl_bytepp) (ucl_voidp) wrkmem;
|
||||
|
||||
d = (long) ((const ucl_bytep) dict - (const ucl_bytep) _wrkmem);
|
||||
r &= __ucl_assert(d >= 0);
|
||||
r &= __ucl_assert(d < (long) sizeof(ucl_align_t));
|
||||
|
||||
/* this may seem obvious, but some compilers incorrectly inline memset */
|
||||
memset(&a,0xff,sizeof(a));
|
||||
r &= __ucl_assert(a.a_ushort == USHRT_MAX);
|
||||
r &= __ucl_assert(a.a_uint == UINT_MAX);
|
||||
|
|
@ -224,32 +125,21 @@ static ucl_bool ptr_check(void)
|
|||
if (r == 1)
|
||||
{
|
||||
for (i = 0; i < 8; i++)
|
||||
r &= __ucl_assert((const ucl_voidp) (&dict[i]) == (const ucl_voidp) (&wrkmem[i * sizeof(ucl_byte *)]));
|
||||
r &= __ucl_assert((const ucl_voidp) (&dict[i]) == (const ucl_voidp) (&wrkmem[i * sizeof(ucl_bytep)]));
|
||||
}
|
||||
|
||||
/* check BZERO8_PTR and that NULL == 0 */
|
||||
/* check that NULL == 0 */
|
||||
memset(&a,0,sizeof(a));
|
||||
r &= __ucl_assert(a.a_char_p == NULL);
|
||||
r &= __ucl_assert(a.a_ucl_bytep == NULL);
|
||||
r &= __ucl_assert(NULL == (void*)0);
|
||||
if (r == 1)
|
||||
{
|
||||
for (i = 0; i < 10; i++)
|
||||
dict[i] = wrkmem;
|
||||
BZERO8_PTR(dict+1,sizeof(dict[0]),8);
|
||||
r &= __ucl_assert(dict[0] == wrkmem);
|
||||
for (i = 1; i < 9; i++)
|
||||
r &= __ucl_assert(dict[i] == NULL);
|
||||
r &= __ucl_assert(dict[9] == wrkmem);
|
||||
}
|
||||
|
||||
/* check that the pointer constructs work as expected */
|
||||
if (r == 1)
|
||||
{
|
||||
unsigned k = 1;
|
||||
const unsigned n = (unsigned) sizeof(ucl_uint32);
|
||||
ucl_byte *p0;
|
||||
ucl_byte *p1;
|
||||
ucl_bytep p0;
|
||||
ucl_bytep p1;
|
||||
|
||||
k += __ucl_align_gap(&x[k],n);
|
||||
p0 = (ucl_bytep) &x[k];
|
||||
|
|
@ -264,7 +154,7 @@ static ucl_bool ptr_check(void)
|
|||
p1 = (ucl_bytep) &x[1];
|
||||
r &= __ucl_assert(PTR_GE(p0,p1));
|
||||
|
||||
r &= __ucl_assert(k < 1+n);
|
||||
r &= __ucl_assert(k < 1u+n);
|
||||
p1 = (ucl_bytep) &x[1+n];
|
||||
r &= __ucl_assert(PTR_LT(p0,p1));
|
||||
|
||||
|
|
@ -272,17 +162,8 @@ static ucl_bool ptr_check(void)
|
|||
if (r == 1)
|
||||
{
|
||||
ucl_uint32 v0, v1;
|
||||
#if 0
|
||||
v0 = * (ucl_uint32 *) &x[k];
|
||||
v1 = * (ucl_uint32 *) &x[k+n];
|
||||
#else
|
||||
/* Avoid compiler warnings on architectures that
|
||||
* do not allow unaligned access. */
|
||||
u.a_uchar_p = &x[k];
|
||||
v0 = *u.a_ucl_uint32_p;
|
||||
u.a_uchar_p = &x[k+n];
|
||||
v1 = *u.a_ucl_uint32_p;
|
||||
#endif
|
||||
v0 = * (ucl_uint32p) (ucl_voidp) &x[k];
|
||||
v1 = * (ucl_uint32p) (ucl_voidp) &x[k+n];
|
||||
r &= __ucl_assert(v0 > 0);
|
||||
r &= __ucl_assert(v1 > 0);
|
||||
}
|
||||
|
|
@ -308,64 +189,42 @@ _ucl_config_check(void)
|
|||
unsigned char x[4*sizeof(ucl_align_t)];
|
||||
} u;
|
||||
|
||||
#if 0
|
||||
/* paranoia - the following is guaranteed by definition anyway */
|
||||
r &= __ucl_assert((const void *)&u == (const void *)&u.a);
|
||||
r &= __ucl_assert((const void *)&u == (const void *)&u.b);
|
||||
r &= __ucl_assert((const void *)&u == (const void *)&u.x[0]);
|
||||
r &= __ucl_assert((const void *)&u == (const void *)&u.aa[0]);
|
||||
#endif
|
||||
|
||||
r &= basic_integral_check();
|
||||
r &= basic_ptr_check();
|
||||
if (r != 1)
|
||||
return UCL_E_ERROR;
|
||||
|
||||
u.a = 0; u.b = 0;
|
||||
for (i = 0; i < (int) sizeof(u.x); i++)
|
||||
u.x[i] = UCL_BYTE(i);
|
||||
|
||||
#if 0
|
||||
/* check if the compiler correctly casts signed to unsigned */
|
||||
r &= __ucl_assert( (int) (unsigned char) ((char) -1) == 255);
|
||||
#endif
|
||||
|
||||
/* check UCL_BYTE_ORDER */
|
||||
#if defined(UCL_BYTE_ORDER)
|
||||
#if defined(ACC_ENDIAN_BIG_ENDIAN) || defined(ACC_ENDIAN_LITTLE_ENDIAN)
|
||||
if (r == 1)
|
||||
{
|
||||
# if (UCL_BYTE_ORDER == UCL_LITTLE_ENDIAN)
|
||||
ucl_uint32 a = (ucl_uint32) (u.a & UCL_UINT32_C(0xffffffff));
|
||||
unsigned short b = (unsigned short) (u.b & 0xffff);
|
||||
r &= __ucl_assert(a == UCL_UINT32_C(0x03020100));
|
||||
r &= __ucl_assert(b == 0x0100);
|
||||
# elif (UCL_BYTE_ORDER == UCL_BIG_ENDIAN)
|
||||
# if defined(ACC_ENDIAN_BIG_ENDIAN)
|
||||
ucl_uint32 a = u.a >> (8 * sizeof(u.a) - 32);
|
||||
unsigned short b = u.b >> (8 * sizeof(u.b) - 16);
|
||||
r &= __ucl_assert(a == UCL_UINT32_C(0x00010203));
|
||||
r &= __ucl_assert(b == 0x0001);
|
||||
# else
|
||||
# error "invalid UCL_BYTE_ORDER"
|
||||
# endif
|
||||
# if defined(ACC_ENDIAN_LITTLE_ENDIAN)
|
||||
ucl_uint32 a = (ucl_uint32) (u.a & UCL_UINT32_C(0xffffffff));
|
||||
unsigned short b = (unsigned short) (u.b & 0xffff);
|
||||
r &= __ucl_assert(a == UCL_UINT32_C(0x03020100));
|
||||
r &= __ucl_assert(b == 0x0100);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/* check that unaligned memory access works as expected */
|
||||
#if defined(UCL_UNALIGNED_OK_2)
|
||||
r &= __ucl_assert(sizeof(short) == 2);
|
||||
#if defined(UA_GET2) || defined(UA_SET2)
|
||||
if (r == 1)
|
||||
{
|
||||
unsigned short b[4];
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
b[i] = * (const unsigned short *) &u.x[i];
|
||||
|
||||
# if (UCL_BYTE_ORDER == UCL_LITTLE_ENDIAN)
|
||||
b[i] = UA_GET2(&u.x[i]);
|
||||
# if defined(ACC_ENDIAN_LITTLE_ENDIAN)
|
||||
r &= __ucl_assert(b[0] == 0x0100);
|
||||
r &= __ucl_assert(b[1] == 0x0201);
|
||||
r &= __ucl_assert(b[2] == 0x0302);
|
||||
r &= __ucl_assert(b[3] == 0x0403);
|
||||
# elif (UCL_BYTE_ORDER == UCL_BIG_ENDIAN)
|
||||
# endif
|
||||
# if defined(ACC_ENDIAN_BIG_ENDIAN)
|
||||
r &= __ucl_assert(b[0] == 0x0001);
|
||||
r &= __ucl_assert(b[1] == 0x0102);
|
||||
r &= __ucl_assert(b[2] == 0x0203);
|
||||
|
|
@ -374,21 +233,19 @@ _ucl_config_check(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(UCL_UNALIGNED_OK_4)
|
||||
r &= __ucl_assert(sizeof(ucl_uint32) == 4);
|
||||
#if defined(UA_GET4) || defined(UA_SET4)
|
||||
if (r == 1)
|
||||
{
|
||||
ucl_uint32 a[4];
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
a[i] = * (const ucl_uint32 *) &u.x[i];
|
||||
|
||||
# if (UCL_BYTE_ORDER == UCL_LITTLE_ENDIAN)
|
||||
a[i] = UA_GET4(&u.x[i]);
|
||||
# if defined(ACC_ENDIAN_LITTLE_ENDIAN)
|
||||
r &= __ucl_assert(a[0] == UCL_UINT32_C(0x03020100));
|
||||
r &= __ucl_assert(a[1] == UCL_UINT32_C(0x04030201));
|
||||
r &= __ucl_assert(a[2] == UCL_UINT32_C(0x05040302));
|
||||
r &= __ucl_assert(a[3] == UCL_UINT32_C(0x06050403));
|
||||
# elif (UCL_BYTE_ORDER == UCL_BIG_ENDIAN)
|
||||
# endif
|
||||
# if defined(ACC_ENDIAN_BIG_ENDIAN)
|
||||
r &= __ucl_assert(a[0] == UCL_UINT32_C(0x00010203));
|
||||
r &= __ucl_assert(a[1] == UCL_UINT32_C(0x01020304));
|
||||
r &= __ucl_assert(a[2] == UCL_UINT32_C(0x02030405));
|
||||
|
|
@ -397,17 +254,13 @@ _ucl_config_check(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(UCL_ALIGNED_OK_4)
|
||||
r &= __ucl_assert(sizeof(ucl_uint32) == 4);
|
||||
#endif
|
||||
|
||||
/* check the ucl_adler32() function */
|
||||
if (r == 1)
|
||||
{
|
||||
ucl_uint32 adler;
|
||||
adler = ucl_adler32(0, NULL, 0);
|
||||
adler = ucl_adler32(adler, ucl_copyright(), 186);
|
||||
r &= __ucl_assert(adler == UCL_UINT32_C(0x47fb39fc));
|
||||
adler = ucl_adler32(adler, ucl_copyright(), 195);
|
||||
r &= __ucl_assert(adler == UCL_UINT32_C(0x52ca3a75));
|
||||
}
|
||||
|
||||
/* check for the gcc schedule-insns optimization bug */
|
||||
|
|
@ -434,6 +287,7 @@ _ucl_config_check(void)
|
|||
r &= ptr_check();
|
||||
}
|
||||
|
||||
ACC_UNUSED(u);
|
||||
return r == 1 ? UCL_E_OK : UCL_E_ERROR;
|
||||
}
|
||||
|
||||
|
|
@ -454,7 +308,11 @@ static ucl_bool schedule_insns_bug(void)
|
|||
|
||||
static ucl_bool strength_reduce_bug(int *x)
|
||||
{
|
||||
#if 1 && (ACC_CC_DMC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
||||
return 0;
|
||||
#else
|
||||
return x[0] != -3 || x[1] != -2 || x[2] != -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -470,6 +328,12 @@ __ucl_init2(ucl_uint32 v, int s1, int s2, int s3, int s4, int s5,
|
|||
{
|
||||
int r;
|
||||
|
||||
#if (ACC_CC_MSC && ((_MSC_VER) < 700))
|
||||
#else
|
||||
#include "acc/acc_chk.ch"
|
||||
#undef ACCCHK_ASSERT
|
||||
#endif
|
||||
|
||||
__ucl_init_done = 1;
|
||||
|
||||
if (v == 0)
|
||||
|
|
@ -495,6 +359,9 @@ __ucl_init2(ucl_uint32 v, int s1, int s2, int s3, int s4, int s5,
|
|||
}
|
||||
|
||||
|
||||
#include "ucl_dll.ch"
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -22,11 +22,10 @@
|
|||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/ucl/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
|
|
@ -43,19 +42,19 @@ typedef struct
|
|||
ucl_uint last_m_len;
|
||||
ucl_uint last_m_off;
|
||||
|
||||
const ucl_byte *bp;
|
||||
const ucl_byte *ip;
|
||||
const ucl_byte *in;
|
||||
const ucl_byte *in_end;
|
||||
ucl_byte *out;
|
||||
const ucl_bytep bp;
|
||||
const ucl_bytep ip;
|
||||
const ucl_bytep in;
|
||||
const ucl_bytep in_end;
|
||||
ucl_bytep out;
|
||||
|
||||
ucl_uint32 bb_b;
|
||||
unsigned bb_k;
|
||||
unsigned bb_c_endian;
|
||||
unsigned bb_c_s;
|
||||
unsigned bb_c_s8;
|
||||
ucl_byte *bb_p;
|
||||
ucl_byte *bb_op;
|
||||
ucl_bytep bb_p;
|
||||
ucl_bytep bb_op;
|
||||
|
||||
struct ucl_compress_config_t conf;
|
||||
ucl_uintp result;
|
||||
|
|
@ -76,9 +75,9 @@ UCL_COMPRESS_T;
|
|||
|
||||
|
||||
|
||||
#if defined(__PUREC__) && defined(__UCL_TOS16)
|
||||
/* the cast is needed to work around a bug in Pure C */
|
||||
#define getbyte(c) ((c).ip < (c).in_end ? (unsigned) *((c).ip)++ : (-1))
|
||||
#if (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
|
||||
/* the cast is needed to work around a code generation bug */
|
||||
#define getbyte(c) ((c).ip < (c).in_end ? (int) (unsigned) *((c).ip)++ : (-1))
|
||||
#else
|
||||
#define getbyte(c) ((c).ip < (c).in_end ? *((c).ip)++ : (-1))
|
||||
#endif
|
||||
|
|
@ -93,7 +92,7 @@ UCL_COMPRESS_T;
|
|||
|
||||
static int
|
||||
init_match ( UCL_COMPRESS_T *c, ucl_swd_t *s,
|
||||
const ucl_byte *dict, ucl_uint dict_len,
|
||||
const ucl_bytep dict, ucl_uint dict_len,
|
||||
ucl_uint32 flags )
|
||||
{
|
||||
int r;
|
||||
|
|
@ -143,7 +142,7 @@ find_match ( UCL_COMPRESS_T *c, ucl_swd_t *s,
|
|||
c->textsize += this_len - skip;
|
||||
}
|
||||
|
||||
s->m_len = THRESHOLD;
|
||||
s->m_len = SWD_THRESHOLD;
|
||||
#ifdef SWD_BEST_OFF
|
||||
if (s->use_best_off)
|
||||
memset(s->best_pos,0,sizeof(s->best_pos));
|
||||
|
|
@ -154,7 +153,7 @@ find_match ( UCL_COMPRESS_T *c, ucl_swd_t *s,
|
|||
/* s->m_off may be uninitialized if we didn't find a match,
|
||||
* but then its value will never be used.
|
||||
*/
|
||||
c->m_off = (s->m_len == THRESHOLD) ? 0 : s->m_off;
|
||||
c->m_off = (s->m_len == SWD_THRESHOLD) ? 0 : s->m_off;
|
||||
#else
|
||||
c->m_off = s->m_off;
|
||||
#endif
|
||||
|
|
@ -175,14 +174,14 @@ find_match ( UCL_COMPRESS_T *c, ucl_swd_t *s,
|
|||
|
||||
#if 0
|
||||
/* brute force match search */
|
||||
if (c->m_len > THRESHOLD && c->m_len + 1 <= c->look)
|
||||
if (c->m_len > SWD_THRESHOLD && c->m_len + 1 <= c->look)
|
||||
{
|
||||
const ucl_byte *ip = c->bp;
|
||||
const ucl_byte *m = c->bp - c->m_off;
|
||||
const ucl_byte *in = c->in;
|
||||
const ucl_bytep ip = c->bp;
|
||||
const ucl_bytep m = c->bp - c->m_off;
|
||||
const ucl_bytep in = c->in;
|
||||
|
||||
if (ip - in > N)
|
||||
in = ip - N;
|
||||
if (ip - in > s->n)
|
||||
in = ip - s->n;
|
||||
for (;;)
|
||||
{
|
||||
while (*in != *ip)
|
||||
|
|
@ -235,7 +234,7 @@ static int bbConfig(UCL_COMPRESS_T *c, int endian, int bitsize)
|
|||
|
||||
static void bbWriteBits(UCL_COMPRESS_T *c)
|
||||
{
|
||||
ucl_byte *p = c->bb_p;
|
||||
ucl_bytep p = c->bb_p;
|
||||
ucl_uint32 b = c->bb_b;
|
||||
|
||||
p[0] = UCL_BYTE(b >> 0);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -33,13 +33,13 @@
|
|||
//
|
||||
************************************************************************/
|
||||
|
||||
UCL_PUBLIC(ucl_ptr_t)
|
||||
UCL_PUBLIC(ucl_uintptr_t)
|
||||
__ucl_ptr_linear(const ucl_voidp ptr)
|
||||
{
|
||||
ucl_ptr_t p;
|
||||
ucl_uintptr_t p;
|
||||
|
||||
#if defined(__UCL_DOS16) || defined(__UCL_WIN16)
|
||||
p = (((ucl_ptr_t)(_FP_SEG(ptr))) << (16 - __UCL_HShift)) + (_FP_OFF(ptr));
|
||||
#if (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16)
|
||||
p = (((ucl_uintptr_t)(ACC_FP_SEG(ptr))) << (16 - ACC_MM_AHSHIFT)) + (ACC_FP_OFF(ptr));
|
||||
#else
|
||||
p = PTR_LINEAR(ptr);
|
||||
#endif
|
||||
|
|
@ -55,12 +55,12 @@ __ucl_ptr_linear(const ucl_voidp ptr)
|
|||
UCL_PUBLIC(unsigned)
|
||||
__ucl_align_gap(const ucl_voidp ptr, ucl_uint size)
|
||||
{
|
||||
ucl_ptr_t p, s, n;
|
||||
ucl_uintptr_t p, s, n;
|
||||
|
||||
assert(size > 0);
|
||||
|
||||
p = __ucl_ptr_linear(ptr);
|
||||
s = (ucl_ptr_t) (size - 1);
|
||||
s = (ucl_uintptr_t) (size - 1);
|
||||
#if 0
|
||||
assert((size & (size - 1)) == 0);
|
||||
n = ((p + s) & ~s) - p;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/ucl/
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -39,93 +40,12 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
|
||||
/* This is the lowest part of the UCL library.
|
||||
* It deals with pointer representations at bit level.
|
||||
*/
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// Includes
|
||||
************************************************************************/
|
||||
|
||||
#if defined(__UCL_DOS16) || defined(__UCL_WIN16)
|
||||
# include <dos.h>
|
||||
# if 1 && defined(__WATCOMC__)
|
||||
# include <i86.h>
|
||||
__UCL_EXTERN_C unsigned char _HShift;
|
||||
# define __UCL_HShift _HShift
|
||||
# elif 1 && defined(_MSC_VER)
|
||||
__UCL_EXTERN_C unsigned short __near _AHSHIFT;
|
||||
# define __UCL_HShift ((unsigned) &_AHSHIFT)
|
||||
# elif defined(__UCL_WIN16)
|
||||
# define __UCL_HShift 3
|
||||
# else
|
||||
# define __UCL_HShift 12
|
||||
# endif
|
||||
# if !defined(_FP_SEG) && defined(FP_SEG)
|
||||
# define _FP_SEG FP_SEG
|
||||
# endif
|
||||
# if !defined(_FP_OFF) && defined(FP_OFF)
|
||||
# define _FP_OFF FP_OFF
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// Integral types
|
||||
************************************************************************/
|
||||
|
||||
/* ptrdiff_t */
|
||||
#if !defined(ucl_ptrdiff_t)
|
||||
#if (UINT_MAX >= UCL_0xffffffffL)
|
||||
typedef ptrdiff_t ucl_ptrdiff_t;
|
||||
#else
|
||||
typedef long ucl_ptrdiff_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Unsigned type that has *exactly* the same number of bits as a ucl_voidp */
|
||||
#if !defined(__UCL_HAVE_PTR_T)
|
||||
# if defined(ucl_ptr_t)
|
||||
# define __UCL_HAVE_PTR_T
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(__UCL_HAVE_PTR_T)
|
||||
# if defined(SIZEOF_CHAR_P) && defined(SIZEOF_UNSIGNED_LONG)
|
||||
# if (SIZEOF_CHAR_P == SIZEOF_UNSIGNED_LONG)
|
||||
typedef unsigned long ucl_ptr_t;
|
||||
typedef long ucl_sptr_t;
|
||||
# define __UCL_HAVE_PTR_T
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(__UCL_HAVE_PTR_T)
|
||||
# if defined(SIZEOF_CHAR_P) && defined(SIZEOF_UNSIGNED)
|
||||
# if (SIZEOF_CHAR_P == SIZEOF_UNSIGNED)
|
||||
typedef unsigned int ucl_ptr_t;
|
||||
typedef int ucl_sptr_t;
|
||||
# define __UCL_HAVE_PTR_T
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(__UCL_HAVE_PTR_T)
|
||||
# if defined(SIZEOF_CHAR_P) && defined(SIZEOF_UNSIGNED_SHORT)
|
||||
# if (SIZEOF_CHAR_P == SIZEOF_UNSIGNED_SHORT)
|
||||
typedef unsigned short ucl_ptr_t;
|
||||
typedef short ucl_sptr_t;
|
||||
# define __UCL_HAVE_PTR_T
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(__UCL_HAVE_PTR_T)
|
||||
# if defined(UCL_HAVE_CONFIG_H) || defined(SIZEOF_CHAR_P)
|
||||
# error "no suitable type for ucl_ptr_t"
|
||||
# else
|
||||
typedef unsigned long ucl_ptr_t;
|
||||
typedef long ucl_sptr_t;
|
||||
# define __UCL_HAVE_PTR_T
|
||||
# endif
|
||||
#if !defined(ucl_uintptr_t)
|
||||
# define ucl_uintptr_t acc_uintptr_t
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -144,13 +64,13 @@ extern "C" {
|
|||
* that are pointing to Nirvana.
|
||||
*/
|
||||
|
||||
#if defined(__UCL_DOS16) || defined(__UCL_WIN16)
|
||||
#if (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16)
|
||||
#define PTR(a) ((ucl_bytep) (a))
|
||||
/* only need the low bits of the pointer -> offset is ok */
|
||||
#define PTR_ALIGNED_4(a) ((_FP_OFF(a) & 3) == 0)
|
||||
#define PTR_ALIGNED2_4(a,b) (((_FP_OFF(a) | _FP_OFF(b)) & 3) == 0)
|
||||
#define PTR_ALIGNED_4(a) ((ACC_FP_OFF(a) & 3) == 0)
|
||||
#define PTR_ALIGNED2_4(a,b) (((ACC_FP_OFF(a) | ACC_FP_OFF(b)) & 3) == 0)
|
||||
#else
|
||||
#define PTR(a) ((ucl_ptr_t) (a))
|
||||
#define PTR(a) ((ucl_uintptr_t) (a))
|
||||
#define PTR_LINEAR(a) PTR(a)
|
||||
#define PTR_ALIGNED_4(a) ((PTR_LINEAR(a) & 3) == 0)
|
||||
#define PTR_ALIGNED_8(a) ((PTR_LINEAR(a) & 7) == 0)
|
||||
|
|
@ -160,10 +80,9 @@ extern "C" {
|
|||
|
||||
#define PTR_LT(a,b) (PTR(a) < PTR(b))
|
||||
#define PTR_GE(a,b) (PTR(a) >= PTR(b))
|
||||
#define PTR_DIFF(a,b) ((ucl_ptrdiff_t) (PTR(a) - PTR(b)))
|
||||
|
||||
|
||||
UCL_EXTERN(ucl_ptr_t)
|
||||
UCL_EXTERN(ucl_uintptr_t)
|
||||
__ucl_ptr_linear(const ucl_voidp ptr);
|
||||
|
||||
|
||||
|
|
@ -182,8 +101,7 @@ typedef union
|
|||
ucl_int32 a_ucl_int32;
|
||||
ucl_uint32 a_ucl_uint32;
|
||||
ptrdiff_t a_ptrdiff_t;
|
||||
ucl_ptrdiff_t a_ucl_ptrdiff_t;
|
||||
ucl_ptr_t a_ucl_ptr_t;
|
||||
ucl_uintptr_t a_ucl_uintptr_t;
|
||||
ucl_voidp a_ucl_voidp;
|
||||
void * a_void_p;
|
||||
ucl_bytep a_ucl_bytep;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -38,94 +38,19 @@
|
|||
// slow but portable <string.h> stuff, only used in assertions
|
||||
************************************************************************/
|
||||
|
||||
UCL_PUBLIC(int)
|
||||
ucl_memcmp(const ucl_voidp s1, const ucl_voidp s2, ucl_uint len)
|
||||
{
|
||||
#if (UCL_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMCMP)
|
||||
return memcmp(s1,s2,len);
|
||||
#else
|
||||
const ucl_byte *p1 = (const ucl_byte *) s1;
|
||||
const ucl_byte *p2 = (const ucl_byte *) s2;
|
||||
int d;
|
||||
|
||||
if (len > 0) do
|
||||
{
|
||||
d = *p1 - *p2;
|
||||
if (d != 0)
|
||||
return d;
|
||||
p1++;
|
||||
p2++;
|
||||
}
|
||||
while (--len > 0);
|
||||
return 0;
|
||||
#if !defined(__UCL_MMODEL_HUGE)
|
||||
# undef ACC_HAVE_MM_HUGE_PTR
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
UCL_PUBLIC(ucl_voidp)
|
||||
ucl_memcpy(ucl_voidp dest, const ucl_voidp src, ucl_uint len)
|
||||
{
|
||||
#if (UCL_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMCPY)
|
||||
return memcpy(dest,src,len);
|
||||
#else
|
||||
ucl_byte *p1 = (ucl_byte *) dest;
|
||||
const ucl_byte *p2 = (const ucl_byte *) src;
|
||||
|
||||
if (len <= 0 || p1 == p2)
|
||||
return dest;
|
||||
do
|
||||
*p1++ = *p2++;
|
||||
while (--len > 0);
|
||||
return dest;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
UCL_PUBLIC(ucl_voidp)
|
||||
ucl_memmove(ucl_voidp dest, const ucl_voidp src, ucl_uint len)
|
||||
{
|
||||
#if (UCL_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMMOVE)
|
||||
return memmove(dest,src,len);
|
||||
#else
|
||||
ucl_byte *p1 = (ucl_byte *) dest;
|
||||
const ucl_byte *p2 = (const ucl_byte *) src;
|
||||
|
||||
if (len <= 0 || p1 == p2)
|
||||
return dest;
|
||||
|
||||
if (p1 < p2)
|
||||
{
|
||||
do
|
||||
*p1++ = *p2++;
|
||||
while (--len > 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
p1 += len;
|
||||
p2 += len;
|
||||
do
|
||||
*--p1 = *--p2;
|
||||
while (--len > 0);
|
||||
}
|
||||
return dest;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
UCL_PUBLIC(ucl_voidp)
|
||||
ucl_memset(ucl_voidp s, int c, ucl_uint len)
|
||||
{
|
||||
#if (UCL_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMSET)
|
||||
return memset(s,c,len);
|
||||
#else
|
||||
ucl_byte *p = (ucl_byte *) s;
|
||||
|
||||
if (len > 0) do
|
||||
*p++ = UCL_BYTE(c);
|
||||
while (--len > 0);
|
||||
return s;
|
||||
#endif
|
||||
}
|
||||
#define acc_hsize_t ucl_uint
|
||||
#define acc_hvoid_p ucl_voidp
|
||||
#define acc_hbyte_p ucl_bytep
|
||||
#define ACCLIB_PUBLIC(r,f) UCL_PUBLIC(r) f
|
||||
#define acc_hmemcmp ucl_memcmp
|
||||
#define acc_hmemcpy ucl_memcpy
|
||||
#define acc_hmemmove ucl_memmove
|
||||
#define acc_hmemset ucl_memset
|
||||
#include "acc/acclib/hmemcpy.ch"
|
||||
#undef ACCLIB_PUBLIC
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/ucl/
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -34,52 +35,43 @@
|
|||
//
|
||||
************************************************************************/
|
||||
|
||||
#ifndef SWD_N
|
||||
# define SWD_N N
|
||||
#endif
|
||||
#ifndef SWD_F
|
||||
# define SWD_F F
|
||||
#endif
|
||||
#ifndef SWD_THRESHOLD
|
||||
# define SWD_THRESHOLD THRESHOLD
|
||||
#endif
|
||||
|
||||
/* unsigned type for dictionary access - don't waste memory here */
|
||||
#if (SWD_N + SWD_F + SWD_F < USHRT_MAX)
|
||||
#if (0UL + SWD_N + SWD_F + SWD_F < 0UL + USHRT_MAX)
|
||||
typedef unsigned short swd_uint;
|
||||
# define SWD_UINT_MAX USHRT_MAX
|
||||
#else
|
||||
typedef ucl_uint swd_uint;
|
||||
# define SWD_UINT_MAX UCL_UINT_MAX
|
||||
#endif
|
||||
#define swd_uintp swd_uint __UCL_MMODEL *
|
||||
#define SWD_UINT(x) ((swd_uint)(x))
|
||||
|
||||
|
||||
#ifndef SWD_HSIZE
|
||||
# define SWD_HSIZE 16384
|
||||
#endif
|
||||
#ifndef SWD_MAX_CHAIN
|
||||
# define SWD_MAX_CHAIN 2048
|
||||
#endif
|
||||
#define SWD_HSIZE (SWD_HMASK + 1)
|
||||
|
||||
#if !defined(HEAD3)
|
||||
#if 1
|
||||
# define HEAD3(b,p) \
|
||||
(((0x9f5f*(((((ucl_uint32)b[p]<<5)^b[p+1])<<5)^b[p+2]))>>5) & (SWD_HSIZE-1))
|
||||
(((0x9f5f*(((((ucl_uint32)b[p]<<5)^b[p+1])<<5)^b[p+2]))>>5) & SWD_HMASK)
|
||||
#else
|
||||
# define HEAD3(b,p) \
|
||||
(((0x9f5f*(((((ucl_uint32)b[p+2]<<5)^b[p+1])<<5)^b[p]))>>5) & (SWD_HSIZE-1))
|
||||
(((0x9f5f*(((((ucl_uint32)b[p+2]<<5)^b[p+1])<<5)^b[p]))>>5) & SWD_HMASK)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (SWD_THRESHOLD == 1) && !defined(HEAD2)
|
||||
# if 1 && defined(UCL_UNALIGNED_OK_2)
|
||||
# define HEAD2(b,p) (* (const ucl_ushortp) &(b[p]))
|
||||
#if !defined(HEAD2)
|
||||
#if (SWD_THRESHOLD == 1)
|
||||
# if 1 && defined(UA_GET2)
|
||||
# define HEAD2(b,p) UA_GET2(&(b[p]))
|
||||
# else
|
||||
# define HEAD2(b,p) (b[p] ^ ((unsigned)b[p+1]<<8))
|
||||
# endif
|
||||
# define NIL2 SWD_UINT_MAX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__UCL_CHECKER)
|
||||
|
|
@ -96,6 +88,7 @@ typedef struct
|
|||
ucl_uint n;
|
||||
ucl_uint f;
|
||||
ucl_uint threshold;
|
||||
ucl_uint hmask;
|
||||
|
||||
/* public - configuration */
|
||||
ucl_uint max_chain;
|
||||
|
|
@ -120,8 +113,8 @@ typedef struct
|
|||
#endif
|
||||
|
||||
/* private */
|
||||
const ucl_byte *dict;
|
||||
const ucl_byte *dict_end;
|
||||
const ucl_bytep dict;
|
||||
const ucl_bytep dict_end;
|
||||
ucl_uint dict_len;
|
||||
|
||||
/* private */
|
||||
|
|
@ -130,19 +123,22 @@ typedef struct
|
|||
ucl_uint rp; /* remove pointer */
|
||||
ucl_uint b_size;
|
||||
|
||||
unsigned char *b_wrap;
|
||||
ucl_bytep b_wrap;
|
||||
|
||||
ucl_uint node_count;
|
||||
ucl_uint first_rp;
|
||||
|
||||
#if defined(SWD_USE_MALLOC)
|
||||
unsigned char *b;
|
||||
swd_uint *head3;
|
||||
swd_uint *succ3;
|
||||
swd_uint *best3;
|
||||
swd_uint *llen3;
|
||||
ucl_bytep b;
|
||||
swd_uintp head3;
|
||||
swd_uintp succ3;
|
||||
swd_uintp best3;
|
||||
swd_uintp llen3;
|
||||
#ifdef HEAD2
|
||||
swd_uint *head2;
|
||||
swd_uintp head2;
|
||||
#ifdef HEAD2_VAR
|
||||
int use_head2;
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
unsigned char b [ SWD_N + SWD_F + SWD_F ];
|
||||
|
|
@ -163,10 +159,10 @@ ucl_swd_t;
|
|||
* but then its value will never be used.
|
||||
*/
|
||||
#if defined(__UCL_CHECKER)
|
||||
# define s_head3(s,key) \
|
||||
# define s_get_head3(s,key) \
|
||||
((s->llen3[key] == 0) ? SWD_UINT_MAX : s->head3[key])
|
||||
#else
|
||||
# define s_head3(s,key) s->head3[key]
|
||||
# define s_get_head3(s,key) s->head3[key]
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -175,7 +171,7 @@ ucl_swd_t;
|
|||
************************************************************************/
|
||||
|
||||
static
|
||||
void swd_initdict(ucl_swd_t *s, const ucl_byte *dict, ucl_uint dict_len)
|
||||
void swd_initdict(ucl_swd_t *s, const ucl_bytep dict, ucl_uint dict_len)
|
||||
{
|
||||
s->dict = s->dict_end = NULL;
|
||||
s->dict_len = 0;
|
||||
|
|
@ -207,15 +203,17 @@ void swd_insertdict(ucl_swd_t *s, ucl_uint node, ucl_uint len)
|
|||
while (len-- > 0)
|
||||
{
|
||||
key = HEAD3(s->b,node);
|
||||
s->succ3[node] = s_head3(s,key);
|
||||
s->succ3[node] = s_get_head3(s,key);
|
||||
s->head3[key] = SWD_UINT(node);
|
||||
s->best3[node] = SWD_UINT(s->f + 1);
|
||||
s->llen3[key]++;
|
||||
assert(s->llen3[key] <= s->n);
|
||||
|
||||
#ifdef HEAD2
|
||||
key = HEAD2(s->b,node);
|
||||
s->head2[key] = SWD_UINT(node);
|
||||
IF_HEAD2(s) {
|
||||
key = HEAD2(s->b,node);
|
||||
s->head2[key] = SWD_UINT(node);
|
||||
}
|
||||
#endif
|
||||
|
||||
node++;
|
||||
|
|
@ -228,10 +226,18 @@ void swd_insertdict(ucl_swd_t *s, ucl_uint node, ucl_uint len)
|
|||
************************************************************************/
|
||||
|
||||
static
|
||||
int swd_init(ucl_swd_t *s, const ucl_byte *dict, ucl_uint dict_len)
|
||||
int swd_init(ucl_swd_t *s, const ucl_bytep dict, ucl_uint dict_len)
|
||||
{
|
||||
ucl_uint i = 0;
|
||||
int c = 0;
|
||||
#if defined(SWD_USE_MALLOC)
|
||||
s->b = NULL;
|
||||
s->head3 = NULL;
|
||||
s->succ3 = NULL;
|
||||
s->best3 = NULL;
|
||||
s->llen3 = NULL;
|
||||
#ifdef HEAD2
|
||||
s->head2 = NULL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (s->n == 0)
|
||||
s->n = SWD_N;
|
||||
|
|
@ -242,17 +248,19 @@ int swd_init(ucl_swd_t *s, const ucl_byte *dict, ucl_uint dict_len)
|
|||
return UCL_E_INVALID_ARGUMENT;
|
||||
|
||||
#if defined(SWD_USE_MALLOC)
|
||||
s->b = (unsigned char *) ucl_alloc(s->n + s->f + s->f, 1);
|
||||
s->head3 = (swd_uint *) ucl_alloc(SWD_HSIZE, sizeof(*s->head3));
|
||||
s->succ3 = (swd_uint *) ucl_alloc(s->n + s->f, sizeof(*s->succ3));
|
||||
s->best3 = (swd_uint *) ucl_alloc(s->n + s->f, sizeof(*s->best3));
|
||||
s->llen3 = (swd_uint *) ucl_alloc(SWD_HSIZE, sizeof(*s->llen3));
|
||||
s->b = (ucl_bytep) ucl_malloc(s->n + s->f + s->f);
|
||||
s->head3 = (swd_uintp) ucl_alloc(SWD_HSIZE, sizeof(*s->head3));
|
||||
s->succ3 = (swd_uintp) ucl_alloc(s->n + s->f, sizeof(*s->succ3));
|
||||
s->best3 = (swd_uintp) ucl_alloc(s->n + s->f, sizeof(*s->best3));
|
||||
s->llen3 = (swd_uintp) ucl_alloc(SWD_HSIZE, sizeof(*s->llen3));
|
||||
if (!s->b || !s->head3 || !s->succ3 || !s->best3 || !s->llen3)
|
||||
return UCL_E_OUT_OF_MEMORY;
|
||||
#ifdef HEAD2
|
||||
s->head2 = (swd_uint *) ucl_alloc(UCL_UINT32_C(65536), sizeof(*s->head2));
|
||||
if (!s->head2)
|
||||
return UCL_E_OUT_OF_MEMORY;
|
||||
IF_HEAD2(s) {
|
||||
s->head2 = (swd_uintp) ucl_alloc(UCL_UINT32_C(65536), sizeof(*s->head2));
|
||||
if (!s->head2)
|
||||
return UCL_E_OUT_OF_MEMORY;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
@ -268,15 +276,18 @@ int swd_init(ucl_swd_t *s, const ucl_byte *dict, ucl_uint dict_len)
|
|||
s->b_wrap = s->b + s->b_size;
|
||||
s->node_count = s->n;
|
||||
|
||||
ucl_memset(s->llen3, 0, sizeof(s->llen3[0]) * SWD_HSIZE);
|
||||
ucl_memset(s->llen3, 0, (ucl_uint)sizeof(s->llen3[0]) * SWD_HSIZE);
|
||||
#ifdef HEAD2
|
||||
IF_HEAD2(s) {
|
||||
#if 1
|
||||
ucl_memset(s->head2, 0xff, sizeof(s->head2[0]) * UCL_UINT32_C(65536));
|
||||
assert(s->head2[0] == NIL2);
|
||||
ucl_memset(s->head2, 0xff, (ucl_uint)sizeof(s->head2[0]) * UCL_UINT32_C(65536));
|
||||
assert(s->head2[0] == NIL2);
|
||||
#else
|
||||
for (i = 0; i < UCL_UINT32_C(65536); i++)
|
||||
s->head2[i] = NIL2;
|
||||
ucl_uint32 i;
|
||||
for (i = 0; i < UCL_UINT32_C(65536); i++)
|
||||
s->head2[i] = NIL2;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
s->ip = 0;
|
||||
|
|
@ -299,6 +310,7 @@ int swd_init(ucl_swd_t *s, const ucl_byte *dict, ucl_uint dict_len)
|
|||
s->look = 0;
|
||||
while (s->look < s->f)
|
||||
{
|
||||
int c;
|
||||
if ((c = getbyte(*(s->c))) < 0)
|
||||
break;
|
||||
s->b[s->ip] = UCL_BYTE(c);
|
||||
|
|
@ -325,8 +337,6 @@ int swd_init(ucl_swd_t *s, const ucl_byte *dict, ucl_uint dict_len)
|
|||
ucl_memset(&s->b[s->bp+s->look],0,3);
|
||||
#endif
|
||||
|
||||
UCL_UNUSED(i);
|
||||
UCL_UNUSED(c);
|
||||
return UCL_E_OK;
|
||||
}
|
||||
|
||||
|
|
@ -345,7 +355,7 @@ void swd_exit(ucl_swd_t *s)
|
|||
ucl_free(s->head3); s->head3 = NULL;
|
||||
ucl_free(s->b); s->b = NULL;
|
||||
#else
|
||||
UCL_UNUSED(s);
|
||||
ACC_UNUSED(s);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -358,7 +368,7 @@ void swd_exit(ucl_swd_t *s)
|
|||
//
|
||||
************************************************************************/
|
||||
|
||||
static __inline__
|
||||
static
|
||||
void swd_getbyte(ucl_swd_t *s)
|
||||
{
|
||||
int c;
|
||||
|
|
@ -393,7 +403,7 @@ void swd_getbyte(ucl_swd_t *s)
|
|||
// remove node from lists
|
||||
************************************************************************/
|
||||
|
||||
static __inline__
|
||||
static
|
||||
void swd_remove_node(ucl_swd_t *s, ucl_uint node)
|
||||
{
|
||||
if (s->node_count == 0)
|
||||
|
|
@ -404,7 +414,7 @@ void swd_remove_node(ucl_swd_t *s, ucl_uint node)
|
|||
if (s->first_rp != UCL_UINT_MAX)
|
||||
{
|
||||
if (node != s->first_rp)
|
||||
printf("Remove %5d: %5d %5d %5d %5d %6d %6d\n",
|
||||
printf("Remove %5u: %5u %5u %5u %5u %6u %6u\n",
|
||||
node, s->rp, s->ip, s->bp, s->first_rp,
|
||||
s->ip - node, s->ip - s->bp);
|
||||
assert(node == s->first_rp);
|
||||
|
|
@ -417,10 +427,12 @@ void swd_remove_node(ucl_swd_t *s, ucl_uint node)
|
|||
--s->llen3[key];
|
||||
|
||||
#ifdef HEAD2
|
||||
key = HEAD2(s->b,node);
|
||||
assert(s->head2[key] != NIL2);
|
||||
if ((ucl_uint) s->head2[key] == node)
|
||||
s->head2[key] = NIL2;
|
||||
IF_HEAD2(s) {
|
||||
key = HEAD2(s->b,node);
|
||||
assert(s->head2[key] != NIL2);
|
||||
if ((ucl_uint) s->head2[key] == node)
|
||||
s->head2[key] = NIL2;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
|
@ -445,16 +457,18 @@ void swd_accept(ucl_swd_t *s, ucl_uint n)
|
|||
|
||||
/* add bp into HEAD3 */
|
||||
key = HEAD3(s->b,s->bp);
|
||||
s->succ3[s->bp] = s_head3(s,key);
|
||||
s->succ3[s->bp] = s_get_head3(s,key);
|
||||
s->head3[key] = SWD_UINT(s->bp);
|
||||
s->best3[s->bp] = SWD_UINT(s->f + 1);
|
||||
s->llen3[key]++;
|
||||
assert(s->llen3[key] <= s->n);
|
||||
|
||||
#ifdef HEAD2
|
||||
/* add bp into HEAD2 */
|
||||
key = HEAD2(s->b,s->bp);
|
||||
s->head2[key] = SWD_UINT(s->bp);
|
||||
IF_HEAD2(s) {
|
||||
/* add bp into HEAD2 */
|
||||
key = HEAD2(s->b,s->bp);
|
||||
s->head2[key] = SWD_UINT(s->bp);
|
||||
}
|
||||
#endif
|
||||
|
||||
swd_getbyte(s);
|
||||
|
|
@ -469,19 +483,13 @@ void swd_accept(ucl_swd_t *s, ucl_uint n)
|
|||
static
|
||||
void swd_search(ucl_swd_t *s, ucl_uint node, ucl_uint cnt)
|
||||
{
|
||||
#if 0 && defined(__GNUC__) && defined(__i386__)
|
||||
register const unsigned char *p1 __asm__("%edi");
|
||||
register const unsigned char *p2 __asm__("%esi");
|
||||
register const unsigned char *px __asm__("%edx");
|
||||
#else
|
||||
const unsigned char *p1;
|
||||
const unsigned char *p2;
|
||||
const unsigned char *px;
|
||||
#endif
|
||||
const ucl_bytep p1;
|
||||
const ucl_bytep p2;
|
||||
const ucl_bytep px;
|
||||
ucl_uint m_len = s->m_len;
|
||||
const unsigned char * b = s->b;
|
||||
const unsigned char * bp = s->b + s->bp;
|
||||
const unsigned char * bx = s->b + s->bp + s->look;
|
||||
const ucl_bytep b = s->b;
|
||||
const ucl_bytep bp = s->b + s->bp;
|
||||
const ucl_bytep bx = s->b + s->bp + s->look;
|
||||
unsigned char scan_end1;
|
||||
|
||||
assert(s->m_len > 0);
|
||||
|
|
@ -506,9 +514,9 @@ void swd_search(ucl_swd_t *s, ucl_uint node, ucl_uint cnt)
|
|||
ucl_uint i;
|
||||
assert(ucl_memcmp(bp,&b[node],3) == 0);
|
||||
|
||||
#if 0 && defined(UCL_UNALIGNED_OK_4)
|
||||
#if 0 && defined(UA_GET4)
|
||||
p1 += 3; p2 += 3;
|
||||
while (p1 < px && * (const ucl_uint32p) p1 == * (const ucl_uint32p) p2)
|
||||
while (p1 < px && UA_GET4(p1) == UA_GET4(p2))
|
||||
p1 += 4, p2 += 4;
|
||||
while (p1 < px && *p1 == *p2)
|
||||
p1 += 1, p2 += 1;
|
||||
|
|
@ -516,7 +524,7 @@ void swd_search(ucl_swd_t *s, ucl_uint node, ucl_uint cnt)
|
|||
p1 += 2; p2 += 2;
|
||||
do {} while (++p1 < px && *p1 == *++p2);
|
||||
#endif
|
||||
i = p1 - bp;
|
||||
i = (ucl_uint) (p1 - bp);
|
||||
|
||||
#ifdef UCL_DEBUG
|
||||
if (ucl_memcmp(bp,&b[node],i) != 0)
|
||||
|
|
@ -604,7 +612,7 @@ void swd_findbest(ucl_swd_t *s)
|
|||
|
||||
/* get current head, add bp into HEAD3 */
|
||||
key = HEAD3(s->b,s->bp);
|
||||
node = s->succ3[s->bp] = s_head3(s,key);
|
||||
node = s->succ3[s->bp] = s_get_head3(s,key);
|
||||
cnt = s->llen3[key]++;
|
||||
assert(s->llen3[key] <= s->n + s->f);
|
||||
if (cnt > s->max_chain && s->max_chain > 0)
|
||||
|
|
@ -622,11 +630,21 @@ void swd_findbest(ucl_swd_t *s)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef HEAD2
|
||||
if (swd_search2(s))
|
||||
#endif
|
||||
#if defined(HEAD2_VAR)
|
||||
if (s->use_head2) {
|
||||
if (swd_search2(s) && s->look >= 3)
|
||||
swd_search(s,node,cnt);
|
||||
} else {
|
||||
if (s->look >= 3)
|
||||
swd_search(s,node,cnt);
|
||||
}
|
||||
#elif defined(HEAD2)
|
||||
if (swd_search2(s) && s->look >= 3)
|
||||
swd_search(s,node,cnt);
|
||||
#else
|
||||
if (s->look >= 3)
|
||||
swd_search(s,node,cnt);
|
||||
#endif
|
||||
if (s->m_len > len)
|
||||
s->m_off = swd_pos2off(s,s->m_pos);
|
||||
s->best3[s->bp] = SWD_UINT(s->m_len);
|
||||
|
|
@ -648,15 +666,18 @@ void swd_findbest(ucl_swd_t *s)
|
|||
|
||||
#ifdef HEAD2
|
||||
/* add bp into HEAD2 */
|
||||
key = HEAD2(s->b,s->bp);
|
||||
s->head2[key] = SWD_UINT(s->bp);
|
||||
IF_HEAD2(s) {
|
||||
key = HEAD2(s->b,s->bp);
|
||||
s->head2[key] = SWD_UINT(s->bp);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#undef HEAD3
|
||||
#undef HEAD2
|
||||
#undef s_head3
|
||||
#undef IF_HEAD2
|
||||
#undef s_get_head3
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library is free software; you can redistribute it and/or
|
||||
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
|
||||
#include "ucl_conf.h"
|
||||
#include "ucl_util.h"
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
|
|
@ -49,75 +48,37 @@ ucl_assert(int expr)
|
|||
* copyright string in the executable of your product.
|
||||
.*/
|
||||
|
||||
const ucl_byte __ucl_copyright[] =
|
||||
"\n\n\n"
|
||||
"UCL real-time data compression library.\n"
|
||||
"$Copyright: UCL (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 Markus Franz Xaver Johannes Oberhumer $\n"
|
||||
static const char __ucl_copyright[] =
|
||||
"\r\n\n"
|
||||
"UCL data compression library.\n"
|
||||
"$Copyright: UCL (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Markus Franz Xaver Johannes Oberhumer\n"
|
||||
"<markus@oberhumer.com>\n"
|
||||
"http://www.oberhumer.com\n"
|
||||
"\n"
|
||||
"UCL version: v" UCL_VERSION_STRING ", " UCL_VERSION_DATE "\n"
|
||||
"UCL build date: " __DATE__ " " __TIME__ "\n\n"
|
||||
"UCL special compilation options:\n"
|
||||
#ifdef __cplusplus
|
||||
" __cplusplus\n"
|
||||
"http://www.oberhumer.com $\n\n"
|
||||
"$Id: UCL version: v" UCL_VERSION_STRING ", " UCL_VERSION_DATE " $\n"
|
||||
"$Built: " __DATE__ " " __TIME__ " $\n"
|
||||
"$Info: " ACC_INFO_OS
|
||||
#if defined(ACC_INFO_OS_POSIX)
|
||||
"/" ACC_INFO_OS_POSIX
|
||||
#endif
|
||||
#if defined(__PIC__)
|
||||
" __PIC__\n"
|
||||
#elif defined(__pic__)
|
||||
" __pic__\n"
|
||||
" " ACC_INFO_ARCH
|
||||
#if defined(ACC_INFO_ENDIAN)
|
||||
"/" ACC_INFO_ENDIAN
|
||||
#endif
|
||||
#if (UINT_MAX < UCL_0xffffffffL)
|
||||
" 16BIT\n"
|
||||
#endif
|
||||
#if defined(__UCL_STRICT_16BIT)
|
||||
" __UCL_STRICT_16BIT\n"
|
||||
#endif
|
||||
#if (UINT_MAX > UCL_0xffffffffL)
|
||||
" UINT_MAX=" _UCL_MEXPAND(UINT_MAX) "\n"
|
||||
#endif
|
||||
#if (ULONG_MAX > UCL_0xffffffffL)
|
||||
" ULONG_MAX=" _UCL_MEXPAND(ULONG_MAX) "\n"
|
||||
#endif
|
||||
#if defined(UCL_BYTE_ORDER)
|
||||
" UCL_BYTE_ORDER=" _UCL_MEXPAND(UCL_BYTE_ORDER) "\n"
|
||||
#endif
|
||||
#if defined(UCL_UNALIGNED_OK_2)
|
||||
" UCL_UNALIGNED_OK_2\n"
|
||||
#endif
|
||||
#if defined(UCL_UNALIGNED_OK_4)
|
||||
" UCL_UNALIGNED_OK_4\n"
|
||||
#endif
|
||||
#if defined(UCL_ALIGNED_OK_4)
|
||||
" UCL_ALIGNED_OK_4\n"
|
||||
#endif
|
||||
#if defined(__UCL_IN_MINIUCL)
|
||||
" __UCL_IN_MINIUCL\n"
|
||||
#endif
|
||||
"\n\n"
|
||||
/* RCS information */
|
||||
"$Id: UCL " UCL_VERSION_STRING " built " __DATE__ " " __TIME__
|
||||
#if defined(__GNUC__) && defined(__VERSION__)
|
||||
" by gcc " __VERSION__
|
||||
#elif defined(__BORLANDC__)
|
||||
" by Borland C " _UCL_MEXPAND(__BORLANDC__)
|
||||
#elif defined(_MSC_VER)
|
||||
" by Microsoft C " _UCL_MEXPAND(_MSC_VER)
|
||||
#elif defined(__PUREC__)
|
||||
" by Pure C " _UCL_MEXPAND(__PUREC__)
|
||||
#elif defined(__SC__)
|
||||
" by Symantec C " _UCL_MEXPAND(__SC__)
|
||||
#elif defined(__TURBOC__)
|
||||
" by Turbo C " _UCL_MEXPAND(__TURBOC__)
|
||||
#elif defined(__WATCOMC__)
|
||||
" by Watcom C " _UCL_MEXPAND(__WATCOMC__)
|
||||
" " ACC_INFO_MM
|
||||
" " ACC_INFO_CC
|
||||
#if defined(ACC_INFO_CCVER)
|
||||
" " ACC_INFO_CCVER
|
||||
#endif
|
||||
" $\n";
|
||||
|
||||
UCL_PUBLIC(const ucl_byte *)
|
||||
UCL_PUBLIC(const ucl_bytep)
|
||||
ucl_copyright(void)
|
||||
{
|
||||
return __ucl_copyright;
|
||||
#if (ACC_OS_DOS16 && ACC_CC_TURBOC)
|
||||
return (ucl_voidp) __ucl_copyright;
|
||||
#else
|
||||
return (const ucl_bytep) __ucl_copyright;
|
||||
#endif
|
||||
}
|
||||
|
||||
UCL_PUBLIC(ucl_uint32)
|
||||
|
|
@ -168,7 +129,7 @@ _ucl_version_date(void)
|
|||
#define UCL_DO16(buf,i) UCL_DO8(buf,i); UCL_DO8(buf,i+8);
|
||||
|
||||
UCL_PUBLIC(ucl_uint32)
|
||||
ucl_adler32(ucl_uint32 adler, const ucl_byte *buf, ucl_uint len)
|
||||
ucl_adler32(ucl_uint32 adler, const ucl_bytep buf, ucl_uint len)
|
||||
{
|
||||
ucl_uint32 s1 = adler & 0xffff;
|
||||
ucl_uint32 s2 = (adler >> 16) & 0xffff;
|
||||
|
|
|
|||
|
|
@ -1,180 +0,0 @@
|
|||
/* ucl_util.h -- utilities for the UCL library
|
||||
|
||||
This file is part of the UCL data compression library.
|
||||
|
||||
Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The UCL library 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.
|
||||
|
||||
The UCL 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the UCL library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
*/
|
||||
|
||||
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the library and is subject
|
||||
to change.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __UCL_UTIL_H
|
||||
#define __UCL_UTIL_H
|
||||
|
||||
#ifndef __UCL_CONF_H
|
||||
# include "ucl_conf.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// fast memcpy that copies multiples of 8 byte chunks.
|
||||
// len is the number of bytes.
|
||||
// note: all parameters must be lvalues, len >= 8
|
||||
// dest and src advance, len is undefined afterwards
|
||||
************************************************************************/
|
||||
|
||||
#if 1 && defined(HAVE_MEMCPY)
|
||||
#if !defined(__UCL_DOS16) && !defined(__UCL_WIN16)
|
||||
|
||||
#define MEMCPY8_DS(dest,src,len) \
|
||||
memcpy(dest,src,len); \
|
||||
dest += len; \
|
||||
src += len
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if 0 && !defined(MEMCPY8_DS)
|
||||
|
||||
#define MEMCPY8_DS(dest,src,len) \
|
||||
{ do { \
|
||||
*dest++ = *src++; \
|
||||
*dest++ = *src++; \
|
||||
*dest++ = *src++; \
|
||||
*dest++ = *src++; \
|
||||
*dest++ = *src++; \
|
||||
*dest++ = *src++; \
|
||||
*dest++ = *src++; \
|
||||
*dest++ = *src++; \
|
||||
len -= 8; \
|
||||
} while (len > 0); }
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(MEMCPY8_DS)
|
||||
|
||||
#define MEMCPY8_DS(dest,src,len) \
|
||||
{ register ucl_uint __l = (len) / 8; \
|
||||
do { \
|
||||
*dest++ = *src++; \
|
||||
*dest++ = *src++; \
|
||||
*dest++ = *src++; \
|
||||
*dest++ = *src++; \
|
||||
*dest++ = *src++; \
|
||||
*dest++ = *src++; \
|
||||
*dest++ = *src++; \
|
||||
*dest++ = *src++; \
|
||||
} while (--__l > 0); }
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// memcpy and pseudo-memmove
|
||||
// len is the number of bytes.
|
||||
// note: all parameters must be lvalues, len > 0
|
||||
// dest and src advance, len is undefined afterwards
|
||||
************************************************************************/
|
||||
|
||||
#define MEMCPY_DS(dest,src,len) \
|
||||
do *dest++ = *src++; \
|
||||
while (--len > 0)
|
||||
|
||||
#define MEMMOVE_DS(dest,src,len) \
|
||||
do *dest++ = *src++; \
|
||||
while (--len > 0)
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// fast bzero that clears multiples of 8 pointers
|
||||
// n is the number of pointers.
|
||||
// note: n > 0
|
||||
// s and n are undefined afterwards
|
||||
************************************************************************/
|
||||
|
||||
#if (UCL_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMSET)
|
||||
|
||||
#if 1
|
||||
#define BZERO8_PTR(s,l,n) memset((s),0,(ucl_uint)(l)*(n))
|
||||
#else
|
||||
#define BZERO8_PTR(s,l,n) memset((ucl_voidp)(s),0,(ucl_uint)(l)*(n))
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define BZERO8_PTR(s,l,n) \
|
||||
ucl_memset((ucl_voidp)(s),0,(ucl_uint)(l)*(n))
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// rotate (not used at the moment)
|
||||
************************************************************************/
|
||||
|
||||
#if 0
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
|
||||
unsigned char ucl_rotr8(unsigned char value, int shift);
|
||||
extern __inline__ unsigned char ucl_rotr8(unsigned char value, int shift)
|
||||
{
|
||||
unsigned char result;
|
||||
|
||||
__asm__ __volatile__ ("movb %b1, %b0; rorb %b2, %b0"
|
||||
: "=a"(result) : "g"(value), "c"(shift));
|
||||
return result;
|
||||
}
|
||||
|
||||
unsigned short ucl_rotr16(unsigned short value, int shift);
|
||||
extern __inline__ unsigned short ucl_rotr16(unsigned short value, int shift)
|
||||
{
|
||||
unsigned short result;
|
||||
|
||||
__asm__ __volatile__ ("movw %b1, %b0; rorw %b2, %b0"
|
||||
: "=a"(result) : "g"(value), "c"(shift));
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
/*
|
||||
vi:ts=4:et
|
||||
*/
|
||||
|
|
@ -34,7 +34,11 @@
|
|||
**************************************************************************/
|
||||
|
||||
#include <ucl/ucl.h>
|
||||
#include "lutil.h"
|
||||
#include "portab.h"
|
||||
|
||||
#include "acc/acc_inci.h"
|
||||
#include "acc/acc_lib.h"
|
||||
#include "acc/acclib/hfread.ch"
|
||||
|
||||
static const char *progname = NULL;
|
||||
|
||||
|
|
@ -58,7 +62,7 @@ ucl_uint xread(FILE *f, ucl_voidp buf, ucl_uint len, ucl_bool allow_eof)
|
|||
{
|
||||
ucl_uint l;
|
||||
|
||||
l = ucl_fread(f,buf,len);
|
||||
l = acc_hfread(f,buf,len);
|
||||
if (l > len)
|
||||
{
|
||||
fprintf(stderr,"\nsomething's wrong with your C library !!!\n");
|
||||
|
|
@ -79,7 +83,7 @@ ucl_uint xwrite(FILE *f, const ucl_voidp buf, ucl_uint len)
|
|||
|
||||
if (f != NULL)
|
||||
{
|
||||
l = ucl_fwrite(f,buf,len);
|
||||
l = acc_hfwrite(f,buf,len);
|
||||
if (l != len)
|
||||
{
|
||||
fprintf(stderr,"\nwrite error [%ld %ld] (disk full ?)\n",
|
||||
|
|
|
|||
|
|
@ -198,10 +198,7 @@ target_link_libraries(mkamsboot ucl)
|
|||
|
||||
add_library(ucl
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/alloc.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/fake16.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/getbit.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/internal.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/io.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/Makefile
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/n2_99.ch
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/n2b_99.c
|
||||
|
|
@ -218,7 +215,7 @@ add_library(ucl
|
|||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/n2e_to.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/ucl_conf.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/ucl_crc.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/ucl_dll.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/ucl_dll.ch
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/ucl_init.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/ucl_mchw.ch
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/ucl_ptr.c
|
||||
|
|
@ -226,10 +223,9 @@ add_library(ucl
|
|||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/ucl_str.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/ucl_swd.ch
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/ucl_util.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/src/ucl_util.h
|
||||
)
|
||||
|
||||
target_include_directories(ucl PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/include)
|
||||
target_include_directories(ucl PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../tools/ucl/include ${CMAKE_CURRENT_LIST_DIR}/../tools/ucl)
|
||||
|
||||
add_library(rbspeex
|
||||
${CMAKE_CURRENT_LIST_DIR}/../tools/rbspeex/rbspeex.c
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue