Squashed 'fribidi/fribidi/' content from commit 27b9250

git-subtree-dir: fribidi/fribidi
git-subtree-split: 27b9250ca4dd328bcc8eff6fd4d72914a0b6bde7
This commit is contained in:
Slava Monich 2015-05-26 23:48:38 +03:00
commit 65c2c54cfb
113 changed files with 40789 additions and 0 deletions

20
.cvsignore Normal file
View file

@ -0,0 +1,20 @@
ChangeLog
INSTALL
aclocal.m4
autom4te.cache
fribidi.pc
fribidi.spec
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
depcomp
install-sh
libtool
ltmain.sh
missing
mkinstalldirs
stamp-h1

20
.indent.pro vendored Normal file
View file

@ -0,0 +1,20 @@
-gnu
-bfda
-bfde
-T FILE
-T FriBidiChar
-T FriBidiLevel
-T FriBidiStrIndex
-T FriBidiCharType
-T FriBidiParType
-T FriBidiJoiningType
-T FriBidiArabicProp
-T FriBidiCharSet
-T FriBidiCharSetHandler
-T FriBidiMemChunk
-T FriBidiEnv
-T FriBidiRun
-T fribidi_uint8
-T fribidi_uint16
-T fribidi_uint32
-T fribidi_boolean

40
AUTHORS Normal file
View file

@ -0,0 +1,40 @@
behdad: Behdad Esfahbod <behdad@gnu.org>
#
# Behdad Esfahbod is the only author that actually codes these days. He
# maintains the package too. He has revised all of the code written by
# others, and has written much of the code himself. He's listed (or should
# be listed) on every file in the package as one of the authors. Behdad
# designs, implements, documents, maintains, ...
#
dov-g: Dov Grobgeld <dov@imagic.weizmann.ac.il>
#
# Dov Grobgeld originally wrote FriBidi. The 0.1.* releases were all done
# by him. After that, Dov rarely touched the code, but contributed ideas.
# All files that he has originally authored have him listed as an author in
# the header of the file.
#
roozbeh: Roozbeh Pournader <roozbeh@gnu.org>
#
# Roozbeh Pournader hasn't contributed much code to FriBidi personally; but
# has maintained, promoted, and supported the project for a while. He has
# helped with making GNU FriBidi standards compliant, and has sometimes
# lobbied with the Unicode Consortium when needed. Roozbeh was supposed to
# be a co-maintainer of GNU FriBidi, but he's not doing that yet.
#
#
# Note: Other people have contributed significant amounts of code, but
# usually the code has faded out because of restructuring and redesigning
# things around GNU FriBidi. As an example, the FriBidiEnv patch by Omer
# Zak, made itself into FriBidi CVS for a couple of years, but was finally
# implemented in a better way by Behdad.
#
# Note: GNU getopt is distributed with and used in GNU FriBidi under bin/, but
# is not part of GNU FriBidi.
#
# Note: Parts of the Unicode Character Database are distributed with and used
# in GNU FriBidi under gen.tab/unidata/, but are not part of GNU FriBidi.
#

504
COPYING Normal file
View file

@ -0,0 +1,504 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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.
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.
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.
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.
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.
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.
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.
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
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.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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!

703
ChangeLog.old Normal file
View file

@ -0,0 +1,703 @@
2002-12-22 Behdad Esfahbod <fribidi@behdad.org>
* Makefile.am: Added fribidi_types.i to
libfribidiinc_HEADERS, to fix bug reported by Omer Zak.
2002-12-10 Behdad Esfahbod <fribidi@behdad.org>
* Created CVSROOT entries.
2002-08-07 Behdad Esfahbod <fribidi@behdad.org>
* AUTHORS: Added Tomas Frydrych <tomas@frydrych.uklinux.net>.
* READMY: Moved AbiWord to applications that use fribidi.
* fribidi.h: Removed #include "fribidi_mem.h".
* fribidi_config.h: Added to CVS, to make MSVC builds from CVS
possible.
* win/*: Added to CVS.
2002-08-01 Behdad Esfahbod <fribidi@behdad.org>
* *.c, *.h, fribidi_config.h.in, configure.in, acconfig.h: Applied
and completed the patch from Tomas Frydrych, to add FRIBIDI_EXPORT
and FRIBIDI_API symbols. These symbols are needed for ports of
fribidi to Windows and other platforms.
* fribidi_char_sets.i, fribidi_types.i: Added.
2002-06-17 Behdad Esfahbod <fribidi@behdad.org>
* fribidi_unicode.h: Set Unicode chars based on sizeof FriBidiChar.
Now if one changes FriBidiChar to 16bit, and regenerate char_type
tables, they will be 16bit too.
2002-05-19 Behdad Esfahbod <fribidi@behdad.org>
* Fribidi 0.10.4 released.
* configure.in: Changed version information.
2002-05-18 Behdad Esfahbod <fribidi@behdad.org>
* packtab.c: Updated the search and output generating routines,
to use select among int8, int16 and int32 types, this helps to
compress better, and generate fewer symbols.
2002-05-16 Behdad Esfahbod <fribidi@behdad.org>
* fribidi_wcwidth.c: Updated to latest source of 2002-05-08.
* fribidi_wcwidth.i: Added, fribidi_wcwidth.c includes this to reduces
changes needed in fribidi_wcwidth.c.
* fribidi_mem.h, fribidi_types.h, *.c: Common type names like int32,
boolean, ..., changed name to have fribidi prefix.
* .indent.pro: Updated type names.
* fribidi_char_sets_utf8.c: Fixed to support 4-byte length utf-8
sequences.
2002-05-04 Behdad Esfahbod <fribidi@behdad.org>
* fribidi_wcwidth.c: Updated to latest source of 2002-05-03.
2002-04-07 Behdad Esfahbod <behdad@bamdad.org>
* unidata/*, fribidi_unicode.h, fribidi_wcwidth.c: Update to
Unicode 3.2.
* configure.in: Version information updated.
* fribidi.c: Version information changed to contain Unicode version too.
* 0.10.3 released.
2002-03-25 Behdad Esfahbod <behdad@bamdad.org>
* fribidi.c: Fixed a bug introduced in adding L3 rule.
2002-03-15 Behdad Esfahbod <behdad@bamdad.org>
* 0.10.2 released.
* configure.in: Changed version to 0.10.2.
2002-03-15 Behdad Esfahbod <behdad@bamdad.org>
* packtab.c: Updated the output generating routine, to generate much
fewer symbols, to reduce the relocation time (suggested by Owen
Taylor).
2002-03-15 Behdad Esfahbod <behdad@bamdad.org>
* fribidi.c, fribidi.h: Applied the patch from
Dominique Unruh <dominique@unruh.de> to reorder the NSM character
to follow their base character (rule L3), fribidi_reorder_nsm_status(),
fribidi_set_reorder_nsm() added.
* fribidi_main.c: Option --reordernsm added, also --test sets
--reordernsm.
* TODO: Done task for rule L3 removed.
* AUTHORS: Dominique Unruh <dominique@unruh.de> added.
* tests/test_UTF-8_nsmreorder.input,
tests/test_UTF-8_nsmreorder.reference: Added.
* NEWS: Updated, will be used to reflect each release News.
2002-03-12 Behdad Esfahbod <behdad@bamdad.org>
* fribidi.spec.in: Small cleanup.
2002-03-08 Behdad Esfahbod <behdad@bamdad.org>
* Makefile.am: Small cleanup.
* bootstrap: automake options removed, added in Makefile.am.
2002-01-25 Behdad Esfahbod <behdad@bamdad.org>
* Makefile.am: Added fribidi.spec to distribution, to be able to make
RPMs from released distribution with 'rpm -tb'.
* fribidi.c: Added 'do { ... } while (0)' stuff around #defined codes.
2002-01-23 Behdad Esfahbod <behdad@bamdad.org>
* fribidi_create_char_types.c, fribidi_create_mirroring.c: Changed
to use sprintf() instead of snprintf().
2002-01-04 Roozbeh Pournader <roozbeh@sharif.edu>
* FriBidi 0.10.1 released.
* configure.in: Changed the version to 0.10.1.
2002-01-18 Behdad Esfahbod <behdad@bamdad.org>
* configure.in, fribidi.spec.in: Clean up, different version components
defined, rpm names changed from fribidi to fribidi{majorversion}.
2002-01-14 Behdad Esfahbod <behdad@bamdad.org>
* fribidi.c: Rewrote run_length_encode_types() main loop.
2002-01-12 Behdad Esfahbod <behdad@bamdad.org>
* fribidi.spec.in: Define RPM serial version as interface version.
* TODO: New tasks added.
2002-01-11 Behdad Esfahbod <behdad@bamdad.org>
* packtab.c: Fixed the bug Owen Taylor <otaylor@redhat.com>, defines
internal arrays as "static const" in output.
* fribidi_create_char_types.c, fribidi_create_mirroring.c: Fixed to
add "#ifndef ... #define ..." stuff around output.
2002-01-10 Behdad Esfahbod <behdad@bamdad.org>
* configure.in: Changed the version to 0.10.1pre.
* TODO: Done tasks removed.
* *.h: "extern C" stuff added.
* fribidi-config.in: Include path changed from @includedir@/fribidi
to @includedir@.
* fribidi.c: Set FRIBIDI_CHUNK_SIZE according to MEM_OPTIMIZED flag
to 16 or 128.
* fribidi.c, fribidi_unicode.h, conformance/test: Do not set
MAX_LEVEL to 15 if flag DEBUG defined, renamed to
UNI_MAX_BIDI_LEVEL and moved to fribidi_unicode.h, should not check
fribidi with debug-enabled reference code anymore. Updated
conformance/test to reflect this change.
* README: Sample input and output removed, refered to tests directory
* fribidi_config.h.in: Added, configure creates fribidi_config.h from
this.
* fribidi.spec.in: Added, configure creates fribidi.spec from this.
It can be used to create RPM packages.
2002-01-04 Roozbeh Pournader <roozbeh@sharif.edu>
* FriBidi 0.10.0 released.
* configure.in: Changed the version to 0.10.0.
2002-01-02 Behdad Esfahbod <behdad@bamdad.org>
* bootstrap: automake option -a added
* fribidi_types.h: FriBidiStrIndex type changed from uint16 to int.
FriBidiLevel introduced, as uint8 to hold the type for bidi levels.
* fribidi.c, fribidi.h, fribidi_utils.c, fribidi_main.c: Updated to
use FriBidiLeveli and FriBidiStrIndex.
* fribidi.h, fribidi.c: fribidi_remove_explicits() replaced by
fribidi_remove_bidi_marks() which also updates l2v, v2l and levels.
* fribidi.h, fribidi_char_type.c: fribidi_get_types() added.
* wcwidth.c: Replaced by fribidi_wcwidth.c.
* fribidi_wcwidth.c: Markus Kuhn's implementation of wcwidth(),
updated to use fribidi's types.
* fribidi.pc.in: Added, input file for pkgconfig support.
* configure.in, Makefile.am: Updated to make fribidi.pc, which
pkgconfig needs.
* AUTHORS: Abel Cheung <maddog@linux.org.hk> added, has implemented
pkgconfig support.
* fribidi_char_sets.h, fribidi_char_sets.c: Check for macro
FRIBIDI_INTERFACE_1 to define fribidi_*_to_unicode functions with
interface version 1.
* Makefile.am: A small dependency problem fixed.
* unidata/README: Added, Unicode disclaimer.
* Makefile.am: unidata/README, unidata/UnicodeData.txt,
BidiMirroring.txt: Added to distribution files.
* Removed wget mechanism for autogetting the Unicode data files.
2001-12-31 Behdad Esfahbod <behdad@bamdad.org>
* configure.in: Check for sed added.
* Makefile.am: Scripts fixed to work with sh (not bash).
2001-12-14 Behdad Esfahbod <behdad@bamdad.org>
* fribidi_get_type.c: Removed, replaced by fribidi_char_type.c and
fribidi_mirroring.c.
* Makefile.noglib, fribidi_mini_glib.c, fribidi_mini_glib.h: removed,
no glib dependency, replaced by fribidi_mem.c, and fribidi_mem.h.
* fribidi_tables.i: Removed, replaced by fribidi_tab_mirroring.i,
fribidi_tab_char_type_2.i, and fribidi_tab_char_type_9.i.
* unidata/CreateGetType.pl: Removed, replaced by
fribidi_create_mirroring.c, and fribidi_create_char_types.c.
* tests/test-CapRTL, tests/test-CapRTL.reference: Removed, replaced by
tests/test_CapRTL_implicit.input, and
tests/test_CapRTL_implicit.reference.
* tests/test-explicit, tests/test-explicit.reference: Removed, replaced
by tests/test_CapRTL_explicit.input, and
tests/test_CapRTL_explicit.reference.
* tests/test-hebrew, tests/test-hebrew.reference: Removed, replaced by
tests/test_ISO8859-8_hebrew.input, and
tests/test_ISO8859-8_hebrew.reference.
* tests/test_CapRTL_implicit.input,
tests/test_CapRTL_implicit.reference,
tests/test_CapRTL_explicit.input,
tests/test_CapRTL_explicit.reference,
tests/test_ISO8859-8_hebrew.input,
tests/test_ISO8859-8_hebrew.reference,
tests/test_UTF-8_persian.input,
tests/test_UTF-8_persian.reference: Added.
* wcwidth.c: Added, determines a characters width, to break lines.
* fribidi_create_mirroring.c: Added, creates fribidi_tab_mirroring.i
from unidata/BidiMirroring.txt
* fribidi_create_char_types.c: Added, creates fribidi_tab_char_type_*.i
from unidata/UnicodeData.txt
* fribidi_tab_mirroring.i: Added, mirroring table.
* fribidi_tab_char_type_2.i, fribidi_tab_char_type_9.i: Added, as
default character type tables, one optimized for speed, one for
space, MEM_OPTIMIZED flag will decide which one to use.
* fribidi_mirroring.c: Added, #includes fribidi_tab_mirroring.i.
* fribidi_char_type.c: Added, #includes one of
'fribidi_tab_char_type_*.i'.
* fribidi_mem.c, fribidi_mem.h: Added, define some types and functions
that was previously defined by glib.
* fribidi_unicode.h: Added, Unicode-dependent definitions moved here.
* packtab.c, packtab.h: Added, fribidi_create_char_type.c uses these,
to compress the types table.
* AUTHORS: Markus Kuhn added, as he has wrote wcwidth.c.
* INSTALL: "Building without glib" material removed.
* TODO: Updated, done tasks removed, new tasks added.
* NEWS: Updated, compile farm results added.
* Makefile.am: Lots of changes, to recent changes, new special
target fribidi_tab_char_type_N.i added, which N is replaced with
a digit between 2 and 9, and makes a table with compress level N.
* acinclude.m4: glib material removed.
* configure.in: VERISON update, INTERFACE_VERSION added. glib
material removed, fribidi_tab_char_types_N.i configuration added,
option --without-charsets added. Also creates fribidi_config.h.
* fribidi-config.in: A small bug fixed, to set the --cflags output
correctly, glib material removed.
* fribidi.h: Preprocessor material added for easier link with c++
codes, new headers included.
* fribidi_benchmark.c: Character set dependency removed, uses no
charset code.
* fribidi_char_sets*.c, fribidi_char_sets*.h: Preprocessor material
added to reflect the effect of --without-charsets configure option.
* fribidi_char_sets_utf8.c, fribidi_char_sets_utf8.h: Unused code
removed.
* fribidi_main.c: Changed to reflect the effect of --without-charsets
configure option, and use iconv if no charsets. Option --nobreak
added for no line breaks. Line break code rewrote to break correctly
in UTF-8 mode.
* fribidi_types.h: In definition of FriBidiChar values, states that
sign bit is reserved for user's private use, FRIBIDI_TYPE_PRIVATE
macro defined to check for this.
* run.tests: Changed to test fribidi with all test files in tests/
directory, and also automatically extract the character set from
the test's name.
* *.c, *.h: glib material replaced with their equivalents: gchar
replaced with char, gint replaced by int, ...
2001-12-11 Roozbeh Pournader <roozbeh@sharif.edu>
* FriBidi 0.9.1 released.
* configure.in: changed the version to 0.9.1.
2001-12-10 Roozbeh Pournader <roozbeh@sharif.edu>
* fribidi.c: fixed a memory boundary bug (fix by Hidetoshi Tajima
<hidetoshi.tajima@sun.com>).
* INSTALL: added a comment for how to install from CVS (suggested by
Omer Zak); cleaned up some vertical spacing.
* ChangeLog: changed Behdad's address to 'bamdad.org'.
2001-08-23 Behdad Esfahbod <behdad@sharif.edu>
* acinclude.m4, ltmain.sh, ltmain.in, ltconfig: Updated with
libtool-1.4 to configure under latest cygwin.
2001-05-29 Behdad Esfahbod <behdad@sharif.edu>
* fribidi_get_type.c: Updated to use new 'fribidi_tables.i'.
* fribidi_utils.c: very small code cleanup.
2001-05-29 Roozbeh Pournader <roozbeh@sharif.edu>
* unidata/CreateGetType.pl, fribidi_tables.i, Makefile.am: Updated
for Unicode 3.1. Replace PropList parsing with UnicodeData parsing.
Unassigned characters are now treated as specified in Table 3-7 of
UAX #9.
* unidata/PropList.txt: removed.
* unidata/UnicodeData.txt: added.
2001-05-22 Behdad Esfahbod <behdad@sharif.edu>
* fribidi_char_sets_utf8.c: Fixed a little bug in utf-8 -> unicode
converter.
2001-05-16 Behdad Esfahbod <behdad@bamdad.org>
* fribidi.c: Fixed a bug in rule W1, that caused W5 not to work
properly when adjacent to a NSM.
2001-05-06 Behdad Esfahbod <behdad@bamdad.org>
* fribidi_types.h: Changed to use #define instead of enum's
work properly with machines with 16bit ints.
2001-04-13 Roozbeh Pournader <roozbeh@sharif.edu>
* configure.in: Added Owen Taylor's patch to make warnings on
by default.
2001-04-12 Behdad Esfahbod <behdad@bamdad.org>
* configure.in, Makefile.am: Changed to use getopt.* if no glibc.
* getopt.c, getopt.h, getopt1.c: Added to be used if no glibc.
2001-04-11 Behdad Esfahbod <behdad@bamdad.org>
* acinclude.m4: Added macro definitions of libtool.
* configure.in, Makefile.am: Changed to use fribidi_mini_glib
whenever glib library not found.
* TODO: Removed done tasks.
2001-04-11 Behdad Esfahbod <behdad@bamdad.org>
* fribidi_char_sets_*.c: Fixed bugs introduced in guchar to gchar
conversion.
2001-04-10 Behdad Esfahbod <behdad@bamdad.org>
* *.c/*.h: Changed all "guchar"s to "gchar" and neede casts done.
* Makefile.am: Added MAINTAINERCLEANFILES to remove files
"configure", "config.h.in", "Makefile.in", "aclocal.m4" by
maintainer-clean target.
2001-04-07 Behdad Esfahbod <behdad@bamdad.org>
* fribidi_main.c, fribidi_benchmark.c: Check for HAVE_CONFIG_H flag.
2001-04-03 Behdad Esfahbod <behdad@sharif.edu>
* fribidi_mini_glib.h, fribidi_mini_glib.c: Added functions
for working with MemChunks, some more definitions of glib added.
* fribidi.c: No more dependency on FRIBIDI_USE_MINI_GLIB flag.
2001-04-01 Behdad Esfahbod <behdad@bamdad.org>
* Makefile.noglib: fribidi_types.c added to sources.
* fribidi.c: Fixed a bug in free_rl_list() when USE_SIMPLE_MALLOC
was set, that caused core dumps.
* fribidi_main.c: Option --nomirror added.
* fribidi_mini_glib.h: Fixed a bug that caused core dumps, the bug
was in macro definition #define g_new(T, n) malloc(n * sizeof(T)),
that caused g_new(X, n + 1) allocate (n + (1 * sizeof(X))) instead
of ((n + 1) * sizeof(X))!, that should be
#define g_new(T, n) malloc((n) * sizeof(T)).
* fribidi_mini_glib.h: Does not set USE_SIMPLE_ALLOC anymore.
* fribidi.c: Use g_malloc when FRIBIDI_USE_MINI_GLIB is set, but
still use the free_type_link_list, for efficiency.
2001-03-31 Behdad Esfahbod <behdad@bamdad.org>
* fribidi_benchmark.c: #included <stdarg.h>, to compile under cygwin.
* fribidi.c, fribidi.h: Changed fribidi_log2vis_get_embedding_levels()
to return TRUE if successful and FALSE otherwise.
* fribidi.c: Function bidi_string_strlen() removed, because we
have not assumed that a fribidi string is ended with char 0.
Fixed all the bugs that roozbeh found and some more. Some more
debug information added. All internal functions defined as static.
* fribidi_main.c: Set to do not allocate visual array, if --novisual
options set.
* .indent.par: Added, it helps program "indent" to change the
appearance of sources to GNU style, each typedef should be added
to this file too.
2001-03-31 Roozbeh Pournader <roozbeh@sharif.edu>
* fribidi.c, fribidi_benchmark.c, fribidi_char_set_cap_rtl.c:
removed some unused variables.
* fribidi_char_sets*.c, fribidi_main.c: #included <string.h>.
* fribidi.c, fribidi_char_sets_cap_rtl.c: added some comment lines
to places that bugs probably exist. find with searching for "--RP".
* COPYING.LIB: renamed to COPYING (based on a recent suggestion on
GNU web site).
* bootstrap: removed lines that suppressed warnings about missing
COPYING.
2001-03-30 Roozbeh Pournader <roozbeh@sharif.edu>
* Makefile.noglib: replaced by a new version from Dan Kenigsberg
<danken@cs.technion.ac.il>.
* AUTHORS: added Dan Kenigsberg.
* '*.c', '*.h': changed all "//" comments to "/* */" pairs.
2001-03-30 Behdad Esfahbod <behdad@bamdad.org>
* fribidi.c, fribidi.h: Changed fribidi_log2vis() to return TRUE
if successful and FALSE otherwise.
* fribidi_main.c, fribidi_benchmark.c: Changed to use getopt library,
to handle command line parameters better.
* fribidi_main.c: Changed to if COLUMNS enviroment variable is
defined, use its value for text width.
2001-03-29 Behdad Esfahbod <behdad@bamdad.org>
* fribidi.c, fribidi_char_sets.h, fribidi_char_sets_cap_rtl.c,
fribidi_main.c, tests/test-CapRTL, tests/test-CapRTL.reference,
tests/test-hebrew, tests/test-hebrew.reference: Fixed a bug in
--clean that didn't remove RLM and LRM, and updated tests to reflect
this change.
* fribidi_main.c: Options --wltr and --wrtl added.
* TODO: A recently done task removed.
2001-03-29 Roozbeh Pournader <roozbeh@sharif.edu>
* fribidi-0.9.0: fribidi-0.9.0 released.
2001-03-28 Roozbeh Pournader <roozbeh@sharif.edu>
* bootstrap: swapped 'aclocal' and 'autoheader'. do not warn for
missing COPYING.
* COPYING: removed.
* COPYING.LIB: added.
* README, *.h, *.c, unidata/CreateGetType.pl: changes to reflect LGPL.
* Makefile.am: added 'bootstrap' to distribution.
2001-03-28 Behdad Esfahbod <behdad@bamdad.org>
* Makefile.am: New target "fribidi_tables.i" defined to download
"unidata/BidiMirroring.txt" and "unidata/PropList.txt" if not
available, and call "unidata/CreateGetType.pl" if needed to update
"fribidi_tables.i".
* fribidi_types.h, fribidi_types.c, fribidi_get_type.c,
unidata/CreateGetType.pl: Define symbol MEM_OPTIMIZED added to
make Dov happy :-), if MEM_OPTIMIZED defined, fribidi_tables.i
entries will be guint8 instead of gint to free 27KB extra memory
that was used to make fribidi use bitmasks, the overhead will be
three array lookups instead of two, in fribidi_get_type().
* fribidi_main.c: Options --verbose and --basedir added.
Options --test and --caprtl updated.
* conformance/test_gen.c: File name changed to
conformance/test_gen_explicit.c
* run.tests: Make to work with "make test" and "make check" when
making from other directories.
* fribidi.c: Rule L1 ("Reset the embedding levels") moved from
fribidi_log2vis() to fribidi_analyse_string(), to affect
fribidi_log2vis_get_embedding_levels() too. New functions
fribidi_mirroring_status() and fribidi_set_mirroring() added to
turn on or off mirroring (Rule L3). Changed to warn about too long
strings only if at least one of position_L_to_V_list or
position_V_to_L_list is asked.
* fribidi.h: Updated to reflect new functions in fribidi.c,
#include "config.h" removed, and added to each .c file that use it,
because config.h should not be included by other apps/libs.
* fribidi.c, fribidi_main.c, fribidi_benchmark.c: #included "config.h",
Now, --version options shows the options that library is compiled
with (DEBUG, MEM_OPTIMIZED, USE_SIMPLE_MALLOC, FRIBIDI_USE_MINI_GLIB).
* fribidi_types.h, fribidi.c, fribidi.h, fribidi_utils.c: TypeDefined
FriBidiStrIndex as guint16 and used for the type of
position_L_to_V_list and postition_V_to_L_list arrays.
2001-03-27 Roozbeh Pournader <roozbeh@sharif.edu>
* fribidi.h: Removed definition of PACKAGE and VERSION. #included
"config.h"
* Makefile.am: Make "make dist" work.
2001-03-27 Behdad Esfahbod <behdad@bamdad.org>
* fribidi.c, fribidi_types.h: Some bugs introduced in the last
changes removed, "Resolving weak types" rewritten, no known
conformance bugs. Defined macros for external use, changed their
name to have a prefix of FRIBIDI_.
* fribidi.c, fribidi.h: Function fribidi_remove_explicits() added
to remove the explicit marks from a fribidi string.
* fribidi.c: Fixed a bug that caused position_l_to_v and
position_v_to_l not to calculated correctly.
* fribidi.h: Defined symbols PACKAGE and VERSION manually, autoconf
should set them, but I don't know how to.
* fribidi_char_sets.c, fribidi_char_sets.h, fribidi_char_sets_*:
Each charset moved to a pair of .c/.h file. CapRTL defined as a
character set for testing with the reference implementation, with
explicit marks escape strings, beware that it differs from the old
capital rtl, it is a character set, only for test, with the property
that contains all character types in ascii characters. Some
functions defined to make charset conversion easy. An interface
designed for adding new charsets.
* fribidi_main.c: API revised, many new options added,
Default charset changed to UTF-8
Option --caprtl simulates the old style (same as --charset CapRTL)
Option --test simulates the old test_fribidi (same as --fill
--showinput --clean)
Option --clean now works for all charsets.
Option --fill implementated.
Options --version, --showinput, --ltov, --vtol, --levels, --changes,
--novisual, --charsetdesc added.
Now use the charset conventions, lots of code removed.
* test_fribidi.c: Got removed! `fribidi --test' should be used
instead.
* fribidi_benchmark: Explicit support added, now benchmarks with
two strings, one without explicit marks and one with them.
* run.tests, tests/test-CapRTL, tests/test-CapRTL.reference,
tests/test-explicit, tests/test-explicit.reference,
tests/test-hebrew, tests/test-hebrew.reference: New test datas
added, for better testing of weak types and explicit support. Test
outputs updated for the new CapRTL character set. Test output for
test-hebrew added.
* Makefile.in, Makefile.am: Updated to use fribidi instead of
test_fribidi for test targets. New files added.
* TODO: Some done tasks removed, some new tasks added!
2001-03-09 Dov Grobgeld <dov@orbotech.orbotech.co.il>
* fribidi_mini_glib.c, fribidi_mini_glib.h: Applied patch
received from Dan Kenigsberg <danken@cs.technion.ac.il> that
allows compiling fribidi without glib if the flag
FRIBIDI_USE_MINI_GLIB is turned on. This option is currently
turned on when compiling through Makefile.noglib .
* TODO: Added the task of making autoconf automatically turn
on FRIBIDI_USE_MINI_GLIB if glib isn't found.
2001-03-07 Behdad Esfahbod <behdad@bamdad.org>
* fribidi.c: Removed dead codes, many parts rewritten more efficient,
including Resolving Neutrals, Resolving Implicit Levels and ....
* fribidi_types.h: Almost redefined, to use bitfields for char types,
and many macros defined for efficient querying about char types.
Some unused char types removed, also char types L, R, N converted
to LTR, RTL and ON everywhere.
* CreateGetType.pl: Changed to define tables as arrays of
FriBidiCharType instead of guchar.
* conformance/: Updated some scripts for automatic testing with
reference implementation.
2001-02-19 Behdad Esfahbod <behdad@bamdad.org>
* fribidi.c: Added support for all explicit marks (embeddings and
overrides), it means rules X1 .. X10 of specification.
* fribidi.c: Added support for L1 rule of specification, it's
resetting the char type of some characters, just before reordering.
* fribidi.c: Added 'AL' to types that change the paragraph embedding
level, it previously only checked for 'R'.
* fribidi.c: Define symbol NO_STDIO changed to DEBUG, to turn on or
off all debug codes compile time, also a function fribidi_set_debug,
turns on and off the debug output generations in run time.
* fribidi.c: Added some more debug information, all debug informations
revised and go to stderr now.
* fribidi.c: Fixed a bug in rule W5, that is when some european
terminators are between some arabic letters and some european
numbers.
* fribidi_main.c: Added support for inputting explicit marks, in
CapRTL charset mode.
* fribidi_main.c: Added command line option for debug mode.
* fribidi_main.c: Fixed a small bug that would annoy when the size
of original string may be different to the derived one.
* fribidi_main.c: Fixed a small bug in padding when the size of the
out string was more than the page width.
* fribidi_types.h: Added some types needed for debug info.
2001-02-19 Roozbeh Pournader <roozbeh@sharif.edu>
* CreateGetType.pl: changed to use BidiMirroring.txt instead
of UnicodeData.txt.
2000-11-12 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Released fribidi-0.1.15.
* fribidi.c: [OZ] Applied Owen Taylor's patch from 2000-07-19 to
fribidi.c. The patch affects pp->prev rules for the last element
in cases W3 and W7.
* fribidi.c: [OZ] fribidi_log2vis() and
fribidi_log2vis_get_embedding_levels() now check for len==0 and if
so, they return immediately (instead of getting stuck).
* fribidi.c: [OZ] new_type_link() is now declared as
new_type_link(void) to prevent a compiler error message.
* fribidi.c: [OZ] The positions of the is_v2l_map and len
arguments in fribidi_map_range() prototype were switched around,
to conform to actual use in the source code file.
* fribidi.c: [OZ] The first argument to fribidi_is_char_rtl() was
changed from gint8 to guint8, to conform to data type returned by
fribidi_log2vis().
* fribidi.c: [OZ] bidi_string_strlen() now uses gint rather than int.
* fribidi.c: [OZ] bidi_string_reverse() now uses gint rather than int.
* fribidi.c: [OZ] int16_array_reverse() is now guint16_array_reverse().
* fribidi.c: Added define symbols NO_STDIO, FRIBIDI_MAX_STRING_LENGTH,
USE_SIMPLE_MALLOC that may be used to effect what code is being
generated.
* fribidi_char_sets.h, fribidi_char_sets.c: Added Omer Zaks more
general ut8 to unicode and unicode to ut8 functions.
* fribidi.c: [OZ] Replaced int to gint to better support embedded
libraries.
* Applied lots of code contributed by Omer Zak <omerz@actcom.co.il>
detailed above.
2000-10-14 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Released fribidi-0.1.14.
* CreateGetType.pl, fribidi_tables.i: Applied a patch received
from Roozbeh Pournader <roozbeh@sina.sharif.ac.ir> (who has got
quite some courage sending an email from Iran to Israel) which
updates the character tables according to UnicodeData-3.0.1.txt .
* fribidi_char_sets.c: Cleaned up the mess and made it compile!
2000-10-09 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Released fribidi-0.1.13 .
* acinclude.m4: Added file including a m4 macro for glib-2.0
as suggested by Owen Taylor.
* Makefile.am: Added acinclude.m4 to extra sources.
* configure.in: Changed it to use new macro.
2000-05-19 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* fribidi_char_sets.c: Added support for the LRM and RLM
characters for the iso-8859-8 converts at unused positions
0xFE and 0xFF .
* CreateGetType.pl, fribidi.c, fribidi_tables.i, fribidi_types.h:
Updated the algorithms to be consistance with the latest Unicode
Technical Report #9 release. Still no explicit overrides, but
hopefully the implicit algorithm now works according to the
specification.
* CreateGetType.pl, fribidi_tables.i: Overwrote the character
bidi-assignment of all non-assigned characters within blocks with
the property of the previous character in order to create a few
more reused secondary lookup character tables.
* CreateGetType.pl, fribidi.c, fribidi_tables.i: Added Owen
Taylor's speed patch that speeds up fribidi by a factor of 4!
Owen's patch consists of two parts. The first part is a double
table lookup scheme for accessing the character properties,
replacing the old binary search. The second part is a reuse of the
links in the character properties linked list in order to minimize
mallocs.
2000-05-02 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Released fribidi-0.1.11 .
* Fixed one remaining bug in Makefile.am.
2000-04-27 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Released fribidi-0.1.10 .
* Added libtool configuration added by Manish Singh.
* Added sevaral arabic charset converts contributed by Pablo
Saratxaga.
2000-03-20 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Released fribidi-0.1.9 .
2000-02-22 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* fribidi_types.h: Changed basic type FriBidiChar to guint32
which corresponds to UCS4, which is more reasonable to use.
2000-02-21 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* tests/test-capital-rtl: Added new tests to check percentage
signs and updated tests.reference to reflect this.
* fribidi.c(fribidi_analyse_string): Added the rule
EN,ET=>EN,EN which takes care of the problem of percentage
signs were put in the wrong place.
2000-02-20 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* fribidi.c: Fixed several memory leaks found by Owen Taylor.
2000-01-01 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Added documentation of the utility functions to fribidi.h .
1999-12-24 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Added new function fribidi_is_char_rtl() that uses the
embedding levels or the base dir to determine the resolved
direction of a character.
* Added new function fribidi_xpos_resolve() to fribidi_utils
that is needed in an gui interaction to resolve a mouse event
to the proper logical and visual positions.
1999-12-21 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Added patches for UTF8 support contributed by raphael@cs.uky.edu.
1999-12-05 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Added two new types FRIBIDI_TYPE_WL and FRIBIDI_TYPE_WR that
indicate weak directions. These directions are used if no strong
direction is found in the string.
* Changed analyse_string() to return base_type FRIBIDI_TYPE_N if
the base direction cannot be determined. It is then up to a higher
level protocol to determine the base direction.
1999-11-22 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Released version 0.1.7.
* Added arabic support contributed by Pablo Saratxaga.
1999-06-20 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Created file fribidi_utils.c which will be used for common
patterns that are common in Bidi supported programs.
1999-04-28 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Fixed bug in fribidi_log2vis which occured if only the v2l
array was requested and not the l2v array.
* Fixed bug in test_fribidi when using option test_vtol .
* Changed types in call to fribidi_log2vis to be more memory
conservative.
* Added single character translation functions to fribidi_char_sets.
1999-04-10 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Changed building to use glib-config as glib-1.2 is now released.
* Added some short cut optimizations.
* Cleaned up the TYPE_RULE_C macro and used in in lots of places.
1999-02-09 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Added ./ to the execution of test_fribidi in run.tests.
1999-02-08 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Released 0.1.3 to match the perl module FriBidi.
* Added length paramater to fribidi_unicode_to_iso8859_8().
* Fixed bug in fribidi.c related to zero length strings.
* Released 0.1.2.
* Added options -ltr and -rtl to fribidi to force LTR and RTL
directions.
* Added function fribidi_log2vis_get_embedding_levels() which
just returns an array of embedding levels.
* Added benchmark program.
* Added new check in test_fribidi that checks the changes
calculation.
* Changed interface to fribidi_log2vis() to include length of
string on input and the embedding level of output.
* Added function fribidi_find_string_changes() which finds the
bounding box of the changes between two FriBidiStrings.
1999-01-19 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Added the option -bol to fribidi_main.c to print out stuff
in the beginning of a line.
1999-01-14 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Released version 0.1.1
* Added program fribidi as a command line interface to the library.
1999-01-13 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Added flag -nopad to test_fribidi to make it not insert spaces.
* Make P1 rules (ES and CS) work only if the span of the ES or
the CS is 1. This is the same as in Hebrew Windoze.
* Replaced all the ET rules with the simpler ET,EN=>EN,EN
* Added `gtk-config --cflags` and `gtk-config -ldflags` to Makefile.am.
* Made test_fribidi read from stdin if no file given.
* Added options -outputonly to test_fribidi.
1999-01-11 Dov Grobgeld <dov@imagic.weizmann.ac.il>
* First Release!

2
HACKING Normal file
View file

@ -0,0 +1,2 @@
So you are interested in hacking GNU FriBidi? Great...
Join the mailing list and lets talk.

34
HISTORY Normal file
View file

@ -0,0 +1,34 @@
FriBidi was first developed by Dov Grobgeld of the Ivrix project, a few
releases happened there, up to 0.1.15. This was late 2000.
Behdad Esfahbod of the FarsiWeb project started reading and hacking FriBidi
in the same days. As per request of Roozbeh Pournader from the FarsiWeb
project, FriBidi development was moved to SourceForge (http://www.sf.net/),
under the same name (http://fribidi.sf.net/).
Behdad started applying patches in early 2001, and became the new
maintainer. He first aimed for full compliance of the standard, and then
applied the GNU Coding Standards. The effort was then released in the
Iranian New Year celebrations on 2001-03-29 as FriBidi 0.9.0.
Since then, FriBidi has been quite stable. A few other releases were made,
to fix bugs, code cleanup, etc which all led to the release of FriBidi
0.10.4 on 2002-05-19. It turned out to be quite stable, and is shipped by
several distributions these days (~2003).
Behdad promised a major redesign of the interface and the code to code, but
it almost never happened, at least not before Iranian New Years of March
2004. In the mean time, FriBidi was dubbed as a GNU package by Richard
Stallman. The first time was in 2002, and he mis-spelled it as "FreeBidi".
Next time in 2003 he addressed the correct name "FriBidi", but the
transition to gnu.org (http://www.gnu.org/) never happened, due to long
down-times of gnu.org due to several administrative problems.
GNU FriBidi was finally moved to the FreeDesktop project
(http://www.freedesktop.org), which it lives a peaceful life these days
(http://www.freedesktop.org/Software/FriBidi). Major cleanup made to the
build system, and was reimported from scratch in the FreeDesktop CVS. The
old CVS repository is still available under the "fribidi-sf.net" module.
You can find more details in the file ChangeLog.old in the GNU FriBidi CVS
repository.

96
Makefile.am Normal file
View file

@ -0,0 +1,96 @@
## -*- Automake -*-
## Process this file with automake to produce Makefile.in
##############################################################################
## $Id: Makefile.am,v 1.10 2005-08-25 18:35:34 behdad Exp $
## $Author: behdad $
## $Date: 2005-08-25 18:35:34 $
## $Revision: 1.10 $
## $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/Makefile.am,v $
##############################################################################
## The order of subdirs is important, don't change without a reason.
SUBDIRS = gen.tab charset lib bin doc test
EXTRA_DIST = bootstrap ChangeLog.old
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = @PACKAGE@.pc
BUILT_SOURCES = lib/fribidi-unicode-version.h
lib/fribidi-unicode-version.h:
(cd lib && $(MAKE) $(AM_MAKEFLAGS) fribidi-unicode-version.h)
MAINTAINERCLEANFILES = \
$(srcdir)/INSTALL \
$(srcdir)/aclocal.m4 \
$(srcdir)/autoscan.log \
$(srcdir)/compile \
$(srcdir)/config.guess \
$(srcdir)/config.h.in \
$(srcdir)/config.sub \
$(srcdir)/configure.scan \
$(srcdir)/depcomp \
$(srcdir)/install-sh \
$(srcdir)/ltmain.sh \
$(srcdir)/missing \
$(srcdir)/mkinstalldirs \
$(srcdir)/ChangeLog \
`find "$(srcdir)" -type f -name Makefile.in -print` \
`$(srcdir)/bootstrap --write-configure`
# The last line above is a horrible hack.
# GNU Coding Standards recommends that `make maintainer-clean' should not
# remove the configure script.
# We instead make configure call bootstrap.
# Indent all C source and header files, using indent(1):
indent: $(srcdir)/.indent.pro
cd "$(srcdir)" && \
find . -mindepth 2 -type f -name "*.[ch]" -print | \
xargs ./missing --run indent
.PHONY: indent
#
# ChangeLog generation
#
CHANGELOG_RANGE =
ChangeLog:
$(AM_V_GEN) if test -d "$(top_srcdir)/.git"; then \
(GIT_DIR=$(top_srcdir)/.git $(top_srcdir)/missing --run \
git log $(CHANGELOG_RANGE) --stat) | fmt --split-only > $@.tmp \
&& mv -f $@.tmp "$(srcdir)/ChangeLog" \
|| ($(RM) $@.tmp; \
echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \
(test -f $@ || echo git-log is required to generate this file >> "$(srcdir)/$@")); \
else \
test -f $@ || \
(echo A git checkout and git-log is required to generate ChangeLog >&2 && \
echo A git checkout and git-log is required to generate this file >> "$(srcdir)/$@"); \
fi
.PHONY: $(srcdir)/ChangeLog
#
# Release engineering
#
TAR_OPTIONS = --owner=0 --group=0
dist-hook: dist-clear-sticky-bits
# Clean up any sticky bits we may inherit from parent dir
dist-clear-sticky-bits:
chmod -R a-s $(distdir)
tar_file = $(PACKAGE_TARNAME)-$(VERSION).tar.bz2
sha256_file = $(tar_file).sha256
gpg_file = $(sha256_file).asc
$(sha256_file): $(tar_file)
sha256sum $^ > $@
$(gpg_file): $(sha256_file)
@echo "Please enter your GPG password to sign the checksum."
gpg --armor --sign $^
release-files: $(tar_file) $(sha256_file) $(gpg_file)
-include $(top_srcdir)/git.mk

66
NEWS Normal file
View file

@ -0,0 +1,66 @@
Overview of changes between 0.19.5 and 0.19.6
=============================================
* Fix two minor bidi bugs.
* Build with new libtool to support ppc64le.
Overview of changes between 0.19.4 and 0.19.5
=============================================
* Update to Unicode 6.2.0.
Overview of changes between 0.19.2 and 0.19.4
=============================================
* Update to Unicode 6.1.0.
* Misc fixes.
Overview of changes between 0.19.1 and 0.19.2
=============================================
* Update to Unicode Character Database 5.1.0
* Fixed bug in Arabic ligature table (bug #208870)
* Handle RLM/LRM in CP1255 charset converter. (bug #15328, Artyom)
Overview of changes between 0.10.9 and 0.19.1
=============================================
* This is the first release of the fribidi2 module in CVS, mostly
developed in 2004 and 2005.
* Support for Arabic joining/shaping added.
* API for correct handling of multi-line paragraphs added.
* Restructured code base.
* Supposed to be fully API/ABI compatible with 0.10 releases.
Please report if it is not.
Overview of changes between 0.10.8 and 0.10.9
=============================================
* Minor bugfix.
Overview of changes between 0.10.7 and 0.10.8
=============================================
* Update to Unicode Character Database 5.0.0
Overview of changes between 0.10.6 and 0.10.7
=============================================
* Nothing really. Just to fix my mess with 0.10.6 release (that never left
the door.)
Overview of changes between 0.10.5 and 0.10.6
=============================================
* Fixed type sizes when stdint.h is not available.
Overview of changes between 0.10.4 and 0.10.5
=============================================
* Unicode 4.1.0 character database used.
* Fixed type sizes on 64-bit architectures.
* We've become GNU FriBidi. Note capitalization please.
* We have moved to http://fribidi.org/, hosted on freedesktop.org.
Overview of changes between 0.10.2 and 0.10.4
=============================================
* Unicode 3.2 data files used.
Overview of changes between 0.10.1 and 0.10.2
=============================================
* Rule L3 of UAX#9 implemented. Now fribidi implements the whole Unicode
BiDi Algorithm.
* The autogenerated table files now contain much fewer symbols, which reduces
the relocation time of the library.
See ChangeLog for more descriptive list of changes.

153
README Normal file
View file

@ -0,0 +1,153 @@
This is GNU FriBidi
The Free Implementation of the Unicode Bidirectional Algorithm.
Background
==========
One of the missing links stopping the penetration of free software in Middle
East is the lack of support for the Arabic and Hebrew alphabets. In order to
have proper Arabic and Hebrew support, the BiDi algorithm should have been
implemented. It is our hope that this library will stimulate more free
software in the Middle Eastern countries.
Audience
========
It is our hope that this library will stimulate the implementation of Hebrew
and Arabic in lots of free software. Here is a small list of projects that
would benefit from the use of the GNU FriBidi library, but of course there are
many more: Wine, Mozilla, Qt, KDE, lynx, OpenOffice.
GNU FriBidi is already being used in projects like Pango (resulting in GTK+
and GNOME using GNU FriBidi), AbiWord, MLTerm, MPlayer, and BiCon.
Dependencies
============
Currently GNU FriBidi does not depend on any other library, but uses Glib if
available. It uses GNU Build System for build and installation on POSIX
systems.
Downloading
===========
The latest version of GNU FriBidi may be found at:
http://fribidi.org/
Building
========
See INSTALL for a description of how to build and install GNU FriBidi.
License
=========
GNU FriBidi 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.1
of the License, or (at your option) any later version.
GNU FriBidi 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 GNU FriBidi, in a file named COPYING; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
For licensing issues, contact <license@farsiweb.info>.
Implementation
==============
The library implements the algorithm described in the "Unicode Standard
Annex #9, The Bidirectional Algorithm", available at
http://www.unicode.org/unicode/reports/tr9/. GNU Fribidi has been tested
exhaustively against the Unicode Reference Code, and to the best of our
knowledge, it completely conforms to the specification, always producing
the same result as the Reference Code.
The library uses Unicode (UTF32) entirely. The character properties are
automatically extracted from the Unicode data files, available from:
http://www.unicode.org/Public/UNIDATA/
This means that every Unicode character is treated in strict accordance
with the Unicode specification.
There is a limited support for character set conversion from/to the UTF32
encoding. Data in these character sets must be converted into UTF32 before
the library may be used. iconv(3) can always do a better job on that, so you
may find that the character sets conversion code is typically turned off on
POSIX machines.
The reordering of characters is typically done through the function:
fribidi_boolean
fribidi_log2vis(/* input */
FriBidiChar *str,
FriBidiStrIndex len,
FriBidiCharType *pbase_dir,
/* output */
FriBidiChar *visual_str,
FriBidiStrIndex *position_L_to_V_list,
FriBidiStrIndex *position_V_to_L_list,
FriBidiLevel *embedding_level_list
)
where
str is the Unicode input string
len is the length of the unicode string
pbase_dir is the input and output base direction. If
base == FRIBIDI_TYPE_ON then fribidi_log2vis
calculates the base direction on its own
according to the BiDi algorithm.
visual_str The reordered output unicode string.
position_L_to_V_list Maps the positions in the logical string to
positions in the visual string.
position_V_to_L_list Maps the positions in the visual string to
the positions in the logical string.
embedding_level_list Returns the classification of each character. Even
levels indicate LTR characters, and odd levels
indicate RTL characters. The main use of this
list is in interactive applications when the
embedding e.g. level determines cursor display.
In any of the output pointers == NULL, then that information is not
calculated.
How it looks like
=================
Have a look at tests directory, to see some input and outputs, which
CapRTL charset means that CAPITAL letters are right to left, and digits
6, 7, 8, 9 are Arabic digits, try 'fribidi --charsetdesc CapRTL' for the
full description.
Executable
==========
There is also a command-line utilitity called fribidi that loops over
the text of a file and performs the BiDi algorithm on each line, also
used for testing the algorithm. Run fribidi with the --help option to
learn about usage. The command-line utility is known to have problems
with line-breaking and ltov/vtol lists.
Bugs and comments
=================
Report GNU FriBidi bugs at:
http://fribidi.org/bug
And send your comments to:
fribidi@freedesktop.org
Behdad Esfahbod
behdad@gnu.org

30
THANKS Normal file
View file

@ -0,0 +1,30 @@
Thanks to:
Behnam Esfahbod <behnam@esfahbod.info>
* Testing and auditing code.
And for the previous versions of FriBidi (pre 2002), thanks to:
Tomas Frydrych <tomas@frydrych.uklinux.net>
* Contirbuted patches for compiling GNU FriBidi under other OSes.
Dov Grobgeld <dov@imagic.weizmann.ac.il>
* Initial author, and maintainer before the 0.9 releases.
Franck Portaneri
* For the Mozilla BiDi languges support document;
Roozbeh Pournader <roozbeh@sharif.edu>
* Fixed things here and there.
Pablo Saratxaga <pablo@mandrakesoft.com>
* Contributed several Arabic charset converters.
Owen Tayler <otaylor@redhat.com>
* Contributed very important memory leak and speed patches.
Omer Zak <omerz@actcom.co.il>
* Contributed several bug fixes, and several considerations for
embedded systems.

88
TODO Normal file
View file

@ -0,0 +1,88 @@
Before release:
* Use gtk-doc?
* Implement fribidi_wcwidth()?
* Port fribidi-main.c to new API.
* help2man.
Implementation issues:
* Add API to get and pass on TypeLink*, to not allocate bidi levels.
Something like that. Also the UTF-8 stuff from pango/mini-fribidi.
* Explore vis2log.
* Clean caprtl2utf8 to do arbitrary charset conversion?
* add --output-charset.
* Update README, etc...
* Mix __attr... with DLLIMPORT?
* Update all files headers/footers. For c/h files, lib/fribidi-mirroring.[ch]
is always the reference.
* In fribidi_main.c reorder after line break.
* Change fribidi-main cmd-line parameters: --mirror --no-mirror... change the
defaults too.
* Add an option to fribidi_main.c to assume two consecutive returns as
paragraph separators.
* Add more tests. For:
- Checking that not removing explicit marks in analyze is not changing the
output in anyway.
- Tests with BN. Right now ^ is BN in CapRTL scheme.
- Test tables.
* indent: support function attributes and _PARAMS like things. Also
FRIBIDI_BEGIN_DECLS, and LIKELY.
* Cleanup gen.tab/gen-*.c files.
* Override pkgincludedir and append interface version. Should we go the GNOME
parallel install way?
* c2man: parse Author and Copyright from the whole file.
* Write texinfo documentation.
* Set up gnu.org web pages, and update the entry in Free Software Directory.
* Use gengetopt.
* Add FriBidiEnv functionality at compile time. Also, ifdef out the memory
cleanup stuff if asked to fail on memory allocation failure (xmalloc). When
this is done, FRIBIDI_GNUC_WARN_UNUSEDS can be turned off conditionally.
* Generate HTML and DVI documentation.
* Rewrite fribidi.spec.in
* Add make rules for lib/$(BUILT_SOURCES) to depend on gen.tab/ stuff?
* When called in interactive mode, fribidi cmd-line should greet, write
about copyrtight stuff, and shared-libs' version and Unicode version.
* Configure gen.tab/ with host=build to avoid cross-compiling table
generators.
* Replace test/run.tests with something better, Makefile foo, etc.
* Clean up README and NEWS, and check all files' headers. Write
gen.tab/README. Also add UniData license file.
From GNU Coding Standards:
* The distribution should contain a file named `README' which gives the name
of the package, and a general description of what it does. It is also good
to explain the purpose of each of the first-level subdirectories in the
package, if there are any. The `README' file should either state the version
number of the package, or refer to where in the package it can be found.
* Add ^L to all sources.

35
USERS Normal file
View file

@ -0,0 +1,35 @@
# List of projects known to use GNU FriBidi
#
#
# terminal emulation software:
#
BiCon: http://www.arabeyes.org/project.php?proj=BiCon # a bidirectional terminal emulation layer
mlterm: http://mlterm.sourceforge.net/ # a bidirectional terminal emulator
AbsoluteTelnet: http://www.celestialsoftware.net/support/online-help/8-terminalfeatures/27-bidirectional-text-support-rtl # a terminal emulator
#
# text rendering systems:
#
Pango: http://www.pango.org/ # text rendering engine. statically links
m17nlib: http://m17n.org/ # an i18n framework
#
# editors and word processors:
#
AbiWord: http://www.abisource.com/ # a word processor that handles RTL docs
Geresh: http://www.typo.co.il/~mooffie/geresh/ # a terminal-based editor capable of editing RTL text
Motor: http://konst.org.ua/en/motor/ # a terminal-based IDE capable of editing RTL text
#
# media players using fribidi to render RTL subtitles:
#
MPlayer: http://www.mplayerhq.hu/ # movie player capable of showing RTL subtitles
vlc: http://www.videolan.org/vlc/ # another media player capable of showing RTL subtitles
dvdauthor: http://dvdauthor.sourceforge.net/ # DVD authoring tool that renders RTL subtitles
#
# misc:
#
CenterICQ: http://konst.org.ua/centericq/ # an ICQ client, capable of showing RTL messages
bidiv: http://www.iglu.org.il/faq/cache/153.html # cmdline tool to display RTL text files on consoles without RTL support
ksvg: http://svg.kde.org/ # SVG renderer capable of rendering RTL text
fvwm: http://www.fvwm.org/ # a window manager with RTL text handling
Nano-X: http://www.microwindows.org/ # a tiny window system
HebrewService: http://mac.plonter.co.il/plonwiki/HebrewService # Mac OS X service to convert visual Hebrew (iso8859-8) to logical order
Nokia 9110 Hebrew Support: http://www.zak.co.il/gpl/geos/9110Hebrew.html # uses to render Hebrew SMS messages

2
bin/.cvsignore Normal file
View file

@ -0,0 +1,2 @@
fribidi
fribidi-benchmark

30
bin/Makefile.am Normal file
View file

@ -0,0 +1,30 @@
bin_PROGRAMS = fribidi
noinst_PROGRAMS = fribidi-benchmark fribidi-bidi-types
if FRIBIDI_CHARSETS
noinst_PROGRAMS += fribidi-caprtl2utf8
endif
getopt_SOURCES = getopt.c getopt1.c getopt_int.h getopt.h gettext.h
fribidi_SOURCES = fribidi-main.c $(getopt_SOURCES)
fribidi_benchmark_SOURCES = fribidi-benchmark.c $(getopt_SOURCES)
AM_CPPFLAGS = \
-I$(top_builddir)/lib \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/charset \
$(MISC_CFLAGS)
LDADD = $(top_builddir)/lib/libfribidi.la $(MISC_LIBS)
if FRIBIDI_CHARSETS
else # !FRIBIDI_CHARSETS
LDADD += $(top_builddir)/charset/libfribidi-char-sets.la
endif # !FRIBIDI_CHARSETS
$(top_builddir)/lib/libfribidi.la:
cd $(top_builddir)/lib && $(MAKE) $(AM_MAKEFLAGS) libfribidi.la
-include $(top_srcdir)/git.mk

302
bin/fribidi-benchmark.c Normal file
View file

@ -0,0 +1,302 @@
/* FriBidi
* fribidi-benchmark.c - command line benchmark tool for libfribidi
*
* $Id: fribidi-benchmark.c,v 1.8 2009-04-14 03:49:52 behdad Exp $
* $Author: behdad $
* $Date: 2009-04-14 03:49:52 $
* $Revision: 1.8 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/bin/fribidi-benchmark.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include <common.h>
#include <fribidi.h>
#include <stdio.h>
#if STDC_HEADERS+0
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#if HAVE_STRING_H+0
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#if HAVE_STRINGS_H+0
# include <strings.h>
#endif
#if HAVE_SYS_TIMES_H+0
# include <sys/times.h>
#endif
#ifdef _WIN32
#include <windows.h>
#endif /* _WIN32 */
#include "getopt.h"
#define appname "fribidi_benchmark"
#define MAX_STR_LEN 1000
#define NUM_ITER 2000
static void
die2 (
const char *fmt,
const char *arg
)
{
fprintf (stderr, "%s: ", appname);
if (fmt)
fprintf (stderr, fmt, arg);
fprintf (stderr, "Try `%s --help' for more information.\n", appname);
exit (-1);
}
#define TEST_STRING \
"a THE QUICK -123,456 (FOX JUMPS ) DOG the quick !1@7#4&5^ over the dog " \
"123,456 OVER THE 5%+ 4.0 LAZY"
#define TEST_STRING_EXPLICIT \
"this is _LJUST_o a _lsimple _Rte%ST_o th_oat HAS A _LPDF missing" \
"AnD hOw_L AbOuT, 123,987 tHiS_o a GO_oOD - _L_oTE_oST. " \
"here_L is_o_o_o _R a good one_o And _r 123,987_LT_oHE_R next_o oNE:" \
"_R_r and the last _LONE_o IS THE _rbest _lONE and" \
"a _L_L_L_LL_L_L_L_L_L_L_L_L_Rbug_o_o_o_o_o_o" \
"_R_r and the last _LONE_o IS THE _rbest _lONE and" \
"A REAL BIG_l_o BUG! _L _l_r_R_L_laslaj siw_o_Rlkj sslk" \
"a _L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_L_Rbug" \
"here_L is_o_o_o _R ab one_o _r 123,987_LT_oHE_R t_o oNE:" \
static void
help (
void
)
{
printf
("Usage: " appname " [OPTION]...\n"
"A program for benchmarking the speed of the " FRIBIDI_NAME
" library.\n" "\n"
" -h, --help Display this information and exit\n"
" -V, --version Display version information and exit\n"
" -n, --niter N Number of iterations. Default is %d.\n"
"\nReport bugs online at\n<" FRIBIDI_BUGREPORT ">.\n", NUM_ITER);
exit (0);
}
static void
version (
void
)
{
printf (appname " %s", fribidi_version_info);
exit (0);
}
static double
utime (
void
)
{
#ifdef _WIN32
FILETIME creationTime, exitTime, kernelTime, userTime;
HANDLE currentProcess = GetCurrentProcess();
if (GetProcessTimes(currentProcess, &creationTime, &exitTime, &kernelTime, &userTime))
{
unsigned __int64 myTime = userTime.dwHighDateTime;
myTime = (myTime << 32) | userTime.dwLowDateTime;
return 1e-7 * myTime;
}
else
return 0.0;
#else /* !_WIN32 */
#if HAVE_SYS_TIMES_H+0
struct tms tb;
times (&tb);
return 0.01 * tb.tms_utime;
#else
#warning Please fill in here to use other functions for determining time.
return 0.0;
#endif
#endif
}
static void
benchmark (
const char *S_,
int niter
)
{
int len, i;
FriBidiChar us[MAX_STR_LEN], out_us[MAX_STR_LEN];
FriBidiStrIndex positionLtoV[MAX_STR_LEN], positionVtoL[MAX_STR_LEN];
FriBidiLevel embedding_list[MAX_STR_LEN];
FriBidiParType base;
double time0, time1;
{
int j;
len = strlen (S_);
for (i = 0, j = 0; i < len; i++)
{
if (S_[i] == '_')
switch (S_[++i])
{
case '>':
us[j++] = FRIBIDI_CHAR_LRM;
break;
case '<':
us[j++] = FRIBIDI_CHAR_RLM;
break;
case 'l':
us[j++] = FRIBIDI_CHAR_LRE;
break;
case 'r':
us[j++] = FRIBIDI_CHAR_RLE;
break;
case 'L':
us[j++] = FRIBIDI_CHAR_LRO;
break;
case 'R':
us[j++] = FRIBIDI_CHAR_RLO;
break;
case 'o':
us[j++] = FRIBIDI_CHAR_PDF;
break;
case '_':
us[j++] = '_';
break;
default:
us[j++] = '_';
i--;
break;
}
else
us[j++] = S_[i];
if (us[j] >= 'A' && us[j] <= 'F')
us[j] += FRIBIDI_CHAR_ARABIC_ALEF - 'A';
else if (us[j] >= 'G' && us[j] <= 'Z')
us[j] += FRIBIDI_CHAR_HEBREW_ALEF - 'G';
else if (us[j] >= '6' && us[j] <= '9')
us[j] += FRIBIDI_CHAR_ARABIC_ZERO - '0';
}
len = j;
}
/* Start timer */
time0 = utime ();
for (i = 0; i < niter; i++)
{
/* Create a bidi string */
base = FRIBIDI_PAR_ON;
if (!fribidi_log2vis (us, len, &base,
/* output */
out_us, positionVtoL, positionLtoV,
embedding_list))
die2
("something failed in fribidi_log2vis.\n"
"perhaps memory allocation failure.", NULL);
}
/* stop timer */
time1 = utime ();
/* output result */
printf ("Length = %d\n", len);
printf ("Iterations = %d\n", niter);
printf ("%d len*iterations in %f seconds\n", len * niter, time1 - time0);
printf ("= %.0f kilo.length.iterations/second\n",
1.0 * len * niter / 1000 / (time1 - time0));
return;
}
int
main (
int argc,
char *argv[]
)
{
int niter = NUM_ITER;
/* Parse the command line */
argv[0] = appname;
while (1)
{
int option_index = 0, c;
static struct option long_options[] = {
{"help", 0, 0, 'h'},
{"version", 0, 0, 'V'},
{"niter", 0, 0, 'n'},
{0, 0, 0, 0}
};
c = getopt_long (argc, argv, "hVn:", long_options, &option_index);
if (c == -1)
break;
switch (c)
{
case 0:
break;
case 'h':
help ();
break;
case 'V':
version ();
break;
case 'n':
niter = atoi (optarg);
if (niter <= 0)
die2 ("invalid number of iterations `%s'\n", optarg);
break;
case ':':
case '?':
die2 (NULL, NULL);
break;
default:
break;
}
}
printf ("* Without explicit marks:\n");
benchmark (TEST_STRING, niter);
printf ("\n");
printf ("* With explicit marks:\n");
benchmark (TEST_STRING_EXPLICIT, niter);
return 0;
}
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

17
bin/fribidi-bidi-types.c Normal file
View file

@ -0,0 +1,17 @@
#include <stdio.h>
#include <fribidi.h>
int
main (
void
)
{
FriBidiChar c;
for (c = 0; c < FRIBIDI_UNICODE_CHARS; c++)
printf ("0x%04lX %s\n", (long) c,
fribidi_get_bidi_type_name (fribidi_get_bidi_type (c)));
return 0;
}

35
bin/fribidi-caprtl2utf8.c Normal file
View file

@ -0,0 +1,35 @@
#include <stdio.h>
#include <string.h>
#include <fribidi.h>
char buf[BUFSIZ];
FriBidiChar ubuf[BUFSIZ];
int
main (
void
)
{
FriBidiCharSet caprtl = fribidi_parse_charset ("CapRTL");
FriBidiCharSet utf8 = fribidi_parse_charset ("UTF-8");
while (fgets (buf, sizeof buf, stdin))
{
char eol[5];
FriBidiStrIndex len = strlen (buf);
while (len && (buf[len - 1] == '\n' || buf[len - 1] == '\r'))
len--;
strncpy (eol, buf + len, sizeof eol);
buf[len] = 0;
len = fribidi_charset_to_unicode (caprtl, buf, len, ubuf);
fprintf (stderr, "%d\n", len);
len = fribidi_unicode_to_charset (utf8, ubuf, len, buf);
buf[len] = 0;
printf ("%s%s", buf, eol);
}
return 0;
}

625
bin/fribidi-main.c Normal file
View file

@ -0,0 +1,625 @@
/* FriBidi
* fribidi-main.c - command line program for libfribidi
*
* $Id: fribidi-main.c,v 1.15 2006-01-31 03:23:12 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:12 $
* $Revision: 1.15 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/bin/fribidi-main.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include <common.h>
#include <fribidi.h>
#if FRIBIDI_CHARSETS+0
#else
# if FRIBIDI_MAIN_USE_ICONV_H
# include <iconv.h>
# else /* !FRIBIDI_MAIN_USE_ICONV_H */
# include <fribidi-char-sets.h>
# endif /* FRIBIDI_MAIN_USE_ICONV_H */
#endif /* !FRIBIDI_CHARSETS */
#include <stdio.h>
#if STDC_HEADERS+0
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#if HAVE_STRING_H+0
# if STDC_HEADERS && HAVE_MEMORY_H
# else
# include <memory.h>
# endif
# include <string.h>
#endif
#if HAVE_STRINGS_H+0
# include <strings.h>
#endif
#include "getopt.h"
#define appname "fribidi"
#define MAX_STR_LEN 65000
#define ALLOCATE(tp,ln) ((tp *) fribidi_malloc (sizeof (tp) * (ln)))
static void
die2 (
const char *fmt,
const char *arg
)
{
fprintf (stderr, "%s: ", appname);
if (fmt)
fprintf (stderr, fmt, arg);
fprintf (stderr, "Try `%s --help' for more information.\n", appname);
exit (-1);
}
#define die1(msg) die2("%s", msg)
fribidi_boolean do_break, do_pad, do_mirror, do_reorder_nsm, do_clean;
fribidi_boolean show_input, show_visual, show_basedir;
fribidi_boolean show_ltov, show_vtol, show_levels;
const int default_text_width = 80;
int text_width;
const char *char_set;
const char *bol_text, *eol_text;
FriBidiParType input_base_direction;
#if FRIBIDI_MAIN_USE_ICONV_H+0
iconv_t to_ucs4, from_ucs4;
#else /* !FRIBIDI_MAIN_USE_ICONV_H */
int char_set_num;
#endif /* !FRIBIDI_MAIN_USE_ICONV_H */
static void
help (
void
)
{
/* Break help string into little ones, to assure ISO C89 conformance */
printf ("Usage: " appname " [OPTION]... [FILE]...\n"
"A command line interface for the " FRIBIDI_NAME " library.\n"
"Convert a logical string to visual.\n"
"\n"
" -h, --help Display this information and exit\n"
" -V, --version Display version information and exit\n"
" -v, --verbose Verbose mode, same as --basedir --ltov --vtol\n"
" --levels --changes\n");
printf (" -d, --debug Output debug information\n"
" -t, --test Test " FRIBIDI_NAME
", same as --clean --nobreak\n"
" --showinput --reordernsm --width %d\n",
default_text_width);
#if FRIBIDI_MAIN_USE_ICONV_H+0
printf (" -c, --charset CS Specify character set, default is %s.\n"
" CS should be a valid iconv character set name\n",
char_set);
#else /* !FRIBIDI_MAIN_USE_ICONV_H */
printf (" -c, --charset CS Specify character set, default is %s\n"
" --charsetdesc CS Show descriptions for character set CS and exit\n"
" --caprtl Old style: set character set to CapRTL\n",
char_set);
#endif /* !FRIBIDI_MAIN_USE_ICONV_H */
printf (" --showinput Output the input string too\n"
" --nopad Do not right justify RTL lines\n"
" --nobreak Do not break long lines\n"
" -w, --width W Screen width for padding, default is %d, but if\n"
" environment variable COLUMNS is defined, its value\n"
" will be used, --width overrides both of them.\n",
default_text_width);
printf
(" -B, --bol BOL Output string BOL before the visual string\n"
" -E, --eol EOL Output string EOL after the visual string\n"
" --rtl Force base direction to RTL\n"
" --ltr Force base direction to LTR\n"
" --wrtl Set base direction to RTL if no strong character found\n");
printf
(" --wltr Set base direction to LTR if no strong character found\n"
" (default)\n"
" --nomirror Turn mirroring off, to do it later\n"
" --reordernsm Reorder NSM sequences to follow their base character\n"
" --clean Remove explicit format codes in visual string\n"
" output, currently does not affect other outputs\n"
" --basedir Output Base Direction\n");
printf (" --ltov Output Logical to Visual position map\n"
" --vtol Output Visual to Logical position map\n"
" --levels Output Embedding Levels\n"
" --novisual Do not output the visual string, to be used with\n"
" --basedir, --ltov, --vtol, --levels, --changes\n");
printf (" All string indexes are zero based\n" "\n" "Output:\n"
" For each line of input, output something like this:\n"
" [input-str` => '][BOL][[padding space]visual-str][EOL]\n"
" [\\n base-dir][\\n ltov-map][\\n vtol-map][\\n levels][\\n changes]\n");
#if FRIBIDI_MAIN_USE_ICONV_H+0
#else
{
int i;
printf ("\n" "Available character sets:\n");
for (i = 1; i <= FRIBIDI_CHAR_SETS_NUM; i++)
printf (" * %-10s: %-25s%1s\n",
fribidi_char_set_name (i), fribidi_char_set_title (i),
(fribidi_char_set_desc (i) ? "X" : ""));
printf
(" X: Character set has descriptions, use --charsetdesc to see\n");
}
#endif /* !FRIBIDI_MAIN_USE_ICONV_H */
printf ("\nReport bugs online at\n<" FRIBIDI_BUGREPORT ">.\n");
exit (0);
}
static void
version (
void
)
{
printf (appname " %s", fribidi_version_info);
exit (0);
}
static char *
my_fribidi_strdup (
char *s
)
{
char *m;
m = fribidi_malloc (strlen (s) + 1);
if (!m)
return NULL;
strcpy (m, s);
return m;
}
int
main (
int argc,
char *argv[]
)
{
int exit_val;
fribidi_boolean file_found;
char *s;
FILE *IN;
text_width = default_text_width;
do_break = true;
do_pad = true;
do_mirror = true;
do_clean = false;
do_reorder_nsm = false;
show_input = false;
show_visual = true;
show_basedir = false;
show_ltov = false;
show_vtol = false;
show_levels = false;
char_set = "UTF-8";
bol_text = NULL;
eol_text = NULL;
input_base_direction = FRIBIDI_PAR_ON;
if ((s = (char *) getenv ("COLUMNS")))
{
int i;
i = atoi (s);
if (i > 0)
text_width = i;
}
#define CHARSETDESC 257
#define CAPRTL 258
/* Parse the command line with getopt library */
/* Must set argv[0], getopt uses it to generate error messages */
argv[0] = appname;
while (1)
{
int option_index = 0, c;
static struct option long_options[] = {
{"help", 0, 0, 'h'},
{"version", 0, 0, 'V'},
{"verbose", 0, 0, 'v'},
{"debug", 0, 0, 'd'},
{"test", 0, 0, 't'},
{"charset", 1, 0, 'c'},
#if FRIBIDI_MAIN_USE_ICONV_H+0
#else
{"charsetdesc", 1, 0, CHARSETDESC},
{"caprtl", 0, 0, CAPRTL},
#endif /* FRIBIDI_MAIN_USE_ICONV_H */
{"showinput", 0, (int *) (void *) &show_input, true},
{"nopad", 0, (int *) (void *) &do_pad, false},
{"nobreak", 0, (int *) (void *) &do_break, false},
{"width", 1, 0, 'w'},
{"bol", 1, 0, 'B'},
{"eol", 1, 0, 'E'},
{"nomirror", 0, (int *) (void *) &do_mirror, false},
{"reordernsm", 0, (int *) (void *) &do_reorder_nsm, true},
{"clean", 0, (int *) (void *) &do_clean, true},
{"ltr", 0, (int *) (void *) &input_base_direction, FRIBIDI_PAR_LTR},
{"rtl", 0, (int *) (void *) &input_base_direction, FRIBIDI_PAR_RTL},
{"wltr", 0, (int *) (void *) &input_base_direction,
FRIBIDI_PAR_WLTR},
{"wrtl", 0, (int *) (void *) &input_base_direction,
FRIBIDI_PAR_WRTL},
{"basedir", 0, (int *) (void *) &show_basedir, true},
{"ltov", 0, (int *) (void *) &show_ltov, true},
{"vtol", 0, (int *) (void *) &show_vtol, true},
{"levels", 0, (int *) (void *) &show_levels, true},
{"novisual", 0, (int *) (void *) &show_visual, false},
{0, 0, 0, 0}
};
c =
getopt_long (argc, argv, "hVvdtc:w:B:E:", long_options,
&option_index);
if (c == -1)
break;
switch (c)
{
case 0:
break;
case 'h':
help ();
break;
case 'V':
version ();
break;
case 'v':
show_basedir = show_ltov = show_vtol = show_levels = true;
break;
case 'w':
text_width = atoi (optarg);
if (text_width <= 0)
die2 ("invalid screen width `%s'\n", optarg);
break;
case 'B':
bol_text = optarg;
break;
case 'E':
eol_text = optarg;
break;
case 'd':
if (!fribidi_set_debug (true))
die1
("lib" FRIBIDI
" must be compiled with DEBUG option to enable\nturn debug info on.\n");
break;
case 't':
do_clean = show_input = do_reorder_nsm = true;
do_break = false;
text_width = default_text_width;
break;
case 'c':
char_set = my_fribidi_strdup (optarg);
if (!char_set)
die1 ("memory allocation failed for char_set!");
break;
#if FRIBIDI_MAIN_USE_ICONV_H+0
#else
case CAPRTL:
char_set = "CapRTL";
break;
case CHARSETDESC:
char_set = optarg;
char_set_num = fribidi_parse_charset (char_set);
if (!char_set_num)
die2 ("unrecognized character set `%s'\n", char_set);
if (!fribidi_char_set_desc (char_set_num))
die2 ("no description available for character set `%s'\n",
fribidi_char_set_name (char_set_num));
else
printf ("Descriptions for character set %s:\n"
"\n" "%s", fribidi_char_set_title (char_set_num),
fribidi_char_set_desc (char_set_num));
exit (0);
break;
#endif /* !FRIBIDI_MAIN_USE_ICONV_H */
case ':':
case '?':
die2 (NULL, NULL);
break;
default:
break;
}
}
#if FRIBIDI_MAIN_USE_ICONV_H+0
to_ucs4 = iconv_open ("WCHAR_T", char_set);
from_ucs4 = iconv_open (char_set, "WCHAR_T");
#else /* !FRIBIDI_MAIN_USE_ICONV_H */
char_set_num = fribidi_parse_charset (char_set);
#endif /* !FRIBIDI_MAIN_USE_ICONV_H */
#if FRIBIDI_MAIN_USE_ICONV_H+0
if (to_ucs4 == (iconv_t) (-1) || from_ucs4 == (iconv_t) (-1))
#else /* !FRIBIDI_MAIN_USE_ICONV_H */
if (!char_set_num)
#endif /* !FRIBIDI_MAIN_USE_ICONV_H */
die2 ("unrecognized character set `%s'\n", char_set);
fribidi_set_mirroring (do_mirror);
fribidi_set_reorder_nsm (do_reorder_nsm);
exit_val = 0;
file_found = false;
while (optind < argc || !file_found)
{
const char *filename;
filename = optind < argc ? argv[optind++] : "-";
file_found = true;
/* Open the infile for reading */
if (filename[0] == '-' && !filename[1])
{
IN = stdin;
}
else
{
IN = fopen (filename, "r");
if (!IN)
{
fprintf (stderr, "%s: %s: no such file or directory\n",
appname, filename);
exit_val = 1;
continue;
}
}
/* Read and process input one line at a time */
{
char S_[MAX_STR_LEN];
int padding_width, break_width;
padding_width = show_input ? (text_width - 10) / 2 : text_width;
break_width = do_break ? padding_width : 3 * MAX_STR_LEN;
while (fgets (S_, sizeof (S_) - 1, IN))
{
const char *new_line, *nl_found;
FriBidiChar logical[MAX_STR_LEN];
char outstring[MAX_STR_LEN];
FriBidiParType base;
FriBidiStrIndex len;
nl_found = "";
S_[sizeof (S_) - 1] = 0;
len = strlen (S_);
/* chop */
if (S_[len - 1] == '\n')
{
len--;
S_[len] = '\0';
new_line = "\n";
}
else
new_line = "";
/* TODO: handle \r */
#if FRIBIDI_MAIN_USE_ICONV_H+0
{
char *st = S_, *ust = (char *) logical;
int in_len = (int) len;
len = sizeof logical;
iconv (to_ucs4, &st, &in_len, &ust, (int *) &len);
len = (FriBidiChar *) ust - logical;
}
#else /* !FRIBIDI_MAIN_USE_ICONV_H */
len = fribidi_charset_to_unicode (char_set_num, S_, len, logical);
#endif /* !FRIBIDI_MAIN_USE_ICONV_H */
{
FriBidiChar *visual;
FriBidiStrIndex *ltov, *vtol;
FriBidiLevel *levels;
FriBidiStrIndex new_len;
fribidi_boolean log2vis;
visual = show_visual ? ALLOCATE (FriBidiChar,
len + 1
) : NULL;
ltov = show_ltov ? ALLOCATE (FriBidiStrIndex,
len + 1
) : NULL;
vtol = show_vtol ? ALLOCATE (FriBidiStrIndex,
len + 1
) : NULL;
levels = show_levels ? ALLOCATE (FriBidiLevel,
len + 1
) : NULL;
/* Create a bidi string. */
base = input_base_direction;
log2vis = fribidi_log2vis (logical, len, &base,
/* output */
visual, ltov, vtol, levels);
if (log2vis)
{
if (show_input)
printf ("%-*s => ", padding_width, S_);
new_len = len;
/* Remove explicit marks, if asked for. */
if (do_clean)
len =
fribidi_remove_bidi_marks (visual, len, ltov, vtol,
levels);
if (show_visual)
{
printf ("%s", nl_found);
if (bol_text)
printf ("%s", bol_text);
/* Convert it to input charset and print. */
{
FriBidiStrIndex idx, st;
for (idx = 0; idx < len;)
{
FriBidiStrIndex wid, inlen;
wid = break_width;
st = idx;
#if FRIBIDI_MAIN_USE_ICONV_H+0
#else
if (char_set_num != FRIBIDI_CHAR_SET_CAP_RTL)
#endif /* !FRIBIDI_MAIN_USE_ICONV_H */
while (wid > 0 && idx < len)
{
wid -=
FRIBIDI_IS_EXPLICIT_OR_BN_OR_NSM
(fribidi_get_bidi_type (visual[idx])) ? 0
: 1;
idx++;
}
#if FRIBIDI_MAIN_USE_ICONV_H+0
#else
else
while (wid > 0 && idx < len)
{
wid--;
idx++;
}
#endif /* !FRIBIDI_MAIN_USE_ICONV_H */
if (wid < 0 && idx - st > 1)
idx--;
inlen = idx - st;
#if FRIBIDI_MAIN_USE_ICONV_H+0
{
char *str = outstring, *ust =
(char *) (visual + st);
int in_len = inlen * sizeof visual[0];
new_len = sizeof outstring;
iconv (from_ucs4, &ust, &in_len, &str,
(int *) &new_len);
*str = '\0';
new_len = str - outstring;
}
#else /* !FRIBIDI_MAIN_USE_ICONV_H */
new_len =
fribidi_unicode_to_charset (char_set_num,
visual + st, inlen,
outstring);
#endif /* !FRIBIDI_MAIN_USE_ICONV_H */
if (FRIBIDI_IS_RTL (base))
printf ("%*s",
(int) (do_pad ? (padding_width +
strlen (outstring) -
(break_width -
wid)) : 0),
outstring);
else
printf ("%s", outstring);
if (idx < len)
printf ("\n");
}
}
if (eol_text)
printf ("%s", eol_text);
nl_found = "\n";
}
if (show_basedir)
{
printf ("%s", nl_found);
printf ("Base direction: %s",
(FRIBIDI_DIR_TO_LEVEL (base) ? "R" : "L"));
nl_found = "\n";
}
if (show_ltov)
{
FriBidiStrIndex i;
printf ("%s", nl_found);
for (i = 0; i < len; i++)
printf ("%ld ", (long) ltov[i]);
nl_found = "\n";
}
if (show_vtol)
{
FriBidiStrIndex i;
printf ("%s", nl_found);
for (i = 0; i < len; i++)
printf ("%ld ", (long) vtol[i]);
nl_found = "\n";
}
if (show_levels)
{
FriBidiStrIndex i;
printf ("%s", nl_found);
for (i = 0; i < len; i++)
printf ("%d ", (int) levels[i]);
nl_found = "\n";
}
}
else
{
exit_val = 2;
}
if (show_visual)
free (visual);
if (show_ltov)
free (ltov);
if (show_vtol)
free (vtol);
if (show_levels)
free (levels);
}
if (*nl_found)
printf ("%s", new_line);
}
}
}
return exit_val;
}
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

1268
bin/getopt.c Normal file

File diff suppressed because it is too large Load diff

187
bin/getopt.h Normal file
View file

@ -0,0 +1,187 @@
/* Declarations for getopt.
Copyright (C) 1989-1994,1996-1999,2001,2003,2004
Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02110-1301, USA. */
#ifndef _GETOPT_H
#ifndef __need_getopt
# define _GETOPT_H 1
#endif
/* If __GNU_LIBRARY__ is not already defined, either we are being used
standalone, or this is the first header included in the source file.
If we are being used with glibc, we need to include <features.h>, but
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
not defined, include <ctype.h>, which will pull in <features.h> for us
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
doesn't flood the namespace with stuff the way some other headers do.) */
#if !defined __GNU_LIBRARY__
# include <ctype.h>
#endif
#ifndef __THROW
# ifndef __GNUC_PREREQ
# define __GNUC_PREREQ(maj, min) (0)
# endif
# if defined __cplusplus && __GNUC_PREREQ (2,8)
# define __THROW throw ()
# else
# define __THROW
# endif
#endif
#ifdef __cplusplus
extern "C"
{
#endif
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
extern int opterr;
/* Set to an option character which was unrecognized. */
extern int optopt;
#ifndef __need_getopt
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
zero.
The field `has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to
a compiled-in constant, such as set a value from `optarg', set the
option's `flag' field to zero and its `val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
struct option
{
const char *name;
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the `has_arg' field of `struct option'. */
# define no_argument 0
# define required_argument 1
# define optional_argument 2
#endif /* need getopt */
/* Get definitions and prototypes for functions to process the
arguments in ARGV (ARGC of them, minus the program name) for
options given in OPTS.
Return the option character from OPTS just read. Return -1 when
there are no more options. For unrecognized options, or options
missing arguments, `optopt' is set to the option letter, and '?' is
returned.
The OPTS string is a list of characters which are recognized option
letters, optionally followed by colons, specifying that that letter
takes an argument, to be placed in `optarg'.
If a letter in OPTS is followed by two colons, its argument is
optional. This behavior is specific to the GNU `getopt'.
The argument `--' causes premature termination of argument
scanning, explicitly telling `getopt' that there are no more
options.
If OPTS begins with `--', then non-option arguments are treated as
arguments to the option '\0'. This behavior is specific to the GNU
`getopt'. */
#ifdef __GNU_LIBRARY__
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int getopt (
int ___argc,
char *const *___argv,
const char *__shortopts
) __THROW;
#else /* not __GNU_LIBRARY__ */
extern int getopt (
);
#endif /* __GNU_LIBRARY__ */
#ifndef __need_getopt
extern int getopt_long (
int ___argc,
char *const *___argv,
const char *__shortopts,
const struct option *__longopts,
int *__longind
) __THROW;
extern int getopt_long_only (
int ___argc,
char *const *___argv,
const char *__shortopts,
const struct option *__longopts,
int *__longind
) __THROW;
#endif
#ifdef __cplusplus
}
#endif
/* Make sure we later can get all the definitions and declarations. */
#undef __need_getopt
#endif /* getopt.h */

213
bin/getopt1.c Normal file
View file

@ -0,0 +1,213 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004
Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef _LIBC
# include <getopt.h>
#else
# include "getopt.h"
#endif
#include "getopt_int.h"
#include <stdio.h>
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#define GETOPT_INTERFACE_VERSION 2
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
#include <gnu-versions.h>
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
#define ELIDE_CODE
#endif
#endif
#ifndef ELIDE_CODE
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
#include <stdlib.h>
#endif
#ifndef NULL
#define NULL 0
#endif
int
getopt_long (
int argc,
char *const *argv,
const char *options,
const struct option *long_options,
int *opt_index
)
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
}
int
_getopt_long_r (
int argc,
char *const *argv,
const char *options,
const struct option *long_options,
int *opt_index,
struct _getopt_data *d
)
{
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
0, d);
}
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
If an option that starts with '-' (not '--') doesn't match a long option,
but does match a short option, it is parsed as a short option
instead. */
int
getopt_long_only (
int argc,
char *const *argv,
const char *options,
const struct option *long_options,
int *opt_index
)
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
}
int
_getopt_long_only_r (
int argc,
char *const *argv,
const char *options,
const struct option *long_options,
int *opt_index,
struct _getopt_data *d
)
{
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
1, d);
}
#endif /* Not ELIDE_CODE. */
#ifdef TEST
#include <stdio.h>
int
main (
int argc,
char **argv
)
{
int c;
int digit_optind = 0;
while (1)
{
int this_option_optind = optind ? optind : 1;
int option_index = 0;
static struct option long_options[] = {
{"add", 1, 0, 0},
{"append", 0, 0, 0},
{"delete", 1, 0, 0},
{"verbose", 0, 0, 0},
{"create", 0, 0, 0},
{"file", 1, 0, 0},
{0, 0, 0, 0}
};
c = getopt_long (argc, argv, "abc:d:0123456789",
long_options, &option_index);
if (c == -1)
break;
switch (c)
{
case 0:
printf ("option %s", long_options[option_index].name);
if (optarg)
printf (" with arg %s", optarg);
printf ("\n");
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (digit_optind != 0 && digit_optind != this_option_optind)
printf ("digits occur in two different argv-elements.\n");
digit_optind = this_option_optind;
printf ("option %c\n", c);
break;
case 'a':
printf ("option a\n");
break;
case 'b':
printf ("option b\n");
break;
case 'c':
printf ("option c with value `%s'\n", optarg);
break;
case 'd':
printf ("option d with value `%s'\n", optarg);
break;
case '?':
break;
default:
printf ("?? getopt returned character code 0%o ??\n", c);
}
}
if (optind < argc)
{
printf ("non-option ARGV-elements: ");
while (optind < argc)
printf ("%s ", argv[optind++]);
printf ("\n");
}
exit (0);
}
#endif /* TEST */

145
bin/getopt_int.h Normal file
View file

@ -0,0 +1,145 @@
/* Internal declarations for getopt.
Copyright (C) 1989-1994,1996-1999,2001,2003,2004
Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02110-1301, USA. */
#ifndef _GETOPT_INT_H
#define _GETOPT_INT_H 1
extern int _getopt_internal (
int ___argc,
char *const *___argv,
const char *__shortopts,
const struct option *__longopts,
int *__longind,
int __long_only
);
/* Reentrant versions which can handle parsing multiple argument
vectors at the same time. */
/* Data type for reentrant functions. */
struct _getopt_data
{
/* These have exactly the same meaning as the corresponding global
variables, except that they are used for the reentrant
versions of getopt. */
int optind;
int opterr;
int optopt;
char *optarg;
/* Internal members. */
/* True if the internal members have been initialized. */
int __initialized;
/* The next char to be scanned in the option-element
in which the last option character we returned was found.
This allows us to pick up the scan where we left off.
If this is zero, or a null string, it means resume the scan
by advancing to the next ARGV-element. */
char *__nextchar;
/* Describe how to deal with options that follow non-option ARGV-elements.
If the caller did not specify anything,
the default is REQUIRE_ORDER if the environment variable
POSIXLY_CORRECT is defined, PERMUTE otherwise.
REQUIRE_ORDER means don't recognize them as options;
stop option processing when the first non-option is seen.
This is what Unix does.
This mode of operation is selected by either setting the environment
variable POSIXLY_CORRECT, or using `+' as the first character
of the list of option characters.
PERMUTE is the default. We permute the contents of ARGV as we
scan, so that eventually all the non-options are at the end.
This allows options to be given in any order, even with programs
that were not written to expect this.
RETURN_IN_ORDER is an option available to programs that were
written to expect options and other ARGV-elements in any order
and that care about the ordering of the two. We describe each
non-option ARGV-element as if it were the argument of an option
with character code 1. Using `-' as the first character of the
list of option characters selects this mode of operation.
The special argument `--' forces an end of option-scanning regardless
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
`--' can cause `getopt' to return -1 with `optind' != ARGC. */
enum
{
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
} __ordering;
/* If the POSIXLY_CORRECT environment variable is set. */
int __posixly_correct;
/* Handle permutation of arguments. */
/* Describe the part of ARGV that contains non-options that have
been skipped. `first_nonopt' is the index in ARGV of the first
of them; `last_nonopt' is the index after the last of them. */
int __first_nonopt;
int __last_nonopt;
#if defined _LIBC && defined USE_NONOPTION_FLAGS
int __nonoption_flags_max_len;
int __nonoption_flags_len;
# endif
};
/* The initializer is necessary to set OPTIND and OPTERR to their
default values and to clear the initialization flag. */
#define _GETOPT_DATA_INITIALIZER { 1, 1 }
extern int _getopt_internal_r (
int ___argc,
char *const *___argv,
const char *__shortopts,
const struct option *__longopts,
int *__longind,
int __long_only,
struct _getopt_data *__data
);
extern int _getopt_long_r (
int ___argc,
char *const *___argv,
const char *__shortopts,
const struct option *__longopts,
int *__longind,
struct _getopt_data *__data
);
extern int _getopt_long_only_r (
int ___argc,
char *const *___argv,
const char *__shortopts,
const struct option *__longopts,
int *__longind,
struct _getopt_data *__data
);
#endif /* getopt_int.h */

2
bin/gettext.h Normal file
View file

@ -0,0 +1,2 @@
#undef gettext
#define gettext

161
bootstrap Executable file
View file

@ -0,0 +1,161 @@
#! /bin/sh
##############################################################################
# $Id: bootstrap,v 1.4 2005-08-27 10:21:51 behdad Exp $
# $Author: behdad
# $Date: 2005-08-27 10:21:51 $
# $Revision: 1.4 $
# $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/bootstrap,v $
##############################################################################
# -*- Bootstrap -*-
# Run this file to produce a configure script.
DEFAULT_BOOTSTRAPFLAGS="--force --install --autoreconf=auto"
DEFAULT_CONFIGUREFLAGS="--enable-maintainer-mode --enable-compile-warnings"
OLDDIR=`pwd`
# move to source dir
DIR=`echo $0 | sed 's,[^/]*$,,'`
test -n "$DIR" && cd "$DIR"
if test "$1" = --write-configure; then
test -f configure && \
((echo '#! /bin/sh
DIR=`echo $0 | sed "s,[^/]*\$,,"`
exec ${DIR}bootstrap --configure -- "$@"' > configure \
&& chmod a+x configure) || \
echo Failed writing to configure >&2)
exit $?
fi
# check if we are invoked as configure, or bootstrap
BASE=`echo $0 | sed 's,.*/,,'`
if test "$BASE" = "configure"; then
CONFIG=--config
EXTRA_CONFIGUREFLAGS=$@
else # bootstrap
EXTRA_BOOTSTRAPFLAGS=$*
fi
for arg in $DEFAULT_BOOTSTRAPFLAGS $BOOTSTRAPFLAGS $EXTRA_BOOTSTRAPFLAGS
do
if test -n "$DASHDASHFLAGS"; then
DASHDASHFLAGS="$DASHDASHFLAGS $arg"
else
case $arg in
-h|--h|--he|--hel|--help)
HELP=--help ;;
-V|--vers|--versi|--versio|--version)
VERSION=--version ;;
-v|--verb|--verbo|--verbos|--verbose)
VERBOSE=--verbose ;;
-d|--de|--deb|--debu|--debug)
DEBUG=--debug ;;
-W|--w|--wa|--war|--warn|--warni|--warnin|--warning|--warnings|--warnings=yes|--warnings=all)
WARNS=--warnings=all ;;
--no-w|--no-wa|--no-war|--no-warn|--no-warni|--no-warnin|--no-warning|--no-warnings|--warn=no|--warning=no|--warnings=no)
WARNS=--warnings=none ;;
--w=*|--wa=*|--war=*|--warn=*|--warni=*|--warnin=*|--warning=*|--warnings=*)
WARNS=$arg ;;
-f|--f|--fo|--for|--forc|--force|--forced|--force=yes|--force-missing)
FORCE=--force ;;
--no-f|--no-fo|--no-for|--no-forc|--no-force|--no-forced|--force=no)
FORCE=--no-force ;;
-i|--i|--in|--ins|--inst|--insta|--instal|--install|--install=yes|-a|--add-missing)
INSTALL=--install ;;
--no-i|--no-in|--no-ins|--no-inst|--no-insta|--no-instal|--no-install|--install=no)
INSTALL= ;;
-s|--s|--sy|--sym|--syml|--symli|--symlin|--symlink|--symlink=yes|--no-copy|--copy=no)
SYMLINK=--symlink ;;
--no-s|--no-sy|--no-sym|--no-syml|--no-symli|--no-symlin|--no-symlink|--symlink=no|--copy|--copy=yes)
SYMLINK= ;;
-m|--m|--ma|--mak|--make|--make=yes)
MAKE=--make
CONFIG=--configure ;;
--no-m|--no-ma|--no-mak|--no-make|--make=no)
MAKE= ;;
-c|--c|--co|--con|--conf|--confi|--config|--configu|--configur|--configure|--configure=yes)
CONFIG=--configure ;;
--no-c|--no-co|--no-con|--no-conf|--no-confi|--no-config|--no-configu|--no-configur|--no-configure|--configure=no)
CONFIG= ;;
-n|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run)
DRYRUN=echo ;;
--auto|--autoreconf=auto)
AUTORECONF=auto ;;
--autoreconf|--autoreconf=yes)
AUTORECONF=yes ;;
--no-autoreconf|--autoreconf=no)
AUTORECONF= ;;
--)
DASHDASHFLAGS=" " ;;
*)
echo Ignoring unknown parameter $arg
esac
fi
done
test -z "$SYMLINK" && COPY=--copy
test -n "$INSTALL" && ADDMISSING=--add-missing
# use autoreconf if possible, just check for version 2+
if test "$AUTORECONF" = auto; then
case `autoreconf --version 2>/dev/null` in
*"autoreconf (GNU Autoconf) 2."* )
echo Usable autoreconf found, running
;;
*)
AUTORECONF=
;;
esac
fi
if test -n "$AUTORECONF"; then
$DRYRUN autoreconf $HELP $VERSION $VERBOSE $DEBUG $FORCE $INSTALL $SYMLINK $MAKE $WARNS $AUTORECONFFLAGS || exit $?
else
# add files 'config.guess', 'config.sub', 'ltconfig', 'ltmain.sh'
test -f Makefile.am && MY_LIBTOOLIZEFLAGS=--automake
if grep -q '^ *AC_PROG_LIBTOOL' configure.ac configure.in 2>/dev/null; then
$DRYRUN libtoolize $HELP $VERSION $COPY $DEBUG $FORCE $MY_LIBTOOLIZEFLAGS $LIBTOOLIZEFLAGS || exit $?
fi
# generate 'aclocal.m4'
if test -f configure.ac -o configure.in; then
$DRYRUN aclocal $HELP $VERSION $VERBOSE $FORCE $ACLOCALFLAGS || exit $?
fi
# generate 'config.h.in'
if test -f configure.ac -o configure.in; then
$DRYRUN autoheader $HELP $VERSION $VERBOSE $DEBUG $FORCE $WARNS $AUTOHEADERFLAGS || exit $?
fi
# generate Makefile.in's from Makefile.am's
if test -f Makefile.am; then
$DRYRUN automake $HELP $VERSION $VERBOSE $ADDMISSING $COPY $FORCE $WARNS $AUTOMAKEFLAGS || exit $?
fi
# generate configure from configure.ac
if test -f configure.ac -o -f configure.in; then
$DRYRUN autoconf $HELP $VERSION $VERBOSE $DEBUG $FORCE $WARNS $AUTOCONFFLAGS || exit $?
fi
fi # !AUTOCONF
# move to build dir
cd $OLDDIR
# configure
if test -n "$CONFIG"; then
if test -f ${DIR}configure; then
$DRYRUN ${DIR}configure $HELP $VERSION $DEFAULT_CONFIGUREFLAGS $CONFIGUREFLAGS $DASHDASHFLAGS $EXTRA_CONFIGUREFLAGS || exit $?
fi
fi
# make
if test -n "$MAKE"; then
if test -f Makefile; then
$DRYRUN make $MAKEFLAGS || exit $?
fi
fi

8
charset/Headers.mk Normal file
View file

@ -0,0 +1,8 @@
libfribidi_char_sets_la_headers = \
fribidi-char-sets.h \
fribidi-char-sets-list.h
libfribidi_char_sets_la_symbols = \
fribidi_charset_to_unicode \
fribidi_unicode_to_charset \
fribidi_parse_charset

45
charset/Makefile.am Normal file
View file

@ -0,0 +1,45 @@
noinst_LTLIBRARIES = libfribidi-char-sets.la
AM_CPPFLAGS = \
-I$(top_builddir)/lib \
-I$(top_srcdir)/lib \
$(MISC_CFLAGS)
pkginclude_HEADERS =
libfribidi_char_sets_la_LDFLAGS =
libfribidi_char_sets_la_LIBADD = $(GLIB_LIBS)
if FRIBIDI_CHARSETS
include Headers.mk
pkginclude_HEADERS += $(libfribidi_char_sets_la_headers)
else # !FRIBIDI_CHARSETS
libfribidi_char_sets_la_LDFLAGS += -static
endif # !FRIBIDI_CHARSETS
libfribidi_char_sets_la_SOURCES = \
fribidi-char-sets.c \
fribidi-char-sets-cap-rtl.c \
fribidi-char-sets-cp1255.c \
fribidi-char-sets-cp1256.c \
fribidi-char-sets-iso8859-6.c \
fribidi-char-sets-iso8859-8.c \
fribidi-char-sets-utf8.c \
fribidi-char-sets-cap-rtl.h \
fribidi-char-sets-cp1255.h \
fribidi-char-sets-cp1256.h \
fribidi-char-sets-iso8859-6.h \
fribidi-char-sets-iso8859-8.h \
fribidi-char-sets-utf8.h
$(top_builddir)/config.h: $(top_srcdir)/config.h.in
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) config.h
$(top_builddir)/lib/fribidi-config.h: $(top_srcdir)/lib/fribidi-config.h.in
cd $(top_builddir)/lib && $(MAKE) $(AM_MAKEFLAGS) fribidi-config.h
-include $(top_srcdir)/git.mk

View file

@ -0,0 +1,342 @@
/* FriBidi
* fribidi-char-sets-cap-rtl.c - CapRTL character set conversion routines
*
* $Id: fribidi-char-sets-cap-rtl.c,v 1.12 2006-01-22 10:12:17 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-22 10:12:17 $
* $Revision: 1.12 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-cap-rtl.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include <common.h>
#include <fribidi-char-sets-cap-rtl.h>
#include <fribidi-unicode.h>
#include <fribidi-mirroring.h>
#include <fribidi-bidi-types.h>
#include <bidi-types.h>
#include <stdio.h>
enum
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE = FRIBIDI_TYPE_##TYPE,
# include "fribidi-bidi-types-list.h"
# undef _FRIBIDI_ADD_TYPE
_FRIBIDI_MAX_TYPES_VALUE
};
enum
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) DUMMY_##TYPE,
# include "fribidi-bidi-types-list.h"
# undef _FRIBIDI_ADD_TYPE
_FRIBIDI_NUM_TYPES
};
static FriBidiCharType CapRTLCharTypes[] = {
/* *INDENT-OFF* */
ON, ON, ON, ON, LTR,RTL,ON, ON, ON, ON, ON, ON, ON, BS, RLO,RLE, /* 00-0f */
LRO,LRE,PDF,WS, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, ON, /* 10-1f */
WS, ON, ON, ON, ET, ON, ON, ON, ON, ON, ON, ET, CS, ON, ES, ES, /* 20-2f */
EN, EN, EN, EN, EN, EN, AN, AN, AN, AN, CS, ON, ON, ON, ON, ON, /* 30-3f */
RTL,AL, AL, AL, AL, AL, AL, RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL, /* 40-4f */
RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL,RTL,ON, BS, ON, BN, ON, /* 50-5f */
NSM,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR, /* 60-6f */
LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,LTR,ON, SS, ON, WS, ON, /* 70-7f */
/* *INDENT-ON* */
};
#define CAPRTL_CHARS (int)(sizeof CapRTLCharTypes / sizeof CapRTLCharTypes[0])
static FriBidiChar *caprtl_to_unicode = NULL;
static void
init_cap_rtl (
void
)
{
int request[_FRIBIDI_NUM_TYPES];
FriBidiCharType to_type[_FRIBIDI_NUM_TYPES];
int num_types = 0, count = 0;
FriBidiCharType i;
char mark[CAPRTL_CHARS];
caprtl_to_unicode =
(FriBidiChar *) fribidi_malloc (CAPRTL_CHARS *
sizeof caprtl_to_unicode[0]);
for (i = 0; i < CAPRTL_CHARS; i++)
if (CapRTLCharTypes[i] == fribidi_get_bidi_type (i))
{
caprtl_to_unicode[i] = i;
mark[i] = 1;
}
else
{
int j;
caprtl_to_unicode[i] = FRIBIDI_UNICODE_CHARS;
mark[i] = 0;
if (fribidi_get_mirror_char (i, NULL))
{
DBG ("warning: I could not map mirroring character map to itself in CapRTL");
}
for (j = 0; j < num_types; j++)
if (to_type[j] == CapRTLCharTypes[i])
break;
if (j == num_types)
{
num_types++;
to_type[j] = CapRTLCharTypes[i];
request[j] = 0;
}
request[j]++;
count++;
}
for (i = 0; i < 0x10000 && count; i++) /* Assign BMP chars to CapRTL entries */
if (!fribidi_get_mirror_char (i, NULL) && !(i < CAPRTL_CHARS && mark[i]))
{
int j, k;
FriBidiCharType t = fribidi_get_bidi_type (i);
for (j = 0; j < num_types; j++)
if (to_type[j] == t)
break;
if (!request[j]) /* Do not need this type */
continue;
for (k = 0; k < CAPRTL_CHARS; k++)
if (caprtl_to_unicode[k] == FRIBIDI_UNICODE_CHARS
&& to_type[j] == CapRTLCharTypes[k])
{
request[j]--;
count--;
caprtl_to_unicode[k] = i;
break;
}
}
if (count)
{
int j;
DBG ("warning: could not find a mapping for CapRTL to Unicode:");
for (j = 0; j < num_types; j++)
if (request[j])
{
DBG2 (" need this type: %s", fribidi_get_bidi_type_name (to_type[j]));
}
}
}
static char
fribidi_unicode_to_cap_rtl_c (
/* input */
FriBidiChar uch
)
{
int i;
if (!caprtl_to_unicode)
init_cap_rtl ();
for (i = 0; i < CAPRTL_CHARS; i++)
if (uch == caprtl_to_unicode[i])
return (unsigned char) i;
return '?';
}
FriBidiStrIndex
fribidi_cap_rtl_to_unicode (
/* input */
const char *s,
FriBidiStrIndex len,
/* output */
FriBidiChar *us
)
{
FriBidiStrIndex i, j;
if (!caprtl_to_unicode)
init_cap_rtl ();
j = 0;
for (i = 0; i < len; i++)
{
char ch;
ch = s[i];
if (ch == '_')
{
switch (ch = s[++i])
{
case '>':
us[j++] = FRIBIDI_CHAR_LRM;
break;
case '<':
us[j++] = FRIBIDI_CHAR_RLM;
break;
case 'l':
us[j++] = FRIBIDI_CHAR_LRE;
break;
case 'r':
us[j++] = FRIBIDI_CHAR_RLE;
break;
case 'o':
us[j++] = FRIBIDI_CHAR_PDF;
break;
case 'L':
us[j++] = FRIBIDI_CHAR_LRO;
break;
case 'R':
us[j++] = FRIBIDI_CHAR_RLO;
break;
case '_':
us[j++] = '_';
break;
default:
us[j++] = '_';
i--;
break;
}
}
else
us[j++] = caprtl_to_unicode[(int) s[i]];
}
return j;
}
FriBidiStrIndex
fribidi_unicode_to_cap_rtl (
/* input */
const FriBidiChar *us,
FriBidiStrIndex len,
/* output */
char *s
)
{
FriBidiStrIndex i;
int j;
j = 0;
for (i = 0; i < len; i++)
{
FriBidiChar ch = us[i];
if (!FRIBIDI_IS_EXPLICIT (fribidi_get_bidi_type (ch)) && ch != '_'
&& ch != FRIBIDI_CHAR_LRM && ch != FRIBIDI_CHAR_RLM)
s[j++] = fribidi_unicode_to_cap_rtl_c (ch);
else
{
s[j++] = '_';
switch (ch)
{
case FRIBIDI_CHAR_LRM:
s[j++] = '>';
break;
case FRIBIDI_CHAR_RLM:
s[j++] = '<';
break;
case FRIBIDI_CHAR_LRE:
s[j++] = 'l';
break;
case FRIBIDI_CHAR_RLE:
s[j++] = 'r';
break;
case FRIBIDI_CHAR_PDF:
s[j++] = 'o';
break;
case FRIBIDI_CHAR_LRO:
s[j++] = 'L';
break;
case FRIBIDI_CHAR_RLO:
s[j++] = 'R';
break;
case '_':
s[j++] = '_';
break;
default:
j--;
if (ch < 256)
s[j++] = fribidi_unicode_to_cap_rtl_c (ch);
else
s[j++] = '?';
break;
}
}
}
s[j] = 0;
return j;
}
const char *
fribidi_char_set_desc_cap_rtl (
void
)
{
static char *s = 0;
int l, i, j;
if (s)
return s;
l = 10000;
s = (char *) fribidi_malloc (l);
i = 0;
i += sprintf (s + i, /*l - i, */
"CapRTL is a character set for testing with the reference\n"
"implementation, with explicit marks escape strings, and\n"
"the property that contains all unicode character types in\n"
"ASCII range 1-127.\n"
"\n"
"Warning: CapRTL character types are subject to change.\n"
"\n" "CapRTL's character types:\n");
for (j = 0; j < CAPRTL_CHARS; j++)
{
if (j % 4 == 0)
s[i++] = '\n';
i += sprintf (s + i, /*l - i, */ " * 0x%02x %c%c %-3s ", j,
j < 0x20 ? '^' : ' ',
j < 0x20 ? j + '@' : j < 0x7f ? j : ' ',
fribidi_get_bidi_type_name (CapRTLCharTypes[j]));
}
i += sprintf (s + i, /*l - i, */
"\n\n"
"Escape sequences:\n"
" Character `_' is used to escape explicit marks. The list is:\n"
" * _> LRM\n" " * _< RLM\n"
" * _l LRE\n" " * _r RLE\n"
" * _L LRO\n" " * _R RLO\n"
" * _o PDF\n" " * __ `_' itself\n" "\n");
return s;
}
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

View file

@ -0,0 +1,72 @@
/* FriBidi
* fribidi-char-sets-cap-rtl.h - CapRTL character set conversion routines
*
* $Id: fribidi-char-sets-cap-rtl.h,v 1.2 2004-06-09 14:59:21 behdad Exp $
* $Author: behdad $
* $Date: 2004-06-09 14:59:21 $
* $Revision: 1.2 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-cap-rtl.h,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_CHAR_SETS_CAP_RTL_H
#define _FRIBIDI_CHAR_SETS_CAP_RTL_H
#include "fribidi-common.h"
#include "fribidi-types.h"
#include "fribidi-begindecls.h"
#define fribidi_char_set_name_cap_rtl "CapRTL"
#define fribidi_char_set_title_cap_rtl "CapRTL (Test)"
#define fribidi_char_set_desc_cap_rtl FRIBIDI_NAMESPACE(char_set_desc_cap_rtl)
const char *fribidi_char_set_desc_cap_rtl (
void
);
#define fribidi_cap_rtl_to_unicode FRIBIDI_NAMESPACE(cap_rtl_to_unicode)
FriBidiStrIndex fribidi_cap_rtl_to_unicode (
const char *s,
FriBidiStrIndex length,
FriBidiChar *us
);
#define fribidi_unicode_to_cap_rtl FRIBIDI_NAMESPACE(unicode_to_cap_rtl)
FriBidiStrIndex fribidi_unicode_to_cap_rtl (
const FriBidiChar *us,
FriBidiStrIndex length,
char *s
);
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_CHAR_SETS_CAP_RTL_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

View file

@ -0,0 +1,116 @@
/* FriBidi
* fribidi-char-sets-cp1255.c - CP1255 character set conversion routines
*
* $Id: fribidi-char-sets-cp1255.c,v 1.3 2008-04-22 19:50:46 behdad Exp $
* $Author: behdad $
* $Date: 2008-04-22 19:50:46 $
* $Revision: 1.3 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-cp1255.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include <common.h>
#include <fribidi-char-sets-cp1255.h>
#define ISO_ALEF 0xE0
#define ISO_TAV 0xFA
#define CP1255_SHEVA 0xC0
#define CP1255_SOF_PASUQ 0xD3
#define CP1255_DOUBLE_VAV 0xD4
#define CP1255_GERSHAYIM 0xD8
#define CP1255_LRM 0xFD
#define CP1255_RLM 0xFE
#define UNI_ALEF 0x05D0
#define UNI_TAV 0x05EA
#define UNI_SHEVA 0x05B0
#define UNI_SOF_PASUQ 0x05C3
#define UNI_DOUBLE_VAV 0x05F0
#define UNI_GERSHAYIM 0x05F4
#define UNI_LRM 0x200E
#define UNI_RLM 0x200F
static FriBidiChar fribidi_cp1255_to_unicode_tab[] = { /* 0x80-0xBF */
0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
0x02C6, 0x2030, 0x008a, 0x2039, 0x008c, 0x008d, 0x008e, 0x008f,
0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
0x02DC, 0x2122, 0x009a, 0x203A, 0x009c, 0x009d, 0x009e, 0x009f,
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AA, 0x00A5, 0x00A6, 0x00A7,
0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF
};
FriBidiChar
fribidi_cp1255_to_unicode_c (
/* input */
char sch
)
{
register unsigned char ch = (unsigned char) sch;
if (ch >= ISO_ALEF && ch <= ISO_TAV)
return ch - ISO_ALEF + UNI_ALEF;
else if (ch >= CP1255_SHEVA && ch <= CP1255_SOF_PASUQ)
return ch - CP1255_SHEVA + UNI_SHEVA;
else if (ch >= CP1255_DOUBLE_VAV && ch <= CP1255_GERSHAYIM)
return ch - CP1255_DOUBLE_VAV + UNI_DOUBLE_VAV;
/* cp1256 specific chars */
else if (ch >= 0x80 && ch <= 0xbf)
return fribidi_cp1255_to_unicode_tab[ch - 0x80];
else if (ch == CP1255_LRM || ch == CP1255_RLM)
return ch - CP1255_LRM + UNI_LRM;
/* treat LRM/LRM charrectes correctly */
else
return ch;
}
char
fribidi_unicode_to_cp1255_c (
/* input */
FriBidiChar uch
)
{
if (uch >= UNI_ALEF && uch <= UNI_TAV)
return (char) (uch - UNI_ALEF + ISO_ALEF);
if (uch >= UNI_SHEVA && uch <= UNI_SOF_PASUQ)
return (char) (uch - UNI_SHEVA + CP1255_SHEVA);
if (uch >= UNI_DOUBLE_VAV && uch <= UNI_GERSHAYIM)
return (char) (uch - UNI_DOUBLE_VAV + CP1255_DOUBLE_VAV);
/* TODO: handle pre-composed and presentation chars */
if (uch == UNI_LRM || uch==UNI_RLM)
return (char) (uch - UNI_LRM + CP1255_LRM);
/* Treat LRM/RLM charrecters correctly */
else if (uch < 256)
return (char) uch;
else
return '?';
}
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

View file

@ -0,0 +1,64 @@
/* FriBidi
* fribidi-char-sets-cp1255.h - CP1255 character set conversion routines
*
* $Id: fribidi-char-sets-cp1255.h,v 1.2 2004-06-09 14:59:21 behdad Exp $
* $Author: behdad $
* $Date: 2004-06-09 14:59:21 $
* $Revision: 1.2 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-cp1255.h,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_CHAR_SETS_CP1255_H
#define _FRIBIDI_CHAR_SETS_CP1255_H
#include "fribidi-common.h"
#include "fribidi-types.h"
#include "fribidi-begindecls.h"
#define fribidi_char_set_name_cp1255 "CP1255"
#define fribidi_char_set_title_cp1255 "CP1255 (MS Hebrew/Yiddish)"
#define fribidi_char_set_desc_cp1255 NULL
#define fribidi_cp1255_to_unicode_c FRIBIDI_NAMESPACE(cp1255_to_unicode_c)
FriBidiChar fribidi_cp1255_to_unicode_c (
char ch
);
#define fribidi_unicode_to_cp1255_c FRIBIDI_NAMESPACE(unicode_to_cp1255_c)
char fribidi_unicode_to_cp1255_c (
FriBidiChar uch
);
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_CHAR_SETS_CP1255_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

View file

@ -0,0 +1,223 @@
/* FriBidi
* fribidi-char-sets-cp1256.c - CP1256 character set conversion routines
*
* $Id: fribidi-char-sets-cp1256.c,v 1.2 2004-05-03 22:05:19 behdad Exp $
* $Author: behdad $
* $Date: 2004-05-03 22:05:19 $
* $Revision: 1.2 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-cp1256.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include <common.h>
#include <fribidi-char-sets-cp1256.h>
#define ISO_HAMZA 0xc1
#define CP1256_DAD 0xD6
#define UNI_HAMZA 0x0621
#define UNI_DAD 0x0636
static FriBidiChar fribidi_cp1256_to_unicode_tab[] = { /* 0x80-0xFF */
0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688,
0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA,
0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F,
0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627,
0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F,
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7,
0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0641, 0x0642, 0x0643,
0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7,
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF,
0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7,
0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x00ff
};
FriBidiChar
fribidi_cp1256_to_unicode_c (
/* input */
char sch
)
{
register unsigned char ch = (unsigned char) sch;
if (ch >= 0x80)
return fribidi_cp1256_to_unicode_tab[ch - 0x80];
else
return ch;
}
char
fribidi_unicode_to_cp1256_c (
/* input */
FriBidiChar uch
)
{
if (uch < 256)
return (char) uch;
if (uch >= UNI_HAMZA && uch <= UNI_DAD)
return (char) (uch - UNI_HAMZA + ISO_HAMZA);
else
switch (uch)
{
case 0x0152:
return (char) 0x8c;
case 0x0153:
return (char) 0x9c;
case 0x0192:
return (char) 0x83;
case 0x02C6:
return (char) 0x88;
case 0x060C:
return (char) 0xA1;
case 0x061B:
return (char) 0xBA;
case 0x061F:
return (char) 0xBF;
case 0x0637:
return (char) 0xD8;
case 0x0638:
return (char) 0xD9;
case 0x0639:
return (char) 0xDA;
case 0x063A:
return (char) 0xDB;
case 0x0640:
return (char) 0xDC;
case 0x0641:
return (char) 0xDD;
case 0x0642:
return (char) 0xDE;
case 0x0643:
return (char) 0xDF;
case 0x0644:
return (char) 0xE1;
case 0x0645:
return (char) 0xE3;
case 0x0646:
return (char) 0xE4;
case 0x0647:
return (char) 0xE5;
case 0x0648:
return (char) 0xE6;
case 0x0649:
return (char) 0xEC;
case 0x064A:
return (char) 0xED;
case 0x064B:
return (char) 0xF0;
case 0x064C:
return (char) 0xF1;
case 0x064D:
return (char) 0xF2;
case 0x064E:
return (char) 0xF3;
case 0x064F:
return (char) 0xF5;
case 0x0650:
return (char) 0xF6;
case 0x0651:
return (char) 0xF8;
case 0x0652:
return (char) 0xFA;
case 0x0679:
return (char) 0x8A;
case 0x067E:
return (char) 0x81;
case 0x0686:
return (char) 0x8D;
case 0x0688:
return (char) 0x8F;
case 0x0691:
return (char) 0x9A;
case 0x0698:
return (char) 0x8E;
case 0x06A9:
return (char) 0x98;
case 0x06AF:
return (char) 0x90;
case 0x06BA:
return (char) 0x9F;
case 0x06BE:
return (char) 0xAA;
case 0x06C1:
return (char) 0xC0;
case 0x200C:
return (char) 0x9D;
case 0x200D:
return (char) 0x9E;
case 0x200E:
return (char) 0xFD;
case 0x200F:
return (char) 0xFE;
case 0x2013:
return (char) 0x96;
case 0x2014:
return (char) 0x97;
case 0x2018:
return (char) 0x91;
case 0x2019:
return (char) 0x92;
case 0x201A:
return (char) 0x82;
case 0x201C:
return (char) 0x93;
case 0x201D:
return (char) 0x94;
case 0x201E:
return (char) 0x84;
case 0x2020:
return (char) 0x86;
case 0x2021:
return (char) 0x87;
case 0x2022:
return (char) 0x95;
case 0x2026:
return (char) 0x85;
case 0x2030:
return (char) 0x89;
case 0x2039:
return (char) 0x8B;
case 0x203A:
return (char) 0x9B;
case 0x20AC:
return (char) 0x80;
case 0x2122:
return (char) 0x99;
default:
return '?';
}
}
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

View file

@ -0,0 +1,64 @@
/* FriBidi
* fribidi-char-sets-cp1256.h - CP1256 character set conversion routines
*
* $Id: fribidi-char-sets-cp1256.h,v 1.2 2004-06-09 14:59:21 behdad Exp $
* $Author: behdad $
* $Date: 2004-06-09 14:59:21 $
* $Revision: 1.2 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-cp1256.h,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_CHAR_SETS_CP1256_H
#define _FRIBIDI_CHAR_SETS_CP1256_H
#include "fribidi-common.h"
#include "fribidi-types.h"
#include "fribidi-begindecls.h"
#define fribidi_char_set_name_cp1256 "CP1256"
#define fribidi_char_set_title_cp1256 "CP1256 (MS Arabic)"
#define fribidi_char_set_desc_cp1256 NULL
#define fribidi_cp1256_to_unicode_c FRIBIDI_NAMESPACE(cp1256_to_unicode_c)
FriBidiChar fribidi_cp1256_to_unicode_c (
char ch
);
#define fribidi_unicode_to_cp1256_c FRIBIDI_NAMESPACE(unicode_to_cp1256_c)
char fribidi_unicode_to_cp1256_c (
FriBidiChar uch
);
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_CHAR_SETS_CP1256_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

View file

@ -0,0 +1,81 @@
/* FriBidi
* fribidi-char-sets-iso8859-6.c - ISO8859-6 character set conversion routines
*
* $Id: fribidi-char-sets-iso8859-6.c,v 1.2 2004-05-03 22:05:19 behdad Exp $
* $Author: behdad $
* $Date: 2004-05-03 22:05:19 $
* $Revision: 1.2 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-iso8859-6.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include <common.h>
#include <fribidi-char-sets-iso8859-6.h>
#define ISO_HAMZA 0xc1
#define ISO_SUKUN 0xf2
#define UNI_HAMZA 0x0621
#define UNI_SUKUN 0x0652
FriBidiChar
fribidi_iso8859_6_to_unicode_c (
/* input */
char sch
)
{
register unsigned char ch = (unsigned char) sch;
if (ch >= ISO_HAMZA && ch <= ISO_SUKUN)
return ch - ISO_HAMZA + UNI_HAMZA;
else
return ch;
}
char
fribidi_unicode_to_iso8859_6_c (
/* input */
FriBidiChar uch
)
{
if (uch >= UNI_HAMZA && uch <= UNI_SUKUN)
return (char) (uch - UNI_HAMZA + ISO_HAMZA);
else if (uch < 256)
return (char) uch;
else if (uch == 0x060c)
return (char) 0xac;
else if (uch == 0x061b)
return (char) 0xbb;
else if (uch == 0x061f)
return (char) 0xbf;
else
return '?';
}
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

View file

@ -0,0 +1,64 @@
/* FriBidi
* fribidi-char-sets-iso8859-6.h - ISO8859-6 character set conversion routines
*
* $Id: fribidi-char-sets-iso8859-6.h,v 1.2 2004-06-09 14:59:21 behdad Exp $
* $Author: behdad $
* $Date: 2004-06-09 14:59:21 $
* $Revision: 1.2 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-iso8859-6.h,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_CHAR_SETS_ISO8859_6_H
#define _FRIBIDI_CHAR_SETS_ISO8859_6_H
#include "fribidi-common.h"
#include "fribidi-types.h"
#include "fribidi-begindecls.h"
#define fribidi_char_set_name_iso8859_6 "ISO8859-6"
#define fribidi_char_set_title_iso8859_6 "ISO8859-6 (Arabic)"
#define fribidi_char_set_desc_iso8859_6 NULL
#define fribidi_iso8859_6_to_unicode_c FRIBIDI_NAMESPACE(iso8859_6_to_unicode_c)
FriBidiChar fribidi_iso8859_6_to_unicode_c (
char ch
);
#define fribidi_unicode_to_iso8859_6_c FRIBIDI_NAMESPACE(unicode_to_iso8859_6_c)
char fribidi_unicode_to_iso8859_6_c (
FriBidiChar uch
);
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_CHAR_SETS_ISO8859_6_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

View file

@ -0,0 +1,120 @@
/* FriBidi
* fribidi-char-sets-iso8859-8.c - ISO8859-8 character set conversion routines
*
* $Id: fribidi-char-sets-iso8859-8.c,v 1.2 2004-05-03 22:05:19 behdad Exp $
* $Author: behdad $
* $Date: 2004-05-03 22:05:19 $
* $Revision: 1.2 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-iso8859-8.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include <common.h>
#include <fribidi-char-sets-iso8859-8.h>
#include <fribidi-unicode.h>
/* The following are proposed extensions to ISO8859-8. */
#define ISO_8859_8_LRM 0xFD
#define ISO_8859_8_RLM 0xFE
#define ISO_8859_8_LRE 0xFB
#define ISO_8859_8_RLE 0xFC
#define ISO_8859_8_PDF 0xDD
#define ISO_8859_8_LRO 0xDB
#define ISO_8859_8_RLO 0xDC
#define ISO_ALEF 0xE0
#define ISO_TAV 0xFA
#define UNI_ALEF 0x05D0
#define UNI_TAV 0x05EA
FriBidiChar
fribidi_iso8859_8_to_unicode_c (
/* input */
char sch
)
{
register unsigned char ch = (unsigned char) sch;
if (ch < ISO_8859_8_LRO)
return ch;
else if (ch >= ISO_ALEF && ch <= ISO_TAV)
return ch - ISO_ALEF + UNI_ALEF;
switch (ch)
{
case ISO_8859_8_RLM:
return FRIBIDI_CHAR_RLM;
case ISO_8859_8_LRM:
return FRIBIDI_CHAR_LRM;
case ISO_8859_8_RLO:
return FRIBIDI_CHAR_RLO;
case ISO_8859_8_LRO:
return FRIBIDI_CHAR_LRO;
case ISO_8859_8_RLE:
return FRIBIDI_CHAR_RLE;
case ISO_8859_8_LRE:
return FRIBIDI_CHAR_LRE;
case ISO_8859_8_PDF:
return FRIBIDI_CHAR_PDF;
default:
return '?';
}
}
char
fribidi_unicode_to_iso8859_8_c (
/* input */
FriBidiChar uch
)
{
if (uch < 128)
return (char) uch;
if (uch >= UNI_ALEF && uch <= UNI_TAV)
return (char) (uch - UNI_ALEF + ISO_ALEF);
switch (uch)
{
case FRIBIDI_CHAR_RLM:
return (char) ISO_8859_8_RLM;
case FRIBIDI_CHAR_LRM:
return (char) ISO_8859_8_LRM;
case FRIBIDI_CHAR_RLO:
return (char) ISO_8859_8_RLO;
case FRIBIDI_CHAR_LRO:
return (char) ISO_8859_8_LRO;
case FRIBIDI_CHAR_RLE:
return (char) ISO_8859_8_RLE;
case FRIBIDI_CHAR_LRE:
return (char) ISO_8859_8_LRE;
case FRIBIDI_CHAR_PDF:
return (char) ISO_8859_8_PDF;
}
return '?';
}
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

View file

@ -0,0 +1,64 @@
/* FriBidi
* fribidi-char-sets-iso8859-8.h - ISO8859-8 character set conversion routines
*
* $Id: fribidi-char-sets-iso8859-8.h,v 1.2 2004-06-09 14:59:21 behdad Exp $
* $Author: behdad $
* $Date: 2004-06-09 14:59:21 $
* $Revision: 1.2 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-iso8859-8.h,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_CHAR_SETS_ISO8859_8_H
#define _FRIBIDI_CHAR_SETS_ISO8859_8_H
#include "fribidi-common.h"
#include "fribidi-types.h"
#include "fribidi-begindecls.h"
#define fribidi_char_set_name_iso8859_8 "ISO8859-8"
#define fribidi_char_set_title_iso8859_8 "ISO8859-8 (Hebrew)"
#define fribidi_char_set_desc_iso8859_8 NULL
#define fribidi_iso8859_8_to_unicode_c FRIBIDI_NAMESPACE(iso8859_8_to_unicode_c)
FriBidiChar fribidi_iso8859_8_to_unicode_c (
char ch
);
#define fribidi_unicode_to_iso8859_8_c FRIBIDI_NAMESPACE(unicode_to_iso8859_8_c)
char fribidi_unicode_to_iso8859_8_c (
FriBidiChar uch
);
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_CHAR_SETS_ISO8859_8_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

View file

@ -0,0 +1,60 @@
#ifndef __FRIBIDI_DOC
/* FriBidi
* fribidi-char-sets-list.h - list of supported character sets
*
* $Id: fribidi-char-sets-list.h,v 1.3 2004-06-09 14:59:21 behdad Exp $
* $Author: behdad $
* $Date: 2004-06-09 14:59:21 $
* $Revision: 1.3 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-list.h,v $
*
* Author:
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc.
* Copyright (C) 2001,2002 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
/* *INDENT-OFF* */
/* The order of types in this list should not be important at compile time,
* but apparently it should not be changed after compilation! */
#endif /* !__FRIBIDI_DOC */
#ifdef _FRIBIDI_ADD_CHAR_SET
# define _FRIBIDI_ADD_CHAR_SET_OTHERS _FRIBIDI_ADD_CHAR_SET
# define _FRIBIDI_ADD_CHAR_SET_ONE2ONE _FRIBIDI_ADD_CHAR_SET
#endif /* _FRIBIDI_ADD_CHAR_SET */
#ifdef _FRIBIDI_ADD_CHAR_SET_OTHERS
_FRIBIDI_ADD_CHAR_SET_OTHERS (UTF8, utf8) /* UTF-8 (Unicode) */
_FRIBIDI_ADD_CHAR_SET_OTHERS (CAP_RTL, cap_rtl) /* CapRTL (Test) */
#endif /* _FRIBIDI_ADD_CHAR_SET_OTHERS */
#ifdef _FRIBIDI_ADD_CHAR_SET_ONE2ONE
_FRIBIDI_ADD_CHAR_SET_ONE2ONE (ISO8859_6, iso8859_6) /* ISO8859-6 (Arabic) */
_FRIBIDI_ADD_CHAR_SET_ONE2ONE (ISO8859_8, iso8859_8) /* ISO8859-8 (Hebrew) */
_FRIBIDI_ADD_CHAR_SET_ONE2ONE (CP1255, cp1255) /* CP1255 (MS Hebrew/Yiddish) */
_FRIBIDI_ADD_CHAR_SET_ONE2ONE (CP1256, cp1256) /* CP1256 (MS Arabic) */
#endif /* _FRIBIDI_ADD_CHAR_SET_ONE2ONE */
#ifdef _FRIBIDI_ADD_CHAR_SET
# undef _FRIBIDI_ADD_CHAR_SET_OTHERS
# undef _FRIBIDI_ADD_CHAR_SET_ONE2ONE
#endif /* _FRIBIDI_ADD_CHAR_SET */
#ifndef __FRIBIDI_DOC
/* *INDENT-ON* */
#endif /* !__FRIBIDI_DOC */

View file

@ -0,0 +1,135 @@
/* FriBidi
* fribidi-char-sets-utf8.c - UTF-8 character set conversion routines
*
* $Id: fribidi-char-sets-utf8.c,v 1.3 2005-07-30 09:06:28 behdad Exp $
* $Author: behdad $
* $Date: 2005-07-30 09:06:28 $
* $Revision: 1.3 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-utf8.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include <common.h>
#include <fribidi-char-sets-utf8.h>
#include <fribidi-unicode.h>
FriBidiStrIndex
fribidi_utf8_to_unicode (
/* input */
const char *ss,
FriBidiStrIndex len,
/* output */
FriBidiChar *us
)
{
FriBidiStrIndex length;
const unsigned char *s = (unsigned const char *) ss;
const unsigned char *t = s;
length = 0;
while ((FriBidiStrIndex) (s - t) < len)
{
register unsigned char ch = *s;
if (ch <= 0x7f) /* one byte */
{
*us++ = *s++;
}
else if (ch <= 0xdf) /* 2 byte */
{
*us++ = ((*s & 0x1f) << 6) + (*(s + 1) & 0x3f);
s += 2;
}
else if (ch <= 0xef) /* 3 byte */
{
*us++ =
((int) (*s & 0x0f) << 12) +
((*(s + 1) & 0x3f) << 6) + (*(s + 2) & 0x3f);
s += 3;
}
else /* 4 byte */
{
*us++ =
((int) (*s & 0x07) << 18) +
((*(s + 1) & 0x3f) << 12) +
((*(s + 2) & 0x3f) << 6) +
((*(s + 3) & 0x3f) << 0);
s += 4;
}
length++;
}
return (length);
}
FriBidiStrIndex
fribidi_unicode_to_utf8 (
/* input */
const FriBidiChar *us,
FriBidiStrIndex len,
/* output */
char *ss
)
{
FriBidiStrIndex i;
unsigned char *s = (unsigned char *) ss;
unsigned char *t = s;
for (i = 0; i < len; i++)
{
FriBidiChar mychar = us[i];
if (mychar <= 0x7F)
{ /* 7 sig bits */
*t++ = mychar;
}
else if (mychar <= 0x7FF)
{ /* 11 sig bits */
*t++ = 0xC0 | (unsigned char) (mychar >> 6); /* upper 5 bits */
*t++ = 0x80 | (unsigned char) (mychar & 0x3F); /* lower 6 bits */
}
else if (mychar <= 0xFFFF)
{ /* 16 sig bits */
*t++ = 0xE0 | (unsigned char) (mychar >> 12); /* upper 4 bits */
*t++ = 0x80 | (unsigned char) ((mychar >> 6) & 0x3F); /* next 6 bits */
*t++ = 0x80 | (unsigned char) (mychar & 0x3F); /* lowest 6 bits */
}
else if (mychar < FRIBIDI_UNICODE_CHARS)
{ /* 21 sig bits */
*t++ = 0xF0 | (unsigned char) ((mychar >> 18) & 0x07); /* upper 3 bits */
*t++ = 0x80 | (unsigned char) ((mychar >> 12) & 0x3F); /* next 6 bits */
*t++ = 0x80 | (unsigned char) ((mychar >> 6) & 0x3F); /* next 6 bits */
*t++ = 0x80 | (unsigned char) (mychar & 0x3F); /* lowest 6 bits */
}
}
*t = 0;
return (t - s);
}
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

View file

@ -0,0 +1,68 @@
/* FriBidi
* fribidi-char-sets-utf8.h - UTF-8 character set conversion routines
*
* $Id: fribidi-char-sets-utf8.h,v 1.2 2004-06-09 14:59:21 behdad Exp $
* $Author: behdad $
* $Date: 2004-06-09 14:59:21 $
* $Revision: 1.2 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-utf8.h,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_CHAR_SETS_UTF8_H
#define _FRIBIDI_CHAR_SETS_UTF8_H
#include "fribidi-common.h"
#include "fribidi-types.h"
#include "fribidi-begindecls.h"
#define fribidi_char_set_name_utf8 "UTF-8"
#define fribidi_char_set_title_utf8 "UTF-8 (Unicode)"
#define fribidi_char_set_desc_utf8 NULL
#define fribidi_utf8_to_unicode FRIBIDI_NAMESPACE(utf8_to_unicode)
FriBidiStrIndex fribidi_utf8_to_unicode (
const char *s,
FriBidiStrIndex length,
FriBidiChar *us
);
#define fribidi_unicode_to_utf8 FRIBIDI_NAMESPACE(unicode_to_utf8)
FriBidiStrIndex fribidi_unicode_to_utf8 (
const FriBidiChar *us,
FriBidiStrIndex length,
char *s
);
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_CHAR_SETS_UTF8_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

237
charset/fribidi-char-sets.c Normal file
View file

@ -0,0 +1,237 @@
/* FriBidi
* fribidi-char-sets.c - character set conversion routines
*
* $Id: fribidi-char-sets.c,v 1.7 2006-01-31 03:23:12 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:12 $
* $Revision: 1.7 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include <common.h>
#include <fribidi-char-sets.h>
#include "fribidi-char-sets-cap-rtl.h"
#include "fribidi-char-sets-utf8.h"
#include "fribidi-char-sets-iso8859-6.h"
#include "fribidi-char-sets-cp1256.h"
#include "fribidi-char-sets-iso8859-8.h"
#include "fribidi-char-sets-cp1255.h"
typedef struct
{
FriBidiChar (
*charset_to_unicode_c
) (
char ch
);
FriBidiStrIndex (
*charset_to_unicode
) (
const char *s,
FriBidiStrIndex len,
FriBidiChar *us
);
char (
*unicode_to_charset_c
) (
FriBidiChar uch
);
FriBidiStrIndex (
*unicode_to_charset
) (
const FriBidiChar *us,
FriBidiStrIndex len,
char *s
);
const char *name;
const char *title;
const char *(
*desc
) (
void
);
}
FriBidiCharSetHandler;
static FriBidiCharSetHandler char_sets[FRIBIDI_CHAR_SETS_NUM + 1] = {
{NULL, NULL, NULL, NULL, "N/A", "Character set not available", NULL},
# define _FRIBIDI_ADD_CHAR_SET_ONE2ONE(CHAR_SET, char_set) \
{ \
fribidi_##char_set##_to_unicode_c, \
NULL, \
fribidi_unicode_to_##char_set##_c, \
NULL, \
fribidi_char_set_name_##char_set, \
fribidi_char_set_title_##char_set, \
fribidi_char_set_desc_##char_set \
},
# define _FRIBIDI_ADD_CHAR_SET_OTHERS(CHAR_SET, char_set) \
{ \
NULL, \
fribidi_##char_set##_to_unicode, \
NULL, \
fribidi_unicode_to_##char_set, \
fribidi_char_set_name_##char_set, \
fribidi_char_set_title_##char_set, \
fribidi_char_set_desc_##char_set \
},
# include <fribidi-char-sets-list.h>
# undef _FRIBIDI_ADD_CHAR_SET_OTHERS
# undef _FRIBIDI_ADD_CHAR_SET_ONE2ONE
};
#if FRIBIDI_USE_GLIB+0
# include <glib.h>
# define fribidi_strcasecmp g_ascii_strcasecmp
#else /* !FRIBIDI_USE_GLIB */
static char
toupper (
/* input */
char c
)
{
return c < 'a' || c > 'z' ? c : c + 'A' - 'a';
}
static int
fribidi_strcasecmp (
/* input */
const char *s1,
const char *s2
)
{
while (*s1 && toupper (*s1) == toupper (*s2))
{
s1++;
s2++;
}
return toupper (*s1) - toupper (*s2);
}
#endif /* !FRIBIDI_USE_GLIB */
FRIBIDI_ENTRY FriBidiCharSet
fribidi_parse_charset (
/* input */
const char *s
)
{
int i;
for (i = FRIBIDI_CHAR_SETS_NUM; i; i--)
if (fribidi_strcasecmp (s, char_sets[i].name) == 0)
return i;
return FRIBIDI_CHAR_SET_NOT_FOUND;
}
FRIBIDI_ENTRY FriBidiStrIndex
fribidi_charset_to_unicode (
/* input */
FriBidiCharSet char_set,
const char *s,
FriBidiStrIndex len,
/* output */
FriBidiChar *us
)
{
if (char_sets[char_set].charset_to_unicode)
return (*char_sets[char_set].charset_to_unicode) (s, len, us);
else if (char_sets[char_set].charset_to_unicode_c)
{
register FriBidiStrIndex l;
for (l = len; l; l--)
*us++ = (*char_sets[char_set].charset_to_unicode_c) (*s++);
return len;
}
else
return 0;
}
FRIBIDI_ENTRY FriBidiStrIndex
fribidi_unicode_to_charset (
/* input */
FriBidiCharSet char_set,
const FriBidiChar *us,
FriBidiStrIndex len,
/* output */
char *s
)
{
if (char_sets[char_set].unicode_to_charset)
return (*char_sets[char_set].unicode_to_charset) (us, len, s);
else if (char_sets[char_set].unicode_to_charset_c)
{
register FriBidiStrIndex l;
for (l = len; l; l--)
*s++ = (*char_sets[char_set].unicode_to_charset_c) (*us++);
*s = '\0';
return len;
}
else
return 0;
}
FRIBIDI_ENTRY const char *
fribidi_char_set_name (
/* input */
FriBidiCharSet char_set
)
{
return char_sets[char_set].name ? char_sets[char_set].name : "";
}
FRIBIDI_ENTRY const char *
fribidi_char_set_title (
/* input */
FriBidiCharSet char_set
)
{
return char_sets[char_set].title ? char_sets[char_set].
title : fribidi_char_set_name (char_set);
}
FRIBIDI_ENTRY const char *
fribidi_char_set_desc (
/* input */
FriBidiCharSet char_set
)
{
return char_sets[char_set].desc ? char_sets[char_set].desc () : NULL;
}
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

118
charset/fribidi-char-sets.h Normal file
View file

@ -0,0 +1,118 @@
/* FriBidi
* fribidi-char-sets.h - character set conversion routines
*
* $Id: fribidi-char-sets.h,v 1.3 2004-06-09 14:59:21 behdad Exp $
* $Author: behdad $
* $Date: 2004-06-09 14:59:21 $
* $Revision: 1.3 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets.h,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_CHAR_SETS_H
#define _FRIBIDI_CHAR_SETS_H
#include "fribidi-common.h"
#include "fribidi-types.h"
#include "fribidi-begindecls.h"
typedef enum
{
_FRIBIDI_CHAR_SET_NOT_FOUND,
# define _FRIBIDI_ADD_CHAR_SET(CHAR_SET, char_set) FRIBIDI_CHAR_SET_##CHAR_SET,
# include "fribidi-char-sets-list.h"
# undef _FRIBIDI_ADD_CHAR_SET
_FRIBIDI_CHAR_SETS_NUM_PLUS_ONE
}
FriBidiCharSet;
#define FRIBIDI_CHAR_SET_NOT_FOUND _FRIBIDI_CHAR_SET_NOT_FOUND
#define FRIBIDI_CHAR_SETS_NUM (_FRIBIDI_CHAR_SETS_NUM_PLUS_ONE - 1)
#define fribidi_charset_to_unicode FRIBIDI_NAMESPACE(charset_to_unicode)
/* fribidi_charset_to_unicode - convert string to Unicode
*
* This function converts an string from a character set, to a Unicode string.
*
* Returns: The length of the new string.
*/
FRIBIDI_ENTRY FriBidiStrIndex fribidi_charset_to_unicode (
FriBidiCharSet char_set, /* character set to convert from */
const char *s, /* input string encoded in char_set */
FriBidiStrIndex len, /* input string length */
FriBidiChar *us /* output Unicode string */
);
#define fribidi_unicode_to_charset FRIBIDI_NAMESPACE(unicode_to_charset)
/* fribidi_unicode_to_charset - convert string from Unicode
*
* This function converts a Unicode string to an string in another character
* set. It also null-terminates the output string.
*
* Returns: The length of the new string.
*/
FRIBIDI_ENTRY FriBidiStrIndex fribidi_unicode_to_charset (
FriBidiCharSet char_set, /* character set to conver to */
const FriBidiChar *us, /* input Unicode string */
FriBidiStrIndex len, /* input string length */
char *s /* output string encoded in char_set */
);
#define fribidi_parse_charset FRIBIDI_NAMESPACE(parse_charset)
/* fribidi_parse_charset - parse character set name
*
* Returns: The character set named s, or FRIBIDI_CHAR_SET_NOT_FOUND if the
* character set is not available.
*/
FRIBIDI_ENTRY FriBidiCharSet fribidi_parse_charset (
const char *s /* input name of the character set */
);
#define fribidi_char_set_name FRIBIDI_NAMESPACE(char_set_name)
FRIBIDI_ENTRY const char *fribidi_char_set_name (
FriBidiCharSet char_set
);
#define fribidi_char_set_title FRIBIDI_NAMESPACE(char_set_title)
FRIBIDI_ENTRY const char *fribidi_char_set_title (
FriBidiCharSet char_set
);
#define fribidi_char_set_desc FRIBIDI_NAMESPACE(char_set_desc)
FRIBIDI_ENTRY const char *fribidi_char_set_desc (
FriBidiCharSet char_set
);
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_CHAR_SETS_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

214
configure.ac Normal file
View file

@ -0,0 +1,214 @@
## -*- Autoconf -*-
## Process this file with autoconf to produce a configure script.
## Use autoupdate to update this file for newer versions of autoconf.
## Use autoscan to check if you need to add something to this file.
##############################################################################
## $Id: configure.ac,v 1.29 2011-01-21 22:49:59 behdad Exp $
## $Auther: behdad $
## $Date: 2011-01-21 22:49:59 $
## $Revision: 1.29 $
## $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/configure.ac,v $
##############################################################################
AC_PREREQ([2.64])
dnl Define different version variables.
dnl
dnl Making releases:
dnl FRIBIDI_MICRO_VERSION++;
dnl FRIBIDI_INTERFACE_AGE++;
dnl
dnl If any functions have been added:
dnl FRIBIDI_INTERFACE_AGE = 0;
dnl FRIBIDI_INTERFACE_VERSION++;
dnl FRIBIDI_BINARY_AGE++;
dnl
dnl If binary backwards compatibility has been broken:
dnl FRIBIDI_BINARY_AGE = FRIBIDI_INTERFACE_AGE = 0;
dnl
m4_define(fribidi_major_version, 0)dnl
m4_define(fribidi_minor_version, 19)dnl
m4_define(fribidi_micro_version, 6)dnl
m4_define(fribidi_interface_version, 3)dnl
m4_define(fribidi_interface_age, 5)dnl
m4_define(fribidi_binary_age, 3)dnl
dnl
m4_define(fribidi_version,
m4_if(m4_eval(fribidi_micro_version()),0,
fribidi_major_version.fribidi_minor_version,
fribidi_major_version.fribidi_minor_version.fribidi_micro_version))dnl
AC_INIT([GNU FriBidi],
fribidi_version(),
[http://bugs.freedesktop.org/enter_bug.cgi?product=fribidi],
[fribidi],
[http://fribidi.org/])
AC_CONFIG_SRCDIR([fribidi.pc.in])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.11.1 gnits dist-bzip2 no-dist-gzip -Wall no-define])
AM_SILENT_RULES([yes])
# Initialize libtool
LT_PREREQ([2.2])
LT_INIT([disable-static])
FRIBIDI_MAJOR_VERSION=fribidi_major_version()
FRIBIDI_MINOR_VERSION=fribidi_minor_version()
FRIBIDI_MICRO_VERSION=fribidi_micro_version()
FRIBIDI_VERSION=fribidi_version()
FRIBIDI_INTERFACE_VERSION=fribidi_interface_version()
FRIBIDI_INTERFACE_AGE=fribidi_interface_age()
FRIBIDI_BINARY_AGE=fribidi_binary_age()
AC_SUBST(FRIBIDI_MAJOR_VERSION)
AC_SUBST(FRIBIDI_MINOR_VERSION)
AC_SUBST(FRIBIDI_MICRO_VERSION)
AC_SUBST(FRIBIDI_VERSION)
AC_SUBST(FRIBIDI_INTERFACE_VERSION)
AC_SUBST(FRIBIDI_INTERFACE_AGE)
AC_SUBST(FRIBIDI_BINARY_AGE)
dnl libtool versioning.
m4_define(lt_current, fribidi_interface_version())dnl
m4_define(lt_revision, fribidi_interface_age())dnl
m4_define(lt_age, fribidi_binary_age())dnl
LT_VERSION_INFO=lt_current():lt_revision():lt_age()
LT_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age)
AC_SUBST(LT_VERSION_INFO)
AC_SUBST(LT_CURRENT_MINUS_AGE)
dnl ==========================================================================
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
PKG_PROG_PKG_CONFIG
AC_MSG_CHECKING([for native Win32])
case $build_os in
mingw*) os_win32=yes ;;
*) os_win32=no ;;
esac
AC_MSG_RESULT([$os_win32])
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
AC_MSG_CHECKING([for some Win32 platform])
case $build_os in
mingw*|cygwin*) platform_win32=yes ;;
*) platform_win32=no ;;
esac
AC_MSG_RESULT([$platform_win32])
AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h strings.h inttypes.h wchar.h asm/page.h sys/times.h])
# Checks for typedefs and structures.
AC_C_CONST
AC_C_STRINGIZE
AC_CHECK_SIZEOF(int)
SIZEOF_INT=$ac_cv_sizeof_int
AC_SUBST(SIZEOF_INT)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(wchar_t)
# Checks for compiler characteristics.
changequote(,)dnl
if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -Wall -ansi "
fi
changequote([,])dnl
# Checks for library functions.
AC_CHECK_FUNCS([memmove memset strdup])
AC_TYPE_SIGNAL
# Checks for configure options
# --enable-debug
m4_define(debug_default,
m4_if(m4_eval(fribidi_minor_version() % 2),1,yes,no))
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[turn on debugging @<:@default=debug_default()@:>@]),,
enable_debug=debug_default())
if test x$enable_debug = xyes; then
AC_DEFINE(DEBUG,1,
[Define to 1 if you want to include debug code in the library])
fi
# --disable-deprecated
AC_ARG_ENABLE(deprecated,
AC_HELP_STRING([--disable-deprecated],
[do not build deprecated functionality]))
if test x$enable_deprecated = xno; then
FRIBIDI_NO_DEPRECATED=1
else
FRIBIDI_NO_DEPRECATED=0
fi
AC_SUBST(FRIBIDI_NO_DEPRECATED)
AC_DEFINE(USE_SIMPLE_MALLOC,1,
[Define to 1 if you want to use simple mallocs instead of memory chunks])
# --disable-charsets
AC_ARG_ENABLE(charsets,
AC_HELP_STRING([--disable-charsets],
[exclude charset conversion routines from library]))
if test x$enable_charsets = xno; then
FRIBIDI_CHARSETS=0
else
FRIBIDI_CHARSETS=1
fi
AC_SUBST(FRIBIDI_CHARSETS)
AM_CONDITIONAL(FRIBIDI_CHARSETS, test x$FRIBIDI_CHARSETS = x1)
# --with[out]-glib
AC_ARG_WITH(glib,
AC_HELP_STRING([--with-glib=@<:@no/auto/yes@:>@],
[use Glib @<:@default=auto@:>@]))
GLIB_PACKAGE=glib-2.0
GLIB_MINVERSION=2.4
GLIB_LIBS=
GLIB_CFLAGS=
if test x$with_glib = xyes; then
PKG_CHECK_MODULES(GLIB,$GLIB_PACKAGE >= $GLIB_MINVERSION)
FRIBIDI_USE_GLIB=1
else
if test x$with_glib = xno; then
FRIBIDI_USE_GLIB=0
else
PKG_CHECK_MODULES(GLIB,$GLIB_PACKAGE >= $GLIB_MINVERSION,
FRIBIDI_USE_GLIB=1,
FRIBIDI_USE_GLIB=0)
fi
fi
if test x$FRIBIDI_USE_GLIB = x0; then
GLIB_PACKAGE=
fi
AC_SUBST(FRIBIDI_USE_GLIB)
AM_CONDITIONAL(FRIBIDI_USE_GLIB, test x$FRIBIDI_USE_GLIB = x1)
MISC_CFLAGS="$GLIB_CFLAGS"
MISC_LIBS="$GLIB_LIBS"
MISC_PACKAGES="$GLIB_PACKAGE"
AC_SUBST(MISC_CFLAGS)
AC_SUBST(MISC_LIBS)
AC_SUBST(MISC_PACKAGES)
# Generate output
AC_CONFIG_FILES([fribidi.pc
lib/fribidi-config.h
Makefile
charset/Makefile
gen.tab/Makefile
lib/Makefile
bin/Makefile
doc/Makefile
test/Makefile])
AC_OUTPUT

4
doc/.cvsignore Normal file
View file

@ -0,0 +1,4 @@
*.1
*.3
help2man.stamp
c2man.stamp

65
doc/Makefile.am Normal file
View file

@ -0,0 +1,65 @@
dist_man_MANS =
dist_noinst_MANS =
EXTRA_DIST =
MOSTLYCLEANFILES =
MAINTAINERCLEANFILES =
# man3
includepath =
includevpath =
headers =
inst_symbols =
noinst_symbols =
include $(top_srcdir)/charset/Headers.mk
headers += $(libfribidi_char_sets_la_headers)
includepath += -I$(top_srcdir)/charset
includevpath += :$(top_srcdir)/charset
if FRIBIDI_CHARSETS
inst_symbols += $(libfribidi_char_sets_la_symbols)
else # !FRIBIDI_CHARSETS
noinst_symbols += $(libfribidi_char_sets_la_symbols)
endif # !FRIBIDI_CHARSETS
# The lib/Headers.mk stuff should come after all optional stuff.
include $(top_srcdir)/lib/Headers.mk
headers += $(libfribidi_la_headers)
includepath += -I$(top_builddir)/lib -I$(top_srcdir)/lib
includevpath += :$(top_builddir)/lib:$(top_srcdir)/lib
inst_symbols += $(libfribidi_la_symbols)
dist_man_MANS += $(inst_symbols:=.3)
dist_noinst_MANS += $(noinst_symbols:=.3)
EXTRA_DIST += c2man.stamp
MOSTLYCLEANFILES += c2man.stamp.tmp
MAINTAINERCLEANFILES += $(man3) c2man.stamp
man3 = $(dist_man_MANS) $(dist_noinst_MANS)
C2MANFLAGS = $(includepath) \
-D__FRIBIDI_DOC \
-DDONT_HAVE_FRIBIDI_CONFIG_H \
-M "Programmer's Manual" \
-m "$(PACKAGE_NAME) $(PACKAGE_VERSION)"
VPATH += $(includevpath)
c2man.stamp: $(headers)
@$(RM) $@.tmp
@touch $@.tmp
@($(LN_S) $^ . || cp $^ .)
@echo Running c2man
@$(top_srcdir)/missing --run c2man -T n $(C2MANFLAGS) $(headers) 2>&1 \
|| true
@$(RM) $(headers)
@mv $@.tmp $@
$(man3): c2man.stamp
@if ! test -f $@; then \
$(RM) $<; \
$(MAKE) $(AM_MAKEFLAGS) $<;\
fi
@touch $@
-include $(top_srcdir)/git.mk

13
fribidi.pc.in Normal file
View file

@ -0,0 +1,13 @@
# @configure_input@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: @PACKAGE_NAME@
Description: Unicode Bidirectional Algorithm Library
Requires: @MISC_PACKAGES@
Version: @VERSION@
Libs: -L${libdir} -lfribidi
Cflags: -I${includedir}/@PACKAGE@

3
gen.tab/.cvsignore Normal file
View file

@ -0,0 +1,3 @@
gen-bidi-type-tab
gen-mirroring-tab
gen-unicode-version

127
gen.tab/Makefile.am Normal file
View file

@ -0,0 +1,127 @@
EXTRA_PROGRAMS = \
gen-unicode-version \
gen-bidi-type-tab \
gen-joining-type-tab \
gen-arabic-shaping-tab \
gen-mirroring-tab
gen_unicode_version_SOURCES = gen-unicode-version.c
gen_bidi_type_tab_SOURCES = gen-bidi-type-tab.c packtab.c packtab.h
gen_joining_type_tab_SOURCES = gen-joining-type-tab.c packtab.c packtab.h
gen_arabic_shaping_tab_SOURCES = gen-arabic-shaping-tab.c
gen_mirroring_tab_SOURCES = gen-mirroring-tab.c packtab.c packtab.h
CLEANFILES = $(EXTRA_PROGRAMS)
DISTCLEANFILES =
AM_CPPFLAGS = \
-I$(top_builddir)/lib \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/charset \
$(MISC_CFLAGS)
LDADD = $(MISC_LIBS)
VPATH += \
$(builddir)/unidata \
$(builddir)/unidata/extracted \
$(srcdir)/unidata \
$(srcdir)/unidata/extracted \
$(top_builddir)/lib
UCD_FILES = \
unidata/ReadMe.txt \
unidata/UnicodeData.txt \
unidata/BidiMirroring.txt \
unidata/ArabicShaping.txt
EXTRA_DIST = $(UCD_FILES)
COMPRESSION = 2
# generate bidi-type.tab.i
gen_bidi_type_tab = gen-bidi-type-tab$(EXEEXT)
derived_bidi-type.tab.i: \
DerivedBidiClass.txt \
fribidi-unicode-version.h \
$(gen_bidi_type_tab_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) $(gen_bidi_type_tab)
./$(gen_bidi_type_tab) $(COMPRESSION) $^ > $@ \
|| ($(RM) $@ && false)
bidi-type.tab.i: \
UnicodeData.txt \
fribidi-unicode-version.h \
$(gen_bidi_type_tab_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) $(gen_bidi_type_tab)
./$(gen_bidi_type_tab) $(COMPRESSION) $^ > $@ \
|| ($(RM) $@ && false)
DISTCLEANFILES += derived_bidi-type.tab.i
# generate joining-type.tab.i
gen_joining_type_tab = gen-joining-type-tab$(EXEEXT)
joining-type.tab.i: \
UnicodeData.txt \
ArabicShaping.txt \
fribidi-unicode-version.h \
$(gen_joining_type_tab_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) $(gen_joining_type_tab)
./$(gen_joining_type_tab) $(COMPRESSION) $^ > $@ \
|| ($(RM) $@ && false)
# generate arabic-shaping.tab.i
gen_arabic_shaping_tab = gen-arabic-shaping-tab$(EXEEXT)
arabic-shaping.tab.i: \
UnicodeData.txt \
fribidi-unicode-version.h \
$(gen_arabic_shaping_tab_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) $(gen_arabic_shaping_tab)
./$(gen_arabic_shaping_tab) $(COMPRESSION) $^ > $@ \
|| ($(RM) $@ && false)
# generate mirroring.tab.i
gen_mirroring_tab = gen-mirroring-tab$(EXEEXT)
mirroring.tab.i: \
BidiMirroring.txt \
fribidi-unicode-version.h \
$(gen_mirroring_tab_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) $(gen_mirroring_tab)
./$(gen_mirroring_tab) $(COMPRESSION) $^ > $@ \
|| ($(RM) $@ && false)
# generate fribidi-unicode-version.h
gen_unicode_version = gen-unicode-version$(EXEEXT)
fribidi-unicode-version.h: \
ReadMe.txt \
BidiMirroring.txt \
$(gen_unicode_version_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) $(gen_unicode_version)
./$(gen_unicode_version) $^ > $@ \
|| ($(RM) $@ && false)
# generate all generators:
gen: $(EXTRA_PROGRAMS)
$(top_builddir)/config.h: $(top_srcdir)/config.h.in
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) config.h
$(top_builddir)/lib/fribidi-config.h: $(top_srcdir)/lib/fribidi-config.h.in
cd $(top_builddir)/lib && $(MAKE) $(AM_MAKEFLAGS) fribidi-config.h
.PHONY: gen
.DELETE_ON_ERROR:
-include $(top_srcdir)/git.mk

9
gen.tab/gen-arabic-liga.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
ARABICSHAPING=unidata/ArabicShaping.txt
UNICODEDATA=unidata/UnicodeData.txt
LAMclass="(`grep '; LAM$' "$ARABICSHAPING" | cut -d';' -f1 | sort | tr '\n' '|' | sed 's/|$//'`)"
ALEFclass="(`grep '; ALEF$' "$ARABICSHAPING" | cut -d';' -f1 | sort | tr '\n' '|' | sed 's/|$//'`)"
grep -E ";<(final|isolated)> $LAMclass $ALEFclass;" "$UNICODEDATA"

View file

@ -0,0 +1,310 @@
/* FriBidi
* gen-arabic-shaping-tab.c - generate arabic-shaping.tab.i
*
* $Id: gen-arabic-shaping-tab.c,v 1.2 2006-01-31 03:23:12 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:12 $
* $Revision: 1.2 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/gen.tab/gen-arabic-shaping-tab.c,v $
*
* Author:
* Behdad Esfahbod, 2004, 2005
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2004, 2005 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include <common.h>
#include <fribidi-unicode.h>
#include <stdio.h>
#if STDC_HEADERS+0
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#if HAVE_STRING_H+0
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#if HAVE_STRINGS_H+0
# include <strings.h>
#endif
#include "packtab.h"
#define appname "gen-arabic-shaping-tab"
#define outputname "arabic-shaping.tab.i"
static void
die (
const char *msg
)
{
fprintf (stderr, appname ": %s\n", msg);
exit (1);
}
static void
die2 (
const char *fmt,
const char *p
)
{
fprintf (stderr, appname ": ");
fprintf (stderr, fmt, p);
fprintf (stderr, "\n");
exit (1);
}
static void
die3 (
const char *fmt,
const char *p,
const char *q
)
{
fprintf (stderr, appname ": ");
fprintf (stderr, fmt, p, q);
fprintf (stderr, "\n");
exit (1);
}
static void
die3l (
const char *fmt,
unsigned long l,
const char *p
)
{
fprintf (stderr, appname ": ");
fprintf (stderr, fmt, l, p);
fprintf (stderr, "\n");
exit (1);
}
static const char *arabic_shaping_tags[] = {
"isolated",
"final",
"initial",
"medial",
NULL
};
static int
shape_is (
const char *s,
const char *type_list[]
)
{
const char **p = type_list;
for (; *p; p++)
if (!strcmp (s, p[0]))
return p - type_list;
return -1;
}
#define table_name "ArShap"
#define macro_name "FRIBIDI_GET_ARABIC_SHAPE_PRES"
#define START_CHAR 0x600
#define END_CHAR 0x700
static FriBidiChar table[FRIBIDI_UNICODE_CHARS][4];
static char buf[4000];
static char tag[sizeof (buf)], buf2[sizeof (buf)];
static FriBidiChar minshaped, maxshaped;
static void
clear_tab (
void
)
{
register FriBidiChar c;
register int shape;
for (c = 0; c < FRIBIDI_UNICODE_CHARS; c++)
for (shape = 0; shape < 4; shape++)
table[c][shape] = c;
}
static void
init (
void
)
{
minshaped = FRIBIDI_UNICODE_CHARS;
maxshaped = 0;
clear_tab ();
}
static void
read_unicode_data_txt (
FILE *f
)
{
unsigned long c, unshaped, l;
l = 0;
while (fgets (buf, sizeof buf, f))
{
int i, shape;
const char *s = buf;
l++;
while (*s == ' ')
s++;
if (*s == '#' || *s == '\0' || *s == '\n')
continue;
i = sscanf (s, "%lx;%*[^;];%*[^;];%*[^;];%*[^;];<%[^;> ]> %lx %[^; ]", &c, tag, &unshaped, buf2);
if (i != 3)
continue;
if (i != 3 || c >= FRIBIDI_UNICODE_CHARS || unshaped >= FRIBIDI_UNICODE_CHARS)
die3l ("UnicodeData.txt: invalid input at line %ld: %s", l, s);
shape = shape_is (tag, arabic_shaping_tags);
if (shape >= 0)
{
table[unshaped][shape] = c;
if (unshaped < minshaped)
minshaped = unshaped;
if (unshaped > maxshaped)
maxshaped = unshaped;
}
}
}
static void
read_data (
const char *data_file_type[],
const char *data_file_name[]
)
{
FILE *f;
for (; data_file_name[0] && data_file_type[0];
data_file_name++, data_file_type++)
{
fprintf (stderr, "Reading `%s'\n", data_file_name[0]);
if (!(f = fopen (data_file_name[0], "rt")))
die2 ("error: cannot open `%s' for reading", data_file_name[0]);
if (!strcmp (data_file_type[0], "UnicodeData.txt"))
read_unicode_data_txt (f);
else
die2 ("error: unknown data-file type %s", data_file_type[0]);
fclose (f);
}
}
static void
gen_arabic_shaping_tab (
int max_depth /* currently unused */,
const char *data_file_type[]
)
{
register FriBidiChar c;
register int shape;
if (maxshaped < minshaped)
die ("error: no shaping pair found, something wrong with reading input");
fprintf (stderr,
"Generating `" outputname "', it may take up to a few minutes\n");
printf ("/* " outputname "\n * generated by " appname " (" FRIBIDI_NAME " "
FRIBIDI_VERSION ")\n" " * from the files %s, %s of Unicode version "
FRIBIDI_UNICODE_VERSION ". */\n\n", data_file_type[0],
data_file_type[1]);
printf ("/*\n"
" use %s(key,shape) to access your table\n\n"
" required memory: %ld\n"
" */\n\n",
macro_name, (long)(maxshaped - minshaped + 1) * 4 * sizeof (FriBidiChar));
printf ("\n" "/* *IND" "ENT-OFF* */\n\n");
printf ("static const FriBidiChar %s[%d][%d] = {\n", table_name, maxshaped - minshaped + 1, 4);
for (c = minshaped; c <= maxshaped; c++)
{
printf (" {");
for (shape = 0; shape < 4; shape++)
printf ("0x%04lx,", (unsigned long)table[c][shape]);
printf ("},\n");
}
printf ("};\n\n");
printf ("/* *IND" "ENT-ON* */\n\n");
printf ("#ifndef FRIBIDI_ACCESS_SHAPE_TABLE\n"
"# define FRIBIDI_ACCESS_SHAPE_TABLE(table,min,max,x,shape) \\\n"
" (((x)<(min)||(x)>(max))?(x):(table)[(x)-(min)][(shape)])\n"
"#endif\n\n");
printf ("#define %s(x,shape) "
"FRIBIDI_ACCESS_SHAPE_TABLE(%s, 0x%04lx, 0x%04lx, (x), (shape))\n\n",
macro_name, table_name, (unsigned long)minshaped, (unsigned long)maxshaped);
printf ("/* End of generated " outputname " */\n");
}
int
main (
int argc,
const char **argv
)
{
const char *data_file_type[] =
{ "UnicodeData.txt", NULL };
if (argc < 3)
die3 ("usage:\n " appname " max-depth /path/to/%s /path/to/%s [junk...]",
data_file_type[0], data_file_type[1]);
{
int max_depth = atoi (argv[1]);
const char *data_file_name[] = { NULL, NULL };
data_file_name[0] = argv[2];
if (max_depth < 2)
die ("invalid depth");
init ();
read_data (data_file_type, data_file_name);
gen_arabic_shaping_tab (max_depth, data_file_type);
}
return 0;
}

367
gen.tab/gen-bidi-type-tab.c Normal file
View file

@ -0,0 +1,367 @@
/* FriBidi
* gen-bidi-type-tab.c - generate bidi-type.tab.i
*
* $Id: gen-bidi-type-tab.c,v 1.18 2006-01-31 03:23:12 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:12 $
* $Revision: 1.18 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/gen.tab/gen-bidi-type-tab.c,v $
*
* Author:
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002,2004 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include <common.h>
#include <fribidi-unicode.h>
#include <stdio.h>
#if STDC_HEADERS+0
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#if HAVE_STRING_H+0
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#if HAVE_STRINGS_H+0
# include <strings.h>
#endif
#include "packtab.h"
#define appname "gen-bidi-type-tab"
#define outputname "bidi-type.tab.i"
static void
die (
const char *msg
)
{
fprintf (stderr, appname ": %s\n", msg);
exit (1);
}
static void
die2 (
const char *fmt,
const char *p
)
{
fprintf (stderr, appname ": ");
fprintf (stderr, fmt, p);
fprintf (stderr, "\n");
exit (1);
}
static void
die3 (
const char *fmt,
unsigned long l,
const char *p
)
{
fprintf (stderr, appname ": ");
fprintf (stderr, fmt, l, p);
fprintf (stderr, "\n");
exit (1);
}
enum FriBidiCharTypeLinearEnumOffsetOne
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE,
# define _FRIBIDI_ADD_ALIAS(TYPE1,TYPE2) TYPE1 = TYPE2,
# include <fribidi-bidi-types-list.h>
# undef _FRIBIDI_ADD_ALIAS
# undef _FRIBIDI_ADD_TYPE
NUM_TYPES
};
struct
{
const char *name;
int key;
}
type_names[] =
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) {STRINGIZE(TYPE), TYPE},
# define _FRIBIDI_ADD_ALIAS(TYPE1,TYPE2) _FRIBIDI_ADD_TYPE(TYPE1, SYMBOL)
# include <fribidi-bidi-types-list.h>
# undef _FRIBIDI_ADD_ALIAS
# undef _FRIBIDI_ADD_TYPE
};
#define type_names_count (sizeof (type_names) / sizeof (type_names[0]))
static const char *names[type_names_count];
static char
get_type (
const char *s
)
{
unsigned int i;
for (i = 0; i < type_names_count; i++)
if (!strcmp (s, type_names[i].name))
return type_names[i].key;
die2 ("bidi type name `%s' not found", s);
return 0;
}
#define table_name "Bid"
#define macro_name "FRIBIDI_GET_BIDI_TYPE"
static signed int table[FRIBIDI_UNICODE_CHARS];
static char buf[4000];
static char tp[sizeof (buf)];
static void
init (
void
)
{
register int i;
for (i = 0; i < type_names_count; i++)
names[i] = 0;
for (i = type_names_count - 1; i >= 0; i--)
names[type_names[i].key] = type_names[i].name;
}
static void
clear_tab (
void
)
{
register FriBidiChar c;
for (c = 0; c < FRIBIDI_UNICODE_CHARS; c++)
table[c] = LTR;
}
static void
init_tab_unicode_data_txt (
void
)
{
register FriBidiChar c;
clear_tab ();
for (c = 0x0590; c < 0x0600; c++)
table[c] = RTL;
for (c = 0x07C0; c < 0x0900; c++)
table[c] = RTL;
for (c = 0xFB1D; c < 0xFB50; c++)
table[c] = RTL;
for (c = 0x0600; c < 0x07C0; c++)
table[c] = AL;
for (c = 0xFB50; c < 0xFDD0; c++)
table[c] = AL;
for (c = 0xFDF0; c < 0xFE00; c++)
table[c] = AL;
for (c = 0xFE70; c < 0xFF00; c++)
table[c] = AL;
for (c = 0x2060; c < 0x2070; c++)
table[c] = BN;
for (c = 0xFDD0; c < 0xFDF0; c++)
table[c] = BN;
for (c = 0xFFF0; c < 0xFFF9; c++)
table[c] = BN;
for (c = 0xFFFF; c < FRIBIDI_UNICODE_CHARS; c += 0x10000)
table[c - 1] = table[c] = BN;
if (FRIBIDI_UNICODE_CHARS > 0x10000)
{
for (c = 0x10800; c < 0x11000; c++)
table[c] = RTL;
for (c = 0xE0000; c < 0xE1000; c++)
table[c] = BN;
}
}
static void
init_tab_derived_bidi_class_txt (
void
)
{
clear_tab ();
}
static void
read_unicode_data_txt (
FILE *f
)
{
unsigned long c, l;
init_tab_unicode_data_txt ();
l = 0;
while (fgets (buf, sizeof buf, f))
{
int i;
const char *s = buf;
l++;
while (*s == ' ')
s++;
if (s[0] == '#' || s[0] == '\0' || s[0] == '\n')
continue;
i = sscanf (s, "%lx;%*[^;];%*[^;];%*[^;];%[^; ]", &c, tp);
if (i != 2 || c >= FRIBIDI_UNICODE_CHARS)
die3 ("invalid input at line %ld: %s", l, s);
/* FIXME: We don't handle First..Last parts of UnicodeData.txt,
* but it works, since all those are LTR. */
table[c] = get_type (tp);
}
}
static void
read_derived_bidi_class_txt (
FILE *f
)
{
unsigned long c, c2, l;
init_tab_derived_bidi_class_txt ();
l = 0;
while (fgets (buf, sizeof buf, f))
{
int i;
register char typ;
const char *s = buf;
l++;
while (*s == ' ')
s++;
if (s[0] == '#' || s[0] == '\0' || s[0] == '\n')
continue;
i = sscanf (s, "%lx ; %[^; ]", &c, tp);
if (i == 2)
c2 = c;
else
i = sscanf (s, "%lx..%lx ; %[^; ]", &c, &c2, tp) - 1;
if (i != 2 || c > c2 || c2 >= FRIBIDI_UNICODE_CHARS)
die3 ("invalid input at line %ld: %s", l, s);
typ = get_type (tp);
for (; c <= c2; c++)
table[c] = typ;
}
}
static void
read_data (
const char *data_file_type,
const char *data_file_name
)
{
FILE *f;
fprintf (stderr, "Reading `%s'\n", data_file_name);
if (!(f = fopen (data_file_name, "rt")))
die2 ("error: cannot open `%s' for reading", data_file_name);
if (!strcmp (data_file_type, "UnicodeData.txt"))
read_unicode_data_txt (f);
else if (!strcmp (data_file_type, "DerivedBidiClass.txt"))
read_derived_bidi_class_txt (f);
else
die2 ("error: unknown data-file type %s", data_file_type);
fclose (f);
}
static void
gen_bidi_type_tab (
int max_depth,
const char *data_file_type
)
{
fprintf (stderr,
"Generating `" outputname "', it may take up to a few minutes\n");
printf ("/* " outputname "\n * generated by " appname " (" FRIBIDI_NAME " "
FRIBIDI_VERSION ")\n" " * from the file %s of Unicode version "
FRIBIDI_UNICODE_VERSION ". */\n\n", data_file_type);
printf ("#define PACKTAB_UINT8 fribidi_uint8\n"
"#define PACKTAB_UINT16 fribidi_uint16\n"
"#define PACKTAB_UINT32 fribidi_uint32\n\n");
if (!pack_table
(table, FRIBIDI_UNICODE_CHARS, 1, LTR, max_depth, 3, names,
"unsigned char", table_name, macro_name, stdout))
die ("error: insufficient memory, decrease max_depth");
printf ("#undef PACKTAB_UINT8\n"
"#undef PACKTAB_UINT16\n" "#undef PACKTAB_UINT32\n\n");
printf ("/* End of generated " outputname " */\n");
}
int
main (
int argc,
const char **argv
)
{
const char *data_file_type = "UnicodeData.txt";
if (argc < 3)
die2 ("usage:\n " appname " max-depth /path/to/%s [junk...]",
data_file_type);
{
int max_depth = atoi (argv[1]);
const char *data_file_name = argv[2];
if (max_depth < 2)
die ("invalid depth");
init ();
read_data (data_file_type, data_file_name);
gen_bidi_type_tab (max_depth, data_file_type);
}
return 0;
}

View file

@ -0,0 +1,361 @@
/* FriBidi
* gen-joining-type-tab.c - generate joining-type.tab.i
*
* $Id: gen-joining-type-tab.c,v 1.7 2010-12-07 19:44:26 behdad Exp $
* $Author: behdad $
* $Date: 2010-12-07 19:44:26 $
* $Revision: 1.7 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/gen.tab/gen-joining-type-tab.c,v $
*
* Author:
* Behdad Esfahbod, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2004 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include <common.h>
#include <fribidi-unicode.h>
#include <stdio.h>
#if STDC_HEADERS+0
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#if HAVE_STRING_H+0
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#if HAVE_STRINGS_H+0
# include <strings.h>
#endif
#include "packtab.h"
#define appname "gen-joining-type-tab"
#define outputname "joining-type.tab.i"
static void
die (
const char *msg
)
{
fprintf (stderr, appname ": %s\n", msg);
exit (1);
}
static void
die2 (
const char *fmt,
const char *p
)
{
fprintf (stderr, appname ": ");
fprintf (stderr, fmt, p);
fprintf (stderr, "\n");
exit (1);
}
static void
die3 (
const char *fmt,
const char *p,
const char *q
)
{
fprintf (stderr, appname ": ");
fprintf (stderr, fmt, p, q);
fprintf (stderr, "\n");
exit (1);
}
static void
die3l (
const char *fmt,
unsigned long l,
const char *p
)
{
fprintf (stderr, appname ": ");
fprintf (stderr, fmt, l, p);
fprintf (stderr, "\n");
exit (1);
}
enum FriBidiJoiningLinearEnumOffsetOne
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE,
# include <fribidi-joining-types-list.h>
# undef _FRIBIDI_ADD_TYPE
NUM_TYPES
};
struct
{
const char *name;
int key;
}
type_names[] =
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) {STRINGIZE(TYPE), TYPE},
# include <fribidi-joining-types-list.h>
# undef _FRIBIDI_ADD_TYPE
};
#define type_names_count (sizeof (type_names) / sizeof (type_names[0]))
static const char *names[type_names_count];
static char
get_type (
const char *s
)
{
unsigned int i;
for (i = 0; i < type_names_count; i++)
if (!strcmp (s, type_names[i].name))
return type_names[i].key;
die2 ("joining type name `%s' not found", s);
return -1;
}
static const char *ignored_bidi_types[] = {
"BN",
"LRE",
"RLE",
"LRO",
"RLO",
"PDF",
NULL
};
static const char *transparent_general_categories[] = {
"Mn",
"Mn",
"Cf",
NULL
};
static const char *
type_is (
const char *s,
const char *type_list[]
)
{
for (; type_list[0]; type_list++)
if (!strcmp (s, type_list[0]))
return type_list[0];
return NULL;
}
#define table_name "Joi"
#define macro_name "FRIBIDI_GET_JOINING_TYPE"
static signed int table[FRIBIDI_UNICODE_CHARS];
static char buf[4000];
static char tp[sizeof (buf)], tp_gen[sizeof (buf)], tp_bidi[sizeof (buf)];
static void
clear_tab (
void
)
{
register FriBidiChar c;
for (c = 0; c < FRIBIDI_UNICODE_CHARS; c++)
table[c] = U;
}
static void
init (
void
)
{
register int i;
for (i = 0; i < type_names_count; i++)
names[i] = 0;
for (i = type_names_count - 1; i >= 0; i--)
names[type_names[i].key] = type_names[i].name;
clear_tab ();
}
static void
read_unicode_data_txt (
FILE *f
)
{
unsigned long c, l;
l = 0;
while (fgets (buf, sizeof buf, f))
{
int i;
const char *s = buf;
l++;
while (*s == ' ')
s++;
if (*s == '#' || *s == '\0' || *s == '\n')
continue;
i = sscanf (s, "%lx;%*[^;];%[^; ];%*[^;];%[^; ]", &c, tp_gen, tp_bidi);
if (i != 3 || c >= FRIBIDI_UNICODE_CHARS)
die3l ("UnicodeData.txt: invalid input at line %ld: %s", l, s);
if (type_is (tp_bidi, ignored_bidi_types))
table[c] = G;
if (type_is (tp_gen, transparent_general_categories))
table[c] = T;
}
}
static void
read_arabic_shaping_txt (
FILE *f
)
{
unsigned long c, c2, l;
l = 0;
while (fgets (buf, sizeof buf, f))
{
int i;
register char typ;
const char *s = buf;
l++;
while (*s == ' ')
s++;
if (*s == '#' || *s == '\0' || *s == '\n')
continue;
i = sscanf (s, "%lx ; %*[^;]; %[^; ]", &c, tp);
if (i == 2)
c2 = c;
else
i = sscanf (s, "%lx..%lx ; %*[^;]; %[^; ]", &c, &c2, tp) - 1;
if (i != 2 || c > c2 || c2 >= FRIBIDI_UNICODE_CHARS)
die3l ("ArabicShaping.txt: invalid input at line %ld: %s", l, s);
typ = get_type (tp);
for (; c <= c2; c++)
table[c] = typ;
}
}
static void
read_data (
const char *data_file_type[],
const char *data_file_name[]
)
{
FILE *f;
for (; data_file_name[0] && data_file_type[0];
data_file_name++, data_file_type++)
{
fprintf (stderr, "Reading `%s'\n", data_file_name[0]);
if (!(f = fopen (data_file_name[0], "rt")))
die2 ("error: cannot open `%s' for reading", data_file_name[0]);
if (!strcmp (data_file_type[0], "UnicodeData.txt"))
read_unicode_data_txt (f);
else if (!strcmp (data_file_type[0], "ArabicShaping.txt"))
read_arabic_shaping_txt (f);
else
die2 ("error: unknown data-file type %s", data_file_type[0]);
fclose (f);
}
}
static void
gen_joining_type_tab (
int max_depth,
const char *data_file_type[]
)
{
fprintf (stderr,
"Generating `" outputname "', it may take up to a few minutes\n");
printf ("/* " outputname "\n * generated by " appname " (" FRIBIDI_NAME " "
FRIBIDI_VERSION ")\n" " * from the files %s, %s of Unicode version "
FRIBIDI_UNICODE_VERSION ". */\n\n", data_file_type[0],
data_file_type[1]);
printf ("#define PACKTAB_UINT8 fribidi_uint8\n"
"#define PACKTAB_UINT16 fribidi_uint16\n"
"#define PACKTAB_UINT32 fribidi_uint32\n\n");
if (!pack_table
(table, FRIBIDI_UNICODE_CHARS, 1, U, max_depth, 1, names,
"unsigned char", table_name, macro_name, stdout))
die ("error: insufficient memory, decrease max_depth");
printf ("#undef PACKTAB_UINT8\n"
"#undef PACKTAB_UINT16\n" "#undef PACKTAB_UINT32\n\n");
printf ("/* End of generated " outputname " */\n");
}
int
main (
int argc,
const char **argv
)
{
const char *data_file_type[] =
{ "UnicodeData.txt", "ArabicShaping.txt", NULL };
if (argc < 4)
die3 ("usage:\n " appname " max-depth /path/to/%s /path/to/%s [junk...]",
data_file_type[0], data_file_type[1]);
{
int max_depth = atoi (argv[1]);
const char *data_file_name[] = { NULL, NULL, NULL };
data_file_name[0] = argv[2];
data_file_name[1] = argv[3];
if (max_depth < 2)
die ("invalid depth");
init ();
read_data (data_file_type, data_file_name);
gen_joining_type_tab (max_depth, data_file_type);
}
return 0;
}

249
gen.tab/gen-mirroring-tab.c Normal file
View file

@ -0,0 +1,249 @@
/* FriBidi
* gen-mirroring-tab.c - generate mirroring.tab.i
*
* $Id: gen-mirroring-tab.c,v 1.14 2006-01-31 03:23:12 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:12 $
* $Revision: 1.14 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/gen.tab/gen-mirroring-tab.c,v $
*
* Author:
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002,2004 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include <common.h>
#include <fribidi-unicode.h>
#include <stdio.h>
#if STDC_HEADERS+0
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#if HAVE_STRING_H+0
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#if HAVE_STRINGS_H+0
# include <strings.h>
#endif
#include "packtab.h"
#define appname "gen-mirroring-tab"
#define outputname "mirroring.tab.i"
static void
die (
const char *msg
)
{
fprintf (stderr, appname ": %s\n", msg);
exit (1);
}
static void
die2 (
const char *fmt,
const char *p
)
{
fprintf (stderr, appname ": ");
fprintf (stderr, fmt, p);
fprintf (stderr, "\n");
exit (1);
}
static void
die4 (
const char *fmt,
unsigned long l,
unsigned long p,
unsigned long q
)
{
fprintf (stderr, appname ": ");
fprintf (stderr, fmt, l, p, q);
fprintf (stderr, "\n");
exit (1);
}
#define table_name "Mir"
#define macro_name "FRIBIDI_GET_MIRRORING"
static signed int table[FRIBIDI_UNICODE_CHARS];
static char buf[4000];
static signed long max_dist;
static void
init (
void
)
{
max_dist = 0;
}
static void
clear_tab (
void
)
{
register FriBidiChar c;
for (c = 0; c < FRIBIDI_UNICODE_CHARS; c++)
table[c] = 0;
}
static void
init_tab_mirroring_txt (
void
)
{
clear_tab ();
}
static void
read_bidi_mirroring_txt (
FILE *f
)
{
unsigned long l;
init_tab_mirroring_txt ();
l = 0;
while (fgets (buf, sizeof buf, f))
{
unsigned long i, j;
signed long dist;
int k;
const char *s = buf;
l++;
while (*s == ' ')
s++;
if (s[0] == '#' || s[0] == '\0' || s[0] == '\n')
continue;
k = sscanf (s, "%lx; %lx", &i, &j);
if (k != 2 || i >= FRIBIDI_UNICODE_CHARS || j >= FRIBIDI_UNICODE_CHARS)
die4 ("invalid pair in input at line %ld: %04lX, %04lX", l, i, j);
dist = ((signed long) j - (signed long) i);
table[i] = dist;
if (dist > max_dist)
max_dist = dist;
else if (-dist > max_dist)
max_dist = -dist;
}
}
static void
read_data (
const char *data_file_type,
const char *data_file_name
)
{
FILE *f;
fprintf (stderr, "Reading `%s'\n", data_file_name);
if (!(f = fopen (data_file_name, "rt")))
die2 ("error: cannot open `%s' for reading", data_file_name);
if (!strcmp (data_file_type, "BidiMirroring.txt"))
read_bidi_mirroring_txt (f);
else
die2 ("error: unknown data-file-type %s", data_file_type);
fclose (f);
}
static void
gen_mirroring_tab (
int max_depth,
const char *data_file_type
)
{
int key_bytes;
const char *key_type;
fprintf (stderr,
"Generating `" outputname "', it may take up to a few minutes\n");
printf ("/* " outputname "\n * generated by " appname " (" FRIBIDI_NAME " "
FRIBIDI_VERSION ")\n" " * from the file %s of Unicode version "
FRIBIDI_UNICODE_VERSION ". */\n\n", data_file_type);
printf ("#define PACKTAB_UINT8 fribidi_uint8\n"
"#define PACKTAB_UINT16 fribidi_uint16\n"
"#define PACKTAB_UINT32 fribidi_uint32\n\n");
key_bytes = max_dist <= 0x7f ? 1 : max_dist < 0x7fff ? 2 : 4;
key_type = key_bytes == 1 ? "fribidi_int8" : key_bytes == 2 ?
"fribidi_int16" : "fribidi_int32";
if (!pack_table
(table, FRIBIDI_UNICODE_CHARS, key_bytes, 0, max_depth, 1, NULL,
key_type, table_name, macro_name "_DELTA", stdout))
die ("error: insufficient memory, decrease max_depth");
printf ("#undef PACKTAB_UINT8\n"
"#undef PACKTAB_UINT16\n" "#undef PACKTAB_UINT32\n\n");
printf ("#define " macro_name "(x) ((x) + " macro_name "_DELTA(x))\n\n");
printf ("/* End of generated " outputname " */\n");
}
int
main (
int argc,
const char **argv
)
{
const char *data_file_type = "BidiMirroring.txt";
if (argc < 3)
die2 ("usage:\n " appname " max-depth /path/to/%s [junk...]",
data_file_type);
{
int max_depth = atoi (argv[1]);
const char *data_file_name = argv[2];
if (max_depth < 2)
die ("invalid depth");
init ();
read_data (data_file_type, data_file_name);
gen_mirroring_tab (max_depth, data_file_type);
}
return 0;
}

View file

@ -0,0 +1,206 @@
/* FriBidi
* gen-unicode-version.c - generate fribidi-unicode-version.h
*
* $Id: gen-unicode-version.c,v 1.12 2006-01-31 03:23:12 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:12 $
* $Revision: 1.12 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/gen.tab/gen-unicode-version.c,v $
*
* Author:
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2004 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include <common.h>
#include <stdio.h>
#if STDC_HEADERS+0
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#if HAVE_STRING_H+0
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#if HAVE_STRINGS_H+0
# include <strings.h>
#endif
#include "packtab.h"
#define appname "gen-unicode-version"
#define outputname "fribidi-unicode-version.h"
static void
die (
const char *msg
)
{
fprintf (stderr, appname ": %s\n", msg);
exit (1);
}
static void
die2 (
const char *fmt,
const char *p
)
{
fprintf (stderr, appname ": ");
fprintf (stderr, fmt, p);
fprintf (stderr, "\n");
exit (1);
}
int version_major, version_minor, version_micro;
char unicode_version[100];
char buf[4000];
static void
init (
void
)
{
version_major = version_minor = version_micro = 0;
strcpy (unicode_version, "(unknown)");
}
#define READ_VERSION(prefix) ((where = strstr(buf, prefix)) && \
(3 == sscanf (where, \
prefix"%d.%d.%d", &version_major, &version_minor, &version_micro)))
static int
read_file (
FILE *f
)
{
int found = 0;
version_micro = 0;
while (fgets (buf, sizeof buf, f))
{
const char *where;
if (READ_VERSION ("Version ") || READ_VERSION ("Unicode "))
{
found = 1;
break;
}
}
if (!found)
return 0;
sprintf (unicode_version, "%d.%d.%d", version_major, version_minor,
version_micro);
return 1;
}
static int
read_data (
const char *data_file_type,
const char *data_file_name
)
{
FILE *f;
int status;
fprintf (stderr, "Reading `%s'\n", data_file_name);
if (!(f = fopen (data_file_name, "rt")))
die2 ("error: cannot open `%s' for reading", data_file_name);
status = read_file (f);
fclose (f);
return status;
}
static void
gen_unicode_version (
const char *data_file_type
)
{
fprintf (stderr, "Generating `" outputname "'\n");
printf ("/* " outputname "\n * generated by " appname " (" FRIBIDI_NAME " "
FRIBIDI_VERSION ")\n" " * from the file %s */\n\n", data_file_type);
printf ("#define FRIBIDI_UNICODE_VERSION \"%s\"\n"
"#define FRIBIDI_UNICODE_MAJOR_VERSION %d\n"
"#define FRIBIDI_UNICODE_MINOR_VERSION %d\n"
"#define FRIBIDI_UNICODE_MICRO_VERSION %d\n"
"#define FRIBIDI_UNICODE_NAMESPACE(SYMBOL) \\\n"
" FRIBIDI_NAMESPACE(SYMBOL##_unicode_%d_%d_%d)\n"
"#define FRIBIDI_UNICODE_PRIVATESPACE(SYMBOL) \\\n"
" FRIBIDI_PRIVATESPACE(SYMBOL##_unicode_%d_%d_%d)\n"
"\n",
unicode_version,
version_major, version_minor, version_micro,
version_major, version_minor, version_micro,
version_major, version_minor, version_micro);
printf ("/* End of generated " outputname " */\n");
}
int
main (
int argc,
const char **argv
)
{
const char *data_file_type;
int i;
int found = 0;
if (argc < 2)
die ("usage:\n " appname
" /path/to/a/UCD/file [/path/to/more/UCD/files ...]");
{
const char *data_file_name;
init ();
for (i = 1; i < argc && !found; i++)
{
data_file_name = argv[i];
data_file_type = strrchr (data_file_name, '/');
if (data_file_type)
data_file_type++;
else
data_file_type = data_file_name;
found = read_data (data_file_type, data_file_name);
}
if (!found)
die ("error: version not found");
gen_unicode_version (data_file_type);
}
return 0;
}

443
gen.tab/packtab.c Normal file
View file

@ -0,0 +1,443 @@
/* PackTab - Pack a static table
* Copyright (C) 2001 Behdad Esfahbod.
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <fwpg@sharif.edu>.
*/
/*
8 <= N <= 2^21
int key
1 <= max_depth <= 21
*/
#if HAVE_CONFIG_H+0
# include <config.h>
#endif /* HAVE_CONFIG_H */
#include <stdio.h>
#if STDC_HEADERS+0
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#if HAVE_STRING_H+0
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#if HAVE_STRINGS_H+0
# include <strings.h>
#endif
#include "packtab.h"
typedef signed int uni_table[1024 * 1024 * 2];
static int n, a, max_depth, digits, tab_width, per_row;
static long N;
signed int def_key;
static uni_table temp, x, perm, *tab;
static long pow[22], cluster, cmpcluster;
static const char *const *name, *key_type_name, *table_name, *macro_name;
static FILE *f;
static long
most_binary (
long min,
long max
)
{
/* min should be less than max */
register int i, ii;
if (min == max)
return max;
for (i = 21; max < pow[i]; i--)
;
ii = i;
while (i && !((min ^ max) & pow[i]))
i--;
if (ii == i)
{
/* min is less than half of max */
for (i = 21 - 1; min < pow[i]; i--)
;
i++;
return pow[i];
}
return max & (pow[i] - 1);
}
static void
init (
const signed int *table
)
{
register int i;
/* initialize powers of two */
pow[0] = 1;
for (i = 1; i <= 21; i++)
pow[i] = pow[i - 1] << 1;
/* reduce number of elements to get a more binary number */
{
long essen;
/* find number of essential items */
essen = N - 1;
while (essen && table[essen] == def_key)
essen--;
essen++;
N = most_binary (essen, N);
}
for (n = 21; N % pow[n]; n--)
;
digits = (n + 3) / 4;
for (i = 6; i; i--)
if (pow[i] * (tab_width + 1) < 80)
break;
per_row = pow[i];
}
static int
compare (
const void *r,
const void *s
)
{
int i;
for (i = 0; i < cmpcluster; i++)
if (((int *) r)[i] != ((int *) s)[i])
return ((int *) r)[i] - ((int *) s)[i];
return 0;
}
static int lev, best_lev, p[22], best_p[22], nn;
static long c[22], best_c[22], s, best_s;
static long t[22], best_t[22], clusters[22], best_cluster[22];
static void
found (
void
)
{
int i;
if (s < best_s)
{
best_s = s;
best_lev = lev;
for (i = 0; i <= lev; i++)
{
best_p[i] = p[i];
best_c[i] = c[i];
best_t[i] = t[i];
best_cluster[i] = clusters[i];
}
}
}
static void
bt (
int node_size
)
{
long i, j, k, y, sbak;
long key_bytes;
if (t[lev] == 1)
{
found ();
return;
}
if (lev == max_depth)
return;
for (i = 1 - t[lev] % 2; i <= nn + (t[lev] >> nn) % 2; i++)
{
nn -= (p[lev] = i);
clusters[lev] = cluster = (i && nn >= 0) ? pow[i] : t[lev];
cmpcluster = cluster + 1;
t[lev + 1] = (t[lev] - 1) / cluster + 1;
for (j = 0; j < t[lev + 1]; j++)
{
memmove (temp + j * cmpcluster, tab[lev] + j * cluster,
cluster * sizeof (tab[lev][0]));
temp[j * cmpcluster + cluster] = j;
}
qsort (temp, t[lev + 1], cmpcluster * sizeof (temp[0]), compare);
for (j = 0; j < t[lev + 1]; j++)
{
perm[j] = temp[j * cmpcluster + cluster];
temp[j * cmpcluster + cluster] = 0;
}
k = 1;
y = 0;
tab[lev + 1][perm[0]] = perm[0];
for (j = 1; j < t[lev + 1]; j++)
{
if (compare (temp + y, temp + y + cmpcluster))
{
k++;
tab[lev + 1][perm[j]] = perm[j];
}
else
tab[lev + 1][perm[j]] = tab[lev + 1][perm[j - 1]];
y += cmpcluster;
}
sbak = s;
s += k * node_size * cluster;
c[lev] = k;
if (s >= best_s)
{
s = sbak;
nn += i;
return;
}
key_bytes = k * cluster;
key_bytes = key_bytes < 0xff ? 1 : key_bytes < 0xffff ? 2 : 4;
lev++;
bt (key_bytes);
lev--;
s = sbak;
nn += i;
}
}
static void
solve (
void
)
{
best_lev = max_depth + 2;
best_s = N * a * 2;
lev = 0;
s = 0;
nn = n;
t[0] = N;
bt (a);
}
static void
write_array (
long max_key
)
{
int i, j, k, y, ii, ofs;
const char *key_type;
if (best_t[lev] == 1)
return;
nn -= (i = best_p[lev]);
cluster = best_cluster[lev];
cmpcluster = cluster + 1;
t[lev + 1] = best_t[lev + 1];
for (j = 0; j < t[lev + 1]; j++)
{
memmove (temp + j * cmpcluster, tab[lev] + j * cluster,
cluster * sizeof (tab[lev][0]));
temp[j * cmpcluster + cluster] = j;
}
qsort (temp, t[lev + 1], cmpcluster * sizeof (temp[0]), compare);
for (j = 0; j < t[lev + 1]; j++)
{
perm[j] = temp[j * cmpcluster + cluster];
temp[j * cmpcluster + cluster] = 0;
}
k = 1;
y = 0;
tab[lev + 1][perm[0]] = x[0] = perm[0];
for (j = 1; j < t[lev + 1]; j++)
{
if (compare (temp + y, temp + y + cmpcluster))
{
x[k] = perm[j];
tab[lev + 1][perm[j]] = x[k];
k++;
}
else
tab[lev + 1][perm[j]] = tab[lev + 1][perm[j - 1]];
y += cmpcluster;
}
i = 0;
for (ii = 1; ii < k; ii++)
if (x[ii] < x[i])
i = ii;
key_type = !lev ? key_type_name :
max_key <= 0xff ? "PACKTAB_UINT8" :
max_key <= 0xffff ? "PACKTAB_UINT16" : "PACKTAB_UINT32";
fprintf (f, "static const %s %sLev%d[%ld*%d] = {", key_type, table_name,
best_lev - lev - 1, cluster, k);
ofs = 0;
for (ii = 0; ii < k; ii++)
{
int kk, jj;
fprintf (f, "\n#define %sLev%d_%0*lX 0x%0X", table_name,
best_lev - lev - 1, digits, x[i] * pow[n - nn], ofs);
kk = x[i] * cluster;
if (!lev)
if (name)
for (j = 0; j < cluster; j++)
{
if (!(j % per_row) && j != cluster - 1)
fprintf (f, "\n ");
fprintf (f, "%*s,", tab_width, name[tab[lev][kk++]]);
}
else
for (j = 0; j < cluster; j++)
{
if (!(j % per_row) && j != cluster - 1)
fprintf (f, "\n ");
fprintf (f, "%*d,", tab_width, tab[lev][kk++]);
}
else
for (j = 0; j < cluster; j++, kk++)
fprintf (f, "\n %sLev%d_%0*lX, /* %0*lX..%0*lX */", table_name,
best_lev - lev, digits,
tab[lev][kk] * pow[n - nn - best_p[lev]], digits,
x[i] * pow[n - nn] + j * pow[n - nn - best_p[lev]], digits,
x[i] * pow[n - nn] + (j + 1) * pow[n - nn - best_p[lev]] -
1);
ofs += cluster;
jj = i;
for (j = 0; j < k; j++)
if (x[j] > x[i] && (x[j] < x[jj] || jj == i))
jj = j;
i = jj;
}
fprintf (f, "\n};\n\n");
lev++;
write_array (cluster * k);
lev--;
}
static void
write_source (
void
)
{
int i, j;
lev = 0;
s = 0;
nn = n;
t[0] = N;
fprintf (f, "\n" "/* *IND" "ENT-OFF* */\n\n");
write_array (0);
fprintf (f, "/* *IND" "ENT-ON* */\n\n");
fprintf (f, "#define %s(x) \\\n", macro_name);
fprintf (f, "\t((x) >= 0x%lx ? ", N);
if (name)
fprintf (f, "%s", name[def_key]);
else
fprintf (f, "%d", def_key);
fprintf (f, " : ");
j = 0;
for (i = best_lev - 1; i >= 0; i--)
{
fprintf (f, " \\\n\t%sLev%d[((x)", table_name, i);
if (j != 0)
fprintf (f, " >> %d", j);
if (i)
fprintf (f, " & 0x%02lx) +", pow[best_p[best_lev - 1 - i]] - 1);
j += best_p[best_lev - 1 - i];
}
fprintf (f, ")");
for (i = 0; i < best_lev; i++)
fprintf (f, "]");
fprintf (f, ")\n\n");
}
static void
write_out (
void
)
{
int i;
fprintf (f, "/*\n"
" generated by packtab.c version %d\n\n"
" use %s(key) to access your table\n\n"
" assumed sizeof(%s): %d\n"
" required memory: %ld\n"
" lookups: %d\n"
" partition shape: %s",
packtab_version, macro_name, key_type_name, a, best_s, best_lev,
table_name);
for (i = best_lev - 1; i >= 0; i--)
fprintf (f, "[%ld]", best_cluster[i]);
fprintf (f, "\n" " different table entries:");
for (i = best_lev - 1; i >= 0; i--)
fprintf (f, " %ld", best_c[i]);
fprintf (f, "\n*/\n");
write_source ();
}
int
pack_table (
const signed int *base,
long key_num,
int key_size,
signed int default_key,
int p_max_depth,
int p_tab_width,
const char *const *p_name,
const char *p_key_type_name,
const char *p_table_name,
const char *p_macro_name,
FILE *out
)
{
N = key_num;
a = key_size;
def_key = default_key;
max_depth = p_max_depth;
tab_width = p_tab_width;
name = p_name;
key_type_name = p_key_type_name;
table_name = p_table_name;
macro_name = p_macro_name;
f = out;
init (base);
if (!(tab = malloc ((n + 1) * sizeof (tab[0]))))
return 0;
memmove (tab[0], base, N * sizeof (base[0]));
solve ();
write_out ();
free (tab);
return 1;
}
/* End of packtab.c */

50
gen.tab/packtab.h Normal file
View file

@ -0,0 +1,50 @@
/* PackTab - Pack a static table
* Copyright (C) 2001 Behdad Esfahbod.
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <fwpg@sharif.edu>.
*/
#ifndef PACKTAB_H
#define PACKTAB_H
#ifdef __cplusplus
extern "C"
{
#endif
#define packtab_version 3
int pack_table (
const signed int *base,
long key_num,
int key_size,
signed int default_key,
int max_depth,
int tab_width,
const char *const *name,
const char *key_type_name,
const char *table_name,
const char *macro_name,
FILE *out
);
#ifdef __cplusplus
}
#endif
#endif /* PACKTAB_H */

View file

@ -0,0 +1,425 @@
# ArabicShaping-6.2.0.txt
# Date: 2012-05-15, 21:05:00 GMT [KW]
#
# This file is a normative contributory data file in the
# Unicode Character Database.
#
# Copyright (c) 1991-2012 Unicode, Inc.
# For terms of use, see http://www.unicode.org/terms_of_use.html
#
# This file defines the Joining_Type and Joining_Group
# property values for Arabic, Syriac, N'Ko, and Mandaic
# positional shaping, repeating in machine readable form the
# information exemplified in Tables 8-3, 8-8, 8-9, 8-10, 8-13, 8-14,
# 8-15, 13-5, 14-5, and 14-6 of The Unicode Standard, Version 6.2.
#
# See sections 8.2, 8.3, 13.5, and 14.12 of The Unicode Standard,
# Version 6.2 for more information.
#
# Each line contains four fields, separated by a semicolon.
#
# Field 0: the code point, in 4-digit hexadecimal
# form, of an Arabic, Syriac, N'Ko, or Mandaic character.
#
# Field 1: gives a short schematic name for that character.
# The schematic name is descriptive of the shape, based as
# consistently as possible on a name for the skeleton and
# then the diacritic marks applied to the skeleton, if any.
# Note that this schematic name is considered a comment,
# and does not constitute a formal property value.
#
# Field 2: defines the joining type (property name: Joining_Type)
# R Right_Joining
# L Left_Joining
# D Dual_Joining
# C Join_Causing
# U Non_Joining
# T Transparent
# See Section 8.2, Arabic for more information on these types.
#
# Field 3: defines the joining group (property name: Joining_Group)
#
# The values of the joining group are based schematically on character
# names. Where a schematic character name consists of two or more parts separated
# by spaces, the formal Joining_Group property value, as specified in
# PropertyValueAliases.txt, consists of the same name parts joined by
# underscores. Hence, the entry:
#
# 0629; TEH MARBUTA; R; TEH MARBUTA
#
# corresponds to [Joining_Group = Teh_Marbuta].
#
# Note: The property value now designated [Joining_Group = Teh_Marbuta_Goal]
# used to apply to both of the following characters
# in earlier versions of the standard:
#
# U+06C2 ARABIC LETTER HEH GOAL WITH HAMZA ABOVE
# U+06C3 ARABIC LETTER TEH MARBUTA GOAL
#
# However, it currently applies only to U+06C3, and *not* to U+06C2.
# To avoid destabilizing existing Joining_Group property aliases, the
# prior Joining_Group value for U+06C3 (Hamza_On_Heh_Goal) has been
# retained as a property value alias, despite the fact that it
# no longer applies to its namesake character, U+06C2.
# See PropertyValueAliases.txt.
#
# When other cursive scripts are added to the Unicode Standard in
# the future, the joining group value of all its letters will default
# to jg=No_Joining_Group in this data file. Other, more specific
# joining group values will be defined only if an explicit proposal
# to define those values exactly has been approved by the UTC. This
# is the convention exemplified by the N'Ko and Mandaic scripts. Only the Arabic
# and Syriac scripts currently have explicit joining group values defined.
#
# Note: Code points that are not explicitly listed in this file are
# either of joining type T or U:
#
# - Those that not explicitly listed that are of General Category Mn, Me, or Cf
# have joining type T.
# - All others not explicitly listed have joining type U.
#
# For an explicit listing of characters of joining type T, see
# the derived property file DerivedJoiningType.txt.
#
# There are currently no characters of joining type L defined in Unicode.
#
# #############################################################
# Unicode; Schematic Name; Joining Type; Joining Group
# Arabic Characters
0600; ARABIC NUMBER SIGN; U; No_Joining_Group
0601; ARABIC SIGN SANAH; U; No_Joining_Group
0602; ARABIC FOOTNOTE MARKER; U; No_Joining_Group
0603; ARABIC SIGN SAFHA; U; No_Joining_Group
0604; ARABIC SIGN SAMVAT; U; No_Joining_Group
0608; ARABIC RAY; U; No_Joining_Group
060B; AFGHANI SIGN; U; No_Joining_Group
0620; DOTLESS YEH WITH SEPARATE RING BELOW; D; YEH
0621; HAMZA; U; No_Joining_Group
0622; ALEF WITH MADDA ABOVE; R; ALEF
0623; ALEF WITH HAMZA ABOVE; R; ALEF
0624; WAW WITH HAMZA ABOVE; R; WAW
0625; ALEF WITH HAMZA BELOW; R; ALEF
0626; DOTLESS YEH WITH HAMZA ABOVE; D; YEH
0627; ALEF; R; ALEF
0628; BEH; D; BEH
0629; TEH MARBUTA; R; TEH MARBUTA
062A; DOTLESS BEH WITH 2 DOTS ABOVE; D; BEH
062B; DOTLESS BEH WITH 3 DOTS ABOVE; D; BEH
062C; HAH WITH DOT BELOW; D; HAH
062D; HAH; D; HAH
062E; HAH WITH DOT ABOVE; D; HAH
062F; DAL; R; DAL
0630; DAL WITH DOT ABOVE; R; DAL
0631; REH; R; REH
0632; REH WITH DOT ABOVE; R; REH
0633; SEEN; D; SEEN
0634; SEEN WITH 3 DOTS ABOVE; D; SEEN
0635; SAD; D; SAD
0636; SAD WITH DOT ABOVE; D; SAD
0637; TAH; D; TAH
0638; TAH WITH DOT ABOVE; D; TAH
0639; AIN; D; AIN
063A; AIN WITH DOT ABOVE; D; AIN
063B; KEHEH WITH 2 DOTS ABOVE; D; GAF
063C; KEHEH WITH 3 DOTS BELOW; D; GAF
063D; FARSI YEH WITH INVERTED V ABOVE; D; FARSI YEH
063E; FARSI YEH WITH 2 DOTS ABOVE; D; FARSI YEH
063F; FARSI YEH WITH 3 DOTS ABOVE; D; FARSI YEH
0640; TATWEEL; C; No_Joining_Group
0641; FEH; D; FEH
0642; QAF; D; QAF
0643; KAF; D; KAF
0644; LAM; D; LAM
0645; MEEM; D; MEEM
0646; NOON; D; NOON
0647; HEH; D; HEH
0648; WAW; R; WAW
0649; DOTLESS YEH; D; YEH
064A; YEH; D; YEH
066E; DOTLESS BEH; D; BEH
066F; DOTLESS QAF; D; QAF
0671; ALEF WITH WASLA ABOVE; R; ALEF
0672; ALEF WITH WAVY HAMZA ABOVE; R; ALEF
0673; ALEF WITH WAVY HAMZA BELOW; R; ALEF
0674; HIGH HAMZA; U; No_Joining_Group
0675; HIGH HAMZA ALEF; R; ALEF
0676; HIGH HAMZA WAW; R; WAW
0677; HIGH HAMZA WAW WITH DAMMA ABOVE; R; WAW
0678; HIGH HAMZA DOTLESS YEH; D; YEH
0679; DOTLESS BEH WITH TAH ABOVE; D; BEH
067A; DOTLESS BEH WITH VERTICAL 2 DOTS ABOVE; D; BEH
067B; DOTLESS BEH WITH VERTICAL 2 DOTS BELOW; D; BEH
067C; DOTLESS BEH WITH ATTACHED RING BELOW AND 2 DOTS ABOVE; D; BEH
067D; DOTLESS BEH WITH INVERTED 3 DOTS ABOVE; D; BEH
067E; DOTLESS BEH WITH 3 DOTS BELOW; D; BEH
067F; DOTLESS BEH WITH 4 DOTS ABOVE; D; BEH
0680; DOTLESS BEH WITH 4 DOTS BELOW; D; BEH
0681; HAH WITH HAMZA ABOVE; D; HAH
0682; HAH WITH VERTICAL 2 DOTS ABOVE; D; HAH
0683; HAH WITH 2 DOTS BELOW; D; HAH
0684; HAH WITH VERTICAL 2 DOTS BELOW; D; HAH
0685; HAH WITH 3 DOTS ABOVE; D; HAH
0686; HAH WITH 3 DOTS BELOW; D; HAH
0687; HAH WITH 4 DOTS BELOW; D; HAH
0688; DAL WITH TAH ABOVE; R; DAL
0689; DAL WITH ATTACHED RING BELOW; R; DAL
068A; DAL WITH DOT BELOW; R; DAL
068B; DAL WITH DOT BELOW AND TAH ABOVE; R; DAL
068C; DAL WITH 2 DOTS ABOVE; R; DAL
068D; DAL WITH 2 DOTS BELOW; R; DAL
068E; DAL WITH 3 DOTS ABOVE; R; DAL
068F; DAL WITH INVERTED 3 DOTS ABOVE; R; DAL
0690; DAL WITH 4 DOTS ABOVE; R; DAL
0691; REH WITH TAH ABOVE; R; REH
0692; REH WITH V ABOVE; R; REH
0693; REH WITH ATTACHED RING BELOW; R; REH
0694; REH WITH DOT BELOW; R; REH
0695; REH WITH V BELOW; R; REH
0696; REH WITH DOT BELOW AND DOT WITHIN; R; REH
0697; REH WITH 2 DOTS ABOVE; R; REH
0698; REH WITH 3 DOTS ABOVE; R; REH
0699; REH WITH 4 DOTS ABOVE; R; REH
069A; SEEN WITH DOT BELOW AND DOT ABOVE; D; SEEN
069B; SEEN WITH 3 DOTS BELOW; D; SEEN
069C; SEEN WITH 3 DOTS BELOW AND 3 DOTS ABOVE; D; SEEN
069D; SAD WITH 2 DOTS BELOW; D; SAD
069E; SAD WITH 3 DOTS ABOVE; D; SAD
069F; TAH WITH 3 DOTS ABOVE; D; TAH
06A0; AIN WITH 3 DOTS ABOVE; D; AIN
06A1; DOTLESS FEH; D; FEH
06A2; DOTLESS FEH WITH DOT BELOW; D; FEH
06A3; FEH WITH DOT BELOW; D; FEH
06A4; DOTLESS FEH WITH 3 DOTS ABOVE; D; FEH
06A5; DOTLESS FEH WITH 3 DOTS BELOW; D; FEH
06A6; DOTLESS FEH WITH 4 DOTS ABOVE; D; FEH
06A7; DOTLESS QAF WITH DOT ABOVE; D; QAF
06A8; DOTLESS QAF WITH 3 DOTS ABOVE; D; QAF
06A9; KEHEH; D; GAF
06AA; SWASH KAF; D; SWASH KAF
06AB; KEHEH WITH ATTACHED RING BELOW; D; GAF
06AC; KAF WITH DOT ABOVE; D; KAF
06AD; KAF WITH 3 DOTS ABOVE; D; KAF
06AE; KAF WITH 3 DOTS BELOW; D; KAF
06AF; GAF; D; GAF
06B0; GAF WITH ATTACHED RING BELOW; D; GAF
06B1; GAF WITH 2 DOTS ABOVE; D; GAF
06B2; GAF WITH 2 DOTS BELOW; D; GAF
06B3; GAF WITH VERTICAL 2 DOTS BELOW; D; GAF
06B4; GAF WITH 3 DOTS ABOVE; D; GAF
06B5; LAM WITH V ABOVE; D; LAM
06B6; LAM WITH DOT ABOVE; D; LAM
06B7; LAM WITH 3 DOTS ABOVE; D; LAM
06B8; LAM WITH 3 DOTS BELOW; D; LAM
06B9; NOON WITH DOT BELOW; D; NOON
06BA; DOTLESS NOON; D; NOON
06BB; DOTLESS NOON WITH TAH ABOVE; D; NOON
06BC; NOON WITH ATTACHED RING BELOW; D; NOON
06BD; NYA; D; NYA
06BE; KNOTTED HEH; D; KNOTTED HEH
06BF; HAH WITH 3 DOTS BELOW AND DOT ABOVE; D; HAH
06C0; DOTLESS TEH MARBUTA WITH HAMZA ABOVE; R; TEH MARBUTA
06C1; HEH GOAL; D; HEH GOAL
06C2; HEH GOAL WITH HAMZA ABOVE; D; HEH GOAL
06C3; TEH MARBUTA GOAL; R; TEH MARBUTA GOAL
06C4; WAW WITH ATTACHED RING WITHIN; R; WAW
06C5; WAW WITH BAR; R; WAW
06C6; WAW WITH V ABOVE; R; WAW
06C7; WAW WITH DAMMA ABOVE; R; WAW
06C8; WAW WITH ALEF ABOVE; R; WAW
06C9; WAW WITH INVERTED V ABOVE; R; WAW
06CA; WAW WITH 2 DOTS ABOVE; R; WAW
06CB; WAW WITH 3 DOTS ABOVE; R; WAW
06CC; FARSI YEH; D; FARSI YEH
06CD; YEH WITH TAIL; R; YEH WITH TAIL
06CE; FARSI YEH WITH V ABOVE; D; FARSI YEH
06CF; WAW WITH DOT ABOVE; R; WAW
06D0; DOTLESS YEH WITH VERTICAL 2 DOTS BELOW; D; YEH
06D1; DOTLESS YEH WITH 3 DOTS BELOW; D; YEH
06D2; YEH BARREE; R; YEH BARREE
06D3; YEH BARREE WITH HAMZA ABOVE; R; YEH BARREE
06D5; DOTLESS TEH MARBUTA; R; TEH MARBUTA
06DD; ARABIC END OF AYAH; U; No_Joining_Group
06EE; DAL WITH INVERTED V ABOVE; R; DAL
06EF; REH WITH INVERTED V ABOVE; R; REH
06FA; SEEN WITH DOT BELOW AND 3 DOTS ABOVE; D; SEEN
06FB; SAD WITH DOT BELOW AND DOT ABOVE; D; SAD
06FC; AIN WITH DOT BELOW AND DOT ABOVE; D; AIN
06FF; KNOTTED HEH WITH INVERTED V ABOVE; D; KNOTTED HEH
# Syriac Characters
0710; ALAPH; R; ALAPH
0712; BETH; D; BETH
0713; GAMAL; D; GAMAL
0714; GAMAL GARSHUNI; D; GAMAL
0715; DALATH; R; DALATH RISH
0716; DOTLESS DALATH RISH; R; DALATH RISH
0717; HE; R; HE
0718; WAW; R; SYRIAC WAW
0719; ZAIN; R; ZAIN
071A; HETH; D; HETH
071B; TETH; D; TETH
071C; TETH GARSHUNI; D; TETH
071D; YUDH; D; YUDH
071E; YUDH HE; R; YUDH HE
071F; KAPH; D; KAPH
0720; LAMADH; D; LAMADH
0721; MIM; D; MIM
0722; NUN; D; NUN
0723; SEMKATH; D; SEMKATH
0724; FINAL SEMKATH; D; FINAL SEMKATH
0725; E; D; E
0726; PE; D; PE
0727; REVERSED PE; D; REVERSED PE
0728; SADHE; R; SADHE
0729; QAPH; D; QAPH
072A; RISH; R; DALATH RISH
072B; SHIN; D; SHIN
072C; TAW; R; TAW
072D; PERSIAN BHETH; D; BETH
072E; PERSIAN GHAMAL; D; GAMAL
072F; PERSIAN DHALATH; R; DALATH RISH
074D; SOGDIAN ZHAIN; R; ZHAIN
074E; SOGDIAN KHAPH; D; KHAPH
074F; SOGDIAN FE; D; FE
# Arabic Supplement Characters
0750; DOTLESS BEH WITH HORIZONTAL 3 DOTS BELOW; D; BEH
0751; BEH WITH 3 DOTS ABOVE; D; BEH
0752; DOTLESS BEH WITH INVERTED 3 DOTS BELOW; D; BEH
0753; DOTLESS BEH WITH INVERTED 3 DOTS BELOW AND 2 DOTS ABOVE; D; BEH
0754; DOTLESS BEH WITH 2 DOTS BELOW AND DOT ABOVE; D; BEH
0755; DOTLESS BEH WITH INVERTED V BELOW; D; BEH
0756; DOTLESS BEH WITH V ABOVE; D; BEH
0757; HAH WITH 2 DOTS ABOVE; D; HAH
0758; HAH WITH INVERTED 3 DOTS BELOW; D; HAH
0759; DAL WITH VERTICAL 2 DOTS BELOW AND TAH ABOVE; R; DAL
075A; DAL WITH INVERTED V BELOW; R; DAL
075B; REH WITH BAR; R; REH
075C; SEEN WITH 4 DOTS ABOVE; D; SEEN
075D; AIN WITH 2 DOTS ABOVE; D; AIN
075E; AIN WITH INVERTED 3 DOTS ABOVE; D; AIN
075F; AIN WITH VERTICAL 2 DOTS ABOVE; D; AIN
0760; DOTLESS FEH WITH 2 DOTS BELOW; D; FEH
0761; DOTLESS FEH WITH INVERTED 3 DOTS BELOW; D; FEH
0762; KEHEH WITH DOT ABOVE; D; GAF
0763; KEHEH WITH 3 DOTS ABOVE; D; GAF
0764; KEHEH WITH INVERTED 3 DOTS BELOW; D; GAF
0765; MEEM WITH DOT ABOVE; D; MEEM
0766; MEEM WITH DOT BELOW; D; MEEM
0767; NOON WITH 2 DOTS BELOW; D; NOON
0768; NOON WITH TAH ABOVE; D; NOON
0769; NOON WITH V ABOVE; D; NOON
076A; LAM WITH BAR; D; LAM
076B; REH WITH VERTICAL 2 DOTS ABOVE; R; REH
076C; REH WITH HAMZA ABOVE; R; REH
076D; SEEN WITH VERTICAL 2 DOTS ABOVE; D; SEEN
076E; HAH WITH TAH BELOW; D; HAH
076F; HAH WITH TAH AND 2 DOTS BELOW; D; HAH
0770; SEEN WITH 2 DOTS AND TAH ABOVE; D; SEEN
0771; REH WITH 2 DOTS AND TAH ABOVE; R; REH
0772; HAH WITH TAH ABOVE; D; HAH
0773; ALEF WITH DIGIT TWO ABOVE; R; ALEF
0774; ALEF WITH DIGIT THREE ABOVE; R; ALEF
0775; FARSI YEH WITH DIGIT TWO ABOVE; D; FARSI YEH
0776; FARSI YEH WITH DIGIT THREE ABOVE; D; FARSI YEH
0777; DOTLESS YEH WITH DIGIT FOUR BELOW; D; YEH
0778; WAW WITH DIGIT TWO ABOVE; R; WAW
0779; WAW WITH DIGIT THREE ABOVE; R; WAW
077A; BURUSHASKI YEH BARREE WITH DIGIT TWO ABOVE; D; BURUSHASKI YEH BARREE
077B; BURUSHASKI YEH BARREE WITH DIGIT THREE ABOVE; D; BURUSHASKI YEH BARREE
077C; HAH WITH DIGIT FOUR BELOW; D; HAH
077D; SEEN WITH DIGIT FOUR ABOVE; D; SEEN
077E; SEEN WITH INVERTED V ABOVE; D; SEEN
077F; KAF WITH 2 DOTS ABOVE; D; KAF
# N'Ko Characters
07CA; NKO A; D; No_Joining_Group
07CB; NKO EE; D; No_Joining_Group
07CC; NKO I; D; No_Joining_Group
07CD; NKO E; D; No_Joining_Group
07CE; NKO U; D; No_Joining_Group
07CF; NKO OO; D; No_Joining_Group
07D0; NKO O; D; No_Joining_Group
07D1; NKO DAGBASINNA; D; No_Joining_Group
07D2; NKO N; D; No_Joining_Group
07D3; NKO BA; D; No_Joining_Group
07D4; NKO PA; D; No_Joining_Group
07D5; NKO TA; D; No_Joining_Group
07D6; NKO JA; D; No_Joining_Group
07D7; NKO CHA; D; No_Joining_Group
07D8; NKO DA; D; No_Joining_Group
07D9; NKO RA; D; No_Joining_Group
07DA; NKO RRA; D; No_Joining_Group
07DB; NKO SA; D; No_Joining_Group
07DC; NKO GBA; D; No_Joining_Group
07DD; NKO FA; D; No_Joining_Group
07DE; NKO KA; D; No_Joining_Group
07DF; NKO LA; D; No_Joining_Group
07E0; NKO NA WOLOSO; D; No_Joining_Group
07E1; NKO MA; D; No_Joining_Group
07E2; NKO NYA; D; No_Joining_Group
07E3; NKO NA; D; No_Joining_Group
07E4; NKO HA; D; No_Joining_Group
07E5; NKO WA; D; No_Joining_Group
07E6; NKO YA; D; No_Joining_Group
07E7; NKO NYA WOLOSO; D; No_Joining_Group
07E8; NKO JONA JA; D; No_Joining_Group
07E9; NKO JONA CHA; D; No_Joining_Group
07EA; NKO JONA RA; D; No_Joining_Group
07FA; NKO LAJANYALAN; C; No_Joining_Group
# Mandaic Characters
0840; MANDAIC HALQA; R; No_Joining_Group
0841; MANDAIC AB; D; No_Joining_Group
0842; MANDAIC AG; D; No_Joining_Group
0843; MANDAIC AD; D; No_Joining_Group
0844; MANDAIC AH; D; No_Joining_Group
0845; MANDAIC USHENNA; D; No_Joining_Group
0846; MANDAIC AZ; R; No_Joining_Group
0847; MANDAIC IT; D; No_Joining_Group
0848; MANDAIC ATT; D; No_Joining_Group
0849; MANDAIC AKSA; R; No_Joining_Group
084A; MANDAIC AK; D; No_Joining_Group
084B; MANDAIC AL; D; No_Joining_Group
084C; MANDAIC AM; D; No_Joining_Group
084D; MANDAIC AN; D; No_Joining_Group
084E; MANDAIC AS; D; No_Joining_Group
084F; MANDAIC IN; R; No_Joining_Group
0850; MANDAIC AP; D; No_Joining_Group
0851; MANDAIC ASZ; D; No_Joining_Group
0852; MANDAIC AQ; D; No_Joining_Group
0853; MANDAIC AR; D; No_Joining_Group
0854; MANDAIC ASH; R; No_Joining_Group
0855; MANDAIC AT; D; No_Joining_Group
0856; MANDAIC DUSHENNA; U; No_Joining_Group
0857; MANDAIC KAD; U; No_Joining_Group
0858; MANDAIC AIN; U; No_Joining_Group
# Arabic Extended-A Characters
08A0; DOTLESS BEH WITH V BELOW; D; BEH
08A2; HAH WITH DOT BELOW AND 2 DOTS ABOVE; D; HAH
08A3; TAH WITH 2 DOTS ABOVE; D; TAH
08A4; DOTLESS FEH WITH DOT BELOW AND 3 DOTS ABOVE; D; FEH
08A5; QAF WITH DOT BELOW; D; QAF
08A6; LAM WITH DOUBLE BAR; D; LAM
08A7; MEEM WITH 3 DOTS ABOVE; D; MEEM
08A8; YEH WITH HAMZA ABOVE; D; YEH
08A9; YEH WITH DOT ABOVE; D; YEH
08AA; REH WITH LOOP; R; REH
08AB; WAW WITH DOT WITHIN; R; WAW
08AC; ROHINGYA YEH; R; ROHINGYA YEH
# Other
200C; ZERO WIDTH NON-JOINER; U; No_Joining_Group
200D; ZERO WIDTH JOINER; C; No_Joining_Group
# EOF

View file

@ -0,0 +1,604 @@
# BidiMirroring-6.2.0.txt
# Date: 2012-05-15, 24:19:00 GMT [KW, LI]
#
# Bidi_Mirroring_Glyph Property
#
# This file is an informative contributory data file in the
# Unicode Character Database.
#
# Copyright (c) 1991-2012 Unicode, Inc.
# For terms of use, see http://www.unicode.org/terms_of_use.html
#
# This data file lists characters that have the Bidi_Mirrored=Yes property
# value, for which there is another Unicode character that typically has a glyph
# that is the mirror image of the original character's glyph.
#
# The repertoire covered by the file is Unicode 6.2.0.
#
# The file contains a list of lines with mappings from one code point
# to another one for character-based mirroring.
# Note that for "real" mirroring, a rendering engine needs to select
# appropriate alternative glyphs, and that many Unicode characters do not
# have a mirror-image Unicode character.
#
# Each mapping line contains two fields, separated by a semicolon (';').
# Each of the two fields contains a code point represented as a
# variable-length hexadecimal value with 4 to 6 digits.
# A comment indicates where the characters are "BEST FIT" mirroring.
#
# Code points for which Bidi_Mirrored=Yes, but for which no appropriate
# characters exist with mirrored glyphs, are
# listed as comments at the end of the file.
#
# Formally, the default value of the Bidi_Mirroring_Glyph property
# for each code point is <none>, unless a mapping to
# some other character is specified in this data file. When a code
# point has the default value for the Bidi_Mirroring_Glyph property,
# that means that no other character exists whose glyph is suitable
# for character-based mirroring.
#
# For information on bidi mirroring, see UAX #9: Bidirectional Algorithm,
# at http://www.unicode.org/unicode/reports/tr9/
#
# This file was originally created by Markus Scherer.
# Extended for Unicode 3.2, 4.0, 4.1, 5.0, 5.1, 5.2, and 6.0 by Ken Whistler,
# and for Unicode 6.1 and 6.2 by Ken Whistler and Laurentiu Iancu.
#
# ############################################################
#
# Property: Bidi_Mirroring_Glyph
#
# @missing: 0000..10FFFF; <none>
0028; 0029 # LEFT PARENTHESIS
0029; 0028 # RIGHT PARENTHESIS
003C; 003E # LESS-THAN SIGN
003E; 003C # GREATER-THAN SIGN
005B; 005D # LEFT SQUARE BRACKET
005D; 005B # RIGHT SQUARE BRACKET
007B; 007D # LEFT CURLY BRACKET
007D; 007B # RIGHT CURLY BRACKET
00AB; 00BB # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
00BB; 00AB # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
0F3A; 0F3B # TIBETAN MARK GUG RTAGS GYON
0F3B; 0F3A # TIBETAN MARK GUG RTAGS GYAS
0F3C; 0F3D # TIBETAN MARK ANG KHANG GYON
0F3D; 0F3C # TIBETAN MARK ANG KHANG GYAS
169B; 169C # OGHAM FEATHER MARK
169C; 169B # OGHAM REVERSED FEATHER MARK
2039; 203A # SINGLE LEFT-POINTING ANGLE QUOTATION MARK
203A; 2039 # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
2045; 2046 # LEFT SQUARE BRACKET WITH QUILL
2046; 2045 # RIGHT SQUARE BRACKET WITH QUILL
207D; 207E # SUPERSCRIPT LEFT PARENTHESIS
207E; 207D # SUPERSCRIPT RIGHT PARENTHESIS
208D; 208E # SUBSCRIPT LEFT PARENTHESIS
208E; 208D # SUBSCRIPT RIGHT PARENTHESIS
2208; 220B # ELEMENT OF
2209; 220C # NOT AN ELEMENT OF
220A; 220D # SMALL ELEMENT OF
220B; 2208 # CONTAINS AS MEMBER
220C; 2209 # DOES NOT CONTAIN AS MEMBER
220D; 220A # SMALL CONTAINS AS MEMBER
2215; 29F5 # DIVISION SLASH
223C; 223D # TILDE OPERATOR
223D; 223C # REVERSED TILDE
2243; 22CD # ASYMPTOTICALLY EQUAL TO
2252; 2253 # APPROXIMATELY EQUAL TO OR THE IMAGE OF
2253; 2252 # IMAGE OF OR APPROXIMATELY EQUAL TO
2254; 2255 # COLON EQUALS
2255; 2254 # EQUALS COLON
2264; 2265 # LESS-THAN OR EQUAL TO
2265; 2264 # GREATER-THAN OR EQUAL TO
2266; 2267 # LESS-THAN OVER EQUAL TO
2267; 2266 # GREATER-THAN OVER EQUAL TO
2268; 2269 # [BEST FIT] LESS-THAN BUT NOT EQUAL TO
2269; 2268 # [BEST FIT] GREATER-THAN BUT NOT EQUAL TO
226A; 226B # MUCH LESS-THAN
226B; 226A # MUCH GREATER-THAN
226E; 226F # [BEST FIT] NOT LESS-THAN
226F; 226E # [BEST FIT] NOT GREATER-THAN
2270; 2271 # [BEST FIT] NEITHER LESS-THAN NOR EQUAL TO
2271; 2270 # [BEST FIT] NEITHER GREATER-THAN NOR EQUAL TO
2272; 2273 # [BEST FIT] LESS-THAN OR EQUIVALENT TO
2273; 2272 # [BEST FIT] GREATER-THAN OR EQUIVALENT TO
2274; 2275 # [BEST FIT] NEITHER LESS-THAN NOR EQUIVALENT TO
2275; 2274 # [BEST FIT] NEITHER GREATER-THAN NOR EQUIVALENT TO
2276; 2277 # LESS-THAN OR GREATER-THAN
2277; 2276 # GREATER-THAN OR LESS-THAN
2278; 2279 # [BEST FIT] NEITHER LESS-THAN NOR GREATER-THAN
2279; 2278 # [BEST FIT] NEITHER GREATER-THAN NOR LESS-THAN
227A; 227B # PRECEDES
227B; 227A # SUCCEEDS
227C; 227D # PRECEDES OR EQUAL TO
227D; 227C # SUCCEEDS OR EQUAL TO
227E; 227F # [BEST FIT] PRECEDES OR EQUIVALENT TO
227F; 227E # [BEST FIT] SUCCEEDS OR EQUIVALENT TO
2280; 2281 # [BEST FIT] DOES NOT PRECEDE
2281; 2280 # [BEST FIT] DOES NOT SUCCEED
2282; 2283 # SUBSET OF
2283; 2282 # SUPERSET OF
2284; 2285 # [BEST FIT] NOT A SUBSET OF
2285; 2284 # [BEST FIT] NOT A SUPERSET OF
2286; 2287 # SUBSET OF OR EQUAL TO
2287; 2286 # SUPERSET OF OR EQUAL TO
2288; 2289 # [BEST FIT] NEITHER A SUBSET OF NOR EQUAL TO
2289; 2288 # [BEST FIT] NEITHER A SUPERSET OF NOR EQUAL TO
228A; 228B # [BEST FIT] SUBSET OF WITH NOT EQUAL TO
228B; 228A # [BEST FIT] SUPERSET OF WITH NOT EQUAL TO
228F; 2290 # SQUARE IMAGE OF
2290; 228F # SQUARE ORIGINAL OF
2291; 2292 # SQUARE IMAGE OF OR EQUAL TO
2292; 2291 # SQUARE ORIGINAL OF OR EQUAL TO
2298; 29B8 # CIRCLED DIVISION SLASH
22A2; 22A3 # RIGHT TACK
22A3; 22A2 # LEFT TACK
22A6; 2ADE # ASSERTION
22A8; 2AE4 # TRUE
22A9; 2AE3 # FORCES
22AB; 2AE5 # DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE
22B0; 22B1 # PRECEDES UNDER RELATION
22B1; 22B0 # SUCCEEDS UNDER RELATION
22B2; 22B3 # NORMAL SUBGROUP OF
22B3; 22B2 # CONTAINS AS NORMAL SUBGROUP
22B4; 22B5 # NORMAL SUBGROUP OF OR EQUAL TO
22B5; 22B4 # CONTAINS AS NORMAL SUBGROUP OR EQUAL TO
22B6; 22B7 # ORIGINAL OF
22B7; 22B6 # IMAGE OF
22C9; 22CA # LEFT NORMAL FACTOR SEMIDIRECT PRODUCT
22CA; 22C9 # RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT
22CB; 22CC # LEFT SEMIDIRECT PRODUCT
22CC; 22CB # RIGHT SEMIDIRECT PRODUCT
22CD; 2243 # REVERSED TILDE EQUALS
22D0; 22D1 # DOUBLE SUBSET
22D1; 22D0 # DOUBLE SUPERSET
22D6; 22D7 # LESS-THAN WITH DOT
22D7; 22D6 # GREATER-THAN WITH DOT
22D8; 22D9 # VERY MUCH LESS-THAN
22D9; 22D8 # VERY MUCH GREATER-THAN
22DA; 22DB # LESS-THAN EQUAL TO OR GREATER-THAN
22DB; 22DA # GREATER-THAN EQUAL TO OR LESS-THAN
22DC; 22DD # EQUAL TO OR LESS-THAN
22DD; 22DC # EQUAL TO OR GREATER-THAN
22DE; 22DF # EQUAL TO OR PRECEDES
22DF; 22DE # EQUAL TO OR SUCCEEDS
22E0; 22E1 # [BEST FIT] DOES NOT PRECEDE OR EQUAL
22E1; 22E0 # [BEST FIT] DOES NOT SUCCEED OR EQUAL
22E2; 22E3 # [BEST FIT] NOT SQUARE IMAGE OF OR EQUAL TO
22E3; 22E2 # [BEST FIT] NOT SQUARE ORIGINAL OF OR EQUAL TO
22E4; 22E5 # [BEST FIT] SQUARE IMAGE OF OR NOT EQUAL TO
22E5; 22E4 # [BEST FIT] SQUARE ORIGINAL OF OR NOT EQUAL TO
22E6; 22E7 # [BEST FIT] LESS-THAN BUT NOT EQUIVALENT TO
22E7; 22E6 # [BEST FIT] GREATER-THAN BUT NOT EQUIVALENT TO
22E8; 22E9 # [BEST FIT] PRECEDES BUT NOT EQUIVALENT TO
22E9; 22E8 # [BEST FIT] SUCCEEDS BUT NOT EQUIVALENT TO
22EA; 22EB # [BEST FIT] NOT NORMAL SUBGROUP OF
22EB; 22EA # [BEST FIT] DOES NOT CONTAIN AS NORMAL SUBGROUP
22EC; 22ED # [BEST FIT] NOT NORMAL SUBGROUP OF OR EQUAL TO
22ED; 22EC # [BEST FIT] DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL
22F0; 22F1 # UP RIGHT DIAGONAL ELLIPSIS
22F1; 22F0 # DOWN RIGHT DIAGONAL ELLIPSIS
22F2; 22FA # ELEMENT OF WITH LONG HORIZONTAL STROKE
22F3; 22FB # ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
22F4; 22FC # SMALL ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
22F6; 22FD # ELEMENT OF WITH OVERBAR
22F7; 22FE # SMALL ELEMENT OF WITH OVERBAR
22FA; 22F2 # CONTAINS WITH LONG HORIZONTAL STROKE
22FB; 22F3 # CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
22FC; 22F4 # SMALL CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
22FD; 22F6 # CONTAINS WITH OVERBAR
22FE; 22F7 # SMALL CONTAINS WITH OVERBAR
2308; 2309 # LEFT CEILING
2309; 2308 # RIGHT CEILING
230A; 230B # LEFT FLOOR
230B; 230A # RIGHT FLOOR
2329; 232A # LEFT-POINTING ANGLE BRACKET
232A; 2329 # RIGHT-POINTING ANGLE BRACKET
2768; 2769 # MEDIUM LEFT PARENTHESIS ORNAMENT
2769; 2768 # MEDIUM RIGHT PARENTHESIS ORNAMENT
276A; 276B # MEDIUM FLATTENED LEFT PARENTHESIS ORNAMENT
276B; 276A # MEDIUM FLATTENED RIGHT PARENTHESIS ORNAMENT
276C; 276D # MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT
276D; 276C # MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT
276E; 276F # HEAVY LEFT-POINTING ANGLE QUOTATION MARK ORNAMENT
276F; 276E # HEAVY RIGHT-POINTING ANGLE QUOTATION MARK ORNAMENT
2770; 2771 # HEAVY LEFT-POINTING ANGLE BRACKET ORNAMENT
2771; 2770 # HEAVY RIGHT-POINTING ANGLE BRACKET ORNAMENT
2772; 2773 # LIGHT LEFT TORTOISE SHELL BRACKET
2773; 2772 # LIGHT RIGHT TORTOISE SHELL BRACKET
2774; 2775 # MEDIUM LEFT CURLY BRACKET ORNAMENT
2775; 2774 # MEDIUM RIGHT CURLY BRACKET ORNAMENT
27C3; 27C4 # OPEN SUBSET
27C4; 27C3 # OPEN SUPERSET
27C5; 27C6 # LEFT S-SHAPED BAG DELIMITER
27C6; 27C5 # RIGHT S-SHAPED BAG DELIMITER
27C8; 27C9 # REVERSE SOLIDUS PRECEDING SUBSET
27C9; 27C8 # SUPERSET PRECEDING SOLIDUS
27CB; 27CD # MATHEMATICAL RISING DIAGONAL
27CD; 27CB # MATHEMATICAL FALLING DIAGONAL
27D5; 27D6 # LEFT OUTER JOIN
27D6; 27D5 # RIGHT OUTER JOIN
27DD; 27DE # LONG RIGHT TACK
27DE; 27DD # LONG LEFT TACK
27E2; 27E3 # WHITE CONCAVE-SIDED DIAMOND WITH LEFTWARDS TICK
27E3; 27E2 # WHITE CONCAVE-SIDED DIAMOND WITH RIGHTWARDS TICK
27E4; 27E5 # WHITE SQUARE WITH LEFTWARDS TICK
27E5; 27E4 # WHITE SQUARE WITH RIGHTWARDS TICK
27E6; 27E7 # MATHEMATICAL LEFT WHITE SQUARE BRACKET
27E7; 27E6 # MATHEMATICAL RIGHT WHITE SQUARE BRACKET
27E8; 27E9 # MATHEMATICAL LEFT ANGLE BRACKET
27E9; 27E8 # MATHEMATICAL RIGHT ANGLE BRACKET
27EA; 27EB # MATHEMATICAL LEFT DOUBLE ANGLE BRACKET
27EB; 27EA # MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET
27EC; 27ED # MATHEMATICAL LEFT WHITE TORTOISE SHELL BRACKET
27ED; 27EC # MATHEMATICAL RIGHT WHITE TORTOISE SHELL BRACKET
27EE; 27EF # MATHEMATICAL LEFT FLATTENED PARENTHESIS
27EF; 27EE # MATHEMATICAL RIGHT FLATTENED PARENTHESIS
2983; 2984 # LEFT WHITE CURLY BRACKET
2984; 2983 # RIGHT WHITE CURLY BRACKET
2985; 2986 # LEFT WHITE PARENTHESIS
2986; 2985 # RIGHT WHITE PARENTHESIS
2987; 2988 # Z NOTATION LEFT IMAGE BRACKET
2988; 2987 # Z NOTATION RIGHT IMAGE BRACKET
2989; 298A # Z NOTATION LEFT BINDING BRACKET
298A; 2989 # Z NOTATION RIGHT BINDING BRACKET
298B; 298C # LEFT SQUARE BRACKET WITH UNDERBAR
298C; 298B # RIGHT SQUARE BRACKET WITH UNDERBAR
298D; 2990 # LEFT SQUARE BRACKET WITH TICK IN TOP CORNER
298E; 298F # RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER
298F; 298E # LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER
2990; 298D # RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER
2991; 2992 # LEFT ANGLE BRACKET WITH DOT
2992; 2991 # RIGHT ANGLE BRACKET WITH DOT
2993; 2994 # LEFT ARC LESS-THAN BRACKET
2994; 2993 # RIGHT ARC GREATER-THAN BRACKET
2995; 2996 # DOUBLE LEFT ARC GREATER-THAN BRACKET
2996; 2995 # DOUBLE RIGHT ARC LESS-THAN BRACKET
2997; 2998 # LEFT BLACK TORTOISE SHELL BRACKET
2998; 2997 # RIGHT BLACK TORTOISE SHELL BRACKET
29B8; 2298 # CIRCLED REVERSE SOLIDUS
29C0; 29C1 # CIRCLED LESS-THAN
29C1; 29C0 # CIRCLED GREATER-THAN
29C4; 29C5 # SQUARED RISING DIAGONAL SLASH
29C5; 29C4 # SQUARED FALLING DIAGONAL SLASH
29CF; 29D0 # LEFT TRIANGLE BESIDE VERTICAL BAR
29D0; 29CF # VERTICAL BAR BESIDE RIGHT TRIANGLE
29D1; 29D2 # BOWTIE WITH LEFT HALF BLACK
29D2; 29D1 # BOWTIE WITH RIGHT HALF BLACK
29D4; 29D5 # TIMES WITH LEFT HALF BLACK
29D5; 29D4 # TIMES WITH RIGHT HALF BLACK
29D8; 29D9 # LEFT WIGGLY FENCE
29D9; 29D8 # RIGHT WIGGLY FENCE
29DA; 29DB # LEFT DOUBLE WIGGLY FENCE
29DB; 29DA # RIGHT DOUBLE WIGGLY FENCE
29F5; 2215 # REVERSE SOLIDUS OPERATOR
29F8; 29F9 # BIG SOLIDUS
29F9; 29F8 # BIG REVERSE SOLIDUS
29FC; 29FD # LEFT-POINTING CURVED ANGLE BRACKET
29FD; 29FC # RIGHT-POINTING CURVED ANGLE BRACKET
2A2B; 2A2C # MINUS SIGN WITH FALLING DOTS
2A2C; 2A2B # MINUS SIGN WITH RISING DOTS
2A2D; 2A2E # PLUS SIGN IN LEFT HALF CIRCLE
2A2E; 2A2D # PLUS SIGN IN RIGHT HALF CIRCLE
2A34; 2A35 # MULTIPLICATION SIGN IN LEFT HALF CIRCLE
2A35; 2A34 # MULTIPLICATION SIGN IN RIGHT HALF CIRCLE
2A3C; 2A3D # INTERIOR PRODUCT
2A3D; 2A3C # RIGHTHAND INTERIOR PRODUCT
2A64; 2A65 # Z NOTATION DOMAIN ANTIRESTRICTION
2A65; 2A64 # Z NOTATION RANGE ANTIRESTRICTION
2A79; 2A7A # LESS-THAN WITH CIRCLE INSIDE
2A7A; 2A79 # GREATER-THAN WITH CIRCLE INSIDE
2A7D; 2A7E # LESS-THAN OR SLANTED EQUAL TO
2A7E; 2A7D # GREATER-THAN OR SLANTED EQUAL TO
2A7F; 2A80 # LESS-THAN OR SLANTED EQUAL TO WITH DOT INSIDE
2A80; 2A7F # GREATER-THAN OR SLANTED EQUAL TO WITH DOT INSIDE
2A81; 2A82 # LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE
2A82; 2A81 # GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE
2A83; 2A84 # LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE RIGHT
2A84; 2A83 # GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE LEFT
2A8B; 2A8C # LESS-THAN ABOVE DOUBLE-LINE EQUAL ABOVE GREATER-THAN
2A8C; 2A8B # GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN
2A91; 2A92 # LESS-THAN ABOVE GREATER-THAN ABOVE DOUBLE-LINE EQUAL
2A92; 2A91 # GREATER-THAN ABOVE LESS-THAN ABOVE DOUBLE-LINE EQUAL
2A93; 2A94 # LESS-THAN ABOVE SLANTED EQUAL ABOVE GREATER-THAN ABOVE SLANTED EQUAL
2A94; 2A93 # GREATER-THAN ABOVE SLANTED EQUAL ABOVE LESS-THAN ABOVE SLANTED EQUAL
2A95; 2A96 # SLANTED EQUAL TO OR LESS-THAN
2A96; 2A95 # SLANTED EQUAL TO OR GREATER-THAN
2A97; 2A98 # SLANTED EQUAL TO OR LESS-THAN WITH DOT INSIDE
2A98; 2A97 # SLANTED EQUAL TO OR GREATER-THAN WITH DOT INSIDE
2A99; 2A9A # DOUBLE-LINE EQUAL TO OR LESS-THAN
2A9A; 2A99 # DOUBLE-LINE EQUAL TO OR GREATER-THAN
2A9B; 2A9C # DOUBLE-LINE SLANTED EQUAL TO OR LESS-THAN
2A9C; 2A9B # DOUBLE-LINE SLANTED EQUAL TO OR GREATER-THAN
2AA1; 2AA2 # DOUBLE NESTED LESS-THAN
2AA2; 2AA1 # DOUBLE NESTED GREATER-THAN
2AA6; 2AA7 # LESS-THAN CLOSED BY CURVE
2AA7; 2AA6 # GREATER-THAN CLOSED BY CURVE
2AA8; 2AA9 # LESS-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL
2AA9; 2AA8 # GREATER-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL
2AAA; 2AAB # SMALLER THAN
2AAB; 2AAA # LARGER THAN
2AAC; 2AAD # SMALLER THAN OR EQUAL TO
2AAD; 2AAC # LARGER THAN OR EQUAL TO
2AAF; 2AB0 # PRECEDES ABOVE SINGLE-LINE EQUALS SIGN
2AB0; 2AAF # SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN
2AB3; 2AB4 # PRECEDES ABOVE EQUALS SIGN
2AB4; 2AB3 # SUCCEEDS ABOVE EQUALS SIGN
2ABB; 2ABC # DOUBLE PRECEDES
2ABC; 2ABB # DOUBLE SUCCEEDS
2ABD; 2ABE # SUBSET WITH DOT
2ABE; 2ABD # SUPERSET WITH DOT
2ABF; 2AC0 # SUBSET WITH PLUS SIGN BELOW
2AC0; 2ABF # SUPERSET WITH PLUS SIGN BELOW
2AC1; 2AC2 # SUBSET WITH MULTIPLICATION SIGN BELOW
2AC2; 2AC1 # SUPERSET WITH MULTIPLICATION SIGN BELOW
2AC3; 2AC4 # SUBSET OF OR EQUAL TO WITH DOT ABOVE
2AC4; 2AC3 # SUPERSET OF OR EQUAL TO WITH DOT ABOVE
2AC5; 2AC6 # SUBSET OF ABOVE EQUALS SIGN
2AC6; 2AC5 # SUPERSET OF ABOVE EQUALS SIGN
2ACD; 2ACE # SQUARE LEFT OPEN BOX OPERATOR
2ACE; 2ACD # SQUARE RIGHT OPEN BOX OPERATOR
2ACF; 2AD0 # CLOSED SUBSET
2AD0; 2ACF # CLOSED SUPERSET
2AD1; 2AD2 # CLOSED SUBSET OR EQUAL TO
2AD2; 2AD1 # CLOSED SUPERSET OR EQUAL TO
2AD3; 2AD4 # SUBSET ABOVE SUPERSET
2AD4; 2AD3 # SUPERSET ABOVE SUBSET
2AD5; 2AD6 # SUBSET ABOVE SUBSET
2AD6; 2AD5 # SUPERSET ABOVE SUPERSET
2ADE; 22A6 # SHORT LEFT TACK
2AE3; 22A9 # DOUBLE VERTICAL BAR LEFT TURNSTILE
2AE4; 22A8 # VERTICAL BAR DOUBLE LEFT TURNSTILE
2AE5; 22AB # DOUBLE VERTICAL BAR DOUBLE LEFT TURNSTILE
2AEC; 2AED # DOUBLE STROKE NOT SIGN
2AED; 2AEC # REVERSED DOUBLE STROKE NOT SIGN
2AF7; 2AF8 # TRIPLE NESTED LESS-THAN
2AF8; 2AF7 # TRIPLE NESTED GREATER-THAN
2AF9; 2AFA # DOUBLE-LINE SLANTED LESS-THAN OR EQUAL TO
2AFA; 2AF9 # DOUBLE-LINE SLANTED GREATER-THAN OR EQUAL TO
2E02; 2E03 # LEFT SUBSTITUTION BRACKET
2E03; 2E02 # RIGHT SUBSTITUTION BRACKET
2E04; 2E05 # LEFT DOTTED SUBSTITUTION BRACKET
2E05; 2E04 # RIGHT DOTTED SUBSTITUTION BRACKET
2E09; 2E0A # LEFT TRANSPOSITION BRACKET
2E0A; 2E09 # RIGHT TRANSPOSITION BRACKET
2E0C; 2E0D # LEFT RAISED OMISSION BRACKET
2E0D; 2E0C # RIGHT RAISED OMISSION BRACKET
2E1C; 2E1D # LEFT LOW PARAPHRASE BRACKET
2E1D; 2E1C # RIGHT LOW PARAPHRASE BRACKET
2E20; 2E21 # LEFT VERTICAL BAR WITH QUILL
2E21; 2E20 # RIGHT VERTICAL BAR WITH QUILL
2E22; 2E23 # TOP LEFT HALF BRACKET
2E23; 2E22 # TOP RIGHT HALF BRACKET
2E24; 2E25 # BOTTOM LEFT HALF BRACKET
2E25; 2E24 # BOTTOM RIGHT HALF BRACKET
2E26; 2E27 # LEFT SIDEWAYS U BRACKET
2E27; 2E26 # RIGHT SIDEWAYS U BRACKET
2E28; 2E29 # LEFT DOUBLE PARENTHESIS
2E29; 2E28 # RIGHT DOUBLE PARENTHESIS
3008; 3009 # LEFT ANGLE BRACKET
3009; 3008 # RIGHT ANGLE BRACKET
300A; 300B # LEFT DOUBLE ANGLE BRACKET
300B; 300A # RIGHT DOUBLE ANGLE BRACKET
300C; 300D # [BEST FIT] LEFT CORNER BRACKET
300D; 300C # [BEST FIT] RIGHT CORNER BRACKET
300E; 300F # [BEST FIT] LEFT WHITE CORNER BRACKET
300F; 300E # [BEST FIT] RIGHT WHITE CORNER BRACKET
3010; 3011 # LEFT BLACK LENTICULAR BRACKET
3011; 3010 # RIGHT BLACK LENTICULAR BRACKET
3014; 3015 # LEFT TORTOISE SHELL BRACKET
3015; 3014 # RIGHT TORTOISE SHELL BRACKET
3016; 3017 # LEFT WHITE LENTICULAR BRACKET
3017; 3016 # RIGHT WHITE LENTICULAR BRACKET
3018; 3019 # LEFT WHITE TORTOISE SHELL BRACKET
3019; 3018 # RIGHT WHITE TORTOISE SHELL BRACKET
301A; 301B # LEFT WHITE SQUARE BRACKET
301B; 301A # RIGHT WHITE SQUARE BRACKET
FE59; FE5A # SMALL LEFT PARENTHESIS
FE5A; FE59 # SMALL RIGHT PARENTHESIS
FE5B; FE5C # SMALL LEFT CURLY BRACKET
FE5C; FE5B # SMALL RIGHT CURLY BRACKET
FE5D; FE5E # SMALL LEFT TORTOISE SHELL BRACKET
FE5E; FE5D # SMALL RIGHT TORTOISE SHELL BRACKET
FE64; FE65 # SMALL LESS-THAN SIGN
FE65; FE64 # SMALL GREATER-THAN SIGN
FF08; FF09 # FULLWIDTH LEFT PARENTHESIS
FF09; FF08 # FULLWIDTH RIGHT PARENTHESIS
FF1C; FF1E # FULLWIDTH LESS-THAN SIGN
FF1E; FF1C # FULLWIDTH GREATER-THAN SIGN
FF3B; FF3D # FULLWIDTH LEFT SQUARE BRACKET
FF3D; FF3B # FULLWIDTH RIGHT SQUARE BRACKET
FF5B; FF5D # FULLWIDTH LEFT CURLY BRACKET
FF5D; FF5B # FULLWIDTH RIGHT CURLY BRACKET
FF5F; FF60 # FULLWIDTH LEFT WHITE PARENTHESIS
FF60; FF5F # FULLWIDTH RIGHT WHITE PARENTHESIS
FF62; FF63 # [BEST FIT] HALFWIDTH LEFT CORNER BRACKET
FF63; FF62 # [BEST FIT] HALFWIDTH RIGHT CORNER BRACKET
# The following characters have no appropriate mirroring character.
# For these characters it is up to the rendering system
# to provide mirrored glyphs.
# 2140; DOUBLE-STRUCK N-ARY SUMMATION
# 2201; COMPLEMENT
# 2202; PARTIAL DIFFERENTIAL
# 2203; THERE EXISTS
# 2204; THERE DOES NOT EXIST
# 2211; N-ARY SUMMATION
# 2216; SET MINUS
# 221A; SQUARE ROOT
# 221B; CUBE ROOT
# 221C; FOURTH ROOT
# 221D; PROPORTIONAL TO
# 221F; RIGHT ANGLE
# 2220; ANGLE
# 2221; MEASURED ANGLE
# 2222; SPHERICAL ANGLE
# 2224; DOES NOT DIVIDE
# 2226; NOT PARALLEL TO
# 222B; INTEGRAL
# 222C; DOUBLE INTEGRAL
# 222D; TRIPLE INTEGRAL
# 222E; CONTOUR INTEGRAL
# 222F; SURFACE INTEGRAL
# 2230; VOLUME INTEGRAL
# 2231; CLOCKWISE INTEGRAL
# 2232; CLOCKWISE CONTOUR INTEGRAL
# 2233; ANTICLOCKWISE CONTOUR INTEGRAL
# 2239; EXCESS
# 223B; HOMOTHETIC
# 223E; INVERTED LAZY S
# 223F; SINE WAVE
# 2240; WREATH PRODUCT
# 2241; NOT TILDE
# 2242; MINUS TILDE
# 2244; NOT ASYMPTOTICALLY EQUAL TO
# 2245; APPROXIMATELY EQUAL TO
# 2246; APPROXIMATELY BUT NOT ACTUALLY EQUAL TO
# 2247; NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO
# 2248; ALMOST EQUAL TO
# 2249; NOT ALMOST EQUAL TO
# 224A; ALMOST EQUAL OR EQUAL TO
# 224B; TRIPLE TILDE
# 224C; ALL EQUAL TO
# 225F; QUESTIONED EQUAL TO
# 2260; NOT EQUAL TO
# 2262; NOT IDENTICAL TO
# 228C; MULTISET
# 22A7; MODELS
# 22AA; TRIPLE VERTICAL BAR RIGHT TURNSTILE
# 22AC; DOES NOT PROVE
# 22AD; NOT TRUE
# 22AE; DOES NOT FORCE
# 22AF; NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE
# 22B8; MULTIMAP
# 22BE; RIGHT ANGLE WITH ARC
# 22BF; RIGHT TRIANGLE
# 22F5; ELEMENT OF WITH DOT ABOVE
# 22F8; ELEMENT OF WITH UNDERBAR
# 22F9; ELEMENT OF WITH TWO HORIZONTAL STROKES
# 22FF; Z NOTATION BAG MEMBERSHIP
# 2320; TOP HALF INTEGRAL
# 2321; BOTTOM HALF INTEGRAL
# 27C0; THREE DIMENSIONAL ANGLE
# 27CC; LONG DIVISION
# 27D3; LOWER RIGHT CORNER WITH DOT
# 27D4; UPPER LEFT CORNER WITH DOT
# 27DC; LEFT MULTIMAP
# 299B; MEASURED ANGLE OPENING LEFT
# 299C; RIGHT ANGLE VARIANT WITH SQUARE
# 299D; MEASURED RIGHT ANGLE WITH DOT
# 299E; ANGLE WITH S INSIDE
# 299F; ACUTE ANGLE
# 29A0; SPHERICAL ANGLE OPENING LEFT
# 29A1; SPHERICAL ANGLE OPENING UP
# 29A2; TURNED ANGLE
# 29A3; REVERSED ANGLE
# 29A4; ANGLE WITH UNDERBAR
# 29A5; REVERSED ANGLE WITH UNDERBAR
# 29A6; OBLIQUE ANGLE OPENING UP
# 29A7; OBLIQUE ANGLE OPENING DOWN
# 29A8; MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND RIGHT
# 29A9; MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND LEFT
# 29AA; MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND RIGHT
# 29AB; MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND LEFT
# 29AC; MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND UP
# 29AD; MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND UP
# 29AE; MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND DOWN
# 29AF; MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND DOWN
# 29C2; CIRCLE WITH SMALL CIRCLE TO THE RIGHT
# 29C3; CIRCLE WITH TWO HORIZONTAL STROKES TO THE RIGHT
# 29C9; TWO JOINED SQUARES
# 29CE; RIGHT TRIANGLE ABOVE LEFT TRIANGLE
# 29DC; INCOMPLETE INFINITY
# 29E1; INCREASES AS
# 29E3; EQUALS SIGN AND SLANTED PARALLEL
# 29E4; EQUALS SIGN AND SLANTED PARALLEL WITH TILDE ABOVE
# 29E5; IDENTICAL TO AND SLANTED PARALLEL
# 29E8; DOWN-POINTING TRIANGLE WITH LEFT HALF BLACK
# 29E9; DOWN-POINTING TRIANGLE WITH RIGHT HALF BLACK
# 29F4; RULE-DELAYED
# 29F6; SOLIDUS WITH OVERBAR
# 29F7; REVERSE SOLIDUS WITH HORIZONTAL STROKE
# 2A0A; MODULO TWO SUM
# 2A0B; SUMMATION WITH INTEGRAL
# 2A0C; QUADRUPLE INTEGRAL OPERATOR
# 2A0D; FINITE PART INTEGRAL
# 2A0E; INTEGRAL WITH DOUBLE STROKE
# 2A0F; INTEGRAL AVERAGE WITH SLASH
# 2A10; CIRCULATION FUNCTION
# 2A11; ANTICLOCKWISE INTEGRATION
# 2A12; LINE INTEGRATION WITH RECTANGULAR PATH AROUND POLE
# 2A13; LINE INTEGRATION WITH SEMICIRCULAR PATH AROUND POLE
# 2A14; LINE INTEGRATION NOT INCLUDING THE POLE
# 2A15; INTEGRAL AROUND A POINT OPERATOR
# 2A16; QUATERNION INTEGRAL OPERATOR
# 2A17; INTEGRAL WITH LEFTWARDS ARROW WITH HOOK
# 2A18; INTEGRAL WITH TIMES SIGN
# 2A19; INTEGRAL WITH INTERSECTION
# 2A1A; INTEGRAL WITH UNION
# 2A1B; INTEGRAL WITH OVERBAR
# 2A1C; INTEGRAL WITH UNDERBAR
# 2A1E; LARGE LEFT TRIANGLE OPERATOR
# 2A1F; Z NOTATION SCHEMA COMPOSITION
# 2A20; Z NOTATION SCHEMA PIPING
# 2A21; Z NOTATION SCHEMA PROJECTION
# 2A24; PLUS SIGN WITH TILDE ABOVE
# 2A26; PLUS SIGN WITH TILDE BELOW
# 2A29; MINUS SIGN WITH COMMA ABOVE
# 2A3E; Z NOTATION RELATIONAL COMPOSITION
# 2A57; SLOPING LARGE OR
# 2A58; SLOPING LARGE AND
# 2A6A; TILDE OPERATOR WITH DOT ABOVE
# 2A6B; TILDE OPERATOR WITH RISING DOTS
# 2A6C; SIMILAR MINUS SIMILAR
# 2A6D; CONGRUENT WITH DOT ABOVE
# 2A6F; ALMOST EQUAL TO WITH CIRCUMFLEX ACCENT
# 2A70; APPROXIMATELY EQUAL OR EQUAL TO
# 2A73; EQUALS SIGN ABOVE TILDE OPERATOR
# 2A74; DOUBLE COLON EQUAL
# 2A7B; LESS-THAN WITH QUESTION MARK ABOVE
# 2A7C; GREATER-THAN WITH QUESTION MARK ABOVE
# 2A85; LESS-THAN OR APPROXIMATE
# 2A86; GREATER-THAN OR APPROXIMATE
# 2A87; LESS-THAN AND SINGLE-LINE NOT EQUAL TO
# 2A88; GREATER-THAN AND SINGLE-LINE NOT EQUAL TO
# 2A89; LESS-THAN AND NOT APPROXIMATE
# 2A8A; GREATER-THAN AND NOT APPROXIMATE
# 2A8D; LESS-THAN ABOVE SIMILAR OR EQUAL
# 2A8E; GREATER-THAN ABOVE SIMILAR OR EQUAL
# 2A8F; LESS-THAN ABOVE SIMILAR ABOVE GREATER-THAN
# 2A90; GREATER-THAN ABOVE SIMILAR ABOVE LESS-THAN
# 2A9D; SIMILAR OR LESS-THAN
# 2A9E; SIMILAR OR GREATER-THAN
# 2A9F; SIMILAR ABOVE LESS-THAN ABOVE EQUALS SIGN
# 2AA0; SIMILAR ABOVE GREATER-THAN ABOVE EQUALS SIGN
# 2AA3; DOUBLE NESTED LESS-THAN WITH UNDERBAR
# 2AB1; PRECEDES ABOVE SINGLE-LINE NOT EQUAL TO
# 2AB2; SUCCEEDS ABOVE SINGLE-LINE NOT EQUAL TO
# 2AB5; PRECEDES ABOVE NOT EQUAL TO
# 2AB6; SUCCEEDS ABOVE NOT EQUAL TO
# 2AB7; PRECEDES ABOVE ALMOST EQUAL TO
# 2AB8; SUCCEEDS ABOVE ALMOST EQUAL TO
# 2AB9; PRECEDES ABOVE NOT ALMOST EQUAL TO
# 2ABA; SUCCEEDS ABOVE NOT ALMOST EQUAL TO
# 2AC7; SUBSET OF ABOVE TILDE OPERATOR
# 2AC8; SUPERSET OF ABOVE TILDE OPERATOR
# 2AC9; SUBSET OF ABOVE ALMOST EQUAL TO
# 2ACA; SUPERSET OF ABOVE ALMOST EQUAL TO
# 2ACB; SUBSET OF ABOVE NOT EQUAL TO
# 2ACC; SUPERSET OF ABOVE NOT EQUAL TO
# 2ADC; FORKING
# 2AE2; VERTICAL BAR TRIPLE RIGHT TURNSTILE
# 2AE6; LONG DASH FROM LEFT MEMBER OF DOUBLE VERTICAL
# 2AEE; DOES NOT DIVIDE WITH REVERSED NEGATION SLASH
# 2AF3; PARALLEL WITH TILDE OPERATOR
# 2AFB; TRIPLE SOLIDUS BINARY RELATION
# 2AFD; DOUBLE SOLIDUS OPERATOR
# 1D6DB; MATHEMATICAL BOLD PARTIAL DIFFERENTIAL
# 1D715; MATHEMATICAL ITALIC PARTIAL DIFFERENTIAL
# 1D74F; MATHEMATICAL BOLD ITALIC PARTIAL DIFFERENTIAL
# 1D789; MATHEMATICAL SANS-SERIF BOLD PARTIAL DIFFERENTIAL
# 1D7C3; MATHEMATICAL SANS-SERIF BOLD ITALIC PARTIAL DIFFERENTIAL
# EOF

View file

@ -0,0 +1,15 @@
# Date: 2012-09-24, 22:40:00 GMT [KW]
#
# Unicode Character Database
# Copyright (c) 1991-2012 Unicode, Inc.
# For terms of use, see http://www.unicode.org/terms_of_use.html
#
# For documentation, see NamesList.html,
# UAX #38, "Unicode Han Database (Unihan)," and
# UAX #44, "Unicode Character Database."
#
This directory contains final data files
for the Unicode Character Database (UCD) for Unicode 6.2.0.

File diff suppressed because it is too large Load diff

224
git.mk Normal file
View file

@ -0,0 +1,224 @@
# git.mk
#
# Copyright 2009, Red Hat, Inc.
# Copyright 2010,2011 Behdad Esfahbod
# Written by Behdad Esfahbod
#
# Copying and distribution of this file, with or without modification,
# is permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
#
# The canonical source for this file is https://github.com/behdad/git.mk.
#
# To use in your project, import this file in your git repo's toplevel,
# then do "make -f git.mk". This modifies all Makefile.am files in
# your project to -include git.mk. Remember to add that line to new
# Makefile.am files you create in your project, or just rerun the
# "make -f git.mk".
#
# This enables automatic .gitignore generation. If you need to ignore
# more files, add them to the GITIGNOREFILES variable in your Makefile.am.
# But think twice before doing that. If a file has to be in .gitignore,
# chances are very high that it's a generated file and should be in one
# of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES.
#
# The only case that you need to manually add a file to GITIGNOREFILES is
# when remove files in one of mostlyclean-local, clean-local, distclean-local,
# or maintainer-clean-local make targets.
#
# Note that for files like editor backup, etc, there are better places to
# ignore them. See "man gitignore".
#
# If "make maintainer-clean" removes the files but they are not recognized
# by this script (that is, if "git status" shows untracked files still), send
# me the output of "git status" as well as your Makefile.am and Makefile for
# the directories involved and I'll diagnose.
#
# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see
# Makefile.am.sample in the git.mk git repo.
#
# Don't EXTRA_DIST this file. It is supposed to only live in git clones,
# not tarballs. It serves no useful purpose in tarballs and clutters the
# build dir.
#
# This file knows how to handle autoconf, automake, libtool, gtk-doc,
# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu.
#
# This makefile provides the following targets:
#
# - all: "make all" will build all gitignore files.
# - gitignore: makes all gitignore files in the current dir and subdirs.
# - .gitignore: make gitignore file for the current dir.
# - gitignore-recurse: makes all gitignore files in the subdirs.
#
# KNOWN ISSUES:
#
# - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the
# submodule doesn't find us. If you have configure.{in,ac} files in
# subdirs, add a proxy git.mk file in those dirs that simply does:
# "include $(top_srcdir)/../git.mk". Add more ..'s to your taste.
# And add those files to git. See vte/gnome-pty-helper/git.mk for
# example.
#
git-all: git-mk-install
git-mk-install:
@echo Installing git makefile
@any_failed=; \
find "`test -z "$(top_srcdir)" && echo . || echo "$(top_srcdir)"`" -name Makefile.am | while read x; do \
if grep 'include .*/git.mk' $$x >/dev/null; then \
echo $$x already includes git.mk; \
else \
failed=; \
echo "Updating $$x"; \
{ cat $$x; \
echo ''; \
echo '-include $$(top_srcdir)/git.mk'; \
} > $$x.tmp || failed=1; \
if test x$$failed = x; then \
mv $$x.tmp $$x || failed=1; \
fi; \
if test x$$failed = x; then : else \
echo Failed updating $$x; >&2 \
any_failed=1; \
fi; \
fi; done; test -z "$$any_failed"
.PHONY: git-all git-mk-install
### .gitignore generation
$(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
$(AM_V_GEN) \
{ \
if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \
for x in \
$(DOC_MODULE)-decl-list.txt \
$(DOC_MODULE)-decl.txt \
tmpl/$(DOC_MODULE)-unused.sgml \
"tmpl/*.bak" \
xml html \
; do echo /$$x; done; \
fi; \
if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \
for lc in $(DOC_LINGUAS); do \
for x in \
$(if $(DOC_MODULE),$(DOC_MODULE).xml) \
$(DOC_PAGES) \
$(DOC_INCLUDES) \
; do echo /$$lc/$$x; done; \
done; \
for x in \
$(_DOC_OMF_ALL) \
$(_DOC_DSK_ALL) \
$(_DOC_HTML_ALL) \
$(_DOC_MOFILES) \
$(DOC_H_FILE) \
"*/.xml2po.mo" \
"*/*.omf.out" \
; do echo /$$x; done; \
fi; \
if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \
for lc in $(HELP_LINGUAS); do \
for x in \
$(HELP_FILES) \
"$$lc.stamp" \
"$$lc.mo" \
; do echo /$$lc/$$x; done; \
done; \
fi; \
if test "x$(gsettings_SCHEMAS)" = x; then :; else \
for x in \
$(gsettings_SCHEMAS:.xml=.valid) \
$(gsettings__enum_file) \
; do echo /$$x; done; \
fi; \
if test -f $(srcdir)/po/Makefile.in.in; then \
for x in \
po/Makefile.in.in \
po/Makefile.in \
po/Makefile \
po/POTFILES \
po/stamp-it \
po/.intltool-merge-cache \
"po/*.gmo" \
"po/*.mo" \
po/$(GETTEXT_PACKAGE).pot \
intltool-extract.in \
intltool-merge.in \
intltool-update.in \
; do echo /$$x; done; \
fi; \
if test -f $(srcdir)/configure; then \
for x in \
autom4te.cache \
configure \
config.h \
stamp-h1 \
libtool \
config.lt \
; do echo /$$x; done; \
fi; \
if test "x$(DEJATOOL)" = x; then :; else \
for x in \
$(DEJATOOL) \
; do echo /$$x.sum; echo /$$x.log; done; \
echo /site.exp; \
fi; \
for x in \
.gitignore \
$(GITIGNOREFILES) \
$(CLEANFILES) \
$(PROGRAMS) $(check_PROGRAMS) $(EXTRA_PROGRAMS) \
$(LIBRARIES) $(check_LIBRARIES) $(EXTRA_LIBRARIES) \
$(LTLIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LTLIBRARIES) \
so_locations \
.libs _libs \
$(MOSTLYCLEANFILES) \
"*.$(OBJEXT)" \
"*.lo" \
$(DISTCLEANFILES) \
$(am__CONFIG_DISTCLEAN_FILES) \
$(CONFIG_CLEAN_FILES) \
TAGS ID GTAGS GRTAGS GSYMS GPATH tags \
"*.tab.c" \
$(MAINTAINERCLEANFILES) \
$(BUILT_SOURCES) \
$(DEPDIR) \
Makefile \
Makefile.in \
"*.orig" \
"*.rej" \
"*.bak" \
"*~" \
".*.sw[nop]" \
".dirstamp" \
; do echo /$$x; done; \
} | \
sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \
sed 's@/[.]/@/@g' | \
LC_ALL=C sort | uniq > $@.tmp && \
mv $@.tmp $@;
all: $(srcdir)/.gitignore gitignore-recurse-maybe
gitignore: $(srcdir)/.gitignore gitignore-recurse
gitignore-recurse-maybe:
@for subdir in $(DIST_SUBDIRS); do \
case " $(SUBDIRS) " in \
*" $$subdir "*) :;; \
*) test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse-maybe || echo "Skipping $$subdir");; \
esac; \
done
gitignore-recurse:
@for subdir in $(DIST_SUBDIRS); do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir"); \
done
maintainer-clean: gitignore-clean
gitignore-clean:
-rm -f $(srcdir)/.gitignore
.PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe

3
lib/.cvsignore Normal file
View file

@ -0,0 +1,3 @@
*.i
fribidi-unicode-version.h
fribidi-config.h

22
lib/Headers.mk Normal file
View file

@ -0,0 +1,22 @@
libfribidi_la_headers = \
fribidi-arabic.h \
fribidi-begindecls.h \
fribidi-bidi.h \
fribidi-bidi-types.h \
fribidi-bidi-types-list.h \
fribidi-common.h \
fribidi-deprecated.h \
fribidi-enddecls.h \
fribidi-flags.h \
fribidi-joining.h \
fribidi-joining-types.h \
fribidi-joining-types-list.h \
fribidi-mirroring.h \
fribidi-shape.h \
fribidi-types.h \
fribidi-unicode.h \
fribidi-unicode-version.h \
fribidi.h
# fribidi.h should be the last entry in the list above.
libfribidi_la_symbols = $(shell cat $(top_srcdir)/lib/fribidi.def)

86
lib/Makefile.am Normal file
View file

@ -0,0 +1,86 @@
EXTRA_DIST = fribidi.def
lib_LTLIBRARIES = libfribidi.la
AM_CPPFLAGS = $(MISC_CFLAGS)
libfribidi_la_LDFLAGS = -no-undefined -version-info $(LT_VERSION_INFO)
libfribidi_la_LIBADD = $(MISC_LIBS)
libfribidi_la_DEPENDENCIES =
if OS_WIN32
libfribidi_la_LDFLAGS += -export-symbols $(srcdir)/fribidi.def
else
libfribidi_la_LDFLAGS += -export-symbols-regex "^fribidi_.*"
endif # OS_WIN32
if FRIBIDI_CHARSETS
AM_CPPFLAGS += -I$(top_srcdir)/charset
libfribidi_la_LIBADD += $(top_builddir)/charset/libfribidi-char-sets.la
libfribidi_la_DEPENDENCIES += $(top_builddir)/charset/libfribidi-char-sets.la
$(top_builddir)/charset/libfribidi-char-sets.la:
cd $(top_builddir)/lib && $(MAKE) $(AM_MAKEFLAGS) libfribidi-char-sets.la
endif # FRIBIDI_CHARSETS
include Headers.mk
pkginclude_HEADERS = $(libfribidi_la_headers)
nodist_pkginclude_HEADERS = fribidi-config.h
libfribidi_la_SOURCES = \
arabic-misc.tab.i \
arabic-shaping.tab.i \
bidi-type.tab.i \
bidi-types.h \
common.h \
debug.h \
fribidi.c \
fribidi-arabic.c \
fribidi-bidi.c \
fribidi-bidi-types.c \
fribidi-deprecated.c \
fribidi-joining.c \
fribidi-joining-types.c \
fribidi-mem.c \
fribidi-mirroring.c \
fribidi-run.c \
fribidi-shape.c \
joining-type.tab.i \
joining-types.h \
mem.h \
mirroring.tab.i \
run.h
GENERATEDSOURCES = \
fribidi-unicode-version.h \
arabic-shaping.tab.i \
bidi-type.tab.i \
joining-type.tab.i \
mirroring.tab.i
BUILT_SOURCES = \
$(GENERATEDSOURCES) \
fribidi-config.h
$(GENERATEDSOURCES):
@(cd $(top_builddir)/gen.tab && \
$(MAKE) $(AM_MAKEFLAGS) $@) && \
(test -f $@ || mv $(top_builddir)/gen.tab/$@ .)
# re-generate all built sources:
gen:
@(cd $(top_builddir)/gen.tab && \
$(MAKE) $(AM_MAKEFLAGS) $@) && \
$(RM) $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) $(BUILT_SOURCES)
MAINTAINERCLEANFILES = $(BUILT_SOURCES)
$(top_builddir)/config.h: $(top_srcdir)/config.h.in
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) config.h
.PHONY: gen
-include $(top_srcdir)/git.mk

94
lib/arabic-misc.tab.i Normal file
View file

@ -0,0 +1,94 @@
/* The tables in this file should all be sorted on their first item. */
/* *INDENT-OFF* */
const PairMap mandatory_liga_table[] = {
{{0xFEDF, 0xFE82}, 0xFEF5},
{{0xFEDF, 0xFE84}, 0xFEF7},
{{0xFEDF, 0xFE88}, 0xFEF9},
{{0xFEDF, 0xFE8E}, 0xFEFB},
{{0xFEE0, 0xFE82}, 0xFEF6},
{{0xFEE0, 0xFE84}, 0xFEF8},
{{0xFEE0, 0xFE88}, 0xFEFA},
{{0xFEE0, 0xFE8E}, 0xFEFC},
};
const PairMap console_liga_table[] = {
{{0x0640, 0xFC60}, 0xFCF2},
{{0x0640, 0xFC61}, 0xFCF3},
{{0x0640, 0xFC62}, 0xFCF4},
{{0x0640, 0xFE70}, 0xFE71},
{{0x0640, 0xFE76}, 0xFE77},
{{0x0640, 0xFE78}, 0xFE79},
{{0x0640, 0xFE7A}, 0xFE7B},
{{0x0640, 0xFE7C}, 0xFE7D},
{{0x0640, 0xFE7E}, 0xFE7F},
{{0xFBE8, 0x0654}, 0xFE8B},
{{0xFBE9, 0x0654}, 0xFE8C},
{{0xFBFC, 0x0654}, 0xFE89},
{{0xFBFC, 0x0670}, 0xFC5D},
{{0xFBFD, 0x0654}, 0xFE8A},
{{0xFBFD, 0x0670}, 0xFC90},
{{0xFE7C, 0x0670}, 0xFC63},
{{0xFE7C, 0xFE72}, 0xFC5E},
{{0xFE7C, 0xFE74}, 0xFC5F},
{{0xFE7C, 0xFE76}, 0xFC60},
{{0xFE7C, 0xFE78}, 0xFC61},
{{0xFE7C, 0xFE7A}, 0xFC62},
{{0xFE7D, 0xFE76}, 0xFCF2},
{{0xFE7D, 0xFE77}, 0xFCF2},
{{0xFE7D, 0xFE78}, 0xFCF3},
{{0xFE7D, 0xFE79}, 0xFCF3},
{{0xFE7D, 0xFE7A}, 0xFCF4},
{{0xFE7D, 0xFE7B}, 0xFCF4},
{{0xFE8D, 0x0653}, 0xFE81},
{{0xFE8D, 0x0654}, 0xFE83},
{{0xFE8D, 0x0655}, 0xFE87},
{{0xFE8D, 0xFE70}, 0xFD3D},
{{0xFE8E, 0x0653}, 0xFE82},
{{0xFE8E, 0x0654}, 0xFE84},
{{0xFE8E, 0x0655}, 0xFE88},
{{0xFE8E, 0xFE70}, 0xFD3C},
{{0xFEE9, 0x0654}, 0xFBA4},
{{0xFEEA, 0x0654}, 0xFBA5},
{{0xFEED, 0x0654}, 0xFE85},
{{0xFEEE, 0x0654}, 0xFE86},
{{0xFEEF, 0x0654}, 0xFE89},
{{0xFEEF, 0x0670}, 0xFC5D},
{{0xFEF0, 0x0654}, 0xFE8A},
{{0xFEF0, 0x0670}, 0xFC90},
{{0xFEF1, 0x0654}, 0xFE89},
{{0xFEF1, 0x0670}, 0xFC5D},
{{0xFEF2, 0x0654}, 0xFE8A},
{{0xFEF2, 0x0670}, 0xFC90},
{{0xFEF3, 0x0654}, 0xFE8B},
{{0xFEF4, 0x0654}, 0xFE8C},
{{0xFEFB, 0x0653}, 0xFEF5},
{{0xFEFB, 0x0654}, 0xFEF7},
{{0xFEFB, 0x0655}, 0xFEF9},
{{0xFEFC, 0x0653}, 0xFEF6},
{{0xFEFC, 0x0654}, 0xFEF8},
{{0xFEFC, 0x0655}, 0xFEFA},
};
static const FriBidiChar NSMShap[][4] = {
{0xFE70, 0xFE71, 0xFE70, 0xFE71,},
{0xFE72, 0xFE72, 0xFE72, 0xFE72,},
{0xFE74, 0xFE74, 0xFE74, 0xFE74,},
{0xFE76, 0xFE77, 0xFE76, 0xFE77,},
{0xFE78, 0xFE79, 0xFE78, 0xFE79,},
{0xFE7A, 0xFE7B, 0xFE7A, 0xFE7B,},
{0xFE7C, 0xFE7D, 0xFE7C, 0xFE7D,},
{0xFE7E, 0xFE7F, 0xFE7E, 0xFE7F,},
};
/* *INDENT-ON* */
#ifndef FRIBIDI_ACCESS_SHAPE_TABLE
# define FRIBIDI_ACCESS_SHAPE_TABLE(table,min,max,x,shape) \
(((x)<(min)||(x)>(max))?(x):(table)[(x)-(min)][(shape)])
#endif
#define FRIBIDI_GET_ARABIC_SHAPE_NSM(x,shape) FRIBIDI_ACCESS_SHAPE_TABLE(NSMShap, 0x064B, 0x0652, (x), (shape))

61
lib/bidi-types.h Normal file
View file

@ -0,0 +1,61 @@
/* FriBidi
* bidi-types.h - define internal bidi types
*
* $Id: bidi-types.h,v 1.7 2006-01-31 03:23:12 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:12 $
* $Revision: 1.7 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/bidi-types.h,v $
*
* Author:
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc.
* Copyright (C) 2001,2002 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _BIDI_TYPES_H
#define _BIDI_TYPES_H
#include "common.h"
#include <fribidi-types.h>
#include <fribidi-bidi-types.h>
#include <fribidi-begindecls.h>
#define FRIBIDI_LEVEL_INVALID FRIBIDI_BIDI_MAX_RESOLVED_LEVELS
#define FRIBIDI_SENTINEL -1
#if DEBUG+0
#define fribidi_char_from_bidi_type FRIBIDI_PRIVATESPACE(char_from_bidi_type)
char
fribidi_char_from_bidi_type (
FriBidiCharType t /* input bidi type */
) FRIBIDI_GNUC_HIDDEN;
#endif /* DEBUG */
#include <fribidi-enddecls.h>
#endif /* !_BIDI_TYPES_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

186
lib/common.h Normal file
View file

@ -0,0 +1,186 @@
/* FriBidi
* common.h - common include for library sources
*
* $Id: common.h,v 1.21 2010-02-24 19:40:04 behdad Exp $
* $Author: behdad $
* $Date: 2010-02-24 19:40:04 $
* $Revision: 1.21 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/common.h,v $
*
* Author:
* Behdad Esfahbod, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _COMMON_H
#define _COMMON_H
#if HAVE_CONFIG_H+0
# include <config.h>
#endif
#include <fribidi-common.h>
/* FRIBIDI_PRIVATESPACE is a macro used to name library internal symbols. */
#ifndef FRIBIDI_PRIVATESPACE
# define FRIBIDI_PRIVATESPACE1(A,B) A##B
# define FRIBIDI_PRIVATESPACE0(A,B) FRIBIDI_PRIVATESPACE1(A,B)
# define FRIBIDI_PRIVATESPACE(SYMBOL) FRIBIDI_PRIVATESPACE0(_,FRIBIDI_NAMESPACE(_##SYMBOL##__internal__))
#endif /* !FRIBIDI_PRIVATESPACE */
#if FRIBIDI_USE_GLIB+0
# ifndef SIZEOF_LONG
# define SIZEOF_LONG GLIB_SIZEOF_LONG
# endif /* !SIZEOF_LONG */
# ifndef SIZEOF_VOID_P
# define SIZEOF_VOID_P GLIB_SIZEOF_VOID_P
# endif /* !SIZEOF_VOID_P */
# ifndef __FRIBIDI_DOC
# include <glib.h>
# endif /* !__FRIBIDI_DOC */
# ifndef fribidi_malloc
# define fribidi_malloc g_try_malloc
# define fribidi_free g_free
# endif /* !fribidi_malloc */
# ifndef fribidi_assert
# ifndef __FRIBIDI_DOC
# include <glib.h>
# endif /* !__FRIBIDI_DOC */
# define fribidi_assert g_assert
# endif /* !fribidi_assert */
# ifndef __FRIBIDI_DOC
# include <glib.h>
# endif /* !__FRIBIDI_DOC */
# ifndef FRIBIDI_BEGIN_STMT
# define FRIBIDI_BEGIN_STMT G_STMT_START {
# define FRIBIDI_END_STMT } G_STMT_END
# endif /* !FRIBIDI_BEGIN_STMT */
# ifndef LIKELY
# define LIKELY G_LIKELY
# define UNLIKELY G_UNLIKELY
# endif /* !LIKELY */
# ifndef false
# define false FALSE
# endif /* !false */
# ifndef true
# define true TRUE
# endif /* !true */
#endif /* FRIBIDI_USE_GLIB */
#ifndef false
# define false (0)
# endif /* !false */
# ifndef true
# define true (!false)
# endif /* !true */
#ifndef NULL
# ifdef __cplusplus
# define NULL (0L)
# else /* !__cplusplus */
# define NULL ((void*) 0)
# endif /* !__cplusplus */
#endif /* !NULL */
/* fribidi_malloc and fribidi_free should be used instead of malloc and free.
* No need to include any headers. */
#ifndef fribidi_malloc
# if HAVE_STDLIB_H
# ifndef __FRIBIDI_DOC
# include <stdlib.h>
# endif /* __FRIBIDI_DOC */
# define fribidi_malloc malloc
# else /* !HAVE_STDLIB_H */
# define fribidi_malloc (void *) malloc
# endif /* !HAVE_STDLIB_H */
# define fribidi_free free
#else /* fribidi_malloc */
# ifndef fribidi_free
# error You should define fribidi_free too when you define fribidi_malloc.
# endif /* !fribidi_free */
#endif /* fribidi_malloc */
#if HAVE_STRING_H+0
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#if HAVE_STRINGS_H+0
# include <strings.h>
#endif
/* FRIBIDI_CHUNK_SIZE is the number of bytes in each chunk of memory being
* allocated for data structure pools. */
#ifndef FRIBIDI_CHUNK_SIZE
# if HAVE_ASM_PAGE_H
# ifndef __FRIBIDI_DOC
# include <asm/page.h>
# endif /* __FRIBIDI_DOC */
# define FRIBIDI_CHUNK_SIZE (PAGE_SIZE - 16)
# else /* !HAVE_ASM_PAGE_H */
# define FRIBIDI_CHUNK_SIZE (4096 - 16)
# endif /* !HAVE_ASM_PAGE_H */
#else /* FRIBIDI_CHUNK_SIZE */
# if FRIBIDI_CHUNK_SIZE < 256
# error FRIBIDI_CHUNK_SIZE now should define the size of a chunk in bytes.
# endif /* FRIBIDI_CHUNK_SIZE < 256 */
#endif /* FRIBIDI_CHUNK_SIZE */
/* FRIBIDI_BEGIN_STMT should be used at the beginning of your macro
* definitions that are to behave like simple statements. Use
* FRIBIDI_END_STMT at the end of the macro after the semicolon or brace. */
#ifndef FRIBIDI_BEGIN_STMT
# define FRIBIDI_BEGIN_STMT do {
# define FRIBIDI_END_STMT } while (0)
#endif /* !FRIBIDI_BEGIN_STMT */
/* LIKEYLY and UNLIKELY are used to give a hint on branch prediction to the
* compiler. */
#ifndef LIKELY
# define LIKELY
# define UNLIKELY
#endif /* !LIKELY */
#ifndef FRIBIDI_EMPTY_STMT
# define FRIBIDI_EMPTY_STMT FRIBIDI_BEGIN_STMT (void) 0; FRIBIDI_END_STMT
#endif /* !FRIBIDI_EMPTY_STMT */
#if HAVE_STRINGIZE+0
# define STRINGIZE(symbol) #symbol
#else /* !HAVE_STRINGIZE */
# define STRINGIZE(symbol) (no stringize operator available)
#endif /* !HAVE_STRINGIZE */
/* As per recommendation of GNU Coding Standards. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif /* !_GNU_SOURCE */
/* We respect our own rules. */
#define FRIBIDI_NO_DEPRECATED
#include "debug.h"
#endif /* !_COMMON_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

113
lib/debug.h Normal file
View file

@ -0,0 +1,113 @@
/* FriBidi
* debug.h - debug-only interfaces
*
* $Id: debug.h,v 1.10 2006-01-31 03:23:12 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:12 $
* $Revision: 1.10 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/debug.h,v $
*
* Author:
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc.
* Copyright (C) 2001,2002 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _DEBUG_H
#define _DEBUG_H
#include "common.h"
#include <fribidi-types.h>
#include <fribidi-begindecls.h>
#if DEBUG+0
/* These definitions should only be used in DEBUG mode: */
#ifndef __LINE__
# define __LINE__ 0
#endif /* !__LINE__ */
#ifndef __FILE__
# define __FILE__ "unknown"
#endif /* !__FILE__ */
#ifndef FRIBIDI_FPRINTF
# ifndef __FRIBIDI_DOC
# include <stdio.h>
# endif /* !__FRIBIDI_DOC */
# define FRIBIDI_FPRINTF fprintf
# define FRIBIDI_STDERR_ stderr,
#endif /* !FRIBIDI_FPRINTF */
#ifndef MSG
#define MSG(s) \
FRIBIDI_BEGIN_STMT \
FRIBIDI_FPRINTF(FRIBIDI_STDERR_ s); \
FRIBIDI_END_STMT
#define MSG2(s, t) \
FRIBIDI_BEGIN_STMT \
FRIBIDI_FPRINTF(FRIBIDI_STDERR_ s, t); \
FRIBIDI_END_STMT
#define MSG5(s, t, u, v, w) \
FRIBIDI_BEGIN_STMT \
FRIBIDI_FPRINTF(FRIBIDI_STDERR_ s, t, u, v, w); \
FRIBIDI_END_STMT
#endif /* !MSG */
#ifndef DBG
# define DBG(s) \
FRIBIDI_BEGIN_STMT \
if (fribidi_debug_status()) { MSG(FRIBIDI ": " s "\n"); } \
FRIBIDI_END_STMT
# define DBG2(s, t) \
FRIBIDI_BEGIN_STMT \
if (fribidi_debug_status()) { MSG2(FRIBIDI ": " s "\n", t); } \
FRIBIDI_END_STMT
#endif /* !DBG */
#ifndef fribidi_assert
# define fribidi_assert(cond) \
FRIBIDI_BEGIN_STMT \
if (!(cond)) { \
DBG(__FILE__ ":" STRINGIZE(__LINE__) ": " \
"assertion failed (" STRINGIZE(cond) ")"); \
} \
FRIBIDI_END_STMT
#endif /* !fribidi_assert */
#else /* !DEBUG */
#ifndef DBG
# define DBG(s) FRIBIDI_EMPTY_STMT
# define DBG2(s, t) FRIBIDI_EMPTY_STMT
#endif /* !DBG */
#ifndef fribidi_assert
# define fribidi_assert(cond) FRIBIDI_EMPTY_STMT
#endif /* !fribidi_assert */
#endif /* !DEBUG */
#include <fribidi-enddecls.h>
#endif /* !_DEBUG_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

193
lib/fribidi-arabic.c Normal file
View file

@ -0,0 +1,193 @@
/* fribidi-arabic.c - Arabic shaping
*
* Copyright (C) 2005 Behdad Esfahbod
*
* This file is part of GNU FriBidi.
*
* GNU FriBidi 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.1
* of the License, or (at your option) any later version.
*
* GNU FriBidi 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 GNU FriBidi; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* For licensing issues, contact <license@farsiweb.info> or write to
* Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran.
*/
/* $Id: fribidi-arabic.c,v 1.3 2007-04-05 16:14:39 behdad Exp $
* $Author: behdad $
* $Date: 2007-04-05 16:14:39 $
* $Revision: 1.3 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-arabic.c,v $
*
* Author(s):
* Behdad Esfahbod, 2005
*/
#include "common.h"
#if HAVE_STDLIB_H+0
# include <stdlib.h>
#endif
#include <fribidi-arabic.h>
#include <fribidi-unicode.h>
typedef struct _PairMap {
FriBidiChar pair[2], to;
} PairMap;
#define FRIBIDI_ACCESS_SHAPE_TABLE(table,min,max,x,shape) (table), (min), (max)
# define FRIBIDI_ACCESS_SHAPE_TABLE_REAL(table,min,max,x,shape) \
(((x)<(min)||(x)>(max))?(x):(table)[(x)-(min)][(shape)])
#include "arabic-shaping.tab.i"
#include "arabic-misc.tab.i"
static void
fribidi_shape_arabic_joining (
/* input */
const FriBidiChar table[][4],
FriBidiChar min,
FriBidiChar max,
const FriBidiStrIndex len,
const FriBidiArabicProp *ar_props,
/* input and output */
FriBidiChar *str
)
{
register FriBidiStrIndex i;
for (i = 0; i < len; i++)
if (FRIBIDI_ARAB_SHAPES(ar_props[i]))
str[i] = FRIBIDI_ACCESS_SHAPE_TABLE_REAL (table, min, max, str[i], FRIBIDI_JOIN_SHAPE (ar_props[i]));
}
static int
comp_PairMap (const void *pa, const void *pb)
{
PairMap *a = (PairMap *)pa;
PairMap *b = (PairMap *)pb;
if (a->pair[0] != b->pair[0])
return a->pair[0] < b->pair[0] ? -1 : +1;
else
return a->pair[1] < b->pair[1] ? -1 :
a->pair[1] > b->pair[1] ? +1 :
0;
}
static FriBidiChar
find_pair_match (const PairMap *table, int size, FriBidiChar first, FriBidiChar second)
{
PairMap *match;
PairMap x;
x.pair[0] = first;
x.pair[1] = second;
x.to = 0;
match = bsearch (&x, table, size, sizeof (table[0]), comp_PairMap);
return match ? match->to : 0;
}
#define PAIR_MATCH(table,len,first,second) \
((first)<(table[0].pair[0])||(first)>(table[len-1].pair[0])?0: \
find_pair_match(table, len, first, second))
static void
fribidi_shape_arabic_ligature (
/* input */
const PairMap *table,
int size,
const FriBidiLevel *embedding_levels,
const FriBidiStrIndex len,
/* input and output */
FriBidiArabicProp *ar_props,
FriBidiChar *str
)
{
/* TODO: This doesn't form ligatures for even-level Arabic text.
* no big problem though. */
register FriBidiStrIndex i;
for (i = 0; i < len - 1; i++) {
register FriBidiChar c;
if (FRIBIDI_LEVEL_IS_RTL(embedding_levels[i]) &&
embedding_levels[i] == embedding_levels[i+1] &&
(c = PAIR_MATCH(table, size, str[i], str[i+1])))
{
str[i] = FRIBIDI_CHAR_FILL;
FRIBIDI_SET_BITS(ar_props[i], FRIBIDI_MASK_LIGATURED);
str[i+1] = c;
}
}
}
#define DO_LIGATURING(table, levels, len, ar_props, str) \
fribidi_shape_arabic_ligature ((table), sizeof(table)/sizeof((table)[0]), levels, len, ar_props, str)
#define DO_SHAPING(tablemacro, len, ar_props, str) \
fribidi_shape_arabic_joining (tablemacro(,), len, ar_props, str);
FRIBIDI_ENTRY void
fribidi_shape_arabic (
/* input */
FriBidiFlags flags,
const FriBidiLevel *embedding_levels,
const FriBidiStrIndex len,
/* input and output */
FriBidiArabicProp *ar_props,
FriBidiChar *str
)
{
DBG ("in fribidi_shape_arabic");
if UNLIKELY
(len == 0 || !str) return;
DBG ("in fribidi_shape");
fribidi_assert (ar_props);
if (FRIBIDI_TEST_BITS (flags, FRIBIDI_FLAG_SHAPE_ARAB_PRES))
{
DO_SHAPING (FRIBIDI_GET_ARABIC_SHAPE_PRES, len, ar_props, str);
}
if (FRIBIDI_TEST_BITS (flags, FRIBIDI_FLAG_SHAPE_ARAB_LIGA))
{
DO_LIGATURING (mandatory_liga_table, embedding_levels, len, ar_props, str);
}
if (FRIBIDI_TEST_BITS (flags, FRIBIDI_FLAG_SHAPE_ARAB_CONSOLE))
{
DO_LIGATURING (console_liga_table, embedding_levels, len, ar_props, str);
DO_SHAPING (FRIBIDI_GET_ARABIC_SHAPE_NSM, len, ar_props, str);
}
}
/* Editor directions:
* Local Variables:
* mode: c
* c-basic-offset: 2
* indent-tabs-mode: t
* tab-width: 8
* End:
* vim: textwidth=78: autoindent: cindent: shiftwidth=2: tabstop=8:
*/

88
lib/fribidi-arabic.h Normal file
View file

@ -0,0 +1,88 @@
/* fribidi-arabic.h - do Arabic shaping to presentation forms
*
* Copyright (C) 2005 Behdad Esfahbod
*
* This file is part of GNU FriBidi.
*
* GNU FriBidi 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.1
* of the License, or (at your option) any later version.
*
* GNU FriBidi 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 GNU FriBidi; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* For licensing issues, contact <license@farsiweb.info> or write to
* Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran.
*/
/* $Id: fribidi-arabic.h,v 1.1 2005-11-03 01:39:01 behdad Exp $
* $Author: behdad $
* $Date: 2005-11-03 01:39:01 $
* $Revision: 1.1 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-arabic.h,v $
*
* Author(s):
* Behdad Esfahbod, 2005
*/
#ifndef _FRIBIDI_ARABIC_H
#define _FRIBIDI_ARABIC_H
#include "fribidi-common.h"
#include "fribidi-types.h"
#include "fribidi-flags.h"
#include "fribidi-bidi-types.h"
#include "fribidi-joining.h"
#include "fribidi-begindecls.h"
#define fribidi_shape_arabic FRIBIDI_NAMESPACE(shape_arabic)
/* fribidi_shape_arabic - do Arabic shaping
*
* The actual shaping that is done depends on the flags set. Only flags
* starting with FRIBIDI_FLAG_SHAPE_ARAB_ affect this function.
* Currently these are:
*
* * FRIBIDI_FLAG_SHAPE_MIRRORING: Do mirroring.
* * FRIBIDI_FLAG_SHAPE_ARAB_PRES: Shape Arabic characters to their
* presentation form glyphs.
* * FRIBIDI_FLAG_SHAPE_ARAB_LIGA: Form mandatory Arabic ligatures.
* * FRIBIDI_FLAG_SHAPE_ARAB_CONSOLE: Perform additional Arabic shaping
* suitable for text rendered on
* grid terminals with no mark
* rendering capabilities.
*
* Of the above, FRIBIDI_FLAG_SHAPE_ARAB_CONSOLE is only used in special
* cases, but the rest are recommended in any enviroment that doesn't have
* other means for doing Arabic shaping. The set of extra flags that enable
* this level of Arabic support has a shortcut named FRIBIDI_FLAGS_ARABIC.
*/
FRIBIDI_ENTRY void
fribidi_shape_arabic (
FriBidiFlags flags, /* shaping flags */
const FriBidiLevel *embedding_levels,
const FriBidiStrIndex len, /* input string length */
FriBidiArabicProp *ar_props, /* input/output Arabic properties as
* computed by fribidi_join_arabic */
FriBidiChar *str /* string to shape */
);
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_ARABIC_H */
/* Editor directions:
* Local Variables:
* mode: c
* c-basic-offset: 2
* indent-tabs-mode: t
* tab-width: 8
* End:
* vim: textwidth=78: autoindent: cindent: shiftwidth=2: tabstop=8:
*/

3
lib/fribidi-begindecls.h Normal file
View file

@ -0,0 +1,3 @@
#ifdef FRIBIDI_BEGIN_DECLS
FRIBIDI_BEGIN_DECLS
#endif /* FRIBIDI_BEGIN_DECLS */

View file

@ -0,0 +1,98 @@
#ifndef __FRIBIDI_DOC
/* FriBidi
* fribidi-bidi-types-list.h - list of bidi types
*
* $Id: fribidi-bidi-types-list.h,v 1.5 2004-06-13 20:11:42 behdad Exp $
* $Author: behdad $
* $Date: 2004-06-13 20:11:42 $
* $Revision: 1.5 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi-types-list.h,v $
*
* Author:
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc.
* Copyright (C) 2001,2002 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
/* *INDENT-OFF* */
#endif /* !__FRIBIDI_DOC */
#ifndef _FRIBIDI_ADD_TYPE
# define _FRIBIDI_ADD_TYPE(x,y)
#endif
#ifndef _FRIBIDI_ADD_ALIAS
# define _FRIBIDI_ADD_ALIAS(x1,x2)
#endif
#if !defined(_FRIBIDI_PAR_TYPES) || defined(_FRIBIDI_ALL_TYPES)
_FRIBIDI_ADD_TYPE (LTR, 'L') /* Left-To-Right letter */
_FRIBIDI_ADD_TYPE (RTL, 'R') /* Right-To-Left letter */
_FRIBIDI_ADD_TYPE (AL, 'A') /* Arabic Letter */
_FRIBIDI_ADD_TYPE (EN, '1') /* European Numeral */
_FRIBIDI_ADD_TYPE (AN, '9') /* Arabic Numeral */
_FRIBIDI_ADD_TYPE (ES, 'w') /* European number Separator */
_FRIBIDI_ADD_TYPE (ET, 'w') /* European number Terminator */
_FRIBIDI_ADD_TYPE (CS, 'w') /* Common Separator */
_FRIBIDI_ADD_TYPE (NSM, '`') /* Non Spacing Mark */
_FRIBIDI_ADD_TYPE (BN, 'b') /* Boundary Neutral */
_FRIBIDI_ADD_TYPE (BS, 'B') /* Block Separator */
_FRIBIDI_ADD_TYPE (SS, 'S') /* Segment Separator */
_FRIBIDI_ADD_TYPE (WS, '_') /* WhiteSpace */
_FRIBIDI_ADD_TYPE (ON, 'n') /* Other Neutral */
_FRIBIDI_ADD_TYPE (LRE, '+') /* Left-to-Right Embedding */
_FRIBIDI_ADD_TYPE (RLE, '+') /* Right-to-Left Embedding */
_FRIBIDI_ADD_TYPE (LRO, '+') /* Left-to-Right Override */
_FRIBIDI_ADD_TYPE (RLO, '+') /* Right-to-Left Override */
_FRIBIDI_ADD_TYPE (PDF, '-') /* Pop Directional Flag */
#if defined(_FRIBIDI_ADD_ALIAS)
_FRIBIDI_ADD_ALIAS (L, LTR)
_FRIBIDI_ADD_ALIAS (R, RTL)
_FRIBIDI_ADD_ALIAS (B, BS)
_FRIBIDI_ADD_ALIAS (S, SS)
#endif /* _FRIBIDI_ADD_ALIAS */
#if defined(_FRIBIDI_SENTINEL_TYPE) || defined(_FRIBIDI_ALL_TYPES)
_FRIBIDI_ADD_TYPE (SENTINEL, '$') /* SENTINEL */
#endif /* _FRIBIDI_SENTINEL_TYPES || _FRIBIDI_ALL_TYPES*/
#endif /* !_FRIBIDI_PAR_TYPES || _FRIBIDI_ALL_TYPES */
#if defined(_FRIBIDI_PAR_TYPES) || defined(_FRIBIDI_ALL_TYPES)
# if !defined(_FRIBIDI_ALL_TYPES)
_FRIBIDI_ADD_TYPE (LTR, 'L') /* Left-To-Right paragraph */
_FRIBIDI_ADD_TYPE (RTL, 'R') /* Right-To-Left paragraph */
_FRIBIDI_ADD_TYPE (ON, 'n') /* directiOn-Neutral paragraph */
# endif /* !_FRIBIDI_ALL_TYPES */
_FRIBIDI_ADD_TYPE (WLTR, 'l') /* Weak Left To Right paragraph */
_FRIBIDI_ADD_TYPE (WRTL, 'r') /* Weak Right To Left paragraph */
#endif /* _FRIBIDI_PAR_TYPES || _FRIBIDI_ALL_TYPES*/
#if defined(_FRIBIDI_ENUM_TYPES)
typedef enum {
# define _FRIBIDI_ADD_TYPE _FRIBIDI_ENUM_ADD_TYPE
# include "fribidi-bidi-types-list.h"
# undef _FRIBIDI_ADD_TYPE
_FRIBIDI_TYPES_MAX
} _FRIBIDI_ENUM_TYPES
#endif /* _FRIBIDI_ENUM_TYPES */
#ifndef __FRIBIDI_DOC
/* *INDENT-ON* */
#endif /* !__FRIBIDI_DOC */

125
lib/fribidi-bidi-types.c Normal file
View file

@ -0,0 +1,125 @@
/* FriBidi
* fribidi-bidi-types.c - character bidi types
*
* $Id: fribidi-bidi-types.c,v 1.9 2006-01-31 03:23:13 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:13 $
* $Revision: 1.9 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi-types.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc.
* Copyright (C) 2001,2002 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include "common.h"
#include <fribidi-bidi-types.h>
#include "bidi-types.h"
enum FriBidiCharTypeLinearEnum
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE,
# include "fribidi-bidi-types-list.h"
# undef _FRIBIDI_ADD_TYPE
_FRIBIDI_NUM_TYPES
};
#include "bidi-type.tab.i"
/* Map FriBidiCharTypeLinearEnum to FriBidiCharType. */
static const FriBidiCharType linear_enum_to_char_type[] = {
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) FRIBIDI_TYPE_##TYPE,
# include "fribidi-bidi-types-list.h"
# undef _FRIBIDI_ADD_TYPE
};
FRIBIDI_ENTRY FriBidiCharType
fribidi_get_bidi_type (
/* input */
FriBidiChar ch
)
{
return linear_enum_to_char_type[FRIBIDI_GET_BIDI_TYPE (ch)];
}
FRIBIDI_ENTRY void
fribidi_get_bidi_types (
/* input */
const FriBidiChar *str,
const FriBidiStrIndex len,
/* output */
FriBidiCharType *btypes
)
{
register FriBidiStrIndex i = len;
for (; i; i--)
{
*btypes++ = linear_enum_to_char_type[FRIBIDI_GET_BIDI_TYPE (*str)];
str++;
}
}
FRIBIDI_ENTRY const char *
fribidi_get_bidi_type_name (
/* input */
FriBidiCharType t
)
{
switch (t)
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_TYPE_##TYPE: return STRINGIZE(TYPE);
# define _FRIBIDI_ALL_TYPES
# include "fribidi-bidi-types-list.h"
# undef _FRIBIDI_ALL_TYPES
# undef _FRIBIDI_ADD_TYPE
default:
return "?";
}
}
#if DEBUG+0
char
fribidi_char_from_bidi_type (
/* input */
FriBidiCharType t
)
{
switch (t)
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_TYPE_##TYPE: return SYMBOL;
# define _FRIBIDI_ALL_TYPES
# include "fribidi-bidi-types-list.h"
# undef _FRIBIDI_ALL_TYPES
# undef _FRIBIDI_ADD_TYPE
default:
return '?';
}
}
#endif /* DEBUG */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

389
lib/fribidi-bidi-types.h Normal file
View file

@ -0,0 +1,389 @@
/* FriBidi
* fribidi-bidi-types.h - character bidi types
*
* $Id: fribidi-bidi-types.h,v 1.15 2008-11-24 17:48:31 behdad Exp $
* $Author: behdad $
* $Date: 2008-11-24 17:48:31 $
* $Revision: 1.15 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi-types.h,v $
*
* Author:
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc.
* Copyright (C) 2001,2002 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_BIDI_TYPES_H
#define _FRIBIDI_BIDI_TYPES_H
#include "fribidi-common.h"
#include "fribidi-types.h"
#include "fribidi-begindecls.h"
typedef signed char FriBidiLevel;
/*
* Define bit masks that bidi types are based on, each mask has
* only one bit set.
*/
/* RTL mask better be the least significant bit. */
#define FRIBIDI_MASK_RTL 0x00000001L /* Is right to left */
#define FRIBIDI_MASK_ARABIC 0x00000002L /* Is arabic */
/* Each char can be only one of the three following. */
#define FRIBIDI_MASK_STRONG 0x00000010L /* Is strong */
#define FRIBIDI_MASK_WEAK 0x00000020L /* Is weak */
#define FRIBIDI_MASK_NEUTRAL 0x00000040L /* Is neutral */
#define FRIBIDI_MASK_SENTINEL 0x00000080L /* Is sentinel */
/* Sentinels are not valid chars, just identify the start/end of strings. */
/* Each char can be only one of the five following. */
#define FRIBIDI_MASK_LETTER 0x00000100L /* Is letter: L, R, AL */
#define FRIBIDI_MASK_NUMBER 0x00000200L /* Is number: EN, AN */
#define FRIBIDI_MASK_NUMSEPTER 0x00000400L /* Is separator or terminator: ES, ET, CS */
#define FRIBIDI_MASK_SPACE 0x00000800L /* Is space: BN, BS, SS, WS */
#define FRIBIDI_MASK_EXPLICIT 0x00001000L /* Is expilict mark: LRE, RLE, LRO, RLO, PDF */
/* Can be set only if FRIBIDI_MASK_SPACE is also set. */
#define FRIBIDI_MASK_SEPARATOR 0x00002000L /* Is text separator: BS, SS */
/* Can be set only if FRIBIDI_MASK_EXPLICIT is also set. */
#define FRIBIDI_MASK_OVERRIDE 0x00004000L /* Is explicit override: LRO, RLO */
/* The following exist to make types pairwise different, some of them can
* be removed but are here because of efficiency (make queries faster). */
#define FRIBIDI_MASK_ES 0x00010000L
#define FRIBIDI_MASK_ET 0x00020000L
#define FRIBIDI_MASK_CS 0x00040000L
#define FRIBIDI_MASK_NSM 0x00080000L
#define FRIBIDI_MASK_BN 0x00100000L
#define FRIBIDI_MASK_BS 0x00200000L
#define FRIBIDI_MASK_SS 0x00400000L
#define FRIBIDI_MASK_WS 0x00800000L
/* We reserve a single bit for user's private use: we will never use it. */
#define FRIBIDI_MASK_PRIVATE 0x01000000L
/*
* Define values for FriBidiCharType
*/
/* Strong types */
/* Left-To-Right letter */
#define FRIBIDI_TYPE_LTR_VAL ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_LETTER )
/* Right-To-Left letter */
#define FRIBIDI_TYPE_RTL_VAL ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_LETTER \
| FRIBIDI_MASK_RTL)
/* Arabic Letter */
#define FRIBIDI_TYPE_AL_VAL ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_LETTER \
| FRIBIDI_MASK_RTL | FRIBIDI_MASK_ARABIC )
/* Left-to-Right Embedding */
#define FRIBIDI_TYPE_LRE_VAL ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_EXPLICIT)
/* Right-to-Left Embedding */
#define FRIBIDI_TYPE_RLE_VAL ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_EXPLICIT \
| FRIBIDI_MASK_RTL )
/* Left-to-Right Override */
#define FRIBIDI_TYPE_LRO_VAL ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_EXPLICIT \
| FRIBIDI_MASK_OVERRIDE )
/* Right-to-Left Override */
#define FRIBIDI_TYPE_RLO_VAL ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_EXPLICIT \
| FRIBIDI_MASK_RTL | FRIBIDI_MASK_OVERRIDE )
/* Weak types */
/* Pop Directional Flag*/
#define FRIBIDI_TYPE_PDF_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_EXPLICIT )
/* European Numeral */
#define FRIBIDI_TYPE_EN_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NUMBER )
/* Arabic Numeral */
#define FRIBIDI_TYPE_AN_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NUMBER \
| FRIBIDI_MASK_ARABIC )
/* European number Separator */
#define FRIBIDI_TYPE_ES_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NUMSEPTER \
| FRIBIDI_MASK_ES )
/* European number Terminator */
#define FRIBIDI_TYPE_ET_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NUMSEPTER \
| FRIBIDI_MASK_ET )
/* Common Separator */
#define FRIBIDI_TYPE_CS_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NUMSEPTER \
| FRIBIDI_MASK_CS )
/* Non Spacing Mark */
#define FRIBIDI_TYPE_NSM_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NSM )
/* Boundary Neutral */
#define FRIBIDI_TYPE_BN_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_SPACE \
| FRIBIDI_MASK_BN )
/* Neutral types */
/* Block Separator */
#define FRIBIDI_TYPE_BS_VAL ( FRIBIDI_MASK_NEUTRAL | FRIBIDI_MASK_SPACE \
| FRIBIDI_MASK_SEPARATOR | FRIBIDI_MASK_BS )
/* Segment Separator */
#define FRIBIDI_TYPE_SS_VAL ( FRIBIDI_MASK_NEUTRAL | FRIBIDI_MASK_SPACE \
| FRIBIDI_MASK_SEPARATOR | FRIBIDI_MASK_SS )
/* WhiteSpace */
#define FRIBIDI_TYPE_WS_VAL ( FRIBIDI_MASK_NEUTRAL | FRIBIDI_MASK_SPACE \
| FRIBIDI_MASK_WS )
/* Other Neutral */
#define FRIBIDI_TYPE_ON_VAL ( FRIBIDI_MASK_NEUTRAL )
/* The following are used in specifying paragraph direction only. */
/* Weak Left-To-Right */
#define FRIBIDI_TYPE_WLTR_VAL ( FRIBIDI_MASK_WEAK )
/* Weak Right-To-Left */
#define FRIBIDI_TYPE_WRTL_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_RTL )
/* start or end of text (run list) SENTINEL. Only used internally */
#define FRIBIDI_TYPE_SENTINEL ( FRIBIDI_MASK_SENTINEL )
/* Private types for applications. More private types can be obtained by
* summing up from this one. */
#define FRIBIDI_TYPE_PRIVATE ( FRIBIDI_MASK_PRIVATE )
/* Define Enums only if sizeof(int) == 4 (UTF-32), and not compiling C++.
* The problem with C++ is that then casts between int32 and enum will fail!
*/
#if defined(__FRIBIDI_DOC) || (FRIBIDI_SIZEOF_INT+0 == 4 && !defined(__cplusplus))
typedef enum
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) \
FRIBIDI_TYPE_##TYPE = FRIBIDI_TYPE_##TYPE##_VAL,
# include "fribidi-bidi-types-list.h"
# undef _FRIBIDI_ADD_TYPE
_FRIBIDI_TYPE_SENTINEL = FRIBIDI_TYPE_SENTINEL /* Don't use this */
} FriBidiCharType;
typedef enum
{
# define _FRIBIDI_PAR_TYPES
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) \
FRIBIDI_PAR_##TYPE = FRIBIDI_TYPE_##TYPE##_VAL,
# include "fribidi-bidi-types-list.h"
# undef _FRIBIDI_ADD_TYPE
# undef _FRIBIDI_PAR_TYPES
_FRIBIDI_PAR_SENTINEL = FRIBIDI_TYPE_SENTINEL /* Don't use this */
} FriBidiParType;
#else
typedef fribidi_uint32 FriBidiCharType;
# define FRIBIDI_TYPE_LTR FRIBIDI_TYPE_LTR_VAL
# define FRIBIDI_TYPE_RTL FRIBIDI_TYPE_RTL_VAL
# define FRIBIDI_TYPE_AL FRIBIDI_TYPE_AL_VAL
# define FRIBIDI_TYPE_EN FRIBIDI_TYPE_EN_VAL
# define FRIBIDI_TYPE_AN FRIBIDI_TYPE_AN_VAL
# define FRIBIDI_TYPE_ES FRIBIDI_TYPE_ES_VAL
# define FRIBIDI_TYPE_ET FRIBIDI_TYPE_ET_VAL
# define FRIBIDI_TYPE_CS FRIBIDI_TYPE_CS_VAL
# define FRIBIDI_TYPE_NSM FRIBIDI_TYPE_NSM_VAL
# define FRIBIDI_TYPE_BN FRIBIDI_TYPE_BN_VAL
# define FRIBIDI_TYPE_BS FRIBIDI_TYPE_BS_VAL
# define FRIBIDI_TYPE_SS FRIBIDI_TYPE_SS_VAL
# define FRIBIDI_TYPE_WS FRIBIDI_TYPE_WS_VAL
# define FRIBIDI_TYPE_ON FRIBIDI_TYPE_ON_VAL
# define FRIBIDI_TYPE_LRE FRIBIDI_TYPE_LRE_VAL
# define FRIBIDI_TYPE_RLE FRIBIDI_TYPE_RLE_VAL
# define FRIBIDI_TYPE_LRO FRIBIDI_TYPE_LRO_VAL
# define FRIBIDI_TYPE_RLO FRIBIDI_TYPE_RLO_VAL
# define FRIBIDI_TYPE_PDF FRIBIDI_TYPE_PDF_VAL
typedef fribidi_uint32 FriBidiParType;
# define FRIBIDI_PAR_LTR FRIBIDI_TYPE_LTR_VAL
# define FRIBIDI_PAR_RTL FRIBIDI_TYPE_RTL_VAL
# define FRIBIDI_PAR_ON FRIBIDI_TYPE_ON_VAL
# define FRIBIDI_PAR_WLTR FRIBIDI_TYPE_WLTR_VAL
# define FRIBIDI_PAR_WRTL FRIBIDI_TYPE_WRTL_VAL
#endif
/* Please don't use these two type names, use FRIBIDI_PAR_* form instead. */
#define FRIBIDI_TYPE_WLTR FRIBIDI_PAR_WLTR
#define FRIBIDI_TYPE_WRTL FRIBIDI_PAR_WRTL
/*
* Defining macros for needed queries, It is fully dependent on the
* implementation of FriBidiCharType.
*/
/* Is right-to-left level? */
#define FRIBIDI_LEVEL_IS_RTL(lev) ((lev) & 1)
/* Return the bidi type corresponding to the direction of the level number,
FRIBIDI_TYPE_LTR for evens and FRIBIDI_TYPE_RTL for odds. */
#define FRIBIDI_LEVEL_TO_DIR(lev) \
(FRIBIDI_LEVEL_IS_RTL (lev) ? FRIBIDI_TYPE_RTL : FRIBIDI_TYPE_LTR)
/* Return the minimum level of the direction, 0 for FRIBIDI_TYPE_LTR and
1 for FRIBIDI_TYPE_RTL and FRIBIDI_TYPE_AL. */
#define FRIBIDI_DIR_TO_LEVEL(dir) \
((FriBidiLevel) (FRIBIDI_IS_RTL (dir) ? 1 : 0))
/* Is right to left: RTL, AL, RLE, RLO? */
#define FRIBIDI_IS_RTL(p) ((p) & FRIBIDI_MASK_RTL)
/* Is arabic: AL, AN? */
#define FRIBIDI_IS_ARABIC(p) ((p) & FRIBIDI_MASK_ARABIC)
/* Is strong? */
#define FRIBIDI_IS_STRONG(p) ((p) & FRIBIDI_MASK_STRONG)
/* Is weak? */
#define FRIBIDI_IS_WEAK(p) ((p) & FRIBIDI_MASK_WEAK)
/* Is neutral? */
#define FRIBIDI_IS_NEUTRAL(p) ((p) & FRIBIDI_MASK_NEUTRAL)
/* Is sentinel? */
#define FRIBIDI_IS_SENTINEL(p) ((p) & FRIBIDI_MASK_SENTINEL)
/* Is letter: L, R, AL? */
#define FRIBIDI_IS_LETTER(p) ((p) & FRIBIDI_MASK_LETTER)
/* Is number: EN, AN? */
#define FRIBIDI_IS_NUMBER(p) ((p) & FRIBIDI_MASK_NUMBER)
/* Is number separator or terminator: ES, ET, CS? */
#define FRIBIDI_IS_NUMBER_SEPARATOR_OR_TERMINATOR(p) \
((p) & FRIBIDI_MASK_NUMSEPTER)
/* Is space: BN, BS, SS, WS? */
#define FRIBIDI_IS_SPACE(p) ((p) & FRIBIDI_MASK_SPACE)
/* Is explicit mark: LRE, RLE, LRO, RLO, PDF? */
#define FRIBIDI_IS_EXPLICIT(p) ((p) & FRIBIDI_MASK_EXPLICIT)
/* Is text separator: BS, SS? */
#define FRIBIDI_IS_SEPARATOR(p) ((p) & FRIBIDI_MASK_SEPARATOR)
/* Is explicit override: LRO, RLO? */
#define FRIBIDI_IS_OVERRIDE(p) ((p) & FRIBIDI_MASK_OVERRIDE)
/* Some more: */
/* Is left to right letter: LTR? */
#define FRIBIDI_IS_LTR_LETTER(p) \
((p) & (FRIBIDI_MASK_LETTER | FRIBIDI_MASK_RTL) == FRIBIDI_MASK_LETTER)
/* Is right to left letter: RTL, AL? */
#define FRIBIDI_IS_RTL_LETTER(p) \
((p) & (FRIBIDI_MASK_LETTER | FRIBIDI_MASK_RTL) \
== (FRIBIDI_MASK_LETTER | FRIBIDI_MASK_RTL))
/* Is ES or CS: ES, CS? */
#define FRIBIDI_IS_ES_OR_CS(p) \
((p) & (FRIBIDI_MASK_ES | FRIBIDI_MASK_CS))
/* Is explicit or BN: LRE, RLE, LRO, RLO, PDF, BN? */
#define FRIBIDI_IS_EXPLICIT_OR_BN(p) \
((p) & (FRIBIDI_MASK_EXPLICIT | FRIBIDI_MASK_BN))
/* Is explicit or BN or NSM: LRE, RLE, LRO, RLO, PDF, BN, NSM? */
#define FRIBIDI_IS_EXPLICIT_OR_BN_OR_NSM(p) \
((p) & (FRIBIDI_MASK_EXPLICIT | FRIBIDI_MASK_BN | FRIBIDI_MASK_NSM))
/* Is explicit or BN or WS: LRE, RLE, LRO, RLO, PDF, BN, WS? */
#define FRIBIDI_IS_EXPLICIT_OR_BN_OR_WS(p) \
((p) & (FRIBIDI_MASK_EXPLICIT | FRIBIDI_MASK_BN | FRIBIDI_MASK_WS))
/* Is explicit or separator or BN or WS: LRE, RLE, LRO, RLO, PDF, BS, SS, BN, WS? */
#define FRIBIDI_IS_EXPLICIT_OR_SEPARATOR_OR_BN_OR_WS(p) \
((p) & (FRIBIDI_MASK_EXPLICIT | FRIBIDI_MASK_SEPARATOR \
| FRIBIDI_MASK_BN | FRIBIDI_MASK_WS))
/* Is private-use type for application? */
#define FRIBIDI_IS_PRIVATE(p) ((p) & FRIBIDI_MASK_PRIVATE)
/* Define some conversions. */
/* Change numbers to RTL: EN,AN -> RTL. */
#define FRIBIDI_CHANGE_NUMBER_TO_RTL(p) \
(FRIBIDI_IS_NUMBER(p) ? FRIBIDI_TYPE_RTL : (p))
/* Override status of an explicit mark:
* LRO,LRE->LTR, RLO,RLE->RTL, otherwise->ON. */
#define FRIBIDI_EXPLICIT_TO_OVERRIDE_DIR(p) \
(FRIBIDI_IS_OVERRIDE(p) ? FRIBIDI_LEVEL_TO_DIR(FRIBIDI_DIR_TO_LEVEL(p)) \
: FRIBIDI_TYPE_ON)
/* Weaken type for paragraph fallback purposes:
* LTR->WLTR, RTL->WRTL. */
#define FRIBIDI_WEAK_PARAGRAPH(p) (FRIBIDI_PAR_WLTR | ((p) & FRIBIDI_MASK_RTL))
/* Functions finally */
#define fribidi_get_bidi_type FRIBIDI_NAMESPACE(get_bidi_type)
/* fribidi_get_bidi_type - get character bidi type
*
* This function returns the bidi type of a character as defined in Table 3.7
* Bidirectional Character Types of the Unicode Bidirectional Algorithm
* available at
* http://www.unicode.org/reports/tr9/#Bidirectional_Character_Types, using
* data provided in file UnicodeData.txt of the Unicode Character Database
* available at http://www.unicode.org/Public/UNIDATA/UnicodeData.txt.
*
* There are a few macros defined in fribidi-bidi-types.h for querying a bidi
* type.
*/
FRIBIDI_ENTRY FriBidiCharType
fribidi_get_bidi_type (
FriBidiChar ch /* input character */
) FRIBIDI_GNUC_CONST;
#define fribidi_get_bidi_types FRIBIDI_NAMESPACE(get_bidi_types)
/* fribidi_get_bidi_types - get bidi types for an string of characters
*
* This function finds the bidi types of an string of characters. See
* fribidi_get_bidi_type() for more information about the bidi types returned
* by this function.
*/
FRIBIDI_ENTRY void fribidi_get_bidi_types (
const FriBidiChar *str, /* input string */
const FriBidiStrIndex len, /* input string length */
FriBidiCharType *btypes /* output bidi types */
);
#define fribidi_get_bidi_type_name FRIBIDI_NAMESPACE(get_bidi_type_name)
/* fribidi_get_bidi_type_name - get bidi type name
*
* This function returns the bidi type name of a character type. The
* returned string is a static string and should not be freed.
*
* The type names are the same as ones defined in Table 3.7 Bidirectional
* Character Types of the Unicode Bidirectional Algorithm available at
* http://www.unicode.org/reports/tr9/#Bidirectional_Character_Types, with a
* few modifications: L->LTR, R->RTL, B->BS, S->SS.
*/
FRIBIDI_ENTRY const char *fribidi_get_bidi_type_name (
FriBidiCharType t /* input bidi type */
) FRIBIDI_GNUC_CONST;
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_BIDI_TYPES_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

998
lib/fribidi-bidi.c Normal file
View file

@ -0,0 +1,998 @@
/* FriBidi
* fribidi-bidi.c - bidirectional algorithm
*
* $Id: fribidi-bidi.c,v 1.21 2007-03-15 18:09:25 behdad Exp $
* $Author: behdad $
* $Date: 2007-03-15 18:09:25 $
* $Revision: 1.21 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include "common.h"
#include <fribidi-bidi.h>
#include <fribidi-mirroring.h>
#include <fribidi-unicode.h>
#include "mem.h"
#include "bidi-types.h"
#include "run.h"
/*
* This file implements most of Unicode Standard Annex #9, Tracking Number 13.
*/
#ifndef MAX
# define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif /* !MAX */
/* Some convenience macros */
#define RL_TYPE(list) ((list)->type)
#define RL_LEN(list) ((list)->len)
#define RL_POS(list) ((list)->pos)
#define RL_LEVEL(list) ((list)->level)
static FriBidiRun *
merge_with_prev (
FriBidiRun *second
)
{
FriBidiRun *first;
fribidi_assert (second);
fribidi_assert (second->next);
first = second->prev;
fribidi_assert (first);
first->next = second->next;
first->next->prev = first;
RL_LEN (first) += RL_LEN (second);
free_run (second);
return first;
}
static void
compact_list (
FriBidiRun *list
)
{
fribidi_assert (list);
if (list->next)
for_run_list (list, list)
if (RL_TYPE (list->prev) == RL_TYPE (list)
&& RL_LEVEL (list->prev) == RL_LEVEL (list))
list = merge_with_prev (list);
}
static void
compact_neutrals (
FriBidiRun *list
)
{
fribidi_assert (list);
if (list->next)
{
for_run_list (list, list)
{
if (RL_LEVEL (list->prev) == RL_LEVEL (list)
&&
((RL_TYPE
(list->prev) == RL_TYPE (list)
|| (FRIBIDI_IS_NEUTRAL (RL_TYPE (list->prev))
&& FRIBIDI_IS_NEUTRAL (RL_TYPE (list))))))
list = merge_with_prev (list);
}
}
}
#if DEBUG+0
/*======================================================================
* For debugging, define some functions for printing the types and the
* levels.
*----------------------------------------------------------------------*/
static char char_from_level_array[] = {
'$', /* -1 == FRIBIDI_SENTINEL, indicating
* start or end of string. */
/* 0-61 == 0-9,a-z,A-Z are the the only valid levels before resolving
* implicits. after that the level @ may be appear too. */
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D',
'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z',
'@', /* 62 == only must appear after resolving
* implicits. */
'!', /* 63 == FRIBIDI_LEVEL_INVALID, internal error,
* this level shouldn't be seen. */
'*', '*', '*', '*', '*' /* >= 64 == overflows, this levels and higher
* levels show a real bug!. */
};
#define fribidi_char_from_level(level) char_from_level_array[(level) + 1]
static void
print_types_re (
const FriBidiRun *pp
)
{
fribidi_assert (pp);
MSG (" Run types : ");
for_run_list (pp, pp)
{
MSG5 ("%d:%d(%s)[%d] ",
pp->pos, pp->len, fribidi_get_bidi_type_name (pp->type), pp->level);
}
MSG ("\n");
}
static void
print_resolved_levels (
const FriBidiRun *pp
)
{
fribidi_assert (pp);
MSG (" Res. levels: ");
for_run_list (pp, pp)
{
register FriBidiStrIndex i;
for (i = RL_LEN (pp); i; i--)
MSG2 ("%c", fribidi_char_from_level (RL_LEVEL (pp)));
}
MSG ("\n");
}
static void
print_resolved_types (
const FriBidiRun *pp
)
{
fribidi_assert (pp);
MSG (" Res. types : ");
for_run_list (pp, pp)
{
FriBidiStrIndex i;
for (i = RL_LEN (pp); i; i--)
MSG2 ("%c", fribidi_char_from_bidi_type (pp->type));
}
MSG ("\n");
}
static void
print_bidi_string (
/* input */
const FriBidiCharType *bidi_types,
const FriBidiStrIndex len
)
{
register FriBidiStrIndex i;
fribidi_assert (bidi_types);
MSG (" Org. types : ");
for (i = 0; i < len; i++)
MSG2 ("%c", fribidi_char_from_bidi_type (bidi_types[i]));
MSG ("\n");
}
#endif /* DEBUG */
/*=========================================================================
* define macros for push and pop the status in to / out of the stack
*-------------------------------------------------------------------------*/
/* There are a few little points in pushing into and poping from the status
stack:
1. when the embedding level is not valid (more than
FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL=61), you must reject it, and not to push
into the stack, but when you see a PDF, you must find the matching code,
and if it was pushed in the stack, pop it, it means you must pop if and
only if you have pushed the matching code, the over_pushed var counts the
number of rejected codes so far.
2. there's a more confusing point too, when the embedding level is exactly
FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL-1=60, an LRO or LRE is rejected
because the new level would be FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL+1=62, that
is invalid; but an RLO or RLE is accepted because the new level is
FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL=61, that is valid, so the rejected codes
may be not continuous in the logical order, in fact there are at most two
continuous intervals of codes, with an RLO or RLE between them. To support
this case, the first_interval var counts the number of rejected codes in
the first interval, when it is 0, means that there is only one interval.
*/
/* a. If this new level would be valid, then this embedding code is valid.
Remember (push) the current embedding level and override status.
Reset current level to this new level, and reset the override status to
new_override.
b. If the new level would not be valid, then this code is invalid. Don't
change the current level or override status.
*/
#define PUSH_STATUS \
FRIBIDI_BEGIN_STMT \
if LIKELY(new_level <= FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL) \
{ \
if UNLIKELY(level == FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL - 1) \
first_interval = over_pushed; \
status_stack[stack_size].level = level; \
status_stack[stack_size].override = override; \
stack_size++; \
level = new_level; \
override = new_override; \
} else \
over_pushed++; \
FRIBIDI_END_STMT
/* If there was a valid matching code, restore (pop) the last remembered
(pushed) embedding level and directional override.
*/
#define POP_STATUS \
FRIBIDI_BEGIN_STMT \
if (stack_size) \
{ \
if UNLIKELY(over_pushed > first_interval) \
over_pushed--; \
else \
{ \
if LIKELY(over_pushed == first_interval) \
first_interval = 0; \
stack_size--; \
level = status_stack[stack_size].level; \
override = status_stack[stack_size].override; \
} \
} \
FRIBIDI_END_STMT
/* Return the type of previous run or the SOR, if already at the start of
a level run. */
#define PREV_TYPE_OR_SOR(pp) \
( \
RL_LEVEL(pp->prev) == RL_LEVEL(pp) ? \
RL_TYPE(pp->prev) : \
FRIBIDI_LEVEL_TO_DIR(MAX(RL_LEVEL(pp->prev), RL_LEVEL(pp))) \
)
/* Return the type of next run or the EOR, if already at the end of
a level run. */
#define NEXT_TYPE_OR_EOR(pp) \
( \
RL_LEVEL(pp->next) == RL_LEVEL(pp) ? \
RL_TYPE(pp->next) : \
FRIBIDI_LEVEL_TO_DIR(MAX(RL_LEVEL(pp->next), RL_LEVEL(pp))) \
)
/* Return the embedding direction of a link. */
#define FRIBIDI_EMBEDDING_DIRECTION(link) \
FRIBIDI_LEVEL_TO_DIR(RL_LEVEL(link))
FRIBIDI_ENTRY FriBidiParType
fribidi_get_par_direction (
/* input */
const FriBidiCharType *bidi_types,
const FriBidiStrIndex len
)
{
register FriBidiStrIndex i;
fribidi_assert (bidi_types);
for (i = 0; i < len; i++)
if (FRIBIDI_IS_LETTER (bidi_types[i]))
return FRIBIDI_IS_RTL (bidi_types[i]) ? FRIBIDI_PAR_RTL :
FRIBIDI_PAR_LTR;
return FRIBIDI_PAR_ON;
}
FRIBIDI_ENTRY FriBidiLevel
fribidi_get_par_embedding_levels (
/* input */
const FriBidiCharType *bidi_types,
const FriBidiStrIndex len,
/* input and output */
FriBidiParType *pbase_dir,
/* output */
FriBidiLevel *embedding_levels
)
{
FriBidiLevel base_level, max_level = 0;
FriBidiParType base_dir;
FriBidiRun *main_run_list = NULL, *explicits_list = NULL, *pp;
fribidi_boolean status = false;
if UNLIKELY
(!len)
{
status = true;
goto out;
}
DBG ("in fribidi_get_par_embedding_levels");
fribidi_assert (bidi_types);
fribidi_assert (pbase_dir);
fribidi_assert (embedding_levels);
/* Determinate character types */
{
/* Get run-length encoded character types */
main_run_list = run_list_encode_bidi_types (bidi_types, len);
if UNLIKELY
(!main_run_list) goto out;
}
/* Find base level */
/* If no strong base_dir was found, resort to the weak direction
that was passed on input. */
base_level = FRIBIDI_DIR_TO_LEVEL (*pbase_dir);
if (!FRIBIDI_IS_STRONG (*pbase_dir))
/* P2. P3. Search for first strong character and use its direction as
base direction */
{
for_run_list (pp, main_run_list) if (FRIBIDI_IS_LETTER (RL_TYPE (pp)))
{
base_level = FRIBIDI_DIR_TO_LEVEL (RL_TYPE (pp));
*pbase_dir = FRIBIDI_LEVEL_TO_DIR (base_level);
break;
}
}
base_dir = FRIBIDI_LEVEL_TO_DIR (base_level);
DBG2 (" base level : %c", fribidi_char_from_level (base_level));
DBG2 (" base dir : %c", fribidi_char_from_bidi_type (base_dir));
# if DEBUG
if UNLIKELY
(fribidi_debug_status ())
{
print_types_re (main_run_list);
}
# endif /* DEBUG */
/* Explicit Levels and Directions */
DBG ("explicit levels and directions");
{
FriBidiLevel level, new_level;
FriBidiCharType override, new_override;
FriBidiStrIndex i;
int stack_size, over_pushed, first_interval;
struct
{
FriBidiCharType override; /* only LTR, RTL and ON are valid */
FriBidiLevel level;
} *status_stack;
FriBidiRun temp_link;
/* explicits_list is a list like main_run_list, that holds the explicit
codes that are removed from main_run_list, to reinsert them later by
calling the shadow_run_list.
*/
explicits_list = new_run_list ();
if UNLIKELY
(!explicits_list) goto out;
/* X1. Begin by setting the current embedding level to the paragraph
embedding level. Set the directional override status to neutral.
Process each character iteratively, applying rules X2 through X9.
Only embedding levels from 0 to 61 are valid in this phase. */
level = base_level;
override = FRIBIDI_TYPE_ON;
/* stack */
stack_size = 0;
over_pushed = 0;
first_interval = 0;
status_stack = fribidi_malloc (sizeof (status_stack[0]) *
FRIBIDI_BIDI_MAX_RESOLVED_LEVELS);
for_run_list (pp, main_run_list)
{
FriBidiCharType this_type = RL_TYPE (pp);
if (FRIBIDI_IS_EXPLICIT_OR_BN (this_type))
{
if (FRIBIDI_IS_STRONG (this_type))
{ /* LRE, RLE, LRO, RLO */
/* 1. Explicit Embeddings */
/* X2. With each RLE, compute the least greater odd
embedding level. */
/* X3. With each LRE, compute the least greater even
embedding level. */
/* 2. Explicit Overrides */
/* X4. With each RLO, compute the least greater odd
embedding level. */
/* X5. With each LRO, compute the least greater even
embedding level. */
new_override = FRIBIDI_EXPLICIT_TO_OVERRIDE_DIR (this_type);
for (i = RL_LEN (pp); i; i--)
{
new_level =
((level + FRIBIDI_DIR_TO_LEVEL (this_type) + 2) & ~1) -
FRIBIDI_DIR_TO_LEVEL (this_type);
PUSH_STATUS;
}
}
else if (this_type == FRIBIDI_TYPE_PDF)
{
/* 3. Terminating Embeddings and overrides */
/* X7. With each PDF, determine the matching embedding or
override code. */
for (i = RL_LEN (pp); i; i--)
POP_STATUS;
}
/* X9. Remove all RLE, LRE, RLO, LRO, PDF, and BN codes. */
/* Remove element and add it to explicits_list */
RL_LEVEL (pp) = FRIBIDI_SENTINEL;
temp_link.next = pp->next;
move_node_before (pp, explicits_list);
pp = &temp_link;
}
else if (this_type == FRIBIDI_TYPE_BS)
{
/* X8. All explicit directional embeddings and overrides are
completely terminated at the end of each paragraph. Paragraph
separators are not included in the embedding. */
break;
}
else
{
/* X6. For all types besides RLE, LRE, RLO, LRO, and PDF:
a. Set the level of the current character to the current
embedding level.
b. Whenever the directional override status is not neutral,
reset the current character type to the directional override
status. */
RL_LEVEL (pp) = level;
if (!FRIBIDI_IS_NEUTRAL (override))
RL_TYPE (pp) = override;
}
}
/* Implementing X8. It has no effect on a single paragraph! */
level = base_level;
override = FRIBIDI_TYPE_ON;
stack_size = 0;
over_pushed = 0;
fribidi_free (status_stack);
}
/* X10. The remaining rules are applied to each run of characters at the
same level. For each run, determine the start-of-level-run (sor) and
end-of-level-run (eor) type, either L or R. This depends on the
higher of the two levels on either side of the boundary (at the start
or end of the paragraph, the level of the 'other' run is the base
embedding level). If the higher level is odd, the type is R, otherwise
it is L. */
/* Resolving Implicit Levels can be done out of X10 loop, so only change
of Resolving Weak Types and Resolving Neutral Types is needed. */
compact_list (main_run_list);
# if DEBUG
if UNLIKELY
(fribidi_debug_status ())
{
print_types_re (main_run_list);
print_bidi_string (bidi_types, len);
print_resolved_levels (main_run_list);
print_resolved_types (main_run_list);
}
# endif /* DEBUG */
/* 4. Resolving weak types */
DBG ("resolving weak types");
{
FriBidiCharType last_strong, prev_type_orig;
fribidi_boolean w4;
last_strong = base_dir;
for_run_list (pp, main_run_list)
{
register FriBidiCharType prev_type, this_type, next_type;
prev_type = PREV_TYPE_OR_SOR (pp);
this_type = RL_TYPE (pp);
next_type = NEXT_TYPE_OR_EOR (pp);
if (FRIBIDI_IS_STRONG (prev_type))
last_strong = prev_type;
/* W1. NSM
Examine each non-spacing mark (NSM) in the level run, and change the
type of the NSM to the type of the previous character. If the NSM
is at the start of the level run, it will get the type of sor. */
/* Implementation note: it is important that if the previous character
is not sor, then we should merge this run with the previous,
because of rules like W5, that we assume all of a sequence of
adjacent ETs are in one FriBidiRun. */
if (this_type == FRIBIDI_TYPE_NSM)
{
if (RL_LEVEL (pp->prev) == RL_LEVEL (pp))
pp = merge_with_prev (pp);
else
RL_TYPE (pp) = prev_type;
if (prev_type == next_type && RL_LEVEL (pp) == RL_LEVEL (pp->next))
{
pp = merge_with_prev (pp->next);
}
continue; /* As we know the next condition cannot be true. */
}
/* W2: European numbers. */
if (this_type == FRIBIDI_TYPE_EN && last_strong == FRIBIDI_TYPE_AL)
{
RL_TYPE (pp) = FRIBIDI_TYPE_AN;
/* Resolving dependency of loops for rules W1 and W2, so we
can merge them in one loop. */
if (next_type == FRIBIDI_TYPE_NSM)
RL_TYPE (pp->next) = FRIBIDI_TYPE_AN;
}
}
last_strong = base_dir;
/* Resolving dependency of loops for rules W4 and W5, W5 may
want to prevent W4 to take effect in the next turn, do this
through "w4". */
w4 = true;
/* Resolving dependency of loops for rules W4 and W5 with W7,
W7 may change an EN to L but it sets the prev_type_orig if needed,
so W4 and W5 in next turn can still do their works. */
prev_type_orig = FRIBIDI_TYPE_ON;
for_run_list (pp, main_run_list)
{
register FriBidiCharType prev_type, this_type, next_type;
prev_type = PREV_TYPE_OR_SOR (pp);
this_type = RL_TYPE (pp);
next_type = NEXT_TYPE_OR_EOR (pp);
if (FRIBIDI_IS_STRONG (prev_type))
last_strong = prev_type;
/* W3: Change ALs to R. */
if (this_type == FRIBIDI_TYPE_AL)
{
RL_TYPE (pp) = FRIBIDI_TYPE_RTL;
w4 = true;
prev_type_orig = FRIBIDI_TYPE_ON;
continue;
}
/* W4. A single european separator changes to a european number.
A single common separator between two numbers of the same type
changes to that type. */
if (w4
&& RL_LEN (pp) == 1 && FRIBIDI_IS_ES_OR_CS (this_type)
&& FRIBIDI_IS_NUMBER (prev_type_orig)
&& prev_type_orig == next_type
&& (prev_type_orig == FRIBIDI_TYPE_EN
|| this_type == FRIBIDI_TYPE_CS))
{
RL_TYPE (pp) = prev_type;
this_type = RL_TYPE (pp);
}
w4 = true;
/* W5. A sequence of European terminators adjacent to European
numbers changes to All European numbers. */
if (this_type == FRIBIDI_TYPE_ET
&& (prev_type_orig == FRIBIDI_TYPE_EN
|| next_type == FRIBIDI_TYPE_EN))
{
RL_TYPE (pp) = FRIBIDI_TYPE_EN;
w4 = false;
this_type = RL_TYPE (pp);
}
/* W6. Otherwise change separators and terminators to other neutral. */
if (FRIBIDI_IS_NUMBER_SEPARATOR_OR_TERMINATOR (this_type))
RL_TYPE (pp) = FRIBIDI_TYPE_ON;
/* W7. Change european numbers to L. */
if (this_type == FRIBIDI_TYPE_EN && last_strong == FRIBIDI_TYPE_LTR)
{
RL_TYPE (pp) = FRIBIDI_TYPE_LTR;
prev_type_orig = (RL_LEVEL (pp) == RL_LEVEL (pp->next) ?
FRIBIDI_TYPE_EN : FRIBIDI_TYPE_ON);
}
else
prev_type_orig = PREV_TYPE_OR_SOR (pp->next);
}
}
compact_neutrals (main_run_list);
# if DEBUG
if UNLIKELY
(fribidi_debug_status ())
{
print_resolved_levels (main_run_list);
print_resolved_types (main_run_list);
}
# endif /* DEBUG */
/* 5. Resolving Neutral Types */
DBG ("resolving neutral types");
{
/* N1. and N2.
For each neutral, resolve it. */
for_run_list (pp, main_run_list)
{
FriBidiCharType prev_type, this_type, next_type;
/* "European and Arabic numbers are treated as though they were R"
FRIBIDI_CHANGE_NUMBER_TO_RTL does this. */
this_type = FRIBIDI_CHANGE_NUMBER_TO_RTL (RL_TYPE (pp));
prev_type = FRIBIDI_CHANGE_NUMBER_TO_RTL (PREV_TYPE_OR_SOR (pp));
next_type = FRIBIDI_CHANGE_NUMBER_TO_RTL (NEXT_TYPE_OR_EOR (pp));
if (FRIBIDI_IS_NEUTRAL (this_type))
RL_TYPE (pp) = (prev_type == next_type) ?
/* N1. */ prev_type :
/* N2. */ FRIBIDI_EMBEDDING_DIRECTION (pp);
}
}
compact_list (main_run_list);
# if DEBUG
if UNLIKELY
(fribidi_debug_status ())
{
print_resolved_levels (main_run_list);
print_resolved_types (main_run_list);
}
# endif /* DEBUG */
/* 6. Resolving implicit levels */
DBG ("resolving implicit levels");
{
max_level = base_level;
for_run_list (pp, main_run_list)
{
FriBidiCharType this_type;
int level;
this_type = RL_TYPE (pp);
level = RL_LEVEL (pp);
/* I1. Even */
/* I2. Odd */
if (FRIBIDI_IS_NUMBER (this_type))
RL_LEVEL (pp) = (level + 2) & ~1;
else
RL_LEVEL (pp) =
level +
(FRIBIDI_LEVEL_IS_RTL (level) ^ FRIBIDI_DIR_TO_LEVEL (this_type));
if (RL_LEVEL (pp) > max_level)
max_level = RL_LEVEL (pp);
}
}
compact_list (main_run_list);
# if DEBUG
if UNLIKELY
(fribidi_debug_status ())
{
print_bidi_string (bidi_types, len);
print_resolved_levels (main_run_list);
print_resolved_types (main_run_list);
}
# endif /* DEBUG */
/* Reinsert the explicit codes & BN's that are already removed, from the
explicits_list to main_run_list. */
DBG ("reinserting explicit codes");
if UNLIKELY
(explicits_list->next != explicits_list)
{
register FriBidiRun *p;
register fribidi_boolean stat =
shadow_run_list (main_run_list, explicits_list, true);
explicits_list = NULL;
if UNLIKELY
(!stat) goto out;
/* Set level of inserted explicit chars to that of their previous
* char, such that they do not affect reordering. */
p = main_run_list->next;
if (p != main_run_list && p->level == FRIBIDI_SENTINEL)
p->level = base_level;
for_run_list (p, main_run_list) if (p->level == FRIBIDI_SENTINEL)
p->level = p->prev->level;
}
# if DEBUG
if UNLIKELY
(fribidi_debug_status ())
{
print_types_re (main_run_list);
print_resolved_levels (main_run_list);
print_resolved_types (main_run_list);
}
# endif /* DEBUG */
DBG ("reset the embedding levels, 1, 2, 3.");
{
register int j, state, pos;
register FriBidiCharType char_type;
register FriBidiRun *p, *q, *list;
/* L1. Reset the embedding levels of some chars:
1. segment separators,
2. paragraph separators,
3. any sequence of whitespace characters preceding a segment
separator or paragraph separator, and
... (to be continued in fribidi_reorder_line()). */
list = new_run_list ();
if UNLIKELY
(!list) goto out;
q = list;
state = 1;
pos = len - 1;
for (j = len - 1; j >= -1; j--)
{
/* close up the open link at the end */
if (j >= 0)
char_type = bidi_types[j];
else
char_type = FRIBIDI_TYPE_ON;
if (!state && FRIBIDI_IS_SEPARATOR (char_type))
{
state = 1;
pos = j;
}
else if (state && !FRIBIDI_IS_EXPLICIT_OR_SEPARATOR_OR_BN_OR_WS
(char_type))
{
state = 0;
p = new_run ();
if UNLIKELY
(!p)
{
free_run_list (list);
goto out;
}
p->pos = j + 1;
p->len = pos - j;
p->type = base_dir;
p->level = base_level;
move_node_before (p, q);
q = p;
}
}
if UNLIKELY
(!shadow_run_list (main_run_list, list, false)) goto out;
}
# if DEBUG
if UNLIKELY
(fribidi_debug_status ())
{
print_types_re (main_run_list);
print_resolved_levels (main_run_list);
print_resolved_types (main_run_list);
}
# endif /* DEBUG */
{
FriBidiStrIndex pos = 0;
for_run_list (pp, main_run_list)
{
register FriBidiStrIndex l;
register FriBidiLevel level = pp->level;
for (l = pp->len; l; l--)
embedding_levels[pos++] = level;
}
}
status = true;
out:
DBG ("leaving fribidi_get_par_embedding_levels");
if (main_run_list)
free_run_list (main_run_list);
if UNLIKELY
(explicits_list) free_run_list (explicits_list);
return status ? max_level + 1 : 0;
}
static void
bidi_string_reverse (
FriBidiChar *str,
const FriBidiStrIndex len
)
{
FriBidiStrIndex i;
fribidi_assert (str);
for (i = 0; i < len / 2; i++)
{
FriBidiChar tmp = str[i];
str[i] = str[len - 1 - i];
str[len - 1 - i] = tmp;
}
}
static void
index_array_reverse (
FriBidiStrIndex *arr,
const FriBidiStrIndex len
)
{
FriBidiStrIndex i;
fribidi_assert (arr);
for (i = 0; i < len / 2; i++)
{
FriBidiStrIndex tmp = arr[i];
arr[i] = arr[len - 1 - i];
arr[len - 1 - i] = tmp;
}
}
FRIBIDI_ENTRY FriBidiLevel
fribidi_reorder_line (
/* input */
FriBidiFlags flags, /* reorder flags */
const FriBidiCharType *bidi_types,
const FriBidiStrIndex len,
const FriBidiStrIndex off,
const FriBidiParType base_dir,
/* input and output */
FriBidiLevel *embedding_levels,
FriBidiChar *visual_str,
/* output */
FriBidiStrIndex *map
)
{
fribidi_boolean status = false;
FriBidiLevel max_level = 0;
if UNLIKELY
(len == 0)
{
status = true;
goto out;
}
DBG ("in fribidi_reorder_line");
fribidi_assert (bidi_types);
fribidi_assert (embedding_levels);
DBG ("reset the embedding levels, 4. whitespace at the end of line");
{
register FriBidiStrIndex i;
/* L1. Reset the embedding levels of some chars:
4. any sequence of white space characters at the end of the line. */
for (i = off + len - 1; i >= off &&
FRIBIDI_IS_EXPLICIT_OR_BN_OR_WS (bidi_types[i]); i--)
embedding_levels[i] = FRIBIDI_DIR_TO_LEVEL (base_dir);
}
/* 7. Reordering resolved levels */
{
register FriBidiLevel level;
register FriBidiStrIndex i;
/* Reorder both the outstring and the order array */
{
if (FRIBIDI_TEST_BITS (flags, FRIBIDI_FLAG_REORDER_NSM))
{
/* L3. Reorder NSMs. */
for (i = off + len - 1; i >= off; i--)
if (FRIBIDI_LEVEL_IS_RTL (embedding_levels[i])
&& bidi_types[i] == FRIBIDI_TYPE_NSM)
{
register FriBidiStrIndex seq_end = i;
level = embedding_levels[i];
for (i--; i >= off &&
FRIBIDI_IS_EXPLICIT_OR_BN_OR_NSM (bidi_types[i])
&& embedding_levels[i] == level; i--)
;
if (i < off || embedding_levels[i] != level)
{
i++;
DBG ("warning: NSM(s) at the beggining of level run");
}
if (visual_str)
{
bidi_string_reverse (visual_str + i, seq_end - i + 1);
}
if (map)
{
index_array_reverse (map + i, seq_end - i + 1);
}
}
}
/* Find max_level of the line. We don't reuse the paragraph
* max_level, both for a cleaner API, and that the line max_level
* may be far less than paragraph max_level. */
for (i = off + len - 1; i >= off; i--)
if (embedding_levels[i] > max_level)
max_level = embedding_levels[i];
/* L2. Reorder. */
for (level = max_level; level > 0; level--)
for (i = off + len - 1; i >= off; i--)
if (embedding_levels[i] >= level)
{
/* Find all stretches that are >= level_idx */
register FriBidiStrIndex seq_end = i;
for (i--; i >= off && embedding_levels[i] >= level; i--)
;
if (visual_str)
bidi_string_reverse (visual_str + i + 1, seq_end - i);
if (map)
index_array_reverse (map + i + 1, seq_end - i);
}
}
}
status = true;
out:
return status ? max_level + 1 : 0;
}
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

149
lib/fribidi-bidi.h Normal file
View file

@ -0,0 +1,149 @@
/* FriBidi
* fribidi-bidi.h - bidirectional algorithm
*
* $Id: fribidi-bidi.h,v 1.15 2005-11-03 01:39:01 behdad Exp $
* $Author: behdad $
* $Date: 2005-11-03 01:39:01 $
* $Revision: 1.15 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi.h,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_BIDI_H
#define _FRIBIDI_BIDI_H
#include "fribidi-common.h"
#include "fribidi-types.h"
#include "fribidi-flags.h"
#include "fribidi-bidi-types.h"
#include "fribidi-begindecls.h"
#define fribidi_get_par_direction FRIBIDI_NAMESPACE(get_par_direction)
/* fribidi_get_par_direction - get base paragraph direction
*
* This function finds the base direction of a single paragraph,
* as defined by rule P2 of the Unicode Bidirectional Algorithm available at
* http://www.unicode.org/reports/tr9/#P2.
*
* You typically do not need this function as
* fribidi_get_par_embedding_levels() knows how to compute base direction
* itself, but you may need this to implement a more sophisticated paragraph
* direction handling. Note that you can pass more than a paragraph to this
* function and the direction of the first non-neutral paragraph is returned,
* which is a very good heuristic to set direction of the neutral paragraphs
* at the beginning of text. For other neutral paragraphs, you better use the
* direction of the previous paragraph.
*
* Returns: Base pargraph direction. No weak paragraph direction is returned,
* only LTR, RTL, or ON.
*/
FRIBIDI_ENTRY FriBidiParType fribidi_get_par_direction (
const FriBidiCharType *bidi_types, /* input list of bidi types as returned by
fribidi_get_bidi_types() */
const FriBidiStrIndex len /* input string length */
);
#define fribidi_get_par_embedding_levels FRIBIDI_NAMESPACE(get_par_embedding_levels)
/* fribidi_get_par_embedding_levels - get bidi embedding levels of a paragraph
*
* This function finds the bidi embedding levels of a single paragraph,
* as defined by the Unicode Bidirectional Algorithm available at
* http://www.unicode.org/reports/tr9/. This function implements rules P2 to
* I1 inclusive, and parts 1 to 3 of L1, except for rule X9 which is
* implemented in fribidi_remove_bidi_marks(). Part 4 of L1 is implemented
* in fribidi_reorder_line().
*
* There are a few macros defined in fribidi-bidi-types.h to work with this
* embedding levels.
*
* Returns: Maximum level found plus one, or zero if any error occured
* (memory allocation failure most probably).
*/
FRIBIDI_ENTRY FriBidiLevel
fribidi_get_par_embedding_levels (
const FriBidiCharType *bidi_types, /* input list of bidi types as returned by
fribidi_get_bidi_types() */
const FriBidiStrIndex len, /* input string length of the paragraph */
FriBidiParType *pbase_dir, /* requested and resolved paragraph
* base direction */
FriBidiLevel *embedding_levels /* output list of embedding levels */
) FRIBIDI_GNUC_WARN_UNUSED;
#define fribidi_reorder_line FRIBIDI_NAMESPACE(reorder_line)
/* fribidi_reorder_line - reorder a line of logical string to visual
*
* This function reorders the characters in a line of text from logical to
* final visual order. This function implements part 4 of rule L1, and rules
* L2 and L3 of the Unicode Bidirectional Algorithm available at
* http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels.
*
* As a side effect it also sets position maps if not NULL.
*
* You should provide the resolved paragraph direction and embedding levels as
* set by fribidi_get_par_embedding_levels(). Also note that the embedding
* levels may change a bit. To be exact, the embedding level of any sequence
* of white space at the end of line is reset to the paragraph embedding level
* (That is part 4 of rule L1).
*
* Note that the bidi types and embedding levels are not reordered. You can
* reorder these (or any other) arrays using the map later. The user is
* responsible to initialize map to something sensible, like an identity
* mapping, or pass NULL if no map is needed.
*
* There is an optional part to this function, which is whether non-spacing
* marks for right-to-left parts of the text should be reordered to come after
* their base characters in the visual string or not. Most rendering engines
* expect this behavior, but console-based systems for example do not like it.
* This is controlled by the FRIBIDI_FLAG_REORDER_NSM flag. The flag is on
* in FRIBIDI_FLAGS_DEFAULT.
*
* Returns: Maximum level found in this line plus one, or zero if any error
* occured (memory allocation failure most probably).
*/
FRIBIDI_ENTRY FriBidiLevel fribidi_reorder_line (
FriBidiFlags flags, /* reorder flags */
const FriBidiCharType *bidi_types, /* input list of bidi types as returned by
fribidi_get_bidi_types() */
const FriBidiStrIndex len, /* input length of the line */
const FriBidiStrIndex off, /* input offset of the beginning of the line
in the paragraph */
const FriBidiParType base_dir, /* resolved paragraph base direction */
FriBidiLevel *embedding_levels, /* input list of embedding levels,
as returned by
fribidi_get_par_embedding_levels */
FriBidiChar *visual_str, /* visual string to reorder */
FriBidiStrIndex *map /* a map of string indices which is reordered
* to reflect where each glyph ends up. */
) FRIBIDI_GNUC_WARN_UNUSED;
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_BIDI_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

126
lib/fribidi-common.h Normal file
View file

@ -0,0 +1,126 @@
/* FriBidi
* fribidi-common.h - common include for library headers
*
* $Id: fribidi-common.h,v 1.14 2010-02-24 19:40:04 behdad Exp $
* $Author: behdad $
* $Date: 2010-02-24 19:40:04 $
* $Revision: 1.14 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-common.h,v $
*
* Author:
* Behdad Esfahbod, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_COMMON_H
#define _FRIBIDI_COMMON_H
#if DONT_HAVE_FRIBIDI_CONFIG_H+0
# define FRIBIDI "fribidi"
# define FRIBIDI_NAME "fribidi"
# define FRIBIDI_VERSION "unknown"
# define FRIBIDI_BUGREPORT "unknown"
# define FRIBIDI_INTERFACE_VERSION_STRING "unknown"
#else /* !DONT_HAVE_FRIBIDI_CONFIG_H */
# include "fribidi-config.h"
#endif /* !DONT_HAVE_FRIBIDI_CONFIG_H */
#if HAVE_FRIBIDI_CUSTOM_H+0
# include <fribidi-custom.h>
#endif /* HAVE_FRIBIDI_CUSTOM_H */
/* FRIBIDI_NAMESPACE is a macro used to name library symbols. */
#ifndef FRIBIDI_NAMESPACE
# define FRIBIDI_NAMESPACE(SYMBOL) fribidi##_##SYMBOL
#endif /* !FRIBIDI_NAMESPACE */
/* FRIBIDI_ENTRY is a macro used to declare library entry points. */
#ifndef FRIBIDI_ENTRY
# define FRIBIDI_ENTRY /* empty */
#endif /* !FRIBIDI_ENTRY */
#if FRIBIDI_USE_GLIB+0
# ifndef __FRIBIDI_DOC
# include <glib.h>
# endif /* !__FRIBIDI_DOC */
# define FRIBIDI_BEGIN_DECLS G_BEGIN_DECLS
# define FRIBIDI_END_DECLS G_END_DECLS
# define FRIBIDI_GNUC_CONST G_GNUC_CONST
# define FRIBIDI_GNUC_DEPRECATED G_GNUC_DEPRECATED
# if __GNUC__ > 2
# define FRIBIDI_GNUC_WARN_UNUSED \
__attribute__((__warn_unused_result__))
# define FRIBIDI_GNUC_MALLOC \
__attribute__((__malloc__))
# define FRIBIDI_GNUC_HIDDEN \
__attribute__((__visibility__ ("hidden")))
# else /* __GNUC__ <= 2 */
# define FRIBIDI_GNUC_WARN_UNUSED
# define FRIBIDI_GNUC_MALLOC
# define FRIBIDI_GNUC_HIDDEN
# endif /* __GNUC__ <= 2 */
#else /* !FRIBIDI_USE_GLIB */
# define FRIBIDI_GNUC_CONST
# define FRIBIDI_GNUC_DEPRECATED
# define FRIBIDI_GNUC_WARN_UNUSED
# define FRIBIDI_GNUC_MALLOC
# define FRIBIDI_GNUC_HIDDEN
#endif /* !FRIBIDI_USE_GLIB */
/* FRIBIDI_BEGIN_DECLS should be used at the beginning of your declarations,
* so that C++ compilers don't mangle their names. Use FRIBIDI_END_DECLS at
* the end of C declarations. */
#ifndef FRIBIDI_BEGIN_DECLS
# ifdef __cplusplus
# define FRIBIDI_BEGIN_DECLS extern "C" {
# define FRIBIDI_END_DECLS }
# else /* !__cplusplus */
# define FRIBIDI_BEGIN_DECLS /* empty */
# define FRIBIDI_END_DECLS /* empty */
# endif /* !__cplusplus */
#endif /* !FRIBIDI_BEGIN_DECLS */
#define fribidi_debug_status FRIBIDI_NAMESPACE(debug_status)
FRIBIDI_ENTRY int fribidi_debug_status (
void
);
#define fribidi_set_debug FRIBIDI_NAMESPACE(set_debug)
FRIBIDI_ENTRY int
fribidi_set_debug (
int state /* new state to set */
);
#endif /* !_FRIBIDI_COMMON_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

26
lib/fribidi-config.h.in Normal file
View file

@ -0,0 +1,26 @@
/* @configure_input@ */
/* Not copyrighted, in public domain. */
#ifndef FRIBIDI_CONFIG_H
#define FRIBIDI_CONFIG_H
#define FRIBIDI "@PACKAGE@"
#define FRIBIDI_NAME "@PACKAGE_NAME@"
#define FRIBIDI_BUGREPORT "@PACKAGE_BUGREPORT@"
#define FRIBIDI_VERSION "@FRIBIDI_VERSION@"
#define FRIBIDI_MAJOR_VERSION @FRIBIDI_MAJOR_VERSION@
#define FRIBIDI_MINOR_VERSION @FRIBIDI_MINOR_VERSION@
#define FRIBIDI_MICRO_VERSION @FRIBIDI_MICRO_VERSION@
#define FRIBIDI_INTERFACE_VERSION @FRIBIDI_INTERFACE_VERSION@
#define FRIBIDI_INTERFACE_VERSION_STRING "@FRIBIDI_INTERFACE_VERSION@"
/* Define to 1 if you want charset conversion codes in the library */
#define FRIBIDI_CHARSETS @FRIBIDI_CHARSETS@
/* Define to 1 if you want to use glib */
#define FRIBIDI_USE_GLIB @FRIBIDI_USE_GLIB@
/* The size of a `int', as computed by sizeof. */
#define FRIBIDI_SIZEOF_INT @SIZEOF_INT@
#endif /* FRIBIDI_CONFIG_H */

314
lib/fribidi-deprecated.c Normal file
View file

@ -0,0 +1,314 @@
/* FriBidi
* fribidi-deprecated.c - deprecated interfaces.
*
* $Id: fribidi-deprecated.c,v 1.6 2006-06-01 22:53:55 behdad Exp $
* $Author: behdad $
* $Date: 2006-06-01 22:53:55 $
* $Revision: 1.6 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-deprecated.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include "common.h"
#undef FRIBIDI_NO_DEPRECATED
#include <fribidi-deprecated.h>
#include <fribidi.h>
#if FRIBIDI_NO_DEPRECATED+0
#else
static FriBidiFlags flags = FRIBIDI_FLAGS_DEFAULT | FRIBIDI_FLAGS_ARABIC;
FRIBIDI_ENTRY fribidi_boolean
fribidi_set_mirroring (
/* input */
fribidi_boolean state
)
{
return FRIBIDI_ADJUST_AND_TEST_BITS (flags, FRIBIDI_FLAG_SHAPE_MIRRORING, state);
}
FRIBIDI_ENTRY fribidi_boolean
fribidi_mirroring_status (
void
)
{
return FRIBIDI_TEST_BITS (flags, FRIBIDI_FLAG_SHAPE_MIRRORING);
}
FRIBIDI_ENTRY fribidi_boolean
fribidi_set_reorder_nsm (
/* input */
fribidi_boolean state
)
{
return FRIBIDI_ADJUST_AND_TEST_BITS (flags, FRIBIDI_FLAG_REORDER_NSM, state);
}
fribidi_boolean
fribidi_reorder_nsm_status (
void
)
{
return FRIBIDI_TEST_BITS (flags, FRIBIDI_FLAG_REORDER_NSM);
}
FRIBIDI_ENTRY FriBidiLevel
fribidi_log2vis_get_embedding_levels (
const FriBidiCharType *bidi_types, /* input list of bidi types as returned by
fribidi_get_bidi_types() */
const FriBidiStrIndex len, /* input string length of the paragraph */
FriBidiParType *pbase_dir, /* requested and resolved paragraph
* base direction */
FriBidiLevel *embedding_levels /* output list of embedding levels */
)
{
return fribidi_get_par_embedding_levels (bidi_types, len, pbase_dir, embedding_levels);
}
FRIBIDI_ENTRY FriBidiCharType
fribidi_get_type (
FriBidiChar ch /* input character */
)
{
return fribidi_get_bidi_type (ch);
}
FRIBIDI_ENTRY FriBidiCharType
fribidi_get_type_internal (
FriBidiChar ch /* input character */
)
{
return fribidi_get_bidi_type (ch);
}
FRIBIDI_ENTRY FriBidiStrIndex
fribidi_remove_bidi_marks (
FriBidiChar *str,
const FriBidiStrIndex len,
FriBidiStrIndex *positions_to_this,
FriBidiStrIndex *position_from_this_list,
FriBidiLevel *embedding_levels
)
{
register FriBidiStrIndex i, j = 0;
fribidi_boolean private_from_this = false;
fribidi_boolean status = false;
if UNLIKELY
(len == 0)
{
status = true;
goto out;
}
DBG ("in fribidi_remove_bidi_marks");
fribidi_assert (str);
/* If to_this is not NULL, we must have from_this as well. If it is
not given by the caller, we have to make a private instance of it. */
if (positions_to_this && !position_from_this_list)
{
position_from_this_list = fribidi_malloc (sizeof
(position_from_this_list[0]) *
len);
if UNLIKELY
(!position_from_this_list) goto out;
private_from_this = true;
for (i = 0; i < len; i++)
position_from_this_list[positions_to_this[i]] = i;
}
for (i = 0; i < len; i++)
if (!FRIBIDI_IS_EXPLICIT_OR_BN (fribidi_get_bidi_type (str[i]))
&& str[i] != FRIBIDI_CHAR_LRM && str[i] != FRIBIDI_CHAR_RLM)
{
str[j] = str[i];
if (embedding_levels)
embedding_levels[j] = embedding_levels[i];
if (position_from_this_list)
position_from_this_list[j] = position_from_this_list[i];
j++;
}
/* Convert the from_this list to to_this */
if (positions_to_this)
{
for (i = 0; i < len; i++)
positions_to_this[i] = -1;
for (i = 0; i < len; i++)
positions_to_this[position_from_this_list[i]] = i;
}
status = true;
out:
if (private_from_this)
fribidi_free (position_from_this_list);
return status ? j : -1;
}
FRIBIDI_ENTRY FriBidiLevel
fribidi_log2vis (
/* input */
const FriBidiChar *str,
FriBidiStrIndex len,
/* input and output */
FriBidiParType *pbase_dir,
/* output */
FriBidiChar *visual_str,
FriBidiStrIndex *positions_L_to_V,
FriBidiStrIndex *positions_V_to_L,
FriBidiLevel *embedding_levels
)
{
register FriBidiStrIndex i;
FriBidiLevel max_level = 0;
fribidi_boolean private_V_to_L = false;
fribidi_boolean private_embedding_levels = false;
fribidi_boolean status = false;
FriBidiArabicProp *ar_props = NULL;
FriBidiCharType *bidi_types = NULL;
if UNLIKELY
(len == 0)
{
status = true;
goto out;
}
DBG ("in fribidi_log2vis");
fribidi_assert (str);
fribidi_assert (pbase_dir);
bidi_types = fribidi_malloc (len * sizeof bidi_types[0]);
if (!bidi_types)
goto out;
fribidi_get_bidi_types (str, len, bidi_types);
if (!embedding_levels)
{
embedding_levels = fribidi_malloc (len * sizeof embedding_levels[0]);
if (!embedding_levels)
goto out;
private_embedding_levels = true;
}
max_level = fribidi_get_par_embedding_levels (bidi_types, len, pbase_dir,
embedding_levels) - 1;
if UNLIKELY
(max_level < 0) goto out;
/* If l2v is to be calculated we must have v2l as well. If it is not
given by the caller, we have to make a private instance of it. */
if (positions_L_to_V && !positions_V_to_L)
{
positions_V_to_L =
(FriBidiStrIndex *) fribidi_malloc (sizeof (FriBidiStrIndex) * len);
if (!positions_V_to_L)
goto out;
private_V_to_L = true;
}
/* Set up the ordering array to identity order */
if (positions_V_to_L)
{
for (i = 0; i < len; i++)
positions_V_to_L[i] = i;
}
if (visual_str)
{
/* Using memcpy instead
for (i = len - 1; i >= 0; i--)
visual_str[i] = str[i];
*/
memcpy (visual_str, str, len * sizeof (*visual_str));
/* Arabic joining */
ar_props = fribidi_malloc (len * sizeof ar_props[0]);
fribidi_get_joining_types (str, len, ar_props);
fribidi_join_arabic (bidi_types, len, embedding_levels, ar_props);
fribidi_shape (flags, embedding_levels, len, ar_props, visual_str);
}
/* line breaking goes here, but we assume one line in this function */
/* and this should be called once per line, but again, we assume one
* line in this deprecated function */
status =
fribidi_reorder_line (flags, bidi_types, len, 0, *pbase_dir,
embedding_levels, visual_str,
positions_V_to_L);
/* Convert the v2l list to l2v */
if (positions_L_to_V)
{
for (i = 0; i < len; i++)
positions_L_to_V[i] = -1;
for (i = 0; i < len; i++)
positions_L_to_V[positions_V_to_L[i]] = i;
}
out:
if (private_V_to_L)
fribidi_free (positions_V_to_L);
if (private_embedding_levels)
fribidi_free (embedding_levels);
if (ar_props)
fribidi_free (ar_props);
if (bidi_types)
fribidi_free (bidi_types);
return status ? max_level + 1 : 0;
}
#endif /* !FRIBIDI_NO_DEPRECATED */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

243
lib/fribidi-deprecated.h Normal file
View file

@ -0,0 +1,243 @@
/* FriBidi
* fribidi-deprecated.h - Deprecated interfaces
*
* $Id: fribidi-deprecated.h,v 1.4 2009-03-27 16:14:33 behdad Exp $
* $Author: behdad $
* $Date: 2009-03-27 16:14:33 $
* $Revision: 1.4 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-deprecated.h,v $
*
* Author:
* Behdad Esfahbod, 2004, 2005
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2004, 2005 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_DEPRECATED_H
#define _FRIBIDI_DEPRECATED_H
#include "fribidi-common.h"
#include "fribidi-types.h"
#include "fribidi-bidi-types.h"
#include "fribidi-begindecls.h"
#define fribidi_mirroring_status FRIBIDI_NAMESPACE(mirroring_status)
/* fribidi_mirroring_status - get current mirroring status
*
* This function is deprecated and only used with other deprecated functions.
*/
FRIBIDI_ENTRY fribidi_boolean fribidi_mirroring_status (
void
) FRIBIDI_GNUC_DEPRECATED;
#define fribidi_set_mirroring FRIBIDI_NAMESPACE(set_mirroring)
/* fribidi_set_mirroring - set mirroring on or off
*
* This function is used to turn character mirroring on or off.
* Character mirroring is the act of replacing a mirrorable glyph
* (character), eg. left paranthesis, with the matching glyph,
* eg. right paranthesis, in a right-to-left resolved context.
* If your rendering engine does mirroring itself, you may want to
* turn it off here.
*
* This flag is on by default.
* This function is deprecated and only used with other deprecated functions.
*
* Returns: the new mirroring status.
*/
FRIBIDI_ENTRY fribidi_boolean fribidi_set_mirroring (
fribidi_boolean state /* new state to set */
) FRIBIDI_GNUC_DEPRECATED;
#define fribidi_reorder_nsm_status FRIBIDI_NAMESPACE(reorder_nsm_status)
/* fribidi_reorder_nsm_status - get current marks reordering status
*
* This function is deprecated and only used with other deprecated functions.
*/
FRIBIDI_ENTRY fribidi_boolean fribidi_reorder_nsm_status (
void
) FRIBIDI_GNUC_DEPRECATED;
#define fribidi_set_reorder_nsm FRIBIDI_NAMESPACE(set_reorder_nsm)
/* fribidi_set_reorder_nsm - set marks reordering on or off
*
* This function is used to turn non-spacing marks reordering on or
* off. Reordering non-spacing marks is the act of placing non-spacing
* marks (bidi class NSM) after their base character in a right-to-left
* resolved context. If your rendering engine expects non-spacing marks
* always after the base character in the memory representation of the
* visual string, you need this option on. An example of where people
* may need it off is when rendering in the console when non-spacing
* marks cannot be applied on top of the base character.
*
* This flag is on by default.
* This function is deprecated and only used with other deprecated functions.
*
* Returns: the new marks reordering status.
*/
FRIBIDI_ENTRY fribidi_boolean fribidi_set_reorder_nsm (
fribidi_boolean state /* new state to set */
) FRIBIDI_GNUC_DEPRECATED;
/* fribidi_log2vis_get_embedding_levels - get embedding levels
*
* Deprecated. Replaced by fribidi_get_par_embedding_levels.
*/
#define fribidi_log2vis_get_embedding_levels FRIBIDI_NAMESPACE(log2vis_get_embedding_levels)
FRIBIDI_ENTRY FriBidiLevel
fribidi_log2vis_get_embedding_levels (
const FriBidiCharType *bidi_types, /* input list of bidi types as returned by
fribidi_get_bidi_types() */
const FriBidiStrIndex len, /* input string length of the paragraph */
FriBidiParType *pbase_dir, /* requested and resolved paragraph
* base direction */
FriBidiLevel *embedding_levels /* output list of embedding levels */
) FRIBIDI_GNUC_DEPRECATED;
/* fribidi_get_type - get character bidi type
*
* Deprecated. Replaced by fribidi_get_bidi_type.
*/
#define fribidi_get_type FRIBIDI_NAMESPACE(get_type)
FRIBIDI_ENTRY FriBidiCharType
fribidi_get_type (
FriBidiChar ch /* input character */
) FRIBIDI_GNUC_DEPRECATED;
/* fribidi_get_type_internal - get character bidi type
*
* Deprecated. Replaced by fribidi_get_bidi_type.
*/
#define fribidi_get_type_internal FRIBIDI_NAMESPACE(get_type_internal)
FRIBIDI_ENTRY FriBidiCharType
fribidi_get_type_internal (
FriBidiChar ch /* input character */
) FRIBIDI_GNUC_DEPRECATED;
#define fribidi_remove_bidi_marks FRIBIDI_NAMESPACE(remove_bidi_marks)
/* fribidi_remove_bidi_marks - remove bidi marks out of an string
*
* This function removes the bidi and boundary-neutral marks out of an string
* and the accompanying lists. It implements rule X9 of the Unicode
* Bidirectional Algorithm available at
* http://www.unicode.org/reports/tr9/#X9, with the exception that it removes
* U+200E LEFT-TO-RIGHT MARK and U+200F RIGHT-TO-LEFT MARK too.
*
* If any of the input lists are NULL, the list is skipped. If str is the
* visual string, then positions_to_this is positions_L_to_V and
* position_from_this_list is positions_V_to_L; if str is the logical
* string, the other way. Moreover, the position maps should be filled with
* valid entries.
*
* A position map pointing to a removed character is filled with \-1. By the
* way, you should not use embedding_levels if str is visual string.
*
* For best results this function should be run on a whole paragraph, not
* lines; but feel free to do otherwise if you know what you are doing.
* Deprecated. Use fribidi_remove_special_chars instead.
*
* Returns: New length of the string, or \-1 if an error occured (memory
* allocation failure most probably).
*/
FRIBIDI_ENTRY FriBidiStrIndex
fribidi_remove_bidi_marks (
FriBidiChar *str, /* input string to clean */
const FriBidiStrIndex len, /* input string length */
FriBidiStrIndex *positions_to_this, /* list mapping positions to the
order used in str */
FriBidiStrIndex *position_from_this_list, /* list mapping positions from the
order used in str */
FriBidiLevel *embedding_levels /* list of embedding levels */
)
FRIBIDI_GNUC_WARN_UNUSED FRIBIDI_GNUC_DEPRECATED;
#define fribidi_log2vis FRIBIDI_NAMESPACE(log2vis)
/* fribidi_log2vis - get visual string
*
* This function converts the logical input string to the visual output
* strings as specified by the Unicode Bidirectional Algorithm. As a side
* effect it also generates mapping lists between the two strings, and the
* list of embedding levels as defined by the algorithm.
*
* If NULL is passed as any of the the lists, the list is ignored and not
* filled.
*
* This function is obsolete because it only handles one-line paragraphs.
* Please consider using other functions instead. Deprecated.
*
* Returns: Maximum level found plus one, or zero if any error occured
* (memory allocation failure most probably).
*/
FRIBIDI_ENTRY FriBidiLevel fribidi_log2vis (
const FriBidiChar *str, /* input logical string */
const FriBidiStrIndex len, /* input string length */
FriBidiParType *pbase_dir, /* requested and resolved paragraph
* base direction */
FriBidiChar *visual_str, /* output visual string */
FriBidiStrIndex *positions_L_to_V, /* output mapping from logical to
* visual string positions */
FriBidiStrIndex *positions_V_to_L, /* output mapping from visual string
* back to the logical string
* positions */
FriBidiLevel *embedding_levels /* output list of embedding levels */
)
FRIBIDI_GNUC_WARN_UNUSED FRIBIDI_GNUC_DEPRECATED;
#define UNI_MAX_BIDI_LEVEL FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL
#define UNI_LRM FRIBIDI_CHAR_LRM
#define UNI_RLM FRIBIDI_CHAR_RLM
#define UNI_LRE FRIBIDI_CHAR_LRE
#define UNI_RLE FRIBIDI_CHAR_RLE
#define UNI_LRO FRIBIDI_CHAR_LRO
#define UNI_RLO FRIBIDI_CHAR_RLO
#define UNI_LS FRIBIDI_CHAR_LS
#define UNI_PS FRIBIDI_CHAR_PS
#define UNI_ZWNJ FRIBIDI_CHAR_ZWNJ
#define UNI_ZWJ FRIBIDI_CHAR_ZWJ
#define UNI_HEBREW_ALEF FRIBIDI_CHAR_HEBREW_ALEF
#define UNI_ARABIC_ALEF FRIBIDI_CHAR_ARABIC_ALEF
#define UNI_ARABIC_ZERO FRIBIDI_CHAR_ARABIC_ZERO
#define UNI_FARSI_ZERO FRIBIDI_CHAR_PERSIAN_ZERO
#define FRIBIDI_TYPE_WL FRIBIDI_PAR_WLTR
#define FRIBIDI_TYPE_WR FRIBIDI_PAR_WRTL
#define FRIBIDI_TYPE_L FRIBIDI_PAR_LTR
#define FRIBIDI_TYPE_R FRIBIDI_PAR_RTL
#define FRIBIDI_TYPE_N FRIBIDI_PAR_ON
#define FRIBIDI_TYPE_B FRIBIDI_TYPE_BS
#define FRIBIDI_TYPE_S FRIBIDI_TYPE_SS
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_DEPRECATED_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

3
lib/fribidi-enddecls.h Normal file
View file

@ -0,0 +1,3 @@
#ifdef FRIBIDI_END_DECLS
FRIBIDI_END_DECLS
#endif /* FRIBIDI_END_DECLS */

78
lib/fribidi-flags.h Normal file
View file

@ -0,0 +1,78 @@
/* FriBidi
* fribidi-flags.h - option flags
*
* $Id: fribidi-flags.h,v 1.1 2005-11-03 01:39:01 behdad Exp $
* $Author: behdad $
* $Date: 2005-11-03 01:39:01 $
* $Revision: 1.1 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-flags.h,v $
*
* Author:
* Behdad Esfahbod, 2005
*
* Copyright (C) 2005 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_FLAGS_H
#define _FRIBIDI_FLAGS_H
#include "fribidi-common.h"
#include "fribidi-types.h"
#include "fribidi-begindecls.h"
typedef fribidi_uint32 FriBidiFlags;
/*
* Define option flags that various functions use. Each mask has
* only one bit set.
*/
#define FRIBIDI_FLAG_SHAPE_MIRRORING 0x00000001
#define FRIBIDI_FLAG_REORDER_NSM 0x00000002
#define FRIBIDI_FLAG_SHAPE_ARAB_PRES 0x00000100
#define FRIBIDI_FLAG_SHAPE_ARAB_LIGA 0x00000200
#define FRIBIDI_FLAG_SHAPE_ARAB_CONSOLE 0x00000400
#define FRIBIDI_FLAG_REMOVE_BIDI 0x00010000
#define FRIBIDI_FLAG_REMOVE_JOINING 0x00020000
#define FRIBIDI_FLAG_REMOVE_SPECIALS 0x00040000
/*
* And their combinations.
*/
#define FRIBIDI_FLAGS_DEFAULT ( \
FRIBIDI_FLAG_SHAPE_MIRRORING | \
FRIBIDI_FLAG_REORDER_NSM | \
FRIBIDI_FLAG_REMOVE_SPECIALS )
#define FRIBIDI_FLAGS_ARABIC ( \
FRIBIDI_FLAG_SHAPE_ARAB_PRES | \
FRIBIDI_FLAG_SHAPE_ARAB_LIGA )
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_FLAGS_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

View file

@ -0,0 +1,50 @@
#ifndef __FRIBIDI_DOC
/* FriBidi
* fribidi-joining-types-list.h - list of joining types
*
* $Id: fribidi-joining-types-list.h,v 1.2 2004-06-15 11:52:02 behdad Exp $
* $Author: behdad $
* $Date: 2004-06-15 11:52:02 $
* $Revision: 1.2 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-joining-types-list.h,v $
*
* Author:
* Behdad Esfahbod, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc.
* Copyright (C) 2004 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
/* *INDENT-OFF* */
#endif /* !__FRIBIDI_DOC */
#ifndef _FRIBIDI_ADD_TYPE
# define _FRIBIDI_ADD_TYPE(x,y)
#endif
_FRIBIDI_ADD_TYPE (U, '|') /* nUn-joining, e.g. Full Stop */
_FRIBIDI_ADD_TYPE (R, '<') /* Right-joining, e.g. Arabic Letter Dal */
_FRIBIDI_ADD_TYPE (D, '+') /* Dual-joining, e.g. Arabic Letter Ain */
_FRIBIDI_ADD_TYPE (C, '-') /* join-Causing, e.g. Tatweel, ZWJ */
_FRIBIDI_ADD_TYPE (T, '^') /* Transparent, e.g. Arabic Fatha */
_FRIBIDI_ADD_TYPE (L, '>') /* Left-joining, i.e. fictional */
_FRIBIDI_ADD_TYPE (G, '~') /* iGnored, e.g. LRE, RLE, ZWNBSP */
#ifndef __FRIBIDI_DOC
/* *INDENT-ON* */
#endif /* !__FRIBIDI_DOC */

118
lib/fribidi-joining-types.c Normal file
View file

@ -0,0 +1,118 @@
/* FriBidi
* fribidi-joining-types.c - character joining types
*
* $Id: fribidi-joining-types.c,v 1.5 2006-01-31 03:23:13 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:13 $
* $Revision: 1.5 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-joining-types.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc.
* Copyright (C) 2001,2002 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include "common.h"
#include <fribidi-joining-types.h>
#include "joining-types.h"
enum FriBidiJoiningTypeShortEnum
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE = FRIBIDI_JOINING_TYPE_##TYPE,
# include "fribidi-joining-types-list.h"
# undef _FRIBIDI_ADD_TYPE
_FRIBIDI_NUM_TYPES
};
#include "joining-type.tab.i"
FRIBIDI_ENTRY FriBidiJoiningType
fribidi_get_joining_type (
/* input */
FriBidiChar ch
)
{
return FRIBIDI_GET_JOINING_TYPE (ch);
}
FRIBIDI_ENTRY void
fribidi_get_joining_types (
/* input */
const FriBidiChar *str,
const FriBidiStrIndex len,
/* output */
FriBidiJoiningType *jtypes
)
{
register FriBidiStrIndex i = len;
for (; i; i--)
{
*jtypes++ = FRIBIDI_GET_JOINING_TYPE (*str);
str++;
}
}
FRIBIDI_ENTRY const char *
fribidi_get_joining_type_name (
/* input */
FriBidiJoiningType j
)
{
switch (j)
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_JOINING_TYPE_##TYPE: return STRINGIZE(TYPE);
# include "fribidi-joining-types-list.h"
# undef _FRIBIDI_ADD_TYPE
default:
return "?";
}
}
#if DEBUG+0
char
fribidi_char_from_joining_type (
/* input */
FriBidiJoiningType j,
fribidi_boolean visual
)
{
/* switch left and right if on visual run */
if (visual & ((FRIBIDI_JOINS_RIGHT (j) && !FRIBIDI_JOINS_LEFT (j)) |
(!FRIBIDI_JOINS_RIGHT (j) && FRIBIDI_JOINS_LEFT (j))))
j ^= FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT;
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) \
if (FRIBIDI_IS_JOINING_TYPE_##TYPE(j)) return SYMBOL;
# include "fribidi-joining-types-list.h"
# undef _FRIBIDI_ADD_TYPE
return '?';
}
#endif /* DEBUG */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

258
lib/fribidi-joining-types.h Normal file
View file

@ -0,0 +1,258 @@
/* FriBidi
* fribidi-joining-types.h - character joining types
*
* $Id: fribidi-joining-types.h,v 1.5 2005-11-03 01:39:01 behdad Exp $
* $Author: behdad $
* $Date: 2005-11-03 01:39:01 $
* $Revision: 1.5 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-joining-types.h,v $
*
* Author:
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc.
* Copyright (C) 2001,2002 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_JOINING_TYPES_H
#define _FRIBIDI_JOINING_TYPES_H
#include "fribidi-common.h"
#include "fribidi-types.h"
#include "fribidi-begindecls.h"
/*
* Define bit masks that joining types are based on, each mask has
* only one bit set.
*/
#define FRIBIDI_MASK_JOINS_RIGHT 0x01 /* May join to right */
#define FRIBIDI_MASK_JOINS_LEFT 0x02 /* May join to right */
#define FRIBIDI_MASK_ARAB_SHAPES 0x04 /* May Arabic shape */
#define FRIBIDI_MASK_TRANSPARENT 0x08 /* Is transparent */
#define FRIBIDI_MASK_IGNORED 0x10 /* Is ignored */
#define FRIBIDI_MASK_LIGATURED 0x20 /* Is ligatured */
/*
* Define values for FriBidiJoiningType
*/
/* nUn-joining */
#define FRIBIDI_JOINING_TYPE_U_VAL ( 0 )
/* Right-joining */
#define FRIBIDI_JOINING_TYPE_R_VAL \
( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_ARAB_SHAPES )
/* Dual-joining */
#define FRIBIDI_JOINING_TYPE_D_VAL \
( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT \
| FRIBIDI_MASK_ARAB_SHAPES )
/* join-Causing */
#define FRIBIDI_JOINING_TYPE_C_VAL \
( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT )
/* Left-joining */
#define FRIBIDI_JOINING_TYPE_L_VAL \
( FRIBIDI_MASK_JOINS_LEFT | FRIBIDI_MASK_ARAB_SHAPES )
/* Transparent */
#define FRIBIDI_JOINING_TYPE_T_VAL \
( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_ARAB_SHAPES )
/* iGnored */
#define FRIBIDI_JOINING_TYPE_G_VAL ( FRIBIDI_MASK_IGNORED )
enum _FriBidiJoiningTypeEnum
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) \
FRIBIDI_JOINING_TYPE_##TYPE = FRIBIDI_JOINING_TYPE_##TYPE##_VAL,
# include "fribidi-joining-types-list.h"
# undef _FRIBIDI_ADD_TYPE
_FRIBIDI_JOINING_TYPE_JUNK /* Don't use this */
};
#ifdef __FRIBIDI_DOC
typedef enum _FriBidiJoiningTypeEnum FriBidiJoiningType;
#else /* !__FRIBIDI_DOC */
typedef fribidi_uint8 FriBidiJoiningType;
#endif /* !__FRIBIDI_DOC */
/* FriBidiArabicProp is essentially the same type as FriBidiJoiningType, but
* not limited to the few values returned by fribidi_get_joining_type. */
typedef fribidi_uint8 FriBidiArabicProp;
/*
* The equivalent of JoiningType values for ArabicProp
*/
/* Primary Arabic Joining Classes (Table 8-2) */
/* nUn-joining */
#define FRIBIDI_IS_JOINING_TYPE_U(p) \
( 0 == ( (p) & \
( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED \
| FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT ) ) )
/* Right-joining */
#define FRIBIDI_IS_JOINING_TYPE_R(p) \
( FRIBIDI_MASK_JOINS_RIGHT == ( (p) & \
( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED \
| FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT ) ) )
/* Dual-joining */
#define FRIBIDI_IS_JOINING_TYPE_D(p) \
( ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT \
| FRIBIDI_MASK_ARAB_SHAPES ) == ( (p) & \
( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED \
| FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT \
| FRIBIDI_MASK_ARAB_SHAPES ) ) )
/* join-Causing */
#define FRIBIDI_IS_JOINING_TYPE_C(p) \
( ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT ) == ( (p) & \
( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED \
| FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT \
| FRIBIDI_MASK_ARAB_SHAPES ) ) )
/* Left-joining */
#define FRIBIDI_IS_JOINING_TYPE_L(p) \
( FRIBIDI_MASK_JOINS_LEFT == ( (p) & \
( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED \
| FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT ) ) )
/* Transparent */
#define FRIBIDI_IS_JOINING_TYPE_T(p) \
( FRIBIDI_MASK_TRANSPARENT == ( (p) & \
( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED ) ) )
/* iGnored */
#define FRIBIDI_IS_JOINING_TYPE_G(p) \
( FRIBIDI_MASK_IGNORED == ( (p) & \
( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED ) ) )
/* and for Derived Arabic Joining Classes (Table 8-3) */
/* Right join-Causing */
#define FRIBIDI_IS_JOINING_TYPE_RC(p) \
( FRIBIDI_MASK_JOINS_RIGHT == ( (p) & \
( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED \
| FRIBIDI_MASK_JOINS_RIGHT ) ) )
/* Left join-Causing */
#define FRIBIDI_IS_JOINING_TYPE_LC(p) \
( FRIBIDI_MASK_JOINS_LEFT == ( (p) & \
( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED \
| FRIBIDI_MASK_JOINS_LEFT ) ) )
/*
* Defining macros for needed queries, It is fully dependent on the
* implementation of FriBidiJoiningType.
*/
/* Joins to right: R, D, C? */
#define FRIBIDI_JOINS_RIGHT(p) ((p) & FRIBIDI_MASK_JOINS_RIGHT)
/* Joins to left: L, D, C? */
#define FRIBIDI_JOINS_LEFT(p) ((p) & FRIBIDI_MASK_JOINS_LEFT)
/* May shape: R, D, L, T? */
#define FRIBIDI_ARAB_SHAPES(p) ((p) & FRIBIDI_MASK_ARAB_SHAPES)
/* Is skipped in joining: T, G? */
#define FRIBIDI_IS_JOIN_SKIPPED(p) \
((p) & (FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED))
/* Is base that will be shaped: R, D, L? */
#define FRIBIDI_IS_JOIN_BASE_SHAPES(p) \
( FRIBIDI_MASK_ARAB_SHAPES == ( (p) & \
( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED \
| FRIBIDI_MASK_ARAB_SHAPES ) ) )
#define FRIBIDI_JOINS_PRECEDING_MASK(level) \
(FRIBIDI_LEVEL_IS_RTL (level) ? FRIBIDI_MASK_JOINS_RIGHT \
: FRIBIDI_MASK_JOINS_LEFT)
#define FRIBIDI_JOINS_FOLLOWING_MASK(level) \
(FRIBIDI_LEVEL_IS_RTL (level) ? FRIBIDI_MASK_JOINS_LEFT \
: FRIBIDI_MASK_JOINS_RIGHT)
#define FRIBIDI_JOIN_SHAPE(p) \
((p) & ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT ))
/* Functions finally */
#define fribidi_get_joining_type FRIBIDI_NAMESPACE(get_joining_type)
/* fribidi_get_joining_type - get character joining type
*
* This function returns the joining type of a character as defined in Table
* 8-2 Primary Arabic Joining Classes of the Unicode standard available at
* http://www.unicode.org/versions/Unicode4.0.0/ch08.pdf#G7462, using data
* provided in file ArabicShaping.txt and UnicodeData.txt of the Unicode
* Character Database available at
* http://www.unicode.org/Public/UNIDATA/ArabicShaping.txt and
* http://www.unicode.org/Public/UNIDATA/UnicodeData.txt.
*
* There are a few macros defined in fribidi-joining-types.h for querying a
* joining type.
*/
FRIBIDI_ENTRY FriBidiJoiningType
fribidi_get_joining_type (
FriBidiChar ch /* input character */
) FRIBIDI_GNUC_CONST;
#define fribidi_get_joining_types FRIBIDI_NAMESPACE(get_joining_types)
/* fribidi_get_joining_types - get joining types for an string of characters
*
* This function finds the joining types of an string of characters. See
* fribidi_get_joining_type for more information about the joining types
* returned by this function.
*/
FRIBIDI_ENTRY void fribidi_get_joining_types (
const FriBidiChar *str, /* input string */
const FriBidiStrIndex len, /* input string length */
FriBidiJoiningType *jtypes /* output joining types */
);
#define fribidi_get_joining_type_name FRIBIDI_NAMESPACE(get_joining_type_name)
/* fribidi_get_joining_type_name - get joining type name
*
* This function returns the joining type name of a joining type. The
* returned string is a static string and should not be freed.
*
* The type names are the same as ones defined in Table 8-2 Primary Arabic
* Joining Classes of the Unicode standard available at
* http://www.unicode.org/versions/Unicode4.0.0/ch08.pdf#G7462.
*/
FRIBIDI_ENTRY const char *fribidi_get_joining_type_name (
FriBidiJoiningType j /* input joining type */
) FRIBIDI_GNUC_CONST;
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_JOINING_TYPES_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

193
lib/fribidi-joining.c Normal file
View file

@ -0,0 +1,193 @@
/* FriBidi
* fribidi-joining.h - Arabic joining algorithm
*
* $Id: fribidi-joining.c,v 1.6 2006-01-31 03:23:13 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:13 $
* $Revision: 1.6 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-joining.c,v $
*
* Authors:
* Behdad Esfahbod, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2004 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include "common.h"
#include <fribidi-joining.h>
#include "mem.h"
#include "bidi-types.h"
#include "joining-types.h"
#if DEBUG+0
/*======================================================================
* For debugging, define some functions for printing joining types and
* properties.
*----------------------------------------------------------------------*/
static void
print_joining_types (
/* input */
const FriBidiLevel *embedding_levels,
const FriBidiStrIndex len,
const FriBidiJoiningType *jtypes
)
{
register FriBidiStrIndex i;
fribidi_assert (jtypes);
MSG (" Join. types: ");
for (i = 0; i < len; i++)
MSG2 ("%c", fribidi_char_from_joining_type (jtypes[i],
!FRIBIDI_LEVEL_IS_RTL
(embedding_levels[i])));
MSG ("\n");
}
#endif /* DEBUG */
#define FRIBIDI_CONSISTENT_LEVEL(i) \
(FRIBIDI_IS_EXPLICIT_OR_BN (bidi_types[(i)]) \
? FRIBIDI_SENTINEL \
: embedding_levels[(i)])
#define FRIBIDI_LEVELS_MATCH(i, j) \
((i) == (j) || (i) == FRIBIDI_SENTINEL || (j) == FRIBIDI_SENTINEL)
FRIBIDI_ENTRY void
fribidi_join_arabic (
/* input */
const FriBidiCharType *bidi_types,
const FriBidiStrIndex len,
const FriBidiLevel *embedding_levels,
/* input and output */
FriBidiArabicProp *ar_props
)
{
if UNLIKELY
(len == 0) return;
DBG ("in fribidi_join_arabic");
fribidi_assert (bidi_types);
fribidi_assert (embedding_levels);
fribidi_assert (ar_props);
# if DEBUG
if UNLIKELY
(fribidi_debug_status ())
{
print_joining_types (embedding_levels, len, ar_props);
}
# endif /* DEBUG */
/* The joining algorithm turned out very very dirty :(. That's what happens
* when you follow the standard which has never been implemented closely
* before.
*/
/* 8.2 Arabic - Cursive Joining */
DBG ("Arabic cursive joining");
{
/* The following do not need to be initialized as long as joins is
* initialized to false. We just do to turn off compiler warnings. */
register FriBidiStrIndex saved = 0;
register FriBidiLevel saved_level = FRIBIDI_SENTINEL;
register fribidi_boolean saved_shapes = false;
register FriBidiArabicProp saved_joins_following_mask = 0;
register fribidi_boolean joins = false;
register FriBidiStrIndex i;
for (i = 0; i < len; i++)
if (!FRIBIDI_IS_JOINING_TYPE_G (ar_props[i]))
{
register fribidi_boolean disjoin = false;
register fribidi_boolean shapes = FRIBIDI_ARAB_SHAPES (ar_props[i]);
register FriBidiLevel level = FRIBIDI_CONSISTENT_LEVEL (i);
if (joins && !FRIBIDI_LEVELS_MATCH (saved_level, level))
{
disjoin = true;
joins = false;
}
if (!FRIBIDI_IS_JOIN_SKIPPED (ar_props[i]))
{
register const FriBidiArabicProp joins_preceding_mask =
FRIBIDI_JOINS_PRECEDING_MASK (level);
if (!joins)
{
if (shapes)
FRIBIDI_UNSET_BITS (ar_props[i], joins_preceding_mask);
}
else if (!FRIBIDI_TEST_BITS (ar_props[i], joins_preceding_mask))
{
disjoin = true;
}
else
{
register FriBidiStrIndex j;
/* This is a FriBidi extension: we set joining properties
* for skipped characters in between, so we can put NSMs on tatweel
* later if we want. Useful on console for example.
*/
for (j = saved + 1; j < i; j++)
FRIBIDI_SET_BITS (ar_props[j], joins_preceding_mask | saved_joins_following_mask);
}
}
if (disjoin && saved_shapes)
FRIBIDI_UNSET_BITS (ar_props[saved], saved_joins_following_mask);
if (!FRIBIDI_IS_JOIN_SKIPPED (ar_props[i]))
{
saved = i;
saved_level = level;
saved_shapes = shapes;
saved_joins_following_mask =
FRIBIDI_JOINS_FOLLOWING_MASK (level);
joins =
FRIBIDI_TEST_BITS (ar_props[i], saved_joins_following_mask);
}
}
if ((joins) && saved_shapes)
FRIBIDI_UNSET_BITS (ar_props[saved], saved_joins_following_mask);
}
# if DEBUG
if UNLIKELY
(fribidi_debug_status ())
{
print_joining_types (embedding_levels, len, ar_props);
}
# endif /* DEBUG */
DBG ("leaving fribidi_join_arabic");
}
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

81
lib/fribidi-joining.h Normal file
View file

@ -0,0 +1,81 @@
/* FriBidi
* fribidi-joining.h - Arabic joining algorithm
*
* $Id: fribidi-joining.h,v 1.3 2004-06-21 21:15:31 behdad Exp $
* $Author: behdad $
* $Date: 2004-06-21 21:15:31 $
* $Revision: 1.3 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-joining.h,v $
*
* Authors:
* Behdad Esfahbod, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2004 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_JOINING_H
#define _FRIBIDI_JOINING_H
#include "fribidi-common.h"
#include "fribidi-types.h"
#include "fribidi-bidi-types.h"
#include "fribidi-joining-types.h"
#include "fribidi-begindecls.h"
#define fribidi_join_arabic FRIBIDI_NAMESPACE(join_arabic)
/* fribidi_join_arabic - do Arabic joining
*
* This function does the Arabic joining algorithm. Means, given Arabic
* joining types of the characters in ar_props (don't worry,
* FriBidiJoiningType can be casted to FriBidiArabicProp automagically), this
* function modifies this properties to grasp the effect of neighboring
* characters. You probably need this information later to do Arabic shaping.
*
* This function implements rules R1 to R7 inclusive (all rules) of the Arabic
* Cursive Joining algorithm of the Unicode standard as available at
* http://www.unicode.org/versions/Unicode4.0.0/ch08.pdf#G7462. It also
* interacts correctly with the bidirection algorithm as defined in Section
* 3.5 Shaping of the Unicode Bidirectional Algorithm available at
* http://www.unicode.org/reports/tr9/#Shaping.
*
* There are a few macros defined in fribidi-joining-types.h for querying the
* Arabic properties computed by this function.
*/
FRIBIDI_ENTRY void fribidi_join_arabic (
const FriBidiCharType *bidi_types, /* input list of bidi types as
returned by
fribidi_get_bidi_types() */
const FriBidiStrIndex len, /* input string length */
const FriBidiLevel *embedding_levels, /* input list of embedding
levels, as returned by
fribidi_get_par_embedding_levels */
FriBidiArabicProp *ar_props /* Arabic properties to analyze, initilized by
joining types, as returned by
fribidi_get_joining_types */
);
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_JOINING_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

140
lib/fribidi-mem.c Normal file
View file

@ -0,0 +1,140 @@
/* FriBidi
* fribidi-mem.c - memory manipulation routines
*
* $Id: fribidi-mem.c,v 1.8 2006-01-31 03:23:13 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:13 $
* $Revision: 1.8 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-mem.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include "common.h"
#include "mem.h"
#if FRIBIDI_USE_GLIB+0
#else
#if USE_SIMPLE_MALLOC+0
#else
struct _FriBidiMemChunk
{
int atom_size;
int area_size;
int empty_size;
void *chunk;
};
FriBidiMemChunk *
fribidi_mem_chunk_new (
/* input */
const char *name,
int atom_size,
unsigned long area_size,
int alloc_type
)
{
register FriBidiMemChunk *m;
fribidi_assert (area_size >= atom_size * 8);
m = (FriBidiMemChunk *) fribidi_malloc (sizeof (FriBidiMemChunk));
if LIKELY
(m)
{
m->atom_size = atom_size;
m->area_size = area_size;
m->empty_size = 0;
m->chunk = NULL;
}
return m;
}
void *
fribidi_mem_chunk_alloc (
/* input */
FriBidiMemChunk *mem_chunk
)
{
fribidi_assert (mem_chunk);
if UNLIKELY
(mem_chunk->empty_size < mem_chunk->atom_size)
{
register void *chunk = fribidi_malloc (mem_chunk->area_size);
if LIKELY
(chunk)
{
if (mem_chunk->chunk)
*(void **) chunk =
(char *) mem_chunk->chunk + mem_chunk->empty_size -
mem_chunk->area_size;
chunk = (char *) chunk + mem_chunk->atom_size;
mem_chunk->chunk = chunk;
mem_chunk->empty_size = mem_chunk->area_size - mem_chunk->atom_size;
}
else
return NULL;
}
{
register void *m = mem_chunk->chunk;
mem_chunk->chunk = (char *) mem_chunk->chunk + mem_chunk->atom_size;
mem_chunk->empty_size -= mem_chunk->atom_size;
return m;
}
}
void
fribidi_mem_chunk_destroy (
/* input */
FriBidiMemChunk *mem_chunk
)
{
register void *chunk;
fribidi_assert (mem_chunk);
chunk =
(char *) mem_chunk->chunk + mem_chunk->empty_size - mem_chunk->area_size;
while LIKELY
(chunk)
{
register void *tofree = chunk;
chunk = *(void **) chunk;
fribidi_free (tofree);
}
fribidi_free (mem_chunk);
}
#endif /* !USE_SIMPLE_MALLOC */
#endif /* !FRIBIDI_USE_GLIB */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

96
lib/fribidi-mirroring.c Normal file
View file

@ -0,0 +1,96 @@
/* fribidi-mirroring.c - get mirrored character
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001, 2002, 2004 Behdad Esfahbod
* Copyright (C) 1999, 2000 Dov Grobgeld
*
* This file is part of GNU FriBidi.
*
* GNU FriBidi 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.1
* of the License, or (at your option) any later version.
*
* GNU FriBidi 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 GNU FriBidi; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* For licensing issues, contact <license@farsiweb.info> or write to
* Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran.
*/
/* $Id: fribidi-mirroring.c,v 1.15 2005-11-03 01:39:01 behdad Exp $
* $Author: behdad $
* $Date: 2005-11-03 01:39:01 $
* $Revision: 1.15 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-mirroring.c,v $
*
* Author(s):
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*/
#include "common.h"
#include <fribidi-mirroring.h>
#include "mirroring.tab.i"
FRIBIDI_ENTRY fribidi_boolean
fribidi_get_mirror_char (
/* input */
FriBidiChar ch,
/* output */
FriBidiChar *mirrored_ch
)
{
register FriBidiChar result;
result = FRIBIDI_GET_MIRRORING (ch);
if (mirrored_ch)
*mirrored_ch = result;
return ch != result ? true : false;
}
FRIBIDI_ENTRY void
fribidi_shape_mirroring (
/* input */
const FriBidiLevel *embedding_levels,
const FriBidiStrIndex len,
/* input and output */
FriBidiChar *str
)
{
register FriBidiStrIndex i;
DBG ("in fribidi_shape_mirroring");
if UNLIKELY
(len == 0 || !str) return;
fribidi_assert (embedding_levels);
/* L4. Mirror all characters that are in odd levels and have mirrors. */
for (i = len - 1; i >= 0; i--)
if (FRIBIDI_LEVEL_IS_RTL (embedding_levels[i]))
{
FriBidiChar mirrored_ch;
if (fribidi_get_mirror_char (str[i], &mirrored_ch))
str[i] = mirrored_ch;
}
}
/* Editor directions:
* Local Variables:
* mode: c
* c-basic-offset: 2
* indent-tabs-mode: t
* tab-width: 8
* End:
* vim: textwidth=78: autoindent: cindent: shiftwidth=2: tabstop=8:
*/

94
lib/fribidi-mirroring.h Normal file
View file

@ -0,0 +1,94 @@
/* fribidi-mirroring.h - get mirrored character
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001, 2002, 2004 Behdad Esfahbod
* Copyright (C) 1999, 2000 Dov Grobgeld
*
* This file is part of GNU FriBidi.
*
* GNU FriBidi 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.1
* of the License, or (at your option) any later version.
*
* GNU FriBidi 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 GNU FriBidi; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* For licensing issues, contact <license@farsiweb.info> or write to
* Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran.
*/
/* $Id: fribidi-mirroring.h,v 1.10 2004-09-28 07:58:57 behdad Exp $
* $Author: behdad $
* $Date: 2004-09-28 07:58:57 $
* $Revision: 1.10 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-mirroring.h,v $
*
* Author(s):
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*/
#ifndef _FRIBIDI_MIRRORING_H
#define _FRIBIDI_MIRRORING_H
#include "fribidi-common.h"
#include "fribidi-types.h"
#include "fribidi-bidi-types.h"
#include "fribidi-begindecls.h"
#define fribidi_get_mirror_char FRIBIDI_NAMESPACE(get_mirror_char)
/* fribidi_get_mirror_char - get mirrored character
*
* This function finds the mirrored equivalent of a character as defined in
* the file BidiMirroring.txt of the Unicode Character Database available at
* http://www.unicode.org/Public/UNIDATA/BidiMirroring.txt.
*
* If the input character is a declared as a mirroring character in the
* Unicode standard and has a mirrored equivalent. The matching mirrored
* character is put in the output, otherwise the input character itself is
* put.
*
* Returns: if the character has a mirroring equivalent or not.
*/
FRIBIDI_ENTRY fribidi_boolean fribidi_get_mirror_char (
FriBidiChar ch, /* input character */
FriBidiChar *mirrored_ch /* output mirrored character */
);
#define fribidi_shape_mirroring FRIBIDI_NAMESPACE(shape_mirroring)
/* fribidi_shape_mirroring - do mirroring shaping
*
* This functions replaces mirroring characters on right-to-left embeddings in
* string with their mirrored equivalent as returned by
* fribidi_get_mirror_char().
*
* This function implements rule L4 of the Unicode Bidirectional Algorithm
* available at http://www.unicode.org/reports/tr9/#L4.
*/
FRIBIDI_ENTRY void fribidi_shape_mirroring (
const FriBidiLevel *embedding_levels, /* input list of embedding
levels, as returned by
fribidi_get_par_embedding_levels */
const FriBidiStrIndex len, /* input string length */
FriBidiChar *str /* string to shape */
);
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_MIRRORING_H */
/* Editor directions:
* Local Variables:
* mode: c
* c-basic-offset: 2
* indent-tabs-mode: t
* tab-width: 8
* End:
* vim: textwidth=78: autoindent: cindent: shiftwidth=2: tabstop=8:
*/

376
lib/fribidi-run.c Normal file
View file

@ -0,0 +1,376 @@
/* FriBidi
* fribidi-run.c - text run data type
*
* $Id: fribidi-run.c,v 1.8 2006-01-31 03:23:13 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:13 $
* $Revision: 1.8 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-run.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include "common.h"
#include <fribidi-bidi-types.h>
#include "run.h"
#include "mem.h"
#include "bidi-types.h"
#if USE_SIMPLE_MALLOC+0
#else
static FriBidiRun *free_runs = NULL;
#endif
FriBidiRun *
new_run (
void
)
{
register FriBidiRun *run;
#if USE_SIMPLE_MALLOC+0
run = fribidi_malloc (sizeof (FriBidiRun));
#else /* !USE_SIMPLE_MALLOC */
if (free_runs)
{
run = free_runs;
free_runs = run->next;
}
else
{
static FriBidiMemChunk *run_mem_chunk = NULL;
if UNLIKELY
(!run_mem_chunk)
run_mem_chunk = fribidi_chunk_new_for_type (FriBidiRun);
if LIKELY
(run_mem_chunk)
run = fribidi_chunk_new (FriBidiRun, run_mem_chunk);
else
run = NULL;
}
#endif /* !USE_SIMPLE_MALLOC */
if LIKELY
(run)
{
run->len = run->pos = run->level = 0;
run->next = run->prev = NULL;
}
return run;
}
void
free_run (
/* input */
FriBidiRun *run
)
{
fribidi_assert (run);
#if USE_SIMPLE_MALLOC+0
fribidi_free (run);
#else /* !USE_SIMPLE_MALLOC */
run->next = free_runs;
free_runs = run;
#endif /* !USE_SIMPLE_MALLOC */
}
FriBidiRun *
new_run_list (
void
)
{
register FriBidiRun *run;
run = new_run ();
if LIKELY
(run)
{
run->type = FRIBIDI_TYPE_SENTINEL;
run->level = FRIBIDI_SENTINEL;
run->pos = FRIBIDI_SENTINEL;
run->len = FRIBIDI_SENTINEL;
run->next = run->prev = run;
}
return run;
}
void
free_run_list (
FriBidiRun *run_list
)
{
if (!run_list)
return;
fribidi_validate_run_list (run_list);
#if USE_SIMPLE_MALLOC+0
{
register FriBidiRun *pp;
pp = run_list;
pp->prev->next = NULL;
while LIKELY
(pp)
{
register FriBidiRun *p;
p = pp;
pp = pp->next;
free_run (p);
};
}
#else /* !USE_SIMPLE_MALLOC */
run_list->prev->next = free_runs;
free_runs = run_list;
#endif /* !USE_SIMPLE_MALLOC */
}
FriBidiRun *
run_list_encode_bidi_types (
/* input */
const FriBidiCharType *bidi_types,
const FriBidiStrIndex len
)
{
FriBidiRun *list, *last;
register FriBidiRun *run = NULL;
FriBidiStrIndex i;
fribidi_assert (bidi_types);
/* Create the list sentinel */
list = new_run_list ();
if UNLIKELY
(!list) return NULL;
last = list;
/* Scan over the character types */
for (i = 0; i < len; i++)
{
register FriBidiCharType char_type = bidi_types[i];
if (char_type != last->type)
{
run = new_run ();
if UNLIKELY
(!run) break;
run->type = char_type;
run->pos = i;
last->len = run->pos - last->pos;
last->next = run;
run->prev = last;
last = run;
}
}
/* Close the circle */
last->len = len - last->pos;
last->next = list;
list->prev = last;
if UNLIKELY
(!run)
{
/* Memory allocation failed */
free_run_list (list);
return NULL;
}
fribidi_validate_run_list (list);
return list;
}
/* override the run list 'base', with the runs in the list 'over', to
reinsert the previously-removed explicit codes (at X9) from
'explicits_list' back into 'type_rl_list' for example. This is used at the
end of I2 to restore the explicit marks, and also to reset the character
types of characters at L1.
it is assumed that the 'pos' of the first element in 'base' list is not
more than the 'pos' of the first element of the 'over' list, and the
'pos' of the last element of the 'base' list is not less than the 'pos'
of the last element of the 'over' list. these two conditions are always
satisfied for the two usages mentioned above.
Note:
frees the over list.
Todo:
use some explanatory names instead of p, q, ...
rewrite comment above to remove references to special usage.
*/
fribidi_boolean
shadow_run_list (
/* input */
FriBidiRun *base,
FriBidiRun *over,
fribidi_boolean preserve_length
)
{
register FriBidiRun *p = base, *q, *r, *s, *t;
register FriBidiStrIndex pos = 0, pos2;
fribidi_boolean status = false;
fribidi_validate_run_list (base);
fribidi_validate_run_list (over);
for_run_list (q, over)
{
if UNLIKELY
(!q->len || q->pos < pos) continue;
pos = q->pos;
while (p->next->type != FRIBIDI_TYPE_SENTINEL && p->next->pos <= pos)
p = p->next;
/* now p is the element that q must be inserted 'in'. */
pos2 = pos + q->len;
r = p;
while (r->next->type != FRIBIDI_TYPE_SENTINEL && r->next->pos < pos2)
r = r->next;
if (preserve_length)
r->len += q->len;
/* now r is the last element that q affects. */
if LIKELY
(p == r)
{
/* split p into at most 3 intervals, and insert q in the place of
the second interval, set r to be the third part. */
/* third part needed? */
if (p->pos + p->len > pos2)
{
r = new_run ();
if UNLIKELY
(!r) goto out;
p->next->prev = r;
r->next = p->next;
r->level = p->level;
r->type = p->type;
r->len = p->pos + p->len - pos2;
r->pos = pos2;
}
else
r = r->next;
if LIKELY
(p->pos + p->len >= pos)
{
/* first part needed? */
if (p->pos < pos)
/* cut the end of p. */
p->len = pos - p->pos;
else
{
t = p;
p = p->prev;
free_run (t);
}
}
}
else
{
if LIKELY
(p->pos + p->len >= pos)
{
/* p needed? */
if (p->pos < pos)
/* cut the end of p. */
p->len = pos - p->pos;
else
p = p->prev;
}
/* r needed? */
if (r->pos + r->len > pos2)
{
/* cut the begining of r. */
r->len = r->pos + r->len - pos2;
r->pos = pos2;
}
else
r = r->next;
/* remove the elements between p and r. */
for (s = p->next; s != r;)
{
t = s;
s = s->next;
free_run (t);
}
}
/* before updating the next and prev runs to point to the inserted q,
we must remember the next element of q in the 'over' list.
*/
t = q;
q = q->prev;
delete_node (t);
p->next = t;
t->prev = p;
t->next = r;
r->prev = t;
}
status = true;
fribidi_validate_run_list (base);
out:
free_run_list (over);
return status;
}
#if DEBUG+0
void
fribidi_validate_run_list (
FriBidiRun *run_list /* input run list */
)
{
register FriBidiRun *q;
fribidi_assert (run_list);
fribidi_assert (run_list->next);
fribidi_assert (run_list->next->prev == run_list);
fribidi_assert (run_list->type == FRIBIDI_TYPE_SENTINEL);
for_run_list (q, run_list)
{
fribidi_assert (q->next);
fribidi_assert (q->next->prev == q);
}
fribidi_assert (q == run_list);
}
#endif /* !DEBUG */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

69
lib/fribidi-shape.c Normal file
View file

@ -0,0 +1,69 @@
/* FriBidi
* fribidi-shape.c - shaping
*
* $Id: fribidi-shape.c,v 1.1 2005-11-03 01:39:01 behdad Exp $
* $Author: behdad $
* $Date: 2005-11-03 01:39:01 $
* $Revision: 1.1 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-shape.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2005 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include "common.h"
#include <fribidi-shape.h>
#include <fribidi-mirroring.h>
#include <fribidi-arabic.h>
FRIBIDI_ENTRY void
fribidi_shape (
/* input */
FriBidiFlags flags,
const FriBidiLevel *embedding_levels,
const FriBidiStrIndex len,
/* input and output */
FriBidiArabicProp *ar_props,
FriBidiChar *str
)
{
if UNLIKELY
(len == 0 || !str) return;
DBG ("in fribidi_shape");
fribidi_assert (embedding_levels);
if (ar_props)
fribidi_shape_arabic (flags, embedding_levels, len, ar_props, str);
if (FRIBIDI_TEST_BITS (flags, FRIBIDI_FLAG_SHAPE_MIRRORING))
fribidi_shape_mirroring (embedding_levels, len, str);
}
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

78
lib/fribidi-shape.h Normal file
View file

@ -0,0 +1,78 @@
/* FriBidi
* fribidi-shape.h - shaping
*
* $Id: fribidi-shape.h,v 1.2 2006-01-14 12:09:29 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-14 12:09:29 $
* $Revision: 1.2 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-shape.h,v $
*
* Author:
* Behdad Esfahbod, 2004, 2005
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2004, 2005 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_SHAPE_H
#define _FRIBIDI_SHAPE_H
#include "fribidi-types.h"
#include "fribidi-flags.h"
#include "fribidi-bidi-types.h"
#include "fribidi-joining-types.h"
#include "fribidi-begindecls.h"
#define fribidi_shape FRIBIDI_NAMESPACE(shape)
/* fribidi_shape - do bidi-aware shaping
*
* This function does all shaping work that depends on the resolved embedding
* levels of the characters. Currently it does mirroring and Arabic shaping,
* but the list may grow in the future. This function is a wrapper around
* fribidi_shape_mirroring and fribidi_shape_arabic.
*
* The flags parameter specifies which shapings are applied. The only flags
* affecting the functionality of this function are those beginning with
* FRIBIDI_FLAG_SHAPE_. Of these, only FRIBIDI_FLAG_SHAPE_MIRRORING is on
* in FRIBIDI_FLAGS_DEFAULT. For details of the Arabic-specific flags see
* fribidi_shape_arabic. If ar_props is NULL, no Arabic shaping is performed.
*
* Feel free to do your own shaping before or after calling this function,
* but you should take care of embedding levels yourself then.
*/
FRIBIDI_ENTRY void fribidi_shape (
FriBidiFlags flags, /* shaping flags */
const FriBidiLevel *embedding_levels, /* input list of embedding
levels, as returned by
fribidi_get_par_embedding_levels */
const FriBidiStrIndex len, /* input string length */
FriBidiArabicProp *ar_props, /* input/output Arabic properties as
* computed by fribidi_join_arabic */
FriBidiChar *str /* string to shape */
);
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_SHAPE_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

162
lib/fribidi-types.h Normal file
View file

@ -0,0 +1,162 @@
/* FriBidi
* fribidi-types.h - define data types for the rest of the library
*
* $Id: fribidi-types.h,v 1.13 2010-02-24 19:40:04 behdad Exp $
* $Author: behdad $
* $Date: 2010-02-24 19:40:04 $
* $Revision: 1.13 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-types.h,v $
*
* Author:
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc.
* Copyright (C) 2001,2002 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_TYPES_H
#define _FRIBIDI_TYPES_H
#include "fribidi-common.h"
#include "fribidi-begindecls.h"
#if FRIBIDI_USE_GLIB+0
# ifndef __FRIBIDI_DOC
# include <glib.h>
# endif /* !__FRIBIDI_DOC */
# define FRIBIDI_INT8_LOCAL gint8
# define FRIBIDI_INT16_LOCAL gint16
# define FRIBIDI_INT32_LOCAL gint32
# define FRIBIDI_UINT8_LOCAL guint8
# define FRIBIDI_UINT16_LOCAL guint16
# define FRIBIDI_UINT32_LOCAL guint32
# define FRIBIDI_BOOLEAN_LOCAL gboolean
# define FRIBIDI_UNICHAR_LOCAL gunichar
#else /* !FRIBIDI_USE_GLIB */
# if defined(HAVE_INTTYPES_H) || defined(HAVE_STDINT_H)
# ifndef __FRIBIDI_DOC
# if HAVE_INTTYPES_H
# include <inttypes.h>
# elif HAVE_STDINT_H
# include <stdint.h>
# endif /* !HAVE_STDINT_H */
# endif /* !__FRIBIDI_DOC */
# define FRIBIDI_INT8_LOCAL int8_t
# define FRIBIDI_INT16_LOCAL int16_t
# define FRIBIDI_INT32_LOCAL int32_t
# define FRIBIDI_UINT8_LOCAL uint8_t
# define FRIBIDI_UINT16_LOCAL uint16_t
# define FRIBIDI_UINT32_LOCAL uint32_t
# else /* no int types */
# define FRIBIDI_INT8_LOCAL signed char
# define FRIBIDI_UINT8_LOCAL unsigned char
# if !defined(FRIBIDI_SIZEOF_INT) || FRIBIDI_SIZEOF_INT >= 4
# define FRIBIDI_INT16_LOCAL signed short
# define FRIBIDI_UINT16_LOCAL unsigned short
# define FRIBIDI_INT32_LOCAL signed int
# define FRIBIDI_UINT32_LOCAL unsigned int
# else /* SIZEOF_INT < 4 */
# define FRIBIDI_INT16_LOCAL signed int
# define FRIBIDI_UINT16_LOCAL unsigned int
# define FRIBIDI_INT32_LOCAL signed long
# define FRIBIDI_UINT32_LOCAL unsigned long
# endif /* SIZEOF_INT < 4 */
# endif /* no int types */
# define FRIBIDI_BOOLEAN_LOCAL int
# if SIZEOF_WCHAR_T >= 4
# ifndef __FRIBIDI_DOC
# if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
# else /* !STDC_HEADERS */
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif /* !HAVE_STDLIB_H */
# endif /* !STDC_HEADERS */
# endif /* !__FRIBIDI_DOC */
# define FRIBIDI_UNICHAR_LOCAL wchar_t
# else /* SIZEOF_WCHAR_T < 4 */
# define FRIBIDI_UNICHAR_LOCAL fribidi_uint32
# endif /* SIZEOF_WCHAR_T < 4 */
#endif /* !FRIBIDI_USE_GLIB */
#if FRIBIDI_INT_TYPES+0
#else
# define FRIBIDI_INT8 FRIBIDI_INT8_LOCAL
# define FRIBIDI_INT16 FRIBIDI_INT16_LOCAL
# define FRIBIDI_INT32 FRIBIDI_INT32_LOCAL
# define FRIBIDI_UINT8 FRIBIDI_UINT8_LOCAL
# define FRIBIDI_UINT16 FRIBIDI_UINT16_LOCAL
# define FRIBIDI_UINT32 FRIBIDI_UINT32_LOCAL
#endif /* !FRIBIDI_INT_TYPES */
#ifndef FRIBIDI_BOOLEAN
# define FRIBIDI_BOOLEAN FRIBIDI_BOOLEAN_LOCAL
#endif /* !FRIBIDI_BOOLEAN */
#ifndef FRIBIDI_UNICHAR
# define FRIBIDI_UNICHAR FRIBIDI_UNICHAR_LOCAL
#endif /* !FRIBIDI_UNICHAR */
#ifndef FRIBIDI_STR_INDEX
# define FRIBIDI_STR_INDEX int
#endif /* FRIBIDI_STR_INDEX */
typedef FRIBIDI_UINT8 fribidi_int8;
typedef FRIBIDI_INT16 fribidi_int16;
typedef FRIBIDI_INT32 fribidi_int32;
typedef FRIBIDI_UINT8 fribidi_uint8;
typedef FRIBIDI_UINT16 fribidi_uint16;
typedef FRIBIDI_UINT32 fribidi_uint32;
typedef FRIBIDI_BOOLEAN fribidi_boolean;
typedef FRIBIDI_UNICHAR FriBidiChar;
typedef FRIBIDI_STR_INDEX FriBidiStrIndex;
#ifndef FRIBIDI_MAX_STRING_LENGTH
# define FRIBIDI_MAX_STRING_LENGTH (sizeof (FriBidiStrIndex) == 2 ? \
0x7FFF : (sizeof (FriBidiStrIndex) == 1 ? \
0x7F : 0x7FFFFFFFL))
#endif
/* A few macros for working with bits */
#define FRIBIDI_TEST_BITS(x, mask) (((x) & (mask)) ? 1 : 0)
#define FRIBIDI_INCLUDE_BITS(x, mask) ((x) | (mask))
#define FRIBIDI_EXCLUDE_BITS(x, mask) ((x) & ~(mask))
#define FRIBIDI_SET_BITS(x, mask) ((x) |= (mask))
#define FRIBIDI_UNSET_BITS(x, mask) ((x) &= ~(mask))
#define FRIBIDI_ADJUST_BITS(x, mask, cond) \
((x) = ((x) & ~(mask)) | ((cond) ? (mask) : 0))
#define FRIBIDI_ADJUST_AND_TEST_BITS(x, mask, cond) \
FRIBIDI_TEST_BITS(FRIBIDI_ADJUST_BITS((x), (mask), (cond)), (mask))
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_TYPES_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

105
lib/fribidi-unicode.h Normal file
View file

@ -0,0 +1,105 @@
/* FriBidi
* fribidi-unicode.h - general Unicode definitions
*
* $Id: fribidi-unicode.h,v 1.7 2006-01-31 03:23:13 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:13 $
* $Revision: 1.7 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-unicode.h,v $
*
* Author:
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_UNICODE_H
#define _FRIBIDI_UNICODE_H
#include "fribidi-common.h"
#include "fribidi-types.h"
#include "fribidi-begindecls.h"
/* We do not support surrogates yet */
#define FRIBIDI_UNICODE_CHARS (sizeof(FriBidiChar) >= 4 ? 0x110000 : 0xFFFE)
/* Unicode version - FRIBIDI_UNICODE_VERSION */
#if DONT_HAVE_FRIBIDI_UNICODE_VERSION_H+0
# define FRIBIDI_UNICODE_VERSION "unknown"
#else /* !DONT_HAVE_FRIBIDI_UNICODE_VERSION_H */
# include "fribidi-unicode-version.h"
#endif /* !DONT_HAVE_FRIBIDI_UNICODE_VERSION_H */
#define fribidi_unicode_version FRIBIDI_NAMESPACE(unicode_version)
/* An string containing the version the Unicode standard implemented,
* in the form of "x.y.z", or "unknown". */
extern const char *fribidi_unicode_version;
/* Unicode Bidirectional Algorithm definitions: */
/* Number of types defined in the bidi algorithm */
#define FRIBIDI_BIDI_NUM_TYPES 19
/* The maximum embedding level value assigned by explicit marks */
#define FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL 61
/* The maximum *number* of different resolved embedding levels: 0-62 */
#define FRIBIDI_BIDI_MAX_RESOLVED_LEVELS 63
/* A few Unicode characters: */
/* Bidirectional marks */
#define FRIBIDI_CHAR_LRM 0x200E
#define FRIBIDI_CHAR_RLM 0x200F
#define FRIBIDI_CHAR_LRE 0x202A
#define FRIBIDI_CHAR_RLE 0x202B
#define FRIBIDI_CHAR_PDF 0x202C
#define FRIBIDI_CHAR_LRO 0x202D
#define FRIBIDI_CHAR_RLO 0x202E
/* Line and Paragraph Separators */
#define FRIBIDI_CHAR_LS 0x2028
#define FRIBIDI_CHAR_PS 0x2029
/* Arabic Joining marks */
#define FRIBIDI_CHAR_ZWNJ 0x200C
#define FRIBIDI_CHAR_ZWJ 0x200D
/* Hebrew and Arabic */
#define FRIBIDI_CHAR_HEBREW_ALEF 0x05D0
#define FRIBIDI_CHAR_ARABIC_ALEF 0x0627
#define FRIBIDI_CHAR_ARABIC_ZERO 0x0660
#define FRIBIDI_CHAR_PERSIAN_ZERO 0x06F0
/* Misc */
#define FRIBIDI_CHAR_ZWNBSP 0xFEFF
/* Char we place for a deleted slot, to delete later */
#define FRIBIDI_CHAR_FILL FRIBIDI_CHAR_ZWNBSP
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_UNICODE_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

105
lib/fribidi.c Normal file
View file

@ -0,0 +1,105 @@
/* FriBidi
* fribidi.c - Unicode bidirectional and Arabic joining/shaping algorithms
*
* $Id: fribidi.c,v 1.18 2006-01-31 03:23:13 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:13 $
* $Revision: 1.18 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi.c,v $
*
* Authors:
* Behdad Esfahbod, 2001, 2002, 2004
* Dov Grobgeld, 1999, 2000
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
* Copyright (C) 1999,2000 Dov Grobgeld
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#include "common.h"
#include <fribidi.h>
#if DEBUG+0
static int flag_debug = false;
#endif
FRIBIDI_ENTRY fribidi_boolean
fribidi_debug_status (
void
)
{
#if DEBUG+0
return flag_debug;
#else
return false;
#endif
}
FRIBIDI_ENTRY fribidi_boolean
fribidi_set_debug (
/* input */
fribidi_boolean state
)
{
#if DEBUG+0
return flag_debug = state;
#else
return false;
#endif
}
const char *fribidi_unicode_version = FRIBIDI_UNICODE_VERSION;
const char *fribidi_version_info =
"(" FRIBIDI_NAME ") " FRIBIDI_VERSION "\n"
"interface version " FRIBIDI_INTERFACE_VERSION_STRING ",\n"
"Unicode Character Database version " FRIBIDI_UNICODE_VERSION ",\n"
"Configure options"
#if DEBUG+0
" --enable-debug"
#endif /* DEBUG */
#if USE_SIMPLE_MALLOC+0
" --enable-malloc"
#endif /* USE_SIMPLE_MALLOC */
#if FRIBIDI_CHARSETS+0
#else
" --disable-charsets"
#endif /* !FRIBIDI_CHARSETS */
#if FRIBIDI_USE_GLIB+0
" --with-glib"
#else /* !FRIBIDI_USE_GLIB */
" --without-glib"
#endif /* !FRIBIDI_USE_GLIB */
".\n\n"
"Copyright (C) 2004 Sharif FarsiWeb, Inc.\n"
"Copyright (C) 2001, 2002, 2004, 2005 Behdad Esfahbod\n"
"Copyright (C) 1999, 2000 Dov Grobgeld\n"
FRIBIDI_NAME " comes with NO WARRANTY, to the extent permitted by law.\n"
"You may redistribute copies of " FRIBIDI_NAME " under\n"
"the terms of the GNU Lesser General Public License.\n"
"For more information about these matters, see the file named COPYING.\n\n"
"Written by Behdad Esfahbod and Dov Grobgeld.\n";
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

26
lib/fribidi.def Normal file
View file

@ -0,0 +1,26 @@
fribidi_debug_status
fribidi_get_bidi_type
fribidi_get_bidi_type_name
fribidi_get_bidi_types
fribidi_get_joining_type
fribidi_get_joining_type_name
fribidi_get_joining_types
fribidi_get_mirror_char
fribidi_get_par_direction
fribidi_get_par_embedding_levels
fribidi_get_type
fribidi_get_type_internal
fribidi_join_arabic
fribidi_log2vis
fribidi_log2vis_get_embedding_levels
fribidi_mirroring_status
fribidi_remove_bidi_marks
fribidi_reorder_line
fribidi_reorder_nsm_status
fribidi_set_debug
fribidi_set_mirroring
fribidi_set_reorder_nsm
fribidi_shape
fribidi_shape_mirroring
fribidi_unicode_version
fribidi_version_info

73
lib/fribidi.h Normal file
View file

@ -0,0 +1,73 @@
/* FriBidi
* fribidi.h - Unicode bidirectional and Arabic joining/shaping algorithms
*
* $Id: fribidi.h,v 1.10 2006-01-31 03:23:13 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:13 $
* $Revision: 1.10 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi.h,v $
*
* Author:
* Behdad Esfahbod, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _FRIBIDI_H
#define _FRIBIDI_H
#include "fribidi-common.h"
#include "fribidi-unicode.h"
#include "fribidi-types.h"
#include "fribidi-flags.h"
#include "fribidi-bidi-types.h"
#include "fribidi-bidi.h"
#include "fribidi-joining-types.h"
#include "fribidi-joining.h"
#include "fribidi-mirroring.h"
#include "fribidi-arabic.h"
#include "fribidi-shape.h"
#if FRIBIDI_CHARSETS+0
# include "fribidi-char-sets.h"
#endif /* FRIBIDI_CHARSETS */
#if FRIBIDI_NO_DEPRECATED+0
#else
# include "fribidi-deprecated.h"
#endif /* !FRIBIDI_NO_DEPRECATED */
#include "fribidi-begindecls.h"
#define fribidi_version_info FRIBIDI_NAMESPACE(version_info)
/* An string containing the version information of the library. */
extern const char *fribidi_version_info;
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

59
lib/joining-types.h Normal file
View file

@ -0,0 +1,59 @@
/* FriBidi
* joining-types.h - define internal joining types
*
* $Id: joining-types.h,v 1.4 2006-01-31 03:23:13 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:13 $
* $Revision: 1.4 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/joining-types.h,v $
*
* Author:
* Behdad Esfahbod, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc.
* Copyright (C) 2004 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _JOINING_TYPES_H
#define _JOINING_TYPES_H
#include "common.h"
#include <fribidi-types.h>
#include <fribidi-joining-types.h>
#include <fribidi-begindecls.h>
#if DEBUG+0
#define fribidi_char_from_joining_type FRIBIDI_PRIVATESPACE(char_from_joining_type)
char
fribidi_char_from_joining_type (
FriBidiJoiningType j, /* input joining type */
fribidi_boolean visual /* in visual context or logical? */
) FRIBIDI_GNUC_HIDDEN;
#endif /* DEBUG */
#include <fribidi-enddecls.h>
#endif /* !_JOINING_TYPES_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

97
lib/mem.h Normal file
View file

@ -0,0 +1,97 @@
/* FriBidi
* mem.h - memory manipulation routines
*
* $Id: mem.h,v 1.7 2006-01-31 03:23:13 behdad Exp $
* $Author: behdad $
* $Date: 2006-01-31 03:23:13 $
* $Revision: 1.7 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/mem.h,v $
*
* Author:
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002 Behdad Esfahbod
*
* 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.1 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, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* For licensing issues, contact <license@farsiweb.info>.
*/
#ifndef _MEM_H
#define _MEM_H
#include "common.h"
#include <fribidi-types.h>
#include <fribidi-begindecls.h>
#if FRIBIDI_USE_GLIB+0
#ifndef __FRIBIDI_DOC
# include <glib.h>
#endif /* !__FRIBIDI_DOC */
#define FriBidiMemChunk GMemChunk
#define FRIBIDI_ALLOC_ONLY G_ALLOC_ONLY
#define fribidi_mem_chunk_new g_mem_chunk_new
#define fribidi_mem_chunk_alloc g_mem_chunk_alloc
#define fribidi_mem_chunk_destroy g_mem_chunk_destroy
#else /* !FRIBIDI_USE_GLIB */
typedef struct _FriBidiMemChunk FriBidiMemChunk;
#define FRIBIDI_ALLOC_ONLY 1
#define fribidi_mem_chunk_new FRIBIDI_PRIVATESPACE(mem_chunk_new)
FriBidiMemChunk *
fribidi_mem_chunk_new (
const char *name,
int atom_size,
unsigned long area_size,
int alloc_type
)
FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_MALLOC FRIBIDI_GNUC_WARN_UNUSED;
#define fribidi_mem_chunk_alloc FRIBIDI_PRIVATESPACE(mem_chunk_alloc)
void *fribidi_mem_chunk_alloc (
FriBidiMemChunk *mem_chunk
)
FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_MALLOC FRIBIDI_GNUC_WARN_UNUSED;
#define fribidi_mem_chunk_destroy FRIBIDI_PRIVATESPACE(mem_chunk_destroy)
void fribidi_mem_chunk_destroy (
FriBidiMemChunk *mem_chunk
) FRIBIDI_GNUC_HIDDEN;
#endif /* !FRIBIDI_USE_GLIB */
#define fribidi_chunk_new(type, chunk) ( \
(type *) fribidi_mem_chunk_alloc (chunk) \
)
#define fribidi_chunk_new_for_type(type) ( \
fribidi_mem_chunk_new(FRIBIDI, sizeof (type), \
FRIBIDI_CHUNK_SIZE, FRIBIDI_ALLOC_ONLY) \
)
#include <fribidi-enddecls.h>
#endif /* !_MEM_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/

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