Newlib: Added original newlib-4.4.0.20231231 source

Signed-off-by: Maxim Logaev <maxlogaev@proton.me>
This commit is contained in:
2024-11-18 15:21:29 +03:00
committed by Max Logaev
parent 1343e83f13
commit 72a413142c
3496 changed files with 585460 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
version: '{build}'
image: Visual Studio 2019
branches:
only:
- master
- /cygwin/
skip_tags: true
shallow_clone: true
environment:
APPVEYOR_SAVE_CACHE_ON_ERROR: true
CACHE: C:\cache
CYGWIN_MIRROR: http://cygwin.mirror.constant.com
matrix:
- BUILD: x86_64-pc-cygwin
CYGWIN_ROOT: C:\cygwin64
PKGARCH: mingw64-x86_64
SETUP: setup-x86_64.exe
cache: C:\cache
install:
- if not exist %CACHE% mkdir %CACHE%
- appveyor DownloadFile http://cygwin.com/%SETUP% -FileName %CACHE%\%SETUP%
- "%CACHE%\\%SETUP% -qnNdO -R %CYGWIN_ROOT% -s %CYGWIN_MIRROR% -l %CACHE% -g -P \
gcc-core,\
gcc-g++,\
autoconf,\
automake,\
make,\
perl,\
patch,\
cocom,\
gettext-devel,\
libiconv-devel,\
libzstd-devel,\
zlib-devel,\
%PKGARCH%-gcc-core,\
%PKGARCH%-gcc-g++,\
%PKGARCH%-zlib,\
dejagnu,\
dblatex,\
docbook2X,\
docbook-xml45,\
docbook-xsl,\
texlive-collection-latexrecommended,\
texlive-collection-fontsrecommended,\
texlive-collection-pictures,\
xmlto,\
python39-lxml,\
python39-ply"
build_script: >-
%CYGWIN_ROOT%/bin/bash -lc "
cd $APPVEYOR_BUILD_FOLDER &&
mkdir build install &&
(cd winsup; ./autogen.sh) &&
cd build &&
../configure --prefix=$(realpath $(pwd)/../install) -v &&
export MAKEFLAGS=-j$(nproc) &&
make &&
make install &&
(cd */newlib; make info man) &&
(cd */newlib; make install-info install-man)"
test: off
deploy: off

20
libraries/newlib/.gitattributes vendored Normal file
View File

@@ -0,0 +1,20 @@
# -*- conf -*-
## Set merge driver for ChangeLog files
# See gnulib's lib/git-merge-changelog.c (or git-merge-changelog(1))
# for per-user setup instructions.
#
# The short version of this (optional) procedure is:
#
# (1) Install git-merge-changelog (this is the tricky part!)
#
# (2) Add something like the following to your ~/.gitconfig:
#
# [merge "merge-changelog"]
# name = GNU-style ChangeLog merge driver
# driver = git-merge-changelog %O %A %B
#
# (3) Enjoy mostly effortless ChangeLog merges, at least until the
# file gets renamed again ...
ChangeLog merge=merge-changelog

View File

@@ -0,0 +1,181 @@
name: cygwin
on:
push:
# since master is a symbolic reference to main, don't run for both
branches-ignore:
- 'master'
tags:
- '*'
jobs:
fedora-build:
runs-on: ubuntu-latest
container: fedora:latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-cygwin
pkgarch: 64
name: Fedora cross ${{ matrix.target }}
env:
HAS_SSH_KEY: ${{ secrets.SSH_KEY != '' }}
steps:
- uses: actions/checkout@v3
# install build tools
- name: Install build tools
run: |
dnf install -y autoconf automake make patch perl mingw${{ matrix.pkgarch }}-gcc-c++ mingw${{ matrix.pkgarch }}-winpthreads-static mingw${{ matrix.pkgarch }}-zlib-static
# enable 'dnf copr'
- name: Enable 'dnf copr'
run: |
dnf install -y dnf-plugins-core
# install cross-cygwin toolchain and libs from copr
- name: Install cross-cygwin toolchain and libs and cocom from copr
run: |
dnf copr enable -y yselkowitz/cygwin
dnf install -y cygwin${{ matrix.pkgarch }}-gcc-c++ cygwin${{ matrix.pkgarch }}-gettext cygwin${{ matrix.pkgarch }}-libbfd cygwin${{ matrix.pkgarch }}-libiconv cygwin${{ matrix.pkgarch }}-zlib cocom
# install doc tools
- name: Install doc tools
run: |
dnf install -y dblatex docbook2X docbook-xsl xmlto python3 python3-lxml python3-ply openssh-clients
fmtutil-sys --byfmt pdflatex && texhash
# build
- name: Configure, build and install
run: |
mkdir build install
(cd winsup && ./autogen.sh)
(cd build && ../configure --target=${{ matrix.target }} --prefix=$(realpath $(pwd)/../install) )
make -C build
make -C build/*/newlib info man
make -C build install
make -C build/*/newlib install-info install-man
# deploy documentation
- name: Deploy documentation
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
# pushes to main are deployed as preview
# pushes to cygwin-n.n.n (but not 'cygwin-n.n.n.dev') tags are deployed as stable
# other references are ignored by this step
case "${{ github.ref }}" in
refs/heads/main)
DEST='preview'
;;
refs/tags/cygwin-[0-9.]*)
DEST='stable'
;;
*)
exit 0
;;
esac
# unfuck github fuckery of HOME in a container
unset HOME
# add the hosts public key to known_hosts
mkdir -p ~/.ssh/
echo "cygwin.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKoejTnTCbXaIIMYfbX7t4tYUOQ2bTxZC3e/td3BageF" >> ~/.ssh/known_hosts
# load the key (restricted to scp only) into ssh-agent
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${{ secrets.SSH_KEY }}"
# 'make install' doesn't install faq, so instead just deploy from build directory
scp -pr build/*/winsup/doc/{cygwin-api,cygwin-ug-net,faq} cygwin-admin@cygwin.com:/sourceware/www/sourceware/htdocs/cygwin/doc/${DEST}/
if: env.HAS_SSH_KEY == 'true'
windows-build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-cygwin
pkgarch: x86_64
name: Windows native ${{ matrix.pkgarch }}
steps:
# checkout action uses the native git (we can avoid this messing up line
# endings, but this could still be dangerous e.g if we need symlinks in the
# repo)
- run: git config --global core.autocrlf input
- uses: actions/checkout@v3
# install cygwin and build tools
- name: Install Cygwin
uses: cygwin/cygwin-install-action@master
with:
platform: ${{ matrix.pkgarch }}
packages: >-
autoconf,
automake,
busybox,
cocom,
cygutils-extra,
dblatex,
dejagnu,
docbook-xml45,
docbook-xsl,
docbook2X,
gcc-g++,
gettext-devel,
libiconv,
libiconv-devel,
libzstd-devel,
make,
mingw64-${{ matrix.pkgarch }}-gcc-g++,
mingw64-${{ matrix.pkgarch }}-zlib,
patch,
perl,
python39-lxml,
python39-ply,
texlive-collection-fontsrecommended,
texlive-collection-latexrecommended,
texlive-collection-pictures,
xmlto,
zlib-devel
# build
- name: Build Cygwin
run: >-
export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32 &&
mkdir build install &&
(cd winsup; ./autogen.sh) &&
cd build &&
../configure --prefix=$(realpath $(pwd)/../install) -v &&
export MAKEFLAGS=-j$(nproc) &&
make &&
make install &&
(cd */newlib; make info man) &&
(cd */newlib; make install-info install-man)
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
# test
- name: Test Cygwin
run: >-
export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32 &&
export MAKEFLAGS=-j$(nproc) &&
cd build &&
(export PATH=${{ matrix.target }}/winsup/testsuite/testinst/bin:${PATH} && cmd /c $(cygpath -wa ${{ matrix.target }}/winsup/cygserver/cygserver) &) &&
(cd ${{ matrix.target }}/winsup; make check AM_COLOR_TESTS=always)
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
# upload test logs to facilitate investigation of problems
- name: Upload test logs
uses: actions/upload-artifact@v3
with:
name: testlogs
path: |
build/${{ matrix.target }}/winsup/testsuite/**/*.log
build/${{ matrix.target }}/winsup/testsuite/**/*.trs
if: ${{ !cancelled() }}
# workaround problems with actions/checkout post-run step using cygwin git
- name: Avoid actions/checkout post-run step using Cygwin git
run: bash -c 'rm /usr/bin/git.exe'

48
libraries/newlib/.gitignore vendored Normal file
View File

@@ -0,0 +1,48 @@
*.diff
*.patch
*.orig
*.rej
*~
.#*
*#
*.flt
*.gmo
*.info
*.la
*.lo
*.o
*.pyc
*.swp
*.tmp
.deps
.libs
autom4te.cache
config.cache
config.h
config.intl
config.log
config.status
libtool
POTFILES
*-POTFILES
winsup/aclocal.m4
winsup/configure
winsup/**/Makefile.in
tags
TAGS
TAGS.sub
.gdbinit
.gdb_history
# ignore core files, but not java/net/protocol/core/
core
!core/
lost+found

View File

@@ -0,0 +1 @@
Deprecated. See git log instead.

File diff suppressed because it is too large Load Diff

283
libraries/newlib/HOWTO Normal file
View File

@@ -0,0 +1,283 @@
This HOWTO file contains notes for maintainers and contributors to Newlib.
For information on using Newlib (building, installing), see README. (In
particular, the "Regenerating Configuration Files" section in README is of
interest to both users and contributors.)
(This file could probably use some other "sections" in addition to the
initially-provided sections. Please help by adding as appropriate.)
DOCUMENTATION
=============
All the documentation for Newlib comes as part of the machine-readable
distribution. Functions are documented in the source files, although not
every file contains documentation, as many functions share manual page
information. For example, lround(), lroundf(), llround(), and llroundf()
share a single man page, which is in the source for lround(). The documentation
is written partially in a custom format and partially in Texinfo format.
The custom part comprises makedoc.c and doc.str, both of which are in the
doc directory. doc.str is a macro file that can be used to define things to
be done by makedoc, using building blocks that are built into makedoc.c.
The basic function of makedoc is two-fold. First, it recognizes comments in
the proper format to pull out of source files. Second, it adds some Texinfo
commands as well as translating certain sequences into the appropriate
Texinfo commands. Refer to makedoc.c and doc.str for what these are.
(makedoc.c is not particularly-well commented.) Another way to see how they
work is to simply examine the source files with documentation comments.
(A couple of examples that use some of the fancier options:
libm/common/s_isnan.c ("o+" variable-"bullet" list),
libc/stdio/sprintf.c ("O+" bullet list; "." for example code).)
In addition to the makedoc.c stuff, Texinfo commands can be directly
used. Texinfo is a documentation system that uses a single source file to
produce both on-line information and a printed manual. You can use one of the
Info formatting commands to create the on-line version of the documentation
and TeX (or `texi2roff') to typeset the printed version. While Newlib contains
a copy of the texinfo package (texinfo.tex), the manual for it is not
included. The latest one may be found at
https://www.gnu.org/software/texinfo/manual/texinfo/texinfo.html
(which could be for a newer version of texinfo.tex than is included in Newlib).
In addition to Texinfo commands, straight TeX commands can also be used,
but these, however, should be carefully limited and be given alternates for
when a non-printed manual is produced--such as when info pages are produced.
For an example of this kind of usage, see libm/common/s_logb.c.
If writing a new function that requires documentation, the required
sections are FUNCTION, INDEX, SYNOPSIS, DESCRIPTION, RETURNS,
and PORTABILITY. BUGS, NOTES, SEEALSO and WARNINGS should be added as
appropriate.
Source files which contain documentation are processed into ".def"
files with the extracted information. These .def files are noted in the
makefiles as CHEWOUT_FILES. These .def files need to be included into an
appropriate .tex file for inclusion in the manuals (one each for libc and libm).
Pay special attention under libc, as the manual is arranged by header file name,
but not all header files are represented by directories (e.g. wcsftime.c is
found under libc/time, but goes under wchar.h in the manual.)
In summary, to add new documentation:
1. Add properly-formatted comments to source file (e.g. src.c);
2. add "chewout" file to CHEWOUT_FILES list in Makefile.am (e.g. src.def),
re-generate Makefile.in;
3. @include that .def file in the appropriate .tex file, add texinfo menu
entries that reference the @node(s) in that .def file;
4. make ChangeLog entry and generate patch.
EL/IX (ELIX_LEVEL_n, ELIX_n_SOURCES)
====================================
Some of the Makefiles contain definitions of ELIX_LEVEL_1 ... ELIX_LEVEL_4,
and corresponding definitions for ELIX_1_SOURCES ... ELIX_4_SOURCES.
These are referring to the EL/IX standards created by Red Hat for the
purpose of Linux-based open standards for embedded development. In brief,
the intent is to define multiple levels for API functions that allows the
user to size the library appropriately for their application--at least in
terms of the predefined lists. For full details, refer to the EL/IX home
page at https://sourceware.org/elix/. The likely best way to tell how to
classify any new functions in terms of needing an ELIX level qualification
is to ask Jeff Johnston. To see how it works and try classification on your
own, refer to the API specification on the web site,
https://sourceware.org/elix/api/current/api.pdf
(Unfortunately, it is not complete with respect to either the C99 or POSIX
standards, so particular C and POSIX functions may or may not be found.)
The following definitions of the levels are from the (draft) standard.
Level 1
RTOS compatible layer. Functions available in both Linux and a
typical deeply embedded operating system (eCos, RTEMS, VxWorks, pSOS, VRTX32,
etc.). Some functions may have reduced or modified semantics.
Level 2
Linux single process only. Includes level 1 plus any functions from Linux
that are not easily implemented on an RTOS. Also full implementations of
reduced functions in Level 1.
Level 3
Linux multiprocess for embedded applications. This is basically POSIX.1
with some of the functions that are obviously not for embedded applications
(such as job control) removed.
Level 4
Full POSIX or Linux compliance. Essentially these are functions that are
present in a standard Linux kernel but are irrelevant to an embedded system.
These functions do not form part of the EL/IX API.
BUILD SYSTEM
============
Newlib utilizes GNU Autotools (GNU Autoconf & GNU Automake) for its build
system. It can be broken down into two phases: configure & compile (make).
NB: GNU Libtool is not used. Newlib only produces static archives, and GNU
Automake is capable of handling that.
As noted in the README file, you do not need to worry about which tools to
run at any particular point. Simply invoke `autoreconf` and it will do it all.
Tool versions are tightly controlled. GNU Autoconf 2.69 exactly must be
used. Attempts to use any other version, newer or older, will be rejected. If
the current system does not include that version, it can be downloaded from the
GNU Autoconf website and installed into a local directory tree (like ~/.local).
GNU Automake 1.15.1 is required as a minimum. Newer versions are allowed when
running locally, but developers submitting patches must use 1.15.1 exactly.
The configure phase naturally starts with the configure script. It merges
multiple inputs to produce the final script.
* aclocal.m4: Generated by aclocal; do not edit. Copies all the various m4
macros used by configure from the system install into the local copy. This
allows regenerating configure without needing all the same system packages.
* autom4te.cache/: Generated by aclocal to cache system search results. Safe
to delete at any time, but never edit anything in this directory.
* iconv.m4: Generated by libc/iconv/ces/mkdeps.pl; do not edit. Keeps the
set of dynamic iconv synced between the source files and configure.
* acinclude.m4: Historically, a way of sharing configure logic with subdirs.
At some point, it should all be merged into configure.ac directly.
* configure.ac: The main configure script for supporting all Newlib options.
* configure.host: An index of every supported Newlib host and the settings to
use when compiling for it.
* **/acinclude.m4: Subdirectories may include custom configure tests without
having to clutter the common configure.ac or acinclude.m4 file. When adding
a new file, it must be manually included -- there is no mechanism to search
and automatically include every such file in the tree. Look for m4_include
lines in configure.ac or existing acinclude.m4 files as examples. Care must
be taken to not run excessive tests for incompatible targets, or to declare
generic names or symbols that can collide with other targets. Any such file
should try to match $host (or similar) settings before running. Settings
from configure.host (e.g. machine_dir or sys_dir) are guaranteed to be
available. When creating names (Makefile variables, defines, etc...), try to
include the respective library and machine or sys name. Do not confuse these
with the historical top-level acinclude.m4 file!
The configure script has to take special consideration to the fact that it
usually runs with a toolchain that lacks a C library (since Newlib will provide
it once it's compiled & installed). Newlib uses the uncommon AC_NO_EXECUTABLES
macro to tell GNU Autoconf to not automatically require a toolchain that can
link executables. As a result, Newlib itself cannot perform any link tests.
It shouldn't really need to, but configure authors must keep this in mind and
stick to the appropriate source-level test -- AC_PREPROC for testing behavior
of the preprocessor and AC_COMPILE for testing compiler behavior.
The newlib.h header is created from newlib.hin during the configure phase.
The newlib.hin file is managed by autoheader, so do not edit it directly. Any
symbol declared in configure via AC_DEFINE is automatically included. The file
declares all the Newlib-specific configure settings and will be installed as
part of the standard set of headers. Critically, all symbols are namespaced
with a leading _ prefix to avoid collisions with user code, and any symbols not
namespaced are automatically removed. This is necessary due to some system m4
macros automatically adding their own defines that we cannot disable. It also
means that, when using AC_DEFINE, the _ prefix must be manually added.
A single Makefile is created during the configure phase. This will build
all of Newlib using non-recursive make (i.e., there are no subdirectories with
their own Makefiles). The single Makefile.am file includes Makefile.inc files
in its immediate subdirectories, and those further include Makefile.inc files
in their subdirectories. This means all variables and targets exist in a
single global flat namespace, so care must be taken to not use generic names
like "SOURCES" in any Makefile.inc file. Instead, use %C%_ on all variables to
get a unique prefix, and GNU Automake will expand it. In order to use one of
the standard GNU Automake variables (e.g., CLEANFILES), first declare it at the
top of the Makefile.am by assigning it (e.g., CLEANFILES =), and then always
append to it in Makefile.inc (e.g. CLEANFILES += ...). Again, GNU Automake
will take care of combining all of this logic together to produce a portable
Makefile.
Developers used to changing to a subdirectory and running make commands
to iterate quickly on a smaller section of Newlib might be surprised that this
does not work -- there is no Makefile in any subdirectory. Instead, make has
to be run from the top-level, and the full path to the target is specified.
So instead of running `cd subdir && make foo.o`, run `make subdir/foo.o`. This
applies to any target, not just objects. Some common targets:
make libm.a
make libc.a
Conditionals are allowed in Makefile.inc files, but using them to elide
an entire subdir Makefile.inc should be avoided. Instead, GNU Automake
conditionals should be used only within a single Makefile.inc file to control
settings specific to that directory. See the documentation section below for
more information.
Per-directory compiler settings are allowed. Similar to the syntax used
above, the _%C% suffix can be used. See the Makefile.am file for the current
set of flags (e.g. CFLAGS, CPPFLAGS, etc...) that are supported.
AM_CFLAGS_%C% = ...
libm_a_CFLAGS_%C% = ...
libc_a_CFLAGS_%C% = ...
Per-file compiler settings are allowed. Similar to the syntax used
above, the _%C% suffix can be used. See the Makefile.am file for the current
set of flags (e.g. CFLAGS, CPPFLAGS, etc...) that are supported.
AM_CFLAGS_%C%_moo.c = ...
libm_a_CFLAGS_%C%_foo.c = ...
libc_a_CFLAGS_%C%_bar.c = ...
An important aspect of the build system is allowing machine-specific
directories to override common implementations. For example, Newlib provides
generic C implementations of string & memory functions in libc/string/ that
perform adequately for any target, but many architectures include hand written
assembly files for smaller & faster execution. Those files live under the
corresponding libc/machine/<ARCHITECTURE>/ directory. Both versions are
compiled when building Newlib, but when generating the libc.a archive, the
common object is added first, followed by the machine-specific one. This works
because the object names follow a consistent convention: libm_a-<filename>.o
for the math library and libc_a-<filename>.o for the C library. If the common
code stores a function foo in foo.c, then it can be overridden by another foo.c
or foo.S or foo.s file since they all produce foo.o. For this reason, all
machine Makefile.inc files must be included last after all common Makefile.inc
files.
Note that the Makefiles do not use VPATH to search source files across
multiple source directories. VPATH is used to match a single build directory
to the corresponding source directory, but that is it. For more details on
how machine directories override functions in common directories, see the
previous section.
Keep in mind that machine overrides only work at the file level, not at
the symbol level. If a common file defines multiple symbols, then the machine
override must define all the same symbols. This is why most common code stores
only one function per source file.
The documentation, both the manual and man pages and header references,
should be consistent regardless of what configure options are used (including
the target system). This makes it easy to get a complete documentation build
at all times. If inclusion of chapters depended on specific configure options,
it would be difficult to find the set of options necessary to produce the
complete manual, if it were even possible in the first place (as some configure
options are incompatible). Since documentation chapters & APIs are declared in
the respective directories and not in a centralized location, it is important
to not use any GNU Automake conditional to control whether Makefile.inc files
are included. Documentation that covers optional APIs should note that it is
not guaranteed to be included in every build of Newlib for every target. The
level of detail is left up to the author's discretion.
Newlib automatically builds itself for all multilib configurations that
the active toolchain supports. This logic is provided by common code from the
combined toolchain source tree, but bolts itself into the GNU Autoconf and
Automake files. The critical parts to keep in mind:
* ../config/multi.m4: AM_ENABLE_MULTILIB adds the --{en,dis}able-multilib
options to configure for users, and takes care of calling ../config-ml.in
for the Makefile in the current directory. While not applicable to Newlib
anymore (since Newlib only produces a single Makefile now), this does not
automatically run for any subdir Makefiles. Instead, it must be run manually
in AC_CONFIG_FILES's commands argument.
* ../config-ml.in: Rewrites the specified Makefile to include the various
multilib variables and the multi-do command. Notably, this only makes the
multi-do rule available, it does not cause it to be used anywhere.
* ../multilib.am: Manually included in Newlib's Makefile.am. This adds calls
to multi-do for the common important rules: all (i.e. compiling), install,
clean, etc...
* FLAGS_TO_PASS: Newlib's Makefile.am declares all the variables to pass to
each multilib configuration via the multi-do rule. While the multi-do rule
includes many common flags automatically, Newlib passes along a few extra
that are unique to it.
The testsuite is not integrated at all currently. It is not really well
tested in general. The README file has more information. Hopefully someone
someday will step up to integrate it into the existing framework.

View File

@@ -0,0 +1,68 @@
Newlib Maintainers
Blanket Write Privileges
The official maintainers of newlib:
Corinna Vinschen corinna@vinschen.de
Jeff Johnston jjohnstn@redhat.com
Various Domain Maintainers
This is a list of maintainers who look after specific domains of newlib.
Individuals who maintain parts of newlib need approval to check in changes
outside of the immediate domain that they maintain.
If there is no maintainer for a given domain then the responsibility
falls to the head maintainers.
If there are several maintainers for a given domain then
responsibility falls to the first maintainer. The first maintainer is
free to devolve that responsibility among the other maintainers.
Makefile.in, configure*: jjohnstn@redhat.com
Cygwin: corinna@vinschen.de
Web pages: jjohnstn@redhat.com
CPU Port Maintainers (CPU alphabetical order)
CPU port maintainers may make changes in cpu-specific directories, as
well as cpu-specific portions of the build system, without approval.
arm Nick Clifton nickc@redhat.com
Richard Earnshaw richard.earnshaw@arm.com
bfin Mike Frysinger vapier@gentoo.org
mn10300 Nick Clifton nickc@redhat.com
moxie Anthony Green green@moxielogic.com
risc-v Kito Cheng kito.cheng@gmail.com
aarch64 Richard Earnshaw richard.earnshaw@arm.com
Marcus Shawcroft marcus.shawcroft@arm.com
msp430 Nick Clifton nickc@redhat.com
OS Port Maintainers (OS alphabetical order)
OS port maintainers may make changes in OS-specific directories, as
well as OS-specific portions of the build system, without approval.
RTEMS Joel Sherrill joel.sherrill@oarcorp.com
Sebastian Huber sebastian.huber@embedded-brains.de
simulator Mike Frysinger vapier@gentoo.org
Write After Approval
These are users with general write privileges after getting approval:
Anthony Green green@moxielogic.com
DJ Delorie dj@redhat.com
Jim Wilson jimw@sifive.com
Nick Clifton nickc@redhat.com
Eric Blake eblake@redhat.com
Will Newton will.newton@linaro.org
Sebastian Huber sebastian.huber@embedded-brains.de
Joel Sherrill joel.sherrill@oarcorp.com
Mike Frysinger vapier@gentoo.org

View File

@@ -0,0 +1,448 @@
## Process this file with automake to generate Makefile.in
AUTOMAKE_OPTIONS = dejagnu
ACLOCAL_AMFLAGS = -I . -I .. -I ../config
# Variables that will accumulate in subdirs.
CLEANFILES =
EXTRA_DIST =
EXTRA_PROGRAMS =
PHONY =
SUFFIXES =
check_PROGRAMS =
info_TEXINFOS =
noinst_DATA =
INSTALL_DATA_LOCAL =
# The newlib hardware floating-point routines have been disabled due to
# inaccuracy. If you wish to work on them, you will need to edit the
# configure.in file to re-enable the configuration option. By default,
# the NEWLIB_HW_FP variable will always be false.
if NEWLIB_HW_FP
MATHDIR = mathfp
else
MATHDIR = math
endif
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile.
AM_MAKEFLAGS = \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CFLAGS=$(CFLAGS)" \
"CCASFLAGS=$(CCASFLAGS)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
"INSTALL=$(INSTALL)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
"MAKE=$(MAKE)" \
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
"SHELL=$(SHELL)" \
"EXPECT=$(EXPECT)" \
"RUNTEST=$(RUNTEST)" \
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
"exec_prefix=$(exec_prefix)" \
"infodir=$(infodir)" \
"libdir=$(libdir)" \
"prefix=$(prefix)" \
"tooldir=$(tooldir)" \
"top_toollibdir=$(toollibdir)" \
"AR=$(AR)" \
"AS=$(AS)" \
"CC=$(CC_FOR_NEWLIB)" \
"LD=$(LD)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"NM=$(NM)" \
"PICFLAG=$(PICFLAG)" \
"RANLIB=$(RANLIB)" \
"DESTDIR=$(DESTDIR)"
FLAGS_TO_PASS=$(AM_MAKEFLAGS)
srcroot = $(top_srcdir)/..
tooldir = $(exec_prefix)/$(host_alias)
toollibdir = $(tooldir)/lib$(MULTISUBDIR)
# These are useful for standalone object files like crt0.o.
AM_CFLAGS = $(AM_CFLAGS_$(subst /,_,$(@D))) $(AM_CFLAGS_$(subst /,_,$(@D)_$(<F)))
AM_CCASFLAGS = $(AM_CCASFLAGS_$(subst /,_,$(@D))) $(AM_CCASFLAGS_$(subst /,_,$(@D)_$(<F)))
AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) $(AM_CPPFLAGS_$(subst /,_,$(@D))) $(AM_CPPFLAGS_$(subst /,_,$(@D)_$(<F))) -idirafter $(srcroot)/include
toollib_LIBRARIES = libm.a \
libc.a
noinst_DATA += libg.a
if HAVE_MULTISUBDIR
BUILD_MULTISUBDIR = $(builddir)$(MULTISUBDIR)
if HAVE_CRT0
noinst_DATA += $(BUILD_MULTISUBDIR)/$(CRT0)
endif
noinst_DATA += $(BUILD_MULTISUBDIR)/libc.a $(BUILD_MULTISUBDIR)/libm.a
endif
toollib_DATA = $(CRT0) $(CRT1)
CLEANFILES += libg.a
## GNU ar has undocumented behavior when specifying the same name multiple times
## in a single invocation, so we have to dedupe ourselves. The algorithm here:
## - Generates the set of unique objects based on the basename.
## - Favors objects later in the list (since machine objects come last).
## - Outputs object list in same order as input for reproducibility.
## https://sourceware.org/PR28917
AWK_UNIQUE_OBJS = $(AWK) '{ \
for (i = NF; i > 0; --i) { \
count = split($$i, parts, "/"); \
name = parts[count]; \
if (!(name in seen)) { \
objs[i] = $$i; \
seen[name] = 1; \
} \
} \
for (i in objs) \
print objs[i]; \
}'
# Recursive Wildcard function
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2)$(filter $(subst *,%,$2),$d))
# The functions ldexp, frexp and modf are traditionally supplied in
# both libc.a and libm.a. We build them in libm.a and copy them over,
# along with some required supporting routines.
MATHOBJS_IN_LIBC = \
libm_a-s_fpclassify.o libm_a-sf_fpclassify.o \
libm_a-s_isinf.o libm_a-sf_isinf.o \
libm_a-s_isnan.o libm_a-sf_isnan.o \
libm_a-s_isinfd.o libm_a-sf_isinff.o \
libm_a-s_isnand.o libm_a-sf_isnanf.o \
libm_a-s_nan.o libm_a-sf_nan.o \
libm_a-s_ldexp.o libm_a-sf_ldexp.o \
libm_a-s_frexp.o libm_a-sf_frexp.o libm_a-frexpl.o \
libm_a-s_modf.o \
libm_a-sf_modf.o libm_a-s_scalbn.o \
libm_a-sf_scalbn.o \
libm_a-s_finite.o libm_a-sf_finite.o \
libm_a-s_copysign.o libm_a-sf_copysign.o
## Place the libm_a objects in libc/ to keep the top dir tidy.
stamp-libc-math-objects: libm.a
$(AM_V_GEN)cd libc && $(AR) x ../$< $(MATHOBJS_IN_LIBC)
$(AM_V_at)touch $@
CLEANFILES += $(MATHOBJS_IN_LIBC)
libc_a_SOURCES =
libc_a_CFLAGS = $(AM_CFLAGS) $(libc_a_CFLAGS_$(subst /,_,$(@D))) $(libc_a_CFLAGS_$(subst /,_,$(@D)_$(<F)))
libc_a_CCASFLAGS = $(AM_CCASFLAGS) $(libc_a_CCASFLAGS_$(subst /,_,$(@D))) $(libc_a_CCASFLAGS_$(subst /,_,$(@D)_$(<F)))
libc_a_CPPFLAGS = $(AM_CPPFLAGS) $(libc_a_CPPFLAGS_$(subst /,_,$(@D))) $(libc_a_CPPFLAGS_$(subst /,_,$(@D)_$(<F)))
libc_a_DEPENDENCIES = stamp-libc-math-objects
## Best to avoid libc_a_LIBADD entirely to avoid having 2 independent lists
## with separate overriding behavior (libc_a_OBJECTS is the other). See the
## AWK_UNIQUE_OBJS comment aove for more details.
$(libc_a_OBJECTS) $(libc_a_LIBADD): stmp-targ-include
libc.a: $(libc_a_OBJECTS) $(libc_a_DEPENDENCIES)
$(AM_V_at)rm -f $@
$(AM_V_AR)objs=`echo $(libc_a_OBJECTS) | $(AWK_UNIQUE_OBJS)` || exit $$?; \
$(AR) $(ARFLAGS) $@ $$objs $(MATHOBJS_IN_LIBC:%=libc/%)
$(AM_V_at)$(RANLIB) $@
libg.a: libc.a
$(AM_V_GEN)ln libc.a libg.a >/dev/null 2>/dev/null || cp libc.a libg.a
libm_a_SOURCES =
libm_a_CFLAGS = $(AM_CFLAGS) $(libm_a_CFLAGS_$(subst /,_,$(@D))) $(libm_a_CFLAGS_$(subst /,_,$(@D)_$(<F)))
libm_a_CCASFLAGS = $(AM_CCASFLAGS) $(libm_a_CCASFLAGS_$(subst /,_,$(@D))) $(libm_a_CCASFLAGS_$(subst /,_,$(@D)_$(<F)))
libm_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/libm/common $(libm_a_CPPFLAGS_$(subst /,_,$(@D))) $(libm_a_CPPFLAGS_$(subst /,_,$(@D)_$(<F)))
## Best to avoid libm_a_LIBADD entirely to avoid having 2 independent lists
## with separate overriding behavior (libm_a_OBJECTS is the other). See the
## AWK_UNIQUE_OBJS comment aove for more details.
$(libm_a_OBJECTS): stmp-targ-include
libm.a: $(libm_a_OBJECTS) $(libm_a_DEPENDENCIES)
$(AM_V_at)rm -f $@
$(AM_V_AR)objs=`echo $(libm_a_OBJECTS) | $(AWK_UNIQUE_OBJS)` || exit $$?; \
$(AR) $(ARFLAGS) $@ $$objs
$(AM_V_at)$(RANLIB) $@
if HAVE_MULTISUBDIR
$(BUILD_MULTISUBDIR):
$(AM_V_at)$(MKDIR_P) $@
$(BUILD_MULTISUBDIR)/crt0.o: $(CRT0_DIR)$(CRT0) $(BUILD_MULTISUBDIR)
$(AM_V_at)rm -f $@
$(AM_V_GEN)ln $< $@ >/dev/null 2>/dev/null || cp $< $@
$(BUILD_MULTISUBDIR)/libc.a: libc.a $(BUILD_MULTISUBDIR)
$(AM_V_at)rm -f $@
$(AM_V_GEN)ln $< $@ >/dev/null 2>/dev/null || cp $< $@
$(BUILD_MULTISUBDIR)/libg.a: libg.a ${BUILD_MULTISUBDIR}
$(AM_V_at)rm -f $@
$(AM_V_GEN)ln $< $@ >/dev/null 2>/dev/null || cp $< $@
$(BUILD_MULTISUBDIR)/libm.a: libm.a $(BUILD_MULTISUBDIR)
$(AM_V_at)rm -f $@
$(AM_V_GEN)ln $< $@ >/dev/null 2>/dev/null || cp $< $@
endif
crt0.o: $(CRT0_DIR)$(CRT0)
$(AM_V_at)rm -f $@
$(AM_V_GEN)ln $< $@ >/dev/null 2>/dev/null || cp $< $@
$(CRT0_DIR)$(CRT0): stmp-targ-include
crt1.o: $(CRT1_DIR)$(CRT1)
$(AM_V_at)rm -f $@
$(AM_V_GEN)ln $< $@ >/dev/null 2>/dev/null || cp $< $@
$(CRT1_DIR)$(CRT1): stmp-targ-include
targ-include:
$(AM_V_GEN)$(MKDIR_P) $@
targ-include/newlib.h: targ-include/_newlib_version.h
targ-include/sys targ-include/machine targ-include/bits: targ-include/_newlib_version.h targ-include/newlib.h
$(AM_V_GEN)$(MKDIR_P) $@
targ-include/newlib.h: newlib.h targ-include
$(AM_V_GEN)cp newlib.h $@
targ-include/_newlib_version.h: _newlib_version.h targ-include
$(AM_V_GEN)cp _newlib_version.h $@
# The targ-include directory just holds the includes files for the
# particular system and machine we have been configured for. It is
# used while building.
TARG_INCLUDE_CP_DIR = \
; srcdir="$(srcdir)/libc/$$s"; dstdir="targ-include/$$d"; \
if (cd $$srcdir 2>/dev/null && [ "`echo *.h`" != "*.h" ]); then cp $$srcdir/*.h $$dstdir/; fi
stmp-targ-include: config.status
$(AM_V_GEN)rm -rf targ-include stmp-targ-include
$(AM_V_at)$(MAKE) targ-include/sys \
targ-include/machine \
targ-include/bits
$(AM_V_at)if [ -n "$(shared_machine_dir)" ]; then \
s=machine/$(shared_machine_dir)/machine d=machine $(TARG_INCLUDE_CP_DIR) || exit $$?; \
s=machine/$(shared_machine_dir)/sys d=sys $(TARG_INCLUDE_CP_DIR) || exit $$?; \
s=machine/$(shared_machine_dir)/include d= $(TARG_INCLUDE_CP_DIR) || exit $$?; \
fi
$(AM_V_at)s=machine/$(machine_dir)/machine d=machine $(TARG_INCLUDE_CP_DIR)
$(AM_V_at)s=machine/$(machine_dir)/sys d=sys $(TARG_INCLUDE_CP_DIR)
$(AM_V_at)s=machine/$(machine_dir)/include d= $(TARG_INCLUDE_CP_DIR)
$(AM_V_at)s=sys/$(sys_dir)/include d= $(TARG_INCLUDE_CP_DIR)
$(AM_V_at)for i in $(call rwildcard,$(srcdir)/libc/sys/$(sys_dir)/include/,*.h); do \
f=`echo $$i | sed s:^$(srcdir)/libc/sys/$(sys_dir)/include/::`; \
$(MKDIR_P) targ-include/`dirname $$f`; \
cp $$i targ-include/$$f; \
done
$(AM_V_at)s=sys/$(sys_dir)/sys d=sys $(TARG_INCLUDE_CP_DIR)
$(AM_V_at)s=sys/$(sys_dir)/bits d=bits $(TARG_INCLUDE_CP_DIR)
$(AM_V_at)s=sys/$(sys_dir)/machine d=machine $(TARG_INCLUDE_CP_DIR)
$(AM_V_at)s=sys/$(sys_dir)/machine/$(machine_dir) d=machine $(TARG_INCLUDE_CP_DIR)
$(AM_V_at)s=sys/$(sys_dir)/machine/$(machine_dir)/include d=machine $(TARG_INCLUDE_CP_DIR)
$(AM_V_at)$(MAKE) targ-include/newlib.h
$(AM_V_at)touch $@
CLEANFILES += stmp-targ-include
## We hook install-multi because this Makefile doesn't have any exec targets,
## only data targets. If that ever changes, this should be removed and the
## install-exec-local in ../multilib.am will kick in.
install-data-local: install-toollibLIBRARIES install-multi $(INSTALL_DATA_LOCAL)
rm -f $(DESTDIR)$(toollibdir)/libg.a
ln $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a >/dev/null 2>/dev/null || cp $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a
-if [ -z "$(MULTISUBDIR)" ]; then \
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include; \
for i in $(srcdir)/libc/include/*.h; do \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/`basename $$i`; \
done; \
$(INSTALL_DATA) newlib.h $(DESTDIR)$(tooldir)/include/newlib.h; \
$(INSTALL_DATA) _newlib_version.h $(DESTDIR)$(tooldir)/include/_newlib_version.h; \
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/machine; \
for i in $(srcdir)/libc/include/machine/*.h; do \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/machine/`basename $$i`; \
done; \
if [ -n "$(shared_machine_dir)" ]; then \
for i in $(srcdir)/libc/machine/$(shared_machine_dir)/machine/*.h; do \
if [ -f $$i ]; then \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/machine/`basename $$i`; \
else true; fi ; \
done; \
fi ; \
for i in $(srcdir)/libc/machine/$(machine_dir)/machine/*.h; do \
if [ -f $$i ]; then \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/machine/`basename $$i`; \
else true; fi ; \
done; \
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/rpc; \
for i in $(srcdir)/libc/include/rpc/*.h; do \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/rpc/`basename $$i`; \
done; \
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/ssp; \
for i in $(srcdir)/libc/include/ssp/*.h; do \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/ssp/`basename $$i`; \
done; \
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/sys; \
for i in $(srcdir)/libc/include/sys/*.h; do \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/sys/`basename $$i`; \
done; \
if [ -n "$(shared_machine_dir)" ]; then \
for i in $(srcdir)/libc/machine/$(shared_machine_dir)/sys/*.h; do \
if [ -f $$i ]; then \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/sys/`basename $$i`; \
else true; fi ; \
done ; \
for i in $(srcdir)/libc/machine/$(shared_machine_dir)/include/*.h; do \
if [ -f $$i ]; then \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/`basename $$i`; \
else true; fi ; \
done ; \
fi ; \
for i in $(srcdir)/libc/machine/$(machine_dir)/sys/*.h; do \
if [ -f $$i ]; then \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/sys/`basename $$i`; \
else true; fi ; \
done ; \
for i in $(srcdir)/libc/machine/$(machine_dir)/include/*.h; do \
if [ -f $$i ]; then \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/`basename $$i`; \
else true; fi ; \
done ; \
for i in $(srcdir)/libc/sys/$(sys_dir)/sys/*.h; do \
if [ -f $$i ]; then \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/sys/`basename $$i`; \
else true; fi ; \
done ; \
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/bits; \
for i in $(srcdir)/libc/sys/$(sys_dir)/bits/*.h; do \
if [ -f $$i ]; then \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/bits/`basename $$i`; \
else true; fi ; \
done ; \
for i in $(srcdir)/libc/sys/$(sys_dir)/machine/*.h; do \
if [ -f $$i ]; then \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/machine/`basename $$i`; \
else true; fi ; \
done ; \
for i in $(call rwildcard,$(srcdir)/libc/sys/$(sys_dir)/include/,*.h); do \
f=`echo $$i | sed s:^$(srcdir)/libc/sys/$(sys_dir)/::`; \
$(MKDIR_P) $(DESTDIR)$(tooldir)/`dirname $$f`; \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/`dirname $$f`; \
done ; \
for i in $(srcdir)/libc/sys/$(sys_dir)/machine/$(machine_dir)/include/*.h; do \
if [ -f $$i ]; then \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/machine/`basename $$i`; \
else true; fi ; \
done ; \
for i in $(NO_INCLUDE_LIST); do \
if [ -f $(DESTDIR)$(tooldir)/include/$$i ]; then \
rm $(DESTDIR)$(tooldir)/include/$$i; \
else true; fi ; \
done ; \
else true; fi
# Generate Unicode data tables for libc/string/wcwidth and libc/ctype/??w*
unidata:
cd $(srcdir)/libc/string; ./mkunidata -u
cd $(srcdir)/libc/ctype; ./mkunidata -u
# Force makedoc to be built before building info files.
info-recursive dvi-recursive: doc/makedoc$(EXEEXT_FOR_BUILD)
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
include ../multilib.am
check-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=check multi-do # $(MAKE)
MAKEOVERRIDES=
# dejagnu support
RUNTESTFLAGS=
site.exp: Makefile
@echo 'Making a new site.exp file...'
@test ! -f site.bak || rm -f site.bak
@echo '## these variables are automatically generated by make ##' > $@-t
@echo '# Do not edit here. If you wish to override these values' >> $@-t
@echo '# edit the last section' >> $@-t
@echo 'set tool $(DEJATOOL)' >> $@-t
@echo 'set tool_version $(VERSION)' >> $@-t
@echo 'set srcdir $(srcdir)/testsuite' >> $@-t
@echo 'set objdir' `pwd` >> $@-t
@echo 'set tmpdir' `pwd`/testsuite >> $@-t
@echo 'set multibuildtop ./$(MULTIBUILDTOP)' >> $@-t
@echo 'set host_alias $(build_alias)' >> $@-t
@echo 'set host_triplet $(build_triplet)' >> $@-t
@echo 'set target_alias $(host_alias)' >> $@-t
@echo 'set target_triplet $(host_triplet)' >> $@-t
@echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t
@test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t
@test ! -f site.exp || mv site.exp site.bak
@mv $@-t site.exp
check-DEJAGNU: site.exp
@if [ -d testsuite ] ; then \
true ; \
else \
mkdir testsuite ; \
fi
@rm -f testsuite/site.exp
@cp site.exp testsuite/site.exp
@rootme=`pwd` ; \
export rootme ; \
srcdir=`cd ${srcdir}; pwd` ; \
export srcdir ; \
EXPECT=`if [ -f $${rootme}/${MULTIBUILDTOP}../../expect/expect ] ; then \
echo $${rootme}/${MULTIBUILDTOP}../../expect/expect ; \
else \
echo expect ; \
fi` ; \
export EXPECT ; \
echo "Found expect: $${EXPECT}" ; \
if [ -f $(top_builddir)/$(MULTIBUILDTOP)../../expect/expect ] ; then \
TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd` ; \
export TCL_LIBRARY ; \
echo "Found TCL library directory: $${TCL_LIBRARY}" ; \
fi ; \
RUNTEST=`if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
echo $${srcdir}/../dejagnu/runtest ; \
else \
echo runtest ; \
fi` ; \
export RUNTEST ; \
echo "Found runtest: $${RUNTEST}" ; \
cd testsuite ; \
if $(SHELL) -c "$$RUNTEST --version" > /dev/null 2>&1 ; then \
$$RUNTEST --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite $(RUNTESTFLAGS) ; \
: ; \
else \
echo "WARNING: could not find \`runtest'" 1>&2 ; \
fi
clean-local:
-rm -rf targ-include newlib.h _newlib_version.h stamp-*
# Workaround bad automake/texinfo interactions.
# https://bugs.gnu.org/23599
TEXI2DVI = texi2dvi -E
TEXINFO_TEX = ../texinfo/texinfo.tex
XMLTO_MAN_QUIET_=--stringparam man.output.quietly=1
XMLTO_MAN_QUIET=$(XMLTO_MAN_QUIET_$(V))
if HAVE_DOC
include doc/Makefile.inc
endif
include libc/Makefile.inc
include libm/Makefile.inc
.PHONY: $(PHONY)

50912
libraries/newlib/Makefile.in Normal file

File diff suppressed because one or more lines are too long

399
libraries/newlib/NEWS Normal file
View File

@@ -0,0 +1,399 @@
*** Major changes in newlib version 4.4.0:
- long double support for i386, aarch64, and x86_64 added from FreeBSD
- RISC-V Zfinx/Zdinx extension support
- wildcard support added to allow arbitrary include dirs to be specified for a platform
- Xtensa port added
- printf family helper functions split out into separate files to save space when linking
- wide-oriented I/O fixes including proper split of byte and wide-oriented stdio functions
- support added for RISC-V long double math
- fixes for c99/gcc-14 warnings treated as errors in multiple platforms
*** Major changes in newlib version 4.3.0:
- remove i?86-pc-linux-gnu support
- remove decstation & sunos support
- remove phoenix OS support
- remove unused members from struct _reent (see also --enable-newlib-reent-binary-compat)
- build system internals heavily rewritten & updated
- make arm jmp_buf size and alignment ABI-conformant
- fixed bug in arm setjmp/longjmp to preserve floating-point register values
- add --enable-newlib-reent-thread-local configuration option
- add --enable-newlib-reent-binary-compat configuration option
- add 64-bit powerpc setjmp/longjmp support
- use global stdio streams for all configurations
- use global atexit data for all configurations
- vectorized math routines added for amdgcn platform
- nvptx: remove newlib ELIX level 1 restriction
*** Major changes in newlib version 4.2.0:
- remove use of --cygnus option for automake
- rename configure.in files to configure.ac
- enable automake silent rules
- import gdtoa from OpenBSD
- update to Unicode 14.0
- ignore _FORTIFY_SOURCE when building newlib
- fixes to ldtoa
- add clock support to nvptx port
- various pthread POSIX APIs added
- added implementatio for sig2str/str2sig
- strtod/strtof to set errno to ERANGE consistently for underflow
- fixed rounding issue with sqrt/sqrtf
- fixed heap fragmentation issue with nano-malloc
- FTW port for newlib
- additions to sys/tree.h
*** Major changes in newlib version 4.1.0:
- fixes for regressions to pow/powf and tgamma functions
- RISC-V semihosting support
- RISC-V and arm patches
*** Major changes in newlib version 4.0.0:
- additional out-of-bounds checking for malloc/nano-malloc family
- various fixes to makedocbook for python 3.8
- multiple standard/accuracy fixes to libm math routines
- C-SKY port
- support for Armv8-R aarch64 added
- move of __tzrules_struct from time.h to internal header
- math additions/improvements for RISC-V and arm
- all arm code converted to use unified syntax for Thumb1
- fenv support added for multiple platforms
- hard float support for PowerPC taken from FreeBSD
- advertising clause removed from BSD licenses
- various other fixes
*** Major changes in newlib version 3.2.0:
- memmem performance improvement
- nanf() and HUGE_VALF now used in libm float routines to reduce size
- new reduced "tiny" code size printf and puts support
- errno setting enhanced in libm routines
- new --enable-newlib-reent-check-verify configure option to verify reent memory
- <fenv.h> support added
- <sys/time.h> and <sys/_timespec.h> synced with FreeBSD
- timeval macros moved to <sys/time.h>
- newlib wide char conversion functions updated to Unicode 11.0
- new msp430-elfbare target support
- AMD GCN port
- PRU port
- nbdm port
- various standard improvements
*** Major changes in newlib version 3.1.0:
- global stdio streams support added for reent small
- _CLOCKID_T made system configurable
- generated Unicode 10.0 width data, case conversion data,
character category data
- Unicode table generation scripts fixed/enhanced
- performance enhancements for qsort, strstr
- nvptx port added
- sinf/cosf/sincosf/exp/exp2/log/log2/pow rewritten for performance and accuracy
- various gcc warnings fixed
- various standard improvements
*** Major changes in newlib version 3.0.0:
- K&R support removed in code and docs
- 64-bit time_t support
- riscv platform support added
- new expf, exp2f, logf, and powf implementations
- unification of lock object names
- locking routine retargetting at link time
- new long double complex math routines
- various ARM optimizations
- various POSIX/BSD additions
- further feature test macros overhaul
*** Major changes in newlib version 2.5.0:
- memory.h added
- some header file reorganization
- doc fixes
- ctype rewrite
- added per-locale string functions
- additional feature test macro overhaul
*** Major changes in newlib version 2.4.0:
- feature test macro overhaul
- new string functions (e.g. timingsafe_bcmp)
- new stdlib functions (e.g. arc4random)
- simplified versioning macros for newlib
- Changelog files deprecated
*** Major changes in newlib version 2.3.0:
- dynamic atexit logic fixed
- various arm performance enhancements
- new version of strtold
- doc improvements
- arc platform support redone
- strftime improvements/enhancements
- imported logic from FreeBSD
- locking fixes
- complex math enhancements
- visium platform support added
- or1k platform support added
*** Major changes in newlib version 2.2.0:
- multiple functional/performance enhancements for arm/aarch64
- new nano formatted I/O support
- replacement of or16/or32 with or1k platform
- qsort_r support
- additional long double math routines
- ito/utoa/ltoa
- restructuring of gmtime/localtime so tz functions only linked by localtime
- unlocked I/O functions
- various warning clean-ups
*** Major changes in newlib version 2.1.0:
- multibyte decimal point support added to
scanf family
- multiple changes for FreeBSD compatibility
- multiple RTEMS changes for Linux compatibility
- addition of restrict keyword
- nano-malloc support added
- global atexit support added
- new nds32 platform support
- new msp430 platform support
- new nios2 platform support
- lite exit support
- updated arm support (aarch64)
- newlib ported to x86_64-pc-cygwin
*** Major changes in newlib version 2.0.0:
- addition of aarch64 platform support
- addition of epiphany platform support
- addition of 'm' printf conversion specifier
- memrchr function added
- removal of many compiler warnings
- removal of enable-newlib-fp-hw option and
deprecation of mathfp directory
- type of offset in file structure changed from int to off_t
- new optimized arm math routines
- various bug fixes
*** Major changes in newlib version 1.20.0:
* I/O lock clean-up
* fixes to strftime/strptime
* fixes to arm support
* new NO_INCLUDE_LIST configuration support
* rl78 platform support contributed
* sparc-leon platform support contributed
* cvs-to-git mirroring of newlib
* various bug fixes
*** Major changes in newlib version 1.19.0:
* complex math functions
* locale support extended to maintain wide char values of native strings
* eXtensible Data Record (XDR) support for Cygwin
* wide char functions updated to Unicode 5.2
* additional locale charsets
* POSIX standard adherence improvements
* tic6x platform support contributed
* cr16 platform support contributed
* various bug fixes
*** Major changes in newlib version 1.18.0:
* wide-char enhancements
* long double math routines added for platforms where LDBL == DBL
* long long math routines added
* math cleanup
* UTF-16 modifications for Cygwin
* major locale charset overhaul including added charsets
* added moxie platform
* added rx platform
* added xc16x platform
* various cleanups
* various bug fixes
*** Major changes in newlib version 1.17.0:
* new C99 wide-char function additions
* lm32 platform support contributed
* movement of regex functions from sys/linux directory into
shared libc/posix directory
* string function optimizations
* redesign of formatted I/O to reduce dependencies when using
sprintf/sscanf family of functions
* numerous warning cleanups
* documentation fixes to support pdf, info, ps formats and
eclipse libhover hover docs
* various bug fixes
*** Major changes in newlib version 1.16.0:
* mep-elf support contributed
* x86_64 support added
* reentrant I/O clean-up
* various new C functions added from C99, POSIX, SUSV, etc..
* switch to use top-level libtool
* spu floating-point environment and stdio enhancement
* fastmath support
* various bug fixes
*** Major changes in newlib version 1.15.0:
* new platforms added (bfin, spu, fido)
* merge of csl branch changes (e.g. m68k)
* additional C99 support (printf modifiers, strtod, isnan/isinf)
* new configuration option to turn off dynamic allocation for atexit
* reentrancy added for read / write functions
* Cygwin fixes (e.g. POSIX read file flush behavior)
* switch to autoconf 2.5.9
* use of aclocal/automake 1.9.6
* various bug fixes and doc cleanups
*** Major changes in newlib version 1.14.0:
* new platforms added (cris, mt, m32c)
* more locking protection macros added
* various C99/POSIX/SUSV3 compliance issue improvements
* reentrancy cleanup
* header file improvements (e.g. adding RTEMS stdint.h/inttypes.h)
* various math fixes
* changes made to allow use of gcc4 to build newlib
* general bug fixes and cleanups
*** Major changes in newlib version 1.13.0:
* optimized iconv support
* new configuration option to disable syscalls in newlib (e.g. sys/arm)
* new configuration options controlling long long, long double support
* ability of configuration options to override platform defaults
* improved locking protection for file I/O functions
* new reentrant functions
* various fixes to allow building under FC3 and Debian Linux
* cxa exit support
* new platforms (e.g. crx)
* new iprintf and iscanf family functions
*** Major changes in newlib version 1.12.0:
* general iconv support added
* major cleanup with linux header files regarding warnings
* thread-safety and reentrancy fixes
* additional wide character C99 functions
* addition of %lc, %ls, %S, and %C printf format specifiers
* doc cleanup
*** Major changes in newlib version 1.11.0:
* enhanced EL/IX support for i[3456]86-pc-linux
* new --enable-newlib-elix-level configuration option
* positional arg I/O support for printf family (--enable-newlib-io-pos-args)
* support for the Fujitsu FRV architecture added by Red Hat
* support for Motorola Altivec and SPE added by Red Hat
* new small reentrancy structure support
* dynamic reentrancy structure support
*** Major changes in newlib version 1.10.0:
* libtool support for i[3456]86-pc-linux native builds
* addition of libm/machine/i386 directory, for i386 fast math routines
*** Major changes in newlib version 1.9.0:
* i[3456]86-pc-linux support
* Long Double I/O support via the WANT_IO_LONG_DBL flag
* addition of reentrant environment functions
* addition of xscale and AVR platforms
* severe reduction in the number of warnings issued
* consolidation of many RTEMS features into shared headers
*** Major changes in newlib version 1.8.2:
* RTEMS features and fixes from Joel Sherrill.
* More work on reentrant routines.
* Floating point math library check, --enable-newlib-hw-fp.
*** Major changes in newlib version 1.8.1:
* Added check for --enable-newlib-mb configure option which defines the
MB_CAPABLE macro. Multibyte support for JIS, SJIS, and EUC-JP implemented.
* Reduced code size for libm modules.
* Replaced the BSD malloc with Doug Lea's malloc.
*** Major changes in newlib version 1.8.0:
* Added simulated signal handling functions _raise_r, _signal_r, raise, and
signal except for sparc-sun-sunos*, i[3456]86-*-sco*, and a29k-*-* systems,
which already provide access to signal. The signal functionality provided
does not interact with hardware generated signals.
* Added reentrant function rand_r from POSIX.1c.
* Removed _asctime, _next, _scanpoint, and _signgam fields from struct
_reent. These are no longer necessary since there are now functions
that explictly support multiple threads (asctime_r, ctime_r, gamma_r,
gmtime_r, lgamma_r, localtime_r, rand_r, & strtok_r).
*** Major changes in newlib version 1.7.0:
* Cross compiler target libraries are now built in a subdir of the top level
build directory.
Old way: build
/newlib
/m68020
/m68881
New way:
build
/m68k-coff
/m68020
/m68881
where m68020 and m68881 are multilib subdirectories
* m68k targets support --disable options to avoid building unwanted versions
of the libraries.
--disable-softfloat - don't build libc, libg++, etc. for -msoft-float
--disable-m68881 - don't build libc, libg++, etc. for -m68881
--disable-m68000 - don't build libc, libg++, etc. for -m68000
--disable-m68020 - don't build libc, libg++, etc. for -m68020
These options have *no* effect on the default libraries, so if the default
is -m68020, --disable-m68020 is nilpotent.
* Reentrancy support in libm removed.
* strtok, strtol, strtoul, assert, div, ldiv, qsort, vfprintf
replaced with NetBSD versions.
* Support for systems with 32 bit "doubles" added.
* unctrl added.
* dtoa.c updated from master dtoa.c soruces (netlib.att.com)
* Various bug fixes.
*** Major changes in newlib version 1.6.1:
* Added reentrant functions (asctime_r, ctime_r, gmtime_r, localtime_r,
and strtok_r) from POSIX.1c.
* Removed _asctime_r and _strtok_r functions.

539
libraries/newlib/README Normal file
View File

@@ -0,0 +1,539 @@
README for newlib-4.2.0 release
(mostly cribbed from the README in the gdb-4.13 release)
This is `newlib', a simple ANSI C library, math library, and collection
of board support packages.
Prior to the 3.0.0 release, newlib supported both ANSI and K&R-style
compilers. As of 3.0.0, K&R is no longer supported.
The newlib and libgloss subdirectories are a collection of software from
several sources, each with their own copyright and license. See the file
COPYING.NEWLIB for details. The rest of the release tree is under either
the GNU GPL or LGPL licenses.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Unpacking and Installation -- quick overview
==========================
When you unpack the newlib-4.2.0.tar.gz file, you'll find a directory
called `newlib-4.2.0', which contains many files. Interesting ones:
COPYING* - License files for the sources
README - A common overview of all GNU development projects
configure - The build script for configuring the source tree
Makefile* - Inputs used by configure to generate the Makefile
libgloss/ - The libgloss project
newlib/ - The newlib project
To build NEWLIB, you must follow the instructions in the section entitled
"Compiling NEWLIB".
This will configure and build all the libraries and crt0 (if one exists).
If `configure' can't determine your host system type, specify one as its
argument, e.g., sun4 or sun4sol2. NEWLIB is most often used in cross
environments.
NOTE THAT YOU MUST HAVE ALREADY BUILT AND INSTALLED GCC and BINUTILS.
More Documentation
==================
Newlib documentation is available on the net via:
https://sourceware.org/newlib/docs.html
All the documentation for NEWLIB comes as part of the machine-readable
distribution. The documentation is written in Texinfo format, which is
a documentation system that uses a single source file to produce both
on-line information and a printed manual. You can use one of the Info
formatting commands to create the on-line version of the documentation
and TeX (or `texi2roff') to typeset the printed version.
If you want to format these Info files yourself, you need one of the
Info formatting programs, such as `texinfo-format-buffer' or `makeinfo'.
If you want to typeset and print copies of this manual, you need TeX,
a program to print its DVI output files, and `texinfo.tex', the Texinfo
definitions file.
TeX is a typesetting program; it does not print files directly, but
produces output files called DVI files. To print a typeset document,
you need a program to print DVI files. If your system has TeX
installed, chances are it has such a program. The precise command to
use depends on your system; `lpr -d' is common; another (for PostScript
devices) is `dvips'. The DVI print command may require a file name
without any extension or a `.dvi' extension.
TeX also requires a macro definitions file called `texinfo.tex'.
This file tells TeX how to typeset a document written in Texinfo
format. On its own, TeX cannot read, much less typeset a Texinfo file.
`texinfo.tex' is distributed with NEWLIB and is located in the
`newlib-VERSION-NUMBER/texinfo' directory.
Compiling NEWLIB
================
To compile NEWLIB, you must build it in a directory separate from
the source directory. If you want to run NEWLIB versions for several host
or target machines, you need a different `newlib' compiled for each combination
of host and target. `configure' is designed to make this easy by allowing
you to generate each configuration in a separate subdirectory.
If your `make' program handles the `VPATH' feature correctly (like GNU `make')
running `make' in each of these directories builds the `newlib' libraries
specified there.
To build `newlib' in a specific directory, run `configure' with the
`--srcdir' option to specify where to find the source. (You also need
to specify a path to find `configure' itself from your working
directory. If the path to `configure' would be the same as the
argument to `--srcdir', you can leave out the `--srcdir' option; it
will be assumed.)
For example, with version 4.2.0, you can build NEWLIB in a separate
directory for a Sun 4 cross m68k-aout environment like this:
cd newlib-4.2.0
mkdir ../newlib-m68k-aout
cd ../newlib-m68k-aout
../newlib-4.2.0/configure --host=sun4 --target=m68k-aout
make
When `configure' builds a configuration using a remote source
directory, it creates a tree for the binaries with the same structure
(and using the same names) as the tree under the source directory. In
the example, you'd find the Sun 4 library `libiberty.a' in the
directory `newlib-m68k-aout/libiberty', and NEWLIB itself in
`newlib-m68k-aout/newlib'.
When you run `make' to build a program or library, you must run it
in a configured directory--whatever directory you were in when you
called `configure' (or one of its subdirectories).
The `Makefile' that `configure' generates in each source directory
also runs recursively. If you type `make' in a source directory such
as `newlib-4.2.0' (or in a separate configured directory configured with
`--srcdir=PATH/newlib-4.2.0'), you will build all the required libraries.
When you have multiple hosts or targets configured in separate
directories, you can run `make' on them in parallel (for example, if
they are NFS-mounted on each of the hosts); they will not interfere
with each other.
By default, the execution of build rules in `make' is less verbose.
To disable, run `make V=1'; or use the `--disable-silent-rules option
of `./configure'.
Specifying names for hosts and targets
======================================
The specifications used for hosts and targets in the `configure'
script are based on a three-part naming scheme, but some short
predefined aliases are also supported. The full naming scheme encodes
three pieces of information in the following pattern:
ARCHITECTURE-VENDOR-OS
For example, you can use the alias `sun4' as a HOST argument or in a
`--target=TARGET' option. The equivalent full name is
`sparc-sun-sunos4'.
The `configure' script accompanying NEWLIB does not provide any query
facility to list all supported host and target names or aliases.
`configure' calls the Bourne shell script `config.sub' to map
abbreviations to full names; you can read the script, if you wish, or
you can use it to test your guesses on abbreviations--for example:
% sh config.sub sun4
sparc-sun-sunos4.1.1
% sh config.sub sun3
m68k-sun-sunos4.1.1
% sh config.sub decstation
mips-dec-ultrix4.2
% sh config.sub hp300bsd
m68k-hp-bsd
% sh config.sub i386v
i386-pc-sysv
% sh config.sub i786v
Invalid configuration `i786v': machine `i786v' not recognized
The Build, Host and Target Concepts in newlib
=============================================
The build, host and target concepts are defined for gcc as follows:
build: the platform on which gcc is built.
host: the platform on which gcc is run.
target: the platform for which gcc generates code.
Since newlib is a library, the target concept does not apply to it, and the
build, host, and target options given to the top-level configure script must
be changed for newlib's use.
The build system shifts the options according to these correspondences:
gcc's build platform has no equivalent in newlib.
gcc's host platform is newlib's build platform.
gcc's target platform is newlib's host platform.
and as mentioned before, newlib has no concept of target.
In summary: the --target=TARGET switch to the top-level configure
script configures newlib's host platform.
`configure' options
===================
Here is a summary of the `configure' options and arguments that are
most often useful for building NEWLIB. `configure' also has several other
options not listed here.
configure [--help]
[--prefix=DIR]
[--srcdir=PATH]
[--target=TARGET] HOST
You may introduce options with a single `-' rather than `--' if you
prefer; but you may abbreviate option names if you use `--'.
`--help'
Display a quick summary of how to invoke `configure'.
`--prefix=DIR'
Configure the source to install programs and files in directory
`DIR'.
`--exec-prefix=DIR'
Configure the source to install host-dependent files in directory
`DIR'.
`--srcdir=PATH'
*Warning: using this option requires GNU `make', or another `make'
that compatibly implements the `VPATH' feature.
Use this option to make configurations in directories separate
from the NEWLIB source directories. Among other things, you can use
this to build (or maintain) several configurations simultaneously,
in separate directories. `configure' writes configuration
specific files in the current directory, but arranges for them to
use the source in the directory PATH. `configure' will create
directories under the working directory in parallel to the source
directories below PATH.
`--norecursion'
Configure only the directory level where `configure' is executed;
do not propagate configuration to subdirectories.
`--target=TARGET'
Configure NEWLIB for running on the specified TARGET.
There is no convenient way to generate a list of all available
targets.
`HOST ...'
Configure NEWLIB to be built using a cross compiler running on
the specified HOST.
There is no convenient way to generate a list of all available
hosts.
To fit diverse usage models, NEWLIB supports a group of configuration
options so that library features can be turned on/off according to
target system's requirements.
One feature can be enabled by specifying `--enable-FEATURE=yes' or
`--enable-FEATURE'. Or it can be disable by `--enable-FEATURE=no' or
`--disable-FEATURE'.
`--enable-newlib-io-pos-args'
Enable printf-family positional arg support.
Disabled by default, but some hosts enable it in configure.host.
`--enable-newlib-io-c99-formats'
Enable C99 support in IO functions like printf/scanf.
Disabled by default, but some hosts enable it in configure.host.
`--enable-newlib-register-fini'
Enable finalization function registration using atexit.
Disabled by default.
`--enable-newlib-io-long-long'
Enable long long type support in IO functions like printf/scanf.
Disabled by default, but many hosts enable it in configure.host.
`--enable-newlib-io-long-double'
Enable long double type support in IO functions printf/scanf.
Disabled by default, but some hosts enable it in configure.host.
`--enable-newlib-mb'
Enable multibyte support.
Disabled by default.
`--enable-newlib-iconv-encodings'
Enable specific comma-separated list of bidirectional iconv
encodings to be built-in.
Disabled by default.
`--enable-newlib-iconv-from-encodings'
Enable specific comma-separated list of \"from\" iconv encodings
to be built-in.
Disabled by default.
`--enable-newlib-iconv-to-encodings'
Enable specific comma-separated list of \"to\" iconv encodings
to be built-in.
Disabled by default.
`--enable-newlib-iconv-external-ccs'
Enable capabilities to load external CCS files for iconv.
Disabled by default.
`--disable-newlib-atexit-dynamic-alloc'
Disable dynamic allocation of atexit entries.
Most hosts and targets have it enabled in configure.host.
`--enable-newlib-reent-small'
Enable small reentrant struct support.
Disabled by default.
`--enable-newlib-reent-binary-compat'
Enable backward binary compatibility for struct _reent. If enabled, then
unused members in struct _reent are preserved to maintain the structure
layout.
Disabled by default.
`--enable-newlib-reent-thread-local'
Enable thread-local storage objects as a replacement for struct _reent
members. If enabled, then struct _reent is not defined and dedicated
thread-local storage objects are provided for each member of the default
struct _reent. For statically linked executables only the objects
required by the application are linked in.
Disabled by default.
`--disable-newlib-fvwrite-in-streamio'
NEWLIB implements the vector buffer mechanism to support stream IO
buffering required by C standard. This feature is possibly
unnecessary for embedded systems which won't change file buffering
with functions like `setbuf' or `setvbuf'. The buffering mechanism
still acts as default for STDIN/STDOUT/STDERR even if this option
is specified.
Enabled by default.
`--disable-newlib-fseek-optimization'
Disable fseek optimization. It can decrease code size of application
calling `fseek`.
Enabled by default.
`--disable-newlib-wide-orient'
C99 states that each stream has an orientation, wide or byte. This
feature is possibly unnecessary for embedded systems which only do
byte input/output operations on stream. It can decrease code size
by disable the feature.
Enabled by default.
`--enable-newlib-nano-malloc'
NEWLIB has two implementations of malloc family's functions, one in
`mallocr.c' and the other one in `nano-mallocr.c'. This options
enables the nano-malloc implementation, which is for small systems
with very limited memory. Note that this implementation does not
support `--enable-malloc-debugging' any more.
Disabled by default.
`--disable-newlib-unbuf-stream-opt'
NEWLIB does optimization when `fprintf to write only unbuffered unix
file'. It creates a temorary buffer to do the optimization that
increases stack consumption by about `BUFSIZ' bytes. This option
disables the optimization and saves size of text and stack.
Enabled by default.
`--enable-newlib-long-time_t'
Define time_t to long. On platforms with a 32-bit long type, this gives
raise to the year 2038 problem. The default type for time_t is a signed
64-bit integer on most systems.
Disabled by default.
`--enable-newlib-use-gdtoa'
Use gdtoa rather than legacy ldtoa. gdtoa privides more accurate
output and faster conversion than legacy ldtoa, while it requires
more heap memory. gdtoa sometimes requires 16KB heap memory, so
if the platform does not have enough heap memory, consider disabling
this option. Legacy ldtoa also use heap, however, only 1KB memory
is malloc'ed. In addition, if malloc fails, it still works, with
less conversion accuracy.
Enabled by default.
`--enable-multilib'
Build many library versions.
Enabled by default.
`--enable-target-optspace'
Optimize for space.
Disabled by default.
`--enable-malloc-debugging'
Indicate malloc debugging requested.
Disabled by default.
`--enable-newlib-multithread'
Enable support for multiple threads.
Enabled by default.
`--enable-newlib-iconv'
Enable iconv library support.
Disabled by default.
`--enable-newlib-elix-level'
Supply desired elix library level (1-4). Please refer to HOWTO for
more information about this option.
Set to level 0 by default.
`--disable-newlib-io-float'
Disable printf/scanf family float support.
Enabled by default.
`--disable-newlib-supplied-syscalls'
Disable newlib from supplying syscalls.
Enabled by default.
`--enable-lite-exit'
Enable lite exit, a size-reduced implementation of exit that doesn't
invoke clean-up functions such as _fini or global destructors.
Disabled by default.
`--enable-newlib-nano-formatted-io'
This builds NEWLIB with a special implementation of formatted I/O
functions, designed to lower the size of application on small systems
with size constraint issues. This option does not affect wide-char
formatted I/O functions. Some notes about the feature:
1) The non-wide-char formatted I/O functions only support the C89
standard. The only exception is the configuration option provides
limited support for long double. Internally, the nano formatted I/O
functions use double so accuracy is only guaranteed to double
precision.
2) Floating-point support is split out of the formatted I/O code into
weak functions which are not linked by default. Programs that need
floating-point I/O support must explicitly request linking of one or
both of the floating-point functions: _printf_float or _scanf_float.
This can be done at link time using the -u option which can be passed
to either gcc or ld. The -u option forces the link to resolve those
function references. Floating-point format specifiers are recognized
by default, but if the floating-point functions are not explicitly
linked in, this may result in undefined behavior for programs that
need floating-point I/O support.
3) Integer-only versions of the formatted I/O functions (the iprintf/
iscanf family) simply alias their regular counter-parts.
The affected functions are:
diprintf vdiprintf
siprintf fiprintf iprintf sniprintf asiprintf asniprintf
siscanf fiscanf iscanf
viprintf vfiprintf vsiprintf vsniprintf vasiprintf vasniprintf
viscanf vfiscanf vsiscanf
_diprintf_r _vdiprintf_r
_siprintf_r _fiprintf_r _iprintf_r _sniprintf_r _asiprintf_r
_asniprintf_r
_siscanf_r _fiscanf_r _iscanf_r
_viprintf_r _vfiprintf_r _vsiprintf_r _asniprintf_r _vasiprintf_r
_vasniprintf_r
_viscanf_r _vfiscanf_r _vsiscanf_r
4) As mentioned, the option does not affect wide-char formatted I/O.
The following configuration options are ignored for non-wide-char
formatted I/O functions, and can be thought of as disabled.
enable-newlib-io-pos-args
enable-newlib-io-c99-formats
enable-newlib-io-long-long
enable-newlib-io-long-double
enable-newlib-mb
Additionally, "enable/disable-newlib-io-float" is supported in
this specific implementation, one can use "disable-newlib-io-float"
to further reduce code size. In this case, the floating-point
specifiers will not be recognized or handled, and the -u option
will not work either.
5) As a rule, no features from outside of C89 standard will be
considered in this implementation.
Disabled by default.
Running the Testsuite
=====================
To run newlib's testsuite, you'll need a site.exp in your home
directory which points dejagnu to the proper baseboards directory and
the proper exp file for your target.
Before running make check-target-newlib, set the DEJAGNU environment
variable to point to ~/site.exp.
Here is a sample site.exp:
# Make sure we look in the right place for the board description files.
if ![info exists boards_dir] {
set boards_dir {}
}
lappend boards_dir "your dejagnu/baseboards here"
verbose "Global Config File: target_triplet is $target_triplet" 2
global target_list
case "$target_triplet" in {
{ "mips-*elf*" } {
set target_list "mips-sim"
}
default {
set target_list { "unix" }
}
}
mips-sim refers to an exp file in the baseboards directory. You'll
need to add the other targets you're testing to the case statement.
Now type make check-target-newlib in the top-level build directory to
run the testsuite.
Regenerating Configuration Files
================================
At times you will need to make changes to configure.ac, Makefile.am and
Makefile.inc files. This will mean that configure and Makefile.in files will
need to be regenerated. The easiest way to do so is by using the autoreconf
tool in the newlib directory.
autoreconf
This will run a number of autotool programs for you. To see the individual
steps, add the -v option.
autoreconf -v
It is strongly advised that you use an adequate version of autotools. For this
latest release, the following were used: autoconf 2.69 and automake 1.15.1.
Reporting Bugs
==============
The correct address for reporting bugs found in NEWLIB is
"newlib@sourceware.org". Please email all bug reports to that
address. Please include the NEWLIB version number (e.g., newlib-4.2.0),
and how you configured it (e.g., "sun4 host and m68k-aout target").
Since NEWLIB supports many different configurations, it is important
that you be precise about this.
Archives of the newlib mailing list are on-line, see
https://sourceware.org/ml/newlib/

View File

@@ -0,0 +1,10 @@
/* Version macros for internal and downstream use. */
#ifndef _NEWLIB_VERSION_H__
#define _NEWLIB_VERSION_H__ 1
#undef _NEWLIB_VERSION
#undef __NEWLIB__
#undef __NEWLIB_MINOR__
#undef __NEWLIB_PATCHLEVEL__
#endif /* !_NEWLIB_VERSION_H__ */

View File

@@ -0,0 +1,165 @@
dnl This provides configure definitions used by all the newlib
dnl configure.in files.
AC_DEFUN([DEF_NEWLIB_MAJOR_VERSION],m4_define([NEWLIB_MAJOR_VERSION],[4]))
AC_DEFUN([DEF_NEWLIB_MINOR_VERSION],m4_define([NEWLIB_MINOR_VERSION],[4]))
AC_DEFUN([DEF_NEWLIB_PATCHLEVEL_VERSION],m4_define([NEWLIB_PATCHLEVEL_VERSION],[0]))
AC_DEFUN([DEF_NEWLIB_VERSION],m4_define([NEWLIB_VERSION],[NEWLIB_MAJOR_VERSION.NEWLIB_MINOR_VERSION.NEWLIB_PATCHLEVEL_VERSION]))
dnl Basic newlib configury. This calls basic introductory stuff,
dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs
dnl configure.host. The only argument is the relative path to the top
dnl newlib directory.
AC_DEFUN([NEWLIB_CONFIGURE],
[AC_REQUIRE([DEF_NEWLIB_VERSION])
dnl Support --enable-target-optspace
AC_ARG_ENABLE(target-optspace,
[ --enable-target-optspace optimize for space],
[case "${enableval}" in
yes) target_optspace=yes ;;
no) target_optspace=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;;
esac], [target_optspace=])dnl
dnl Support --enable-malloc-debugging - currently only supported for Cygwin
AC_ARG_ENABLE(malloc-debugging,
[ --enable-malloc-debugging indicate malloc debugging requested],
[case "${enableval}" in
yes) malloc_debugging=yes ;;
no) malloc_debugging=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;;
esac], [malloc_debugging=])dnl
dnl Support --enable-newlib-multithread
AC_ARG_ENABLE(newlib-multithread,
[ --enable-newlib-multithread enable support for multiple threads],
[case "${enableval}" in
yes) newlib_multithread=yes ;;
no) newlib_multithread=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;;
esac], [newlib_multithread=yes])dnl
dnl Support --enable-newlib-iconv
AC_ARG_ENABLE(newlib-iconv,
[ --enable-newlib-iconv enable iconv library support],
[if test "${newlib_iconv+set}" != set; then
case "${enableval}" in
yes) newlib_iconv=yes ;;
no) newlib_iconv=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-iconv option) ;;
esac
fi], [newlib_iconv=${newlib_iconv}])dnl
dnl Support --enable-newlib-elix-level
AC_ARG_ENABLE(newlib-elix-level,
[ --enable-newlib-elix-level supply desired elix library level (1-4)],
[case "${enableval}" in
0) newlib_elix_level=0 ;;
1) newlib_elix_level=1 ;;
2) newlib_elix_level=2 ;;
3) newlib_elix_level=3 ;;
4) newlib_elix_level=4 ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;;
esac], [newlib_elix_level=0])dnl
dnl Support --disable-newlib-io-float
AC_ARG_ENABLE(newlib-io-float,
[ --disable-newlib-io-float disable printf/scanf family float support],
[case "${enableval}" in
yes) newlib_io_float=yes ;;
no) newlib_io_float=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;;
esac], [newlib_io_float=yes])dnl
dnl Support --disable-newlib-supplied-syscalls
AC_ARG_ENABLE(newlib-supplied-syscalls,
[ --disable-newlib-supplied-syscalls disable newlib from supplying syscalls],
[case "${enableval}" in
yes) newlib_may_supply_syscalls=yes ;;
no) newlib_may_supply_syscalls=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-supplied-syscalls option) ;;
esac], [newlib_may_supply_syscalls=yes])dnl
AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes)
dnl Support --disable-newlib-fno-builtin
AC_ARG_ENABLE(newlib-fno-builtin,
[ --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions],
[case "${enableval}" in
yes) newlib_fno_builtin=yes ;;
no) newlib_fno_builtin=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-fno-builtin option) ;;
esac], [newlib_fno_builtin=])dnl
dnl We may get other options which we don't document:
dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
test -z "[$]{with_target_subdir}" && with_target_subdir=.
if test "[$]{srcdir}" = "."; then
if test "[$]{with_target_subdir}" != "."; then
newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
else
newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
fi
else
newlib_basedir="[$]{srcdir}/$1"
fi
AC_SUBST(newlib_basedir)
abs_newlib_basedir=`cd "${newlib_basedir}" && pwd`
AC_SUBST(abs_newlib_basedir)
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([foreign no-installinfo no-dist no-define subdir-objects 1.15.1])
AM_MAINTAINER_MODE
AM_SILENT_RULES(yes)
AC_NO_EXECUTABLES
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
AC_REQUIRE([AM_PROG_AS])dnl
AC_REQUIRE([AM_PROG_AR])dnl
AC_PROG_RANLIB
AC_CHECK_TOOL(READELF, readelf, :)
dnl We need these programs, but so does Automake. Require the macros to avoid
dnl expanding them multiple times.
AC_REQUIRE([AC_PROG_INSTALL])dnl
AC_REQUIRE([AC_PROG_AWK])dnl
. [$]{newlib_basedir}/configure.host
NEWLIB_CFLAGS=${newlib_cflags}
AC_SUBST(NEWLIB_CFLAGS)
NO_INCLUDE_LIST=${noinclude}
AC_SUBST(NO_INCLUDE_LIST)
AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0)
AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1)
AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2)
AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3)
AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4)
# Emit any target-specific warnings.
if test "x${newlib_msg_warn}" != "x"; then
AC_MSG_WARN([${newlib_msg_warn}])
fi
# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we
# use oext, which is set in configure.host based on the target platform.
OBJEXT=o
AC_SUBST(OBJEXT)
AC_SUBST(lpfx)
AC_SUBST(libm_machine_dir)
AC_SUBST(machine_dir)
AC_SUBST(shared_machine_dir)
AC_SUBST(sys_dir)
])

1255
libraries/newlib/aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

9411
libraries/newlib/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,681 @@
dnl This is the newlib configure.in file.
dnl Process this file with autoconf to produce a configure script.
AC_INIT([newlib],[NEWLIB_VERSION])
AC_CONFIG_SRCDIR([libc])
dnl Since we can't control what defines autoheader picks up (various autoconf
dnl macros will add their own), filter out all the ones w/out a _ prefix. All
dnl the ones we want to export use a _ prefix, and all the rest we don't want
dnl to export as it'll pollute the namespace of newlib users.
dnl We also filter out version defines that we want in _newlib_version.h.
dnl NB: newlib.h must be the first AC_CONFIG_HEADERS call for autoheader.
AC_CONFIG_HEADERS(
[newlib.h:newlib.hin],
[sed -i.tmp -E -e '/^#define [^_]/d' -e '/^\/\* #undef [^_]/d' -e '/_NEWLIB_VERSION|__NEWLIB_(MINOR|PATCHLEVEL)__|__NEWLIB__/d' newlib.h && rm -f newlib.h.tmp])
AH_TOP([/* NB: The contents are filtered before being installed. */
#ifndef __NEWLIB_H__
#define __NEWLIB_H__ 1
/* Newlib version */
#include <_newlib_version.h>])
AH_BOTTOM([#endif /* !__NEWLIB_H__ */])
AC_CONFIG_HEADERS([_newlib_version.h:_newlib_version.hin])
dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake.
AC_CONFIG_AUX_DIR(..)
dnl Support --enable-newlib-io-pos-args
dnl This option is actually read in libc/configure.in. It is repeated
dnl here so that it shows up in the help text.
AC_ARG_ENABLE(newlib-io-pos-args,
[ --enable-newlib-io-pos-args enable printf-family positional arg support],
[case "${enableval}" in
yes) newlib_io_pos_args=yes ;;
no) newlib_io_pos_args=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-io-pos-args option) ;;
esac], [newlib_io_pos_args=])dnl
dnl Support --enable-newlib-io-c99-formats
AC_ARG_ENABLE(newlib-io-c99-formats,
[ --enable-newlib-io-c99-formats enable C99 support in IO functions like printf/scanf],
[case "${enableval}" in
yes) newlib_io_c99_formats=yes;;
no) newlib_io_c99_formats=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-io-c99-formats option) ;;
esac], [newlib_io_c99_formats=])dnl
dnl Support --enable-newlib-register-fini
AC_ARG_ENABLE(newlib-register-fini,
[ --enable-newlib-register-fini enable finalization function registration using atexit],
[case "${enableval}" in
yes) newlib_register_fini=yes;;
no) newlib_register_fini=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-register-fini option) ;;
esac], [newlib_register_fini=])dnl
dnl Support --enable-newlib-io-long-long
AC_ARG_ENABLE(newlib-io-long-long,
[ --enable-newlib-io-long-long enable long long type support in IO functions like printf/scanf],
[case "${enableval}" in
yes) newlib_io_long_long=yes;;
no) newlib_io_long_long=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-io-long-long option) ;;
esac], [newlib_io_long_long=])dnl
dnl Support --enable-newlib-io-long-double
AC_ARG_ENABLE(newlib-io-long-double,
[ --enable-newlib-io-long-double enable long double type support in IO functions printf/scanf],
[case "${enableval}" in
yes) newlib_io_long_double=yes;;
no) newlib_io_long_double=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-io-long-double option) ;;
esac], [newlib_io_long_double=])dnl
dnl If multibyte support is enabled, iconv should be enabled too
dnl Support --enable-newlib-mb
AC_ARG_ENABLE(newlib-mb,
[ --enable-newlib-mb enable multibyte support],
[case "${enableval}" in
yes) newlib_mb=yes;;
no) newlib_mb=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;;
esac], [newlib_mb=])dnl
dnl Enable verification of successful memory allocation for _REENT_CHECK family of macros
dnl Support --disable-newlib-reent-check-verify
AC_ARG_ENABLE(newlib-reent-check-verify,
[ --disable-newlib-reent-check-verify disable checking of _REENT_CHECK memory allocation],
[case "${enableval}" in
yes) newlib_reent_check_verify=yes;;
no) newlib_reent_check_verify=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-reent-check-verify option) ;;
esac], [newlib_reent_check_verify=])dnl
dnl Support --enable-newlib-iconv-encodings
AC_ARG_ENABLE(newlib-iconv-encodings,
[ --enable-newlib-iconv-encodings enable specific comma-separated list of bidirectional iconv encodings to be built-in],
[if test x${enableval} = x; then
AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-encodings option - use comma-separated encodings list)
fi
iconv_encodings=${enableval}
], [iconv_encodings=])dnl
dnl Support --enable-newlib-iconv-from-encodings
AC_ARG_ENABLE(newlib-iconv-from-encodings,
[ --enable-newlib-iconv-from-encodings enable specific comma-separated list of \"from\" iconv encodings to be built-in],
[if test x${enableval} = x; then
AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-from-encodings option - use comma-separated encodings list)
fi
iconv_from_encodings=${enableval}
], [iconv_from_encodings=])dnl
dnl Support --enable-newlib-iconv-to-encodings
AC_ARG_ENABLE(newlib-iconv-to-encodings,
[ --enable-newlib-iconv-to-encodings enable specific comma-separated list of \"to\" iconv encodings to be built-in],
[if test x${enableval} = x; then
AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-to-encodings option - use comma-separated encodings list)
fi
iconv_to_encodings=${enableval}
], [iconv_to_encodings=])dnl
dnl Support --enable-newlib-iconv-external-ccs
AC_ARG_ENABLE(newlib-iconv-external-ccs,
[ --enable-newlib-iconv-external-ccs enable capabilities to load external CCS files for iconv],
[if test "${newlib_iconv_external_ccs+set}" != set; then
case "${enableval}" in
yes) newlib_iconv_external_ccs=yes ;;
no) newlib_iconv_external_ccs=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-external-ccs option) ;;
esac
fi], [newlib_iconv_external_ccs=${newlib_iconv_external_ccs}])dnl
dnl Support --disable-newlib-atexit-dynamic-alloc
AC_ARG_ENABLE(newlib-atexit-dynamic-alloc,
[ --disable-newlib-atexit-dynamic-alloc disable dynamic allocation of atexit entries],
[if test "${newlib_atexit_dynamic_alloc+set}" != set; then
case "${enableval}" in
yes) newlib_atexit_dynamic_alloc=yes ;;
no) newlib_atexit_dynamic_alloc=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-atexit-dynamic-alloc option) ;;
esac
fi], [newlib_atexit_dynamic_alloc=${newlib_atexit_dynamic_alloc}])dnl
dnl Support --enable-newlib-global-atexit
dnl Enable atexit data structure as global variables to save memory usage in
dnl _reent. This is no longer optional. It is enabled in all Newlib
dnl configurations.
AC_ARG_ENABLE(newlib-global-atexit,
[ --enable-newlib-global-atexit enable atexit data structure as global],
[if test "${newlib_global_atexit+set}" != set; then
case "${enableval}" in
yes) newlib_global_atexit=yes ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-global-atexit option) ;;
esac
fi], [newlib_global_atexit=yes])dnl
dnl Support --enable-newlib-reent-small
AC_ARG_ENABLE(newlib-reent-small,
[ --enable-newlib-reent-small enable small reentrant struct support],
[case "${enableval}" in
yes) newlib_reent_small=yes;;
no) newlib_reent_small=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-reent-small option) ;;
esac], [newlib_reent_small=])dnl
dnl Support --enable-newlib-reent-binary-compat
AC_ARG_ENABLE(newlib-reent-binary-compat,
[ --enable-newlib-reent-binary-compat enable backward binary compatibility for struct _reent],
[if test "${newlib_reent_binary_compat+set}" != set; then
case "${enableval}" in
yes) newlib_reent_binary_compat=yes ;;
no) newlib_reent_binary_compat=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-enable-reent-binary-compat option) ;;
esac
fi], [newlib_reent_binary_compat=no])dnl
dnl Support --enable-newlib-reent-thread-local
AC_ARG_ENABLE(newlib-reent-thread-local,
[ --enable-newlib-reent-thread-local enable thread-local storage objects as a replacment for struct _reent members],
[if test "${newlib_reent_thread_local+set}" != set; then
case "${enableval}" in
yes) newlib_reent_thread_local=yes ;;
no) newlib_reent_thread_local=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-enable-reent-thread-local option) ;;
esac
fi], [newlib_reent_thread_local=no])dnl
dnl Support --enable-newlib-global-stdio-streams
dnl This is no longer optional. It is enabled in all Newlib configurations.
AC_ARG_ENABLE(newlib-global-stdio-streams,
[ --enable-newlib-global-stdio-streams enable global stdio streams],
[case "${enableval}" in
yes) newlib_global_stdio_streams=yes;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-global-stdio-streams option) ;;
esac], [newlib_global_stdio_streams=yes])dnl
dnl Support --disable-newlib-fvwrite-in-streamio
AC_ARG_ENABLE(newlib-fvwrite-in-streamio,
[ --disable-newlib-fvwrite-in-streamio disable iov in streamio],
[if test "${newlib_fvwrite_in_streamio+set}" != set; then
case "${enableval}" in
yes) newlib_fvwrite_in_streamio=yes ;;
no) newlib_fvwrite_in_streamio=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-fvwrite-in-streamio option) ;;
esac
fi], [newlib_fvwrite_in_streamio=yes])dnl
dnl Support --disable-newlib-fseek-optimization
AC_ARG_ENABLE(newlib-fseek-optimization,
[ --disable-newlib-fseek-optimization disable fseek optimization],
[if test "${newlib_fseek_optimization+set}" != set; then
case "${enableval}" in
yes) newlib_fseek_optimization=yes ;;
no) newlib_fseek_optimization=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-fseek-optimization option) ;;
esac
fi], [newlib_fseek_optimization=yes])dnl
dnl Support --enable-newlib-wide-orient
dnl This option is also read in libc/configure.in. It is repeated
dnl here so that it shows up in the help text.
AC_ARG_ENABLE(newlib_wide_orient,
[ --disable-newlib-wide-orient Turn off wide orientation in streamio],
[case "${enableval}" in
yes) newlib_wide_orient=yes ;;
no) newlib_wide_orient=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-wide-orient) ;;
esac],[newlib_wide_orient=yes])
dnl Support --enable-newlib-nano-malloc
dnl This option is also read in libc/configure.in. It is repeated
dnl here so that it shows up in the help text.
AC_ARG_ENABLE(newlib-nano-malloc,
[ --enable-newlib-nano-malloc use small-footprint nano-malloc implementation],
[if test "${newlib_nano_malloc+set}" != set; then
case "${enableval}" in
yes) newlib_nano_malloc=yes ;;
no) newlib_nano_malloc=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-nano-malloc option) ;;
esac
fi], [newlib_nano_malloc=])dnl
AM_CONDITIONAL(NEWLIB_NANO_MALLOC, test x$newlib_nano_malloc = xyes)
dnl Support --disable-newlib-unbuf-stream-opt
AC_ARG_ENABLE(newlib-unbuf-stream-opt,
[ --disable-newlib-unbuf-stream-opt disable unbuffered stream optimization in streamio],
[if test "${newlib_unbuf_stream_opt+set}" != set; then
case "${enableval}" in
yes) newlib_unbuf_stream_opt=yes ;;
no) newlib_unbuf_stream_opt=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-unbuf-stream-opt option) ;;
esac
fi], [newlib_unbuf_stream_opt=yes])dnl
dnl Support --enable-lite-exit
dnl Lite exit is a size-reduced implementation of exit that doesn't invoke
dnl clean-up functions such as _fini or global destructors.
AC_ARG_ENABLE(lite-exit,
[ --enable-lite-exit enable light weight exit],
[if test "${lite_exit+set}" != set; then
case "${enableval}" in
yes) lite_exit=yes ;;
no) lite_exit=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for lite-exit option) ;;
esac
fi], [lite_exit=no])dnl
dnl Support --enable-newlib-nano-formatted-io
dnl This option is also read in libc/configure.in. It is repeated
dnl here so that it shows up in the help text.
AC_ARG_ENABLE(newlib_nano_formatted_io,
[ --enable-newlib-nano-formatted-io Use small-footprint nano-formatted-IO implementation],
[case "${enableval}" in
yes) newlib_nano_formatted_io=yes ;;
no) newlib_nano_formatted_io=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-nano-formatted-io) ;;
esac],[newlib_nano_formatted_io=no])
AM_CONDITIONAL(NEWLIB_NANO_FORMATTED_IO, test x$newlib_nano_formatted_io = xyes)
dnl Support --enable-retargetable-locking
dnl This option is also read in libc/configure.in. It is repeated
dnl here so that it shows up in the help text.
AC_ARG_ENABLE(newlib-retargetable-locking,
[ --enable-newlib-retargetable-locking Allow locking routines to be retargeted at link time],
[case "${enableval}" in
yes) newlib_retargetable_locking=yes ;;
no) newlib_retargetable_locking=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-retargetable-locking) ;;
esac],[newlib_retargetable_locking=no])
AM_CONDITIONAL(NEWLIB_RETARGETABLE_LOCKING, test x$newlib_retargetable_locking = xyes)
dnl Support --enable-newlib-long-time_t
AC_ARG_ENABLE(newlib-long-time_t,
[ --enable-newlib-long-time_t define time_t to long],
[if test "${newlib_long_time_t+set}" != set; then
case "${enableval}" in
yes) newlib_long_time_t=yes ;;
no) newlib_long_time_t=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-long-time_t option) ;;
esac
fi], [newlib_long_time_t=no])dnl
dnl Support --enable-newlib-use-gdtoa
AC_ARG_ENABLE(newlib-use-gdtoa,
[ --enable-newlib-use-gdtoa Use gdtoa rather than legacy ldtoa],
[if test "${newlib_use_gdtoa+set}" != set; then
case "${enableval}" in
yes) newlib_use_gdtoa=yes ;;
no) newlib_use_gdtoa=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-use-gdtoa option) ;;
esac
fi], [newlib_use_gdtoa=yes])dnl
AM_ENABLE_MULTILIB(, ..)
NEWLIB_CONFIGURE(.)
dnl The following is being disabled because the mathfp library is
dnl not up to standard due to inaccuracies caused by some of the
dnl floating-point algorithms used. If you wish to work on this,
dnl comment out the following line and uncomment out the lines
dnl following it to re-enable the feature.
newlib_hw_fp=false
#AC_ARG_ENABLE(newlib_hw_fp,
#[ --enable-newlib-hw-fp Turn on hardware floating point math],
#[case "${enableval}" in
# yes) newlib_hw_fp=true ;;
# no) newlib_hw_fp=false ;;
# *) AC_MSG_ERROR(bad value ${enableval} for --enable-newlib-hw-fp) ;;
# esac],[newlib_hw_fp=false])
AM_CONDITIONAL(NEWLIB_HW_FP, test x$newlib_hw_fp = xtrue)
# These get added in the top-level configure.in, except in the case where
# newlib is being built natively.
LIBC_INCLUDE_GREP=`echo ${CC} | grep \/libc\/include`
if test -z "${LIBC_INCLUDE_GREP}"; then
CC_FOR_NEWLIB="${CC} -I$PWD/targ-include -I${abs_newlib_basedir}/libc/include"
else
CC_FOR_NEWLIB="${CC}"
fi
AC_SUBST(CC_FOR_NEWLIB)
m4_include([libc/acinclude.m4])
m4_include([libm/acinclude.m4])
if test -z "${with_multisubdir}"; then
have_multisubdir=no
else
have_multisubdir=yes
fi
AM_CONDITIONAL(HAVE_DOC, test x$have_multisubdir = xno)
# Some run-time support libraries provided by GCC (e.g. libgomp) use configure
# checks to detect certain features, e.g. availability of thread-local storage.
# The configure script generates a test program and tries to compile and link
# it. It should use target libraries and startfiles of the build tree if
# available and not random ones from the installation prefix for this
# procedure. The search directories specified by -B are a bit special, see
# for_each_path() in gcc.c of the GCC sources. First a search is performed on
# all search paths with the multilib directory appended (if desired), then a
# second search is performed on demand with the base directory only. For each
# multilib there is a "newlib" subdirectory. This directory is specified by a
# -B option for the support libraries. In order to find the newlib artifacts
# (ctr0.o, libc.a, libg.a and libm.a) they must be located in a proper multilib
# subdirectory withing the build directory.
AM_CONDITIONAL(HAVE_MULTISUBDIR, test x$have_multisubdir = xyes)
CRT0=
CRT0_DIR=
if test "x${have_crt0}" = "xyes"; then
CRT0=crt0.o
CRT0_DIR=libc/sys/${sys_dir}/
fi
AM_CONDITIONAL(HAVE_CRT0, test x$have_crt0 = xyes)
AC_SUBST(CRT0)
AC_SUBST(CRT0_DIR)
CRT1=${crt1}
CRT1_DIR=
if test -n "${crt1_dir}"; then
CRT1_DIR=${crt1_dir}/
fi
AC_SUBST(CRT1)
AC_SUBST(CRT1_DIR)
# Put a plausible default for CC_FOR_BUILD in Makefile.
if test -z "$CC_FOR_BUILD"; then
if test "x$cross_compiling" = "xno"; then
CC_FOR_BUILD='$(CC)'
else
CC_FOR_BUILD=gcc
fi
fi
AC_SUBST(CC_FOR_BUILD)
# Also set EXEEXT_FOR_BUILD.
if test "x$cross_compiling" = "xno"; then
EXEEXT_FOR_BUILD='$(EXEEXT)'
else
AC_CACHE_CHECK([for build system executable suffix], newlib_cv_build_exeext,
[cat > ac_c_test.c << 'EOF'
int main() {
/* Nothing needed here */
}
EOF
${CC_FOR_BUILD} -o ac_c_test am_c_test.c 1>&5 2>&5
newlib_cv_build_exeext=`echo ac_c_test.* | grep -v ac_c_test.c | sed -e s/ac_c_test//`
rm -f ac_c_test*
test x"${newlib_cv_build_exeext}" = x && newlib_cv_build_exeext=no])
EXEEXT_FOR_BUILD=""
test x"${newlib_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${newlib_cv_build_exeext}
fi
AC_SUBST(EXEEXT_FOR_BUILD)
AC_DEFINE(_NEWLIB_VERSION, "NEWLIB_VERSION", [The newlib version in string format.])
AC_DEFINE(__NEWLIB__, NEWLIB_MAJOR_VERSION, [The newlib major version number.])
AC_DEFINE(__NEWLIB_MINOR__, NEWLIB_MINOR_VERSION, [The newlib minor version number.])
AC_DEFINE(__NEWLIB_PATCHLEVEL__, NEWLIB_PATCHLEVEL_VERSION, [The newlib patch level.])
if test "${newlib_elix_level}" -gt "0"; then
AC_DEFINE_UNQUOTED(_ELIX_LEVEL, ${newlib_elix_level}, [EL/IX level])
fi
if test "${newlib_reent_check_verify}" = "yes"; then
AC_DEFINE(_REENT_CHECK_VERIFY, 1, [Verify _REENT_CHECK macros allocate memory successfully.])
fi
if test "${newlib_io_c99_formats}" = "yes"; then
AC_DEFINE(_WANT_IO_C99_FORMATS, 1, [Enable C99 formats support (e.g. %a, %zu, ...) in IO functions like printf/scanf.])
fi
if test "${newlib_register_fini}" = "yes"; then
AC_DEFINE(_WANT_REGISTER_FINI, 1, [Register application finalization function using atexit.])
fi
if test "${newlib_io_long_long}" = "yes"; then
AC_DEFINE(_WANT_IO_LONG_LONG, 1, [Define to enable long long type support in IO functions like printf/scanf.])
fi
if test "${newlib_io_long_double}" = "yes"; then
AC_DEFINE(_WANT_IO_LONG_DOUBLE, 1, [Define to enable long double type support in IO functions like printf/scanf.])
fi
if test "${newlib_io_pos_args}" = "yes"; then
AC_DEFINE(_WANT_IO_POS_ARGS, 1, [Positional argument support in printf functions enabled.])
fi
if test "${newlib_reent_small}" = "yes"; then
AC_DEFINE(_WANT_REENT_SMALL, 1, [Optional reentrant struct support. Used mostly on platforms with very restricted storage.])
fi
if test "${newlib_reent_binary_compat}" = "yes"; then
AC_DEFINE(_WANT_REENT_BACKWARD_BINARY_COMPAT, 1, [Define to enable backward binary compatibility for struct _reent.])
fi
if test "${newlib_reent_thread_local}" = "yes"; then
AC_DEFINE(_WANT_REENT_THREAD_LOCAL, 1, [Define to enable thread-local storage objects as a replacment for struct _reent members.])
fi
_mb_len_max=1
if test "${newlib_mb}" = "yes"; then
AC_DEFINE(_MB_CAPABLE, 1, [Multibyte supported.])
_mb_len_max=8
fi
AC_DEFINE_UNQUOTED(_MB_LEN_MAX, $_mb_len_max, [Multibyte max length.])
dnl These are AC_SUBST instead of AC_DEFINE as they're hand maintained in a
dnl dedicated _newlib_version.h, and we don't want them in newlib.h.
AC_SUBST([NEWLIB_VERSION])
AC_SUBST([NEWLIB_MAJOR_VERSION])
AC_SUBST([NEWLIB_MINOR_VERSION])
AC_SUBST([NEWLIB_PATCHLEVEL_VERSION])
if test "${newlib_iconv}" = "yes"; then
AC_DEFINE(_ICONV_ENABLED, 1, [ICONV enabled.])
fi
if test "x${newlib_iconv_external_ccs}" = "xyes"; then
if test "x${newlib_iconv}" = "x"; then
AC_MSG_ERROR(--enable-newlib-iconv-external-ccs option can't be used if iconv library is disabled, use --enable-newlib-iconv to enable it.)
fi
AC_DEFINE(_ICONV_ENABLE_EXTERNAL_CCS, 1, [Enable ICONV external CCS files loading capabilities.])
fi
if test "${newlib_atexit_dynamic_alloc}" = "yes"; then
AC_DEFINE(_ATEXIT_DYNAMIC_ALLOC, 1, [If atexit() may dynamically allocate space for cleanup functions.])
fi
if test "${newlib_fvwrite_in_streamio}" = "yes"; then
AC_DEFINE(_FVWRITE_IN_STREAMIO, 1, [Define if ivo supported in streamio.])
fi
if test "${newlib_fseek_optimization}" = "yes"; then
AC_DEFINE(_FSEEK_OPTIMIZATION, 1, [Define if fseek functions support seek optimization.])
fi
if test "${newlib_wide_orient}" = "yes"; then
AC_DEFINE(_WIDE_ORIENT, 1, [Define if wide char orientation is supported.])
fi
if test "${newlib_nano_malloc}" = "yes"; then
AC_DEFINE(_NANO_MALLOC, 1, [nano version of malloc is used.])
fi
if test "${newlib_unbuf_stream_opt}" = "yes"; then
AC_DEFINE(_UNBUF_STREAM_OPT, 1, [Define if unbuffered stream file optimization is supported.])
fi
if test "${lite_exit}" = "yes"; then
AC_DEFINE(_LITE_EXIT, 1, [Define if lite version of exit supported.])
fi
if test "${newlib_nano_formatted_io}" = "yes"; then
AC_DEFINE(_NANO_FORMATTED_IO, 1, [Define if small footprint nano-formatted-IO implementation used.])
fi
if test "${newlib_retargetable_locking}" = "yes"; then
AC_DEFINE(_RETARGETABLE_LOCKING, 1, [Define if using retargetable functions for default lock routines.])
fi
if test "${newlib_long_time_t}" = "yes"; then
AC_DEFINE(_WANT_USE_LONG_TIME_T, 1, [Define to use type long for time_t.])
fi
if test "${newlib_use_gdtoa}" = "yes"; then
AC_DEFINE(_WANT_USE_GDTOA, 1, [Define if using gdtoa rather than legacy ldtoa.])
fi
dnl
dnl Parse --enable-newlib-iconv-encodings option argument
dnl
if test "x${iconv_encodings}" != "x" \
|| test "x${iconv_to_encodings}" != "x" \
|| test "x${iconv_from_encodings}" != "x"; then
if test "x${newlib_iconv}" = "x"; then
AC_MSG_ERROR([--enable-newlib-iconv-encodings, --enable-newlib-iconv-from-encodings and --enable-newlib-iconv-to-encodings option can't be used if iconv library is disabled, use --enable-newlib-iconv to enable it.])
fi
dnl Normalize encodings names and delete commas
iconv_encodings=`echo "${iconv_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
iconv_to_encodings=`echo "${iconv_to_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
iconv_from_encodings=`echo "${iconv_from_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
dnl Get the list of available encodings excluding comments
dnl Join line with previous if the first character is whitespace
available_encodings=`cat "${srcdir}/libc/iconv/encoding.aliases" | sed -e '/^#.*/d'`
dnl Check if required encodings are supported
dnl Convert aliases to names
dnl iconv_encodings
iconv_encodings1="${iconv_encodings}"
iconv_encodings=""
for encoding in ${iconv_encodings1}; do
result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
if test $? != "0"; then
AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
fi
encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
iconv_encodings="${iconv_encodings} ${encoding1}"
done
dnl Enable appropriate option in newlib.h
for encoding in ${iconv_encodings}; do
opt=_ICONV_TO_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
eval "$opt=1"
opt=_ICONV_FROM_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
eval "$opt=1"
done
dnl iconv_to_encodings
iconv_encodings1="${iconv_to_encodings}"
iconv_to_encodings=""
for encoding in ${iconv_encodings1}; do
result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
if test $? != "0"; then
AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
fi
encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
iconv_to_encodings="${iconv_to_encodings} ${encoding1}"
done
dnl Enable appropriate option in newlib.h
for encoding in ${iconv_to_encodings}; do
opt=_ICONV_TO_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
eval "$opt=1"
done
dnl iconv_from_encodings
iconv_encodings1="${iconv_from_encodings}"
iconv_from_encodings=""
for encoding in ${iconv_encodings1}; do
result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
if test $? != "0"; then
AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
fi
encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
iconv_from_encodings="${iconv_from_encodings} ${encoding1}"
done
dnl Enable appropriate option in newlib.h
for encoding in ${iconv_from_encodings}; do
opt=_ICONV_FROM_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
eval "$opt=1"
done
fi;
NEWLIB_ICONV_DEFINES
AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
newlib_cv_initfinit_array, [dnl
cat > conftest.c <<EOF
int _start (void) { return 0; }
int __start (void) { return 0; }
int foo (void) { return 1; }
int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
EOF
if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest conftest.c
1>&AS_MESSAGE_LOG_FD])
then
if ${READELF} -S conftest | grep -e INIT_ARRAY > /dev/null; then
newlib_cv_initfinit_array=yes
else
newlib_cv_initfinit_array=no
fi
else
newlib_cv_initfinit_array=no
fi
rm -f conftest*])
if test $newlib_cv_initfinit_array = yes; then
AC_DEFINE(_HAVE_INITFINI_ARRAY, 1, [Define if the linker supports .preinit_array/.init_array/.fini_array sections.])
fi
AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
__attribute__ ((__optimize__)), newlib_cv_cc_loop_to_function, [dnl
cat > conftest.c <<EOF
void
__attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
foo (void) {}
EOF
newlib_cv_cc_loop_to_function=no
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c
-fno-tree-loop-distribute-patterns conftest.c])
then
newlib_cv_cc_loop_to_function=yes
fi
rm -f conftest*])
if test $newlib_cv_cc_loop_to_function = yes; then
AC_DEFINE(_HAVE_CC_INHIBIT_LOOP_TO_LIBCALL, 1, [Define if compiler supports -fno-tree-loop-distribute-patterns.])
fi
AC_TYPE_LONG_DOUBLE
dnl Export the setting for our installed headers to check.
if test $ac_cv_type_long_double = yes; then
AC_DEFINE(_HAVE_LONG_DOUBLE, 1, [Define if the platform supports long double type.])
fi
AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$ac_cv_type_long_double" = x"yes")
AC_CACHE_CHECK(whether long double equals double,
newlib_cv_ldbl_eq_dbl, [dnl
cat > conftest.c <<EOF
#include <float.h>
#if DBL_MANT_DIG == LDBL_MANT_DIG && LDBL_MIN_EXP == DBL_MIN_EXP && \
LDBL_MAX_EXP == DBL_MAX_EXP
#define _LDBL_EQ_DBL
#else
#error "LDBL != DBL"
#endif
EOF
if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c
1>&AS_MESSAGE_LOG_FD])
then
newlib_cv_ldbl_eq_dbl=yes;
else
newlib_cv_ldbl_eq_dbl=no;
fi
rm -f conftest*])
if test $newlib_cv_ldbl_eq_dbl = yes; then
AC_DEFINE(_LDBL_EQ_DBL, 1, [Define if the platform long double type is equal to double.])
fi
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View File

@@ -0,0 +1,958 @@
# configure.host
# This shell script handles all host based configuration for newlib.
# It sets various shell variables based on the the host and the
# configuration options. You can modify this shell script without
# needing to rerun autoconf.
# This shell script should be invoked as
# . configure.host
# If it encounters an error, it will exit with a message.
# FIXME: This script is too complicated. It does things in too many
# different ways. This was taken from the old Cygnus configure script
# with only minor changes. It should be cleaned up.
# FIXME: The general approach of picking and choosing which
# directories to configure, other than machine_dir and sys_dir, is
# potentially confusing.
# It uses the following shell variables:
# host The configuration host
# host_cpu The configuration host CPU
# newlib_mb --enable-newlib-mb ("yes", "no")
# target_optspace --enable-target-optspace ("yes", "no", "")
# newlib_multithread --enable-newlib-multithread ("yes", "no", "yes")
# newlib_elix_level --enable-newlib-elix-level ("1","2","3","4") ("4")
# newlib_io_c99_formats --enable-newlib-io-c99-formats ("yes", "no", "")
# newlib_io_long_long --enable-newlib-io-long-long ("yes", "no", "")
# newlib_io_long_double --enable-newlib-io-long-double ("yes", "no", "")
# newlib_global_stdio_streams --enable-global-stdio-streams ("yes", "no, "")
# newlib_fno_builtin --disable-newlib-fno-builtin ("yes", "no, "")
# newlib_reent_check_verify --enable-newlib-reent-check-verify ("yes", "no, "")
# It sets the following shell variables:
# newlib_cflags Special CFLAGS to use when building
# machine_dir Subdirectory of libc/machine to configure
# shared_machine_dir Subdirectory of libc/machine for files shared
# between specific architectures, optional
# sys_dir Subdirectory of libc/sys to configure
# have_sys_mach_dir Is there a machine subdirectory in sys subdirectory
# posix_dir "posix" to build libc/posix, "" otherwise
# signal_dir "signal" to build libc/signal, "" otherwise
# stdio64_dir "stdio64" to build libc/stdio64, "" otherwise
# syscall_dir "syscalls" to build libc/syscalls, "" otherwise
# unix_dir "unix" to build libc/unix, "" otherwise
# lpfx library object prefix - generated when no libtool
# crt1 name of crt1 object if one is provided
# crt1_dir directory where crt1 object is found
# have_crt0 "yes"/"no" if crt0 is/isn't provided.
# "" if crt0 is provided when sys_dir is set
# have_init_fini have init/fini ("yes" or "no", set to "yes" by default)
# noinclude list of include files to not install
newlib_cflags="-D_LIBC"
libm_machine_dir=
machine_dir=
shared_machine_dir=
sys_dir=
posix_dir=
signal_dir=signal
stdio_dir=stdio
stdio64_dir=
xdr_dir=
syscall_dir=
unix_dir=
noinclude=
mach_add_setjmp=
crt1=
crt1_dir=
have_crt0=
have_init_fini=yes
default_newlib_io_c99_formats=no
default_newlib_io_long_long=no
default_newlib_io_long_double=no
default_newlib_io_pos_args=no
default_newlib_atexit_dynamic_alloc=yes
default_newlib_nano_malloc=no
default_newlib_reent_check_verify=yes
lpfx="lib_a-"
newlib_msg_warn=
case "${target_optspace}:${host}" in
yes:*)
newlib_cflags="${newlib_cflags} -Os"
;;
:m32r-* | :d10v-* | :d30v-* | :avr-* | :m32c-* | :msp430*-* | :nds32* | :pru-* | :rl78-* )
newlib_cflags="${newlib_cflags} -Os"
;;
no:* | :*)
;;
esac
case "${newlib_fno_builtin}:${host}" in
yes:*)
newlib_cflags="${newlib_cflags} -fno-builtin"
;;
no:*)
newlib_cflags="${newlib_cflags}"
;;
*:*)
# For now, all targets default to using -fno-builtin until tested without
newlib_cflags="${newlib_cflags} -fno-builtin"
;;
esac
# Get the source directories to use for the CPU type.
# machine_dir should supply CPU dependent routines, such as setjmp.
# newlib_cflags is passed to gcc when compiling.
# THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
case "${host_cpu}" in
a29k)
machine_dir=a29k
;;
aarch64*)
machine_dir=aarch64
libm_machine_dir=aarch64
;;
amdgcn*)
newlib_cflags="${newlib_cflags} -D__DYNAMIC_REENT__"
machine_dir=amdgcn
libm_machine_dir=amdgcn
newlib_cv_initfinit_array=yes
;;
arc*)
machine_dir=arc
;;
arm*)
machine_dir=arm
libm_machine_dir=arm
;;
avr*)
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -mcall-prologues"
;;
bfin)
machine_dir=bfin
;;
cr16*)
machine_dir=cr16
;;
cris | crisv32)
# The size of the (kernel_)time_t passed from or to a
# simulator or a Linux kernel is mandated by the
# gettimeofday and time system calls and fixed to 32 bits, the
# size of a long. Instead of churning as 64 bits what is anyway
# 32 bits, it makes more sense to default to long.
test -z "${enable_newlib_long_time_t}" && newlib_long_time_t=yes
machine_dir=cris
;;
crx*)
machine_dir=crx
;;
csky*)
machine_dir=csky
default_newlib_atexit_dynamic_alloc="no"
;;
d10v*)
machine_dir=d10v
;;
d30v*)
machine_dir=d30v
;;
epiphany)
machine_dir=epiphany
;;
fido)
machine_dir=m68k
newlib_cflags="${newlib_cflags} -DCOMPACT_CTYPE"
;;
fr30)
machine_dir=fr30
;;
frv)
machine_dir=frv
;;
ft32*)
machine_dir=ft32
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED"
;;
h8300)
machine_dir=h8300
;;
h8500)
machine_dir=h8500
;;
hppa*)
machine_dir=hppa
;;
i960)
machine_dir=i960
;;
i[34567]86)
libm_machine_dir=i386
machine_dir=i386
shared_machine_dir=shared_x86
# Don't use for these since they provide their own setjmp.
case ${host} in
*-*-sco* | *-*-cygwin*)
;;
*)
mach_add_setjmp=true
;;
esac
;;
ia64*)
;;
iq2000)
machine_dir=iq2000
;;
lm32)
machine_dir=lm32
;;
m32c)
machine_dir=m32c
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -DSMALL_MEMORY"
;;
m32r*)
machine_dir=m32r
;;
m68hc11|m6811|m68hc12|m6812)
machine_dir=m68hc11
newlib_cflags="-DPREFER_SIZE_OVER_SPEED -Os -mrelax"
CFLAGS="-g -Os"
;;
m68*)
machine_dir=m68k
newlib_cflags="${newlib_cflags} -DCOMPACT_CTYPE"
;;
m88k)
machine_dir=m88k
newlib_cflags="${newlib_cflags} -m88000"
;;
m88110)
machine_dir=m88k
newlib_cflags="${newlib_cflags} -m88110"
;;
mcore)
;;
microblaze*)
machine_dir=microblaze
;;
mep)
machine_dir=mep
;;
mips*)
machine_dir=mips
libm_machine_dir=mips
;;
mmix)
;;
mn10200)
machine_dir=mn10200
;;
mn10300)
default_newlib_io_long_long="yes"
machine_dir=mn10300
;;
moxie)
machine_dir=moxie
;;
msp430*)
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -DSMALL_MEMORY"
newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections "
newlib_cflags="${newlib_cflags} -mOs "
newlib_cflags="${newlib_cflags} -mhwmult=none "
machine_dir=msp430
default_newlib_nano_malloc="yes"
;;
mt*)
machine_dir=mt
;;
nds32*)
machine_dir=nds32
libm_machine_dir=nds32
newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections"
newlib_cflags="${newlib_cflags} -DHAVE_RENAME"
;;
nios2*)
machine_dir=nios2
;;
nvptx*)
machine_dir=nvptx
newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED"
;;
or1k*|or1knd*)
machine_dir=or1k
have_init_fini=no
;;
powerpc*)
machine_dir=powerpc
libm_machine_dir=powerpc
;;
pru*)
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED"
newlib_cflags="${newlib_cflags} -DNO_EXEC"
newlib_cflags="${newlib_cflags} -DSMALL_MEMORY"
newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections "
default_newlib_nano_malloc="yes"
default_newlib_atexit_dynamic_alloc="no"
machine_dir=pru
libm_machine_dir=pru
;;
riscv*)
libm_machine_dir=riscv
machine_dir=riscv
newlib_cflags="${newlib_cflags} -DHAVE_NANOSLEEP"
default_newlib_atexit_dynamic_alloc="no"
have_init_fini=no
;;
rl78)
machine_dir=rl78
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -DSMALL_MEMORY"
newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections "
;;
rx)
machine_dir=rx
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections "
;;
sh | sh64)
machine_dir=sh
;;
sparc*)
libm_machine_dir=sparc
machine_dir=sparc
# FIXME: Might wish to make MALLOC_ALIGNMENT more generic.
newlib_cflags="${newlib_cflags} -DMALLOC_ALIGNMENT=8"
;;
tic4x|c4x)
machine_dir=tic4x
;;
tic6x)
machine_dir=tic6x
;;
tic80*)
machine_dir=tic80
;;
v70)
;;
v810)
;;
v850*)
machine_dir=v850
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED "
;;
visium)
machine_dir=visium
;;
w65*)
machine_dir=w65
;;
x86_64)
machine_dir=x86_64
libm_machine_dir=x86_64
shared_machine_dir=shared_x86
;;
xc16x*)
machine_dir=xc16x
;;
xstormy16)
machine_dir=xstormy16
newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED"
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED"
;;
xtensa)
libm_machine_dir=xtensa
machine_dir=xtensa
newlib_cflags="${newlib_cflags} -mlongcalls"
default_newlib_atexit_dynamic_alloc="no"
have_init_fini=no
;;
z8k)
machine_dir=z8k
;;
spu)
stdio_dir=
libm_machine_dir=spu
machine_dir=spu
newlib_cflags="${newlib_cflags} -D_POSIX_MODE"
newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED"
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections "
;;
*)
echo '***' "Newlib does not support CPU ${host_cpu}" 1>&2
exit 1
;;
esac
# Disable thread support if requested.
if [ "${newlib_multithread}" = "no" ] ; then
newlib_cflags="${newlib_cflags} -D__SINGLE_THREAD__"
fi
# Disable syscall support if requested.
if [ "${newlib_may_supply_syscalls}" = "no" ] ; then
newlib_cflags="${newlib_cflags} -D__NO_SYSCALLS__"
fi
# Enable multibyte support if requested or it is defaulted
# for target.
if [ "x${newlib_mb}" = "x" ]; then
case "${host}" in
*-*-cygwin*)
newlib_mb=yes
;;
esac
fi
# Disable printf/scanf floating-point support if requested.
if [ "${newlib_io_float}" = "no" ] ; then
newlib_cflags="${newlib_cflags} -DNO_FLOATING_POINT"
fi
# Get the source directories to use for the host. unix_dir is set
# to unix to get some standard Unix routines. posix_dir is set to get some
# standard Posix routines. sys_dir should supply system dependent routines
# including crt0.
# THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
case "${host}" in
*-*-cygwin*)
posix_dir=posix
xdr_dir=xdr
;;
*-*-netware*)
signal_dir=
sys_dir=netware
;;
*-*-rtems*) # generic RTEMS support
sys_dir=rtems
posix_dir=posix
unix_dir=unix
;;
*-*-tirtos*)
sys_dir=tirtos
have_crt0="no"
;;
a29k-*-*)
sys_dir=a29khif
signal_dir=
;;
amdgcn*)
sys_dir=amdgcn
have_crt0="no"
;;
arm*-*-*)
sys_dir=arm
if [ "x${newlib_may_supply_syscalls}" = "xno" ] ; then
have_crt0="no"
fi
;;
bfin-*-*)
sys_dir=
;;
cr16-*-*)
sys_dir=
;;
crx*)
sys_dir=
;;
d10v*)
sys_dir=d10v
;;
d30v*)
sys_dir=
;;
epiphany-*-*)
sys_dir=epiphany
# crt0 is provided by libgloss.
have_crt0="no"
;;
frv*)
sys_dir=
;;
ft32*)
sys_dir=
;;
h8300-*-hms*)
sys_dir=h8300hms
;;
h8300-*-elf*)
sys_dir=h8300hms
;;
h8300-*-coff*)
sys_dir=h8300hms
;;
h8300-*-xray*)
sys_dir=h8300xray
;;
h8500-*-hms*)
sys_dir=h8500hms
;;
h8500-*-elf*)
sys_dir=h8500hms
;;
i[34567]86-*-rdos*)
sys_dir=rdos
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
newlib_cflags="${newlib_cflags} -D_I386MACH_DISABLE_HW_INTERRUPTS"
;;
i[34567]86-*-sco*)
sys_dir=sysvi386
unix_dir=unix
;;
m68hc11-*-*|m6811-*-*|m6812-*-*|m68hc12-*-*)
;;
m68k-sun-sunos*)
unix_dir=unix
;;
m8*-bug-*)
sys_dir=m88kbug
;;
mep-*-*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
;;
microblaze*-*-*)
machine_dir=microblaze
;;
mmix-knuth-mmixware)
sys_dir=mmixware
;;
moxie*)
sys_dir=
;;
nios2*)
sys_dir=
;;
or1k-*-elf | or1knd-*-elf)
sys_dir=or1k
newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED "
have_crt0="no"
;;
powerpcle-*-pe)
posix_dir=posix
;;
sh*-*)
sys_dir=sh
;;
spu-*-*)
default_newlib_io_long_long="yes"
default_newlib_atexit_dynamic_alloc="no"
;;
tic6x*)
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
have_crt0="no"
;;
tic80*)
sys_dir=tic80
;;
v70-nec-*)
sys_dir=sysvnecv70
;;
v810-*-*)
sys_dir=sysnec810
;;
v850*-*-*)
sys_dir=sysnecv850
if [ "x${newlib_may_supply_syscalls}" = "xno" ] ; then
have_crt0="no"
fi
;;
visium-*-*)
sys_dir=
;;
w65-*-*)
sys_dir=w65
;;
xtensa*-*-*)
sys_dir=xtensa
;;
z8k-*-coff)
sys_dir=z8ksim
;;
esac
# Host specific flag settings -- usually for features that are not
# general enough or broad enough to be handled above.
# THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
case "${host}" in
*-*-cygwin*)
test -z "$cygwin_srcdir" && cygwin_srcdir="${abs_newlib_basedir}/../winsup/cygwin"
export cygwin_srcdir
default_newlib_io_c99_formats="yes"
default_newlib_io_long_long="yes"
default_newlib_io_long_double="yes"
default_newlib_io_pos_args="yes"
CC="${CC} -I${cygwin_srcdir}/include"
newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DGETREENT_PROVIDED -DSIGNAL_PROVIDED -DHAVE_BLKSIZE -DHAVE_FCNTL -DMALLOC_PROVIDED -DHAVE_CHDIR -DHAVE_FCHDIR"
syscall_dir=syscalls
;;
# RTEMS supplies its own versions of some routines:
# malloc() (reentrant version)
# exit() RTEMS has a "global" reent to flush
# signal()/raise() RTEMS has its own including pthread signals
# _XYZ_r() RTEMS has its own reentrant routines
#
# NOTE: When newlib malloc uses a semaphore, RTEMS will switch to that.
*-*-rtems*)
default_newlib_io_long_long="yes"
default_newlib_io_c99_formats="yes"
newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections "
newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DGETREENT_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
# turn off unsupported items in posix directory
newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN -D_NO_POSIX_SPAWN"
;;
# VxWorks supplies its own version of malloc, and the newlib one
# doesn't work because VxWorks does not have sbrk.
*-wrs-vxworks*)
newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED -DMISSING_SYSCALL_NAMES -DHAVE_FCNTL"
;;
# TIRTOS supplies its own version of malloc
*-*-tirtos*)
newlib_cflags="${newlib_cflags} -D__DYNAMIC_REENT__ -DMALLOC_PROVIDED"
;;
# UDI doesn't have exec, so system() should fail the right way
a29k-amd-udi)
newlib_cflags="${newlib_cflags} -DNO_EXEC"
syscall_dir=syscalls
;;
aarch64*-*-*)
default_newlib_io_long_long="yes"
syscall_dir=syscalls
;;
arc*-*-*)
syscall_dir=syscalls
default_newlib_io_long_long="yes"
;;
arm*-*-pe)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DHAVE_SYSCONF_PAGESIZE"
;;
arm*-*-*)
syscall_dir=syscalls
# If newlib is supplying syscalls, select which debug protocol is being used.
# ARM_RDP_MONITOR selects the Demon monitor.
# ARM_RDI_MONITOR selects the Angel monitor.
# If neither are defined, then hard coded defaults will be used
# to create the program's environment.
# If --disable-newlib-supplied-syscalls is specified, then the end-user
# may specify the protocol via gcc spec files supplied by libgloss.
if [ "x${newlib_may_supply_syscalls}" = "xyes" ] ; then
# newlib_cflags="${newlib_cflags} -DARM_RDP_MONITOR"
newlib_cflags="${newlib_cflags} -DARM_RDI_MONITOR"
fi
newlib_cflags="${newlib_cflags} -DHAVE_SYSCONF_PAGESIZE"
;;
avr*)
newlib_cflags="${newlib_cflags} -DNO_EXEC -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
;;
bfin*)
syscall_dir=syscalls
;;
cris-*-* | crisv32-*-*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DHAVE_RENAME -D_USE_WRITE -DCOMPACT_CTYPE"
syscall_dir=syscalls
;;
cr16-*-*)
syscall_dir=syscalls
;;
crx-*-*)
newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DMISSING_SYSCALL_NAMES"
syscall_dir=
;;
csky*)
newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DHAVE_SYSTEM -DMISSING_SYSCALL_NAMES"
syscall_dir=
;;
d10v*)
newlib_cflags="${newlib_cflags} -DSMALL_MEMORY"
syscall_dir=syscalls
;;
d30v*)
newlib_cflags="${newlib_cflags} -DABORT_MESSAGE -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
syscall_dir=
;;
epiphany*)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED"
;;
fido-*-elf)
newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DHAVE_SYSTEM -DMISSING_SYSCALL_NAMES"
syscall_dir=
;;
fr30-*-*)
syscall_dir=syscalls
;;
frv-*-*)
syscall_dir=syscalls
default_newlib_io_long_long="yes"
;;
ft32*-*-*)
syscall_dir=syscalls
;;
h8300*-*-*)
syscall_dir=syscalls
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
# Simulator only extensions for H8300.
# Uncomment the next line to enable them.
# newlib_cflags="${newlib_cflags} -D__SIMULATOR__"
;;
h8500-*-*)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
;;
i[34567]86-*-sco*)
newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED -DHAVE_FCNTL"
;;
i[34567]86-*-netware*)
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DNO_EXEC -DABORT_PROVIDED -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DHAVE_FCNTL"
;;
i[3-7]86-*-elfiamcu)
newlib_cflags="${newlib_cflags} -Os -DPREFER_SIZE_OVER_SPEED -ffunction-sections -fomit-frame-pointer -DREENTRANT_SYSCALL_PROVIDED"
if [ "${newlib_multithread}" = "no" ] ; then
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
else
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -D__DYNAMIC_REENT__"
fi
;;
iq2000*)
syscall_dir=syscalls
default_newlib_io_long_long="yes"
;;
lm32-*-*)
syscall_dir=syscalls
;;
m32c-*-*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DABORT_PROVIDED"
syscall_dir=
;;
m32r-*-*)
# Pass -msdata=sdata so _impure_ptr goes in .sdata.
# We don't generate sda relocs however for upward compatibility.
# FIXME: This is necessary because the default multilib doesn't
# use --print-multi-lib.
newlib_cflags="${newlib_cflags} -msdata=sdata"
syscall_dir=syscalls
;;
m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
newlib_cflags="${newlib_cflags} -DNO_EXEC -DABORT_PROVIDED -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
;;
m68k-unknown-elf)
newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DHAVE_SYSTEM -DMISSING_SYSCALL_NAMES"
syscall_dir=
;;
mcore-*-*)
syscall_dir=syscalls
;;
microblaze*-*-*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DSMALL_MEMORY -D_REENT_SMALL"
;;
mips64vr*-*-*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
;;
mips*-*-elf*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
;;
mmix-*)
syscall_dir=syscalls
# We need every symbol 32-bit aligned, so the invalid
# construct with attribute ((alias ("_ctype_b+127"))) breaks.
newlib_cflags="${newlib_cflags} -DCOMPACT_CTYPE"
;;
mn10?00-*-*)
syscall_dir=syscalls
;;
moxie-*-elf* | moxie-*-rtems*)
syscall_dir=syscalls
default_newlib_io_long_long="yes"
;;
moxie-*-moxiebox)
syscall_dir=syscalls
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -Os -DPREFER_SIZE_OVER_SPEED -DSMALL_MEMORY"
;;
nios2*)
syscall_dir=
newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DHAVE_SYSTEM -DMISSING_SYSCALL_NAMES"
;;
nds32*)
syscall_dir=syscalls
;;
or1k*|or1knd*)
syscall_dir=syscalls
;;
powerpc*-*-eabialtivec*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
;;
powerpc*-*-eabispe*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
;;
powerpc*-*-eabi* | \
powerpc*-*-elf* | \
powerpc*-*-linux* | \
powerpc*-*-rtem* | \
powerpc*-*-sysv* | \
powerpc*-*-solaris*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -mrelocatable-lib -mno-eabi -mstrict-align -DMISSING_SYSCALL_NAMES"
;;
powerpcle-*-pe)
newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DHAVE_FCNTL -D_NO_POSIX_SPAWN"
syscall_dir=syscalls
;;
pru*)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DSMALL_MEMORY -D_REENT_SMALL"
;;
riscv*-*-*)
syscall_dir=syscalls
;;
sh*-*-*)
default_newlib_io_long_long="yes"
syscall_dir=syscalls
;;
sparc-sun-sunos*)
newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED"
;;
sparc64-*-*)
newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_BLKSIZE -DHAVE_FCNTL"
# This either belongs elsewhere or nowhere. But I need *something*,
# so for now it's here ...
case "${host_os}" in
aoutv8 | *32p)
newlib_cflags="${newlib_cflags} -DTARGET_PTR_SIZE=32" ;;
*)
newlib_cflags="${newlib_cflags} -DTARGET_PTR_SIZE=64" ;;
esac
;;
tic6x*)
syscall_dir=
newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED"
;;
tic80*)
syscall_dir=syscalls
;;
v850*-*-*)
syscall_dir=syscalls
;;
visium-*-*)
newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DHAVE_SYSTEM -DMISSING_SYSCALL_NAMES"
syscall_dir=
;;
w65-*-*)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
;;
xc16x-*)
syscall_dir=syscalls
;;
xstormy16-*-*)
syscall_dir=syscalls
;;
xtensa*-*-* | xtensa*-*)
syscall_dir=syscalls
;;
z8k-*-*)
syscall_dir=syscalls
;;
*)
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
syscall_dir=
;;
esac
# Use defaults for certain settings if not specified by user
# Enable C99 format support in I/O routines if requested.
if [ "x${newlib_io_c99_formats}" = "x" ]; then
if [ ${default_newlib_io_c99_formats} = "yes" ]; then
newlib_io_c99_formats="yes";
fi
fi
# Enable long long support in I/O routines if requested.
if [ "x${newlib_io_long_long}" = "x" ]; then
if [ ${default_newlib_io_long_long} = "yes" ]; then
newlib_io_long_long="yes";
fi
fi
# Enable long double support in I/O routines if requested.
if [ "x${newlib_io_long_double}" = "x" ]; then
if [ ${default_newlib_io_long_double} = "yes" ]; then
newlib_io_long_double="yes";
fi
fi
# Enable printf positional argument support if requested.
if [ "x${newlib_io_pos_args}" = "x" ]; then
if [ ${default_newlib_io_pos_args} = "yes" ]; then
newlib_io_pos_args="yes";
fi
fi
# Disable atexit dynamic allocation if requested.
if [ "x${newlib_atexit_dynamic_alloc}" = "x" ]; then
if [ ${default_newlib_atexit_dynamic_alloc} = "yes" ]; then
newlib_atexit_dynamic_alloc="yes";
fi
fi
# Enable nano-malloc if requested.
if [ "x${newlib_nano_malloc}" = "x" ]; then
if [ ${default_newlib_nano_malloc} = "yes" ]; then
newlib_nano_malloc="yes";
fi
fi
# Enable _REENT_CHECK macro memory allocation verification.
if [ "x${newlib_reent_check_verify}" = "x" ]; then
if [ ${default_newlib_reent_check_verify} = "yes" ]; then
newlib_reent_check_verify="yes";
fi
fi
# Remove rpc headers if xdr_dir not specified
if [ "x${xdr_dir}" = "x" ]; then
noinclude="${noinclude} rpc/types.h rpc/xdr.h"
fi
# Have init/finit if not explicitly specified otherwise
if [ "x${have_init_fini}" != "xno" ]; then
newlib_cflags="${newlib_cflags} -D_HAVE_INIT_FINI"
fi
if test -z "${have_crt0}" && test -n "${sys_dir}"; then
have_crt0="yes"
fi
# Target-specific defaults
case "${host_cpu}" in
nvptx*)
if [[ -z ${newlib_global_stdio_streams} ]]; then
newlib_global_stdio_streams="yes";
fi
;;
esac

3
libraries/newlib/doc/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
# PLY artefacts
parser.out
parsetab.py

View File

@@ -0,0 +1,40 @@
MKDOC = doc/makedoc$(EXEEXT_FOR_BUILD)
# We can't use noinst_PROGRAMS, because automake will add $(EXEEXT).
noinst_DATA += $(MKDOC)
# We don't use CFLAGS with CC_FOR_BUILD because here CFLAGS will
# actually be CFLAGS_FOR_TARGET, and in some cases that will include
# -Os, which CC_FOR_BUILD may not recognize.
$(MKDOC): doc/makedoc.o
$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ $<
doc/makedoc.o: doc/makedoc.c
$(MKDIR_P) doc
$(CC_FOR_BUILD) -g $(CFLAGS_FOR_BUILD) -o $@ -c $<
#
# Subdir documentation rules.
#
SUFFIXES += .def
CHEW = $(MKDOC) -f $(srcdir)/%D%/doc.str
.c.def:
$(AM_V_at)$(MKDIR_P) $(@D)
$(AM_V_GEN)$(CHEW) < $< > $*.def || ( rm $*.def && false )
SUFFIXES += .xml
DOCBOOK_CHEW = ${top_srcdir}/%D%/makedocbook.py
.c.xml:
$(AM_V_at)$(MKDIR_P) $(@D)
$(AM_V_GEN)$(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false )
# We can't use .tex.xml rule here as it'll conflict with .c.xml when the chapter
# name (e.g. "stdio.xml") matches a source file name (e.g. "stdio.c"). We've
# been flattening chapters into the main library dir (e.g. libc/) to avoid that.
TEXI2DOCBOOK = $(top_srcdir)/%D%/chapter-texi2docbook.py

View File

@@ -0,0 +1,55 @@
#!/usr/bin/env python3
#
# python script to convert the handwritten chapter .texi files, which include
# the generated files for each function, to DocBook XML
#
# all we care about is the content of the refentries, so all this needs to do is
# convert the @include of the makedoc generated .def files to xi:include of the
# makedocbook generated .xml files.
#
from __future__ import print_function
import sys
import re
def main():
first_node = True
prev_sect = False
print('<?xml version="1.0" encoding="UTF-8"?>')
print('<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">')
for l in sys.stdin.readlines():
l = l.rstrip()
# transform @file{foo} to <filename>foo</filename>
l = re.sub("@file{(.*?)}", "<filename>\\1</filename>", l)
if l.startswith("@node"):
l = l.replace("@node", "", 1)
l = l.strip()
if first_node:
print('<chapter id="%s_chapter" xmlns:xi="http://www.w3.org/2001/XInclude">' % l.lower().replace(' ', '_'))
first_node = False
else:
if prev_sect:
print('</section>')
print('<section id="%s">' % l)
prev_sect = True
elif l.startswith("@chapter "):
l = l.replace("@chapter ", "", 1)
print('<title>%s</title>' % l)
elif l.startswith("@section "):
l = l.replace("@section ", "", 1)
print('<title>%s</title>' % l)
elif l.startswith("@include "):
l = l.replace("@include ", "", 1)
l = l.replace(".def", ".xml", 1)
print('<xi:include href="%s"/>' % l.strip())
if prev_sect:
print('</section>')
print('</chapter>')
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,160 @@
: nokill_bogus_lines ;
: ENDDD
skip_past_newline
;
: TABLE
skip_past_newline
"@table @code\n" catstr
;
: ENDTABLE
skip_past_newline
"@end table\n"
catstr
;
: QUICKREF
skip_past_newline
;
: MATHREF
skip_past_newline
;
: EXAMPLE
skip_past_newline
get_stuff_in_command nokill_bogus_lines translatecomments
courierize catstr
;
: INODE
"@node " catstr skip_past_newline copy_past_newline catstr
;
: CODE_FRAGMENT
EXAMPLE
;
: SYNOPSIS
skip_past_newline
"@strong{Synopsis}\n" catstr
"@example\n" catstr
get_stuff_in_command
do_fancy_stuff
nokill_bogus_lines
indent
catstr
"@end example\n" catstr
;
: ANSI_SYNOPSIS
skip_past_newline
"@strong{Synopsis}\n" catstr
"@example\n" catstr
get_stuff_in_command
do_fancy_stuff
nokill_bogus_lines
indent
catstr
"@end example\n" catstr
"ANSI_SYNOPSIS is deprecated, use SYNOPSIS instead" warn
;
: TRAD_SYNOPSIS
skip_past_newline
"TRAD_SYNOPSIS is obsolete and ignored" warn
;
: INDEX
"@findex " skip_past_newline copy_past_newline catstr catstr
;
: FUNCTION
"@node " - a
skip_past_newline
copy_past_newline
dup - a x x
get_stuff_in_angle -a x y
swap
do_fancy_stuff
"@section " - a x x b
swap
remchar
"\n" - a x b x c
catstr catstr catstr catstr catstr
;
: bodytext
get_stuff_in_command
bulletize
courierize
do_fancy_stuff
catstr
"@sp 1\n" catstr
;
: asection
skip_past_newline
catstr
copy_past_newline
do_fancy_stuff catstr
bodytext
;
: SECTION
"@section " asection ;
: SUBSECTION
"@section " asection ;
: SUBSUBSECTION
"@subsection " asection ;
: subhead
skip_past_newline
bodytext
;
: DESCRIPTION
"@strong{Description}@*\n" catstr subhead ;
: RETURNS
"@strong{Returns}@*\n" catstr subhead ;
: ERRORS
"@strong{Errors}@*\n" catstr subhead ;
: PORTABILITY
"@strong{Portability}@*\n" catstr subhead ;
: BUGS
"@strong{Bugs}@*\n" catstr subhead ;
: WARNINGS
"@strong{Warnings}@*\n" catstr subhead ;
: SEEALSO
"@strong{See Also}@*\n" catstr subhead ;
: NOTES
"@strong{Notes}@*\n" catstr subhead ;
: INTERNAL_FUNCTION
;
: INTERNAL_DEFINITION
;
: INTERNAL
;
: TYPEDEF
FUNCTION ;
: NEWPAGE
"@page\n" catstr subhead ;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,845 @@
#!/usr/bin/env python3
#
# python script to process makedoc instructions in a source file and produce
# DocBook XML output
#
#
# This performs 3 stages of processing on it's input, in a similar fashion
# to makedoc:
#
# 1. Discard everything outside of /* */ comments
# 2. Identify lines which contains commands (a single uppercase word)
# 3. Apply each command to the text of the following lines (up to the next
# command or the end of the comment block), to produce some output
#
# The resulting output contains one or more DocBook XML refentry elements.
#
# To make the output a valid XML document which can be xincluded, those refentry
# elements are contained by a refcontainer element. refcontainer is not part of
# the DocBook DTD and should be removed by a suitable XSLT.
#
from __future__ import print_function
import fcntl
import sys
import os
import re
from optparse import OptionParser
import lxml.etree
import ply.lex as lex
import ply.yacc as yacc
rootelement = None # root element of the XML tree
refentry = None # the current refentry
verbose = 0
def dump(s, stage, threshold=1):
if verbose > threshold:
print('*' * 40, file=sys.stderr)
print(stage, file=sys.stderr)
print('*' * 40, file=sys.stderr)
print('%s' % s, file=sys.stderr)
print('*' * 40, file=sys.stderr)
#
# Stage 1
#
def skip_whitespace_and_stars(i, src):
while i < len(src) and (src[i].isspace() or (src[i] == '*' and src[i + 1] != '/')):
i += 1
return i
# Discard everything not inside '/* */' style-comments which start at column 0
# Discard any leading blank space or '*'
# Discard a single leading '.'
# Discard blank lines after a blank line
def comment_contents_generator(src):
i = 0
while i < len(src) - 2:
if src[i] == '\n' and src[i + 1] == '/' and src[i + 2] == '*':
i = i + 3
i = skip_whitespace_and_stars(i, src)
if src[i] == '.':
i += 1
while i < len(src):
if src[i] == '\n':
yield '\n'
i += 1
# allow a single blank line
if i < len(src) and src[i] == '\n':
yield '\n'
i += 1
i = skip_whitespace_and_stars(i, src)
elif src[i] == '*' and src[i + 1] == '/':
i = i + 2
# If we have just output \n\n, this adds another blank line.
# This is the only way a double blank line can occur.
yield '\nEND\n'
break
else:
yield src[i]
i += 1
else:
i += 1
def remove_noncomments(src):
src = '\n' + src
dst = ''.join(comment_contents_generator(src))
dump(dst, 'extracted from comments')
return dst
#
# Stage 2
#
# A command is a single word of at least 3 characters, all uppercase, and alone on a line
def iscommand(l):
if re.match(r'^[A-Z_]{3,}\s*$', l):
return True
return False
def command_block_generator(content):
command = 'START'
text = ''
for l in content.splitlines():
if iscommand(l):
yield (command, text)
command = l.rstrip()
text = ''
else:
text = text + l + '\n'
yield (command, text)
# Look for commands, which give instructions how to process the following input
def process(content):
content = content.lstrip()
dump(content, 'about to process for commands')
# process into a list of tuples of commands and the associated following text
# it is important to maintain the order of the sections the commands generate
processed = list(command_block_generator(content))
return processed
#
# Stage 3
#
# invoke each command on it's text
def perform(processed):
for i in processed:
c = i[0].rstrip()
t = i[1].strip() + '\n'
if verbose:
print("performing command '%s'" % c, file=sys.stderr)
if c in command_dispatch_dict:
command_dispatch_dict[c](c, t)
else:
print("command '%s' is not recognized" % c, file=sys.stderr)
# the text following an unrecognized command is discarded
# FUNCTION (aka TYPEDEF)
#
def function(c, l):
global refentry
global rootelement
l = l.strip()
if verbose:
print('FUNCTION %s' % l, file=sys.stderr)
separator = '---'
if ';' in l:
# fpclassify has an unusual format we also need to handle
spliton = ';'
l = l.splitlines()[0]
elif len(l.splitlines()) > 1:
# a few pages like mktemp have two '---' lines
spliton = ';'
o = ''
for i in l.splitlines():
if separator in i:
o += i + ';'
else:
o += i
l = o[:-1]
else:
spliton = '\n'
namelist = []
descrlist = []
for a in l.split(spliton):
(n, d) = a.split(separator, 1)
namelist = namelist + n.split(',')
descrlist = descrlist + [d]
# only copysign and log1p use <[ ]> markup in descr,
# only gets() uses << >> markup
# but we should handle it correctly
descr = line_markup_convert(', '.join(descrlist))
# fpclassify includes an 'and' we need to discard
namelist = map(lambda v: re.sub(r'^and ', r'', v.strip(), 1), namelist)
# strip off << >> surrounding name
namelist = map(lambda v: v.strip().lstrip('<').rstrip('>'), namelist)
# instantiate list to make it subscriptable
namelist = list(namelist)
if verbose:
print(namelist, file=sys.stderr)
# additional alternate names may also appear in INDEX commands
# create the root element if needed
if rootelement is None:
rootelement = lxml.etree.Element('refentrycontainer')
# FUNCTION implies starting a new refentry
if refentry is not None:
sys.exit("multiple FUNCTIONs without NEWPAGE")
# create the refentry
refentry = lxml.etree.SubElement(rootelement, 'refentry')
refentry.append(lxml.etree.Comment(' Generated by makedocbook.py '))
refentry.set('id', namelist[0].lstrip('_'))
refmeta = lxml.etree.SubElement(refentry, 'refmeta')
# refentrytitle will be same as refdescriptor, the primary name
refentrytitle = lxml.etree.SubElement(refmeta, 'refentrytitle')
refentrytitle.text = namelist[0]
manvolnum = lxml.etree.SubElement(refmeta, 'manvolnum')
manvolnum.text = '3'
refnamediv = lxml.etree.SubElement(refentry, 'refnamediv')
# refdescriptor is the primary name, assume we should use the one which
# appears first in the list
refdescriptor = lxml.etree.SubElement(refnamediv, 'refdescriptor')
refdescriptor.text = namelist[0]
# refname elements exist for all alternate names
for n in namelist:
refname = lxml.etree.SubElement(refnamediv, 'refname')
refname.text = n
refpurpose = lxml.etree.SubElement(refnamediv, 'refpurpose')
refnamediv.replace(refpurpose, lxml.etree.fromstring('<refpurpose>' + descr + '</refpurpose>'))
# Only FUNCTION currently exists, which implies that the SYNOPSIS should be
# a funcsynopsis. If TYPEDEF was to be added, SYNOPSIS should be processed
# in a different way, probably producing a refsynopsis.
# INDEX
# may occur more than once for each FUNCTION giving alternate names this
# function should be indexed under
#
def index(c, l):
l = l.strip()
if verbose:
print('INDEX %s' % l, file=sys.stderr)
# discard anything after the first word
l = l.split()[0]
# add indexterm
# (we could just index under all the refnames, but we control the indexing
# separately as that is what makedoc does)
indexterm = lxml.etree.SubElement(refentry, 'indexterm')
primary = lxml.etree.SubElement(indexterm, 'primary')
primary.text = l
# to validate, it seems we need to maintain refentry elements in a certain order
refentry[:] = sorted(refentry, key=lambda x: x.tag if isinstance(x.tag, str) else '')
# adds another alternate refname
refnamediv = refentry.find('refnamediv')
# as long as it doesn't already exist
if not refnamediv.xpath(('refname[.="%s"]') % l):
refname = lxml.etree.SubElement(refnamediv, 'refname')
refname.text = l
if verbose > 1:
print('added refname %s' % l, file=sys.stderr)
else:
if verbose > 1:
print('duplicate refname %s discarded' % l, file=sys.stderr)
# to validate, it seems we need to maintain refnamediv elements in a certain order
refnamediv[:] = sorted(refnamediv, key=lambda x: x.tag)
# SYNOPSIS aka ANSI_SYNOPSIS
# ANSI-style synopsis
#
# Note that makedoc would also process <<code>> markup here, but there are no
# such uses.
#
def synopsis(c, t):
refsynopsisdiv = lxml.etree.SubElement(refentry, 'refsynopsisdiv')
funcsynopsis = lxml.etree.SubElement(refsynopsisdiv, 'funcsynopsis')
s = ''
for l in t.splitlines():
if re.match(r'\s*(#|\[|struct)', l):
# preprocessor # directives, structs, comments in square brackets
funcsynopsisinfo = lxml.etree.SubElement(funcsynopsis, 'funcsynopsisinfo')
funcsynopsisinfo.text = l.strip() + '\n'
elif re.match(r'[Ll]ink with', l):
pass
else:
s = s + l
# a prototype without a terminating ';' is an error
if s.endswith(')'):
sys.exit("'%s' missing terminating semicolon" % l)
s = s + ';'
if ';' in s:
synopsis_for_prototype(funcsynopsis, s)
s = ''
if s.strip():
sys.exit("surplus synopsis '%s'" % s)
def synopsis_for_prototype(funcsynopsis, s):
s = s.strip()
# funcsynopsis has a very detailed content model, so we need to massage the
# bare prototype into it. Fortunately, since the parameter names are marked
# up, we have enough information to do this.
for fp in s.split(';'):
fp = fp.strip()
if fp:
if verbose:
print("'%s'" % fp, file=sys.stderr)
match = re.match(r'(.*?)([\w\d]*) ?\((.*)\)', fp)
if verbose:
print(match.groups(), file=sys.stderr)
funcprototype = lxml.etree.SubElement(funcsynopsis, 'funcprototype')
funcdef = lxml.etree.SubElement(funcprototype, 'funcdef')
funcdef.text = match.group(1)
function = lxml.etree.SubElement(funcdef, 'function')
function.text = match.group(2)
if match.group(3).strip() == 'void':
void = lxml.etree.SubElement(funcprototype, 'void')
else:
# Split parameters on ',' except if it is inside ()
for p in re.split(r',(?![^()]*\))', match.group(3)):
p = p.strip()
if verbose:
print(p, file=sys.stderr)
if p == '...':
varargs = lxml.etree.SubElement(funcprototype, 'varargs')
else:
paramdef = lxml.etree.SubElement(funcprototype, 'paramdef')
parameter = lxml.etree.SubElement(paramdef, 'parameter')
# <[ ]> enclose the parameter name
match2 = re.match(r'(.*)<\[(.*)\]>(.*)', p)
if verbose:
print(match2.groups(), file=sys.stderr)
paramdef.text = match2.group(1)
parameter.text = match2.group(2)
parameter.tail = match2.group(3)
# DESCRIPTION
# (RETURNS, ERRORS, PORTABILITY, BUGS, WARNINGS, SEEALSO, NOTES are handled the same)
#
# Create a refsect with a title corresponding to the command
#
# Nearly all the the existing DESCRIPTION contents could be transformed into
# DocBook with a few regex substitutions. Unfortunately, pages like sprintf and
# sscanf, have very complex layout using nested tables and itemized lists, which
# it is best to parse in order to transform correctly.
#
def refsect(t, s):
refsect = lxml.etree.SubElement(refentry, 'refsect1')
title = lxml.etree.SubElement(refsect, 'title')
title.text = t.title()
if verbose:
print('%s has %d paragraphs' % (t, len(s.split('\n\n'))), file=sys.stderr)
if verbose > 1:
dump(s, 'before lexing')
# dump out lexer token sequence
lex.input(s)
for tok in lexer:
print(tok, file=sys.stderr)
# parse the section text for makedoc markup and the few pieces of texinfo
# markup we understand, and output an XML marked-up string
xml = parser.parse(s, tracking=True, debug=(verbose > 2))
dump(xml, 'after parsing')
xml = '<refsect1>' + xml + '</refsect1>'
refsect.extend(lxml.etree.fromstring(xml))
def seealso(c, t):
refsect('SEE ALSO', t)
# NEWPAGE
#
# start a new refentry
def newpage(c, t):
global refentry
refentry = None
# command dispatch table
def discarded(c, t):
return
command_dispatch_dict = {
'FUNCTION': function,
'TYPEDEF': function, # TYPEDEF is not currently used, but described in doc.str
'INDEX': index,
'TRAD_SYNOPSIS': discarded, # K&R-style synopsis, obsolete and discarded
'ANSI_SYNOPSIS': synopsis,
'SYNOPSIS': synopsis,
'DESCRIPTION': refsect,
'RETURNS': refsect,
'ERRORS': refsect,
'PORTABILITY': refsect,
'BUGS': refsect,
'WARNINGS': refsect,
'SEEALSO': seealso,
'NOTES': refsect, # NOTES is not described in doc.str, so is currently discarded by makedoc, but that doesn't seem right
'QUICKREF': discarded, # The intent of QUICKREF and MATHREF is not obvious, but they don't generate any output currently
'MATHREF': discarded,
'START': discarded, # a START command is inserted to contain the text before the first command
'END': discarded, # an END command is inserted merely to terminate the text for the last command in a comment block
'NEWPAGE': newpage,
}
#
# Utility functions
#
# apply transformations which are easy to do in-place
def line_markup_convert(p):
s = p
# escape characters not allowed in XML
s = s.replace('&', '&amp;')
s = s.replace('<', '&lt;')
s = s.replace('>', '&gt;')
# convert <<somecode>> to <code>somecode</code> and <[var]> to
# <varname>var</varname>
# also handle nested << <[ ]> >> correctly
s = s.replace('&lt;&lt;', '<code>')
s = s.replace('&lt;[', '<varname>')
s = s.replace(']&gt;', '</varname>')
s = s.replace('&gt;&gt;', '</code>')
# also convert some simple texinfo markup
# convert @emph{foo} to <emphasis>foo</emphasis>
s = re.sub(r'@emph{(.*?)}', r'<emphasis>\1</emphasis>', s)
# convert @strong{foo} to <emphasis role=strong>foo</emphasis>
s = re.sub(r'@strong{(.*?)}', r'<emphasis role="strong">\1</emphasis>', s)
# convert @minus{} to U+2212 MINUS SIGN
s = s.replace('@minus{}', '&#x2212;')
# convert @dots{} to U+2026 HORIZONTAL ELLIPSIS
s = s.replace('@dots{}', '&#x2026;')
# convert xref and pxref
s = re.sub(r'@xref{(.*?)}', r"See <xref linkend='\1'/>", s)
# very hacky way of dealing with @* to force a newline
s = s.replace('@*', '</para><para>')
# fail if there are unhandled texinfo commands
match = re.search(r'(?<!@)@[^@\s]+', s)
if match:
sys.exit("texinfo command '%s' remains in output" % match.group(0))
# process the texinfo escape for an @
s = s.replace('@@', '@')
if (verbose > 3) and (s != p):
print('%s-> line_markup_convert ->\n%s' % (p, s), file=sys.stderr)
return s
#
# lexer
#
texinfo_commands = {
'ifnottex': 'IFNOTTEX',
'end ifnottex': 'ENDIFNOTTEX',
'tex': 'IFTEX',
'end tex': 'ENDIFTEX',
'comment': 'COMMENT',
'c ': 'COMMENT',
'multitable': 'MULTICOLUMNTABLE',
'end multitable': 'ENDMULTICOLUMNTABLE',
'headitem': 'MCT_HEADITEM',
'tab': 'MCT_COLUMN_SEPARATOR',
'item': 'MCT_ITEM',
}
# token names
tokens = [
'BLANKLINE',
'BULLETEND',
'BULLETSTART',
'COURIER',
'EOF',
'ITEM',
'TABLEEND',
'TABLESTART',
'TEXINFO',
'TEXT',
] + list(set(texinfo_commands.values()))
# regular expression rules for tokens, in priority order
# (all these expressions should match a whole line)
def t_TEXINFO(t):
# this matches any @command. but not @command{} which just happens to be at
# the start of a line
r'@\w+[^{]*?\n'
# if the line starts with a known texinfo command, change t.type to the
# token for that command
for k in texinfo_commands.keys():
if t.value[1:].startswith(k):
t.type = texinfo_commands[k]
break
return t
def t_COURIER(t):
r'[.|].*\n'
t.value = line_markup_convert(t.value[1:])
return t
def t_BULLETSTART(t):
r'O\+\n'
return t
def t_BULLETEND(t):
r'O-\n'
return t
def t_TABLESTART(t):
r'o\+\n'
return t
def t_TABLEEND(t):
r'o-\n'
return t
def t_ITEM(t):
r'o\s.*\n'
t.value = re.sub(r'o\s', r'', lexer.lexmatch.group(0), 1)
t.value = line_markup_convert(t.value)
return t
def t_TEXT(t):
r'.+\n'
t.value = line_markup_convert(t.value)
t.lexer.lineno += 1
return t
def t_BLANKLINE(t):
r'\n'
t.lexer.lineno += 1
return t
def t_eof(t):
if hasattr(t.lexer, 'at_eof'):
# remove eof flag ready for lexing next input
delattr(t.lexer, 'at_eof')
t.lexer.lineno = 0
return None
t.type = 'EOF'
t.lexer.at_eof = True
return t
# Error handling rule
def t_error(t):
sys.exit("tokenization error, remaining text '%s'" % t.value)
lexer = lex.lex()
#
# parser
#
def parser_verbose(p):
if verbose > 2:
print(p[0], file=sys.stderr)
def p_input(p):
'''input : paragraph
| input paragraph'''
if len(p) == 3:
p[0] = p[1] + '\n' + p[2]
else:
p[0] = p[1]
parser_verbose(p)
# Strictly, text at top level should be paragraphs (i.e terminated by a
# BLANKLINE), while text contained in rows or bullets may not be, but this
# grammar doesn't enforce that for simplicity's sake.
def p_paragraph(p):
'''paragraph : paragraph_content maybe_eof_or_blankline'''
p[0] = '<para>\n' + p[1] + '</para>'
parser_verbose(p)
def p_paragraph_content(p):
'''paragraph_content : paragraph_line
| paragraph_line paragraph_content'''
if len(p) == 3:
p[0] = p[1] + p[2]
else:
p[0] = p[1]
parser_verbose(p)
def p_paragraph_line(p):
'''paragraph_line : TEXT
| texinfocmd
| courierblock
| table
| bulletlist'''
p[0] = p[1]
def p_empty(p):
'empty :'
p[0] = ''
def p_maybe_eof_or_blankline(p):
'''maybe_eof_or_blankline : empty
| EOF
| BLANKLINE
| BLANKLINE EOF'''
p[0] = ''
def p_maybe_lines(p):
'''maybe_lines : empty
| paragraph maybe_lines'''
if len(p) == 3:
p[0] = p[1] + p[2]
else:
p[0] = p[1]
parser_verbose(p)
def p_maybe_blankline(p):
'''maybe_blankline : empty
| BLANKLINE'''
p[0] = ''
def p_courierblock(p):
'''courierblock : courier'''
p[0] = '<literallayout class="monospaced">' + p[1] + '</literallayout>'
parser_verbose(p)
def p_courier(p):
'''courier : COURIER
| COURIER courier'''
if len(p) == 3:
p[0] = p[1] + p[2]
else:
p[0] = p[1]
parser_verbose(p)
def p_bullet(p):
'''bullet : ITEM maybe_lines
| ITEM BLANKLINE maybe_lines'''
if len(p) == 3:
# Glue any text in ITEM into the first para of maybe_lines
# (This is an unfortunate consequence of the line-based tokenization we do)
if p[2].startswith('<para>'):
p[0] = '<listitem><para>' + p[1] + p[2][len('<para>'):] + '</listitem>'
else:
p[0] = '<listitem><para>' + p[1] + '</para>' + p[2] + '</listitem>'
else:
p[0] = '<listitem><para>' + p[1] + '</para>' + p[3] + '</listitem>'
parser_verbose(p)
def p_bullets(p):
'''bullets : bullet
| bullet bullets'''
if len(p) == 3:
p[0] = p[1] + '\n' + p[2]
else:
p[0] = p[1]
parser_verbose(p)
def p_bulletlist(p):
'''bulletlist : BULLETSTART bullets BULLETEND maybe_blankline'''
p[0] = '<itemizedlist>' + p[2] + '</itemizedlist>'
parser_verbose(p)
def p_row(p):
'''row : ITEM maybe_lines
| ITEM BLANKLINE maybe_lines'''
if len(p) == 3:
p[0] = '<row><entry><code>' + p[1] + '</code></entry><entry>' + p[2] + '</entry></row>'
else:
p[0] = '<row><entry><code>' + p[1] + '</code></entry><entry>' + p[3] + '</entry></row>'
parser_verbose(p)
def p_rows(p):
'''rows : row
| row rows'''
if len(p) == 3:
p[0] = p[1] + '\n' + p[2]
else:
p[0] = p[1]
parser_verbose(p)
def p_table(p):
'''table : TABLESTART rows TABLEEND maybe_blankline'''
p[0] = '<informaltable><tgroup cols="2"><tbody>' + p[2] + '</tbody></tgroup></informaltable>'
parser_verbose(p)
def p_texinfocmd(p):
'''texinfocmd : unknown_texinfocmd
| comment
| multitable
| nottex
| tex'''
p[0] = p[1]
def p_unknown_texinfocmd(p):
'''unknown_texinfocmd : TEXINFO'''
print("unknown texinfo command '%s'" % p[1].strip(), file=sys.stderr)
p[0] = p[1]
parser_verbose(p)
def p_nottex(p):
'''nottex : IFNOTTEX paragraph_content ENDIFNOTTEX'''
p[0] = p[2]
def p_tex(p):
'''tex : IFTEX paragraph_content ENDIFTEX'''
# text for TeX formatter inside @iftex is discarded
p[0] = ''
def p_comment(p):
'''comment : COMMENT'''
# comment text is discarded
p[0] = ''
def p_mct_columns(p):
'''mct_columns : maybe_lines
| maybe_lines MCT_COLUMN_SEPARATOR mct_columns'''
if len(p) == 4:
p[0] = '<entry>' + p[1] + '</entry>' + p[3]
else:
p[0] = '<entry>' + p[1] + '</entry>'
parser_verbose(p)
def p_mct_row(p):
'''mct_row : MCT_ITEM mct_columns'''
p[0] = '<row>' + p[2] + '</row>'
parser_verbose(p)
def p_mct_rows(p):
'''mct_rows : mct_row
| mct_row mct_rows'''
if len(p) == 3:
p[0] = p[1] + '\n' + p[2]
else:
p[0] = p[1]
parser_verbose(p)
def p_mct_header(p):
'''mct_header : MCT_HEADITEM mct_columns'''
p[0] = '<row>' + p[2] + '</row>'
parser_verbose(p)
def p_multitable(p):
'''multitable : MULTICOLUMNTABLE mct_header mct_rows ENDMULTICOLUMNTABLE'''
# this doesn't handle the prototype row form of @multitable, only the @columnfractions form
colfrac = p[1].replace('@multitable @columnfractions', '').split()
colspec = '\n'.join(['<colspec colwidth="%s*"/>' % (c) for c in colfrac])
header = '<thead>' + p[2] + '</thead>\n'
body = '<tbody>' + p[3] + '</tbody>\n'
p[0] = '<informaltable><tgroup cols="' + str(len(colfrac)) + '">' + colspec + header + body + '</tgroup></informaltable>'
parser_verbose(p)
def p_error(t):
sys.exit('parse error at line %d, token %s, next token %s' % (t.lineno, t, parser.token()))
# protect creating the parser with a lockfile, so that when multiple processes
# are running this script simultaneously, we don't get one of them generating a
# parsetab.py file, while another one attempts to read it...
#
# see also https://github.com/dabeaz/ply/pull/184
with open(os.path.join(os.path.dirname(__file__), 'parsetab.lock'), 'w+') as lockfile:
fcntl.flock(lockfile.fileno(), fcntl.LOCK_EX)
parser = yacc.yacc(start='input')
fcntl.flock(lockfile.fileno(), fcntl.LOCK_UN)
#
#
#
def main(file):
content = file.read()
content = remove_noncomments(content)
processed = process(content)
perform(processed)
# output the XML tree
s = lxml.etree.tostring(rootelement, pretty_print=True, encoding='unicode')
if not s:
print('No output produced (perhaps the input has no makedoc markup?)', file=sys.stderr)
exit(1)
print(s)
#
#
#
if __name__ == '__main__':
options = OptionParser()
options.add_option('-v', '--verbose', action='count', dest='verbose', default=0)
(opts, args) = options.parse_args()
verbose = opts.verbose
if len(args) > 0:
main(open(args[0], 'rb'))
else:
main(sys.stdin)

305
libraries/newlib/iconv.m4 Normal file
View File

@@ -0,0 +1,305 @@
/*
* This file was automatically generated mkdeps.pl script. Don't edit.
*/
AC_DEFUN([NEWLIB_ICONV_DEFINES],[dnl
if test "$_ICONV_TO_ENCODING_BIG5" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_BIG5, 1, [Support big5 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_BIG5" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_BIG5, 1, [Support big5 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_CP775" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_CP775, 1, [Support cp775 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_CP775" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_CP775, 1, [Support cp775 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_CP850" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_CP850, 1, [Support cp850 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_CP850" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_CP850, 1, [Support cp850 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_CP852" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_CP852, 1, [Support cp852 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_CP852" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_CP852, 1, [Support cp852 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_CP855" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_CP855, 1, [Support cp855 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_CP855" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_CP855, 1, [Support cp855 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_CP866" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_CP866, 1, [Support cp866 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_CP866" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_CP866, 1, [Support cp866 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_EUC_JP" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_EUC_JP, 1, [Support euc_jp output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_EUC_JP" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_EUC_JP, 1, [Support euc_jp input encoding.])
fi
if test "$_ICONV_TO_ENCODING_EUC_KR" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_EUC_KR, 1, [Support euc_kr output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_EUC_KR" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_EUC_KR, 1, [Support euc_kr input encoding.])
fi
if test "$_ICONV_TO_ENCODING_EUC_TW" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_EUC_TW, 1, [Support euc_tw output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_EUC_TW" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_EUC_TW, 1, [Support euc_tw input encoding.])
fi
if test "$_ICONV_TO_ENCODING_ISO_8859_1" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_1, 1, [Support iso_8859_1 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_ISO_8859_1" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_1, 1, [Support iso_8859_1 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_ISO_8859_10" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_10, 1, [Support iso_8859_10 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_ISO_8859_10" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_10, 1, [Support iso_8859_10 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_ISO_8859_11" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_11, 1, [Support iso_8859_11 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_ISO_8859_11" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_11, 1, [Support iso_8859_11 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_ISO_8859_13" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_13, 1, [Support iso_8859_13 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_ISO_8859_13" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_13, 1, [Support iso_8859_13 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_ISO_8859_14" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_14, 1, [Support iso_8859_14 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_ISO_8859_14" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_14, 1, [Support iso_8859_14 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_ISO_8859_15" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_15, 1, [Support iso_8859_15 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_ISO_8859_15" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_15, 1, [Support iso_8859_15 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_ISO_8859_2" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_2, 1, [Support iso_8859_2 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_ISO_8859_2" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_2, 1, [Support iso_8859_2 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_ISO_8859_3" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_3, 1, [Support iso_8859_3 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_ISO_8859_3" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_3, 1, [Support iso_8859_3 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_ISO_8859_4" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_4, 1, [Support iso_8859_4 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_ISO_8859_4" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_4, 1, [Support iso_8859_4 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_ISO_8859_5" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_5, 1, [Support iso_8859_5 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_ISO_8859_5" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_5, 1, [Support iso_8859_5 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_ISO_8859_6" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_6, 1, [Support iso_8859_6 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_ISO_8859_6" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_6, 1, [Support iso_8859_6 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_ISO_8859_7" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_7, 1, [Support iso_8859_7 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_ISO_8859_7" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_7, 1, [Support iso_8859_7 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_ISO_8859_8" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_8, 1, [Support iso_8859_8 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_ISO_8859_8" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_8, 1, [Support iso_8859_8 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_ISO_8859_9" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_9, 1, [Support iso_8859_9 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_ISO_8859_9" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_9, 1, [Support iso_8859_9 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_ISO_IR_111" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_ISO_IR_111, 1, [Support iso_ir_111 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_ISO_IR_111" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_ISO_IR_111, 1, [Support iso_ir_111 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_KOI8_R" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_KOI8_R, 1, [Support koi8_r output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_KOI8_R" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_KOI8_R, 1, [Support koi8_r input encoding.])
fi
if test "$_ICONV_TO_ENCODING_KOI8_RU" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_KOI8_RU, 1, [Support koi8_ru output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_KOI8_RU" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_KOI8_RU, 1, [Support koi8_ru input encoding.])
fi
if test "$_ICONV_TO_ENCODING_KOI8_U" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_KOI8_U, 1, [Support koi8_u output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_KOI8_U" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_KOI8_U, 1, [Support koi8_u input encoding.])
fi
if test "$_ICONV_TO_ENCODING_KOI8_UNI" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_KOI8_UNI, 1, [Support koi8_uni output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_KOI8_UNI" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_KOI8_UNI, 1, [Support koi8_uni input encoding.])
fi
if test "$_ICONV_TO_ENCODING_UCS_2" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_UCS_2, 1, [Support ucs_2 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_UCS_2" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_UCS_2, 1, [Support ucs_2 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_UCS_2_INTERNAL" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_UCS_2_INTERNAL, 1, [Support ucs_2_internal output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_UCS_2_INTERNAL" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_UCS_2_INTERNAL, 1, [Support ucs_2_internal input encoding.])
fi
if test "$_ICONV_TO_ENCODING_UCS_2BE" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_UCS_2BE, 1, [Support ucs_2be output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_UCS_2BE" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_UCS_2BE, 1, [Support ucs_2be input encoding.])
fi
if test "$_ICONV_TO_ENCODING_UCS_2LE" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_UCS_2LE, 1, [Support ucs_2le output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_UCS_2LE" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_UCS_2LE, 1, [Support ucs_2le input encoding.])
fi
if test "$_ICONV_TO_ENCODING_UCS_4" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_UCS_4, 1, [Support ucs_4 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_UCS_4" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_UCS_4, 1, [Support ucs_4 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_UCS_4_INTERNAL" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_UCS_4_INTERNAL, 1, [Support ucs_4_internal output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_UCS_4_INTERNAL" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_UCS_4_INTERNAL, 1, [Support ucs_4_internal input encoding.])
fi
if test "$_ICONV_TO_ENCODING_UCS_4BE" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_UCS_4BE, 1, [Support ucs_4be output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_UCS_4BE" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_UCS_4BE, 1, [Support ucs_4be input encoding.])
fi
if test "$_ICONV_TO_ENCODING_UCS_4LE" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_UCS_4LE, 1, [Support ucs_4le output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_UCS_4LE" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_UCS_4LE, 1, [Support ucs_4le input encoding.])
fi
if test "$_ICONV_TO_ENCODING_US_ASCII" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_US_ASCII, 1, [Support us_ascii output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_US_ASCII" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_US_ASCII, 1, [Support us_ascii input encoding.])
fi
if test "$_ICONV_TO_ENCODING_UTF_16" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_UTF_16, 1, [Support utf_16 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_UTF_16" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_UTF_16, 1, [Support utf_16 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_UTF_16BE" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_UTF_16BE, 1, [Support utf_16be output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_UTF_16BE" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_UTF_16BE, 1, [Support utf_16be input encoding.])
fi
if test "$_ICONV_TO_ENCODING_UTF_16LE" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_UTF_16LE, 1, [Support utf_16le output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_UTF_16LE" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_UTF_16LE, 1, [Support utf_16le input encoding.])
fi
if test "$_ICONV_TO_ENCODING_UTF_8" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_UTF_8, 1, [Support utf_8 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_UTF_8" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_UTF_8, 1, [Support utf_8 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_WIN_1250" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_WIN_1250, 1, [Support win_1250 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_WIN_1250" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1250, 1, [Support win_1250 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_WIN_1251" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_WIN_1251, 1, [Support win_1251 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_WIN_1251" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1251, 1, [Support win_1251 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_WIN_1252" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_WIN_1252, 1, [Support win_1252 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_WIN_1252" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1252, 1, [Support win_1252 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_WIN_1253" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_WIN_1253, 1, [Support win_1253 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_WIN_1253" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1253, 1, [Support win_1253 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_WIN_1254" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_WIN_1254, 1, [Support win_1254 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_WIN_1254" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1254, 1, [Support win_1254 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_WIN_1255" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_WIN_1255, 1, [Support win_1255 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_WIN_1255" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1255, 1, [Support win_1255 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_WIN_1256" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_WIN_1256, 1, [Support win_1256 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_WIN_1256" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1256, 1, [Support win_1256 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_WIN_1257" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_WIN_1257, 1, [Support win_1257 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_WIN_1257" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1257, 1, [Support win_1257 input encoding.])
fi
if test "$_ICONV_TO_ENCODING_WIN_1258" = 1; then
AC_DEFINE(_ICONV_TO_ENCODING_WIN_1258, 1, [Support win_1258 output encoding.])
fi
if test "$_ICONV_FROM_ENCODING_WIN_1258" = 1; then
AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1258, 1, [Support win_1258 input encoding.])
fi
])

View File

@@ -0,0 +1,71 @@
info_TEXINFOS += %D%/libc.texi
%C%_libc_TEXINFOS = %D%/targetdep.tex $(LIBC_CHEWOUT_FILES)
LIBC_CHEWOUT_FILES =
LIBC_CHAPTERS = %D%/sys.tex
LIBC_DOCBOOK_OUT_FILES = $(LIBC_CHEWOUT_FILES:.def=.xml)
$(LIBC_CHEWOUT_FILES): $(MKDOC)
%D%/libc.dvi: %D%/targetdep.tex $(LIBC_CHEWOUT_FILES)
%D%/targetdep.tex.stamp: $(LIBC_CHAPTERS)
$(AM_V_GEN)cat $^ > $@.tmp
$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $(@:.stamp=)
$(AM_V_at)touch $@
%D%/targetdep.tex: %D%/targetdep.tex.stamp; @true
%D%/libc.xml: %D%/libc.in.xml $(LIBC_CHAPTERS) $(LIBC_DOCBOOK_OUT_FILES)
$(AM_V_at)\
for chapter in $(LIBC_CHAPTERS); do \
$(TEXI2DOCBOOK) < $(srcdir)/$$chapter > %D%/`basename $${chapter%.tex}`.xml || exit 1; \
done
$(AM_V_GEN)xsltproc --xinclude --path $(builddir)/%D% --nonet $(srcdir)/refcontainers.xslt $< > $@.tmp
$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $@
%C%_man.stamp: %D%/libc.xml
$(AM_V_GEN)xmlto --skip-validation -o %D% --searchpath $(builddir)/%D% man -m $(srcdir)/man.xsl $(XMLTO_MAN_QUIET) %D%/libc.xml
$(AM_V_at)touch $@
man: %C%_man.stamp
%C%_install-man: %C%_man.stamp
$(MKDIR_P) $(DESTDIR)$(mandir)/man3
$(INSTALL_DATA) %D%/*.3 $(DESTDIR)$(mandir)/man3/
install-man: %C%_install-man
## The order of includes is important for two reasons:
## * The integrated documentation (chapter ordering).
## * Object overridding -- machine dir must come last.
## Do not change the order without considering the doc impact.
##
## Also keep in mind that every subdir must always be included here. Any
## conditional loigc must live in the respective Makefile.inc files.
include %D%/argz/Makefile.inc
include %D%/stdlib/Makefile.inc
include %D%/ctype/Makefile.inc
include %D%/search/Makefile.inc
include %D%/stdio/Makefile.inc
include %D%/stdio64/Makefile.inc
include %D%/string/Makefile.inc
include %D%/signal/Makefile.inc
include %D%/time/Makefile.inc
include %D%/locale/Makefile.inc
include %D%/reent/Makefile.inc
include %D%/errno/Makefile.inc
include %D%/misc/Makefile.inc
include %D%/unix/Makefile.inc
include %D%/posix/Makefile.inc
include %D%/syscalls/Makefile.inc
include %D%/iconv/Makefile.inc
include %D%/xdr/Makefile.inc
include %D%/ssp/Makefile.inc
include %D%/sys/Makefile.inc
## NB: Machine must be last! See comment block above.
include %D%/machine/Makefile.inc
CLEANFILES += \
%D%/targetdep.tex \
%D%/targetdep.tex.stamp \
$(LIBC_CHEWOUT_FILES) \
$(LIBC_DOCBOOK_OUT_FILES) \
%D%/*.xml %C%_man.stamp %D%/*.3

View File

@@ -0,0 +1,31 @@
#############################################################################
# Generate Unicode data tables for string/wcwidth and ctype/??w*
unicode-update: unidata cleanup
#############################################################################
# Clean up downloaded files
cleanup:
rm ctype/UnicodeData.txt
rm string/Blocks.txt
rm string/EastAsianWidth.txt
rm string/UnicodeData.txt
rm string/uniset.tar.gz
#############################################################################
# Download Unicode data files
unidata:
cd string; ./mkunidata -u
cd ctype; ./mkunidata -u
#############################################################################
# Use installed Unicode data files from package unicode-ucd
unidata-local:
cd string; ./mkunidata -i
cd ctype; ./mkunidata -i
#############################################################################
# end

View File

@@ -0,0 +1,70 @@
dnl For each directory which we may or may not want, we define a name
dnl for the library and an automake conditional for whether we should
dnl build the library.
AM_CONDITIONAL(HAVE_SIGNAL_DIR, test x${signal_dir} != x)
AM_CONDITIONAL(HAVE_STDIO_DIR, test x${stdio_dir} != x)
AM_CONDITIONAL(HAVE_STDIO64_DIR, test x${stdio64_dir} != x)
AM_CONDITIONAL(HAVE_POSIX_DIR, test x${posix_dir} != x)
AM_CONDITIONAL(HAVE_XDR_DIR, test x${xdr_dir} != x)
AM_CONDITIONAL(HAVE_SYSCALL_DIR, test x${syscall_dir} != x)
AM_CONDITIONAL(HAVE_UNIX_DIR, test x${unix_dir} != x)
dnl We always recur into sys and machine, and let them decide what to do.
m4_foreach_w([SYS_DIR], [
a29khif amdgcn arm
d10v
epiphany
h8300hms h8500hms
m88kbug mmixware
netware
or1k
rdos rtems
sh sysmec sysnec810 sysnecv850 sysvi386 sysvnecv70
tic80 tirtos
w65
xtensa
z8ksim
], [AM_CONDITIONAL([HAVE_LIBC_SYS_]m4_toupper(SYS_DIR)[_DIR], test "${sys_dir}" = SYS_DIR)])
AC_TYPE_LONG_DOUBLE
AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$ac_cv_type_long_double" = x"yes")
dnl iconv library will be compiled if --enable-newlib-iconv option is enabled
AM_CONDITIONAL(ENABLE_NEWLIB_ICONV, test x${newlib_iconv} != x)
dnl We have to include these unconditionally since machines might want to use
dnl AM_CONDITIONAL in their subdirs.
m4_include([libc/machine/nds32/acinclude.m4])
m4_include([libc/machine/powerpc/acinclude.m4])
m4_include([libc/machine/sh/acinclude.m4])
m4_include([libc/machine/spu/acinclude.m4])
m4_include([libc/machine/xtensa/acinclude.m4])
m4_foreach_w([MACHINE], [
aarch64 amdgcn arc arm
bfin
cr16 cris crx csky
d10v d30v
epiphany
fr30 frv ft32
h8300 h8500 hppa
i386 i960 iq2000
lm32
m32c m32r m68hc11 m68k m88k mep microblaze mips mn10200 mn10300 moxie msp430 mt
nds32 necv70 nios2 nvptx
or1k
powerpc pru
riscv rl78 rx
sh sparc spu
tic4x tic6x tic80
v850 visium
w65
x86_64 xc16x xstormy16 xtensa
z8k
], [AM_CONDITIONAL([HAVE_LIBC_MACHINE_]m4_toupper(MACHINE), test "${machine_dir}" = MACHINE)])
AM_CONDITIONAL(HAVE_FPMATH_H, test -r "${srcdir}/libc/machine/${machine_dir}/machine/_fpmath.h")
AM_CONDITIONAL(MACH_ADD_SETJMP, test "x$mach_add_setjmp" = "xtrue")

View File

@@ -0,0 +1,23 @@
## All functions in this directory are EL/IX level 2 and above
if !ELIX_LEVEL_1
libc_a_SOURCES += \
%D%/argz_add.c \
%D%/argz_add_sep.c \
%D%/argz_append.c \
%D%/argz_count.c \
%D%/argz_create.c \
%D%/argz_create_sep.c \
%D%/argz_delete.c \
%D%/argz_extract.c \
%D%/argz_insert.c \
%D%/argz_next.c \
%D%/argz_replace.c \
%D%/argz_stringify.c \
%D%/buf_findstr.c \
%D%/envz_entry.c \
%D%/envz_get.c \
%D%/envz_add.c \
%D%/envz_remove.c \
%D%/envz_merge.c \
%D%/envz_strip.c
endif

View File

@@ -0,0 +1,32 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <argz.h>
#include <errno.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
error_t
argz_add (char **argz,
size_t *argz_len,
const char *str)
{
int len_to_add = 0;
size_t last = *argz_len;
if (str == NULL)
return 0;
len_to_add = strlen(str) + 1;
*argz_len += len_to_add;
if(!(*argz = (char *)realloc(*argz, *argz_len)))
return ENOMEM;
memcpy(*argz + last, str, len_to_add);
return 0;
}

View File

@@ -0,0 +1,35 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <errno.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <argz.h>
error_t
argz_add_sep (char **argz,
size_t *argz_len,
const char *str,
int sep)
{
char *str_argz = 0;
size_t str_argz_len = 0;
size_t last = *argz_len;
argz_create_sep (str, sep, &str_argz, &str_argz_len);
if (str_argz_len)
{
*argz_len += str_argz_len;
if(!(*argz = (char *)realloc(*argz, *argz_len)))
return ENOMEM;
memcpy(*argz + last, str_argz, str_argz_len);
}
return 0;
}

View File

@@ -0,0 +1,31 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <argz.h>
#include <errno.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
error_t
argz_append (char **argz,
size_t *argz_len,
const char *buf,
size_t buf_len)
{
if (buf_len)
{
size_t last = *argz_len;
*argz_len += buf_len;
if(!(*argz = (char *)realloc(*argz, *argz_len)))
return ENOMEM;
memcpy(*argz + last, buf, buf_len);
}
return 0;
}

View File

@@ -0,0 +1,25 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <_ansi.h>
#include <argz.h>
#include <stddef.h>
#include <sys/types.h>
size_t
argz_count (const char *argz,
size_t argz_len)
{
int i;
size_t count = 0;
for (i = 0; i < argz_len; i++)
{
if (argz[i] == '\0')
count++;
}
return count;
}

View File

@@ -0,0 +1,49 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <argz.h>
#include <errno.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
error_t
argz_create (char *const argv[],
char **argz,
size_t *argz_len)
{
int argc = 0;
int i = 0;
int len = 0;
char *iter;
*argz_len = 0;
if (*argv == NULL)
{
*argz = NULL;
return 0;
}
while (argv[argc])
{
*argz_len += (strlen(argv[argc]) + 1);
argc++;
}
/* There are argc strings to copy into argz. */
if(!(*argz = (char *)malloc(*argz_len)))
return ENOMEM;
iter = *argz;
for(i = 0; i < argc; i++)
{
len = strlen(argv[i]) + 1;
memcpy(iter, argv[i], len);
iter += len;
}
return 0;
}

View File

@@ -0,0 +1,68 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <argz.h>
#include <errno.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
error_t
argz_create_sep (const char *string,
int sep,
char **argz,
size_t *argz_len)
{
int len = 0;
int i = 0;
int num_strings = 0;
char delim[2];
char *running = 0;
char *old_running = 0;
char *token = 0;
char *iter = 0;
*argz_len = 0;
if (!string || string[0] == '\0')
{
*argz= NULL;
return 0;
}
delim[0] = sep;
delim[1] = '\0';
running = strdup(string);
old_running = running;
while ((token = strsep(&running, delim)))
{
len = strlen(token);
*argz_len += (len + 1);
num_strings++;
}
if(!(*argz = (char *)malloc(*argz_len)))
return ENOMEM;
free(old_running);
running = strdup(string);
old_running = running;
iter = *argz;
for (i = 0; i < num_strings; i++)
{
token = strsep(&running, delim);
len = strlen(token) + 1;
memcpy(iter, token, len);
iter += len;
}
free(old_running);
return 0;
}

View File

@@ -0,0 +1,40 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <argz.h>
#include <errno.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
error_t
argz_delete (char **argz,
size_t *argz_len,
char *entry)
{
int len = 0;
char *moveto = entry;
if (entry)
{
len = strlen(entry) + 1;
entry += len;
memmove(moveto, entry, *argz + *argz_len - entry);
*argz_len -= len;
if(!(*argz = (char *)realloc(*argz, *argz_len)))
return ENOMEM;
if (*argz_len <= 0)
{
free(*argz);
*argz = NULL;
}
}
return 0;
}

View File

@@ -0,0 +1,31 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <stddef.h>
#include <argz.h>
#include <sys/types.h>
void
argz_extract (char *argz,
size_t argz_len,
char **argv)
{
size_t i = 0;
int j = 0;
const size_t count = argz_count(argz, argz_len);
if (argz_len > 1)
for (i = argz_len - 2; i > 0; i--)
{
if (argz[i] == '\0')
{
j++;
argv[count - j] = &argz[i + 1];
}
}
argv[0] = &argz[0];
argv[count] = NULL;
}

View File

@@ -0,0 +1,47 @@
/* Copyright (C) 2002, 2005 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <errno.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <argz.h>
#define __need_ptrdiff_t
#include <stddef.h>
error_t
argz_insert (char **argz,
size_t *argz_len,
char *before,
const char *entry)
{
int len = 0;
ptrdiff_t delta;
if (before == NULL)
return argz_add(argz, argz_len, entry);
if (before < *argz || before >= *argz + *argz_len)
return EINVAL;
while (before != *argz && before[-1])
before--;
/* delta will always be non-negative, and < *argz_len */
delta = before - *argz;
len = strlen(entry) + 1;
if(!(*argz = (char *)realloc(*argz, *argz_len + len)))
return ENOMEM;
memmove(*argz + delta + len, *argz + delta, *argz_len - delta);
memcpy(*argz + delta, entry, len);
*argz_len += len;
return 0;
}

View File

@@ -0,0 +1,36 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <argz.h>
#include <errno.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
char *
argz_next (char *argz,
size_t argz_len,
const char *entry)
{
if (entry)
{
while(*entry != '\0')
entry++;
entry++;
if (entry >= argz + argz_len)
return NULL;
else
return (char *) entry;
}
else
{
if (argz_len > 0)
return (char *) argz;
else
return NULL;
}
}

View File

@@ -0,0 +1,93 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <errno.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <argz.h>
#include "buf_findstr.h"
error_t
argz_replace (char **argz,
size_t *argz_len,
const char *str,
const char *with,
unsigned *replace_count)
{
const int str_len = strlen(str);
const int with_len = strlen(with);
const int len_diff = with_len - str_len;
char *buf_iter = *argz;
size_t buf_len = *argz_len;
char *last_iter = NULL;
char *new_argz = NULL;
size_t new_argz_len = 0;
char *new_argz_iter = NULL;
char *argz_realloc = NULL;
*replace_count = 0;
new_argz_len = *argz_len;
while(buf_len)
{
if(_buf_findstr(str, &buf_iter, &buf_len))
{
*replace_count += 1;
new_argz_len += len_diff;
}
}
if (*replace_count)
{
if (!(new_argz = (char *)malloc(new_argz_len)))
return ENOMEM;
buf_iter = *argz;
buf_len = *argz_len;
last_iter = buf_iter;
new_argz_iter = new_argz;
while(buf_len)
{
if (_buf_findstr(str, &buf_iter, &buf_len))
{
/* copy everything up to, but not including str, from old argz to
new argz. */
memcpy(new_argz_iter, last_iter, buf_iter - last_iter - str_len);
new_argz_iter += (buf_iter - last_iter - str_len);
/* copy replacement string. */
memcpy(new_argz_iter, with, with_len);
new_argz_iter += with_len;
last_iter = buf_iter;
}
}
/* copy everything after last occurrence of str. */
memcpy(new_argz_iter, last_iter, *argz + *argz_len - last_iter);
/* reallocate argz, and copy over the new value. */
if(!(argz_realloc = (char *)realloc(*argz, new_argz_len)))
{
free(new_argz);
return ENOMEM;
}
*argz = argz_realloc;
memcpy(*argz, new_argz, new_argz_len);
*argz_len = new_argz_len;
if (*argz_len == 0)
{
free(*argz);
*argz = NULL;
}
free(new_argz);
}
return 0;
}

View File

@@ -0,0 +1,26 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <_ansi.h>
#include <argz.h>
#include <stddef.h>
#include <sys/types.h>
void
argz_stringify (char *argz,
size_t argz_len,
int sep)
{
size_t i;
/* len includes trailing \0, which we don't want to replace. */
if (argz_len > 1)
for (i = 0; i < argz_len - 1; i++)
{
if (argz[i] == '\0')
argz[i] = sep;
}
}

View File

@@ -0,0 +1,44 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <errno.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include "buf_findstr.h"
/* Find string str in buffer buf of length buf_len. Point buf to character after string,
or set it to NULL if end of buffer is reached. Return 1 if found, 0 if not. */
int
_buf_findstr(const char *str, char **buf, size_t *buf_len)
{
int i = 0;
int j = 0;
for (i = 0; i < *buf_len; i++)
{
if (str[0] == (*buf)[i])
{
j = i;
while (str[j - i] && (str[j - i] == (*buf)[j])) j++;
if(str[j - i] == '\0')
{
*buf += j;
*buf_len -= j;
return 1;
}
}
}
if (i == *buf_len)
{
*buf += *buf_len;
*buf_len = 0;
}
return 0;
}

View File

@@ -0,0 +1,12 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <sys/types.h>
/* Find string str in buffer buf of length buf_len. Point buf to
character after string, or set it to NULL if end of buffer is
reached. Return 1 if found, 0 if not. */
int _buf_findstr(const char *str, char **buf, size_t *buf_len);

View File

@@ -0,0 +1,46 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <errno.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <argz.h>
#include <envz.h>
error_t
envz_add (char **envz,
size_t *envz_len,
const char *name,
const char *value)
{
char *concat = NULL;
int name_len = 0;
int val_len = 0;
int retval = 0;
envz_remove(envz, envz_len, name);
if (value)
{
name_len = strlen(name);
val_len = strlen(value);
if(!(concat = (char *) malloc(name_len + val_len + 2)))
return ENOMEM;
memcpy(concat, name, name_len);
concat[name_len] = '=';
memcpy(concat + name_len + 1, value, val_len + 1);
retval = argz_add(envz, envz_len, concat);
free(concat);
}
else
{
retval = argz_add(envz, envz_len, name);
}
return retval;
}

View File

@@ -0,0 +1,45 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <errno.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <envz.h>
#include "buf_findstr.h"
char *
envz_entry (const char *envz,
size_t envz_len,
const char *name)
{
char *buf_ptr = (char *)envz;
size_t buf_len = envz_len;
while(buf_len)
{
if (_buf_findstr(name, &buf_ptr, &buf_len))
{
if (buf_ptr)
{
if (*buf_ptr == '=' || *buf_ptr == '\0')
{
buf_ptr--;
/* Move buf_ptr back to start of entry. */
while(*buf_ptr != '\0' && buf_ptr != envz) buf_ptr--;
if(*buf_ptr == '\0')
buf_ptr++;
return (char *)buf_ptr;
}
}
}
}
return 0;
}

View File

@@ -0,0 +1,42 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <errno.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <envz.h>
#include "buf_findstr.h"
char *
envz_get (const char *envz,
size_t envz_len,
const char *name)
{
char *buf_ptr = (char *)envz;
size_t buf_len = envz_len;
while(buf_len)
{
if (_buf_findstr(name, &buf_ptr, &buf_len))
{
if (*buf_ptr == '=')
{
buf_ptr++;
return (char *)buf_ptr;
}
else
{
if (*buf_ptr == '\0')
/* NULL entry. */
return NULL;
}
}
}
/* No matching entries found. */
return NULL;
}

View File

@@ -0,0 +1,61 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <errno.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <argz.h>
#include <envz.h>
error_t
envz_merge (char **envz,
size_t *envz_len,
const char *envz2,
size_t envz2_len,
int override)
{
char *entry = NULL;
char *name_str = NULL;
char *val_str = NULL;
char *name_iter = NULL;
int retval = 0;
while((entry = argz_next((char *)envz2, envz2_len, entry)) && !retval)
{
if (!override)
{
name_str = strdup (entry);
name_iter = strchr(name_str, '=');
if(name_iter)
*name_iter = '\0';
if(!envz_entry(*envz, *envz_len, name_str))
{
retval = argz_add(envz, envz_len, entry);
}
free(name_str);
}
else
{
name_str = strdup (entry);
name_iter = strchr(name_str, '=');
if(name_iter)
{
*name_iter = '\0';
val_str = name_iter + 1;
}
else
{
val_str = NULL;
}
retval = envz_add(envz, envz_len, name_str, val_str);
free(name_str);
}
}
return retval;
}

View File

@@ -0,0 +1,36 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <errno.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <argz.h>
#include <envz.h>
void
envz_remove (char **envz,
size_t *envz_len,
const char *name)
{
char *entry = NULL;
int len = 0;
entry = envz_entry (*envz, *envz_len, name);
if (entry)
{
len = strlen(entry) + 1;
/* Not the last entry. */
if (*envz + *envz_len != entry + len - 1)
{
memmove(entry, entry + len, *envz + *envz_len - entry - len);
}
*envz = (char *)realloc(*envz, *envz_len - len);
*envz_len -= len;
}
}

View File

@@ -0,0 +1,41 @@
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
#include <errno.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <argz.h>
#include <envz.h>
void
envz_strip (char **envz,
size_t *envz_len)
{
char *entry = 0;
int len = 0;
int null_found = 0;
while((entry = argz_next(*envz, *envz_len, entry)))
{
if(!strchr(entry, '='))
{
null_found = 1;
len = strlen(entry) + 1;
/* Make sure this is not the last entry in envz. If it is, it
will be chopped off by the realloc anyway.*/
if(*envz + *envz_len != entry + len - 1)
{
memmove(entry, entry + len, *envz + *envz_len - entry - len);
}
*envz_len -= len;
}
}
if(null_found)
{
*envz = (char *)realloc(*envz, *envz_len);
}
}

View File

@@ -0,0 +1,112 @@
libc_a_SOURCES += \
%D%/ctype_.c \
%D%/isalnum.c \
%D%/isalpha.c \
%D%/iscntrl.c \
%D%/isdigit.c \
%D%/islower.c \
%D%/isupper.c \
%D%/isprint.c \
%D%/ispunct.c \
%D%/isspace.c \
%D%/isxdigit.c \
%D%/tolower.c \
%D%/toupper.c
## The following handles EL/IX level 2 functions
if !ELIX_LEVEL_1
libc_a_SOURCES += \
%D%/categories.c \
%D%/isalnum_l.c \
%D%/isalpha_l.c \
%D%/isascii.c \
%D%/isascii_l.c \
%D%/isblank.c \
%D%/isblank_l.c \
%D%/iscntrl_l.c \
%D%/isdigit_l.c \
%D%/islower_l.c \
%D%/isupper_l.c \
%D%/isprint_l.c \
%D%/ispunct_l.c \
%D%/isspace_l.c \
%D%/iswalnum.c \
%D%/iswalnum_l.c \
%D%/iswalpha.c \
%D%/iswalpha_l.c \
%D%/iswblank.c \
%D%/iswblank_l.c \
%D%/iswcntrl.c \
%D%/iswcntrl_l.c \
%D%/iswctype.c \
%D%/iswctype_l.c \
%D%/iswdigit.c \
%D%/iswdigit_l.c \
%D%/iswgraph.c \
%D%/iswgraph_l.c \
%D%/iswlower.c \
%D%/iswlower_l.c \
%D%/iswprint.c \
%D%/iswprint_l.c \
%D%/iswpunct.c \
%D%/iswpunct_l.c \
%D%/iswspace.c \
%D%/iswspace_l.c \
%D%/iswupper.c \
%D%/iswupper_l.c \
%D%/iswxdigit.c \
%D%/iswxdigit_l.c \
%D%/isxdigit_l.c \
%D%/jp2uc.c \
%D%/toascii.c \
%D%/toascii_l.c \
%D%/tolower_l.c \
%D%/toupper_l.c \
%D%/towctrans.c \
%D%/towctrans_l.c \
%D%/towlower.c \
%D%/towlower_l.c \
%D%/towupper.c \
%D%/towupper_l.c \
%D%/wctrans.c \
%D%/wctrans_l.c \
%D%/wctype.c \
%D%/wctype_l.c
endif
LIBC_CHEWOUT_FILES += \
%D%/isalnum.def \
%D%/isalpha.def \
%D%/isascii.def \
%D%/isblank.def \
%D%/iscntrl.def \
%D%/isdigit.def \
%D%/islower.def \
%D%/isprint.def \
%D%/ispunct.def \
%D%/isspace.def \
%D%/isupper.def \
%D%/iswalnum.def \
%D%/iswalpha.def \
%D%/iswblank.def \
%D%/iswcntrl.def \
%D%/iswctype.def \
%D%/iswdigit.def \
%D%/iswgraph.def \
%D%/iswlower.def \
%D%/iswprint.def \
%D%/iswpunct.def \
%D%/iswspace.def \
%D%/iswupper.def \
%D%/iswxdigit.def \
%D%/isxdigit.def \
%D%/toascii.def \
%D%/tolower.def \
%D%/toupper.def \
%D%/towctrans.def \
%D%/towlower.def \
%D%/towupper.def \
%D%/wctrans.def \
%D%/wctype.def
LIBC_CHAPTERS += %D%/ctype.tex

View File

@@ -0,0 +1,328 @@
{0x0041, 25, TOLO, 32},
{0x0061, 25, TOUP, -32},
{0x00B5, 0, TOUP, 743},
{0x00C0, 22, TOLO, 32},
{0x00D8, 6, TOLO, 32},
{0x00E0, 22, TOUP, -32},
{0x00F8, 6, TOUP, -32},
{0x00FF, 0, TOUP, 121},
{0x0100, 47, TO1, EVENCAP},
{0x0130, 0, TOLO, -199},
{0x0131, 0, TOUP, -232},
{0x0132, 5, TO1, EVENCAP},
{0x0139, 15, TO1, ODDCAP},
{0x014A, 45, TO1, EVENCAP},
{0x0178, 0, TOLO, -121},
{0x0179, 5, TO1, ODDCAP},
{0x017F, 0, TOUP, -300},
{0x0180, 0, TOUP, 195},
{0x0181, 0, TOLO, 210},
{0x0182, 3, TO1, EVENCAP},
{0x0186, 0, TOLO, 206},
{0x0187, 1, TO1, ODDCAP},
{0x0189, 1, TOLO, 205},
{0x018B, 1, TO1, ODDCAP},
{0x018E, 0, TOLO, 79},
{0x018F, 0, TOLO, 202},
{0x0190, 0, TOLO, 203},
{0x0191, 1, TO1, ODDCAP},
{0x0193, 0, TOLO, 205},
{0x0194, 0, TOLO, 207},
{0x0195, 0, TOUP, 97},
{0x0196, 0, TOLO, 211},
{0x0197, 0, TOLO, 209},
{0x0198, 1, TO1, EVENCAP},
{0x019A, 0, TOUP, 163},
{0x019C, 0, TOLO, 211},
{0x019D, 0, TOLO, 213},
{0x019E, 0, TOUP, 130},
{0x019F, 0, TOLO, 214},
{0x01A0, 5, TO1, EVENCAP},
{0x01A6, 0, TOLO, 218},
{0x01A7, 1, TO1, ODDCAP},
{0x01A9, 0, TOLO, 218},
{0x01AC, 1, TO1, EVENCAP},
{0x01AE, 0, TOLO, 218},
{0x01AF, 1, TO1, ODDCAP},
{0x01B1, 1, TOLO, 217},
{0x01B3, 3, TO1, ODDCAP},
{0x01B7, 0, TOLO, 219},
{0x01B8, 1, TO1, EVENCAP},
{0x01BC, 1, TO1, EVENCAP},
{0x01BF, 0, TOUP, 56},
{0x01C4, 0, TOLO, 2},
{0x01C5, 0, TOBOTH, 0},
{0x01C6, 0, TOUP, -2},
{0x01C7, 0, TOLO, 2},
{0x01C8, 0, TOBOTH, 0},
{0x01C9, 0, TOUP, -2},
{0x01CA, 0, TOLO, 2},
{0x01CB, 0, TOBOTH, 0},
{0x01CC, 0, TOUP, -2},
{0x01CD, 15, TO1, ODDCAP},
{0x01DD, 0, TOUP, -79},
{0x01DE, 17, TO1, EVENCAP},
{0x01F1, 0, TOLO, 2},
{0x01F2, 0, TOBOTH, 0},
{0x01F3, 0, TOUP, -2},
{0x01F4, 1, TO1, EVENCAP},
{0x01F6, 0, TOLO, -97},
{0x01F7, 0, TOLO, -56},
{0x01F8, 39, TO1, EVENCAP},
{0x0220, 0, TOLO, -130},
{0x0222, 17, TO1, EVENCAP},
{0x023A, 0, TOLO, 10795},
{0x023B, 1, TO1, ODDCAP},
{0x023D, 0, TOLO, -163},
{0x023E, 0, TOLO, 10792},
{0x023F, 1, TOUP, 10815},
{0x0241, 1, TO1, ODDCAP},
{0x0243, 0, TOLO, -195},
{0x0244, 0, TOLO, 69},
{0x0245, 0, TOLO, 71},
{0x0246, 9, TO1, EVENCAP},
{0x0250, 0, TOUP, 10783},
{0x0251, 0, TOUP, 10780},
{0x0252, 0, TOUP, 10782},
{0x0253, 0, TOUP, -210},
{0x0254, 0, TOUP, -206},
{0x0256, 1, TOUP, -205},
{0x0259, 0, TOUP, -202},
{0x025B, 0, TOUP, -203},
{0x025C, 0, TOUP, 42319},
{0x0260, 0, TOUP, -205},
{0x0261, 0, TOUP, 42315},
{0x0263, 0, TOUP, -207},
{0x0265, 0, TOUP, 42280},
{0x0266, 0, TOUP, 42308},
{0x0268, 0, TOUP, -209},
{0x0269, 0, TOUP, -211},
{0x026A, 0, TOUP, 42308},
{0x026B, 0, TOUP, 10743},
{0x026C, 0, TOUP, 42305},
{0x026F, 0, TOUP, -211},
{0x0271, 0, TOUP, 10749},
{0x0272, 0, TOUP, -213},
{0x0275, 0, TOUP, -214},
{0x027D, 0, TOUP, 10727},
{0x0280, 0, TOUP, -218},
{0x0282, 0, TOUP, 42307},
{0x0283, 0, TOUP, -218},
{0x0287, 0, TOUP, 42282},
{0x0288, 0, TOUP, -218},
{0x0289, 0, TOUP, -69},
{0x028A, 1, TOUP, -217},
{0x028C, 0, TOUP, -71},
{0x0292, 0, TOUP, -219},
{0x029D, 0, TOUP, 42261},
{0x029E, 0, TOUP, 42258},
{0x0345, 0, TOUP, 84},
{0x0370, 3, TO1, EVENCAP},
{0x0376, 1, TO1, EVENCAP},
{0x037B, 2, TOUP, 130},
{0x037F, 0, TOLO, 116},
{0x0386, 0, TOLO, 38},
{0x0388, 2, TOLO, 37},
{0x038C, 0, TOLO, 64},
{0x038E, 1, TOLO, 63},
{0x0391, 16, TOLO, 32},
{0x03A3, 8, TOLO, 32},
{0x03AC, 0, TOUP, -38},
{0x03AD, 2, TOUP, -37},
{0x03B1, 16, TOUP, -32},
{0x03C2, 0, TOUP, -31},
{0x03C3, 8, TOUP, -32},
{0x03CC, 0, TOUP, -64},
{0x03CD, 1, TOUP, -63},
{0x03CF, 0, TOLO, 8},
{0x03D0, 0, TOUP, -62},
{0x03D1, 0, TOUP, -57},
{0x03D5, 0, TOUP, -47},
{0x03D6, 0, TOUP, -54},
{0x03D7, 0, TOUP, -8},
{0x03D8, 23, TO1, EVENCAP},
{0x03F0, 0, TOUP, -86},
{0x03F1, 0, TOUP, -80},
{0x03F2, 0, TOUP, 7},
{0x03F3, 0, TOUP, -116},
{0x03F4, 0, TOLO, -60},
{0x03F5, 0, TOUP, -96},
{0x03F7, 1, TO1, ODDCAP},
{0x03F9, 0, TOLO, -7},
{0x03FA, 1, TO1, EVENCAP},
{0x03FD, 2, TOLO, -130},
{0x0400, 15, TOLO, 80},
{0x0410, 31, TOLO, 32},
{0x0430, 31, TOUP, -32},
{0x0450, 15, TOUP, -80},
{0x0460, 33, TO1, EVENCAP},
{0x048A, 53, TO1, EVENCAP},
{0x04C0, 0, TOLO, 15},
{0x04C1, 13, TO1, ODDCAP},
{0x04CF, 0, TOUP, -15},
{0x04D0, 95, TO1, EVENCAP},
{0x0531, 37, TOLO, 48},
{0x0561, 37, TOUP, -48},
{0x10A0, 37, TOLO, 7264},
{0x10C7, 0, TOLO, 7264},
{0x10CD, 0, TOLO, 7264},
{0x10D0, 42, TOUP, 3008},
{0x10FD, 2, TOUP, 3008},
{0x13A0, 79, TOLO, 38864},
{0x13F0, 5, TOLO, 8},
{0x13F8, 5, TOUP, -8},
{0x1C80, 0, TOUP, -6254},
{0x1C81, 0, TOUP, -6253},
{0x1C82, 0, TOUP, -6244},
{0x1C83, 1, TOUP, -6242},
{0x1C85, 0, TOUP, -6243},
{0x1C86, 0, TOUP, -6236},
{0x1C87, 0, TOUP, -6181},
{0x1C88, 0, TOUP, 35266},
{0x1C90, 42, TOLO, -3008},
{0x1CBD, 2, TOLO, -3008},
{0x1D79, 0, TOUP, 35332},
{0x1D7D, 0, TOUP, 3814},
{0x1D8E, 0, TOUP, 35384},
{0x1E00, 149, TO1, EVENCAP},
{0x1E9B, 0, TOUP, -59},
{0x1E9E, 0, TOLO, -7615},
{0x1EA0, 95, TO1, EVENCAP},
{0x1F00, 7, TOUP, 8},
{0x1F08, 7, TOLO, -8},
{0x1F10, 5, TOUP, 8},
{0x1F18, 5, TOLO, -8},
{0x1F20, 7, TOUP, 8},
{0x1F28, 7, TOLO, -8},
{0x1F30, 7, TOUP, 8},
{0x1F38, 7, TOLO, -8},
{0x1F40, 5, TOUP, 8},
{0x1F48, 5, TOLO, -8},
{0x1F51, 0, TOUP, 8},
{0x1F53, 0, TOUP, 8},
{0x1F55, 0, TOUP, 8},
{0x1F57, 0, TOUP, 8},
{0x1F59, 0, TOLO, -8},
{0x1F5B, 0, TOLO, -8},
{0x1F5D, 0, TOLO, -8},
{0x1F5F, 0, TOLO, -8},
{0x1F60, 7, TOUP, 8},
{0x1F68, 7, TOLO, -8},
{0x1F70, 1, TOUP, 74},
{0x1F72, 3, TOUP, 86},
{0x1F76, 1, TOUP, 100},
{0x1F78, 1, TOUP, 128},
{0x1F7A, 1, TOUP, 112},
{0x1F7C, 1, TOUP, 126},
{0x1F80, 7, TOUP, 8},
{0x1F88, 7, TOLO, -8},
{0x1F90, 7, TOUP, 8},
{0x1F98, 7, TOLO, -8},
{0x1FA0, 7, TOUP, 8},
{0x1FA8, 7, TOLO, -8},
{0x1FB0, 1, TOUP, 8},
{0x1FB3, 0, TOUP, 9},
{0x1FB8, 1, TOLO, -8},
{0x1FBA, 1, TOLO, -74},
{0x1FBC, 0, TOLO, -9},
{0x1FBE, 0, TOUP, -7205},
{0x1FC3, 0, TOUP, 9},
{0x1FC8, 3, TOLO, -86},
{0x1FCC, 0, TOLO, -9},
{0x1FD0, 1, TOUP, 8},
{0x1FD8, 1, TOLO, -8},
{0x1FDA, 1, TOLO, -100},
{0x1FE0, 1, TOUP, 8},
{0x1FE5, 0, TOUP, 7},
{0x1FE8, 1, TOLO, -8},
{0x1FEA, 1, TOLO, -112},
{0x1FEC, 0, TOLO, -7},
{0x1FF3, 0, TOUP, 9},
{0x1FF8, 1, TOLO, -128},
{0x1FFA, 1, TOLO, -126},
{0x1FFC, 0, TOLO, -9},
{0x2126, 0, TOLO, -7517},
{0x212A, 0, TOLO, -8383},
{0x212B, 0, TOLO, -8262},
{0x2132, 0, TOLO, 28},
{0x214E, 0, TOUP, -28},
{0x2160, 15, TOLO, 16},
{0x2170, 15, TOUP, -16},
{0x2183, 1, TO1, ODDCAP},
{0x24B6, 25, TOLO, 26},
{0x24D0, 25, TOUP, -26},
{0x2C00, 47, TOLO, 48},
{0x2C30, 47, TOUP, -48},
{0x2C60, 1, TO1, EVENCAP},
{0x2C62, 0, TOLO, -10743},
{0x2C63, 0, TOLO, -3814},
{0x2C64, 0, TOLO, -10727},
{0x2C65, 0, TOUP, -10795},
{0x2C66, 0, TOUP, -10792},
{0x2C67, 5, TO1, ODDCAP},
{0x2C6D, 0, TOLO, -10780},
{0x2C6E, 0, TOLO, -10749},
{0x2C6F, 0, TOLO, -10783},
{0x2C70, 0, TOLO, -10782},
{0x2C72, 1, TO1, EVENCAP},
{0x2C75, 1, TO1, ODDCAP},
{0x2C7E, 1, TOLO, -10815},
{0x2C80, 99, TO1, EVENCAP},
{0x2CEB, 3, TO1, ODDCAP},
{0x2CF2, 1, TO1, EVENCAP},
{0x2D00, 37, TOUP, -7264},
{0x2D27, 0, TOUP, -7264},
{0x2D2D, 0, TOUP, -7264},
{0xA640, 45, TO1, EVENCAP},
{0xA680, 27, TO1, EVENCAP},
{0xA722, 13, TO1, EVENCAP},
{0xA732, 61, TO1, EVENCAP},
{0xA779, 3, TO1, ODDCAP},
{0xA77D, 0, TOLO, -35332},
{0xA77E, 9, TO1, EVENCAP},
{0xA78B, 1, TO1, ODDCAP},
{0xA78D, 0, TOLO, -42280},
{0xA790, 3, TO1, EVENCAP},
{0xA794, 0, TOUP, 48},
{0xA796, 19, TO1, EVENCAP},
{0xA7AA, 0, TOLO, -42308},
{0xA7AB, 0, TOLO, -42319},
{0xA7AC, 0, TOLO, -42315},
{0xA7AD, 0, TOLO, -42305},
{0xA7AE, 0, TOLO, -42308},
{0xA7B0, 0, TOLO, -42258},
{0xA7B1, 0, TOLO, -42282},
{0xA7B2, 0, TOLO, -42261},
{0xA7B3, 0, TOLO, 928},
{0xA7B4, 15, TO1, EVENCAP},
{0xA7C4, 0, TOLO, -48},
{0xA7C5, 0, TOLO, -42307},
{0xA7C6, 0, TOLO, -35384},
{0xA7C7, 3, TO1, ODDCAP},
{0xA7D0, 1, TO1, EVENCAP},
{0xA7D6, 3, TO1, EVENCAP},
{0xA7F5, 1, TO1, ODDCAP},
{0xAB53, 0, TOUP, -928},
{0xAB70, 79, TOUP, -38864},
{0xFF21, 25, TOLO, 32},
{0xFF41, 25, TOUP, -32},
{0x10400, 39, TOLO, 40},
{0x10428, 39, TOUP, -40},
{0x104B0, 35, TOLO, 40},
{0x104D8, 35, TOUP, -40},
{0x10570, 10, TOLO, 39},
{0x1057C, 14, TOLO, 39},
{0x1058C, 6, TOLO, 39},
{0x10594, 1, TOLO, 39},
{0x10597, 10, TOUP, -39},
{0x105A3, 14, TOUP, -39},
{0x105B3, 6, TOUP, -39},
{0x105BB, 1, TOUP, -39},
{0x10C80, 50, TOLO, 64},
{0x10CC0, 50, TOUP, -64},
{0x118A0, 31, TOLO, 32},
{0x118C0, 31, TOUP, -32},
{0x16E40, 31, TOLO, 32},
{0x16E60, 31, TOUP, -32},
{0x1E900, 33, TOLO, 34},
{0x1E922, 33, TOUP, -34},

View File

@@ -0,0 +1,40 @@
#include <wctype.h>
#include <stdint.h>
#include "categories.h"
struct _category {
enum category cat: 8;
uint_least32_t first: 24;
uint_least16_t delta;
} __attribute__((packed));
static const struct _category categories[] = {
#include "categories.t"
};
static enum category
bisearch_cat(wint_t ucs, const struct _category *table, int max)
{
int min = 0;
int mid;
if (ucs < table[0].first || ucs > table[max].first + table[max].delta)
return -1;
while (max >= min)
{
mid = (min + max) / 2;
if (ucs > table[mid].first + table[mid].delta)
min = mid + 1;
else if (ucs < table[mid].first)
max = mid - 1;
else
return table[mid].cat;
}
return -1;
}
enum category category(wint_t ucs)
{
return bisearch_cat(ucs, categories,
sizeof(categories) / sizeof(*categories) - 1);
}

View File

@@ -0,0 +1,29 @@
CAT_Cc,
CAT_Cf,
CAT_Cs,
CAT_LC,
CAT_Ll,
CAT_Lm,
CAT_Lo,
CAT_Lt,
CAT_Lu,
CAT_Mc,
CAT_Me,
CAT_Mn,
CAT_Nd,
CAT_Nl,
CAT_No,
CAT_Pc,
CAT_Pd,
CAT_Pe,
CAT_Pf,
CAT_Pi,
CAT_Po,
CAT_Ps,
CAT_Sc,
CAT_Sk,
CAT_Sm,
CAT_So,
CAT_Zl,
CAT_Zp,
CAT_Zs,

View File

@@ -0,0 +1,7 @@
/* category data */
enum category {
#include "categories.cat"
};
extern enum category category(wint_t ucs);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,143 @@
@node Ctype
@chapter Character Type Macros and Functions (@file{ctype.h})
This chapter groups macros (which are also available as subroutines)
to classify characters into several categories (alphabetic,
numeric, control characters, whitespace, and so on), or to perform
simple character mappings.
The header file @file{ctype.h} defines the macros.
@menu
* isalnum:: Alphanumeric character predicate (isalnum, isalnum_l)
* isalpha:: Alphabetic character predicate (isalpha, isalpha_l)
* isascii:: ASCII character predicate (isascii, isascii_l)
* isblank:: Blank character predicate (isblank, isblank_l)
* iscntrl:: Control character predicate (iscntrl, iscntrl_l)
* isdigit:: Decimal digit predicate (isdigit, isdigit_l)
* islower:: Lowercase character predicate (islower, islower_l)
* isprint:: Printable character predicates (isprint, isprint_l. isgraph, isgraph_l)
* ispunct:: Punctuation character predicate (ispunct, ispunct_l)
* isspace:: Whitespace character predicate (isspace, isspace_l)
* isupper:: Uppercase character predicate (isupper, isupper_l)
* isxdigit:: Hexadecimal digit predicate (isxdigit, isxdigit_l)
* toascii:: Force integers to ASCII range (toascii, toascii_l)
* tolower:: Translate characters to lowercase (tolower, tolower_l)
* toupper:: Translate characters to uppercase (toupper, toupper_l)
* iswalnum:: Alphanumeric wide character predicate (iswalnum, iswalnum_l)
* iswalpha:: Alphabetic wide character predicate (iswalpha, iswalpha_l)
* iswblank:: Blank wide character predicate (iswblank, iswblank_l)
* iswcntrl:: Control wide character predicate (iswcntrl, iswcntrl_l)
* iswdigit:: Decimal digit wide character predicate (iswdigit, iswdigit_l)
* iswgraph:: Graphic wide character predicate (iswgraph, iswgraph_l)
* iswlower:: Lowercase wide character predicate (iswlower, iswlower_l)
* iswprint:: Printable wide character predicate (iswprint, iswprint_l)
* iswpunct:: Punctuation wide character predicate (iswpunct, iswpunct_l)
* iswspace:: Whitespace wide character predicate (iswspace, iswspace_l)
* iswupper:: Uppercase wide character predicate (iswupper, iswupper_l)
* iswxdigit:: Hexadecimal digit wide character predicate (iswxdigit, iswxdigit_l)
* iswctype:: Extensible wide-character test (iswctype, iswctype_l)
* wctype:: Compute wide-character test type (wctype, wctype_l)
* towlower:: Translate wide characters to lowercase (towlower, towlower_l)
* towupper:: Translate wide characters to uppercase (towupper, towupper_l)
* towctrans:: Extensible wide-character translation (towctrans, towctrans_l)
* wctrans:: Compute wide-character translation type (wctrans, wctrans_l)
@end menu
@page
@include ctype/isalnum.def
@page
@include ctype/isalpha.def
@page
@include ctype/isascii.def
@page
@include ctype/isblank.def
@page
@include ctype/iscntrl.def
@page
@include ctype/isdigit.def
@page
@include ctype/islower.def
@page
@include ctype/isprint.def
@page
@include ctype/ispunct.def
@page
@include ctype/isspace.def
@page
@include ctype/isupper.def
@page
@include ctype/isxdigit.def
@page
@include ctype/toascii.def
@page
@include ctype/tolower.def
@page
@include ctype/toupper.def
@page
@include ctype/iswalnum.def
@page
@include ctype/iswalpha.def
@page
@include ctype/iswcntrl.def
@page
@include ctype/iswblank.def
@page
@include ctype/iswdigit.def
@page
@include ctype/iswgraph.def
@page
@include ctype/iswlower.def
@page
@include ctype/iswprint.def
@page
@include ctype/iswpunct.def
@page
@include ctype/iswspace.def
@page
@include ctype/iswupper.def
@page
@include ctype/iswxdigit.def
@page
@include ctype/iswctype.def
@page
@include ctype/wctype.def
@page
@include ctype/towlower.def
@page
@include ctype/towupper.def
@page
@include ctype/towctrans.def
@page
@include ctype/wctrans.def

View File

@@ -0,0 +1,185 @@
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)ctype_.c 5.6 (Berkeley) 6/1/90";
#endif /* LIBC_SCCS and not lint */
#include "ctype_.h"
#include "../locale/setlocale.h"
#define _CTYPE_DATA_0_127 \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C|_S, _C|_S, _C|_S, _C|_S, _C|_S, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_S|_B, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_N, _N, _N, _N, _N, _N, _N, _N, \
_N, _N, _P, _P, _P, _P, _P, _P, \
_P, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _P, _P, _P, _P, _P, \
_P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _P, _P, _P, _P, _C
#define _CTYPE_DATA_128_255 \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0
#if defined(_MB_CAPABLE)
#if defined(_MB_EXTENDED_CHARSETS_ISO)
#include "ctype_iso.h"
#endif
#if defined(_MB_EXTENDED_CHARSETS_WINDOWS)
#include "ctype_cp.h"
#endif
#endif
#if defined(ALLOW_NEGATIVE_CTYPE_INDEX)
/* No static const on Cygwin since it's referenced and potentially overwritten
for compatibility with older applications. */
#ifndef __CYGWIN__
const
#endif
char _ctype_b[128 + 256] = {
_CTYPE_DATA_128_255,
_CTYPE_DATA_0_127,
_CTYPE_DATA_128_255
};
# ifdef __CYGWIN__
/* For backward compatibility */
char __EXPORT *__ctype_ptr__ = DEFAULT_CTYPE_PTR;
# ifdef __x86_64__
__asm__ (" \n\
.data \n\
.globl _ctype_ \n\
.set _ctype_,_ctype_b+127 \n\
.text \n\
");
# else
__asm__ (" \n\
.data \n\
.globl __ctype_ \n\
.set __ctype_,__ctype_b+127 \n\
.text \n\
");
# endif
# else /* !__CYGWIN__ */
const char _ctype_[1 + 256] = {
0,
_CTYPE_DATA_0_127,
_CTYPE_DATA_128_255
};
# endif /* !__CYGWIN__ */
#else /* !ALLOW_NEGATIVE_CTYPE_INDEX */
const char _ctype_[1 + 256] = {
0,
_CTYPE_DATA_0_127,
_CTYPE_DATA_128_255
};
#endif /* !ALLOW_NEGATIVE_CTYPE_INDEX */
#if defined(_MB_CAPABLE)
/* Cygwin has its own implementation which additionally maintains backward
compatibility with applications built under older Cygwin releases. */
#ifndef __CYGWIN__
void
__set_ctype (struct __locale_t *loc, const char *charset)
{
#if defined(_MB_EXTENDED_CHARSETS_ISO) || defined(_MB_EXTENDED_CHARSETS_WINDOWS)
int idx;
#endif
char *ctype_ptr = NULL;
switch (*charset)
{
#if defined(_MB_EXTENDED_CHARSETS_ISO)
case 'I':
idx = __iso_8859_index (charset + 9);
/* The ctype table has a leading ISO-8859-1 element so we have to add
1 to the index returned by __iso_8859_index. If __iso_8859_index
returns < 0, it's ISO-8859-1. */
if (idx < 0)
idx = 0;
else
++idx;
ctype_ptr = __ctype_iso[idx];
break;
#endif
#if defined(_MB_EXTENDED_CHARSETS_WINDOWS)
case 'C':
idx = __cp_index (charset + 2);
if (idx < 0)
break;
ctype_ptr = __ctype_cp[idx];
break;
#endif
default:
break;
}
if (!ctype_ptr)
{
# if defined(ALLOW_NEGATIVE_CTYPE_INDEX)
ctype_ptr = _ctype_b;
# else
ctype_ptr = _ctype_;
# endif
}
# if defined(ALLOW_NEGATIVE_CTYPE_INDEX)
loc->ctype_ptr = ctype_ptr + 127;
# else
loc->ctype_ptr = ctype_ptr;
# endif
}
#endif /* !__CYGWIN__ */
#endif /* _MB_CAPABLE */

View File

@@ -0,0 +1,22 @@
#include <ctype.h>
#if (defined(__GNUC__) && !defined(__CHAR_UNSIGNED__) && !defined(COMPACT_CTYPE)) || defined (__CYGWIN__)
#define ALLOW_NEGATIVE_CTYPE_INDEX
#endif
#ifdef ALLOW_NEGATIVE_CTYPE_INDEX
#ifndef __CYGWIN__
extern const char _ctype_b[];
#else
extern char _ctype_b[];
#endif
# define DEFAULT_CTYPE_PTR ((char *) _ctype_b + 127)
#else /* !ALLOW_NEGATIVE_CTYPE_INDEX */
/* _ctype_ is declared in <ctype.h>. */
# define DEFAULT_CTYPE_PTR ((char *) _ctype_)
#endif /* !ALLOW_NEGATIVE_CTYPE_INDEX */

View File

@@ -0,0 +1,801 @@
/* ctype table definitions for Windows codepage charsets.
Included by ctype_.c. */
#define _CTYPE_CP437_128_254 \
_U, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _U, _U, \
_U, _L, _U, _L, _L, _L, _L, _L, \
_L, _U, _U, _P, _P, _P, _P, _P, \
_L, _L, _L, _L, _L, _L, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_L, _L, _U, _L, _U, _L, _P, _L, \
_U, _U, _U, _L, _P, _L, _L, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P
#define _CTYPE_CP437_255 _S|_B
#define _CTYPE_CP720_128_254 \
0, 0, _L, _L, 0, _L, 0, _L, \
_L, _L, _L, _L, _L, 0, 0, 0, \
0, _P, _P, _L, _P, _P, _L, _L, \
_U|_L, _U|_L, _U|_L, _U|_L, _P, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _P, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P
#define _CTYPE_CP720_255 _S|_B
#define _CTYPE_CP737_128_254 \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _U, _U, _U, _U, _U, _U, \
_U, _P, _P, _P, _U, _U, _P, _P, \
_P, _P, _P, _P, _P, _P, _P
#define _CTYPE_CP737_255 _S|_B
#define _CTYPE_CP775_128_254 \
_U, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _U, _L, _L, _U, _U, _U, \
_U, _L, _U, _L, _L, _U, _P, _U, \
_L, _U, _U, _L, _P, _U, _P, _P, \
_U, _U, _L, _U, _L, _L, _P, _P, \
_P, _P, _P, _P, _P, _U, _P, _P, \
_P, _P, _P, _P, _P, _U, _U, _U, \
_U, _P, _P, _P, _P, _U, _U, _P, \
_P, _P, _P, _P, _P, _P, _U, _U, \
_P, _P, _P, _P, _P, _P, _P, _U, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _P, _P, _P, _P, _P, _P, _P, \
_U, _L, _U, _U, _L, _U, _P, _L, \
_U, _L, _U, _L, _L, _U, _U, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P
#define _CTYPE_CP775_255 _S|_B
#define _CTYPE_CP850_128_254 \
_U, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _U, _U, \
_U, _L, _U, _L, _L, _L, _L, _L, \
_L, _U, _U, _L, _P, _U, _P, _L, \
_L, _L, _L, _L, _L, _U, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _U, _U, _U, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _L, _U, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_L, _U, _U, _U, _U, _L, _U, _U, \
_U, _P, _P, _P, _P, _P, _U, _P, \
_U, _L, _U, _U, _L, _U, _P, _L, \
_U, _U, _U, _U, _L, _U, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P
#define _CTYPE_CP850_255 _S|_B
#define _CTYPE_CP852_128_254 \
_U, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _U, _L, _L, _U, _U, _U, \
_U, _U, _L, _L, _L, _U, _L, _U, \
_L, _U, _U, _U, _L, _U, _P, _L, \
_L, _L, _L, _L, _U, _L, _U, _L, \
_U, _L, _P, _L, _U, _L, _P, _P, \
_P, _P, _P, _P, _P, _U, _U, _U, \
_U, _P, _P, _P, _P, _U, _L, _P, \
_P, _P, _P, _P, _P, _P, _U, _L, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_L, _U, _U, _U, _L, _U, _U, _U, \
_L, _P, _P, _P, _P, _U, _U, _P, \
_U, _L, _U, _U, _L, _L, _U, _L, \
_U, _U, _L, _U, _L, _U, _L, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _L, _U, _L, _P
#define _CTYPE_CP852_255 _S|_B
#define _CTYPE_CP855_128_254 \
_L, _U, _L, _U, _L, _U, _L, _U, \
_L, _U, _L, _U, _L, _U, _L, _U, \
_L, _U, _L, _U, _L, _U, _L, _U, \
_L, _U, _L, _U, _L, _U, _L, _U, \
_L, _U, _L, _U, _L, _U, _L, _U, \
_L, _U, _L, _U, _L, _U, _P, _P, \
_P, _P, _P, _P, _P, _L, _U, _L, \
_U, _P, _P, _P, _P, _L, _U, _P, \
_P, _P, _P, _P, _P, _P, _L, _U, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_L, _U, _L, _U, _L, _U, _L, _U, \
_L, _P, _P, _P, _P, _U, _L, _P, \
_U, _L, _U, _L, _U, _L, _U, _L, \
_U, _L, _U, _L, _U, _L, _U, _P, \
_P, _L, _U, _L, _U, _L, _U, _L, \
_U, _L, _U, _L, _U, _P, _P
#define _CTYPE_CP855_255 _S|_B
#define _CTYPE_CP857_128_254 \
_U, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _U, _U, \
_U, _L, _U, _L, _L, _L, _L, _L, \
_U, _U, _U, _L, _P, _U, _U, _L, \
_L, _L, _L, _L, _L, _U, _U, _L, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _U, _U, _U, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _L, _U, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _U, _U, _U, 0, _U, _U, \
_U, _P, _P, _P, _P, _P, _U, _P, \
_U, _L, _U, _U, _L, _U, _P, 0, \
_P, _U, _U, _U, _L, _L, _P, _P, \
_P, _P, 0, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P
#define _CTYPE_CP857_255 _S|_B
#define _CTYPE_CP858_128_254 \
_U, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _U, _U, \
_U, _L, _U, _L, _L, _L, _L, _L, \
_L, _U, _U, _L, _P, _U, _P, _L, \
_L, _L, _L, _L, _L, _U, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _U, _U, _U, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _L, _U, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_L, _U, _U, _U, _U, _P, _U, _U, \
_U, _P, _P, _P, _P, _P, _U, _P, \
_U, _L, _U, _U, _L, _U, _P, _L, \
_U, _U, _U, _U, _L, _U, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P
#define _CTYPE_CP858_255 _S|_B
#define _CTYPE_CP862_128_254 \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _P, _P, _P, _P, _L, \
_L, _L, _L, _L, _L, _U, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_L, _L, _U, _L, _U, _L, _P, _L, \
_U, _U, _U, _L, _P, _L, _L, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P
#define _CTYPE_CP862_255 _S|_B
#define _CTYPE_CP866_128_254 \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_U, _L, _U, _L, _U, _L, _U, _L, \
_P, _P, _P, _P, _P, _P, _P
#define _CTYPE_CP866_255 _S|_B
#define _CTYPE_CP874_128_254 \
_P, 0, 0, 0, 0, _P, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, _P, _P, _P, _P, _P, _P, _P, \
0, 0, 0, 0, 0, 0, 0, 0, \
_S|_B, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, 0, 0, 0, 0, _P, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _U|_L, _U|_L, 0, 0, 0
#define _CTYPE_CP874_255 0
#define _CTYPE_CP1125_128_254 \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_U, _L, _U, _L, _U, _L, _U, _L, \
_U, _L, _P, _P, _P, _P, _P
#define _CTYPE_CP1125_255 _S|_B
#define _CTYPE_CP1250_128_254 \
_P, 0, _P, 0, _P, _P, _P, _P, \
0, _P, _U, _P, _U, _U, _U, _U, \
0, _P, _P, _P, _P, _P, _P, _P, \
0, _P, _L, _P, _L, _L, _L, _L, \
_S|_B, _P, _P, _U, _P, _U, _P, _P, \
_P, _P, _U, _P, _P, _P, _P, _U, \
_P, _P, _P, _L, _P, _P, _P, _P, \
_P, _L, _L, _P, _U, _P, _L, _L, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _P, \
_U, _U, _U, _U, _U, _U, _U, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _P, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_CP1250_255 _P
#define _CTYPE_CP1251_128_254 \
_U, _U, _P, _L, _P, _P, _P, _P, \
_P, _P, _U, _P, _U, _U, _U, _U, \
_L, _P, _P, _P, _P, _P, _P, _P, \
0, _P, _L, _P, _L, _L, _L, _L, \
_S|_B, _U, _L, _U, _P, _U, _P, _P, \
_U, _P, _U, _P, _P, _P, _P, _U, \
_P, _P, _U, _L, _L, _P, _P, _P, \
_L, _P, _L, _P, _L, _U, _L, _L, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_CP1251_255 _L
#define _CTYPE_CP1252_128_254 \
_P, 0, _P, _L, _P, _P, _P, _P, \
_P, _P, _U, _P, _U, _U, 0, 0, \
0, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _L, _P, _L, 0, _L, _U, \
_S|_B, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _P, \
_U, _U, _U, _U, _U, _U, _U, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _P, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_CP1252_255 _L
#define _CTYPE_CP1253_128_254 \
_P, 0, _P, _L, _P, _P, _P, _P, \
0, _P, 0, _P, 0, 0, 0, 0, \
0, _P, _P, _P, _P, _P, _P, _P, \
0, _P, 0, _P, 0, 0, 0, 0, \
_S|_B, _P, _U, _P, _P, _P, _P, _P, \
_P, _P, 0, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_U, _U, _U, _P, _U, _P, _U, _U, \
_L, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_CP1253_255 _L
#define _CTYPE_CP1254_128_254 \
_P, 0, _P, _L, _P, _P, _P, _P, \
_P, _P, _U, _P, _U, 0, 0, 0, \
0, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _L, _P, _L, 0, 0, _U, \
_S|_B, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _P, \
_U, _U, _U, _U, _U, _U, _U, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _P, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_CP1254_255 _L
#define _CTYPE_CP1255_128_254 \
_P, 0, _P, _L, _P, _P, _P, _P, \
_P, _P, 0, _P, 0, 0, 0, 0, \
0, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, 0, _P, 0, 0, 0, 0, \
_S|_B, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _U|_L, _U|_L, _U|_L, _P, \
_P, 0, 0, 0, 0, 0, 0, 0, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, 0, 0, _P, _P
#define _CTYPE_CP1255_255 0
#define _CTYPE_CP1256_128_254 \
_P, _U|_L, _P, _L, _P, _P, _P, _P, \
_P, _P, _U|_L, _P, _U, _U|_L, _U|_L, _U|_L, \
_U|_L, _P, _P, _P, _P, _P, _P, _P, \
_U|_L, _P, _U|_L, _P, _L, _P, _P, _U|_L, \
_S|_B, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _U|_L, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _P, \
_U|_L, _U|_L, _U|_L, _U|_L, _P, _U|_L, _U|_L, _U|_L, \
_L, _U|_L, _L, _U|_L, _U|_L, _U|_L, _U|_L, _L, \
_L, _L, _L, _L, _U|_L, _U|_L, _L, _L, \
_P, _P, _P, _P, _L, _P, _P, _P, \
_P, _L, _P, _L, _L, _P, _P
#define _CTYPE_CP1256_255 _U|_L
#define _CTYPE_CP1257_128_254 \
_P, 0, _P, 0, _P, _P, _P, _P, \
0, _P, 0, _P, 0, _P, _P, _P, \
0, _P, _P, _P, _P, _P, _P, _P, \
0, _P, 0, _P, 0, _P, _P, 0, \
_S|_B, 0, _P, _P, _P, 0, _P, _P, \
_U, _P, _U, _P, _P, _P, _P, _U, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_L, _P, _L, _P, _P, _P, _P, _L, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _P, \
_U, _U, _U, _U, _U, _U, _U, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _P, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_CP1257_255 _P
#define _CTYPE_CP1258_128_254 \
_P, 0, _P, _L, _P, _P, _P, _P, \
_P, _P, 0, _P, _U, 0, 0, 0, \
0, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, 0, _P, _L, 0, 0, _U, \
_S|_B, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _P, _U, _U, _U, \
_U, _U, _P, _U, _U, _U, _U, _P, \
_U, _U, _U, _U, _U, _U, _P, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _P, _L, _L, _L, \
_L, _L, _P, _L, _L, _L, _L, _P, \
_L, _L, _L, _L, _L, _L, _P
#define _CTYPE_CP1258_255 _L
#define _CTYPE_CP20866_128_254 \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _S|_B, _P, _P, _P, _P, _P, \
_P, _P, _P, _L, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _U, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U
#define _CTYPE_CP20866_255 _U
#define _CTYPE_CP21866_128_254 \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _S|_B, _P, _P, _P, _P, _P, \
_P, _P, _P, _L, _L, _P, _L, _L, \
_P, _P, _P, _P, _P, _L, _P, _P, \
_P, _P, _P, _U, _U, _P, _U, _U, \
_P, _P, _P, _P, _P, _U, _P, _P, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U
#define _CTYPE_CP21866_255 _U
#define _CTYPE_GEORGIAN_PS_128_254 \
_P, 0, _P, _L, _P, _P, _P, _P, \
_P, _P, _U, _P, _U, _U, 0, 0, \
0, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _L, _P, _L, 0, _L, _U, \
_S|_B, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _P, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_GEORGIAN_PS_255 _L
#define _CTYPE_PT154_128_254 \
_U, _U, _U, _L, _P, _P, _U, _U, \
_U, _L, _U, _U, _U, _U, _U, _U, \
_L, _P, _P, _P, _P, _P, _P, _P, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_S|_B, _U, _L, _U, _U, _U, _U, _P, \
_U, _P, _U, _P, _P, _L, _P, _U, \
_P, _L, _U, _L, _L, _L, _P, _P, \
_L, _P, _L, _P, _L, _U, _L, _L, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_PT154_255 _L
#define _CTYPE_CP103_128_254 \
_L, _L, _P, _U, _P, _P, _P, _P, \
0, _P, _L, _P, _U, _L, _U, 0, \
_U, _P, _P, _P, _P, _P, _P, _P, \
0, _P, 0, _P, 0, 0, 0, 0, \
0, _L, _U, _L, _P, _L, _P, _P, \
0, 0, 0, _P, _P, _P, _P, 0, \
_P, _P, _P, _U, 0, _U, _P, _P, \
0, _P, 0, _P, 0, 0, 0, _P, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U
#define _CTYPE_CP103_255 _U
#if defined(ALLOW_NEGATIVE_CTYPE_INDEX)
#ifndef __CYGWIN__
static const
#endif
char __ctype_cp[27][128 + 256] = {
{ _CTYPE_CP437_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP437_128_254,
_CTYPE_CP437_255
},
{ _CTYPE_CP720_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP720_128_254,
_CTYPE_CP720_255
},
{ _CTYPE_CP737_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP737_128_254,
_CTYPE_CP737_255
},
{ _CTYPE_CP775_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP775_128_254,
_CTYPE_CP775_255
},
{ _CTYPE_CP850_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP850_128_254,
_CTYPE_CP850_255
},
{ _CTYPE_CP852_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP852_128_254,
_CTYPE_CP852_255
},
{ _CTYPE_CP855_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP855_128_254,
_CTYPE_CP855_255
},
{ _CTYPE_CP857_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP857_128_254,
_CTYPE_CP857_255
},
{ _CTYPE_CP858_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP858_128_254,
_CTYPE_CP858_255
},
{ _CTYPE_CP862_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP862_128_254,
_CTYPE_CP862_255
},
{ _CTYPE_CP866_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP866_128_254,
_CTYPE_CP866_255
},
{ _CTYPE_CP874_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP874_128_254,
_CTYPE_CP874_255
},
{ _CTYPE_CP1125_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP1125_128_254,
_CTYPE_CP1125_255
},
{ _CTYPE_CP1250_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP1250_128_254,
_CTYPE_CP1250_255
},
{ _CTYPE_CP1251_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP1251_128_254,
_CTYPE_CP1251_255
},
{ _CTYPE_CP1252_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP1252_128_254,
_CTYPE_CP1252_255
},
{ _CTYPE_CP1253_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP1253_128_254,
_CTYPE_CP1253_255
},
{ _CTYPE_CP1254_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP1254_128_254,
_CTYPE_CP1254_255
},
{ _CTYPE_CP1255_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP1255_128_254,
_CTYPE_CP1255_255
},
{ _CTYPE_CP1256_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP1256_128_254,
_CTYPE_CP1256_255
},
{ _CTYPE_CP1257_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP1257_128_254,
_CTYPE_CP1257_255
},
{ _CTYPE_CP1258_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP1258_128_254,
_CTYPE_CP1258_255
},
{ _CTYPE_CP20866_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP20866_128_254,
_CTYPE_CP20866_255
},
{ _CTYPE_CP21866_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP21866_128_254,
_CTYPE_CP21866_255
},
{ _CTYPE_GEORGIAN_PS_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_GEORGIAN_PS_128_254,
_CTYPE_GEORGIAN_PS_255
},
{ _CTYPE_PT154_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_PT154_128_254,
_CTYPE_PT154_255
},
{ _CTYPE_CP103_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_CP103_128_254,
_CTYPE_CP103_255
},
};
#else /* !defined(ALLOW_NEGATIVE_CTYPE_INDEX) */
static const char __ctype_cp[27][1 + 256] = {
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP437_128_254,
_CTYPE_CP437_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP720_128_254,
_CTYPE_CP720_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP737_128_254,
_CTYPE_CP737_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP775_128_254,
_CTYPE_CP775_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP850_128_254,
_CTYPE_CP850_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP852_128_254,
_CTYPE_CP852_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP855_128_254,
_CTYPE_CP855_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP857_128_254,
_CTYPE_CP857_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP858_128_254,
_CTYPE_CP858_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP862_128_254,
_CTYPE_CP862_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP866_128_254,
_CTYPE_CP866_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP874_128_254,
_CTYPE_CP874_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP1125_128_254,
_CTYPE_CP1125_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP1250_128_254,
_CTYPE_CP1250_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP1251_128_254,
_CTYPE_CP1251_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP1252_128_254,
_CTYPE_CP1252_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP1253_128_254,
_CTYPE_CP1253_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP1254_128_254,
_CTYPE_CP1254_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP1255_128_254,
_CTYPE_CP1255_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP1256_128_254,
_CTYPE_CP1256_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP1257_128_254,
_CTYPE_CP1257_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP1258_128_254,
_CTYPE_CP1258_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP20866_128_254,
_CTYPE_CP20866_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP21866_128_254,
_CTYPE_CP21866_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_GEORGIAN_PS_128_254,
_CTYPE_GEORGIAN_PS_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_PT154_128_254,
_CTYPE_PT154_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_CP103_128_254,
_CTYPE_CP103_255
},
};
#endif /* ALLOW_NEGATIVE_CTYPE_INDEX */

View File

@@ -0,0 +1,455 @@
/* ctype table definitions for ISO-8859-x charsets.
Included by ctype_.c. */
#define _CTYPE_ISO_8859_1_128_254 \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_S|_B, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _P, \
_U, _U, _U, _U, _U, _U, _U, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _P, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_ISO_8859_1_255 _L
#define _CTYPE_ISO_8859_2_128_254 \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_S|_B, _U, _P, _U, _P, _U, _U, _P, \
_P, _U, _U, _U, _U, _P, _U, _U, \
_P, _L, _P, _L, _P, _L, _L, _P, \
_P, _L, _L, _L, _L, _P, _L, _L, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _P, \
_U, _U, _U, _U, _U, _U, _U, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _P, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_ISO_8859_2_255 _P
#define _CTYPE_ISO_8859_3_128_254 \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_S|_B, _U, _P, _P, _P, 0, _U, _P, \
_P, _U, _U, _U, _U, _P, 0, _U, \
_P, _L, _P, _P, _P, _P, _L, _P, \
_P, _L, _L, _L, _L, _P, 0, _L, \
_U, _U, _U, 0, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
0, _U, _U, _U, _U, _U, _U, _P, \
_U, _U, _U, _U, _U, _U, _U, _L, \
_L, _L, _L, 0, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
0, _L, _L, _L, _L, _L, _L, _P, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_ISO_8859_3_255 _P
#define _CTYPE_ISO_8859_4_128_254 \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_S|_B, _U, _L, _U, _P, _U, _U, _P, \
_P, _U, _U, _U, _U, _P, _U, _P, \
_P, _L, _P, _L, _P, _L, _L, _P, \
_P, _L, _L, _L, _L, _P, _L, _L, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _P, \
_U, _U, _U, _U, _U, _U, _U, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _P, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_ISO_8859_4_255 _L
#define _CTYPE_ISO_8859_5_128_254 \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_S|_B, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _P, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_P, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _P, _L
#define _CTYPE_ISO_8859_5_255 _L
#define _CTYPE_ISO_8859_6_128_254 \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_S|_B, 0, 0, 0, _P, 0, 0, 0, \
0, 0, 0, 0, _P, _P, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, _P, 0, 0, 0, _P, \
0, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, 0, 0, 0, 0, 0, \
_P, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _P, _P, _P, _P, _P, \
_P, _P, _P, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0
#define _CTYPE_ISO_8859_6_255 0
#define _CTYPE_ISO_8859_7_128_254 \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_S|_B, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, 0, _P, \
_P, _P, _P, _P, _P, _P, _U, _P, \
_U, _U, _U, _P, _U, _P, _U, _U, \
_L, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_ISO_8859_7_255 0
#define _CTYPE_ISO_8859_8_128_254 \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_S|_B, 0, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, _P, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, 0, 0, _P, _P
#define _CTYPE_ISO_8859_8_255 0
#define _CTYPE_ISO_8859_9_128_254 \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_S|_B, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _P, \
_U, _U, _U, _U, _U, _U, _U, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _P, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_ISO_8859_9_255 _L
#define _CTYPE_ISO_8859_10_128_254 \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_S|_B, _U, _U, _U, _U, _U, _U, _P, \
_U, _U, _U, _U, _U, _P, _U, _U, \
_P, _L, _L, _L, _L, _L, _L, _P, \
_L, _L, _L, _L, _L, _P, _L, _L, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_ISO_8859_10_255 _L
#define _CTYPE_ISO_8859_11_128_254 \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_S|_B, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _P, _U|_L, _U|_L, _P, _P, _P, _P, \
_P, _P, _P, 0, 0, 0, 0, _P, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _P, \
_P, _P, _P, _P, _P, _P, _P, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, _U|_L, \
_U|_L, _U|_L, _U|_L, _U|_L, 0, 0, 0
#define _CTYPE_ISO_8859_11_255 0
#define _CTYPE_ISO_8859_13_128_254 \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_S|_B, _P, _P, _P, _P, _P, _P, _P, \
_U, _P, _U, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _P, _P, _P, _P, \
_L, _P, _L, _P, _P, _P, _P, _P, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _P, \
_U, _U, _U, _U, _U, _U, _U, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _P, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_ISO_8859_13_255 _P
#define _CTYPE_ISO_8859_14_128_254 \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_S|_B, _U, _L, _P, _U, _L, _U, _P, \
_U, _P, _U, _L, _U, _P, _P, _U, \
_U, _L, _U, _L, _U, _L, _P, _U, \
_L, _L, _L, _U, _L, _U, _L, _L, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_ISO_8859_14_255 _L
#define _CTYPE_ISO_8859_15_128_254 \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_S|_B, _P, _P, _P, _P, _P, _U, _P, \
_L, _P, _P, _P, _P, _P, _P, _P, \
_P, _P, _P, _P, _U, _P, _P, _P, \
_L, _P, _P, _P, _U, _L, _U, _P, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _P, \
_U, _U, _U, _U, _U, _U, _U, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _P, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_ISO_8859_15_255 _L
#define _CTYPE_ISO_8859_16_128_254 \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_C, _C, _C, _C, _C, _C, _C, _C, \
_S|_B, _U, _L, _U, _P, _P, _U, _P, \
_L, _P, _U, _P, _U, _P, _L, _U, \
_P, _P, _U, _U, _U, _P, _P, _P, \
_L, _L, _L, _P, _U, _L, _U, _L, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _U, \
_U, _U, _U, _U, _U, _U, _U, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L, _L, \
_L, _L, _L, _L, _L, _L, _L
#define _CTYPE_ISO_8859_16_255 _L
extern int __iso_8859_index (const char *charset_ext);
#if defined(ALLOW_NEGATIVE_CTYPE_INDEX)
#ifndef __CYGWIN__
static const
#endif
char __ctype_iso[15][128 + 256] = {
{ _CTYPE_ISO_8859_1_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_1_128_254,
_CTYPE_ISO_8859_1_255
},
{ _CTYPE_ISO_8859_2_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_2_128_254,
_CTYPE_ISO_8859_2_255
},
{ _CTYPE_ISO_8859_3_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_3_128_254,
_CTYPE_ISO_8859_3_255
},
{ _CTYPE_ISO_8859_4_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_4_128_254,
_CTYPE_ISO_8859_4_255
},
{ _CTYPE_ISO_8859_5_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_5_128_254,
_CTYPE_ISO_8859_5_255
},
{ _CTYPE_ISO_8859_6_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_6_128_254,
_CTYPE_ISO_8859_6_255
},
{ _CTYPE_ISO_8859_7_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_7_128_254,
_CTYPE_ISO_8859_7_255
},
{ _CTYPE_ISO_8859_8_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_8_128_254,
_CTYPE_ISO_8859_8_255
},
{ _CTYPE_ISO_8859_9_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_9_128_254,
_CTYPE_ISO_8859_9_255
},
{ _CTYPE_ISO_8859_10_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_10_128_254,
_CTYPE_ISO_8859_10_255
},
{ _CTYPE_ISO_8859_11_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_11_128_254,
_CTYPE_ISO_8859_11_255
},
{ _CTYPE_ISO_8859_13_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_13_128_254,
_CTYPE_ISO_8859_13_255
},
{ _CTYPE_ISO_8859_14_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_14_128_254,
_CTYPE_ISO_8859_14_255
},
{ _CTYPE_ISO_8859_15_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_15_128_254,
_CTYPE_ISO_8859_15_255
},
{ _CTYPE_ISO_8859_16_128_254,
0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_16_128_254,
_CTYPE_ISO_8859_16_255
},
};
#else /* !defined(ALLOW_NEGATIVE_CTYPE_INDEX) */
static const char __ctype_iso[15][1 + 256] = {
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_1_128_254,
_CTYPE_ISO_8859_1_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_2_128_254,
_CTYPE_ISO_8859_2_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_3_128_254,
_CTYPE_ISO_8859_3_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_4_128_254,
_CTYPE_ISO_8859_4_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_5_128_254,
_CTYPE_ISO_8859_5_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_6_128_254,
_CTYPE_ISO_8859_6_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_7_128_254,
_CTYPE_ISO_8859_7_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_8_128_254,
_CTYPE_ISO_8859_8_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_9_128_254,
_CTYPE_ISO_8859_9_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_10_128_254,
_CTYPE_ISO_8859_10_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_11_128_254,
_CTYPE_ISO_8859_11_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_13_128_254,
_CTYPE_ISO_8859_13_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_14_128_254,
_CTYPE_ISO_8859_14_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_15_128_254,
_CTYPE_ISO_8859_15_255
},
{ 0,
_CTYPE_DATA_0_127,
_CTYPE_ISO_8859_16_128_254,
_CTYPE_ISO_8859_16_255
},
};
#endif /* ALLOW_NEGATIVE_CTYPE_INDEX */

View File

@@ -0,0 +1,50 @@
/*
FUNCTION
<<isalnum>>, <<isalnum_l>>---alphanumeric character predicate
INDEX
isalnum
INDEX
isalnum_l
SYNOPSIS
#include <ctype.h>
int isalnum(int <[c]>);
#include <ctype.h>
int isalnum_l(int <[c]>, locale_t <[locale]>);
DESCRIPTION
<<isalnum>> is a macro which classifies singlebyte charset values by table
lookup. It is a predicate returning non-zero for alphabetic or
numeric ASCII characters, and <<0>> for other arguments. It is defined
only if <[c]> is representable as an unsigned char or if <[c]> is EOF.
<<isalnum_l>> is like <<isalnum>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
You can use a compiled subroutine instead of the macro definition by
undefining the macro using `<<#undef isalnum>>' or `<<#undef isalnum_l>>'.
RETURNS
<<isalnum>>,<<isalnum_l>> return non-zero if <[c]> is a letter or a digit.
PORTABILITY
<<isalnum>> is ANSI C.
<<isalnum_l>> is POSIX-1.2008.
No OS subroutines are required.
*/
#include <_ansi.h>
#include <ctype.h>
#undef isalnum
int
isalnum (int c)
{
return(__CTYPE_PTR[c+1] & (_U|_L|_N));
}

View File

@@ -0,0 +1,10 @@
#include <_ansi.h>
#include <ctype.h>
#undef isalnum_l
int
isalnum_l (int c, struct __locale_t *locale)
{
return __locale_ctype_ptr_l (locale)[c+1] & (_U|_L|_N);
}

View File

@@ -0,0 +1,49 @@
/*
FUNCTION
<<isalpha>>, <<isalpha_l>>---alphabetic character predicate
INDEX
isalpha
INDEX
isalpha_l
SYNOPSIS
#include <ctype.h>
int isalpha(int <[c]>);
#include <ctype.h>
int isalpha_l(int <[c]>, locale_t <[locale]>);
DESCRIPTION
<<isalpha>> is a macro which classifies singlebyte charset values by table
lookup. It is a predicate returning non-zero when <[c]> represents an
alphabetic ASCII character, and 0 otherwise. It is defined only if
<[c]> is representable as an unsigned char or if <[c]> is EOF.
<<isalpha_l>> is like <<isalpha>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
You can use a compiled subroutine instead of the macro definition by
undefining the macro using `<<#undef isalpha>>' or `<<#undef isalpha_l>>'.
RETURNS
<<isalpha>>, <<isalpha_l>> return non-zero if <[c]> is a letter.
PORTABILITY
<<isalpha>> is ANSI C.
<<isalpha_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <ctype.h>
#undef isalpha
int
isalpha (int c)
{
return(__CTYPE_PTR[c+1] & (_U|_L));
}

View File

@@ -0,0 +1,10 @@
#include <_ansi.h>
#include <ctype.h>
#undef isalpha_l
int
isalpha_l (int c, struct __locale_t *locale)
{
return __locale_ctype_ptr_l (locale)[c+1] & (_U|_L);
}

View File

@@ -0,0 +1,50 @@
/*
FUNCTION
<<isascii>>, <<isascii_l>>---ASCII character predicate
INDEX
isascii
INDEX
isascii_l
SYNOPSIS
#include <ctype.h>
int isascii(int <[c]>);
#include <ctype.h>
int isascii_l(int <[c]>, locale_t <[locale]>);
DESCRIPTION
<<isascii>> is a macro which returns non-zero when <[c]> is an ASCII
character, and 0 otherwise. It is defined for all integer values.
<<isascii_l>> is like <<isascii>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
You can use a compiled subroutine instead of the macro definition by
undefining the macro using `<<#undef isascii>>' or `<<#undef isascii_l>>'.
RETURNS
<<isascii>>, <<isascii_l>> return non-zero if the low order byte of <[c]>
is in the range 0 to 127 (<<0x00>>--<<0x7F>>).
PORTABILITY
<<isascii>> is ANSI C.
<<isascii_l>> is a GNU extension.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <ctype.h>
#undef isascii
int
isascii (int c)
{
return c >= 0 && c< 128;
}

View File

@@ -0,0 +1,10 @@
#include <_ansi.h>
#include <ctype.h>
#undef isascii_l
int
isascii_l (int c, struct __locale_t *locale)
{
return c >= 0 && c < 128;
}

View File

@@ -0,0 +1,48 @@
/*
FUNCTION
<<isblank>>, <<isblank_l>>---blank character predicate
INDEX
isblank
INDEX
isblank_l
SYNOPSIS
#include <ctype.h>
int isblank(int <[c]>);
#include <ctype.h>
int isblank_l(int <[c]>, locale_t <[locale]>);
DESCRIPTION
<<isblank>> is a function which classifies singlebyte charset values by table
lookup. It is a predicate returning non-zero for blank characters, and 0
for other characters. It is defined only if <[c]> is representable as an
unsigned char or if <[c]> is EOF.
<<isblank_l>> is like <<isblank>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
RETURNS
<<isblank>>, <<isblank_l>> return non-zero if <[c]> is a blank character.
PORTABILITY
<<isblank>> is C99.
<<isblank_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <ctype.h>
#undef isblank
int
isblank (int c)
{
return ((__CTYPE_PTR[c+1] & _B) || (c == '\t'));
}

View File

@@ -0,0 +1,10 @@
#include <_ansi.h>
#include <ctype.h>
#undef isblank_l
int
isblank_l (int c, struct __locale_t *locale)
{
return (__locale_ctype_ptr_l (locale)[c+1] & _B) || (c == '\t');
}

View File

@@ -0,0 +1,52 @@
/*
FUNCTION
<<iscntrl>>, <<iscntrl_l>>---control character predicate
INDEX
iscntrl
INDEX
iscntrl_l
SYNOPSIS
#include <ctype.h>
int iscntrl(int <[c]>);
#include <ctype.h>
int iscntrl_l(int <[c]>, locale_t <[locale]>);
DESCRIPTION
<<iscntrl>> is a macro which classifies singlebyte charset values by table
lookup. It is a predicate returning non-zero for control characters, and 0
for other characters. It is defined only if <[c]> is representable as an
unsigned char or if <[c]> is EOF.
<<iscntrl_l>> is like <<iscntrl>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
You can use a compiled subroutine instead of the macro definition by
undefining the macro using `<<#undef iscntrl>>' or `<<#undef iscntrl_l>>'.
RETURNS
<<iscntrl>>, <<iscntrl_l>> return non-zero if <[c]> is a delete character
or ordinary control character.
PORTABILITY
<<iscntrl>> is ANSI C.
<<iscntrl_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <ctype.h>
#undef iscntrl
int
iscntrl (int c)
{
return(__CTYPE_PTR[c+1] & _C);
}

View File

@@ -0,0 +1,10 @@
#include <_ansi.h>
#include <ctype.h>
#undef iscntrl_l
int
iscntrl_l (int c, struct __locale_t *locale)
{
return __locale_ctype_ptr_l (locale)[c+1] & _C;
}

View File

@@ -0,0 +1,51 @@
/*
FUNCTION
<<isdigit>>, <<isdigit_l>>---decimal digit predicate
INDEX
isdigit
INDEX
isdigit_l
SYNOPSIS
#include <ctype.h>
int isdigit(int <[c]>);
#include <ctype.h>
int isdigit_l(int <[c]>, locale_t <[locale]>);
DESCRIPTION
<<isdigit>> is a macro which classifies singlebyte charset values by table
lookup. It is a predicate returning non-zero for decimal digits, and 0 for
other characters. It is defined only if <[c]> is representable as an
unsigned char or if <[c]> is EOF.
<<isdigit_l>> is like <<isdigit>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
You can use a compiled subroutine instead of the macro definition by
undefining the macro using `<<#undef isdigit>>' or `<<#undef isdigit_l>>'.
RETURNS
<<isdigit>>, <<isdigit_l>> return non-zero if <[c]> is a decimal digit
(<<0>>--<<9>>).
PORTABILITY
<<isdigit>> is ANSI C.
<<isdigit_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <ctype.h>
#undef isdigit
int
isdigit (int c)
{
return(__CTYPE_PTR[c+1] & _N);
}

View File

@@ -0,0 +1,10 @@
#include <_ansi.h>
#include <ctype.h>
#undef isdigit_l
int
isdigit_l (int c, struct __locale_t *locale)
{
return __locale_ctype_ptr_l (locale)[c+1] & _N;
}

View File

@@ -0,0 +1,49 @@
/*
FUNCTION
<<islower>>, <<islower_l>>---lowercase character predicate
INDEX
islower
INDEX
islower_l
SYNOPSIS
#include <ctype.h>
int islower(int <[c]>);
#include <ctype.h>
int islower_l(int <[c]>, locale_t <[locale]>);
DESCRIPTION
<<islower>> is a macro which classifies singlebyte charset values by table
lookup. It is a predicate returning non-zero for minuscules
(lowercase alphabetic characters), and 0 for other characters.
It is defined only if <[c]> is representable as an unsigned char or if
<[c]> is EOF.
<<islower_l>> is like <<islower>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
You can use a compiled subroutine instead of the macro definition by
undefining the macro using `<<#undef islower>>' or `<<#undef islower_l>>'.
RETURNS
<<islower>>, <<islower_l>> return non-zero if <[c]> is a lowercase letter.
PORTABILITY
<<islower>> is ANSI C.
<<islower_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <ctype.h>
#undef islower
int
islower (int c)
{
return ((__CTYPE_PTR[c+1] & (_U|_L)) == _L);
}

View File

@@ -0,0 +1,10 @@
#include <_ansi.h>
#include <ctype.h>
#undef islower_l
int
islower_l (int c, struct __locale_t *locale)
{
return (__locale_ctype_ptr_l (locale)[c+1] & (_U|_L)) == _L;
}

View File

@@ -0,0 +1,71 @@
/*
FUNCTION
<<isprint>>, <<isgraph>>, <<isprint_l>>, <<isgraph_l>>---printable character predicates
INDEX
isprint
INDEX
isgraph
INDEX
isprint_l
INDEX
isgraph_l
SYNOPSIS
#include <ctype.h>
int isprint(int <[c]>);
int isgraph(int <[c]>);
#include <ctype.h>
int isprint_l(int <[c]>, locale_t <[locale]>);
int isgraph_l(int <[c]>, locale_t <[locale]>);
DESCRIPTION
<<isprint>> is a macro which classifies singlebyte charset values by table
lookup. It is a predicate returning non-zero for printable characters,
and 0 for other character arguments. It is defined only if <[c]> is
representable as an unsigned char or if <[c]> is EOF.
<<isgraph>> behaves identically to <<isprint>>, except that space characters
are excluded.
<<isprint_l>>, <<isgraph_l>> are like <<isprint>>, <<isgraph>> but perform
the check based on the locale specified by the locale object locale. If
<[locale]> is LC_GLOBAL_LOCALE or not a valid locale object, the behaviour
is undefined.
You can use a compiled subroutine instead of the macro definition by
undefining either macro using `<<#undef isprint>>' or `<<#undef isgraph>>',
or `<<#undef isprint_l>>' or `<<#undef isgraph_l>>'.
RETURNS
<<isprint>>, <<isprint_l>> return non-zero if <[c]> is a printing character.
<<isgraph>>, <<isgraph_l>> return non-zero if <[c]> is a printing character
except spaces.
PORTABILITY
<<isprint>> and <<isgraph>> are ANSI C.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <ctype.h>
#undef isgraph
int
isgraph (int c)
{
return(__CTYPE_PTR[c+1] & (_P|_U|_L|_N));
}
#undef isprint
int
isprint (int c)
{
return(__CTYPE_PTR[c+1] & (_P|_U|_L|_N|_B));
}

View File

@@ -0,0 +1,18 @@
#include <_ansi.h>
#include <ctype.h>
#undef isgraph_l
int
isgraph_l (int c, struct __locale_t *locale)
{
return __locale_ctype_ptr_l (locale)[c+1] & (_P|_U|_L|_N);
}
#undef isprint_l
int
isprint_l (int c, struct __locale_t *locale)
{
return __locale_ctype_ptr_l (locale)[c+1] & (_P|_U|_L|_N|_B);
}

View File

@@ -0,0 +1,51 @@
/*
FUNCTION
<<ispunct>>, <<ispunct_l>>---punctuation character predicate
INDEX
ispunct
INDEX
ispunct_l
SYNOPSIS
#include <ctype.h>
int ispunct(int <[c]>);
#include <ctype.h>
int ispunct_l(int <[c]>, locale_t <[locale]>);
DESCRIPTION
<<ispunct>> is a macro which classifies singlebyte charset values by table
lookup. It is a predicate returning non-zero for printable
punctuation characters, and 0 for other characters. It is defined only
if <[c]> is representable as an unsigned char or if <[c]> is EOF.
<<ispunct_l>> is like <<ispunct>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
You can use a compiled subroutine instead of the macro definition by
undefining the macro using `<<#undef ispunct>>' or `<<#undef ispunct_l>>'.
RETURNS
<<ispunct>>, <<ispunct_l>> return non-zero if <[c]> is a printable
punctuation character.
PORTABILITY
<<ispunct>> is ANSI C.
<<ispunct_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <ctype.h>
#undef ispunct
int
ispunct (int c)
{
return(__CTYPE_PTR[c+1] & _P);
}

View File

@@ -0,0 +1,11 @@
#include <_ansi.h>
#include <ctype.h>
#undef ispunct_l
int
ispunct_l (int c, struct __locale_t *locale)
{
return __locale_ctype_ptr_l (locale)[c+1] & _P;
}

View File

@@ -0,0 +1,50 @@
/*
FUNCTION
<<isspace>>, <<isspace_l>>---whitespace character predicate
INDEX
isspace
INDEX
isspace_l
SYNOPSIS
#include <ctype.h>
int isspace(int <[c]>);
#include <ctype.h>
int isspace_l(int <[c]>, locale_t <[locale]>);
DESCRIPTION
<<isspace>> is a macro which classifies singlebyte charset values by table
lookup. It is a predicate returning non-zero for whitespace
characters, and 0 for other characters. It is defined only when <<isascii>>(<[c]>) is true or <[c]> is EOF.
<<isspace_l>> is like <<isspace>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
You can use a compiled subroutine instead of the macro definition by
undefining the macro using `<<#undef isspace>>' or `<<#undef isspace_l>>'.
RETURNS
<<isspace>>, <<isspace_l>> return non-zero if <[c]> is a space, tab,
carriage return, new line, vertical tab, or formfeed (<<0x09>>--<<0x0D>>,
<<0x20>>), or one of the other space characters in non-ASCII charsets.
PORTABILITY
<<isspace>> is ANSI C.
<<isspace_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <ctype.h>
#undef isspace
int
isspace (int c)
{
return(__CTYPE_PTR[c+1] & _S);
}

View File

@@ -0,0 +1,11 @@
#include <_ansi.h>
#include <ctype.h>
#undef isspace_l
int
isspace_l (int c, struct __locale_t *locale)
{
return __locale_ctype_ptr_l (locale)[c+1] & _S;
}

View File

@@ -0,0 +1,47 @@
/*
FUNCTION
<<isupper>>, <<isupper_l>>---uppercase character predicate
INDEX
isupper
INDEX
isupper_l
SYNOPSIS
#include <ctype.h>
int isupper(int <[c]>);
#include <ctype.h>
int isupper_l(int <[c]>, locale_t <[locale]>);
DESCRIPTION
<<isupper>> is a macro which classifies singlebyte charset values by table
lookup. It is a predicate returning non-zero for uppercase letters
(<<A>>--<<Z>>), and 0 for other characters.
<<isupper_l>> is like <<isupper>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
You can use a compiled subroutine instead of the macro definition by
undefining the macro using `<<#undef isupper>>' or `<<#undef isupper_l>>'.
RETURNS
<<isupper>>, <<isupper_l>> return non-zero if <[c]> is an uppercase letter.
PORTABILITY
<<isupper>> is ANSI C.
<<isupper_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <ctype.h>
#undef isupper
int
isupper (int c)
{
return ((__CTYPE_PTR[c+1] & (_U|_L)) == _U);
}

View File

@@ -0,0 +1,11 @@
#include <_ansi.h>
#include <ctype.h>
#undef isupper_l
int
isupper_l (int c, struct __locale_t *locale)
{
return (__locale_ctype_ptr_l (locale)[c+1] & (_U|_L)) == _U;
}

View File

@@ -0,0 +1,43 @@
/*
FUNCTION
<<iswalnum>>, <<iswalnum_l>>---alphanumeric wide character test
INDEX
iswalnum
INDEX
iswalnum_l
SYNOPSIS
#include <wctype.h>
int iswalnum(wint_t <[c]>);
#include <wctype.h>
int iswalnum_l(wint_t <[c]>, locale_t <[locale]>);
DESCRIPTION
<<iswalnum>> is a function which classifies wide-character values that
are alphanumeric.
<<iswalnum_l>> is like <<iswalnum>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
RETURNS
<<iswalnum>>, <<iswalnum_l>> return non-zero if <[c]> is a alphanumeric
wide character.
PORTABILITY
<<iswalnum>> is C99.
<<iswalnum_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <wctype.h>
int
iswalnum (wint_t c)
{
return iswalnum_l (c, 0);
}

View File

@@ -0,0 +1,23 @@
/* Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling */
#include <_ansi.h>
#include <ctype.h>
#include <wctype.h>
#include "local.h"
#include "categories.h"
int
iswalnum_l (wint_t c, struct __locale_t *locale)
{
#ifdef _MB_CAPABLE
//return iswalpha (c) || iswdigit (c);
c = _jp2uc_l (c, locale);
enum category cat = category (c);
return cat == CAT_LC || cat == CAT_Lu || cat == CAT_Ll || cat == CAT_Lt
|| cat == CAT_Lm || cat == CAT_Lo
|| cat == CAT_Nl // Letter_Number
|| cat == CAT_Nd // Decimal_Number
;
#else
return c < (wint_t)0x100 ? isalnum (c) : 0;
#endif /* _MB_CAPABLE */
}

View File

@@ -0,0 +1,73 @@
/* Copyright (c) 2002 Red Hat Incorporated.
All rights reserved.
Modified (m) 2017 Thomas Wolff to refer to generated Unicode data tables.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
The name of Red Hat Incorporated may not be used to endorse
or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
FUNCTION
<<iswalpha>>, <<iswalpha_l>>---alphabetic wide character test
INDEX
iswalpha
INDEX
iswalpha_l
SYNOPSIS
#include <wctype.h>
int iswalpha(wint_t <[c]>);
#include <wctype.h>
int iswalpha_l(wint_t <[c]>, locale_t <[locale]>);
DESCRIPTION
<<iswalpha>> is a function which classifies wide-character values that
are alphabetic.
<<iswalpha_l>> is like <<iswalpha>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
RETURNS
<<iswalpha>>, <<iswalpha_l>> return non-zero if <[c]> is an alphabetic
wide character.
PORTABILITY
<<iswalpha>> is C99.
<<iswalpha_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <wctype.h>
int
iswalpha (wint_t c)
{
return iswalpha_l (c, 0);
}

View File

@@ -0,0 +1,21 @@
/* Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling */
#include <_ansi.h>
#include <ctype.h>
#include <wctype.h>
#include "local.h"
#include "categories.h"
int
iswalpha_l (wint_t c, struct __locale_t *locale)
{
#ifdef _MB_CAPABLE
c = _jp2uc_l (c, locale);
enum category cat = category (c);
return cat == CAT_LC || cat == CAT_Lu || cat == CAT_Ll || cat == CAT_Lt
|| cat == CAT_Lm || cat == CAT_Lo
|| cat == CAT_Nl // Letter_Number
;
#else
return c < (wint_t)0x100 ? isalpha (c) : 0;
#endif /* _MB_CAPABLE */
}

View File

@@ -0,0 +1,72 @@
/* Copyright (c) 2002 Red Hat Incorporated.
All rights reserved.
Modified (m) 2017 Thomas Wolff to refer to generated Unicode data tables.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
The name of Red Hat Incorporated may not be used to endorse
or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
FUNCTION
<<iswblank>>, <<iswblank_l>>---blank wide character test
INDEX
iswblank
INDEX
iswblank_l
SYNOPSIS
#include <wctype.h>
int iswblank(wint_t <[c]>);
#include <wctype.h>
int iswblank_l(wint_t <[c]>, locale_t <[locale]>);
DESCRIPTION
<<iswblank>> is a function which classifies wide-character values that
are categorized as blank.
<<iswblank_l>> is like <<iswblank>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
RETURNS
<<iswblank>>, <<iswblank_l>> return non-zero if <[c]> is a blank wide character.
PORTABILITY
<<iswblank>> is C99.
<<iswblank_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <wctype.h>
int
iswblank (wint_t c)
{
return iswblank_l (c, 0);
}

View File

@@ -0,0 +1,20 @@
/* Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling */
#include <_ansi.h>
#include <ctype.h>
#include <wctype.h>
#include "local.h"
#include "categories.h"
int
iswblank_l (wint_t c, struct __locale_t *locale)
{
#ifdef _MB_CAPABLE
c = _jp2uc_l (c, locale);
enum category cat = category (c);
// exclude "<noBreak>"?
return cat == CAT_Zs
|| c == '\t';
#else
return c < 0x100 ? isblank (c) : 0;
#endif /* _MB_CAPABLE */
}

View File

@@ -0,0 +1,72 @@
/* Copyright (c) 2002 Red Hat Incorporated.
All rights reserved.
Modified (m) 2017 Thomas Wolff to refer to generated Unicode data tables.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
The name of Red Hat Incorporated may not be used to endorse
or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
FUNCTION
<<iswcntrl>>, <<iswcntrl_l>>---control wide character test
INDEX
iswcntrl
INDEX
iswcntrl_l
SYNOPSIS
#include <wctype.h>
int iswcntrl(wint_t <[c]>);
#include <wctype.h>
int iswcntrl_l(wint_t <[c]>, locale_t <[locale]>);
DESCRIPTION
<<iswcntrl>> is a function which classifies wide-character values that
are categorized as control characters.
<<iswcntrl_l>> is like <<iswcntrl>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
RETURNS
<<iswcntrl>>, <<iswcntrl_l>> return non-zero if <[c]> is a control wide character.
PORTABILITY
<<iswcntrl>> is C99.
<<iswcntrl_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <wctype.h>
int
iswcntrl (wint_t c)
{
return iswcntrl_l (c, 0);
}

View File

@@ -0,0 +1,20 @@
/* Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling */
#include <_ansi.h>
#include <ctype.h>
#include <wctype.h>
#include "local.h"
#include "categories.h"
int
iswcntrl_l (wint_t c, struct __locale_t *locale)
{
#ifdef _MB_CAPABLE
c = _jp2uc_l (c, locale);
enum category cat = category (c);
return cat == CAT_Cc
|| cat == CAT_Zl || cat == CAT_Zp // Line/Paragraph Separator
;
#else
return c < 0x100 ? iscntrl (c) : 0;
#endif /* _MB_CAPABLE */
}

View File

@@ -0,0 +1,75 @@
/*
FUNCTION
<<iswctype>>, <<iswctype_l>>---extensible wide-character test
INDEX
iswctype
INDEX
iswctype_l
SYNOPSIS
#include <wctype.h>
int iswctype(wint_t <[c]>, wctype_t <[desc]>);
#include <wctype.h>
int iswctype_l(wint_t <[c]>, wctype_t <[desc]>, locale_t <[locale]>);
DESCRIPTION
<<iswctype>> is a function which classifies wide-character values using the
wide-character test specified by <[desc]>.
<<iswctype_l>> is like <<iswctype>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
RETURNS
<<iswctype>>, <<iswctype_l>> return non-zero if and only if <[c]> matches
the test specified by <[desc]>. If <[desc]> is unknown, zero is returned.
PORTABILITY
<<iswctype>> is C99.
<<iswctype_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <wctype.h>
#include "local.h"
int
iswctype (wint_t c, wctype_t desc)
{
switch (desc)
{
case WC_ALNUM:
return iswalnum (c);
case WC_ALPHA:
return iswalpha (c);
case WC_BLANK:
return iswblank (c);
case WC_CNTRL:
return iswcntrl (c);
case WC_DIGIT:
return iswdigit (c);
case WC_GRAPH:
return iswgraph (c);
case WC_LOWER:
return iswlower (c);
case WC_PRINT:
return iswprint (c);
case WC_PUNCT:
return iswpunct (c);
case WC_SPACE:
return iswspace (c);
case WC_UPPER:
return iswupper (c);
case WC_XDIGIT:
return iswxdigit (c);
default:
return 0; /* eliminate warning */
}
/* otherwise unknown */
return 0;
}

View File

@@ -0,0 +1,41 @@
/* Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling */
#include <_ansi.h>
#include <wctype.h>
#include "local.h"
int
iswctype_l (wint_t c, wctype_t desc, struct __locale_t *locale)
{
switch (desc)
{
case WC_ALNUM:
return iswalnum_l (c, locale);
case WC_ALPHA:
return iswalpha_l (c, locale);
case WC_BLANK:
return iswblank_l (c, locale);
case WC_CNTRL:
return iswcntrl_l (c, locale);
case WC_DIGIT:
return iswdigit_l (c, locale);
case WC_GRAPH:
return iswgraph_l (c, locale);
case WC_LOWER:
return iswlower_l (c, locale);
case WC_PRINT:
return iswprint_l (c, locale);
case WC_PUNCT:
return iswpunct_l (c, locale);
case WC_SPACE:
return iswspace_l (c, locale);
case WC_UPPER:
return iswupper_l (c, locale);
case WC_XDIGIT:
return iswxdigit_l (c, locale);
default:
return 0; /* eliminate warning */
}
/* otherwise unknown */
return 0;
}

View File

@@ -0,0 +1,43 @@
/*
FUNCTION
<<iswdigit>>, <<iswdigit_l>>---decimal digit wide character test
INDEX
iswdigit
INDEX
iswdigit_l
SYNOPSIS
#include <wctype.h>
int iswdigit(wint_t <[c]>);
#include <wctype.h>
int iswdigit_l(wint_t <[c]>, locale_t <[locale]>);
DESCRIPTION
<<iswdigit>> is a function which classifies wide-character values that
are decimal digits.
<<iswdigit_l>> is like <<iswdigit>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
RETURNS
<<iswdigit>>, <<iswdigit_l>> return non-zero if <[c]> is a decimal digit wide character.
PORTABILITY
<<iswdigit>> is C99.
<<iswdigit_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <wctype.h>
int
iswdigit (wint_t c)
{
return c >= (wint_t)'0' && c <= (wint_t)'9';
// category (c) == CAT_Nd not to be included as of C-99
}

View File

@@ -0,0 +1,8 @@
#include <_ansi.h>
#include <wctype.h>
int
iswdigit_l (wint_t c, struct __locale_t *locale)
{
return c >= (wint_t)'0' && c <= (wint_t)'9';
}

View File

@@ -0,0 +1,72 @@
/* Copyright (c) 2002 Red Hat Incorporated.
All rights reserved.
Modified (m) 2017 Thomas Wolff to refer to generated Unicode data tables.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
The name of Red Hat Incorporated may not be used to endorse
or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
FUNCTION
<<iswgraph>>, <<iswgraph_l>>---graphic wide character test
INDEX
iswgraph
INDEX
iswgraph_l
SYNOPSIS
#include <wctype.h>
int iswgraph(wint_t <[c]>);
#include <wctype.h>
int iswgraph_l(wint_t <[c]>, locale_t <[locale]>);
DESCRIPTION
<<iswgraph>> is a function which classifies wide-character values that
are graphic.
<<iswgraph_l>> is like <<iswgraph>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
RETURNS
<<iswgraph>>, <<iswgraph_l>> return non-zero if <[c]> is a graphic wide character.
PORTABILITY
<<iswgraph>> is C99.
<<iswgraph_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <wctype.h>
int
iswgraph (wint_t c)
{
return iswgraph_l (c, 0);
}

View File

@@ -0,0 +1,23 @@
/* Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling */
#include <_ansi.h>
#include <wctype.h>
#include "local.h"
#include "categories.h"
int
iswgraph_l (wint_t c, struct __locale_t *locale)
{
#ifdef _MB_CAPABLE
//return iswprint (c, locale) && !iswspace (c, locale);
c = _jp2uc_l (c, locale);
enum category cat = category (c);
return cat != -1
&& cat != CAT_Cc && cat != CAT_Cf
&& cat != CAT_Cs // Surrogate
&& cat != CAT_Zs
&& cat != CAT_Zl && cat != CAT_Zp // Line/Paragraph Separator
;
#else
return iswprint_l (c, locale) && !iswspace_l (c, locale);
#endif /* _MB_CAPABLE */
}

View File

@@ -0,0 +1,42 @@
/*
FUNCTION
<<iswlower>>, <<iswlower_l>>---lowercase wide character test
INDEX
iswlower
INDEX
iswlower_l
SYNOPSIS
#include <wctype.h>
int iswlower(wint_t <[c]>);
#include <wctype.h>
int iswlower_l(wint_t <[c]>, locale_t <[locale]>);
DESCRIPTION
<<iswlower>> is a function which classifies wide-character values that
are categorized as lowercase.
<<iswlower_l>> is like <<iswlower>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
RETURNS
<<iswlower>>, <<iswlower_l>> return non-zero if <[c]> is a lowercase wide character.
PORTABILITY
<<iswlower>> is C99.
<<iswlower_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <wctype.h>
int
iswlower (wint_t c)
{
return iswlower_l (c, 0);
}

View File

@@ -0,0 +1,20 @@
/* Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling */
#include <_ansi.h>
#include <ctype.h>
#include <wctype.h>
#include "local.h"
#include "categories.h"
int
iswlower_l (wint_t c, struct __locale_t *locale)
{
#ifdef _MB_CAPABLE
c = _jp2uc_l (c, locale);
// The wide-character class "lower" contains at least those characters wc
// which are equal to towlower(wc) and different from towupper(wc).
enum category cat = category (c);
return cat == CAT_Ll || (cat == CAT_LC && towlower (c) == c);
#else
return c < 0x100 ? islower (c) : 0;
#endif /* _MB_CAPABLE */
}

View File

@@ -0,0 +1,72 @@
/* Copyright (c) 2002 Red Hat Incorporated.
All rights reserved.
Modified (m) 2017 Thomas Wolff to refer to generated Unicode data tables.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
The name of Red Hat Incorporated may not be used to endorse
or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
FUNCTION
<<iswprint>>, <<iswprint_l>>---printable wide character test
INDEX
iswprint
INDEX
iswprint_l
SYNOPSIS
#include <wctype.h>
int iswprint(wint_t <[c]>);
#include <wctype.h>
int iswprint_l(wint_t <[c]>, locale_t <[locale]>);
DESCRIPTION
<<iswprint>> is a function which classifies wide-character values that
are printable.
<<iswprint_l>> is like <<iswprint>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
RETURNS
<<iswprint>>, <<iswprint_l>> return non-zero if <[c]> is a printable wide character.
PORTABILITY
<<iswprint>> is C99.
<<iswprint_l>> is POSIX-1.2008.
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <wctype.h>
int
iswprint (wint_t c)
{
return iswprint_l (c, 0);
}

View File

@@ -0,0 +1,21 @@
/* Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling */
#include <_ansi.h>
#include <ctype.h>
#include <wctype.h>
#include "local.h"
#include "categories.h"
int
iswprint_l (wint_t c, struct __locale_t *locale)
{
#ifdef _MB_CAPABLE
c = _jp2uc_l (c, locale);
enum category cat = category (c);
return cat != -1
&& cat != CAT_Cc && cat != CAT_Cf
&& cat != CAT_Cs // Surrogate
;
#else
return c < (wint_t)0x100 ? isprint (c) : 0;
#endif /* _MB_CAPABLE */
}

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