mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-08 23:47:27 +00:00
Add 'src/ucd-tools/' from commit '3b8016e4f5f415175abb966000c1ebd6f15a4697'
git-subtree-dir: src/ucd-tools git-subtree-mainline:4d3bc36c47git-subtree-split:3b8016e4f5
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
.*.swp
|
||||
|
||||
# intermediate files:
|
||||
|
||||
.deps/
|
||||
.libs/
|
||||
.dirstamp
|
||||
|
||||
*.pyc
|
||||
*.o
|
||||
*.lo
|
||||
|
||||
# build output:
|
||||
|
||||
data/ucd
|
||||
|
||||
src/libucd.la
|
||||
tests/printucddata
|
||||
tests/printucddata_cpp
|
||||
|
||||
# test output:
|
||||
|
||||
tests/*.expected
|
||||
tests/*.actual
|
||||
tests/*.diff
|
||||
|
||||
# documentation output:
|
||||
|
||||
docs/html/
|
||||
|
||||
CHANGELOG.html
|
||||
README.html
|
||||
|
||||
# autotools output:
|
||||
|
||||
INSTALL
|
||||
NEWS
|
||||
README
|
||||
aclocal.m4
|
||||
autom4te.cache/
|
||||
compile
|
||||
config.guess
|
||||
config.h.in
|
||||
config.h
|
||||
config.log
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
depcomp
|
||||
install-sh
|
||||
libtool
|
||||
ltmain.sh
|
||||
m4/
|
||||
missing
|
||||
Makefile
|
||||
Makefile.in
|
||||
stamp-h1
|
||||
@@ -0,0 +1 @@
|
||||
Reece H. Dunn
|
||||
@@ -0,0 +1,47 @@
|
||||
# Change Log
|
||||
|
||||
## 9.0.0 - 2016-12-28
|
||||
|
||||
* Update to Unicode Character Data 9.0.0.
|
||||
|
||||
## 8.0.0.1 - 2016-05-31
|
||||
|
||||
* Provide a C API in addition to the C++ API.
|
||||
* Convert the implementation from C++ to C.
|
||||
|
||||
## 8.0.0 - 2015-06-06
|
||||
|
||||
* Update to Unicode Character Data 8.0.0.
|
||||
* Detect MacOSX `glibtoolize` in `autogen.sh`.
|
||||
* Use UCD `PropertyValueAliases` instead of the IANA subtag registry for the
|
||||
script label to ISO 15924 mapping.
|
||||
* Support enabling the CSUR data via the `--with-csur` configure flag.
|
||||
|
||||
## 7.0.0.1 - 2014-07-14
|
||||
|
||||
* Remove the ConScript Unicode Registry data from the Script and Category tables.
|
||||
* Fix mapping Script values to string.
|
||||
|
||||
## 7.0.0 - 2014-06-28
|
||||
|
||||
* Update to Unicode Character Data 7.0.0.
|
||||
* Updated the script list to support all ISO 15924 scripts.
|
||||
* Add a make target for building the documentation.
|
||||
|
||||
## 6.3.0 - 2013-10-16
|
||||
|
||||
* Update to Unicode Character Data 6.3.0.
|
||||
|
||||
## 6.2.0 - 2013-10-16
|
||||
|
||||
* Use Unicode Character Data 6.2.0.
|
||||
* General Category group and value lookup.
|
||||
* Script lookup.
|
||||
* `White_Space` property lookup provided by `isspace`.
|
||||
* Uses compact data tables for minimal overhead.
|
||||
* Support for Klingon \[F8D0-F8FF\] from the ConScript Unicode Registry.
|
||||
|
||||
wctype.h/wchar.h compatibility:
|
||||
|
||||
* ctype-style API.
|
||||
* case conversion API (including `totitle` to convert to title case).
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,37 @@
|
||||
COPYRIGHT AND PERMISSION NOTICE
|
||||
|
||||
Copyright © 1991-2014 Unicode, Inc. All rights reserved.
|
||||
Distributed under the Terms of Use in
|
||||
http://www.unicode.org/copyright.html.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Unicode data files and any associated documentation
|
||||
(the "Data Files") or Unicode software and any associated documentation
|
||||
(the "Software") to deal in the Data Files or Software
|
||||
without restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, and/or sell copies of
|
||||
the Data Files or Software, and to permit persons to whom the Data Files
|
||||
or Software are furnished to do so, provided that
|
||||
(a) this copyright and permission notice appear with all copies
|
||||
of the Data Files or Software,
|
||||
(b) this copyright and permission notice appear in associated
|
||||
documentation, and
|
||||
(c) there is clear notice in each modified Data File or in the Software
|
||||
as well as in the documentation associated with the Data File(s) or
|
||||
Software that the data or software has been modified.
|
||||
|
||||
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
|
||||
NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THE DATA FILES OR SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder
|
||||
shall not be used in advertising or otherwise to promote the sale,
|
||||
use or other dealings in these Data Files or Software without prior
|
||||
written authorization of the copyright holder.
|
||||
@@ -0,0 +1,151 @@
|
||||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
|
||||
localedir = $(datadir)/locale
|
||||
xdgdatadir = @XDGDATADIR@
|
||||
mimedir = $(xdgdatadir)/mime
|
||||
xmldir = $(mimedir)/packages
|
||||
|
||||
AM_LDFLAGS = ${LTLIBINTL}
|
||||
AM_CFLAGS = -Isrc/include -Isrc
|
||||
AM_CXXFLAGS = -Isrc/include -Isrc
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
bin_PROGRAMS =
|
||||
lib_LTLIBRARIES =
|
||||
man1_MANS =
|
||||
pkgdata_DATA =
|
||||
|
||||
noinst_bin_PROGRAMS =
|
||||
noinst_LIBRARIES =
|
||||
|
||||
noinst_bindir =
|
||||
|
||||
EXTRA_DIST = config.rpath ChangeLog
|
||||
CLEANFILES =
|
||||
SUBDIRS =
|
||||
|
||||
############################# libtool #########################################
|
||||
|
||||
EXTRA_DIST += config.guess config.sub ltmain.sh
|
||||
|
||||
# Increment if the interface has changed and is not backward compatible
|
||||
CURRENT=0
|
||||
|
||||
# Increment if source files have changed
|
||||
# Reset to 0 if the interface has changed
|
||||
REVISION=0
|
||||
|
||||
# Increment if the interface is backward compatible (superset)
|
||||
# Reset to 0 if the interface is not backward compatible
|
||||
AGE=0
|
||||
|
||||
LIBUCD_VERSION=$(CURRENT):$(REVISION):$(AGE)
|
||||
|
||||
############################# ChangeLog #######################################
|
||||
|
||||
ChangeLog:
|
||||
git log > ChangeLog
|
||||
|
||||
dist-hook: ChangeLog
|
||||
|
||||
.PHONY: ChangeLog
|
||||
|
||||
EXTRA_DIST += ChangeLog
|
||||
|
||||
############################# Unicode Character Database ######################
|
||||
|
||||
UCD_VERSION=@UCD_VERSION@
|
||||
UCD_ROOTDIR=data/ucd
|
||||
|
||||
data/ucd/PropList.txt:
|
||||
mkdir -pv data/ucd
|
||||
wget -O $@ http://www.unicode.org/Public/${UCD_VERSION}/ucd/PropList.txt
|
||||
|
||||
data/ucd/PropertyValueAliases.txt:
|
||||
mkdir -pv data/ucd
|
||||
wget -O $@ http://www.unicode.org/Public/${UCD_VERSION}/ucd/PropertyValueAliases.txt
|
||||
|
||||
data/ucd/Scripts.txt:
|
||||
mkdir -pv data/ucd
|
||||
wget -O $@ http://www.unicode.org/Public/${UCD_VERSION}/ucd/Scripts.txt
|
||||
|
||||
data/ucd/UnicodeData.txt:
|
||||
mkdir -pv data/ucd
|
||||
wget -O $@ http://www.unicode.org/Public/${UCD_VERSION}/ucd/UnicodeData.txt
|
||||
|
||||
############################# documentation ###################################
|
||||
|
||||
SUFFIXES=.html .md
|
||||
|
||||
.md.html: _layouts/webpage.html
|
||||
cat $< | sed -e 's/\.md)/.html)/g' | \
|
||||
kramdown --template _layouts/webpage.html > $@
|
||||
|
||||
html:
|
||||
doxygen docs/ucd-tools.conf
|
||||
|
||||
docs: html \
|
||||
CHANGELOG.html \
|
||||
README.html
|
||||
|
||||
############################# libucd ##########################################
|
||||
|
||||
tools/ucd.py: data/ucd/PropertyValueAliases.txt
|
||||
|
||||
tools/case.py: tools/ucd.py \
|
||||
data/ucd/UnicodeData.txt
|
||||
|
||||
tools/categories.py: tools/ucd.py \
|
||||
data/ucd/UnicodeData.txt
|
||||
|
||||
tools/scripts.py: tools/ucd.py \
|
||||
data/ucd/Scripts.txt
|
||||
|
||||
ucd-update: tools/case.py tools/categories.py tools/scripts.py
|
||||
tools/case.py ${UCD_ROOTDIR} ${UCD_VERSION} ${UCD_FLAGS} > src/case.c
|
||||
tools/categories.py ${UCD_ROOTDIR} ${UCD_VERSION} ${UCD_FLAGS} > src/categories.c
|
||||
tools/scripts.py ${UCD_ROOTDIR} ${UCD_VERSION} ${UCD_FLAGS} > src/scripts.c
|
||||
|
||||
libucd_includedir = $(includedir)/ucd
|
||||
libucd_include_HEADERS = \
|
||||
src/include/ucd/ucd.h
|
||||
|
||||
lib_LTLIBRARIES += src/libucd.la
|
||||
src_libucd_la_LDFLAGS = -version-info $(LIBUCD_VERSION)
|
||||
src_libucd_la_SOURCES = \
|
||||
src/case.c \
|
||||
src/categories.c \
|
||||
src/ctype.c \
|
||||
src/scripts.c \
|
||||
src/tostring.c
|
||||
|
||||
############################# tests ###########################################
|
||||
|
||||
noinst_bin_PROGRAMS += tests/printucddata
|
||||
tests_printucddata_SOURCES = tests/printucddata.c
|
||||
tests_printucddata_LDADD = src/libucd.la
|
||||
|
||||
noinst_bin_PROGRAMS += tests/printucddata_cpp
|
||||
tests_printucddata_cpp_SOURCES = tests/printucddata_cpp.cpp
|
||||
tests_printucddata_cpp_LDADD = src/libucd.la
|
||||
|
||||
tests/unicode-data.expected: tools/printdata.py tools/ucd.py \
|
||||
data/ucd/UnicodeData.txt \
|
||||
data/ucd/PropList.txt \
|
||||
data/ucd/Scripts.txt
|
||||
tools/printdata.py ${UCD_ROOTDIR} ${UCD_FLAGS} > $@
|
||||
|
||||
tests/unicode-data-capi.actual: tests/printucddata
|
||||
tests/printucddata > $@
|
||||
|
||||
tests/unicode-data-cppapi.actual: tests/printucddata_cpp
|
||||
tests/printucddata_cpp > $@
|
||||
|
||||
tests/unicode-data-capi.diff: tests/unicode-data.expected tests/unicode-data-capi.actual
|
||||
diff -U0 tests/unicode-data.expected tests/unicode-data-capi.actual > tests/unicode-data-capi.diff
|
||||
|
||||
tests/unicode-data-cppapi.diff: tests/unicode-data.expected tests/unicode-data-cppapi.actual
|
||||
diff -U0 tests/unicode-data.expected tests/unicode-data-cppapi.actual > tests/unicode-data-cppapi.diff
|
||||
|
||||
check: tests/unicode-data-capi.diff tests/unicode-data-cppapi.diff
|
||||
@@ -0,0 +1,195 @@
|
||||
# Unicode Character Database Tools
|
||||
|
||||
- [Data Files](#data-files)
|
||||
- [Unicode Character Database](#unicode-character-database)
|
||||
- [ConScript Unicode Registry](#conscript-unicode-registry)
|
||||
- [C Library](#c-library)
|
||||
- [Querying Properties](#querying-properties)
|
||||
- [Case Conversion](#case-conversion)
|
||||
- [wctype Compatibility](#wctype-compatibility)
|
||||
- [Build Dependencies](#build-dependencies)
|
||||
- [Debian](#debian)
|
||||
- [Building](#building)
|
||||
- [Updating the UCD Data](#updating-the-ucd-data)
|
||||
- [Bugs](#bugs)
|
||||
- [License Information](#license-information)
|
||||
|
||||
----------
|
||||
|
||||
The Unicode Character Database (UCD) Tools is a set of Python tools and a C
|
||||
library with a C++ API binding. The Python tools are designed to support
|
||||
extracting and processing data from the text-based UCD source files, while
|
||||
the C library is designed to provide easy access to this information within
|
||||
a C or C++ program.
|
||||
|
||||
## Data Files
|
||||
|
||||
The `ucd-tools` project provides support for UCD formatted data files from
|
||||
several different sources.
|
||||
|
||||
### Unicode Character Database
|
||||
|
||||
The following [Unicode Character Database](http://www.unicode.org/Public/9.0.0/ucd/)
|
||||
files are supported:
|
||||
|
||||
* Blocks
|
||||
* DerivedAge
|
||||
* PropList
|
||||
* PropertyValueAliases
|
||||
* Scripts
|
||||
* UnicodeData
|
||||
|
||||
### ConScript Unicode Registry
|
||||
|
||||
If enabled, the following data from the
|
||||
[ConScript Unicode Registry](http://www.evertype.com/standards/csur/) (CSUR) is
|
||||
added:
|
||||
|
||||
| Code Range | Script |
|
||||
|--------------|---------|
|
||||
| `F8D0-F8FF` | [Klingon](http://www.evertype.com/standards/csur/klingon.html) |
|
||||
|
||||
This data is located in the `data/csur` directory in a form compatible with the
|
||||
Unicode Character Data files.
|
||||
|
||||
## C Library
|
||||
|
||||
The C library provides several different facilities that make use of the UCD
|
||||
data. It provides a compact and efficient representation of the different data
|
||||
tables.
|
||||
|
||||
Detailed documentation is provided in the `src/include/ucd/ucd.h` file in the
|
||||
Doxygen documentation format.
|
||||
|
||||
### Querying Properties
|
||||
|
||||
The library exposes the following properties from the UCD data files:
|
||||
|
||||
| Property | Description |
|
||||
|--------------------|-------------|
|
||||
| `General_Category` | A [General Category Value](http://www.unicode.org/reports/tr44/#General_Category_Values), including the higher-level grouping. |
|
||||
| `Script` | An [ISO 15924](http://www.unicode.org/iso15924/iso15924-codes.html) script code. |
|
||||
|
||||
### Case Conversion
|
||||
|
||||
The following character conversion functions are provided:
|
||||
|
||||
| C API | C++ API | Description |
|
||||
|---------------|----------------|-------------|
|
||||
| `ucd_tolower` | `ucd::tolower` | convert letters to lower case |
|
||||
| `ucd_totitle` | `ucd::totitle` | convert letters to title case (UCD extension) |
|
||||
| `ucd_toupper` | `ucd::toupper` | convert letters to upper case |
|
||||
|
||||
__NOTE:__ These functions use the simple case mapping algorithm. That is, they
|
||||
only ever map to a single character. This is to provide a compatible signature
|
||||
to the standard C `wctype.h` APIs.
|
||||
|
||||
### wctype Compatibility
|
||||
|
||||
To facilitate working on platforms that don't have a useable wide-character
|
||||
ctypes library, or to provide a more consistent behaviour, the `ucd-tools`
|
||||
C library provides a set of APIs that are compatible with `wctype.h`.
|
||||
|
||||
The following character classification functions are provided:
|
||||
|
||||
| C API | C++ API |
|
||||
|---------------|----------------|
|
||||
| `ucd_isalnum` | `ucd::isalnum` |
|
||||
| `ucd_isalpha` | `ucd::isalpha` |
|
||||
| `ucd_iscntrl` | `ucd::iscntrl` |
|
||||
| `ucd_isdigit` | `ucd::isdigit` |
|
||||
| `ucd_isgraph` | `ucd::isgraph` |
|
||||
| `ucd_islower` | `ucd::islower` |
|
||||
| `ucd_isprint` | `ucd::isprint` |
|
||||
| `ucd_ispunct` | `ucd::ispunct` |
|
||||
| `ucd_isspace` | `ucd::isspace` |
|
||||
| `ucd_isupper` | `ucd::isupper` |
|
||||
|
||||
__NOTE:__ Equivalents for `isblank` and `isxdigit` are not provided.
|
||||
|
||||
## Build Dependencies
|
||||
|
||||
In order to build ucd-tools, you need:
|
||||
|
||||
1. a functional autotools system (`make`, `autoconf`, `automake` and `libtool`);
|
||||
2. a functional C and C++ compiler.
|
||||
|
||||
__NOTE__: The C++ compiler is used to build the test for the C++ API.
|
||||
|
||||
To build the documentation, you need:
|
||||
|
||||
1. the doxygen program to build the api documentation;
|
||||
2. the dot program from the graphviz library to generate graphs in the api documentation.
|
||||
|
||||
### Debian
|
||||
|
||||
Core Dependencies:
|
||||
|
||||
| Dependency | Install |
|
||||
|------------------|-------------------------------------------------------|
|
||||
| autotools | `sudo apt-get install make autoconf automake libtool` |
|
||||
| C++ compiler | `sudo apt-get install gcc g++` |
|
||||
|
||||
Documentation Dependencies:
|
||||
|
||||
| Dependency | Install |
|
||||
|------------|---------------------------------|
|
||||
| doxygen | `sudo apt-get install doxygen` |
|
||||
| graphviz | `sudo apt-get install graphviz` |
|
||||
|
||||
## Building
|
||||
|
||||
UCD Tools supports the standard GNU autotools build system. The source code
|
||||
does not contain the generated `configure` files, so to build it you need to
|
||||
run:
|
||||
|
||||
./autogen.sh
|
||||
./configure --prefix=/usr
|
||||
make
|
||||
|
||||
The tests can be run by using:
|
||||
|
||||
make check
|
||||
|
||||
The program can be installed using:
|
||||
|
||||
sudo make install
|
||||
|
||||
The documentation can be built using:
|
||||
|
||||
make html
|
||||
|
||||
## Updating the UCD Data
|
||||
|
||||
To re-generate the source files from the UCD data when a new version of
|
||||
unicode is released, you need to run:
|
||||
|
||||
./configure --prefix=/usr --with-unicode-version=VERSION
|
||||
make ucd-update
|
||||
|
||||
where `VERSION` is the Unicode version (e.g. `6.3.0`).
|
||||
|
||||
Additionally, you can use the `UCD_FLAGS` option to control how the data is
|
||||
generated. The following flags are supported:
|
||||
|
||||
| Flag | Description |
|
||||
|-------------|-------------|
|
||||
| --with-csur | Add ConScript Unicode Registry data. |
|
||||
|
||||
## Bugs
|
||||
|
||||
Report bugs to the [ucd-tools issues](https://github.com/rhdunn/ucd-tools/issues)
|
||||
page on GitHub.
|
||||
|
||||
## License Information
|
||||
|
||||
UCD Tools is released under the GPL version 3 or later license.
|
||||
|
||||
The UCD data files in `data/ucd` are downloaded from the UCD website and are
|
||||
licensed under the [Unicode Terms of Use](COPYING.UCD). These data files are
|
||||
used in their unmodified form. They have the following Copyright notice:
|
||||
|
||||
Copyright © 1991-2014 Unicode, Inc. All rights reserved.
|
||||
|
||||
The files in `data/csur` are based on the information from the ConScript
|
||||
Unicode Registry maintained by John Cowan and Michael Everson.
|
||||
@@ -0,0 +1,54 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width; initial-scale=1"/>
|
||||
<meta name="robots" content="all"/>
|
||||
<style type="text/css">
|
||||
body
|
||||
{
|
||||
font-family: sans-serif;
|
||||
font-size: 14px;
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
*:first-child
|
||||
{
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
code, pre
|
||||
{
|
||||
font-family: monospace;
|
||||
background: #F7F7F7;
|
||||
color: navy;
|
||||
}
|
||||
|
||||
code
|
||||
{
|
||||
font-size: 85%;
|
||||
padding: 0.2em;
|
||||
}
|
||||
|
||||
pre
|
||||
{
|
||||
margin-left: 3em;
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
th
|
||||
{
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
hr
|
||||
{
|
||||
border: 0;
|
||||
border-bottom: 1px solid #BBB;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<%= @body %>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
LIBTOOLIZE=`which libtoolize`
|
||||
if ! test -f "$LIBTOOLIZE" ; then
|
||||
# Mac OSX support ...
|
||||
LIBTOOLIZE=`which glibtoolize`
|
||||
fi
|
||||
|
||||
mkdir -p m4
|
||||
ln -sf README.md README
|
||||
ln -sf CHANGELOG.md NEWS
|
||||
|
||||
aclocal -I m4 || exit 1
|
||||
|
||||
${LIBTOOLIZE} || exit 1
|
||||
autoheader || exit 1
|
||||
automake --add-missing || exit 1
|
||||
autoconf || exit 1
|
||||
@@ -0,0 +1,63 @@
|
||||
AC_PREREQ([2.65])
|
||||
AC_INIT([Unicode Character Database Tools], [9.0.0], [https://github.com/rhdunn/ucd-tools/issues], [ucd-tools], [https://github.com/rhdunn/ucd-tools])
|
||||
AM_INIT_AUTOMAKE()
|
||||
|
||||
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES])
|
||||
AM_SILENT_RULES([yes])
|
||||
|
||||
AC_CONFIG_SRCDIR([src])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
LT_INIT
|
||||
|
||||
dnl ================================================================
|
||||
dnl Program checks.
|
||||
dnl ================================================================
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
dnl ================================================================
|
||||
dnl library checks.
|
||||
dnl ================================================================
|
||||
|
||||
AC_CHECK_HEADERS([stddef.h]) dnl C89
|
||||
|
||||
AC_TYPE_UINT8_T
|
||||
AC_TYPE_UINT32_T
|
||||
|
||||
dnl ================================================================
|
||||
dnl UCD data configuration.
|
||||
dnl ================================================================
|
||||
|
||||
AC_ARG_WITH([unicode-version],
|
||||
[AS_HELP_STRING([--with-unicode-version], [Unicode version to support @<:@default=9.0.0@:>@])],
|
||||
[AS_IF([test x"$withval" != x],
|
||||
[UCD_VERSION="$withval"])],
|
||||
[UCD_VERSION="9.0.0"])
|
||||
|
||||
AC_SUBST(UCD_VERSION)
|
||||
|
||||
dnl ================================================================
|
||||
dnl Generate output.
|
||||
dnl ================================================================
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
AC_MSG_NOTICE([
|
||||
|
||||
Configuration for Unicode Character Data Tools complete.
|
||||
|
||||
Source code location: ${srcdir}
|
||||
|
||||
C Compiler: ${CC}
|
||||
C Compiler flags: ${CFLAGS}
|
||||
|
||||
C++ Compiler: ${CXX}
|
||||
C++ Compiler flags: ${CXXFLAGS}
|
||||
|
||||
Unicode version: ${UCD_VERSION}
|
||||
])
|
||||
@@ -0,0 +1,52 @@
|
||||
# Code Point ; Script ; General Category ; Name ; Okrand Transliteration
|
||||
#
|
||||
# ConScript Unicode Registry
|
||||
# Registered: 1996-05-09
|
||||
# Updated: 2004-01-15
|
||||
#
|
||||
# Based on the original encoding by H. Peter Anvin
|
||||
# Copyright (C) 2006 Michael Everson
|
||||
# Copyright (C) 2012-2014 Reece H. Dunn
|
||||
#
|
||||
# Reference: Documentation/unicode.txt [Linux Kernel sources]
|
||||
# Reference: http://www.evertype.com/standards/csur/klingon.html
|
||||
|
||||
F8D0;Qaak;Lo;KLINGON LETTER A;a
|
||||
F8D1;Qaak;Lo;KLINGON LETTER B;a
|
||||
F8D2;Qaak;Lo;KLINGON LETTER CH;ch
|
||||
F8D3;Qaak;Lo;KLINGON LETTER D;D
|
||||
F8D4;Qaak;Lo;KLINGON LETTER E;e
|
||||
F8D5;Qaak;Lo;KLINGON LETTER GH;gh
|
||||
F8D6;Qaak;Lo;KLINGON LETTER H;H
|
||||
F8D7;Qaak;Lo;KLINGON LETTER I;I
|
||||
F8D8;Qaak;Lo;KLINGON LETTER J;j
|
||||
F8D9;Qaak;Lo;KLINGON LETTER L;l
|
||||
F8DA;Qaak;Lo;KLINGON LETTER M;m
|
||||
F8DB;Qaak;Lo;KLINGON LETTER N;n
|
||||
F8DC;Qaak;Lo;KLINGON LETTER NG;ng
|
||||
F8DD;Qaak;Lo;KLINGON LETTER O;o
|
||||
F8DE;Qaak;Lo;KLINGON LETTER P;p
|
||||
F8DF;Qaak;Lo;KLINGON LETTER Q;q
|
||||
F8E0;Qaak;Lo;KLINGON LETTER QH;Q
|
||||
F8E1;Qaak;Lo;KLINGON LETTER R;r
|
||||
F8E2;Qaak;Lo;KLINGON LETTER S;S
|
||||
F8E3;Qaak;Lo;KLINGON LETTER T;t
|
||||
F8E4;Qaak;Lo;KLINGON LETTER TLH;tlh
|
||||
F8E5;Qaak;Lo;KLINGON LETTER U;u
|
||||
F8E6;Qaak;Lo;KLINGON LETTER V;v
|
||||
F8E7;Qaak;Lo;KLINGON LETTER W;w
|
||||
F8E8;Qaak;Lo;KLINGON LETTER Y;y
|
||||
F8E9;Qaak;Lo;KLINGON LETTER GLOTTAL STOP;'
|
||||
F8F0;Qaak;Nd;KLINGON DIGIT ZERO;0
|
||||
F8F1;Qaak;Nd;KLINGON DIGIT ONE;1
|
||||
F8F2;Qaak;Nd;KLINGON DIGIT TWO;2
|
||||
F8F3;Qaak;Nd;KLINGON DIGIT THREE;3
|
||||
F8F4;Qaak;Nd;KLINGON DIGIT FOUR;4
|
||||
F8F5;Qaak;Nd;KLINGON DIGIT FIVE;5
|
||||
F8F6;Qaak;Nd;KLINGON DIGIT SIX;6
|
||||
F8F7;Qaak;Nd;KLINGON DIGIT SEVEN;7
|
||||
F8F8;Qaak;Nd;KLINGON DIGIT EIGHT;8
|
||||
F8F9;Qaak;Nd;KLINGON DIGIT NINE;9
|
||||
F8FD;Zinh;Po;KLINGON COMMA;,
|
||||
F8FE;Zinh;Po;KLINGON FULL STOP;.
|
||||
F8FF;Zinh;So;KLINGON MUMMIFICATION GLYPH;
|
||||
@@ -0,0 +1,234 @@
|
||||
# Doxyfile 1.8.4
|
||||
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = "UCD Tools"
|
||||
PROJECT_NUMBER =
|
||||
PROJECT_BRIEF = "Unicode Character Data tools"
|
||||
PROJECT_LOGO =
|
||||
OUTPUT_DIRECTORY = docs
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF =
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = NO
|
||||
QT_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 4
|
||||
ALIASES =
|
||||
TCL_SUBST =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
OPTIMIZE_FOR_FORTRAN = NO
|
||||
OPTIMIZE_OUTPUT_VHDL = NO
|
||||
EXTENSION_MAPPING =
|
||||
MARKDOWN_SUPPORT = YES
|
||||
AUTOLINK_SUPPORT = YES
|
||||
BUILTIN_STL_SUPPORT = YES
|
||||
CPP_CLI_SUPPORT = NO
|
||||
SIP_SUPPORT = NO
|
||||
IDL_PROPERTY_SUPPORT = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
INLINE_GROUPED_CLASSES = NO
|
||||
INLINE_SIMPLE_STRUCTS = NO
|
||||
TYPEDEF_HIDES_STRUCT = NO
|
||||
LOOKUP_CACHE_SIZE = 0
|
||||
|
||||
# Build related configuration options
|
||||
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_PACKAGE = NO
|
||||
EXTRACT_STATIC = NO
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = YES
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
FORCE_LOCAL_INCLUDES = NO
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_MEMBERS_CTORS_1ST = NO
|
||||
SORT_GROUP_NAMES = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
STRICT_PROTO_MATCHING = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = NO
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_FILES = YES
|
||||
SHOW_NAMESPACES = YES
|
||||
FILE_VERSION_FILTER =
|
||||
LAYOUT_FILE =
|
||||
CITE_BIB_FILES =
|
||||
|
||||
# Configuration options related to warning and progress messages
|
||||
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = YES
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
|
||||
# Configuration options related to the input files
|
||||
|
||||
INPUT = src/include
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS =
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXCLUDE_SYMBOLS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
FILTER_SOURCE_PATTERNS =
|
||||
USE_MDFILE_AS_MAINPAGE =
|
||||
|
||||
# Configuration options related to source browsing
|
||||
|
||||
SOURCE_BROWSER = NO
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = NO
|
||||
REFERENCES_RELATION = NO
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
SOURCE_TOOLTIPS = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = NO
|
||||
|
||||
# Configuration options related to the alphabetical class index
|
||||
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
|
||||
# Configuration options related to the HTML output
|
||||
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
HTML_EXTRA_FILES =
|
||||
HTML_COLORSTYLE_HUE = 220
|
||||
HTML_COLORSTYLE_SAT = 100
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
HTML_TIMESTAMP = YES
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
HTML_INDEX_NUM_ENTRIES = 100
|
||||
GENERATE_DOCSET = NO
|
||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||
DOCSET_BUNDLE_ID = uk.co.reecedunn.UcdTools
|
||||
DOCSET_PUBLISHER_ID = uk.co.reecedunn.CainteoirTechnologies
|
||||
DOCSET_PUBLISHER_NAME = "Cainteoir Technologies"
|
||||
GENERATE_HTMLHELP = NO
|
||||
GENERATE_QHP = NO
|
||||
GENERATE_ECLIPSEHELP = NO
|
||||
DISABLE_INDEX = NO
|
||||
GENERATE_TREEVIEW = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
TREEVIEW_WIDTH = 250
|
||||
EXT_LINKS_IN_WINDOW = NO
|
||||
FORMULA_FONTSIZE = 10
|
||||
FORMULA_TRANSPARENT = YES
|
||||
USE_MATHJAX = NO
|
||||
SEARCHENGINE = NO
|
||||
|
||||
# Configuration options related to other output formats.
|
||||
|
||||
GENERATE_LATEX = NO
|
||||
GENERATE_RTF = NO
|
||||
GENERATE_XML = NO
|
||||
GENERATE_DOCBOOK = NO
|
||||
GENERATE_MAN = NO
|
||||
|
||||
# Configuration options for the AutoGen Definitions output
|
||||
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
|
||||
# Configuration options related to the Perl module output
|
||||
|
||||
GENERATE_PERLMOD = NO
|
||||
|
||||
# Configuration options related to the preprocessor
|
||||
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
|
||||
# Configuration options related to external references
|
||||
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
EXTERNAL_PAGES = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
|
||||
# Configuration options related to the dot tool
|
||||
|
||||
CLASS_DIAGRAMS = YES
|
||||
MSCGEN_PATH =
|
||||
HIDE_UNDOC_RELATIONS = NO
|
||||
HAVE_DOT = YES
|
||||
DOT_NUM_THREADS = 0
|
||||
DOT_FONTNAME = Helvetica
|
||||
DOT_FONTSIZE = 10
|
||||
DOT_FONTPATH =
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
INTERACTIVE_SVG = NO
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MSCFILE_DIRS =
|
||||
DOT_GRAPH_MAX_NODES = 50
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,158 @@
|
||||
/* ctype-style APIs.
|
||||
*
|
||||
* Copyright (C) 2012-2016 Reece H. Dunn
|
||||
*
|
||||
* This file is part of ucd-tools.
|
||||
*
|
||||
* ucd-tools is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ucd-tools is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ucd/ucd.h"
|
||||
|
||||
int ucd_isalnum(codepoint_t c)
|
||||
{
|
||||
switch (ucd_lookup_category(c))
|
||||
{
|
||||
case UCD_CATEGORY_Ll:
|
||||
case UCD_CATEGORY_Lm:
|
||||
case UCD_CATEGORY_Lo:
|
||||
case UCD_CATEGORY_Lt:
|
||||
case UCD_CATEGORY_Lu:
|
||||
case UCD_CATEGORY_Nd:
|
||||
case UCD_CATEGORY_Nl:
|
||||
case UCD_CATEGORY_No:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int ucd_isalpha(codepoint_t c)
|
||||
{
|
||||
switch (ucd_lookup_category(c))
|
||||
{
|
||||
case UCD_CATEGORY_Ll:
|
||||
case UCD_CATEGORY_Lm:
|
||||
case UCD_CATEGORY_Lo:
|
||||
case UCD_CATEGORY_Lt:
|
||||
case UCD_CATEGORY_Lu:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int ucd_iscntrl(codepoint_t c)
|
||||
{
|
||||
return ucd_lookup_category(c) == UCD_CATEGORY_Cc;
|
||||
}
|
||||
|
||||
int ucd_isdigit(codepoint_t c)
|
||||
{
|
||||
switch (ucd_lookup_category(c))
|
||||
{
|
||||
case UCD_CATEGORY_Nd:
|
||||
case UCD_CATEGORY_Nl:
|
||||
case UCD_CATEGORY_No:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int ucd_isgraph(codepoint_t c)
|
||||
{
|
||||
switch (ucd_lookup_category(c))
|
||||
{
|
||||
case UCD_CATEGORY_Cc:
|
||||
case UCD_CATEGORY_Cf:
|
||||
case UCD_CATEGORY_Cn:
|
||||
case UCD_CATEGORY_Co:
|
||||
case UCD_CATEGORY_Cs:
|
||||
case UCD_CATEGORY_Zl:
|
||||
case UCD_CATEGORY_Zp:
|
||||
case UCD_CATEGORY_Zs:
|
||||
case UCD_CATEGORY_Ii:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int ucd_islower(codepoint_t c)
|
||||
{
|
||||
return ucd_lookup_category(c) == UCD_CATEGORY_Ll;
|
||||
}
|
||||
|
||||
int ucd_isprint(codepoint_t c)
|
||||
{
|
||||
switch (ucd_lookup_category(c))
|
||||
{
|
||||
case UCD_CATEGORY_Cc:
|
||||
case UCD_CATEGORY_Cf:
|
||||
case UCD_CATEGORY_Cn:
|
||||
case UCD_CATEGORY_Co:
|
||||
case UCD_CATEGORY_Cs:
|
||||
case UCD_CATEGORY_Ii:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int ucd_ispunct(codepoint_t c)
|
||||
{
|
||||
switch (ucd_lookup_category(c))
|
||||
{
|
||||
case UCD_CATEGORY_Pc:
|
||||
case UCD_CATEGORY_Pd:
|
||||
case UCD_CATEGORY_Pe:
|
||||
case UCD_CATEGORY_Pf:
|
||||
case UCD_CATEGORY_Pi:
|
||||
case UCD_CATEGORY_Po:
|
||||
case UCD_CATEGORY_Ps:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int ucd_isspace(codepoint_t c)
|
||||
{
|
||||
switch (ucd_lookup_category(c))
|
||||
{
|
||||
case UCD_CATEGORY_Zl:
|
||||
case UCD_CATEGORY_Zp:
|
||||
case UCD_CATEGORY_Zs:
|
||||
return 1;
|
||||
case UCD_CATEGORY_Cc:
|
||||
switch (c) // Some control characters are also whitespace characters:
|
||||
{
|
||||
case 0x09: // U+0009 : CHARACTER TABULATION
|
||||
case 0x0A: // U+000A : LINE FEED
|
||||
case 0x0B: // U+000B : LINE TABULATION
|
||||
case 0x0C: // U+000C : FORM FEED
|
||||
case 0x0D: // U+000D : CARRIAGE RETURN
|
||||
case 0x85: // U+0085 : NEXT LINE
|
||||
return 1;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int ucd_isupper(codepoint_t c)
|
||||
{
|
||||
return ucd_lookup_category(c) == UCD_CATEGORY_Lu;
|
||||
}
|
||||
@@ -0,0 +1,906 @@
|
||||
/* Unicode Character Database API
|
||||
*
|
||||
* Copyright (C) 2012-2016 Reece H. Dunn
|
||||
*
|
||||
* This file is part of ucd-tools.
|
||||
*
|
||||
* ucd-tools is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ucd-tools is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef UNICODE_CHARACTER_DATA_H
|
||||
#define UNICODE_CHARACTER_DATA_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/** @brief Represents a Unicode codepoint.
|
||||
*/
|
||||
typedef uint32_t codepoint_t;
|
||||
|
||||
/** @brief Unicode General Category Groups
|
||||
* @see http://www.unicode.org/reports/tr44/
|
||||
*/
|
||||
typedef enum ucd_category_group_
|
||||
{
|
||||
UCD_CATEGORY_GROUP_C, /**< @brief Other */
|
||||
UCD_CATEGORY_GROUP_I, /**< @brief Invalid */
|
||||
UCD_CATEGORY_GROUP_L, /**< @brief Letter */
|
||||
UCD_CATEGORY_GROUP_M, /**< @brief Mark */
|
||||
UCD_CATEGORY_GROUP_N, /**< @brief Number */
|
||||
UCD_CATEGORY_GROUP_P, /**< @brief Punctuation */
|
||||
UCD_CATEGORY_GROUP_S, /**< @brief Symbol */
|
||||
UCD_CATEGORY_GROUP_Z, /**< @brief Separator */
|
||||
} ucd_category_group;
|
||||
|
||||
/** @brief Get a string representation of the category_group enumeration value.
|
||||
*
|
||||
* @param c The value to get the string representation for.
|
||||
*
|
||||
* @return The string representation, or "-" if the value is not recognized.
|
||||
*/
|
||||
const char *ucd_get_category_group_string(ucd_category_group c);
|
||||
|
||||
/** @brief Unicode General Category Values
|
||||
* @see http://www.unicode.org/reports/tr44/
|
||||
*/
|
||||
typedef enum ucd_category_
|
||||
{
|
||||
UCD_CATEGORY_Cc, /**< @brief Control Character */
|
||||
UCD_CATEGORY_Cf, /**< @brief Format Control Character */
|
||||
UCD_CATEGORY_Cn, /**< @brief Unassigned */
|
||||
UCD_CATEGORY_Co, /**< @brief Private Use */
|
||||
UCD_CATEGORY_Cs, /**< @brief Surrogate Code Point */
|
||||
|
||||
UCD_CATEGORY_Ii, /**< @brief Invalid Unicode Codepoint */
|
||||
|
||||
UCD_CATEGORY_Ll, /**< @brief Lower Case Letter */
|
||||
UCD_CATEGORY_Lm, /**< @brief Letter Modifier */
|
||||
UCD_CATEGORY_Lo, /**< @brief Other Letter */
|
||||
UCD_CATEGORY_Lt, /**< @brief Title Case Letter */
|
||||
UCD_CATEGORY_Lu, /**< @brief Upper Case Letter */
|
||||
|
||||
UCD_CATEGORY_Mc, /**< @brief Spacing Mark */
|
||||
UCD_CATEGORY_Me, /**< @brief Enclosing Mark */
|
||||
UCD_CATEGORY_Mn, /**< @brief Non-Spacing Mark */
|
||||
|
||||
UCD_CATEGORY_Nd, /**< @brief Decimal Digit */
|
||||
UCD_CATEGORY_Nl, /**< @brief Letter-Like Number */
|
||||
UCD_CATEGORY_No, /**< @brief Other Number */
|
||||
|
||||
UCD_CATEGORY_Pc, /**< @brief Connector */
|
||||
UCD_CATEGORY_Pd, /**< @brief Dash/Hyphen */
|
||||
UCD_CATEGORY_Pe, /**< @brief Close Punctuation Mark */
|
||||
UCD_CATEGORY_Pf, /**< @brief Final Quotation Mark */
|
||||
UCD_CATEGORY_Pi, /**< @brief Initial Quotation Mark */
|
||||
UCD_CATEGORY_Po, /**< @brief Other */
|
||||
UCD_CATEGORY_Ps, /**< @brief Open Punctuation Mark */
|
||||
|
||||
UCD_CATEGORY_Sc, /**< @brief Currency Symbol */
|
||||
UCD_CATEGORY_Sk, /**< @brief Modifier Symbol */
|
||||
UCD_CATEGORY_Sm, /**< @brief Math Symbol */
|
||||
UCD_CATEGORY_So, /**< @brief Other Symbol */
|
||||
|
||||
UCD_CATEGORY_Zl, /**< @brief Line Separator */
|
||||
UCD_CATEGORY_Zp, /**< @brief Paragraph Separator */
|
||||
UCD_CATEGORY_Zs, /**< @brief Space Separator */
|
||||
} ucd_category;
|
||||
|
||||
/** @brief Get a string representation of the category enumeration value.
|
||||
*
|
||||
* @param c The value to get the string representation for.
|
||||
*
|
||||
* @return The string representation, or "--" if the value is not recognized.
|
||||
*/
|
||||
const char *ucd_get_category_string(ucd_category c);
|
||||
|
||||
/** @brief Lookup the General Category Group for a General Category.
|
||||
*
|
||||
* @param c The General Category to lookup.
|
||||
* @return The General Category Group of the General Category.
|
||||
*/
|
||||
ucd_category_group ucd_get_category_group_for_category(ucd_category c);
|
||||
|
||||
/** @brief Lookup the General Category Group for a Unicode codepoint.
|
||||
*
|
||||
* @param c The Unicode codepoint to lookup.
|
||||
* @return The General Category Group of the Unicode codepoint.
|
||||
*/
|
||||
ucd_category_group ucd_lookup_category_group(codepoint_t c);
|
||||
|
||||
/** @brief Lookup the General Category for a Unicode codepoint.
|
||||
*
|
||||
* @param c The Unicode codepoint to lookup.
|
||||
* @return The General Category of the Unicode codepoint.
|
||||
*/
|
||||
ucd_category ucd_lookup_category(codepoint_t c);
|
||||
|
||||
/** @brief Unicode Script
|
||||
* @see http://www.iana.org/assignments/language-subtag-registry
|
||||
* @see http://www.unicode.org/iso15924/iso15924-codes.html
|
||||
*/
|
||||
typedef enum ucd_script_
|
||||
{
|
||||
UCD_SCRIPT_Adlm, /**< @brief Adlam Script */
|
||||
UCD_SCRIPT_Afak, /**< @brief Afaka Script */
|
||||
UCD_SCRIPT_Aghb, /**< @brief Caucasian Albanian Script */
|
||||
UCD_SCRIPT_Ahom, /**< @brief Tai Ahom Script */
|
||||
UCD_SCRIPT_Arab, /**< @brief Arabic Script */
|
||||
UCD_SCRIPT_Armi, /**< @brief Imperial Aramaic Script */
|
||||
UCD_SCRIPT_Armn, /**< @brief Armenian Script */
|
||||
UCD_SCRIPT_Avst, /**< @brief Avestan Script */
|
||||
UCD_SCRIPT_Bali, /**< @brief Balinese Script */
|
||||
UCD_SCRIPT_Bamu, /**< @brief Bamum Script */
|
||||
UCD_SCRIPT_Bass, /**< @brief Bassa Vah Script */
|
||||
UCD_SCRIPT_Batk, /**< @brief Batak Script */
|
||||
UCD_SCRIPT_Beng, /**< @brief Bengali Script */
|
||||
UCD_SCRIPT_Bhks, /**< @brief Bhaiksuki Script */
|
||||
UCD_SCRIPT_Blis, /**< @brief Blissymbols Script */
|
||||
UCD_SCRIPT_Bopo, /**< @brief Bopomofo Script */
|
||||
UCD_SCRIPT_Brah, /**< @brief Brahmi Script */
|
||||
UCD_SCRIPT_Brai, /**< @brief Braille Script */
|
||||
UCD_SCRIPT_Bugi, /**< @brief Buginese Script */
|
||||
UCD_SCRIPT_Buhd, /**< @brief Buhid Script */
|
||||
UCD_SCRIPT_Cakm, /**< @brief Chakma Script */
|
||||
UCD_SCRIPT_Cans, /**< @brief Unified Canadian Aboriginal Syllabics */
|
||||
UCD_SCRIPT_Cari, /**< @brief Carian Script */
|
||||
UCD_SCRIPT_Cham, /**< @brief Cham Script */
|
||||
UCD_SCRIPT_Cher, /**< @brief Cherokee Script */
|
||||
UCD_SCRIPT_Cirt, /**< @brief Cirth Script */
|
||||
UCD_SCRIPT_Copt, /**< @brief Coptic Script */
|
||||
UCD_SCRIPT_Cprt, /**< @brief Cypriot Script */
|
||||
UCD_SCRIPT_Cyrl, /**< @brief Cyrillic Script */
|
||||
UCD_SCRIPT_Cyrs, /**< @brief Cyrillic (Old Church Slavonic variant) Script */
|
||||
UCD_SCRIPT_Deva, /**< @brief Devanagari Script */
|
||||
UCD_SCRIPT_Dsrt, /**< @brief Deseret Script */
|
||||
UCD_SCRIPT_Dupl, /**< @brief Duployan Shorthand Script */
|
||||
UCD_SCRIPT_Egyd, /**< @brief Egyptian Demotic Script */
|
||||
UCD_SCRIPT_Egyh, /**< @brief Egyptian Hieratic Script */
|
||||
UCD_SCRIPT_Egyp, /**< @brief Egyptian Hiegoglyphs */
|
||||
UCD_SCRIPT_Elba, /**< @brief Elbasan Script */
|
||||
UCD_SCRIPT_Ethi, /**< @brief Ethiopic Script */
|
||||
UCD_SCRIPT_Geok, /**< @brief Khutsuri Script */
|
||||
UCD_SCRIPT_Geor, /**< @brief Geirgian Script */
|
||||
UCD_SCRIPT_Glag, /**< @brief Glagolitic Script */
|
||||
UCD_SCRIPT_Goth, /**< @brief Gothic Script */
|
||||
UCD_SCRIPT_Gran, /**< @brief Grantha Script */
|
||||
UCD_SCRIPT_Grek, /**< @brief Greek Script */
|
||||
UCD_SCRIPT_Gujr, /**< @brief Gujarati Script */
|
||||
UCD_SCRIPT_Guru, /**< @brief Gurmukhi Script */
|
||||
UCD_SCRIPT_Hang, /**< @brief Hangul Script */
|
||||
UCD_SCRIPT_Hani, /**< @brief Han (Hanzi, Kanji, Hanja) Script */
|
||||
UCD_SCRIPT_Hano, /**< @brief Hanunoo Script */
|
||||
UCD_SCRIPT_Hans, /**< @brief Han (Simplified) Script */
|
||||
UCD_SCRIPT_Hant, /**< @brief Han (Traditional) Script */
|
||||
UCD_SCRIPT_Hatr, /**< @brief Hatran Script */
|
||||
UCD_SCRIPT_Hebr, /**< @brief Hebrew Script */
|
||||
UCD_SCRIPT_Hira, /**< @brief Hiragana Script */
|
||||
UCD_SCRIPT_Hluw, /**< @brief Anatolian Hieroglyphs */
|
||||
UCD_SCRIPT_Hmng, /**< @brief Pahawh Hmong Script */
|
||||
UCD_SCRIPT_Hrkt, /**< @brief Japanese Syllabaries */
|
||||
UCD_SCRIPT_Hung, /**< @brief Old Hungarian Script */
|
||||
UCD_SCRIPT_Inds, /**< @brief Indus Script */
|
||||
UCD_SCRIPT_Ital, /**< @brief Old Italic Script */
|
||||
UCD_SCRIPT_Java, /**< @brief Javanese Script */
|
||||
UCD_SCRIPT_Jpan, /**< @brief Japanese (Han + Hiragana + Katakana) Scripts */
|
||||
UCD_SCRIPT_Jurc, /**< @brief Jurchen Script */
|
||||
UCD_SCRIPT_Kali, /**< @brief Kayah Li Script */
|
||||
UCD_SCRIPT_Kana, /**< @brief Katakana Script */
|
||||
UCD_SCRIPT_Khar, /**< @brief Kharoshthi Script */
|
||||
UCD_SCRIPT_Khmr, /**< @brief Khmer Script */
|
||||
UCD_SCRIPT_Khoj, /**< @brief Khojki Script */
|
||||
UCD_SCRIPT_Knda, /**< @brief Kannada Script */
|
||||
UCD_SCRIPT_Kore, /**< @brief Korean (Hangul + Han) Scripts */
|
||||
UCD_SCRIPT_Kpel, /**< @brief Kpelle Script */
|
||||
UCD_SCRIPT_Kthi, /**< @brief Kaithi Script */
|
||||
UCD_SCRIPT_Lana, /**< @brief Tai Tham Script */
|
||||
UCD_SCRIPT_Laoo, /**< @brief Lao Script */
|
||||
UCD_SCRIPT_Latf, /**< @brief Latin Script (Fractur Variant) */
|
||||
UCD_SCRIPT_Latg, /**< @brief Latin Script (Gaelic Variant) */
|
||||
UCD_SCRIPT_Latn, /**< @brief Latin Script */
|
||||
UCD_SCRIPT_Lepc, /**< @brief Lepcha Script */
|
||||
UCD_SCRIPT_Limb, /**< @brief Limbu Script */
|
||||
UCD_SCRIPT_Lina, /**< @brief Linear A Script */
|
||||
UCD_SCRIPT_Linb, /**< @brief Linear B Script */
|
||||
UCD_SCRIPT_Lisu, /**< @brief Lisu Script */
|
||||
UCD_SCRIPT_Loma, /**< @brief Loma Script */
|
||||
UCD_SCRIPT_Lyci, /**< @brief Lycian Script */
|
||||
UCD_SCRIPT_Lydi, /**< @brief Lydian Script */
|
||||
UCD_SCRIPT_Mahj, /**< @brief Mahajani Script */
|
||||
UCD_SCRIPT_Mand, /**< @brief Mandaic Script */
|
||||
UCD_SCRIPT_Mani, /**< @brief Manichaean Script */
|
||||
UCD_SCRIPT_Marc, /**< @brief Marchen Script */
|
||||
UCD_SCRIPT_Maya, /**< @brief Mayan Hieroglyphs */
|
||||
UCD_SCRIPT_Mend, /**< @brief Mende Kikakui Script */
|
||||
UCD_SCRIPT_Merc, /**< @brief Meroitic Cursive Script */
|
||||
UCD_SCRIPT_Mero, /**< @brief Meroitic Hieroglyphs */
|
||||
UCD_SCRIPT_Mlym, /**< @brief Malayalam Script */
|
||||
UCD_SCRIPT_Modi, /**< @brief Modi Script */
|
||||
UCD_SCRIPT_Mong, /**< @brief Mongolian Script */
|
||||
UCD_SCRIPT_Moon, /**< @brief Moon Script */
|
||||
UCD_SCRIPT_Mroo, /**< @brief Mro Script */
|
||||
UCD_SCRIPT_Mtei, /**< @brief Meitei Mayek Script */
|
||||
UCD_SCRIPT_Mult, /**< @brief Multani Script */
|
||||
UCD_SCRIPT_Mymr, /**< @brief Myanmar (Burmese) Script */
|
||||
UCD_SCRIPT_Narb, /**< @brief Old North Arabian Script */
|
||||
UCD_SCRIPT_Nbat, /**< @brief Nabataean Script */
|
||||
UCD_SCRIPT_Newa, /**< @brief Newa Script */
|
||||
UCD_SCRIPT_Nkgb, /**< @brief Nakhi Geba Script */
|
||||
UCD_SCRIPT_Nkoo, /**< @brief N'Ko Script */
|
||||
UCD_SCRIPT_Nshu, /**< @brief Nushu Script */
|
||||
UCD_SCRIPT_Ogam, /**< @brief Ogham Script */
|
||||
UCD_SCRIPT_Olck, /**< @brief Ol Chiki Script */
|
||||
UCD_SCRIPT_Orkh, /**< @brief Old Turkic Script */
|
||||
UCD_SCRIPT_Orya, /**< @brief Oriya Script */
|
||||
UCD_SCRIPT_Osge, /**< @brief Osage Script */
|
||||
UCD_SCRIPT_Osma, /**< @brief Osmanya Script */
|
||||
UCD_SCRIPT_Palm, /**< @brief Palmyrene Script */
|
||||
UCD_SCRIPT_Pauc, /**< @brief Pau Cin Hau Script */
|
||||
UCD_SCRIPT_Perm, /**< @brief Old Permic */
|
||||
UCD_SCRIPT_Phag, /**< @brief Phags-Pa Script */
|
||||
UCD_SCRIPT_Phli, /**< @brief Inscriptional Pahlavi Script */
|
||||
UCD_SCRIPT_Phlp, /**< @brief Psalter Pahlavi Script */
|
||||
UCD_SCRIPT_Phlv, /**< @brief Book Pahlavi Script */
|
||||
UCD_SCRIPT_Phnx, /**< @brief Phoenician Script */
|
||||
UCD_SCRIPT_Plrd, /**< @brief Miao Script */
|
||||
UCD_SCRIPT_Prti, /**< @brief Inscriptional Parthian Script */
|
||||
UCD_SCRIPT_Qaak, /**< @brief Klingon Script (Private Use) */
|
||||
UCD_SCRIPT_Rjng, /**< @brief Rejang Script */
|
||||
UCD_SCRIPT_Roro, /**< @brief Rongorongo Script */
|
||||
UCD_SCRIPT_Runr, /**< @brief Runic Script */
|
||||
UCD_SCRIPT_Samr, /**< @brief Samaritan Script */
|
||||
UCD_SCRIPT_Sara, /**< @brief Sarati Script */
|
||||
UCD_SCRIPT_Sarb, /**< @brief Old South Arabian Script */
|
||||
UCD_SCRIPT_Saur, /**< @brief Saurashtra Script */
|
||||
UCD_SCRIPT_Sgnw, /**< @brief Sign Writing */
|
||||
UCD_SCRIPT_Shaw, /**< @brief Shavian Script */
|
||||
UCD_SCRIPT_Shrd, /**< @brief Sharada Script */
|
||||
UCD_SCRIPT_Sidd, /**< @brief Siddham Script */
|
||||
UCD_SCRIPT_Sind, /**< @brief Sindhi Script */
|
||||
UCD_SCRIPT_Sinh, /**< @brief Sinhala Script */
|
||||
UCD_SCRIPT_Sora, /**< @brief Sora Sompeng Script */
|
||||
UCD_SCRIPT_Sund, /**< @brief Sundanese Script */
|
||||
UCD_SCRIPT_Sylo, /**< @brief Syloti Nagri Script */
|
||||
UCD_SCRIPT_Syrc, /**< @brief Syriac Script */
|
||||
UCD_SCRIPT_Syre, /**< @brief Syriac Script (Estrangelo Variant) */
|
||||
UCD_SCRIPT_Syrj, /**< @brief Syriac Script (Western Variant) */
|
||||
UCD_SCRIPT_Syrn, /**< @brief Syriac Script (Eastern Variant) */
|
||||
UCD_SCRIPT_Tagb, /**< @brief Tagbanwa Script */
|
||||
UCD_SCRIPT_Takr, /**< @brief Takri Script */
|
||||
UCD_SCRIPT_Tale, /**< @brief Tai Le Script */
|
||||
UCD_SCRIPT_Talu, /**< @brief New Tai Lue Script */
|
||||
UCD_SCRIPT_Taml, /**< @brief Tamil Script */
|
||||
UCD_SCRIPT_Tang, /**< @brief Tangut Script */
|
||||
UCD_SCRIPT_Tavt, /**< @brief Tai Viet Script */
|
||||
UCD_SCRIPT_Telu, /**< @brief Telugu Script */
|
||||
UCD_SCRIPT_Teng, /**< @brief Tengwar Script */
|
||||
UCD_SCRIPT_Tfng, /**< @brief Tifinagh Script */
|
||||
UCD_SCRIPT_Tglg, /**< @brief Tagalog Script */
|
||||
UCD_SCRIPT_Thaa, /**< @brief Thaana Script */
|
||||
UCD_SCRIPT_Thai, /**< @brief Thai Script */
|
||||
UCD_SCRIPT_Tibt, /**< @brief Tibetan Script */
|
||||
UCD_SCRIPT_Tirh, /**< @brief Tirhuta Script */
|
||||
UCD_SCRIPT_Ugar, /**< @brief Ugaritic Script */
|
||||
UCD_SCRIPT_Vaii, /**< @brief Vai Script */
|
||||
UCD_SCRIPT_Visp, /**< @brief Visible Speech Script */
|
||||
UCD_SCRIPT_Wara, /**< @brief Warang Citi Script */
|
||||
UCD_SCRIPT_Wole, /**< @brief Woleai Script */
|
||||
UCD_SCRIPT_Xpeo, /**< @brief Old Persian Script */
|
||||
UCD_SCRIPT_Xsux, /**< @brief Cuneiform Script */
|
||||
UCD_SCRIPT_Yiii, /**< @brief Yi Script */
|
||||
UCD_SCRIPT_Zinh, /**< @brief Inherited Script */
|
||||
UCD_SCRIPT_Zmth, /**< @brief Mathematical Notation */
|
||||
UCD_SCRIPT_Zsym, /**< @brief Symbols */
|
||||
UCD_SCRIPT_Zxxx, /**< @brief Unwritten Documents */
|
||||
UCD_SCRIPT_Zyyy, /**< @brief Undetermined Script */
|
||||
UCD_SCRIPT_Zzzz, /**< @brief Uncoded Script */
|
||||
} ucd_script;
|
||||
|
||||
/** @brief Get a string representation of the script enumeration value.
|
||||
*
|
||||
* @param s The value to get the string representation for.
|
||||
*
|
||||
* @return The string representation, or "----" if the value is not recognized.
|
||||
*/
|
||||
const char *ucd_get_script_string(ucd_script s);
|
||||
|
||||
/** @brief Lookup the Script for a Unicode codepoint.
|
||||
*
|
||||
* @param c The Unicode codepoint to lookup.
|
||||
* @return The Script of the Unicode codepoint.
|
||||
*/
|
||||
ucd_script ucd_lookup_script(codepoint_t c);
|
||||
|
||||
/** @brief Is the codepoint an alpha-numeric character?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is a letter or number, zero otherwise.
|
||||
*/
|
||||
int ucd_isalnum(codepoint_t c);
|
||||
|
||||
/** @brief Is the codepoint a letter?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is a letter, zero otherwise.
|
||||
*/
|
||||
int ucd_isalpha(codepoint_t c);
|
||||
|
||||
/** @brief Is the codepoint a control character?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is a control character, zero otherwise.
|
||||
*/
|
||||
int ucd_iscntrl(codepoint_t c);
|
||||
|
||||
/** @brief Is the codepoint a numeric character?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is a number, zero otherwise.
|
||||
*/
|
||||
int ucd_isdigit(codepoint_t c);
|
||||
|
||||
/** @brief Does the codepoint have a displayable glyph?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint has a displayable glyph, zero otherwise.
|
||||
*/
|
||||
int ucd_isgraph(codepoint_t c);
|
||||
|
||||
/** @brief Is the codepoint a lower-case letter?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is a lower-case letter, zero otherwise.
|
||||
*/
|
||||
int ucd_islower(codepoint_t c);
|
||||
|
||||
/** @brief Is the codepoint a printable character?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is a printable character, zero otherwise.
|
||||
*/
|
||||
int ucd_isprint(codepoint_t c);
|
||||
|
||||
/** @brief Is the codepoint a punctuation character?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is a punctuation character, zero otherwise.
|
||||
*/
|
||||
int ucd_ispunct(codepoint_t c);
|
||||
|
||||
/** @brief Is the codepoint a whitespace character?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is a whitespace character, zero otherwise.
|
||||
*/
|
||||
int ucd_isspace(codepoint_t c);
|
||||
|
||||
/** @brief Is the codepoint an upper-case letter?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is an upper-case letter, zero otherwise.
|
||||
*/
|
||||
int ucd_isupper(codepoint_t c);
|
||||
|
||||
/** @brief Convert the Unicode codepoint to upper-case.
|
||||
*
|
||||
* This function only uses the simple case mapping present in the
|
||||
* UnicodeData file. The data in SpecialCasing requires Unicode
|
||||
* codepoints to be mapped to multiple codepoints.
|
||||
*
|
||||
* @param c The Unicode codepoint to convert.
|
||||
* @return The upper-case Unicode codepoint for this codepoint, or
|
||||
* this codepoint if there is no upper-case codepoint.
|
||||
*/
|
||||
codepoint_t ucd_toupper(codepoint_t c);
|
||||
|
||||
/** @brief Convert the Unicode codepoint to lower-case.
|
||||
*
|
||||
* This function only uses the simple case mapping present in the
|
||||
* UnicodeData file. The data in SpecialCasing requires Unicode
|
||||
* codepoints to be mapped to multiple codepoints.
|
||||
*
|
||||
* @param c The Unicode codepoint to convert.
|
||||
* @return The lower-case Unicode codepoint for this codepoint, or
|
||||
* this codepoint if there is no upper-case codepoint.
|
||||
*/
|
||||
codepoint_t ucd_tolower(codepoint_t c);
|
||||
|
||||
/** @brief Convert the Unicode codepoint to title-case.
|
||||
*
|
||||
* This function only uses the simple case mapping present in the
|
||||
* UnicodeData file. The data in SpecialCasing requires Unicode
|
||||
* codepoints to be mapped to multiple codepoints.
|
||||
*
|
||||
* @param c The Unicode codepoint to convert.
|
||||
* @return The title-case Unicode codepoint for this codepoint, or
|
||||
* this codepoint if there is no upper-case codepoint.
|
||||
*/
|
||||
codepoint_t ucd_totitle(codepoint_t c);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
/** @brief Unicode Character Database
|
||||
*/
|
||||
namespace ucd
|
||||
{
|
||||
/** @brief Represents a Unicode codepoint.
|
||||
*/
|
||||
using ::codepoint_t;
|
||||
|
||||
/** @brief Unicode General Category Groups
|
||||
* @see http://www.unicode.org/reports/tr44/
|
||||
*/
|
||||
enum category_group
|
||||
{
|
||||
C = UCD_CATEGORY_GROUP_C, /**< @brief Other */
|
||||
I = UCD_CATEGORY_GROUP_I, /**< @brief Invalid */
|
||||
L = UCD_CATEGORY_GROUP_L, /**< @brief Letter */
|
||||
M = UCD_CATEGORY_GROUP_M, /**< @brief Mark */
|
||||
N = UCD_CATEGORY_GROUP_N, /**< @brief Number */
|
||||
P = UCD_CATEGORY_GROUP_P, /**< @brief Punctuation */
|
||||
S = UCD_CATEGORY_GROUP_S, /**< @brief Symbol */
|
||||
Z = UCD_CATEGORY_GROUP_Z, /**< @brief Separator */
|
||||
};
|
||||
|
||||
/** @brief Get a string representation of the category_group enumeration value.
|
||||
*
|
||||
* @param c The value to get the string representation for.
|
||||
*
|
||||
* @return The string representation, or "-" if the value is not recognized.
|
||||
*/
|
||||
inline const char *get_category_group_string(category_group c)
|
||||
{
|
||||
return ucd_get_category_group_string((ucd_category_group)c);
|
||||
}
|
||||
|
||||
/** @brief Unicode General Category Values
|
||||
* @see http://www.unicode.org/reports/tr44/
|
||||
*/
|
||||
enum category
|
||||
{
|
||||
Cc = UCD_CATEGORY_Cc, /**< @brief Control Character */
|
||||
Cf = UCD_CATEGORY_Cf, /**< @brief Format Control Character */
|
||||
Cn = UCD_CATEGORY_Cn, /**< @brief Unassigned */
|
||||
Co = UCD_CATEGORY_Co, /**< @brief Private Use */
|
||||
Cs = UCD_CATEGORY_Cs, /**< @brief Surrogate Code Point */
|
||||
|
||||
Ii = UCD_CATEGORY_Ii, /**< @brief Invalid Unicode Codepoint */
|
||||
|
||||
Ll = UCD_CATEGORY_Ll, /**< @brief Lower Case Letter */
|
||||
Lm = UCD_CATEGORY_Lm, /**< @brief Letter Modifier */
|
||||
Lo = UCD_CATEGORY_Lo, /**< @brief Other Letter */
|
||||
Lt = UCD_CATEGORY_Lt, /**< @brief Title Case Letter */
|
||||
Lu = UCD_CATEGORY_Lu, /**< @brief Upper Case Letter */
|
||||
|
||||
Mc = UCD_CATEGORY_Mc, /**< @brief Spacing Mark */
|
||||
Me = UCD_CATEGORY_Me, /**< @brief Enclosing Mark */
|
||||
Mn = UCD_CATEGORY_Mn, /**< @brief Non-Spacing Mark */
|
||||
|
||||
Nd = UCD_CATEGORY_Nd, /**< @brief Decimal Digit */
|
||||
Nl = UCD_CATEGORY_Nl, /**< @brief Letter-Like Number */
|
||||
No = UCD_CATEGORY_No, /**< @brief Other Number */
|
||||
|
||||
Pc = UCD_CATEGORY_Pc, /**< @brief Connector */
|
||||
Pd = UCD_CATEGORY_Pd, /**< @brief Dash/Hyphen */
|
||||
Pe = UCD_CATEGORY_Pe, /**< @brief Close Punctuation Mark */
|
||||
Pf = UCD_CATEGORY_Pf, /**< @brief Final Quotation Mark */
|
||||
Pi = UCD_CATEGORY_Pi, /**< @brief Initial Quotation Mark */
|
||||
Po = UCD_CATEGORY_Po, /**< @brief Other */
|
||||
Ps = UCD_CATEGORY_Ps, /**< @brief Open Punctuation Mark */
|
||||
|
||||
Sc = UCD_CATEGORY_Sc, /**< @brief Currency Symbol */
|
||||
Sk = UCD_CATEGORY_Sk, /**< @brief Modifier Symbol */
|
||||
Sm = UCD_CATEGORY_Sm, /**< @brief Math Symbol */
|
||||
So = UCD_CATEGORY_So, /**< @brief Other Symbol */
|
||||
|
||||
Zl = UCD_CATEGORY_Zl, /**< @brief Line Separator */
|
||||
Zp = UCD_CATEGORY_Zp, /**< @brief Paragraph Separator */
|
||||
Zs = UCD_CATEGORY_Zs, /**< @brief Space Separator */
|
||||
};
|
||||
|
||||
/** @brief Get a string representation of the category enumeration value.
|
||||
*
|
||||
* @param c The value to get the string representation for.
|
||||
*
|
||||
* @return The string representation, or "--" if the value is not recognized.
|
||||
*/
|
||||
inline const char *get_category_string(category c)
|
||||
{
|
||||
return ucd_get_category_string((ucd_category)c);
|
||||
}
|
||||
|
||||
/** @brief Lookup the General Category Group for a General Category.
|
||||
*
|
||||
* @param c The General Category to lookup.
|
||||
* @return The General Category Group of the General Category.
|
||||
*/
|
||||
inline category_group lookup_category_group(category c)
|
||||
{
|
||||
return (category_group)ucd_get_category_group_for_category((ucd_category)c);
|
||||
}
|
||||
|
||||
/** @brief Lookup the General Category Group for a Unicode codepoint.
|
||||
*
|
||||
* @param c The Unicode codepoint to lookup.
|
||||
* @return The General Category Group of the Unicode codepoint.
|
||||
*/
|
||||
inline category_group lookup_category_group(codepoint_t c)
|
||||
{
|
||||
return (category_group)ucd_lookup_category_group(c);
|
||||
}
|
||||
|
||||
/** @brief Lookup the General Category for a Unicode codepoint.
|
||||
*
|
||||
* @param c The Unicode codepoint to lookup.
|
||||
* @return The General Category of the Unicode codepoint.
|
||||
*/
|
||||
inline category lookup_category(codepoint_t c)
|
||||
{
|
||||
return (category)ucd_lookup_category(c);
|
||||
}
|
||||
|
||||
/** @brief Unicode Script
|
||||
* @see http://www.iana.org/assignments/language-subtag-registry
|
||||
* @see http://www.unicode.org/iso15924/iso15924-codes.html
|
||||
*/
|
||||
enum script
|
||||
{
|
||||
Adlm = UCD_SCRIPT_Adlm, /**< @brief Adlam Script */
|
||||
Afak = UCD_SCRIPT_Afak, /**< @brief Afaka Script */
|
||||
Aghb = UCD_SCRIPT_Aghb, /**< @brief Caucasian Albanian Script */
|
||||
Ahom = UCD_SCRIPT_Ahom, /**< @brief Tai Ahom Script */
|
||||
Arab = UCD_SCRIPT_Arab, /**< @brief Arabic Script */
|
||||
Armi = UCD_SCRIPT_Armi, /**< @brief Imperial Aramaic Script */
|
||||
Armn = UCD_SCRIPT_Armn, /**< @brief Armenian Script */
|
||||
Avst = UCD_SCRIPT_Avst, /**< @brief Avestan Script */
|
||||
Bali = UCD_SCRIPT_Bali, /**< @brief Balinese Script */
|
||||
Bamu = UCD_SCRIPT_Bamu, /**< @brief Bamum Script */
|
||||
Bass = UCD_SCRIPT_Bass, /**< @brief Bassa Vah Script */
|
||||
Batk = UCD_SCRIPT_Batk, /**< @brief Batak Script */
|
||||
Beng = UCD_SCRIPT_Beng, /**< @brief Bengali Script */
|
||||
Bhks = UCD_SCRIPT_Bhks, /**< @brief Bhaiksuki Script */
|
||||
Blis = UCD_SCRIPT_Blis, /**< @brief Blissymbols Script */
|
||||
Bopo = UCD_SCRIPT_Bopo, /**< @brief Bopomofo Script */
|
||||
Brah = UCD_SCRIPT_Brah, /**< @brief Brahmi Script */
|
||||
Brai = UCD_SCRIPT_Brai, /**< @brief Braille Script */
|
||||
Bugi = UCD_SCRIPT_Bugi, /**< @brief Buginese Script */
|
||||
Buhd = UCD_SCRIPT_Buhd, /**< @brief Buhid Script */
|
||||
Cakm = UCD_SCRIPT_Cakm, /**< @brief Chakma Script */
|
||||
Cans = UCD_SCRIPT_Cans, /**< @brief Unified Canadian Aboriginal Syllabics */
|
||||
Cari = UCD_SCRIPT_Cari, /**< @brief Carian Script */
|
||||
Cham = UCD_SCRIPT_Cham, /**< @brief Cham Script */
|
||||
Cher = UCD_SCRIPT_Cher, /**< @brief Cherokee Script */
|
||||
Cirt = UCD_SCRIPT_Cirt, /**< @brief Cirth Script */
|
||||
Copt = UCD_SCRIPT_Copt, /**< @brief Coptic Script */
|
||||
Cprt = UCD_SCRIPT_Cprt, /**< @brief Cypriot Script */
|
||||
Cyrl = UCD_SCRIPT_Cyrl, /**< @brief Cyrillic Script */
|
||||
Cyrs = UCD_SCRIPT_Cyrs, /**< @brief Cyrillic (Old Church Slavonic variant) Script */
|
||||
Deva = UCD_SCRIPT_Deva, /**< @brief Devanagari Script */
|
||||
Dsrt = UCD_SCRIPT_Dsrt, /**< @brief Deseret Script */
|
||||
Dupl = UCD_SCRIPT_Dupl, /**< @brief Duployan Shorthand Script */
|
||||
Egyd = UCD_SCRIPT_Egyd, /**< @brief Egyptian Demotic Script */
|
||||
Egyh = UCD_SCRIPT_Egyh, /**< @brief Egyptian Hieratic Script */
|
||||
Egyp = UCD_SCRIPT_Egyp, /**< @brief Egyptian Hiegoglyphs */
|
||||
Elba = UCD_SCRIPT_Elba, /**< @brief Elbasan Script */
|
||||
Ethi = UCD_SCRIPT_Ethi, /**< @brief Ethiopic Script */
|
||||
Geok = UCD_SCRIPT_Geok, /**< @brief Khutsuri Script */
|
||||
Geor = UCD_SCRIPT_Geor, /**< @brief Geirgian Script */
|
||||
Glag = UCD_SCRIPT_Glag, /**< @brief Glagolitic Script */
|
||||
Goth = UCD_SCRIPT_Goth, /**< @brief Gothic Script */
|
||||
Gran = UCD_SCRIPT_Gran, /**< @brief Grantha Script */
|
||||
Grek = UCD_SCRIPT_Grek, /**< @brief Greek Script */
|
||||
Gujr = UCD_SCRIPT_Gujr, /**< @brief Gujarati Script */
|
||||
Guru = UCD_SCRIPT_Guru, /**< @brief Gurmukhi Script */
|
||||
Hang = UCD_SCRIPT_Hang, /**< @brief Hangul Script */
|
||||
Hani = UCD_SCRIPT_Hani, /**< @brief Han (Hanzi, Kanji, Hanja) Script */
|
||||
Hano = UCD_SCRIPT_Hano, /**< @brief Hanunoo Script */
|
||||
Hans = UCD_SCRIPT_Hans, /**< @brief Han (Simplified) Script */
|
||||
Hant = UCD_SCRIPT_Hant, /**< @brief Han (Traditional) Script */
|
||||
Hatr = UCD_SCRIPT_Hatr, /**< @brief Hatran Script */
|
||||
Hebr = UCD_SCRIPT_Hebr, /**< @brief Hebrew Script */
|
||||
Hira = UCD_SCRIPT_Hira, /**< @brief Hiragana Script */
|
||||
Hluw = UCD_SCRIPT_Hluw, /**< @brief Anatolian Hieroglyphs */
|
||||
Hmng = UCD_SCRIPT_Hmng, /**< @brief Pahawh Hmong Script */
|
||||
Hrkt = UCD_SCRIPT_Hrkt, /**< @brief Japanese Syllabaries */
|
||||
Hung = UCD_SCRIPT_Hung, /**< @brief Old Hungarian Script */
|
||||
Inds = UCD_SCRIPT_Inds, /**< @brief Indus Script */
|
||||
Ital = UCD_SCRIPT_Ital, /**< @brief Old Italic Script */
|
||||
Java = UCD_SCRIPT_Java, /**< @brief Javanese Script */
|
||||
Jpan = UCD_SCRIPT_Jpan, /**< @brief Japanese (Han + Hiragana + Katakana) Scripts */
|
||||
Jurc = UCD_SCRIPT_Jurc, /**< @brief Jurchen Script */
|
||||
Kali = UCD_SCRIPT_Kali, /**< @brief Kayah Li Script */
|
||||
Kana = UCD_SCRIPT_Kana, /**< @brief Katakana Script */
|
||||
Khar = UCD_SCRIPT_Khar, /**< @brief Kharoshthi Script */
|
||||
Khmr = UCD_SCRIPT_Khmr, /**< @brief Khmer Script */
|
||||
Khoj = UCD_SCRIPT_Khoj, /**< @brief Khojki Script */
|
||||
Knda = UCD_SCRIPT_Knda, /**< @brief Kannada Script */
|
||||
Kore = UCD_SCRIPT_Kore, /**< @brief Korean (Hangul + Han) Scripts */
|
||||
Kpel = UCD_SCRIPT_Kpel, /**< @brief Kpelle Script */
|
||||
Kthi = UCD_SCRIPT_Kthi, /**< @brief Kaithi Script */
|
||||
Lana = UCD_SCRIPT_Lana, /**< @brief Tai Tham Script */
|
||||
Laoo = UCD_SCRIPT_Laoo, /**< @brief Lao Script */
|
||||
Latf = UCD_SCRIPT_Latf, /**< @brief Latin Script (Fractur Variant) */
|
||||
Latg = UCD_SCRIPT_Latg, /**< @brief Latin Script (Gaelic Variant) */
|
||||
Latn = UCD_SCRIPT_Latn, /**< @brief Latin Script */
|
||||
Lepc = UCD_SCRIPT_Lepc, /**< @brief Lepcha Script */
|
||||
Limb = UCD_SCRIPT_Limb, /**< @brief Limbu Script */
|
||||
Lina = UCD_SCRIPT_Lina, /**< @brief Linear A Script */
|
||||
Linb = UCD_SCRIPT_Linb, /**< @brief Linear B Script */
|
||||
Lisu = UCD_SCRIPT_Lisu, /**< @brief Lisu Script */
|
||||
Loma = UCD_SCRIPT_Loma, /**< @brief Loma Script */
|
||||
Lyci = UCD_SCRIPT_Lyci, /**< @brief Lycian Script */
|
||||
Lydi = UCD_SCRIPT_Lydi, /**< @brief Lydian Script */
|
||||
Mahj = UCD_SCRIPT_Mahj, /**< @brief Mahajani Script */
|
||||
Mand = UCD_SCRIPT_Mand, /**< @brief Mandaic Script */
|
||||
Mani = UCD_SCRIPT_Mani, /**< @brief Manichaean Script */
|
||||
Marc = UCD_SCRIPT_Marc, /**< @brief Marchen Script */
|
||||
Maya = UCD_SCRIPT_Maya, /**< @brief Mayan Hieroglyphs */
|
||||
Mend = UCD_SCRIPT_Mend, /**< @brief Mende Kikakui Script */
|
||||
Merc = UCD_SCRIPT_Merc, /**< @brief Meroitic Cursive Script */
|
||||
Mero = UCD_SCRIPT_Mero, /**< @brief Meroitic Hieroglyphs */
|
||||
Mlym = UCD_SCRIPT_Mlym, /**< @brief Malayalam Script */
|
||||
Modi = UCD_SCRIPT_Modi, /**< @brief Modi Script */
|
||||
Mong = UCD_SCRIPT_Mong, /**< @brief Mongolian Script */
|
||||
Moon = UCD_SCRIPT_Moon, /**< @brief Moon Script */
|
||||
Mroo = UCD_SCRIPT_Mroo, /**< @brief Mro Script */
|
||||
Mtei = UCD_SCRIPT_Mtei, /**< @brief Meitei Mayek Script */
|
||||
Mult = UCD_SCRIPT_Mult, /**< @brief Multani Script */
|
||||
Mymr = UCD_SCRIPT_Mymr, /**< @brief Myanmar (Burmese) Script */
|
||||
Narb = UCD_SCRIPT_Narb, /**< @brief Old North Arabian Script */
|
||||
Nbat = UCD_SCRIPT_Nbat, /**< @brief Nabataean Script */
|
||||
Newa = UCD_SCRIPT_Newa, /**< @brief Newa Script */
|
||||
Nkgb = UCD_SCRIPT_Nkgb, /**< @brief Nakhi Geba Script */
|
||||
Nkoo = UCD_SCRIPT_Nkoo, /**< @brief N'Ko Script */
|
||||
Nshu = UCD_SCRIPT_Nshu, /**< @brief Nushu Script */
|
||||
Ogam = UCD_SCRIPT_Ogam, /**< @brief Ogham Script */
|
||||
Olck = UCD_SCRIPT_Olck, /**< @brief Ol Chiki Script */
|
||||
Orkh = UCD_SCRIPT_Orkh, /**< @brief Old Turkic Script */
|
||||
Orya = UCD_SCRIPT_Orya, /**< @brief Oriya Script */
|
||||
Osge = UCD_SCRIPT_Osge, /**< @brief Osage Script */
|
||||
Osma = UCD_SCRIPT_Osma, /**< @brief Osmanya Script */
|
||||
Palm = UCD_SCRIPT_Palm, /**< @brief Palmyrene Script */
|
||||
Pauc = UCD_SCRIPT_Pauc, /**< @brief Pau Cin Hau Script */
|
||||
Perm = UCD_SCRIPT_Perm, /**< @brief Old Permic */
|
||||
Phag = UCD_SCRIPT_Phag, /**< @brief Phags-Pa Script */
|
||||
Phli = UCD_SCRIPT_Phli, /**< @brief Inscriptional Pahlavi Script */
|
||||
Phlp = UCD_SCRIPT_Phlp, /**< @brief Psalter Pahlavi Script */
|
||||
Phlv = UCD_SCRIPT_Phlv, /**< @brief Book Pahlavi Script */
|
||||
Phnx = UCD_SCRIPT_Phnx, /**< @brief Phoenician Script */
|
||||
Plrd = UCD_SCRIPT_Plrd, /**< @brief Miao Script */
|
||||
Prti = UCD_SCRIPT_Prti, /**< @brief Inscriptional Parthian Script */
|
||||
Qaak = UCD_SCRIPT_Qaak, /**< @brief Klingon Script (Private Use) */
|
||||
Rjng = UCD_SCRIPT_Rjng, /**< @brief Rejang Script */
|
||||
Roro = UCD_SCRIPT_Roro, /**< @brief Rongorongo Script */
|
||||
Runr = UCD_SCRIPT_Runr, /**< @brief Runic Script */
|
||||
Samr = UCD_SCRIPT_Samr, /**< @brief Samaritan Script */
|
||||
Sara = UCD_SCRIPT_Sara, /**< @brief Sarati Script */
|
||||
Sarb = UCD_SCRIPT_Sarb, /**< @brief Old South Arabian Script */
|
||||
Saur = UCD_SCRIPT_Saur, /**< @brief Saurashtra Script */
|
||||
Sgnw = UCD_SCRIPT_Sgnw, /**< @brief Sign Writing */
|
||||
Shaw = UCD_SCRIPT_Shaw, /**< @brief Shavian Script */
|
||||
Shrd = UCD_SCRIPT_Shrd, /**< @brief Sharada Script */
|
||||
Sidd = UCD_SCRIPT_Sidd, /**< @brief Siddham Script */
|
||||
Sind = UCD_SCRIPT_Sind, /**< @brief Sindhi Script */
|
||||
Sinh = UCD_SCRIPT_Sinh, /**< @brief Sinhala Script */
|
||||
Sora = UCD_SCRIPT_Sora, /**< @brief Sora Sompeng Script */
|
||||
Sund = UCD_SCRIPT_Sund, /**< @brief Sundanese Script */
|
||||
Sylo = UCD_SCRIPT_Sylo, /**< @brief Syloti Nagri Script */
|
||||
Syrc = UCD_SCRIPT_Syrc, /**< @brief Syriac Script */
|
||||
Syre = UCD_SCRIPT_Syre, /**< @brief Syriac Script (Estrangelo Variant) */
|
||||
Syrj = UCD_SCRIPT_Syrj, /**< @brief Syriac Script (Western Variant) */
|
||||
Syrn = UCD_SCRIPT_Syrn, /**< @brief Syriac Script (Eastern Variant) */
|
||||
Tagb = UCD_SCRIPT_Tagb, /**< @brief Tagbanwa Script */
|
||||
Takr = UCD_SCRIPT_Takr, /**< @brief Takri Script */
|
||||
Tale = UCD_SCRIPT_Tale, /**< @brief Tai Le Script */
|
||||
Talu = UCD_SCRIPT_Talu, /**< @brief New Tai Lue Script */
|
||||
Taml = UCD_SCRIPT_Taml, /**< @brief Tamil Script */
|
||||
Tang = UCD_SCRIPT_Tang, /**< @brief Tangut Script */
|
||||
Tavt = UCD_SCRIPT_Tavt, /**< @brief Tai Viet Script */
|
||||
Telu = UCD_SCRIPT_Telu, /**< @brief Telugu Script */
|
||||
Teng = UCD_SCRIPT_Teng, /**< @brief Tengwar Script */
|
||||
Tfng = UCD_SCRIPT_Tfng, /**< @brief Tifinagh Script */
|
||||
Tglg = UCD_SCRIPT_Tglg, /**< @brief Tagalog Script */
|
||||
Thaa = UCD_SCRIPT_Thaa, /**< @brief Thaana Script */
|
||||
Thai = UCD_SCRIPT_Thai, /**< @brief Thai Script */
|
||||
Tibt = UCD_SCRIPT_Tibt, /**< @brief Tibetan Script */
|
||||
Tirh = UCD_SCRIPT_Tirh, /**< @brief Tirhuta Script */
|
||||
Ugar = UCD_SCRIPT_Ugar, /**< @brief Ugaritic Script */
|
||||
Vaii = UCD_SCRIPT_Vaii, /**< @brief Vai Script */
|
||||
Visp = UCD_SCRIPT_Visp, /**< @brief Visible Speech Script */
|
||||
Wara = UCD_SCRIPT_Wara, /**< @brief Warang Citi Script */
|
||||
Wole = UCD_SCRIPT_Wole, /**< @brief Woleai Script */
|
||||
Xpeo = UCD_SCRIPT_Xpeo, /**< @brief Old Persian Script */
|
||||
Xsux = UCD_SCRIPT_Xsux, /**< @brief Cuneiform Script */
|
||||
Yiii = UCD_SCRIPT_Yiii, /**< @brief Yi Script */
|
||||
Zinh = UCD_SCRIPT_Zinh, /**< @brief Inherited Script */
|
||||
Zmth = UCD_SCRIPT_Zmth, /**< @brief Mathematical Notation */
|
||||
Zsym = UCD_SCRIPT_Zsym, /**< @brief Symbols */
|
||||
Zxxx = UCD_SCRIPT_Zxxx, /**< @brief Unwritten Documents */
|
||||
Zyyy = UCD_SCRIPT_Zyyy, /**< @brief Undetermined Script */
|
||||
Zzzz = UCD_SCRIPT_Zzzz, /**< @brief Uncoded Script */
|
||||
};
|
||||
|
||||
/** @brief Get a string representation of the script enumeration value.
|
||||
*
|
||||
* @param s The value to get the string representation for.
|
||||
*
|
||||
* @return The string representation, or "----" if the value is not recognized.
|
||||
*/
|
||||
inline const char *get_script_string(script s)
|
||||
{
|
||||
return ucd_get_script_string((ucd_script)s);
|
||||
}
|
||||
|
||||
/** @brief Lookup the Script for a Unicode codepoint.
|
||||
*
|
||||
* @param c The Unicode codepoint to lookup.
|
||||
* @return The Script of the Unicode codepoint.
|
||||
*/
|
||||
inline script lookup_script(codepoint_t c)
|
||||
{
|
||||
return (script)ucd_lookup_script(c);
|
||||
}
|
||||
|
||||
/** @brief Is the codepoint an alpha-numeric character?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is a letter or number, zero otherwise.
|
||||
*/
|
||||
inline int isalnum(codepoint_t c)
|
||||
{
|
||||
return ucd_isalnum(c);
|
||||
}
|
||||
|
||||
/** @brief Is the codepoint a letter?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is a letter, zero otherwise.
|
||||
*/
|
||||
inline int isalpha(codepoint_t c)
|
||||
{
|
||||
return ucd_isalpha(c);
|
||||
}
|
||||
|
||||
/** @brief Is the codepoint a control character?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is a control character, zero otherwise.
|
||||
*/
|
||||
inline int iscntrl(codepoint_t c)
|
||||
{
|
||||
return ucd_iscntrl(c);
|
||||
}
|
||||
|
||||
/** @brief Is the codepoint a numeric character?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is a number, zero otherwise.
|
||||
*/
|
||||
inline int isdigit(codepoint_t c)
|
||||
{
|
||||
return ucd_isdigit(c);
|
||||
}
|
||||
|
||||
/** @brief Does the codepoint have a displayable glyph?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint has a displayable glyph, zero otherwise.
|
||||
*/
|
||||
inline int isgraph(codepoint_t c)
|
||||
{
|
||||
return ucd_isgraph(c);
|
||||
}
|
||||
|
||||
/** @brief Is the codepoint a lower-case letter?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is a lower-case letter, zero otherwise.
|
||||
*/
|
||||
inline int islower(codepoint_t c)
|
||||
{
|
||||
return ucd_islower(c);
|
||||
}
|
||||
|
||||
/** @brief Is the codepoint a printable character?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is a printable character, zero otherwise.
|
||||
*/
|
||||
inline int isprint(codepoint_t c)
|
||||
{
|
||||
return ucd_isprint(c);
|
||||
}
|
||||
|
||||
/** @brief Is the codepoint a punctuation character?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is a punctuation character, zero otherwise.
|
||||
*/
|
||||
inline int ispunct(codepoint_t c)
|
||||
{
|
||||
return ucd_ispunct(c);
|
||||
}
|
||||
|
||||
/** @brief Is the codepoint a whitespace character?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is a whitespace character, zero otherwise.
|
||||
*/
|
||||
inline int isspace(codepoint_t c)
|
||||
{
|
||||
return ucd_isspace(c);
|
||||
}
|
||||
|
||||
/** @brief Is the codepoint an upper-case letter?
|
||||
*
|
||||
* @param c The Unicode codepoint to check.
|
||||
* @return Non-zero if the codepoint is an upper-case letter, zero otherwise.
|
||||
*/
|
||||
inline int isupper(codepoint_t c)
|
||||
{
|
||||
return ucd_isupper(c);
|
||||
}
|
||||
|
||||
/** @brief Convert the Unicode codepoint to upper-case.
|
||||
*
|
||||
* This function only uses the simple case mapping present in the
|
||||
* UnicodeData file. The data in SpecialCasing requires Unicode
|
||||
* codepoints to be mapped to multiple codepoints.
|
||||
*
|
||||
* @param c The Unicode codepoint to convert.
|
||||
* @return The upper-case Unicode codepoint for this codepoint, or
|
||||
* this codepoint if there is no upper-case codepoint.
|
||||
*/
|
||||
inline codepoint_t toupper(codepoint_t c)
|
||||
{
|
||||
return ucd_toupper(c);
|
||||
}
|
||||
|
||||
/** @brief Convert the Unicode codepoint to lower-case.
|
||||
*
|
||||
* This function only uses the simple case mapping present in the
|
||||
* UnicodeData file. The data in SpecialCasing requires Unicode
|
||||
* codepoints to be mapped to multiple codepoints.
|
||||
*
|
||||
* @param c The Unicode codepoint to convert.
|
||||
* @return The lower-case Unicode codepoint for this codepoint, or
|
||||
* this codepoint if there is no upper-case codepoint.
|
||||
*/
|
||||
inline codepoint_t tolower(codepoint_t c)
|
||||
{
|
||||
return ucd_tolower(c);
|
||||
}
|
||||
|
||||
/** @brief Convert the Unicode codepoint to title-case.
|
||||
*
|
||||
* This function only uses the simple case mapping present in the
|
||||
* UnicodeData file. The data in SpecialCasing requires Unicode
|
||||
* codepoints to be mapped to multiple codepoints.
|
||||
*
|
||||
* @param c The Unicode codepoint to convert.
|
||||
* @return The title-case Unicode codepoint for this codepoint, or
|
||||
* this codepoint if there is no upper-case codepoint.
|
||||
*/
|
||||
inline codepoint_t totitle(codepoint_t c)
|
||||
{
|
||||
return ucd_totitle(c);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,260 @@
|
||||
/* Enumeration types to string.
|
||||
*
|
||||
* Copyright (C) 2012-2016 Reece H. Dunn
|
||||
*
|
||||
* This file is part of ucd-tools.
|
||||
*
|
||||
* ucd-tools is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ucd-tools is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ucd/ucd.h"
|
||||
|
||||
const char *ucd_get_category_group_string(ucd_category_group c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case UCD_CATEGORY_GROUP_C: return "C";
|
||||
case UCD_CATEGORY_GROUP_I: return "I";
|
||||
case UCD_CATEGORY_GROUP_L: return "L";
|
||||
case UCD_CATEGORY_GROUP_M: return "M";
|
||||
case UCD_CATEGORY_GROUP_N: return "N";
|
||||
case UCD_CATEGORY_GROUP_P: return "P";
|
||||
case UCD_CATEGORY_GROUP_S: return "S";
|
||||
case UCD_CATEGORY_GROUP_Z: return "Z";
|
||||
default: return "-";
|
||||
}
|
||||
}
|
||||
|
||||
const char *ucd_get_category_string(ucd_category c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case UCD_CATEGORY_Cc: return "Cc";
|
||||
case UCD_CATEGORY_Cf: return "Cf";
|
||||
case UCD_CATEGORY_Cn: return "Cn";
|
||||
case UCD_CATEGORY_Co: return "Co";
|
||||
case UCD_CATEGORY_Cs: return "Cs";
|
||||
case UCD_CATEGORY_Ii: return "Ii";
|
||||
case UCD_CATEGORY_Ll: return "Ll";
|
||||
case UCD_CATEGORY_Lm: return "Lm";
|
||||
case UCD_CATEGORY_Lo: return "Lo";
|
||||
case UCD_CATEGORY_Lt: return "Lt";
|
||||
case UCD_CATEGORY_Lu: return "Lu";
|
||||
case UCD_CATEGORY_Mc: return "Mc";
|
||||
case UCD_CATEGORY_Me: return "Me";
|
||||
case UCD_CATEGORY_Mn: return "Mn";
|
||||
case UCD_CATEGORY_Nd: return "Nd";
|
||||
case UCD_CATEGORY_Nl: return "Nl";
|
||||
case UCD_CATEGORY_No: return "No";
|
||||
case UCD_CATEGORY_Pc: return "Pc";
|
||||
case UCD_CATEGORY_Pd: return "Pd";
|
||||
case UCD_CATEGORY_Pe: return "Pe";
|
||||
case UCD_CATEGORY_Pf: return "Pf";
|
||||
case UCD_CATEGORY_Pi: return "Pi";
|
||||
case UCD_CATEGORY_Po: return "Po";
|
||||
case UCD_CATEGORY_Ps: return "Ps";
|
||||
case UCD_CATEGORY_Sc: return "Sc";
|
||||
case UCD_CATEGORY_Sk: return "Sk";
|
||||
case UCD_CATEGORY_Sm: return "Sm";
|
||||
case UCD_CATEGORY_So: return "So";
|
||||
case UCD_CATEGORY_Zl: return "Zl";
|
||||
case UCD_CATEGORY_Zp: return "Zp";
|
||||
case UCD_CATEGORY_Zs: return "Zs";
|
||||
default: return "--";
|
||||
}
|
||||
}
|
||||
|
||||
const char *ucd_get_script_string(ucd_script s)
|
||||
{
|
||||
static const char *scripts[] =
|
||||
{
|
||||
"Adlm",
|
||||
"Afak",
|
||||
"Aghb",
|
||||
"Ahom",
|
||||
"Arab",
|
||||
"Armi",
|
||||
"Armn",
|
||||
"Avst",
|
||||
"Bali",
|
||||
"Bamu",
|
||||
"Bass",
|
||||
"Batk",
|
||||
"Beng",
|
||||
"Bhks",
|
||||
"Blis",
|
||||
"Bopo",
|
||||
"Brah",
|
||||
"Brai",
|
||||
"Bugi",
|
||||
"Buhd",
|
||||
"Cakm",
|
||||
"Cans",
|
||||
"Cari",
|
||||
"Cham",
|
||||
"Cher",
|
||||
"Cirt",
|
||||
"Copt",
|
||||
"Cprt",
|
||||
"Cyrl",
|
||||
"Cyrs",
|
||||
"Deva",
|
||||
"Dsrt",
|
||||
"Dupl",
|
||||
"Egyd",
|
||||
"Egyh",
|
||||
"Egyp",
|
||||
"Elba",
|
||||
"Ethi",
|
||||
"Geok",
|
||||
"Geor",
|
||||
"Glag",
|
||||
"Goth",
|
||||
"Gran",
|
||||
"Grek",
|
||||
"Gujr",
|
||||
"Guru",
|
||||
"Hang",
|
||||
"Hani",
|
||||
"Hano",
|
||||
"Hans",
|
||||
"Hant",
|
||||
"Hatr",
|
||||
"Hebr",
|
||||
"Hira",
|
||||
"Hluw",
|
||||
"Hmng",
|
||||
"Hrkt",
|
||||
"Hung",
|
||||
"Inds",
|
||||
"Ital",
|
||||
"Java",
|
||||
"Jpan",
|
||||
"Jurc",
|
||||
"Kali",
|
||||
"Kana",
|
||||
"Khar",
|
||||
"Khmr",
|
||||
"Khoj",
|
||||
"Knda",
|
||||
"Kore",
|
||||
"Kpel",
|
||||
"Kthi",
|
||||
"Lana",
|
||||
"Laoo",
|
||||
"Latf",
|
||||
"Latg",
|
||||
"Latn",
|
||||
"Lepc",
|
||||
"Limb",
|
||||
"Lina",
|
||||
"Linb",
|
||||
"Lisu",
|
||||
"Loma",
|
||||
"Lyci",
|
||||
"Lydi",
|
||||
"Mahj",
|
||||
"Mand",
|
||||
"Mani",
|
||||
"Marc",
|
||||
"Maya",
|
||||
"Mend",
|
||||
"Merc",
|
||||
"Mero",
|
||||
"Mlym",
|
||||
"Modi",
|
||||
"Mong",
|
||||
"Moon",
|
||||
"Mroo",
|
||||
"Mtei",
|
||||
"Mult",
|
||||
"Mymr",
|
||||
"Narb",
|
||||
"Nbat",
|
||||
"Newa",
|
||||
"Nkgb",
|
||||
"Nkoo",
|
||||
"Nshu",
|
||||
"Ogam",
|
||||
"Olck",
|
||||
"Orkh",
|
||||
"Orya",
|
||||
"Osge",
|
||||
"Osma",
|
||||
"Palm",
|
||||
"Pauc",
|
||||
"Perm",
|
||||
"Phag",
|
||||
"Phli",
|
||||
"Phlp",
|
||||
"Phlv",
|
||||
"Phnx",
|
||||
"Plrd",
|
||||
"Prti",
|
||||
"Qaak",
|
||||
"Rjng",
|
||||
"Roro",
|
||||
"Runr",
|
||||
"Samr",
|
||||
"Sara",
|
||||
"Sarb",
|
||||
"Saur",
|
||||
"Sgnw",
|
||||
"Shaw",
|
||||
"Shrd",
|
||||
"Sidd",
|
||||
"Sind",
|
||||
"Sinh",
|
||||
"Sora",
|
||||
"Sund",
|
||||
"Sylo",
|
||||
"Syrc",
|
||||
"Syre",
|
||||
"Syrj",
|
||||
"Syrn",
|
||||
"Tagb",
|
||||
"Takr",
|
||||
"Tale",
|
||||
"Talu",
|
||||
"Taml",
|
||||
"Tang",
|
||||
"Tavt",
|
||||
"Telu",
|
||||
"Teng",
|
||||
"Tfng",
|
||||
"Tglg",
|
||||
"Thaa",
|
||||
"Thai",
|
||||
"Tibt",
|
||||
"Tirh",
|
||||
"Ugar",
|
||||
"Vaii",
|
||||
"Visp",
|
||||
"Wara",
|
||||
"Wole",
|
||||
"Xpeo",
|
||||
"Xsux",
|
||||
"Yiii",
|
||||
"Zinh",
|
||||
"Zmth",
|
||||
"Zsym",
|
||||
"Zxxx",
|
||||
"Zyyy",
|
||||
"Zzzz",
|
||||
};
|
||||
|
||||
if ((unsigned int)s >= (sizeof(scripts)/sizeof(scripts[0])))
|
||||
return "----";
|
||||
return scripts[(unsigned int)s];
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2016 Reece H. Dunn
|
||||
*
|
||||
* This file is part of ucd-tools.
|
||||
*
|
||||
* ucd-tools is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ucd-tools is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ucd/ucd.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void fput_utf8c(FILE *out, codepoint_t c)
|
||||
{
|
||||
if (c < 0x80)
|
||||
fputc((uint8_t)c, out);
|
||||
else if (c < 0x800)
|
||||
{
|
||||
fputc(0xC0 | (c >> 6), out);
|
||||
fputc(0x80 + (c & 0x3F), out);
|
||||
}
|
||||
else if (c < 0x10000)
|
||||
{
|
||||
fputc(0xE0 | (c >> 12), out);
|
||||
fputc(0x80 + ((c >> 6) & 0x3F), out);
|
||||
fputc(0x80 + (c & 0x3F), out);
|
||||
}
|
||||
else if (c < 0x200000)
|
||||
{
|
||||
fputc(0xF0 | (c >> 18), out);
|
||||
fputc(0x80 + ((c >> 12) & 0x3F), out);
|
||||
fputc(0x80 + ((c >> 6) & 0x3F), out);
|
||||
fputc(0x80 + (c & 0x3F), out);
|
||||
}
|
||||
}
|
||||
|
||||
int fget_utf8c(FILE *in, codepoint_t *c)
|
||||
{
|
||||
int ch = EOF;
|
||||
if ((ch = fgetc(in)) == EOF) return 0;
|
||||
if ((uint8_t)ch < 0x80)
|
||||
*c = (uint8_t)ch;
|
||||
else switch ((uint8_t)ch & 0xF0)
|
||||
{
|
||||
default:
|
||||
*c = (uint8_t)ch & 0x1F;
|
||||
if ((ch = fgetc(in)) == EOF) return 0;
|
||||
*c = (*c << 6) + ((uint8_t)ch & 0x3F);
|
||||
break;
|
||||
case 0xE0:
|
||||
*c = (uint8_t)ch & 0x0F;
|
||||
if ((ch = fgetc(in)) == EOF) return 0;
|
||||
*c = (*c << 6) + ((uint8_t)ch & 0x3F);
|
||||
if ((ch = fgetc(in)) == EOF) return 0;
|
||||
*c = (*c << 6) + ((uint8_t)ch & 0x3F);
|
||||
break;
|
||||
case 0xF0:
|
||||
*c = (uint8_t)ch & 0x07;
|
||||
if ((ch = fgetc(in)) == EOF) return 0;
|
||||
*c = (*c << 6) + ((uint8_t)ch & 0x3F);
|
||||
if ((ch = fgetc(in)) == EOF) return 0;
|
||||
*c = (*c << 6) + ((uint8_t)ch & 0x3F);
|
||||
if ((ch = fgetc(in)) == EOF) return 0;
|
||||
*c = (*c << 6) + ((uint8_t)ch & 0x3F);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void uprintf_codepoint(FILE *out, codepoint_t c, char mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 'c': // character
|
||||
switch (c)
|
||||
{
|
||||
case '\t': fputs("\\t", out); break;
|
||||
case '\r': fputs("\\r", out); break;
|
||||
case '\n': fputs("\\n", out); break;
|
||||
default: fput_utf8c(out, c); break;
|
||||
}
|
||||
break;
|
||||
case 'h': // hexadecimal (lower)
|
||||
fprintf(out, "%06x", c);
|
||||
break;
|
||||
case 'H': // hexadecimal (upper)
|
||||
fprintf(out, "%06X", c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void uprintf(FILE *out, codepoint_t c, const char *format)
|
||||
{
|
||||
while (*format) switch (*format)
|
||||
{
|
||||
case '%':
|
||||
switch (*++format)
|
||||
{
|
||||
case 'c': // category
|
||||
fputs(ucd_get_category_string(ucd_lookup_category(c)), out);
|
||||
break;
|
||||
case 'C': // category group
|
||||
fputs(ucd_get_category_group_string(ucd_lookup_category_group(c)), out);
|
||||
break;
|
||||
case 'p': // codepoint
|
||||
uprintf_codepoint(out, c, *++format);
|
||||
break;
|
||||
case 'L': // lowercase
|
||||
uprintf_codepoint(out, ucd_tolower(c), *++format);
|
||||
break;
|
||||
case 's': // script
|
||||
fputs(ucd_get_script_string(ucd_lookup_script(c)), out);
|
||||
break;
|
||||
case 'T': // titlecase
|
||||
uprintf_codepoint(out, ucd_totitle(c), *++format);
|
||||
break;
|
||||
case 'U': // uppercase
|
||||
uprintf_codepoint(out, ucd_toupper(c), *++format);
|
||||
break;
|
||||
case 'W': // whitespace
|
||||
if (ucd_isspace(c))
|
||||
fputs("White_Space", out);
|
||||
break;
|
||||
}
|
||||
++format;
|
||||
break;
|
||||
default:
|
||||
fputc(*format, out);
|
||||
++format;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void print_file(FILE *in)
|
||||
{
|
||||
codepoint_t c = 0;
|
||||
while (fget_utf8c(in, &c))
|
||||
uprintf(stdout, c, "%pc\t%pH\t%s\t%c\t%Uc\t%Lc\t%Tc\t%W\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc == 2)
|
||||
{
|
||||
if (!strcmp(argv[1], "--stdin") || !strcmp(argv[1], "-"))
|
||||
print_file(stdin);
|
||||
else
|
||||
{
|
||||
FILE *in = fopen(argv[1], "r");
|
||||
if (in)
|
||||
{
|
||||
print_file(in);
|
||||
fclose(in);
|
||||
}
|
||||
else
|
||||
fprintf(stdout, "cannot open `%s`\n", argv[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (codepoint_t c = 0; c <= 0x10FFFF; ++c)
|
||||
uprintf(stdout, c, "%pH %s %C %c %UH %LH %TH %W\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2016 Reece H. Dunn
|
||||
*
|
||||
* This file is part of ucd-tools.
|
||||
*
|
||||
* ucd-tools is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ucd-tools is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ucd/ucd.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void fput_utf8c(FILE *out, ucd::codepoint_t c)
|
||||
{
|
||||
if (c < 0x80)
|
||||
fputc((uint8_t)c, out);
|
||||
else if (c < 0x800)
|
||||
{
|
||||
fputc(0xC0 | (c >> 6), out);
|
||||
fputc(0x80 + (c & 0x3F), out);
|
||||
}
|
||||
else if (c < 0x10000)
|
||||
{
|
||||
fputc(0xE0 | (c >> 12), out);
|
||||
fputc(0x80 + ((c >> 6) & 0x3F), out);
|
||||
fputc(0x80 + (c & 0x3F), out);
|
||||
}
|
||||
else if (c < 0x200000)
|
||||
{
|
||||
fputc(0xF0 | (c >> 18), out);
|
||||
fputc(0x80 + ((c >> 12) & 0x3F), out);
|
||||
fputc(0x80 + ((c >> 6) & 0x3F), out);
|
||||
fputc(0x80 + (c & 0x3F), out);
|
||||
}
|
||||
}
|
||||
|
||||
bool fget_utf8c(FILE *in, ucd::codepoint_t &c)
|
||||
{
|
||||
int ch = EOF;
|
||||
if ((ch = fgetc(in)) == EOF) return false;
|
||||
if (uint8_t(ch) < 0x80)
|
||||
c = uint8_t(ch);
|
||||
else switch (uint8_t(ch) & 0xF0)
|
||||
{
|
||||
default:
|
||||
c = uint8_t(ch) & 0x1F;
|
||||
if ((ch = fgetc(in)) == EOF) return false;
|
||||
c = (c << 6) + (uint8_t(ch) & 0x3F);
|
||||
break;
|
||||
case 0xE0:
|
||||
c = uint8_t(ch) & 0x0F;
|
||||
if ((ch = fgetc(in)) == EOF) return false;
|
||||
c = (c << 6) + (uint8_t(ch) & 0x3F);
|
||||
if ((ch = fgetc(in)) == EOF) return false;
|
||||
c = (c << 6) + (uint8_t(ch) & 0x3F);
|
||||
break;
|
||||
case 0xF0:
|
||||
c = uint8_t(ch) & 0x07;
|
||||
if ((ch = fgetc(in)) == EOF) return false;
|
||||
c = (c << 6) + (uint8_t(ch) & 0x3F);
|
||||
if ((ch = fgetc(in)) == EOF) return false;
|
||||
c = (c << 6) + (uint8_t(ch) & 0x3F);
|
||||
if ((ch = fgetc(in)) == EOF) return false;
|
||||
c = (c << 6) + (uint8_t(ch) & 0x3F);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void uprintf_codepoint(FILE *out, ucd::codepoint_t c, char mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 'c': // character
|
||||
switch (c)
|
||||
{
|
||||
case '\t': fputs("\\t", out); break;
|
||||
case '\r': fputs("\\r", out); break;
|
||||
case '\n': fputs("\\n", out); break;
|
||||
default: fput_utf8c(out, c); break;
|
||||
}
|
||||
break;
|
||||
case 'h': // hexadecimal (lower)
|
||||
fprintf(out, "%06x", c);
|
||||
break;
|
||||
case 'H': // hexadecimal (upper)
|
||||
fprintf(out, "%06X", c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void uprintf(FILE *out, ucd::codepoint_t c, const char *format)
|
||||
{
|
||||
while (*format) switch (*format)
|
||||
{
|
||||
case '%':
|
||||
switch (*++format)
|
||||
{
|
||||
case 'c': // category
|
||||
fputs(ucd::get_category_string(ucd::lookup_category(c)), out);
|
||||
break;
|
||||
case 'C': // category group
|
||||
fputs(ucd::get_category_group_string(ucd::lookup_category_group(c)), out);
|
||||
break;
|
||||
case 'p': // codepoint
|
||||
uprintf_codepoint(out, c, *++format);
|
||||
break;
|
||||
case 'L': // lowercase
|
||||
uprintf_codepoint(out, ucd::tolower(c), *++format);
|
||||
break;
|
||||
case 's': // script
|
||||
fputs(ucd::get_script_string(ucd::lookup_script(c)), out);
|
||||
break;
|
||||
case 'T': // titlecase
|
||||
uprintf_codepoint(out, ucd::totitle(c), *++format);
|
||||
break;
|
||||
case 'U': // uppercase
|
||||
uprintf_codepoint(out, ucd::toupper(c), *++format);
|
||||
break;
|
||||
case 'W': // whitespace
|
||||
if (ucd::isspace(c))
|
||||
fputs("White_Space", out);
|
||||
break;
|
||||
}
|
||||
++format;
|
||||
break;
|
||||
default:
|
||||
fputc(*format, out);
|
||||
++format;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void print_file(FILE *in)
|
||||
{
|
||||
ucd::codepoint_t c = 0;
|
||||
while (fget_utf8c(in, c))
|
||||
uprintf(stdout, c, "%pc\t%pH\t%s\t%c\t%Uc\t%Lc\t%Tc\t%W\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc == 2)
|
||||
{
|
||||
if (!strcmp(argv[1], "--stdin") || !strcmp(argv[1], "-"))
|
||||
print_file(stdin);
|
||||
else
|
||||
{
|
||||
FILE *in = fopen(argv[1], "r");
|
||||
if (in)
|
||||
{
|
||||
print_file(in);
|
||||
fclose(in);
|
||||
}
|
||||
else
|
||||
fprintf(stdout, "cannot open `%s`\n", argv[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ucd::codepoint_t c = 0; c <= 0x10FFFF; ++c)
|
||||
uprintf(stdout, c, "%pH %s %C %c %UH %LH %TH %W\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Executable
+98
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright (C) 2012-2016 Reece H. Dunn
|
||||
#
|
||||
# This file is part of ucd-tools.
|
||||
#
|
||||
# ucd-tools is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ucd-tools is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import ucd
|
||||
|
||||
ucd_rootdir = sys.argv[1]
|
||||
ucd_version = sys.argv[2]
|
||||
|
||||
unicode_chars = {}
|
||||
null = ucd.CodePoint('0000')
|
||||
for data in ucd.parse_ucd_data(ucd_rootdir, 'UnicodeData'):
|
||||
if data['LowerCase'] != null or data['UpperCase'] != null or data['TitleCase'] != null:
|
||||
unicode_chars[data['CodePoint']] = (data['LowerCase'], data['UpperCase'], data['TitleCase'])
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.stdout.write("""/* Unicode Case Conversion
|
||||
*
|
||||
* Copyright (C) 2012-2016 Reece H. Dunn
|
||||
*
|
||||
* This file is part of ucd-tools.
|
||||
*
|
||||
* ucd-tools is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ucd-tools is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// NOTE: This file is automatically generated from the UnicodeData.txt file in
|
||||
// the Unicode Character database by the ucd-tools/tools/categories.py script.
|
||||
|
||||
#include "ucd/ucd.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
// Unicode Character Data %s
|
||||
|
||||
struct case_conversion_entry
|
||||
{
|
||||
codepoint_t codepoint;
|
||||
codepoint_t uppercase;
|
||||
codepoint_t lowercase;
|
||||
codepoint_t titlecase;
|
||||
};
|
||||
""" % ucd_version)
|
||||
|
||||
sys.stdout.write('\n')
|
||||
sys.stdout.write('static const struct case_conversion_entry case_conversion_data[] =\n')
|
||||
sys.stdout.write('{\n')
|
||||
for codepoint in sorted(unicode_chars.keys()):
|
||||
lower, upper, title = unicode_chars[codepoint]
|
||||
sys.stdout.write('\t{ 0x%s, 0x%s, 0x%s, 0x%s },\n' % (codepoint, upper, lower, title))
|
||||
sys.stdout.write('};\n')
|
||||
|
||||
for case in ['upper', 'lower', 'title']:
|
||||
sys.stdout.write('\n')
|
||||
sys.stdout.write('codepoint_t ucd_to%s(codepoint_t c)\n' % case)
|
||||
sys.stdout.write('{\n')
|
||||
sys.stdout.write('\tint begin = 0;\n')
|
||||
sys.stdout.write('\tint end = sizeof(case_conversion_data)/sizeof(case_conversion_data[0]);\n')
|
||||
sys.stdout.write('\twhile (begin <= end)\n')
|
||||
sys.stdout.write('\t{\n')
|
||||
sys.stdout.write('\t\tint pos = (begin + end) / 2;\n')
|
||||
sys.stdout.write('\t\tconst struct case_conversion_entry *item = (case_conversion_data + pos);\n')
|
||||
sys.stdout.write('\t\tif (c == item->codepoint)\n')
|
||||
sys.stdout.write('\t\t\treturn item->%scase == 0 ? c : item->%scase;\n' % (case, case))
|
||||
sys.stdout.write('\t\telse if (c > item->codepoint)\n')
|
||||
sys.stdout.write('\t\t\tbegin = pos + 1;\n')
|
||||
sys.stdout.write('\t\telse\n')
|
||||
sys.stdout.write('\t\t\tend = pos - 1;\n')
|
||||
sys.stdout.write('\t}\n')
|
||||
sys.stdout.write('\treturn c;\n')
|
||||
sys.stdout.write('}\n')
|
||||
Executable
+238
@@ -0,0 +1,238 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright (C) 2012-2016 Reece H. Dunn
|
||||
#
|
||||
# This file is part of ucd-tools.
|
||||
#
|
||||
# ucd-tools is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ucd-tools is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import ucd
|
||||
|
||||
ucd_rootdir = sys.argv[1]
|
||||
ucd_version = sys.argv[2]
|
||||
|
||||
unicode_chars = {}
|
||||
for data in ucd.parse_ucd_data(ucd_rootdir, 'UnicodeData'):
|
||||
for codepoint in data['CodePoint']:
|
||||
unicode_chars[codepoint] = data['GeneralCategory']
|
||||
if '--with-csur' in sys.argv:
|
||||
for csur in ['Klingon']:
|
||||
for data in ucd.parse_ucd_data('data/csur', csur):
|
||||
for codepoint in data['CodePoint']:
|
||||
unicode_chars[codepoint] = data['GeneralCategory']
|
||||
|
||||
# This map is a combination of the information in the UnicodeData and Blocks
|
||||
# data files. It is intended to reduce the number of character tables that
|
||||
# need to be generated.
|
||||
category_sets = [
|
||||
(ucd.CodeRange('000000..00D7FF'), None, 'Multiple Blocks'),
|
||||
(ucd.CodeRange('00D800..00DFFF'), 'Cs', 'Surrogates'),
|
||||
(ucd.CodeRange('00E000..00F7FF'), 'Co', 'Private Use Area'),
|
||||
(ucd.CodeRange('00F800..02FAFF'), None, 'Multiple Blocks'),
|
||||
(ucd.CodeRange('02FB00..0DFFFF'), 'Cn', 'Unassigned'),
|
||||
(ucd.CodeRange('0E0000..0E01FF'), None, 'Multiple Blocks'),
|
||||
(ucd.CodeRange('0E0200..0EFFFF'), 'Cn', 'Unassigned'),
|
||||
(ucd.CodeRange('0F0000..0FFFFD'), 'Co', 'Plane 15 Private Use'),
|
||||
(ucd.CodeRange('0FFFFE..0FFFFF'), 'Cn', 'Plane 15 Private Use'),
|
||||
(ucd.CodeRange('100000..10FFFD'), 'Co', 'Plane 16 Private Use'),
|
||||
(ucd.CodeRange('10FFFE..10FFFF'), 'Cn', 'Plane 16 Private Use'),
|
||||
]
|
||||
|
||||
# These categories have many pages consisting of just this category:
|
||||
# Cn -- Unassigned
|
||||
# Lo -- CJK Ideographs
|
||||
special_categories = ['Cn', 'Co', 'Lo', 'Sm', 'So']
|
||||
|
||||
category_tables = {}
|
||||
for codepoints, category, comment in category_sets:
|
||||
if not category:
|
||||
table = {}
|
||||
table_entry = None
|
||||
table_codepoint = None
|
||||
table_category = None
|
||||
for i, codepoint in enumerate(codepoints):
|
||||
try:
|
||||
category = unicode_chars[codepoint]
|
||||
except KeyError:
|
||||
category = 'Cn' # Unassigned
|
||||
if (i % 256) == 0:
|
||||
if table_entry:
|
||||
if table_category in special_categories:
|
||||
table[table_codepoint] = table_category
|
||||
elif table_category:
|
||||
raise Exception('%s only table not in the special_categories list.' % table_category)
|
||||
else:
|
||||
table[table_codepoint] = table_entry
|
||||
table_entry = []
|
||||
table_codepoint = codepoint
|
||||
table_category = category
|
||||
if category != table_category:
|
||||
table_category = None
|
||||
table_entry.append(category)
|
||||
if table_entry:
|
||||
if table_category in special_categories:
|
||||
table[table_codepoint] = table_category
|
||||
else:
|
||||
table[table_codepoint] = table_entry
|
||||
category_tables['%s_%s' % (codepoints.first, codepoints.last)] = table
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.stdout.write("""/* Unicode General Categories
|
||||
*
|
||||
* Copyright (C) 2012-2016 Reece H. Dunn
|
||||
*
|
||||
* This file is part of ucd-tools.
|
||||
*
|
||||
* ucd-tools is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ucd-tools is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// NOTE: This file is automatically generated from the UnicodeData.txt file in
|
||||
// the Unicode Character database by the ucd-tools/tools/categories.py script.
|
||||
|
||||
#include "ucd/ucd.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#define Cc UCD_CATEGORY_Cc
|
||||
#define Cf UCD_CATEGORY_Cf
|
||||
#define Cn UCD_CATEGORY_Cn
|
||||
#define Co UCD_CATEGORY_Co
|
||||
#define Cs UCD_CATEGORY_Cs
|
||||
#define Ll UCD_CATEGORY_Ll
|
||||
#define Lm UCD_CATEGORY_Lm
|
||||
#define Lo UCD_CATEGORY_Lo
|
||||
#define Lt UCD_CATEGORY_Lt
|
||||
#define Lu UCD_CATEGORY_Lu
|
||||
#define Mc UCD_CATEGORY_Mc
|
||||
#define Me UCD_CATEGORY_Me
|
||||
#define Mn UCD_CATEGORY_Mn
|
||||
#define Nd UCD_CATEGORY_Nd
|
||||
#define Nl UCD_CATEGORY_Nl
|
||||
#define No UCD_CATEGORY_No
|
||||
#define Pc UCD_CATEGORY_Pc
|
||||
#define Pd UCD_CATEGORY_Pd
|
||||
#define Pe UCD_CATEGORY_Pe
|
||||
#define Pf UCD_CATEGORY_Pf
|
||||
#define Pi UCD_CATEGORY_Pi
|
||||
#define Po UCD_CATEGORY_Po
|
||||
#define Ps UCD_CATEGORY_Ps
|
||||
#define Sc UCD_CATEGORY_Sc
|
||||
#define Sk UCD_CATEGORY_Sk
|
||||
#define Sm UCD_CATEGORY_Sm
|
||||
#define So UCD_CATEGORY_So
|
||||
#define Zl UCD_CATEGORY_Zl
|
||||
#define Zp UCD_CATEGORY_Zp
|
||||
#define Zs UCD_CATEGORY_Zs
|
||||
#define Ii UCD_CATEGORY_Ii
|
||||
|
||||
// Unicode Character Data %s
|
||||
""" % ucd_version)
|
||||
|
||||
for category in special_categories:
|
||||
sys.stdout.write('\n')
|
||||
sys.stdout.write('static const uint8_t categories_%s[256] =\n' % category)
|
||||
sys.stdout.write('{')
|
||||
for i in range(0, 256):
|
||||
if (i % 16) == 0:
|
||||
sys.stdout.write('\n\t/* %02X */' % i)
|
||||
sys.stdout.write(' %s,' % category)
|
||||
sys.stdout.write('\n};\n')
|
||||
|
||||
for codepoints, category, comment in category_sets:
|
||||
if not category:
|
||||
tables = category_tables['%s_%s' % (codepoints.first, codepoints.last)]
|
||||
for codepoint in sorted(tables.keys()):
|
||||
table = tables[codepoint]
|
||||
if table in special_categories:
|
||||
continue
|
||||
|
||||
sys.stdout.write('\n')
|
||||
sys.stdout.write('static const uint8_t categories_%s[256] =\n' % codepoint)
|
||||
sys.stdout.write('{')
|
||||
for i, category in enumerate(table):
|
||||
if (i % 16) == 0:
|
||||
sys.stdout.write('\n\t/* %02X */' % i)
|
||||
sys.stdout.write(' %s,' % category)
|
||||
sys.stdout.write('\n};\n')
|
||||
|
||||
for codepoints, category, comment in category_sets:
|
||||
if not category:
|
||||
table_index = '%s_%s' % (codepoints.first, codepoints.last)
|
||||
sys.stdout.write('\n')
|
||||
sys.stdout.write('static const uint8_t *categories_%s[] =\n' % table_index)
|
||||
sys.stdout.write('{\n')
|
||||
for codepoint, table in sorted(category_tables[table_index].items()):
|
||||
if isinstance(table, str):
|
||||
sys.stdout.write('\tcategories_%s, // %s\n' % (table, codepoint))
|
||||
else:
|
||||
sys.stdout.write('\tcategories_%s,\n' % codepoint)
|
||||
sys.stdout.write('};\n')
|
||||
|
||||
sys.stdout.write('\n')
|
||||
sys.stdout.write('ucd_category ucd_lookup_category(codepoint_t c)\n')
|
||||
sys.stdout.write('{\n')
|
||||
for codepoints, category, comment in category_sets:
|
||||
if category:
|
||||
sys.stdout.write('\tif (c <= 0x%s) return %s; // %s : %s\n' % (codepoints.last, category, codepoints, comment))
|
||||
else:
|
||||
sys.stdout.write('\tif (c <= 0x%s) // %s\n' % (codepoints.last, codepoints))
|
||||
sys.stdout.write('\t{\n')
|
||||
sys.stdout.write('\t\tconst uint8_t *table = categories_%s_%s[(c - 0x%s) / 256];\n' % (codepoints.first, codepoints.last, codepoints.first))
|
||||
sys.stdout.write('\t\treturn (ucd_category)table[c % 256];\n')
|
||||
sys.stdout.write('\t}\n')
|
||||
sys.stdout.write('\treturn Ii; // Invalid Unicode Codepoint\n')
|
||||
sys.stdout.write('}\n')
|
||||
|
||||
sys.stdout.write("""
|
||||
ucd_category_group ucd_get_category_group_for_category(ucd_category c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case Cc: case Cf: case Cn: case Co: case Cs:
|
||||
return UCD_CATEGORY_GROUP_C;
|
||||
case Ll: case Lm: case Lo: case Lt: case Lu:
|
||||
return UCD_CATEGORY_GROUP_L;
|
||||
case Mc: case Me: case Mn:
|
||||
return UCD_CATEGORY_GROUP_M;
|
||||
case Nd: case Nl: case No:
|
||||
return UCD_CATEGORY_GROUP_N;
|
||||
case Pc: case Pd: case Pe: case Pf: case Pi: case Po: case Ps:
|
||||
return UCD_CATEGORY_GROUP_P;
|
||||
case Sc: case Sk: case Sm: case So:
|
||||
return UCD_CATEGORY_GROUP_S;
|
||||
case Zl: case Zp: case Zs:
|
||||
return UCD_CATEGORY_GROUP_Z;
|
||||
case Ii:
|
||||
return UCD_CATEGORY_GROUP_I;
|
||||
}
|
||||
}
|
||||
|
||||
ucd_category_group ucd_lookup_category_group(codepoint_t c)
|
||||
{
|
||||
return (ucd_category_group)ucd_get_category_group_for_category(ucd_lookup_category(c));
|
||||
}
|
||||
""")
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright (C) 2012 Reece H. Dunn
|
||||
#
|
||||
# This file is part of ucd-tools.
|
||||
#
|
||||
# ucd-tools is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ucd-tools is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import ucd
|
||||
|
||||
ucd_rootdir = sys.argv[1]
|
||||
csur_rootdir = 'data/csur'
|
||||
|
||||
unicode_chars = {}
|
||||
for data in ucd.parse_ucd_data(ucd_rootdir, 'UnicodeData'):
|
||||
for codepoint in data['CodePoint']:
|
||||
unicode_chars[codepoint] = data
|
||||
unicode_chars[codepoint]['Properties'] = []
|
||||
for data in ucd.parse_ucd_data(ucd_rootdir, 'PropList'):
|
||||
if data['Property'] in ['White_Space']:
|
||||
for codepoint in data['Range']:
|
||||
unicode_chars[codepoint]['Properties'].append(data['Property'])
|
||||
for data in ucd.parse_ucd_data(ucd_rootdir, 'Scripts'):
|
||||
for codepoint in data['Range']:
|
||||
unicode_chars[codepoint]['Script'] = data['Script']
|
||||
if '--with-csur' in sys.argv:
|
||||
for csur in ['Klingon']:
|
||||
for data in ucd.parse_ucd_data('data/csur', csur):
|
||||
for codepoint in data['CodePoint']:
|
||||
if not 'TitleCase' in data: data['TitleCase'] = codepoint
|
||||
if not 'UpperCase' in data: data['UpperCase'] = codepoint
|
||||
if not 'LowerCase' in data: data['LowerCase'] = codepoint
|
||||
if not 'Properties' in data: data['Properties'] = []
|
||||
unicode_chars[codepoint] = data
|
||||
|
||||
null = ucd.CodePoint('0000')
|
||||
if __name__ == '__main__':
|
||||
for codepoint in ucd.CodeRange('000000..10FFFF'):
|
||||
try:
|
||||
data = unicode_chars[codepoint]
|
||||
except KeyError:
|
||||
data = {'GeneralCategory': 'Cn', 'TitleCase': codepoint, 'UpperCase': codepoint, 'LowerCase': codepoint, 'Properties': []}
|
||||
try:
|
||||
script = data['Script']
|
||||
except KeyError:
|
||||
script = 'Zzzz'
|
||||
title = data['TitleCase']
|
||||
upper = data['UpperCase']
|
||||
lower = data['LowerCase']
|
||||
if title == null: title = codepoint
|
||||
if upper == null: upper = codepoint
|
||||
if lower == null: lower = codepoint
|
||||
print('%s %s %s %s %s %s %s %s' % (
|
||||
codepoint, script,
|
||||
data['GeneralCategory'][0], data['GeneralCategory'],
|
||||
upper, lower, title,
|
||||
' '.join(data['Properties'])))
|
||||
Executable
+344
@@ -0,0 +1,344 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright (C) 2012-2016 Reece H. Dunn
|
||||
#
|
||||
# This file is part of ucd-tools.
|
||||
#
|
||||
# ucd-tools is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ucd-tools is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import ucd
|
||||
|
||||
ucd_rootdir = sys.argv[1]
|
||||
ucd_version = sys.argv[2]
|
||||
|
||||
unicode_chars = {}
|
||||
for data in ucd.parse_ucd_data(ucd_rootdir, 'Scripts'):
|
||||
for codepoint in data['Range']:
|
||||
unicode_chars[codepoint] = data['Script']
|
||||
if '--with-csur' in sys.argv:
|
||||
for csur in ['Klingon']:
|
||||
for data in ucd.parse_ucd_data('data/csur', csur):
|
||||
for codepoint in data['CodePoint']:
|
||||
unicode_chars[codepoint] = data['Script']
|
||||
|
||||
# This map is a combination of the information in the UnicodeData and Blocks
|
||||
# data files. It is intended to reduce the number of character tables that
|
||||
# need to be generated.
|
||||
script_sets = [
|
||||
(ucd.CodeRange('000000..00D7FF'), None, 'Multiple Blocks'),
|
||||
(ucd.CodeRange('00D800..00F7FF'), 'Zzzz', 'Surrogates / Private Use Area'),
|
||||
(ucd.CodeRange('00F800..02FAFF'), None, 'Multiple Blocks'),
|
||||
(ucd.CodeRange('02FB00..0DFFFF'), 'Zzzz', 'Unassigned'),
|
||||
(ucd.CodeRange('0E0000..0E01FF'), None, 'Multiple Blocks'),
|
||||
(ucd.CodeRange('0E0200..10FFFF'), 'Zzzz', 'Unassigned'),
|
||||
]
|
||||
|
||||
# These scripts have many pages consisting of just this script:
|
||||
special_scripts = []
|
||||
|
||||
script_tables = {}
|
||||
for codepoints, script, comment in script_sets:
|
||||
if not script:
|
||||
table = {}
|
||||
table_entry = None
|
||||
table_codepoint = None
|
||||
table_script = None
|
||||
for i, codepoint in enumerate(codepoints):
|
||||
try:
|
||||
script = unicode_chars[codepoint]
|
||||
except KeyError:
|
||||
script = 'Zzzz' # Unknown
|
||||
if (i % 256) == 0:
|
||||
if table_entry:
|
||||
if table_script in special_scripts:
|
||||
table[table_codepoint] = table_script
|
||||
elif table_script:
|
||||
special_scripts.append(table_script)
|
||||
table[table_codepoint] = table_script
|
||||
else:
|
||||
table[table_codepoint] = table_entry
|
||||
table_entry = []
|
||||
table_codepoint = codepoint
|
||||
table_script = script
|
||||
if script != table_script:
|
||||
table_script = None
|
||||
table_entry.append(script)
|
||||
if table_entry:
|
||||
if table_script in special_scripts:
|
||||
table[table_codepoint] = table_script
|
||||
else:
|
||||
table[table_codepoint] = table_entry
|
||||
script_tables['%s_%s' % (codepoints.first, codepoints.last)] = table
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.stdout.write("""/* Unicode Scripts
|
||||
*
|
||||
* Copyright (C) 2012-2016 Reece H. Dunn
|
||||
*
|
||||
* This file is part of ucd-tools.
|
||||
*
|
||||
* ucd-tools is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ucd-tools is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// NOTE: This file is automatically generated from the Scripts.txt file in
|
||||
// the Unicode Character database by the ucd-tools/tools/scripts.py script.
|
||||
|
||||
#include "ucd/ucd.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#define Adlm UCD_SCRIPT_Adlm
|
||||
#define Afak UCD_SCRIPT_Afak
|
||||
#define Aghb UCD_SCRIPT_Aghb
|
||||
#define Ahom UCD_SCRIPT_Ahom
|
||||
#define Arab UCD_SCRIPT_Arab
|
||||
#define Armi UCD_SCRIPT_Armi
|
||||
#define Armn UCD_SCRIPT_Armn
|
||||
#define Avst UCD_SCRIPT_Avst
|
||||
#define Bali UCD_SCRIPT_Bali
|
||||
#define Bamu UCD_SCRIPT_Bamu
|
||||
#define Bass UCD_SCRIPT_Bass
|
||||
#define Batk UCD_SCRIPT_Batk
|
||||
#define Beng UCD_SCRIPT_Beng
|
||||
#define Bhks UCD_SCRIPT_Bhks
|
||||
#define Blis UCD_SCRIPT_Blis
|
||||
#define Bopo UCD_SCRIPT_Bopo
|
||||
#define Brah UCD_SCRIPT_Brah
|
||||
#define Brai UCD_SCRIPT_Brai
|
||||
#define Bugi UCD_SCRIPT_Bugi
|
||||
#define Buhd UCD_SCRIPT_Buhd
|
||||
#define Cakm UCD_SCRIPT_Cakm
|
||||
#define Cans UCD_SCRIPT_Cans
|
||||
#define Cari UCD_SCRIPT_Cari
|
||||
#define Cham UCD_SCRIPT_Cham
|
||||
#define Cher UCD_SCRIPT_Cher
|
||||
#define Cirt UCD_SCRIPT_Cirt
|
||||
#define Copt UCD_SCRIPT_Copt
|
||||
#define Cprt UCD_SCRIPT_Cprt
|
||||
#define Cyrl UCD_SCRIPT_Cyrl
|
||||
#define Cyrs UCD_SCRIPT_Cyrs
|
||||
#define Deva UCD_SCRIPT_Deva
|
||||
#define Dsrt UCD_SCRIPT_Dsrt
|
||||
#define Dupl UCD_SCRIPT_Dupl
|
||||
#define Egyd UCD_SCRIPT_Egyd
|
||||
#define Egyh UCD_SCRIPT_Egyh
|
||||
#define Egyp UCD_SCRIPT_Egyp
|
||||
#define Elba UCD_SCRIPT_Elba
|
||||
#define Ethi UCD_SCRIPT_Ethi
|
||||
#define Geok UCD_SCRIPT_Geok
|
||||
#define Geor UCD_SCRIPT_Geor
|
||||
#define Glag UCD_SCRIPT_Glag
|
||||
#define Goth UCD_SCRIPT_Goth
|
||||
#define Gran UCD_SCRIPT_Gran
|
||||
#define Grek UCD_SCRIPT_Grek
|
||||
#define Gujr UCD_SCRIPT_Gujr
|
||||
#define Guru UCD_SCRIPT_Guru
|
||||
#define Hang UCD_SCRIPT_Hang
|
||||
#define Hani UCD_SCRIPT_Hani
|
||||
#define Hano UCD_SCRIPT_Hano
|
||||
#define Hans UCD_SCRIPT_Hans
|
||||
#define Hant UCD_SCRIPT_Hant
|
||||
#define Hatr UCD_SCRIPT_Hatr
|
||||
#define Hebr UCD_SCRIPT_Hebr
|
||||
#define Hira UCD_SCRIPT_Hira
|
||||
#define Hluw UCD_SCRIPT_Hluw
|
||||
#define Hmng UCD_SCRIPT_Hmng
|
||||
#define Hrkt UCD_SCRIPT_Hrkt
|
||||
#define Hung UCD_SCRIPT_Hung
|
||||
#define Inds UCD_SCRIPT_Inds
|
||||
#define Ital UCD_SCRIPT_Ital
|
||||
#define Java UCD_SCRIPT_Java
|
||||
#define Jpan UCD_SCRIPT_Jpan
|
||||
#define Jurc UCD_SCRIPT_Jurc
|
||||
#define Kali UCD_SCRIPT_Kali
|
||||
#define Kana UCD_SCRIPT_Kana
|
||||
#define Khar UCD_SCRIPT_Khar
|
||||
#define Khmr UCD_SCRIPT_Khmr
|
||||
#define Khoj UCD_SCRIPT_Khoj
|
||||
#define Knda UCD_SCRIPT_Knda
|
||||
#define Kore UCD_SCRIPT_Kore
|
||||
#define Kpel UCD_SCRIPT_Kpel
|
||||
#define Kthi UCD_SCRIPT_Kthi
|
||||
#define Lana UCD_SCRIPT_Lana
|
||||
#define Laoo UCD_SCRIPT_Laoo
|
||||
#define Latf UCD_SCRIPT_Latf
|
||||
#define Latg UCD_SCRIPT_Latg
|
||||
#define Latn UCD_SCRIPT_Latn
|
||||
#define Lepc UCD_SCRIPT_Lepc
|
||||
#define Limb UCD_SCRIPT_Limb
|
||||
#define Lina UCD_SCRIPT_Lina
|
||||
#define Linb UCD_SCRIPT_Linb
|
||||
#define Lisu UCD_SCRIPT_Lisu
|
||||
#define Loma UCD_SCRIPT_Loma
|
||||
#define Lyci UCD_SCRIPT_Lyci
|
||||
#define Lydi UCD_SCRIPT_Lydi
|
||||
#define Mahj UCD_SCRIPT_Mahj
|
||||
#define Mand UCD_SCRIPT_Mand
|
||||
#define Mani UCD_SCRIPT_Mani
|
||||
#define Marc UCD_SCRIPT_Marc
|
||||
#define Maya UCD_SCRIPT_Maya
|
||||
#define Mend UCD_SCRIPT_Mend
|
||||
#define Merc UCD_SCRIPT_Merc
|
||||
#define Mero UCD_SCRIPT_Mero
|
||||
#define Mlym UCD_SCRIPT_Mlym
|
||||
#define Modi UCD_SCRIPT_Modi
|
||||
#define Mong UCD_SCRIPT_Mong
|
||||
#define Moon UCD_SCRIPT_Moon
|
||||
#define Mroo UCD_SCRIPT_Mroo
|
||||
#define Mtei UCD_SCRIPT_Mtei
|
||||
#define Mult UCD_SCRIPT_Mult
|
||||
#define Mymr UCD_SCRIPT_Mymr
|
||||
#define Narb UCD_SCRIPT_Narb
|
||||
#define Nbat UCD_SCRIPT_Nbat
|
||||
#define Newa UCD_SCRIPT_Newa
|
||||
#define Nkgb UCD_SCRIPT_Nkgb
|
||||
#define Nkoo UCD_SCRIPT_Nkoo
|
||||
#define Nshu UCD_SCRIPT_Nshu
|
||||
#define Ogam UCD_SCRIPT_Ogam
|
||||
#define Olck UCD_SCRIPT_Olck
|
||||
#define Orkh UCD_SCRIPT_Orkh
|
||||
#define Orya UCD_SCRIPT_Orya
|
||||
#define Osge UCD_SCRIPT_Osge
|
||||
#define Osma UCD_SCRIPT_Osma
|
||||
#define Palm UCD_SCRIPT_Palm
|
||||
#define Pauc UCD_SCRIPT_Pauc
|
||||
#define Perm UCD_SCRIPT_Perm
|
||||
#define Phag UCD_SCRIPT_Phag
|
||||
#define Phli UCD_SCRIPT_Phli
|
||||
#define Phlp UCD_SCRIPT_Phlp
|
||||
#define Phlv UCD_SCRIPT_Phlv
|
||||
#define Phnx UCD_SCRIPT_Phnx
|
||||
#define Plrd UCD_SCRIPT_Plrd
|
||||
#define Prti UCD_SCRIPT_Prti
|
||||
#define Qaak UCD_SCRIPT_Qaak
|
||||
#define Rjng UCD_SCRIPT_Rjng
|
||||
#define Roro UCD_SCRIPT_Roro
|
||||
#define Runr UCD_SCRIPT_Runr
|
||||
#define Samr UCD_SCRIPT_Samr
|
||||
#define Sara UCD_SCRIPT_Sara
|
||||
#define Sarb UCD_SCRIPT_Sarb
|
||||
#define Saur UCD_SCRIPT_Saur
|
||||
#define Sgnw UCD_SCRIPT_Sgnw
|
||||
#define Shaw UCD_SCRIPT_Shaw
|
||||
#define Shrd UCD_SCRIPT_Shrd
|
||||
#define Sidd UCD_SCRIPT_Sidd
|
||||
#define Sind UCD_SCRIPT_Sind
|
||||
#define Sinh UCD_SCRIPT_Sinh
|
||||
#define Sora UCD_SCRIPT_Sora
|
||||
#define Sund UCD_SCRIPT_Sund
|
||||
#define Sylo UCD_SCRIPT_Sylo
|
||||
#define Syrc UCD_SCRIPT_Syrc
|
||||
#define Syre UCD_SCRIPT_Syre
|
||||
#define Syrj UCD_SCRIPT_Syrj
|
||||
#define Syrn UCD_SCRIPT_Syrn
|
||||
#define Tagb UCD_SCRIPT_Tagb
|
||||
#define Takr UCD_SCRIPT_Takr
|
||||
#define Tale UCD_SCRIPT_Tale
|
||||
#define Talu UCD_SCRIPT_Talu
|
||||
#define Taml UCD_SCRIPT_Taml
|
||||
#define Tang UCD_SCRIPT_Tang
|
||||
#define Tavt UCD_SCRIPT_Tavt
|
||||
#define Telu UCD_SCRIPT_Telu
|
||||
#define Teng UCD_SCRIPT_Teng
|
||||
#define Tfng UCD_SCRIPT_Tfng
|
||||
#define Tglg UCD_SCRIPT_Tglg
|
||||
#define Thaa UCD_SCRIPT_Thaa
|
||||
#define Thai UCD_SCRIPT_Thai
|
||||
#define Tibt UCD_SCRIPT_Tibt
|
||||
#define Tirh UCD_SCRIPT_Tirh
|
||||
#define Ugar UCD_SCRIPT_Ugar
|
||||
#define Vaii UCD_SCRIPT_Vaii
|
||||
#define Visp UCD_SCRIPT_Visp
|
||||
#define Wara UCD_SCRIPT_Wara
|
||||
#define Wole UCD_SCRIPT_Wole
|
||||
#define Xpeo UCD_SCRIPT_Xpeo
|
||||
#define Xsux UCD_SCRIPT_Xsux
|
||||
#define Yiii UCD_SCRIPT_Yiii
|
||||
#define Zinh UCD_SCRIPT_Zinh
|
||||
#define Zmth UCD_SCRIPT_Zmth
|
||||
#define Zsym UCD_SCRIPT_Zsym
|
||||
#define Zxxx UCD_SCRIPT_Zxxx
|
||||
#define Zyyy UCD_SCRIPT_Zyyy
|
||||
#define Zzzz UCD_SCRIPT_Zzzz
|
||||
|
||||
// Unicode Character Data %s
|
||||
""" % ucd_version)
|
||||
|
||||
for script in special_scripts:
|
||||
sys.stdout.write('\n')
|
||||
sys.stdout.write('static const uint8_t scripts_%s[256] =\n' % script)
|
||||
sys.stdout.write('{')
|
||||
for i in range(0, 256):
|
||||
if (i % 16) == 0:
|
||||
sys.stdout.write('\n\t/* %02X */' % i)
|
||||
sys.stdout.write(' %s,' % script)
|
||||
sys.stdout.write('\n};\n')
|
||||
|
||||
for codepoints, script, comment in script_sets:
|
||||
if not script:
|
||||
tables = script_tables['%s_%s' % (codepoints.first, codepoints.last)]
|
||||
for codepoint in sorted(tables.keys()):
|
||||
table = tables[codepoint]
|
||||
if table in special_scripts:
|
||||
continue
|
||||
|
||||
sys.stdout.write('\n')
|
||||
sys.stdout.write('static const uint8_t scripts_%s[256] =\n' % codepoint)
|
||||
sys.stdout.write('{')
|
||||
for i, script in enumerate(table):
|
||||
if (i % 16) == 0:
|
||||
sys.stdout.write('\n\t/* %02X */' % i)
|
||||
sys.stdout.write(' %s,' % script)
|
||||
sys.stdout.write('\n};\n')
|
||||
|
||||
for codepoints, script, comment in script_sets:
|
||||
if not script:
|
||||
table_index = '%s_%s' % (codepoints.first, codepoints.last)
|
||||
sys.stdout.write('\n')
|
||||
sys.stdout.write('static const uint8_t *scripts_%s[] =\n' % table_index)
|
||||
sys.stdout.write('{\n')
|
||||
for codepoint, table in sorted(script_tables[table_index].items()):
|
||||
if isinstance(table, str):
|
||||
sys.stdout.write('\tscripts_%s, // %s\n' % (table, codepoint))
|
||||
else:
|
||||
sys.stdout.write('\tscripts_%s,\n' % codepoint)
|
||||
sys.stdout.write('};\n')
|
||||
|
||||
sys.stdout.write('\n')
|
||||
sys.stdout.write('ucd_script ucd_lookup_script(codepoint_t c)\n')
|
||||
sys.stdout.write('{\n')
|
||||
for codepoints, script, comment in script_sets:
|
||||
if script:
|
||||
sys.stdout.write('\tif (c <= 0x%s) return %s; // %s : %s\n' % (codepoints.last, script, codepoints, comment))
|
||||
else:
|
||||
sys.stdout.write('\tif (c <= 0x%s) // %s\n' % (codepoints.last, codepoints))
|
||||
sys.stdout.write('\t{\n')
|
||||
sys.stdout.write('\t\tconst uint8_t *table = scripts_%s_%s[(c - 0x%s) / 256];\n' % (codepoints.first, codepoints.last, codepoints.first))
|
||||
sys.stdout.write('\t\treturn (ucd_script)table[c % 256];\n')
|
||||
sys.stdout.write('\t}\n')
|
||||
sys.stdout.write('\treturn Zzzz; // Invalid Unicode Codepoint\n')
|
||||
sys.stdout.write('}\n')
|
||||
Executable
+195
@@ -0,0 +1,195 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright (C) 2012-2014 Reece H. Dunn
|
||||
#
|
||||
# This file is part of ucd-tools.
|
||||
#
|
||||
# ucd-tools is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ucd-tools is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
script_map = {}
|
||||
|
||||
class CodePoint:
|
||||
def __init__(self, x):
|
||||
if isinstance(x, str):
|
||||
self.codepoint = int(x, 16)
|
||||
else:
|
||||
self.codepoint = x
|
||||
|
||||
def __repr__(self):
|
||||
return '%06X' % self.codepoint
|
||||
|
||||
def __str__(self):
|
||||
return '%06X' % self.codepoint
|
||||
|
||||
def __iter__(self):
|
||||
yield self
|
||||
|
||||
def __hash__(self):
|
||||
return self.codepoint
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.codepoint == other.codepoint
|
||||
|
||||
def __ne__(self, other):
|
||||
return self.codepoint != other.codepoint
|
||||
|
||||
def __lt__(self, other):
|
||||
return self.codepoint < other.codepoint
|
||||
|
||||
class CodeRange:
|
||||
def __init__(self, x):
|
||||
f, l = x.split('..')
|
||||
self.first = CodePoint(f)
|
||||
self.last = CodePoint(l)
|
||||
|
||||
def __repr__(self):
|
||||
return '%s..%s' % (self.first, self.last)
|
||||
|
||||
def __str__(self):
|
||||
return '%s..%s' % (self.first, self.last)
|
||||
|
||||
def __iter__(self):
|
||||
for c in range(self.first.codepoint, self.last.codepoint + 1):
|
||||
yield CodePoint(c)
|
||||
|
||||
def size(self):
|
||||
return self.last.codepoint - self.first.codepoint + 1
|
||||
|
||||
def codepoint(x):
|
||||
if '..' in x[0]:
|
||||
return CodeRange(x[0]), x[1:]
|
||||
if ' ' in x:
|
||||
return [CodePoint(c) for c in x[0].split()], x[1:]
|
||||
if x[0] == '':
|
||||
return CodePoint('0000'), x[1:]
|
||||
return CodePoint(x[0]), x[1:]
|
||||
|
||||
def string(x):
|
||||
if x[0] == '':
|
||||
return None, x[1:]
|
||||
return x[0], x[1:]
|
||||
|
||||
def integer(x):
|
||||
return int(x[0]), x[1:]
|
||||
|
||||
def boolean(x):
|
||||
if x[0] == 'Y':
|
||||
return True, x[1:]
|
||||
return False, x[1:]
|
||||
|
||||
def script(x):
|
||||
return script_map[x[0]], x[1:]
|
||||
|
||||
def strlist(x):
|
||||
return x, []
|
||||
|
||||
data_items = {
|
||||
# Unicode Character Data:
|
||||
'Blocks': [
|
||||
('Range', codepoint),
|
||||
('Name', string)
|
||||
],
|
||||
'DerivedAge': [
|
||||
('Range', codepoint),
|
||||
('Age', string),
|
||||
],
|
||||
'PropList': [
|
||||
('Range', codepoint),
|
||||
('Property', string),
|
||||
],
|
||||
'PropertyValueAliases': [
|
||||
('Property', string),
|
||||
('Key', string),
|
||||
('Value', string),
|
||||
('Aliases', strlist),
|
||||
],
|
||||
'Scripts': [
|
||||
('Range', codepoint),
|
||||
('Script', script),
|
||||
],
|
||||
'UnicodeData': [
|
||||
('CodePoint', codepoint),
|
||||
('Name', string),
|
||||
('GeneralCategory', string),
|
||||
('CanonicalCombiningClass', integer),
|
||||
('BidiClass', string),
|
||||
('DecompositionType', string),
|
||||
('DecompositionMapping', string),
|
||||
('NumericType', string),
|
||||
('NumericValue', string),
|
||||
('BidiMirrored', boolean),
|
||||
('UnicodeName', string),
|
||||
('ISOComment', string),
|
||||
('UpperCase', codepoint),
|
||||
('LowerCase', codepoint),
|
||||
('TitleCase', codepoint),
|
||||
],
|
||||
# ConScript Unicode Registry Data:
|
||||
'Klingon': [
|
||||
('CodePoint', codepoint),
|
||||
('Script', string),
|
||||
('GeneralCategory', string),
|
||||
('Name', string),
|
||||
('Transliteration', string),
|
||||
],
|
||||
}
|
||||
|
||||
def parse_ucd_data(ucd_rootdir, dataset):
|
||||
keys = data_items[dataset]
|
||||
first = None
|
||||
with open(os.path.join(ucd_rootdir, '%s.txt' % dataset)) as f:
|
||||
for line in f:
|
||||
line = line.replace('\n', '').split('#')[0]
|
||||
linedata = [' '.join(x.split()) for x in line.split(';')]
|
||||
if len(linedata) > 1:
|
||||
if linedata[1].endswith(', First>'):
|
||||
first = linedata
|
||||
continue
|
||||
|
||||
if linedata[1].endswith(', Last>'):
|
||||
linedata[0] = '%s..%s' % (first[0], linedata[0])
|
||||
linedata[1] = linedata[1].replace(', Last>', '').replace('<', '')
|
||||
first = None
|
||||
|
||||
data = {}
|
||||
for key, typemap in keys:
|
||||
data[key], linedata = typemap(linedata)
|
||||
yield data
|
||||
|
||||
def parse_property_mapping(ucd_rootdir, propname, reverse=False):
|
||||
ret = {}
|
||||
for data in parse_ucd_data(ucd_rootdir, 'PropertyValueAliases'):
|
||||
if data['Property'] == propname:
|
||||
if reverse:
|
||||
ret[data['Value']] = data['Key']
|
||||
else:
|
||||
ret[data['Key']] = data['Value']
|
||||
return ret
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
items = sys.argv[3].split(',')
|
||||
except:
|
||||
items = None
|
||||
script_map = parse_property_mapping(sys.argv[1], 'sc', reverse=True)
|
||||
for entry in parse_ucd_data(sys.argv[1], sys.argv[2]):
|
||||
if items:
|
||||
print(','.join([str(entry[item]) for item in items]))
|
||||
else:
|
||||
print(entry)
|
||||
else:
|
||||
script_map = parse_property_mapping('data/ucd', 'sc', reverse=True)
|
||||
Reference in New Issue
Block a user