mirror of https://github.com/odrling/Aegisub
Remove vendor submodules
This commit is contained in:
parent
e53bdd32d7
commit
e2430b6fca
|
@ -1,42 +1,4 @@
|
||||||
[submodule "freetype2"]
|
|
||||||
path = vendor/freetype2
|
|
||||||
url = git://git.sv.nongnu.org/freetype/freetype2.git
|
|
||||||
ignore = dirty
|
|
||||||
[submodule "wxWidgets"]
|
|
||||||
path = vendor/wxWidgets
|
|
||||||
url = git://github.com/Aegisub/wxWidgets.git
|
|
||||||
ignore = dirty
|
|
||||||
[submodule "googletest"]
|
[submodule "googletest"]
|
||||||
path = vendor/googletest
|
path = vendor/googletest
|
||||||
url = git://github.com/svn2github/googletest.git
|
url = git://github.com/svn2github/googletest.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
[submodule "ffmpeg"]
|
|
||||||
path = vendor/ffmpeg
|
|
||||||
url = git://source.ffmpeg.org/ffmpeg.git
|
|
||||||
ignore = dirty
|
|
||||||
[submodule "ffms2"]
|
|
||||||
path = vendor/ffms2
|
|
||||||
url = git://github.com/FFMS/ffms2.git
|
|
||||||
branch = master
|
|
||||||
ignore = dirty
|
|
||||||
[submodule "libass"]
|
|
||||||
path = vendor/libass
|
|
||||||
url = git://github.com/libass/libass.git
|
|
||||||
branch = master
|
|
||||||
[submodule "icu"]
|
|
||||||
path = vendor/icu
|
|
||||||
url = git://github.com/svn2github/icu4c.git
|
|
||||||
branch = master
|
|
||||||
ignore = dirty
|
|
||||||
[submodule "boost"]
|
|
||||||
path = vendor/boost
|
|
||||||
url = https://github.com/boostorg/boost.git
|
|
||||||
ignore = dirty
|
|
||||||
[submodule "fftw"]
|
|
||||||
path = vendor/fftw
|
|
||||||
url = https://github.com/Aegisub/fftw3.git
|
|
||||||
ignore = dirty
|
|
||||||
[submodule "uchardet"]
|
|
||||||
path = vendor/uchardet
|
|
||||||
url = https://github.com/BYVoid/uchardet
|
|
||||||
ignore = dirty
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 8d02ed770bbd22c7573b625657d8cc44aa19351a
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit d290bb0c540425e937d11ed88e22c68ab97c57eb
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit f3c6b008b53719dcac032293e3a42a3164c8d7ec
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit d68ca6315cafa5b8ff9367d9375314f32b7dbd81
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 51fee655837ef99084767873266aaddfa3a31da5
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +0,0 @@
|
||||||
Author of Hunspell:
|
|
||||||
Németh László nemeth (at) numbertext.org
|
|
||||||
|
|
||||||
Hunspell based on OpenOffice.org's Myspell. MySpell's author:
|
|
||||||
Kevin Hendricks kevin.hendricks (at) sympatico.ca
|
|
|
@ -1,67 +0,0 @@
|
||||||
Developer Credits:
|
|
||||||
|
|
||||||
Special credit and thanks go to ispell's creator Geoff Kuenning.
|
|
||||||
Ispell affix compression code was used as the basis for the
|
|
||||||
affix code used in MySpell. Specifically Geoff's use of a
|
|
||||||
conds[] array that makes it easy to check if the conditions
|
|
||||||
required for a particular affix are present was very
|
|
||||||
ingenious! Kudos to Geoff. Very nicely done.
|
|
||||||
BTW: ispell is available under a BSD style license
|
|
||||||
from Geoff Kuennings ispell website:
|
|
||||||
http://www.cs.ucla.edu/ficus-members/geoff/ispell.html
|
|
||||||
|
|
||||||
|
|
||||||
Kevin Hendricks <kevin.hendricks@sympatico.ca> is the original
|
|
||||||
author and now maintainer of the MySpell codebase. Recent
|
|
||||||
additions include ngram support, and related character maps
|
|
||||||
to help improve and create suggestions for very poorly
|
|
||||||
spelled words.
|
|
||||||
|
|
||||||
Please send any and all contributions or improvements
|
|
||||||
to him or to dev@lingucomponent.openoffice.org.
|
|
||||||
|
|
||||||
|
|
||||||
David Einstein (Deinst@world.std.com) developed an almost
|
|
||||||
complete rewrite of MySpell for use by the Mozilla project.
|
|
||||||
David and I are now working on parallel development tracks
|
|
||||||
to help our respective projects (Mozilla and OpenOffice.org)
|
|
||||||
and we will maintain full affix file and dictionary file
|
|
||||||
compatibility and work on merging our versions of MySpell
|
|
||||||
back into a single tree. David has been a significant help
|
|
||||||
in improving MySpell.
|
|
||||||
|
|
||||||
|
|
||||||
Németh László <nemethl@gyorsposta.hu> is the author of
|
|
||||||
the Hungarian dictionary and he developed and contributed
|
|
||||||
extensive changes to MySpell including ...
|
|
||||||
* code to support compound words in MySpell
|
|
||||||
* fixed numerous problems with encoding case conversion tables.
|
|
||||||
* designed/developed replacement tables to improve suggestions
|
|
||||||
* changed affix file parsing to trees to greatly speed loading
|
|
||||||
* removed the need for malloc/free pairs in suffix_check which
|
|
||||||
speeds up spell checking in suffix rich languages by 20%
|
|
||||||
|
|
||||||
Davide Prina <davideprina@uahoo.com>, Giuseppe Modugno
|
|
||||||
<gppe.modugno@libero.it>, Gianluca Turconi <luctur@comeg.it>
|
|
||||||
all from the it_IT OpenOffice.org team performed an
|
|
||||||
extremely detailed code review of MySpell and generated
|
|
||||||
fixes for bugs, leaks, and speedup improvements.
|
|
||||||
|
|
||||||
Simon Brouwer <simon.oo.o@xs4all.nl> for fixes and enhancements
|
|
||||||
that have greatly improved MySpell auggestions
|
|
||||||
* n-gram suggestions for an initcap word have an init. cap.
|
|
||||||
* fix for too many n-gram suggestions from specialized dictionary,
|
|
||||||
* fix for long suggestions rather than close ones in case of
|
|
||||||
dictionaries with many compound words (kompuuter)
|
|
||||||
* optionally disabling split-word suggestions (controlled
|
|
||||||
by NOSPLITSUGS line in affix file)
|
|
||||||
|
|
||||||
|
|
||||||
Special Thanks to all others who have either contributed ideas or
|
|
||||||
testing for MySpell
|
|
||||||
|
|
||||||
|
|
||||||
Thanks,
|
|
||||||
|
|
||||||
Kevin Hendricks
|
|
||||||
kevin.hendricks@sympatico.ca
|
|
|
@ -1,5 +0,0 @@
|
||||||
* Interactive interface has some visualization problem with long lines
|
|
||||||
|
|
||||||
* Experimental -U, -u options don't support Unicode.
|
|
||||||
|
|
||||||
* Compound handling is not thread safe in Hungarian specific code.
|
|
|
@ -1,12 +0,0 @@
|
||||||
GPL 2.0/LGPL 2.1/MPL 1.1 tri-license
|
|
||||||
|
|
||||||
The contents of this software may be used under the terms of
|
|
||||||
the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
the GNU Lesser General Public License Version 2.1 or later (the "LGPL",
|
|
||||||
see COPYING.LGPL) or (excepting the LGPLed GNU gettext library in the
|
|
||||||
intl/ directory) the Mozilla Public License Version 1.1 or later
|
|
||||||
(the "MPL", see COPYING.MPL).
|
|
||||||
|
|
||||||
Software distributed under these licenses is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the licences
|
|
||||||
for the specific language governing rights and limitations under the licenses.
|
|
|
@ -1,515 +0,0 @@
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
Version 2.1, February 1999
|
|
||||||
|
|
||||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
|
||||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
[This is the first released version of the Lesser GPL. It also counts
|
|
||||||
as the successor of the GNU Library Public License, version 2, hence
|
|
||||||
the version number 2.1.]
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
|
||||||
Licenses are intended to guarantee your freedom to share and change
|
|
||||||
free software--to make sure the software is free for all its users.
|
|
||||||
|
|
||||||
This license, the Lesser General Public License, applies to some
|
|
||||||
specially designated software packages--typically libraries--of the
|
|
||||||
Free Software Foundation and other authors who decide to use it. You
|
|
||||||
can use it too, but we suggest you first think carefully about whether
|
|
||||||
this license or the ordinary General Public License is the better
|
|
||||||
strategy to use in any particular case, based on the explanations
|
|
||||||
below.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom of use,
|
|
||||||
not price. Our General Public Licenses are designed to make sure that
|
|
||||||
you have the freedom to distribute copies of free software (and charge
|
|
||||||
for this service if you wish); that you receive source code or can get
|
|
||||||
it if you want it; that you can change the software and use pieces of
|
|
||||||
it in new free programs; and that you are informed that you can do
|
|
||||||
these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid
|
|
||||||
distributors to deny you these rights or to ask you to surrender these
|
|
||||||
rights. These restrictions translate to certain responsibilities for
|
|
||||||
you if you distribute copies of the library or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of the library, whether gratis
|
|
||||||
or for a fee, you must give the recipients all the rights that we gave
|
|
||||||
you. You must make sure that they, too, receive or can get the source
|
|
||||||
code. If you link other code with the library, you must provide
|
|
||||||
complete object files to the recipients, so that they can relink them
|
|
||||||
with the library after making changes to the library and recompiling
|
|
||||||
it. And you must show them these terms so they know their rights.
|
|
||||||
|
|
||||||
We protect your rights with a two-step method: (1) we copyright the
|
|
||||||
library, and (2) we offer you this license, which gives you legal
|
|
||||||
permission to copy, distribute and/or modify the library.
|
|
||||||
|
|
||||||
To protect each distributor, we want to make it very clear that
|
|
||||||
there is no warranty for the free library. Also, if the library is
|
|
||||||
modified by someone else and passed on, the recipients should know
|
|
||||||
that what they have is not the original version, so that the original
|
|
||||||
author's reputation will not be affected by problems that might be
|
|
||||||
introduced by others.
|
|
||||||
^L
|
|
||||||
Finally, software patents pose a constant threat to the existence of
|
|
||||||
any free program. We wish to make sure that a company cannot
|
|
||||||
effectively restrict the users of a free program by obtaining a
|
|
||||||
restrictive license from a patent holder. Therefore, we insist that
|
|
||||||
any patent license obtained for a version of the library must be
|
|
||||||
consistent with the full freedom of use specified in this license.
|
|
||||||
|
|
||||||
Most GNU software, including some libraries, is covered by the
|
|
||||||
ordinary GNU General Public License. This license, the GNU Lesser
|
|
||||||
General Public License, applies to certain designated libraries, and
|
|
||||||
is quite different from the ordinary General Public License. We use
|
|
||||||
this license for certain libraries in order to permit linking those
|
|
||||||
libraries into non-free programs.
|
|
||||||
|
|
||||||
When a program is linked with a library, whether statically or using
|
|
||||||
a shared library, the combination of the two is legally speaking a
|
|
||||||
combined work, a derivative of the original library. The ordinary
|
|
||||||
General Public License therefore permits such linking only if the
|
|
||||||
entire combination fits its criteria of freedom. The Lesser General
|
|
||||||
Public License permits more lax criteria for linking other code with
|
|
||||||
the library.
|
|
||||||
|
|
||||||
We call this license the "Lesser" General Public License because it
|
|
||||||
does Less to protect the user's freedom than the ordinary General
|
|
||||||
Public License. It also provides other free software developers Less
|
|
||||||
of an advantage over competing non-free programs. These disadvantages
|
|
||||||
are the reason we use the ordinary General Public License for many
|
|
||||||
libraries. However, the Lesser license provides advantages in certain
|
|
||||||
special circumstances.
|
|
||||||
|
|
||||||
For example, on rare occasions, there may be a special need to
|
|
||||||
encourage the widest possible use of a certain library, so that it
|
|
||||||
becomes
|
|
||||||
a de-facto standard. To achieve this, non-free programs must be
|
|
||||||
allowed to use the library. A more frequent case is that a free
|
|
||||||
library does the same job as widely used non-free libraries. In this
|
|
||||||
case, there is little to gain by limiting the free library to free
|
|
||||||
software only, so we use the Lesser General Public License.
|
|
||||||
|
|
||||||
In other cases, permission to use a particular library in non-free
|
|
||||||
programs enables a greater number of people to use a large body of
|
|
||||||
free software. For example, permission to use the GNU C Library in
|
|
||||||
non-free programs enables many more people to use the whole GNU
|
|
||||||
operating system, as well as its variant, the GNU/Linux operating
|
|
||||||
system.
|
|
||||||
|
|
||||||
Although the Lesser General Public License is Less protective of the
|
|
||||||
users' freedom, it does ensure that the user of a program that is
|
|
||||||
linked with the Library has the freedom and the wherewithal to run
|
|
||||||
that program using a modified version of the Library.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow. Pay close attention to the difference between a
|
|
||||||
"work based on the library" and a "work that uses the library". The
|
|
||||||
former contains code derived from the library, whereas the latter must
|
|
||||||
be combined with the library in order to run.
|
|
||||||
^L
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
||||||
|
|
||||||
0. This License Agreement applies to any software library or other
|
|
||||||
program which contains a notice placed by the copyright holder or
|
|
||||||
other authorized party saying it may be distributed under the terms of
|
|
||||||
this Lesser General Public License (also called "this License").
|
|
||||||
Each licensee is addressed as "you".
|
|
||||||
|
|
||||||
A "library" means a collection of software functions and/or data
|
|
||||||
prepared so as to be conveniently linked with application programs
|
|
||||||
(which use some of those functions and data) to form executables.
|
|
||||||
|
|
||||||
The "Library", below, refers to any such software library or work
|
|
||||||
which has been distributed under these terms. A "work based on the
|
|
||||||
Library" means either the Library or any derivative work under
|
|
||||||
copyright law: that is to say, a work containing the Library or a
|
|
||||||
portion of it, either verbatim or with modifications and/or translated
|
|
||||||
straightforwardly into another language. (Hereinafter, translation is
|
|
||||||
included without limitation in the term "modification".)
|
|
||||||
|
|
||||||
"Source code" for a work means the preferred form of the work for
|
|
||||||
making modifications to it. For a library, complete source code means
|
|
||||||
all the source code for all modules it contains, plus any associated
|
|
||||||
interface definition files, plus the scripts used to control
|
|
||||||
compilation
|
|
||||||
and installation of the library.
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not
|
|
||||||
covered by this License; they are outside its scope. The act of
|
|
||||||
running a program using the Library is not restricted, and output from
|
|
||||||
such a program is covered only if its contents constitute a work based
|
|
||||||
on the Library (independent of the use of the Library in a tool for
|
|
||||||
writing it). Whether that is true depends on what the Library does
|
|
||||||
and what the program that uses the Library does.
|
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Library's
|
|
||||||
complete source code as you receive it, in any medium, provided that
|
|
||||||
you conspicuously and appropriately publish on each copy an
|
|
||||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
|
||||||
all the notices that refer to this License and to the absence of any
|
|
||||||
warranty; and distribute a copy of this License along with the
|
|
||||||
Library.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy,
|
|
||||||
and you may at your option offer warranty protection in exchange for a
|
|
||||||
fee.
|
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Library or any portion
|
|
||||||
of it, thus forming a work based on the Library, and copy and
|
|
||||||
distribute such modifications or work under the terms of Section 1
|
|
||||||
above, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The modified work must itself be a software library.
|
|
||||||
|
|
||||||
b) You must cause the files modified to carry prominent notices
|
|
||||||
stating that you changed the files and the date of any change.
|
|
||||||
|
|
||||||
c) You must cause the whole of the work to be licensed at no
|
|
||||||
charge to all third parties under the terms of this License.
|
|
||||||
|
|
||||||
d) If a facility in the modified Library refers to a function or a
|
|
||||||
table of data to be supplied by an application program that uses
|
|
||||||
the facility, other than as an argument passed when the facility
|
|
||||||
is invoked, then you must make a good faith effort to ensure that,
|
|
||||||
in the event an application does not supply such function or
|
|
||||||
table, the facility still operates, and performs whatever part of
|
|
||||||
its purpose remains meaningful.
|
|
||||||
|
|
||||||
(For example, a function in a library to compute square roots has
|
|
||||||
a purpose that is entirely well-defined independent of the
|
|
||||||
application. Therefore, Subsection 2d requires that any
|
|
||||||
application-supplied function or table used by this function must
|
|
||||||
be optional: if the application does not supply it, the square
|
|
||||||
root function must still compute square roots.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
|
||||||
identifiable sections of that work are not derived from the Library,
|
|
||||||
and can be reasonably considered independent and separate works in
|
|
||||||
themselves, then this License, and its terms, do not apply to those
|
|
||||||
sections when you distribute them as separate works. But when you
|
|
||||||
distribute the same sections as part of a whole which is a work based
|
|
||||||
on the Library, the distribution of the whole must be on the terms of
|
|
||||||
this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote
|
|
||||||
it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest
|
|
||||||
your rights to work written entirely by you; rather, the intent is to
|
|
||||||
exercise the right to control the distribution of derivative or
|
|
||||||
collective works based on the Library.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Library
|
|
||||||
with the Library (or with a work based on the Library) on a volume of
|
|
||||||
a storage or distribution medium does not bring the other work under
|
|
||||||
the scope of this License.
|
|
||||||
|
|
||||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
|
||||||
License instead of this License to a given copy of the Library. To do
|
|
||||||
this, you must alter all the notices that refer to this License, so
|
|
||||||
that they refer to the ordinary GNU General Public License, version 2,
|
|
||||||
instead of to this License. (If a newer version than version 2 of the
|
|
||||||
ordinary GNU General Public License has appeared, then you can specify
|
|
||||||
that version instead if you wish.) Do not make any other change in
|
|
||||||
these notices.
|
|
||||||
^L
|
|
||||||
Once this change is made in a given copy, it is irreversible for
|
|
||||||
that copy, so the ordinary GNU General Public License applies to all
|
|
||||||
subsequent copies and derivative works made from that copy.
|
|
||||||
|
|
||||||
This option is useful when you wish to copy part of the code of
|
|
||||||
the Library into a program that is not a library.
|
|
||||||
|
|
||||||
4. You may copy and distribute the Library (or a portion or
|
|
||||||
derivative of it, under Section 2) in object code or executable form
|
|
||||||
under the terms of Sections 1 and 2 above provided that you accompany
|
|
||||||
it with the complete corresponding machine-readable source code, which
|
|
||||||
must be distributed under the terms of Sections 1 and 2 above on a
|
|
||||||
medium customarily used for software interchange.
|
|
||||||
|
|
||||||
If distribution of object code is made by offering access to copy
|
|
||||||
from a designated place, then offering equivalent access to copy the
|
|
||||||
source code from the same place satisfies the requirement to
|
|
||||||
distribute the source code, even though third parties are not
|
|
||||||
compelled to copy the source along with the object code.
|
|
||||||
|
|
||||||
5. A program that contains no derivative of any portion of the
|
|
||||||
Library, but is designed to work with the Library by being compiled or
|
|
||||||
linked with it, is called a "work that uses the Library". Such a
|
|
||||||
work, in isolation, is not a derivative work of the Library, and
|
|
||||||
therefore falls outside the scope of this License.
|
|
||||||
|
|
||||||
However, linking a "work that uses the Library" with the Library
|
|
||||||
creates an executable that is a derivative of the Library (because it
|
|
||||||
contains portions of the Library), rather than a "work that uses the
|
|
||||||
library". The executable is therefore covered by this License.
|
|
||||||
Section 6 states terms for distribution of such executables.
|
|
||||||
|
|
||||||
When a "work that uses the Library" uses material from a header file
|
|
||||||
that is part of the Library, the object code for the work may be a
|
|
||||||
derivative work of the Library even though the source code is not.
|
|
||||||
Whether this is true is especially significant if the work can be
|
|
||||||
linked without the Library, or if the work is itself a library. The
|
|
||||||
threshold for this to be true is not precisely defined by law.
|
|
||||||
|
|
||||||
If such an object file uses only numerical parameters, data
|
|
||||||
structure layouts and accessors, and small macros and small inline
|
|
||||||
functions (ten lines or less in length), then the use of the object
|
|
||||||
file is unrestricted, regardless of whether it is legally a derivative
|
|
||||||
work. (Executables containing this object code plus portions of the
|
|
||||||
Library will still fall under Section 6.)
|
|
||||||
|
|
||||||
Otherwise, if the work is a derivative of the Library, you may
|
|
||||||
distribute the object code for the work under the terms of Section 6.
|
|
||||||
Any executables containing that work also fall under Section 6,
|
|
||||||
whether or not they are linked directly with the Library itself.
|
|
||||||
^L
|
|
||||||
6. As an exception to the Sections above, you may also combine or
|
|
||||||
link a "work that uses the Library" with the Library to produce a
|
|
||||||
work containing portions of the Library, and distribute that work
|
|
||||||
under terms of your choice, provided that the terms permit
|
|
||||||
modification of the work for the customer's own use and reverse
|
|
||||||
engineering for debugging such modifications.
|
|
||||||
|
|
||||||
You must give prominent notice with each copy of the work that the
|
|
||||||
Library is used in it and that the Library and its use are covered by
|
|
||||||
this License. You must supply a copy of this License. If the work
|
|
||||||
during execution displays copyright notices, you must include the
|
|
||||||
copyright notice for the Library among them, as well as a reference
|
|
||||||
directing the user to the copy of this License. Also, you must do one
|
|
||||||
of these things:
|
|
||||||
|
|
||||||
a) Accompany the work with the complete corresponding
|
|
||||||
machine-readable source code for the Library including whatever
|
|
||||||
changes were used in the work (which must be distributed under
|
|
||||||
Sections 1 and 2 above); and, if the work is an executable linked
|
|
||||||
with the Library, with the complete machine-readable "work that
|
|
||||||
uses the Library", as object code and/or source code, so that the
|
|
||||||
user can modify the Library and then relink to produce a modified
|
|
||||||
executable containing the modified Library. (It is understood
|
|
||||||
that the user who changes the contents of definitions files in the
|
|
||||||
Library will not necessarily be able to recompile the application
|
|
||||||
to use the modified definitions.)
|
|
||||||
|
|
||||||
b) Use a suitable shared library mechanism for linking with the
|
|
||||||
Library. A suitable mechanism is one that (1) uses at run time a
|
|
||||||
copy of the library already present on the user's computer system,
|
|
||||||
rather than copying library functions into the executable, and (2)
|
|
||||||
will operate properly with a modified version of the library, if
|
|
||||||
the user installs one, as long as the modified version is
|
|
||||||
interface-compatible with the version that the work was made with.
|
|
||||||
|
|
||||||
c) Accompany the work with a written offer, valid for at
|
|
||||||
least three years, to give the same user the materials
|
|
||||||
specified in Subsection 6a, above, for a charge no more
|
|
||||||
than the cost of performing this distribution.
|
|
||||||
|
|
||||||
d) If distribution of the work is made by offering access to copy
|
|
||||||
from a designated place, offer equivalent access to copy the above
|
|
||||||
specified materials from the same place.
|
|
||||||
|
|
||||||
e) Verify that the user has already received a copy of these
|
|
||||||
materials or that you have already sent this user a copy.
|
|
||||||
|
|
||||||
For an executable, the required form of the "work that uses the
|
|
||||||
Library" must include any data and utility programs needed for
|
|
||||||
reproducing the executable from it. However, as a special exception,
|
|
||||||
the materials to be distributed need not include anything that is
|
|
||||||
normally distributed (in either source or binary form) with the major
|
|
||||||
components (compiler, kernel, and so on) of the operating system on
|
|
||||||
which the executable runs, unless that component itself accompanies
|
|
||||||
the executable.
|
|
||||||
|
|
||||||
It may happen that this requirement contradicts the license
|
|
||||||
restrictions of other proprietary libraries that do not normally
|
|
||||||
accompany the operating system. Such a contradiction means you cannot
|
|
||||||
use both them and the Library together in an executable that you
|
|
||||||
distribute.
|
|
||||||
^L
|
|
||||||
7. You may place library facilities that are a work based on the
|
|
||||||
Library side-by-side in a single library together with other library
|
|
||||||
facilities not covered by this License, and distribute such a combined
|
|
||||||
library, provided that the separate distribution of the work based on
|
|
||||||
the Library and of the other library facilities is otherwise
|
|
||||||
permitted, and provided that you do these two things:
|
|
||||||
|
|
||||||
a) Accompany the combined library with a copy of the same work
|
|
||||||
based on the Library, uncombined with any other library
|
|
||||||
facilities. This must be distributed under the terms of the
|
|
||||||
Sections above.
|
|
||||||
|
|
||||||
b) Give prominent notice with the combined library of the fact
|
|
||||||
that part of it is a work based on the Library, and explaining
|
|
||||||
where to find the accompanying uncombined form of the same work.
|
|
||||||
|
|
||||||
8. You may not copy, modify, sublicense, link with, or distribute
|
|
||||||
the Library except as expressly provided under this License. Any
|
|
||||||
attempt otherwise to copy, modify, sublicense, link with, or
|
|
||||||
distribute the Library is void, and will automatically terminate your
|
|
||||||
rights under this License. However, parties who have received copies,
|
|
||||||
or rights, from you under this License will not have their licenses
|
|
||||||
terminated so long as such parties remain in full compliance.
|
|
||||||
|
|
||||||
9. You are not required to accept this License, since you have not
|
|
||||||
signed it. However, nothing else grants you permission to modify or
|
|
||||||
distribute the Library or its derivative works. These actions are
|
|
||||||
prohibited by law if you do not accept this License. Therefore, by
|
|
||||||
modifying or distributing the Library (or any work based on the
|
|
||||||
Library), you indicate your acceptance of this License to do so, and
|
|
||||||
all its terms and conditions for copying, distributing or modifying
|
|
||||||
the Library or works based on it.
|
|
||||||
|
|
||||||
10. Each time you redistribute the Library (or any work based on the
|
|
||||||
Library), the recipient automatically receives a license from the
|
|
||||||
original licensor to copy, distribute, link with or modify the Library
|
|
||||||
subject to these terms and conditions. You may not impose any further
|
|
||||||
restrictions on the recipients' exercise of the rights granted herein.
|
|
||||||
You are not responsible for enforcing compliance by third parties with
|
|
||||||
this License.
|
|
||||||
^L
|
|
||||||
11. If, as a consequence of a court judgment or allegation of patent
|
|
||||||
infringement or for any other reason (not limited to patent issues),
|
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot
|
|
||||||
distribute so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you
|
|
||||||
may not distribute the Library at all. For example, if a patent
|
|
||||||
license would not permit royalty-free redistribution of the Library by
|
|
||||||
all those who receive copies directly or indirectly through you, then
|
|
||||||
the only way you could satisfy both it and this License would be to
|
|
||||||
refrain entirely from distribution of the Library.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under
|
|
||||||
any particular circumstance, the balance of the section is intended to
|
|
||||||
apply, and the section as a whole is intended to apply in other
|
|
||||||
circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any
|
|
||||||
patents or other property right claims or to contest validity of any
|
|
||||||
such claims; this section has the sole purpose of protecting the
|
|
||||||
integrity of the free software distribution system which is
|
|
||||||
implemented by public license practices. Many people have made
|
|
||||||
generous contributions to the wide range of software distributed
|
|
||||||
through that system in reliance on consistent application of that
|
|
||||||
system; it is up to the author/donor to decide if he or she is willing
|
|
||||||
to distribute software through any other system and a licensee cannot
|
|
||||||
impose that choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
|
||||||
be a consequence of the rest of this License.
|
|
||||||
|
|
||||||
12. If the distribution and/or use of the Library is restricted in
|
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
|
||||||
original copyright holder who places the Library under this License
|
|
||||||
may add an explicit geographical distribution limitation excluding those
|
|
||||||
countries, so that distribution is permitted only in or among
|
|
||||||
countries not thus excluded. In such case, this License incorporates
|
|
||||||
the limitation as if written in the body of this License.
|
|
||||||
|
|
||||||
13. The Free Software Foundation may publish revised and/or new
|
|
||||||
versions of the Lesser 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 Library
|
|
||||||
specifies a version number of this License which applies to it and
|
|
||||||
"any later version", you have the option of following the terms and
|
|
||||||
conditions either of that version or of any later version published by
|
|
||||||
the Free Software Foundation. If the Library does not specify a
|
|
||||||
license version number, you may choose any version ever published by
|
|
||||||
the Free Software Foundation.
|
|
||||||
^L
|
|
||||||
14. If you wish to incorporate parts of the Library into other free
|
|
||||||
programs whose distribution conditions are incompatible with these,
|
|
||||||
write to the author to ask for permission. For software which is
|
|
||||||
copyrighted by the Free Software Foundation, write to the Free
|
|
||||||
Software Foundation; we sometimes make exceptions for this. Our
|
|
||||||
decision will be guided by the two goals of preserving the free status
|
|
||||||
of all derivatives of our free software and of promoting the sharing
|
|
||||||
and reuse of software generally.
|
|
||||||
|
|
||||||
NO WARRANTY
|
|
||||||
|
|
||||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
|
||||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
|
||||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
|
||||||
OTHER PARTIES PROVIDE THE LIBRARY "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
|
|
||||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
|
||||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
|
||||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
|
||||||
AND/OR REDISTRIBUTE THE LIBRARY 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
|
|
||||||
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
|
||||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
||||||
DAMAGES.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
^L
|
|
||||||
How to Apply These Terms to Your New Libraries
|
|
||||||
|
|
||||||
If you develop a new library, and you want it to be of the greatest
|
|
||||||
possible use to the public, we recommend making it free software that
|
|
||||||
everyone can redistribute and change. You can do so by permitting
|
|
||||||
redistribution under these terms (or, alternatively, under the terms
|
|
||||||
of the ordinary General Public License).
|
|
||||||
|
|
||||||
To apply these terms, attach the following notices to the library.
|
|
||||||
It is safest to attach them to the start of each source file to most
|
|
||||||
effectively convey the exclusion of warranty; and each file should
|
|
||||||
have at least the "copyright" line and a pointer to where the full
|
|
||||||
notice is found.
|
|
||||||
|
|
||||||
|
|
||||||
<one line to give the library's name and a brief idea of what it
|
|
||||||
does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper
|
|
||||||
mail.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or
|
|
||||||
your
|
|
||||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
|
||||||
necessary. Here is a sample; alter the names:
|
|
||||||
|
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
|
||||||
library `Frob' (a library for tweaking knobs) written by James
|
|
||||||
Random Hacker.
|
|
||||||
|
|
||||||
<signature of Ty Coon>, 1 April 1990
|
|
||||||
Ty Coon, President of Vice
|
|
||||||
|
|
||||||
That's all there is to it!
|
|
||||||
|
|
||||||
|
|
|
@ -1,470 +0,0 @@
|
||||||
MOZILLA PUBLIC LICENSE
|
|
||||||
Version 1.1
|
|
||||||
|
|
||||||
---------------
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
1.0.1. "Commercial Use" means distribution or otherwise making the
|
|
||||||
Covered Code available to a third party.
|
|
||||||
|
|
||||||
1.1. "Contributor" means each entity that creates or contributes to
|
|
||||||
the creation of Modifications.
|
|
||||||
|
|
||||||
1.2. "Contributor Version" means the combination of the Original
|
|
||||||
Code, prior Modifications used by a Contributor, and the Modifications
|
|
||||||
made by that particular Contributor.
|
|
||||||
|
|
||||||
1.3. "Covered Code" means the Original Code or Modifications or the
|
|
||||||
combination of the Original Code and Modifications, in each case
|
|
||||||
including portions thereof.
|
|
||||||
|
|
||||||
1.4. "Electronic Distribution Mechanism" means a mechanism generally
|
|
||||||
accepted in the software development community for the electronic
|
|
||||||
transfer of data.
|
|
||||||
|
|
||||||
1.5. "Executable" means Covered Code in any form other than Source
|
|
||||||
Code.
|
|
||||||
|
|
||||||
1.6. "Initial Developer" means the individual or entity identified
|
|
||||||
as the Initial Developer in the Source Code notice required by Exhibit
|
|
||||||
A.
|
|
||||||
|
|
||||||
1.7. "Larger Work" means a work which combines Covered Code or
|
|
||||||
portions thereof with code not governed by the terms of this License.
|
|
||||||
|
|
||||||
1.8. "License" means this document.
|
|
||||||
|
|
||||||
1.8.1. "Licensable" means having the right to grant, to the maximum
|
|
||||||
extent possible, whether at the time of the initial grant or
|
|
||||||
subsequently acquired, any and all of the rights conveyed herein.
|
|
||||||
|
|
||||||
1.9. "Modifications" means any addition to or deletion from the
|
|
||||||
substance or structure of either the Original Code or any previous
|
|
||||||
Modifications. When Covered Code is released as a series of files, a
|
|
||||||
Modification is:
|
|
||||||
A. Any addition to or deletion from the contents of a file
|
|
||||||
containing Original Code or previous Modifications.
|
|
||||||
|
|
||||||
B. Any new file that contains any part of the Original Code or
|
|
||||||
previous Modifications.
|
|
||||||
|
|
||||||
1.10. "Original Code" means Source Code of computer software code
|
|
||||||
which is described in the Source Code notice required by Exhibit A as
|
|
||||||
Original Code, and which, at the time of its release under this
|
|
||||||
License is not already Covered Code governed by this License.
|
|
||||||
|
|
||||||
1.10.1. "Patent Claims" means any patent claim(s), now owned or
|
|
||||||
hereafter acquired, including without limitation, method, process,
|
|
||||||
and apparatus claims, in any patent Licensable by grantor.
|
|
||||||
|
|
||||||
1.11. "Source Code" means the preferred form of the Covered Code for
|
|
||||||
making modifications to it, including all modules it contains, plus
|
|
||||||
any associated interface definition files, scripts used to control
|
|
||||||
compilation and installation of an Executable, or source code
|
|
||||||
differential comparisons against either the Original Code or another
|
|
||||||
well known, available Covered Code of the Contributor's choice. The
|
|
||||||
Source Code can be in a compressed or archival form, provided the
|
|
||||||
appropriate decompression or de-archiving software is widely available
|
|
||||||
for no charge.
|
|
||||||
|
|
||||||
1.12. "You" (or "Your") means an individual or a legal entity
|
|
||||||
exercising rights under, and complying with all of the terms of, this
|
|
||||||
License or a future version of this License issued under Section 6.1.
|
|
||||||
For legal entities, "You" includes any entity which controls, is
|
|
||||||
controlled by, or is under common control with You. For purposes of
|
|
||||||
this definition, "control" means (a) the power, direct or indirect,
|
|
||||||
to cause the direction or management of such entity, whether by
|
|
||||||
contract or otherwise, or (b) ownership of more than fifty percent
|
|
||||||
(50%) of the outstanding shares or beneficial ownership of such
|
|
||||||
entity.
|
|
||||||
|
|
||||||
2. Source Code License.
|
|
||||||
|
|
||||||
2.1. The Initial Developer Grant.
|
|
||||||
The Initial Developer hereby grants You a world-wide, royalty-free,
|
|
||||||
non-exclusive license, subject to third party intellectual property
|
|
||||||
claims:
|
|
||||||
(a) under intellectual property rights (other than patent or
|
|
||||||
trademark) Licensable by Initial Developer to use, reproduce,
|
|
||||||
modify, display, perform, sublicense and distribute the Original
|
|
||||||
Code (or portions thereof) with or without Modifications, and/or
|
|
||||||
as part of a Larger Work; and
|
|
||||||
|
|
||||||
(b) under Patents Claims infringed by the making, using or
|
|
||||||
selling of Original Code, to make, have made, use, practice,
|
|
||||||
sell, and offer for sale, and/or otherwise dispose of the
|
|
||||||
Original Code (or portions thereof).
|
|
||||||
|
|
||||||
(c) the licenses granted in this Section 2.1(a) and (b) are
|
|
||||||
effective on the date Initial Developer first distributes
|
|
||||||
Original Code under the terms of this License.
|
|
||||||
|
|
||||||
(d) Notwithstanding Section 2.1(b) above, no patent license is
|
|
||||||
granted: 1) for code that You delete from the Original Code; 2)
|
|
||||||
separate from the Original Code; or 3) for infringements caused
|
|
||||||
by: i) the modification of the Original Code or ii) the
|
|
||||||
combination of the Original Code with other software or devices.
|
|
||||||
|
|
||||||
2.2. Contributor Grant.
|
|
||||||
Subject to third party intellectual property claims, each Contributor
|
|
||||||
hereby grants You a world-wide, royalty-free, non-exclusive license
|
|
||||||
|
|
||||||
(a) under intellectual property rights (other than patent or
|
|
||||||
trademark) Licensable by Contributor, to use, reproduce, modify,
|
|
||||||
display, perform, sublicense and distribute the Modifications
|
|
||||||
created by such Contributor (or portions thereof) either on an
|
|
||||||
unmodified basis, with other Modifications, as Covered Code
|
|
||||||
and/or as part of a Larger Work; and
|
|
||||||
|
|
||||||
(b) under Patent Claims infringed by the making, using, or
|
|
||||||
selling of Modifications made by that Contributor either alone
|
|
||||||
and/or in combination with its Contributor Version (or portions
|
|
||||||
of such combination), to make, use, sell, offer for sale, have
|
|
||||||
made, and/or otherwise dispose of: 1) Modifications made by that
|
|
||||||
Contributor (or portions thereof); and 2) the combination of
|
|
||||||
Modifications made by that Contributor with its Contributor
|
|
||||||
Version (or portions of such combination).
|
|
||||||
|
|
||||||
(c) the licenses granted in Sections 2.2(a) and 2.2(b) are
|
|
||||||
effective on the date Contributor first makes Commercial Use of
|
|
||||||
the Covered Code.
|
|
||||||
|
|
||||||
(d) Notwithstanding Section 2.2(b) above, no patent license is
|
|
||||||
granted: 1) for any code that Contributor has deleted from the
|
|
||||||
Contributor Version; 2) separate from the Contributor Version;
|
|
||||||
3) for infringements caused by: i) third party modifications of
|
|
||||||
Contributor Version or ii) the combination of Modifications made
|
|
||||||
by that Contributor with other software (except as part of the
|
|
||||||
Contributor Version) or other devices; or 4) under Patent Claims
|
|
||||||
infringed by Covered Code in the absence of Modifications made by
|
|
||||||
that Contributor.
|
|
||||||
|
|
||||||
3. Distribution Obligations.
|
|
||||||
|
|
||||||
3.1. Application of License.
|
|
||||||
The Modifications which You create or to which You contribute are
|
|
||||||
governed by the terms of this License, including without limitation
|
|
||||||
Section 2.2. The Source Code version of Covered Code may be
|
|
||||||
distributed only under the terms of this License or a future version
|
|
||||||
of this License released under Section 6.1, and You must include a
|
|
||||||
copy of this License with every copy of the Source Code You
|
|
||||||
distribute. You may not offer or impose any terms on any Source Code
|
|
||||||
version that alters or restricts the applicable version of this
|
|
||||||
License or the recipients' rights hereunder. However, You may include
|
|
||||||
an additional document offering the additional rights described in
|
|
||||||
Section 3.5.
|
|
||||||
|
|
||||||
3.2. Availability of Source Code.
|
|
||||||
Any Modification which You create or to which You contribute must be
|
|
||||||
made available in Source Code form under the terms of this License
|
|
||||||
either on the same media as an Executable version or via an accepted
|
|
||||||
Electronic Distribution Mechanism to anyone to whom you made an
|
|
||||||
Executable version available; and if made available via Electronic
|
|
||||||
Distribution Mechanism, must remain available for at least twelve (12)
|
|
||||||
months after the date it initially became available, or at least six
|
|
||||||
(6) months after a subsequent version of that particular Modification
|
|
||||||
has been made available to such recipients. You are responsible for
|
|
||||||
ensuring that the Source Code version remains available even if the
|
|
||||||
Electronic Distribution Mechanism is maintained by a third party.
|
|
||||||
|
|
||||||
3.3. Description of Modifications.
|
|
||||||
You must cause all Covered Code to which You contribute to contain a
|
|
||||||
file documenting the changes You made to create that Covered Code and
|
|
||||||
the date of any change. You must include a prominent statement that
|
|
||||||
the Modification is derived, directly or indirectly, from Original
|
|
||||||
Code provided by the Initial Developer and including the name of the
|
|
||||||
Initial Developer in (a) the Source Code, and (b) in any notice in an
|
|
||||||
Executable version or related documentation in which You describe the
|
|
||||||
origin or ownership of the Covered Code.
|
|
||||||
|
|
||||||
3.4. Intellectual Property Matters
|
|
||||||
(a) Third Party Claims.
|
|
||||||
If Contributor has knowledge that a license under a third party's
|
|
||||||
intellectual property rights is required to exercise the rights
|
|
||||||
granted by such Contributor under Sections 2.1 or 2.2,
|
|
||||||
Contributor must include a text file with the Source Code
|
|
||||||
distribution titled "LEGAL" which describes the claim and the
|
|
||||||
party making the claim in sufficient detail that a recipient will
|
|
||||||
know whom to contact. If Contributor obtains such knowledge after
|
|
||||||
the Modification is made available as described in Section 3.2,
|
|
||||||
Contributor shall promptly modify the LEGAL file in all copies
|
|
||||||
Contributor makes available thereafter and shall take other steps
|
|
||||||
(such as notifying appropriate mailing lists or newsgroups)
|
|
||||||
reasonably calculated to inform those who received the Covered
|
|
||||||
Code that new knowledge has been obtained.
|
|
||||||
|
|
||||||
(b) Contributor APIs.
|
|
||||||
If Contributor's Modifications include an application programming
|
|
||||||
interface and Contributor has knowledge of patent licenses which
|
|
||||||
are reasonably necessary to implement that API, Contributor must
|
|
||||||
also include this information in the LEGAL file.
|
|
||||||
|
|
||||||
(c) Representations.
|
|
||||||
Contributor represents that, except as disclosed pursuant to
|
|
||||||
Section 3.4(a) above, Contributor believes that Contributor's
|
|
||||||
Modifications are Contributor's original creation(s) and/or
|
|
||||||
Contributor has sufficient rights to grant the rights conveyed by
|
|
||||||
this License.
|
|
||||||
|
|
||||||
3.5. Required Notices.
|
|
||||||
You must duplicate the notice in Exhibit A in each file of the Source
|
|
||||||
Code. If it is not possible to put such notice in a particular Source
|
|
||||||
Code file due to its structure, then You must include such notice in a
|
|
||||||
location (such as a relevant directory) where a user would be likely
|
|
||||||
to look for such a notice. If You created one or more Modification(s)
|
|
||||||
You may add your name as a Contributor to the notice described in
|
|
||||||
Exhibit A. You must also duplicate this License in any documentation
|
|
||||||
for the Source Code where You describe recipients' rights or ownership
|
|
||||||
rights relating to Covered Code. You may choose to offer, and to
|
|
||||||
charge a fee for, warranty, support, indemnity or liability
|
|
||||||
obligations to one or more recipients of Covered Code. However, You
|
|
||||||
may do so only on Your own behalf, and not on behalf of the Initial
|
|
||||||
Developer or any Contributor. You must make it absolutely clear than
|
|
||||||
any such warranty, support, indemnity or liability obligation is
|
|
||||||
offered by You alone, and You hereby agree to indemnify the Initial
|
|
||||||
Developer and every Contributor for any liability incurred by the
|
|
||||||
Initial Developer or such Contributor as a result of warranty,
|
|
||||||
support, indemnity or liability terms You offer.
|
|
||||||
|
|
||||||
3.6. Distribution of Executable Versions.
|
|
||||||
You may distribute Covered Code in Executable form only if the
|
|
||||||
requirements of Section 3.1-3.5 have been met for that Covered Code,
|
|
||||||
and if You include a notice stating that the Source Code version of
|
|
||||||
the Covered Code is available under the terms of this License,
|
|
||||||
including a description of how and where You have fulfilled the
|
|
||||||
obligations of Section 3.2. The notice must be conspicuously included
|
|
||||||
in any notice in an Executable version, related documentation or
|
|
||||||
collateral in which You describe recipients' rights relating to the
|
|
||||||
Covered Code. You may distribute the Executable version of Covered
|
|
||||||
Code or ownership rights under a license of Your choice, which may
|
|
||||||
contain terms different from this License, provided that You are in
|
|
||||||
compliance with the terms of this License and that the license for the
|
|
||||||
Executable version does not attempt to limit or alter the recipient's
|
|
||||||
rights in the Source Code version from the rights set forth in this
|
|
||||||
License. If You distribute the Executable version under a different
|
|
||||||
license You must make it absolutely clear that any terms which differ
|
|
||||||
from this License are offered by You alone, not by the Initial
|
|
||||||
Developer or any Contributor. You hereby agree to indemnify the
|
|
||||||
Initial Developer and every Contributor for any liability incurred by
|
|
||||||
the Initial Developer or such Contributor as a result of any such
|
|
||||||
terms You offer.
|
|
||||||
|
|
||||||
3.7. Larger Works.
|
|
||||||
You may create a Larger Work by combining Covered Code with other code
|
|
||||||
not governed by the terms of this License and distribute the Larger
|
|
||||||
Work as a single product. In such a case, You must make sure the
|
|
||||||
requirements of this License are fulfilled for the Covered Code.
|
|
||||||
|
|
||||||
4. Inability to Comply Due to Statute or Regulation.
|
|
||||||
|
|
||||||
If it is impossible for You to comply with any of the terms of this
|
|
||||||
License with respect to some or all of the Covered Code due to
|
|
||||||
statute, judicial order, or regulation then You must: (a) comply with
|
|
||||||
the terms of this License to the maximum extent possible; and (b)
|
|
||||||
describe the limitations and the code they affect. Such description
|
|
||||||
must be included in the LEGAL file described in Section 3.4 and must
|
|
||||||
be included with all distributions of the Source Code. Except to the
|
|
||||||
extent prohibited by statute or regulation, such description must be
|
|
||||||
sufficiently detailed for a recipient of ordinary skill to be able to
|
|
||||||
understand it.
|
|
||||||
|
|
||||||
5. Application of this License.
|
|
||||||
|
|
||||||
This License applies to code to which the Initial Developer has
|
|
||||||
attached the notice in Exhibit A and to related Covered Code.
|
|
||||||
|
|
||||||
6. Versions of the License.
|
|
||||||
|
|
||||||
6.1. New Versions.
|
|
||||||
Netscape Communications Corporation ("Netscape") may publish revised
|
|
||||||
and/or new versions of the License from time to time. Each version
|
|
||||||
will be given a distinguishing version number.
|
|
||||||
|
|
||||||
6.2. Effect of New Versions.
|
|
||||||
Once Covered Code has been published under a particular version of the
|
|
||||||
License, You may always continue to use it under the terms of that
|
|
||||||
version. You may also choose to use such Covered Code under the terms
|
|
||||||
of any subsequent version of the License published by Netscape. No one
|
|
||||||
other than Netscape has the right to modify the terms applicable to
|
|
||||||
Covered Code created under this License.
|
|
||||||
|
|
||||||
6.3. Derivative Works.
|
|
||||||
If You create or use a modified version of this License (which you may
|
|
||||||
only do in order to apply it to code which is not already Covered Code
|
|
||||||
governed by this License), You must (a) rename Your license so that
|
|
||||||
the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
|
|
||||||
"MPL", "NPL" or any confusingly similar phrase do not appear in your
|
|
||||||
license (except to note that your license differs from this License)
|
|
||||||
and (b) otherwise make it clear that Your version of the license
|
|
||||||
contains terms which differ from the Mozilla Public License and
|
|
||||||
Netscape Public License. (Filling in the name of the Initial
|
|
||||||
Developer, Original Code or Contributor in the notice described in
|
|
||||||
Exhibit A shall not of themselves be deemed to be modifications of
|
|
||||||
this License.)
|
|
||||||
|
|
||||||
7. DISCLAIMER OF WARRANTY.
|
|
||||||
|
|
||||||
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
|
||||||
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
|
|
||||||
DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
|
|
||||||
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
|
|
||||||
IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
|
|
||||||
YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
|
|
||||||
COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
|
|
||||||
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
|
|
||||||
ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
|
|
||||||
|
|
||||||
8. TERMINATION.
|
|
||||||
|
|
||||||
8.1. This License and the rights granted hereunder will terminate
|
|
||||||
automatically if You fail to comply with terms herein and fail to cure
|
|
||||||
such breach within 30 days of becoming aware of the breach. All
|
|
||||||
sublicenses to the Covered Code which are properly granted shall
|
|
||||||
survive any termination of this License. Provisions which, by their
|
|
||||||
nature, must remain in effect beyond the termination of this License
|
|
||||||
shall survive.
|
|
||||||
|
|
||||||
8.2. If You initiate litigation by asserting a patent infringement
|
|
||||||
claim (excluding declatory judgment actions) against Initial Developer
|
|
||||||
or a Contributor (the Initial Developer or Contributor against whom
|
|
||||||
You file such action is referred to as "Participant") alleging that:
|
|
||||||
|
|
||||||
(a) such Participant's Contributor Version directly or indirectly
|
|
||||||
infringes any patent, then any and all rights granted by such
|
|
||||||
Participant to You under Sections 2.1 and/or 2.2 of this License
|
|
||||||
shall, upon 60 days notice from Participant terminate prospectively,
|
|
||||||
unless if within 60 days after receipt of notice You either: (i)
|
|
||||||
agree in writing to pay Participant a mutually agreeable reasonable
|
|
||||||
royalty for Your past and future use of Modifications made by such
|
|
||||||
Participant, or (ii) withdraw Your litigation claim with respect to
|
|
||||||
the Contributor Version against such Participant. If within 60 days
|
|
||||||
of notice, a reasonable royalty and payment arrangement are not
|
|
||||||
mutually agreed upon in writing by the parties or the litigation claim
|
|
||||||
is not withdrawn, the rights granted by Participant to You under
|
|
||||||
Sections 2.1 and/or 2.2 automatically terminate at the expiration of
|
|
||||||
the 60 day notice period specified above.
|
|
||||||
|
|
||||||
(b) any software, hardware, or device, other than such Participant's
|
|
||||||
Contributor Version, directly or indirectly infringes any patent, then
|
|
||||||
any rights granted to You by such Participant under Sections 2.1(b)
|
|
||||||
and 2.2(b) are revoked effective as of the date You first made, used,
|
|
||||||
sold, distributed, or had made, Modifications made by that
|
|
||||||
Participant.
|
|
||||||
|
|
||||||
8.3. If You assert a patent infringement claim against Participant
|
|
||||||
alleging that such Participant's Contributor Version directly or
|
|
||||||
indirectly infringes any patent where such claim is resolved (such as
|
|
||||||
by license or settlement) prior to the initiation of patent
|
|
||||||
infringement litigation, then the reasonable value of the licenses
|
|
||||||
granted by such Participant under Sections 2.1 or 2.2 shall be taken
|
|
||||||
into account in determining the amount or value of any payment or
|
|
||||||
license.
|
|
||||||
|
|
||||||
8.4. In the event of termination under Sections 8.1 or 8.2 above,
|
|
||||||
all end user license agreements (excluding distributors and resellers)
|
|
||||||
which have been validly granted by You or any distributor hereunder
|
|
||||||
prior to termination shall survive termination.
|
|
||||||
|
|
||||||
9. LIMITATION OF LIABILITY.
|
|
||||||
|
|
||||||
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
|
|
||||||
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
|
|
||||||
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
|
|
||||||
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
|
|
||||||
ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
|
|
||||||
CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
|
|
||||||
WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
|
|
||||||
COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
|
|
||||||
INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
|
|
||||||
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
|
|
||||||
RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
|
|
||||||
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
|
|
||||||
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
|
|
||||||
THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
|
|
||||||
|
|
||||||
10. U.S. GOVERNMENT END USERS.
|
|
||||||
|
|
||||||
The Covered Code is a "commercial item," as that term is defined in
|
|
||||||
48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
|
|
||||||
software" and "commercial computer software documentation," as such
|
|
||||||
terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
|
|
||||||
C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
|
|
||||||
all U.S. Government End Users acquire Covered Code with only those
|
|
||||||
rights set forth herein.
|
|
||||||
|
|
||||||
11. MISCELLANEOUS.
|
|
||||||
|
|
||||||
This License represents the complete agreement concerning subject
|
|
||||||
matter hereof. If any provision of this License is held to be
|
|
||||||
unenforceable, such provision shall be reformed only to the extent
|
|
||||||
necessary to make it enforceable. This License shall be governed by
|
|
||||||
California law provisions (except to the extent applicable law, if
|
|
||||||
any, provides otherwise), excluding its conflict-of-law provisions.
|
|
||||||
With respect to disputes in which at least one party is a citizen of,
|
|
||||||
or an entity chartered or registered to do business in the United
|
|
||||||
States of America, any litigation relating to this License shall be
|
|
||||||
subject to the jurisdiction of the Federal Courts of the Northern
|
|
||||||
District of California, with venue lying in Santa Clara County,
|
|
||||||
California, with the losing party responsible for costs, including
|
|
||||||
without limitation, court costs and reasonable attorneys' fees and
|
|
||||||
expenses. The application of the United Nations Convention on
|
|
||||||
Contracts for the International Sale of Goods is expressly excluded.
|
|
||||||
Any law or regulation which provides that the language of a contract
|
|
||||||
shall be construed against the drafter shall not apply to this
|
|
||||||
License.
|
|
||||||
|
|
||||||
12. RESPONSIBILITY FOR CLAIMS.
|
|
||||||
|
|
||||||
As between Initial Developer and the Contributors, each party is
|
|
||||||
responsible for claims and damages arising, directly or indirectly,
|
|
||||||
out of its utilization of rights under this License and You agree to
|
|
||||||
work with Initial Developer and Contributors to distribute such
|
|
||||||
responsibility on an equitable basis. Nothing herein is intended or
|
|
||||||
shall be deemed to constitute any admission of liability.
|
|
||||||
|
|
||||||
13. MULTIPLE-LICENSED CODE.
|
|
||||||
|
|
||||||
Initial Developer may designate portions of the Covered Code as
|
|
||||||
"Multiple-Licensed". "Multiple-Licensed" means that the Initial
|
|
||||||
Developer permits you to utilize portions of the Covered Code under
|
|
||||||
Your choice of the NPL or the alternative licenses, if any, specified
|
|
||||||
by the Initial Developer in the file described in Exhibit A.
|
|
||||||
|
|
||||||
EXHIBIT A -Mozilla Public License.
|
|
||||||
|
|
||||||
``The contents of this file are subject to the Mozilla Public License
|
|
||||||
Version 1.1 (the "License"); you may not use this file except in
|
|
||||||
compliance with the License. You may obtain a copy of the License at
|
|
||||||
http://www.mozilla.org/MPL/
|
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS"
|
|
||||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
||||||
License for the specific language governing rights and limitations
|
|
||||||
under the License.
|
|
||||||
|
|
||||||
The Original Code is ______________________________________.
|
|
||||||
|
|
||||||
The Initial Developer of the Original Code is ________________________.
|
|
||||||
Portions created by ______________________ are Copyright (C) ______
|
|
||||||
_______________________. All Rights Reserved.
|
|
||||||
|
|
||||||
Contributor(s): ______________________________________.
|
|
||||||
|
|
||||||
Alternatively, the contents of this file may be used under the terms
|
|
||||||
of the _____ license (the "[___] License"), in which case the
|
|
||||||
provisions of [______] License are applicable instead of those
|
|
||||||
above. If you wish to allow use of your version of this file only
|
|
||||||
under the terms of the [____] License and not to allow others to use
|
|
||||||
your version of this file under the MPL, indicate your decision by
|
|
||||||
deleting the provisions above and replace them with the notice and
|
|
||||||
other provisions required by the [___] License. If you do not delete
|
|
||||||
the provisions above, a recipient may use your version of this file
|
|
||||||
under either the MPL or the [___] License."
|
|
||||||
|
|
||||||
[NOTE: The text of this Exhibit A may differ slightly from the text of
|
|
||||||
the notices in the Source Code files of the Original Code. You should
|
|
||||||
use the text of this Exhibit A rather than the text found in the
|
|
||||||
Original Code Source Code for Your Modifications.]
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,524 +0,0 @@
|
||||||
Myspell has a lot of parallel development, that is not documented here.
|
|
||||||
|
|
||||||
2005-01-11: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* hunspell.cxx:
|
|
||||||
- interaktív javításnál hiányzó új sor karakterek pótlása.
|
|
||||||
A hibát Gefferth András és Khiraly jelezte.
|
|
||||||
* csutil.cxx:
|
|
||||||
- pontosvesszők törlése a GCC 3.4-es fordító igényeinek megfelelően
|
|
||||||
A hibát Dvornik László jelezte.
|
|
||||||
- i változó ismételt deklarásának törlése, ami helyenként hibás
|
|
||||||
fordítást eredményez.
|
|
||||||
A hibát Lódoktor és Bencsáth Boldizsár jelezte.
|
|
||||||
* OLVASS.EL:
|
|
||||||
- Windows alatti fordításnál Langid.cxx módosítandó. A hibát
|
|
||||||
Lódoktor jelezte.
|
|
||||||
|
|
||||||
2004-12-15 Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* src/morphbase/*:
|
|
||||||
- handling K&R morphological encoding (remove plus signs from output)
|
|
||||||
- LEMMA_PRESENT: put only morphological description to output
|
|
||||||
- LANG parameter, langnum variable in source for writing language-dependent codes
|
|
||||||
- remove HU_KOTOHANGZO
|
|
||||||
- etc.
|
|
||||||
* doc/hunspell.4:
|
|
||||||
- adding some
|
|
||||||
|
|
||||||
2004-09-29 Halácsy Péter <peter@halacsy.com>
|
|
||||||
|
|
||||||
* doc/ : bemásoltam a hunspell.1 hunspell.4 man oldalakat
|
|
||||||
* doc/hunspell.1: Kivettem a -s -m kapcsolókról szóló részt
|
|
||||||
|
|
||||||
2004-09-28 Halácsy Péter <peter@halacsy.com>
|
|
||||||
|
|
||||||
* src/hunspell/hunspell.cxx (indexing_interface): Ezt kiszedtem a
|
|
||||||
HunSpell-bol, mert nem ide valo. Ez egy kulon program lehet.
|
|
||||||
(main): a hunstem üzemmódot is kidobtam, ez se ide való
|
|
||||||
(main): meg a hunmorph üzemmódot is
|
|
||||||
|
|
||||||
* src/morphbase/morphbase.cxx (MorphBase): Átneveztem a MySpell
|
|
||||||
osztályt MorphBase-re
|
|
||||||
(stems): Átnevezten a suggest_stems metódust stem -re (mint to stem)
|
|
||||||
|
|
||||||
2004-08-25 Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* src/hunbase/suggestmgr.cxx: tövezés visszaállítása, nem
|
|
||||||
működik még az igekötők hozzátoldása a tőhöz, továbbá a
|
|
||||||
kivételek kezelése (ehhez a 0.99.4-es szótár szükséges még).
|
|
||||||
* src/hunbase/myspell.cxx: -s vissza a tövezéshez
|
|
||||||
* src/hunbase/atypes.hxx: HUNSTEM makró definiálása itt az
|
|
||||||
affixmgr.cxx feltételes kódjához
|
|
||||||
|
|
||||||
2004-08-12 Halacsy Peter
|
|
||||||
* src/misc/lexfilter.cxx : uj program, ami a szotar szureshez hasznalhato
|
|
||||||
lecserelheti a mostani hunmorph, hunspell -G -1 funkciokat
|
|
||||||
|
|
||||||
* src/hunbase/myspell.cxx (analyzer) : Uj metodust vettem fel, ami mar
|
|
||||||
karaktertombben adja vissza az elemzes eredmenyet
|
|
||||||
|
|
||||||
2004-08-03 Halácsy Péter <peter@halacsy.com>
|
|
||||||
|
|
||||||
* src/hunspell/hunspell.cxx (HUNSPELL_VERSION): Áttettem ide ennek definiálását
|
|
||||||
|
|
||||||
2004-07-31 Halácsy Péter <peter@halacsy.com>
|
|
||||||
|
|
||||||
* src/hunbase/suggestmgr.cxx (fixstems): A fixstems miért itt van
|
|
||||||
és miért így hívják. Ez mehetne egy külön osztályba.
|
|
||||||
|
|
||||||
2004-07-31 Halácsy Péter <peter@halacsy.com>
|
|
||||||
|
|
||||||
* src/huntoken/htmlparser.cxx: Egyebkent az include-ok kezelese
|
|
||||||
eleg zavaros. Peldaul itt minek a textparser.hxx includolasa?
|
|
||||||
|
|
||||||
* src/huntoken/textparser.hxx (MAXLNLEN): Áthoztam ide a MAXLNLEN makrót
|
|
||||||
az atypes.hxx-bol, hogy a fuggoseget megszuntessem
|
|
||||||
|
|
||||||
* src/hunbase/myspell.cxx (suggest): Kivettem azt a részt, ami visszaadja a HUNSPELL_VERSION stringet
|
|
||||||
ha a VERSION_KEYWORD a bemeneti string. Csúnya gányolásnak tartottam
|
|
||||||
|
|
||||||
2004-07-27 Halácsy Péter <peter@halacsy.com>
|
|
||||||
|
|
||||||
* src/hunbase/myspell.cxx (morph_with_correction):
|
|
||||||
|
|
||||||
* src/hunbase/baseaffix.hxx (class AffEntry): Allandora felvettem a morphcode mezot (last htypes.hxx)
|
|
||||||
|
|
||||||
* src/hunbase/affentry.hxx: Kivettem a hunmorph felteteleket (last htypes.hxx)
|
|
||||||
|
|
||||||
* src/hunbase/htypes.hxx (struct hentry): Kivettem a HUNMORPH feltetelt a char* description korul. Ertem,
|
|
||||||
hogy hatekonyabb egy folosleges mutato nelkul, ha nincs morf info, de szerintem felesleges
|
|
||||||
|
|
||||||
* src/hunbase/myspell.hxx: HUNSPELL_VERSION es VERSION_KEYWORD makrokat kivettem. Valamiert a
|
|
||||||
hunspellnek kell majd
|
|
||||||
|
|
||||||
* src/hunbase/config.hxx (FLAG): config.hxx torolve, helyet atveszi a kozponti config.h; FLAG
|
|
||||||
definicioja az atypes.hxx-be ment
|
|
||||||
|
|
||||||
* src/hunbase/atypes.hxx (FLAG): config.hxx megszuntetese erdekeben attettem ide a FLAG makro
|
|
||||||
definialasat, ami az EXT_CLASS-tol fugg
|
|
||||||
|
|
||||||
config.hxx include kicserelve a configure altal kezelt config.h-ra
|
|
||||||
|
|
||||||
2004-06-29: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* affixmgr.cxx:
|
|
||||||
- csak utolsó tagként megengedett szavak (compound3) toldalék
|
|
||||||
nélküli előfordulásának engedélyezése (pl. macskapár)
|
|
||||||
- többszörösen összetett szavak toldalékolt alakjainak morfológiai
|
|
||||||
elemzése
|
|
||||||
* myspell.cxx:
|
|
||||||
- rövidítések, számok, kötőjeles összetett szavak és a
|
|
||||||
-e határozószót tartalmazó szavak morfológiai elemzése
|
|
||||||
* suggestmgr.cxx: suggest_morph_for_spelling_error() optimalizálása
|
|
||||||
(csak a felhasznált egy javaslatot keresi meg, többet nem).
|
|
||||||
* csutil.cxx: kimenetben szereplő üres sorok törlése
|
|
||||||
|
|
||||||
2004-06-10: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* suggestmgr.cxx: összetett szavak elemzésének korlátozása
|
|
||||||
- a tövezés még nincs megvalósítva a 0.9.9-es változatban
|
|
||||||
(helyette a Hunspell 0.9.7 használandó a Magyar Ispell 0.99.4-es
|
|
||||||
változatával)
|
|
||||||
|
|
||||||
2004-05-19: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* 0.9.9f-alpha
|
|
||||||
|
|
||||||
- morf. leírás sztringkezelése jav.
|
|
||||||
- EXT_CLASS: config.cxx-ben
|
|
||||||
- nagybetűs alakok is elemezve (a hibát Tron Viktor jelezte)
|
|
||||||
- szebb kimenet
|
|
||||||
- rule119 törölve
|
|
||||||
- firstparser.cxx javítva
|
|
||||||
|
|
||||||
2004-02-13: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* 0.9.8a:
|
|
||||||
- MAXUSERWORD helyett USERWORD, nincs korlát
|
|
||||||
- description \t-vel dic fájlba
|
|
||||||
- homonimák kezelése
|
|
||||||
- aff formátumbővítés
|
|
||||||
- konfixumok
|
|
||||||
- _morpho függvények
|
|
||||||
- kettős szuffixum
|
|
||||||
- hunmorph
|
|
||||||
- lásd tests/hunmorph
|
|
||||||
|
|
||||||
2004-01-29: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* 0.9.7-sztaki:
|
|
||||||
- memóriakezelési hibák javítása
|
|
||||||
|
|
||||||
2003-12-17: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* 0.9.7-es változat:
|
|
||||||
* affixmgr.cxx:
|
|
||||||
- suffix_check() javítás (tmpword kiváltása isRevSubSet()
|
|
||||||
függvénnyel
|
|
||||||
- betöltés optimalizálása, build_pfxlist() helyett:
|
|
||||||
- build_pfxtree()
|
|
||||||
- process_sfx_tree_to_list(), process_sfx_inorder()
|
|
||||||
|
|
||||||
* csutil.cxx:
|
|
||||||
- isSubSet() gyorsabb változata
|
|
||||||
- isRevSubSet()
|
|
||||||
|
|
||||||
* langid.cxx, hunp.cxx:
|
|
||||||
- nyelvfelismerő osztály és program (l. man hunp)
|
|
||||||
* man/hunp.1:
|
|
||||||
- nyelvfelismerő program leírása
|
|
||||||
|
|
||||||
* firstparser.cxx:
|
|
||||||
- csak a tabulátorjelet tartalmazó sorokból a tabulátorjel
|
|
||||||
előtti részt adja vissza (l. man Hunspell, -1 kapcsoló)
|
|
||||||
|
|
||||||
* hunspell.cxx:
|
|
||||||
- -u, -U, -u2 kapcsolók: tipikus hibák kijelzése;
|
|
||||||
automatikus, illetve lektorált javítása. L. man hunspell.
|
|
||||||
|
|
||||||
- -w kapcsoló teljes sor vizsgálatához
|
|
||||||
|
|
||||||
* hunspell.cxx:
|
|
||||||
- spell(): javítás (Valgrind hibajelzés alapján)
|
|
||||||
|
|
||||||
* hunspell.cxx: sprintf()-ek elé strlen() feltételvizsgálat
|
|
||||||
|
|
||||||
* suggestmgr.cxx:
|
|
||||||
- 0.99.4-es Hunspell szótárral bekerült tövezési hiba
|
|
||||||
javítása (nem produktív ragozású, összetett szóbam szereplő
|
|
||||||
főneveknél lépett fel ez a probléma).
|
|
||||||
|
|
||||||
* OLVASS.EL:
|
|
||||||
- bővítés
|
|
||||||
|
|
||||||
2003-11-03: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* SuggestMgr::permute_accent():
|
|
||||||
- illegális memóriaolvasási hiba javítása.
|
|
||||||
* example.cxx::
|
|
||||||
- dupla free() a "" karakterlánc tövezése után
|
|
||||||
|
|
||||||
A hibákat Sarlós Tamás <stamas@csillag.ilab.sztaki.hu>
|
|
||||||
fedezte fel a figyelemre méltó Valgrind nyomkövető
|
|
||||||
programmal (http://developer.kde.org/~sewardj/)
|
|
||||||
|
|
||||||
2003-10-22: Bencsáth Boldizsár <boldi@datacontact.hu>
|
|
||||||
* affixmgr.[ch]xx, csutil.[ch]xx: Az eredeti
|
|
||||||
MySpell foltjainak alkalmazása az OpenOffice.org 1.1
|
|
||||||
kompatibilitás érdekében. Itt karakterkezelő
|
|
||||||
segédfüggvények lettek áthelyezve elérhetőbb helyre.
|
|
||||||
|
|
||||||
* dictmgr.[ch]xx: Itt etype paraméter hozzáadása.
|
|
||||||
|
|
||||||
* makefile.mk: Itt angol szótárak megjegyzésbe tétele.
|
|
||||||
|
|
||||||
2003-10-04: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* 0.9.6.3-as változat:
|
|
||||||
* myspell.cxx: suggest() függvényben hibás
|
|
||||||
memóriafoglalás javítása. A hiba a pontra végződő
|
|
||||||
helytelen szavakra adott javaslattevés során
|
|
||||||
jelentkezett. A hibás működést Khiraly
|
|
||||||
<khiraly@gmx.net> jelezte.
|
|
||||||
|
|
||||||
2003-09-15: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* 0.9.6.2-es változat:
|
|
||||||
* latexparser.cxx: TeX elemző javítása:
|
|
||||||
- elemzési hiba ({{}}})
|
|
||||||
- verb+ +, \verb stb. kezelése
|
|
||||||
|
|
||||||
2003-09-01: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* 0.9.6-os változat:
|
|
||||||
|
|
||||||
* affentry.cxx: check2 törlése, lehetséges
|
|
||||||
tövek tárolása
|
|
||||||
* suggestmgr.cxx, myspell.cxx: suggest_pos_stems()
|
|
||||||
az ismeretlen szavak névszóragjainak és
|
|
||||||
jeleinek leválasztására.
|
|
||||||
|
|
||||||
* affixmgr.cxx, suggestmgr.cxx: suggest_stems()
|
|
||||||
szálkezeléshez módosított és javított függvény
|
|
||||||
|
|
||||||
* myspell.cxx: számok tövezése (teszt: 5-nek)
|
|
||||||
|
|
||||||
* myspell.cxx: egy karakter + szó javaslatok
|
|
||||||
törlése (például cápak->cápa k)
|
|
||||||
|
|
||||||
* affixmgr.cxx, myspell.cxx, hunspell.cxx: szótár
|
|
||||||
verziószámának kiírása
|
|
||||||
|
|
||||||
* hunspell.cxx: \r karaktert tartalmazó sorok
|
|
||||||
helyes megjelenítése
|
|
||||||
|
|
||||||
* myspell.cxx, hunspell.cxx: rövidítés végi pontok
|
|
||||||
hozzáadása függvénykönyvtár szinten
|
|
||||||
|
|
||||||
* hunspell.cxx: pipe_interface(): standard bemenet
|
|
||||||
tövezésénél hiányzó memóriafelszabadítás pótlása
|
|
||||||
|
|
||||||
* Makefile: install javítása, több feltételvizsgálat
|
|
||||||
deinstall szakasz
|
|
||||||
|
|
||||||
2003-07-22: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* 0.9.5-ös változat
|
|
||||||
* suggestmgr.cxx: marhalevél->lelevél tövezés javítása
|
|
||||||
* myspell.cxx: nagy kezdőbetűs rövidítések vizsgálata (Bp., Btk.)
|
|
||||||
- pontot tartalmazó számok helyesnek való elfogadása, ha:
|
|
||||||
- az első pontot legalább egy,
|
|
||||||
- de legfeljebb három számjegy előzi meg,
|
|
||||||
- a pontok nem egymás mellett helyezkednek el,
|
|
||||||
- az utolsó pont után legfeljebb két számjegy van.
|
|
||||||
Ezzel elfogadjuk az időpontokat (12.00-kor), a pontozásokat
|
|
||||||
(1.1.2-ben), de kizárjuk a szóköz nélküli hibás dátummegadásokat
|
|
||||||
(2003.7.22.), valamint a tizedesvessző helyett ponttal írt
|
|
||||||
tizedestörteket (3.456, 4563.34).
|
|
||||||
- Javítás a tiltott szavakra adott kötőjeles javaslatoknál:
|
|
||||||
Straussal->Strauss-szal, és nem ,,Strauss szal''.
|
|
||||||
* hunspell.cxx: csak a -a kapcsoló megadásával élnek a
|
|
||||||
csőfelületi parancsok. Ezért most már nincsenek figyelmen
|
|
||||||
kívül hagyva például a kötőjellel kezdődő sorok, ha a -l
|
|
||||||
kapcsolóval hibás szavakat keresünk egy állományban.
|
|
||||||
* man/hunspell.1: a -a kapcsoló leírásának kiegészítése.
|
|
||||||
|
|
||||||
2003-06-13: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* 0.9.4-es változat
|
|
||||||
* bin/*: makedb, lookdb segédprogramok az indexeléshez
|
|
||||||
* man/*: hunstem, makedb, lookdb
|
|
||||||
* hunspell.cxx: pipe_interface: nyomkövető kiírás törlése
|
|
||||||
- LOG #ifdef-be
|
|
||||||
|
|
||||||
2003-06-11: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* 0.9.3-es változat
|
|
||||||
* suggestmgr.cxx: nagybetűs javaslat tulajdonneveknél
|
|
||||||
* hunspell.cxx: pipe_interface: hiba javítása
|
|
||||||
|
|
||||||
2003-06-05: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* 0.9.2-es változat
|
|
||||||
* hunspell.cxx: -s kapcsoló
|
|
||||||
* suggestmgr.cxx: suggest_stems()
|
|
||||||
Szótövek előállítása
|
|
||||||
* example.cxx: példa a szótövek előállítására
|
|
||||||
|
|
||||||
2003-05-13: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* 0.9.1-es változat
|
|
||||||
* hunspell.cxx:
|
|
||||||
- rl_escape(), stb.: a readline sorban ki lett kapcsolva
|
|
||||||
a fájlnév-kiegészítés, és helyette a két Escape lenyomás
|
|
||||||
megszakítja a szövegbevitelt. A Csere műveletnél is a
|
|
||||||
readline() hívás található most már.
|
|
||||||
- egy hibás sprintf() sor javítva lett
|
|
||||||
* Makefile.unix:
|
|
||||||
- beállítások elkülönítve az állomány elején
|
|
||||||
- Makefile most már szimbólikus kötés
|
|
||||||
* ooomagyarispellteszt.txt: tesztállomány
|
|
||||||
|
|
||||||
2003-04-28: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* affixmgr.cxx:
|
|
||||||
- y végű szavak kezelése: bővebb leírás a
|
|
||||||
Magyar Ispell Changelog állományában.
|
|
||||||
|
|
||||||
* *parser.cxx:
|
|
||||||
ISO-8859-1 HTML karakterentitások közül a betűértékűek
|
|
||||||
(csak az ISO-8859-2-ben nem szereplők) felismerése
|
|
||||||
és kezelése.
|
|
||||||
|
|
||||||
2003-04-21: Goldman Elenonóra <eleonora46@gmx.net>
|
|
||||||
* *.dll függvénykönyvtár előállítása Windows alatt:
|
|
||||||
- StdAfx.h
|
|
||||||
- libmyspell.def
|
|
||||||
- dlltest.cpp
|
|
||||||
|
|
||||||
2003-04-16: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* Hunspell.cxx, stb: a Mispell átnevezése Hunspell-lé.
|
|
||||||
A nevet Kornai András <andras@kornai.com> javasolta.
|
|
||||||
Könyvtárak: /usr/share/mispell -> /usr/share/myspell
|
|
||||||
(korábban is ez volt).
|
|
||||||
A /usr/share/hunmorph szótár a helye a speciális
|
|
||||||
morfológiai információkat tartalmazó Hunmorph (bővített
|
|
||||||
Myspell szótárformátumú) szótárállományoknak.
|
|
||||||
* Licenc: LGPL
|
|
||||||
* config.hxx: SZOSZABLYA_POSSIBLE_ROOTS
|
|
||||||
Ha a makrót bekapcsoljuk, akkor kiírásra kerülnek
|
|
||||||
a lehetséges tövek is, az alkalmazott ragozási szabály
|
|
||||||
osztályának betűjelével, illetve az alapszóval együtt.
|
|
||||||
|
|
||||||
2003-04-10: Németh László <nemethl@gyorsposta.hu>:
|
|
||||||
* affixmgr.cxx:
|
|
||||||
- kötőhangzók helyes kezelése (hu_kotohangzo kapcsolóval),
|
|
||||||
l. még Magyar Ispell Changelog
|
|
||||||
|
|
||||||
2003-03-24: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* mispell.cxx: pipe_interface(): az adatfájl szűrésnél fellépő
|
|
||||||
memóriaszivárgás megszüntetése a kimaradt free(token) pótlásával
|
|
||||||
* affixmgr.cxx: prefix_check(): leg-, legesleg- confixum ellenőrzés
|
|
||||||
- onlyroot kapcsoló a csak tőszót érintő tiltáshoz. L. Magyar Ispell
|
|
||||||
Az affixum állományban új kapcsolót adhatunk meg az
|
|
||||||
ONLYROOT paranccsal bevezetve. A kapcsoló módosítja a tiltókapcsoló
|
|
||||||
működését. L. man 4 mispell
|
|
||||||
* myspell.cxx:
|
|
||||||
- spell(): nagybetűs tulajdonnevek ellenőrzése (pl. BALATON)
|
|
||||||
- onlyroot vizsgálat forbiddenword mellett -> mangrove kezelése
|
|
||||||
|
|
||||||
2003-03-17: Goldman Elenonóra <eleonora46@gmx.net>
|
|
||||||
* Windows port
|
|
||||||
* makefile.Windows:
|
|
||||||
|
|
||||||
2003-03-04: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* firstparser.[ch]xx: adatfájlok szűréséhez (l. -1 kapcsoló)
|
|
||||||
* mispell.cxx: -L, -1, -G kapcsolók
|
|
||||||
* man/mispell.1: -L, -1, -G kapcsolók
|
|
||||||
|
|
||||||
2003-03-03: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* mispell.cxx: -l, -p, WORDLIST
|
|
||||||
* man/mispell.1: -l, -p, WORDLIST
|
|
||||||
|
|
||||||
2003-02-26: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* mispell.cxx: dialog_screen():
|
|
||||||
TILTOTT! (FORBIDDEN!) megjelenítése a tiltott szóösszetételek
|
|
||||||
esetén.
|
|
||||||
* suggestmgr.cxx:
|
|
||||||
- check(): -ó, -ő képzős igeneveket érintő kód törlése
|
|
||||||
- check_forbidden(): a 6 szótagnál hosszabb, tiltott szótövekre
|
|
||||||
vonatkozó javaslatok nem kötőjellel, hanem szóközzel elválasztva
|
|
||||||
tartalmazzák a szavakat, ehhez szükséges a check_forbidden().
|
|
||||||
* man/*: új kézikönyv oldal az állományok formátumáról (mispell(4)),
|
|
||||||
a mispell(1) bővítése.
|
|
||||||
* Makefile, mispell.mo: Bíró Árpád <biro_arpad@yahoo.com> javításai
|
|
||||||
|
|
||||||
2003-02-18: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* mispell.cxx: interactive_interface()
|
|
||||||
- nem nyeli el a MAXLNLEN-t meghaladó méretű sorokban a MAXLNLEN
|
|
||||||
méretű részek határán lévő karaktereket, és a nem újsor karakterre
|
|
||||||
végződő állományok utolsó karakterét. (Hibát viszont még mindig
|
|
||||||
jelez, ha a MAXLNLEN határ feldarabol egy amúgy helyes szót.)
|
|
||||||
A MAXLNLEN 8192 karakter jelenleg.
|
|
||||||
- readline függvénykönyvtár használata a bevitelnél
|
|
||||||
- tőfelvételnél egy lehetséges tő előállítása, és a beviteli
|
|
||||||
sorban való feltüntetése. Az így megjelenő szó javítható.
|
|
||||||
- --help kapcsoló
|
|
||||||
* Makefile: Javítások az install szakaszban.
|
|
||||||
A hibákat Bíró Árpád <biro_arpad@yahoo.com> jelezte.
|
|
||||||
|
|
||||||
2003-02-07: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* mispell.cxx: put_dots_to_suggestions()
|
|
||||||
- realloc() cseréje malloc()-ra ismeretlen eredetű lefagyás miatt.
|
|
||||||
- lehetséges az Ispellhez hasonlóan a kapcsolókat kézzel megadni a
|
|
||||||
saját szótárban a szavak után egy perjelet követően: például a
|
|
||||||
valamicsúnyaszó/w
|
|
||||||
sor megadása után a valamicsúnyaszó és toldalékolt változatai hibásak
|
|
||||||
lesznek az ellenőrzés alatt. (További kapcsolók leírásáért lásd a
|
|
||||||
Magyar Ispell forrásában az aff/aff.fej állományt.)
|
|
||||||
* affixmgr.cxx: compound_check()
|
|
||||||
- repl_chars() hívása a megfelelő helyre lett téve, ezzel a
|
|
||||||
javaslattevés sebessége kétszeresére nőtt.
|
|
||||||
- A dinamikus memóriakezelés lecserelése veremmemóriára nem járt
|
|
||||||
lényeges sebességnövekedéssel, de a közeljövőben ezzel elkerülhető
|
|
||||||
az a memóriaszivárgás, ami például itt a tiltott szavak kezelésénél
|
|
||||||
volt az előző változatban (javítva).
|
|
||||||
* affentry.cxx, affixmgr.cxx: szótő-előállító kód megalapozása:
|
|
||||||
get_possible_root() metódus az utolsó toldalék-leválasztás
|
|
||||||
eredményével tér vissza.
|
|
||||||
|
|
||||||
2003-02-05: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* mispell.cxx: put_dots_to_suggestions(): amennyiben
|
|
||||||
a felismert szó pontra, vagy pontokra végződik, a
|
|
||||||
javaslatokat is bővíti ezzel.
|
|
||||||
- @, valamint 1-nél több pontot magába foglaló (de nem arra végződő)
|
|
||||||
szavak ellenőrzésének tiltása (e-mail, fájlnevek, még nem opcionális).
|
|
||||||
- Hosszú sorok helyes megjelenítése.
|
|
||||||
- Tabulátorjelet tartalmazó sorok helyes megjelenítése.
|
|
||||||
- Mozaikszavak tőfelvételénél kötőjeles alak automatikus rögzítése
|
|
||||||
Pl.: BKV//URH mellett BKV-//URH- is bekerül a saját szótárba
|
|
||||||
(a ragozott mozaikszavak felismerése tehát automatikus lesz, kivéve a
|
|
||||||
nem triviális -val/-vel toldalékos alakoké, amit külön kell felvenni.)
|
|
||||||
- PuT törlése (helyette MySpell::put_word(), put_word_suffix(),
|
|
||||||
put_word_pattern() eljárások a saját szótár bővítésére)
|
|
||||||
- dupla szavak ellenőrzésének törlése a MySpell kódból (áthelyezés majd a
|
|
||||||
Mispell felületbe), hogy a MySpell meghívható maradjon párhuzamosan
|
|
||||||
futó szálakból.
|
|
||||||
|
|
||||||
2002-12-30: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* *parser.cxx, *parser.hxx: elemző osztályok a régi és csúnya kód helyett
|
|
||||||
|
|
||||||
2002-12-10: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* myspell.cxx: 35°-os, 20%-kal kezelése
|
|
||||||
* man/mispell.1: kézikönyv
|
|
||||||
|
|
||||||
2002-12-04: Noll János <johnzero@johnzero.hu>
|
|
||||||
* spdaemon/: kiszolgáló felület, ld. README.spdaemon
|
|
||||||
|
|
||||||
2002-12-04: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* mispell.cxx: Emacs kompatibilitáshoz hibák javítása (pl. többszörös -d)
|
|
||||||
* mispell.cxx: CURSES makróval kikapcsolható az interaktív felület + locale
|
|
||||||
(Windows, Macintosh)
|
|
||||||
|
|
||||||
2002-11-30: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* affixmgr.cxx: get_checkdoublewords()
|
|
||||||
|
|
||||||
2002-11-25: Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* affixmgr.cxx: mozgószabály (hu_mov_rule)
|
|
||||||
* myspell.cxx: mozgószabály
|
|
||||||
* affixmgr.cxx: kiötlőjénekmacskát (affix is összetettben, ha prefix)
|
|
||||||
|
|
||||||
2002-11-08 Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* myspell.cxx: balatonnak->Balatonnak, balatoninak
|
|
||||||
|
|
||||||
2002-11-07 Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* myspell: 0.6-os változat
|
|
||||||
|
|
||||||
2002-10-31 Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* Egyszerűbb név: Magyar MySpell 0.5 után -> MIspell 0.6
|
|
||||||
* mispell.cxx: többnyelvű interaktív felület (ncurses, locale)
|
|
||||||
* Makefile: make install
|
|
||||||
|
|
||||||
2002-09-22 Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* affixmgr.cxx: compound_check() macskaugom->macskaugrom, stb. javítása
|
|
||||||
* affixmgr.cxx: compound_check() szóismétlés (pl. macskamacska) tiltása
|
|
||||||
* myspell.cxx: szóismétlődés tiltása (pl. kutya kutya) második rossz
|
|
||||||
* suggestmgr.cxx: macskaírat->macska írat mellett ->macskairat
|
|
||||||
|
|
||||||
2002-07-29 Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* mispell Windowsra, teszt Emacs-szel (vagy Emacs-csal)
|
|
||||||
* tiltott szavakat nem javasol, és összetett szóban sem fogad el
|
|
||||||
* fonev_morfo, fonev_morfo2 álszótövek elutasítása (házakmacska)
|
|
||||||
* kötőjeles szavak kezelése
|
|
||||||
* számok kezelése, kötőjeles alakjaikkal együtt, CHECKNUM kapcsoló
|
|
||||||
|
|
||||||
2002-07-17 Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* mispell.cxx: MySpell Ispell cső interfész
|
|
||||||
|
|
||||||
2002-07-04 Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* mispell.cxx: MySpell Ispell cső interfész
|
|
||||||
* affxmgr.cxx: szszerű kiszűrése,
|
|
||||||
* új funkciók:
|
|
||||||
COMPOUNDFIRST: szó szerepelhet első tagként a szóöszetételekben
|
|
||||||
COMPOUNDLAST: szó szerepelhet utolsó tagként a szóöszetételekben
|
|
||||||
FORBIDDENWORD: tiltott szavak kapcsolója (utú, uta, stb.)
|
|
||||||
|
|
||||||
2002-06-25 Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* myspell.cxx, suggestmgr.cxx: get_compound() char* helyett char
|
|
||||||
* affxmgr.cxx: check_repl() a helyesnek tűnő, de hibás összetett
|
|
||||||
szavak kiszűrésére (pl. tejles, szervíz)
|
|
||||||
A szóösszetétel elfogadása előtt még megnézzük, hogy a szó
|
|
||||||
nem-e a cseretáblázatban felvett hibát tartalmaz,
|
|
||||||
ha igen, akkor a szó hibásnak minősül, hiába helyes szóösszetétel.
|
|
||||||
* affxmgr.cxx, suggestmgr.xx: accent: ékezetesítő.
|
|
||||||
Leírás: README.accent
|
|
||||||
További optimalizáció: az ékezet nélküli betű ékezetes
|
|
||||||
változatai számának függvényében
|
|
||||||
|
|
||||||
2002-06-05 Noll János <johnzero@johnzero.hu>
|
|
||||||
* myspell.cxx, suggestmgr.cxx: mem. szivárgás javítása
|
|
||||||
(a get_compound() felszabadítás nélkül lett meghíva).
|
|
||||||
A hiba a GNU mtrace segítségével lett detektálva.
|
|
||||||
|
|
||||||
2002-06-03 Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* Licenc: GPL
|
|
||||||
* Lásd MYSPELL.HU
|
|
||||||
* compound_check: 6-3 szabály, stb.
|
|
||||||
|
|
||||||
MySpell:
|
|
||||||
|
|
||||||
2002-xx-xx Kevin Hendricks <kevin.hendricks@sympatico.ca>
|
|
||||||
* REP: ismétlések kiszűrése a javaslatokból
|
|
||||||
* COMPOUNDMIN
|
|
||||||
|
|
||||||
2002-xx-xx Németh László <nemethl@gyorsposta.hu>
|
|
||||||
* REP cseretáblázat
|
|
||||||
* COMPOUND, szóösszetételképzés
|
|
||||||
|
|
||||||
2002-xx-xx David Einstein <Deinst@world.std.com>
|
|
||||||
* optimalizált MySpell algoritmus
|
|
||||||
|
|
||||||
2001-xx-xx Kevin Hendricks <kevin.hendricks@sympatico.ca>
|
|
||||||
* Működő ellenőrző, Ispell toldaléktömörítési algoritmussal
|
|
|
@ -1,229 +0,0 @@
|
||||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
|
|
||||||
Foundation, Inc.
|
|
||||||
|
|
||||||
This file is free documentation; the Free Software Foundation gives
|
|
||||||
unlimited permission to copy, distribute and modify it.
|
|
||||||
|
|
||||||
Basic Installation
|
|
||||||
==================
|
|
||||||
|
|
||||||
These are generic installation instructions.
|
|
||||||
|
|
||||||
The `configure' shell script attempts to guess correct values for
|
|
||||||
various system-dependent variables used during compilation. It uses
|
|
||||||
those values to create a `Makefile' in each directory of the package.
|
|
||||||
It may also create one or more `.h' files containing system-dependent
|
|
||||||
definitions. Finally, it creates a shell script `config.status' that
|
|
||||||
you can run in the future to recreate the current configuration, and a
|
|
||||||
file `config.log' containing compiler output (useful mainly for
|
|
||||||
debugging `configure').
|
|
||||||
|
|
||||||
It can also use an optional file (typically called `config.cache'
|
|
||||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
|
||||||
the results of its tests to speed up reconfiguring. (Caching is
|
|
||||||
disabled by default to prevent problems with accidental use of stale
|
|
||||||
cache files.)
|
|
||||||
|
|
||||||
If you need to do unusual things to compile the package, please try
|
|
||||||
to figure out how `configure' could check whether to do them, and mail
|
|
||||||
diffs or instructions to the address given in the `README' so they can
|
|
||||||
be considered for the next release. If you are using the cache, and at
|
|
||||||
some point `config.cache' contains results you don't want to keep, you
|
|
||||||
may remove or edit it.
|
|
||||||
|
|
||||||
The file `configure.ac' (or `configure.in') is used to create
|
|
||||||
`configure' by a program called `autoconf'. You only need
|
|
||||||
`configure.ac' if you want to change it or regenerate `configure' using
|
|
||||||
a newer version of `autoconf'.
|
|
||||||
|
|
||||||
The simplest way to compile this package is:
|
|
||||||
|
|
||||||
1. `cd' to the directory containing the package's source code and type
|
|
||||||
`./configure' to configure the package for your system. If you're
|
|
||||||
using `csh' on an old version of System V, you might need to type
|
|
||||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
|
||||||
`configure' itself.
|
|
||||||
|
|
||||||
Running `configure' takes awhile. While running, it prints some
|
|
||||||
messages telling which features it is checking for.
|
|
||||||
|
|
||||||
2. Type `make' to compile the package.
|
|
||||||
|
|
||||||
3. Optionally, type `make check' to run any self-tests that come with
|
|
||||||
the package.
|
|
||||||
|
|
||||||
4. Type `make install' to install the programs and any data files and
|
|
||||||
documentation.
|
|
||||||
|
|
||||||
5. You can remove the program binaries and object files from the
|
|
||||||
source code directory by typing `make clean'. To also remove the
|
|
||||||
files that `configure' created (so you can compile the package for
|
|
||||||
a different kind of computer), type `make distclean'. There is
|
|
||||||
also a `make maintainer-clean' target, but that is intended mainly
|
|
||||||
for the package's developers. If you use it, you may have to get
|
|
||||||
all sorts of other programs in order to regenerate files that came
|
|
||||||
with the distribution.
|
|
||||||
|
|
||||||
Compilers and Options
|
|
||||||
=====================
|
|
||||||
|
|
||||||
Some systems require unusual options for compilation or linking that
|
|
||||||
the `configure' script does not know about. Run `./configure --help'
|
|
||||||
for details on some of the pertinent environment variables.
|
|
||||||
|
|
||||||
You can give `configure' initial values for configuration parameters
|
|
||||||
by setting variables in the command line or in the environment. Here
|
|
||||||
is an example:
|
|
||||||
|
|
||||||
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
|
|
||||||
|
|
||||||
*Note Defining Variables::, for more details.
|
|
||||||
|
|
||||||
Compiling For Multiple Architectures
|
|
||||||
====================================
|
|
||||||
|
|
||||||
You can compile the package for more than one kind of computer at the
|
|
||||||
same time, by placing the object files for each architecture in their
|
|
||||||
own directory. To do this, you must use a version of `make' that
|
|
||||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
|
||||||
directory where you want the object files and executables to go and run
|
|
||||||
the `configure' script. `configure' automatically checks for the
|
|
||||||
source code in the directory that `configure' is in and in `..'.
|
|
||||||
|
|
||||||
If you have to use a `make' that does not support the `VPATH'
|
|
||||||
variable, you have to compile the package for one architecture at a
|
|
||||||
time in the source code directory. After you have installed the
|
|
||||||
package for one architecture, use `make distclean' before reconfiguring
|
|
||||||
for another architecture.
|
|
||||||
|
|
||||||
Installation Names
|
|
||||||
==================
|
|
||||||
|
|
||||||
By default, `make install' will install the package's files in
|
|
||||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
|
||||||
installation prefix other than `/usr/local' by giving `configure' the
|
|
||||||
option `--prefix=PATH'.
|
|
||||||
|
|
||||||
You can specify separate installation prefixes for
|
|
||||||
architecture-specific files and architecture-independent files. If you
|
|
||||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
|
||||||
PATH as the prefix for installing programs and libraries.
|
|
||||||
Documentation and other data files will still use the regular prefix.
|
|
||||||
|
|
||||||
In addition, if you use an unusual directory layout you can give
|
|
||||||
options like `--bindir=PATH' to specify different values for particular
|
|
||||||
kinds of files. Run `configure --help' for a list of the directories
|
|
||||||
you can set and what kinds of files go in them.
|
|
||||||
|
|
||||||
If the package supports it, you can cause programs to be installed
|
|
||||||
with an extra prefix or suffix on their names by giving `configure' the
|
|
||||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
|
||||||
|
|
||||||
Optional Features
|
|
||||||
=================
|
|
||||||
|
|
||||||
Some packages pay attention to `--enable-FEATURE' options to
|
|
||||||
`configure', where FEATURE indicates an optional part of the package.
|
|
||||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
|
||||||
is something like `gnu-as' or `x' (for the X Window System). The
|
|
||||||
`README' should mention any `--enable-' and `--with-' options that the
|
|
||||||
package recognizes.
|
|
||||||
|
|
||||||
For packages that use the X Window System, `configure' can usually
|
|
||||||
find the X include and library files automatically, but if it doesn't,
|
|
||||||
you can use the `configure' options `--x-includes=DIR' and
|
|
||||||
`--x-libraries=DIR' to specify their locations.
|
|
||||||
|
|
||||||
Specifying the System Type
|
|
||||||
==========================
|
|
||||||
|
|
||||||
There may be some features `configure' cannot figure out
|
|
||||||
automatically, but needs to determine by the type of machine the package
|
|
||||||
will run on. Usually, assuming the package is built to be run on the
|
|
||||||
_same_ architectures, `configure' can figure that out, but if it prints
|
|
||||||
a message saying it cannot guess the machine type, give it the
|
|
||||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
|
||||||
type, such as `sun4', or a canonical name which has the form:
|
|
||||||
|
|
||||||
CPU-COMPANY-SYSTEM
|
|
||||||
|
|
||||||
where SYSTEM can have one of these forms:
|
|
||||||
|
|
||||||
OS KERNEL-OS
|
|
||||||
|
|
||||||
See the file `config.sub' for the possible values of each field. If
|
|
||||||
`config.sub' isn't included in this package, then this package doesn't
|
|
||||||
need to know the machine type.
|
|
||||||
|
|
||||||
If you are _building_ compiler tools for cross-compiling, you should
|
|
||||||
use the `--target=TYPE' option to select the type of system they will
|
|
||||||
produce code for.
|
|
||||||
|
|
||||||
If you want to _use_ a cross compiler, that generates code for a
|
|
||||||
platform different from the build platform, you should specify the
|
|
||||||
"host" platform (i.e., that on which the generated programs will
|
|
||||||
eventually be run) with `--host=TYPE'.
|
|
||||||
|
|
||||||
Sharing Defaults
|
|
||||||
================
|
|
||||||
|
|
||||||
If you want to set default values for `configure' scripts to share,
|
|
||||||
you can create a site shell script called `config.site' that gives
|
|
||||||
default values for variables like `CC', `cache_file', and `prefix'.
|
|
||||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
|
||||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
|
||||||
`CONFIG_SITE' environment variable to the location of the site script.
|
|
||||||
A warning: not all `configure' scripts look for a site script.
|
|
||||||
|
|
||||||
Defining Variables
|
|
||||||
==================
|
|
||||||
|
|
||||||
Variables not defined in a site shell script can be set in the
|
|
||||||
environment passed to `configure'. However, some packages may run
|
|
||||||
configure again during the build, and the customized values of these
|
|
||||||
variables may be lost. In order to avoid this problem, you should set
|
|
||||||
them in the `configure' command line, using `VAR=value'. For example:
|
|
||||||
|
|
||||||
./configure CC=/usr/local2/bin/gcc
|
|
||||||
|
|
||||||
will cause the specified gcc to be used as the C compiler (unless it is
|
|
||||||
overridden in the site shell script).
|
|
||||||
|
|
||||||
`configure' Invocation
|
|
||||||
======================
|
|
||||||
|
|
||||||
`configure' recognizes the following options to control how it
|
|
||||||
operates.
|
|
||||||
|
|
||||||
`--help'
|
|
||||||
`-h'
|
|
||||||
Print a summary of the options to `configure', and exit.
|
|
||||||
|
|
||||||
`--version'
|
|
||||||
`-V'
|
|
||||||
Print the version of Autoconf used to generate the `configure'
|
|
||||||
script, and exit.
|
|
||||||
|
|
||||||
`--cache-file=FILE'
|
|
||||||
Enable the cache: use and save the results of the tests in FILE,
|
|
||||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
|
||||||
disable caching.
|
|
||||||
|
|
||||||
`--config-cache'
|
|
||||||
`-C'
|
|
||||||
Alias for `--cache-file=config.cache'.
|
|
||||||
|
|
||||||
`--quiet'
|
|
||||||
`--silent'
|
|
||||||
`-q'
|
|
||||||
Do not print messages saying which checks are being made. To
|
|
||||||
suppress all normal output, redirect it to `/dev/null' (any error
|
|
||||||
messages will still be shown).
|
|
||||||
|
|
||||||
`--srcdir=DIR'
|
|
||||||
Look for the package's source code in directory DIR. Usually
|
|
||||||
`configure' can determine that directory automatically.
|
|
||||||
|
|
||||||
`configure' also accepts some other, not widely useful, options. Run
|
|
||||||
`configure --help' for more details.
|
|
||||||
|
|
|
@ -1,650 +0,0 @@
|
||||||
2014-06-02: Hunspell 1.3.3 release:
|
|
||||||
- OpenDocument (ODF and Flat ODF) support (ODF needs unzip program)
|
|
||||||
- various bug fixes
|
|
||||||
|
|
||||||
2011-02-02: Hunspell 1.3.2 release:
|
|
||||||
- fix library versioning
|
|
||||||
- improved manual
|
|
||||||
|
|
||||||
2011-02-02: Hunspell 1.3.1 release:
|
|
||||||
- bug fixes
|
|
||||||
|
|
||||||
2011-01-26: Hunspell 1.2.15/1.3 release:
|
|
||||||
- new features: MAXDIFF, ONLYMAXDIFF, MAXCPDSUGS, FORBIDWARN, see manual
|
|
||||||
- bug fixes
|
|
||||||
|
|
||||||
2011-01-21:
|
|
||||||
- new features: FORCEUCASE and WARN, see manual
|
|
||||||
- new options: -r to filter potential mistakes (rare words
|
|
||||||
signed by flag WARN in the dictionary)
|
|
||||||
- limited and optimized suggestions
|
|
||||||
|
|
||||||
2011-01-06: Hunspell 1.2.14 release:
|
|
||||||
- bug fix
|
|
||||||
2011-01-03: Hunspell 1.2.13 release:
|
|
||||||
- bug fixes
|
|
||||||
- improved compound handling and
|
|
||||||
other improvements supported by OpenTaal Foundation, Netherlands
|
|
||||||
2010-07-15: Hunspell 1.2.12 release
|
|
||||||
2010-05-06: Hunspell 1.2.11 release:
|
|
||||||
- Maintenance release bug fixes
|
|
||||||
2010-04-30: Hunspell 1.2.10 release:
|
|
||||||
- Maintenance release bug fixes
|
|
||||||
2010-03-03: Hunspell 1.2.9 release:
|
|
||||||
- Maintenance release bug fixes and warnings
|
|
||||||
- MAP support for composed characters or character sequences
|
|
||||||
2008-11-01: Hunspell 1.2.8 release:
|
|
||||||
- Default BREAK feature and better hyphenated word suggestion to accept
|
|
||||||
and fix (compound) words with hyphen characters by spell checker
|
|
||||||
instead of by work breaking code of OpenOffice.org. With this feature
|
|
||||||
it's possible to accept hyphenated compound words, such as "scot-free",
|
|
||||||
where "scot" is not a correct English word.
|
|
||||||
|
|
||||||
- ICONV & OCONV: input and output conversion tables for optional character
|
|
||||||
handling or using special inner format. Example:
|
|
||||||
|
|
||||||
# Accepting de facto replacements of the Romanian comma acuted letters
|
|
||||||
SET UTF-8
|
|
||||||
ICONV 4
|
|
||||||
ICONV ÅŸ È™
|
|
||||||
ICONV ţ ț
|
|
||||||
ICONV Ş Ș
|
|
||||||
ICONV Ţ Ț
|
|
||||||
|
|
||||||
Typical usage of ICONV/OCONV is to manage an inner format for a segmental
|
|
||||||
writing system, like the Ethiopic script of the Amharic language.
|
|
||||||
|
|
||||||
- Extended CHECKCOMPOUNDPATTERN to handle conpound word alternations, like
|
|
||||||
sandhi feature of Telugu and other writing systems.
|
|
||||||
|
|
||||||
- SIMPLIFIEDTRIPLE compound word feature: allow simplified Swedish and
|
|
||||||
Norwegian compound word forms, like tillåta (till|låta) and
|
|
||||||
bussjåfør (buss|sjåfør)
|
|
||||||
|
|
||||||
- wordforms: word generator script for dictionary developers (Hunspell
|
|
||||||
version of unmunch).
|
|
||||||
|
|
||||||
- bug fixes
|
|
||||||
|
|
||||||
2008-08-15: Hunspell 1.2.7 release:
|
|
||||||
- FULLSTRIP: new option for affix handling. With FULLSTRIP, affix rules can
|
|
||||||
strip full words, not only one less characters.
|
|
||||||
- COMPOUNDRULE works with all flag types. (COMPOUNDRULE is for pattern
|
|
||||||
matching. For example, en_US dictionary of OpenOffice.org uses COMPOUNDRULE
|
|
||||||
for ordinal number recognition: 1st, 2nd, 11th, 12th, 22nd, 112th, 1000122nd
|
|
||||||
etc.).
|
|
||||||
- optimized suggestions:
|
|
||||||
- modified 1-character distance suggestion algorithms: search a TRY character
|
|
||||||
in all position instead of all TRY characters in a character position
|
|
||||||
(it can give more readable suggestion order, also better suggestions
|
|
||||||
in the first positions, when TRY characters are sorted by frequency.)
|
|
||||||
For example, suggestions for "moze":
|
|
||||||
ooze, doze, Roze, maze, more etc. (Hunspell 1.2.6),
|
|
||||||
maze, more, mote, ooze, mole etc. (Hunspell 1.2.7).
|
|
||||||
- extended compound word checking for better COMPOUNDRULE related
|
|
||||||
suggestions, for example English ordinal numbers: 121323th -> 121323rd
|
|
||||||
(it needs also a th->rd REP definition).
|
|
||||||
- bug fixes
|
|
||||||
|
|
||||||
2008-07-15: Hunspell 1.2.6 release:
|
|
||||||
- bug fix release (fix affix rule condition checking of sk_SK dictionary,
|
|
||||||
iconv support in stemming and morphological analysis of the Hunspell
|
|
||||||
utility, see also Changelog)
|
|
||||||
|
|
||||||
2008-07-09: Hunspell 1.2.5 release:
|
|
||||||
- bug fix release (fix affix rule condition checking of en_GB dictionary,
|
|
||||||
also morphological analysis by dictionaries with two-level suffixes)
|
|
||||||
|
|
||||||
2008-06-18: Hunspell 1.2.4-2 release:
|
|
||||||
- fix GCC compiler warnings
|
|
||||||
|
|
||||||
2008-06-17: Hunspell 1.2.4 release:
|
|
||||||
- add free_list() for C, C++ interfaces to deallocate suggestion lists
|
|
||||||
|
|
||||||
- bug fixes
|
|
||||||
|
|
||||||
2008-06-17: Hunspell 1.2.3 release:
|
|
||||||
- extended XML interface to use morphological functions by standard
|
|
||||||
spell checking interface, spell() and suggest(). See hunspell.3 manual page.
|
|
||||||
|
|
||||||
- default dash suggestions for compound words: newword-> new word and new-word
|
|
||||||
|
|
||||||
- new manual pages: hunspell.3, hzip.1, hunzip.1.
|
|
||||||
|
|
||||||
- bug fixes
|
|
||||||
|
|
||||||
2008-04-12: Hunspell 1.2.2 release:
|
|
||||||
- extended dictionary (dic file) support to use multiple base and
|
|
||||||
special dictionaries.
|
|
||||||
|
|
||||||
- new and improved options of command line hunspell:
|
|
||||||
-m: morphological analysis or flag debug mode (without affix
|
|
||||||
rule data it signs the flag of the affix rules)
|
|
||||||
-s: stemming mode
|
|
||||||
-D: list available dictionaries and search path
|
|
||||||
-d: support extra dictionaries by comma separated list. Example:
|
|
||||||
|
|
||||||
hunspell -d en_US,en_med,de_DE,de_med,de_geo UNESCO.txt
|
|
||||||
|
|
||||||
- forbidding in personal dictionary (with asterisk, / signs affixation)
|
|
||||||
|
|
||||||
- optional compressed dictionary format "hzip" for aff and dic files
|
|
||||||
usage:
|
|
||||||
hzip example.aff example.dic
|
|
||||||
mv example.aff example.dic /tmp
|
|
||||||
hunspell -d example
|
|
||||||
hunzip example.aff.hz >example.aff
|
|
||||||
hunzip example.dic.hz >example.dic
|
|
||||||
|
|
||||||
- new affix compression tool "affixcompress": compression tool for
|
|
||||||
large (millions of words) dictionaries.
|
|
||||||
|
|
||||||
- support encrypted dictionaries for closed OpenOffice.org extensions or
|
|
||||||
other commercial programs
|
|
||||||
|
|
||||||
- improved manual
|
|
||||||
|
|
||||||
- bug fixes
|
|
||||||
|
|
||||||
2007-11-01: Hunspell 1.2.1 release:
|
|
||||||
- new memory efficient condition checking algorithm for affix rules
|
|
||||||
|
|
||||||
- new morphological functions:
|
|
||||||
- stem() for stemming
|
|
||||||
- analyze() for morphological analysis
|
|
||||||
- generate() for morphological generation
|
|
||||||
|
|
||||||
- new demos:
|
|
||||||
- analyze: stemming, morphological analysis and generation
|
|
||||||
- chmorph: morphological conversion of texts
|
|
||||||
|
|
||||||
2007-09-05: Hunspell 1.1.12 release:
|
|
||||||
- dictionary based phonetic suggestion for words with
|
|
||||||
special or foreign pronounciation or alternative (bad) transliteration
|
|
||||||
(see Changelog, tests/phone.* and manual).
|
|
||||||
|
|
||||||
- improved data structure and memory optimization for dictionaries
|
|
||||||
with variable count fields
|
|
||||||
|
|
||||||
- bug fixes for Unicode encoding dictionaries and ngram suggestions
|
|
||||||
|
|
||||||
- improved REP suggestions with space: it works without dictionary
|
|
||||||
modification
|
|
||||||
|
|
||||||
- updated and new project files for Windows API
|
|
||||||
|
|
||||||
2007-08-27: Hunspell 1.1.11 release:
|
|
||||||
- portability fixes
|
|
||||||
|
|
||||||
2007-08-23: Hunspell 1.1.10 release:
|
|
||||||
- pronounciation based suggestion using Björn Jacke's original Aspell
|
|
||||||
phonetic transcription algorithm (http://aspell.net), relicensed under
|
|
||||||
GPL/LGPL/MPL tri-license with the permission of the author
|
|
||||||
|
|
||||||
- keyboard base suggestion by KEY (see manual)
|
|
||||||
|
|
||||||
- better time limits for suggestion search
|
|
||||||
|
|
||||||
- test environment for suggestion based on Wikipedia data
|
|
||||||
|
|
||||||
- bug fixes for non standard Mozilla platforms etc.
|
|
||||||
|
|
||||||
2007-07-25: Hunspell 1.1.9 release:
|
|
||||||
- better tokenization:
|
|
||||||
- for URLs, mail addresses and directory paths (default: skip these tokens)
|
|
||||||
- for colons in words (for Finnish and Swedish)
|
|
||||||
|
|
||||||
- new examples:
|
|
||||||
- affixation of personal dictionary words
|
|
||||||
- digits in words
|
|
||||||
|
|
||||||
- bug fixes (see ChangeLog)
|
|
||||||
|
|
||||||
2007-07-16: Hunspell 1.1.8 release:
|
|
||||||
- better Mac OS X/Cygwin and Windows compatibility
|
|
||||||
|
|
||||||
- fix Hunspell's Valgrind environment and memory handling errors
|
|
||||||
detected by Valgrind
|
|
||||||
|
|
||||||
- other bug fixes (see ChangeLog)
|
|
||||||
|
|
||||||
2007-07-06: Hunspell 1.1.7 release:
|
|
||||||
- fix warning messages of OpenOffice.org build
|
|
||||||
|
|
||||||
2007-06-29: Hunspell 1.1.6 release:
|
|
||||||
- check capitalization of the following word forms
|
|
||||||
- words with mixed capitalisation: OpenOffice.org - OPENOFFICE.ORG
|
|
||||||
- allcap words and suffixes: UNICEF's - UNICEF'S
|
|
||||||
- prefixes with apostrophe and proper names: Sant'Elia - SANT'ELIA
|
|
||||||
|
|
||||||
- suggestion for missing sentence spacing: something.The -> something. The
|
|
||||||
|
|
||||||
- Hunspell executable: improved locale support
|
|
||||||
- -i option: custom input encoding
|
|
||||||
- use locale data for default dictionary names.
|
|
||||||
- tools/hunspell.cxx: fix 8-bit tokenization (letters without
|
|
||||||
casing, like ß or Hebrew characters now are handled well)
|
|
||||||
- dictionary search path (automatic detection of OpenOffice.org directories)
|
|
||||||
- DICPATH environmental variable
|
|
||||||
- -D option: show directory path of loaded dictionary
|
|
||||||
|
|
||||||
- patches and bug fixes for Mozilla, OpenOffice.org.
|
|
||||||
|
|
||||||
2007-03-19: Hunspell 1.1.5 release:
|
|
||||||
- optimizations: 10-100% speed up, smaller code size and memory footprint
|
|
||||||
(conditional experimental code and warning messages)
|
|
||||||
|
|
||||||
- extended Unicode support:
|
|
||||||
- non BMP Unicode characters in dictionary words and affixes (except
|
|
||||||
affix rules and conditions)
|
|
||||||
- support BOM sequence in aff and dic files
|
|
||||||
|
|
||||||
- IGNORE feature for Arabic diacritics and other optional characters
|
|
||||||
|
|
||||||
- New edit distance suggestion methods:
|
|
||||||
- capitalisation: nasa -> NASA
|
|
||||||
- long swap: permenant -> permanent
|
|
||||||
- long move: Ghandi -> Gandhi, greatful -> grateful
|
|
||||||
- double two characters: vacacation -> vacation
|
|
||||||
- spaces in REP sug.: REP alot a_lot (NOTE: "a lot" must be a dictionary word)
|
|
||||||
|
|
||||||
- patches and bug fixes for Mozilla, OpenOffice.org, Emacs, MinGW, Aqua,
|
|
||||||
German and Arabic language, etc.
|
|
||||||
|
|
||||||
2006-02-01: Hunspell 1.1.4 release:
|
|
||||||
- Improved suggestion for typical OCR bugs (missing spaces between
|
|
||||||
capitalized words). For example: "aNew" -> "a New".
|
|
||||||
http://qa.openoffice.org/issues/show_bug.cgi?id=58202
|
|
||||||
|
|
||||||
- tokenization fixes (fix incomplete tokenization of input texts on big-endian
|
|
||||||
platforms, and locale-dependent tokenization of dictionary entries)
|
|
||||||
|
|
||||||
2006-01-06: Hunspell 1.1.3.2 release:
|
|
||||||
- fix Visual C++ compiling errors
|
|
||||||
|
|
||||||
2006-01-05: Hunspell 1.1.3 release:
|
|
||||||
- GPL/LGPL/MPL tri-license for Mozilla integration
|
|
||||||
|
|
||||||
- Alias compression of flag sets and morphological descriptions.
|
|
||||||
(For example, 16 MB Arabic dic file can be compressed to 1 MB.)
|
|
||||||
|
|
||||||
- Improved suggestion.
|
|
||||||
|
|
||||||
- Improved, language independent German sharp s casing with CHECKSHARPS
|
|
||||||
declaration.
|
|
||||||
|
|
||||||
- Unicode tokenization in Hunspell program.
|
|
||||||
|
|
||||||
- Bug fixes (at new and old compound word handling methods), etc.
|
|
||||||
|
|
||||||
2005-11-11: Hunspell 1.1.2 release:
|
|
||||||
|
|
||||||
- Bug fixes (MAP Unicode, COMPOUND pattern matching, ONLYINCOMPOUND
|
|
||||||
suggestions)
|
|
||||||
|
|
||||||
- Checked with 51 regression tests in Valgrind debugging environment,
|
|
||||||
and tested with 52 OOo dictionaries on i686-pc-linux platform.
|
|
||||||
|
|
||||||
2005-11-09: Hunspell 1.1.1 release:
|
|
||||||
|
|
||||||
- Compound word patterns for complex compound word handling and
|
|
||||||
simple word-level lexical scanning. Ideal for checking
|
|
||||||
Arabic and Roman numbers, ordinal numbers in English, affixed
|
|
||||||
numbers in agglutinative languages, etc.
|
|
||||||
http://qa.openoffice.org/issues/show_bug.cgi?id=53643
|
|
||||||
|
|
||||||
- Support ISO-8859-15 encoding for French (French oe ligatures are
|
|
||||||
missing from the latin-1 encoding).
|
|
||||||
http://qa.openoffice.org/issues/show_bug.cgi?id=54980
|
|
||||||
|
|
||||||
- Implemented a flag to forbid obscene word suggestion:
|
|
||||||
http://qa.openoffice.org/issues/show_bug.cgi?id=55498
|
|
||||||
|
|
||||||
- Checked with 50 regression tests in Valgrind debugging environment,
|
|
||||||
and tested with 52 OOo dictionaries.
|
|
||||||
|
|
||||||
- other improvements and bug fixes (see ChangeLog)
|
|
||||||
|
|
||||||
2005-09-19: Hunspell 1.1.0 release
|
|
||||||
|
|
||||||
* complete comparison with MySpell 3.2 (from OpenOffice.org 2 beta)
|
|
||||||
|
|
||||||
* improved ngram suggestion with swap character detection and
|
|
||||||
case insensitivity
|
|
||||||
|
|
||||||
------ examples for ngram improvement (input word and suggestions) -----
|
|
||||||
|
|
||||||
1. pernament (instead of permanent)
|
|
||||||
|
|
||||||
MySpell 3.2: tournaments, tournament, ornaments, ornament's, ornamenting, ornamented,
|
|
||||||
ornament, ornamentals, ornamental, ornamentally
|
|
||||||
|
|
||||||
Hunspell 1.0.9: ornamental, ornament, tournament
|
|
||||||
|
|
||||||
Hunspell 1.1.0: permanent
|
|
||||||
|
|
||||||
Note: swap character detection
|
|
||||||
|
|
||||||
|
|
||||||
2. PERNAMENT (instead of PERMANENT)
|
|
||||||
|
|
||||||
MySpell 3.2: -
|
|
||||||
|
|
||||||
Hunspell 1.0.9: -
|
|
||||||
|
|
||||||
Hunspell 1.1.0: PERMANENT
|
|
||||||
|
|
||||||
|
|
||||||
3. Unesco (instead of UNESCO)
|
|
||||||
|
|
||||||
MySpell 3.2: Genesco, Ionesco, Genesco's, Ionesco's, Frescoing, Fresco's,
|
|
||||||
Frescoed, Fresco, Escorts, Escorting
|
|
||||||
|
|
||||||
Hunspell 1.0.9: Genesco, Ionesco, Fresco
|
|
||||||
|
|
||||||
Hunspell 1.1.0: UNESCO
|
|
||||||
|
|
||||||
|
|
||||||
4. siggraph's (instead of SIGGRAPH's)
|
|
||||||
|
|
||||||
MySpell 3.2: serigraph's, photograph's, serigraphs, physiography's,
|
|
||||||
physiography, digraphs, serigraph, stratigraphy's, stratigraphy
|
|
||||||
epigraphs
|
|
||||||
|
|
||||||
Hunspell 1.0.9: serigraph's, epigraph's, digraph's
|
|
||||||
|
|
||||||
Hunspell 1.1.0: SIGGRAPH's
|
|
||||||
|
|
||||||
--------------- end of examples --------------------
|
|
||||||
|
|
||||||
* improved testing environment with suggestion checking and memory debugging
|
|
||||||
|
|
||||||
memory debugging of all tests with a simple command:
|
|
||||||
|
|
||||||
VALGRIND=memcheck make check
|
|
||||||
|
|
||||||
* lots of other improvements and bug fixes (see ChangeLog)
|
|
||||||
|
|
||||||
|
|
||||||
2005-08-26: Hunspell 1.0.9 release
|
|
||||||
|
|
||||||
* improved related character map suggestion
|
|
||||||
|
|
||||||
* improved ngram suggestion
|
|
||||||
|
|
||||||
------ examples for ngram improvement (O=old, N = new ngram suggestions) --
|
|
||||||
|
|
||||||
1. Permenant (instead of Permanent)
|
|
||||||
|
|
||||||
O: Endangerment, Ferment, Fermented, Deferment's, Empowerment,
|
|
||||||
Ferment's, Ferments, Fermenting, Countermen, Weathermen
|
|
||||||
|
|
||||||
N: Permanent, Supermen, Preferment
|
|
||||||
|
|
||||||
Note: Ngram suggestions was case sensitive.
|
|
||||||
|
|
||||||
2. permenant (instead of permanent)
|
|
||||||
|
|
||||||
O: supermen, newspapermen, empowerment, endangerment, preferments,
|
|
||||||
preferment, permanent, preferment's, permanently, impermanent
|
|
||||||
|
|
||||||
N: permanent, supermen, preferment
|
|
||||||
|
|
||||||
Note: new suggestions are also weighted with longest common subsequence,
|
|
||||||
first letter and common character positions
|
|
||||||
|
|
||||||
3. pernemant (instead of permanent)
|
|
||||||
|
|
||||||
O: pimpernel's, pimpernel, pimpernels, permanently, permanents, permanent,
|
|
||||||
supernatant, impermanent, semipermanent, impermanently
|
|
||||||
|
|
||||||
N: permanent, supernatant, pimpernel
|
|
||||||
|
|
||||||
Note: new method also prefers root word instead of not
|
|
||||||
relevant affixes ('s, s and ly)
|
|
||||||
|
|
||||||
|
|
||||||
4. pernament (instead of permanent)
|
|
||||||
|
|
||||||
O: tournaments, tournament, ornaments, ornament's, ornamenting, ornamented,
|
|
||||||
ornament, ornamentals, ornamental, ornamentally
|
|
||||||
|
|
||||||
N: ornamental, ornament, tournament
|
|
||||||
|
|
||||||
Note: Both ngram methods misses here.
|
|
||||||
|
|
||||||
|
|
||||||
5. obvus (instad of obvious):
|
|
||||||
|
|
||||||
O: obvious, Corvus, obverse, obviously, Jacobus, obtuser, obtuse,
|
|
||||||
obviates, obviate, Travus
|
|
||||||
|
|
||||||
N: obvious, obtuse, obverse
|
|
||||||
|
|
||||||
Note: new method also prefers common first letters.
|
|
||||||
|
|
||||||
|
|
||||||
6. unambigus (instead of unambiguous)
|
|
||||||
|
|
||||||
O: unambiguous, unambiguity, unambiguously, ambiguously, ambiguous,
|
|
||||||
unambitious, ambiguities, ambiguousness
|
|
||||||
|
|
||||||
N: unambiguous, unambiguity, unambitious
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
7. consecvence (instead of consequence)
|
|
||||||
|
|
||||||
O: consecutive, consecutively, consecutiveness, nonconsecutive, consequence,
|
|
||||||
consecutiveness's, convenience's, consistences, consistence
|
|
||||||
|
|
||||||
N: consequence, consecutive, consecrates
|
|
||||||
|
|
||||||
|
|
||||||
An example in a language with rich morphology:
|
|
||||||
|
|
||||||
8. Misisipiben (instead of Mississippiben [`in Mississippi' in Hungarian]):
|
|
||||||
|
|
||||||
O: Misikédéiben, Pisisedéiben, Misikéiéiben, Pisisekéiben, Misikéiben,
|
|
||||||
Misikéidéiben, Misikékéiben, Misikéikéiben, Misikéiméiben, Mississippiiben
|
|
||||||
|
|
||||||
N: Mississippiben, Mississippiiben, Misiiben
|
|
||||||
|
|
||||||
Note: Suggesting not relevant affixes was the biggest fault in ngram
|
|
||||||
suggestion for languages with a lot of affixes.
|
|
||||||
|
|
||||||
--------------- end of examples --------------------
|
|
||||||
|
|
||||||
* support twofold prefix cutting
|
|
||||||
|
|
||||||
* lots of other improvements and bug fixes (see ChangeLog)
|
|
||||||
|
|
||||||
* test Hunspell with 54 OpenOffice.org dictionaries:
|
|
||||||
|
|
||||||
source: ftp://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries
|
|
||||||
|
|
||||||
testing shell script:
|
|
||||||
-------------------------------------------------------
|
|
||||||
for i in `ls *zip | grep '^[a-z]*_[A-Z]*[.]'`
|
|
||||||
do
|
|
||||||
dic=`basename $i .zip`
|
|
||||||
mkdir $dic
|
|
||||||
echo unzip $dic
|
|
||||||
unzip -d $dic $i 2>/dev/null
|
|
||||||
cd $dic
|
|
||||||
echo unmunch and test $dic
|
|
||||||
unmunch $dic.dic $dic.aff 2>/dev/null | awk '{print$0"\t"}' |
|
|
||||||
hunspell -d $dic -l -1 >$dic.result 2>$dic.err || rm -f $dic.result
|
|
||||||
cd ..
|
|
||||||
done
|
|
||||||
--------------------------------------------------------
|
|
||||||
|
|
||||||
test result (0 size is o.k.):
|
|
||||||
|
|
||||||
$ for i in *_*/*.result; do wc -c $i; done
|
|
||||||
0 af_ZA/af_ZA.result
|
|
||||||
0 bg_BG/bg_BG.result
|
|
||||||
0 ca_ES/ca_ES.result
|
|
||||||
0 cy_GB/cy_GB.result
|
|
||||||
0 cs_CZ/cs_CZ.result
|
|
||||||
0 da_DK/da_DK.result
|
|
||||||
0 de_AT/de_AT.result
|
|
||||||
0 de_CH/de_CH.result
|
|
||||||
0 de_DE/de_DE.result
|
|
||||||
0 el_GR/el_GR.result
|
|
||||||
6 en_AU/en_AU.result
|
|
||||||
0 en_CA/en_CA.result
|
|
||||||
0 en_GB/en_GB.result
|
|
||||||
0 en_NZ/en_NZ.result
|
|
||||||
0 en_US/en_US.result
|
|
||||||
0 eo_EO/eo_EO.result
|
|
||||||
0 es_ES/es_ES.result
|
|
||||||
0 es_MX/es_MX.result
|
|
||||||
0 es_NEW/es_NEW.result
|
|
||||||
0 fo_FO/fo_FO.result
|
|
||||||
0 fr_FR/fr_FR.result
|
|
||||||
0 ga_IE/ga_IE.result
|
|
||||||
0 gd_GB/gd_GB.result
|
|
||||||
0 gl_ES/gl_ES.result
|
|
||||||
0 he_IL/he_IL.result
|
|
||||||
0 hr_HR/hr_HR.result
|
|
||||||
200694989 hu_HU/hu_HU.result
|
|
||||||
0 id_ID/id_ID.result
|
|
||||||
0 it_IT/it_IT.result
|
|
||||||
0 ku_TR/ku_TR.result
|
|
||||||
0 lt_LT/lt_LT.result
|
|
||||||
0 lv_LV/lv_LV.result
|
|
||||||
0 mg_MG/mg_MG.result
|
|
||||||
0 mi_NZ/mi_NZ.result
|
|
||||||
0 ms_MY/ms_MY.result
|
|
||||||
0 nb_NO/nb_NO.result
|
|
||||||
0 nl_NL/nl_NL.result
|
|
||||||
0 nn_NO/nn_NO.result
|
|
||||||
0 ny_MW/ny_MW.result
|
|
||||||
0 pl_PL/pl_PL.result
|
|
||||||
0 pt_BR/pt_BR.result
|
|
||||||
0 pt_PT/pt_PT.result
|
|
||||||
0 ro_RO/ro_RO.result
|
|
||||||
0 ru_RU/ru_RU.result
|
|
||||||
0 rw_RW/rw_RW.result
|
|
||||||
0 sk_SK/sk_SK.result
|
|
||||||
0 sl_SI/sl_SI.result
|
|
||||||
0 sv_SE/sv_SE.result
|
|
||||||
0 sw_KE/sw_KE.result
|
|
||||||
0 tet_ID/tet_ID.result
|
|
||||||
0 tl_PH/tl_PH.result
|
|
||||||
0 tn_ZA/tn_ZA.result
|
|
||||||
0 uk_UA/uk_UA.result
|
|
||||||
0 zu_ZA/zu_ZA.result
|
|
||||||
|
|
||||||
In en_AU dictionary, there is an abbrevation with two dots (`eqn..'), but
|
|
||||||
`eqn.' is missing. Presumably it is a dictionary bug. Myspell also
|
|
||||||
haven't accepted it.
|
|
||||||
|
|
||||||
Hungarian dictionary contains pseudoroots and forbidden words.
|
|
||||||
Unmunch haven't supported these features yet, and generates bad words, too.
|
|
||||||
|
|
||||||
* check affix rules and OOo dictionaries. Detected bugs in cs_CZ,
|
|
||||||
es_ES, es_NEW, es_MX, lt_LT, nn_NO, pt_PT, ro_RO, sk_SK and sv_SE dictionaries).
|
|
||||||
|
|
||||||
Details:
|
|
||||||
--------------------------------------------------------
|
|
||||||
cs_CZ
|
|
||||||
warning - incompatible stripping characters and condition:
|
|
||||||
SFX D us ech [^ighk]os
|
|
||||||
SFX D us y [^i]os
|
|
||||||
SFX Q os ech [^ghk]es
|
|
||||||
SFX M o ech [^ghkei]a
|
|
||||||
SFX J ém ej ám
|
|
||||||
SFX J ém ejme ám
|
|
||||||
SFX J ém ejte ám
|
|
||||||
SFX A ou¾it up oupit
|
|
||||||
SFX A ou¾it upme oupit
|
|
||||||
SFX A ou¾it upte oupit
|
|
||||||
SFX A nout l [aeiouyáéíóúýùìr][^aeiouyáéíóúýùìrl][^aeiouy
|
|
||||||
SFX A nout l [aeiouyáéíóúýùìr][^aeiouyáéíóúýùìrl][^aeiouy
|
|
||||||
|
|
||||||
es_ES
|
|
||||||
warning - incompatible stripping characters and condition:
|
|
||||||
SFX W umar úse [ae]husar
|
|
||||||
SFX W emir iñáis eñir
|
|
||||||
|
|
||||||
es_NEW
|
|
||||||
warning - incompatible stripping characters and condition:
|
|
||||||
SFX I unan únen unar
|
|
||||||
|
|
||||||
es_MX
|
|
||||||
warning - incompatible stripping characters and condition:
|
|
||||||
SFX A a ote e
|
|
||||||
SFX W umar úse [ae]husar
|
|
||||||
SFX W emir iñáis eñir
|
|
||||||
|
|
||||||
lt_LT
|
|
||||||
warning - incompatible stripping characters and condition:
|
|
||||||
SFX U ti siuosi tis
|
|
||||||
SFX U ti siuosi tis
|
|
||||||
SFX U ti siesi tis
|
|
||||||
SFX U ti siesi tis
|
|
||||||
SFX U ti sis tis
|
|
||||||
SFX U ti sis tis
|
|
||||||
SFX U ti simës tis
|
|
||||||
SFX U ti simës tis
|
|
||||||
SFX U ti sitës tis
|
|
||||||
SFX U ti sitës tis
|
|
||||||
|
|
||||||
nn_NO
|
|
||||||
warning - incompatible stripping characters and condition:
|
|
||||||
SFX D ar rar [^fmk]er
|
|
||||||
SFX U Øre orde ere
|
|
||||||
SFX U Øre ort ere
|
|
||||||
|
|
||||||
pt_PT
|
|
||||||
warning - incompatible stripping characters and condition:
|
|
||||||
SFX g ãos oas ão
|
|
||||||
SFX g ãos oas ão
|
|
||||||
|
|
||||||
ro_RO
|
|
||||||
warning - bad field number:
|
|
||||||
SFX L 0 le [^cg] i
|
|
||||||
SFX L 0 i [cg] i
|
|
||||||
SFX U 0 i [^i] ii
|
|
||||||
warning - incompatible stripping characters and condition:
|
|
||||||
SFX P l i l [<- there is an unnecessary tabulator here)
|
|
||||||
SFX I a ii [gc] a
|
|
||||||
warning - bad field number:
|
|
||||||
SFX I a ii [gc] a
|
|
||||||
SFX I a ei [^cg] a
|
|
||||||
|
|
||||||
sk_SK
|
|
||||||
warning - incompatible stripping characters and condition:
|
|
||||||
SFX T µa» olú kla»
|
|
||||||
SFX T µa» olúc kla»
|
|
||||||
SFX T sµa» ¹lú sla»
|
|
||||||
SFX T sµa» ¹lúc sla»
|
|
||||||
SFX R µc» lèiem åc»
|
|
||||||
SFX R iás» ätie mias»
|
|
||||||
SFX R iez» iem [^i]ez»
|
|
||||||
SFX R iez» ie¹ [^i]ez»
|
|
||||||
SFX R iez» ie [^i]ez»
|
|
||||||
SFX R iez» eme [^i]ez»
|
|
||||||
SFX R iez» ete [^i]ez»
|
|
||||||
SFX R iez» ú [^i]ez»
|
|
||||||
SFX R iez» úc [^i]ez»
|
|
||||||
SFX R iez» z [^i]ez»
|
|
||||||
SFX R iez» me [^i]ez»
|
|
||||||
SFX R iez» te [^i]ez»
|
|
||||||
|
|
||||||
sv_SE
|
|
||||||
warning - bad field number:
|
|
||||||
SFX C 0 net nets [^e]n
|
|
||||||
--------------------------------------------------------
|
|
||||||
|
|
||||||
2005-08-01: Hunspell 1.0.8 release
|
|
||||||
|
|
||||||
- improved compound word support
|
|
||||||
- fix German S handling
|
|
||||||
- port MySpell files and MAP feature
|
|
||||||
|
|
||||||
2005-07-22: Hunspell 1.0.7 release
|
|
||||||
|
|
||||||
2005-07-21: new home page: http://hunspell.sourceforge.net
|
|
|
@ -1,182 +0,0 @@
|
||||||
About Hunspell
|
|
||||||
--------------
|
|
||||||
|
|
||||||
Hunspell is a spell checker and morphological analyzer library and program
|
|
||||||
designed for languages with rich morphology and complex word compounding or
|
|
||||||
character encoding. Hunspell interfaces: Ispell-like terminal interface
|
|
||||||
using Curses library, Ispell pipe interface, OpenOffice.org UNO module.
|
|
||||||
|
|
||||||
Hunspell's code base comes from the OpenOffice.org MySpell
|
|
||||||
(http://lingucomponent.openoffice.org/MySpell-3.zip). See README.MYSPELL,
|
|
||||||
AUTHORS.MYSPELL and license.myspell files.
|
|
||||||
Hunspell is designed to eventually replace Myspell in OpenOffice.org.
|
|
||||||
|
|
||||||
Main features of Hunspell spell checker and morphological analyzer:
|
|
||||||
|
|
||||||
- Unicode support (affix rules work only with the first 65535 Unicode characters)
|
|
||||||
|
|
||||||
- Morphological analysis (in custom item and arrangement style) and stemming
|
|
||||||
|
|
||||||
- Max. 65535 affix classes and twofold affix stripping (for agglutinative
|
|
||||||
languages, like Azeri, Basque, Estonian, Finnish, Hungarian, Turkish, etc.)
|
|
||||||
|
|
||||||
- Support complex compoundings (for example, Hungarian and German)
|
|
||||||
|
|
||||||
- Support language specific features (for example, special casing of
|
|
||||||
Azeri and Turkish dotted i, or German sharp s)
|
|
||||||
|
|
||||||
- Handle conditional affixes, circumfixes, fogemorphemes,
|
|
||||||
forbidden words, pseudoroots and homonyms.
|
|
||||||
|
|
||||||
- Free software (LGPL, GPL, MPL tri-license)
|
|
||||||
|
|
||||||
Compiling on Unix/Linux
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
|
|
||||||
For dictionary development, use the --with-warnings option of configure.
|
|
||||||
|
|
||||||
For interactive user interface of Hunspell executable, use the --with-ui option.
|
|
||||||
|
|
||||||
The developer packages you need to compile Hunspell's interface:
|
|
||||||
|
|
||||||
glibc-devel
|
|
||||||
|
|
||||||
optional developer packages:
|
|
||||||
|
|
||||||
ncurses (need for --with-ui), eg. libncursesw5 for UTF-8
|
|
||||||
readline (for fancy input line editing,
|
|
||||||
configure parameter: --with-readline)
|
|
||||||
locale and gettext (but you can also use the
|
|
||||||
--with-included-gettext configure parameter)
|
|
||||||
|
|
||||||
Hunspell distribution uses new Autoconf (2.59) and Automake (1.9).
|
|
||||||
|
|
||||||
Compiling on Windows
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
1. Compiling with Windows SDK
|
|
||||||
|
|
||||||
Download the free Windows SDK of Microsoft, open a command prompt
|
|
||||||
window and cd into hunspell/src/win_api. Use the following command
|
|
||||||
to compile hunspell:
|
|
||||||
|
|
||||||
vcbuild
|
|
||||||
|
|
||||||
2. Compiling in Cygwin environment
|
|
||||||
|
|
||||||
Download and install Cygwin environment for Windows with the following
|
|
||||||
extra packages:
|
|
||||||
|
|
||||||
make
|
|
||||||
gcc-g++ development package
|
|
||||||
mingw development package (for cygwin.dll free native Windows compilation)
|
|
||||||
ncurses, readline (for user interface)
|
|
||||||
iconv (character conversion)
|
|
||||||
|
|
||||||
2.1. Cygwin1.dll dependent compiling
|
|
||||||
|
|
||||||
Open a Cygwin shell, cd into the hunspell root directory:
|
|
||||||
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
|
|
||||||
For dictionary development, use the --with-warnings option of configure.
|
|
||||||
|
|
||||||
For interactive user interface of Hunspell executable, use the --with-ui option.
|
|
||||||
|
|
||||||
readline configure parameter: --with-readline (for fancy input line editing)
|
|
||||||
|
|
||||||
1.2. Cygwin1.dll free compiling
|
|
||||||
|
|
||||||
Open a Cygwin shell, cd into the hunspell/src/win_api and
|
|
||||||
|
|
||||||
make -f Makefile.cygwin
|
|
||||||
|
|
||||||
Testing
|
|
||||||
-------
|
|
||||||
|
|
||||||
Testing Hunspell (see tests in tests/ subdirectory):
|
|
||||||
|
|
||||||
make check
|
|
||||||
|
|
||||||
or with Valgrind debugger:
|
|
||||||
|
|
||||||
make check
|
|
||||||
VALGRIND=[Valgrind_tool] make check
|
|
||||||
|
|
||||||
For example:
|
|
||||||
|
|
||||||
make check
|
|
||||||
VALGRIND=memcheck make check
|
|
||||||
|
|
||||||
Documentation
|
|
||||||
-------------
|
|
||||||
|
|
||||||
features and dictionary format:
|
|
||||||
man 5 hunspell
|
|
||||||
|
|
||||||
man hunspell
|
|
||||||
hunspell -h
|
|
||||||
http://hunspell.sourceforge.net
|
|
||||||
|
|
||||||
Usage
|
|
||||||
-----
|
|
||||||
|
|
||||||
The src/tools dictionary contains ten executables after compiling
|
|
||||||
(or some of them are in the src/win_api):
|
|
||||||
|
|
||||||
affixcompress: dictionary generation from large (millions of words) vocabularies
|
|
||||||
analyze: example of spell checking, stemming and morphological analysis
|
|
||||||
chmorph: example of automatic morphological generation and conversion
|
|
||||||
example: example of spell checking and suggestion
|
|
||||||
hunspell: main program for spell checking and others (see manual)
|
|
||||||
hunzip: decompressor of hzip format
|
|
||||||
hzip: compressor of hzip format
|
|
||||||
makealias: alias compression (Hunspell only, not back compatible with MySpell)
|
|
||||||
munch: dictionary generation from vocabularies (it needs an affix file, too).
|
|
||||||
unmunch: list all recognized words of a MySpell dictionary
|
|
||||||
wordforms: word generation (Hunspell version of unmunch)
|
|
||||||
|
|
||||||
After compiling and installing (see INSTALL) you can
|
|
||||||
run the Hunspell spell checker (compiled with user interface)
|
|
||||||
with a Hunspell or Myspell dictionary:
|
|
||||||
|
|
||||||
hunspell -d en_US text.txt
|
|
||||||
|
|
||||||
or without interface:
|
|
||||||
|
|
||||||
hunspell
|
|
||||||
hunspell -d en_UK -l <text.txt
|
|
||||||
|
|
||||||
Dictionaries consist of an affix and dictionary file, see tests/
|
|
||||||
or http://wiki.services.openoffice.org/wiki/Dictionaries.
|
|
||||||
|
|
||||||
Using Hunspell library with GCC
|
|
||||||
-------------------------------
|
|
||||||
|
|
||||||
Including in your program:
|
|
||||||
#include <hunspell.hxx>
|
|
||||||
|
|
||||||
Linking with Hunspell static library:
|
|
||||||
g++ -lhunspell example.cxx
|
|
||||||
|
|
||||||
Dictionaries
|
|
||||||
------------
|
|
||||||
|
|
||||||
Myspell & Hunspell dictionaries:
|
|
||||||
http://extensions.libreoffice.org
|
|
||||||
http://cgit.freedesktop.org/libreoffice/dictionaries
|
|
||||||
http://extensions.openoffice.org
|
|
||||||
http://wiki.services.openoffice.org/wiki/Dictionaries
|
|
||||||
|
|
||||||
Aspell dictionaries (need some conversion):
|
|
||||||
ftp://ftp.gnu.org/gnu/aspell/dict
|
|
||||||
Conversion steps: see relevant feature request at http://hunspell.sf.net.
|
|
||||||
|
|
||||||
László Németh
|
|
||||||
nemeth at numbertext org
|
|
|
@ -1,69 +0,0 @@
|
||||||
MySpell is a simple spell checker that uses affix
|
|
||||||
compression and is modelled after the spell checker
|
|
||||||
ispell.
|
|
||||||
|
|
||||||
MySpell was written to explore how affix compression
|
|
||||||
can be implemented.
|
|
||||||
|
|
||||||
The Main features of MySpell are:
|
|
||||||
|
|
||||||
1. written in C++ to make it easier to interface with
|
|
||||||
Pspell, OpenOffice, AbiWord, etc
|
|
||||||
|
|
||||||
2. it is stateless, uses no static variables and
|
|
||||||
should be completely reentrant with almost no
|
|
||||||
ifdefs
|
|
||||||
|
|
||||||
3. it tries to be as compatible with ispell to
|
|
||||||
the extent it can. It can read slightly modified
|
|
||||||
versions of munched ispell dictionaries (and it
|
|
||||||
comes with a munched english wordlist borrowed from
|
|
||||||
Kevin Atkinson's excellent Aspell.
|
|
||||||
|
|
||||||
4. it uses a heavily modified aff file format that
|
|
||||||
can be derived from ispell aff files but uses
|
|
||||||
the iso-8859-X character sets only
|
|
||||||
|
|
||||||
5. it is simple with *lots* of comments that
|
|
||||||
describes how the affixes are stored
|
|
||||||
and tested for (based on the approach used by
|
|
||||||
ispell).
|
|
||||||
|
|
||||||
6. it supports improved suggestions with replacement
|
|
||||||
tables and ngram-scoring based mechanisms in addition
|
|
||||||
to the main suggestion mechanisms
|
|
||||||
|
|
||||||
7. like ispell it has a BSD license (and no
|
|
||||||
advertising clause)
|
|
||||||
|
|
||||||
But ... it has *no* support for adding words
|
|
||||||
to a personal dictionary, *no* support for converting
|
|
||||||
between various text encodings, and *no* command line
|
|
||||||
interface (it is purely meant to be a library).
|
|
||||||
|
|
||||||
It can not (in any way) replace all of the functionality
|
|
||||||
of ispell or aspell/pspell. It is meant as a learning
|
|
||||||
tool for understanding affix compression and for
|
|
||||||
being used by front ends like OpenOffice, Abiword, etc.
|
|
||||||
|
|
||||||
MySpell has been tested under Linux and Solaris
|
|
||||||
and has the world's simplest Makefile and no
|
|
||||||
configure support.
|
|
||||||
|
|
||||||
It does come with a simple example program that
|
|
||||||
spell checks some words and returns suggestions.
|
|
||||||
|
|
||||||
To build a static library and an example
|
|
||||||
program under Linux simply type:
|
|
||||||
|
|
||||||
tar -zxvf myspell.tar.gz
|
|
||||||
cd myspell2
|
|
||||||
make
|
|
||||||
|
|
||||||
To run the example program:
|
|
||||||
./example ./en_US.aff ./en_US.dic checkme.lst
|
|
||||||
|
|
||||||
Please play around with it and let me know
|
|
||||||
what you think.
|
|
||||||
|
|
||||||
Please see the file CONTRIBUTORS for more info.
|
|
|
@ -1,136 +0,0 @@
|
||||||
Many thanks to the following contributors and supporters:
|
|
||||||
|
|
||||||
Mehmet Akin
|
|
||||||
Göran Andersson
|
|
||||||
Lars Aronsson
|
|
||||||
Ruud Baars
|
|
||||||
Bartkó Zoltán
|
|
||||||
Mathias Bauer
|
|
||||||
Bencsáth Boldizsár
|
|
||||||
Bíró Árpád
|
|
||||||
Ingo H. de Boer
|
|
||||||
Simon Brouwer
|
|
||||||
Jeppe Bundsgaard
|
|
||||||
Ginn Chen
|
|
||||||
Tomáš Chvátal
|
|
||||||
Aaron Digulla
|
|
||||||
Dmitri Gabinski
|
|
||||||
Dvornik László
|
|
||||||
David Einstein
|
|
||||||
Rene Engelhard
|
|
||||||
Frederik Fouvry
|
|
||||||
Flemming Frandsen
|
|
||||||
Serge Gautherie
|
|
||||||
Marek Gleń
|
|
||||||
Gavins at OOo
|
|
||||||
Gefferth András
|
|
||||||
Godó Ferenc
|
|
||||||
Goldman Eleonóra
|
|
||||||
Steinar H. Gunderson
|
|
||||||
Halácsy Péter
|
|
||||||
Chris Halls
|
|
||||||
Khaled Hosny
|
|
||||||
Izsók András
|
|
||||||
Björn Jacke
|
|
||||||
Mike Tian-Jian Jiang
|
|
||||||
Dafydd Jones
|
|
||||||
Ryan Jones
|
|
||||||
Jean-Christophe Helary
|
|
||||||
Kevin Hendricks
|
|
||||||
Martin Hollmichel
|
|
||||||
Pavel Janík
|
|
||||||
John Winters
|
|
||||||
Mohamed Kebdani
|
|
||||||
Kelemen Gábor
|
|
||||||
Shewangizaw Gulilat
|
|
||||||
Kéménczy Kálmán
|
|
||||||
Dan Kenigsberg
|
|
||||||
Pham Ngoc Khanh
|
|
||||||
Khiraly László
|
|
||||||
Koblinger Egmont
|
|
||||||
Kornai András
|
|
||||||
Tor Lillqvist
|
|
||||||
Christian Lohmaier
|
|
||||||
Robert Longson
|
|
||||||
Marot at SF dot net
|
|
||||||
Mark McClain
|
|
||||||
Caolan McNamara
|
|
||||||
Michael Meeks
|
|
||||||
Moheb Mekhaiel
|
|
||||||
Laurie Mercer
|
|
||||||
Ladislav Michnovič
|
|
||||||
Ellis Miller
|
|
||||||
Giuseppe Modugno
|
|
||||||
János Mohácsi
|
|
||||||
Bram Moolenaar
|
|
||||||
Daniel Naber
|
|
||||||
Nagy Viktor
|
|
||||||
John Nisly
|
|
||||||
Noll János
|
|
||||||
S Page
|
|
||||||
Christophe Paris
|
|
||||||
Malcolm Parsons
|
|
||||||
Sylvain Paschein
|
|
||||||
Volkov Peter
|
|
||||||
Bryan Petty
|
|
||||||
Harri Pitkänen
|
|
||||||
Davide Prina
|
|
||||||
Kevin F. Quinn
|
|
||||||
Erdal Ronahi
|
|
||||||
Olivier Ronez
|
|
||||||
Bernhard Rosenkraenzer
|
|
||||||
Sarlós Tamás
|
|
||||||
Thobias Schlemmer
|
|
||||||
Jan Seeger
|
|
||||||
Jose da Silva
|
|
||||||
Paulo Ney de Souza
|
|
||||||
Roland Smith
|
|
||||||
Munzir Taha
|
|
||||||
Timeless at bemail dot org
|
|
||||||
Tímár András
|
|
||||||
Tonal at OOo
|
|
||||||
Török László
|
|
||||||
Trón Viktor
|
|
||||||
Gianluca Turconi
|
|
||||||
Ryan VanderMeulen
|
|
||||||
Varga Dániel
|
|
||||||
Elio Voci
|
|
||||||
Miha Vrhovnik
|
|
||||||
Martijn Wargers
|
|
||||||
Michel Weimerskirch
|
|
||||||
Brett Wilson
|
|
||||||
Friedel Wolff
|
|
||||||
Daniel Yacob
|
|
||||||
Gábor Zahemszky
|
|
||||||
Taha Zerrouki
|
|
||||||
and others (see also AUTHORS.myspell)
|
|
||||||
|
|
||||||
FSF.hu Foundation
|
|
||||||
http://www.fsf.hu
|
|
||||||
|
|
||||||
LibreOffice community
|
|
||||||
http://www.libreoffice.org
|
|
||||||
|
|
||||||
MOKK Research Centre
|
|
||||||
Budapest University of Technology and Economics
|
|
||||||
Sociology and Communications Department
|
|
||||||
http://www.mokk.bme.hu
|
|
||||||
|
|
||||||
Hungarian Ministry of Informatics and Telecommunications
|
|
||||||
|
|
||||||
IMEDIA Kft.
|
|
||||||
http://www.imedia.hu
|
|
||||||
|
|
||||||
OpenOffice.org community
|
|
||||||
http://www.openoffice.org
|
|
||||||
|
|
||||||
OpenTaal Foundation, Netherlands and
|
|
||||||
Dutch Language Union (Nederlandse Taalunie)
|
|
||||||
http://opentaal.org
|
|
||||||
|
|
||||||
UHU-Linux Kft.
|
|
||||||
|
|
||||||
Thanks,
|
|
||||||
|
|
||||||
Németh László
|
|
||||||
nemeth at numbertext org
|
|
|
@ -1,4 +0,0 @@
|
||||||
* shared dictionaries for multi-user environment
|
|
||||||
* improve compound handling
|
|
||||||
* Unicode unmunch (munch)
|
|
||||||
* forbiddenword and pseudoword support in unmunch
|
|
|
@ -1,55 +0,0 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
|
||||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
||||||
* for the specific language governing rights and limitations under the
|
|
||||||
* License.
|
|
||||||
*
|
|
||||||
* The Original Code is Hunspell, based on MySpell.
|
|
||||||
*
|
|
||||||
* The Initial Developers of the Original Code are
|
|
||||||
* Kevin Hendricks (MySpell) and Németh László (Hunspell).
|
|
||||||
* Portions created by the Initial Developers are Copyright (C) 2002-2005
|
|
||||||
* the Initial Developers. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* David Einstein
|
|
||||||
* Davide Prina
|
|
||||||
* Giuseppe Modugno
|
|
||||||
* Gianluca Turconi
|
|
||||||
* Simon Brouwer
|
|
||||||
* Noll János
|
|
||||||
* Bíró Árpád
|
|
||||||
* Goldman Eleonóra
|
|
||||||
* Sarlós Tamás
|
|
||||||
* Bencsáth Boldizsár
|
|
||||||
* Halácsy Péter
|
|
||||||
* Dvornik László
|
|
||||||
* Gefferth András
|
|
||||||
* Nagy Viktor
|
|
||||||
* Varga Dániel
|
|
||||||
* Chris Halls
|
|
||||||
* Rene Engelhard
|
|
||||||
* Bram Moolenaar
|
|
||||||
* Dafydd Jones
|
|
||||||
* Harri Pitkänen
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
|
@ -1,61 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2002 Kevin B. Hendricks, Stratford, Ontario, Canada
|
|
||||||
* And Contributors. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. All modifications to the source code must be clearly marked as
|
|
||||||
* such. Binary redistributions based on modified source code
|
|
||||||
* must be clearly marked as modified versions in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY KEVIN B. HENDRICKS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
||||||
* KEVIN B. HENDRICKS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: A special thanks and credit goes to Geoff Kuenning
|
|
||||||
* the creator of ispell. MySpell's affix algorithms were
|
|
||||||
* based on those of ispell which should be noted is
|
|
||||||
* copyright Geoff Kuenning et.al. and now available
|
|
||||||
* under a BSD style license. For more information on ispell
|
|
||||||
* and affix compression in general, please see:
|
|
||||||
* http://www.cs.ucla.edu/ficus-members/geoff/ispell.html
|
|
||||||
* (the home page for ispell)
|
|
||||||
*
|
|
||||||
* An almost complete rewrite of MySpell for use by
|
|
||||||
* the Mozilla project has been developed by David Einstein
|
|
||||||
* (Deinst@world.std.com). David and I are now
|
|
||||||
* working on parallel development tracks to help
|
|
||||||
* our respective projects (Mozilla and OpenOffice.org
|
|
||||||
* and we will maintain full affix file and dictionary
|
|
||||||
* file compatibility and work on merging our versions
|
|
||||||
* of MySpell back into a single tree. David has been
|
|
||||||
* a significant help in improving MySpell.
|
|
||||||
*
|
|
||||||
* Special thanks also go to La'szlo' Ne'meth
|
|
||||||
* <nemethl@gyorsposta.hu> who is the author of the
|
|
||||||
* Hungarian dictionary and who developed and contributed
|
|
||||||
* the code to support compound words in MySpell
|
|
||||||
* and fixed numerous problems with the encoding
|
|
||||||
* case conversion tables.
|
|
||||||
*
|
|
||||||
*/
|
|
|
@ -1,21 +0,0 @@
|
||||||
Hunspell spell checker and morphological analyser library
|
|
||||||
|
|
||||||
Documentation, tests, examples: http://hunspell.sourceforge.net
|
|
||||||
|
|
||||||
Author of Hunspell:
|
|
||||||
László Németh (nemethl (at) gyorsposta.hu)
|
|
||||||
|
|
||||||
Hunspell based on OpenOffice.org's Myspell. MySpell's author:
|
|
||||||
Kevin Hendricks (kevin.hendricks (at) sympatico.ca)
|
|
||||||
|
|
||||||
License: GPL 2.0/LGPL 2.1/MPL 1.1 tri-license
|
|
||||||
|
|
||||||
The contents of this library may be used under the terms of
|
|
||||||
the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
the GNU Lesser General Public License Version 2.1 or later (the "LGPL",
|
|
||||||
see http://gnu.org/copyleft/lesser.html) or the Mozilla Public License
|
|
||||||
Version 1.1 or later (the "MPL", see http://mozilla.org/MPL/MPL-1.1.html).
|
|
||||||
|
|
||||||
Software distributed under these licenses is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the licences
|
|
||||||
for the specific language governing rights and limitations under the licenses.
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,144 +0,0 @@
|
||||||
#ifndef _AFFIX_HXX_
|
|
||||||
#define _AFFIX_HXX_
|
|
||||||
|
|
||||||
#include "hunvisapi.h"
|
|
||||||
|
|
||||||
#include "atypes.hxx"
|
|
||||||
#include "baseaffix.hxx"
|
|
||||||
#include "affixmgr.hxx"
|
|
||||||
|
|
||||||
/* A Prefix Entry */
|
|
||||||
|
|
||||||
class LIBHUNSPELL_DLL_EXPORTED PfxEntry : protected AffEntry
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
PfxEntry(const PfxEntry&);
|
|
||||||
PfxEntry& operator = (const PfxEntry&);
|
|
||||||
private:
|
|
||||||
AffixMgr* pmyMgr;
|
|
||||||
|
|
||||||
PfxEntry * next;
|
|
||||||
PfxEntry * nexteq;
|
|
||||||
PfxEntry * nextne;
|
|
||||||
PfxEntry * flgnxt;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
PfxEntry(AffixMgr* pmgr, affentry* dp );
|
|
||||||
~PfxEntry();
|
|
||||||
|
|
||||||
inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
|
|
||||||
struct hentry * checkword(const char * word, int len, char in_compound,
|
|
||||||
const FLAG needflag = FLAG_NULL);
|
|
||||||
|
|
||||||
struct hentry * check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL);
|
|
||||||
|
|
||||||
char * check_morph(const char * word, int len, char in_compound,
|
|
||||||
const FLAG needflag = FLAG_NULL);
|
|
||||||
|
|
||||||
char * check_twosfx_morph(const char * word, int len,
|
|
||||||
char in_compound, const FLAG needflag = FLAG_NULL);
|
|
||||||
|
|
||||||
inline FLAG getFlag() { return aflag; }
|
|
||||||
inline const char * getKey() { return appnd; }
|
|
||||||
char * add(const char * word, int len);
|
|
||||||
|
|
||||||
inline short getKeyLen() { return appndl; }
|
|
||||||
|
|
||||||
inline const char * getMorph() { return morphcode; }
|
|
||||||
|
|
||||||
inline const unsigned short * getCont() { return contclass; }
|
|
||||||
inline short getContLen() { return contclasslen; }
|
|
||||||
|
|
||||||
inline PfxEntry * getNext() { return next; }
|
|
||||||
inline PfxEntry * getNextNE() { return nextne; }
|
|
||||||
inline PfxEntry * getNextEQ() { return nexteq; }
|
|
||||||
inline PfxEntry * getFlgNxt() { return flgnxt; }
|
|
||||||
|
|
||||||
inline void setNext(PfxEntry * ptr) { next = ptr; }
|
|
||||||
inline void setNextNE(PfxEntry * ptr) { nextne = ptr; }
|
|
||||||
inline void setNextEQ(PfxEntry * ptr) { nexteq = ptr; }
|
|
||||||
inline void setFlgNxt(PfxEntry * ptr) { flgnxt = ptr; }
|
|
||||||
|
|
||||||
inline char * nextchar(char * p);
|
|
||||||
inline int test_condition(const char * st);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* A Suffix Entry */
|
|
||||||
|
|
||||||
class LIBHUNSPELL_DLL_EXPORTED SfxEntry : protected AffEntry
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
SfxEntry(const SfxEntry&);
|
|
||||||
SfxEntry& operator = (const SfxEntry&);
|
|
||||||
private:
|
|
||||||
AffixMgr* pmyMgr;
|
|
||||||
char * rappnd;
|
|
||||||
|
|
||||||
SfxEntry * next;
|
|
||||||
SfxEntry * nexteq;
|
|
||||||
SfxEntry * nextne;
|
|
||||||
SfxEntry * flgnxt;
|
|
||||||
|
|
||||||
SfxEntry * l_morph;
|
|
||||||
SfxEntry * r_morph;
|
|
||||||
SfxEntry * eq_morph;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
SfxEntry(AffixMgr* pmgr, affentry* dp );
|
|
||||||
~SfxEntry();
|
|
||||||
|
|
||||||
inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
|
|
||||||
struct hentry * checkword(const char * word, int len, int optflags,
|
|
||||||
PfxEntry* ppfx, char ** wlst, int maxSug, int * ns,
|
|
||||||
// const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, char in_compound=IN_CPD_NOT);
|
|
||||||
const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, const FLAG badflag = 0);
|
|
||||||
|
|
||||||
struct hentry * check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);
|
|
||||||
|
|
||||||
char * check_twosfx_morph(const char * word, int len, int optflags,
|
|
||||||
PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
|
|
||||||
struct hentry * get_next_homonym(struct hentry * he);
|
|
||||||
struct hentry * get_next_homonym(struct hentry * word, int optflags, PfxEntry* ppfx,
|
|
||||||
const FLAG cclass, const FLAG needflag);
|
|
||||||
|
|
||||||
|
|
||||||
inline FLAG getFlag() { return aflag; }
|
|
||||||
inline const char * getKey() { return rappnd; }
|
|
||||||
char * add(const char * word, int len);
|
|
||||||
|
|
||||||
|
|
||||||
inline const char * getMorph() { return morphcode; }
|
|
||||||
|
|
||||||
inline const unsigned short * getCont() { return contclass; }
|
|
||||||
inline short getContLen() { return contclasslen; }
|
|
||||||
inline const char * getAffix() { return appnd; }
|
|
||||||
|
|
||||||
inline short getKeyLen() { return appndl; }
|
|
||||||
|
|
||||||
inline SfxEntry * getNext() { return next; }
|
|
||||||
inline SfxEntry * getNextNE() { return nextne; }
|
|
||||||
inline SfxEntry * getNextEQ() { return nexteq; }
|
|
||||||
|
|
||||||
inline SfxEntry * getLM() { return l_morph; }
|
|
||||||
inline SfxEntry * getRM() { return r_morph; }
|
|
||||||
inline SfxEntry * getEQM() { return eq_morph; }
|
|
||||||
inline SfxEntry * getFlgNxt() { return flgnxt; }
|
|
||||||
|
|
||||||
inline void setNext(SfxEntry * ptr) { next = ptr; }
|
|
||||||
inline void setNextNE(SfxEntry * ptr) { nextne = ptr; }
|
|
||||||
inline void setNextEQ(SfxEntry * ptr) { nexteq = ptr; }
|
|
||||||
inline void setFlgNxt(SfxEntry * ptr) { flgnxt = ptr; }
|
|
||||||
|
|
||||||
inline char * nextchar(char * p);
|
|
||||||
inline int test_condition(const char * st, const char * begin);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,252 +0,0 @@
|
||||||
#ifndef _AFFIXMGR_HXX_
|
|
||||||
#define _AFFIXMGR_HXX_
|
|
||||||
|
|
||||||
#include "hunvisapi.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "atypes.hxx"
|
|
||||||
#include "baseaffix.hxx"
|
|
||||||
#include "hashmgr.hxx"
|
|
||||||
#include "phonet.hxx"
|
|
||||||
#include "replist.hxx"
|
|
||||||
|
|
||||||
// check flag duplication
|
|
||||||
#define dupSFX (1 << 0)
|
|
||||||
#define dupPFX (1 << 1)
|
|
||||||
|
|
||||||
class PfxEntry;
|
|
||||||
class SfxEntry;
|
|
||||||
|
|
||||||
class LIBHUNSPELL_DLL_EXPORTED AffixMgr
|
|
||||||
{
|
|
||||||
|
|
||||||
PfxEntry * pStart[SETSIZE];
|
|
||||||
SfxEntry * sStart[SETSIZE];
|
|
||||||
PfxEntry * pFlag[SETSIZE];
|
|
||||||
SfxEntry * sFlag[SETSIZE];
|
|
||||||
HashMgr * pHMgr;
|
|
||||||
HashMgr ** alldic;
|
|
||||||
int * maxdic;
|
|
||||||
char * keystring;
|
|
||||||
char * trystring;
|
|
||||||
char * encoding;
|
|
||||||
struct cs_info * csconv;
|
|
||||||
int utf8;
|
|
||||||
int complexprefixes;
|
|
||||||
FLAG compoundflag;
|
|
||||||
FLAG compoundbegin;
|
|
||||||
FLAG compoundmiddle;
|
|
||||||
FLAG compoundend;
|
|
||||||
FLAG compoundroot;
|
|
||||||
FLAG compoundforbidflag;
|
|
||||||
FLAG compoundpermitflag;
|
|
||||||
int compoundmoresuffixes;
|
|
||||||
int checkcompounddup;
|
|
||||||
int checkcompoundrep;
|
|
||||||
int checkcompoundcase;
|
|
||||||
int checkcompoundtriple;
|
|
||||||
int simplifiedtriple;
|
|
||||||
FLAG forbiddenword;
|
|
||||||
FLAG nosuggest;
|
|
||||||
FLAG nongramsuggest;
|
|
||||||
FLAG needaffix;
|
|
||||||
int cpdmin;
|
|
||||||
int numrep;
|
|
||||||
replentry * reptable;
|
|
||||||
RepList * iconvtable;
|
|
||||||
RepList * oconvtable;
|
|
||||||
int nummap;
|
|
||||||
mapentry * maptable;
|
|
||||||
int numbreak;
|
|
||||||
char ** breaktable;
|
|
||||||
int numcheckcpd;
|
|
||||||
patentry * checkcpdtable;
|
|
||||||
int simplifiedcpd;
|
|
||||||
int numdefcpd;
|
|
||||||
flagentry * defcpdtable;
|
|
||||||
phonetable * phone;
|
|
||||||
int maxngramsugs;
|
|
||||||
int maxcpdsugs;
|
|
||||||
int maxdiff;
|
|
||||||
int onlymaxdiff;
|
|
||||||
int nosplitsugs;
|
|
||||||
int sugswithdots;
|
|
||||||
int cpdwordmax;
|
|
||||||
int cpdmaxsyllable;
|
|
||||||
char * cpdvowels;
|
|
||||||
w_char * cpdvowels_utf16;
|
|
||||||
int cpdvowels_utf16_len;
|
|
||||||
char * cpdsyllablenum;
|
|
||||||
const char * pfxappnd; // BUG: not stateless
|
|
||||||
const char * sfxappnd; // BUG: not stateless
|
|
||||||
FLAG sfxflag; // BUG: not stateless
|
|
||||||
char * derived; // BUG: not stateless
|
|
||||||
SfxEntry * sfx; // BUG: not stateless
|
|
||||||
PfxEntry * pfx; // BUG: not stateless
|
|
||||||
int checknum;
|
|
||||||
char * wordchars;
|
|
||||||
unsigned short * wordchars_utf16;
|
|
||||||
int wordchars_utf16_len;
|
|
||||||
char * ignorechars;
|
|
||||||
unsigned short * ignorechars_utf16;
|
|
||||||
int ignorechars_utf16_len;
|
|
||||||
char * version;
|
|
||||||
char * lang;
|
|
||||||
int langnum;
|
|
||||||
FLAG lemma_present;
|
|
||||||
FLAG circumfix;
|
|
||||||
FLAG onlyincompound;
|
|
||||||
FLAG keepcase;
|
|
||||||
FLAG forceucase;
|
|
||||||
FLAG warn;
|
|
||||||
int forbidwarn;
|
|
||||||
FLAG substandard;
|
|
||||||
int checksharps;
|
|
||||||
int fullstrip;
|
|
||||||
|
|
||||||
int havecontclass; // boolean variable
|
|
||||||
char contclasses[CONTSIZE]; // flags of possible continuing classes (twofold affix)
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
AffixMgr(const char * affpath, HashMgr** ptr, int * md,
|
|
||||||
const char * key = NULL);
|
|
||||||
~AffixMgr();
|
|
||||||
struct hentry * affix_check(const char * word, int len,
|
|
||||||
const unsigned short needflag = (unsigned short) 0,
|
|
||||||
char in_compound = IN_CPD_NOT);
|
|
||||||
struct hentry * prefix_check(const char * word, int len,
|
|
||||||
char in_compound, const FLAG needflag = FLAG_NULL);
|
|
||||||
inline int isSubset(const char * s1, const char * s2);
|
|
||||||
struct hentry * prefix_check_twosfx(const char * word, int len,
|
|
||||||
char in_compound, const FLAG needflag = FLAG_NULL);
|
|
||||||
inline int isRevSubset(const char * s1, const char * end_of_s2, int len);
|
|
||||||
struct hentry * suffix_check(const char * word, int len, int sfxopts,
|
|
||||||
PfxEntry* ppfx, char ** wlst, int maxSug, int * ns,
|
|
||||||
const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL,
|
|
||||||
char in_compound = IN_CPD_NOT);
|
|
||||||
struct hentry * suffix_check_twosfx(const char * word, int len,
|
|
||||||
int sfxopts, PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
|
|
||||||
|
|
||||||
char * affix_check_morph(const char * word, int len,
|
|
||||||
const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT);
|
|
||||||
char * prefix_check_morph(const char * word, int len,
|
|
||||||
char in_compound, const FLAG needflag = FLAG_NULL);
|
|
||||||
char * suffix_check_morph (const char * word, int len, int sfxopts,
|
|
||||||
PfxEntry * ppfx, const FLAG cclass = FLAG_NULL,
|
|
||||||
const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT);
|
|
||||||
|
|
||||||
char * prefix_check_twosfx_morph(const char * word, int len,
|
|
||||||
char in_compound, const FLAG needflag = FLAG_NULL);
|
|
||||||
char * suffix_check_twosfx_morph(const char * word, int len,
|
|
||||||
int sfxopts, PfxEntry * ppfx, const FLAG needflag = FLAG_NULL);
|
|
||||||
|
|
||||||
char * morphgen(char * ts, int wl, const unsigned short * ap,
|
|
||||||
unsigned short al, char * morph, char * targetmorph, int level);
|
|
||||||
|
|
||||||
int expand_rootword(struct guessword * wlst, int maxn, const char * ts,
|
|
||||||
int wl, const unsigned short * ap, unsigned short al, char * bad,
|
|
||||||
int, char *);
|
|
||||||
|
|
||||||
short get_syllable (const char * word, int wlen);
|
|
||||||
int cpdrep_check(const char * word, int len);
|
|
||||||
int cpdpat_check(const char * word, int len, hentry * r1, hentry * r2,
|
|
||||||
const char affixed);
|
|
||||||
int defcpd_check(hentry *** words, short wnum, hentry * rv,
|
|
||||||
hentry ** rwords, char all);
|
|
||||||
int cpdcase_check(const char * word, int len);
|
|
||||||
inline int candidate_check(const char * word, int len);
|
|
||||||
void setcminmax(int * cmin, int * cmax, const char * word, int len);
|
|
||||||
struct hentry * compound_check(const char * word, int len, short wordnum,
|
|
||||||
short numsyllable, short maxwordnum, short wnum, hentry ** words,
|
|
||||||
char hu_mov_rule, char is_sug, int * info);
|
|
||||||
|
|
||||||
int compound_check_morph(const char * word, int len, short wordnum,
|
|
||||||
short numsyllable, short maxwordnum, short wnum, hentry ** words,
|
|
||||||
char hu_mov_rule, char ** result, char * partresult);
|
|
||||||
|
|
||||||
struct hentry * lookup(const char * word);
|
|
||||||
int get_numrep() const;
|
|
||||||
struct replentry * get_reptable() const;
|
|
||||||
RepList * get_iconvtable() const;
|
|
||||||
RepList * get_oconvtable() const;
|
|
||||||
struct phonetable * get_phonetable() const;
|
|
||||||
int get_nummap() const;
|
|
||||||
struct mapentry * get_maptable() const;
|
|
||||||
int get_numbreak() const;
|
|
||||||
char ** get_breaktable() const;
|
|
||||||
char * get_encoding();
|
|
||||||
int get_langnum() const;
|
|
||||||
char * get_key_string();
|
|
||||||
char * get_try_string() const;
|
|
||||||
const char * get_wordchars() const;
|
|
||||||
unsigned short * get_wordchars_utf16(int * len) const;
|
|
||||||
char * get_ignore() const;
|
|
||||||
unsigned short * get_ignore_utf16(int * len) const;
|
|
||||||
int get_compound() const;
|
|
||||||
FLAG get_compoundflag() const;
|
|
||||||
FLAG get_compoundbegin() const;
|
|
||||||
FLAG get_forbiddenword() const;
|
|
||||||
FLAG get_nosuggest() const;
|
|
||||||
FLAG get_nongramsuggest() const;
|
|
||||||
FLAG get_needaffix() const;
|
|
||||||
FLAG get_onlyincompound() const;
|
|
||||||
FLAG get_compoundroot() const;
|
|
||||||
FLAG get_lemma_present() const;
|
|
||||||
int get_checknum() const;
|
|
||||||
const char * get_prefix() const;
|
|
||||||
const char * get_suffix() const;
|
|
||||||
const char * get_derived() const;
|
|
||||||
const char * get_version() const;
|
|
||||||
int have_contclass() const;
|
|
||||||
int get_utf8() const;
|
|
||||||
int get_complexprefixes() const;
|
|
||||||
char * get_suffixed(char ) const;
|
|
||||||
int get_maxngramsugs() const;
|
|
||||||
int get_maxcpdsugs() const;
|
|
||||||
int get_maxdiff() const;
|
|
||||||
int get_onlymaxdiff() const;
|
|
||||||
int get_nosplitsugs() const;
|
|
||||||
int get_sugswithdots(void) const;
|
|
||||||
FLAG get_keepcase(void) const;
|
|
||||||
FLAG get_forceucase(void) const;
|
|
||||||
FLAG get_warn(void) const;
|
|
||||||
int get_forbidwarn(void) const;
|
|
||||||
int get_checksharps(void) const;
|
|
||||||
char * encode_flag(unsigned short aflag) const;
|
|
||||||
int get_fullstrip() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
int parse_file(const char * affpath, const char * key);
|
|
||||||
int parse_flag(char * line, unsigned short * out, FileMgr * af);
|
|
||||||
int parse_num(char * line, int * out, FileMgr * af);
|
|
||||||
int parse_cpdsyllable(char * line, FileMgr * af);
|
|
||||||
int parse_reptable(char * line, FileMgr * af);
|
|
||||||
int parse_convtable(char * line, FileMgr * af, RepList ** rl, const char * keyword);
|
|
||||||
int parse_phonetable(char * line, FileMgr * af);
|
|
||||||
int parse_maptable(char * line, FileMgr * af);
|
|
||||||
int parse_breaktable(char * line, FileMgr * af);
|
|
||||||
int parse_checkcpdtable(char * line, FileMgr * af);
|
|
||||||
int parse_defcpdtable(char * line, FileMgr * af);
|
|
||||||
int parse_affix(char * line, const char at, FileMgr * af, char * dupflags);
|
|
||||||
|
|
||||||
void reverse_condition(char *);
|
|
||||||
void debugflag(char * result, unsigned short flag);
|
|
||||||
int condlen(char *);
|
|
||||||
int encodeit(affentry &entry, char * cs);
|
|
||||||
int build_pfxtree(PfxEntry* pfxptr);
|
|
||||||
int build_sfxtree(SfxEntry* sfxptr);
|
|
||||||
int process_pfx_order();
|
|
||||||
int process_sfx_order();
|
|
||||||
PfxEntry * process_pfx_in_order(PfxEntry * ptr, PfxEntry * nptr);
|
|
||||||
SfxEntry * process_sfx_in_order(SfxEntry * ptr, SfxEntry * nptr);
|
|
||||||
int process_pfx_tree_to_list();
|
|
||||||
int process_sfx_tree_to_list();
|
|
||||||
int redundant_condition(char, char * strip, int stripl,
|
|
||||||
const char * cond, int);
|
|
||||||
void finishFileMgr(FileMgr *afflst);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,107 +0,0 @@
|
||||||
#ifndef _ATYPES_HXX_
|
|
||||||
#define _ATYPES_HXX_
|
|
||||||
|
|
||||||
#ifndef HUNSPELL_WARNING
|
|
||||||
#include <stdio.h>
|
|
||||||
#ifdef HUNSPELL_WARNING_ON
|
|
||||||
#define HUNSPELL_WARNING fprintf
|
|
||||||
#else
|
|
||||||
// empty inline function to switch off warnings (instead of the C99 standard variadic macros)
|
|
||||||
static inline void HUNSPELL_WARNING(FILE *, const char *, ...) {}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// HUNSTEM def.
|
|
||||||
#define HUNSTEM
|
|
||||||
|
|
||||||
#include "hashmgr.hxx"
|
|
||||||
#include "w_char.hxx"
|
|
||||||
|
|
||||||
#define SETSIZE 256
|
|
||||||
#define CONTSIZE 65536
|
|
||||||
#define MAXWORDLEN 100
|
|
||||||
#define MAXWORDUTF8LEN 256
|
|
||||||
|
|
||||||
// affentry options
|
|
||||||
#define aeXPRODUCT (1 << 0)
|
|
||||||
#define aeUTF8 (1 << 1)
|
|
||||||
#define aeALIASF (1 << 2)
|
|
||||||
#define aeALIASM (1 << 3)
|
|
||||||
#define aeLONGCOND (1 << 4)
|
|
||||||
|
|
||||||
// compound options
|
|
||||||
#define IN_CPD_NOT 0
|
|
||||||
#define IN_CPD_BEGIN 1
|
|
||||||
#define IN_CPD_END 2
|
|
||||||
#define IN_CPD_OTHER 3
|
|
||||||
|
|
||||||
// info options
|
|
||||||
#define SPELL_COMPOUND (1 << 0)
|
|
||||||
#define SPELL_FORBIDDEN (1 << 1)
|
|
||||||
#define SPELL_ALLCAP (1 << 2)
|
|
||||||
#define SPELL_NOCAP (1 << 3)
|
|
||||||
#define SPELL_INITCAP (1 << 4)
|
|
||||||
#define SPELL_ORIGCAP (1 << 5)
|
|
||||||
#define SPELL_WARN (1 << 6)
|
|
||||||
|
|
||||||
#define MAXLNLEN 8192
|
|
||||||
|
|
||||||
#define MINCPDLEN 3
|
|
||||||
#define MAXCOMPOUND 10
|
|
||||||
#define MAXCONDLEN 20
|
|
||||||
#define MAXCONDLEN_1 (MAXCONDLEN - sizeof(char *))
|
|
||||||
|
|
||||||
#define MAXACC 1000
|
|
||||||
|
|
||||||
#define FLAG unsigned short
|
|
||||||
#define FLAG_NULL 0x00
|
|
||||||
#define FREE_FLAG(a) a = 0
|
|
||||||
|
|
||||||
#define TESTAFF( a, b , c ) (flag_bsearch((unsigned short *) a, (unsigned short) b, c))
|
|
||||||
|
|
||||||
struct affentry
|
|
||||||
{
|
|
||||||
char * strip;
|
|
||||||
char * appnd;
|
|
||||||
unsigned char stripl;
|
|
||||||
unsigned char appndl;
|
|
||||||
char numconds;
|
|
||||||
char opts;
|
|
||||||
unsigned short aflag;
|
|
||||||
unsigned short * contclass;
|
|
||||||
short contclasslen;
|
|
||||||
union {
|
|
||||||
char conds[MAXCONDLEN];
|
|
||||||
struct {
|
|
||||||
char conds1[MAXCONDLEN_1];
|
|
||||||
char * conds2;
|
|
||||||
} l;
|
|
||||||
} c;
|
|
||||||
char * morphcode;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct guessword {
|
|
||||||
char * word;
|
|
||||||
bool allow;
|
|
||||||
char * orig;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct mapentry {
|
|
||||||
char ** set;
|
|
||||||
int len;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct flagentry {
|
|
||||||
FLAG * def;
|
|
||||||
int len;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct patentry {
|
|
||||||
char * pattern;
|
|
||||||
char * pattern2;
|
|
||||||
char * pattern3;
|
|
||||||
FLAG cond;
|
|
||||||
FLAG cond2;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,32 +0,0 @@
|
||||||
#ifndef _BASEAFF_HXX_
|
|
||||||
#define _BASEAFF_HXX_
|
|
||||||
|
|
||||||
#include "hunvisapi.h"
|
|
||||||
|
|
||||||
class LIBHUNSPELL_DLL_EXPORTED AffEntry
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
AffEntry(const AffEntry&);
|
|
||||||
AffEntry& operator = (const AffEntry&);
|
|
||||||
protected:
|
|
||||||
AffEntry() {}
|
|
||||||
char * appnd;
|
|
||||||
char * strip;
|
|
||||||
unsigned char appndl;
|
|
||||||
unsigned char stripl;
|
|
||||||
char numconds;
|
|
||||||
char opts;
|
|
||||||
unsigned short aflag;
|
|
||||||
union {
|
|
||||||
char conds[MAXCONDLEN];
|
|
||||||
struct {
|
|
||||||
char conds1[MAXCONDLEN_1];
|
|
||||||
char * conds2;
|
|
||||||
} l;
|
|
||||||
} c;
|
|
||||||
char * morphcode;
|
|
||||||
unsigned short * contclass;
|
|
||||||
short contclasslen;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,223 +0,0 @@
|
||||||
#ifndef __CSUTILHXX__
|
|
||||||
#define __CSUTILHXX__
|
|
||||||
|
|
||||||
#include "hunvisapi.h"
|
|
||||||
|
|
||||||
// First some base level utility routines
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include "w_char.hxx"
|
|
||||||
#include "htypes.hxx"
|
|
||||||
|
|
||||||
#ifdef MOZILLA_CLIENT
|
|
||||||
#include "nscore.h" // for mozalloc headers
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// casing
|
|
||||||
#define NOCAP 0
|
|
||||||
#define INITCAP 1
|
|
||||||
#define ALLCAP 2
|
|
||||||
#define HUHCAP 3
|
|
||||||
#define HUHINITCAP 4
|
|
||||||
|
|
||||||
// default encoding and keystring
|
|
||||||
#define SPELL_ENCODING "ISO8859-1"
|
|
||||||
#define SPELL_KEYSTRING "qwertyuiop|asdfghjkl|zxcvbnm"
|
|
||||||
|
|
||||||
// default morphological fields
|
|
||||||
#define MORPH_STEM "st:"
|
|
||||||
#define MORPH_ALLOMORPH "al:"
|
|
||||||
#define MORPH_POS "po:"
|
|
||||||
#define MORPH_DERI_PFX "dp:"
|
|
||||||
#define MORPH_INFL_PFX "ip:"
|
|
||||||
#define MORPH_TERM_PFX "tp:"
|
|
||||||
#define MORPH_DERI_SFX "ds:"
|
|
||||||
#define MORPH_INFL_SFX "is:"
|
|
||||||
#define MORPH_TERM_SFX "ts:"
|
|
||||||
#define MORPH_SURF_PFX "sp:"
|
|
||||||
#define MORPH_FREQ "fr:"
|
|
||||||
#define MORPH_PHON "ph:"
|
|
||||||
#define MORPH_HYPH "hy:"
|
|
||||||
#define MORPH_PART "pa:"
|
|
||||||
#define MORPH_FLAG "fl:"
|
|
||||||
#define MORPH_HENTRY "_H:"
|
|
||||||
#define MORPH_TAG_LEN strlen(MORPH_STEM)
|
|
||||||
|
|
||||||
#define MSEP_FLD ' '
|
|
||||||
#define MSEP_REC '\n'
|
|
||||||
#define MSEP_ALT '\v'
|
|
||||||
|
|
||||||
// default flags
|
|
||||||
#define DEFAULTFLAGS 65510
|
|
||||||
#define FORBIDDENWORD 65510
|
|
||||||
#define ONLYUPCASEFLAG 65511
|
|
||||||
|
|
||||||
// fopen or optional _wfopen to fix long pathname problem of WIN32
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED FILE * myfopen(const char * path, const char * mode);
|
|
||||||
|
|
||||||
// convert UTF-16 characters to UTF-8
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED char * u16_u8(char * dest, int size, const w_char * src, int srclen);
|
|
||||||
|
|
||||||
// convert UTF-8 characters to UTF-16
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int u8_u16(w_char * dest, int size, const char * src);
|
|
||||||
|
|
||||||
// sort 2-byte vector
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void flag_qsort(unsigned short flags[], int begin, int end);
|
|
||||||
|
|
||||||
// binary search in 2-byte vector
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int flag_bsearch(unsigned short flags[], unsigned short flag, int right);
|
|
||||||
|
|
||||||
// remove end of line char(s)
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void mychomp(char * s);
|
|
||||||
|
|
||||||
// duplicate string
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED char * mystrdup(const char * s);
|
|
||||||
|
|
||||||
// strcat for limited length destination string
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED char * mystrcat(char * dest, const char * st, int max);
|
|
||||||
|
|
||||||
// duplicate reverse of string
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED char * myrevstrdup(const char * s);
|
|
||||||
|
|
||||||
// parse into tokens with char delimiter
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED char * mystrsep(char ** sptr, const char delim);
|
|
||||||
// parse into tokens with char delimiter
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED char * mystrsep2(char ** sptr, const char delim);
|
|
||||||
|
|
||||||
// parse into tokens with char delimiter
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED char * mystrrep(char *, const char *, const char *);
|
|
||||||
|
|
||||||
// append s to ends of every lines in text
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void strlinecat(char * lines, const char * s);
|
|
||||||
|
|
||||||
// tokenize into lines with new line
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int line_tok(const char * text, char *** lines, char breakchar);
|
|
||||||
|
|
||||||
// tokenize into lines with new line and uniq in place
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED char * line_uniq(char * text, char breakchar);
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED char * line_uniq_app(char ** text, char breakchar);
|
|
||||||
|
|
||||||
// change oldchar to newchar in place
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED char * tr(char * text, char oldc, char newc);
|
|
||||||
|
|
||||||
// reverse word
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int reverseword(char *);
|
|
||||||
|
|
||||||
// reverse word
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int reverseword_utf(char *);
|
|
||||||
|
|
||||||
// remove duplicates
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int uniqlist(char ** list, int n);
|
|
||||||
|
|
||||||
// free character array list
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void freelist(char *** list, int n);
|
|
||||||
|
|
||||||
// character encoding information
|
|
||||||
struct cs_info {
|
|
||||||
unsigned char ccase;
|
|
||||||
unsigned char clower;
|
|
||||||
unsigned char cupper;
|
|
||||||
};
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int initialize_utf_tbl();
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void free_utf_tbl();
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED unsigned short unicodetoupper(unsigned short c, int langnum);
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED unsigned short unicodetolower(unsigned short c, int langnum);
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int unicodeisalpha(unsigned short c);
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED struct cs_info * get_current_cs(const char * es);
|
|
||||||
|
|
||||||
// get language identifiers of language codes
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int get_lang_num(const char * lang);
|
|
||||||
|
|
||||||
// get characters of the given 8bit encoding with lower- and uppercase forms
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED char * get_casechars(const char * enc);
|
|
||||||
|
|
||||||
// convert null terminated string to all caps using encoding
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void enmkallcap(char * d, const char * p, const char * encoding);
|
|
||||||
|
|
||||||
// convert null terminated string to all little using encoding
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void enmkallsmall(char * d, const char * p, const char * encoding);
|
|
||||||
|
|
||||||
// convert null terminated string to have initial capital using encoding
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void enmkinitcap(char * d, const char * p, const char * encoding);
|
|
||||||
|
|
||||||
// convert null terminated string to all caps
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void mkallcap(char * p, const struct cs_info * csconv);
|
|
||||||
|
|
||||||
// convert null terminated string to all little
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void mkallsmall(char * p, const struct cs_info * csconv);
|
|
||||||
|
|
||||||
// convert null terminated string to have initial capital
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void mkinitcap(char * p, const struct cs_info * csconv);
|
|
||||||
|
|
||||||
// convert first nc characters of UTF-8 string to little
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void mkallsmall_utf(w_char * u, int nc, int langnum);
|
|
||||||
|
|
||||||
// convert first nc characters of UTF-8 string to capital
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void mkallcap_utf(w_char * u, int nc, int langnum);
|
|
||||||
|
|
||||||
// get type of capitalization
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int get_captype(char * q, int nl, cs_info *);
|
|
||||||
|
|
||||||
// get type of capitalization (UTF-8)
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int get_captype_utf8(w_char * q, int nl, int langnum);
|
|
||||||
|
|
||||||
// strip all ignored characters in the string
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void remove_ignored_chars_utf(char * word, unsigned short ignored_chars[], int ignored_len);
|
|
||||||
|
|
||||||
// strip all ignored characters in the string
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void remove_ignored_chars(char * word, char * ignored_chars);
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int parse_string(char * line, char ** out, int ln);
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int parse_array(char * line, char ** out, unsigned short ** out_utf16,
|
|
||||||
int * out_utf16_len, int utf8, int ln);
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int fieldlen(const char * r);
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED char * copy_field(char * dest, const char * morph, const char * var);
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int morphcmp(const char * s, const char * t);
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int get_sfxcount(const char * morph);
|
|
||||||
|
|
||||||
// conversion function for protected memory
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void store_pointer(char * dest, char * source);
|
|
||||||
|
|
||||||
// conversion function for protected memory
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED char * get_stored_pointer(const char * s);
|
|
||||||
|
|
||||||
// hash entry macros
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED inline char* HENTRY_DATA(struct hentry *h)
|
|
||||||
{
|
|
||||||
char *ret;
|
|
||||||
if (!h->var)
|
|
||||||
ret = NULL;
|
|
||||||
else if (h->var & H_OPT_ALIASM)
|
|
||||||
ret = get_stored_pointer(HENTRY_WORD(h) + h->blen + 1);
|
|
||||||
else
|
|
||||||
ret = HENTRY_WORD(h) + h->blen + 1;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NULL-free version for warning-free OOo build
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED inline const char* HENTRY_DATA2(const struct hentry *h)
|
|
||||||
{
|
|
||||||
const char *ret;
|
|
||||||
if (!h->var)
|
|
||||||
ret = "";
|
|
||||||
else if (h->var & H_OPT_ALIASM)
|
|
||||||
ret = get_stored_pointer(HENTRY_WORD(h) + h->blen + 1);
|
|
||||||
else
|
|
||||||
ret = HENTRY_WORD(h) + h->blen + 1;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED inline char* HENTRY_FIND(struct hentry *h, const char *p)
|
|
||||||
{
|
|
||||||
return (HENTRY_DATA(h) ? strstr(HENTRY_DATA(h), p) : NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define w_char_eq(a,b) (((a).l == (b).l) && ((a).h == (b).h))
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,182 +0,0 @@
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "dictmgr.hxx"
|
|
||||||
#include "csutil.hxx"
|
|
||||||
|
|
||||||
DictMgr::DictMgr(const char * dictpath, const char * etype) : numdict(0)
|
|
||||||
{
|
|
||||||
// load list of etype entries
|
|
||||||
pdentry = (dictentry *)malloc(MAXDICTIONARIES*sizeof(struct dictentry));
|
|
||||||
if (pdentry) {
|
|
||||||
if (parse_file(dictpath, etype)) {
|
|
||||||
numdict = 0;
|
|
||||||
// no dictionary.lst found is okay
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DictMgr::~DictMgr()
|
|
||||||
{
|
|
||||||
dictentry * pdict = NULL;
|
|
||||||
if (pdentry) {
|
|
||||||
pdict = pdentry;
|
|
||||||
for (int i=0;i<numdict;i++) {
|
|
||||||
if (pdict->lang) {
|
|
||||||
free(pdict->lang);
|
|
||||||
pdict->lang = NULL;
|
|
||||||
}
|
|
||||||
if (pdict->region) {
|
|
||||||
free(pdict->region);
|
|
||||||
pdict->region=NULL;
|
|
||||||
}
|
|
||||||
if (pdict->filename) {
|
|
||||||
free(pdict->filename);
|
|
||||||
pdict->filename = NULL;
|
|
||||||
}
|
|
||||||
pdict++;
|
|
||||||
}
|
|
||||||
free(pdentry);
|
|
||||||
pdentry = NULL;
|
|
||||||
pdict = NULL;
|
|
||||||
}
|
|
||||||
numdict = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// read in list of etype entries and build up structure to describe them
|
|
||||||
int DictMgr::parse_file(const char * dictpath, const char * etype)
|
|
||||||
{
|
|
||||||
|
|
||||||
int i;
|
|
||||||
char line[MAXDICTENTRYLEN+1];
|
|
||||||
dictentry * pdict = pdentry;
|
|
||||||
|
|
||||||
// open the dictionary list file
|
|
||||||
FILE * dictlst;
|
|
||||||
dictlst = myfopen(dictpath,"r");
|
|
||||||
if (!dictlst) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// step one is to parse the dictionary list building up the
|
|
||||||
// descriptive structures
|
|
||||||
|
|
||||||
// read in each line ignoring any that dont start with etype
|
|
||||||
while (fgets(line,MAXDICTENTRYLEN,dictlst)) {
|
|
||||||
mychomp(line);
|
|
||||||
|
|
||||||
/* parse in a dictionary entry */
|
|
||||||
if (strncmp(line,etype,4) == 0) {
|
|
||||||
if (numdict < MAXDICTIONARIES) {
|
|
||||||
char * tp = line;
|
|
||||||
char * piece;
|
|
||||||
i = 0;
|
|
||||||
while ((piece=mystrsep(&tp,' '))) {
|
|
||||||
if (*piece != '\0') {
|
|
||||||
switch(i) {
|
|
||||||
case 0: break;
|
|
||||||
case 1: pdict->lang = mystrdup(piece); break;
|
|
||||||
case 2: if (strcmp (piece, "ANY") == 0)
|
|
||||||
pdict->region = mystrdup("");
|
|
||||||
else
|
|
||||||
pdict->region = mystrdup(piece);
|
|
||||||
break;
|
|
||||||
case 3: pdict->filename = mystrdup(piece); break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
free(piece);
|
|
||||||
}
|
|
||||||
if (i == 4) {
|
|
||||||
numdict++;
|
|
||||||
pdict++;
|
|
||||||
} else {
|
|
||||||
switch (i) {
|
|
||||||
case 3:
|
|
||||||
free(pdict->region);
|
|
||||||
pdict->region=NULL;
|
|
||||||
/* FALLTHROUGH */
|
|
||||||
case 2:
|
|
||||||
free(pdict->lang);
|
|
||||||
pdict->lang=NULL;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
fprintf(stderr,"dictionary list corruption in line \"%s\"\n",line);
|
|
||||||
fflush(stderr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(dictlst);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// return text encoding of dictionary
|
|
||||||
int DictMgr::get_list(dictentry ** ppentry)
|
|
||||||
{
|
|
||||||
*ppentry = pdentry;
|
|
||||||
return numdict;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// strip strings into token based on single char delimiter
|
|
||||||
// acts like strsep() but only uses a delim char and not
|
|
||||||
// a delim string
|
|
||||||
|
|
||||||
char * DictMgr::mystrsep(char ** stringp, const char delim)
|
|
||||||
{
|
|
||||||
char * rv = NULL;
|
|
||||||
char * mp = *stringp;
|
|
||||||
size_t n = strlen(mp);
|
|
||||||
if (n > 0) {
|
|
||||||
char * dp = (char *)memchr(mp,(int)((unsigned char)delim),n);
|
|
||||||
if (dp) {
|
|
||||||
*stringp = dp+1;
|
|
||||||
size_t nc = dp - mp;
|
|
||||||
rv = (char *) malloc(nc+1);
|
|
||||||
if (rv) {
|
|
||||||
memcpy(rv,mp,nc);
|
|
||||||
*(rv+nc) = '\0';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
rv = (char *) malloc(n+1);
|
|
||||||
if (rv) {
|
|
||||||
memcpy(rv, mp, n);
|
|
||||||
*(rv+n) = '\0';
|
|
||||||
*stringp = mp + n;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// replaces strdup with ansi version
|
|
||||||
char * DictMgr::mystrdup(const char * s)
|
|
||||||
{
|
|
||||||
char * d = NULL;
|
|
||||||
if (s) {
|
|
||||||
int sl = strlen(s)+1;
|
|
||||||
d = (char *) malloc(sl);
|
|
||||||
if (d) memcpy(d,s,sl);
|
|
||||||
}
|
|
||||||
return d;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// remove cross-platform text line end characters
|
|
||||||
void DictMgr:: mychomp(char * s)
|
|
||||||
{
|
|
||||||
int k = strlen(s);
|
|
||||||
if ((k > 0) && ((*(s+k-1)=='\r') || (*(s+k-1)=='\n'))) *(s+k-1) = '\0';
|
|
||||||
if ((k > 1) && (*(s+k-2) == '\r')) *(s+k-2) = '\0';
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
#ifndef _DICTMGR_HXX_
|
|
||||||
#define _DICTMGR_HXX_
|
|
||||||
|
|
||||||
#include "hunvisapi.h"
|
|
||||||
|
|
||||||
#define MAXDICTIONARIES 100
|
|
||||||
#define MAXDICTENTRYLEN 1024
|
|
||||||
|
|
||||||
struct dictentry {
|
|
||||||
char * filename;
|
|
||||||
char * lang;
|
|
||||||
char * region;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class LIBHUNSPELL_DLL_EXPORTED DictMgr
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
DictMgr(const DictMgr&);
|
|
||||||
DictMgr& operator = (const DictMgr&);
|
|
||||||
private:
|
|
||||||
int numdict;
|
|
||||||
dictentry * pdentry;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
DictMgr(const char * dictpath, const char * etype);
|
|
||||||
~DictMgr();
|
|
||||||
int get_list(dictentry** ppentry);
|
|
||||||
|
|
||||||
private:
|
|
||||||
int parse_file(const char * dictpath, const char * etype);
|
|
||||||
char * mystrsep(char ** stringp, const char delim);
|
|
||||||
char * mystrdup(const char * s);
|
|
||||||
void mychomp(char * s);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,53 +0,0 @@
|
||||||
#include "license.hunspell"
|
|
||||||
#include "license.myspell"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "filemgr.hxx"
|
|
||||||
#include "csutil.hxx"
|
|
||||||
|
|
||||||
int FileMgr::fail(const char * err, const char * par) {
|
|
||||||
fprintf(stderr, err, par);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
FileMgr::FileMgr(const char * file, const char * key)
|
|
||||||
: hin(NULL)
|
|
||||||
, linenum(0)
|
|
||||||
{
|
|
||||||
in[0] = '\0';
|
|
||||||
|
|
||||||
fin = myfopen(file, "r");
|
|
||||||
if (!fin) {
|
|
||||||
// check hzipped file
|
|
||||||
char * st = (char *) malloc(strlen(file) + strlen(HZIP_EXTENSION) + 1);
|
|
||||||
if (st) {
|
|
||||||
strcpy(st, file);
|
|
||||||
strcat(st, HZIP_EXTENSION);
|
|
||||||
hin = new Hunzip(st, key);
|
|
||||||
free(st);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!fin && !hin) fail(MSG_OPEN, file);
|
|
||||||
}
|
|
||||||
|
|
||||||
FileMgr::~FileMgr()
|
|
||||||
{
|
|
||||||
if (fin) fclose(fin);
|
|
||||||
if (hin) delete hin;
|
|
||||||
}
|
|
||||||
|
|
||||||
char * FileMgr::getline() {
|
|
||||||
const char * l;
|
|
||||||
linenum++;
|
|
||||||
if (fin) return fgets(in, BUFSIZE - 1, fin);
|
|
||||||
if (hin && ((l = hin->getline()) != NULL)) return strcpy(in, l);
|
|
||||||
linenum--;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int FileMgr::getlinenum() {
|
|
||||||
return linenum;
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
/* file manager class - read lines of files [filename] OR [filename.hz] */
|
|
||||||
#ifndef _FILEMGR_HXX_
|
|
||||||
#define _FILEMGR_HXX_
|
|
||||||
|
|
||||||
#include "hunvisapi.h"
|
|
||||||
|
|
||||||
#include "hunzip.hxx"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
class LIBHUNSPELL_DLL_EXPORTED FileMgr
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
FileMgr(const FileMgr&);
|
|
||||||
FileMgr& operator = (const FileMgr&);
|
|
||||||
protected:
|
|
||||||
FILE * fin;
|
|
||||||
Hunzip * hin;
|
|
||||||
char in[BUFSIZE + 50]; // input buffer
|
|
||||||
int fail(const char * err, const char * par);
|
|
||||||
int linenum;
|
|
||||||
|
|
||||||
public:
|
|
||||||
FileMgr(const char * filename, const char * key = NULL);
|
|
||||||
~FileMgr();
|
|
||||||
char * getline();
|
|
||||||
int getlinenum();
|
|
||||||
};
|
|
||||||
#endif
|
|
|
@ -1,936 +0,0 @@
|
||||||
#include "license.hunspell"
|
|
||||||
#include "license.myspell"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <limits>
|
|
||||||
|
|
||||||
#include "hashmgr.hxx"
|
|
||||||
#include "csutil.hxx"
|
|
||||||
#include "atypes.hxx"
|
|
||||||
|
|
||||||
// build a hash table from a munched word list
|
|
||||||
|
|
||||||
HashMgr::HashMgr(const char * tpath, const char * apath, const char * key)
|
|
||||||
: tablesize(0)
|
|
||||||
, tableptr(NULL)
|
|
||||||
, userword(0)
|
|
||||||
, flag_mode(FLAG_CHAR)
|
|
||||||
, complexprefixes(0)
|
|
||||||
, utf8(0)
|
|
||||||
, forbiddenword(FORBIDDENWORD) // forbidden word signing flag
|
|
||||||
, numaliasf(0)
|
|
||||||
, aliasf(NULL)
|
|
||||||
, aliasflen(0)
|
|
||||||
, numaliasm(0)
|
|
||||||
, aliasm(NULL)
|
|
||||||
{
|
|
||||||
langnum = 0;
|
|
||||||
lang = NULL;
|
|
||||||
enc = NULL;
|
|
||||||
csconv = 0;
|
|
||||||
ignorechars = NULL;
|
|
||||||
ignorechars_utf16 = NULL;
|
|
||||||
ignorechars_utf16_len = 0;
|
|
||||||
load_config(apath, key);
|
|
||||||
int ec = load_tables(tpath, key);
|
|
||||||
if (ec) {
|
|
||||||
/* error condition - what should we do here */
|
|
||||||
HUNSPELL_WARNING(stderr, "Hash Manager Error : %d\n",ec);
|
|
||||||
if (tableptr) {
|
|
||||||
free(tableptr);
|
|
||||||
tableptr = NULL;
|
|
||||||
}
|
|
||||||
tablesize = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
HashMgr::~HashMgr()
|
|
||||||
{
|
|
||||||
if (tableptr) {
|
|
||||||
// now pass through hash table freeing up everything
|
|
||||||
// go through column by column of the table
|
|
||||||
for (int i=0; i < tablesize; i++) {
|
|
||||||
struct hentry * pt = tableptr[i];
|
|
||||||
struct hentry * nt = NULL;
|
|
||||||
while(pt) {
|
|
||||||
nt = pt->next;
|
|
||||||
if (pt->astr && (!aliasf || TESTAFF(pt->astr, ONLYUPCASEFLAG, pt->alen))) free(pt->astr);
|
|
||||||
free(pt);
|
|
||||||
pt = nt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(tableptr);
|
|
||||||
}
|
|
||||||
tablesize = 0;
|
|
||||||
|
|
||||||
if (aliasf) {
|
|
||||||
for (int j = 0; j < (numaliasf); j++) free(aliasf[j]);
|
|
||||||
free(aliasf);
|
|
||||||
aliasf = NULL;
|
|
||||||
if (aliasflen) {
|
|
||||||
free(aliasflen);
|
|
||||||
aliasflen = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (aliasm) {
|
|
||||||
for (int j = 0; j < (numaliasm); j++) free(aliasm[j]);
|
|
||||||
free(aliasm);
|
|
||||||
aliasm = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef OPENOFFICEORG
|
|
||||||
#ifndef MOZILLA_CLIENT
|
|
||||||
if (utf8) free_utf_tbl();
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (enc) free(enc);
|
|
||||||
if (lang) free(lang);
|
|
||||||
|
|
||||||
if (ignorechars) free(ignorechars);
|
|
||||||
if (ignorechars_utf16) free(ignorechars_utf16);
|
|
||||||
|
|
||||||
#ifdef MOZILLA_CLIENT
|
|
||||||
delete [] csconv;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// lookup a root word in the hashtable
|
|
||||||
|
|
||||||
struct hentry * HashMgr::lookup(const char *word) const
|
|
||||||
{
|
|
||||||
struct hentry * dp;
|
|
||||||
if (tableptr) {
|
|
||||||
dp = tableptr[hash(word)];
|
|
||||||
if (!dp) return NULL;
|
|
||||||
for ( ; dp != NULL; dp = dp->next) {
|
|
||||||
if (strcmp(word, dp->word) == 0) return dp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add a word to the hash table (private)
|
|
||||||
int HashMgr::add_word(const char * word, int wbl, int wcl, unsigned short * aff,
|
|
||||||
int al, const char * desc, bool onlyupcase)
|
|
||||||
{
|
|
||||||
bool upcasehomonym = false;
|
|
||||||
int descl = desc ? (aliasm ? sizeof(char *) : strlen(desc) + 1) : 0;
|
|
||||||
// variable-length hash record with word and optional fields
|
|
||||||
struct hentry* hp =
|
|
||||||
(struct hentry *) malloc (sizeof(struct hentry) + wbl + descl);
|
|
||||||
if (!hp) return 1;
|
|
||||||
char * hpw = hp->word;
|
|
||||||
strcpy(hpw, word);
|
|
||||||
if (ignorechars != NULL) {
|
|
||||||
if (utf8) {
|
|
||||||
remove_ignored_chars_utf(hpw, ignorechars_utf16, ignorechars_utf16_len);
|
|
||||||
} else {
|
|
||||||
remove_ignored_chars(hpw, ignorechars);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (complexprefixes) {
|
|
||||||
if (utf8) reverseword_utf(hpw); else reverseword(hpw);
|
|
||||||
}
|
|
||||||
|
|
||||||
int i = hash(hpw);
|
|
||||||
|
|
||||||
hp->blen = (unsigned char) wbl;
|
|
||||||
hp->clen = (unsigned char) wcl;
|
|
||||||
hp->alen = (short) al;
|
|
||||||
hp->astr = aff;
|
|
||||||
hp->next = NULL;
|
|
||||||
hp->next_homonym = NULL;
|
|
||||||
|
|
||||||
// store the description string or its pointer
|
|
||||||
if (desc) {
|
|
||||||
hp->var = H_OPT;
|
|
||||||
if (aliasm) {
|
|
||||||
hp->var += H_OPT_ALIASM;
|
|
||||||
store_pointer(hpw + wbl + 1, get_aliasm(atoi(desc)));
|
|
||||||
} else {
|
|
||||||
strcpy(hpw + wbl + 1, desc);
|
|
||||||
if (complexprefixes) {
|
|
||||||
if (utf8) reverseword_utf(HENTRY_DATA(hp));
|
|
||||||
else reverseword(HENTRY_DATA(hp));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (strstr(HENTRY_DATA(hp), MORPH_PHON)) hp->var += H_OPT_PHON;
|
|
||||||
} else hp->var = 0;
|
|
||||||
|
|
||||||
struct hentry * dp = tableptr[i];
|
|
||||||
if (!dp) {
|
|
||||||
tableptr[i] = hp;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
while (dp->next != NULL) {
|
|
||||||
if ((!dp->next_homonym) && (strcmp(hp->word, dp->word) == 0)) {
|
|
||||||
// remove hidden onlyupcase homonym
|
|
||||||
if (!onlyupcase) {
|
|
||||||
if ((dp->astr) && TESTAFF(dp->astr, ONLYUPCASEFLAG, dp->alen)) {
|
|
||||||
free(dp->astr);
|
|
||||||
dp->astr = hp->astr;
|
|
||||||
dp->alen = hp->alen;
|
|
||||||
free(hp);
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
dp->next_homonym = hp;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
upcasehomonym = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dp=dp->next;
|
|
||||||
}
|
|
||||||
if (strcmp(hp->word, dp->word) == 0) {
|
|
||||||
// remove hidden onlyupcase homonym
|
|
||||||
if (!onlyupcase) {
|
|
||||||
if ((dp->astr) && TESTAFF(dp->astr, ONLYUPCASEFLAG, dp->alen)) {
|
|
||||||
free(dp->astr);
|
|
||||||
dp->astr = hp->astr;
|
|
||||||
dp->alen = hp->alen;
|
|
||||||
free(hp);
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
dp->next_homonym = hp;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
upcasehomonym = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!upcasehomonym) {
|
|
||||||
dp->next = hp;
|
|
||||||
} else {
|
|
||||||
// remove hidden onlyupcase homonym
|
|
||||||
if (hp->astr) free(hp->astr);
|
|
||||||
free(hp);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int HashMgr::add_hidden_capitalized_word(char * word, int wbl, int wcl,
|
|
||||||
unsigned short * flags, int flagslen, char * dp, int captype)
|
|
||||||
{
|
|
||||||
if (flags == NULL)
|
|
||||||
flagslen = 0;
|
|
||||||
|
|
||||||
// add inner capitalized forms to handle the following allcap forms:
|
|
||||||
// Mixed caps: OpenOffice.org -> OPENOFFICE.ORG
|
|
||||||
// Allcaps with suffixes: CIA's -> CIA'S
|
|
||||||
if (((captype == HUHCAP) || (captype == HUHINITCAP) ||
|
|
||||||
((captype == ALLCAP) && (flagslen != 0))) &&
|
|
||||||
!((flagslen != 0) && TESTAFF(flags, forbiddenword, flagslen))) {
|
|
||||||
unsigned short * flags2 = (unsigned short *) malloc (sizeof(unsigned short) * (flagslen+1));
|
|
||||||
if (!flags2) return 1;
|
|
||||||
if (flagslen) memcpy(flags2, flags, flagslen * sizeof(unsigned short));
|
|
||||||
flags2[flagslen] = ONLYUPCASEFLAG;
|
|
||||||
if (utf8) {
|
|
||||||
char st[BUFSIZE];
|
|
||||||
w_char w[BUFSIZE];
|
|
||||||
int wlen = u8_u16(w, BUFSIZE, word);
|
|
||||||
mkallsmall_utf(w, wlen, langnum);
|
|
||||||
mkallcap_utf(w, 1, langnum);
|
|
||||||
u16_u8(st, BUFSIZE, w, wlen);
|
|
||||||
return add_word(st,wbl,wcl,flags2,flagslen+1,dp, true);
|
|
||||||
} else {
|
|
||||||
mkallsmall(word, csconv);
|
|
||||||
mkinitcap(word, csconv);
|
|
||||||
return add_word(word,wbl,wcl,flags2,flagslen+1,dp, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// detect captype and modify word length for UTF-8 encoding
|
|
||||||
int HashMgr::get_clen_and_captype(const char * word, int wbl, int * captype) {
|
|
||||||
int len;
|
|
||||||
if (utf8) {
|
|
||||||
w_char dest_utf[BUFSIZE];
|
|
||||||
len = u8_u16(dest_utf, BUFSIZE, word);
|
|
||||||
*captype = get_captype_utf8(dest_utf, len, langnum);
|
|
||||||
} else {
|
|
||||||
len = wbl;
|
|
||||||
*captype = get_captype((char *) word, len, csconv);
|
|
||||||
}
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove word (personal dictionary function for standalone applications)
|
|
||||||
int HashMgr::remove(const char * word)
|
|
||||||
{
|
|
||||||
struct hentry * dp = lookup(word);
|
|
||||||
while (dp) {
|
|
||||||
if (dp->alen == 0 || !TESTAFF(dp->astr, forbiddenword, dp->alen)) {
|
|
||||||
unsigned short * flags =
|
|
||||||
(unsigned short *) malloc(sizeof(short) * (dp->alen + 1));
|
|
||||||
if (!flags) return 1;
|
|
||||||
for (int i = 0; i < dp->alen; i++) flags[i] = dp->astr[i];
|
|
||||||
flags[dp->alen] = forbiddenword;
|
|
||||||
dp->astr = flags;
|
|
||||||
dp->alen++;
|
|
||||||
flag_qsort(flags, 0, dp->alen);
|
|
||||||
}
|
|
||||||
dp = dp->next_homonym;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* remove forbidden flag to add a personal word to the hash */
|
|
||||||
int HashMgr::remove_forbidden_flag(const char * word) {
|
|
||||||
struct hentry * dp = lookup(word);
|
|
||||||
if (!dp) return 1;
|
|
||||||
while (dp) {
|
|
||||||
if (dp->astr && TESTAFF(dp->astr, forbiddenword, dp->alen)) {
|
|
||||||
if (dp->alen == 1) dp->alen = 0; // XXX forbidden words of personal dic.
|
|
||||||
else {
|
|
||||||
unsigned short * flags2 =
|
|
||||||
(unsigned short *) malloc(sizeof(short) * (dp->alen - 1));
|
|
||||||
if (!flags2) return 1;
|
|
||||||
int i, j = 0;
|
|
||||||
for (i = 0; i < dp->alen; i++) {
|
|
||||||
if (dp->astr[i] != forbiddenword) flags2[j++] = dp->astr[i];
|
|
||||||
}
|
|
||||||
dp->alen--;
|
|
||||||
dp->astr = flags2; // XXX allowed forbidden words
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dp = dp->next_homonym;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add a custom dic. word to the hash table (public)
|
|
||||||
int HashMgr::add(const char * word)
|
|
||||||
{
|
|
||||||
unsigned short * flags = NULL;
|
|
||||||
int al = 0;
|
|
||||||
if (remove_forbidden_flag(word)) {
|
|
||||||
int captype;
|
|
||||||
int wbl = strlen(word);
|
|
||||||
int wcl = get_clen_and_captype(word, wbl, &captype);
|
|
||||||
add_word(word, wbl, wcl, flags, al, NULL, false);
|
|
||||||
return add_hidden_capitalized_word((char *) word, wbl, wcl, flags, al, NULL, captype);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int HashMgr::add_with_affix(const char * word, const char * example)
|
|
||||||
{
|
|
||||||
// detect captype and modify word length for UTF-8 encoding
|
|
||||||
struct hentry * dp = lookup(example);
|
|
||||||
remove_forbidden_flag(word);
|
|
||||||
if (dp && dp->astr) {
|
|
||||||
int captype;
|
|
||||||
int wbl = strlen(word);
|
|
||||||
int wcl = get_clen_and_captype(word, wbl, &captype);
|
|
||||||
if (aliasf) {
|
|
||||||
add_word(word, wbl, wcl, dp->astr, dp->alen, NULL, false);
|
|
||||||
} else {
|
|
||||||
unsigned short * flags = (unsigned short *) malloc (dp->alen * sizeof(short));
|
|
||||||
if (flags) {
|
|
||||||
memcpy((void *) flags, (void *) dp->astr, dp->alen * sizeof(short));
|
|
||||||
add_word(word, wbl, wcl, flags, dp->alen, NULL, false);
|
|
||||||
} else return 1;
|
|
||||||
}
|
|
||||||
return add_hidden_capitalized_word((char *) word, wbl, wcl, dp->astr, dp->alen, NULL, captype);
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// walk the hash table entry by entry - null at end
|
|
||||||
// initialize: col=-1; hp = NULL; hp = walk_hashtable(&col, hp);
|
|
||||||
struct hentry * HashMgr::walk_hashtable(int &col, struct hentry * hp) const
|
|
||||||
{
|
|
||||||
if (hp && hp->next != NULL) return hp->next;
|
|
||||||
for (col++; col < tablesize; col++) {
|
|
||||||
if (tableptr[col]) return tableptr[col];
|
|
||||||
}
|
|
||||||
// null at end and reset to start
|
|
||||||
col = -1;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// load a munched word list and build a hash table on the fly
|
|
||||||
int HashMgr::load_tables(const char * tpath, const char * key)
|
|
||||||
{
|
|
||||||
int al;
|
|
||||||
char * ap;
|
|
||||||
char * dp;
|
|
||||||
char * dp2;
|
|
||||||
unsigned short * flags;
|
|
||||||
char * ts;
|
|
||||||
|
|
||||||
// open dictionary file
|
|
||||||
FileMgr * dict = new FileMgr(tpath, key);
|
|
||||||
if (dict == NULL) return 1;
|
|
||||||
|
|
||||||
// first read the first line of file to get hash table size */
|
|
||||||
if ((ts = dict->getline()) == NULL) {
|
|
||||||
HUNSPELL_WARNING(stderr, "error: empty dic file %s\n", tpath);
|
|
||||||
delete dict;
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
mychomp(ts);
|
|
||||||
|
|
||||||
/* remove byte order mark */
|
|
||||||
if (strncmp(ts,"\xEF\xBB\xBF",3) == 0) {
|
|
||||||
memmove(ts, ts+3, strlen(ts+3)+1);
|
|
||||||
// warning: dic file begins with byte order mark: possible incompatibility with old Hunspell versions
|
|
||||||
}
|
|
||||||
|
|
||||||
tablesize = atoi(ts);
|
|
||||||
|
|
||||||
int nExtra = 5 + USERWORD;
|
|
||||||
|
|
||||||
if (tablesize <= 0 || (tablesize >= (std::numeric_limits<int>::max() - 1 - nExtra) / int(sizeof(struct hentry *)))) {
|
|
||||||
HUNSPELL_WARNING(stderr, "error: line 1: missing or bad word count in the dic file\n");
|
|
||||||
delete dict;
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
tablesize += nExtra;
|
|
||||||
if ((tablesize % 2) == 0) tablesize++;
|
|
||||||
|
|
||||||
// allocate the hash table
|
|
||||||
tableptr = (struct hentry **) calloc(tablesize, sizeof(struct hentry *));
|
|
||||||
if (! tableptr) {
|
|
||||||
delete dict;
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// loop through all words on much list and add to hash
|
|
||||||
// table and create word and affix strings
|
|
||||||
|
|
||||||
while ((ts = dict->getline()) != NULL) {
|
|
||||||
mychomp(ts);
|
|
||||||
// split each line into word and morphological description
|
|
||||||
dp = ts;
|
|
||||||
while ((dp = strchr(dp, ':')) != NULL) {
|
|
||||||
if ((dp > ts + 3) && (*(dp - 3) == ' ' || *(dp - 3) == '\t')) {
|
|
||||||
for (dp -= 4; dp >= ts && (*dp == ' ' || *dp == '\t'); dp--);
|
|
||||||
if (dp < ts) { // missing word
|
|
||||||
dp = NULL;
|
|
||||||
} else {
|
|
||||||
*(dp + 1) = '\0';
|
|
||||||
dp = dp + 2;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
dp++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// tabulator is the old morphological field separator
|
|
||||||
dp2 = strchr(ts, '\t');
|
|
||||||
if (dp2 && (!dp || dp2 < dp)) {
|
|
||||||
*dp2 = '\0';
|
|
||||||
dp = dp2 + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// split each line into word and affix char strings
|
|
||||||
// "\/" signs slash in words (not affix separator)
|
|
||||||
// "/" at beginning of the line is word character (not affix separator)
|
|
||||||
ap = strchr(ts,'/');
|
|
||||||
while (ap) {
|
|
||||||
if (ap == ts) {
|
|
||||||
ap++;
|
|
||||||
continue;
|
|
||||||
} else if (*(ap - 1) != '\\') break;
|
|
||||||
// replace "\/" with "/"
|
|
||||||
for (char * sp = ap - 1; *sp; *sp = *(sp + 1), sp++);
|
|
||||||
ap = strchr(ap,'/');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ap) {
|
|
||||||
*ap = '\0';
|
|
||||||
if (aliasf) {
|
|
||||||
int index = atoi(ap + 1);
|
|
||||||
al = get_aliasf(index, &flags, dict);
|
|
||||||
if (!al) {
|
|
||||||
HUNSPELL_WARNING(stderr, "error: line %d: bad flag vector alias\n", dict->getlinenum());
|
|
||||||
*ap = '\0';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
al = decode_flags(&flags, ap + 1, dict);
|
|
||||||
if (al == -1) {
|
|
||||||
HUNSPELL_WARNING(stderr, "Can't allocate memory.\n");
|
|
||||||
delete dict;
|
|
||||||
return 6;
|
|
||||||
}
|
|
||||||
flag_qsort(flags, 0, al);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
al = 0;
|
|
||||||
ap = NULL;
|
|
||||||
flags = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int captype;
|
|
||||||
int wbl = strlen(ts);
|
|
||||||
int wcl = get_clen_and_captype(ts, wbl, &captype);
|
|
||||||
// add the word and its index plus its capitalized form optionally
|
|
||||||
if (add_word(ts,wbl,wcl,flags,al,dp, false) ||
|
|
||||||
add_hidden_capitalized_word(ts, wbl, wcl, flags, al, dp, captype)) {
|
|
||||||
delete dict;
|
|
||||||
return 5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
delete dict;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// the hash function is a simple load and rotate
|
|
||||||
// algorithm borrowed
|
|
||||||
|
|
||||||
int HashMgr::hash(const char * word) const
|
|
||||||
{
|
|
||||||
long hv = 0;
|
|
||||||
for (int i=0; i < 4 && *word != 0; i++)
|
|
||||||
hv = (hv << 8) | (*word++);
|
|
||||||
while (*word != 0) {
|
|
||||||
ROTATE(hv,ROTATE_LEN);
|
|
||||||
hv ^= (*word++);
|
|
||||||
}
|
|
||||||
return (unsigned long) hv % tablesize;
|
|
||||||
}
|
|
||||||
|
|
||||||
int HashMgr::decode_flags(unsigned short ** result, char * flags, FileMgr * af) {
|
|
||||||
int len;
|
|
||||||
if (*flags == '\0') {
|
|
||||||
*result = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
switch (flag_mode) {
|
|
||||||
case FLAG_LONG: { // two-character flags (1x2yZz -> 1x 2y Zz)
|
|
||||||
len = strlen(flags);
|
|
||||||
if (len%2 == 1) HUNSPELL_WARNING(stderr, "error: line %d: bad flagvector\n", af->getlinenum());
|
|
||||||
len /= 2;
|
|
||||||
*result = (unsigned short *) malloc(len * sizeof(short));
|
|
||||||
if (!*result) return -1;
|
|
||||||
for (int i = 0; i < len; i++) {
|
|
||||||
(*result)[i] = (((unsigned short) flags[i * 2]) << 8) + (unsigned short) flags[i * 2 + 1];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case FLAG_NUM: { // decimal numbers separated by comma (4521,23,233 -> 4521 23 233)
|
|
||||||
int i;
|
|
||||||
len = 1;
|
|
||||||
char * src = flags;
|
|
||||||
unsigned short * dest;
|
|
||||||
char * p;
|
|
||||||
for (p = flags; *p; p++) {
|
|
||||||
if (*p == ',') len++;
|
|
||||||
}
|
|
||||||
*result = (unsigned short *) malloc(len * sizeof(short));
|
|
||||||
if (!*result) return -1;
|
|
||||||
dest = *result;
|
|
||||||
for (p = flags; *p; p++) {
|
|
||||||
if (*p == ',') {
|
|
||||||
i = atoi(src);
|
|
||||||
if (i >= DEFAULTFLAGS) HUNSPELL_WARNING(stderr, "error: line %d: flag id %d is too large (max: %d)\n",
|
|
||||||
af->getlinenum(), i, DEFAULTFLAGS - 1);
|
|
||||||
*dest = (unsigned short) i;
|
|
||||||
if (*dest == 0) HUNSPELL_WARNING(stderr, "error: line %d: 0 is wrong flag id\n", af->getlinenum());
|
|
||||||
src = p + 1;
|
|
||||||
dest++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i = atoi(src);
|
|
||||||
if (i >= DEFAULTFLAGS) HUNSPELL_WARNING(stderr, "error: line %d: flag id %d is too large (max: %d)\n",
|
|
||||||
af->getlinenum(), i, DEFAULTFLAGS - 1);
|
|
||||||
*dest = (unsigned short) i;
|
|
||||||
if (*dest == 0) HUNSPELL_WARNING(stderr, "error: line %d: 0 is wrong flag id\n", af->getlinenum());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case FLAG_UNI: { // UTF-8 characters
|
|
||||||
w_char w[BUFSIZE/2];
|
|
||||||
len = u8_u16(w, BUFSIZE/2, flags);
|
|
||||||
*result = (unsigned short *) malloc(len * sizeof(short));
|
|
||||||
if (!*result) return -1;
|
|
||||||
memcpy(*result, w, len * sizeof(short));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: { // Ispell's one-character flags (erfg -> e r f g)
|
|
||||||
unsigned short * dest;
|
|
||||||
len = strlen(flags);
|
|
||||||
*result = (unsigned short *) malloc(len * sizeof(short));
|
|
||||||
if (!*result) return -1;
|
|
||||||
dest = *result;
|
|
||||||
for (unsigned char * p = (unsigned char *) flags; *p; p++) {
|
|
||||||
*dest = (unsigned short) *p;
|
|
||||||
dest++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned short HashMgr::decode_flag(const char * f) {
|
|
||||||
unsigned short s = 0;
|
|
||||||
int i;
|
|
||||||
switch (flag_mode) {
|
|
||||||
case FLAG_LONG:
|
|
||||||
s = ((unsigned short) f[0] << 8) + (unsigned short) f[1];
|
|
||||||
break;
|
|
||||||
case FLAG_NUM:
|
|
||||||
i = atoi(f);
|
|
||||||
if (i >= DEFAULTFLAGS) HUNSPELL_WARNING(stderr, "error: flag id %d is too large (max: %d)\n", i, DEFAULTFLAGS - 1);
|
|
||||||
s = (unsigned short) i;
|
|
||||||
break;
|
|
||||||
case FLAG_UNI:
|
|
||||||
u8_u16((w_char *) &s, 1, f);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
s = (unsigned short) *((unsigned char *)f);
|
|
||||||
}
|
|
||||||
if (s == 0) HUNSPELL_WARNING(stderr, "error: 0 is wrong flag id\n");
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
char * HashMgr::encode_flag(unsigned short f) {
|
|
||||||
unsigned char ch[10];
|
|
||||||
if (f==0) return mystrdup("(NULL)");
|
|
||||||
if (flag_mode == FLAG_LONG) {
|
|
||||||
ch[0] = (unsigned char) (f >> 8);
|
|
||||||
ch[1] = (unsigned char) (f - ((f >> 8) << 8));
|
|
||||||
ch[2] = '\0';
|
|
||||||
} else if (flag_mode == FLAG_NUM) {
|
|
||||||
sprintf((char *) ch, "%d", f);
|
|
||||||
} else if (flag_mode == FLAG_UNI) {
|
|
||||||
u16_u8((char *) &ch, 10, (w_char *) &f, 1);
|
|
||||||
} else {
|
|
||||||
ch[0] = (unsigned char) (f);
|
|
||||||
ch[1] = '\0';
|
|
||||||
}
|
|
||||||
return mystrdup((char *) ch);
|
|
||||||
}
|
|
||||||
|
|
||||||
// read in aff file and set flag mode
|
|
||||||
int HashMgr::load_config(const char * affpath, const char * key)
|
|
||||||
{
|
|
||||||
char * line; // io buffers
|
|
||||||
int firstline = 1;
|
|
||||||
|
|
||||||
// open the affix file
|
|
||||||
FileMgr * afflst = new FileMgr(affpath, key);
|
|
||||||
if (!afflst) {
|
|
||||||
HUNSPELL_WARNING(stderr, "Error - could not open affix description file %s\n",affpath);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// read in each line ignoring any that do not
|
|
||||||
// start with a known line type indicator
|
|
||||||
|
|
||||||
while ((line = afflst->getline()) != NULL) {
|
|
||||||
mychomp(line);
|
|
||||||
|
|
||||||
/* remove byte order mark */
|
|
||||||
if (firstline) {
|
|
||||||
firstline = 0;
|
|
||||||
if (strncmp(line,"\xEF\xBB\xBF",3) == 0) memmove(line, line+3, strlen(line+3)+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* parse in the try string */
|
|
||||||
if ((strncmp(line,"FLAG",4) == 0) && isspace(line[4])) {
|
|
||||||
if (flag_mode != FLAG_CHAR) {
|
|
||||||
HUNSPELL_WARNING(stderr, "error: line %d: multiple definitions of the FLAG affix file parameter\n", afflst->getlinenum());
|
|
||||||
}
|
|
||||||
if (strstr(line, "long")) flag_mode = FLAG_LONG;
|
|
||||||
if (strstr(line, "num")) flag_mode = FLAG_NUM;
|
|
||||||
if (strstr(line, "UTF-8")) flag_mode = FLAG_UNI;
|
|
||||||
if (flag_mode == FLAG_CHAR) {
|
|
||||||
HUNSPELL_WARNING(stderr, "error: line %d: FLAG needs `num', `long' or `UTF-8' parameter\n", afflst->getlinenum());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (strncmp(line,"FORBIDDENWORD",13) == 0) {
|
|
||||||
char * st = NULL;
|
|
||||||
if (parse_string(line, &st, afflst->getlinenum())) {
|
|
||||||
delete afflst;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
forbiddenword = decode_flag(st);
|
|
||||||
free(st);
|
|
||||||
}
|
|
||||||
if (strncmp(line, "SET", 3) == 0) {
|
|
||||||
if (parse_string(line, &enc, afflst->getlinenum())) {
|
|
||||||
delete afflst;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (strcmp(enc, "UTF-8") == 0) {
|
|
||||||
utf8 = 1;
|
|
||||||
#ifndef OPENOFFICEORG
|
|
||||||
#ifndef MOZILLA_CLIENT
|
|
||||||
initialize_utf_tbl();
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
} else csconv = get_current_cs(enc);
|
|
||||||
}
|
|
||||||
if (strncmp(line, "LANG", 4) == 0) {
|
|
||||||
if (parse_string(line, &lang, afflst->getlinenum())) {
|
|
||||||
delete afflst;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
langnum = get_lang_num(lang);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* parse in the ignored characters (for example, Arabic optional diacritics characters */
|
|
||||||
if (strncmp(line,"IGNORE",6) == 0) {
|
|
||||||
if (parse_array(line, &ignorechars, &ignorechars_utf16,
|
|
||||||
&ignorechars_utf16_len, utf8, afflst->getlinenum())) {
|
|
||||||
delete afflst;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((strncmp(line,"AF",2) == 0) && isspace(line[2])) {
|
|
||||||
if (parse_aliasf(line, afflst)) {
|
|
||||||
delete afflst;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((strncmp(line,"AM",2) == 0) && isspace(line[2])) {
|
|
||||||
if (parse_aliasm(line, afflst)) {
|
|
||||||
delete afflst;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strncmp(line,"COMPLEXPREFIXES",15) == 0) complexprefixes = 1;
|
|
||||||
if (((strncmp(line,"SFX",3) == 0) || (strncmp(line,"PFX",3) == 0)) && isspace(line[3])) break;
|
|
||||||
}
|
|
||||||
if (csconv == NULL) csconv = get_current_cs(SPELL_ENCODING);
|
|
||||||
delete afflst;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* parse in the ALIAS table */
|
|
||||||
int HashMgr::parse_aliasf(char * line, FileMgr * af)
|
|
||||||
{
|
|
||||||
if (numaliasf != 0) {
|
|
||||||
HUNSPELL_WARNING(stderr, "error: line %d: multiple table definitions\n", af->getlinenum());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
char * tp = line;
|
|
||||||
char * piece;
|
|
||||||
int i = 0;
|
|
||||||
int np = 0;
|
|
||||||
piece = mystrsep(&tp, 0);
|
|
||||||
while (piece) {
|
|
||||||
if (*piece != '\0') {
|
|
||||||
switch(i) {
|
|
||||||
case 0: { np++; break; }
|
|
||||||
case 1: {
|
|
||||||
numaliasf = atoi(piece);
|
|
||||||
if (numaliasf < 1) {
|
|
||||||
numaliasf = 0;
|
|
||||||
aliasf = NULL;
|
|
||||||
aliasflen = NULL;
|
|
||||||
HUNSPELL_WARNING(stderr, "error: line %d: bad entry number\n", af->getlinenum());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
aliasf = (unsigned short **) malloc(numaliasf * sizeof(unsigned short *));
|
|
||||||
aliasflen = (unsigned short *) malloc(numaliasf * sizeof(short));
|
|
||||||
if (!aliasf || !aliasflen) {
|
|
||||||
numaliasf = 0;
|
|
||||||
if (aliasf) free(aliasf);
|
|
||||||
if (aliasflen) free(aliasflen);
|
|
||||||
aliasf = NULL;
|
|
||||||
aliasflen = NULL;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
np++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
piece = mystrsep(&tp, 0);
|
|
||||||
}
|
|
||||||
if (np != 2) {
|
|
||||||
numaliasf = 0;
|
|
||||||
free(aliasf);
|
|
||||||
free(aliasflen);
|
|
||||||
aliasf = NULL;
|
|
||||||
aliasflen = NULL;
|
|
||||||
HUNSPELL_WARNING(stderr, "error: line %d: missing data\n", af->getlinenum());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now parse the numaliasf lines to read in the remainder of the table */
|
|
||||||
char * nl;
|
|
||||||
for (int j=0; j < numaliasf; j++) {
|
|
||||||
if ((nl = af->getline()) == NULL) return 1;
|
|
||||||
mychomp(nl);
|
|
||||||
tp = nl;
|
|
||||||
i = 0;
|
|
||||||
aliasf[j] = NULL;
|
|
||||||
aliasflen[j] = 0;
|
|
||||||
piece = mystrsep(&tp, 0);
|
|
||||||
while (piece) {
|
|
||||||
if (*piece != '\0') {
|
|
||||||
switch(i) {
|
|
||||||
case 0: {
|
|
||||||
if (strncmp(piece,"AF",2) != 0) {
|
|
||||||
numaliasf = 0;
|
|
||||||
free(aliasf);
|
|
||||||
free(aliasflen);
|
|
||||||
aliasf = NULL;
|
|
||||||
aliasflen = NULL;
|
|
||||||
HUNSPELL_WARNING(stderr, "error: line %d: table is corrupt\n", af->getlinenum());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1: {
|
|
||||||
aliasflen[j] = (unsigned short) decode_flags(&(aliasf[j]), piece, af);
|
|
||||||
flag_qsort(aliasf[j], 0, aliasflen[j]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
piece = mystrsep(&tp, 0);
|
|
||||||
}
|
|
||||||
if (!aliasf[j]) {
|
|
||||||
free(aliasf);
|
|
||||||
free(aliasflen);
|
|
||||||
aliasf = NULL;
|
|
||||||
aliasflen = NULL;
|
|
||||||
numaliasf = 0;
|
|
||||||
HUNSPELL_WARNING(stderr, "error: line %d: table is corrupt\n", af->getlinenum());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int HashMgr::is_aliasf() {
|
|
||||||
return (aliasf != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
int HashMgr::get_aliasf(int index, unsigned short ** fvec, FileMgr * af) {
|
|
||||||
if ((index > 0) && (index <= numaliasf)) {
|
|
||||||
*fvec = aliasf[index - 1];
|
|
||||||
return aliasflen[index - 1];
|
|
||||||
}
|
|
||||||
HUNSPELL_WARNING(stderr, "error: line %d: bad flag alias index: %d\n", af->getlinenum(), index);
|
|
||||||
*fvec = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* parse morph alias definitions */
|
|
||||||
int HashMgr::parse_aliasm(char * line, FileMgr * af)
|
|
||||||
{
|
|
||||||
if (numaliasm != 0) {
|
|
||||||
HUNSPELL_WARNING(stderr, "error: line %d: multiple table definitions\n", af->getlinenum());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
char * tp = line;
|
|
||||||
char * piece;
|
|
||||||
int i = 0;
|
|
||||||
int np = 0;
|
|
||||||
piece = mystrsep(&tp, 0);
|
|
||||||
while (piece) {
|
|
||||||
if (*piece != '\0') {
|
|
||||||
switch(i) {
|
|
||||||
case 0: { np++; break; }
|
|
||||||
case 1: {
|
|
||||||
numaliasm = atoi(piece);
|
|
||||||
if (numaliasm < 1) {
|
|
||||||
HUNSPELL_WARNING(stderr, "error: line %d: bad entry number\n", af->getlinenum());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
aliasm = (char **) malloc(numaliasm * sizeof(char *));
|
|
||||||
if (!aliasm) {
|
|
||||||
numaliasm = 0;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
np++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
piece = mystrsep(&tp, 0);
|
|
||||||
}
|
|
||||||
if (np != 2) {
|
|
||||||
numaliasm = 0;
|
|
||||||
free(aliasm);
|
|
||||||
aliasm = NULL;
|
|
||||||
HUNSPELL_WARNING(stderr, "error: line %d: missing data\n", af->getlinenum());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now parse the numaliasm lines to read in the remainder of the table */
|
|
||||||
char * nl = line;
|
|
||||||
for (int j=0; j < numaliasm; j++) {
|
|
||||||
if ((nl = af->getline()) == NULL) return 1;
|
|
||||||
mychomp(nl);
|
|
||||||
tp = nl;
|
|
||||||
i = 0;
|
|
||||||
aliasm[j] = NULL;
|
|
||||||
piece = mystrsep(&tp, ' ');
|
|
||||||
while (piece) {
|
|
||||||
if (*piece != '\0') {
|
|
||||||
switch(i) {
|
|
||||||
case 0: {
|
|
||||||
if (strncmp(piece,"AM",2) != 0) {
|
|
||||||
HUNSPELL_WARNING(stderr, "error: line %d: table is corrupt\n", af->getlinenum());
|
|
||||||
numaliasm = 0;
|
|
||||||
free(aliasm);
|
|
||||||
aliasm = NULL;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1: {
|
|
||||||
// add the remaining of the line
|
|
||||||
if (*tp) {
|
|
||||||
*(tp - 1) = ' ';
|
|
||||||
tp = tp + strlen(tp);
|
|
||||||
}
|
|
||||||
if (complexprefixes) {
|
|
||||||
if (utf8) reverseword_utf(piece);
|
|
||||||
else reverseword(piece);
|
|
||||||
}
|
|
||||||
aliasm[j] = mystrdup(piece);
|
|
||||||
if (!aliasm[j]) {
|
|
||||||
numaliasm = 0;
|
|
||||||
free(aliasm);
|
|
||||||
aliasm = NULL;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
break; }
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
piece = mystrsep(&tp, ' ');
|
|
||||||
}
|
|
||||||
if (!aliasm[j]) {
|
|
||||||
numaliasm = 0;
|
|
||||||
free(aliasm);
|
|
||||||
aliasm = NULL;
|
|
||||||
HUNSPELL_WARNING(stderr, "error: line %d: table is corrupt\n", af->getlinenum());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int HashMgr::is_aliasm() {
|
|
||||||
return (aliasm != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
char * HashMgr::get_aliasm(int index) {
|
|
||||||
if ((index > 0) && (index <= numaliasm)) return aliasm[index - 1];
|
|
||||||
HUNSPELL_WARNING(stderr, "error: bad morph. alias index: %d\n", index);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
|
@ -1,69 +0,0 @@
|
||||||
#ifndef _HASHMGR_HXX_
|
|
||||||
#define _HASHMGR_HXX_
|
|
||||||
|
|
||||||
#include "hunvisapi.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "htypes.hxx"
|
|
||||||
#include "filemgr.hxx"
|
|
||||||
|
|
||||||
enum flag { FLAG_CHAR, FLAG_LONG, FLAG_NUM, FLAG_UNI };
|
|
||||||
|
|
||||||
class LIBHUNSPELL_DLL_EXPORTED HashMgr
|
|
||||||
{
|
|
||||||
int tablesize;
|
|
||||||
struct hentry ** tableptr;
|
|
||||||
int userword;
|
|
||||||
flag flag_mode;
|
|
||||||
int complexprefixes;
|
|
||||||
int utf8;
|
|
||||||
unsigned short forbiddenword;
|
|
||||||
int langnum;
|
|
||||||
char * enc;
|
|
||||||
char * lang;
|
|
||||||
struct cs_info * csconv;
|
|
||||||
char * ignorechars;
|
|
||||||
unsigned short * ignorechars_utf16;
|
|
||||||
int ignorechars_utf16_len;
|
|
||||||
int numaliasf; // flag vector `compression' with aliases
|
|
||||||
unsigned short ** aliasf;
|
|
||||||
unsigned short * aliasflen;
|
|
||||||
int numaliasm; // morphological desciption `compression' with aliases
|
|
||||||
char ** aliasm;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
HashMgr(const char * tpath, const char * apath, const char * key = NULL);
|
|
||||||
~HashMgr();
|
|
||||||
|
|
||||||
struct hentry * lookup(const char *) const;
|
|
||||||
int hash(const char *) const;
|
|
||||||
struct hentry * walk_hashtable(int & col, struct hentry * hp) const;
|
|
||||||
|
|
||||||
int add(const char * word);
|
|
||||||
int add_with_affix(const char * word, const char * pattern);
|
|
||||||
int remove(const char * word);
|
|
||||||
int decode_flags(unsigned short ** result, char * flags, FileMgr * af);
|
|
||||||
unsigned short decode_flag(const char * flag);
|
|
||||||
char * encode_flag(unsigned short flag);
|
|
||||||
int is_aliasf();
|
|
||||||
int get_aliasf(int index, unsigned short ** fvec, FileMgr * af);
|
|
||||||
int is_aliasm();
|
|
||||||
char * get_aliasm(int index);
|
|
||||||
|
|
||||||
private:
|
|
||||||
int get_clen_and_captype(const char * word, int wbl, int * captype);
|
|
||||||
int load_tables(const char * tpath, const char * key);
|
|
||||||
int add_word(const char * word, int wbl, int wcl, unsigned short * ap,
|
|
||||||
int al, const char * desc, bool onlyupcase);
|
|
||||||
int load_config(const char * affpath, const char * key);
|
|
||||||
int parse_aliasf(char * line, FileMgr * af);
|
|
||||||
int add_hidden_capitalized_word(char * word, int wbl, int wcl,
|
|
||||||
unsigned short * flags, int al, char * dp, int captype);
|
|
||||||
int parse_aliasm(char * line, FileMgr * af);
|
|
||||||
int remove_forbidden_flag(const char * word);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,32 +0,0 @@
|
||||||
#ifndef _HTYPES_HXX_
|
|
||||||
#define _HTYPES_HXX_
|
|
||||||
|
|
||||||
#define ROTATE_LEN 5
|
|
||||||
|
|
||||||
#define ROTATE(v,q) \
|
|
||||||
(v) = ((v) << (q)) | (((v) >> (32 - q)) & ((1 << (q))-1));
|
|
||||||
|
|
||||||
// hentry options
|
|
||||||
#define H_OPT (1 << 0)
|
|
||||||
#define H_OPT_ALIASM (1 << 1)
|
|
||||||
#define H_OPT_PHON (1 << 2)
|
|
||||||
|
|
||||||
// see also csutil.hxx
|
|
||||||
#define HENTRY_WORD(h) &(h->word[0])
|
|
||||||
|
|
||||||
// approx. number of user defined words
|
|
||||||
#define USERWORD 1000
|
|
||||||
|
|
||||||
struct hentry
|
|
||||||
{
|
|
||||||
unsigned char blen; // word length in bytes
|
|
||||||
unsigned char clen; // word length in characters (different for UTF-8 enc.)
|
|
||||||
short alen; // length of affix flag vector
|
|
||||||
unsigned short * astr; // affix flag vector
|
|
||||||
struct hentry * next; // next word with same hash code
|
|
||||||
struct hentry * next_homonym; // next homonym word (with same hash code)
|
|
||||||
char var; // variable fields (only for special pronounciation yet)
|
|
||||||
char word[1]; // variable-length word (8-bit or UTF-8 encoding)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,164 +0,0 @@
|
||||||
# Microsoft Developer Studio Project File - Name="hunspell" - Package Owner=<4>
|
|
||||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
|
||||||
# ** DO NOT EDIT **
|
|
||||||
|
|
||||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
|
||||||
|
|
||||||
CFG=hunspell - Win32 Debug
|
|
||||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
|
||||||
!MESSAGE use the Export Makefile command and run
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE NMAKE /f "hunspell.mak".
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE You can specify a configuration when running NMAKE
|
|
||||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE NMAKE /f "hunspell.mak" CFG="hunspell - Win32 Debug"
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE Possible choices for configuration are:
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE "hunspell - Win32 Release" (based on "Win32 (x86) Static Library")
|
|
||||||
!MESSAGE "hunspell - Win32 Debug" (based on "Win32 (x86) Static Library")
|
|
||||||
!MESSAGE
|
|
||||||
|
|
||||||
# Begin Project
|
|
||||||
# PROP AllowPerConfigDependencies 0
|
|
||||||
# PROP Scc_ProjName ""
|
|
||||||
# PROP Scc_LocalPath ""
|
|
||||||
CPP=cl.exe
|
|
||||||
RSC=rc.exe
|
|
||||||
|
|
||||||
!IF "$(CFG)" == "hunspell - Win32 Release"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
|
||||||
# PROP BASE Output_Dir "Release"
|
|
||||||
# PROP BASE Intermediate_Dir "Release"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 0
|
|
||||||
# PROP Output_Dir "Release"
|
|
||||||
# PROP Intermediate_Dir "Release"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "W32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
|
||||||
# ADD CPP /nologo /W3 /GX /O2 /D "W32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
|
||||||
# ADD BASE RSC /l 0x40e /d "NDEBUG"
|
|
||||||
# ADD RSC /l 0x40e /d "NDEBUG"
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LIB32=link.exe -lib
|
|
||||||
# ADD BASE LIB32 /nologo
|
|
||||||
# ADD LIB32 /nologo
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "hunspell - Win32 Debug"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
|
||||||
# PROP BASE Output_Dir "Debug"
|
|
||||||
# PROP BASE Intermediate_Dir "Debug"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 1
|
|
||||||
# PROP Output_Dir "Debug"
|
|
||||||
# PROP Intermediate_Dir "Debug"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "W32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
|
||||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "W32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
|
||||||
# ADD BASE RSC /l 0x40e /d "_DEBUG"
|
|
||||||
# ADD RSC /l 0x40e /d "_DEBUG"
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LIB32=link.exe -lib
|
|
||||||
# ADD BASE LIB32 /nologo
|
|
||||||
# ADD LIB32 /nologo
|
|
||||||
|
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
# Begin Target
|
|
||||||
|
|
||||||
# Name "hunspell - Win32 Release"
|
|
||||||
# Name "hunspell - Win32 Debug"
|
|
||||||
# Begin Group "Source Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\affentry.cxx
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\affixmgr.cxx
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\csutil.cxx
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\dictmgr.cxx
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\hashmgr.cxx
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\hunspell.cxx
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\suggestmgr.cxx
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# Begin Group "Header Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\affentry.hxx
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\affixmgr.hxx
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\atypes.hxx
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\baseaffix.hxx
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\csutil.hxx
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\dictmgr.hxx
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\hashmgr.hxx
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\htypes.hxx
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\langnum.hxx
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\hunspell.hxx
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\suggestmgr.hxx
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# End Target
|
|
||||||
# End Project
|
|
|
@ -1,95 +0,0 @@
|
||||||
#ifndef _MYSPELLMGR_H_
|
|
||||||
#define _MYSPELLMGR_H_
|
|
||||||
|
|
||||||
#include "hunvisapi.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct Hunhandle Hunhandle;
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED Hunhandle *Hunspell_create(const char * affpath, const char * dpath);
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED Hunhandle *Hunspell_create_key(const char * affpath, const char * dpath,
|
|
||||||
const char * key);
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void Hunspell_destroy(Hunhandle *pHunspell);
|
|
||||||
|
|
||||||
/* spell(word) - spellcheck word
|
|
||||||
* output: 0 = bad word, not 0 = good word
|
|
||||||
*/
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int Hunspell_spell(Hunhandle *pHunspell, const char *);
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED char *Hunspell_get_dic_encoding(Hunhandle *pHunspell);
|
|
||||||
|
|
||||||
/* suggest(suggestions, word) - search suggestions
|
|
||||||
* input: pointer to an array of strings pointer and the (bad) word
|
|
||||||
* array of strings pointer (here *slst) may not be initialized
|
|
||||||
* output: number of suggestions in string array, and suggestions in
|
|
||||||
* a newly allocated array of strings (*slts will be NULL when number
|
|
||||||
* of suggestion equals 0.)
|
|
||||||
*/
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int Hunspell_suggest(Hunhandle *pHunspell, char*** slst, const char * word);
|
|
||||||
|
|
||||||
/* morphological functions */
|
|
||||||
|
|
||||||
/* analyze(result, word) - morphological analysis of the word */
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int Hunspell_analyze(Hunhandle *pHunspell, char*** slst, const char * word);
|
|
||||||
|
|
||||||
/* stem(result, word) - stemmer function */
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int Hunspell_stem(Hunhandle *pHunspell, char*** slst, const char * word);
|
|
||||||
|
|
||||||
/* stem(result, analysis, n) - get stems from a morph. analysis
|
|
||||||
* example:
|
|
||||||
* char ** result, result2;
|
|
||||||
* int n1 = Hunspell_analyze(result, "words");
|
|
||||||
* int n2 = Hunspell_stem2(result2, result, n1);
|
|
||||||
*/
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int Hunspell_stem2(Hunhandle *pHunspell, char*** slst, char** desc, int n);
|
|
||||||
|
|
||||||
/* generate(result, word, word2) - morphological generation by example(s) */
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int Hunspell_generate(Hunhandle *pHunspell, char*** slst, const char * word,
|
|
||||||
const char * word2);
|
|
||||||
|
|
||||||
/* generate(result, word, desc, n) - generation by morph. description(s)
|
|
||||||
* example:
|
|
||||||
* char ** result;
|
|
||||||
* char * affix = "is:plural"; // description depends from dictionaries, too
|
|
||||||
* int n = Hunspell_generate2(result, "word", &affix, 1);
|
|
||||||
* for (int i = 0; i < n; i++) printf("%s\n", result[i]);
|
|
||||||
*/
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int Hunspell_generate2(Hunhandle *pHunspell, char*** slst, const char * word,
|
|
||||||
char** desc, int n);
|
|
||||||
|
|
||||||
/* functions for run-time modification of the dictionary */
|
|
||||||
|
|
||||||
/* add word to the run-time dictionary */
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int Hunspell_add(Hunhandle *pHunspell, const char * word);
|
|
||||||
|
|
||||||
/* add word to the run-time dictionary with affix flags of
|
|
||||||
* the example (a dictionary word): Hunspell will recognize
|
|
||||||
* affixed forms of the new word, too.
|
|
||||||
*/
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int Hunspell_add_with_affix(Hunhandle *pHunspell, const char * word, const char * example);
|
|
||||||
|
|
||||||
/* remove word from the run-time dictionary */
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int Hunspell_remove(Hunhandle *pHunspell, const char * word);
|
|
||||||
|
|
||||||
/* free suggestion lists */
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void Hunspell_free_list(Hunhandle *pHunspell, char *** slst, int n);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,184 +0,0 @@
|
||||||
#include "hunvisapi.h"
|
|
||||||
|
|
||||||
#include "hashmgr.hxx"
|
|
||||||
#include "affixmgr.hxx"
|
|
||||||
#include "suggestmgr.hxx"
|
|
||||||
#include "langnum.hxx"
|
|
||||||
|
|
||||||
#define SPELL_XML "<?xml?>"
|
|
||||||
|
|
||||||
#define MAXDIC 20
|
|
||||||
#define MAXSUGGESTION 15
|
|
||||||
#define MAXSHARPS 5
|
|
||||||
|
|
||||||
#define HUNSPELL_OK (1 << 0)
|
|
||||||
#define HUNSPELL_OK_WARN (1 << 1)
|
|
||||||
|
|
||||||
#ifndef _MYSPELLMGR_HXX_
|
|
||||||
#define _MYSPELLMGR_HXX_
|
|
||||||
|
|
||||||
class LIBHUNSPELL_DLL_EXPORTED Hunspell
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
Hunspell(const Hunspell&);
|
|
||||||
Hunspell& operator = (const Hunspell&);
|
|
||||||
private:
|
|
||||||
AffixMgr* pAMgr;
|
|
||||||
HashMgr* pHMgr[MAXDIC];
|
|
||||||
int maxdic;
|
|
||||||
SuggestMgr* pSMgr;
|
|
||||||
char * affixpath;
|
|
||||||
char * encoding;
|
|
||||||
struct cs_info * csconv;
|
|
||||||
int langnum;
|
|
||||||
int utf8;
|
|
||||||
int complexprefixes;
|
|
||||||
char** wordbreak;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/* Hunspell(aff, dic) - constructor of Hunspell class
|
|
||||||
* input: path of affix file and dictionary file
|
|
||||||
*
|
|
||||||
* In WIN32 environment, use UTF-8 encoded paths started with the long path
|
|
||||||
* prefix \\\\?\\ to handle system-independent character encoding and very
|
|
||||||
* long path names (without the long path prefix Hunspell will use fopen()
|
|
||||||
* with system-dependent character encoding instead of _wfopen()).
|
|
||||||
*/
|
|
||||||
|
|
||||||
Hunspell(const char * affpath, const char * dpath, const char * key = NULL);
|
|
||||||
~Hunspell();
|
|
||||||
|
|
||||||
/* load extra dictionaries (only dic files) */
|
|
||||||
int add_dic(const char * dpath, const char * key = NULL);
|
|
||||||
|
|
||||||
/* spell(word) - spellcheck word
|
|
||||||
* output: 0 = bad word, not 0 = good word
|
|
||||||
*
|
|
||||||
* plus output:
|
|
||||||
* info: information bit array, fields:
|
|
||||||
* SPELL_COMPOUND = a compound word
|
|
||||||
* SPELL_FORBIDDEN = an explicit forbidden word
|
|
||||||
* root: root (stem), when input is a word with affix(es)
|
|
||||||
*/
|
|
||||||
|
|
||||||
int spell(const char * word, int * info = NULL, char ** root = NULL);
|
|
||||||
|
|
||||||
/* suggest(suggestions, word) - search suggestions
|
|
||||||
* input: pointer to an array of strings pointer and the (bad) word
|
|
||||||
* array of strings pointer (here *slst) may not be initialized
|
|
||||||
* output: number of suggestions in string array, and suggestions in
|
|
||||||
* a newly allocated array of strings (*slts will be NULL when number
|
|
||||||
* of suggestion equals 0.)
|
|
||||||
*/
|
|
||||||
|
|
||||||
int suggest(char*** slst, const char * word);
|
|
||||||
|
|
||||||
/* deallocate suggestion lists */
|
|
||||||
|
|
||||||
void free_list(char *** slst, int n);
|
|
||||||
|
|
||||||
char * get_dic_encoding();
|
|
||||||
|
|
||||||
/* morphological functions */
|
|
||||||
|
|
||||||
/* analyze(result, word) - morphological analysis of the word */
|
|
||||||
|
|
||||||
int analyze(char*** slst, const char * word);
|
|
||||||
|
|
||||||
/* stem(result, word) - stemmer function */
|
|
||||||
|
|
||||||
int stem(char*** slst, const char * word);
|
|
||||||
|
|
||||||
/* stem(result, analysis, n) - get stems from a morph. analysis
|
|
||||||
* example:
|
|
||||||
* char ** result, result2;
|
|
||||||
* int n1 = analyze(&result, "words");
|
|
||||||
* int n2 = stem(&result2, result, n1);
|
|
||||||
*/
|
|
||||||
|
|
||||||
int stem(char*** slst, char ** morph, int n);
|
|
||||||
|
|
||||||
/* generate(result, word, word2) - morphological generation by example(s) */
|
|
||||||
|
|
||||||
int generate(char*** slst, const char * word, const char * word2);
|
|
||||||
|
|
||||||
/* generate(result, word, desc, n) - generation by morph. description(s)
|
|
||||||
* example:
|
|
||||||
* char ** result;
|
|
||||||
* char * affix = "is:plural"; // description depends from dictionaries, too
|
|
||||||
* int n = generate(&result, "word", &affix, 1);
|
|
||||||
* for (int i = 0; i < n; i++) printf("%s\n", result[i]);
|
|
||||||
*/
|
|
||||||
|
|
||||||
int generate(char*** slst, const char * word, char ** desc, int n);
|
|
||||||
|
|
||||||
/* functions for run-time modification of the dictionary */
|
|
||||||
|
|
||||||
/* add word to the run-time dictionary */
|
|
||||||
|
|
||||||
int add(const char * word);
|
|
||||||
|
|
||||||
/* add word to the run-time dictionary with affix flags of
|
|
||||||
* the example (a dictionary word): Hunspell will recognize
|
|
||||||
* affixed forms of the new word, too.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int add_with_affix(const char * word, const char * example);
|
|
||||||
|
|
||||||
/* remove word from the run-time dictionary */
|
|
||||||
|
|
||||||
int remove(const char * word);
|
|
||||||
|
|
||||||
/* other */
|
|
||||||
|
|
||||||
/* get extra word characters definied in affix file for tokenization */
|
|
||||||
const char * get_wordchars();
|
|
||||||
unsigned short * get_wordchars_utf16(int * len);
|
|
||||||
|
|
||||||
struct cs_info * get_csconv();
|
|
||||||
const char * get_version();
|
|
||||||
|
|
||||||
int get_langnum() const;
|
|
||||||
|
|
||||||
/* need for putdic */
|
|
||||||
int input_conv(const char * word, char * dest);
|
|
||||||
|
|
||||||
/* experimental and deprecated functions */
|
|
||||||
|
|
||||||
#ifdef HUNSPELL_EXPERIMENTAL
|
|
||||||
/* suffix is an affix flag string, similarly in dictionary files */
|
|
||||||
int put_word_suffix(const char * word, const char * suffix);
|
|
||||||
char * morph_with_correction(const char * word);
|
|
||||||
|
|
||||||
/* spec. suggestions */
|
|
||||||
int suggest_auto(char*** slst, const char * word);
|
|
||||||
int suggest_pos_stems(char*** slst, const char * word);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
|
||||||
int cleanword(char *, const char *, int * pcaptype, int * pabbrev);
|
|
||||||
int cleanword2(char *, const char *, w_char *, int * w_len, int * pcaptype, int * pabbrev);
|
|
||||||
void mkinitcap(char *);
|
|
||||||
int mkinitcap2(char * p, w_char * u, int nc);
|
|
||||||
int mkinitsmall2(char * p, w_char * u, int nc);
|
|
||||||
void mkallcap(char *);
|
|
||||||
int mkallcap2(char * p, w_char * u, int nc);
|
|
||||||
void mkallsmall(char *);
|
|
||||||
int mkallsmall2(char * p, w_char * u, int nc);
|
|
||||||
struct hentry * checkword(const char *, int * info, char **root);
|
|
||||||
char * sharps_u8_l1(char * dest, char * source);
|
|
||||||
hentry * spellsharps(char * base, char *, int, int, char * tmp, int * info, char **root);
|
|
||||||
int is_keepcase(const hentry * rv);
|
|
||||||
int insert_sug(char ***slst, char * word, int ns);
|
|
||||||
void cat_result(char * result, char * st);
|
|
||||||
char * stem_description(const char * desc);
|
|
||||||
int spellml(char*** slst, const char * word);
|
|
||||||
int get_xml_par(char * dest, const char * par, int maxl);
|
|
||||||
const char * get_xml_pos(const char * s, const char * attr);
|
|
||||||
int get_xml_list(char ***slst, char * list, const char * tag);
|
|
||||||
int check_xml_par(const char * q, const char * attr, const char * value);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,18 +0,0 @@
|
||||||
#ifndef _HUNSPELL_VISIBILITY_H_
|
|
||||||
#define _HUNSPELL_VISIBILITY_H_
|
|
||||||
|
|
||||||
#if defined(HUNSPELL_STATIC)
|
|
||||||
# define LIBHUNSPELL_DLL_EXPORTED
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
# if defined(BUILDING_LIBHUNSPELL)
|
|
||||||
# define LIBHUNSPELL_DLL_EXPORTED __declspec(dllexport)
|
|
||||||
# else
|
|
||||||
# define LIBHUNSPELL_DLL_EXPORTED __declspec(dllimport)
|
|
||||||
# endif
|
|
||||||
#elif defined(BUILDING_LIBHUNSPELL) && 1
|
|
||||||
# define LIBHUNSPELL_DLL_EXPORTED __attribute__((__visibility__("default")))
|
|
||||||
#else
|
|
||||||
# define LIBHUNSPELL_DLL_EXPORTED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,18 +0,0 @@
|
||||||
#ifndef _HUNSPELL_VISIBILITY_H_
|
|
||||||
#define _HUNSPELL_VISIBILITY_H_
|
|
||||||
|
|
||||||
#if defined(HUNSPELL_STATIC)
|
|
||||||
# define LIBHUNSPELL_DLL_EXPORTED
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
# if defined(BUILDING_LIBHUNSPELL)
|
|
||||||
# define LIBHUNSPELL_DLL_EXPORTED __declspec(dllexport)
|
|
||||||
# else
|
|
||||||
# define LIBHUNSPELL_DLL_EXPORTED __declspec(dllimport)
|
|
||||||
# endif
|
|
||||||
#elif defined(BUILDING_LIBHUNSPELL) && @HAVE_VISIBILITY@
|
|
||||||
# define LIBHUNSPELL_DLL_EXPORTED __attribute__((__visibility__("default")))
|
|
||||||
#else
|
|
||||||
# define LIBHUNSPELL_DLL_EXPORTED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,196 +0,0 @@
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "hunzip.hxx"
|
|
||||||
#include "csutil.hxx"
|
|
||||||
|
|
||||||
#define CODELEN 65536
|
|
||||||
#define BASEBITREC 5000
|
|
||||||
|
|
||||||
#define UNCOMPRESSED '\002'
|
|
||||||
#define MAGIC "hz0"
|
|
||||||
#define MAGIC_ENCRYPT "hz1"
|
|
||||||
#define MAGICLEN (sizeof(MAGIC) - 1)
|
|
||||||
|
|
||||||
int Hunzip::fail(const char * err, const char * par) {
|
|
||||||
fprintf(stderr, err, par);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Hunzip::Hunzip(const char * file, const char * key)
|
|
||||||
: fin(NULL)
|
|
||||||
, bufsiz(0)
|
|
||||||
, lastbit(0)
|
|
||||||
, inc(0)
|
|
||||||
, inbits(0)
|
|
||||||
, outc(0)
|
|
||||||
, dec(NULL)
|
|
||||||
{
|
|
||||||
in[0] = out[0] = line[0] = '\0';
|
|
||||||
filename = mystrdup(file);
|
|
||||||
if (getcode(key) == -1) bufsiz = -1;
|
|
||||||
else bufsiz = getbuf();
|
|
||||||
}
|
|
||||||
|
|
||||||
int Hunzip::getcode(const char * key) {
|
|
||||||
unsigned char c[2];
|
|
||||||
int i, j, n, p;
|
|
||||||
int allocatedbit = BASEBITREC;
|
|
||||||
const char * enc = key;
|
|
||||||
|
|
||||||
if (!filename) return -1;
|
|
||||||
|
|
||||||
fin = myfopen(filename, "rb");
|
|
||||||
if (!fin) return -1;
|
|
||||||
|
|
||||||
// read magic number
|
|
||||||
if ((fread(in, 1, 3, fin) < MAGICLEN)
|
|
||||||
|| !(strncmp(MAGIC, in, MAGICLEN) == 0 ||
|
|
||||||
strncmp(MAGIC_ENCRYPT, in, MAGICLEN) == 0)) {
|
|
||||||
return fail(MSG_FORMAT, filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check encryption
|
|
||||||
if (strncmp(MAGIC_ENCRYPT, in, MAGICLEN) == 0) {
|
|
||||||
unsigned char cs;
|
|
||||||
if (!key) return fail(MSG_KEY, filename);
|
|
||||||
if (fread(&c, 1, 1, fin) < 1) return fail(MSG_FORMAT, filename);
|
|
||||||
for (cs = 0; *enc; enc++) cs ^= *enc;
|
|
||||||
if (cs != c[0]) return fail(MSG_KEY, filename);
|
|
||||||
enc = key;
|
|
||||||
} else key = NULL;
|
|
||||||
|
|
||||||
// read record count
|
|
||||||
if (fread(&c, 1, 2, fin) < 2) return fail(MSG_FORMAT, filename);
|
|
||||||
|
|
||||||
if (key) {
|
|
||||||
c[0] ^= *enc;
|
|
||||||
if (*(++enc) == '\0') enc = key;
|
|
||||||
c[1] ^= *enc;
|
|
||||||
}
|
|
||||||
|
|
||||||
n = ((int) c[0] << 8) + c[1];
|
|
||||||
dec = (struct bit *) malloc(BASEBITREC * sizeof(struct bit));
|
|
||||||
if (!dec) return fail(MSG_MEMORY, filename);
|
|
||||||
dec[0].v[0] = 0;
|
|
||||||
dec[0].v[1] = 0;
|
|
||||||
|
|
||||||
// read codes
|
|
||||||
for (i = 0; i < n; i++) {
|
|
||||||
unsigned char l;
|
|
||||||
if (fread(c, 1, 2, fin) < 2) return fail(MSG_FORMAT, filename);
|
|
||||||
if (key) {
|
|
||||||
if (*(++enc) == '\0') enc = key;
|
|
||||||
c[0] ^= *enc;
|
|
||||||
if (*(++enc) == '\0') enc = key;
|
|
||||||
c[1] ^= *enc;
|
|
||||||
}
|
|
||||||
if (fread(&l, 1, 1, fin) < 1) return fail(MSG_FORMAT, filename);
|
|
||||||
if (key) {
|
|
||||||
if (*(++enc) == '\0') enc = key;
|
|
||||||
l ^= *enc;
|
|
||||||
}
|
|
||||||
if (fread(in, 1, l/8+1, fin) < (size_t) l/8+1) return fail(MSG_FORMAT, filename);
|
|
||||||
if (key) for (j = 0; j <= l/8; j++) {
|
|
||||||
if (*(++enc) == '\0') enc = key;
|
|
||||||
in[j] ^= *enc;
|
|
||||||
}
|
|
||||||
p = 0;
|
|
||||||
for (j = 0; j < l; j++) {
|
|
||||||
int b = (in[j/8] & (1 << (7 - (j % 8)))) ? 1 : 0;
|
|
||||||
int oldp = p;
|
|
||||||
p = dec[p].v[b];
|
|
||||||
if (p == 0) {
|
|
||||||
lastbit++;
|
|
||||||
if (lastbit == allocatedbit) {
|
|
||||||
allocatedbit += BASEBITREC;
|
|
||||||
dec = (struct bit *) realloc(dec, allocatedbit * sizeof(struct bit));
|
|
||||||
}
|
|
||||||
dec[lastbit].v[0] = 0;
|
|
||||||
dec[lastbit].v[1] = 0;
|
|
||||||
dec[oldp].v[b] = lastbit;
|
|
||||||
p = lastbit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dec[p].c[0] = c[0];
|
|
||||||
dec[p].c[1] = c[1];
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Hunzip::~Hunzip()
|
|
||||||
{
|
|
||||||
if (dec) free(dec);
|
|
||||||
if (fin) fclose(fin);
|
|
||||||
if (filename) free(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
int Hunzip::getbuf() {
|
|
||||||
int p = 0;
|
|
||||||
int o = 0;
|
|
||||||
do {
|
|
||||||
if (inc == 0) inbits = fread(in, 1, BUFSIZE, fin) * 8;
|
|
||||||
for (; inc < inbits; inc++) {
|
|
||||||
int b = (in[inc / 8] & (1 << (7 - (inc % 8)))) ? 1 : 0;
|
|
||||||
int oldp = p;
|
|
||||||
p = dec[p].v[b];
|
|
||||||
if (p == 0) {
|
|
||||||
if (oldp == lastbit) {
|
|
||||||
fclose(fin);
|
|
||||||
fin = NULL;
|
|
||||||
// add last odd byte
|
|
||||||
if (dec[lastbit].c[0]) out[o++] = dec[lastbit].c[1];
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
out[o++] = dec[oldp].c[0];
|
|
||||||
out[o++] = dec[oldp].c[1];
|
|
||||||
if (o == BUFSIZE) return o;
|
|
||||||
p = dec[p].v[b];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inc = 0;
|
|
||||||
} while (inbits == BUFSIZE * 8);
|
|
||||||
return fail(MSG_FORMAT, filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char * Hunzip::getline() {
|
|
||||||
char linebuf[BUFSIZE];
|
|
||||||
int l = 0, eol = 0, left = 0, right = 0;
|
|
||||||
if (bufsiz == -1) return NULL;
|
|
||||||
while (l < bufsiz && !eol) {
|
|
||||||
linebuf[l++] = out[outc];
|
|
||||||
switch (out[outc]) {
|
|
||||||
case '\t': break;
|
|
||||||
case 31: { // escape
|
|
||||||
if (++outc == bufsiz) {
|
|
||||||
bufsiz = getbuf();
|
|
||||||
outc = 0;
|
|
||||||
}
|
|
||||||
linebuf[l - 1] = out[outc];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ' ': break;
|
|
||||||
default: if (((unsigned char) out[outc]) < 47) {
|
|
||||||
if (out[outc] > 32) {
|
|
||||||
right = out[outc] - 31;
|
|
||||||
if (++outc == bufsiz) {
|
|
||||||
bufsiz = getbuf();
|
|
||||||
outc = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (out[outc] == 30) left = 9; else left = out[outc];
|
|
||||||
linebuf[l-1] = '\n';
|
|
||||||
eol = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (++outc == bufsiz) {
|
|
||||||
outc = 0;
|
|
||||||
bufsiz = fin ? getbuf(): -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (right) strcpy(linebuf + l - 1, line + strlen(line) - right - 1);
|
|
||||||
else linebuf[l] = '\0';
|
|
||||||
strcpy(line + left, linebuf);
|
|
||||||
return line;
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/* hunzip: file decompression for sorted dictionaries with optional encryption,
|
|
||||||
* algorithm: prefix-suffix encoding and 16-bit Huffman encoding */
|
|
||||||
|
|
||||||
#ifndef _HUNZIP_HXX_
|
|
||||||
#define _HUNZIP_HXX_
|
|
||||||
|
|
||||||
#include "hunvisapi.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#define BUFSIZE 65536
|
|
||||||
#define HZIP_EXTENSION ".hz"
|
|
||||||
|
|
||||||
#define MSG_OPEN "error: %s: cannot open\n"
|
|
||||||
#define MSG_FORMAT "error: %s: not in hzip format\n"
|
|
||||||
#define MSG_MEMORY "error: %s: missing memory\n"
|
|
||||||
#define MSG_KEY "error: %s: missing or bad password\n"
|
|
||||||
|
|
||||||
struct bit {
|
|
||||||
unsigned char c[2];
|
|
||||||
int v[2];
|
|
||||||
};
|
|
||||||
|
|
||||||
class LIBHUNSPELL_DLL_EXPORTED Hunzip
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
Hunzip(const Hunzip&);
|
|
||||||
Hunzip& operator = (const Hunzip&);
|
|
||||||
protected:
|
|
||||||
char * filename;
|
|
||||||
FILE * fin;
|
|
||||||
int bufsiz, lastbit, inc, inbits, outc;
|
|
||||||
struct bit * dec; // code table
|
|
||||||
char in[BUFSIZE]; // input buffer
|
|
||||||
char out[BUFSIZE + 1]; // Huffman-decoded buffer
|
|
||||||
char line[BUFSIZE + 50]; // decoded line
|
|
||||||
int getcode(const char * key);
|
|
||||||
int getbuf();
|
|
||||||
int fail(const char * err, const char * par);
|
|
||||||
|
|
||||||
public:
|
|
||||||
Hunzip(const char * filename, const char * key = NULL);
|
|
||||||
~Hunzip();
|
|
||||||
const char * getline();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,38 +0,0 @@
|
||||||
#ifndef _LANGNUM_HXX_
|
|
||||||
#define _LANGNUM_HXX_
|
|
||||||
|
|
||||||
/*
|
|
||||||
language numbers for language specific codes
|
|
||||||
see http://l10n.openoffice.org/languages.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
enum {
|
|
||||||
LANG_ar=96,
|
|
||||||
LANG_az=100, // custom number
|
|
||||||
LANG_bg=41,
|
|
||||||
LANG_ca=37,
|
|
||||||
LANG_cs=42,
|
|
||||||
LANG_da=45,
|
|
||||||
LANG_de=49,
|
|
||||||
LANG_el=30,
|
|
||||||
LANG_en=01,
|
|
||||||
LANG_es=34,
|
|
||||||
LANG_eu=10,
|
|
||||||
LANG_fr=02,
|
|
||||||
LANG_gl=38,
|
|
||||||
LANG_hr=78,
|
|
||||||
LANG_hu=36,
|
|
||||||
LANG_it=39,
|
|
||||||
LANG_la=99, // custom number
|
|
||||||
LANG_lv=101, // custom number
|
|
||||||
LANG_nl=31,
|
|
||||||
LANG_pl=48,
|
|
||||||
LANG_pt=03,
|
|
||||||
LANG_ru=07,
|
|
||||||
LANG_sv=50,
|
|
||||||
LANG_tr=90,
|
|
||||||
LANG_uk=80,
|
|
||||||
LANG_xx=999
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,59 +0,0 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
|
||||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
||||||
* for the specific language governing rights and limitations under the
|
|
||||||
* License.
|
|
||||||
*
|
|
||||||
* The Original Code is Hunspell, based on MySpell.
|
|
||||||
*
|
|
||||||
* The Initial Developers of the Original Code are
|
|
||||||
* Kevin Hendricks (MySpell) and Laszlo Nemeth (Hunspell).
|
|
||||||
* Portions created by the Initial Developers are Copyright (C) 2002-2005
|
|
||||||
* the Initial Developers. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* David Einstein
|
|
||||||
* Davide Prina
|
|
||||||
* Giuseppe Modugno
|
|
||||||
* Gianluca Turconi
|
|
||||||
* Simon Brouwer
|
|
||||||
* Noll Janos
|
|
||||||
* Biro Arpad
|
|
||||||
* Goldman Eleonora
|
|
||||||
* Sarlos Tamas
|
|
||||||
* Bencsath Boldizsar
|
|
||||||
* Halacsy Peter
|
|
||||||
* Dvornik Laszlo
|
|
||||||
* Gefferth Andras
|
|
||||||
* Nagy Viktor
|
|
||||||
* Varga Daniel
|
|
||||||
* Chris Halls
|
|
||||||
* Rene Engelhard
|
|
||||||
* Bram Moolenaar
|
|
||||||
* Dafydd Jones
|
|
||||||
* Harri Pitkanen
|
|
||||||
* Andras Timar
|
|
||||||
* Tor Lillqvist
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#include "config.h"
|
|
|
@ -1,61 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2002 Kevin B. Hendricks, Stratford, Ontario, Canada
|
|
||||||
* And Contributors. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. All modifications to the source code must be clearly marked as
|
|
||||||
* such. Binary redistributions based on modified source code
|
|
||||||
* must be clearly marked as modified versions in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY KEVIN B. HENDRICKS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
||||||
* KEVIN B. HENDRICKS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: A special thanks and credit goes to Geoff Kuenning
|
|
||||||
* the creator of ispell. MySpell's affix algorithms were
|
|
||||||
* based on those of ispell which should be noted is
|
|
||||||
* copyright Geoff Kuenning et.al. and now available
|
|
||||||
* under a BSD style license. For more information on ispell
|
|
||||||
* and affix compression in general, please see:
|
|
||||||
* http://www.cs.ucla.edu/ficus-members/geoff/ispell.html
|
|
||||||
* (the home page for ispell)
|
|
||||||
*
|
|
||||||
* An almost complete rewrite of MySpell for use by
|
|
||||||
* the Mozilla project has been developed by David Einstein
|
|
||||||
* (Deinst@world.std.com). David and I are now
|
|
||||||
* working on parallel development tracks to help
|
|
||||||
* our respective projects (Mozilla and OpenOffice.org
|
|
||||||
* and we will maintain full affix file and dictionary
|
|
||||||
* file compatibility and work on merging our versions
|
|
||||||
* of MySpell back into a single tree. David has been
|
|
||||||
* a significant help in improving MySpell.
|
|
||||||
*
|
|
||||||
* Special thanks also go to La'szlo' Ne'meth
|
|
||||||
* <nemethl@gyorsposta.hu> who is the author of the
|
|
||||||
* Hungarian dictionary and who developed and contributed
|
|
||||||
* the code to support compound words in MySpell
|
|
||||||
* and fixed numerous problems with the encoding
|
|
||||||
* case conversion tables.
|
|
||||||
*
|
|
||||||
*/
|
|
|
@ -1,65 +0,0 @@
|
||||||
#*************************************************************************
|
|
||||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
#
|
|
||||||
# The contents of this file are subject to the Mozilla Public License Version
|
|
||||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
|
||||||
# the License. You may obtain a copy of the License at
|
|
||||||
# http://www.mozilla.org/MPL/
|
|
||||||
#
|
|
||||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
||||||
# for the specific language governing rights and limitations under the
|
|
||||||
# License.
|
|
||||||
#
|
|
||||||
# Alternatively, the contents of this file may be used under the terms of
|
|
||||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
# of those above. If you wish to allow use of your version of this file only
|
|
||||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
# use your version of this file under the terms of the MPL, indicate your
|
|
||||||
# decision by deleting the provisions above and replace them with the notice
|
|
||||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
# the provisions above, a recipient may use your version of this file under
|
|
||||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
#
|
|
||||||
#*************************************************************************
|
|
||||||
|
|
||||||
PRJ = ../../../../../..
|
|
||||||
|
|
||||||
PRJNAME = hunspell
|
|
||||||
TARGET = hunspell
|
|
||||||
LIBTARGET=YES
|
|
||||||
EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
|
|
||||||
UWINAPILIB=
|
|
||||||
|
|
||||||
#----- Settings ---------------------------------------------------------
|
|
||||||
|
|
||||||
.INCLUDE : settings.mk
|
|
||||||
|
|
||||||
# --- Files --------------------------------------------------------
|
|
||||||
|
|
||||||
CFLAGS+=-I..$/..$/
|
|
||||||
CDEFS+=-DOPENOFFICEORG
|
|
||||||
|
|
||||||
SLOFILES= \
|
|
||||||
$(SLO)$/affentry.obj \
|
|
||||||
$(SLO)$/affixmgr.obj \
|
|
||||||
$(SLO)$/dictmgr.obj \
|
|
||||||
$(SLO)$/csutil.obj \
|
|
||||||
$(SLO)$/hashmgr.obj \
|
|
||||||
$(SLO)$/suggestmgr.obj \
|
|
||||||
$(SLO)$/phonet.obj \
|
|
||||||
$(SLO)$/hunzip.obj \
|
|
||||||
$(SLO)$/filemgr.obj \
|
|
||||||
$(SLO)$/replist.obj \
|
|
||||||
$(SLO)$/hunspell.obj
|
|
||||||
|
|
||||||
LIB1TARGET= $(SLB)$/lib$(TARGET).lib
|
|
||||||
LIB1ARCHIV= $(LB)/lib$(TARGET).a
|
|
||||||
LIB1OBJFILES= $(SLOFILES)
|
|
||||||
|
|
||||||
# --- Targets ------------------------------------------------------
|
|
||||||
|
|
||||||
.INCLUDE : target.mk
|
|
||||||
|
|
|
@ -1,293 +0,0 @@
|
||||||
/* phonetic.c - generic replacement aglogithms for phonetic transformation
|
|
||||||
Copyright (C) 2000 Bjoern Jacke
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License version 2.1 as published by the Free Software Foundation;
|
|
||||||
|
|
||||||
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, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Changelog:
|
|
||||||
|
|
||||||
2000-01-05 Bjoern Jacke <bjoern at j3e.de>
|
|
||||||
Initial Release insprired by the article about phonetic
|
|
||||||
transformations out of c't 25/1999
|
|
||||||
|
|
||||||
2007-07-26 Bjoern Jacke <bjoern at j3e.de>
|
|
||||||
Released under MPL/GPL/LGPL tri-license for Hunspell
|
|
||||||
|
|
||||||
2007-08-23 Laszlo Nemeth <nemeth at OOo>
|
|
||||||
Porting from Aspell to Hunspell using C-like structs
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
#include "csutil.hxx"
|
|
||||||
#include "phonet.hxx"
|
|
||||||
|
|
||||||
void init_phonet_hash(phonetable & parms)
|
|
||||||
{
|
|
||||||
int i, k;
|
|
||||||
|
|
||||||
for (i = 0; i < HASHSIZE; i++) {
|
|
||||||
parms.hash[i] = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; parms.rules[i][0] != '\0'; i += 2) {
|
|
||||||
/** set hash value **/
|
|
||||||
k = (unsigned char) parms.rules[i][0];
|
|
||||||
|
|
||||||
if (parms.hash[k] < 0) {
|
|
||||||
parms.hash[k] = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// like strcpy but safe if the strings overlap
|
|
||||||
// but only if dest < src
|
|
||||||
static inline void strmove(char * dest, char * src) {
|
|
||||||
while (*src)
|
|
||||||
*dest++ = *src++;
|
|
||||||
*dest = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
static int myisalpha(char ch) {
|
|
||||||
if ((unsigned char) ch < 128) return isalpha(ch);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* phonetic transcription algorithm */
|
|
||||||
/* see: http://aspell.net/man-html/Phonetic-Code.html */
|
|
||||||
/* convert string to uppercase before this call */
|
|
||||||
int phonet (const char * inword, char * target,
|
|
||||||
int len,
|
|
||||||
phonetable & parms)
|
|
||||||
{
|
|
||||||
/** Do phonetic transformation. **/
|
|
||||||
/** "len" = length of "inword" incl. '\0'. **/
|
|
||||||
|
|
||||||
/** result: >= 0: length of "target" **/
|
|
||||||
/** otherwise: error **/
|
|
||||||
|
|
||||||
int i,j,k=0,n,p,z;
|
|
||||||
int k0,n0,p0=-333,z0;
|
|
||||||
char c, c0;
|
|
||||||
const char * s;
|
|
||||||
typedef unsigned char uchar;
|
|
||||||
char word[MAXPHONETUTF8LEN + 1];
|
|
||||||
if (len == -1) len = strlen(inword);
|
|
||||||
if (len > MAXPHONETUTF8LEN) return 0;
|
|
||||||
strncpy(word, inword, MAXPHONETUTF8LEN);
|
|
||||||
word[MAXPHONETUTF8LEN] = '\0';
|
|
||||||
|
|
||||||
/** check word **/
|
|
||||||
i = j = z = 0;
|
|
||||||
while ((c = word[i]) != '\0') {
|
|
||||||
n = parms.hash[(uchar) c];
|
|
||||||
z0 = 0;
|
|
||||||
|
|
||||||
if (n >= 0) {
|
|
||||||
/** check all rules for the same letter **/
|
|
||||||
while (parms.rules[n][0] == c) {
|
|
||||||
|
|
||||||
/** check whole string **/
|
|
||||||
k = 1; /** number of found letters **/
|
|
||||||
p = 5; /** default priority **/
|
|
||||||
s = parms.rules[n];
|
|
||||||
s++; /** important for (see below) "*(s-1)" **/
|
|
||||||
|
|
||||||
while (*s != '\0' && word[i+k] == *s
|
|
||||||
&& !isdigit ((unsigned char) *s) && strchr ("(-<^$", *s) == NULL) {
|
|
||||||
k++;
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
if (*s == '(') {
|
|
||||||
/** check letters in "(..)" **/
|
|
||||||
if (myisalpha(word[i+k]) // ...could be implied?
|
|
||||||
&& strchr(s+1, word[i+k]) != NULL) {
|
|
||||||
k++;
|
|
||||||
while (*s != ')')
|
|
||||||
s++;
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p0 = (int) *s;
|
|
||||||
k0 = k;
|
|
||||||
while (*s == '-' && k > 1) {
|
|
||||||
k--;
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
if (*s == '<')
|
|
||||||
s++;
|
|
||||||
if (isdigit ((unsigned char) *s)) {
|
|
||||||
/** determine priority **/
|
|
||||||
p = *s - '0';
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
if (*s == '^' && *(s+1) == '^')
|
|
||||||
s++;
|
|
||||||
|
|
||||||
if (*s == '\0'
|
|
||||||
|| (*s == '^'
|
|
||||||
&& (i == 0 || ! myisalpha(word[i-1]))
|
|
||||||
&& (*(s+1) != '$'
|
|
||||||
|| (! myisalpha(word[i+k0]) )))
|
|
||||||
|| (*s == '$' && i > 0
|
|
||||||
&& myisalpha(word[i-1])
|
|
||||||
&& (! myisalpha(word[i+k0]) )))
|
|
||||||
{
|
|
||||||
/** search for followup rules, if: **/
|
|
||||||
/** parms.followup and k > 1 and NO '-' in searchstring **/
|
|
||||||
c0 = word[i+k-1];
|
|
||||||
n0 = parms.hash[(uchar) c0];
|
|
||||||
|
|
||||||
// if (parms.followup && k > 1 && n0 >= 0
|
|
||||||
if (k > 1 && n0 >= 0
|
|
||||||
&& p0 != (int) '-' && word[i+k] != '\0') {
|
|
||||||
/** test follow-up rule for "word[i+k]" **/
|
|
||||||
while (parms.rules[n0][0] == c0) {
|
|
||||||
|
|
||||||
/** check whole string **/
|
|
||||||
k0 = k;
|
|
||||||
p0 = 5;
|
|
||||||
s = parms.rules[n0];
|
|
||||||
s++;
|
|
||||||
while (*s != '\0' && word[i+k0] == *s
|
|
||||||
&& ! isdigit((unsigned char) *s) && strchr("(-<^$",*s) == NULL) {
|
|
||||||
k0++;
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
if (*s == '(') {
|
|
||||||
/** check letters **/
|
|
||||||
if (myisalpha(word[i+k0])
|
|
||||||
&& strchr (s+1, word[i+k0]) != NULL) {
|
|
||||||
k0++;
|
|
||||||
while (*s != ')' && *s != '\0')
|
|
||||||
s++;
|
|
||||||
if (*s == ')')
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (*s == '-') {
|
|
||||||
/** "k0" gets NOT reduced **/
|
|
||||||
/** because "if (k0 == k)" **/
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
if (*s == '<')
|
|
||||||
s++;
|
|
||||||
if (isdigit ((unsigned char) *s)) {
|
|
||||||
p0 = *s - '0';
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*s == '\0'
|
|
||||||
/** *s == '^' cuts **/
|
|
||||||
|| (*s == '$' && ! myisalpha(word[i+k0])))
|
|
||||||
{
|
|
||||||
if (k0 == k) {
|
|
||||||
/** this is just a piece of the string **/
|
|
||||||
n0 += 2;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p0 < p) {
|
|
||||||
/** priority too low **/
|
|
||||||
n0 += 2;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/** rule fits; stop search **/
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
n0 += 2;
|
|
||||||
} /** End of "while (parms.rules[n0][0] == c0)" **/
|
|
||||||
|
|
||||||
if (p0 >= p && parms.rules[n0][0] == c0) {
|
|
||||||
n += 2;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} /** end of follow-up stuff **/
|
|
||||||
|
|
||||||
/** replace string **/
|
|
||||||
s = parms.rules[n+1];
|
|
||||||
p0 = (parms.rules[n][0] != '\0'
|
|
||||||
&& strchr (parms.rules[n]+1,'<') != NULL) ? 1:0;
|
|
||||||
if (p0 == 1 && z == 0) {
|
|
||||||
/** rule with '<' is used **/
|
|
||||||
if (j > 0 && *s != '\0'
|
|
||||||
&& (target[j-1] == c || target[j-1] == *s)) {
|
|
||||||
j--;
|
|
||||||
}
|
|
||||||
z0 = 1;
|
|
||||||
z = 1;
|
|
||||||
k0 = 0;
|
|
||||||
while (*s != '\0' && word[i+k0] != '\0') {
|
|
||||||
word[i+k0] = *s;
|
|
||||||
k0++;
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
if (k > k0)
|
|
||||||
strmove (&word[0]+i+k0, &word[0]+i+k);
|
|
||||||
|
|
||||||
/** new "actual letter" **/
|
|
||||||
c = word[i];
|
|
||||||
}
|
|
||||||
else { /** no '<' rule used **/
|
|
||||||
i += k - 1;
|
|
||||||
z = 0;
|
|
||||||
while (*s != '\0'
|
|
||||||
&& *(s+1) != '\0' && j < len) {
|
|
||||||
if (j == 0 || target[j-1] != *s) {
|
|
||||||
target[j] = *s;
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
/** new "actual letter" **/
|
|
||||||
c = *s;
|
|
||||||
if (parms.rules[n][0] != '\0'
|
|
||||||
&& strstr (parms.rules[n]+1, "^^") != NULL) {
|
|
||||||
if (c != '\0') {
|
|
||||||
target[j] = c;
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
strmove (&word[0], &word[0]+i+1);
|
|
||||||
i = 0;
|
|
||||||
z0 = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
} /** end of follow-up stuff **/
|
|
||||||
n += 2;
|
|
||||||
} /** end of while (parms.rules[n][0] == c) **/
|
|
||||||
} /** end of if (n >= 0) **/
|
|
||||||
if (z0 == 0) {
|
|
||||||
// if (k && (assert(p0!=-333),!p0) && j < len && c != '\0'
|
|
||||||
// && (!parms.collapse_result || j == 0 || target[j-1] != c)){
|
|
||||||
if (k && !p0 && j < len && c != '\0'
|
|
||||||
&& (1 || j == 0 || target[j-1] != c)){
|
|
||||||
/** condense only double letters **/
|
|
||||||
target[j] = c;
|
|
||||||
///printf("\n setting \n");
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
|
||||||
z = 0;
|
|
||||||
k=0;
|
|
||||||
}
|
|
||||||
} /** end of while ((c = word[i]) != '\0') **/
|
|
||||||
|
|
||||||
target[j] = '\0';
|
|
||||||
return (j);
|
|
||||||
|
|
||||||
} /** end of function "phonet" **/
|
|
|
@ -1,52 +0,0 @@
|
||||||
/* phonetic.c - generic replacement aglogithms for phonetic transformation
|
|
||||||
Copyright (C) 2000 Bjoern Jacke
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License version 2.1 as published by the Free Software Foundation;
|
|
||||||
|
|
||||||
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, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Changelog:
|
|
||||||
|
|
||||||
2000-01-05 Bjoern Jacke <bjoern at j3e.de>
|
|
||||||
Initial Release insprired by the article about phonetic
|
|
||||||
transformations out of c't 25/1999
|
|
||||||
|
|
||||||
2007-07-26 Bjoern Jacke <bjoern at j3e.de>
|
|
||||||
Released under MPL/GPL/LGPL tri-license for Hunspell
|
|
||||||
|
|
||||||
2007-08-23 Laszlo Nemeth <nemeth at OOo>
|
|
||||||
Porting from Aspell to Hunspell using C-like structs
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __PHONETHXX__
|
|
||||||
#define __PHONETHXX__
|
|
||||||
|
|
||||||
#define HASHSIZE 256
|
|
||||||
#define MAXPHONETLEN 256
|
|
||||||
#define MAXPHONETUTF8LEN (MAXPHONETLEN * 4)
|
|
||||||
|
|
||||||
#include "hunvisapi.h"
|
|
||||||
|
|
||||||
struct phonetable {
|
|
||||||
char utf8;
|
|
||||||
cs_info * lang;
|
|
||||||
int num;
|
|
||||||
char * * rules;
|
|
||||||
int hash[HASHSIZE];
|
|
||||||
};
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED void init_phonet_hash(phonetable & parms);
|
|
||||||
|
|
||||||
LIBHUNSPELL_DLL_EXPORTED int phonet (const char * inword, char * target,
|
|
||||||
int len, phonetable & phone);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,87 +0,0 @@
|
||||||
#include "license.hunspell"
|
|
||||||
#include "license.myspell"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "replist.hxx"
|
|
||||||
#include "csutil.hxx"
|
|
||||||
|
|
||||||
RepList::RepList(int n) {
|
|
||||||
dat = (replentry **) malloc(sizeof(replentry *) * n);
|
|
||||||
if (dat == 0) size = 0; else size = n;
|
|
||||||
pos = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
RepList::~RepList()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < pos; i++) {
|
|
||||||
free(dat[i]->pattern);
|
|
||||||
free(dat[i]->pattern2);
|
|
||||||
free(dat[i]);
|
|
||||||
}
|
|
||||||
free(dat);
|
|
||||||
}
|
|
||||||
|
|
||||||
int RepList::get_pos() {
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
replentry * RepList::item(int n) {
|
|
||||||
return dat[n];
|
|
||||||
}
|
|
||||||
|
|
||||||
int RepList::near(const char * word) {
|
|
||||||
int p1 = 0;
|
|
||||||
int p2 = pos;
|
|
||||||
while ((p2 - p1) > 1) {
|
|
||||||
int m = (p1 + p2) / 2;
|
|
||||||
int c = strcmp(word, dat[m]->pattern);
|
|
||||||
if (c <= 0) {
|
|
||||||
if (c < 0) p2 = m; else p1 = p2 = m;
|
|
||||||
} else p1 = m;
|
|
||||||
}
|
|
||||||
return p1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int RepList::match(const char * word, int n) {
|
|
||||||
if (strncmp(word, dat[n]->pattern, strlen(dat[n]->pattern)) == 0) return strlen(dat[n]->pattern);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int RepList::add(char * pat1, char * pat2) {
|
|
||||||
if (pos >= size || pat1 == NULL || pat2 == NULL) return 1;
|
|
||||||
replentry * r = (replentry *) malloc(sizeof(replentry));
|
|
||||||
if (r == NULL) return 1;
|
|
||||||
r->pattern = mystrrep(pat1, "_", " ");
|
|
||||||
r->pattern2 = mystrrep(pat2, "_", " ");
|
|
||||||
r->start = false;
|
|
||||||
r->end = false;
|
|
||||||
dat[pos++] = r;
|
|
||||||
for (int i = pos - 1; i > 0; i--) {
|
|
||||||
r = dat[i];
|
|
||||||
if (strcmp(r->pattern, dat[i - 1]->pattern) < 0) {
|
|
||||||
dat[i] = dat[i - 1];
|
|
||||||
dat[i - 1] = r;
|
|
||||||
} else break;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int RepList::conv(const char * word, char * dest) {
|
|
||||||
int stl = 0;
|
|
||||||
int change = 0;
|
|
||||||
for (size_t i = 0; i < strlen(word); i++) {
|
|
||||||
int n = near(word + i);
|
|
||||||
int l = match(word + i, n);
|
|
||||||
if (l) {
|
|
||||||
strcpy(dest + stl, dat[n]->pattern2);
|
|
||||||
stl += strlen(dat[n]->pattern2);
|
|
||||||
i += l - 1;
|
|
||||||
change = 1;
|
|
||||||
} else dest[stl++] = word[i];
|
|
||||||
}
|
|
||||||
dest[stl] = '\0';
|
|
||||||
return change;
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
/* string replacement list class */
|
|
||||||
#ifndef _REPLIST_HXX_
|
|
||||||
#define _REPLIST_HXX_
|
|
||||||
|
|
||||||
#include "hunvisapi.h"
|
|
||||||
|
|
||||||
#include "w_char.hxx"
|
|
||||||
|
|
||||||
class LIBHUNSPELL_DLL_EXPORTED RepList
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
RepList(const RepList&);
|
|
||||||
RepList& operator = (const RepList&);
|
|
||||||
protected:
|
|
||||||
replentry ** dat;
|
|
||||||
int size;
|
|
||||||
int pos;
|
|
||||||
|
|
||||||
public:
|
|
||||||
RepList(int n);
|
|
||||||
~RepList();
|
|
||||||
|
|
||||||
int get_pos();
|
|
||||||
int add(char * pat1, char * pat2);
|
|
||||||
replentry * item(int n);
|
|
||||||
int near(const char * word);
|
|
||||||
int match(const char * word, int n);
|
|
||||||
int conv(const char * word, char * dest);
|
|
||||||
};
|
|
||||||
#endif
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,115 +0,0 @@
|
||||||
#ifndef _SUGGESTMGR_HXX_
|
|
||||||
#define _SUGGESTMGR_HXX_
|
|
||||||
|
|
||||||
#define MAXSWL 100
|
|
||||||
#define MAXSWUTF8L (MAXSWL * 4)
|
|
||||||
#define MAX_ROOTS 100
|
|
||||||
#define MAX_WORDS 100
|
|
||||||
#define MAX_GUESS 200
|
|
||||||
#define MAXNGRAMSUGS 4
|
|
||||||
#define MAXPHONSUGS 2
|
|
||||||
#define MAXCOMPOUNDSUGS 3
|
|
||||||
|
|
||||||
// timelimit: max ~1/4 sec (process time on Linux) for a time consuming function
|
|
||||||
#define TIMELIMIT (CLOCKS_PER_SEC >> 2)
|
|
||||||
#define MINTIMER 100
|
|
||||||
#define MAXPLUSTIMER 100
|
|
||||||
|
|
||||||
#define NGRAM_LONGER_WORSE (1 << 0)
|
|
||||||
#define NGRAM_ANY_MISMATCH (1 << 1)
|
|
||||||
#define NGRAM_LOWERING (1 << 2)
|
|
||||||
#define NGRAM_WEIGHTED (1 << 3)
|
|
||||||
|
|
||||||
#include "hunvisapi.h"
|
|
||||||
|
|
||||||
#include "atypes.hxx"
|
|
||||||
#include "affixmgr.hxx"
|
|
||||||
#include "hashmgr.hxx"
|
|
||||||
#include "langnum.hxx"
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
enum { LCS_UP, LCS_LEFT, LCS_UPLEFT };
|
|
||||||
|
|
||||||
class LIBHUNSPELL_DLL_EXPORTED SuggestMgr
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
SuggestMgr(const SuggestMgr&);
|
|
||||||
SuggestMgr& operator = (const SuggestMgr&);
|
|
||||||
private:
|
|
||||||
char * ckey;
|
|
||||||
int ckeyl;
|
|
||||||
w_char * ckey_utf;
|
|
||||||
|
|
||||||
char * ctry;
|
|
||||||
int ctryl;
|
|
||||||
w_char * ctry_utf;
|
|
||||||
|
|
||||||
AffixMgr* pAMgr;
|
|
||||||
int maxSug;
|
|
||||||
struct cs_info * csconv;
|
|
||||||
int utf8;
|
|
||||||
int langnum;
|
|
||||||
int nosplitsugs;
|
|
||||||
int maxngramsugs;
|
|
||||||
int maxcpdsugs;
|
|
||||||
int complexprefixes;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
SuggestMgr(const char * tryme, int maxn, AffixMgr *aptr);
|
|
||||||
~SuggestMgr();
|
|
||||||
|
|
||||||
int suggest(char*** slst, const char * word, int nsug, int * onlycmpdsug);
|
|
||||||
int ngsuggest(char ** wlst, char * word, int ns, HashMgr** pHMgr, int md);
|
|
||||||
int suggest_auto(char*** slst, const char * word, int nsug);
|
|
||||||
int suggest_stems(char*** slst, const char * word, int nsug);
|
|
||||||
int suggest_pos_stems(char*** slst, const char * word, int nsug);
|
|
||||||
|
|
||||||
char * suggest_morph(const char * word);
|
|
||||||
char * suggest_gen(char ** pl, int pln, char * pattern);
|
|
||||||
char * suggest_morph_for_spelling_error(const char * word);
|
|
||||||
|
|
||||||
private:
|
|
||||||
int testsug(char** wlst, const char * candidate, int wl, int ns, int cpdsuggest,
|
|
||||||
int * timer, clock_t * timelimit);
|
|
||||||
int checkword(const char *, int, int, int *, clock_t *);
|
|
||||||
int check_forbidden(const char *, int);
|
|
||||||
|
|
||||||
int capchars(char **, const char *, int, int);
|
|
||||||
int replchars(char**, const char *, int, int);
|
|
||||||
int doubletwochars(char**, const char *, int, int);
|
|
||||||
int forgotchar(char **, const char *, int, int);
|
|
||||||
int swapchar(char **, const char *, int, int);
|
|
||||||
int longswapchar(char **, const char *, int, int);
|
|
||||||
int movechar(char **, const char *, int, int);
|
|
||||||
int extrachar(char **, const char *, int, int);
|
|
||||||
int badcharkey(char **, const char *, int, int);
|
|
||||||
int badchar(char **, const char *, int, int);
|
|
||||||
int twowords(char **, const char *, int, int);
|
|
||||||
int fixstems(char **, const char *, int);
|
|
||||||
|
|
||||||
int capchars_utf(char **, const w_char *, int wl, int, int);
|
|
||||||
int doubletwochars_utf(char**, const w_char *, int wl, int, int);
|
|
||||||
int forgotchar_utf(char**, const w_char *, int wl, int, int);
|
|
||||||
int extrachar_utf(char**, const w_char *, int wl, int, int);
|
|
||||||
int badcharkey_utf(char **, const w_char *, int wl, int, int);
|
|
||||||
int badchar_utf(char **, const w_char *, int wl, int, int);
|
|
||||||
int swapchar_utf(char **, const w_char *, int wl, int, int);
|
|
||||||
int longswapchar_utf(char **, const w_char *, int, int, int);
|
|
||||||
int movechar_utf(char **, const w_char *, int, int, int);
|
|
||||||
|
|
||||||
int mapchars(char**, const char *, int, int);
|
|
||||||
int map_related(const char *, char *, int, int, char ** wlst, int, int, const mapentry*, int, int *, clock_t *);
|
|
||||||
int ngram(int n, char * s1, const char * s2, int opt);
|
|
||||||
int mystrlen(const char * word);
|
|
||||||
int leftcommonsubstring(char * s1, const char * s2);
|
|
||||||
int commoncharacterpositions(char * s1, const char * s2, int * is_swap);
|
|
||||||
void bubblesort( char ** rwd, char ** rwd2, int * rsc, int n);
|
|
||||||
void lcs(const char * s, const char * s2, int * l1, int * l2, char ** result);
|
|
||||||
int lcslen(const char * s, const char* s2);
|
|
||||||
char * suggest_hentry_gen(hentry * rv, char * pattern);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,21 +0,0 @@
|
||||||
#ifndef __WCHARHXX__
|
|
||||||
#define __WCHARHXX__
|
|
||||||
|
|
||||||
#ifndef GCC
|
|
||||||
typedef struct {
|
|
||||||
#else
|
|
||||||
typedef struct __attribute__ ((packed)) {
|
|
||||||
#endif
|
|
||||||
unsigned char l;
|
|
||||||
unsigned char h;
|
|
||||||
} w_char;
|
|
||||||
|
|
||||||
// two character arrays
|
|
||||||
struct replentry {
|
|
||||||
char * pattern;
|
|
||||||
char * pattern2;
|
|
||||||
bool start;
|
|
||||||
bool end;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,208 +0,0 @@
|
||||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
|
||||||
|
|
||||||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
|
||||||
systems. This function is required for `alloca.c' support on those systems.
|
|
||||||
*/
|
|
||||||
#define CRAY_STACKSEG_END 1
|
|
||||||
|
|
||||||
/* Define to 1 if using `alloca.c'. */
|
|
||||||
#define C_ALLOCA 1
|
|
||||||
|
|
||||||
/* Define to 1 if translation of program messages to the user's native
|
|
||||||
language is requested. */
|
|
||||||
#undef ENABLE_NLS
|
|
||||||
|
|
||||||
/* Define to 1 if you have `alloca', as a function or macro. */
|
|
||||||
#define HAVE_ALLOCA 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
|
|
||||||
*/
|
|
||||||
#define HAVE_ALLOCA_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <argz.h> header file. */
|
|
||||||
#define HAVE_ARGZ_H 1
|
|
||||||
|
|
||||||
/* "Define if you have the <curses.h> header" */
|
|
||||||
#undef HAVE_CURSES_H
|
|
||||||
|
|
||||||
/* Define if the GNU dcgettext() function is already present or preinstalled.
|
|
||||||
*/
|
|
||||||
#define HAVE_DCGETTEXT 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
|
||||||
#define HAVE_DLFCN_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <error.h> header file. */
|
|
||||||
#define HAVE_ERROR_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
|
||||||
#define HAVE_FCNTL_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `feof_unlocked' function. */
|
|
||||||
#define HAVE_FEOF_UNLOCKED 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `fgets_unlocked' function. */
|
|
||||||
#define HAVE_FGETS_UNLOCKED 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `getcwd' function. */
|
|
||||||
#define HAVE_GETCWD 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `getc_unlocked' function. */
|
|
||||||
#define HAVE_GETC_UNLOCKED 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `getegid' function. */
|
|
||||||
#define HAVE_GETEGID 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `geteuid' function. */
|
|
||||||
#define HAVE_GETEUID 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `getgid' function. */
|
|
||||||
#define HAVE_GETGID 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `getpagesize' function. */
|
|
||||||
#define HAVE_GETPAGESIZE 1
|
|
||||||
|
|
||||||
/* Define if the GNU gettext() function is already present or preinstalled. */
|
|
||||||
#define HAVE_GETTEXT 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `getuid' function. */
|
|
||||||
#define HAVE_GETUID 1
|
|
||||||
|
|
||||||
/* Define if you have the iconv() function. */
|
|
||||||
#undef HAVE_ICONV
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
|
||||||
#define HAVE_INTTYPES_H 1
|
|
||||||
|
|
||||||
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
|
|
||||||
#define HAVE_LANGINFO_CODESET 1
|
|
||||||
|
|
||||||
/* Define if your <locale.h> file defines LC_MESSAGES. */
|
|
||||||
#define HAVE_LC_MESSAGES 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <libintl.h> header file. */
|
|
||||||
#define HAVE_LIBINTL_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <limits.h> header file. */
|
|
||||||
#define HAVE_LIMITS_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <locale.h> header file. */
|
|
||||||
#define HAVE_LOCALE_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `memchr' function. */
|
|
||||||
#define HAVE_MEMCHR 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <memory.h> header file. */
|
|
||||||
#define HAVE_MEMORY_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `mempcpy' function. */
|
|
||||||
#define HAVE_MEMPCPY 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have a working `mmap' system call. */
|
|
||||||
#define HAVE_MMAP 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `munmap' function. */
|
|
||||||
#define HAVE_MUNMAP 1
|
|
||||||
|
|
||||||
/* "Define if you have the <ncursesw/curses.h> header" */
|
|
||||||
#define HAVE_NCURSESW_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <nl_types.h> header file. */
|
|
||||||
#define HAVE_NL_TYPES_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `putenv' function. */
|
|
||||||
#define HAVE_PUTENV 1
|
|
||||||
|
|
||||||
/* "Define if you have fancy command input editing with Readline" */
|
|
||||||
#undef HAVE_READLINE
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `setenv' function. */
|
|
||||||
#define HAVE_SETENV 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `setlocale' function. */
|
|
||||||
#define HAVE_SETLOCALE 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <stddef.h> header file. */
|
|
||||||
#define HAVE_STDDEF_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdint.h> header file. */
|
|
||||||
#define HAVE_STDINT_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
|
||||||
#define HAVE_STDLIB_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `stpcpy' function. */
|
|
||||||
#define HAVE_STPCPY 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strcasecmp' function. */
|
|
||||||
#define HAVE_STRCASECMP 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strchr' function. */
|
|
||||||
#define HAVE_STRCHR 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strdup' function. */
|
|
||||||
#define HAVE_STRDUP 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <strings.h> header file. */
|
|
||||||
#define HAVE_STRINGS_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <string.h> header file. */
|
|
||||||
#define HAVE_STRING_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strstr' function. */
|
|
||||||
#define HAVE_STRSTR 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strtoul' function. */
|
|
||||||
#define HAVE_STRTOUL 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
|
||||||
#define HAVE_SYS_PARAM_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
|
||||||
#define HAVE_SYS_STAT_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
|
||||||
#define HAVE_SYS_TYPES_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `tsearch' function. */
|
|
||||||
#define HAVE_TSEARCH 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
|
||||||
#define HAVE_UNISTD_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `__argz_count' function. */
|
|
||||||
#define HAVE___ARGZ_COUNT 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `__argz_next' function. */
|
|
||||||
#define HAVE___ARGZ_NEXT 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `__argz_stringify' function. */
|
|
||||||
#define HAVE___ARGZ_STRINGIFY 1
|
|
||||||
|
|
||||||
/* "Define if you use exterimental functions" */
|
|
||||||
#undef HUNSPELL_EXPERIMENTAL
|
|
||||||
|
|
||||||
/* "Define if you need warning messages" */
|
|
||||||
#define HUNSPELL_WARNING_ON
|
|
||||||
|
|
||||||
/* Define as const if the declaration of iconv() needs const. */
|
|
||||||
#define ICONV_CONST 1
|
|
||||||
|
|
||||||
/* Name of package */
|
|
||||||
#define PACKAGE
|
|
||||||
|
|
||||||
/* Define to the address where bug reports for this package should be sent. */
|
|
||||||
#define PACKAGE_BUGREPORT
|
|
||||||
|
|
||||||
/* Define to the full name of this package. */
|
|
||||||
#define PACKAGE_NAME
|
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */
|
|
||||||
#define PACKAGE_STRING
|
|
||||||
|
|
||||||
/* Define to the one symbol short name of this package. */
|
|
||||||
#define PACKAGE_TARNAME
|
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
|
||||||
#define PACKAGE_VERSION "1.3.3"
|
|
||||||
#define VERSION "1.3.3"
|
|
|
@ -1 +0,0 @@
|
||||||
Bruno Haible <bruno@clisp.org>
|
|
|
@ -1,674 +0,0 @@
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1 +0,0 @@
|
||||||
No packages need to be installed before GNU libiconv is installed.
|
|
|
@ -1,64 +0,0 @@
|
||||||
While some other iconv(3) implementations - like FreeBSD iconv(3) - choose
|
|
||||||
the "many small shared libraries" and dlopen(3) approach, this implementation
|
|
||||||
packs everything into a single shared library. Here is a comparison of the
|
|
||||||
two designs.
|
|
||||||
|
|
||||||
* Run-time efficiency
|
|
||||||
1. A dlopen() based approach needs a cache of loaded shared libraries.
|
|
||||||
Otherwise, every iconv_open() call will result in a call to dlopen()
|
|
||||||
and thus to file system related system calls - which is prohibitive
|
|
||||||
because some applications use the iconv_open/iconv/iconv_close sequence
|
|
||||||
for every single filename, string, or piece of text.
|
|
||||||
2. In terms of virtual memory use, both approaches are on par. Being shared
|
|
||||||
libraries, the tables are shared between any processes that use them.
|
|
||||||
And because of the demand loading used by Unix systems (and because libiconv
|
|
||||||
does not have initialization functions), only those parts of the tables
|
|
||||||
which are needed (typically very few kilobytes) will be read from disk and
|
|
||||||
paged into main memory.
|
|
||||||
3. Even with a cache of loaded shared libraries, the dlopen() based approach
|
|
||||||
makes more system calls, because it has to load one or two shared libraries
|
|
||||||
for every encoding in use.
|
|
||||||
|
|
||||||
* Total size
|
|
||||||
In the dlopen(3) approach, every shared library has a symbol table and
|
|
||||||
relocation offset. All together, FreeBSD iconv installs more than 200 shared
|
|
||||||
libraries with a total size of 2.3 MB. Whereas libiconv installs 0.45 MB.
|
|
||||||
|
|
||||||
* Extensibility
|
|
||||||
The dlopen(3) approach is good for guaranteeing extensibility if the iconv
|
|
||||||
implementation is distributed without source. (Or when, as in glibc, you
|
|
||||||
cannot rebuild iconv without rebuilding your libc, thus possibly
|
|
||||||
destabilizing your system.)
|
|
||||||
The libiconv package achieves extensibility through the LGPL license:
|
|
||||||
Every user has access to the source of the package and can extend and
|
|
||||||
replace just libiconv.so.
|
|
||||||
The places which have to be modified when a new encoding is added are as
|
|
||||||
follows: add an #include statement in iconv.c, add an entry in the table in
|
|
||||||
iconv.c, and of course, update the README and iconv_open.3 manual page.
|
|
||||||
|
|
||||||
* Use within other packages
|
|
||||||
If you want to incorporate an iconv implementation into another package
|
|
||||||
(such as a mail user agent or web browser), the single library approach
|
|
||||||
is easier, because:
|
|
||||||
1. In the shared library approach you have to provide the right directory
|
|
||||||
prefix which will be used at run time.
|
|
||||||
2. Incorporating iconv as a static library into the executable is easy -
|
|
||||||
it won't need dynamic loading. (This assumes that your package is under
|
|
||||||
the LGPL or GPL license.)
|
|
||||||
|
|
||||||
|
|
||||||
All conversions go through Unicode. This is possible because most of the
|
|
||||||
world's characters have already been allocated in the Unicode standard.
|
|
||||||
Therefore we have for each encoding two functions:
|
|
||||||
- For conversion from the encoding to Unicode, a function called xxx_mbtowc.
|
|
||||||
- For conversion from Unicode to the encoding, a function called xxx_wctomb,
|
|
||||||
and for stateful encodings, a function called xxx_reset which returns to
|
|
||||||
the initial shift state.
|
|
||||||
|
|
||||||
|
|
||||||
All our functions operate on a single Unicode character at a time. This is
|
|
||||||
obviously less efficient than operating on an entire buffer of characters at
|
|
||||||
a time, but it makes the coding considerably easier and less bug-prone. Those
|
|
||||||
who wish best performance should install the Real Thing (TM): GNU libc 2.1
|
|
||||||
or newer.
|
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
All you need to know when hacking (modifying) GNU libiconv or when building
|
|
||||||
it off the CVS.
|
|
||||||
|
|
||||||
|
|
||||||
Requirements
|
|
||||||
============
|
|
||||||
|
|
||||||
You will need reasonably recent versions of the build tools:
|
|
||||||
|
|
||||||
* A C compiler. Such as GNU GCC.
|
|
||||||
+ Homepage:
|
|
||||||
http://gcc.gnu.org/
|
|
||||||
|
|
||||||
* GNU automake
|
|
||||||
+ Homepage:
|
|
||||||
http://www.gnu.org/software/automake/
|
|
||||||
|
|
||||||
* GNU autoconf
|
|
||||||
+ Homepage:
|
|
||||||
http://www.gnu.org/software/autoconf/
|
|
||||||
|
|
||||||
* GNU m4
|
|
||||||
+ Homepage:
|
|
||||||
http://www.gnu.org/software/m4/
|
|
||||||
|
|
||||||
* GNU gperf
|
|
||||||
+ Homepage:
|
|
||||||
http://www.gnu.org/software/gperf/
|
|
||||||
|
|
||||||
* GNU groff 1.17 or newer
|
|
||||||
+ Homepage:
|
|
||||||
http://www.gnu.org/software/groff/
|
|
||||||
|
|
||||||
* Perl
|
|
||||||
+ Homepage:
|
|
||||||
http://www.perl.org/
|
|
||||||
|
|
||||||
* Either an internet connection or a recent copy of GNU gnulib.
|
|
||||||
+ Homepage:
|
|
||||||
http://www.gnu.org/software/gnulib/
|
|
||||||
|
|
||||||
And, of course, the packages listed in the DEPENDENCIES file.
|
|
||||||
|
|
||||||
|
|
||||||
Building off the CVS
|
|
||||||
====================
|
|
||||||
|
|
||||||
Access to the CVS is described at http://sourceforge.net/cvs/?group_id=51585 .
|
|
||||||
|
|
||||||
After fetching the sources from the CVS, peek at the comments in autogen.sh,
|
|
||||||
then run "./autogen.sh"; then you can proceed with "./configure" as usual.
|
|
||||||
|
|
||||||
|
|
||||||
Adding new encodings
|
|
||||||
====================
|
|
||||||
|
|
||||||
For an indication which encodings are acceptable in the official version of
|
|
||||||
GNU libiconv, take a look at NOTES.
|
|
||||||
|
|
||||||
For an indication which files need to be modified when adding a new encoding,
|
|
||||||
look for example at the 2007-05-25 ChangeLog entry for RK1048. The lib/*.h
|
|
||||||
file for an encoding is usually generated by one of the tools in the tools/
|
|
||||||
directory. All you need to provide is the conversion table in the format of
|
|
||||||
the many *.TXT files.
|
|
|
@ -1,172 +0,0 @@
|
||||||
New in 1.13:
|
|
||||||
* The library and the iconv program now understand platform dependent aliases,
|
|
||||||
for better compatibility with the platform's own iconv_open function.
|
|
||||||
Examples: "646" on Solaris, "iso88591" on HP-UX, "IBM-1252" on AIX.
|
|
||||||
* For stateful encodings, when the input ends with a shift sequence followed
|
|
||||||
by invalid input, the iconv function now increments the input pointer past
|
|
||||||
the shift sequence before returning (size_t)(-1) with errno = EILSEQ. This
|
|
||||||
is also like GNU libc's iconv() behaves.
|
|
||||||
* The library exports a new function iconv_open_into() that stores the
|
|
||||||
conversion descriptor in pre-allocated memory, rather than allocating fresh
|
|
||||||
memory for it.
|
|
||||||
* Added CP1131 converter.
|
|
||||||
|
|
||||||
New in 1.12:
|
|
||||||
* The iconv program is now licensed under the GPL version 3, instead of the
|
|
||||||
GPL version 2. The libiconv library continues to be licensed under LGPL.
|
|
||||||
* Added RK1048 converter.
|
|
||||||
* On AIX, an existing system libiconv no longer causes setlocale() to fail.
|
|
||||||
* Upgraded EUC-KR, JOHAB to include the Korean postal code sign.
|
|
||||||
|
|
||||||
New in 1.11:
|
|
||||||
* The iconv program has new options --unicode-subst, --byte-subst,
|
|
||||||
--widechar-subst that allow to specify substitutions for characters that
|
|
||||||
cannot be converted.
|
|
||||||
* The iconv program now understands long options:
|
|
||||||
long option equivalent to
|
|
||||||
--from-code -f
|
|
||||||
--to-code -t
|
|
||||||
--list -l
|
|
||||||
--silent -s
|
|
||||||
* The CP936 converter is now different from the GBK converter: it has changed
|
|
||||||
to include the Euro sign and private area characters. CP936 is no longer an
|
|
||||||
alias of GBK.
|
|
||||||
* Updated GB18030 converter to include all private area characters.
|
|
||||||
* Updated CP950 converter to include the Euro sign and private area characters.
|
|
||||||
* Updated CP949 converter to include private area characters.
|
|
||||||
* Updated the BIG5-HKSCS converter. The old BIG5-HKSCS converter is renamed to
|
|
||||||
BIG5-HKSCS:1999 and updated to Unicode 4. New converters BIG5-HKSCS:2001 and
|
|
||||||
BIG5-HKSCS:2004 are added. BIG5-HKSCS is now an alias for BIG5-HKSCS:2004.
|
|
||||||
* Added a few irreversible mappings to the CP932 converter.
|
|
||||||
* Tidy up the list of symbols exported from libiconv (assumes gcc >= 4.0).
|
|
||||||
|
|
||||||
New in 1.10:
|
|
||||||
* Added ISO-8859-11 converter.
|
|
||||||
* Updated the ISO-8859-7 converter.
|
|
||||||
* Added ATARIST converter, available through --enable-extra-encodings.
|
|
||||||
* Added BIG5-2003 converter (experimental), available through
|
|
||||||
--enable-extra-encodings.
|
|
||||||
* Updated EUC-TW converter to include the Euro sign.
|
|
||||||
* The preloadable library has been renamed from libiconv_plug.so to
|
|
||||||
preloadable_libiconv.so.
|
|
||||||
* Portability to mingw.
|
|
||||||
|
|
||||||
New in 1.9:
|
|
||||||
* Many more transliterations.
|
|
||||||
* New configuration option --enable-relocatable. See the INSTALL.generic file
|
|
||||||
for details.
|
|
||||||
|
|
||||||
New in 1.8:
|
|
||||||
* The iconv program has new options -l, -c, -s.
|
|
||||||
* The iconv program is internationalized.
|
|
||||||
* Added C99 converter.
|
|
||||||
* Added KOI8-T converter.
|
|
||||||
* New configuration option --enable-extra-encodings that enables a bunch of
|
|
||||||
additional encodings; see the README for details.
|
|
||||||
* Updated the ISO-8859-16 converter.
|
|
||||||
* Upgraded BIG5-HKSCS, EUC-TW, ISO-2022-CN, ISO-2022-CN-EXT converters to
|
|
||||||
Unicode 3.2.
|
|
||||||
* Upgraded EUC-KR, CP949, JOHAB converters to include the Euro sign.
|
|
||||||
* Changed the ARMSCII-8 converter.
|
|
||||||
* Extended the EUC-JP encoder so that YEN SIGN characters don't cause failures
|
|
||||||
in Shift_JIS to EUC-JP conversion.
|
|
||||||
* The JAVA converter now handles characters outside the Unicode BMP correctly.
|
|
||||||
* Fixed a bug in the CP1255, CP1258, TCVN decoders: The base characters of
|
|
||||||
combining characters could be dropped at the end of the conversion buffer.
|
|
||||||
* Fixed a bug in the transliteration that could lead to excessive memory
|
|
||||||
allocations in libintl when transliteration was needed.
|
|
||||||
* Portability to BSD/OS and SCO 3.2.5.
|
|
||||||
|
|
||||||
New in 1.7:
|
|
||||||
* Added UTF-32, UTF-32BE, UTF-32LE converters.
|
|
||||||
* Changed CP1255, CP1258 and TCVN converters to handle combining characters.
|
|
||||||
* Changed EUC-JP, SHIFT_JIS, CP932, ISO-2022-JP, ISO-2022-JP-2, ISO-2022-JP-1
|
|
||||||
converters to use fullwidth Yen sign instead of halfwidth Yen sign, and
|
|
||||||
fullwidth tilde instead of halfwidth tilde.
|
|
||||||
* Upgraded EUC-TW, ISO-2022-CN, ISO-2022-CN-EXT converters to Unicode 3.1.
|
|
||||||
* Changed the GB18030 converter to not reject unassigned and private-use
|
|
||||||
Unicode characters.
|
|
||||||
* Fixed a bug in the byte order mark treatment of the UCS-4 decoder.
|
|
||||||
* The manual pages are now distributed also in HTML format.
|
|
||||||
|
|
||||||
New in 1.6:
|
|
||||||
* The iconv program's -f and -t options are now optional.
|
|
||||||
* Many more transliterations.
|
|
||||||
* Added CP862 converter.
|
|
||||||
* Changed the GB18030 converter.
|
|
||||||
* Portability to DOS with DJGPP.
|
|
||||||
|
|
||||||
New in 1.5:
|
|
||||||
* Added an iconv(1) program.
|
|
||||||
* New locale dependent encodings "char", "wchar_t".
|
|
||||||
* Transliteration is now off by default. Use a //TRANSLIT suffix to enable it.
|
|
||||||
* The JOHAB encoding is documented again.
|
|
||||||
* Changed a few mappings in the CP950 converter.
|
|
||||||
|
|
||||||
New in 1.4:
|
|
||||||
* Added GB18030, BIG5HKSCS converters.
|
|
||||||
* Portability to OS/2 with emx+gcc.
|
|
||||||
|
|
||||||
New in 1.3:
|
|
||||||
* Added UCS-2BE, UCS-2LE, UCS-4BE, UCS-4LE converters.
|
|
||||||
* Fixed the definition of EILSEQ on SunOS4.
|
|
||||||
* Fixed a build problem on OSF/1.
|
|
||||||
* Support for building as a shared library on Woe32.
|
|
||||||
|
|
||||||
New in 1.2:
|
|
||||||
* Added UTF-16BE and UTF-16LE converters.
|
|
||||||
* Changed the UTF-16 encoder.
|
|
||||||
* Fixed the treatment of tab characters in the UTF-7 converter.
|
|
||||||
* Fixed an internal error when output buffer was not large enough.
|
|
||||||
|
|
||||||
New in 1.1:
|
|
||||||
* Added ISO-8859-16 converter.
|
|
||||||
* Added CP932 converter, a variant of SHIFT_JIS.
|
|
||||||
* Added CP949 converter, a variant of EUC-KR.
|
|
||||||
* Improved the ISO-2022-CN-EXT converter: It now covers the ISO-IR-165 range.
|
|
||||||
* Updated the ISO-8859-8 conversion table.
|
|
||||||
* The JOHAB encoding is deprecated and not documented any more.
|
|
||||||
* Fixed two build problems: 1. "make -n check" failed. 2. When libiconv was
|
|
||||||
already installed, "make" failed.
|
|
||||||
|
|
||||||
New in 1.0:
|
|
||||||
* Added transliteration facilities.
|
|
||||||
* Added a test suite.
|
|
||||||
* Fixed the iconv(3) manual page and function: the return value was not
|
|
||||||
described correctly.
|
|
||||||
* Fixed a bug in the CP1258 decoder: invalid bytes now yield EILSEQ instead of
|
|
||||||
U+FFFD.
|
|
||||||
* Fixed a bug in the Georgian-PS encoder: accept U+00E6.
|
|
||||||
* Fixed a bug in the EUC-JP encoder: reject 0x8E5C and 0x8E7E.
|
|
||||||
* Fixed a bug in the KSC5601 and JOHAB converters: they recognized some Hangul
|
|
||||||
characters at some invalid code positions.
|
|
||||||
* Fixed a bug in the EUC-TW decoder; it was severely broken.
|
|
||||||
* Fixed a bug in the CP950 converter: it recognized a dubious BIG5 range.
|
|
||||||
|
|
||||||
New in 0.3:
|
|
||||||
* Reduced the size of the tables needed for the JOHAB converter.
|
|
||||||
* Portability to Woe32.
|
|
||||||
|
|
||||||
New in 0.2:
|
|
||||||
* Added KOI8-RU, CP850, CP866, CP874, CP950, ISO-2022-CN-EXT, GBK and
|
|
||||||
ISO-2022-JP-1 converters.
|
|
||||||
* Added MACINTOSH as an alias for MAC-ROMAN.
|
|
||||||
* Added ASMO-708 as an alias for ISO-8859-6.
|
|
||||||
* Added ELOT_928 as an alias for ISO-8859-7.
|
|
||||||
* Improved the EUC-TW converter: Treat CNS 11643 plane 3.
|
|
||||||
* Improved the ISO-2022-KR and EUC-KR converters: Hangul characters are
|
|
||||||
decomposed into Jamo when needed.
|
|
||||||
* Improved the CP932 converter.
|
|
||||||
* Updated the CP1133, MULELAO-1 and ARMSCII-8 mappings.
|
|
||||||
* The EUC-JP and SHIFT_JIS converters now cover the user-defined range.
|
|
||||||
* Fixed a possible buffer overrun in the JOHAB converter.
|
|
||||||
* Fixed a bug in the UTF-7, ISO-2022-*, HZ decoders: a shift sequence a the
|
|
||||||
end of the input no longer gives an error.
|
|
||||||
* The HZ encoder now always terminates its output in the ASCII state.
|
|
||||||
* Use a perfect hash table for looking up the aliases.
|
|
||||||
|
|
||||||
New in 0.1:
|
|
||||||
* Portability to Linux/glibc-2.0.x, Linux/libc5, OSF/1, FreeBSD.
|
|
||||||
* Fixed a bug in the EUC-JP decoder. Extended the ISO-2022-JP-2 converter.
|
|
||||||
* Made TIS-620 mapping consistent with glibc-2.1.
|
|
||||||
|
|
|
@ -1,399 +0,0 @@
|
||||||
Q: Why does libiconv support encoding XXX? Why does libiconv not support
|
|
||||||
encoding ZZZ?
|
|
||||||
|
|
||||||
A: libiconv, as an internationalization library, supports those character
|
|
||||||
sets and encodings which are in wide-spread use in at least one territory
|
|
||||||
of the world.
|
|
||||||
|
|
||||||
Hint1: On http://www.w3c.org/International/O-charset-lang.html you find a
|
|
||||||
page "Languages, countries, and the charsets typically used for them".
|
|
||||||
From this table, we can conclude that the following are in active use:
|
|
||||||
|
|
||||||
ISO-8859-1, CP1252 Afrikaans, Albanian, Basque, Catalan, Danish, Dutch,
|
|
||||||
English, Faroese, Finnish, French, Galician, German,
|
|
||||||
Icelandic, Irish, Italian, Norwegian, Portuguese,
|
|
||||||
Scottish, Spanish, Swedish
|
|
||||||
ISO-8859-2 Croatian, Czech, Hungarian, Polish, Romanian, Slovak,
|
|
||||||
Slovenian
|
|
||||||
ISO-8859-3 Esperanto, Maltese
|
|
||||||
ISO-8859-5 Bulgarian, Byelorussian, Macedonian, Russian,
|
|
||||||
Serbian, Ukrainian
|
|
||||||
ISO-8859-6 Arabic
|
|
||||||
ISO-8859-7 Greek
|
|
||||||
ISO-8859-8 Hebrew
|
|
||||||
ISO-8859-9, CP1254 Turkish
|
|
||||||
ISO-8859-10 Inuit, Lapp
|
|
||||||
ISO-8859-13 Latvian, Lithuanian
|
|
||||||
ISO-8859-15 Estonian
|
|
||||||
KOI8-R Russian
|
|
||||||
SHIFT_JIS Japanese
|
|
||||||
ISO-2022-JP Japanese
|
|
||||||
EUC-JP Japanese
|
|
||||||
|
|
||||||
Ordered by frequency on the web (1997):
|
|
||||||
ISO-8859-1, CP1252 96%
|
|
||||||
SHIFT_JIS 1.6%
|
|
||||||
ISO-2022-JP 1.2%
|
|
||||||
EUC-JP 0.4%
|
|
||||||
CP1250 0.3%
|
|
||||||
CP1251 0.2%
|
|
||||||
CP850 0.1%
|
|
||||||
MACINTOSH 0.1%
|
|
||||||
ISO-8859-5 0.1%
|
|
||||||
ISO-8859-2 0.0%
|
|
||||||
|
|
||||||
Hint2: The character sets mentioned in the XFree86 4.0 locale.alias file.
|
|
||||||
|
|
||||||
ISO-8859-1 Afrikaans, Basque, Breton, Catalan, Danish, Dutch,
|
|
||||||
English, Estonian, Faroese, Finnish, French,
|
|
||||||
Galician, German, Greenlandic, Icelandic,
|
|
||||||
Indonesian, Irish, Italian, Lithuanian, Norwegian,
|
|
||||||
Occitan, Portuguese, Scottish, Spanish, Swedish,
|
|
||||||
Walloon, Welsh
|
|
||||||
ISO-8859-2 Albanian, Croatian, Czech, Hungarian, Polish,
|
|
||||||
Romanian, Serbian, Slovak, Slovenian
|
|
||||||
ISO-8859-3 Esperanto
|
|
||||||
ISO-8859-4 Estonian, Latvian, Lithuanian
|
|
||||||
ISO-8859-5 Bulgarian, Byelorussian, Macedonian, Russian,
|
|
||||||
Serbian, Ukrainian
|
|
||||||
ISO-8859-6 Arabic
|
|
||||||
ISO-8859-7 Greek
|
|
||||||
ISO-8859-8 Hebrew
|
|
||||||
ISO-8859-9 Turkish
|
|
||||||
ISO-8859-14 Breton, Irish, Scottish, Welsh
|
|
||||||
ISO-8859-15 Basque, Breton, Catalan, Danish, Dutch, Estonian,
|
|
||||||
Faroese, Finnish, French, Galician, German,
|
|
||||||
Greenlandic, Icelandic, Irish, Italian, Lithuanian,
|
|
||||||
Norwegian, Occitan, Portuguese, Scottish, Spanish,
|
|
||||||
Swedish, Walloon, Welsh
|
|
||||||
KOI8-R Russian
|
|
||||||
KOI8-U Russian, Ukrainian
|
|
||||||
EUC-JP (alias eucJP) Japanese
|
|
||||||
ISO-2022-JP (alias JIS7) Japanese
|
|
||||||
SHIFT_JIS (alias SJIS) Japanese
|
|
||||||
U90 Japanese
|
|
||||||
S90 Japanese
|
|
||||||
EUC-CN (alias eucCN) Chinese
|
|
||||||
EUC-TW (alias eucTW) Chinese
|
|
||||||
BIG5 Chinese
|
|
||||||
EUC-KR (alias eucKR) Korean
|
|
||||||
ARMSCII-8 Armenian
|
|
||||||
GEORGIAN-ACADEMY Georgian
|
|
||||||
GEORGIAN-PS Georgian
|
|
||||||
TIS-620 (alias TACTIS) Thai
|
|
||||||
MULELAO-1 Laothian
|
|
||||||
IBM-CP1133 Laothian
|
|
||||||
VISCII Vietnamese
|
|
||||||
TCVN Vietnamese
|
|
||||||
NUNACOM-8 Inuktitut
|
|
||||||
|
|
||||||
Hint3: The character sets supported by Netscape Communicator 4.
|
|
||||||
|
|
||||||
Where is this documented? For the complete picture, I had to use
|
|
||||||
"strings netscape" and then a lot of guesswork. For a quick take,
|
|
||||||
look at the "View - Character set" menu of Netscape Communicator 4.6:
|
|
||||||
|
|
||||||
ISO-8859-{1,2,5,7,9,15}
|
|
||||||
WINDOWS-{1250,1251,1253}
|
|
||||||
KOI8-R Cyrillic
|
|
||||||
CP866 Cyrillic
|
|
||||||
Autodetect Japanese (EUC-JP, ISO-2022-JP, ISO-2022-JP-2, SJIS)
|
|
||||||
EUC-JP Japanese
|
|
||||||
SHIFT_JIS Japanese
|
|
||||||
GB2312 Chinese
|
|
||||||
BIG5 Chinese
|
|
||||||
EUC-TW Chinese
|
|
||||||
Autodetect Korean (EUC-KR, ISO-2022-KR, but not JOHAB)
|
|
||||||
|
|
||||||
UTF-8
|
|
||||||
UTF-7
|
|
||||||
|
|
||||||
Hint4: The character sets supported by Microsoft Internet Explorer 4.
|
|
||||||
|
|
||||||
ISO-8859-{1,2,3,4,5,6,7,8,9}
|
|
||||||
WINDOWS-{1250,1251,1252,1253,1254,1255,1256,1257}
|
|
||||||
KOI8-R Cyrillic
|
|
||||||
KOI8-RU Ukrainian
|
|
||||||
ASMO-708 Arabic
|
|
||||||
EUC-JP Japanese
|
|
||||||
ISO-2022-JP Japanese
|
|
||||||
SHIFT_JIS Japanese
|
|
||||||
GB2312 Chinese
|
|
||||||
HZ-GB-2312 Chinese
|
|
||||||
BIG5 Chinese
|
|
||||||
EUC-KR Korean
|
|
||||||
ISO-2022-KR Korean
|
|
||||||
WINDOWS-874 Thai
|
|
||||||
WINDOWS-1258 Vietnamese
|
|
||||||
|
|
||||||
UTF-8
|
|
||||||
UTF-7
|
|
||||||
UNICODE actually UNICODE-LITTLE
|
|
||||||
UNICODEFEFF actually UNICODE-BIG
|
|
||||||
|
|
||||||
and various DOS character sets: DOS-720, DOS-862, IBM852, CP866.
|
|
||||||
|
|
||||||
We take the union of all these four sets. The result is:
|
|
||||||
|
|
||||||
European and Semitic languages
|
|
||||||
* ASCII.
|
|
||||||
We implement this because it is occasionally useful to know or to
|
|
||||||
check whether some text is entirely ASCII (i.e. if the conversion
|
|
||||||
ISO-8859-x -> UTF-8 is trivial).
|
|
||||||
* ISO-8859-{1,2,3,4,5,6,7,8,9,10}
|
|
||||||
We implement this because they are widely used. Except ISO-8859-4
|
|
||||||
which appears to have been superseded by ISO-8859-13 in the baltic
|
|
||||||
countries. But it's an ISO standard anyway.
|
|
||||||
* ISO-8859-13
|
|
||||||
We implement this because it's a standard in Lithuania and Latvia.
|
|
||||||
* ISO-8859-14
|
|
||||||
We implement this because it's an ISO standard.
|
|
||||||
* ISO-8859-15
|
|
||||||
We implement this because it's increasingly used in Europe, because
|
|
||||||
of the Euro symbol.
|
|
||||||
* ISO-8859-16
|
|
||||||
We implement this because it's an ISO standard.
|
|
||||||
* KOI8-R, KOI8-U
|
|
||||||
We implement this because it appears to be the predominant encoding
|
|
||||||
on Unix in Russia and Ukraine, respectively.
|
|
||||||
* KOI8-RU
|
|
||||||
We implement this because MSIE4 supports it.
|
|
||||||
* KOI8-T
|
|
||||||
We implement this because it is the locale encoding in glibc's Tajik
|
|
||||||
locale.
|
|
||||||
* PT154
|
|
||||||
We implement this because it is the locale encoding in glibc's Kazakh
|
|
||||||
locale.
|
|
||||||
* RK1048
|
|
||||||
We implement this because it's a standard in Kazakhstan.
|
|
||||||
* CP{1250,1251,1252,1253,1254,1255,1256,1257}
|
|
||||||
We implement these because they are the predominant Windows encodings
|
|
||||||
in Europe.
|
|
||||||
* CP850
|
|
||||||
We implement this because it is mentioned as occurring in the web
|
|
||||||
in the aforementioned statistics.
|
|
||||||
* CP862
|
|
||||||
We implement this because Ron Aaron says it is sometimes used in web
|
|
||||||
pages and emails.
|
|
||||||
* CP866
|
|
||||||
We implement this because Netscape Communicator does.
|
|
||||||
* CP1131
|
|
||||||
We implement this because it is the locale encoding of a Belorusian
|
|
||||||
locale in FreeBSD and MacOS X.
|
|
||||||
* Mac{Roman,CentralEurope,Croatian,Romania,Cyrillic,Greek,Turkish} and
|
|
||||||
Mac{Hebrew,Arabic}
|
|
||||||
We implement these because the Sun JDK does, and because Mac users
|
|
||||||
don't deserve to be punished.
|
|
||||||
* Macintosh
|
|
||||||
We implement this because it is mentioned as occurring in the web
|
|
||||||
in the aforementioned statistics.
|
|
||||||
Japanese
|
|
||||||
* EUC-JP, SHIFT_JIS, ISO-2022-JP
|
|
||||||
We implement these because they are widely used. EUC-JP and SHIFT_JIS
|
|
||||||
are more used for files, whereas ISO-2022-JP is recommended for email.
|
|
||||||
* CP932
|
|
||||||
We implement this because it is the Microsoft variant of SHIFT_JIS,
|
|
||||||
used on Windows.
|
|
||||||
* ISO-2022-JP-2
|
|
||||||
We implement this because it's the common way to represent mails which
|
|
||||||
make use of JIS X 0212 characters.
|
|
||||||
* ISO-2022-JP-1
|
|
||||||
We implement this because it's in the RFCs, but I don't think it is
|
|
||||||
really used.
|
|
||||||
* U90, S90
|
|
||||||
We DON'T implement this because I have no informations about what it
|
|
||||||
is or who uses it.
|
|
||||||
Simplified Chinese
|
|
||||||
* EUC-CN = GB2312
|
|
||||||
We implement this because it is the widely used representation
|
|
||||||
of simplified Chinese.
|
|
||||||
* GBK
|
|
||||||
We implement this because it appears to be used on Solaris and Windows.
|
|
||||||
* GB18030
|
|
||||||
We implement this because it is an official requirement in the
|
|
||||||
People's Republic of China.
|
|
||||||
* ISO-2022-CN
|
|
||||||
We implement this because it is in the RFCs, but I have no idea
|
|
||||||
whether it is really used.
|
|
||||||
* ISO-2022-CN-EXT
|
|
||||||
We implement this because it's in the RFCs, but I don't think it is
|
|
||||||
really used.
|
|
||||||
* HZ = HZ-GB-2312
|
|
||||||
We implement this because the RFCs recommend it for Usenet postings,
|
|
||||||
and because MSIE4 supports it.
|
|
||||||
Traditional Chinese
|
|
||||||
* EUC-TW
|
|
||||||
We implement it because it appears to be used on Unix.
|
|
||||||
* BIG5
|
|
||||||
We implement it because it is the de-facto standard for traditional
|
|
||||||
Chinese.
|
|
||||||
* CP950
|
|
||||||
We implement this because it is the Microsoft variant of BIG5, used
|
|
||||||
on Windows.
|
|
||||||
* BIG5+
|
|
||||||
We DON'T implement this because it doesn't appear to be in wide use.
|
|
||||||
Only the CWEX fonts use this encoding. Furthermore, the conversion
|
|
||||||
tables in the big5p package are not coherent: If you convert directly,
|
|
||||||
you get different results than when you convert via GBK.
|
|
||||||
* BIG5-HKSCS
|
|
||||||
We implement it because it is the de-facto standard for traditional
|
|
||||||
Chinese in Hongkong.
|
|
||||||
Korean
|
|
||||||
* EUC-KR
|
|
||||||
We implement these because they appear to be the widely used
|
|
||||||
representations for Korean.
|
|
||||||
* CP949
|
|
||||||
We implement this because it is the Microsoft variant of EUC-KR, used
|
|
||||||
on Windows.
|
|
||||||
* ISO-2022-KR
|
|
||||||
We implement it because it is in the RFCs and because MSIE4 supports
|
|
||||||
it, but I have no idea whether it's really used.
|
|
||||||
* JOHAB
|
|
||||||
We implement this because it is apparently used on Windows as a locale
|
|
||||||
encoding (codepage 1361).
|
|
||||||
* ISO-646-KR
|
|
||||||
We DON'T implement this because although an old ASCII variant, its
|
|
||||||
glyph for 0x7E is not clear: RFC 1345 and unicode.org's JOHAB.TXT
|
|
||||||
say it's a tilde, but Ken Lunde's "CJKV information processing" says
|
|
||||||
it's an overline. And it is not ISO-IR registered.
|
|
||||||
Armenian
|
|
||||||
* ARMSCII-8
|
|
||||||
We implement it because XFree86 supports it.
|
|
||||||
Georgian
|
|
||||||
* Georgian-Academy, Georgian-PS
|
|
||||||
We implement these because they appear to be both used for Georgian;
|
|
||||||
Xfree86 supports them.
|
|
||||||
Thai
|
|
||||||
* ISO-8859-11, TIS-620
|
|
||||||
We implement these because it seems to be standard for Thai.
|
|
||||||
* CP874
|
|
||||||
We implement this because MSIE4 supports it.
|
|
||||||
* MacThai
|
|
||||||
We implement this because the Sun JDK does, and because Mac users
|
|
||||||
don't deserve to be punished.
|
|
||||||
Laotian
|
|
||||||
* MuleLao-1, CP1133
|
|
||||||
We implement these because XFree86 supports them. I have no idea which
|
|
||||||
one is used more widely.
|
|
||||||
Vietnamese
|
|
||||||
* VISCII, TCVN
|
|
||||||
We implement these because XFree86 supports them.
|
|
||||||
* CP1258
|
|
||||||
We implement this because MSIE4 supports it.
|
|
||||||
Other languages
|
|
||||||
* NUNACOM-8 (Inuktitut)
|
|
||||||
We DON'T implement this because it isn't part of Unicode yet, and
|
|
||||||
therefore doesn't convert to anything except itself.
|
|
||||||
Platform specifics
|
|
||||||
* HP-ROMAN8, NEXTSTEP
|
|
||||||
We implement these because they were the native character set on HPs
|
|
||||||
and NeXTs for a long time, and libiconv is intended to be usable on
|
|
||||||
these old machines.
|
|
||||||
Full Unicode
|
|
||||||
* UTF-8, UCS-2, UCS-4
|
|
||||||
We implement these. Obviously.
|
|
||||||
* UCS-2BE, UCS-2LE, UCS-4BE, UCS-4LE
|
|
||||||
We implement these because they are the preferred internal
|
|
||||||
representation of strings in Unicode aware applications. These are
|
|
||||||
non-ambiguous names, known to glibc. (glibc doesn't have
|
|
||||||
UCS-2-INTERNAL and UCS-4-INTERNAL.)
|
|
||||||
* UTF-16, UTF-16BE, UTF-16LE
|
|
||||||
We implement these, because UTF-16 is still the favourite encoding of
|
|
||||||
the president of the Unicode Consortium (for political reasons), and
|
|
||||||
because they appear in RFC 2781.
|
|
||||||
* UTF-32, UTF-32BE, UTF-32LE
|
|
||||||
We implement these because they are part of Unicode 3.1.
|
|
||||||
* UTF-7
|
|
||||||
We implement this because it is essential functionality for mail
|
|
||||||
applications.
|
|
||||||
* C99
|
|
||||||
We implement it because it's used for C and C++ programs and because
|
|
||||||
it's a nice encoding for debugging.
|
|
||||||
* JAVA
|
|
||||||
We implement it because it's used for Java programs and because it's
|
|
||||||
a nice encoding for debugging.
|
|
||||||
* UNICODE (big endian), UNICODEFEFF (little endian)
|
|
||||||
We DON'T implement these because they are stupid and not standardized.
|
|
||||||
Full Unicode, in terms of `uint16_t' or `uint32_t'
|
|
||||||
(with machine dependent endianness and alignment)
|
|
||||||
* UCS-2-INTERNAL, UCS-4-INTERNAL
|
|
||||||
We implement these because they are the preferred internal
|
|
||||||
representation of strings in Unicode aware applications.
|
|
||||||
|
|
||||||
Q: Support encodings mentioned in RFC 1345 ?
|
|
||||||
A: No, they are not in use any more. Supporting ISO-646 variants is pointless
|
|
||||||
since ISO-8859-* have been adopted.
|
|
||||||
|
|
||||||
Q: Support EBCDIC ?
|
|
||||||
A: No!
|
|
||||||
|
|
||||||
Q: How do I add a new character set?
|
|
||||||
A: 1. Explain the "why" in this file, above.
|
|
||||||
2. You need to have a conversion table from/to Unicode. Transform it into
|
|
||||||
the format used by the mapping tables found on ftp.unicode.org: each line
|
|
||||||
contains the character code, in hex, with 0x prefix, then whitespace,
|
|
||||||
then the Unicode code point, in hex, 4 hex digits, with 0x prefix. '#'
|
|
||||||
counts as a comment delimiter until end of line.
|
|
||||||
Please also send your table to Mark Leisher <mleisher@crl.nmsu.edu> so he
|
|
||||||
can include it in his collection.
|
|
||||||
3. If it's an 8-bit character set, use the '8bit_tab_to_h' program in the
|
|
||||||
tools directory to generate the C code for the conversion. You may tweak
|
|
||||||
the resulting C code if you are not satisfied with its quality, but this
|
|
||||||
is rarely needed.
|
|
||||||
If it's a two-dimensional character set (with rows and columns), use the
|
|
||||||
'cjk_tab_to_h' program in the tools directory to generate the C code for
|
|
||||||
the conversion. You will need to modify the main() function to recognize
|
|
||||||
the new character set name, with the proper dimensions, but that shouldn't
|
|
||||||
be too hard. This yields the CCS. The CES you have to write by hand.
|
|
||||||
4. Store the resulting C code file in the lib directory. Add a #include
|
|
||||||
directive to converters.h, and add an entry to the encodings.def file.
|
|
||||||
5. Compile the package, and test your new encoding using a program like
|
|
||||||
iconv(1) or clisp(1).
|
|
||||||
6. Augment the testsuite: Add a line to tests/Makefile.in. For a stateless
|
|
||||||
encoding, create the complete table as a TXT file. For a stateful encoding,
|
|
||||||
provide a text snippet encoded using your new encoding and its UTF-8
|
|
||||||
equivalent.
|
|
||||||
7. Update the README and man/iconv_open.3, to mention the new encoding.
|
|
||||||
Add a note in the NEWS file.
|
|
||||||
|
|
||||||
Q: What about bidirectional text? Should it be tagged or reversed when
|
|
||||||
converting from ISO-8859-8 or ISO-8859-6 to Unicode? Qt appears to do
|
|
||||||
this, see qt-2.0.1/src/tools/qrtlcodec.cpp.
|
|
||||||
A: After reading RFC 1556: I don't think so. Support for ISO-8859-8-I and
|
|
||||||
ISO-8859-E remains to be implemented.
|
|
||||||
On the other hand, a page on www.w3c.org says that ISO-8859-8 in *email*
|
|
||||||
is visually encoded, ISO-8859-8 in *HTML* is logically encoded, i.e.
|
|
||||||
the same as ISO-8859-8-I. I'm confused.
|
|
||||||
|
|
||||||
Other character sets not implemented:
|
|
||||||
"MNEMONIC" = "csMnemonic"
|
|
||||||
"MNEM" = "csMnem"
|
|
||||||
"ISO-10646-UCS-Basic" = "csUnicodeASCII"
|
|
||||||
"ISO-10646-Unicode-Latin1" = "csUnicodeLatin1" = "ISO-10646"
|
|
||||||
"ISO-10646-J-1"
|
|
||||||
"UNICODE-1-1" = "csUnicode11"
|
|
||||||
"csWindows31Latin5"
|
|
||||||
|
|
||||||
Other aliases not implemented (and not implemented in glibc-2.1 either):
|
|
||||||
From MSIE4:
|
|
||||||
ISO-8859-1: alias ISO8859-1
|
|
||||||
ISO-8859-2: alias ISO8859-2
|
|
||||||
KSC_5601: alias KS_C_5601
|
|
||||||
UTF-8: aliases UNICODE-1-1-UTF-8 UNICODE-2-0-UTF-8
|
|
||||||
|
|
||||||
|
|
||||||
Q: How can I integrate libiconv into my package?
|
|
||||||
A: Just copy the entire libiconv package into a subdirectory of your package.
|
|
||||||
At configuration time, call libiconv's configure script with the
|
|
||||||
appropriate --srcdir option and maybe --enable-static or --disable-shared.
|
|
||||||
Then "cd libiconv && make && make install-lib libdir=... includedir=...".
|
|
||||||
'install-lib' is a special (not GNU standardized) target which installs
|
|
||||||
only the include file - in $(includedir) - and the library - in $(libdir) -
|
|
||||||
and does not use other directory variables. After "installing" libiconv
|
|
||||||
in your package's build directory, building of your package can proceed.
|
|
||||||
|
|
||||||
Q: Why is the testsuite so big?
|
|
||||||
A: Because some of the tests are very comprehensive.
|
|
||||||
If you don't feel like using the testsuite, you can simply remove the
|
|
||||||
tests/ directory.
|
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
* Linux with libc6 (glibc-2.1):
|
|
||||||
OK
|
|
||||||
|
|
||||||
* Linux with libc6 (glibc-2.0.7):
|
|
||||||
OK
|
|
||||||
|
|
||||||
* Linux with libc5:
|
|
||||||
OK
|
|
||||||
|
|
||||||
* Solaris 2.7:
|
|
||||||
OK
|
|
||||||
|
|
||||||
* Solaris 2.6:
|
|
||||||
OK
|
|
||||||
|
|
||||||
* OSF/1 5.1:
|
|
||||||
OK
|
|
||||||
|
|
||||||
* OSF/1 4.0d:
|
|
||||||
OK
|
|
||||||
|
|
||||||
* Irix 6.5:
|
|
||||||
OK
|
|
||||||
|
|
||||||
* HP-UX 10.20:
|
|
||||||
OK
|
|
||||||
|
|
||||||
* AIX 4.2:
|
|
||||||
OK
|
|
||||||
|
|
||||||
* SunOS 4:
|
|
||||||
OK when configured --enable-static --disable-shared
|
|
||||||
(gcc cannot create shared libraries without relocations)
|
|
||||||
|
|
||||||
* FreeBSD 3.3:
|
|
||||||
OK
|
|
||||||
|
|
||||||
* BeOS 5:
|
|
||||||
OK
|
|
||||||
|
|
||||||
* Woe32 with MSVC 4.0:
|
|
||||||
OK
|
|
||||||
|
|
||||||
* Woe32 with MSVC 5.0:
|
|
||||||
OK
|
|
||||||
|
|
|
@ -1,170 +0,0 @@
|
||||||
GNU LIBICONV - character set conversion library
|
|
||||||
|
|
||||||
This library provides an iconv() implementation, for use on systems which
|
|
||||||
don't have one, or whose implementation cannot convert from/to Unicode.
|
|
||||||
|
|
||||||
It provides support for the encodings:
|
|
||||||
|
|
||||||
European languages
|
|
||||||
ASCII, ISO-8859-{1,2,3,4,5,7,9,10,13,14,15,16},
|
|
||||||
KOI8-R, KOI8-U, KOI8-RU,
|
|
||||||
CP{1250,1251,1252,1253,1254,1257}, CP{850,866,1131},
|
|
||||||
Mac{Roman,CentralEurope,Iceland,Croatian,Romania},
|
|
||||||
Mac{Cyrillic,Ukraine,Greek,Turkish},
|
|
||||||
Macintosh
|
|
||||||
Semitic languages
|
|
||||||
ISO-8859-{6,8}, CP{1255,1256}, CP862, Mac{Hebrew,Arabic}
|
|
||||||
Japanese
|
|
||||||
EUC-JP, SHIFT_JIS, CP932, ISO-2022-JP, ISO-2022-JP-2, ISO-2022-JP-1
|
|
||||||
Chinese
|
|
||||||
EUC-CN, HZ, GBK, CP936, GB18030, EUC-TW, BIG5, CP950, BIG5-HKSCS,
|
|
||||||
BIG5-HKSCS:2001, BIG5-HKSCS:1999, ISO-2022-CN, ISO-2022-CN-EXT
|
|
||||||
Korean
|
|
||||||
EUC-KR, CP949, ISO-2022-KR, JOHAB
|
|
||||||
Armenian
|
|
||||||
ARMSCII-8
|
|
||||||
Georgian
|
|
||||||
Georgian-Academy, Georgian-PS
|
|
||||||
Tajik
|
|
||||||
KOI8-T
|
|
||||||
Kazakh
|
|
||||||
PT154, RK1048
|
|
||||||
Thai
|
|
||||||
ISO-8859-11, TIS-620, CP874, MacThai
|
|
||||||
Laotian
|
|
||||||
MuleLao-1, CP1133
|
|
||||||
Vietnamese
|
|
||||||
VISCII, TCVN, CP1258
|
|
||||||
Platform specifics
|
|
||||||
HP-ROMAN8, NEXTSTEP
|
|
||||||
Full Unicode
|
|
||||||
UTF-8
|
|
||||||
UCS-2, UCS-2BE, UCS-2LE
|
|
||||||
UCS-4, UCS-4BE, UCS-4LE
|
|
||||||
UTF-16, UTF-16BE, UTF-16LE
|
|
||||||
UTF-32, UTF-32BE, UTF-32LE
|
|
||||||
UTF-7
|
|
||||||
C99, JAVA
|
|
||||||
Full Unicode, in terms of `uint16_t' or `uint32_t'
|
|
||||||
(with machine dependent endianness and alignment)
|
|
||||||
UCS-2-INTERNAL, UCS-4-INTERNAL
|
|
||||||
Locale dependent, in terms of `char' or `wchar_t'
|
|
||||||
(with machine dependent endianness and alignment, and with OS and
|
|
||||||
locale dependent semantics)
|
|
||||||
char, wchar_t
|
|
||||||
The empty encoding name "" is equivalent to "char": it denotes the
|
|
||||||
locale dependent character encoding.
|
|
||||||
|
|
||||||
When configured with the option --enable-extra-encodings, it also provides
|
|
||||||
support for a few extra encodings:
|
|
||||||
|
|
||||||
European languages
|
|
||||||
CP{437,737,775,852,853,855,857,858,860,861,863,865,869,1125}
|
|
||||||
Semitic languages
|
|
||||||
CP864
|
|
||||||
Japanese
|
|
||||||
EUC-JISX0213, Shift_JISX0213, ISO-2022-JP-3
|
|
||||||
Chinese
|
|
||||||
BIG5-2003 (experimental)
|
|
||||||
Turkmen
|
|
||||||
TDS565
|
|
||||||
Platform specifics
|
|
||||||
ATARIST, RISCOS-LATIN1
|
|
||||||
|
|
||||||
It can convert from any of these encodings to any other, through Unicode
|
|
||||||
conversion.
|
|
||||||
|
|
||||||
It has also some limited support for transliteration, i.e. when a character
|
|
||||||
cannot be represented in the target character set, it can be approximated
|
|
||||||
through one or several similarly looking characters. Transliteration is
|
|
||||||
activated when "//TRANSLIT" is appended to the target encoding name.
|
|
||||||
|
|
||||||
libiconv is for you if your application needs to support multiple character
|
|
||||||
encodings, but that support lacks from your system.
|
|
||||||
|
|
||||||
|
|
||||||
Installation
|
|
||||||
------------
|
|
||||||
|
|
||||||
As usual for GNU packages:
|
|
||||||
|
|
||||||
$ ./configure --prefix=/usr/local
|
|
||||||
$ make
|
|
||||||
$ make install
|
|
||||||
|
|
||||||
After installing GNU libiconv for the first time, it is recommended to
|
|
||||||
recompile and reinstall GNU gettext, so that it can take advantage of
|
|
||||||
libiconv.
|
|
||||||
|
|
||||||
On systems other than GNU/Linux, the iconv program will be internationalized
|
|
||||||
only if GNU gettext has been built and installed before GNU libiconv. This
|
|
||||||
means that the first time GNU libiconv is installed, we have a circular
|
|
||||||
dependency between the GNU libiconv and GNU gettext packages, which can be
|
|
||||||
resolved by building and installing either
|
|
||||||
- first libiconv, then gettext, then libiconv again,
|
|
||||||
or (on systems supporting shared libraries, excluding AIX)
|
|
||||||
- first gettext, then libiconv, then gettext again.
|
|
||||||
Recall that before building a package for the second time, you need to erase
|
|
||||||
the traces of the first build by running "make distclean".
|
|
||||||
|
|
||||||
This library can be built and installed in two variants:
|
|
||||||
|
|
||||||
- The library mode. This works on all systems, and uses a library
|
|
||||||
`libiconv.so' and a header file `<iconv.h>'. (Both are installed
|
|
||||||
through "make install".)
|
|
||||||
|
|
||||||
To use it, simply #include <iconv.h> and use the functions.
|
|
||||||
|
|
||||||
To use it in an autoconfiguring package:
|
|
||||||
- If you don't use automake, append m4/iconv.m4 to your aclocal.m4
|
|
||||||
file.
|
|
||||||
- If you do use automake, add m4/iconv.m4 to your m4 macro repository.
|
|
||||||
- Add to the link command line of libraries and executables that use
|
|
||||||
the functions the placeholder @LIBICONV@ (or, if using libtool for
|
|
||||||
the link, @LTLIBICONV@). If you use automake, the right place for
|
|
||||||
these additions are the *_LDADD variables.
|
|
||||||
Note that 'iconv.m4' is also part of the GNU gettext package, which
|
|
||||||
installs it in /usr/local/share/aclocal/iconv.m4.
|
|
||||||
|
|
||||||
- The libc plug/override mode. This works on GNU/Linux, Solaris and OSF/1
|
|
||||||
systems only. It is a way to get good iconv support without having
|
|
||||||
glibc-2.1.
|
|
||||||
It installs a library `preloadable_libiconv.so'. This library can be used
|
|
||||||
with LD_PRELOAD, to override the iconv* functions present in the C library.
|
|
||||||
|
|
||||||
On GNU/Linux and Solaris:
|
|
||||||
$ export LD_PRELOAD=/usr/local/lib/preloadable_libiconv.so
|
|
||||||
|
|
||||||
On OSF/1:
|
|
||||||
$ export _RLD_LIST=/usr/local/lib/preloadable_libiconv.so:DEFAULT
|
|
||||||
|
|
||||||
A program's source need not be modified, the program need not even be
|
|
||||||
recompiled. Just set the LD_PRELOAD environment variable, that's it!
|
|
||||||
|
|
||||||
|
|
||||||
Copyright
|
|
||||||
---------
|
|
||||||
|
|
||||||
The libiconv and libcharset _libraries_ and their header files are under LGPL,
|
|
||||||
see file COPYING.LIB.
|
|
||||||
|
|
||||||
The iconv _program_ and the documentation are under GPL, see file COPYING.
|
|
||||||
|
|
||||||
|
|
||||||
Download
|
|
||||||
--------
|
|
||||||
|
|
||||||
http://ftp.gnu.org/gnu/libiconv/libiconv-1.13.tar.gz
|
|
||||||
|
|
||||||
Homepage
|
|
||||||
--------
|
|
||||||
|
|
||||||
http://www.gnu.org/software/libiconv/
|
|
||||||
|
|
||||||
Bug reports to
|
|
||||||
--------------
|
|
||||||
|
|
||||||
<bug-gnu-libiconv@gnu.org>
|
|
||||||
|
|
||||||
|
|
||||||
Bruno Haible <bruno@clisp.org>
|
|
|
@ -1,15 +0,0 @@
|
||||||
Thanks to for
|
|
||||||
|
|
||||||
Edmund Grimley Evans <edmundo@rano.org> bug reports
|
|
||||||
|
|
||||||
Taro Muraoka <koron@tka.att.ne.jp> Woe32 DLL support
|
|
||||||
|
|
||||||
Akira Hatakeyama <akira@sra.co.jp> OS/2 support
|
|
||||||
|
|
||||||
Juan Manuel Guerrero <st001906@hrz1.hrz.tu-darmstadt.de>
|
|
||||||
DOS/DJGPP support
|
|
||||||
|
|
||||||
Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> advice on EUC-JP and JISX0213
|
|
||||||
|
|
||||||
Ken Lunde <lunde@adobe.com> detailed information about GB18030
|
|
||||||
|
|
|
@ -1,242 +0,0 @@
|
||||||
/* Copyright (C) 1999-2003, 2005-2006, 2008-2009 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU LIBICONV Library.
|
|
||||||
|
|
||||||
The GNU LIBICONV Library is free software; you can redistribute it
|
|
||||||
and/or modify it under the terms of the GNU Library General Public
|
|
||||||
License as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU LIBICONV 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
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
|
||||||
If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
|
|
||||||
Fifth Floor, Boston, MA 02110-1301, USA. */
|
|
||||||
|
|
||||||
/* When installed, this file is called "iconv.h". */
|
|
||||||
|
|
||||||
#ifndef _LIBICONV_H
|
|
||||||
#define _LIBICONV_H
|
|
||||||
|
|
||||||
#define _LIBICONV_VERSION 0x010D /* version number: (major<<8) + minor */
|
|
||||||
|
|
||||||
#if 1 && BUILDING_LIBICONV
|
|
||||||
#define LIBICONV_DLL_EXPORTED __attribute__((__visibility__("default")))
|
|
||||||
#else
|
|
||||||
#define LIBICONV_DLL_EXPORTED
|
|
||||||
#endif
|
|
||||||
extern LIBICONV_DLL_EXPORTED int _libiconv_version; /* Likewise */
|
|
||||||
|
|
||||||
/* We would like to #include any system header file which could define
|
|
||||||
iconv_t, 1. in order to eliminate the risk that the user gets compilation
|
|
||||||
errors because some other system header file includes /usr/include/iconv.h
|
|
||||||
which defines iconv_t or declares iconv after this file, 2. when compiling
|
|
||||||
for LIBICONV_PLUG, we need the proper iconv_t type in order to produce
|
|
||||||
binary compatible code.
|
|
||||||
But gcc's #include_next is not portable. Thus, once libiconv's iconv.h
|
|
||||||
has been installed in /usr/local/include, there is no way any more to
|
|
||||||
include the original /usr/include/iconv.h. We simply have to get away
|
|
||||||
without it.
|
|
||||||
Ad 1. The risk that a system header file does
|
|
||||||
#include "iconv.h" or #include_next "iconv.h"
|
|
||||||
is small. They all do #include <iconv.h>.
|
|
||||||
Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It
|
|
||||||
has to be a scalar type because (iconv_t)(-1) is a possible return value
|
|
||||||
from iconv_open().) */
|
|
||||||
|
|
||||||
/* Define iconv_t ourselves. */
|
|
||||||
#undef iconv_t
|
|
||||||
#define iconv_t libiconv_t
|
|
||||||
typedef void* iconv_t;
|
|
||||||
|
|
||||||
/* Get size_t declaration.
|
|
||||||
Get wchar_t declaration if it exists. */
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
/* Get errno declaration and values. */
|
|
||||||
#include <errno.h>
|
|
||||||
/* Some systems, like SunOS 4, don't have EILSEQ. Some systems, like BSD/OS,
|
|
||||||
have EILSEQ in a different header. On these systems, define EILSEQ
|
|
||||||
ourselves. */
|
|
||||||
#ifndef EILSEQ
|
|
||||||
#define EILSEQ
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Allocates descriptor for code conversion from encoding ‘fromcode’ to
|
|
||||||
encoding ‘tocode’. */
|
|
||||||
#ifndef LIBICONV_PLUG
|
|
||||||
#define iconv_open libiconv_open
|
|
||||||
#endif
|
|
||||||
extern LIBICONV_DLL_EXPORTED iconv_t iconv_open (const char* tocode, const char* fromcode);
|
|
||||||
|
|
||||||
/* Converts, using conversion descriptor ‘cd’, at most ‘*inbytesleft’ bytes
|
|
||||||
starting at ‘*inbuf’, writing at most ‘*outbytesleft’ bytes starting at
|
|
||||||
‘*outbuf’.
|
|
||||||
Decrements ‘*inbytesleft’ and increments ‘*inbuf’ by the same amount.
|
|
||||||
Decrements ‘*outbytesleft’ and increments ‘*outbuf’ by the same amount. */
|
|
||||||
#ifndef LIBICONV_PLUG
|
|
||||||
#define iconv libiconv
|
|
||||||
#endif
|
|
||||||
extern LIBICONV_DLL_EXPORTED size_t iconv (iconv_t cd, char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
|
|
||||||
|
|
||||||
/* Frees resources allocated for conversion descriptor ‘cd’. */
|
|
||||||
#ifndef LIBICONV_PLUG
|
|
||||||
#define iconv_close libiconv_close
|
|
||||||
#endif
|
|
||||||
extern LIBICONV_DLL_EXPORTED int iconv_close (iconv_t cd);
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef LIBICONV_PLUG
|
|
||||||
|
|
||||||
/* Nonstandard extensions. */
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
#if 0
|
|
||||||
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
|
|
||||||
<wchar.h>.
|
|
||||||
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|
|
||||||
included before <wchar.h>. */
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <time.h>
|
|
||||||
#endif
|
|
||||||
#include <wchar.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* A type that holds all memory needed by a conversion descriptor.
|
|
||||||
A pointer to such an object can be used as an iconv_t. */
|
|
||||||
typedef struct {
|
|
||||||
void* dummy1[28];
|
|
||||||
#if 1
|
|
||||||
mbstate_t dummy2;
|
|
||||||
#endif
|
|
||||||
} iconv_allocation_t;
|
|
||||||
|
|
||||||
/* Allocates descriptor for code conversion from encoding ‘fromcode’ to
|
|
||||||
encoding ‘tocode’ into preallocated memory. Returns an error indicator
|
|
||||||
(0 or -1 with errno set). */
|
|
||||||
#define iconv_open_into libiconv_open_into
|
|
||||||
extern LIBICONV_DLL_EXPORTED int iconv_open_into (const char* tocode, const char* fromcode,
|
|
||||||
iconv_allocation_t* resultp);
|
|
||||||
|
|
||||||
/* Control of attributes. */
|
|
||||||
#define iconvctl libiconvctl
|
|
||||||
extern LIBICONV_DLL_EXPORTED int iconvctl (iconv_t cd, int request, void* argument);
|
|
||||||
|
|
||||||
/* Hook performed after every successful conversion of a Unicode character. */
|
|
||||||
typedef void (*iconv_unicode_char_hook) (unsigned int uc, void* data);
|
|
||||||
/* Hook performed after every successful conversion of a wide character. */
|
|
||||||
typedef void (*iconv_wide_char_hook) (wchar_t wc, void* data);
|
|
||||||
/* Set of hooks. */
|
|
||||||
struct iconv_hooks {
|
|
||||||
iconv_unicode_char_hook uc_hook;
|
|
||||||
iconv_wide_char_hook wc_hook;
|
|
||||||
void* data;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Fallback function. Invoked when a small number of bytes could not be
|
|
||||||
converted to a Unicode character. This function should process all
|
|
||||||
bytes from inbuf and may produce replacement Unicode characters by calling
|
|
||||||
the write_replacement callback repeatedly. */
|
|
||||||
typedef void (*iconv_unicode_mb_to_uc_fallback)
|
|
||||||
(const char* inbuf, size_t inbufsize,
|
|
||||||
void (*write_replacement) (const unsigned int *buf, size_t buflen,
|
|
||||||
void* callback_arg),
|
|
||||||
void* callback_arg,
|
|
||||||
void* data);
|
|
||||||
/* Fallback function. Invoked when a Unicode character could not be converted
|
|
||||||
to the target encoding. This function should process the character and
|
|
||||||
may produce replacement bytes (in the target encoding) by calling the
|
|
||||||
write_replacement callback repeatedly. */
|
|
||||||
typedef void (*iconv_unicode_uc_to_mb_fallback)
|
|
||||||
(unsigned int code,
|
|
||||||
void (*write_replacement) (const char *buf, size_t buflen,
|
|
||||||
void* callback_arg),
|
|
||||||
void* callback_arg,
|
|
||||||
void* data);
|
|
||||||
#if 1
|
|
||||||
/* Fallback function. Invoked when a number of bytes could not be converted to
|
|
||||||
a wide character. This function should process all bytes from inbuf and may
|
|
||||||
produce replacement wide characters by calling the write_replacement
|
|
||||||
callback repeatedly. */
|
|
||||||
typedef void (*iconv_wchar_mb_to_wc_fallback)
|
|
||||||
(const char* inbuf, size_t inbufsize,
|
|
||||||
void (*write_replacement) (const wchar_t *buf, size_t buflen,
|
|
||||||
void* callback_arg),
|
|
||||||
void* callback_arg,
|
|
||||||
void* data);
|
|
||||||
/* Fallback function. Invoked when a wide character could not be converted to
|
|
||||||
the target encoding. This function should process the character and may
|
|
||||||
produce replacement bytes (in the target encoding) by calling the
|
|
||||||
write_replacement callback repeatedly. */
|
|
||||||
typedef void (*iconv_wchar_wc_to_mb_fallback)
|
|
||||||
(wchar_t code,
|
|
||||||
void (*write_replacement) (const char *buf, size_t buflen,
|
|
||||||
void* callback_arg),
|
|
||||||
void* callback_arg,
|
|
||||||
void* data);
|
|
||||||
#else
|
|
||||||
/* If the wchar_t type does not exist, these two fallback functions are never
|
|
||||||
invoked. Their argument list therefore does not matter. */
|
|
||||||
typedef void (*iconv_wchar_mb_to_wc_fallback) ();
|
|
||||||
typedef void (*iconv_wchar_wc_to_mb_fallback) ();
|
|
||||||
#endif
|
|
||||||
/* Set of fallbacks. */
|
|
||||||
struct iconv_fallbacks {
|
|
||||||
iconv_unicode_mb_to_uc_fallback mb_to_uc_fallback;
|
|
||||||
iconv_unicode_uc_to_mb_fallback uc_to_mb_fallback;
|
|
||||||
iconv_wchar_mb_to_wc_fallback mb_to_wc_fallback;
|
|
||||||
iconv_wchar_wc_to_mb_fallback wc_to_mb_fallback;
|
|
||||||
void* data;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Requests for iconvctl. */
|
|
||||||
#define ICONV_TRIVIALP 0 /* int *argument */
|
|
||||||
#define ICONV_GET_TRANSLITERATE 1 /* int *argument */
|
|
||||||
#define ICONV_SET_TRANSLITERATE 2 /* const int *argument */
|
|
||||||
#define ICONV_GET_DISCARD_ILSEQ 3 /* int *argument */
|
|
||||||
#define ICONV_SET_DISCARD_ILSEQ 4 /* const int *argument */
|
|
||||||
#define ICONV_SET_HOOKS 5 /* const struct iconv_hooks *argument */
|
|
||||||
#define ICONV_SET_FALLBACKS 6 /* const struct iconv_fallbacks *argument */
|
|
||||||
|
|
||||||
/* Listing of locale independent encodings. */
|
|
||||||
#define iconvlist libiconvlist
|
|
||||||
extern LIBICONV_DLL_EXPORTED void iconvlist (int (*do_one) (unsigned int namescount,
|
|
||||||
const char * const * names,
|
|
||||||
void* data),
|
|
||||||
void* data);
|
|
||||||
|
|
||||||
/* Canonicalize an encoding name.
|
|
||||||
The result is either a canonical encoding name, or name itself. */
|
|
||||||
extern LIBICONV_DLL_EXPORTED const char * iconv_canonicalize (const char * name);
|
|
||||||
|
|
||||||
/* Support for relocatable packages. */
|
|
||||||
|
|
||||||
/* Sets the original and the current installation prefix of the package.
|
|
||||||
Relocation simply replaces a pathname starting with the original prefix
|
|
||||||
by the corresponding pathname with the current prefix instead. Both
|
|
||||||
prefixes should be directory names without trailing slash (i.e. use ""
|
|
||||||
instead of "/"). */
|
|
||||||
extern LIBICONV_DLL_EXPORTED void libiconv_set_relocation_prefix (const char *orig_prefix,
|
|
||||||
const char *curr_prefix);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* mingw32's errno is not msvc's errno, which makes directly getting iconv's
|
|
||||||
errors impossible when combining them */
|
|
||||||
//#define errno_WORKAROUND 1
|
|
||||||
//extern LIBICONV_DLL_EXPORTED int errno;
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _LIBICONV_H */
|
|
|
@ -1,46 +0,0 @@
|
||||||
/* Copyright (C) 2003 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU CHARSET Library.
|
|
||||||
|
|
||||||
The GNU CHARSET Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public License as
|
|
||||||
published by the Free Software Foundation; either version 2 of the
|
|
||||||
License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU CHARSET 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
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public License
|
|
||||||
along with the GNU CHARSET Library; see the file COPYING.LIB. If not,
|
|
||||||
write to the Free Software Foundation, Inc., 51 Franklin Street,
|
|
||||||
Fifth Floor, Boston, MA 02110-1301, USA. */
|
|
||||||
|
|
||||||
#ifndef _LIBCHARSET_H
|
|
||||||
#define _LIBCHARSET_H
|
|
||||||
|
|
||||||
#include <localcharset.h>
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Support for relocatable packages. */
|
|
||||||
|
|
||||||
/* Sets the original and the current installation prefix of the package.
|
|
||||||
Relocation simply replaces a pathname starting with the original prefix
|
|
||||||
by the corresponding pathname with the current prefix instead. Both
|
|
||||||
prefixes should be directory names without trailing slash (i.e. use ""
|
|
||||||
instead of "/"). */
|
|
||||||
extern void libcharset_set_relocation_prefix (const char *orig_prefix,
|
|
||||||
const char *curr_prefix);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* _LIBCHARSET_H */
|
|
|
@ -1,48 +0,0 @@
|
||||||
/* Determine a canonical name for the current locale's character encoding.
|
|
||||||
Copyright (C) 2000-2003 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU CHARSET Library.
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU Library General Public License as published
|
|
||||||
by the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|
||||||
USA. */
|
|
||||||
|
|
||||||
#ifndef _LOCALCHARSET_H
|
|
||||||
#define _LOCALCHARSET_H
|
|
||||||
|
|
||||||
#if 1 && BUILDING_LIBCHARSET
|
|
||||||
#define LIBCHARSET_DLL_EXPORTED __attribute__((__visibility__("default")))
|
|
||||||
#else
|
|
||||||
#define LIBCHARSET_DLL_EXPORTED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Determine the current locale's character encoding, and canonicalize it
|
|
||||||
into one of the canonical names listed in config.charset.
|
|
||||||
The result must not be freed; it is statically allocated.
|
|
||||||
If the canonical name cannot be determined, the result is a non-canonical
|
|
||||||
name. */
|
|
||||||
extern LIBCHARSET_DLL_EXPORTED const char * locale_charset (void);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* _LOCALCHARSET_H */
|
|
|
@ -1,46 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2000 Jeroen Ruigrok van der Werven <asmodai@FreeBSD.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* $FreeBSD: src/include/stdbool.h,v 1.6 2002/08/16 07:33:14 alfred Exp $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _STDBOOL_H_
|
|
||||||
#define _STDBOOL_H_
|
|
||||||
|
|
||||||
#define __bool_true_false_are_defined 1
|
|
||||||
|
|
||||||
#ifndef __cplusplus
|
|
||||||
|
|
||||||
#define false 0
|
|
||||||
#define true 1
|
|
||||||
|
|
||||||
#define bool _Bool
|
|
||||||
#if __STDC_VERSION__ < 199901L && __GNUC__ < 3
|
|
||||||
typedef int _Bool;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* !__cplusplus */
|
|
||||||
|
|
||||||
#endif /* !_STDBOOL_H_ */
|
|
|
@ -1,102 +0,0 @@
|
||||||
/* config.h. Generated from config.h.in by configure. */
|
|
||||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
|
||||||
|
|
||||||
/* Define to 1 if the package shall run at any location in the filesystem. */
|
|
||||||
/* #undef ENABLE_RELOCATABLE */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
|
||||||
/* #undef HAVE_DLFCN_H */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
|
||||||
#define HAVE_INTTYPES_H 1
|
|
||||||
|
|
||||||
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
|
|
||||||
/* #undef HAVE_LANGINFO_CODESET */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <memory.h> header file. */
|
|
||||||
#define HAVE_MEMORY_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `setlocale' function. */
|
|
||||||
#define HAVE_SETLOCALE 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdint.h> header file. */
|
|
||||||
#define HAVE_STDINT_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
|
||||||
#define HAVE_STDLIB_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <strings.h> header file. */
|
|
||||||
#define HAVE_STRINGS_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <string.h> header file. */
|
|
||||||
#define HAVE_STRING_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
|
||||||
#define HAVE_SYS_STAT_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
|
||||||
#define HAVE_SYS_TYPES_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
|
||||||
#define HAVE_UNISTD_H 1
|
|
||||||
|
|
||||||
/* Define to 1 or 0, depending whether the compiler supports simple visibility
|
|
||||||
declarations. */
|
|
||||||
#define HAVE_VISIBILITY 1
|
|
||||||
|
|
||||||
/* Define to the value of ${prefix}, as a string. */
|
|
||||||
#define INSTALLPREFIX "/usr/local/mingw"
|
|
||||||
|
|
||||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||||
*/
|
|
||||||
#define LT_OBJDIR ".libs/"
|
|
||||||
|
|
||||||
/* Define to the address where bug reports for this package should be sent. */
|
|
||||||
#define PACKAGE_BUGREPORT ""
|
|
||||||
|
|
||||||
/* Define to the full name of this package. */
|
|
||||||
#define PACKAGE_NAME ""
|
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */
|
|
||||||
#define PACKAGE_STRING ""
|
|
||||||
|
|
||||||
/* Define to the one symbol short name of this package. */
|
|
||||||
#define PACKAGE_TARNAME ""
|
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
|
||||||
#define PACKAGE_VERSION ""
|
|
||||||
|
|
||||||
/* Define to 1 if you have the ANSI C header files. */
|
|
||||||
#define STDC_HEADERS 1
|
|
||||||
|
|
||||||
/* Enable extensions on AIX 3, Interix. */
|
|
||||||
#ifndef _ALL_SOURCE
|
|
||||||
# define _ALL_SOURCE 1
|
|
||||||
#endif
|
|
||||||
/* Enable GNU extensions on systems that have them. */
|
|
||||||
#ifndef _GNU_SOURCE
|
|
||||||
# define _GNU_SOURCE 1
|
|
||||||
#endif
|
|
||||||
/* Enable threading extensions on Solaris. */
|
|
||||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
|
||||||
# define _POSIX_PTHREAD_SEMANTICS 1
|
|
||||||
#endif
|
|
||||||
/* Enable extensions on HP NonStop. */
|
|
||||||
#ifndef _TANDEM_SOURCE
|
|
||||||
# define _TANDEM_SOURCE 1
|
|
||||||
#endif
|
|
||||||
/* Enable general extensions on Solaris. */
|
|
||||||
#ifndef __EXTENSIONS__
|
|
||||||
# define __EXTENSIONS__ 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Define to 1 if on MINIX. */
|
|
||||||
/* #undef _MINIX */
|
|
||||||
|
|
||||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
|
||||||
this defined. */
|
|
||||||
/* #undef _POSIX_1_SOURCE */
|
|
||||||
|
|
||||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
|
||||||
/* #undef _POSIX_SOURCE */
|
|
|
@ -1,500 +0,0 @@
|
||||||
/* Determine a canonical name for the current locale's character encoding.
|
|
||||||
|
|
||||||
Copyright (C) 2000-2006, 2008-2009 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU Library General Public License as published
|
|
||||||
by the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|
||||||
USA. */
|
|
||||||
|
|
||||||
/* Written by Bruno Haible <bruno@clisp.org>. */
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
/* Specification. */
|
|
||||||
#include "localcharset.h"
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
|
|
||||||
# define DARWIN7 /* Darwin 7 or newer, i.e. MacOS X 10.3 or newer */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined _WIN32 || defined __WIN32__
|
|
||||||
# define WIN32_NATIVE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined __EMX__
|
|
||||||
/* Assume EMX program runs on OS/2, even if compiled under DOS. */
|
|
||||||
# ifndef OS2
|
|
||||||
# define OS2
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined WIN32_NATIVE
|
|
||||||
# if HAVE_LANGINFO_CODESET
|
|
||||||
# include <langinfo.h>
|
|
||||||
# else
|
|
||||||
# if 0 /* see comment below */
|
|
||||||
# include <locale.h>
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# ifdef __CYGWIN__
|
|
||||||
# define WIN32_LEAN_AND_MEAN
|
|
||||||
# include <windows.h>
|
|
||||||
# endif
|
|
||||||
#elif defined WIN32_NATIVE
|
|
||||||
# define WIN32_LEAN_AND_MEAN
|
|
||||||
# include <windows.h>
|
|
||||||
#endif
|
|
||||||
#if defined OS2
|
|
||||||
# define INCL_DOS
|
|
||||||
# include <os2.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLE_RELOCATABLE
|
|
||||||
# include "relocatable.h"
|
|
||||||
#else
|
|
||||||
# define relocate(pathname) (pathname)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Get LIBDIR. */
|
|
||||||
#ifndef LIBDIR
|
|
||||||
//# include "configmake.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
|
|
||||||
/* Win32, Cygwin, OS/2, DOS */
|
|
||||||
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DIRECTORY_SEPARATOR
|
|
||||||
# define DIRECTORY_SEPARATOR '/'
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ISSLASH
|
|
||||||
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAVE_DECL_GETC_UNLOCKED
|
|
||||||
# undef getc
|
|
||||||
# define getc getc_unlocked
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The following static variable is declared 'volatile' to avoid a
|
|
||||||
possible multithread problem in the function get_charset_aliases. If we
|
|
||||||
are running in a threaded environment, and if two threads initialize
|
|
||||||
'charset_aliases' simultaneously, both will produce the same value,
|
|
||||||
and everything will be ok if the two assignments to 'charset_aliases'
|
|
||||||
are atomic. But I don't know what will happen if the two assignments mix. */
|
|
||||||
#if __STDC__ != 1
|
|
||||||
# define volatile /* empty */
|
|
||||||
#endif
|
|
||||||
/* Pointer to the contents of the charset.alias file, if it has already been
|
|
||||||
read, else NULL. Its format is:
|
|
||||||
ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */
|
|
||||||
static const char * volatile charset_aliases;
|
|
||||||
|
|
||||||
/* Return a pointer to the contents of the charset.alias file. */
|
|
||||||
static const char *
|
|
||||||
get_charset_aliases (void)
|
|
||||||
{
|
|
||||||
const char *cp;
|
|
||||||
|
|
||||||
cp = charset_aliases;
|
|
||||||
if (cp == NULL)
|
|
||||||
{
|
|
||||||
#if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE || defined __CYGWIN__)
|
|
||||||
FILE *fp;
|
|
||||||
const char *dir;
|
|
||||||
const char *base = "charset.alias";
|
|
||||||
char *file_name;
|
|
||||||
|
|
||||||
/* Make it possible to override the charset.alias location. This is
|
|
||||||
necessary for running the testsuite before "make install". */
|
|
||||||
dir = getenv ("CHARSETALIASDIR");
|
|
||||||
if (dir == NULL || dir[0] == '\0')
|
|
||||||
dir = relocate (LIBDIR);
|
|
||||||
|
|
||||||
/* Concatenate dir and base into freshly allocated file_name. */
|
|
||||||
{
|
|
||||||
size_t dir_len = strlen (dir);
|
|
||||||
size_t base_len = strlen (base);
|
|
||||||
int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1]));
|
|
||||||
file_name = (char *) malloc (dir_len + add_slash + base_len + 1);
|
|
||||||
if (file_name != NULL)
|
|
||||||
{
|
|
||||||
memcpy (file_name, dir, dir_len);
|
|
||||||
if (add_slash)
|
|
||||||
file_name[dir_len] = DIRECTORY_SEPARATOR;
|
|
||||||
memcpy (file_name + dir_len + add_slash, base, base_len + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL)
|
|
||||||
/* Out of memory or file not found, treat it as empty. */
|
|
||||||
cp = "";
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Parse the file's contents. */
|
|
||||||
char *res_ptr = NULL;
|
|
||||||
size_t res_size = 0;
|
|
||||||
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
int c;
|
|
||||||
char buf1[50+1];
|
|
||||||
char buf2[50+1];
|
|
||||||
size_t l1, l2;
|
|
||||||
char *old_res_ptr;
|
|
||||||
|
|
||||||
c = getc (fp);
|
|
||||||
if (c == EOF)
|
|
||||||
break;
|
|
||||||
if (c == '\n' || c == ' ' || c == '\t')
|
|
||||||
continue;
|
|
||||||
if (c == '#')
|
|
||||||
{
|
|
||||||
/* Skip comment, to end of line. */
|
|
||||||
do
|
|
||||||
c = getc (fp);
|
|
||||||
while (!(c == EOF || c == '\n'));
|
|
||||||
if (c == EOF)
|
|
||||||
break;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ungetc (c, fp);
|
|
||||||
if (fscanf (fp, "%50s %50s", buf1, buf2) < 2)
|
|
||||||
break;
|
|
||||||
l1 = strlen (buf1);
|
|
||||||
l2 = strlen (buf2);
|
|
||||||
old_res_ptr = res_ptr;
|
|
||||||
if (res_size == 0)
|
|
||||||
{
|
|
||||||
res_size = l1 + 1 + l2 + 1;
|
|
||||||
res_ptr = (char *) malloc (res_size + 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
res_size += l1 + 1 + l2 + 1;
|
|
||||||
res_ptr = (char *) realloc (res_ptr, res_size + 1);
|
|
||||||
}
|
|
||||||
if (res_ptr == NULL)
|
|
||||||
{
|
|
||||||
/* Out of memory. */
|
|
||||||
res_size = 0;
|
|
||||||
if (old_res_ptr != NULL)
|
|
||||||
free (old_res_ptr);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
|
|
||||||
strcpy (res_ptr + res_size - (l2 + 1), buf2);
|
|
||||||
}
|
|
||||||
fclose (fp);
|
|
||||||
if (res_size == 0)
|
|
||||||
cp = "";
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*(res_ptr + res_size) = '\0';
|
|
||||||
cp = res_ptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_name != NULL)
|
|
||||||
free (file_name);
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
# if defined DARWIN7
|
|
||||||
/* To avoid the trouble of installing a file that is shared by many
|
|
||||||
GNU packages -- many packaging systems have problems with this --,
|
|
||||||
simply inline the aliases here. */
|
|
||||||
cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
|
|
||||||
"ISO8859-2" "\0" "ISO-8859-2" "\0"
|
|
||||||
"ISO8859-4" "\0" "ISO-8859-4" "\0"
|
|
||||||
"ISO8859-5" "\0" "ISO-8859-5" "\0"
|
|
||||||
"ISO8859-7" "\0" "ISO-8859-7" "\0"
|
|
||||||
"ISO8859-9" "\0" "ISO-8859-9" "\0"
|
|
||||||
"ISO8859-13" "\0" "ISO-8859-13" "\0"
|
|
||||||
"ISO8859-15" "\0" "ISO-8859-15" "\0"
|
|
||||||
"KOI8-R" "\0" "KOI8-R" "\0"
|
|
||||||
"KOI8-U" "\0" "KOI8-U" "\0"
|
|
||||||
"CP866" "\0" "CP866" "\0"
|
|
||||||
"CP949" "\0" "CP949" "\0"
|
|
||||||
"CP1131" "\0" "CP1131" "\0"
|
|
||||||
"CP1251" "\0" "CP1251" "\0"
|
|
||||||
"eucCN" "\0" "GB2312" "\0"
|
|
||||||
"GB2312" "\0" "GB2312" "\0"
|
|
||||||
"eucJP" "\0" "EUC-JP" "\0"
|
|
||||||
"eucKR" "\0" "EUC-KR" "\0"
|
|
||||||
"Big5" "\0" "BIG5" "\0"
|
|
||||||
"Big5HKSCS" "\0" "BIG5-HKSCS" "\0"
|
|
||||||
"GBK" "\0" "GBK" "\0"
|
|
||||||
"GB18030" "\0" "GB18030" "\0"
|
|
||||||
"SJIS" "\0" "SHIFT_JIS" "\0"
|
|
||||||
"ARMSCII-8" "\0" "ARMSCII-8" "\0"
|
|
||||||
"PT154" "\0" "PT154" "\0"
|
|
||||||
/*"ISCII-DEV" "\0" "?" "\0"*/
|
|
||||||
"*" "\0" "UTF-8" "\0";
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if defined VMS
|
|
||||||
/* To avoid the troubles of an extra file charset.alias_vms in the
|
|
||||||
sources of many GNU packages, simply inline the aliases here. */
|
|
||||||
/* The list of encodings is taken from the OpenVMS 7.3-1 documentation
|
|
||||||
"Compaq C Run-Time Library Reference Manual for OpenVMS systems"
|
|
||||||
section 10.7 "Handling Different Character Sets". */
|
|
||||||
cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
|
|
||||||
"ISO8859-2" "\0" "ISO-8859-2" "\0"
|
|
||||||
"ISO8859-5" "\0" "ISO-8859-5" "\0"
|
|
||||||
"ISO8859-7" "\0" "ISO-8859-7" "\0"
|
|
||||||
"ISO8859-8" "\0" "ISO-8859-8" "\0"
|
|
||||||
"ISO8859-9" "\0" "ISO-8859-9" "\0"
|
|
||||||
/* Japanese */
|
|
||||||
"eucJP" "\0" "EUC-JP" "\0"
|
|
||||||
"SJIS" "\0" "SHIFT_JIS" "\0"
|
|
||||||
"DECKANJI" "\0" "DEC-KANJI" "\0"
|
|
||||||
"SDECKANJI" "\0" "EUC-JP" "\0"
|
|
||||||
/* Chinese */
|
|
||||||
"eucTW" "\0" "EUC-TW" "\0"
|
|
||||||
"DECHANYU" "\0" "DEC-HANYU" "\0"
|
|
||||||
"DECHANZI" "\0" "GB2312" "\0"
|
|
||||||
/* Korean */
|
|
||||||
"DECKOREAN" "\0" "EUC-KR" "\0";
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if defined WIN32_NATIVE || defined __CYGWIN__
|
|
||||||
/* To avoid the troubles of installing a separate file in the same
|
|
||||||
directory as the DLL and of retrieving the DLL's directory at
|
|
||||||
runtime, simply inline the aliases here. */
|
|
||||||
|
|
||||||
cp = "CP936" "\0" "GBK" "\0"
|
|
||||||
"CP1361" "\0" "JOHAB" "\0"
|
|
||||||
"CP20127" "\0" "ASCII" "\0"
|
|
||||||
"CP20866" "\0" "KOI8-R" "\0"
|
|
||||||
"CP20936" "\0" "GB2312" "\0"
|
|
||||||
"CP21866" "\0" "KOI8-RU" "\0"
|
|
||||||
"CP28591" "\0" "ISO-8859-1" "\0"
|
|
||||||
"CP28592" "\0" "ISO-8859-2" "\0"
|
|
||||||
"CP28593" "\0" "ISO-8859-3" "\0"
|
|
||||||
"CP28594" "\0" "ISO-8859-4" "\0"
|
|
||||||
"CP28595" "\0" "ISO-8859-5" "\0"
|
|
||||||
"CP28596" "\0" "ISO-8859-6" "\0"
|
|
||||||
"CP28597" "\0" "ISO-8859-7" "\0"
|
|
||||||
"CP28598" "\0" "ISO-8859-8" "\0"
|
|
||||||
"CP28599" "\0" "ISO-8859-9" "\0"
|
|
||||||
"CP28605" "\0" "ISO-8859-15" "\0"
|
|
||||||
"CP38598" "\0" "ISO-8859-8" "\0"
|
|
||||||
"CP51932" "\0" "EUC-JP" "\0"
|
|
||||||
"CP51936" "\0" "GB2312" "\0"
|
|
||||||
"CP51949" "\0" "EUC-KR" "\0"
|
|
||||||
"CP51950" "\0" "EUC-TW" "\0"
|
|
||||||
"CP54936" "\0" "GB18030" "\0"
|
|
||||||
"CP65001" "\0" "UTF-8" "\0";
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
charset_aliases = cp;
|
|
||||||
}
|
|
||||||
|
|
||||||
return cp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Determine the current locale's character encoding, and canonicalize it
|
|
||||||
into one of the canonical names listed in config.charset.
|
|
||||||
The result must not be freed; it is statically allocated.
|
|
||||||
If the canonical name cannot be determined, the result is a non-canonical
|
|
||||||
name. */
|
|
||||||
|
|
||||||
#ifdef STATIC
|
|
||||||
STATIC
|
|
||||||
#endif
|
|
||||||
const char *
|
|
||||||
locale_charset (void)
|
|
||||||
{
|
|
||||||
const char *codeset;
|
|
||||||
const char *aliases;
|
|
||||||
|
|
||||||
#if !(defined WIN32_NATIVE || defined OS2)
|
|
||||||
|
|
||||||
# if HAVE_LANGINFO_CODESET
|
|
||||||
|
|
||||||
/* Most systems support nl_langinfo (CODESET) nowadays. */
|
|
||||||
codeset = nl_langinfo (CODESET);
|
|
||||||
|
|
||||||
# ifdef __CYGWIN__
|
|
||||||
/* Cygwin 2006 does not have locales. nl_langinfo (CODESET) always
|
|
||||||
returns "US-ASCII". As long as this is not fixed, return the suffix
|
|
||||||
of the locale name from the environment variables (if present) or
|
|
||||||
the codepage as a number. */
|
|
||||||
if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
|
|
||||||
{
|
|
||||||
const char *locale;
|
|
||||||
static char buf[2 + 10 + 1];
|
|
||||||
|
|
||||||
locale = getenv ("LC_ALL");
|
|
||||||
if (locale == NULL || locale[0] == '\0')
|
|
||||||
{
|
|
||||||
locale = getenv ("LC_CTYPE");
|
|
||||||
if (locale == NULL || locale[0] == '\0')
|
|
||||||
locale = getenv ("LANG");
|
|
||||||
}
|
|
||||||
if (locale != NULL && locale[0] != '\0')
|
|
||||||
{
|
|
||||||
/* If the locale name contains an encoding after the dot, return
|
|
||||||
it. */
|
|
||||||
const char *dot = strchr (locale, '.');
|
|
||||||
|
|
||||||
if (dot != NULL)
|
|
||||||
{
|
|
||||||
const char *modifier;
|
|
||||||
|
|
||||||
dot++;
|
|
||||||
/* Look for the possible @... trailer and remove it, if any. */
|
|
||||||
modifier = strchr (dot, '@');
|
|
||||||
if (modifier == NULL)
|
|
||||||
return dot;
|
|
||||||
if (modifier - dot < sizeof (buf))
|
|
||||||
{
|
|
||||||
memcpy (buf, dot, modifier - dot);
|
|
||||||
buf [modifier - dot] = '\0';
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Woe32 has a function returning the locale's codepage as a number. */
|
|
||||||
sprintf (buf, "CP%u", GetACP ());
|
|
||||||
codeset = buf;
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# else
|
|
||||||
|
|
||||||
/* On old systems which lack it, use setlocale or getenv. */
|
|
||||||
const char *locale = NULL;
|
|
||||||
|
|
||||||
/* But most old systems don't have a complete set of locales. Some
|
|
||||||
(like SunOS 4 or DJGPP) have only the C locale. Therefore we don't
|
|
||||||
use setlocale here; it would return "C" when it doesn't support the
|
|
||||||
locale name the user has set. */
|
|
||||||
# if 0
|
|
||||||
locale = setlocale (LC_CTYPE, NULL);
|
|
||||||
# endif
|
|
||||||
if (locale == NULL || locale[0] == '\0')
|
|
||||||
{
|
|
||||||
locale = getenv ("LC_ALL");
|
|
||||||
if (locale == NULL || locale[0] == '\0')
|
|
||||||
{
|
|
||||||
locale = getenv ("LC_CTYPE");
|
|
||||||
if (locale == NULL || locale[0] == '\0')
|
|
||||||
locale = getenv ("LANG");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* On some old systems, one used to set locale = "iso8859_1". On others,
|
|
||||||
you set it to "language_COUNTRY.charset". In any case, we resolve it
|
|
||||||
through the charset.alias file. */
|
|
||||||
codeset = locale;
|
|
||||||
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#elif defined WIN32_NATIVE
|
|
||||||
|
|
||||||
static char buf[2 + 10 + 1];
|
|
||||||
|
|
||||||
/* Woe32 has a function returning the locale's codepage as a number. */
|
|
||||||
sprintf (buf, "CP%u", GetACP ());
|
|
||||||
codeset = buf;
|
|
||||||
|
|
||||||
#elif defined OS2
|
|
||||||
|
|
||||||
const char *locale;
|
|
||||||
static char buf[2 + 10 + 1];
|
|
||||||
ULONG cp[3];
|
|
||||||
ULONG cplen;
|
|
||||||
|
|
||||||
/* Allow user to override the codeset, as set in the operating system,
|
|
||||||
with standard language environment variables. */
|
|
||||||
locale = getenv ("LC_ALL");
|
|
||||||
if (locale == NULL || locale[0] == '\0')
|
|
||||||
{
|
|
||||||
locale = getenv ("LC_CTYPE");
|
|
||||||
if (locale == NULL || locale[0] == '\0')
|
|
||||||
locale = getenv ("LANG");
|
|
||||||
}
|
|
||||||
if (locale != NULL && locale[0] != '\0')
|
|
||||||
{
|
|
||||||
/* If the locale name contains an encoding after the dot, return it. */
|
|
||||||
const char *dot = strchr (locale, '.');
|
|
||||||
|
|
||||||
if (dot != NULL)
|
|
||||||
{
|
|
||||||
const char *modifier;
|
|
||||||
|
|
||||||
dot++;
|
|
||||||
/* Look for the possible @... trailer and remove it, if any. */
|
|
||||||
modifier = strchr (dot, '@');
|
|
||||||
if (modifier == NULL)
|
|
||||||
return dot;
|
|
||||||
if (modifier - dot < sizeof (buf))
|
|
||||||
{
|
|
||||||
memcpy (buf, dot, modifier - dot);
|
|
||||||
buf [modifier - dot] = '\0';
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Resolve through the charset.alias file. */
|
|
||||||
codeset = locale;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* OS/2 has a function returning the locale's codepage as a number. */
|
|
||||||
if (DosQueryCp (sizeof (cp), cp, &cplen))
|
|
||||||
codeset = "";
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf (buf, "CP%u", cp[0]);
|
|
||||||
codeset = buf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (codeset == NULL)
|
|
||||||
/* The canonical name cannot be determined. */
|
|
||||||
codeset = "";
|
|
||||||
|
|
||||||
/* Resolve alias. */
|
|
||||||
for (aliases = get_charset_aliases ();
|
|
||||||
*aliases != '\0';
|
|
||||||
aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
|
|
||||||
if (strcmp (codeset, aliases) == 0
|
|
||||||
|| (aliases[0] == '*' && aliases[1] == '\0'))
|
|
||||||
{
|
|
||||||
codeset = aliases + strlen (aliases) + 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Don't return an empty string. GNU libc and GNU libiconv interpret
|
|
||||||
the empty string as denoting "the locale's character encoding",
|
|
||||||
thus GNU libiconv would call this function a second time. */
|
|
||||||
if (codeset[0] == '\0')
|
|
||||||
codeset = "ASCII";
|
|
||||||
|
|
||||||
return codeset;
|
|
||||||
}
|
|
|
@ -1,493 +0,0 @@
|
||||||
/* Provide relocatable packages.
|
|
||||||
Copyright (C) 2003-2006, 2008 Free Software Foundation, Inc.
|
|
||||||
Written by Bruno Haible <bruno@clisp.org>, 2003.
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU Library General Public License as published
|
|
||||||
by the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|
||||||
USA. */
|
|
||||||
|
|
||||||
|
|
||||||
/* Tell glibc's <stdio.h> to provide a prototype for getline().
|
|
||||||
This must come before <config.h> because <config.h> may include
|
|
||||||
<features.h>, and once <features.h> has been included, it's too late. */
|
|
||||||
#ifndef _GNU_SOURCE
|
|
||||||
# define _GNU_SOURCE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//#include <sconfig.h>
|
|
||||||
|
|
||||||
/* Specification. */
|
|
||||||
#include "relocatable.h"
|
|
||||||
|
|
||||||
#if ENABLE_RELOCATABLE
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#ifdef NO_XMALLOC
|
|
||||||
# define xmalloc malloc
|
|
||||||
#else
|
|
||||||
# include "xalloc.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__
|
|
||||||
# define WIN32_LEAN_AND_MEAN
|
|
||||||
# include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if DEPENDS_ON_LIBCHARSET
|
|
||||||
# include <libcharset.h>
|
|
||||||
#endif
|
|
||||||
#if DEPENDS_ON_LIBICONV && HAVE_ICONV
|
|
||||||
# include <iconv.h>
|
|
||||||
#endif
|
|
||||||
#if DEPENDS_ON_LIBINTL && ENABLE_NLS
|
|
||||||
# include <libintl.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Faked cheap 'bool'. */
|
|
||||||
#undef bool
|
|
||||||
#undef false
|
|
||||||
#undef true
|
|
||||||
#define bool int
|
|
||||||
#define false 0
|
|
||||||
#define true 1
|
|
||||||
|
|
||||||
/* Pathname support.
|
|
||||||
ISSLASH(C) tests whether C is a directory separator character.
|
|
||||||
IS_PATH_WITH_DIR(P) tests whether P contains a directory specification.
|
|
||||||
*/
|
|
||||||
#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
|
|
||||||
/* Win32, Cygwin, OS/2, DOS */
|
|
||||||
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
|
|
||||||
# define HAS_DEVICE(P) \
|
|
||||||
((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
|
|
||||||
&& (P)[1] == ':')
|
|
||||||
# define IS_PATH_WITH_DIR(P) \
|
|
||||||
(strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
|
|
||||||
# define FILE_SYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0)
|
|
||||||
#else
|
|
||||||
/* Unix */
|
|
||||||
# define ISSLASH(C) ((C) == '/')
|
|
||||||
# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
|
|
||||||
# define FILE_SYSTEM_PREFIX_LEN(P) 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Original installation prefix. */
|
|
||||||
static char *orig_prefix;
|
|
||||||
static size_t orig_prefix_len;
|
|
||||||
/* Current installation prefix. */
|
|
||||||
static char *curr_prefix;
|
|
||||||
static size_t curr_prefix_len;
|
|
||||||
/* These prefixes do not end in a slash. Anything that will be concatenated
|
|
||||||
to them must start with a slash. */
|
|
||||||
|
|
||||||
/* Sets the original and the current installation prefix of this module.
|
|
||||||
Relocation simply replaces a pathname starting with the original prefix
|
|
||||||
by the corresponding pathname with the current prefix instead. Both
|
|
||||||
prefixes should be directory names without trailing slash (i.e. use ""
|
|
||||||
instead of "/"). */
|
|
||||||
static void
|
|
||||||
set_this_relocation_prefix (const char *orig_prefix_arg,
|
|
||||||
const char *curr_prefix_arg)
|
|
||||||
{
|
|
||||||
if (orig_prefix_arg != NULL && curr_prefix_arg != NULL
|
|
||||||
/* Optimization: if orig_prefix and curr_prefix are equal, the
|
|
||||||
relocation is a nop. */
|
|
||||||
&& strcmp (orig_prefix_arg, curr_prefix_arg) != 0)
|
|
||||||
{
|
|
||||||
/* Duplicate the argument strings. */
|
|
||||||
char *memory;
|
|
||||||
|
|
||||||
orig_prefix_len = strlen (orig_prefix_arg);
|
|
||||||
curr_prefix_len = strlen (curr_prefix_arg);
|
|
||||||
memory = (char *) xmalloc (orig_prefix_len + 1 + curr_prefix_len + 1);
|
|
||||||
#ifdef NO_XMALLOC
|
|
||||||
if (memory != NULL)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
memcpy (memory, orig_prefix_arg, orig_prefix_len + 1);
|
|
||||||
orig_prefix = memory;
|
|
||||||
memory += orig_prefix_len + 1;
|
|
||||||
memcpy (memory, curr_prefix_arg, curr_prefix_len + 1);
|
|
||||||
curr_prefix = memory;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
orig_prefix = NULL;
|
|
||||||
curr_prefix = NULL;
|
|
||||||
/* Don't worry about wasted memory here - this function is usually only
|
|
||||||
called once. */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sets the original and the current installation prefix of the package.
|
|
||||||
Relocation simply replaces a pathname starting with the original prefix
|
|
||||||
by the corresponding pathname with the current prefix instead. Both
|
|
||||||
prefixes should be directory names without trailing slash (i.e. use ""
|
|
||||||
instead of "/"). */
|
|
||||||
void
|
|
||||||
set_relocation_prefix (const char *orig_prefix_arg, const char *curr_prefix_arg)
|
|
||||||
{
|
|
||||||
set_this_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
|
|
||||||
|
|
||||||
/* Now notify all dependent libraries. */
|
|
||||||
#if DEPENDS_ON_LIBCHARSET
|
|
||||||
libcharset_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
|
|
||||||
#endif
|
|
||||||
#if DEPENDS_ON_LIBICONV && HAVE_ICONV && _LIBICONV_VERSION >= 0x0109
|
|
||||||
libiconv_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
|
|
||||||
#endif
|
|
||||||
#if DEPENDS_ON_LIBINTL && ENABLE_NLS && defined libintl_set_relocation_prefix
|
|
||||||
libintl_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR)
|
|
||||||
|
|
||||||
/* Convenience function:
|
|
||||||
Computes the current installation prefix, based on the original
|
|
||||||
installation prefix, the original installation directory of a particular
|
|
||||||
file, and the current pathname of this file.
|
|
||||||
Returns it, freshly allocated. Returns NULL upon failure. */
|
|
||||||
#ifdef IN_LIBRARY
|
|
||||||
#define compute_curr_prefix local_compute_curr_prefix
|
|
||||||
static
|
|
||||||
#endif
|
|
||||||
char *
|
|
||||||
compute_curr_prefix (const char *orig_installprefix,
|
|
||||||
const char *orig_installdir,
|
|
||||||
const char *curr_pathname)
|
|
||||||
{
|
|
||||||
char *curr_installdir;
|
|
||||||
const char *rel_installdir;
|
|
||||||
|
|
||||||
if (curr_pathname == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* Determine the relative installation directory, relative to the prefix.
|
|
||||||
This is simply the difference between orig_installprefix and
|
|
||||||
orig_installdir. */
|
|
||||||
if (strncmp (orig_installprefix, orig_installdir, strlen (orig_installprefix))
|
|
||||||
!= 0)
|
|
||||||
/* Shouldn't happen - nothing should be installed outside $(prefix). */
|
|
||||||
return NULL;
|
|
||||||
rel_installdir = orig_installdir + strlen (orig_installprefix);
|
|
||||||
|
|
||||||
/* Determine the current installation directory. */
|
|
||||||
{
|
|
||||||
const char *p_base = curr_pathname + FILE_SYSTEM_PREFIX_LEN (curr_pathname);
|
|
||||||
const char *p = curr_pathname + strlen (curr_pathname);
|
|
||||||
char *q;
|
|
||||||
|
|
||||||
while (p > p_base)
|
|
||||||
{
|
|
||||||
p--;
|
|
||||||
if (ISSLASH (*p))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
q = (char *) xmalloc (p - curr_pathname + 1);
|
|
||||||
#ifdef NO_XMALLOC
|
|
||||||
if (q == NULL)
|
|
||||||
return NULL;
|
|
||||||
#endif
|
|
||||||
memcpy (q, curr_pathname, p - curr_pathname);
|
|
||||||
q[p - curr_pathname] = '\0';
|
|
||||||
curr_installdir = q;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Compute the current installation prefix by removing the trailing
|
|
||||||
rel_installdir from it. */
|
|
||||||
{
|
|
||||||
const char *rp = rel_installdir + strlen (rel_installdir);
|
|
||||||
const char *cp = curr_installdir + strlen (curr_installdir);
|
|
||||||
const char *cp_base =
|
|
||||||
curr_installdir + FILE_SYSTEM_PREFIX_LEN (curr_installdir);
|
|
||||||
|
|
||||||
while (rp > rel_installdir && cp > cp_base)
|
|
||||||
{
|
|
||||||
bool same = false;
|
|
||||||
const char *rpi = rp;
|
|
||||||
const char *cpi = cp;
|
|
||||||
|
|
||||||
while (rpi > rel_installdir && cpi > cp_base)
|
|
||||||
{
|
|
||||||
rpi--;
|
|
||||||
cpi--;
|
|
||||||
if (ISSLASH (*rpi) || ISSLASH (*cpi))
|
|
||||||
{
|
|
||||||
if (ISSLASH (*rpi) && ISSLASH (*cpi))
|
|
||||||
same = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* Do case-insensitive comparison if the filesystem is always or
|
|
||||||
often case-insensitive. It's better to accept the comparison
|
|
||||||
if the difference is only in case, rather than to fail. */
|
|
||||||
#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
|
|
||||||
/* Win32, Cygwin, OS/2, DOS - case insignificant filesystem */
|
|
||||||
if ((*rpi >= 'a' && *rpi <= 'z' ? *rpi - 'a' + 'A' : *rpi)
|
|
||||||
!= (*cpi >= 'a' && *cpi <= 'z' ? *cpi - 'a' + 'A' : *cpi))
|
|
||||||
break;
|
|
||||||
#else
|
|
||||||
if (*rpi != *cpi)
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
if (!same)
|
|
||||||
break;
|
|
||||||
/* The last pathname component was the same. opi and cpi now point
|
|
||||||
to the slash before it. */
|
|
||||||
rp = rpi;
|
|
||||||
cp = cpi;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rp > rel_installdir)
|
|
||||||
{
|
|
||||||
/* Unexpected: The curr_installdir does not end with rel_installdir. */
|
|
||||||
free (curr_installdir);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
size_t curr_prefix_len = cp - curr_installdir;
|
|
||||||
char *curr_prefix;
|
|
||||||
|
|
||||||
curr_prefix = (char *) xmalloc (curr_prefix_len + 1);
|
|
||||||
#ifdef NO_XMALLOC
|
|
||||||
if (curr_prefix == NULL)
|
|
||||||
{
|
|
||||||
free (curr_installdir);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
memcpy (curr_prefix, curr_installdir, curr_prefix_len);
|
|
||||||
curr_prefix[curr_prefix_len] = '\0';
|
|
||||||
|
|
||||||
free (curr_installdir);
|
|
||||||
|
|
||||||
return curr_prefix;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* !IN_LIBRARY || PIC */
|
|
||||||
|
|
||||||
#if defined PIC && defined INSTALLDIR
|
|
||||||
|
|
||||||
/* Full pathname of shared library, or NULL. */
|
|
||||||
static char *shared_library_fullname;
|
|
||||||
|
|
||||||
#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__
|
|
||||||
|
|
||||||
/* Determine the full pathname of the shared library when it is loaded. */
|
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
DllMain (HINSTANCE module_handle, DWORD event, LPVOID reserved)
|
|
||||||
{
|
|
||||||
(void) reserved;
|
|
||||||
|
|
||||||
if (event == DLL_PROCESS_ATTACH)
|
|
||||||
{
|
|
||||||
/* The DLL is being loaded into an application's address range. */
|
|
||||||
static char location[MAX_PATH];
|
|
||||||
|
|
||||||
if (!GetModuleFileName (module_handle, location, sizeof (location)))
|
|
||||||
/* Shouldn't happen. */
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (!IS_PATH_WITH_DIR (location))
|
|
||||||
/* Shouldn't happen. */
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
{
|
|
||||||
#if defined __CYGWIN__
|
|
||||||
/* On Cygwin, we need to convert paths coming from Win32 system calls
|
|
||||||
to the Unix-like slashified notation. */
|
|
||||||
static char location_as_posix_path[2 * MAX_PATH];
|
|
||||||
/* There's no error return defined for cygwin_conv_to_posix_path.
|
|
||||||
See cygwin-api/func-cygwin-conv-to-posix-path.html.
|
|
||||||
Does it overflow the buffer of expected size MAX_PATH or does it
|
|
||||||
truncate the path? I don't know. Let's catch both. */
|
|
||||||
cygwin_conv_to_posix_path (location, location_as_posix_path);
|
|
||||||
location_as_posix_path[MAX_PATH - 1] = '\0';
|
|
||||||
if (strlen (location_as_posix_path) >= MAX_PATH - 1)
|
|
||||||
/* A sign of buffer overflow or path truncation. */
|
|
||||||
return FALSE;
|
|
||||||
shared_library_fullname = strdup (location_as_posix_path);
|
|
||||||
#else
|
|
||||||
shared_library_fullname = strdup (location);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* Unix except Cygwin */
|
|
||||||
|
|
||||||
static void
|
|
||||||
find_shared_library_fullname ()
|
|
||||||
{
|
|
||||||
#if defined __linux__ && __GLIBC__ >= 2
|
|
||||||
/* Linux has /proc/self/maps. glibc 2 has the getline() function. */
|
|
||||||
FILE *fp;
|
|
||||||
|
|
||||||
/* Open the current process' maps file. It describes one VMA per line. */
|
|
||||||
fp = fopen ("/proc/self/maps", "r");
|
|
||||||
if (fp)
|
|
||||||
{
|
|
||||||
unsigned long address = (unsigned long) &find_shared_library_fullname;
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
unsigned long start, end;
|
|
||||||
int c;
|
|
||||||
|
|
||||||
if (fscanf (fp, "%lx-%lx", &start, &end) != 2)
|
|
||||||
break;
|
|
||||||
if (address >= start && address <= end - 1)
|
|
||||||
{
|
|
||||||
/* Found it. Now see if this line contains a filename. */
|
|
||||||
while (c = getc (fp), c != EOF && c != '\n' && c != '/')
|
|
||||||
continue;
|
|
||||||
if (c == '/')
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
int len;
|
|
||||||
|
|
||||||
ungetc (c, fp);
|
|
||||||
shared_library_fullname = NULL; size = 0;
|
|
||||||
len = getline (&shared_library_fullname, &size, fp);
|
|
||||||
if (len >= 0)
|
|
||||||
{
|
|
||||||
/* Success: filled shared_library_fullname. */
|
|
||||||
if (len > 0 && shared_library_fullname[len - 1] == '\n')
|
|
||||||
shared_library_fullname[len - 1] = '\0';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
while (c = getc (fp), c != EOF && c != '\n')
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
fclose (fp);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* (WIN32 or Cygwin) / (Unix except Cygwin) */
|
|
||||||
|
|
||||||
/* Return the full pathname of the current shared library.
|
|
||||||
Return NULL if unknown.
|
|
||||||
Guaranteed to work only on Linux, Cygwin and Woe32. */
|
|
||||||
static char *
|
|
||||||
get_shared_library_fullname ()
|
|
||||||
{
|
|
||||||
#if !(defined _WIN32 || defined __WIN32__ || defined __CYGWIN__)
|
|
||||||
static bool tried_find_shared_library_fullname;
|
|
||||||
if (!tried_find_shared_library_fullname)
|
|
||||||
{
|
|
||||||
find_shared_library_fullname ();
|
|
||||||
tried_find_shared_library_fullname = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return shared_library_fullname;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* PIC */
|
|
||||||
|
|
||||||
/* Returns the pathname, relocated according to the current installation
|
|
||||||
directory.
|
|
||||||
The returned string is either PATHNAME unmodified or a freshly allocated
|
|
||||||
string that you can free with free() after casting it to 'char *'. */
|
|
||||||
const char *
|
|
||||||
relocate (const char *pathname)
|
|
||||||
{
|
|
||||||
#if defined PIC && defined INSTALLDIR
|
|
||||||
static int initialized;
|
|
||||||
|
|
||||||
/* Initialization code for a shared library. */
|
|
||||||
if (!initialized)
|
|
||||||
{
|
|
||||||
/* At this point, orig_prefix and curr_prefix likely have already been
|
|
||||||
set through the main program's set_program_name_and_installdir
|
|
||||||
function. This is sufficient in the case that the library has
|
|
||||||
initially been installed in the same orig_prefix. But we can do
|
|
||||||
better, to also cover the cases that 1. it has been installed
|
|
||||||
in a different prefix before being moved to orig_prefix and (later)
|
|
||||||
to curr_prefix, 2. unlike the program, it has not moved away from
|
|
||||||
orig_prefix. */
|
|
||||||
const char *orig_installprefix = INSTALLPREFIX;
|
|
||||||
const char *orig_installdir = INSTALLDIR;
|
|
||||||
char *curr_prefix_better;
|
|
||||||
|
|
||||||
curr_prefix_better =
|
|
||||||
compute_curr_prefix (orig_installprefix, orig_installdir,
|
|
||||||
get_shared_library_fullname ());
|
|
||||||
|
|
||||||
set_relocation_prefix (orig_installprefix,
|
|
||||||
curr_prefix_better != NULL
|
|
||||||
? curr_prefix_better
|
|
||||||
: curr_prefix);
|
|
||||||
|
|
||||||
if (curr_prefix_better != NULL)
|
|
||||||
free (curr_prefix_better);
|
|
||||||
|
|
||||||
initialized = 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Note: It is not necessary to perform case insensitive comparison here,
|
|
||||||
even for DOS-like filesystems, because the pathname argument was
|
|
||||||
typically created from the same Makefile variable as orig_prefix came
|
|
||||||
from. */
|
|
||||||
if (orig_prefix != NULL && curr_prefix != NULL
|
|
||||||
&& strncmp (pathname, orig_prefix, orig_prefix_len) == 0)
|
|
||||||
{
|
|
||||||
if (pathname[orig_prefix_len] == '\0')
|
|
||||||
{
|
|
||||||
/* pathname equals orig_prefix. */
|
|
||||||
char *result = (char *) xmalloc (strlen (curr_prefix) + 1);
|
|
||||||
|
|
||||||
#ifdef NO_XMALLOC
|
|
||||||
if (result != NULL)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
strcpy (result, curr_prefix);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (ISSLASH (pathname[orig_prefix_len]))
|
|
||||||
{
|
|
||||||
/* pathname starts with orig_prefix. */
|
|
||||||
const char *pathname_tail = &pathname[orig_prefix_len];
|
|
||||||
char *result =
|
|
||||||
(char *) xmalloc (curr_prefix_len + strlen (pathname_tail) + 1);
|
|
||||||
|
|
||||||
#ifdef NO_XMALLOC
|
|
||||||
if (result != NULL)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
memcpy (result, curr_prefix, curr_prefix_len);
|
|
||||||
strcpy (result + curr_prefix_len, pathname_tail);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Nothing to relocate. */
|
|
||||||
return pathname;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,83 +0,0 @@
|
||||||
/* Provide relocatable packages.
|
|
||||||
Copyright (C) 2003, 2005, 2008 Free Software Foundation, Inc.
|
|
||||||
Written by Bruno Haible <bruno@clisp.org>, 2003.
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU Library General Public License as published
|
|
||||||
by the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|
||||||
USA. */
|
|
||||||
|
|
||||||
#ifndef _RELOCATABLE_H
|
|
||||||
#define _RELOCATABLE_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* This can be enabled through the configure --enable-relocatable option. */
|
|
||||||
#if ENABLE_RELOCATABLE
|
|
||||||
|
|
||||||
/* When building a DLL, we must export some functions. Note that because
|
|
||||||
this is a private .h file, we don't need to use __declspec(dllimport)
|
|
||||||
in any case. */
|
|
||||||
#if HAVE_VISIBILITY && BUILDING_DLL
|
|
||||||
# define RELOCATABLE_DLL_EXPORTED __attribute__((__visibility__("default")))
|
|
||||||
#elif defined _MSC_VER && BUILDING_DLL
|
|
||||||
# define RELOCATABLE_DLL_EXPORTED __declspec(dllexport)
|
|
||||||
#else
|
|
||||||
# define RELOCATABLE_DLL_EXPORTED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Sets the original and the current installation prefix of the package.
|
|
||||||
Relocation simply replaces a pathname starting with the original prefix
|
|
||||||
by the corresponding pathname with the current prefix instead. Both
|
|
||||||
prefixes should be directory names without trailing slash (i.e. use ""
|
|
||||||
instead of "/"). */
|
|
||||||
extern RELOCATABLE_DLL_EXPORTED void
|
|
||||||
set_relocation_prefix (const char *orig_prefix,
|
|
||||||
const char *curr_prefix);
|
|
||||||
|
|
||||||
/* Returns the pathname, relocated according to the current installation
|
|
||||||
directory.
|
|
||||||
The returned string is either PATHNAME unmodified or a freshly allocated
|
|
||||||
string that you can free with free() after casting it to 'char *'. */
|
|
||||||
extern const char * relocate (const char *pathname);
|
|
||||||
|
|
||||||
/* Memory management: relocate() potentially allocates memory, because it has
|
|
||||||
to construct a fresh pathname. If this is a problem because your program
|
|
||||||
calls relocate() frequently, think about caching the result. Or free the
|
|
||||||
return value if it was different from the argument pathname. */
|
|
||||||
|
|
||||||
/* Convenience function:
|
|
||||||
Computes the current installation prefix, based on the original
|
|
||||||
installation prefix, the original installation directory of a particular
|
|
||||||
file, and the current pathname of this file.
|
|
||||||
Returns it, freshly allocated. Returns NULL upon failure. */
|
|
||||||
extern char * compute_curr_prefix (const char *orig_installprefix,
|
|
||||||
const char *orig_installdir,
|
|
||||||
const char *curr_pathname);
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* By default, we use the hardwired pathnames. */
|
|
||||||
#define relocate(pathname) (pathname)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _RELOCATABLE_H */
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,40 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 1999-2003, 2008 Free Software Foundation, Inc.
|
|
||||||
* This file is part of the GNU LIBICONV Library.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV Library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Library General Public
|
|
||||||
* License as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV 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
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
|
||||||
* If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
|
|
||||||
* Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef USE_AIX
|
|
||||||
# if defined _AIX
|
|
||||||
# include "aliases_aix_sysaix.h"
|
|
||||||
# else
|
|
||||||
# include "aliases_aix.h"
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#ifdef USE_OSF1
|
|
||||||
# if defined __osf__
|
|
||||||
# include "aliases_osf1_sysosf1.h"
|
|
||||||
# else
|
|
||||||
# include "aliases_osf1.h"
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#ifdef USE_DOS
|
|
||||||
# include "aliases_dos.h"
|
|
||||||
#endif
|
|
||||||
#ifdef USE_EXTRA
|
|
||||||
# include "aliases_extra.h"
|
|
||||||
#endif
|
|
|
@ -1,18 +0,0 @@
|
||||||
S(aix_0, "CP856", ei_cp856 )
|
|
||||||
S(aix_1, "CP922", ei_cp922 )
|
|
||||||
S(aix_2, "CP943", ei_cp943 )
|
|
||||||
S(aix_3, "CP1046", ei_cp1046 )
|
|
||||||
S(aix_4, "CP1124", ei_cp1124 )
|
|
||||||
S(aix_5, "CP1129", ei_cp1129 )
|
|
||||||
S(aix_6, "CP1161", ei_cp1161 )
|
|
||||||
S(aix_7, "IBM1161", ei_cp1161 )
|
|
||||||
S(aix_8, "IBM-1161", ei_cp1161 )
|
|
||||||
S(aix_9, "CSIBM1161", ei_cp1161 )
|
|
||||||
S(aix_10, "CP1162", ei_cp1162 )
|
|
||||||
S(aix_11, "IBM1162", ei_cp1162 )
|
|
||||||
S(aix_12, "IBM-1162", ei_cp1162 )
|
|
||||||
S(aix_13, "CSIBM1162", ei_cp1162 )
|
|
||||||
S(aix_14, "CP1163", ei_cp1163 )
|
|
||||||
S(aix_15, "IBM1163", ei_cp1163 )
|
|
||||||
S(aix_16, "IBM-1163", ei_cp1163 )
|
|
||||||
S(aix_17, "CSIBM1163", ei_cp1163 )
|
|
|
@ -1,24 +0,0 @@
|
||||||
S(aix_0, "CP856", ei_cp856 )
|
|
||||||
S(aix_1, "IBM-856", ei_cp856 )
|
|
||||||
S(aix_2, "CP922", ei_cp922 )
|
|
||||||
S(aix_3, "IBM-922", ei_cp922 )
|
|
||||||
S(aix_4, "CP943", ei_cp943 )
|
|
||||||
S(aix_5, "IBM-943", ei_cp943 )
|
|
||||||
S(aix_6, "CP1046", ei_cp1046 )
|
|
||||||
S(aix_7, "IBM-1046", ei_cp1046 )
|
|
||||||
S(aix_8, "CP1124", ei_cp1124 )
|
|
||||||
S(aix_9, "IBM-1124", ei_cp1124 )
|
|
||||||
S(aix_10, "CP1129", ei_cp1129 )
|
|
||||||
S(aix_11, "IBM-1129", ei_cp1129 )
|
|
||||||
S(aix_12, "CP1161", ei_cp1161 )
|
|
||||||
S(aix_13, "IBM1161", ei_cp1161 )
|
|
||||||
S(aix_14, "IBM-1161", ei_cp1161 )
|
|
||||||
S(aix_15, "CSIBM1161", ei_cp1161 )
|
|
||||||
S(aix_16, "CP1162", ei_cp1162 )
|
|
||||||
S(aix_17, "IBM1162", ei_cp1162 )
|
|
||||||
S(aix_18, "IBM-1162", ei_cp1162 )
|
|
||||||
S(aix_19, "CSIBM1162", ei_cp1162 )
|
|
||||||
S(aix_20, "CP1163", ei_cp1163 )
|
|
||||||
S(aix_21, "IBM1163", ei_cp1163 )
|
|
||||||
S(aix_22, "IBM-1163", ei_cp1163 )
|
|
||||||
S(aix_23, "CSIBM1163", ei_cp1163 )
|
|
|
@ -1,48 +0,0 @@
|
||||||
S(dos_0, "CP437", ei_cp437 )
|
|
||||||
S(dos_1, "IBM437", ei_cp437 )
|
|
||||||
S(dos_2, "437", ei_cp437 )
|
|
||||||
S(dos_3, "CSPC8CODEPAGE437", ei_cp437 )
|
|
||||||
S(dos_4, "CP737", ei_cp737 )
|
|
||||||
S(dos_5, "CP775", ei_cp775 )
|
|
||||||
S(dos_6, "IBM775", ei_cp775 )
|
|
||||||
S(dos_7, "CSPC775BALTIC", ei_cp775 )
|
|
||||||
S(dos_8, "CP852", ei_cp852 )
|
|
||||||
S(dos_9, "IBM852", ei_cp852 )
|
|
||||||
S(dos_10, "852", ei_cp852 )
|
|
||||||
S(dos_11, "CSPCP852", ei_cp852 )
|
|
||||||
S(dos_12, "CP853", ei_cp853 )
|
|
||||||
S(dos_13, "CP855", ei_cp855 )
|
|
||||||
S(dos_14, "IBM855", ei_cp855 )
|
|
||||||
S(dos_15, "855", ei_cp855 )
|
|
||||||
S(dos_16, "CSIBM855", ei_cp855 )
|
|
||||||
S(dos_17, "CP857", ei_cp857 )
|
|
||||||
S(dos_18, "IBM857", ei_cp857 )
|
|
||||||
S(dos_19, "857", ei_cp857 )
|
|
||||||
S(dos_20, "CSIBM857", ei_cp857 )
|
|
||||||
S(dos_21, "CP858", ei_cp858 )
|
|
||||||
S(dos_22, "CP860", ei_cp860 )
|
|
||||||
S(dos_23, "IBM860", ei_cp860 )
|
|
||||||
S(dos_24, "860", ei_cp860 )
|
|
||||||
S(dos_25, "CSIBM860", ei_cp860 )
|
|
||||||
S(dos_26, "CP861", ei_cp861 )
|
|
||||||
S(dos_27, "IBM861", ei_cp861 )
|
|
||||||
S(dos_28, "861", ei_cp861 )
|
|
||||||
S(dos_29, "CP-IS", ei_cp861 )
|
|
||||||
S(dos_30, "CSIBM861", ei_cp861 )
|
|
||||||
S(dos_31, "CP863", ei_cp863 )
|
|
||||||
S(dos_32, "IBM863", ei_cp863 )
|
|
||||||
S(dos_33, "863", ei_cp863 )
|
|
||||||
S(dos_34, "CSIBM863", ei_cp863 )
|
|
||||||
S(dos_35, "CP864", ei_cp864 )
|
|
||||||
S(dos_36, "IBM864", ei_cp864 )
|
|
||||||
S(dos_37, "CSIBM864", ei_cp864 )
|
|
||||||
S(dos_38, "CP865", ei_cp865 )
|
|
||||||
S(dos_39, "IBM865", ei_cp865 )
|
|
||||||
S(dos_40, "865", ei_cp865 )
|
|
||||||
S(dos_41, "CSIBM865", ei_cp865 )
|
|
||||||
S(dos_42, "CP869", ei_cp869 )
|
|
||||||
S(dos_43, "IBM869", ei_cp869 )
|
|
||||||
S(dos_44, "869", ei_cp869 )
|
|
||||||
S(dos_45, "CP-GR", ei_cp869 )
|
|
||||||
S(dos_46, "CSIBM869", ei_cp869 )
|
|
||||||
S(dos_47, "CP1125", ei_cp1125 )
|
|
|
@ -1,12 +0,0 @@
|
||||||
S(extra_0, "EUC-JISX0213", ei_euc_jisx0213 )
|
|
||||||
S(extra_1, "EUC-JIS-2004", ei_euc_jisx0213 )
|
|
||||||
S(extra_2, "SHIFT_JISX0213", ei_shift_jisx0213 )
|
|
||||||
S(extra_3, "SHIFT_JIS-2004", ei_shift_jisx0213 )
|
|
||||||
S(extra_4, "ISO-2022-JP-3", ei_iso2022_jp3 )
|
|
||||||
S(extra_5, "ISO-2022-JP-2004", ei_iso2022_jp3 )
|
|
||||||
S(extra_6, "BIG5-2003", ei_big5_2003 )
|
|
||||||
S(extra_7, "TDS565", ei_tds565 )
|
|
||||||
S(extra_8, "ISO-IR-230", ei_tds565 )
|
|
||||||
S(extra_9, "ATARIST", ei_atarist )
|
|
||||||
S(extra_10, "ATARI", ei_atarist )
|
|
||||||
S(extra_11, "RISCOS-LATIN1", ei_riscos1 )
|
|
|
@ -1,2 +0,0 @@
|
||||||
S(osf1_0, "DEC-KANJI", ei_dec_kanji )
|
|
||||||
S(osf1_1, "DEC-HANYU", ei_dec_hanyu )
|
|
|
@ -1,4 +0,0 @@
|
||||||
S(osf1_0, "DEC-KANJI", ei_dec_kanji )
|
|
||||||
S(osf1_1, "DECKANJI", ei_dec_kanji )
|
|
||||||
S(osf1_2, "DEC-HANYU", ei_dec_hanyu )
|
|
||||||
S(osf1_3, "DECHANYU", ei_dec_hanyu )
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,116 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 1999-2002 Free Software Foundation, Inc.
|
|
||||||
* This file is part of the GNU LIBICONV Library.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV Library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Library General Public
|
|
||||||
* License as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV 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
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
|
||||||
* If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
|
|
||||||
* Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ARMSCII-8
|
|
||||||
*/
|
|
||||||
|
|
||||||
static const unsigned short armscii_8_2uni[96] = {
|
|
||||||
/* 0xa0 */
|
|
||||||
0x00a0, 0xfffd, 0x0587, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab,
|
|
||||||
0x2014, 0x002e, 0x055d, 0x002c, 0x002d, 0x058a, 0x2026, 0x055c,
|
|
||||||
/* 0xb0 */
|
|
||||||
0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563,
|
|
||||||
0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567,
|
|
||||||
/* 0xc0 */
|
|
||||||
0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b,
|
|
||||||
0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f,
|
|
||||||
/* 0xd0 */
|
|
||||||
0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573,
|
|
||||||
0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577,
|
|
||||||
/* 0xe0 */
|
|
||||||
0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b,
|
|
||||||
0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f,
|
|
||||||
/* 0xf0 */
|
|
||||||
0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583,
|
|
||||||
0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x055a, 0xfffd,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
|
||||||
armscii_8_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
|
|
||||||
{
|
|
||||||
unsigned char c = *s;
|
|
||||||
if (c < 0xa0) {
|
|
||||||
*pwc = (ucs4_t) c;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
unsigned short wc = armscii_8_2uni[c-0xa0];
|
|
||||||
if (wc != 0xfffd) {
|
|
||||||
*pwc = (ucs4_t) wc;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return RET_ILSEQ;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const unsigned char armscii_8_page00[8] = {
|
|
||||||
0xa5, 0xa4, 0x2a, 0x2b, 0xab, 0xac, 0xa9, 0x2f, /* 0x28-0x2f */
|
|
||||||
};
|
|
||||||
static const unsigned char armscii_8_page00_1[32] = {
|
|
||||||
0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
|
|
||||||
0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */
|
|
||||||
0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
|
|
||||||
};
|
|
||||||
static const unsigned char armscii_8_page05[96] = {
|
|
||||||
0x00, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, /* 0x30-0x37 */
|
|
||||||
0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce, /* 0x38-0x3f */
|
|
||||||
0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, /* 0x40-0x47 */
|
|
||||||
0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, /* 0x48-0x4f */
|
|
||||||
0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0x00, /* 0x50-0x57 */
|
|
||||||
0x00, 0x00, 0xfe, 0xb0, 0xaf, 0xaa, 0xb1, 0x00, /* 0x58-0x5f */
|
|
||||||
0x00, 0xb3, 0xb5, 0xb7, 0xb9, 0xbb, 0xbd, 0xbf, /* 0x60-0x67 */
|
|
||||||
0xc1, 0xc3, 0xc5, 0xc7, 0xc9, 0xcb, 0xcd, 0xcf, /* 0x68-0x6f */
|
|
||||||
0xd1, 0xd3, 0xd5, 0xd7, 0xd9, 0xdb, 0xdd, 0xdf, /* 0x70-0x77 */
|
|
||||||
0xe1, 0xe3, 0xe5, 0xe7, 0xe9, 0xeb, 0xed, 0xef, /* 0x78-0x7f */
|
|
||||||
0xf1, 0xf3, 0xf5, 0xf7, 0xf9, 0xfb, 0xfd, 0xa2, /* 0x80-0x87 */
|
|
||||||
0x00, 0xa3, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
|
|
||||||
};
|
|
||||||
static const unsigned char armscii_8_page20[24] = {
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, /* 0x10-0x17 */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0x00, /* 0x20-0x27 */
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
|
||||||
armscii_8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
|
|
||||||
{
|
|
||||||
unsigned char c = 0;
|
|
||||||
if (wc < 0x0028) {
|
|
||||||
*r = wc;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (wc >= 0x0028 && wc < 0x0030)
|
|
||||||
c = armscii_8_page00[wc-0x0028];
|
|
||||||
else if (wc >= 0x0030 && wc < 0x00a0)
|
|
||||||
c = wc;
|
|
||||||
else if (wc >= 0x00a0 && wc < 0x00c0)
|
|
||||||
c = armscii_8_page00_1[wc-0x00a0];
|
|
||||||
else if (wc >= 0x0530 && wc < 0x0590)
|
|
||||||
c = armscii_8_page05[wc-0x0530];
|
|
||||||
else if (wc >= 0x2010 && wc < 0x2028)
|
|
||||||
c = armscii_8_page20[wc-0x2010];
|
|
||||||
if (c != 0) {
|
|
||||||
*r = c;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return RET_ILUNI;
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 1999-2001 Free Software Foundation, Inc.
|
|
||||||
* This file is part of the GNU LIBICONV Library.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV Library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Library General Public
|
|
||||||
* License as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV 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
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
|
||||||
* If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
|
|
||||||
* Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ASCII
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int
|
|
||||||
ascii_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
|
|
||||||
{
|
|
||||||
unsigned char c = *s;
|
|
||||||
if (c < 0x80) {
|
|
||||||
*pwc = (ucs4_t) c;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return RET_ILSEQ;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
ascii_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
|
|
||||||
{
|
|
||||||
if (wc < 0x0080) {
|
|
||||||
*r = wc;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return RET_ILUNI;
|
|
||||||
}
|
|
|
@ -1,158 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 1999-2005 Free Software Foundation, Inc.
|
|
||||||
* This file is part of the GNU LIBICONV Library.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV Library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Library General Public
|
|
||||||
* License as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV 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
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
|
||||||
* If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
|
|
||||||
* Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Atari ST
|
|
||||||
*/
|
|
||||||
|
|
||||||
static const unsigned short atarist_2uni[128] = {
|
|
||||||
/* 0x80 */
|
|
||||||
0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0, 0x00e5, 0x00e7,
|
|
||||||
0x00ea, 0x00eb, 0x00e8, 0x00ef, 0x00ee, 0x00ec, 0x00c4, 0x00c5,
|
|
||||||
/* 0x90 */
|
|
||||||
0x00c9, 0x00e6, 0x00c6, 0x00f4, 0x00f6, 0x00f2, 0x00fb, 0x00f9,
|
|
||||||
0x00ff, 0x00d6, 0x00dc, 0x00a2, 0x00a3, 0x00a5, 0x00df, 0x0192,
|
|
||||||
/* 0xa0 */
|
|
||||||
0x00e1, 0x00ed, 0x00f3, 0x00fa, 0x00f1, 0x00d1, 0x00aa, 0x00ba,
|
|
||||||
0x00bf, 0x2310, 0x00ac, 0x00bd, 0x00bc, 0x00a1, 0x00ab, 0x00bb,
|
|
||||||
/* 0xb0 */
|
|
||||||
0x00e3, 0x00f5, 0x00d8, 0x00f8, 0x0153, 0x0152, 0x00c0, 0x00c3,
|
|
||||||
0x00d5, 0x00a8, 0x00b4, 0x2020, 0x00b6, 0x00a9, 0x00ae, 0x2122,
|
|
||||||
/* 0xc0 */
|
|
||||||
0x0133, 0x0132, 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5,
|
|
||||||
0x05d6, 0x05d7, 0x05d8, 0x05d9, 0x05db, 0x05dc, 0x05de, 0x05e0,
|
|
||||||
/* 0xd0 */
|
|
||||||
0x05e1, 0x05e2, 0x05e4, 0x05e6, 0x05e7, 0x05e8, 0x05e9, 0x05ea,
|
|
||||||
0x05df, 0x05da, 0x05dd, 0x05e3, 0x05e5, 0x00a7, 0x2227, 0x221e,
|
|
||||||
/* 0xe0 */
|
|
||||||
0x03b1, 0x03b2, 0x0393, 0x03c0, 0x03a3, 0x03c3, 0x00b5, 0x03c4,
|
|
||||||
0x03a6, 0x0398, 0x03a9, 0x03b4, 0x222e, 0x03c6, 0x2208, 0x2229,
|
|
||||||
/* 0xf0 */
|
|
||||||
0x2261, 0x00b1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00f7, 0x2248,
|
|
||||||
0x00b0, 0x2219, 0x00b7, 0x221a, 0x207f, 0x00b2, 0x00b3, 0x00af,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
|
||||||
atarist_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
|
|
||||||
{
|
|
||||||
unsigned char c = *s;
|
|
||||||
if (c < 0x80)
|
|
||||||
*pwc = (ucs4_t) c;
|
|
||||||
else
|
|
||||||
*pwc = (ucs4_t) atarist_2uni[c-0x80];
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const unsigned char atarist_page00[96] = {
|
|
||||||
0x00, 0xad, 0x9b, 0x9c, 0x00, 0x9d, 0x00, 0xdd, /* 0xa0-0xa7 */
|
|
||||||
0xb9, 0xbd, 0xa6, 0xae, 0xaa, 0x00, 0xbe, 0xff, /* 0xa8-0xaf */
|
|
||||||
0xf8, 0xf1, 0xfd, 0xfe, 0xba, 0xe6, 0xbc, 0xfa, /* 0xb0-0xb7 */
|
|
||||||
0x00, 0x00, 0xa7, 0xaf, 0xac, 0xab, 0x00, 0xa8, /* 0xb8-0xbf */
|
|
||||||
0xb6, 0x00, 0x00, 0xb7, 0x8e, 0x8f, 0x92, 0x80, /* 0xc0-0xc7 */
|
|
||||||
0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
|
|
||||||
0x00, 0xa5, 0x00, 0x00, 0x00, 0xb8, 0x99, 0x00, /* 0xd0-0xd7 */
|
|
||||||
0xb2, 0x00, 0x00, 0x00, 0x9a, 0x00, 0x00, 0x9e, /* 0xd8-0xdf */
|
|
||||||
0x85, 0xa0, 0x83, 0xb0, 0x84, 0x86, 0x91, 0x87, /* 0xe0-0xe7 */
|
|
||||||
0x8a, 0x82, 0x88, 0x89, 0x8d, 0xa1, 0x8c, 0x8b, /* 0xe8-0xef */
|
|
||||||
0x00, 0xa4, 0x95, 0xa2, 0x93, 0xb1, 0x94, 0xf6, /* 0xf0-0xf7 */
|
|
||||||
0xb3, 0x97, 0xa3, 0x96, 0x81, 0x00, 0x00, 0x98, /* 0xf8-0xff */
|
|
||||||
};
|
|
||||||
static const unsigned char atarist_page01[104] = {
|
|
||||||
0x00, 0x00, 0xc1, 0xc0, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */
|
|
||||||
0x00, 0x00, 0xb5, 0xb4, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
|
|
||||||
0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
|
|
||||||
};
|
|
||||||
static const unsigned char atarist_page03[56] = {
|
|
||||||
0x00, 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
|
|
||||||
0xe9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
|
|
||||||
0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0xe8, 0x00, /* 0xa0-0xa7 */
|
|
||||||
0x00, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
|
|
||||||
0x00, 0xe0, 0xe1, 0x00, 0xeb, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
|
|
||||||
0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */
|
|
||||||
};
|
|
||||||
static const unsigned char atarist_page05[32] = {
|
|
||||||
0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, /* 0xd0-0xd7 */
|
|
||||||
0xca, 0xcb, 0xd9, 0xcc, 0xcd, 0xda, 0xce, 0xd8, /* 0xd8-0xdf */
|
|
||||||
0xcf, 0xd0, 0xd1, 0xdb, 0xd2, 0xdc, 0xd3, 0xd4, /* 0xe0-0xe7 */
|
|
||||||
0xd5, 0xd6, 0xd7, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
|
|
||||||
};
|
|
||||||
static const unsigned char atarist_page22[96] = {
|
|
||||||
0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
|
|
||||||
0x00, 0xf9, 0xfb, 0x00, 0x00, 0x00, 0xdf, 0x00, /* 0x18-0x1f */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, /* 0x20-0x27 */
|
|
||||||
0x00, 0xef, 0x00, 0x00, 0x00, 0x00, 0xec, 0x00, /* 0x28-0x2f */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */
|
|
||||||
0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
|
|
||||||
0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */
|
|
||||||
};
|
|
||||||
static const unsigned char atarist_page23[24] = {
|
|
||||||
0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
|
|
||||||
0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
|
||||||
atarist_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
|
|
||||||
{
|
|
||||||
unsigned char c = 0;
|
|
||||||
if (wc < 0x0080) {
|
|
||||||
*r = wc;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (wc >= 0x00a0 && wc < 0x0100)
|
|
||||||
c = atarist_page00[wc-0x00a0];
|
|
||||||
else if (wc >= 0x0130 && wc < 0x0198)
|
|
||||||
c = atarist_page01[wc-0x0130];
|
|
||||||
else if (wc >= 0x0390 && wc < 0x03c8)
|
|
||||||
c = atarist_page03[wc-0x0390];
|
|
||||||
else if (wc >= 0x05d0 && wc < 0x05f0)
|
|
||||||
c = atarist_page05[wc-0x05d0];
|
|
||||||
else if (wc == 0x2020)
|
|
||||||
c = 0xbb;
|
|
||||||
else if (wc == 0x207f)
|
|
||||||
c = 0xfc;
|
|
||||||
else if (wc == 0x2122)
|
|
||||||
c = 0xbf;
|
|
||||||
else if (wc >= 0x2208 && wc < 0x2268)
|
|
||||||
c = atarist_page22[wc-0x2208];
|
|
||||||
else if (wc >= 0x2310 && wc < 0x2328)
|
|
||||||
c = atarist_page23[wc-0x2310];
|
|
||||||
if (c != 0) {
|
|
||||||
*r = c;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return RET_ILUNI;
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,476 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 1999-2001, 2005 Free Software Foundation, Inc.
|
|
||||||
* This file is part of the GNU LIBICONV Library.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV Library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Library General Public
|
|
||||||
* License as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV 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
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
|
||||||
* If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
|
|
||||||
* Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* BIG5-2003
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* BIG5-2003 is a slightly extended and slightly modified version of BIG5.
|
|
||||||
* It is actually nearer to Microsoft CP950 than to BIG5. The differences
|
|
||||||
* between EASTASIA/OTHER/BIG5.TXT found on ftp.unicode.org and BIG5-2003.TXT
|
|
||||||
* are as follows:
|
|
||||||
*
|
|
||||||
* 1. Some characters in the symbols area (0xA140..0xA2CE) are defined
|
|
||||||
* differently:
|
|
||||||
*
|
|
||||||
* code BIG5.TXT BIG5-2003.TXT
|
|
||||||
* 0xA145 0x2022 # BULLET 0x2027 # HYPHENATION POINT
|
|
||||||
* 0xA14E 0xFF64 # HALFWIDTH IDEOGRAPHIC COMMA
|
|
||||||
* 0xFE51 # SMALL IDEOGRAPHIC COMMA
|
|
||||||
* 0xA156 0x2013 # EN DASH 0x2015 # HORIZONTAL BAR
|
|
||||||
* 0xA15A --- 0x2574 # BOX DRAWINGS LIGHT LEFT
|
|
||||||
* 0xA1C3 --- 0xFFE3 # FULLWIDTH MACRON
|
|
||||||
* 0xA1C5 --- 0x02CD # MODIFIER LETTER LOW MACRON
|
|
||||||
* 0xA1E3 0x223C # TILDE OPERATOR 0xFF5E # FULLWIDTH TILDE
|
|
||||||
* 0xA1F2 0x2641 # EARTH 0x2295 # CIRCLED PLUS
|
|
||||||
* 0xA1F3 0x2609 # SUN 0x2299 # CIRCLED DOT OPERATOR
|
|
||||||
* 0xA1FE --- 0xFF0F # FULLWIDTH SOLIDUS
|
|
||||||
* 0xA240 --- 0xFF3C # FULLWIDTH REVERSE SOLIDUS
|
|
||||||
* 0xA241 0xFF0F # FULLWIDTH SOLIDUS 0x2215 # DIVISION SLASH
|
|
||||||
* 0xA242 0xFF3C # FULLWIDTH REVERSE SOLIDUS
|
|
||||||
* 0xFE68 # SMALL REVERSE SOLIDUS
|
|
||||||
* 0xA244 0x00A5 # YEN SIGN 0xFFE5 # FULLWIDTH YEN SIGN
|
|
||||||
* 0xA246 0x00A2 # CENT SIGN 0xFFE0 # FULLWIDTH CENT SIGN
|
|
||||||
* 0xA247 0x00A3 # POUND SIGN 0xFFE1 # FULLWIDTH POUND SIGN
|
|
||||||
* 0xA2A4 0x2550 # BOX DRAWINGS DOUBLE HORIZONTAL
|
|
||||||
* 0x2501 # BOX DRAWINGS HEAVY HORIZONTAL
|
|
||||||
* 0xA2A5 0x255E # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
|
|
||||||
* 0x251D # BOX DRAWINGS VERTICAL LIGHT AND RIGHT HEAVY
|
|
||||||
* 0xA2A6 0x256A # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
|
|
||||||
* 0x253F # BOX DRAWINGS VERTICAL LIGHT AND HORIZONTAL HEAVY
|
|
||||||
* 0xA2A7 0x2561 # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
|
|
||||||
* 0x2525 # BOX DRAWINGS VERTICAL LIGHT AND LEFT HEAVY
|
|
||||||
* 0xA2CC --- 0x3038 # HANGZHOU NUMERAL TEN
|
|
||||||
* 0xA2CD 0x5344 0x3039 # HANGZHOU NUMERAL TWENTY
|
|
||||||
* 0xA2CE --- 0x303A # HANGZHOU NUMERAL THIRTY
|
|
||||||
*
|
|
||||||
* 2. A control symbols area is added:
|
|
||||||
*
|
|
||||||
* code
|
|
||||||
* 0xA3C0..0xA3E0 U+2400..U+2421
|
|
||||||
*
|
|
||||||
* 3. The Euro sign is added:
|
|
||||||
*
|
|
||||||
* code
|
|
||||||
* 0xA3E1 0x20AC # EURO SIGN
|
|
||||||
*
|
|
||||||
* 4. Some characters in the main area are defined differently:
|
|
||||||
*
|
|
||||||
* code BIG5.TXT BIG5-2003.TXT
|
|
||||||
* 0xC255 0x5F5D 0x5F5E
|
|
||||||
*
|
|
||||||
* 5. The area 0xC6A1..0xC7FE is organized differently:
|
|
||||||
*
|
|
||||||
* code
|
|
||||||
* 0xC6A1..0xC6BE numerals (was in BIG5.TXT at 0xC7E9..0xC7FC)
|
|
||||||
* 0xC6BF..0xC6D7 radicals
|
|
||||||
* 0xC6D8..0xC6E6 rarely used symbols
|
|
||||||
* 0xC6E7..0xC77A hiragana (U+3041..U+3093, was in BIG5.TXT at 0xC6A5..0xC6F7)
|
|
||||||
* 0xC77B..0xC7F2 katakana (U+30A1..U+30F6, was in BIG5.TXT at 0xC6F8..0xC7B0)
|
|
||||||
*
|
|
||||||
* 6. Some characters are added at 0xF9D6..0xF9DC.
|
|
||||||
*
|
|
||||||
* 7. Box drawing characters are added at 0xF9DD..0xF9FE.
|
|
||||||
*
|
|
||||||
* Note: 4 of these characters are mapped in a non-inversible way, because
|
|
||||||
* Unicode does not yet include the corresponding characters:
|
|
||||||
*
|
|
||||||
* code Unicode approximation
|
|
||||||
* 0xF9FA BOX DRAWINGS DOUBLE ARC DOWN AND RIGHT 0x2554
|
|
||||||
* 0xF9FB BOX DRAWINGS DOUBLE ARC DOWN AND LEFT 0x2557
|
|
||||||
* 0xF9FC BOX DRAWINGS DOUBLE ARC UP AND RIGHT 0x255A
|
|
||||||
* 0xF9FD BOX DRAWINGS DOUBLE ARC UP AND LEFT 0x255D
|
|
||||||
*
|
|
||||||
* 8. Private area mappings are added:
|
|
||||||
*
|
|
||||||
* code Unicode
|
|
||||||
* 0x{81..8D}{40..7E,A1..FE} U+EEB8..U+F6B0
|
|
||||||
* 0x{8E..A0}{40..7E,A1..FE} U+E311..U+EEB7
|
|
||||||
* 0x{FA..FE}{40..7E,A1..FE} U+E000..U+E310
|
|
||||||
*
|
|
||||||
* These mappings are not contained in the BSMI Big5-2003 standard. However,
|
|
||||||
* they were contained in a draft of it.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static const unsigned short big5_2003_2uni_pagea1[314] = {
|
|
||||||
/* 0xa1 */
|
|
||||||
0x3000, 0xff0c, 0x3001, 0x3002, 0xff0e, 0x2027, 0xff1b, 0xff1a,
|
|
||||||
0xff1f, 0xff01, 0xfe30, 0x2026, 0x2025, 0xfe50, 0xfe51, 0xfe52,
|
|
||||||
0x00b7, 0xfe54, 0xfe55, 0xfe56, 0xfe57, 0xff5c, 0x2015, 0xfe31,
|
|
||||||
0x2014, 0xfe33, 0x2574, 0xfe34, 0xfe4f, 0xff08, 0xff09, 0xfe35,
|
|
||||||
0xfe36, 0xff5b, 0xff5d, 0xfe37, 0xfe38, 0x3014, 0x3015, 0xfe39,
|
|
||||||
0xfe3a, 0x3010, 0x3011, 0xfe3b, 0xfe3c, 0x300a, 0x300b, 0xfe3d,
|
|
||||||
0xfe3e, 0x3008, 0x3009, 0xfe3f, 0xfe40, 0x300c, 0x300d, 0xfe41,
|
|
||||||
0xfe42, 0x300e, 0x300f, 0xfe43, 0xfe44, 0xfe59, 0xfe5a, 0xfe5b,
|
|
||||||
0xfe5c, 0xfe5d, 0xfe5e, 0x2018, 0x2019, 0x201c, 0x201d, 0x301d,
|
|
||||||
0x301e, 0x2035, 0x2032, 0xff03, 0xff06, 0xff0a, 0x203b, 0x00a7,
|
|
||||||
0x3003, 0x25cb, 0x25cf, 0x25b3, 0x25b2, 0x25ce, 0x2606, 0x2605,
|
|
||||||
0x25c7, 0x25c6, 0x25a1, 0x25a0, 0x25bd, 0x25bc, 0x32a3, 0x2105,
|
|
||||||
0x203e, 0xffe3, 0xff3f, 0x02cd, 0xfe49, 0xfe4a, 0xfe4d, 0xfe4e,
|
|
||||||
0xfe4b, 0xfe4c, 0xfe5f, 0xfe60, 0xfe61, 0xff0b, 0xff0d, 0x00d7,
|
|
||||||
0x00f7, 0x00b1, 0x221a, 0xff1c, 0xff1e, 0xff1d, 0x2266, 0x2267,
|
|
||||||
0x2260, 0x221e, 0x2252, 0x2261, 0xfe62, 0xfe63, 0xfe64, 0xfe65,
|
|
||||||
0xfe66, 0xff5e, 0x2229, 0x222a, 0x22a5, 0x2220, 0x221f, 0x22bf,
|
|
||||||
0x33d2, 0x33d1, 0x222b, 0x222e, 0x2235, 0x2234, 0x2640, 0x2642,
|
|
||||||
0x2295, 0x2299, 0x2191, 0x2193, 0x2190, 0x2192, 0x2196, 0x2197,
|
|
||||||
0x2199, 0x2198, 0x2225, 0x2223, 0xff0f,
|
|
||||||
/* 0xa2 */
|
|
||||||
0xff3c, 0x2215, 0xfe68, 0xff04, 0xffe5, 0x3012, 0xffe0, 0xffe1,
|
|
||||||
0xff05, 0xff20, 0x2103, 0x2109, 0xfe69, 0xfe6a, 0xfe6b, 0x33d5,
|
|
||||||
0x339c, 0x339d, 0x339e, 0x33ce, 0x33a1, 0x338e, 0x338f, 0x33c4,
|
|
||||||
0x00b0, 0x5159, 0x515b, 0x515e, 0x515d, 0x5161, 0x5163, 0x55e7,
|
|
||||||
0x74e9, 0x7cce, 0x2581, 0x2582, 0x2583, 0x2584, 0x2585, 0x2586,
|
|
||||||
0x2587, 0x2588, 0x258f, 0x258e, 0x258d, 0x258c, 0x258b, 0x258a,
|
|
||||||
0x2589, 0x253c, 0x2534, 0x252c, 0x2524, 0x251c, 0x2594, 0x2500,
|
|
||||||
0x2502, 0x2595, 0x250c, 0x2510, 0x2514, 0x2518, 0x256d, 0x256e,
|
|
||||||
0x2570, 0x256f, 0x2501, 0x251d, 0x253f, 0x2525, 0x25e2, 0x25e3,
|
|
||||||
0x25e5, 0x25e4, 0x2571, 0x2572, 0x2573, 0xff10, 0xff11, 0xff12,
|
|
||||||
0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, 0xff19, 0x2160,
|
|
||||||
0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168,
|
|
||||||
0x2169, 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, 0x3027,
|
|
||||||
0x3028, 0x3029, 0x3038, 0x3039, 0x303a, 0xff21, 0xff22, 0xff23,
|
|
||||||
0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b,
|
|
||||||
0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33,
|
|
||||||
0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a, 0xff41,
|
|
||||||
0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, 0xff49,
|
|
||||||
0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, 0xff51,
|
|
||||||
0xff52, 0xff53, 0xff54, 0xff55, 0xff56,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const unsigned short big5_2003_2uni_pagec6[70] = {
|
|
||||||
/* 0xc6a1 */
|
|
||||||
0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467,
|
|
||||||
0x2468, 0x2469, 0x2474, 0x2475, 0x2476, 0x2477, 0x2478, 0x2479,
|
|
||||||
0x247a, 0x247b, 0x247c, 0x247d, 0x2170, 0x2171, 0x2172, 0x2173,
|
|
||||||
0x2174, 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0x2f02, 0x2f03,
|
|
||||||
0x2f05, 0x2f07, 0x2f0c, 0x2f0d, 0x2f0e, 0x2f13, 0x2f16, 0x2f19,
|
|
||||||
0x2f1b, 0x2f22, 0x2f27, 0x2f2e, 0x2f33, 0x2f34, 0x2f35, 0x2f39,
|
|
||||||
0x2f3a, 0x2f41, 0x2f46, 0x2f67, 0x2f68, 0x2fa1, 0x2faa, 0x00a8,
|
|
||||||
0xff3e, 0x30fd, 0x30fe, 0x309d, 0x309e, 0xfffd, 0xfffd, 0x3005,
|
|
||||||
0x3006, 0x3007, 0x30fc, 0xff3b, 0xff3d, 0x273d,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const unsigned short big5_2003_2uni_pagef9[41] = {
|
|
||||||
/* 0xf9d6 */
|
|
||||||
0x7881, 0x92b9, 0x88cf, 0x58bb, 0x6052, 0x7ca7, 0x5afa,
|
|
||||||
/* 0xf9dd */
|
|
||||||
0x2554, 0x2566, 0x2557, 0x2560, 0x256c, 0x2563, 0x255a, 0x2569,
|
|
||||||
0x255d, 0x2552, 0x2564, 0x2555, 0x255e, 0x256a, 0x2561, 0x2558,
|
|
||||||
0x2567, 0x255b, 0x2553, 0x2565, 0x2556, 0x255f, 0x256b, 0x2562,
|
|
||||||
0x2559, 0x2568, 0x255c, 0x2551, 0x2550,
|
|
||||||
0x2554, 0x2557, 0x255a, 0x255d, /* not invertible */
|
|
||||||
0x2593,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
|
||||||
big5_2003_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
|
|
||||||
{
|
|
||||||
unsigned char c = *s;
|
|
||||||
/* Code set 0 (ASCII) */
|
|
||||||
if (c < 0x80)
|
|
||||||
return ascii_mbtowc(conv,pwc,s,n);
|
|
||||||
/* Code set 1 (BIG5 extended) */
|
|
||||||
if (c >= 0x81 && c < 0xff) {
|
|
||||||
if (n < 2)
|
|
||||||
return RET_TOOFEW(0);
|
|
||||||
{
|
|
||||||
unsigned char c2 = s[1];
|
|
||||||
if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0xa1 && c2 < 0xff)) {
|
|
||||||
if (c >= 0xa1) {
|
|
||||||
if (c < 0xa3) {
|
|
||||||
unsigned int i = 157 * (c - 0xa1) + (c2 - (c2 >= 0xa1 ? 0x62 : 0x40));
|
|
||||||
unsigned short wc = big5_2003_2uni_pagea1[i];
|
|
||||||
if (wc != 0xfffd) {
|
|
||||||
*pwc = (ucs4_t) wc;
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!((c == 0xc6 && c2 >= 0xa1) || c == 0xc7)) {
|
|
||||||
if (!(c == 0xc2 && c2 == 0x55)) {
|
|
||||||
int ret = big5_mbtowc(conv,pwc,s,2);
|
|
||||||
if (ret != RET_ILSEQ)
|
|
||||||
return ret;
|
|
||||||
if (c == 0xa3) {
|
|
||||||
if (c2 >= 0xc0 && c2 <= 0xe1) {
|
|
||||||
*pwc = (c2 == 0xe1 ? 0x20ac : c2 == 0xe0 ? 0x2421 : 0x2340 + c2);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
} else if (c == 0xf9) {
|
|
||||||
if (c2 >= 0xd6) {
|
|
||||||
*pwc = big5_2003_2uni_pagef9[c2-0xd6];
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
} else if (c >= 0xfa) {
|
|
||||||
*pwc = 0xe000 + 157 * (c - 0xfa) + (c2 - (c2 >= 0xa1 ? 0x62 : 0x40));
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* c == 0xc2 && c2 == 0x55. */
|
|
||||||
*pwc = 0x5f5e;
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* (c == 0xc6 && c2 >= 0xa1) || c == 0xc7. */
|
|
||||||
unsigned int i = 157 * (c - 0xc6) + (c2 - (c2 >= 0xa1 ? 0x62 : 0x40));
|
|
||||||
if (i < 133) {
|
|
||||||
/* 63 <= i < 133. */
|
|
||||||
unsigned short wc = big5_2003_2uni_pagec6[i-63];
|
|
||||||
if (wc != 0xfffd) {
|
|
||||||
*pwc = (ucs4_t) wc;
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
} else if (i < 216) {
|
|
||||||
/* 133 <= i < 216. Hiragana. */
|
|
||||||
*pwc = 0x3041 - 133 + i;
|
|
||||||
return 2;
|
|
||||||
} else if (i < 302) {
|
|
||||||
/* 216 <= i < 302. Katakana. */
|
|
||||||
*pwc = 0x30a1 - 216 + i;
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* 0x81 <= c < 0xa1. */
|
|
||||||
*pwc = (c >= 0x8e ? 0xdb18 : 0xeeb8) + 157 * (c - 0x81)
|
|
||||||
+ (c2 - (c2 >= 0xa1 ? 0x62 : 0x40));
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return RET_ILSEQ;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const unsigned char big5_2003_2charset_page25[29] = {
|
|
||||||
/* 0x2550 */
|
|
||||||
0xf9, 0xf8, 0xe6, 0xef, 0xdd, 0xe8, 0xf1, 0xdf,
|
|
||||||
0xec, 0xf5, 0xe3, 0xee, 0xf7, 0xe5, 0xe9, 0xf2,
|
|
||||||
0xe0, 0xeb, 0xf4, 0xe2, 0xe7, 0xf0, 0xde, 0xed,
|
|
||||||
0xf6, 0xe4, 0xea, 0xf3, 0xe1,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
|
||||||
big5_2003_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
|
|
||||||
{
|
|
||||||
unsigned char buf[2];
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Code set 0 (ASCII) */
|
|
||||||
ret = ascii_wctomb(conv,r,wc,n);
|
|
||||||
if (ret != RET_ILUNI)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
/* Code set 1 (BIG5 extended) */
|
|
||||||
switch (wc >> 8) {
|
|
||||||
case 0x00:
|
|
||||||
if (wc == 0x00a8) { buf[0] = 0xc6; buf[1] = 0xd8; ret = 2; break; }
|
|
||||||
if (wc == 0x00a2 || wc == 0x00a3 || wc == 0x00a5)
|
|
||||||
return RET_ILUNI;
|
|
||||||
break;
|
|
||||||
case 0x02:
|
|
||||||
if (wc == 0x02cd) { buf[0] = 0xa1; buf[1] = 0xc5; ret = 2; break; }
|
|
||||||
break;
|
|
||||||
case 0x04:
|
|
||||||
return RET_ILUNI;
|
|
||||||
case 0x20:
|
|
||||||
if (wc == 0x2015) { buf[0] = 0xa1; buf[1] = 0x56; ret = 2; break; }
|
|
||||||
if (wc == 0x2027) { buf[0] = 0xa1; buf[1] = 0x45; ret = 2; break; }
|
|
||||||
if (wc == 0x20ac) { buf[0] = 0xa3; buf[1] = 0xe1; ret = 2; break; }
|
|
||||||
if (wc == 0x2013 || wc == 0x2022)
|
|
||||||
return RET_ILUNI;
|
|
||||||
break;
|
|
||||||
case 0x21:
|
|
||||||
if (wc >= 0x2170 && wc <= 0x2179) {
|
|
||||||
buf[0] = 0xc6; buf[1] = wc - 0x20bb; ret = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 0x22:
|
|
||||||
if (wc == 0x2215) { buf[0] = 0xa2; buf[1] = 0x41; ret = 2; break; }
|
|
||||||
if (wc == 0x2295) { buf[0] = 0xa1; buf[1] = 0xf2; ret = 2; break; }
|
|
||||||
if (wc == 0x2299) { buf[0] = 0xa1; buf[1] = 0xf3; ret = 2; break; }
|
|
||||||
if (wc == 0x223c)
|
|
||||||
return RET_ILUNI;
|
|
||||||
break;
|
|
||||||
case 0x24:
|
|
||||||
if (wc <= 0x241f) { buf[0] = 0xa3; buf[1] = wc - 0x2340; ret = 2; break; }
|
|
||||||
if (wc == 0x2421) { buf[0] = 0xa3; buf[1] = 0xe0; ret = 2; break; }
|
|
||||||
if (wc >= 0x2460 && wc <= 0x2469) {
|
|
||||||
buf[0] = 0xc6; buf[1] = wc - 0x23bf; ret = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (wc >= 0x2474 && wc <= 0x247d) {
|
|
||||||
buf[0] = 0xc6; buf[1] = wc - 0x23c9; ret = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 0x25:
|
|
||||||
if (wc == 0x2501) { buf[0] = 0xa2; buf[1] = 0xa4; ret = 2; break; }
|
|
||||||
if (wc == 0x251d) { buf[0] = 0xa2; buf[1] = 0xa5; ret = 2; break; }
|
|
||||||
if (wc == 0x2525) { buf[0] = 0xa2; buf[1] = 0xa7; ret = 2; break; }
|
|
||||||
if (wc == 0x253f) { buf[0] = 0xa2; buf[1] = 0xa6; ret = 2; break; }
|
|
||||||
if (wc >= 0x2550 && wc <= 0x256c) {
|
|
||||||
buf[0] = 0xf9; buf[1] = big5_2003_2charset_page25[wc-0x2550]; ret = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (wc == 0x2574) { buf[0] = 0xa1; buf[1] = 0x5a; ret = 2; break; }
|
|
||||||
if (wc == 0x2593) { buf[0] = 0xf9; buf[1] = 0xfe; ret = 2; break; }
|
|
||||||
break;
|
|
||||||
case 0x26:
|
|
||||||
if (wc == 0x2609 || wc == 0x2641)
|
|
||||||
return RET_ILUNI;
|
|
||||||
break;
|
|
||||||
case 0x27:
|
|
||||||
if (wc == 0x273d) { buf[0] = 0xc6; buf[1] = 0xe6; ret = 2; break; }
|
|
||||||
break;
|
|
||||||
case 0x2f:
|
|
||||||
if (wc == 0x2f02) { buf[0] = 0xc6; buf[1] = 0xbf; ret = 2; break; }
|
|
||||||
if (wc == 0x2f03) { buf[0] = 0xc6; buf[1] = 0xc0; ret = 2; break; }
|
|
||||||
if (wc == 0x2f05) { buf[0] = 0xc6; buf[1] = 0xc1; ret = 2; break; }
|
|
||||||
if (wc == 0x2f07) { buf[0] = 0xc6; buf[1] = 0xc2; ret = 2; break; }
|
|
||||||
if (wc == 0x2f0c) { buf[0] = 0xc6; buf[1] = 0xc3; ret = 2; break; }
|
|
||||||
if (wc == 0x2f0d) { buf[0] = 0xc6; buf[1] = 0xc4; ret = 2; break; }
|
|
||||||
if (wc == 0x2f0e) { buf[0] = 0xc6; buf[1] = 0xc5; ret = 2; break; }
|
|
||||||
if (wc == 0x2f13) { buf[0] = 0xc6; buf[1] = 0xc6; ret = 2; break; }
|
|
||||||
if (wc == 0x2f16) { buf[0] = 0xc6; buf[1] = 0xc7; ret = 2; break; }
|
|
||||||
if (wc == 0x2f19) { buf[0] = 0xc6; buf[1] = 0xc8; ret = 2; break; }
|
|
||||||
if (wc == 0x2f1b) { buf[0] = 0xc6; buf[1] = 0xc9; ret = 2; break; }
|
|
||||||
if (wc == 0x2f22) { buf[0] = 0xc6; buf[1] = 0xca; ret = 2; break; }
|
|
||||||
if (wc == 0x2f27) { buf[0] = 0xc6; buf[1] = 0xcb; ret = 2; break; }
|
|
||||||
if (wc == 0x2f2e) { buf[0] = 0xc6; buf[1] = 0xcc; ret = 2; break; }
|
|
||||||
if (wc == 0x2f33) { buf[0] = 0xc6; buf[1] = 0xcd; ret = 2; break; }
|
|
||||||
if (wc == 0x2f34) { buf[0] = 0xc6; buf[1] = 0xce; ret = 2; break; }
|
|
||||||
if (wc == 0x2f35) { buf[0] = 0xc6; buf[1] = 0xcf; ret = 2; break; }
|
|
||||||
if (wc == 0x2f39) { buf[0] = 0xc6; buf[1] = 0xd0; ret = 2; break; }
|
|
||||||
if (wc == 0x2f3a) { buf[0] = 0xc6; buf[1] = 0xd1; ret = 2; break; }
|
|
||||||
if (wc == 0x2f41) { buf[0] = 0xc6; buf[1] = 0xd2; ret = 2; break; }
|
|
||||||
if (wc == 0x2f46) { buf[0] = 0xc6; buf[1] = 0xd3; ret = 2; break; }
|
|
||||||
if (wc == 0x2f67) { buf[0] = 0xc6; buf[1] = 0xd4; ret = 2; break; }
|
|
||||||
if (wc == 0x2f68) { buf[0] = 0xc6; buf[1] = 0xd5; ret = 2; break; }
|
|
||||||
if (wc == 0x2fa1) { buf[0] = 0xc6; buf[1] = 0xd6; ret = 2; break; }
|
|
||||||
if (wc == 0x2faa) { buf[0] = 0xc6; buf[1] = 0xd7; ret = 2; break; }
|
|
||||||
break;
|
|
||||||
case 0x30:
|
|
||||||
if (wc >= 0x3005 && wc <= 0x3007) {
|
|
||||||
buf[0] = 0xc6; buf[1] = wc - 0x2f25; ret = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (wc >= 0x3038 && wc <= 0x303a) {
|
|
||||||
buf[0] = 0xa2; buf[1] = wc - 0x2f6c; ret = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (wc >= 0x3041 && wc <= 0x3093) {
|
|
||||||
if (wc < 0x3059) {
|
|
||||||
buf[0] = 0xc6; buf[1] = wc - 0x2f5a;
|
|
||||||
} else {
|
|
||||||
buf[0] = 0xc7; buf[1] = wc - 0x3019;
|
|
||||||
}
|
|
||||||
ret = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (wc == 0x309d) { buf[0] = 0xc6; buf[1] = 0xdc; ret = 2; break; }
|
|
||||||
if (wc == 0x309e) { buf[0] = 0xc6; buf[1] = 0xdd; ret = 2; break; }
|
|
||||||
if (wc >= 0x30a1 && wc <= 0x30f6) {
|
|
||||||
buf[0] = 0xc7; buf[1] = wc - (wc < 0x30a5 ? 0x3026 : 0x3004); ret = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (wc == 0x30fc) { buf[0] = 0xc6; buf[1] = 0xe3; ret = 2; break; }
|
|
||||||
if (wc == 0x30fd) { buf[0] = 0xc6; buf[1] = 0xda; ret = 2; break; }
|
|
||||||
if (wc == 0x30fe) { buf[0] = 0xc6; buf[1] = 0xdb; ret = 2; break; }
|
|
||||||
break;
|
|
||||||
case 0x53:
|
|
||||||
if (wc == 0x5344)
|
|
||||||
return RET_ILUNI;
|
|
||||||
break;
|
|
||||||
case 0x58:
|
|
||||||
if (wc == 0x58bb) { buf[0] = 0xf9; buf[1] = 0xd9; ret = 2; break; }
|
|
||||||
break;
|
|
||||||
case 0x5a:
|
|
||||||
if (wc == 0x5afa) { buf[0] = 0xf9; buf[1] = 0xdc; ret = 2; break; }
|
|
||||||
break;
|
|
||||||
case 0x5f:
|
|
||||||
if (wc == 0x5f5e) { buf[0] = 0xc2; buf[1] = 0x55; ret = 2; break; }
|
|
||||||
if (wc == 0x5f5d)
|
|
||||||
return RET_ILUNI;
|
|
||||||
break;
|
|
||||||
case 0x60:
|
|
||||||
if (wc == 0x6052) { buf[0] = 0xf9; buf[1] = 0xda; ret = 2; break; }
|
|
||||||
break;
|
|
||||||
case 0x78:
|
|
||||||
if (wc == 0x7881) { buf[0] = 0xf9; buf[1] = 0xd6; ret = 2; break; }
|
|
||||||
break;
|
|
||||||
case 0x7c:
|
|
||||||
if (wc == 0x7ca7) { buf[0] = 0xf9; buf[1] = 0xdb; ret = 2; break; }
|
|
||||||
break;
|
|
||||||
case 0x88:
|
|
||||||
if (wc == 0x88cf) { buf[0] = 0xf9; buf[1] = 0xd8; ret = 2; break; }
|
|
||||||
break;
|
|
||||||
case 0x92:
|
|
||||||
if (wc == 0x92b9) { buf[0] = 0xf9; buf[1] = 0xd7; ret = 2; break; }
|
|
||||||
break;
|
|
||||||
case 0xe0: case 0xe1: case 0xe2: case 0xe3: case 0xe4: case 0xe5:
|
|
||||||
case 0xe6: case 0xe7: case 0xe8: case 0xe9: case 0xea: case 0xeb:
|
|
||||||
case 0xec: case 0xed: case 0xee: case 0xef: case 0xf0: case 0xf1:
|
|
||||||
case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6:
|
|
||||||
{
|
|
||||||
unsigned int i = wc - 0xe000;
|
|
||||||
if (i < 5809) {
|
|
||||||
unsigned int c1 = i / 157;
|
|
||||||
unsigned int c2 = i % 157;
|
|
||||||
buf[0] = c1 + (c1 < 5 ? 0xfa : c1 < 24 ? 0x89 : 0x69);
|
|
||||||
buf[1] = c2 + (c2 < 0x3f ? 0x40 : 0x62);
|
|
||||||
ret = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 0xfe:
|
|
||||||
if (wc == 0xfe51) { buf[0] = 0xa1; buf[1] = 0x4e; ret = 2; break; }
|
|
||||||
if (wc == 0xfe68) { buf[0] = 0xa2; buf[1] = 0x42; ret = 2; break; }
|
|
||||||
break;
|
|
||||||
case 0xff:
|
|
||||||
if (wc == 0xff0f) { buf[0] = 0xa1; buf[1] = 0xfe; ret = 2; break; }
|
|
||||||
if (wc == 0xff3b) { buf[0] = 0xc6; buf[1] = 0xe4; ret = 2; break; }
|
|
||||||
if (wc == 0xff3c) { buf[0] = 0xa2; buf[1] = 0x40; ret = 2; break; }
|
|
||||||
if (wc == 0xff3d) { buf[0] = 0xc6; buf[1] = 0xe5; ret = 2; break; }
|
|
||||||
if (wc == 0xff3e) { buf[0] = 0xc6; buf[1] = 0xd9; ret = 2; break; }
|
|
||||||
if (wc == 0xff5e) { buf[0] = 0xa1; buf[1] = 0xe3; ret = 2; break; }
|
|
||||||
if (wc == 0xffe0) { buf[0] = 0xa2; buf[1] = 0x46; ret = 2; break; }
|
|
||||||
if (wc == 0xffe1) { buf[0] = 0xa2; buf[1] = 0x47; ret = 2; break; }
|
|
||||||
if (wc == 0xffe3) { buf[0] = 0xa1; buf[1] = 0xc3; ret = 2; break; }
|
|
||||||
if (wc == 0xffe5) { buf[0] = 0xa2; buf[1] = 0x44; ret = 2; break; }
|
|
||||||
if (wc == 0xff64)
|
|
||||||
return RET_ILUNI;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (ret == RET_ILUNI)
|
|
||||||
ret = big5_wctomb(conv,buf,wc,2);
|
|
||||||
if (ret != RET_ILUNI) {
|
|
||||||
if (ret != 2) abort();
|
|
||||||
if (n < 2)
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
r[0] = buf[0];
|
|
||||||
r[1] = buf[1];
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return RET_ILUNI;
|
|
||||||
}
|
|
|
@ -1,197 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 1999-2002, 2006 Free Software Foundation, Inc.
|
|
||||||
* This file is part of the GNU LIBICONV Library.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV Library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Library General Public
|
|
||||||
* License as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV 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
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
|
||||||
* If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
|
|
||||||
* Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* BIG5-HKSCS:1999
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* BIG5-HKSCS:1999 can be downloaded from
|
|
||||||
* http://www.info.gov.hk/digital21/eng/hkscs/download.html
|
|
||||||
* http://www.info.gov.hk/digital21/eng/hkscs/index.html
|
|
||||||
*
|
|
||||||
* It extends BIG5 (without the rows 0xC6..0xC7) through the ranges
|
|
||||||
*
|
|
||||||
* 0x{88..8D}{40..7E,A1..FE} 641 characters
|
|
||||||
* 0x{8E..A0}{40..7E,A1..FE} 2898 characters
|
|
||||||
* 0x{C6..C8}{40..7E,A1..FE} 359 characters
|
|
||||||
* 0xF9{D6..FE} 41 characters
|
|
||||||
* 0x{FA..FE}{40..7E,A1..FE} 763 characters
|
|
||||||
*
|
|
||||||
* Note that some HKSCS characters are not contained in Unicode 3.2
|
|
||||||
* and are therefore best represented as sequences of Unicode characters:
|
|
||||||
* 0x8862 U+00CA U+0304 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND MACRON
|
|
||||||
* 0x8864 U+00CA U+030C LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND CARON
|
|
||||||
* 0x88A3 U+00EA U+0304 LATIN SMALL LETTER E WITH CIRCUMFLEX AND MACRON
|
|
||||||
* 0x88A5 U+00EA U+030C LATIN SMALL LETTER E WITH CIRCUMFLEX AND CARON
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "hkscs1999.h"
|
|
||||||
#include "flushwc.h"
|
|
||||||
|
|
||||||
static int
|
|
||||||
big5hkscs1999_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
|
|
||||||
{
|
|
||||||
ucs4_t last_wc = conv->istate;
|
|
||||||
if (last_wc) {
|
|
||||||
/* Output the buffered character. */
|
|
||||||
conv->istate = 0;
|
|
||||||
*pwc = last_wc;
|
|
||||||
return 0; /* Don't advance the input pointer. */
|
|
||||||
} else {
|
|
||||||
unsigned char c = *s;
|
|
||||||
/* Code set 0 (ASCII) */
|
|
||||||
if (c < 0x80)
|
|
||||||
return ascii_mbtowc(conv,pwc,s,n);
|
|
||||||
/* Code set 1 (BIG5 extended) */
|
|
||||||
if (c >= 0xa1 && c < 0xff) {
|
|
||||||
if (n < 2)
|
|
||||||
return RET_TOOFEW(0);
|
|
||||||
{
|
|
||||||
unsigned char c2 = s[1];
|
|
||||||
if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0xa1 && c2 < 0xff)) {
|
|
||||||
if (!((c == 0xc6 && c2 >= 0xa1) || c == 0xc7)) {
|
|
||||||
int ret = big5_mbtowc(conv,pwc,s,2);
|
|
||||||
if (ret != RET_ILSEQ)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
int ret = hkscs1999_mbtowc(conv,pwc,s,n);
|
|
||||||
if (ret != RET_ILSEQ)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
if (c == 0x88) {
|
|
||||||
if (n < 2)
|
|
||||||
return RET_TOOFEW(0);
|
|
||||||
{
|
|
||||||
unsigned char c2 = s[1];
|
|
||||||
if (c2 == 0x62 || c2 == 0x64 || c2 == 0xa3 || c2 == 0xa5) {
|
|
||||||
/* It's a composed character. */
|
|
||||||
ucs4_t wc1 = ((c2 >> 3) << 2) + 0x009a; /* = 0x00ca or 0x00ea */
|
|
||||||
ucs4_t wc2 = ((c2 & 6) << 2) + 0x02fc; /* = 0x0304 or 0x030c */
|
|
||||||
/* We cannot output two Unicode characters at once. So,
|
|
||||||
output the first character and buffer the second one. */
|
|
||||||
*pwc = wc1;
|
|
||||||
conv->istate = wc2;
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return RET_ILSEQ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define big5hkscs1999_flushwc normal_flushwc
|
|
||||||
|
|
||||||
static int
|
|
||||||
big5hkscs1999_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
|
|
||||||
{
|
|
||||||
int count = 0;
|
|
||||||
unsigned char last = conv->ostate;
|
|
||||||
|
|
||||||
if (last) {
|
|
||||||
/* last is = 0x66 or = 0xa7. */
|
|
||||||
if (wc == 0x0304 || wc == 0x030c) {
|
|
||||||
/* Output the combined character. */
|
|
||||||
if (n >= 2) {
|
|
||||||
r[0] = 0x88;
|
|
||||||
r[1] = last + ((wc & 24) >> 2) - 4; /* = 0x62 or 0x64 or 0xa3 or 0xa5 */
|
|
||||||
conv->ostate = 0;
|
|
||||||
return 2;
|
|
||||||
} else
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Output the buffered character. */
|
|
||||||
if (n < 2)
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
r[0] = 0x88;
|
|
||||||
r[1] = last;
|
|
||||||
r += 2;
|
|
||||||
count = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Code set 0 (ASCII) */
|
|
||||||
if (wc < 0x0080) {
|
|
||||||
/* Plain ASCII character. */
|
|
||||||
if (n > count) {
|
|
||||||
r[0] = (unsigned char) wc;
|
|
||||||
conv->ostate = 0;
|
|
||||||
return count+1;
|
|
||||||
} else
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
} else {
|
|
||||||
unsigned char buf[2];
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Code set 1 (BIG5 extended) */
|
|
||||||
ret = big5_wctomb(conv,buf,wc,2);
|
|
||||||
if (ret != RET_ILUNI) {
|
|
||||||
if (ret != 2) abort();
|
|
||||||
if (!((buf[0] == 0xc6 && buf[1] >= 0xa1) || buf[0] == 0xc7)) {
|
|
||||||
if (n >= count+2) {
|
|
||||||
r[0] = buf[0];
|
|
||||||
r[1] = buf[1];
|
|
||||||
conv->ostate = 0;
|
|
||||||
return count+2;
|
|
||||||
} else
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ret = hkscs1999_wctomb(conv,buf,wc,2);
|
|
||||||
if (ret != RET_ILUNI) {
|
|
||||||
if (ret != 2) abort();
|
|
||||||
if ((wc & ~0x0020) == 0x00ca) {
|
|
||||||
/* A possible first character of a multi-character sequence. We have to
|
|
||||||
buffer it. */
|
|
||||||
if (!(buf[0] == 0x88 && (buf[1] == 0x66 || buf[1] == 0xa7))) abort();
|
|
||||||
conv->ostate = buf[1]; /* = 0x66 or = 0xa7 */
|
|
||||||
return count+0;
|
|
||||||
}
|
|
||||||
if (n >= count+2) {
|
|
||||||
r[0] = buf[0];
|
|
||||||
r[1] = buf[1];
|
|
||||||
conv->ostate = 0;
|
|
||||||
return count+2;
|
|
||||||
} else
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
}
|
|
||||||
return RET_ILUNI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
big5hkscs1999_reset (conv_t conv, unsigned char *r, int n)
|
|
||||||
{
|
|
||||||
unsigned char last = conv->ostate;
|
|
||||||
|
|
||||||
if (last) {
|
|
||||||
if (n < 2)
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
r[0] = 0x88;
|
|
||||||
r[1] = last;
|
|
||||||
/* conv->ostate = 0; will be done by the caller */
|
|
||||||
return 2;
|
|
||||||
} else
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,215 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 1999-2002, 2006 Free Software Foundation, Inc.
|
|
||||||
* This file is part of the GNU LIBICONV Library.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV Library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Library General Public
|
|
||||||
* License as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV 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
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
|
||||||
* If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
|
|
||||||
* Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* BIG5-HKSCS:2001
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* BIG5-HKSCS:2001 can be downloaded from
|
|
||||||
* http://www.info.gov.hk/digital21/eng/hkscs/download.html
|
|
||||||
* http://www.info.gov.hk/digital21/eng/hkscs/index.html
|
|
||||||
*
|
|
||||||
* It extends BIG5-HKSCS:1999 through 116 characters.
|
|
||||||
*
|
|
||||||
* It extends BIG5 (without the rows 0xC6..0xC7) through the ranges
|
|
||||||
*
|
|
||||||
* 0x{88..8D}{40..7E,A1..FE} 757 characters
|
|
||||||
* 0x{8E..A0}{40..7E,A1..FE} 2898 characters
|
|
||||||
* 0x{C6..C8}{40..7E,A1..FE} 359 characters
|
|
||||||
* 0xF9{D6..FE} 41 characters
|
|
||||||
* 0x{FA..FE}{40..7E,A1..FE} 763 characters
|
|
||||||
*
|
|
||||||
* Note that some HKSCS characters are not contained in Unicode 3.2
|
|
||||||
* and are therefore best represented as sequences of Unicode characters:
|
|
||||||
* 0x8862 U+00CA U+0304 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND MACRON
|
|
||||||
* 0x8864 U+00CA U+030C LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND CARON
|
|
||||||
* 0x88A3 U+00EA U+0304 LATIN SMALL LETTER E WITH CIRCUMFLEX AND MACRON
|
|
||||||
* 0x88A5 U+00EA U+030C LATIN SMALL LETTER E WITH CIRCUMFLEX AND CARON
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "hkscs2001.h"
|
|
||||||
#include "flushwc.h"
|
|
||||||
|
|
||||||
static int
|
|
||||||
big5hkscs2001_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
|
|
||||||
{
|
|
||||||
ucs4_t last_wc = conv->istate;
|
|
||||||
if (last_wc) {
|
|
||||||
/* Output the buffered character. */
|
|
||||||
conv->istate = 0;
|
|
||||||
*pwc = last_wc;
|
|
||||||
return 0; /* Don't advance the input pointer. */
|
|
||||||
} else {
|
|
||||||
unsigned char c = *s;
|
|
||||||
/* Code set 0 (ASCII) */
|
|
||||||
if (c < 0x80)
|
|
||||||
return ascii_mbtowc(conv,pwc,s,n);
|
|
||||||
/* Code set 1 (BIG5 extended) */
|
|
||||||
if (c >= 0xa1 && c < 0xff) {
|
|
||||||
if (n < 2)
|
|
||||||
return RET_TOOFEW(0);
|
|
||||||
{
|
|
||||||
unsigned char c2 = s[1];
|
|
||||||
if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0xa1 && c2 < 0xff)) {
|
|
||||||
if (!((c == 0xc6 && c2 >= 0xa1) || c == 0xc7)) {
|
|
||||||
int ret = big5_mbtowc(conv,pwc,s,2);
|
|
||||||
if (ret != RET_ILSEQ)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
int ret = hkscs1999_mbtowc(conv,pwc,s,n);
|
|
||||||
if (ret != RET_ILSEQ)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
int ret = hkscs2001_mbtowc(conv,pwc,s,n);
|
|
||||||
if (ret != RET_ILSEQ)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
if (c == 0x88) {
|
|
||||||
if (n < 2)
|
|
||||||
return RET_TOOFEW(0);
|
|
||||||
{
|
|
||||||
unsigned char c2 = s[1];
|
|
||||||
if (c2 == 0x62 || c2 == 0x64 || c2 == 0xa3 || c2 == 0xa5) {
|
|
||||||
/* It's a composed character. */
|
|
||||||
ucs4_t wc1 = ((c2 >> 3) << 2) + 0x009a; /* = 0x00ca or 0x00ea */
|
|
||||||
ucs4_t wc2 = ((c2 & 6) << 2) + 0x02fc; /* = 0x0304 or 0x030c */
|
|
||||||
/* We cannot output two Unicode characters at once. So,
|
|
||||||
output the first character and buffer the second one. */
|
|
||||||
*pwc = wc1;
|
|
||||||
conv->istate = wc2;
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return RET_ILSEQ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define big5hkscs2001_flushwc normal_flushwc
|
|
||||||
|
|
||||||
static int
|
|
||||||
big5hkscs2001_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
|
|
||||||
{
|
|
||||||
int count = 0;
|
|
||||||
unsigned char last = conv->ostate;
|
|
||||||
|
|
||||||
if (last) {
|
|
||||||
/* last is = 0x66 or = 0xa7. */
|
|
||||||
if (wc == 0x0304 || wc == 0x030c) {
|
|
||||||
/* Output the combined character. */
|
|
||||||
if (n >= 2) {
|
|
||||||
r[0] = 0x88;
|
|
||||||
r[1] = last + ((wc & 24) >> 2) - 4; /* = 0x62 or 0x64 or 0xa3 or 0xa5 */
|
|
||||||
conv->ostate = 0;
|
|
||||||
return 2;
|
|
||||||
} else
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Output the buffered character. */
|
|
||||||
if (n < 2)
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
r[0] = 0x88;
|
|
||||||
r[1] = last;
|
|
||||||
r += 2;
|
|
||||||
count = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Code set 0 (ASCII) */
|
|
||||||
if (wc < 0x0080) {
|
|
||||||
/* Plain ASCII character. */
|
|
||||||
if (n > count) {
|
|
||||||
r[0] = (unsigned char) wc;
|
|
||||||
conv->ostate = 0;
|
|
||||||
return count+1;
|
|
||||||
} else
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
} else {
|
|
||||||
unsigned char buf[2];
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Code set 1 (BIG5 extended) */
|
|
||||||
ret = big5_wctomb(conv,buf,wc,2);
|
|
||||||
if (ret != RET_ILUNI) {
|
|
||||||
if (ret != 2) abort();
|
|
||||||
if (!((buf[0] == 0xc6 && buf[1] >= 0xa1) || buf[0] == 0xc7)) {
|
|
||||||
if (n >= count+2) {
|
|
||||||
r[0] = buf[0];
|
|
||||||
r[1] = buf[1];
|
|
||||||
conv->ostate = 0;
|
|
||||||
return count+2;
|
|
||||||
} else
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ret = hkscs1999_wctomb(conv,buf,wc,2);
|
|
||||||
if (ret != RET_ILUNI) {
|
|
||||||
if (ret != 2) abort();
|
|
||||||
if ((wc & ~0x0020) == 0x00ca) {
|
|
||||||
/* A possible first character of a multi-character sequence. We have to
|
|
||||||
buffer it. */
|
|
||||||
if (!(buf[0] == 0x88 && (buf[1] == 0x66 || buf[1] == 0xa7))) abort();
|
|
||||||
conv->ostate = buf[1]; /* = 0x66 or = 0xa7 */
|
|
||||||
return count+0;
|
|
||||||
}
|
|
||||||
if (n >= count+2) {
|
|
||||||
r[0] = buf[0];
|
|
||||||
r[1] = buf[1];
|
|
||||||
conv->ostate = 0;
|
|
||||||
return count+2;
|
|
||||||
} else
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
}
|
|
||||||
ret = hkscs2001_wctomb(conv,buf,wc,2);
|
|
||||||
if (ret != RET_ILUNI) {
|
|
||||||
if (ret != 2) abort();
|
|
||||||
if (n >= count+2) {
|
|
||||||
r[0] = buf[0];
|
|
||||||
r[1] = buf[1];
|
|
||||||
conv->ostate = 0;
|
|
||||||
return count+2;
|
|
||||||
} else
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
}
|
|
||||||
return RET_ILUNI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
big5hkscs2001_reset (conv_t conv, unsigned char *r, int n)
|
|
||||||
{
|
|
||||||
unsigned char last = conv->ostate;
|
|
||||||
|
|
||||||
if (last) {
|
|
||||||
if (n < 2)
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
r[0] = 0x88;
|
|
||||||
r[1] = last;
|
|
||||||
/* conv->ostate = 0; will be done by the caller */
|
|
||||||
return 2;
|
|
||||||
} else
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,231 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 1999-2002, 2006 Free Software Foundation, Inc.
|
|
||||||
* This file is part of the GNU LIBICONV Library.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV Library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Library General Public
|
|
||||||
* License as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV 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
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
|
||||||
* If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
|
|
||||||
* Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* BIG5-HKSCS:2004
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* BIG5-HKSCS:2004 can be downloaded from
|
|
||||||
* http://www.info.gov.hk/digital21/eng/hkscs/download.html
|
|
||||||
* http://www.info.gov.hk/digital21/eng/hkscs/index.html
|
|
||||||
*
|
|
||||||
* It extends BIG5-HKSCS:2001 through 123 characters.
|
|
||||||
*
|
|
||||||
* It extends BIG5 (without the rows 0xC6..0xC7) through the ranges
|
|
||||||
*
|
|
||||||
* 0x{87..8D}{40..7E,A1..FE} 880 characters
|
|
||||||
* 0x{8E..A0}{40..7E,A1..FE} 2898 characters
|
|
||||||
* 0x{C6..C8}{40..7E,A1..FE} 359 characters
|
|
||||||
* 0xF9{D6..FE} 41 characters
|
|
||||||
* 0x{FA..FE}{40..7E,A1..FE} 763 characters
|
|
||||||
*
|
|
||||||
* Note that some HKSCS characters are not contained in Unicode 3.2
|
|
||||||
* and are therefore best represented as sequences of Unicode characters:
|
|
||||||
* 0x8862 U+00CA U+0304 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND MACRON
|
|
||||||
* 0x8864 U+00CA U+030C LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND CARON
|
|
||||||
* 0x88A3 U+00EA U+0304 LATIN SMALL LETTER E WITH CIRCUMFLEX AND MACRON
|
|
||||||
* 0x88A5 U+00EA U+030C LATIN SMALL LETTER E WITH CIRCUMFLEX AND CARON
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "hkscs2004.h"
|
|
||||||
#include "flushwc.h"
|
|
||||||
|
|
||||||
static int
|
|
||||||
big5hkscs2004_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
|
|
||||||
{
|
|
||||||
ucs4_t last_wc = conv->istate;
|
|
||||||
if (last_wc) {
|
|
||||||
/* Output the buffered character. */
|
|
||||||
conv->istate = 0;
|
|
||||||
*pwc = last_wc;
|
|
||||||
return 0; /* Don't advance the input pointer. */
|
|
||||||
} else {
|
|
||||||
unsigned char c = *s;
|
|
||||||
/* Code set 0 (ASCII) */
|
|
||||||
if (c < 0x80)
|
|
||||||
return ascii_mbtowc(conv,pwc,s,n);
|
|
||||||
/* Code set 1 (BIG5 extended) */
|
|
||||||
if (c >= 0xa1 && c < 0xff) {
|
|
||||||
if (n < 2)
|
|
||||||
return RET_TOOFEW(0);
|
|
||||||
{
|
|
||||||
unsigned char c2 = s[1];
|
|
||||||
if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0xa1 && c2 < 0xff)) {
|
|
||||||
if (!((c == 0xc6 && c2 >= 0xa1) || c == 0xc7)) {
|
|
||||||
int ret = big5_mbtowc(conv,pwc,s,2);
|
|
||||||
if (ret != RET_ILSEQ)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
int ret = hkscs1999_mbtowc(conv,pwc,s,n);
|
|
||||||
if (ret != RET_ILSEQ)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
int ret = hkscs2001_mbtowc(conv,pwc,s,n);
|
|
||||||
if (ret != RET_ILSEQ)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
int ret = hkscs2004_mbtowc(conv,pwc,s,n);
|
|
||||||
if (ret != RET_ILSEQ)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
if (c == 0x88) {
|
|
||||||
if (n < 2)
|
|
||||||
return RET_TOOFEW(0);
|
|
||||||
{
|
|
||||||
unsigned char c2 = s[1];
|
|
||||||
if (c2 == 0x62 || c2 == 0x64 || c2 == 0xa3 || c2 == 0xa5) {
|
|
||||||
/* It's a composed character. */
|
|
||||||
ucs4_t wc1 = ((c2 >> 3) << 2) + 0x009a; /* = 0x00ca or 0x00ea */
|
|
||||||
ucs4_t wc2 = ((c2 & 6) << 2) + 0x02fc; /* = 0x0304 or 0x030c */
|
|
||||||
/* We cannot output two Unicode characters at once. So,
|
|
||||||
output the first character and buffer the second one. */
|
|
||||||
*pwc = wc1;
|
|
||||||
conv->istate = wc2;
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return RET_ILSEQ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define big5hkscs2004_flushwc normal_flushwc
|
|
||||||
|
|
||||||
static int
|
|
||||||
big5hkscs2004_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
|
|
||||||
{
|
|
||||||
int count = 0;
|
|
||||||
unsigned char last = conv->ostate;
|
|
||||||
|
|
||||||
if (last) {
|
|
||||||
/* last is = 0x66 or = 0xa7. */
|
|
||||||
if (wc == 0x0304 || wc == 0x030c) {
|
|
||||||
/* Output the combined character. */
|
|
||||||
if (n >= 2) {
|
|
||||||
r[0] = 0x88;
|
|
||||||
r[1] = last + ((wc & 24) >> 2) - 4; /* = 0x62 or 0x64 or 0xa3 or 0xa5 */
|
|
||||||
conv->ostate = 0;
|
|
||||||
return 2;
|
|
||||||
} else
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Output the buffered character. */
|
|
||||||
if (n < 2)
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
r[0] = 0x88;
|
|
||||||
r[1] = last;
|
|
||||||
r += 2;
|
|
||||||
count = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Code set 0 (ASCII) */
|
|
||||||
if (wc < 0x0080) {
|
|
||||||
/* Plain ASCII character. */
|
|
||||||
if (n > count) {
|
|
||||||
r[0] = (unsigned char) wc;
|
|
||||||
conv->ostate = 0;
|
|
||||||
return count+1;
|
|
||||||
} else
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
} else {
|
|
||||||
unsigned char buf[2];
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Code set 1 (BIG5 extended) */
|
|
||||||
ret = big5_wctomb(conv,buf,wc,2);
|
|
||||||
if (ret != RET_ILUNI) {
|
|
||||||
if (ret != 2) abort();
|
|
||||||
if (!((buf[0] == 0xc6 && buf[1] >= 0xa1) || buf[0] == 0xc7)) {
|
|
||||||
if (n >= count+2) {
|
|
||||||
r[0] = buf[0];
|
|
||||||
r[1] = buf[1];
|
|
||||||
conv->ostate = 0;
|
|
||||||
return count+2;
|
|
||||||
} else
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ret = hkscs1999_wctomb(conv,buf,wc,2);
|
|
||||||
if (ret != RET_ILUNI) {
|
|
||||||
if (ret != 2) abort();
|
|
||||||
if ((wc & ~0x0020) == 0x00ca) {
|
|
||||||
/* A possible first character of a multi-character sequence. We have to
|
|
||||||
buffer it. */
|
|
||||||
if (!(buf[0] == 0x88 && (buf[1] == 0x66 || buf[1] == 0xa7))) abort();
|
|
||||||
conv->ostate = buf[1]; /* = 0x66 or = 0xa7 */
|
|
||||||
return count+0;
|
|
||||||
}
|
|
||||||
if (n >= count+2) {
|
|
||||||
r[0] = buf[0];
|
|
||||||
r[1] = buf[1];
|
|
||||||
conv->ostate = 0;
|
|
||||||
return count+2;
|
|
||||||
} else
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
}
|
|
||||||
ret = hkscs2001_wctomb(conv,buf,wc,2);
|
|
||||||
if (ret != RET_ILUNI) {
|
|
||||||
if (ret != 2) abort();
|
|
||||||
if (n >= count+2) {
|
|
||||||
r[0] = buf[0];
|
|
||||||
r[1] = buf[1];
|
|
||||||
conv->ostate = 0;
|
|
||||||
return count+2;
|
|
||||||
} else
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
}
|
|
||||||
ret = hkscs2004_wctomb(conv,buf,wc,2);
|
|
||||||
if (ret != RET_ILUNI) {
|
|
||||||
if (ret != 2) abort();
|
|
||||||
if (n >= count+2) {
|
|
||||||
r[0] = buf[0];
|
|
||||||
r[1] = buf[1];
|
|
||||||
conv->ostate = 0;
|
|
||||||
return count+2;
|
|
||||||
} else
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
}
|
|
||||||
return RET_ILUNI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
big5hkscs2004_reset (conv_t conv, unsigned char *r, int n)
|
|
||||||
{
|
|
||||||
unsigned char last = conv->ostate;
|
|
||||||
|
|
||||||
if (last) {
|
|
||||||
if (n < 2)
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
r[0] = 0x88;
|
|
||||||
r[1] = last;
|
|
||||||
/* conv->ostate = 0; will be done by the caller */
|
|
||||||
return 2;
|
|
||||||
} else
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,125 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 1999-2002 Free Software Foundation, Inc.
|
|
||||||
* This file is part of the GNU LIBICONV Library.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV Library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Library General Public
|
|
||||||
* License as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* The GNU LIBICONV 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
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
|
||||||
* If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
|
|
||||||
* Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* C99
|
|
||||||
* This is ASCII with \uXXXX and \UXXXXXXXX escape sequences, denoting Unicode
|
|
||||||
* characters. See ISO/IEC 9899:1999, section 6.4.3.
|
|
||||||
* The treatment of control characters in the range U+0080..U+009F is not
|
|
||||||
* specified; we pass them through unmodified.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int
|
|
||||||
c99_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
|
|
||||||
{
|
|
||||||
unsigned char c;
|
|
||||||
ucs4_t wc;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
c = s[0];
|
|
||||||
if (c < 0xa0) {
|
|
||||||
if (c != '\\') {
|
|
||||||
*pwc = c;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (n < 2)
|
|
||||||
return RET_TOOFEW(0);
|
|
||||||
c = s[1];
|
|
||||||
if (c == 'u') {
|
|
||||||
wc = 0;
|
|
||||||
for (i = 2; i < 6; i++) {
|
|
||||||
if (n <= i)
|
|
||||||
return RET_TOOFEW(0);
|
|
||||||
c = s[i];
|
|
||||||
if (c >= '0' && c <= '9')
|
|
||||||
c -= '0';
|
|
||||||
else if (c >= 'A' && c <= 'Z')
|
|
||||||
c -= 'A'-10;
|
|
||||||
else if (c >= 'a' && c <= 'z')
|
|
||||||
c -= 'a'-10;
|
|
||||||
else
|
|
||||||
goto simply_backslash;
|
|
||||||
wc |= (ucs4_t) c << (4 * (5-i));
|
|
||||||
}
|
|
||||||
if ((wc >= 0x00a0 && !(wc >= 0xd800 && wc < 0xe000))
|
|
||||||
|| wc == 0x0024 || wc == 0x0040 || wc == 0x0060) {
|
|
||||||
*pwc = wc;
|
|
||||||
return 6;
|
|
||||||
}
|
|
||||||
} else if (c == 'U') {
|
|
||||||
wc = 0;
|
|
||||||
for (i = 2; i < 10; i++) {
|
|
||||||
if (n <= i)
|
|
||||||
return RET_TOOFEW(0);
|
|
||||||
c = s[i];
|
|
||||||
if (c >= '0' && c <= '9')
|
|
||||||
c -= '0';
|
|
||||||
else if (c >= 'A' && c <= 'Z')
|
|
||||||
c -= 'A'-10;
|
|
||||||
else if (c >= 'a' && c <= 'z')
|
|
||||||
c -= 'a'-10;
|
|
||||||
else
|
|
||||||
goto simply_backslash;
|
|
||||||
wc |= (ucs4_t) c << (4 * (9-i));
|
|
||||||
}
|
|
||||||
if ((wc >= 0x00a0 && !(wc >= 0xd800 && wc < 0xe000))
|
|
||||||
|| wc == 0x0024 || wc == 0x0040 || wc == 0x0060) {
|
|
||||||
*pwc = wc;
|
|
||||||
return 10;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
goto simply_backslash;
|
|
||||||
}
|
|
||||||
return RET_ILSEQ;
|
|
||||||
simply_backslash:
|
|
||||||
*pwc = '\\';
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
c99_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
|
|
||||||
{
|
|
||||||
if (wc < 0xa0) {
|
|
||||||
*r = wc;
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
int result;
|
|
||||||
unsigned char u;
|
|
||||||
if (wc < 0x10000) {
|
|
||||||
result = 6;
|
|
||||||
u = 'u';
|
|
||||||
} else {
|
|
||||||
result = 10;
|
|
||||||
u = 'U';
|
|
||||||
}
|
|
||||||
if (n >= result) {
|
|
||||||
int count;
|
|
||||||
r[0] = '\\';
|
|
||||||
r[1] = u;
|
|
||||||
r += 2;
|
|
||||||
for (count = result-3; count >= 0; count--) {
|
|
||||||
unsigned int i = (wc >> (4*count)) & 0x0f;
|
|
||||||
*r++ = (i < 10 ? '0'+i : 'a'-10+i);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
} else
|
|
||||||
return RET_TOOSMALL;
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue