pax_global_header 0000666 0000000 0000000 00000000064 14665226114 0014521 g ustar 00root root 0000000 0000000 52 comment=a2936e865fcc00e6e0c0bfc6c1d62db19e49fe74
libskk-master/ 0000775 0000000 0000000 00000000000 14665226114 0013635 5 ustar 00root root 0000000 0000000 libskk-master/.dir-locals.el 0000664 0000000 0000000 00000000172 14665226114 0016266 0 ustar 00root root 0000000 0000000 ((c-mode . ((indent-tabs-mode . nil)))
(vala-mode . ((indent-tabs-mode . nil)))
(js-mode . ((indent-tabs-mode . nil))))
libskk-master/.travis.yml 0000664 0000000 0000000 00000004736 14665226114 0015760 0 ustar 00root root 0000000 0000000 sudo: required
language: c
env:
- BUILD_OPTS="--prefix=/usr --libdir=/usr/lib64"
- BUILD_OPTS="--prefix=/usr --libdir=/usr/lib64 --enable-docs" DOCS=yes EXTRA_PKGS="gtk-doc valadoc valadoc-devel"
- BUILD_OPTS="--prefix=/usr --libdir=/usr/lib64 --enable-code-coverage" COVERAGE=yes EXTRA_PKGS="python-pip"
- BUILD_OPTS="--prefix=/usr --libdir=/usr/lib64 CFLAGS='-fsanitize=address -g -fno-common -U_FORTIFY_SOURCE' CXXFLAGS='-fsanitize=address -g -fno-common -U_FORTIFY_SOURCE' LDFLAGS='-fsanitize=address -g -fno-common -U_FORTIFY_SOURCE' LIBS='-ldl -lpthread'" EXTRA_PKGS="libasan"
- BUILD_OPTS="--prefix=/usr --libdir=/usr/lib64 CFLAGS='-fsanitize=undefined -g -fno-common -U_FORTIFY_SOURCE' CXXFLAGS='-fsanitize=undefined -g -fno-common -U_FORTIFY_SOURCE' LDFLAGS='-fsanitize=undefined -g -fno-common -U_FORTIFY_SOURCE' LIBS='-ldl -lpthread'" EXTRA_PKGS="libubsan"
services:
- docker
before_install:
- docker pull fedora
- export CONTAINER=$(docker run --cap-add SYS_PTRACE -d fedora sleep 1800)
- docker exec $CONTAINER dnf -y install 'dnf-command(builddep)'
- docker exec $CONTAINER dnf -y builddep libskk
- docker exec $CONTAINER dnf -y install libtool make which gcc-c++ vala vala-devel git libxkbcommon-devel $EXTRA_PKGS
- docker exec $CONTAINER useradd user
install:
- docker cp . $CONTAINER:/srcdir
- docker exec $CONTAINER chown -R user /srcdir
script:
- docker exec $CONTAINER su - user sh -c "cd /srcdir && NOCONFIGURE=1 ./autogen.sh"
- docker exec $CONTAINER su - user sh -c "cd /srcdir && ./configure $BUILD_OPTS"
- docker exec $CONTAINER su - user sh -c "cd /srcdir && make V=1 && touch po/libskk.pot && make check V=1"
after_failure:
- docker exec $CONTAINER su - user sh -c "cd /srcdir && cat tests/test-suite.log"
- docker exec $CONTAINER su - user sh -c "cd /srcdir && cat config.log"
after_success:
- |
if test x"$COVERAGE" = xyes; then
docker exec $CONTAINER pip install cpp-coveralls
docker exec -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" -e TRAVIS_BRANCH="$TRAVIS_BRANCH" $CONTAINER sh -c "cd /srcdir && coveralls --exclude tools --exclude tests --gcov-options '\-lp'"
fi
- |
if test x"$DOCS" = xyes; then
mkdir dist
docker cp $CONTAINER:/srcdir/docs/libskk/libskk dist/vala
docker cp $CONTAINER:/srcdir/docs/gtk-doc/libskk/html dist/c
fi
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
local_dir: dist
on:
branch: master
condition: $DOCS = yes
libskk-master/AUTHORS 0000664 0000000 0000000 00000000000 14665226114 0014673 0 ustar 00root root 0000000 0000000 libskk-master/COPYING 0000664 0000000 0000000 00000104513 14665226114 0014674 0 ustar 00root root 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
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.
Copyright (C)
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 .
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:
Copyright (C)
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
.
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
.
libskk-master/Makefile.am 0000664 0000000 0000000 00000005065 14665226114 0015677 0 ustar 00root root 0000000 0000000 # Copyright (C) 2011-2018 Daiki Ueno
# Copyright (C) 2011-2018 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 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 .
SUBDIRS = libskk rules tools tests po
DISTCHECK_CONFIGURE_FLAGS = --enable-docs --enable-fep
ACLOCAL_AMFLAGS = -I m4
if HAVE_VALADOC
SUBDIRS += docs
endif
DIST_SUBDIRS = libskk rules tools tests docs po
GITIGNOREFILES = \
ABOUT-NLS \
config.rpath \
INSTALL \
aclocal.m4 \
compile \
config.guess \
config.h.in \
config.sub \
depcomp \
install-sh \
ltmain.sh \
missing \
mkinstalldirs \
`find "m4" -type f -name "*.m4" ! -name "vala.m4" -print` \
$(top_builddir)/lcov.html/* \
$(top_builddir)/docs/gtk-doc \
$(top_builddir)/docs/libskk \
po/Makevars.template \
po/Rules-quot \
po/boldquot.sed \
po/en@boldquot.header \
po/en@quot.header \
po/insert-header.sin \
po/quot.sed \
po/remove-potcdate.sed \
po/remove-potcdate.sin \
po/stamp-po \
test-driver \
$(NULL)
distclean-local:
if test "x$(srcdir)" = "x."; then :; else \
rm -f ChangeLog; \
fi
MAINTAINERCLEANFILES = \
$(top_builddir)/lcov.info \
$(srcdir)/ChangeLog \
$(NULL)
EXTRA_DIST = lcov.mk
maintainer-clean-local: maintainer-clean-local-lcov
maintainer-clean-local-lcov:
rm -rf $(top_builddir)/lcov.html
.PHONY: maintainer-clean-local-lcov
ChangeLog:
@echo Creating $@
@if test -d "$(srcdir)/.git"; then \
(GIT_DIR=$(top_srcdir)/.git ./missing --run git log --stat) | fmt --split-only > $@.tmp \
&& mv -f $@.tmp $@ \
|| ($(RM) $@.tmp; \
echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \
(test -f $@ || echo git-log is required to generate this file >> $@)); \
else \
test -f $@ || \
(echo A git checkout and git-log is required to generate ChangeLog >&2 && \
echo A git checkout and git-log is required to generate this file >> $@); \
fi
.PHONY: ChangeLog
# Code coverage support
include $(top_srcdir)/lcov.mk
-include $(top_srcdir)/git.mk
libskk-master/NEWS 0000664 0000000 0000000 00000012576 14665226114 0014347 0 ustar 00root root 0000000 0000000 Noteworthy changes in version 1.0.5 (2018-09-15)
------------------------------------------------
* build: Use libxkbcommon to resolve keysyms [#54]
Noteworthy changes in version 1.0.4 (2018-06-26)
------------------------------------------------
* Don't consume key release events [#52]
* Improve hankaku katakana conversion [#51]
* Use the same typing rule in dict-edit mode [#50]
* Add `abort-to-latin` and `abort-to-latin-unhandled` command [#48]
* Add more z-* shortcuts from DDSKK
* Fix memory leak caused by Vala array conversion
* Bump build requirements (glib >= 2.36, valadoc >= 0.40)
Noteworthy changes in version 1.0.3 (2017-11-10)
------------------------------------------------
* Fix hiragana to katakana conversion in abbrev mode [#41]
* Make "commit-unhandled" actually commit in abbrev mode [#39]
* Avoid redundant dictionary lookup in non-numeric conversion cases [#36]
* Fix KZIK rules [#35, #37]
* Fix okuri-ari word registration [#33, #34]
* Add command for sticky-shift [#32]
* Don't crash when a rule has no default metadata [#31]
* Bind C-j to go back to hiragana in AZIK latin [#30]
* Build fixes [#42, #43]
Noteworthy changes in version 1.0.2 (2014-09-09)
------------------------------------------------
* Migrate to libgee 0.8 from 0.6 (Issue#29).
* rules: new ACT09 rule contributed by Naoki Mizuno (Issue#28).
* Consume key event for "commit" command (Issue#26). Use
"commit-unhandled" for the previous behavior.
* Consume C-j in abbrev mode (Issue#24).
Noteworthy changes in version 1.0.1 (2013-04-01)
------------------------------------------------
* Cancel okuri-ari conversion only if there is no candidate (Issue#23).
* Allow clients to populate lookup table before setting cursor pos
(ibus-skk Issue#51).
* rules: inherit AZIK keymap from the default keymap (Issue#22).
* Don't use type-punning when converting bytes to uint32 (Issue#20).
Noteworthy changes in version 1.0.0 (2012-08-27)
------------------------------------------------
* Make sure to create parent directory of user-dict (Debian bug#685745).
* Clear output and preedit on context reset.
* Fix header include in tests (Issue#19).
Noteworthy changes in version 0.0.13 (2012-07-02)
------------------------------------------------
* Fix segfault on 64-bit FreeBSD (Issue#18).
* Update required Vala version from 0.12.0 to 0.14.0 (Issue#17).
* Fix CDB dictionary integer alignment issue on ARM (Debian bug#674471).
* Map files that simply include "default" are now optional.
Noteworthy changes in version 0.0.12 (2012-03-29)
------------------------------------------------
* Improve AZIK, KZIK, and ACT tables (Issue#16).
"upper-" command is added to keymap.
* Fix "nq" and "nl" handling in hiragana input mode (Issue#15).
* Fix "NA" handling in hiragana input mode.
* Fix okuri-ari conversion in katakana input mode (Issue#12).
* --preedit-style option is added to skkfep.
Noteworthy changes in version 0.0.11 (2012-02-11)
------------------------------------------------
* Fix for candidate list hiding bug (ibus-skk Issue#47).
* Decorate selected candidate in FEP mode.
Noteworthy changes in version 0.0.10 (2012-02-03)
------------------------------------------------
* Respect coding cookie in file dictionaries (Issue#10).
* Change DictEdit preedit format to make Firefox forms happy.
* Support libfep and add skkfep replacement.
To enable, pass --enable-fep to configure.
Noteworthy changes in version 0.0.9 (2012-01-25)
------------------------------------------------
* Import skk.1 manual page from Debian.
* Adopt code coverage testing with lcov.
To enable, pass --enable-code-coverage to configure.
* Support running test cases under valgrind.
To enable, pass --enable-valgrind-tests to configure.
Noteworthy changes in version 0.0.8 (2012-01-11)
------------------------------------------------
* Fix user dictionary handling (ibus-skk Issue#44).
Noteworthy changes in version 0.0.7 (2012-01-05)
------------------------------------------------
* Improve candidate list traversal with "x" and SPC keys.
* Reduce the number of property notifications for performance.
Noteworthy changes in version 0.0.6 (2011-12-28)
------------------------------------------------
* Support re-conversion based on surrounding text.
Noteworthy changes in version 0.0.5 (2011-12-25)
------------------------------------------------
* Fix buffer overrun when using skkserv (Issue#2).
Noteworthy changes in version 0.0.4 (2011-12-20)
------------------------------------------------
* Improve kanagaki input okuri-ari conversion.
Noteworthy changes in version 0.0.3 (2011-12-20)
------------------------------------------------
* Support (concat ...).
Noteworthy changes in version 0.0.2 (2011-12-16)
------------------------------------------------
* New test tool "skk".
Noteworthy changes in version 0.0.1 (2011-11-30)
------------------------------------------------
* First release of libskk.
Copyright (C) 2011-2018 Daiki Ueno
Copyright (C) 2011-2018 Red Hat, Inc.
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
modifications, as long as this notice is preserved.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
libskk-master/README 0000664 0000000 0000000 00000003407 14665226114 0014521 0 ustar 00root root 0000000 0000000 libskk -- a library to deal with Japanese kana-to-kanji conversion method
Features:
* Support basic features of SKK including: new word registration,
completion, numeric conversion, abbrev mode, kuten input,
hankaku-katakana input, Lisp expression evaluation (concat only),
and re-conversion.
* Support various typing rules including: romaji-to-kana, AZIK,
TUT-Code, and NICOLA.
* Support various dictionary types including: file dictionary (such as
SKK-JISYO.[SML]), user dictionary, skkserv, and CDB format
dictionary.
* GObject based API with gobject-introspection support.
Documentation:
* file:tests/context.c for basic usage
* file:rules/README.rules for keymap and romaji-to-kana table customization
* http://du-a.org/docs/libskk/libskk/ for Vala binding reference
* http://du-a.org/docs/gtk-doc/libskk/html/ for C binding reference
Test:
$ echo "A i SPC" | skk
{ "input": "A i SPC", "output": "", "preedit": "▼愛" }
$ echo "K a p a SPC K a SPC" | skk
{ "input": "K a p a SPC K a SPC", "output": "", "preedit": "▼かぱ【▼蚊】" }
$ echo "r k" | skk -r tutcode
{ "input": "r k", "output": "あ", "preedit": "" }
$ echo "a (usleep 50000) b (usleep 200000)" | skk -r nicola
{ "input": "a (usleep 50000) b (usleep 200000)", "output": "うへ", "preedit": "" }
License:
GPLv3+
Copyright (C) 2011-2018 Daiki Ueno
Copyright (C) 2011-2018 Red Hat, Inc.
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
modifications, as long as this notice is preserved.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
libskk-master/README.md 0000664 0000000 0000000 00000004073 14665226114 0015120 0 ustar 00root root 0000000 0000000 libskk -- a library to deal with Japanese kana-to-kanji conversion method
======
[](https://travis-ci.org/ueno/libskk) [](https://coveralls.io/r/ueno/libskk)
Features
------
* Support basic features of SKK including: new word registration,
completion, numeric conversion, abbrev mode, kuten input,
hankaku-katakana input, Lisp expression evaluation (concat only),
and re-conversion.
* Support various typing rules including: romaji-to-kana, AZIK,
TUT-Code, and NICOLA.
* Support various dictionary types including: file dictionary (such as
SKK-JISYO.[SML]), user dictionary, skkserv, and CDB format
dictionary.
* GObject based API with gobject-introspection support.
Documentation
------
* [Basic usage](https://github.com/ueno/libskk/blob/master/tests/context.c)
* [Keymap and Romaji-to-Kana table customization](https://github.com/ueno/libskk/blob/master/rules/README.rules)
* [Vala binding reference](https://ueno.github.io/libskk/vala/)
* [C binding reference](https://ueno.github.io/libskk/c/)
Test
------
```
$ echo "A i SPC" | skk
{ "input": "A i SPC", "output": "", "preedit": "▼愛" }
$ echo "K a p a SPC K a SPC" | skk
{ "input": "K a p a SPC K a SPC", "output": "", "preedit": "▼かぱ【▼蚊】" }
$ echo "r k" | skk -r tutcode
{ "input": "r k", "output": "あ", "preedit": "" }
$ echo "a (usleep 50000) b (usleep 200000)" | skk -r nicola
{ "input": "a (usleep 50000) b (usleep 200000)", "output": "うへ", "preedit": "" }
```
License
------
```
GPLv3+
Copyright (C) 2011-2018 Daiki Ueno
Copyright (C) 2011-2018 Red Hat, Inc.
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
modifications, as long as this notice is preserved.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
``` libskk-master/autogen.sh 0000775 0000000 0000000 00000001721 14665226114 0015637 0 ustar 00root root 0000000 0000000 #!/bin/sh
# Run this to generate all the initial makefiles, etc.
test -n "$srcdir" || srcdir=$(dirname "$0")
test -n "$srcdir" || srcdir=.
olddir=$(pwd)
cd $srcdir
(test -f configure.ac) || {
echo "*** ERROR: Directory '$srcdir' does not look like the top-level project directory ***"
exit 1
}
# shellcheck disable=SC2016
PKG_NAME=libskk
if [ "$#" = 0 -a "x$NOCONFIGURE" = "x" ]; then
echo "*** WARNING: I am going to run 'configure' with no arguments." >&2
echo "*** If you wish to pass any to it, please specify them on the" >&2
echo "*** '$0' command line." >&2
echo "" >&2
fi
autoreconf --verbose --force --install || exit 1
cd "$olddir"
if [ "$NOCONFIGURE" = "" ]; then
$srcdir/configure "$@" || exit 1
if [ "$1" = "--help" ]; then
exit 0
else
echo "Now type 'make' to compile $PKG_NAME" || exit 1
fi
else
echo "Skipping configure process."
fi
libskk-master/configure.ac 0000664 0000000 0000000 00000012166 14665226114 0016131 0 ustar 00root root 0000000 0000000 # Copyright (C) 2011-2018 Daiki Ueno
# Copyright (C) 2011-2018 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 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 .
AC_PREREQ(2.63)
AC_CONFIG_MACRO_DIR([m4])
AC_INIT([libskk], [1.0.5], [ueno@gnu.org])
SKK_API_VERSION=1.0
SKK_API_MAJOR_VERSION=1
SKK_API_MINOR_VERSION=0
SKK_API_PC_VERSION=1.0
SKK_LIBRARY_SUFFIX="-$SKK_API_VERSION"
AC_SUBST([SKK_API_VERSION])
AC_SUBST([SKK_API_MAJOR_VERSION])
AC_SUBST([SKK_API_MINOR_VERSION])
AC_SUBST([SKK_API_PC_VERSION])
AC_SUBST([SKK_LIBRARY_SUFFIX])
AC_SUBST([SKK_LIBRARY_SUFFIX_U],[AS_TR_SH([$SKK_LIBRARY_SUFFIX])])
dnl Init automake
AM_INIT_AUTOMAKE([1.11.1 dist-xz no-dist-gzip])
AM_MAINTAINER_MODE([enable])
AC_GNU_SOURCE
dnl Check for programs
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CC_STDC
AC_PROG_INSTALL
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.8])
# define PACKAGE_VERSION_* variables
AM_DISABLE_STATIC
AC_ISC_POSIX
AC_HEADER_STDC
LT_INIT
# If library source has changed since last release, increment revision
# If public symbols have been added, removed or changed since last release,
# increment current and set revision to 0
# If public symbols have been added since last release, increment age
# If public symbols have been removed since last release, set age to 0
m4_define([libskk_lt_current], [0])
m4_define([libskk_lt_revision], [0])
m4_define([libskk_lt_age], [0])
LT_CURRENT=libskk_lt_current
LT_REVISION=libskk_lt_revision
LT_AGE=libskk_lt_age
AC_SUBST([LT_CURRENT])
AC_SUBST([LT_REVISION])
AC_SUBST([LT_AGE])
# check gio
PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.36], ,
[AC_MSG_ERROR([can't find gio-2.0])])
# check gee
PKG_CHECK_MODULES([GEE], [gee-0.8], ,
[AC_MSG_ERROR([can't find gee-0.8])])
# check json-glib
PKG_CHECK_MODULES([JSON_GLIB], [json-glib-1.0], ,
[AC_MSG_ERROR([can't find json-glib-1.0])])
# check xkbcommon
PKG_CHECK_MODULES([XKBCOMMON], [xkbcommon], ,
[AC_MSG_ERROR([can't find xkbcommon])])
LIBSKK_CFLAGS="$GIO_CFLAGS $GEE_CFLAGS $JSON_GLIB_CFLAGS $XKBCOMMON_CFLAGS"
AC_SUBST(LIBSKK_CFLAGS)
LIBSKK_LIBS="$GIO_LIBS $GEE_LIBS $JSON_GLIB_LIBS $XKBCOMMON_LIBS"
AC_SUBST(LIBSKK_LIBS)
GOBJECT_INTROSPECTION_CHECK([0.9.0])
AM_PROG_VALAC([0.14.0])
AC_SUBST(VALAC)
AC_SUBST(VALAFLAGS)
# define GETTEXT_* variables
GETTEXT_PACKAGE=libskk
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define to the read-only architecture-independent data directory.])
AC_ARG_ENABLE([fep],
AS_HELP_STRING([--enable-fep],
[compile with libfep]),
[enable_fep=$enableval], [enable_fep=no])
if test x$enable_fep = xyes; then
PKG_CHECK_MODULES([LIBFEP], [libfep-glib >= 0.0.7], , enable_fep=no)
VALA_CHECK_PACKAGES([libfep-glib], , enable_fep=no)
AC_PATH_PROG([FEP], [fep])
fi
AM_CONDITIONAL([ENABLE_FEP], [test x$enable_fep = xyes])
AC_ARG_ENABLE([docs],
AS_HELP_STRING([--enable-docs],[Enable documentation generation]),
[enable_docs=$enableval], [enable_docs=no])
AM_CONDITIONAL([ENABLE_DOCS], [test x$enable_docs = xyes])
have_valadoc=no
if test x$enable_docs = xyes; then
AC_PATH_PROG([VALADOC], [valadoc], [:])
AS_IF([test "$VALADOC" != :], have_valadoc=yes)
fi
AM_CONDITIONAL([HAVE_VALADOC], [test x$have_valadoc = xyes])
if test "x$enable_docs" = "xyes" -a "x$have_valadoc" != "xyes"; then
AC_MSG_ERROR([Doc building requested but valadoc not installed.])
fi
AC_ARG_ENABLE([code-coverage],
AS_HELP_STRING([--enable-code-coverage],
[compile with code coverage code]),
[enable_code_coverage=$enableval], [enable_code_coverage=no])
# Only enable code coverage if this isn't a release.
if test "x$enable_code_coverage" = "xyes"; then
CODE_COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage -O0 -ggdb"
CODE_COVERAGE_LDFLAGS="-lgcov"
fi
AC_SUBST([CODE_COVERAGE_CFLAGS])
AC_SUBST([CODE_COVERAGE_LDFLAGS])
AC_ARG_ENABLE([valgrind-tests],
AS_HELP_STRING([--enable-valgrind-tests],
[run self tests under valgrind]),
[enable_valgrind_tests=$enableval], [enable_valgrind_tests=no])
# Run self-tests under valgrind?
if test "x$enable_valgrind_tests" = "xyes"; then
AC_CHECK_PROGS(VALGRIND, valgrind)
fi
if test -n "$VALGRIND"; then
VALGRIND_OPTS="--leak-check=full --show-reachable=no --gen-suppressions=all --num-callers=20 --error-exitcode=0 --log-file=valgrind.log.%p"
AC_SUBST(VALGRIND_OPTS)
fi
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile
libskk/Makefile
libskk/libskk.pc
rules/Makefile
tools/Makefile
tests/Makefile
docs/Makefile
po/Makefile.in])
AC_OUTPUT
libskk-master/docs/ 0000775 0000000 0000000 00000000000 14665226114 0014565 5 ustar 00root root 0000000 0000000 libskk-master/docs/Makefile.am 0000664 0000000 0000000 00000004112 14665226114 0016617 0 ustar 00root root 0000000 0000000 distclean_dirs = \
libskk \
gtk-doc \
$(NULL)
docs = \
libskk-doc \
libskk-gtk-doc \
$(NULL)
libskkdocdir=$(datadir)/devhelp/references/libskk
libskkimgdir=$(datadir)/devhelp/references/libskk/img
libskkgtkdocdir=$(datadir)/gtk-doc/html/libskk
common_doc_files = \
*.css \
*.png \
*.js \
index.htm \
*.html \
$(NULL)
libskkdoc_DATA = \
libskk/libskk/libskk.devhelp2 \
$(addprefix libskk/libskk/,$(common_doc_files)) \
$(NULL)
libskkgtkdoc_DATA = gtk-doc/libskk/html/*
libskkimg_DATA = \
libskk/libskk/img/*.png \
$(NULL)
$(libskkdoc_DATA) $(libskkimg_DATA): libskk-doc.stamp
$(libskkgtkdoc_DATA): libskk-gtk-doc.stamp
valadoc_flags = \
--force \
--package-version $(PACKAGE_VERSION) \
--no-protected \
--driver "$(shell valac --api-version)" \
$(NULL)
# libskk documentation
libskk_doc_files_blacklist = \
$(top_srcdir)/libskk/kana-kan.vala \
$(NULL)
# this expands the list of files, so we can filter out elements
libskk_doc_files_all = \
$(wildcard $(top_srcdir)/libskk/*.vala) \
$(NULL)
# FIXME: sort the files manually to work around the native doclet portion of
# bgo#662784
libskk_doc_files = \
$(sort \
$(filter-out $(libskk_doc_files_blacklist),$(libskk_doc_files_all)))
libskk_doc_deps = \
config \
glib-2.0 \
gio-2.0 \
gee-0.8 \
posix \
json-glib-1.0 \
xkbcommon \
$(NULL)
valadoc_flags_libskk = \
$(valadoc_flags) \
-X $(top_srcdir)/libskk/libskk.h \
$(addprefix --pkg=,$(libskk_doc_deps)) \
--vapidir=$(top_srcdir)/libskk \
$(libskk_doc_files) \
$(NULL)
libskk-doc.stamp: $(libskk_doc_files)
$(AM_V_GEN)$(VALADOC) \
-o libskk/ \
--doclet=devhelp \
$(valadoc_flags_libskk) \
$(NULL)
@touch $@
libskk-gtk-doc.stamp: $(libskk_doc_files)
$(AM_V_GEN)$(VALADOC) \
-X -l -X $(top_builddir)/libskk/.libs/libskk.so \
-o gtk-doc/libskk \
--doclet=gtkdoc \
$(valadoc_flags_libskk) \
$(NULL)
@touch $@
stamps = libskk-doc.stamp libskk-gtk-doc.stamp
all: $(stamps)
CLEANFILES = $(stamps)
distclean-local: distclean-docs
distclean-docs:
rm -rf $(distclean_dirs)
GITIGNOREFILES = \
$(distclean_dirs) \
$(NULL)
-include $(top_srcdir)/git.mk
libskk-master/git.mk 0000664 0000000 0000000 00000014000 14665226114 0014744 0 ustar 00root root 0000000 0000000 # git.mk
#
# Copyright 2009, Red Hat, Inc.
# Copyright 2010,2011 Behdad Esfahbod
# Written by Behdad Esfahbod
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
#
# The canonical source for this file is https://github.com/behdad/git.mk.
#
# To use in your project, import this file in your git repo's toplevel,
# then do "make -f git.mk". This modifies all Makefile.am files in
# your project to -include git.mk. Remember to add that line to new
# Makefile.am files you create in your project, or just rerun the
# "make -f git.mk".
#
# This enables automatic .gitignore generation. If you need to ignore
# more files, add them to the GITIGNOREFILES variable in your Makefile.am.
# But think twice before doing that. If a file has to be in .gitignore,
# chances are very high that it's a generated file and should be in one
# of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES.
#
# The only case that you need to manually add a file to GITIGNOREFILES is
# when remove files in one of mostlyclean-local, clean-local, distclean-local,
# or maintainer-clean-local make targets.
#
# Note that for files like editor backup, etc, there are better places to
# ignore them. See "man gitignore".
#
# If "make maintainer-clean" removes the files but they are not recognized
# by this script (that is, if "git status" shows untracked files still), send
# me the output of "git status" as well as your Makefile.am and Makefile for
# the directories involved and I'll diagnose.
#
# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see
# Makefile.am.sample in the git.mk git repo.
#
# Don't EXTRA_DIST this file. It is supposed to only live in git clones,
# not tarballs. It serves no useful purpose in tarballs and clutters the
# build dir.
#
# This file knows how to handle autoconf, automake, libtool, gtk-doc,
# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings.
#
#
# KNOWN ISSUES:
#
# - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the
# submodule doesn't find us. If you have configure.{in,ac} files in
# subdirs, add a proxy git.mk file in those dirs that simply does:
# "include $(top_srcdir)/../git.mk". Add more ..'s to your taste.
# And add those files to git. See vte/gnome-pty-helper/git.mk for
# example.
#
git-all: git-mk-install
git-mk-install:
@echo Installing git makefile
@any_failed=; \
find "`test -z "$(top_srcdir)" && echo . || echo "$(top_srcdir)"`" -name Makefile.am | while read x; do \
if grep 'include .*/git.mk' $$x >/dev/null; then \
echo $$x already includes git.mk; \
else \
failed=; \
echo "Updating $$x"; \
{ cat $$x; \
echo ''; \
echo '-include $$(top_srcdir)/git.mk'; \
} > $$x.tmp || failed=1; \
if test x$$failed = x; then \
mv $$x.tmp $$x || failed=1; \
fi; \
if test x$$failed = x; then : else \
echo Failed updating $$x; >&2 \
any_failed=1; \
fi; \
fi; done; test -z "$$any_failed"
.PHONY: git-all git-mk-install
### .gitignore generation
$(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
$(AM_V_GEN) \
{ \
if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \
for x in \
$(DOC_MODULE)-decl-list.txt \
$(DOC_MODULE)-decl.txt \
tmpl/$(DOC_MODULE)-unused.sgml \
"tmpl/*.bak" \
xml html \
; do echo /$$x; done; \
fi; \
if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \
for x in \
$(_DOC_C_DOCS) \
$(_DOC_LC_DOCS) \
$(_DOC_OMF_ALL) \
$(_DOC_DSK_ALL) \
$(_DOC_HTML_ALL) \
$(_DOC_MOFILES) \
$(_DOC_POFILES) \
$(DOC_H_FILE) \
"*/.xml2po.mo" \
"*/*.omf.out" \
; do echo /$$x; done; \
fi; \
if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \
for x in \
$(_HELP_LC_FILES) \
$(_HELP_LC_STAMPS) \
$(_HELP_MOFILES) \
; do echo /$$x; done; \
fi; \
if test "x$(gsettings_SCHEMAS)" = x; then :; else \
for x in \
$(gsettings_SCHEMAS:.xml=.valid) \
$(gsettings__enum_file) \
; do echo /$$x; done; \
fi; \
if test -f $(srcdir)/po/Makefile.in.in; then \
for x in \
po/Makefile.in.in \
po/Makefile.in \
po/Makefile \
po/POTFILES \
po/stamp-it \
po/.intltool-merge-cache \
"po/*.gmo" \
"po/*.mo" \
po/$(GETTEXT_PACKAGE).pot \
intltool-extract.in \
intltool-merge.in \
intltool-update.in \
; do echo /$$x; done; \
fi; \
if test -f $(srcdir)/configure; then \
for x in \
autom4te.cache \
configure \
config.h \
stamp-h1 \
libtool \
config.lt \
; do echo /$$x; done; \
fi; \
for x in \
.gitignore \
$(GITIGNOREFILES) \
$(CLEANFILES) \
$(PROGRAMS) \
$(check_PROGRAMS) \
$(EXTRA_PROGRAMS) \
$(LTLIBRARIES) \
so_locations \
.libs _libs \
$(MOSTLYCLEANFILES) \
"*.$(OBJEXT)" \
"*.lo" \
$(DISTCLEANFILES) \
$(am__CONFIG_DISTCLEAN_FILES) \
$(CONFIG_CLEAN_FILES) \
TAGS ID GTAGS GRTAGS GSYMS GPATH tags \
"*.tab.c" \
$(MAINTAINERCLEANFILES) \
$(BUILT_SOURCES) \
$(DEPDIR) \
Makefile \
Makefile.in \
"*.orig" \
"*.rej" \
"*.bak" \
"*~" \
".*.sw[nop]" \
".dirstamp" \
; do echo /$$x; done; \
} | \
sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \
sed 's@/[.]/@/@g' | \
LC_ALL=C sort | uniq > $@.tmp && \
mv $@.tmp $@;
all: $(srcdir)/.gitignore gitignore-recurse-maybe
gitignore-recurse-maybe:
@if test "x$(SUBDIRS)" = "x$(DIST_SUBDIRS)"; then :; else \
$(MAKE) $(AM_MAKEFLAGS) gitignore-recurse; \
fi;
gitignore-recurse:
@for subdir in $(DIST_SUBDIRS); do \
case " $(SUBDIRS) " in \
*" $$subdir "*) :;; \
*) test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir");; \
esac; \
done
gitignore: $(srcdir)/.gitignore gitignore-recurse
maintainer-clean: gitignore-clean
gitignore-clean:
-rm -f $(srcdir)/.gitignore
.PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe
libskk-master/lcov.mk 0000664 0000000 0000000 00000001255 14665226114 0015134 0 ustar 00root root 0000000 0000000 # From http://cgit.freedesktop.org/telepathy/telepathy-glib/tree/tools/lcov.am
lcov-reset:
lcov --directory @top_srcdir@ --zerocounters
lcov-report:
lcov --directory @top_srcdir@ --capture \
--output-file @top_builddir@/lcov.info
$(mkdir_p) @top_builddir@/lcov.html
git_commit=`GIT_DIR=@top_srcdir@/.git git log -1 --pretty=format:%h 2>/dev/null`;\
genhtml --title "@PACKAGE_STRING@ $$git_commit" \
--output-directory @top_builddir@/lcov.html lcov.info
@echo
@echo 'lcov report can be found in:'
@echo 'file://@abs_top_builddir@/lcov.html/index.html'
@echo
lcov-check:
$(MAKE) lcov-reset
$(MAKE) check $(LCOV_CHECK_ARGS)
$(MAKE) lcov-report
## vim:set ft=automake:
libskk-master/libskk/ 0000775 0000000 0000000 00000000000 14665226114 0015114 5 ustar 00root root 0000000 0000000 libskk-master/libskk/Makefile.am 0000664 0000000 0000000 00000006144 14665226114 0017155 0 ustar 00root root 0000000 0000000 # Copyright (C) 2011-2018 Daiki Ueno
# Copyright (C) 2011-2018 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 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 .
# force include config.h before gi18n.h.
AM_CPPFLAGS = -include $(CONFIG_HEADER)
lib_LTLIBRARIES = libskk.la
libskk_la_VALAFLAGS = \
--includedir=libskk \
-H libskk.h \
--vapi skk-@SKK_API_VERSION@.vapi \
-h libskk-internals.h \
--vapidir=. \
--pkg config \
--pkg glib-2.0 \
--pkg gio-2.0 \
--pkg gee-0.8 \
--pkg posix \
--pkg json-glib-1.0 \
--pkg xkbcommon \
--internal-vapi skk-internals-@SKK_API_VERSION@.vapi \
--library skk-@SKK_API_VERSION@ \
--gir Skk-@SKK_API_VERSION@.gir \
--symbols libskk.symbols \
$(VALAFLAGS) \
$(NULL)
libskk_la_CFLAGS = \
$(CODE_COVERAGE_CFLAGS) \
$(LIBSKK_CFLAGS) \
-DPKGDATADIR=\"$(pkgdatadir)\" \
$(NULL)
libskk_la_LIBADD = $(LIBSKK_LIBS)
libskk_la_LDFLAGS = \
$(CODE_COVERAGE_LDFLAGS) \
-version-info "$(LT_CURRENT)":"$(LT_REVISION)":"$(LT_AGE)" \
-export-dynamic \
-export-symbols $(srcdir)/libskk.symbols \
$(NULL)
libskkincludedir = $(includedir)/libskk
libskkinclude_HEADERS = libskk.h
libskk_la_SOURCES = \
rom-kana.vala \
encoding.vala \
dict.vala \
file-dict.vala \
cdb-dict.vala \
user-dict.vala \
skkserv.vala \
key-event.vala \
key-event-filter.vala \
keymap.vala \
rule.vala \
map-file.vala \
state.vala \
context.vala \
candidate.vala \
candidate-list.vala \
nicola.vala \
expr.vala \
util.vala \
keysyms.vala \
$(NULL)
if HAVE_INTROSPECTION
girdir = $(datadir)/gir-1.0
gir_DATA = Skk-@SKK_API_VERSION@.gir
typelibdir = $(libdir)/girepository-1.0
typelib_DATA = Skk-@SKK_API_VERSION@.typelib
Skk-@SKK_API_VERSION@.typelib: Skk-@SKK_API_VERSION@.gir
@INTROSPECTION_COMPILER@ --shared-library=libskk -o $@ $^
endif
Skk-@SKK_API_VERSION@.gir skk-internals-@SKK_API_VERSION@.vapi skk-@SKK_API_VERSION@.vapi: libskk.la
GITIGNOREFILES = \
$(libskk_la_SOURCES:.vala=.c) \
libskk_la_vala.stamp \
libskk.h \
libskk-internals.h \
libskk.symbols \
$(NULL)
CLEANFILES = \
skk-@SKK_API_VERSION@.vapi \
skk-internals-@SKK_API_VERSION@.vapi \
Skk-@SKK_API_VERSION@.typelib \
Skk-@SKK_API_VERSION@.gir \
libskk.pc \
$(NULL)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libskk.pc
vapi_DATA = skk-1.0.vapi skk-1.0.deps
vapidir = $(datadir)/vala/vapi
EXTRA_DIST = config.vapi skk-1.0.deps libskk.symbols xkbcommon.vapi
-include $(top_srcdir)/git.mk
libskk-master/libskk/candidate-list.vala 0000664 0000000 0000000 00000030062 14665226114 0020647 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
using Gee;
namespace Skk {
/**
* Base abstract class of candidate list.
*/
public abstract class CandidateList : Object {
/**
* Current cursor position.
*/
public abstract int cursor_pos { get; }
/**
* Get the current candidate at the given index.
*
* @param index candidate position (-1 for the current cursor position)
*
* @return a Candidate
*/
public abstract new Candidate @get (int index = -1);
/**
* The number of candidate in the candidate list.
*/
public abstract int size { get; }
internal abstract void clear ();
internal abstract void add_candidates (Candidate[] array);
internal abstract void add_candidates_end ();
/**
* Move cursor to the previous candidate.
*
* @return `true` if cursor position has changed, `false` otherwise.
*/
public abstract bool cursor_up ();
/**
* Move cursor to the next candidate.
*
* @return `true` if cursor position has changed, `false` otherwise
*/
public abstract bool cursor_down ();
/**
* Move cursor to the previous page.
*
* @return `true` if cursor position has changed, `false` otherwise
*/
public abstract bool page_up ();
/**
* Move cursor to the next page.
*
* @return `true` if cursor position has changed, `false` otherwise
*/
public abstract bool page_down ();
/**
* Move cursor forward.
*
* @return `true` if cursor position has changed, `false` otherwise
*/
public virtual bool next () {
if (cursor_pos < page_start) {
return cursor_down ();
} else {
return page_down ();
}
}
/**
* Move cursor backward.
*
* @return `true` if cursor position has changed, `false` otherwise
*/
public virtual bool previous () {
if (cursor_pos <= page_start) {
return cursor_up ();
} else {
return page_up ();
}
}
/**
* Starting index of paging.
*/
public abstract uint page_start { get; set; }
/**
* Page size.
*/
public abstract uint page_size { get; set; }
/**
* Flag to indicate whether page (lookup table) is visible.
*/
public abstract bool page_visible { get; }
/**
* Return cursor position of the beginning of the current page.
*
* @return cursor position
*/
protected uint get_page_start_cursor_pos () {
var pages = (cursor_pos - page_start) / page_size;
return pages * page_size + page_start;
}
/**
* Select a candidate in the current page.
*
* @param index_in_page cursor position in the page to select
*
* @return `true` if a candidate is selected, `false` otherwise
*/
public abstract bool select_at (uint index_in_page);
/**
* Select the current candidate.
*/
public abstract void select ();
/**
* Signal emitted when candidates are filled and ready for traversal.
*/
public signal void populated ();
/**
* Signal emitted when a candidate is selected.
*
* @param candidate selected candidate
*/
public signal void selected (Candidate candidate);
}
class SimpleCandidateList : CandidateList {
ArrayList _candidates = new ArrayList ();
int _cursor_pos;
public override int cursor_pos {
get {
return _cursor_pos;
}
}
public override Candidate @get (int index = -1) {
if (index < 0)
index = _cursor_pos;
assert (0 <= index && index < size);
return _candidates.get (index);
}
public override int size {
get {
return _candidates.size;
}
}
Set seen = new HashSet ();
internal override void clear () {
bool is_populated = false;
bool is_cursor_changed = false;
seen.clear ();
if (_candidates.size > 0) {
_candidates.clear ();
is_populated = true;
}
if (_cursor_pos >= 0) {
_cursor_pos = -1;
is_cursor_changed = true;
}
// to avoid race condition, emit signals after modifying
// _candidates and _cursor_pos
if (is_populated) {
populated ();
}
if (is_cursor_changed) {
notify_property ("cursor-pos");
}
}
internal override void add_candidates (Candidate[] array) {
foreach (var c in array) {
if (!(c.output in seen)) {
_candidates.add (c);
seen.add (c.output);
}
}
}
internal override void add_candidates_end () {
if (_candidates.size > 0) {
_cursor_pos = 0;
}
populated ();
notify_property ("cursor-pos");
}
public override bool select_at (uint index_in_page) {
assert (index_in_page < page_size);
var page_offset = get_page_start_cursor_pos ();
if (page_offset + index_in_page < size) {
_cursor_pos = (int) (page_offset + index_in_page);
notify_property ("cursor-pos");
select ();
return true;
}
return false;
}
public override void select () {
Candidate candidate = this.get ();
selected (candidate);
}
public SimpleCandidateList (uint page_start = 4, uint page_size = 7) {
_page_start = (int) page_start;
_page_size = (int) page_size;
}
public override bool cursor_up () {
assert (_cursor_pos >= 0);
if (_cursor_pos > 0) {
_cursor_pos--;
notify_property ("cursor-pos");
return true;
}
return false;
}
public override bool cursor_down () {
assert (_cursor_pos >= 0);
if (_cursor_pos < _candidates.size - 1) {
_cursor_pos++;
notify_property ("cursor-pos");
return true;
}
return false;
}
public override bool page_up () {
assert (_cursor_pos >= 0);
if (_cursor_pos >= _page_start + _page_size) {
_cursor_pos -= _page_size;
_cursor_pos = (int) get_page_start_cursor_pos ();
notify_property ("cursor-pos");
return true;
}
return false;
}
public override bool page_down () {
assert (_cursor_pos >= 0);
if (_cursor_pos >= _page_start &&
_cursor_pos < _candidates.size - _page_size) {
_cursor_pos += _page_size;
_cursor_pos = (int) get_page_start_cursor_pos ();
notify_property ("cursor-pos");
return true;
}
return false;
}
int _page_start;
public override uint page_start {
get {
return (uint) _page_start;
}
set {
_page_start = (int) value;
}
}
int _page_size;
public override uint page_size {
get {
return (uint) _page_size;
}
set {
_page_size = (int) value;
}
}
public override bool page_visible {
get {
return _cursor_pos >= _page_start;
}
}
}
class ProxyCandidateList : CandidateList {
CandidateList _candidates;
void notify_cursor_pos_cb (Object s, ParamSpec? p) {
notify_property ("cursor-pos");
}
void populated_cb () {
populated ();
}
void selected_cb (Candidate c) {
selected (c);
}
public CandidateList candidates {
get {
return _candidates;
}
set {
if (_candidates != value) {
// _candidates is initially null
if (_candidates != null) {
_candidates.notify["cursor-pos"].disconnect (
notify_cursor_pos_cb);
_candidates.populated.disconnect (populated_cb);
_candidates.selected.disconnect (selected_cb);
}
_candidates = value;
_candidates.notify["cursor-pos"].connect (
notify_cursor_pos_cb);
_candidates.populated.connect (populated_cb);
_candidates.selected.connect (selected_cb);
populated ();
}
}
}
public override int cursor_pos {
get {
return candidates.cursor_pos;
}
}
public override Candidate @get (int index = -1) {
return candidates.get (index);
}
public override int size {
get {
return candidates.size;
}
}
internal override void clear () {
candidates.clear ();
}
internal override void add_candidates (Candidate[] array) {
candidates.add_candidates (array);
}
internal override void add_candidates_end () {
candidates.add_candidates_end ();
}
public override bool select_at (uint index_in_page) {
return candidates.select_at (index_in_page);
}
public override void select () {
candidates.select ();
}
public ProxyCandidateList (CandidateList candidates) {
this.candidates = candidates;
}
public override bool cursor_up () {
return candidates.cursor_up ();
}
public override bool cursor_down () {
return candidates.cursor_down ();
}
public override bool page_up () {
return candidates.page_up ();
}
public override bool page_down () {
return candidates.page_down ();
}
public override uint page_start {
get {
return candidates.page_start;
}
set {
candidates.page_start = value;
}
}
public override uint page_size {
get {
return candidates.page_size;
}
set {
candidates.page_size = value;
}
}
public override bool page_visible {
get {
return candidates.page_visible;
}
}
}
}
libskk-master/libskk/candidate.vala 0000664 0000000 0000000 00000005544 14665226114 0017705 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
using Gee;
namespace Skk {
/**
* Object representing a candidate in dictionaries.
*/
public class Candidate : Object {
/**
* Midasi word which generated this candidate.
*/
public string midasi { get; private set; }
/**
* Flag to indicate whether this candidate is generated as a
* result of okuri-ari conversion.
*/
public bool okuri { get; private set; }
/**
* Base string value of the candidate.
*/
public string text { get; set; }
/**
* Optional annotation text associated with the candidate.
*/
public string? annotation { get; set; }
/**
* Output string shown instead of text.
*
* This is particularly useful to display a candidate of
* numeric conversion.
*/
public string output { get; set; }
/**
* Convert the candidate to string.
* @return a string representing the candidate
*/
public string to_string () {
if (annotation != null) {
return text + ";" + annotation;
} else {
return text;
}
}
/**
* Create a new Candidate.
*
* @param midasi midasi (index) word which generate the candidate
* @param okuri whether the candidate is a result of okuri-ari conversion
* @param text base string value of the candidate
* @param annotation optional annotation text to the candidate
* @param output optional output text used instead of text
*
* @return a new SkkCandidate
*/
public Candidate (string midasi,
bool okuri,
string text,
string? annotation = null,
string? output = null)
{
this.midasi = midasi;
this.okuri = okuri;
this.text = text;
this.annotation = annotation;
this.output = output == null ? text : output;
}
}
}
libskk-master/libskk/cdb-dict.vala 0000664 0000000 0000000 00000012364 14665226114 0017440 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
namespace Skk {
/**
* CDB based implementation of Dict.
*/
public class CdbDict : Dict {
static uint32 hash (char[] chars) {
uint32 h = 5381;
foreach (var c in chars) {
h = ((h << 5) + h) ^ ((uint8) c);
}
return h;
}
/**
* {@inheritDoc}
*/
public override void reload () throws GLib.Error {
#if VALA_0_16
string attributes = FileAttribute.ETAG_VALUE;
#else
string attributes = FILE_ATTRIBUTE_ETAG_VALUE;
#endif
FileInfo info = file.query_info (attributes,
FileQueryInfoFlags.NONE);
if (info.get_etag () != etag) {
try {
mmap.remap ();
etag = info.get_etag ();
} catch (SkkDictError e) {
warning ("error loading file dictionary %s %s",
file.get_path (), e.message);
}
}
}
static uint32 read_uint32 (uint8 *p) {
// Make sure that Q does not stride across 4-byte
// alignment on ARM (Debian bug#674471).
uint8 q[4] = (uint8[]) p;
return (q[3] << 24) | (q[2] << 16) | (q[1] << 8) | q[0];
}
/**
* {@inheritDoc}
*/
public override Candidate[] lookup (string midasi, bool okuri = false) {
if (mmap.memory == null)
return new Candidate[0];
string _midasi;
try {
_midasi = converter.encode (midasi);
} catch (GLib.Error e) {
warning ("can't encode %s: %s", midasi, e.message);
return new Candidate[0];
}
uint32 h = hash (_midasi.to_utf8 ());
uint8 *p = (uint8 *) mmap.memory + (h % 256) * 8;
uint32 hash_offset = read_uint32 (p);
uint32 hash_length = read_uint32 (p + 4);
uint32 start = (h >> 8) % hash_length;
p = (uint8 *) mmap.memory + hash_offset;
for (var i = 0; i < hash_length; i++) {
uint8 *q = p + 8 * ((i + start) % hash_length);
uint32 _h = read_uint32 (q);
uint32 record_offset = read_uint32 (q + 4);
if (record_offset == 0)
break;
if (_h == h) {
uint8 *r = (uint8 *) mmap.memory + record_offset;
uint32 key_length = read_uint32 (r);
uint32 data_length = read_uint32 (r + 4);
if (Memory.cmp (r + 8, _midasi, key_length) == 0) {
char[] data = new char[data_length + 1];
Memory.copy (data, r + 8 + key_length, data_length);
data.length--;
string _data;
try {
_data = converter.decode ((string) data);
} catch (GLib.Error e) {
warning ("can't decode data %s: %s",
(string) data, e.message);
break;
}
return split_candidates (midasi, okuri, _data);
}
}
}
return new Candidate[0];
}
/**
* {@inheritDoc}
*
* This always returns an empty array since CDB format does
* not provide key enumeration.
*/
public override string[] complete (string midasi) {
return new string[0];
}
/**
* {@inheritDoc}
*/
public override bool read_only {
get {
return true;
}
}
File file;
MemoryMappedFile mmap;
string etag;
EncodingConverter converter;
/**
* Create a new CdbDict.
*
* @param path a path to the file
* @param encoding encoding of the file (default EUC-JP)
*
* @return a new FileDict
* @throws GLib.Error if opening the file is failed
*/
public CdbDict (string path,
string encoding = "EUC-JP") throws GLib.Error
{
this.file = File.new_for_path (path);
this.mmap = new MemoryMappedFile (file);
this.etag = "";
this.converter = new EncodingConverter (encoding);
reload ();
}
}
}
libskk-master/libskk/config.vapi 0000664 0000000 0000000 00000000555 14665226114 0017247 0 ustar 00root root 0000000 0000000 [CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
namespace Config
{
public const string PACKAGE_DATADIR;
public const string PACKAGE_NAME;
public const string PACKAGE_VERSION;
public const string DATADIR;
public const string PKGDATADIR;
public const string LOCALEDIR;
public const string GETTEXT_PACKAGE;
}
libskk-master/libskk/context.vala 0000664 0000000 0000000 00000056037 14665226114 0017460 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
using Gee;
namespace Skk {
/**
* Initialize libskk.
*
* Must be called before using any functions in libskk.
*/
public static void init () {
// needed to use static methods defined in some classes
typeof (Util).class_ref ();
typeof (Rule).class_ref ();
typeof (EncodingConverter).class_ref ();
}
/**
* Type to specify input modes.
*/
public enum InputMode {
/**
* Hiragana like "あいう...".
*/
HIRAGANA = KanaMode.HIRAGANA,
/**
* Katakana like "アイウ...".
*/
KATAKANA = KanaMode.KATAKANA,
/**
* Half-width katakana like "アイウ...".
*/
HANKAKU_KATAKANA = KanaMode.HANKAKU_KATAKANA,
/**
* Half-width latin like "abc...".
*/
LATIN,
/**
* Full-width latin like "abc...".
*/
WIDE_LATIN,
LAST,
/**
* The default.
*/
DEFAULT = HIRAGANA,
}
/**
* Main entry point of libskk.
*
* Context represents an input context with support for SKK
* kana-kanji conversion method.
*/
public class Context : Object {
Gee.List _dictionaries = new ArrayList ();
/**
* Dictionaries.
*/
public Dict[] dictionaries {
owned get {
return _dictionaries.to_array ();
}
set {
_dictionaries.clear ();
foreach (var dict in value) {
_dictionaries.add (dict);
}
}
}
/**
* Register dictionary.
*
* @param dict a dictionary
* @since 0.0.8
*/
public void add_dictionary (Dict dict) {
_dictionaries.add (dict);
}
/**
* Unregister dictionary.
*
* @param dict a dictionary
* @since 0.0.8
*/
public void remove_dictionary (Dict dict) {
_dictionaries.remove (dict);
}
CandidateList _candidates;
/**
* Current candidates.
*/
public CandidateList candidates {
get {
return _candidates;
}
}
LinkedList state_stack = new LinkedList ();
Gee.Map handlers =
new HashMap ();
/**
* Current input mode.
*/
public InputMode input_mode {
get {
return state_stack.peek_head ().input_mode;
}
set {
state_stack.peek_head ().input_mode = value;
}
}
/**
* Array of strings which triggers automatic conversion.
*/
public string[] auto_start_henkan_keywords {
get {
return state_stack.peek_head ().auto_start_henkan_keywords;
}
set {
state_stack.peek_head ().auto_start_henkan_keywords = value;
}
}
/**
* Flag to indicate whether or not "\n" is consumed on commit.
*/
public bool egg_like_newline {
get {
return state_stack.peek_head ().egg_like_newline;
}
set {
state_stack.peek_head ().egg_like_newline = value;
}
}
/**
* Period style used in romaji-to-kana conversion.
*/
public PeriodStyle period_style {
get {
return state_stack.peek_head ().period_style;
}
set {
state_stack.peek_head ().period_style = value;
}
}
void filter_forwarded_cb (KeyEvent key) {
process_key_event_internal (key);
}
/**
* The name of typing rule.
*/
public Rule typing_rule {
get {
return state_stack.peek_head ().typing_rule;
}
set {
var state = state_stack.peek_head ();
state.typing_rule.get_filter ().forwarded.disconnect (
filter_forwarded_cb);
state.typing_rule = value;
state.typing_rule.get_filter ().forwarded.connect (
filter_forwarded_cb);
}
}
/**
* Filter which runs before process_key_event.
*
* This is particularly useful for NICOLA.
* @see NicolaKeyEventFilter
*/
public KeyEventFilter key_event_filter {
owned get {
return state_stack.peek_head ().typing_rule.get_filter ();
}
}
/**
* Create a new Context.
*
* @param dictionaries an array of Dict
*
* @return a new Context
*/
public Context (Dict[] dictionaries) {
foreach (var dict in dictionaries) {
add_dictionary (dict);
}
handlers.set (typeof (NoneStateHandler),
new NoneStateHandler ());
handlers.set (typeof (StartStateHandler),
new StartStateHandler ());
handlers.set (typeof (SelectStateHandler),
new SelectStateHandler ());
handlers.set (typeof (AbbrevStateHandler),
new AbbrevStateHandler ());
handlers.set (typeof (KutenStateHandler),
new KutenStateHandler ());
var state = new State (_dictionaries);
_candidates = new ProxyCandidateList (state.candidates);
push_state (state);
_candidates.notify["cursor-pos"].connect (() => {
if (_candidates.cursor_pos >= 0) {
update_preedit ();
}
});
_candidates.selected.connect ((candidate) => {
if (select_candidate_in_dictionaries (candidate)) {
try {
save_dictionaries ();
} catch (GLib.Error e) {
warning ("error saving dictionaries %s", e.message);
}
}
update_preedit ();
});
}
~Context () {
_dictionaries.clear ();
}
void notify_input_mode_cb (Object s, ParamSpec? p) {
notify_property ("input-mode");
}
bool retrieve_surrounding_text_cb (out string text,
out uint cursor_pos)
{
return retrieve_surrounding_text (out text, out cursor_pos);
}
bool delete_surrounding_text_cb (int offset, uint nchars) {
return delete_surrounding_text (offset, nchars);
}
void request_selection_text_cb () {
request_selection_text ();
}
void connect_state_signals (State state) {
state.recursive_edit_start.connect (start_dict_edit);
state.recursive_edit_end.connect (end_dict_edit);
state.recursive_edit_abort.connect (abort_dict_edit);
state.notify["input-mode"].connect (notify_input_mode_cb);
state.retrieve_surrounding_text.connect (
retrieve_surrounding_text_cb);
state.delete_surrounding_text.connect (
delete_surrounding_text_cb);
state.request_selection_text.connect (
request_selection_text_cb);
}
void disconnect_state_signals (State state) {
state.recursive_edit_start.disconnect (start_dict_edit);
state.recursive_edit_end.disconnect (end_dict_edit);
state.recursive_edit_abort.disconnect (abort_dict_edit);
state.notify["input-mode"].disconnect (notify_input_mode_cb);
state.retrieve_surrounding_text.disconnect (
retrieve_surrounding_text_cb);
state.delete_surrounding_text.disconnect (
delete_surrounding_text_cb);
state.request_selection_text.disconnect (
request_selection_text_cb);
}
/**
* Signal emitted when the context requires surrounding-text.
*
* @param text surrounding text
* @param cursor_pos cursor position in text
*
* @return `true` on success, `false` on failure
*/
public signal bool retrieve_surrounding_text (out string text,
out uint cursor_pos);
/**
* Signal emitted when the context requests deletion of
* surrounding-text.
*
* @param offset character offset from the cursor position.
* @param nchars number of characters to delete.
*
* @return `true` on success, `false` on failure
*/
public signal bool delete_surrounding_text (int offset,
uint nchars);
public signal void request_selection_text ();
/**
* Set the current selection text.
*
* @param text selection text
*/
public void set_selection_text (string? text) {
var state = state_stack.peek_head ();
if (text == null)
state.selection.erase();
else
state.selection.assign(text);
}
bool select_candidate_in_dictionaries (Candidate candidate) {
bool changed = false;
foreach (var dict in dictionaries) {
if (!dict.read_only &&
dict.select_candidate (candidate)) {
changed = true;
}
}
return changed;
}
uint dict_edit_level () {
return state_stack.size - 1;
}
void push_state (State state) {
if (!state_stack.is_empty) {
disconnect_state_signals (state_stack.peek_head ());
}
state_stack.offer_head (state);
connect_state_signals (state);
var pcandidates = (ProxyCandidateList) _candidates;
if (pcandidates.candidates != state.candidates) {
pcandidates.candidates = state.candidates;
}
}
void pop_state () {
assert (!state_stack.is_empty);
disconnect_state_signals (state_stack.poll_head ());
if (!state_stack.is_empty) {
var state = state_stack.peek_head ();
connect_state_signals (state);
var pcandidates = (ProxyCandidateList) _candidates;
if (pcandidates.candidates != state.candidates) {
pcandidates.candidates = state.candidates;
}
}
}
void start_dict_edit (string midasi, bool okuri) {
var state = new State (_dictionaries);
state.typing_rule = typing_rule;
state.midasi = midasi;
push_state (state);
update_preedit ();
}
bool end_dict_edit (string text) {
string? midasi;
bool? okuri;
if (leave_dict_edit (out midasi, out okuri)) {
var candidate = new Candidate (midasi, okuri, text);
if (select_candidate_in_dictionaries (candidate)) {
try {
save_dictionaries ();
} catch (GLib.Error e) {
warning ("error saving dictionaries %s", e.message);
}
}
var state = state_stack.peek_head ();
state.reset ();
state.output.assign (text);
update_preedit ();
return true;
}
return false;
}
bool leave_dict_edit (out string? midasi, out bool? okuri) {
if (dict_edit_level () > 0) {
var state = state_stack.peek_head ();
midasi = state.midasi;
pop_state ();
state = state_stack.peek_head ();
okuri = state.okuri;
if (state.candidates.size == 0)
state.cancel_okuri ();
return true;
}
midasi = null;
okuri = false;
return false;
}
bool abort_dict_edit () {
string? midasi;
bool? okuri;
if (leave_dict_edit (out midasi, out okuri)) {
update_preedit ();
return true;
}
return false;
}
/**
* Pass key events (separated by spaces) to the context.
*
* This function is rarely used in programs but in unit tests.
*
* @param keyseq a string representing key events, separated by " "
*
* @return `true` if any of key events are handled, `false` otherwise
*/
public bool process_key_events (string keyseq) {
Gee.List keys = new ArrayList ();
var builder = new StringBuilder ();
bool complex = false;
bool escaped = false;
int index = 0;
unichar uc;
while (keyseq.get_next_char (ref index, out uc)) {
if (escaped) {
builder.append_unichar (uc);
escaped = false;
continue;
}
switch (uc) {
case '\\':
escaped = true;
break;
case '(':
if (complex) {
warning ("bare '(' is not allowed in complex keyseq");
return false;
}
complex = true;
builder.append_unichar (uc);
break;
case ')':
if (!complex) {
warning ("bare ')' is not allowed in simple keyseq");
return false;
}
complex = false;
builder.append_unichar (uc);
keys.add (builder.str);
builder.erase ();
break;
case ' ':
if (complex) {
builder.append_unichar (uc);
}
else if (builder.len > 0) {
keys.add (builder.str);
builder.erase ();
}
break;
default:
builder.append_unichar (uc);
break;
}
}
if (complex) {
warning ("premature end of key events");
return false;
}
if (builder.len > 0) {
keys.add (builder.str);
}
bool retval = false;
foreach (var key in keys) {
if (key == "SPC")
key = " ";
else if (key == "TAB")
key = "\t";
else if (key == "RET")
key = "\n";
else if (key == "DEL")
key = "\b";
KeyEvent ev;
try {
ev = new KeyEvent.from_string (key);
} catch (KeyEventFormatError e) {
warning ("can't get key event from string %s: %s",
key, e.message);
return false;
}
if (process_key_event (ev) && !retval)
retval = true;
}
return retval;
}
/**
* Pass one key event to the context.
*
* @param key a key event
*
* @return `true` if the key event is handled, `false` otherwise
*/
public bool process_key_event (KeyEvent key) {
KeyEvent? _key = key_event_filter.filter_key_event (key);
if (_key == null) {
// Let key release events pass through when not editing
// dictionary, because they would be necessary for some
// web applications to correctly handle key events when
// focused to text box.
return ((key.modifiers & ModifierType.RELEASE_MASK) == 0 &&
dict_edit_level () == 0);
}
return process_key_event_internal (_key);
}
bool process_key_event_internal (KeyEvent key) {
KeyEvent _key = key.copy ();
var state = state_stack.peek_head ();
while (true) {
var handler_type = state.handler_type;
var handler = handlers.get (handler_type);
if (handler.process_key_event (state, ref _key)) {
// FIXME should do this only when preedit is really changed
update_preedit ();
return true;
}
// state.handler_type may change if handler cannot
// handle the event. In that case retry with the new
// handler. Otherwise exit the loop.
if (handler_type == state.handler_type) {
// consume all events when we are in dict edit mode
return dict_edit_level () > 0;
}
}
}
/**
* Reset the context.
*/
public void reset () {
// cancel all dict edit
while (dict_edit_level () > 0) {
pop_state ();
state_stack.peek_head ().cancel_okuri ();
}
var state = state_stack.peek_head ();
// will clear state.candidates but not state.output
state.reset ();
// need to manually assign it because
// _candidates.candidates may point to a State object different
// from state, when dict edit
((ProxyCandidateList) _candidates).candidates = state.candidates;
// clear output and preedit
clear_output ();
preedit = "";
}
/**
* This is replaced with {@link poll_output}.
*
* @return an output string
* Deprecated: 0.0.6
*/
public string get_output () {
return poll_output ();
}
string retrieve_output (bool clear) {
// get the output from the top level state
var state = state_stack.last ();
var handler = handlers.get (state.handler_type);
var output = handler.get_output (state);
if (clear) {
state.output.erase ();
}
return output;
}
/**
* Peek (retrieve, but not remove) the current output string.
*
* @return an output string
* @since 0.0.6
*/
public string peek_output () {
return retrieve_output (false);
}
/**
* Poll (retrieve and remove) the current output string.
*
* @return an output string
* @since 0.0.6
*/
public string poll_output () {
return retrieve_output (true);
}
/**
* Clear the output buffer.
*
* @since 0.0.6
*/
public void clear_output () {
state_stack.peek_head ().output.erase ();
}
/**
* Current preedit string.
*/
[CCode(notify = false)]
public string preedit { get; private set; default = ""; }
void update_preedit () {
var builder = new StringBuilder ();
var iter = state_stack.bidir_list_iterator ();
iter.last ();
while (iter.has_previous ()) {
var state = iter.get ();
var handler = handlers.get (state.handler_type);
// if state is not top level, need to prepend output to preedit
if (iter.has_next ())
builder.append (handler.get_output (state));
iter.previous ();
state = iter.get ();
builder.append ("▼");
builder.append (state.midasi);
builder.append ("【");
}
var state = state_stack.peek_head ();
var handler = handlers.get (state.handler_type);
if (dict_edit_level () > 0)
builder.append (handler.get_output (state));
uint start = (uint) builder.str.char_count ();
uint offset, nchars;
builder.append (handler.get_preedit (state,
out offset,
out nchars));
offset += start;
var level = dict_edit_level ();
for (var i = 0; i < level; i++) {
builder.append ("】");
}
bool changed = false;
if (preedit != builder.str) {
preedit = builder.str;
changed = true;
}
if (preedit_underline_offset != offset ||
preedit_underline_nchars != nchars) {
preedit_underline_offset = offset;
preedit_underline_nchars = nchars;
changed = true;
}
if (changed) {
notify_property ("preedit");
}
}
uint preedit_underline_offset = 0;
uint preedit_underline_nchars = 0;
/**
* Get underlined range of preedit.
*
* @param offset starting offset (in chars) of underline
* @param nchars number of characters to be underlined
* @since 0.0.6
*/
public void get_preedit_underline (out uint offset, out uint nchars) {
offset = preedit_underline_offset;
nchars = preedit_underline_nchars;
}
/**
* Save dictionaries on to disk.
*/
public void save_dictionaries () throws GLib.Error {
foreach (var dict in dictionaries) {
if (!dict.read_only) {
dict.save ();
}
}
}
}
}
libskk-master/libskk/dict.vala 0000664 0000000 0000000 00000012462 14665226114 0016711 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
namespace Skk {
/**
* Base abstract class of dictionaries.
*/
public abstract class Dict : Object {
/**
* Parse a line consisting of candidates separated by "/".
*
* @param line a line consisting of candidates
* @return an array of Candidates
*/
protected Candidate[] split_candidates (string midasi,
bool okuri,
string line)
{
var strv = line.strip ().slice (1, -1).split ("/");
Candidate[] candidates = new Candidate[strv.length];
for (int i = 0; i < strv.length; i++) {
var text_annotation = strv[i].split (";", 2);
string text, annotation;
if (text_annotation.length == 2) {
text = text_annotation[0];
annotation = text_annotation[1];
} else {
text = strv[i];
annotation = null;
}
candidates[i] = new Candidate (midasi,
okuri,
text,
annotation);
}
return candidates;
}
/**
* Format an array of Candidates to be saved in a dictionary file.
*
* @param candidates an array of Candidate
* @return a string
*/
protected string join_candidates (Candidate[] candidates) {
var strv = new string[candidates.length];
for (int i = 0; i < candidates.length; i++) {
strv[i] = candidates[i].to_string ();
}
return "/" + string.joinv ("/", strv) + "/";
}
/**
* Reload the dictionary.
*
* @throws GLib.Error when reading the dictionary failed.
*/
public abstract void reload () throws GLib.Error;
/**
* Lookup candidates in the dictionary.
*
* @param midasi a midasi (title) string to lookup
* @param okuri whether to search okuri-ari entries or
* okuri-nasi entries
*
* @return an array of Candidate
*/
public abstract Candidate[] lookup (string midasi, bool okuri = false);
/**
* Return an array of strings which matches midasi.
*
* @param midasi a midasi (title) string to lookup
*
* @return an array of strings
*/
public abstract string[] complete (string midasi);
/**
* Flag to indicate whether the dictionary is read only.
*/
public abstract bool read_only { get; }
/**
* Select a candidate in the dictionary.
*
* @param candidate an Candidate
*
* @return `true` if the dictionary is modified, `false` otherwise.
*/
public virtual bool select_candidate (Candidate candidate)
{
// FIXME: throw an error when the dictionary is read only
return false;
}
/**
* Purge a candidate in the dictionary.
*
* @param candidate an Candidate
*
* @return `true` if the dictionary is modified, `false` otherwise.
*/
public virtual bool purge_candidate (Candidate candidate)
{
// FIXME: throw an error when the dictionary is read only
return false;
}
/**
* Save the dictionary on disk.
*
* @throws GLib.Error if the dictionary cannot be saved.
*/
public virtual void save () throws GLib.Error {
// FIXME: throw an error when the dictionary is read only
}
}
/**
* Null implementation of Dict.
*/
public class EmptyDict : Dict {
/**
* {@inheritDoc}
*/
public override void reload () throws GLib.Error {
}
/**
* {@inheritDoc}
*/
public override Candidate[] lookup (string midasi, bool okuri = false) {
return new Candidate[0];
}
/**
* {@inheritDoc}
*/
public override string[] complete (string midasi) {
return new string[0];
}
/**
* {@inheritDoc}
*/
public override bool read_only {
get {
return true;
}
}
}
errordomain SkkDictError {
NOT_READABLE,
MALFORMED_INPUT
}
}
libskk-master/libskk/encoding.vala 0000664 0000000 0000000 00000010525 14665226114 0017552 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
namespace Skk {
// XXX: we use Vala string to represent byte array, assuming that
// it does not contain null element
class EncodingConverter : Object {
const int BUFSIZ = 4096;
const string INTERNAL_ENCODING = "UTF-8";
const Entry ENCODING_TO_CODING_SYSTEM_RULE[] = {
{ "UTF-8", "utf-8" },
{ "EUC-JP", "euc-jp" },
{ "Shift_JIS", "shift_jis" },
{ "ISO-2022-JP", "iso-2022-jp" },
{ "EUC-JISX0213", "euc-jisx0213" },
{ "EUC-JISX0213", "euc-jis-2004" },
{ "SHIFT_JISX0213", "shift_jis-2004" }
};
static Regex coding_cookie_regex;
static construct {
try {
coding_cookie_regex = new Regex (
"-\\*-.*[ \t]coding:[ \t]*([^ \t;]+?)[ \t;].*-\\*-");
} catch (GLib.RegexError e) {
assert_not_reached ();
}
}
internal static string? extract_coding_system (string line) {
MatchInfo info = null;
if (coding_cookie_regex.match (line, 0, out info)) {
return info.fetch (1);
}
return null;
}
internal string? get_coding_system () {
foreach (var entry in ENCODING_TO_CODING_SYSTEM_RULE) {
if (entry.key == encoding) {
return entry.value;
}
}
return null;
}
internal string encoding { get; private set; }
CharsetConverter encoder;
CharsetConverter decoder;
internal EncodingConverter (string encoding) throws GLib.Error {
this.encoding = encoding;
encoder = new CharsetConverter (encoding, INTERNAL_ENCODING);
decoder = new CharsetConverter (INTERNAL_ENCODING, encoding);
}
internal EncodingConverter.from_coding_system (string coding) throws GLib.Error {
foreach (var entry in ENCODING_TO_CODING_SYSTEM_RULE) {
if (entry.value == coding) {
this (entry.key);
return;
}
}
assert_not_reached ();
}
string convert (CharsetConverter converter, string str) throws GLib.Error {
uint8[] inbuf = str.data;
uint8[] outbuf = new uint8[BUFSIZ];
StringBuilder builder = new StringBuilder ();
size_t total_bytes_read = 0;
while (total_bytes_read < inbuf.length) {
size_t bytes_read, bytes_written;
// FIXME: we could split inbuf to small segments (<
// BUFSIZ) here to reduce memory copy. However it
// requires proper error handling when the end of
// segmented buffer lies across a UTF-8 character
// boundary.
converter.convert (inbuf[total_bytes_read : inbuf.length],
outbuf,
ConverterFlags.INPUT_AT_END,
out bytes_read,
out bytes_written);
for (int i = 0; i < bytes_written; i++)
builder.append_c ((char)outbuf[i]);
total_bytes_read += bytes_read;
}
return builder.str;
}
internal string encode (string internal_str) throws GLib.Error {
return convert (encoder, internal_str);
}
internal string decode (string external_str) throws GLib.Error {
return convert (decoder, external_str);
}
}
}
libskk-master/libskk/expr.vala 0000664 0000000 0000000 00000016754 14665226114 0016754 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
using Gee;
namespace Skk {
enum ExprNodeType {
ARRAY,
SYMBOL,
STRING
}
struct ExprNode {
public ExprNodeType type;
public LinkedList nodes;
public string data;
public ExprNode (ExprNodeType type) {
this.type = type;
}
}
class ExprReader : Object {
public ExprNode read_symbol (string expr, ref int index) {
var builder = new StringBuilder ();
bool stop = false;
unichar uc = '\0';
while (!stop && expr.get_next_char (ref index, out uc)) {
switch (uc) {
case '\\':
if (expr.get_next_char (ref index, out uc)) {
builder.append_unichar (uc);
}
break;
case '(': case ')': case '"': case ' ':
stop = true;
break;
default:
builder.append_unichar (uc);
break;
}
}
var node = ExprNode (ExprNodeType.SYMBOL);
node.data = builder.str;
return node;
}
public ExprNode? read_string (string expr, ref int index) {
return_val_if_fail (index < expr.length && expr[index] == '"',
null);
var builder = new StringBuilder ();
index++;
bool stop = false;
unichar uc = '\0';
while (!stop && expr.get_next_char (ref index, out uc)) {
switch (uc) {
case '\\':
if (expr.get_next_char (ref index, out uc)) {
switch (uc) {
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
int start = index;
int advance = 0;
int num = (int) uc - '0';
while (expr.get_next_char (ref index, out uc)) {
if (index - start == 3)
break;
if (uc < '0' || uc > '7')
break;
num <<= 3;
num += (int) uc - '0';
advance++;
}
index = start + advance;
uc = (unichar) num;
break;
case 'x':
int start = index;
int advance = 0;
int num = 0;
while (expr.get_next_char (ref index, out uc)) {
uc = uc.tolower ();
if ('0' <= uc && uc <= '9') {
num <<= 4;
num += (int) uc - '0';
} else if ('a' <= uc && uc <= 'f') {
num <<= 4;
num += (int) uc - 'a' + 10;
} else
break;
advance++;
}
index = start + advance;
uc = (unichar) num;
break;
default:
break;
}
builder.append_unichar (uc);
}
break;
case '\"':
stop = true;
break;
default:
builder.append_unichar (uc);
break;
}
}
var node = ExprNode (ExprNodeType.STRING);
node.data = builder.str;
return node;
}
public ExprNode? read_expr (string expr, ref int index) {
return_val_if_fail (index < expr.length && expr[index] == '(',
null);
var nodes = new LinkedList ();
bool stop = false;
index++;
unichar uc = '\0';
while (!stop && expr.get_next_char (ref index, out uc)) {
switch (uc) {
case ' ':
break;
case ')':
index++;
stop = true;
break;
case '(':
index--;
nodes.add (read_expr (expr, ref index));
break;
case '"':
index--;
nodes.add (read_string (expr, ref index));
break;
default:
index--;
nodes.add (read_symbol (expr, ref index));
break;
}
}
var node = ExprNode (ExprNodeType.ARRAY);
node.nodes = nodes;
return node;
}
}
class ExprEvaluator : Object {
public string? eval (ExprNode node) {
if (node.type == ExprNodeType.ARRAY) {
var iter = node.nodes.list_iterator ();
if (iter.next ()) {
var funcall = iter.get ();
if (funcall.type == ExprNodeType.SYMBOL) {
// FIXME support other functions in more extensible way
if (funcall.data == "concat") {
var builder = new StringBuilder ();
while (iter.next ()) {
var arg = iter.get ();
if (arg.type == ExprNodeType.STRING) {
builder.append (arg.data);
}
}
return builder.str;
}
else if (funcall.data == "current-time-string") {
var datetime = new DateTime.now_local ();
return datetime.format ("%a, %d %b %Y %T %z");
}
else if (funcall.data == "pwd") {
return Environment.get_current_dir ();
}
else if (funcall.data == "skk-version") {
return "%s/%s".printf (Config.PACKAGE_NAME,
Config.PACKAGE_VERSION);
}
}
}
}
return null;
}
}
}
libskk-master/libskk/file-dict.vala 0000664 0000000 0000000 00000030037 14665226114 0017624 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
using Gee;
namespace Skk {
/**
* Read-only file based implementation of Dict.
*/
public class FileDict : Dict {
// Read a line near offset and move offset to the beginning of
// the line.
string read_line (ref long offset) {
return_val_if_fail (offset < mmap.length, null);
char *p = ((char *)mmap.memory + offset);
for (; offset > 0; offset--, p--) {
if (*p == '\n')
break;
}
if (offset > 0) {
offset++;
p++;
}
var builder = new StringBuilder ();
long _offset = offset;
for (; _offset < mmap.length; _offset++, p++) {
if (*p == '\n')
break;
builder.append_c (*p);
}
return builder.str;
}
// can only called after read*_line
string? read_previous_line (ref long pos, string line) {
if (pos < 2) {
return null;
}
// place the cursor at the end of the previous line
pos -= 2;
return read_line (ref pos);
}
// can only called after read*_line
string? read_next_line (ref long pos, string line) {
if (pos + line.length + 1 >= mmap.length) {
return null;
}
// place the cursor at "\n" of the current line
pos += line.length + 1;
return read_line (ref pos);
}
// Skip until the first occurrence of line. This moves offset
// at the beginning of the next line.
bool read_until (ref long offset, string line) {
return_val_if_fail (offset < mmap.length, false);
while (offset + line.length < mmap.length) {
char *p = ((char *)mmap.memory + offset);
if (*p == '\n' &&
Memory.cmp (p + 1, (void *)line, line.length) == 0) {
offset += line.length;
return true;
}
offset++;
}
return false;
}
void load () throws SkkDictError {
mmap.remap ();
long offset = 0;
var line = read_line (ref offset);
if (line == null) {
throw new SkkDictError.MALFORMED_INPUT (
"can't read the first line");
}
var coding = EncodingConverter.extract_coding_system (line);
if (coding != null) {
try {
var _converter = new EncodingConverter.from_coding_system (
coding);
if (_converter != null) {
converter = _converter;
}
} catch (Error e) {
warning ("can't create converter from coding system %s: %s",
coding, e.message);
}
}
offset = 0;
if (!read_until (ref offset, ";; okuri-ari entries.\n")) {
throw new SkkDictError.MALFORMED_INPUT (
"no okuri-ari boundary");
}
okuri_ari_offset = offset;
if (!read_until (ref offset, ";; okuri-nasi entries.\n")) {
throw new SkkDictError.MALFORMED_INPUT (
"no okuri-nasi boundary");
}
okuri_nasi_offset = offset;
}
/**
* {@inheritDoc}
*/
public override void reload () throws GLib.Error {
#if VALA_0_16
string attributes = FileAttribute.ETAG_VALUE;
#else
string attributes = FILE_ATTRIBUTE_ETAG_VALUE;
#endif
FileInfo info = file.query_info (attributes,
FileQueryInfoFlags.NONE);
if (info.get_etag () != etag) {
try {
load ();
etag = info.get_etag ();
} catch (SkkDictError e) {
warning ("error loading file dictionary %s %s",
file.get_path (), e.message);
}
}
}
bool search_pos (string midasi,
long start_offset,
long end_offset,
CompareFunc cmp,
out long pos,
out string? line,
int direction) {
long offset = start_offset + (end_offset - start_offset) / 2;
while (start_offset <= end_offset) {
assert (offset < mmap.length);
string _line = read_line (ref offset);
int index = _line.index_of (" ");
if (index < 1) {
warning ("corrupted dictionary entry: %s", _line);
break;
}
int r = cmp (_line[0:index], midasi);
if (r == 0) {
pos = offset;
line = _line;
return true;
}
if (r * direction > 0) {
end_offset = offset - 2;
} else {
start_offset = offset + _line.length + 1;
}
offset = start_offset + (end_offset - start_offset) / 2;
}
pos = -1;
line = null;
return false;
}
/**
* {@inheritDoc}
*/
public override Candidate[] lookup (string midasi, bool okuri = false) {
if (mmap.memory == null)
return new Candidate[0];
long start_offset, end_offset;
if (okuri) {
start_offset = okuri_ari_offset;
end_offset = okuri_nasi_offset;
} else {
start_offset = okuri_nasi_offset;
end_offset = (long) mmap.length - 1;
}
string _midasi;
try {
_midasi = converter.encode (midasi);
} catch (GLib.Error e) {
warning ("can't encode %s: %s", midasi, e.message);
return new Candidate[0];
}
long pos;
string line;
if (search_pos (_midasi,
start_offset,
end_offset,
strcmp,
out pos,
out line,
okuri ? -1 : 1)) {
int index = line.index_of (" ");
string _line;
if (index > 0) {
try {
_line = converter.decode (line[index:line.length]);
} catch (GLib.Error e) {
warning ("can't decode line %s: %s",
line, e.message);
return new Candidate[0];
}
return split_candidates (midasi, okuri, _line);
}
}
return new Candidate[0];
}
static int strcmp_prefix (string a, string b) {
if (a.has_prefix (b))
return 0;
return strcmp (a, b);
}
/**
* {@inheritDoc}
*/
public override string[] complete (string midasi) {
if (mmap.memory == null)
return new string[0];
var completion = new ArrayList ();
long start_offset, end_offset;
start_offset = okuri_nasi_offset;
end_offset = (long) mmap.length - 1;
string _midasi;
try {
_midasi = converter.encode (midasi);
} catch (GLib.Error e) {
warning ("can't decode %s: %s", midasi, e.message);
return completion.to_array ();
}
long pos;
string line;
if (search_pos (_midasi,
start_offset,
end_offset,
strcmp_prefix,
out pos,
out line,
1)) {
long _pos = pos;
string _line = line;
// search backward
do {
int index = line.index_of (" ");
if (index < 0) {
warning ("corrupted dictionary entry: %s",
line);
} else {
var completed = line[0:index];
// don't add midasi word itself
if (completed != _midasi) {
try {
string decoded = converter.decode (completed);
completion.insert (0, decoded);
} catch (GLib.Error e) {
warning ("can't decode line %s: %s",
line, e.message);
}
}
}
} while ((line = read_previous_line (ref pos, line)) != null &&
line.has_prefix (_midasi));
// search forward
pos = _pos;
line = _line;
while ((line = read_next_line (ref pos, line)) != null &&
line.has_prefix (_midasi)) {
int index = line.index_of (" ");
if (index < 0) {
warning ("corrupted dictionary entry: %s",
line);
} else {
var completed = line[0:index];
// don't add midasi word itself
if (completed != _midasi) {
try {
string decoded = converter.decode (completed);
completion.add (decoded);
} catch (GLib.Error e) {
warning ("can't decode line %s: %s",
line, e.message);
}
}
}
}
}
return completion.to_array ();
}
/**
* {@inheritDoc}
*/
public override bool read_only {
get {
return true;
}
}
File file;
MemoryMappedFile mmap;
string etag;
EncodingConverter converter;
long okuri_ari_offset;
long okuri_nasi_offset;
/**
* Create a new FileDict.
*
* @param path a path to the file
* @param encoding encoding of the file (default EUC-JP)
*
* @return a new FileDict
* @throws GLib.Error if opening the file is failed
*/
public FileDict (string path,
string encoding = "EUC-JP") throws GLib.Error
{
this.file = File.new_for_path (path);
this.mmap = new MemoryMappedFile (file);
this.etag = "";
this.converter = new EncodingConverter (encoding);
reload ();
}
}
}
libskk-master/libskk/key-event-filter.vala 0000664 0000000 0000000 00000004066 14665226114 0021161 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
namespace Skk {
/**
* Base class of a key event filter.
*/
public abstract class KeyEventFilter : Object {
/**
* Convert a key event to another.
*
* @param key a key event
*
* @return a KeyEvent or `null` if the result cannot be
* fetched immediately
*/
public abstract KeyEvent? filter_key_event (KeyEvent key);
/**
* Signal emitted when a new key event is generated in the filter.
*
* @param key a key event
*/
public signal void forwarded (KeyEvent key);
/**
* Reset the filter.
*/
public virtual void reset () {
}
}
/**
* Simple implementation of a key event filter.
*
* This class is rarely used in programs but specified as "filter"
* property in rule metadata.
*
* @see Rule
*/
class SimpleKeyEventFilter : KeyEventFilter {
/**
* {@inheritDoc}
*/
public override KeyEvent? filter_key_event (KeyEvent key) {
// ignore key release event
if ((key.modifiers & ModifierType.RELEASE_MASK) != 0)
return null;
// clear shift mask
key.modifiers &= ~ModifierType.SHIFT_MASK;
return key;
}
}
} libskk-master/libskk/key-event.vala 0000664 0000000 0000000 00000024751 14665226114 0017701 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
using Gee;
namespace Skk {
public errordomain KeyEventFormatError {
PARSE_FAILED,
KEYSYM_NOT_FOUND
}
/**
* A set of bit-flags to indicate the state of modifier keys.
*/
[Flags]
public enum ModifierType {
NONE = 0,
SHIFT_MASK = 1 << 0,
LOCK_MASK = 1 << 1,
CONTROL_MASK = 1 << 2,
MOD1_MASK = 1 << 3,
MOD2_MASK = 1 << 4,
MOD3_MASK = 1 << 5,
MOD4_MASK = 1 << 6,
MOD5_MASK = 1 << 7,
// dummy modifiers for NICOLA
LSHIFT_MASK = 1 << 22,
RSHIFT_MASK = 1 << 23,
USLEEP_MASK = 1 << 24,
SUPER_MASK = 1 << 26,
HYPER_MASK = 1 << 27,
META_MASK = 1 << 28,
RELEASE_MASK = 1 << 30
}
/**
* Object representing a key event.
*/
public class KeyEvent : Object {
/**
* The base name of the KeyEvent.
*
* This is exclusive to {@link code}.
*/
public string? name { get; private set; }
/**
* The base code of the KeyEvent.
*
* This is exclusive to {@link name}.
*/
public unichar code { get; private set; }
/**
* Modifier mask.
*/
public ModifierType modifiers { get; set; }
/**
* Create a key event.
*
* @param name a key name
* @param code a character code
* @param modifiers state of modifier keys
*
* @return a new KeyEvent
*/
public KeyEvent (string? name,
unichar code,
ModifierType modifiers) {
this.name = name;
this.code = code;
this.modifiers = modifiers;
}
/**
* Create a copy of the key event.
*
* @return a new KeyEvent
*/
public KeyEvent copy () {
return new KeyEvent (name, code, modifiers);
}
/**
* Create a key event from string.
*
* @param key a string representation of a key event
*
* @return a new KeyEvent
*/
public KeyEvent.from_string (string key) throws KeyEventFormatError {
ModifierType _modifiers = 0;
uint _keyval = Keysyms.VoidSymbol;
if (key.has_prefix ("(usleep ") && key.has_suffix (")")) {
// special key event for SKK-NICOLA
var strv = key[1:-1].split (" ");
if (strv.length != 2) {
throw new KeyEventFormatError.PARSE_FAILED (
"usleep requires duration");
}
name = strv[1];
code = '\0';
modifiers |= ModifierType.USLEEP_MASK;
} else if (key.has_prefix ("(") && key.has_suffix (")")) {
var strv = key[1:-1].split (" ");
int index = 0;
for (; index < strv.length - 1; index++) {
if (strv[index] == "shift") {
_modifiers |= ModifierType.SHIFT_MASK;
} else if (strv[index] == "control") {
_modifiers |= ModifierType.CONTROL_MASK;
} else if (strv[index] == "meta") {
_modifiers |= ModifierType.META_MASK;
} else if (strv[index] == "hyper") {
_modifiers |= ModifierType.HYPER_MASK;
} else if (strv[index] == "super") {
_modifiers |= ModifierType.SUPER_MASK;
} else if (strv[index] == "alt") {
_modifiers |= ModifierType.MOD1_MASK;
} else if (strv[index] == "lshift") {
_modifiers |= ModifierType.LSHIFT_MASK;
} else if (strv[index] == "rshift") {
_modifiers |= ModifierType.RSHIFT_MASK;
} else if (strv[index] == "release") {
_modifiers |= ModifierType.RELEASE_MASK;
} else {
throw new KeyEventFormatError.PARSE_FAILED (
"unknown modifier %s", strv[index]);
}
}
// special key event for SKK-NICOLA
if (strv[index] == "lshift" || strv[index] == "rshift") {
name = strv[index];
code = '\0';
modifiers = ModifierType.NONE;
} else {
_keyval = KeyEventUtils.keyval_from_name (strv[index]);
if (_keyval == Keysyms.VoidSymbol)
throw new KeyEventFormatError.PARSE_FAILED (
"unknown keyval %s", strv[index]);
name = KeyEventUtils.keyval_name (_keyval);
code = KeyEventUtils.keyval_unicode (_keyval);
modifiers = _modifiers;
}
} else if (key.has_prefix ("[") && key.has_suffix ("]") &&
key.char_count () == 4) {
// special double key press events (SKK-NICOLA extension)
name = key;
code = '\0';
modifiers = ModifierType.NONE;
} else {
int index = key.last_index_of ("-");
string? _name = null;
if (index > 0) {
// support only limited modifiers in this form
string[] mods = key.substring (0, index).split ("-");
foreach (var mod in mods) {
if (mod == "S") {
_modifiers |= ModifierType.SHIFT_MASK;
} else if (mod == "C") {
_modifiers |= ModifierType.CONTROL_MASK;
} else if (mod == "A") {
_modifiers |= ModifierType.MOD1_MASK;
} else if (mod == "M") {
_modifiers |= ModifierType.META_MASK;
} else if (mod == "G") {
_modifiers |= ModifierType.MOD5_MASK;
}
}
_name = key.substring (index + 1);
} else {
_modifiers = ModifierType.NONE;
_name = key;
}
_keyval = KeyEventUtils.keyval_from_name (_name);
if (_keyval == Keysyms.VoidSymbol)
throw new KeyEventFormatError.PARSE_FAILED (
"unknown keyval %s", _name);
name = KeyEventUtils.keyval_name (_keyval);
code = KeyEventUtils.keyval_unicode (_keyval);
modifiers = _modifiers;
}
}
/**
* Convert the KeyEvent to string.
*
* @return a string representing the KeyEvent
*/
public string to_string () {
string _base = name != null ? name : code.to_string ();
if (modifiers != 0) {
ArrayList elements = new ArrayList ();
if ((modifiers & ModifierType.CONTROL_MASK) != 0) {
elements.add ("control");
}
if ((modifiers & ModifierType.META_MASK) != 0) {
elements.add ("meta");
}
if ((modifiers & ModifierType.HYPER_MASK) != 0) {
elements.add ("hyper");
}
if ((modifiers & ModifierType.SUPER_MASK) != 0) {
elements.add ("super");
}
if ((modifiers & ModifierType.MOD1_MASK) != 0) {
elements.add ("alt");
}
if ((modifiers & ModifierType.LSHIFT_MASK) != 0) {
elements.add ("lshift");
}
if ((modifiers & ModifierType.RSHIFT_MASK) != 0) {
elements.add ("rshift");
}
if ((modifiers & ModifierType.USLEEP_MASK) != 0) {
elements.add ("usleep");
}
if ((modifiers & ModifierType.RELEASE_MASK) != 0) {
elements.add ("release");
}
elements.add (_base);
elements.add (null); // make sure that strv ends with null
// newer valac thinks null in a fixed length array as
// an empty string
var array = elements.to_array ();
// Change length of strv may make vala no able to free it
// correctly. Save the length and restore it later.
var old_length = array.length;
array.length = -1;
var key_string = "(" + string.joinv (" ", array) + ")";
array.length = old_length;
return key_string;
} else {
return _base;
}
}
/**
* Create a key event from an X keysym and modifiers.
*
* @param keyval an X keysym
* @param modifiers modifier mask
*
* @return a new KeyEvent
*/
public KeyEvent.from_x_keysym (uint keyval,
ModifierType modifiers) throws KeyEventFormatError {
name = KeyEventUtils.keyval_name (keyval);
code = KeyEventUtils.keyval_unicode (keyval);
this.modifiers = modifiers;
}
/**
* Compare two key events ignoring modifiers.
*
* @param key a KeyEvent
*
* @return `true` if those base components are equal, `false` otherwise
*/
public bool base_equal (KeyEvent key) {
return code == key.code && name == key.name;
}
}
}
libskk-master/libskk/keymap.vala 0000664 0000000 0000000 00000003647 14665226114 0017261 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
using Gee;
namespace Skk {
class Keymap : Object {
Map entries = new HashMap ();
public new void @set (string key, string command) {
try {
var ev = new KeyEvent.from_string (key);
entries.set (ev.to_string (), command);
} catch (KeyEventFormatError e) {
warning ("can't get key event from string %s: %s",
key, e.message);
}
}
public string? lookup_key (KeyEvent key) {
return entries.get (key.to_string ());
}
public KeyEvent? where_is (string command) {
var iter = entries.map_iterator ();
while (iter.next ()) {
if (iter.get_value () == command) {
var key = iter.get_key ();
try {
return new KeyEvent.from_string (key);
} catch (KeyEventFormatError e) {
warning ("can't get key event from string %s: %s",
key, e.message);
}
}
}
return null;
}
}
}
libskk-master/libskk/keysyms.vala 0000664 0000000 0000000 00000271561 14665226114 0017501 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
namespace Skk.Keysyms {
// converted from /usr/include/X11/keysymdef.h with:
public const uint VoidSymbol = 0xffffff;
public const uint BackSpace = 0xff08;
public const uint Tab = 0xff09;
public const uint Linefeed = 0xff0a;
public const uint Clear = 0xff0b;
public const uint Return = 0xff0d;
public const uint Pause = 0xff13;
public const uint Scroll_Lock = 0xff14;
public const uint Sys_Req = 0xff15;
public const uint Escape = 0xff1b;
public const uint Delete = 0xffff;
public const uint Multi_key = 0xff20;
public const uint Codeinput = 0xff37;
public const uint SingleCandidate = 0xff3c;
public const uint MultipleCandidate = 0xff3d;
public const uint PreviousCandidate = 0xff3e;
public const uint Kanji = 0xff21;
public const uint Muhenkan = 0xff22;
public const uint Henkan_Mode = 0xff23;
public const uint Henkan = 0xff23;
public const uint Romaji = 0xff24;
public const uint Hiragana = 0xff25;
public const uint Katakana = 0xff26;
public const uint Hiragana_Katakana = 0xff27;
public const uint Zenkaku = 0xff28;
public const uint Hankaku = 0xff29;
public const uint Zenkaku_Hankaku = 0xff2a;
public const uint Touroku = 0xff2b;
public const uint Massyo = 0xff2c;
public const uint Kana_Lock = 0xff2d;
public const uint Kana_Shift = 0xff2e;
public const uint Eisu_Shift = 0xff2f;
public const uint Eisu_toggle = 0xff30;
public const uint Kanji_Bangou = 0xff37;
public const uint Zen_Koho = 0xff3d;
public const uint Mae_Koho = 0xff3e;
public const uint Home = 0xff50;
public const uint Left = 0xff51;
public const uint Up = 0xff52;
public const uint Right = 0xff53;
public const uint Down = 0xff54;
public const uint Prior = 0xff55;
public const uint Page_Up = 0xff55;
public const uint Next = 0xff56;
public const uint Page_Down = 0xff56;
public const uint End = 0xff57;
public const uint Begin = 0xff58;
public const uint Select = 0xff60;
public const uint Print = 0xff61;
public const uint Execute = 0xff62;
public const uint Insert = 0xff63;
public const uint Undo = 0xff65;
public const uint Redo = 0xff66;
public const uint Menu = 0xff67;
public const uint Find = 0xff68;
public const uint Cancel = 0xff69;
public const uint Help = 0xff6a;
public const uint Break = 0xff6b;
public const uint Mode_switch = 0xff7e;
public const uint script_switch = 0xff7e;
public const uint Num_Lock = 0xff7f;
public const uint KP_Space = 0xff80;
public const uint KP_Tab = 0xff89;
public const uint KP_Enter = 0xff8d;
public const uint KP_F1 = 0xff91;
public const uint KP_F2 = 0xff92;
public const uint KP_F3 = 0xff93;
public const uint KP_F4 = 0xff94;
public const uint KP_Home = 0xff95;
public const uint KP_Left = 0xff96;
public const uint KP_Up = 0xff97;
public const uint KP_Right = 0xff98;
public const uint KP_Down = 0xff99;
public const uint KP_Prior = 0xff9a;
public const uint KP_Page_Up = 0xff9a;
public const uint KP_Next = 0xff9b;
public const uint KP_Page_Down = 0xff9b;
public const uint KP_End = 0xff9c;
public const uint KP_Begin = 0xff9d;
public const uint KP_Insert = 0xff9e;
public const uint KP_Delete = 0xff9f;
public const uint KP_Equal = 0xffbd;
public const uint KP_Multiply = 0xffaa;
public const uint KP_Add = 0xffab;
public const uint KP_Separator = 0xffac;
public const uint KP_Subtract = 0xffad;
public const uint KP_Decimal = 0xffae;
public const uint KP_Divide = 0xffaf;
public const uint KP_0 = 0xffb0;
public const uint KP_1 = 0xffb1;
public const uint KP_2 = 0xffb2;
public const uint KP_3 = 0xffb3;
public const uint KP_4 = 0xffb4;
public const uint KP_5 = 0xffb5;
public const uint KP_6 = 0xffb6;
public const uint KP_7 = 0xffb7;
public const uint KP_8 = 0xffb8;
public const uint KP_9 = 0xffb9;
public const uint F1 = 0xffbe;
public const uint F2 = 0xffbf;
public const uint F3 = 0xffc0;
public const uint F4 = 0xffc1;
public const uint F5 = 0xffc2;
public const uint F6 = 0xffc3;
public const uint F7 = 0xffc4;
public const uint F8 = 0xffc5;
public const uint F9 = 0xffc6;
public const uint F10 = 0xffc7;
public const uint F11 = 0xffc8;
public const uint L1 = 0xffc8;
public const uint F12 = 0xffc9;
public const uint L2 = 0xffc9;
public const uint F13 = 0xffca;
public const uint L3 = 0xffca;
public const uint F14 = 0xffcb;
public const uint L4 = 0xffcb;
public const uint F15 = 0xffcc;
public const uint L5 = 0xffcc;
public const uint F16 = 0xffcd;
public const uint L6 = 0xffcd;
public const uint F17 = 0xffce;
public const uint L7 = 0xffce;
public const uint F18 = 0xffcf;
public const uint L8 = 0xffcf;
public const uint F19 = 0xffd0;
public const uint L9 = 0xffd0;
public const uint F20 = 0xffd1;
public const uint L10 = 0xffd1;
public const uint F21 = 0xffd2;
public const uint R1 = 0xffd2;
public const uint F22 = 0xffd3;
public const uint R2 = 0xffd3;
public const uint F23 = 0xffd4;
public const uint R3 = 0xffd4;
public const uint F24 = 0xffd5;
public const uint R4 = 0xffd5;
public const uint F25 = 0xffd6;
public const uint R5 = 0xffd6;
public const uint F26 = 0xffd7;
public const uint R6 = 0xffd7;
public const uint F27 = 0xffd8;
public const uint R7 = 0xffd8;
public const uint F28 = 0xffd9;
public const uint R8 = 0xffd9;
public const uint F29 = 0xffda;
public const uint R9 = 0xffda;
public const uint F30 = 0xffdb;
public const uint R10 = 0xffdb;
public const uint F31 = 0xffdc;
public const uint R11 = 0xffdc;
public const uint F32 = 0xffdd;
public const uint R12 = 0xffdd;
public const uint F33 = 0xffde;
public const uint R13 = 0xffde;
public const uint F34 = 0xffdf;
public const uint R14 = 0xffdf;
public const uint F35 = 0xffe0;
public const uint R15 = 0xffe0;
public const uint Shift_L = 0xffe1;
public const uint Shift_R = 0xffe2;
public const uint Control_L = 0xffe3;
public const uint Control_R = 0xffe4;
public const uint Caps_Lock = 0xffe5;
public const uint Shift_Lock = 0xffe6;
public const uint Meta_L = 0xffe7;
public const uint Meta_R = 0xffe8;
public const uint Alt_L = 0xffe9;
public const uint Alt_R = 0xffea;
public const uint Super_L = 0xffeb;
public const uint Super_R = 0xffec;
public const uint Hyper_L = 0xffed;
public const uint Hyper_R = 0xffee;
public const uint ISO_Lock = 0xfe01;
public const uint ISO_Level2_Latch = 0xfe02;
public const uint ISO_Level3_Shift = 0xfe03;
public const uint ISO_Level3_Latch = 0xfe04;
public const uint ISO_Level3_Lock = 0xfe05;
public const uint ISO_Level5_Shift = 0xfe11;
public const uint ISO_Level5_Latch = 0xfe12;
public const uint ISO_Level5_Lock = 0xfe13;
public const uint ISO_Group_Shift = 0xff7e;
public const uint ISO_Group_Latch = 0xfe06;
public const uint ISO_Group_Lock = 0xfe07;
public const uint ISO_Next_Group = 0xfe08;
public const uint ISO_Next_Group_Lock = 0xfe09;
public const uint ISO_Prev_Group = 0xfe0a;
public const uint ISO_Prev_Group_Lock = 0xfe0b;
public const uint ISO_First_Group = 0xfe0c;
public const uint ISO_First_Group_Lock = 0xfe0d;
public const uint ISO_Last_Group = 0xfe0e;
public const uint ISO_Last_Group_Lock = 0xfe0f;
public const uint ISO_Left_Tab = 0xfe20;
public const uint ISO_Move_Line_Up = 0xfe21;
public const uint ISO_Move_Line_Down = 0xfe22;
public const uint ISO_Partial_Line_Up = 0xfe23;
public const uint ISO_Partial_Line_Down = 0xfe24;
public const uint ISO_Partial_Space_Left = 0xfe25;
public const uint ISO_Partial_Space_Right = 0xfe26;
public const uint ISO_Set_Margin_Left = 0xfe27;
public const uint ISO_Set_Margin_Right = 0xfe28;
public const uint ISO_Release_Margin_Left = 0xfe29;
public const uint ISO_Release_Margin_Right = 0xfe2a;
public const uint ISO_Release_Both_Margins = 0xfe2b;
public const uint ISO_Fast_Cursor_Left = 0xfe2c;
public const uint ISO_Fast_Cursor_Right = 0xfe2d;
public const uint ISO_Fast_Cursor_Up = 0xfe2e;
public const uint ISO_Fast_Cursor_Down = 0xfe2f;
public const uint ISO_Continuous_Underline = 0xfe30;
public const uint ISO_Discontinuous_Underline = 0xfe31;
public const uint ISO_Emphasize = 0xfe32;
public const uint ISO_Center_Object = 0xfe33;
public const uint ISO_Enter = 0xfe34;
public const uint dead_grave = 0xfe50;
public const uint dead_acute = 0xfe51;
public const uint dead_circumflex = 0xfe52;
public const uint dead_tilde = 0xfe53;
public const uint dead_perispomeni = 0xfe53;
public const uint dead_macron = 0xfe54;
public const uint dead_breve = 0xfe55;
public const uint dead_abovedot = 0xfe56;
public const uint dead_diaeresis = 0xfe57;
public const uint dead_abovering = 0xfe58;
public const uint dead_doubleacute = 0xfe59;
public const uint dead_caron = 0xfe5a;
public const uint dead_cedilla = 0xfe5b;
public const uint dead_ogonek = 0xfe5c;
public const uint dead_iota = 0xfe5d;
public const uint dead_voiced_sound = 0xfe5e;
public const uint dead_semivoiced_sound = 0xfe5f;
public const uint dead_belowdot = 0xfe60;
public const uint dead_hook = 0xfe61;
public const uint dead_horn = 0xfe62;
public const uint dead_stroke = 0xfe63;
public const uint dead_abovecomma = 0xfe64;
public const uint dead_psili = 0xfe64;
public const uint dead_abovereversedcomma = 0xfe65;
public const uint dead_dasia = 0xfe65;
public const uint dead_doublegrave = 0xfe66;
public const uint dead_belowring = 0xfe67;
public const uint dead_belowmacron = 0xfe68;
public const uint dead_belowcircumflex = 0xfe69;
public const uint dead_belowtilde = 0xfe6a;
public const uint dead_belowbreve = 0xfe6b;
public const uint dead_belowdiaeresis = 0xfe6c;
public const uint dead_invertedbreve = 0xfe6d;
public const uint dead_belowcomma = 0xfe6e;
public const uint dead_currency = 0xfe6f;
public const uint dead_a = 0xfe80;
public const uint dead_A = 0xfe81;
public const uint dead_e = 0xfe82;
public const uint dead_E = 0xfe83;
public const uint dead_i = 0xfe84;
public const uint dead_I = 0xfe85;
public const uint dead_o = 0xfe86;
public const uint dead_O = 0xfe87;
public const uint dead_u = 0xfe88;
public const uint dead_U = 0xfe89;
public const uint dead_small_schwa = 0xfe8a;
public const uint dead_capital_schwa = 0xfe8b;
public const uint First_Virtual_Screen = 0xfed0;
public const uint Prev_Virtual_Screen = 0xfed1;
public const uint Next_Virtual_Screen = 0xfed2;
public const uint Last_Virtual_Screen = 0xfed4;
public const uint Terminate_Server = 0xfed5;
public const uint AccessX_Enable = 0xfe70;
public const uint AccessX_Feedback_Enable = 0xfe71;
public const uint RepeatKeys_Enable = 0xfe72;
public const uint SlowKeys_Enable = 0xfe73;
public const uint BounceKeys_Enable = 0xfe74;
public const uint StickyKeys_Enable = 0xfe75;
public const uint MouseKeys_Enable = 0xfe76;
public const uint MouseKeys_Accel_Enable = 0xfe77;
public const uint Overlay1_Enable = 0xfe78;
public const uint Overlay2_Enable = 0xfe79;
public const uint AudibleBell_Enable = 0xfe7a;
public const uint Pointer_Left = 0xfee0;
public const uint Pointer_Right = 0xfee1;
public const uint Pointer_Up = 0xfee2;
public const uint Pointer_Down = 0xfee3;
public const uint Pointer_UpLeft = 0xfee4;
public const uint Pointer_UpRight = 0xfee5;
public const uint Pointer_DownLeft = 0xfee6;
public const uint Pointer_DownRight = 0xfee7;
public const uint Pointer_Button_Dflt = 0xfee8;
public const uint Pointer_Button1 = 0xfee9;
public const uint Pointer_Button2 = 0xfeea;
public const uint Pointer_Button3 = 0xfeeb;
public const uint Pointer_Button4 = 0xfeec;
public const uint Pointer_Button5 = 0xfeed;
public const uint Pointer_DblClick_Dflt = 0xfeee;
public const uint Pointer_DblClick1 = 0xfeef;
public const uint Pointer_DblClick2 = 0xfef0;
public const uint Pointer_DblClick3 = 0xfef1;
public const uint Pointer_DblClick4 = 0xfef2;
public const uint Pointer_DblClick5 = 0xfef3;
public const uint Pointer_Drag_Dflt = 0xfef4;
public const uint Pointer_Drag1 = 0xfef5;
public const uint Pointer_Drag2 = 0xfef6;
public const uint Pointer_Drag3 = 0xfef7;
public const uint Pointer_Drag4 = 0xfef8;
public const uint Pointer_Drag5 = 0xfefd;
public const uint Pointer_EnableKeys = 0xfef9;
public const uint Pointer_Accelerate = 0xfefa;
public const uint Pointer_DfltBtnNext = 0xfefb;
public const uint Pointer_DfltBtnPrev = 0xfefc;
public const uint @3270_Duplicate = 0xfd01;
public const uint @3270_FieldMark = 0xfd02;
public const uint @3270_Right2 = 0xfd03;
public const uint @3270_Left2 = 0xfd04;
public const uint @3270_BackTab = 0xfd05;
public const uint @3270_EraseEOF = 0xfd06;
public const uint @3270_EraseInput = 0xfd07;
public const uint @3270_Reset = 0xfd08;
public const uint @3270_Quit = 0xfd09;
public const uint @3270_PA1 = 0xfd0a;
public const uint @3270_PA2 = 0xfd0b;
public const uint @3270_PA3 = 0xfd0c;
public const uint @3270_Test = 0xfd0d;
public const uint @3270_Attn = 0xfd0e;
public const uint @3270_CursorBlink = 0xfd0f;
public const uint @3270_AltCursor = 0xfd10;
public const uint @3270_KeyClick = 0xfd11;
public const uint @3270_Jump = 0xfd12;
public const uint @3270_Ident = 0xfd13;
public const uint @3270_Rule = 0xfd14;
public const uint @3270_Copy = 0xfd15;
public const uint @3270_Play = 0xfd16;
public const uint @3270_Setup = 0xfd17;
public const uint @3270_Record = 0xfd18;
public const uint @3270_ChangeScreen = 0xfd19;
public const uint @3270_DeleteWord = 0xfd1a;
public const uint @3270_ExSelect = 0xfd1b;
public const uint @3270_CursorSelect = 0xfd1c;
public const uint @3270_PrintScreen = 0xfd1d;
public const uint @3270_Enter = 0xfd1e;
public const uint space = 0x0020;
public const uint exclam = 0x0021;
public const uint quotedbl = 0x0022;
public const uint numbersign = 0x0023;
public const uint dollar = 0x0024;
public const uint percent = 0x0025;
public const uint ampersand = 0x0026;
public const uint apostrophe = 0x0027;
public const uint quoteright = 0x0027;
public const uint parenleft = 0x0028;
public const uint parenright = 0x0029;
public const uint asterisk = 0x002a;
public const uint plus = 0x002b;
public const uint comma = 0x002c;
public const uint minus = 0x002d;
public const uint period = 0x002e;
public const uint slash = 0x002f;
public const uint @0 = 0x0030;
public const uint @1 = 0x0031;
public const uint @2 = 0x0032;
public const uint @3 = 0x0033;
public const uint @4 = 0x0034;
public const uint @5 = 0x0035;
public const uint @6 = 0x0036;
public const uint @7 = 0x0037;
public const uint @8 = 0x0038;
public const uint @9 = 0x0039;
public const uint colon = 0x003a;
public const uint semicolon = 0x003b;
public const uint less = 0x003c;
public const uint equal = 0x003d;
public const uint greater = 0x003e;
public const uint question = 0x003f;
public const uint at = 0x0040;
public const uint A = 0x0041;
public const uint B = 0x0042;
public const uint C = 0x0043;
public const uint D = 0x0044;
public const uint E = 0x0045;
public const uint F = 0x0046;
public const uint G = 0x0047;
public const uint H = 0x0048;
public const uint I = 0x0049;
public const uint J = 0x004a;
public const uint K = 0x004b;
public const uint L = 0x004c;
public const uint M = 0x004d;
public const uint N = 0x004e;
public const uint O = 0x004f;
public const uint P = 0x0050;
public const uint Q = 0x0051;
public const uint R = 0x0052;
public const uint S = 0x0053;
public const uint T = 0x0054;
public const uint U = 0x0055;
public const uint V = 0x0056;
public const uint W = 0x0057;
public const uint X = 0x0058;
public const uint Y = 0x0059;
public const uint Z = 0x005a;
public const uint bracketleft = 0x005b;
public const uint backslash = 0x005c;
public const uint bracketright = 0x005d;
public const uint asciicircum = 0x005e;
public const uint underscore = 0x005f;
public const uint grave = 0x0060;
public const uint quoteleft = 0x0060;
public const uint a = 0x0061;
public const uint b = 0x0062;
public const uint c = 0x0063;
public const uint d = 0x0064;
public const uint e = 0x0065;
public const uint f = 0x0066;
public const uint g = 0x0067;
public const uint h = 0x0068;
public const uint i = 0x0069;
public const uint j = 0x006a;
public const uint k = 0x006b;
public const uint l = 0x006c;
public const uint m = 0x006d;
public const uint n = 0x006e;
public const uint o = 0x006f;
public const uint p = 0x0070;
public const uint q = 0x0071;
public const uint r = 0x0072;
public const uint s = 0x0073;
public const uint t = 0x0074;
public const uint u = 0x0075;
public const uint v = 0x0076;
public const uint w = 0x0077;
public const uint x = 0x0078;
public const uint y = 0x0079;
public const uint z = 0x007a;
public const uint braceleft = 0x007b;
public const uint bar = 0x007c;
public const uint braceright = 0x007d;
public const uint asciitilde = 0x007e;
public const uint nobreakspace = 0x00a0;
public const uint exclamdown = 0x00a1;
public const uint cent = 0x00a2;
public const uint sterling = 0x00a3;
public const uint currency = 0x00a4;
public const uint yen = 0x00a5;
public const uint brokenbar = 0x00a6;
public const uint section = 0x00a7;
public const uint diaeresis = 0x00a8;
public const uint copyright = 0x00a9;
public const uint ordfeminine = 0x00aa;
public const uint guillemotleft = 0x00ab;
public const uint notsign = 0x00ac;
public const uint hyphen = 0x00ad;
public const uint registered = 0x00ae;
public const uint macron = 0x00af;
public const uint degree = 0x00b0;
public const uint plusminus = 0x00b1;
public const uint twosuperior = 0x00b2;
public const uint threesuperior = 0x00b3;
public const uint acute = 0x00b4;
public const uint mu = 0x00b5;
public const uint paragraph = 0x00b6;
public const uint periodcentered = 0x00b7;
public const uint cedilla = 0x00b8;
public const uint onesuperior = 0x00b9;
public const uint masculine = 0x00ba;
public const uint guillemotright = 0x00bb;
public const uint onequarter = 0x00bc;
public const uint onehalf = 0x00bd;
public const uint threequarters = 0x00be;
public const uint questiondown = 0x00bf;
public const uint Agrave = 0x00c0;
public const uint Aacute = 0x00c1;
public const uint Acircumflex = 0x00c2;
public const uint Atilde = 0x00c3;
public const uint Adiaeresis = 0x00c4;
public const uint Aring = 0x00c5;
public const uint AE = 0x00c6;
public const uint Ccedilla = 0x00c7;
public const uint Egrave = 0x00c8;
public const uint Eacute = 0x00c9;
public const uint Ecircumflex = 0x00ca;
public const uint Ediaeresis = 0x00cb;
public const uint Igrave = 0x00cc;
public const uint Iacute = 0x00cd;
public const uint Icircumflex = 0x00ce;
public const uint Idiaeresis = 0x00cf;
public const uint ETH = 0x00d0;
public const uint Eth = 0x00d0;
public const uint Ntilde = 0x00d1;
public const uint Ograve = 0x00d2;
public const uint Oacute = 0x00d3;
public const uint Ocircumflex = 0x00d4;
public const uint Otilde = 0x00d5;
public const uint Odiaeresis = 0x00d6;
public const uint multiply = 0x00d7;
public const uint Oslash = 0x00d8;
public const uint Ooblique = 0x00d8;
public const uint Ugrave = 0x00d9;
public const uint Uacute = 0x00da;
public const uint Ucircumflex = 0x00db;
public const uint Udiaeresis = 0x00dc;
public const uint Yacute = 0x00dd;
public const uint THORN = 0x00de;
public const uint Thorn = 0x00de;
public const uint ssharp = 0x00df;
public const uint agrave = 0x00e0;
public const uint aacute = 0x00e1;
public const uint acircumflex = 0x00e2;
public const uint atilde = 0x00e3;
public const uint adiaeresis = 0x00e4;
public const uint aring = 0x00e5;
public const uint ae = 0x00e6;
public const uint ccedilla = 0x00e7;
public const uint egrave = 0x00e8;
public const uint eacute = 0x00e9;
public const uint ecircumflex = 0x00ea;
public const uint ediaeresis = 0x00eb;
public const uint igrave = 0x00ec;
public const uint iacute = 0x00ed;
public const uint icircumflex = 0x00ee;
public const uint idiaeresis = 0x00ef;
public const uint eth = 0x00f0;
public const uint ntilde = 0x00f1;
public const uint ograve = 0x00f2;
public const uint oacute = 0x00f3;
public const uint ocircumflex = 0x00f4;
public const uint otilde = 0x00f5;
public const uint odiaeresis = 0x00f6;
public const uint division = 0x00f7;
public const uint oslash = 0x00f8;
public const uint ooblique = 0x00f8;
public const uint ugrave = 0x00f9;
public const uint uacute = 0x00fa;
public const uint ucircumflex = 0x00fb;
public const uint udiaeresis = 0x00fc;
public const uint yacute = 0x00fd;
public const uint thorn = 0x00fe;
public const uint ydiaeresis = 0x00ff;
public const uint Aogonek = 0x01a1;
public const uint breve = 0x01a2;
public const uint Lstroke = 0x01a3;
public const uint Lcaron = 0x01a5;
public const uint Sacute = 0x01a6;
public const uint Scaron = 0x01a9;
public const uint Scedilla = 0x01aa;
public const uint Tcaron = 0x01ab;
public const uint Zacute = 0x01ac;
public const uint Zcaron = 0x01ae;
public const uint Zabovedot = 0x01af;
public const uint aogonek = 0x01b1;
public const uint ogonek = 0x01b2;
public const uint lstroke = 0x01b3;
public const uint lcaron = 0x01b5;
public const uint sacute = 0x01b6;
public const uint caron = 0x01b7;
public const uint scaron = 0x01b9;
public const uint scedilla = 0x01ba;
public const uint tcaron = 0x01bb;
public const uint zacute = 0x01bc;
public const uint doubleacute = 0x01bd;
public const uint zcaron = 0x01be;
public const uint zabovedot = 0x01bf;
public const uint Racute = 0x01c0;
public const uint Abreve = 0x01c3;
public const uint Lacute = 0x01c5;
public const uint Cacute = 0x01c6;
public const uint Ccaron = 0x01c8;
public const uint Eogonek = 0x01ca;
public const uint Ecaron = 0x01cc;
public const uint Dcaron = 0x01cf;
public const uint Dstroke = 0x01d0;
public const uint Nacute = 0x01d1;
public const uint Ncaron = 0x01d2;
public const uint Odoubleacute = 0x01d5;
public const uint Rcaron = 0x01d8;
public const uint Uring = 0x01d9;
public const uint Udoubleacute = 0x01db;
public const uint Tcedilla = 0x01de;
public const uint racute = 0x01e0;
public const uint abreve = 0x01e3;
public const uint lacute = 0x01e5;
public const uint cacute = 0x01e6;
public const uint ccaron = 0x01e8;
public const uint eogonek = 0x01ea;
public const uint ecaron = 0x01ec;
public const uint dcaron = 0x01ef;
public const uint dstroke = 0x01f0;
public const uint nacute = 0x01f1;
public const uint ncaron = 0x01f2;
public const uint odoubleacute = 0x01f5;
public const uint rcaron = 0x01f8;
public const uint uring = 0x01f9;
public const uint udoubleacute = 0x01fb;
public const uint tcedilla = 0x01fe;
public const uint abovedot = 0x01ff;
public const uint Hstroke = 0x02a1;
public const uint Hcircumflex = 0x02a6;
public const uint Iabovedot = 0x02a9;
public const uint Gbreve = 0x02ab;
public const uint Jcircumflex = 0x02ac;
public const uint hstroke = 0x02b1;
public const uint hcircumflex = 0x02b6;
public const uint idotless = 0x02b9;
public const uint gbreve = 0x02bb;
public const uint jcircumflex = 0x02bc;
public const uint Cabovedot = 0x02c5;
public const uint Ccircumflex = 0x02c6;
public const uint Gabovedot = 0x02d5;
public const uint Gcircumflex = 0x02d8;
public const uint Ubreve = 0x02dd;
public const uint Scircumflex = 0x02de;
public const uint cabovedot = 0x02e5;
public const uint ccircumflex = 0x02e6;
public const uint gabovedot = 0x02f5;
public const uint gcircumflex = 0x02f8;
public const uint ubreve = 0x02fd;
public const uint scircumflex = 0x02fe;
public const uint kra = 0x03a2;
public const uint kappa = 0x03a2;
public const uint Rcedilla = 0x03a3;
public const uint Itilde = 0x03a5;
public const uint Lcedilla = 0x03a6;
public const uint Emacron = 0x03aa;
public const uint Gcedilla = 0x03ab;
public const uint Tslash = 0x03ac;
public const uint rcedilla = 0x03b3;
public const uint itilde = 0x03b5;
public const uint lcedilla = 0x03b6;
public const uint emacron = 0x03ba;
public const uint gcedilla = 0x03bb;
public const uint tslash = 0x03bc;
public const uint ENG = 0x03bd;
public const uint eng = 0x03bf;
public const uint Amacron = 0x03c0;
public const uint Iogonek = 0x03c7;
public const uint Eabovedot = 0x03cc;
public const uint Imacron = 0x03cf;
public const uint Ncedilla = 0x03d1;
public const uint Omacron = 0x03d2;
public const uint Kcedilla = 0x03d3;
public const uint Uogonek = 0x03d9;
public const uint Utilde = 0x03dd;
public const uint Umacron = 0x03de;
public const uint amacron = 0x03e0;
public const uint iogonek = 0x03e7;
public const uint eabovedot = 0x03ec;
public const uint imacron = 0x03ef;
public const uint ncedilla = 0x03f1;
public const uint omacron = 0x03f2;
public const uint kcedilla = 0x03f3;
public const uint uogonek = 0x03f9;
public const uint utilde = 0x03fd;
public const uint umacron = 0x03fe;
public const uint Wcircumflex = 0x1000174;
public const uint wcircumflex = 0x1000175;
public const uint Ycircumflex = 0x1000176;
public const uint ycircumflex = 0x1000177;
public const uint Babovedot = 0x1001e02;
public const uint babovedot = 0x1001e03;
public const uint Dabovedot = 0x1001e0a;
public const uint dabovedot = 0x1001e0b;
public const uint Fabovedot = 0x1001e1e;
public const uint fabovedot = 0x1001e1f;
public const uint Mabovedot = 0x1001e40;
public const uint mabovedot = 0x1001e41;
public const uint Pabovedot = 0x1001e56;
public const uint pabovedot = 0x1001e57;
public const uint Sabovedot = 0x1001e60;
public const uint sabovedot = 0x1001e61;
public const uint Tabovedot = 0x1001e6a;
public const uint tabovedot = 0x1001e6b;
public const uint Wgrave = 0x1001e80;
public const uint wgrave = 0x1001e81;
public const uint Wacute = 0x1001e82;
public const uint wacute = 0x1001e83;
public const uint Wdiaeresis = 0x1001e84;
public const uint wdiaeresis = 0x1001e85;
public const uint Ygrave = 0x1001ef2;
public const uint ygrave = 0x1001ef3;
public const uint OE = 0x13bc;
public const uint oe = 0x13bd;
public const uint Ydiaeresis = 0x13be;
public const uint overline = 0x047e;
public const uint kana_fullstop = 0x04a1;
public const uint kana_openingbracket = 0x04a2;
public const uint kana_closingbracket = 0x04a3;
public const uint kana_comma = 0x04a4;
public const uint kana_conjunctive = 0x04a5;
public const uint kana_middledot = 0x04a5;
public const uint kana_WO = 0x04a6;
public const uint kana_a = 0x04a7;
public const uint kana_i = 0x04a8;
public const uint kana_u = 0x04a9;
public const uint kana_e = 0x04aa;
public const uint kana_o = 0x04ab;
public const uint kana_ya = 0x04ac;
public const uint kana_yu = 0x04ad;
public const uint kana_yo = 0x04ae;
public const uint kana_tsu = 0x04af;
public const uint kana_tu = 0x04af;
public const uint prolongedsound = 0x04b0;
public const uint kana_A = 0x04b1;
public const uint kana_I = 0x04b2;
public const uint kana_U = 0x04b3;
public const uint kana_E = 0x04b4;
public const uint kana_O = 0x04b5;
public const uint kana_KA = 0x04b6;
public const uint kana_KI = 0x04b7;
public const uint kana_KU = 0x04b8;
public const uint kana_KE = 0x04b9;
public const uint kana_KO = 0x04ba;
public const uint kana_SA = 0x04bb;
public const uint kana_SHI = 0x04bc;
public const uint kana_SU = 0x04bd;
public const uint kana_SE = 0x04be;
public const uint kana_SO = 0x04bf;
public const uint kana_TA = 0x04c0;
public const uint kana_CHI = 0x04c1;
public const uint kana_TI = 0x04c1;
public const uint kana_TSU = 0x04c2;
public const uint kana_TU = 0x04c2;
public const uint kana_TE = 0x04c3;
public const uint kana_TO = 0x04c4;
public const uint kana_NA = 0x04c5;
public const uint kana_NI = 0x04c6;
public const uint kana_NU = 0x04c7;
public const uint kana_NE = 0x04c8;
public const uint kana_NO = 0x04c9;
public const uint kana_HA = 0x04ca;
public const uint kana_HI = 0x04cb;
public const uint kana_FU = 0x04cc;
public const uint kana_HU = 0x04cc;
public const uint kana_HE = 0x04cd;
public const uint kana_HO = 0x04ce;
public const uint kana_MA = 0x04cf;
public const uint kana_MI = 0x04d0;
public const uint kana_MU = 0x04d1;
public const uint kana_ME = 0x04d2;
public const uint kana_MO = 0x04d3;
public const uint kana_YA = 0x04d4;
public const uint kana_YU = 0x04d5;
public const uint kana_YO = 0x04d6;
public const uint kana_RA = 0x04d7;
public const uint kana_RI = 0x04d8;
public const uint kana_RU = 0x04d9;
public const uint kana_RE = 0x04da;
public const uint kana_RO = 0x04db;
public const uint kana_WA = 0x04dc;
public const uint kana_N = 0x04dd;
public const uint voicedsound = 0x04de;
public const uint semivoicedsound = 0x04df;
public const uint kana_switch = 0xff7e;
public const uint Farsi_0 = 0x10006f0;
public const uint Farsi_1 = 0x10006f1;
public const uint Farsi_2 = 0x10006f2;
public const uint Farsi_3 = 0x10006f3;
public const uint Farsi_4 = 0x10006f4;
public const uint Farsi_5 = 0x10006f5;
public const uint Farsi_6 = 0x10006f6;
public const uint Farsi_7 = 0x10006f7;
public const uint Farsi_8 = 0x10006f8;
public const uint Farsi_9 = 0x10006f9;
public const uint Arabic_percent = 0x100066a;
public const uint Arabic_superscript_alef = 0x1000670;
public const uint Arabic_tteh = 0x1000679;
public const uint Arabic_peh = 0x100067e;
public const uint Arabic_tcheh = 0x1000686;
public const uint Arabic_ddal = 0x1000688;
public const uint Arabic_rreh = 0x1000691;
public const uint Arabic_comma = 0x05ac;
public const uint Arabic_fullstop = 0x10006d4;
public const uint Arabic_0 = 0x1000660;
public const uint Arabic_1 = 0x1000661;
public const uint Arabic_2 = 0x1000662;
public const uint Arabic_3 = 0x1000663;
public const uint Arabic_4 = 0x1000664;
public const uint Arabic_5 = 0x1000665;
public const uint Arabic_6 = 0x1000666;
public const uint Arabic_7 = 0x1000667;
public const uint Arabic_8 = 0x1000668;
public const uint Arabic_9 = 0x1000669;
public const uint Arabic_semicolon = 0x05bb;
public const uint Arabic_question_mark = 0x05bf;
public const uint Arabic_hamza = 0x05c1;
public const uint Arabic_maddaonalef = 0x05c2;
public const uint Arabic_hamzaonalef = 0x05c3;
public const uint Arabic_hamzaonwaw = 0x05c4;
public const uint Arabic_hamzaunderalef = 0x05c5;
public const uint Arabic_hamzaonyeh = 0x05c6;
public const uint Arabic_alef = 0x05c7;
public const uint Arabic_beh = 0x05c8;
public const uint Arabic_tehmarbuta = 0x05c9;
public const uint Arabic_teh = 0x05ca;
public const uint Arabic_theh = 0x05cb;
public const uint Arabic_jeem = 0x05cc;
public const uint Arabic_hah = 0x05cd;
public const uint Arabic_khah = 0x05ce;
public const uint Arabic_dal = 0x05cf;
public const uint Arabic_thal = 0x05d0;
public const uint Arabic_ra = 0x05d1;
public const uint Arabic_zain = 0x05d2;
public const uint Arabic_seen = 0x05d3;
public const uint Arabic_sheen = 0x05d4;
public const uint Arabic_sad = 0x05d5;
public const uint Arabic_dad = 0x05d6;
public const uint Arabic_tah = 0x05d7;
public const uint Arabic_zah = 0x05d8;
public const uint Arabic_ain = 0x05d9;
public const uint Arabic_ghain = 0x05da;
public const uint Arabic_tatweel = 0x05e0;
public const uint Arabic_feh = 0x05e1;
public const uint Arabic_qaf = 0x05e2;
public const uint Arabic_kaf = 0x05e3;
public const uint Arabic_lam = 0x05e4;
public const uint Arabic_meem = 0x05e5;
public const uint Arabic_noon = 0x05e6;
public const uint Arabic_ha = 0x05e7;
public const uint Arabic_heh = 0x05e7;
public const uint Arabic_waw = 0x05e8;
public const uint Arabic_alefmaksura = 0x05e9;
public const uint Arabic_yeh = 0x05ea;
public const uint Arabic_fathatan = 0x05eb;
public const uint Arabic_dammatan = 0x05ec;
public const uint Arabic_kasratan = 0x05ed;
public const uint Arabic_fatha = 0x05ee;
public const uint Arabic_damma = 0x05ef;
public const uint Arabic_kasra = 0x05f0;
public const uint Arabic_shadda = 0x05f1;
public const uint Arabic_sukun = 0x05f2;
public const uint Arabic_madda_above = 0x1000653;
public const uint Arabic_hamza_above = 0x1000654;
public const uint Arabic_hamza_below = 0x1000655;
public const uint Arabic_jeh = 0x1000698;
public const uint Arabic_veh = 0x10006a4;
public const uint Arabic_keheh = 0x10006a9;
public const uint Arabic_gaf = 0x10006af;
public const uint Arabic_noon_ghunna = 0x10006ba;
public const uint Arabic_heh_doachashmee = 0x10006be;
public const uint Farsi_yeh = 0x10006cc;
public const uint Arabic_farsi_yeh = 0x10006cc;
public const uint Arabic_yeh_baree = 0x10006d2;
public const uint Arabic_heh_goal = 0x10006c1;
public const uint Arabic_switch = 0xff7e;
public const uint Cyrillic_GHE_bar = 0x1000492;
public const uint Cyrillic_ghe_bar = 0x1000493;
public const uint Cyrillic_ZHE_descender = 0x1000496;
public const uint Cyrillic_zhe_descender = 0x1000497;
public const uint Cyrillic_KA_descender = 0x100049a;
public const uint Cyrillic_ka_descender = 0x100049b;
public const uint Cyrillic_KA_vertstroke = 0x100049c;
public const uint Cyrillic_ka_vertstroke = 0x100049d;
public const uint Cyrillic_EN_descender = 0x10004a2;
public const uint Cyrillic_en_descender = 0x10004a3;
public const uint Cyrillic_U_straight = 0x10004ae;
public const uint Cyrillic_u_straight = 0x10004af;
public const uint Cyrillic_U_straight_bar = 0x10004b0;
public const uint Cyrillic_u_straight_bar = 0x10004b1;
public const uint Cyrillic_HA_descender = 0x10004b2;
public const uint Cyrillic_ha_descender = 0x10004b3;
public const uint Cyrillic_CHE_descender = 0x10004b6;
public const uint Cyrillic_che_descender = 0x10004b7;
public const uint Cyrillic_CHE_vertstroke = 0x10004b8;
public const uint Cyrillic_che_vertstroke = 0x10004b9;
public const uint Cyrillic_SHHA = 0x10004ba;
public const uint Cyrillic_shha = 0x10004bb;
public const uint Cyrillic_SCHWA = 0x10004d8;
public const uint Cyrillic_schwa = 0x10004d9;
public const uint Cyrillic_I_macron = 0x10004e2;
public const uint Cyrillic_i_macron = 0x10004e3;
public const uint Cyrillic_O_bar = 0x10004e8;
public const uint Cyrillic_o_bar = 0x10004e9;
public const uint Cyrillic_U_macron = 0x10004ee;
public const uint Cyrillic_u_macron = 0x10004ef;
public const uint Serbian_dje = 0x06a1;
public const uint Macedonia_gje = 0x06a2;
public const uint Cyrillic_io = 0x06a3;
public const uint Ukrainian_ie = 0x06a4;
public const uint Ukranian_je = 0x06a4;
public const uint Macedonia_dse = 0x06a5;
public const uint Ukrainian_i = 0x06a6;
public const uint Ukranian_i = 0x06a6;
public const uint Ukrainian_yi = 0x06a7;
public const uint Ukranian_yi = 0x06a7;
public const uint Cyrillic_je = 0x06a8;
public const uint Serbian_je = 0x06a8;
public const uint Cyrillic_lje = 0x06a9;
public const uint Serbian_lje = 0x06a9;
public const uint Cyrillic_nje = 0x06aa;
public const uint Serbian_nje = 0x06aa;
public const uint Serbian_tshe = 0x06ab;
public const uint Macedonia_kje = 0x06ac;
public const uint Ukrainian_ghe_with_upturn = 0x06ad;
public const uint Byelorussian_shortu = 0x06ae;
public const uint Cyrillic_dzhe = 0x06af;
public const uint Serbian_dze = 0x06af;
public const uint numerosign = 0x06b0;
public const uint Serbian_DJE = 0x06b1;
public const uint Macedonia_GJE = 0x06b2;
public const uint Cyrillic_IO = 0x06b3;
public const uint Ukrainian_IE = 0x06b4;
public const uint Ukranian_JE = 0x06b4;
public const uint Macedonia_DSE = 0x06b5;
public const uint Ukrainian_I = 0x06b6;
public const uint Ukranian_I = 0x06b6;
public const uint Ukrainian_YI = 0x06b7;
public const uint Ukranian_YI = 0x06b7;
public const uint Cyrillic_JE = 0x06b8;
public const uint Serbian_JE = 0x06b8;
public const uint Cyrillic_LJE = 0x06b9;
public const uint Serbian_LJE = 0x06b9;
public const uint Cyrillic_NJE = 0x06ba;
public const uint Serbian_NJE = 0x06ba;
public const uint Serbian_TSHE = 0x06bb;
public const uint Macedonia_KJE = 0x06bc;
public const uint Ukrainian_GHE_WITH_UPTURN = 0x06bd;
public const uint Byelorussian_SHORTU = 0x06be;
public const uint Cyrillic_DZHE = 0x06bf;
public const uint Serbian_DZE = 0x06bf;
public const uint Cyrillic_yu = 0x06c0;
public const uint Cyrillic_a = 0x06c1;
public const uint Cyrillic_be = 0x06c2;
public const uint Cyrillic_tse = 0x06c3;
public const uint Cyrillic_de = 0x06c4;
public const uint Cyrillic_ie = 0x06c5;
public const uint Cyrillic_ef = 0x06c6;
public const uint Cyrillic_ghe = 0x06c7;
public const uint Cyrillic_ha = 0x06c8;
public const uint Cyrillic_i = 0x06c9;
public const uint Cyrillic_shorti = 0x06ca;
public const uint Cyrillic_ka = 0x06cb;
public const uint Cyrillic_el = 0x06cc;
public const uint Cyrillic_em = 0x06cd;
public const uint Cyrillic_en = 0x06ce;
public const uint Cyrillic_o = 0x06cf;
public const uint Cyrillic_pe = 0x06d0;
public const uint Cyrillic_ya = 0x06d1;
public const uint Cyrillic_er = 0x06d2;
public const uint Cyrillic_es = 0x06d3;
public const uint Cyrillic_te = 0x06d4;
public const uint Cyrillic_u = 0x06d5;
public const uint Cyrillic_zhe = 0x06d6;
public const uint Cyrillic_ve = 0x06d7;
public const uint Cyrillic_softsign = 0x06d8;
public const uint Cyrillic_yeru = 0x06d9;
public const uint Cyrillic_ze = 0x06da;
public const uint Cyrillic_sha = 0x06db;
public const uint Cyrillic_e = 0x06dc;
public const uint Cyrillic_shcha = 0x06dd;
public const uint Cyrillic_che = 0x06de;
public const uint Cyrillic_hardsign = 0x06df;
public const uint Cyrillic_YU = 0x06e0;
public const uint Cyrillic_A = 0x06e1;
public const uint Cyrillic_BE = 0x06e2;
public const uint Cyrillic_TSE = 0x06e3;
public const uint Cyrillic_DE = 0x06e4;
public const uint Cyrillic_IE = 0x06e5;
public const uint Cyrillic_EF = 0x06e6;
public const uint Cyrillic_GHE = 0x06e7;
public const uint Cyrillic_HA = 0x06e8;
public const uint Cyrillic_I = 0x06e9;
public const uint Cyrillic_SHORTI = 0x06ea;
public const uint Cyrillic_KA = 0x06eb;
public const uint Cyrillic_EL = 0x06ec;
public const uint Cyrillic_EM = 0x06ed;
public const uint Cyrillic_EN = 0x06ee;
public const uint Cyrillic_O = 0x06ef;
public const uint Cyrillic_PE = 0x06f0;
public const uint Cyrillic_YA = 0x06f1;
public const uint Cyrillic_ER = 0x06f2;
public const uint Cyrillic_ES = 0x06f3;
public const uint Cyrillic_TE = 0x06f4;
public const uint Cyrillic_U = 0x06f5;
public const uint Cyrillic_ZHE = 0x06f6;
public const uint Cyrillic_VE = 0x06f7;
public const uint Cyrillic_SOFTSIGN = 0x06f8;
public const uint Cyrillic_YERU = 0x06f9;
public const uint Cyrillic_ZE = 0x06fa;
public const uint Cyrillic_SHA = 0x06fb;
public const uint Cyrillic_E = 0x06fc;
public const uint Cyrillic_SHCHA = 0x06fd;
public const uint Cyrillic_CHE = 0x06fe;
public const uint Cyrillic_HARDSIGN = 0x06ff;
public const uint Greek_ALPHAaccent = 0x07a1;
public const uint Greek_EPSILONaccent = 0x07a2;
public const uint Greek_ETAaccent = 0x07a3;
public const uint Greek_IOTAaccent = 0x07a4;
public const uint Greek_IOTAdieresis = 0x07a5;
public const uint Greek_IOTAdiaeresis = 0x07a5;
public const uint Greek_OMICRONaccent = 0x07a7;
public const uint Greek_UPSILONaccent = 0x07a8;
public const uint Greek_UPSILONdieresis = 0x07a9;
public const uint Greek_OMEGAaccent = 0x07ab;
public const uint Greek_accentdieresis = 0x07ae;
public const uint Greek_horizbar = 0x07af;
public const uint Greek_alphaaccent = 0x07b1;
public const uint Greek_epsilonaccent = 0x07b2;
public const uint Greek_etaaccent = 0x07b3;
public const uint Greek_iotaaccent = 0x07b4;
public const uint Greek_iotadieresis = 0x07b5;
public const uint Greek_iotaaccentdieresis = 0x07b6;
public const uint Greek_omicronaccent = 0x07b7;
public const uint Greek_upsilonaccent = 0x07b8;
public const uint Greek_upsilondieresis = 0x07b9;
public const uint Greek_upsilonaccentdieresis = 0x07ba;
public const uint Greek_omegaaccent = 0x07bb;
public const uint Greek_ALPHA = 0x07c1;
public const uint Greek_BETA = 0x07c2;
public const uint Greek_GAMMA = 0x07c3;
public const uint Greek_DELTA = 0x07c4;
public const uint Greek_EPSILON = 0x07c5;
public const uint Greek_ZETA = 0x07c6;
public const uint Greek_ETA = 0x07c7;
public const uint Greek_THETA = 0x07c8;
public const uint Greek_IOTA = 0x07c9;
public const uint Greek_KAPPA = 0x07ca;
public const uint Greek_LAMDA = 0x07cb;
public const uint Greek_LAMBDA = 0x07cb;
public const uint Greek_MU = 0x07cc;
public const uint Greek_NU = 0x07cd;
public const uint Greek_XI = 0x07ce;
public const uint Greek_OMICRON = 0x07cf;
public const uint Greek_PI = 0x07d0;
public const uint Greek_RHO = 0x07d1;
public const uint Greek_SIGMA = 0x07d2;
public const uint Greek_TAU = 0x07d4;
public const uint Greek_UPSILON = 0x07d5;
public const uint Greek_PHI = 0x07d6;
public const uint Greek_CHI = 0x07d7;
public const uint Greek_PSI = 0x07d8;
public const uint Greek_OMEGA = 0x07d9;
public const uint Greek_alpha = 0x07e1;
public const uint Greek_beta = 0x07e2;
public const uint Greek_gamma = 0x07e3;
public const uint Greek_delta = 0x07e4;
public const uint Greek_epsilon = 0x07e5;
public const uint Greek_zeta = 0x07e6;
public const uint Greek_eta = 0x07e7;
public const uint Greek_theta = 0x07e8;
public const uint Greek_iota = 0x07e9;
public const uint Greek_kappa = 0x07ea;
public const uint Greek_lamda = 0x07eb;
public const uint Greek_lambda = 0x07eb;
public const uint Greek_mu = 0x07ec;
public const uint Greek_nu = 0x07ed;
public const uint Greek_xi = 0x07ee;
public const uint Greek_omicron = 0x07ef;
public const uint Greek_pi = 0x07f0;
public const uint Greek_rho = 0x07f1;
public const uint Greek_sigma = 0x07f2;
public const uint Greek_finalsmallsigma = 0x07f3;
public const uint Greek_tau = 0x07f4;
public const uint Greek_upsilon = 0x07f5;
public const uint Greek_phi = 0x07f6;
public const uint Greek_chi = 0x07f7;
public const uint Greek_psi = 0x07f8;
public const uint Greek_omega = 0x07f9;
public const uint Greek_switch = 0xff7e;
public const uint leftradical = 0x08a1;
public const uint topleftradical = 0x08a2;
public const uint horizconnector = 0x08a3;
public const uint topintegral = 0x08a4;
public const uint botintegral = 0x08a5;
public const uint vertconnector = 0x08a6;
public const uint topleftsqbracket = 0x08a7;
public const uint botleftsqbracket = 0x08a8;
public const uint toprightsqbracket = 0x08a9;
public const uint botrightsqbracket = 0x08aa;
public const uint topleftparens = 0x08ab;
public const uint botleftparens = 0x08ac;
public const uint toprightparens = 0x08ad;
public const uint botrightparens = 0x08ae;
public const uint leftmiddlecurlybrace = 0x08af;
public const uint rightmiddlecurlybrace = 0x08b0;
public const uint topleftsummation = 0x08b1;
public const uint botleftsummation = 0x08b2;
public const uint topvertsummationconnector = 0x08b3;
public const uint botvertsummationconnector = 0x08b4;
public const uint toprightsummation = 0x08b5;
public const uint botrightsummation = 0x08b6;
public const uint rightmiddlesummation = 0x08b7;
public const uint lessthanequal = 0x08bc;
public const uint notequal = 0x08bd;
public const uint greaterthanequal = 0x08be;
public const uint integral = 0x08bf;
public const uint therefore = 0x08c0;
public const uint variation = 0x08c1;
public const uint infinity = 0x08c2;
public const uint nabla = 0x08c5;
public const uint approximate = 0x08c8;
public const uint similarequal = 0x08c9;
public const uint ifonlyif = 0x08cd;
public const uint implies = 0x08ce;
public const uint identical = 0x08cf;
public const uint radical = 0x08d6;
public const uint includedin = 0x08da;
public const uint includes = 0x08db;
public const uint intersection = 0x08dc;
public const uint union = 0x08dd;
public const uint logicaland = 0x08de;
public const uint logicalor = 0x08df;
public const uint partialderivative = 0x08ef;
public const uint function = 0x08f6;
public const uint leftarrow = 0x08fb;
public const uint uparrow = 0x08fc;
public const uint rightarrow = 0x08fd;
public const uint downarrow = 0x08fe;
public const uint blank = 0x09df;
public const uint soliddiamond = 0x09e0;
public const uint checkerboard = 0x09e1;
public const uint ht = 0x09e2;
public const uint ff = 0x09e3;
public const uint cr = 0x09e4;
public const uint lf = 0x09e5;
public const uint nl = 0x09e8;
public const uint vt = 0x09e9;
public const uint lowrightcorner = 0x09ea;
public const uint uprightcorner = 0x09eb;
public const uint upleftcorner = 0x09ec;
public const uint lowleftcorner = 0x09ed;
public const uint crossinglines = 0x09ee;
public const uint horizlinescan1 = 0x09ef;
public const uint horizlinescan3 = 0x09f0;
public const uint horizlinescan5 = 0x09f1;
public const uint horizlinescan7 = 0x09f2;
public const uint horizlinescan9 = 0x09f3;
public const uint leftt = 0x09f4;
public const uint rightt = 0x09f5;
public const uint bott = 0x09f6;
public const uint topt = 0x09f7;
public const uint vertbar = 0x09f8;
public const uint emspace = 0x0aa1;
public const uint enspace = 0x0aa2;
public const uint em3space = 0x0aa3;
public const uint em4space = 0x0aa4;
public const uint digitspace = 0x0aa5;
public const uint punctspace = 0x0aa6;
public const uint thinspace = 0x0aa7;
public const uint hairspace = 0x0aa8;
public const uint emdash = 0x0aa9;
public const uint endash = 0x0aaa;
public const uint signifblank = 0x0aac;
public const uint ellipsis = 0x0aae;
public const uint doubbaselinedot = 0x0aaf;
public const uint onethird = 0x0ab0;
public const uint twothirds = 0x0ab1;
public const uint onefifth = 0x0ab2;
public const uint twofifths = 0x0ab3;
public const uint threefifths = 0x0ab4;
public const uint fourfifths = 0x0ab5;
public const uint onesixth = 0x0ab6;
public const uint fivesixths = 0x0ab7;
public const uint careof = 0x0ab8;
public const uint figdash = 0x0abb;
public const uint leftanglebracket = 0x0abc;
public const uint decimalpoint = 0x0abd;
public const uint rightanglebracket = 0x0abe;
public const uint marker = 0x0abf;
public const uint oneeighth = 0x0ac3;
public const uint threeeighths = 0x0ac4;
public const uint fiveeighths = 0x0ac5;
public const uint seveneighths = 0x0ac6;
public const uint trademark = 0x0ac9;
public const uint signaturemark = 0x0aca;
public const uint trademarkincircle = 0x0acb;
public const uint leftopentriangle = 0x0acc;
public const uint rightopentriangle = 0x0acd;
public const uint emopencircle = 0x0ace;
public const uint emopenrectangle = 0x0acf;
public const uint leftsinglequotemark = 0x0ad0;
public const uint rightsinglequotemark = 0x0ad1;
public const uint leftdoublequotemark = 0x0ad2;
public const uint rightdoublequotemark = 0x0ad3;
public const uint prescription = 0x0ad4;
public const uint minutes = 0x0ad6;
public const uint seconds = 0x0ad7;
public const uint latincross = 0x0ad9;
public const uint hexagram = 0x0ada;
public const uint filledrectbullet = 0x0adb;
public const uint filledlefttribullet = 0x0adc;
public const uint filledrighttribullet = 0x0add;
public const uint emfilledcircle = 0x0ade;
public const uint emfilledrect = 0x0adf;
public const uint enopencircbullet = 0x0ae0;
public const uint enopensquarebullet = 0x0ae1;
public const uint openrectbullet = 0x0ae2;
public const uint opentribulletup = 0x0ae3;
public const uint opentribulletdown = 0x0ae4;
public const uint openstar = 0x0ae5;
public const uint enfilledcircbullet = 0x0ae6;
public const uint enfilledsqbullet = 0x0ae7;
public const uint filledtribulletup = 0x0ae8;
public const uint filledtribulletdown = 0x0ae9;
public const uint leftpointer = 0x0aea;
public const uint rightpointer = 0x0aeb;
public const uint club = 0x0aec;
public const uint diamond = 0x0aed;
public const uint heart = 0x0aee;
public const uint maltesecross = 0x0af0;
public const uint dagger = 0x0af1;
public const uint doubledagger = 0x0af2;
public const uint checkmark = 0x0af3;
public const uint ballotcross = 0x0af4;
public const uint musicalsharp = 0x0af5;
public const uint musicalflat = 0x0af6;
public const uint malesymbol = 0x0af7;
public const uint femalesymbol = 0x0af8;
public const uint telephone = 0x0af9;
public const uint telephonerecorder = 0x0afa;
public const uint phonographcopyright = 0x0afb;
public const uint caret = 0x0afc;
public const uint singlelowquotemark = 0x0afd;
public const uint doublelowquotemark = 0x0afe;
public const uint cursor = 0x0aff;
public const uint leftcaret = 0x0ba3;
public const uint rightcaret = 0x0ba6;
public const uint downcaret = 0x0ba8;
public const uint upcaret = 0x0ba9;
public const uint overbar = 0x0bc0;
public const uint downtack = 0x0bc2;
public const uint upshoe = 0x0bc3;
public const uint downstile = 0x0bc4;
public const uint underbar = 0x0bc6;
public const uint jot = 0x0bca;
public const uint quad = 0x0bcc;
public const uint uptack = 0x0bce;
public const uint circle = 0x0bcf;
public const uint upstile = 0x0bd3;
public const uint downshoe = 0x0bd6;
public const uint rightshoe = 0x0bd8;
public const uint leftshoe = 0x0bda;
public const uint lefttack = 0x0bdc;
public const uint righttack = 0x0bfc;
public const uint hebrew_doublelowline = 0x0cdf;
public const uint hebrew_aleph = 0x0ce0;
public const uint hebrew_bet = 0x0ce1;
public const uint hebrew_beth = 0x0ce1;
public const uint hebrew_gimel = 0x0ce2;
public const uint hebrew_gimmel = 0x0ce2;
public const uint hebrew_dalet = 0x0ce3;
public const uint hebrew_daleth = 0x0ce3;
public const uint hebrew_he = 0x0ce4;
public const uint hebrew_waw = 0x0ce5;
public const uint hebrew_zain = 0x0ce6;
public const uint hebrew_zayin = 0x0ce6;
public const uint hebrew_chet = 0x0ce7;
public const uint hebrew_het = 0x0ce7;
public const uint hebrew_tet = 0x0ce8;
public const uint hebrew_teth = 0x0ce8;
public const uint hebrew_yod = 0x0ce9;
public const uint hebrew_finalkaph = 0x0cea;
public const uint hebrew_kaph = 0x0ceb;
public const uint hebrew_lamed = 0x0cec;
public const uint hebrew_finalmem = 0x0ced;
public const uint hebrew_mem = 0x0cee;
public const uint hebrew_finalnun = 0x0cef;
public const uint hebrew_nun = 0x0cf0;
public const uint hebrew_samech = 0x0cf1;
public const uint hebrew_samekh = 0x0cf1;
public const uint hebrew_ayin = 0x0cf2;
public const uint hebrew_finalpe = 0x0cf3;
public const uint hebrew_pe = 0x0cf4;
public const uint hebrew_finalzade = 0x0cf5;
public const uint hebrew_finalzadi = 0x0cf5;
public const uint hebrew_zade = 0x0cf6;
public const uint hebrew_zadi = 0x0cf6;
public const uint hebrew_qoph = 0x0cf7;
public const uint hebrew_kuf = 0x0cf7;
public const uint hebrew_resh = 0x0cf8;
public const uint hebrew_shin = 0x0cf9;
public const uint hebrew_taw = 0x0cfa;
public const uint hebrew_taf = 0x0cfa;
public const uint Hebrew_switch = 0xff7e;
public const uint Thai_kokai = 0x0da1;
public const uint Thai_khokhai = 0x0da2;
public const uint Thai_khokhuat = 0x0da3;
public const uint Thai_khokhwai = 0x0da4;
public const uint Thai_khokhon = 0x0da5;
public const uint Thai_khorakhang = 0x0da6;
public const uint Thai_ngongu = 0x0da7;
public const uint Thai_chochan = 0x0da8;
public const uint Thai_choching = 0x0da9;
public const uint Thai_chochang = 0x0daa;
public const uint Thai_soso = 0x0dab;
public const uint Thai_chochoe = 0x0dac;
public const uint Thai_yoying = 0x0dad;
public const uint Thai_dochada = 0x0dae;
public const uint Thai_topatak = 0x0daf;
public const uint Thai_thothan = 0x0db0;
public const uint Thai_thonangmontho = 0x0db1;
public const uint Thai_thophuthao = 0x0db2;
public const uint Thai_nonen = 0x0db3;
public const uint Thai_dodek = 0x0db4;
public const uint Thai_totao = 0x0db5;
public const uint Thai_thothung = 0x0db6;
public const uint Thai_thothahan = 0x0db7;
public const uint Thai_thothong = 0x0db8;
public const uint Thai_nonu = 0x0db9;
public const uint Thai_bobaimai = 0x0dba;
public const uint Thai_popla = 0x0dbb;
public const uint Thai_phophung = 0x0dbc;
public const uint Thai_fofa = 0x0dbd;
public const uint Thai_phophan = 0x0dbe;
public const uint Thai_fofan = 0x0dbf;
public const uint Thai_phosamphao = 0x0dc0;
public const uint Thai_moma = 0x0dc1;
public const uint Thai_yoyak = 0x0dc2;
public const uint Thai_rorua = 0x0dc3;
public const uint Thai_ru = 0x0dc4;
public const uint Thai_loling = 0x0dc5;
public const uint Thai_lu = 0x0dc6;
public const uint Thai_wowaen = 0x0dc7;
public const uint Thai_sosala = 0x0dc8;
public const uint Thai_sorusi = 0x0dc9;
public const uint Thai_sosua = 0x0dca;
public const uint Thai_hohip = 0x0dcb;
public const uint Thai_lochula = 0x0dcc;
public const uint Thai_oang = 0x0dcd;
public const uint Thai_honokhuk = 0x0dce;
public const uint Thai_paiyannoi = 0x0dcf;
public const uint Thai_saraa = 0x0dd0;
public const uint Thai_maihanakat = 0x0dd1;
public const uint Thai_saraaa = 0x0dd2;
public const uint Thai_saraam = 0x0dd3;
public const uint Thai_sarai = 0x0dd4;
public const uint Thai_saraii = 0x0dd5;
public const uint Thai_saraue = 0x0dd6;
public const uint Thai_sarauee = 0x0dd7;
public const uint Thai_sarau = 0x0dd8;
public const uint Thai_sarauu = 0x0dd9;
public const uint Thai_phinthu = 0x0dda;
public const uint Thai_maihanakat_maitho = 0x0dde;
public const uint Thai_baht = 0x0ddf;
public const uint Thai_sarae = 0x0de0;
public const uint Thai_saraae = 0x0de1;
public const uint Thai_sarao = 0x0de2;
public const uint Thai_saraaimaimuan = 0x0de3;
public const uint Thai_saraaimaimalai = 0x0de4;
public const uint Thai_lakkhangyao = 0x0de5;
public const uint Thai_maiyamok = 0x0de6;
public const uint Thai_maitaikhu = 0x0de7;
public const uint Thai_maiek = 0x0de8;
public const uint Thai_maitho = 0x0de9;
public const uint Thai_maitri = 0x0dea;
public const uint Thai_maichattawa = 0x0deb;
public const uint Thai_thanthakhat = 0x0dec;
public const uint Thai_nikhahit = 0x0ded;
public const uint Thai_leksun = 0x0df0;
public const uint Thai_leknung = 0x0df1;
public const uint Thai_leksong = 0x0df2;
public const uint Thai_leksam = 0x0df3;
public const uint Thai_leksi = 0x0df4;
public const uint Thai_lekha = 0x0df5;
public const uint Thai_lekhok = 0x0df6;
public const uint Thai_lekchet = 0x0df7;
public const uint Thai_lekpaet = 0x0df8;
public const uint Thai_lekkao = 0x0df9;
public const uint Hangul = 0xff31;
public const uint Hangul_Start = 0xff32;
public const uint Hangul_End = 0xff33;
public const uint Hangul_Hanja = 0xff34;
public const uint Hangul_Jamo = 0xff35;
public const uint Hangul_Romaja = 0xff36;
public const uint Hangul_Codeinput = 0xff37;
public const uint Hangul_Jeonja = 0xff38;
public const uint Hangul_Banja = 0xff39;
public const uint Hangul_PreHanja = 0xff3a;
public const uint Hangul_PostHanja = 0xff3b;
public const uint Hangul_SingleCandidate = 0xff3c;
public const uint Hangul_MultipleCandidate = 0xff3d;
public const uint Hangul_PreviousCandidate = 0xff3e;
public const uint Hangul_Special = 0xff3f;
public const uint Hangul_switch = 0xff7e;
public const uint Hangul_Kiyeog = 0x0ea1;
public const uint Hangul_SsangKiyeog = 0x0ea2;
public const uint Hangul_KiyeogSios = 0x0ea3;
public const uint Hangul_Nieun = 0x0ea4;
public const uint Hangul_NieunJieuj = 0x0ea5;
public const uint Hangul_NieunHieuh = 0x0ea6;
public const uint Hangul_Dikeud = 0x0ea7;
public const uint Hangul_SsangDikeud = 0x0ea8;
public const uint Hangul_Rieul = 0x0ea9;
public const uint Hangul_RieulKiyeog = 0x0eaa;
public const uint Hangul_RieulMieum = 0x0eab;
public const uint Hangul_RieulPieub = 0x0eac;
public const uint Hangul_RieulSios = 0x0ead;
public const uint Hangul_RieulTieut = 0x0eae;
public const uint Hangul_RieulPhieuf = 0x0eaf;
public const uint Hangul_RieulHieuh = 0x0eb0;
public const uint Hangul_Mieum = 0x0eb1;
public const uint Hangul_Pieub = 0x0eb2;
public const uint Hangul_SsangPieub = 0x0eb3;
public const uint Hangul_PieubSios = 0x0eb4;
public const uint Hangul_Sios = 0x0eb5;
public const uint Hangul_SsangSios = 0x0eb6;
public const uint Hangul_Ieung = 0x0eb7;
public const uint Hangul_Jieuj = 0x0eb8;
public const uint Hangul_SsangJieuj = 0x0eb9;
public const uint Hangul_Cieuc = 0x0eba;
public const uint Hangul_Khieuq = 0x0ebb;
public const uint Hangul_Tieut = 0x0ebc;
public const uint Hangul_Phieuf = 0x0ebd;
public const uint Hangul_Hieuh = 0x0ebe;
public const uint Hangul_A = 0x0ebf;
public const uint Hangul_AE = 0x0ec0;
public const uint Hangul_YA = 0x0ec1;
public const uint Hangul_YAE = 0x0ec2;
public const uint Hangul_EO = 0x0ec3;
public const uint Hangul_E = 0x0ec4;
public const uint Hangul_YEO = 0x0ec5;
public const uint Hangul_YE = 0x0ec6;
public const uint Hangul_O = 0x0ec7;
public const uint Hangul_WA = 0x0ec8;
public const uint Hangul_WAE = 0x0ec9;
public const uint Hangul_OE = 0x0eca;
public const uint Hangul_YO = 0x0ecb;
public const uint Hangul_U = 0x0ecc;
public const uint Hangul_WEO = 0x0ecd;
public const uint Hangul_WE = 0x0ece;
public const uint Hangul_WI = 0x0ecf;
public const uint Hangul_YU = 0x0ed0;
public const uint Hangul_EU = 0x0ed1;
public const uint Hangul_YI = 0x0ed2;
public const uint Hangul_I = 0x0ed3;
public const uint Hangul_J_Kiyeog = 0x0ed4;
public const uint Hangul_J_SsangKiyeog = 0x0ed5;
public const uint Hangul_J_KiyeogSios = 0x0ed6;
public const uint Hangul_J_Nieun = 0x0ed7;
public const uint Hangul_J_NieunJieuj = 0x0ed8;
public const uint Hangul_J_NieunHieuh = 0x0ed9;
public const uint Hangul_J_Dikeud = 0x0eda;
public const uint Hangul_J_Rieul = 0x0edb;
public const uint Hangul_J_RieulKiyeog = 0x0edc;
public const uint Hangul_J_RieulMieum = 0x0edd;
public const uint Hangul_J_RieulPieub = 0x0ede;
public const uint Hangul_J_RieulSios = 0x0edf;
public const uint Hangul_J_RieulTieut = 0x0ee0;
public const uint Hangul_J_RieulPhieuf = 0x0ee1;
public const uint Hangul_J_RieulHieuh = 0x0ee2;
public const uint Hangul_J_Mieum = 0x0ee3;
public const uint Hangul_J_Pieub = 0x0ee4;
public const uint Hangul_J_PieubSios = 0x0ee5;
public const uint Hangul_J_Sios = 0x0ee6;
public const uint Hangul_J_SsangSios = 0x0ee7;
public const uint Hangul_J_Ieung = 0x0ee8;
public const uint Hangul_J_Jieuj = 0x0ee9;
public const uint Hangul_J_Cieuc = 0x0eea;
public const uint Hangul_J_Khieuq = 0x0eeb;
public const uint Hangul_J_Tieut = 0x0eec;
public const uint Hangul_J_Phieuf = 0x0eed;
public const uint Hangul_J_Hieuh = 0x0eee;
public const uint Hangul_RieulYeorinHieuh = 0x0eef;
public const uint Hangul_SunkyeongeumMieum = 0x0ef0;
public const uint Hangul_SunkyeongeumPieub = 0x0ef1;
public const uint Hangul_PanSios = 0x0ef2;
public const uint Hangul_KkogjiDalrinIeung = 0x0ef3;
public const uint Hangul_SunkyeongeumPhieuf = 0x0ef4;
public const uint Hangul_YeorinHieuh = 0x0ef5;
public const uint Hangul_AraeA = 0x0ef6;
public const uint Hangul_AraeAE = 0x0ef7;
public const uint Hangul_J_PanSios = 0x0ef8;
public const uint Hangul_J_KkogjiDalrinIeung = 0x0ef9;
public const uint Hangul_J_YeorinHieuh = 0x0efa;
public const uint Korean_Won = 0x0eff;
public const uint Armenian_ligature_ew = 0x1000587;
public const uint Armenian_full_stop = 0x1000589;
public const uint Armenian_verjaket = 0x1000589;
public const uint Armenian_separation_mark = 0x100055d;
public const uint Armenian_but = 0x100055d;
public const uint Armenian_hyphen = 0x100058a;
public const uint Armenian_yentamna = 0x100058a;
public const uint Armenian_exclam = 0x100055c;
public const uint Armenian_amanak = 0x100055c;
public const uint Armenian_accent = 0x100055b;
public const uint Armenian_shesht = 0x100055b;
public const uint Armenian_question = 0x100055e;
public const uint Armenian_paruyk = 0x100055e;
public const uint Armenian_AYB = 0x1000531;
public const uint Armenian_ayb = 0x1000561;
public const uint Armenian_BEN = 0x1000532;
public const uint Armenian_ben = 0x1000562;
public const uint Armenian_GIM = 0x1000533;
public const uint Armenian_gim = 0x1000563;
public const uint Armenian_DA = 0x1000534;
public const uint Armenian_da = 0x1000564;
public const uint Armenian_YECH = 0x1000535;
public const uint Armenian_yech = 0x1000565;
public const uint Armenian_ZA = 0x1000536;
public const uint Armenian_za = 0x1000566;
public const uint Armenian_E = 0x1000537;
public const uint Armenian_e = 0x1000567;
public const uint Armenian_AT = 0x1000538;
public const uint Armenian_at = 0x1000568;
public const uint Armenian_TO = 0x1000539;
public const uint Armenian_to = 0x1000569;
public const uint Armenian_ZHE = 0x100053a;
public const uint Armenian_zhe = 0x100056a;
public const uint Armenian_INI = 0x100053b;
public const uint Armenian_ini = 0x100056b;
public const uint Armenian_LYUN = 0x100053c;
public const uint Armenian_lyun = 0x100056c;
public const uint Armenian_KHE = 0x100053d;
public const uint Armenian_khe = 0x100056d;
public const uint Armenian_TSA = 0x100053e;
public const uint Armenian_tsa = 0x100056e;
public const uint Armenian_KEN = 0x100053f;
public const uint Armenian_ken = 0x100056f;
public const uint Armenian_HO = 0x1000540;
public const uint Armenian_ho = 0x1000570;
public const uint Armenian_DZA = 0x1000541;
public const uint Armenian_dza = 0x1000571;
public const uint Armenian_GHAT = 0x1000542;
public const uint Armenian_ghat = 0x1000572;
public const uint Armenian_TCHE = 0x1000543;
public const uint Armenian_tche = 0x1000573;
public const uint Armenian_MEN = 0x1000544;
public const uint Armenian_men = 0x1000574;
public const uint Armenian_HI = 0x1000545;
public const uint Armenian_hi = 0x1000575;
public const uint Armenian_NU = 0x1000546;
public const uint Armenian_nu = 0x1000576;
public const uint Armenian_SHA = 0x1000547;
public const uint Armenian_sha = 0x1000577;
public const uint Armenian_VO = 0x1000548;
public const uint Armenian_vo = 0x1000578;
public const uint Armenian_CHA = 0x1000549;
public const uint Armenian_cha = 0x1000579;
public const uint Armenian_PE = 0x100054a;
public const uint Armenian_pe = 0x100057a;
public const uint Armenian_JE = 0x100054b;
public const uint Armenian_je = 0x100057b;
public const uint Armenian_RA = 0x100054c;
public const uint Armenian_ra = 0x100057c;
public const uint Armenian_SE = 0x100054d;
public const uint Armenian_se = 0x100057d;
public const uint Armenian_VEV = 0x100054e;
public const uint Armenian_vev = 0x100057e;
public const uint Armenian_TYUN = 0x100054f;
public const uint Armenian_tyun = 0x100057f;
public const uint Armenian_RE = 0x1000550;
public const uint Armenian_re = 0x1000580;
public const uint Armenian_TSO = 0x1000551;
public const uint Armenian_tso = 0x1000581;
public const uint Armenian_VYUN = 0x1000552;
public const uint Armenian_vyun = 0x1000582;
public const uint Armenian_PYUR = 0x1000553;
public const uint Armenian_pyur = 0x1000583;
public const uint Armenian_KE = 0x1000554;
public const uint Armenian_ke = 0x1000584;
public const uint Armenian_O = 0x1000555;
public const uint Armenian_o = 0x1000585;
public const uint Armenian_FE = 0x1000556;
public const uint Armenian_fe = 0x1000586;
public const uint Armenian_apostrophe = 0x100055a;
public const uint Georgian_an = 0x10010d0;
public const uint Georgian_ban = 0x10010d1;
public const uint Georgian_gan = 0x10010d2;
public const uint Georgian_don = 0x10010d3;
public const uint Georgian_en = 0x10010d4;
public const uint Georgian_vin = 0x10010d5;
public const uint Georgian_zen = 0x10010d6;
public const uint Georgian_tan = 0x10010d7;
public const uint Georgian_in = 0x10010d8;
public const uint Georgian_kan = 0x10010d9;
public const uint Georgian_las = 0x10010da;
public const uint Georgian_man = 0x10010db;
public const uint Georgian_nar = 0x10010dc;
public const uint Georgian_on = 0x10010dd;
public const uint Georgian_par = 0x10010de;
public const uint Georgian_zhar = 0x10010df;
public const uint Georgian_rae = 0x10010e0;
public const uint Georgian_san = 0x10010e1;
public const uint Georgian_tar = 0x10010e2;
public const uint Georgian_un = 0x10010e3;
public const uint Georgian_phar = 0x10010e4;
public const uint Georgian_khar = 0x10010e5;
public const uint Georgian_ghan = 0x10010e6;
public const uint Georgian_qar = 0x10010e7;
public const uint Georgian_shin = 0x10010e8;
public const uint Georgian_chin = 0x10010e9;
public const uint Georgian_can = 0x10010ea;
public const uint Georgian_jil = 0x10010eb;
public const uint Georgian_cil = 0x10010ec;
public const uint Georgian_char = 0x10010ed;
public const uint Georgian_xan = 0x10010ee;
public const uint Georgian_jhan = 0x10010ef;
public const uint Georgian_hae = 0x10010f0;
public const uint Georgian_he = 0x10010f1;
public const uint Georgian_hie = 0x10010f2;
public const uint Georgian_we = 0x10010f3;
public const uint Georgian_har = 0x10010f4;
public const uint Georgian_hoe = 0x10010f5;
public const uint Georgian_fi = 0x10010f6;
public const uint Xabovedot = 0x1001e8a;
public const uint Ibreve = 0x100012c;
public const uint Zstroke = 0x10001b5;
public const uint Gcaron = 0x10001e6;
public const uint Ocaron = 0x10001d1;
public const uint Obarred = 0x100019f;
public const uint xabovedot = 0x1001e8b;
public const uint ibreve = 0x100012d;
public const uint zstroke = 0x10001b6;
public const uint gcaron = 0x10001e7;
public const uint ocaron = 0x10001d2;
public const uint obarred = 0x1000275;
public const uint SCHWA = 0x100018f;
public const uint schwa = 0x1000259;
public const uint Lbelowdot = 0x1001e36;
public const uint lbelowdot = 0x1001e37;
public const uint Abelowdot = 0x1001ea0;
public const uint abelowdot = 0x1001ea1;
public const uint Ahook = 0x1001ea2;
public const uint ahook = 0x1001ea3;
public const uint Acircumflexacute = 0x1001ea4;
public const uint acircumflexacute = 0x1001ea5;
public const uint Acircumflexgrave = 0x1001ea6;
public const uint acircumflexgrave = 0x1001ea7;
public const uint Acircumflexhook = 0x1001ea8;
public const uint acircumflexhook = 0x1001ea9;
public const uint Acircumflextilde = 0x1001eaa;
public const uint acircumflextilde = 0x1001eab;
public const uint Acircumflexbelowdot = 0x1001eac;
public const uint acircumflexbelowdot = 0x1001ead;
public const uint Abreveacute = 0x1001eae;
public const uint abreveacute = 0x1001eaf;
public const uint Abrevegrave = 0x1001eb0;
public const uint abrevegrave = 0x1001eb1;
public const uint Abrevehook = 0x1001eb2;
public const uint abrevehook = 0x1001eb3;
public const uint Abrevetilde = 0x1001eb4;
public const uint abrevetilde = 0x1001eb5;
public const uint Abrevebelowdot = 0x1001eb6;
public const uint abrevebelowdot = 0x1001eb7;
public const uint Ebelowdot = 0x1001eb8;
public const uint ebelowdot = 0x1001eb9;
public const uint Ehook = 0x1001eba;
public const uint ehook = 0x1001ebb;
public const uint Etilde = 0x1001ebc;
public const uint etilde = 0x1001ebd;
public const uint Ecircumflexacute = 0x1001ebe;
public const uint ecircumflexacute = 0x1001ebf;
public const uint Ecircumflexgrave = 0x1001ec0;
public const uint ecircumflexgrave = 0x1001ec1;
public const uint Ecircumflexhook = 0x1001ec2;
public const uint ecircumflexhook = 0x1001ec3;
public const uint Ecircumflextilde = 0x1001ec4;
public const uint ecircumflextilde = 0x1001ec5;
public const uint Ecircumflexbelowdot = 0x1001ec6;
public const uint ecircumflexbelowdot = 0x1001ec7;
public const uint Ihook = 0x1001ec8;
public const uint ihook = 0x1001ec9;
public const uint Ibelowdot = 0x1001eca;
public const uint ibelowdot = 0x1001ecb;
public const uint Obelowdot = 0x1001ecc;
public const uint obelowdot = 0x1001ecd;
public const uint Ohook = 0x1001ece;
public const uint ohook = 0x1001ecf;
public const uint Ocircumflexacute = 0x1001ed0;
public const uint ocircumflexacute = 0x1001ed1;
public const uint Ocircumflexgrave = 0x1001ed2;
public const uint ocircumflexgrave = 0x1001ed3;
public const uint Ocircumflexhook = 0x1001ed4;
public const uint ocircumflexhook = 0x1001ed5;
public const uint Ocircumflextilde = 0x1001ed6;
public const uint ocircumflextilde = 0x1001ed7;
public const uint Ocircumflexbelowdot = 0x1001ed8;
public const uint ocircumflexbelowdot = 0x1001ed9;
public const uint Ohornacute = 0x1001eda;
public const uint ohornacute = 0x1001edb;
public const uint Ohorngrave = 0x1001edc;
public const uint ohorngrave = 0x1001edd;
public const uint Ohornhook = 0x1001ede;
public const uint ohornhook = 0x1001edf;
public const uint Ohorntilde = 0x1001ee0;
public const uint ohorntilde = 0x1001ee1;
public const uint Ohornbelowdot = 0x1001ee2;
public const uint ohornbelowdot = 0x1001ee3;
public const uint Ubelowdot = 0x1001ee4;
public const uint ubelowdot = 0x1001ee5;
public const uint Uhook = 0x1001ee6;
public const uint uhook = 0x1001ee7;
public const uint Uhornacute = 0x1001ee8;
public const uint uhornacute = 0x1001ee9;
public const uint Uhorngrave = 0x1001eea;
public const uint uhorngrave = 0x1001eeb;
public const uint Uhornhook = 0x1001eec;
public const uint uhornhook = 0x1001eed;
public const uint Uhorntilde = 0x1001eee;
public const uint uhorntilde = 0x1001eef;
public const uint Uhornbelowdot = 0x1001ef0;
public const uint uhornbelowdot = 0x1001ef1;
public const uint Ybelowdot = 0x1001ef4;
public const uint ybelowdot = 0x1001ef5;
public const uint Yhook = 0x1001ef6;
public const uint yhook = 0x1001ef7;
public const uint Ytilde = 0x1001ef8;
public const uint ytilde = 0x1001ef9;
public const uint Ohorn = 0x10001a0;
public const uint ohorn = 0x10001a1;
public const uint Uhorn = 0x10001af;
public const uint uhorn = 0x10001b0;
public const uint EcuSign = 0x10020a0;
public const uint ColonSign = 0x10020a1;
public const uint CruzeiroSign = 0x10020a2;
public const uint FFrancSign = 0x10020a3;
public const uint LiraSign = 0x10020a4;
public const uint MillSign = 0x10020a5;
public const uint NairaSign = 0x10020a6;
public const uint PesetaSign = 0x10020a7;
public const uint RupeeSign = 0x10020a8;
public const uint WonSign = 0x10020a9;
public const uint NewSheqelSign = 0x10020aa;
public const uint DongSign = 0x10020ab;
public const uint EuroSign = 0x20ac;
public const uint zerosuperior = 0x1002070;
public const uint foursuperior = 0x1002074;
public const uint fivesuperior = 0x1002075;
public const uint sixsuperior = 0x1002076;
public const uint sevensuperior = 0x1002077;
public const uint eightsuperior = 0x1002078;
public const uint ninesuperior = 0x1002079;
public const uint zerosubscript = 0x1002080;
public const uint onesubscript = 0x1002081;
public const uint twosubscript = 0x1002082;
public const uint threesubscript = 0x1002083;
public const uint foursubscript = 0x1002084;
public const uint fivesubscript = 0x1002085;
public const uint sixsubscript = 0x1002086;
public const uint sevensubscript = 0x1002087;
public const uint eightsubscript = 0x1002088;
public const uint ninesubscript = 0x1002089;
public const uint partdifferential = 0x1002202;
public const uint emptyset = 0x1002205;
public const uint elementof = 0x1002208;
public const uint notelementof = 0x1002209;
public const uint containsas = 0x100220B;
public const uint squareroot = 0x100221A;
public const uint cuberoot = 0x100221B;
public const uint fourthroot = 0x100221C;
public const uint dintegral = 0x100222C;
public const uint tintegral = 0x100222D;
public const uint because = 0x1002235;
public const uint approxeq = 0x1002248;
public const uint notapproxeq = 0x1002247;
public const uint notidentical = 0x1002262;
public const uint stricteq = 0x1002263;
public const uint braille_dot_1 = 0xfff1;
public const uint braille_dot_2 = 0xfff2;
public const uint braille_dot_3 = 0xfff3;
public const uint braille_dot_4 = 0xfff4;
public const uint braille_dot_5 = 0xfff5;
public const uint braille_dot_6 = 0xfff6;
public const uint braille_dot_7 = 0xfff7;
public const uint braille_dot_8 = 0xfff8;
public const uint braille_dot_9 = 0xfff9;
public const uint braille_dot_10 = 0xfffa;
public const uint braille_blank = 0x1002800;
public const uint braille_dots_1 = 0x1002801;
public const uint braille_dots_2 = 0x1002802;
public const uint braille_dots_12 = 0x1002803;
public const uint braille_dots_3 = 0x1002804;
public const uint braille_dots_13 = 0x1002805;
public const uint braille_dots_23 = 0x1002806;
public const uint braille_dots_123 = 0x1002807;
public const uint braille_dots_4 = 0x1002808;
public const uint braille_dots_14 = 0x1002809;
public const uint braille_dots_24 = 0x100280a;
public const uint braille_dots_124 = 0x100280b;
public const uint braille_dots_34 = 0x100280c;
public const uint braille_dots_134 = 0x100280d;
public const uint braille_dots_234 = 0x100280e;
public const uint braille_dots_1234 = 0x100280f;
public const uint braille_dots_5 = 0x1002810;
public const uint braille_dots_15 = 0x1002811;
public const uint braille_dots_25 = 0x1002812;
public const uint braille_dots_125 = 0x1002813;
public const uint braille_dots_35 = 0x1002814;
public const uint braille_dots_135 = 0x1002815;
public const uint braille_dots_235 = 0x1002816;
public const uint braille_dots_1235 = 0x1002817;
public const uint braille_dots_45 = 0x1002818;
public const uint braille_dots_145 = 0x1002819;
public const uint braille_dots_245 = 0x100281a;
public const uint braille_dots_1245 = 0x100281b;
public const uint braille_dots_345 = 0x100281c;
public const uint braille_dots_1345 = 0x100281d;
public const uint braille_dots_2345 = 0x100281e;
public const uint braille_dots_12345 = 0x100281f;
public const uint braille_dots_6 = 0x1002820;
public const uint braille_dots_16 = 0x1002821;
public const uint braille_dots_26 = 0x1002822;
public const uint braille_dots_126 = 0x1002823;
public const uint braille_dots_36 = 0x1002824;
public const uint braille_dots_136 = 0x1002825;
public const uint braille_dots_236 = 0x1002826;
public const uint braille_dots_1236 = 0x1002827;
public const uint braille_dots_46 = 0x1002828;
public const uint braille_dots_146 = 0x1002829;
public const uint braille_dots_246 = 0x100282a;
public const uint braille_dots_1246 = 0x100282b;
public const uint braille_dots_346 = 0x100282c;
public const uint braille_dots_1346 = 0x100282d;
public const uint braille_dots_2346 = 0x100282e;
public const uint braille_dots_12346 = 0x100282f;
public const uint braille_dots_56 = 0x1002830;
public const uint braille_dots_156 = 0x1002831;
public const uint braille_dots_256 = 0x1002832;
public const uint braille_dots_1256 = 0x1002833;
public const uint braille_dots_356 = 0x1002834;
public const uint braille_dots_1356 = 0x1002835;
public const uint braille_dots_2356 = 0x1002836;
public const uint braille_dots_12356 = 0x1002837;
public const uint braille_dots_456 = 0x1002838;
public const uint braille_dots_1456 = 0x1002839;
public const uint braille_dots_2456 = 0x100283a;
public const uint braille_dots_12456 = 0x100283b;
public const uint braille_dots_3456 = 0x100283c;
public const uint braille_dots_13456 = 0x100283d;
public const uint braille_dots_23456 = 0x100283e;
public const uint braille_dots_123456 = 0x100283f;
public const uint braille_dots_7 = 0x1002840;
public const uint braille_dots_17 = 0x1002841;
public const uint braille_dots_27 = 0x1002842;
public const uint braille_dots_127 = 0x1002843;
public const uint braille_dots_37 = 0x1002844;
public const uint braille_dots_137 = 0x1002845;
public const uint braille_dots_237 = 0x1002846;
public const uint braille_dots_1237 = 0x1002847;
public const uint braille_dots_47 = 0x1002848;
public const uint braille_dots_147 = 0x1002849;
public const uint braille_dots_247 = 0x100284a;
public const uint braille_dots_1247 = 0x100284b;
public const uint braille_dots_347 = 0x100284c;
public const uint braille_dots_1347 = 0x100284d;
public const uint braille_dots_2347 = 0x100284e;
public const uint braille_dots_12347 = 0x100284f;
public const uint braille_dots_57 = 0x1002850;
public const uint braille_dots_157 = 0x1002851;
public const uint braille_dots_257 = 0x1002852;
public const uint braille_dots_1257 = 0x1002853;
public const uint braille_dots_357 = 0x1002854;
public const uint braille_dots_1357 = 0x1002855;
public const uint braille_dots_2357 = 0x1002856;
public const uint braille_dots_12357 = 0x1002857;
public const uint braille_dots_457 = 0x1002858;
public const uint braille_dots_1457 = 0x1002859;
public const uint braille_dots_2457 = 0x100285a;
public const uint braille_dots_12457 = 0x100285b;
public const uint braille_dots_3457 = 0x100285c;
public const uint braille_dots_13457 = 0x100285d;
public const uint braille_dots_23457 = 0x100285e;
public const uint braille_dots_123457 = 0x100285f;
public const uint braille_dots_67 = 0x1002860;
public const uint braille_dots_167 = 0x1002861;
public const uint braille_dots_267 = 0x1002862;
public const uint braille_dots_1267 = 0x1002863;
public const uint braille_dots_367 = 0x1002864;
public const uint braille_dots_1367 = 0x1002865;
public const uint braille_dots_2367 = 0x1002866;
public const uint braille_dots_12367 = 0x1002867;
public const uint braille_dots_467 = 0x1002868;
public const uint braille_dots_1467 = 0x1002869;
public const uint braille_dots_2467 = 0x100286a;
public const uint braille_dots_12467 = 0x100286b;
public const uint braille_dots_3467 = 0x100286c;
public const uint braille_dots_13467 = 0x100286d;
public const uint braille_dots_23467 = 0x100286e;
public const uint braille_dots_123467 = 0x100286f;
public const uint braille_dots_567 = 0x1002870;
public const uint braille_dots_1567 = 0x1002871;
public const uint braille_dots_2567 = 0x1002872;
public const uint braille_dots_12567 = 0x1002873;
public const uint braille_dots_3567 = 0x1002874;
public const uint braille_dots_13567 = 0x1002875;
public const uint braille_dots_23567 = 0x1002876;
public const uint braille_dots_123567 = 0x1002877;
public const uint braille_dots_4567 = 0x1002878;
public const uint braille_dots_14567 = 0x1002879;
public const uint braille_dots_24567 = 0x100287a;
public const uint braille_dots_124567 = 0x100287b;
public const uint braille_dots_34567 = 0x100287c;
public const uint braille_dots_134567 = 0x100287d;
public const uint braille_dots_234567 = 0x100287e;
public const uint braille_dots_1234567 = 0x100287f;
public const uint braille_dots_8 = 0x1002880;
public const uint braille_dots_18 = 0x1002881;
public const uint braille_dots_28 = 0x1002882;
public const uint braille_dots_128 = 0x1002883;
public const uint braille_dots_38 = 0x1002884;
public const uint braille_dots_138 = 0x1002885;
public const uint braille_dots_238 = 0x1002886;
public const uint braille_dots_1238 = 0x1002887;
public const uint braille_dots_48 = 0x1002888;
public const uint braille_dots_148 = 0x1002889;
public const uint braille_dots_248 = 0x100288a;
public const uint braille_dots_1248 = 0x100288b;
public const uint braille_dots_348 = 0x100288c;
public const uint braille_dots_1348 = 0x100288d;
public const uint braille_dots_2348 = 0x100288e;
public const uint braille_dots_12348 = 0x100288f;
public const uint braille_dots_58 = 0x1002890;
public const uint braille_dots_158 = 0x1002891;
public const uint braille_dots_258 = 0x1002892;
public const uint braille_dots_1258 = 0x1002893;
public const uint braille_dots_358 = 0x1002894;
public const uint braille_dots_1358 = 0x1002895;
public const uint braille_dots_2358 = 0x1002896;
public const uint braille_dots_12358 = 0x1002897;
public const uint braille_dots_458 = 0x1002898;
public const uint braille_dots_1458 = 0x1002899;
public const uint braille_dots_2458 = 0x100289a;
public const uint braille_dots_12458 = 0x100289b;
public const uint braille_dots_3458 = 0x100289c;
public const uint braille_dots_13458 = 0x100289d;
public const uint braille_dots_23458 = 0x100289e;
public const uint braille_dots_123458 = 0x100289f;
public const uint braille_dots_68 = 0x10028a0;
public const uint braille_dots_168 = 0x10028a1;
public const uint braille_dots_268 = 0x10028a2;
public const uint braille_dots_1268 = 0x10028a3;
public const uint braille_dots_368 = 0x10028a4;
public const uint braille_dots_1368 = 0x10028a5;
public const uint braille_dots_2368 = 0x10028a6;
public const uint braille_dots_12368 = 0x10028a7;
public const uint braille_dots_468 = 0x10028a8;
public const uint braille_dots_1468 = 0x10028a9;
public const uint braille_dots_2468 = 0x10028aa;
public const uint braille_dots_12468 = 0x10028ab;
public const uint braille_dots_3468 = 0x10028ac;
public const uint braille_dots_13468 = 0x10028ad;
public const uint braille_dots_23468 = 0x10028ae;
public const uint braille_dots_123468 = 0x10028af;
public const uint braille_dots_568 = 0x10028b0;
public const uint braille_dots_1568 = 0x10028b1;
public const uint braille_dots_2568 = 0x10028b2;
public const uint braille_dots_12568 = 0x10028b3;
public const uint braille_dots_3568 = 0x10028b4;
public const uint braille_dots_13568 = 0x10028b5;
public const uint braille_dots_23568 = 0x10028b6;
public const uint braille_dots_123568 = 0x10028b7;
public const uint braille_dots_4568 = 0x10028b8;
public const uint braille_dots_14568 = 0x10028b9;
public const uint braille_dots_24568 = 0x10028ba;
public const uint braille_dots_124568 = 0x10028bb;
public const uint braille_dots_34568 = 0x10028bc;
public const uint braille_dots_134568 = 0x10028bd;
public const uint braille_dots_234568 = 0x10028be;
public const uint braille_dots_1234568 = 0x10028bf;
public const uint braille_dots_78 = 0x10028c0;
public const uint braille_dots_178 = 0x10028c1;
public const uint braille_dots_278 = 0x10028c2;
public const uint braille_dots_1278 = 0x10028c3;
public const uint braille_dots_378 = 0x10028c4;
public const uint braille_dots_1378 = 0x10028c5;
public const uint braille_dots_2378 = 0x10028c6;
public const uint braille_dots_12378 = 0x10028c7;
public const uint braille_dots_478 = 0x10028c8;
public const uint braille_dots_1478 = 0x10028c9;
public const uint braille_dots_2478 = 0x10028ca;
public const uint braille_dots_12478 = 0x10028cb;
public const uint braille_dots_3478 = 0x10028cc;
public const uint braille_dots_13478 = 0x10028cd;
public const uint braille_dots_23478 = 0x10028ce;
public const uint braille_dots_123478 = 0x10028cf;
public const uint braille_dots_578 = 0x10028d0;
public const uint braille_dots_1578 = 0x10028d1;
public const uint braille_dots_2578 = 0x10028d2;
public const uint braille_dots_12578 = 0x10028d3;
public const uint braille_dots_3578 = 0x10028d4;
public const uint braille_dots_13578 = 0x10028d5;
public const uint braille_dots_23578 = 0x10028d6;
public const uint braille_dots_123578 = 0x10028d7;
public const uint braille_dots_4578 = 0x10028d8;
public const uint braille_dots_14578 = 0x10028d9;
public const uint braille_dots_24578 = 0x10028da;
public const uint braille_dots_124578 = 0x10028db;
public const uint braille_dots_34578 = 0x10028dc;
public const uint braille_dots_134578 = 0x10028dd;
public const uint braille_dots_234578 = 0x10028de;
public const uint braille_dots_1234578 = 0x10028df;
public const uint braille_dots_678 = 0x10028e0;
public const uint braille_dots_1678 = 0x10028e1;
public const uint braille_dots_2678 = 0x10028e2;
public const uint braille_dots_12678 = 0x10028e3;
public const uint braille_dots_3678 = 0x10028e4;
public const uint braille_dots_13678 = 0x10028e5;
public const uint braille_dots_23678 = 0x10028e6;
public const uint braille_dots_123678 = 0x10028e7;
public const uint braille_dots_4678 = 0x10028e8;
public const uint braille_dots_14678 = 0x10028e9;
public const uint braille_dots_24678 = 0x10028ea;
public const uint braille_dots_124678 = 0x10028eb;
public const uint braille_dots_34678 = 0x10028ec;
public const uint braille_dots_134678 = 0x10028ed;
public const uint braille_dots_234678 = 0x10028ee;
public const uint braille_dots_1234678 = 0x10028ef;
public const uint braille_dots_5678 = 0x10028f0;
public const uint braille_dots_15678 = 0x10028f1;
public const uint braille_dots_25678 = 0x10028f2;
public const uint braille_dots_125678 = 0x10028f3;
public const uint braille_dots_35678 = 0x10028f4;
public const uint braille_dots_135678 = 0x10028f5;
public const uint braille_dots_235678 = 0x10028f6;
public const uint braille_dots_1235678 = 0x10028f7;
public const uint braille_dots_45678 = 0x10028f8;
public const uint braille_dots_145678 = 0x10028f9;
public const uint braille_dots_245678 = 0x10028fa;
public const uint braille_dots_1245678 = 0x10028fb;
public const uint braille_dots_345678 = 0x10028fc;
public const uint braille_dots_1345678 = 0x10028fd;
public const uint braille_dots_2345678 = 0x10028fe;
public const uint braille_dots_12345678 = 0x10028ff;
public const uint Sinh_ng = 0x1000d82;
public const uint Sinh_h2 = 0x1000d83;
public const uint Sinh_a = 0x1000d85;
public const uint Sinh_aa = 0x1000d86;
public const uint Sinh_ae = 0x1000d87;
public const uint Sinh_aee = 0x1000d88;
public const uint Sinh_i = 0x1000d89;
public const uint Sinh_ii = 0x1000d8a;
public const uint Sinh_u = 0x1000d8b;
public const uint Sinh_uu = 0x1000d8c;
public const uint Sinh_ri = 0x1000d8d;
public const uint Sinh_rii = 0x1000d8e;
public const uint Sinh_lu = 0x1000d8f;
public const uint Sinh_luu = 0x1000d90;
public const uint Sinh_e = 0x1000d91;
public const uint Sinh_ee = 0x1000d92;
public const uint Sinh_ai = 0x1000d93;
public const uint Sinh_o = 0x1000d94;
public const uint Sinh_oo = 0x1000d95;
public const uint Sinh_au = 0x1000d96;
public const uint Sinh_ka = 0x1000d9a;
public const uint Sinh_kha = 0x1000d9b;
public const uint Sinh_ga = 0x1000d9c;
public const uint Sinh_gha = 0x1000d9d;
public const uint Sinh_ng2 = 0x1000d9e;
public const uint Sinh_nga = 0x1000d9f;
public const uint Sinh_ca = 0x1000da0;
public const uint Sinh_cha = 0x1000da1;
public const uint Sinh_ja = 0x1000da2;
public const uint Sinh_jha = 0x1000da3;
public const uint Sinh_nya = 0x1000da4;
public const uint Sinh_jnya = 0x1000da5;
public const uint Sinh_nja = 0x1000da6;
public const uint Sinh_tta = 0x1000da7;
public const uint Sinh_ttha = 0x1000da8;
public const uint Sinh_dda = 0x1000da9;
public const uint Sinh_ddha = 0x1000daa;
public const uint Sinh_nna = 0x1000dab;
public const uint Sinh_ndda = 0x1000dac;
public const uint Sinh_tha = 0x1000dad;
public const uint Sinh_thha = 0x1000dae;
public const uint Sinh_dha = 0x1000daf;
public const uint Sinh_dhha = 0x1000db0;
public const uint Sinh_na = 0x1000db1;
public const uint Sinh_ndha = 0x1000db3;
public const uint Sinh_pa = 0x1000db4;
public const uint Sinh_pha = 0x1000db5;
public const uint Sinh_ba = 0x1000db6;
public const uint Sinh_bha = 0x1000db7;
public const uint Sinh_ma = 0x1000db8;
public const uint Sinh_mba = 0x1000db9;
public const uint Sinh_ya = 0x1000dba;
public const uint Sinh_ra = 0x1000dbb;
public const uint Sinh_la = 0x1000dbd;
public const uint Sinh_va = 0x1000dc0;
public const uint Sinh_sha = 0x1000dc1;
public const uint Sinh_ssha = 0x1000dc2;
public const uint Sinh_sa = 0x1000dc3;
public const uint Sinh_ha = 0x1000dc4;
public const uint Sinh_lla = 0x1000dc5;
public const uint Sinh_fa = 0x1000dc6;
public const uint Sinh_al = 0x1000dca;
public const uint Sinh_aa2 = 0x1000dcf;
public const uint Sinh_ae2 = 0x1000dd0;
public const uint Sinh_aee2 = 0x1000dd1;
public const uint Sinh_i2 = 0x1000dd2;
public const uint Sinh_ii2 = 0x1000dd3;
public const uint Sinh_u2 = 0x1000dd4;
public const uint Sinh_uu2 = 0x1000dd6;
public const uint Sinh_ru2 = 0x1000dd8;
public const uint Sinh_e2 = 0x1000dd9;
public const uint Sinh_ee2 = 0x1000dda;
public const uint Sinh_ai2 = 0x1000ddb;
public const uint Sinh_o2 = 0x1000ddc;
public const uint Sinh_oo2 = 0x1000ddd;
public const uint Sinh_au2 = 0x1000dde;
public const uint Sinh_lu2 = 0x1000ddf;
public const uint Sinh_ruu2 = 0x1000df2;
public const uint Sinh_luu2 = 0x1000df3;
public const uint Sinh_kunddaliya = 0x1000df4;
}
libskk-master/libskk/libskk.pc.in 0000664 0000000 0000000 00000002131 14665226114 0017321 0 ustar 00root root 0000000 0000000 # Copyright (C) 2011 Daiki Ueno
# Copyright (C) 2011 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libskk
Description: a library to deal with Japanese kana-to-kanji conversion method
Version: @VERSION@
Requires: gobject-2.0 gio-2.0 gee-0.8
Libs: -L${libdir} -lskk
Cflags: -I${includedir}/skk-@SKK_API_VERSION@
libskk-master/libskk/map-file.vala 0000664 0000000 0000000 00000012372 14665226114 0017460 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
using Gee;
namespace Skk {
abstract class MapFile : Object {
Map> maps =
new HashMap> ();
void load_map (Map map, Json.Object object) {
var keys = object.get_members ();
foreach (var key in keys) {
var value = object.get_member (key);
if (value.get_node_type () == Json.NodeType.NULL) {
map.unset (key);
} else {
map.set (key, value);
}
}
}
void load (RuleMetadata metadata,
string type,
string name,
Set included) throws RuleParseError
{
var filename = metadata.locate_map_file (type, name);
if (filename == null) {
throw new RuleParseError.FAILED ("no such file %s", filename);
}
Json.Parser parser = new Json.Parser ();
try {
if (!parser.load_from_file (filename))
throw new RuleParseError.FAILED ("");
} catch (GLib.Error e) {
throw new RuleParseError.FAILED (
"can't load %s: %s".printf (filename, e.message));
}
var root = parser.get_root ();
if (root.get_node_type () != Json.NodeType.OBJECT) {
throw new RuleParseError.FAILED (
"root element must be an object");
}
var object = root.get_object ();
Json.Node member;
if (object.has_member ("include")) {
member = object.get_member ("include");
if (member.get_node_type () != Json.NodeType.ARRAY) {
throw new RuleParseError.FAILED (
"\"include\" element must be an array");
}
var include = member.get_array ();
var elements = include.get_elements ();
foreach (var element in elements) {
var parent = element.get_string ();
if (parent in included)
continue;
string parent_rule, parent_name;
var index = parent.index_of ("/");
if (index < 0) {
parent_rule = metadata.name;
parent_name = parent;
} else {
parent_rule = parent[0:index];
parent_name = parent[index + 1:parent.length];
}
var parent_metadata = Rule.find_rule (parent_rule);
if (parent_metadata == null) {
throw new RuleParseError.FAILED ("can't find rule %s",
parent_rule);
}
load (parent_metadata, type, parent_name, included);
included.add (parent);
}
}
if (object.has_member ("define")) {
member = object.get_member ("define");
if (member.get_node_type () != Json.NodeType.OBJECT) {
throw new RuleParseError.FAILED (
"\"define\" element must be an object");
}
var define = member.get_object ();
var keys = define.get_members ();
foreach (var key in keys) {
if (!maps.has_key (key)) {
var map = new HashMap ();
maps.set (key, map);
}
member = define.get_member (key);
if (member.get_node_type () != Json.NodeType.OBJECT) {
throw new RuleParseError.FAILED (
"map element must be an object");
}
load_map (maps.get (key), member.get_object ());
}
}
}
internal MapFile (RuleMetadata metadata,
string type,
string name) throws RuleParseError
{
Set included = new HashSet ();
load (metadata, type, name, included);
}
internal bool has_map (string name) {
return maps.has_key (name);
}
internal new Map @get (string name) {
return maps.get (name);
}
}
}
libskk-master/libskk/nicola.vala 0000664 0000000 0000000 00000024304 14665226114 0017231 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
using Gee;
namespace Skk {
/**
* Get the current timer count.
*/
public delegate int64 GetTime ();
/**
* Key event filter implementing NICOLA (thumb shift) input
*
* This class is rarely used in programs but specified as "filter"
* property in rule metadata.
*
* @see Rule
*/
public class NicolaKeyEventFilter : KeyEventFilter {
static int64 get_time () {
var tv = TimeVal ();
return (((int64) tv.tv_sec) * 1000000) + tv.tv_usec;
}
public GetTime get_time_func = get_time;
/**
* Duration where a single key press event is committed
* without a corresponding key release event.
*/
public int64 timeout = 100000;
/**
* Duration between two overlapping key press events, so they
* are considered as a doule key press/release event.
*/
public int64 overlap = 50000;
/**
* Maximum duration to wait for the next key event.
*/
public int64 maxwait = 10000000;
const string[] SPECIAL_DOUBLES = {
"[fj]", "[gh]", "[dk]", "[LR]"
};
/**
* Special double key press events (SKK-NICOLA extension).
*
* By default, "[fj]" (f + j), "[gh]" (g + h), "[dk]" (d + k),
* and "[LR]" (left shift + right shift) are registered.
*/
public string[] special_doubles;
class TimedEntry {
public T data;
public int64 time;
public TimedEntry (T data, int64 time) {
this.data = data;
this.time = time;
}
}
LinkedList> pending = new LinkedList> ();
// we can't use normal constructor here since KeyEventFilter
// is constructed with Object.new (type).
construct {
special_doubles = SPECIAL_DOUBLES;
}
static bool is_char (KeyEvent key) {
return key.code != 0;
}
static bool is_lshift (KeyEvent key) {
return key.name == "lshift" || key.name == "Muhenkan";
}
static bool is_rshift (KeyEvent key) {
return key.name == "rshift" || key.name == "Henkan";
}
static bool is_shift (KeyEvent key) {
return is_lshift (key) || is_rshift (key);
}
static string get_special_double_name (KeyEvent a, KeyEvent b) {
if (is_shift (a) && is_shift (b)) {
return "[LR]";
} else if (is_char (a) && is_char (b)) {
unichar ac, bc;
if (a.code < b.code) {
ac = a.code;
bc = b.code;
} else {
ac = b.code;
bc = a.code;
}
return @"[$ac$bc]";
} else {
return_val_if_reached (null);
}
}
KeyEvent? queue (KeyEvent key, int64 time, out int64 wait) {
// press/release a same key
if ((key.modifiers & ModifierType.RELEASE_MASK) != 0) {
if (pending.size > 0 && pending.get (0).data.base_equal (key)) {
var entry = pending.get (0);
wait = get_next_wait (key, time);
pending.clear ();
return entry.data;
}
}
// ignore key repeat
else {
if (pending.size > 0 && pending.get (0).data.base_equal (key)) {
pending.get (0).time = time;
wait = get_next_wait (key, time);
return key;
}
else {
if (pending.size > 2) {
var iter = pending.bidir_list_iterator ();
iter.last ();
do {
iter.remove ();
} while (pending.size > 2 && iter.previous ());
}
pending.insert (0, new TimedEntry (key, time));
}
}
wait = maxwait;
return null;
}
int64 get_next_wait (KeyEvent key, int64 time) {
if (pending.size > 0) {
var iter = pending.bidir_list_iterator ();
iter.last ();
do {
var entry = iter.get ();
if (time - entry.time > timeout) {
iter.remove ();
}
} while (iter.previous ());
}
if (pending.size > 0) {
return timeout - (time - pending.last ().time);
} else {
return maxwait;
}
}
KeyEvent? dispatch_single (int64 time) {
var entry = pending.peek ();
if (time - entry.time > timeout) {
pending.clear ();
return entry.data;
}
return null;
}
void apply_shift (KeyEvent s, KeyEvent c) {
if (is_lshift (s)) {
c.modifiers |= ModifierType.LSHIFT_MASK;
} else if (is_rshift (s)) {
c.modifiers |= ModifierType.RSHIFT_MASK;
}
}
KeyEvent? dispatch (int64 time) {
if (pending.size == 3) {
var b = pending.get (0);
var s = pending.get (1);
var a = pending.get (2);
var t1 = s.time - a.time;
var t2 = b.time - s.time;
if (t1 <= t2) {
pending.clear ();
pending.offer_head (b);
var r = dispatch_single (time);
apply_shift (s.data, a.data);
forwarded (a.data);
return r;
} else {
pending.clear ();
apply_shift (s.data, b.data);
forwarded (a.data);
return b.data;
}
} else if (pending.size == 2) {
var b = pending.get (0);
var a = pending.get (1);
if (b.time - a.time > overlap) {
pending.clear ();
pending.offer_head (b);
var r = dispatch_single (time);
forwarded (a.data);
return r;
} else if ((is_char (a.data) && is_char (b.data)) ||
(is_shift (a.data) && is_shift (b.data))) {
// skk-nicola uses some combinations of 2 character
// keys ([fj], [gh], etc.) and 2 shift keys ([LR]).
var name = get_special_double_name (b.data, a.data);
if (name in special_doubles) {
pending.clear ();
return new KeyEvent (name,
(unichar) 0,
ModifierType.NONE);
} else {
pending.clear ();
pending.offer_head (b);
var r = dispatch_single (time);
forwarded (a.data);
return r;
}
} else if (time - a.time > timeout) {
pending.clear ();
if (is_shift (b.data)) {
apply_shift (b.data, a.data);
return a.data;
} else {
apply_shift (a.data, b.data);
return b.data;
}
}
} else if (pending.size == 1) {
return dispatch_single (time);
}
return null;
}
bool timeout_func () {
int64 time = get_time_func ();
var r = dispatch (time);
if (r != null) {
forwarded (r);
}
return false;
}
uint timeout_id = 0;
/**
* {@inheritDoc}
*/
public override KeyEvent? filter_key_event (KeyEvent key) {
// clear shift mask
key.modifiers &= ~ModifierType.SHIFT_MASK;
KeyEvent? output = null;
int64 time;
if ((key.modifiers & ModifierType.USLEEP_MASK) != 0) {
Thread.usleep ((long) int.parse (key.name));
time = get_time_func ();
} else if ((key.modifiers & ~ModifierType.RELEASE_MASK) == 0 &&
(is_shift (key) ||
(0x20 <= key.code && key.code <= 0x7E))) {
time = get_time_func ();
int64 wait;
output = queue (key, time, out wait);
if (wait > 0) {
if (timeout_id > 0) {
Source.remove (timeout_id);
}
timeout_id = Timeout.add ((uint) wait, timeout_func);
}
} else {
if ((key.modifiers & ModifierType.RELEASE_MASK) == 0) {
return key;
}
return null;
}
if (output == null) {
output = dispatch (time);
}
return output;
}
/**
* {@inheritDoc}
*/
public override void reset () {
pending.clear ();
}
}
}
libskk-master/libskk/rom-kana.vala 0000664 0000000 0000000 00000025264 14665226114 0017477 0 ustar 00root root 0000000 0000000 // -*- coding: utf-8 -*-
/*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
using Gee;
namespace Skk {
struct RomKanaEntry {
string rom;
string carryover;
// we can't simply use string kana[3] here because array
// initializer in Vala does not support it
string hiragana;
string katakana;
string hankaku_katakana;
internal string get_kana (KanaMode kana_mode) {
if (kana_mode == KanaMode.HIRAGANA)
return hiragana;
else if (kana_mode == KanaMode.KATAKANA)
return katakana;
else if (kana_mode == KanaMode.HANKAKU_KATAKANA)
return hankaku_katakana;
return "";
}
}
const string[] PERIOD_RULE = {"。、", ".,", "。,", ".、"};
class RomKanaNode : Object {
internal RomKanaEntry? entry;
internal weak RomKanaNode parent;
internal RomKanaNode children[128];
internal char c;
internal uint n_children = 0;
internal bool valid[128];
internal RomKanaNode (RomKanaEntry? entry) {
this.entry = entry;
for (int i = 0; i < children.length; i++) {
children[i] = null;
}
}
internal void insert (string key, RomKanaEntry entry) {
var node = this;
for (var i = 0; i < key.length; i++) {
if (node.children[key[i]] == null) {
var child = node.children[key[i]] = new RomKanaNode (null);
child.parent = node;
}
node.n_children++;
node = node.children[key[i]];
valid[key[i]] = true;
}
node.entry = entry;
}
#if 0
RomKanaNode? lookup_node (string key) {
var node = this;
for (var i = 0; i < key.length; i++) {
node = node.children[key[i]];
if (node == null)
return null;
}
return node;
}
internal RomKanaEntry? lookup (string key) {
var node = lookup_node (key);
if (node == null)
return null;
return node.entry;
}
void remove_child (RomKanaNode node) {
children[node.c] = null;
if (--n_children == 0 && parent != null) {
parent.remove_child (this);
}
}
internal void @remove (string key) {
var node = lookup_node (key);
if (node != null) {
return_if_fail (node.parent != null);
node.parent.remove_child (node);
}
}
#endif
}
/**
* Type representing kana scripts.
*/
public enum KanaMode {
/**
* Hiragana like "あいう...".
*/
HIRAGANA,
/**
* Katakana like "アイウ...".
*/
KATAKANA,
/**
* Half-width katakana like "アイウ...".
*/
HANKAKU_KATAKANA
}
/**
* Type to specify how "." and "," are converted.
*/
public enum PeriodStyle {
/**
* Use "。" and "、" for "." and ",".
*/
JA_JA,
/**
* Use "." and "," for "." and ",".
*/
EN_EN,
/**
* Use "。" and "," for "." and ",".
*/
JA_EN,
/**
* Use "." and "、" for "." and ",".
*/
EN_JA
}
/**
* Romaji-to-kana converter.
*/
public class RomKanaConverter : Object {
RomKanaMapFile _rule;
internal RomKanaMapFile rule {
get {
return _rule;
}
set {
_rule = value;
current_node = _rule.root_node;
}
}
RomKanaNode current_node;
public KanaMode kana_mode { get; set; default = KanaMode.HIRAGANA; }
public PeriodStyle period_style { get; set; default = PeriodStyle.JA_JA; }
StringBuilder _output = new StringBuilder ();
StringBuilder _preedit = new StringBuilder ();
public string output {
get {
return _output.str;
}
internal set {
_output.assign (value);
}
}
public string preedit {
get {
return _preedit.str;
}
}
const string[] NN = { "ん", "ン", "ン" };
public RomKanaConverter () {
try {
var metadata = Rule.find_rule ("default");
if (metadata == null) {
throw new RuleParseError.FAILED ("can't find default rule");
}
_rule = new RomKanaMapFile (metadata);
current_node = _rule.root_node;
} catch (RuleParseError e) {
warning ("can't find default rom-kana rule: %s",
e.message);
assert_not_reached ();
}
}
public bool is_valid (unichar uc) {
if (uc > 128)
return false;
return _rule.root_node.valid[(int)uc];
}
/**
* Output "nn" if preedit ends with "n".
*/
public bool output_nn_if_any () {
if (_preedit.str == "n") {
_output.append (NN[kana_mode]);
_preedit.erase ();
current_node = rule.root_node;
return true;
}
return false;
}
/**
* Append text to the internal buffer.
*
* @param text a string
*/
public void append_text (string text) {
int index = 0;
unichar c;
while (text.get_next_char (ref index, out c)) {
append (c);
}
}
/**
* Append a character to the internal buffer.
*
* @param uc an ASCII character
*
* @return `true` if the character is handled, `false` otherwise
*/
public bool append (unichar uc) {
var child_node = current_node.children[uc];
if (child_node == null) {
// no such transition path in trie
var retval = output_nn_if_any ();
// XXX: index_of_char does not work with '\0'
var index = uc != '\0' ? ".,".index_of_char (uc) : -1;
if (index >= 0) {
index = PERIOD_RULE[period_style].index_of_nth_char (index);
unichar period = PERIOD_RULE[period_style].get_char (index);
string kana_period = Util.convert_by_input_mode(
period.to_string(),
(InputMode)kana_mode);
_output.append (kana_period);
_preedit.erase ();
current_node = rule.root_node;
return true;
} else if (rule.root_node.children[uc] == null) {
_output.append_unichar (uc);
_preedit.erase ();
current_node = rule.root_node;
// there may be "NN" output
return retval;
} else {
// abandon current preedit and restart lookup from
// the root with uc
_preedit.erase ();
current_node = rule.root_node;
return append (uc);
}
} else if (child_node.n_children > 0) {
// node is not a terminal
_preedit.append_unichar (uc);
current_node = child_node;
return true;
} else {
_output.append (child_node.entry.get_kana (kana_mode));
_preedit.erase ();
current_node = rule.root_node;
for (int i = 0; i < child_node.entry.carryover.length; i++) {
append (child_node.entry.carryover[i]);
}
return true;
}
}
/**
* Check if a character will be consumed by the current conversion.
*
* @param uc an ASCII character
* @param preedit_only only checks if preedit is active
* @param no_carryover return false if there will be carryover
* @return `true` if the character can be consumed
*/
public bool can_consume (unichar uc,
bool preedit_only = false,
bool no_carryover = true)
{
if (preedit_only && _preedit.len == 0)
return false;
var child_node = current_node.children[uc];
if (child_node == null)
return false;
if (no_carryover &&
child_node.entry != null && child_node.entry.carryover != "")
return false;
return true;
}
/**
* Reset the internal state of the converter.
*/
public void reset () {
_output.erase ();
_preedit.erase ();
current_node = rule.root_node;
}
/**
* Delete the trailing character from the internal buffer.
*
* @return `true` if any character is removed, `false` otherwise
*/
public bool delete () {
if (_preedit.len > 0) {
current_node = current_node.parent;
if (current_node == null)
current_node = rule.root_node;
_preedit.truncate (
_preedit.str.index_of_nth_char (
_preedit.str.char_count () - 1));
return true;
}
if (_output.len > 0) {
_output.truncate (
_output.str.index_of_nth_char (
_output.str.char_count () - 1));
return true;
}
return false;
}
}
}
libskk-master/libskk/rule.vala 0000664 0000000 0000000 00000030410 14665226114 0016726 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
using Gee;
namespace Skk {
class KeymapMapFile : MapFile {
internal Keymap keymap;
internal KeymapMapFile (RuleMetadata metadata, string mode) throws RuleParseError
{
base (metadata, "keymap", mode);
if (has_map ("keymap")) {
var map = get ("keymap");
keymap = new Keymap ();
foreach (var key in map.keys) {
var value = map.get (key);
keymap.set (key, value.get_string ());
}
} else {
throw new RuleParseError.FAILED ("no keymap entry");
}
}
}
class RomKanaMapFile : MapFile {
internal RomKanaNode root_node;
RomKanaNode parse_rule (Map map) throws RuleParseError
{
var node = new RomKanaNode (null);
foreach (var key in map.keys) {
var value = map.get (key);
if (value.get_node_type () == Json.NodeType.ARRAY) {
var components = value.get_array ();
var length = components.get_length ();
if (2 <= length && length <= 4) {
var carryover = components.get_string_element (0);
var hiragana = components.get_string_element (1);
var katakana = length >= 3 ?
components.get_string_element (2) :
Util.get_katakana (hiragana);
var hankaku_katakana = length == 4 ?
components.get_string_element (3) :
Util.get_hankaku_katakana (katakana);
RomKanaEntry entry = {
key,
carryover,
hiragana,
katakana,
hankaku_katakana
};
node.insert (key, entry);
}
else {
throw new RuleParseError.FAILED (
"\"rom-kana\" must have two to four elements");
}
} else {
throw new RuleParseError.FAILED (
"\"rom-kana\" member must be either an array or null");
}
}
return node;
}
public RomKanaMapFile (RuleMetadata metadata) throws RuleParseError {
base (metadata, "rom-kana", "default");
if (has_map ("rom-kana")) {
root_node = parse_rule (get ("rom-kana"));
} else {
throw new RuleParseError.FAILED ("no rom-kana entry");
}
}
}
public errordomain RuleParseError {
FAILED
}
/**
* Object describing a rule.
*/
public struct RuleMetadata {
/**
* Base directory.
*/
string base_dir;
/**
* Name of the rule.
*/
string name;
/**
* Label string of the rule.
*/
string label;
/**
* Description of the rule.
*/
string description;
/**
* Name of key event filter.
*/
string filter;
/**
* Return the path of the map file.
*
* @param type type of the map file
* @param name name of the map file
*
* @return the absolute path of the map file
*/
public string? locate_map_file (string type, string name) {
var filename = Path.build_filename (base_dir, type, name + ".json");
if (FileUtils.test (filename, FileTest.EXISTS)) {
return filename;
}
return null;
}
}
/**
* Object representing a typing rule.
*/
public class Rule : Object {
/**
* Metadata associated with the rule.
*/
public RuleMetadata metadata { get; private set; }
internal KeymapMapFile[] keymaps = new KeymapMapFile[InputMode.LAST];
internal RomKanaMapFile rom_kana;
// We can't use Entry here because of Vala bug:
// https://bugzilla.gnome.org/show_bug.cgi?id=684262
struct KeymapNameEntry {
InputMode key;
string value;
}
const KeymapNameEntry[] keymap_names = {
{ InputMode.HIRAGANA, "hiragana" },
{ InputMode.KATAKANA, "katakana" },
{ InputMode.HANKAKU_KATAKANA, "hankaku-katakana" },
{ InputMode.LATIN, "latin" },
{ InputMode.WIDE_LATIN, "wide-latin" }
};
static string[] rules_path;
KeyEventFilter? filter;
// Make the value type boxed to avoid unwanted ulong -> uint cast:
// https://bugzilla.gnome.org/show_bug.cgi?id=660621
static Map filter_types =
new HashMap ();
static construct {
rules_path = Util.build_data_path ("rules");
filter_types.set ("simple", typeof (SimpleKeyEventFilter));
filter_types.set ("nicola", typeof (NicolaKeyEventFilter));
}
static RuleMetadata load_metadata (string filename) throws RuleParseError
{
Json.Parser parser = new Json.Parser ();
try {
if (!parser.load_from_file (filename)) {
throw new RuleParseError.FAILED ("can't load %s",
filename);
}
var root = parser.get_root ();
if (root.get_node_type () != Json.NodeType.OBJECT) {
throw new RuleParseError.FAILED (
"metadata must be a JSON object");
}
var object = root.get_object ();
Json.Node member;
if (!object.has_member ("name")) {
throw new RuleParseError.FAILED (
"name is not defined in metadata");
}
member = object.get_member ("name");
var name = member.get_string ();
if (!object.has_member ("description")) {
throw new RuleParseError.FAILED (
"description is not defined in metadata");
}
member = object.get_member ("description");
var description = member.get_string ();
string? filter;
if (object.has_member ("filter")) {
member = object.get_member ("filter");
filter = member.get_string ();
if (!filter_types.has_key (filter)) {
throw new RuleParseError.FAILED (
"unknown filter type %s",
filter);
}
} else {
filter = "simple";
}
return RuleMetadata () { label = name,
description = description,
filter = filter,
base_dir = Path.get_dirname (filename) };
} catch (GLib.Error e) {
throw new RuleParseError.FAILED ("can't load rule: %s",
e.message);
}
}
internal KeyEventFilter get_filter () {
if (filter == null) {
var type = filter_types.get (metadata.filter);
filter = (KeyEventFilter) Object.new (type);
}
return filter;
}
/**
* Create a rule.
*
* @param name name of the rule to load
*
* @return a new Rule
*/
public Rule (string name) throws RuleParseError {
var metadata = find_rule (name);
if (metadata == null) {
throw new RuleParseError.FAILED (
"can't find metadata for \"%s\"",
name);
}
this.metadata = metadata;
var default_metadata = find_rule ("default");
if (default_metadata == null) {
throw new RuleParseError.FAILED ("can't find default metadata");
}
foreach (var entry in keymap_names) {
var _metadata = metadata;
if (metadata.locate_map_file ("keymap", entry.value) == null) {
_metadata = default_metadata;
}
keymaps[entry.key] = new KeymapMapFile (_metadata, entry.value);
}
if (metadata.locate_map_file ("rom-kana", "default") == null) {
_metadata = default_metadata;
}
rom_kana = new RomKanaMapFile (_metadata);
}
~Rule () {
if (filter != null) {
filter.reset ();
filter = null;
}
}
static Map rule_cache = new HashMap ();
/**
* Locate a rule by name.
*
* @param name name of the rule
*
* @return a RuleMetadata or `null`
*/
public static RuleMetadata? find_rule (string name) {
if (rule_cache.has_key (name)) {
return rule_cache.get (name);
}
foreach (var dir in rules_path) {
var base_dir_filename = Path.build_filename (dir, name);
var metadata_filename = Path.build_filename (base_dir_filename,
"metadata.json");
if (FileUtils.test (metadata_filename, FileTest.EXISTS)) {
try {
var metadata = load_metadata (metadata_filename);
metadata.name = name;
rule_cache.set (name, metadata);
return metadata;
} catch (RuleParseError e) {
continue;
}
}
}
return null;
}
/**
* List rules.
*
* @return an array of RuleMetadata
*/
public static RuleMetadata[] list () {
Set names = new HashSet ();
RuleMetadata[] rules = {};
foreach (var dir in rules_path) {
Dir handle;
try {
handle = Dir.open (dir);
} catch (GLib.Error e) {
continue;
}
string? name;
while ((name = handle.read_name ()) != null) {
if (name in names) {
continue;
}
var metadata_filename =
Path.build_filename (dir, name, "metadata.json");
if (FileUtils.test (metadata_filename, FileTest.EXISTS)) {
try {
var metadata = load_metadata (metadata_filename);
names.add (name);
metadata.name = name;
rules += metadata;
} catch (RuleParseError e) {
warning ("can't load metadata %s: %s",
metadata_filename,
e.message);
}
}
}
}
return rules;
}
}
}
libskk-master/libskk/skk-1.0.deps 0000664 0000000 0000000 00000000055 14665226114 0017055 0 ustar 00root root 0000000 0000000 glib-2.0
gio-2.0
gee-0.8
posix
json-glib-1.0
libskk-master/libskk/skkserv.vala 0000664 0000000 0000000 00000015556 14665226114 0017465 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
namespace Skk {
errordomain SkkServError {
NOT_READABLE,
INVALID_RESPONSE
}
/**
* Network based Implementation of Dict.
*/
public class SkkServ : Dict {
SocketConnection? connection;
uint8 buffer[4096];
string host;
uint16 port;
void close_connection () {
if (connection != null) {
try {
buffer[0] = '0';
size_t bytes_written;
connection.output_stream.write_all (buffer[0:1],
out bytes_written);
connection.output_stream.flush ();
connection.close ();
} catch (GLib.Error e) {
warning ("can't close skkserv: %s", e.message);
}
connection = null;
}
}
/**
* {@inheritDoc}
*/
public override void reload () {
close_connection ();
try {
var client = new SocketClient ();
connection = client.connect_to_host (host, port);
buffer[0] = '2';
size_t bytes_written;
connection.output_stream.write_all (buffer[0:1],
out bytes_written);
connection.output_stream.flush ();
ssize_t len = connection.input_stream.read (buffer);
if (len <= 0) {
close_connection ();
}
} catch (GLib.Error e) {
warning ("can't open skkserv at %s:%u: %s",
host, port, e.message);
close_connection ();
}
}
string read_response () throws SkkServError, GLib.IOError {
StringBuilder builder = new StringBuilder ();
// skksearch does not terminate the line with LF on
// error (ibus-skk Issue#30)
while (builder.str.index_of_char ('\n') < 0) {
ssize_t len = connection.input_stream.read (buffer);
if (len < 0) {
throw new SkkServError.NOT_READABLE ("read error");
}
else if (len == 0) {
break;
}
else if (len > 0) {
if (buffer[0] != '1') {
throw new SkkServError.INVALID_RESPONSE (
"invalid response code");
}
// make sure to null terminate the string
char[] data = new char[len + 1];
Memory.copy (data, buffer, len);
data.length--;
builder.append ((string)data);
}
}
var index = builder.str.index_of_char ('\n');
if (index < 0) {
throw new SkkServError.INVALID_RESPONSE ("missing newline");
}
return builder.str[0:index];
}
/**
* {@inheritDoc}
*/
public override Candidate[] lookup (string midasi, bool okuri = false) {
if (connection == null)
return new Candidate[0];
string _midasi;
try {
_midasi = converter.encode (midasi);
} catch (GLib.Error e) {
return new Candidate[0];
}
try {
size_t bytes_written;
connection.output_stream.write_all (
"1%s ".printf (_midasi).data, out bytes_written);
connection.output_stream.flush ();
var response = read_response ();
if (response.length == 0)
return new Candidate[0];
return split_candidates (midasi,
okuri,
converter.decode (
response[1:response.length]));
} catch (SkkServError e) {
return new Candidate[0];
} catch (GLib.Error e) {
return new Candidate[0];
}
}
/**
* {@inheritDoc}
*/
public override string[] complete (string midasi) {
if (connection == null)
return new string[0];
string _midasi;
try {
_midasi = converter.encode (midasi);
} catch (GLib.Error e) {
return new string[0];
}
try {
size_t bytes_written;
connection.output_stream.write_all (
"4%s ".printf (_midasi).data, out bytes_written);
connection.output_stream.flush ();
var response = read_response ();
if (response.length < 2)
return new string[0];
return converter.decode (
response[2:-1]).split ("/");
} catch (SkkServError e) {
warning ("server completion failed %s", e.message);
return new string[0];
} catch (GLib.Error e) {
warning ("server completion failed %s", e.message);
return new string[0];
}
}
/**
* {@inheritDoc}
*/
public override bool read_only {
get {
return true;
}
}
EncodingConverter converter;
/**
* Create a new SkkServ.
*
* @param host host to connect
* @param port port at the host
* @param encoding encoding to convert text over network traffic
*
* @return a new SkkServ.
* @throws GLib.Error if opening a connection is failed
*/
public SkkServ (string host, uint16 port = 1178, string encoding = "EUC-JP") throws GLib.Error {
this.host = host;
this.port = port;
this.converter = new EncodingConverter (encoding);
reload ();
}
~SkkServ () {
close_connection ();
}
}
}
libskk-master/libskk/state.vala 0000664 0000000 0000000 00000131742 14665226114 0017111 0 ustar 00root root 0000000 0000000 // -*- coding: utf-8 -*-
/*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
using Gee;
namespace Skk {
const string[] AUTO_START_HENKAN_KEYWORDS = {
"を", "ヲ", "、", "。", ".", ",", "?", "」",
"ヲ", "、", "。", "」",
"!", ";", ":", ")", ";", ":", ")",
"”", "】", "』", "》", "〉", "}", "]",
"〕", "}", "]", "?", ".", ",", "!"
};
class State : Object {
internal Type handler_type;
InputMode _input_mode;
[CCode(notify = false)]
internal InputMode input_mode {
get {
return _input_mode;
}
set {
output.append (rom_kana_converter.output);
var last_input_mode = _input_mode;
reset ();
_input_mode = value;
switch (_input_mode) {
case InputMode.HIRAGANA:
case InputMode.KATAKANA:
case InputMode.HANKAKU_KATAKANA:
rom_kana_converter.kana_mode = (KanaMode) value;
okuri_rom_kana_converter.kana_mode = (KanaMode) value;
break;
default:
break;
}
if (_input_mode != last_input_mode) {
notify_property ("input-mode");
}
}
}
internal Gee.List dictionaries;
internal CandidateList candidates;
// These two RomKanaConverters are needed to track delete/undo
// operation.
internal RomKanaConverter rom_kana_converter;
internal RomKanaConverter okuri_rom_kana_converter;
internal bool okuri;
// Used by Context for dict edit.
internal string midasi;
internal StringBuilder selection = new StringBuilder ();
internal StringBuilder output = new StringBuilder ();
internal StringBuilder abbrev = new StringBuilder ();
internal StringBuilder kuten = new StringBuilder ();
ArrayList completion = new ArrayList ();
internal BidirListIterator completion_iterator;
internal Set completion_set = new HashSet ();
internal string[] auto_start_henkan_keywords;
internal string? auto_start_henkan_keyword = null;
internal bool egg_like_newline = false;
internal PeriodStyle period_style {
get {
return rom_kana_converter.period_style;
}
set {
rom_kana_converter.period_style = value;
okuri_rom_kana_converter.period_style = value;
}
}
Rule _typing_rule;
internal Rule typing_rule {
get {
return _typing_rule;
}
set {
_typing_rule = value;
rom_kana_converter.rule = _typing_rule.rom_kana;
okuri_rom_kana_converter.rule = _typing_rule.rom_kana;
}
}
internal string? lookup_key (KeyEvent key) {
var keymap = _typing_rule.keymaps[input_mode].keymap;
return_val_if_fail (keymap != null, null);
return keymap.lookup_key (key);
}
internal KeyEvent? where_is (string command) {
var keymap = _typing_rule.keymaps[input_mode].keymap;
return_val_if_fail (keymap != null, null);
return keymap.where_is (command);
}
internal bool isupper (KeyEvent key, out unichar lower_code) {
var command = lookup_key (key);
if (command != null && command.has_prefix ("upper-")) {
lower_code = (unichar) command[6];
return true;
} else if (key.code.isupper()) {
lower_code = key.code.tolower();
return true;
}
lower_code = key.code;
return false;
}
Regex numeric_regex;
Regex numeric_ref_regex;
internal State (Gee.List dictionaries) {
this.dictionaries = dictionaries;
this.candidates = new SimpleCandidateList ();
this.candidates.selected.connect (candidate_selected);
rom_kana_converter = new RomKanaConverter ();
okuri_rom_kana_converter = new RomKanaConverter ();
auto_start_henkan_keywords = AUTO_START_HENKAN_KEYWORDS;
try {
_typing_rule = new Rule ("default");
} catch (RuleParseError e) {
assert_not_reached ();
}
try {
numeric_regex = new Regex ("[0-9]+");
} catch (GLib.RegexError e) {
assert_not_reached ();
}
try {
numeric_ref_regex = new Regex ("#([0-9])");
} catch (GLib.RegexError e) {
assert_not_reached ();
}
reset ();
}
~State () {
reset ();
}
void candidate_selected (Candidate c) {
output.append (c.output);
if (auto_start_henkan_keyword != null) {
output.append (auto_start_henkan_keyword);
}
else if (okuri) {
output.append (okuri_rom_kana_converter.output);
}
var _mode = input_mode;
reset ();
_input_mode = _mode;
}
internal void output_surrounding_text () {
if (surrounding_text != null) {
output.append (surrounding_text.substring (0));
}
}
internal void reset () {
// output and input_mode won't change
handler_type = typeof (NoneStateHandler);
rom_kana_converter.reset ();
okuri_rom_kana_converter.reset ();
okuri = false;
_typing_rule.get_filter ().reset ();
completion_iterator = null;
completion_set.clear ();
completion.clear ();
candidates.clear ();
abbrev.erase ();
kuten.erase ();
selection.erase();
auto_start_henkan_keyword = null;
surrounding_text = null;
surrounding_end = 0;
}
internal void cancel_okuri () {
rom_kana_converter.output += okuri_rom_kana_converter.output;
okuri_rom_kana_converter.reset ();
okuri = false;
}
string extract_numerics (string midasi, out int[] numerics) {
MatchInfo info = null;
int start_pos = 0;
int[] _numerics = {};
var builder = new StringBuilder ();
while (true) {
try {
if (!numeric_regex.match_full (midasi,
-1,
start_pos,
0,
out info)) {
break;
}
} catch (GLib.RegexError e) {
return_val_if_reached (midasi);
}
string numeric = info.fetch (0);
int match_start_pos, match_end_pos;
info.fetch_pos (0,
out match_start_pos,
out match_end_pos);
_numerics += int.parse (numeric);
builder.append (midasi[start_pos:match_start_pos]);
builder.append ("#");
start_pos = match_end_pos;
}
numerics = _numerics;
builder.append (midasi[start_pos:midasi.length]);
return builder.str;
}
string expand_expr (string text) {
if (text.has_prefix ("(")) {
var reader = new ExprReader ();
int index = 0;
var node = reader.read_expr (text, ref index);
var evaluator = new ExprEvaluator ();
var _text = evaluator.eval (node);
if (_text != null) {
return _text;
}
}
return text;
}
string expand_numeric_references (string text, int[] numerics) {
var builder = new StringBuilder ();
MatchInfo info = null;
int start_pos = 0;
for (int numeric_index = 0;
numeric_index < numerics.length;
numeric_index++)
{
try {
if (!numeric_ref_regex.match_full (text,
-1,
start_pos,
0,
out info)) {
break;
}
} catch (GLib.RegexError e) {
return_val_if_reached (text);
}
int match_start_pos, match_end_pos;
info.fetch_pos (0,
out match_start_pos,
out match_end_pos);
builder.append (text[start_pos:match_start_pos]);
string type = info.fetch (1);
switch (type[0]) {
case '0':
case '1':
case '2':
case '3':
case '5':
builder.append (
Util.get_numeric (
numerics[numeric_index],
(NumericConversionType) (type[0] - '0')));
break;
case '4':
case '9':
// not supported yet
break;
default:
warning ("unknown numeric conversion type: %s",
type);
break;
}
start_pos = match_end_pos;
}
builder.append (text[start_pos:text.length]);
return builder.str;
}
internal void lookup (string midasi, bool okuri = false) {
candidates.clear ();
int[] numerics = new int[0];
lookup_internal (midasi, numerics, okuri);
var numeric_midasi = extract_numerics (midasi, out numerics);
if (numeric_midasi != midasi) {
lookup_internal (numeric_midasi, numerics, okuri);
}
candidates.add_candidates_end ();
}
void lookup_internal (string midasi,
int[] numerics,
bool okuri = false)
{
foreach (var dict in dictionaries) {
var _candidates = dict.lookup (midasi, okuri);
foreach (var candidate in _candidates) {
var text = candidate.text;
text = expand_expr (text);
text = expand_numeric_references (text, numerics);
candidate.output = text;
// annotation may be an expression
if (candidate.annotation != null) {
candidate.annotation = expand_expr (
candidate.annotation);
}
}
candidates.add_candidates (_candidates);
}
}
internal void purge_candidate (Candidate candidate) {
foreach (var dict in dictionaries) {
if (!dict.read_only) {
dict.purge_candidate (candidate);
}
}
}
internal void completion_start (string midasi) {
foreach (var dict in dictionaries) {
string[] _completion = dict.complete (midasi);
foreach (var word in _completion) {
if (completion_set.add (word)) {
completion.add (word);
}
}
completion.sort ();
}
completion_iterator = completion.bidir_list_iterator ();
if (!completion_iterator.first ()) {
completion_iterator = null;
}
}
internal signal bool recursive_edit_abort ();
internal signal bool recursive_edit_end (string text);
internal signal void recursive_edit_start (string midasi, bool okuri);
internal UnicodeString? surrounding_text;
internal uint surrounding_end;
internal signal bool retrieve_surrounding_text (out string text,
out uint cursor_pos);
internal signal bool delete_surrounding_text (int offset,
uint nchars);
public signal void request_selection_text ();
internal string get_yomi () {
StringBuilder builder = new StringBuilder ();
if (abbrev.len > 0) {
builder.append (abbrev.str);
}
else if (okuri) {
builder.append (rom_kana_converter.output);
builder.append ("*");
builder.append (okuri_rom_kana_converter.output);
builder.append (okuri_rom_kana_converter.preedit);
}
else {
builder.append (rom_kana_converter.output);
builder.append (rom_kana_converter.preedit);
}
return builder.str;
}
}
delegate bool CommandHandler (State state);
abstract class StateHandler : Object {
internal abstract bool process_key_event (State state, ref KeyEvent key);
internal abstract string get_preedit (State state,
out uint underline_offset,
out uint underline_nchars);
internal virtual string get_output (State state) {
return state.output.str;
}
}
// We can't use Entry<*,InputMode> here because of Vala bug:
// https://bugzilla.gnome.org/show_bug.cgi?id=684262
struct InputModeCommandEntry {
string key;
InputMode value;
}
class NoneStateHandler : StateHandler {
const InputModeCommandEntry[] input_mode_commands = {
{ "set-input-mode-hiragana", InputMode.HIRAGANA },
{ "set-input-mode-katakana", InputMode.KATAKANA },
{ "set-input-mode-hankaku-katakana", InputMode.HANKAKU_KATAKANA },
{ "set-input-mode-latin", InputMode.LATIN },
{ "set-input-mode-wide-latin", InputMode.WIDE_LATIN }
};
internal override bool process_key_event (State state,
ref KeyEvent key)
{
var command = state.lookup_key (key);
// check abort and commit event
if (command == "abort" ||
command == "abort-to-latin" ||
command == "abort-to-latin-unhandled") {
bool something_changed;
bool event_handled;
if (state.rom_kana_converter.preedit.length > 0) {
something_changed = true;
} else {
something_changed = state.recursive_edit_abort ();
}
event_handled = something_changed;
state.reset ();
if (command == "abort") {
return something_changed;
}
// change to latin mode
if (state.input_mode != InputMode.LATIN) {
state.input_mode = InputMode.LATIN;
// this change doesn't affect `event_handled`
something_changed = true;
}
// if the key event will not be handled by
// "abort-to-latin-unhandled" command,
// let key event pass through
if (command == "abort-to-latin-unhandled" &&
!event_handled) {
return false;
}
return something_changed;
} else if (command == "commit" ||
command == "commit-unhandled") {
bool retval;
if (state.rom_kana_converter.preedit.length > 0) {
retval = true;
}
else if (state.output.str.length == 0) {
retval = state.recursive_edit_abort ();
}
else {
retval = state.recursive_edit_end (state.output.str);
}
state.reset ();
return command == "commit" ? true : retval;
} else if (command == "start-preedit" ||
command == "start-preedit-kana") {
string? text;
uint cursor_pos;
if (state.retrieve_surrounding_text (out text,
out cursor_pos)) {
state.surrounding_text = new UnicodeString (
text[text.index_of_nth_char (cursor_pos):text.length]);
state.surrounding_end = 0;
state.delete_surrounding_text (
0, state.surrounding_text.length);
}
state.handler_type = typeof (StartStateHandler);
return true;
} else if (command == "start-preedit-no-delete") {
state.handler_type = typeof (StartStateHandler);
return true;
}
// check mode switch events
if (command != null && command.has_prefix ("set-input-mode-") &&
!((state.input_mode == InputMode.HIRAGANA ||
state.input_mode == InputMode.KATAKANA ||
state.input_mode == InputMode.HANKAKU_KATAKANA) &&
key.modifiers == 0 &&
state.rom_kana_converter.can_consume (key.code))) {
foreach (var entry in input_mode_commands) {
if (entry.key == command) {
state.rom_kana_converter.output_nn_if_any ();
state.input_mode = entry.value;
return true;
}
}
}
// check editing events
if (command == "delete") {
if (state.rom_kana_converter.delete ()) {
return true;
}
if (state.output.len > 0) {
state.output.truncate (
state.output.str.index_of_nth_char (
state.output.str.char_count () - 1));
return true;
}
return false;
}
if (command == "register") {
state.request_selection_text();
state.output.append(state.selection.str);
state.selection.erase();
return true;
}
switch (state.input_mode) {
case InputMode.HIRAGANA:
case InputMode.KATAKANA:
case InputMode.HANKAKU_KATAKANA:
unichar lower_code;
if (state.isupper (key, out lower_code) &&
state.rom_kana_converter.is_valid (lower_code)) {
state.rom_kana_converter.output_nn_if_any ();
state.output.append (state.rom_kana_converter.output);
state.rom_kana_converter.output = "";
state.handler_type = typeof (StartStateHandler);
return false;
}
else if (key.modifiers == 0 &&
!state.rom_kana_converter.can_consume (key.code,
true)) {
if (command == "abbrev") {
state.handler_type = typeof (AbbrevStateHandler);
return true;
}
else if (command == "kuten") {
state.handler_type = typeof (KutenStateHandler);
return true;
}
}
if (command != null && command.has_prefix ("insert-kana-")) {
var kana = Util.convert_by_input_mode (
command["insert-kana-".length:command.length],
state.input_mode);
state.output.append (kana);
return true;
}
if (key.modifiers == 0) {
if (state.rom_kana_converter.append (key.code)) {
state.output.append (state.rom_kana_converter.output);
state.rom_kana_converter.output = "";
return true;
}
else if (0x20 <= key.code && key.code < 0x7F) {
state.output.append_c ((char) key.code);
state.rom_kana_converter.output = "";
return true;
}
else {
state.rom_kana_converter.output = "";
return false;
}
}
break;
case InputMode.LATIN:
if (key.modifiers == 0 &&
0x20 <= key.code && key.code < 0x7F) {
state.output.append_c ((char) key.code);
return true;
}
break;
case InputMode.WIDE_LATIN:
if (key.modifiers == 0 &&
0x20 <= key.code && key.code < 0x7F) {
state.output.append_unichar (
Util.get_wide_latin_char ((char) key.code));
return true;
}
break;
}
return false;
}
internal override string get_preedit (State state,
out uint underline_offset,
out uint underline_nchars)
{
StringBuilder builder = new StringBuilder ();
builder.append (state.rom_kana_converter.preedit);
underline_offset = underline_nchars = 0;
return builder.str;
}
}
class KutenStateHandler : StateHandler {
EncodingConverter converter;
internal KutenStateHandler () {
try {
// use EUC-JP to get JISX0208 characters by code
// point, this works because EUC-JP maps JISX0208
// characters to equivalent bytes. See:
// https://en.wikipedia.org/wiki/EUC-JP
// this is generally a wrong approach though
converter = new EncodingConverter ("EUC-JP");
} catch (GLib.Error e) {
converter = null;
assert_not_reached ();
}
}
int hex_char_to_int (char hex) {
if ('0' <= hex && hex <= '9') {
return hex - '0';
} else if ('a' <= hex.tolower () && hex.tolower () <= 'f') {
return hex - 'a' + 10;
}
return -1;
}
string parse_hex (string hex) {
var builder = new StringBuilder ();
for (var i = 0; i < hex.length - 1; i += 2) {
int c = (hex_char_to_int (hex[i]) << 4) |
hex_char_to_int (hex[i + 1]);
builder.append_c ((char)c);
}
return builder.str;
}
internal override bool process_key_event (State state,
ref KeyEvent key)
{
var command = state.lookup_key (key);
if (command == "abort" ||
command == "abort-to-latin" ||
command == "abort-to-latin-unhandled") {
state.reset ();
return true;
}
else if (command == "commit-unhandled" &&
(state.kuten.len == 4 || state.kuten.len == 6)) {
if (converter != null) {
var euc = parse_hex (state.kuten.str);
try {
state.output.append (converter.decode (euc));
} catch (GLib.Error e) {
warning ("can't decode %s in EUC-JP: %s",
euc, e.message);
}
}
state.reset ();
return true;
}
else if (command == "delete" &&
state.kuten.len > 0) {
state.kuten.truncate (state.kuten.len - 1);
return true;
}
else if (key.modifiers == 0 &&
(('a' <= key.code && key.code <= 'f') ||
('A' <= key.code && key.code <= 'F') ||
('0' <= key.code && key.code <= '9')) &&
state.kuten.len < 6) {
state.kuten.append_unichar (key.code);
return true;
}
return true;
}
internal override string get_preedit (State state,
out uint underline_offset,
out uint underline_nchars) {
underline_offset = underline_nchars = 0;
return _("Kuten([MM]KKTT) ") + state.kuten.str;
}
}
class AbbrevStateHandler : StateHandler {
internal override bool process_key_event (State state,
ref KeyEvent key)
{
var command = state.lookup_key (key);
if (command == "abort" ||
command == "abort-to-latin" ||
command == "abort-to-latin-unhandled") {
state.reset ();
return true;
}
else if (command == "next-candidate") {
state.handler_type = typeof (SelectStateHandler);
return false;
}
else if ((key.modifiers & ModifierType.CONTROL_MASK) != 0 &&
key.code == 'q') {
state.output.assign (
Util.get_wide_latin (state.abbrev.str));
state.reset ();
return true;
}
else if (command == "delete") {
if (state.abbrev.len > 0) {
state.abbrev.truncate (state.abbrev.len - 1);
} else {
state.reset ();
}
return true;
}
else if (command == "commit") {
state.output.assign (state.abbrev.str);
state.reset ();
return true;
}
else if (command == "commit-unhandled") {
state.output.assign (state.abbrev.str);
state.reset ();
return state.egg_like_newline;
}
else if (command == "register") {
state.request_selection_text();
state.abbrev.append(state.selection.str);
state.selection.erase();
return true;
}
else if (command == "complete") {
if (state.completion_iterator == null) {
state.completion_start (state.abbrev.str);
}
if (state.completion_iterator != null) {
string midasi = state.completion_iterator.get ();
state.abbrev.assign (midasi);
if (state.completion_iterator.has_next ()) {
state.completion_iterator.next ();
}
}
}
else if (key.modifiers == 0 &&
0x20 <= key.code && key.code <= 0x7E) {
state.abbrev.append_unichar (key.code);
return true;
}
return true;
}
internal override string get_preedit (State state,
out uint underline_offset,
out uint underline_nchars) {
underline_offset = underline_nchars = 0;
return "▽" + state.abbrev.str;
}
}
class StartStateHandler : StateHandler {
const InputModeCommandEntry[] end_preedit_commands = {
{ "set-input-mode-hiragana", InputMode.HIRAGANA },
{ "set-input-mode-katakana", InputMode.KATAKANA },
{ "set-input-mode-hankaku-katakana", InputMode.HANKAKU_KATAKANA }
};
internal override bool process_key_event (State state,
ref KeyEvent key)
{
var command = state.lookup_key (key);
// if no command nor code is assigned to key, we can't proceed
if (command == null && key.code == 0)
return true;
if (command == "abort" ||
command == "abort-to-latin" ||
command == "abort-to-latin-unhandled") {
state.reset ();
return true;
}
// ▽ひらがな + 'q' => ヒラガナ
// which should not change input mode (Issue#8)
foreach (var entry in end_preedit_commands) {
if (entry.key == command) {
state.rom_kana_converter.output_nn_if_any ();
state.output.append (
Util.convert_by_input_mode (
state.rom_kana_converter.output,
entry.value));
if (state.surrounding_text != null) {
state.output.append (state.surrounding_text.substring (
state.surrounding_end));
}
state.rom_kana_converter.reset ();
state.handler_type = typeof (NoneStateHandler);
return true;
}
}
if (command == "next-candidate") {
if (state.rom_kana_converter.output.length == 0) {
if (state.surrounding_text != null) {
state.output.append (state.surrounding_text.substring (
state.surrounding_end));
}
state.reset ();
return true;
}
state.handler_type = typeof (SelectStateHandler);
return false;
}
else if (command == "commit") {
state.output.append (state.rom_kana_converter.output);
if (state.surrounding_text != null) {
state.output.append (state.surrounding_text.substring (
state.surrounding_end));
}
state.reset ();
return true;
}
else if (command == "commit-unhandled") {
state.output.append (state.rom_kana_converter.output);
if (state.surrounding_text != null) {
state.output.append (state.surrounding_text.substring (
state.surrounding_end));
}
state.reset ();
return state.egg_like_newline;
}
else if (command == "delete") {
if (state.okuri_rom_kana_converter.delete ()) {
if (state.okuri_rom_kana_converter.preedit.length == 0) {
state.okuri = false;
}
return true;
}
else if (state.rom_kana_converter.delete ()) {
return true;
}
else if (state.output.len > 0) {
state.output.truncate (
state.output.str.index_of_nth_char (
state.output.str.char_count () - 1));
return true;
}
state.handler_type = typeof (NoneStateHandler);
return true;
}
else if (command == "complete") {
if (state.completion_iterator == null) {
state.completion_start (state.rom_kana_converter.output);
}
if (state.completion_iterator != null) {
string midasi = state.completion_iterator.get ();
state.rom_kana_converter.reset ();
state.rom_kana_converter.output = midasi;
if (state.completion_iterator.has_next ()) {
state.completion_iterator.next ();
}
}
return true;
}
else if (command == "special-midasi") {
if (state.rom_kana_converter.output.length > 0) {
state.rom_kana_converter.append (key.code.tolower ());
state.handler_type = typeof (SelectStateHandler);
key = state.where_is ("next-candidate");
return false;
}
else {
state.rom_kana_converter.append (key.code);
return true;
}
}
else if (command != null && command.has_prefix ("insert-kana-")) {
var kana = Util.convert_by_input_mode (
command["insert-kana-".length:command.length],
state.input_mode);
if (state.okuri) {
state.okuri_rom_kana_converter.output = kana;
state.handler_type = typeof (SelectStateHandler);
key = state.where_is ("next-candidate");
return false;
} else {
state.rom_kana_converter.output += kana;
return true;
}
}
else if (command == "start-preedit") {
return true;
}
else if (command == "start-preedit-kana" ||
command == "start-preedit-no-delete") {
if (state.rom_kana_converter.output.length > 0) {
state.okuri = true;
}
return true;
}
else if (command == "expand-preedit") {
if (state.surrounding_text != null &&
state.surrounding_end < state.surrounding_text.length) {
state.surrounding_end++;
state.rom_kana_converter.output =
state.surrounding_text.substring (
0, state.surrounding_end);
return true;
}
}
else if (command == "shrink-preedit") {
if (state.surrounding_text != null &&
state.surrounding_end > 0) {
state.surrounding_end--;
state.rom_kana_converter.output =
state.surrounding_text.substring (
0, state.surrounding_end);
return true;
}
}
else if (command == "register") {
state.request_selection_text();
state.rom_kana_converter.output += state.selection.str;
state.selection.erase();
return true;
}
unichar lower_code;
bool is_upper = state.isupper (key, out lower_code);
if (state.rom_kana_converter.is_valid (lower_code)) {
// okuri_rom_kana_converter is started or being started
if (state.okuri ||
(is_upper &&
state.rom_kana_converter.output.length > 0 &&
!state.rom_kana_converter.can_consume (
lower_code, true))) {
if (!state.okuri &&
state.rom_kana_converter.can_consume (
lower_code, true, false)) {
state.rom_kana_converter.append (lower_code);
}
state.rom_kana_converter.output_nn_if_any ();
state.okuri = true;
// when okuri-kana is "N [AIUEO]", flush "nn" first
if (is_upper)
state.okuri_rom_kana_converter.output_nn_if_any ();
state.okuri_rom_kana_converter.append (lower_code);
if (state.okuri_rom_kana_converter.preedit.length == 0) {
state.handler_type = typeof (SelectStateHandler);
key = state.where_is ("next-candidate");
return false;
}
return true;
}
else {
state.rom_kana_converter.append (lower_code);
if (check_auto_conversion (state, key)) {
state.handler_type = typeof (SelectStateHandler);
key = state.where_is ("next-candidate");
return false;
}
return true;
}
}
else if (key.modifiers == 0) {
state.rom_kana_converter.append (lower_code);
if (check_auto_conversion (state, key)) {
state.handler_type = typeof (SelectStateHandler);
key = state.where_is ("next-candidate");
return false;
}
return true;
}
// mark any other key events are consumed here
return true;
}
internal override string get_preedit (State state,
out uint underline_offset,
out uint underline_nchars) {
StringBuilder builder = new StringBuilder ("▽");
underline_offset = underline_nchars = 0;
builder.append (state.get_yomi ());
if (state.surrounding_text != null) {
underline_offset = 1;
underline_nchars = builder.str.char_count () - 1;
builder.append (state.surrounding_text.substring (
state.surrounding_end,
-1));
}
return builder.str;
}
bool check_auto_conversion (State state, KeyEvent key) {
foreach (var keyword in state.auto_start_henkan_keywords) {
if (state.rom_kana_converter.output.length > keyword.length &&
state.rom_kana_converter.output.has_suffix (keyword)) {
state.auto_start_henkan_keyword = keyword;
state.rom_kana_converter.output = state.rom_kana_converter.output[0:-keyword.length];
state.handler_type = typeof (SelectStateHandler);
return true;
}
}
return false;
}
}
class SelectStateHandler : StateHandler {
internal override bool process_key_event (State state,
ref KeyEvent key)
{
var command = state.lookup_key (key);
// if no command nor code is assigned to key, we can't proceed
if (command == null && key.code == 0)
return true;
if (command == "previous-candidate") {
if (!state.candidates.previous ()) {
state.candidates.clear ();
state.handler_type = typeof (StartStateHandler);
}
return true;
}
else if (command == "purge-candidate") {
var candidate = state.candidates.get ();
state.purge_candidate (candidate);
state.reset ();
return true;
}
else if (command == "next-candidate") {
if (state.candidates.cursor_pos < 0) {
string midasi;
bool okuri = false;
if (state.abbrev.len > 0) {
midasi = state.abbrev.str;
}
else {
StringBuilder builder = new StringBuilder ();
state.rom_kana_converter.output_nn_if_any ();
builder.append (state.rom_kana_converter.output);
if (state.okuri) {
var prefix = Util.get_okurigana_prefix (
Util.get_hiragana (
state.okuri_rom_kana_converter.output));
if (prefix != null) {
builder.append (prefix);
okuri = true;
}
}
midasi = Util.get_hiragana (builder.str);
}
state.lookup (midasi, okuri);
if (state.candidates.size > 0) {
return true;
}
}
else if (state.candidates.next ()) {
return true;
}
// no more candidates
state.recursive_edit_start (state.get_yomi (), state.okuri);
if (state.candidates.size == 0) {
state.candidates.clear ();
state.handler_type = typeof (StartStateHandler);
}
return true;
}
else if (command == "abort" ||
command == "abort-to-latin" ||
command == "abort-to-latin-unhandled") {
state.candidates.clear ();
state.cancel_okuri ();
state.handler_type = typeof (StartStateHandler);
return true;
}
else {
string surrounding_after = "";
if (state.surrounding_text != null) {
surrounding_after = state.surrounding_text.substring (
state.surrounding_end);
}
state.candidates.select ();
state.output.append (surrounding_after);
if (command == "special-midasi") {
state.candidates.clear ();
state.handler_type = typeof (StartStateHandler);
return false;
}
else {
state.reset ();
if ((key.modifiers == 0 &&
0x20 <= key.code && key.code <= 0x7E) ||
command == "delete" ||
(!state.egg_like_newline &&
command == "commit-unhandled")) {
return false;
}
else {
// mark any other key events are consumed here
return true;
}
}
}
}
internal override string get_preedit (State state,
out uint underline_offset,
out uint underline_nchars) {
StringBuilder builder = new StringBuilder ("▼");
underline_offset = underline_nchars = 0;
if (state.candidates.cursor_pos >= 0) {
var c = state.candidates.get ();
builder.append (c.output);
} else {
builder.append (state.rom_kana_converter.output);
}
if (state.auto_start_henkan_keyword != null) {
builder.append (state.auto_start_henkan_keyword);
}
else if (state.okuri) {
builder.append (state.okuri_rom_kana_converter.output);
}
else if (state.surrounding_text != null) {
underline_offset = 1;
underline_nchars = builder.str.char_count () - 1;
builder.append (state.surrounding_text.substring (
state.surrounding_end,
-1));
}
return builder.str;
}
}
}
libskk-master/libskk/user-dict.vala 0000664 0000000 0000000 00000032066 14665226114 0017667 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
using Gee;
namespace Skk {
/**
* File based implementation of Dict with write access.
*/
public class UserDict : Dict {
void load () throws SkkDictError, GLib.IOError {
uint8[] contents;
try {
file.load_contents (null, out contents, out etag);
} catch (GLib.Error e) {
throw new SkkDictError.NOT_READABLE ("can't load contents");
}
var memory = new MemoryInputStream.from_data (contents, g_free);
var data = new DataInputStream (memory);
string? line = null;
size_t length;
line = data.read_line (out length);
if (line == null) {
return;
}
var coding = EncodingConverter.extract_coding_system (line);
if (coding != null) {
try {
var _converter = new EncodingConverter.from_coding_system (
coding);
if (_converter != null) {
converter = _converter;
}
} catch (Error e) {
warning ("can't create converter from coding system %s: %s",
coding, e.message);
}
// proceed to the next line
line = data.read_line (out length);
if (line == null) {
return;
}
}
Map>? entries = null;
while (line != null) {
if (line.has_prefix (";; okuri-ari entries.")) {
entries = okuri_ari_entries;
break;
}
line = data.read_line (out length);
if (line == null) {
break;
}
}
if (entries == null) {
throw new SkkDictError.MALFORMED_INPUT (
"no okuri-ari boundary");
}
bool okuri = true;
while (line != null) {
line = data.read_line (out length);
if (line == null) {
break;
}
if (line.has_prefix (";; okuri-nasi entries.")) {
entries = okuri_nasi_entries;
okuri = false;
continue;
}
try {
line = converter.decode (line);
} catch (GLib.Error e) {
throw new SkkDictError.MALFORMED_INPUT (
"can't decode line %s: %s", line, e.message);
}
int index = line.index_of (" ");
if (index < 1) {
throw new SkkDictError.MALFORMED_INPUT (
"can't extract midasi from line %s",
line);
}
string midasi = line[0:index];
string candidates_str = line[index + 1:line.length];
if (!candidates_str.has_prefix ("/") ||
!candidates_str.has_suffix ("/")) {
throw new SkkDictError.MALFORMED_INPUT (
"can't parse candidates list %s",
candidates_str);
}
var candidates = split_candidates (midasi,
okuri,
candidates_str);
var list = new ArrayList ();
foreach (var c in candidates) {
list.add (c);
}
entries.set (midasi, list);
}
}
/**
* {@inheritDoc}
*/
public override void reload () throws GLib.Error {
#if VALA_0_16
string attributes = FileAttribute.ETAG_VALUE;
#else
string attributes = FILE_ATTRIBUTE_ETAG_VALUE;
#endif
FileInfo info = file.query_info (attributes,
FileQueryInfoFlags.NONE);
if (info.get_etag () != etag) {
this.okuri_ari_entries.clear ();
this.okuri_nasi_entries.clear ();
try {
load ();
} catch (SkkDictError e) {
warning ("error parsing user dictionary %s: %s",
file.get_path (), e.message);
} catch (GLib.IOError e) {
warning ("error reading user dictionary %s: %s",
file.get_path (), e.message);
}
}
}
static int compare_entry_asc (Map.Entry> a,
Map.Entry> b)
{
return strcmp (a.key, b.key);
}
static int compare_entry_dsc (Map.Entry> a,
Map.Entry> b)
{
return strcmp (b.key, a.key);
}
void write_entries (StringBuilder builder,
Gee.List>> entries)
{
var iter = entries.iterator ();
while (iter.next ()) {
var entry = iter.get ();
var line = "%s %s\n".printf (
entry.key,
join_candidates (entry.value.to_array ()));
builder.append (line);
}
}
/**
* {@inheritDoc}
*/
public override void save () throws GLib.Error {
var builder = new StringBuilder ();
var coding = converter.get_coding_system ();
if (coding != null) {
builder.append (";;; -*- coding: %s -*-\n".printf (coding));
}
builder.append (";; okuri-ari entries.\n");
var entries = new ArrayList>> ();
entries.add_all (okuri_ari_entries.entries);
entries.sort ((CompareDataFunc) compare_entry_dsc);
write_entries (builder, entries);
entries.clear ();
builder.append (";; okuri-nasi entries.\n");
entries.add_all (okuri_nasi_entries.entries);
entries.sort ((CompareDataFunc) compare_entry_asc);
write_entries (builder, entries);
entries.clear ();
var contents = converter.encode (builder.str);
DirUtils.create_with_parents (Path.get_dirname (file.get_path ()),
448);
#if VALA_0_16
file.replace_contents (contents.data,
etag,
false,
FileCreateFlags.PRIVATE,
out etag);
#else
file.replace_contents (contents,
contents.length,
etag,
false,
FileCreateFlags.PRIVATE,
out etag);
#endif
}
Map> get_entries (bool okuri = false) {
if (okuri) {
return okuri_ari_entries;
} else {
return okuri_nasi_entries;
}
}
/**
* {@inheritDoc}
*/
public override Candidate[] lookup (string midasi, bool okuri = false) {
var entries = get_entries (okuri);
if (entries.has_key (midasi)) {
return entries.get (midasi).to_array ();
} else {
return new Candidate[0];
}
}
/**
* {@inheritDoc}
*/
public override string[] complete (string midasi) {
Gee.List completion = new ArrayList ();
Gee.List keys = new ArrayList ();
keys.add_all (okuri_nasi_entries.keys);
keys.sort ();
var iter = keys.iterator ();
// find the first matching entry
while (iter.next ()) {
var key = iter.get ();
if (key.has_prefix (midasi)) {
// don't add midasi word itself
if (key != midasi) {
completion.add (key);
}
break;
}
}
// loop until the last matching entry
while (iter.next ()) {
var key = iter.get ();
if (!key.has_prefix (midasi)) {
break;
}
// don't add midasi word itself
if (key != midasi) {
completion.add (key);
}
}
return completion.to_array ();
}
/**
* {@inheritDoc}
*/
public override bool select_candidate (Candidate candidate) {
var entries = get_entries (candidate.okuri);
if (!entries.has_key (candidate.midasi)) {
entries.set (candidate.midasi, new ArrayList ());
}
var index = 0;
var candidates = entries.get (candidate.midasi);
foreach (var c in candidates) {
if (c.text == candidate.text) {
if (index > 0) {
var first = candidates[0];
candidates[0] = candidates[index];
candidates[index] = first;
return true;
}
return false;
}
index++;
}
candidates.insert (0, candidate);
return true;
}
/**
* {@inheritDoc}
*/
public override bool purge_candidate (Candidate candidate)
{
bool modified = false;
var entries = get_entries (candidate.okuri);
if (entries.has_key (candidate.midasi)) {
var candidates = entries.get (candidate.midasi);
if (candidates.size > 0) {
var iter = candidates.iterator ();
while (iter.next ()) {
var c = iter.get ();
if (c.text == candidate.text) {
iter.remove ();
modified = true;
}
}
if (candidates.size == 0) {
entries.unset (candidate.midasi);
}
}
}
return modified;
}
/**
* {@inheritDoc}
*/
public override bool read_only {
get {
return false;
}
}
File file;
string etag;
EncodingConverter converter;
Map> okuri_ari_entries =
new HashMap> ();
Map> okuri_nasi_entries =
new HashMap> ();
/**
* Create a new UserDict.
*
* @param path a path to the file
* @param encoding encoding of the file (default UTF-8)
*
* @return a new UserDict
* @throws GLib.Error if opening the file is failed
*/
public UserDict (string path,
string encoding = "UTF-8") throws GLib.Error
{
this.file = File.new_for_path (path);
this.etag = "";
this.converter = new EncodingConverter (encoding);
// user dictionary may not exist for the first time
if (FileUtils.test (path, FileTest.EXISTS)) {
reload ();
}
}
~UserDict () {
var okuri_ari_iter = okuri_ari_entries.map_iterator ();
while (okuri_ari_iter.next ()) {
okuri_ari_iter.get_value ().clear ();
}
okuri_ari_entries.clear ();
var okuri_nasi_iter = okuri_nasi_entries.map_iterator ();
while (okuri_nasi_iter.next ()) {
okuri_nasi_iter.get_value ().clear ();
}
okuri_nasi_entries.clear ();
}
}
}
libskk-master/libskk/util.vala 0000664 0000000 0000000 00000053133 14665226114 0016743 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2011-2018 Daiki Ueno
* Copyright (C) 2011-2018 Red Hat, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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 .
*/
using Gee;
namespace Skk {
struct Entry {
K key;
V value;
}
enum NumericConversionType {
LATIN,
WIDE_LATIN,
KANJI_NUMERAL,
KANJI,
RECONVERT,
DAIJI,
SHOGI
}
class Util : Object {
struct KanaTableEntry {
unichar katakana;
string? hiragana;
string? hankaku_katakana;
}
const KanaTableEntry[] KanaTable = {
{'ア', "あ", "ア"}, {'イ', "い", "イ"}, {'ウ', "う", "ウ"},
{'エ', "え", "エ"}, {'オ', "お", "オ"}, {'カ', "か", "カ"},
{'キ', "き", "キ"}, {'ク', "く", "ク"}, {'ケ', "け", "ケ"},
{'コ', "こ", "コ"}, {'サ', "さ", "サ"}, {'シ', "し", "シ"},
{'ス', "す", "ス"}, {'セ', "せ", "セ"}, {'ソ', "そ", "ソ"},
{'タ', "た", "タ"}, {'チ', "ち", "チ"}, {'ツ', "つ", "ツ"},
{'テ', "て", "テ"}, {'ト', "と", "ト"}, {'ナ', "な", "ナ"},
{'ニ', "に", "ニ"}, {'ヌ', "ぬ", "ヌ"}, {'ネ', "ね", "ネ"},
{'ノ', "の", "ノ"}, {'ハ', "は", "ハ"}, {'ヒ', "ひ", "ヒ"},
{'フ', "ふ", "フ"}, {'ヘ', "へ", "ヘ"}, {'ホ', "ほ", "ホ"},
{'マ', "ま", "マ"}, {'ミ', "み", "ミ"}, {'ム', "む", "ム"},
{'メ', "め", "メ"}, {'モ', "も", "モ"}, {'ヤ', "や", "ヤ"},
{'ユ', "ゆ", "ユ"}, {'ヨ', "よ", "ヨ"}, {'ラ', "ら", "ラ"},
{'リ', "り", "リ"}, {'ル', "る", "ル"}, {'レ', "れ", "レ"},
{'ロ', "ろ", "ロ"}, {'ワ', "わ", "ワ"}, {'ヰ', "ゐ", "イ"},
{'ヱ', "ゑ", "エ"}, {'ヲ', "を", "ヲ"}, {'ン', "ん", "ン"},
{'ガ', "が", "ガ"}, {'ギ', "ぎ", "ギ"}, {'グ', "ぐ", "グ"},
{'ゲ', "げ", "ゲ"}, {'ゴ', "ご", "ゴ"}, {'ザ', "ざ", "ザ"},
{'ジ', "じ", "ジ"}, {'ズ', "ず", "ズ"}, {'ゼ', "ぜ", "ゼ"},
{'ゾ', "ぞ", "ゾ"}, {'ダ', "だ", "ダ"}, {'ヂ', "ぢ", "ヂ"},
{'ヅ', "づ", "ヅ"}, {'デ', "で", "デ"}, {'ド', "ど", "ド"},
{'バ', "ば", "バ"}, {'ビ', "び", "ビ"}, {'ブ', "ぶ", "ブ"},
{'ベ', "べ", "ベ"}, {'ボ', "ぼ", "ボ"}, {'パ', "ぱ", "パ"},
{'ピ', "ぴ", "ピ"}, {'プ', "ぷ", "プ"}, {'ペ', "ぺ", "ペ"},
{'ポ', "ぽ", "ポ"}, {'ァ', "ぁ", "ァ"}, {'ィ', "ぃ", "ィ"},
{'ゥ', "ぅ", "ゥ"}, {'ェ', "ぇ", "ェ"}, {'ォ', "ぉ", "ォ"},
{'ッ', "っ", "ッ"},
{'ャ', "ゃ", "ャ"}, {'ュ', "ゅ", "ュ"}, {'ョ', "ょ", "ョ"},
{'ヮ', "ゎ", null},
{'ヴ', "う゛", "ヴ"}, {'ヵ', "ゕ", null}, {'ヶ', "ゖ", null},
{'.', ".", "."},
{',', ",", ","},
{'。', "。", "。"},
{'「', "「", "「"},
{'」', "」", "」"},
{'、', "、", "、"},
{'・', "・", "・"},
{'ー', "ー", "ー"},
{'゛', "゛", "゙"},
{'゜', "゜", "゚"}
};
const KanaTableEntry[] HankakuKatakanaSubstitute = {
{'ヮ', null, "ワ"},
{'ヵ', null, "カ"},
{'ヶ', null, "ケ"}
};
const string[] WideLatinTable = {
" ", "!", "”", "#", "$", "%", "&", "’",
"(", ")", "*", "+", ",", "−", ".", "/",
"0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", ":", ";", "<", "=", ">", "?",
"@", "A", "B", "C", "D", "E", "F", "G",
"H", "I", "J", "K", "L", "M", "N", "O",
"P", "Q", "R", "S", "T", "U", "V", "W",
"X", "Y", "Z", "[", "\", "]", "^", "_",
"‘", "a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k", "l", "m", "n", "o",
"p", "q", "r", "s", "t", "u", "v", "w",
"x", "y", "z", "{", "|", "}", "〜"
};
const string[] KanaRomTable = {
"x", "a", "x", "i", "x", "u", "x", "e", "x", "o", "k",
"g", "k", "g", "k", "g", "k", "g", "k", "g", "s", "z",
"s", "z", "s", "z", "s", "z", "s", "z", "t", "d", "t",
"d", "t", "t", "d", "t", "d", "t", "d", "n", "n", "n",
"n", "n", "h", "b", "p", "h", "b", "p", "h", "b", "p",
"h", "b", "p", "h", "b", "p", "m", "m", "m", "m", "m",
"x", "y", "x", "y", "x", "y", "r", "r", "r", "r", "r",
"x", "w", "x", "x", "w", "n"
};
static string? get_okurigana_prefix_for_char (unichar uc) {
if (uc == 'ん') {
return "n";
}
else if (uc < 'ぁ' || uc > 'ん') {
return null;
}
else {
return KanaRomTable[uc - 'ぁ'];
}
}
internal static string? get_okurigana_prefix (string okurigana) {
var head = okurigana.get_char ();
if (head == 'っ' && okurigana != "っ") {
var index = okurigana.index_of_nth_char (1);
head = okurigana.get_char (index);
}
return get_okurigana_prefix_for_char (head);
}
const string[] KanjiNumericTable = {
"〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"
};
const string[] DaijiNumericTable = {
"零", "壱", "弐", "参", "四", "伍", "六", "七", "八", "九"
};
const string?[] KanjiNumericalPositionTable = {
null, "十", "百", "千", "万", null, null, null, "億",
null, null, null, "兆", null, null, null, null, "京"
};
const string?[] DaijiNumericalPositionTable = {
null, "拾", "百", "阡", "萬", null, null, null, "億",
null, null, null, "兆", null, null, null, null, "京"
};
// katakana to hiragana
static Map _HiraganaTable =
new HashMap ();
// hiragana or hankaku katakana (not composed) to katakana
static Map _KatakanaTable =
new HashMap ();
// katakana to hankaku katakana
static Map _HankakuKatakanaTable =
new HashMap ();
static Map> _CompositionTable =
new HashMap> ();
static Map _WideLatinToLatinTable =
new HashMap ();
internal static unichar get_wide_latin_char (char c) {
return WideLatinTable[c - 32].get_char ();
}
internal static string get_wide_latin (string latin) {
StringBuilder builder = new StringBuilder ();
int index = 0;
unichar uc;
while (latin.get_next_char (ref index, out uc)) {
if (0x20 <= uc && uc <= 0x7E) {
builder.append_unichar (get_wide_latin_char ((char)uc));
} else {
builder.append_unichar (uc);
}
}
return builder.str;
}
#if 0
internal static string get_latin (string wide_latin) {
StringBuilder builder = new StringBuilder ();
int index = 0;
unichar uc;
while (wide_latin.get_next_char (ref index, out uc)) {
string str = uc.to_string ();
if (_WideLatinToLatinTable.has_key (str)) {
builder.append_c (_WideLatinToLatinTable.get (str));
} else {
builder.append (str);
}
}
return builder.str;
}
#endif
static unichar get_katakana_char (unichar uc) {
if (_KatakanaTable.has_key (uc)) {
return _KatakanaTable.get (uc);
}
return uc;
}
static void foreach_katakana (string kana,
Func func)
{
int index = 0;
unichar uc0;
while (kana.get_next_char (ref index, out uc0)) {
if (_CompositionTable.has_key (uc0)) {
var composition = _CompositionTable.get (uc0);
unichar uc1;
if (kana.get_next_char (ref index, out uc1)) {
if (composition.has_key (uc1))
func (composition.get (uc1));
else {
func (get_katakana_char (uc0));
func (get_katakana_char (uc1));
}
} else {
func (get_katakana_char (uc0));
break;
}
} else {
func (get_katakana_char (uc0));
}
}
}
internal static string get_katakana (string kana) {
StringBuilder builder = new StringBuilder ();
foreach_katakana (kana, (uc) => {
builder.append_unichar (uc);
});
return builder.str;
}
internal static string get_hiragana (string kana) {
StringBuilder builder = new StringBuilder ();
foreach_katakana (kana, (uc) => {
if (_HiraganaTable.has_key (uc)) {
builder.append (_HiraganaTable.get (uc));
} else {
builder.append_unichar (uc);
}
});
return builder.str;
}
internal static string get_hankaku_katakana (string kana) {
StringBuilder builder = new StringBuilder ();
foreach_katakana (kana, (uc) => {
if (_HankakuKatakanaTable.has_key (uc)) {
builder.append (_HankakuKatakanaTable.get (uc));
} else {
builder.append_unichar (uc);
}
});
return builder.str;
}
internal static string convert_by_input_mode (string str,
InputMode input_mode)
{
switch (input_mode) {
case InputMode.HIRAGANA:
return get_hiragana (str);
case InputMode.KATAKANA:
return get_katakana (str);
case InputMode.HANKAKU_KATAKANA:
return get_hankaku_katakana (str);
#if 0
case InputMode.LATIN:
return get_latin (str);
#endif
case InputMode.WIDE_LATIN:
return get_wide_latin (str);
default:
return str;
}
}
static string get_kanji_numeric (int numeric,
string[] num_table,
string[]? num_pos_table = null)
{
var builder = new StringBuilder ();
var str = numeric.to_string ();
unichar uc;
if (num_pos_table == null) {
for (var index = 0; str.get_next_char (ref index, out uc); ) {
builder.append (num_table[uc - '0']);
}
return builder.str;
}
else {
for (var index = 0; str.get_next_char (ref index, out uc); ) {
if (uc > '0') {
int pos_index = str.length - index;
if (uc != '1' || pos_index % 4 == 0)
builder.append (KanjiNumericTable[uc - '0']);
var pos = num_pos_table[pos_index];
if (pos == null && pos_index % 4 > 0) {
pos = num_pos_table[pos_index % 4];
}
if (pos != null)
builder.append (pos);
}
}
return builder.str;
}
}
internal static string get_numeric (int numeric,
NumericConversionType type)
{
switch (type) {
case NumericConversionType.LATIN:
return numeric.to_string ();
case NumericConversionType.WIDE_LATIN:
return get_wide_latin (numeric.to_string ());
case NumericConversionType.KANJI_NUMERAL:
return get_kanji_numeric (numeric, KanjiNumericTable);
case NumericConversionType.KANJI:
return get_kanji_numeric (numeric,
KanjiNumericTable,
KanjiNumericalPositionTable);
case NumericConversionType.DAIJI:
return get_kanji_numeric (numeric,
DaijiNumericTable,
DaijiNumericalPositionTable);
default:
break;
}
return "";
}
static construct {
foreach (var entry in KanaTable) {
_HiraganaTable.set (entry.katakana,
entry.hiragana);
_HankakuKatakanaTable.set (entry.katakana,
entry.hankaku_katakana);
foreach (var substitute in HankakuKatakanaSubstitute) {
_HankakuKatakanaTable.set (substitute.katakana,
substitute.hankaku_katakana);
}
if (entry.hiragana != null) {
if (entry.hiragana.char_count () > 1) {
int index = 0;
unichar uc0, uc1;
entry.hiragana.get_next_char (ref index, out uc0);
entry.hiragana.get_next_char (ref index, out uc1);
if (!_CompositionTable.has_key (uc0)) {
_CompositionTable.set (
uc0,
new HashMap ());
}
var composition = _CompositionTable.get (uc0);
composition.set (uc1, entry.katakana);
} else {
_KatakanaTable.set (entry.hiragana.get_char (),
entry.katakana);
}
}
if (entry.hankaku_katakana != null) {
if (entry.hankaku_katakana.char_count () > 1) {
int index = 0;
unichar uc0, uc1;
entry.hankaku_katakana.get_next_char (
ref index, out uc0);
entry.hankaku_katakana.get_next_char (
ref index, out uc1);
if (!_CompositionTable.has_key (uc0)) {
_CompositionTable.set (
uc0,
new HashMap ());
}
var composition = _CompositionTable.get (uc0);
composition.set (uc1, entry.katakana);
} else {
_KatakanaTable.set (entry.hankaku_katakana.get_char (),
entry.katakana);
}
}
}
for (var i = 0; i < WideLatinTable.length; i++) {
_WideLatinToLatinTable.set (WideLatinTable[i], i + 32);
}
}
internal static string[] build_data_path (string subdir) {
ArrayList dirs = new ArrayList ();
string? path = Environment.get_variable ("LIBSKK_DATA_PATH");
if (path == null) {
dirs.add (Path.build_filename (
Environment.get_user_config_dir (),
Config.PACKAGE_NAME,
subdir));
dirs.add (Path.build_filename (Config.PKGDATADIR, subdir));
} else {
string[] elements = path.split (":");
foreach (var element in elements) {
dirs.add (Path.build_filename (element, subdir));
}
}
return dirs.to_array ();
}
}
class UnicodeString : Object {
string str;
internal int length;
internal UnicodeString (string str) {
this.str = str;
this.length = str.char_count ();
}
internal string substring (long offset, long len = -1) {
long byte_offset = str.index_of_nth_char (offset);
long byte_len;
if (len < 0) {
byte_len = len;
} else {
byte_len = str.index_of_nth_char (offset + len) - byte_offset;
}
return str.substring (byte_offset, byte_len);
}
}
class MemoryMappedFile : Object {
void *_memory = null;
public void *memory {
get {
return _memory;
}
}
size_t _length = 0;
public size_t length {
get {
return _length;
}
}
File file;
public MemoryMappedFile (File file) {
this.file = file;
}
public void remap () throws SkkDictError {
if (_memory != null) {
Posix.munmap (_memory, _length);
_memory = null;
}
map ();
}
void map () throws SkkDictError {
int fd = Posix.open (file.get_path (), Posix.O_RDONLY, 0);
if (fd < 0) {
throw new SkkDictError.NOT_READABLE ("can't open %s",
file.get_path ());
}
Posix.Stat stat;
int retval = Posix.fstat (fd, out stat);
if (retval < 0) {
throw new SkkDictError.NOT_READABLE ("can't stat fd");
}
_memory = Posix.mmap (null,
stat.st_size,
Posix.PROT_READ,
Posix.MAP_SHARED,
fd,
0);
if (_memory == Posix.MAP_FAILED) {
throw new SkkDictError.NOT_READABLE ("mmap failed");
}
_length = stat.st_size;
}
}
abstract class KeyEventUtils : Object {
public static string? keyval_name (uint keyval) {
uint8[] buffer = new uint8[64];
int ret = -1;
do {
ret = Xkb.keysym_get_name ((uint32) keyval, buffer);
if (ret == -1)
return null;
if (ret < buffer.length)
return (string) buffer;
buffer = new uint8[buffer.length * 2];
} while (ret >= buffer.length);
return null;
}
public static uint keyval_from_name (string name) {
// special cases for compatibilty with older libskk
if (name == " ")
name = "space";
else if (name == "\t")
name = "Tab";
else if (name == "\n")
name = "Return";
else if (name == "\b")
name = "BackSpace";
var keysym = Xkb.keysym_from_name (name, Xkb.KeysymFlags.NO_FLAGS);
if (keysym == Xkb.Keysym.NoSymbol) {
// handle ASCII keyvals with differnet name (e.g. at,
// percent, etc.)
if (name.char_count () == 1) {
unichar code = name.get_char ();
if (0x20 <= code && code < 0x7F)
return code;
}
return Keysyms.VoidSymbol;
}
return (uint) keysym;
}
public static unichar keyval_unicode (uint keyval) {
// handle ASCII keyvals with differnet name (e.g. at,
// percent, etc.)
if (0x20 <= keyval && keyval < 0x7F)
return keyval;
// special case
if (keyval == Keysyms.yen)
return "\xc2\xa5".get_char ();
uint8[] buffer = new uint8[8];
int ret = -1;
do {
ret = Xkb.keysym_to_utf8 ((uint32) keyval, buffer);
if (ret == 0)
return '\0';
buffer = new uint8[buffer.length * 2];
} while (ret == -1);
return '\0';
}
}
}
libskk-master/libskk/xkbcommon.vapi 0000664 0000000 0000000 00000001357 14665226114 0020000 0 ustar 00root root 0000000 0000000 [CCode (cprefix = "xkb_", lower_case_cprefix = "xkb_", cheader_filename = "xkbcommon/xkbcommon.h")]
namespace Xkb
{
namespace Keysym {
[CCode (cname = "XKB_KEY_NoSymbol")]
public const uint32 NoSymbol;
}
public enum KeysymFlags {
[CCode (cname = "XKB_KEYSYM_NO_FLAGS")]
NO_FLAGS = 0,
CASE_INSENSITIVE = (1 << 0)
}
public int keysym_get_name(uint32 keysym, [CCode (array_length_cname = "size", array_length_pos = 2.1, array_length_type = "size_t")] uint8[] buffer);
public uint32 keysym_from_name(string name, KeysymFlags flags);
public int keysym_to_utf8(uint32 keysym, [CCode (array_length_cname = "size", array_length_pos = 2.1, array_length_type = "size_t")] uint8[] buffer);
}
libskk-master/m4/ 0000775 0000000 0000000 00000000000 14665226114 0014155 5 ustar 00root root 0000000 0000000 libskk-master/m4/vala.m4 0000664 0000000 0000000 00000004141 14665226114 0015342 0 ustar 00root root 0000000 0000000 dnl vala.m4
dnl
dnl Copyright 2010 Marc-Andre Lureau
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation; either
dnl version 2.1 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library; if not, write to the Free Software
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# _VALA_CHECK_COMPILE_WITH_ARGS(ARGS, [ACTION-IF-TRUE],
# [ACTION-IF-FALSE])
# --------------------------------------
# Check that Vala compile with ARGS.
#
AC_DEFUN([_VALA_CHECK_COMPILE_WITH_ARGS],
[AC_REQUIRE([AM_PROG_VALAC])[]dnl
cat <<_ACEOF >conftest.vala
void main(){}
_ACEOF
AS_IF([vala_error=`$VALAC $1 -q -o conftest$ac_exeext conftest.vala 2>&1`],
[$2], [$3])
])
])# _VALA_CHECK_COMPILE_WITH_ARGS
# VALA_CHECK_PACKAGES(PKGS, [ACTION-IF-FOUND],
# [ACTION-IF-NOT-FOUND])
# --------------------------------------
# Check that PKGS Vala bindings are installed and usable.
#
AC_DEFUN([VALA_CHECK_PACKAGES],
[
ac_save_ifs="$IFS"; unset IFS
for vala_pkg in $(echo "$1"); do
vala_pkgs="$vala_pkgs --pkg $vala_pkg"
vala_bindings="$vala_bindings $vala_pkg"
done
IFS="$ac_save_ifs"
AC_MSG_CHECKING([for $vala_bindings vala bindings])
_VALA_CHECK_COMPILE_WITH_ARGS([$vala_pkgs],
[vala_pkg_exists=yes],
[vala_pkg_exists=no])
AS_IF([test x${vala_pkg_exists} = xno],[
ifelse([$3], , [AC_MSG_ERROR([]dnl
[Package requirements were not met: $1
$vala_error
Consider adjusting the XDG_DATA_DIRS environment variable if you
installed bindings in a non-standard prefix.
])],
[AC_MSG_RESULT([no])
$3])],[
AC_MSG_RESULT([yes])
ifelse([$2], , :, [$2])[]dnl
])
])# VALA_CHECK_PACKAGES
libskk-master/po/ 0000775 0000000 0000000 00000000000 14665226114 0014253 5 ustar 00root root 0000000 0000000 libskk-master/po/LINGUAS 0000664 0000000 0000000 00000000003 14665226114 0015271 0 ustar 00root root 0000000 0000000 ja
libskk-master/po/Makevars 0000664 0000000 0000000 00000006435 14665226114 0015757 0 ustar 00root root 0000000 0000000 # Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
DOMAIN = $(PACKAGE)
# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = Daiki Ueno
# This tells whether or not to prepend "GNU " prefix to the package
# name that gets inserted into the header of the $(DOMAIN).pot file.
# Possible values are "yes", "no", or empty. If it is empty, try to
# detect it automatically by scanning the files in $(top_srcdir) for
# "GNU packagename" string.
PACKAGE_GNU = no
# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
# in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
# understood.
# - Strings which make invalid assumptions about notation of date, time or
# money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS =
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =
# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
# context. Possible values are "yes" and "no". Set this to yes if the
# package uses functions taking also a message context, like pgettext(), or
# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
USE_MSGCTXT = no
# These options get passed to msgmerge.
# Useful options are in particular:
# --previous to keep previous msgids of translated messages,
# --quiet to reduce the verbosity.
MSGMERGE_OPTIONS =
# These options get passed to msginit.
# If you want to disable line wrapping when writing PO files, add
# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
# MSGINIT_OPTIONS.
MSGINIT_OPTIONS =
# This tells whether or not to regenerate a PO file when $(DOMAIN).pot
# has changed. Possible values are "yes" and "no". Set this to no if
# the POT file is checked in the repository and the version control
# program ignores timestamps.
PO_DEPENDS_ON_POT = no
# This tells whether or not to forcibly update $(DOMAIN).pot and
# regenerate PO files on "make dist". Possible values are "yes" and
# "no". Set this to no if the POT file and PO files are maintained
# externally.
DIST_DEPENDS_ON_UPDATE_PO = no
libskk-master/po/POTFILES.in 0000664 0000000 0000000 00000000104 14665226114 0016023 0 ustar 00root root 0000000 0000000 libskk/context.vala
libskk/state.vala
tools/skk.vala
tools/fep.vala
libskk-master/po/POTFILES.skip 0000664 0000000 0000000 00000000070 14665226114 0016365 0 ustar 00root root 0000000 0000000 libskk/context.c
libskk/state.c
tools/skk.c
tools/fep.c
libskk-master/po/ja.po 0000664 0000000 0000000 00000003231 14665226114 0015204 0 ustar 00root root 0000000 0000000 # SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR , YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: libskk 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-03-06 18:38+0900\n"
"PO-Revision-Date: 2014-03-06 18:39+0900\n"
"Last-Translator: Daiki Ueno \n"
"Language-Team: Japanese\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../libskk/state.vala:649
msgid "Kuten([MM]KKTT) "
msgstr "区点([MM]KKTT)"
#: ../tools/skk.vala:28 ../tools/fep.vala:35
msgid "Path to a file dictionary"
msgstr "ファイル辞書へのパス"
#: ../tools/skk.vala:30 ../tools/fep.vala:37
msgid "Path to a user dictionary"
msgstr "ユーザ辞書へのパス"
#: ../tools/skk.vala:32 ../tools/fep.vala:39
msgid "Host and port running skkserv (HOST:PORT)"
msgstr "skkserv が動いているホストとポート (HOST:PORT)"
#: ../tools/skk.vala:34 ../tools/fep.vala:41
msgid "Typing rule (default: \"default\")"
msgstr "タイピング方式 (既定値: \"default\")"
#: ../tools/skk.vala:36 ../tools/fep.vala:43
msgid "List typing rules"
msgstr "タイピング方式を一覧表示"
#: ../tools/skk.vala:47 ../tools/fep.vala:56
msgid "- emulate SKK input method on the command line"
msgstr "コマンドライン上で SKK 入力メソッドをエミュレート"
#: ../tools/fep.vala:45
msgid "Preedit style"
msgstr "編集中のテキストのスタイル"
#: ../tools/fep.vala:151
#, c-format
msgid "unknown preedit style %s"
msgstr "未知のスタイル %s"
libskk-master/rules/ 0000775 0000000 0000000 00000000000 14665226114 0014767 5 ustar 00root root 0000000 0000000 libskk-master/rules/Makefile.am 0000664 0000000 0000000 00000007530 14665226114 0017030 0 ustar 00root root 0000000 0000000 # Copyright (C) 2011-2018 Daiki Ueno
# Copyright (C) 2011-2018 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 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 .
rulesdir = $(pkgdatadir)/rules
default_files = \
default/metadata.json \
default/keymap/default.json \
default/keymap/hankaku-katakana.json \
default/keymap/hiragana.json \
default/keymap/katakana.json \
default/keymap/latin.json \
default/keymap/wide-latin.json \
default/rom-kana/default.json \
$(NULL)
act_files = \
act/metadata.json \
act/keymap/default.json \
act/keymap/hankaku-katakana.json \
act/keymap/hiragana.json \
act/keymap/katakana.json \
act/keymap/latin.json \
act/keymap/wide-latin.json \
act/rom-kana/default.json \
$(NULL)
act09_files = \
act09/metadata.json \
act09/keymap/default.json \
act09/keymap/hankaku-katakana.json \
act09/keymap/hiragana.json \
act09/keymap/katakana.json \
act09/keymap/latin.json \
act09/keymap/wide-latin.json \
act09/rom-kana/default.json \
$(NULL)
azik_files = \
azik/metadata.json \
azik/keymap/common.json \
azik/keymap/default.json \
azik/keymap/hankaku-katakana.json \
azik/keymap/hiragana.json \
azik/keymap/katakana.json \
azik/keymap/latin.json \
azik/keymap/wide-latin.json \
azik/rom-kana/default.json \
$(NULL)
kzik_files = \
kzik/metadata.json \
kzik/keymap/common.json \
kzik/keymap/default.json \
kzik/keymap/hankaku-katakana.json \
kzik/keymap/hiragana.json \
kzik/keymap/katakana.json \
kzik/keymap/latin.json \
kzik/keymap/wide-latin.json \
kzik/rom-kana/default.json \
$(NULL)
tutcode_files = \
tutcode/metadata.json \
tutcode/keymap/hankaku-katakana.json \
tutcode/keymap/hiragana.json \
tutcode/keymap/katakana.json \
tutcode/keymap/latin.json \
tutcode/keymap/wide-latin.json \
tutcode/rom-kana/default.json \
$(NULL)
tutcode_touch16x_files = \
tutcode-touch16x/metadata.json \
tutcode-touch16x/keymap/hankaku-katakana.json \
tutcode-touch16x/keymap/hiragana.json \
tutcode-touch16x/keymap/katakana.json \
tutcode-touch16x/keymap/latin.json \
tutcode-touch16x/keymap/wide-latin.json \
tutcode-touch16x/rom-kana/default.json \
$(NULL)
nicola_files = \
nicola/metadata.json \
nicola/keymap/default.json \
nicola/keymap/kana.json \
nicola/keymap/latin.json \
nicola/keymap/katakana.json \
nicola/keymap/hankaku-katakana.json \
nicola/keymap/wide-latin.json \
nicola/keymap/hiragana.json \
nicola/rom-kana/default.json \
$(NULL)
tcode_files = \
tcode/rom-kana/default.json \
tcode/metadata.json \
tcode/keymap/latin.json \
tcode/keymap/katakana.json \
tcode/keymap/hankaku-katakana.json \
tcode/keymap/wide-latin.json \
tcode/keymap/hiragana.json \
$(NULL)
trycode_files = \
trycode/rom-kana/default.json \
trycode/metadata.json \
trycode/keymap/latin.json \
trycode/keymap/katakana.json \
trycode/keymap/hankaku-katakana.json \
trycode/keymap/wide-latin.json \
trycode/keymap/hiragana.json \
$(NULL)
nobase_dist_rules_DATA = \
$(default_files) \
$(act_files) \
$(act09_files) \
$(azik_files) \
$(kzik_files) \
$(tutcode_files) \
$(tutcode_touch16x_files) \
$(nicola_files) \
$(tcode_files) \
$(trycode_files) \
README.rules \
$(NULL)
-include $(top_srcdir)/git.mk
libskk-master/rules/README.rules 0000664 0000000 0000000 00000010127 14665226114 0017001 0 ustar 00root root 0000000 0000000 * Rules overview
libskk supports various typing rules such as AZIK, ACT, TUT-Code,
which define keyboard shortcuts and romaji-to-kana conversion table.
Rules are normally read from ~/.config/libskk/rules and
/usr/share/libskk/rules.
* Rule directory structure
A rule consists of the following directory structure:
metadata.json
keymap/
...
rom-kana/
...
* Rule metadata
Each rule must have metadata.json in the top level directory, with the
following content:
{
"name": ,
"description": ,
"filter":
}
* Format of map files
Each file under keymaps/ and rom-kana/ directories is used to define
some key-value mappings. They are in the following format:
{
"include": [
,
...
],
"define": {