summaryrefslogtreecommitdiff
path: root/Build/source/libs/graphite
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/graphite')
-rw-r--r--Build/source/libs/graphite/COPYING1
-rw-r--r--Build/source/libs/graphite/INSTALL236
-rw-r--r--Build/source/libs/graphite/Makefile.am62
-rw-r--r--Build/source/libs/graphite/Makefile.in699
-rw-r--r--Build/source/libs/graphite/README32
-rw-r--r--Build/source/libs/graphite/TODO4
-rw-r--r--Build/source/libs/graphite/aclocal.m47533
-rw-r--r--Build/source/libs/graphite/build.bat1
-rw-r--r--Build/source/libs/graphite/build_d.bat1
-rwxr-xr-xBuild/source/libs/graphite/config/config.guess1555
-rwxr-xr-xBuild/source/libs/graphite/config/config.sub1685
-rwxr-xr-xBuild/source/libs/graphite/config/depcomp530
-rwxr-xr-xBuild/source/libs/graphite/config/install-sh519
-rw-r--r--Build/source/libs/graphite/config/ltmain.sh6930
-rwxr-xr-xBuild/source/libs/graphite/config/missing375
-rwxr-xr-xBuild/source/libs/graphite/configure22334
-rw-r--r--Build/source/libs/graphite/configure.ac137
-rw-r--r--Build/source/libs/graphite/debian/changelog174
-rw-r--r--Build/source/libs/graphite/debian/compat1
-rw-r--r--Build/source/libs/graphite/debian/control83
-rw-r--r--Build/source/libs/graphite/debian/copyright259
-rw-r--r--Build/source/libs/graphite/debian/libgraphite-dev.dirs4
-rw-r--r--Build/source/libs/graphite/debian/libgraphite-dev.docs5
-rw-r--r--Build/source/libs/graphite/debian/libgraphite-dev.install4
-rw-r--r--Build/source/libs/graphite/debian/libgraphite3.dirs1
-rw-r--r--Build/source/libs/graphite/debian/libgraphite3.install1
-rw-r--r--Build/source/libs/graphite/debian/libgraphite3.shlibs1
-rwxr-xr-xBuild/source/libs/graphite/debian/rules12
-rw-r--r--Build/source/libs/graphite/doc/GTF_3_0.odtbin0 -> 32225 bytes
-rw-r--r--Build/source/libs/graphite/doc/V2_Engine_Interface.odtbin0 -> 25593 bytes
-rw-r--r--Build/source/libs/graphite/doc/V2_Segment_Interface.odtbin0 -> 29845 bytes
-rw-r--r--Build/source/libs/graphite/doc/V2_TextSource_Interface.odtbin0 -> 21265 bytes
-rw-r--r--Build/source/libs/graphite/doc/hungarian.txt126
-rw-r--r--Build/source/libs/graphite/doc/policy.txt19
-rw-r--r--Build/source/libs/graphite/graphite-engine.ac13
-rw-r--r--Build/source/libs/graphite/include/Makefile.am29
-rw-r--r--Build/source/libs/graphite/include/graphite/BinTree.h71
-rw-r--r--Build/source/libs/graphite/include/graphite/FileFont.h260
-rw-r--r--Build/source/libs/graphite/include/graphite/Font.h416
-rw-r--r--Build/source/libs/graphite/include/graphite/GenericResource.h86
-rw-r--r--Build/source/libs/graphite/include/graphite/GrAppData.h39
-rw-r--r--Build/source/libs/graphite/include/graphite/GrClient.h39
-rw-r--r--Build/source/libs/graphite/include/graphite/GrCommon.h145
-rw-r--r--Build/source/libs/graphite/include/graphite/GrConstants.h268
-rw-r--r--Build/source/libs/graphite/include/graphite/GrData.h226
-rw-r--r--Build/source/libs/graphite/include/graphite/GrDebug.h200
-rw-r--r--Build/source/libs/graphite/include/graphite/GrExt.h13
-rw-r--r--Build/source/libs/graphite/include/graphite/GrFeature.h203
-rw-r--r--Build/source/libs/graphite/include/graphite/GrMstypes.h40
-rw-r--r--Build/source/libs/graphite/include/graphite/GrPlatform.h189
-rw-r--r--Build/source/libs/graphite/include/graphite/GrResult.h171
-rw-r--r--Build/source/libs/graphite/include/graphite/GrStructs.h97
-rw-r--r--Build/source/libs/graphite/include/graphite/GrWrappers.h13
-rw-r--r--Build/source/libs/graphite/include/graphite/GraphiteProcess.h45
-rw-r--r--Build/source/libs/graphite/include/graphite/HashMap.h328
-rw-r--r--Build/source/libs/graphite/include/graphite/IGrEngine.h36
-rw-r--r--Build/source/libs/graphite/include/graphite/IGrJustifier.h58
-rw-r--r--Build/source/libs/graphite/include/graphite/IGraphiteProcess.h44
-rw-r--r--Build/source/libs/graphite/include/graphite/ITextSource.h69
-rw-r--r--Build/source/libs/graphite/include/graphite/MemoryUsage.h156
-rw-r--r--Build/source/libs/graphite/include/graphite/Segment.h627
-rw-r--r--Build/source/libs/graphite/include/graphite/SegmentAux.h392
-rw-r--r--Build/source/libs/graphite/include/graphite/SegmentPainter.h234
-rw-r--r--Build/source/libs/graphite/installed-top.pc.in5
-rw-r--r--Build/source/libs/graphite/license/LICENSING.txt43
-rw-r--r--Build/source/libs/graphite/license/License_CPLv05.txt86
-rw-r--r--Build/source/libs/graphite/license/License_GPLv2.txt342
-rw-r--r--Build/source/libs/graphite/license/License_LGPLv21.txt506
-rw-r--r--Build/source/libs/graphite/makefile.vc814
-rw-r--r--Build/source/libs/graphite/silgraphite.pc.in7
-rw-r--r--Build/source/libs/graphite/src/Makefile.am22
-rw-r--r--Build/source/libs/graphite/src/Makefile.in767
-rw-r--r--Build/source/libs/graphite/src/font/FileFont.cpp429
-rw-r--r--Build/source/libs/graphite/src/font/Font.cpp950
-rw-r--r--Build/source/libs/graphite/src/font/FontTableCache.h52
-rw-r--r--Build/source/libs/graphite/src/font/Makefile.am7
-rw-r--r--Build/source/libs/graphite/src/font/TtfTypes.h388
-rw-r--r--Build/source/libs/graphite/src/font/TtfUtil.cpp1935
-rw-r--r--Build/source/libs/graphite/src/font/TtfUtil.h147
-rw-r--r--Build/source/libs/graphite/src/generic/BinTree.h71
-rw-r--r--Build/source/libs/graphite/src/generic/BinTree_i.cpp225
-rw-r--r--Build/source/libs/graphite/src/generic/Debug.cpp83
-rw-r--r--Build/source/libs/graphite/src/generic/GenericResource.h86
-rw-r--r--Build/source/libs/graphite/src/generic/HashMap.h328
-rw-r--r--Build/source/libs/graphite/src/generic/HashMap_i.cpp561
-rw-r--r--Build/source/libs/graphite/src/generic/Makefile.am8
-rw-r--r--Build/source/libs/graphite/src/generic/Util.cpp261
-rw-r--r--Build/source/libs/graphite/src/painter/Makefile.am5
-rw-r--r--Build/source/libs/graphite/src/painter/SegmentPainter.cpp2986
-rw-r--r--Build/source/libs/graphite/src/segment/FileInput.cpp266
-rw-r--r--Build/source/libs/graphite/src/segment/FileInput.h104
-rw-r--r--Build/source/libs/graphite/src/segment/FontCache.cpp308
-rw-r--r--Build/source/libs/graphite/src/segment/FontCache.h105
-rw-r--r--Build/source/libs/graphite/src/segment/FontFace.cpp598
-rw-r--r--Build/source/libs/graphite/src/segment/FontFace.h246
-rw-r--r--Build/source/libs/graphite/src/segment/GrCharStream.cpp652
-rw-r--r--Build/source/libs/graphite/src/segment/GrCharStream.h183
-rw-r--r--Build/source/libs/graphite/src/segment/GrClassTable.cpp382
-rw-r--r--Build/source/libs/graphite/src/segment/GrClassTable.h188
-rw-r--r--Build/source/libs/graphite/src/segment/GrEngine.cpp2030
-rw-r--r--Build/source/libs/graphite/src/segment/GrEngine.h622
-rw-r--r--Build/source/libs/graphite/src/segment/GrFSM.cpp526
-rw-r--r--Build/source/libs/graphite/src/segment/GrFSM.h245
-rw-r--r--Build/source/libs/graphite/src/segment/GrFeature.cpp321
-rw-r--r--Build/source/libs/graphite/src/segment/GrFeatureValues.h71
-rw-r--r--Build/source/libs/graphite/src/segment/GrGlyphTable.cpp650
-rw-r--r--Build/source/libs/graphite/src/segment/GrGlyphTable.h429
-rw-r--r--Build/source/libs/graphite/src/segment/GrPass.cpp1995
-rw-r--r--Build/source/libs/graphite/src/segment/GrPass.h748
-rw-r--r--Build/source/libs/graphite/src/segment/GrPassActionCode.cpp1492
-rw-r--r--Build/source/libs/graphite/src/segment/GrPseudoMap.h48
-rw-r--r--Build/source/libs/graphite/src/segment/GrSlotState.cpp1481
-rw-r--r--Build/source/libs/graphite/src/segment/GrSlotState.h1287
-rw-r--r--Build/source/libs/graphite/src/segment/GrSlotStream.cpp2368
-rw-r--r--Build/source/libs/graphite/src/segment/GrSlotStream.h577
-rw-r--r--Build/source/libs/graphite/src/segment/GrTableManager.cpp2691
-rw-r--r--Build/source/libs/graphite/src/segment/GrTableManager.h583
-rw-r--r--Build/source/libs/graphite/src/segment/Main.h181
-rw-r--r--Build/source/libs/graphite/src/segment/Makefile.am26
-rw-r--r--Build/source/libs/graphite/src/segment/MemoryUsage.cpp781
-rw-r--r--Build/source/libs/graphite/src/segment/Platform.cpp113
-rw-r--r--Build/source/libs/graphite/src/segment/Segment.cpp3547
-rw-r--r--Build/source/libs/graphite/src/segment/SegmentAux.cpp256
-rw-r--r--Build/source/libs/graphite/src/segment/TestFSM.cpp3416
-rw-r--r--Build/source/libs/graphite/src/segment/TestPasses.cpp1005
-rw-r--r--Build/source/libs/graphite/src/segment/TransductionLog.cpp2091
-rw-r--r--Build/source/libs/graphite/src/segment/XmlTransductionLog.cpp1583
-rw-r--r--Build/source/libs/graphite/src/segment/resource.h15
-rw-r--r--Build/source/libs/graphite/test/Makefile.am2
-rw-r--r--Build/source/libs/graphite/test/Makefile.in478
-rw-r--r--Build/source/libs/graphite/test/ProfileHarness/GrUtfTextSrc.cpp310
-rw-r--r--Build/source/libs/graphite/test/ProfileHarness/GrUtfTextSrc.h146
-rw-r--r--Build/source/libs/graphite/test/ProfileHarness/Makefile.am14
-rw-r--r--Build/source/libs/graphite/test/ProfileHarness/Makefile.in447
-rw-r--r--Build/source/libs/graphite/test/ProfileHarness/ProfileHarness.cpp476
-rw-r--r--Build/source/libs/graphite/test/ProfileHarness/makefile.vc111
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/GrJustifier.cpp566
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/GrJustifier.h82
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/Makefile.am38
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/Makefile.in478
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/Makefile.vc121
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/RegressionTest.cpp748
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/RtTextSrc.h74
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/SimpleTextSrc.cpp93
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/SimpleTextSrc.h113
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/TestCase.cpp1974
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/TestCase.h245
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/arabicText.wpx137
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/bridgingStackingText.wpx158
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/burmeseText.wpx138
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/grtest_arabic.ttfbin0 -> 304748 bytes
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/grtest_badCmap.ttfbin0 -> 1013012 bytes
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/grtest_badVersion.ttfbin0 -> 58160 bytes
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/grtest_burmese.ttfbin0 -> 176660 bytes
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/grtest_roman.ttfbin0 -> 1069592 bytes
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/grtest_taiviet.ttfbin0 -> 115564 bytes
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/grtest_xline.ttfbin0 -> 61132 bytes
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/main.h89
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/makedebug.bat2
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/readme.txt19
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/romanText.wpx206
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/stdafx.cpp8
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/stdafx.h12
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/taivietText.wpx162
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/xline.gdl146
-rw-r--r--Build/source/libs/graphite/test/RegressionTest/xlineText.wpx132
-rw-r--r--Build/source/libs/graphite/test/examples/burmese/Padauk.ttfbin0 -> 232884 bytes
-rw-r--r--Build/source/libs/graphite/test/examples/burmese/bh1.utx4
-rwxr-xr-xBuild/source/libs/graphite/test/examples/khmer/cloudsku2.txt29
-rwxr-xr-xBuild/source/libs/graphite/test/examples/khmer/mond40gr6.ttfbin0 -> 906948 bytes
-rw-r--r--Build/source/libs/graphite/test/fonterrors/errBadGloc.ttfbin0 -> 57988 bytes
-rw-r--r--Build/source/libs/graphite/test/fonterrors/errBadGloc2.ttfbin0 -> 57996 bytes
-rw-r--r--Build/source/libs/graphite/test/fonterrors/errBadPass.ttfbin0 -> 58132 bytes
-rw-r--r--Build/source/libs/graphite/test/fonterrors/errBadStackMachine.ttfbin0 -> 58216 bytes
-rw-r--r--Build/source/libs/graphite/test/fonterrors/errBadSubs.ttfbin0 -> 58132 bytes
-rw-r--r--Build/source/libs/graphite/test/fonterrors/errBadVersion.ttfbin0 -> 58160 bytes
-rw-r--r--Build/source/libs/graphite/test/fonterrors/errGarbageFsm.ttfbin0 -> 58160 bytes
-rw-r--r--Build/source/libs/graphite/test/fonterrors/errGarbageGlat.ttfbin0 -> 58144 bytes
-rw-r--r--Build/source/libs/graphite/test/fonterrors/errGarbageSilf.ttfbin0 -> 58144 bytes
-rw-r--r--Build/source/libs/graphite/test/fonterrors/errSilfVerMismatch.ttfbin0 -> 58252 bytes
-rw-r--r--Build/source/libs/graphite/test/fonterrors/errSubsUnderflow.ttfbin0 -> 58196 bytes
-rw-r--r--Build/source/libs/graphite/test/fonterrors/errTooManyClasses.ttfbin0 -> 58200 bytes
-rw-r--r--Build/source/libs/graphite/test/fonterrors/fonterrors.gdl43
-rw-r--r--Build/source/libs/graphite/test/fonterrors/readme.txt43
-rw-r--r--Build/source/libs/graphite/uninstalled-top.pc.in6
-rw-r--r--Build/source/libs/graphite/withenable.ac4
186 files changed, 101009 insertions, 0 deletions
diff --git a/Build/source/libs/graphite/COPYING b/Build/source/libs/graphite/COPYING
new file mode 100644
index 00000000000..2e009b10e5a
--- /dev/null
+++ b/Build/source/libs/graphite/COPYING
@@ -0,0 +1 @@
+see license/LICENSING.txt
diff --git a/Build/source/libs/graphite/INSTALL b/Build/source/libs/graphite/INSTALL
new file mode 100644
index 00000000000..23e5f25d0e5
--- /dev/null
+++ b/Build/source/libs/graphite/INSTALL
@@ -0,0 +1,236 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
+Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about. Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory. After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script). Here is a another example:
+
+ /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
+configuration-related scripts to be executed by `/bin/bash'.
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
diff --git a/Build/source/libs/graphite/Makefile.am b/Build/source/libs/graphite/Makefile.am
new file mode 100644
index 00000000000..c819a9a33be
--- /dev/null
+++ b/Build/source/libs/graphite/Makefile.am
@@ -0,0 +1,62 @@
+AUTOMAKE_OPTIONS = 1.6
+
+SUBDIRS = src test
+
+EXTRA_DIST = doc license \
+ build.bat build_d.bat makefile.vc \
+ README
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = silgraphite.pc
+
+$(pkgconfig_DATA): config.status
+
+dist-hook:
+ find $(distdir) -name .svn | xargs rm -rf
+
+# VC_VERSION is the last released version of the software
+VC_VERSION = 2.3
+# D_VERSION gets the number of the current svn revision
+D_VERSION = `svnversion ${top_srcdir}|sed -e "s/[0-9]*\://g"`
+SVNDEB_VERSION = $(VC_VERSION)+0$(D_VERSION)svn
+SVNDEBPACKAGE = silgraphite2.0-$(SVNDEB_VERSION)
+SVNORIGTAR = silgraphite2.0_$(SVNDEB_VERSION).orig.tar.gz
+SVNWITH_EPOCH = 1:$(SVNDEB_VERSION)-1
+
+DEB_VERSION = $(VC_VERSION)
+DEBPACKAGE = silgraphite2.0-$(DEB_VERSION)
+ORIGTAR = silgraphite2.0_$(DEB_VERSION).orig.tar.gz
+WITH_EPOCH = 1:$(DEB_VERSION)-1
+
+DISTRIB_CODENAME ?= ${REL_CODENAME}
+
+showcodename:
+ echo "Codename: ${DISTRIB_CODENAME}"
+
+deb-base: dist
+ rm -rf silgraphite2.0*
+ mkdir -p ${SVNDEBPACKAGE}
+ cp ${PACKAGE}-${VERSION}.tar.gz $(SVNDEBPACKAGE)
+ tar cfz $(SVNORIGTAR) $(SVNDEBPACKAGE)
+ cp -a ${top_srcdir}/debian $(SVNDEBPACKAGE)
+ cd ${SVNDEBPACKAGE} && find . -name .svn | xargs rm -rf
+
+# make deb builds an interim deb from svn source for release
+deb: deb-base
+ dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog
+ cd ${SVNDEBPACKAGE} && pdebuild
+
+# make deb-binary-only builds a binary only deb from svn source
+deb-binary-only: deb-base
+ dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog "This is build direct from svn"
+ cd ${SVNDEBPACKAGE} && pdebuild --debbuildopts -i --debbuildopts -b
+
+# make deb-release builds a deb for a released version number
+deb-release: deb-base
+ dch -D ${DISTRIB_CODENAME} -v ${WITH_EPOCH} -c${DEBPACKAGE}/debian/changelog
+ cd ${DEBPACKAGE} && pdebuild
+
+# make deb-local uses debuild to build a deb for local use only
+deb-local: deb-base
+ dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog "This is a debuild direct from svn"
+ cd ${SVNDEBPACKAGE} && debuild -us -uc
diff --git a/Build/source/libs/graphite/Makefile.in b/Build/source/libs/graphite/Makefile.in
new file mode 100644
index 00000000000..a07fdc70a31
--- /dev/null
+++ b/Build/source/libs/graphite/Makefile.in
@@ -0,0 +1,699 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/installed-top.pc.in \
+ $(srcdir)/silgraphite.pc.in $(srcdir)/uninstalled-top.pc.in \
+ $(top_srcdir)/configure COPYING INSTALL TODO \
+ config/config.guess config/config.sub config/depcomp \
+ config/install-sh config/ltmain.sh config/missing
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES = silgraphite.pc silgraphite-uninstalled.pc
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
+pkgconfigDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(pkgconfig_DATA)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LSB_RELEASE = @LSB_RELEASE@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+REL_CODENAME = @REL_CODENAME@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SIZEOF_WCHAR_T = @SIZEOF_WCHAR_T@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AUTOMAKE_OPTIONS = 1.6
+SUBDIRS = src test
+EXTRA_DIST = doc license \
+ build.bat build_d.bat makefile.vc \
+ README
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = silgraphite.pc
+
+# VC_VERSION is the last released version of the software
+VC_VERSION = 2.2.1
+# D_VERSION gets the number of the current svn revision
+D_VERSION = `svnversion ${top_srcdir}|sed -e "s/[0-9]*\://g"`
+SVNDEB_VERSION = $(VC_VERSION)+0$(D_VERSION)svn
+SVNDEBPACKAGE = silgraphite2.0-$(SVNDEB_VERSION)
+SVNORIGTAR = silgraphite2.0_$(SVNDEB_VERSION).orig.tar.gz
+SVNWITH_EPOCH = 1:$(SVNDEB_VERSION)-1
+DEB_VERSION = $(VC_VERSION)
+DEBPACKAGE = silgraphite2.0-$(DEB_VERSION)
+ORIGTAR = silgraphite2.0_$(DEB_VERSION).orig.tar.gz
+WITH_EPOCH = 1:$(DEB_VERSION)-1
+all: all-recursive
+
+.SUFFIXES:
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
+ cd $(srcdir) && $(AUTOMAKE) --foreign \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+silgraphite.pc: $(top_builddir)/config.status $(srcdir)/installed-top.pc.in $(srcdir)/silgraphite.pc.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+silgraphite-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/uninstalled-top.pc.in $(srcdir)/silgraphite.pc.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+install-pkgconfigDATA: $(pkgconfig_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkgconfigdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfigdir)"
+ @list='$(pkgconfig_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
+ $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \
+ done
+
+uninstall-pkgconfigDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgconfig_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ mkdir $(distdir)
+ $(mkdir_p) $(distdir)/. $(distdir)/config
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-hook
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-pkgconfigDATA
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-pkgconfigDATA
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+ check-am clean clean-generic clean-libtool clean-recursive \
+ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
+ dist-hook dist-shar dist-tarZ dist-zip distcheck distclean \
+ distclean-generic distclean-libtool distclean-recursive \
+ distclean-tags distcleancheck distdir distuninstallcheck dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-pkgconfigDATA \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am uninstall-info-am \
+ uninstall-pkgconfigDATA
+
+
+$(pkgconfig_DATA): config.status
+
+dist-hook:
+ find $(distdir) -name .svn | xargs rm -rf
+
+DISTRIB_CODENAME ?= ${REL_CODENAME}
+
+showcodename:
+ echo "Codename: ${DISTRIB_CODENAME}"
+
+deb-base: dist
+ rm -rf silgraphite2.0*
+ mkdir -p ${SVNDEBPACKAGE}
+ cp ${PACKAGE}-${VERSION}.tar.gz $(SVNDEBPACKAGE)
+ tar cfz $(SVNORIGTAR) $(SVNDEBPACKAGE)
+ cp -a ${top_srcdir}/debian $(SVNDEBPACKAGE)
+ cd ${SVNDEBPACKAGE} && find . -name .svn | xargs rm -rf
+
+# make deb builds an interim deb from svn source for release
+deb: deb-base
+ dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog
+ cd ${SVNDEBPACKAGE} && pdebuild
+
+# make deb-binary-only builds a binary only deb from svn source
+deb-binary-only: deb-base
+ dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog "This is build direct from svn"
+ cd ${SVNDEBPACKAGE} && pdebuild --debbuildopts -i --debbuildopts -b
+
+# make deb-release builds a deb for a released version number
+deb-release: deb-base
+ dch -D ${DISTRIB_CODENAME} -v ${WITH_EPOCH} -c${DEBPACKAGE}/debian/changelog
+ cd ${DEBPACKAGE} && pdebuild
+
+# make deb-local uses debuild to build a deb for local use only
+deb-local: deb-base
+ dch -D ${DISTRIB_CODENAME} -v ${SVNWITH_EPOCH} -m -c${SVNDEBPACKAGE}/debian/changelog "This is a debuild direct from svn"
+ cd ${SVNDEBPACKAGE} && debuild -us -uc
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Build/source/libs/graphite/README b/Build/source/libs/graphite/README
new file mode 100644
index 00000000000..41c9cc02b5e
--- /dev/null
+++ b/Build/source/libs/graphite/README
@@ -0,0 +1,32 @@
+ GRAPHITE ENGINE
+
+The Graphite smart-font engine is the bit that takes a Unicode string, font
+formatting information (features, size, etc.) and a font and returns a set
+of positioned glyphs. Graphite also does more than this, in that it can
+handle cursor tracking and interaction with the application for string
+selection, etc.
+
+In order to interact with the application or system, Graphite is embedded in
+an application. You may want to write a custom font and render backend or use one
+of the provided backends in the wrappers project.
+
+The *nix build system uses autoconf and automake including all the
+conventions of those tools. This includes extended support for debug,
+maintenance mode, etc. See the GNU autotools info pages for the appropriate
+tools for help.
+
+If you have checked this source out of the Graphite Subversion repository or
+a similar version control system you will need to generate the autotools
+scripts and files (configure, Makefile.in etc) to do this run:
+
+ autoreconf --install
+
+Please see INSTALL for information on building
+
+NOTE:
+If you modify any configure.in or Makefile.am file you will need rerun
+autoreconf like so:
+
+ autoreconf
+
+For those changes to affect the configure script and makefiles.
diff --git a/Build/source/libs/graphite/TODO b/Build/source/libs/graphite/TODO
new file mode 100644
index 00000000000..146eff85d26
--- /dev/null
+++ b/Build/source/libs/graphite/TODO
@@ -0,0 +1,4 @@
+
+Unprioritised
+
+ * NFD/NFC Pre-processing
diff --git a/Build/source/libs/graphite/aclocal.m4 b/Build/source/libs/graphite/aclocal.m4
new file mode 100644
index 00000000000..039674bb36f
--- /dev/null
+++ b/Build/source/libs/graphite/aclocal.m4
@@ -0,0 +1,7533 @@
+# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(AC_AUTOCONF_VERSION, [2.61a],,
+[m4_warning([this file was generated for autoconf 2.61a.
+You have another version of autoconf. It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+
+# serial 52 AC_PROG_LIBTOOL
+
+
+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -----------------------------------------------------------
+# If this macro is not defined by Autoconf, define it here.
+m4_ifdef([AC_PROVIDE_IFELSE],
+ [],
+ [m4_define([AC_PROVIDE_IFELSE],
+ [m4_ifdef([AC_PROVIDE_$1],
+ [$2], [$3])])])
+
+
+# AC_PROG_LIBTOOL
+# ---------------
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+ AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [AC_LIBTOOL_CXX],
+ [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+ ])])
+dnl And a similar setup for Fortran 77 support
+ AC_PROVIDE_IFELSE([AC_PROG_F77],
+ [AC_LIBTOOL_F77],
+ [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+ AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [ifdef([AC_PROG_GCJ],
+ [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+ ifdef([A][M_PROG_GCJ],
+ [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+ ifdef([LT_AC_PROG_GCJ],
+ [define([LT_AC_PROG_GCJ],
+ defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
+])])# AC_PROG_LIBTOOL
+
+
+# _AC_PROG_LIBTOOL
+# ----------------
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])# _AC_PROG_LIBTOOL
+
+
+# AC_LIBTOOL_SETUP
+# ----------------
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.50)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+AC_LIBTOOL_SYS_MAX_CMD_LEN
+AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+AC_LIBTOOL_OBJDIR
+
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+_LT_AC_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
+
+# Same as above, but do not quote variable references.
+[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+AC_CHECK_TOOL(AR, ar, false)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ AC_PATH_MAGIC
+ fi
+ ;;
+esac
+
+_LT_REQUIRED_DARWIN_CHECKS
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
+
+AC_ARG_ENABLE([libtool-lock],
+ [AC_HELP_STRING([--disable-libtool-lock],
+ [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+AC_ARG_WITH([pic],
+ [AC_HELP_STRING([--with-pic],
+ [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+ [pic_mode="$withval"],
+ [pic_mode=default])
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+AC_LIBTOOL_LANG_C_CONFIG
+_LT_AC_TAGCONFIG
+])# AC_LIBTOOL_SETUP
+
+
+# _LT_AC_SYS_COMPILER
+# -------------------
+AC_DEFUN([_LT_AC_SYS_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_AC_SYS_COMPILER
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
+AC_DEFUN([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+ case $cc_temp in
+ compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+ distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+AC_DEFUN([_LT_COMPILER_BOILERPLATE],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+AC_DEFUN([_LT_LINKER_BOILERPLATE],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# --------------------------
+# Check for some things on darwin
+AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[
+ case $host_os in
+ rhapsody* | darwin*)
+ AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+ AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+
+ AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+ [lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ echo "int foo(void){return 1;}" > conftest.c
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib ${wl}-single_module conftest.c
+ if test -f libconftest.dylib; then
+ lt_cv_apple_cc_single_mod=yes
+ rm -rf libconftest.dylib*
+ fi
+ rm conftest.c
+ fi])
+ AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+ [lt_cv_ld_exported_symbols_list],
+ [lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+ [lt_cv_ld_exported_symbols_list=yes],
+ [lt_cv_ld_exported_symbols_list=no])
+ LDFLAGS="$save_LDFLAGS"
+ ])
+ case $host_os in
+ rhapsody* | darwin1.[[0123]])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*)
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[[012]]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}"
+ fi
+ if test "$DSYMUTIL" != ":"; then
+ _lt_dsymutil="~$DSYMUTIL \$lib || :"
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+])
+
+# _LT_AC_SYS_LIBPATH_AIX
+# ----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_AC_SYS_LIBPATH_AIX
+
+
+# _LT_AC_SHELL_INIT(ARG)
+# ----------------------
+AC_DEFUN([_LT_AC_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+ [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+ [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_AC_SHELL_INIT
+
+
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[_LT_AC_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+ # Remove one level of quotation (which was required for Make).
+ ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+ ;;
+esac
+
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X[$]1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell.
+ exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+[$]*
+EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+ echo_test_string=`eval $cmd` &&
+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+ then
+ break
+ fi
+ done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ if test "X$echo" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ echo='print -r'
+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+ else
+ # Try using printf.
+ echo='printf %s\n'
+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ echo="$CONFIG_SHELL [$]0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$CONFIG_SHELL [$]0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "[$]0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ echo=echo
+ fi
+ fi
+ fi
+ fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+ ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+])])# _LT_AC_PROG_ECHO_BACKSLASH
+
+
+# _LT_AC_LOCK
+# -----------
+AC_DEFUN([_LT_AC_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+ [AC_HELP_STRING([--disable-libtool-lock],
+ [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_LANG_PUSH(C)
+ AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+ AC_LANG_POP])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+sparc*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+ ])
+esac
+
+need_locks="$enable_libtool_lock"
+
+])# _LT_AC_LOCK
+
+
+# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$3"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ fi
+ $rm conftest*
+])
+
+if test x"[$]$2" = xyes; then
+ ifelse([$5], , :, [$5])
+else
+ ifelse([$6], , :, [$6])
+fi
+])# AC_LIBTOOL_COMPILER_OPTION
+
+
+# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [ACTION-SUCCESS], [ACTION-FAILURE])
+# ------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $3"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&AS_MESSAGE_LOG_FD
+ $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ else
+ $2=yes
+ fi
+ fi
+ $rm -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+ ifelse([$4], , :, [$4])
+else
+ ifelse([$5], , :, [$5])
+fi
+])# AC_LIBTOOL_LINKER_OPTION
+
+
+# AC_LIBTOOL_SYS_MAX_CMD_LEN
+# --------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
+[# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+ = "XX$teststring") >/dev/null 2>&1 &&
+ new_result=`expr "X$teststring" : ".*" 2>&1` &&
+ lt_cv_sys_max_cmd_len=$new_result &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on massive
+ # amounts of additional arguments before passing them to the linker.
+ # It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+ AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+ AC_MSG_RESULT(none)
+fi
+])# AC_LIBTOOL_SYS_MAX_CMD_LEN
+
+
+# _LT_AC_CHECK_DLFCN
+# ------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)dnl
+])# _LT_AC_CHECK_DLFCN
+
+
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ---------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+ [$4]
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ exit (status);
+}]
+EOF
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) $1 ;;
+ x$lt_dlneed_uscore) $2 ;;
+ x$lt_dlunknown|x*) $3 ;;
+ esac
+ else :
+ # compilation failed
+ $3
+ fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+
+# AC_LIBTOOL_DLOPEN_SELF
+# ----------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ])
+ ;;
+
+ *)
+ AC_CHECK_FUNC([shl_load],
+ [lt_cv_dlopen="shl_load"],
+ [AC_CHECK_LIB([dld], [shl_load],
+ [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+ [AC_CHECK_FUNC([dlopen],
+ [lt_cv_dlopen="dlopen"],
+ [AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+ [AC_CHECK_LIB([svld], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+ [AC_CHECK_LIB([dld], [dld_link],
+ [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+ ])
+ ])
+ ])
+ ])
+ ])
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ AC_CACHE_CHECK([whether a program can dlopen itself],
+ lt_cv_dlopen_self, [dnl
+ _LT_AC_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+ lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+ ])
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+ lt_cv_dlopen_self_static, [dnl
+ _LT_AC_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+ lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
+ ])
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+])# AC_LIBTOOL_DLOPEN_SELF
+
+
+# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
+# ---------------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler
+AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+ [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+ [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+ $rm -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+ fi
+ fi
+ chmod u+w . 2>&AS_MESSAGE_LOG_FD
+ $rm conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+ $rm out/* && rmdir out
+ cd ..
+ rmdir conftest
+ $rm conftest*
+])
+])# AC_LIBTOOL_PROG_CC_C_O
+
+
+# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
+# -----------------------------------------
+# Check to see if we can do hard links to lock some files if needed
+AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
+[AC_REQUIRE([_LT_AC_LOCK])dnl
+
+hard_links="nottested"
+if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ AC_MSG_CHECKING([if we can lock with hard links])
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ AC_MSG_RESULT([$hard_links])
+ if test "$hard_links" = no; then
+ AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
+
+
+# AC_LIBTOOL_OBJDIR
+# -----------------
+AC_DEFUN([AC_LIBTOOL_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+])# AC_LIBTOOL_OBJDIR
+
+
+# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
+# ----------------------------------------------
+# Check hardcoding attributes.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_AC_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
+ test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
+ test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+ # We can hardcode non-existant directories.
+ if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+ test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
+ # Linking always hardcodes the temporary library directory.
+ _LT_AC_TAGVAR(hardcode_action, $1)=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ _LT_AC_TAGVAR(hardcode_action, $1)=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
+
+
+# AC_LIBTOOL_SYS_LIB_STRIP
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
+[striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+fi
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+fi
+])# AC_LIBTOOL_SYS_LIB_STRIP
+
+
+# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+m4_if($1,[],[
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+ if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+ sys_lib_search_path_spec=`echo $lt_search_path_spec`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[[4-9]]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[[01]] | aix4.[[01]].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[[45]]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $rm \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+ m4_if([$1], [],[
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[[123]]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+interix[[3-9]]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+nto-qnx*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[[89]] | openbsd2.[[89]].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ shlibpath_overrides_runpath=no
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ shlibpath_overrides_runpath=yes
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+AC_CACHE_VAL([lt_cv_sys_lib_search_path_spec],
+[lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"])
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+AC_CACHE_VAL([lt_cv_sys_lib_dlsearch_path_spec],
+[lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"])
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+
+
+# _LT_AC_TAGCONFIG
+# ----------------
+AC_DEFUN([_LT_AC_TAGCONFIG],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_ARG_WITH([tags],
+ [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
+ [include additional configurations @<:@automatic@:>@])],
+ [tagnames="$withval"])
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+ if test ! -f "${ofile}"; then
+ AC_MSG_WARN([output file `$ofile' does not exist])
+ fi
+
+ if test -z "$LTCC"; then
+ eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+ if test -z "$LTCC"; then
+ AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
+ else
+ AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
+ fi
+ fi
+ if test -z "$LTCFLAGS"; then
+ eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+ fi
+
+ # Extract list of available tagged configurations in $ofile.
+ # Note that this assumes the entire list is on one line.
+ available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for tagname in $tagnames; do
+ IFS="$lt_save_ifs"
+ # Check whether tagname contains only valid characters
+ case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
+ "") ;;
+ *) AC_MSG_ERROR([invalid tag name: $tagname])
+ ;;
+ esac
+
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+ then
+ AC_MSG_ERROR([tag name \"$tagname\" already exists])
+ fi
+
+ # Update the list of available tags.
+ if test -n "$tagname"; then
+ echo appending configuration tag \"$tagname\" to $ofile
+
+ case $tagname in
+ CXX)
+ if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_LIBTOOL_LANG_CXX_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ F77)
+ if test -n "$F77" && test "X$F77" != "Xno"; then
+ AC_LIBTOOL_LANG_F77_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ GCJ)
+ if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+ AC_LIBTOOL_LANG_GCJ_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ RC)
+ AC_LIBTOOL_LANG_RC_CONFIG
+ ;;
+
+ *)
+ AC_MSG_ERROR([Unsupported tag name: $tagname])
+ ;;
+ esac
+
+ # Append the new tag name to the list of available tags.
+ if test -n "$tagname" ; then
+ available_tags="$available_tags $tagname"
+ fi
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ # Now substitute the updated list of available tags.
+ if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+ mv "${ofile}T" "$ofile"
+ chmod +x "$ofile"
+ else
+ rm -f "${ofile}T"
+ AC_MSG_ERROR([unable to update list of available tagged configurations.])
+ fi
+fi
+])# _LT_AC_TAGCONFIG
+
+
+# AC_LIBTOOL_DLOPEN
+# -----------------
+# enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN],
+ [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_DLOPEN
+
+
+# AC_LIBTOOL_WIN32_DLL
+# --------------------
+# declare package support for building win32 DLLs
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_WIN32_DLL
+
+
+# AC_ENABLE_SHARED([DEFAULT])
+# ---------------------------
+# implement the --enable-shared flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([shared],
+ [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+ [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
+])# AC_ENABLE_SHARED
+
+
+# AC_DISABLE_SHARED
+# -----------------
+# set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)
+])# AC_DISABLE_SHARED
+
+
+# AC_ENABLE_STATIC([DEFAULT])
+# ---------------------------
+# implement the --enable-static flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([static],
+ [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+ [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_static=]AC_ENABLE_STATIC_DEFAULT)
+])# AC_ENABLE_STATIC
+
+
+# AC_DISABLE_STATIC
+# -----------------
+# set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)
+])# AC_DISABLE_STATIC
+
+
+# AC_ENABLE_FAST_INSTALL([DEFAULT])
+# ---------------------------------
+# implement the --enable-fast-install flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([fast-install],
+ [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+ [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
+])# AC_ENABLE_FAST_INSTALL
+
+
+# AC_DISABLE_FAST_INSTALL
+# -----------------------
+# set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)
+])# AC_DISABLE_FAST_INSTALL
+
+
+# AC_LIBTOOL_PICMODE([MODE])
+# --------------------------
+# implement the --with-pic flag
+# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)
+])# AC_LIBTOOL_PICMODE
+
+
+# AC_PROG_EGREP
+# -------------
+# This is predefined starting with Autoconf 2.54, so this conditional
+# definition can be removed once we require Autoconf 2.54 or later.
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+ [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi])
+ EGREP=$ac_cv_prog_egrep
+ AC_SUBST([EGREP])
+])])
+
+
+# AC_PATH_TOOL_PREFIX
+# -------------------
+# find a file program which can recognize shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] | ?:[\\/]*])
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word. This closes a longstanding sh security hole.
+ ac_dummy="ifelse([$2], , $PATH, [$2])"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$1; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ AC_MSG_RESULT($MAGIC_CMD)
+else
+ AC_MSG_RESULT(no)
+fi
+])# AC_PATH_TOOL_PREFIX
+
+
+# AC_PATH_MAGIC
+# -------------
+# find a file program which can recognize a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+ else
+ MAGIC_CMD=:
+ fi
+fi
+])# AC_PATH_MAGIC
+
+
+# AC_PROG_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH([gnu-ld],
+ [AC_HELP_STRING([--with-gnu-ld],
+ [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+ [test "$withval" = no || with_gnu_ld=yes],
+ [with_gnu_ld=no])
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by $CC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]]* | ?:[[\\/]]*)
+ re_direlt='/[[^/]][[^/]]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])# AC_PROG_LD
+
+
+# AC_PROG_LD_GNU
+# --------------
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# AC_PROG_LD_GNU
+
+
+# AC_PROG_LD_RELOAD_FLAG
+# ----------------------
+# find reload flag for linker
+# -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+ lt_cv_ld_reload_flag,
+ [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+])# AC_PROG_LD_RELOAD_FLAG
+
+
+# AC_DEPLIBS_CHECK_METHOD
+# -----------------------
+# how to check for library dependencies
+# -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[[4-9]]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[[45]]*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ if ( file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[[3-9]]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+nto-qnx*)
+ lt_cv_deplibs_check_method=unknown
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+])# AC_DEPLIBS_CHECK_METHOD
+
+
+# AC_PROG_NM
+# ----------
+# find the pathname to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+])# AC_PROG_NM
+
+
+# AC_CHECK_LIBM
+# -------------
+# check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, cos, LIBM="-lm")
+ ;;
+esac
+])# AC_CHECK_LIBM
+
+
+# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl convenience library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-convenience to the configure arguments. Note that
+# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided,
+# it is assumed to be `libltdl'. LIBLTDL will be prefixed with
+# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
+# (note the single quotes!). If your package is not flat and you're not
+# using automake, define top_builddir and top_srcdir appropriately in
+# the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case $enable_ltdl_convenience in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ # For backwards non-gettext consistent compatibility...
+ INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_CONVENIENCE
+
+
+# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl installable library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-install to the configure arguments. Note that
+# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided,
+# and an installed libltdl is not found, it is assumed to be `libltdl'.
+# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with
+# '${top_srcdir}/' (note the single quotes!). If your package is not
+# flat and you're not using automake, define top_builddir and top_srcdir
+# appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, lt_dlinit,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ else
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ LTDLINCL=
+ fi
+ # For backwards non-gettext consistent compatibility...
+ INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_INSTALLABLE
+
+
+# AC_LIBTOOL_CXX
+# --------------
+# enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX],
+[AC_REQUIRE([_LT_AC_LANG_CXX])
+])# AC_LIBTOOL_CXX
+
+
+# _LT_AC_LANG_CXX
+# ---------------
+AC_DEFUN([_LT_AC_LANG_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
+])# _LT_AC_LANG_CXX
+
+# _LT_AC_PROG_CXXCPP
+# ------------------
+AC_DEFUN([_LT_AC_PROG_CXXCPP],
+[
+AC_REQUIRE([AC_PROG_CXX])
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_PROG_CXXCPP
+fi
+])# _LT_AC_PROG_CXXCPP
+
+# AC_LIBTOOL_F77
+# --------------
+# enable support for Fortran 77 libraries
+AC_DEFUN([AC_LIBTOOL_F77],
+[AC_REQUIRE([_LT_AC_LANG_F77])
+])# AC_LIBTOOL_F77
+
+
+# _LT_AC_LANG_F77
+# ---------------
+AC_DEFUN([_LT_AC_LANG_F77],
+[AC_REQUIRE([AC_PROG_F77])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
+])# _LT_AC_LANG_F77
+
+
+# AC_LIBTOOL_GCJ
+# --------------
+# enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],
+[AC_REQUIRE([_LT_AC_LANG_GCJ])
+])# AC_LIBTOOL_GCJ
+
+
+# _LT_AC_LANG_GCJ
+# ---------------
+AC_DEFUN([_LT_AC_LANG_GCJ],
+[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+ [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+ [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+ [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
+])# _LT_AC_LANG_GCJ
+
+
+# AC_LIBTOOL_RC
+# -------------
+# enable support for Windows resource files
+AC_DEFUN([AC_LIBTOOL_RC],
+[AC_REQUIRE([LT_AC_PROG_RC])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
+])# AC_LIBTOOL_RC
+
+
+# AC_LIBTOOL_LANG_C_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
+AC_DEFUN([_LT_AC_LANG_C_CONFIG],
+[lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF
+
+# Report which library types will actually be built
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_C_CONFIG
+
+
+# AC_LIBTOOL_LANG_CXX_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
+AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
+[AC_LANG_PUSH(C++)
+AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Dependencies to place before and after the object being linked:
+_LT_AC_TAGVAR(predep_objects, $1)=
+_LT_AC_TAGVAR(postdep_objects, $1)=
+_LT_AC_TAGVAR(predeps, $1)=
+_LT_AC_TAGVAR(postdeps, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+ $as_unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+ lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+ $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+else
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+fi
+
+if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+ AC_PROG_LD
+
+ # Check if GNU C++ uses GNU ld as the underlying linker, since the
+ # archiving commands below assume that GNU ld is being used.
+ if test "$with_gnu_ld" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+ # investigate it a little bit more. (MM)
+ wlarc='${wl}'
+
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+ grep 'no-whole-archive' > /dev/null; then
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ with_gnu_ld=no
+ wlarc=
+
+ # A generic and very simple default shared library creation
+ # command for GNU C++ for the case where it uses the native
+ # linker, instead of GNU ld. If possible, this setting should
+ # overridden to take advantage of the native linker features on
+ # the platform it is being used on.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ fi
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+ GXX=no
+ with_gnu_ld=no
+ wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+ for ld_flag in $LDFLAGS; do
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_AC_TAGVAR(archive_cmds, $1)=''
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ if test "$GXX" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ darwin* | rhapsody*)
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+ if test "$GXX" = yes ; then
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+ _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+ fi
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ fi
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ freebsd[[12]]*)
+ # C++ shared libraries reported to be fairly broken before switch to ELF
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ freebsd-elf*)
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ ;;
+ freebsd* | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+ gnu*)
+ ;;
+ hpux9*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*) ;;
+ *)
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ esac
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ interix[[3-9]]*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ # Archives containing C++ object files must be created using
+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+ fi
+ fi
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+ esac
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc*)
+ # Intel C++
+ with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ ;;
+ cxx*)
+ # Compaq C++
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+ runpath_var=LD_RUN_PATH
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+
+ # Not sure whether something based on
+ # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+ # would be better.
+ output_verbose_link_cmd='echo'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ m88k*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ fi
+ # Workaround some broken pre-1.5 toolchains
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+ ;;
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd='echo'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ osf3*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+ echo "-hidden">> $lib.exp~
+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+ $rm $lib.exp'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ psos*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ ;;
+ esac
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ output_verbose_link_cmd='echo'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+ # The C++ compiler must be used to create the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+ ;;
+ *)
+ # GNU C++ compiler with Solaris linker
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+ if $CC --version | grep -v '^2\.7' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+ fi
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ ;;
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ # So that behaviour is only enabled if SCOABSPATH is set to a
+ # non-empty value in the environment. Most likely only useful for
+ # creating official distributions of packages.
+ # This is a hack until libtool officially supports absolute path
+ # names for shared libraries.
+ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+esac
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$GXX"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_POSTDEP_PREDEP($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+])# AC_LIBTOOL_LANG_CXX_CONFIG
+
+# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
+# ------------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library. It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
+int a;
+void foo (void) { a = 0; }
+EOF
+],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+EOF
+],[$1],[F77],[cat > conftest.$ac_ext <<EOF
+ subroutine foo
+ implicit none
+ integer*4 a
+ a=0
+ return
+ end
+EOF
+],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
+public class foo {
+ private int a;
+ public void bar (void) {
+ a = 0;
+ }
+};
+EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+ # Parse the compiler output and extract the necessary
+ # objects, libraries and library flags.
+
+ # Sentinel used to keep track of whether or not we are before
+ # the conftest object file.
+ pre_test_object_deps_done=no
+
+ # The `*' in the case matches for architectures that use `case' in
+ # $output_verbose_cmd can trigger glob expansion during the loop
+ # eval without this substitution.
+ output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+ for p in `eval $output_verbose_link_cmd`; do
+ case $p in
+
+ -L* | -R* | -l*)
+ # Some compilers place space between "-{L,R}" and the path.
+ # Remove the space.
+ if test $p = "-L" \
+ || test $p = "-R"; then
+ prev=$p
+ continue
+ else
+ prev=
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ case $p in
+ -L* | -R*)
+ # Internal compiler library paths should come after those
+ # provided the user. The postdeps already come after the
+ # user supplied libs so there is no need to process them.
+ if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+ else
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+ fi
+ ;;
+ # The "-l" case would never come before the object being
+ # linked, so don't bother handling this case.
+ esac
+ else
+ if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then
+ _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
+ else
+ _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}"
+ fi
+ fi
+ ;;
+
+ *.$objext)
+ # This assumes that the test object file only shows up
+ # once in the compiler output.
+ if test "$p" = "conftest.$objext"; then
+ pre_test_object_deps_done=yes
+ continue
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then
+ _LT_AC_TAGVAR(predep_objects, $1)="$p"
+ else
+ _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
+ fi
+ else
+ if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
+ _LT_AC_TAGVAR(postdep_objects, $1)="$p"
+ else
+ _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$rm -f confest.$objext
+
+_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+ _LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_AC_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+
+# PORTME: override above test on systems where it is broken
+ifelse([$1],[CXX],
+[case $host_os in
+interix[[3-9]]*)
+ # Interix 3.5 installs completely hosed .la files for C++, so rather than
+ # hack all around it, let's just trust "g++" to DTRT.
+ _LT_AC_TAGVAR(predep_objects,$1)=
+ _LT_AC_TAGVAR(postdep_objects,$1)=
+ _LT_AC_TAGVAR(postdeps,$1)=
+ ;;
+
+linux*)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ #
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+
+solaris*)
+ case $cc_basename in
+ CC*)
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ # Adding this requires a known-good setup of shared libraries for
+ # Sun compiler versions before 5.6, else PIC objects from an old
+ # archive will be linked into the output, leading to subtle bugs.
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+esac
+])
+case " $_LT_AC_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+])# AC_LIBTOOL_POSTDEP_PREDEP
+
+# AC_LIBTOOL_LANG_F77_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
+AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
+[AC_REQUIRE([AC_PROG_F77])
+AC_LANG_PUSH(Fortran 77)
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="\
+ subroutine t
+ return
+ end
+"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="\
+ program t
+ end
+"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+_LT_AC_TAGVAR(GCC, $1)="$G77"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_F77_CONFIG
+
+
+# AC_LIBTOOL_LANG_GCJ_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
+AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_GCJ_CONFIG
+
+
+# AC_LIBTOOL_LANG_RC_CONFIG
+# -------------------------
+# Ensure that the configuration vars for the Windows resource compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
+AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_RC_CONFIG
+
+
+# AC_LIBTOOL_CONFIG([TAGNAME])
+# ----------------------------
+# If TAGNAME is not passed, then create an initial libtool script
+# with a default configuration from the untagged config vars. Otherwise
+# add code to config.status for appending the configuration named by
+# TAGNAME from the matching tagged config vars.
+AC_DEFUN([AC_LIBTOOL_CONFIG],
+[# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ _LT_AC_TAGVAR(compiler, $1) \
+ _LT_AC_TAGVAR(CC, $1) \
+ _LT_AC_TAGVAR(LD, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
+ _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
+ _LT_AC_TAGVAR(old_archive_cmds, $1) \
+ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
+ _LT_AC_TAGVAR(predep_objects, $1) \
+ _LT_AC_TAGVAR(postdep_objects, $1) \
+ _LT_AC_TAGVAR(predeps, $1) \
+ _LT_AC_TAGVAR(postdeps, $1) \
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+ _LT_AC_TAGVAR(compiler_lib_search_dirs, $1) \
+ _LT_AC_TAGVAR(archive_cmds, $1) \
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
+ _LT_AC_TAGVAR(postinstall_cmds, $1) \
+ _LT_AC_TAGVAR(postuninstall_cmds, $1) \
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
+ _LT_AC_TAGVAR(allow_undefined_flag, $1) \
+ _LT_AC_TAGVAR(no_undefined_flag, $1) \
+ _LT_AC_TAGVAR(export_symbols_cmds, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
+ _LT_AC_TAGVAR(hardcode_automatic, $1) \
+ _LT_AC_TAGVAR(module_cmds, $1) \
+ _LT_AC_TAGVAR(module_expsym_cmds, $1) \
+ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
+ _LT_AC_TAGVAR(fix_srcfile_path, $1) \
+ _LT_AC_TAGVAR(exclude_expsyms, $1) \
+ _LT_AC_TAGVAR(include_expsyms, $1); do
+
+ case $var in
+ _LT_AC_TAGVAR(old_archive_cmds, $1) | \
+ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
+ _LT_AC_TAGVAR(archive_cmds, $1) | \
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
+ _LT_AC_TAGVAR(module_cmds, $1) | \
+ _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
+ _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\[$]0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
+ ;;
+ esac
+
+ifelse([$1], [],
+ [cfgfile="${ofile}T"
+ trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+ $rm -f "$cfgfile"
+ AC_MSG_NOTICE([creating $ofile])],
+ [cfgfile="$ofile"])
+
+ cat <<__EOF__ >> "$cfgfile"
+ifelse([$1], [],
+[#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# 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 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG],
+[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
+
+# Is the compiler the GNU C compiler?
+with_gcc=$_LT_AC_TAGVAR(GCC, $1)
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
+archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
+module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
+
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
+
+# Symbols that must always be exported.
+include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
+
+ifelse([$1],[],
+[# ### END LIBTOOL CONFIG],
+[# ### END LIBTOOL TAG CONFIG: $tagname])
+
+__EOF__
+
+ifelse([$1],[], [
+ case $host_os in
+ aix3*)
+ cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+EOF
+ ;;
+ esac
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" || \
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+])
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+])# AC_LIBTOOL_CONFIG
+
+
+# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+
+_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+ AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+ lt_cv_prog_compiler_rtti_exceptions,
+ [-fno-rtti -fno-exceptions], [],
+ [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
+
+
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([LT_AC_PROG_SED])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[[BCDT]]'
+ ;;
+cygwin* | mingw* | pw32*)
+ symcode='[[ABCDGISTW]]'
+ ;;
+hpux*) # Its linker distinguishes data from code symbols
+ if test "$host_cpu" = ia64; then
+ symcode='[[ABCDEGRST]]'
+ fi
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ ;;
+linux* | k*bsd*-gnu)
+ if test "$host_cpu" = ia64; then
+ symcode='[[ABCDGIRSTW]]'
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[[BCDEGRST]]'
+ ;;
+osf*)
+ symcode='[[BCDEGQRST]]'
+ ;;
+solaris*)
+ symcode='[[BDRT]]'
+ ;;
+sco3.2v5*)
+ symcode='[[DT]]'
+ ;;
+sysv4.2uw2*)
+ symcode='[[DT]]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[[ABDT]]'
+ ;;
+sysv4)
+ symcode='[[DFNSTU]]'
+ ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+ if AC_TRY_EVAL(ac_compile); then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if grep ' nm_test_var$' "$nlist" >/dev/null; then
+ if grep ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+ cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr_t address;
+}
+lt_preloaded_symbols[[]] =
+{
+EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+ cat <<\EOF >> conftest.$ac_ext
+ {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_save_LIBS="$LIBS"
+ lt_save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS="$lt_save_LIBS"
+ CFLAGS="$lt_save_CFLAGS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ AC_MSG_RESULT(failed)
+else
+ AC_MSG_RESULT(ok)
+fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+
+
+# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
+# ---------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
+[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+ ifelse([$1],[CXX],[
+ # C++ specific cases for pic, static, wl, etc.
+ if test "$GXX" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ mingw* | cygwin* | os2* | pw32*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ m4_if([$1], [GCJ], [],
+ [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+ *djgpp*)
+ # DJGPP does not support shared libraries at all
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ else
+ case $host_os in
+ aix[[4-9]]*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ cxch68*)
+ # Green Hills C++ Compiler
+ # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+ ;;
+ esac
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ esac
+ ;;
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | dragonfly*)
+ # FreeBSD uses GNU C++
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $cc_basename in
+ CC*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ if test "$host_cpu" != ia64; then
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ fi
+ ;;
+ aCC*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ interix*)
+ # This is c89, which is MS Visual C++ (no shared libs)
+ # Anyone wants to do a port?
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case $cc_basename in
+ CC*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ # CC pic flag -KPIC is the default.
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ KCC*)
+ # KAI C++ Compiler
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ icpc* | ecpc*)
+ # Intel C++
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler.
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ cxx*)
+ # Compaq C++
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lynxos*)
+ ;;
+ m88k*)
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ netbsd*)
+ ;;
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ cxx*)
+ # Digital/Compaq C++
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ psos*)
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ lcc*)
+ # Lucid
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ case $cc_basename in
+ CC*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ esac
+ ;;
+ vxworks*)
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+],
+[
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ m4_if([$1], [GCJ], [],
+ [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+
+ interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ enable_shared=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ esac
+ ;;
+
+ mingw* | cygwin* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ m4_if([$1], [GCJ], [],
+ [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC (with -KPIC) is the default.
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ newsos6)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ icc* | ecc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ ccc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All Alpha code is PIC.
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C 5.9
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ *Sun\ F*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=''
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ osf3* | osf4* | osf5*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All OSF/1 code is PIC.
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ rdos*)
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ solaris*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ unicos*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+
+ uts4*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
+ _LT_AC_TAGVAR(lt_cv_prog_compiler_pic_works, $1),
+ [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
+ [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
+ "" | " "*) ;;
+ *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+ esac],
+ [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
+ ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
+AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+ _LT_AC_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+ $lt_tmp_static_flag,
+ [],
+ [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
+])
+
+
+# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
+# ------------------------------------
+# See if the linker supports building shared libraries.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ifelse([$1],[CXX],[
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ case $host_os in
+ aix[[4-9]]*)
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+ ;;
+ cygwin* | mingw*)
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+ ;;
+ *)
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+ _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+],[
+ runpath_var=
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)=
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=no
+ _LT_AC_TAGVAR(module_cmds, $1)=
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)=
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ _LT_AC_TAGVAR(include_expsyms, $1)=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+ extract_expsyms_cmds=
+ # Just being paranoid about ensuring that cc_basename is set.
+ _LT_CC_BASENAME([$compiler])
+ case $host_os in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+ if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>/dev/null` in
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[[3-9]]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ fi
+ ;;
+
+ amigaos*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can't use
+ # them.
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ interix[[3-9]]*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | k*bsd*-gnu)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ tmp_addflag=
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ *)
+ tmp_sharedflag='-shared' ;;
+ esac
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test $supports_anon_versioning = yes; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ $echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+
+ if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then
+ runpath_var=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+ fi
+ ;;
+
+ aix[[4-9]]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_AC_TAGVAR(archive_cmds, $1)=''
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ # see comment about different semantics on the GNU ld section
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ bsdi[[45]]*)
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
+ # FIXME: Should let the user specify the lib program.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ ;;
+
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ fi
+ ;;
+
+ dgux*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ freebsd1*)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ newsos6)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ else
+ case $host_os in
+ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ os2*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ else
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ solaris*)
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+ else
+ wlarc=''
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ ;;
+ motorola)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4.3*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+ # Assume -lc should be added
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $_LT_AC_TAGVAR(archive_cmds, $1) in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+ $rm conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+ pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+ if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+ then
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ else
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+ fi
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $rm conftest*
+ AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
+ ;;
+ esac
+ fi
+ ;;
+esac
+])# AC_LIBTOOL_PROG_LD_SHLIBS
+
+
+# _LT_AC_FILE_LTDLL_C
+# -------------------
+# Be careful that the start marker always follows a newline.
+AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# # ifdef __CYGWIN32__
+# # define __CYGWIN__ __CYGWIN32__
+# # endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+# __hDllInstance_base = hInst;
+# return TRUE;
+# }
+# /* ltdll.c ends here */
+])# _LT_AC_FILE_LTDLL_C
+
+
+# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
+# ---------------------------------
+AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
+
+
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD], [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM], [AC_PROG_NM])
+
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
+
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ AC_SUBST(GCJFLAGS)
+])
+
+AC_DEFUN([LT_AC_PROG_RC],
+[AC_CHECK_TOOL(RC, windres, no)
+])
+
+
+# Cheap backport of AS_EXECUTABLE_P and required macros
+# from Autoconf 2.59; we should not use $as_executable_p directly.
+
+# _AS_TEST_PREPARE
+# ----------------
+m4_ifndef([_AS_TEST_PREPARE],
+[m4_defun([_AS_TEST_PREPARE],
+[if test -x / >/dev/null 2>&1; then
+ as_executable_p='test -x'
+else
+ as_executable_p='test -f'
+fi
+])])# _AS_TEST_PREPARE
+
+# AS_EXECUTABLE_P
+# ---------------
+# Check whether a file is executable.
+m4_ifndef([AS_EXECUTABLE_P],
+[m4_defun([AS_EXECUTABLE_P],
+[AS_REQUIRE([_AS_TEST_PREPARE])dnl
+$as_executable_p $1[]dnl
+])])# AS_EXECUTABLE_P
+
+# NOTE: This macro has been submitted for inclusion into #
+# GNU Autoconf as AC_PROG_SED. When it is available in #
+# a released version of Autoconf we should remove this #
+# macro and use it instead. #
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible. Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for lt_ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then
+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+ fi
+ done
+ done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && continue
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
+ fi
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
+ fi
+ done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])
+
+# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.10'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version. Point them to the right macro.
+m4_if([$1], [1.10.1], [],
+ [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too. Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.10.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 9
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], UPC, [depcc="$UPC" am_compiler_list=],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2008 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 13
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.60])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+ [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+ [_AM_DEPENDENCIES(OBJC)],
+ [define([AC_PROG_OBJC],
+ defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+AC_DEFUN([AM_MAINTAINER_MODE],
+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+ dnl maintainer-mode is disabled by default
+ AC_ARG_ENABLE(maintainer-mode,
+[ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer],
+ USE_MAINTAINER_MODE=$enableval,
+ USE_MAINTAINER_MODE=no)
+ AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+ AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
+ MAINT=$MAINTAINER_MODE_TRUE
+ AC_SUBST(MAINT)dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+ [[\\/$]]* | ?:[[\\/]]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+ [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
diff --git a/Build/source/libs/graphite/build.bat b/Build/source/libs/graphite/build.bat
new file mode 100644
index 00000000000..4c8f6d93999
--- /dev/null
+++ b/Build/source/libs/graphite/build.bat
@@ -0,0 +1 @@
+nmake -f makefile.vc %1 %2 %3 \ No newline at end of file
diff --git a/Build/source/libs/graphite/build_d.bat b/Build/source/libs/graphite/build_d.bat
new file mode 100644
index 00000000000..1f10fb4a8f7
--- /dev/null
+++ b/Build/source/libs/graphite/build_d.bat
@@ -0,0 +1 @@
+nmake CFG=DEBUG -f makefile.vc %1 %2 %3 \ No newline at end of file
diff --git a/Build/source/libs/graphite/config/config.guess b/Build/source/libs/graphite/config/config.guess
new file mode 100755
index 00000000000..e5716eea733
--- /dev/null
+++ b/Build/source/libs/graphite/config/config.guess
@@ -0,0 +1,1555 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# Free Software Foundation, Inc.
+
+timestamp='2009-02-03'
+
+# This file 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 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ sh5el) machine=sh5le-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ *:SolidBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+ eval $set_cc_for_build
+ SUN_ARCH="i386"
+ # If there is a compiler, see if it is configured for 64-bit objects.
+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+ # This test works for both compilers.
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ SUN_ARCH="x86_64"
+ fi
+ fi
+ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+ *:AIX:*:[456])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep __LP64__ >/dev/null
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ *:UNICOS/mp:*:*)
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+ case ${UNAME_MACHINE} in
+ pc98)
+ echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ amd64)
+ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ *)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ esac
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+ *:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+ *:Interix*:[3456]*)
+ case ${UNAME_MACHINE} in
+ x86)
+ echo i586-pc-interix${UNAME_RELEASE}
+ exit ;;
+ EM64T | authenticamd | genuineintel)
+ echo x86_64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ IA64)
+ echo ia64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ esac ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ *:GNU:*:*)
+ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ arm*:Linux:*:*)
+ eval $set_cc_for_build
+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_EABI__
+ then
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ else
+ echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+ fi
+ exit ;;
+ avr32*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ cris:Linux:*:*)
+ echo cris-axis-linux-gnu
+ exit ;;
+ crisv32:Linux:*:*)
+ echo crisv32-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo frv-unknown-linux-gnu
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mipsel
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips64
+ #undef mips64el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mips64el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips64
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ or32:Linux:*:*)
+ echo or32-unknown-linux-gnu
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit ;;
+ padre:Linux:*:*)
+ echo sparc-unknown-linux-gnu
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ vax:Linux:*:*)
+ echo ${UNAME_MACHINE}-dec-linux-gnu
+ exit ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit ;;
+ xtensa*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^LIBC/{
+ s: ::g
+ p
+ }'`"
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit
+ }
+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+ OS_REL='.3'
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
+ echo i586-pc-haiku
+ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-7:SUPER-UX:*:*)
+ echo sx7-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8:SUPER-UX:*:*)
+ echo sx8-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8R:SUPER-UX:*:*)
+ echo sx8r-nec-superux${UNAME_RELEASE}
+ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux${UNAME_RELEASE}
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
+ i*86:rdos:*:*)
+ echo ${UNAME_MACHINE}-pc-rdos
+ exit ;;
+ i*86:AROS:*:*)
+ echo ${UNAME_MACHINE}-pc-aros
+ exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ c34*)
+ echo c34-convex-bsd
+ exit ;;
+ c38*)
+ echo c38-convex-bsd
+ exit ;;
+ c4*)
+ echo c4-convex-bsd
+ exit ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/Build/source/libs/graphite/config/config.sub b/Build/source/libs/graphite/config/config.sub
new file mode 100755
index 00000000000..d546a94b951
--- /dev/null
+++ b/Build/source/libs/graphite/config/config.sub
@@ -0,0 +1,1685 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# Free Software Foundation, Inc.
+
+timestamp='2009-02-03'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file 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 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+ kopensolaris*-gnu* | \
+ storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis | -knuth | -cray)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco6)
+ os=-sco5v6
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+ | bfin \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | fido | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | lm32 \
+ | m32c | m32r | m32rle | m68000 | m68k | m88k \
+ | maxq | mb | microblaze | mcore | mep | metag \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64octeon | mips64octeonel \
+ | mips64orion | mips64orionel \
+ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | mt \
+ | msp430 \
+ | nios | nios2 \
+ | ns16k | ns32k \
+ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | score \
+ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+ | spu | strongarm \
+ | tahoe | thumb | tic4x | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+ | z8k | z80)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+ ms1)
+ basic_machine=mt-unknown
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* | avr32-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | lm32-* \
+ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64octeon-* | mips64octeonel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64r5900-* | mips64r5900el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | mt-* \
+ | msp430-* \
+ | nios-* | nios2-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
+ | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | xstormy16-* | xtensa*-* \
+ | ymp-* \
+ | z8k-* | z80-*)
+ ;;
+ # Recognize the basic CPU types without company name, with glob match.
+ xtensa*)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aros)
+ basic_machine=i386-pc
+ os=-aros
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ blackfin)
+ basic_machine=bfin-unknown
+ os=-linux
+ ;;
+ blackfin-*)
+ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ cegcc)
+ basic_machine=arm-unknown
+ os=-cegcc
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16)
+ basic_machine=cr16-unknown
+ os=-elf
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dicos)
+ basic_machine=i686-pc
+ os=-dicos
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m68knommu)
+ basic_machine=m68k-unknown
+ os=-linux
+ ;;
+ m68knommu-*)
+ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ mingw32ce)
+ basic_machine=arm-unknown
+ os=-mingw32ce
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ ms1-*)
+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ parisc)
+ basic_machine=hppa-unknown
+ os=-linux
+ ;;
+ parisc-*)
+ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pc98)
+ basic_machine=i386-pc
+ ;;
+ pc98-*)
+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rdos)
+ basic_machine=i386-pc
+ os=-rdos
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sde)
+ basic_machine=mipsisa32-sde
+ os=-elf
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sh5el)
+ basic_machine=sh5le-unknown
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tic55x | c55x*)
+ basic_machine=tic55x-unknown
+ os=-coff
+ ;;
+ tic6x | c6x*)
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
+ tile*)
+ basic_machine=tile-unknown
+ os=-linux-gnu
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ z80-*-coff)
+ basic_machine=z80-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -kopensolaris* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* | -aros* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -openbsd* | -solidbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* | -cegcc* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -kaos*)
+ os=-kaos
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -dicos*)
+ os=-dicos
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ score-*)
+ os=-elf
+ ;;
+ spu-*)
+ os=-elf
+ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mep-*)
+ os=-elf
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-haiku)
+ os=-haiku
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/Build/source/libs/graphite/config/depcomp b/Build/source/libs/graphite/config/depcomp
new file mode 100755
index 00000000000..04701da536f
--- /dev/null
+++ b/Build/source/libs/graphite/config/depcomp
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 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., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by `PROGRAMS ARGS'.
+ object Object file output by `PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputing dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+ "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'. On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like `#:fec' to the end of the
+ # dependency line.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> $depfile
+ echo >> $depfile
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> $depfile
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts `$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+ tmpdepfile="$stripped.u"
+ if test "$libtool" = yes; then
+ "$@" -Wc,-M
+ else
+ "$@" -M
+ fi
+ stat=$?
+
+ if test -f "$tmpdepfile"; then :
+ else
+ stripped=`echo "$stripped" | sed 's,^.*/,,'`
+ tmpdepfile="$stripped.u"
+ fi
+
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+
+ if test -f "$tmpdepfile"; then
+ outname="$stripped.o"
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+ sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Intel's C compiler understands `-MD -MF file'. However on
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # ICC 7.0 will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want:
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+ # ICC 7.1 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using \ :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form `foo.o: dependent.h',
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+ sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in `foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mecanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # generates 2 separate objects for the 2 libraries. These two
+ # compilations output dependencies in in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for `:'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+ "$@" $dashmflag |
+ sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no
+ for arg in "$@"; do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix="`echo $object | sed 's/^.*\././'`"
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E |
+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o,
+ # because we must use -o when running libtool.
+ "$@" || exit $?
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ echo " " >> "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/Build/source/libs/graphite/config/install-sh b/Build/source/libs/graphite/config/install-sh
new file mode 100755
index 00000000000..a5897de6ea7
--- /dev/null
+++ b/Build/source/libs/graphite/config/install-sh
@@ -0,0 +1,519 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2006-12-25.00
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" "" $nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -s) stripcmd=$stripprog;;
+
+ -t) dst_arg=$2
+ shift;;
+
+ -T) no_target_directory=true;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dst_arg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst;;
+ esac
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writeable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ -*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ eval "$initialize_posix_glob"
+
+ oIFS=$IFS
+ IFS=/
+ $posix_glob set -f
+ set fnord $dstdir
+ shift
+ $posix_glob set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test -z "$d" && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ $posix_glob set +f &&
+
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/Build/source/libs/graphite/config/ltmain.sh b/Build/source/libs/graphite/config/ltmain.sh
new file mode 100644
index 00000000000..4598ec61ccf
--- /dev/null
+++ b/Build/source/libs/graphite/config/ltmain.sh
@@ -0,0 +1,6930 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# 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 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+basename="s,^.*/,,g"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+progname=`echo "$progpath" | $SED $basename`
+modename="$progname"
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.5.24
+TIMESTAMP=" (1.1220.2.455 2007/06/24 02:13:29)"
+
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell, and then maybe $echo will work.
+ exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit $EXIT_SUCCESS
+fi
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ SP2NL='tr \040 \012'
+ NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ SP2NL='tr \100 \n'
+ NL2SP='tr \r\n \100\100'
+ ;;
+esac
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+ eval "if test \"\${$lt_var+set}\" = set; then
+ save_$lt_var=\$$lt_var
+ $lt_var=C
+ export $lt_var
+ fi"
+done
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" $lt_nl"
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ $echo "$modename: not configured to build any kind of library" 1>&2
+ $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit $EXIT_FAILURE
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+duplicate_deps=no
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+#####################################
+# Shell function definitions:
+# This seems to be the best place for them
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible. If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+ my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+ if test "$run" = ":"; then
+ # Return a directory name, but don't create it in dry-run mode
+ my_tmpdir="${my_template}-$$"
+ else
+
+ # If mktemp works, use that first and foremost
+ my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+ if test ! -d "$my_tmpdir"; then
+ # Failing that, at least try and use $RANDOM to avoid a race
+ my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+ save_mktempdir_umask=`umask`
+ umask 0077
+ $mkdir "$my_tmpdir"
+ umask $save_mktempdir_umask
+ fi
+
+ # If we're not in dry-run mode, bomb out on failure
+ test -d "$my_tmpdir" || {
+ $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
+ exit $EXIT_FAILURE
+ }
+ fi
+
+ $echo "X$my_tmpdir" | $Xsed
+}
+
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid ()
+{
+ win32_libid_type="unknown"
+ win32_fileres=`file -L $1 2>/dev/null`
+ case $win32_fileres in
+ *ar\ archive\ import\ library*) # definitely import
+ win32_libid_type="x86 archive import"
+ ;;
+ *ar\ archive*) # could be an import, or static
+ if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
+ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+ win32_nmres=`eval $NM -f posix -A $1 | \
+ $SED -n -e '1,100{
+ / I /{
+ s,.*,import,
+ p
+ q
+ }
+ }'`
+ case $win32_nmres in
+ import*) win32_libid_type="x86 archive import";;
+ *) win32_libid_type="x86 archive static";;
+ esac
+ fi
+ ;;
+ *DLL*)
+ win32_libid_type="x86 DLL"
+ ;;
+ *executable*) # but shell scripts are "executable" too...
+ case $win32_fileres in
+ *MS\ Windows\ PE\ Intel*)
+ win32_libid_type="x86 DLL"
+ ;;
+ esac
+ ;;
+ esac
+ $echo $win32_libid_type
+}
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+ if test -n "$available_tags" && test -z "$tagname"; then
+ CC_quoted=
+ for arg in $CC; do
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ CC_quoted="$CC_quoted $arg"
+ done
+ case $@ in
+ # Blanks in the command may have been stripped by the calling shell,
+ # but not from the CC environment variable when configure was run.
+ " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
+ # Blanks at the start of $base_compile will cause this to fail
+ # if we don't check for them as well.
+ *)
+ for z in $available_tags; do
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+ CC_quoted=
+ for arg in $CC; do
+ # Double-quote args containing other shell metacharacters.
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ CC_quoted="$CC_quoted $arg"
+ done
+ case "$@ " in
+ " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
+ # The compiler in the base compile command matches
+ # the one in the tagged configuration.
+ # Assume this is the tagged configuration we want.
+ tagname=$z
+ break
+ ;;
+ esac
+ fi
+ done
+ # If $tagname still isn't set, then no tagged configuration
+ # was found and let the user know that the "--tag" command
+ # line option must be used.
+ if test -z "$tagname"; then
+ $echo "$modename: unable to infer tagged configuration"
+ $echo "$modename: specify a tag with \`--tag'" 1>&2
+ exit $EXIT_FAILURE
+# else
+# $echo "$modename: using $tagname tagged configuration"
+ fi
+ ;;
+ esac
+ fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+ f_ex_an_ar_dir="$1"; shift
+ f_ex_an_ar_oldlib="$1"
+
+ $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
+ $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+ if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
+ exit $EXIT_FAILURE
+ fi
+}
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+ my_gentop="$1"; shift
+ my_oldlibs=${1+"$@"}
+ my_oldobjs=""
+ my_xlib=""
+ my_xabs=""
+ my_xdir=""
+ my_status=""
+
+ $show "${rm}r $my_gentop"
+ $run ${rm}r "$my_gentop"
+ $show "$mkdir $my_gentop"
+ $run $mkdir "$my_gentop"
+ my_status=$?
+ if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
+ exit $my_status
+ fi
+
+ for my_xlib in $my_oldlibs; do
+ # Extract the objects.
+ case $my_xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+ *) my_xabs=`pwd`"/$my_xlib" ;;
+ esac
+ my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
+ my_xlib_u=$my_xlib
+ while :; do
+ case " $extracted_archives " in
+ *" $my_xlib_u "*)
+ extracted_serial=`expr $extracted_serial + 1`
+ my_xlib_u=lt$extracted_serial-$my_xlib ;;
+ *) break ;;
+ esac
+ done
+ extracted_archives="$extracted_archives $my_xlib_u"
+ my_xdir="$my_gentop/$my_xlib_u"
+
+ $show "${rm}r $my_xdir"
+ $run ${rm}r "$my_xdir"
+ $show "$mkdir $my_xdir"
+ $run $mkdir "$my_xdir"
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
+ exit $exit_status
+ fi
+ case $host in
+ *-darwin*)
+ $show "Extracting $my_xabs"
+ # Do not bother doing anything if just a dry run
+ if test -z "$run"; then
+ darwin_orig_dir=`pwd`
+ cd $my_xdir || exit $?
+ darwin_archive=$my_xabs
+ darwin_curdir=`pwd`
+ darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
+ darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
+ if test -n "$darwin_arches"; then
+ darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
+ darwin_arch=
+ $show "$darwin_base_archive has multiple architectures $darwin_arches"
+ for darwin_arch in $darwin_arches ; do
+ mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+ cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+ cd "$darwin_curdir"
+ $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+ done # $darwin_arches
+ ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+ darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
+ darwin_file=
+ darwin_files=
+ for darwin_file in $darwin_filelist; do
+ darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+ lipo -create -output "$darwin_file" $darwin_files
+ done # $darwin_filelist
+ ${rm}r unfat-$$
+ cd "$darwin_orig_dir"
+ else
+ cd "$darwin_orig_dir"
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ fi # $darwin_arches
+ fi # $run
+ ;;
+ *)
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ ;;
+ esac
+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+ done
+ func_extract_archives_result="$my_oldobjs"
+}
+# End of Shell function definitions
+#####################################
+
+# Darwin sucks
+eval std_shrext=\"$shrext_cmds\"
+
+disable_libs=no
+
+# Parse our command line options once, thoroughly.
+while test "$#" -gt 0
+do
+ arg="$1"
+ shift
+
+ case $arg in
+ -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ execute_dlfiles)
+ execute_dlfiles="$execute_dlfiles $arg"
+ ;;
+ tag)
+ tagname="$arg"
+ preserve_args="${preserve_args}=$arg"
+
+ # Check whether tagname contains only valid characters
+ case $tagname in
+ *[!-_A-Za-z0-9,/]*)
+ $echo "$progname: invalid tag name: $tagname" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ case $tagname in
+ CC)
+ # Don't test for the "default" C tag, as we know, it's there, but
+ # not specially marked.
+ ;;
+ *)
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
+ taglist="$taglist $tagname"
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
+ else
+ $echo "$progname: ignoring unknown tag $tagname" 1>&2
+ fi
+ ;;
+ esac
+ ;;
+ *)
+ eval "$prev=\$arg"
+ ;;
+ esac
+
+ prev=
+ prevopt=
+ continue
+ fi
+
+ # Have we seen a non-optional argument yet?
+ case $arg in
+ --help)
+ show_help=yes
+ ;;
+
+ --version)
+ echo "\
+$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
+
+Copyright (C) 2007 Free Software Foundation, Inc.
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+ exit $?
+ ;;
+
+ --config)
+ ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
+ # Now print the configurations for the tags.
+ for tagname in $taglist; do
+ ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
+ done
+ exit $?
+ ;;
+
+ --debug)
+ $echo "$progname: enabling shell trace mode"
+ set -x
+ preserve_args="$preserve_args $arg"
+ ;;
+
+ --dry-run | -n)
+ run=:
+ ;;
+
+ --features)
+ $echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ $echo "enable shared libraries"
+ else
+ $echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ $echo "enable static libraries"
+ else
+ $echo "disable static libraries"
+ fi
+ exit $?
+ ;;
+
+ --finish) mode="finish" ;;
+
+ --mode) prevopt="--mode" prev=mode ;;
+ --mode=*) mode="$optarg" ;;
+
+ --preserve-dup-deps) duplicate_deps="yes" ;;
+
+ --quiet | --silent)
+ show=:
+ preserve_args="$preserve_args $arg"
+ ;;
+
+ --tag)
+ prevopt="--tag"
+ prev=tag
+ preserve_args="$preserve_args --tag"
+ ;;
+ --tag=*)
+ set tag "$optarg" ${1+"$@"}
+ shift
+ prev=tag
+ preserve_args="$preserve_args --tag"
+ ;;
+
+ -dlopen)
+ prevopt="-dlopen"
+ prev=execute_dlfiles
+ ;;
+
+ -*)
+ $echo "$modename: unrecognized option \`$arg'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+
+ *)
+ nonopt="$arg"
+ break
+ ;;
+ esac
+done
+
+if test -n "$prevopt"; then
+ $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+fi
+
+case $disable_libs in
+no)
+ ;;
+shared)
+ build_libtool_libs=no
+ build_old_libs=yes
+ ;;
+static)
+ build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+ ;;
+esac
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end. This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+ # Infer the operation mode.
+ if test -z "$mode"; then
+ $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
+ $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
+ case $nonopt in
+ *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
+ mode=link
+ for arg
+ do
+ case $arg in
+ -c)
+ mode=compile
+ break
+ ;;
+ esac
+ done
+ ;;
+ *db | *dbx | *strace | *truss)
+ mode=execute
+ ;;
+ *install*|cp|mv)
+ mode=install
+ ;;
+ *rm)
+ mode=uninstall
+ ;;
+ *)
+ # If we have no mode, but dlfiles were specified, then do execute mode.
+ test -n "$execute_dlfiles" && mode=execute
+
+ # Just use the default operation mode.
+ if test -z "$mode"; then
+ if test -n "$nonopt"; then
+ $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+ else
+ $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+ fi
+ fi
+ ;;
+ esac
+ fi
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$execute_dlfiles" && test "$mode" != execute; then
+ $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$modename --help --mode=$mode' for more information."
+
+ # These modes are in order of execution frequency so that they run quickly.
+ case $mode in
+ # libtool compile mode
+ compile)
+ modename="$modename: compile"
+ # Get the compilation command and the source file.
+ base_compile=
+ srcfile="$nonopt" # always keep a non-empty value in "srcfile"
+ suppress_opt=yes
+ suppress_output=
+ arg_mode=normal
+ libobj=
+ later=
+
+ for arg
+ do
+ case $arg_mode in
+ arg )
+ # do not "continue". Instead, add this to base_compile
+ lastarg="$arg"
+ arg_mode=normal
+ ;;
+
+ target )
+ libobj="$arg"
+ arg_mode=normal
+ continue
+ ;;
+
+ normal )
+ # Accept any command-line options.
+ case $arg in
+ -o)
+ if test -n "$libobj" ; then
+ $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ arg_mode=target
+ continue
+ ;;
+
+ -static | -prefer-pic | -prefer-non-pic)
+ later="$later $arg"
+ continue
+ ;;
+
+ -no-suppress)
+ suppress_opt=no
+ continue
+ ;;
+
+ -Xcompiler)
+ arg_mode=arg # the next one goes into the "base_compile" arg list
+ continue # The current "srcfile" will either be retained or
+ ;; # replaced later. I would guess that would be a bug.
+
+ -Wc,*)
+ args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+ lastarg=
+ save_ifs="$IFS"; IFS=','
+ for arg in $args; do
+ IFS="$save_ifs"
+
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ lastarg="$lastarg $arg"
+ done
+ IFS="$save_ifs"
+ lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+ # Add the arguments to base_compile.
+ base_compile="$base_compile $lastarg"
+ continue
+ ;;
+
+ * )
+ # Accept the current argument as the source file.
+ # The previous "srcfile" becomes the current argument.
+ #
+ lastarg="$srcfile"
+ srcfile="$arg"
+ ;;
+ esac # case $arg
+ ;;
+ esac # case $arg_mode
+
+ # Aesthetically quote the previous argument.
+ lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+ case $lastarg in
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, and some SunOS ksh mistreat backslash-escaping
+ # in scan sets (worked around with variable expansion),
+ # and furthermore cannot handle '|' '&' '(' ')' in scan sets
+ # at all, so we specify them separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ lastarg="\"$lastarg\""
+ ;;
+ esac
+
+ base_compile="$base_compile $lastarg"
+ done # for arg
+
+ case $arg_mode in
+ arg)
+ $echo "$modename: you must specify an argument for -Xcompile"
+ exit $EXIT_FAILURE
+ ;;
+ target)
+ $echo "$modename: you must specify a target with \`-o'" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ *)
+ # Get the name of the library object.
+ [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ xform='[cCFSifmso]'
+ case $libobj in
+ *.ada) xform=ada ;;
+ *.adb) xform=adb ;;
+ *.ads) xform=ads ;;
+ *.asm) xform=asm ;;
+ *.c++) xform=c++ ;;
+ *.cc) xform=cc ;;
+ *.ii) xform=ii ;;
+ *.class) xform=class ;;
+ *.cpp) xform=cpp ;;
+ *.cxx) xform=cxx ;;
+ *.[fF][09]?) xform=[fF][09]. ;;
+ *.for) xform=for ;;
+ *.java) xform=java ;;
+ *.obj) xform=obj ;;
+ esac
+
+ libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+ case $libobj in
+ *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+ *)
+ $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ func_infer_tag $base_compile
+
+ for arg in $later; do
+ case $arg in
+ -static)
+ build_old_libs=yes
+ continue
+ ;;
+
+ -prefer-pic)
+ pic_mode=yes
+ continue
+ ;;
+
+ -prefer-non-pic)
+ pic_mode=no
+ continue
+ ;;
+ esac
+ done
+
+ qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
+ case $qlibobj in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qlibobj="\"$qlibobj\"" ;;
+ esac
+ test "X$libobj" != "X$qlibobj" \
+ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
+ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
+ objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir=
+ else
+ xdir=$xdir/
+ fi
+ lobj=${xdir}$objdir/$objname
+
+ if test -z "$base_compile"; then
+ $echo "$modename: you must specify a compilation command" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $lobj $libobj ${libobj}T"
+ else
+ removelist="$lobj $libobj ${libobj}T"
+ fi
+
+ $run $rm $removelist
+ trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+
+ # On Cygwin there's no "real" PIC flag so we must build both object types
+ case $host_os in
+ cygwin* | mingw* | pw32* | os2*)
+ pic_mode=default
+ ;;
+ esac
+ if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+ # non-PIC code in shared libraries is not supported
+ pic_mode=default
+ fi
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ removelist="$removelist $output_obj $lockfile"
+ trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+ else
+ output_obj=
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until $run ln "$progpath" "$lockfile" 2>/dev/null; do
+ $show "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ $echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+ $echo "$srcfile" > "$lockfile"
+ fi
+
+ if test -n "$fix_srcfile_path"; then
+ eval srcfile=\"$fix_srcfile_path\"
+ fi
+ qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
+ case $qsrcfile in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qsrcfile="\"$qsrcfile\"" ;;
+ esac
+
+ $run $rm "$libobj" "${libobj}T"
+
+ # Create a libtool object file (analogous to a ".la" file),
+ # but don't create it if we're doing a dry run.
+ test -z "$run" && cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ if test "$pic_mode" != no; then
+ command="$base_compile $qsrcfile $pic_flag"
+ else
+ # Don't build PIC code
+ command="$base_compile $qsrcfile"
+ fi
+
+ if test ! -d "${xdir}$objdir"; then
+ $show "$mkdir ${xdir}$objdir"
+ $run $mkdir ${xdir}$objdir
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
+ exit $exit_status
+ fi
+ fi
+
+ if test -z "$output_obj"; then
+ # Place PIC objects in $objdir
+ command="$command -o $lobj"
+ fi
+
+ $run $rm "$lobj" "$output_obj"
+
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ test -n "$output_obj" && $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ # Just move the object if needed, then go on to compile the next one
+ if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+ $show "$mv $output_obj $lobj"
+ if $run $mv $output_obj $lobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Append the name of the PIC object to the libtool object file.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
+
+EOF
+
+ # Allow error messages only from the first compilation.
+ if test "$suppress_opt" = yes; then
+ suppress_output=' >/dev/null 2>&1'
+ fi
+ else
+ # No PIC object so indicate it doesn't exist in the libtool
+ # object file.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object=none
+
+EOF
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ if test "$pic_mode" != yes; then
+ # Don't build PIC code
+ command="$base_compile $qsrcfile"
+ else
+ command="$base_compile $qsrcfile $pic_flag"
+ fi
+ if test "$compiler_c_o" = yes; then
+ command="$command -o $obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ command="$command$suppress_output"
+ $run $rm "$obj" "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ # Just move the object if needed
+ if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+ $show "$mv $output_obj $obj"
+ if $run $mv $output_obj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Append the name of the non-PIC object the libtool object file.
+ # Only append if the libtool object file exists.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
+ else
+ # Append the name of the non-PIC object the libtool object file.
+ # Only append if the libtool object file exists.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
+
+EOF
+ fi
+
+ $run $mv "${libobj}T" "${libobj}"
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ $run $rm "$lockfile"
+ fi
+
+ exit $EXIT_SUCCESS
+ ;;
+
+ # libtool link mode
+ link | relink)
+ modename="$modename: link"
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invocation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ libtool_args="$nonopt"
+ base_compile="$nonopt $@"
+ compile_command="$nonopt"
+ finalize_command="$nonopt"
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ old_deplibs=
+ compiler_flags=
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
+ inst_prefix_dir=
+
+ avoid_version=no
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ ltlibs=
+ module=no
+ no_install=no
+ objs=
+ non_pic_objects=
+ notinst_path= # paths that contain not-installed libtool libraries
+ precious_files_regex=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+ vinfo_number=no
+
+ func_infer_tag $base_compile
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case $arg in
+ -all-static | -static | -static-libtool-libs)
+ case $arg in
+ -all-static)
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ ;;
+ -static)
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=built
+ ;;
+ -static-libtool-libs)
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ ;;
+ esac
+ build_libtool_libs=no
+ build_old_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test "$#" -gt 0; do
+ arg="$1"
+ shift
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+ ;;
+ *) qarg=$arg ;;
+ esac
+ libtool_args="$libtool_args $qarg"
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ output)
+ compile_command="$compile_command @OUTPUT@"
+ finalize_command="$finalize_command @OUTPUT@"
+ ;;
+ esac
+
+ case $prev in
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ compile_command="$compile_command @SYMFILE@"
+ finalize_command="$finalize_command @SYMFILE@"
+ preload=yes
+ fi
+ case $arg in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ else
+ dlprefiles="$dlprefiles $arg"
+ fi
+ prev=
+ continue
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ if test ! -f "$arg"; then
+ $echo "$modename: symbol file \`$arg' does not exist"
+ exit $EXIT_FAILURE
+ fi
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ inst_prefix)
+ inst_prefix_dir="$arg"
+ prev=
+ continue
+ ;;
+ precious_regex)
+ precious_files_regex="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ objectlist)
+ if test -f "$arg"; then
+ save_arg=$arg
+ moreargs=
+ for fil in `cat $save_arg`
+ do
+# moreargs="$moreargs $fil"
+ arg=$fil
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ # If there is no directory component, then add one.
+ case $arg in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
+
+ if test -z "$pic_object" || \
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none && \
+ test "$non_pic_object" = none; then
+ $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ dlfiles="$dlfiles $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ libobjs="$libobjs $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if test -z "$run"; then
+ $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+ exit $EXIT_FAILURE
+ else
+ # Dry-run case.
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+ non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+ libobjs="$libobjs $pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ fi
+ done
+ else
+ $echo "$modename: link input file \`$save_arg' does not exist"
+ exit $EXIT_FAILURE
+ fi
+ arg=$save_arg
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case $arg in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) rpath="$rpath $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) xrpath="$xrpath $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ xcompiler)
+ compiler_flags="$compiler_flags $qarg"
+ prev=
+ compile_command="$compile_command $qarg"
+ finalize_command="$finalize_command $qarg"
+ continue
+ ;;
+ xlinker)
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $wl$qarg"
+ prev=
+ compile_command="$compile_command $wl$qarg"
+ finalize_command="$finalize_command $wl$qarg"
+ continue
+ ;;
+ xcclinker)
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $qarg"
+ prev=
+ compile_command="$compile_command $qarg"
+ finalize_command="$finalize_command $qarg"
+ continue
+ ;;
+ shrext)
+ shrext_cmds="$arg"
+ prev=
+ continue
+ ;;
+ darwin_framework|darwin_framework_skip)
+ test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ prev=
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi # test -n "$prev"
+
+ prevarg="$arg"
+
+ case $arg in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+ continue
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: more than one -exported-symbols argument is not allowed"
+ exit $EXIT_FAILURE
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -framework|-arch|-isysroot)
+ case " $CC " in
+ *" ${arg} ${1} "* | *" ${arg} ${1} "*)
+ prev=darwin_framework_skip ;;
+ *) compiler_flags="$compiler_flags $arg"
+ prev=darwin_framework ;;
+ esac
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ continue
+ ;;
+
+ -inst-prefix-dir)
+ prev=inst_prefix
+ continue
+ ;;
+
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+ case $with_gcc/$host in
+ no/*-*-irix* | /*-*-irix*)
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ ;;
+ esac
+ continue
+ ;;
+
+ -L*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+ absdir="$dir"
+ notinst_path="$notinst_path $dir"
+ fi
+ dir="$absdir"
+ ;;
+ esac
+ case "$deplibs " in
+ *" -L$dir "*) ;;
+ *)
+ deplibs="$deplibs -L$dir"
+ lib_search_path="$lib_search_path $dir"
+ ;;
+ esac
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$dir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$dir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$testbindir";;
+ esac
+ ;;
+ esac
+ continue
+ ;;
+
+ -l*)
+ if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
+ # These systems don't actually have a C or math library (as such)
+ continue
+ ;;
+ *-*-os2*)
+ # These systems don't actually have a C library (as such)
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C and math libraries are in the System framework
+ deplibs="$deplibs -framework System"
+ continue
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ test "X$arg" = "X-lc" && continue
+ ;;
+ esac
+ elif test "X$arg" = "X-lc_r"; then
+ case $host in
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc_r directly, use -pthread flag.
+ continue
+ ;;
+ esac
+ fi
+ deplibs="$deplibs $arg"
+ continue
+ ;;
+
+ # Tru64 UNIX uses -model [arg] to determine the layout of C++
+ # classes, name mangling, and exception handling.
+ -model)
+ compile_command="$compile_command $arg"
+ compiler_flags="$compiler_flags $arg"
+ finalize_command="$finalize_command $arg"
+ prev=xcompiler
+ continue
+ ;;
+
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+ compiler_flags="$compiler_flags $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ continue
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+ # -r[0-9][0-9]* specifies the processor on the SGI compiler
+ # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+ # +DA*, +DD* enable 64-bit mode on the HP compiler
+ # -q* pass through compiler args for the IBM compiler
+ # -m* pass through architecture-specific compiler args for GCC
+ # -m*, -t[45]*, -txscale* pass through architecture-specific
+ # compiler args for GCC
+ # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
+ # -F/path gives path to uninstalled frameworks, gcc on darwin
+ # @file GCC response files
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
+
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ compiler_flags="$compiler_flags $arg"
+ continue
+ ;;
+
+ -shrext)
+ prev=shrext
+ continue
+ ;;
+
+ -no-fast-install)
+ fast_install=no
+ continue
+ ;;
+
+ -no-install)
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
+ # The PATH hackery in wrapper scripts is required on Windows
+ # and Darwin in order for the loader to find any dlls it needs.
+ $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+ $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+ fast_install=no
+ ;;
+ *) no_install=yes ;;
+ esac
+ continue
+ ;;
+
+ -no-undefined)
+ allow_undefined=no
+ continue
+ ;;
+
+ -objectlist)
+ prev=objectlist
+ continue
+ ;;
+
+ -o) prev=output ;;
+
+ -precious-files-regex)
+ prev=precious_regex
+ continue
+ ;;
+
+ -release)
+ prev=release
+ continue
+ ;;
+
+ -rpath)
+ prev=rpath
+ continue
+ ;;
+
+ -R)
+ prev=xrpath
+ continue
+ ;;
+
+ -R*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ continue
+ ;;
+
+ -static | -static-libtool-libs)
+ # The effects of -static are defined in a previous loop.
+ # We used to do the same as -all-static on platforms that
+ # didn't have a PIC flag, but the assumption that the effects
+ # would be equivalent was wrong. It would break on at least
+ # Digital Unix and AIX.
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+ -version-number)
+ prev=vinfo
+ vinfo_number=yes
+ continue
+ ;;
+
+ -Wc,*)
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ case $flag in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ flag="\"$flag\""
+ ;;
+ esac
+ arg="$arg $wl$flag"
+ compiler_flags="$compiler_flags $flag"
+ done
+ IFS="$save_ifs"
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ ;;
+
+ -Wl,*)
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ case $flag in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ flag="\"$flag\""
+ ;;
+ esac
+ arg="$arg $wl$flag"
+ compiler_flags="$compiler_flags $wl$flag"
+ linker_flags="$linker_flags $flag"
+ done
+ IFS="$save_ifs"
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ ;;
+
+ -Xcompiler)
+ prev=xcompiler
+ continue
+ ;;
+
+ -Xlinker)
+ prev=xlinker
+ continue
+ ;;
+
+ -XCClinker)
+ prev=xcclinker
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+
+ *.$objext)
+ # A standard object.
+ objs="$objs $arg"
+ ;;
+
+ *.lo)
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ # If there is no directory component, then add one.
+ case $arg in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
+
+ if test -z "$pic_object" || \
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none && \
+ test "$non_pic_object" = none; then
+ $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ dlfiles="$dlfiles $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ libobjs="$libobjs $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if test -z "$run"; then
+ $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+ exit $EXIT_FAILURE
+ else
+ # Dry-run case.
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+ non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+ libobjs="$libobjs $pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ fi
+ ;;
+
+ *.$libext)
+ # An archive.
+ deplibs="$deplibs $arg"
+ old_deplibs="$old_deplibs $arg"
+ continue
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ if test "$prev" = dlfiles; then
+ # This library was specified with -dlopen.
+ dlfiles="$dlfiles $arg"
+ prev=
+ elif test "$prev" = dlprefiles; then
+ # The library was specified with -dlpreopen.
+ dlprefiles="$dlprefiles $arg"
+ prev=
+ else
+ deplibs="$deplibs $arg"
+ fi
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+ esac # arg
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+ done # argument parsing loop
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+
+ oldlibs=
+ # calculate the name of the file, without its directory
+ outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+ libobjs_save="$libobjs"
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+ else
+ shlib_search_path=
+ fi
+ eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+ # Create the object directory.
+ if test ! -d "$output_objdir"; then
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
+ exit $exit_status
+ fi
+ fi
+
+ # Determine the type of output
+ case $output in
+ "")
+ $echo "$modename: you must specify an output file" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ *.$libext) linkmode=oldlib ;;
+ *.lo | *.$objext) linkmode=obj ;;
+ *.la) linkmode=lib ;;
+ *) linkmode=prog ;; # Anything else should be a program.
+ esac
+
+ case $host in
+ *cygwin* | *mingw* | *pw32*)
+ # don't eliminate duplications in $postdeps and $predeps
+ duplicate_compiler_generated_deps=yes
+ ;;
+ *)
+ duplicate_compiler_generated_deps=$duplicate_deps
+ ;;
+ esac
+ specialdeplibs=
+
+ libs=
+ # Find all interdependent deplibs by searching for libraries
+ # that are linked more than once (e.g. -la -lb -la)
+ for deplib in $deplibs; do
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ libs="$libs $deplib"
+ done
+
+ if test "$linkmode" = lib; then
+ libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+ # Compute libraries that are listed more than once in $predeps
+ # $postdeps and mark them as special (i.e., whose duplicates are
+ # not to be eliminated).
+ pre_post_deps=
+ if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
+ for pre_post_dep in $predeps $postdeps; do
+ case "$pre_post_deps " in
+ *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+ esac
+ pre_post_deps="$pre_post_deps $pre_post_dep"
+ done
+ fi
+ pre_post_deps=
+ fi
+
+ deplibs=
+ newdependency_libs=
+ newlib_search_path=
+ need_relink=no # whether we're linking any uninstalled libtool libraries
+ notinst_deplibs= # not-installed libtool libraries
+ case $linkmode in
+ lib)
+ passes="conv link"
+ for file in $dlfiles $dlprefiles; do
+ case $file in
+ *.la) ;;
+ *)
+ $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ done
+ ;;
+ prog)
+ compile_deplibs=
+ finalize_deplibs=
+ alldeplibs=no
+ newdlfiles=
+ newdlprefiles=
+ passes="conv scan dlopen dlpreopen link"
+ ;;
+ *) passes="conv"
+ ;;
+ esac
+ for pass in $passes; do
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan"; then
+ libs="$deplibs"
+ deplibs=
+ fi
+ if test "$linkmode" = prog; then
+ case $pass in
+ dlopen) libs="$dlfiles" ;;
+ dlpreopen) libs="$dlprefiles" ;;
+ link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+ esac
+ fi
+ if test "$pass" = dlopen; then
+ # Collect dlpreopened libraries
+ save_deplibs="$deplibs"
+ deplibs=
+ fi
+ for deplib in $libs; do
+ lib=
+ found=no
+ case $deplib in
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ compiler_flags="$compiler_flags $deplib"
+ fi
+ continue
+ ;;
+ -l*)
+ if test "$linkmode" != lib && test "$linkmode" != prog; then
+ $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
+ continue
+ fi
+ name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+ for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ for search_ext in .la $std_shrext .so .a; do
+ # Search the libtool library
+ lib="$searchdir/lib${name}${search_ext}"
+ if test -f "$lib"; then
+ if test "$search_ext" = ".la"; then
+ found=yes
+ else
+ found=no
+ fi
+ break 2
+ fi
+ done
+ done
+ if test "$found" != yes; then
+ # deplib doesn't seem to be a libtool library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ else # deplib is a libtool library
+ # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+ # We need to do some special things here, and not later.
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $deplib "*)
+ if (${SED} -e '2q' $lib |
+ grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ library_names=
+ old_library=
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ for l in $old_library $library_names; do
+ ll="$l"
+ done
+ if test "X$ll" = "X$old_library" ; then # only static version available
+ found=no
+ ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$ladir" = "X$lib" && ladir="."
+ lib=$ladir/$old_library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ fi
+ fi
+ ;;
+ *) ;;
+ esac
+ fi
+ fi
+ ;; # -l
+ -L*)
+ case $linkmode in
+ lib)
+ deplibs="$deplib $deplibs"
+ test "$pass" = conv && continue
+ newdependency_libs="$deplib $newdependency_libs"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ ;;
+ prog)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ if test "$pass" = scan; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ ;;
+ *)
+ $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
+ ;;
+ esac # linkmode
+ continue
+ ;; # -L
+ -R*)
+ if test "$pass" = link; then
+ dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+ # Make sure the xrpath contains only unique directories.
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ fi
+ deplibs="$deplib $deplibs"
+ continue
+ ;;
+ *.la) lib="$deplib" ;;
+ *.$libext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ case $linkmode in
+ lib)
+ valid_a_lib=no
+ case $deplibs_check_method in
+ match_pattern*)
+ set dummy $deplibs_check_method
+ match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ if eval $echo \"$deplib\" 2>/dev/null \
+ | $SED 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ valid_a_lib=yes
+ fi
+ ;;
+ pass_all)
+ valid_a_lib=yes
+ ;;
+ esac
+ if test "$valid_a_lib" != yes; then
+ $echo
+ $echo "*** Warning: Trying to link with static lib archive $deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because the file extensions .$libext of this argument makes me believe"
+ $echo "*** that it is just a static archive that I should not used here."
+ else
+ $echo
+ $echo "*** Warning: Linking the shared library $output against the"
+ $echo "*** static library $deplib is not portable!"
+ deplibs="$deplib $deplibs"
+ fi
+ continue
+ ;;
+ prog)
+ if test "$pass" != link; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ continue
+ ;;
+ esac # linkmode
+ ;; # *.$libext
+ *.lo | *.$objext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ elif test "$linkmode" = prog; then
+ if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlopen support or we're linking statically,
+ # we need to preload.
+ newdlprefiles="$newdlprefiles $deplib"
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ newdlfiles="$newdlfiles $deplib"
+ fi
+ fi
+ continue
+ ;;
+ %DEPLIBS%)
+ alldeplibs=yes
+ continue
+ ;;
+ esac # case $deplib
+ if test "$found" = yes || test -f "$lib"; then :
+ else
+ $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$ladir" = "X$lib" && ladir="."
+
+ dlname=
+ dlopen=
+ dlpreopen=
+ libdir=
+ library_names=
+ old_library=
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variables installed, or shouldnotlink
+ installed=yes
+ shouldnotlink=no
+ avoidtemprpath=
+
+
+ # Read the .la file
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan" ||
+ { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+ test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+ test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+ fi
+
+ if test "$pass" = conv; then
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ if test -z "$libdir"; then
+ if test -z "$old_library"; then
+ $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ # It is a libtool convenience library, so add in its objects.
+ convenience="$convenience $ladir/$objdir/$old_library"
+ old_convenience="$old_convenience $ladir/$objdir/$old_library"
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done
+ elif test "$linkmode" != prog && test "$linkmode" != lib; then
+ $echo "$modename: \`$lib' is not a convenience library" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ continue
+ fi # $pass = conv
+
+
+ # Get the name of the library we link against.
+ linklib=
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+ if test -z "$linklib"; then
+ $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # This library was specified with -dlopen.
+ if test "$pass" = dlopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ if test -z "$dlname" ||
+ test "$dlopen_support" != yes ||
+ test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking
+ # statically, we need to preload. We also need to preload any
+ # dependent libraries so libltdl's deplib preloader doesn't
+ # bomb out in the load deplibs phase.
+ dlprefiles="$dlprefiles $lib $dependency_libs"
+ else
+ newdlfiles="$newdlfiles $lib"
+ fi
+ continue
+ fi # $pass = dlopen
+
+ # We need an absolute path.
+ case $ladir in
+ [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+ *)
+ abs_ladir=`cd "$ladir" && pwd`
+ if test -z "$abs_ladir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ abs_ladir="$ladir"
+ fi
+ ;;
+ esac
+ laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+ # Find the relevant object directory and library name.
+ if test "X$installed" = Xyes; then
+ if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ $echo "$modename: warning: library \`$lib' was moved." 1>&2
+ dir="$ladir"
+ absdir="$abs_ladir"
+ libdir="$abs_ladir"
+ else
+ dir="$libdir"
+ absdir="$libdir"
+ fi
+ test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+ else
+ if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ dir="$ladir"
+ absdir="$abs_ladir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ else
+ dir="$ladir/$objdir"
+ absdir="$abs_ladir/$objdir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ fi
+ fi # $installed = yes
+ name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+ # This library was specified with -dlpreopen.
+ if test "$pass" = dlpreopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ newdlprefiles="$newdlprefiles $dir/$old_library"
+ # Otherwise, use the dlname, so that lt_dlopen finds it.
+ elif test -n "$dlname"; then
+ newdlprefiles="$newdlprefiles $dir/$dlname"
+ else
+ newdlprefiles="$newdlprefiles $dir/$linklib"
+ fi
+ fi # $pass = dlpreopen
+
+ if test -z "$libdir"; then
+ # Link the convenience library
+ if test "$linkmode" = lib; then
+ deplibs="$dir/$old_library $deplibs"
+ elif test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$dir/$old_library $compile_deplibs"
+ finalize_deplibs="$dir/$old_library $finalize_deplibs"
+ else
+ deplibs="$lib $deplibs" # used for prog,scan pass
+ fi
+ continue
+ fi
+
+
+ if test "$linkmode" = prog && test "$pass" != link; then
+ newlib_search_path="$newlib_search_path $ladir"
+ deplibs="$lib $deplibs"
+
+ linkalldeplibs=no
+ if test "$link_all_deplibs" != no || test -z "$library_names" ||
+ test "$build_libtool_libs" = no; then
+ linkalldeplibs=yes
+ fi
+
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+ esac
+ # Need to link against all dependency_libs?
+ if test "$linkalldeplibs" = yes; then
+ deplibs="$deplib $deplibs"
+ else
+ # Need to hardcode shared library paths
+ # or/and link against static libraries
+ newdependency_libs="$deplib $newdependency_libs"
+ fi
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done # for deplib
+ continue
+ fi # $linkmode = prog...
+
+ if test "$linkmode,$pass" = "prog,link"; then
+ if test -n "$library_names" &&
+ { { test "$prefer_static_libs" = no ||
+ test "$prefer_static_libs,$installed" = "built,yes"; } ||
+ test -z "$old_library"; }; then
+ # We need to hardcode the library path
+ if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath " in
+ *" $dir "*) ;;
+ *" $absdir "*) ;;
+ *) temp_rpath="$temp_rpath $absdir" ;;
+ esac
+ fi
+
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+ fi # $linkmode,$pass = prog,link...
+
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+ test -n "$library_names"; }; }; then
+ # We only need to search for static libraries
+ continue
+ fi
+ fi
+
+ link_static=no # Whether the deplib will be linked statically
+ use_static_libs=$prefer_static_libs
+ if test "$use_static_libs" = built && test "$installed" = yes ; then
+ use_static_libs=no
+ fi
+ if test -n "$library_names" &&
+ { test "$use_static_libs" = no || test -z "$old_library"; }; then
+ if test "$installed" = no; then
+ notinst_deplibs="$notinst_deplibs $lib"
+ need_relink=yes
+ fi
+ # This is a shared library
+
+ # Warn about portability, can't link against -module's on
+ # some systems (darwin)
+ if test "$shouldnotlink" = yes && test "$pass" = link ; then
+ $echo
+ if test "$linkmode" = prog; then
+ $echo "*** Warning: Linking the executable $output against the loadable module"
+ else
+ $echo "*** Warning: Linking the shared library $output against the loadable module"
+ fi
+ $echo "*** $linklib is not portable!"
+ fi
+ if test "$linkmode" = lib &&
+ test "$hardcode_into_libs" = yes; then
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+ fi
+
+ if test -n "$old_archive_from_expsyms_cmds"; then
+ # figure out the soname
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+ libname=`eval \\$echo \"$libname_spec\"`
+ # use dlname if we got it. it's perfectly good, no?
+ if test -n "$dlname"; then
+ soname="$dlname"
+ elif test -n "$soname_spec"; then
+ # bleh windows
+ case $host in
+ *cygwin* | mingw*)
+ major=`expr $current - $age`
+ versuffix="-$major"
+ ;;
+ esac
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ # Make a new name for the extract_expsyms_cmds to use
+ soroot="$soname"
+ soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
+ newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+ # If the library has no export list, then create one now
+ if test -f "$output_objdir/$soname-def"; then :
+ else
+ $show "extracting exported symbol list from \`$soname'"
+ save_ifs="$IFS"; IFS='~'
+ cmds=$extract_expsyms_cmds
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Create $newlib
+ if test -f "$output_objdir/$newlib"; then :; else
+ $show "generating import library for \`$soname'"
+ save_ifs="$IFS"; IFS='~'
+ cmds=$old_archive_from_expsyms_cmds
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+ # make sure the library variables are pointing to the new library
+ dir=$output_objdir
+ linklib=$newlib
+ fi # test -n "$old_archive_from_expsyms_cmds"
+
+ if test "$linkmode" = prog || test "$mode" != relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ lib_linked=yes
+ case $hardcode_action in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ add="$dir/$linklib"
+ case $host in
+ *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+ *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+ *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+ *-*-unixware7*) add_dir="-L$dir" ;;
+ *-*-darwin* )
+ # if the lib is a module then we can not link against
+ # it, someone is ignoring the new warnings I added
+ if /usr/bin/file -L $add 2> /dev/null |
+ $EGREP ": [^:]* bundle" >/dev/null ; then
+ $echo "** Warning, lib $linklib is a module, not a shared library"
+ if test -z "$old_library" ; then
+ $echo
+ $echo "** And there doesn't seem to be a static archive available"
+ $echo "** The link will probably fail, sorry"
+ else
+ add="$dir/$old_library"
+ fi
+ fi
+ esac
+ elif test "$hardcode_minus_L" = no; then
+ case $host in
+ *-*-sunos*) add_shlibpath="$dir" ;;
+ esac
+ add_dir="-L$dir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ relink)
+ if test "$hardcode_direct" = yes; then
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$dir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ *) lib_linked=no ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ $echo "$modename: configuration error: unsupported hardcode properties"
+ exit $EXIT_FAILURE
+ fi
+
+ if test -n "$add_shlibpath"; then
+ case :$compile_shlibpath: in
+ *":$add_shlibpath:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+ esac
+ fi
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+ test -n "$add" && compile_deplibs="$add $compile_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ if test "$hardcode_direct" != yes && \
+ test "$hardcode_minus_L" != yes && \
+ test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+ esac
+ fi
+ fi
+ fi
+
+ if test "$linkmode" = prog || test "$mode" = relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes; then
+ add="$libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+ esac
+ add="-l$name"
+ elif test "$hardcode_automatic" = yes; then
+ if test -n "$inst_prefix_dir" &&
+ test -f "$inst_prefix_dir$libdir/$linklib" ; then
+ add="$inst_prefix_dir$libdir/$linklib"
+ else
+ add="$libdir/$linklib"
+ fi
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ add_dir="-L$libdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ fi
+
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+ fi
+ elif test "$linkmode" = prog; then
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_deplibs="$dir/$linklib $compile_deplibs"
+ finalize_deplibs="$dir/$linklib $finalize_deplibs"
+ else
+ compile_deplibs="-l$name -L$dir $compile_deplibs"
+ finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+ fi
+ elif test "$build_libtool_libs" = yes; then
+ # Not a shared library
+ if test "$deplibs_check_method" != pass_all; then
+ # We're trying link a shared library against a static one
+ # but the system doesn't support it.
+
+ # Just print a warning and add the library to dependency_libs so
+ # that the program can be linked against the static library.
+ $echo
+ $echo "*** Warning: This system can not link to static lib archive $lib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have."
+ if test "$module" = yes; then
+ $echo "*** But as you try to build a module library, libtool will still create "
+ $echo "*** a static module, that should work as long as the dlopening application"
+ $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+ if test -z "$global_symbol_pipe"; then
+ $echo
+ $echo "*** However, this would only work if libtool was able to extract symbol"
+ $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ $echo "*** not find such a program. So, this module is probably useless."
+ $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ else
+ deplibs="$dir/$old_library $deplibs"
+ link_static=yes
+ fi
+ fi # link shared/static library?
+
+ if test "$linkmode" = lib; then
+ if test -n "$dependency_libs" &&
+ { test "$hardcode_into_libs" != yes ||
+ test "$build_old_libs" = yes ||
+ test "$link_static" = yes; }; then
+ # Extract -R from dependency_libs
+ temp_deplibs=
+ for libdir in $dependency_libs; do
+ case $libdir in
+ -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+ case " $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) xrpath="$xrpath $temp_xrpath";;
+ esac;;
+ *) temp_deplibs="$temp_deplibs $libdir";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ fi
+
+ newlib_search_path="$newlib_search_path $absdir"
+ # Link against this library
+ test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+ # ... and its dependency_libs
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ newdependency_libs="$deplib $newdependency_libs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done
+
+ if test "$link_all_deplibs" != no; then
+ # Add the search paths of all dependency libraries
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) path="$deplib" ;;
+ *.la)
+ dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$deplib" && dir="."
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ absdir="$dir"
+ fi
+ ;;
+ esac
+ if grep "^installed=no" $deplib > /dev/null; then
+ path="$absdir/$objdir"
+ else
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ if test "$absdir" != "$libdir"; then
+ $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+ fi
+ path="$absdir"
+ fi
+ depdepl=
+ case $host in
+ *-*-darwin*)
+ # we do not want to link against static libs,
+ # but need to link against shared
+ eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+ if test -n "$deplibrary_names" ; then
+ for tmp in $deplibrary_names ; do
+ depdepl=$tmp
+ done
+ if test -f "$path/$depdepl" ; then
+ depdepl="$path/$depdepl"
+ fi
+ # do not add paths which are already there
+ case " $newlib_search_path " in
+ *" $path "*) ;;
+ *) newlib_search_path="$newlib_search_path $path";;
+ esac
+ fi
+ path=""
+ ;;
+ *)
+ path="-L$path"
+ ;;
+ esac
+ ;;
+ -l*)
+ case $host in
+ *-*-darwin*)
+ # Again, we only want to link against shared libraries
+ eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
+ for tmp in $newlib_search_path ; do
+ if test -f "$tmp/lib$tmp_libs.dylib" ; then
+ eval depdepl="$tmp/lib$tmp_libs.dylib"
+ break
+ fi
+ done
+ path=""
+ ;;
+ *) continue ;;
+ esac
+ ;;
+ *) continue ;;
+ esac
+ case " $deplibs " in
+ *" $path "*) ;;
+ *) deplibs="$path $deplibs" ;;
+ esac
+ case " $deplibs " in
+ *" $depdepl "*) ;;
+ *) deplibs="$depdepl $deplibs" ;;
+ esac
+ done
+ fi # link_all_deplibs != no
+ fi # linkmode = lib
+ done # for deplib in $libs
+ dependency_libs="$newdependency_libs"
+ if test "$pass" = dlpreopen; then
+ # Link the dlpreopened libraries before other libraries
+ for deplib in $save_deplibs; do
+ deplibs="$deplib $deplibs"
+ done
+ fi
+ if test "$pass" != dlopen; then
+ if test "$pass" != conv; then
+ # Make sure lib_search_path contains only unique directories.
+ lib_search_path=
+ for dir in $newlib_search_path; do
+ case "$lib_search_path " in
+ *" $dir "*) ;;
+ *) lib_search_path="$lib_search_path $dir" ;;
+ esac
+ done
+ newlib_search_path=
+ fi
+
+ if test "$linkmode,$pass" != "prog,link"; then
+ vars="deplibs"
+ else
+ vars="compile_deplibs finalize_deplibs"
+ fi
+ for var in $vars dependency_libs; do
+ # Add libraries to $var in reverse order
+ eval tmp_libs=\"\$$var\"
+ new_libs=
+ for deplib in $tmp_libs; do
+ # FIXME: Pedantically, this is the right thing to do, so
+ # that some nasty dependency loop isn't accidentally
+ # broken:
+ #new_libs="$deplib $new_libs"
+ # Pragmatically, this seems to cause very few problems in
+ # practice:
+ case $deplib in
+ -L*) new_libs="$deplib $new_libs" ;;
+ -R*) ;;
+ *)
+ # And here is the reason: when a library appears more
+ # than once as an explicit dependence of a library, or
+ # is implicitly linked in more than once by the
+ # compiler, it is considered special, and multiple
+ # occurrences thereof are not removed. Compare this
+ # with having the same library being listed as a
+ # dependency of multiple other libraries: in this case,
+ # we know (pedantically, we assume) the library does not
+ # need to be listed more than once, so we keep only the
+ # last copy. This is not always right, but it is rare
+ # enough that we require users that really mean to play
+ # such unportable linking tricks to link the library
+ # using -Wl,-lname, so that libtool does not consider it
+ # for duplicate removal.
+ case " $specialdeplibs " in
+ *" $deplib "*) new_libs="$deplib $new_libs" ;;
+ *)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$deplib $new_libs" ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ done
+ tmp_libs=
+ for deplib in $new_libs; do
+ case $deplib in
+ -L*)
+ case " $tmp_libs " in
+ *" $deplib "*) ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ done
+ eval $var=\"$tmp_libs\"
+ done # for var
+ fi
+ # Last step: remove runtime libs from dependency_libs
+ # (they stay in deplibs)
+ tmp_libs=
+ for i in $dependency_libs ; do
+ case " $predeps $postdeps $compiler_lib_search_path " in
+ *" $i "*)
+ i=""
+ ;;
+ esac
+ if test -n "$i" ; then
+ tmp_libs="$tmp_libs $i"
+ fi
+ done
+ dependency_libs=$tmp_libs
+ done # for pass
+ if test "$linkmode" = prog; then
+ dlfiles="$newdlfiles"
+ dlprefiles="$newdlprefiles"
+ fi
+
+ case $linkmode in
+ oldlib)
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+ fi
+
+ # Now set the variables for building old libraries.
+ build_libtool_libs=no
+ oldlibs="$output"
+ objs="$objs$old_deplibs"
+ ;;
+
+ lib)
+ # Make sure we only generate libraries of the form `libNAME.la'.
+ case $outputname in
+ lib*)
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+ eval shared_ext=\"$shrext_cmds\"
+ eval libname=\"$libname_spec\"
+ ;;
+ *)
+ if test "$module" = no; then
+ $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ if test "$need_lib_prefix" != no; then
+ # Add the "lib" prefix for modules if required
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ eval shared_ext=\"$shrext_cmds\"
+ eval libname=\"$libname_spec\"
+ else
+ libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ fi
+ ;;
+ esac
+
+ if test -n "$objs"; then
+ if test "$deplibs_check_method" != pass_all; then
+ $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+ exit $EXIT_FAILURE
+ else
+ $echo
+ $echo "*** Warning: Linking the shared library $output against the non-libtool"
+ $echo "*** objects $objs is not portable!"
+ libobjs="$libobjs $objs"
+ fi
+ fi
+
+ if test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+ fi
+
+ set dummy $rpath
+ if test "$#" -gt 2; then
+ $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+ fi
+ install_libdir="$2"
+
+ oldlibs=
+ if test -z "$rpath"; then
+ if test "$build_libtool_libs" = yes; then
+ # Building a libtool convenience library.
+ # Some compilers have problems with a `.al' extension so
+ # convenience libraries should have the same extension an
+ # archive normally would.
+ oldlibs="$output_objdir/$libname.$libext $oldlibs"
+ build_libtool_libs=convenience
+ build_old_libs=yes
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+ fi
+ else
+
+ # Parse the version information argument.
+ save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+ IFS="$save_ifs"
+
+ if test -n "$8"; then
+ $echo "$modename: too many parameters to \`-version-info'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # convert absolute version numbers to libtool ages
+ # this retains compatibility with .la files and attempts
+ # to make the code below a bit more comprehensible
+
+ case $vinfo_number in
+ yes)
+ number_major="$2"
+ number_minor="$3"
+ number_revision="$4"
+ #
+ # There are really only two kinds -- those that
+ # use the current revision as the major version
+ # and those that subtract age and use age as
+ # a minor version. But, then there is irix
+ # which has an extra 1 added just for fun
+ #
+ case $version_type in
+ darwin|linux|osf|windows|none)
+ current=`expr $number_major + $number_minor`
+ age="$number_minor"
+ revision="$number_revision"
+ ;;
+ freebsd-aout|freebsd-elf|sunos)
+ current="$number_major"
+ revision="$number_minor"
+ age="0"
+ ;;
+ irix|nonstopux)
+ current=`expr $number_major + $number_minor`
+ age="$number_minor"
+ revision="$number_minor"
+ lt_irix_increment=no
+ ;;
+ esac
+ ;;
+ no)
+ current="$2"
+ revision="$3"
+ age="$4"
+ ;;
+ esac
+
+ # Check that each of the things are valid numbers.
+ case $current in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ case $revision in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ case $age in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ if test "$age" -gt "$current"; then
+ $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case $version_type in
+ none) ;;
+
+ darwin)
+ # Like Linux, but with the current version available in
+ # verstring for coding it into the library header
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ # Darwin ld doesn't like 0 for these options...
+ minor_current=`expr $current + 1`
+ xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+ verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+ ;;
+
+ freebsd-aout)
+ major=".$current"
+ versuffix=".$current.$revision";
+ ;;
+
+ freebsd-elf)
+ major=".$current"
+ versuffix=".$current";
+ ;;
+
+ irix | nonstopux)
+ if test "X$lt_irix_increment" = "Xno"; then
+ major=`expr $current - $age`
+ else
+ major=`expr $current - $age + 1`
+ fi
+ case $version_type in
+ nonstopux) verstring_prefix=nonstopux ;;
+ *) verstring_prefix=sgi ;;
+ esac
+ verstring="$verstring_prefix$major.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+ while test "$loop" -ne 0; do
+ iface=`expr $revision - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring_prefix$major.$iface:$verstring"
+ done
+
+ # Before this point, $major must not contain `.'.
+ major=.$major
+ versuffix="$major.$revision"
+ ;;
+
+ linux)
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ ;;
+
+ osf)
+ major=.`expr $current - $age`
+ versuffix=".$current.$age.$revision"
+ verstring="$current.$age.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+ while test "$loop" -ne 0; do
+ iface=`expr $current - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring:${iface}.0"
+ done
+
+ # Make executables depend on our current version.
+ verstring="$verstring:${current}.0"
+ ;;
+
+ sunos)
+ major=".$current"
+ versuffix=".$current.$revision"
+ ;;
+
+ windows)
+ # Use '-' rather than '.', since we only want one
+ # extension on DOS 8.3 filesystems.
+ major=`expr $current - $age`
+ versuffix="-$major"
+ ;;
+
+ *)
+ $echo "$modename: unknown library version type \`$version_type'" 1>&2
+ $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ # Clear the version info if we defaulted, and they specified a release.
+ if test -z "$vinfo" && test -n "$release"; then
+ major=
+ case $version_type in
+ darwin)
+ # we can't check for "0.0" in archive_cmds due to quoting
+ # problems, so we reset it completely
+ verstring=
+ ;;
+ *)
+ verstring="0.0"
+ ;;
+ esac
+ if test "$need_version" = no; then
+ versuffix=
+ else
+ versuffix=".0.0"
+ fi
+ fi
+
+ # Remove version info from name if versioning should be avoided
+ if test "$avoid_version" = yes && test "$need_version" = no; then
+ major=
+ versuffix=
+ verstring=""
+ fi
+
+ # Check to see if the archive will have undefined symbols.
+ if test "$allow_undefined" = yes; then
+ if test "$allow_undefined_flag" = unsupported; then
+ $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+ build_libtool_libs=no
+ build_old_libs=yes
+ fi
+ else
+ # Don't allow undefined symbols.
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+ fi
+
+ if test "$mode" != relink; then
+ # Remove our outputs, but don't remove object files since they
+ # may have been created when compiling PIC objects.
+ removelist=
+ tempremovelist=`$echo "$output_objdir/*"`
+ for p in $tempremovelist; do
+ case $p in
+ *.$objext)
+ ;;
+ $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+ if test "X$precious_files_regex" != "X"; then
+ if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+ then
+ continue
+ fi
+ fi
+ removelist="$removelist $p"
+ ;;
+ *) ;;
+ esac
+ done
+ if test -n "$removelist"; then
+ $show "${rm}r $removelist"
+ $run ${rm}r $removelist
+ fi
+ fi
+
+ # Now set the variables for building old libraries.
+ if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+ oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+ # Transform .lo files to .o files.
+ oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+ fi
+
+ # Eliminate all temporary directories.
+ #for path in $notinst_path; do
+ # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
+ # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
+ # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
+ #done
+
+ if test -n "$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ temp_xrpath=
+ for libdir in $xrpath; do
+ temp_xrpath="$temp_xrpath -R$libdir"
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+ fi
+
+ # Make sure dlfiles contains only unique files that won't be dlpreopened
+ old_dlfiles="$dlfiles"
+ dlfiles=
+ for lib in $old_dlfiles; do
+ case " $dlprefiles $dlfiles " in
+ *" $lib "*) ;;
+ *) dlfiles="$dlfiles $lib" ;;
+ esac
+ done
+
+ # Make sure dlprefiles contains only unique files
+ old_dlprefiles="$dlprefiles"
+ dlprefiles=
+ for lib in $old_dlprefiles; do
+ case "$dlprefiles " in
+ *" $lib "*) ;;
+ *) dlprefiles="$dlprefiles $lib" ;;
+ esac
+ done
+
+ if test "$build_libtool_libs" = yes; then
+ if test -n "$rpath"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+ # these systems don't actually have a c library (as such)!
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C library is in the System framework
+ deplibs="$deplibs -framework System"
+ ;;
+ *-*-netbsd*)
+ # Don't link with libc until the a.out ld.so is fixed.
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ ;;
+ *)
+ # Add libc to deplibs on all other systems if necessary.
+ if test "$build_libtool_need_lc" = "yes"; then
+ deplibs="$deplibs -lc"
+ fi
+ ;;
+ esac
+ fi
+
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case $deplibs_check_method in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behavior.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $rm conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $rm conftest
+ if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ name=`expr $i : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" != "0"; then
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ newdeplibs="$newdeplibs $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: dynamic linker does not accept needed library $i."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which I believe you do not have"
+ $echo "*** because a test_compile did reveal that the linker did not use it for"
+ $echo "*** its dynamic dependency list that programs get resolved with at runtime."
+ fi
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ else
+ # Error occurred in the first compile. Let's try to salvage
+ # the situation: Compile a separate program for each library.
+ for i in $deplibs; do
+ name=`expr $i : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" != "0"; then
+ $rm conftest
+ if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+ ldd_output=`ldd conftest`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ newdeplibs="$newdeplibs $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: dynamic linker does not accept needed library $i."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because a test_compile did reveal that the linker did not use this one"
+ $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+ fi
+ fi
+ else
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning! Library $i is needed by this library but I was not able to"
+ $echo "*** make it link in! You will probably need to install it or some"
+ $echo "*** library that it depends on before this library will be fully"
+ $echo "*** functional. Installing it before continuing would be even better."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method
+ file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ for a_deplib in $deplibs; do
+ name=`expr $a_deplib : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" != "0"; then
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null \
+ | grep " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+ case $potliblink in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+ | ${SED} 10q \
+ | $EGREP "$file_magic_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: linker path does not have real file for library $a_deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $echo "*** with $libname but no candidates were found. (...for file magic test)"
+ else
+ $echo "*** with $libname and none of the candidates passed a file format test"
+ $echo "*** using a file magic. Last file checked: $potlib"
+ fi
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ match_pattern*)
+ set dummy $deplibs_check_method
+ match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ for a_deplib in $deplibs; do
+ name=`expr $a_deplib : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test -n "$name" && test "$name" != "0"; then
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ potlib="$potent_lib" # see symlink-check above in file_magic test
+ if eval $echo \"$potent_lib\" 2>/dev/null \
+ | ${SED} 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: linker path does not have real file for library $a_deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+ else
+ $echo "*** with $libname and none of the candidates passed a file format test"
+ $echo "*** using a regex pattern. Last file checked: $potlib"
+ fi
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+ -e 's/ -[LR][^ ]*//g'`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ for i in $predeps $postdeps ; do
+ # can't use Xsed below, because $i might contain '/'
+ tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
+ done
+ fi
+ if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
+ | grep . >/dev/null; then
+ $echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ $echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ $echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ $echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ fi
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ ;;
+ esac
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ $echo
+ $echo "*** Warning: libtool could not satisfy all declared inter-library"
+ $echo "*** dependencies of module $libname. Therefore, libtool will create"
+ $echo "*** a static module, that should work as long as the dlopening"
+ $echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ $echo
+ $echo "*** However, this would only work if libtool was able to extract symbol"
+ $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ $echo "*** not find such a program. So, this module is probably useless."
+ $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ $echo "*** The inter-library dependencies that have been dropped here will be"
+ $echo "*** automatically added whenever a program is linked with this library"
+ $echo "*** or is declared to -dlopen it."
+
+ if test "$allow_undefined" = no; then
+ $echo
+ $echo "*** Since this library must not contain undefined symbols,"
+ $echo "*** because either the platform does not support them or"
+ $echo "*** it was explicitly requested with -no-undefined,"
+ $echo "*** libtool will only create a static version of it."
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $deplibs " in
+ *" -L$path/$objdir "*)
+ new_libs="$new_libs -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ done
+ deplibs="$new_libs"
+
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ if test "$hardcode_into_libs" = yes; then
+ # Hardcode the library paths
+ hardcode_libdirs=
+ dep_rpath=
+ rpath="$finalize_rpath"
+ test "$mode" != relink && rpath="$compile_rpath$rpath"
+ for libdir in $rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ dep_rpath="$dep_rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ if test -n "$hardcode_libdir_flag_spec_ld"; then
+ case $archive_cmds in
+ *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
+ *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
+ esac
+ else
+ eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+ fi
+ fi
+ if test -n "$runpath_var" && test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+ fi
+ test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+ fi
+
+ shlibpath="$finalize_shlibpath"
+ test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+ if test -n "$shlibpath"; then
+ eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+ fi
+
+ # Get the real and link names of the library.
+ eval shared_ext=\"$shrext_cmds\"
+ eval library_names=\"$library_names_spec\"
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+
+ if test -n "$soname_spec"; then
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+ if test -z "$dlname"; then
+ dlname=$soname
+ fi
+
+ lib="$output_objdir/$realname"
+ linknames=
+ for link
+ do
+ linknames="$linknames $link"
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ cmds=$export_symbols_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ if len=`expr "X$cmd" : ".*"` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ skipped_export=false
+ else
+ # The command line is too long to execute in one step.
+ $show "using reloadable object file for export list..."
+ skipped_export=:
+ # Break out early, otherwise skipped_export may be
+ # set to false by a later but shorter cmd.
+ break
+ fi
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex"; then
+ $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+ $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+ $run eval '$mv "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+ fi
+
+ tmp_deplibs=
+ for test_deplib in $deplibs; do
+ case " $convenience " in
+ *" $test_deplib "*) ;;
+ *)
+ tmp_deplibs="$tmp_deplibs $test_deplib"
+ ;;
+ esac
+ done
+ deplibs="$tmp_deplibs"
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ func_extract_archives $gentop $convenience
+ libobjs="$libobjs $func_extract_archives_result"
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ linker_flags="$linker_flags $flag"
+ fi
+
+ # Make a backup of the uninstalled library when relinking
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+ fi
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ eval test_cmds=\"$module_expsym_cmds\"
+ cmds=$module_expsym_cmds
+ else
+ eval test_cmds=\"$module_cmds\"
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval test_cmds=\"$archive_expsym_cmds\"
+ cmds=$archive_expsym_cmds
+ else
+ eval test_cmds=\"$archive_cmds\"
+ cmds=$archive_cmds
+ fi
+ fi
+
+ if test "X$skipped_export" != "X:" &&
+ len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ :
+ else
+ # The command line is too long to link in one step, link piecewise.
+ $echo "creating reloadable object files..."
+
+ # Save the value of $output and $libobjs because we want to
+ # use them later. If we have whole_archive_flag_spec, we
+ # want to use save_libobjs as it was before
+ # whole_archive_flag_spec was expanded, because we can't
+ # assume the linker understands whole_archive_flag_spec.
+ # This may have to be revisited, in case too many
+ # convenience libraries get linked in and end up exceeding
+ # the spec.
+ if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ fi
+ save_output=$output
+ output_la=`$echo "X$output" | $Xsed -e "$basename"`
+
+ # Clear the reloadable object creation command queue and
+ # initialize k to one.
+ test_cmds=
+ concat_cmds=
+ objlist=
+ delfiles=
+ last_robj=
+ k=1
+ output=$output_objdir/$output_la-${k}.$objext
+ # Loop over the list of objects to be linked.
+ for obj in $save_libobjs
+ do
+ eval test_cmds=\"$reload_cmds $objlist $last_robj\"
+ if test "X$objlist" = X ||
+ { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ test "$len" -le "$max_cmd_len"; }; then
+ objlist="$objlist $obj"
+ else
+ # The command $test_cmds is almost too long, add a
+ # command to the queue.
+ if test "$k" -eq 1 ; then
+ # The first file doesn't have a previous command to add.
+ eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+ else
+ # All subsequent reloadable object files will link in
+ # the last one created.
+ eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
+ fi
+ last_robj=$output_objdir/$output_la-${k}.$objext
+ k=`expr $k + 1`
+ output=$output_objdir/$output_la-${k}.$objext
+ objlist=$obj
+ len=1
+ fi
+ done
+ # Handle the remaining objects by creating one last
+ # reloadable object file. All subsequent reloadable object
+ # files will link in the last one created.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+ if ${skipped_export-false}; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ libobjs=$output
+ # Append the command to create the export file.
+ eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
+ fi
+
+ # Set up a command to remove the reloadable object files
+ # after they are used.
+ i=0
+ while test "$i" -lt "$k"
+ do
+ i=`expr $i + 1`
+ delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
+ done
+
+ $echo "creating a temporary reloadable object file: $output"
+
+ # Loop through the commands generated above and execute them.
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $concat_cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ libobjs=$output
+ # Restore the value of output.
+ output=$save_output
+
+ if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ fi
+ # Expand the library linking commands again to reset the
+ # value of $libobjs for piecewise linking.
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ cmds=$module_expsym_cmds
+ else
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ cmds=$archive_expsym_cmds
+ else
+ cmds=$archive_cmds
+ fi
+ fi
+
+ # Append the command to remove the reloadable object files
+ # to the just-reset $cmds.
+ eval cmds=\"\$cmds~\$rm $delfiles\"
+ fi
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+
+ if test -n "$convenience"; then
+ if test -z "$whole_archive_flag_spec"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ fi
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ obj)
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+ fi
+
+ case $output in
+ *.lo)
+ if test -n "$objs$old_deplibs"; then
+ $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ libobj="$output"
+ obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+ ;;
+ *)
+ libobj=
+ obj="$output"
+ ;;
+ esac
+
+ # Delete the old objects.
+ $run $rm $obj $libobj
+
+ # Objects from convenience libraries. This assumes
+ # single-version convenience libraries. Whenever we create
+ # different ones for PIC/non-PIC, this we'll have to duplicate
+ # the extraction.
+ reload_conv_objs=
+ gentop=
+ # reload_cmds runs $LD directly, so let us get rid of
+ # -Wl from whole_archive_flag_spec and hope we can get by with
+ # turning comma into space..
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+ reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
+ else
+ gentop="$output_objdir/${obj}x"
+ generated="$generated $gentop"
+
+ func_extract_archives $gentop $convenience
+ reload_conv_objs="$reload_objs $func_extract_archives_result"
+ fi
+ fi
+
+ # Create the old-style object.
+ reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+ output="$obj"
+ cmds=$reload_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ # $show "echo timestamp > $libobj"
+ # $run eval "echo timestamp > $libobj" || exit $?
+ exit $EXIT_SUCCESS
+ fi
+
+ if test -n "$pic_flag" || test "$pic_mode" != default; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ cmds=$reload_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit $EXIT_SUCCESS
+ ;;
+
+ prog)
+ case $host in
+ *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+ esac
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+ fi
+
+ if test "$preload" = yes; then
+ if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+ test "$dlopen_self_static" = unknown; then
+ $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+ fi
+ fi
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ ;;
+ esac
+
+ case $host in
+ *darwin*)
+ # Don't allow lazy linking, it breaks C++ global constructors
+ if test "$tagname" = CXX ; then
+ compile_command="$compile_command ${wl}-bind_at_load"
+ finalize_command="$finalize_command ${wl}-bind_at_load"
+ fi
+ ;;
+ esac
+
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $compile_deplibs " in
+ *" -L$path/$objdir "*)
+ new_libs="$new_libs -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $compile_deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ done
+ compile_deplibs="$new_libs"
+
+
+ compile_command="$compile_command $compile_deplibs"
+ finalize_command="$finalize_command $finalize_deplibs"
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$libdir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$libdir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$testbindir";;
+ esac
+ ;;
+ esac
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ fi
+
+ dlsyms=
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ dlsyms="${outputname}S.c"
+ else
+ $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+ fi
+ fi
+
+ if test -n "$dlsyms"; then
+ case $dlsyms in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${outputname}.nm"
+
+ $show "$rm $nlist ${nlist}S ${nlist}T"
+ $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+ # Parse the name list into a source file.
+ $show "creating $output_objdir/$dlsyms"
+
+ test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ $show "generating symbol list for \`$output'"
+
+ test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ for arg in $progfiles; do
+ $show "extracting global C symbols from \`$arg'"
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$outputname.exp"
+ $run $rm $export_symbols
+ $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ case $host in
+ *cygwin* | *mingw* )
+ $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ else
+ $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+ $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+ $run eval 'mv "$nlist"T "$nlist"'
+ case $host in
+ *cygwin* | *mingw* )
+ $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ fi
+ fi
+
+ for arg in $dlprefiles; do
+ $show "extracting global C symbols from \`$arg'"
+ name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
+ $run eval '$echo ": $name " >> "$nlist"'
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -z "$run"; then
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $mv "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if grep -v "^: " < "$nlist" |
+ if sort -k 3 </dev/null >/dev/null 2>&1; then
+ sort -k 3
+ else
+ sort +2
+ fi |
+ uniq > "$nlist"S; then
+ :
+ else
+ grep -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+ else
+ $echo '/* NONE */' >> "$output_objdir/$dlsyms"
+ fi
+
+ $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+"
+
+ case $host in
+ *cygwin* | *mingw* )
+ $echo >> "$output_objdir/$dlsyms" "\
+/* DATA imports from DLLs on WIN32 can't be const, because
+ runtime relocations are performed -- see ld's documentation
+ on pseudo-relocs */
+struct {
+"
+ ;;
+ * )
+ $echo >> "$output_objdir/$dlsyms" "\
+const struct {
+"
+ ;;
+ esac
+
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ const char *name;
+ lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+ eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ fi
+
+ pic_flag_for_symtable=
+ case $host in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
+ esac;;
+ *-*-hpux*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag";;
+ esac
+ esac
+
+ # Now compile the dynamic symbol file.
+ $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+ $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+ # Clean up the generated files.
+ $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+ $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+ # Transform the symbol file into the correct name.
+ case $host in
+ *cygwin* | *mingw* )
+ if test -f "$output_objdir/${outputname}.def" ; then
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ else
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ fi
+ ;;
+ * )
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ ;;
+ esac
+ ;;
+ *)
+ $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+ fi
+
+ if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+ # Replace the output file specification.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ $show "$link_command"
+ $run eval "$link_command"
+ exit_status=$?
+
+ # Delete the generated files.
+ if test -n "$dlsyms"; then
+ $show "$rm $output_objdir/${outputname}S.${objext}"
+ $run $rm "$output_objdir/${outputname}S.${objext}"
+ fi
+
+ exit $exit_status
+ fi
+
+ if test -n "$shlibpath_var"; then
+ # We should set the shlibpath_var
+ rpath=
+ for dir in $temp_rpath; do
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*)
+ # Absolute path.
+ rpath="$rpath$dir:"
+ ;;
+ *)
+ # Relative path: add a thisdir entry.
+ rpath="$rpath\$thisdir/$dir:"
+ ;;
+ esac
+ done
+ temp_rpath="$rpath"
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$no_install" = yes; then
+ # We don't need to create a wrapper script.
+ link_command="$compile_var$compile_command$compile_rpath"
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ # Delete the old output file.
+ $run $rm $output
+ # Link the executable and exit
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+ $echo "$modename: \`$output' will be relinked during installation" 1>&2
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+
+ # Now create the wrapper script.
+ $show "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ fi
+ done
+ relink_command="(cd `pwd`; $relink_command)"
+ relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
+ fi
+
+ # Quote $echo for shipping.
+ if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
+ case $progpath in
+ [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+ *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+ esac
+ qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+ else
+ qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if our run command is non-null.
+ if test -z "$run"; then
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
+ esac
+ # test for cygwin because mv fails w/o .exe extensions
+ case $host in
+ *cygwin*)
+ exeext=.exe
+ outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
+ *) exeext= ;;
+ esac
+ case $host in
+ *cygwin* | *mingw* )
+ output_name=`basename $output`
+ output_path=`dirname $output`
+ cwrappersource="$output_path/$objdir/lt-$output_name.c"
+ cwrapper="$output_path/$output_name.exe"
+ $rm $cwrappersource $cwrapper
+ trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+ cat > $cwrappersource <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+ Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+
+ The $output program cannot be directly executed until all the libtool
+ libraries that it depends on are installed.
+
+ This wrapper executable should never be moved out of the build directory.
+ If it is, it will not operate correctly.
+
+ Currently, it simply execs the wrapper *script* "/bin/sh $output",
+ but could eventually absorb all of the scripts functionality and
+ exec $objdir/$outputname directly.
+*/
+EOF
+ cat >> $cwrappersource<<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/stat.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+ defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# ifndef DIR_SEPARATOR_2
+# define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+# define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+ if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+/* -DDEBUG is fairly common in CFLAGS. */
+#undef DEBUG
+#if defined DEBUGWRAPPER
+# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
+#else
+# define DEBUG(format, ...)
+#endif
+
+const char *program_name = NULL;
+
+void * xmalloc (size_t num);
+char * xstrdup (const char *string);
+const char * base_name (const char *name);
+char * find_executable(const char *wrapper);
+int check_executable(const char *path);
+char * strendzap(char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+
+int
+main (int argc, char *argv[])
+{
+ char **newargz;
+ int i;
+
+ program_name = (char *) xstrdup (base_name (argv[0]));
+ DEBUG("(main) argv[0] : %s\n",argv[0]);
+ DEBUG("(main) program_name : %s\n",program_name);
+ newargz = XMALLOC(char *, argc+2);
+EOF
+
+ cat >> $cwrappersource <<EOF
+ newargz[0] = (char *) xstrdup("$SHELL");
+EOF
+
+ cat >> $cwrappersource <<"EOF"
+ newargz[1] = find_executable(argv[0]);
+ if (newargz[1] == NULL)
+ lt_fatal("Couldn't find %s", argv[0]);
+ DEBUG("(main) found exe at : %s\n",newargz[1]);
+ /* we know the script has the same name, without the .exe */
+ /* so make sure newargz[1] doesn't end in .exe */
+ strendzap(newargz[1],".exe");
+ for (i = 1; i < argc; i++)
+ newargz[i+1] = xstrdup(argv[i]);
+ newargz[argc+1] = NULL;
+
+ for (i=0; i<argc+1; i++)
+ {
+ DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
+ ;
+ }
+
+EOF
+
+ case $host_os in
+ mingw*)
+ cat >> $cwrappersource <<EOF
+ execv("$SHELL",(char const **)newargz);
+EOF
+ ;;
+ *)
+ cat >> $cwrappersource <<EOF
+ execv("$SHELL",newargz);
+EOF
+ ;;
+ esac
+
+ cat >> $cwrappersource <<"EOF"
+ return 127;
+}
+
+void *
+xmalloc (size_t num)
+{
+ void * p = (void *) malloc (num);
+ if (!p)
+ lt_fatal ("Memory exhausted");
+
+ return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+ return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
+;
+}
+
+const char *
+base_name (const char *name)
+{
+ const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ /* Skip over the disk name in MSDOS pathnames. */
+ if (isalpha ((unsigned char)name[0]) && name[1] == ':')
+ name += 2;
+#endif
+
+ for (base = name; *name; name++)
+ if (IS_DIR_SEPARATOR (*name))
+ base = name + 1;
+ return base;
+}
+
+int
+check_executable(const char * path)
+{
+ struct stat st;
+
+ DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
+ if ((!path) || (!*path))
+ return 0;
+
+ if ((stat (path, &st) >= 0) &&
+ (
+ /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
+#if defined (S_IXOTH)
+ ((st.st_mode & S_IXOTH) == S_IXOTH) ||
+#endif
+#if defined (S_IXGRP)
+ ((st.st_mode & S_IXGRP) == S_IXGRP) ||
+#endif
+ ((st.st_mode & S_IXUSR) == S_IXUSR))
+ )
+ return 1;
+ else
+ return 0;
+}
+
+/* Searches for the full path of the wrapper. Returns
+ newly allocated full path name if found, NULL otherwise */
+char *
+find_executable (const char* wrapper)
+{
+ int has_slash = 0;
+ const char* p;
+ const char* p_next;
+ /* static buffer for getcwd */
+ char tmp[LT_PATHMAX + 1];
+ int tmp_len;
+ char* concat_name;
+
+ DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
+
+ if ((wrapper == NULL) || (*wrapper == '\0'))
+ return NULL;
+
+ /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+ else
+ {
+#endif
+ if (IS_DIR_SEPARATOR (wrapper[0]))
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ }
+#endif
+
+ for (p = wrapper; *p; p++)
+ if (*p == '/')
+ {
+ has_slash = 1;
+ break;
+ }
+ if (!has_slash)
+ {
+ /* no slashes; search PATH */
+ const char* path = getenv ("PATH");
+ if (path != NULL)
+ {
+ for (p = path; *p; p = p_next)
+ {
+ const char* q;
+ size_t p_len;
+ for (q = p; *q; q++)
+ if (IS_PATH_SEPARATOR(*q))
+ break;
+ p_len = q - p;
+ p_next = (*q == '\0' ? q : q + 1);
+ if (p_len == 0)
+ {
+ /* empty path: current directory */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal ("getcwd failed");
+ tmp_len = strlen(tmp);
+ concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+ }
+ else
+ {
+ concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, p, p_len);
+ concat_name[p_len] = '/';
+ strcpy (concat_name + p_len + 1, wrapper);
+ }
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+ }
+ /* not found in PATH; assume curdir */
+ }
+ /* Relative path | not found in path: prepend cwd */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal ("getcwd failed");
+ tmp_len = strlen(tmp);
+ concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ return NULL;
+}
+
+char *
+strendzap(char *str, const char *pat)
+{
+ size_t len, patlen;
+
+ assert(str != NULL);
+ assert(pat != NULL);
+
+ len = strlen(str);
+ patlen = strlen(pat);
+
+ if (patlen <= len)
+ {
+ str += len - patlen;
+ if (strcmp(str, pat) == 0)
+ *str = '\0';
+ }
+ return str;
+}
+
+static void
+lt_error_core (int exit_status, const char * mode,
+ const char * message, va_list ap)
+{
+ fprintf (stderr, "%s: %s: ", program_name, mode);
+ vfprintf (stderr, message, ap);
+ fprintf (stderr, ".\n");
+
+ if (exit_status >= 0)
+ exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+ va_list ap;
+ va_start (ap, message);
+ lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+ va_end (ap);
+}
+EOF
+ # we should really use a build-platform specific compiler
+ # here, but OTOH, the wrappers (shell script and this C one)
+ # are only useful if you want to execute the "real" binary.
+ # Since the "real" binary is built for $host, then this
+ # wrapper might as well be built for $host, too.
+ $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
+ ;;
+ esac
+ $rm $output
+ trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
+
+ $echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variable:
+ notinst_deplibs='$notinst_deplibs'
+else
+ # When we are sourced in execute mode, \$file and \$echo are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ echo=\"$qecho\"
+ file=\"\$0\"
+ # Make sure echo works.
+ if test \"X\$1\" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+ elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+ # Yippee, \$echo works!
+ :
+ else
+ # Restart under the correct shell, and then maybe \$echo will work.
+ exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+ fi
+ fi\
+"
+ $echo >> $output "\
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+ done
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ $echo >> $output "\
+ program=lt-'$outputname'$exeext
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" || \\
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $mkdir \"\$progdir\"
+ else
+ $rm \"\$progdir/\$file\"
+ fi"
+
+ $echo >> $output "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+ else
+ $echo \"\$relink_command_output\" >&2
+ $rm \"\$progdir/\$file\"
+ exit $EXIT_FAILURE
+ fi
+ fi
+
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $rm \"\$progdir/\$program\";
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $rm \"\$progdir/\$file\"
+ fi"
+ else
+ $echo >> $output "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ $echo >> $output "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $echo >> $output "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ # fixup the dll searchpath if we need to.
+ if test -n "$dllsearchpath"; then
+ $echo >> $output "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ $echo >> $output "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+"
+ case $host in
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2*)
+ $echo >> $output "\
+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $echo >> $output "\
+ exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $echo >> $output "\
+ \$echo \"\$0: cannot exec \$program \$*\"
+ exit $EXIT_FAILURE
+ fi
+ else
+ # The program doesn't exist.
+ \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+ \$echo \"This script is just a wrapper for \$program.\" 1>&2
+ $echo \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit $EXIT_FAILURE
+ fi
+fi\
+"
+ chmod +x $output
+ fi
+ exit $EXIT_SUCCESS
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$old_deplibs $non_pic_objects"
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ func_extract_archives $gentop $addlibs
+ oldobjs="$oldobjs $func_extract_archives_result"
+ fi
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ cmds=$old_archive_from_new_cmds
+ else
+ # POSIX demands no paths to be encoded in archives. We have
+ # to avoid creating archives with duplicate basenames if we
+ # might have to extract them afterwards, e.g., when creating a
+ # static archive out of a convenience library, or when linking
+ # the entirety of a libtool archive into another (currently
+ # not supported by libtool).
+ if (for obj in $oldobjs
+ do
+ $echo "X$obj" | $Xsed -e 's%^.*/%%'
+ done | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "copying selected object files to avoid basename conflicts..."
+
+ if test -z "$gentop"; then
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "$mkdir $gentop"
+ $run $mkdir "$gentop"
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
+ exit $exit_status
+ fi
+ fi
+
+ save_oldobjs=$oldobjs
+ oldobjs=
+ counter=1
+ for obj in $save_oldobjs
+ do
+ objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ case " $oldobjs " in
+ " ") oldobjs=$obj ;;
+ *[\ /]"$objbase "*)
+ while :; do
+ # Make sure we don't pick an alternate name that also
+ # overlaps.
+ newobj=lt$counter-$objbase
+ counter=`expr $counter + 1`
+ case " $oldobjs " in
+ *[\ /]"$newobj "*) ;;
+ *) if test ! -f "$gentop/$newobj"; then break; fi ;;
+ esac
+ done
+ $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+ $run ln "$obj" "$gentop/$newobj" ||
+ $run cp "$obj" "$gentop/$newobj"
+ oldobjs="$oldobjs $gentop/$newobj"
+ ;;
+ *) oldobjs="$oldobjs $obj" ;;
+ esac
+ done
+ fi
+
+ eval cmds=\"$old_archive_cmds\"
+
+ if len=`expr "X$cmds" : ".*"` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ cmds=$old_archive_cmds
+ else
+ # the command line is too long to link in one step, link in parts
+ $echo "using piecewise archive linking..."
+ save_RANLIB=$RANLIB
+ RANLIB=:
+ objlist=
+ concat_cmds=
+ save_oldobjs=$oldobjs
+
+ # Is there a better way of finding the last object in the list?
+ for obj in $save_oldobjs
+ do
+ last_oldobj=$obj
+ done
+ for obj in $save_oldobjs
+ do
+ oldobjs="$objlist $obj"
+ objlist="$objlist $obj"
+ eval test_cmds=\"$old_archive_cmds\"
+ if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ test "$len" -le "$max_cmd_len"; then
+ :
+ else
+ # the above command should be used before it gets too long
+ oldobjs=$objlist
+ if test "$obj" = "$last_oldobj" ; then
+ RANLIB=$save_RANLIB
+ fi
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+ objlist=
+ fi
+ done
+ RANLIB=$save_RANLIB
+ oldobjs=$objlist
+ if test "X$oldobjs" = "X" ; then
+ eval cmds=\"\$concat_cmds\"
+ else
+ eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+ fi
+ fi
+ fi
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ eval cmd=\"$cmd\"
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$generated"; then
+ $show "${rm}r$generated"
+ $run ${rm}r$generated
+ fi
+
+ # Now create the libtool archive.
+ case $output in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ $show "creating $output"
+
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ fi
+ done
+ # Quote the link command for shipping.
+ relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
+ if test "$hardcode_automatic" = yes ; then
+ relink_command=
+ fi
+
+
+ # Only create the output if not a dry run.
+ if test -z "$run"; then
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ # Replace all uninstalled libtool libraries with the installed ones
+ newdependency_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ *.la)
+ name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ newdependency_libs="$newdependency_libs $libdir/$name"
+ ;;
+ *) newdependency_libs="$newdependency_libs $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+ newdlfiles=
+ for lib in $dlfiles; do
+ name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ newdlfiles="$newdlfiles $libdir/$name"
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ newdlprefiles="$newdlprefiles $libdir/$name"
+ done
+ dlprefiles="$newdlprefiles"
+ else
+ newdlfiles=
+ for lib in $dlfiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ newdlfiles="$newdlfiles $abs"
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ newdlprefiles="$newdlprefiles $abs"
+ done
+ dlprefiles="$newdlprefiles"
+ fi
+ $rm $output
+ # place dlname in correct position for cygwin
+ tdlname=$dlname
+ case $host,$output,$installed,$module,$dlname in
+ *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+ esac
+ $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+ if test "$installed" = no && test "$need_relink" = yes; then
+ $echo >> $output "\
+relink_command=\"$relink_command\""
+ fi
+ done
+ fi
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+ $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+ ;;
+ esac
+ exit $EXIT_SUCCESS
+ ;;
+
+ # libtool install mode
+ install)
+ modename="$modename: install"
+
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+ # Allow the use of GNU shtool's install command.
+ $echo "X$nonopt" | grep shtool > /dev/null; then
+ # Aesthetically quote it.
+ arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$arg "
+ arg="$1"
+ shift
+ else
+ install_prog=
+ arg=$nonopt
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog$arg"
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ for arg
+ do
+ if test -n "$dest"; then
+ files="$files $dest"
+ dest=$arg
+ continue
+ fi
+
+ case $arg in
+ -d) isdir=yes ;;
+ -f)
+ case " $install_prog " in
+ *[\\\ /]cp\ *) ;;
+ *) prev=$arg ;;
+ esac
+ ;;
+ -g | -m | -o) prev=$arg ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*)
+ ;;
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ prev=
+ else
+ dest=$arg
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog $arg"
+ done
+
+ if test -z "$install_prog"; then
+ $echo "$modename: you must specify an install program" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prev' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ $echo "$modename: no file or destination specified" 1>&2
+ else
+ $echo "$modename: you must specify a destination" 1>&2
+ fi
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Strip any trailing slash from the destination.
+ dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$destdir" = "X$dest" && destdir=.
+ destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files
+ if test "$#" -gt 2; then
+ $echo "$modename: \`$dest' is not a directory" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ fi
+ case $destdir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case $file in
+ *.lo) ;;
+ *)
+ $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case $file in
+ *.$libext)
+ # Do the static libraries later.
+ staticlibs="$staticlibs $file"
+ ;;
+
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ library_names=
+ old_library=
+ relink_command=
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) current_libdirs="$current_libdirs $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) future_libdirs="$future_libdirs $libdir" ;;
+ esac
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+ test "X$dir" = "X$file/" && dir=
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
+
+ # Don't allow the user to place us outside of our expected
+ # location b/c this prevents finding dependent libraries that
+ # are installed to the same prefix.
+ # At present, this check doesn't affect windows .dll's that
+ # are installed into $libdir/../bin (currently, that works fine)
+ # but it's something to keep an eye on.
+ if test "$inst_prefix_dir" = "$destdir"; then
+ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
+ else
+ relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
+ fi
+
+ $echo "$modename: warning: relinking \`$file'" 1>&2
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ fi
+
+ # See the names of the shared library.
+ set dummy $library_names
+ if test -n "$2"; then
+ realname="$2"
+ shift
+ shift
+
+ srcname="$realname"
+ test -n "$relink_command" && srcname="$realname"T
+
+ # Install the shared library and build the symlinks.
+ $show "$install_prog $dir/$srcname $destdir/$realname"
+ $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+ if test -n "$stripme" && test -n "$striplib"; then
+ $show "$striplib $destdir/$realname"
+ $run eval "$striplib $destdir/$realname" || exit $?
+ fi
+
+ if test "$#" -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ # Try `ln -sf' first, because the `ln' binary might depend on
+ # the symlink we replace! Solaris /bin/ln does not understand -f,
+ # so we also need to try rm && ln -s.
+ for linkname
+ do
+ if test "$linkname" != "$realname"; then
+ $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+ $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+ fi
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ cmds=$postinstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Install the pseudo-library for information purposes.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ instname="$dir/$name"i
+ $show "$install_prog $instname $destdir/$name"
+ $run eval "$install_prog $instname $destdir/$name" || exit $?
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case $destfile in
+ *.lo)
+ staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+ ;;
+ *.$objext)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ if test -n "$destfile"; then
+ $show "$install_prog $file $destfile"
+ $run eval "$install_prog $file $destfile" || exit $?
+ fi
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+ $show "$install_prog $staticobj $staticdest"
+ $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+ fi
+ exit $EXIT_SUCCESS
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # If the file is missing, and there is a .exe on the end, strip it
+ # because it is most likely a libtool script we actually want to
+ # install
+ stripped_ext=""
+ case $file in
+ *.exe)
+ if test ! -f "$file"; then
+ file=`$echo $file|${SED} 's,.exe$,,'`
+ stripped_ext=".exe"
+ fi
+ ;;
+ esac
+
+ # Do a test to see if this is really a libtool program.
+ case $host in
+ *cygwin*|*mingw*)
+ wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
+ ;;
+ *)
+ wrapper=$file
+ ;;
+ esac
+ if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+ notinst_deplibs=
+ relink_command=
+
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
+ # If there is no directory component, then add one.
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
+ esac
+
+ # Check the variables that should have been set.
+ if test -z "$notinst_deplibs"; then
+ $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ finalize=yes
+ for lib in $notinst_deplibs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ # If there is no directory component, then add one.
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ fi
+ libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+ finalize=no
+ fi
+ done
+
+ relink_command=
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
+ # If there is no directory component, then add one.
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
+ esac
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ if test "$finalize" = yes && test -z "$run"; then
+ tmpdir=`func_mktempdir`
+ file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
+
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ ${rm}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ $echo "$modename: warning: cannot relink \`$file'" 1>&2
+ fi
+ else
+ # Install the binary that we compiled earlier.
+ file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ # remove .exe since cygwin /usr/bin/install will append another
+ # one anyway
+ case $install_prog,$host in
+ */usr/bin/install*,*cygwin*)
+ case $file:$destfile in
+ *.exe:*.exe)
+ # this is ok
+ ;;
+ *.exe:*)
+ destfile=$destfile.exe
+ ;;
+ *:*.exe)
+ destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
+ ;;
+ esac
+ ;;
+ esac
+ $show "$install_prog$stripme $file $destfile"
+ $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+ test -n "$outputname" && ${rm}r "$tmpdir"
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+
+ $show "$install_prog $file $oldlib"
+ $run eval "$install_prog \$file \$oldlib" || exit $?
+
+ if test -n "$stripme" && test -n "$old_striplib"; then
+ $show "$old_striplib $oldlib"
+ $run eval "$old_striplib $oldlib" || exit $?
+ fi
+
+ # Do each command in the postinstall commands.
+ cmds=$old_postinstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$future_libdirs"; then
+ $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+ fi
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ test -n "$run" && current_libdirs=" -n$current_libdirs"
+ exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+ else
+ exit $EXIT_SUCCESS
+ fi
+ ;;
+
+ # libtool finish mode
+ finish)
+ modename="$modename: finish"
+ libdirs="$nonopt"
+ admincmds=
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for dir
+ do
+ libdirs="$libdirs $dir"
+ done
+
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ cmds=$finish_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || admincmds="$admincmds
+ $cmd"
+ done
+ IFS="$save_ifs"
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $run eval "$cmds" || admincmds="$admincmds
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ test "$show" = : && exit $EXIT_SUCCESS
+
+ $echo "X----------------------------------------------------------------------" | $Xsed
+ $echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ $echo " $libdir"
+ done
+ $echo
+ $echo "If you ever happen to want to link against installed libraries"
+ $echo "in a given directory, LIBDIR, you must either use libtool, and"
+ $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+ $echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ $echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ $echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ $echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ $echo " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ $echo " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ $echo
+ $echo "See any operating system documentation about shared libraries for"
+ $echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ $echo "X----------------------------------------------------------------------" | $Xsed
+ exit $EXIT_SUCCESS
+ ;;
+
+ # libtool execute mode
+ execute)
+ modename="$modename: execute"
+
+ # The first argument is the command name.
+ cmd="$nonopt"
+ if test -z "$cmd"; then
+ $echo "$modename: you must specify a COMMAND" 1>&2
+ $echo "$help"
+ exit $EXIT_FAILURE
+ fi
+
+ # Handle -dlopen flags immediately.
+ for file in $execute_dlfiles; do
+ if test ! -f "$file"; then
+ $echo "$modename: \`$file' is not a file" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ dir=
+ case $file in
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+
+ if test -f "$dir/$objdir/$dlname"; then
+ dir="$dir/$objdir"
+ else
+ if test ! -f "$dir/$dlname"; then
+ $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ ;;
+
+ *)
+ $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case $file in
+ -*) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+ args="$args \"$file\""
+ done
+
+ if test -z "$run"; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved environment variables
+ for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+ do
+ eval "if test \"\${save_$lt_var+set}\" = set; then
+ $lt_var=\$save_$lt_var; export $lt_var
+ fi"
+ done
+
+ # Now prepare to actually exec the command.
+ exec_cmd="\$cmd$args"
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+ $echo "export $shlibpath_var"
+ fi
+ $echo "$cmd$args"
+ exit $EXIT_SUCCESS
+ fi
+ ;;
+
+ # libtool clean and uninstall mode
+ clean | uninstall)
+ modename="$modename: $mode"
+ rm="$nonopt"
+ files=
+ rmforce=
+ exit_status=0
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ for arg
+ do
+ case $arg in
+ -f) rm="$rm $arg"; rmforce=yes ;;
+ -*) rm="$rm $arg" ;;
+ *) files="$files $arg" ;;
+ esac
+ done
+
+ if test -z "$rm"; then
+ $echo "$modename: you must specify an RM program" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ rmdirs=
+
+ origobjdir="$objdir"
+ for file in $files; do
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$file"; then
+ dir=.
+ objdir="$origobjdir"
+ else
+ objdir="$dir/$origobjdir"
+ fi
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ test "$mode" = uninstall && objdir="$dir"
+
+ # Remember objdir for removal later, being careful to avoid duplicates
+ if test "$mode" = clean; then
+ case " $rmdirs " in
+ *" $objdir "*) ;;
+ *) rmdirs="$rmdirs $objdir" ;;
+ esac
+ fi
+
+ # Don't error if the file doesn't exist and rm -f was used.
+ if (test -L "$file") >/dev/null 2>&1 \
+ || (test -h "$file") >/dev/null 2>&1 \
+ || test -f "$file"; then
+ :
+ elif test -d "$file"; then
+ exit_status=1
+ continue
+ elif test "$rmforce" = yes; then
+ continue
+ fi
+
+ rmfiles="$file"
+
+ case $name in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ . $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ rmfiles="$rmfiles $objdir/$n"
+ done
+ test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+
+ case "$mode" in
+ clean)
+ case " $library_names " in
+ # " " in the beginning catches empty $dlname
+ *" $dlname "*) ;;
+ *) rmfiles="$rmfiles $objdir/$dlname" ;;
+ esac
+ test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+ ;;
+ uninstall)
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ cmds=$postuninstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd"
+ if test "$?" -ne 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ cmds=$old_postuninstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd"
+ if test "$?" -ne 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+ IFS="$save_ifs"
+ fi
+ # FIXME: should reinstall the best remaining shared library.
+ ;;
+ esac
+ fi
+ ;;
+
+ *.lo)
+ # Possibly a libtool object, so verify it.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+
+ # Read the .lo file
+ . $dir/$name
+
+ # Add PIC object to the list of files to remove.
+ if test -n "$pic_object" \
+ && test "$pic_object" != none; then
+ rmfiles="$rmfiles $dir/$pic_object"
+ fi
+
+ # Add non-PIC object to the list of files to remove.
+ if test -n "$non_pic_object" \
+ && test "$non_pic_object" != none; then
+ rmfiles="$rmfiles $dir/$non_pic_object"
+ fi
+ fi
+ ;;
+
+ *)
+ if test "$mode" = clean ; then
+ noexename=$name
+ case $file in
+ *.exe)
+ file=`$echo $file|${SED} 's,.exe$,,'`
+ noexename=`$echo $name|${SED} 's,.exe$,,'`
+ # $file with .exe has already been added to rmfiles,
+ # add $file without .exe
+ rmfiles="$rmfiles $file"
+ ;;
+ esac
+ # Do a test to see if this is a libtool program.
+ if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ relink_command=
+ . $dir/$noexename
+
+ # note $name still contains .exe if it was in $file originally
+ # as does the version of $file that was added into $rmfiles
+ rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+ if test "$fast_install" = yes && test -n "$relink_command"; then
+ rmfiles="$rmfiles $objdir/lt-$name"
+ fi
+ if test "X$noexename" != "X$name" ; then
+ rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+ fi
+ fi
+ fi
+ ;;
+ esac
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles || exit_status=1
+ done
+ objdir="$origobjdir"
+
+ # Try to remove the ${objdir}s in the directories where we deleted files
+ for dir in $rmdirs; do
+ if test -d "$dir"; then
+ $show "rmdir $dir"
+ $run rmdir $dir >/dev/null 2>&1
+ fi
+ done
+
+ exit $exit_status
+ ;;
+
+ "")
+ $echo "$modename: you must specify a MODE" 1>&2
+ $echo "$generic_help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ if test -z "$exec_cmd"; then
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$generic_help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+ eval exec $exec_cmd
+ exit $EXIT_FAILURE
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+ --config show all configuration variables
+ --debug enable verbose shell tracing
+-n, --dry-run display commands without modifying any files
+ --features display basic configuration information and exit
+ --finish same as \`--mode=finish'
+ --help display this help message and exit
+ --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
+ --quiet same as \`--silent'
+ --silent don't print informational messages
+ --tag=TAG use configuration variables from tag TAG
+ --version print version information
+
+MODE must be one of the following:
+
+ clean remove files from the build directory
+ compile compile a source file into a libtool object
+ execute automatically set library path, then run a program
+ finish complete the installation of libtool libraries
+ install install libraries or executables
+ link create a library or an executable
+ uninstall remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE.
+
+Report bugs to <bug-libtool@gnu.org>."
+ exit $EXIT_SUCCESS
+ ;;
+
+clean)
+ $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+compile)
+ $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -prefer-pic try to building PIC objects only
+ -prefer-non-pic try to building non-PIC objects only
+ -static always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+execute)
+ $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+finish)
+ $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+install)
+ $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+link)
+ $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-fast-install disable the fast-install mode
+ -no-install link a not-installable executable
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -objectlist FILE Use a list of object files found in FILE to specify objects
+ -precious-files-regex REGEX
+ don't remove output files matching REGEX
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -static do not do any dynamic linking of uninstalled libtool libraries
+ -static-libtool-libs
+ do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+uninstall)
+ $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+*)
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+esac
+
+$echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit $?
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries. Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them. This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration. But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+disable_libs=shared
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+disable_libs=static
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/Build/source/libs/graphite/config/missing b/Build/source/libs/graphite/config/missing
new file mode 100755
index 00000000000..f359dae7a87
--- /dev/null
+++ b/Build/source/libs/graphite/config/missing
@@ -0,0 +1,375 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2008-12-21.33
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ autom4te touch the output file, or create a stub one
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
+Send bug reports to <bug-automake@gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# normalize program name to check for.
+program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program). This is about non-GNU programs, so use $1 not
+# $program.
+case $1 in
+ lex*|yacc*)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ tar*)
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ exit 1
+ fi
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $program in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case $f in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te*)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison*|yacc*)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f y.tab.h; then
+ echo >y.tab.h
+ fi
+ if test ! -f y.tab.c; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex*|flex*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f lex.yy.c; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit $?
+ fi
+ ;;
+
+ makeinfo*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '
+ /^@setfilename/{
+ s/.* \([^ ]*\) *$/\1/
+ p
+ q
+ }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ tar*)
+ shift
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar "$@" && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar "$@" && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+ case $firstarg in
+ *o*)
+ firstarg=`echo "$firstarg" | sed s/o//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ case $firstarg in
+ *h*)
+ firstarg=`echo "$firstarg" | sed s/h//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/Build/source/libs/graphite/configure b/Build/source/libs/graphite/configure
new file mode 100755
index 00000000000..8a7063533cc
--- /dev/null
+++ b/Build/source/libs/graphite/configure
@@ -0,0 +1,22334 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.61a for silgraphite 2.3.
+#
+# Report bugs to <silgraphite-devel@lists.sourceforge.net>.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+ if (eval ":") 2>/dev/null; then
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+
+ if test $as_have_required = yes && (eval ":
+(as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=\$LINENO
+ as_lineno_2=\$LINENO
+ test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+ test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+ :
+else
+ as_candidate_shells=
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ case $as_dir in
+ /*)
+ for as_base in sh bash ksh sh5; do
+ as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+ done;;
+ esac
+done
+IFS=$as_save_IFS
+
+
+ for as_shell in $as_candidate_shells $SHELL; do
+ # Try only shells that exist, to save several forks.
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { ("$as_shell") 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+_ASEOF
+}; then
+ CONFIG_SHELL=$as_shell
+ as_have_required=yes
+ if { "$as_shell" 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+(as_func_return () {
+ (exit $1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+ break
+fi
+
+fi
+
+ done
+
+ if test "x$CONFIG_SHELL" != x; then
+ for as_var in BASH_ENV ENV
+ do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ done
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+ if test $as_have_required = no; then
+ echo This script requires a shell more modern than all the
+ echo shells that I found on your system. Please install a
+ echo modern shell, or manually run the script under such a
+ echo shell if you do have one.
+ { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+ echo No shell found that supports shell functions.
+ echo Please tell autoconf@gnu.org about your system,
+ echo including any error possibly output before this
+ echo message
+}
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+ # Remove one level of quotation (which was required for Make).
+ ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
+ ;;
+esac
+
+echo=${ECHO-echo}
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell.
+ exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+ echo_test_string=`eval $cmd` &&
+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+ then
+ break
+ fi
+ done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ if test "X$echo" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ echo='print -r'
+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+ else
+ # Try using printf.
+ echo='printf %s\n'
+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ echo="$CONFIG_SHELL $0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$CONFIG_SHELL $0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "$0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ echo=echo
+ fi
+ fi
+ fi
+ fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+ ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+
+tagnames=${tagnames+${tagnames},}CXX
+
+tagnames=${tagnames+${tagnames},}F77
+
+exec 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME='silgraphite'
+PACKAGE_TARNAME='silgraphite'
+PACKAGE_VERSION='2.3'
+PACKAGE_STRING='silgraphite 2.3'
+PACKAGE_BUGREPORT='silgraphite-devel@lists.sourceforge.net'
+
+ac_unique_file="src/segment/GrEngine.cpp"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+am__isrc
+CYGPATH_W
+PACKAGE
+VERSION
+ACLOCAL
+AUTOCONF
+AUTOMAKE
+AUTOHEADER
+MAKEINFO
+install_sh
+STRIP
+INSTALL_STRIP_PROGRAM
+mkdir_p
+AWK
+SET_MAKE
+am__leading_dot
+AMTAR
+am__tar
+am__untar
+MAINTAINER_MODE_TRUE
+MAINTAINER_MODE_FALSE
+MAINT
+build
+build_cpu
+build_vendor
+build_os
+host
+host_cpu
+host_vendor
+host_os
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+DEPDIR
+am__include
+am__quote
+AMDEP_TRUE
+AMDEP_FALSE
+AMDEPBACKSLASH
+CCDEPMODE
+am__fastdepCC_TRUE
+am__fastdepCC_FALSE
+CPP
+GREP
+EGREP
+SED
+LN_S
+ECHO
+AR
+RANLIB
+DSYMUTIL
+NMEDIT
+CXX
+CXXFLAGS
+ac_ct_CXX
+CXXDEPMODE
+am__fastdepCXX_TRUE
+am__fastdepCXX_FALSE
+CXXCPP
+F77
+FFLAGS
+ac_ct_F77
+LIBTOOL
+LSB_RELEASE
+SIZEOF_WCHAR_T
+REL_CODENAME
+LIBOBJS
+LTLIBOBJS'
+ac_subst_files=''
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+CXX
+CXXFLAGS
+CCC
+CXXCPP
+F77
+FFLAGS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
+ { (exit 1); exit 1; }; }
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-.]/_/g'`
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
+ { (exit 1); exit 1; }; }
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-.]/_/g'`
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
+ { (exit 1); exit 1; }; }
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-.]/_/g'`
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
+ { (exit 1); exit 1; }; }
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-.]/_/g'`
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) { $as_echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { $as_echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute directory names.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; }
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ { $as_echo "$as_me: error: Working directory cannot be determined" >&2
+ { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
+ { (exit 1); exit 1; }; }
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$0" ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
+ { (exit 1); exit 1; }; }
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures silgraphite 2.3 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/silgraphite]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of silgraphite 2.3:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --disable-tracing build without support for trace Graphite logs
+ --enable-debug build with debugging. (default=no)
+ --disable-final build without optimizations and no debugging.
+ --enable-strict treat warnings as errors, check for as much as we
+ can
+ --enable-profile allow profiling (default=no)
+ --enable-profilefn allow functioncheck profiling (default=no)
+ --enable-shared[=PKGS] build shared libraries [default=yes]
+ --enable-static[=PKGS] build static libraries [default=yes]
+ --enable-fast-install[=PKGS]
+ optimize for fast installation [default=yes]
+ --disable-libtool-lock avoid locking (might break parallel builds)
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-tags[=TAGS] include additional configurations [automatic]
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+ CXX C++ compiler command
+ CXXFLAGS C++ compiler flags
+ CXXCPP C++ preprocessor
+ F77 Fortran 77 compiler command
+ FFLAGS Fortran 77 compiler flags
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <silgraphite-devel@lists.sourceforge.net>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" || continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+silgraphite configure 2.3
+generated by GNU Autoconf 2.61a
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by silgraphite $as_me 2.3, which was
+generated by GNU Autoconf 2.61a. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args '$ac_arg'"
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -n "$CONFIG_SITE"; then
+ set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+ set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+ set x "$ac_default_prefix/share/config.site" \
+ "$ac_default_prefix/etc/config.site"
+fi
+shift
+for ac_site_file
+do
+ if test -r "$ac_site_file"; then
+ { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { $as_echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+$as_echo "$as_me: former value: $ac_old_val" >&2;}
+ { $as_echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+$as_echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+ac_aux_dir=
+for ac_dir in config "$srcdir"/config; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&5
+$as_echo "$as_me: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+
+# setup automake
+am__api_version='1.10'
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+IFS=$as_save_IFS
+
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&5
+$as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+$as_echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+{ $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in mkdir gmkdir; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+ 'mkdir (GNU coreutils) '* | \
+ 'mkdir (coreutils) '* | \
+ 'mkdir (fileutils) '4.1*)
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+ break 3;;
+ esac
+ done
+ done
+done
+IFS=$as_save_IFS
+
+fi
+
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ MKDIR_P="$ac_cv_path_mkdir -p"
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for MKDIR_P within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ test -d ./--version && rmdir ./--version
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+ [\\/$]* | ?:[\\/]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:$LINENO: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ am__isrc=' -I$(srcdir)'
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='silgraphite'
+ VERSION='2.3'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+{ $as_echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
+ # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+ enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi
+
+ { $as_echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
+$as_echo "$USE_MAINTAINER_MODE" >&6; }
+ if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
+else
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
+fi
+
+ MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+# System checks.
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+ { (exit 1); exit 1; }; }
+
+{ $as_echo "$as_me:$LINENO: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+ { (exit 1); exit 1; }; }
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+$as_echo "$as_me: error: invalid value of canonical build" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:$LINENO: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+$as_echo "$as_me: error: invalid value of canonical host" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+
+
+{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort. b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions. Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+
+{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+if test -z "$ac_file"; then
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_compiler_gnu=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cc_g=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cc_g=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cc_c89=$ac_arg
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:$LINENO: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:$LINENO: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ # Broken: success on invalid input.
+continue
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:$LINENO: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ # Broken: success on invalid input.
+continue
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_path_GREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+ # Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+ $ac_path_GREP_found && break 3
+ done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+ { { $as_echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+$as_echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_path_EGREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+ # Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+ $ac_path_EGREP_found && break 3
+ done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+ { { $as_echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+$as_echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_header_stdc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ eval "$as_ac_Header=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+{ $as_echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
+if test "${ac_cv_c_bigendian+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ # See if sys/param.h defines the BYTE_ORDER macro.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/param.h>
+
+int
+main ()
+{
+#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
+ && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
+ bogus endian macros
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ # It does; now see whether it defined to BIG_ENDIAN or not.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/param.h>
+
+int
+main ()
+{
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_c_bigendian=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_c_bigendian=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # It does not; compile a test program.
+if test "$cross_compiling" = yes; then
+ # try to guess the endianness by grepping values into an object file
+ ac_cv_c_bigendian=unknown
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
+short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
+int
+main ()
+{
+ _ascii (); _ebcdic ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
+ ac_cv_c_bigendian=yes
+fi
+if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+ if test "$ac_cv_c_bigendian" = unknown; then
+ ac_cv_c_bigendian=no
+ else
+ # finding both strings is unlikely to happen, but who knows?
+ ac_cv_c_bigendian=unknown
+ fi
+fi
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ /* Are we little or big endian? From Harbison&Steele. */
+ union
+ {
+ long int l;
+ char c[sizeof (long int)];
+ } u;
+ u.l = 1;
+ return u.c[sizeof (long int) - 1] == 1;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_bigendian=no
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_c_bigendian=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+$as_echo "$ac_cv_c_bigendian" >&6; }
+case $ac_cv_c_bigendian in
+ yes)
+
+cat >>confdefs.h <<\_ACEOF
+#define WORDS_BIGENDIAN 1
+_ACEOF
+ ;;
+ no)
+ ;;
+ *)
+ { { $as_echo "$as_me:$LINENO: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&5
+$as_echo "$as_me: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+
+
+# Optional features
+# Check whether --enable-tracing was given.
+if test "${enable_tracing+set}" = set; then
+ enableval=$enable_tracing;
+fi
+
+ test "x$enable_tracing" != xno && enable_tracing=yes
+
+# Check whether --enable-debug was given.
+if test "${enable_debug+set}" = set; then
+ enableval=$enable_debug;
+fi
+
+# Check whether --enable-final was given.
+if test "${enable_final+set}" = set; then
+ enableval=$enable_final;
+fi
+
+ test "x$enable_final" != xno && enable_final=yes
+# Check whether --enable-strict was given.
+if test "${enable_strict+set}" = set; then
+ enableval=$enable_strict;
+fi
+
+
+# Check whether --enable-profile was given.
+if test "${enable_profile+set}" = set; then
+ enableval=$enable_profile;
+fi
+
+# Check whether --enable-profilefn was given.
+if test "${enable_profilefn+set}" = set; then
+ enableval=$enable_profilefn;
+fi
+
+
+# Checks for programs.
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+IFS=$as_save_IFS
+
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+# Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval=$enable_shared; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_shared=yes
+fi
+
+
+# Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval=$enable_static; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_static=yes
+fi
+
+
+# Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval=$enable_fast_install; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_fast_install=yes
+fi
+
+
+{ $as_echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if test "${lt_cv_path_SED+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for lt_ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$lt_ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$lt_ac_prog$ac_exec_ext"; }; then
+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+ fi
+ done
+ done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && continue
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
+ fi
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
+ fi
+ done
+done
+
+fi
+
+SED=$lt_cv_path_SED
+
+{ $as_echo "$as_me:$LINENO: result: $SED" >&5
+$as_echo "$SED" >&6; }
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { $as_echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ { $as_echo "$as_me:$LINENO: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+ { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:$LINENO: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+$as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+{ $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+{ $as_echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+
+{ $as_echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+$as_echo_n "checking for BSD-compatible nm... " >&6; }
+if test "${lt_cv_path_NM+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+NM="$lt_cv_path_NM"
+
+{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+{ $as_echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[45]*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ if ( file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[3-9]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+nto-qnx*)
+ lt_cv_deplibs_check_method=unknown
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line 5245 "configure"' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ { $as_echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ lt_cv_cc_needs_belf=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ lt_cv_cc_needs_belf=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+sparc*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+
+esac
+
+need_locks="$enable_libtool_lock"
+
+
+
+for ac_header in dlfcn.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------------------------ ##
+## Report this to silgraphite-devel@lists.sourceforge.net ##
+## ------------------------------------------------------ ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+ if test -n "$CCC"; then
+ CXX=$CCC
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CXX"; then
+ ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+ { $as_echo "$as_me:$LINENO: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CXX" && break
+ done
+fi
+if test -z "$CXX"; then
+ ac_ct_CXX=$CXX
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CXX"; then
+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CXX="$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CXX" && break
+done
+
+ if test "x$ac_ct_CXX" = x; then
+ CXX="g++"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CXX=$ac_ct_CXX
+ fi
+fi
+
+ fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:$LINENO: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_compiler_gnu=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GXX=yes
+else
+ GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+ ac_cxx_werror_flag=yes
+ ac_cv_prog_cxx_g=no
+ CXXFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cxx_g=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CXXFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+ CXXFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cxx_g=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-g"
+ fi
+else
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ fi
+fi
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+depcc="$CXX" am_compiler_list=
+
+{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CXX_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CXX_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+ am__fastdepCXX_TRUE=
+ am__fastdepCXX_FALSE='#'
+else
+ am__fastdepCXX_TRUE='#'
+ am__fastdepCXX_FALSE=
+fi
+
+
+
+
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ $as_echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
+$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
+if test -z "$CXXCPP"; then
+ if test "${ac_cv_prog_CXXCPP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CXXCPP needs to be expanded
+ for CXXCPP in "$CXX -E" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ # Broken: success on invalid input.
+continue
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+ CXXCPP=$ac_cv_prog_CXXCPP
+else
+ ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ $as_echo "$as_me:$LINENO: result: $CXXCPP" >&5
+$as_echo "$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ # Broken: success on invalid input.
+continue
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { $as_echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+fi
+
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_F77+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$F77"; then
+ ac_cv_prog_F77="$F77" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+F77=$ac_cv_prog_F77
+if test -n "$F77"; then
+ { $as_echo "$as_me:$LINENO: result: $F77" >&5
+$as_echo "$F77" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$F77" && break
+ done
+fi
+if test -z "$F77"; then
+ ac_ct_F77=$F77
+ for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_F77+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_F77"; then
+ ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_F77="$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_F77=$ac_cv_prog_ac_ct_F77
+if test -n "$ac_ct_F77"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
+$as_echo "$ac_ct_F77" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_F77" && break
+done
+
+ if test "x$ac_ct_F77" = x; then
+ F77=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ F77=$ac_ct_F77
+ fi
+fi
+
+
+# Provide some information about the compiler.
+$as_echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+rm -f a.out
+
+# If we don't use `.F' as extension, the preprocessor is not run on the
+# input file. (Note that this only needs to work for GNU compilers.)
+ac_save_ext=$ac_ext
+ac_ext=F
+{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
+$as_echo_n "checking whether we are using the GNU Fortran 77 compiler... " >&6; }
+if test "${ac_cv_f77_compiler_gnu+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+ program main
+#ifndef __GNUC__
+ choke me
+#endif
+
+ end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_f77_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_compiler_gnu=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_f77_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
+$as_echo "$ac_cv_f77_compiler_gnu" >&6; }
+ac_ext=$ac_save_ext
+ac_test_FFLAGS=${FFLAGS+set}
+ac_save_FFLAGS=$FFLAGS
+FFLAGS=
+{ $as_echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
+$as_echo_n "checking whether $F77 accepts -g... " >&6; }
+if test "${ac_cv_prog_f77_g+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ FFLAGS=-g
+cat >conftest.$ac_ext <<_ACEOF
+ program main
+
+ end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_f77_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_f77_g=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_prog_f77_g=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
+$as_echo "$ac_cv_prog_f77_g" >&6; }
+if test "$ac_test_FFLAGS" = set; then
+ FFLAGS=$ac_save_FFLAGS
+elif test $ac_cv_prog_f77_g = yes; then
+ if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+ FFLAGS="-g -O2"
+ else
+ FFLAGS="-g"
+ fi
+else
+ if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+ FFLAGS="-O2"
+ else
+ FFLAGS=
+ fi
+fi
+
+if test $ac_compiler_gnu = yes; then
+ G77=yes
+else
+ G77=
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
+ = "XX$teststring") >/dev/null 2>&1 &&
+ new_result=`expr "X$teststring" : ".*" 2>&1` &&
+ lt_cv_sys_max_cmd_len=$new_result &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on massive
+ # amounts of additional arguments before passing them to the linker.
+ # It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+ { $as_echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: none" >&5
+$as_echo "none" >&6; }
+fi
+
+
+
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw* | pw32*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*) # Its linker distinguishes data from code symbols
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDEGRST]'
+ fi
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ ;;
+linux* | k*bsd*-gnu)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDGIRSTW]'
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[BCDEGRST]'
+ ;;
+osf*)
+ symcode='[BCDEGQRST]'
+ ;;
+solaris*)
+ symcode='[BDRT]'
+ ;;
+sco3.2v5*)
+ symcode='[DT]'
+ ;;
+sysv4.2uw2*)
+ symcode='[DT]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[ABDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
+ (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if grep ' nm_test_var$' "$nlist" >/dev/null; then
+ if grep ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+ cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+ cat <<\EOF >> conftest.$ac_ext
+ {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_save_LIBS="$LIBS"
+ lt_save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS="$lt_save_LIBS"
+ CFLAGS="$lt_save_CFLAGS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ { $as_echo "$as_me:$LINENO: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if test "${lt_cv_objdir+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:$LINENO: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_AR="ar"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AR" = x; then
+ AR="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ { $as_echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ { $as_echo "$as_me:$LINENO: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+
+ case $host_os in
+ rhapsody* | darwin*)
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DSYMUTIL+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DSYMUTIL"; then
+ ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+ { $as_echo "$as_me:$LINENO: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+ ac_ct_DSYMUTIL=$DSYMUTIL
+ # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DSYMUTIL"; then
+ ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DSYMUTIL" = x; then
+ DSYMUTIL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ DSYMUTIL=$ac_ct_DSYMUTIL
+ fi
+else
+ DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_NMEDIT+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NMEDIT"; then
+ ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+ { $as_echo "$as_me:$LINENO: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+ ac_ct_NMEDIT=$NMEDIT
+ # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_NMEDIT"; then
+ ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_NMEDIT="nmedit"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_NMEDIT" = x; then
+ NMEDIT=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ NMEDIT=$ac_ct_NMEDIT
+ fi
+else
+ NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+
+ { $as_echo "$as_me:$LINENO: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if test "${lt_cv_apple_cc_single_mod+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ echo "int foo(void){return 1;}" > conftest.c
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib ${wl}-single_module conftest.c
+ if test -f libconftest.dylib; then
+ lt_cv_apple_cc_single_mod=yes
+ rm -rf libconftest.dylib*
+ fi
+ rm conftest.c
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+ { $as_echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if test "${lt_cv_ld_exported_symbols_list+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ lt_cv_ld_exported_symbols_list=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ lt_cv_ld_exported_symbols_list=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+ case $host_os in
+ rhapsody* | darwin1.[0123])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*)
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[012]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}"
+ fi
+ if test "$DSYMUTIL" != ":"; then
+ _lt_dsymutil="~$DSYMUTIL \$lib || :"
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+
+
+enable_dlopen=no
+enable_win32_dll=no
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then
+ withval=$with_pic; pic_mode="$withval"
+else
+ pic_mode=default
+fi
+
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm -r conftest*
+
+
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+
+{ $as_echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_rtti_exceptions=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:7861: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:7865: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_rtti_exceptions=yes
+ fi
+ fi
+ $rm conftest*
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+ lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+ :
+fi
+
+fi
+
+lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_static='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic='-fno-common'
+ ;;
+
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared=no
+ enable_shared=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic=-Kconform_pic
+ fi
+ ;;
+
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ ;;
+
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ else
+ lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ lt_prog_compiler_pic='-qnocommon'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ esac
+ ;;
+
+ mingw* | cygwin* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ icc* | ecc*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ *Sun\ F*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl=''
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ rdos*)
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ lt_prog_compiler_wl='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl='-Qoption ld '
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic='-Kconform_pic'
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_can_build_shared=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic='-pic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared=no
+ ;;
+ esac
+ fi
+
+{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+$as_echo "$lt_prog_compiler_pic" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+
+{ $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_works=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:8151: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:8155: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_pic_works=yes
+ fi
+ fi
+ $rm conftest*
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+ case $lt_prog_compiler_pic in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+ esac
+else
+ lt_prog_compiler_pic=
+ lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic=
+ ;;
+ *)
+ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+ ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if test "${lt_cv_prog_compiler_static_works+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_static_works=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ fi
+ $rm -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+ :
+else
+ lt_prog_compiler_static=
+fi
+
+
+{ $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $rm -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:8255: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:8259: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $rm conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+ $rm out/* && rmdir out
+ cd ..
+ rmdir conftest
+ $rm conftest*
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { $as_echo "$as_me:$LINENO: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+{ $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+ runpath_var=
+ allow_undefined_flag=
+ enable_shared_with_static_runtimes=no
+ archive_cmds=
+ archive_expsym_cmds=
+ old_archive_From_new_cmds=
+ old_archive_from_expsyms_cmds=
+ export_dynamic_flag_spec=
+ whole_archive_flag_spec=
+ thread_safe_flag_spec=
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_flag_spec_ld=
+ hardcode_libdir_separator=
+ hardcode_direct=no
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=unsupported
+ link_all_deplibs=unknown
+ hardcode_automatic=no
+ module_cmds=
+ module_expsym_cmds=
+ always_export_symbols=no
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+ extract_expsyms_cmds=
+ # Just being paranoid about ensuring that cc_basename is set.
+ for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+ case $host_os in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ ld_shlibs=yes
+ if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>/dev/null` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[3-9]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ fi
+ ;;
+
+ amigaos*)
+ archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can't use
+ # them.
+ ld_shlibs=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ allow_undefined_flag=unsupported
+ always_export_symbols=no
+ enable_shared_with_static_runtimes=yes
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | k*bsd*-gnu)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ tmp_addflag=
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ *)
+ tmp_sharedflag='-shared' ;;
+ esac
+ archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test $supports_anon_versioning = yes; then
+ archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ $echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec=
+ export_dynamic_flag_spec=
+ whole_archive_flag_spec=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds=''
+ hardcode_direct=yes
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag=' ${wl}-bernotok'
+ allow_undefined_flag=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
+ archive_cmds_need_lc=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_From_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path='`cygpath -w "$srcfile"`'
+ enable_shared_with_static_runtimes=yes
+ ;;
+
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ archive_cmds_need_lc=no
+ hardcode_direct=no
+ hardcode_automatic=yes
+ hardcode_shlibpath_var=unsupported
+ whole_archive_flag_spec=''
+ link_all_deplibs=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+ module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+ fi
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+
+ hardcode_direct=yes
+ export_dynamic_flag_spec='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_libdir_flag_spec_ld='+b $libdir'
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ ;;
+ *)
+ hardcode_direct=yes
+ export_dynamic_flag_spec='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_ld='-rpath $libdir'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ link_all_deplibs=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ newsos6)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_shlibpath_var=no
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ hardcode_libdir_separator=:
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z text'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+ else
+ wlarc=''
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ link_all_deplibs=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds='$CC -r -o $output$reload_objs'
+ hardcode_direct=no
+ ;;
+ motorola)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag='${wl}-z,text'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag='${wl}-z,text'
+ allow_undefined_flag='${wl}-z,nodefs'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ export_dynamic_flag_spec='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+ fi
+
+{ $as_echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+ $rm conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl
+ pic_flag=$lt_prog_compiler_pic
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+ (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ then
+ archive_cmds_need_lc=no
+ else
+ archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $rm conftest*
+ { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+$as_echo "$archive_cmds_need_lc" >&6; }
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+{ $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[lt_foo]++; }
+ if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+ sys_lib_search_path_spec=`echo $lt_search_path_spec`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[4-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $rm \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[123]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+interix[3-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+nto-qnx*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ shlibpath_overrides_runpath=no
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ shlibpath_overrides_runpath=yes
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
+fi
+
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
+fi
+
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+ test -n "$runpath_var" || \
+ test "X$hardcode_automatic" = "Xyes" ; then
+
+ # We can hardcode non-existant directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:$LINENO: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+ ;;
+ *)
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ ;;
+ esac
+fi
+
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_lib_dl_dlopen=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+
+fi
+
+ ;;
+
+ *)
+ { $as_echo "$as_me:$LINENO: checking for shl_load" >&5
+$as_echo_n "checking for shl_load... " >&6; }
+if test "${ac_cv_func_shl_load+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define shl_load innocuous_shl_load
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char shl_load (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef shl_load
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_shl_load || defined __stub___shl_load
+choke me
+#endif
+
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_func_shl_load=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_func_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+$as_echo "$ac_cv_func_shl_load" >&6; }
+if test $ac_cv_func_shl_load = yes; then
+ lt_cv_dlopen="shl_load"
+else
+ { $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_lib_dld_shl_load=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dld_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test $ac_cv_lib_dld_shl_load = yes; then
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+ { $as_echo "$as_me:$LINENO: checking for dlopen" >&5
+$as_echo_n "checking for dlopen... " >&6; }
+if test "${ac_cv_func_dlopen+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef dlopen
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_dlopen || defined __stub___dlopen
+choke me
+#endif
+
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_func_dlopen=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_func_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+$as_echo "$ac_cv_func_dlopen" >&6; }
+if test $ac_cv_func_dlopen = yes; then
+ lt_cv_dlopen="dlopen"
+else
+ { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_lib_dl_dlopen=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ { $as_echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_lib_svld_dlopen=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_svld_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test $ac_cv_lib_svld_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+ { $as_echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_lib_dld_dld_link=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dld_dld_link=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test $ac_cv_lib_dld_dld_link = yes; then
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ { $as_echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+#line 10628 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ exit (status);
+}
+EOF
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ { $as_echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self_static=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+#line 10728 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ exit (status);
+}
+EOF
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self_static=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+
+# Report which library types will actually be built
+{ $as_echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+{ $as_echo "$as_me:$LINENO: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+{ $as_echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+aix[4-9]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+{ $as_echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+{ $as_echo "$as_me:$LINENO: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ compiler \
+ CC \
+ LD \
+ lt_prog_compiler_wl \
+ lt_prog_compiler_pic \
+ lt_prog_compiler_static \
+ lt_prog_compiler_no_builtin_flag \
+ export_dynamic_flag_spec \
+ thread_safe_flag_spec \
+ whole_archive_flag_spec \
+ enable_shared_with_static_runtimes \
+ old_archive_cmds \
+ old_archive_from_new_cmds \
+ predep_objects \
+ postdep_objects \
+ predeps \
+ postdeps \
+ compiler_lib_search_path \
+ compiler_lib_search_dirs \
+ archive_cmds \
+ archive_expsym_cmds \
+ postinstall_cmds \
+ postuninstall_cmds \
+ old_archive_from_expsyms_cmds \
+ allow_undefined_flag \
+ no_undefined_flag \
+ export_symbols_cmds \
+ hardcode_libdir_flag_spec \
+ hardcode_libdir_flag_spec_ld \
+ hardcode_libdir_separator \
+ hardcode_automatic \
+ module_cmds \
+ module_expsym_cmds \
+ lt_cv_prog_compiler_c_o \
+ fix_srcfile_path \
+ exclude_expsyms \
+ include_expsyms; do
+
+ case $var in
+ old_archive_cmds | \
+ old_archive_from_new_cmds | \
+ archive_cmds | \
+ archive_expsym_cmds | \
+ module_cmds | \
+ module_expsym_cmds | \
+ old_archive_from_expsyms_cmds | \
+ export_symbols_cmds | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\$0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+cfgfile="${ofile}T"
+ trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+ $rm -f "$cfgfile"
+ { $as_echo "$as_me:$LINENO: creating $ofile" >&5
+$as_echo "$as_me: creating $ofile" >&6;}
+
+ cat <<__EOF__ >> "$cfgfile"
+#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# 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 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps
+
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+
+ case $host_os in
+ aix3*)
+ cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+EOF
+ ;;
+ esac
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" || \
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+# Check whether --with-tags was given.
+if test "${with_tags+set}" = set; then
+ withval=$with_tags; tagnames="$withval"
+fi
+
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+ if test ! -f "${ofile}"; then
+ { $as_echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5
+$as_echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;}
+ fi
+
+ if test -z "$LTCC"; then
+ eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+ if test -z "$LTCC"; then
+ { $as_echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5
+$as_echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;}
+ else
+ { $as_echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5
+$as_echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;}
+ fi
+ fi
+ if test -z "$LTCFLAGS"; then
+ eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+ fi
+
+ # Extract list of available tagged configurations in $ofile.
+ # Note that this assumes the entire list is on one line.
+ available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for tagname in $tagnames; do
+ IFS="$lt_save_ifs"
+ # Check whether tagname contains only valid characters
+ case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in
+ "") ;;
+ *) { { $as_echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5
+$as_echo "$as_me: error: invalid tag name: $tagname" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+ esac
+
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+ then
+ { { $as_echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5
+$as_echo "$as_me: error: tag name \"$tagname\" already exists" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ # Update the list of available tags.
+ if test -n "$tagname"; then
+ echo appending configuration tag \"$tagname\" to $ofile
+
+ case $tagname in
+ CXX)
+ if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+compiler_lib_search_dirs_CXX=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[]) { return(0); }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm -r conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+ $as_unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+ lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+ $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+compiler_CXX=$CC
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+ lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+else
+ lt_prog_compiler_no_builtin_flag_CXX=
+fi
+
+if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { $as_echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ { $as_echo "$as_me:$LINENO: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+ { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:$LINENO: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+$as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+{ $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+ # Check if GNU C++ uses GNU ld as the underlying linker, since the
+ # archiving commands below assume that GNU ld is being used.
+ if test "$with_gnu_ld" = yes; then
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+ # investigate it a little bit more. (MM)
+ wlarc='${wl}'
+
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+ grep 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec_CXX=
+ fi
+ else
+ with_gnu_ld=no
+ wlarc=
+
+ # A generic and very simple default shared library creation
+ # command for GNU C++ for the case where it uses the native
+ # linker, instead of GNU ld. If possible, this setting should
+ # overridden to take advantage of the native linker features on
+ # the platform it is being used on.
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ fi
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+ GXX=no
+ with_gnu_ld=no
+ wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+{ $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+ld_shlibs_CXX=yes
+case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ aix[4-9]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ for ld_flag in $LDFLAGS; do
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds_CXX=''
+ hardcode_direct_CXX=yes
+ hardcode_libdir_separator_CXX=':'
+ link_all_deplibs_CXX=yes
+
+ if test "$GXX" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ hardcode_direct_CXX=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L_CXX=yes
+ hardcode_libdir_flag_spec_CXX='-L$libdir'
+ hardcode_libdir_separator_CXX=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols_CXX=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag_CXX='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag_CXX="-z nodefs"
+ archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag_CXX=' ${wl}-bernotok'
+ allow_undefined_flag_CXX=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec_CXX='$convenience'
+ archive_cmds_need_lc_CXX=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag_CXX=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec_CXX='-L$libdir'
+ allow_undefined_flag_CXX=unsupported
+ always_export_symbols_CXX=no
+ enable_shared_with_static_runtimes_CXX=yes
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ darwin* | rhapsody*)
+ archive_cmds_need_lc_CXX=no
+ hardcode_direct_CXX=no
+ hardcode_automatic_CXX=yes
+ hardcode_shlibpath_var_CXX=unsupported
+ whole_archive_flag_spec_CXX=''
+ link_all_deplibs_CXX=yes
+ allow_undefined_flag_CXX="$_lt_dar_allow_undefined"
+ if test "$GXX" = yes ; then
+ output_verbose_link_cmd='echo'
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+ fi
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+ module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ fi
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+ freebsd[12]*)
+ # C++ shared libraries reported to be fairly broken before switch to ELF
+ ld_shlibs_CXX=no
+ ;;
+ freebsd-elf*)
+ archive_cmds_need_lc_CXX=no
+ ;;
+ freebsd* | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ ld_shlibs_CXX=yes
+ ;;
+ gnu*)
+ ;;
+ hpux9*)
+ hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ hardcode_direct_CXX=yes
+ hardcode_minus_L_CXX=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ aCC*)
+ archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ case $host_cpu in
+ hppa*64*|ia64*) ;;
+ *)
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ ;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ ;;
+ *)
+ hardcode_direct_CXX=yes
+ hardcode_minus_L_CXX=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ esac
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+ interix[3-9]*)
+ hardcode_direct_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ # Archives containing C++ object files must be created using
+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test "$with_gnu_ld" = no; then
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+ fi
+ fi
+ link_all_deplibs_CXX=yes
+ ;;
+ esac
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+ ;;
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+ hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc*)
+ # Intel C++
+ with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
+ archive_cmds_need_lc_CXX=no
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ ;;
+ cxx*)
+ # Compaq C++
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ no_undefined_flag_CXX=' -zdefs'
+ archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+
+ # Not sure whether something based on
+ # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+ # would be better.
+ output_verbose_link_cmd='echo'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ m88k*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ hardcode_direct_CXX=yes
+ hardcode_shlibpath_var_CXX=no
+ fi
+ # Workaround some broken pre-1.5 toolchains
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+ ;;
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ ld_shlibs_CXX=no
+ ;;
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct_CXX=yes
+ hardcode_shlibpath_var_CXX=no
+ archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd='echo'
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ osf3*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ cxx*)
+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+ osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ old_archive_cmds_CXX='$CC -o $oldlib $oldobjs'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ cxx*)
+ allow_undefined_flag_CXX=' -expect_unresolved \*'
+ archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+ echo "-hidden">> $lib.exp~
+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+ $rm $lib.exp'
+
+ hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+ psos*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ archive_cmds_need_lc_CXX=yes
+ no_undefined_flag_CXX=' -zdefs'
+ archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ hardcode_shlibpath_var_CXX=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
+ ;;
+ esac
+ link_all_deplibs_CXX=yes
+
+ output_verbose_link_cmd='echo'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+ # The C++ compiler must be used to create the archive.
+ old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+ ;;
+ *)
+ # GNU C++ compiler with Solaris linker
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+ if $CC --version | grep -v '^2\.7' > /dev/null; then
+ archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+ fi
+
+ hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ ;;
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag_CXX='${wl}-z,text'
+ archive_cmds_need_lc_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ # So that behaviour is only enabled if SCOABSPATH is set to a
+ # non-empty value in the environment. Most likely only useful for
+ # creating official distributions of packages.
+ # This is a hack until libtool officially supports absolute path
+ # names for shared libraries.
+ no_undefined_flag_CXX='${wl}-z,text'
+ allow_undefined_flag_CXX='${wl}-z,nodefs'
+ archive_cmds_need_lc_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ hardcode_libdir_separator_CXX=':'
+ link_all_deplibs_CXX=yes
+ export_dynamic_flag_spec_CXX='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+GCC_CXX="$GXX"
+LD_CXX="$LD"
+
+cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+EOF
+
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Parse the compiler output and extract the necessary
+ # objects, libraries and library flags.
+
+ # Sentinel used to keep track of whether or not we are before
+ # the conftest object file.
+ pre_test_object_deps_done=no
+
+ # The `*' in the case matches for architectures that use `case' in
+ # $output_verbose_cmd can trigger glob expansion during the loop
+ # eval without this substitution.
+ output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+ for p in `eval $output_verbose_link_cmd`; do
+ case $p in
+
+ -L* | -R* | -l*)
+ # Some compilers place space between "-{L,R}" and the path.
+ # Remove the space.
+ if test $p = "-L" \
+ || test $p = "-R"; then
+ prev=$p
+ continue
+ else
+ prev=
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ case $p in
+ -L* | -R*)
+ # Internal compiler library paths should come after those
+ # provided the user. The postdeps already come after the
+ # user supplied libs so there is no need to process them.
+ if test -z "$compiler_lib_search_path_CXX"; then
+ compiler_lib_search_path_CXX="${prev}${p}"
+ else
+ compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+ fi
+ ;;
+ # The "-l" case would never come before the object being
+ # linked, so don't bother handling this case.
+ esac
+ else
+ if test -z "$postdeps_CXX"; then
+ postdeps_CXX="${prev}${p}"
+ else
+ postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+ fi
+ fi
+ ;;
+
+ *.$objext)
+ # This assumes that the test object file only shows up
+ # once in the compiler output.
+ if test "$p" = "conftest.$objext"; then
+ pre_test_object_deps_done=yes
+ continue
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$predep_objects_CXX"; then
+ predep_objects_CXX="$p"
+ else
+ predep_objects_CXX="$predep_objects_CXX $p"
+ fi
+ else
+ if test -z "$postdep_objects_CXX"; then
+ postdep_objects_CXX="$p"
+ else
+ postdep_objects_CXX="$postdep_objects_CXX $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$rm -f confest.$objext
+
+compiler_lib_search_dirs_CXX=
+if test -n "$compiler_lib_search_path_CXX"; then
+ compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+interix[3-9]*)
+ # Interix 3.5 installs completely hosed .la files for C++, so rather than
+ # hack all around it, let's just trust "g++" to DTRT.
+ predep_objects_CXX=
+ postdep_objects_CXX=
+ postdeps_CXX=
+ ;;
+
+linux*)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ #
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+ if test "$solaris_use_stlport4" != yes; then
+ postdeps_CXX='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+
+solaris*)
+ case $cc_basename in
+ CC*)
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ # Adding this requires a known-good setup of shared libraries for
+ # Sun compiler versions before 5.6, else PIC objects from an old
+ # archive will be linked into the output, leading to subtle bugs.
+ if test "$solaris_use_stlport4" != yes; then
+ postdeps_CXX='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+esac
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+
+lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+
+ # C++ specific cases for pic, static, wl, etc.
+ if test "$GXX" = yes; then
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_CXX='-Bstatic'
+ fi
+ ;;
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ mingw* | cygwin* | os2* | pw32*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+ ;;
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic_CXX='-fno-common'
+ ;;
+ *djgpp*)
+ # DJGPP does not support shared libraries at all
+ lt_prog_compiler_pic_CXX=
+ ;;
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic_CXX=-Kconform_pic
+ fi
+ ;;
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+ esac
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+ esac
+ else
+ case $host_os in
+ aix[4-9]*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_CXX='-Bstatic'
+ else
+ lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ cxch68*)
+ # Green Hills C++ Compiler
+ # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+ ;;
+ esac
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ lt_prog_compiler_pic_CXX='-qnocommon'
+ lt_prog_compiler_wl_CXX='-Wl,'
+ ;;
+ esac
+ ;;
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ lt_prog_compiler_pic_CXX='-KPIC'
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ lt_prog_compiler_pic_CXX='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | dragonfly*)
+ # FreeBSD uses GNU C++
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $cc_basename in
+ CC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+ if test "$host_cpu" != ia64; then
+ lt_prog_compiler_pic_CXX='+Z'
+ fi
+ ;;
+ aCC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX='+Z'
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ interix*)
+ # This is c89, which is MS Visual C++ (no shared libs)
+ # Anyone wants to do a port?
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case $cc_basename in
+ CC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='-non_shared'
+ # CC pic flag -KPIC is the default.
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ KCC*)
+ # KAI C++ Compiler
+ lt_prog_compiler_wl_CXX='--backend -Wl,'
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+ icpc* | ecpc*)
+ # Intel C++
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-static'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler.
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-fpic'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ ;;
+ cxx*)
+ # Compaq C++
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ lt_prog_compiler_pic_CXX=
+ lt_prog_compiler_static_CXX='-non_shared'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ lt_prog_compiler_wl_CXX='-Qoption ld '
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lynxos*)
+ ;;
+ m88k*)
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ lt_prog_compiler_pic_CXX='-W c,exportall'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ netbsd*)
+ ;;
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ lt_prog_compiler_wl_CXX='--backend -Wl,'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ lt_prog_compiler_pic_CXX='-pic'
+ ;;
+ cxx*)
+ # Digital/Compaq C++
+ lt_prog_compiler_wl_CXX='-Wl,'
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ lt_prog_compiler_pic_CXX=
+ lt_prog_compiler_static_CXX='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ psos*)
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ lt_prog_compiler_wl_CXX='-Qoption ld '
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ lt_prog_compiler_pic_CXX='-PIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ lt_prog_compiler_pic_CXX='-pic'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ ;;
+ lcc*)
+ # Lucid
+ lt_prog_compiler_pic_CXX='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ lt_prog_compiler_pic_CXX='-KPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ case $cc_basename in
+ CC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ ;;
+ esac
+ ;;
+ vxworks*)
+ ;;
+ *)
+ lt_prog_compiler_can_build_shared_CXX=no
+ ;;
+ esac
+ fi
+
+{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
+$as_echo "$lt_prog_compiler_pic_CXX" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+
+{ $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works_CXX+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_works_CXX=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:13131: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:13135: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_pic_works_CXX=yes
+ fi
+ fi
+ $rm conftest*
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then
+ case $lt_prog_compiler_pic_CXX in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+ esac
+else
+ lt_prog_compiler_pic_CXX=
+ lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic_CXX=
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+ ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+{ $as_echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if test "${lt_cv_prog_compiler_static_works_CXX+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_static_works_CXX=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_static_works_CXX=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works_CXX=yes
+ fi
+ fi
+ $rm -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
+ :
+else
+ lt_prog_compiler_static_CXX=
+fi
+
+
+{ $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o_CXX=no
+ $rm -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:13235: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:13239: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o_CXX=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $rm conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+ $rm out/* && rmdir out
+ cd ..
+ rmdir conftest
+ $rm conftest*
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { $as_echo "$as_me:$LINENO: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+{ $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ case $host_os in
+ aix[4-9]*)
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
+ export_symbols_cmds_CXX="$ltdll_cmds"
+ ;;
+ cygwin* | mingw*)
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+ ;;
+ *)
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+ exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+
+{ $as_echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc_CXX=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds_CXX in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+ $rm conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl_CXX
+ pic_flag=$lt_prog_compiler_pic_CXX
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+ allow_undefined_flag_CXX=
+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+ (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ then
+ archive_cmds_need_lc_CXX=no
+ else
+ archive_cmds_need_lc_CXX=yes
+ fi
+ allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $rm conftest*
+ { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
+$as_echo "$archive_cmds_need_lc_CXX" >&6; }
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+{ $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[4-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $rm \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[123]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+interix[3-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+nto-qnx*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ shlibpath_overrides_runpath=no
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ shlibpath_overrides_runpath=yes
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
+fi
+
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
+fi
+
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" || \
+ test -n "$runpath_var_CXX" || \
+ test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+ # We can hardcode non-existant directories.
+ if test "$hardcode_direct_CXX" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+ test "$hardcode_minus_L_CXX" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action_CXX=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action_CXX=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action_CXX=unsupported
+fi
+{ $as_echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
+$as_echo "$hardcode_action_CXX" >&6; }
+
+if test "$hardcode_action_CXX" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ compiler_CXX \
+ CC_CXX \
+ LD_CXX \
+ lt_prog_compiler_wl_CXX \
+ lt_prog_compiler_pic_CXX \
+ lt_prog_compiler_static_CXX \
+ lt_prog_compiler_no_builtin_flag_CXX \
+ export_dynamic_flag_spec_CXX \
+ thread_safe_flag_spec_CXX \
+ whole_archive_flag_spec_CXX \
+ enable_shared_with_static_runtimes_CXX \
+ old_archive_cmds_CXX \
+ old_archive_from_new_cmds_CXX \
+ predep_objects_CXX \
+ postdep_objects_CXX \
+ predeps_CXX \
+ postdeps_CXX \
+ compiler_lib_search_path_CXX \
+ compiler_lib_search_dirs_CXX \
+ archive_cmds_CXX \
+ archive_expsym_cmds_CXX \
+ postinstall_cmds_CXX \
+ postuninstall_cmds_CXX \
+ old_archive_from_expsyms_cmds_CXX \
+ allow_undefined_flag_CXX \
+ no_undefined_flag_CXX \
+ export_symbols_cmds_CXX \
+ hardcode_libdir_flag_spec_CXX \
+ hardcode_libdir_flag_spec_ld_CXX \
+ hardcode_libdir_separator_CXX \
+ hardcode_automatic_CXX \
+ module_cmds_CXX \
+ module_expsym_cmds_CXX \
+ lt_cv_prog_compiler_c_o_CXX \
+ fix_srcfile_path_CXX \
+ exclude_expsyms_CXX \
+ include_expsyms_CXX; do
+
+ case $var in
+ old_archive_cmds_CXX | \
+ old_archive_from_new_cmds_CXX | \
+ archive_cmds_CXX | \
+ archive_expsym_cmds_CXX | \
+ module_cmds_CXX | \
+ module_expsym_cmds_CXX | \
+ old_archive_from_expsyms_cmds_CXX | \
+ export_symbols_cmds_CXX | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\$0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+cfgfile="$ofile"
+
+ cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_CXX
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_CXX
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_CXX
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_CXX
+
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_CXX
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+
+ else
+ tagname=""
+ fi
+ ;;
+
+ F77)
+ if test -n "$F77" && test "X$F77" != "Xno"; then
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+
+
+archive_cmds_need_lc_F77=no
+allow_undefined_flag_F77=
+always_export_symbols_F77=no
+archive_expsym_cmds_F77=
+export_dynamic_flag_spec_F77=
+hardcode_direct_F77=no
+hardcode_libdir_flag_spec_F77=
+hardcode_libdir_flag_spec_ld_F77=
+hardcode_libdir_separator_F77=
+hardcode_minus_L_F77=no
+hardcode_automatic_F77=no
+module_cmds_F77=
+module_expsym_cmds_F77=
+link_all_deplibs_F77=unknown
+old_archive_cmds_F77=$old_archive_cmds
+no_undefined_flag_F77=
+whole_archive_flag_spec_F77=
+enable_shared_with_static_runtimes_F77=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+objext_F77=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="\
+ subroutine t
+ return
+ end
+"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="\
+ program t
+ end
+"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm -r conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+compiler_F77=$CC
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+{ $as_echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+{ $as_echo "$as_me:$LINENO: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+{ $as_echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+aix[4-9]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+{ $as_echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+{ $as_echo "$as_me:$LINENO: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+GCC_F77="$G77"
+LD_F77="$LD"
+
+lt_prog_compiler_wl_F77=
+lt_prog_compiler_pic_F77=
+lt_prog_compiler_static_F77=
+
+{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl_F77='-Wl,'
+ lt_prog_compiler_static_F77='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_F77='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4'
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic_F77='-fno-common'
+ ;;
+
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared_F77=no
+ enable_shared=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic_F77=-Kconform_pic
+ fi
+ ;;
+
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic_F77='-fPIC'
+ ;;
+ esac
+ ;;
+
+ *)
+ lt_prog_compiler_pic_F77='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_F77='-Bstatic'
+ else
+ lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ lt_prog_compiler_pic_F77='-qnocommon'
+ lt_prog_compiler_wl_F77='-Wl,'
+ ;;
+ esac
+ ;;
+
+ mingw* | cygwin* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic_F77='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static_F77='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static_F77='-non_shared'
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic_F77='-KPIC'
+ lt_prog_compiler_static_F77='-Bstatic'
+ ;;
+
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ icc* | ecc*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ lt_prog_compiler_pic_F77='-KPIC'
+ lt_prog_compiler_static_F77='-static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl_F77='-Wl,'
+ lt_prog_compiler_pic_F77='-fpic'
+ lt_prog_compiler_static_F77='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static_F77='-non_shared'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic_F77='-KPIC'
+ lt_prog_compiler_static_F77='-Bstatic'
+ lt_prog_compiler_wl_F77='-Wl,'
+ ;;
+ *Sun\ F*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic_F77='-KPIC'
+ lt_prog_compiler_static_F77='-Bstatic'
+ lt_prog_compiler_wl_F77=''
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static_F77='-non_shared'
+ ;;
+
+ rdos*)
+ lt_prog_compiler_static_F77='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic_F77='-KPIC'
+ lt_prog_compiler_static_F77='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ lt_prog_compiler_wl_F77='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl_F77='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl_F77='-Qoption ld '
+ lt_prog_compiler_pic_F77='-PIC'
+ lt_prog_compiler_static_F77='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ lt_prog_compiler_pic_F77='-KPIC'
+ lt_prog_compiler_static_F77='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic_F77='-Kconform_pic'
+ lt_prog_compiler_static_F77='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ lt_prog_compiler_pic_F77='-KPIC'
+ lt_prog_compiler_static_F77='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ lt_prog_compiler_can_build_shared_F77=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic_F77='-pic'
+ lt_prog_compiler_static_F77='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared_F77=no
+ ;;
+ esac
+ fi
+
+{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
+$as_echo "$lt_prog_compiler_pic_F77" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_F77"; then
+
+{ $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works_F77+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_works_F77=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic_F77"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:14818: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:14822: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_pic_works_F77=yes
+ fi
+ fi
+ $rm conftest*
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_F77" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works_F77" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works_F77" = xyes; then
+ case $lt_prog_compiler_pic_F77 in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;;
+ esac
+else
+ lt_prog_compiler_pic_F77=
+ lt_prog_compiler_can_build_shared_F77=no
+fi
+
+fi
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic_F77=
+ ;;
+ *)
+ lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77"
+ ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\"
+{ $as_echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if test "${lt_cv_prog_compiler_static_works_F77+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_static_works_F77=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_static_works_F77=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works_F77=yes
+ fi
+ fi
+ $rm -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_F77" >&5
+$as_echo "$lt_cv_prog_compiler_static_works_F77" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works_F77" = xyes; then
+ :
+else
+ lt_prog_compiler_static_F77=
+fi
+
+
+{ $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o_F77=no
+ $rm -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:14922: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:14926: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o_F77=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $rm conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+ $rm out/* && rmdir out
+ cd ..
+ rmdir conftest
+ $rm conftest*
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_F77" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { $as_echo "$as_me:$LINENO: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+{ $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+ runpath_var=
+ allow_undefined_flag_F77=
+ enable_shared_with_static_runtimes_F77=no
+ archive_cmds_F77=
+ archive_expsym_cmds_F77=
+ old_archive_From_new_cmds_F77=
+ old_archive_from_expsyms_cmds_F77=
+ export_dynamic_flag_spec_F77=
+ whole_archive_flag_spec_F77=
+ thread_safe_flag_spec_F77=
+ hardcode_libdir_flag_spec_F77=
+ hardcode_libdir_flag_spec_ld_F77=
+ hardcode_libdir_separator_F77=
+ hardcode_direct_F77=no
+ hardcode_minus_L_F77=no
+ hardcode_shlibpath_var_F77=unsupported
+ link_all_deplibs_F77=unknown
+ hardcode_automatic_F77=no
+ module_cmds_F77=
+ module_expsym_cmds_F77=
+ always_export_symbols_F77=no
+ export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms_F77=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms_F77='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+ extract_expsyms_cmds=
+ # Just being paranoid about ensuring that cc_basename is set.
+ for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+ case $host_os in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ ld_shlibs_F77=yes
+ if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec_F77='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec_F77=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>/dev/null` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[3-9]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs_F77=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ fi
+ ;;
+
+ amigaos*)
+ archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ hardcode_minus_L_F77=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can't use
+ # them.
+ ld_shlibs_F77=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag_F77=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs_F77=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ allow_undefined_flag_F77=unsupported
+ always_export_symbols_F77=no
+ enable_shared_with_static_runtimes_F77=yes
+ export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs_F77=no
+ fi
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct_F77=no
+ hardcode_shlibpath_var_F77=no
+ hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_F77='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | k*bsd*-gnu)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ tmp_addflag=
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ *)
+ tmp_sharedflag='-shared' ;;
+ esac
+ archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test $supports_anon_versioning = yes; then
+ archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ $echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ else
+ ld_shlibs_F77=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs_F77=no
+ cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs_F77=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs_F77=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+ archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+ else
+ ld_shlibs_F77=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct_F77=yes
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs_F77=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs_F77" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec_F77=
+ export_dynamic_flag_spec_F77=
+ whole_archive_flag_spec_F77=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag_F77=unsupported
+ always_export_symbols_F77=yes
+ archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L_F77=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct_F77=unsupported
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds_F77=''
+ hardcode_direct_F77=yes
+ hardcode_libdir_separator_F77=':'
+ link_all_deplibs_F77=yes
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ hardcode_direct_F77=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L_F77=yes
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ hardcode_libdir_separator_F77=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols_F77=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag_F77='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+ program main
+
+ end
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_f77_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag_F77="-z nodefs"
+ archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+ program main
+
+ end
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_f77_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag_F77=' ${wl}-bernotok'
+ allow_undefined_flag_F77=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec_F77='$convenience'
+ archive_cmds_need_lc_F77=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ hardcode_minus_L_F77=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs_F77=no
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec_F77=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec_F77=' '
+ allow_undefined_flag_F77=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_From_new_cmds_F77='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path_F77='`cygpath -w "$srcfile"`'
+ enable_shared_with_static_runtimes_F77=yes
+ ;;
+
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag_F77='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ archive_cmds_need_lc_F77=no
+ hardcode_direct_F77=no
+ hardcode_automatic_F77=yes
+ hardcode_shlibpath_var_F77=unsupported
+ whole_archive_flag_spec_F77=''
+ link_all_deplibs_F77=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ archive_cmds_F77="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds_F77="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds_F77="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ module_expsym_cmds_F77="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+ module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs_F77=no
+ ;;
+ esac
+ fi
+ ;;
+
+ dgux*)
+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ freebsd1*)
+ ld_shlibs_F77=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec_F77='-R$libdir'
+ hardcode_direct_F77=yes
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_F77=yes
+ hardcode_minus_L_F77=yes
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec_F77='-R$libdir'
+ hardcode_direct_F77=yes
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_F77=:
+ hardcode_direct_F77=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L_F77=yes
+ export_dynamic_flag_spec_F77='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_F77=:
+
+ hardcode_direct_F77=yes
+ export_dynamic_flag_spec_F77='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L_F77=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_F77=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_libdir_flag_spec_ld_F77='+b $libdir'
+ hardcode_direct_F77=no
+ hardcode_shlibpath_var_F77=no
+ ;;
+ *)
+ hardcode_direct_F77=yes
+ export_dynamic_flag_spec_F77='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L_F77=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_ld_F77='-rpath $libdir'
+ fi
+ hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_F77=:
+ link_all_deplibs_F77=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec_F77='-R$libdir'
+ hardcode_direct_F77=yes
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ newsos6)
+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_F77=yes
+ hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_F77=:
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct_F77=yes
+ hardcode_shlibpath_var_F77=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_F77='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec_F77='-R$libdir'
+ ;;
+ *)
+ archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ ld_shlibs_F77=no
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ hardcode_minus_L_F77=yes
+ allow_undefined_flag_F77=unsupported
+ archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag_F77=' -expect_unresolved \*'
+ archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_F77=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag_F77=' -expect_unresolved \*'
+ archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec_F77='-rpath $libdir'
+ fi
+ hardcode_libdir_separator_F77=:
+ ;;
+
+ solaris*)
+ no_undefined_flag_F77=' -z text'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+ else
+ wlarc=''
+ archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ fi
+ hardcode_libdir_flag_spec_F77='-R$libdir'
+ hardcode_shlibpath_var_F77=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ link_all_deplibs_F77=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ hardcode_direct_F77=yes
+ hardcode_minus_L_F77=yes
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_F77=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds_F77='$CC -r -o $output$reload_objs'
+ hardcode_direct_F77=no
+ ;;
+ motorola)
+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var_F77=no
+ export_dynamic_flag_spec_F77='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var_F77=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs_F77=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag_F77='${wl}-z,text'
+ archive_cmds_need_lc_F77=no
+ hardcode_shlibpath_var_F77=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag_F77='${wl}-z,text'
+ allow_undefined_flag_F77='${wl}-z,nodefs'
+ archive_cmds_need_lc_F77=no
+ hardcode_shlibpath_var_F77=no
+ hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ hardcode_libdir_separator_F77=':'
+ link_all_deplibs_F77=yes
+ export_dynamic_flag_spec_F77='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ *)
+ ld_shlibs_F77=no
+ ;;
+ esac
+ fi
+
+{ $as_echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
+$as_echo "$ld_shlibs_F77" >&6; }
+test "$ld_shlibs_F77" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_F77" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc_F77=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds_F77 in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+ $rm conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl_F77
+ pic_flag=$lt_prog_compiler_pic_F77
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag_F77
+ allow_undefined_flag_F77=
+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+ (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ then
+ archive_cmds_need_lc_F77=no
+ else
+ archive_cmds_need_lc_F77=yes
+ fi
+ allow_undefined_flag_F77=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $rm conftest*
+ { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
+$as_echo "$archive_cmds_need_lc_F77" >&6; }
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+{ $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[4-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $rm \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[123]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+interix[3-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+nto-qnx*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ shlibpath_overrides_runpath=no
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ shlibpath_overrides_runpath=yes
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
+fi
+
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
+fi
+
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action_F77=
+if test -n "$hardcode_libdir_flag_spec_F77" || \
+ test -n "$runpath_var_F77" || \
+ test "X$hardcode_automatic_F77" = "Xyes" ; then
+
+ # We can hardcode non-existant directories.
+ if test "$hardcode_direct_F77" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no &&
+ test "$hardcode_minus_L_F77" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action_F77=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action_F77=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action_F77=unsupported
+fi
+{ $as_echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
+$as_echo "$hardcode_action_F77" >&6; }
+
+if test "$hardcode_action_F77" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ compiler_F77 \
+ CC_F77 \
+ LD_F77 \
+ lt_prog_compiler_wl_F77 \
+ lt_prog_compiler_pic_F77 \
+ lt_prog_compiler_static_F77 \
+ lt_prog_compiler_no_builtin_flag_F77 \
+ export_dynamic_flag_spec_F77 \
+ thread_safe_flag_spec_F77 \
+ whole_archive_flag_spec_F77 \
+ enable_shared_with_static_runtimes_F77 \
+ old_archive_cmds_F77 \
+ old_archive_from_new_cmds_F77 \
+ predep_objects_F77 \
+ postdep_objects_F77 \
+ predeps_F77 \
+ postdeps_F77 \
+ compiler_lib_search_path_F77 \
+ compiler_lib_search_dirs_F77 \
+ archive_cmds_F77 \
+ archive_expsym_cmds_F77 \
+ postinstall_cmds_F77 \
+ postuninstall_cmds_F77 \
+ old_archive_from_expsyms_cmds_F77 \
+ allow_undefined_flag_F77 \
+ no_undefined_flag_F77 \
+ export_symbols_cmds_F77 \
+ hardcode_libdir_flag_spec_F77 \
+ hardcode_libdir_flag_spec_ld_F77 \
+ hardcode_libdir_separator_F77 \
+ hardcode_automatic_F77 \
+ module_cmds_F77 \
+ module_expsym_cmds_F77 \
+ lt_cv_prog_compiler_c_o_F77 \
+ fix_srcfile_path_F77 \
+ exclude_expsyms_F77 \
+ include_expsyms_F77; do
+
+ case $var in
+ old_archive_cmds_F77 | \
+ old_archive_from_new_cmds_F77 | \
+ archive_cmds_F77 | \
+ archive_expsym_cmds_F77 | \
+ module_cmds_F77 | \
+ module_expsym_cmds_F77 | \
+ old_archive_from_expsyms_cmds_F77 | \
+ export_symbols_cmds_F77 | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\$0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+cfgfile="$ofile"
+
+ cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_F77
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_F77
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_F77
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_F77
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_F77
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_F77
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_F77
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_F77
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_F77
+archive_expsym_cmds=$lt_archive_expsym_cmds_F77
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_F77
+module_expsym_cmds=$lt_module_expsym_cmds_F77
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_F77
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_F77
+
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_F77
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_F77
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_F77
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_F77
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_F77
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_F77
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_F77
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_F77
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_F77
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_F77
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_F77
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_F77
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_F77
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_F77
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+ else
+ tagname=""
+ fi
+ ;;
+
+ GCJ)
+ if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+objext_GCJ=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm -r conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+compiler_GCJ=$CC
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+archive_cmds_need_lc_GCJ=no
+
+old_archive_cmds_GCJ=$old_archive_cmds
+
+
+lt_prog_compiler_no_builtin_flag_GCJ=
+
+if test "$GCC" = yes; then
+ lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin'
+
+
+{ $as_echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_rtti_exceptions=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:17131: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:17135: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_rtti_exceptions=yes
+ fi
+ fi
+ $rm conftest*
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+ lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions"
+else
+ :
+fi
+
+fi
+
+lt_prog_compiler_wl_GCJ=
+lt_prog_compiler_pic_GCJ=
+lt_prog_compiler_static_GCJ=
+
+{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_static_GCJ='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4'
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic_GCJ='-fno-common'
+ ;;
+
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared_GCJ=no
+ enable_shared=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic_GCJ=-Kconform_pic
+ fi
+ ;;
+
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic_GCJ='-fPIC'
+ ;;
+ esac
+ ;;
+
+ *)
+ lt_prog_compiler_pic_GCJ='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ else
+ lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ lt_prog_compiler_pic_GCJ='-qnocommon'
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ ;;
+ esac
+ ;;
+
+ mingw* | cygwin* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic_GCJ='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static_GCJ='-non_shared'
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ icc* | ecc*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_pic_GCJ='-fpic'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static_GCJ='-non_shared'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ ;;
+ *Sun\ F*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ lt_prog_compiler_wl_GCJ=''
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static_GCJ='-non_shared'
+ ;;
+
+ rdos*)
+ lt_prog_compiler_static_GCJ='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ lt_prog_compiler_wl_GCJ='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl_GCJ='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl_GCJ='-Qoption ld '
+ lt_prog_compiler_pic_GCJ='-PIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic_GCJ='-Kconform_pic'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_can_build_shared_GCJ=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic_GCJ='-pic'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared_GCJ=no
+ ;;
+ esac
+ fi
+
+{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
+$as_echo "$lt_prog_compiler_pic_GCJ" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_GCJ"; then
+
+{ $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works_GCJ+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_works_GCJ=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic_GCJ"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:17421: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:17425: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_pic_works_GCJ=yes
+ fi
+ fi
+ $rm conftest*
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_GCJ" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works_GCJ" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works_GCJ" = xyes; then
+ case $lt_prog_compiler_pic_GCJ in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;;
+ esac
+else
+ lt_prog_compiler_pic_GCJ=
+ lt_prog_compiler_can_build_shared_GCJ=no
+fi
+
+fi
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic_GCJ=
+ ;;
+ *)
+ lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ"
+ ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\"
+{ $as_echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if test "${lt_cv_prog_compiler_static_works_GCJ+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_static_works_GCJ=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_static_works_GCJ=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works_GCJ=yes
+ fi
+ fi
+ $rm -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_GCJ" >&5
+$as_echo "$lt_cv_prog_compiler_static_works_GCJ" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works_GCJ" = xyes; then
+ :
+else
+ lt_prog_compiler_static_GCJ=
+fi
+
+
+{ $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o_GCJ=no
+ $rm -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:17525: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:17529: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o_GCJ=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $rm conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+ $rm out/* && rmdir out
+ cd ..
+ rmdir conftest
+ $rm conftest*
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_GCJ" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { $as_echo "$as_me:$LINENO: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+{ $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+ runpath_var=
+ allow_undefined_flag_GCJ=
+ enable_shared_with_static_runtimes_GCJ=no
+ archive_cmds_GCJ=
+ archive_expsym_cmds_GCJ=
+ old_archive_From_new_cmds_GCJ=
+ old_archive_from_expsyms_cmds_GCJ=
+ export_dynamic_flag_spec_GCJ=
+ whole_archive_flag_spec_GCJ=
+ thread_safe_flag_spec_GCJ=
+ hardcode_libdir_flag_spec_GCJ=
+ hardcode_libdir_flag_spec_ld_GCJ=
+ hardcode_libdir_separator_GCJ=
+ hardcode_direct_GCJ=no
+ hardcode_minus_L_GCJ=no
+ hardcode_shlibpath_var_GCJ=unsupported
+ link_all_deplibs_GCJ=unknown
+ hardcode_automatic_GCJ=no
+ module_cmds_GCJ=
+ module_expsym_cmds_GCJ=
+ always_export_symbols_GCJ=no
+ export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms_GCJ=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms_GCJ='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+ extract_expsyms_cmds=
+ # Just being paranoid about ensuring that cc_basename is set.
+ for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+ case $host_os in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ ld_shlibs_GCJ=yes
+ if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec_GCJ='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec_GCJ=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>/dev/null` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[3-9]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs_GCJ=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ fi
+ ;;
+
+ amigaos*)
+ archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_minus_L_GCJ=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can't use
+ # them.
+ ld_shlibs_GCJ=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag_GCJ=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ allow_undefined_flag_GCJ=unsupported
+ always_export_symbols_GCJ=no
+ enable_shared_with_static_runtimes_GCJ=yes
+ export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct_GCJ=no
+ hardcode_shlibpath_var_GCJ=no
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_GCJ='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | k*bsd*-gnu)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ tmp_addflag=
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ whole_archive_flag_spec_GCJ='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ *)
+ tmp_sharedflag='-shared' ;;
+ esac
+ archive_cmds_GCJ='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test $supports_anon_versioning = yes; then
+ archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ $echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs_GCJ=no
+ cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs_GCJ=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+ archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs_GCJ" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec_GCJ=
+ export_dynamic_flag_spec_GCJ=
+ whole_archive_flag_spec_GCJ=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag_GCJ=unsupported
+ always_export_symbols_GCJ=yes
+ archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L_GCJ=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct_GCJ=unsupported
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds_GCJ=''
+ hardcode_direct_GCJ=yes
+ hardcode_libdir_separator_GCJ=':'
+ link_all_deplibs_GCJ=yes
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ hardcode_direct_GCJ=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L_GCJ=yes
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_libdir_separator_GCJ=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols_GCJ=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag_GCJ='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag_GCJ="-z nodefs"
+ archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag_GCJ=' ${wl}-bernotok'
+ allow_undefined_flag_GCJ=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec_GCJ='$convenience'
+ archive_cmds_need_lc_GCJ=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_minus_L_GCJ=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs_GCJ=no
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec_GCJ=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec_GCJ=' '
+ allow_undefined_flag_GCJ=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_From_new_cmds_GCJ='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds_GCJ='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`'
+ enable_shared_with_static_runtimes_GCJ=yes
+ ;;
+
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ archive_cmds_need_lc_GCJ=no
+ hardcode_direct_GCJ=no
+ hardcode_automatic_GCJ=yes
+ hardcode_shlibpath_var_GCJ=unsupported
+ whole_archive_flag_spec_GCJ=''
+ link_all_deplibs_GCJ=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ archive_cmds_GCJ="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds_GCJ="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds_GCJ="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ module_expsym_cmds_GCJ="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+ module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs_GCJ=no
+ ;;
+ esac
+ fi
+ ;;
+
+ dgux*)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ freebsd1*)
+ ld_shlibs_GCJ=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec_GCJ='-R$libdir'
+ hardcode_direct_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_GCJ=yes
+ hardcode_minus_L_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec_GCJ='-R$libdir'
+ hardcode_direct_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+ hardcode_direct_GCJ=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L_GCJ=yes
+ export_dynamic_flag_spec_GCJ='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+
+ hardcode_direct_GCJ=yes
+ export_dynamic_flag_spec_GCJ='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L_GCJ=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_libdir_flag_spec_ld_GCJ='+b $libdir'
+ hardcode_direct_GCJ=no
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+ *)
+ hardcode_direct_GCJ=yes
+ export_dynamic_flag_spec_GCJ='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L_GCJ=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir'
+ fi
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+ link_all_deplibs_GCJ=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec_GCJ='-R$libdir'
+ hardcode_direct_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ newsos6)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_GCJ=yes
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_GCJ='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec_GCJ='-R$libdir'
+ ;;
+ *)
+ archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_minus_L_GCJ=yes
+ allow_undefined_flag_GCJ=unsupported
+ archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag_GCJ=' -expect_unresolved \*'
+ archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag_GCJ=' -expect_unresolved \*'
+ archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec_GCJ='-rpath $libdir'
+ fi
+ hardcode_libdir_separator_GCJ=:
+ ;;
+
+ solaris*)
+ no_undefined_flag_GCJ=' -z text'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+ else
+ wlarc=''
+ archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ fi
+ hardcode_libdir_flag_spec_GCJ='-R$libdir'
+ hardcode_shlibpath_var_GCJ=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ link_all_deplibs_GCJ=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_direct_GCJ=yes
+ hardcode_minus_L_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_GCJ=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds_GCJ='$CC -r -o $output$reload_objs'
+ hardcode_direct_GCJ=no
+ ;;
+ motorola)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var_GCJ=no
+ export_dynamic_flag_spec_GCJ='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var_GCJ=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs_GCJ=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag_GCJ='${wl}-z,text'
+ archive_cmds_need_lc_GCJ=no
+ hardcode_shlibpath_var_GCJ=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag_GCJ='${wl}-z,text'
+ allow_undefined_flag_GCJ='${wl}-z,nodefs'
+ archive_cmds_need_lc_GCJ=no
+ hardcode_shlibpath_var_GCJ=no
+ hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ hardcode_libdir_separator_GCJ=':'
+ link_all_deplibs_GCJ=yes
+ export_dynamic_flag_spec_GCJ='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ *)
+ ld_shlibs_GCJ=no
+ ;;
+ esac
+ fi
+
+{ $as_echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
+$as_echo "$ld_shlibs_GCJ" >&6; }
+test "$ld_shlibs_GCJ" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_GCJ" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc_GCJ=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds_GCJ in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+ $rm conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl_GCJ
+ pic_flag=$lt_prog_compiler_pic_GCJ
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ
+ allow_undefined_flag_GCJ=
+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+ (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ then
+ archive_cmds_need_lc_GCJ=no
+ else
+ archive_cmds_need_lc_GCJ=yes
+ fi
+ allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $rm conftest*
+ { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
+$as_echo "$archive_cmds_need_lc_GCJ" >&6; }
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+{ $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[4-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $rm \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[123]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+interix[3-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+nto-qnx*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ shlibpath_overrides_runpath=no
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ shlibpath_overrides_runpath=yes
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
+fi
+
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
+fi
+
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action_GCJ=
+if test -n "$hardcode_libdir_flag_spec_GCJ" || \
+ test -n "$runpath_var_GCJ" || \
+ test "X$hardcode_automatic_GCJ" = "Xyes" ; then
+
+ # We can hardcode non-existant directories.
+ if test "$hardcode_direct_GCJ" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no &&
+ test "$hardcode_minus_L_GCJ" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action_GCJ=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action_GCJ=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action_GCJ=unsupported
+fi
+{ $as_echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
+$as_echo "$hardcode_action_GCJ" >&6; }
+
+if test "$hardcode_action_GCJ" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ compiler_GCJ \
+ CC_GCJ \
+ LD_GCJ \
+ lt_prog_compiler_wl_GCJ \
+ lt_prog_compiler_pic_GCJ \
+ lt_prog_compiler_static_GCJ \
+ lt_prog_compiler_no_builtin_flag_GCJ \
+ export_dynamic_flag_spec_GCJ \
+ thread_safe_flag_spec_GCJ \
+ whole_archive_flag_spec_GCJ \
+ enable_shared_with_static_runtimes_GCJ \
+ old_archive_cmds_GCJ \
+ old_archive_from_new_cmds_GCJ \
+ predep_objects_GCJ \
+ postdep_objects_GCJ \
+ predeps_GCJ \
+ postdeps_GCJ \
+ compiler_lib_search_path_GCJ \
+ compiler_lib_search_dirs_GCJ \
+ archive_cmds_GCJ \
+ archive_expsym_cmds_GCJ \
+ postinstall_cmds_GCJ \
+ postuninstall_cmds_GCJ \
+ old_archive_from_expsyms_cmds_GCJ \
+ allow_undefined_flag_GCJ \
+ no_undefined_flag_GCJ \
+ export_symbols_cmds_GCJ \
+ hardcode_libdir_flag_spec_GCJ \
+ hardcode_libdir_flag_spec_ld_GCJ \
+ hardcode_libdir_separator_GCJ \
+ hardcode_automatic_GCJ \
+ module_cmds_GCJ \
+ module_expsym_cmds_GCJ \
+ lt_cv_prog_compiler_c_o_GCJ \
+ fix_srcfile_path_GCJ \
+ exclude_expsyms_GCJ \
+ include_expsyms_GCJ; do
+
+ case $var in
+ old_archive_cmds_GCJ | \
+ old_archive_from_new_cmds_GCJ | \
+ archive_cmds_GCJ | \
+ archive_expsym_cmds_GCJ | \
+ module_cmds_GCJ | \
+ module_expsym_cmds_GCJ | \
+ old_archive_from_expsyms_cmds_GCJ | \
+ export_symbols_cmds_GCJ | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\$0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+cfgfile="$ofile"
+
+ cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_GCJ
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_GCJ
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_GCJ
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_GCJ
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_GCJ
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_GCJ
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_GCJ
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_GCJ
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_GCJ
+archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_GCJ
+module_expsym_cmds=$lt_module_expsym_cmds_GCJ
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_GCJ
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_GCJ
+
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_GCJ
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_GCJ
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_GCJ
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_GCJ
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_GCJ
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_GCJ
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_GCJ
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_GCJ
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_GCJ
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_GCJ
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_GCJ
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_GCJ
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+ else
+ tagname=""
+ fi
+ ;;
+
+ RC)
+
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+objext_RC=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm -r conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+compiler_RC=$CC
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+lt_cv_prog_compiler_c_o_RC=yes
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ compiler_RC \
+ CC_RC \
+ LD_RC \
+ lt_prog_compiler_wl_RC \
+ lt_prog_compiler_pic_RC \
+ lt_prog_compiler_static_RC \
+ lt_prog_compiler_no_builtin_flag_RC \
+ export_dynamic_flag_spec_RC \
+ thread_safe_flag_spec_RC \
+ whole_archive_flag_spec_RC \
+ enable_shared_with_static_runtimes_RC \
+ old_archive_cmds_RC \
+ old_archive_from_new_cmds_RC \
+ predep_objects_RC \
+ postdep_objects_RC \
+ predeps_RC \
+ postdeps_RC \
+ compiler_lib_search_path_RC \
+ compiler_lib_search_dirs_RC \
+ archive_cmds_RC \
+ archive_expsym_cmds_RC \
+ postinstall_cmds_RC \
+ postuninstall_cmds_RC \
+ old_archive_from_expsyms_cmds_RC \
+ allow_undefined_flag_RC \
+ no_undefined_flag_RC \
+ export_symbols_cmds_RC \
+ hardcode_libdir_flag_spec_RC \
+ hardcode_libdir_flag_spec_ld_RC \
+ hardcode_libdir_separator_RC \
+ hardcode_automatic_RC \
+ module_cmds_RC \
+ module_expsym_cmds_RC \
+ lt_cv_prog_compiler_c_o_RC \
+ fix_srcfile_path_RC \
+ exclude_expsyms_RC \
+ include_expsyms_RC; do
+
+ case $var in
+ old_archive_cmds_RC | \
+ old_archive_from_new_cmds_RC | \
+ archive_cmds_RC | \
+ archive_expsym_cmds_RC | \
+ module_cmds_RC | \
+ module_expsym_cmds_RC | \
+ old_archive_from_expsyms_cmds_RC | \
+ export_symbols_cmds_RC | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\$0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+cfgfile="$ofile"
+
+ cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_RC
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_RC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_RC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_RC
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_RC
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_RC
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_RC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_RC
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_RC
+archive_expsym_cmds=$lt_archive_expsym_cmds_RC
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_RC
+module_expsym_cmds=$lt_module_expsym_cmds_RC
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_RC
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_RC
+
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_RC
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_RC
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_RC
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_RC
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_RC
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_RC
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_RC
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_RC
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_RC
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_RC
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_RC
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_RC
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_RC
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_RC
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+ ;;
+
+ *)
+ { { $as_echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5
+$as_echo "$as_me: error: Unsupported tag name: $tagname" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+ esac
+
+ # Append the new tag name to the list of available tags.
+ if test -n "$tagname" ; then
+ available_tags="$available_tags $tagname"
+ fi
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ # Now substitute the updated list of available tags.
+ if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+ mv "${ofile}T" "$ofile"
+ chmod +x "$ofile"
+ else
+ rm -f "${ofile}T"
+ { { $as_echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5
+$as_echo "$as_me: error: unable to update list of available tagged configurations." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+fi
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Prevent multiple expansion
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+# Extract the first word of "lsb_release", so it can be a program name with args.
+set dummy lsb_release; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_LSB_RELEASE+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ case $LSB_RELEASE in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_LSB_RELEASE="$LSB_RELEASE" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_LSB_RELEASE="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_LSB_RELEASE" && ac_cv_path_LSB_RELEASE="no"
+ ;;
+esac
+fi
+LSB_RELEASE=$ac_cv_path_LSB_RELEASE
+if test -n "$LSB_RELEASE"; then
+ { $as_echo "$as_me:$LINENO: result: $LSB_RELEASE" >&5
+$as_echo "$LSB_RELEASE" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+# Checks for libraries.
+
+# Checks for header files.
+
+{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_header_stdc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+{ $as_echo "$as_me:$LINENO: checking for size_t" >&5
+$as_echo_n "checking for size_t... " >&6; }
+if test "${ac_cv_type_size_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef size_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_size_t=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_size_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+$as_echo "$ac_cv_type_size_t" >&6; }
+if test $ac_cv_type_size_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for wchar_t" >&5
+$as_echo_n "checking for wchar_t... " >&6; }
+if test "${ac_cv_type_wchar_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef wchar_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_wchar_t=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_wchar_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_wchar_t" >&5
+$as_echo "$ac_cv_type_wchar_t" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:$LINENO: checking size of wchar_t" >&5
+$as_echo_n "checking size of wchar_t... " >&6; }
+if test "${ac_cv_sizeof_wchar_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef wchar_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef wchar_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=$ac_mid; break
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef wchar_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef wchar_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_lo=$ac_mid; break
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef wchar_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=$ac_mid
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_wchar_t=$ac_lo;;
+'') if test "$ac_cv_type_wchar_t" = yes; then
+ { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (wchar_t)
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute sizeof (wchar_t)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+ else
+ ac_cv_sizeof_wchar_t=0
+ fi ;;
+esac
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef wchar_t ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+ {
+ long int i = longval ();
+ if (i != ((long int) (sizeof (ac__type_sizeof_))))
+ return 1;
+ fprintf (f, "%ld", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ((long int) (sizeof (ac__type_sizeof_))))
+ return 1;
+ fprintf (f, "%lu", i);
+ }
+ /* Do not output a trailing newline, as this causes \r\n confusion
+ on some platforms. */
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_wchar_t=`cat conftest.val`
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_wchar_t" = yes; then
+ { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (wchar_t)
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute sizeof (wchar_t)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+ else
+ ac_cv_sizeof_wchar_t=0
+ fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_wchar_t" >&5
+$as_echo "$ac_cv_sizeof_wchar_t" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_WCHAR_T $ac_cv_sizeof_wchar_t
+_ACEOF
+
+
+
+
+
+for ac_func in fabsf
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+# Checks for library functions.
+
+# Setup the build compiler flags and linker flags.
+# Enable debug
+# (note: the flags here are gcc-specific and may fail with other compilers)
+build_flags=""
+if test "$enable_debug" = yes; then
+ build_flags="$build_flags -O0 -g -Wall -Wno-unknown-pragmas -Wparentheses -Werror"
+elif test "$enable_strict" = yes; then
+ build_flags="$build_flags -DNDEBUG -Wall -Wno-unknown-pragmas -Wparentheses -Werror"
+else
+ build_flags="$build_flags -DNDEBUG"
+fi
+
+# Enable Graphite Trace logs - these are only used if a
+# LayoutEnvironment has a valid ostream pointer
+if test "$enable_tracing" = yes; then
+ build_flags="$build_flags -DTRACING"
+fi
+
+# Enable final
+if test "$enable_final" = yes; then
+ build_flags="$build_flags -O3 -DNDEBUG"
+fi
+
+# Enable profile
+if test "$enable_profile" = yes; then
+ build_flags="$build_flags -pg "
+fi
+if test "$enable_profilefn" = yes; then
+ build_flags="$build_flags -g -finstrument-functions "
+ LIBS="$LIBS -g -finstrument-functions -lfnccheck "
+fi
+
+# Find distrib codename
+
+{ $as_echo "$as_me:$LINENO: checking if already have REL_CODENAME" >&5
+$as_echo_n "checking if already have REL_CODENAME... " >&6; }
+if test -z "${REL_CODENAME}"; then
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ { $as_echo "$as_me:$LINENO: checking if have lsb_release" >&5
+$as_echo_n "checking if have lsb_release... " >&6; }
+ if test "${LSB_RELEASE}" = "no"; then
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ REL_CODENAME="unstable"
+ else
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ { $as_echo "$as_me:$LINENO: checking if LSB_RELEASE is empty" >&5
+$as_echo_n "checking if LSB_RELEASE is empty... " >&6; }
+ if test -z ${LSB_RELEASE}; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ REL_CODENAME="unstable"
+ else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ CODENAME=`${LSB_RELEASE} -c | sed -e 's/^\S*\s*//'`
+ { $as_echo "$as_me:$LINENO: checking if release is sid" >&5
+$as_echo_n "checking if release is sid... " >&6; }
+ if test ${CODENAME} = 'sid'; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ REL_CODENAME="unstable"
+ else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ REL_CODENAME=${CODENAME}
+ fi
+ fi
+ fi
+else
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+
+
+
+CFLAGS="$CFLAGS $build_flags"
+CXXFLAGS="$CXXFLAGS $build_flags"
+
+ac_config_files="$ac_config_files Makefile silgraphite.pc:installed-top.pc.in:silgraphite.pc.in silgraphite-uninstalled.pc:uninstalled-top.pc.in:silgraphite.pc.in src/Makefile test/Makefile test/RegressionTest/Makefile test/ProfileHarness/Makefile"
+
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
+ else
+ { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+t clear
+:clear
+s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+ g
+ s/^\n//
+ s/\n/ /g
+ p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by silgraphite $as_me 2.3, which was
+generated by GNU Autoconf 2.61a. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+silgraphite config.status 2.3
+configured by $0, generated by GNU Autoconf 2.61a,
+ with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --he | --h | --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { $as_echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ set X '$SHELL' '$0'$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "silgraphite.pc") CONFIG_FILES="$CONFIG_FILES silgraphite.pc:installed-top.pc.in:silgraphite.pc.in" ;;
+ "silgraphite-uninstalled.pc") CONFIG_FILES="$CONFIG_FILES silgraphite-uninstalled.pc:uninstalled-top.pc.in:silgraphite.pc.in" ;;
+ "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+ "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
+ "test/RegressionTest/Makefile") CONFIG_FILES="$CONFIG_FILES test/RegressionTest/Makefile" ;;
+ "test/ProfileHarness/Makefile") CONFIG_FILES="$CONFIG_FILES test/ProfileHarness/Makefile" ;;
+
+ *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} ||
+{
+ $as_echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+echo 'BEGIN {' >"$tmp/subs.awk"
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF"
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/'
+ echo "_ACEOF"
+} >conf$$subs.sh
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh
+
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >>"\$tmp/subs.awk" <<\CEOF
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\).*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\).*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^"]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF
+CEOF
+cat >>"\$tmp/subs.awk" <<CEOF
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+CEOF
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in :F $CONFIG_FILES :C $CONFIG_COMMANDS
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+$as_echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+ { (exit 1); exit 1; }; };;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+ ac_file_inputs="$ac_file_inputs $ac_f"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin";;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir="$ac_dir"
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | $AWK -f "$tmp/subs.awk" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
+ case $ac_file in
+ -) cat "$tmp/out"; rm -f "$tmp/out";;
+ *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+ esac
+ ;;
+
+
+ :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir=$dirpart/$fdir
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+ ;;
+
+ esac
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/Build/source/libs/graphite/configure.ac b/Build/source/libs/graphite/configure.ac
new file mode 100644
index 00000000000..de30af569dc
--- /dev/null
+++ b/Build/source/libs/graphite/configure.ac
@@ -0,0 +1,137 @@
+AC_PREREQ(2.54)
+
+AC_INIT(silgraphite, 2.3, silgraphite-devel@lists.sourceforge.net)
+AC_CONFIG_SRCDIR(src/segment/GrEngine.cpp)
+AC_CONFIG_AUX_DIR(config)
+
+# setup automake
+AM_INIT_AUTOMAKE(foreign)
+AM_MAINTAINER_MODE
+
+# System checks.
+AC_CANONICAL_HOST
+AC_C_BIGENDIAN
+
+# Optional features
+AC_ARG_ENABLE(tracing,
+ AC_HELP_STRING([--disable-tracing],
+ [build without support for trace Graphite logs]))
+ test "x$enable_tracing" != xno && enable_tracing=yes
+
+AC_ARG_ENABLE(debug,
+ AC_HELP_STRING([--enable-debug],
+ [build with debugging. (default=no)]))
+AC_ARG_ENABLE(final,
+ AC_HELP_STRING([--disable-final],
+ [build without optimizations and no debugging.]))
+ test "x$enable_final" != xno && enable_final=yes
+AC_ARG_ENABLE(strict,
+ AC_HELP_STRING([--enable-strict],
+ [treat warnings as errors, check for as much as we can]))
+
+AC_ARG_ENABLE(profile,
+ AC_HELP_STRING([--enable-profile],
+ [allow profiling (default=no)]))
+AC_ARG_ENABLE(profilefn,
+ AC_HELP_STRING([--enable-profilefn],
+ [allow functioncheck profiling (default=no)]))
+
+# Checks for programs.
+AC_PROG_INSTALL
+AC_PROG_LIBTOOL
+AC_LANG_CPLUSPLUS
+
+AC_PATH_PROG(LSB_RELEASE, lsb_release, no)
+
+# Checks for libraries.
+
+# Checks for header files.
+AC_HEADER_STDC
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_TYPE_SIZE_T
+AC_CHECK_SIZEOF(wchar_t)
+AC_SUBST(SIZEOF_WCHAR_T)
+
+AC_CHECK_FUNCS(fabsf)
+
+# Checks for library functions.
+
+# Setup the build compiler flags and linker flags.
+# Enable debug
+# (note: the flags here are gcc-specific and may fail with other compilers)
+build_flags=""
+if test "$enable_debug" = yes; then
+ build_flags="$build_flags -O0 -g -Wall -Wno-unknown-pragmas -Wparentheses -Werror"
+elif test "$enable_strict" = yes; then
+ build_flags="$build_flags -DNDEBUG -Wall -Wno-unknown-pragmas -Wparentheses -Werror"
+else
+ build_flags="$build_flags -DNDEBUG"
+fi
+
+# Enable Graphite Trace logs - these are only used if a
+# LayoutEnvironment has a valid ostream pointer
+if test "$enable_tracing" = yes; then
+ build_flags="$build_flags -DTRACING"
+fi
+
+# Enable final
+if test "$enable_final" = yes; then
+ build_flags="$build_flags -O3 -DNDEBUG"
+fi
+
+# Enable profile
+if test "$enable_profile" = yes; then
+ build_flags="$build_flags -pg "
+fi
+if test "$enable_profilefn" = yes; then
+ build_flags="$build_flags -g -finstrument-functions "
+ LIBS="$LIBS -g -finstrument-functions -lfnccheck "
+fi
+
+# Find distrib codename
+
+AC_MSG_CHECKING(if already have REL_CODENAME)
+if test -z "${REL_CODENAME}"; then
+ AC_MSG_RESULT(no)
+ AC_MSG_CHECKING(if have lsb_release)
+ if test "${LSB_RELEASE}" = "no"; then
+ AC_MSG_RESULT(no)
+ REL_CODENAME="unstable"
+ else
+ AC_MSG_RESULT(yes)
+ AC_MSG_CHECKING(if LSB_RELEASE is empty)
+ if test -z ${LSB_RELEASE}; then
+ AC_MSG_RESULT(yes)
+ REL_CODENAME="unstable"
+ else
+ AC_MSG_RESULT(no)
+ CODENAME=`${LSB_RELEASE} -c | sed -e 's/^\S*\s*//'`
+ AC_MSG_CHECKING(if release is sid)
+ if test ${CODENAME} = 'sid'; then
+ AC_MSG_RESULT(yes)
+ REL_CODENAME="unstable"
+ else
+ AC_MSG_RESULT(no, ${CODENAME})
+ REL_CODENAME=${CODENAME}
+ fi
+ fi
+ fi
+else
+ AC_MSG_RESULT(yes)
+fi
+
+AC_SUBST(REL_CODENAME)
+
+CFLAGS="$CFLAGS $build_flags"
+CXXFLAGS="$CXXFLAGS $build_flags"
+
+AC_CONFIG_FILES(Makefile \
+ silgraphite.pc:installed-top.pc.in:silgraphite.pc.in \
+ silgraphite-uninstalled.pc:uninstalled-top.pc.in:silgraphite.pc.in \
+ src/Makefile \
+ test/Makefile \
+ test/RegressionTest/Makefile \
+ test/ProfileHarness/Makefile)
+
+AC_OUTPUT
diff --git a/Build/source/libs/graphite/debian/changelog b/Build/source/libs/graphite/debian/changelog
new file mode 100644
index 00000000000..e77c628ef90
--- /dev/null
+++ b/Build/source/libs/graphite/debian/changelog
@@ -0,0 +1,174 @@
+silgraphite2.0 (1:2.3-1) gutsy; urgency=low
+
+ * Smaller segment and glyphinfo foot prints
+ * bug fixes
+
+ -- Martin Hosken <martin_hosken@sil.org> Wed, 16 Jan 2008 16:54:26 +0700
+
+silgraphite2.0 (1:2.2.1-1) feisty; urgency=low
+
+ * 30% speedup
+ * various bug fixes
+
+ -- Martin Hosken <martin_hosken@sil.org> Mon, 27 Aug 2007 16:47:26 +0100
+
+silgraphite2.0 (1:2.2.0-1.1) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Fix the broken graphite.pc file (Closes: #433225):
+ - debian/rules:
+ Added an include of cdbs's simple-patchsys.mk.
+ - debian/patches/fix_cflags_in_graphite.pc.diff
+ Added this patch to fix the graphite.pc file by appending the missing
+ ``graphite'' directory to the Cflags in graphite.pc.in.
+
+ -- Cyril Brulebois <cyril.brulebois@enst-bretagne.fr> Mon, 20 Aug 2007 01:20:35 +0000
+
+silgraphite2.0 (1:2.2.0-1) unstable; urgency=low
+
+ * Release 2.2.0
+
+ -- Daniel Glassey <wdg@debian.org> Thu, 28 Jun 2007 10:56:17 +0100
+
+silgraphite2.0 (1:2.1+0447svn-1) unstable; urgency=low
+
+ * Update svn
+ * Keep engine separate from wrappers
+ * debian/control So don't need build dep on fontconfig or freetype
+ * debian/docs Docs are not in odf format not rtf
+
+ -- Daniel Glassey <wdg@debian.org> Fri, 25 May 2007 13:33:06 +0100
+
+silgraphite2.0 (1:2.1+0361svn-1) unstable; urgency=low
+
+ * Build freetype wrapper
+ * Update svn
+ * depend on libfreetype6-dev instead of X and Xft dependencies
+ * binary package is now libgraphite3 since library version has
+ changed
+ * so rename the debian/libgraphite2.* to libgraphite3.*
+ * libgraphite-dev.install: install libgraphite-ft.a
+
+ -- Daniel Glassey <wdg@debian.org> Mon, 12 Mar 2007 20:25:30 +0000
+
+silgraphite2.0 (1:2.1+0347svn-1) unstable; urgency=low
+
+ * Package preparation for min-deps reorganisation
+ * allow build from svn
+ * debian/rules: not using tarball anymore
+ * debian/control standards version 3.7.2 (no changes)
+ * remove unneeded misc:Depends subsitution variable
+
+ -- Daniel Glassey <wdg@debian.org> Fri, 9 Mar 2007 17:20:52 +0000
+
+silgraphite2.0 (1:2.1-1) unstable; urgency=low
+
+ * New upstream release
+ * debian/rules: fix shlibs
+ * Use an epoch as 2.1 < 221svn
+ if further svn releases are made they will be
+ e.g. 1:2.1+0250svn-1
+
+ -- Daniel Glassey <wdg@debian.org> Mon, 15 May 2006 19:48:23 -0500
+
+silgraphite2.0 (221svn-3) unstable; urgency=low
+
+ * er, try that again
+
+ -- Daniel Glassey <wdg@debian.org> Mon, 17 Apr 2006 15:51:32 +0100
+
+silgraphite2.0 (221svn-2) unstable; urgency=low
+
+ * debian/libgraphite2.shlibs refer to new package name
+
+ -- Daniel Glassey <wdg@debian.org> Mon, 17 Apr 2006 15:36:48 +0100
+
+silgraphite2.0 (221svn-1) unstable; urgency=low
+
+ [ Daniel Glassey ]
+ * update to current svn
+ * include fix to build with gcc 4.1, Closes: #357711
+ Thanks to Martin Michlmayr <tbm@cyrius.com> for the report
+ and Michael Peters <mpeters@mac.com> for the initial one
+ * fix shlibs to refer to libgraphite
+ * rename the lib packages because lib is now libgraphite
+ * now lintian and linda clean
+ * debian/copyright: get location of public svn repo right
+ * conflict with the old packages
+ * don't compress the rtf docs
+
+ [ Martin Hosken ]
+ * build for dapper from trunk
+ * build for dapper from trunk - with right email
+
+ -- Martin Hosken <martin_hosken@sil.org> Fri, 16 Jun 2006 10:48:22 +0700
+
+silgraphite2.0 (190svn-2) unstable; urgency=low
+
+ * fix shlibs
+ * debian/copyright: update location of svn repo
+
+ -- Daniel Glassey <wdg@debian.org> Fri, 10 Mar 2006 09:35:21 +0000
+
+silgraphite2.0 (190svn-1) unstable; urgency=low
+
+ * update to current svn - 2.1.0 prerelease snapshot
+ * not a native package - build it as such, Closes: #345154
+ * Don't assume size_t is unsigned, Closes: #345155
+ Thanks to Bastian Blank <waldi@debian.org> for the report and patch
+ * Take more care with void*, Closes: #345369
+ * debian/libsilgraphite-dev.docs: new file GTF_3_0.rtf
+ build dir is now silgraphite-2.1.0
+ * debian/control: compiler is grcompiler not gdlcomp
+
+ -- Daniel Glassey <wdg@debian.org> Thu, 9 Mar 2006 12:49:53 +0000
+
+silgraphite2.0 (102svn-1) unstable; urgency=low
+
+ * update to current svn
+ * fix the build-deps line (rejection)
+
+ -- Daniel Glassey <wdg@debian.org> Mon, 12 Dec 2005 09:39:31 +0000
+
+silgraphite2.0 (87svn-1) unstable; urgency=low
+
+ * update to more recent svn
+ * new naming scheme using svn revision
+ * Don't autogenerate debian/control using cdbs (rejection)
+ * Add section for source to debian/control
+
+ -- Daniel Glassey <wdg@debian.org> Thu, 1 Dec 2005 11:24:13 +0000
+
+silgraphite2.0 (20051010svn-1) unstable; urgency=low
+
+ * new upstream v2 API
+ * this doesn't depend on libfont-ttf-perl as perl bindings are
+ separate now
+ * GDL font compiler will be a separate package
+
+ -- Daniel Glassey <wdg@debian.org> Mon, 10 Oct 2005 05:32:32 +0100
+
+silgraphite1.0 (20050813cvs-1) unstable; urgency=low
+
+ * New sync with cvs
+ * Ready to upload to unstable
+ * not sure which arch #279655 is for (guessing amd64), so uploading
+ in case it has been fixed in cvs
+ * let cdbs control its build deps in control.in
+
+ -- Daniel Glassey <wdg@debian.org> Sat, 13 Aug 2005 00:12:12 +0100
+
+silgraphite1.0 (20041025cvs-1) experimental; urgency=low
+
+ * update to current CVS
+ * remember to sign this time :/
+ * name package libsilgraphite-1.2 as that is the upcoming version
+ * ITP completed, Closes: #205565
+
+ -- Daniel Glassey <wdg@debian.org> Mon, 25 Oct 2004 20:53:50 +0100
+
+silgraphite1.0 (20041022cvs-1) experimental; urgency=low
+
+ * Initial Release using current CVS.
+
+ -- Daniel Glassey <wdg@debian.org> Fri, 22 Oct 2004 14:24:35 +0100
diff --git a/Build/source/libs/graphite/debian/compat b/Build/source/libs/graphite/debian/compat
new file mode 100644
index 00000000000..b8626c4cff2
--- /dev/null
+++ b/Build/source/libs/graphite/debian/compat
@@ -0,0 +1 @@
+4
diff --git a/Build/source/libs/graphite/debian/control b/Build/source/libs/graphite/debian/control
new file mode 100644
index 00000000000..fbcdb63a66a
--- /dev/null
+++ b/Build/source/libs/graphite/debian/control
@@ -0,0 +1,83 @@
+Source: silgraphite2.0
+Priority: optional
+Section: libs
+Maintainer: Daniel Glassey <wdg@debian.org>
+Build-Depends: cdbs (>= 0.4.23-1.1), autotools-dev, debhelper (>= 4.1.0)
+Standards-Version: 3.7.2
+
+Package: libgraphite-dev
+Section: libdevel
+Architecture: any
+Depends: libgraphite3 (= ${Source-Version})
+Conflicts: libsilgraphite-dev, libsilgraphite-2.0
+Description: Development files for SILGraphite
+ SILGraphite is a system that can be used to create and use "smart fonts"
+ capable of displaying writing systems with various complex behaviors, such
+ as: contextual shaping, ligatures, reordering, split glyphs,
+ bidirectionality, stacking diacritics and complex positioning.
+ .
+ This library was designed and developed by the NRSI (Non-Roman Script
+ Initiative) within SIL International (www.sil.org) to act as a complement to
+ other smart font rendering technologies with limited practical local
+ extensability. Its purpose is to help meet the needs of a very large number
+ of "minority language" communities for local extensibility of complex script
+ behaviors.
+ .
+ The behavior of the SILGraphite rendering engine for a given writing system is
+ specified through extra tables added to a TrueType font. These tables are
+ generated by compiling a GDL (Graphite Description Language) source file into
+ a font using grcompiler.
+ .
+ This package contains the headers and development libraries.
+
+Package: libgraphite3
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}
+Conflicts: libsilgraphite-dev, libsilgraphite-2.0
+Description: SILGraphite - a "smart font" rendering engine
+ SILGraphite is a system that can be used to create and use "smart fonts"
+ capable of displaying writing systems with various complex behaviors, such
+ as: contextual shaping, ligatures, reordering, split glyphs,
+ bidirectionality, stacking diacritics and complex positioning.
+ .
+ This library was designed and developed by the NRSI (Non-Roman Script
+ Initiative) within SIL International (www.sil.org) to act as a complement to
+ other smart font rendering technologies with limited practical local
+ extensability. Its purpose is to help meet the needs of a very large number
+ of "minority language" communities for local extensibility of complex script
+ behaviors.
+ .
+ The behavior of the SILGraphite rendering engine for a given writing system is
+ specified through extra tables added to a TrueType font. These tables are
+ generated by compiling a GDL (Graphite Description Language) source file into
+ a font using grcompiler.
+ .
+ This package contains the shared library.
+
+Package: libgraphite3-dbg
+Priority: extra
+Section: libdevel
+Architecture: any
+Depends: libgraphite3 (= ${Source-Version})
+Conflicts: libsilgraphite-dev, libsilgraphite-2.0
+Description: debugging symbols for SILGraphite
+ SILGraphite is a system that can be used to create and use "smart fonts"
+ capable of displaying writing systems with various complex behaviors, such
+ as: contextual shaping, ligatures, reordering, split glyphs,
+ bidirectionality, stacking diacritics and complex positioning.
+ .
+ This library was designed and developed by the NRSI (Non-Roman Script
+ Initiative) within SIL International (www.sil.org) to act as a complement to
+ other smart font rendering technologies with limited practical local
+ extensability. Its purpose is to help meet the needs of a very large number
+ of "minority language" communities for local extensibility of complex script
+ behaviors.
+ .
+ The behavior of the SILGraphite rendering engine for a given writing system is
+ specified through extra tables added to a TrueType font. These tables are
+ generated by compiling a GDL (Graphite Description Language) source file into
+ a font using grcompiler.
+ .
+ This package contains the debug library.
+
diff --git a/Build/source/libs/graphite/debian/copyright b/Build/source/libs/graphite/debian/copyright
new file mode 100644
index 00000000000..b1fe8899e1d
--- /dev/null
+++ b/Build/source/libs/graphite/debian/copyright
@@ -0,0 +1,259 @@
+This package was debianized by Daniel Glassey <wdg@debian.org> on
+Fri, 22 Oct 2004 14:24:35 +0100.
+
+It was oringally downloaded from http://www.sourceforge.net/projects/silgraphite
+ SILGraphite cvs on sourceforge
+It is now in the subversion repository at
+ http://scripts.sil.org/svn-public/graphite/graphite/trunk
+
+Upstream Authors:
+ SIL International <silgraphite-devel@lists.sourceforge.net>
+ http://www.sil.org
+
+Copyright:
+Copyright 1999-2006 SIL International
+
+Graphite is copyrighted under the SIL Dual License
+This can be found on http://fieldworks.sil.org/License/SIL_open_source_license_frame.htm
+
+Graphite, Version .9 Copyright 2001, SIL International, Inc. All rights reserved.
+This software is free; you can redistribute it and/or modify it under the terms of either:
+a) the GNU "GNU Lesser General Public License version 2.1" as published by the Free Software
+Foundation, or b) the "Common Public License Version 0.5".
+
+This software 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 either the GNU Lesser General Public License or the Common Public License for more details.
+
+ On Debian systems, the complete text of the GNU Lesser General Public
+ License, version 2.1, can be found in /usr/share/common-licenses/LGPL-2.1
+
+The IBM Common Public License follows:
+Common Public License Version 0.5
+
+Common Public License Version 0.5
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE
+("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S
+ACCEPTANCE OF THIS AGREEMENT.
+
+
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+ a) in the case of the initial Contributor, the initial code and documentation distributed
+under this Agreement, and
+
+ b) in the case of each subsequent Contributor:
+
+ i) changes to the Program, and
+
+ ii) additions to the Program;
+
+ where such changes and/or additions to the Program originate from and are distributed by
+that particular Contributor. A Contribution 'originates' from a Contributor if it was added to
+the Program by such Contributor itself or anyone acting on such Contributor's behalf.
+Contributions do not include additions to the Program which: (i) are separate modules of
+software distributed in conjunction with the Program under their own license agreement, and
+(ii) are not derivative works of the Program.
+
+
+
+"Contributor" means any person or entity that distributes the Program.
+
+
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily
+infringed by the use or sale of its Contribution alone or when combined with the Program.
+
+
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+
+
+"Recipient" means anyone who receives the Program under this Agreement, including all
+Contributors.
+
+
+
+2. GRANT OF RIGHTS
+
+ a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a
+non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code form.
+
+ b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a
+non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use,
+sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if
+any, in source code and object code form. This patent license shall apply to the combination of
+the Contribution and the Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered by the Licensed
+Patents. The patent license shall not apply to any other combinations which include the
+Contribution. No hardware per se is licensed hereunder.
+
+ c) Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor that the Program
+does not infringe the patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by any other entity based
+on infringement of intellectual property rights or otherwise. As a condition to exercising the
+rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For example, if a third party
+patent license is required to allow Recipient to distribute the Program, it is Recipient's
+responsibility to acquire that license before distributing the Program.
+
+ d) Each Contributor represents that to its knowledge it has sufficient copyright rights
+in its Contribution, if any, to grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license
+agreement, provided that:
+
+ a) it complies with the terms and conditions of this Agreement; and
+
+ b) its license agreement:
+
+ i) effectively disclaims on behalf of all Contributors all warranties and conditions,
+express and implied, including warranties or conditions of title and non-infringement, and
+implied warranties or conditions of merchantability and fitness for a particular purpose;
+
+ ii) effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such as lost
+profits;
+
+ iii) states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and
+
+ iv) states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a medium customarily
+used for software exchange.
+
+When the Program is made available in source code form:
+
+ a) it must be made available under this Agreement; and
+
+ b) a copy of this Agreement must be included with each copy of the Program.
+
+
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+
+
+
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a
+manner that reasonably allows subsequent Recipients to identify the originator of the
+Contribution.
+
+
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end
+users, business partners and the like. While this license is intended to facilitate the
+commercial use of the Program, the Contributor who includes the Program in a commercial product
+offering should do so in a manner which does not create potential liability for other
+Contributors. Therefore, if a Contributor includes the Program in a commercial product
+offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
+every other Contributor ("Indemnified Contributor") against any losses, damages and costs
+(collectively "Losses") arising from claims, lawsuits and other legal actions brought by a
+third party against the Indemnified Contributor to the extent caused by the acts or omissions
+of such Commercial Contributor in connection with its distribution of the Program in a
+commercial product offering. The obligations in this section do not apply to any claims or
+Losses relating to any actual or alleged intellectual property infringement. In order to
+qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in
+writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with
+the Commercial Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own expense.
+
+
+
+For example, a Contributor might include the Program in a commercial product offering, Product
+X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes
+performance claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this section, the
+Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay
+any damages as a result, the Commercial Contributor must pay those damages.
+
+
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS
+FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the
+appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement, including but not limited to the risks and costs of
+program errors, compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations.
+
+
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL
+HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
+GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall
+not affect the validity or enforceability of the remainder of the terms of this Agreement, and
+without further action by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.
+
+
+
+If Recipient institutes patent litigation against a Contributor with respect to a patent
+applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent
+licenses granted by that Contributor to such Recipient under this Agreement shall terminate as
+of the date such litigation is filed. In addition, If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other software or hardware)
+infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b)
+shall terminate as of the date such litigation is filed.
+
+
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of
+the material terms or conditions of this Agreement and does not cure such failure in a
+reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and distribution of the Program
+as soon as reasonably practicable. However, Recipient's obligations under this Agreement and
+any licenses granted by Recipient relating to the Program shall continue and survive.
+
+
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid
+inconsistency the Agreement is copyrighted and may only be modified in the following manner.
+The Agreement Steward reserves the right to publish new versions (including revisions) of this
+Agreement from time to time. No one other than the Agreement Steward has the right to modify
+this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement
+will be given a distinguishing version number. The Program (including Contributions) may always
+be distributed subject to the version of the Agreement under which it was received. In
+addition, after a new version of the Agreement is published, Contributor may elect to
+distribute the Program (including its Contributions) under the new version. Except as expressly
+stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the
+intellectual property of any Contributor under this Agreement, whether expressly, by
+implication, estoppel or otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.
+
+
+
+This Agreement is governed by the laws of the State of New York and the intellectual property
+laws of the United States of America. No party to this Agreement will bring a legal action
+under this Agreement more than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.
diff --git a/Build/source/libs/graphite/debian/libgraphite-dev.dirs b/Build/source/libs/graphite/debian/libgraphite-dev.dirs
new file mode 100644
index 00000000000..c08dc81a2ef
--- /dev/null
+++ b/Build/source/libs/graphite/debian/libgraphite-dev.dirs
@@ -0,0 +1,4 @@
+usr/lib
+usr/lib/pkgconfig
+usr/include/silgraphite
+
diff --git a/Build/source/libs/graphite/debian/libgraphite-dev.docs b/Build/source/libs/graphite/debian/libgraphite-dev.docs
new file mode 100644
index 00000000000..2a85e0b4b5b
--- /dev/null
+++ b/Build/source/libs/graphite/debian/libgraphite-dev.docs
@@ -0,0 +1,5 @@
+build-tree/silgraphite-2.2.1/doc/GTF_3_0.odt
+build-tree/silgraphite-2.2.1/doc/V2_Engine_Interface.odt
+build-tree/silgraphite-2.2.1/doc/V2_Segment_Interface.odt
+build-tree/silgraphite-2.2.1/doc/V2_TextSource_Interface.odt
+
diff --git a/Build/source/libs/graphite/debian/libgraphite-dev.install b/Build/source/libs/graphite/debian/libgraphite-dev.install
new file mode 100644
index 00000000000..e1c2c58c292
--- /dev/null
+++ b/Build/source/libs/graphite/debian/libgraphite-dev.install
@@ -0,0 +1,4 @@
+debian/tmp/usr/include
+debian/tmp/usr/lib/libgraphite.a
+debian/tmp/usr/lib/lib*.so
+debian/tmp/usr/lib/pkgconfig
diff --git a/Build/source/libs/graphite/debian/libgraphite3.dirs b/Build/source/libs/graphite/debian/libgraphite3.dirs
new file mode 100644
index 00000000000..68457717bd8
--- /dev/null
+++ b/Build/source/libs/graphite/debian/libgraphite3.dirs
@@ -0,0 +1 @@
+usr/lib
diff --git a/Build/source/libs/graphite/debian/libgraphite3.install b/Build/source/libs/graphite/debian/libgraphite3.install
new file mode 100644
index 00000000000..c45ebcf2a34
--- /dev/null
+++ b/Build/source/libs/graphite/debian/libgraphite3.install
@@ -0,0 +1 @@
+debian/tmp/usr/lib/lib*.so.*
diff --git a/Build/source/libs/graphite/debian/libgraphite3.shlibs b/Build/source/libs/graphite/debian/libgraphite3.shlibs
new file mode 100644
index 00000000000..6c6ca9f718e
--- /dev/null
+++ b/Build/source/libs/graphite/debian/libgraphite3.shlibs
@@ -0,0 +1 @@
+libgraphite 3 libgraphite3 (>= 1:2.1+0361svn-1)
diff --git a/Build/source/libs/graphite/debian/rules b/Build/source/libs/graphite/debian/rules
new file mode 100755
index 00000000000..7e5c672aad5
--- /dev/null
+++ b/Build/source/libs/graphite/debian/rules
@@ -0,0 +1,12 @@
+#!/usr/bin/make -f
+#DEB_AUTO_UPDATE_DEBIAN_CONTROL:=yes
+
+DEB_TAR_SRCDIR := silgraphite-2.3
+include /usr/share/cdbs/1/rules/tarball.mk
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/autotools.mk
+#DEB_CONFIGURE_EXTRA_FLAGS := --enable-final
+DEB_DH_MAKESHLIBS_ARGS_libgraphite3 := -V"libgraphite3 (>= 2.1+0449svn-1)"
+DEB_COMPRESS_EXCLUDE := .rtf
+DEB_DH_STRIP_ARGS := --dbg-package=libgraphite3
diff --git a/Build/source/libs/graphite/doc/GTF_3_0.odt b/Build/source/libs/graphite/doc/GTF_3_0.odt
new file mode 100644
index 00000000000..36b3e136dd9
--- /dev/null
+++ b/Build/source/libs/graphite/doc/GTF_3_0.odt
Binary files differ
diff --git a/Build/source/libs/graphite/doc/V2_Engine_Interface.odt b/Build/source/libs/graphite/doc/V2_Engine_Interface.odt
new file mode 100644
index 00000000000..c69511535a6
--- /dev/null
+++ b/Build/source/libs/graphite/doc/V2_Engine_Interface.odt
Binary files differ
diff --git a/Build/source/libs/graphite/doc/V2_Segment_Interface.odt b/Build/source/libs/graphite/doc/V2_Segment_Interface.odt
new file mode 100644
index 00000000000..b9028cfb379
--- /dev/null
+++ b/Build/source/libs/graphite/doc/V2_Segment_Interface.odt
Binary files differ
diff --git a/Build/source/libs/graphite/doc/V2_TextSource_Interface.odt b/Build/source/libs/graphite/doc/V2_TextSource_Interface.odt
new file mode 100644
index 00000000000..c2f183a1629
--- /dev/null
+++ b/Build/source/libs/graphite/doc/V2_TextSource_Interface.odt
Binary files differ
diff --git a/Build/source/libs/graphite/doc/hungarian.txt b/Build/source/libs/graphite/doc/hungarian.txt
new file mode 100644
index 00000000000..946c9a4bc97
--- /dev/null
+++ b/Build/source/libs/graphite/doc/hungarian.txt
@@ -0,0 +1,126 @@
+GRAPHITE HUNGARIAN NOTATION
+
+General rules for variable names:
+
+* Syntax is:
+ scope indicator (if any)
+ combining prefix (zero or more)
+ type/class indicator (required)
+ usage labels (optional)
+
+* The only places underscores are used are after the scoping prefixes. Uppercase is used to separate the prefixes from the main label, if any; eg: strName, m_psegNew.
+
+* If you are creating a new class, make up a short indicator for it and use it consistently. Class indicators should be 3-6 characters long.
+
+* An appropriate way to indicate method arguments where necessary is with an "Arg" usage label, eg: nValueArg. Generally method arguments have no special indication.
+
+* Usage labels can be made up arbitrarily, but the ones listed below should be used if they apply.
+
+
+*** Scope indicators:
+
+m_ member variable
+s_ static (global) variable
+
+
+*** Combining prefixes:
+
+i index
+c counter
+p pointer
+pp double pointer
+rg range (array, especially stack-allocated)
+prg pointer to the start of an array (often used for method arguments)
+v vector
+d delta or difference
+k constant (combines with an enumeration identifier: eg, klb, kest, kgmet, etc)
+
+
+*** Basic type indicators:
+
+f boolean (flag)
+n integer (simple numerical value--not a counter, index, glyph id, char, measurement, etc.)
+b byte
+l long integer (whatever that means)
+ch character (width irrelevant)
+chs short character (8-bit)
+chw wide character (16-bit)
+chl long (32-bit) character
+str string (char-width irrelevant)
+sta ANSI string (8-bit)
+stu Unicode string (16-bit)
+fxd fixed-field integer
+v void (yes, this duplicates vector)
+
+Graphite specific integer types:
+
+gid glyph id
+m em-units
+xs logical units, x-coordinates (source)
+ys logical units, y-coordinates (source)
+xys logical units, x- or y-coordinates (source)
+xd display units, x-coordinates
+yd display units, y-coordinates
+xyd display units, x- or y-coordinates
+
+
+*** Common Graphite-specific class prefixes (not a complete list)
+
+seg Segment
+font Font
+txsrc TextSource
+fface FontFace
+pass GrPass
+greng GrEngine
+tman GrTableManager
+sstrm GrSlotStream
+slot GrSlotState
+slout GrSlotOutput
+chstrm GrCharStream
+gbb glyph bounding box
+
+
+*** Enumeration prefixes (see the GrConstants.h and GrData.h files for a more complete list)
+
+lb line break (breakweight)
+twsh trailing whitespace handling
+est end-segment type (why the segment was terminated)
+dm draw mode (for insertion points)
+dirc directionality code
+slat slot attribute name
+clr color
+op operator in Graphite's stack machine
+
+
+*** Usage labels (somewhat optional, depending on context)
+
+Min first in a sequence or array (used with Lim); minimum (used with Max)
+Lim 1 + last in a sequence or array
+Max maximum
+First first in a sequence (used with Last)
+Last last in a sequence
+Prev previous
+Next next
+Ret return value
+In input
+Out output
+New newly created object
+Arg method argument
+
+-----------------
+
+EXAMPLES
+
+pf pointer to boolean
+cch character count
+ipassPrev index of previous pass
+pppass pointer to a pointer to a pass
+iislot index to an index to a GrSlotState
+vich vector of character indices
+prgchw pointer to the start of a wide-char buffer
+dislot delta to apply to an index of a GrSlotState
+m_ipass index of pass (member variable)
+ppassNew pointer to a newly created pass
+clrBack background color
+m_igbbFirst index to the first glyph bounding box (member variable)
+islotLim 1 + index of the last slot \ No newline at end of file
diff --git a/Build/source/libs/graphite/doc/policy.txt b/Build/source/libs/graphite/doc/policy.txt
new file mode 100644
index 00000000000..e3acbb4bcec
--- /dev/null
+++ b/Build/source/libs/graphite/doc/policy.txt
@@ -0,0 +1,19 @@
+POLICIES
+
+This document keeps a dated list of policy changes that we may come up with
+or recind or generally do whatever we want with. There's no carefully worked
+out framework in which these policies sit, they are just rules we intend
+to keep and break when we need to!
+
+2007-04-02
+
+API Changes Policy
+
+Any changes to the public API will be documented on the developers' list along
+with a branch into which the corresponding code changes will be placed.
+Following the announcement, the branch will not be merged into the trunk for
+at least 1 week. After which, depending on how the development has gone and
+the comments or otherwise, the merge may: take place unannounced, be delayed
+unannounced or be dropped and not take place, in which case an announcement
+will be made on the developers' list.
+
diff --git a/Build/source/libs/graphite/graphite-engine.ac b/Build/source/libs/graphite/graphite-engine.ac
new file mode 100644
index 00000000000..dddbe63cb82
--- /dev/null
+++ b/Build/source/libs/graphite/graphite-engine.ac
@@ -0,0 +1,13 @@
+if test "$needs_graphite" = no; then
+ GRAPHITECPPFLAGS=
+ LDGRAPHITE=
+ GRAPHITEDEP=
+else
+ GRAPHITECPPFLAGS='-I$(GRAPHITESRCDIR)/include'
+ LDGRAPHITE='$(GRAPHITEDIR)/src/.libs/libgraphite.a'
+ GRAPHITEDEP='$(GRAPHITEDIR)/src/.libs/libgraphite.a'
+fi
+
+AC_SUBST(GRAPHITECPPFLAGS)
+AC_SUBST(LDGRAPHITE)
+AC_SUBST(GRAPHITEDEP)
diff --git a/Build/source/libs/graphite/include/Makefile.am b/Build/source/libs/graphite/include/Makefile.am
new file mode 100644
index 00000000000..83286118d8d
--- /dev/null
+++ b/Build/source/libs/graphite/include/Makefile.am
@@ -0,0 +1,29 @@
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/FileFont.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/Font.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GraphiteProcess.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrAppData.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrClient.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrCommon.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrConstants.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrData.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrDebug.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrExt.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrFeature.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrMstypes.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrPlatform.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrResult.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrStructs.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/GrWrappers.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/IGraphiteProcess.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/IGrEngine.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/IGrJustifier.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/ITextSource.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/MemoryUsage.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/SegmentAux.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/Segment.h
+graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/SegmentPainter.h
+
+EXTRA_DIST += $(top_srcdir)/include/graphite/BinTree.h
+EXTRA_DIST += $(top_srcdir)/include/graphite/GenericResource.h
+EXTRA_DIST += $(top_srcdir)/include/graphite/HashMap.h
+
diff --git a/Build/source/libs/graphite/include/graphite/BinTree.h b/Build/source/libs/graphite/include/graphite/BinTree.h
new file mode 100644
index 00000000000..a487df03770
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/BinTree.h
@@ -0,0 +1,71 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: BinTree.h
+Responsibility: Darrell Zook
+Last reviewed: 9/8/99
+
+Description:
+ This file provides declarations of binary tree class(es).
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef BINTREE_H_INCLUDED
+#define BINTREE_H_INCLUDED
+
+/*----------------------------------------------------------------------------------------------
+ This template class implements a balanced tree, which is a binary tree where the height of
+ the two children of any node in the tree can only be different by +/- 1 or 0.
+
+ The class of objects to be stored in the tree should be derived from BalTreeBase, because
+ the constructor of BalTreeBase adds an object to the tree in sorted order without
+ allocating any memory.
+
+ Classes that derive from BalTreeBase must have a CompareKey member function that compares
+ a given key with this->key to determine which should be first when sorting the tree.
+ The declaration of CompareKey should be as follows:
+ int CompareKey(const Key & key);
+ and it should return:
+ <0 if key is less than the key in the current node (this->key)
+ 0 if key is equal to the key in the current node (this->key)
+ >0 if key is greater than the key in the current node (this->key)
+
+ CAUTION: Classes that use this template should never be dynamically instantiated (by using
+ local variables or new/NewObj). This class is meant to be used only for global
+ instances of a class. The reason for this restriction is that the tree is never
+ destroyed, so using dynamic instantiations of objects would result in stale pointers
+ in the tree.
+
+ Hungarian: btb
+----------------------------------------------------------------------------------------------*/
+
+template<typename Obj, typename Key> class BalTreeBase
+{
+protected:
+ // Pointers to the left and right subtrees.
+ Obj * m_rgpobj[2];
+
+ // The difference between the height of the right sub tree and the height of the left
+ // sub tree. This should be -1, 0, or +1. Insert may temporarily set it to -2 or +2.
+ short m_dht;
+
+ // Which way we went from this node when inserting the new node.
+ short m_ipobj;
+
+ // Inserts this in the balanced tree.
+ BalTreeBase(Obj ** ppobjRoot, const Key & key);
+
+ // Returns a node with the given key from the tree rooted at pobjRoot.
+ static Obj * Find(Obj * pobjRoot, const Key & key);
+
+private:
+ // Inserts a node in the tree rooted at *ppobjRoot, sorting it based on key.
+ void Insert(Obj ** ppobjRoot, const Key & key);
+};
+
+#endif // !BINTREE_H_INCLUDED
+
diff --git a/Build/source/libs/graphite/include/graphite/FileFont.h b/Build/source/libs/graphite/include/graphite/FileFont.h
new file mode 100644
index 00000000000..bbb26266c71
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/FileFont.h
@@ -0,0 +1,260 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001, 2005 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: XftFont.h
+Responsibility: Keith Stribley
+Last reviewed: Not yet.
+
+Description:
+ A Font is an object that represents a font-family + bold + italic setting, that contains
+ Graphite tables.
+----------------------------------------------------------------------------------------------*/
+#ifndef FILEFONT_INCLUDED
+#define FILEFONT_INCLUDED
+#include "Font.h"
+
+
+//:End Ignore
+
+
+namespace gr
+{
+
+class FontTableCache;
+class GrEngine;
+/*-----------------------------------------------------------------------------
+ Stock implementation of an Xft font class.
+------------------------------------------------------------------------------*/
+/**
+* An implementation of the Graphite gr::Font class for Xft fonts for use on
+* systems using X. Freetype is used to retrieve font information.
+* If you are using Freetype directly, without Xft, you can pass in a FT_Face
+* directly.
+*/
+class FileFont : public Font
+{
+public:
+ /**
+ * The main user constructor. Constructs the font from the supplied FILE pointer.
+ * @param file the FILE pointer to initialise from (must not be null)
+ */
+ FileFont(FILE * file, float pointSize, unsigned int DPIx, unsigned int DPIy = 0);
+
+ /**
+ * Alternative user constructor. Constructs the font from the supplied filename.
+ * @param filename character array
+ */
+ FileFont(char * filename, float pointSize, unsigned int DPIx, unsigned int DPIy = 0);
+
+ /**
+ * Alternative user constructor. Constructs the font from the supplied filename.
+ * @param filename as a string
+ */
+ FileFont(std::string filename, float pointSize,
+ unsigned int DPIx, unsigned int DPIy = 0);
+
+
+ /**
+ * Destructor - cleans up the tables that it has allocated if all other copies
+ * of this font have been deleted.
+ */
+ virtual ~FileFont();
+
+ /**
+ * Returns a copy of the recipient. Specifically needed to store the Font
+ * in a segment.
+ * @internal
+ */
+ virtual Font * copyThis();
+
+ /**
+ * Copy constructor - note the tables are shared between the copy and the
+ * original font for efficiency reasons.
+ * The last copy to be deleted will delete the tables.
+ * @param font the XftGrFont object to copy from.
+ * @internal
+ */
+ FileFont(const FileFont & font, float pointSize = 0, unsigned int DPIx = 0, unsigned int DPIy = 0);
+
+ //virtual FontErrorCode isValidForGraphite(int * pnVersion = NULL, int * pnSubVersion = NULL);
+ /**
+ * Returns a pointer to the start of a table in the font. The ftblid32 type
+ * is a 32-bit unsigned integer.
+ * If the Font class cannot easily determine the length of the table, it may
+ * set 0 as the length (while returning a non-NULL pointer to the table). This
+ * means that certain kinds of error checking cannot be done by the Graphite
+ * engine.
+ * Throws an exception if there is some other error in reading the table, or if
+ * the table asked for is not one of the expected ones (cmap, head, name, Sile,
+ * Silf, Feat, Gloc, Glat). [If we want to be able to read “non-standard”
+ * tables, then the caller needs to be responsible for freeing the memory.]
+ */
+ virtual const void * getTable(fontTableId32 tableID, size_t * pcbSize);
+
+ /**
+ * Returns the basic metrics of the font. It corresponds to the current
+ * GrGraphics::get_FontAscent, get_FontDescent and GetFontEmSquare methods.
+ * @param pAscent pointer to hold font ascent
+ * @param pDescent pointer to hold font descent
+ * @param pEmSquare pointer to hold font EM square
+ */
+ virtual void getFontMetrics(float * pAscent, float * pDescent = NULL,
+ float * pEmSquare = NULL);
+
+ /**
+ * Returns true if the given arguments specify a font that contains Graphite
+ * tables—specfically a “Silf” table.
+ * @param xftFont XftFont pointer
+ * @return true if this font has the silf table
+ */
+ bool fontHasGraphiteTables();
+
+ /**
+ * Returns true if the given arguments specify a font that contains Graphite
+ * tables—specfically a “Silf” table.
+ * @param xftFont XftFont pointer
+ * @return true if this font has the silf table
+ */
+ static bool FontHasGraphiteTables(FILE * file);
+
+ /**
+ * Returns true if the given arguments specify a font that contains Graphite
+ * tables—specfically a “Silf” table.
+ * @param face FT_Face handle
+ * @return true if this font has the silf table
+ */
+ static bool FontHasGraphiteTables(char * filename);
+
+ // Temporary, until interface gets thoroughly reworked:
+ GrEngine * GraphiteEngine();
+
+ /**
+ * Returns the font ascent in pixels. Using floating point allows us to
+ * avoid rounding errors.
+ * Value is the same as that returned by getFontMetrics()
+ * @return the font ascent
+ */
+ virtual float ascent()
+ {
+ float pixAscent;
+ getFontMetrics(&pixAscent);
+ return pixAscent;
+ }
+ /**
+ * Returns the font descent in pixels with a positive sign.
+ * Value is the same as that returned by getFontMetrics()
+ * @return the font descent in pixels.
+ */
+ virtual float descent()
+ {
+ float pixDescent;
+ getFontMetrics(NULL, &pixDescent);
+ return pixDescent;
+ }
+ /**
+ * Returns the total height of the font.
+ * Equivalent to ascent() + descent().
+ * @return font height
+ */
+ virtual float height()
+ {
+ float pixAscent;
+ float pixDescent;
+ getFontMetrics(&pixAscent, &pixDescent);
+ return (pixAscent + pixDescent);
+ }
+ /**
+ * @return true if the font is a bold styled one.
+ */
+ virtual bool bold()
+ {
+ return m_fBold;
+ }
+ /**
+ * @return true if the font is italic
+ */
+ virtual bool italic()
+ {
+ return m_fItalic;
+ }
+ /** @return the DPI for the x-axis.
+ */
+ virtual unsigned int getDPIx()
+ {
+ return m_dpiX;
+ }
+ /** @return Returns the DPI for the y-axis.
+ */
+ virtual unsigned int getDPIy()
+ {
+ return m_dpiY;
+ }
+ // Specific to XftGrFont:
+
+ /** @return set the DPI for the x-axis.
+ */
+ virtual void setDPIx(unsigned int dpi)
+ {
+ m_dpiX = dpi;
+ m_xScale = scaleFromDpi(dpi);
+ }
+ /** @return set the DPI for the y-axis.
+ */
+ virtual void setDPIy(unsigned int dpi)
+ {
+ m_dpiY = dpi;
+ m_yScale = scaleFromDpi(dpi);
+ }
+
+ bool isValid() { return m_fIsValid; };
+protected:
+ /** Default constructor is not used */
+ FileFont();
+ /**
+ * Common initialisation between the XftFont and FT_Face constructors.
+ */
+ void initializeFromFace(void);
+ // this uses an int to avoid having to include TtfUtil.h in the include
+ // directory
+ byte * readTable(int /*TableId*/ tableId, size_t & size);
+
+ // pixels-per-em = dpi * point-size / 72
+ // pixel-coord = design-coord * pixels-per-em / font-em-square
+ float scaleFromDpi(int dpi)
+ {
+ return (dpi * m_pointSize) / (72.0f * m_mEmSquare);
+ }
+
+ // Member variables:
+ FILE * m_pfile;
+
+ unsigned long m_clrFore;
+ unsigned long m_clrBack;
+ bool m_fBold;
+ bool m_fItalic;
+ // font table caches:
+ FontTableCache * m_pTableCache;
+
+ // KRS: I think these should be cached otherwise Segment::LineContextSegment doesn't work
+ float m_mAscent;
+ float m_mDescent;
+ float m_mEmSquare;
+ float m_pointSize;
+ int m_dpiX;
+ int m_dpiY;
+ bool m_fIsValid;
+ std::wstring m_stuFaceName;
+ byte * m_pHeader;
+ byte * m_pTableDir;
+ float m_xScale;
+ float m_yScale;
+};
+
+
+} // namespace gr
+
+#endif
+
diff --git a/Build/source/libs/graphite/include/graphite/Font.h b/Build/source/libs/graphite/include/graphite/Font.h
new file mode 100644
index 00000000000..64f62b3ff62
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/Font.h
@@ -0,0 +1,416 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: Font.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ A Font is an object that represents a font-family + bold + italic setting, that contains
+ Graphite tables. This file also includes related iterators: FeatureIterator,
+ FeatureSettingIterator, FeatLabelLangIterator, LanguageIterator.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef FONT_INCLUDED
+#define FONT_INCLUDED
+
+//:End Ignore
+
+namespace gr
+{
+
+class Font;
+class FontFace;
+class FeatureSettingIterator;
+class Segment;
+class LayoutEnvironment;
+class ITextSource;
+class FontMemoryUsage;
+
+typedef struct tagFontProps
+{
+ unsigned long clrFore;
+ unsigned long clrBack;
+ bool fBold;
+ bool fItalic;
+ float pixHeight;
+ wchar_t szFaceName[ 32 ];
+} FontProps;
+
+
+/*----------------------------------------------------------------------------------------------
+ A FontError object is an exception that is thrown when there is an error in initializing
+ a Graphite font.
+----------------------------------------------------------------------------------------------*/
+struct FontException
+{
+ FontErrorCode errorCode;
+ int version;
+ int subVersion;
+};
+
+/*----------------------------------------------------------------------------------------------
+ Iterator to provide access to a font's features.
+----------------------------------------------------------------------------------------------*/
+class FeatureIterator
+{
+ friend class Font;
+ friend class FeatureSettingIterator;
+
+public:
+ FeatureIterator() // needed for creating std::pair of these, and for default FSI
+ {
+ m_pfont = NULL;
+ m_ifeat = 0;
+ m_cfeat = 0;
+ }
+
+protected:
+ FeatureIterator(Font * pfont, int ifeat, size_t cfeat)
+ {
+ m_pfont = pfont;
+ m_ifeat = ifeat;
+ m_cfeat = cfeat;
+ }
+public:
+ featid operator*();
+ FeatureIterator operator++();
+ FeatureIterator operator+=(int n);
+ bool operator==(FeatureIterator &);
+ bool operator!=(FeatureIterator &);
+ int operator-(FeatureIterator &);
+
+protected:
+ Font * m_pfont;
+ size_t m_ifeat; // feature being pointed at
+ size_t m_cfeat; // number of features for this font
+
+ FeatureSettingIterator BeginSetting();
+ FeatureSettingIterator EndSetting();
+};
+
+/*----------------------------------------------------------------------------------------------
+ Iterator to provide access to the defined values for a single font feature.
+----------------------------------------------------------------------------------------------*/
+class FeatureSettingIterator
+{
+ friend class Font;
+ friend class FeatureIterator;
+
+public:
+ FeatureSettingIterator() // needed for creating std::pair of these, I think
+ {
+ m_ifset = 0;
+ m_cfset = 0;
+ }
+protected:
+ FeatureSettingIterator(FeatureIterator fit, int ifset, size_t cfset)
+ {
+ m_fit = fit;
+ m_ifset = ifset;
+ m_cfset = cfset;
+ }
+public:
+ int operator*();
+ FeatureSettingIterator operator++();
+ FeatureSettingIterator operator +=(int n);
+ bool operator==(FeatureSettingIterator &);
+ bool operator!=(FeatureSettingIterator &);
+ int operator-(FeatureSettingIterator);
+
+protected:
+ FeatureIterator m_fit;
+ size_t m_ifset; // which setting being pointed at
+ size_t m_cfset; // number of settings for this feature
+};
+
+/*----------------------------------------------------------------------------------------------
+ Iterator to provide access to the languages available for the feature label strings.
+----------------------------------------------------------------------------------------------*/
+class FeatLabelLangIterator
+{
+ friend class Font;
+
+public:
+ FeatLabelLangIterator() // needed for creating std::pair of these, and for default FSI
+ {
+ m_pfont = NULL;
+ m_ilang = 0;
+ m_clang = 0;
+ }
+
+protected:
+ FeatLabelLangIterator(Font * pfont, int ilang, size_t clang)
+ {
+ m_pfont = pfont;
+ m_ilang = ilang;
+ m_clang = clang;
+ }
+public:
+ data16 operator*();
+ FeatLabelLangIterator operator++();
+ FeatLabelLangIterator operator+=(int n);
+ bool operator==(FeatLabelLangIterator &);
+ bool operator!=(FeatLabelLangIterator &);
+ int operator-(FeatLabelLangIterator &);
+
+protected:
+ Font * m_pfont;
+ size_t m_ilang; // language being pointed at
+ size_t m_clang; // number of languages for this font
+};
+
+/*----------------------------------------------------------------------------------------------
+ Iterator to provide access to a font's defined languages--ie, those that have feature
+ settings associated with them.
+----------------------------------------------------------------------------------------------*/
+class LanguageIterator
+{
+ friend class Font;
+
+public:
+ LanguageIterator() // needed for creating std::pair of these, and for default FSI
+ {
+ m_pfont = NULL;
+ m_ilang = 0;
+ m_clang = 0;
+ }
+
+protected:
+ LanguageIterator(Font * pfont, int ilang, size_t clang)
+ {
+ m_pfont = pfont;
+ m_ilang = ilang;
+ m_clang = clang;
+ }
+public:
+ isocode operator*(); // returns a 4-char array
+ LanguageIterator operator++();
+ LanguageIterator operator+=(int n);
+ bool operator==(LanguageIterator &);
+ bool operator!=(LanguageIterator &);
+ int operator-(LanguageIterator &);
+
+protected:
+ Font * m_pfont;
+ size_t m_ilang; // language being pointed at
+ size_t m_clang; // number of languages for this font
+};
+
+/*----------------------------------------------------------------------------------------------
+ Abstract superclass for Graphite fonts. A font represents a face name, size, and bold and
+ italic styles.
+----------------------------------------------------------------------------------------------*/
+class Font {
+
+ friend class FeatureIterator;
+ friend class FeatureSettingIterator;
+ friend class FeatLabelLangIterator;
+ friend class LanguageIterator;
+ friend class FontMemoryUsage;
+
+public:
+ virtual ~Font();
+
+ /**
+ * Returns a copy of the recipient. Specifically needed to store the
+ * Font in a segment.
+ * @internal
+ * @return pointer to copy
+ */
+ virtual Font * copyThis() = 0;
+
+ /**
+ * Return wether the font is bold.
+ * @return true when bold
+ */
+ virtual bool bold() = 0;
+ /**
+ * Return wether the font is italic.
+ * @return true when italic
+ */
+ virtual bool italic() = 0;
+
+ /**
+ * Returns the slope of the italic (if the font is italic)
+ * @return ratio of slope from the vertical
+ */
+ virtual float fakeItalicRatio() { return 0; } // no support for fake italic
+
+ /**
+ * Returns the font ascent.
+ * Value is the same as that returned by getFontMetrics()
+ * @return the font ascent in device co-ordinates
+ */
+ virtual float ascent() = 0;
+
+ /**
+ * Returns the font descent.
+ * Value is the same as that returned by getFontMetrics()
+ * @return the font descent in device co-ordinates
+ */
+ virtual float descent() = 0;
+
+ /**
+ * Returns the total height of the font.
+ * @return font height in device co-ordinates
+ */
+ virtual float height() = 0;
+
+ /**
+ * Returns the x and y resolution of the device co-ordinate space.
+ */
+ virtual unsigned int getDPIx() = 0;
+ virtual unsigned int getDPIy() = 0;
+
+ /**
+ * Returns a pointer to the start of a table in the font.
+ * If the Font class cannot easily determine the length of the table,
+ * it may set 0 as the length (while returning a non-NULL pointer to
+ * the table). This means that certain kinds of error checking cannot
+ * be done by the Graphite engine.
+ * Throws an exception if there is some other error in reading the
+ * table, or if the table asked for is not in the font.
+ * @param tableID the TTF ID of the table as a 32-bit long in native machine byte order
+ * @param pcbSize pointer to a size_t to hold the table size.
+ * @return address of the buffer containing the table or 0
+ */
+ virtual const void * getTable(fontTableId32 tableID, size_t * pcbSize) = 0;
+ /**
+ * Fetches the basic metrics of the font in device co-ordinates
+ * (normaly pixels).
+ * @param pAscent pointer to hold font ascent.
+ * @param pDescent pointer to hold font descent.
+ * @param pEmSquare pointer to hold font EM square.
+ */
+ virtual void getFontMetrics(float * pAscent, float * pDescent = NULL,
+ float * pEmSquare = NULL) = 0;
+ /**
+ * Converts the point number of a glyph’s on-curve point to a pair of
+ * x/y coordinates in pixels. The default implementation will read the
+ * curve information directly from the font and perform a simple
+ * transformation to pixels. Some subclasses (e.g., WinFont) will use
+ * a system-level API call to return hinted metrics.
+ * Note that the coordinates returned are floating point values in the
+ * device co-ordinate space (normaly pixels).
+ * @param gid glyph id
+ * @param pointNum within glyph
+ * @param xyReturn reference to a Point object to hold the x,y result
+ */
+ virtual void getGlyphPoint(gid16 glyphID, unsigned int pointNum, gr::Point & pointReturn);
+
+ /**
+ * Returns the metrics of a glyph in the font. The default
+ * implementation will read the information directly from the font and
+ * perform a simple transformation to pixels. Some subclasses (e.g.,
+ * WinFont) will use a system-level API call to return hinted metrics.
+ * Note that the coordinates returned are floating point values in the
+ * device co-ordinate space (normaly pixels).
+ * @param glyphID
+ * @param boundingBox reference to gr::Rect to hold bounding box of glyph
+ * @param advances refererence to gr::Point to hold the horizontal / vertical advances
+ */
+ virtual void getGlyphMetrics(gid16 glyphID, gr::Rect & boundingBox, gr::Point & advances);
+
+ static void SetFlushMode(int);
+ static int GetFlushMode();
+
+ // obsolete:
+ //virtual FontErrorCode isValidForGraphite(int * pnVersion = NULL, int * pnSubVersion = NULL) = 0;
+
+ // Features:
+ std::pair<FeatureIterator, FeatureIterator> getFeatures();
+ FeatureIterator featureWithID(featid id);
+ bool getFeatureLabel(FeatureIterator, lgid language, utf16 * label);
+ FeatureSettingIterator getDefaultFeatureValue(FeatureIterator);
+ std::pair<FeatureSettingIterator, FeatureSettingIterator> getFeatureSettings(FeatureIterator);
+ bool getFeatureSettingLabel(FeatureSettingIterator, lgid language, utf16 * label);
+
+ std::pair<FeatLabelLangIterator, FeatLabelLangIterator> getFeatureLabelLanguages();
+
+ // Languages:
+ std::pair<LanguageIterator, LanguageIterator> getSupportedLanguages();
+
+ // Script directions, Verticle, LTR, RTL etc see enum ScriptDirCode
+ // the posibilities. This returns a bit set where more than one scripts may
+ // be set, it's up to the app to decide which is the prefered direction to use.
+ ScriptDirCode getSupportedScriptDirections() const throw();
+
+ // Debugging:
+ //static bool DbgCheckFontCache();
+
+ static FontMemoryUsage calculateMemoryUsage();
+ ///FontMemoryUsage calculateMemoryUsage(bool fBold = false, bool fItalic = false);
+
+public:
+ // For use in segment creation:
+ void RenderLineFillSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout,
+ toffset ichStart, toffset ichStop, float xsMaxWidth, bool fBacktracking);
+ void RenderRangeSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout,
+ toffset ichStart, toffset ichEnd);
+ void RenderJustifiedSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout,
+ toffset ichStart, toffset ichEnd, float xsCurrentWidth, float xsDesiredWidth);
+
+protected:
+ Font();
+ Font(const Font &);
+
+ FontFace & fontFace(bool fDumbFallback = false);
+
+ // Feature access:
+ FeatureIterator BeginFeature();
+ FeatureIterator EndFeature();
+
+ size_t NumberOfFeatures();
+ featid FeatureID(size_t ifeat);
+ size_t FeatureWithID(featid id);
+ bool GetFeatureLabel(size_t ifeat, lgid language, utf16 * label);
+ int GetFeatureDefault(size_t ifeat);
+ size_t NumberOfSettings(size_t ifeat);
+ int GetFeatureSettingValue(size_t ifeat, size_t ifset);
+ bool GetFeatureSettingLabel(size_t ifeat, size_t ifset, lgid language, utf16 * label);
+
+ // Feature-label languages:
+ FeatLabelLangIterator BeginFeatLang();
+ FeatLabelLangIterator EndFeatLang();
+
+ size_t NumberOfFeatLangs();
+ short FeatLabelLang(size_t ilang);
+
+ // Language access:
+ LanguageIterator BeginLanguage();
+ LanguageIterator EndLanguage();
+
+ size_t NumberOfLanguages();
+ isocode LanguageCode(size_t ilang);
+
+ virtual void UniqueCacheInfo(std::wstring & stuFace, bool & fBold, bool & fItalic);
+
+private:
+ FontFace * m_pfface; // set up with Graphite tables
+
+ // Cache of common tables:
+ const void * m_pHead;
+ const void * m_pHmtx;
+ const void * m_pLoca;
+ const void * m_pGlyf;
+ size_t m_cbHmtxSize;
+ size_t m_cbLocaSize;
+ bool m_fTablesCached;
+
+ void initialiseFontFace(bool fDumbFallback);
+ void EnsureTablesCached();
+};
+
+inline Font::Font() : m_pfface(0), m_fTablesCached(false)
+{ }
+
+} // namespace gr
+
+
+#endif // !FONT_INCLUDED
diff --git a/Build/source/libs/graphite/include/graphite/GenericResource.h b/Build/source/libs/graphite/include/graphite/GenericResource.h
new file mode 100644
index 00000000000..119c6317bcd
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/GenericResource.h
@@ -0,0 +1,86 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GenericResource.h
+Responsibility: John Thomson
+Last reviewed:
+
+ Resources needed by certain generic components (but must be created in app's or AppCore's
+ resource file).
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GenericResource_H
+#define GenericResource_H 1
+// Create suitable resources for these if your app uses StackDumper.
+// For example
+// STRINGTABLE DISCARDABLE
+// BEGIN
+// "A programming error (%s) has been detected in module %s.\n Please report this to the developers", kstidInternalError
+// "Out of memory. To attempt Save, close other apps and click OK. To quit without saving click Cancel", kstidOutOfMemory
+// END
+
+
+// Date qualifier string IDs:
+#define kstidDateQualBefore 24200
+#define kstidDateQualOn 24201
+#define kstidDateQualAbout 24202
+#define kstidDateQualAfter 24203
+#define kstidDateQualAbt 24204
+#define kstidDateQualBC 24205
+#define kstidDateQualAD 24206
+#define kstidDateBlank 24207
+#define kstidDateBlankM 24208
+#define kstidDateBlankD 24209
+
+
+#define kstidInternalError 25900
+#define khcidHelpOutOfMemory 25901
+#define khcidNoHelpAvailable 25902 // default help module when there is no specific one.
+#define kstidOutOfMemory 25903
+#define kstidUndoFrame 25904
+#define kstidRedoFrame 25905
+
+#define kstidFileErrUnknown 25920
+#define kstidFileErrNotFound 25921
+#define kstidFileErrPathNotFound 25922
+#define kstidFileErrTooManyFiles 25923
+#define kstidFileErrAccDenied 25924
+#define kstidFileErrBadHandle 25925
+#define kstidFileErrBadDrive 25926
+#define kstidFileErrWriteProtect 25927
+#define kstidFileErrBadUnit 25928
+#define kstidFileErrNotReady 25929
+#define kstidFileErrSeek 25930
+#define kstidFileErrNotDosDisk 25931
+#define kstidFileErrBadSector 25932
+#define kstidFileErrWriteFault 25933
+#define kstidFileErrReadFault 25934
+#define kstidFileErrGeneral 25935
+#define kstidFileErrSharing 25936
+#define kstidFileErrLock 25937
+#define kstidFileErrEof 25938
+#define kstidFileErrHandleDiskFull 25939
+#define kstidFileErrBadNetPath 25940
+#define kstidFileErrNetworkBusy 25941
+#define kstidFileErrNoDevice 25942
+#define kstidFileErrNoNetAccess 25943
+#define kstidFileErrBadDevice 25944
+#define kstidFileErrBadNetName 25945
+#define kstidFileErrExists 25946
+#define kstidFileErrCantMake 25947
+#define kstidFileErrBadPassword 25948
+#define kstidFileErrNetWriteFault 25949
+#define kstidFileErrDriveLocked 25950
+#define kstidFileErrOpenFailed 25951
+#define kstidFileErrBufOverflow 25952
+#define kstidFileErrDiskFull 25953
+#define kstidFileErrBadName 25954
+#define kstidFileErrNoVolLabel 25955
+#define kstidFileErrAlreadyExists 25956
+
+#endif // !GenericResource_H
diff --git a/Build/source/libs/graphite/include/graphite/GrAppData.h b/Build/source/libs/graphite/include/graphite/GrAppData.h
new file mode 100644
index 00000000000..3a2024b8a10
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/GrAppData.h
@@ -0,0 +1,39 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrAppData.h
+Responsibility: Sharon Correll
+Last reviewed: not yet
+
+Description:
+ Data structures need by applications that use the Graphite engine.
+----------------------------------------------------------------------------------------------*/
+
+
+#ifndef GRAPPDATA_INCLUDED
+#define GRAPPDATA_INCLUDED
+
+#include "GrData.h"
+
+namespace gr
+{
+
+typedef unsigned int featid; // font feature IDs
+typedef unsigned int lgid; // language ID (for access feature UI strings)
+typedef unsigned int toffset; // text-source index
+
+typedef struct { // ISO-639-3 language code (for mapping onto features)
+ char rgch[4];
+} isocode;
+
+} // namespace gr
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif // GRAPPDATA_INCLUDED
+
diff --git a/Build/source/libs/graphite/include/graphite/GrClient.h b/Build/source/libs/graphite/include/graphite/GrClient.h
new file mode 100644
index 00000000000..0ef5127c81a
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/GrClient.h
@@ -0,0 +1,39 @@
+#ifndef GR_CLIENT_H
+#define GR_CLIENT_H
+
+#include "GrCommon.h"
+#include "GrConstants.h"
+
+#define __RPC_FAR
+
+namespace gr
+{
+
+// These are internal classes, whose forward declarations are needed to allow the public interfaces
+// to compile but are not intended for client use.
+class GrSlotState;
+class GrSlotStream;
+class GrGlyphTable;
+class GrClassTable;
+class GrTableManager;
+class GrPseudoMap;
+class GrFileIStream;
+class GrSlotOutput;
+class GrCharStream;
+class GrIStream;
+
+// Forward declarations of client APIs and classes.
+class Segment;
+}
+
+#include "GrAppData.h"
+#include "GrResult.h"
+#include "GrFeature.h"
+
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif //GR_CLIENT_H
+
diff --git a/Build/source/libs/graphite/include/graphite/GrCommon.h b/Build/source/libs/graphite/include/graphite/GrCommon.h
new file mode 100644
index 00000000000..8bb5728ecb3
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/GrCommon.h
@@ -0,0 +1,145 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001, 2003 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrCommon.h
+Responsibility: Sharon Correll
+Last reviewed:
+
+ Common generic header file.
+
+ This header file checks for the following compile time switches:
+
+ USING_MFC
+----------------------------------------------------------------------------------------------*/
+
+#ifndef GRCOMMON_INCLUDED
+#define GRCOMMON_INCLUDED
+
+
+// Standard Headers.
+
+#include <cstdlib>
+#include <cstdio>
+#include <cstdarg>
+#include <climits>
+//#include <exception>
+#include <new>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+#include <algorithm>
+#include <string>
+
+// Uncomment this to allow multiple versions of gr to coexist
+// in the same program e.g. pangographite with gtk uses namespace gr
+// mozilla graphite defines this to gr2moz incase the 2 libraries are
+// incompatible.
+// Provided the client includes GrClient.h first this #define is
+// picked up by all files.
+
+//#define gr gr2
+
+// Project headers
+#include "GrPlatform.h"
+
+#ifndef GrAssert
+#include <cassert>
+#define GrAssert(exp) assert(exp)
+#endif
+
+using std::max;
+using std::min;
+
+namespace gr
+{
+
+
+/***********************************************************************************************
+ Simple types.
+***********************************************************************************************/
+typedef char schar;
+
+// TODO ShonK: Make generic use these where appropriate.
+#ifdef UNICODE
+typedef utf16 achar;
+#else // !UNICODE
+typedef schar achar;
+#endif // UNICODE
+
+typedef achar *Psz;
+//typedef const achar * Pcsz;
+
+
+
+// This is to make a signed isizeof operator, otherwise we get tons of warnings about
+// signed / unsigned mismatches.
+#define isizeof(T) (sizeof(T))
+
+#define SizeOfArray(rgt) (isizeof(rgt) / isizeof(rgt[0]))
+
+
+/***********************************************************************************************
+ Tests for valid strings and pointers.
+***********************************************************************************************/
+inline bool ValidPsz(const data16 *pszw)
+{
+ // TODO ShonK: Determine if IsBadStringPtrW is implemented on Win9x.
+ return pszw != 0 && !GrIsBadStringPtrW(pszw, 0x10000000);
+}
+
+inline bool ValidPsz(const schar *pszs)
+{
+ return pszs != 0 && !GrIsBadStringPtrA(pszs, 0x10000000);
+}
+
+template<typename T> inline bool ValidReadPtr(T *pt)
+{
+ return pt != 0 && !GrIsBadReadPtr(pt, isizeof(T));
+}
+
+template<typename T> inline bool ValidWritePtr(T *pt)
+{
+ return pt != 0 && !GrIsBadWritePtr(pt, isizeof(T));
+}
+
+inline bool ValidReadPtrSize(const void *pv, int cb)
+{
+ if (cb < 0) return false;
+ if (cb == 0) return true;
+
+ return pv != 0 && !GrIsBadReadPtr(pv, cb);
+}
+
+inline bool ValidWritePtrSize(void *pv, int cb)
+{
+// if (!bstr || ::IsBadReadPtr((byte *)bstr - isizeof(int), isizeof(int) + isizeof(OLECHAR)))
+// return false;
+// int cb = ((int *)bstr)[-1];
+// if (::IsBadReadPtr((byte *)bstr - isizeof(int), isizeof(int) + isizeof(OLECHAR) + cb))
+// return false;
+ if (cb < 0) return false;
+ if (cb == 0) return true;
+
+ return pv != 0 && !GrIsBadWritePtr(pv, cb);
+}
+
+
+} // namespace gr
+
+
+// TODO Remove these as soon as they are no longer needed by GrCompiler:
+//#include "UtilMem.h"
+//#include "UtilRect.h"
+//#include "UtilString.h"
+//#include "UtilVector.h"
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif // !GRCOMMON_INCLUDED
+
diff --git a/Build/source/libs/graphite/include/graphite/GrConstants.h b/Build/source/libs/graphite/include/graphite/GrConstants.h
new file mode 100644
index 00000000000..61f79b88022
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/GrConstants.h
@@ -0,0 +1,268 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999 - 2008 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: constants.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Various global constants.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GRCONSTANTS_INCLUDED
+#define GRCONSTANTS_INCLUDED
+
+//:End Ignore
+
+namespace gr
+{
+
+// Maximum table versions handled by this engine:
+enum {
+
+ kSilfVersion = 0x00030000,
+ kRuleVersion = 0x00030000,
+ kGlatVersion = 0x00010000,
+ kGlocVersion = 0x00010000,
+ kFeatVersion = 0x00020000,
+ kSileVersion = 0x00010000,
+ kSillVersion = 0x00010000
+
+};
+
+enum {
+
+ kMaxFeatures = 64,
+ kMaxComponentsPerGlyph = 32,
+ kFieldsPerComponent = 4,
+ kMaxSlotsPerRule = 64,
+ kMaxSubTablesInFont = 256,
+ kMaxUserDefinableSlotAttrs = 64,
+ kMaxJLevels = 4
+
+};
+
+// Maxima permitted by the binary format of the TrueType tables.
+enum {
+
+ kMaxSubTables = 256,
+ kMaxRenderingBehavior = 65536, // ie, the maximum value allowed for an ID
+ kMaxGlyphAttrs = 65536, // Gloc table
+ kMinGlyphAttrValue =-32768,
+ kMaxGlyphAttrValue = 32768,
+ kMaxPasses = 128, // Sil_sub table allows 256
+ kMaxPseudos = 65536,
+ kMaxRendBehaviors = 256,
+ kMaxReplcmtClasses = 65536, // Class map
+ kMaxReplcmtClassesV1_2 = 256,
+ kMaxComponents = 16383
+
+};
+
+
+enum {
+
+ kPosInfinity = 0x3FFFFFF,
+ kNegInfinity = kPosInfinity * -1,
+
+ kInvalid = kNegInfinity
+
+};
+
+#define kPosInfFloat (float)kPosInfinity
+#define kNegInfFloat (float)kNegInfinity
+
+
+enum {
+ kGpointZero = -2
+};
+
+
+// for stream processing
+enum {
+ kBacktrack = -2,
+ kNextPass = -1
+};
+
+
+// internal justification modes
+enum {
+ kjmodiNormal = 0,
+ kjmodiMeasure,
+ kjmodiJustify,
+ kjmodiCanShrink // like normal, but shrinking is possible
+};
+
+
+enum DirCode { // Hungarian: dirc
+
+ kdircUnknown = -1,
+ kdircNeutral = 0, // other neutrals (default) - ON
+ kdircL = 1, // left-to-right, strong - L
+ kdircR = 2, // right-to-left, strong - R
+ kdircRArab = 3, // Arabic letter, right-to-left, strong, AR
+ kdircEuroNum = 4, // European number, left-to-right, weak - EN
+ kdircEuroSep = 5, // European separator, left-to-right, weak - ES
+ kdircEuroTerm = 6, // European number terminator, left-to-right, weak - ET
+ kdircArabNum = 7, // Arabic number, left-to-right, weak - AN
+ kdircComSep = 8, // Common number separator, left-to-right, weak - CS
+ kdircWhiteSpace = 9, // white space, neutral - WS
+ kdircBndNeutral = 10, // boundary neutral - BN
+
+ kdircLRO = 11, // LTR override
+ kdircRLO = 12, // RTL override
+ kdircLRE = 13, // LTR embedding
+ kdircRLE = 14, // RTL embedding
+ kdircPDF = 15, // pop directional format
+
+ // I think we need this too:
+ kdircNSM = 16, // non-space mark
+
+ // Special values for internal use:
+ kdircLlb = 32, // left-to-right line-break
+ kdircRlb = 33, // right-to-left line-break
+ kdircPdfL = 34, // PDF marker matching an LRO or LRE
+ kdircPdfR = 35 // PDF marker matching an RLO or RLE
+
+};
+
+
+bool StrongDir(DirCode dirc);
+bool WeakDir(DirCode dirc);
+bool NeutralDir(DirCode dirc);
+bool RightToLeftDir(DirCode dirc);
+
+
+// Unicode characters with special treatments
+enum DefinedChars {
+
+ knSpace = 0x0020, // space
+ knHyphen = 0x002D, // hyphen
+
+ knTab = 0x0009, // tab (horizontal)
+ knLF = 0x000A, // line feed
+ knCR = 0x000D, // carriage return
+ knLineSep = 0x2028, // line separator (soft return)
+ knParaSep = 0x2029, // paragraph separator
+
+ knLRM = 0x200E, // left-to-right mark
+ knRLM = 0x200F, // right-to-left mark
+ knLRE = 0x202A, // left-to-right embedding
+ knRLE = 0x202B, // right-to-left embedding
+ knPDF = 0x202C, // pop directional format
+ knLRO = 0x202D, // left-to-right override
+ knRLO = 0x202E, // right-to-left override
+
+ knORC = 0xFFFC // Object Replacement Character
+};
+
+bool BidiCode(int nUnicode);
+
+
+typedef enum SpecialSlots {
+
+ kspslNone = 0,
+
+ kspslLbInitial = 1,
+ kspslLbFinal = 2,
+
+ kspslLRM = 3,
+ kspslRLM = 4,
+ kspslLRO = 5,
+ kspslRLO = 6,
+ kspslLRE = 7,
+ kspslRLE = 8,
+ kspslPDF = 9
+
+} SpecialSlots;
+
+
+// version 1.0 breakweights
+enum BreakWeightsV1
+{
+ klbv1WordBreak = 1,
+ klbv1HyphenBreak = 2,
+ klbv1LetterBreak = 3,
+ klbv1ClipBreak = 4
+};
+
+
+typedef enum SlotAttrName {
+
+ kslatAdvX = 0, kslatAdvY,
+ kslatAttTo,
+ kslatAttAtX, kslatAttAtY, kslatAttAtGpt,
+ kslatAttAtXoff, kslatAttAtYoff,
+ kslatAttWithX, kslatAttWithY, kslatAttWithGpt,
+ kslatAttWithXoff, kslatAttWithYoff,
+ kslatAttLevel,
+ kslatBreak,
+ kslatCompRef,
+ kslatDir,
+ kslatInsert,
+ kslatPosX, kslatPosY,
+ kslatShiftX, kslatShiftY,
+ kslatUserDefnV1, // version 1.0 of the font tables
+ kslatMeasureSol, kslatMeasureEol,
+ kslatJStretch, kslatJShrink, kslatJStep, kslatJWeight, kslatJWidth,
+ // this must be last:
+ kslatUserDefn = kslatJStretch + 30,
+ // I think 30 is somewhat arbitrary. We at least need to save 15 slots for more levels of
+ // justification attributes.
+
+ kslatMax,
+
+ kslatNoEffect = kslatMax + 1 // for internal use
+} SlotAttrName;
+
+
+typedef enum GlyphMetric {
+ kgmetLsb = 0, kgmetRsb,
+ kgmetBbTop, kgmetBbBottom, kgmetBbLeft, kgmetBbRight,
+ kgmetBbHeight, kgmetBbWidth,
+ kgmetAdvWidth, kgmetAdvHeight,
+ kgmetAscent, kgmetDescent
+} GlyphMetric;
+
+
+enum ProcessStates
+{
+ kpstatJustifyMode = 1,
+ kpstatJustifyLevel = 2
+};
+
+// user justification modes: these must match the values in stddef.gdh
+enum JustifyModes
+{
+ kjmoduNormal = 0,
+ kjmoduMeasure = 1,
+ kjmoduJustify = 2
+};
+
+enum TruetypeTableId {
+ kttiCmap = 0x636D6170,
+ kttiFeat = 0x46656174,
+ kttiGlat = 0x476C6174,
+ kttiGloc = 0x476C6F63,
+ kttiGlyf = 0x676C7966,
+ kttiHead = 0x68656164,
+ kttiHhea = 0x68686561,
+ kttiHmtx = 0x686D7478,
+ kttiLoca = 0x6C6F6361,
+ kttiMaxp = 0x6D617870,
+ kttiName = 0x6E616D65,
+ kttiOs2 = 0x4F532F32,
+ kttiPost = 0x706F7374,
+ kttiSile = 0x53696C65,
+ kttiSilf = 0x53696C66,
+ kttiSill = 0x53696C6C
+};
+
+} // namespace gr
+
+#endif // CONSTANTS_INCLUDED
diff --git a/Build/source/libs/graphite/include/graphite/GrData.h b/Build/source/libs/graphite/include/graphite/GrData.h
new file mode 100644
index 00000000000..3624ca9c271
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/GrData.h
@@ -0,0 +1,226 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrData.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Data structures needed by the Graphite engine, particularly for argument passing.
+ NOT to be used within FieldWorks.
+
+Special Note:
+ This file needs to be used by C files. Please do not use C++ style comments; use
+ ONLY C style comments in this file to make the C compiler happy.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GRDATA_INCLUDED
+#define GRDATA_INCLUDED
+
+#include "GrCommon.h"
+
+/*
+//:End Ignore
+ */
+
+#include "GrStructs.h"
+
+namespace gr
+{
+
+struct Point
+{
+ float x;
+ float y;
+
+ Point()
+ {
+ x = y = 0;
+ }
+
+#if defined(_WIN32)
+ Point(POINT & p)
+ {
+ x = (float)p.x;
+ y = (float)p.y;
+ }
+#endif
+};
+
+
+struct Rect
+{
+ float top;
+ float bottom;
+ float left;
+ float right;
+
+ Rect()
+ {
+ top = bottom = left = right = 0;
+ };
+
+#if defined(_WIN32)
+ Rect(RECT & r)
+ {
+ top = (float)r.top;
+ bottom = (float)r.bottom;
+ left = (float)r.left;
+ right = (float)r.right;
+ };
+#endif
+};
+
+enum {
+ kttvOff = 0,
+ kttvForceOn = 1,
+ kttvInvert = 2
+};
+
+//typedef struct tagLgParaRenderProps
+//{
+// int dummy;
+//} LgParaRenderProps;
+
+typedef enum tagSegEnd
+{ kestNoMore = 0,
+ kestMoreLines = kestNoMore + 1,
+ kestHardBreak = kestMoreLines + 1,
+ kestBadBreak = kestHardBreak + 1,
+ kestOkayBreak = kestBadBreak + 1,
+ kestWsBreak = kestOkayBreak + 1,
+ kestMoreWhtsp = kestWsBreak + 1,
+ kestNothingFit = kestMoreWhtsp + 1
+} SegEnd;
+
+typedef enum tagLgIPDrawMode // TODO: remove
+{ kdmNormal = 0,
+ kdmSplitPrimary = kdmNormal + 1,
+ kdmSplitSecondary = kdmSplitPrimary + 1
+} LgIPDrawMode;
+
+typedef enum tagLgIpValidResult
+{ kipvrOK = 0,
+ kipvrBad = kipvrOK + 1,
+ kipvrUnknown = kipvrBad + 1
+} LgIpValidResult;
+
+typedef enum tagLineBrk
+{ klbNoBreak = 0,
+ klbWsBreak = 10,
+ klbWordBreak = 15,
+ klbHyphenBreak = 20,
+ klbLetterBreak = 30,
+ klbClipBreak = 40
+} LineBrk;
+
+typedef enum tagTrWsHandling
+{ ktwshAll = 0,
+ ktwshNoWs = ktwshAll + 1,
+ ktwshOnlyWs = ktwshNoWs + 1
+} TrWsHandling;
+
+typedef enum tagUtfType
+{
+ kutf8 = 0,
+ kutf16 = kutf8 + 1,
+ kutf32 = kutf16 + 1
+} UtfType;
+
+enum tagFlushMode
+{
+ kflushAuto = 0,
+ kflushManual = kflushAuto + 1
+};
+
+typedef enum ScriptDirCode
+{ kfsdcNone = 0,
+ kfsdcHorizLtr = 1,
+ kfsdcHorizRtl = 2,
+ kfsdcVertFromLeft = 4,
+ kfsdcVertFromRight = 8
+} ScriptDirCode;
+
+typedef enum tagFwTextColor
+{ kclrWhite = 0xffffff,
+ kclrBlack = 0,
+ kclrRed = 0x0000ff,
+ kclrGreen = 0x00ff00,
+ kclrBlue = 0xff0000,
+/*
+// kclrYellow = 0x00ffff,
+// kclrMagenta = 0xff00ff,
+// kclrCyan = 0xffff00,
+ */
+ kclrReserved1 = 0x80000000,
+ kclrReserved2 = 0x80000001,
+ kclrTransparent = 0xc0000000
+} FwTextColor;
+
+
+typedef enum FwSuperscriptVal
+{ kssvOff = 0,
+ kssvSuper = 1,
+ kssvSub = 2
+} FwSuperscriptVal;
+
+
+// Glyph attributes for justification
+typedef enum tagJustGlyphAttr
+{
+ kjgatStretch = 1,
+ kjgatShrink,
+ kjgatWeight,
+ kjgatStep,
+ kjgatChunk,
+ kjgatWidth,
+ kjgatBreak,
+ // pseudo-attributes for handling steps:
+ kjgatStretchInSteps,
+ kjgatWidthInSteps,
+ // also metrics:
+ kjgatAdvWidth,
+ kjgatAdvHeight,
+ kjgatBbLeft,
+ kjgatBbRight,
+ kjgatBbTop,
+ kjgatBbBottom
+} JustGlyphAttr; // Hungarian: jgat
+
+class GrSlotState;
+typedef union {
+ int nValue;
+ GrSlotState *pslot;
+} u_intslot;
+
+/*****
+#undef ATTACH_GUID_TO_CLASS
+#if defined(__cplusplus)
+#define ATTACH_GUID_TO_CLASS(type, guid, cls) \
+ type __declspec(uuid(#guid)) cls;
+#else // !defined(__cplusplus)
+#define ATTACH_GUID_TO_CLASS(type, guid, cls)
+#endif // !defined(__cplusplus)
+
+#ifndef DEFINE_COM_PTR
+#define DEFINE_COM_PTR(cls)
+#endif
+
+#undef GENERIC_DECLARE_SMART_INTERFACE_PTR
+#define GENERIC_DECLARE_SMART_INTERFACE_PTR(cls, iid) \
+ ATTACH_GUID_TO_CLASS(interface, iid, cls); \
+ DEFINE_COM_PTR(cls);
+*****/
+
+} // namespace gr
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif /* !GRDATA_INCLUDED */
diff --git a/Build/source/libs/graphite/include/graphite/GrDebug.h b/Build/source/libs/graphite/include/graphite/GrDebug.h
new file mode 100644
index 00000000000..dc02fac0134
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/GrDebug.h
@@ -0,0 +1,200 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: debug.h
+Responsibility:
+Last reviewed:
+
+Description:
+ Assert and debug definitions.
+----------------------------------------------------------------------------------------------*/
+
+#ifndef __DEBUG_H__
+#define __DEBUG_H__
+
+#include <cassert>
+
+namespace gr
+{
+
+#ifdef _DEBUG
+ #undef DEBUG
+ #define DEBUG 1
+ #undef NDEBUG
+ #define DEFINE_THIS_FILE static char THIS_FILE[] = __FILE__;
+ #undef THIS_FILE
+ #define THIS_FILE __FILE__
+#else //!_DEBUG
+ #undef DEBUG
+ #define DEFINE_THIS_FILE
+
+ //#define Debug(foo)
+#endif //!_DEBUG
+
+#if 0
+//#ifdef DEBUG
+
+//#include <windows.h>
+
+ typedef void (WINAPI * Pfn_Assert)(const char * pszExp, const char * pszFile, int nLine,
+ HMODULE hmod);
+ typedef Pfn_Assert Pfn_Warn;
+
+ /*__declspec(dllimport)*/ void WINAPI WarnProc(const char * pszExp, const char * pszFile,
+ int nLine, bool fCritical, HMODULE hmod);
+ /*__declspec(dllimport)*/ void WINAPI AssertProc(const char * pszExp, const char * pszFile,
+ int nLine, bool fCritical, HMODULE hmod);
+
+ __declspec(dllimport) Pfn_Assert WINAPI SetAssertProc(Pfn_Assert pfnAssert);
+ __declspec(dllimport) Pfn_Warn WINAPI SetWarnProc(Pfn_Warn pfnWarn);
+ __declspec(dllimport) int WINAPI HideWarnings(bool f);
+ __declspec(dllimport) int WINAPI HideAsserts(bool f);
+ __declspec(dllimport) int WINAPI HideErrors(bool f);
+
+ void WINAPI WarnHrProc(HRESULT hr, const char * pszFile, int nLine, bool fCritical);
+ void WINAPI WarnProcLocal(const char * pszExp, const char * pszFile, int nLine,
+ bool fCritical);
+ void WINAPI AssertProcLocal(const char * pszExp, const char * pszFile, int nLine,
+ bool fCritical);
+
+ #define Assert(exp) ((exp) || (AssertProcLocal(#exp, THIS_FILE, __LINE__, false), 0))
+ #define AssertC(exp) ((exp) || (AssertProcLocal(#exp, THIS_FILE, __LINE__, true), 0))
+ #define AssertMsg(exp, msg) ((exp) || (AssertProcLocal(msg, THIS_FILE, __LINE__, false), 0))
+ #define AssertMsgC(exp, msg) ((exp) || (AssertProcLocal(msg, THIS_FILE, __LINE__, true), 0))
+
+ #undef Warn
+ #define Warn(psz) (void)(WarnProcLocal(psz, THIS_FILE, __LINE__, false))
+ #define WarnC(psz) (void)(WarnProcLocal(psz, THIS_FILE, __LINE__, true))
+
+ #undef WarnIf
+ #define WarnIf(exp) (void)(!(exp) || (WarnProcLocal("(" #exp ") is true", THIS_FILE, \
+ __LINE__, false), 0))
+ #define WarnIfC(exp) (void)(!(exp) || (WarnProcLocal("(" #exp ") is true", THIS_FILE, \
+ __LINE__, true), 0))
+
+ #undef WarnUnless
+ #define WarnUnless(exp) (void)((exp) || (WarnProcLocal("(" #exp ") is false", \
+ THIS_FILE, __LINE__, false), 0))
+ #define WarnUnlessC(exp) (void)((exp) || (WarnProcLocal("(" #exp ") is false", \
+ THIS_FILE, __LINE__, true), 0))
+
+ #undef WarnHr
+ #define WarnHr(hr) ((SUCCEEDED(hr) || (WarnHrProc(hr, THIS_FILE, __LINE__, false), 0)), \
+ (hr))
+ #define WarnHrC(hr) ((SUCCEEDED(hr) || (WarnHrProc(hr, THIS_FILE, __LINE__, true), 0)), \
+ (hr))
+
+ class IgnoreWarnings
+ {
+ public:
+ IgnoreWarnings()
+ { HideWarnings(true); }
+ ~IgnoreWarnings()
+ { HideWarnings(false); }
+ };
+
+ class IgnoreAsserts
+ {
+ public:
+ IgnoreAsserts()
+ { HideAsserts(true); }
+ ~IgnoreAsserts()
+ { HideAsserts(false); }
+ };
+
+ class IgnoreErrors
+ {
+ private:
+ IgnoreWarnings iw;
+ IgnoreAsserts ia;
+ };
+
+ #define Debug(exp) exp
+ #define DoAssert(exp) Assert(exp)
+ #define DoAssertC(exp) AssertC(exp)
+ #define DoAssertHr(hr) Assert(SUCCEEDED(hr))
+ #define DoAssertHrC(hr) AssertC(SUCCEEDED(hr))
+#else
+ #define Assert(exp) assert(exp)
+ #define AssertC(exp)
+ #define AssertMsg(exp, msg)
+ #define AssertMsgC(exp, msg)
+ #define Warn(psz)
+ #define WarnC(psz)
+ #define WarnIf(exp)
+ #define WarnIfC(exp)
+ #define WarnUnless(exp)
+ #define WarnUnlessC(exp)
+ #define WarnHr(hr) (hr)
+ #define WarnHrC(hr) (hr)
+ #define Debug(exp)
+ #define DoAssert(exp) (exp)
+ #define DoAssertC(exp) (exp)
+ #define DoAssertHr(hr) (hr)
+ #define DoAssertHrC(hr) (hr)
+#endif //DEBUG
+
+#define AssertPtr(pv) Assert(ValidReadPtr(pv))
+#define AssertPtrN(pv) Assert(!(pv) || ValidReadPtr(pv))
+#define AssertArray(pv, cv) Assert((cv) >= 0 && ValidReadPtrSize((pv), isizeof(*(pv)) * (cv)))
+#define AssertArrayN(pv, cv) Assert((cv) >= 0 && (!(pv) || ValidReadPtrSize((pv), isizeof(*(pv)) * (cv))))
+#define AssertPtrSize(pv, cb) Assert((cb) >= 0 && ValidReadPtrSize((pv), cb))
+
+#define AssertPfn(pfn) Assert(!IsBadCodePtr((FARPROC)(pfn)))
+#define AssertPfnN(pfn) Assert(!(pfn) || !IsBadCodePtr((FARPROC)(pfn)))
+
+#define AssertPsz(psz) Assert(ValidPsz(psz))
+#define AssertPszN(psz) Assert(!(psz) || ValidPsz(psz))
+
+#define AssertBstr(bstr) Assert(ValidBstr(bstr))
+#define AssertBstrN(bstr) Assert(!(bstr) || ValidBstr(bstr))
+
+#define AssertObj(pv) Assert(ValidReadPtr(pv) && (pv)->AssertValid())
+#define AssertObjN(pv) Assert(!(pv) || ValidReadPtr(pv) && (pv)->AssertValid())
+
+/*----------------------------------------------------------------------------------------------
+ This class implements custom output to the debugger. The results of Watch() can be
+ viewed on a line in the Watch window. Output() writes to the Debugger Output window.
+ Calls to Output() should be included in the Watch() function as needed. Watch()
+ is executed every time the debugger displays this class in the Watch window.
+ To use it:
+
+ 1) Put the following line in:
+ \program files\Microsoft Visual Studio\Common\MSDev98\bin\AutoExp.dat
+ in the [AutoExpand] section:
+ DebugWatch=<WatchNV(),su>
+
+ 2) In the class from which you want custom debug output, add the equivalent of:
+ #ifdef DEBUG
+ class Dbw1 : public DebugWatch { virtual OLECHAR * Watch(); ... };
+ Dbw1 m_dbw1;
+ #endif //DEBUG
+
+ 3) Implement the Watch() function to display the data you want to see, bracketed by
+ #ifdef DEBUG / #endif. Note that Output() is LIMITED to 10 pointer-sized arguments.
+ If you must have more, then call _CrtDbgReport() directly. Note also that
+ _CrtDbgReport() is not implemented for wide characters, so neither is Output().
+----------------------------------------------------------------------------------------------*/
+#if 0
+//#ifdef DEBUG
+class DebugWatch
+{
+public:
+ int m_nSerial; // increment and display this for positive affirmation of refresh
+ DebugWatch() { m_nSerial = 0; }
+ OLECHAR * WatchNV(); // debugger won't find it if it is virtual or inline.
+ virtual OLECHAR * Watch() { return L"No DebugWatch string implemented"; }
+ void Output (char *fmt, ...); // LIMITED to 10 pointer-sized arguments
+};
+#endif //DEBUG
+
+} // namespace gr
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif
diff --git a/Build/source/libs/graphite/include/graphite/GrExt.h b/Build/source/libs/graphite/include/graphite/GrExt.h
new file mode 100644
index 00000000000..518683db29e
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/GrExt.h
@@ -0,0 +1,13 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001, 2003 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrHelperClases.h
+Responsibility: Sharon Correll
+Last reviewed:
+
+ External helper classes to be included in the open-source version of the Graphite DLL.
+ Currently there are none.
+----------------------------------------------------------------------------------------------*/
diff --git a/Build/source/libs/graphite/include/graphite/GrFeature.h b/Build/source/libs/graphite/include/graphite/GrFeature.h
new file mode 100644
index 00000000000..4cc396a11d9
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/GrFeature.h
@@ -0,0 +1,203 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrFeature.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+
+Note:
+ The body of methods not complete contained in this file are located in GrEngine.cpp.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GR_FEATURE_INCLUDED
+#define GR_FEATURE_INCLUDED
+
+//:End Ignore
+
+#include "GrAppData.h"
+
+namespace gr
+{
+
+
+/*----------------------------------------------------------------------------------------------
+ A valid setting and its UI labels in potentially various languages.
+
+ Hungarian: fset
+----------------------------------------------------------------------------------------------*/
+/****
+class GrFeatureSetting
+{
+ friend class GrFeature;
+public:
+ GrFeatureSetting()
+ {
+ m_hmnstuLabels.Clear();
+ }
+ GrFeatureSetting(GrFeatureSetting & fset)
+ {
+ m_hmnstuLabels.Clear();
+ }
+protected:
+ int m_nVal;
+ HashMap<int, std::wstring> m_hmnstuLabels;
+};
+****/
+
+class GrEngine;
+
+/*----------------------------------------------------------------------------------------------
+ Each Graphite feature defines a way to customize or parameterize the rendering processs.
+
+ Hungarian: feat
+----------------------------------------------------------------------------------------------*/
+class GrFeature
+{
+ //friend class GrFeatureSetting;
+public:
+ enum {
+ knLangFeatV2 = 1
+ };
+
+ GrFeature()
+ {
+ m_vnVal.clear();
+ m_vnNameId.clear();
+ }
+
+ void Initialize(featid nID, int nNameId, int cfset, int nDefault = 0);
+
+ featid ID()
+ {
+ return m_nID;
+ }
+
+ int DefaultValue()
+ {
+ return m_nDefault;
+ }
+
+ void SetDefault(int nDefault)
+ {
+ m_nDefault = nDefault;
+ }
+
+ int NameId()
+ {
+ return m_nNameId;
+ }
+
+ void SetNameId(int n)
+ {
+ m_nNameId = n;
+ }
+
+ int NumberOfSettings()
+ {
+ return (int)m_vnVal.size();
+ }
+
+ int Settings(int cMax, int * prgnVal);
+ void AddSetting(int nVal, int nNameId);
+ bool IsValidSetting(int nVal);
+ std::wstring Label(GrEngine * pgreng, int nLang);
+ std::wstring SettingLabel(GrEngine * pgreng, int nVal, int nLang);
+ int NthSetting(int ifset);
+ std::wstring NthSettingLabel(GrEngine * pgreng, int ifset, int nLang);
+// void SetSettingLabel(int nVal, std::wstring stuLabel, int nLang);
+
+protected:
+ featid m_nID;
+ int m_nDefault;
+ int m_nNameId;
+// HashMap<int, std::wstrng> m_hmnstuLabels;
+
+ // These are parallel arrays. The first gives the setting value for a given feature,
+ // the second gives the index into the name table that is used to read UI strings.
+ std::vector<int> m_vnVal;
+ std::vector<int> m_vnNameId;
+};
+
+
+/*----------------------------------------------------------------------------------------------
+ GrLangTable handles looking up language information.
+ GrEngine has one instance of this class.
+ Hungarian: langtbl
+----------------------------------------------------------------------------------------------*/
+class GrIStream;
+
+class GrLangTable
+{
+ friend class FontMemoryUsage;
+
+public:
+ GrLangTable()
+ {
+ m_prglang = NULL;
+ m_clang = 0;
+ m_prgfset = NULL;
+ }
+ ~GrLangTable()
+ {
+ delete[] m_prglang;
+ delete[] m_prgfset;
+ }
+
+ bool ReadFromFont(GrIStream * pgrstrm, int fxdVersion);
+ void CreateEmpty();
+
+ size_t NumberOfLanguages()
+ {
+ return m_clang;
+ }
+ void LanguageFeatureSettings(isocode lgcode,
+ std::vector<featid> & vnFeatId, std::vector<int> & vnValues);
+ isocode LanguageCode(size_t ilang);
+
+protected:
+ size_t m_clang;
+ // constants for fast binary search of language list
+ data16 m_dilangInit; // (max power of 2 <= m_clang);
+ // size of initial range to consider
+ data16 m_cLoop; // log2(max power of 2 <= m_clang);
+ // indicates how many iterations are necessary
+ data16 m_ilangStart; // m_clang - m_dilangInit;
+ // where to start search
+
+ struct LangEntry
+ {
+ char rgchCode[4];
+ data16 cFeaturesBIG; // big endian
+ data16 cbOffsetBIG; // big endian
+ };
+ LangEntry * m_prglang;
+ int m_cbOffset0; // offset of first entry
+
+ struct FeatSet
+ {
+ featid featidBIG; // big endian
+ data16 valueBIG; // big endian
+ data16 padBIG;
+ };
+ FeatSet * m_prgfset;
+ int m_cfset; // needed for memory instrumentation only
+
+ int FindIndex(isocode lgcode);
+};
+
+} // namespace gr
+
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+
+#endif // !GR_FEATURE_INCLUDED
diff --git a/Build/source/libs/graphite/include/graphite/GrMstypes.h b/Build/source/libs/graphite/include/graphite/GrMstypes.h
new file mode 100644
index 00000000000..2fc9f108009
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/GrMstypes.h
@@ -0,0 +1,40 @@
+#ifndef _MSTYPES_H
+#define _MSTYPES_H
+/********
+This header contains the MS Win32 specific types that are still used
+throughout the Graphite code.
+
+It is intended to allow Graphite to build on non-Win32 platforms.
+
+ **Do NOT include this when building against WIN32**
+
+ TSE - 15/07/2003
+********/
+
+#if defined(_WIN32)
+ #error Do not include this header when building against Win32 APIs
+#else
+
+#if defined(GR_NAMESPACE)
+namespace gr
+{
+#endif
+
+typedef wchar_t OLECHAR;
+
+typedef signed long HRESULT;
+
+inline const long InterlockedIncrement(long *const intr_lck) {
+ return ++*intr_lck;
+}
+
+inline const long InterlockedDecrement(long *const intr_lck) {
+ return --*intr_lck;
+}
+
+#if defined(GR_NAMESPACE)
+}
+#endif
+
+#endif // defined(_WIN32)
+#endif // include guard
diff --git a/Build/source/libs/graphite/include/graphite/GrPlatform.h b/Build/source/libs/graphite/include/graphite/GrPlatform.h
new file mode 100644
index 00000000000..d72abbc6412
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/GrPlatform.h
@@ -0,0 +1,189 @@
+#ifndef _GR_PLATFORM_H
+#define _GR_PLATFORM_H
+
+/***********************************************************************************************
+ Turn off the goofy warnings for MS VisualStudio.
+***********************************************************************************************/
+#ifdef _MSC_VER
+#pragma warning(disable: 4065) // Switch statement contains default but no case.
+#pragma warning(disable: 4097) // typedef-name 'xxx' used as synonym for class-name 'yyy'.
+#pragma warning(disable: 4100) // unreferenced formal parameter.
+#pragma warning(disable: 4127) // conditional expression is constant
+#pragma warning(disable: 4192) // automatically excluding while importing.
+#pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union.
+#pragma warning(disable: 4290) // exception specification ignored.
+#pragma warning(disable: 4310) // cast truncates constant value.
+#pragma warning(disable: 4355) // 'this' used in base member initializer list.
+#pragma warning(disable: 4505) // unreferenced local function has been removed.
+#pragma warning(disable: 4510) // default constructor could not be generated - caused by
+ // applying ComSmartPtr to a non-interface class.
+#pragma warning(disable: 4511) // copy constructor could not be generated.
+#pragma warning(disable: 4512) // assignment operator could not be generated.
+#pragma warning(disable: 4610) // class 'xxx' can never be instantiated - user defined
+ // constructor required - caused by applying ComSmartPtr to a non-interface class.
+#pragma warning(disable: 4660) // template-class specialization is already instantiated.
+#pragma warning(disable: 4701) // local variable 'xxx' may be used without being initialized.
+ // We would like to keep this warning (4701) enabled but the compiler applies it in
+ // places that are obviously OK.
+#pragma warning(disable: 4702) // unreachable code. We would like to keep this warning (4702)
+ // enabled but the compiler applies it in places that are obviously OK.
+#pragma warning(disable: 4706) // assignment in conditional expression
+#pragma warning(disable: 4710) // not inlined.
+#pragma warning(disable: 4786) // identifier truncated in debug info.
+#pragma warning(disable: 4800) // forcing value to bool 'true' or 'false' (performance warning).
+#endif
+
+
+// Standard headers
+#include <stddef.h>
+
+// Platform headers
+//
+#if defined(_WIN32)
+#include <windows.h>
+#include <tchar.h>
+
+#ifdef SIZEOF_WCHAR_T
+#define SIZEOF_WCHAR_T 2
+#endif
+
+#endif
+
+// Project headers
+#if defined(_WIN32)
+#include <algorithm>
+#endif
+#include <iostream>
+
+
+#if defined(_WIN32)
+// TSE: We need to define std::max and std::min, because VC6.0 seems to omit
+// these from their version of <algorithm> and rely on the macro versions
+// to silently take their place. This breaks the use of the name max in any
+// other scope e.g. as in std::numeric_limits<..>::max().
+
+#undef min
+#undef max
+
+// SJC: Only do this for version 6, otherwise the definitions conflict with the
+// built-in STL definitions, and the compiler really struggles.
+#if _MSC_VER == 1200 // VC version 6
+namespace std
+{
+ template<typename T> inline T max(const T a, const T b) { return a < b ? b : a; }
+ template<typename T> inline T min(const T a, const T b) { return a > b ? b : a; }
+}
+#endif // _MSC_VER == 1200
+//////using std::max; // SJC moved to GrCommon.h
+//////using std::min;
+#endif // _WIN32
+
+
+namespace gr
+{
+
+// Typedefs
+// These are correct for the x86_64 architecture too.
+typedef unsigned char byte;
+typedef unsigned int utf32; // UTF32 encoded Unicode codepoints
+typedef unsigned short int utf16; // UTF16 encoded Unicode codepoints
+typedef unsigned char utf8; // UTF-8 encoded Unicode codepoints
+typedef unsigned short int gid16; // glyph ID
+typedef unsigned int fontTableId32; // ID to pass to getTable()
+
+typedef unsigned char data8;
+typedef unsigned short int data16; // generic 16-bit data
+typedef unsigned int data32; // generic 32-bit data
+typedef signed char sdata8;
+typedef signed short int sdata16; // generic 16-bit data
+typedef signed int sdata32; // generic 32-bit data
+
+#ifndef NO_ASM
+#define NO_ASM
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+// std::_Ios_Openmode isn't defined in the Windows compiler
+#if !defined(_WIN32)
+ typedef std::ios_base::openmode openmode_t;
+#else
+ typedef int openmode_t;
+#endif
+
+/*************************************************************************************
+ Offsets and addresses. AddrOf is useful for taking the address of an object
+ that overloads the & operator.
+*************************************************************************************/
+#if defined(_WIN32)
+#undef offsetof
+#define offsetof(cls,fld) ((int)&((cls *)0)->fld)
+#endif
+
+// #ifndef NO_ASM
+// #define addrsafe_offsetof(cls,fld) reinterpret_cast<int>(AddrOf(((cls *)0)->fld))
+//
+// template<typename T> inline T * AddrOf(T & x) {
+// T * pt;
+// __asm
+// {
+// mov eax,x
+// mov pt,eax
+// }
+// return pt;
+// }
+// #endif
+
+
+inline bool GrIsBadStringPtrW(const utf16 *const pszw, const long)
+{
+ return !pszw;
+}
+
+inline bool GrIsBadStringPtrA(const char *const psza, const long)
+{
+ return !psza;
+}
+
+inline bool GrIsBadReadPtr(const void *const, const unsigned int)
+{
+ return false;
+}
+
+inline bool GrIsBadWritePtr(const void *const, const unsigned int)
+{
+ return false;
+}
+
+
+size_t Platform_UnicodeToANSI(const utf16 * prgchwSrc, size_t cchwSrc, char * prgchsDst, size_t cchsDst);
+size_t Platform_AnsiToUnicode(const char * prgchsSrc, size_t cchsSrc, utf16 * prgchwDst, size_t cchwDst);
+//size_t Platform_UnicodeToANSI(const wchar * prgchwSrc, size_t cchwSrc, char * prgchsDst, size_t cchsDst);
+//size_t Platform_AnsiToUnicode(const char * prgchsSrc, size_t cchsSrc, wchar * prgchwDst, size_t cchwDst);
+size_t Platform_8bitToUnicode(int nCodePage, const char * prgchsSrc, int cchsSrc, utf16 * prgchwDst, int cchwDst);
+
+utf16 *utf16cpy(utf16 *dest, const utf16 *src);
+utf16 *utf16cpy(utf16 *dest, const char *src);
+utf16 *utf16cpy(utf16 *dest, const utf32 *src);
+
+utf16 *utf16ncpy(utf16 *dest, const utf16 *src, size_t n);
+utf16 *utf16ncpy(utf16 *dest, const char *src, size_t n);
+
+#ifdef UTF16DEBUG
+void utf16Output(const utf16 *input);
+#endif
+
+size_t utf16len(const utf16 *s);
+
+int utf16cmp(const utf16 *s1, const utf16 *s2);
+int utf16ncmp(const utf16 *s1, const utf16 *s2, size_t n);
+int utf16cmp(const utf16 *s1, const char *s2);
+
+} // namespace gr
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif
diff --git a/Build/source/libs/graphite/include/graphite/GrResult.h b/Build/source/libs/graphite/include/graphite/GrResult.h
new file mode 100644
index 00000000000..d2c418dc9df
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/GrResult.h
@@ -0,0 +1,171 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrResult.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Support for the GrResult and error handling in the Graphite engine. Also argument
+ checking. Much of this is set up to parallel standard COM behavior.
+
+Special Note:
+ This file needs to be used by C files. Please do not use C++ style comments; use
+ ONLY C style comments in this file to make the C compiler happy.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GRRESULT_INCLUDED
+#define GRRESULT_INCLUDED
+
+/*
+//:End Ignore
+ */
+
+
+namespace gr
+{
+
+
+
+/*:>********************************************************************************************/
+/*:> Result flags */
+/*:>********************************************************************************************/
+
+/* These are return values for the main interface methods to indicate various kinds of */
+/* error conditions. To facilitate COM compatibiliy, they match the standard COM HRESULT codes. */
+enum GrResult
+{
+ kresOk = 0, // S_OK
+ kresFalse = 1, // S_FALSE
+ kresFail = 0x80004005L, // E_FAIL
+ kresOutOfMemory = 0x8007000EL, // E_OUTOFMEMORY
+ kresInvalidArg = 0x80000002L, // E_INVALIDARG
+ kresReadFault = 0x80000001L, // STG_E_READFAULT
+ kresUnexpected = 0x80000003L, // E_UNEXPECTED
+ kresNotImpl = 0x80000004L, // E_NOTIMPL
+ kresPointer = 0x80004003L//, // E_POINTER
+};
+
+#define ResultFailed(res) (res != kresOk) /* && res != kresFalse */
+
+#define ResultSucceeded(res) (res == kresOk) /* || res == kresFalse */
+
+enum FontErrorCode
+{
+ kferrOkay,
+ kferrUninitialized,
+ kferrUnknown,
+ kferrFindHeadTable,
+ kferrReadDesignUnits,
+ kferrFindCmapTable,
+ kferrLoadCmapSubtable,
+ kferrCheckCmapSubtable,
+ kferrFindNameTable,
+ kferrLoadSilfTable,
+ kferrLoadFeatTable,
+ kferrLoadGlatTable,
+ kferrLoadGlocTable,
+ kferrReadSilfTable,
+ kferrReadGlocGlatTable,
+ kferrReadFeatTable,
+ kferrBadVersion,
+ kferrSileTableMismatch,
+ kferrReadSillTable
+};
+
+/*:>********************************************************************************************/
+/*:> Error handling */
+/*:>********************************************************************************************/
+/* These are set up as #defines so we can easily adjust them once we know how errors should */
+/* be handled. */
+
+#define ReturnResult(res) return res
+
+#ifdef GR_FW
+#define THROW(res) ThrowInternalError(res)
+#else
+#define THROW(res) throw res
+#endif /* GR_FW */
+
+
+// #if !defined(NDEBUG)
+
+#if (0) // can't get E_POINTER to work so no debugging this way for now
+
+} // namespace gr
+
+#include <iostream>
+
+namespace gr
+{
+
+#define WARN(warning) (std::cerr << __FILE__ << ':' << __LINE__ << ": WARN: " << #warning, warning)
+
+/*:>********************************************************************************************/
+/*:> Argument checking */
+/*:>********************************************************************************************/
+
+#define ChkGrArgPtr(p) \
+{ \
+ AssertPtrN(p); \
+ if (!p) \
+ THROW(E_POINTER); \
+} \
+
+#define ChkGrOutPtr(p) \
+{ \
+ AssertPtrN(p); \
+ if (!p) \
+ THROW(E_POINTER); \
+} \
+
+#define ChkGrArgPtrN(p) \
+ AssertPtrN(p); \
+
+#define ChkGrArrayArg(prgv, cv) \
+{ \
+ AssertArray(prgv, cv); \
+ if (cv && !prgv) \
+ THROW(E_POINTER); \
+} \
+
+#define ChkGrBstrArg(bstr) \
+ AssertBstr(bstr); \
+
+#define ChkGrBstrArgN(bstr) \
+ AssertBstrN(bstr); \
+
+#else // debugging is off
+
+#define WARN(warning) (warning)
+
+/*:>********************************************************************************************/
+/*:> Argument checking */
+/*:>********************************************************************************************/
+
+#define ChkGrArgPtr(p) (static_cast<void>(0))
+
+#define ChkGrOutPtr(p) (static_cast<void>(0))
+
+#define ChkGrArgPtrN(p) (static_cast<void>(0))
+
+#define ChkGrArrayArg(prgv, cv) (static_cast<void>(0))
+
+#define ChkGrBstrArg(bstr) (static_cast<void>(0))
+
+#define ChkGrBstrArgN(bstr) (static_cast<void>(0))
+
+#endif // !defined(NDEBUG)
+
+} // namespace gr
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif /* !GRRESULT_INCLUDED */
diff --git a/Build/source/libs/graphite/include/graphite/GrStructs.h b/Build/source/libs/graphite/include/graphite/GrStructs.h
new file mode 100644
index 00000000000..a1c9debe238
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/GrStructs.h
@@ -0,0 +1,97 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrStructs.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Copyright (C) 1999 by SIL International. All rights reserved.
+
+Description:
+ Cross-platform structure definitions.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GRSTRUCTS_INCLUDED
+#define GRSTRUCTS_INCLUDED
+#include "GrPlatform.h"
+
+namespace gr
+{
+
+//:End Ignore
+
+typedef struct tagGrCharProps
+{
+ unsigned long clrFore;
+ unsigned long clrBack;
+ int dympOffset;
+ int ws;
+ int ows;
+ byte fWsRtl;
+ int nDirDepth;
+ byte ssv;
+ byte ttvBold;
+ byte ttvItalic;
+ int dympHeight;
+ wchar_t szFaceName[ 32 ];
+ wchar_t szFontVar[ 64 ];
+} GrCharProps;
+
+// Used to pass feature information among the Graphite engine and the application.
+typedef struct tagFeatureSetting
+{
+ int id;
+ int value;
+} FeatureSetting;
+
+/*****
+struct Point
+{
+ float x;
+ float y;
+
+ Point()
+ {
+ x = y = 0;
+ }
+
+ Point(POINT & p)
+ {
+ x = (float)p.x;
+ y = (float)p.y;
+ }
+};
+
+
+struct Rect
+{
+ float top;
+ float bottom;
+ float left;
+ float right;
+
+ Rect()
+ {
+ top = bottom = left = right = 0;
+ };
+
+ Rect(RECT & r)
+ {
+ top = (float)r.top;
+ bottom = (float)r.bottom;
+ left = (float)r.left;
+ right = (float)r.right;
+ };
+};
+****/
+
+} // namespace gr
+
+
+#endif // !STRUCTS_INCLUDED
+
diff --git a/Build/source/libs/graphite/include/graphite/GrWrappers.h b/Build/source/libs/graphite/include/graphite/GrWrappers.h
new file mode 100644
index 00000000000..077b4695d80
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/GrWrappers.h
@@ -0,0 +1,13 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001, 2003 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrWrapperClases.h
+Responsibility: Sharon Correll
+Last reviewed:
+
+ Wrapper classes to be included in the open-source version of the Graphite DLL.
+ Currently there are none.
+----------------------------------------------------------------------------------------------*/
diff --git a/Build/source/libs/graphite/include/graphite/GraphiteProcess.h b/Build/source/libs/graphite/include/graphite/GraphiteProcess.h
new file mode 100644
index 00000000000..60f81860c2e
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/GraphiteProcess.h
@@ -0,0 +1,45 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GraphiteProcess.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ The interface that is needed for the Justifier object to call back to the Graphite engine.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GRAPHITEPROCESS_INCLUDED
+#define GRAPHITEPROCESS_INCLUDED
+
+#include "GrResult.h"
+//:End Ignore
+namespace gr
+{
+
+/*----------------------------------------------------------------------------------------------
+
+ Hungarian: fgje
+----------------------------------------------------------------------------------------------*/
+class GraphiteProcess
+{
+public:
+ virtual ~GraphiteProcess() {};
+ virtual GrResult getGlyphAttribute(int iGlyph, int jgat, int nLevel, float * pValueRet) = 0;
+ virtual GrResult getGlyphAttribute(int iGlyph, int jgat, int nLevel, int * pValueRet) = 0;
+ virtual GrResult setGlyphAttribute(int iGlyph, int jgat, int nLevel, float value) = 0;
+ virtual GrResult setGlyphAttribute(int iGlyph, int jgat, int nLevel, int value) = 0;
+};
+
+} // namespace gr
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif // !IGR_JENGINE_INCLUDED
diff --git a/Build/source/libs/graphite/include/graphite/HashMap.h b/Build/source/libs/graphite/include/graphite/HashMap.h
new file mode 100644
index 00000000000..aa925ac608d
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/HashMap.h
@@ -0,0 +1,328 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: HashMap.h
+Responsibility: Steve McConnel
+Last reviewed: Not yet.
+
+Description:
+ This provides a set of template collection classes to replace std::map. Their primary
+ reason to exist is to allow explicit checking for internal memory allocation failures.
+----------------------------------------------------------------------------------------------*/
+#pragma once
+#ifndef HASHMAP_H_INCLUDED
+#define HASHMAP_H_INCLUDED
+//:End Ignore
+
+/*----------------------------------------------------------------------------------------------
+ Functor class for computing a hash value from an arbitrary object.
+
+ Hungarian: hsho
+----------------------------------------------------------------------------------------------*/
+class HashObj
+{
+public:
+ int operator () (void * pKey, int cbKey);
+};
+
+/*----------------------------------------------------------------------------------------------
+ Functor class for comparing two arbitrary objects (of the same class) for equality.
+
+ Hungarian: eqlo
+----------------------------------------------------------------------------------------------*/
+class EqlObj
+{
+public:
+ bool operator () (void * pKey1, void * pKey2, int cbKey);
+};
+
+/*----------------------------------------------------------------------------------------------
+ Hash map template collection class whose keys are objects of an arbitrary class.
+
+ Hungarian: hm[K][T]
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H = HashObj, class Eq = EqlObj> class HashMap
+{
+public:
+ //:> Member classes
+
+ /*------------------------------------------------------------------------------------------
+ This is the basic data structure for storing one key-value pair in a hash map. In
+ order to handle hash collisions, this structure is a member of a linked list.
+ Hungarian: hsnd
+ ------------------------------------------------------------------------------------------*/
+ class HashNode
+ {
+ public:
+ //:> Constructors/destructors/etc.
+
+ HashNode(void)
+ : m_key(K()), m_value(T()), m_nHash(0), m_ihsndNext(0)
+ {
+ }
+ HashNode(K & key, T & value, int nHash, int ihsndNext = -1)
+ : m_key(key), m_value(value), m_nHash(nHash), m_ihsndNext(ihsndNext)
+ {
+ }
+ ~HashNode()
+ {
+ }
+
+ //:> Member variable access
+
+ void PutKey(K & key)
+ {
+ m_key = key;
+ }
+ K & GetKey()
+ {
+ return m_key;
+ }
+ void PutValue(T & value)
+ {
+ m_value = value;
+ }
+ T & GetValue()
+ {
+ return m_value;
+ }
+ void PutHash(int nHash)
+ {
+ m_nHash = nHash;
+ }
+ int GetHash()
+ {
+ return m_nHash;
+ }
+ void PutNext(int ihsndNext)
+ {
+ m_ihsndNext = ihsndNext;
+ }
+ int GetNext()
+ {
+ return m_ihsndNext;
+ }
+
+ /*--------------------------------------------------------------------------------------
+ Check whether the given HashNode is being used.
+ --------------------------------------------------------------------------------------*/
+ bool InUse()
+ {
+ return m_ihsndNext >= -1;
+ }
+
+ protected:
+ //:> Member variables
+
+ K m_key;
+ T m_value;
+ int m_nHash;
+ int m_ihsndNext; // -1 means end of list, -(ihsnd + 3) for free list members
+ };
+
+ /*------------------------------------------------------------------------------------------
+ This provides an iterator for stepping through all HashNodes stored in the hash map.
+ This is useful primarily for saving the contents of a hash map to a file.
+
+ Hungarian: ithm[K][T]
+ ------------------------------------------------------------------------------------------*/
+ class iterator
+ {
+ public:
+ // Constructors/destructors/etc.
+
+ iterator() : m_phmParent(0), m_ihsnd(0)
+ {
+ }
+ iterator(HashMap<K,T,H,Eq> * phm, int ihsnd) : m_phmParent(phm), m_ihsnd(ihsnd)
+ {
+ }
+ iterator(const iterator & v) : m_phmParent(v.m_phmParent), m_ihsnd(v.m_ihsnd)
+ {
+ }
+ ~iterator()
+ {
+ }
+
+ // Other public methods
+
+ iterator & operator = (const iterator & ithm)
+ {
+ m_phmParent = ithm.m_phmParent;
+ m_ihsnd = ithm.m_ihsnd;
+ return *this;
+ }
+ T & operator * (void)
+ {
+ Assert(m_phmParent);
+ Assert(m_phmParent->m_prghsnd);
+ Assert(m_ihsnd < m_phmParent->m_ihsndLim);
+ return m_phmParent->m_prghsnd[m_ihsnd].GetValue();
+ }
+ HashNode * operator -> (void)
+ {
+ Assert(m_phmParent);
+ Assert(m_phmParent->m_prghsnd);
+ Assert(m_ihsnd < m_phmParent->m_ihsndLim);
+ return &m_phmParent->m_prghsnd[m_ihsnd];
+ }
+ iterator & operator ++ (void)
+ {
+ Assert(m_phmParent);
+ ++m_ihsnd;
+ // make sure that this new HashNode is actually in use
+ while (m_ihsnd < m_phmParent->m_ihsndLim)
+ {
+ if (m_phmParent->m_prghsnd[m_ihsnd].InUse())
+ return *this;
+ // skip to the next one and check it
+ ++m_ihsnd;
+ }
+ if (m_ihsnd > m_phmParent->m_ihsndLim)
+ m_ihsnd = m_phmParent->m_ihsndLim;
+ return *this;
+ }
+ bool operator == (const iterator & ithm)
+ {
+ return (m_phmParent == ithm.m_phmParent) && (m_ihsnd == ithm.m_ihsnd);
+ }
+ bool operator != (const iterator & ithm)
+ {
+ return (m_phmParent != ithm.m_phmParent) || (m_ihsnd != ithm.m_ihsnd);
+ }
+ T & GetValue(void)
+ {
+ Assert(m_phmParent);
+ Assert(m_phmParent->m_prghsnd);
+ Assert(m_ihsnd < m_phmParent->m_ihsndLim);
+ Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse());
+ return m_phmParent->m_prghsnd[m_ihsnd].GetValue();
+ }
+ K & GetKey(void)
+ {
+ Assert(m_phmParent);
+ Assert(m_phmParent->m_prghsnd);
+ Assert(m_ihsnd < m_phmParent->m_ihsndLim);
+ Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse());
+ return m_phmParent->m_prghsnd[m_ihsnd].GetKey();
+ }
+ int GetHash()
+ {
+ Assert(m_phmParent);
+ Assert(m_phmParent->m_prghsnd);
+ Assert(m_ihsnd < m_phmParent->m_ihsndLim);
+ Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse());
+ return m_phmParent->m_prghsnd[m_ihsnd].GetHash();
+ }
+ int GetIndex()
+ {
+ Assert(m_phmParent);
+ Assert(m_phmParent->m_prghsnd);
+ Assert(m_ihsnd < m_phmParent->m_ihsndLim);
+ Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse());
+ return m_ihsnd;
+ }
+
+ protected:
+ //:> Member variables
+
+ HashMap<K,T,H,Eq> * m_phmParent;
+ int m_ihsnd;
+ };
+ friend class iterator;
+
+ //:> Constructors/destructors/etc.
+
+ HashMap();
+ ~HashMap();
+ HashMap(HashMap<K,T,H,Eq> & hm);
+
+ //:> Other public methods
+
+ iterator Begin();
+ iterator End();
+ void Insert(K & key, T & value, bool fOverwrite = false, int * pihsndOut = 0);
+ bool Retrieve(K & key, T * pvalueRet);
+ bool Delete(K & key);
+ void Clear();
+ void CopyTo(HashMap<K,T,H,Eq> & hmKT);
+ void CopyTo(HashMap<K,T,H,Eq> * phmKT);
+
+ bool GetIndex(K & key, int * pihsndRet);
+ bool IndexKey(int ihsnd, K * pkeyRet);
+ bool IndexValue(int ihsnd, T * pvalueRet);
+
+ int Size();
+
+ /*------------------------------------------------------------------------------------------
+ The assignment operator allows an entire hashmap to be assigned as the value of another
+ hashmap. It throws an error if it runs out of memory.
+
+ @return a reference to this hashmap. (That is how the assignment operator is defined!)
+
+ @param hm is a reference to the other hashmap.
+ ------------------------------------------------------------------------------------------*/
+ HashMap<K,T,H,Eq> & operator = (HashMap<K,T,H,Eq> & hm)
+ {
+ hm.CopyTo(this);
+ return *this;
+ }
+
+ //:Ignore
+#ifdef DEBUG
+ int _BucketCount();
+ int _EmptyBuckets();
+ int _BucketsUsed();
+ int _FullestBucket();
+ bool AssertValid()
+ {
+ AssertPtrN(m_prgihsndBuckets);
+ Assert(m_prgihsndBuckets || !m_cBuckets);
+ Assert(!m_prgihsndBuckets || m_cBuckets);
+ AssertArray(m_prgihsndBuckets, m_cBuckets);
+ AssertPtrN(m_prghsnd);
+ Assert(m_prghsnd || !m_ihsndMax);
+ Assert(!m_prghsnd || m_ihsndMax);
+ AssertArray(m_prghsnd, m_ihsndMax);
+ Assert(0 <= m_ihsndLim && m_ihsndLim <= m_ihsndMax);
+ Assert(-1 <= FreeListIdx(m_ihsndFirstFree));
+ Assert(FreeListIdx(m_ihsndFirstFree) < m_ihsndLim);
+ return true;
+ }
+#endif
+ //:End Ignore
+
+protected:
+ //:> Member variables
+
+ int * m_prgihsndBuckets;
+ int m_cBuckets;
+ HashNode * m_prghsnd;
+ int m_ihsndLim;
+ int m_ihsndMax;
+ int m_ihsndFirstFree; // stores -(ihsnd + 3)
+
+ //:> Protected methods
+ //:Ignore
+
+ /*------------------------------------------------------------------------------------------
+ Map between real index and "free list" index. Note that this mapping is bidirectional.
+ ------------------------------------------------------------------------------------------*/
+ int FreeListIdx(int ihsnd)
+ {
+ return -(ihsnd + 3);
+ }
+ //:End Ignore
+};
+
+
+// Local Variables:
+// mode:C++
+// c-file-style:"cellar"
+// tab-width:4
+// End:
+
+#endif /*HASHMAP_H_INCLUDED*/
diff --git a/Build/source/libs/graphite/include/graphite/IGrEngine.h b/Build/source/libs/graphite/include/graphite/IGrEngine.h
new file mode 100644
index 00000000000..481cb534b46
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/IGrEngine.h
@@ -0,0 +1,36 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2003 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+NU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: IGrEngine.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ A very minimal interface representing the Graphite engine, for passing to the
+ GrJustifier.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef IGRENG_INCLUDED
+#define IGRENG_INCLUDED
+
+namespace gr
+{
+/*----------------------------------------------------------------------------------------------
+ Class: IGrEngine
+----------------------------------------------------------------------------------------------*/
+class IGrEngine
+{
+};
+
+} // namespace gr
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif // !IGRENG_INCLUDED
diff --git a/Build/source/libs/graphite/include/graphite/IGrJustifier.h b/Build/source/libs/graphite/include/graphite/IGrJustifier.h
new file mode 100644
index 00000000000..a9ba6e51c07
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/IGrJustifier.h
@@ -0,0 +1,58 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2003 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: IGrJustifier.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ An interface for a justification agent that is used by the Graphite engine.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef IGRJUSTIFIER_INCLUDED
+#define IGRJUSTIFIER_INCLUDED
+
+#include "GrResult.h"
+
+namespace gr
+{
+
+class GraphiteProcess;
+
+/*----------------------------------------------------------------------------------------------
+ Class: IGrJustifier
+ This class provides an interface for a justification agent for the Graphite engine.
+----------------------------------------------------------------------------------------------*/
+class IGrJustifier
+{
+public:
+ virtual ~IGrJustifier() {};
+ virtual GrResult adjustGlyphWidths(GraphiteProcess * pgje, int iGlyphMin, int iGlyphLim,
+ float dxCurrWidth, float dxDesiredWidth) = 0;
+
+ //virtual GrResult suggestShrinkAndBreak(GraphiteProcess * pfgjwe,
+ // int iGlyphMin, int iGlyphLim, float dxsWidth, LgLineBreak lbPref, LgLineBreak lbMax,
+ // float * pdxShrink, LgLineBreak * plbToTry) = 0;
+
+ // Return a Graphite-compatible justifier that can be stored in a Graphite segment.
+ // TODO: remove
+ //virtual void JustifierObject(IGrJustifier ** ppgjus) = 0;
+
+ // When a segment is being destroyed, delete this object, which is the wrapper for the
+ // text source inside of it.
+ // TODO: remove
+ //virtual void DeleteJustifierPtr() = 0;
+};
+
+} // namespace gr
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif // !IGRJUSTIFIER_INCLUDED
diff --git a/Build/source/libs/graphite/include/graphite/IGraphiteProcess.h b/Build/source/libs/graphite/include/graphite/IGraphiteProcess.h
new file mode 100644
index 00000000000..ee84a94cdb1
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/IGraphiteProcess.h
@@ -0,0 +1,44 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GraphiteProcess.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ The interface that is needed for the Justifier object to call back to the Graphite engine.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef IGRAPHITEPROCESS_INCLUDED
+#define IGRAPHITEPROCESS_INCLUDED
+
+#include "GrResult.h"
+//:End Ignore
+namespace gr
+{
+
+/*----------------------------------------------------------------------------------------------
+
+ Hungarian: fgje
+----------------------------------------------------------------------------------------------*/
+class GraphiteProcess
+{
+public:
+ virtual GrResult GetGlyphAttribute(int iGlyph, int jgat, int nLevel, float * pValueRet) = 0;
+ virtual GrResult GetGlyphAttribute(int iGlyph, int jgat, int nLevel, int * pValueRet) = 0;
+ virtual GrResult SetGlyphAttribute(int iGlyph, int jgat, int nLevel, float value) = 0;
+ virtual GrResult SetGlyphAttribute(int iGlyph, int jgat, int nLevel, int value) = 0;
+};
+
+} // namespace gr
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif // !IGR_JENGINE_INCLUDED
diff --git a/Build/source/libs/graphite/include/graphite/ITextSource.h b/Build/source/libs/graphite/include/graphite/ITextSource.h
new file mode 100644
index 00000000000..154d80296e3
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/ITextSource.h
@@ -0,0 +1,69 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: ITextSource.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ An interface for a text source that is used by the Graphite engine.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef IGRTXTSRC_INCLUDED
+#define IGRTXTSRC_INCLUDED
+
+
+#include "GrAppData.h"
+#include "GrStructs.h"
+#include "GrResult.h"
+
+namespace gr
+{
+
+/*----------------------------------------------------------------------------------------------
+ Class: ITextSource
+ This class provides an interface for a text source for the Graphite engine.
+----------------------------------------------------------------------------------------------*/
+class ITextSource
+{
+public:
+ virtual ~ITextSource() {};
+ virtual UtfType utfEncodingForm() = 0;
+ virtual size_t getLength() = 0;
+ virtual size_t fetch(toffset ichMin, size_t cch, utf32 * prgchBuffer) = 0;
+ virtual size_t fetch(toffset ichMin, size_t cch, utf16 * prgchwBuffer) = 0;
+ virtual size_t fetch(toffset ichMin, size_t cch, utf8 * prgchsBuffer) = 0;
+ virtual bool getRightToLeft(toffset ich) = 0;
+ virtual unsigned int getDirectionDepth(toffset ich) = 0;
+ virtual float getVerticalOffset(toffset ich) = 0;
+ virtual isocode getLanguage(toffset ich) = 0;
+
+ virtual std::pair<toffset, toffset> propertyRange(toffset ich) = 0;
+ virtual size_t getFontFeatures(toffset ich, FeatureSetting * prgfset) = 0;
+ virtual bool sameSegment(toffset ich1, toffset ich2) = 0;
+};
+
+
+/*----------------------------------------------------------------------------------------------
+ Class: IColorTextSource
+ Defines a method to get the color informtion from the text source.
+ It is needed for SegmentPainters that want to handle color.
+----------------------------------------------------------------------------------------------*/
+class IColorTextSource : public ITextSource
+{
+public:
+ virtual void getColors(toffset ich, int * pclrFore, int * pclrBack) = 0;
+};
+
+} // namespace gr
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif // !IGRTXTSRC_INCLUDED
diff --git a/Build/source/libs/graphite/include/graphite/MemoryUsage.h b/Build/source/libs/graphite/include/graphite/MemoryUsage.h
new file mode 100644
index 00000000000..d59ff165f75
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/MemoryUsage.h
@@ -0,0 +1,156 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2007 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: MemoryUsage.h
+Responsibility: Sharon Correll
+Last reviewed: not yet
+
+Description:
+ Data structures to hold the calculations for memory usage.
+----------------------------------------------------------------------------------------------*/
+
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef MEMORYUSAGE_INCLUDED
+#define MEMORYUSAGE_INCLUDED
+
+//:End Ignore
+
+
+namespace gr
+{
+
+/*----------------------------------------------------------------------------------------------
+ A data structure that holds information about the memory usage for font/engine objects
+----------------------------------------------------------------------------------------------*/
+class FontMemoryUsage
+{
+ friend class FontCache;
+ friend class FontFace;
+
+public:
+ FontMemoryUsage()
+ {
+ initialize();
+ }
+ void addEngine(GrEngine * pgreng);
+ void prettyPrint(std::ostream & strm);
+
+protected:
+ // member variables:
+ std::vector<size_t> vFontTotalsReg;
+ std::vector<size_t> vFontTotalsBold;
+ std::vector<size_t> vFontTotalsItalic;
+ std::vector<size_t> vFontTotalsBI;
+ std::vector<std::string> vstrFontNames;
+ std::vector<size_t> vFaceCount;
+
+ size_t font;
+ size_t fontCache;
+ size_t fontFace;
+
+ size_t eng_count;
+ size_t eng_overhead;
+ size_t eng_scalars;
+ size_t eng_strings;
+ size_t eng_pointers;
+ size_t eng_cmap;
+ size_t eng_nameTable;
+
+ size_t pseudoMap;
+
+ size_t clstbl_counters;
+ size_t clstbl_offsets;
+ size_t clstbl_glyphList;
+
+ size_t glftbl_general;
+ size_t glftbl_compDefns;
+ size_t glftbl_attrTable;
+ size_t glftbl_attrOffsets;
+
+ size_t lngtbl_general;
+ size_t lngtbl_entries;
+ size_t lngtbl_featureSets;
+
+ size_t tman_general;
+
+ size_t pass_count;
+ size_t pass_general;
+ size_t pass_fsm;
+ size_t pass_ruleExtras;
+ size_t pass_constraintOffsets;
+ size_t pass_constraintCode;
+ size_t pass_actionOffsets;
+ size_t pass_actionCode;
+
+ size_t engst_general;
+ size_t engst_passState;
+
+ size_t sstrm_count;
+ size_t sstrm_general;
+ size_t sstrm_chunkMapsUsed;
+ size_t sstrm_chunkMapsAlloc;
+ size_t sstrm_reprocBuf;
+
+ size_t slot_count;
+ size_t slot_general;
+ size_t slot_abstract;
+ size_t slot_varLenBuf;
+ size_t slot_assocsUsed;
+ size_t slot_assocsAlloc;
+ size_t slot_attachUsed;
+ size_t slot_attachAlloc;
+
+ // methods:
+ void initialize();
+ int total();
+ void add(FontMemoryUsage & fmu);
+};
+
+/*----------------------------------------------------------------------------------------------
+ A data structure that holds information about the memory usage for segment objects.
+----------------------------------------------------------------------------------------------*/
+class SegmentMemoryUsage
+{
+public:
+ SegmentMemoryUsage()
+ {
+ initialize();
+ }
+ void addSegment(Segment & seg);
+ void prettyPrint(std::ostream & strm);
+
+protected:
+ // member variables:
+ size_t seg_count;
+ size_t overhead;
+ size_t pointers;
+ size_t scalars;
+ size_t strings;
+ size_t metrics;
+ size_t associations;
+ size_t init;
+ size_t obsolete;
+
+ size_t slot_count;
+ size_t slot_abstract;
+ size_t slot_varLenBuf;
+ size_t slot_scalars;
+ size_t slot_clusterMembers;
+
+ size_t glyphInfo_count;
+ size_t glyphInfo;
+
+ size_t wastedVector; // allocated space that is not used in vectors
+
+ // methods:
+ void initialize();
+};
+
+} // namespace gr
+
+#endif // !MEMORYUSAGE_INCLUDED
diff --git a/Build/source/libs/graphite/include/graphite/Segment.h b/Build/source/libs/graphite/include/graphite/Segment.h
new file mode 100644
index 00000000000..41443c27f53
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/Segment.h
@@ -0,0 +1,627 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: Segment.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Defines the class for a Graphite text segment.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GR_SEGMENT_INCLUDED
+#define GR_SEGMENT_INCLUDED
+
+#include "Font.h"
+#include "GrConstants.h"
+#include "SegmentAux.h"
+
+// undo automagic DrawTextA DrawTextW stuff
+// #undef DrawText
+
+//:End Ignore
+
+namespace gr
+{
+class GrEngine;
+class SegmentMemoryUsage;
+
+class IGrJustifier;
+class GrTableManager;
+class GrSlotStream;
+class GrSlotOutput;
+
+/*----------------------------------------------------------------------------------------------
+ A Graphite segment consists of a sequence of well-positioned glyphs all on one line,
+ Each glyph understands its relationship to the underlying text that was used to generate
+ the segment.
+
+ Hungarian: seg
+----------------------------------------------------------------------------------------------*/
+class Segment
+{
+ friend class GrEngine;
+ friend class SegmentPainter;
+ friend class GlyphInfo;
+ friend class GlyphIterator;
+ friend class GlyphSetIterator;
+ friend class SegmentMemoryUsage;
+
+public:
+ // Static methods
+
+ // Constructors, destructors, etc.
+ Segment();
+// Segment(ITextSource * pgts, int ichMin, int ichLim,
+// LineBrk lbStart, LineBrk lbEnd,
+// bool fStartLine, bool fEndLine, bool fWsRtl);
+
+ virtual ~Segment();
+
+ // Basic copy constructor:
+ Segment(Segment & seg);
+
+ // For making modified copies of segments:
+ static Segment * LineContextSegment(Segment & seg, bool fStartLine, bool fEndLine);
+ static Segment * JustifiedSegment(Segment & seg, float xsNewWidth);
+ static Segment * WhiteSpaceSegment(Segment & seg, int newDirDepth);
+
+ static int GetSegmentCount();
+
+public:
+
+ long IncRefCount();
+ long DecRefCount();
+
+ Font & getFont();
+ ITextSource & getText();
+ float advanceWidth();
+ Rect boundingRect();
+
+ bool rightToLeft();
+ bool paraRightToLeft() { return m_fParaRtl; }
+ int directionDepth(bool * pfWeak = NULL);
+ bool setDirectionDepth(int nNewDepth);
+ int startCharacter();
+ int stopCharacter();
+ bool startOfLine();
+ bool endOfLine();
+ bool hasLineBoundaryContext();
+ SegEnd segmentTermination();
+ LineBrk startBreakWeight();
+ LineBrk endBreakWeight();
+ float stretch();
+ float maxStretch();
+ float maxShrink();
+ void setTextSourceOffset(int ichMin)
+ {
+ m_ichwMin = ichMin;
+ }
+
+ //GrResult changeLineEnds(bool fNewStart, bool fNewEnd);
+
+ std::pair<GlyphIterator, GlyphIterator> glyphs();
+ std::pair<GlyphSetIterator, GlyphSetIterator> charToGlyphs(toffset ich);
+
+ // OBSOLETE:
+ GrResult GetCharData(int cchMax, utf16 * prgch, int * pcchRet);
+ GrResult GlyphToChar(int iginf, bool fFirst, int * pich);
+ GrResult GlyphToAllChars(int iginf, int cichMax, int * prgich, int *pcichRet);
+ GrResult CharToGlyph(int ich, bool fFirst, int * pigbb);
+
+ // Not part of FW interface:
+
+ float getRangeWidth(int ichMin, int ichLim,
+ bool fStartLine = true, bool fEndLine = true, bool fSkipSpace = true);
+ int findNextBreakPoint(int ichStart,
+ LineBrk lbPref, LineBrk lbWorst, float dxMaxWidth,
+ float * pdxBreakWidth, bool fStartLine = true, bool fEndLine = true);
+
+ GrResult getUniscribeClusters(
+ int * prgigbb1stOfCluster, int cchMax, int * pcch,
+ bool * pfClusterStart, int cfMax, int * pcf);
+
+ //GrResult GetGlyphsAndPositions(
+ // Rect rsArg, Rect rdArg, int cgidMax, int * pcgidRet, utf16 * prggid,
+ // float * prgxd, float * prgyd, float * prgdxdAdv);
+ //GrResult GetUniscribePositions(
+ // Rect rs, Rect rd, int cgidMax, int * pcgidRet,
+ // float * prgxd, float * prgyd, float * prgdxdAdv);
+ //GrResult GetUniscribeGlyphsAndPositions(
+ // Rect rsArg, Rect rdArg, int cgidMax, int * pcchRet, utf16 * prgchGlyphs,
+ // float * prgxd, float * prgyd, float * prgdxdAdv);
+
+ // Other public methods:
+
+ void Initialize(ITextSource * pgts, int ichMin, int ichLim,
+ LineBrk lbStart, LineBrk lbEnd, SegEnd est,
+ bool fStartLine, bool fEndLine, bool fWsRtl);
+ void DestroyContents();
+ void SwapWith(Segment * pgrseg);
+ void ClearAltEndLineSeg();
+
+ ITextSource * GetString(); // client is responsible to Release()
+
+ // The following three functions handle storing and retrieving information that
+ // allows us to restart a new segment following a line break. This is necessary
+ // in case there is some sort of contextualization across the line break.
+ void StoreRestartInfo(int cslotRestartBackup, std::vector<int>& vnSkipOffsets)
+ {
+ m_cslotRestartBackup = cslotRestartBackup;
+ m_vnSkipOffsets.resize(vnSkipOffsets.size());
+ for (size_t i = 0; i < vnSkipOffsets.size(); i++)
+ m_vnSkipOffsets[i] = sdata8(vnSkipOffsets[i]);
+ }
+ int NextRestartBackup()
+ {
+ return m_cslotRestartBackup;
+ }
+ int RestartBackup()
+ {
+ //return (m_psegPrev)? m_psegPrev->NextRestartBackup(): 0;
+ return 0;
+ }
+ int SkipOffset(int ipass)
+ {
+ return int(m_vnSkipOffsets[ipass]);
+ }
+ DirCode PreviousStrongDir()
+ {
+ return m_dircPrevStrong;
+ }
+ void SetPreviousStrongDir(DirCode dirc)
+ {
+ m_dircPrevStrong = dirc;
+ }
+ DirCode PreviousTermDir()
+ {
+ return m_dircPrevTerm;
+ }
+ void SetPreviousTermDir(DirCode dirc)
+ {
+ m_dircPrevTerm = dirc;
+ }
+
+ int NextSegInitBuffer(byte ** ppbDat)
+ {
+ *ppbDat = m_prgbNextSegDat;
+ return m_cbNextSegDat;
+ }
+ int ThisSegInitBuffer(byte ** ppbDat)
+ {
+ *ppbDat = m_prgInitDat;
+ return m_cbInitDat;
+ }
+
+// void SetNextSeg(Segment * psegNext)
+// {
+// m_psegNext = psegNext;
+// }
+
+ void SetFaceName(std::wstring stu, std::wstring stuBase)
+ {
+// m_stuFaceName = stu;
+// m_stuBaseFaceName = stuBase;
+// m_fUseSepBase = (m_stuBaseFaceName.size() > 0);
+ }
+
+ void SetEngine(GrEngine * pgreng);
+ void SetFont(Font * pfont);
+ void SwitchFont(Font * pfont);
+ GrEngine * EngineImpl();
+
+ void SetJustifier(IGrJustifier * pgjus);
+ IGrJustifier * Justifier()
+ {
+ return m_pgjus;
+ }
+
+ void SetPreContext(int dich)
+ {
+ m_dichPreContext = dich;
+ }
+
+ //void SetToBaseFont(IGrGraphics * pgg);
+ //void RestoreFont(IGrGraphics * pgg);
+
+ void SetUpOutputArrays(Font * pfont, GrTableManager * ptm,
+ GrSlotStream * psstrmFinal,
+ int cchwUnderlying, int csloutSurface, gid16 chwLB,
+ TrWsHandling twsh, bool fParaRtl, int nDirDepth,
+ bool fEmpty = false);
+ void RecordSurfaceAssoc(int ichw, int islot, int nDir);
+ void RecordLigature(int ichwUnder, int islotSurface, int iComponent);
+ void AdjustForOverlapsWithPrevSeg();
+ void MarkSlotInPrevSeg(int ichw, int islot);
+ void MarkSlotInNextSeg(int ichw, int islot);
+
+ void CleanUpAssocsVectors()
+ {
+ for (int iv = 0; iv < m_ichwAssocsLim - m_ichwAssocsMin; iv++)
+ {
+ std::vector<int> * pvislout = m_prgpvisloutAssocs[iv];
+ if (pvislout->size() <= 1)
+ {
+ delete pvislout;
+ *(m_prgpvisloutAssocs + iv) = NULL;
+ }
+ }
+ }
+
+ GrSlotOutput * OutputSlot(int islout);
+
+ void RecordInitializationForNextSeg(int cbNextSegDat, byte * pbNextSegDat)
+ {
+ m_cbNextSegDat = cbNextSegDat;
+ m_prgbNextSegDat = new byte[m_cbNextSegDat];
+ std::copy(pbNextSegDat, pbNextSegDat + cbNextSegDat, m_prgbNextSegDat);
+ }
+ void RecordInitializationForThisSeg(int cbDat, byte * pbDat)
+ {
+ m_cbInitDat = cbDat;
+ if (cbDat == 0)
+ m_prgInitDat = NULL;
+ else
+ {
+ m_prgInitDat = new byte[m_cbInitDat];
+ std::copy(pbDat, pbDat + cbDat, m_prgInitDat);
+ }
+ }
+
+ void SetWidths(float dxsVisWidth, float dxsTotalWidth)
+ {
+ m_dxsVisibleWidth = dxsVisWidth;
+ m_dxsTotalWidth = dxsTotalWidth;
+ }
+
+ void SetLayout(LayoutEnvironment & layout)
+ {
+ m_layout.setStartOfLine(layout.startOfLine());
+ m_layout.setEndOfLine(layout.endOfLine());
+ m_layout.setBestBreak(layout.bestBreak());
+ m_layout.setWorstBreak(layout.worstBreak());
+ m_layout.setRightToLeft(layout.rightToLeft());
+ m_layout.setTrailingWs(layout.trailingWs());
+ m_layout.setPrevSegment(layout.prevSegment());
+ m_layout.setJustifier(layout.justifier());
+ m_layout.setLoggingStream(layout.loggingStream());
+ m_layout.setDumbFallback(layout.dumbFallback());
+ }
+ LayoutEnvironment & Layout()
+ {
+ return m_layout;
+ }
+
+ bool Erroneous()
+ {
+ return m_fErroneous;
+ }
+ void SetErroneous(bool f)
+ {
+ m_fErroneous = f;
+ }
+
+ void FixTermination(SegEnd est)
+ {
+ m_est = est;
+ }
+
+ // Convert from em-units to logical units.
+ float EmToLogUnits(int m);
+
+ Rect ComponentRect(GrSlotOutput * pslout, int icomp);
+
+ void ClusterMembersForGlyph(int islout, int disloutCluster, std::vector<int> & visloutRet);
+
+ // for transduction logging:
+ // implementations are empty unless TRACING is defined
+ void LogUnderlyingToSurface(GrTableManager * ptman, std::ostream & strmOut,
+ GrCharStream * pchstrm);
+ void LogSurfaceToUnderlying(GrTableManager * ptman, std::ostream & strmOut);
+ void LogXmlUnderlyingToSurface(std::ostream & strmOut, GrTableManager * ptman,
+ GrCharStream * pchstrm, int nIndent);
+ void LogXmlSurfaceToUnderlying(std::ostream & strmOut, GrTableManager * ptman,
+ GrCharStream * pchstrm, int nIndent);
+
+ // calculate memory usage
+ void calculateMemoryUsage(SegmentMemoryUsage & smu);
+
+protected:
+ // Member variables:
+ long m_cref; // standard COM ref count
+
+ ITextSource * m_pgts; // the string we are a segment of
+ int m_dichwLim; // number of characters officially in this segment
+ int m_ichwMin; // first character relative to the text-source
+
+ Font * m_pfont;
+ GrEngine * m_preneng;
+
+ bool m_fErroneous; // an error occurred in generating this segment
+
+ IGrJustifier * m_pgjus;
+
+ LayoutEnvironment m_layout;
+
+ bool m_fWsRtl; // writing system direction
+ bool m_fParaRtl; // paragraph direction; redundant with layout?
+
+ TrWsHandling m_twsh; // // redundant with layout?
+ int m_nDirDepth; // segment direction (white-space-only segments can switch)
+
+ byte * m_prgbNextSegDat; // for initializing the following segment
+ int m_cbNextSegDat; // length of above buffer
+
+ byte * m_prgInitDat; // what was used to initialize this segment
+ int m_cbInitDat;
+
+ int m_dichPreContext; // what part of this segment affects the previous;
+ // not really used for anything right now
+
+// Segment * m_psegPrev; // OBSOLETE
+// Segment * m_psegNext;
+
+ // Font information:
+// std::wstring m_stuFaceName;
+// std::wstring m_stuBaseFaceName;
+// bool m_fUseSepBase;
+
+// float m_pixHeight; // character height of font in pixels (NOT = ascent + descent)
+// bool m_fBold;
+// bool m_fItalic;
+
+ LineBrk m_lbStart;
+ LineBrk m_lbEnd;
+
+ bool m_fStartLine; // redundant with layout?
+ bool m_fEndLine; // redundant with layout?
+
+ SegEnd m_est;
+
+ //Segment * m_psegAltEndLine; // segment having the alternate m_fEndLine value
+
+ int m_mFontEmUnits;
+ float m_dysFontAscent;
+ float m_dysFontDescent;
+ float m_xysEmSquare; // em-square of the font in display units
+// float m_xsDPI; // DPI of device on which segment was measured
+// float m_ysDPI;
+
+ float m_dxsStretch; // difference between actual and natural width
+ float m_dxsWidth; // width in absence of any stretch. -1 if not computed.
+ float m_dysHeight;
+ float m_dysAscent; // distance from common baseline to top of this segment,
+ // including extra ascent
+
+ float m_dysXAscent; // extra for this renderer, beyond what is standard for the font
+ float m_dysXDescent;
+
+ float m_dysAscentOverhang; // extra height above official top of segment; >= 0
+ float m_dysDescentOverhang; // extra height below bottom of segment; <= 0;
+ float m_dxsLeftOverhang; // <= 0
+ float m_dxsRightOverhang;
+
+ float m_dxsVisibleWidth; // not including trailing white space
+ float m_dxsTotalWidth; // including trailing white space
+
+ int m_isloutVisLim; // lim of visible stuff (to handle trailing ws underlines)
+
+ float m_dysOffset;
+
+ // Index of the first item in the before/after arrays and the ligature/component arrays,
+ // relative to the start of the segment. Normally == 0, but will be some negative number
+ // if there are slots "borrowed" from the previous segment (officially located in the
+ // previous segment but rendered in this one).
+ int m_ichwAssocsMin;
+
+ // 1 + index of last item in the before/after arrays and the ligature/component arrays,
+ // relative to the start of the segment. Normally == m_dichwLim, but will be
+ // larger if there are slots "borrowed" from the following segment.
+ int m_ichwAssocsLim;
+
+ // Underlying-to-surface associations:
+ int * m_prgisloutBefore; // logical first
+ int * m_prgisloutAfter; // logical last
+ std::vector<int> ** m_prgpvisloutAssocs; // all; used by range selections
+
+ int * m_prgisloutLigature; // similar to above, index of associated ligature, or kNegInfinity
+
+ sdata8 * m_prgiComponent; // component of the ligature that the corresponding character
+ // represents; only meaningful if corresponding item in
+ // m_prgisloutLigature is set
+
+// GrSlotStream * m_psstrm; // TODO: rework to remove this
+ int m_cslout;
+ GrSlotOutput * m_prgslout; // final output slots
+ u_intslot * m_prgnSlotVarLenBuf; // var-length buffer for slots--one big buffer managed by the
+ // segment, but pointed to by the slots
+
+// int m_cnUserDefn; // this information is not stored in the segment itself
+ int m_cnCompPerLig;
+// int m_cnFeat; // this information is not stored in the segment itself
+
+ int m_cginf;
+ int m_isloutGinf0; // islout index for m_prgginf[0];
+ GlyphInfo * m_prgginf;
+
+ // Data structures to hold glyphs for rendering:
+////#include "GrSegmentPlatform.h"
+
+ // For initializing the following segment:
+ int m_cslotRestartBackup; // the number of slots in the underlying
+ // input that need to be reprocessed when starting
+ // the next segment
+
+ std::vector<sdata8> m_vnSkipOffsets; // skip offset for each pass when restarting
+
+ DirCode m_dircPrevStrong; // previous strong directionality code
+ DirCode m_dircPrevTerm; // previous terminator code, if any
+
+
+ // Other protected methods:
+
+ void InitLineContextSegment(bool fStartLine, bool fEndLine);
+ void InitWhiteSpaceSegment(int nNewDepth);
+
+ void ComputeDimensions();
+
+ void SetUpGlyphInfo(GrTableManager * ptman, GrSlotStream * psstrmFinal,
+ gid16 chwLB, int nDirDepth, int islotMin, int cslot);
+ void SetUpLigInfo(GrTableManager * ptman, GlyphInfo & ginf, GrSlotOutput * pslout);
+
+ void InitBeforeArrayFromPrevSeg(); // obsolete
+ void AdjustBeforeArrayFromPrevSeg();
+ void AdjustAfterArrayFromNextSeg();
+ void EnsureSpaceAtLineBoundaries(int ichwUnder);
+
+ int LogicalSurfaceToUnderlying(int islout,
+ float xsOffset, float ysOffset,
+ float dxsGlyphWidth = 0, float dysGlyphHeight = 0, bool * pfAfter = NULL);
+ int LogicalSurfaceToUnderlying(int islout, bool fBefore);
+ int PhysicalSurfaceToUnderlying(int iginf,
+ float xsOffset, float xyOffset,
+ float dxsGlyphWidth = 0, float dysGlyphHeight = 0, bool * pfAfter = NULL);
+ int PhysicalSurfaceToUnderlying(int iginf, bool fBefore);
+ int UnderlyingToLogicalSurface(int ichw, bool fBefore);
+ int UnderlyingToPhysicalSurface(int ichw, bool fBefore);
+ int LogicalToPhysicalSurface(int islout);
+ void UnderlyingToPhysicalAssocs(int ichw, std::vector<int> & viginf);
+ std::vector<int> UnderlyingToLogicalAssocs(int ichw);
+ int UnderlyingToLogicalInThisSeg(int ichw);
+ bool SameSurfaceGlyphs(int ichw1, int ichw2);
+
+ void ShiftGlyphs(float dxsShift);
+
+ float GlyphLeftEdge(int iginf);
+
+ int DirLevelOfChar(int ichw, bool fBefore);
+ int CharIsRightToLeft(int ichw, bool fBefore);
+ int SlotIsRightToLeft(GrSlotOutput * pslout);
+ int TopDirLevel()
+ {
+ if (m_fWsRtl)
+ return 1;
+ else
+ return 0;
+ }
+
+ void AssertValidClusters(GrSlotStream * psstrm);
+
+ void MergeUniscribeCluster(
+ std::vector<int> & visloutBefore, std::vector<int> & visloutAfter,
+ int ich1, int ich2);
+
+ int GlyphHit(float xsClick, float ysClick);
+ int SelectBb(std::vector<int> & viginf, bool fRTL);
+
+ int RightMostGlyph();
+ int LeftMostGlyph();
+
+ void ComputeOverhangs(float * pdysVisAscent, float * pdysNegVisDescent,
+ float * pdxsVisLeft, float * pdxsVisRight);
+
+public:
+ LineBrk getBreakWeight(int ich, bool fBreakBefore = false);
+
+ // Platform-specific routines:
+protected:
+ //void ShiftGlyphsPlatform(float dxsShift);
+ //bool SetDirectionDepthPlatform(int nNewDepth);
+
+ //void InitializePlatform();
+ //void DestroyContentsPlatform();
+ //GrResult GetGlyphsAndPositionsPlatform(float xs, float ys,
+ // Rect rsArg, Rect rdArg,
+ // utf16 * prgchGlyphs, float * prgxd, float * prgyd, float * prgdxdAdv);
+ //void SetUpOutputArraysPlatform(GrTableManager * ptman, gid16 chwLB, int nDirDepth,
+ // int islotMin, int cslot);
+
+ // Temporary - for WinSegmentPainter
+public:
+ int CSlout()
+ {
+ return m_cslout;
+ }
+ gid16 LBGlyphID();
+ float AscentOffset()
+ {
+ if (m_dysAscent == -1)
+ ComputeDimensions();
+ return m_dysAscent - m_dysFontAscent;
+ }
+};
+
+
+//:>********************************************************************************************
+//:> The purpose of these subclasses is simply to provide meaningful names for the
+//:> constructors. Instances of these classes are in every way equivalent to Segment.
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Creating a LineFillSegment fits as much of the text on the line as possible,
+ finding a reasonable break point if necessary.
+----------------------------------------------------------------------------------------------*/
+class LineFillSegment : public Segment
+{
+public:
+ LineFillSegment(
+ Font * pfont,
+ ITextSource * pts,
+ LayoutEnvironment * playout,
+ toffset ichStart,
+ toffset ichStop,
+ float maxWidth,
+ bool fBacktracking = false);
+protected:
+ // Default constructor:
+ LineFillSegment() : Segment()
+ {
+ }
+};
+
+/*----------------------------------------------------------------------------------------------
+ Creating a RangeSegment makes a segment representing the given range of characters, or
+ the entire text-source.
+----------------------------------------------------------------------------------------------*/
+class RangeSegment : public Segment
+{
+public:
+ RangeSegment(
+ Font * pfont,
+ ITextSource * pts,
+ LayoutEnvironment * playout,
+ toffset ichStart = 0,
+ toffset ichStop = kPosInfinity,
+ Segment * psegInitLike = NULL);
+};
+
+/*----------------------------------------------------------------------------------------------
+ The JustSegmentAux class is used by the factory method that creates a justified segment.
+ It is called JustSegmentAux to avoid conflicting with the factory method.
+----------------------------------------------------------------------------------------------*/
+class JustSegmentAux : public Segment
+{
+public:
+ JustSegmentAux(
+ Font * pfont,
+ ITextSource * pts,
+ LayoutEnvironment * playout,
+ toffset ichStart,
+ toffset ichStop,
+ float xsNaturalWidth,
+ float xsJustifiedWidth,
+ Segment * psegInitLike = NULL);
+};
+
+} // namespace gr
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif // !GR_SEGMENT_INCLUDED
diff --git a/Build/source/libs/graphite/include/graphite/SegmentAux.h b/Build/source/libs/graphite/include/graphite/SegmentAux.h
new file mode 100644
index 00000000000..293ba291436
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/SegmentAux.h
@@ -0,0 +1,392 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2005 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: SegmentAux.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Auxiliary classes for the Segment class:
+ - GlyphInfo
+ - GlyphIterator
+ - LayoutEnvironment
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef SEGMENTAUX_INCLUDED
+#define SEGMENTAUX_INCLUDED
+
+//:End Ignore
+
+namespace gr
+{
+
+class Segment;
+class GrSlotOutput;
+class IGrJustifier;
+class GlyphInfo;
+class GlyphIterator;
+class GlyphSetIterator;
+
+
+/*----------------------------------------------------------------------------------------------
+ The GlyphInfo class provides access to details about a single glyph within a segment.
+----------------------------------------------------------------------------------------------*/
+class GlyphInfo // hungarian: ginf
+{
+ friend class Segment;
+
+public:
+ // Default constructor:
+ GlyphInfo()
+ {
+ m_pseg = NULL;
+ m_pslout = NULL;
+ m_islout = kInvalid;
+ }
+
+ gid16 glyphID();
+ gid16 pseudoGlyphID();
+
+ // Index of this glyph in the logical sequence; zero-based.
+ size_t logicalIndex();
+
+ // glyph's position relative to the left of the segment
+ float origin();
+ float advanceWidth(); // logical units
+ float advanceHeight(); // logical units; zero for horizontal fonts
+ float yOffset();
+ gr::Rect bb(); // logical units
+ bool isSpace();
+
+ // first char associated with this glyph, relative to start of seg
+ toffset firstChar();
+ // last char associated with this glyph, relative to start of seg
+ toffset lastChar();
+
+ // Unicode bidi value
+ unsigned int directionality();
+ // Embedding depth
+ unsigned int directionLevel();
+ bool insertBefore();
+ int breakweight();
+
+ bool isAttached() const throw();
+ gr::GlyphIterator attachedClusterBase() const throw();
+ float attachedClusterAdvance() const throw();
+ std::pair<gr::GlyphSetIterator, gr::GlyphSetIterator> attachedClusterGlyphs() const;
+
+ float maxStretch(size_t level);
+ float maxShrink(size_t level);
+ float stretchStep(size_t level);
+ byte justWeight(size_t level);
+ float justWidth(size_t level);
+ float measureStartOfLine();
+ float measureEndOfLine();
+
+ size_t numberOfComponents();
+ gr::Rect componentBox(size_t icomp);
+ toffset componentFirstChar(size_t icomp);
+ toffset componentLastChar(size_t icomp);
+
+ bool erroneous();
+
+ const Segment & segment() const throw();
+ Segment & segment() throw();
+
+protected:
+ Segment * m_pseg;
+ GrSlotOutput * m_pslout;
+ int m_islout; // signed, so it can return kInvalid
+};
+
+inline Segment & GlyphInfo::segment() throw () {
+ return * m_pseg;
+}
+
+inline const Segment & GlyphInfo::segment() const throw () {
+ return * m_pseg;
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ The GlyphIterator class allows the Graphite client to iterate over a contiguous
+ range of glyphs for the segment.
+----------------------------------------------------------------------------------------------*/
+class GlyphIterator
+: public std::iterator<std::random_access_iterator_tag, gr::GlyphInfo>
+{
+ friend class GlyphInfo;
+ friend class Segment;
+
+ // Pointers into the glyph info store
+ GlyphInfo * m_pginf;
+
+protected:
+ // Constructor
+ GlyphIterator(Segment & seg, size_t iginf);
+
+public:
+ // Default constructor.
+ GlyphIterator() throw (): m_pginf(0) {}
+
+ explicit GlyphIterator(const GlyphSetIterator &);
+
+ // Forward iterator requirements.
+ reference operator*() const { assert(m_pginf != 0); return *m_pginf; }
+ pointer operator->() const { return m_pginf; }
+ GlyphIterator & operator++() throw() { ++m_pginf; return *this; }
+ GlyphIterator operator++(int) throw() { GlyphIterator tmp = *this; operator++(); return tmp; }
+
+ // Bidirectional iterator requirements
+ GlyphIterator & operator--() throw() { --m_pginf; return *this; }
+ GlyphIterator operator--(int) throw() { GlyphIterator tmp = *this; operator--(); return tmp; }
+
+ // Random access iterator requirements
+ reference operator[](difference_type n) const { return m_pginf[n]; }
+ GlyphIterator & operator+=(difference_type n) throw() { m_pginf += n; return *this; }
+ GlyphIterator operator+(difference_type n) const throw() { GlyphIterator r = *this; return r += n; }
+ GlyphIterator & operator-=(difference_type n) throw() { m_pginf -= n; return *this; }
+ GlyphIterator operator-(difference_type n) const throw() { GlyphIterator r = *this; return r += -n; }
+
+ // Relational operators.
+ // Forward iterator requirements
+ bool operator==(const GlyphIterator & rhs) const throw() { return m_pginf == rhs.m_pginf; }
+ bool operator!=(const GlyphIterator & rhs) const throw() { return !(*this == rhs); }
+
+ // Random access iterator requirements
+ bool operator<(const GlyphIterator & rhs) const throw() { return m_pginf < rhs.m_pginf; }
+ bool operator>(const GlyphIterator & rhs) const throw() { return m_pginf > rhs.m_pginf; }
+ bool operator<=(const GlyphIterator & rhs) const throw() { return !(*this > rhs); }
+ bool operator>=(const GlyphIterator & rhs) const throw() { return !(*this < rhs); }
+
+ difference_type operator-(const GlyphIterator & rhs) const throw() { return m_pginf - rhs.m_pginf; }
+};
+
+inline GlyphIterator operator+(const GlyphIterator::difference_type n, const GlyphIterator & rhs)
+{
+ return rhs + n;
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ This reference-counted vector is used as the basis of GlyphSetIterator. This is because
+ multiple iterators are based on the same vector, so it needs to hang around appropriately.
+----------------------------------------------------------------------------------------------*/
+class RcVector
+{
+ friend class GlyphSetIterator;
+
+public:
+ RcVector(std::vector<int> & vn)
+ {
+ m_vn = vn;
+ m_cref = 0;
+ }
+
+protected:
+ void IncRefCount() const
+ {
+ m_cref++;
+ }
+ void DecRefCount() const
+ {
+ m_cref--;
+ if (m_cref <= 0)
+ delete this;
+ }
+
+ const std::vector<int> & Vector() const { return m_vn; };
+
+ // member variables:
+ mutable int m_cref;
+ std::vector<int> m_vn;
+};
+
+/*----------------------------------------------------------------------------------------------
+ The GlyphSetIterator class allows the Graphite client to iterate over a non-contiguous
+ set of glyphs for the segment, this is almost always the set of glyphs for a character.
+----------------------------------------------------------------------------------------------*/
+class GlyphSetIterator
+: public std::iterator<std::random_access_iterator_tag, gr::GlyphInfo>
+{
+ friend class GlyphInfo;
+ friend class Segment;
+
+ // Segment containing the glyphs being iterated over.
+ const Segment * m_pseg;
+
+ // Sometimes, in the case of character-to-glyph look-ups or attached
+ // children, we need to represent a non-contiguous list; in these cases
+ // we first map through a vector of output-slot objects into the actual
+ // glyph-info store.
+ std::vector<int>::const_iterator m_vit;
+
+ // Store a reliable copy of the vector we are iterating over:
+ const RcVector * m_qvislout;
+
+protected:
+ // Constructor that includes output-slot mapping list, used for non-contiguous lists:
+ GlyphSetIterator(Segment & seg, size_t islout, RcVector * qvislout)
+ : m_pseg(&seg), m_vit(qvislout->Vector().begin() + islout)
+ {
+ m_qvislout = qvislout;
+ m_qvislout->IncRefCount();
+ }
+public:
+ // Default constructor--no output-slot mapping:
+ GlyphSetIterator() throw() : m_pseg(0), m_vit(std::vector<int>::const_iterator())
+ {
+ m_qvislout = NULL;
+ }
+
+ // Copy constructor:
+ GlyphSetIterator(const GlyphSetIterator & sit) throw()
+ {
+ m_pseg = sit.m_pseg;
+ m_vit = sit.m_vit;
+ m_qvislout = sit.m_qvislout;
+ if (m_qvislout)
+ m_qvislout->IncRefCount();
+ }
+ // Assignment operator:
+ GlyphSetIterator & operator=(const GlyphSetIterator & sit) throw()
+ {
+ m_pseg = sit.m_pseg;
+ m_vit = sit.m_vit;
+ m_qvislout = sit.m_qvislout;
+ if (m_qvislout)
+ m_qvislout->IncRefCount();
+ return *this;
+ }
+ // Destructor:
+ ~GlyphSetIterator()
+ {
+ if (m_qvislout)
+ m_qvislout->DecRefCount();
+ }
+
+ // Forward iterator requirements.
+ reference operator*() const;
+ pointer operator->() const { return &(operator*()); }
+ GlyphSetIterator & operator++() throw() { ++m_vit; return *this; }
+ GlyphSetIterator operator++(int) throw() { GlyphSetIterator tmp = *this; operator++(); return tmp; }
+
+ // Bidirectional iterator requirements
+ GlyphSetIterator & operator--() throw() { --m_vit; return *this; }
+ GlyphSetIterator operator--(int) throw() { GlyphSetIterator tmp = *this; operator--(); return tmp; }
+
+ // Random access iterator requirements
+ reference operator[](difference_type n) const { return *operator+(n); }
+ GlyphSetIterator & operator+=(difference_type n) throw() { m_vit += n; return *this; }
+ GlyphSetIterator operator+(difference_type n) const throw() { GlyphSetIterator r = *this; return r += n; }
+ GlyphSetIterator & operator-=(difference_type n) throw() { operator+=(-n); return *this; }
+ GlyphSetIterator operator-(difference_type n) const throw() { GlyphSetIterator r = *this; return r += -n; }
+
+ // Relational operators.
+ // Forward iterator requirements
+ bool operator==(const GlyphSetIterator & rhs) const throw() { return m_vit == rhs.m_vit; }
+ bool operator!=(const GlyphSetIterator & rhs) const throw() { return !(*this == rhs); }
+
+ // Random access iterator requirements
+ bool operator<(const GlyphSetIterator & rhs) const throw() { return m_vit < rhs.m_vit; }
+ bool operator>(const GlyphSetIterator & rhs) const throw() { return m_vit > rhs.m_vit; }
+ bool operator<=(const GlyphSetIterator & rhs) const throw() { return !(*this > rhs); }
+ bool operator>=(const GlyphSetIterator & rhs) const throw() { return !(*this < rhs); }
+
+ difference_type operator-(const GlyphSetIterator & rhs) const throw() { return m_vit - rhs.m_vit; }
+};
+
+inline GlyphSetIterator operator+(const GlyphSetIterator::difference_type n, const GlyphSetIterator & rhs)
+{
+ return rhs + n;
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ The GlyphInfo class provides access to details about a single glyph within a segment.
+----------------------------------------------------------------------------------------------*/
+class LayoutEnvironment
+{
+public:
+ LayoutEnvironment()
+ {
+ // Defaults:
+ m_fStartOfLine = true;
+ m_fEndOfLine = true;
+ m_lbBest = klbWordBreak;
+ m_lbWorst = klbClipBreak;
+ m_fRightToLeft = false;
+ m_twsh = ktwshAll;
+ m_pstrmLog = NULL;
+ m_fDumbFallback = false;
+ m_psegPrev = NULL;
+ m_psegInit = NULL;
+ m_pjust = NULL;
+ }
+ LayoutEnvironment(LayoutEnvironment & layout)
+ {
+ m_fStartOfLine = layout.m_fStartOfLine;
+ m_fEndOfLine = layout.m_fEndOfLine;
+ m_lbBest = layout.m_lbBest;
+ m_lbWorst = layout.m_lbWorst;
+ m_fRightToLeft = layout.m_fRightToLeft;
+ m_twsh = layout.m_twsh;
+ m_pstrmLog = layout.m_pstrmLog;
+ m_fDumbFallback = layout.m_fDumbFallback;
+ m_psegPrev = layout.m_psegPrev;
+ m_psegInit = layout.m_psegInit;
+ m_pjust = layout.m_pjust;
+ }
+
+ // Setters:
+ inline void setStartOfLine(bool f) { m_fStartOfLine = f; }
+ inline void setEndOfLine(bool f) { m_fEndOfLine = f; }
+ inline void setBestBreak(LineBrk lb) { m_lbBest = lb; }
+ inline void setWorstBreak(LineBrk lb) { m_lbWorst = lb; }
+ inline void setRightToLeft(bool f) { m_fRightToLeft = f; }
+ inline void setTrailingWs(TrWsHandling twsh) { m_twsh = twsh; }
+ inline void setLoggingStream(std::ostream * pstrm) { m_pstrmLog = pstrm; }
+ inline void setDumbFallback(bool f) { m_fDumbFallback = f; }
+ inline void setPrevSegment(Segment * pseg) { m_psegPrev = pseg; }
+ inline void setSegmentForInit(Segment * pseg) { m_psegInit = pseg; }
+ inline void setJustifier(IGrJustifier * pjust) { m_pjust = pjust; }
+
+ // Getters:
+ inline bool startOfLine() { return m_fStartOfLine; }
+ inline bool endOfLine() { return m_fEndOfLine; }
+ inline LineBrk bestBreak() { return m_lbBest; }
+ inline LineBrk worstBreak() { return m_lbWorst; }
+ inline bool rightToLeft() { return m_fRightToLeft; }
+ inline TrWsHandling trailingWs() { return m_twsh; }
+ inline std::ostream * loggingStream() { return m_pstrmLog; }
+ inline bool dumbFallback() { return m_fDumbFallback; }
+ inline Segment * prevSegment() { return m_psegPrev; }
+ inline Segment * segmentForInit() { return m_psegInit; }
+ inline IGrJustifier * justifier() { return m_pjust; }
+
+protected:
+ bool m_fStartOfLine;
+ bool m_fEndOfLine;
+ LineBrk m_lbBest;
+ LineBrk m_lbWorst;
+ bool m_fRightToLeft;
+ TrWsHandling m_twsh;
+ std::ostream * m_pstrmLog;
+ bool m_fDumbFallback;
+ Segment * m_psegPrev;
+ Segment * m_psegInit;
+ IGrJustifier * m_pjust;
+};
+
+} // namespace gr
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif // !SEGMENTAUX_INCLUDED
diff --git a/Build/source/libs/graphite/include/graphite/SegmentPainter.h b/Build/source/libs/graphite/include/graphite/SegmentPainter.h
new file mode 100644
index 00000000000..29564a6c63d
--- /dev/null
+++ b/Build/source/libs/graphite/include/graphite/SegmentPainter.h
@@ -0,0 +1,234 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: SegmentPainter.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Defines the class for a Graphite text segment.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GR_SEGPAINTER_INCLUDED
+#define GR_SEGPAINTER_INCLUDED
+
+// undo automagic DrawTextA DrawTextW stuff
+// #undef DrawText
+
+//:End Ignore
+
+
+namespace gr
+{
+
+class Segment;
+
+/*----------------------------------------------------------------------------------------------
+ A SegmentPainter handles the UI-related operations on for segment.
+
+ This superclass does not know how to do any actual drawing, because it has no access
+ to a device. Subclasses are needed to handle drawing on the various platforms. In addition,
+ it is legitimate to make a subclass to override the behavior of a specific piece of
+ functionality.
+
+ Hungarian: segp
+----------------------------------------------------------------------------------------------*/
+class SegmentPainter
+{
+public:
+ // Static methods
+
+ // Constructors/destructors/etc.
+ SegmentPainter(Segment * pseg, float xOrigin = 0, float yOrigin = 0);
+ //SegmentPainter(Segment * pseg, float xOrigin, float yOrigin);
+
+ virtual ~SegmentPainter();
+
+ virtual void setOrigin(float xsOrigin, float ysOrigin);
+ virtual void setPosition(float xdPosition, float ydPosition);
+ virtual void setScalingFactors(float xFactor, float yFactor);
+
+ virtual void setBuggyDisplayFormat(int strategy, long textColor, long backColor,
+ long underlineColor)
+ {
+ // Currently not implemented to do anything useful.
+ }
+
+ // The paint method must be implemented by a concrete subclass:
+ virtual void paint() = 0;
+
+ virtual void drawInsertionPoint(int ichwIP, bool fAssocPrev, bool bOn, bool fForceSplit);
+ virtual void positionsOfIP(int ichwIP, bool fAssocPrev, bool fForceSplit,
+ Rect * prdPrimary, Rect * prdSecondary);
+ virtual bool drawSelectionRange(int ichwMin, int ichwLim,
+ float ydTop, float ydBottom, bool bOn);
+ virtual bool positionsOfRange(int ichwMin, int ichwLim,
+ float ydTop, float ydBottom, Rect * prsBounds);
+ virtual size_t getUnderlinePlacement(int ichwMin, int ichwLim,
+ bool fSkipSpace,
+ size_t crgMax, // number of ranges allowed
+ float * prgxdLefts, float * prgxdRights, float * prgydUnderline);
+
+ virtual void pointToChar(Point zptdClickPosition, int * pichw, bool * pfAssocPrev);
+ virtual LgIpValidResult isValidInsertionPoint(int ichwIP);
+ virtual bool doBoundariesCoincide(bool fBoundaryEnd, bool fBoundaryRight);
+ virtual int arrowKeyPosition(int ichwIP, bool * pfAssocPrev,
+ bool fRight, bool * pfInThisSeg);
+ virtual int extendSelectionPosition(
+ int charIndex, bool assocPrevMatch, bool assocPrevNeeded,
+ int anchorIndex, bool movingRight, bool * inThisSeg);
+
+ // For calculating underlines:
+ struct LineSeg { // hungarian: ls
+ float left;
+ float right;
+ };
+
+ static float ScaleX(float xs, Rect rs, Rect rd);
+ static float ScaleY(float ys, Rect rs, Rect rd);
+
+ float ScaleXToDest(float xs)
+ {
+ float xd = ((xs + m_xsOrigin) * m_xFactor) + m_xdPosition;
+ return xd;
+ }
+ //int ScaleXToDest(int xs)
+ //{
+ // int xd = (((xs + m_xsOriginInt) * m_xFactor64) >> 6) + m_xdPositionInt;
+ // return xd; // >> 6 means div by 64
+ //}
+ float ScaleYToDest(float ys)
+ {
+ float yd = ((ys + m_ysOrigin) * m_yFactor) + m_ydPosition;
+ return yd;
+ }
+
+ float ScaleXToSource(float xd)
+ {
+ float xs = ((xd - m_xdPosition) / m_xFactor) - m_xsOrigin;
+ return xs;
+ }
+ float ScaleYToSource(float yd)
+ {
+ float ys = ((yd - m_ydPosition) / m_yFactor) - m_ysOrigin;
+ return ys;
+ }
+
+protected:
+ // Member variables:
+
+ Segment * m_pseg;
+
+ // transformation factors:
+ float m_xsOrigin;
+ float m_ysOrigin;
+ float m_xdPosition;
+ float m_ydPosition;
+ float m_xFactor; // destination / source
+ float m_yFactor; // destination / source
+
+ // optimizations for when we need integer arithmetic (converting between int and float is
+ // very slow) - DELETE these.
+ //int m_xsOriginInt;
+ //int m_xdPositionInt;
+ //int m_xFactor64;
+
+ //gr::Rect m_rectSrc;
+
+ // Other methods:
+
+ void CalcOrDrawInsertionPoint(
+ int ich, bool fAssocPrev, bool bOn, bool fForceSplit,
+ Rect * prectPrimary, Rect * prectSecondary);
+ void InvertIBeam(float xs, float ysTop, float ysBottom, bool fAssocPrev,
+ Rect * prdRet);
+ void InvertSplitIP(float xs, float ysTop, float ysBottom,
+ bool fTop, bool fAssocRight, bool fSecondary, float ysMinSplitHt,
+ Rect * prdRet);
+ void CalcIP(int ichw, bool fBefore,
+ float * pxs, float * pysTop, float * pysBottom, bool * pfRtl);
+ bool CloseIPPositions(
+ float * pxsBefore, float ysBeforeTop, float ysBeforeBottom,
+ float * pxsAfter, float ysAfterTop, float ysAfterBottom);
+ bool AtEdgeOfCluster(GrSlotOutput * pslout, int islout, bool fBefore);
+ bool AtEdgeOfCluster(GrSlotOutput * psloutBase, int isloutBase,
+ GrSlotOutput * pslout, int islout, bool fBefore);
+ bool CanInsertIntoCluster(GrSlotOutput * pslout, int islout);
+
+ void CalcPartialLigatures(bool * prgfAllSelected,
+ int ichwMinSeg, int ichwLimSeg,
+ int ichwMinSel, int ichwLimSel);
+ void CalcHighlightRect(int ichw,
+ std::vector<Rect> & vrs, std::vector<bool> & vfEntireLineHt,
+ bool fJustComponent, bool * rgfHighlighted, bool fSkipTrSpace);
+ void CalcCompleteCluster(int islout,
+ std::vector<Rect> & vrs, std::vector<bool> & vfEntireLineHt, bool * prgfHighlighted);
+ void AddRectWithoutOverlaps(std::vector<Rect> & vrect, Rect rectToAdd);
+ bool AnyArea(Rect * prect);
+ bool AdjustRectsToNotOverlap(std::vector<Rect> & vrect, int irect, Rect * prect2,
+ std::vector<Rect> & vrectMoreToAdd);
+ void AssertNoOverlaps(std::vector<Rect> & vrect);
+
+ void AddLineSegWithoutOverlaps(std::vector<LineSeg> & vls, LineSeg lsToAdd);
+ bool AnyLength(LineSeg * pls);
+ bool AdjustLineSegsToNotOverlap(std::vector<LineSeg> & vls, int ils, LineSeg * pls2,
+ std::vector<LineSeg> & vlsMoreToAdd);
+ void AssertNoOverlaps(std::vector<LineSeg> & vls);
+
+ GrResult ArrowKeyPositionAux(int * pichwIP, bool * pfAssocPrev,
+ bool fRight, bool fMovingIn,
+ bool fAssocPrevMatch, bool fAssocPrevNeeded,
+ bool * pfResult);
+ bool ArrowKeyPositionInternal(int * pichw, bool * pfAssocPrev,
+ bool fRight, bool fAssocPrevMatch, bool fAssocPrevNeeded, int * nNextOrPrevSeg);
+ bool AdjacentLigComponent(int * pichw, bool * pfAssocPrev, bool fRight, bool fMove);
+
+ int PointToCharAux(float xsTry, float ysTry,
+ float * pxsGlyphOffset, float * pxsGlyphWidth);
+
+ // Platform-specific routines:
+
+ GrResult DrawSegmentPlatform(float xs, float ys);
+
+ // Low-level routines--these must be implemented appropriate by subclasses:
+
+ virtual void InvertRect(float xLeft, float yTop, float xRight, float yBottom)
+ {
+ GrAssert(false); // no device context
+ }
+
+ //void SetFontProps();
+ virtual void SetFontProps(unsigned long clrFore, unsigned long clrBack);
+
+};
+
+/*----------------------------------------------------------------------------------------------
+ This is a subclass of SegmentPainter for which the paint operation is unnecessary.
+----------------------------------------------------------------------------------------------*/
+class SegmentNonPainter : public SegmentPainter
+{
+public:
+ SegmentNonPainter(Segment * pseg)
+ : SegmentPainter(pseg)
+ {
+ }
+
+ void paint()
+ {
+ GrAssert(false);
+ throw;
+ }
+};
+
+} // namespace gr
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif // !GR_SEGPAINTER_INCLUDED
diff --git a/Build/source/libs/graphite/installed-top.pc.in b/Build/source/libs/graphite/installed-top.pc.in
new file mode 100644
index 00000000000..7609afda4e4
--- /dev/null
+++ b/Build/source/libs/graphite/installed-top.pc.in
@@ -0,0 +1,5 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+version=@VERSION@
diff --git a/Build/source/libs/graphite/license/LICENSING.txt b/Build/source/libs/graphite/license/LICENSING.txt
new file mode 100644
index 00000000000..33a150a94d6
--- /dev/null
+++ b/Build/source/libs/graphite/license/LICENSING.txt
@@ -0,0 +1,43 @@
+ Graphite 2.1 Licensing
+
+ Copyright 1999-2006, SIL International
+ All rights reserved.
+
+ This library is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ a) the Common Public License as published by the "Agreement
+ Steward" for that license (currently IBM); either version 0.5
+ of the License, or (at your option) any later version,
+
+ or
+
+ b) the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2.1 of License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either
+ the Common Public License or the GNU Lesser General Public License
+ for more details.
+
+ You should have received a plain text copy of the Common Public License
+ Version 0.5 with this distribution in the file named "License_CPLv05.txt".
+ That text came from http://www.opensource.org/licenses/cpl.html. The
+ initial "Agreement Steward" for the CPL displays currently the license at
+ http://www-124.ibm.com/developerworks/oss/license-cpl.html.
+
+ You should also have received a copy of the GNU Lesser General Public
+ License along with this library in the file named "License_LGPLv21.txt".
+ If not, write to the Free Software Foundation, Inc., 59 Temple Place,
+ Suite 330, Boston, MA 02111-1307, USA or visit their web page on the
+ internet at http://www.fsf.org/licenses/lgpl.html.
+
+ The GNU General Public License to which the GNU Lesser General Public
+ License refers can be found at http://www.gnu.org/copyleft/gpl.html.
+ For convenient reference, a text version has been included with this
+ distribution in the file named "License_GPLv2.txt". All of the licenses
+ mentioned above can also be found at http://www.opensource.org/licenses/.
+
+--------------------------------------------------------------------------
diff --git a/Build/source/libs/graphite/license/License_CPLv05.txt b/Build/source/libs/graphite/license/License_CPLv05.txt
new file mode 100644
index 00000000000..4cac5dfe069
--- /dev/null
+++ b/Build/source/libs/graphite/license/License_CPLv05.txt
@@ -0,0 +1,86 @@
+Common Public License Version 0.5
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
diff --git a/Build/source/libs/graphite/license/License_GPLv2.txt b/Build/source/libs/graphite/license/License_GPLv2.txt
new file mode 100644
index 00000000000..1bcc46f53a6
--- /dev/null
+++ b/Build/source/libs/graphite/license/License_GPLv2.txt
@@ -0,0 +1,342 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+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 Program or any portion
+of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+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 Program, 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 Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) 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; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, 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 executable. However, as a
+special exception, the source code 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.
+
+If distribution of executable or 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 counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program 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.
+
+ 5. 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 Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program 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 to
+this License.
+
+ 7. 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 Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program 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 Program.
+
+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.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program 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.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies 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 Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, 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
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. 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 PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+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 program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
+
diff --git a/Build/source/libs/graphite/license/License_LGPLv21.txt b/Build/source/libs/graphite/license/License_LGPLv21.txt
new file mode 100644
index 00000000000..807db791666
--- /dev/null
+++ b/Build/source/libs/graphite/license/License_LGPLv21.txt
@@ -0,0 +1,506 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
+
+
diff --git a/Build/source/libs/graphite/makefile.vc b/Build/source/libs/graphite/makefile.vc
new file mode 100644
index 00000000000..2c5c5a935ef
--- /dev/null
+++ b/Build/source/libs/graphite/makefile.vc
@@ -0,0 +1,814 @@
+
+TARGET=graphite
+
+CPP=cl.exe
+CPPFLAGS=/nologo /W4 /GR /GX /I "./src/font" /I "./src/painter" /I "./src/segment" /I "./src/textsource" /I "./src/generic" /I "./include/graphite" /I "../wrappers/win32" /D "GR_NAMESPACE" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "TRACING" /Fp"$(INTDIR)\graphite.pch" /YX /Fd"$(INTDIR)\\" /FD /c
+# /Wp62
+
+LINK=link.exe
+LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /pdb:"$(OUTDIR)\\graphite.pdb" /machine:I386 /out:"$(OUTDIR)\\$(TARGET).dll" /implib:"$(OUTDIR)\\$(TARGET).lib"
+
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\\$(TARGET).bsc"
+
+AR=lib
+AR_FLAGS=/OUT:$@
+
+!IF "$(MLIB)" == "MD"
+MLIB=MD
+!ELSE
+MLIB=MT
+!ENDIF
+
+OBJEXT = .obj
+SBREXT = .sbr
+
+!IF "$(CFG)" == "DEBUG"
+CPP_DEBUG=/D "DEBUG" /Gm /GR /ZI /Od /GZ /FR"$(INTDIR)\\" /$(MLIB)d
+# CPP_DEBUG=/D "DEBUG" /Gm /GR /ZI /Od /GZ /FR"$(INTDIR)\\" /MDd
+
+OUTDIR=.\debug
+INTDIR=.\debug_temp
+LINK_DEBUG= MSVCRTD.lib /debug /incremental:yes #/pdbtype:sept
+
+all : lib lib_dll bsc
+
+!ELSE
+CPP_DEBUG=/D "NDEBUG" /O2 /$(MLIB)
+# CPP_DEBUG=/D "NDEBUG" /O2 /MD
+OUTDIR=.\release
+INTDIR=.\release_temp
+LINK_DEBUG= MSVCRT.lib /incremental:no /NODEFAULTLIB:libc
+
+all : lib lib_dll
+
+!ENDIF
+
+!IF "$(TRACING)" == "1"
+CPP_DEBUG=/D "TRACING" $(CPP_DEBUG)
+!ENDIF
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+
+clean :
+ @- rd /s/q .\release_temp
+ @- rd /s/q .\debug_temp
+
+realclean : clean
+ @- rd /s/q .\release
+ @- rd /s/q .\debug
+
+LINK_OBJS=\
+# "$(INTDIR)\BinTree_i$(OBJEXT)"\
+# "$(INTDIR)\HashMap_i$(OBJEXT)"\
+ "$(INTDIR)\Debug$(OBJEXT)"\
+ "$(INTDIR)\Util$(OBJEXT)"\
+ "$(INTDIR)\Font$(OBJEXT)"\
+ "$(INTDIR)\FileFont$(OBJEXT)"\
+ "$(INTDIR)\FontCache$(OBJEXT)"\
+ "$(INTDIR)\FontFace$(OBJEXT)"\
+ "$(INTDIR)\FileInput$(OBJEXT)"\
+ "$(INTDIR)\GrCharStream$(OBJEXT)"\
+ "$(INTDIR)\GrClassTable$(OBJEXT)"\
+ "$(INTDIR)\GrEngine$(OBJEXT)"\
+ "$(INTDIR)\GrFeature$(OBJEXT)"\
+ "$(INTDIR)\GrFSM$(OBJEXT)"\
+ "$(INTDIR)\GrGlyphTable$(OBJEXT)"\
+ "$(INTDIR)\GrPass$(OBJEXT)"\
+ "$(INTDIR)\GrPassActionCode$(OBJEXT)"\
+ "$(INTDIR)\GrSlotState$(OBJEXT)"\
+ "$(INTDIR)\GrSlotStream$(OBJEXT)"\
+ "$(INTDIR)\GrTableManager$(OBJEXT)"\
+ "$(INTDIR)\MemoryUsage$(OBJEXT)"\
+ "$(INTDIR)\Segment$(OBJEXT)"\
+ "$(INTDIR)\SegmentAux$(OBJEXT)"\
+ "$(INTDIR)\SegmentPainter$(OBJEXT)"\
+# "$(INTDIR)\TestFSM$(OBJEXT)"\
+# "$(INTDIR)\TestPasses$(OBJEXT)"\
+ "$(INTDIR)\TransductionLog$(OBJEXT)"\
+ "$(INTDIR)\XmlTransductionLog$(OBJEXT)"\
+ "$(INTDIR)\Platform$(OBJEXT)"\
+ "$(INTDIR)\TtfUtil$(OBJEXT)"\
+ "$(INTDIR)\WinFont$(OBJEXT)"\
+ "$(INTDIR)\WinSegmentPainter$(OBJEXT)"
+
+LINK_DLL_OBJS=\
+# "$(INTDIR)\BinTree_i_dll$(OBJEXT)"\
+# "$(INTDIR)\HashMap_i_dll$(OBJEXT)"\
+ "$(INTDIR)\Debug_dll$(OBJEXT)"\
+ "$(INTDIR)\Util_dll$(OBJEXT)"\
+ "$(INTDIR)\Font_dll$(OBJEXT)"\
+ "$(INTDIR)\WinFont_dll$(OBJEXT)"\
+ "$(INTDIR)\FileFont_dll$(OBJEXT)"\
+ "$(INTDIR)\FontCache_dll$(OBJEXT)"\
+ "$(INTDIR)\FontFace_dll$(OBJEXT)"\
+ "$(INTDIR)\FileInput_dll$(OBJEXT)"\
+ "$(INTDIR)\GrCharStream_dll$(OBJEXT)"\
+ "$(INTDIR)\GrClassTable_dll$(OBJEXT)"\
+ "$(INTDIR)\GrEngine_dll$(OBJEXT)"\
+ "$(INTDIR)\GrFeature_dll$(OBJEXT)"\
+ "$(INTDIR)\GrFSM_dll$(OBJEXT)"\
+ "$(INTDIR)\GrGlyphTable_dll$(OBJEXT)"\
+ "$(INTDIR)\GrPass_dll$(OBJEXT)"\
+ "$(INTDIR)\GrPassActionCode_dll$(OBJEXT)"\
+ "$(INTDIR)\GrSlotState_dll$(OBJEXT)"\
+ "$(INTDIR)\GrSlotStream_dll$(OBJEXT)"\
+ "$(INTDIR)\GrTableManager_dll$(OBJEXT)"\
+ "$(INTDIR)\MemoryUsage_dll$(OBJEXT)"\
+ "$(INTDIR)\Segment_dll$(OBJEXT)"\
+ "$(INTDIR)\SegmentAux_dll$(OBJEXT)"\
+ "$(INTDIR)\SegmentPainter_dll$(OBJEXT)"\
+# "$(INTDIR)\TestFSM_dll$(OBJEXT)"\
+# "$(INTDIR)\TestPasses_dll$(OBJEXT)"\
+ "$(INTDIR)\TransductionLog_dll$(OBJEXT)"\
+ "$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)"\
+ "$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)"\
+ "$(INTDIR)\Platform_dll$(OBJEXT)"\
+ "$(INTDIR)\TtfUtil_dll$(OBJEXT)"
+
+DLL_LINK_OBJS=\
+ "$(INTDIR)\win32_dll_dll$(OBJEXT)"
+
+BSC32_SBRS=\
+# "$(INTDIR)\BinTree_i$(SBREXT)"\
+# "$(INTDIR)\HashMap_i$(SBREXT)"\
+ "$(INTDIR)\Debug$(SBREXT)"\
+ "$(INTDIR)\Util$(SBREXT)"\
+ "$(INTDIR)\Font$(SBREXT)"\
+ "$(INTDIR)\WinFont$(SBREXT)"\
+ "$(INTDIR)\FileFont$(SBREXT)"\
+ "$(INTDIR)\FontCache$(SBREXT)"\
+ "$(INTDIR)\FontFace$(SBREXT)"\
+ "$(INTDIR)\FileInput$(SBREXT)"\
+ "$(INTDIR)\GrCharStream$(SBREXT)"\
+ "$(INTDIR)\GrClassTable$(SBREXT)"\
+ "$(INTDIR)\GrEngine$(SBREXT)"\
+ "$(INTDIR)\GrFeature$(SBREXT)"\
+ "$(INTDIR)\GrFSM$(SBREXT)"\
+ "$(INTDIR)\GrGlyphTable$(SBREXT)"\
+ "$(INTDIR)\GrPass$(SBREXT)"\
+ "$(INTDIR)\GrPassActionCode$(SBREXT)"\
+ "$(INTDIR)\GrSlotState$(SBREXT)"\
+ "$(INTDIR)\GrSlotStream$(SBREXT)"\
+ "$(INTDIR)\GrTableManager$(SBREXT)"\
+ "$(INTDIR)\MemoryUsage$(SBREXT)"\
+ "$(INTDIR)\Segment$(SBREXT)"\
+ "$(INTDIR)\SegmentAux$(SBREXT)"\
+ "$(INTDIR)\SegmentPainter$(SBREXT)"\
+# "$(INTDIR)\TestFSM$(SBREXT)"\
+# "$(INTDIR)\TestPasses$(SBREXT)"\
+ "$(INTDIR)\TransductionLog$(SBREXT)"\
+ "$(INTDIR)\XmlTransductionLog$(SBREXT)"\
+ "$(INTDIR)\WinSegmentPainter$(SBREXT)"\
+ "$(INTDIR)\Platform$(SBREXT)"\
+ "$(INTDIR)\TtfUtil$(SBREXT)"\
+ "$(INTDIR)\win32_dll$(SBREXT)"
+
+$(OUTDIR) :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+$(INTDIR) :
+ if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
+
+lib : "$(OUTDIR)/$(TARGET).lib"
+
+lib_dll : "$(OUTDIR)/$(TARGET)_dll.lib"
+
+"$(OUTDIR)/$(TARGET).lib" : "$(OUTDIR)" "$(INTDIR)" $(LINK_OBJS)
+ $(AR) @<<
+ $(AR_FLAGS) $(LINK_OBJS)
+<<
+
+"$(OUTDIR)/$(TARGET)_dll.lib" : "$(OUTDIR)" "$(INTDIR)" $(LINK_DLL_OBJS)
+ $(AR) @<<
+ $(AR_FLAGS) $(LINK_DLL_OBJS)
+<<
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\BinTree_i$(OBJEXT)" "$(INTDIR)\BinTree_i$(SBREXT)" : "src/generic/BinTree_i.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\BinTree_i$(OBJEXT)" $?
+
+"$(INTDIR)\BinTree_i_dll$(OBJEXT)" "$(INTDIR)\BinTree_i_dll$(SBREXT)" : "src/generic/BinTree_i.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\BinTree_i_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\BinTree_i$(OBJEXT)" : "src/generic/BinTree_i.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\BinTree_i$(OBJEXT)" $?
+
+"$(INTDIR)\BinTree_i_dll$(OBJEXT)" : "src/generic/BinTree_i.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /D "_DLL" /Fo"$(INTDIR)\BinTree_i_dll$(OBJEXT)" $?
+
+!ENDIF
+
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\Debug$(OBJEXT)" "$(INTDIR)\Debug$(SBREXT)" : "src/generic/Debug.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Debug$(OBJEXT)" $?
+
+"$(INTDIR)\Debug_dll$(OBJEXT)" "$(INTDIR)\Debug_dll$(SBREXT)" : "src/generic/Debug.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Debug_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\Debug$(OBJEXT)" : "src/generic/Debug.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Debug$(OBJEXT)" $?
+
+"$(INTDIR)\Debug_dll$(OBJEXT)" : "src/generic/Debug.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Debug_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\HashMap$(OBJEXT)" "$(INTDIR)\HashMap$(SBREXT)" : "src/generic/HashMap.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap$(OBJEXT)" $?
+
+"$(INTDIR)\HashMap_dll$(OBJEXT)" "$(INTDIR)\HashMap_dll$(SBREXT)" : "src/generic/HashMap.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\HashMap$(OBJEXT)" : "src/generic/HashMap.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap$(OBJEXT)" $?
+
+"$(INTDIR)\HashMap_dll$(OBJEXT)" : "src/generic/HashMap.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\HashMap_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\HashMap_i$(OBJEXT)" "$(INTDIR)\HashMap_i$(SBREXT)" : "src/generic/HashMap_i.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_i$(OBJEXT)" $?
+
+"$(INTDIR)\HashMap_i_dll$(OBJEXT)" "$(INTDIR)\HashMap_i_dll$(SBREXT)" : "src/generic/HashMap_i.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_i_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\HashMap_i$(OBJEXT)" : "src/generic/HashMap_i.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\HashMap_i$(OBJEXT)" $?
+
+"$(INTDIR)\HashMap_i_dll$(OBJEXT)" : "src/generic/HashMap_i.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\HashMap_i_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\Set_i$(OBJEXT)" "$(INTDIR)\Set_i$(SBREXT)" : "src/generic/Set_i.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Set_i$(OBJEXT)" $?
+
+"$(INTDIR)\Set_i_dll$(OBJEXT)" "$(INTDIR)\Set_i_dll$(SBREXT)" : "src/generic/Set_i.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Set_i_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\Set_i$(OBJEXT)" : "src/generic/Set_i.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Set_i$(OBJEXT)" $?
+
+"$(INTDIR)\Set_i_dll$(OBJEXT)" : "src/generic/Set_i.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Set_i_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\Util$(OBJEXT)" "$(INTDIR)\Util$(SBREXT)" : "src/generic/Util.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Util$(OBJEXT)" $?
+
+"$(INTDIR)\Util_dll$(OBJEXT)" "$(INTDIR)\Util_dll$(SBREXT)" : "src/generic/Util.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Util_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\Util$(OBJEXT)" : "src/generic/Util.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Util$(OBJEXT)" $?
+
+"$(INTDIR)\Util_dll$(OBJEXT)" : "src/generic/Util.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Util_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\UtilString$(OBJEXT)" "$(INTDIR)\UtilString$(SBREXT)" : "src/generic/UtilString.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\UtilString$(OBJEXT)" $?
+
+"$(INTDIR)\UtilString_dll$(OBJEXT)" "$(INTDIR)\UtilString_dll$(SBREXT)" : "src/generic/UtilString.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\UtilString_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\UtilString$(OBJEXT)" : "src/generic/UtilString.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\UtilString$(OBJEXT)" $?
+
+"$(INTDIR)\UtilString_dll$(OBJEXT)" : "src/generic/UtilString.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\UtilString_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\Vector_i$(OBJEXT)" "$(INTDIR)\Vector_i$(SBREXT)" : "src/generic/Vector_i.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Vector_i$(OBJEXT)" $?
+
+"$(INTDIR)\Vector_i_dll$(OBJEXT)" "$(INTDIR)\Vector_i_dll$(SBREXT)" : "src/generic/Vector_i.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Vector_i_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\Vector_i$(OBJEXT)" : "src/generic/Vector_i.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Vector_i$(OBJEXT)" $?
+
+"$(INTDIR)\Vector_i_dll$(OBJEXT)" : "src/generic/Vector_i.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Vector_i_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\Font$(OBJEXT)" "$(INTDIR)\Font$(SBREXT)" : "src/font/Font.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Font$(OBJEXT)" $?
+
+"$(INTDIR)\Font_dll$(OBJEXT)" "$(INTDIR)\Font_dll$(SBREXT)" : "src/font/Font.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Font_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\Font$(OBJEXT)" : "src/font/Font.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Font$(OBJEXT)" $?
+
+"$(INTDIR)\Font_dll$(OBJEXT)" : "src/font/Font.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Font_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\GrUtil$(OBJEXT)" "$(INTDIR)\GrUtil$(SBREXT)" : "src/font/GrUtil.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrUtil$(OBJEXT)" $?
+
+"$(INTDIR)\GrUtil_dll$(OBJEXT)" "$(INTDIR)\GrUtil_dll$(SBREXT)" : "src/font/GrUtil.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrUtil_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\GrUtil$(OBJEXT)" : "src/font/GrUtil.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrUtil$(OBJEXT)" $?
+
+"$(INTDIR)\GrUtil_dll$(OBJEXT)" : "src/font/GrUtil.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrUtil_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\TtfUtil$(OBJEXT)" "$(INTDIR)\TtfUtil$(SBREXT)" : "src/font/TtfUtil.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TtfUtil$(OBJEXT)" $?
+
+"$(INTDIR)\TtfUtil_dll$(OBJEXT)" "$(INTDIR)\TtfUtil_dll$(SBREXT)" : "src/font/TtfUtil.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TtfUtil_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\TtfUtil$(OBJEXT)" : "src/font/TtfUtil.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TtfUtil$(OBJEXT)" $?
+
+"$(INTDIR)\TtfUtil_dll$(OBJEXT)" : "src/font/TtfUtil.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TtfUtil_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\FontCache$(OBJEXT)" "$(INTDIR)\FontCache$(SBREXT)" : "src/segment/FontCache.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontCache$(OBJEXT)" $?
+
+"$(INTDIR)\FontCache_dll$(OBJEXT)" "$(INTDIR)\FontCache_dll$(SBREXT)" : "src/segment/FontCache.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FontCache_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\FontCache$(OBJEXT)" : "src/segment/FontCache.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontCache$(OBJEXT)" $?
+
+"$(INTDIR)\FontCache_dll$(OBJEXT)" : "src/segment/FontCache.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FontCache_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\FontFace$(OBJEXT)" "$(INTDIR)\FontFace$(SBREXT)" : "src/segment/FontFace.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontFace$(OBJEXT)" $?
+
+"$(INTDIR)\FontFace_dll$(OBJEXT)" "$(INTDIR)\FontFace_dll$(SBREXT)" : "src/segment/FontFace.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FontFace_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\FontFace$(OBJEXT)" : "src/segment/FontFace.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FontFace$(OBJEXT)" $?
+
+"$(INTDIR)\FontFace_dll$(OBJEXT)" : "src/segment/FontFace.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FontFace_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\FileInput$(OBJEXT)" "$(INTDIR)\FileInput$(SBREXT)" : "src/segment/FileInput.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileInput$(OBJEXT)" $?
+
+"$(INTDIR)\FileInput_dll$(OBJEXT)" "$(INTDIR)\FileInput_dll$(SBREXT)" : "src/segment/FileInput.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FileInput_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\FileInput$(OBJEXT)" : "src/segment/FileInput.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileInput$(OBJEXT)" $?
+
+"$(INTDIR)\FileInput_dll$(OBJEXT)" : "src/segment/FileInput.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FileInput_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\GrCharStream$(OBJEXT)" "$(INTDIR)\GrCharStream$(SBREXT)" : "src/segment/GrCharStream.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrCharStream$(OBJEXT)" $?
+
+"$(INTDIR)\GrCharStream_dll$(OBJEXT)" "$(INTDIR)\GrCharStream_dll$(SBREXT)" : "src/segment/GrCharStream.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrCharStream_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\GrCharStream$(OBJEXT)" : "src/segment/GrCharStream.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrCharStream$(OBJEXT)" $?
+
+"$(INTDIR)\GrCharStream_dll$(OBJEXT)" : "src/segment/GrCharStream.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrCharStream_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\GrClassTable$(OBJEXT)" "$(INTDIR)\GrClassTable$(SBREXT)" : "src/segment/GrClassTable.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrClassTable$(OBJEXT)" $?
+
+"$(INTDIR)\GrClassTable_dll$(OBJEXT)" "$(INTDIR)\GrClassTable_dll$(SBREXT)" : "src/segment/GrClassTable.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrClassTable_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\GrClassTable$(OBJEXT)" : "src/segment/GrClassTable.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrClassTable$(OBJEXT)" $?
+
+"$(INTDIR)\GrClassTable_dll$(OBJEXT)" : "src/segment/GrClassTable.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrClassTable_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\GrEngine$(OBJEXT)" "$(INTDIR)\GrEngine$(SBREXT)" : "src/segment/GrEngine.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrEngine$(OBJEXT)" $?
+
+"$(INTDIR)\GrEngine_dll$(OBJEXT)" "$(INTDIR)\GrEngine_dll$(SBREXT)" : "src/segment/GrEngine.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrEngine_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\GrEngine$(OBJEXT)" : "src/segment/GrEngine.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrEngine$(OBJEXT)" $?
+
+"$(INTDIR)\GrEngine_dll$(OBJEXT)" : "src/segment/GrEngine.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrEngine_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\GrFeature$(OBJEXT)" "$(INTDIR)\GrFeature$(SBREXT)" : "src/segment/GrFeature.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFeature$(OBJEXT)" $?
+
+"$(INTDIR)\GrFeature_dll$(OBJEXT)" "$(INTDIR)\GrFeature_dll$(SBREXT)" : "src/segment/GrFeature.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrFeature_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\GrFeature$(OBJEXT)" : "src/segment/GrFeature.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFeature$(OBJEXT)" $?
+
+"$(INTDIR)\GrFeature_dll$(OBJEXT)" : "src/segment/GrFeature.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrFeature_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\GrFSM$(OBJEXT)" "$(INTDIR)\GrFSM$(SBREXT)" : "src/segment/GrFSM.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFSM$(OBJEXT)" $?
+
+"$(INTDIR)\GrFSM_dll$(OBJEXT)" "$(INTDIR)\GrFSM_dll$(SBREXT)" : "src/segment/GrFSM.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrFSM_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\GrFSM$(OBJEXT)" : "src/segment/GrFSM.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrFSM$(OBJEXT)" $?
+
+"$(INTDIR)\GrFSM_dll$(OBJEXT)" : "src/segment/GrFSM.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrFSM_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\GrGlyphTable$(OBJEXT)" "$(INTDIR)\GrGlyphTable$(SBREXT)" : "src/segment/GrGlyphTable.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrGlyphTable$(OBJEXT)" $?
+
+"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" "$(INTDIR)\GrGlyphTable_dll$(SBREXT)" : "src/segment/GrGlyphTable.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\GrGlyphTable$(OBJEXT)" : "src/segment/GrGlyphTable.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrGlyphTable$(OBJEXT)" $?
+
+"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" : "src/segment/GrGlyphTable.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrGlyphTable_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\GrPass$(OBJEXT)" "$(INTDIR)\GrPass$(SBREXT)" : "src/segment/GrPass.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPass$(OBJEXT)" $?
+
+"$(INTDIR)\GrPass_dll$(OBJEXT)" "$(INTDIR)\GrPass_dll$(SBREXT)" : "src/segment/GrPass.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrPass_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\GrPass$(OBJEXT)" : "src/segment/GrPass.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPass$(OBJEXT)" $?
+
+"$(INTDIR)\GrPass_dll$(OBJEXT)" : "src/segment/GrPass.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrPass_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\GrPassActionCode$(OBJEXT)" "$(INTDIR)\GrPassActionCode$(SBREXT)" : "src/segment/GrPassActionCode.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPassActionCode$(OBJEXT)" $?
+
+"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" "$(INTDIR)\GrPassActionCode_dll$(SBREXT)" : "src/segment/GrPassActionCode.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\GrPassActionCode$(OBJEXT)" : "src/segment/GrPassActionCode.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrPassActionCode$(OBJEXT)" $?
+
+"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" : "src/segment/GrPassActionCode.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrPassActionCode_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\GrSlotState$(OBJEXT)" "$(INTDIR)\GrSlotState$(SBREXT)" : "src/segment/GrSlotState.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotState$(OBJEXT)" $?
+
+"$(INTDIR)\GrSlotState_dll$(OBJEXT)" "$(INTDIR)\GrSlotState_dll$(SBREXT)" : "src/segment/GrSlotState.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotState_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\GrSlotState$(OBJEXT)" : "src/segment/GrSlotState.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotState$(OBJEXT)" $?
+
+"$(INTDIR)\GrSlotState_dll$(OBJEXT)" : "src/segment/GrSlotState.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrSlotState_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\GrSlotStream$(OBJEXT)" "$(INTDIR)\GrSlotStream$(SBREXT)" : "src/segment/GrSlotStream.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotStream$(OBJEXT)" $?
+
+"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" "$(INTDIR)\GrSlotStream_dll$(SBREXT)" : "src/segment/GrSlotStream.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\GrSlotStream$(OBJEXT)" : "src/segment/GrSlotStream.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrSlotStream$(OBJEXT)" $?
+
+"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" : "src/segment/GrSlotStream.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrSlotStream_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\GrTableManager$(OBJEXT)" "$(INTDIR)\GrTableManager$(SBREXT)" : "src/segment/GrTableManager.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrTableManager$(OBJEXT)" $?
+
+"$(INTDIR)\GrTableManager_dll$(OBJEXT)" "$(INTDIR)\GrTableManager_dll$(SBREXT)" : "src/segment/GrTableManager.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\GrTableManager_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\GrTableManager$(OBJEXT)" : "src/segment/GrTableManager.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\GrTableManager$(OBJEXT)" $?
+
+"$(INTDIR)\GrTableManager_dll$(OBJEXT)" : "src/segment/GrTableManager.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\GrTableManager_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\MemoryUsage$(OBJEXT)" "$(INTDIR)\MemoryUsage$(SBREXT)" : "src/segment/MemoryUsage.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage$(OBJEXT)" $?
+
+"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" "$(INTDIR)\MemoryUsage_dll$(SBREXT)" : "src/segment/MemoryUsage.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\MemoryUsage$(OBJEXT)" : "src/segment/MemoryUsage.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\MemoryUsage$(OBJEXT)" $?
+
+"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" : "src/segment/MemoryUsage.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\MemoryUsage_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\Segment$(OBJEXT)" "$(INTDIR)\Segment$(SBREXT)" : "src/segment/Segment.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Segment$(OBJEXT)" $?
+
+"$(INTDIR)\Segment_dll$(OBJEXT)" "$(INTDIR)\Segment_dll$(SBREXT)" : "src/segment/Segment.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Segment_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\Segment$(OBJEXT)" : "src/segment/Segment.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Segment$(OBJEXT)" $?
+
+"$(INTDIR)\Segment_dll$(OBJEXT)" : "src/segment/Segment.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Segment_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\SegmentAux$(OBJEXT)" "$(INTDIR)\SegmentAux$(SBREXT)" : "src/segment/SegmentAux.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentAux$(OBJEXT)" $?
+
+"$(INTDIR)\SegmentAux_dll$(OBJEXT)" "$(INTDIR)\SegmentAux_dll$(SBREXT)" : "src/segment/SegmentAux.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentAux_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\SegmentAux$(OBJEXT)" : "src/segment/SegmentAux.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentAux$(OBJEXT)" $?
+
+"$(INTDIR)\SegmentAux_dll$(OBJEXT)" : "src/segment/SegmentAux.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\SegmentAux_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\TestFSM$(OBJEXT)" "$(INTDIR)\TestFSM$(SBREXT)" : "src/segment/TestFSM.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestFSM$(OBJEXT)" $?
+
+"$(INTDIR)\TestFSM_dll$(OBJEXT)" "$(INTDIR)\TestFSM_dll$(SBREXT)" : "src/segment/TestFSM.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TestFSM_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\TestFSM$(OBJEXT)" : "src/segment/TestFSM.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestFSM$(OBJEXT)" $?
+
+"$(INTDIR)\TestFSM_dll$(OBJEXT)" : "src/segment/TestFSM.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TestFSM_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\TestPasses$(OBJEXT)" "$(INTDIR)\TestPasses$(SBREXT)" : "src/segment/TestPasses.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestPasses$(OBJEXT)" $?
+
+"$(INTDIR)\TestPasses_dll$(OBJEXT)" "$(INTDIR)\TestPasses_dll$(SBREXT)" : "src/segment/TestPasses.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TestPasses_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\TestPasses$(OBJEXT)" : "src/segment/TestPasses.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TestPasses$(OBJEXT)" $?
+
+"$(INTDIR)\TestPasses_dll$(OBJEXT)" : "src/segment/TestPasses.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TestPasses_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\TransductionLog$(OBJEXT)" "$(INTDIR)\TransductionLog$(SBREXT)" : "src/segment/TransductionLog.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TransductionLog$(OBJEXT)" $?
+
+"$(INTDIR)\TransductionLog_dll$(OBJEXT)" "$(INTDIR)\TransductionLog_dll$(SBREXT)" : "src/segment/TransductionLog.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\TransductionLog_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\TransductionLog$(OBJEXT)" : "src/segment/TransductionLog.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\TransductionLog$(OBJEXT)" $?
+
+"$(INTDIR)\TransductionLog_dll$(OBJEXT)" : "src/segment/TransductionLog.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\TransductionLog_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\XmlTransductionLog$(OBJEXT)" "$(INTDIR)\XmlTransductionLog$(SBREXT)" : "src/segment/XmlTransductionLog.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\XmlTransductionLog$(OBJEXT)" $?
+
+"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" "$(INTDIR)\XmlTransductionLog_dll$(SBREXT)" : "src/segment/XmlTransductionLog.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\XmlTransductionLog$(OBJEXT)" : "src/segment/XmlTransductionLog.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\XmlTransductionLog$(OBJEXT)" $?
+
+"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" : "src/segment/XmlTransductionLog.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\XmlTransductionLog_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\Platform$(OBJEXT)" "$(INTDIR)\Platform$(SBREXT)" : "src/segment/Platform.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Platform$(OBJEXT)" $?
+
+"$(INTDIR)\Platform_dll$(OBJEXT)" "$(INTDIR)\Platform_dll$(SBREXT)" : "src/segment/Platform.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\Platform_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\Platform$(OBJEXT)" : "src/segment/Platform.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\Platform$(OBJEXT)" $?
+
+"$(INTDIR)\Platform_dll$(OBJEXT)" : "src/segment/Platform.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\Platform_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\SegmentPainter$(OBJEXT)" "$(INTDIR)\SegmentPainter$(SBREXT)" : "src/painter/SegmentPainter.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentPainter$(OBJEXT)" $?
+
+"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" "$(INTDIR)\SegmentPainter_dll$(SBREXT)" : "src/painter/SegmentPainter.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\SegmentPainter$(OBJEXT)" : "src/painter/SegmentPainter.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\SegmentPainter$(OBJEXT)" $?
+
+"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" : "src/painter/SegmentPainter.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\SegmentPainter_dll$(OBJEXT)" $?
+
+!ENDIF
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\WinSegmentPainter$(OBJEXT)" "$(INTDIR)\WinSegmentPainter$(SBREXT)" : "..\wrappers\win32\WinSegmentPainter.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinSegmentPainter$(OBJEXT)" $?
+
+"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" "$(INTDIR)\WinSegmentPainter_dll$(SBREXT)" : "..\wrappers\win32\WinSegmentPainter.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\WinSegmentPainter$(OBJEXT)" : "..\wrappers\win32\WinSegmentPainter.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinSegmentPainter$(OBJEXT)" $?
+
+"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" : "..\wrappers\win32\WinSegmentPainter.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\WinSegmentPainter_dll$(OBJEXT)" $?
+
+!ENDIF
+
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\WinFont$(OBJEXT)" "$(INTDIR)\WinFont$(SBREXT)" : "../wrappers/win32/WinFont.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinFont$(OBJEXT)" $?
+
+"$(INTDIR)\WinFont_dll$(OBJEXT)" "$(INTDIR)\WinFont_dll$(SBREXT)" : "../wrappers/win32/WinFont.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\WinFont_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\WinFont$(OBJEXT)" : "../wrappers/win32/WinFont.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\WinFont$(OBJEXT)" $?
+
+"$(INTDIR)\WinFont_dll$(OBJEXT)" : "../wrappers/win32/WinFont.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\WinFont_dll$(OBJEXT)" $?
+
+!ENDIF
+
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\FileFont$(OBJEXT)" "$(INTDIR)\FileFont$(SBREXT)" : "src/font/FileFont.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont$(OBJEXT)" $?
+
+"$(INTDIR)\FileFont_dll$(OBJEXT)" "$(INTDIR)\FileFont_dll$(SBREXT)" : "src/font/FileFont.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\FileFont$(OBJEXT)" : "src/font/FileFont.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\FileFont$(OBJEXT)" $?
+
+"$(INTDIR)\FileFont_dll$(OBJEXT)" : "src/font/FileFont.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\FileFont_dll$(OBJEXT)" $?
+
+!ENDIF
+
+
+!IF "$(CFG)" == "DEBUG"
+"$(INTDIR)\..\wrappers\win32\win32_dll$(OBJEXT)" "$(INTDIR)\win32_dll$(SBREXT)" : "..\wrappers\win32\win32_dll.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\win32_dll$(OBJEXT)" $?
+
+"$(INTDIR)\win32_dll_dll$(OBJEXT)" "$(INTDIR)\win32_dll_dll$(SBREXT)" : "..\wrappers\win32\win32_dll.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" $(CPP_DEBUG) /Fo"$(INTDIR)\win32_dll_dll$(OBJEXT)" $?
+
+!ELSE
+"$(INTDIR)\win32_dll$(OBJEXT)" : "..\wrappers\win32\win32_dll.cpp"
+ @- $(CPP) $(CPPFLAGS) $(CPP_DEBUG) /Fo"$(INTDIR)\win32_dll$(OBJEXT)" $?
+
+"$(INTDIR)\win32_dll_dll$(OBJEXT)" : "..\wrappers\win32\win32_dll.cpp"
+ @- $(CPP) $(CPPFLAGS) /D "_DLL" /Fo"$(INTDIR)\win32_dll_dll$(OBJEXT)" $?
+
+!ENDIF
+
+bsc : "$(OUTDIR)/$(TARGET).bsc"
+
+"$(OUTDIR)/$(TARGET).bsc" : "$(OUTDIR)" $(BSC32_SBRS)
+ $(BSC32) @<<
+ $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+dll : $(OUTDIR)/$(TARGET).dll
+
+"$(OUTDIR)/$(TARGET).dll" : "$(OUTDIR)" $(DEF_FILE) lib_dll $(DLL_LINK_OBJS)
+ $(LINK) $(LINK_FLAGS) $(LINK_DEBUG) $(OUTDIR)/$(TARGET)_dll.lib $(DLL_LINK_OBJS)
+
diff --git a/Build/source/libs/graphite/silgraphite.pc.in b/Build/source/libs/graphite/silgraphite.pc.in
new file mode 100644
index 00000000000..6a57ab7838b
--- /dev/null
+++ b/Build/source/libs/graphite/silgraphite.pc.in
@@ -0,0 +1,7 @@
+
+Name: SILGraphite
+Description: Script rendering engine
+Version: ${version}
+Libs: -L${libdir} -lgraphite
+Cflags: -I${includedir}
+
diff --git a/Build/source/libs/graphite/src/Makefile.am b/Build/source/libs/graphite/src/Makefile.am
new file mode 100644
index 00000000000..7d55c002a23
--- /dev/null
+++ b/Build/source/libs/graphite/src/Makefile.am
@@ -0,0 +1,22 @@
+AUTOMAKE_OPTIONS = 1.6
+
+AM_CPPFLAGS = -I$(top_srcdir)/include/graphite -I$(top_srcdir)/src/generic
+AM_CPPFLAGS += -I$(top_srcdir)/src/font -I$(top_srcdir)/src/segment
+#AM_CPPFLAGS += $(FT_CFLAGS) $(XFT_CFLAGS)
+#AM_CPPFLAGS += -D_UNICODE -DUNICODE -DNO_ASM
+
+lib_LTLIBRARIES = libgraphite.la
+
+libgraphite_la_LDFLAGS = -version-info 3:0:0
+
+#EXTRA_DIST=textsource
+EXTRA_DIST=
+graphiteinclude_HEADERS =
+graphiteincludedir = $(includedir)/graphite
+include ../include/Makefile.am
+
+libgraphite_la_SOURCES =
+include generic/Makefile.am
+include font/Makefile.am
+include segment/Makefile.am
+include painter/Makefile.am
diff --git a/Build/source/libs/graphite/src/Makefile.in b/Build/source/libs/graphite/src/Makefile.in
new file mode 100644
index 00000000000..e84ac5e7e29
--- /dev/null
+++ b/Build/source/libs/graphite/src/Makefile.in
@@ -0,0 +1,767 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(graphiteinclude_HEADERS) \
+ $(srcdir)/../include/Makefile.am $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/font/Makefile.am \
+ $(srcdir)/generic/Makefile.am $(srcdir)/painter/Makefile.am \
+ $(srcdir)/segment/Makefile.am
+subdir = src
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" \
+ "$(DESTDIR)$(graphiteincludedir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libgraphite_la_LIBADD =
+am_libgraphite_la_OBJECTS = Debug.lo Util.lo Font.lo TtfUtil.lo \
+ FileFont.lo FileInput.lo FontCache.lo FontFace.lo \
+ GrCharStream.lo GrClassTable.lo GrEngine.lo GrFeature.lo \
+ GrFSM.lo GrGlyphTable.lo GrPassActionCode.lo GrPass.lo \
+ GrSlotState.lo GrSlotStream.lo GrTableManager.lo \
+ MemoryUsage.lo Platform.lo SegmentAux.lo Segment.lo TestFSM.lo \
+ TestPasses.lo TransductionLog.lo SegmentPainter.lo
+libgraphite_la_OBJECTS = $(am_libgraphite_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgraphite_la_SOURCES)
+DIST_SOURCES = $(libgraphite_la_SOURCES)
+graphiteincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(graphiteinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LSB_RELEASE = @LSB_RELEASE@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+REL_CODENAME = @REL_CODENAME@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SIZEOF_WCHAR_T = @SIZEOF_WCHAR_T@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AUTOMAKE_OPTIONS = 1.6
+AM_CPPFLAGS = -I$(top_srcdir)/include/graphite \
+ -I$(top_srcdir)/src/generic -I$(top_srcdir)/src/font \
+ -I$(top_srcdir)/src/segment
+#AM_CPPFLAGS += $(FT_CFLAGS) $(XFT_CFLAGS)
+#AM_CPPFLAGS += -D_UNICODE -DUNICODE -DNO_ASM
+lib_LTLIBRARIES = libgraphite.la
+libgraphite_la_LDFLAGS = -version-info 3:0:0
+
+#EXTRA_DIST=textsource
+EXTRA_DIST = $(top_srcdir)/include/graphite/BinTree.h \
+ $(top_srcdir)/include/graphite/GenericResource.h \
+ $(top_srcdir)/include/graphite/HashMap.h $(genericdir)/*.h \
+ $(genericdir)/BinTree_i.cpp $(genericdir)/HashMap_i.cpp \
+ $(fontdir)/*.h $(segmentdir)/*.h
+graphiteinclude_HEADERS = $(top_srcdir)/include/graphite/FileFont.h \
+ $(top_srcdir)/include/graphite/Font.h \
+ $(top_srcdir)/include/graphite/GraphiteProcess.h \
+ $(top_srcdir)/include/graphite/GrAppData.h \
+ $(top_srcdir)/include/graphite/GrClient.h \
+ $(top_srcdir)/include/graphite/GrCommon.h \
+ $(top_srcdir)/include/graphite/GrConstants.h \
+ $(top_srcdir)/include/graphite/GrData.h \
+ $(top_srcdir)/include/graphite/GrDebug.h \
+ $(top_srcdir)/include/graphite/GrExt.h \
+ $(top_srcdir)/include/graphite/GrFeature.h \
+ $(top_srcdir)/include/graphite/GrMstypes.h \
+ $(top_srcdir)/include/graphite/GrPlatform.h \
+ $(top_srcdir)/include/graphite/GrResult.h \
+ $(top_srcdir)/include/graphite/GrStructs.h \
+ $(top_srcdir)/include/graphite/GrWrappers.h \
+ $(top_srcdir)/include/graphite/IGraphiteProcess.h \
+ $(top_srcdir)/include/graphite/IGrEngine.h \
+ $(top_srcdir)/include/graphite/IGrJustifier.h \
+ $(top_srcdir)/include/graphite/ITextSource.h \
+ $(top_srcdir)/include/graphite/MemoryUsage.h \
+ $(top_srcdir)/include/graphite/SegmentAux.h \
+ $(top_srcdir)/include/graphite/Segment.h \
+ $(top_srcdir)/include/graphite/SegmentPainter.h
+graphiteincludedir = $(includedir)/graphite
+libgraphite_la_SOURCES = $(genericdir)/Debug.cpp \
+ $(genericdir)/Util.cpp $(fontdir)/Font.cpp \
+ $(fontdir)/TtfUtil.cpp $(fontdir)/FileFont.cpp \
+ $(segmentdir)/FileInput.cpp $(segmentdir)/FontCache.cpp \
+ $(segmentdir)/FontFace.cpp $(segmentdir)/GrCharStream.cpp \
+ $(segmentdir)/GrClassTable.cpp $(segmentdir)/GrEngine.cpp \
+ $(segmentdir)/GrFeature.cpp $(segmentdir)/GrFSM.cpp \
+ $(segmentdir)/GrGlyphTable.cpp \
+ $(segmentdir)/GrPassActionCode.cpp $(segmentdir)/GrPass.cpp \
+ $(segmentdir)/GrSlotState.cpp $(segmentdir)/GrSlotStream.cpp \
+ $(segmentdir)/GrTableManager.cpp $(segmentdir)/MemoryUsage.cpp \
+ $(segmentdir)/Platform.cpp $(segmentdir)/SegmentAux.cpp \
+ $(segmentdir)/Segment.cpp $(segmentdir)/TestFSM.cpp \
+ $(segmentdir)/TestPasses.cpp $(segmentdir)/TransductionLog.cpp \
+ $(painterdir)/SegmentPainter.cpp
+genericdir = $(top_srcdir)/src/generic
+fontdir = $(top_srcdir)/src/font
+segmentdir = $(top_srcdir)/src/segment
+painterdir = $(top_srcdir)/src/painter
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../include/Makefile.am $(srcdir)/generic/Makefile.am $(srcdir)/font/Makefile.am $(srcdir)/segment/Makefile.am $(srcdir)/painter/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libgraphite.la: $(libgraphite_la_OBJECTS) $(libgraphite_la_DEPENDENCIES)
+ $(CXXLINK) -rpath $(libdir) $(libgraphite_la_LDFLAGS) $(libgraphite_la_OBJECTS) $(libgraphite_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Debug.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileFont.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileInput.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Font.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FontCache.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FontFace.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrCharStream.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrClassTable.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrEngine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrFSM.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrFeature.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrGlyphTable.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrPass.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrPassActionCode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrSlotState.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrSlotStream.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrTableManager.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MemoryUsage.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Platform.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Segment.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SegmentAux.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SegmentPainter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestFSM.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestPasses.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TransductionLog.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TtfUtil.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Util.Plo@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+Debug.lo: $(genericdir)/Debug.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Debug.lo -MD -MP -MF "$(DEPDIR)/Debug.Tpo" -c -o Debug.lo `test -f '$(genericdir)/Debug.cpp' || echo '$(srcdir)/'`$(genericdir)/Debug.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Debug.Tpo" "$(DEPDIR)/Debug.Plo"; else rm -f "$(DEPDIR)/Debug.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(genericdir)/Debug.cpp' object='Debug.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Debug.lo `test -f '$(genericdir)/Debug.cpp' || echo '$(srcdir)/'`$(genericdir)/Debug.cpp
+
+Util.lo: $(genericdir)/Util.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Util.lo -MD -MP -MF "$(DEPDIR)/Util.Tpo" -c -o Util.lo `test -f '$(genericdir)/Util.cpp' || echo '$(srcdir)/'`$(genericdir)/Util.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Util.Tpo" "$(DEPDIR)/Util.Plo"; else rm -f "$(DEPDIR)/Util.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(genericdir)/Util.cpp' object='Util.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Util.lo `test -f '$(genericdir)/Util.cpp' || echo '$(srcdir)/'`$(genericdir)/Util.cpp
+
+Font.lo: $(fontdir)/Font.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Font.lo -MD -MP -MF "$(DEPDIR)/Font.Tpo" -c -o Font.lo `test -f '$(fontdir)/Font.cpp' || echo '$(srcdir)/'`$(fontdir)/Font.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Font.Tpo" "$(DEPDIR)/Font.Plo"; else rm -f "$(DEPDIR)/Font.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(fontdir)/Font.cpp' object='Font.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Font.lo `test -f '$(fontdir)/Font.cpp' || echo '$(srcdir)/'`$(fontdir)/Font.cpp
+
+TtfUtil.lo: $(fontdir)/TtfUtil.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TtfUtil.lo -MD -MP -MF "$(DEPDIR)/TtfUtil.Tpo" -c -o TtfUtil.lo `test -f '$(fontdir)/TtfUtil.cpp' || echo '$(srcdir)/'`$(fontdir)/TtfUtil.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/TtfUtil.Tpo" "$(DEPDIR)/TtfUtil.Plo"; else rm -f "$(DEPDIR)/TtfUtil.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(fontdir)/TtfUtil.cpp' object='TtfUtil.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o TtfUtil.lo `test -f '$(fontdir)/TtfUtil.cpp' || echo '$(srcdir)/'`$(fontdir)/TtfUtil.cpp
+
+FileFont.lo: $(fontdir)/FileFont.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT FileFont.lo -MD -MP -MF "$(DEPDIR)/FileFont.Tpo" -c -o FileFont.lo `test -f '$(fontdir)/FileFont.cpp' || echo '$(srcdir)/'`$(fontdir)/FileFont.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/FileFont.Tpo" "$(DEPDIR)/FileFont.Plo"; else rm -f "$(DEPDIR)/FileFont.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(fontdir)/FileFont.cpp' object='FileFont.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FileFont.lo `test -f '$(fontdir)/FileFont.cpp' || echo '$(srcdir)/'`$(fontdir)/FileFont.cpp
+
+FileInput.lo: $(segmentdir)/FileInput.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT FileInput.lo -MD -MP -MF "$(DEPDIR)/FileInput.Tpo" -c -o FileInput.lo `test -f '$(segmentdir)/FileInput.cpp' || echo '$(srcdir)/'`$(segmentdir)/FileInput.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/FileInput.Tpo" "$(DEPDIR)/FileInput.Plo"; else rm -f "$(DEPDIR)/FileInput.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/FileInput.cpp' object='FileInput.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FileInput.lo `test -f '$(segmentdir)/FileInput.cpp' || echo '$(srcdir)/'`$(segmentdir)/FileInput.cpp
+
+FontCache.lo: $(segmentdir)/FontCache.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT FontCache.lo -MD -MP -MF "$(DEPDIR)/FontCache.Tpo" -c -o FontCache.lo `test -f '$(segmentdir)/FontCache.cpp' || echo '$(srcdir)/'`$(segmentdir)/FontCache.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/FontCache.Tpo" "$(DEPDIR)/FontCache.Plo"; else rm -f "$(DEPDIR)/FontCache.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/FontCache.cpp' object='FontCache.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FontCache.lo `test -f '$(segmentdir)/FontCache.cpp' || echo '$(srcdir)/'`$(segmentdir)/FontCache.cpp
+
+FontFace.lo: $(segmentdir)/FontFace.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT FontFace.lo -MD -MP -MF "$(DEPDIR)/FontFace.Tpo" -c -o FontFace.lo `test -f '$(segmentdir)/FontFace.cpp' || echo '$(srcdir)/'`$(segmentdir)/FontFace.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/FontFace.Tpo" "$(DEPDIR)/FontFace.Plo"; else rm -f "$(DEPDIR)/FontFace.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/FontFace.cpp' object='FontFace.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FontFace.lo `test -f '$(segmentdir)/FontFace.cpp' || echo '$(srcdir)/'`$(segmentdir)/FontFace.cpp
+
+GrCharStream.lo: $(segmentdir)/GrCharStream.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrCharStream.lo -MD -MP -MF "$(DEPDIR)/GrCharStream.Tpo" -c -o GrCharStream.lo `test -f '$(segmentdir)/GrCharStream.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrCharStream.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/GrCharStream.Tpo" "$(DEPDIR)/GrCharStream.Plo"; else rm -f "$(DEPDIR)/GrCharStream.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrCharStream.cpp' object='GrCharStream.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrCharStream.lo `test -f '$(segmentdir)/GrCharStream.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrCharStream.cpp
+
+GrClassTable.lo: $(segmentdir)/GrClassTable.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrClassTable.lo -MD -MP -MF "$(DEPDIR)/GrClassTable.Tpo" -c -o GrClassTable.lo `test -f '$(segmentdir)/GrClassTable.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrClassTable.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/GrClassTable.Tpo" "$(DEPDIR)/GrClassTable.Plo"; else rm -f "$(DEPDIR)/GrClassTable.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrClassTable.cpp' object='GrClassTable.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrClassTable.lo `test -f '$(segmentdir)/GrClassTable.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrClassTable.cpp
+
+GrEngine.lo: $(segmentdir)/GrEngine.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrEngine.lo -MD -MP -MF "$(DEPDIR)/GrEngine.Tpo" -c -o GrEngine.lo `test -f '$(segmentdir)/GrEngine.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrEngine.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/GrEngine.Tpo" "$(DEPDIR)/GrEngine.Plo"; else rm -f "$(DEPDIR)/GrEngine.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrEngine.cpp' object='GrEngine.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrEngine.lo `test -f '$(segmentdir)/GrEngine.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrEngine.cpp
+
+GrFeature.lo: $(segmentdir)/GrFeature.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrFeature.lo -MD -MP -MF "$(DEPDIR)/GrFeature.Tpo" -c -o GrFeature.lo `test -f '$(segmentdir)/GrFeature.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrFeature.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/GrFeature.Tpo" "$(DEPDIR)/GrFeature.Plo"; else rm -f "$(DEPDIR)/GrFeature.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrFeature.cpp' object='GrFeature.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrFeature.lo `test -f '$(segmentdir)/GrFeature.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrFeature.cpp
+
+GrFSM.lo: $(segmentdir)/GrFSM.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrFSM.lo -MD -MP -MF "$(DEPDIR)/GrFSM.Tpo" -c -o GrFSM.lo `test -f '$(segmentdir)/GrFSM.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrFSM.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/GrFSM.Tpo" "$(DEPDIR)/GrFSM.Plo"; else rm -f "$(DEPDIR)/GrFSM.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrFSM.cpp' object='GrFSM.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrFSM.lo `test -f '$(segmentdir)/GrFSM.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrFSM.cpp
+
+GrGlyphTable.lo: $(segmentdir)/GrGlyphTable.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrGlyphTable.lo -MD -MP -MF "$(DEPDIR)/GrGlyphTable.Tpo" -c -o GrGlyphTable.lo `test -f '$(segmentdir)/GrGlyphTable.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrGlyphTable.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/GrGlyphTable.Tpo" "$(DEPDIR)/GrGlyphTable.Plo"; else rm -f "$(DEPDIR)/GrGlyphTable.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrGlyphTable.cpp' object='GrGlyphTable.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrGlyphTable.lo `test -f '$(segmentdir)/GrGlyphTable.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrGlyphTable.cpp
+
+GrPassActionCode.lo: $(segmentdir)/GrPassActionCode.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrPassActionCode.lo -MD -MP -MF "$(DEPDIR)/GrPassActionCode.Tpo" -c -o GrPassActionCode.lo `test -f '$(segmentdir)/GrPassActionCode.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrPassActionCode.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/GrPassActionCode.Tpo" "$(DEPDIR)/GrPassActionCode.Plo"; else rm -f "$(DEPDIR)/GrPassActionCode.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrPassActionCode.cpp' object='GrPassActionCode.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrPassActionCode.lo `test -f '$(segmentdir)/GrPassActionCode.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrPassActionCode.cpp
+
+GrPass.lo: $(segmentdir)/GrPass.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrPass.lo -MD -MP -MF "$(DEPDIR)/GrPass.Tpo" -c -o GrPass.lo `test -f '$(segmentdir)/GrPass.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrPass.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/GrPass.Tpo" "$(DEPDIR)/GrPass.Plo"; else rm -f "$(DEPDIR)/GrPass.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrPass.cpp' object='GrPass.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrPass.lo `test -f '$(segmentdir)/GrPass.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrPass.cpp
+
+GrSlotState.lo: $(segmentdir)/GrSlotState.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrSlotState.lo -MD -MP -MF "$(DEPDIR)/GrSlotState.Tpo" -c -o GrSlotState.lo `test -f '$(segmentdir)/GrSlotState.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrSlotState.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/GrSlotState.Tpo" "$(DEPDIR)/GrSlotState.Plo"; else rm -f "$(DEPDIR)/GrSlotState.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrSlotState.cpp' object='GrSlotState.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrSlotState.lo `test -f '$(segmentdir)/GrSlotState.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrSlotState.cpp
+
+GrSlotStream.lo: $(segmentdir)/GrSlotStream.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrSlotStream.lo -MD -MP -MF "$(DEPDIR)/GrSlotStream.Tpo" -c -o GrSlotStream.lo `test -f '$(segmentdir)/GrSlotStream.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrSlotStream.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/GrSlotStream.Tpo" "$(DEPDIR)/GrSlotStream.Plo"; else rm -f "$(DEPDIR)/GrSlotStream.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrSlotStream.cpp' object='GrSlotStream.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrSlotStream.lo `test -f '$(segmentdir)/GrSlotStream.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrSlotStream.cpp
+
+GrTableManager.lo: $(segmentdir)/GrTableManager.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT GrTableManager.lo -MD -MP -MF "$(DEPDIR)/GrTableManager.Tpo" -c -o GrTableManager.lo `test -f '$(segmentdir)/GrTableManager.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrTableManager.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/GrTableManager.Tpo" "$(DEPDIR)/GrTableManager.Plo"; else rm -f "$(DEPDIR)/GrTableManager.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/GrTableManager.cpp' object='GrTableManager.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o GrTableManager.lo `test -f '$(segmentdir)/GrTableManager.cpp' || echo '$(srcdir)/'`$(segmentdir)/GrTableManager.cpp
+
+MemoryUsage.lo: $(segmentdir)/MemoryUsage.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MemoryUsage.lo -MD -MP -MF "$(DEPDIR)/MemoryUsage.Tpo" -c -o MemoryUsage.lo `test -f '$(segmentdir)/MemoryUsage.cpp' || echo '$(srcdir)/'`$(segmentdir)/MemoryUsage.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/MemoryUsage.Tpo" "$(DEPDIR)/MemoryUsage.Plo"; else rm -f "$(DEPDIR)/MemoryUsage.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/MemoryUsage.cpp' object='MemoryUsage.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MemoryUsage.lo `test -f '$(segmentdir)/MemoryUsage.cpp' || echo '$(srcdir)/'`$(segmentdir)/MemoryUsage.cpp
+
+Platform.lo: $(segmentdir)/Platform.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Platform.lo -MD -MP -MF "$(DEPDIR)/Platform.Tpo" -c -o Platform.lo `test -f '$(segmentdir)/Platform.cpp' || echo '$(srcdir)/'`$(segmentdir)/Platform.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Platform.Tpo" "$(DEPDIR)/Platform.Plo"; else rm -f "$(DEPDIR)/Platform.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/Platform.cpp' object='Platform.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Platform.lo `test -f '$(segmentdir)/Platform.cpp' || echo '$(srcdir)/'`$(segmentdir)/Platform.cpp
+
+SegmentAux.lo: $(segmentdir)/SegmentAux.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT SegmentAux.lo -MD -MP -MF "$(DEPDIR)/SegmentAux.Tpo" -c -o SegmentAux.lo `test -f '$(segmentdir)/SegmentAux.cpp' || echo '$(srcdir)/'`$(segmentdir)/SegmentAux.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/SegmentAux.Tpo" "$(DEPDIR)/SegmentAux.Plo"; else rm -f "$(DEPDIR)/SegmentAux.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/SegmentAux.cpp' object='SegmentAux.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o SegmentAux.lo `test -f '$(segmentdir)/SegmentAux.cpp' || echo '$(srcdir)/'`$(segmentdir)/SegmentAux.cpp
+
+Segment.lo: $(segmentdir)/Segment.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Segment.lo -MD -MP -MF "$(DEPDIR)/Segment.Tpo" -c -o Segment.lo `test -f '$(segmentdir)/Segment.cpp' || echo '$(srcdir)/'`$(segmentdir)/Segment.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Segment.Tpo" "$(DEPDIR)/Segment.Plo"; else rm -f "$(DEPDIR)/Segment.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/Segment.cpp' object='Segment.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Segment.lo `test -f '$(segmentdir)/Segment.cpp' || echo '$(srcdir)/'`$(segmentdir)/Segment.cpp
+
+TestFSM.lo: $(segmentdir)/TestFSM.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TestFSM.lo -MD -MP -MF "$(DEPDIR)/TestFSM.Tpo" -c -o TestFSM.lo `test -f '$(segmentdir)/TestFSM.cpp' || echo '$(srcdir)/'`$(segmentdir)/TestFSM.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/TestFSM.Tpo" "$(DEPDIR)/TestFSM.Plo"; else rm -f "$(DEPDIR)/TestFSM.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/TestFSM.cpp' object='TestFSM.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o TestFSM.lo `test -f '$(segmentdir)/TestFSM.cpp' || echo '$(srcdir)/'`$(segmentdir)/TestFSM.cpp
+
+TestPasses.lo: $(segmentdir)/TestPasses.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TestPasses.lo -MD -MP -MF "$(DEPDIR)/TestPasses.Tpo" -c -o TestPasses.lo `test -f '$(segmentdir)/TestPasses.cpp' || echo '$(srcdir)/'`$(segmentdir)/TestPasses.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/TestPasses.Tpo" "$(DEPDIR)/TestPasses.Plo"; else rm -f "$(DEPDIR)/TestPasses.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/TestPasses.cpp' object='TestPasses.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o TestPasses.lo `test -f '$(segmentdir)/TestPasses.cpp' || echo '$(srcdir)/'`$(segmentdir)/TestPasses.cpp
+
+TransductionLog.lo: $(segmentdir)/TransductionLog.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TransductionLog.lo -MD -MP -MF "$(DEPDIR)/TransductionLog.Tpo" -c -o TransductionLog.lo `test -f '$(segmentdir)/TransductionLog.cpp' || echo '$(srcdir)/'`$(segmentdir)/TransductionLog.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/TransductionLog.Tpo" "$(DEPDIR)/TransductionLog.Plo"; else rm -f "$(DEPDIR)/TransductionLog.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(segmentdir)/TransductionLog.cpp' object='TransductionLog.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o TransductionLog.lo `test -f '$(segmentdir)/TransductionLog.cpp' || echo '$(srcdir)/'`$(segmentdir)/TransductionLog.cpp
+
+SegmentPainter.lo: $(painterdir)/SegmentPainter.cpp
+@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT SegmentPainter.lo -MD -MP -MF "$(DEPDIR)/SegmentPainter.Tpo" -c -o SegmentPainter.lo `test -f '$(painterdir)/SegmentPainter.cpp' || echo '$(srcdir)/'`$(painterdir)/SegmentPainter.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/SegmentPainter.Tpo" "$(DEPDIR)/SegmentPainter.Plo"; else rm -f "$(DEPDIR)/SegmentPainter.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(painterdir)/SegmentPainter.cpp' object='SegmentPainter.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o SegmentPainter.lo `test -f '$(painterdir)/SegmentPainter.cpp' || echo '$(srcdir)/'`$(painterdir)/SegmentPainter.cpp
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+install-graphiteincludeHEADERS: $(graphiteinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(graphiteincludedir)" || $(mkdir_p) "$(DESTDIR)$(graphiteincludedir)"
+ @list='$(graphiteinclude_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(graphiteincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(graphiteincludedir)/$$f'"; \
+ $(graphiteincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(graphiteincludedir)/$$f"; \
+ done
+
+uninstall-graphiteincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(graphiteinclude_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(graphiteincludedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(graphiteincludedir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ $(mkdir_p) $(distdir)/$(fontdir) $(distdir)/$(genericdir) $(distdir)/$(segmentdir) $(distdir)/$(top_srcdir)/include/graphite $(distdir)/../include $(distdir)/../include/graphite $(distdir)/font $(distdir)/generic $(distdir)/painter $(distdir)/segment
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(graphiteincludedir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-graphiteincludeHEADERS
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-graphiteincludeHEADERS uninstall-info-am \
+ uninstall-libLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-graphiteincludeHEADERS install-info \
+ install-info-am install-libLTLIBRARIES install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-graphiteincludeHEADERS uninstall-info-am \
+ uninstall-libLTLIBRARIES
+
+
+#EXTRA_DIST += $(painterdir)/*.h
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Build/source/libs/graphite/src/font/FileFont.cpp b/Build/source/libs/graphite/src/font/FileFont.cpp
new file mode 100644
index 00000000000..4600b788ed2
--- /dev/null
+++ b/Build/source/libs/graphite/src/font/FileFont.cpp
@@ -0,0 +1,429 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999 - 2008 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: FileFont.cpp
+Responsibility: Keith Stribley
+Last reviewed: Not yet.
+
+Description:
+ A Font is an object that represents a font-family + bold + italic setting, that contains
+ Graphite tables.
+----------------------------------------------------------------------------------------------*/
+
+#include "Main.h"
+
+#include "FontTableCache.h"
+#include "FileFont.h"
+#include <stdio.h>
+
+
+// TBD do this properly
+#define FUDGE_FACTOR 72
+#define fix26_6(x) (x >> 6) + (x & 32 ? (x > 0 ? 1 : 0) : (x < 0 ? -1 : 0))
+
+namespace gr
+{
+
+
+FileFont::FileFont()
+ : Font(),
+ m_pfile(NULL),
+ m_pTableCache(NULL),
+ m_mAscent(0),
+ m_mDescent(0),
+ m_mEmSquare(0),
+ m_pointSize(0),
+ m_dpiX(FUDGE_FACTOR),
+ m_dpiY(FUDGE_FACTOR),
+ m_fIsValid(false),
+ m_pHeader(NULL),
+ m_pTableDir(NULL),
+ m_xScale(1.0f),
+ m_yScale(1.0f)
+{
+ m_fItalic = false;
+ m_fBold = false;
+ // colors are not used
+ m_clrFore = (unsigned long)kclrBlack;
+ m_clrBack = (unsigned long)kclrTransparent;
+}
+
+FileFont::FileFont(FILE * pfile, float pointSize,
+ unsigned int dpiX, unsigned int dpiY)
+ : Font(),
+ m_pfile(pfile),
+ m_pTableCache(NULL),
+ m_mAscent(0),
+ m_mDescent(0),
+ m_mEmSquare(0),
+ m_pointSize(pointSize),
+ m_dpiX(dpiX),
+ m_dpiY(dpiY),
+ m_fIsValid(false),
+ m_pHeader(NULL),
+ m_pTableDir(NULL),
+ m_xScale(1.0f),
+ m_yScale(1.0f)
+{
+ Assert(m_pfile); // shouldn't be null
+ initializeFromFace();
+
+}
+
+FileFont::FileFont(char * fileName, float pointSize,
+ unsigned int dpiX, unsigned int dpiY)
+ : Font(),
+ m_pfile(NULL),
+ m_pTableCache(NULL),
+ m_mAscent(0),
+ m_mDescent(0),
+ m_mEmSquare(0),
+ m_pointSize(pointSize),
+ m_dpiX(dpiX),
+ m_dpiY(dpiY),
+ m_fIsValid(false),
+ m_pHeader(NULL),
+ m_pTableDir(NULL),
+ m_xScale(1.0f),
+ m_yScale(1.0f)
+{
+ Assert(fileName); // shouldn't be null but we play safe anyway
+ m_pfile = fopen(fileName, "rb");
+
+ initializeFromFace();
+}
+
+FileFont::FileFont(std::string fileName, float pointSize,
+ unsigned int dpiX, unsigned int dpiY)
+ : Font(),
+ m_pfile(NULL),
+ m_pTableCache(NULL),
+ m_mAscent(0),
+ m_mDescent(0),
+ m_mEmSquare(0),
+ m_pointSize(pointSize),
+ m_dpiX(dpiX),
+ m_dpiY(dpiY),
+ m_fIsValid(false),
+ m_pHeader(NULL),
+ m_pTableDir(NULL),
+ m_xScale(1.0f),
+ m_yScale(1.0f)
+{
+ Assert(fileName.length()); // shouldn't be null but we play safe anyway
+ m_pfile = fopen(fileName.c_str(), "rb");
+
+ initializeFromFace();
+}
+
+
+void
+FileFont::initializeFromFace()
+{
+ if (m_dpiY == 0) m_dpiY = m_dpiX;
+ m_fItalic = false;
+ m_fBold = false;
+ // colors are not used
+ m_clrFore = (unsigned long)kclrBlack;
+ m_clrBack = (unsigned long)kclrTransparent;
+
+ if (m_pfile)
+ {
+ size_t lOffset, lSize;
+ TtfUtil::GetHeaderInfo(lOffset, lSize);
+ m_pHeader = new byte [lSize];
+ m_fIsValid = true;
+ if (!m_pHeader)
+ {
+ m_fIsValid = false;
+ return;
+ }
+ m_fIsValid = (fseek(m_pfile, lOffset, SEEK_SET) == 0);
+ size_t bytesRead = fread(m_pHeader, 1, lSize, m_pfile);
+ Assert(bytesRead == lSize);
+ m_fIsValid = TtfUtil::CheckHeader(m_pHeader);
+
+ if (!m_fIsValid) return;
+ m_fIsValid = TtfUtil::GetTableDirInfo(m_pHeader, lOffset, lSize);
+ m_pTableDir = new byte[lSize];
+ if (!m_pTableDir)
+ {
+ m_fIsValid = false;
+ return;
+ }
+ // if lOffset hasn't changed this isn't needed
+ fseek(m_pfile, lOffset, SEEK_SET);
+ bytesRead = fread(m_pTableDir, 1, lSize, m_pfile);
+ Assert(bytesRead == lSize);
+
+ // now read head tables
+ m_fIsValid = TtfUtil::GetTableInfo(ktiOs2, m_pHeader, m_pTableDir,
+ lOffset, lSize);
+ if (!m_fIsValid)
+ {
+ return;
+ }
+ byte * pTable = readTable(ktiOs2, lSize);
+ // get ascent, descent, style while we have the OS2 table loaded
+ if (!m_fIsValid || !pTable)
+ {
+ return;
+ }
+ m_fIsValid = TtfUtil::FontOs2Style(pTable, m_fBold, m_fItalic);
+ m_mAscent = static_cast<float>(TtfUtil::FontAscent(pTable));
+ m_mDescent = static_cast<float>(TtfUtil::FontDescent(pTable));
+
+ pTable = readTable(ktiName, lSize);
+ if (!m_fIsValid || !pTable)
+ {
+ return;
+ }
+ if (!TtfUtil::Get31EngFamilyInfo(pTable, lOffset, lSize))
+ {
+ // not English name
+ m_fIsValid = false;
+ return;
+ }
+ Assert(lSize %2 == 0);// should be utf16
+ utf16 rgchwFace[128];
+ int cchw = (lSize / isizeof(utf16)) + 1;
+ cchw = min(cchw, 128);
+ utf16 * pTable16 = reinterpret_cast<utf16*>(pTable + lOffset);
+ std::copy(pTable16, pTable16 + cchw - 1, rgchwFace);
+ rgchwFace[cchw - 1] = 0; // zero terminate
+ TtfUtil::SwapWString(rgchwFace, cchw - 1);
+// We could use something like "if (sizeof(std::wstring::value_type) == 4)" here,
+// but a compile-time switch is preferable.
+#if SIZEOF_WCHAR_T == 4
+ for (int cch16 = 0; cch16 < cchw; )
+ {
+ int cch16Used = 0;
+ utf32 ch32 = GrCharStream::Utf16ToUtf32(&(rgchwFace[cch16]),
+ cchw - cch16, &cch16Used);
+ m_stuFaceName.push_back(ch32);
+ cch16 += cch16Used;
+ }
+// }
+#else
+ m_stuFaceName.assign(rgchwFace);
+ // VS 2005 needs this:
+ //for (int cch16 = 0; cch16 < cchw; cch16++)
+ // m_stuFaceName.push_back(rgchwFace[cch16]);
+#endif
+ pTable = readTable(ktiHead, lSize);
+ if (!m_fIsValid || !pTable)
+ {
+ return;
+ }
+ m_mEmSquare = static_cast<float>(TtfUtil::DesignUnits(pTable));
+ // can now set the scale
+ m_xScale = scaleFromDpi(m_dpiX);
+ m_yScale = scaleFromDpi(m_dpiY);
+ }
+ else
+ {
+ m_fIsValid = false;
+ }
+}
+
+byte *
+FileFont::readTable(int /*TableId*/ tid, size_t & size)
+{
+ const TableId tableId = TableId(tid);
+ bool isValid = true;
+ size_t lOffset = 0, lSize = 0;
+ if (!m_pTableCache)
+ {
+ m_pTableCache = new FontTableCache();
+ }
+ if (!m_pTableCache) return NULL;
+
+ byte * pTable = m_pTableCache->getTable(tableId);
+ size = m_pTableCache->getTableSize(tableId);
+ // check whether it is already in the cache
+ if (pTable) return pTable;
+ isValid &= TtfUtil::GetTableInfo(tableId, m_pHeader, m_pTableDir,
+ lOffset, lSize);
+ if (!isValid)
+ return NULL;
+ fseek(m_pfile, lOffset, SEEK_SET);
+ // only allocate if needed
+ pTable = m_pTableCache->allocateTable(tableId, lSize);
+
+ if (!pTable)
+ {
+ isValid = false;
+ return NULL;
+ }
+ size_t bytesRead = fread(pTable, 1, lSize, m_pfile);
+ isValid = bytesRead == lSize;
+ if (isValid)
+ {
+ isValid &= TtfUtil::CheckTable(tableId, pTable, lSize);
+ }
+ if (!isValid)
+ {
+ return 0;
+ }
+ size = lSize;
+ return pTable;
+}
+
+
+FileFont::~FileFont()
+{
+
+ // if this is the last copy of the font sharing these tables
+ // delete them
+ if (m_pTableCache)
+ {
+ m_pTableCache->decrementFontCount();
+ if (m_pTableCache->getFontCount() == 0)
+ {
+ delete [] m_pHeader;
+ delete [] m_pTableDir;
+ delete m_pTableCache;
+ m_pTableCache = NULL;
+ if (m_pfile)
+ fclose(m_pfile);
+ }
+ }
+ else
+ {
+ delete [] m_pHeader;
+ delete [] m_pTableDir;
+ if (m_pfile)
+ fclose(m_pfile);
+ }
+ // note the DecFontCount(); is done in the Font base class
+}
+
+Font * FileFont::copyThis()
+{
+ FileFont * copy = new FileFont(*this);
+ return copy;
+}
+
+/**
+* A copy constructor that allows a change of point size or dpi
+* The underlying table cache will be shared between the fonts, so
+* this should have a low overhead.
+*/
+FileFont::FileFont(const FileFont & font, float pointSize,
+ unsigned int dpiX, unsigned int dpiY)
+: Font(font),
+ m_pfile(font.m_pfile),
+ m_mAscent(font.m_mAscent),
+ m_mDescent(font.m_mDescent),
+ m_mEmSquare(font.m_mEmSquare),
+ m_pointSize(font.m_pointSize),
+ m_dpiX(font.m_dpiX),
+ m_dpiY(font.m_dpiY),
+ m_fIsValid(font.m_fIsValid),
+ m_pHeader(font.m_pHeader),
+ m_pTableDir(font.m_pTableDir),
+ m_xScale(font.m_xScale),
+ m_yScale(font.m_yScale)
+{
+ if (pointSize > 0)
+ {
+ m_pointSize = pointSize;
+ if (dpiX > 0)
+ {
+ m_dpiX = dpiX;
+ if (dpiY > 0) m_dpiY = dpiY;
+ else dpiY = dpiX;
+ }
+ m_xScale = scaleFromDpi(m_dpiX);
+ m_yScale = scaleFromDpi(m_dpiY);
+ }
+ m_fItalic = font.m_fItalic;
+ m_fBold = font.m_fBold;
+ // colors are not used
+ m_clrFore = font.m_clrFore;
+ m_clrBack = font.m_clrBack;
+ m_stuFaceName.assign(font.m_stuFaceName);
+
+ m_pTableCache = font.m_pTableCache;
+ // use the same table cache between instances
+ if (m_pTableCache)
+ m_pTableCache->incrementFontCount();
+
+
+ // I dont' see why we need to reget the face, but WinFont does
+ //m_pfface = FontFace::GetFontFace(this, m_fpropDef.szFaceName,
+ // m_fpropDef.fBold, m_fpropDef.fItalic);
+}
+
+
+
+ //virtual FontErrorCode isValidForGraphite(int * pnVersion = NULL, int * pnSubVersion = NULL);
+
+/*----------------------------------------------------------------------------------------------
+ Read a table from the font.
+----------------------------------------------------------------------------------------------*/
+const void *
+FileFont::getTable(fontTableId32 tableID, size_t * pcbSize)
+{
+ *pcbSize = 0;
+ // use a cache to reduce the number of times tables have to be reloaded
+ if (m_pTableCache == NULL)
+ {
+ // constructor automatically sets the font count to 1
+ m_pTableCache = new FontTableCache();
+ }
+ TableId tid;
+ for (int i = 0; i<ktiLast; i++)
+ {
+ tid = static_cast<TableId>(i);
+ if (tableID == TtfUtil::TableIdTag(tid))
+ {
+ if (m_pTableCache->getTable(tid))
+ {
+ *pcbSize = m_pTableCache->getTableSize(tid);
+ return m_pTableCache->getTable(tid);
+ }
+ break;
+ }
+ }
+ Assert(tid < ktiLast);
+ size_t tableSize = 0;
+ void * pTable = readTable(tid, tableSize);
+ *pcbSize = static_cast<int>(tableSize);
+ return pTable;
+}
+
+
+void FileFont::getFontMetrics(float * pAscent, float * pDescent,
+ float * pEmSquare)
+{
+ if (pEmSquare) *pEmSquare = m_mEmSquare * m_xScale;
+ if (pAscent) *pAscent = m_mAscent * m_yScale;
+ if (pDescent) *pDescent = m_mDescent * m_yScale;
+}
+
+
+bool FileFont::FontHasGraphiteTables(FILE * file)
+{
+ FileFont testFont(file, 1.0f, FUDGE_FACTOR);
+ return testFont.fontHasGraphiteTables();
+}
+
+bool FileFont::FontHasGraphiteTables(char * fileName)
+{
+ FileFont testFont(fileName, 1.0f, FUDGE_FACTOR);
+ return testFont.fontHasGraphiteTables();
+}
+
+bool FileFont::fontHasGraphiteTables()
+{
+ size_t tableSize;
+ bool isGraphiteFont = m_fIsValid;
+ isGraphiteFont &= (readTable(ktiSilf, tableSize) != NULL);
+ return isGraphiteFont;
+}
+
+} // namespace gr
diff --git a/Build/source/libs/graphite/src/font/Font.cpp b/Build/source/libs/graphite/src/font/Font.cpp
new file mode 100644
index 00000000000..95cf2cefd41
--- /dev/null
+++ b/Build/source/libs/graphite/src/font/Font.cpp
@@ -0,0 +1,950 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999 - 2008 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: Font.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ A font is an object that knows how to read tables from a (platform-specific) font resource.
+----------------------------------------------------------------------------------------------*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+// any other headers (not precompiled)
+
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:End Ignore
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Font methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Constructor.
+----------------------------------------------------------------------------------------------*/
+Font::Font(const Font & fontSrc) : m_pfface(fontSrc.m_pfface), m_fTablesCached(false)
+{
+ if (m_pfface)
+ m_pfface->IncFontCount();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Destructor.
+----------------------------------------------------------------------------------------------*/
+Font::~Font()
+{
+ if (m_pfface)
+ m_pfface->DecFontCount();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Mark the font-cache as to whether it should be deleted when all the font instances go away.
+----------------------------------------------------------------------------------------------*/
+void Font::SetFlushMode(int flush)
+{
+ FontFace::SetFlushMode(flush);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Cache the common tables if necessary.
+----------------------------------------------------------------------------------------------*/
+void Font::EnsureTablesCached()
+{
+ if (m_fTablesCached)
+ return;
+
+ size_t cbBogus;
+ m_pHead = getTable(TtfUtil::TableIdTag(ktiHead), &cbBogus);
+ m_pHmtx = getTable(TtfUtil::TableIdTag(ktiHmtx), &m_cbHmtxSize);
+ m_pGlyf = getTable(TtfUtil::TableIdTag(ktiGlyf), &cbBogus);
+ m_pLoca = getTable(TtfUtil::TableIdTag(ktiLoca), &m_cbLocaSize);
+
+ // getTable can return 0 for the lengths if it is hard to calculate them, but it should
+ // never do that for hmtx or loca.
+ Assert(m_cbHmtxSize > 0);
+ Assert(m_cbLocaSize > 0);
+
+ m_fTablesCached = true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the flush mode of the font-cache.
+----------------------------------------------------------------------------------------------*/
+int Font::GetFlushMode()
+{
+ return FontFace::GetFlushMode();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the internal object representing the font-face. This is the object that is stored
+ in Graphite's internal cache.
+----------------------------------------------------------------------------------------------*/
+inline FontFace & Font::fontFace(bool fDumbFallback)
+{
+ if (m_pfface == 0)
+ initialiseFontFace(fDumbFallback);
+ return *m_pfface;
+}
+
+void Font::initialiseFontFace(bool fDumbFallback)
+{
+ std::wstring stuFaceName;
+ bool fBold, fItalic;
+
+ UniqueCacheInfo(stuFaceName, fBold, fItalic);
+
+ m_pfface = FontFace::GetFontFace(this, stuFaceName, fBold, fItalic, fDumbFallback);
+
+ Assert(m_pfface != 0);
+
+ m_pfface->IncFontCount();
+
+ FontException fexptn;
+ fexptn.version = -1;
+ fexptn.subVersion = -1;
+ if (m_pfface->BadFont(&fexptn.errorCode)
+ || (!fDumbFallback && m_pfface->DumbFallback(&fexptn.errorCode)))
+ {
+ throw fexptn;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return uniquely identifying information that will be used as the key for this font
+ in the font cache. This includes the font face name and the bold and italic flags.
+----------------------------------------------------------------------------------------------*/
+void Font::UniqueCacheInfo(std::wstring & stuFace, bool & fBold, bool & fItalic)
+{
+ size_t cbSize;
+ const byte * pNameTbl = static_cast<const byte *>(getTable(TtfUtil::TableIdTag(ktiName), &cbSize));
+ size_t lOffset, lSize;
+ if (!TtfUtil::Get31EngFamilyInfo(pNameTbl, lOffset, lSize))
+ {
+ // TODO: try to find any name in any arbitrary language.
+ Assert(false);
+ return;
+ }
+ // byte * pvName = (byte *)pNameTbl + lOffset;
+ utf16 rgchwFace[128];
+ const size_t cchw = min(long(lSize / sizeof(utf16)), long((sizeof(rgchwFace) / sizeof(utf16)) - 1));
+ // NOTE: there is a potential alignment problem in the following two lines, which can causes
+ // crashes on architectures that require alignment to word boundaries.
+ const utf16 * pchwNameStart = reinterpret_cast<const utf16 *>(pNameTbl+ lOffset);
+ std::copy(pchwNameStart, pchwNameStart + cchw, rgchwFace);
+ rgchwFace[cchw] = 0; // zero terminate
+ TtfUtil::SwapWString(rgchwFace, cchw);
+ for (size_t ich16 = 0; ich16 < cchw; ich16++) // equivalent to assign, but works in more situations
+ stuFace.push_back(wchar_t(rgchwFace[ich16])); // where where wchar_t is 4 bytes
+
+ const void * pOs2Tbl = getTable(TtfUtil::TableIdTag(ktiOs2), &cbSize);
+ TtfUtil::FontOs2Style(pOs2Tbl, fBold, fItalic);
+ // Do we need to compare the results from the OS2 table with the italic flag in the
+ // head table? (There is no requirement that they be consistent!)
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ A default unhinted implmentation of getGlyphPoint(..)
+----------------------------------------------------------------------------------------------*/
+void Font::getGlyphPoint(gid16 glyphID, unsigned int pointNum, Point & pointReturn)
+{
+ EnsureTablesCached();
+
+ // Default values
+ pointReturn.x = 0;
+ pointReturn.y = 0;
+
+ if (m_pGlyf == 0) return;
+ if (m_pHead == 0) return;
+ if (m_pLoca == 0) return;
+
+ size_t cContours;
+ size_t cPoints;
+
+ const size_t CONTOUR_BUF_SIZE = 16;
+ const size_t POINT_BUF_SIZE = 64;
+ // Fixed-size buffers that will be used in most cases:
+ bool rgfOnCurveFixedBuf[POINT_BUF_SIZE], *rgfOnCurveHeapBuf=0;
+ int rgnEndPtFixedBuf[CONTOUR_BUF_SIZE], *rgnEndPtHeapBuf=0,
+ rgnXFixedBuf[POINT_BUF_SIZE], *rgnXHeapBuf=0,
+ rgnYFixedBuf[POINT_BUF_SIZE], *rgnYHeapBuf=0;
+
+ if (!TtfUtil::GlyfContourCount(glyphID, m_pGlyf, m_pLoca, m_cbLocaSize, m_pHead, cContours))
+ return; // can't figure it out
+
+ int * prgnEndPt = (cContours > CONTOUR_BUF_SIZE) ?
+ rgnEndPtHeapBuf = new int[cContours] :
+ rgnEndPtFixedBuf;
+
+ if (!TtfUtil::GlyfContourEndPoints(glyphID, m_pGlyf, m_pLoca, m_cbLocaSize, m_pHead,
+ prgnEndPt, cContours))
+ {
+ return; // should have been caught above
+ }
+ cPoints = prgnEndPt[cContours - 1] + 1;
+
+ bool* prgfOnCurve = (cPoints > POINT_BUF_SIZE) ? rgfOnCurveHeapBuf= new bool[cPoints] : rgfOnCurveFixedBuf;
+ int * prgnX = (cPoints > POINT_BUF_SIZE) ? rgnXHeapBuf= new int[cPoints] : rgnXFixedBuf;
+ int * prgnY = (cPoints > POINT_BUF_SIZE) ? rgnYHeapBuf= new int[cPoints] : rgnYFixedBuf;
+
+ if (TtfUtil::GlyfPoints(glyphID, m_pGlyf, m_pLoca, m_cbLocaSize, m_pHead, 0, 0,
+ prgnX, prgnY, prgfOnCurve, cPoints))
+ {
+ float nPixEmSquare;
+ getFontMetrics(0, 0, &nPixEmSquare);
+
+ const float nDesignUnitsPerPixel = float(TtfUtil::DesignUnits(m_pHead)) / nPixEmSquare;
+ pointReturn.x = prgnX[pointNum] / nDesignUnitsPerPixel;
+ pointReturn.y = prgnY[pointNum] / nDesignUnitsPerPixel;
+ }
+
+ delete[] rgnEndPtHeapBuf;
+ delete[] rgfOnCurveHeapBuf;
+ delete[] rgnXHeapBuf;
+ delete[] rgnYHeapBuf;
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ A default unhinted implmentation of getGlyphMetrics(..)
+----------------------------------------------------------------------------------------------*/
+void Font::getGlyphMetrics(gid16 glyphID, gr::Rect & boundingBox, gr::Point & advances)
+{
+ EnsureTablesCached();
+
+ // Setup default return values in case of failiure.
+ boundingBox.left = 0;
+ boundingBox.right = 0;
+ boundingBox.bottom = 0;
+ boundingBox.top = 0;
+ advances.x = 0;
+ advances.y = 0;
+
+ if (m_pHead == 0) return;
+
+ // Calculate the number of design units per pixel.
+ float pixelEmSquare;
+ getFontMetrics(0, 0, &pixelEmSquare);
+ const float pixelsPerDesignUnit =
+ pixelEmSquare / float(TtfUtil::DesignUnits(m_pHead));
+
+ // getTable can return 0 for the lengths if it is hard to calculate them, but it should
+ // never do that for hmtx or loca.
+ Assert(m_cbHmtxSize > 0);
+
+ // Use the Hmtx and Head tables to find the glyph advances.
+ int lsb;
+ unsigned int advance = 0;
+ if (TtfUtil::HorMetrics(glyphID, m_pHmtx, m_cbHmtxSize, m_pHead,
+ lsb, advance))
+ {
+ advances.x = (advance * pixelsPerDesignUnit);
+ advances.y = 0.0f;
+ }
+
+ if (m_pGlyf == 0) return;
+ if (m_pLoca == 0) return;
+ Assert(m_cbLocaSize > 0);
+
+ // Fetch the glyph bounding box. GlyphBox may return false for a whitespace glyph.
+ // Note that using GlyfBox here allows attachment points (ie, points lying outside
+ // the glyph's outline) to affect the bounding box, which might not be what we want.
+ int xMin, xMax, yMin, yMax;
+ if (TtfUtil::GlyfBox(glyphID, m_pGlyf, m_pLoca, m_cbLocaSize, m_pHead,
+ xMin, yMin, xMax, yMax))
+ {
+ boundingBox.left = (xMin * pixelsPerDesignUnit);
+ boundingBox.bottom = (yMin * pixelsPerDesignUnit);
+ boundingBox.right = (xMax * pixelsPerDesignUnit);
+ boundingBox.top = (yMax * pixelsPerDesignUnit);
+ }
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Return a pair of iterators over a sequence of features defined for the font.
+----------------------------------------------------------------------------------------------*/
+std::pair<FeatureIterator, FeatureIterator> Font::getFeatures()
+{
+ std::pair<FeatureIterator, FeatureIterator> pairRet;
+ pairRet.first = BeginFeature();
+ pairRet.second = EndFeature();
+ return pairRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Returns an iterator indicating the feature with the given ID. If no such feature,
+ returns the end iterator.
+----------------------------------------------------------------------------------------------*/
+FeatureIterator Font::featureWithID(featid id)
+{
+ FeatureIterator fit = BeginFeature();
+ FeatureIterator fitEnd = EndFeature();
+ for ( ; fit != fitEnd ; ++fit)
+ {
+ if (*fit == id)
+ return fit;
+ }
+ return fitEnd; // invalid
+}
+
+/*----------------------------------------------------------------------------------------------
+ Returns the UI label for the indicated feature. Return false if there is no label for the
+ language, or it is empty.
+----------------------------------------------------------------------------------------------*/
+bool Font::getFeatureLabel(FeatureIterator fit, lgid nLanguage, utf16 * label)
+{
+ return GetFeatureLabel(fit.m_ifeat, nLanguage, label);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Returns an iterator pointing at the default value for the feature.
+----------------------------------------------------------------------------------------------*/
+FeatureSettingIterator Font::getDefaultFeatureValue(FeatureIterator fit)
+{
+ size_t ifset = GetFeatureDefault(fit.m_ifeat);
+ FeatureSettingIterator fsit = fit.BeginSetting();
+ fsit += ifset;
+ return fsit;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Returns a pair of iterators spanning the defined settings for the feature.
+----------------------------------------------------------------------------------------------*/
+std::pair<FeatureSettingIterator, FeatureSettingIterator>
+ Font::getFeatureSettings(FeatureIterator fit)
+{
+ std::pair<FeatureSettingIterator, FeatureSettingIterator> pairRet;
+ pairRet.first = fit.BeginSetting();
+ pairRet.second = fit.EndSetting();
+ return pairRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Returns the UI label for the indicated feature. Return false if there is no label for the
+ language, or it is empty.
+----------------------------------------------------------------------------------------------*/
+bool Font::getFeatureSettingLabel(FeatureSettingIterator fsit, lgid nLanguage, utf16 * label)
+{
+ //FeatureIterator * pfit = static_cast<FeatureIterator *>(fsit.m_pfit);
+ return GetFeatureSettingLabel(fsit.m_fit.m_ifeat, fsit.m_ifset, nLanguage, label);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Private methods for feature and language access.
+----------------------------------------------------------------------------------------------*/
+size_t Font::NumberOfFeatures()
+{
+ try {
+ return fontFace().NumberOfFeatures();
+ }
+ catch (...) { return 0; }
+}
+featid Font::FeatureID(size_t ifeat)
+{
+ try {
+ return fontFace().FeatureID(ifeat);
+ }
+ catch (...) { return 0; }
+}
+size_t Font::FeatureWithID(featid id)
+{
+ try {
+ return fontFace().FeatureWithID(id);
+ }
+ catch (...) { return 0; }
+}
+bool Font::GetFeatureLabel(size_t ifeat, lgid language, utf16 * label)
+{
+ try {
+ return fontFace().GetFeatureLabel(ifeat, language, label);
+ }
+ catch (...)
+ {
+ *label = 0;
+ return false;
+ }
+}
+int Font::GetFeatureDefault(size_t ifeat) // index of default setting
+{
+ try {
+ return fontFace().GetFeatureDefault(ifeat);
+ }
+ catch (...) { return 0; }
+}
+size_t Font::NumberOfSettings(size_t ifeat)
+{
+ try {
+ return fontFace().NumberOfSettings(ifeat);
+ }
+ catch (...) { return 0; }
+}
+int Font::GetFeatureSettingValue(size_t ifeat, size_t ifset)
+{
+ try {
+ return fontFace().GetFeatureSettingValue(ifeat, ifset);
+ }
+ catch (...) { return 0; }
+}
+bool Font::GetFeatureSettingLabel(size_t ifeat, size_t ifset, lgid language, utf16 * label)
+{
+ try {
+ return fontFace().GetFeatureSettingLabel(ifeat, ifset, language, label);
+ }
+ catch (...)
+ {
+ *label = 0;
+ return false;
+ }
+}
+size_t Font::NumberOfFeatLangs()
+{
+ try {
+ return fontFace().NumberOfFeatLangs();
+ }
+ catch (...) { return 0; }
+}
+short Font::FeatLabelLang(size_t ilang)
+{
+ try {
+ return fontFace().FeatLabelLang(ilang);
+ }
+ catch (...) { return 0; }
+}
+size_t Font::NumberOfLanguages()
+{
+ try {
+ return fontFace().NumberOfLanguages();
+ }
+ catch (...) { return 0; }
+}
+isocode Font::LanguageCode(size_t ilang)
+{
+ try {
+ return fontFace().LanguageCode(ilang);
+ }
+ catch (...)
+ {
+ isocode ret;
+ std::fill_n(ret.rgch, sizeof(ret.rgch), '\0');
+ return ret;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return a pair of iterators over a sequence of feature-label languages for this font.
+----------------------------------------------------------------------------------------------*/
+std::pair<FeatLabelLangIterator, FeatLabelLangIterator> Font::getFeatureLabelLanguages()
+{
+ std::pair<FeatLabelLangIterator, FeatLabelLangIterator> pairRet;
+ pairRet.first = BeginFeatLang();
+ pairRet.second = EndFeatLang();
+ return pairRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return a pair of iterators over a sequence of languages defined for the font, that is,
+ those that have features specified for them.
+----------------------------------------------------------------------------------------------*/
+std::pair<LanguageIterator, LanguageIterator> Font::getSupportedLanguages()
+{
+ std::pair<LanguageIterator, LanguageIterator> pairRet;
+ pairRet.first = BeginLanguage();
+ pairRet.second = EndLanguage();
+ return pairRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return a bitmap indicating which directions are supported by the font.
+----------------------------------------------------------------------------------------------*/
+ScriptDirCode Font::getSupportedScriptDirections() const throw()
+{
+ try {
+ Font * pfontThis = const_cast<Font *>(this);
+ FontFace & fface = pfontThis->fontFace();
+ return fface.ScriptDirection();
+ }
+ catch (...) {
+ return kfsdcHorizLtr;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ For segment creation.
+----------------------------------------------------------------------------------------------*/
+void Font::RenderLineFillSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout,
+ toffset ichStart, toffset ichStop, float xsMaxWidth, bool fBacktracking)
+{
+ fontFace(layout.dumbFallback()).RenderLineFillSegment(pseg, this, pts, layout,
+ ichStart, ichStop, xsMaxWidth, fBacktracking);
+}
+
+void Font::RenderRangeSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout,
+ toffset ichStart, toffset ichStop)
+{
+ fontFace(layout.dumbFallback()).RenderRangeSegment(pseg, this, pts, layout, ichStart, ichStop);
+}
+
+void Font::RenderJustifiedSegment(Segment * pseg, ITextSource * pts,
+ LayoutEnvironment & layout, toffset ichStart, toffset ichStop,
+ float xsCurrentWidth, float xsDesiredWidth)
+{
+ fontFace(layout.dumbFallback()).RenderJustifiedSegment(pseg, this, pts, layout,
+ ichStart, ichStop, xsCurrentWidth, xsDesiredWidth);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Feature iterators.
+----------------------------------------------------------------------------------------------*/
+FeatureIterator Font::BeginFeature()
+{
+ FeatureIterator fit(this, 0, NumberOfFeatures());
+ return fit;
+}
+
+FeatureIterator Font::EndFeature()
+{
+ int cfeat = NumberOfFeatures();
+ FeatureIterator fit (this, cfeat, cfeat);
+ return fit;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Feature-label language iterators.
+----------------------------------------------------------------------------------------------*/
+FeatLabelLangIterator Font::BeginFeatLang()
+{
+ FeatLabelLangIterator lgit(this, 0, NumberOfFeatLangs());
+ return lgit;
+}
+
+FeatLabelLangIterator Font::EndFeatLang()
+{
+ int clang = NumberOfFeatLangs();
+ FeatLabelLangIterator lgit(this, clang, clang);
+ return lgit;
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Language iterators.
+----------------------------------------------------------------------------------------------*/
+LanguageIterator Font::BeginLanguage()
+{
+ LanguageIterator lgit(this, 0, NumberOfLanguages());
+ return lgit;
+}
+
+LanguageIterator Font::EndLanguage()
+{
+ int clang = NumberOfLanguages();
+ LanguageIterator lgit(this, clang, clang);
+ return lgit;
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Debugging.
+----------------------------------------------------------------------------------------------*/
+//bool Font::DbgCheckFontCache()
+//{
+// return FontFace::DbgCheckFontCache();
+//}
+
+
+//:>********************************************************************************************
+//:> FeatureIterator methods
+//:>********************************************************************************************
+
+//FeatureIterator::FeatureIterator(FeatureIterator & fitToCopy)
+//{
+// m_pfont = fitToCopy.m_pfont;
+// m_ifeat = fitToCopy.m_ifeat;
+// m_cfeat = fitToCopy.m_cfeat;
+//}
+
+/*----------------------------------------------------------------------------------------------
+ Dereference the iterator, returning a feature ID.
+----------------------------------------------------------------------------------------------*/
+featid FeatureIterator::operator*()
+{
+ if (m_ifeat >= m_cfeat)
+ {
+ Assert(false);
+ return (unsigned int)kInvalid;
+ }
+
+ return m_pfont->FeatureID(m_ifeat);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Increment the iterator.
+----------------------------------------------------------------------------------------------*/
+FeatureIterator FeatureIterator::operator++()
+{
+ if (m_ifeat >= m_cfeat)
+ {
+ // Can't increment.
+ Assert(false);
+ }
+ else
+ m_ifeat++;
+
+ return *this;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Increment the iterator by the given value.
+----------------------------------------------------------------------------------------------*/
+FeatureIterator FeatureIterator::operator+=(int n)
+{
+ if (m_ifeat + n >= m_cfeat)
+ {
+ // Can't increment.
+ Assert(false);
+ m_ifeat = m_cfeat;
+ }
+ else if (m_ifeat + n < 0)
+ {
+ // Can't decrement.
+ Assert(false);
+ m_ifeat = 0;
+ }
+ else
+ m_ifeat += m_cfeat;
+
+ return *this;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Test whether the two iterators are equal.
+----------------------------------------------------------------------------------------------*/
+bool FeatureIterator::operator==(FeatureIterator & fit)
+{
+ return (fit.m_ifeat == m_ifeat && fit.m_pfont == m_pfont);
+}
+
+bool FeatureIterator::operator!=(FeatureIterator & fit)
+{
+ return (fit.m_ifeat != m_ifeat || fit.m_pfont != m_pfont);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the number of items represented by the range of the two iterators.
+----------------------------------------------------------------------------------------------*/
+int FeatureIterator::operator-(FeatureIterator & fit)
+{
+ if (m_pfont != fit.m_pfont)
+ {
+ throw;
+ }
+ return (m_ifeat - fit.m_ifeat);
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Iterators.
+----------------------------------------------------------------------------------------------*/
+FeatureSettingIterator FeatureIterator::BeginSetting()
+{
+ int cfset = m_pfont->NumberOfSettings(m_ifeat);
+ FeatureSettingIterator fsit(*this, 0, cfset);
+ return fsit;
+}
+
+FeatureSettingIterator FeatureIterator::EndSetting()
+{
+ int cfset = m_pfont->NumberOfSettings(m_ifeat);
+ FeatureSettingIterator fsit(*this, cfset, cfset);
+ return fsit;
+}
+
+
+//:>********************************************************************************************
+//:> FeatureSettingIterator methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Dereference the iterator, returning a feature value.
+----------------------------------------------------------------------------------------------*/
+int FeatureSettingIterator::operator*()
+{
+ if (m_ifset >= m_cfset)
+ {
+ Assert(false);
+ return kInvalid;
+ }
+
+ return m_fit.m_pfont->GetFeatureSettingValue(m_fit.m_ifeat, m_ifset);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Increment the iterator.
+----------------------------------------------------------------------------------------------*/
+FeatureSettingIterator FeatureSettingIterator::operator++()
+{
+ if (m_ifset >= m_cfset)
+ {
+ // Can't increment.
+ Assert(false);
+ }
+ else
+ m_ifset++;
+
+ return *this;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Increment the iterator by the given value.
+----------------------------------------------------------------------------------------------*/
+FeatureSettingIterator FeatureSettingIterator::operator+=(int n)
+{
+ if (m_ifset + n >= m_cfset)
+ {
+ // Can't increment.
+ Assert(false);
+ m_ifset = m_cfset;
+ }
+ if (m_ifset + n < 0)
+ {
+ // Can't decrement.
+ Assert(false);
+ m_ifset = 0;
+ }
+ else
+ m_ifset += n;
+
+ return *this;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Test whether the two iterators are equal.
+----------------------------------------------------------------------------------------------*/
+bool FeatureSettingIterator::operator==(FeatureSettingIterator & fsit)
+{
+ //FeatureIterator * pfit = static_cast<FeatureIterator *>(m_pfit);
+ //FeatureIterator * pfitOther = static_cast<FeatureIterator *>(fsit.m_pfit);
+ //return (m_ifset == fsit.m_ifset && pfit == pfitOther);
+ return (m_ifset == fsit.m_ifset && m_fit == fsit.m_fit);
+}
+
+bool FeatureSettingIterator::operator!=(FeatureSettingIterator & fsit)
+{
+ //FeatureIterator * pfit = static_cast<FeatureIterator *>(m_pfit);
+ //FeatureIterator * pfitOther = static_cast<FeatureIterator *>(fsit.m_pfit);
+ //return (m_ifset != fsit.m_ifset || pfit != pfitOther);
+
+ return (m_ifset != fsit.m_ifset || m_fit != fsit.m_fit);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the number of items represented by the range of the two iterators.
+----------------------------------------------------------------------------------------------*/
+int FeatureSettingIterator::operator-(FeatureSettingIterator fsit)
+{
+ //FeatureIterator * pfit = static_cast<FeatureIterator *>(m_pfit);
+ //FeatureIterator * pfitOther = static_cast<FeatureIterator *>(fsit.m_pfit);
+ //if (pfit != pfitOther)
+
+ if (m_fit != fsit.m_fit)
+ {
+ throw;
+ }
+ return (m_ifset - fsit.m_ifset);
+}
+
+//:>********************************************************************************************
+//:> FeatLabelLangIterator methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Dereference the iterator, returning a language LCID.
+----------------------------------------------------------------------------------------------*/
+data16 FeatLabelLangIterator::operator*()
+{
+ if (m_ilang >= m_clang)
+ {
+ Assert(false);
+ return 0;
+ }
+
+ return m_pfont->FeatLabelLang(m_ilang);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Increment the iterator.
+----------------------------------------------------------------------------------------------*/
+FeatLabelLangIterator FeatLabelLangIterator::operator++()
+{
+ if (m_ilang >= m_clang)
+ {
+ // Can't increment.
+ Assert(false);
+ }
+ else
+ m_ilang++;
+
+ return *this;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Increment the iterator by the given value.
+----------------------------------------------------------------------------------------------*/
+FeatLabelLangIterator FeatLabelLangIterator::operator+=(int n)
+{
+ if (m_ilang + n >= m_clang)
+ {
+ // Can't increment.
+ Assert(false);
+ m_ilang = m_clang;
+ }
+ else if (m_ilang + n < 0)
+ {
+ // Can't decrement.
+ Assert(false);
+ m_ilang = 0;
+ }
+ else
+ m_ilang += m_clang;
+
+ return *this;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Test whether the two iterators are equal.
+----------------------------------------------------------------------------------------------*/
+bool FeatLabelLangIterator::operator==(FeatLabelLangIterator & fllit)
+{
+ return (fllit.m_ilang == m_ilang && fllit.m_pfont == m_pfont);
+}
+
+bool FeatLabelLangIterator::operator!=(FeatLabelLangIterator & fllit)
+{
+ return (fllit.m_ilang != m_ilang || fllit.m_pfont != m_pfont);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the number of items represented by the range of the two iterators.
+----------------------------------------------------------------------------------------------*/
+int FeatLabelLangIterator::operator-(FeatLabelLangIterator & fllit)
+{
+ if (m_pfont != fllit.m_pfont)
+ {
+ throw;
+ }
+ return (m_ilang - fllit.m_ilang);
+}
+
+
+//:>********************************************************************************************
+//:> LanguageIterator methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Dereference the iterator, returning a language code.
+----------------------------------------------------------------------------------------------*/
+isocode LanguageIterator::operator*()
+{
+ if (m_ilang >= m_clang)
+ {
+ Assert(false);
+ isocode codeRet;
+ codeRet.rgch[0] = '?'; codeRet.rgch[1] = '?';
+ codeRet.rgch[2] = '?'; codeRet.rgch[3] = 0;
+ return codeRet;
+ }
+
+ return m_pfont->LanguageCode(m_ilang);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Increment the iterator.
+----------------------------------------------------------------------------------------------*/
+LanguageIterator LanguageIterator::operator++()
+{
+ if (m_ilang >= m_clang)
+ {
+ // Can't increment.
+ Assert(false);
+ }
+ else
+ m_ilang++;
+
+ return *this;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Increment the iterator by the given value.
+----------------------------------------------------------------------------------------------*/
+LanguageIterator LanguageIterator::operator+=(int n)
+{
+ if (m_ilang + n >= m_clang)
+ {
+ // Can't increment.
+ Assert(false);
+ m_ilang = m_clang;
+ }
+ else if (m_ilang + n < 0)
+ {
+ // Can't decrement.
+ Assert(false);
+ m_ilang = 0;
+ }
+ else
+ m_ilang += m_clang;
+
+ return *this;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Test whether the two iterators are equal.
+----------------------------------------------------------------------------------------------*/
+bool LanguageIterator::operator==(LanguageIterator & lgit)
+{
+ return (lgit.m_ilang == m_ilang && lgit.m_pfont == m_pfont);
+}
+
+bool LanguageIterator::operator!=(LanguageIterator & lgit)
+{
+ return (lgit.m_ilang != m_ilang || lgit.m_pfont != m_pfont);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the number of items represented by the range of the two iterators.
+----------------------------------------------------------------------------------------------*/
+int LanguageIterator::operator-(LanguageIterator & lgit)
+{
+ if (m_pfont != lgit.m_pfont)
+ {
+ throw;
+ }
+ return (m_ilang - lgit.m_ilang);
+}
+
+
+} // namespace gr
+
+
diff --git a/Build/source/libs/graphite/src/font/FontTableCache.h b/Build/source/libs/graphite/src/font/FontTableCache.h
new file mode 100644
index 00000000000..461b00d745f
--- /dev/null
+++ b/Build/source/libs/graphite/src/font/FontTableCache.h
@@ -0,0 +1,52 @@
+
+#include "TtfUtil.h"
+
+namespace gr
+{
+
+
+// used to allow table sharing among font copies
+// TBD: should this be a real class or is it acceptable to
+// make the attributes public
+class FontTableCache
+{
+public:
+ FontTableCache()
+ : m_fontCount(1)
+ {
+ for (int i = 0; i<ktiLast; i++)
+ {
+ m_pTable[i] = NULL;
+ }
+ }
+ ~FontTableCache()
+ {
+ Assert(m_fontCount == 0);
+ for (int i = 0; i<ktiLast; i++)
+ {
+ if (m_pTable[i]) delete[] m_pTable[i];
+ }
+ }
+ const int & getFontCount() { return m_fontCount; }
+ void incrementFontCount() { m_fontCount++; }
+ void decrementFontCount() { m_fontCount--; Assert(m_fontCount > -1); }
+ byte * getTable(TableId id) const { Assert(id < ktiLast); return m_pTable[id]; }
+ const long & getTableSize(TableId id) const
+ {
+ Assert(id < ktiLast);
+ return m_tableSize[id];
+ }
+ byte * allocateTable(TableId id, long size)
+ {
+ m_pTable[id] = new byte[size];
+ m_tableSize[id] = size;
+ return m_pTable[id];
+ }
+
+private:
+ int m_fontCount;
+ byte * m_pTable[ktiLast];
+ long m_tableSize[ktiLast];
+};
+
+}
diff --git a/Build/source/libs/graphite/src/font/Makefile.am b/Build/source/libs/graphite/src/font/Makefile.am
new file mode 100644
index 00000000000..461af621b49
--- /dev/null
+++ b/Build/source/libs/graphite/src/font/Makefile.am
@@ -0,0 +1,7 @@
+fontdir = $(top_srcdir)/src/font
+
+libgraphite_la_SOURCES += $(fontdir)/Font.cpp
+libgraphite_la_SOURCES += $(fontdir)/TtfUtil.cpp
+libgraphite_la_SOURCES += $(fontdir)/FileFont.cpp
+
+EXTRA_DIST += $(fontdir)/*.h
diff --git a/Build/source/libs/graphite/src/font/TtfTypes.h b/Build/source/libs/graphite/src/font/TtfTypes.h
new file mode 100644
index 00000000000..da8d90f1f26
--- /dev/null
+++ b/Build/source/libs/graphite/src/font/TtfTypes.h
@@ -0,0 +1,388 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2007 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: TtfTypes.h
+Responsibility: Tim Eves
+Last reviewed: Not yet.
+
+Description:
+Provides types required to represent the TTF basic types.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+
+//**********************************************************************************************
+// Include files
+//**********************************************************************************************
+#include "GrPlatform.h"
+
+namespace TtfUtil
+{
+//**********************************************************************************************
+// Forward declarations
+//**********************************************************************************************
+
+
+//**********************************************************************************************
+// Type declarations
+//**********************************************************************************************
+typedef gr::data8 uint8;
+typedef gr::sdata8 int8;
+typedef gr::data16 uint16;
+typedef gr::sdata16 int16;
+typedef gr::data32 uint32;
+typedef gr::sdata32 int32;
+
+typedef int16 short_frac;
+typedef int32 fixed;
+typedef int16 fword;
+typedef uint16 ufword;
+typedef int16 f2dot14;
+typedef uint32 long_date_time[2];
+
+//**********************************************************************************************
+// Constants and enum types
+//**********************************************************************************************/
+enum
+{
+ OneFix = 1<<16
+};
+
+//**********************************************************************************************
+// Table declarations
+//**********************************************************************************************
+namespace Sfnt
+{
+#pragma pack(1) // We need this or the structure members aren't alligned
+ // correctly. Fortunately this form of pragma is supposed
+ // to be recongnised by VS C++ too (at least according to
+ // MSDN).
+
+ struct OffsetSubTable
+ {
+ uint32 scaler_type;
+ uint16 num_tables,
+ search_range,
+ entry_selector,
+ range_shift;
+ struct Entry
+ {
+ uint32 tag,
+ checksum,
+ offset,
+ length;
+ } table_directory[1];
+
+ enum ScalerType
+ {
+ TrueTypeMac = 0x74727565U,
+ TrueTypeWin = 0x00010000U,
+ Type1 = 0x74797031U
+ };
+ };
+
+
+
+
+ struct CharacterCodeMap
+ {
+ uint16 version,
+ num_subtables;
+ struct
+ {
+ uint16 platform_id,
+ platform_specific_id;
+ uint32 offset;
+ } encoding[1];
+ };
+
+ struct CmapSubTable
+ {
+ uint16 format,
+ length,
+ language;
+ };
+
+ struct CmapSubTableFormat4 : CmapSubTable
+ {
+ uint16 seg_count_x2,
+ search_range,
+ entry_selector,
+ range_shift,
+ end_code[1];
+ // There are arrarys after this which need their
+ // start positions calculated since end_code is
+ // seg_count uint16s long.
+ };
+
+ struct CmapSubTableFormat12
+ {
+ fixed format;
+ uint32 length,
+ language,
+ num_groups;
+ struct
+ {
+ uint32 start_char_code,
+ end_char_code,
+ start_glyph_id;
+ } group[1];
+ };
+
+
+
+ struct FontHeader
+ {
+ fixed version,
+ font_revision;
+ uint32 check_sum_adjustment,
+ magic_number;
+ uint16 flags,
+ units_per_em;
+ long_date_time created,
+ modified;
+ fword x_min,
+ y_min,
+ x_max,
+ y_max;
+ uint16 mac_style,
+ lowest_rec_ppem;
+ int16 font_direction_hint,
+ index_to_loc_format,
+ glyph_data_format;
+ enum
+ {
+ MagicNumber = 0x5F0F3CF5,
+ GlypDataFormat = 0
+ };
+ enum {ShortIndexLocFormat, LongIndexLocFormat};
+ };
+
+
+
+
+ struct PostScriptGlyphName
+ {
+ fixed format,
+ italic_angle;
+ fword underline_position,
+ underline_thickness;
+ uint32 is_fixed_pitch,
+ min_mem_type42,
+ max_mem_type42,
+ min_mem_type1,
+ max_mem_type1;
+ enum
+ {
+ Format1 = 0x10000,
+ Format2 = 0x20000,
+ Format25 = 0x28000,
+ Format3 = 0x30000,
+ Format4 = 0x40000
+ };
+ };
+
+ struct PostScriptGlyphName2 : PostScriptGlyphName
+ {
+ uint16 number_of_glyphs,
+ glyph_name_index[1];
+ };
+
+ struct PostScriptGlyphName25 : PostScriptGlyphName
+ {
+ uint16 number_of_glyphs;
+ int8 offset[1];
+ };
+
+ struct PostScriptGlyphName3 : PostScriptGlyphName {};
+
+ struct PostScriptGlyphName4 : PostScriptGlyphName
+ {
+ uint16 glyph_to_char_map[1];
+ };
+
+
+ struct HorizontalHeader
+ {
+ fixed version;
+ fword ascent,
+ descent,
+ line_gap;
+ ufword advance_width_max;
+ fword min_left_side_bearing,
+ max_left_side_bearing,
+ x_max_element;
+ int16 caret_slope_rise,
+ caret_slope_run;
+ fword caret_offset;
+ int16 reserved[4],
+ metric_data_format;
+ uint16 num_long_hor_metrics;
+ };
+
+ struct MaximumProfile
+ {
+ fixed version;
+ uint16 num_glyphs,
+ max_points,
+ max_contours,
+ max_component_points,
+ max_component_contours,
+ max_zones,
+ max_twilight_points,
+ max_storage,
+ max_function_defs,
+ max_instruction_defs,
+ max_stack_elements,
+ max_size_of_instructions,
+ max_component_elements,
+ max_component_depth;
+ };
+
+
+ typedef gr::byte Panose[10];
+
+ struct Compatibility0
+ {
+ uint16 version;
+ int16 x_avg_char_width;
+ uint16 weight_class,
+ width_class;
+ int16 fs_type,
+ y_subscript_x_size,
+ y_subscript_y_size,
+ y_subscript_x_offset,
+ y_subscript_y_offset,
+ y_superscript_x_size,
+ y_superscript_y_size,
+ y_superscript_x_offset,
+ y_superscript_y_offset,
+ y_strikeout_size,
+ y_strikeout_position,
+ family_class;
+ Panose panose;
+ uint32 unicode_range[4];
+ int8 ach_vend_id[4];
+ uint16 fs_selection,
+ fs_first_char_index,
+ fs_last_char_index, // Acording to Apple's spec this is where v0 should end
+ typo_ascender,
+ typo_descender,
+ type_linegap,
+ win_ascent,
+ win_descent;
+
+ enum
+ {
+ Italic =0x01,
+ Underscore=0x02,
+ Negative =0x04,
+ Outlined =0x08,
+ StrikeOut =0x10,
+ Bold =0x20
+ };
+ };
+
+ struct Compatibility1 : Compatibility0
+ {
+ uint32 codepage_range[2];
+ };
+
+ struct Compatibility2 : Compatibility1
+ {
+ int16 x_height,
+ cap_height;
+ uint16 default_char,
+ break_char,
+ max_context;
+ };
+
+ struct Compatibility3 : Compatibility2 {};
+
+ typedef Compatibility3 Compatibility;
+
+
+ struct NameRecord
+ {
+ uint16 platform_id,
+ platform_specific_id,
+ language_id,
+ name_id,
+ length,
+ offset;
+ enum {Unicode, Mactintosh, Reserved, Microsoft};
+ enum
+ {
+ Copyright, Family, Subfamily, UniqueSubfamily,
+ Fullname, Version, PostScript
+ };
+ };
+
+ struct FontNames
+ {
+ uint16 format,
+ count,
+ string_offset;
+ NameRecord name_record[1];
+ };
+
+
+ struct HorizontalMetric
+ {
+ uint16 advance_width;
+ int16 left_side_bearing;
+ };
+
+
+ struct Glyph
+ {
+ int16 number_of_contours;
+ fword x_min,
+ y_min,
+ x_max,
+ y_max;
+ };
+
+ struct SimpleGlyph : Glyph
+ {
+ uint16 end_pts_of_contours[1];
+ enum
+ {
+ OnCurve = 0x01,
+ XShort = 0x02,
+ YShort = 0x04,
+ Repeat = 0x08,
+ XIsSame = 0x10,
+ XIsPos = 0x10,
+ YIsSame = 0x20,
+ YIsPos = 0x20
+ };
+ };
+
+ struct CompoundGlyph : Glyph
+ {
+ uint16 flags,
+ glyph_index;
+ enum
+ {
+ Arg1Arg2Words = 0x01,
+ ArgsAreXYValues = 0x02,
+ RoundXYToGrid = 0x04,
+ HaveScale = 0x08,
+ MoreComponents = 0x20,
+ HaveXAndYScale = 0x40,
+ HaveTwoByTwo = 0x80,
+ HaveInstructions = 0x100,
+ UseMyMetrics = 0x200,
+ OverlapCompund = 0x400,
+ ScaledOffset = 0x800,
+ UnscaledOffset = 0x1000
+ };
+ };
+
+#pragma pack()
+} // end of namespace Sfnt
+
+} // end of namespace TtfUtil
diff --git a/Build/source/libs/graphite/src/font/TtfUtil.cpp b/Build/source/libs/graphite/src/font/TtfUtil.cpp
new file mode 100644
index 00000000000..471b7eeca2c
--- /dev/null
+++ b/Build/source/libs/graphite/src/font/TtfUtil.cpp
@@ -0,0 +1,1935 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2000, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: TtfUtil.cpp
+Responsibility: Alan Ward
+Last reviewed: Not yet.
+
+Description:
+ Implements the methods for TtfUtil class. This file should remain portable to any C++
+ environment by only using standard C++ and the TTF structurs defined in Tt.h.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+
+/***********************************************************************************************
+ Include files
+***********************************************************************************************/
+// Language headers
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <cstring>
+#include <climits>
+#include <stdexcept>
+// Platform headers
+// Module headers
+#include "TtfUtil.h"
+#include "TtfTypes.h"
+
+/***********************************************************************************************
+ Forward declarations
+***********************************************************************************************/
+
+/***********************************************************************************************
+ Local Constants and static variables
+***********************************************************************************************/
+// max number of components allowed in composite glyphs
+namespace
+{
+ const int kMaxGlyphComponents = 8;
+
+ // These are basic byte order swapping functions
+ template<typename T> inline T rev16(const T d) {
+ T r = (d & 0xff) << 8; r |= (d & 0xff00) >> 8;
+ return r;
+ }
+
+ template<typename T> inline T rev32(const T d) {
+ T r = (d & 0xff) << 24; r |= (d & 0xff00) << 8;
+ r |= (d & 0xff0000) >> 8; r |= (d & 0xff000000) >> 24;
+ return r;
+ }
+
+ // This is the generic read function which does the swapping
+ template<typename T> inline T read(const T d) {
+ return d;
+ }
+
+#if !defined WORDS_BIGENDIAN || defined PC_OS
+ template<> inline TtfUtil::uint16 read(const TtfUtil::uint16 d) {
+ return rev16(d);
+ }
+
+ template<> inline TtfUtil::int16 read(const TtfUtil::int16 d) {
+ return rev16(d);
+ }
+
+ template<> inline TtfUtil::uint32 read(const TtfUtil::uint32 d) {
+ return rev32(d);
+ }
+
+ template<> inline TtfUtil::int32 read(const TtfUtil::int32 d) {
+ return rev32(d);
+ }
+#endif
+
+ template <int R, typename T>
+ inline float fixed_to_float(const T f) {
+ return float(f)/float(2^R);
+ }
+
+#define MAKE_TAG(a,b,c,d) ((a << 24UL) + (b << 16UL) + (c << 8UL) + (d))
+ const gr::fontTableId32 mapIdToTag[] = {
+ MAKE_TAG('c','m','a','p'),
+ MAKE_TAG('c','v','t',' '),
+ MAKE_TAG('c','r','y','p'),
+ MAKE_TAG('h','e','a','d'),
+ MAKE_TAG('f','p','g','m'),
+ MAKE_TAG('g','d','i','r'),
+ MAKE_TAG('g','l','y','f'),
+ MAKE_TAG('h','d','m','x'),
+ MAKE_TAG('h','h','e','a'),
+ MAKE_TAG('h','m','t','x'),
+ MAKE_TAG('l','o','c','a'),
+ MAKE_TAG('k','e','r','n'),
+ MAKE_TAG('L','T','S','H'),
+ MAKE_TAG('m','a','x','p'),
+ MAKE_TAG('n','a','m','e'),
+ MAKE_TAG('O','S','/','2'),
+ MAKE_TAG('p','o','s','t'),
+ MAKE_TAG('p','r','e','p'),
+ MAKE_TAG('F','e','a','t'),
+ MAKE_TAG('G','l','a','t'),
+ MAKE_TAG('G','l','o','c'),
+ MAKE_TAG('S','i','l','f'),
+ MAKE_TAG('S','i','l','e'),
+ MAKE_TAG('S','i','l','l')
+ };
+
+
+/*----------------------------------------------------------------------------------------------
+ Table of standard Postscript glyph names. From Martin Hosken. Disagress with ttfdump.exe
+---------------------------------------------------------------------------------------------*/
+ const int kcPostNames = 258;
+
+ const char * rgPostName[kcPostNames] = {
+ ".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign",
+ "dollar", "percent", "ampersand", "quotesingle", "parenleft",
+ "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash",
+ "zero", "one", "two", "three", "four", "five", "six", "seven", "eight",
+ "nine", "colon", "semicolon", "less", "equal", "greater", "question",
+ "at", "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",
+ "bracketleft", "backslash", "bracketright", "asciicircum",
+ "underscore", "grave", "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", "braceleft", "bar", "braceright", "asciitilde",
+ "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis",
+ "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde",
+ "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis",
+ "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute",
+ "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave",
+ "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling",
+ "section", "bullet", "paragraph", "germandbls", "registered",
+ "copyright", "trademark", "acute", "dieresis", "notequal", "AE",
+ "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen",
+ "mu", "partialdiff", "summation", "product", "pi", "integral",
+ "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown",
+ "exclamdown", "logicalnot", "radical", "florin", "approxequal",
+ "Delta", "guillemotleft", "guillemotright", "ellipsis", "nonbreakingspace",
+ "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash",
+ "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide",
+ "lozenge", "ydieresis", "Ydieresis", "fraction", "currency",
+ "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered",
+ "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex",
+ "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute",
+ "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex",
+ "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi",
+ "circumflex", "tilde", "macron", "breve", "dotaccent", "ring",
+ "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash",
+ "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar", "Eth", "eth",
+ "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply",
+ "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter",
+ "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla",
+ "scedilla", "Cacute", "cacute", "Ccaron", "ccaron",
+ "dcroat" };
+
+}
+
+/***********************************************************************************************
+ Methods
+***********************************************************************************************/
+
+/* Note on error processing: The code guards against bad glyph ids being used to look up data
+in open ended tables (loca, hmtx). If the glyph id comes from a cmap this shouldn't happen
+but it seems prudent to check for user errors here. The code does assume that data obtained
+from the TTF file is valid otherwise (though the CheckTable method seeks to check for
+obvious problems that might accompany a change in table versions). For example an invalid
+offset in the loca table which could exceed the size of the glyf table is NOT trapped.
+Likewise if numberOf_LongHorMetrics in the hhea table is wrong, this will NOT be trapped,
+which could cause a lookup in the hmtx table to exceed the table length. Of course, TTF tables
+that are completely corrupt will cause unpredictable results. */
+
+/* Note on composite glyphs: Glyphs that have components that are themselves composites
+are not supported. IsDeepComposite can be used to test for this. False is returned from many
+of the methods in this cases. It is unclear how to build composite glyphs in some cases,
+so this code represents my best guess until test cases can be found. See notes on the high-
+level GlyfPoints method. */
+
+namespace TtfUtil
+{
+
+
+/*----------------------------------------------------------------------------------------------
+ Get offset and size of the offset table needed to find table directory
+ Return true if success, false otherwise
+ lSize excludes any table directory entries
+----------------------------------------------------------------------------------------------*/
+bool GetHeaderInfo(size_t & lOffset, size_t & lSize)
+{
+ lOffset = 0;
+ lSize = offsetof(Sfnt::OffsetSubTable, table_directory);
+ assert(sizeof(uint32) + 4*sizeof (uint16) == lSize);
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Check the offset table for expected data
+ Return true if success, false otherwise
+----------------------------------------------------------------------------------------------*/
+bool CheckHeader(const void * pHdr)
+{
+ const Sfnt::OffsetSubTable * pOffsetTable
+ = reinterpret_cast<const Sfnt::OffsetSubTable *>(pHdr);
+
+ return read(pOffsetTable->scaler_type) == Sfnt::OffsetSubTable::TrueTypeWin;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get offset and size of the table directory
+ Return true if successful, false otherwise
+----------------------------------------------------------------------------------------------*/
+bool GetTableDirInfo(const void * pHdr, size_t & lOffset, size_t & lSize)
+{
+ const Sfnt::OffsetSubTable * pOffsetTable
+ = reinterpret_cast<const Sfnt::OffsetSubTable *>(pHdr);
+
+ lOffset = offsetof(Sfnt::OffsetSubTable, table_directory);
+ lSize = read(pOffsetTable->num_tables)
+ * sizeof(Sfnt::OffsetSubTable::Entry);
+
+ return true;
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Get offset and size of the specified table
+ Return true if successful, false otherwise. On false, offset and size will be 0
+----------------------------------------------------------------------------------------------*/
+bool GetTableInfo(TableId ktiTableId, const void * pHdr, const void * pTableDir,
+ size_t & lOffset, size_t & lSize)
+{
+ gr::fontTableId32 lTableTag = TableIdTag(ktiTableId);
+ if (!lTableTag)
+ {
+ lOffset = 0;
+ lSize = 0;
+ return false;
+ }
+
+ const Sfnt::OffsetSubTable * pOffsetTable
+ = reinterpret_cast<const Sfnt::OffsetSubTable *>(pHdr);
+ const Sfnt::OffsetSubTable::Entry
+ * entry_itr = reinterpret_cast<const Sfnt::OffsetSubTable::Entry *>(
+ pTableDir),
+ * const dir_end = entry_itr + read(pOffsetTable->num_tables);
+
+ assert(read(pOffsetTable->num_tables) < 40);
+ if (read(pOffsetTable->num_tables) > 40)
+ return false;
+
+ for (;entry_itr != dir_end; ++entry_itr) // 40 - safe guard
+ {
+ if (read(entry_itr->tag) == lTableTag)
+ {
+ lOffset = read(entry_itr->offset);
+ lSize = read(entry_itr->length);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Check the specified table. Tests depend on the table type.
+ Return true if successful, false otherwise
+----------------------------------------------------------------------------------------------*/
+bool CheckTable(TableId ktiTableId, const void * pTable, size_t lTableSize)
+{
+ using namespace Sfnt;
+
+ switch(ktiTableId)
+ {
+ case ktiCmap: // cmap
+ {
+ const Sfnt::CharacterCodeMap * const pCmap
+ = reinterpret_cast<const Sfnt::CharacterCodeMap *>(pTable);
+ assert(read(pCmap->version) == 0);
+ return read(pCmap->version) == 0;
+ }
+
+ case ktiHead: // head
+ {
+ const Sfnt::FontHeader * const pHead
+ = reinterpret_cast<const Sfnt::FontHeader *>(pTable);
+ bool r = read(pHead->version) == OneFix
+ && read(pHead->magic_number) == FontHeader::MagicNumber
+ && read(pHead->glyph_data_format)
+ == FontHeader::GlypDataFormat
+ && (read(pHead->index_to_loc_format)
+ == FontHeader::ShortIndexLocFormat
+ || read(pHead->index_to_loc_format)
+ == FontHeader::LongIndexLocFormat)
+ && sizeof(FontHeader) <= lTableSize;
+ assert(r); return r;
+ }
+
+ case ktiPost: // post
+ {
+ const Sfnt::PostScriptGlyphName * const pPost
+ = reinterpret_cast<const Sfnt::PostScriptGlyphName *>(pTable);
+ const fixed format = read(pPost->format);
+ bool r = format == PostScriptGlyphName::Format1
+ || format == PostScriptGlyphName::Format2
+ || format == PostScriptGlyphName::Format3
+ || format == PostScriptGlyphName::Format25;
+ assert(r); return r;
+ }
+
+ case ktiHhea: // hhea
+ {
+ const Sfnt::HorizontalHeader * pHhea =
+ reinterpret_cast<const Sfnt::HorizontalHeader *>(pTable);
+ bool r = read(pHhea->version) == OneFix
+ && read(pHhea->metric_data_format) == 0
+ && sizeof (Sfnt::HorizontalHeader) <= lTableSize;
+ assert(r); return r;
+ }
+
+ case ktiMaxp: // maxp
+ {
+ const Sfnt::MaximumProfile * pMaxp =
+ reinterpret_cast<const Sfnt::MaximumProfile *>(pTable);
+ bool r = read(pMaxp->version) == OneFix
+ && sizeof(Sfnt::MaximumProfile) <= lTableSize;
+ assert(r); return r;
+ }
+
+ case ktiOs2: // OS/2
+ {
+ const Sfnt::Compatibility * pOs2
+ = reinterpret_cast<const Sfnt::Compatibility *>(pTable);
+ if (read(pOs2->version) == 0)
+ { // OS/2 table version 1 size
+// if (sizeof(Sfnt::Compatibility)
+// - sizeof(uint32)*2 - sizeof(int16)*2
+// - sizeof(uint16)*3 <= lTableSize)
+ if (sizeof(Sfnt::Compatibility0) <= lTableSize)
+ return true;
+ }
+ else if (read(pOs2->version) == 1)
+ { // OS/2 table version 2 size
+// if (sizeof(Sfnt::Compatibility)
+// - sizeof(int16) *2
+// - sizeof(uint16)*3 <= lTableSize)
+ if (sizeof(Sfnt::Compatibility1) <= lTableSize)
+ return true;
+ }
+ else if (read(pOs2->version) == 2)
+ { // OS/2 table version 3 size
+ if (sizeof(Sfnt::Compatibility2) <= lTableSize)
+ return true;
+ }
+ else if (read(pOs2->version) == 3)
+ { // OS/2 table version 4 size - version 4 changed the meaning of some fields which we don't use
+ if (sizeof(Sfnt::Compatibility3) <= lTableSize)
+ return true;
+ }
+ else
+ return false;
+ }
+
+ case ktiName:
+ {
+ const Sfnt::FontNames * pName
+ = reinterpret_cast<const Sfnt::FontNames *>(pTable);
+ assert(read(pName->format) == 0);
+ return read(pName->format) == 0;
+ }
+
+ default:
+ break;
+ }
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the number of glyphs in the font. Should never be less than zero.
+----------------------------------------------------------------------------------------------*/
+size_t GlyphCount(const void * pMaxp)
+{
+ const Sfnt::MaximumProfile * pTable =
+ reinterpret_cast<const Sfnt::MaximumProfile *>(pMaxp);
+ return read(pTable->num_glyphs);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the maximum number of components for any composite glyph in the font
+----------------------------------------------------------------------------------------------*/
+size_t MaxCompositeComponentCount(const void * pMaxp)
+{
+ const Sfnt::MaximumProfile * pTable =
+ reinterpret_cast<const Sfnt::MaximumProfile *>(pMaxp);
+ return read(pTable->max_component_elements);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Composite glyphs can be composed of glyphs that are themselves composites.
+ This method returns the maximum number of levels like this for any glyph in the font.
+ A non-composite glyph has a level of 1
+----------------------------------------------------------------------------------------------*/
+size_t MaxCompositeLevelCount(const void * pMaxp)
+{
+ const Sfnt::MaximumProfile * pTable =
+ reinterpret_cast<const Sfnt::MaximumProfile *>(pMaxp);
+ return read(pTable->max_component_depth);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the number of glyphs in the font according to a differt source.
+ Should never be less than zero. Return -1 on failure.
+----------------------------------------------------------------------------------------------*/
+size_t LocaGlyphCount(size_t lLocaSize, const void * pHead) throw(std::domain_error)
+{
+
+ const Sfnt::FontHeader * pTable
+ = reinterpret_cast<const Sfnt::FontHeader *>(pHead);
+
+ if (read(pTable->index_to_loc_format)
+ == Sfnt::FontHeader::ShortIndexLocFormat)
+ // loca entries are two bytes and have been divided by two
+ return (lLocaSize >> 1) - 1;
+
+ if (read(pTable->index_to_loc_format)
+ == Sfnt::FontHeader::LongIndexLocFormat)
+ // loca entries are four bytes
+ return (lLocaSize >> 2) - 1;
+
+ //return -1;
+ throw std::domain_error("head table in inconsistent state. The font may be corrupted");
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the design units the font is designed with
+----------------------------------------------------------------------------------------------*/
+int DesignUnits(const void * pHead)
+{
+ const Sfnt::FontHeader * pTable =
+ reinterpret_cast<const Sfnt::FontHeader *>(pHead);
+
+ return read(pTable->units_per_em);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the checksum from the head table, which serves as a unique identifer for the font.
+----------------------------------------------------------------------------------------------*/
+int HeadTableCheckSum(const void * pHead)
+{
+ const Sfnt::FontHeader * pTable =
+ reinterpret_cast<const Sfnt::FontHeader *>(pHead);
+
+ return read(pTable->check_sum_adjustment);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the create time from the head table. This consists of a 64-bit integer, which
+ we return here as two 32-bit integers.
+----------------------------------------------------------------------------------------------*/
+void HeadTableCreateTime(const void * pHead,
+ unsigned int * pnDateBC, unsigned int * pnDateAD)
+{
+ const Sfnt::FontHeader * pTable =
+ reinterpret_cast<const Sfnt::FontHeader *>(pHead);
+
+ *pnDateBC = read(pTable->created[0]);
+ *pnDateAD = read(pTable->created[1]);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the modify time from the head table.This consists of a 64-bit integer, which
+ we return here as two 32-bit integers.
+----------------------------------------------------------------------------------------------*/
+void HeadTableModifyTime(const void * pHead,
+ unsigned int * pnDateBC, unsigned int *pnDateAD)
+{
+ const Sfnt::FontHeader * pTable =
+ reinterpret_cast<const Sfnt::FontHeader *>(pHead);
+
+ *pnDateBC = read(pTable->modified[0]);
+ *pnDateAD = read(pTable->modified[1]);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if the font is italic.
+----------------------------------------------------------------------------------------------*/
+bool IsItalic(const void * pHead)
+{
+ const Sfnt::FontHeader * pTable =
+ reinterpret_cast<const Sfnt::FontHeader *>(pHead);
+
+ return read(((pTable->mac_style) & 0x00000002) != 0);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the ascent for the font
+----------------------------------------------------------------------------------------------*/
+int FontAscent(const void * pOs2)
+{
+ const Sfnt::Compatibility * pTable = reinterpret_cast<const Sfnt::Compatibility *>(pOs2);
+
+ return read(pTable->win_ascent);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the descent for the font
+----------------------------------------------------------------------------------------------*/
+int FontDescent(const void * pOs2)
+{
+ const Sfnt::Compatibility * pTable = reinterpret_cast<const Sfnt::Compatibility *>(pOs2);
+
+ return read(pTable->win_descent);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the bold and italic style bits.
+ Return true if successful. false otherwise.
+ In addition to checking the OS/2 table, one could also check
+ the head table's macStyle field (overridden by the OS/2 table on Win)
+ the sub-family name in the name table (though this can contain oblique, dark, etc too)
+----------------------------------------------------------------------------------------------*/
+bool FontOs2Style(const void *pOs2, bool & fBold, bool & fItalic)
+{
+ const Sfnt::Compatibility * pTable = reinterpret_cast<const Sfnt::Compatibility *>(pOs2);
+
+ fBold = (read(pTable->fs_selection) & Sfnt::Compatibility::Bold) != 0;
+ fItalic = (read(pTable->fs_selection) & Sfnt::Compatibility::Italic) != 0;
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Method for searching name table.
+----------------------------------------------------------------------------------------------*/
+bool GetNameInfo(const void * pName, int nPlatformId, int nEncodingId,
+ int nLangId, int nNameId, size_t & lOffset, size_t & lSize)
+{
+ lOffset = 0;
+ lSize = 0;
+
+ const Sfnt::FontNames * pTable = reinterpret_cast<const Sfnt::FontNames *>(pName);
+ uint16 cRecord = read(pTable->count);
+ uint16 nRecordOffset = read(pTable->string_offset);
+ const Sfnt::NameRecord * pRecord = reinterpret_cast<const Sfnt::NameRecord *>(pTable + 1);
+
+ for (int i = 0; i < cRecord; ++i)
+ {
+ if (read(pRecord->platform_id) == nPlatformId &&
+ read(pRecord->platform_specific_id) == nEncodingId &&
+ read(pRecord->language_id) == nLangId &&
+ read(pRecord->name_id) == nNameId)
+ {
+ lOffset = read(pRecord->offset) + nRecordOffset;
+ lSize = read(pRecord->length);
+ return true;
+ }
+ pRecord++;
+ }
+
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return all the lang-IDs that have data for the given name-IDs. Assume that there is room
+ in the return array (langIdList) for 128 items. The purpose of this method is to return
+ a list of all possible lang-IDs.
+----------------------------------------------------------------------------------------------*/
+int GetLangsForNames(const void * pName, int nPlatformId, int nEncodingId,
+ int * nameIdList, int cNameIds, short * langIdList)
+{
+ const Sfnt::FontNames * pTable = reinterpret_cast<const Sfnt::FontNames *>(pName);
+ uint16 cRecord = read(pTable->count);
+ //uint16 nRecordOffset = swapw(pTable->stringOffset);
+ const Sfnt::NameRecord * pRecord = reinterpret_cast<const Sfnt::NameRecord *>(pTable + 1);
+
+ int cLangIds = 0;
+ for (int i = 0; i < cRecord; ++i)
+ {
+ if (read(pRecord->platform_id) == nPlatformId &&
+ read(pRecord->platform_specific_id) == nEncodingId)
+ {
+ bool fNameFound = false;
+ int nLangId = read(pRecord->language_id);
+ int nNameId = read(pRecord->name_id);
+ for (int i = 0; i < cNameIds; i++)
+ {
+ if (nNameId == nameIdList[i])
+ {
+ fNameFound = true;
+ break;
+ }
+ }
+ if (fNameFound)
+ {
+ // Add it if it's not there.
+ int ilang;
+ for (ilang = 0; ilang < cLangIds; ilang++)
+ if (langIdList[ilang] == nLangId)
+ break;
+ if (ilang >= cLangIds)
+ {
+ langIdList[cLangIds] = short(nLangId);
+ cLangIds++;
+ }
+ if (cLangIds == 128)
+ return cLangIds;
+ }
+ }
+ pRecord++;
+ }
+
+ return cLangIds;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the offset and size of the font family name in English for the MS Platform with Unicode
+ writing system. The offset is within the pName data. The string is double byte with MSB first.
+----------------------------------------------------------------------------------------------*/
+bool Get31EngFamilyInfo(const void * pName, size_t & lOffset, size_t & lSize)
+{
+ return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 1, 1033,
+ Sfnt::NameRecord::Family, lOffset, lSize);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the offset and size of the full font name in English for the MS Platform with Unicode
+ writing system. The offset is within the pName data. The string is double byte with MSB first.
+----------------------------------------------------------------------------------------------*/
+bool Get31EngFullFontInfo(const void * pName, size_t & lOffset, size_t & lSize)
+{
+ return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 1, 1033,
+ Sfnt::NameRecord::Fullname, lOffset, lSize);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the offset and size of the font family name in English for the MS Platform with Symbol
+ writing system. The offset is within the pName data. The string is double byte with MSB first.
+----------------------------------------------------------------------------------------------*/
+bool Get30EngFamilyInfo(const void * pName, size_t & lOffset, size_t & lSize)
+{
+ return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 0, 1033,
+ Sfnt::NameRecord::Family, lOffset, lSize);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the offset and size of the full font name in English for the MS Platform with Symbol
+ writing system. The offset is within the pName data. The string is double byte with MSB first.
+----------------------------------------------------------------------------------------------*/
+bool Get30EngFullFontInfo(const void * pName, size_t & lOffset, size_t & lSize)
+{
+ return GetNameInfo(pName, Sfnt::NameRecord::Microsoft, 0, 1033,
+ Sfnt::NameRecord::Fullname, lOffset, lSize);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the Glyph ID for a given Postscript name. This method finds the first glyph which
+ matches the requested Postscript name. Ideally every glyph should have a unique Postscript
+ name (except for special names such as .notdef), but this is not always true.
+ On failure return value less than zero.
+ -1 - table search failed
+ -2 - format 3 table (no Postscript glyph info)
+ -3 - other failures
+----------------------------------------------------------------------------------------------*/
+int PostLookup(const void * pPost, size_t lPostSize, const void * pMaxp,
+ const char * pPostName)
+{
+ using namespace Sfnt;
+
+ const Sfnt::PostScriptGlyphName * pTable
+ = reinterpret_cast<const Sfnt::PostScriptGlyphName *>(pPost);
+ fixed format = read(pTable->format);
+
+ if (format == PostScriptGlyphName::Format3)
+ { // format 3 - no Postscript glyph info in font
+ return -2;
+ }
+
+ // search for given Postscript name among the standard names
+ int iPostName = -1; // index in standard names
+ for (int i = 0; i < kcPostNames; i++)
+ {
+ if (!strcmp(pPostName, rgPostName[i]))
+ {
+ iPostName = i;
+ break;
+ }
+ }
+
+ if (format == PostScriptGlyphName::Format1)
+ { // format 1 - use standard Postscript names
+ return iPostName;
+ }
+
+ if (format == PostScriptGlyphName::Format25)
+ {
+ if (iPostName == -1)
+ return -1;
+
+ const PostScriptGlyphName25 * pTable25
+ = static_cast<const PostScriptGlyphName25 *>(pTable);
+ int cnGlyphs = GlyphCount(pMaxp);
+ for (gr::gid16 nGlyphId = 0; nGlyphId < cnGlyphs && nGlyphId < kcPostNames;
+ nGlyphId++)
+ { // glyph_name_index25 contains bytes so no byte swapping needed
+ // search for first glyph id that uses the standard name
+ if (nGlyphId + pTable25->offset[nGlyphId] == iPostName)
+ return nGlyphId;
+ }
+ }
+
+ if (format == PostScriptGlyphName::Format2)
+ { // format 2
+ const PostScriptGlyphName2 * pTable2
+ = static_cast<const PostScriptGlyphName2 *>(pTable);
+
+ int cnGlyphs = read(pTable2->number_of_glyphs);
+
+ if (iPostName != -1)
+ { // did match a standard name, look for first glyph id mapped to that name
+ for (gr::gid16 nGlyphId = 0; nGlyphId < cnGlyphs; nGlyphId++)
+ {
+ if (read(pTable2->glyph_name_index[nGlyphId]) == iPostName)
+ return nGlyphId;
+ }
+ return -1; // no glyph with this standard name
+ }
+
+ else
+ { // did not match a standard name, search font specific names
+ size_t nStrSizeGoal = strlen(pPostName);
+ const char * pFirstGlyphName = reinterpret_cast<const char *>(
+ &pTable2->glyph_name_index[0] + cnGlyphs);
+ const char * pGlyphName = pFirstGlyphName;
+ int iInNames = 0; // index in font specific names
+ bool fFound = false;
+ const char * const endOfTable
+ = reinterpret_cast<const char *>(pTable2) + lPostSize;
+ while (pGlyphName < endOfTable && !fFound)
+ { // search Pascal strings for first matching name
+ size_t nStringSize = size_t(*pGlyphName);
+ if (nStrSizeGoal != nStringSize ||
+ strncmp(pGlyphName + 1, pPostName, nStringSize))
+ { // did not match
+ ++iInNames;
+ pGlyphName += nStringSize + 1;
+ }
+ else
+ { // did match
+ fFound = true;
+ }
+ }
+ if (!fFound)
+ return -1; // no font specific name matches request
+
+ iInNames += kcPostNames;
+ for (gr::gid16 nGlyphId = 0; nGlyphId < cnGlyphs; nGlyphId++)
+ { // search for first glyph id that maps to the found string index
+ if (read(pTable2->glyph_name_index[nGlyphId]) == iInNames)
+ return nGlyphId;
+ }
+ return -1; // no glyph mapped to this index (very strange)
+ }
+ }
+
+ return -3;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Convert a Unicode character string from big endian (MSB first, Motorola) format to little
+ endian (LSB first, Intel) format.
+ nSize is the number of Unicode characters in the string. It should not include any
+ terminating null. If nSize is 0, it is assumed the string is null terminated. nSize
+ defaults to 0.
+ Return true if successful, false otherwise.
+----------------------------------------------------------------------------------------------*/
+void SwapWString(void * pWStr, size_t nSize /* = 0 */) throw (std::invalid_argument)
+{
+ if (pWStr == 0)
+ throw std::invalid_argument("null pointer given");
+
+ uint16 * pStr = reinterpret_cast<uint16 *>(pWStr);
+ uint16 * const pStrEnd = pStr + (nSize == 0 ? gr::utf16len(pStr) : nSize);
+
+ std::transform(pStr, pStrEnd, pStr, read<uint16>);
+
+// for (int i = 0; i < nSize; i++)
+// { // swap the wide characters in the string
+// pStr[i] = gr::utf16(read(uint16(pStr[i])));
+// }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the left-side bearing and and advance width based on the given tables and Glyph ID
+ Return true if successful, false otherwise. On false, one or both value could be INT_MIN
+----------------------------------------------------------------------------------------------*/
+bool HorMetrics(gr::gid16 nGlyphId, const void * pHmtx, size_t lHmtxSize, const void * pHhea,
+ int & nLsb, unsigned int & nAdvWid)
+{
+ const Sfnt::HorizontalMetric * phmtx =
+ reinterpret_cast<const Sfnt::HorizontalMetric *>(pHmtx);
+
+ const Sfnt::HorizontalHeader * phhea =
+ reinterpret_cast<const Sfnt::HorizontalHeader *>(pHhea);
+
+ size_t cLongHorMetrics = read(phhea->num_long_hor_metrics);
+ if (nGlyphId < cLongHorMetrics)
+ { // glyph id is acceptable
+ nAdvWid = read(phmtx[nGlyphId].advance_width);
+ nLsb = read(phmtx[nGlyphId].left_side_bearing);
+ }
+ else
+ {
+ nAdvWid = read(phmtx[cLongHorMetrics - 1].advance_width);
+
+ // guard against bad glyph id
+ size_t lLsbOffset = sizeof(Sfnt::HorizontalMetric) * cLongHorMetrics +
+ sizeof(int16) * (nGlyphId - cLongHorMetrics); // offset in bytes
+ if (lLsbOffset + 1 >= lHmtxSize) // + 1 because entries are two bytes wide
+ {
+ nLsb = 0;
+ return false;
+ }
+ const int16 * pLsb = reinterpret_cast<const int16 *>(phmtx) +
+ lLsbOffset / sizeof(int16);
+ nLsb = read(*pLsb);
+ }
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return a pointer to the requested cmap subtable. By default find the Microsoft Unicode
+ subtable. Pass nEncoding as -1 to find first table that matches only nPlatformId.
+ Return NULL if the subtable cannot be found.
+----------------------------------------------------------------------------------------------*/
+void * FindCmapSubtable(const void * pCmap,
+ int nPlatformId, /* =3 */
+ int nEncodingId) /* = 1 */
+{
+ const Sfnt::CharacterCodeMap * pTable =
+ reinterpret_cast<const Sfnt::CharacterCodeMap *>(pCmap);
+
+ uint16 csuPlatforms = read(pTable->num_subtables);
+ for (int i = 0; i < csuPlatforms; i++)
+ {
+ if (read(pTable->encoding[i].platform_id) == nPlatformId &&
+ (nEncodingId == -1 || read(pTable->encoding[i].platform_specific_id) == nEncodingId))
+ {
+ const void * pRtn = reinterpret_cast<const uint8 *>(pCmap) +
+ read(pTable->encoding[i].offset);
+ return const_cast<void *>(pRtn);
+ }
+ }
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Check the Microsoft Unicode subtable for expected values
+----------------------------------------------------------------------------------------------*/
+bool CheckCmap31Subtable(const void * pCmap31)
+{
+ const Sfnt::CmapSubTable * pTable = reinterpret_cast<const Sfnt::CmapSubTable *>(pCmap31);
+ // Bob H says ome freeware TT fonts have version 1 (eg, CALIGULA.TTF)
+ // so don't check subtable version. 21 Mar 2002 spec changes version to language.
+
+ return read(pTable->format) == 4;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the Glyph ID for the given Unicode ID in the Microsoft Unicode subtable.
+ (Actually this code only depends on subtable being format 4.)
+ Return 0 if the Unicode ID is not in the subtable.
+----------------------------------------------------------------------------------------------*/
+gr::gid16 Cmap31Lookup(const void * pCmap31, int nUnicodeId)
+{
+ const Sfnt::CmapSubTableFormat4 * pTable = reinterpret_cast<const Sfnt::CmapSubTableFormat4 *>(pCmap31);
+
+ uint16 nSeg = read(pTable->seg_count_x2) >> 1;
+
+ uint16 n;
+ const uint16 * pLeft, * pMid;
+ uint16 cMid, chStart, chEnd;
+
+ // Binary search of the endCode[] array
+ pLeft = &(pTable->end_code[0]);
+ n = nSeg;
+ while (n > 0)
+ {
+ cMid = n >> 1; // Pick an element in the middle
+ pMid = pLeft + cMid;
+ chEnd = read(*pMid);
+ if (nUnicodeId <= chEnd)
+ {
+ if (cMid == 0 || nUnicodeId > read(pMid[-1]))
+ break; // Must be this seg or none!
+ n = cMid; // Continue on left side, omitting mid point
+ }
+ else
+ {
+ pLeft = pMid + 1; // Continue on right side, omitting mid point
+ n -= (cMid + 1);
+ }
+ }
+
+ if (!n)
+ return 0;
+
+ // Ok, we're down to one segment and pMid points to the endCode element
+ // Either this is it or none is.
+
+ chStart = read(*(pMid += nSeg + 1));
+ if (chEnd >= nUnicodeId && nUnicodeId >= chStart)
+ {
+ // Found correct segment. Find Glyph Id
+ int16 idDelta = read(*(pMid += nSeg));
+ uint16 idRangeOffset = read(*(pMid += nSeg));
+
+ if (idRangeOffset == 0)
+ return (uint16)(idDelta + nUnicodeId); // must use modulus 2^16
+
+ // Look up value in glyphIdArray
+ gr::gid16 nGlyphId = read(*(pMid + (nUnicodeId - chStart) + (idRangeOffset >> 1)));
+ // If this value is 0, return 0. Else add the idDelta
+ return nGlyphId ? nGlyphId + idDelta : 0;
+ }
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the next Unicode value in the cmap. Pass 0 to obtain the first item.
+ Returns 0xFFFF as the last item.
+ pRangeKey is an optional key that is used to optimize the search; its value is the range
+ in which the character is found.
+----------------------------------------------------------------------------------------------*/
+unsigned int Cmap31NextCodepoint(const void *pCmap31, unsigned int nUnicodeId, int * pRangeKey)
+{
+ const Sfnt::CmapSubTableFormat4 * pTable = reinterpret_cast<const Sfnt::CmapSubTableFormat4 *>(pCmap31);
+
+ uint16 nRange = read(pTable->seg_count_x2) >> 1;
+
+ uint32 nUnicodePrev = (uint32)nUnicodeId;
+
+ const uint16 * pStartCode = &(pTable->end_code[0])
+ + nRange // length of end code array
+ + 1; // reserved word
+
+ if (nUnicodePrev == 0)
+ {
+ // return the first codepoint.
+ if (pRangeKey)
+ *pRangeKey = 0;
+ return read(pStartCode[0]);
+ }
+ else if (nUnicodePrev >= 0xFFFF)
+ {
+ if (pRangeKey)
+ *pRangeKey = nRange - 1;
+ return 0xFFFF;
+ }
+
+ int iRange = (pRangeKey) ? *pRangeKey : 0;
+ // Just in case we have a bad key:
+ while (iRange > 0 && read(pStartCode[iRange]) > nUnicodePrev)
+ iRange--;
+ while (read(pTable->end_code[iRange]) < nUnicodePrev)
+ iRange++;
+
+ // Now iRange is the range containing nUnicodePrev.
+ unsigned int nStartCode = read(pStartCode[iRange]);
+ unsigned int nEndCode = read(pTable->end_code[iRange]);
+
+ if (nStartCode > nUnicodePrev)
+ // Oops, nUnicodePrev is not in the cmap! Adjust so we get a reasonable
+ // answer this time around.
+ nUnicodePrev = nStartCode - 1;
+
+ if (nEndCode > nUnicodePrev)
+ {
+ // Next is in the same range; it is the next successive codepoint.
+ if (pRangeKey)
+ *pRangeKey = iRange;
+ return nUnicodePrev + 1;
+ }
+
+ // Otherwise the next codepoint is the first one in the next range.
+ // There is guaranteed to be a next range because there must be one that
+ // ends with 0xFFFF.
+ if (pRangeKey)
+ *pRangeKey = iRange + 1;
+ return read(pStartCode[iRange + 1]);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Check the Microsoft UCS-4 subtable for expected values
+----------------------------------------------------------------------------------------------*/
+bool CheckCmap310Subtable(const void *pCmap310)
+{
+ const Sfnt::CmapSubTable * pTable = reinterpret_cast<const Sfnt::CmapSubTable *>(pCmap310);
+ return read(pTable->format) == 12;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the Glyph ID for the given Unicode ID in the Microsoft UCS-4 subtable.
+ (Actually this code only depends on subtable being format 12.)
+ Return 0 if the Unicode ID is not in the subtable.
+----------------------------------------------------------------------------------------------*/
+gr::gid16 Cmap310Lookup(const void * pCmap310, unsigned int uUnicodeId)
+{
+ const Sfnt::CmapSubTableFormat12 * pTable = reinterpret_cast<const Sfnt::CmapSubTableFormat12 *>(pCmap310);
+
+ //uint32 uLength = read(pTable->length); //could use to test for premature end of table
+ uint32 ucGroups = read(pTable->num_groups);
+
+ for (unsigned int i = 0; i < ucGroups; i++)
+ {
+ uint32 uStartCode = read(pTable->group[i].start_char_code);
+ uint32 uEndCode = read(pTable->group[i].end_char_code);
+ if (uUnicodeId >= uStartCode && uUnicodeId <= uEndCode)
+ {
+ uint32 uDiff = uUnicodeId - uStartCode;
+ uint32 uStartGid = read(pTable->group[i].start_glyph_id);
+ return static_cast<gr::gid16>(uStartGid + uDiff);
+ }
+ }
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the next Unicode value in the cmap. Pass 0 to obtain the first item.
+ Returns 0x10FFFF as the last item.
+ pRangeKey is an optional key that is used to optimize the search; its value is the range
+ in which the character is found.
+----------------------------------------------------------------------------------------------*/
+unsigned int Cmap310NextCodepoint(const void *pCmap310, unsigned int nUnicodeId, int * pRangeKey)
+{
+ const Sfnt::CmapSubTableFormat12 * pTable = reinterpret_cast<const Sfnt::CmapSubTableFormat12 *>(pCmap310);
+
+ int nRange = read(pTable->num_groups);
+
+ uint32 nUnicodePrev = (uint32)nUnicodeId;
+
+ if (nUnicodePrev == 0)
+ {
+ // return the first codepoint.
+ if (pRangeKey)
+ *pRangeKey = 0;
+ return read(pTable->group[0].start_char_code);
+ }
+ else if (nUnicodePrev >= 0x10FFFF)
+ {
+ if (pRangeKey)
+ *pRangeKey = nRange;
+ return 0x10FFFF;
+ }
+
+ int iRange = (pRangeKey) ? *pRangeKey : 0;
+ // Just in case we have a bad key:
+ while (iRange > 0 && read(pTable->group[iRange].start_char_code) > nUnicodePrev)
+ iRange--;
+ while (read(pTable->group[iRange].end_char_code) < nUnicodePrev)
+ iRange++;
+
+ // Now iRange is the range containing nUnicodePrev.
+
+ unsigned int nStartCode = read(pTable->group[iRange].start_char_code);
+ unsigned int nEndCode = read(pTable->group[iRange].end_char_code);
+
+ if (nStartCode > nUnicodePrev)
+ // Oops, nUnicodePrev is not in the cmap! Adjust so we get a reasonable
+ // answer this time around.
+ nUnicodePrev = nStartCode - 1;
+
+ if (nEndCode > nUnicodePrev)
+ {
+ // Next is in the same range; it is the next successive codepoint.
+ if (pRangeKey)
+ *pRangeKey = iRange;
+ return nUnicodePrev + 1;
+ }
+
+ // Otherwise the next codepoint is the first one in the next range, or 10FFFF if we're done.
+ if (pRangeKey)
+ *pRangeKey = iRange + 1;
+ return (iRange + 1 >= nRange) ? 0x10FFFF : read(pTable->group[iRange + 1].start_char_code);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the offset stored in the loca table for the given Glyph ID.
+ (This offset is into the glyf table.)
+ Return -1 if the lookup failed.
+ Technically this method should return an unsigned long but it is unlikely the offset will
+ exceed 2^31.
+----------------------------------------------------------------------------------------------*/
+size_t LocaLookup(gr::gid16 nGlyphId,
+ const void * pLoca, size_t lLocaSize,
+ const void * pHead) throw (std::out_of_range)
+{
+ const Sfnt::FontHeader * pTable = reinterpret_cast<const Sfnt::FontHeader *>(pHead);
+
+ // CheckTable verifies the index_to_loc_format is valid
+ if (read(pTable->index_to_loc_format) == Sfnt::FontHeader::ShortIndexLocFormat)
+ { // loca entries are two bytes and have been divided by two
+ if (nGlyphId <= (lLocaSize >> 1) - 1) // allow sentinel value to be accessed
+ {
+ const uint16 * pTable = reinterpret_cast<const uint16 *>(pLoca);
+ return (read(pTable[nGlyphId]) << 1);
+ }
+ }
+
+ if (read(pTable->index_to_loc_format) == Sfnt::FontHeader::LongIndexLocFormat)
+ { // loca entries are four bytes
+ if (nGlyphId <= (lLocaSize >> 2) - 1)
+ {
+ const uint32 * pTable = reinterpret_cast<const uint32 *>(pLoca);
+ return read(pTable[nGlyphId]);
+ }
+ }
+
+ // only get here if glyph id was bad
+ //return -1;
+ throw std::out_of_range("glyph id out of range for font");
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return a pointer into the glyf table based on the given offset (from LocaLookup).
+ Return NULL on error.
+----------------------------------------------------------------------------------------------*/
+void * GlyfLookup(const void * pGlyf, size_t nGlyfOffset)
+{
+ const uint8 * pByte = reinterpret_cast<const uint8 *>(pGlyf);
+ return const_cast<uint8 *>(pByte + nGlyfOffset);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the bounding box coordinates for a simple glyf entry (non-composite)
+ Return true if successful, false otherwise
+----------------------------------------------------------------------------------------------*/
+bool GlyfBox(const void * pSimpleGlyf, int & xMin, int & yMin,
+ int & xMax, int & yMax)
+{
+ const Sfnt::Glyph * pGlyph = reinterpret_cast<const Sfnt::Glyph *>(pSimpleGlyf);
+
+ xMin = read(pGlyph->x_min);
+ yMin = read(pGlyph->y_min);
+ xMax = read(pGlyph->x_max);
+ yMax = read(pGlyph->y_max);
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the number of contours for a simple glyf entry (non-composite)
+ Returning -1 means this is a composite glyph
+----------------------------------------------------------------------------------------------*/
+int GlyfContourCount(const void * pSimpleGlyf)
+{
+ const Sfnt::Glyph * pGlyph = reinterpret_cast<const Sfnt::Glyph *>(pSimpleGlyf);
+ return read(pGlyph->number_of_contours); // -1 means composite glyph
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the point numbers for the end points of the glyph contours for a simple
+ glyf entry (non-composite).
+ cnPointsTotal - count of contours from GlyfContourCount(); (same as number of end points)
+ prgnContourEndPoints - should point to a buffer large enough to hold cnPoints integers
+ cnPoints - count of points placed in above range
+ Return true if successful, false otherwise.
+ False could indicate a multi-level composite glyphs.
+----------------------------------------------------------------------------------------------*/
+bool GlyfContourEndPoints(const void * pSimpleGlyf, int * prgnContourEndPoint,
+ int cnPointsTotal, int & cnPoints)
+{
+ const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast<const Sfnt::SimpleGlyph *>(pSimpleGlyf);
+
+ int cContours = read(pGlyph->number_of_contours);
+ if (cContours < 0)
+ return false; // this method isn't supposed handle composite glyphs
+
+ for (int i = 0; i < cContours && i < cnPointsTotal; i++)
+ {
+ prgnContourEndPoint[i] = read(pGlyph->end_pts_of_contours[i]);
+ }
+
+ cnPoints = cContours;
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the points for a simple glyf entry (non-composite)
+ cnPointsTotal - count of points from largest end point obtained from GlyfContourEndPoints
+ prgnX & prgnY - should point to buffers large enough to hold cnPointsTotal integers
+ The ranges are parallel so that coordinates for point(n) are found at offset n in both
+ ranges. This is raw point data with relative coordinates.
+ prgbFlag - should point to a buffer a large enough to hold cnPointsTotal bytes
+ This range is parallel to the prgnX & prgnY
+ cnPoints - count of points placed in above ranges
+ Return true if successful, false otherwise.
+ False could indicate a composite glyph
+ TODO: implement
+----------------------------------------------------------------------------------------------*/
+bool GlyfPoints(const void * pSimpleGlyf, int * prgnX, int * prgnY,
+ char * prgbFlag, int cnPointsTotal, int & cnPoints)
+{
+ using namespace Sfnt;
+
+ const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast<const Sfnt::SimpleGlyph *>(pSimpleGlyf);
+ int cContours = read(pGlyph->number_of_contours);
+ // return false for composite glyph
+ if (cContours <= 0)
+ return false;
+ int cPts = read(pGlyph->end_pts_of_contours[cContours - 1]) + 1;
+ if (cPts > cnPointsTotal)
+ return false;
+
+ // skip over bounding box data & point to byte count of instructions (hints)
+ const uint8 * pbGlyph = reinterpret_cast<const uint8 *>
+ (&pGlyph->end_pts_of_contours[cContours]);
+
+ // skip over hints & point to first flag
+ int cbHints = read(*(uint16 *)pbGlyph);
+ pbGlyph += sizeof(uint16);
+ pbGlyph += cbHints;
+
+ // load flags & point to first x coordinate
+ int iFlag = 0;
+ while (iFlag < cPts)
+ {
+ if (!(*pbGlyph & SimpleGlyph::Repeat))
+ { // flag isn't repeated
+ prgbFlag[iFlag] = (char)*pbGlyph;
+ pbGlyph++;
+ iFlag++;
+ }
+ else
+ { // flag is repeated; count specified by next byte
+ char chFlag = (char)*pbGlyph;
+ pbGlyph++;
+ int cFlags = (int)*pbGlyph;
+ pbGlyph++;
+ prgbFlag[iFlag] = chFlag;
+ iFlag++;
+ for (int i = 0; i < cFlags; i++)
+ {
+ prgbFlag[iFlag + i] = chFlag;
+ }
+ iFlag += cFlags;
+ }
+ }
+ if (iFlag != cPts)
+ return false;
+
+ // load x coordinates
+ iFlag = 0;
+ while (iFlag < cPts)
+ {
+ if (prgbFlag[iFlag] & SimpleGlyph::XShort)
+ {
+ prgnX[iFlag] = *pbGlyph;
+ if (!(prgbFlag[iFlag] & SimpleGlyph::XIsPos))
+ {
+ prgnX[iFlag] = -prgnX[iFlag];
+ }
+ pbGlyph++;
+ }
+ else
+ {
+ if (prgbFlag[iFlag] & SimpleGlyph::XIsSame)
+ {
+ prgnX[iFlag] = 0;
+ // do NOT increment pbGlyph
+ }
+ else
+ {
+ prgnX[iFlag] = read(*(int16 *)pbGlyph);
+ pbGlyph += sizeof(int16);
+ }
+ }
+ iFlag++;
+ }
+
+ // load y coordinates
+ iFlag = 0;
+ while (iFlag < cPts)
+ {
+ if (prgbFlag[iFlag] & SimpleGlyph::YShort)
+ {
+ prgnY[iFlag] = *pbGlyph;
+ if (!(prgbFlag[iFlag] & SimpleGlyph::YIsPos))
+ {
+ prgnY[iFlag] = -prgnY[iFlag];
+ }
+ pbGlyph++;
+ }
+ else
+ {
+ if (prgbFlag[iFlag] & SimpleGlyph::YIsSame)
+ {
+ prgnY[iFlag] = 0;
+ // do NOT increment pbGlyph
+ }
+ else
+ {
+ prgnY[iFlag] = read(*(int16 *)pbGlyph);
+ pbGlyph += sizeof(int16);
+ }
+ }
+ iFlag++;
+ }
+
+ cnPoints = cPts;
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Fill prgnCompId with the component Glyph IDs from pSimpleGlyf.
+ Client must allocate space before calling.
+ pSimpleGlyf - assumed to point to a composite glyph
+ cCompIdTotal - the number of elements in prgnCompId
+ cCompId - the total number of Glyph IDs stored in prgnCompId
+ Return true if successful, false otherwise
+ False could indicate a non-composite glyph or the input array was not big enough
+----------------------------------------------------------------------------------------------*/
+bool GetComponentGlyphIds(const void * pSimpleGlyf, int * prgnCompId,
+ size_t cnCompIdTotal, size_t & cnCompId)
+{
+ using namespace Sfnt;
+
+ if (GlyfContourCount(pSimpleGlyf) >= 0)
+ return false;
+
+ const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast<const Sfnt::SimpleGlyph *>(pSimpleGlyf);
+ // for a composite glyph, the special data begins here
+ const uint8 * pbGlyph = reinterpret_cast<const uint8 *>(&pGlyph->end_pts_of_contours[0]);
+
+ uint16 GlyphFlags;
+ size_t iCurrentComp = 0;
+ do
+ {
+ GlyphFlags = read(*((uint16 *)pbGlyph));
+ pbGlyph += sizeof(uint16);
+ prgnCompId[iCurrentComp++] = read(*((uint16 *)pbGlyph));
+ pbGlyph += sizeof(uint16);
+ if (iCurrentComp >= cnCompIdTotal)
+ return false;
+ int nOffset = 0;
+ nOffset += GlyphFlags & CompoundGlyph::Arg1Arg2Words ? 4 : 2;
+ nOffset += GlyphFlags & CompoundGlyph::HaveScale ? 2 : 0;
+ nOffset += GlyphFlags & CompoundGlyph::HaveXAndYScale ? 4 : 0;
+ nOffset += GlyphFlags & CompoundGlyph::HaveTwoByTwo ? 8 : 0;
+ pbGlyph += nOffset;
+ } while (GlyphFlags & CompoundGlyph::MoreComponents);
+
+ cnCompId = iCurrentComp;
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return info on how a component glyph is to be placed
+ pSimpleGlyph - assumed to point to a composite glyph
+ nCompId - glyph id for component of interest
+ bOffset - if true, a & b are the x & y offsets for this component
+ if false, b is the point on this component that is attaching to point a on the
+ preceding glyph
+ Return true if successful, false otherwise
+ False could indicate a non-composite glyph or that component wasn't found
+----------------------------------------------------------------------------------------------*/
+bool GetComponentPlacement(const void * pSimpleGlyf, int nCompId,
+ bool fOffset, int & a, int & b)
+{
+ using namespace Sfnt;
+
+ if (GlyfContourCount(pSimpleGlyf) >= 0)
+ return false;
+
+ const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast<const Sfnt::SimpleGlyph *>(pSimpleGlyf);
+ // for a composite glyph, the special data begins here
+ const uint8 * pbGlyph = reinterpret_cast<const uint8 *>(&pGlyph->end_pts_of_contours[0]);
+
+ uint16 GlyphFlags;
+ do
+ {
+ GlyphFlags = read(*((uint16 *)pbGlyph));
+ pbGlyph += sizeof(uint16);
+ if (read(*((uint16 *)pbGlyph)) == nCompId)
+ {
+ pbGlyph += sizeof(uint16); // skip over glyph id of component
+ fOffset = (GlyphFlags & CompoundGlyph::ArgsAreXYValues) == CompoundGlyph::ArgsAreXYValues;
+
+ if (GlyphFlags & CompoundGlyph::Arg1Arg2Words )
+ {
+ a = read(*(int16 *)pbGlyph);
+ pbGlyph += sizeof(int16);
+ b = read(*(int16 *)pbGlyph);
+ pbGlyph += sizeof(int16);
+ }
+ else
+ { // args are signed bytes
+ a = *pbGlyph++;
+ b = *pbGlyph++;
+ }
+ return true;
+ }
+ pbGlyph += sizeof(uint16); // skip over glyph id of component
+ int nOffset = 0;
+ nOffset += GlyphFlags & CompoundGlyph::Arg1Arg2Words ? 4 : 2;
+ nOffset += GlyphFlags & CompoundGlyph::HaveScale ? 2 : 0;
+ nOffset += GlyphFlags & CompoundGlyph::HaveXAndYScale ? 4 : 0;
+ nOffset += GlyphFlags & CompoundGlyph::HaveTwoByTwo ? 8 : 0;
+ pbGlyph += nOffset;
+ } while (GlyphFlags & CompoundGlyph::MoreComponents);
+
+ // didn't find requested component
+ fOffset = true;
+ a = 0;
+ b = 0;
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return info on how a component glyph is to be transformed
+ pSimpleGlyph - assumed to point to a composite glyph
+ nCompId - glyph id for component of interest
+ flt11, flt11, flt11, flt11 - a 2x2 matrix giving the transform
+ bTransOffset - whether to transform the offset from above method
+ The spec is unclear about the meaning of this flag
+ Currently - initialize to true for MS rasterizer and false for Mac rasterizer, then
+ on return it will indicate whether transform should apply to offset (MSDN CD 10/99)
+ Return true if successful, false otherwise
+ False could indicate a non-composite glyph or that component wasn't found
+----------------------------------------------------------------------------------------------*/
+bool GetComponentTransform(const void * pSimpleGlyf, int nCompId,
+ float & flt11, float & flt12, float & flt21, float & flt22,
+ bool & fTransOffset)
+{
+ using namespace Sfnt;
+
+ if (GlyfContourCount(pSimpleGlyf) >= 0)
+ return false;
+
+ const Sfnt::SimpleGlyph * pGlyph = reinterpret_cast<const Sfnt::SimpleGlyph *>(pSimpleGlyf);
+ // for a composite glyph, the special data begins here
+ const uint8 * pbGlyph = reinterpret_cast<const uint8 *>(&pGlyph->end_pts_of_contours[0]);
+
+ uint16 GlyphFlags;
+ do
+ {
+ GlyphFlags = read(*((uint16 *)pbGlyph));
+ pbGlyph += sizeof(uint16);
+ if (read(*((uint16 *)pbGlyph)) == nCompId)
+ {
+ pbGlyph += sizeof(uint16); // skip over glyph id of component
+ pbGlyph += GlyphFlags & CompoundGlyph::Arg1Arg2Words ? 4 : 2; // skip over placement data
+
+ if (fTransOffset) // MS rasterizer
+ fTransOffset = !(GlyphFlags & CompoundGlyph::UnscaledOffset);
+ else // Apple rasterizer
+ fTransOffset = (GlyphFlags & CompoundGlyph::ScaledOffset) != 0;
+
+ if (GlyphFlags & CompoundGlyph::HaveScale)
+ {
+ flt11 = fixed_to_float<14>(read(*(uint16 *)pbGlyph));
+ pbGlyph += sizeof(uint16);
+ flt12 = 0;
+ flt21 = 0;
+ flt22 = flt11;
+ }
+ else if (GlyphFlags & CompoundGlyph::HaveXAndYScale)
+ {
+ flt11 = fixed_to_float<14>(read(*(uint16 *)pbGlyph));
+ pbGlyph += sizeof(uint16);
+ flt12 = 0;
+ flt21 = 0;
+ flt22 = fixed_to_float<14>(read(*(uint16 *)pbGlyph));
+ pbGlyph += sizeof(uint16);
+ }
+ else if (GlyphFlags & CompoundGlyph::HaveTwoByTwo)
+ {
+ flt11 = fixed_to_float<14>(read(*(uint16 *)pbGlyph));
+ pbGlyph += sizeof(uint16);
+ flt12 = fixed_to_float<14>(read(*(uint16 *)pbGlyph));
+ pbGlyph += sizeof(uint16);
+ flt21 = fixed_to_float<14>(read(*(uint16 *)pbGlyph));
+ pbGlyph += sizeof(uint16);
+ flt22 = fixed_to_float<14>(read(*(uint16 *)pbGlyph));
+ pbGlyph += sizeof(uint16);
+ }
+ else
+ { // identity transform
+ flt11 = 1.0;
+ flt12 = 0.0;
+ flt21 = 0.0;
+ flt22 = 1.0;
+ }
+ return true;
+ }
+ pbGlyph += sizeof(uint16); // skip over glyph id of component
+ int nOffset = 0;
+ nOffset += GlyphFlags & CompoundGlyph::Arg1Arg2Words ? 4 : 2;
+ nOffset += GlyphFlags & CompoundGlyph::HaveScale ? 2 : 0;
+ nOffset += GlyphFlags & CompoundGlyph::HaveXAndYScale ? 4 : 0;
+ nOffset += GlyphFlags & CompoundGlyph::HaveTwoByTwo ? 8 : 0;
+ pbGlyph += nOffset;
+ } while (GlyphFlags & CompoundGlyph::MoreComponents);
+
+ // didn't find requested component
+ fTransOffset = false;
+ flt11 = 1;
+ flt12 = 0;
+ flt21 = 0;
+ flt22 = 1;
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return a pointer into the glyf table based on the given tables and Glyph ID
+ Since this method doesn't check for spaces, it is good to call IsSpace before using it.
+ Return NULL on error
+----------------------------------------------------------------------------------------------*/
+void * GlyfLookup(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca,
+ size_t lLocaSize, const void * pHead)
+{
+ // test for valid glyph id
+ // CheckTable verifies the index_to_loc_format is valid
+
+ const Sfnt::FontHeader * pTable
+ = reinterpret_cast<const Sfnt::FontHeader *>(pHead);
+
+ if (read(pTable->index_to_loc_format) == Sfnt::FontHeader::ShortIndexLocFormat)
+ { // loca entries are two bytes (and have been divided by two)
+ if (nGlyphId >= (lLocaSize >> 1) - 1) // don't allow nGlyphId to access sentinel
+ throw std::out_of_range("glyph id out of range for font");
+ }
+ if (read(pTable->index_to_loc_format) == Sfnt::FontHeader::LongIndexLocFormat)
+ { // loca entries are four bytes
+ if (nGlyphId >= (lLocaSize >> 2) - 1)
+ throw std::out_of_range("glyph id out of range for font");
+ }
+
+ long lGlyfOffset = LocaLookup(nGlyphId, pLoca, lLocaSize, pHead);
+ void * pSimpleGlyf = GlyfLookup(pGlyf, lGlyfOffset); // invalid loca offset returns null
+ return pSimpleGlyf;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Determine if a particular Glyph ID has any data in the glyf table. If it is white space,
+ there will be no glyf data, though there will be metric data in hmtx, etc.
+----------------------------------------------------------------------------------------------*/
+bool IsSpace(gr::gid16 nGlyphId, const void * pLoca, size_t lLocaSize, const void * pHead)
+{
+ size_t lGlyfOffset = LocaLookup(nGlyphId, pLoca, lLocaSize, pHead);
+
+ // the +1 should always work because there is a sentinel value at the end of the loca table
+ size_t lNextGlyfOffset = LocaLookup(nGlyphId + 1, pLoca, lLocaSize, pHead);
+
+ return (lNextGlyfOffset - lGlyfOffset) == 0;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Determine if a particular Glyph ID is a multi-level composite.
+----------------------------------------------------------------------------------------------*/
+bool IsDeepComposite(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca,
+ long lLocaSize, const void * pHead)
+{
+ if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead)) {return false;}
+
+ void * pSimpleGlyf = GlyfLookup(nGlyphId, pGlyf, pLoca, lLocaSize, pHead);
+ if (pSimpleGlyf == NULL)
+ return false; // no way to really indicate an error occured here
+
+ if (GlyfContourCount(pSimpleGlyf) >= 0)
+ return false;
+
+ int rgnCompId[kMaxGlyphComponents]; // assumes only a limited number of glyph components
+ size_t cCompIdTotal = kMaxGlyphComponents;
+ size_t cCompId = 0;
+
+ if (!GetComponentGlyphIds(pSimpleGlyf, rgnCompId, cCompIdTotal, cCompId))
+ return false;
+
+ for (size_t i = 0; i < cCompId; i++)
+ {
+ void * pSimpleGlyf = GlyfLookup(static_cast<gr::gid16>(rgnCompId[i]),
+ pGlyf, pLoca, lLocaSize, pHead);
+ if (pSimpleGlyf == NULL) {return false;}
+
+ if (GlyfContourCount(pSimpleGlyf) < 0)
+ return true;
+ }
+
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the bounding box coordinates based on the given tables and Glyph ID
+ Handles both simple and composite glyphs.
+ Return true if successful, false otherwise. On false, all point values will be INT_MIN
+ False may indicate a white space glyph
+----------------------------------------------------------------------------------------------*/
+bool GlyfBox(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca,
+ size_t lLocaSize, const void * pHead, int & xMin, int & yMin, int & xMax, int & yMax)
+{
+ xMin = yMin = xMax = yMax = INT_MIN;
+
+ if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead)) {return false;}
+
+ void * pSimpleGlyf = GlyfLookup(nGlyphId, pGlyf, pLoca, lLocaSize, pHead);
+ if (pSimpleGlyf == NULL) {return false;}
+
+ return GlyfBox(pSimpleGlyf, xMin, yMin, xMax, yMax);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the number of contours based on the given tables and Glyph ID
+ Handles both simple and composite glyphs.
+ Return true if successful, false otherwise. On false, cnContours will be INT_MIN
+ False may indicate a white space glyph or a multi-level composite glyph.
+----------------------------------------------------------------------------------------------*/
+bool GlyfContourCount(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca,
+ size_t lLocaSize, const void * pHead, size_t & cnContours)
+{
+ cnContours = static_cast<size_t>(INT_MIN);
+
+ if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead)) {return false;}
+
+ void * pSimpleGlyf = GlyfLookup(nGlyphId, pGlyf, pLoca, lLocaSize, pHead);
+ if (pSimpleGlyf == NULL) {return false;}
+
+ int cRtnContours = GlyfContourCount(pSimpleGlyf);
+ if (cRtnContours >= 0)
+ {
+ cnContours = size_t(cRtnContours);
+ return true;
+ }
+
+ //handle composite glyphs
+
+ int rgnCompId[kMaxGlyphComponents]; // assumes no glyph will be made of more than 8 components
+ size_t cCompIdTotal = kMaxGlyphComponents;
+ size_t cCompId = 0;
+
+ if (!GetComponentGlyphIds(pSimpleGlyf, rgnCompId, cCompIdTotal, cCompId))
+ return false;
+
+ cRtnContours = 0;
+ int cTmp = 0;
+ for (size_t i = 0; i < cCompId; i++)
+ {
+ if (IsSpace(static_cast<gr::gid16>(rgnCompId[i]), pLoca, lLocaSize, pHead)) {return false;}
+ pSimpleGlyf = GlyfLookup(static_cast<gr::gid16>(rgnCompId[i]),
+ pGlyf, pLoca, lLocaSize, pHead);
+ if (pSimpleGlyf == 0) {return false;}
+ // return false on multi-level composite
+ if ((cTmp = GlyfContourCount(pSimpleGlyf)) < 0)
+ return false;
+ cRtnContours += cTmp;
+ }
+
+ cnContours = size_t(cRtnContours);
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the point numbers for the end points of the glyph contours based on the given tables
+ and Glyph ID
+ Handles both simple and composite glyphs.
+ cnPoints - count of contours from GlyfContourCount (same as number of end points)
+ prgnContourEndPoints - should point to a buffer large enough to hold cnPoints integers
+ Return true if successful, false otherwise. On false, all end points are INT_MIN
+ False may indicate a white space glyph or a multi-level composite glyph.
+----------------------------------------------------------------------------------------------*/
+bool GlyfContourEndPoints(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca,
+ size_t lLocaSize, const void * pHead,
+ int * prgnContourEndPoint, size_t cnPoints)
+{
+ std::fill_n(prgnContourEndPoint, cnPoints, INT_MIN);
+
+ if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead)) {return false;}
+
+ void * pSimpleGlyf = GlyfLookup(nGlyphId, pGlyf, pLoca, lLocaSize, pHead);
+ if (pSimpleGlyf == NULL) {return false;}
+
+ int cContours = GlyfContourCount(pSimpleGlyf);
+ int cActualPts = 0;
+ if (cContours > 0)
+ return GlyfContourEndPoints(pSimpleGlyf, prgnContourEndPoint, cnPoints, cActualPts);
+
+ // handle composite glyphs
+
+ int rgnCompId[kMaxGlyphComponents]; // assumes no glyph will be made of more than 8 components
+ size_t cCompIdTotal = kMaxGlyphComponents;
+ size_t cCompId = 0;
+
+ if (!GetComponentGlyphIds(pSimpleGlyf, rgnCompId, cCompIdTotal, cCompId))
+ return false;
+
+ int * prgnCurrentEndPoint = prgnContourEndPoint;
+ int cCurrentPoints = cnPoints;
+ int nPrevPt = 0;
+ for (size_t i = 0; i < cCompId; i++)
+ {
+ if (IsSpace(static_cast<gr::gid16>(rgnCompId[i]), pLoca, lLocaSize, pHead)) {return false;}
+ pSimpleGlyf = GlyfLookup(static_cast<gr::gid16>(rgnCompId[i]), pGlyf, pLoca, lLocaSize, pHead);
+ if (pSimpleGlyf == NULL) {return false;}
+ // returns false on multi-level composite
+ if (!GlyfContourEndPoints(pSimpleGlyf, prgnCurrentEndPoint, cCurrentPoints, cActualPts))
+ return false;
+ // points in composite are numbered sequentially as components are added
+ // must adjust end point numbers for new point numbers
+ for (int j = 0; j < cActualPts; j++)
+ prgnCurrentEndPoint[j] += nPrevPt;
+ nPrevPt = prgnCurrentEndPoint[cActualPts - 1] + 1;
+
+ prgnCurrentEndPoint += cActualPts;
+ cCurrentPoints -= cActualPts;
+ }
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the points for a glyph based on the given tables and Glyph ID
+ Handles both simple and composite glyphs.
+ cnPoints - count of points from largest end point obtained from GlyfContourEndPoints
+ prgnX & prgnY - should point to buffers large enough to hold cnPoints integers
+ The ranges are parallel so that coordinates for point(n) are found at offset n in
+ both ranges. These points are in absolute coordinates.
+ prgfOnCurve - should point to a buffer a large enough to hold cnPoints bytes (bool)
+ This range is parallel to the prgnX & prgnY
+ Return true if successful, false otherwise. On false, all points may be INT_MIN
+ False may indicate a white space glyph, a multi-level composite, or a corrupt font
+ // TODO: doesn't support composite glyphs whose components are themselves components
+ It's not clear from the TTF spec when the transforms should be applied. Should the
+ transform be done before or after attachment point calcs? (current code - before)
+ Should the transform be applied to other offsets? (currently - no; however commented
+ out code is in place so that if CompoundGlyph::UnscaledOffset on the MS rasterizer is
+ clear (typical) then yes, and if CompoundGlyph::ScaledOffset on the Apple rasterizer is
+ clear (typical?) then no). See GetComponentTransform.
+ It's also unclear where point numbering with attachment poinst starts
+ (currently - first point number is relative to whole glyph, second point number is
+ relative to current glyph).
+----------------------------------------------------------------------------------------------*/
+bool GlyfPoints(gr::gid16 nGlyphId, const void * pGlyf,
+ const void * pLoca, size_t lLocaSize, const void * pHead,
+ const int * prgnContourEndPoint, size_t cnEndPoints,
+ int * prgnX, int * prgnY, bool * prgfOnCurve, size_t cnPoints)
+{
+ std::fill_n(prgnX, cnPoints, INT_MAX);
+ std::fill_n(prgnY, cnPoints, INT_MAX);
+
+ if (IsSpace(nGlyphId, pLoca, lLocaSize, pHead))
+ return false;
+
+ void * pSimpleGlyf = GlyfLookup(nGlyphId, pGlyf, pLoca, lLocaSize, pHead);
+ if (pSimpleGlyf == NULL)
+ return false;
+
+ int cContours = GlyfContourCount(pSimpleGlyf);
+ int cActualPts;
+ if (cContours > 0)
+ {
+ if (!GlyfPoints(pSimpleGlyf, prgnX, prgnY, (char *)prgfOnCurve, cnPoints, cActualPts))
+ return false;
+ CalcAbsolutePoints(prgnX, prgnY, cnPoints);
+ SimplifyFlags((char *)prgfOnCurve, cnPoints);
+ return true;
+ }
+
+ // handle composite glyphs
+ int rgnCompId[kMaxGlyphComponents]; // assumes no glyph will be made of more than 8 components
+ size_t cCompIdTotal = kMaxGlyphComponents;
+ size_t cCompId = 0;
+
+ // this will fail if there are more components than there is room for
+ if (!GetComponentGlyphIds(pSimpleGlyf, rgnCompId, cCompIdTotal, cCompId))
+ return false;
+
+ int * prgnCurrentX = prgnX;
+ int * prgnCurrentY = prgnY;
+ char * prgbCurrentFlag = (char *)prgfOnCurve; // converting bool to char should be safe
+ int cCurrentPoints = cnPoints;
+ bool fOffset = true, fTransOff = true;
+ int a, b;
+ float flt11, flt12, flt21, flt22;
+ // int * prgnPrevX = prgnX; // in case first att pt number relative to preceding glyph
+ // int * prgnPrevY = prgnY;
+ for (size_t i = 0; i < cCompId; i++)
+ {
+ if (IsSpace(static_cast<gr::gid16>(rgnCompId[i]), pLoca, lLocaSize, pHead)) {return false;}
+ void * pCompGlyf = GlyfLookup(static_cast<gr::gid16>(rgnCompId[i]), pGlyf, pLoca, lLocaSize, pHead);
+ if (pCompGlyf == NULL) {return false;}
+ // returns false on multi-level composite
+ if (!GlyfPoints(pCompGlyf, prgnCurrentX, prgnCurrentY, prgbCurrentFlag,
+ cCurrentPoints, cActualPts))
+ return false;
+ if (!GetComponentPlacement(pSimpleGlyf, rgnCompId[i], fOffset, a, b))
+ return false;
+ if (!GetComponentTransform(pSimpleGlyf, rgnCompId[i],
+ flt11, flt12, flt21, flt22, fTransOff))
+ return false;
+ bool fIdTrans = flt11 == 1.0 && flt12 == 0.0 && flt21 == 0.0 && flt22 == 1.0;
+
+ // convert points to absolute coordinates
+ // do before transform and attachment point placement are applied
+ CalcAbsolutePoints(prgnCurrentX, prgnCurrentY, cActualPts);
+
+ // apply transform - see main method note above
+ // do before attachment point calcs
+ if (!fIdTrans)
+ for (int j = 0; j < cActualPts; j++)
+ {
+ int x = prgnCurrentX[j]; // store before transform applied
+ int y = prgnCurrentY[j];
+ prgnCurrentX[j] = (int)(x * flt11 + y * flt12);
+ prgnCurrentY[j] = (int)(x * flt21 + y * flt22);
+ }
+
+ // apply placement - see main method note above
+ int nXOff, nYOff;
+ if (fOffset) // explicit x & y offsets
+ {
+ /* ignore fTransOff for now
+ if (fTransOff && !fIdTrans)
+ { // transform x & y offsets
+ nXOff = (int)(a * flt11 + b * flt12);
+ nYOff = (int)(a * flt21 + b * flt22);
+ }
+ else */
+ { // don't transform offset
+ nXOff = a;
+ nYOff = b;
+ }
+ }
+ else // attachment points
+ { // in case first point is relative to preceding glyph and second relative to current
+ // nXOff = prgnPrevX[a] - prgnCurrentX[b];
+ // nYOff = prgnPrevY[a] - prgnCurrentY[b];
+ // first point number relative to whole composite, second relative to current glyph
+ nXOff = prgnX[a] - prgnCurrentX[b];
+ nYOff = prgnY[a] - prgnCurrentY[b];
+ }
+ for (int j = 0; j < cActualPts; j++)
+ {
+ prgnCurrentX[j] += nXOff;
+ prgnCurrentY[j] += nYOff;
+ }
+
+ // prgnPrevX = prgnCurrentX;
+ // prgnPrevY = prgnCurrentY;
+ prgnCurrentX += cActualPts;
+ prgnCurrentY += cActualPts;
+ prgbCurrentFlag += cActualPts;
+ cCurrentPoints -= cActualPts;
+ }
+
+ SimplifyFlags((char *)prgfOnCurve, cnPoints);
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Simplify the meaning of flags to just indicate whether point is on-curve or off-curve
+---------------------------------------------------------------------------------------------*/
+bool SimplifyFlags(char * prgbFlags, int cnPoints)
+{
+ for (int i = 0; i < cnPoints; i++)
+ prgbFlags[i] = static_cast<char>(prgbFlags[i] & Sfnt::SimpleGlyph::OnCurve);
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Convert relative point coordinates to absolute coordinates
+ Points are stored in the font such that they are offsets from one another except for the
+ first point of a glyph.
+---------------------------------------------------------------------------------------------*/
+bool CalcAbsolutePoints(int * prgnX, int * prgnY, int cnPoints)
+{
+ int nX = prgnX[0];
+ int nY = prgnY[0];
+ for (int i = 1; i < cnPoints; i++)
+ {
+ prgnX[i] += nX;
+ nX = prgnX[i];
+ prgnY[i] += nY;
+ nY = prgnY[i];
+ }
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Convert a numerical table ID to a string containing the actual name of the table.
+ Returns native order unsigned long.
+---------------------------------------------------------------------------------------------*/
+gr::fontTableId32 TableIdTag(const TableId tid)
+{
+ assert(sizeof(mapIdToTag) == sizeof(gr::fontTableId32) * ktiLast);
+ assert(tid < ktiLast);
+
+ return mapIdToTag[tid];
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the length of the 'name' table in bytes.
+ Currently used.
+---------------------------------------------------------------------------------------------*/
+#if 0
+size_t NameTableLength(const gr::byte * pTable)
+{
+ gr::byte * pb = (const_cast<gr::byte *>(pTable)) + 2; // skip format
+ size_t cRecords = *pb++ << 8; cRecords += *pb++;
+ int dbStringOffset0 = (*pb++) << 8; dbStringOffset0 += *pb++;
+ int dbMaxStringOffset = 0;
+ for (size_t irec = 0; irec < cRecords; irec++)
+ {
+ int nPlatform = (*pb++) << 8; nPlatform += *pb++;
+ int nEncoding = (*pb++) << 8; nEncoding += *pb++;
+ int nLanguage = (*pb++) << 8; nLanguage += *pb++;
+ int nName = (*pb++) << 8; nName += *pb++;
+ int cbStringLen = (*pb++) << 8; cbStringLen += *pb++;
+ int dbStringOffset = (*pb++) << 8; dbStringOffset += *pb++;
+ if (dbMaxStringOffset < dbStringOffset + cbStringLen)
+ dbMaxStringOffset = dbStringOffset + cbStringLen;
+ }
+ return dbStringOffset0 + dbMaxStringOffset;
+}
+#endif
+
+} // end of namespace TtfUtil
diff --git a/Build/source/libs/graphite/src/font/TtfUtil.h b/Build/source/libs/graphite/src/font/TtfUtil.h
new file mode 100644
index 00000000000..bf437ff3475
--- /dev/null
+++ b/Build/source/libs/graphite/src/font/TtfUtil.h
@@ -0,0 +1,147 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2000, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: TtfUtil.h
+Responsibility: Alan Ward
+Last reviewed: Not yet.
+
+Description:
+ Utility class for handling TrueType font files.
+----------------------------------------------------------------------------------------------*/
+
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef TTFUTIL_H
+#define TTFUTIL_H
+
+#include <cstddef>
+#include <stdexcept>
+#include "GrPlatform.h"
+
+// Enumeration used to specify a table in a TTF file
+enum TableId
+{
+ ktiCmap, ktiCvt, ktiCryp, ktiHead, ktiFpgm, ktiGdir, ktiGlyf,
+ ktiHdmx, ktiHhea, ktiHmtx, ktiLoca, ktiKern, ktiLtsh, ktiMaxp,
+ ktiName, ktiOs2, ktiPost, ktiPrep, ktiFeat, ktiGlat, ktiGloc,
+ ktiSilf, ktiSile, ktiSill,
+ ktiLast /*This gives the enum length - it is not a real table*/
+};
+
+/*----------------------------------------------------------------------------------------------
+ Class providing utility methods to parse a TrueType font file (TTF).
+ Callling application handles all file input and memory allocation.
+ Assumes minimal knowledge of TTF file format.
+----------------------------------------------------------------------------------------------*/
+namespace TtfUtil
+{
+ ////////////////////////////////// tools to find & check TTF tables
+ bool GetHeaderInfo(size_t & lOffset, size_t & lSize);
+ bool CheckHeader(const void * pHdr);
+ bool GetTableDirInfo(const void * pHdr, size_t & lOffset, size_t & lSize);
+ bool GetTableInfo(TableId ktiTableId, const void * pHdr, const void * pTableDir,
+ size_t & lOffset, size_t & lSize);
+ bool CheckTable(TableId ktiTableId, const void * pTable, size_t lTableSize);
+
+ ////////////////////////////////// simple font wide info
+ size_t GlyphCount(const void * pMaxp);
+ size_t MaxCompositeComponentCount(const void * pMaxp);
+ size_t MaxCompositeLevelCount(const void * pMaxp);
+ size_t LocaGlyphCount(size_t lLocaSize, const void * pHead) throw (std::domain_error);
+ int DesignUnits(const void * pHead);
+ int HeadTableCheckSum(const void * pHead);
+ void HeadTableCreateTime(const void * pHead, unsigned int * pnDateBC, unsigned int * pnDateAD);
+ void HeadTableModifyTime(const void * pHead, unsigned int * pnDateBC, unsigned int * pnDateAD);
+ bool IsItalic(const void * pHead);
+ int FontAscent(const void * pOs2);
+ int FontDescent(const void * pOs2);
+ bool FontOs2Style(const void *pOs2, bool & fBold, bool & fItalic);
+ bool Get31EngFamilyInfo(const void * pName, size_t & lOffset, size_t & lSize);
+ bool Get31EngFullFontInfo(const void * pName, size_t & lOffset, size_t & lSize);
+ bool Get30EngFamilyInfo(const void * pName, size_t & lOffset, size_t & lSize);
+ bool Get30EngFullFontInfo(const void * pName, size_t & lOffset, size_t & lSize);
+ int PostLookup(const void * pPost, size_t lPostSize, const void * pMaxp,
+ const char * pPostName);
+
+ ////////////////////////////////// utility methods helpful for name table
+ bool GetNameInfo(const void * pName, int nPlatformId, int nEncodingId,
+ int nLangId, int nNameId, size_t & lOffset, size_t & lSize);
+ //size_t NameTableLength(const gr::byte * pTable);
+ int GetLangsForNames(const void * pName, int nPlatformId, int nEncodingId,
+ int *nameIdList, int cNameIds, short *langIdList);
+ void SwapWString(void * pWStr, size_t nSize = 0) throw (std::invalid_argument);
+
+ ////////////////////////////////// cmap lookup tools
+ void * FindCmapSubtable(const void * pCmap, int nPlatformId = 3,
+ int nEncodingId = 1);
+ bool CheckCmap31Subtable(const void * pCmap31);
+ gr::gid16 Cmap31Lookup(const void * pCmap31, int nUnicodeId);
+ unsigned int Cmap31NextCodepoint(const void *pCmap31, unsigned int nUnicodeId,
+ int * pRangeKey = 0);
+ bool CheckCmap310Subtable(const void *pCmap310);
+ gr::gid16 Cmap310Lookup(const void * pCmap310, unsigned int uUnicodeId);
+ unsigned int Cmap310NextCodepoint(const void *pCmap310, unsigned int nUnicodeId,
+ int * pRangeKey = 0);
+
+ ///////////////////////////////// horizontal metric data for a glyph
+ bool HorMetrics(gr::gid16 nGlyphId, const void * pHmtx, size_t lHmtxSize,
+ const void * pHhea, int & nLsb, unsigned int & nAdvWid);
+
+ ///////////////////////////////// convert our TableId enum to standard TTF tags
+ gr::fontTableId32 TableIdTag(const TableId);
+
+ ////////////////////////////////// primitives for loca and glyf lookup
+ size_t LocaLookup(gr::gid16 nGlyphId, const void * pLoca, size_t lLocaSize,
+ const void * pHead) throw (std::out_of_range);
+ void * GlyfLookup(const void * pGlyf, size_t lGlyfOffset);
+
+ ////////////////////////////////// primitves for simple glyph data
+ bool GlyfBox(const void * pSimpleGlyf, int & xMin, int & yMin,
+ int & xMax, int & yMax);
+
+ int GlyfContourCount(const void * pSimpleGlyf);
+ bool GlyfContourEndPoints(const void * pSimpleGlyf, int * prgnContourEndPoint,
+ int cnPointsTotal, size_t & cnPoints);
+ bool GlyfPoints(const void * pSimpleGlyf, int * prgnX, int * prgnY,
+ char * prgbFlag, int cnPointsTotal, int & cnPoints);
+
+ // primitive to find the glyph ids in a composite glyph
+ bool GetComponentGlyphIds(const void * pSimpleGlyf, int * prgnCompId,
+ size_t cnCompIdTotal, size_t & cnCompId);
+ // primitive to find the placement data for a component in a composite glyph
+ bool GetComponentPlacement(const void * pSimpleGlyf, int nCompId,
+ bool fOffset, int & a, int & b);
+ // primitive to find the transform data for a component in a composite glyph
+ bool GetComponentTransform(const void * pSimpleGlyf, int nCompId,
+ float & flt11, float & flt12, float & flt21, float & flt22, bool & fTransOffset);
+
+ ////////////////////////////////// operate on composite or simple glyph (auto glyf lookup)
+ void * GlyfLookup(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca,
+ size_t lLocaSize, const void * pHead); // primitive used by below methods
+
+ // below are primary user methods for handling glyf data
+ bool IsSpace(gr::gid16 nGlyphId, const void * pLoca, size_t lLocaSize, const void * pHead);
+ bool IsDeepComposite(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca,
+ size_t lLocaSize, const void * pHead);
+
+ bool GlyfBox(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca, size_t lLocaSize,
+ const void * pHead, int & xMin, int & yMin, int & xMax, int & yMax);
+ bool GlyfContourCount(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca,
+ size_t lLocaSize, const void *pHead, size_t & cnContours);
+ bool GlyfContourEndPoints(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca,
+ size_t lLocaSize, const void * pHead, int * prgnContourEndPoint, size_t cnPoints);
+ bool GlyfPoints(gr::gid16 nGlyphId, const void * pGlyf, const void * pLoca,
+ size_t lLocaSize, const void * pHead, const int * prgnContourEndPoint, size_t cnEndPoints,
+ int * prgnX, int * prgnY, bool * prgfOnCurve, size_t cnPoints);
+
+ // utitily method used by high-level GlyfPoints
+ bool SimplifyFlags(char * prgbFlags, int cnPoints);
+ bool CalcAbsolutePoints(int * prgnX, int * prgnY, int cnPoints);
+
+} // end of namespace TtfUtil
+
+#endif
diff --git a/Build/source/libs/graphite/src/generic/BinTree.h b/Build/source/libs/graphite/src/generic/BinTree.h
new file mode 100644
index 00000000000..a487df03770
--- /dev/null
+++ b/Build/source/libs/graphite/src/generic/BinTree.h
@@ -0,0 +1,71 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: BinTree.h
+Responsibility: Darrell Zook
+Last reviewed: 9/8/99
+
+Description:
+ This file provides declarations of binary tree class(es).
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef BINTREE_H_INCLUDED
+#define BINTREE_H_INCLUDED
+
+/*----------------------------------------------------------------------------------------------
+ This template class implements a balanced tree, which is a binary tree where the height of
+ the two children of any node in the tree can only be different by +/- 1 or 0.
+
+ The class of objects to be stored in the tree should be derived from BalTreeBase, because
+ the constructor of BalTreeBase adds an object to the tree in sorted order without
+ allocating any memory.
+
+ Classes that derive from BalTreeBase must have a CompareKey member function that compares
+ a given key with this->key to determine which should be first when sorting the tree.
+ The declaration of CompareKey should be as follows:
+ int CompareKey(const Key & key);
+ and it should return:
+ <0 if key is less than the key in the current node (this->key)
+ 0 if key is equal to the key in the current node (this->key)
+ >0 if key is greater than the key in the current node (this->key)
+
+ CAUTION: Classes that use this template should never be dynamically instantiated (by using
+ local variables or new/NewObj). This class is meant to be used only for global
+ instances of a class. The reason for this restriction is that the tree is never
+ destroyed, so using dynamic instantiations of objects would result in stale pointers
+ in the tree.
+
+ Hungarian: btb
+----------------------------------------------------------------------------------------------*/
+
+template<typename Obj, typename Key> class BalTreeBase
+{
+protected:
+ // Pointers to the left and right subtrees.
+ Obj * m_rgpobj[2];
+
+ // The difference between the height of the right sub tree and the height of the left
+ // sub tree. This should be -1, 0, or +1. Insert may temporarily set it to -2 or +2.
+ short m_dht;
+
+ // Which way we went from this node when inserting the new node.
+ short m_ipobj;
+
+ // Inserts this in the balanced tree.
+ BalTreeBase(Obj ** ppobjRoot, const Key & key);
+
+ // Returns a node with the given key from the tree rooted at pobjRoot.
+ static Obj * Find(Obj * pobjRoot, const Key & key);
+
+private:
+ // Inserts a node in the tree rooted at *ppobjRoot, sorting it based on key.
+ void Insert(Obj ** ppobjRoot, const Key & key);
+};
+
+#endif // !BINTREE_H_INCLUDED
+
diff --git a/Build/source/libs/graphite/src/generic/BinTree_i.cpp b/Build/source/libs/graphite/src/generic/BinTree_i.cpp
new file mode 100644
index 00000000000..5929bf0bab1
--- /dev/null
+++ b/Build/source/libs/graphite/src/generic/BinTree_i.cpp
@@ -0,0 +1,225 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: BinTree_i.cpp
+Responsibility: Darrell Zook
+Last reviewed: 9/8/99
+
+Description:
+ This file provides implementations of binary tree class(es).
+ It is used as an #include file in any file which derives from one of the classes.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef BINTREE_I_CPP_INCLUDED
+#define BINTREE_I_CPP_INCLUDED
+
+#include "BinTree.h"
+////#include <algorithm>
+////#include "GrPlatform.h"
+#include "GrCommon.h"
+
+
+//using namespace gr;
+
+/***********************************************************************************************
+ BalTreeBase<Obj, Key> methods
+***********************************************************************************************/
+
+/*----------------------------------------------------------------------------------------------
+ Constructor.
+ This calls Insert to add this node to the tree in the correct (sorted) position.
+
+ Arguments:
+ [in] ppobjRoot -> The address of the pointer to the root node of the tree.
+ [in] key -> References the key of the node to insert.
+----------------------------------------------------------------------------------------------*/
+template<typename Obj, typename Key>
+ BalTreeBase<Obj, Key>::BalTreeBase(Obj ** ppobjRoot, const Key & key)
+{
+ AssertPtr(ppobjRoot);
+ AssertPtrN(*ppobjRoot);
+
+ m_rgpobj[0] = NULL;
+ m_rgpobj[1] = NULL;
+ m_dht = 0;
+
+ Insert(ppobjRoot, key);
+}
+
+/*----------------------------------------------------------------------------------------------
+ This method finds a node with the given key within the tree. If the key is not found in
+ the tree, NULL is returned.
+
+ Arguments:
+ [in] pobjRoot -> Points to the root node of the tree.
+ [in] key -> References the key of the node to search for.
+----------------------------------------------------------------------------------------------*/
+template<typename Obj, typename Key>
+ Obj * BalTreeBase<Obj, Key>::Find(Obj * pobjRoot, const Key & key)
+{
+ AssertPtrN(pobjRoot);
+
+ for (Obj * pobj = pobjRoot; pobj; )
+ {
+ int nT = pobj->CompareKey(key);
+ if (0 == nT)
+ return pobj;
+ pobj = pobj->m_rgpobj[nT > 0];
+ }
+ return NULL;
+}
+
+/*----------------------------------------------------------------------------------------------
+ This method inserts a node within the tree, sorting it based on key. It does not allocate
+ any memory.
+
+ Arguments:
+ [in] ppobjRoot -> The address of the pointer to the root node of the tree.
+ [in] key -> References the key of the node to insert into the tree.
+ Note: "this" is the node that is being inserted into the tree.
+----------------------------------------------------------------------------------------------*/
+template<typename Obj, typename Key>
+ void BalTreeBase<Obj, Key>::Insert(Obj ** ppobjRoot, const Key & key)
+{
+ AssertPtr(ppobjRoot);
+ AssertPtrN(*ppobjRoot);
+
+ Assert(m_dht == 0);
+ Assert(!m_rgpobj[0]);
+ Assert(!m_rgpobj[1]);
+
+ Obj * pobjThis = static_cast<Obj *>(this);
+
+ // If the tree is empty, set the root of the tree to this and return.
+ if (!*ppobjRoot)
+ {
+ *ppobjRoot = pobjThis;
+ return;
+ }
+
+ Obj ** ppobjRebal = ppobjRoot;
+ Obj * pobjCur;
+
+ // Place this in the tree. Mark each node indicating which branch we took.
+ // Remember the lowest node with non-zero m_dht in ppobjRebal. If we have to do
+ // rebalancing, this is where we'll do it.
+ for (pobjCur = *ppobjRoot; ; )
+ {
+ AssertPtr(pobjCur);
+
+ int nT = pobjCur->CompareKey(key);
+ Assert(nT != 0);
+
+ // if nT is positive go right, otherwise go left.
+ pobjCur->m_ipobj = nT > 0;
+
+ Obj ** ppobjNext = &pobjCur->m_rgpobj[pobjCur->m_ipobj];
+ if (!*ppobjNext)
+ {
+ // Place the node and break.
+ *ppobjNext = pobjThis;
+ break;
+ }
+
+ // Remember this location if m_dht is non-zero.
+ if ((*ppobjNext)->m_dht != 0)
+ ppobjRebal = ppobjNext;
+
+ // Move on down.
+ pobjCur = *ppobjNext;
+ }
+
+ // Adjust m_dht from *ppobjRebal to pobjThis.
+ for (pobjCur = *ppobjRebal; pobjCur != pobjThis; )
+ {
+ AssertPtr(pobjCur);
+ Assert((unsigned int)pobjCur->m_ipobj < (unsigned int)2);
+
+ // Recall that ppobjRebal is the lowest node on the path which has non-zero m_dht.
+ Assert(pobjCur->m_dht == 0 || pobjCur == *ppobjRebal);
+
+ // If we went left (m_ipobj == 0) we need to subtract one. If we went right
+ // (m_ipobj == 1) we need to add one.
+ pobjCur->m_dht = (short)(pobjCur->m_dht + (pobjCur->m_ipobj << 1) - 1);
+ pobjCur = pobjCur->m_rgpobj[pobjCur->m_ipobj];
+ }
+
+ if ((unsigned int)((*ppobjRebal)->m_dht + 1) <= (unsigned int)2)
+ {
+ // No need to rebalance since the new m_dht for *ppobjRebal is within -1 to 1.
+ return;
+ }
+
+ // We need to rebalance.
+ Obj * pobjRebal = *ppobjRebal;
+ Assert(pobjRebal->m_dht == -2 || pobjRebal->m_dht == 2);
+
+ // Get the direction from pobjRebal and the next lower node.
+ int ipobj = pobjRebal->m_ipobj;
+ Obj * pobjChd = pobjRebal->m_rgpobj[ipobj];
+
+ if (pobjChd->m_ipobj == ipobj)
+ {
+ // We branched the same way at pobjRebal and pobjChd.
+ // Do a single rotation: make pobjChd the parent of pobjRebal.
+ Assert(pobjChd->m_dht << 1 == pobjRebal->m_dht);
+ pobjRebal->m_rgpobj[ipobj] = pobjChd->m_rgpobj[1 - ipobj];
+ pobjChd->m_rgpobj[1 - ipobj] = pobjRebal;
+ *ppobjRebal = pobjChd;
+
+ // Fix the m_dht values.
+ pobjChd->m_dht = 0;
+ pobjRebal->m_dht = 0;
+ return;
+ }
+
+ // We branched opposite ways at pobjRebal and pobjChd.
+ // Do a double rotation.
+ Assert(pobjChd->m_ipobj == 1 - ipobj);
+ pobjCur = pobjChd->m_rgpobj[1 - ipobj];
+ AssertPtr(pobjCur);
+
+ // Let (A own[ipobj] B) mean that A->m_rgpobj[ipobj] == B.
+ // Currently, (pobjRebal own[ipobj] pobjChd) and (pobjChd own[1 - ipobj] pobjCur).
+ // Make (pobjCur own[ipobj] pobjChd) and (pobjCur own[1 - ipobj] pobjRebal).
+
+ // Rotate pobjChd and pobjCur.
+ Assert(pobjCur == pobjChd->m_rgpobj[1 - ipobj]);
+ pobjChd->m_rgpobj[1 - ipobj] = pobjCur->m_rgpobj[ipobj];
+ pobjCur->m_rgpobj[ipobj] = pobjChd;
+
+ // Rotate pobjRebal and pobjCur.
+ Assert(pobjRebal->m_rgpobj[ipobj] == pobjChd);
+ pobjRebal->m_rgpobj[ipobj] = pobjCur->m_rgpobj[1 - ipobj];
+ pobjCur->m_rgpobj[1 - ipobj] = pobjRebal;
+
+ // Fix *ppobjRebal.
+ *ppobjRebal = pobjCur;
+
+ // Fix the m_dht values. Note that we don't compare with pobjRebal->m_dht since it
+ // currently has absolute value 2.
+ Assert(pobjChd->m_dht);
+ if (pobjCur->m_dht == pobjChd->m_dht)
+ {
+ pobjRebal->m_dht = 0;
+ pobjChd->m_dht = (short)-pobjChd->m_dht;
+ }
+ else if (pobjCur->m_dht == -pobjChd->m_dht)
+ {
+ pobjRebal->m_dht = pobjChd->m_dht;
+ pobjChd->m_dht = 0;
+ }
+ else
+ {
+ pobjRebal->m_dht = 0;
+ pobjChd->m_dht = 0;
+ }
+ pobjCur->m_dht = 0;
+}
+
+#endif // !BINTREE_I_CPP_INCLUDED
diff --git a/Build/source/libs/graphite/src/generic/Debug.cpp b/Build/source/libs/graphite/src/generic/Debug.cpp
new file mode 100644
index 00000000000..d1f2a67e364
--- /dev/null
+++ b/Build/source/libs/graphite/src/generic/Debug.cpp
@@ -0,0 +1,83 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: Debug.cpp
+Responsibility: Darrell Zook
+Last reviewed: Not yet.
+
+Description:
+ This file provides the standard debug error functions.
+----------------------------------------------------------------------------------------------*/
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
+//#include "common.h"
+//#include "Main.h"
+#include "GrDebug.h"
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//#include "ModuleEntry.h"
+#include <stdio.h>
+#ifdef _MSC_VER
+#include <crtdbg.h>
+#endif
+
+
+#if 0
+//#ifdef DEBUG
+
+extern HMODULE Win32DllGetModuleHandle();
+
+void WINAPI AssertProcLocal(const char * pszExp, const char * pszFile, int nLine,
+ bool fCritical)
+{
+ AssertProc(pszExp, pszFile, nLine, fCritical, Win32DllGetModuleHandle());
+}
+
+void WINAPI WarnProcLocal(const char * pszExp, const char * pszFile, int nLine,
+ bool fCritical)
+{
+ WarnProc(pszExp, pszFile, nLine, fCritical, Win32DllGetModuleHandle());
+}
+
+void WINAPI WarnHrProc(HRESULT hr, const char * pszFile, int nLine, bool fCritical)
+{
+ char szBuffer[MAX_PATH + 25];
+ sprintf(szBuffer, "HRESULT[0x%08x]--", hr);
+ int cch = lstrlen(szBuffer);
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, hr, 0, szBuffer + cch,
+ sizeof(szBuffer) - cch, NULL);
+ szBuffer[max(lstrlen(szBuffer) - 2, 0)] = 0;
+ WarnProcLocal(szBuffer, pszFile, nLine, fCritical);
+}
+
+
+OLECHAR * DebugWatch::WatchNV()
+{
+ // JT: we need this, otherwise if dealing with a deleted object or null pointer
+ // we may try to call a virtual function where there is no valid VTABLE pointer.
+ // In the debugger we can't be sure of not dereferencing a bad pointer.
+ if (!::_CrtIsValidPointer(this, isizeof(this), TRUE ))
+ return L"A very bad object pointer";
+ // We could also be referencing memory that is trashed (e.g., the object has
+ // been deleted, or deleted and replaced by something else).
+ if (!dynamic_cast<DebugWatch *>(this))
+ return L"A bad object pointer";
+ return Watch();
+}
+
+void DebugWatch::Output (char *fmt, ...) // LIMITED to 10 pointer-sized arguments
+{
+ struct args { void * pv[10]; };
+ _CrtDbgReport (_CRT_WARN, NULL, NULL, __FILE__, fmt, *(args*)(&fmt+1));
+}
+
+#endif // DEBUG
diff --git a/Build/source/libs/graphite/src/generic/GenericResource.h b/Build/source/libs/graphite/src/generic/GenericResource.h
new file mode 100644
index 00000000000..119c6317bcd
--- /dev/null
+++ b/Build/source/libs/graphite/src/generic/GenericResource.h
@@ -0,0 +1,86 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GenericResource.h
+Responsibility: John Thomson
+Last reviewed:
+
+ Resources needed by certain generic components (but must be created in app's or AppCore's
+ resource file).
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GenericResource_H
+#define GenericResource_H 1
+// Create suitable resources for these if your app uses StackDumper.
+// For example
+// STRINGTABLE DISCARDABLE
+// BEGIN
+// "A programming error (%s) has been detected in module %s.\n Please report this to the developers", kstidInternalError
+// "Out of memory. To attempt Save, close other apps and click OK. To quit without saving click Cancel", kstidOutOfMemory
+// END
+
+
+// Date qualifier string IDs:
+#define kstidDateQualBefore 24200
+#define kstidDateQualOn 24201
+#define kstidDateQualAbout 24202
+#define kstidDateQualAfter 24203
+#define kstidDateQualAbt 24204
+#define kstidDateQualBC 24205
+#define kstidDateQualAD 24206
+#define kstidDateBlank 24207
+#define kstidDateBlankM 24208
+#define kstidDateBlankD 24209
+
+
+#define kstidInternalError 25900
+#define khcidHelpOutOfMemory 25901
+#define khcidNoHelpAvailable 25902 // default help module when there is no specific one.
+#define kstidOutOfMemory 25903
+#define kstidUndoFrame 25904
+#define kstidRedoFrame 25905
+
+#define kstidFileErrUnknown 25920
+#define kstidFileErrNotFound 25921
+#define kstidFileErrPathNotFound 25922
+#define kstidFileErrTooManyFiles 25923
+#define kstidFileErrAccDenied 25924
+#define kstidFileErrBadHandle 25925
+#define kstidFileErrBadDrive 25926
+#define kstidFileErrWriteProtect 25927
+#define kstidFileErrBadUnit 25928
+#define kstidFileErrNotReady 25929
+#define kstidFileErrSeek 25930
+#define kstidFileErrNotDosDisk 25931
+#define kstidFileErrBadSector 25932
+#define kstidFileErrWriteFault 25933
+#define kstidFileErrReadFault 25934
+#define kstidFileErrGeneral 25935
+#define kstidFileErrSharing 25936
+#define kstidFileErrLock 25937
+#define kstidFileErrEof 25938
+#define kstidFileErrHandleDiskFull 25939
+#define kstidFileErrBadNetPath 25940
+#define kstidFileErrNetworkBusy 25941
+#define kstidFileErrNoDevice 25942
+#define kstidFileErrNoNetAccess 25943
+#define kstidFileErrBadDevice 25944
+#define kstidFileErrBadNetName 25945
+#define kstidFileErrExists 25946
+#define kstidFileErrCantMake 25947
+#define kstidFileErrBadPassword 25948
+#define kstidFileErrNetWriteFault 25949
+#define kstidFileErrDriveLocked 25950
+#define kstidFileErrOpenFailed 25951
+#define kstidFileErrBufOverflow 25952
+#define kstidFileErrDiskFull 25953
+#define kstidFileErrBadName 25954
+#define kstidFileErrNoVolLabel 25955
+#define kstidFileErrAlreadyExists 25956
+
+#endif // !GenericResource_H
diff --git a/Build/source/libs/graphite/src/generic/HashMap.h b/Build/source/libs/graphite/src/generic/HashMap.h
new file mode 100644
index 00000000000..dc2de9d0af7
--- /dev/null
+++ b/Build/source/libs/graphite/src/generic/HashMap.h
@@ -0,0 +1,328 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: HashMap.h
+Responsibility: Steve McConnel
+Last reviewed: Not yet.
+
+Description:
+ This provides a set of template collection classes to replace std::map. Their primary
+ reason to exist is to allow explicit checking for internal memory allocation failures.
+----------------------------------------------------------------------------------------------*/
+#pragma once
+#ifndef HASHMAP_H_INCLUDED
+#define HASHMAP_H_INCLUDED
+//:End Ignore
+
+/*----------------------------------------------------------------------------------------------
+ Functor class for computing a hash value from an arbitrary object.
+
+ Hungarian: hsho
+----------------------------------------------------------------------------------------------*/
+class HashObj
+{
+public:
+ int operator () (void * pKey, int cbKey);
+};
+
+/*----------------------------------------------------------------------------------------------
+ Functor class for comparing two arbitrary objects (of the same class) for equality.
+
+ Hungarian: eqlo
+----------------------------------------------------------------------------------------------*/
+class EqlObj
+{
+public:
+ bool operator () (void * pKey1, void * pKey2, int cbKey);
+};
+
+/*----------------------------------------------------------------------------------------------
+ Hash map template collection class whose keys are objects of an arbitrary class.
+
+ Hungarian: hm[K][T]
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H = HashObj, class Eq = EqlObj> class HashMap
+{
+public:
+ //:> Member classes
+
+ /*------------------------------------------------------------------------------------------
+ This is the basic data structure for storing one key-value pair in a hash map. In
+ order to handle hash collisions, this structure is a member of a linked list.
+ Hungarian: hsnd
+ ------------------------------------------------------------------------------------------*/
+ class HashNode
+ {
+ public:
+ //:> Constructors/destructors/etc.
+
+ HashNode(void)
+ : m_key(K()), m_value(T()), m_nHash(0), m_ihsndNext(0)
+ {
+ }
+ HashNode(K & key, T & value, int nHash, int ihsndNext = -1)
+ : m_key(key), m_value(value), m_nHash(nHash), m_ihsndNext(ihsndNext)
+ {
+ }
+ ~HashNode()
+ {
+ }
+
+ //:> Member variable access
+
+ void PutKey(K & key)
+ {
+ m_key = key;
+ }
+ K & GetKey()
+ {
+ return m_key;
+ }
+ void PutValue(T & value)
+ {
+ m_value = value;
+ }
+ T & GetValue()
+ {
+ return m_value;
+ }
+ void PutHash(int nHash)
+ {
+ m_nHash = nHash;
+ }
+ int GetHash()
+ {
+ return m_nHash;
+ }
+ void PutNext(int ihsndNext)
+ {
+ m_ihsndNext = ihsndNext;
+ }
+ int GetNext()
+ {
+ return m_ihsndNext;
+ }
+
+ /*--------------------------------------------------------------------------------------
+ Check whether the given HashNode is being used.
+ --------------------------------------------------------------------------------------*/
+ bool InUse()
+ {
+ return m_ihsndNext >= -1;
+ }
+
+ protected:
+ //:> Member variables
+
+ K m_key;
+ T m_value;
+ int m_nHash;
+ int m_ihsndNext; // -1 means end of list, -(ihsnd + 3) for free list members
+ };
+
+ /*------------------------------------------------------------------------------------------
+ This provides an iterator for stepping through all HashNodes stored in the hash map.
+ This is useful primarily for saving the contents of a hash map to a file.
+
+ Hungarian: ithm[K][T]
+ ------------------------------------------------------------------------------------------*/
+ class iterator
+ {
+ public:
+ // Constructors/destructors/etc.
+
+ iterator() : m_phmParent(NULL), m_ihsnd(0)
+ {
+ }
+ iterator(HashMap<K,T,H,Eq> * phm, int ihsnd) : m_phmParent(phm), m_ihsnd(ihsnd)
+ {
+ }
+ iterator(const iterator & v) : m_phmParent(v.m_phmParent), m_ihsnd(v.m_ihsnd)
+ {
+ }
+ ~iterator()
+ {
+ }
+
+ // Other public methods
+
+ iterator & operator = (const iterator & ithm)
+ {
+ m_phmParent = ithm.m_phmParent;
+ m_ihsnd = ithm.m_ihsnd;
+ return *this;
+ }
+ T & operator * (void)
+ {
+ Assert(m_phmParent);
+ Assert(m_phmParent->m_prghsnd);
+ Assert(m_ihsnd < m_phmParent->m_ihsndLim);
+ return m_phmParent->m_prghsnd[m_ihsnd].GetValue();
+ }
+ HashNode * operator -> (void)
+ {
+ Assert(m_phmParent);
+ Assert(m_phmParent->m_prghsnd);
+ Assert(m_ihsnd < m_phmParent->m_ihsndLim);
+ return &m_phmParent->m_prghsnd[m_ihsnd];
+ }
+ iterator & operator ++ (void)
+ {
+ Assert(m_phmParent);
+ ++m_ihsnd;
+ // make sure that this new HashNode is actually in use
+ while (m_ihsnd < m_phmParent->m_ihsndLim)
+ {
+ if (m_phmParent->m_prghsnd[m_ihsnd].InUse())
+ return *this;
+ // skip to the next one and check it
+ ++m_ihsnd;
+ }
+ if (m_ihsnd > m_phmParent->m_ihsndLim)
+ m_ihsnd = m_phmParent->m_ihsndLim;
+ return *this;
+ }
+ bool operator == (const iterator & ithm)
+ {
+ return (m_phmParent == ithm.m_phmParent) && (m_ihsnd == ithm.m_ihsnd);
+ }
+ bool operator != (const iterator & ithm)
+ {
+ return (m_phmParent != ithm.m_phmParent) || (m_ihsnd != ithm.m_ihsnd);
+ }
+ T & GetValue(void)
+ {
+ Assert(m_phmParent);
+ Assert(m_phmParent->m_prghsnd);
+ Assert(m_ihsnd < m_phmParent->m_ihsndLim);
+ Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse());
+ return m_phmParent->m_prghsnd[m_ihsnd].GetValue();
+ }
+ K & GetKey(void)
+ {
+ Assert(m_phmParent);
+ Assert(m_phmParent->m_prghsnd);
+ Assert(m_ihsnd < m_phmParent->m_ihsndLim);
+ Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse());
+ return m_phmParent->m_prghsnd[m_ihsnd].GetKey();
+ }
+ int GetHash()
+ {
+ Assert(m_phmParent);
+ Assert(m_phmParent->m_prghsnd);
+ Assert(m_ihsnd < m_phmParent->m_ihsndLim);
+ Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse());
+ return m_phmParent->m_prghsnd[m_ihsnd].GetHash();
+ }
+ int GetIndex()
+ {
+ Assert(m_phmParent);
+ Assert(m_phmParent->m_prghsnd);
+ Assert(m_ihsnd < m_phmParent->m_ihsndLim);
+ Assert(m_phmParent->m_prghsnd[m_ihsnd].InUse());
+ return m_ihsnd;
+ }
+
+ protected:
+ //:> Member variables
+
+ HashMap<K,T,H,Eq> * m_phmParent;
+ int m_ihsnd;
+ };
+ friend class iterator;
+
+ //:> Constructors/destructors/etc.
+
+ HashMap();
+ ~HashMap();
+ HashMap(HashMap<K,T,H,Eq> & hm);
+
+ //:> Other public methods
+
+ iterator Begin();
+ iterator End();
+ void Insert(K & key, T & value, bool fOverwrite = false, int * pihsndOut = NULL);
+ bool Retrieve(K & key, T * pvalueRet);
+ bool Delete(K & key);
+ void Clear();
+ void CopyTo(HashMap<K,T,H,Eq> & hmKT);
+ void CopyTo(HashMap<K,T,H,Eq> * phmKT);
+
+ bool GetIndex(K & key, int * pihsndRet);
+ bool IndexKey(int ihsnd, K * pkeyRet);
+ bool IndexValue(int ihsnd, T * pvalueRet);
+
+ int Size();
+
+ /*------------------------------------------------------------------------------------------
+ The assignment operator allows an entire hashmap to be assigned as the value of another
+ hashmap. It throws an error if it runs out of memory.
+
+ @return a reference to this hashmap. (That is how the assignment operator is defined!)
+
+ @param hm is a reference to the other hashmap.
+ ------------------------------------------------------------------------------------------*/
+ HashMap<K,T,H,Eq> & operator = (HashMap<K,T,H,Eq> & hm)
+ {
+ hm.CopyTo(this);
+ return *this;
+ }
+
+ //:Ignore
+#ifdef DEBUG
+ int _BucketCount();
+ int _EmptyBuckets();
+ int _BucketsUsed();
+ int _FullestBucket();
+ bool AssertValid()
+ {
+ AssertPtrN(m_prgihsndBuckets);
+ Assert(m_prgihsndBuckets || !m_cBuckets);
+ Assert(!m_prgihsndBuckets || m_cBuckets);
+ AssertArray(m_prgihsndBuckets, m_cBuckets);
+ AssertPtrN(m_prghsnd);
+ Assert(m_prghsnd || !m_ihsndMax);
+ Assert(!m_prghsnd || m_ihsndMax);
+ AssertArray(m_prghsnd, m_ihsndMax);
+ Assert(0 <= m_ihsndLim && m_ihsndLim <= m_ihsndMax);
+ Assert(-1 <= FreeListIdx(m_ihsndFirstFree));
+ Assert(FreeListIdx(m_ihsndFirstFree) < m_ihsndLim);
+ return true;
+ }
+#endif
+ //:End Ignore
+
+protected:
+ //:> Member variables
+
+ int * m_prgihsndBuckets;
+ int m_cBuckets;
+ HashNode * m_prghsnd;
+ int m_ihsndLim;
+ int m_ihsndMax;
+ int m_ihsndFirstFree; // stores -(ihsnd + 3)
+
+ //:> Protected methods
+ //:Ignore
+
+ /*------------------------------------------------------------------------------------------
+ Map between real index and "free list" index. Note that this mapping is bidirectional.
+ ------------------------------------------------------------------------------------------*/
+ int FreeListIdx(int ihsnd)
+ {
+ return -(ihsnd + 3);
+ }
+ //:End Ignore
+};
+
+
+// Local Variables:
+// mode:C++
+// c-file-style:"cellar"
+// tab-width:4
+// End:
+
+#endif /*HASHMAP_H_INCLUDED*/
diff --git a/Build/source/libs/graphite/src/generic/HashMap_i.cpp b/Build/source/libs/graphite/src/generic/HashMap_i.cpp
new file mode 100644
index 00000000000..baebe427a4e
--- /dev/null
+++ b/Build/source/libs/graphite/src/generic/HashMap_i.cpp
@@ -0,0 +1,561 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: HashMap_i.cpp
+Responsibility: Steve McConnel
+Last reviewed: Not yet.
+
+Description:
+ This file provides the implementations of methods for the HashMap template collection
+ classes. It is used as an #include file in any file which explicitly instantiates any
+ particular type of HashMap<K,T>, HashMapStrUni<T>, or HashMapChars<T>.
+----------------------------------------------------------------------------------------------*/
+#pragma once
+#ifndef HASHMAP_I_C_INCLUDED
+#define HASHMAP_I_C_INCLUDED
+
+#include "HashMap.h"
+////#include <algorithm>
+////#include "GrPlatform.h"
+#include "GrCommon.h"
+
+/***********************************************************************************************
+ Methods
+***********************************************************************************************/
+//:End Ignore
+
+/*----------------------------------------------------------------------------------------------
+ Constructor.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ HashMap<K,T,H,Eq>::HashMap()
+{
+ m_prgihsndBuckets = NULL;
+ m_cBuckets = 0;
+ m_prghsnd = NULL;
+ m_ihsndLim = 0;
+ m_ihsndMax = 0;
+ m_ihsndFirstFree = FreeListIdx(-1);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Copy constructor. It throws an error if it runs out of memory.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ HashMap<K,T,H,Eq>::HashMap(HashMap<K,T,H,Eq> & hm)
+{
+ m_prgihsndBuckets = NULL;
+ m_cBuckets= 0;
+ m_prghsnd = NULL;
+ m_ihsndLim = 0;
+ m_ihsndMax = 0;
+ m_ihsndFirstFree = FreeListIdx(-1);
+ hm.CopyTo(this);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Destructor.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ HashMap<K,T,H,Eq>::~HashMap()
+{
+ Clear();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return an iterator that references the first key and value stored in the HashMap.
+ If the hash map is empty, Begin returns the same value as End.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ typename HashMap<K,T,H,Eq>::iterator HashMap<K,T,H,Eq>::Begin()
+{
+ AssertObj(this);
+ int ihsnd;
+ for (ihsnd = 0; ihsnd < m_ihsndLim; ++ihsnd)
+ {
+ if (m_prghsnd[ihsnd].InUse())
+ {
+ iterator ithm(this, ihsnd);
+ return ithm;
+ }
+ }
+ return End();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return an iterator that marks the end of the set of keys and values stored in the HashMap.
+ If the HashMap is empty, End returns the same value as Begin.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ typename HashMap<K,T,H,Eq>::iterator HashMap<K,T,H,Eq>::End()
+{
+ AssertObj(this);
+ iterator ithm(this, m_ihsndLim);
+ return ithm;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Add one key and value to the HashMap. Insert potentially invalidates existing iterators
+ for this HashMap. An exception is thrown if there are any errors.
+
+ @param key Reference to the key object. An internal copy is made of this object.
+ @param value Reference to the object associated with the key. An internal copy is
+ made of this object.
+ @param fOverwrite Optional flag (defaults to false) to allow a value already associated
+ with this key to be replaced by this value.
+ @param pihsndOut Optional pointer to an integer for returning the internal index where the
+ key-value pair is stored.
+
+ @exception E_INVALIDARG if fOverwrite is not true and the key already is stored with a value
+ in this HashMap.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ void HashMap<K,T,H,Eq>::Insert(K & key, T & value, bool fOverwrite, int * pihsndOut)
+{
+ AssertObj(this);
+ // Check for initial allocation of memory.
+ if (!m_cBuckets)
+ {
+ int cBuckets = GetPrimeNear(10);
+ m_prgihsndBuckets = (int *)malloc(cBuckets * isizeof(int));
+ if (!m_prgihsndBuckets)
+ ThrowHr(WarnHr(E_OUTOFMEMORY));
+ std::fill_n(m_prgihsndBuckets, cBuckets, -1);
+ m_cBuckets = cBuckets;
+ }
+ if (!m_ihsndMax)
+ {
+ int iMax = 32;
+ m_prghsnd = (HashNode *)malloc(iMax * isizeof(HashNode));
+ if (!m_prghsnd)
+ ThrowHr(WarnHr(E_OUTOFMEMORY));
+ std::fill_n(m_prghsnd, iMax, 0);
+ m_ihsndLim = 0;
+ m_ihsndMax = iMax;
+ m_ihsndFirstFree = FreeListIdx(-1);
+ }
+ // Check whether this key is already used.
+ // If it is, store the value if overwriting is allowed, otherwise return an error value.
+ H hasher;
+ Eq equal;
+ int ihsnd;
+ int nHash = hasher(&key, isizeof(K));
+ int ie = (unsigned)nHash % m_cBuckets;
+ for (ihsnd = m_prgihsndBuckets[ie]; ihsnd != -1; ihsnd = m_prghsnd[ihsnd].GetNext())
+ {
+ if ((nHash == m_prghsnd[ihsnd].GetHash()) &&
+ equal(&key, &m_prghsnd[ihsnd].GetKey(), isizeof(K)))
+ {
+ if (fOverwrite)
+ {
+ m_prghsnd[ihsnd].PutValue(value);
+ if (pihsndOut)
+ *pihsndOut = ihsnd;
+ AssertObj(this);
+ return;
+ }
+ else
+ {
+ ThrowHr(WarnHr(E_INVALIDARG));
+ }
+ }
+ }
+ // Check whether to increase the number of buckets to redistribute the wealth.
+ // Calculate the average depth of hash collection chains.
+ // If greater than or equal to two, increase the number of buckets.
+ int chsndFree = 0;
+ int i;
+ for (i = m_ihsndFirstFree; i != FreeListIdx(-1); i = m_prghsnd[FreeListIdx(i)].GetNext())
+ ++chsndFree;
+ int chsndAvgDepth = (m_ihsndLim - chsndFree) / m_cBuckets;
+ if (chsndAvgDepth > 2)
+ {
+ int cNewBuckets = GetPrimeNear(4 * m_cBuckets);
+ if (cNewBuckets && cNewBuckets > m_cBuckets)
+ {
+ int * pNewBuckets = (int *)realloc(m_prgihsndBuckets, cNewBuckets * isizeof(int));
+ if (pNewBuckets)
+ {
+ std::fill_n(pNewBuckets, cNewBuckets, -1);
+ m_cBuckets = cNewBuckets;
+ m_prgihsndBuckets = pNewBuckets;
+ for (ihsnd = 0; ihsnd < m_ihsndLim; ++ihsnd)
+ {
+ if (m_prghsnd[ihsnd].InUse())
+ {
+ ie = (unsigned)m_prghsnd[ihsnd].GetHash() % m_cBuckets;
+ m_prghsnd[ihsnd].PutNext(m_prgihsndBuckets[ie]);
+ m_prgihsndBuckets[ie] = ihsnd;
+ }
+ }
+ // Recompute the new entry's slot so that it can be stored properly.
+ ie = (unsigned)nHash % m_cBuckets;
+ }
+ }
+ }
+ if (m_ihsndLim < m_ihsndMax)
+ {
+ ihsnd = m_ihsndLim;
+ ++m_ihsndLim;
+ }
+ else if (m_ihsndFirstFree != FreeListIdx(-1))
+ {
+ ihsnd = FreeListIdx(m_ihsndFirstFree);
+ m_ihsndFirstFree = m_prghsnd[ihsnd].GetNext();
+ }
+ else
+ {
+ int iNewMax = (!m_ihsndMax) ? 32 : 2 * m_ihsndMax;
+ HashNode * pNewNodes = (HashNode *)realloc(m_prghsnd, iNewMax * isizeof(HashNode));
+ if (!pNewNodes && iNewMax > 32)
+ {
+ iNewMax = m_ihsndMax + (m_ihsndMax / 2);
+ pNewNodes = (HashNode *)realloc(m_prghsnd, iNewMax * isizeof(HashNode));
+ if (!pNewNodes)
+ ThrowHr(WarnHr(E_OUTOFMEMORY));
+ }
+ m_prghsnd = pNewNodes;
+ m_ihsndMax = iNewMax;
+ Assert(m_ihsndLim < m_ihsndMax);
+ ihsnd = m_ihsndLim;
+ ++m_ihsndLim;
+ }
+ // Call constructor on previously allocated memory.
+ new((void *)&m_prghsnd[ihsnd]) HashNode(key, value, nHash, m_prgihsndBuckets[ie]);
+ m_prgihsndBuckets[ie] = ihsnd;
+ if (pihsndOut)
+ *pihsndOut = ihsnd;
+ AssertObj(this);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Search the HashMap for the given key, and return true if the key is found or false if the
+ key is not found. If the key is found and the given pointer is not NULL, copy the
+ associated value to that memory location.
+
+ @param key Reference to a key object.
+ @param pvalueRet Pointer to an empty object for storing a copy of the value associated with
+ the key, if one exists.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ bool HashMap<K,T,H,Eq>::Retrieve(K & key, T * pvalueRet)
+{
+ AssertObj(this);
+ if (!m_prgihsndBuckets)
+ return false;
+ H hasher;
+ Eq equal;
+ int nHash = hasher(&key, isizeof(K));
+ int ie = (unsigned)nHash % m_cBuckets;
+ int ihsnd;
+ for (ihsnd = m_prgihsndBuckets[ie]; ihsnd != -1; ihsnd = m_prghsnd[ihsnd].GetNext())
+ {
+ if ((nHash == m_prghsnd[ihsnd].GetHash()) &&
+ equal(&key, &m_prghsnd[ihsnd].GetKey(), isizeof(K)))
+ {
+ if (pvalueRet)
+ *pvalueRet = m_prghsnd[ihsnd].GetValue();
+ return true;
+ }
+ }
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Remove the element with the given key from the stored HashMap. This potentially
+ invalidates existing iterators for this HashMap. If the key is not found in the
+ HashMap, then nothing is deleted.
+
+ @param key Reference to a key object.
+
+ @return True if the key is found, and something is actually deleted; otherwise, false.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ bool HashMap<K,T,H,Eq>::Delete(K & key)
+{
+ AssertObj(this);
+ if (!m_prgihsndBuckets)
+ return false;
+ H hasher;
+ Eq equal;
+ int nHash = hasher(&key, isizeof(K));
+ int ie = (unsigned)nHash % m_cBuckets;
+ int ihsnd;
+ int ihsndPrev = -1;
+ for (ihsnd = m_prgihsndBuckets[ie]; ihsnd != -1; ihsnd = m_prghsnd[ihsnd].GetNext())
+ {
+ if ((nHash == m_prghsnd[ihsnd].GetHash()) &&
+ equal(&key, &m_prghsnd[ihsnd].GetKey(), isizeof(K)))
+ {
+ if (ihsndPrev == -1)
+ m_prgihsndBuckets[ie] = m_prghsnd[ihsnd].GetNext();
+ else
+ m_prghsnd[ihsndPrev].PutNext(m_prghsnd[ihsnd].GetNext());
+ m_prghsnd[ihsnd].~HashNode(); // Ensure member destructors are called.
+ memset(&m_prghsnd[ihsnd], 0, isizeof(HashNode));
+ m_prghsnd[ihsnd].PutNext(m_ihsndFirstFree);
+ m_ihsndFirstFree = FreeListIdx(ihsnd);
+ AssertObj(this);
+ return true;
+ }
+ ihsndPrev = ihsnd;
+ }
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Free all the memory used by the HashMap. When done, only the minimum amount of
+ bookkeeping memory is still taking up space, and any internal pointers all been set
+ to NULL. The appropriate destructor is called for all key and value objects stored
+ in the HashMap before the memory space is freed.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ void HashMap<K,T,H,Eq>::Clear()
+{
+ AssertObj(this);
+ if (!m_prgihsndBuckets)
+ return;
+ int ihsnd;
+ for (ihsnd = 0; ihsnd < m_ihsndLim; ++ihsnd)
+ {
+ if (m_prghsnd[ihsnd].InUse())
+ m_prghsnd[ihsnd].~HashNode(); // Ensure member destructors are called.
+ }
+ free(m_prgihsndBuckets);
+ free(m_prghsnd);
+ m_prgihsndBuckets = NULL;
+ m_cBuckets = 0;
+ m_prghsnd = NULL;
+ m_ihsndLim = 0;
+ m_ihsndMax = 0;
+ m_ihsndFirstFree = FreeListIdx(-1);
+ AssertObj(this);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Copy the content of one HashMap to another. An exception is thrown if there are any errors.
+
+ @param hmKT Reference to the other HashMap.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ void HashMap<K,T,H,Eq>::CopyTo(HashMap<K,T,H,Eq> & hmKT)
+{
+ AssertObj(this);
+ AssertObj(&hmKT);
+ hmKT.Clear();
+ iterator itmm;
+ for (itmm = Begin(); itmm != End(); ++itmm)
+ hmKT.Insert(itmm->GetKey(), itmm->GetValue());
+}
+
+/*----------------------------------------------------------------------------------------------
+ Copy the content of one HashMap to another. An exception is thrown if there are any errors.
+
+ @param phmKT Pointer to the other HashMap.
+
+ @exception E_POINTER if phmKT is NULL.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ void HashMap<K,T,H,Eq>::CopyTo(HashMap<K,T,H,Eq> * phmKT)
+{
+ if (!phmKT)
+ ThrowHr(WarnHr(E_POINTER));
+ CopyTo(*phmKT);
+}
+
+/*----------------------------------------------------------------------------------------------
+ If the given key is found in the HashMap, return true, and if the provided index pointer
+ is not NULL, also store the internal index value in the indicated memory location.
+ If the given key is NOT found in the HashMap, return false and ignore the provided index
+ pointer.
+
+ @param key Reference to a key object.
+ @param pihsndRet Pointer to an integer for returning the internal index where the
+ key-value pair is stored.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ bool HashMap<K,T,H,Eq>::GetIndex(K & key, int * pihsndRet)
+{
+ AssertObj(this);
+ if (!m_prgihsndBuckets)
+ return false;
+ H hasher;
+ Eq equal;
+ int nHash = hasher(&key, isizeof(K));
+ int ie = (unsigned)nHash % m_cBuckets;
+ int ihsnd;
+ for (ihsnd = m_prgihsndBuckets[ie]; ihsnd != -1; ihsnd = m_prghsnd[ihsnd].GetNext())
+ {
+ if ((nHash == m_prghsnd[ihsnd].GetHash()) &&
+ equal(&key, &m_prghsnd[ihsnd].GetKey(), isizeof(K)))
+ {
+ if (pihsndRet)
+ *pihsndRet = ihsnd;
+ return true;
+ }
+ }
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ If the given internal HashMap index is valid, return true, and if the provided pointer to a
+ key object is not NULL, also copy the indexed key to the indicated memory location.
+ If the given internal index is NOT valid, return false, and ignore the provided key
+ object pointer.
+
+ @param ihsnd Internal index value returned earlier by GetIndex or Insert.
+ @param pkeyRet Pointer to an empty key object for storing a copy of the key found at the
+ indexed location.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ bool HashMap<K,T,H,Eq>::IndexKey(int ihsnd, K * pkeyRet)
+{
+ AssertObj(this);
+ if ((ihsnd < 0) || (ihsnd >= m_ihsndLim))
+ return false;
+ if (m_prghsnd[ihsnd].InUse())
+ {
+ if (pkeyRet)
+ *pkeyRet = m_prghsnd[ihsnd].GetKey();
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ If the given internal HashMap index is valid, return true, and if the provided pointer to an
+ object is not NULL, also copy the indexed value to the indicated memory location.
+ If the given internal index is NOT valid, return false, and ignore the provided
+ object pointer.
+
+ @param ihsnd Internal index value returned earlier by GetIndex or Insert.
+ @param pvalueRet Pointer to an empty object for storing a copy of the value found at the
+ indexed location.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ bool HashMap<K,T,H,Eq>::IndexValue(int ihsnd, T * pvalueRet)
+{
+ AssertObj(this);
+ if (ihsnd < 0 || ihsnd >= m_ihsndLim)
+ return false;
+ if (m_prghsnd[ihsnd].InUse())
+ {
+ if (pvalueRet)
+ *pvalueRet = m_prghsnd[ihsnd].GetValue();
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the number of items (key-value pairs) stored in the HashMap.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ int HashMap<K,T,H,Eq>::Size()
+{
+ AssertObj(this);
+ if (!m_prgihsndBuckets)
+ return 0;
+ int chsndFree = 0;
+ int ihsnd;
+ for (ihsnd = m_ihsndFirstFree;
+ ihsnd != FreeListIdx(-1);
+ ihsnd = m_prghsnd[FreeListIdx(ihsnd)].GetNext())
+ {
+ ++chsndFree;
+ }
+ return m_ihsndLim - chsndFree;
+}
+
+//:Ignore
+#ifdef DEBUG
+/*----------------------------------------------------------------------------------------------
+ Return the number of buckets (hash slots) currently allocated for the hash map. This is
+ useful only for debugging the hash map mechanism itself.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ int HashMap<K,T,H,Eq>::_BucketCount()
+{
+ AssertObj(this);
+ return m_cBuckets;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the number of buckets (hash slots) that do not point to a list of HashNode objects.
+ This is useful only for debugging the hash map mechanism itself.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ int HashMap<K,T,H,Eq>::_EmptyBuckets()
+{
+ AssertObj(this);
+ int ceUnused = 0;
+ int ie;
+ for (ie = 0; ie < m_cBuckets; ++ie)
+ {
+ if (m_prgihsndBuckets[ie] == -1)
+ ++ceUnused;
+ }
+ return ceUnused;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the number of buckets (hash slots) that currently point to a list of HashNode
+ objects in the hash map. This is useful only for debugging the hash map mechanism itself.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ int HashMap<K,T,H,Eq>::_BucketsUsed()
+{
+ AssertObj(this);
+ int ceUsed = 0;
+ int ie;
+ for (ie = 0; ie < m_cBuckets; ++ie)
+ {
+ if (m_prgihsndBuckets[ie] != -1)
+ ++ceUsed;
+ }
+ return ceUsed;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the length of the longest list of HashNode objects stored in any bucket (hash slot)
+ of the hash map. This is useful only for debugging the hash map mechanism itself.
+----------------------------------------------------------------------------------------------*/
+template<class K, class T, class H, class Eq>
+ int HashMap<K,T,H,Eq>::_FullestBucket()
+{
+ AssertObj(this);
+ int chsndMax = 0;
+ int chsnd;
+ int ie;
+ int ihsnd;
+ for (ie = 0; ie < m_cBuckets; ++ie)
+ {
+ chsnd = 0;
+ for (ihsnd = m_prgihsndBuckets[ie]; ihsnd != -1; ihsnd = m_prghsnd[ihsnd].GetNext())
+ ++chsnd;
+ if (chsndMax < chsnd)
+ chsndMax = chsnd;
+ }
+ return chsndMax;
+}
+#endif
+//:End Ignore
+
+
+
+// Local Variables:
+// mode:C++
+// c-file-style:"cellar"
+// tab-width:4
+// End:
+
+#endif /*HASHMAP_I_C_INCLUDED*/
diff --git a/Build/source/libs/graphite/src/generic/Makefile.am b/Build/source/libs/graphite/src/generic/Makefile.am
new file mode 100644
index 00000000000..ec60b09be3a
--- /dev/null
+++ b/Build/source/libs/graphite/src/generic/Makefile.am
@@ -0,0 +1,8 @@
+genericdir = $(top_srcdir)/src/generic
+
+libgraphite_la_SOURCES += $(genericdir)/Debug.cpp
+libgraphite_la_SOURCES += $(genericdir)/Util.cpp
+
+EXTRA_DIST += $(genericdir)/*.h
+EXTRA_DIST += $(genericdir)/BinTree_i.cpp
+EXTRA_DIST += $(genericdir)/HashMap_i.cpp
diff --git a/Build/source/libs/graphite/src/generic/Util.cpp b/Build/source/libs/graphite/src/generic/Util.cpp
new file mode 100644
index 00000000000..aabd6563d3e
--- /dev/null
+++ b/Build/source/libs/graphite/src/generic/Util.cpp
@@ -0,0 +1,261 @@
+
+#include "GrCommon.h"
+#include "GrDebug.h"
+
+
+namespace gr
+{
+
+/*----------------------------------------------------------------------------------------------
+ Swap two blocks of size cb starting at pv1 and pv2. Doesn't handle overlapping blocks.
+----------------------------------------------------------------------------------------------*/
+void SwapBytes(void * pv1, void * pv2, int cb)
+{
+ Assert((byte *)pv1 + cb <= (byte *)pv2 || (byte *)pv2 + cb <= (byte *)pv1);
+ AssertPtrSize(pv1, cb);
+ AssertPtrSize(pv2, cb);
+
+#ifdef NO_ASM
+
+ byte *pb1 = (byte *)pv1;
+ byte *pb2 = (byte *)pv2;
+ byte b;
+
+ while (--cb >= 0)
+ {
+ b = *pb1;
+ *pb1++ = *pb2;
+ *pb2++ = b;
+ }
+
+#else // !NO_ASM
+
+ __asm
+ {
+ // edi -> memory to swap, first pointer
+ // esi -> memory to swap, second pointer
+
+ mov edi,pv1
+ mov esi,pv2
+
+ mov ecx,cb
+ shr ecx,2
+ jz LBytes
+
+LIntLoop:
+ mov eax,[edi]
+ mov ebx,[esi]
+ mov [edi],ebx
+ mov [esi],eax
+
+ add edi,4
+ add esi,4
+ dec ecx
+ jnz LIntLoop;
+
+LBytes:
+ mov ecx,cb
+ and ecx,3
+ jz LDone
+
+LByteLoop:
+ mov al,[edi]
+ mov bl,[esi]
+ mov [edi],bl
+ mov [esi],al
+ inc edi
+ inc esi
+ dec ecx
+ jnz LByteLoop
+
+LDone:
+ }
+
+#endif //!NO_ASM
+}
+
+/*----------------------------------------------------------------------------------------------
+ Fills a block of memory with the given short value.
+----------------------------------------------------------------------------------------------*/
+void FillShorts(void * pv, short sn, int csn)
+{
+ AssertPtrSize(pv, csn * isizeof(short));
+
+#ifdef NO_ASM
+
+ short * psn = (short *)pv;
+ short * psnLim = psn + csn;
+
+ while (psn < psnLim)
+ *psn++ = sn;
+
+#else // !NO_ASM
+
+ __asm
+ {
+ // Setup the registers for using REP STOS instruction to set memory.
+ // NOTE: Alignment does not effect the speed of STOS.
+ //
+ // edi -> memory to set
+ // eax = value to store in destination
+ // direction flag is clear for auto-increment
+
+ mov edi,pv
+ mov ax,sn
+ mov ecx,csn
+
+ mov edx,ecx
+ and edx,1
+ jz LInts
+
+ // set 1 short
+ stosw
+
+LInts:
+ shr ecx,1
+ jz LDone
+
+ mov ebx,eax
+ shl eax,16
+ mov ax,bx
+
+ rep stosd
+LDone:
+ }
+
+#endif //!NO_ASM
+}
+
+/***********************************************************************************************
+ Integer utilities.
+***********************************************************************************************/
+
+/*
+ * table of powers of 2, and largest prime smaller than each power of 2
+ * n 2**n prime diff
+ * --- ---------- ---------- ----
+ * 2: 4 3 ( -1)
+ * 3: 8 7 ( -1)
+ * 4: 16 13 ( -3)
+ * 5: 32 31 ( -1)
+ * 6: 64 61 ( -3)
+ * 7: 128 127 ( -1)
+ * 8: 256 251 ( -5)
+ * 9: 512 509 ( -3)
+ * 10: 1024 1021 ( -3)
+ * 11: 2048 2039 ( -9)
+ * 12: 4096 4093 ( -3)
+ * 13: 8192 8191 ( -1)
+ * 14: 16384 16381 ( -3)
+ * 15: 32768 32749 (-19)
+ * 16: 65536 65521 (-15)
+ * 17: 131072 131071 ( -1)
+ * 18: 262144 262139 ( -5)
+ * 19: 524288 524287 ( -1)
+ * 20: 1048576 1048573 ( -3)
+ * 21: 2097152 2097143 ( -9)
+ * 22: 4194304 4194301 ( -3)
+ * 23: 8388608 8388593 (-15)
+ * 24: 16777216 16777213 ( -3)
+ * 25: 33554432 33554393 (-39)
+ * 26: 67108864 67108859 ( -5)
+ * 27: 134217728 134217689 (-39)
+ * 28: 268435456 268435399 (-57)
+ * 29: 536870912 536870909 ( -3)
+ * 30: 1073741824 1073741789 (-35)
+ * 31: 2147483648 2147483647 ( -1)
+ * 32: 4294967296 4294967291 ( -5)
+ */
+const static unsigned int g_rguPrimes[] = {
+ 3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071,
+ 262139, 524287, 1048573, 2097143, 4194301, 8388593, 16777213, 33554393, 67108859,
+ 134217689, 268435399, 536870909, 1073741789, 2147483647, 4294967291U
+};
+
+
+/*----------------------------------------------------------------------------------------------
+ Returns the prime in g_rguPrimes that is closest to u.
+----------------------------------------------------------------------------------------------*/
+unsigned int GetPrimeNear(unsigned int u)
+{
+ int cu = isizeof(g_rguPrimes) / isizeof(unsigned int);
+ int iuMin;
+ int iuLim;
+ int iu;
+
+ for (iuMin = 0, iuLim = cu; iuMin < iuLim; )
+ {
+ iu = (iuMin + iuLim) / 2;
+ if (u > g_rguPrimes[iu])
+ iuMin = iu + 1;
+ else
+ iuLim = iu;
+ }
+ Assert(iuMin == cu || iuMin < cu && u <= g_rguPrimes[iuMin]);
+ Assert(iuMin == 0 || iuMin > 0 && u > g_rguPrimes[iuMin - 1]);
+
+ if (!iuMin)
+ return g_rguPrimes[0];
+ if (iuMin == cu)
+ return g_rguPrimes[cu - 1];
+ if (g_rguPrimes[iuMin] - u < u - g_rguPrimes[iuMin - 1])
+ return g_rguPrimes[iuMin];
+ return g_rguPrimes[iuMin - 1];
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Returns the prime in g_rguPrimes that is larger than u or is the largest in the list.
+----------------------------------------------------------------------------------------------*/
+unsigned int GetLargerPrime(unsigned int u)
+{
+ int cu = isizeof(g_rguPrimes) / isizeof(unsigned int);
+ int iuMin;
+ int iuLim;
+ int iu;
+
+ for (iuMin = 0, iuLim = cu; iuMin < iuLim; )
+ {
+ iu = (iuMin + iuLim) / 2;
+ if (u >= g_rguPrimes[iu])
+ iuMin = iu + 1;
+ else
+ iuLim = iu;
+ }
+ Assert(iuMin == cu || iuMin < cu && u < g_rguPrimes[iuMin]);
+ Assert(iuMin == 0 || iuMin > 0 && u >= g_rguPrimes[iuMin - 1]);
+
+ if (iuMin == cu)
+ return g_rguPrimes[cu - 1];
+ return g_rguPrimes[iuMin];
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Returns the prime in g_rguPrimes that is smaller than u or is the smallest in the list.
+----------------------------------------------------------------------------------------------*/
+unsigned int GetSmallerPrime(unsigned int u)
+{
+ int cu = isizeof(g_rguPrimes) / isizeof(unsigned int);
+ int iuMin;
+ int iuLim;
+ int iu;
+
+ for (iuMin = 0, iuLim = cu; iuMin < iuLim; )
+ {
+ iu = (iuMin + iuLim) / 2;
+ if (u > g_rguPrimes[iu])
+ iuMin = iu + 1;
+ else
+ iuLim = iu;
+ }
+ Assert(iuMin == cu || iuMin < cu && u <= g_rguPrimes[iuMin]);
+ Assert(iuMin == 0 || iuMin > 0 && u > g_rguPrimes[iuMin - 1]);
+
+ if (!iuMin)
+ return g_rguPrimes[0];
+ return g_rguPrimes[iuMin - 1];
+}
+
+}
+
diff --git a/Build/source/libs/graphite/src/painter/Makefile.am b/Build/source/libs/graphite/src/painter/Makefile.am
new file mode 100644
index 00000000000..497d31bd018
--- /dev/null
+++ b/Build/source/libs/graphite/src/painter/Makefile.am
@@ -0,0 +1,5 @@
+painterdir = $(top_srcdir)/src/painter
+
+libgraphite_la_SOURCES += $(painterdir)/SegmentPainter.cpp
+
+#EXTRA_DIST += $(painterdir)/*.h
diff --git a/Build/source/libs/graphite/src/painter/SegmentPainter.cpp b/Build/source/libs/graphite/src/painter/SegmentPainter.cpp
new file mode 100644
index 00000000000..ee92cbe8caf
--- /dev/null
+++ b/Build/source/libs/graphite/src/painter/SegmentPainter.cpp
@@ -0,0 +1,2986 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: SegmentPainter.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Implements the object that handles drawing, mouse clicks, and other UI-related behavior
+ for a Graphite segment.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+// any other headers (not precompiled)
+#include <math.h>
+#ifndef _WIN32
+#include <stdlib.h>
+#endif
+
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+namespace
+{
+
+static bool g_fDrawing;
+
+} // namespace
+
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Constructors.
+----------------------------------------------------------------------------------------------*/
+//SegmentPainter::SegmentPainter(Segment * pseg)
+//{
+// m_pseg = pseg;
+//
+// m_xsOrigin = 0;
+// m_ysOrigin = 0;
+// m_xdPosition = 0;
+// m_ydPosition = 0;
+// m_xFactor = 1.0;
+// m_yFactor = 1.0;
+//}
+
+SegmentPainter::SegmentPainter(Segment * pseg, float xsOrigin, float ysOrigin)
+{
+ m_pseg = pseg;
+
+ m_xsOrigin = xsOrigin;
+ m_ysOrigin = ysOrigin;
+ m_xdPosition = m_xsOrigin;
+ m_ydPosition = m_ysOrigin;
+ m_xFactor = 1.0;
+ m_yFactor = 1.0;
+
+ //m_xsOriginInt = GrEngine::RoundFloat(xsOrigin);
+ //m_xdPositionInt = m_xsOriginInt;
+ //m_xFactor64 = 64;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Destructor.
+----------------------------------------------------------------------------------------------*/
+SegmentPainter::~SegmentPainter()
+{
+}
+
+/*----------------------------------------------------------------------------------------------
+ Initialization.
+
+ The correspondence with the old rectangle approach is:
+ m_xsOrigin = sourceRect.left;
+ m_ysOrigin = sourceRect.top;
+ m_xdPosition = destRect.left;
+ m_ydPosition = destRect.top;
+
+ m_xFactor = (destRect.right - destRect.left) / (sourceRect.right - sourceRect.left);
+ m_yFactor = (destRect.top - destRect.bottom) / (sourceRect.top - sourceRect.bottom);
+
+----------------------------------------------------------------------------------------------*/
+void SegmentPainter::setOrigin(float xsOrigin, float ysOrigin)
+{
+ m_xsOrigin = xsOrigin;
+ m_ysOrigin = ysOrigin;
+
+ //m_xsOriginInt = GrEngine::RoundFloat(xsOrigin);
+}
+
+void SegmentPainter::setPosition(float xdPosition, float ydPosition)
+{
+ m_xdPosition = xdPosition;
+ m_ydPosition = ydPosition;
+
+ //m_xdPositionInt = GrEngine::RoundFloat(xdPosition);
+}
+
+void SegmentPainter::setScalingFactors(float xFactor, float yFactor)
+{
+ m_xFactor = xFactor;
+ m_yFactor = yFactor;
+
+ //int temp = GrEngine::RoundFloat(xFactor);
+ //m_xFactor64 = GrEngine::RoundFloat(xFactor * 64);
+}
+
+
+//:>********************************************************************************************
+//:> SegmentPainter interface methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Draw the text of the segment at the specified point in the graphics context.
+ This method must be implemented by a concrete subclass for painters that really need
+ to paint.
+----------------------------------------------------------------------------------------------*/
+//void SegmentPainter::paint()
+//{
+// Assert(false);
+//}
+
+/*----------------------------------------------------------------------------------------------
+ Indicate if the character position is a valid place for an insertion point.
+
+ @oaram ich - position to test
+ @param pipvr - answer: kipvrOK = IP here is valid;
+ kipvrBad = IP here no good;
+ kipvrUnknown = this seg can't decide, ask the next
+----------------------------------------------------------------------------------------------*/
+LgIpValidResult SegmentPainter::isValidInsertionPoint(int ichw)
+{
+ Assert(m_pseg->m_dxsWidth >= 0);
+ Assert(m_pseg->m_dysAscent >= 0);
+
+ int ichwSegOffset = ichw - m_pseg->m_ichwMin;
+ if (ichwSegOffset < m_pseg->m_ichwAssocsMin || ichwSegOffset >= m_pseg->m_ichwAssocsLim)
+ {
+ // If we're pointing at a hard line break character (Unicode 2028), then we know
+ // that it's a good insertion point in spite of missing the other conditions.
+ utf16 ch;
+ m_pseg->m_pgts->fetch(ichw, 1, &ch);
+ if (ch != knLineSep)
+ return kipvrUnknown; // Definitely in a different segment of the paragraph.
+ return kipvrOK;
+ }
+
+ int isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - m_pseg->m_ichwAssocsMin];
+ if (isloutLig != kNegInfinity)
+ {
+ return kipvrOK;
+ }
+
+ // TODO: do we need to test ALL the associated glyphs? Here we just test the first.
+
+ LgIpValidResult ipvrRet;
+
+ int isloutBefore = m_pseg->UnderlyingToLogicalSurface(ichw, true);
+ int isloutAfter = m_pseg->UnderlyingToLogicalSurface(ichw - 1, false);
+ int isloutTest = m_pseg->UnderlyingToLogicalInThisSeg(ichw);
+ if (isloutBefore == isloutAfter)
+ // If inserting before this character yields the same visible result as
+ // inserting after the previous, then this character is invisible, or has
+ // been merged with the previous, and it doesn't make sense to put an insertion
+ // point here.
+ ipvrRet = kipvrBad;
+ else if (isloutTest == kNegInfinity || isloutTest == kPosInfinity)
+ ipvrRet = kipvrBad; // can't figure it out
+ else if (!m_pseg->OutputSlot(isloutTest)->InsertBefore())
+ ipvrRet = kipvrBad;
+ else if (m_pseg->SameSurfaceGlyphs(ichw - 1, ichw))
+ // The insertion point would be between two characters that map to the same
+ // set of glyphs. Not a good place.
+ ipvrRet = kipvrBad;
+ else
+ ipvrRet = kipvrOK;
+
+ return ipvrRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Answer whether the logical and physical boundaries of the string coincide.
+ This method is called by the application to handle writing system boundaries, and by
+ other segments in a writing-system chain to handle line-breaks.
+
+ @param fBoundaryEnd - asking about the logical end boundary?
+ @param fBoundaryRight - asking about the physical right boundary?
+ @param pfResult - return value
+----------------------------------------------------------------------------------------------*/
+bool SegmentPainter::doBoundariesCoincide(bool fBoundaryEnd, bool fBoundaryRight)
+{
+ float xsBefore, ysBeforeTop, ysBeforeBottom;
+ float xsAfter, ysAfterTop, ysAfterBottom;
+ bool fRtlBefore, fRtlAfter;
+
+ if (m_pseg->m_cginf == 0)
+ {
+ // Empty segment.
+ return true;
+ }
+
+ //SetUpGraphics(ichwBase, pgg, true);
+
+ Assert(m_pseg->m_dxsWidth >= 0);
+ Assert(m_pseg->m_dysAscent >= 0);
+
+ if (fBoundaryEnd)
+ {
+ CalcIP(m_pseg->m_ichwMin + m_pseg->m_dichwLim, true,
+ &xsBefore, &ysBeforeTop, &ysBeforeBottom, &fRtlBefore);
+ CalcIP(m_pseg->m_ichwMin + m_pseg->m_dichwLim, false,
+ &xsAfter, &ysAfterTop, &ysAfterBottom, &fRtlAfter);
+ }
+ else
+ {
+ CalcIP(m_pseg->m_ichwMin, true,
+ &xsBefore, &ysBeforeTop, &ysBeforeBottom, &fRtlBefore);
+ CalcIP(m_pseg->m_ichwMin, false,
+ &xsAfter, &ysAfterTop, &ysAfterBottom, &fRtlAfter);
+ }
+
+ // We allow for rounding errors which might cause differences between the expected
+ // and the actual values, hence the test for a difference of <= 1.
+ bool fRet;
+ if (fBoundaryRight)
+ {
+ // right edge
+ if (fBoundaryEnd) // logical end
+ fRet = (!fRtlAfter && fabsf(xsAfter - (m_pseg->m_dxsTotalWidth + m_pseg->m_dxsStretch)) <= 1);
+ else // logical start
+ fRet = (fRtlBefore && fabsf(xsBefore - (m_pseg->m_dxsTotalWidth + m_pseg->m_dxsStretch)) <= 1);
+ }
+ else
+ {
+ // left edge
+ if (fBoundaryEnd) // logical end
+ fRet = (fRtlAfter && fabsf(xsAfter) <= 1);
+ else // logical start
+ fRet = (!fRtlBefore && fabsf(xsBefore) <= 1);
+ }
+
+ return fRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Draw an insertion point at an appropriate position.
+
+ @param twx, twy - same origin used to Draw segment
+ @param ich - character position; must be valid
+ @param fAssocPrev - associated with previous character?
+ @param bOn - turning on or off? Caller should alternate, first turning on
+ (ignored in this implementation)
+ @param dm - draw mode:
+ kdmNormal = draw complete insertion pt (I-beam or split cursor);
+ kdmPrimary = only draw primary half of split cursor;
+ kdmSecondary = only draw secondary half of split cursor
+----------------------------------------------------------------------------------------------*/
+void SegmentPainter::drawInsertionPoint(int ichwIP, bool fAssocPrev,
+ bool bOn, bool fForceSplit) // LgIPDrawMode dm)
+{
+ if (g_fDrawing)
+ return;
+
+ g_fDrawing = true;
+
+ //SetUpGraphics(ichwBase, pgg, true);
+
+ Assert(m_pseg->m_dxsWidth >= 0);
+ Assert(m_pseg->m_dysAscent >= 0);
+
+ CalcOrDrawInsertionPoint(ichwIP,
+ fAssocPrev, bOn, fForceSplit,
+ NULL, NULL); // passing NULLs here means we want to draw
+
+ //RestoreFont(pgg);
+
+ g_fDrawing = false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Fill in bounding rectangles for the (possibly 2-part) IP, in destination device coordinates.
+ Return flags indicating which of the 2 parts where rendered here.
+
+ @param rs,rd - source/destination coordinates, for scaling
+ @param ichwIP - insertion point
+ @param fAssocPrev - is the IP "leaning" backward?
+ @param dm - draw mode:
+ kdmNormal = draw complete insertion pt (I-beam or split cursor);
+ kdmPrimary = only draw primary half of split cursor;
+ kdmSecondary = only draw secondary half of split cursor
+ @param prdPrimary - return location of primary selection, in dest coords
+ @param prdSecondary - return location of secondary selection, in dest coords
+----------------------------------------------------------------------------------------------*/
+void SegmentPainter::positionsOfIP(
+ int ichwIP, bool fAssocPrev, bool fForceSplit,
+ Rect * prdPrimary, Rect * prdSecondary)
+{
+ ChkGrArgPtr(prdPrimary);
+ ChkGrArgPtr(prdSecondary);
+
+ //SetUpGraphics(ichwBase, pgg, true);
+
+ Assert(m_pseg->m_dxsWidth >= 0);
+ Assert(m_pseg->m_dysAscent >= 0);
+
+ CalcOrDrawInsertionPoint(ichwIP, fAssocPrev, true, fForceSplit,
+ prdPrimary, prdSecondary);
+
+ //RestoreFont(pgg);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Highlight a range of text.
+
+ @param ichwAnchor/End - selected range
+ @param ydLineTop/Bottom - top/bottom of area to highlight if whole line height;
+ includes half of inter-line spacing.
+ @param bOn - true if we are turning on (ignored in this implementation)
+----------------------------------------------------------------------------------------------*/
+bool SegmentPainter::drawSelectionRange(int ichwAnchor, int ichwEnd,
+ float ydLineTop, float ydLineBottom, bool bOn)
+{
+ if (g_fDrawing)
+ return true;
+
+ g_fDrawing = true;
+
+ //SetUpGraphics(ichwBase, pgg, true);
+
+ Assert(m_pseg->m_dxsWidth >= 0);
+ Assert(m_pseg->m_dysAscent >= 0);
+
+ float xsSegLeft = 0;
+ float ysSegTop = 0;
+
+ float xdSegRight = ScaleXToDest(m_pseg->m_dxsTotalWidth);
+
+ int ichwMinSel = min(ichwAnchor, ichwEnd);
+ int ichwLimSel = max(ichwAnchor, ichwEnd);
+
+ int ichwMinSeg = max(ichwMinSel, m_pseg->m_ichwMin + m_pseg->m_ichwAssocsMin);
+ int ichwLimSeg = min(ichwLimSel, m_pseg->m_ichwMin + m_pseg->m_ichwAssocsLim);
+
+ std::vector<Rect> vrs;
+ std::vector<bool> vfEntireHt;
+
+ bool * prgfAllCompsSelected = new bool[m_pseg->m_dichwLim];
+ std::fill_n(prgfAllCompsSelected, m_pseg->m_dichwLim, false);
+ CalcPartialLigatures(prgfAllCompsSelected, ichwMinSeg, ichwLimSeg,
+ ichwMinSel, ichwLimSel);
+
+ // Array to keep track of which glyphs were highlighted.
+ int cginf = m_pseg->m_cginf;
+ bool * prgfHighlighted = new bool[cginf];
+ std::fill_n(prgfHighlighted, cginf, false);
+
+ for (int ichwLp = ichwMinSeg; ichwLp < ichwLimSeg; ichwLp++)
+ {
+ CalcHighlightRect(ichwLp, vrs, vfEntireHt,
+ !prgfAllCompsSelected[ichwLp - m_pseg->m_ichwMin], prgfHighlighted, false);
+ }
+
+ // If all the glyphs of a given cluster were highlighted, highlight the whole cluster
+ // as a unit.
+ for (int islout = 0; islout < m_pseg->m_cslout; islout++)
+ {
+ CalcCompleteCluster(islout, vrs, vfEntireHt, prgfHighlighted);
+ }
+
+ // Convert to destination coordinates; also extend full-line rectangles to the top
+ // and bottom of the line height.
+ std::vector<Rect> vrd;
+ for (size_t irs = 0; irs < vrs.size(); irs++)
+ {
+ Rect rsTmp = vrs[irs];
+ Rect rdTmp;
+ if (vfEntireHt[irs])
+ {
+ rdTmp.top = ydLineTop;
+ rdTmp.bottom = ydLineBottom;
+ }
+ else
+ {
+ float ydTmp = ScaleYToDest(rsTmp.top + ysSegTop);
+ rdTmp.top = min(ydLineBottom, max(ydLineTop, ydTmp));
+ ydTmp = ScaleYToDest(rsTmp.bottom + ysSegTop);
+ rdTmp.bottom = max(ydLineTop, min(ydLineBottom, ydTmp));
+ }
+ float xdTmp = ScaleXToDest(rsTmp.left + xsSegLeft);
+ rdTmp.left = min(xdSegRight, max(float(0), xdTmp));
+ xdTmp = ScaleXToDest(rsTmp.right + xsSegLeft);
+ rdTmp.right = max(float(0), min(xdSegRight, xdTmp));
+ if (rdTmp.left > rdTmp.right)
+ {
+ // I think this can happen due to rounding errors.
+ float tmp = rdTmp.left;
+ rdTmp.left = rdTmp.right;
+ rdTmp.right = tmp;
+ }
+ vrd.push_back(rdTmp);
+ }
+
+ // Create a list of rectangles with no overlaps, so the selection draws cleanly.
+ std::vector<Rect> vrdNoOverlaps;
+ size_t irect;
+ for (irect = 0; irect < vrd.size(); irect++)
+ AddRectWithoutOverlaps(vrdNoOverlaps, vrd[irect]);
+
+ AssertNoOverlaps(vrdNoOverlaps);
+
+ // Draw the hightlight.
+ for (irect = 0; irect < vrdNoOverlaps.size(); irect++)
+ {
+ Rect rdTmp = vrdNoOverlaps[irect];
+ InvertRect(rdTmp.left, rdTmp.top, rdTmp.right, rdTmp.bottom);
+ }
+
+ delete[] prgfAllCompsSelected;
+ delete[] prgfHighlighted;
+
+ //RestoreFont(pgg);
+
+ g_fDrawing = false;
+
+ return (vrdNoOverlaps.size() > 0);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get a bounding rectangle that will contain the area highlighted by this segment
+ when drawing the specified range.
+
+ @param ichwAnchor/End - selected range
+ @param ydLineTop/Bottom - top/bottom of area to highlight if whole line height;
+ includes half of inter-line spacing.
+ @param prdBounds - return location of range
+ @return - true if the return rectange has a meaningful value
+----------------------------------------------------------------------------------------------*/
+bool SegmentPainter::positionsOfRange(int ichwAnchor, int ichwEnd,
+ float ydLineTop, float ydLineBottom, Rect * prdBounds)
+{
+ ChkGrArgPtr(prdBounds);
+
+ std::vector<Rect> vrs;
+ std::vector<bool> vfEntireHt;
+
+ //SetUpGraphics(ichwBase, pgg, true);
+
+ Assert(m_pseg->m_dxsWidth >= 0);
+ Assert(m_pseg->m_dysAscent >= 0);
+
+ int ichwMin = min(ichwAnchor, ichwEnd);
+ int ichwLim = max(ichwAnchor, ichwEnd);
+
+ for (int ichwLp = ichwMin; ichwLp < ichwLim; ichwLp++)
+ {
+ CalcHighlightRect(ichwLp, vrs, vfEntireHt, true, NULL, false);
+ }
+
+ if (vrs.size() == 0)
+ {
+ return false;
+ }
+
+ Rect * prsBounds = &(vrs[0]);
+ for (size_t irect = 1; irect < vrs.size(); irect++)
+ {
+ Rect * prs = &(vrs[irect]);
+ prsBounds->left = min(prsBounds->left, prs->left);
+ prsBounds->right = max(prsBounds->right, prs->right);
+ }
+
+ prdBounds->top = ydLineTop;
+ prdBounds->bottom = ydLineBottom;
+ prdBounds->left = ScaleXToDest(prsBounds->left);
+ prdBounds->right = ScaleXToDest(prsBounds->right);
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Convert a click position to a character position.
+
+ @param zptdClickPosition - relative to the segment draw origin
+ @param pichw - return character clicked before
+ @param pfAssocPrev - return true if they clicked on the trailing half of
+ the previous char, false if click was on the
+ leading half of the following
+----------------------------------------------------------------------------------------------*/
+void SegmentPainter::pointToChar(Point zptdClickPosition, int * pichw, bool * pfAssocPrev)
+{
+ ChkGrOutPtr(pichw);
+ ChkGrOutPtr(pfAssocPrev);
+
+ //SetUpGraphics(ichwBase, pgg, true);
+
+ bool fRtl = m_pseg->rightToLeft();
+
+ if (m_pseg->m_dysAscent < 0 || m_pseg->m_dxsWidth < 0)
+ m_pseg->ComputeDimensions();
+
+ if (m_pseg->m_dichwLim == 0 || m_pseg->m_cginf == 0)
+ {
+ *pichw = m_pseg->m_ichwMin;
+ *pfAssocPrev = false;
+ //RestoreFont(pgg);
+ return;
+ }
+
+ float xsClick = ScaleXToSource(zptdClickPosition.x);
+ float ysClick = ScaleYToSource(zptdClickPosition.y);
+ ysClick = m_pseg->m_dysAscent - ysClick; // make relative to common base line
+
+ float xsTry = xsClick;
+ float ysTry = ysClick;
+
+ float xysInc = 1.0;
+ //res = pgg->LogUnitsFromXPixels(1, &xysInc);
+ //if (ResultFailed(res)) xysInc = 20;
+ int cTries = 1;
+ int nAdjustDir = 0;
+
+ while (true)
+ {
+ float xsGlyphOffset;
+ float xsGlyphWidth;
+ int iginfLoc = PointToCharAux(xsTry, ysTry, &xsGlyphOffset, &xsGlyphWidth);
+
+ bool fClickedAfter;
+ int ichwCharClicked;
+ if (xsTry < m_pseg->m_prgginf[m_pseg->LeftMostGlyph()].bb().left)
+ {
+ fClickedAfter = fRtl;
+ ichwCharClicked = (fClickedAfter) ?
+ m_pseg->m_ichwMin + m_pseg->m_ichwAssocsLim - 1 :
+ m_pseg->m_ichwMin + m_pseg->m_ichwAssocsMin;
+ }
+ else if (xsTry > m_pseg->m_prgginf[m_pseg->RightMostGlyph()].bb().right)
+ {
+ fClickedAfter = !fRtl;
+ ichwCharClicked = (fClickedAfter) ?
+ m_pseg->m_ichwMin + m_pseg->m_ichwAssocsLim - 1 :
+ m_pseg->m_ichwMin + m_pseg->m_ichwAssocsMin;
+ }
+ else
+ {
+ ichwCharClicked = m_pseg->PhysicalSurfaceToUnderlying(iginfLoc,
+ xsTry - xsGlyphOffset, m_pseg->m_dysAscent - ysClick,
+ xsGlyphWidth, m_pseg->m_dysHeight, &fClickedAfter); // handles ligature components
+ }
+
+ if (fClickedAfter)
+ {
+ *pichw = ichwCharClicked + 1;
+ while (!GrCharStream::AtUnicodeCharBoundary(m_pseg->GetString(), *pichw))
+ *pichw = *pichw + 1;
+ *pfAssocPrev = true;
+ }
+ else
+ {
+ *pichw = ichwCharClicked;
+ *pfAssocPrev = false;
+ }
+
+ if (*pichw < m_pseg->m_ichwMin + m_pseg->m_ichwAssocsMin)
+ {
+ //RestoreFont(pgg);
+ return;
+ }
+ else if (*pichw >= m_pseg->m_ichwMin + m_pseg->m_ichwAssocsLim)
+ {
+ //RestoreFont(pgg);
+ return;
+ }
+
+ //int islout = UnderlyingToLogicalInThisSeg(ichwBase, ichwCharClicked);
+ int isloutBefore = m_pseg->UnderlyingToLogicalInThisSeg(*pichw);
+ if (isloutBefore == kNegInfinity || isloutBefore == kPosInfinity)
+ { }
+ else
+ {
+ Assert(0 <= isloutBefore && isloutBefore < m_pseg->m_cslout);
+ if (m_pseg->OutputSlot(isloutBefore)->InsertBefore())
+ {
+ // Legal insertion point
+ //RestoreFont(pgg);
+ return;
+ }
+ }
+
+ // Gradually adjust the click position in various directions and try again
+ // until we find a legal insertion point.
+ switch (nAdjustDir)
+ {
+ case 0: // Adjust to the left
+ case 4:
+ xsTry = xsClick - (xysInc * cTries);
+ ysTry = ysClick;
+ nAdjustDir = 0;
+ break;
+ case 1: // Adjust to the right
+ xsTry = xsClick + (xysInc * cTries);
+ ysTry = ysClick;
+ break;
+ case 2: // Adjust up
+ xsTry = xsClick;
+ ysTry = ysClick - (xysInc * cTries);
+ break;
+ case 3: // Adjust down
+ xsTry = xsClick;
+ ysTry = ysClick + (xysInc * cTries);
+ cTries++;
+ break;
+ default:
+ Assert(false);
+ nAdjustDir = 0;
+ cTries++;
+ }
+ nAdjustDir++;
+
+ if (cTries > 50)
+ { // Safety net
+ *pichw = 0;
+ *pfAssocPrev = false;
+ THROW(kresFail);
+ }
+ else if (cTries > 20)
+ xysInc = xysInc * 2;
+ }
+
+ //RestoreFont(pgg);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Convert a click position to a glyph bounding-box position.
+----------------------------------------------------------------------------------------------*/
+int SegmentPainter::PointToCharAux(float xsTry, float ysTry,
+ float * pxsGlyphOffset, float * pxsGlyphWidth)
+{
+ int iginfLoc = m_pseg->GlyphHit(xsTry, ysTry);
+
+ GlyphInfo * pginf = m_pseg->m_prgginf + iginfLoc;
+ *pxsGlyphOffset = pginf->bb().left;
+ *pxsGlyphWidth = pginf->bb().right - *pxsGlyphOffset;
+
+ return iginfLoc;
+}
+
+// Review: may need a way to do this and subsequent methods with one result per method?
+/*----------------------------------------------------------------------------------------------
+ Returns a value what logical position an arrow key should move the IP to.
+
+ @param ichwIP - initial position
+ @param pfAssocPrev - is the IP "leaning" backwards? input and output
+ @param fRight - direction of desired movement (physical or logical?)
+ @param pfInThisSeg - initially true if ichwIP is in the current segment;
+ return value is true if there is a legitimate output
+----------------------------------------------------------------------------------------------*/
+int SegmentPainter::arrowKeyPosition(int ichwIP, bool * pfAssocPrev,
+ bool fRight, bool * pfInThisSeg)
+//GrResult SegmentPainter::arrowKeyPosition(
+// int * pichwIP, bool * pfAssocPrev,
+// bool fRight, bool fMovingIn,
+// bool * pfResult)
+{
+ ChkGrArgPtr(pfAssocPrev);
+ //ChkGrOutPtr(pfInThisSeg);
+
+ bool fMovingIn = !*pfInThisSeg;
+ int ichwTmp = ichwIP;
+ bool fResult;
+ ArrowKeyPositionAux(&ichwTmp, pfAssocPrev, fRight, fMovingIn, false, false, &fResult);
+ *pfInThisSeg = fResult;
+ return ichwTmp;
+
+ //return ArrowKeyPositionAux(pichwIP, pfAssocPrev,
+ // fRight, fMovingIn, false, false, pfResult);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Indicate what logical position a shift-arrow-key combination should move the
+ end of the selection to.
+
+ @param pichw - initial endpoint and also adjusted result
+ @param fAssocPrevMatch - true if we need a certain orientation for the result;
+ should be false when *pichw = 0 and we are moving within the
+ same segment
+ @param fAssocPrevNeeded - association of the end-point, ie, true if it follows the anchor
+ @param ichAnchor - -1 if anchor is in a different segment
+ @param fRight - direction of desired movement
+ @param fMovingIn - true if we are moving in to this segment;
+ if so, initial pichw meaningless
+ @param pfRet - if false try next seg or string
+----------------------------------------------------------------------------------------------*/
+int SegmentPainter::extendSelectionPosition(int ichwEnd, bool fAssocPrevMatch, bool fAssocPrevNeeded,
+ int ichwAnchor, bool fRight, bool * pfInThisSeg)
+//GrResult SegmentPainter::extendSelectionPosition(
+// int * pichw, bool fAssocPrevMatch, bool fAssocPrevNeeded, int ichwAnchor,
+// bool fRight, bool fMovingIn,
+// bool* pfRet)
+{
+ //ChkGrArgPtr(pichw);
+ //ChkGrOutPtr(pfRet);
+
+ // Make the same adjustment as for an insertion point.
+ bool fAssocPrevCopy = fAssocPrevMatch;
+ bool fMovingIn = !*pfInThisSeg;
+ int ichwOld = ichwEnd;
+ int ichwNew = ichwEnd;
+ bool fResult;
+ ArrowKeyPositionAux(&ichwNew, &fAssocPrevCopy,
+ fRight, fMovingIn, fAssocPrevMatch, fAssocPrevNeeded, &fResult);
+ *pfInThisSeg = fResult;
+
+ //int ichwNew = *pichw;
+ //bool fAssocPrevCopy = fAssocPrevMatch;
+ //// TODO: adjust fAssocPrevCopy based on assoc-prev value of IP
+ //*pfRet = false;
+ //int ichwOld = *pichw;
+ //GrResult res = ArrowKeyPositionAux(&ichwNew, &fAssocPrevCopy,
+ // fRight, fMovingIn,
+ // fAssocPrevMatch, fAssocPrevNeeded,
+ // pfRet);
+
+// if (*pfRet && ichwNew == *pichw)
+// {
+// // The selection wasn't actually moved, just switched the direction it leans.
+// // Try one more time.
+// res = ArrowKeyPositionAux(&ichwNew, &fAssocPrevCopy,
+// fRight, fMovingIn,
+// (ichwAnchor != *pichw && fAssocPrevNeeded), fAssocPrevNeeded,
+// pfRet);
+// }
+ if (ichwAnchor != -1 && fResult &&
+ ((ichwNew < ichwAnchor && ichwAnchor < ichwOld) ||
+ (ichwOld < ichwAnchor && ichwAnchor < ichwNew)))
+ {
+ // Don't switch directions in one operation--force to an insertion point.
+ ichwNew = ichwAnchor;
+ }
+ return ichwNew;
+ //*pichw = ichwNew;
+ //ReturnResult(res);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Handle arrow key movement for both plain and shifted arrows.
+
+ @param pichw - initial endpoint and also adjusted result
+ @param pfAssocPrev - association of the end-point, ie, true if it follows the anchor
+ @param fRight - direction of desired movement
+ @param fMovingIn - true if we are moving in to this segment;
+ if so, initial pichw meaningless
+ @param fAssocPrevMatch - true if the direction of the result should
+ match the requested orientation, to avoid flipping around and
+ infinite loops
+ @param fAssocPrevNeeded - what is needed for the result, if fAssocPrevMatch == true
+ @param pfRet - if false try next segment or string
+----------------------------------------------------------------------------------------------*/
+GrResult SegmentPainter::ArrowKeyPositionAux(
+ int * pichwIP, bool * pfAssocPrev,
+ bool fRight, bool fMovingIn,
+ bool fAssocPrevMatch, bool fAssocPrevNeeded,
+ bool * pfResult)
+{
+ ChkGrArgPtr(pfResult);
+
+ //bool fAssocPrevTmp = *pfAssocPrev;
+
+ Assert(m_pseg->m_dxsWidth >= 0);
+ Assert(m_pseg->m_dysAscent >= 0);
+
+ int nNextOrPrevSeg;
+ if (!fMovingIn)
+ {
+ *pfResult = ArrowKeyPositionInternal(pichwIP, pfAssocPrev, fRight,
+ fAssocPrevMatch, fAssocPrevNeeded, &nNextOrPrevSeg);
+ ReturnResult(kresOk);
+ }
+ else
+ {
+ int ichw;
+ bool fAssocPrevNew;
+ if (fRight)
+ {
+ // Moving right: make selection at left edge.
+ int iginf = m_pseg->LeftMostGlyph();
+ bool fBefore = !m_pseg->rightToLeft();
+ ichw = m_pseg->PhysicalSurfaceToUnderlying(iginf, fBefore) +
+ ((fBefore) ? 0 : 1);
+ fAssocPrevNew = !fBefore; // Review: should it be based on the char dir?
+ }
+ else
+ {
+ // Moving left: make selection at right edge;
+ int iginf = m_pseg->RightMostGlyph();
+ bool fBefore = m_pseg->rightToLeft();
+ ichw = m_pseg->PhysicalSurfaceToUnderlying(iginf, fBefore) +
+ ((fBefore) ? 0 : 1);
+ fAssocPrevNew = !fBefore; // Review: should it be based on the char dir?
+ }
+
+ // Okay, now we have a selection at the edge of the segment. Try moving inside by
+ // one glyph.
+ *pfResult = ArrowKeyPositionInternal(&ichw, &fAssocPrevNew, fRight,
+ fAssocPrevMatch, fAssocPrevNeeded, &nNextOrPrevSeg);
+ if (*pfResult)
+ {
+ *pichwIP = ichw;
+ *pfAssocPrev = fAssocPrevNew;
+ }
+
+ }
+
+ ReturnResult(kresOk);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Used to find out where underlines should be drawn.
+
+ @param ichwMin/Lim - range of text of interest
+ @param rs, rd - source/destination coordinates, for scaling
+ @param fSkipSpace - true if white space should not be underlined; some renderers may
+ ignore this
+ @param cxdMax - number of ranges allowed
+ @param prgxdLefts/Rights/UnderTops
+ - arrays of corresponding values indicating where an underline
+ should be drawn, in logical order
+
+ TODO: fix the bug where if you have trailing spaces in different segments (eg,
+ at different sizes), the spaces all but the last segment will be erroneously included
+ in the underline result.
+----------------------------------------------------------------------------------------------*/
+size_t SegmentPainter::getUnderlinePlacement(int ichwMin, int ichwLim,
+ bool fSkipSpace, size_t cxdMax,
+ float * prgxdLefts, float * prgxdRights, float * prgydUnderTops)
+{
+ ChkGrArrayArg(prgxdLefts, cxdMax);
+ ChkGrArrayArg(prgxdRights, cxdMax);
+ //ChkGrArrayArg(prgydUnderTops, cxdMax);
+
+ GrResult res = kresOk;
+
+ //SetUpGraphics(ichwBase, pgg, true);
+
+ Assert(m_pseg->m_dxsWidth >= 0);
+ Assert(m_pseg->m_dysAscent >= 0);
+
+ float xsSegLeft = m_pseg->m_dxsTotalWidth;
+ for (int iginf = 0; iginf < m_pseg->m_cginf; iginf++)
+ {
+ xsSegLeft = min(xsSegLeft, m_pseg->GlyphLeftEdge(iginf));
+ }
+
+ float xdSegLeft = this->ScaleXToDest(xsSegLeft);
+ float xdSegRight = xdSegLeft + m_pseg->m_dxsTotalWidth;
+
+ int ichwMinSel = min(ichwMin, ichwLim);
+ int ichwLimSel = max(ichwMin, ichwLim);
+
+ int ichwMinSeg = max(ichwMinSel, m_pseg->m_ichwMin + m_pseg->m_ichwAssocsMin);
+ int ichwLimSeg = min(ichwLimSel, m_pseg->m_ichwMin + m_pseg->m_ichwAssocsLim);
+
+ std::vector<Rect> vrs;
+ std::vector<bool> vfEntireHt;
+
+ bool * prgfAllCompsSelected = new bool[m_pseg->m_dichwLim];
+ std::fill_n(prgfAllCompsSelected, m_pseg->m_dichwLim, false);
+ CalcPartialLigatures(prgfAllCompsSelected, ichwMinSeg, ichwLimSeg,
+ ichwMinSel, ichwLimSel);
+
+ // Array to keep track of which glyphs were highlighted:
+ int cginf = m_pseg->m_cginf;
+ bool * prgfHighlighted = new bool[cginf];
+ std::fill_n(prgfHighlighted, cginf, false);
+
+ for (int ichwLp = ichwMinSeg; ichwLp < ichwLimSeg; ichwLp++)
+ {
+ CalcHighlightRect(ichwLp, vrs, vfEntireHt,
+ !prgfAllCompsSelected[ichwLp - m_pseg->m_ichwMin], prgfHighlighted,
+ (m_pseg->m_fEndLine && fSkipSpace));
+ }
+
+ // If all the glyphs of a given cluster were highlighted, highlight the whole cluster
+ // as a unit.
+ for (int islout = 0; islout < m_pseg->m_cslout; islout++)
+ {
+ CalcCompleteCluster(islout, vrs, vfEntireHt, prgfHighlighted);
+ }
+
+ // Convert rectangles in source coordinates to line segments in destination
+ // coordinates.
+ std::vector<LineSeg> vlsd;
+ for (size_t irs = 0; irs < vrs.size(); irs++)
+ {
+ Rect rsTmp = vrs[irs];
+ LineSeg lsdTmp;
+ lsdTmp.left = min(xdSegRight, max(xdSegLeft, ScaleXToDest(rsTmp.left)));
+ lsdTmp.right = max(xdSegLeft, min(xdSegRight, ScaleXToDest(rsTmp.right)));
+ vlsd.push_back(lsdTmp);
+ }
+
+ // Create a list of line segments with no overlaps.
+ std::vector<LineSeg> vlsdNoOverlaps;
+ size_t ils;
+ for (ils = 0; ils < vlsd.size(); ils++)
+ AddLineSegWithoutOverlaps(vlsdNoOverlaps, vlsd[ils]);
+
+ AssertNoOverlaps(vlsdNoOverlaps);
+
+ // The gap between the baseline and underlining is one pixel, on a normal screen
+ // at standard magnification, and as near as we can get to the equivalent in any
+ // special case.
+ //float dydGap = rdHeight / 96;
+ //float dydSubscript = max(float(0), (-1 * GrEngine::GrFloatMulDiv(m_pseg->m_dysOffset, rsHeight, rdHeight)));
+ float dydGap = 1;
+ float dydSubscript = max(float(0), (-1 * (m_pseg->m_dysOffset * m_yFactor)));
+ float ydBottom = ScaleYToDest(m_pseg->m_dysAscent) + dydGap + dydSubscript;
+
+ // Put the results in the output buffers.
+ size_t cxdRet = vlsdNoOverlaps.size();
+ for (ils = 0; ils < min(cxdRet, size_t(cxdMax)); ils++)
+ {
+ prgxdLefts[ils] = vlsdNoOverlaps[ils].left;
+ prgxdRights[ils] = vlsdNoOverlaps[ils].right;
+ if (prgydUnderTops)
+ prgydUnderTops[ils] = ydBottom;
+ }
+ delete[] prgfAllCompsSelected;
+ delete[] prgfHighlighted;
+
+ //RestoreFont(pgg);
+
+ if (vlsdNoOverlaps.size() > cxdMax)
+ res = kresFail;
+
+ return cxdRet;
+}
+
+
+//:>********************************************************************************************
+//:> Other methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Handle either drawing an insertion point or returning the position at which it
+ would be drawn.
+
+ @param ichwIP - character position
+ @param fAssocPrev - true if selection is associated with previous character
+ @param bOn - turning on or off? (ignored in this implementation)
+ @param fForceSplit - force a split insertion point
+ @param prdPrimary - if NULL, do drawing; otherwise, return location of primary IP
+ in destination device coordinates
+ @param prdSecondary - return location of secondary IP in dest device coordinates
+ @param pfPrimaryHere - true if primary selection is rendered in this segment
+ @param pfSecHere - true if (distinct) secondary selection is rendered in this segment;
+ false if it is in a different segment, or we are rendering
+ an I-beam (std selection)
+----------------------------------------------------------------------------------------------*/
+void SegmentPainter::CalcOrDrawInsertionPoint(
+ int ichwIP, bool fAssocPrev, bool bOn, bool fForceSplit,
+ Rect * prdPrimary, Rect * prdSecondary)
+{
+ GrResult res = kresOk;
+
+ float xsSegLeft = 0;
+ float ysSegTop = 0;
+
+ if (prdPrimary)
+ {
+ prdPrimary->top = 0;
+ prdPrimary->bottom = 0;
+ prdPrimary->left = 0;
+ prdPrimary->right = 0;
+ }
+ if (prdSecondary)
+ {
+ prdSecondary->top = 0;
+ prdSecondary->bottom = 0;
+ prdSecondary->left = 0;
+ prdSecondary->right = 0;
+ }
+
+ int ichwLim = m_pseg->m_ichwMin + m_pseg->m_dichwLim;
+ bool fRtl = m_pseg->rightToLeft();
+
+ if (m_pseg->m_dxsWidth < 0)
+ m_pseg->ComputeDimensions();
+
+ // Get the locations for the before and after selections.
+
+ float xsBefore, ysBeforeTop, ysBeforeBottom;
+ float xsAfter, ysAfterTop, ysAfterBottom;
+ bool fRtlBefore, fRtlAfter;
+ CalcIP(ichwIP, true, &xsBefore, &ysBeforeTop, &ysBeforeBottom, &fRtlBefore);
+ CalcIP(ichwIP, false, &xsAfter, &ysAfterTop, &ysAfterBottom, &fRtlAfter);
+
+ if (m_pseg->m_cginf == 0 && ichwIP == ichwLim)
+ {
+ Assert(kPosInfFloat == xsBefore && kPosInfFloat == xsAfter);
+ xsBefore = 0;
+ xsAfter = 0;
+ }
+ else if ((kPosInfFloat == xsBefore || kNegInfFloat == xsBefore) &&
+ (kPosInfFloat == xsAfter || kNegInfFloat == xsAfter))
+ {
+ return; // quick exit for nothing-to-draw case
+ }
+
+ bool fPrimary = true;
+ if (fForceSplit)
+ {
+ // Supposedly we can't find both halves of the IP in this segment.
+ Assert(xsBefore == kPosInfFloat || xsBefore == kNegInfFloat
+ || xsAfter == kPosInfFloat || xsAfter == kNegInfFloat);
+ if (xsBefore == kPosInfFloat || xsBefore == kNegInfFloat)
+ {
+ // Can't find the char the IP is before.
+ fPrimary = fAssocPrev;
+ }
+ else // if (xsAfter == kPosInfinity || xsAfter == kNegInfinity)
+ {
+ // Can't find the char the IP is after.
+ fPrimary = !fAssocPrev;
+ }
+ ////Assert((dm == kdmSplitPrimary) == fPrimary);
+ }
+
+ if (xsBefore == kPosInfinity || xsBefore == kNegInfinity)
+ {
+ ysBeforeTop = ysSegTop;
+ ysBeforeBottom = ysSegTop + m_pseg->m_dysHeight;
+ }
+ else
+ {
+ xsBefore += xsSegLeft;
+ ysBeforeTop += ysSegTop;
+ ysBeforeBottom += ysSegTop;
+ }
+ if (xsAfter == kNegInfinity || xsAfter == kPosInfinity)
+ {
+ ysAfterTop = ysSegTop;
+ ysAfterBottom = ysSegTop + m_pseg->m_dysHeight;
+ }
+ else
+ {
+ xsAfter += xsSegLeft;
+ ysAfterTop += ysSegTop;
+ ysAfterBottom += ysSegTop;
+ }
+
+ float xsLeft = xsSegLeft
+ + ((fRtl && m_pseg->m_fEndLine) ? (m_pseg->m_dxsVisibleWidth - m_pseg->m_dxsTotalWidth) :0);
+ float xsRight = xsSegLeft
+ + ((fRtl && m_pseg->m_fEndLine) ? m_pseg->m_dxsVisibleWidth : m_pseg->m_dxsTotalWidth)
+ + m_pseg->m_dxsStretch;
+ float dysMinSplitHeight = m_pseg->m_dysHeight / 4;
+
+ if (!fForceSplit) // kdmNormal == dm)
+ {
+ // Standard I-beam, or both halves of split IP.
+
+ bool fIBeam = false;
+
+ if (xsBefore == xsAfter)
+ // Positions coincide within this segment: make an I-beam.
+ fIBeam = true;
+
+ else if (fabsf(xsBefore - xsLeft) <= 1 && ichwIP == m_pseg->m_ichwMin)
+ {
+ // Logical start is at a left edge: allow I-beam if previous segment has one
+ // at the end (or there is no previous segment).
+ //Assert(!fRtlBefore);
+ //if (m_pseg->m_psegPrev)
+ //{
+ // SegmentPainter segpPrev(m_pseg->m_psegPrev);
+ // fIBeam = segpPrev.doBoundariesCoincide(true, true);
+ //}
+ //else
+
+ fIBeam = true;
+ }
+ else if (fabsf(xsBefore - xsRight) <= 1 && ichwIP == m_pseg->m_ichwMin)
+ {
+ // Logical start is at a right edge: allow I-beam if previous segment has one
+ // at the end (or there is no previous segment).
+ //Assert(fRtlBefore);
+ //if (m_pseg->m_psegPrev)
+ //{
+ // SegmentPainter segpPrev(m_pseg->m_psegPrev);
+ // fIBeam = segpPrev.doBoundariesCoincide(true, false);
+ //}
+ //else
+
+ fIBeam = true;
+ }
+ else if (fabsf(xsAfter - xsLeft) <= 1 && ichwIP == ichwLim)
+ {
+ // Logical end is at a left edge: allow I-beam if next segment has one
+ // at the beginning (or there is no next segment).
+ //Assert(fRtlAfter);
+ //if (m_pseg->m_psegNext == NULL)
+ //{
+ // SegmentPainter segpPrev(m_pseg->m_psegPrev);
+ // fIBeam = segpPrev.doBoundariesCoincide(false, true);
+ //}
+ //else
+
+ fIBeam = true;
+ }
+ else if (fabsf(xsAfter - xsRight) <= 1 && ichwIP == ichwLim)
+ {
+ // Logical end is at a right edge: allow I-beam if next segment has one
+ // at the beginning (or there is no next segment).
+ //Assert(!fRtlAfter);
+ //if (m_pseg->m_psegNext == NULL)
+ //{
+ // SegmentPainter segpPrev(m_pseg->m_psegPrev);
+ // fIBeam = segpPrev.doBoundariesCoincide(false, false);
+ //}
+ //else
+
+ fIBeam = true;
+ }
+ else
+ {
+ // If the horizontal positions of the two halves are sufficiently close,
+ // make an I-beam.
+ fIBeam = CloseIPPositions(
+ &xsBefore, ysBeforeTop, ysBeforeBottom,
+ &xsAfter, ysAfterTop, ysAfterBottom);
+ }
+ if (ResultFailed(res))
+ THROW(WARN(res));
+
+ if (fIBeam &&
+ ((ichwIP == m_pseg->m_ichwMin && fAssocPrev) || (ichwIP == ichwLim && !fAssocPrev)))
+ {
+ // Adjacent segment will show the I-beam, so don't show it here.
+ if (m_pseg->m_cginf == 0)
+ {
+ // Empty segment--assume no adjacent segment.
+ }
+ else
+ return;
+ }
+
+ if (fIBeam)
+ { // I-beam caret
+
+ float ysTop = min(ysBeforeTop, ysAfterTop);
+ float ysBottom = max(ysBeforeBottom, ysAfterBottom);
+ float xsMid = (xsBefore == kPosInfFloat) ? xsAfter : xsBefore;
+ InvertIBeam(xsMid, ysTop, ysBottom, fAssocPrev, prdPrimary);
+ }
+ else
+ { // split caret
+ if (fAssocPrev)
+ { // xsAfter is primary, xsBefore is secondary
+ if (xsAfter != kNegInfinity)
+ {
+ InvertSplitIP(xsAfter, ysAfterTop, ysAfterBottom,
+ true, fRtlAfter, false, dysMinSplitHeight, prdPrimary);
+ }
+ if (xsBefore != kPosInfFloat)
+ {
+ InvertSplitIP(xsBefore, ysBeforeTop, ysBeforeBottom,
+ false, !fRtlBefore, true, dysMinSplitHeight, prdSecondary);
+ }
+ }
+ else
+ { // xsBefore is primary, xsAfter is secondary
+ if (xsBefore != kPosInfinity)
+ {
+ InvertSplitIP(xsBefore, ysBeforeTop, ysBeforeBottom,
+ false, !fRtlBefore, false, dysMinSplitHeight, prdPrimary);
+ }
+ if (xsAfter != kNegInfinity)
+ {
+ InvertSplitIP(xsAfter, ysAfterTop, ysAfterBottom,
+ true, fRtlAfter, true, dysMinSplitHeight, prdSecondary);
+ }
+ }
+ //*pfSecHere = true;
+ }
+ //*pfPrimaryHere = true;
+ }
+ else if (fForceSplit && fPrimary) // kdmSplitPrimary == dm)
+ {
+ // Draw just the primary caret.
+ if (fAssocPrev)
+ { // xsAfter is primary
+ if (xsAfter == kNegInfinity)
+ {} // no primary
+ else
+ InvertSplitIP(xsAfter, ysAfterTop, ysAfterBottom,
+ true, fRtlAfter, false, dysMinSplitHeight, prdPrimary);
+ }
+ else
+ { // xsBefore is primary
+ if (xsBefore == kPosInfinity)
+ {} // no primary
+ else
+ InvertSplitIP(xsBefore, ysBeforeTop, ysBeforeBottom,
+ false, !fRtlBefore, false, dysMinSplitHeight, prdPrimary);
+ }
+ }
+ else // fForceSplit && !fPrimary
+ {
+ // Draw just the secondary caret.
+ //Assert(kdmSplitSecondary == dm);
+ if (fAssocPrev)
+ { // xsBefore is secondary
+ if (xsBefore == kPosInfinity)
+ {} // no secondary
+ else
+ InvertSplitIP(xsBefore, ysBeforeTop, ysBeforeBottom,
+ false, !fRtlBefore, true, dysMinSplitHeight, prdSecondary);
+ }
+ else
+ { // xsAfter is secondary
+ if (xsAfter == kNegInfinity)
+ {} // no secondary
+ else
+ InvertSplitIP(xsAfter, ysAfterTop, ysAfterBottom,
+ true, fRtlAfter, true, dysMinSplitHeight, prdSecondary);
+ }
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Draw an I-beam cursor, or return the location at which it would be drawn.
+
+ Note that currently we do not draw a true I-beam, but rather just a vertical line.
+
+ @param xs - horizontal center of IP
+ @param ysTop - top of glyph (or ligature component) box
+ @param ysBottom - bottom of glyph (or ligature component) box
+ @param fAssocRight - true if the IP is associated with the text to the right
+ @param rs, rd - source/destination device coordinates
+ @param prdRet - return location to be drawn in dest device coords;
+ if NULL, do the drawing
+----------------------------------------------------------------------------------------------*/
+void SegmentPainter::InvertIBeam(float xs, float ysTop, float ysBottom,
+ bool fAssocPrev, Rect * prdRet)
+{
+ float xd = ScaleXToDest(xs);
+ float ydTop = ScaleYToDest(ysTop);
+ float ydBottom = ScaleYToDest(ysBottom);
+
+ // For now, assume that destination coordinates are in terms of pixels.
+ float dxdTwoXPixels = 2;
+
+ float dxdLeftAdjust = dxdTwoXPixels / 2;
+ float dxdRightAdjust = dxdTwoXPixels - dxdLeftAdjust;
+
+// int dysFontAscent;
+// pgg->GetFontAscentSourceUnits(pgg, &dysFontAscent);
+// dysFontAscent += m_dysXAscent;
+// if (dysFontAscent < 20)
+// {
+// dxdRightAdjust--;
+// dxdRightHook = 1;
+// }
+
+ if (prdRet)
+ {
+ prdRet->left = xd - dxdLeftAdjust;
+ prdRet->right = xd + dxdRightAdjust;
+ prdRet->top = ydTop;
+ prdRet->bottom = ydBottom;
+ }
+ else
+ {
+ InvertRect(xd-dxdLeftAdjust, ydTop,
+ xd+dxdRightAdjust, ydBottom);
+
+ // To make a true I-beam:
+// InvertRect(xd-dxdTwoXPixels, ydTop-dydOneYPixel,
+// xd+dxdRightHook, ydTop);
+// InvertRect(xd-dxdTwoXPixels, ydBottom,
+// xd+dxdRightHook, ydBottom+dydOneYPixel);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Draw a split insertion point, or return the location at which it would be drawn.
+
+ @param xs - horizontal center of IP
+ @param ysTop - top of glyph (or ligature component) box
+ @param ysBottom - bottom of glyph (or ligature component) box
+ @param fTop - true if the IP is to be drawn at the top of the line of text
+ @param fAssocRight - true if the IP is associated with the text to the right
+ @param fSecondary - true if the IP is secondary, false if it is primary
+ @param dysMinSplitHeight
+ - minimum split cursor height
+ @param rs, rd - source/destination device coordinates
+ @param prdRet - return location to be drawn in dest device coords;
+ if NULL, do the drawing
+----------------------------------------------------------------------------------------------*/
+void SegmentPainter::InvertSplitIP(float xs, float ysTop, float ysBottom,
+ bool fTop, bool fAssocRight, bool fSecondary, float dysMinSplitHeight,
+ Rect * prdRet)
+{
+ if (prdRet == NULL && ysTop == ysBottom)
+ return; // invisible IP
+
+ float xd = ScaleXToDest(xs);
+ float ydTop = ScaleYToDest(ysTop);
+ float ydBottom = ScaleYToDest(ysBottom);
+ float dydMinSplitHeight = dysMinSplitHeight;
+
+ float ydMid = (ydTop + ydBottom) / 2;
+
+ // For now, assume that destination coordinates are in terms of pixels.
+ float dxdOneXPixel = 1;
+ float dydOneYPixel = 1;
+ float dxdTwoXPixels = 2;
+
+ float xdLeft, xdRight, dxdHookLen;
+ if (fSecondary)
+ {
+ xdLeft = xd - (dxdOneXPixel / 2);
+ xdRight = xdLeft + 1;
+ dxdHookLen = 2;
+ }
+ else
+ {
+ xdLeft = xd - (dxdTwoXPixels / 2);
+ xdRight = xdLeft + 2;
+ dxdHookLen = 3;
+ }
+
+ float yd1, yd2;
+ if (fTop)
+ {
+ yd1 = ydTop;
+ if (ydMid - ydTop < dydMinSplitHeight)
+ ydMid = ydTop + dydMinSplitHeight;
+ yd2 = (fSecondary) ? ydMid : ydMid + 3;
+ }
+ else
+ {
+ yd2 = ydBottom;
+ if (ydBottom - ydMid < dydMinSplitHeight)
+ ydMid = ydBottom - dydMinSplitHeight;
+ yd1 = (fSecondary) ? ydMid : ydMid - 3;
+ }
+
+ if (prdRet)
+ {
+ prdRet->left = xdLeft;
+ prdRet->right = xdRight;
+ // The most common reason for returning the positions of the IP is to scroll it into
+ // view, in which case we want to return the entire line height, not just the
+ // height of the IP itself.
+ prdRet->top = ydTop; // yd1;
+ prdRet->bottom = ydBottom; // yd2;
+ }
+ else
+ {
+ InvertRect(xdLeft, yd1, xdRight, yd2);
+ }
+
+ if (fAssocRight)
+ {
+ if (prdRet)
+ prdRet->right = xdRight + dxdHookLen;
+ else
+ {
+ if (fTop)
+ InvertRect(xdRight, ydTop,
+ xdRight + dxdHookLen, ydTop + dydOneYPixel);
+ else
+ InvertRect(xdRight, ydBottom-dydOneYPixel,
+ xdRight + dxdHookLen, ydBottom);
+ }
+ }
+ else
+ {
+ if (prdRet)
+ prdRet->left = xdLeft - dxdHookLen;
+ else
+ {
+ if (fTop)
+ InvertRect(xdLeft - dxdHookLen, ydTop,
+ xdLeft, ydTop + dydOneYPixel);
+ else
+ InvertRect(xdLeft - dxdHookLen, ydBottom - dydOneYPixel,
+ xdLeft, ydBottom);
+ }
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Given a character position (relative to the beginning of the string), return the
+ position for the insertion point, relative to the top-left of the segment.
+ Notice that these are before/after positions, not left/right positions.
+ Return an infinity value to indicate no appropriate IP.
+
+ @param ichwSel - selection position, relative to beginning of string
+ @param fBefore - true if we are interested in the character the IP is before.
+ @param pxs, pysTop, pysBottom
+ - return locations for drawing the IP (top and bottom are not
+ adjusted for half-selections)
+ @param pfRtl - return true if the character is right-to-left
+
+ Review: it might be useful to figure out if the two surface glyphs are physically adjacent
+ in such a way that their IPs can be combined into one I-beam. For now we use a simple
+ rule that assumes that any glyph or ligature component is at least 10% as wide as the
+ height of the font (see CloseIPPositions).
+----------------------------------------------------------------------------------------------*/
+void SegmentPainter::CalcIP(int ichwSel, bool fBefore,
+ float * pxs, float * pysTop, float * pysBottom, bool * pfRtl)
+{
+ Font & font = this->m_pseg->getFont();
+
+ int ichw = (fBefore) ? ichwSel : ichwSel - 1;
+
+ int iginfOutput;
+
+ *pfRtl = m_pseg->CharIsRightToLeft(ichw, fBefore);
+
+ GrEngine * pgreng = m_pseg->EngineImpl();
+ GrGlyphTable * pgtbl = (pgreng) ? pgreng->GlyphTable() : NULL;
+
+ float dysFontAscent = m_pseg->m_dysFontAscent;
+ ////GrResult res = GetFontAscentSourceUnits(pgg, &dysFontAscent);
+ ////if (ResultFailed(res))
+ //// THROW(WARN(res));
+ dysFontAscent += m_pseg->m_dysXAscent;
+
+ *pysTop = 0;
+ *pysBottom = m_pseg->m_dysHeight;
+
+ int ichwSegOffset = ichw - m_pseg->m_ichwMin;
+ int isloutLig;
+ if (ichwSegOffset < m_pseg->m_ichwAssocsMin || ichwSegOffset >= m_pseg->m_ichwAssocsLim)
+ isloutLig = kNegInfinity;
+ else
+ isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - m_pseg->m_ichwAssocsMin];
+ bool fOkLig = (isloutLig != kNegInfinity);
+ if (pgtbl && fOkLig)
+ {
+ // Ligature component; place the IP at the boundary
+ // of the component box.
+
+ GrSlotOutput * pslout = m_pseg->OutputSlot(isloutLig);
+ int icomp = m_pseg->m_prgiComponent[ichwSegOffset - m_pseg->m_ichwAssocsMin];
+
+ iginfOutput = m_pseg->LogicalToPhysicalSurface(isloutLig);
+
+ float xsGlyphOffset = m_pseg->GlyphLeftEdge(iginfOutput);
+
+ float xsLeft, xsRight, ysTop, ysBottom;
+
+ // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph.
+ int slati = pslout->ComponentId(icomp);
+ int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati);
+ fOkLig = pgtbl->ComponentBoxLogUnits(m_pseg->m_xysEmSquare, pslout->GlyphID(), iForGlyph,
+ m_pseg->m_mFontEmUnits, m_pseg->m_dysAscent,
+ &xsLeft, &ysTop, &xsRight, &ysBottom);
+ if (fOkLig)
+ {
+ if (fBefore == *pfRtl)
+ // Position of interest is to the right.
+ *pxs = xsGlyphOffset + xsRight;
+ else
+ // Position of interest is to the left.
+ *pxs = xsGlyphOffset + xsLeft;
+
+ GlyphInfo * pginf = m_pseg->m_prgginf + iginfOutput;
+ float ysGlyph = pginf->yOffset();
+
+ *pysTop = ysTop + (m_pseg->m_dysAscent - dysFontAscent) - ysGlyph;
+ *pysBottom = ysBottom + (m_pseg->m_dysAscent - dysFontAscent) - ysGlyph;
+ }
+ }
+
+ if (!fOkLig)
+ {
+ // Not a ligature component.
+
+ int islout = m_pseg->UnderlyingToLogicalSurface(ichw, fBefore);
+ GrSlotOutput * psloutTmp = m_pseg->OutputSlot(islout);
+ iginfOutput = m_pseg->LogicalToPhysicalSurface(islout);
+
+ if (kPosInfinity == iginfOutput || kNegInfinity == iginfOutput)
+ *pxs = kPosInfFloat;
+
+ else
+ {
+ bool fCluster = (psloutTmp->IsPartOfCluster());
+ bool fHighlightBB = fCluster;
+ // Test below should match the one in CalcHighlightRect:
+ if ((psloutTmp->ClusterAdvance() == 0
+ || psloutTmp->GlyphMetricLogUnits(&font, kgmetAdvWidth) == 0)
+ && !psloutTmp->IsSpace())
+ {
+ fHighlightBB = true; // use bounding box for zero-advance glyph
+ }
+ if (fHighlightBB)
+ {
+ // Cluster member or zero-width glyph.
+
+ if (fCluster && AtEdgeOfCluster(psloutTmp, islout, fBefore) &&
+ !CanInsertIntoCluster(psloutTmp, islout))
+ {
+ // Place the IP at the edge of the whole cluster.
+
+ int isloutBase = psloutTmp->ClusterBase();
+ GrSlotOutput * psloutBase = m_pseg->OutputSlot(isloutBase);
+ //int igbbBase = psloutBase->GlyphBbIndex();
+ int iginfBase = m_pseg->LogicalToPhysicalSurface(isloutBase);
+
+ float xsBase = m_pseg->GlyphLeftEdge(iginfBase);
+
+ float xsLeft = xsBase + psloutBase->ClusterXOffset();
+ float xsRight = xsBase + psloutBase->ClusterAdvance();
+
+ if (fBefore == *pfRtl)
+ // Position of interest is to the right
+ *pxs = xsRight;
+ else
+ // Position of interest is to the left.
+ *pxs = xsLeft;
+ }
+ else
+ {
+ // Place the IP on the perimeter of the bounding box of the cluster member.
+
+ float xsGlyphStart = m_pseg->GlyphLeftEdge(iginfOutput);
+
+// float dysFontAscent;
+// res = GetFontAscentSourceUnits(pgg, &dysFontAscent);
+// if (ResultFailed(res)) THROW(WARN(res));
+// dysFontAscent += m_dysXAscent;
+
+ float ysBbTop = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbTop);
+ float ysBbBottom = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbBottom);
+ float xsBbLeft = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbLeft);
+ float xsBbRight = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbRight);
+
+ int twoPixels = 2; // assume dest coords are in pixels
+
+ if (fBefore == *pfRtl)
+ // Position of interest is to the right
+ *pxs = xsGlyphStart + xsBbRight + twoPixels;
+ else
+ // Position of interest is to the left.
+ *pxs = xsGlyphStart + xsBbLeft - twoPixels;
+
+ GlyphInfo * pginf = m_pseg->m_prgginf + iginfOutput;
+ float ysGlyph = pginf->yOffset();
+ float ysGlyphBaseline = m_pseg->m_dysAscent - ysGlyph; // relative to top
+
+ *pysTop = ysGlyphBaseline - ysBbTop - twoPixels;
+ *pysBottom = ysGlyphBaseline - ysBbBottom + twoPixels;
+ }
+ }
+ else
+ {
+ // Insertion point goes at origin or advance width of glyph.
+
+ *pxs = m_pseg->GlyphLeftEdge(iginfOutput);
+ if (fBefore == *pfRtl)
+ {
+ // Position of interest is to the right
+ //*pxs += psloutTmp->GlyphMetricLogUnits(&font, kgmetAdvWidth);
+ *pxs += psloutTmp->ClusterAdvance();
+ }
+ // else position of interest is to the left
+ }
+ }
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ If the two positions for the insertion point are close enough, merge them into
+ one insertion point, and return true to indicate that we want an I-beam.
+
+ @param pxsBefore, pxsAfter - for comparing, and also adjusted results
+ @param ysBeforeTop/Bottom, ysAfterTop/Bottom - for comparing
+----------------------------------------------------------------------------------------------*/
+bool SegmentPainter::CloseIPPositions(float * pxsBefore, float ysBeforeTop, float ysBeforeBottom,
+ float * pxsAfter, float ysAfterTop, float ysAfterBottom)
+{
+ // No adjustment if vertical positions are disjoint.
+ if (ysBeforeBottom <= ysAfterTop)
+ return false;
+ if (ysAfterBottom <= ysBeforeTop)
+ return false;
+
+ float dysHt = max(ysBeforeBottom, ysAfterBottom) - min(ysBeforeTop, ysAfterTop);
+ float dxsDiff = fabsf(*pxsBefore - *pxsAfter);
+
+ // If the difference in the x positions is less than 10% of the height,
+ // we want an I-beam--use the average.
+ if (dxsDiff * 10 < dysHt)
+ {
+ *pxsBefore = (*pxsBefore + *pxsAfter) / 2;
+ *pxsAfter = *pxsBefore;
+ return true;
+ }
+
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if the slot in question is the first or last slot of its cluster,
+ or if it is not part of a cluster at all. Return false if the specified side
+ of the slot is interior to a cluster.
+
+ @param fBefore - if true, we are examining the slot the insertion point is before,
+ so we are interested in whether this slot is at the
+ leading edge of the cluster.
+----------------------------------------------------------------------------------------------*/
+bool SegmentPainter::AtEdgeOfCluster(GrSlotOutput * pslout, int islout, bool fBefore)
+{
+ if (!pslout->IsPartOfCluster())
+ return true;
+
+ if (fBefore && (islout == 0))
+ return true;
+ if (!fBefore && (m_pseg->m_cslout == islout + 1))
+ return true;
+
+ // If the adjacent slot in whatever direction we're interested in has the same
+ // cluster base, this slot is not on the edge of the cluster.
+ // -- NO, because you could have an intervening glyph that is not part of the
+ // cluster.
+ //int isloutAdjacentBase = (fBefore) ?
+ // m_pseg->OutputSlot(islout - 1)->ClusterBase() :
+ // m_pseg->OutputSlot(islout + 1)->ClusterBase();
+ //return (isloutAdjacentBase != m_pseg->OutputSlot(islout)->ClusterBase());
+
+ // Ask the cluster base.
+ return AtEdgeOfCluster(m_pseg->OutputSlot(pslout->ClusterBase()), pslout->ClusterBase(),
+ pslout, islout, fBefore);
+}
+
+bool SegmentPainter::AtEdgeOfCluster(GrSlotOutput * psloutBase, int isloutBase,
+ GrSlotOutput * pslout, int islout, bool fBefore)
+{
+ // Compare pslout to all the members of the cluster. If it is the minimum or maximum, it
+ // is at an edge.
+ if (fBefore && isloutBase < islout)
+ return false;
+ if (!fBefore && isloutBase > islout)
+ return false;
+
+ std::vector<int> visloutCluster;
+ m_pseg->ClusterMembersForGlyph(isloutBase, psloutBase->ClusterRange(), visloutCluster);
+
+ for (size_t iislout = 0; iislout < visloutCluster.size(); iislout++)
+ {
+ int isloutMember = visloutCluster[iislout];
+ if (fBefore && isloutMember < islout)
+ return false;
+ if (!fBefore && isloutMember > islout)
+ return false;
+ }
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if it is permitted to put an insertion point somewhere in the middle of
+ the given slot's cluster.
+----------------------------------------------------------------------------------------------*/
+bool SegmentPainter::CanInsertIntoCluster(GrSlotOutput * pslout, int islout)
+{
+ if (!pslout->IsPartOfCluster())
+ return false;
+
+ int isloutBase = pslout->ClusterBase();
+ if (islout != isloutBase)
+ {
+ // Ask the cluster base.
+ Assert(pslout->ClusterRange() == 0);
+ return CanInsertIntoCluster(m_pseg->OutputSlot(isloutBase), isloutBase);
+ }
+
+ if (!AtEdgeOfCluster(pslout, islout, true) && pslout->InsertBefore())
+ return true;
+
+ std::vector<int> visloutCluster;
+ m_pseg->ClusterMembersForGlyph(isloutBase, pslout->ClusterRange(), visloutCluster);
+
+ for (size_t iislout = 0; iislout < visloutCluster.size(); iislout++)
+ {
+ int isloutMember = visloutCluster[iislout];
+ if (AtEdgeOfCluster(m_pseg->OutputSlot(isloutMember), isloutMember, true))
+ // Inserting before the first member of the cluster doesn't count.
+ continue;
+
+ if (m_pseg->OutputSlot(isloutMember)->InsertBefore())
+ return true;
+ }
+
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Determine which characters in the selected range are part of ligatures that are fully
+ selected vs. those that are only partially selected. Those that are only partially selected
+ must have their components highlighted individually, but those that are fully selected
+ should be highlighted fully, to avoid blank spots in the case that the components do not
+ fully cover the surface of the glyph.
+
+ @param prgfAllSelected - array of flags to fill in with results
+ @param ichwMin/LimSeg - range of characters to examine
+ @param ichwMin/LimSel - range of characters that are selected
+----------------------------------------------------------------------------------------------*/
+void SegmentPainter::CalcPartialLigatures(bool * prgfAllSelected,
+ int ichwMinSeg, int ichwLimSeg,
+ int ichwMinSel, int ichwLimSel)
+{
+ GrEngine * pgreng = m_pseg->EngineImpl();
+ GrGlyphTable * pgtbl = (pgreng) ? pgreng->GlyphTable() : NULL;
+
+ for (int ichw = ichwMinSeg; ichw < ichwLimSeg; ichw++)
+ {
+ int ichwSegOffset = ichw - m_pseg->m_ichwMin;
+ int isloutLig;
+ if (ichwSegOffset < m_pseg->m_ichwAssocsMin || ichwSegOffset >= m_pseg->m_ichwAssocsLim)
+ isloutLig = kNegInfinity;
+ else
+ isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - m_pseg->m_ichwAssocsMin];
+ bool fLigComp = (pgtbl && isloutLig != kNegInfinity);
+ if (fLigComp && !prgfAllSelected[ichwSegOffset])
+ {
+ GrSlotOutput * pslout = m_pseg->OutputSlot(isloutLig);
+ bool fAll = true;
+ int icomp;
+ for (icomp = 0; icomp < pslout->NumberOfComponents(); icomp++)
+ {
+ int ichwUnderlying = pslout->UnderlyingComponent(icomp);
+ if (ichwUnderlying < ichwMinSel - m_pseg->m_ichwMin ||
+ ichwUnderlying >= ichwLimSel - m_pseg->m_ichwMin)
+ {
+ fAll = false; // found a component that is not selected
+ }
+ }
+ for (icomp = 0; icomp < pslout->NumberOfComponents(); icomp++)
+ {
+ int ichwUnderlying = pslout->UnderlyingComponent(icomp);
+ prgfAllSelected[ichwUnderlying] = fAll;
+ }
+ }
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ The given character is part of the selected range. Add to the vector a rectangle (or
+ eventually, several) indicating the corresponding screen area(s) of the character.
+ The rectangle is relative to the top left of the segment.
+
+ @param ichw - selected char, relative to beginning of string
+ @param vrs - list of rectangles to highlight, in source coords, relative to
+ segment draw position (top-left)
+ @param vfEntireHt - for each of the above rectangles, true if the rect should be
+ extended to include the entire line
+ @param fJustComponent - true if we want to highlight just the single ligature component
+ this character maps to; false if the entire ligature is selected
+ @param rgfHighlighted - for each glyph in this segment, whether it is being highlighted
+ by this operation
+ @param fSkipTrSpace - should we skip trailing white space?
+----------------------------------------------------------------------------------------------*/
+void SegmentPainter::CalcHighlightRect(int ichw,
+ std::vector<Rect> & vrs, std::vector<bool> & vfEntireHt,
+ bool fJustComponent, bool * rgfHighlighted, bool fSkipTrSpace)
+{
+ GrResult res;
+
+ GrEngine * pgreng = m_pseg->EngineImpl();
+ GrGlyphTable * pgtbl = (pgreng) ? pgreng->GlyphTable() : NULL;
+ //bool fRtl = m_pseg->rightToLeft();
+
+ Font & font = m_pseg->getFont();
+
+ if (!GrCharStream::AtUnicodeCharBoundary(m_pseg->GetString(), ichw))
+ // Second half of a surrogate pair, or UTF-8: ignore.
+ return;
+
+ // Calculate the location for the glyph that this IP is before.
+
+ int ichwSegOffset = ichw - m_pseg->m_ichwMin;
+ int isloutLig;
+ if (ichwSegOffset < m_pseg->m_ichwAssocsMin || ichwSegOffset >= m_pseg->m_ichwAssocsLim)
+ isloutLig = kNegInfinity;
+ else
+ isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - m_pseg->m_ichwAssocsMin];
+ bool fLigComp = (pgtbl && isloutLig != kNegInfinity);
+ if (fLigComp && fJustComponent)
+ {
+ // Character is a ligature component.
+
+ GrSlotOutput * pslout = m_pseg->OutputSlot(isloutLig);
+ int icomp = m_pseg->m_prgiComponent[ichwSegOffset - m_pseg->m_ichwAssocsMin];
+ int iginfOutput = m_pseg->LogicalToPhysicalSurface(isloutLig);
+
+ float xsGlyphStart = m_pseg->GlyphLeftEdge(iginfOutput);
+
+ float xsLeft, xsRight, ysTop, ysBottom;
+
+ // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph.
+ int slati = pslout->ComponentId(icomp);
+ int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati);
+ pgtbl->ComponentBoxLogUnits(m_pseg->m_xysEmSquare, pslout->GlyphID(), iForGlyph,
+ m_pseg->m_mFontEmUnits, m_pseg->m_dysAscent,
+ &xsLeft, &ysTop, &xsRight, &ysBottom);
+
+ float dysFontAscent = m_pseg->m_dysFontAscent;
+ ////GetFontAscentSourceUnits(pgg, &dysFontAscent);
+ dysFontAscent += m_pseg->m_dysXAscent;
+ GlyphInfo * pginf = m_pseg->m_prgginf + iginfOutput;
+ float ysForGlyph = pginf->yOffset();
+ float dysGlyphTop = (m_pseg->m_dysAscent - dysFontAscent) - ysForGlyph; // rel. to common baseline
+
+ Rect rsNew;
+ rsNew.top = ysTop + dysGlyphTop;
+ rsNew.bottom = ysBottom + dysGlyphTop;
+ rsNew.left = xsGlyphStart + xsLeft;
+ rsNew.right = xsGlyphStart + xsRight;
+ vrs.push_back(rsNew);
+
+ vfEntireHt.push_back(false);
+ }
+ else
+ {
+ std::vector<int> vislout = m_pseg->UnderlyingToLogicalAssocs(ichw);
+ if (vislout.size() == 0)
+ return;
+
+ float xsGlyphLeft, xsGlyphRight;
+
+ res = kresOk;
+
+ for (size_t iislout = 0; iislout < vislout.size(); iislout++)
+ {
+ int islout = vislout[iislout];
+ if (islout == kNegInfinity || islout == kPosInfinity)
+ continue;
+ int iginfTmp = m_pseg->LogicalToPhysicalSurface(islout);
+ Assert(iginfTmp != kNegInfinity);
+ Assert(iginfTmp != kPosInfinity);
+
+ if (fSkipTrSpace && islout >= m_pseg->m_isloutVisLim)
+ continue;
+
+ Rect rsNew;
+ GrSlotOutput * psloutTmp = m_pseg->OutputSlot(islout);
+ bool fHighlightBB = psloutTmp->IsPartOfCluster();
+ // Test below should match the one in CalcIP--
+ // If the glyph has no advance width but does have a real bounding box,
+ // highlight the bounding box. Review: do we want this???
+ if ((psloutTmp->ClusterAdvance() == 0
+ || psloutTmp->GlyphMetricLogUnits(&font, kgmetAdvWidth) == 0)
+ && !psloutTmp->IsSpace())
+ {
+ fHighlightBB = true;
+ }
+ xsGlyphLeft = m_pseg->GlyphLeftEdge(iginfTmp);
+ if (fHighlightBB)
+ {
+ // For now, highlight just the bounding box of this glyph. After we finish
+ // highlighting all glyphs individually, we'll go back and highlight
+ // as one unit any clusters that are completely selected.
+
+// int dysFontAscent;
+// res = GetFontAscentSourceUnits(pgg, &dysFontAscent); // if we restore this code, add in ExtraAscent
+// if (ResultFailed(res)) THROW(WARN(res));
+// dysFontAscent += m_dysXAscent;
+
+ GlyphInfo * pginf = m_pseg->m_prgginf + iginfTmp;
+ float ysForGlyph = pginf->yOffset();
+ float ysGlyphBaseline = m_pseg->m_dysAscent - ysForGlyph; // relative to top
+
+ float ysBbTop = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbTop);
+ float ysBbBottom = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbBottom);
+ float xsBbLeft = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbLeft);
+ float xsBbRight = psloutTmp->GlyphMetricLogUnits(&font, kgmetBbRight);
+
+ rsNew.top = ysGlyphBaseline - ysBbTop - 2;
+ rsNew.bottom = ysGlyphBaseline - ysBbBottom + 2;
+ rsNew.left = xsGlyphLeft + xsBbLeft - 2;
+ rsNew.right = xsGlyphLeft + xsBbRight + 2;
+
+ vfEntireHt.push_back(false);
+ }
+ else
+ {
+ // Highlight entire width of the glyph from the top of the line to the bottom.
+ // Horizontally, highlight from the origin of the glyph to the advance width.
+
+ //xsGlyphRight = xsGlyphLeft + psloutTmp->GlyphMetricLogUnits(&font kgmetAdvWidth);
+ xsGlyphRight = xsGlyphLeft + psloutTmp->ClusterAdvance();
+
+ if (xsGlyphLeft > xsGlyphRight)
+ std::swap(xsGlyphLeft, xsGlyphRight);
+
+ rsNew.top = 0;
+ rsNew.bottom = m_pseg->m_dysHeight;
+ rsNew.left = xsGlyphLeft;
+ rsNew.right = xsGlyphRight;
+
+ vfEntireHt.push_back(true);
+ }
+ vrs.push_back(rsNew);
+
+ if (rgfHighlighted)
+ rgfHighlighted[iginfTmp] = true;
+ }
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ If the output slot is a cluster base and all the members of the cluster are highlighted,
+ simply highlight the cluster as a single rectangle, to avoid unslightly gaps
+ between glyphs. (Note that this does not remove the rectangles that were already included
+ to handle the individual members.)
+ The rectangles are relative to the top left of the segment.
+
+ @param islout - output slot index
+ @param vrect - list of rectangles to highlight; add result here
+ @param prgfHighlighted - flags indicating which glyphs have been highlighted, indexed by
+ physical surface position
+----------------------------------------------------------------------------------------------*/
+void SegmentPainter::CalcCompleteCluster(int islout,
+ std::vector<Rect> & vrs, std::vector<bool> & vfEntireHt, bool * prgfHighlighted)
+{
+ //GrEngine * pgreng = m_pseg->EngineImpl();
+
+ GrSlotOutput * pslout = m_pseg->OutputSlot(islout);
+ if (pslout->ClusterRange() == 0)
+ return;
+
+ int iginfDraw = m_pseg->LogicalToPhysicalSurface(islout);
+ if (!prgfHighlighted[iginfDraw])
+ return;
+
+ bool fAllHighlighted = true;
+
+ std::vector<int> visloutCluster;
+ m_pseg->ClusterMembersForGlyph(islout, pslout->ClusterRange(), visloutCluster);
+ for (size_t i = 0; i < visloutCluster.size(); i++)
+ {
+ int iginfMemberDraw = m_pseg->LogicalToPhysicalSurface(visloutCluster[i]);
+ if (!prgfHighlighted[iginfMemberDraw])
+ {
+ fAllHighlighted = false;
+ break;
+ }
+ }
+
+ if (!fAllHighlighted)
+ return;
+
+ // All the members of this cluster are highlighted.
+
+ float xsGlyphStart = m_pseg->GlyphLeftEdge(iginfDraw);
+
+ Rect rsNew;
+ rsNew.top = 0;
+ rsNew.bottom = m_pseg->m_dysHeight;
+ rsNew.left = xsGlyphStart + pslout->ClusterXOffset();
+ rsNew.right = xsGlyphStart + pslout->ClusterAdvance();
+ vrs.push_back(rsNew);
+
+ vfEntireHt.push_back(true);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Add the given rectangle to the vector, eliminating any overlapping areas.
+
+ Note this method can be recursive: if we have to break the current rectangle into
+ two, we'll call the method again the for new
+----------------------------------------------------------------------------------------------*/
+void SegmentPainter::AddRectWithoutOverlaps(std::vector<Rect> & vrect, Rect rectToAdd)
+{
+ std::vector<Rect> vrectMoreToAdd;
+
+ bool fAnythingToAdd = AnyArea(&rectToAdd);
+
+ size_t irect;
+ for (irect = 0; irect < vrect.size(); irect++)
+ {
+ bool f = AdjustRectsToNotOverlap(vrect, irect, &rectToAdd, vrectMoreToAdd);
+ if (!AnyArea(&vrect[irect]))
+ {
+ vrect.erase(vrect.begin() + irect);
+ irect--;
+ }
+ if (!f)
+ {
+ fAnythingToAdd = false;
+ break;
+ }
+ }
+
+ // Now rectToAdd is in a state that it does not intersect with any other rectangles
+ // in the list.
+
+ if (fAnythingToAdd)
+ vrect.push_back(rectToAdd);
+
+ // Add in any extra rectangles that are needed to handle overlaps.
+
+ for (irect = 0; irect < vrectMoreToAdd.size(); irect++)
+ AddRectWithoutOverlaps(vrect, vrectMoreToAdd[irect]);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if the rectangle has an area greater than 0.
+----------------------------------------------------------------------------------------------*/
+bool SegmentPainter::AnyArea(Rect * prect)
+{
+ Assert(prect->left <= prect->right);
+ Assert(prect->top <= prect->bottom);
+
+ return (prect->left < prect->right && prect->top < prect->bottom);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Adjust the rectangle prect2 to avoid overlaps with the given one in the vector.
+ Return false if the rectangle does not need to be added after all.
+
+ If we have to split this rectangle into two, add the second one to vrectMoreToAdd, so
+ we can do the same process on it.
+
+ If we can merge the two rectangles, add the result to vrectMoreToAdd (so it can be properly
+ checked for further overlaps), and adjust the rectangle in the vector so it will be
+ deleted.
+
+ @param vrect - current list of valid rectangles
+ @param irect - item in vrect we're comparing with prect2
+ @param prect2 - rectangle to add
+ @param vrectMoreToAdd - list of accumulated rectangles that need to be added
+ (caused by splitting one into two)
+
+ @return True if we want to add prect2 (possibly adjusted) to the list;
+ false it it is completely subsumed by vrect[irect], or has been merged with it,
+ or has no area.
+----------------------------------------------------------------------------------------------*/
+bool SegmentPainter::AdjustRectsToNotOverlap(std::vector<Rect> & vrect, int irect, Rect * prect2,
+ std::vector<Rect> & vrectMoreToAdd)
+{
+ Rect * prect1 = &(vrect[irect]);
+
+ float xLeft1 = prect1->left;
+ float xRight1 = prect1->right;
+ float yTop1 = prect1->top;
+ float yBottom1 = prect1->bottom;
+ Assert(xLeft1 < xRight1);
+ Assert(yTop1 < yBottom1);
+
+ float xLeft2 = prect2->left;
+ float xRight2 = prect2->right;
+ float yTop2 = prect2->top;
+ float yBottom2 = prect2->bottom;
+ Assert(xLeft2 <= xRight2);
+ Assert(yTop2 <= yBottom2);
+
+ if (!AnyArea(prect2))
+ return false;
+
+ // No overlap: keep both as they are.
+ if (yBottom2 < yTop1 || yBottom1 < yTop2)
+ return true;
+ if (xRight2 < xLeft1 || xRight1 < xLeft2)
+ return true;
+
+ // Present rect subsumes new: ignore new
+ if (xLeft1 <= xLeft2 && xRight2 <= xRight1 && yTop1 <= yTop2 && yBottom2 <= yBottom1)
+ return false;
+
+ // New rect subsumes present: replace.
+ if (xLeft2 <= xLeft1 && xRight1 <= xRight2 && yTop2 <= yTop1 && yBottom1 <= yBottom2)
+ {
+ prect1->bottom = prect1->top; // delete
+ return true; // keep this one
+ }
+
+ // Abutting rectangles of same height or width: merge.
+ if (yTop1 == yTop2 && yBottom1 == yBottom2)
+ {
+ if (xRight1 == xLeft2)
+ {
+ // prect2 is to the right
+ prect2->left = prect1->left;
+ vrectMoreToAdd.push_back(*prect2);
+ prect1->bottom = prect1->top; // delete previous
+ return false;
+ }
+ else if (xRight2 == xLeft1)
+ {
+ // prect2 is to the left
+ prect2->right = prect1->right;
+ vrectMoreToAdd.push_back(*prect2);
+ prect1->bottom = prect1->top; // delete
+ return false;
+ }
+ }
+ if (xLeft1 == xLeft2 && xRight1 == xRight2)
+ {
+ if (yBottom1 == yTop2)
+ {
+ // prect2 is below
+ prect2->top = prect1->top;
+ vrectMoreToAdd.push_back(*prect2);
+ prect1->bottom = prect1->top; // delete
+ return false;
+ }
+ else if (yBottom2 == yTop1)
+ {
+ // prect2 is above
+ prect2->bottom = prect1->bottom;
+ vrectMoreToAdd.push_back(*prect2);
+ prect1->bottom = prect1->top; // delete
+ return false;
+ }
+ }
+
+ // Abutting rectangles of different heights or widths: leave as they are.
+ if (xRight1 == xLeft2 || xRight2 == xLeft1)
+ return true;
+ if (yBottom1 == yTop2 || yBottom2 == yTop1)
+ return true;
+
+ // Overlapping on one axis: adjust smaller rectangle
+ if (yTop1 <= yTop2 && yBottom2 <= yBottom1)
+ {
+ if (xLeft1 <= xLeft2 && xLeft2 < xRight1)
+ {
+ Assert(xRight1 < xRight2); // otherwise rect2 is subsumed
+ prect2->left = prect1->right;
+ return true;
+ }
+ else if (xLeft1 < xRight2 && xRight2 <= xRight1)
+ {
+ Assert(xLeft2 < xLeft1); // otherwise rect2 is subsumed
+ prect2->right = prect1->left;
+ return true;
+ }
+ }
+ else if (yTop2 <= yTop1 && yBottom1 <= yBottom2)
+ {
+ if (xLeft2 <= xLeft1 && xLeft1 < xRight2)
+ {
+ Assert(xRight2 < xRight1); // otherwise rect1 is subsumed
+ prect1->left = prect2->right;
+ return true;
+ }
+ else if (xLeft2 < xRight1 && xRight1 <= xRight2)
+ {
+ Assert(xLeft1 < xLeft2); // otherwise rect1 is subsumed
+ prect1->right = prect2->left;
+ return true;
+ }
+ }
+
+ if (xLeft1 <= xLeft2 && xRight2 <= xRight1)
+ {
+ if (yTop1 <= yTop2 && yTop2 < yBottom1)
+ {
+ Assert(yBottom1 < yBottom2); // otherwise rect2 is subsumed
+ prect2->top = prect1->bottom;
+ return true;
+ }
+ else if (yTop1 < yBottom2 && yBottom2 <= yBottom1)
+ {
+ Assert(yTop2 < yTop1); // otherwise rect2 is subsumed
+ prect2->bottom = prect1->top;
+ return true;
+ }
+ }
+ else if (xLeft2 <= xLeft1 && xRight1 <= xRight2)
+ {
+ if (yTop2 <= yTop1 && yTop1 < yBottom2)
+ {
+ Assert(yBottom2 < yBottom1); // otherwise rect1 is subsumed
+ prect1->top = prect2->bottom;
+ return true;
+ }
+ else if (yTop2 < yBottom1 && yBottom1 <= yBottom2)
+ {
+ Assert(yTop1 < yTop2); // otherwise rect1 is subsumed
+ prect1->bottom = prect2->top;
+ return true;
+ }
+ }
+
+ // Centers overlap: break prect2 into two disjoint rectangles.
+ if (xLeft1 < xLeft2 && xRight2 < xRight1 && yTop2 < yTop1 && yBottom1 < yBottom2)
+ {
+ // create a new rectangle for the bottom of prect2 that is below prect1
+ Rect rectNew = *prect2;
+ rectNew.top = prect1->bottom;
+ prect2->bottom = prect1->top;
+ vrectMoreToAdd.push_back(rectNew);
+ return true;
+ }
+ else if (xLeft2 < xLeft1 && xRight1 < xRight2 && yTop1 < yTop2 && yBottom2 < yBottom1)
+ {
+ // create a new rectangle for the right of prect2 that is to the right of prect1
+ Rect rectNew = *prect2;
+ rectNew.left = prect1->right;
+ prect2->right = prect1->left;
+ vrectMoreToAdd.push_back(rectNew);
+ return true;
+ }
+
+ // Corners overlap: break prect2 into two adjacent rectangles.
+ if (xLeft1 < xLeft2 && xRight1 < xRight2)
+ {
+ // prect2 is partially to the right
+ if (yTop1 < yTop2 && yBottom1 < yBottom2)
+ {
+ // prect2 is partially below
+ Rect rectNew = *prect2;
+ rectNew.left = prect1->right;
+ prect2->top = prect1->bottom;
+ vrectMoreToAdd.push_back(rectNew);
+ return true;
+ }
+ else if (yTop2 < yTop1 && yBottom2 < yBottom1)
+ {
+ // prect2 is partially above
+ Rect rectNew = *prect2;
+ rectNew.left = prect1->right;
+ prect2->bottom = prect1->top;
+ vrectMoreToAdd.push_back(rectNew);
+ return true;
+ }
+ }
+ else if (xLeft2 < xLeft1 && xRight2 < xRight1)
+ {
+ // prect2 is partially to the left
+ if (yTop1 < yTop2 && yBottom1 < yBottom2)
+ {
+ // prect2 is partially below
+ Rect rectNew = *prect2;
+ rectNew.right = prect1->left;
+ prect2->top = prect1->bottom;
+ vrectMoreToAdd.push_back(rectNew);
+ return true;
+ }
+ else if (yTop2 < yTop1 && yBottom2 < yBottom1)
+ {
+ // prect2 is partially above
+ Rect rectNew = *prect2;
+ rectNew.right = prect1->left;
+ prect2->bottom = prect1->top;
+ vrectMoreToAdd.push_back(rectNew);
+ return true;
+ }
+ }
+
+ // No overlap.
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Assert that there are no overlaps among all the rectangles in the array, which should
+ be the case if AdjustRectsToNotOverlap is working properly.
+----------------------------------------------------------------------------------------------*/
+void SegmentPainter::AssertNoOverlaps(std::vector<Rect> & vrect)
+{
+#ifdef _DEBUG
+ for (int irect1 = 0; irect1 < signed(vrect.size() - 1); irect1++)
+ {
+ for (int irect2 = irect1 + 1; irect2 < signed(vrect.size()); irect2++)
+ {
+ float xLeft1 = vrect[irect1].left;
+ float xRight1 = vrect[irect1].right;
+ float yTop1 = vrect[irect1].top;
+ float yBottom1 = vrect[irect1].bottom;
+ Assert(xLeft1 < xRight1);
+ Assert(yTop1 < yBottom1);
+
+ float xLeft2 = vrect[irect2].left;
+ float xRight2 = vrect[irect2].right;
+ float yTop2 = vrect[irect2].top;
+ float yBottom2 = vrect[irect2].bottom;
+ Assert(xLeft2 <= xRight2);
+ Assert(yTop2 <= yBottom2);
+
+ Assert(xRight1 <= xLeft2 || xRight2 <= xLeft1 ||
+ yBottom1 <= yTop2 || yBottom2 <= yTop1);
+ }
+ }
+#endif
+}
+
+/*----------------------------------------------------------------------------------------------
+ Add the given line segment to the vector, eliminating any overlapping areas.
+----------------------------------------------------------------------------------------------*/
+void SegmentPainter::AddLineSegWithoutOverlaps(std::vector<LineSeg> & vls, LineSeg lsToAdd)
+{
+ std::vector<LineSeg> vlsMoreToAdd;
+
+ bool fAnythingToAdd = AnyLength(&lsToAdd);
+
+ size_t ils;
+ for (ils = 0; ils < vls.size(); ils++)
+ {
+ bool f = AdjustLineSegsToNotOverlap(vls, ils, &lsToAdd, vlsMoreToAdd);
+ if (!AnyLength(&vls[ils]))
+ {
+ vls.erase(vls.begin() + ils);
+ ils--;
+ }
+ if (!f)
+ {
+ fAnythingToAdd = false;
+ break;
+ }
+ }
+
+ // Now lsToAdd is in a state that it does not overlap with any other line segments
+ // in the list.
+
+ if (fAnythingToAdd)
+ vls.push_back(lsToAdd);
+
+ // Add in any extra line segments that are needed to handle overlaps.
+
+ for (ils = 0; ils < vlsMoreToAdd.size(); ils++)
+ AddLineSegWithoutOverlaps(vls, vlsMoreToAdd[ils]);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if the rectangle has an area greater than 0.
+----------------------------------------------------------------------------------------------*/
+bool SegmentPainter::AnyLength(LineSeg * pls)
+{
+ Assert(pls->left <= pls->right);
+ return (pls->left < pls->right);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Adjust the line segment pls2 to avoid overlaps with the given one in the vector.
+ Return false if the line segment does not need to be added after all.
+
+ If we can merge the two line segments, add the result to vrectMoreToAdd (so it can be properly
+ checked for further overlaps), and adjust the rectangle in the vector so it will be
+ deleted.
+
+ @param vls - current list of valid line segments
+ @param ils - item in vrect we're comparing with pls2
+ @param pls2 - line segment to add
+ @param vlsMoreToAdd - list of accumulated line segments that need to be added
+ (caused by splitting one into two)
+
+ @return True if we want to add pls2 (possibly adjusted) to the list;
+ false it it is completely subsumed by vls[ils], or has been merged with it,
+ or has no length.
+----------------------------------------------------------------------------------------------*/
+bool SegmentPainter::AdjustLineSegsToNotOverlap(std::vector<LineSeg> & vls, int ils, LineSeg * pls2,
+ std::vector<LineSeg> & vlsMoreToAdd)
+{
+ LineSeg * pls1 = &(vls[ils]);
+
+ float xLeft1 = pls1->left;
+ float xRight1 = pls1->right;
+ Assert(xLeft1 < xRight1);
+
+ float xLeft2 = pls2->left;
+ float xRight2 = pls2->right;
+ Assert(xLeft2 <= xRight2);
+
+ if (!AnyLength(pls2))
+ return false;
+
+ // No overlap: keep both as they are.
+ if (xRight2 < xLeft1 || xRight1 < xLeft2)
+ return true;
+
+ // Present line segment subsumes new: ignore new
+ if (xLeft1 <= xLeft2 && xRight2 <= xRight1)
+ return false;
+
+ // New line segment subsumes present: replace.
+ if (xLeft2 <= xLeft1 && xRight1 <= xRight2)
+ {
+ pls1->left = pls1->right; // delete previous
+ return true; // keep this one
+ }
+
+ // Adjacent or partially overlapping line segments: merge.
+ if (xLeft1 <= xLeft2 && xLeft2 <= xRight1 && xRight1 <= xRight2)
+ {
+ pls2->left = xLeft1;
+ vlsMoreToAdd.push_back(*pls2);
+ pls1->left = pls1->right; // delete previous
+ return false;
+ }
+ else if (xLeft2 <= xLeft1 && xLeft1 <= xRight2 && xRight2 <= xRight1)
+ {
+ pls2->right = xRight1;
+ vlsMoreToAdd.push_back(*pls2);
+ pls1->left = pls1->right; // delete previous
+ return false;
+ }
+ else
+ Assert(false);
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Assert that there are no overlaps among all the rectangles in the array, which should
+ be the case if AdjustRectsToNotOverlap is working properly.
+----------------------------------------------------------------------------------------------*/
+void SegmentPainter::AssertNoOverlaps(std::vector<LineSeg> & vls)
+{
+#ifdef _DEBUG
+ for (int ils1 = 0; ils1 < (int)vls.size() - 1; ils1++)
+ {
+ for (int ils2 = ils1 + 1; ils2 < (int)vls.size(); ils2++)
+ {
+ float xLeft1 = vls[ils1].left;
+ float xRight1 = vls[ils1].right;
+ Assert(xLeft1 < xRight1);
+
+ float xLeft2 = vls[ils2].left;
+ float xRight2 = vls[ils2].right;
+ Assert(xLeft2 <= xRight2);
+
+ Assert(xRight1 <= xLeft2 || xRight2 <= xLeft1);
+ }
+ }
+#endif
+}
+
+/*----------------------------------------------------------------------------------------------
+ Find the next physical location for the IP. Return true if we found one.
+
+ @param pichw - current insertion point, and adjusted result to return
+ @param pfAssocPrev - is the IP "leaning" backwards? adjust to return
+ @param fRight - true if we are moving right
+ @param fAssocPrevMatch - the assoc-prev of the result must match the original selection.
+ This is used when extending range selections; the orientation
+ of the resulting end-point must be the same as previously.
+ This helps avoids circular loops when dealing with reordering.
+ @param fAssocPrevNeeded - value needed for result; ignored if fAssocPrevMatch == false
+ @param pnNextOrPrevSeg - return 1 if we need to try the following segment, -1 if we
+ need to try the previous - CURRENTLY NOT USED for anything
+ practical
+----------------------------------------------------------------------------------------------*/
+bool SegmentPainter::ArrowKeyPositionInternal(
+ int * pichw, bool * pfAssocPrev,
+ bool fRight, bool fAssocPrevMatch, bool fAssocPrevNeeded, int * pnNextOrPrevSeg)
+{
+ int kBefore = true;
+ int kAfter = false;
+
+ bool fResult = false;
+
+ // Handle ligatures.
+
+ fResult = AdjacentLigComponent(pichw, pfAssocPrev, fRight, true);
+ if (fResult)
+ return true;
+
+ // Not within a ligature, or on the outside edge of one.
+
+ int iginfStart;
+ bool fCharRtl;
+ if (*pfAssocPrev)
+ {
+ iginfStart = m_pseg->UnderlyingToPhysicalSurface(*pichw - 1, kAfter);
+ fCharRtl = m_pseg->CharIsRightToLeft(*pichw - 1, kAfter);
+ }
+ else
+ {
+ iginfStart = m_pseg->UnderlyingToPhysicalSurface(*pichw, kBefore);
+ fCharRtl = m_pseg->CharIsRightToLeft(*pichw, kBefore);
+ }
+ if (kNegInfinity == iginfStart || kPosInfinity == iginfStart)
+ {
+ *pnNextOrPrevSeg = 0;
+ return false;
+ }
+
+ //if (*pfAssocPrev)
+ // fCharRtl ? iginfStart : iginfStart++;
+ //else
+ // fCharRtl ? iginfStart++ : iginfStart;
+
+ if (*pfAssocPrev)
+ iginfStart++;
+
+ // At this point iginfStart indicates the index of the glyph we are before.
+
+ int ichwNewIndex;
+ bool fAPNew;
+
+ bool fRtl = m_pseg->rightToLeft();
+ bool fForward = (fRtl) ? !fRight : fRight;
+ int dir = (fForward) ? 1 : -1;
+ int diginf = 0;
+
+ // When moving forward, we first move to the opposite side of the current glyph,
+ // so initially diginf should be zero.
+ if (fForward)
+ diginf = -1;
+
+ while (true)
+ {
+ diginf++;
+ int iginfTry = iginfStart + (dir * diginf);
+
+ if (iginfTry < 0)
+ {
+ *pnNextOrPrevSeg = -1;
+ return false;
+ }
+ if (iginfTry > m_pseg->m_cginf)
+ {
+ *pnNextOrPrevSeg = 1;
+ return false;
+ }
+ if (iginfTry == m_pseg->m_cginf && fForward)
+ {
+ *pnNextOrPrevSeg = 1;
+ return false;
+ }
+
+ bool fAfter;
+ int ichwTryChar;
+ if (iginfTry == m_pseg->m_cginf)
+ {
+ ichwTryChar = m_pseg->PhysicalSurfaceToUnderlying(iginfTry - 1,
+ kPosInfFloat, kPosInfFloat, 0, 0, &fAfter);
+ }
+ else
+ {
+ ichwTryChar = m_pseg->PhysicalSurfaceToUnderlying(iginfTry,
+ (fRight) ? kPosInfFloat : kNegInfFloat,
+ (fRight) ? kPosInfFloat : kNegInfFloat,
+ 0, 0, &fAfter);
+ }
+
+ if (fAfter)
+ {
+ ichwNewIndex = ichwTryChar + 1;
+ fAPNew = true;
+ }
+ else
+ {
+ ichwNewIndex = ichwTryChar;
+ fAPNew = false;
+ }
+
+ if (ichwNewIndex == *pichw)
+ continue; // didn't make any progress
+
+ LgIpValidResult ipvr = isValidInsertionPoint(ichwNewIndex);
+ if (ipvr == kipvrBad)
+ continue; // bad insertion point
+
+ if (fAssocPrevMatch && (fAssocPrevNeeded != fAPNew))
+ {
+ // Try switching fAPNew and see if that gives the right result
+ bool fAPAlt = !fAPNew;
+ int iginfAlt = m_pseg->UnderlyingToPhysicalSurface(
+ fAPAlt ? ichwTryChar - 1 : ichwTryChar + 1,
+ fAPAlt ? kAfter : kBefore);
+ fCharRtl = m_pseg->CharIsRightToLeft(
+ fAPAlt ? ichwTryChar - 1 : ichwTryChar + 1,
+ fAPAlt ? kAfter : kBefore);
+
+ if (fAPAlt)
+ fCharRtl ? iginfAlt : iginfAlt++;
+ else
+ fCharRtl ? iginfAlt++ : iginfAlt;
+
+ if ((fForward && iginfAlt <= iginfStart)
+ || (!fForward && iginfAlt >= iginfStart))
+ {
+ // Switching fAPNew would cause us to move in the opposite direction, so
+ // that's not a good solution. Keep going.
+ if ((iginfStart == 0 && !fForward) || (iginfStart == m_pseg->m_cginf && fForward))
+ {
+ // Can't go any further, so go with this even though AP is wrong.
+ }
+ else
+ continue;
+ }
+ fAPNew = fAPAlt;
+ }
+ break;
+ }
+
+ // If we have a selection within a ligature, adjust to either the right-most or the
+ // left-most.
+ AdjacentLigComponent(&ichwNewIndex, &fAPNew, fRight, false);
+
+ *pichw = ichwNewIndex;
+ *pfAssocPrev = fAPNew;
+ return true;
+}
+
+/****** OLD VERSION
+bool Segment::ArrowKeyPositionInternal(
+ int * pichw, bool * pfAssocPrev,
+ bool fRight, bool fAssocPrevMatch, bool fAssocPrevNeeded, int * pnNextOrPrevSeg)
+{
+ int kBefore = true;
+ int kAfter = false;
+
+ bool fResult = false;
+
+ // Handle ligatures.
+
+ fResult = AdjacentLigComponent(pichw, pfAssocPrev, fRight, true);
+ if (fResult)
+ return true;
+
+ // Not within a ligature, or on the outside edge of one.
+
+ int igbbOutput;
+ bool fCharRtl;
+ if (*pfAssocPrev)
+ {
+ igbbOutput = UnderlyingToPhysicalSurface(*pichw - 1, kAfter);
+ fCharRtl = CharIsRightToLeft(*pichw - 1, kAfter);
+ }
+ else
+ {
+ igbbOutput = UnderlyingToPhysicalSurface(*pichw, kBefore);
+ fCharRtl = CharIsRightToLeft(*pichw, kBefore);
+ }
+ if (kNegInfinity == igbbOutput || kPosInfinity == igbbOutput)
+ {
+ *pnNextOrPrevSeg = 0;
+ return false;
+ }
+
+ if (*pfAssocPrev)
+ fCharRtl ? igbbOutput : igbbOutput++;
+ else
+ fCharRtl ? igbbOutput++ : igbbOutput;
+
+ bool fBackward = (fRight == m_fWsRtl);
+
+ // Try to find an underlying position that would produce an IP in the expected place.
+ // First look in the same direction in the underlying text, then, if necessary, try the
+ // opposite direction (which may be necessary when reordering occurred).
+
+ int igbbNeed = (fRight) ? igbbOutput + 1 : igbbOutput - 1;
+ int ichwNew;
+ bool fAssocPrevNew;
+
+ while (0 <= igbbNeed && igbbNeed <= NumGbb()) // include end-points--we may need to
+ // be before or after them.
+ {
+ int dichwInc = fBackward ? -1 : 1;
+ int dichwLim = m_ichwMin + (fBackward ? 0 : m_dichwLim);
+
+ int nDirectionsTried = 0;
+// while (nDirectionsTried < 2) -- Nope, for now we are being very strict above moving
+ while (nDirectionsTried < 1) // only in the desired direction
+ {
+ for (int ichwTry = *pichw;
+ ((dichwInc == 1 && ichwTry <= dichwLim) ||
+ (dichwInc == -1 && ichwTry >= dichwLim));
+ ichwTry += dichwInc)
+ {
+ int igbbTry = UnderlyingToPhysicalSurface(ichwTry, kBefore);
+ fCharRtl = CharIsRightToLeft(ichwTry, kBefore);
+ igbbTry = fCharRtl ? igbbTry + 1 : igbbTry;
+ if (igbbTry == igbbNeed &&
+ (ichwTry != *pichw || *pfAssocPrev) &&
+ (!fAssocPrevMatch || !fAssocPrevNeeded))
+ {
+ ichwNew = ichwTry;
+ fAssocPrevNew = false;
+ goto LFixLigatures;
+ }
+
+ igbbTry = UnderlyingToPhysicalSurface(ichwTry - 1, kAfter);
+ fCharRtl = CharIsRightToLeft(ichwTry - 1, kAfter);
+ igbbTry = fCharRtl ? igbbTry : igbbTry + 1;
+ if (igbbTry == igbbNeed &&
+ (ichwTry != *pichw || !*pfAssocPrev) &&
+ (!fAssocPrevMatch || fAssocPrevNeeded))
+ {
+ ichwNew = ichwTry;
+ fAssocPrevNew = true;
+ goto LFixLigatures;
+ }
+ }
+
+ nDirectionsTried++;
+
+ // Didn't find an answer going the expected way; try the opposite direction.
+ dichwInc = (fRight) ? -1 : 1;
+ dichwLim = m_ichwMin + ((fRight) ? 0 : m_dichwLim);
+ }
+
+ // Didn't find an underlying position that would produce an IP in the next glyph;
+ // try the glyph after that.
+
+ igbbNeed = (fRight) ? igbbNeed + 1 : igbbNeed - 1;
+ }
+
+ if (igbbNeed >= NumGbb())
+ *pnNextOrPrevSeg = 1; // try next segment
+ else if (igbbNeed < 0)
+ *pnNextOrPrevSeg = -1; // try previous segment
+ else
+ {
+ Assert(false);
+ *pnNextOrPrevSeg = 0;
+ }
+
+ return false;
+
+LFixLigatures:
+
+ // If we have a selection within a ligature, adjust to either the right-most or the
+ // left-most.
+ AdjacentLigComponent(&ichwNew, &fAssocPrevNew, fRight, false);
+
+ *pichw = ichwNew;
+ *pfAssocPrev = fAssocPrevNew;
+ return true;
+}
+******************/
+
+/*----------------------------------------------------------------------------------------------
+ Return position for the physically next or previous ligature component, or the right-most
+ or left-most. Return true if this routine handled it.
+
+ @param pichw - starting underlying position
+ @param pfAssocPrev - is selection leaning backwards?
+ @param fMovingRight - true if right arrow key was pressed, false if left
+ @param fMove - if true, we want to find the next one over from *pichw;
+ if false, we want to find either the right-most
+ (fMovingRight = false)
+ or the left-most (fMovingRight = true)
+----------------------------------------------------------------------------------------------*/
+bool SegmentPainter::AdjacentLigComponent(int * pichw, bool * pfAssocPrev,
+ bool fMovingRight, bool fMove)
+{
+ int kBefore = true;
+ int kAfter = false;
+
+ GrEngine * pgreng = m_pseg->EngineImpl();
+ GrGlyphTable * pgtbl = (pgreng) ? pgreng->GlyphTable() : NULL;
+
+ if (!pgtbl)
+ {
+ return false;
+ }
+
+ // Find the slot containing the ligature glyph.
+
+ int ichwSegOffset = *pichw - m_pseg->m_ichwMin;
+ int isloutLig = kNegInfinity;
+ if (*pfAssocPrev)
+ {
+ if (ichwSegOffset - 1 >= m_pseg->m_ichwAssocsMin && ichwSegOffset - 1 < m_pseg->m_ichwAssocsLim)
+ isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - 1 - m_pseg->m_ichwAssocsMin];
+ }
+ else
+ {
+ if (ichwSegOffset >= m_pseg->m_ichwAssocsMin && ichwSegOffset < m_pseg->m_ichwAssocsLim)
+ isloutLig = m_pseg->m_prgisloutLigature[ichwSegOffset - m_pseg->m_ichwAssocsMin];
+ }
+
+ if (isloutLig == kNegInfinity)
+ {
+ return false;
+ }
+
+ if (*pfAssocPrev)
+ ichwSegOffset--;
+
+ bool fGlyphRtl = (*pfAssocPrev) ?
+ m_pseg->CharIsRightToLeft(*pichw - 1, kAfter) :
+ m_pseg->CharIsRightToLeft(*pichw, kBefore);
+
+ // Comparing right-sides.
+ bool fIPOnRight = (fGlyphRtl != *pfAssocPrev);
+
+ // When two ligatures are horizontally equal, take vertical position into account.
+ // In left-to-right writing systems, moving right means moving down.
+ bool fMovingDown = (fMovingRight != m_pseg->m_fWsRtl);
+
+ // Get the coordinates for all the ligatures.
+
+ std::vector<float> vysTops;
+ std::vector<float> vysBottoms;
+ std::vector<float> vxsLefts;
+ std::vector<float> vxsRights;
+
+ float ysTopCurr, ysBottomCurr, xsLeftCurr, xsRightCurr;
+ int icompCurr = -1;
+ if (fMovingRight)
+ ysTopCurr = ysBottomCurr = xsLeftCurr = xsRightCurr = kNegInfFloat;
+ else
+ ysTopCurr = ysBottomCurr = xsLeftCurr = xsRightCurr = kPosInfFloat;
+
+ GrSlotOutput * pslout = m_pseg->OutputSlot(isloutLig);
+ //int iginfOutput = m_pseg->LogicalToPhysicalSurface(isloutLig);
+
+ int icomp;
+ for (icomp = 0; icomp < pslout->NumberOfComponents(); icomp++)
+ {
+ float xsLeft, ysTop, xsRight, ysBottom;
+
+ // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph.
+ int slati = pslout->ComponentId(icomp);
+ int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati);
+ pgtbl->ComponentBoxLogUnits(m_pseg->m_xysEmSquare, pslout->GlyphID(), iForGlyph,
+ m_pseg->m_mFontEmUnits, m_pseg->m_dysAscent,
+ &xsLeft, &ysTop, &xsRight, &ysBottom);
+
+ vysTops.push_back(ysTop);
+ vysBottoms.push_back(ysBottom);
+ vxsLefts.push_back(xsLeft);
+ vxsRights.push_back(xsRight);
+
+ // If we're moving, record this component as the one we're moving relative to.
+ if (fMove && icomp == m_pseg->m_prgiComponent[ichwSegOffset - m_pseg->m_ichwAssocsMin])
+ {
+ icompCurr = icomp;
+ ysTopCurr = ysTop;
+ ysBottomCurr = ysBottom;
+ xsLeftCurr = xsLeft;
+ xsRightCurr = xsRight;
+ }
+ }
+
+ float xsHorizCurr = (fIPOnRight) ? xsRightCurr : xsLeftCurr;
+ float xsHorizNext;
+
+ // Find the first ligature that is in the proper direction.
+ int icompNext;
+ for (icompNext = 0; icompNext < pslout->NumberOfComponents(); icompNext++)
+ {
+ if (icompNext != icompCurr)
+ {
+ float xsHorizNext = (fIPOnRight) ? vxsRights[icompNext] : vxsLefts[icompNext];
+ if (fMovingRight && xsHorizNext > xsHorizCurr)
+ break;
+ else if (!fMovingRight && xsHorizNext < xsHorizCurr)
+ break;
+ }
+ }
+ if (icompNext == pslout->NumberOfComponents())
+ {
+ bool fResult;
+ // No component in the proper direction. Can we switch to the opposite edge of the
+ // current component?
+ if (fMovingRight && !fIPOnRight)
+ {
+ if (fGlyphRtl)
+ --(*pichw);
+ else
+ ++(*pichw);
+ *pfAssocPrev = !*pfAssocPrev;
+ fResult = true;
+ }
+ else if (!fMovingRight && fIPOnRight)
+ {
+ if (fGlyphRtl)
+ ++(*pichw);
+ else
+ --(*pichw);
+
+ *pfAssocPrev = !*pfAssocPrev;
+ fResult = true;
+ }
+ else
+ fResult = false;
+ return fResult;
+ }
+
+ xsHorizNext = (fIPOnRight) ? vxsRights[icompNext] : vxsLefts[icompNext];
+
+ // Now find the closest one in the proper direction.
+ for (icomp = icompNext + 1; icomp < pslout->NumberOfComponents(); icomp++)
+ {
+ if (icomp != icompCurr)
+ {
+ float xsHorizTry = (fIPOnRight) ? vxsRights[icomp] : vxsLefts[icomp];
+
+ if (fMovingRight && xsHorizTry > xsHorizCurr &&
+ (xsHorizTry < xsHorizNext ||
+ (xsHorizTry == xsHorizNext &&
+ (vysTops[icomp] > vysTops[icompNext]) == fMovingDown)))
+ {
+ icompNext = icomp;
+ xsHorizNext = xsHorizTry;
+ }
+ else if (!fMovingRight && xsHorizTry < xsHorizCurr &&
+ (xsHorizTry > xsHorizNext ||
+ (xsHorizTry == xsHorizNext &&
+ (vysTops[icomp] > vysTops[icompNext]) == fMovingDown)))
+ {
+ icompNext = icomp;
+ xsHorizNext = xsHorizTry;
+ }
+ }
+ }
+
+ *pichw = pslout->UnderlyingComponent(icompNext) + m_pseg->m_ichwMin;
+ if (*pfAssocPrev)
+ ++(*pichw);
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Scale the x-coordinate by the scaling factors for this painter.
+----------------------------------------------------------------------------------------------*/
+float SegmentPainter::ScaleX(float xs, Rect rs, Rect rd)
+{
+ //return rs.MapXTo(xs, rd);
+
+ float dxs = rs.right - rs.left;
+ float dxd = rd.right - rd.left;
+ Assert(dxs > 0);
+ if (dxs == dxd)
+ return xs + rd.left - rs.left;
+
+ float xd = rd.left + GrEngine::GrFloatMulDiv((xs - rs.left), dxd, dxs);
+ return xd;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Scale the y-coordinate by the scaling factors for this painter.
+----------------------------------------------------------------------------------------------*/
+float SegmentPainter::ScaleY(float ys, Rect rs, Rect rd)
+{
+ //return rs.MapYTo(ys, rd);
+
+ float dys = rs.bottom - rs.top;
+ float dyd = rd.bottom - rd.top;
+ Assert(dys > 0);
+ if (dys == dyd)
+ return ys + rd.top - rs.top;
+ float yd = rd.top + GrEngine::GrFloatMulDiv((ys - rs.top), dyd, dys);
+ return yd;
+}
+
+
+//:>********************************************************************************************
+//:> Low-level platform-specific drawing methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Make sure the font is set to use the character properties required by this segment.
+----------------------------------------------------------------------------------------------*/
+void SegmentPainter::SetFontProps(unsigned long clrFore, unsigned long clrBack)
+{
+ return;
+}
+
+} // namespace gr
diff --git a/Build/source/libs/graphite/src/segment/FileInput.cpp b/Build/source/libs/graphite/src/segment/FileInput.cpp
new file mode 100644
index 00000000000..52969532cd3
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/FileInput.cpp
@@ -0,0 +1,266 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: FileInput.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Contains the functions for reading from a TT file. (These are functions, not methods
+ associated with a class.)
+----------------------------------------------------------------------------------------------*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+
+#include "GrCommon.h"
+#include "GrData.h"
+#ifndef _WIN32
+#include "GrMstypes.h"
+#endif
+#include "GrDebug.h"
+#include <fstream>
+#include <iostream>
+#include <string>
+#include "FileInput.h"
+#include "GrResult.h"
+
+//#ifndef _MSC_VER
+//#include "config.h"
+//#endif
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:End Ignore
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Methods of GrBufferIStream
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Constructor.
+----------------------------------------------------------------------------------------------*/
+GrBufferIStream::GrBufferIStream()
+{
+ m_pbStart = NULL;
+ m_pbNext = NULL;
+ m_pbLim = NULL;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Destructor.
+----------------------------------------------------------------------------------------------*/
+GrBufferIStream::~GrBufferIStream()
+{
+ Close();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Initialize the stream.
+----------------------------------------------------------------------------------------------*/
+#ifdef GR_FW
+bool GrBufferIStream::Open(std::wstring stuFileName, int kMode)
+#else
+bool GrBufferIStream::Open(const char * pcFileName, std::ios::openmode kMode)
+#endif
+{
+ Assert(false); // use OpenBuffer
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Initialize the stream to a buffer.
+----------------------------------------------------------------------------------------------*/
+bool GrBufferIStream::OpenBuffer(byte * pbBuffer, int cb)
+{
+ Assert(m_pbStart == NULL);
+ Assert(m_pbNext == NULL);
+ Assert(m_pbLim == NULL);
+
+ m_pbStart = pbBuffer;
+ m_pbNext = pbBuffer;
+ if (cb > 0)
+ m_pbLim = m_pbStart + cb;
+ // otherwise we don't know the length
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Close the stream.
+----------------------------------------------------------------------------------------------*/
+void GrBufferIStream::Close()
+{
+ m_pbStart = NULL;
+ m_pbNext = NULL;
+ m_pbLim = NULL;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Read a byte from the stream.
+----------------------------------------------------------------------------------------------*/
+byte GrBufferIStream::ReadByteFromFont()
+{
+ byte bInput = *m_pbNext;
+ m_pbNext += isizeof(byte);
+ if (m_pbLim && m_pbNext > m_pbLim)
+ THROW(kresReadFault);
+ return bInput;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Read a short (signed 16-bit) word from the stream. Switch the bytes from big-endian
+ to little-endian format.
+----------------------------------------------------------------------------------------------*/
+short GrBufferIStream::ReadShortFromFont()
+{
+ short snInput = *(short *)m_pbNext;
+ m_pbNext += isizeof(short);
+ if (m_pbLim && m_pbNext > m_pbLim)
+ THROW(kresReadFault);
+ snInput = lsbf(snInput);
+ return snInput;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Read a wide character (unsigned 16-bit word) from the stream.
+ Switch the bytes from big-endian to little-endian format.
+----------------------------------------------------------------------------------------------*/
+utf16 GrBufferIStream::ReadUShortFromFont()
+{
+ utf16 chwInput = *(utf16 *)m_pbNext;
+ m_pbNext += isizeof(utf16);
+ if (m_pbLim && m_pbNext > m_pbLim)
+ THROW(kresReadFault);
+ chwInput = lsbf(chwInput);
+ return chwInput;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Read a standard (32-bit) word from the stream. Switch the bytes from big-endian
+ to little-endian format.
+----------------------------------------------------------------------------------------------*/
+int GrBufferIStream::ReadIntFromFont()
+{
+ int nInput = *(int *)m_pbNext;
+ m_pbNext += isizeof(int);
+ if (m_pbLim && m_pbNext > m_pbLim)
+ THROW(kresReadFault);
+ nInput = lsbf(nInput);
+ return nInput;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Read a block of data from the stream. DON'T switch the bytes from big-endian
+ to little-endian format.
+----------------------------------------------------------------------------------------------*/
+void GrBufferIStream::ReadBlockFromFont(void * pvInput, int cb)
+{
+ std::copy(m_pbNext, m_pbNext + cb, reinterpret_cast<byte*>(pvInput));
+ m_pbNext += cb;
+ if (m_pbLim && m_pbNext > m_pbLim)
+ THROW(kresReadFault);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the absolute position of the font-file stream (relative to the beginning of
+ the file). For buffers, we just return the byte position in the buffer.
+----------------------------------------------------------------------------------------------*/
+void GrBufferIStream::GetPositionInFont(long * plPos)
+{
+ *plPos = (m_pbNext - m_pbStart);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set the position of the font-file stream to the given absolute position (relative
+ to the beginning of the file). For buffers, assume the position is relative to the
+ beginning of the buffer.
+----------------------------------------------------------------------------------------------*/
+void GrBufferIStream::SetPositionInFont(long lPos)
+{
+ m_pbNext = m_pbStart + lPos;
+ if (m_pbLim && m_pbNext > m_pbLim)
+ THROW(kresReadFault);
+}
+
+
+//:>********************************************************************************************
+//:> Swap byte order.
+//:>********************************************************************************************
+int swapb(int nArg)
+{
+#if WORDS_BIGENDIAN
+return nArg;
+#else
+ int b1, b2, b3, b4;
+ b1 = ((nArg & 0xFF000000) >> 24) & 0x000000FF; // remove sign extension
+ b2 = ((nArg & 0x00FF0000) >> 8); // & 0x0000FF00;
+ b3 = ((nArg & 0x0000FF00) << 8); // & 0x00FF0000;
+ b4 = ((nArg & 0x000000FF) << 24); // & 0xFF000000;
+ int nRet = b1 | b2 | b3 | b4;
+ return nRet;
+#endif
+}
+
+unsigned int swapb(unsigned int nArg)
+{
+#if WORDS_BIGENDIAN
+return nArg;
+#else
+ int b1, b2, b3, b4;
+ b1 = ((nArg & 0xFF000000) >> 24) & 0x000000FF; // remove sign extension
+ b2 = ((nArg & 0x00FF0000) >> 8); // & 0x0000FF00;
+ b3 = ((nArg & 0x0000FF00) << 8); // & 0x00FF0000;
+ b4 = ((nArg & 0x000000FF) << 24); // & 0xFF000000;
+ int nRet = b1 | b2 | b3 | b4;
+ return nRet;
+#endif
+}
+
+utf16 swapb(utf16 chwArg)
+{
+#if WORDS_BIGENDIAN
+return chwArg;
+#else
+ utf16 b1, b2;
+ b1 = ((chwArg & 0xFF00) >> 8) & 0x00FF; // remove sign extension
+ b2 = ((chwArg & 0x00FF) << 8); // & 0xFF00;
+ utf16 chwRet = b1 | b2;
+ return chwRet;
+#endif
+}
+
+short swapb(short snArg)
+{
+#if WORDS_BIGENDIAN
+return snArg;
+#else
+ short b1, b2;
+ b1 = ((snArg & 0xFF00) >> 8) & 0x00FF; // remove sign extension
+ b2 = ((snArg & 0x00FF) << 8); // & 0xFF00;
+ short snRet = b1 | b2;
+ return snRet;
+#endif
+}
+
+} //namespace gr
+
diff --git a/Build/source/libs/graphite/src/segment/FileInput.h b/Build/source/libs/graphite/src/segment/FileInput.h
new file mode 100644
index 00000000000..f8c32b762eb
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/FileInput.h
@@ -0,0 +1,104 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: FileInput.h
+Responsibility: Sharon Correll
+Last reviewed: not yet
+
+Description:
+ Defines utility functions for reading from a font file.
+----------------------------------------------------------------------------------------------*/
+
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef FILEINPUT_INCLUDED
+#define FILEINPUT_INCLUDED
+
+//:End Ignore
+
+namespace gr
+{
+
+int swapb(int nArg);
+unsigned int swapb(unsigned int nArg);
+utf16 swapb(utf16 chwArg);
+short swapb(short snArg);
+
+// Most significant byte first (converting from least-sig-first):
+inline int msbf(int nArg) { return swapb(nArg); }
+inline unsigned int msbf(unsigned int nArg) { return swapb(nArg); }
+inline utf16 msbf(utf16 chwArg) { return swapb(chwArg); }
+inline short msbf(short chwArg) { return swapb(chwArg); }
+
+// Least significant byte first (converting from most-sig first):
+inline int lsbf(int nArg) { return swapb(nArg); }
+inline unsigned int lsbf(unsigned int nArg) { return swapb(nArg); };
+inline utf16 lsbf(utf16 chwArg) { return swapb(chwArg); }
+inline short lsbf(short chwArg) { return swapb(chwArg); }
+
+class GrIStream
+{
+public:
+ virtual void Close() = 0;
+
+ virtual byte ReadByteFromFont() = 0;
+ virtual short ReadShortFromFont() = 0;
+ virtual utf16 ReadUShortFromFont() = 0;
+ virtual int ReadIntFromFont() = 0;
+ virtual void ReadBlockFromFont(void * pvInput, int cb) = 0;
+
+ virtual void GetPositionInFont(long * plPos) = 0;
+ virtual void SetPositionInFont(long lPos) = 0;
+
+ virtual bool OpenBuffer(byte * pbBuffer, int cb) = 0;
+ virtual void CloseBuffer() = 0;
+
+protected:
+ virtual ~GrIStream() {}
+};
+
+
+/*----------------------------------------------------------------------------------------------
+ A stream that reads from a buffer rather than a file.
+----------------------------------------------------------------------------------------------*/
+class GrBufferIStream : public GrIStream
+{
+public:
+ GrBufferIStream();
+ ~GrBufferIStream();
+
+ #ifdef GR_FW
+ virtual bool Open(std::wstring stuFileName, std::ios::openmode kMode);
+ #else
+ virtual bool Open(const char * pcFileName, std::ios::openmode kMode);
+ #endif
+ virtual void Close();
+
+ virtual byte ReadByteFromFont();
+ virtual short ReadShortFromFont();
+ virtual utf16 ReadUShortFromFont();
+ virtual int ReadIntFromFont();
+ virtual void ReadBlockFromFont(void * pvInput, int cb);
+
+ virtual void GetPositionInFont(long * plPos);
+ virtual void SetPositionInFont(long lPos);
+
+ virtual bool OpenBuffer(byte * pbBuffer, int cb);
+ virtual void CloseBuffer()
+ {
+ Close();
+ }
+
+protected:
+ byte * m_pbStart;
+ byte * m_pbNext;
+ byte * m_pbLim;
+};
+
+} // namespace gr
+
+#endif // !FILEINPUT_INCLUDED
diff --git a/Build/source/libs/graphite/src/segment/FontCache.cpp b/Build/source/libs/graphite/src/segment/FontCache.cpp
new file mode 100644
index 00000000000..f0540463e3b
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/FontCache.cpp
@@ -0,0 +1,308 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: FontCache.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ A cache of all the font-face objects.
+----------------------------------------------------------------------------------------------*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+// any other headers (not precompiled)
+
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:End Ignore
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Methods
+//:>********************************************************************************************
+
+namespace gr
+{
+
+/*----------------------------------------------------------------------------------------------
+ Store the given font-face in the cache. Overwrite whatever was there before.
+ Return NULL if there is nothing appropriate there.
+----------------------------------------------------------------------------------------------*/
+void FontCache::GetFontFace(std::wstring strFaceName, bool fBold, bool fItalic,
+ FontFace ** ppfface)
+{
+ int ifci = FindCacheItem(strFaceName);
+ if (ifci < 0) // no fonts of that family present
+ {
+ *ppfface = NULL;
+ return;
+ }
+
+ CacheItem * pfci = m_prgfci + ifci;
+ if (fBold)
+ {
+ if (fItalic)
+ *ppfface = pfci->pffaceBI;
+ else
+ *ppfface = pfci->pffaceBold;
+ }
+ else
+ {
+ if (fItalic)
+ *ppfface = pfci->pffaceItalic;
+ else
+ *ppfface = pfci->pffaceRegular;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Store the given font-face in the cache. Overwrite whatever was there before.
+----------------------------------------------------------------------------------------------*/
+void FontCache::CacheFontFace(std::wstring strFaceName, bool fBold, bool fItalic,
+ FontFace * pfface)
+{
+ if (m_prgfci == NULL)
+ Initialize();
+
+ int ifciIns = FindCacheItem(strFaceName);
+ int ifci = ifciIns;
+ if (ifciIns < 0)
+ {
+ ifci = (ifciIns + 1) * -1;
+ InsertCacheItem(ifci);
+ std::copy(strFaceName.c_str(), strFaceName.c_str() +
+ (strFaceName.size() + 1), m_prgfci[ifci].szFaceName);
+ }
+
+ CacheItem * pfci = m_prgfci + ifci;
+
+ bool fPrevNull;
+ if (fBold)
+ {
+ if (fItalic)
+ {
+ fPrevNull = (pfci->pffaceBI == NULL);
+ pfci->pffaceBI = pfface;
+ }
+ else
+ {
+ fPrevNull = (pfci->pffaceBold == NULL);
+ pfci->pffaceBold = pfface;
+ }
+ }
+ else
+ {
+ if (fItalic)
+ {
+ fPrevNull = (pfci->pffaceItalic == NULL);
+ pfci->pffaceItalic = pfface;
+ }
+ else
+ {
+ fPrevNull = (pfci->pffaceRegular == NULL);
+ pfci->pffaceRegular = pfface;
+ }
+ }
+
+ if (fPrevNull && (pfface != NULL))
+ m_cfface++;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Remove the given font-face from the cache. Return false if it couldn't be found.
+----------------------------------------------------------------------------------------------*/
+bool FontCache::RemoveFontFace(std::wstring strFaceName, bool fBold, bool fItalic,
+ bool fZapCache)
+{
+ int ifci = FindCacheItem(strFaceName);
+ if (ifci < 0)
+ {
+ return false;
+ }
+
+ bool fPrevVal;
+ CacheItem * pfci = m_prgfci + ifci;
+ if (fBold)
+ {
+ if (fItalic)
+ {
+ fPrevVal = (pfci->pffaceBI != NULL);
+ pfci->pffaceBI = NULL;
+ }
+ else
+ {
+ fPrevVal = (pfci->pffaceBold != NULL);
+ pfci->pffaceBold = NULL;
+ }
+ }
+ else
+ {
+ if (fItalic)
+ {
+ fPrevVal = (pfci->pffaceItalic != NULL);
+ pfci->pffaceItalic = NULL;
+ }
+ else
+ {
+ fPrevVal = (pfci->pffaceRegular != NULL);
+ pfci->pffaceRegular = NULL;
+ }
+ }
+
+ if (fPrevVal)
+ m_cfface--;
+
+ Assert(m_cfface >= 0);
+
+ if (m_flush == kflushAuto && fZapCache)
+ {
+ DeleteIfEmpty();
+ }
+
+ return fPrevVal;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Search for the font-family in the cache and return its index.
+ If not present, return a negative number indicating where it was expected.
+----------------------------------------------------------------------------------------------*/
+int FontCache::FindCacheItem(std::wstring strFaceName)
+{
+ if (m_cfci == 0)
+ return -1;
+
+ Assert(m_prgfci);
+
+ // Use a binary-chop search.
+
+ int ifciLow = 0;
+ int ifciHigh = m_cfci;
+ while (true)
+ {
+ int ifciMid = (ifciHigh + ifciLow) >> 1; // divide by 2
+ CacheItem * pfci = m_prgfci + ifciMid;
+ int tst = wcscmp(strFaceName.c_str(), (const wchar_t *)pfci->szFaceName);
+ if (tst == 0)
+ return ifciMid; // found it
+ if (ifciLow + 1 == ifciHigh)
+ {
+ // not there; return where expected: 0 -> -1, 1 -> -2
+ Assert(ifciMid == ifciLow);
+ if (tst < 0)
+ return (ifciLow * -1) - 1;
+ else
+ return (ifciHigh * -1) - 1;
+ }
+
+ // Keep looking.
+ if (tst < 0)
+ ifciHigh = ifciMid;
+ else
+ ifciLow = ifciMid;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Insert space in the cache at location ifci.
+----------------------------------------------------------------------------------------------*/
+void FontCache::InsertCacheItem(int ifci)
+{
+ if (m_cfci == m_cfciMax)
+ {
+ // Cache is full; double the space.
+ CacheItem * m_prgfciOld = m_prgfci;
+ m_prgfci = new CacheItem[m_cfciMax * 2];
+ std::copy(m_prgfciOld, m_prgfciOld + m_cfciMax, m_prgfci);
+ delete[] m_prgfciOld;
+ m_cfciMax *= 2;
+ }
+
+ // This copy involves overlapping ranges, so we need copy_backward not copy
+ // to satisfy the preconditions
+ std::copy_backward(m_prgfci + ifci, m_prgfci + m_cfci, m_prgfci + m_cfci + 1);
+ m_cfci++;
+
+ // Initialize inserted item.
+ CacheItem * pfci = m_prgfci + ifci;
+ pfci->pffaceRegular = NULL;
+ pfci->pffaceBold = NULL;
+ pfci->pffaceItalic = NULL;
+ pfci->pffaceBI = NULL;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Delete the cache if it is empty.
+----------------------------------------------------------------------------------------------*/
+void FontCache::DeleteIfEmpty()
+{
+ if (m_cfface <= 0)
+ // All items are NULL; delete this cache. Probably this is because
+ // the program is exiting.
+ FontFace::ZapFontCache();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Check that the cache is indeed empty.
+----------------------------------------------------------------------------------------------*/
+void FontCache::AssertEmpty()
+{
+#ifdef _DEBUG
+ for (int ifci = 0; ifci < m_cfci; ifci++)
+ {
+ CacheItem * pfci = m_prgfci + ifci;
+ Assert(pfci->pffaceRegular == NULL);
+ Assert(pfci->pffaceBold == NULL);
+ Assert(pfci->pffaceItalic == NULL);
+ Assert(pfci->pffaceBI == NULL);
+ }
+#endif // _DEBUG
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set the flush mode on the cache to indicate whether or not it should be deleted when
+ it becomes empty.
+----------------------------------------------------------------------------------------------*/
+void FontCache::SetFlushMode(int flush)
+{
+ m_flush = flush;
+
+ if (m_flush == kflushAuto)
+ {
+ // Delete any font faces that have no remaining corresponding fonts.
+ // Work backwards so as we remove items the loop still works.
+ for (int ifci = m_cfci; --ifci >= 0; )
+ {
+ CacheItem * pfci = m_prgfci + ifci;
+ if (pfci->pffaceRegular && pfci->pffaceRegular->NoFonts())
+ RemoveFontFace(pfci->szFaceName, false, false, false);
+ if (pfci->pffaceBold && pfci->pffaceBold->NoFonts())
+ RemoveFontFace(pfci->szFaceName, true, false, false);
+ if (pfci->pffaceItalic && pfci->pffaceItalic->NoFonts())
+ RemoveFontFace(pfci->szFaceName, false, true, false);
+ if (pfci->pffaceBI && pfci->pffaceBI->NoFonts())
+ RemoveFontFace(pfci->szFaceName, true, true, false);
+ }
+
+ if (m_cfface <= 0)
+ FontFace::ZapFontCache();
+ }
+}
+
+} // namespace gr
diff --git a/Build/source/libs/graphite/src/segment/FontCache.h b/Build/source/libs/graphite/src/segment/FontCache.h
new file mode 100644
index 00000000000..56da5ab26b8
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/FontCache.h
@@ -0,0 +1,105 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: FontCache.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ A cache of all the font-face objects known to mankind. There is exactly one instance
+ of a FontCache.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef FONTCACHE_INCLUDED
+#define FONTCACHE_INCLUDED
+
+//:End Ignore
+
+namespace gr
+{
+
+class FontFace;
+class FontMemoryUsage;
+
+/*----------------------------------------------------------------------------------------------
+ TODO: change from a sorted list to a hash table, if performance so requires.
+----------------------------------------------------------------------------------------------*/
+class FontCache {
+ friend class FontMemoryUsage;
+
+public:
+ FontCache()
+ {
+ m_cfci = 0;
+ m_prgfci = NULL;
+ m_cfciMax = 0;
+ m_cfface = 0;
+ m_flush = kflushAuto;
+ }
+
+ ~FontCache()
+ {
+ delete[] m_prgfci;
+ m_prgfci = NULL;
+ m_cfci = 0;
+ m_cfciMax = 0;
+ m_cfface = 0;
+ }
+
+ void Initialize()
+ {
+ m_cfci = 0;
+ m_prgfci = new CacheItem[12];
+ m_cfciMax = 12;
+ m_cfface = 0;
+ }
+
+ struct CacheItem
+ {
+ wchar_t szFaceName[32]; // type should match std::wstring
+ FontFace * pffaceRegular;
+ FontFace * pffaceBold;
+ FontFace * pffaceItalic;
+ FontFace * pffaceBI;
+ };
+
+ void GetFontFace(std::wstring strFaceName, bool fBold, bool fItalic, FontFace ** ppfface);
+ void CacheFontFace(std::wstring strFaceName, bool fBold, bool fItalic, FontFace * pfface);
+ bool RemoveFontFace(std::wstring strFaceName, bool fBold, bool fItalic, bool fZapCache = true);
+ void DeleteIfEmpty();
+ void AssertEmpty();
+
+ int GetFlushMode()
+ {
+ return m_flush;
+ }
+ void SetFlushMode(int);
+
+ // Debugging:
+ //bool DbgCheckFontCache();
+
+ void calculateMemoryUsage(FontMemoryUsage & fmu);
+
+protected:
+ int FindCacheItem(std::wstring strFaceName);
+ void InsertCacheItem(int ifci);
+
+protected:
+ // member variables;
+ int m_cfci; // number of items (font-families)
+ int m_cfciMax; // amount of space available
+ int m_cfface; // number of font-faces
+ CacheItem * m_prgfci;
+
+ int m_flush;
+};
+
+} // namespace gr
+
+
+#endif // !FONTCACHE_INCLUDED
diff --git a/Build/source/libs/graphite/src/segment/FontFace.cpp b/Build/source/libs/graphite/src/segment/FontFace.cpp
new file mode 100644
index 00000000000..45461fe63ac
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/FontFace.cpp
@@ -0,0 +1,598 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrEngine.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description: Contains the implementation of the FontFace class.
+----------------------------------------------------------------------------------------------*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+#include <functional>
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+// any other headers (not precompiled)
+
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:End Ignore
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+FontCache * FontFace::s_pFontCache = 0;
+
+//:>********************************************************************************************
+//:> New interface
+//:>********************************************************************************************
+/*----------------------------------------------------------------------------------------------
+ Return the appropriate FontFace, initialized with Graphite tables.
+ Called from the font constructor.
+----------------------------------------------------------------------------------------------*/
+FontFace * FontFace::GetFontFace(Font * pfont,
+ std::wstring strFaceName, bool fBold, bool fItalic,
+ bool fDumbFallback)
+{
+ if (s_pFontCache == NULL)
+ s_pFontCache = new FontCache;
+
+ FontFace * pfface;
+ s_pFontCache->GetFontFace(strFaceName, fBold, fItalic, &pfface);
+ if (pfface)
+ return pfface;
+
+ // Create a new font face.
+ pfface = new FontFace();
+ pfface->InitFontFace(pfont, strFaceName, fBold, fItalic, fDumbFallback);
+ return pfface;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Initialize the engine using the given Graphite font.
+----------------------------------------------------------------------------------------------*/
+GrResult FontFace::InitFontFace(Font * pfont,
+ std::wstring stuFaceName, bool fBold, bool fItalic,
+ bool fDumbFallback)
+{
+ AssertPtrN(pfont);
+
+ m_pgreng = new GrEngine;
+ m_pgreng->m_pfface = this;
+
+ m_pgreng->m_nScriptTag = 0; // not currently used, but set it to something
+
+ std::wstring stuFeatures;
+
+ //stuFeatures = stuFeaturesArg;
+
+ if (wcscmp(stuFaceName.c_str(), m_pgreng->m_stuFaceName.c_str()) != 0)
+ {
+ s_pFontCache->RemoveFontFace(m_pgreng->FaceName(), m_pgreng->Bold(), m_pgreng->Italic());
+
+ m_pgreng->DestroyEverything(); // nothing we've cached is safe or useful.
+ m_pgreng->m_stuFaceName = stuFaceName; // if this is buggy, using assign might fix it
+ }
+
+ //GrResult res = kresFail;
+//#ifdef GR_FW
+// // Read from the control file indicated by the registry, if any.
+// std::wstring stuFaceNameTmp;
+// stuFaceNameTmp.assign(rgchFaceName, wcslen(rgchFaceName));
+// res = InitFromControlFile(pfont, stuFaceName.c_str(), fBold, fItalic);
+//#endif // GR_FW
+
+ // Read directly from the font.
+ m_pgreng->DestroyContents();
+ GrResult res = kresUnexpected;
+ try {
+ res = m_pgreng->ReadFontTables(pfont, fItalic);
+ }
+ catch (...)
+ {
+ if (fDumbFallback && m_pgreng->DumbFallback() && !m_pgreng->BadFont())
+ {
+ // If we have a basically good font but can't do Graphite,
+ // just go with empty tables, which should be set up.
+ res = m_pgreng->m_resFontRead;
+ }
+ else
+ {
+ if (m_cfonts == 0)
+ {
+ //s_pFontCache->DeleteIfEmpty();
+ //Assert(s_pFontCache == 0);
+ delete this; // will also delete GrEngine
+ }
+ else
+ {
+ delete m_pgreng;
+ }
+ m_pgreng = NULL;
+ throw; // throw original exception
+ }
+ }
+
+ m_pgreng->m_resFontValid = res;
+
+ m_pgreng->m_fBold = fBold;
+ m_pgreng->m_fItalic = fItalic;
+
+ s_pFontCache->CacheFontFace(m_pgreng->FaceName(), fBold, fItalic, this);
+
+ return m_pgreng->m_resFontValid;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Read the cmap and Graphite tables from the font that is selected into the graphics
+ device.
+
+ @return A GrResult indicating whether we were successful in loading the Graphite font:
+ - kresOk means success
+ - kresFail means the Graphite font could not be found or the basic font tables
+ (head, name, cmap) could not be loaded
+ - kresUnexpected means the Graphite tables could not be loaded
+ - kresFalse means it is not a Graphite font at all (has no Silf table).
+----------------------------------------------------------------------------------------------*/
+GrResult GrEngine::ReadFontTables(Font * pfont, bool fItalic)
+{
+ GrResult res = kresOk;
+ m_ferr = kferrOkay;
+ GrBufferIStream grstrm;
+
+ FontException fexptn;
+ fexptn.version = -1;
+ fexptn.subVersion = -1;
+
+ bool fOk = false;
+
+ const void * pHeadTbl; const void * pSileTbl; const void * pSilfTbl;
+ const void * pFeatTbl; const void * pGlatTbl; const void * pGlocTbl; const void * pSillTbl;
+ //const void * pCmapTbl; const void * pNameTbl;
+ size_t cbHeadSz, cbSilfSz, cbFeatSz, cbGlatSz, cbGlocSz, cbSillSz;
+ //size_t cbCmapSz, cbSileSz, cbNameSz;
+
+ m_fFakeItalic = false;
+
+ bool fBasicTables = false;
+ bool fSilf = false; // does the font have some sort of Silf table?
+ int nCheckSum = 0;
+
+ bool fBadBase = false,
+ fMismatchedBase = false,
+ fFontIsItalic = false;
+
+ // First read the head table. This gives us the checksum that we are using as a
+ // unique identifer. If it is the same as the one stored, and things appear set up,
+ // don't reload the tables.
+ res = (pHeadTbl = pfont->getTable(TtfUtil::TableIdTag(ktiHead), &cbHeadSz)) ? kresOk : kresFail;
+ fOk = pHeadTbl && (cbHeadSz == 0 || TtfUtil::CheckTable(ktiHead, pHeadTbl, cbHeadSz));
+ if (res == kresFail)
+ {
+ m_stuInitError = L"could not locate head table for Graphite rendering";
+ m_ferr = kferrFindHeadTable;
+ goto LUnexpected;
+ }
+ if (!fOk)
+ {
+ m_stuInitError = L"could not read design units for Graphite rendering";
+ m_ferr = kferrReadDesignUnits;
+ goto LUnexpected;
+ }
+ m_mFontEmUnits = TtfUtil::DesignUnits(pHeadTbl);
+ nCheckSum = TtfUtil::HeadTableCheckSum(pHeadTbl);
+ fFontIsItalic = TtfUtil::IsItalic(pHeadTbl);
+
+ if (m_nFontCheckSum == nCheckSum && m_ptman)
+ return m_resFontRead; // already initialized in some form
+
+ DestroyContents();
+
+ Assert(!m_ptman);
+ Assert(!m_pctbl);
+ Assert(!m_pgtbl);
+ Assert(!m_prgpsd);
+ m_prgpsd = NULL;
+ m_cpsd = 0;
+
+ m_ptman = new GrTableManager(this);
+
+ m_fFakeItalic = (fItalic && !fFontIsItalic);
+
+ // Look for an Sile table. If there is one, this is an extension font containing only
+ // the Graphite tables. Read the base font name out of the Sile table, and use it to
+ // read the cmap. Then replace the original font name to read the Graphite tables.
+
+ m_fUseSepBase = false;
+ m_stuBaseFaceName.erase();
+
+ // TODO: rework the handling of the Sile table.
+ pSileTbl = NULL;
+ //pSileTbl = pfont->getTable(TtfUtil::TableIdTag(ktiSile));
+ //if (pSileTbl)
+ //{
+ // pgg->get_FontCharProperties(&chrpOriginal);
+ // grstrm.OpenBuffer(pSileTbl, sile_tbl.size());
+ // m_fUseSepBase = ReadSileTable(pgg, grstrm, 0, &m_mFontEmUnits, &fMismatchedBase);
+ // grstrm.Close();
+
+ // if (!m_fUseSepBase)
+ // {
+ // SwitchGraphicsFont(pgg, false); // back to Graphite table font
+ // m_stuBaseFaceName.erase();
+ // fBadBase = true;
+ // m_fUseSepBase = false;
+ // }
+ // // Otherwise leave the GrGraphics in a state to read from the base font.
+ //}
+
+ // We don't need the offset table, and there's no way to get it anyway
+ // without a font file.
+
+ // cmap and name
+ Assert(!m_fCmapTblCopy);
+ Assert(!m_fNameTblCopy);
+ fOk = SetCmapAndNameTables(pfont);
+ if (!fOk)
+ {
+ goto LUnexpected;
+ }
+
+ fBasicTables = true;
+
+ // If we have a bad base file, don't do Graphite stuff.
+ if (fBadBase || fMismatchedBase)
+ goto LUnexpected;
+
+ /****
+ Obtain font name from InitNew() now instead of reading from font file. InitNew should
+ should have a correct font name passed to it since it should come from a font registered
+ by GrFontInst.exe. This commented code could be use to verify name in font file matches.
+ NOTE: if we ever use this code again, make sure we're using the base font name table,
+ not the Graphite wrapper font name table.
+ // find the font family name
+ if (!TtfUtil::Get31EngFamilyInfo(vbName.Begin(), lnNameOff, lnNameSz))
+ { // use Name table which is Symbol encode instead
+ // this could cause problems if a real Symbol writing system is used in the name table
+ // however normally real Unicode values are used instead a Symbol writing system
+ if (!TtfUtil::Get30EngFamilyInfo(vbName.Begin(), lnNameOff, lnNameSz))
+ {
+ ReturnResult(kresFail);
+ }
+ // test for Symbol writing system. first byte of Unicode id should be 0xF0
+ if (vbName[lnNameOff + 1] == (unsigned char)0xF0) // 1 - Unicode id is big endian
+ ReturnResult(kresFail);
+ }
+ if (!TtfUtil::SwapWString(vbName.Begin() + lnNameOff, lnNameSz / isizeof(utf16)))
+ ReturnResult(kresFail);
+
+ m_stuFaceName = std::wstring((utf16 *)(vbName.begin() + lnNameOff), lnNameSz / isizeof(utf16));
+ ****/
+
+ // Silf
+ res = (pSilfTbl = pfont->getTable(TtfUtil::TableIdTag(ktiSilf), &cbSilfSz)) ? kresOk : kresFail;
+ fOk = pSilfTbl && (cbSilfSz == 0 || TtfUtil::CheckTable(ktiSilf, pSilfTbl, cbSilfSz));
+ if (!fOk)
+ {
+ m_stuInitError = L"could not load Silf table for Graphite rendering";
+ m_ferr = kferrLoadSilfTable;
+ goto LUnexpected;
+ }
+
+ // Feat
+ res = (pFeatTbl = pfont->getTable(TtfUtil::TableIdTag(ktiFeat), &cbFeatSz)) ? kresOk : kresFail;
+ fOk = pFeatTbl && (cbFeatSz == 0 || TtfUtil::CheckTable(ktiFeat, pFeatTbl, cbFeatSz));
+ if (!fOk)
+ {
+ // TODO: just create an empty set of features, since this is not disastrous.
+ m_stuInitError = L"could not load Feat table for Graphite rendering";
+ m_ferr = kferrLoadFeatTable;
+ goto LUnexpected;
+ }
+
+ // Glat
+ res = (pGlatTbl = pfont->getTable(TtfUtil::TableIdTag(ktiGlat), &cbGlatSz)) ? kresOk : kresFail;
+ fOk = pGlatTbl && (cbGlatSz == 0 || TtfUtil::CheckTable(ktiGlat, pGlatTbl, cbGlatSz));
+ if (!fOk)
+ {
+ m_stuInitError = L"could not load Glat table for Graphite rendering";
+ m_ferr = kferrLoadGlatTable;
+ goto LUnexpected;
+ }
+
+ // Gloc
+ res = (pGlocTbl = pfont->getTable(TtfUtil::TableIdTag(ktiGloc), &cbGlocSz)) ? kresOk : kresFail;
+ fOk = pGlocTbl && (cbGlocSz == 0 || TtfUtil::CheckTable(ktiGloc, pGlocTbl, cbGlocSz));
+ if (!fOk)
+ {
+ m_stuInitError = L"could not load Gloc table for Graphite rendering";
+ m_ferr = kferrLoadGlocTable;
+ goto LUnexpected;
+ }
+
+ // Sill
+ try {
+ res = (pSillTbl = pfont->getTable(TtfUtil::TableIdTag(ktiSill), &cbSillSz)) ? kresOk : kresFail;
+ fOk = pSillTbl && (cbSillSz == 0 || TtfUtil::CheckTable(ktiSill, pSillTbl, cbSillSz));
+ }
+ catch (...)
+ {
+ fOk = true;
+ pSillTbl = NULL;
+ }
+ // if table couldn't be loaded, this is not disastrous.
+
+// ibGlocStart = cbGlatTbl;
+ fOk = CheckTableVersions(&grstrm,
+ (byte *)pSilfTbl, 0,
+ (byte *)pGlocTbl, 0,
+ (byte *)pFeatTbl, 0,
+ &m_fxdBadVersion);
+ if (!fOk)
+ {
+// wchar_t rgch1[50];
+// wchar_t rgch2[50];
+//#if defined(_WIN32)
+// // This version does not work in Windows, in spite of being documented:
+// // swprintf(rgch, 50, L"%d", (m_fxdBadVersion >> 16));
+// // Removing the size argument make it work.
+// swprintf(rgch1, L"%d", (m_fxdBadVersion >> 16));
+// swprintf(rgch2, L"%d", (m_fxdBadVersion & 0x0000FFFF));
+//#else
+// swprintf(rgch1, 50, L"%d", (m_fxdBadVersion >> 16));
+// swprintf(rgch2, 50, L"%d", (m_fxdBadVersion & 0x0000FFFF));
+//#endif
+ char rgch[50]; // more than enough space to print two 16-bit ints
+ char *pch = &rgch[0];
+ sprintf(rgch, "%d.%d", (m_fxdBadVersion >> 16), (m_fxdBadVersion & 0x0000FFFF));
+ std::wstring stu = L"unsupported version (";
+ //stu.append(rgch1);
+ //stu.append(L".");
+ //stu.append(rgch2);
+ while (*pch != 0)
+ stu.push_back((wchar_t)*pch++);
+ stu.append(L") of Graphite tables");
+ m_stuInitError.assign(stu.c_str());
+ m_ferr = kferrBadVersion;
+ goto LUnexpected;
+ }
+
+ try
+ {
+ // Parse the "Silf" table.
+ grstrm.OpenBuffer((byte*)pSilfTbl, cbSilfSz);
+ int chwGlyphIDMax, fxdVersion;
+ bool f = ReadSilfTable(grstrm, 0, 0, &chwGlyphIDMax, &fxdVersion);
+ grstrm.Close();
+ if (!f)
+ {
+ m_ferr = kferrReadSilfTable;
+ fexptn.errorCode = m_ferr;
+ throw fexptn;
+ }
+
+ // Parse the "Gloc" and "Glat" tables.
+ {
+ GrBufferIStream grstrmGlat;
+
+ grstrm.OpenBuffer((byte *)pGlocTbl, cbGlocSz);
+ grstrmGlat.OpenBuffer((byte *)pGlatTbl, cbGlatSz);
+ f = ReadGlocAndGlatTables(grstrm, 0, grstrmGlat, 0, chwGlyphIDMax, fxdVersion);
+ grstrm.Close();
+ grstrmGlat.Close();
+ if (!f)
+ {
+ m_ferr = kferrReadGlocGlatTable;
+ fexptn.errorCode = m_ferr;
+ throw fexptn;
+ }
+ }
+
+ // Parse the "Feat" table.
+ grstrm.OpenBuffer((byte *)pFeatTbl, cbFeatSz);
+ f = ReadFeatTable(grstrm, 0);
+ grstrm.Close();
+ if (!f)
+ {
+ m_ferr = kferrReadFeatTable;
+ fexptn.errorCode = m_ferr;
+ throw fexptn;
+ }
+
+ // Parse the "Sill" table.
+ if (pSillTbl)
+ {
+ grstrm.OpenBuffer((byte *)pSillTbl, cbFeatSz);
+ f = ReadSillTable(grstrm, 0);
+ grstrm.Close();
+ if (!f)
+ {
+ m_ferr = kferrReadSillTable;
+ fexptn.errorCode = m_ferr;
+ throw fexptn;
+ }
+ }
+ else
+ m_langtbl.CreateEmpty();
+ }
+ catch (...)
+ {
+ fSilf = false;
+ m_resFontRead = kresUnexpected;
+ try {
+ DestroyContents(false);
+ }
+ catch (...)
+ {}
+ goto LUnexpected;
+ }
+
+ m_stuErrCtrlFile.erase();
+ m_nFontCheckSum = nCheckSum;
+ m_resFontRead = kresOk;
+ m_ferr = kferrOkay;
+ ReturnResult(kresOk);
+
+LUnexpected:
+ // Don't do this, because it is possible to use a base font with an empty Graphite
+ // engine:
+ //if (m_fUseSepBase || m_stuBaseFaceName.Length() > 0)
+ //{
+ // SwitchGraphicsFont(pgg, false); // back to Graphite table font
+ // m_stuBaseFaceName.erase();
+ // m_fUseSepBase = false;
+ //}
+
+ CreateEmpty();
+ m_nFontCheckSum = nCheckSum;
+ if (!fBasicTables)
+ m_resFontRead = kresFail; // bad font
+ else if (!fSilf)
+ m_resFontRead = kresFalse; // no Silf table--not a Graphite font
+ else
+ m_resFontRead = kresUnexpected; // couldn't read the Graphite tables
+
+ fexptn.errorCode = m_ferr;
+ fexptn.version = m_fxdBadVersion >> 16;
+ fexptn.subVersion = m_fxdBadVersion & 0x0000FFFF;
+ throw fexptn;
+
+ ReturnResult(m_resFontRead);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Read the cmap and name tables.
+
+ This is called from two places. One is when we first initialize the engine. Also, if the
+ font tables have not been actually copied from the font, they may have been deleted
+ when the font was deleted. So when reusing the engine, set them to something valid based
+ on the current font.
+----------------------------------------------------------------------------------------------*/
+bool GrEngine::SetCmapAndNameTables(Font * pfont)
+{
+ GrResult res = kresOk;
+ bool fOk;
+ const void * pCmapTbl;
+ const void * pNameTbl;
+ size_t cbCmapSz, cbNameSz;
+
+ // cmap
+ if (!m_fCmapTblCopy)
+ {
+ res = (pCmapTbl = pfont->getTable(TtfUtil::TableIdTag(ktiCmap), &cbCmapSz)) ? kresOk : kresFail;
+ fOk = pCmapTbl && (cbCmapSz == 0 || TtfUtil::CheckTable(ktiCmap, pCmapTbl, cbCmapSz));
+ if (!fOk)
+ {
+ m_stuInitError = L"could not locate cmap table";
+ m_ferr = kferrFindCmapTable;
+ return false;
+ }
+
+ if (pCmapTbl && cbCmapSz > 0)
+ {
+ // Make a private copy of the cmap for the engine's use.
+ m_pCmapTbl = new byte[cbCmapSz];
+ std::copy(reinterpret_cast<const byte*>(pCmapTbl),
+ reinterpret_cast<const byte*>(pCmapTbl) + cbCmapSz, m_pCmapTbl);
+ m_fCmapTblCopy = true;
+ m_cbCmapTbl = cbCmapSz;
+ }
+ else
+ {
+ m_pCmapTbl = const_cast<byte*>(reinterpret_cast<const byte*>(pCmapTbl));
+ m_fCmapTblCopy = false;
+ }
+
+ // MS Unicode cmap
+ m_pCmap_3_1 = TtfUtil::FindCmapSubtable(m_pCmapTbl, 3, 1);
+ m_pCmap_3_10 = TtfUtil::FindCmapSubtable(m_pCmapTbl, 3, 10);
+ if (!m_pCmap_3_1)
+ m_pCmap_3_1 = TtfUtil::FindCmapSubtable(m_pCmapTbl, 3, 0);
+ if (!m_pCmap_3_1)
+ {
+ m_stuInitError = L"failure to load cmap subtable";
+ m_ferr = kferrLoadCmapSubtable;
+ return false;
+ }
+ if (!TtfUtil::CheckCmap31Subtable(m_pCmap_3_1))
+ {
+ m_stuInitError = L"checking cmap subtable failed";
+ m_ferr = kferrCheckCmapSubtable;
+ return false;
+ }
+ }
+ else
+ {
+ Assert(m_pCmapTbl);
+ }
+
+ // name table - eventually need feature label strings
+
+ // Currently the only stuff we're getting from the name table are our feature names,
+ // so use the version from the Graphite font (not the base font if any).
+ //////if (m_fUseSepBase)
+ ////// pgg->SetupGraphics(&chrpOriginal);
+
+ if (!m_fNameTblCopy)
+ {
+ res = (pNameTbl = (byte *)pfont->getTable(TtfUtil::TableIdTag(ktiName), &cbNameSz)) ? kresOk : kresFail;
+ fOk = pNameTbl && (cbNameSz == 0 || TtfUtil::CheckTable(ktiName, pNameTbl, cbNameSz));
+ if (!fOk)
+ {
+ m_stuInitError = L"could not locate name table";
+ m_ferr = kferrFindNameTable;
+ return false;
+ }
+
+ if (pNameTbl && cbNameSz > 0)
+ {
+ // Make a private copy of the name table for the engine's use.
+ m_pNameTbl = new byte[cbNameSz];
+ std::copy(reinterpret_cast<const byte*>(pNameTbl),
+ reinterpret_cast<const byte*>(pNameTbl) + cbNameSz, m_pNameTbl);
+ m_fNameTblCopy = true;
+ m_cbNameTbl = cbNameSz;
+ }
+ else
+ {
+ m_pNameTbl = const_cast<byte*>(reinterpret_cast<const byte*>(pNameTbl));
+ m_fNameTblCopy = false;
+ }
+ }
+ else
+ {
+ Assert(m_pNameTbl);
+ }
+
+ return true;
+}
+
+
+//void FontFace::DbgCheckFontFace()
+//{
+// Assert(m_cfonts < 5000);
+// Assert(m_cfonts >= 0);
+// wchar_t chw0 = m_pgreng->m_stuFaceName[0];
+// Assert(chw0 >= 0x0040); // A
+// Assert(chw0 <= 0x007A); // z
+//}
+
+} // namespace gr
+
+//:End Ignore
diff --git a/Build/source/libs/graphite/src/segment/FontFace.h b/Build/source/libs/graphite/src/segment/FontFace.h
new file mode 100644
index 00000000000..7f2684a5908
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/FontFace.h
@@ -0,0 +1,246 @@
+/*--------------------------------------------------------------------
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: FontFace.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Contains the definition of the FontFace class.
+ TODO: Merge with GrEngine.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef FONTFACE_INCLUDED
+#define FONTFACE_INCLUDED
+#include <limits>
+
+#ifdef _MSC_VER
+#include <crtdbg.h>
+#endif
+
+namespace gr
+{
+
+class IGrJustifier;
+class Segment;
+
+
+/*----------------------------------------------------------------------------------------------
+ The GrEngine serves as the top level object that knows how to run Graphite tables
+ and generate Graphite segments.
+
+ Primarily, this class implements IRenderEngine, which allows it to serve as a FW
+ rendering engine. It also implements ISimpleInit, a general interface for initializing
+ using a string. Finally, it implements ITraceControl, a very simple interface which
+ allows a client to flip a flag indicating whether or not we want to output a log of
+ the Graphite transduction process.
+
+ Hungarian: greng
+----------------------------------------------------------------------------------------------*/
+class FontFace
+{
+ friend class gr::FontMemoryUsage;
+
+public:
+ FontFace()
+ {
+ m_cfonts = 0;
+ }
+
+ ~FontFace()
+ {
+ if (s_pFontCache)
+ s_pFontCache->RemoveFontFace(m_pgreng->FaceName(), m_pgreng->Bold(), m_pgreng->Italic());
+ delete m_pgreng;
+ }
+
+ void IncFontCount()
+ {
+ m_cfonts++;
+ }
+ void DecFontCount()
+ {
+ m_cfonts--;
+ if (m_cfonts <= 0 && (s_pFontCache == NULL || s_pFontCache->GetFlushMode() == kflushAuto))
+ delete this;
+ }
+
+ bool NoFonts()
+ {
+ return (m_cfonts <= 0);
+ }
+
+ static FontFace * GetFontFace(Font * pfont,
+ std::wstring strFaceName, bool fBold, bool fItalic,
+ bool fDumbFallback = false);
+
+ GrResult InitFontFace(Font * pfont,
+ std::wstring stuFaceName, bool fBold, bool fItalic,
+ bool fDumbLayout);
+
+ FontErrorCode IsValidForGraphite(int * pnVersion, int * pnSubVersion)
+ {
+ return m_pgreng->IsValidForGraphite(pnVersion, pnSubVersion);
+ }
+
+ static void ZapFontCache()
+ {
+ if (s_pFontCache)
+ {
+ s_pFontCache->AssertEmpty();
+ delete s_pFontCache;
+ }
+ s_pFontCache = NULL;
+ }
+
+ static void SetFlushMode(int flush)
+ {
+ if (s_pFontCache == NULL)
+ s_pFontCache = new FontCache;
+ s_pFontCache->SetFlushMode(flush);
+ }
+ static int GetFlushMode()
+ {
+ if (s_pFontCache == NULL)
+ s_pFontCache = new FontCache;
+ return s_pFontCache->GetFlushMode();
+ }
+
+ // Temporary, until interface gets thoroughly reworked:
+ GrEngine * GraphiteEngine()
+ {
+ return m_pgreng;
+ }
+
+ // Feature access:
+ size_t NumberOfFeatures()
+ {
+ return m_pgreng->NumberOfFeatures_ff();
+ }
+ featid FeatureID(size_t ifeat)
+ {
+ return m_pgreng->FeatureID_ff(ifeat);
+ }
+ size_t FeatureWithID(featid id)
+ {
+ return m_pgreng->FeatureWithID_ff(id);
+ }
+ bool GetFeatureLabel(size_t ifeat, lgid language, utf16 * label)
+ {
+ return m_pgreng->GetFeatureLabel_ff(ifeat, language, label);
+ }
+ int GetFeatureDefault(size_t ifeat) // index of default setting
+ {
+ return m_pgreng->GetFeatureDefault_ff(ifeat);
+ }
+ size_t NumberOfSettings(size_t ifeat)
+ {
+ return m_pgreng->NumberOfSettings_ff(ifeat);
+ }
+ int GetFeatureSettingValue(size_t ifeat, size_t ifset)
+ {
+ return m_pgreng->GetFeatureSettingValue_ff(ifeat, ifset);
+ }
+ bool GetFeatureSettingLabel(size_t ifeat, size_t ifset, lgid language, utf16 * label)
+ {
+ return m_pgreng->GetFeatureSettingLabel_ff(ifeat, ifset, language, label);
+ }
+ // Feature-label language access:
+ size_t NumberOfFeatLangs()
+ {
+ return m_pgreng->NumberOfFeatLangs_ff();
+ }
+ short FeatLabelLang(int ilang)
+ {
+ return m_pgreng->GetFeatLabelLang_ff(ilang);
+ }
+ // Language access:
+ size_t NumberOfLanguages()
+ {
+ return m_pgreng->NumberOfLanguages_ff();
+ }
+ isocode LanguageCode(size_t ilang)
+ {
+ return m_pgreng->GetLanguageCode_ff(ilang);
+ }
+
+ // Script Direction access:
+ ScriptDirCode ScriptDirection() const throw()
+ {
+ unsigned int script_dirs = 0;
+ OLECHAR err_dummy = 0;
+ m_pgreng->get_ScriptDirection(&script_dirs, &err_dummy, 1);
+ return ScriptDirCode(script_dirs);
+ }
+
+ bool BadFont(FontErrorCode * pferr = NULL)
+ {
+ return m_pgreng->BadFont(pferr);
+ }
+ bool DumbFallback(FontErrorCode * pferr = NULL)
+ {
+ return m_pgreng->DumbFallback(pferr);
+ }
+
+public:
+ // For use in segment creation:
+ void RenderLineFillSegment(Segment * pseg, Font * pfont, ITextSource * pts,
+ LayoutEnvironment & layout,
+ toffset ichStart, toffset ichStop, float xsMaxWidth, bool fBacktracking)
+ {
+ m_pgreng->MakeSegment(pseg, pfont, pts, NULL, layout,
+ ichStart, ichStop, xsMaxWidth, fBacktracking, false, 0, kestMoreLines);
+ }
+ void RenderRangeSegment(Segment * pseg, Font * pfont,
+ ITextSource * pts, LayoutEnvironment & layout,
+ toffset ichStart, toffset ichStop)
+ {
+ m_pgreng->MakeSegment(pseg, pfont, pts, NULL, layout,
+ ichStart, ichStop, kPosInfFloat, false, false, 0, kestMoreLines);
+ }
+ void RenderJustifiedSegment(Segment * pseg, Font * pfont,
+ ITextSource * pts, LayoutEnvironment & layout,
+ toffset ichStart, toffset ichStop, float xsCurrentWidth, float xsDesiredWidth)
+ {
+ m_pgreng->MakeSegment(pseg, pfont, pts, NULL, layout,
+ ichStart, ichStop, xsCurrentWidth, false, true, xsDesiredWidth, kestMoreLines);
+ }
+
+ // Debugging.
+ //static bool DbgCheckFontCache()
+ //{
+ // if (s_pFontCache)
+ // return s_pFontCache->DbgCheckFontCache();
+ // else
+ // return true;
+ //}
+ //void DbgCheckFontFace();
+
+ static void calculateAllMemoryUsage(FontMemoryUsage & fmu);
+ void calculateMemoryUsage(FontMemoryUsage & fmu);
+
+protected:
+ // Number of fonts in existence that use this face; when it goes to zero, delete.
+ int m_cfonts;
+
+ // Static variable:
+ static FontCache * s_pFontCache;
+
+ // Member variables:
+ GrEngine * m_pgreng;
+};
+
+} // namespace gr
+
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+
+#endif // !FONTFACE_INCLUDED
diff --git a/Build/source/libs/graphite/src/segment/GrCharStream.cpp b/Build/source/libs/graphite/src/segment/GrCharStream.cpp
new file mode 100644
index 00000000000..20b5a46ab76
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrCharStream.cpp
@@ -0,0 +1,652 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrCharStream.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Implements the GrCharStream class.
+----------------------------------------------------------------------------------------------*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:End Ignore
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Constructor.
+----------------------------------------------------------------------------------------------*/
+GrCharStream::GrCharStream(ITextSource * pgts, int ichrMin, int ichrLim,
+ bool fStartLine, bool fEndLine)
+ : m_pgts(pgts),
+ m_ichrMin(ichrMin),
+ m_ichrLim(ichrLim),
+ m_ichrPos(ichrMin),
+ m_fStartLine(fStartLine),
+ m_fEndLine(fEndLine),
+ m_cchrBackedUp(0),
+ m_ichrRunMin(0),
+ m_ichrRunLim(0),
+ m_ichlRunOffset(kPosInfinity),
+ m_ichrRunOffset(kPosInfinity)
+{
+ #if 0 // ??? surely m_cnRunMax and m_prgnRunText are undefined at this point
+ if (m_cchlRunMax > -1)
+ delete[] m_prgchlRunText;
+ #endif
+ m_cchlRunMax = -1;
+ m_prgchlRunText = NULL;
+
+ m_vislotNextChunkMap.clear();
+
+ m_utf = m_pgts->utfEncodingForm();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Restart the stream when an error has a occurred and we need to fall back to dumb rendering.
+----------------------------------------------------------------------------------------------*/
+void GrCharStream::Restart()
+{
+ if (m_cchlRunMax > -1)
+ delete[] m_prgchlRunText;
+
+ m_ichrPos = m_ichrMin;
+ m_cchrBackedUp = 0;
+ m_ichrRunMin = 0;
+ m_ichrRunLim = 0;
+ m_ichlRunOffset = kPosInfinity;
+ m_ichrRunOffset = kPosInfinity;
+
+ m_cchlRunMax = -1;
+ m_prgchlRunText = NULL;
+
+ m_vislotNextChunkMap.clear();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the next character from the stream.
+
+ @param pichwSegOffset - index of this character from the beginning of the segment
+ @param pcchRaw - number of raw (UTF-16 or UTF-8) chars consumed to get one complete
+ Unicode codepoint.
+----------------------------------------------------------------------------------------------*/
+int GrCharStream::NextGet(GrTableManager * ptman,
+ GrFeatureValues * pfval, int * pichrSegOffset, int * pcchr)
+{
+ if (AtEnd())
+ {
+ Assert(m_ichrPos == m_ichrLim);
+ return 0;
+ }
+
+ int m_ichrMinBackedUp = m_ichrMin - m_cchrBackedUp;
+
+ if ((m_ichrRunOffset + m_ichrRunMin) >= m_ichrRunLim)
+ {
+ // Get the next run of characters
+
+ std::pair<toffset, toffset> pairRange = m_pgts->propertyRange(m_ichrPos);
+ m_ichrRunMin = pairRange.first;
+ m_ichrRunLim = pairRange.second;
+
+ // The only time the run extends before what we want is on the first run.
+ Assert((m_ichrRunMin == m_ichrPos) // m_ichwPos is beginning of run
+ || (m_ichrPos == m_ichrMinBackedUp)); // first run
+ // Pretend like the run starts where we need it:
+ m_ichrRunMin = max(m_ichrRunMin, m_ichrMinBackedUp);
+ Assert(m_ichrRunMin == m_ichrPos);
+
+ if (m_cchlRunMax != -1 && m_cchlRunMax < m_ichrRunLim - m_ichrRunMin)
+ {
+ // Text buffer is too small: delete it and create a new one.
+ delete[] m_prgchlRunText;
+ m_cchlRunMax = -1;
+ }
+
+ if (m_cchlRunMax == -1)
+ {
+ // Note that combining surrogates or UTF-8 will always result in the same or fewer
+ // number of characters needed in m_prgchlRunText, so the following is safe:
+ m_cchlRunMax = m_ichrRunLim - m_ichrRunMin;
+ m_prgchlRunText = new int[m_cchlRunMax];
+ }
+
+ utf32 * prgchlRunText32 = NULL;
+ utf16 * prgchwRunText16 = NULL;
+ utf8 * prgchsRunText8 = NULL;
+
+ int cchGot;
+ switch (m_utf)
+ {
+ case kutf8:
+ prgchsRunText8 = new utf8[m_ichrRunLim - m_ichrRunMin];
+ cchGot = m_pgts->fetch(m_ichrRunMin, m_ichrRunLim - m_ichrRunMin, prgchsRunText8);
+ break;
+ case kutf16:
+ prgchwRunText16 = new utf16[m_ichrRunLim - m_ichrRunMin];
+ cchGot = m_pgts->fetch(m_ichrRunMin, m_ichrRunLim - m_ichrRunMin, prgchwRunText16);
+ break;
+ default:
+ Assert(false);
+ // Assume UTF-32: fall through
+ case kutf32:
+ prgchlRunText32 = new utf32[m_ichrRunLim - m_ichrRunMin];
+ cchGot = m_pgts->fetch(m_ichrRunMin, m_ichrRunLim - m_ichrRunMin, prgchlRunText32);
+ break;
+ }
+
+ int ichlUtf32 = 0;
+ for (int ichr = 0; ichr < m_ichrRunLim - m_ichrRunMin; ichr++)
+ {
+ if (ichr == m_ichrPos - m_ichrRunMin)
+ {
+ m_ichrRunOffset = ichr;
+ m_ichlRunOffset = ichlUtf32;
+ }
+ Assert(m_ichrRunOffset != kPosInfinity || ichr < m_ichrPos - m_ichrRunMin);
+
+ int cchrUsed;
+ switch (m_utf)
+ {
+ case kutf8:
+ m_prgchlRunText[ichlUtf32] = Utf8ToUtf32(prgchsRunText8 + ichr,
+ m_ichrRunLim - m_ichrRunMin - ichr, &cchrUsed);
+ break;
+ case kutf16:
+ m_prgchlRunText[ichlUtf32] = Utf16ToUtf32(prgchwRunText16 + ichr,
+ m_ichrRunLim - m_ichrRunMin - ichr, &cchrUsed);
+ break;
+ default:
+ Assert(false);
+ // Assume UTF-32: fall through
+ case kutf32:
+ m_prgchlRunText[ichlUtf32] = prgchlRunText32[ichlUtf32];
+ cchrUsed = 1;
+ break;
+ }
+
+ m_vislotNextChunkMap.push_back(ichlUtf32);
+ for (int i = 1; i < cchrUsed; i++)
+ m_vislotNextChunkMap.push_back(-1);
+ ichr += cchrUsed - 1;
+ ichlUtf32++;
+ }
+ delete[] prgchlRunText32;
+ delete[] prgchwRunText16;
+ delete[] prgchsRunText8;
+
+ while (m_ichrLim - m_ichrRunMin < signed(m_vislotNextChunkMap.size())
+ && m_vislotNextChunkMap[m_ichrLim - m_ichrRunMin] == -1)
+ {
+ // Invalid surrogate boundary; this is really a bug in the application program,
+ // but adjust here to avoid a crash!
+ m_ichrLim--;
+ }
+
+ SetUpFeatureValues(ptman, m_ichrPos);
+
+ Assert(m_ichrRunOffset >= 0);
+ Assert(m_ichrRunOffset < m_ichrRunLim - m_ichrRunMin);
+ Assert(m_vislotNextChunkMap.size() == (unsigned) m_ichrRunLim - m_ichrMinBackedUp);
+ }
+
+ int chlRet = m_prgchlRunText[m_ichlRunOffset];
+ *pfval = m_fvalRunFeats;
+ *pichrSegOffset = m_ichrPos - m_ichrMin; // offset from the official start of the segment
+ // of the first 16-bit char
+ int ichrPosPrev = m_ichrPos;
+ ++m_ichlRunOffset;
+ do {
+ ++m_ichrPos;
+ ++m_ichrRunOffset;
+ } while (m_ichrPos - m_ichrMinBackedUp < signed(m_vislotNextChunkMap.size())
+ && m_vislotNextChunkMap[m_ichrPos - m_ichrMinBackedUp] == -1);
+
+ *pcchr = m_ichrPos - ichrPosPrev; // number of raw chars consumed
+ Assert(m_utf != kutf8 || *pcchr <= 6);
+ Assert(m_utf != kutf16 || *pcchr <= 2);
+
+ Assert(m_ichrPos == (m_ichrRunMin + m_ichrRunOffset));
+ Assert(m_ichrPos <= m_ichrLim);
+
+ /* KLUDGE for debugging
+ if (m_ichrPos == 1)
+ nRet = 0x1018;
+ else if (m_ichrPos == 2)
+ nRet = 0x1039;
+ else if (m_ichrPos == 3)
+ nRet = 0x101b;
+ else if (m_ichrPos == 4)
+ nRet = 0x1032;
+ else if (m_ichrPos == 5)
+ nRet = 0x1037;
+ else if (m_ichrPos == 6)
+ nRet = 0x1037;
+ */
+
+ return chlRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Convert UTF-8 to UTF-32--a single character's worth. Also pass back the number of 8-bit
+ items consumed.
+----------------------------------------------------------------------------------------------*/
+utf32 GrCharStream::Utf8ToUtf32(utf8 * prgchs, int cchs, int * pcchsUsed)
+{
+ if (cchs <= 0)
+ {
+ *pcchsUsed = 0;
+ return 0;
+ }
+
+ long chlRet = DecodeUtf8(prgchs, cchs, pcchsUsed);
+ Assert(chlRet > 0);
+ if (chlRet == -1)
+ {
+ // Some error occurred. Just treat the UTF-8 as UTF-32.
+ *pcchsUsed = 1;
+ return (utf32)prgchs[0];
+ }
+ else
+ return chlRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Convert UTF-16 to UTF-32--a single character's worth. Also pass back the number of 16-bit
+ items consumed.
+----------------------------------------------------------------------------------------------*/
+utf32 GrCharStream::Utf16ToUtf32(utf16 * prgchw, int cchw, int * pcchwUsed)
+{
+ if (cchw <= 0)
+ {
+ *pcchwUsed = 0;
+ return 0;
+ }
+
+ unsigned int nUtf32;
+ bool fSurrogate = FromSurrogatePair(prgchw[0], ((cchw < 2) ? 0 : prgchw[1]), &nUtf32);
+ *pcchwUsed = (fSurrogate) ? 2 : 1;
+ return (int)nUtf32;
+
+/*
+ // For testing:
+ int nCharRet;
+ if (cchw >= 2 && prgchw[0] == '^' && prgchw[1] == 'a')
+ {
+ nCharRet = 'A';
+ *pcchwUsed = 2;
+ }
+ else if (cchw >= 3 && prgchw[0] == '#' && prgchw[1] == '#' &&
+ prgchw[2] == 'B')
+ {
+ nCharRet = 'b';
+ *pcchwUsed = 3;
+ }
+ else if (cchw >= 1)
+ {
+ nCharRet = prgchw[0];
+ *pcchwUsed = 1;
+ }
+ else
+ {
+ nCharRet = 0;
+ *pcchwUsed = 0;
+ }
+ return nCharRet;
+*/
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if the given position is at the boundary of a Unicode character; return false
+ if it is between two parts of pair of surrogates.
+----------------------------------------------------------------------------------------------*/
+bool GrCharStream::AtUnicodeCharBoundary(ITextSource * pgts, int ichr)
+{
+ int cchr = pgts->getLength();
+ if (ichr <= 0 || ichr >= cchr)
+ return true;
+
+ UtfType utf = pgts->utfEncodingForm();
+
+ // Note that we never need more than a handful of characters.
+ int ichrMinGet = max(0, ichr - 1);
+ int ichrLimGet = ichr + 1;
+ utf16 rgchwText16[3];
+ utf8 rgchsText8[3];
+ bool fRet;
+ switch (utf)
+ {
+ case kutf8:
+ pgts->fetch(ichrMinGet, ichrLimGet - ichrMinGet, rgchsText8);
+ fRet = AtUnicodeCharBoundary(rgchsText8, ichrLimGet - ichrMinGet,
+ ichr - ichrMinGet, utf);
+ break;
+ case kutf16:
+ pgts->fetch(ichrMinGet, ichrLimGet - ichrMinGet, rgchwText16);
+ fRet = AtUnicodeCharBoundary(rgchwText16, ichrLimGet - ichrMinGet,
+ ichr - ichrMinGet, utf);
+ break;
+ default:
+ Assert(false);
+ case kutf32:
+ fRet = true;
+ break;
+ }
+
+ return fRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if the given position is at the boundary of a Unicode character; return false
+ if it is between two parts of pair of surrogates.
+----------------------------------------------------------------------------------------------*/
+bool GrCharStream::AtUnicodeCharBoundary(utf16 * prgchw, int cchw, int ichr, UtfType utf)
+{
+ Assert(ichr >= 0);
+ Assert(ichr <= cchw);
+
+ if (ichr == 0)
+ return true;
+ if (ichr >= cchw)
+ return true;
+
+ switch (utf)
+ {
+ case kutf16:
+ {
+ unsigned int nUtf32;
+ bool fMiddleOfPair = FromSurrogatePair(prgchw[ichr - 1], prgchw[ichr], &nUtf32);
+ return !fMiddleOfPair;
+ }
+ case kutf8:
+ {
+ // 16-bit buffer being treated like UTF-8.
+ utf8 rgchs[2];
+ rgchs[1] = (utf8)prgchw[ichr];
+ return AtUnicodeCharBoundary(rgchs, 2, 1, kutf8);
+ }
+ case kutf32:
+ default:
+ return true;
+ }
+
+/*
+ // temp stuff for debugging:
+ if (ichr > 0 && cchw >= 1 && prgchw[ichr-1] == '^' && prgchw[ichr] == 'a')
+ {
+ return false;
+ }
+ if (ichr > 0 && cchw >= 2 && prgchw[ichr-1] == '#' && prgchw[ichr] == '#' &&
+ prgchw[ichr+1] == 'B')
+ {
+ return false;
+ }
+ if (ichr > 1 && cchw >= 1 && prgchw[ichr-2] == '#' && prgchw[ichr-1] == '#' &&
+ prgchw[ichr] == 'B')
+ {
+ return false;
+ }
+
+ return true;
+*/
+}
+
+bool GrCharStream::AtUnicodeCharBoundary(utf8 * prgchs, int cchs, int ichs, UtfType utf)
+{
+ Assert(ichs >= 0);
+ Assert(ichs <= cchs);
+
+ Assert(utf == kutf8);
+
+ if (ichs == 0)
+ return true;
+ if (ichs >= cchs)
+ return true;
+
+ if (cchs == 0)
+ return true;
+
+ // A bit pattern of 10xxxxxx indicates a continuation of a sequence
+ // (11xxxxxx means the first byte of a sequence, 0xxxxxxx means a single character).
+
+ utf8 chsTest = prgchs[ichs] & 0xC0;
+ return (chsTest != 0x80);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Convert the given pair of characters into a single 32-bit Unicode character. Return
+ true if they are a legitimate surrogate pair. If not, just return the first of the
+ two 16-bit characters.
+----------------------------------------------------------------------------------------------*/
+bool GrCharStream::FromSurrogatePair(utf16 chwIn1, utf16 chwIn2, unsigned int * pchlOut)
+{
+ if ((chwIn1 < kzUtf16HighFirst) || (chwIn1 > kzUtf16HighLast)
+ || (chwIn2 < kzUtf16LowFirst) || (chwIn2 > kzUtf16LowLast))
+ {
+ // Not a surrogate
+ *pchlOut = (unsigned int)chwIn1;
+ return false;
+ }
+ else
+ {
+ *pchlOut = ((chwIn1 - kzUtf16HighFirst) << kzUtf16Shift) + chwIn2 + kzUtf16Inc;
+ return true;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Decode 1-6 bytes in the character string from UTF-8 format to Unicode (UCS-4).
+ As a side-effect, cbOut is set to the number of UTF-8 bytes consumed.
+
+ @param rgchUtf8 Pointer to a a character array containing UTF-8 data.
+ @param cchUtf8 Number of characters in the array.
+ @param cbOut Reference to an integer for holding the number of input (8-bit) characters
+ consumed to produce the single output Unicode character.
+
+ @return A single Unicode (UCS-4) character. If an error occurs, return -1.
+----------------------------------------------------------------------------------------------*/
+long GrCharStream::DecodeUtf8(const utf8 * rgchUtf8, int cchUtf8, int * pcbOut)
+{
+ // check for valid input
+ AssertArray(rgchUtf8, cchUtf8);
+ if ((cchUtf8 == 0) || (rgchUtf8[0] == '\0'))
+ {
+ *pcbOut = (cchUtf8) ? 1 : 0;
+ return 0;
+ }
+ //
+ // decode the first byte of the UTF-8 sequence
+ //
+ long lnUnicode;
+ int cbExtra;
+ int chsUtf8 = *rgchUtf8++ & 0xFF;
+ if (chsUtf8 >= kzUtf8Flag6) // 0xFC
+ {
+ lnUnicode = chsUtf8 & kzUtf8Mask6;
+ cbExtra = 5;
+ }
+ else if (chsUtf8 >= kzUtf8Flag5) // 0xF8
+ {
+ lnUnicode = chsUtf8 & kzUtf8Mask5;
+ cbExtra = 4;
+ }
+ else if (chsUtf8 >= kzUtf8Flag4) // 0xF0
+ {
+ lnUnicode = chsUtf8 & kzUtf8Mask4;
+ cbExtra = 3;
+ }
+ else if (chsUtf8 >= kzUtf8Flag3) // 0xE0
+ {
+ lnUnicode = chsUtf8 & kzUtf8Mask3;
+ cbExtra = 2;
+ }
+ else if (chsUtf8 >= kzUtf8Flag2) // 0xC0
+ {
+ lnUnicode = chsUtf8 & kzUtf8Mask2;
+ cbExtra = 1;
+ }
+ else // 0x00
+ {
+ lnUnicode = chsUtf8;
+ cbExtra = 0;
+ }
+ if (cbExtra >= cchUtf8)
+ {
+ return -1;
+ }
+
+ switch (cbExtra)
+ {
+ case 5:
+ lnUnicode <<= kzUtf8ByteShift;
+ chsUtf8 = *rgchUtf8++ & 0xFF;
+ if ((chsUtf8 & ~kzByteMask) != 0x80)
+ return -1;
+ lnUnicode += chsUtf8 & kzByteMask;
+ // fall through
+ case 4:
+ lnUnicode <<= kzUtf8ByteShift;
+ chsUtf8 = *rgchUtf8++ & 0xFF;
+ if ((chsUtf8 & ~kzByteMask) != 0x80)
+ return -1;
+ lnUnicode += chsUtf8 & kzByteMask;
+ // fall through
+ case 3:
+ lnUnicode <<= kzUtf8ByteShift;
+ chsUtf8 = *rgchUtf8++ & 0xFF;
+ if ((chsUtf8 & ~kzByteMask) != 0x80)
+ return -1;
+ lnUnicode += chsUtf8 & kzByteMask;
+ // fall through
+ case 2:
+ lnUnicode <<= kzUtf8ByteShift;
+ chsUtf8 = *rgchUtf8++ & 0xFF;
+ if ((chsUtf8 & ~kzByteMask) != 0x80)
+ return -1;
+ lnUnicode += chsUtf8 & kzByteMask;
+ // fall through
+ case 1:
+ lnUnicode <<= kzUtf8ByteShift;
+ chsUtf8 = *rgchUtf8++ & 0xFF;
+ if ((chsUtf8 & ~kzByteMask) != 0x80)
+ return -1;
+ lnUnicode += chsUtf8 & kzByteMask;
+ break;
+ case 0:
+ // already handled
+ break;
+ default:
+ Assert(false);
+ }
+ if ((unsigned long)lnUnicode > kzUnicodeMax)
+ {
+ return -1;
+ }
+ *pcbOut = cbExtra + 1;
+ return lnUnicode;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the current feature values and character properties from the stream.
+----------------------------------------------------------------------------------------------*/
+void GrCharStream::CurrentFeatures(GrTableManager * ptman, GrFeatureValues * pfval)
+{
+ if (m_ichrRunOffset == kPosInfinity)
+ {
+ // Not yet set up.
+ if (AtEnd())
+ {
+ // Empty stream; no valid values.
+ Assert(false);
+ return;
+ }
+
+ // Get the settings from the first character.
+ int ichrSegOffset;
+ int ichrPosSave = m_ichrPos;
+ int ichrRunOffsetSave = m_ichrRunOffset;
+ int ichlRunOffsetSave = m_ichlRunOffset;
+ int cMapSize = m_vislotNextChunkMap.size();
+ int cchrConsumed;
+ NextGet(ptman, pfval, &ichrSegOffset, &cchrConsumed);
+ // Put the character back.
+ m_ichrPos = ichrPosSave;
+ m_ichrRunOffset = ichrRunOffsetSave;
+ m_ichlRunOffset = ichlRunOffsetSave;
+ while (signed(m_vislotNextChunkMap.size()) > cMapSize)
+ m_vislotNextChunkMap.pop_back();
+ }
+ else
+ {
+ *pfval = m_fvalRunFeats;
+ //*ppchrp = &m_chrpRun;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Read the feature settings from the text properties.
+
+ Eventually, handle style index here?
+----------------------------------------------------------------------------------------------*/
+void GrCharStream::SetUpFeatureValues(GrTableManager * ptman, int ichr)
+{
+ // Set all the features to their default values.
+ for (int i = 0; i < kMaxFeatures; ++i)
+ {
+ m_fvalRunFeats.m_rgnFValues[i] = ptman->DefaultForFeatureAt(i);
+ }
+ m_fvalRunFeats.m_nStyleIndex = 0;
+
+ // Add in the defaults for the language of the text.
+ std::vector<featid> vnFeats;
+ std::vector<int> vnValues;
+ isocode lgcode = m_pgts->getLanguage(ichr);
+ ptman->DefaultsForLanguage(lgcode, vnFeats, vnValues);
+ size_t ifeatLp;
+ int ifeat;
+ for (ifeatLp = 0; ifeatLp < vnFeats.size(); ifeatLp++)
+ {
+ ptman->FeatureWithID(vnFeats[ifeatLp], &ifeat);
+ m_fvalRunFeats.m_rgnFValues[ifeat] = vnValues[ifeatLp];
+ }
+
+ // Add in the explicit feature settings.
+ FeatureSetting rgfset[kMaxFeatures];
+ int cfeat = m_pgts->getFontFeatures(ichr, rgfset);
+
+ for (ifeatLp = 0; ifeatLp < (size_t)cfeat; ifeatLp++)
+ {
+ ptman->FeatureWithID(rgfset[ifeatLp].id, &ifeat);
+ if (ifeat >= 0)
+ m_fvalRunFeats.m_rgnFValues[ifeat] = rgfset[ifeatLp].value;
+ }
+}
+
+} // namespace gr
diff --git a/Build/source/libs/graphite/src/segment/GrCharStream.h b/Build/source/libs/graphite/src/segment/GrCharStream.h
new file mode 100644
index 00000000000..892435d376e
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrCharStream.h
@@ -0,0 +1,183 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999 - 2008 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrCharStream.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+
+
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GR_CHARSTREAM_INCLUDED
+#define GR_CHARSTREAM_INCLUDED
+
+//:End Ignore
+
+namespace gr
+{
+
+/*----------------------------------------------------------------------------------------------
+ Makes a stream out of a text string that is serving as input to the process.
+
+ Hungarian: chstrm
+----------------------------------------------------------------------------------------------*/
+class GrCharStream
+{
+public:
+ // Constructor and destructor:
+ GrCharStream(ITextSource * pgts, int ichrMin, int ichrLim,
+ bool fStartLine, bool fEndLine);
+
+ ~GrCharStream()
+ {
+ if (m_cchlRunMax >= 0)
+ delete[] m_prgchlRunText;
+ }
+
+ // Getters:
+ ITextSource * TextSrc() { return m_pgts; }
+ int Min() { return m_ichrMin; }
+ int Pos() { return m_ichrPos; }
+ int Lim() { return m_ichrLim; }
+ bool StartLine() { return m_fStartLine; }
+ bool EndLine() { return m_fEndLine; }
+
+ // offset from the beginning of the segment
+ int SegOffset() { return m_ichrPos - m_ichrMin; }
+ int SegOffset(int ichr) { return ichr - m_ichrMin; }
+
+ bool AtEnd()
+ {
+ return (m_ichrPos >= m_ichrLim);
+ }
+
+ // The input string is empty.
+ bool IsEmpty()
+ {
+ return (m_ichrLim - m_ichrMin == 0);
+ }
+
+ // When we are restarting in order to create a segment other than the first,
+ // back up the position in the stream slightly in order to reprocess a few characters
+ // before the line-break.
+ void Backup(int cchrToReprocess)
+ {
+ Assert(m_ichrPos >= cchrToReprocess);
+ m_ichrPos -= cchrToReprocess;
+ m_ichrRunOffset = kPosInfinity;
+ m_cchrBackedUp = cchrToReprocess;
+ }
+
+ // When we found a hard-break in the input stream, we need to put it back, and since
+ // we're done, we set the end of the stream to that position.
+ void HitHardBreak()
+ {
+ m_ichrPos -= 1;
+ m_ichrRunOffset -= 1;
+ m_ichrLim = m_ichrPos;
+ }
+
+ void Restart();
+
+ int NextGet(GrTableManager *, GrFeatureValues * pfval, int * ichrSegOffset, int * pcchr);
+
+ void CurrentFeatures(GrTableManager * ptman, GrFeatureValues * pfval);
+
+ // For transduction logging:
+ int GetLogData(GrTableManager * ptman, int * rgnChars, bool * rgfNewRun,
+ GrFeatureValues * rgfval, int cchwBackup,
+ int * pcchwMaxRaw);
+ void GetLogDataRaw(GrTableManager * ptman, int cchw, int cchwBackup,
+ int cchwMax16bit, int * prgnChars,
+ utf16 * prgchw2, utf16 * prgchw3, utf16 * prgchw4, utf16 * prgchw5, utf16 * prgchw6,
+ int * prgichwRaw);
+
+protected:
+ void SetUpFeatureValues(GrTableManager * ptman, int ichr);
+public:
+ static utf32 Utf8ToUtf32(utf8 * prgchs8bit, int cchs, int * pcchsUsed);
+ static utf32 Utf16ToUtf32(utf16 * prgchw16bit, int cchw, int * pcchwUsed);
+ bool AtUnicodeCharBoundary(int cchr)
+ {
+ return AtUnicodeCharBoundary(m_pgts, cchr);
+ }
+ static bool AtUnicodeCharBoundary(ITextSource * pgts, int ichr);
+ static bool AtUnicodeCharBoundary(utf8 * prgchs, int cchs, int ichs, UtfType utf);
+ static bool AtUnicodeCharBoundary(utf16 * prgchw, int cchw, int ichr, UtfType utf);
+ static bool FromSurrogatePair(utf16 chwIn1, utf16 chwIn2, unsigned int * pch32Out);
+ static long DecodeUtf8(const utf8 * rgchUtf8, int cchUtf8, int * pcbOut);
+
+protected:
+ // Instance variables:
+ // Hungarian note: chr = raw characters, chl = long characters (UTF-32)
+ // chs = short characters (UTF-8), chw = wide characters (UTF-16)
+ ITextSource * m_pgts; // string to render
+ UtfType m_utf; // what encoding form the text-source uses
+ int m_ichrMin; // official start of segment relative to beginning of string
+ int m_ichrLim; // end of stream (potential end of seg) relative to beginning of string
+ int m_ichrPos; // stream position (0 = start of string)
+ bool m_fStartLine; // true if a line-break character should be prepended
+ bool m_fEndLine; // true if a line-break character should be appended
+ int m_cchrBackedUp; // number of characters backed up before beginning of segment
+
+ // We read a run's worth of data at a time and cache it in the following variables:
+ int m_cchlRunMax; // size of buffer allocated
+ int * m_prgchlRunText; // buffer containing current run
+ int m_ichrRunMin; // start of run relative to beginning of string
+ int m_ichrRunLim; // end of run relative to beginning of string
+ int m_ichlRunOffset; // index into m_prgchlRunText; kPosInfinity if nothing set up
+ int m_ichrRunOffset; // corresponding index into text source
+ GrFeatureValues m_fvalRunFeats;
+
+ std::vector<int> m_vislotNextChunkMap; // maps from 16-bit chars to 32-bit chars & glyphs
+
+ enum
+ {
+ kzUtf8Mask1 = 0x7F,
+ kzUtf8Mask2 = 0x1F,
+ kzUtf8Mask3 = 0x0F,
+ kzUtf8Mask4 = 0x07,
+ kzUtf8Mask5 = 0x03,
+ kzUtf8Mask6 = 0x01
+ };
+
+ enum
+ {
+ kzUtf8Flag1 = 0x00,
+ kzUtf8Flag2 = 0xC0,
+ kzUtf8Flag3 = 0xE0,
+ kzUtf8Flag4 = 0xF0,
+ kzUtf8Flag5 = 0xF8,
+ kzUtf8Flag6 = 0xFC
+ };
+
+ enum
+ {
+ kzByteMask = 0x3F,
+ kzByteMark = 0x80,
+ kzUtf8ByteShift = 6,
+ kzUnicodeMax = 0x7FFFFFFF
+ };
+
+ enum
+ {
+ kzUtf16Shift = 10,
+ kzUtf16Inc = 0x2400,
+ kzUtf16HighFirst = 0xD800,
+ kzUtf16HighLast = 0xDBFF,
+ kzUtf16LowFirst = 0xDC00,
+ kzUtf16LowLast = 0xDFFF
+ };
+};
+
+} // namespace gr
+
+#endif // !GR_CHARSTREAM_INCLUDED
+
diff --git a/Build/source/libs/graphite/src/segment/GrClassTable.cpp b/Build/source/libs/graphite/src/segment/GrClassTable.cpp
new file mode 100644
index 00000000000..43316fdc04a
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrClassTable.cpp
@@ -0,0 +1,382 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrClassTable.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Implements the GrClassTable class and related classes.
+----------------------------------------------------------------------------------------------*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:End Ignore
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Fill in by reading from the file stream.
+----------------------------------------------------------------------------------------------*/
+bool GrClassTable::ReadFromFont(GrIStream & grstrm, int fxdVersion)
+{
+ long lClassMapStart;
+ grstrm.GetPositionInFont(&lClassMapStart);
+
+ // number of classes
+ m_ccls = grstrm.ReadUShortFromFont();
+ if (m_ccls >= kMaxReplcmtClasses)
+ return false; // bad table
+ if (fxdVersion < 0x00030000 && m_ccls > kMaxReplcmtClassesV1_2)
+ return false; // bad table
+
+ // number of linear classes
+ m_cclsLinear = grstrm.ReadUShortFromFont();
+ if (m_cclsLinear > m_ccls)
+ return false; // bad table
+
+ // class offsets
+ m_prgichwOffsets = new data16[m_ccls + 1];
+ gAssert(m_prgichwOffsets);
+ if (!m_prgichwOffsets)
+ return false; // bad table
+
+ data16 * pchw = m_prgichwOffsets;
+ int icls;
+ for (icls = 0; icls <= m_ccls; icls++, pchw++)
+ {
+ *pchw = grstrm.ReadUShortFromFont();
+ }
+
+ // Offsets are relative to the start class map; make them relative to the class list
+ // itself, and in terms of utf16s, not bytes.
+ long lClassesPos;
+ grstrm.GetPositionInFont(&lClassesPos);
+ int cbDiff = lClassesPos - lClassMapStart;
+ for (icls = 0; icls <= m_ccls; icls++)
+ {
+ m_prgichwOffsets[icls] = data16(int(m_prgichwOffsets[icls]) - cbDiff);
+ gAssert((m_prgichwOffsets[icls] & 0x00000001) == 0);
+ if ((m_prgichwOffsets[icls] & 0x00000001) != 0)
+ return false; // bad table
+ m_prgichwOffsets[icls] >>= 1; // divide by 2
+ }
+
+ // classes - slurp entire block (data remains in big-endian format)
+ m_prgchwBIGGlyphList = new data16[m_prgichwOffsets[m_ccls]];
+ gAssert(m_prgchwBIGGlyphList);
+ if (!m_prgchwBIGGlyphList)
+ return false; // bad table
+ grstrm.ReadBlockFromFont(m_prgchwBIGGlyphList,
+ m_prgichwOffsets[m_ccls] * isizeof(data16));
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set up an empty class table.
+----------------------------------------------------------------------------------------------*/
+void GrClassTable::CreateEmpty()
+{
+ // number of classes
+ m_ccls = 0;
+ // number of linear classes
+ m_cclsLinear = 0;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Search for the glyph ID using a fast binary search, and return the matching index.
+----------------------------------------------------------------------------------------------*/
+int GrInputClass::FindIndex(gid16 gid)
+{
+ int digixInit = InitialSearchRange();
+ int igixStart = StartSearch();
+#ifdef _DEBUG
+ int cgix = NumberOfGlyphs();
+ int nPowerOf2 = 1;
+ while (nPowerOf2 <= cgix)
+ nPowerOf2 <<= 1;
+ nPowerOf2 >>= 1;
+ // Now nPowerOf2 is the max power of 2 <= cgix
+ gAssert((1 << LoopCount()) == nPowerOf2); // LoopCount() == log2(nPowerOf2)
+ gAssert(digixInit == nPowerOf2);
+ gAssert(igixStart == cgix - digixInit);
+#endif // _DEBUG
+
+ int digixCurr = digixInit;
+
+ GrGlyphIndexPair * pgixCurr = m_pgixFirst + igixStart;
+ while (digixCurr > 0)
+ {
+ int nTest;
+ if (pgixCurr < m_pgixFirst)
+ nTest = -1;
+ else
+ nTest = pgixCurr->GlyphID() - gid;
+
+ if (nTest == 0)
+ return pgixCurr->Index();
+
+ digixCurr >>= 1; // divide by 2
+ if (nTest < 0)
+ pgixCurr += digixCurr;
+ else // (nTest > 0)
+ pgixCurr -= digixCurr;
+ }
+
+ return -1;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the selector index for the given glyph ID.
+----------------------------------------------------------------------------------------------*/
+int GrClassTable::FindIndex(int icls, gid16 chwGlyphID)
+{
+ if (icls >= m_ccls)
+ {
+ gAssert(false); // bad compiler problem
+ return 0;
+ }
+
+ if (icls < m_cclsLinear)
+ {
+ // The class is an output class--uses linear format--and is being used as an
+ // input class. Shouldn't happen if the compiler is working right.
+ gAssert(false); // comment out for test procedures
+
+ // Do a slow linear search to find the glyph ID.
+ int ichwMin = m_prgichwOffsets[icls];
+ int ichwLim = m_prgichwOffsets[icls+1];
+ int cchw = ichwLim - ichwMin;
+
+ for (int ichw = 0; ichw < cchw; ichw++)
+ {
+ if (GlyphAt(ichwMin + ichw) == chwGlyphID)
+ return ichw;
+ }
+ return -1;
+ }
+
+ // Slurp the class into an instance so we can see what's there.
+ GrInputClass clsin;
+ int ichwMin = m_prgichwOffsets[icls];
+ int ichwLim = m_prgichwOffsets[icls+1];
+ clsin.CopyFrom(GlyphListLoc(ichwMin), (ichwLim - ichwMin));
+
+ // Do a fast binary search to find our glyph.
+ int iRet = clsin.FindIndex(chwGlyphID);
+ return iRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the glyph ID at the selector index.
+----------------------------------------------------------------------------------------------*/
+gid16 GrClassTable::GetGlyphID(int icls, int ichw)
+{
+ if (ichw < 0)
+ {
+ gAssert(false);
+ return 0;
+ }
+
+ if (icls >= m_cclsLinear)
+ {
+ // The class is an input class--sorted by glyph ID--and is being used as an
+ // output class. Shouldn't happen if the compiler is working right.
+ gAssert(false); // comment out for test procedures
+
+ if (icls >= m_ccls) // bad compiler problem
+ return 0;
+
+ // Do a slow linear search to find the index and answer the matching glyph.
+ // Slurp the class into an instance so we can see what's there.
+ GrInputClass clsin;
+ int ichwMin = m_prgichwOffsets[icls];
+ int ichwLim = m_prgichwOffsets[icls+1];
+ clsin.CopyFrom(GlyphListLoc(ichwMin), (ichwLim - ichwMin));
+
+ int cgix = clsin.NumberOfGlyphs();
+ for (int igix = 0; igix < cgix; igix++)
+ {
+ GrGlyphIndexPair * m_pgix = clsin.m_pgixFirst + igix;
+ if (m_pgix->Index() == ichw)
+ return m_pgix->GlyphID();
+ }
+ return 0;
+ }
+
+ int ichwMin = m_prgichwOffsets[icls];
+ int ichwLim = m_prgichwOffsets[icls+1];
+
+ if (ichw >= ichwLim - ichwMin)
+ return 0;
+ else
+ return GlyphAt(ichwMin + ichw);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the number of glyphs in the class.
+----------------------------------------------------------------------------------------------*/
+int GrClassTable::NumberOfGlyphsInClass(int icls)
+{
+ int ichwMin = m_prgichwOffsets[icls];
+ int ichwLim = m_prgichwOffsets[icls+1];
+
+ if (icls >= m_cclsLinear)
+ {
+ if (icls >= m_ccls) // bad compiler problem
+ return 0;
+
+ GrInputClass clsin;
+ clsin.CopyFrom(GlyphListLoc(ichwMin), (ichwLim - ichwMin));
+
+ int cgix = clsin.NumberOfGlyphs();
+ return cgix;
+ }
+ else
+ {
+ gAssert(false); // this method should not be used for output classes.
+ return ichwLim - ichwMin;
+ }
+}
+
+//:>********************************************************************************************
+//:> For test procedures
+//:>********************************************************************************************
+
+//:Ignore
+
+#ifdef OLD_TEST_STUFF
+/*----------------------------------------------------------------------------------------------
+ General test of class table.
+----------------------------------------------------------------------------------------------*/
+void GrClassTable::SetUpTestData()
+{
+ m_ccls = 7; // number of classes
+ m_cclsLinear = 4; // number of classes in linear format
+
+ m_prgchwBIGGlyphList = new gid16[100];
+
+ m_prgichwOffsets = new data16[7+1];
+
+ gid16 * pchw = m_prgchwBIGGlyphList;
+
+ // Output class 0: uppercase consonants B - H
+ m_prgichwOffsets[0] = 0;
+ *pchw++ = msbf(gid16(66)); *pchw++ = msbf(utf16(67)); *pchw++ = msbf(utf16(68));
+ *pchw++ = msbf(gid16(70)); *pchw++ = msbf(utf16(71)); *pchw++ = msbf(utf16(72));
+
+ // Output class 1: grave vowels
+ m_prgichwOffsets[1] = 6;
+ *pchw++ = msbf(gid16(192)); // A
+ *pchw++ = msbf(gid16(224)); // a
+ *pchw++ = msbf(gid16(200)); // E
+ *pchw++ = msbf(gid16(232)); // e
+ *pchw++ = msbf(gid16(204)); // I
+ *pchw++ = msbf(gid16(236)); // i
+ *pchw++ = msbf(gid16(210)); // O
+ *pchw++ = msbf(gid16(243)); // o
+ *pchw++ = msbf(gid16(217)); // U
+ *pchw++ = msbf(gid16(249)); // u
+
+ // Output class 2: circumflex vowels
+ m_prgichwOffsets[2] = 6 + 10;
+ *pchw++ = msbf(gid16(194)); // A
+ *pchw++ = msbf(gid16(226)); // a
+ *pchw++ = msbf(gid16(202)); // E
+ *pchw++ = msbf(gid16(234)); // e
+ *pchw++ = msbf(gid16(206)); // I
+ *pchw++ = msbf(gid16(238)); // i
+ *pchw++ = msbf(gid16(212)); // O
+ *pchw++ = msbf(gid16(244)); // o
+ *pchw++ = msbf(gid16(219)); // U
+ *pchw++ = msbf(gid16(251)); // u
+
+ // Output class 3: diaeresis vowels, uppercase
+ m_prgichwOffsets[3] = 16 + 10;
+ *pchw++ = msbf(gid16(196)); // A
+ *pchw++ = msbf(gid16(196)); // A
+ *pchw++ = msbf(gid16(203)); // E
+ *pchw++ = msbf(gid16(203)); // E
+ *pchw++ = msbf(gid16(207)); // I
+ *pchw++ = msbf(gid16(207)); // I
+ *pchw++ = msbf(gid16(214)); // O
+ *pchw++ = msbf(gid16(214)); // O
+ *pchw++ = msbf(gid16(220)); // U
+ *pchw++ = msbf(gid16(220)); // U
+
+ // Input class 4: lowercase consonants b - h
+ m_prgichwOffsets[4] = 26 + 10; // = 36
+ *pchw++ = msbf(gid16(6));
+ *pchw++ = msbf(gid16(4)); *pchw++ = msbf(gid16(2)); *pchw++ = msbf(gid16(6-4));
+ *pchw++ = msbf(gid16(98)); *pchw++ = msbf(gid16(0));
+ *pchw++ = msbf(gid16(99)); *pchw++ = msbf(gid16(1));
+ *pchw++ = msbf(gid16(100)); *pchw++ = msbf(gid16(2));
+ *pchw++ = msbf(gid16(102)); *pchw++ = msbf(gid16(3));
+ *pchw++ = msbf(gid16(103)); *pchw++ = msbf(gid16(4));
+ *pchw++ = msbf(gid16(104)); *pchw++ = msbf(gid16(5));
+
+ // Input class 5: vowels
+ m_prgichwOffsets[5] = 36 + 4 + 6*2; // = 52
+ *pchw++ = msbf(gid16(10));
+ *pchw++ = msbf(gid16(8)); *pchw++ = msbf(utf16(3)); *pchw++ = msbf(utf16(10-8));
+ *pchw++ = msbf(gid16(65)); *pchw++ = msbf(gid16(0)); // A
+ *pchw++ = msbf(gid16(69)); *pchw++ = msbf(gid16(2)); // E
+ *pchw++ = msbf(gid16(73)); *pchw++ = msbf(gid16(4)); // I
+ *pchw++ = msbf(gid16(79)); *pchw++ = msbf(gid16(6)); // O
+ *pchw++ = msbf(gid16(85)); *pchw++ = msbf(gid16(8)); // U
+ *pchw++ = msbf(gid16(97)); *pchw++ = msbf(gid16(1)); // a
+ *pchw++ = msbf(gid16(101)); *pchw++ = msbf(gid16(3)); // e
+ *pchw++ = msbf(gid16(105)); *pchw++ = msbf(gid16(5)); // i
+ *pchw++ = msbf(gid16(111)); *pchw++ = msbf(gid16(7)); // o
+ *pchw++ = msbf(gid16(117)); *pchw++ = msbf(gid16(9)); // u
+
+ // Input class 6: acute vowels
+ m_prgichwOffsets[6] = 52 + 4 + 10*2; // = 76
+ *pchw++ = msbf(gid16(10));
+ *pchw++ = msbf(gid16(8)); *pchw++ = msbf(gid16(3)); *pchw++ = msbf(gid16(10-8));
+ *pchw++ = msbf(gid16(193)); *pchw++ = msbf(gid16(0)); // A
+ *pchw++ = msbf(gid16(201)); *pchw++ = msbf(gid16(2)); // E
+ *pchw++ = msbf(gid16(205)); *pchw++ = msbf(gid16(4)); // I
+ *pchw++ = msbf(gid16(211)); *pchw++ = msbf(gid16(6)); // O
+ *pchw++ = msbf(gid16(218)); *pchw++ = msbf(gid16(8)); // U
+ *pchw++ = msbf(gid16(225)); *pchw++ = msbf(gid16(1)); // a
+ *pchw++ = msbf(gid16(233)); *pchw++ = msbf(gid16(3)); // e
+ *pchw++ = msbf(gid16(237)); *pchw++ = msbf(gid16(5)); // i
+ *pchw++ = msbf(gid16(243)); *pchw++ = msbf(gid16(7)); // o
+ *pchw++ = msbf(gid16(250)); *pchw++ = msbf(gid16(9)); // u
+
+ m_prgichwOffsets[7] = 76 + 4 + 10*2; // = 100
+};
+
+#endif // OLD_TEST_STUFF
+
+} // namespace gr
+
+//:End Ignore
+
diff --git a/Build/source/libs/graphite/src/segment/GrClassTable.h b/Build/source/libs/graphite/src/segment/GrClassTable.h
new file mode 100644
index 00000000000..67d6940862c
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrClassTable.h
@@ -0,0 +1,188 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrClassTable.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ The GrClassTable and related classes that store the classes that are used in substitutions.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GR_CTABLE_INCLUDED
+#define GR_CTABLE_INCLUDED
+
+//:End Ignore
+
+namespace gr
+{
+
+/*----------------------------------------------------------------------------------------------
+ A glyph ID / index pair, a member of the GrInputClass where the items are sorted
+ by glyph ID.
+
+ Hungarian: gix
+----------------------------------------------------------------------------------------------*/
+class GrGlyphIndexPair
+{
+ friend class GrInputClass;
+ friend class GrClassTable;
+
+ gid16 GlyphID() { return lsbf(m_gidBIG); }
+ data16 Index() { return lsbf(m_nBIGIndex); }
+
+ gid16 m_gidBIG;
+ data16 m_nBIGIndex;
+};
+
+/*----------------------------------------------------------------------------------------------
+ A class consisting of a mapping from glyph ID to index, used for classes that
+ function as input classes (eg, occurrng in the left-hand side of a rule).
+
+ Hungarian: clsin
+----------------------------------------------------------------------------------------------*/
+class GrInputClass
+{
+ friend class GrClassTable;
+
+protected:
+ /*------------------------------------------------------------------------------------------
+ Copy the raw memory into the instance.
+ ------------------------------------------------------------------------------------------*/
+ void CopyFrom(data16 * pchwStart, int cchw)
+ {
+ m_cgixBIG = pchwStart[0];
+ m_digixBIGInit = pchwStart[1];
+ m_cBIGLoop = pchwStart[2];
+ m_igixBIGStart = pchwStart[3];
+
+ int cgix = NumberOfGlyphs();
+ m_pgixFirst = m_prggixBuffer;
+ if (cgix > 64)
+ {
+ m_vgix.resize(cgix);
+ m_pgixFirst = &m_vgix[0];
+ }
+ gAssert((4 + (cgix * 2)) == cchw);
+ #ifdef _DEBUG
+ memset(m_pgixFirst, 0, cgix * isizeof(GrGlyphIndexPair));
+ #endif
+ Assert(sizeof(GrGlyphIndexPair) == sizeof(gid16) + sizeof(data16));
+ GrGlyphIndexPair * pgixStart = reinterpret_cast<GrGlyphIndexPair*>(pchwStart + 4);
+ std::copy(pgixStart, pgixStart + cgix, m_pgixFirst);
+ }
+
+ int NumberOfGlyphs() { return lsbf(m_cgixBIG); }
+ int LoopCount() { return lsbf(m_cBIGLoop); }
+ int InitialSearchRange() { return lsbf(m_digixBIGInit); }
+ int StartSearch() { return lsbf(m_igixBIGStart); }
+
+ int FindIndex(gid16 gid);
+
+protected:
+ // Instance variables:
+ data16 m_cgixBIG; // number of glyphs in the class
+
+ // constants for fast binary search
+ data16 m_digixBIGInit; // (max power of 2 <= m_cgix);
+ // size of initial range to consider
+ data16 m_cBIGLoop; // log2(max power of 2 <= m_cgix);
+ // indicates how many iterations are necessary
+ data16 m_igixBIGStart; // m_cgix - m_digixInit;
+ // where to start search
+
+ GrGlyphIndexPair m_prggixBuffer[64];
+ std::vector<GrGlyphIndexPair> m_vgix;
+ GrGlyphIndexPair * m_pgixFirst;
+};
+
+
+/*----------------------------------------------------------------------------------------------
+ Contains all the classes used for substitution rules.
+
+ Hungarian: ctbl
+----------------------------------------------------------------------------------------------*/
+
+class GrClassTable
+{
+ friend class FontMemoryUsage;
+
+public:
+ // Constructor & destructor:
+ GrClassTable()
+ : m_prgichwOffsets(NULL),
+ m_prgchwBIGGlyphList(NULL)
+ {
+ }
+
+ ~GrClassTable()
+ {
+ delete[] m_prgichwOffsets;
+ delete[] m_prgchwBIGGlyphList;
+ }
+
+ int NumberOfClasses() { return m_ccls; }
+ int NumberOfInputClasses() { return m_ccls - m_cclsLinear; }
+ int NumberOfOutputClasses() { return m_cclsLinear; }
+
+ bool ReadFromFont(GrIStream & grstrm, int fxdVersion);
+ void CreateEmpty();
+
+ int FindIndex(int icls, gid16 chwGlyphID);
+ gid16 GetGlyphID(int icls, int ichw);
+ int NumberOfGlyphsInClass(int icls);
+
+ gid16 GlyphAt(int ichw)
+ {
+ return lsbf(m_prgchwBIGGlyphList[ichw]);
+ }
+ data16 * GlyphListLoc(int ichw)
+ {
+ return m_prgchwBIGGlyphList + ichw;
+ }
+
+protected:
+ // Instance variables:
+ int m_ccls; // number of classes
+ int m_cclsLinear; // number of classes in linear format
+
+ data16 * m_prgichwOffsets;
+
+ // Two formats are included in the following array: the first section consists of
+ // flat ordered lists of glyphs, used for the "output" classes that use linear format.
+ // This provides an index-to-glyph mapping.
+ // The second section contains data in the format of GrInputClasses, used for "input"
+ // classes that need a binary-search format. This provides a glyph-to-index mapping.
+ // We don't create instances of GrInputClasses, because that would make reading
+ // from the ECF file slow. Instead we just set up a single instance at the time
+ // we're interested in it.
+ // NOTE that all this data has been slurped directly from the ECF file and therefore
+ // uses BIG-ENDIAN format.
+ gid16 * m_prgchwBIGGlyphList;
+
+//:Ignore
+#ifdef OLD_TEST_STUFF
+public:
+ // For test procedures:
+ void SetUpTestData();
+ void SetUpRuleActionTest();
+ void SetUpRuleAction2Test();
+ void SetUpAssocTest();
+ void SetUpAssoc2Test();
+ void SetUpDefaultAssocTest();
+ void SetUpFeatureTest();
+ void SetUpLigatureTest();
+ void SetUpLigature2Test();
+#endif // OLD_TEST_STUFF
+//:End Ignore
+};
+
+} // namespace gr
+
+#endif // !GR_CTABLE_INCLUDED
+
diff --git a/Build/source/libs/graphite/src/segment/GrEngine.cpp b/Build/source/libs/graphite/src/segment/GrEngine.cpp
new file mode 100644
index 00000000000..0fda68df880
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrEngine.cpp
@@ -0,0 +1,2030 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrEngine.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description: Contains the implementation of the GrEngine class.
+----------------------------------------------------------------------------------------------*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+#include <functional>
+#include <cstring>
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+// any other headers (not precompiled)
+
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:End Ignore
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+
+//:>********************************************************************************************
+//:> General functions
+//:>********************************************************************************************
+
+bool compareCmap(const byte *lhs, const byte *rhs)
+{
+ using namespace gr;
+
+ typedef const struct index {data16 version; data16 numberSubtables;} *const IndexPtr;
+ typedef const struct enc {data16 platID; data16 platSpecID; data32 offset;} *const EncPtr;
+
+ // Calculate the size of the cmap.
+
+ IndexPtr rhsIndex = IndexPtr(rhs);
+ size_t numSubTbl = lsbf(rhsIndex->numberSubtables);
+ size_t cbCmapSz = sizeof(index) + sizeof(enc) * numSubTbl;
+ EncPtr encTbl = EncPtr(rhs + sizeof(index));
+
+ for (size_t iSubTbl = 0; iSubTbl < numSubTbl; iSubTbl++)
+ //for (int iSubTbl = numSubTbl - 1; iSubTbl >= 0; --iSubTbl)
+ {
+ const data16 *const mapTbl = reinterpret_cast<const data16 *>(rhs + lsbf((int)encTbl[iSubTbl].offset));
+ int format = lsbf(*mapTbl);
+ switch (format)
+ {
+ // 16-bit lengths
+ case 0:
+ case 2:
+ case 4:
+ case 6:
+ cbCmapSz += lsbf((data16)unsigned(mapTbl[1]));
+ break;
+ // 32-bit lengths
+ case 8:
+ case 10:
+ case 12:
+ cbCmapSz += lsbf((int)unsigned(reinterpret_cast<const data32 *>(mapTbl)[1]));
+ break;
+ default:
+ Assert(false);
+ }
+ }
+
+ // Do the comparison.
+ return (memcmp(lhs, rhs, cbCmapSz) ? false : true);
+}
+
+
+//:>********************************************************************************************
+//:> GrEngine class.
+//:>********************************************************************************************
+
+GrEngine::GrEngine()
+{
+ /////////////_CrtSetDbgFlag(_CRTDBG_CHECK_ALWAYS_DF); ////////////////
+
+
+ m_cref = 1;
+ BasicInit();
+}
+
+void GrEngine::BasicInit()
+{
+ m_pfface = NULL;
+
+ m_ptman = NULL;
+ m_pctbl = NULL;
+ m_pgtbl = NULL;
+ m_prgpsd = NULL;
+ m_cpsd = 0;
+ m_cfeat = 0;
+ m_mFontEmUnits = -1;
+ m_dysOffset = 0;
+
+ ////m_tbufCmap.reset();
+ m_pCmap_3_1 = NULL;
+ m_pCmap_3_10 = NULL;
+ ////m_tbufNameTbl.reset();
+ // new interface stuff:
+ m_pCmapTbl = NULL;
+ m_pNameTbl = NULL;
+ m_fCmapTblCopy = false;
+ m_fNameTblCopy = false;
+
+ m_fLogXductn = false;
+
+ m_resFontValid = kresInvalidArg; // not yet initialized
+ m_ferr = kferrUninitialized;
+ m_fxdBadVersion = 0;
+
+ m_fSmartReg = false;
+ m_fSmartBold = false;
+ m_fSmartItalic = false;
+ m_fSmartBI = false;
+ m_fFakeItalicCache = false;
+ m_fFakeBICache = false;
+ m_strCtrlFileReg.erase();
+ m_strCtrlFileBold.erase();
+ m_strCtrlFileItalic.erase();
+ m_strCtrlFileBI.erase();
+ m_fFakeItalic = false;
+ m_stuCtrlFile.erase();
+ m_stuInitError.erase();
+ m_stuErrCtrlFile.erase();
+ m_stuFaceName.erase();
+ m_stuBaseFaceName.erase();
+ m_fUseSepBase = false;
+ m_stuFeatures.erase();
+
+ m_nFontCheckSum = 0;
+
+ m_fInErrorState = false;
+
+ m_rglcidFeatLabelLangs = NULL; // initialize lazily, when needed
+ m_clcidFeatLabelLangs = 0;
+}
+
+GrEngine::~GrEngine()
+{
+ DestroyEverything();
+ #ifdef _MSC_VER
+ if (!_CrtCheckMemory())
+ {
+ OutputDebugString(L"bad memory");
+ }
+ #endif
+}
+
+/*----------------------------------------------------------------------------------------------
+ Clean everything out (destructor or reinitializing with a different face name).
+----------------------------------------------------------------------------------------------*/
+void GrEngine::DestroyEverything()
+{
+ DestroyContents();
+ #ifdef _MSC_VER
+ if (!_CrtCheckMemory())
+ {
+ OutputDebugString(L"bad memory");
+ }
+ #endif
+
+ m_strCtrlFileReg.erase();
+ m_strCtrlFileBold.erase();
+ m_strCtrlFileItalic.erase();
+ m_strCtrlFileBI.erase();
+ m_fSmartReg = false;
+ m_fSmartBold = false;
+ m_fSmartItalic = false;
+ m_fSmartBI = false;
+ m_fFakeItalicCache = false;
+ m_fFakeBICache = false;
+ m_stuBaseFaceName.erase();
+
+ //m_stuFaceName.erase();
+ //m_stuFaceName = L"this is not a usable or valid string";
+ m_fUseSepBase = false;
+ m_stuFeatures.erase();
+}
+
+void GrEngine::DestroyContents(bool fDestroyCmap)
+{
+ if (fDestroyCmap)
+ {
+ ////m_tbufCmap.reset();
+ m_pCmap_3_1 = NULL;
+ m_pCmap_3_10 = NULL;
+
+ if (m_fCmapTblCopy)
+ delete[] m_pCmapTbl;
+ if (m_fNameTblCopy)
+ delete[] m_pNameTbl;
+ m_pCmapTbl = NULL;
+ m_pNameTbl = NULL;
+ m_fCmapTblCopy = false;
+ m_fNameTblCopy = false;
+ }
+
+ delete m_ptman;
+ delete m_pctbl;
+ delete m_pgtbl;
+ delete[] m_prgpsd;
+ m_ptman = NULL;
+ m_pctbl = NULL;
+ m_pgtbl = NULL;
+ m_prgpsd = NULL;
+
+ ////m_tbufNameTbl.reset();
+
+ m_stuCtrlFile.erase();
+ m_stuInitError.erase();
+
+ m_resFontValid = kresInvalidArg;
+ m_ferr = kferrUninitialized;
+}
+
+/*----------------------------------------------------------------------------------------------
+ For FontFace: return the number of features.
+----------------------------------------------------------------------------------------------*/
+size_t GrEngine::NumberOfFeatures_ff()
+{
+ return (size_t)m_cfeat;
+}
+
+/*----------------------------------------------------------------------------------------------
+ For FontFace: return the feature ID for the ifeat-th feature.
+----------------------------------------------------------------------------------------------*/
+featid GrEngine::FeatureID_ff(size_t ifeat)
+{
+ return (featid)m_rgfeat[ifeat].ID();
+}
+
+/*----------------------------------------------------------------------------------------------
+ For FontFace: return the index of the feature with the given ID.
+----------------------------------------------------------------------------------------------*/
+size_t GrEngine::FeatureWithID_ff(featid fid)
+{
+ int ifeatRet;
+ /* GrFeature * pfeat = */
+ FeatureWithID(fid, &ifeatRet);
+ return (size_t)ifeatRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ For FontFace: return the label for the ifeat-th feature.
+----------------------------------------------------------------------------------------------*/
+bool GrEngine::GetFeatureLabel_ff(size_t ifeat, lgid nLanguage, utf16 * rgchwLabel)
+{
+ std::wstring stu = m_rgfeat[ifeat].Label(this, nLanguage);
+
+ int cch = stu.size();
+ cch = min(cch, 127); // 1 char for zero-termination
+ std::copy(stu.data(), stu.data() + cch, rgchwLabel);
+ rgchwLabel[cch] = 0;
+
+ return (cch > 0);
+}
+
+/*----------------------------------------------------------------------------------------------
+ For FontFace: return the index of the default setting. Return -1 if it cannot be found.
+----------------------------------------------------------------------------------------------*/
+int GrEngine::GetFeatureDefault_ff(size_t ifeat)
+{
+ GrFeature * pfeat = m_rgfeat + ifeat;
+ int defaultValue = pfeat->DefaultValue();
+ int cfset = pfeat->NumberOfSettings();
+ int rgnSettings[100];
+ pfeat->Settings(100, rgnSettings);
+ Assert(cfset < 100); // TODO: improve this
+ for (int ifset = 0; ifset < cfset; ifset++)
+ {
+ if (rgnSettings[ifset] == defaultValue)
+ return ifset;
+ }
+ return -1;
+}
+
+/*----------------------------------------------------------------------------------------------
+ For FontFace: return the number of settings for the ifeat-th feature.
+----------------------------------------------------------------------------------------------*/
+size_t GrEngine::NumberOfSettings_ff(size_t ifeat)
+{
+ return m_rgfeat[ifeat].NumberOfSettings();
+}
+
+/*----------------------------------------------------------------------------------------------
+ For FontFace: return the value of the ifset-th setting for the ifeat-th feature.
+----------------------------------------------------------------------------------------------*/
+int GrEngine::GetFeatureSettingValue_ff(size_t ifeat, size_t ifset)
+{
+ return m_rgfeat[ifeat].NthSetting(ifset);
+}
+
+/*----------------------------------------------------------------------------------------------
+ For FontFace: return the UI label for the given feature setting.
+----------------------------------------------------------------------------------------------*/
+bool GrEngine::GetFeatureSettingLabel_ff(size_t ifeat, size_t ifset, lgid language,
+ utf16 * rgchwLabel)
+{
+ std::wstring stu = m_rgfeat[ifeat].NthSettingLabel(this, ifset, language);
+
+ int cch = stu.size();
+ cch = min(cch, 127); // 1 char for zero-termination
+ // Note: the wchar_t label was originally assigned from utf16 data, so although wchar_t is
+ // utf32 on some platforms the conversion back to utf16 should still give correct results.
+ std::copy(stu.data(), stu.data() + cch, rgchwLabel);
+ rgchwLabel[cch] = 0;
+
+ return (cch > 0);
+}
+
+/*----------------------------------------------------------------------------------------------
+ For FontFace: return the number of languages that are possible among the feature labels.
+----------------------------------------------------------------------------------------------*/
+size_t GrEngine::NumberOfFeatLangs_ff()
+{
+ SetUpFeatLangList();
+ return m_clcidFeatLabelLangs;
+}
+
+/*----------------------------------------------------------------------------------------------
+ For FontFace: return the language LCID for the feature-label language with the given index.
+----------------------------------------------------------------------------------------------*/
+short GrEngine::GetFeatLabelLang_ff(size_t ilang)
+{
+ SetUpFeatLangList();
+ return m_rglcidFeatLabelLangs[ilang];
+}
+
+/*----------------------------------------------------------------------------------------------
+ For FontFace: return the number of supported languages.
+----------------------------------------------------------------------------------------------*/
+size_t GrEngine::NumberOfLanguages_ff()
+{
+ return (size_t)m_langtbl.NumberOfLanguages();
+}
+
+/*----------------------------------------------------------------------------------------------
+ For FontFace: return the language code for the language with the given index.
+----------------------------------------------------------------------------------------------*/
+isocode GrEngine::GetLanguageCode_ff(size_t ilang)
+{
+ return m_langtbl.LanguageCode(ilang);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set up the list of all the languages that are present in the feature labels.
+----------------------------------------------------------------------------------------------*/
+void GrEngine::SetUpFeatLangList()
+{
+ if (m_rglcidFeatLabelLangs)
+ return;
+
+ int rgnNameIDs[kMaxFeatures];
+ for (int ifeat = 0; ifeat < m_cfeat; ifeat++)
+ rgnNameIDs[ifeat] = m_rgfeat[ifeat].NameId();
+ short rglcid[128]; // 128 is the number expected by TtfUtil::GetLangsForNames
+ m_clcidFeatLabelLangs = TtfUtil::GetLangsForNames(m_pNameTbl, 3, 1, rgnNameIDs, m_cfeat, rglcid);
+ m_rglcidFeatLabelLangs = new short[m_clcidFeatLabelLangs];
+ memcpy(m_rglcidFeatLabelLangs, rglcid, sizeof(short) * m_clcidFeatLabelLangs);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the maximum size needed for the block of data to pass between segments, that is,
+ to reinitialize the engine based on the results of the previously generated segment.
+ This value must match what is in GrTableManager::InitializeStreams() and
+ InitializeForNextSeg(). 256 is an absolute maximum imposed by the interface.
+
+ In Graphite, what this block of data will contain is information about cross-line
+ contextualization and some directionality information.
+
+ Assumes InitNew() has already been called to set the font name.
+----------------------------------------------------------------------------------------------*/
+GrResult GrEngine::get_SegDatMaxLength(int * pcb)
+{
+ ChkGrOutPtr(pcb);
+
+ if (m_resFontValid == kresInvalidArg)
+ ReturnResult(kresUnexpected); // engine not initialized
+
+ GrResult res = m_resFontValid;
+ if (m_resFontValid == kresFail || m_resFontValid == kresUnexpected || m_resFontValid == kresFalse)
+ res = kresOk; // invalid font
+ if (ResultFailed(res))
+ ReturnResult(res);
+
+ Assert(m_ptman);
+ if (!m_ptman)
+ *pcb = 256;
+ else
+ *pcb = m_ptman->NumberOfPasses() + 4;
+
+ ReturnResult(res);
+}
+
+/*----------------------------------------------------------------------------------------------
+ @return The supported script direction(s). If more than one, the application is
+ responsible for choosing the most appropriate.
+----------------------------------------------------------------------------------------------*/
+GrResult GrEngine::get_ScriptDirection(unsigned int * pgrfsdc, OLECHAR * prgchwErrMsg, int cchMaxErrMsg)
+{
+ ChkGrOutPtr(pgrfsdc);
+ ChkGrArrayArg(prgchwErrMsg, cchMaxErrMsg);
+
+ if (m_resFontValid == kresInvalidArg)
+ ReturnResult(kresUnexpected); // engine not initialized
+
+ GrResult res = m_resFontValid;
+
+ *pgrfsdc = m_grfsdc;
+
+// ClearFontError(prgchwErrMsg, cchMaxErrMsg);
+// try
+// {
+// if (m_resFontValid == kresFail || m_resFontValid == kresUnexpected || m_resFontValid == kresFalse)
+// {
+// RecordFontLoadError(prgchwErrMsg, cchMaxErrMsg);
+// res = kresOk;
+// }
+// *pgrfsdc = m_grfsdc;
+// }
+// catch (Throwable & thr)
+// {
+// res = (GrResult)thr.Error();
+// *pgrfsdc = kfsdcHorizLtr;
+// }
+// catch (...)
+// {
+// res = WARN(kresFail);
+// *pgrfsdc = kfsdcHorizLtr;
+// }
+
+ ReturnResult(res);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get an glyph attribute from the engine that will help the GrJustifier in its work.
+----------------------------------------------------------------------------------------------*/
+GrResult GrEngine::getGlyphAttribute(int iGlyph, int jgat, int nLevel, float * pValueRet)
+{
+ return m_ptman->State()->GetGlyphAttrForJustification(iGlyph, jgat, nLevel, pValueRet);
+}
+
+GrResult GrEngine::getGlyphAttribute(int iGlyph, int jgat, int nLevel, int * pValueRet)
+{
+ return m_ptman->State()->GetGlyphAttrForJustification(iGlyph, jgat, nLevel, pValueRet);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set an glyph attribute in the engine as a result of the decisions made by the
+ GrJustifier.
+----------------------------------------------------------------------------------------------*/
+GrResult GrEngine::setGlyphAttribute(int iGlyph, int jgat, int nLevel, float value)
+{
+ return m_ptman->State()->SetGlyphAttrForJustification(iGlyph, jgat, nLevel, value);
+}
+
+GrResult GrEngine::setGlyphAttribute(int iGlyph, int jgat, int nLevel, int value)
+{
+ return m_ptman->State()->SetGlyphAttrForJustification(iGlyph, jgat, nLevel, value);
+}
+
+//:>********************************************************************************************
+//:> Non-FieldWorks interface methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Make a complete segment that can be used to measure and do line-breaking.
+
+ OBSOLETE - delete
+----------------------------------------------------------------------------------------------*/
+/*
+GrResult GrEngine::MakeMeasuredSegment(
+ Font * pfont, ITextSource * pgts,
+ int ichMin, int ichLim,
+ bool fParaRtl,
+ Segment ** ppsegRet, SegEnd * pest,
+ std::ostream * pstrmLog,
+ OLECHAR * prgchwErrMsg, int cchMaxErrMsg)
+{
+ int dichContext, dichLimSeg;
+ float dxWidth;
+ return MakeSegment(ksegmodeMsfr,
+ pfont, pgts, NULL, ichMin, ichLim, false, false,
+ 100000, klbClipBreak, ktwshAll, // not used
+ fParaRtl,
+ ppsegRet, &dxWidth,
+ 0, NULL, 0, NULL, NULL, &dichContext, // not used
+ pstrmLog,
+ prgchwErrMsg, cchMaxErrMsg,
+ -1, false, false, klbClipBreak, // not used
+ &dichLimSeg, pest,
+ false, 100000, kestMoreLines); // not used
+}
+*/
+
+/*----------------------------------------------------------------------------------------------
+ Make a segment from the given range, regardless of the kind of line-break that results.
+
+ OBSOLETE - delete
+----------------------------------------------------------------------------------------------*/
+/*
+GrResult GrEngine::MakeSegmentFromRange(
+ Font * pfont, ITextSource * pgts, IGrJustifier * pgj,
+ int ichMin, int ichLim,
+ bool fStartLine, bool fEndLine,
+ TrWsHandling twsh, bool fParaRtl,
+ Segment ** ppsegRet, float * pdxWidth, SegEnd * pest,
+ int cbPrev, byte * pbPrevSegDat, int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat,
+ int * pdichwContext,
+ std::ostream * pstrmLog,
+ OLECHAR * prgchwErrMsg, int cchwMaxErrMsg)
+{
+ int dichLimSegBogus;
+ return MakeSegment(ksegmodeMsfr, pfont, pgts, pgj,
+ ichMin, ichLim,
+ fStartLine, fEndLine,
+ 10000, klbWordBreak, // not used
+ twsh, fParaRtl,
+ ppsegRet, pdxWidth,
+ //cbPrev, pbPrevSegDat, cbNextMax, pbNextSegDat, pcbNextSegDat, pdichwContext,
+ 0, NULL, 0, NULL, NULL, NULL,
+ pstrmLog,
+ prgchwErrMsg, cchwMaxErrMsg,
+ ichLim, false, false, klbClipBreak, // not used
+ &dichLimSegBogus, pest,
+ 10000, kestMoreLines); // not used
+}
+*/
+
+
+//:>********************************************************************************************
+//:> Other methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Create a segment.
+----------------------------------------------------------------------------------------------*/
+void GrEngine::MakeSegment(
+ // Common parameters
+ Segment * psegNew,
+ Font * pfont, ITextSource * pgts, IGrJustifier * pjus,
+ LayoutEnvironment & layout,
+ int ichMin, int ichLim,
+ // for finding a break point
+ float dxMaxWidth,
+ bool fBacktracking,
+ // for justification
+ bool fJust, float dxJustifiedWidthJ, SegEnd estJ)
+{
+ ChkGrArgPtr(pgts);
+ ChkGrArgPtrN(pjus);
+ ChkGrOutPtr(psegNew);
+ Assert(layout.bestBreak() <= layout.worstBreak());
+
+ if (pjus == NULL)
+ pjus = layout.justifier();
+
+ if (m_resFontValid == kresInvalidArg)
+ // Uninitialized.
+ return; // ReturnResult(kresUnexpected);
+
+ SetCmapAndNameTables(pfont);
+
+ int segmode = ksegmodeRange; // segment from range
+ if (fJust)
+ segmode = ksegmodeJust; // justified segment
+ else if (dxMaxWidth < kPosInfFloat)
+ segmode = ksegmodeBreak; // find break point
+
+ // Temporary:
+ if (!this->m_ptman)
+ {
+ Warn("No Graphite tables");
+ m_ptman = new GrTableManager(this);
+ CreateEmpty();
+ }
+
+ // GrResult hr = kresOk;
+ m_fInErrorState = false;
+
+ bool fBold, fItalic;
+ GetStyles(pfont, ichMin, &fBold, &fItalic);
+
+ GetWritingSystemDirection(pgts, ichMin);
+
+ // Find the end of the range to render with the current font.
+ int nDirDepth = 0;
+ int ichFontLim = FindFontLim(pgts, ichMin, &nDirDepth);
+ int ichStrmLim = 0;
+ int ichSegLim = 0;
+ switch (segmode)
+ {
+ case ksegmodeBreak: // find break point
+ // Here ichLim should be the end of the text-source, unless we're backtracking.
+ ichStrmLim = min(ichFontLim, ichLim);
+ ichSegLim = -1; // unknown
+ break;
+ case ksegmodeJust: // stretching an existing segment to achieve justification
+ ichStrmLim = ichFontLim;
+ ichSegLim = ichLim;
+ break;
+ //case ksegmodeMms: // MakeMeasuredSegment
+ // ichLim = ichFontLim;
+ // ichStrmLim = ichFontLim;
+ // ichSegLim = -1; // process to the end of the stream
+ // break;
+ case ksegmodeRange: // segment from range
+ ichLim = min(ichLim, ichFontLim);
+ ichStrmLim = ichFontLim;
+ ichSegLim = (ichLim == kPosInfinity) ? -1 : ichLim;
+ break;
+ default:
+ Assert(false);
+ }
+
+ // Initialize the graphics object with the font and character properties.
+ // SILE
+ ////if (m_fUseSepBase)
+ ////{
+ //// Assert(m_stuBaseFaceName.size() > 0);
+ //// SetUpGraphics(pgg, pgts, ichMin, m_stuBaseFaceName);
+ ////}
+ ////else
+ //// SetUpGraphics(pgg, pgts, ichMin, m_stuFaceName);
+
+ GrResult res = kresOk;
+
+ Assert(m_ptman);
+ m_ptman->State()->SetFont(pfont);
+
+ // Create a character stream on the text source.
+ GrCharStream * pchstrm = new GrCharStream(pgts, ichMin, ichStrmLim,
+ layout.startOfLine(), layout.endOfLine());
+
+ // TODO: change vertical offset to work on a character-by-character basis
+ m_dysOffset = (pgts->getVerticalOffset(ichMin) * pfont->getDPIy()) / 72;
+
+ // Run the tables and get back a segment.
+
+ bool fMoreText = false;
+ int ichCallerBtLim = -1;
+ bool fInfiniteWidth = false;
+ switch (segmode)
+ {
+ //case ksegmodeMms:
+ case ksegmodeBreak:
+ case ksegmodeRange:
+ if (segmode == ksegmodeBreak)
+ {
+ fMoreText = ((ichFontLim < ichLim) || fBacktracking);
+ ichCallerBtLim = (fBacktracking) ? ichLim : -1;
+ fInfiniteWidth = false;
+ }
+ //else if (segmode == ksegmodeMms)
+ //{
+ // fMoreText = false;
+ // ichCallerBtLim = -1;
+ // fInfiniteWidth = true;
+ // Assert(twsh == ktwshAll);
+ //}
+ else if (segmode == ksegmodeRange)
+ {
+ int ichTextLim;
+ ichTextLim = pgts->getLength();
+ fMoreText = (ichLim < ichTextLim);
+ ichCallerBtLim = -1;
+ fInfiniteWidth = true;
+ }
+ try {
+ m_ptman->Run(psegNew, pfont, pchstrm, pjus,
+ ((pjus) ? kjmodiCanShrink : kjmodiNormal),
+ layout,
+ ichSegLim, dxMaxWidth, 0,
+ fBacktracking, fMoreText, ichFontLim, fInfiniteWidth, false,
+ ichCallerBtLim,
+ nDirDepth, estJ);
+ }
+ catch (...)
+ {
+ // Disastrous problem in rendering.
+ if (!layout.dumbFallback())
+ throw; // throws original exception
+
+ // Try dumb rendering.
+ if (m_fUseSepBase)
+ SwitchGraphicsFont(true); // use the base font, which has real glyphs
+
+ m_fInErrorState = true;
+ res = RunUsingEmpty(psegNew, pfont, pchstrm, layout,
+ ichSegLim,
+ dxMaxWidth,
+ fBacktracking, fMoreText, fInfiniteWidth,
+ ichCallerBtLim,
+ nDirDepth, estJ);
+ }
+ break;
+
+ case ksegmodeJust: // justified segment
+ {
+ m_ptman->Run(psegNew, pfont, pchstrm, pjus, kjmodiJustify, layout,
+ ichSegLim,
+ dxJustifiedWidthJ, dxMaxWidth,
+ false, false, // not used
+ ichFontLim,
+ true, // infinite width
+ false, // kludge
+ -1,
+ nDirDepth, estJ);
+ //&dxWidth, &est);
+ Assert((ichLim - ichMin) == (psegNew->stopCharacter() - psegNew->startCharacter()));
+ break;
+ }
+
+ default:
+ Assert(false);
+ }
+
+ delete pchstrm;
+
+ if (m_fUseSepBase)
+ SwitchGraphicsFont(false);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return an indication of whether an error happened in trying to load Graphite tables.
+----------------------------------------------------------------------------------------------*/
+FontErrorCode GrEngine::IsValidForGraphite(int * pnVersion, int * pnSubVersion)
+{
+ if (pnVersion)
+ *pnVersion = m_fxdBadVersion >> 16;
+ if (pnSubVersion)
+ *pnSubVersion = m_fxdBadVersion & 0x0000FFFF;
+
+ return m_ferr;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Record a system error indicating that the font could not be loaded properly.
+ OBSOLETE
+----------------------------------------------------------------------------------------------*/
+void GrEngine::RecordFontLoadError(OLECHAR * prgchwErrMsg, int cchMax)
+{
+ if (prgchwErrMsg == NULL || cchMax == 0)
+ return;
+
+ std::wstring stuMessage = L"Error in initializing Graphite font \"";
+ stuMessage.append(m_stuFaceName);
+ if (m_stuErrCtrlFile.size())
+ {
+ stuMessage.append(L"\" (");
+ stuMessage.append(m_stuErrCtrlFile);
+ stuMessage.append(L")");
+ }
+ else
+ stuMessage.append(L"\"");
+ if (m_stuInitError.size())
+ {
+ stuMessage.append(L"--\n");
+ stuMessage.append(m_stuInitError);
+ }
+
+ std::fill_n(prgchwErrMsg, cchMax, 0);
+ std::copy(stuMessage.data(), stuMessage.data() + min(cchMax - 1, signed(stuMessage.size())),
+ prgchwErrMsg);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Record a system error indicating a bad error in rendering using a supposedly valid font.
+ OBSOLETE
+----------------------------------------------------------------------------------------------*/
+void GrEngine::RecordFontRunError(OLECHAR * prgchwErrMsg, int cchMax, GrResult res)
+{
+ if (prgchwErrMsg == NULL || cchMax == 0)
+ return;
+
+ std::wstring stuMessage = L"Error in rendering using Graphite font \"";
+ stuMessage.append(m_stuFaceName);
+ if (m_stuErrCtrlFile.size())
+ {
+ stuMessage.append(L"\" (");
+ stuMessage.append(m_stuErrCtrlFile);
+ stuMessage.append(L")");
+ }
+ else
+ stuMessage.append(L"\"");
+
+ std::fill_n(prgchwErrMsg, cchMax, 0);
+ std::copy(stuMessage.data(), stuMessage.data() + min(cchMax - 1, signed(stuMessage.size())),
+ prgchwErrMsg);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Initialize the font error message buffer to zero. This way we can be sure to recognize
+ an error condition by the fact that the buffer is non-zero.
+ OBSOLETE
+----------------------------------------------------------------------------------------------*/
+void GrEngine::ClearFontError(OLECHAR * prgchwErrMsg, int cchMaxErrMsg)
+{
+ std::fill_n(prgchwErrMsg, cchMaxErrMsg, 0);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set the overall direction of the writing system based on the text properties.
+----------------------------------------------------------------------------------------------*/
+void GrEngine::GetWritingSystemDirection(ITextSource * pgts, int ichwMin)
+{
+#ifdef OLD_TEST_STUFF
+ // for test procedures:
+ if (m_stuInitialize == "RightToLeftLayout")
+ {
+ m_fRightToLeft = true;
+ return;
+ }
+#endif // OLD_TEST_STUFF
+
+ m_fRightToLeft = pgts->getRightToLeft(ichwMin);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Find the end of the range that uses the current font.
+
+ @param pgts - contains text to render
+ @param ichwMinFont - beginning of range to render with this font
+ @param pnDirDepth - return direction depth: 0=LTR, 1=RTL
+
+ @return The lim of the range that could be rendered by this font. Also the direction depth.
+----------------------------------------------------------------------------------------------*/
+int GrEngine::FindFontLim(ITextSource * pgts, int ichwMinFont, int * pnDirDepth)
+{
+ int ichwTextLen = (int)pgts->getLength();
+
+ int ichwLimRange; // range that can be rendered without breaking contextualization.
+ int ichwMinNext = ichwMinFont;
+
+ while (true)
+ {
+ std::pair<toffset, toffset> pairRange = pgts->propertyRange(ichwMinNext);
+ // int ichwMinRun = pairRange.first;
+ int ichwLimRun = pairRange.second;
+ *pnDirDepth = pgts->getDirectionDepth(ichwMinNext);
+
+ //if (ichwLim > -1 && ichwLim < ichwLimRun)
+ //{
+ // // Stopping in the middle of a run
+ // return ichwLim;
+ //}
+
+ // We can at least go to the end of this run.
+ ichwLimRange = ichwLimRun;
+ if (ichwLimRun >= ichwTextLen)
+ {
+ // Hit the end of the text-source
+ return ichwLimRange;
+ }
+ else
+ {
+ // If the following run is the same as this run except for color and underlining,
+ // we don't have to break here.
+ if (!pgts->sameSegment(ichwMinNext, ichwLimRun))
+ return ichwLimRange;
+ }
+ ichwMinNext = ichwLimRun;
+ }
+
+ return ichwLimRange;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Read the version number from the tables, and return false if any are a version this
+ implementation of the engine can't handle.
+----------------------------------------------------------------------------------------------*/
+bool GrEngine::CheckTableVersions(GrIStream * pgrstrm,
+ byte *pSilfTbl, int lSilfStart,
+ byte *pGlobTbl, int lGlocStart,
+ byte *pFeatTbl, int lFeatStart,
+ int * pfxdBadVersion)
+{
+ pgrstrm->OpenBuffer(pSilfTbl, isizeof(int));
+ pgrstrm->SetPositionInFont(lSilfStart);
+ *pfxdBadVersion = ReadVersion(*pgrstrm);
+ pgrstrm->CloseBuffer();
+ if (*pfxdBadVersion > kSilfVersion)
+ return false;
+
+ pgrstrm->OpenBuffer(pGlobTbl, lGlocStart + isizeof(int));
+ pgrstrm->SetPositionInFont(lGlocStart);
+ *pfxdBadVersion = ReadVersion(*pgrstrm);
+ pgrstrm->CloseBuffer();
+ if (*pfxdBadVersion > kGlocVersion)
+ return false;
+
+ pgrstrm->OpenBuffer(pFeatTbl, isizeof(int));
+ pgrstrm->SetPositionInFont(lFeatStart);
+ *pfxdBadVersion = ReadVersion(*pgrstrm);
+ pgrstrm->CloseBuffer();
+ if (*pfxdBadVersion > kFeatVersion)
+ return false;
+
+ *pfxdBadVersion = 0;
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Reinterpret the version number from a font table.
+----------------------------------------------------------------------------------------------*/
+int GrEngine::ReadVersion(GrIStream & grstrm)
+{
+ int fxdVersion = grstrm.ReadIntFromFont();
+
+ if (fxdVersion < 0x00010000)
+ fxdVersion = 0x00010000; // kludge for bug with which some fonts were generated
+
+ return fxdVersion;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Initialize the engine from the test file. Used for test procedures.
+----------------------------------------------------------------------------------------------*/
+//:Ignore
+#ifdef OLD_TEST_STUFF
+void GrEngine::InitFromControlFileTest()
+{
+ IStreamPtr qstrm;
+ FileStream::Create(m_stuCtrlFile, STGM_READ, &qstrm);
+
+ int nSilfOffset, nGlocOffset, nGlatOffset, nFeatOffset;
+
+ nSilfOffset = ReadIntFromFont(qstrm);
+ nGlocOffset = ReadIntFromFont(qstrm);
+ nGlatOffset = ReadIntFromFont(qstrm);
+ nFeatOffset = ReadIntFromFont(qstrm);
+ nSill
+
+ // Read the "Silf" table.
+ int chwMaxGlyphID;
+ int fxdVersion;
+ ReadSilfTable(qstrm, nSilOffset, 0, &chwMaxGlyphID, &fxdVersion);
+
+ // Read the "Gloc" and "Glat" tables.
+ ReadGlocAndGlatTables(qstrm, nGlocOffset, qstrm, nGlatOffset, chwMaxGlyphID, fxdVersion);
+
+ // Read the "Feat" table.
+ ReadFeatTable(qstrm, nFeatOffset);
+}
+#endif // OLD_TEST_STUFF
+//:End Ignore
+
+
+/*----------------------------------------------------------------------------------------------
+ Return whether the text is asking for bold and/or italic text.
+----------------------------------------------------------------------------------------------*/
+void GrEngine::GetStyles(Font * pfont, int ichwMin, bool * pfBold, bool * pfItalic)
+{
+ *pfBold = pfont->bold();
+ *pfItalic = pfont->italic();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Switch the Graphics object between the Graphite table file and the base font.
+ Should only be called when we know we are using a base font, or when we are reading
+ the base font to see if it is valid.
+----------------------------------------------------------------------------------------------*/
+void GrEngine::SwitchGraphicsFont(bool fBase)
+{
+ Assert(!fBase || m_stuBaseFaceName.size() > 0);
+
+ //LgCharRenderProps chrp;
+ //pgg->get_FontCharProperties(&chrp);
+ //if (fBase)
+ //{
+ // wcsncpy(chrp.szFaceName, m_stuBaseFaceName.data(), m_stuBaseFaceName.size() + 1);
+ // chrp.szFaceName[31] = 0;
+ //}
+ //else
+ //{
+ // wcsncpy(chrp.szFaceName, m_stuFaceName.data(), m_stuFaceName.size() + 1);
+ // chrp.szFaceName[31] = 0;
+ //}
+ //pgg->SetupGraphics(&chrp);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Read the contents of the "Silf" table from the stream, which is on an extended
+ TrueType font file. Specifically, read the iSubTable-th sub-table (for now there is
+ only one).
+
+ WARNING: any changes to this method must be accompanied by equivalent changes to
+ CreateEmpty().
+----------------------------------------------------------------------------------------------*/
+bool GrEngine::ReadSilfTable(GrIStream & grstrm, long lTableStart, int iSubTable,
+ int * pchwMaxGlyphID, int * pfxdSilfVersion)
+{
+ grstrm.SetPositionInFont(lTableStart);
+
+ // version
+ *pfxdSilfVersion = ReadVersion(grstrm);
+ if (*pfxdSilfVersion > kSilfVersion)
+ // Version we don't know how to handle.
+ return false;
+
+ if (*pfxdSilfVersion >= 0x00030000)
+ // compiler version
+ grstrm.ReadIntFromFont();
+
+ // number of tables
+ unsigned short cSubTables = grstrm.ReadUShortFromFont();
+ Assert(cSubTables == 1); // for now
+ Assert(cSubTables <= kMaxSubTablesInFont);
+ if (cSubTables != 1 || cSubTables > kMaxSubTablesInFont)
+ return false;
+
+ if (*pfxdSilfVersion >= 0x00020000)
+ // reserved
+ grstrm.ReadShortFromFont();
+
+ // subtable offsets
+ int nSubTableOffsets[kMaxSubTablesInFont];
+ int i;
+ for (i = 0; i < cSubTables; i++)
+ {
+ nSubTableOffsets[i] = grstrm.ReadIntFromFont();
+ }
+
+ grstrm.SetPositionInFont(lTableStart + nSubTableOffsets[iSubTable]);
+
+ // Now we are at the beginning of the desired sub-table.
+
+ // Get the position of the start of the table.
+ long lSubTableStart;
+ grstrm.GetPositionInFont(&lSubTableStart);
+
+ // rule version
+ int fxdRuleVersion = (*pfxdSilfVersion >= 0x00030000) ?
+ ReadVersion(grstrm) :
+ *pfxdSilfVersion;
+
+ long lPassBlockPos = -1;
+ long lPseudosPos = -1;
+ if (*pfxdSilfVersion >= 0x00030000)
+ {
+ lPassBlockPos = grstrm.ReadUShortFromFont() + lSubTableStart;
+ lPseudosPos = grstrm.ReadUShortFromFont() + lSubTableStart;
+ }
+
+ // maximum glyph ID
+ data16 chwTmp;
+ *pchwMaxGlyphID = grstrm.ReadUShortFromFont();
+
+ // extra ascent and descent
+ m_mXAscent = grstrm.ReadShortFromFont();
+ m_mXDescent = grstrm.ReadShortFromFont();
+
+ // TODO: decide whether we want these:
+ m_mXAscent = 0;
+ m_mXDescent = 0;
+
+ // number of passes
+ byte cPasses = grstrm.ReadByteFromFont();
+ // index of first substitution pass
+ byte ipassSub1 = grstrm.ReadByteFromFont();
+ // index of first positioning pass
+ byte ipassPos1 = grstrm.ReadByteFromFont();
+ // index of first justification pass
+ byte ipassJust1 = grstrm.ReadByteFromFont();
+ // index of first reordered pass, or 0xFF if no reordering
+ byte ipassReordered1 = grstrm.ReadByteFromFont();
+ if (*pfxdSilfVersion < 0x00020000)
+ {
+ Assert(ipassJust1 == cPasses || ipassJust1 == ipassPos1);
+ ipassJust1 = ipassPos1;
+ }
+
+ // Sanity checks.
+ if (cPasses > kMaxPasses || ipassSub1 > cPasses || ipassPos1 > cPasses)
+ return false; // bad table
+
+ // line-break flag
+ int nLineBreak = grstrm.ReadByteFromFont();
+ if (nLineBreak != 0 && nLineBreak != 1)
+ return false; // bad table
+ m_fLineBreak = (bool)nLineBreak;
+
+ // range of possible cross-line-boundary contextualization
+ m_cchwPreXlbContext = grstrm.ReadByteFromFont();
+ m_cchwPostXlbContext = grstrm.ReadByteFromFont();
+
+ // actual glyph ID for pseudo-glyph (ID of bogus attribute)
+ byte bTmp; // unsigned
+ bTmp = grstrm.ReadByteFromFont();
+ m_chwPseudoAttr = bTmp;
+ // breakweight
+ bTmp = grstrm.ReadByteFromFont();
+ m_chwBWAttr = bTmp;
+ // directionality
+ bTmp = grstrm.ReadByteFromFont();
+ m_chwDirAttr = bTmp;
+
+ // Sanity checks--don't bother with these, I don't seem to be able to know what are reasonable values.
+ //if (m_chwPseudoAttr > 200 || m_chwBWAttr > 200 || m_chwDirAttr > 200)
+ // return false; // bad table
+
+ if (*pfxdSilfVersion >= 0x00020000)
+ {
+ // reserved
+ grstrm.ReadByteFromFont();
+ grstrm.ReadByteFromFont();
+
+ // justification levels
+ m_cJLevels = grstrm.ReadByteFromFont();
+ if (m_cJLevels > kMaxJLevels)
+ return false; // bad table
+ m_fBasicJust = (m_cJLevels == 0);
+ m_chwJStretch0 = 0xffff; // if no justification
+ m_chwJShrink0 = 0xffff;
+ m_chwJStep0 = 0xffff;
+ m_chwJWeight0 = 0xffff;
+ for (int i = 0; i < m_cJLevels; i++)
+ {
+ // justification glyph attribute IDs
+ bTmp = grstrm.ReadByteFromFont();
+ if (i == 0)
+ m_chwJStretch0 = bTmp;
+ bTmp = grstrm.ReadByteFromFont();
+ if (i == 0)
+ m_chwJShrink0 = bTmp;
+ bTmp = grstrm.ReadByteFromFont();
+ if (i == 0)
+ m_chwJStep0 = bTmp;
+ bTmp = grstrm.ReadByteFromFont();
+ if (i == 0)
+ m_chwJWeight0 = bTmp;
+ bTmp = grstrm.ReadByteFromFont(); // runto
+ // reserved
+ grstrm.ReadByteFromFont();
+ grstrm.ReadByteFromFont();
+ grstrm.ReadByteFromFont();
+ }
+ }
+ else
+ {
+ m_cJLevels = 0;
+ m_fBasicJust = true;
+ m_chwJStretch0 = 0xffff;
+ m_chwJShrink0 = 0xffff;
+ m_chwJStep0 = 0xffff;
+ m_chwJWeight0 = 0xffff;
+ }
+
+ // number of component attributes
+ chwTmp = grstrm.ReadUShortFromFont();
+ m_cComponents = chwTmp;
+
+ // number of user-defined slot attributes
+ m_cnUserDefn = grstrm.ReadByteFromFont();
+ if (m_cnUserDefn > kMaxUserDefinableSlotAttrs)
+ return false; // bad table
+
+ // max number of ligature components per glyph
+ m_cnCompPerLig = grstrm.ReadByteFromFont();
+ if (m_cnCompPerLig > 16)
+ return false; // bad table
+
+ // directions supported
+ bTmp = grstrm.ReadByteFromFont();
+ m_grfsdc = bTmp;
+ if (m_grfsdc > kfsdcHorizLtr + kfsdcHorizRtl + kfsdcVertFromLeft + kfsdcVertFromRight)
+ return false; // bad table
+
+ // reserved
+ bTmp = grstrm.ReadByteFromFont();
+ bTmp = grstrm.ReadByteFromFont();
+ bTmp = grstrm.ReadByteFromFont();
+
+ // critical features
+ int cCriticalFeatures;
+ if (*pfxdSilfVersion >= 0x00020000)
+ {
+ // reserved
+ bTmp = grstrm.ReadByteFromFont();
+
+ cCriticalFeatures = grstrm.ReadByteFromFont();
+ Assert(cCriticalFeatures == 0);
+ if (cCriticalFeatures != 0)
+ return false; // bad table
+
+ // reserved
+ bTmp = grstrm.ReadByteFromFont();
+ }
+
+ // rendering behaviors--ignore for now
+ byte cBehaviors = grstrm.ReadByteFromFont();
+ data16 chwBehaviors[kMaxRenderingBehavior];
+ for (i = 0; i < cBehaviors; i++)
+ {
+ chwBehaviors[i] = grstrm.ReadUShortFromFont();
+ }
+
+ // linebreak glyph ID
+ m_chwLBGlyphID = grstrm.ReadUShortFromFont();
+
+ // Jump to the beginning of the pass offset block, if we have this information.
+ if (*pfxdSilfVersion >= 0x00030000)
+ grstrm.SetPositionInFont(lPassBlockPos);
+ else
+ // Otherwise assume that's where we are!
+ Assert(lPassBlockPos == -1);
+
+ // offsets to passes, relative to the start of this subtable;
+ // note that we read (cPasses + 1) of these
+ int nPassOffsets[kMaxPasses];
+ for (i = 0; i <= cPasses; i++)
+ {
+ nPassOffsets[i] = grstrm.ReadIntFromFont();
+ }
+
+ // Jump to the beginning of the pseudo-glyph info block, if we have this information.
+ if (*pfxdSilfVersion >= 0x00030000)
+ grstrm.SetPositionInFont(lPseudosPos);
+ else
+ // Otherwise assume that's where we are!
+ Assert(lPseudosPos == -1);
+
+ // number of pseudo-glyphs and search constants
+ short snTmp;
+ snTmp = grstrm.ReadShortFromFont();
+ m_cpsd = snTmp;
+ snTmp = grstrm.ReadShortFromFont();
+ m_dipsdInit = snTmp;
+ snTmp = grstrm.ReadShortFromFont();
+ m_cPsdLoop = snTmp;
+ snTmp = grstrm.ReadShortFromFont();
+ m_ipsdStart = snTmp;
+
+ // unicode-to-pseudo map
+ m_prgpsd = new GrPseudoMap[m_cpsd];
+ for (i = 0; i < m_cpsd; i++)
+ {
+ if (*pfxdSilfVersion <= 0x00010000)
+ {
+ utf16 chwUnicode = grstrm.ReadUShortFromFont();
+ m_prgpsd[i].SetUnicode(chwUnicode);
+ }
+ else
+ {
+ int nUnicode = grstrm.ReadIntFromFont();
+ m_prgpsd[i].SetUnicode(nUnicode);
+ }
+ gid16 chwPseudo = grstrm.ReadUShortFromFont();
+ m_prgpsd[i].SetPseudoGlyph(chwPseudo);
+ }
+
+ // class table
+ m_pctbl = new GrClassTable();
+ if (!m_pctbl->ReadFromFont(grstrm, *pfxdSilfVersion))
+ return false;
+
+ // passes
+ return m_ptman->CreateAndReadPasses(grstrm, *pfxdSilfVersion, fxdRuleVersion,
+ cPasses, lSubTableStart, nPassOffsets,
+ ipassSub1, ipassPos1, ipassJust1, ipassReordered1);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set up the engine with no Graphite smarts at all, just dummy tables.
+----------------------------------------------------------------------------------------------*/
+void GrEngine::CreateEmpty()
+{
+ // Silf table
+
+ m_mXAscent = 0;
+ m_mXDescent = 0;
+
+ m_fLineBreak = false;
+
+ // range of possible cross-line-boundary contextualization
+ m_cchwPreXlbContext = 0;
+ m_cchwPostXlbContext = 0;
+
+ // Bogus attribute IDs:
+ m_chwPseudoAttr = 1; // actual glyph ID for pseudo-glyph (ID of bogus attribute)
+ m_chwBWAttr = 2; // breakweight
+ m_chwDirAttr = 3; // directionality
+
+ m_cComponents = 0; // number of component attributes
+
+ m_cnUserDefn = 0; // number of user-defined slot attributes
+ m_cnCompPerLig = 0; // max number of ligature components
+
+ m_grfsdc = kfsdcHorizLtr; // supported script direction
+
+ // linebreak glyph ID
+ m_chwLBGlyphID = 0xFFFE;
+
+ // number of pseudo-glyphs and search constants
+ m_cpsd = 0;
+ m_dipsdInit = 0;
+ m_cPsdLoop = 0;
+ m_ipsdStart = 0;
+
+ // class table
+ m_pctbl = new GrClassTable();
+ m_pctbl->CreateEmpty();
+
+ // passes
+ if (m_ptman != 0)
+ m_ptman->CreateEmpty();
+
+ // Gloc and Glat tables
+ m_pgtbl = new GrGlyphTable();
+ m_pgtbl->SetNumberOfGlyphs(0);
+ m_pgtbl->SetNumberOfComponents(0);
+ m_pgtbl->SetNumberOfStyles(1); // for now
+
+ m_pgtbl->CreateEmpty();
+
+ // Feat table
+ m_cfeat = 0;
+ m_rglcidFeatLabelLangs = NULL;
+ m_clcidFeatLabelLangs = 0;
+
+ // Language table
+ m_langtbl.CreateEmpty();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Create the glyph table and fill it in from the font stream.
+----------------------------------------------------------------------------------------------*/
+bool GrEngine::ReadGlocAndGlatTables(GrIStream & grstrmGloc, long lGlocStart,
+ GrIStream & grstrmGlat, long lGlatStart,
+ int chwGlyphIDMax, int fxdSilfVersion)
+{
+ // Determine the highest used glyph ID number.
+// int chwGlyphIDMax = m_chwLBGlyphID;
+// for (int ipsd = 0; ipsd < m_cpsd; ipsd++)
+// {
+// if (m_prgpsd[ipsd].PseudoGlyph() > chwGlyphIDMax)
+// chwGlyphIDMax = m_prgpsd[ipsd].PseudoGlyph();
+// }
+
+ // Create the glyph table.
+ m_pgtbl = new GrGlyphTable();
+ m_pgtbl->SetNumberOfGlyphs(chwGlyphIDMax + 1);
+ m_pgtbl->SetNumberOfComponents(m_cComponents);
+ m_pgtbl->SetNumberOfStyles(1); // for now
+
+ return m_pgtbl->ReadFromFont(grstrmGloc, lGlocStart, grstrmGlat, lGlatStart,
+ m_chwBWAttr, m_chwJStretch0, m_cJLevels, m_cnCompPerLig, fxdSilfVersion);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Read the contents of the "Feat" table from the stream, which is on an extended
+ TrueType font file.
+----------------------------------------------------------------------------------------------*/
+bool GrEngine::ReadFeatTable(GrIStream & grstrm, long lTableStart)
+{
+ short snTmp;
+ data16 chwTmp;
+ int nTmp;
+
+ grstrm.SetPositionInFont(lTableStart);
+
+ // version
+ int fxdVersion = ReadVersion(grstrm);
+ if (fxdVersion > kFeatVersion)
+ return false;
+
+ // number of features
+ int cfeat;
+ cfeat = grstrm.ReadUShortFromFont();
+ if (cfeat > kMaxFeatures)
+ return false; // bad table;
+
+ // reserved
+ chwTmp = grstrm.ReadUShortFromFont();
+ nTmp = grstrm.ReadIntFromFont();
+
+ std::vector<featid> vnIDs; // unsigned ints
+ std::vector<int> vnOffsets;
+ std::vector<int> vcfset;
+
+ m_cfeat = 0;
+ int ifeat;
+ for (ifeat = 0; ifeat < cfeat; ifeat++)
+ {
+ // ID
+ featid nID;
+ if (fxdVersion >= 0x00020000)
+ nID = (unsigned int)grstrm.ReadIntFromFont();
+ else
+ nID = grstrm.ReadUShortFromFont();
+ vnIDs.push_back(nID);
+ // number of settings
+ data16 cfset = grstrm.ReadUShortFromFont();
+ vcfset.push_back(cfset);
+ if (fxdVersion >= 0x00020000)
+ grstrm.ReadShortFromFont(); // pad bytes
+ // offset to settings list
+ nTmp = grstrm.ReadIntFromFont();
+ vnOffsets.push_back(nTmp);
+ // flags
+ chwTmp = grstrm.ReadUShortFromFont();
+ Assert(chwTmp == 0x8000); // mutually exclusive
+ // index into name table of UI label
+ int nNameId = grstrm.ReadShortFromFont();
+
+ if (fxdVersion <= 0x00020000 && nID == GrFeature::knLangFeatV2)
+ {
+ // Ignore the obsolete "lang" feature which has ID = 1
+ vnIDs.pop_back();
+ vcfset.pop_back();
+ vnOffsets.pop_back();
+ continue;
+ }
+ AddFeature(nID, nNameId, cfset);
+ }
+
+ // default feature setting value and name strings;
+ for (ifeat = 0; ifeat < m_cfeat; ifeat++)
+ {
+ GrFeature * pfeat = m_rgfeat + ifeat;
+ Assert(pfeat->ID() == vnIDs[ifeat]);
+
+ grstrm.SetPositionInFont(lTableStart + vnOffsets[ifeat]);
+
+ // Each feature has been initialized with blank spots for the number of settings
+ // it has.
+ int cfset = vcfset[ifeat];
+ Assert(pfeat->NumberOfSettings() == cfset);
+ for (int ifset = 0; ifset < cfset; ifset++)
+ {
+ snTmp = grstrm.ReadShortFromFont(); // yes, signed (TT feat table spec says unsigned)
+ short snTmp2 = grstrm.ReadShortFromFont();
+ pfeat->AddSetting(snTmp, snTmp2);
+
+ if (ifset == 0)
+ {
+ // default setting value--first in list
+ pfeat->SetDefault(snTmp);
+ }
+ }
+ }
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Read the contents of the "Sill" table from the stream, which is on an extended
+ TrueType font file.
+----------------------------------------------------------------------------------------------*/
+bool GrEngine::ReadSillTable(GrIStream & grstrm, long lTableStart)
+{
+ grstrm.SetPositionInFont(lTableStart);
+
+ // version
+ int fxdVersion = ReadVersion(grstrm);
+ if (fxdVersion > kSillVersion)
+ return false;
+
+ return m_langtbl.ReadFromFont(&grstrm, fxdVersion);
+}
+
+/*----------------------------------------------------------------------------------------------
+ An error happened in running the tables. Set up temporary dummy tables, and try running
+ with dumb rendering.
+ Return kresUnexpected if even running the empty tables crashed, kresFail otherwise.
+----------------------------------------------------------------------------------------------*/
+GrResult GrEngine::RunUsingEmpty(Segment * psegNew, Font * pfont,
+ GrCharStream * pchstrm, LayoutEnvironment & layout,
+ int ichStop,
+ float dxMaxWidth,
+ bool fNeedFinalBreak, bool fMoreText, bool fInfiniteWidth,
+ int ichwCallerBtLim,
+ int nDirDepth, SegEnd estJ)
+{
+ // Save the current state of the engine.
+ int mXAscentSave = m_mXAscent;
+ int mXDescentSave = m_mXDescent;
+ bool fLineBreakSave = m_fLineBreak;
+ int cchwPreXlbContextSave = m_cchwPreXlbContext;
+ int cchwPostXlbContextSave = m_cchwPostXlbContext;
+ data16 chwPseudoAttrSave = m_chwPseudoAttr;
+ data16 chwBWAttrSave = m_chwBWAttr;
+ data16 chwDirAttrSave = m_chwDirAttr;
+ int cComponentsSave = m_cComponents;
+ int cnUserDefnSave = m_cnUserDefn;
+ int cnCompPerLigSave = m_cnCompPerLig;
+ unsigned int grfsdcSave = m_grfsdc;
+ gid16 chwLBGlyphIDSave = m_chwLBGlyphID;
+ int cpsdSave = m_cpsd;
+ int dipsdInitSave = m_dipsdInit;
+ int cPsdLoopSave = m_cPsdLoop;
+ int ipsdStartSave = m_ipsdStart;
+ GrTableManager * ptmanSave = m_ptman;
+ GrClassTable * pctblSave = m_pctbl;
+ GrGlyphTable * pgtblSave = m_pgtbl;
+ int cfeatSave = m_cfeat;
+ GrResult resFontReadSave = m_resFontRead;
+
+ GrResult res = kresFail;
+
+ pchstrm->Restart();
+
+ // Create dummy versions of the tables and run them.
+ m_pctbl = NULL;
+ m_pgtbl = NULL;
+ m_ptman = new GrTableManager(this);
+ m_ptman->State()->SetFont(pfont);
+ CreateEmpty();
+
+ try
+ {
+ m_ptman->Run(psegNew, pfont, pchstrm, NULL, kjmodiNormal, layout,
+ ichStop, dxMaxWidth, 0,
+ fNeedFinalBreak, fMoreText, -1, fInfiniteWidth, false,
+ ichwCallerBtLim,
+ nDirDepth, estJ);
+ }
+ catch(...)
+ {
+ // Still didn't work. Oh, well, not much we can do.
+ res = kresUnexpected;
+ }
+
+ psegNew->SetErroneous(true);
+
+ if (m_ptman)
+ delete m_ptman;
+ if (m_pctbl)
+ delete m_pctbl;
+ if (m_pgtbl)
+ delete m_pgtbl;
+
+ // Put everything back the way it was.
+ m_mXAscent = mXAscentSave;
+ m_mXDescent = mXDescentSave;
+ m_fLineBreak = fLineBreakSave;
+ m_cchwPreXlbContext = cchwPreXlbContextSave;
+ m_cchwPostXlbContext = cchwPostXlbContextSave;
+ m_chwPseudoAttr = chwPseudoAttrSave;
+ m_chwBWAttr = chwBWAttrSave;
+ m_chwDirAttr = chwDirAttrSave;
+ m_cComponents = cComponentsSave;
+ m_cnUserDefn = cnUserDefnSave;
+ m_cnCompPerLig = cnCompPerLigSave;
+ m_grfsdc = grfsdcSave;
+ m_chwLBGlyphID = chwLBGlyphIDSave;
+ m_cpsd = cpsdSave;
+ m_dipsdInit = dipsdInitSave;
+ m_cPsdLoop = cPsdLoopSave;
+ m_ipsdStart = ipsdStartSave;
+ m_ptman = ptmanSave;
+ m_pctbl = pctblSave;
+ m_pgtbl = pgtblSave;
+ m_cfeat = cfeatSave;
+ m_resFontRead = resFontReadSave;
+
+ return res;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the glyph ID for the given Unicode value.
+----------------------------------------------------------------------------------------------*/
+gid16 GrEngine::GetGlyphIDFromUnicode(int nUnicode)
+{
+ gid16 chwGlyphID = MapToPseudo(nUnicode);
+ if (chwGlyphID != 0)
+ return chwGlyphID; // return a pseudo-glyph
+
+#ifdef OLD_TEST_STUFF
+ if (!m_pCmap31)
+ // test procedures
+ return chwUnicode;
+#endif // OLD_TEST_STUFF
+
+ // Otherwise, get the glyph ID from the font's cmap.
+
+ if (m_pCmap_3_10)
+ return gid16(TtfUtil::Cmap310Lookup(m_pCmap_3_10, nUnicode));
+ else if (m_pCmap_3_1)
+ return gid16(TtfUtil::Cmap31Lookup(m_pCmap_3_1, nUnicode));
+ else
+ return 0;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the pseudo-glyph corresponding to the given Unicode input, or 0 if none.
+----------------------------------------------------------------------------------------------*/
+gid16 GrEngine::MapToPseudo(int nUnicode)
+{
+ if (m_cpsd == 0)
+ return 0;
+
+#ifdef _DEBUG
+ int nPowerOf2 = 1;
+ while (nPowerOf2 <= m_cpsd)
+ nPowerOf2 <<= 1;
+ nPowerOf2 >>= 1;
+ // Now nPowerOf2 is the max power of 2 <= m_cpds
+ Assert((1 << m_cPsdLoop) == nPowerOf2); // m_cPsdLoop == log2(nPowerOf2)
+ Assert(m_dipsdInit == nPowerOf2);
+ Assert(m_ipsdStart == m_cpsd - m_dipsdInit);
+#endif // _DEBUG
+
+ int dipsdCurr = m_dipsdInit;
+
+ GrPseudoMap * ppsdCurr = m_prgpsd + m_ipsdStart;
+ while (dipsdCurr > 0)
+ {
+ int nTest;
+ if (ppsdCurr < m_prgpsd)
+ nTest = -1;
+ else
+ nTest = ppsdCurr->Unicode() - nUnicode;
+
+ if (nTest == 0)
+ return ppsdCurr->PseudoGlyph();
+
+ dipsdCurr >>= 1; // divide by 2
+ if (nTest < 0)
+ ppsdCurr += dipsdCurr;
+ else // (nTest > 0)
+ ppsdCurr -= dipsdCurr;
+ }
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the actual glyph ID to use for glyph metrics and output. For most glyphs, this
+ is just the glyph ID we're already working with, but for pseudo-glyphs it will something
+ different.
+----------------------------------------------------------------------------------------------*/
+gid16 GrEngine::ActualGlyphForOutput(gid16 chwGlyphID)
+{
+ gid16 chwActual = gid16(GlyphAttrValue(chwGlyphID, m_chwPseudoAttr));
+ if (chwActual == 0)
+ return chwGlyphID; // not a pseudo, we're already working with the actual glyph ID
+ else
+ return chwActual;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Look up name based on lang id and name id in name table.
+ Currently used to look up feature names.
+----------------------------------------------------------------------------------------------*/
+std::wstring GrEngine::StringFromNameTable(int nLangID, int nNameID)
+{
+ std::wstring stuName;
+ stuName.erase();
+ size_t lOffset = 0, lSize = 0;
+
+ // The Graphite compiler stores our names in either
+ // the MS (platform id = 3) Unicode (writing system id = 1) table
+ // or the MS Symbol (writing system id = 0) table. Try MS Unicode first.
+ // lOffset & lSize are in bytes.
+ // new interface:
+ if (!TtfUtil::GetNameInfo(m_pNameTbl, 3, 1, nLangID, nNameID, lOffset, lSize))
+ {
+ if (!TtfUtil::GetNameInfo(m_pNameTbl, 3, 0, nLangID, nNameID, lOffset, lSize))
+ {
+ return stuName;
+ }
+ }
+
+ size_t cchw = (unsigned(lSize) / sizeof(utf16));
+ utf16 * pchwName = new utf16[cchw+1]; // lSize - byte count for Uni str
+ const utf16 *pchwSrcName = reinterpret_cast<const utf16*>(m_pNameTbl + lOffset);
+ std::transform(pchwSrcName, pchwSrcName + cchw, pchwName, std::ptr_fun<utf16,utf16>(lsbf));
+ pchwName[cchw] = 0; // zero terminate
+ #ifdef _WIN32
+ stuName.assign((const wchar_t*)pchwName, cchw);
+ #else
+ wchar_t * pchwName32 = new wchar_t[cchw+1]; // lSize - byte count for Uni str
+ for (int i = 0; i <= signed(cchw); i++) {
+ pchwName32[i] = pchwName[i];
+ }
+ stuName.assign(pchwName32, cchw);
+ delete [] pchwName32;
+ #endif
+
+ delete [] pchwName;
+ return stuName;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Add a feature (eg, when loading from the font).
+----------------------------------------------------------------------------------------------*/
+void GrEngine::AddFeature(featid nID, int nNameId, int cfset, int nDefault)
+{
+ if (m_cfeat >= kMaxFeatures)
+ return;
+
+ int ifeat = m_cfeat;
+ m_rgfeat[ifeat].Initialize(nID, nNameId, cfset, nDefault);
+// m_hmnifeat.Insert(nID, ifeat);
+ m_cfeat++;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the feature with the given ID, or NULL if none.
+----------------------------------------------------------------------------------------------*/
+GrFeature * GrEngine::FeatureWithID(featid nID, int * pifeat)
+{
+ for (int ifeat = 0; ifeat < m_cfeat; ifeat++)
+ {
+ if (m_rgfeat[ifeat].ID() == nID)
+ {
+ *pifeat = ifeat;
+ return m_rgfeat + ifeat;
+ }
+ }
+ *pifeat = -1;
+ return NULL;
+
+
+ // Alternate implementation if we end up with so many features that we need to use
+ // a hash map:
+// int ifeat;
+// if (m_hmnifeat.Retrieve(nID, &ifeat))
+// {
+// Assert(ifeat < kMaxFeatures);
+// return m_rgfeat + ifeat; // may be NULL
+// }
+// else
+// return NULL;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the default for the feature at the given index in the array.
+----------------------------------------------------------------------------------------------*/
+int GrEngine::DefaultForFeatureAt(int ifeat)
+{
+ Assert(ifeat < kMaxFeatures);
+ if (ifeat >= m_cfeat || ifeat < 0)
+ return 0; // undefined feature
+
+ return m_rgfeat[ifeat].DefaultValue();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set the default for the feature at the given index in the array.
+----------------------------------------------------------------------------------------------*/
+void GrEngine::SetDefaultForFeatureAt(int ifeat, int nValue)
+{
+ Assert(ifeat < kMaxFeatures);
+ Assert(ifeat < m_cfeat);
+ if (ifeat >= 0)
+ m_rgfeat[ifeat].SetDefault(nValue);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the default feature settings for the given language.
+----------------------------------------------------------------------------------------------*/
+void GrEngine::DefaultsForLanguage(isocode lgcode,
+ std::vector<featid> & vnFeats, std::vector<int> & vnValues)
+{
+ m_langtbl.LanguageFeatureSettings(lgcode, vnFeats, vnValues);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Initialize the directionality and breakweight attributes of a new slot based on its
+ glyph ID.
+ REVIEW: we could optimize by not initializing from the glyph table right away,
+ but waiting until we need the value.
+----------------------------------------------------------------------------------------------*/
+void GrEngine::InitSlot(GrSlotState * pslot, int nUnicode)
+{
+ gid16 chwGlyphID = pslot->GlyphID();
+
+ if (m_ptman->InternalJustificationMode() != kjmodiNormal)
+ {
+ if (m_cJLevels > 0)
+ {
+ Assert(m_cJLevels == 1); // for now
+ // TODO: do this at level 0.
+ pslot->SetJStretch(m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwJStretch0));
+ pslot->SetJShrink( m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwJShrink0));
+ pslot->SetJStep( m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwJStep0));
+ pslot->SetJWeight( m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwJWeight0));
+ }
+ else if (nUnicode == knSpace)
+ {
+ // Basic stretch/shrink for whitespace.
+ // TODO: do this at level 0.
+ Assert(m_fBasicJust);
+ int mAdv = pslot->AdvanceX(m_ptman);
+ pslot->SetJStretch(mAdv * 100); // stretch up to 100 times natural width
+ pslot->SetJShrink(mAdv / 4); // shrink to 75%
+ pslot->SetJWeight(1);
+ }
+ }
+
+ if (m_pgtbl && !m_pgtbl->IsEmpty())
+ {
+ // Initialize from glyph table.
+ pslot->SetBreakWeight(m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwBWAttr));
+
+ DirCode dirc = DirCode(m_pgtbl->GlyphAttrValue(chwGlyphID, m_chwDirAttr));
+ if (BidiCode(nUnicode) && (chwGlyphID == 0 || dirc == kdircNeutral))
+ // A built-in character for the bidi algorithm that is not defined in the font but
+ // must be given a special directionality:
+ goto LDefaults;
+
+ pslot->SetDirectionality(dirc);
+
+ return;
+ }
+
+LDefaults:
+ // Otherwise, in fill defaults for some basic values.
+ if (pslot->BreakWeight() == GrSlotState::kNotYetSet8)
+ {
+ switch (nUnicode)
+ {
+ case knSpace:
+ pslot->SetBreakWeight(klbWordBreak);
+ break;
+ case knHyphen:
+ pslot->SetBreakWeight(klbHyphenBreak);
+ break;
+ default:
+ pslot->SetBreakWeight(klbLetterBreak);
+ }
+ }
+
+ if ((int)pslot->Directionality() == GrSlotState::kNotYetSet8)
+ {
+ switch (nUnicode)
+ {
+ case knSpace:
+ pslot->SetDirectionality(kdircWhiteSpace);
+ break;
+ case knLRM:
+ pslot->SetDirectionality(kdircL);
+ break;
+ case knRLM:
+ pslot->SetDirectionality(kdircR);
+ break;
+ case knLRO:
+ pslot->SetDirectionality(kdircLRO);
+ break;
+ case knRLO:
+ pslot->SetDirectionality(kdircRLO);
+ break;
+ case knLRE:
+ pslot->SetDirectionality(kdircLRE);
+ break;
+ case knRLE:
+ pslot->SetDirectionality(kdircRLE);
+ break;
+ case knPDF:
+ pslot->SetDirectionality(kdircPDF);
+ break;
+ default:
+ if (chwGlyphID == LBGlyphID())
+ pslot->SetDirectionality(kdircNeutral);
+ else
+ pslot->SetDirectionality(kdircL);
+ }
+ }
+ else
+ Assert(false); // currently no way to set directionality ahead of time
+}
+
+/*----------------------------------------------------------------------------------------------
+ We have just changed this slot's glyph ID. Change the directionality and breakweight
+ attributes of a new slot based on its glyph ID.
+----------------------------------------------------------------------------------------------*/
+void GrEngine::SetSlotAttrsFromGlyphAttrs(GrSlotState * pslot)
+{
+ InitSlot(pslot);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Create a new segment.
+----------------------------------------------------------------------------------------------*/
+void GrEngine::NewSegment(Segment ** ppseg)
+{
+ *ppseg = new Segment;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Methods to pass on to the tables.
+----------------------------------------------------------------------------------------------*/
+gid16 GrEngine::GetClassGlyphIDAt(int nClass, int nIndex)
+{
+ if (nIndex < 0)
+ return 0;
+ if (nClass < 0)
+ return 0;
+
+ try {
+ return m_pctbl->GetGlyphID(nClass, nIndex);
+ }
+ catch (...)
+ {
+ return 0;
+ }
+}
+
+int GrEngine::GetIndexInGlyphClass(int nClass, gid16 chwGlyphID)
+{
+ try {
+ return m_pctbl->FindIndex(nClass, chwGlyphID);
+ }
+ catch (...)
+ {
+ return -1;
+ }
+}
+
+size_t GrEngine::NumberOfGlyphsInClass(int nClass)
+{
+ try {
+ return m_pctbl->NumberOfGlyphsInClass(nClass);
+ }
+ catch (...)
+ {
+ return 0;
+ }
+}
+
+int GrEngine::GlyphAttrValue(gid16 chwGlyphID, int nAttrID)
+{
+#ifdef OLD_TEST_STUFF
+ if (!m_pgtbl) // test procedures
+ return 0;
+#endif // OLD_TEST_STUFF
+
+ return m_pgtbl->GlyphAttrValue(chwGlyphID, nAttrID);
+}
+
+int GrEngine::ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID)
+{
+#ifdef OLD_TEST_STUFF
+ if (!m_pgtbl) // test procedures
+ return -1;
+#endif // OLD_TEST_STUFF
+
+ return m_pgtbl->ComponentIndexForGlyph(chwGlyphID, nCompID);
+}
+
+
+//:>********************************************************************************************
+//:> For test procedures
+//:>********************************************************************************************
+
+//:Ignore
+
+#ifdef OLD_TEST_STUFF
+
+void GrEngine::SetUpPseudoGlyphTest()
+{
+ m_cpsd = 5;
+
+ m_prgpsd = new GrPseudoMap[m_cpsd];
+
+ m_prgpsd[0].SetUnicode(65);
+ m_prgpsd[0].SetPseudoGlyph(1065);
+
+ m_prgpsd[1].SetUnicode(66);
+ m_prgpsd[1].SetPseudoGlyph(1066);
+
+ m_prgpsd[2].SetUnicode(67);
+ m_prgpsd[2].SetPseudoGlyph(1067);
+
+ m_prgpsd[3].SetUnicode(68);
+ m_prgpsd[3].SetPseudoGlyph(1068);
+
+ m_prgpsd[4].SetUnicode(69);
+ m_prgpsd[4].SetPseudoGlyph(1069);
+
+ m_dipsdInit = 4;
+ m_cPsdLoop = 2;
+ m_ipsdStart = 1;
+}
+
+#endif // OLD_TEST_STUFF
+
+
+//:>********************************************************************************************
+//:> New interface
+//:>********************************************************************************************
+/*----------------------------------------------------------------------------------------------
+ Store the default features values as specified by the client.
+----------------------------------------------------------------------------------------------*/
+void GrEngine::AssignDefaultFeatures(int cfeat, FeatureSetting * prgfset)
+{
+ for (int ifeatIn = 0; ifeatIn < cfeat; ifeatIn++)
+ {
+ int ifeat;
+ FeatureWithID(prgfset[ifeatIn].id, &ifeat);
+ if (ifeat >= 0 )
+ SetDefaultForFeatureAt(ifeat, prgfset[ifeatIn].value);
+ }
+}
+
+bool GrEngine::LoggingTransduction()
+{
+ Assert(false);
+ //return m_pfface->getLogging();
+ //return m_fLogXductn;
+ return true;
+}
+
+} // namespace gr
+
+//:End Ignore
+
diff --git a/Build/source/libs/graphite/src/segment/GrEngine.h b/Build/source/libs/graphite/src/segment/GrEngine.h
new file mode 100644
index 00000000000..81b54e805bc
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrEngine.h
@@ -0,0 +1,622 @@
+/*--------------------------------------------------------------------
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrEngine.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Contains the definition of the GrEngine class.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GR_ENGINE_INCLUDED
+#define GR_ENGINE_INCLUDED
+#include <limits>
+
+#ifdef _MSC_VER
+#include <crtdbg.h>
+#endif
+
+namespace gr
+{
+class IGrJustifier;
+class Segment;
+
+
+/*----------------------------------------------------------------------------------------------
+ The GrEngine serves as the top level object that knows how to run Graphite tables
+ and generate Graphite segments.
+
+ Primarily, this class implements IRenderEngine, which allows it to serve as a FW
+ rendering engine. It also implements ISimpleInit, a general interface for initializing
+ using a string. Finally, it implements ITraceControl, a very simple interface which
+ allows a client to flip a flag indicating whether or not we want to output a log of
+ the Graphite transduction process.
+
+ Hungarian: greng
+----------------------------------------------------------------------------------------------*/
+class GrEngine : public GraphiteProcess
+{
+ friend class FontFace;
+ friend class FontMemoryUsage;
+
+public:
+ // Constructors & destructors:
+ GrEngine();
+ void BasicInit();
+ virtual ~GrEngine();
+ void DestroyContents(bool fDestroyCmap = true);
+
+ // ISimpleInit methods:
+ ////GrResult InitNew(const byte * prgb, int cb); -- obsolete
+ ////GrResult get_InitializationData(int cchMax, OLECHAR * rgchw, int * pcch); -- obsolete
+
+ // ITraceControl methods:
+ //GrResult SetTracing(int n);
+ //GrResult GetTracing(int * pnOptions);
+
+ // IRenderingFeatures methods:
+ //GrResult GetFeatureIDs(int cMax, int * prgFids, int * pcfid);
+ //GrResult GetFeatureLabel(int fid, int nLanguage, int cchMax, OLECHAR * rgchw, int * pcch);
+ //GrResult GetFeatureValues(int fid, int cfvalMax,
+ // int * prgfval, int * pcfval, int * pfvalDefault);
+ //GrResult GetFeatureValueLabel(int fid, int fval, int nLanguage,
+ // int cchMax, OLECHAR * rgchw, int * pcch);
+
+ // IRenderEngine methods:
+ ////GrResult InitRenderer(IGrGraphics * pgg, OLECHAR * prgchData, int cchData); -- obsolete
+ ////GrResult FontIsValid(OLECHAR * prgchwErrMsg, int cchMaxErrMsg);
+
+ GrResult get_SegDatMaxLength(int * pcb);
+
+ //GrResult FindBreakPoint(Font * pfont, ITextSource * pgts, DELETE
+ // int ichMin, int ichLim, int ichLimBacktrack,
+ // bool fNeedFinalBreak,
+ // bool fStartLine,
+ // float dxMaxWidth,
+ // LineBrk lbPref, LineBrk lbMax,
+ // TrWsHandling twsh, bool fParaRtoL,
+ // Segment ** ppsegRet,
+ // int * pdichwLimSeg, float * pdxWidth, SegEnd * pest,
+ // int cbPrev, byte * pbPrevSegDat,
+ // int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat,
+ // int * pdichwContext,
+ // std::ostream * pstrmLog,
+ // OLECHAR * prgchwErrMsg, int cchMaxErrMsg);
+
+ //GrResult FindBreakPointWJust(Font * pfont, ITextSource * pgts, IGrJustifier * pgjus,
+ // int ichMin, int ichLim, int ichLimBacktrack, DELETE
+ // bool fNeedFinalBreak,
+ // bool fStartLine,
+ // float dxMaxWidth,
+ // LineBrk lbPref, LineBrk lbMax,
+ // TrWsHandling twsh, bool fParaRtoL,
+ // Segment ** ppsegRet,
+ // int * pdichwLimSeg, float * pdxWidth, SegEnd * pest,
+ // int cbPrev, byte * pbPrevSegDat,
+ // int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat,
+ // int * pdichwContext,
+ // std::ostream * pstrmLog,
+ // OLECHAR * prgchwErrMsg, int cchMaxErrMsg);
+
+ GrResult get_ScriptDirection(unsigned int * pgrfsdc, OLECHAR * prgchwErrMsg, int cchMaxErrMsg);
+
+ // DELETE
+ //GrResult MakeJustifiedSegment(Font * pfont, ITextSource * pgts, IGrJustifier * pgj,
+ // int ichMin, int ichLim,
+ // bool fStartLine, bool fEndLine,
+ // float dxUnjustifiedWidth, float dxJustifiedWidth,
+ // TrWsHandling twsh, SegEnd est, LineBrk lb,
+ // bool fParaRtl,
+ // Segment ** ppsegRet, float * pdxWidth,
+ // //int cbPrev, byte * pbPrevSegDat, int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat, int * pdichwContext,
+ // std::ostream * pstrmLog,
+ // OLECHAR * prgchwErrMsg, int cchwMaxErrMsg);
+
+ // IJustifyingRenderer methods:
+ // These methods return kresInvalidArg if the attribute ID is invalid or inappropriate;
+ // kresFail if the engine is not in an appropriate state to return the information.
+ virtual GrResult getGlyphAttribute(int iGlyph, int jgat, int nLevel, float * pValueRet);
+ virtual GrResult getGlyphAttribute(int iGlyph, int jgat, int nLevel, int * pValueRet);
+ virtual GrResult setGlyphAttribute(int iGlyph, int jgat, int nLevel, float value);
+ virtual GrResult setGlyphAttribute(int iGlyph, int jgat, int nLevel, int value);
+
+ // Interface methods not used by FW:
+
+ ////GrResult IsGraphiteFont(IGrGraphics * pgg); -- obsolete
+
+ ////GrResult FontAscentAndDescent(IGrGraphics * pgg, int * pysAscent, int * pysDescent); -- obsolete
+
+ //GrResult MakeMeasuredSegment(
+ // Font * pfont, ITextSource * pgts,
+ // int ichMin, int ichLim,
+ // bool fParaRtl,
+ // Segment ** ppsegRet, SegEnd * pest,
+ // std::ostream * pstrmLog,
+ // OLECHAR * prgchwErrMsg, int cchMaxErrMsg);
+
+ //GrResult MakeSegmentFromRange(Font * pfont, ITextSource * pgts, IGrJustifier * pgj,
+ // int ichMin, int ichLim,
+ // bool fStartLine, bool fEndLine,
+ // TrWsHandling twsh, bool fParaRtl,
+ // Segment ** ppsegRet, float * pdxWidth, SegEnd * pest,
+ // int cbPrev, byte * pbPrevSegDat, int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat,
+ // int * pdichwContext,
+ // std::ostream * pstrmLog,
+ // OLECHAR * prgchwErrMsg, int cchwMaxErrMsg);
+
+ // NEW interface
+
+ GrResult ReadFontTables(Font * pfont, bool fItalic);
+
+ FontErrorCode IsValidForGraphite(int * pnVersion, int * pnSubVersion);
+
+ // Other public methods
+
+ GrResult FindBreakPointAux(Font * pfont, ITextSource * pgts, IGrJustifier * pgjus,
+ int ichwMin, int ichwLim, int ichwLimBacktrack,
+ bool fNeedFinalBreakArg, bool fStartLine, bool fEndLine,
+ float dxMaxWidth, bool fWidthIsCharCount,
+ LineBrk lbPref, LineBrk lbMax, TrWsHandling twsh, bool fParaRtl,
+ Segment ** ppsegRet,
+ int * pdichwLimSeg,
+ float * pdxWidth, SegEnd * pest,
+ int cbPrev, byte * pbPrevSegDat,
+ int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat,
+ int * pdichwContext,
+ std::ostream * pstrmLog,
+ OLECHAR * prgchwErrMsg, int cchMaxErrMsg);
+
+ gid16 GetGlyphIDFromUnicode(int nUnicode);
+ gid16 ActualGlyphForOutput(utf16 chwGlyphID);
+
+ int GetFontEmUnits()
+ {
+ return m_mFontEmUnits;
+ }
+
+ gid16 LBGlyphID()
+ {
+ return m_chwLBGlyphID;
+ }
+
+ gid16 GetClassGlyphIDAt(int nClass, int nIndex);
+ int GetIndexInGlyphClass(int nClass, gid16 chwGlyphID);
+ size_t NumberOfGlyphsInClass(int nClass);
+ int GlyphAttrValue(gid16 chwGlyphID, int nAttrID);
+ int ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID);
+
+ ////void InitFontName(std::wstring stuInitialize, std::wstring & stuFaceName, std::wstring & stuFeatures); -- obsolete
+ void RecordFontLoadError(OLECHAR * prgchwErrMsg, int cchMaxErrMsg);
+ void RecordFontRunError(OLECHAR * prgchwErrMsg, int cchMaxErrMsg, GrResult res);
+ void ClearFontError(OLECHAR * prgchwErrMsg, int cchMaxErrMsg);
+ void GetWritingSystemDirection(ITextSource * pgts, int ichwMin);
+ ////GrResult SetUp(IGrGraphics * pgg, std::wstring stuFeatures); -- obsolete
+ ////GrResult SetUp(IGrGraphics * pgg, std::wstring stuFeaturesArg, bool fBold, bool fItalic); -- obsolete
+
+ GrResult RunUsingEmpty(Segment * psegNew, Font * pfont,
+ GrCharStream * pchstrm, LayoutEnvironment & layout,
+ int ichStop,
+ float dxMaxWidth,
+ bool fNeedFinalBreak, bool fMoreText, bool fInfiniteWidth,
+ int ichwCallerBtLim,
+ int nDirDepth, SegEnd estJ);
+ bool InErrorState()
+ {
+ return m_fInErrorState;
+ }
+
+ std::wstring FaceName()
+ {
+ return m_stuFaceName;
+ }
+ std::wstring BaseFaceName()
+ {
+ Assert(m_stuBaseFaceName.size() == 0 || m_fUseSepBase);
+ return m_stuBaseFaceName; // empty if not using separate base font
+ }
+ bool Bold()
+ {
+ return m_fBold;
+ }
+ bool Italic()
+ {
+ return m_fItalic;
+ }
+
+ void GetStyles(Font * pfont, int ichwMin, bool * pfBold, bool * pfItalic);
+ void SwitchGraphicsFont(bool fBase);
+
+ void AddFeature(featid nID, int nNameId, int cfset, int nDefault = 0);
+ GrFeature * FeatureWithID(featid nID, int * pifeat);
+ int DefaultForFeatureAt(int ifeat);
+ void SetDefaultForFeatureAt(int ifeat, int nValue);
+ GrFeature * Feature(int ifeat)
+ {
+ if (ifeat >= kMaxFeatures)
+ return NULL;
+ return m_rgfeat + ifeat;
+ }
+ void DefaultsForLanguage(isocode lgcode,
+ std::vector<featid> & vnFeats, std::vector<int> & vnValues);
+ std::wstring StringFromNameTable(int nNameId, int nLang);
+
+ void InitSlot(GrSlotState *, int nUnicode = -1);
+ void SetSlotAttrsFromGlyphAttrs(GrSlotState *);
+
+ bool RightToLeft()
+ {
+ return m_fRightToLeft;
+ }
+ int TopDirectionLevel()
+ {
+ return (m_fRightToLeft) ? 1 : 0;
+ }
+
+ GrGlyphTable * GlyphTable()
+ {
+ return m_pgtbl;
+ }
+
+ GrClassTable * ClassTable()
+ {
+ return m_pctbl;
+ }
+
+ int NumFeat()
+ {
+ return m_cfeat;
+ }
+
+ bool LineBreakFlag()
+ {
+ return m_fLineBreak;
+ }
+
+ int PreXlbContext()
+ {
+ return m_cchwPreXlbContext;
+ }
+
+ int PostXlbContext()
+ {
+ return m_cchwPostXlbContext;
+ }
+
+ int ExtraAscent()
+ {
+ return m_mXAscent;
+ }
+
+ int ExtraDescent()
+ {
+ return m_mXDescent;
+ }
+
+ float VerticalOffset()
+ {
+ return m_dysOffset;
+ }
+
+ int NumUserDefn()
+ {
+ return m_cnUserDefn;
+ }
+
+ int NumCompPerLig()
+ {
+ return m_cnCompPerLig;
+ }
+
+ bool BasicJustification()
+ {
+ return m_fBasicJust;
+ }
+
+ bool LoggingTransduction();
+ //{
+ // return m_pfface->getLogging();
+ // //return m_fLogXductn;
+ //}
+
+ bool FakeItalic()
+ {
+ return m_fFakeItalic;
+ }
+
+ void NewSegment(Segment ** ppseg);
+
+ static int ReadVersion(GrIStream & grstrm);
+
+ /*----------------------------------------------------------------------------------------------
+ Function to convert between coordinate systems.
+ This is identical to the built-in MulDiv function except that it rounds with better
+ precision.
+
+ TODO: move these out of GrEngine to someplace more general.
+ ----------------------------------------------------------------------------------------------*/
+ inline static int GrIntMulDiv(const int v, const int n, const int d)
+ {
+ return int(n < 0 ?
+ (double(v * n)/double(d)) - 0.5 :
+ (double(v * n)/double(d)) + 0.5);
+ }
+ inline static float GrFloatMulDiv(const float v, const float n, const float d)
+ {
+ return v * n / d;
+ }
+ inline static float GrIFIMulDiv(const int v, const float n, const int d)
+ {
+ return float(double(v) * n / double(d));
+ }
+ inline static int GrFIFMulDiv(const float v, const int n, const float d)
+ {
+ return int(n < 0 ?
+ (v * double(n) / double(d)) - 0.5 :
+ (v * double(n) / double(d)) + 0.5);
+ }
+ inline static int RoundFloat(const float n)
+ {
+ return int(n < 0 ? n - 0.5 : n + 0.5);
+ }
+
+protected:
+ // Member variables:
+
+ long m_cref;
+
+ //////////// Font information ////////////
+
+ bool m_fBold;
+ bool m_fItalic;
+
+ // do we have the capacity to perform smart rendering for the various styles?
+ bool m_fSmartReg;
+ bool m_fSmartBold;
+ bool m_fSmartItalic;
+ bool m_fSmartBI;
+ // are the italics faked using a slant?
+ bool m_fFakeItalicCache;
+ bool m_fFakeBICache;
+ // control files for styled text; empty means not yet determined
+ std::wstring m_strCtrlFileReg; // regular
+ std::wstring m_strCtrlFileBold; // bold
+ std::wstring m_strCtrlFileItalic; // italic
+ std::wstring m_strCtrlFileBI; // bold-italic
+
+ bool m_fFakeItalic; // true if we are simulating an italic slant in positioning
+
+ std::wstring m_stuCtrlFile; // control file (.ttf file) from which we got
+ // currently loaded files
+
+ std::wstring m_stuInitError; // description of any error that happened while initializing
+ // the engine
+ std::wstring m_stuErrCtrlFile; // file for which the error occurred
+
+ std::wstring m_stuFaceName; // eg, "Times New Roman"
+ std::wstring m_stuFeatures;
+
+ bool m_fUseSepBase;
+ std::wstring m_stuBaseFaceName; // from Sile table; empty if we are not using a separate
+ // control file
+
+ GrResult m_resFontRead; // kresOk if the Graphite font was loaded successfully;
+ // kresFail if the font could not be found or basic tables couldn't be read;
+ // kresFalse if the Silf table is not present;
+ // kresUnexpected if the Graphite tables could not be loaded
+
+ GrResult m_resFontValid; // kresInvalidArg if the engine is not yet initialized
+ // Originally:
+ // kresOk if Graphite font & dc font match cmaps
+ // kresUnexpected/kresFalse if dumb rendering
+ // kresFail if dumb rendering with no cmap
+ // But now it is apparently just = to m_resFontRead otherwise.
+ FontErrorCode m_ferr;
+ int m_fxdBadVersion;
+
+ int m_nFontCheckSum; // when loading a font using the GrGraphics, remember the
+ // check sum as a unique identifer
+
+ int m_nScriptTag; // from the pertinent writing system; currently not used
+ unsigned int m_grfsdc; // supported script directions
+
+ bool m_fRightToLeft; // overall writing-system direction
+
+ int m_mXAscent; // extra ascent, in font's em-units
+ int m_mXDescent; // extra descent, in font's em_units
+
+ float m_dysOffset; // vertical offset, in logical units (eg, for super/subscript)
+
+ bool m_fBasicJust; // true if there are no complex justification tables/rules in the
+ // font, so we use basic whitespace justification
+ int m_cJLevels; // number of justification levels
+
+ GrTableManager * m_ptman;
+ GrClassTable * m_pctbl;
+ GrGlyphTable * m_pgtbl;
+
+ FontFace * m_pfface;
+
+ GrFeature m_rgfeat[kMaxFeatures];
+// HashMap<int, int> m_hmnifeat; // maps from feature IDs to indices in the array
+// // Review: do we need this, or is a linear search adequate?
+ int m_cfeat; // number of features present
+
+ short * m_rglcidFeatLabelLangs; // LCIDs (language IDs) for all the labels in the feature table
+ size_t m_clcidFeatLabelLangs;
+
+ GrLangTable m_langtbl;
+
+ // are line-breaks relevant at all?
+ bool m_fLineBreak;
+ // ranges for possible cross-line-boundary contextualization
+ int m_cchwPreXlbContext;
+ int m_cchwPostXlbContext;
+
+ // magic glyph attribute numbers
+ data16 m_chwPseudoAttr; // actual-for-pseudo fake glyph attribute
+ data16 m_chwBWAttr; // break-weight
+ data16 m_chwDirAttr; // directionality
+ data16 m_chwJStretch0; // justify.0.stretch
+ data16 m_chwJShrink0; // justify.0.shrink
+ data16 m_chwJStep0; // justify.0.step
+ data16 m_chwJWeight0; // justify.0.weight
+
+ gid16 m_chwLBGlyphID; // magic line-break glyph ID
+
+ int m_cComponents; // number of glyph attributes at the beginning of the glyph table
+ // that actually represent ligature components
+
+ int m_cnUserDefn; // number of user-defined slot attributes
+ int m_cnCompPerLig; // max number of components needed per ligature
+
+ int m_mFontEmUnits; // number of design units in the Em square for the font
+
+ // for pseudo-glyph mappings
+ int m_cpsd; // number of psuedo-glyphs
+ GrPseudoMap * m_prgpsd;
+ int m_dipsdInit; // (max power of 2 <= m_cpsd);
+ // size of initial range to consider
+ int m_cPsdLoop; // log2(max power of 2 <= m_cpsd);
+ // indicates how many iterations are necessary
+ int m_ipsdStart; // m_cpsd - m_dipsdInit;
+ // where to start search
+
+ // for Unicode to glyph ID mapping
+ ////TableBuffer m_tbufCmap; // hold the full cmap table
+ void * m_pCmap_3_1; // point to the MS Unicode cmap subtable
+ // uses platform 3 writing system 1 or 0, preferably 1
+ // use for Unicode to Glyph ID conversion
+ void * m_pCmap_3_10;
+ byte * m_pCmapTbl;
+ bool m_fCmapTblCopy;
+ int m_cbCmapTbl; // needed only for memory instrumentation
+
+ // for feature names and maybe other strings from font later
+ ////TableBuffer m_tbufNameTbl; // hold full name table; use Name() method to access
+ byte * m_pNameTbl;
+ bool m_fNameTblCopy;
+ int m_cbNameTbl; // needed only for memory instrumentation
+
+ bool m_fLogXductn; // true if we want to log the transduction process
+
+ bool m_fInErrorState; // true if we are handling a rendering error
+
+ // Other protected methods:
+
+ enum {
+ ksegmodeBreak = 0, // FindBreakPoint
+ ksegmodeJust, // MakeJustifiedSegment
+ //ksegmodeMms, // MakeMeasuredSegment
+ ksegmodeRange // MakeSegmentFromRange
+ };
+
+ void MakeSegment(
+ // Common parameters
+ Segment * psegRet,
+ Font * pfont, ITextSource * pgts, IGrJustifier * pjus,
+ LayoutEnvironment & layout,
+ int ichMin, int ichLim,
+ // for finding a line break
+ float dxMaxWidth,
+ bool fBacktracking,
+ // for making a justified segment
+ bool fJust, float dxJustifiedWidthJ, SegEnd estJ);
+
+ int FindFontLim(ITextSource * pgts, int ichFontMin, int * pnDirDepth);
+
+#ifdef GR_FW
+ ////GrResult InitFromControlFile(IGrGraphics * pgg, std::wstring stuFaceName,
+ //// bool fBold, bool fItalic); -- obsolete
+ ////GrResult ReadFromControlFile(std::wstring stuFontFile); -- obsolete
+// GrResult GetFallBackFont(std::wstring * pstu);
+#endif
+
+ ////GrResult ReadFromGraphicsFont(IGrGraphics * pgg, bool fItalic); -- obsolete
+ void DestroyEverything();
+
+ bool CheckTableVersions(GrIStream * pgrstrm,
+ byte *silf_tbl, int lSilfStart,
+ byte *gloc_tbl, int lGlocStart,
+ byte *feat_tbl, int lFeatStart,
+ int * pfxdBadVersion);
+ //bool ReadSileTable(GrIStream & grstrm, long lTableSTart,
+ // int * pmFontEmUnits, bool * pfMismatchedBase);
+ bool ReadSilfTable(GrIStream & grstrm, long lTableStart, int iSubTable,
+ int * pchwMaxGlyphID, int * pfxdVersion);
+ bool ReadGlocAndGlatTables(GrIStream & grstrm, long lGlocStart, GrIStream & glat_strm, long lGlatStart,
+ int chwMaxGlyphID, int fxdSilfVersion);
+ bool ReadFeatTable(GrIStream & grstrm, long lTableStart);
+ bool ReadSillTable(GrIStream & grstrm, long lTableStart);
+ bool SetCmapAndNameTables(Font * pfont);
+
+ void CreateEmpty();
+
+ bool BadFont(FontErrorCode * pferr = NULL)
+ {
+ if (pferr)
+ *pferr = m_ferr;
+ return (m_resFontValid == kresFail || m_resFontRead == kresFail);
+ }
+ bool DumbFallback(FontErrorCode * pferr = NULL)
+ {
+ if (pferr)
+ *pferr = m_ferr;
+ return (m_resFontValid != kresOk || m_resFontRead != kresOk);
+ }
+
+ gid16 MapToPseudo(int nUnicode);
+
+ // NEW interface
+ void AssignDefaultFeatures(int cfeat, FeatureSetting * prgfset);
+
+ // Feature access for FontFace:
+ size_t NumberOfFeatures_ff();
+ featid FeatureID_ff(size_t ifeat);
+ size_t FeatureWithID_ff(featid id);
+ bool GetFeatureLabel_ff(size_t ifeat, lgid language, utf16 * label);
+ int GetFeatureDefault_ff(size_t ifeat);
+ size_t NumberOfSettings_ff(size_t ifeat);
+ int GetFeatureSettingValue_ff(size_t ifeat, size_t ifset);
+ bool GetFeatureSettingLabel_ff(size_t ifeat, size_t ifset, lgid language, utf16 * label);
+ // Feature-label languages:
+ size_t NumberOfFeatLangs_ff();
+ short GetFeatLabelLang_ff(size_t ilang);
+ // Language access for FontFace:
+ size_t NumberOfLanguages_ff();
+ isocode GetLanguageCode_ff(size_t ilang);
+
+ void SetUpFeatLangList();
+
+//:Ignore
+#ifdef OLD_TEST_STUFF
+ // For test procedures:
+ void SetUpCrossLineContextTest();
+ void SetUpPseudoGlyphTest();
+ void SetUpRuleActionTest();
+ void SetUpRuleAction2Test();
+ void SetUpAssocTest();
+ void SetUpAssoc2Test();
+ void SetUpDefaultAssocTest();
+ void SetUpFeatureTest();
+ void SetUpLigatureTest();
+ void SetUpLigature2Test();
+
+ void InitFromControlFileTest();
+#endif // OLD_TEST_STUFF
+//:End Ignore
+};
+
+} // namespace gr
+
+#if defined(GR_NO_NAMESPACE)
+using namespace gr;
+#endif
+
+
+#endif // !GR_ENGINE_INCLUDED
diff --git a/Build/source/libs/graphite/src/segment/GrFSM.cpp b/Build/source/libs/graphite/src/segment/GrFSM.cpp
new file mode 100644
index 00000000000..53182edab0d
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrFSM.cpp
@@ -0,0 +1,526 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrFSM.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Implements the finite state machine.
+----------------------------------------------------------------------------------------------*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+#include <cstring>
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+// any other headers (not precompiled)
+
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:End Ignore
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Fill in the FSM by reading from the font stream.
+ Assumes the stream is in the correct position.
+----------------------------------------------------------------------------------------------*/
+bool GrFSM::ReadFromFont(GrIStream & grstrm, int fxdVersion)
+{
+ short snTmp;
+
+ // number of FSM states
+ snTmp = grstrm.ReadShortFromFont();
+ m_crow = snTmp;
+ // number of transitional states
+ snTmp = grstrm.ReadShortFromFont();
+ int crowTransitional = snTmp;
+ // number of success states
+ snTmp = grstrm.ReadShortFromFont();
+ int crowSuccess = snTmp;
+ m_crowFinal = m_crow - crowTransitional;
+ m_crowNonAcpt = m_crow - crowSuccess;
+ m_rowFinalMin = crowTransitional;
+ // number of columns
+ snTmp = grstrm.ReadShortFromFont();
+ m_ccol = snTmp;
+
+ // Sanity checks.
+ if (crowTransitional > m_crow || crowSuccess > m_crow)
+ return false; // bad table
+ // TODO: add a sanity check for m_ccol.
+
+ // number of FSM glyph ranges and search constants
+ snTmp = grstrm.ReadShortFromFont();
+ m_cmcr = snTmp;
+ snTmp = grstrm.ReadShortFromFont();
+ m_dimcrInit = snTmp;
+ snTmp = grstrm.ReadShortFromFont();
+ m_cLoop = snTmp;
+ snTmp = grstrm.ReadShortFromFont();
+ m_imcrStart = snTmp;
+
+ m_prgmcr = new GrFSMClassRange[m_cmcr];
+ for (int imcr = 0; imcr < m_cmcr; imcr++)
+ {
+ m_prgmcr[imcr].m_chwFirst = grstrm.ReadUShortFromFont();
+ m_prgmcr[imcr].m_chwLast = grstrm.ReadUShortFromFont();
+ m_prgmcr[imcr].m_col = grstrm.ReadUShortFromFont();
+ }
+
+ // rule map and offsets (extra item at end gives final offset, ie, total)
+ m_prgirulnMin = new data16[crowSuccess + 1];
+ data16 * pchw = m_prgirulnMin;
+ int i;
+ for (i = 0; i < (crowSuccess + 1); i++, pchw++)
+ {
+ *pchw = grstrm.ReadUShortFromFont();
+ }
+
+ // Last offset functions as the total length of the rule list.
+ // Note that the number of rules in the map is not necessarily equal to the number of
+ // rules in the pass; some rules may be listed multiply, if they are matched by more
+ // than one state.
+ int crulInMap = m_prgirulnMin[crowSuccess];
+ m_prgrulnMatched = new data16[crulInMap];
+ m_crulnMatched = crulInMap;
+ pchw = m_prgrulnMatched;
+ for (i = 0; i < crulInMap; i++, pchw++)
+ {
+ *pchw = grstrm.ReadUShortFromFont();
+ }
+
+ // min rule pre-context number of items
+ byte bTmp = grstrm.ReadByteFromFont();
+ m_critMinRulePreContext = bTmp;
+ // max rule pre-context number of items
+ bTmp = grstrm.ReadByteFromFont();
+ m_critMaxRulePreContext = bTmp;
+
+ if (m_critMinRulePreContext > kMaxSlotsPerRule || m_critMaxRulePreContext > kMaxSlotsPerRule)
+ return false; // bad table
+
+ int cStartStates = m_critMaxRulePreContext - m_critMinRulePreContext + 1;
+
+ // start states
+ m_prgrowStartStates = new short[cStartStates];
+ short * psn = m_prgrowStartStates;
+ for (int ic = 0; ic < cStartStates; ic++, psn++)
+ {
+ *psn = grstrm.ReadShortFromFont();
+ }
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Fill in the FSM's state table by reading from the font stream.
+ Assumes the stream is in the correct position.
+----------------------------------------------------------------------------------------------*/
+bool GrFSM::ReadStateTableFromFont(GrIStream & grstrm, int fxdVersion)
+{
+ int cCells = ((m_crow - m_crowFinal) * m_ccol);
+ m_prgrowTransitions = new short[cCells];
+ short * psn = m_prgrowTransitions;
+ for (int iCell = 0; iCell < cCells; iCell++, psn++)
+ {
+ *psn = grstrm.ReadShortFromFont();
+ }
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Use the transition table to find a rule or rules that match; then run the contraint
+ code to see if the rule is active. Return the rule number of the rule to be applied.
+
+ @param ppass - pass, which knows how to run constraint code
+ @param psstrmIn - input stream
+ @param psstrmOut - output stream (from which to get recently output slots)
+----------------------------------------------------------------------------------------------*/
+int GrFSM::GetRuleToApply(GrTableManager * ptman, GrPass * ppass,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ // List of accepting states and corresponding count of slots that were
+ // matched by each.
+ int prgrowAccepting[kMaxSlotsPerRule];
+ int prgcslotMatched[kMaxSlotsPerRule];
+
+ // Run the transition table until it jams.
+ int crowAccepting = RunTransitionTable(ppass, psstrmIn, psstrmOut,
+ prgrowAccepting, prgcslotMatched);
+
+ // Nothing matched; fail quickly.
+ if (crowAccepting == 0)
+ return -1;
+
+ int * prow = prgrowAccepting + crowAccepting - 1;
+ int * pcslot = prgcslotMatched + crowAccepting - 1; // # of slots matched AFTER the curr pos
+
+ // Quick test for common case of exactly one rule matched.
+ if (crowAccepting == 1 &&
+ (m_prgirulnMin[*prow - m_crowNonAcpt + 1] - m_prgirulnMin[*prow - m_crowNonAcpt]) == 1)
+ {
+ int iruln = m_prgirulnMin[*prow - m_crowNonAcpt];
+ int ruln = m_prgrulnMatched[iruln];
+ if (RunConstraintAndRecordLog(ptman, ppass, ruln, psstrmIn, psstrmOut,
+ ppass->PreModContextForRule(ruln), *pcslot))
+ {
+ return ruln;
+ }
+ else
+ return -1;
+ }
+
+ // Several rules were matched. We need to sort them and then run the constraints
+ // for each rule, accepting the first one whose constraints succeed.
+
+ // Count up the number of rules that matched and allocate a buffer of the right size.
+ int crulMatched = 0;
+ while (prow >= prgrowAccepting)
+ {
+ crulMatched +=
+ m_prgirulnMin[*prow - m_crowNonAcpt + 1] - m_prgirulnMin[*prow - m_crowNonAcpt];
+ --prow;
+ }
+ MatchedRule * prgmr = new MatchedRule[crulMatched];
+
+ prow = prgrowAccepting + crowAccepting - 1;
+
+ // Do a dumb insertion sort, ordering primarily by sort key (largest first)
+ // and secondarily by the order in the original file (rule number).
+ // Review: is this kind of sort fast enough? We assuming that we usually only
+ // have a handful of matched rules.
+ int cmr = 0;
+ while (prow >= prgrowAccepting)
+ {
+ int iruln = m_prgirulnMin[*prow - m_crowNonAcpt];
+ // Get all the rules matches by a single state.
+ while (iruln < m_prgirulnMin[*prow - m_crowNonAcpt + 1])
+ {
+ int ruln = m_prgrulnMatched[iruln];
+ int nSortKey = ppass->SortKeyForRule(ruln);
+ int cslot = *pcslot;
+ int imr;
+ for (imr = 0; imr < cmr; imr++)
+ {
+ if (nSortKey > prgmr[imr].nSortKey ||
+ (nSortKey == prgmr[imr].nSortKey && ruln < prgmr[imr].ruln))
+ {
+ // Insert here.
+ memmove(prgmr+imr+1, prgmr+imr, (isizeof(MatchedRule) * (cmr - imr)));
+ prgmr[imr].ruln = ruln;
+ prgmr[imr].nSortKey = nSortKey;
+ prgmr[imr].cslot = cslot;
+ break;
+ }
+ }
+ if (imr >= cmr)
+ {
+ prgmr[cmr].ruln = ruln;
+ prgmr[cmr].nSortKey = nSortKey;
+ prgmr[cmr].cslot = cslot;
+ }
+ cmr++;
+
+ iruln++;
+ }
+ --prow;
+ --pcslot;
+ }
+
+
+ for (int imr = 0; imr < cmr; imr++)
+ {
+ int ruln = prgmr[imr].ruln;
+ if (RunConstraintAndRecordLog(ptman, ppass, ruln, psstrmIn, psstrmOut,
+ ppass->PreModContextForRule(ruln), prgmr[imr].cslot))
+ {
+ // Success!
+ delete[] prgmr;
+ return ruln;
+ }
+ }
+
+ // No rule matched or the constraints failed.
+ delete[] prgmr;
+ return -1;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Run the transition table, generating a list of rows corresponding to accepting states.
+
+ @param psstrmIn - input stream
+ @param prgrowAccepting - array to fill in with accepting rows
+ @param prgcslotMatched - corresponding array with number of slots matched
+----------------------------------------------------------------------------------------------*/
+int GrFSM::RunTransitionTable(GrPass * ppass, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ int * prgrowAccepting, int * prgcslotMatched)
+{
+ int ipass = ppass->PassNumber();
+
+ // Remember we're reading the pre-context items from the output stream, not the input.
+ int cslotPreContextAvail = psstrmOut->WritePos();
+
+ if (cslotPreContextAvail < m_critMinRulePreContext)
+ return 0; // not enough input to match any rule
+
+ // Look backwards by the number of pre-context items for this pass, but not earlier
+ // than the beginning of the stream.
+ int cslot = -1 * min(cslotPreContextAvail, m_critMaxRulePreContext);
+
+ // Normally the start state is state 0. But if we are near the beginning of the stream,
+ // we may need to adjust due to the fact that we don't have enough input yet to
+ // match the pre-context items in all the rules. So in effect we skip some states
+ // corresponding to the earlier items that aren't present.
+ int row = m_prgrowStartStates[max(0, m_critMaxRulePreContext - cslotPreContextAvail)];
+
+ int * prowTop = prgrowAccepting;
+ int * pcslotTop = prgcslotMatched;
+ while (true)
+ {
+ if (row >= m_rowFinalMin)
+ // final state--jammed
+ return (prowTop - prgrowAccepting);
+
+ if (psstrmIn->SlotsPendingInContext() <= cslot)
+ // no more input
+ return (prowTop - prgrowAccepting);
+
+ // Figure out what column the input glyph belong in.
+ // Since this is a time-critical routine, we cache the results for the current pass.
+ GrSlotState * pslot = (cslot < 0) ?
+ psstrmOut->PeekBack(cslot) :
+ psstrmIn->Peek(cslot);
+ int col;
+ if (pslot->PassNumberForColumn() == ipass)
+ {
+ col = pslot->FsmColumn();
+ }
+ else
+ {
+ gid16 chwGlyphID = (cslot < 0) ?
+ psstrmOut->PeekBack(cslot)->GlyphID() :
+ psstrmIn->Peek(cslot)->GlyphID();
+ col = FindColumn(chwGlyphID);
+ pslot->CacheFsmColumn(ipass, col);
+ }
+ int rowNext;
+ if (col < 0)
+ rowNext = 0;
+ else
+ rowNext = m_prgrowTransitions[(row * m_ccol) + col];
+
+ if (rowNext == 0) // jammed
+ return (prowTop - prgrowAccepting);
+
+ cslot++;
+ if (rowNext >= m_crowNonAcpt) // or (rowNext < 0)
+ {
+ // Accepting state--push it on the stack.
+ //rowNext *= -1;
+ gAssert((prowTop - prgrowAccepting) < kMaxSlotsPerRule);
+ *prowTop++ = rowNext;
+ *pcslotTop++ = cslot;
+ }
+ row = rowNext;
+
+ gAssert((prowTop - prgrowAccepting) == (pcslotTop - prgcslotMatched));
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Run the transition table, generating a list of rows corresponding to accepting states.
+ Optimized to avoid matrix arithmetic for non-accepting states.
+
+ Review: do we need to use this version?
+
+ @param psstrmIn - input stream
+ @param prgrowAccepting - array to fill in with accepting rows
+ @param prgcslotMatched - corresponding array with number of slots matched
+----------------------------------------------------------------------------------------------*/
+#if 0
+
+int GrFSM::RunTransitionTableOptimized(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ int * prgrowAccepting, int * prgcslotMatched)
+{
+ int cslot = 0;
+ int ichwRowOffset = 0;
+ int ichwRowOffsetLim = m_crowFinal * m_ccol; // number of cells
+ int * prowTop = prgrowAccepting;
+ int * pcslotTop = prgcslotMatched;
+ while (true)
+ {
+ if (ichwRowOffset >= ichwRowOffsetLim)
+ // final state--jammed
+ return (prowTop - prgrowAccepting);
+
+ if (psstrmIn->SlotsPendingInContext() < cslot)
+ // no more input
+ return (prowTop - prgrowAccepting);
+
+ gid16 chwGlyphID = psstrmIn->Peek(cslot)->GlyphID();
+ int col = FindColumn(chwGlyphID);
+ short cellValue = *(m_prgprgrowXitions + ichwRowOffset + col);
+
+ if (cellValue == 0) // jammed
+ return (prowTop - prgrowAccepting);
+
+ cslot++;
+ if (cellValue < 0)
+ {
+ // Accepting state--push it on the stack.
+ int rowNext = cellValue * -1;
+ gAssert((prowTop - prgrowAccepting) < kMaxSlotsPerRule);
+ *prowTop++ = rowNext;
+ *pcslotTop++ = cslot;
+ ichwRowOffset = rowNext * m_ccol;
+ }
+ else
+ ichwRowOffset = cellValue;
+
+ gAssert((prowTop - prgrowAccepting) == (pcslotTop - prgcslotMatched));
+ }
+}
+
+#endif // 0
+
+
+/*----------------------------------------------------------------------------------------------
+ Run all the constraints for the rules matched by the state that we have reached.
+ The rules are ordered as they were in the GDL file. When we hit a constraint that
+ matches, return the corresponding rule number. Return -1 if no rule passed.
+
+ @param ppass - pass, which knows how to actually run the constraints
+ @param psstrmIn - input stream
+ @param cslotMatched - number of slots matched; constraints must be run for each of these
+----------------------------------------------------------------------------------------------*/
+//:Ignore
+int GrFSM::RunConstraints_Obsolete(GrTableManager * ptman, GrPass * ppass, int row,
+ GrSlotStream * psstrmIn, int cslotMatched)
+{
+ int iruln = m_prgirulnMin[row - m_crowNonAcpt];
+ while (iruln < m_prgirulnMin[row - m_crowNonAcpt + 1])
+ {
+ int ruln = m_prgrulnMatched[iruln];
+ bool fSuccess = ppass->RunConstraint(ptman, ruln, psstrmIn, NULL, 0, cslotMatched);
+ if (fSuccess)
+ {
+ if (ptman->LoggingTransduction())
+ ppass->RecordRuleFired(psstrmIn->ReadPosForNextGet(), ruln);
+ return ruln;
+ }
+ else
+ {
+ if (ptman->LoggingTransduction())
+ ppass->RecordRuleFailed(psstrmIn->ReadPosForNextGet(), ruln);
+ }
+
+ iruln++;
+ }
+ return -1; // no rule succeeded
+}
+//:End Ignore
+
+/*----------------------------------------------------------------------------------------------
+ Run the constraints for the given rule, and record whether it failed or succeeded in the
+ transduction log.
+
+ @param ppass - pass, which knows how to actually run the constraints
+ @param psstrmIn - input stream
+ @param cslotPreModContext - number of slots before the current position that must be tested
+ @param islotLimMatched - number of slots matched AFTER the current position
+
+ @return True if the constraints succeeded.
+----------------------------------------------------------------------------------------------*/
+bool GrFSM::RunConstraintAndRecordLog(GrTableManager * ptman, GrPass * ppass, int ruln,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ int cslotPreModContext, int islotLimMatched)
+{
+ bool fSuccess = ppass->RunConstraint(ptman, ruln, psstrmIn, psstrmOut,
+ cslotPreModContext, islotLimMatched);
+
+ if (ptman->LoggingTransduction())
+ {
+ if (fSuccess)
+ ppass->RecordRuleFired(psstrmIn->ReadPosForNextGet(), ruln);
+ else
+ ppass->RecordRuleFailed(psstrmIn->ReadPosForNextGet(), ruln);
+ }
+
+ return fSuccess;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Search for the class range containing the glyph ID, and return the matching FSM column.
+ Does a fast binary search that uses only shifts, no division.
+----------------------------------------------------------------------------------------------*/
+int GrFSM::FindColumn(gid16 chwGlyphID)
+{
+ #ifdef _DEBUG
+ // Check that the pre-calculated constants are correct.
+ int nPowerOf2 = 1;
+ while (nPowerOf2 <= m_cmcr)
+ nPowerOf2 <<= 1;
+ nPowerOf2 >>= 1;
+ // Now nPowerOf2 is the max power of 2 <= m_cclsrg.
+ // m_cLoop is not needed for our purposes, but it is included because it is part of
+ // the TrueType standard.
+ gAssert(1 << m_cLoop == nPowerOf2); // m_cloop == log2(nPowerOf2)
+ gAssert(m_dimcrInit == nPowerOf2);
+ gAssert(m_imcrStart == m_cmcr - m_dimcrInit);
+ #endif
+
+ int dimcrCurr = m_dimcrInit;
+
+ GrFSMClassRange * pmcrCurr = m_prgmcr + m_imcrStart;
+ while (dimcrCurr > 0)
+ {
+ int nTest;
+ if (pmcrCurr < m_prgmcr)
+ nTest = -1;
+ else
+ {
+ nTest = pmcrCurr->m_chwFirst - chwGlyphID;
+ if (nTest < 0 && chwGlyphID <= pmcrCurr->m_chwLast)
+ //nTest = 0;
+ // This is a tiny bit more efficient:
+ return pmcrCurr->m_col;
+ }
+
+ if (nTest == 0)
+ // found it
+ return pmcrCurr->m_col;
+
+ dimcrCurr >>= 1; // divide by 2
+ if (nTest < 0)
+ pmcrCurr += dimcrCurr;
+ else // (nTest > 0)
+ pmcrCurr -= dimcrCurr;
+ }
+
+ return -1;
+}
+
+} // namespace gr
diff --git a/Build/source/libs/graphite/src/segment/GrFSM.h b/Build/source/libs/graphite/src/segment/GrFSM.h
new file mode 100644
index 00000000000..b1909553daa
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrFSM.h
@@ -0,0 +1,245 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrFSM.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ The GrFSM class, which is the mechanism that examines input in a glyph stream and
+ determines which rule matches and should be run.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef FSM_INCLUDED
+#define FSM_INCLUDED
+
+//:End Ignore
+
+namespace gr
+{
+
+class GrPass;
+
+/*----------------------------------------------------------------------------------------------
+ A machine class range consists of a range of contiguous glyph IDs that map to
+ a single column in the FSM (a machine class). (Note that there might be more than one
+ range mapping to a given column.)
+
+ Keep in mind that these "classes" are completely different from the classes that
+ are used for substitution. These are used only for matching by the FSM.
+
+ Hungarian: mcr
+----------------------------------------------------------------------------------------------*/
+class GrFSMClassRange
+{
+ friend class GrFSM;
+
+protected:
+ gid16 m_chwFirst; // first glyph ID in range
+ gid16 m_chwLast; // last glyph ID in range
+ data16 m_col; // column (machine class) to which this range maps
+};
+
+/*----------------------------------------------------------------------------------------------
+ The finite state machine that is used to match sequences of glyphs and
+ determine which rule to apply. There is one FSM per pass.
+
+ The states in the FSM are grouped and ordered in the following way:
+ - non-accepting states (no rule completely matched)
+ - accepting non-final states (a rule matched, but a longer rule is possible)
+ - final states (a rule matched and no longer rule is possible)
+ In other words, we have:
+ - transition, non-accepting
+ - transition, accepting
+ - non-transition, accepting
+ The transition states have information about the next state to transition to;
+ the accepting states have information about the rule(s) that matched.
+
+ There are three main data structures that are part of the finite state machine:
+
+ (1) the transition matrix: m_prgprgrowXitions. It contains a row for each transition
+ state (non-accepting states plus accepting non-final states), and a column for each
+ machine class. The cell values indicate the next state to transition to for the
+ matched input. A positive number indicates that the next state is a non-accepting state;
+ a negative value indicates an accepting state. Zero means there is no next state;
+ no more matches are possible; machine has "jammed."
+
+ (2) the matched-rule list: m_prgrulnMatched. This is a list of rule numbers,
+ which are indices into the pass's action- and constraint-code arrays.
+ It contains the numbers of the rules matched by the first accepting state,
+ followed by those matched by the second accepting state, etc. For each state,
+ the rules must be ordered using the same order of the rules in the RDL file.
+
+ (3) the matched-rule-offsets list: m_prgirulnMin. This gives the starting index into
+ the matched-rule list for each accepting state. (Non-accepting states are not included,
+ so the first item is for state m_crowNonAcpt.)
+
+ In addition, the FSM interacts with the action- and constraint-code lists in the pass
+ itself. These lists are indexed by rule number (the values of m_prgrulnMatched).
+ When some input matches the rule, the constraint-code is run; if it succeeds,
+ the rule number is returned to the caller and that rule is applied (ie, the action-code
+ is run).
+
+ Hungarian: fsm
+
+ Other hungarian:
+ row - row (state)
+ col - column (machine class)
+ ruln - rule number
+
+ REVIEW: This is quite a time-critical class, and there are two potential optimizations
+ that have been proposed for the value of a cell:
+
+ (1) use a negative cell number to indicate an accepting state and a positive number
+ to indicate a non-accepting state. So this gives a comparison with zero rather than
+ some arbitrary number
+
+ (2) have the positive numbers--the most common case--be the actual byte offset into the
+ table rather than the row number. This saves matrix multiplication at each step,
+ ie, "m_prgsnTransitions[(row * m_ccol) + col]".
+
+ The two versions are implemented in RunTransitionTable and RunTransitionTableOptimized.
+ Do these seem to be worth the inconvenience of added complexity in understanding
+ and debugging?
+----------------------------------------------------------------------------------------------*/
+class GrFSM
+{
+ friend class FontMemoryUsage;
+
+public:
+ GrFSM() :
+ m_prgirulnMin(NULL),
+ m_prgrulnMatched(NULL),
+ m_prgrowTransitions(NULL),
+ m_prgibStateDebug(NULL),
+ m_prgmcr(NULL),
+ m_prgrowStartStates(NULL)
+ {
+ }
+
+ ~GrFSM()
+ {
+ delete[] m_prgirulnMin;
+ delete[] m_prgrulnMatched;
+
+ delete[] m_prgrowTransitions;
+
+ delete[] m_prgibStateDebug;
+
+ delete[] m_prgmcr;
+
+ delete[] m_prgrowStartStates;
+ }
+
+ bool ReadFromFont(GrIStream & grstrm, int fxdVersion);
+ bool ReadStateTableFromFont(GrIStream & grstrm, int fxdVersion);
+
+ int GetRuleToApply(GrTableManager *, GrPass * ppass,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+
+ int RunTransitionTable(GrPass * ppass, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ int * prgrowAccepting, int * prgcslotMatched);
+ int RunTransitionTableOptimized(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ int * prgrowAccepting, int * prgcslotMatched);
+ bool RunConstraintAndRecordLog(GrTableManager *, GrPass * ppass, int ruln,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ int cslotPreModContext, int cslotMatched);
+
+ int RunConstraints_Obsolete(GrTableManager *, GrPass * ppass, int row, GrSlotStream * psstrmIn,
+ int cslotMatched);
+
+ // For sorting matched rules
+ struct MatchedRule // mr
+ {
+ int ruln;
+ int nSortKey;
+ int cslot; // number of slots matched AFTER the current stream position
+ };
+
+ int MaxRulePreContext()
+ {
+ return m_critMaxRulePreContext;
+ }
+
+protected:
+ int FindColumn(gid16 chwGlyphID);
+protected:
+ // Instance variables:
+ int m_crow; // number of rows (states)
+ int m_crowFinal; // number of final states; no transitions for these
+ int m_rowFinalMin; // index of first final row
+ int m_crowNonAcpt; // number of non-accepting states; no rule indices for these
+
+ int m_ccol; // number of columns (machine classes)
+
+ data16 * m_prgirulnMin; // m_crow-m_crowNonAcpt+1 of these;
+ // index within m_prgrulnMatched, start of matched
+ // rules for each accepting state
+
+ data16 * m_prgrulnMatched; // long ordered list of rule indices matched by
+ // subsequent states; total length is sum of number
+ // of rules matched for each accepting state
+ int m_crulnMatched; // needed only for memory instrumentation
+
+ // Transition matrix--for optimized version:
+// short ** m_prgprgrowXitions; // ((m_crow-m_crowFinal) * m_ccol) of these;
+ // positive number indicates
+ // next state is non-accepting; negative number is
+ // negative of accepting state.
+
+ // Transition matrix--for current version:
+ short * m_prgrowTransitions; // ((m_crow-m_crowFinal) * m_ccol) of these
+
+ // debugger string offsets
+ data16 * m_prgibStateDebug; // for transition states; (m_crow-m_crul+1) of these
+
+ // constants for fast binary search; these are generated by the compiler so that the
+ // engine doesn't have to take time to do it
+ data16 m_dimcrInit; // (max power of 2 <= m_cmcr);
+ // size of initial range to consider
+ data16 m_cLoop; // log2(max power of 2 <= m_cmcr);
+ // indicates how many iterations are necessary
+ data16 m_imcrStart; // m_cmcr - m_dimcrInit;
+ // where to start search
+
+ int m_cmcr; // number of machine-class-ranges
+ GrFSMClassRange * m_prgmcr; // array of class ranges; we search these to find the
+ // mapping to the machine-class-column
+
+ // minimum and maximum number of items in the rule contexts before the first modified
+ // item.
+ int m_critMinRulePreContext;
+ int m_critMaxRulePreContext;
+
+ // start states--row in the FSM to start on depending on how many bogus slots we
+ // are skipping; (max rule-precontext - min rule-precontext + 1) of these;
+ // first always = zero
+ short * m_prgrowStartStates;
+
+//:Ignore
+#if OLD_TEST_STUFF
+public:
+ // For test procedures:
+ void SetUpSimpleFSMTest();
+ void SetUpRuleActionTest();
+ void SetUpRuleAction2Test(int);
+ void SetUpAssocTest(int);
+ void SetUpAssoc2Test(int);
+ void SetUpDefaultAssocTest();
+ void SetUpFeatureTest();
+ void SetUpLigatureTest(int);
+ void SetUpLigature2Test(int);
+#endif // OLD_TEST_STUFF
+//:End Ignore
+
+};
+
+} // namespace gr
+
+
+#endif // !FSM_INCLUDED
diff --git a/Build/source/libs/graphite/src/segment/GrFeature.cpp b/Build/source/libs/graphite/src/segment/GrFeature.cpp
new file mode 100644
index 00000000000..61970d56949
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrFeature.cpp
@@ -0,0 +1,321 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrFeature.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Implements the GrFeature class.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+#include <cstring>
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> GrFeature Methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Initialize the feature.
+----------------------------------------------------------------------------------------------*/
+void GrFeature::Initialize(featid nID, int nNameId, int cfset, int nDefault)
+{
+ m_nID = nID;
+ m_nNameId = nNameId;
+ m_nDefault = nDefault;
+
+ m_vnVal.resize(cfset);
+ for (unsigned int ifset = 0; ifset < m_vnVal.size(); ifset++)
+ m_vnVal[ifset] = INT_MAX;
+ m_vnNameId.resize(cfset);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the feature settings.
+----------------------------------------------------------------------------------------------*/
+int GrFeature::Settings(int cMax, int * prgnVal)
+{
+ int cRet = min(cMax, signed(m_vnVal.size()));
+ for (int ifset = 0; ifset < cRet; ifset++)
+ prgnVal[ifset] = m_vnVal[ifset];
+ return cRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Add a feature setting.
+----------------------------------------------------------------------------------------------*/
+void GrFeature::AddSetting(int nVal, int nNameId)
+{
+ Assert(nVal != INT_MAX);
+ unsigned int ifset;
+ for (ifset = 0; ifset < m_vnVal.size(); ifset++)
+ {
+ if (m_vnVal[ifset] == nVal)
+ return; // already there
+ }
+ for (ifset = 0; ifset < m_vnVal.size(); ifset++)
+ {
+ if (m_vnVal[ifset] == INT_MAX)
+ {
+ m_vnVal[ifset] = nVal;
+ m_vnNameId[ifset] = nNameId;
+ return;
+ }
+ }
+ m_vnVal.push_back(nVal);
+ m_vnNameId.push_back(nNameId);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if the given setting is valid according to the font's feature table.
+----------------------------------------------------------------------------------------------*/
+bool GrFeature::IsValidSetting(int nVal)
+{
+ for (unsigned int ifset = 0; ifset < m_vnVal.size(); ifset++)
+ {
+ if (m_vnVal[ifset] == nVal)
+ return true;
+ }
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Read the feature label from the name table.
+----------------------------------------------------------------------------------------------*/
+std::wstring GrFeature::Label(GrEngine * pgreng, int nLang)
+{
+ std::wstring stu = pgreng->StringFromNameTable(nLang, m_nNameId);
+ if (stu == L"NoName")
+ stu.erase();
+ return stu;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Read the feature value label from the name table.
+----------------------------------------------------------------------------------------------*/
+std::wstring GrFeature::SettingLabel(GrEngine * pgreng, int nVal, int nLang)
+{
+ for (unsigned int ifset = 0; ifset < m_vnVal.size(); ifset++)
+ {
+ if (m_vnVal[ifset] == nVal)
+ {
+ std::wstring stu = pgreng->StringFromNameTable(nLang, m_vnNameId[ifset]);
+ if (stu == L"NoName")
+ stu.erase();
+ return stu;
+ }
+ }
+ Assert(false); // setting is not valid
+ return L"";
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the given setting value.
+----------------------------------------------------------------------------------------------*/
+int GrFeature::NthSetting(int ifset)
+{
+ if (ifset >= (int)m_vnVal.size())
+ return -1;
+ else
+ return m_vnVal[ifset];
+}
+
+/*----------------------------------------------------------------------------------------------
+ Read the feature value label for the given index.
+----------------------------------------------------------------------------------------------*/
+std::wstring GrFeature::NthSettingLabel(GrEngine * pgreng, int ifset, int nLang)
+{
+ std::wstring stu;
+
+ if (ifset >= (int)m_vnVal.size())
+ stu.erase();
+ else
+ {
+ stu = pgreng->StringFromNameTable(nLang, m_vnNameId[ifset]);
+ if (stu == L"NoName")
+ stu.erase();
+ }
+ return stu;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the feature setting label.
+----------------------------------------------------------------------------------------------*/
+// void GrFeature::SetSettingLabel(int nVal, std::wstring stuLabel, int nLang)
+// {
+// for (int ifset = 0; ifset < m_vfset.size(); ifset++)
+// {
+// if (m_vfset[ifset].m_nVal == nVal)
+// {
+// m_vfset[ifset].m_hmnstuLabels.Insert(nLang, stuLabel, true);
+// return;
+// }
+// }
+// Assert(false); // setting is not valid
+// }
+
+
+//:>********************************************************************************************
+//:> GrLangTable Methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Read the languages from the font.
+----------------------------------------------------------------------------------------------*/
+bool GrLangTable::ReadFromFont(GrIStream * pgrstrm, int fxdVersion)
+{
+ GrIStream & grstrm = *pgrstrm;
+
+ // number of languages
+ m_clang = (size_t)grstrm.ReadUShortFromFont();
+
+ // search constants
+ m_dilangInit = grstrm.ReadUShortFromFont();
+ m_cLoop = grstrm.ReadUShortFromFont();
+ m_ilangStart = grstrm.ReadUShortFromFont();
+
+ // Slurp the data into the buffers. The "+1" represents a bogus ending entry that quickly
+ // gives us the size of the feature list. Note that the resulting data is all big-endian.
+ int cb = (m_clang + 1) * sizeof(LangEntry);
+ m_prglang = new LangEntry[m_clang + 1];
+ grstrm.ReadBlockFromFont(m_prglang, cb);
+
+ m_cbOffset0 = (lsbf)(m_prglang[0].cbOffsetBIG);
+
+ Assert((lsbf)(m_prglang[m_clang].cFeaturesBIG) == 0); // bogus entry has no settings
+ cb = (lsbf)(m_prglang[m_clang].cbOffsetBIG) - m_cbOffset0;
+ Assert(cb % sizeof(FeatSet) == 0); // # of bytes fits nicely into FeatSet class
+ int cfset = cb / sizeof(FeatSet);
+ m_prgfset = new FeatSet[cfset];
+ m_cfset = cfset;
+ grstrm.ReadBlockFromFont(m_prgfset, cb);
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Create an empty language table to use for dumb rendering, or when there is no valid
+ Sill table.
+----------------------------------------------------------------------------------------------*/
+void GrLangTable::CreateEmpty()
+{
+ m_prglang = NULL;
+ m_prgfset = NULL;
+ m_clang = 0;
+ m_dilangInit = 0;
+ m_cLoop = 0;
+ m_ilangStart = 0;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return information about the language with the given ID by filling in the given vectors
+ with the feature ids and values. Will wipe out any data in the vectors already.
+----------------------------------------------------------------------------------------------*/
+void GrLangTable::LanguageFeatureSettings(isocode lgcode,
+ std::vector<featid> & vnFeatId, std::vector<int> & vnValues)
+{
+ vnFeatId.clear();
+ vnValues.clear();
+
+ int ilang = FindIndex(lgcode);
+ if (ilang == -1)
+ return; // no such language: leave vectors empty
+
+ LangEntry * plang = m_prglang + ilang;
+ int cbOffset = lsbf(plang->cbOffsetBIG) - m_cbOffset0;
+ Assert(cbOffset % sizeof(FeatSet) == 0);
+ byte * pbFeatSet = reinterpret_cast<byte*>(m_prgfset) + cbOffset;
+ FeatSet * pfset = reinterpret_cast<FeatSet*>(pbFeatSet);
+ for (int ifset = 0; ifset < lsbf(plang->cFeaturesBIG); ifset++)
+ {
+ vnFeatId.push_back(lsbf(pfset[ifset].featidBIG));
+ vnValues.push_back(lsbf(pfset[ifset].valueBIG));
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the code for the language at the given index.
+----------------------------------------------------------------------------------------------*/
+isocode GrLangTable::LanguageCode(size_t ilang)
+{
+ isocode lgcodeRet;
+ if (ilang > m_clang)
+ {
+ std::fill_n(lgcodeRet.rgch, 4, '\0');
+ return lgcodeRet;
+ }
+ LangEntry * plang = m_prglang + ilang;
+ std::copy(plang->rgchCode, plang->rgchCode + 4, lgcodeRet.rgch);
+ return lgcodeRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the index of the language in the list.
+----------------------------------------------------------------------------------------------*/
+int GrLangTable::FindIndex(isocode lgcode)
+{
+ if (m_clang == 0)
+ return -1;
+#ifdef _DEBUG
+ int nPowerOf2 = 1;
+ while (nPowerOf2 <= signed(m_clang))
+ nPowerOf2 <<= 1;
+ nPowerOf2 >>= 1;
+ // Now nPowerOf2 is the max power of 2 <= m_clang
+ gAssert((1 << m_cLoop) == nPowerOf2); // m_cLoop == log2(nPowerOf2)
+ gAssert(m_dilangInit == nPowerOf2);
+ gAssert(m_ilangStart == m_clang - m_dilangInit);
+#endif // _DEBUG
+
+ int dilangCurr = m_dilangInit;
+
+ int ilangCurr = m_ilangStart; // may become < 0
+ while (dilangCurr > 0)
+ {
+ int nTest;
+ if (ilangCurr < 0)
+ nTest = -1;
+ else
+ {
+ LangEntry * plangCurr = m_prglang + ilangCurr;
+ nTest = strcmp(plangCurr->rgchCode, lgcode.rgch);
+ }
+
+ if (nTest == 0)
+ return ilangCurr;
+
+ dilangCurr >>= 1; // divide by 2
+ if (nTest < 0)
+ ilangCurr += dilangCurr;
+ else // (nTest > 0)
+ ilangCurr -= dilangCurr;
+ }
+
+ return -1;
+}
+
+} // namespace gr
diff --git a/Build/source/libs/graphite/src/segment/GrFeatureValues.h b/Build/source/libs/graphite/src/segment/GrFeatureValues.h
new file mode 100644
index 00000000000..de9eda0f03f
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrFeatureValues.h
@@ -0,0 +1,71 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999 - 2008 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrFeatureValues.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+
+
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GR_FEATVAL_INCLUDED
+#define GR_FEATVAL_INCLUDED
+
+//:End Ignore
+
+namespace gr
+{
+
+/*----------------------------------------------------------------------------------------------
+ A convenient way to group together style and feature information that interacts
+ with the rules.
+
+ Hungarian: fval
+----------------------------------------------------------------------------------------------*/
+class GrFeatureValues
+{
+ friend class GrCharStream;
+ friend class GrSlotAbstract;
+ friend class GrSlotState;
+
+public:
+ // Standard constructor:
+ GrFeatureValues()
+ {
+ m_nStyleIndex = 0;
+ std::fill(m_rgnFValues, m_rgnFValues + kMaxFeatures, 0);
+ }
+
+ // Copy constructor:
+ GrFeatureValues(const GrFeatureValues & fval)
+ {
+ m_nStyleIndex = fval.m_nStyleIndex;
+ std::copy(fval.m_rgnFValues, fval.m_rgnFValues + kMaxFeatures, m_rgnFValues);
+ }
+
+ bool FeatureValue(size_t ifeat)
+ {
+ return m_rgnFValues[ifeat];
+ }
+
+ // For transduction logging:
+#ifdef TRACING
+ void WriteXductnLog(GrTableManager * ptman, std::ostream &);
+#endif // TRACING
+
+protected:
+ int m_nStyleIndex;
+ int m_rgnFValues[kMaxFeatures];
+};
+
+} // namespace gr
+
+
+#endif // !GR_FEATVAL_INCLUDED
diff --git a/Build/source/libs/graphite/src/segment/GrGlyphTable.cpp b/Build/source/libs/graphite/src/segment/GrGlyphTable.cpp
new file mode 100644
index 00000000000..8643eae8cb8
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrGlyphTable.cpp
@@ -0,0 +1,650 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrGlyphTable.cpp
+Responsibility: Sharon Correll
+Last reviewed: 10Aug99, JT, quick look over
+
+Description:
+ Implements the GrGlyphTable class and related classes.
+----------------------------------------------------------------------------------------------*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:End Ignore
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Fill in the glyph table from the font stream.
+----------------------------------------------------------------------------------------------*/
+bool GrGlyphTable::ReadFromFont(GrIStream & grstrmGloc, long lGlocStart,
+ GrIStream & grstrmGlat, long lGlatStart,
+ data16 chwBWAttr, data16 chwJStrAttr, int cJLevels, int cnCompPerLig,
+ int fxdSilfVersion)
+{
+ // Create the glyph sub-table for the single style.
+ GrGlyphSubTable * pgstbl = new GrGlyphSubTable();
+
+ // Gloc table--offsets into Glat table
+ grstrmGloc.SetPositionInFont(lGlocStart);
+
+ // version
+ int fxdGlocVersion = GrEngine::ReadVersion(grstrmGloc);
+ if (fxdGlocVersion > kGlocVersion)
+ return false;
+
+ // flags
+ short snFlags = grstrmGloc.ReadShortFromFont();
+
+ // number of attributes
+ unsigned short cAttrs = grstrmGloc.ReadUShortFromFont();
+
+ // Create a single sub-table for the single style.
+ pgstbl->Initialize(fxdSilfVersion, snFlags, chwBWAttr, chwJStrAttr, data16(chwJStrAttr + cJLevels),
+ m_cglf, cAttrs, cnCompPerLig);
+
+ SetSubTable(0, pgstbl);
+
+ return pgstbl->ReadFromFont(grstrmGloc, m_cglf, grstrmGlat, lGlatStart);
+}
+
+bool GrGlyphSubTable::ReadFromFont(GrIStream & grstrmGloc, int cGlyphs,
+ GrIStream & grstrmGlat, long lGlatStart)
+{
+ // attribute value offsets--slurp
+ if (m_fGlocShort)
+ {
+ grstrmGloc.ReadBlockFromFont(m_prgibBIGAttrValues, ((cGlyphs + 1) * sizeof(data16)));
+ }
+ else
+ {
+ grstrmGloc.ReadBlockFromFont(m_prgibBIGAttrValues, ((cGlyphs + 1) * sizeof(data32)));
+ }
+
+ // length of buffer needed for glyph attribute values:
+ int cbBufLen = GlocLookup(data16(cGlyphs));
+
+ // TODO: slurp debugger offsets: 'm_prgibBIGGlyphAttrDebug'
+
+ m_pgatbl = new GrGlyphAttrTable();
+ m_pgatbl->Initialize(m_fxdSilfVersion, cbBufLen);
+
+ // Glat table
+ grstrmGlat.SetPositionInFont(lGlatStart);
+
+ // version
+ int fxdGlatVersion = grstrmGlat.ReadIntFromFont();
+ if (fxdGlatVersion > kGlatVersion)
+ return false;
+
+ // Back up over the version number and include it right in the attribute value entry
+ // buffer, since the offsets take it into account.
+ grstrmGlat.SetPositionInFont(lGlatStart);
+
+ // Slurp the entire block of entries.
+ grstrmGlat.ReadBlockFromFont(m_pgatbl->m_prgbBIGEntries, cbBufLen);
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Create an empty glyph table with no glyph attributes.
+----------------------------------------------------------------------------------------------*/
+void GrGlyphTable::CreateEmpty()
+{
+ // Create the glyph sub-table for the single style.
+ GrGlyphSubTable * pgstbl = new GrGlyphSubTable();
+
+ // Create a single sub-table for the single style.
+ pgstbl->Initialize(0, 0, 0, 0, 0, m_cglf, 0, 0);
+
+ SetSubTable(0, pgstbl);
+
+ pgstbl->CreateEmpty();
+}
+
+void GrGlyphSubTable::CreateEmpty()
+{
+ m_pgatbl = new GrGlyphAttrTable();
+ m_pgatbl->Initialize(0, 0);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Initialization.
+----------------------------------------------------------------------------------------------*/
+void GrGlyphSubTable::Initialize(int fxdSilfVersion, utf16 chwFlags,
+ data16 chwBWAttr, data16 chwJStrAttr, data16 chwJStrHWAttr,
+ int cGlyphs, int cAttrs, int cnCompPerLig)
+{
+ m_fxdSilfVersion = fxdSilfVersion;
+ m_fHasDebugStrings = HasAttrNames(chwFlags);
+ m_nAttrIDLim = cAttrs;
+ m_chwBWAttr = chwBWAttr;
+ m_chwJStrAttr = chwJStrAttr;
+ m_chwJStrHWAttr = chwJStrHWAttr;
+ m_fGlocShort = !LongFormat(chwFlags);
+
+ if (m_fGlocShort)
+ { // item # cGlyphs holds length, which is convenient for dealing with last item
+ m_prgibBIGAttrValues = new byte[(cGlyphs + 1) * sizeof(data16)];
+ }
+ else
+ {
+ m_prgibBIGAttrValues = new byte[(cGlyphs + 1) * sizeof(data32)];
+ }
+
+
+ if (m_fHasDebugStrings)
+ {
+ m_prgibBIGGlyphAttrDebug = new data16[cAttrs + 1];
+ }
+
+ // Make a cache to hold a list of defined components for each glyph. This is
+ // calculated lazily, as needed, so we also include (as the first item) a flag to
+ // indicate whether or not it has been calculated; hence the "+1".
+ m_cnCompPerLig = cnCompPerLig;
+ m_prgnDefinedComponents = new int[(m_cnCompPerLig + 1) * cGlyphs];
+ std::fill_n(m_prgnDefinedComponents, (m_cnCompPerLig + 1) * cGlyphs, 0);
+
+ // Now the instance is ready to have the locations and the debug strings
+ // read from the file.
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the attribute value for the given glyph.
+----------------------------------------------------------------------------------------------*/
+int GrGlyphSubTable::GlyphAttrValue(gid16 chwGlyphID, int nAttrID)
+{
+ if (m_nAttrIDLim == 0)
+ {
+ // No attributes defined (eg, invalid font)
+ return 0;
+ }
+ if (nAttrID >= m_nAttrIDLim || nAttrID >= 0xFF)
+ {
+ gAssert(false);
+ return 0;
+ }
+ int ibMin = GlocLookup(chwGlyphID); // where this glyph's attrs start
+ int ibLim = GlocLookup(chwGlyphID + 1); // where next glyph starts
+
+ int nRet = m_pgatbl->GlyphAttr16BitValue(ibMin, ibLim, byte(nAttrID));
+ if ((data16)nAttrID == m_chwJStrAttr)
+ {
+ // For justify.stretch, which can be a 32-bit value, add on the high word.
+ unsigned int nRetHW = m_pgatbl->GlyphAttr16BitValue(ibMin, ibLim, byte(m_chwJStrHWAttr));
+ nRet = (nRetHW << 16) | nRet;
+ }
+ return ConvertValueForVersion(nRet, nAttrID);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Convert the glyph attribute value from the version of the font table to what is
+ expected by the engine.
+----------------------------------------------------------------------------------------------*/
+int GrGlyphSubTable::ConvertValueForVersion(int nValue, int nAttrID)
+{
+ return ConvertValueForVersion(nValue, nAttrID, (int)m_chwBWAttr, m_fxdSilfVersion);
+}
+
+int GrGlyphSubTable::ConvertValueForVersion(int nValue, int nAttrID, int nBWAttr, int fxdVersion)
+{
+ if ((nBWAttr >= 0 && nAttrID == (int)nBWAttr) ||
+ (nBWAttr == -1 && nAttrID == (int)kslatBreak))
+ {
+ if (fxdVersion < 0x00020000)
+ {
+ //switch (nValue)
+ //{
+ //case klbv1WordBreak: return klbWordBreak;
+ //case klbv1HyphenBreak: return klbHyphenBreak;
+ //case klbv1LetterBreak: return klbLetterBreak;
+ //case klbv1ClipBreak: return klbClipBreak;
+ //default:
+ // break;
+ //}
+ //switch (nValue * -1)
+ //{
+ //case klbv1WordBreak: return (klbWordBreak * -1);
+ //case klbv1HyphenBreak: return (klbHyphenBreak * -1);
+ //case klbv1LetterBreak: return (klbLetterBreak * -1);
+ //case klbv1ClipBreak: return (klbClipBreak * -1);
+ //default:
+ // break;
+ //}
+
+ // Breakweight values in version 2 are 10 times what they were in version 1.
+ if (abs(nValue) <= 7)
+ return nValue * 10;
+ }
+ }
+ return nValue;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the attribute value a glyph. Loop through the attribute runs, looking
+ for the one containing the given attribute. Assume the value is 0 if not found.
+
+ @param ibMin - byte offset of first run for the glyph of interest
+ @param ibLim - byte offset of first run for the following glyph
+ @param bAttrID - attribute to find
+----------------------------------------------------------------------------------------------*/
+int GrGlyphAttrTable::GlyphAttr16BitValue(int ibMin, int ibLim, byte bAttrID)
+{
+ GrGlyphAttrRun gatrun;
+ byte * pbBIGEnt = m_prgbBIGEntries + ibMin;
+
+ while (pbBIGEnt < m_prgbBIGEntries + ibLim)
+ {
+ // Suck the run of attribute values into the instance, so we can see
+ // what's there.
+ gatrun.CopyFrom(pbBIGEnt);
+
+ if (bAttrID < gatrun.m_bMinAttrID)
+ // Attribute not found--assume value is 0.
+ return 0;
+ else if (gatrun.m_bMinAttrID + gatrun.m_cAttrs > bAttrID)
+ {
+ // Found the value in this run.
+ data16 chw = lsbf(gatrun.m_rgchwBIGValues[bAttrID - gatrun.m_bMinAttrID]);
+ if ((chw & 0x8000) == 0)
+ return (int)chw;
+ else
+ return 0xFFFF0000 | chw; // sign extension
+ }
+ else
+ // Go to next run.
+ pbBIGEnt += gatrun.ByteCount();
+ }
+
+ // Attribute not found--assume value is 0;
+ return 0;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Given a point on the glyph, determine which component (if any) the point is in, and return
+ its index relative to the components that are defined for this glyph; ie, the index within
+ the compRef array.
+ Return -1 if the click with not inside any component, or if there are no components
+ defined for this glyph.
+ CURRENTLY NOT USED - if ever used, need to incorporate floating point
+----------------------------------------------------------------------------------------------*/
+int GrGlyphSubTable::ComponentContainingPoint(gid16 chwGlyphID, int x, int y)
+{
+ int i = CalculateDefinedComponents(chwGlyphID);
+ for (int inComp = 0; inComp < m_cnCompPerLig; inComp++)
+ {
+ // The m_pnComponents list holds a list of the component attributes that are defined
+ // for this glyph, padded with -1's.
+ int nCompID = m_prgnDefinedComponents[i + inComp];
+ if (nCompID == -1)
+ break; // hit the end of the list
+
+ // The value of the component attribute is actually the attribute ID for the
+ // first of the component box fields--the top. There should a contiguous group of
+ // four fields: top, bottom, left, right.
+ int nFieldIDMin = GlyphAttrValue(chwGlyphID, nCompID);
+ gAssert(nFieldIDMin != 0);
+ int nTop = GlyphAttrValue(chwGlyphID, nFieldIDMin);
+ int nBottom = GlyphAttrValue(chwGlyphID, nFieldIDMin + 1);
+ int nLeft = GlyphAttrValue(chwGlyphID, nFieldIDMin + 2);
+ int nRight = GlyphAttrValue(chwGlyphID, nFieldIDMin + 3);
+
+ if (nLeft <= x && x < nRight &&
+ nBottom <= y && y < nTop)
+ {
+ return inComp;
+ }
+ }
+ return -1;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Fill in the box with the source-device coordinates corresponding to the given component.
+ The rectangle is relative to the top-left of the glyph.
+ Return false if the component is not defined.
+
+ @param xysEmSquare - of the font, in logical units
+ @param chwGlyphID - the glyph of interest
+ @param icomp - the component of interest (eg, for the "oe" ligature,
+ the index for component.o would be 0,
+ and the index for component.e would be 1);
+ these is as defined by the glyph, not as used in the rules
+ @param mFontEmUnits - the number of em-units in the font, for scaling
+ @param dysFontAscent - ascent of the font, for adjusting coordinate systems
+ @param pxsLeft, pxsRight, pysTop, pysBottom
+ - return values, in source device coordinates
+ @param fTopOrigin - convert values to a coordinate system where the origin is the
+ top of the line, not the baseline
+----------------------------------------------------------------------------------------------*/
+bool GrGlyphSubTable::ComponentBoxLogUnits(float xysEmSquare,
+ gid16 chwGlyphID, int icomp, int mFontEmUnits, float dysFontAscent,
+ float * pxsLeft, float * pysTop, float * pxsRight, float * pysBottom,
+ bool fTopOrigin)
+{
+ int i = CalculateDefinedComponents(chwGlyphID);
+
+ // The m_pnComponents list holds a list of the component attributes that are defined
+ // for this glyph, padded with -1's.
+ int nCompID = m_prgnDefinedComponents[i + icomp];
+ if (nCompID == -1)
+ {
+ // Ooops, the component is undefined for this glyph.
+ *pxsLeft = 0;
+ *pxsRight = 0;
+ *pysTop = 0;
+ *pysBottom = 0;
+ return false;
+ }
+
+ // The value of the component attribute is actually the attribute ID for the
+ // first of the component box fields--the top. There should a contiguous group of
+ // four fields: top, bottom, left, right.
+ int nFieldIDMin = GlyphAttrValue(chwGlyphID, nCompID);
+ if (nFieldIDMin == 0)
+ {
+ // Component inadequately defined. This can happen when we defined components
+ // for a glyph and then substituted another glyph for it.
+ *pxsLeft = 0;
+ *pxsRight = 0;
+ *pysTop = 0;
+ *pysBottom = 0;
+ return false;
+ }
+ int mTop = GlyphAttrValue(chwGlyphID, nFieldIDMin);
+ int mBottom = GlyphAttrValue(chwGlyphID, nFieldIDMin + 1);
+ int mLeft = GlyphAttrValue(chwGlyphID, nFieldIDMin + 2);
+ int mRight = GlyphAttrValue(chwGlyphID, nFieldIDMin + 3);
+
+ ////int xysFontEmUnits;
+ ////// ysHeight should correspond to the pixels in the font's em square
+ ////GrResult res = pgg->GetFontEmSquare(&xysFontEmUnits);
+ ////if (ResultFailed(res))
+ //// return false;
+
+ *pxsLeft = GrEngine::GrIFIMulDiv(mLeft, xysEmSquare, mFontEmUnits);
+ *pxsRight = GrEngine::GrIFIMulDiv(mRight, xysEmSquare, mFontEmUnits);
+ *pysTop = GrEngine::GrIFIMulDiv(mTop, xysEmSquare, mFontEmUnits);
+ *pysBottom = GrEngine::GrIFIMulDiv(mBottom, xysEmSquare, mFontEmUnits);
+
+ if (*pxsLeft > *pxsRight)
+ {
+ float xsTmp = *pxsLeft;
+ *pxsLeft = *pxsRight;
+ *pxsRight = xsTmp;
+ }
+ if (*pysTop < *pysBottom)
+ {
+ float ysTmp = *pysTop;
+ *pysTop = *pysBottom;
+ *pysBottom = ysTmp;
+ }
+
+ if (fTopOrigin)
+ {
+ // Currently top and bottom coordinates are such that 0 is the baseline and positive is
+ // upwards, while for the box we want to return, 0 is the top of the glyph and positive
+ // is downwards. So switch systems.
+ *pysTop = (dysFontAscent - *pysTop);
+ *pysBottom = (dysFontAscent - *pysBottom);
+ }
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Calculate the list of defined components for the given glyph, if any.
+ Return the index to the first relevant item in the array.
+ Private.
+ TODO: With the current implementation that stores the glyph ids in each slot, this
+ mechanism is redundant and obsolete, and should be removed.
+----------------------------------------------------------------------------------------------*/
+int GrGlyphSubTable::CalculateDefinedComponents(gid16 chwGlyphID)
+{
+ // The first item is a flag indicating whether the list has been calculated.
+ int iFlag = chwGlyphID * (m_cnCompPerLig + 1); // index of has-been-calculated flag
+ int iMin = iFlag + 1; // first actual value; +1 in order to skip the flag
+ if (m_prgnDefinedComponents[iFlag] == 0)
+ {
+ int iTmp = iMin;
+ for (int nCompID = 0; nCompID < m_cComponents; nCompID++)
+ {
+ if (ComponentIsDefined(chwGlyphID, nCompID))
+ m_prgnDefinedComponents[iTmp++] = nCompID;
+ if (iTmp - iMin >= m_cnCompPerLig)
+ break; // ignore any components beyond the maximum allowed
+ }
+ // Fill in the rest of the list with -1.
+ for( ; iTmp < iMin + m_cnCompPerLig; iTmp++)
+ m_prgnDefinedComponents[iTmp] = -1;
+
+ m_prgnDefinedComponents[iFlag] = 1; // has been calculated
+ }
+ return iMin;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if the given attr ID, which is a component definition attribute, indicates
+ that that component is defined for the given glyph.
+
+ @param chwGlyphID - the glyph of interest
+ @param nAttrID - the attribute of interest, assumed to be a component glyph
+ attribute (eg. component.e.top)
+----------------------------------------------------------------------------------------------*/
+bool GrGlyphSubTable::ComponentIsDefined(gid16 chwGlyphID, int nAttrID)
+{
+ gAssert(nAttrID < m_cComponents);
+ if (nAttrID >= m_cComponents)
+ return false;
+
+ return (GlyphAttrValue(chwGlyphID, nAttrID) != 0);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the index of the given component as defined for the given glyph ID. that is,
+ convert the global ID for the component to the one within this glyph. Return -1
+ if the component is not defined for the given glyph.
+ For instance, given the glyph ID "oe" (the oe ligature) and the attr ID for component.o,
+ the result would be 0; for component.e the result would be 1.
+----------------------------------------------------------------------------------------------*/
+int GrGlyphSubTable::ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID)
+{
+ int i = CalculateDefinedComponents(chwGlyphID);
+
+ for (int iLp = 0; iLp < m_cnCompPerLig; iLp++)
+ {
+ if (m_prgnDefinedComponents[i + iLp] == nCompID)
+ return iLp;
+ }
+ return -1;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the ID of the nth defined component attribute for the given glyph.
+----------------------------------------------------------------------------------------------*/
+//int GrGlyphSubTable::NthComponentID(gid16 chwGlyphID, int n)
+//{
+// int i = CalculateDefinedComponents(chwGlyphID);
+// return m_pnComponents[i + 1 + n];
+//}
+
+
+//:>********************************************************************************************
+//:> For test procedures
+//:>********************************************************************************************
+
+//:Ignore
+#ifdef OLD_TEST_STUFF
+
+void GrGlyphTable::SetUpTestData()
+{
+ SetNumberOfGlyphs(5);
+ SetNumberOfStyles(1);
+
+ GrGlyphSubTable * pgstbl = new GrGlyphSubTable();
+ gAssert(pgstbl);
+
+ pgstbl->Initialize(1, 0, 5, 10, 4);
+ SetSubTable(0, pgstbl);
+
+ pgstbl->SetUpTestData();
+}
+
+/***********************************************************************************************
+ TODO: This method is BROKEN because m_prgibBIGAttrValues has been changed. It is no
+ longer a utf16 *. The Gloc table can contain 16-bit or 32-bit entries and must be
+ accessed accordingly.
+***********************************************************************************************/
+void GrGlyphSubTable::SetUpTestData()
+{
+ m_pgatbl = new GrGlyphAttrTable();
+ m_pgatbl->Initialize(0, 48);
+
+ m_prgibBIGAttrValues[0] = byte(msbf(data16(0)));
+ m_prgibBIGAttrValues[1] = byte(msbf(data16(6))));
+ m_prgibBIGAttrValues[2] = byte(msbf(data16(20)));
+ m_prgibBIGAttrValues[3] = byte(msbf(data16(20)));
+ m_prgibBIGAttrValues[4] = byte(msbf(data16(40)));
+ m_prgibBIGAttrValues[5] = byte(msbf(data16(48)));
+
+ m_pgatbl->SetUpTestData();
+}
+
+void GrGlyphAttrTable::SetUpTestData()
+{
+ // Glyph 0 (1 run; offset = 0):
+ // 1 = 11 = 0x0B
+ // 2 = 22 = 0x16
+ // 0102 000B 0016
+ //
+ // Glyph 1 (2 runs; offset = 3*2 = 6):
+ // 0 = 5
+ // 1 = 6
+ // 2 = 7
+ // 8 = 8
+ // 9 = 9
+ // 0003 0005 0006 0007
+ // 0802 0008 0009
+ //
+ // Glyph 2 (0 runs; offset = 6 + 7*2 = 20):
+ // all values = 0
+ //
+ // Glyph 3 (5 runs; offset = 20):
+ // 1 = 111 = 0x006F
+ // 3 = 333 = 0x00DE
+ // 5 = 555 = 0x022B
+ // 7 = 777 = 0x0309
+ // 9 = 999 = 0x03E7
+ // 0101 006F
+ // 0301 00DE
+ // 0501 022B
+ // 0701 0309
+ // 0901 03E7
+ //
+ // Glyph 4 (1 run; offset = 20 + 10*2 = 40):
+ // 5 = 4
+ // 6 = 4
+ // 7 = 4
+ // 0503 0004 0004 0004
+ //
+ // Glyph 5 (offset = 40 + 4*2 = 48)
+
+ byte * pbBIG = m_prgbBIGEntries;
+
+ GrGlyphAttrRun gatrun;
+
+ // Glyph 0
+ gatrun.m_bMinAttrID = 1;
+ gatrun.m_cAttrs = 2;
+ gatrun.m_rgchwBIGValues[0] = msbf(data16(11));
+ gatrun.m_rgchwBIGValues[1] = msbf(data16(22));
+ memcpy(pbBIG, &gatrun, 6);
+ pbBIG += 6;
+
+ // Glyph 1
+ gatrun.m_bMinAttrID = 0;
+ gatrun.m_cAttrs = 3;
+ gatrun.m_rgchwBIGValues[0] = msbf(data16(5));
+ gatrun.m_rgchwBIGValues[1] = msbf(data16(6));
+ gatrun.m_rgchwBIGValues[2] = msbf(data16(7));
+ memcpy(pbBIG, &gatrun, 8);
+ pbBIG += 8;
+ gatrun.m_bMinAttrID = 8;
+ gatrun.m_cAttrs = 2;
+ gatrun.m_rgchwBIGValues[0] = msbf(data16(8));
+ gatrun.m_rgchwBIGValues[1] = msbf(data16(9));
+ memcpy(pbBIG, &gatrun, 6);
+ pbBIG += 6;
+
+ // Glyph 2: no data
+
+ // Glyph 3
+ gatrun.m_bMinAttrID = 1;
+ gatrun.m_cAttrs = 1;
+ gatrun.m_rgchwBIGValues[0] = msbf(data16(111));
+ memcpy(pbBIG, &gatrun, 4);
+ pbBIG += 4;
+ gatrun.m_bMinAttrID = 3;
+ gatrun.m_cAttrs = 1;
+ gatrun.m_rgchwBIGValues[0] = msbf(data16(333));
+ memcpy(pbBIG, &gatrun, 4);
+ pbBIG += 4;
+ gatrun.m_bMinAttrID = 5;
+ gatrun.m_cAttrs = 1;
+ gatrun.m_rgchwBIGValues[0] = msbf(data16(555));
+ memcpy(pbBIG, &gatrun, 4);
+ pbBIG += 4;
+ gatrun.m_bMinAttrID = 7;
+ gatrun.m_cAttrs = 1;
+ gatrun.m_rgchwBIGValues[0] = msbf(data16(777));
+ memcpy(pbBIG, &gatrun, 4);
+ pbBIG += 4;
+ gatrun.m_bMinAttrID = 9;
+ gatrun.m_cAttrs = 1;
+ gatrun.m_rgchwBIGValues[0] = msbf(data16(999));
+ memcpy(pbBIG, &gatrun, 4);
+ pbBIG += 4;
+
+ // Glyph 4
+ gatrun.m_bMinAttrID = 5;
+ gatrun.m_cAttrs = 3;
+ gatrun.m_rgchwBIGValues[0] = msbf(data16(4));
+ gatrun.m_rgchwBIGValues[1] = msbf(data16(4));
+ gatrun.m_rgchwBIGValues[2] = msbf(data16(4));
+ memcpy(pbBIG, &gatrun, 8);
+ pbBIG += 8;
+
+ gAssert(pbBIG == m_prgbBIGEntries + 48);
+}
+
+#endif // OLD_TEST_STUFF
+
+} // namespace gr
+
+//:End Ignore
diff --git a/Build/source/libs/graphite/src/segment/GrGlyphTable.h b/Build/source/libs/graphite/src/segment/GrGlyphTable.h
new file mode 100644
index 00000000000..bec0e518dee
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrGlyphTable.h
@@ -0,0 +1,429 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrGlyphTable.h
+Responsibility: Sharon Correll
+Last reviewed: 10Aug99, JT, quick look over
+
+Description:
+ The GrGlyphTable and related classes that store the values of glyph attributes.
+
+ For each glyph in a TrueType font, Graphite has a list of glyph attributes (which
+ are defined in the GDL script file). Since most of the values will be zero, we save space
+ by only storing the non-zero values.
+
+ Eventually it may be possible to have more than one TrueType font compiled into a single
+ glyph table, hence the need for multiple sub-tables. For now we assume that there is only
+ one font file and only one sub-table.
+
+ Note that BIG in a variable name means that the data is in big-endian format, or is a range
+ of bytes that must be interpreted as a run of wide chars or ints in big-endian format.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+//:Ignore
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GR_GTABLE_INCLUDED
+#define GR_GTABLE_INCLUDED
+//:End Ignore
+
+namespace gr
+{
+
+class Font;
+
+/*----------------------------------------------------------------------------------------------
+ A run of non-zero attribute values for a single glyph, where the attribute IDs
+ are contiguous.
+
+ NOTE: it is assumed that the format of this class matches the byte order of the data as it
+ is read directly from the TTF/ECF file--that is, it is big-endian.
+
+ Hungarian: gatrun
+----------------------------------------------------------------------------------------------*/
+
+class GrGlyphAttrRun
+{
+ friend class GrGlyphTable;
+ friend class GrGlyphSubTable;
+ friend class GrGlyphAttrTable;
+
+ enum {
+ kMaxAttrsPerRun = 255
+ };
+
+ /*------------------------------------------------------------------------------------------
+ Copy the raw memory (starting at the given byte) into the instance. This method must
+ reflect the format of the "Glat_entry" as it is stored in the file and slurped into
+ memory.
+ ------------------------------------------------------------------------------------------*/
+ void CopyFrom(byte * pbBIGEnt)
+ {
+ m_bMinAttrID = *pbBIGEnt;
+ m_cAttrs = *(pbBIGEnt + 1);
+ if (m_cAttrs >= kMaxAttrsPerRun)
+ {
+ gAssert(false);
+ m_cAttrs = kMaxAttrsPerRun;
+ }
+ #ifdef _DEBUG
+ // Probably not strictly necessary to zero the array, but convenient for debugging.
+ // Removed from release build for optimization
+ std::fill(m_rgchwBIGValues, m_rgchwBIGValues + kMaxAttrsPerRun, 0);
+ #endif
+ // this is mixing types of data16 and byte pointers!
+ const data16 * prgchw = reinterpret_cast<const data16*>(pbBIGEnt + 2);
+ std::copy(prgchw, prgchw + m_cAttrs, m_rgchwBIGValues);
+ }
+
+ int ByteCount()
+ {
+ return (2 + (m_cAttrs * isizeof(data16)));
+ }
+
+protected:
+ byte m_bMinAttrID; // ID of first attribute in the run
+ byte m_cAttrs; // number of attributes in the run
+ data16 m_rgchwBIGValues[kMaxAttrsPerRun];
+};
+
+/*----------------------------------------------------------------------------------------------
+ Contains runs of attribute values for all the glyphs in the font; corresponds to
+ the "Glat" table in the font.
+
+ Hungarian: gatbl
+----------------------------------------------------------------------------------------------*/
+
+class GrGlyphAttrTable
+{
+ friend class GrGlyphTable;
+ friend class GrGlyphSubTable;
+ friend class FontMemoryUsage;
+
+protected:
+ // Constructor:
+ GrGlyphAttrTable()
+ {
+ m_prgbBIGEntries = NULL;
+ }
+
+ // Destructor:
+ ~GrGlyphAttrTable()
+ {
+ delete[] m_prgbBIGEntries;
+ }
+
+ // Initialization:
+ void Initialize(int fxdSilfVersion, int cbBufLen)
+ {
+ m_fxdSilfVersion = fxdSilfVersion;
+ m_cbEntryBufLen = cbBufLen;
+ m_prgbBIGEntries = new byte[cbBufLen];
+ // Now the instance is ready to have all the glyph attr entries slurped into
+ // the byte array from the file.
+ }
+
+ int GlyphAttr16BitValue(int ibMin, int ibLim, byte bAttrID);
+
+protected:
+ int m_fxdSilfVersion; // version number of the Silf table, which is used
+ // to interpret the attribute values
+
+ // Block of variable-length glyph attribute runs, matching the format of
+ // GrGlyphAttrRun. We don't store instances of that class here because they
+ // are variable length, and it would be too slow to read them individually from the
+ // font. Instead, we set up a single instance in the method that accesses the values;
+ // having this instance will help debugging. Eventually we may want to do without it,
+ // if it would help efficiency.
+ int m_cbEntryBufLen; // needed only for memory instrumentation
+ byte * m_prgbBIGEntries;
+
+//:Ignore
+#ifdef OLD_TEST_STUFF
+public:
+ // For test procedures:
+ void SetUpTestData();
+ void SetUpLigatureTest();
+ void SetUpLigature2Test();
+#endif // OLD_TEST_STUFF
+
+//:End Ignore
+
+};
+
+/*----------------------------------------------------------------------------------------------
+ One glyph table per font (style) file; corresponds to the "Gloc" table in the font.
+ Currently there is only considered to be one style per file, so there is only one of
+ these. It holds the (non-zero) glyph attribute values for every glyph in the font.
+
+ Hungarian: gstbl
+
+ Review: Eventually we may need to make a subclass that uses 32-bit values for the offsets,
+ or just use a separate array pointer in this class. Which would be preferable?
+----------------------------------------------------------------------------------------------*/
+
+class GrGlyphSubTable
+{
+ friend class GrGlyphTable;
+ friend class FontMemoryUsage;
+
+public:
+ // Constructor:
+ GrGlyphSubTable() :
+ m_pgatbl(NULL),
+ m_prgibBIGAttrValues(NULL),
+ m_prgibBIGGlyphAttrDebug(NULL),
+ m_prgnDefinedComponents(NULL)
+ {
+ }
+ // Destructor:
+ ~GrGlyphSubTable()
+ {
+ delete m_pgatbl;
+ delete[] m_prgibBIGAttrValues;
+ if (m_fHasDebugStrings)
+ delete[] m_prgibBIGGlyphAttrDebug;
+ delete[] m_prgnDefinedComponents;
+ }
+
+ // Initialization:
+ bool ReadFromFont(GrIStream & gloc_strm, int cGlyphs,
+ GrIStream & glat_strm, long lGlatStart);
+ void Initialize(int fxdSilfVersion, data16 chwFlags,
+ data16 chwBWAttr, data16 chwJStrAttr, data16 chwJStrHWAttr,
+ int cGlyphs, int cAttrs, int cnCompPerLig);
+
+ void CreateEmpty();
+
+ void SetNumberOfComponents(int c)
+ {
+ m_cComponents = c;
+ }
+
+ // General:
+ int NumberOfGlyphAttrs() { return m_nAttrIDLim; } // 0..(m_nAttrIDLim-1)
+
+ int GlyphAttrValue(gid16 chwGlyphID, int nAttrID);
+
+ // Ligatures:
+ int ComponentContainingPoint(gid16 chwGlyphID, int x, int y);
+ bool ComponentBoxLogUnits(float xysEmSquare, gid16 chwGlyphID, int icomp,
+ int mFontEmUnits, float dysAscent,
+ float * pxsLeft, float * pysTop, float * pxsRight, float * pysBottom,
+ bool fTopOrigin = true);
+protected:
+ int CalculateDefinedComponents(gid16 chwGlyphID);
+ bool ComponentIsDefined(gid16 chwGlyphID, int nAttrID);
+ int ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID);
+// int NthComponentID(gid16 chwGlyphID, int n);
+ int ConvertValueForVersion(int nRet, int nAttrID);
+
+public:
+ static int ConvertValueForVersion(int nRet, int nAttrID, int nBWAttr, int fxdVersion);
+
+ // Flags:
+ bool LongFormat(data16 chwFlags) // 32-bit values?
+ {
+ return ((chwFlags & 0x01) == 0x01); // bit 0
+ }
+ bool HasAttrNames(data16 chwFlags)
+ {
+ return ((chwFlags & 0x02) == 0x02); // bit 1
+ }
+ int GlocLookup(data16 chwGlyphId)
+ {
+ if (m_fGlocShort)
+ {
+ unsigned short su = ((unsigned short *)m_prgibBIGAttrValues)[chwGlyphId];
+ return lsbf(su);
+ }
+ else
+ { unsigned int u = ((unsigned int *)m_prgibBIGAttrValues)[chwGlyphId];
+ return lsbf((int)u);
+ }
+ }
+
+protected:
+ int m_fxdSilfVersion; // version number of the Silf table, which is used
+ // to interpret the attribute values
+ bool m_fHasDebugStrings; // are debugging strings loaded into memory?
+
+ int m_nAttrIDLim; // number of glyph attributes
+ int m_cComponents; // number of initial glyph attributes that
+ // represent ligature components
+ int m_cnCompPerLig;
+
+ GrGlyphAttrTable * m_pgatbl;
+ byte * m_prgibBIGAttrValues; // byte offsets for glyph attr values - BIG endian
+ bool m_fGlocShort; // flag for Gloc table format
+ data16 * m_prgibBIGGlyphAttrDebug; // byte offsets for glyph attr debug strings - BIG endian
+
+ data16 m_chwBWAttr; // breakweight attr ID; needed for converting
+ // between versions
+
+ // Attr IDs for justify.0.stretch and justify.0.stretchHW; these must always be looked
+ // up in tandem.
+ data16 m_chwJStrAttr;
+ data16 m_chwJStrHWAttr;
+
+ int * m_prgnDefinedComponents; // for each glyph, cache list of component attributes that
+ // are defined
+
+//:Ignore
+#ifdef OLD_TEST_STUFF
+public:
+ // For test procedures:
+ void SetUpTestData();
+ void SetUpLigatureTest();
+ void SetUpLigature2Test();
+#endif // OLD_TEST_STUFF
+
+//:End Ignore
+};
+
+/*----------------------------------------------------------------------------------------------
+ Holds all the information about glyph attributes.
+
+ Hungarian: gtbl
+----------------------------------------------------------------------------------------------*/
+
+class GrGlyphTable
+{
+ friend class GrGlyphSubTable;
+ friend class FontMemoryUsage;
+
+public:
+ // Constructor:
+ GrGlyphTable()
+ {
+ m_cglf = 0;
+ m_cComponents = 0;
+ m_cgstbl = 0;
+ m_vpgstbl.clear();
+ }
+
+ // Destructor:
+ ~GrGlyphTable()
+ {
+ for (int i = 0; i < m_cgstbl; ++i)
+ delete m_vpgstbl[i];
+ }
+
+ bool ReadFromFont(GrIStream & gloc_strm, long lGlocStart,
+ GrIStream & glat_strm, long lGlatStart,
+ data16 chwBWAttr, data16 chwJStrAttr, int cJLevels, int cnCompPerLig,
+ int fxdSilfVersion);
+
+ void CreateEmpty();
+
+ // Setters:
+ void SetNumberOfGlyphs(int c)
+ {
+ m_cglf = c;
+ }
+ void SetNumberOfStyles(int c)
+ {
+ m_cgstbl = c;
+ m_vpgstbl.resize(c);
+ }
+ void SetNumberOfComponents(int c)
+ {
+ m_cComponents = c;
+ for (unsigned int ipgstbl = 0; ipgstbl < m_vpgstbl.size(); ipgstbl++)
+ m_vpgstbl[ipgstbl]->SetNumberOfComponents(c);
+ }
+ void SetSubTable(int i, GrGlyphSubTable * pgstbl)
+ {
+ if (signed(m_vpgstbl.size()) <= i)
+ {
+ gAssert(false);
+ m_vpgstbl.resize(i+1);
+ }
+ m_vpgstbl[i] = pgstbl;
+ m_vpgstbl[i]->SetNumberOfComponents(m_cComponents);
+ }
+
+ // Getters:
+ int NumberOfGlyphs() { return m_cglf; }
+ int NumberOfStyles() { return m_cgstbl; }
+
+ int NumberOfGlyphAttrs()
+ {
+ // All of the sub-tables should have the same number of glyph attributes,
+ // so just ask the first.
+ return m_vpgstbl[0]->NumberOfGlyphAttrs();
+ }
+
+ int GlyphAttrValue(gid16 chwGlyphID, int nAttrID)
+ {
+ gAssert(m_cgstbl == 1);
+ return m_vpgstbl[0]->GlyphAttrValue(chwGlyphID, nAttrID);
+ }
+ // Eventually:
+ //int GlyphAttrValue(gid16 chwGlyphID, int nAttrID, int nStyleIndex)
+ //{
+ // return m_vpgstbl[nStyleIndex]->GlyphAttrValue(chwGlyphID, nAttrID);
+ //}
+
+ int ComponentContainingPoint(gid16 chwGlyphID, int x, int y)
+ {
+ gAssert(m_cgstbl == 1);
+ return m_vpgstbl[0]->ComponentContainingPoint(chwGlyphID, x, y);
+ }
+ // Eventually:
+ //int ComponentContainingPoint(gid16 chwGlyphID, int nStyleIndex, int x, int y)
+ //{
+ // gAssert(m_cgstbl == 1);
+ // return m_vpgstbl[nStyleIndex]->ComponentContainingPoint(chwGlyphID, nAttrID);
+ //}
+
+ bool ComponentBoxLogUnits(float xysEmSquare, gid16 chwGlyphID, int icomp,
+ int mFontEmUnits, float dysAscent,
+ float * pxsLeft, float * pysTop, float * pxsRight, float * pysBottom,
+ bool fTopOrigin = true)
+ {
+ gAssert(m_cgstbl == 1);
+ return m_vpgstbl[0]->ComponentBoxLogUnits(xysEmSquare,
+ chwGlyphID, icomp, mFontEmUnits, dysAscent,
+ pxsLeft, pysTop, pxsRight, pysBottom,
+ fTopOrigin);
+ }
+
+ int ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID)
+ {
+ gAssert(m_cgstbl == 1);
+ return m_vpgstbl[0]->ComponentIndexForGlyph(chwGlyphID, nCompID);
+ }
+
+ bool IsEmpty()
+ {
+ return (m_cglf == 0);
+ }
+
+protected:
+ int m_cglf; // number of glyphs
+ int m_cComponents; // number of defined components
+ int m_cgstbl; // number of sub-tables, corresponding to font files;
+ // for now there is only one
+
+ std::vector<GrGlyphSubTable *> m_vpgstbl;
+
+//:Ignore
+#ifdef OLD_TEST_STUFF
+public:
+ // For test procedures:
+ void SetUpTestData();
+ void SetUpLigatureTest();
+ void SetUpLigature2Test();
+#endif // OLD_TEST_STUFF
+//:End Ignore
+
+};
+
+} // namespace gr
+
+#endif // !GR_GTABLE_INCLUDED
diff --git a/Build/source/libs/graphite/src/segment/GrPass.cpp b/Build/source/libs/graphite/src/segment/GrPass.cpp
new file mode 100644
index 00000000000..26eb3a3deb6
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrPass.cpp
@@ -0,0 +1,1995 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrPass.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Implements the GrPass class and subclasses.
+----------------------------------------------------------------------------------------------*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:End Ignore
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Methods
+//:>********************************************************************************************
+/*----------------------------------------------------------------------------------------------
+ Constructors and initializers
+----------------------------------------------------------------------------------------------*/
+GrPass::GrPass(int i)
+ : m_ipass(i),
+ m_fxdVersion(0),
+ m_nMaxRuleContext(0),
+ m_pfsm(NULL),
+ m_nMaxRuleLoop(0),
+ m_nMaxBackup(0),
+ m_crul(0),
+ m_prgchwRuleSortKeys(NULL),
+ m_prgcritRulePreModContext(NULL),
+ m_cbPassConstraint(0),
+ m_prgibConstraintStart(NULL),
+ m_prgibActionStart(NULL),
+ m_prgbPConstraintBlock(NULL),
+ m_prgbConstraintBlock(NULL),
+ m_prgbActionBlock(NULL),
+ m_cbConstraints(0),
+ m_cbActions(0),
+ m_prgibConstraintDebug(NULL),
+ m_prgibRuleDebug(NULL),
+ m_fCheckRules(false),
+ m_prgfRuleOkay(NULL),
+ m_vnStack(128),
+ m_pzpst(NULL)
+{
+}
+
+void PassState::InitForNewSegment(int ipass, int nMaxChunk)
+{
+ m_ipass = ipass;
+ m_nRulesSinceAdvance = 0;
+ m_nMaxChunk = nMaxChunk;
+ m_cslotSkipToResync = 0;
+ m_fDidResyncSkip = false;
+ InitializeLogInfo();
+}
+
+void PassState::InitializeLogInfo()
+{
+ m_crulrec = 0;
+ std::fill_n(m_rgcslotDeletions, 128, 0);
+ std::fill_n(m_rgfInsertion, 128, false);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Destructors
+----------------------------------------------------------------------------------------------*/
+GrPass::~GrPass()
+{
+ delete m_pfsm;
+
+ delete[] m_prgchwRuleSortKeys;
+
+ delete[] m_prgcritRulePreModContext;
+
+ delete[] m_prgibConstraintStart;
+ delete[] m_prgibActionStart;
+
+ delete[] m_prgbPConstraintBlock;
+ delete[] m_prgbConstraintBlock;
+ delete[] m_prgbActionBlock;
+
+ delete[] m_prgfRuleOkay;
+
+ delete[] m_prgibConstraintDebug;
+ delete[] m_prgibRuleDebug;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Fill in the pass by reading from the font stream.
+----------------------------------------------------------------------------------------------*/
+bool GrPass::ReadFromFont(GrIStream & grstrm, int fxdSilfVersion, int fxdRuleVersion,
+ int nOffset)
+{
+ long lPassInfoStart;
+ grstrm.GetPositionInFont(&lPassInfoStart);
+
+ m_fxdVersion = fxdSilfVersion;
+
+ m_fCheckRules = (fxdRuleVersion > kRuleVersion);
+
+// Assert(nOffset == lPassInfoStart);
+ if (lPassInfoStart != nOffset)
+ {
+ grstrm.SetPositionInFont(nOffset);
+ }
+
+ // flags - ignore for now
+ //byte bTmp = grstrm.ReadByteFromFont();
+ grstrm.ReadByteFromFont();
+
+ // MaxRuleLoop
+ m_nMaxRuleLoop = grstrm.ReadByteFromFont();
+
+ // max rule context
+ m_nMaxRuleContext = grstrm.ReadByteFromFont();
+
+ // MaxBackup
+ m_nMaxBackup = grstrm.ReadByteFromFont();
+
+ // number of rules
+ m_crul = grstrm.ReadShortFromFont();
+ // TODO: add a sanity check for the number of rules.
+
+ // offset to pass constraint code, relative to start of subtable
+ int nPConstraintOffset = 0;
+ long lFsmPos = -1;
+ if (fxdSilfVersion >= 0x00020000)
+ {
+ if (fxdSilfVersion >= 0x00030000)
+ lFsmPos = grstrm.ReadUShortFromFont() + nOffset; // offset to row info
+ else
+ grstrm.ReadShortFromFont(); // pad bytes
+ nPConstraintOffset = grstrm.ReadIntFromFont();
+ }
+ // offset to rule constraint code, relative to start of subtable
+ //int nConstraintOffset = grstrm.ReadIntFromFont();
+ grstrm.ReadIntFromFont();
+ // offset to action code, relative to start of subtable
+ //int nActionOffset = grstrm.ReadIntFromFont();
+ grstrm.ReadIntFromFont();
+ // offset to debug strings; 0 if stripped
+ //int nDebugOffset = grstrm.ReadIntFromFont();
+ grstrm.ReadIntFromFont();
+
+ // Jump to beginning of FSM, if we have this information.
+ if (fxdSilfVersion >= 0x00030000)
+ grstrm.SetPositionInFont(lFsmPos);
+ else
+ // Otherwise assume that's where we are!
+ Assert(lFsmPos == -1);
+
+ m_pfsm = new GrFSM();
+
+ m_pfsm->ReadFromFont(grstrm, fxdSilfVersion);
+
+ // rule sort keys
+ m_prgchwRuleSortKeys = new data16[m_crul];
+ data16 * pchw = m_prgchwRuleSortKeys;
+ int irul;
+ for (irul = 0; irul < m_crul; irul++, pchw++)
+ {
+ *pchw = grstrm.ReadUShortFromFont();
+ }
+
+ // rule pre-mod-context item counts
+ m_prgcritRulePreModContext = new byte[m_crul];
+ byte * pb = m_prgcritRulePreModContext;
+ for (irul = 0; irul < m_crul; irul++, pb++)
+ {
+ *pb = grstrm.ReadByteFromFont();
+ }
+
+ // constraint offset for pass-level constraints
+ if (fxdSilfVersion >= 0x00020000)
+ {
+ // reserved - pad byte
+ grstrm.ReadByteFromFont();
+ // Note: pass constraints have not been fully implemented.
+ m_cbPassConstraint = grstrm.ReadUShortFromFont();
+ }
+ else
+ m_cbPassConstraint = 0;
+
+ // constraint and action offsets for rules
+ m_prgibConstraintStart = new data16[m_crul + 1];
+ pchw = m_prgibConstraintStart;
+ for (irul = 0; irul <= m_crul; irul++, pchw++)
+ {
+ *pchw = grstrm.ReadUShortFromFont();
+ }
+
+ m_prgibActionStart = new data16[m_crul + 1];
+ pchw = m_prgibActionStart;
+ for (irul = 0; irul <= m_crul; irul++, pchw++)
+ {
+ *pchw = grstrm.ReadUShortFromFont();
+ }
+
+ // FSM state table
+ m_pfsm->ReadStateTableFromFont(grstrm, fxdSilfVersion);
+
+ if (fxdSilfVersion >= 0x00020000)
+ // reserved - pad byte
+ grstrm.ReadByteFromFont();
+
+ // Constraint and action blocks
+ int cb = m_cbPassConstraint;
+ m_prgbPConstraintBlock = new byte[cb];
+ grstrm.ReadBlockFromFont(m_prgbPConstraintBlock, cb);
+ m_cbConstraints = cb;
+
+ cb = m_prgibConstraintStart[m_crul];
+ m_prgbConstraintBlock = new byte[cb];
+ grstrm.ReadBlockFromFont(m_prgbConstraintBlock, cb);
+ m_cbConstraints += cb;
+
+ cb = m_prgibActionStart[m_crul];
+ m_prgbActionBlock = new byte[cb];
+ grstrm.ReadBlockFromFont(m_prgbActionBlock, cb);
+ m_cbActions = cb;
+
+ // Rule-validity flags
+ m_prgfRuleOkay = new bool[m_crul];
+ for (irul = 0; irul < m_crul; irul++)
+ m_prgfRuleOkay[irul] = !m_fCheckRules;
+
+ // TODO SharonC/AlanW: debuggers
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Initialize a bogus pass with no rules. Currently this is used to make a single positioning
+ pass if there was none in the font.
+----------------------------------------------------------------------------------------------*/
+void GrPass::InitializeWithNoRules()
+{
+ m_crul = 0;
+ m_nMaxRuleContext = 1;
+ m_nMaxRuleLoop = 1;
+ m_nMaxBackup = 0;
+ m_pfsm = NULL;
+ m_prgchwRuleSortKeys = NULL;
+ m_prgcritRulePreModContext = NULL;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Extend the output stream by the given number of characters.
+ (Overridden by GrBidiPass.)
+
+ @param ptman - table manager
+ @param psstrmIn/Out - streams being processed
+ @param cslotNeededByNext - the number of slots being requested by the following pass
+ @param twsh - how we are handling trailing white-space
+ @param pnRet - return value
+ @param pcslotGot - return the number of slots gotten
+ @param pislotFinalBreak - return the index of the final slot, when we are removing
+ the trailing white-space and so the end of the segment
+ will be before the any actual line-break slot
+
+ @return kNextPass if we were able to generated the number requested, or processing is
+ complete; otherwise return the number of slots needed from the previous pass.
+----------------------------------------------------------------------------------------------*/
+void GrPass::ExtendOutput(GrTableManager * ptman,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ int cslotNeededByNext, TrWsHandling twsh,
+ int * pnRet, int * pcslotGot, int * pislotFinalBreak)
+{
+ // Kludge to generate an error in rendering:
+ //int z = 50;
+ //int t = ((5 * 10) / z) - 1;
+ //if (this->m_ipass == 4)
+ //{
+ // int x; x = z / t;
+ //}
+
+ int islotInitReadPos = psstrmIn->ReadPos();
+ int islotInitWritePos = psstrmOut->WritePos();
+
+ int cslotToGet = max(cslotNeededByNext,
+ m_pzpst->NeededToResync() - psstrmOut->WritePos());
+ int cslotGot = 0;
+
+ gid16 chwLB = ptman->LBGlyphID();
+
+ // While we haven't got the number of slot we've been asked for, and there is enough
+ // available in the input, run rules, filling up the output.
+
+ while ((cslotToGet > 0 && cslotGot < cslotToGet)
+ // Don't leave this pass until we've got the index offset. This is especially
+ // needed for input to the positioning pass, but it doesn't hurt to make it a
+ // general rule.
+ || !psstrmOut->GotIndexOffset()
+ // Don't leave this pass until all the slots to reprocess have been
+ // completely handled.
+ || (psstrmIn->SlotsToReprocess() > 0)
+ // Don't leave this pass until there is a complete cluster in the output
+ || (islotInitWritePos == psstrmOut->WritePos())
+ || (psstrmOut->MaxClusterSlot(islotInitWritePos, psstrmOut->WritePos()) > 0))
+ {
+ int cslotAvailable = psstrmIn->TotalSlotsPending();
+ int cslotNeedMore = MaxRuleContext() - cslotAvailable + ptman->PrevPassMaxBackup(m_ipass);
+
+ // This test should not be necessary, but just in case.
+ if (psstrmIn->PastEndOfPositioning(false))
+ cslotNeedMore = 0; // the input stream is done
+
+ if (// Not enough available in the input:
+ (cslotNeedMore > 0 && !psstrmIn->FullyWritten())
+
+ // && psstrmIn->SegLimIfKnown() == -1) && -- no, because substitution passes may need
+ // to consider slots beyond the seg limit
+
+ // Positioning passes need to know where they are in relation to the initial
+ // line-break.
+ || (IsPosPass() && !psstrmIn->GotIndexOffset())
+
+ // The following can happen on backtracking, when we undo stuff before the
+ // beginning of the segment:
+ || !ptman->Pass(m_ipass - 1)->DidResyncSkip())
+ {
+ // Ask previous pass for more input.
+ *pnRet = max(cslotNeedMore, 1);
+ *pnRet = max(*pnRet, cslotNeededByNext - cslotGot);
+ *pcslotGot = cslotGot;
+ return;
+ }
+
+ Assert(ptman->Pass(m_ipass - 1)->DidResyncSkip());
+
+ bool fDoneThisPass = (cslotAvailable == 0);
+ if (psstrmIn->SlotsToReprocess() == 0)
+ {
+ fDoneThisPass = fDoneThisPass ||
+ psstrmIn->PastEndOfPositioning(false) ||
+ psstrmOut->PastEndOfPositioning(true);
+ }
+
+ if (fDoneThisPass)
+ {
+ // No more input to process--this pass is done.
+ Assert(psstrmIn->SlotsToReprocess() == 0);
+ psstrmIn->ClearReprocBuffer();
+
+ if (twsh == ktwshNoWs && m_ipass == ptman->NumberOfLbPasses())
+ {
+ *pnRet = RemoveTrailingWhiteSpace(ptman, psstrmOut, twsh, pislotFinalBreak);
+ if (*pnRet == kBacktrack) // entire segment was white-space:
+ return; // backtrack, which will fail
+ }
+ DoResyncSkip(psstrmOut);
+ DoCleanUpSegMin(ptman, psstrmIn, islotInitReadPos, psstrmOut);
+ psstrmOut->MarkFullyWritten();
+ *pnRet = kNextPass;
+ *pcslotGot = cslotGot;
+ return;
+ }
+
+ if (twsh == ktwshOnlyWs && m_ipass == ptman->NumberOfLbPasses() + 1)
+ {
+ // Note that this is the first pass after the linebreak pass, so psstrmInput
+ // is the output of the linebreak pass.
+ GrSlotState * pslotNext = psstrmIn->Peek();
+ if (!pslotNext->IsLineBreak(chwLB) &&
+ pslotNext->Directionality() != kdircWhiteSpace &&
+ psstrmIn->SegMin() > -1 && psstrmIn->SegMin() <= psstrmIn->ReadPos())
+ {
+ // We are only allowing white-space in this segment and we hit
+ // something else. Don't process any further.
+ if (psstrmIn->SegLimIfKnown() > -1 &&
+ psstrmIn->SegLimIfKnown() <= psstrmIn->ReadPos())
+ {
+ // Already inserted a line-break; we're done.
+ DoResyncSkip(psstrmOut);
+ psstrmOut->MarkFullyWritten();
+ *pnRet = kNextPass;
+ *pcslotGot = cslotGot;
+ return;
+ }
+ while (psstrmIn->SlotsToReprocess() > 0)
+ {
+ psstrmOut->CopyOneSlotFrom(psstrmIn);
+ psstrmOut->SetPosForNextRule(0, psstrmIn, IsPosPass());
+ }
+ psstrmIn->ClearReprocBuffer();
+ *pnRet = kBacktrack;
+ return;
+ }
+ }
+
+ // Otherwise, we have enough input to run a rule.
+
+ psstrmIn->SetRuleStartReadPos();
+ psstrmOut->SetRuleStartWritePos();
+
+ int ruln = -1;
+ if (m_pfsm)
+ ruln = m_pfsm->GetRuleToApply(ptman, this, psstrmIn, psstrmOut);
+ ruln = CheckRuleValidity(ruln);
+ RunRule(ptman, ruln, psstrmIn, psstrmOut);
+
+ cslotGot = psstrmOut->WritePos() - islotInitWritePos;
+ psstrmOut->CalcIndexOffset(ptman);
+ }
+
+ DoResyncSkip(psstrmOut);
+ DoCleanUpSegMin(ptman, psstrmIn, islotInitReadPos, psstrmOut);
+
+ // We're past the point where we care about anything in the reprocessing buffer.
+ Assert(psstrmIn->NoReproc());
+ psstrmIn->ClearReprocBuffer();
+
+ if (psstrmOut->PastEndOfPositioning(true))
+ psstrmOut->MarkFullyWritten();
+
+ *pnRet = kNextPass;
+ *pcslotGot = cslotGot;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Extend the output stream by the given number of characters.
+ For a GrBidiPass, if we are at a direction change, get the entire
+ range of upstream glyphs, reverse them, and treat them as one chunk.
+ Otherwise just pass one slot through.
+
+ @param ptman - table manager
+ @param psstrmInput/Output - streams being processed
+ @param cslotNeededByNext - the number of slots being requested by the following pass
+ @param twsh - how we are handling trailing white-space
+ @param pnRet - return value
+ @param pcslotGot - return the number of slots gotten
+ @param pislotFinalBreak - not used in this version
+
+ @return 1 if we need more glyphs from the previous pass
+----------------------------------------------------------------------------------------------*/
+void GrBidiPass::ExtendOutput(GrTableManager * ptman,
+ GrSlotStream* psstrmIn, GrSlotStream* psstrmOut,
+ int cslotNeededByNext, TrWsHandling twsh,
+ int * pnRet, int * pcslotGot, int * pislotFinalBreak)
+{
+ Assert(psstrmIn->SlotsToReprocess() == 0);
+
+ int islotInitReadPos = psstrmIn->ReadPos();
+ int islotInitWritePos = psstrmOut->WritePos();
+
+ Assert(m_pzpst->NeededToResync() == 0);
+
+ int cslotToGet = max(cslotNeededByNext,
+ m_pzpst->NeededToResync() - psstrmOut->WritePos());
+ int cslotGot = 0;
+ int nTopDir;
+ if (twsh == ktwshOnlyWs)
+ nTopDir = (ptman->State()->ParaRightToLeft()) ? 1 : 0;
+ else
+ nTopDir = ptman->TopDirectionLevel();
+
+ while (cslotToGet > 0 && cslotGot < cslotToGet)
+ {
+ int islotChunkO = psstrmOut->WritePos();
+ int islotChunkI = psstrmIn->ReadPos();
+
+ // Need at least one character to test.
+ if (psstrmIn->SlotsPending() < 1 || !ptman->Pass(m_ipass-1)->DidResyncSkip())
+ {
+ if (!psstrmIn->FullyWritten())
+ {
+ // Ask previous pass for more input.
+ *pnRet = max(cslotToGet - psstrmIn->SlotsPending(), 1);
+ *pnRet = max(*pnRet, cslotNeededByNext - cslotGot);
+ *pcslotGot = cslotGot;
+ return;
+ }
+ else
+ {
+ Assert(ptman->Pass(m_ipass-1)->DidResyncSkip());
+ Assert(psstrmIn->SlotsToReprocess() == 0);
+ psstrmIn->ClearReprocBuffer();
+ DoResyncSkip(psstrmOut);
+ DoCleanUpSegMin(ptman, psstrmIn, islotInitReadPos, psstrmOut);
+ psstrmOut->MarkFullyWritten();
+ *pnRet = kNextPass;
+ *pcslotGot = cslotGot;
+ return;
+ }
+ }
+
+ std::vector<int> vislotStarts;
+ std::vector<int> vislotStops;
+ int islotReverseLim = psstrmIn->DirLevelRange(ptman->State(),
+ psstrmIn->ReadPos(), nTopDir,
+ vislotStarts, vislotStops);
+ //int islotReverseLim = psstrmIn->OldDirLevelRange(pengst, psstrmIn->ReadPos(), nTopDir);
+ if (islotReverseLim == -1)
+ {
+ // We haven't got the full range of reversed text yet--
+ // ask for more input.
+ *pnRet = max(1, cslotNeededByNext - cslotGot);
+ *pcslotGot = cslotGot;
+ return;
+ }
+
+ // Okay, we have enough input to do the reversal, if any.
+
+ int cslotToReverse = islotReverseLim - psstrmIn->ReadPos();
+
+ // Never reverse the final linebreak; leave it at the end.
+ if (cslotToReverse > 0 && islotReverseLim > 0)
+ {
+ GrSlotState * pslotLast = psstrmIn->SlotAt(islotReverseLim - 1);
+ if (pslotLast->IsFinalLineBreak(ptman->LBGlyphID()))
+ {
+ for (size_t i = 0; i < vislotStops.size(); i++)
+ if (vislotStops.back() == islotReverseLim - 1)
+ vislotStops.back() = islotReverseLim - 2;
+ islotReverseLim--;
+ cslotToReverse--;
+ }
+ }
+
+ psstrmIn->SetRuleStartReadPos();
+ psstrmOut->SetRuleStartWritePos();
+
+ if (cslotToReverse == 0)
+ {
+ psstrmOut->CopyOneSlotFrom(psstrmIn);
+ }
+ else
+ {
+ int islotNextWritePos = psstrmOut->WritePos() + cslotToReverse;
+ int islotNextReadPos = psstrmIn->ReadPos() + cslotToReverse;
+ if (vislotStarts.size() == 0)
+ {
+ Assert(false); // this should have been done by DirLevelRange
+ vislotStarts.push_back(psstrmIn->ReadPos());
+ vislotStops.push_back(islotNextReadPos - 1);
+ }
+ Assert(vislotStarts.back() == psstrmIn->ReadPos());
+ Assert(vislotStops.back() == islotNextReadPos - 1);
+ int cslotNotCopied = Reverse(ptman, psstrmIn, psstrmOut, vislotStarts, vislotStops);
+ //Reverse(nTopDir + 1,
+ // psstrmIn, psstrmIn->ReadPos(), islotReverseLim,
+ // psstrmOut, psstrmOut->WritePos() + cslotToReverse - 1, psstrmOut->WritePos()-1);
+
+ islotNextWritePos -= cslotNotCopied; // bidi markers that are not passed through
+
+ psstrmIn->SetReadPos(islotNextReadPos);
+ psstrmOut->SetWritePos(islotNextWritePos);
+
+ // It's quite strange to have the segment start or end in the middle of stuff to
+ // reverse (because the LB forms a natural terminator), but at any rate,
+ // if that happens, record the segment lim at the corresponding place in the
+ // output stream.
+ int islotSegMinIn = psstrmIn->SegMin();
+ if (islotSegMinIn > -1 &&
+ psstrmIn->ReadPos() - cslotToReverse <= islotSegMinIn &&
+ islotSegMinIn < psstrmIn->ReadPos())
+ {
+ Assert(islotSegMinIn == psstrmIn->ReadPos() - cslotToReverse); // normal situation
+ psstrmOut->SetSegMin(
+ psstrmOut->WritePos() - (psstrmIn->ReadPos() - islotSegMinIn));
+ }
+ int islotSegLimIn = psstrmIn->SegLimIfKnown();
+ if (islotSegLimIn > -1 &&
+ psstrmIn->ReadPos() - cslotToReverse <= islotSegLimIn &&
+ islotSegLimIn < psstrmIn->ReadPos())
+ {
+ Assert(islotSegLimIn == psstrmIn->ReadPos() - cslotToReverse); // normal situation
+ psstrmOut->SetSegLim(
+ psstrmOut->WritePos() - (psstrmIn->ReadPos() - islotSegLimIn));
+ }
+ }
+
+ psstrmOut->SetPosForNextRule(0, psstrmIn, false);
+
+ // Record the chunk mappings:
+ MapChunks(psstrmIn, psstrmOut, islotChunkI, islotChunkO, 0);
+
+ cslotGot = psstrmOut->WritePos() - islotInitWritePos;
+ psstrmOut->CalcIndexOffset(ptman);
+ }
+
+ DoResyncSkip(psstrmOut);
+ DoCleanUpSegMin(ptman, psstrmIn, islotInitReadPos, psstrmOut);
+
+ // We're past the point where we care about anything in the reprocessing buffer.
+ Assert(psstrmIn->NoReproc());
+ psstrmIn->ClearReprocBuffer();
+
+ Assert(psstrmIn->SlotsToReprocess() == 0);
+
+ if (psstrmOut->PastEndOfPositioning(true))
+ psstrmOut->MarkFullyWritten();
+
+ *pnRet = kNextPass;
+ *pcslotGot = cslotGot;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Generate slots containing glyph IDs for the underlying character data,
+ incrementing the input pointer as we go.
+
+ @param ptman - table manager
+ @param pchstrm - input character stream
+ @param psstrmOutput - output slot stream
+ @param ichSegLim - known end of segment, index into the text; or -1;
+ the lim of the of char-stream itself represents
+ the end of the text-source; this lim is the
+ known desired end of the segment
+ @param cchwPostXlbContext - number of characters that may be needed from the following line;
+ valid when ichSegLim > -1
+ @param lb - breakweight to use for inserted LB
+ @param cslotToGet - the number of slots being requested by the following pass
+ @param fNeedFinalBreak - true if the end of the segment needs to be a valid break point
+ @param pislotFinalBreak - the end of this segment
+----------------------------------------------------------------------------------------------*/
+int GrPass::ExtendGlyphIDOutput(GrTableManager * ptman,
+ GrCharStream * pchstrm, GrSlotStream * psstrmOut, int ichSegLim, int cchwPostXlbContext,
+ LineBrk lb, int cslotToGet, bool fNeedFinalBreak, TrWsHandling twsh,
+ int * pislotFinalBreak)
+{
+ EngineState * pengst = ptman->State();
+
+ // This pass should be the glyph-generation pass.
+ Assert(dynamic_cast<GrGlyphGenPass*>(this));
+ Assert(m_pzpst->m_cslotSkipToResync == 0);
+ m_pzpst->m_fDidResyncSkip = true;
+
+ for (int islot = 0; islot < cslotToGet; ++islot)
+ {
+ int islotChunkO = psstrmOut->WritePos();
+ int islotChunkI = pchstrm->SegOffset();
+
+ if (pchstrm->AtEnd()
+ || (ichSegLim > -1 && pchstrm->Pos() == ichSegLim))
+ {
+ if (psstrmOut->SegLimIfKnown() > -1 &&
+ psstrmOut->SegLimIfKnown() <= psstrmOut->WritePos())
+ {
+ // Already found the end of this stream.
+ }
+ else
+ {
+ if (pchstrm->EndLine() && !fNeedFinalBreak)
+ // (if we need a good final break, don't just append an LB;
+ // make it backtrack and find a valid break point)
+ {
+ // Only need to get a good break when we're backtracking; otherwise we
+ // already know it.
+ Assert(ichSegLim == -1 || !fNeedFinalBreak);
+ // Notice that we're cheating here: we're putting the LB in the zeroth
+ // stream instead of in the output of the linebreak table.
+ psstrmOut->AppendLineBreak(ptman, pchstrm,
+ (pchstrm->AtEnd() ? klbWordBreak : lb),
+ ((ptman->RightToLeft()) ? kdircRlb : kdircLlb), -1, false,
+ pchstrm->SegOffset());
+ if (pchstrm->AtEnd())
+ pengst->SetFinalLB();
+ else
+ pengst->SetInsertedLB(true);
+ }
+ else
+ {
+ // Don't actually insert a line-break glyph.
+ psstrmOut->SetSegLimToWritePos();
+ }
+ *pislotFinalBreak = psstrmOut->WritePos() - 1;
+ if (ptman->NumberOfLbPasses() > 0 && pengst->HasInitialLB())
+ {
+ // Because we cheated above: the output stream of the linekbreak table
+ // has an initial LB, which this stream doesn't have. Adjust the position
+ // of the final break to match what it will be in the output of the
+ // lb table.
+ *pislotFinalBreak += 1;
+ }
+ }
+
+ if (twsh == ktwshNoWs && m_ipass == ptman->NumberOfLbPasses())
+ {
+ int nRet = RemoveTrailingWhiteSpace(ptman, psstrmOut, twsh, pislotFinalBreak);
+ if (nRet == kBacktrack) // entire segment was white-space:
+ return kBacktrack; // backtrack, which will fail
+ }
+ if (pchstrm->AtEnd())
+ {
+ psstrmOut->MarkFullyWritten();
+ return kNextPass;
+ }
+ // otherwise we may need a few more characters for line-boundary contextualization.
+ }
+
+ int ichwSegOffset; // offset from the official start of the segment
+ int cchw; // number of 16-bit chars consumed
+ GrFeatureValues fval;
+ int nUnicode = pchstrm->NextGet(ptman, &fval, &ichwSegOffset, &cchw);
+ gid16 chwGlyphID = ptman->GetGlyphIDFromUnicode(nUnicode);
+
+ if (nUnicode == knCR || nUnicode == knLF || nUnicode == knLineSep || nUnicode == knParaSep ||
+ nUnicode == knORC)
+ {
+ // Hard line-break: we're done.
+ // Note that we don't include the hard-break character in this segment.
+ pchstrm->HitHardBreak();
+ pengst->SetHitHardBreak();
+ psstrmOut->MarkFullyWritten();
+ return kNextPass;
+ }
+
+ GrSlotState * pslotNew;
+ ptman->State()->NewSlot(chwGlyphID, fval, 0, ichwSegOffset, nUnicode, &pslotNew);
+
+ psstrmOut->NextPut(pslotNew);
+ psstrmOut->MapInputChunk(islotChunkI, islotChunkO, pchstrm->SegOffset(), false, false);
+ // Mapping the output chunks of the char stream has already been handled by the
+ // char stream.
+
+ }
+
+ psstrmOut->CalcIndexOffset(ptman);
+
+ if (psstrmOut->PastEndOfPositioning(true)
+ || (ichSegLim > -1 && pchstrm->Pos() > ichSegLim + cchwPostXlbContext))
+ {
+ // We have enough for this segment.
+ psstrmOut->MarkFullyWritten();
+ }
+
+ return kNextPass;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Extend the output stream until it is using up the allotted amount of
+ physical space. Return kNextPass when all data has been processed successfully.
+ Return kBacktrack when space overflows, indicating that we need to backtrack
+ and find a break point. Otherwise, return the number of slots we
+ need from the previous pass.
+
+ @param fWidthIsCharCount - kludge for test procedures
+ @param fInfiniteWidth - don't test for more space
+ @param fMustBacktrack - true if we need a good final break and haven't found one yet
+ @param lbMax - max allowed for the final slot
+ @param twsh - how we are handling trailing white-space
+----------------------------------------------------------------------------------------------*/
+int GrPass::ExtendFinalOutput(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput,
+ float xsSpaceAllotted, bool fWidthIsCharCount, bool fInfiniteWidth,
+ bool fHaveLineBreak, bool fMustBacktrack, LineBrk lbMax, TrWsHandling twsh,
+ int * pislotLB, float * pxsWidth)
+{
+ EngineState * pengst = ptman->State();
+
+ // This pass should be the final positioning pass.
+ Assert(dynamic_cast<GrPosPass*>(this));
+
+ // It would be very strange to be positioning based on something that happened in
+ // previous line. -- not true any more, since this will include the max-precontext-length.
+// Assert(m_cslotSkipToResync == 0);
+
+ int islotOutputLB = -1;
+ //int islotInitWritePos = psstrmOutput->WritePos();
+ int islotNoLbUpTo = psstrmOutput->WritePos();;
+
+ while (true)
+ {
+ // Do this right up front, so we are only measuring actual output.
+ if (m_pzpst->CanResyncSkip(psstrmOutput))
+ m_pzpst->DoResyncSkip(psstrmOutput);
+
+ bool fMoreSpace;
+ if (!m_pzpst->DidResyncSkip())
+ fMoreSpace = true;
+ else if (fInfiniteWidth)
+ fMoreSpace = true;
+ else
+ fMoreSpace = psstrmOutput->MoreSpace(ptman,
+ xsSpaceAllotted, fWidthIsCharCount,
+ true, // always ignore trailing white space when we are first making the segment
+ twsh,
+ pxsWidth);
+ if (!fMoreSpace)
+ {
+ // Overflowed available space; backtrack and find a line break.
+ while (psstrmInput->SlotsToReprocess() > 0)
+ {
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+ psstrmOutput->SetPosForNextRule(0, psstrmInput, IsPosPass());
+ }
+ psstrmInput->ClearReprocBuffer();
+
+ *pislotLB = -1;
+ pengst->SetExceededSpace();
+ pengst->SetHitHardBreak(false);
+ return kBacktrack;
+ }
+
+ if (islotOutputLB != -1 && psstrmInput->SlotsToReprocess() == 0)
+ {
+ // Hit the inserted line break--we're done.
+ psstrmInput->ClearReprocBuffer();
+ *pislotLB = islotOutputLB;
+ return kNextPass;
+ }
+
+ int nslotAvailable = psstrmInput->SlotsPending();
+ if ((nslotAvailable - ptman->PrevPassMaxBackup(m_ipass)
+ < MaxRuleContext() && !psstrmInput->FullyWritten())
+ || !ptman->Pass(m_ipass-1)->DidResyncSkip())
+ {
+ // Not enough available in the input--ask previous pass for more input.
+ // Ten is an arbitrary value--we ask for more that we really need to cut down
+ // on the number of times we loop between passes.
+ return max(MaxRuleContext() - (nslotAvailable - 10), 1);
+ }
+
+ Assert(ptman->Pass(m_ipass - 1)->DidResyncSkip());
+
+ if (nslotAvailable == 0)
+ {
+ // No more input to process. If we have a valid line-break, or we don't care,
+ // we're done. Otherwise backtrack to find a valid break point.
+ Assert(psstrmInput->SlotsToReprocess() == 0);
+ psstrmInput->ClearReprocBuffer();
+ if (fMustBacktrack)
+ {
+ *pislotLB = -1;
+ return kBacktrack;
+ }
+ else
+ {
+ psstrmOutput->MarkFullyWritten();
+ return kNextPass;
+ }
+ }
+
+ // Otherwise, we have enough input to run a rule.
+
+ psstrmInput->SetRuleStartReadPos();
+ psstrmOutput->SetRuleStartWritePos();
+
+ int ruln = -1;
+ if (m_pfsm)
+ ruln = m_pfsm->GetRuleToApply(ptman, this, psstrmInput, psstrmOutput);
+ ruln = CheckRuleValidity(ruln);
+ RunRule(ptman, ruln, psstrmInput, psstrmOutput);
+
+ if (fHaveLineBreak)
+ {
+ islotOutputLB =
+ psstrmOutput->FindFinalLineBreak(ptman->LBGlyphID(),
+ islotNoLbUpTo, psstrmOutput->WritePos());
+ islotNoLbUpTo = psstrmOutput->WritePos();
+ }
+
+ psstrmOutput->CalcIndexOffset(ptman);
+ }
+
+ Assert(false);
+
+ psstrmInput->ClearReprocBuffer();
+ *pislotLB = -1;
+ return kNextPass;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Remove undesirable trailing white-space.
+----------------------------------------------------------------------------------------------*/
+int GrPass::RemoveTrailingWhiteSpace(GrTableManager * ptman, GrSlotStream * psstrmOut,
+ TrWsHandling twsh, int * pislotFinalBreak)
+{
+ EngineState * pengst = ptman->State();
+
+ Assert(twsh == ktwshNoWs);
+ Assert(m_ipass == ptman->NumberOfLbPasses()); // output of (final) lb pass
+
+ int islotTmp = psstrmOut->FinalSegLim();
+ if (islotTmp <= 0)
+ return kNextPass;
+
+ GrSlotState * pslotLast = psstrmOut->SlotAt(islotTmp-1);
+ if (islotTmp > 0 && pslotLast->IsFinalLineBreak(ptman->LBGlyphID()))
+ {
+ islotTmp--;
+ pslotLast = (islotTmp > 0) ? psstrmOut->SlotAt(islotTmp-1) : NULL;
+ }
+ bool fRemovedWs = false;
+ while (islotTmp > 0 && pslotLast->Directionality() == kdircWhiteSpace)
+ {
+ islotTmp--;
+ pslotLast = (islotTmp > 0) ? psstrmOut->SlotAt(islotTmp-1) : NULL;
+ fRemovedWs = true;
+ }
+ if (fRemovedWs)
+ {
+ if (islotTmp <= 0)
+ {
+ // Entire segment was white-space: backtrack, which will fail.
+ return kBacktrack;
+ }
+ psstrmOut->SetSegLim(islotTmp);
+ *pislotFinalBreak = islotTmp - 1;
+ pengst->SetFinalLB(false);
+ pengst->SetRemovedTrWhiteSpace();
+ ptman->UnwindAndReinit(islotTmp - 1);
+ }
+
+ return kNextPass;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Keep track of whether we're advancing through the input satisfactorily;
+ if not, forcibly advance. This is a safety net to avoid infinite loops; it
+ should never be necessary if they've set up their tables right.
+----------------------------------------------------------------------------------------------*/
+void GrPass::CheckInputProgress(GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput,
+ int islotOrigInput)
+{
+ int islotInput = psstrmInput->ReadPosForNextGet();
+// Assert(islotInput >= islotOrigInput); -- no longer true now that we can back up
+
+ if (islotInput <= psstrmInput->ReadPosMax())
+ {
+ // Didn't advance.
+ if (m_pzpst->m_nRulesSinceAdvance >= m_nMaxRuleLoop)
+ {
+ bool fAdvanced = false;
+ // Forcibly advance. First try to advance to where we backed up from.
+ while (!psstrmInput->AtEnd() &&
+ psstrmInput->ReadPosForNextGet() < psstrmInput->ReadPosMax())
+ {
+ RecordHitMaxRuleLoop(psstrmInput->ReadPosForNextGet());
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+ fAdvanced = true;
+ }
+ // If that didn't do anything productive, just advance one slot.
+ if (!fAdvanced && !psstrmInput->AtEndOfContext())
+ {
+ RecordHitMaxRuleLoop(psstrmInput->ReadPosForNextGet());
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+ }
+
+ m_pzpst->m_nRulesSinceAdvance = 0;
+ }
+ else m_pzpst->m_nRulesSinceAdvance++;
+ }
+ else m_pzpst->m_nRulesSinceAdvance = 0;
+
+ psstrmInput->SetReadPosMax(islotInput);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Record the chunks in the streams' chunk maps.
+
+ psstrmIn/Out - streams being processed
+ islotChunkIn/Out - start of chunks
+ cslotReprocessed - number of slots to reprocess before the rule was run
+----------------------------------------------------------------------------------------------*/
+void GrPass::MapChunks(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ int islotChunkIn, int islotChunkOut, int cslotReprocessed)
+{
+ if (islotChunkOut > psstrmOut->WritePos())
+ {
+ // backing up
+ int islotReadPosTmp = psstrmIn->ReadPosForNextGet();
+/// Assert((islotChunkIn - islotReadPosTmp) == (islotChunkOut - psstrmOut->WritePos()));
+// psstrmIn->MapOutputChunk(psstrmOut->WritePos() - 1, islotReadPosTmp - 1,
+// islotChunkOut, true, 0, true);
+// psstrmOut->MapInputChunk(islotReadPosTmp - 1, psstrmOut->WritePos() - 1,
+// islotChunkIn, true, true);
+
+ // Resync.
+ if (psstrmOut->WritePos() == 0)
+ {
+ // Clear all the chunks.
+ psstrmIn->MapOutputChunk(-1, -1, 0, true, 0, true);
+ psstrmOut->MapInputChunk(-1, -1, islotReadPosTmp, true, true);
+ psstrmIn->AssertChunkMapsValid(psstrmOut);
+ return;
+ }
+ else if (islotReadPosTmp == 0)
+ {
+ // Clear all the chunks.
+ psstrmIn->MapOutputChunk(-1, -1, psstrmOut->WritePos(), true, 0, true);
+ psstrmOut->MapInputChunk(-1, -1, 0, true, true);
+ psstrmIn->AssertChunkMapsValid(psstrmOut);
+ return;
+ }
+ // Find the beginning of the current chunk.
+ int islotChunkOutAdj = min(islotChunkOut, psstrmOut->WritePos() - 1);
+ int islotChunkInAdj = psstrmOut->ChunkInPrev(islotChunkOutAdj);
+ while (islotChunkInAdj == -1 && islotChunkOutAdj > 0)
+ islotChunkInAdj = psstrmOut->ChunkInPrev(--islotChunkOutAdj);
+
+ if (islotChunkInAdj == -1)
+ {
+ // Couldn't find the beginning of any chunk; zap them all.
+ psstrmIn->MapOutputChunk(-1, -1, psstrmOut->WritePos(), true, 0, true);
+ psstrmOut->MapInputChunk(-1, -1, psstrmOut->ReadPos(), true, true);
+ psstrmIn->AssertChunkMapsValid(psstrmOut);
+ return;
+ }
+
+ if (psstrmIn->ChunkInNext(islotChunkInAdj) != islotChunkOutAdj)
+ {
+ islotChunkOutAdj = psstrmIn->ChunkInNext(islotChunkInAdj);
+ while (islotChunkOutAdj == -1 && islotChunkInAdj > 0)
+ islotChunkOutAdj = psstrmIn->ChunkInNext(--islotChunkInAdj);
+ }
+
+ psstrmIn->MapOutputChunk(islotChunkOutAdj, islotChunkInAdj,
+ psstrmOut->WritePos(), false, 0, true);
+ psstrmOut->MapInputChunk(islotChunkInAdj, islotChunkOutAdj,
+ psstrmIn->ReadPos(), false, true);
+ }
+ else if (islotChunkOut == psstrmOut->WritePos())
+ // no output generated--continue the previous chunk
+ ;
+ else if (islotChunkIn == psstrmIn->ReadPos())
+ // no input consumed
+ ;
+ else
+ {
+ psstrmIn->MapOutputChunk(islotChunkOut, islotChunkIn, psstrmOut->WritePos(),
+ (cslotReprocessed > 0), cslotReprocessed, false);
+ psstrmOut->MapInputChunk(islotChunkIn, islotChunkOut, psstrmIn->ReadPos(),
+ (cslotReprocessed > 0), false);
+ }
+
+ psstrmIn->AssertChunkMapsValid(psstrmOut);
+
+ m_pzpst->m_nMaxChunk = max(m_pzpst->m_nMaxChunk, psstrmIn->LastNextChunkLength());
+}
+
+/*----------------------------------------------------------------------------------------------
+ This method is something of a kludge. During the course of running the rules we try to
+ keep track of the seg-min location, but sometimes that gets confused due to insertions
+ and deletions at the segment boundaries.
+----------------------------------------------------------------------------------------------*/
+void GrSubPass::DoCleanUpSegMin(GrTableManager * ptman,
+ GrSlotStream * psstrmIn, int islotInitReadPos, GrSlotStream * psstrmOut)
+{
+ int islotSegMinIn = psstrmIn->SegMin();
+ if (islotSegMinIn == -1)
+ return; // input doesn't even know it
+ if (islotInitReadPos > islotSegMinIn)
+ return; // should already have figured it out
+
+ // Otherwise this batch of processing likely set the seg-min on the output stream,
+ // so check it out.
+
+ // First, if the seg-min of the input stream is zero, it should be zero on the output.
+ if (islotSegMinIn == 0)
+ {
+ psstrmOut->SetSegMin(0, true);
+ return;
+ }
+
+ // If there is an initial line-break, the seg-min should be just before it.
+ int islot;
+ if (ptman->State()->HasInitialLB())
+ {
+ gid16 chwLB = ptman->LBGlyphID();
+
+ // Unfortunately, the seg-min from the previous segment can get off, too. :-(
+ // Fix it, while we're at it.
+ if (!psstrmIn->SlotAt(islotSegMinIn)->IsInitialLineBreak(chwLB))
+ {
+ for (islot = 0; islot < psstrmIn->ReadPos(); islot++)
+ if (psstrmIn->SlotAt(islot)->IsInitialLineBreak(chwLB))
+ {
+ psstrmIn->SetSegMin(islot, true);
+ break;
+ }
+ }
+ if (psstrmOut->SegMin() > -1
+ && psstrmOut->SlotAt(psstrmOut->SegMin())->IsInitialLineBreak(chwLB))
+ {
+ return; // already okay
+ }
+ for (islot = 0; islot < psstrmOut->WritePos(); islot++)
+ if (psstrmOut->SlotAt(islot)->IsInitialLineBreak(chwLB))
+ {
+ psstrmOut->SetSegMin(islot, true);
+ return;
+ }
+ Assert(false); // couldn't find it
+ }
+
+ // Otherwise, figure it out using the associations. First observe that the seg-min
+ // will be in the corresponding chunk to the seg-min of the previous pass.
+ int islotChunkMinIn = psstrmIn->ChunkInNextMin(islotSegMinIn);
+ int islotChunkLimIn = psstrmIn->ChunkInNextLim(islotSegMinIn);
+ if (islotChunkMinIn == -1) islotChunkMinIn = 0;
+ if (islotChunkLimIn == -1) islotChunkLimIn = 1;
+
+ int islotChunkMinOut = psstrmIn->ChunkInNext(islotChunkMinIn);
+ int islotChunkLimOut = psstrmIn->ChunkInNext(islotChunkLimIn);
+ if (islotChunkMinOut == -1) islotChunkMinOut = 0;
+ if (islotChunkLimOut == -1) islotChunkLimOut = 1;
+
+ int islotSegMinOut = psstrmOut->SegMin();
+ if (islotSegMinOut == -1)
+ {
+ // No reasonable guess; try to figure it out.
+ for (islot = islotChunkMinOut; islot < islotChunkLimOut; islot++)
+ {
+// GrSlotState * pslotOut = psstrmOut->SlotAt(islot);
+ if (psstrmOut->SlotAt(islot)->BeforeAssoc() == 0)
+ {
+ islotSegMinOut = islot;
+ break;
+ }
+ }
+ if (islotSegMinOut == -1)
+ {
+ // Ick, couldn't figure it out. Let's hope we set it to something reasonable earlier.
+ Assert(psstrmOut->SegMin() > -1);
+ return;
+ }
+ }
+ // else we have a reasonable guess
+
+ // islotSegMinOut is the best or at leastfirst slot in the chunk that maps into the segment.
+ // But if there is an adjacent slot inserted before it and it is in the chunk,
+ // we want to include that also.
+ while (islotSegMinOut > islotChunkMinOut
+ && psstrmOut->SlotAt(islotSegMinOut-1)->BeforeAssoc() >= 0)
+ {
+ islotSegMinOut--;
+ }
+ psstrmOut->SetSegMin(islotSegMinOut, true);
+}
+
+/*----------------------------------------------------------------------------------------------
+ If we are in a state where we are supposed to skip some of the initial output,
+ do so. The purpose of this is to resync when restarting for a segment other than the
+ first. Caller should ensure that there are enough slots to skip.
+----------------------------------------------------------------------------------------------*/
+int PassState::DoResyncSkip(GrSlotStream * psstrmOutput)
+{
+ if (m_fDidResyncSkip)
+ return 0;
+
+ if (m_cslotSkipToResync == 0)
+ {
+ m_fDidResyncSkip = true;
+ return 0;
+ }
+
+ if (!CanResyncSkip(psstrmOutput))
+ {
+ Assert(false); // caller makes sure this doesn't happen
+ return (m_cslotSkipToResync - psstrmOutput->WritePos());
+ }
+
+ psstrmOutput->ResyncSkip(m_cslotSkipToResync);
+ m_fDidResyncSkip = true;
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Run a constraint for a single rule.
+
+ @param ruln - rule to test
+ @param psstrmIn - input stream
+ @param psstrmOut - for accessing items in the pre-context
+ @param cslotPreModContext - the number of items that need to be tested prior to the
+ current stream position
+ @param cslotMatched - the number of items matched after the current stream position
+----------------------------------------------------------------------------------------------*/
+bool GrPass::RunConstraint(GrTableManager * ptman, int ruln,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ int cslotPreModContext, int cslotMatched)
+{
+ int nRet = 0;
+
+ if (m_prgibConstraintStart == NULL)
+ return true;
+
+ int biStart = int(m_prgibConstraintStart[ruln]);
+ if (biStart == 0)
+ return true; // no constraints
+
+ for (int islot = -cslotPreModContext; islot < cslotMatched; islot++)
+ {
+ nRet = RunCommandCode(ptman, m_prgbConstraintBlock + biStart, true,
+ psstrmIn, psstrmOut, islot);
+
+ if (nRet == 0) // one slot failed
+ return false;
+ }
+
+ return (nRet != 0);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Check that we can interpret all the commands in the rule. If not, return -1 indicating
+ that we don't want to run a rule after all. This can happen when the version of the compiler
+ that generated the font is later than this engine.
+----------------------------------------------------------------------------------------------*/
+int GrPass::CheckRuleValidity(int ruln)
+{
+ if (ruln == -1)
+ return -1;
+
+ if (m_prgfRuleOkay[ruln])
+ return ruln;
+
+ int biStart = m_prgibActionStart[ruln];
+ byte * pbNext = m_prgbActionBlock + biStart;
+
+ // General purpose variables:
+// int arg1, arg2, arg3, arg4;
+ int nSlotRef;
+ int nInputClass;
+ int nOutputClass;
+ int c;
+ int islotArg;
+ int nIndex;
+ int nGlyphAttr;
+ int nAttLevel;
+ int nFeat;
+ int nPState;
+// SlotAttrName slat;
+
+ int i;
+
+// int nRet = 0;
+
+ while (true) // exit by encountering PopRet or RetTrue or RetZero
+ {
+ ActionCommand op = ActionCommand(*pbNext++);
+
+ switch (op)
+ {
+ case kopNop:
+ break;
+
+ case kopPushByte:
+ pbNext++;
+ break;
+ case kopPushByteU:
+ pbNext++;
+ break;
+ case kopPushShort:
+ pbNext++;
+ pbNext++;
+ break;
+ case kopPushShortU:
+ pbNext++;
+ pbNext++;
+ break;
+ case kopPushLong:
+ pbNext++;
+ pbNext++;
+ pbNext++;
+ pbNext++;
+ break;
+
+ case kopNeg:
+ case kopTrunc8: case kopTrunc16:
+ case kopNot:
+ break;
+
+ case kopAdd: case kopSub:
+ case kopMul: case kopDiv:
+ case kopMin: case kopMax:
+ case kopAnd: case kopOr:
+ case kopEqual: case kopNotEq:
+ case kopLess: case kopGtr:
+ case kopLessEq: case kopGtrEq:
+ break;
+
+ case kopCond:
+ break;
+
+ case kopNext:
+ break;
+ case kopNextN:
+ c = *pbNext; pbNext++; // count
+ break;
+ case kopPutGlyph8bitObs:
+ nOutputClass = *pbNext++;
+ break;
+ case kopPutGlyph:
+ pbNext += 2;
+ break;
+ case kopPutCopy:
+ nSlotRef = *pbNext++;
+ break;
+ case kopPutSubs8bitObs:
+ nSlotRef = *pbNext++;
+ nInputClass = *pbNext++;
+ nOutputClass = *pbNext++;
+ break;
+ case kopPutSubs:
+ nSlotRef = *pbNext++;
+ pbNext += 4; // 2 bytes each for classes
+ break;
+ case kopCopyNext:
+ break;
+ case kopInsert:
+ break;
+ case kopDelete:
+ break;
+ case kopAssoc:
+ c = *pbNext; pbNext++;
+ for (i = 0; i < c; i++)
+ pbNext++;
+ break;
+ case kopCntxtItem:
+ islotArg = *pbNext++;
+ c = *pbNext++;
+ break;
+
+ case kopAttrSet:
+ case kopAttrAdd:
+ case kopAttrSub:
+ case kopAttrSetSlot:
+ pbNext++; // slot attribute ID
+ break;
+ case kopIAttrSet:
+ case kopIAttrAdd:
+ case kopIAttrSub:
+ case kopIAttrSetSlot:
+ pbNext++; // slot attribute ID
+ nIndex = *pbNext++; // index; eg, global ID for component
+ break;
+
+ case kopPushSlotAttr:
+ pbNext++;
+ nSlotRef = *pbNext++;
+ break;
+ case kopPushISlotAttr:
+ pbNext++;
+ nSlotRef = *pbNext++;
+ nIndex = *pbNext++;
+ break;
+
+ case kopPushGlyphAttrObs:
+ case kopPushAttToGAttrObs:
+ nGlyphAttr = *pbNext++;
+ nSlotRef = *pbNext++;
+ break;
+ case kopPushGlyphAttr:
+ case kopPushAttToGlyphAttr:
+ *pbNext += 3;
+ break;
+ case kopPushGlyphMetric:
+ case kopPushAttToGlyphMetric:
+ nGlyphAttr = *pbNext++;
+ nSlotRef = *pbNext++;
+ nAttLevel = *pbNext++;
+ break;
+ case kopPushFeat:
+ nFeat = *pbNext++;
+ nSlotRef = *pbNext++;
+ break;
+
+ case kopPushProcState:
+ nPState = *pbNext++;
+ break;
+ case kopPushVersion:
+ break;
+
+ case kopPopRet:
+ case kopRetZero:
+ case kopRetTrue:
+ m_prgfRuleOkay[ruln] = true;
+ return ruln;
+
+ default:
+ // Uninterpretable command:
+ return -1;
+ }
+ }
+
+ return ruln; // to keep compiler from griping
+}
+
+/*----------------------------------------------------------------------------------------------
+ Runs the rule, if any, otherwise just passes one character through.
+ The rule does nothing but set the line-break weights for the slots.
+
+ @param ptman - the table manager that allocates slots
+ @param ruln - number of rule to run; -1 if none applies
+ @param psstrmIn/Out - input/output stream
+----------------------------------------------------------------------------------------------*/
+void GrLineBreakPass::RunRule(GrTableManager * ptman, int ruln,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ // Remember the beginnings of the new chunk:
+ int islotIn = psstrmIn->ReadPos();
+ int islotOut = psstrmOut->WritePos();
+ int cslotReprocessed = psstrmIn->SlotsToReprocess();
+
+ if (ruln == -1)
+ {
+#ifdef OLD_TEST_STUFF
+ if (RunTestRules(ptman, ruln, psstrmIn, psstrmOut))
+#else
+ if (false)
+#endif // OLD_TEST_STUFF
+ {}
+ else
+ // Just pass one glyph through.
+ {
+ psstrmOut->CopyOneSlotFrom(psstrmIn);
+ psstrmOut->SetPosForNextRule(0, psstrmIn, false);
+ }
+ }
+ else
+ {
+ // Run the rule.
+#ifdef OLD_TEST_STUFF
+ if (RunTestRules(ptman, ruln, psstrmIn, psstrmOut))
+#else
+ if (false)
+#endif // OLD_TEST_STUFF
+ {}
+ else
+ {
+ int biStart = m_prgibActionStart[ruln];
+ int iResult = RunCommandCode(ptman, m_prgbActionBlock + biStart, false,
+ psstrmIn, psstrmOut, 0);
+ psstrmOut->SetPosForNextRule(iResult, psstrmIn, false);
+ }
+ }
+
+ CheckInputProgress(psstrmIn, psstrmOut, islotIn);
+
+ MapChunks(psstrmIn, psstrmOut, islotIn, islotOut, cslotReprocessed);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Runs the rule, if any, otherwise just passes one character through.
+ Keeps track of the association information in the slots and chunk
+ mappings for backtracking.
+
+ @param ptman - the table manager that allocates slots
+ @param ruln - number of rule to run; -1 if none applies
+ @param psstrmIn/Out - input / output streams
+----------------------------------------------------------------------------------------------*/
+void GrSubPass::RunRule(GrTableManager * ptman, int ruln,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ // Remember the beginnings of the new chunk:
+ int islotIn = psstrmIn->ReadPosForNextGet();
+ int islotOut = psstrmOut->WritePos();
+ int cslotReprocessed = psstrmIn->SlotsToReprocess();
+
+ if (ruln == -1)
+ {
+#ifdef OLD_TEST_STUFF
+ if (RunTestRules(ptman, ruln, psstrmIn, psstrmOut))
+#else
+ if (false)
+#endif // OLD_TEST_STUFF
+ {}
+ else
+ // Just pass one glyph through.
+ {
+ psstrmOut->CopyOneSlotFrom(psstrmIn);
+ psstrmOut->SetPosForNextRule(0, psstrmIn, false);
+ }
+ }
+ else
+ {
+ // Run the rule.
+#ifdef OLD_TEST_STUFF
+ if (RunTestRules(ptman, ruln, psstrmIn, psstrmOut))
+#else
+ if (false)
+#endif // OLD_TEST_STUFF
+ {}
+ else
+ /****************************/
+ {
+ int biStart = m_prgibActionStart[ruln];
+ int iResult = RunCommandCode(ptman, m_prgbActionBlock + biStart, false,
+ psstrmIn, psstrmOut, 0);
+ psstrmOut->SetPosForNextRule(iResult, psstrmIn, false);
+
+ // Restore if we need line-boundary contextualization based on physical locations
+ ////psstrmOut->SetLBContextFlag(ptman, islotOut);
+ }
+ }
+
+ CheckInputProgress(psstrmIn, psstrmOut, islotIn);
+
+ MapChunks(psstrmIn, psstrmOut, islotIn, islotOut, cslotReprocessed);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Runs the rule, if any, otherwise just positions one character in the standard way.
+ Keeps track of (among other things) the overall physical size of the output
+ and chunk mappings.
+
+ @param ptman - the table manager that allocates slots
+ @param ruln - number of rule to run; -1 if none applies
+ @param psstrmIn / Out - input / output streams
+----------------------------------------------------------------------------------------------*/
+void GrPosPass::RunRule(GrTableManager * ptman, int ruln,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ // Remember the beginnings of the new chunk:
+ int islotIn = psstrmIn->ReadPosForNextGet();
+ int islotOut = psstrmOut->WritePos();
+ int cslotReprocessed = psstrmIn->SlotsToReprocess();
+
+ int iResult = 0;
+
+ Assert(psstrmIn->GotIndexOffset());
+ // Don't do any positioning in anything being processed from the previous line.
+ if (psstrmIn->ReadPosForNextGet() < psstrmIn->IndexOffset())
+ ruln = -1;
+
+ if (ruln == -1)
+ {
+ // Just position one glyph in the standard way.
+ psstrmOut->CopyOneSlotFrom(psstrmIn);
+ iResult = 0;
+ }
+ else
+ {
+ // Run the rule.
+#ifdef OLD_TEST_STUFF
+ if (RunTestRules(ptman, ruln, psstrmIn, psstrmOut))
+#else
+ if (false)
+#endif // OLD_TEST_STUFF
+ {}
+ else
+ {
+ int biStart = m_prgibActionStart[ruln];
+ iResult = RunCommandCode(ptman, m_prgbActionBlock + biStart, false,
+ psstrmIn, psstrmOut, 0);
+ }
+ }
+
+ // Make sure an entire cluster is present in the output stream. Actually there might be
+ // interleaved clusters, which is the purpose for the loop.
+ int dislotClusterMax = 0;
+ do {
+ dislotClusterMax = psstrmIn->MaxClusterSlot(islotIn, psstrmIn->ReadPos());
+ Assert(dislotClusterMax >= 0);
+ for (int islot = 0; islot < dislotClusterMax; islot++)
+ psstrmOut->CopyOneSlotFrom(psstrmIn);
+ iResult -= dislotClusterMax;
+ } while (dislotClusterMax > 0);
+
+ psstrmOut->SetPosForNextRule(iResult, psstrmIn, true);
+
+ // Restore if we need line-boundary contextualization based on physical locations
+ ////psstrmOut->SetLBContextFlag(ptman, islotOut);
+
+ if (ruln > -1)
+ {
+ psstrmOut->CalcIndexOffset(ptman);
+ // Update the attachment trees and cluster metrics for slots modified by this rule.
+ // Note that this loop assumes that the reprocess buffer points to the identical
+ // slot objects as the output stream (not copies of the slots).
+ for (int islot = islotIn - psstrmIn->SlotsSkippedToResync();
+ islot < psstrmOut->WritePos() + psstrmIn->SlotsToReprocess();
+ islot++)
+ {
+ psstrmOut->SlotAt(islot)->HandleModifiedPosition(ptman, psstrmIn, psstrmOut, islot);
+ }
+ }
+
+ CheckInputProgress(psstrmIn, psstrmOut, islotIn);
+
+ MapChunks(psstrmIn, psstrmOut, islotIn, islotOut, cslotReprocessed);
+
+ psstrmOut->AssertStreamIndicesValid(psstrmIn);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Perform the reversal for internal bidirectionality.
+ Caller is responsible for updating the read- and write-positions.
+ Private.
+
+ OBSOLETE
+
+ @param nCurrDirection - direction level of range of reverse
+ @param psstrmIn, psstrmOut - streams
+ @param islotInMin, islotInLim - range to reverse
+ @param islotOutMin,islotOutLim - corresponding output positions; note that islotOutMin
+ will be greater than islotOutLim if we are reversing
+ reversing the slots (direction is odd)
+----------------------------------------------------------------------------------------------*/
+#if 0
+void GrBidiPass::OldReverse(int nCurrDirection,
+ GrSlotStream * psstrmIn, int islotInMin, int islotInLim,
+ GrSlotStream * psstrmOut, int islotOutMin, int islotOutLim)
+{
+ int oInc = (islotOutLim > islotOutMin)? 1: -1; // which direction output is moving in
+ // buffer (if dir is even, oInc == 1;
+ // if odd, oInc == -1)
+
+ int islotITmp = islotInMin;
+ int islotOTmp = islotOutMin;
+
+ while (islotITmp != islotInLim) {
+ // Find end of sub-range at current level to reverse.
+ int islotSubLim = psstrmIn->OldDirLevelRange(NULL, islotITmp, nCurrDirection);
+ Assert(islotSubLim >= 0);
+
+ if (islotSubLim == islotITmp) {
+ // Current slot is at this level--just copy it.
+ psstrmOut->SimpleCopyFrom(psstrmIn, islotITmp, islotOTmp);
+ islotOTmp += oInc;
+ islotITmp++;
+ }
+ else {
+ // There is a sub-range that needs to be reversed.
+ int islotONext = islotOTmp + ((islotSubLim-islotITmp) * oInc);
+ OldReverse(nCurrDirection+1,
+ psstrmIn, islotITmp, islotSubLim,
+ psstrmOut, islotONext - oInc, islotOTmp - oInc);
+ islotOTmp = islotONext;
+ islotITmp = islotSubLim;
+ }
+ }
+}
+#endif
+
+/*----------------------------------------------------------------------------------------------
+ Perform the reversal for internal bidirectionality.
+ Caller is responsible for updating the read- and write-positions.
+ Return the number of slots NOT copied because they were markers.
+ Private.
+
+ @param psstrmIn, psstrmOut - streams
+ @param vislotStarts, vislotStops - indices of ranges to reverse, from inner to outer
+----------------------------------------------------------------------------------------------*/
+int GrBidiPass::Reverse(GrTableManager * ptman,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ std::vector<int> & vislotStarts, std::vector<int> & vislotStops)
+{
+ Assert(vislotStarts.size() == vislotStops.size());
+
+ std::vector<int> vislotMap; // list of slot indices in the order they should be copied
+ // into the output
+
+ int islotOuterStart = vislotStarts.back();
+ int islotOuterStop = vislotStops.back();
+
+ // Initialize map as if nothing is reversed; eg for [2, 9]: (2 3 4 5 6 7 8 9)
+ int islot;
+ for (islot = 0; islot <= (islotOuterStop - islotOuterStart); islot++)
+ vislotMap.push_back(islot + islotOuterStart);
+
+ // Do the inner reversals first, followed by the outer reversals.
+ size_t iislot;
+ for (iislot = 0; iislot < vislotStarts.size(); iislot++)
+ {
+ // Reverse the run.
+ int islotStart = vislotStarts[iislot] - islotOuterStart;
+ int islotStop = vislotStops[iislot] - islotOuterStart;
+ int islot1, islot2;
+ for (islot1 = islotStart, islot2 = islotStop; islot1 < islot2; islot1++, islot2--)
+ {
+ int islotTmp = vislotMap[islot1];
+ vislotMap[islot1] = vislotMap[islot2];
+ vislotMap[islot2] = islotTmp;
+ }
+ }
+
+ // With vislotStarts = [7, 5, 2] and vislotStops = [8, 8, 9], we get
+ // first: (2 3 4 5 6 8 7 9)
+ // then: (2 3 4 7 8 5 6 9)
+ // and finally: (9 6 5 8 7 4 3 2)
+
+ // Now copy the slots.
+
+ int islotOutStart = psstrmOut->WritePos();
+ int cslotNotCopied = 0;
+ for (iislot = 0; iislot < vislotMap.size(); iislot++)
+ {
+ GrSlotState * pslot = psstrmIn->SlotAt(vislotMap[iislot]);
+ // Don't copy bidi markers unless they have been set to use a specific glyph.
+ if (pslot->IsBidiMarker() && pslot->ActualGlyphForOutput(ptman) == 0)
+ cslotNotCopied++;
+ else
+ psstrmOut->SimpleCopyFrom(psstrmIn, vislotMap[iislot],
+ iislot + islotOutStart - cslotNotCopied);
+ }
+ return cslotNotCopied;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Unwind the output for this pass, given that a change was assumed to have occurred
+ in the input at the given position. Return the position to which we unwound.
+----------------------------------------------------------------------------------------------*/
+int GrPass::Unwind(GrTableManager * ptman,
+ int islotChanged, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ bool fFirst)
+{
+ // Back up the number of slots required for the longest rule context,
+ // but if we land in the middle of a chunk, go forward to its boundary.
+ int islotIn = max(islotChanged - m_pzpst->MaxChunk(), 0);
+ if (!psstrmIn->NoReproc())
+ islotIn = min(islotIn, psstrmIn->ReprocMin());
+ psstrmIn->ClearReprocBuffer();
+ int islotOut = 0;
+ if (islotIn < psstrmIn->SlotsSkippedToResync() ||
+ islotIn == 0 ||
+ psstrmIn->ReadPos() == 0)
+ {
+ // The next-chunk-map is invalid. The beginning of the chunk is 0.
+ islotIn = 0;
+ islotOut = 0;
+ }
+ else if (islotIn >= psstrmIn->ReadPos())
+ {
+ // No need to unwind.
+ Assert(psstrmIn->NoReproc());
+ return psstrmOut->WritePos();
+ }
+ else
+ {
+ Assert(islotIn < psstrmIn->ReadPos());
+ islotIn = min(islotIn, psstrmIn->ReadPos() - 1);
+ while (islotIn < psstrmIn->ReadPos() &&
+ (islotOut = psstrmIn->ChunkInNext(islotIn)) == -1)
+ {
+ ++islotIn;
+ }
+ if (islotIn == psstrmIn->ReadPos())
+ islotOut = psstrmOut->WritePos();
+ }
+
+ Assert(islotOut != -2); // because the chunk size must be <= than the max-chunk,
+ // so we should never hit the end of the output stream
+
+ // Now we've found a chunk boundary.
+
+// if (fFirst)
+// Unattach(psstrmIn, islotIn, psstrmOut, islotOut, islotChanged);
+// else
+// Unattach(psstrmIn, islotIn, psstrmOut, islotOut, -1);
+
+ psstrmIn->UnwindInput(islotIn, PreBidiPass());
+ psstrmOut->UnwindOutput(islotOut, IsPosPass());
+
+ if (psstrmIn->ReadPos() < psstrmIn->SlotsSkippedToResync())
+ {
+ ptman->Pass(m_ipass - 1)->UndoResyncSkip();
+ psstrmIn->ClearSlotsSkippedToResync();
+ }
+ if (psstrmOut->WritePos() < psstrmOut->SlotsSkippedToResync())
+ {
+ Assert(psstrmOut->SlotsSkippedToResync() == m_pzpst->m_cslotSkipToResync);
+ UndoResyncSkip();
+ psstrmOut->ClearSlotsSkippedToResync();
+ }
+
+ if (ptman->LoggingTransduction())
+ m_pzpst->UnwindLogInfo(islotIn, islotOut);
+
+ return islotOut;
+}
+
+/*----------------------------------------------------------------------------------------------
+ For a GrBidiPass, just unwind to the beginning of the reordered chunk.
+----------------------------------------------------------------------------------------------*/
+int GrBidiPass::Unwind(GrTableManager * ptman,
+ int islotChanged, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ bool fFirst)
+{
+ int islotIn;
+ int islotOut;
+
+ if (islotChanged == 0)
+ {
+ islotIn = 0;
+ islotOut = 0;
+ }
+ else {
+ islotIn = min(islotChanged, psstrmIn->ReadPos());
+ islotIn = max(islotIn - 1, 0);
+ while (islotIn > 0 && !StrongDir(psstrmIn->SlotAt(islotIn)->Directionality()))
+ {
+ psstrmIn->SlotAt(islotIn)->ZapDirLevel();
+ islotIn--;
+ }
+ Assert(islotIn == 0 || psstrmIn->SlotAt(islotIn)->DirHasBeenProcessed());
+ islotOut = 0;
+ while (islotIn > 0 && (islotOut = psstrmIn->ChunkInNext(islotIn)) == -1)
+ --islotIn;
+ }
+
+ if (islotOut == -1 || islotOut == -2)
+ islotOut = 0;
+
+ // Now we've found a chunk boundary; islotI and islotO are the positions in the
+ // input and output streams, respectively.
+
+ psstrmIn->UnwindInput(islotIn, false);
+ psstrmOut->UnwindOutput(islotOut, false);
+
+ if (psstrmOut->WritePos() < m_pzpst->m_cslotSkipToResync)
+ {
+ Assert(false); // shouldn't be any of this mess for the Bidi pass
+ m_pzpst->m_fDidResyncSkip = false;
+ }
+
+ if (ptman->LoggingTransduction())
+ m_pzpst->UnwindLogInfo(islotIn, islotOut);
+
+ return islotOut;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Reinitialize part of the transduction logging information when we unwind the pass.
+----------------------------------------------------------------------------------------------*/
+void PassState::UnwindLogInfo(int islotIn, int islotOut)
+{
+ while (m_crulrec > 0 && m_rgrulrec[m_crulrec-1].m_islot >= islotIn)
+ {
+ m_crulrec--;
+ m_rgrulrec[m_crulrec].m_islot = 0;
+ m_rgrulrec[m_crulrec].m_irul = 0;
+ m_rgrulrec[m_crulrec].m_fFired = false;
+ }
+
+ for (int islot = islotOut; islot < 128; islot++)
+ {
+ m_rgcslotDeletions[islot] = 0;
+ m_rgfInsertion[islot] = false;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Undo the side effects of attachments, ie, fix up the attachment trees as we unwind.
+
+ @param islotLB the index of the line-break that was just inserted, or -1 if this is
+ not the first pass to include line-breaks; we want to skip this slot
+ in the processing in this method
+
+ OBSOLETE
+----------------------------------------------------------------------------------------------*/
+//:Ignore
+void GrPosPass::Unattach(GrSlotStream * psstrmIn, int islotIn,
+ GrSlotStream * psstrmOut, int islotOut, int islotLB)
+{
+ // Because this is a positioning pass, there is a one-to-one correspondence between
+ // the slots in the input and the slots in the output. Thus we can make simplifying
+ // assumptions. Specifically, the chunk sizes are equal, except for the possiblity
+ // of a LB slot that we just inserted in the input stream.
+#if 0
+
+#ifdef _DEBUG
+ int islotDiff = (psstrmIn->ReadPos() - islotIn) - (psstrmOut->WritePos() - islotOut);
+ if (islotLB == -1)
+ Assert(islotDiff == 0);
+ else
+ Assert(islotDiff == 1);
+#endif // _DEBUG
+
+ int islotInLp = psstrmIn->ReadPos();
+ int islotOutLp = psstrmOut->WritePos();
+ for ( ; islotInLp-- > islotIn && islotOutLp-- > islotOut; )
+ {
+ if (islotLB == islotInLp)
+ {
+ GrSlotState * pslotTmp = psstrmIn->SlotAt(islotInLp);
+ islotInLp--;
+ }
+
+ GrSlotState * pslotIn = psstrmIn->SlotAt(islotInLp);
+ GrSlotState * pslotOut = psstrmOut->SlotAt(islotOutLp);
+
+ if (pslotIn != pslotOut)
+ {
+ GrSlotState * pslotInRoot = pslotIn->AttachRoot();
+ GrSlotState * pslotOutRoot = pslotOut->AttachRoot();
+
+ if (pslotOutRoot)
+ pslotOutRoot->RemoveLeaf(pslotOut);
+ if (pslotInRoot)
+ pslotInRoot->AddLeaf(pslotIn);
+ }
+ }
+#endif // 0
+}
+//:End Ignore
+
+
+/*----------------------------------------------------------------------------------------------
+ Record the fact that the given rule's constraint failed, for the purpose of logging
+ the transduction process.
+----------------------------------------------------------------------------------------------*/
+void GrPass::RecordRuleFailed(int islot, int irul)
+{
+ m_pzpst->RecordRule(islot, irul, false);
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Record the fact that the given rule fired, for the purpose of logging
+ the transduction process.
+----------------------------------------------------------------------------------------------*/
+void GrPass::RecordRuleFired(int islot, int irul)
+{
+ m_pzpst->RecordRule(islot, irul, true);
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Record the fact that we forcibly advanced due to the max-rule-loop.
+----------------------------------------------------------------------------------------------*/
+void GrPass::RecordHitMaxRuleLoop(int islot)
+{
+ m_pzpst->RecordRule(islot, PassState::kHitMaxRuleLoop);
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Record the fact that we forcibly advanced due to the max-backup.
+
+ In theory it should be possible to call this, but in reality, it is pretty hard to be
+ able to say that there is a rule that would have fired except it was prevent by
+ MaxBackup. So currently this method is not called.
+----------------------------------------------------------------------------------------------*/
+void GrPass::RecordHitMaxBackup(int islot)
+{
+ m_pzpst->RecordRule(islot, PassState::kHitMaxBackup);
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Record some rule-related activity on a slot.
+----------------------------------------------------------------------------------------------*/
+void PassState::RecordRule(int islot, int irul, bool fFired)
+{
+ if (m_crulrec >= 128)
+ return;
+
+ m_rgrulrec[m_crulrec].m_irul = irul;
+ m_rgrulrec[m_crulrec].m_islot = islot;
+ m_rgrulrec[m_crulrec].m_fFired = true;
+ m_rgrulrec[m_crulrec].m_fFired = fFired;
+ m_crulrec++;
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Record the fact that a slot was deleted before the given slot (in the output).
+----------------------------------------------------------------------------------------------*/
+void PassState::RecordDeletionBefore(int islot)
+{
+ if (islot >= 128)
+ return;
+
+ (m_rgcslotDeletions[islot])++;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Record the fact that the given slot was inserted into the output.
+----------------------------------------------------------------------------------------------*/
+void PassState::RecordInsertionAt(int islot)
+{
+ if (islot >= 128)
+ return;
+
+ m_rgfInsertion[islot] = true;
+}
+
+} // namespace gr
diff --git a/Build/source/libs/graphite/src/segment/GrPass.h b/Build/source/libs/graphite/src/segment/GrPass.h
new file mode 100644
index 00000000000..d4d6a16a9dc
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrPass.h
@@ -0,0 +1,748 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999 - 2008 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrPass.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ The GrPass class and subclasses.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef PASS_INCLUDED
+#define PASS_INCLUDED
+
+//:End Ignore
+
+namespace gr
+{
+
+/*----------------------------------------------------------------------------------------------
+ This class stores the state of processing in a single pass.
+
+ Hungarian: zpst
+----------------------------------------------------------------------------------------------*/
+
+class PassState {
+ friend class GrPass;
+ friend class GrGlyphGenPass;
+ friend class GrLineBreakPass;
+ friend class GrSubPass;
+ friend class GrBidiPass;
+ friend class GrPosPass;
+ friend class FontMemoryUsage;
+
+public:
+ PassState()
+ {
+ }
+
+ void InitForNewSegment(int ipass, int nMaxChunk);
+ void InitializeLogInfo();
+
+ int MaxChunk()
+ {
+ return m_nMaxChunk;
+ }
+
+ void SetResyncSkip(int c)
+ {
+ m_cslotSkipToResync = c;
+ m_fDidResyncSkip = false;
+ }
+ int NeededToResync()
+ {
+ if (m_fDidResyncSkip)
+ return 0;
+ return m_cslotSkipToResync;
+ }
+ bool DidResyncSkip()
+ {
+ return m_fDidResyncSkip;
+ }
+ bool CanResyncSkip(GrSlotStream * psstrmOutput)
+ {
+ if (m_fDidResyncSkip)
+ return true; // already did it
+ // Are we in the position to do the resync-skip?
+ return m_cslotSkipToResync <= psstrmOutput->WritePos();
+ }
+ int DoResyncSkip(GrSlotStream * psstrmOutput);
+ void UndoResyncSkip()
+ {
+ m_fDidResyncSkip = false;
+ }
+
+ void UnwindLogInfo(int islotIn, int islotOut);
+ void RecordRule(int islot, int irul, bool fFired = false);
+ void RecordDeletionBefore(int islot);
+ void RecordInsertionAt(int islot);
+#ifdef TRACING
+ void LogRulesFiredAndFailed(std::ostream & strmOut, GrSlotStream * psstrmIn);
+ void LogInsertionsAndDeletions(std::ostream & strmOut, GrSlotStream * psstrmOut);
+ void LogXmlRules(std::ostream & strmOut, GrTableManager *, GrSlotStream * psstrmIn, int nIndent);
+ void LogXmlGlyphs(std::ostream & strmOut, GrTableManager * ptman, GrSlotStream * psstrmOut,
+ int ipassJust1, bool fPreJust, bool fPostJust, bool fBidi, bool fBidiNext, int cslotsSkipped,
+ int nIndent);
+#endif // TRACING
+
+protected:
+ int m_ipass;
+
+ // Used to avoid infinite loops. If m_nRulesSinceAdvance > m_nMaxRuleLoop,
+ // and we have not passed the stream's ReadPosMax, forcibly advance.
+ int m_nRulesSinceAdvance;
+
+ // Maximum length of chunk, used when unwinding the streams during backtracking. This
+ // must be initialized to m_nMaxRuleContext, but that is not always adequate, because
+ // when there is reprocessing going on the chunks may be longer.
+ int m_nMaxChunk;
+
+ // Indicates how much of the pass's initial output should be automatically
+ // skipped over in order to resync with a chunk boundary. This handles the situation
+ // where we are reprocessing a little of the previous segment in order to handle
+ // cross-line-boundary contextuals. The goal is to skip over the output until we hit
+ // what we know (from processing the previous segment) is a chunk boundary.
+ //
+ // In most cases (and always when this is the first segment of the
+ // writing system) this number is 0.
+ int m_cslotSkipToResync;
+ bool m_fDidResyncSkip;
+
+ enum {
+ kHitMaxBackup = -1,
+ kHitMaxRuleLoop = -2
+ };
+
+ // For logging transduction process: record of one rule matched or fired
+ struct RuleRecord
+ {
+ int m_irul; // rule index, or kHitMaxBackup or kHitMaxRuleLoop
+ int m_islot; // slot index of input stream
+ bool m_fFired;
+ };
+ RuleRecord m_rgrulrec[128];
+ int m_crulrec;
+
+ int m_rgcslotDeletions[128]; // number of deletions before slot i in output
+ bool m_rgfInsertion[128]; // true if slot i in output was inserted
+};
+
+/*----------------------------------------------------------------------------------------------
+ This class handles finding and applying rules from the pass and storing
+ the results in the appropriate stream.
+
+ Hungarian: pass
+----------------------------------------------------------------------------------------------*/
+class GrPass {
+ friend class FontMemoryUsage;
+
+protected:
+ // Action command codes; these MUST match the corresponding definitions in the compiler:
+ enum ActionCommand {
+ kopNop = 0,
+
+ kopPushByte, kopPushByteU, kopPushShort, kopPushShortU, kopPushLong,
+
+ kopAdd, kopSub, kopMul, kopDiv,
+ kopMin, kopMax,
+ kopNeg,
+ kopTrunc8, kopTrunc16,
+
+ kopCond,
+
+ kopAnd, kopOr, kopNot,
+ kopEqual, kopNotEq,
+ kopLess, kopGtr, kopLessEq, kopGtrEq,
+
+ kopNext, kopNextN, kopCopyNext,
+ kopPutGlyph8bitObs, kopPutSubs8bitObs, kopPutCopy,
+ kopInsert, kopDelete,
+ kopAssoc,
+ kopCntxtItem,
+
+ kopAttrSet, kopAttrAdd, kopAttrSub,
+ kopAttrSetSlot,
+ kopIAttrSetSlot,
+ kopPushSlotAttr, kopPushGlyphAttrObs,kopPushGlyphMetric, kopPushFeat,
+ kopPushAttToGAttrObs, kopPushAttToGlyphMetric,
+ kopPushISlotAttr,
+
+ kopPushIGlyphAttr, // not implemented
+
+ kopPopRet, kopRetZero, kopRetTrue,
+ kopIAttrSet, kopIAttrAdd, kopIAttrSub,
+ kopPushProcState, kopPushVersion,
+ kopPutSubs, kopPutSubs2, kopPutSubs3,
+ kopPutGlyph, kopPushGlyphAttr, kopPushAttToGlyphAttr
+
+ };
+
+ enum StackMachineFlag {
+ ksmfDone = 0,
+ ksmfContinue,
+ ksmfUnderflow,
+ ksmfStackNotEmptied
+ };
+
+public:
+ // Constructor:
+ GrPass(int i);
+ // Destructor:
+ virtual ~GrPass();
+
+ int PassNumber() { return m_ipass; }
+
+ bool ReadFromFont(GrIStream & grstrm, int fxdSilfVersion, int fxdRuleVersion, int nOffset);
+ void InitializeWithNoRules();
+
+ virtual void SetTopDirLevel(int n)
+ { // only GrBidiPass does anything interesting
+ }
+
+ void SetPassState(PassState * pzpst)
+ {
+ m_pzpst = pzpst;
+ }
+
+ virtual void ExtendOutput(GrTableManager *,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput, int nslotToGet,
+ TrWsHandling twsh,
+ int * pnRet, int * pcslotGot, int * pislotFinalBreak);
+
+ int ExtendGlyphIDOutput(GrTableManager *, GrCharStream *,
+ GrSlotStream *, int ichSegLim, int cchwPostXlbContext,
+ LineBrk lb, int cslotToGet, bool fNeedFinalBreak,
+ TrWsHandling twsh, int * pislotFinalBreak);
+
+ int ExtendFinalOutput(GrTableManager *, GrSlotStream * psstrmInput,
+ GrSlotStream * psstrmOutput,
+ float xsSpaceAllotted, bool fWidthIsCharCount, bool fInfiniteWidth,
+ bool fHaveLineBreak, bool fMustBacktrack,
+ LineBrk lbMax, TrWsHandling twsh,
+ int * pislotLB, float * pxsWidth);
+
+ int RemoveTrailingWhiteSpace(GrTableManager * ptman, GrSlotStream * psstrmOut,
+ TrWsHandling twsh, int * pislotFinalBreak);
+
+ virtual int Unwind(GrTableManager * ptman,
+ int islotChanged, GrSlotStream *psstrmInput, GrSlotStream * psstrmOutput,
+ bool fFirst);
+
+ int MaxBackup()
+ {
+ return m_nMaxBackup;
+ }
+
+ bool DidResyncSkip()
+ {
+ return m_pzpst->DidResyncSkip();
+ }
+ int DoResyncSkip(GrSlotStream * psstrmOutput)
+ {
+ return m_pzpst->DoResyncSkip(psstrmOutput);
+ }
+
+ void UndoResyncSkip()
+ {
+ m_pzpst->UndoResyncSkip();
+ }
+ void SetResyncSkip(int n)
+ {
+ m_pzpst->SetResyncSkip(n);
+ }
+
+ virtual void DoCleanUpSegMin(GrTableManager * ptman,
+ GrSlotStream * psstrmIn, int islotInitReadPos, GrSlotStream * psstrmOut)
+ {
+ }
+
+ virtual bool IsPosPass()
+ {
+ return false;
+ }
+
+ virtual bool PreBidiPass() = 0;
+
+ bool RunConstraint(GrTableManager *, int ruln,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ int cslotPreModContext, int cslotMatched);
+
+ int RunCommandCode(GrTableManager * ptman,
+ byte * pbStart, bool fConstraints,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islot);
+
+protected:
+ int RunOneCommand(GrTableManager * ptman, bool fConstraints,
+ ActionCommand op, byte ** ppbArg, bool * pfMustGet, bool * pfInserting,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islot,
+ std::vector<int> & vnStack, StackMachineFlag * psmf);
+ void DoStackArithmetic2Args(ActionCommand op, std::vector<int> & vnStack,
+ StackMachineFlag * psmf);
+ void DoStackArithmetic1Arg(ActionCommand op, std::vector<int> & vnStack,
+ StackMachineFlag * psmf);
+ void DoConditional(std::vector<int> & vnStack, StackMachineFlag * psmf);
+ StackMachineFlag CheckStack(std::vector<int> & vnStack, int cn);
+ void DoNext(GrTableManager * ptman,
+ int cslot, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+ void DoPutGlyph(GrTableManager * ptman, bool fInserting, int nReplacementClass,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+ void DoPutCopy(GrTableManager * ptman, bool fInserting, int cslotCopyFrom,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+ void DoPutSubs(GrTableManager * ptman, bool fInserting,
+ int cslotSel, int nSelClass, int nReplacementClass,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+ void DoPutSubs2(GrTableManager * ptman, bool fInserting,
+ int cslotSel1, int nSelClass1, int cslotSel2, int nSelClass2, int nReplacementClass,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+ void DoPutSubs3(GrTableManager * ptman, bool fInserting,
+ int cslotSel1, int nSelClass1, int cslotSel2, int nSelClass2, int cslotSel3, int nSelClass3,
+ int nReplacementClass, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+ void DoPutSubsInit(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, bool fInserting,
+ GrSlotState ** ppslotNextPut, bool * pfAtSegMin, bool * pfAtSegLim);
+ void DoPutSubsAux(GrTableManager * ptman, bool fInserting, gid16 nGlyphReplacement,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, GrSlotState * pslotNextInput,
+ bool fAtSegMin, bool fAtSegLim);
+ void SetNeutralAssocs(GrSlotState * pslotNew, GrSlotStream * psstrmIn);
+ void DoDelete(GrTableManager * ptman,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+ void DoAssoc(int cnAssocs, std::vector<int> & vnAssocs, bool fInserting,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+ void DoSetAttr(GrTableManager * ptman,
+ ActionCommand op, bool fInserrting,
+ SlotAttrName slat, int slati, std::vector<int> & vnStack,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+ void DoPushSlotAttr(GrTableManager * ptman,
+ int nSlotRef, bool fInserting,
+ SlotAttrName slat, int slati, std::vector<int> & vnStack,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+ void DoPushGlyphAttr(GrTableManager * ptman, int nSlotRef, bool fInserting,
+ int nGlyphAttr, std::vector<int> & vnStack,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+ void DoPushAttToGlyphAttr(GrTableManager * ptman, int nSlotRef, bool fInserting,
+ int nGlyphAttr, std::vector<int> & vnStack,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+ void DoPushGlyphMetric(GrTableManager * ptman, int nSlotRef, bool fInserting,
+ int nGlyphAttr, int nAttLevel, std::vector<int> & vnStack,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+ void DoPushAttToGlyphMetric(GrTableManager * ptman, int nSlotRef, bool fInserting,
+ int nGlyphAttr, int nAttLevel, std::vector<int> & vnStack,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+ void DoPushFeatValue(GrTableManager * ptman, int islot, bool fInsering,
+ int nFeat, std::vector<int> & vnStack,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+ void DoPushProcState(GrTableManager * ptman, int nPState, std::vector<int> & vnStack);
+protected:
+ void DoPushGlyphMetricAux(GrTableManager * ptman,
+ GrSlotState * pslot, int nGlyphAttr, int nAttLevel,
+ std::vector<int> & vnStack, GrSlotStream * psstrmIn);
+public:
+ int SortKeyForRule(int ruln)
+ {
+ Assert(ruln < m_crul);
+ return m_prgchwRuleSortKeys[ruln];
+ }
+ int PreModContextForRule(int ruln)
+ {
+ Assert(ruln < m_crul);
+ return m_prgcritRulePreModContext[ruln];
+ }
+
+ int MaxRulePreContext()
+ {
+ if (m_pfsm)
+ return m_pfsm->MaxRulePreContext();
+ else
+ return 0;
+ }
+
+ void RecordRuleFailed(int islot, int irul);
+ void RecordRuleFired(int islot, int irul);
+ void RecordHitMaxRuleLoop(int islot);
+ void RecordHitMaxBackup(int islot);
+#ifdef TRACING
+ void LogRulesFiredAndFailed(std::ostream & strmOut, GrSlotStream * psstrmIn);
+ void LogInsertionsAndDeletions(std::ostream & strmOut, GrSlotStream * psstrmOut);
+ void LogXmlRules(std::ostream & strmOut, GrTableManager * ptman,
+ GrSlotStream * psstrmIn, int nIndent);
+ void LogXmlGlyphs(std::ostream & strmOut, GrTableManager * ptman, GrSlotStream * psstrmOut,
+ int ipassJust1, bool fPreJust, bool fPostJust, int cslotsSkipped, int nIndent);
+#endif // TRACING
+
+protected:
+ int CheckRuleValidity(int ruln);
+
+ virtual void RunRule(GrTableManager *, int ruln,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput) = 0;
+
+ void CheckInputProgress(GrSlotStream* input, GrSlotStream* psstrmOutput,
+ int islotOrigInput);
+
+ void MapChunks(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ int islotChunkI, int islotChunkO, int cslotReprocessed);
+
+ virtual void Unattach(GrSlotStream * psstrmIn, int islotIn, // GrPosPass overrides
+ GrSlotStream * psstrmOut, int islotOut, int islotLB)
+ {
+ }
+
+ friend class EngineState; // let it call the method below
+ virtual int MaxRuleContext() // GrBidiPass overrides
+ {
+ return m_nMaxRuleContext;
+ }
+
+protected:
+ // Instance variables:
+
+ int m_ipass; // index of pass
+
+ int m_fxdVersion;
+
+ // number of items required from previous pass; don't access directly, use the getter
+ // method, because GrBidiPass overrides to always use 1.
+ int m_nMaxRuleContext;
+
+ GrFSM * m_pfsm; // Finite State Machine to give next rule
+
+ int m_nMaxRuleLoop; // maximum number of rules to process before forcibly
+ // advancing input position
+
+ int m_nMaxBackup;
+
+ int m_crul; // number of rules
+
+ // rule sort keys, indicating precedence of rules; m_crul of these
+ data16 * m_prgchwRuleSortKeys;
+
+ // for each rule, the number of items in the context before the first modified item
+ // that the constraints need to be tested on
+ byte * m_prgcritRulePreModContext;
+
+ // offset for pass-level constraints; just 1 of these
+ data16 m_cbPassConstraint;
+ // offsets for constraint and action code; m_crul+1 of each of these (the last
+ // indicates the total byte count)
+ data16 * m_prgibConstraintStart;
+ data16 * m_prgibActionStart;
+
+ // blocks of constraint and action code
+ byte * m_prgbPConstraintBlock; // pass-level constraints
+ byte * m_prgbConstraintBlock; // rule constraints
+ byte * m_prgbActionBlock;
+
+ int m_cbConstraints; // needed for memory instrumentation only
+ int m_cbActions; // needed for memory instrumentation only
+
+ bool m_fHasDebugStrings;
+ data16 * m_prgibConstraintDebug; // m_crul+1 of these
+ data16 * m_prgibRuleDebug; // m_crul+1 of these
+
+ bool m_fCheckRules;
+ bool * m_prgfRuleOkay;
+
+ std::vector<int> m_vnStack; // for stack machine processing (more efficient than creating the
+ // vector each time)
+
+ // state of process for this pass
+ PassState * m_pzpst;
+
+public:
+#ifdef OLD_TEST_STUFF
+ // For test procedures:
+ StrAnsi m_staBehavior;
+
+ virtual void SetUpTestData();
+
+ // overridden on appropriate subclasses:
+ virtual void SetUpReverseNumbersTest() { Assert(false); }
+ virtual void SetUpBidiNumbersTest() { Assert(false); }
+
+ virtual void SetUpCrossLineContextTest() { Assert(false); }
+ virtual void SetUpReprocessTest() { Assert(false); }
+ virtual void SetUpLineEdgeContextTest(int ipass) { Assert(false); }
+ virtual void SetUpBidiAlgorithmTest() { Assert(false); }
+ virtual void SetUpPseudoGlyphsTest() { Assert(false); }
+ virtual void SetUpSimpleFSMTest() { Assert(false); }
+ virtual void SetUpRuleActionTest() { Assert(false); }
+ virtual void SetUpRuleAction2Test() { Assert(false); }
+ virtual void SetUpAssocTest() { Assert(false); }
+ virtual void SetUpAssoc2Test() { Assert(false); }
+ virtual void SetUpDefaultAssocTest() { Assert(false); }
+ virtual void SetUpFeatureTest() { Assert(false); }
+ virtual void SetUpLigatureTest() { Assert(false); }
+ virtual void SetUpLigature2Test() { Assert(false); }
+#endif // OLD_TEST_STUFF
+
+}; // end of class GrPass
+
+
+/*----------------------------------------------------------------------------------------------
+ The initial pass that generates glyph IDs from Unicode input.
+
+ Hungarian: pass
+----------------------------------------------------------------------------------------------*/
+class GrGlyphGenPass : public GrPass
+{
+ friend class FontMemoryUsage;
+
+public:
+ GrGlyphGenPass(int ipass) : GrPass(ipass)
+ {
+ }
+
+ virtual bool PreBidiPass()
+ {
+ return true;
+ }
+
+protected:
+ // Irrelevant when generating glyphs.
+ virtual void RunRule(GrTableManager *, int ruln,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+ {
+ Assert(false);
+ }
+
+}; // end of class GrGlyphGenPass
+
+
+/*----------------------------------------------------------------------------------------------
+ A pass containing rules that set the break weight values.
+
+ Hungarian: pass
+----------------------------------------------------------------------------------------------*/
+class GrLineBreakPass : public GrPass
+{
+ friend class FontMemoryUsage;
+
+public:
+ GrLineBreakPass(int ipass) : GrPass(ipass)
+ {
+ }
+
+ virtual bool PreBidiPass()
+ {
+ return true;
+ }
+
+protected:
+ virtual void RunRule(GrTableManager *, int ruln,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput);
+
+public:
+#ifdef OLD_TEST_STUFF
+ // For test procedures:
+ bool RunTestRules(GrTableManager *, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+ bool RunTestRules(GrTableManager *, int ruln, GrSlotStream * psstrmIn,
+ GrSlotStream * psstrmOut);
+
+ virtual void SetUpCrossLineContextTest();
+ bool RunCrossLineContextTest(GrTableManager*, GrSlotStream* psstrmIn,
+ GrSlotStream* psstrmOut);
+
+ virtual void SetUpReprocessTest();
+ bool RunReprocessTest(GrTableManager *, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut);
+
+ virtual void SetUpAssocTest();
+ virtual void SetUpLigatureTest();
+#endif // OLD_TEST_STUFF
+
+}; // end of class GrLineBreakPass
+
+
+/*----------------------------------------------------------------------------------------------
+ A pass containing substitution rules.
+
+ Hungarian: pass
+----------------------------------------------------------------------------------------------*/
+class GrSubPass : public GrPass
+{
+ friend class FontMemoryUsage;
+
+public:
+ GrSubPass(int ipass) : GrPass(ipass)
+ {
+ }
+
+ virtual bool PreBidiPass()
+ {
+ return true;
+ }
+
+protected:
+ virtual void RunRule(GrTableManager *, int ruln,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput);
+
+ virtual void DoCleanUpSegMin(GrTableManager * ptman,
+ GrSlotStream * psstrmIn, int islotInitReadPos, GrSlotStream * psstrmOut);
+
+public:
+#ifdef OLD_TEST_STUFF
+ // For test procedures:
+ bool RunTestRules(GrTableManager *, GrSlotStream * psstrmIn,
+ GrSlotStream * psstrmOut);
+ bool RunTestRules(GrTableManager *, int ruln, GrSlotStream * psstrmIn,
+ GrSlotStream * psstrmOut);
+
+ virtual void SetUpReverseNumbersTest();
+ bool RunReverseNumbersTest(GrTableManager*, GrSlotStream* psstrmIn,
+ GrSlotStream* psstrmOut);
+
+ virtual void SetUpBidiNumbersTest();
+ bool RunBidiNumbersTest(GrTableManager*, GrSlotStream* psstrmIn,
+ GrSlotStream* psstrmOut);
+
+ virtual void SetUpCrossLineContextTest();
+ bool RunCrossLineContextTest(GrTableManager*, GrSlotStream* psstrmIn,
+ GrSlotStream* psstrmOut);
+
+ virtual void SetUpReprocessTest();
+ bool RunReprocessTest(GrTableManager *, GrSlotStream * psstrmIn,
+ GrSlotStream * psstrmOut);
+
+ virtual void SetUpLineEdgeContextTest(int ipass);
+ bool RunLineEdgeContextTest(GrTableManager *, GrSlotStream * psstrmIn,
+ GrSlotStream * psstrmOut);
+
+ virtual void SetUpBidiAlgorithmTest();
+ bool RunBidiAlgorithmTest(GrTableManager *, GrSlotStream * psstrmIn,
+ GrSlotStream * psstrmOut);
+
+ virtual void SetUpPseudoGlyphsTest();
+ bool RunPseudoGlyphsTest(GrTableManager *, GrSlotStream * psstrmIn,
+ GrSlotStream * psstrmOut);
+
+ virtual void SetUpSimpleFSMTest();
+ bool RunSimpleFSMTest(GrTableManager *, int ruln, GrSlotStream * psstrmIn,
+ GrSlotStream * psstrmOut);
+ virtual void SetUpRuleActionTest();
+ virtual void SetUpRuleAction2Test();
+ virtual void SetUpAssocTest();
+ virtual void SetUpAssoc2Test();
+ virtual void SetUpDefaultAssocTest();
+ virtual void SetUpFeatureTest();
+ virtual void SetUpLigatureTest();
+ virtual void SetUpLigature2Test();
+#endif // OLD_TEST_STUFF
+
+}; // end of class GrSubPass
+
+
+/*----------------------------------------------------------------------------------------------
+ This class is the one the knows how to handle bidi reordering, including backtracking.
+
+ Hungarian: pass
+----------------------------------------------------------------------------------------------*/
+class GrBidiPass : public GrSubPass
+{
+ friend class FontMemoryUsage;
+
+public:
+ // Constructor:
+ GrBidiPass(int ipass)
+ : GrSubPass(ipass),
+ m_nTopDirection(0)
+ {
+ }
+
+ virtual void SetTopDirLevel(int n)
+ {
+ m_nTopDirection = n;
+ }
+
+ virtual bool PreBidiPass()
+ {
+ return false;
+ }
+
+ virtual void ExtendOutput(GrTableManager *,
+ GrSlotStream * psstrmI, GrSlotStream * psstrmO, int nslotToGet,
+ TrWsHandling twsh,
+ int * pnRet, int * pcslotGot, int * pislotFinalBreak);
+
+ virtual int Unwind(GrTableManager * ptman,
+ int islotChanged, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ bool fFirst);
+protected:
+ virtual int MaxRuleContext()
+ {
+ return 1;
+ }
+
+private:
+ //void OldReverse(int nCurrDirection,
+ // GrSlotStream * psstrmI, int islotI1, int islotI2,
+ // GrSlotStream * psstrmO, int islotO1, int islotO2);
+
+ int Reverse(GrTableManager * ptman,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut,
+ std::vector<int> & vislotStarts, std::vector<int> & vislotStops);
+
+protected:
+ // Instance variables:
+ int m_nTopDirection; // 0 for LTR, 1 for RTL -- CURRENTLY NOT USED; need to
+ // initialize it when we set the writing system direction
+
+#ifdef OLD_TEST_STUFF
+public:
+ // For test procedures:
+ ////virtual void SetUpTestData();
+ virtual void SetUpBidiNumbersTest();
+ virtual void SetUpBidiAlgorithmTest();
+#endif // OLD_TEST_STUFF
+
+}; // end of class GrBidiPass
+
+
+/*----------------------------------------------------------------------------------------------
+ A pass containing positioning rules.
+
+ Hungarian: pass
+----------------------------------------------------------------------------------------------*/
+class GrPosPass : public GrPass
+{
+ friend class FontMemoryUsage;
+
+public:
+ GrPosPass(int ipass) : GrPass(ipass)
+ {
+ }
+
+ virtual bool IsPosPass()
+ {
+ return true;
+ }
+
+ virtual bool PreBidiPass()
+ {
+ return false;
+ }
+
+protected:
+ virtual void RunRule(GrTableManager *, int ruln,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput);
+
+ virtual void Unattach(GrSlotStream * psstrmIn, int islotIn,
+ GrSlotStream * psstrmOut, int islotOut, int islotLB);
+
+public:
+#ifdef OLD_TEST_STUFF
+ // For test procedures:
+ bool RunTestRules(GrTableManager *, GrSlotStream * psstrmIn,
+ GrSlotStream * psstrmOut);
+ bool RunTestRules(GrTableManager *, int ruln, GrSlotStream * psstrmIn,
+ GrSlotStream * psstrmOut);
+#endif // OLD_TEST_STUFF
+
+}; // end of class GrPosPass
+
+} // namespace gr
+
+
+#endif // PASS_INCLUDED
diff --git a/Build/source/libs/graphite/src/segment/GrPassActionCode.cpp b/Build/source/libs/graphite/src/segment/GrPassActionCode.cpp
new file mode 100644
index 00000000000..83c58b27e48
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrPassActionCode.cpp
@@ -0,0 +1,1492 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrPassActionCode.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ A continution of the GrPass file, including functions to run the action commands.
+
+This comment could create a merge conflict. It can be removed.
+----------------------------------------------------------------------------------------------*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:End Ignore
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local type definitions
+//:>********************************************************************************************
+
+typedef signed char Int8; // signed value
+typedef unsigned char Uint8; // unsigned value
+
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ The main function to run a block of action or constraint code and return a result.
+
+ @param ptman - table manager, for generating new slots; NULL when
+ running constraints
+ @param pbStart - address of the first command
+ @param fConstraints - true if we are running constraint tests;
+ false if we are running rule actions
+ @param psstrmIn - input stream
+ @param psstrmOut - output stream; when running constraints, used to access items
+ in the precontext
+ @param islot - slot being processed relative to the start of the rule;
+ used only for constraints; must be 0 for rule actions
+----------------------------------------------------------------------------------------------*/
+int GrPass::RunCommandCode(GrTableManager * ptman,
+ byte * pbStart, bool fConstraints,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islot)
+{
+ byte * pbNext = pbStart;
+
+// std::vector<int> vnStack;
+// vnStack.EnsureSpace(128); // make it nice and big
+ m_vnStack.clear();
+
+ gAssert(fConstraints || islot == 0);
+
+ // There are two states: fMustGet = true means we need to get a slot to work on from
+ // the input; fMustGet = false means we have a slot and we need to do a Next before
+ // we can get the next one.
+ bool fMustGet = !fConstraints;
+
+ bool fInserting = false; // set to true by an Insert command
+
+ int nRet = 0;
+
+ while (true)
+ {
+ ActionCommand op = ActionCommand(*pbNext++);
+ StackMachineFlag smf;
+ nRet = RunOneCommand(ptman, fConstraints, op,
+ &pbNext, &fMustGet, &fInserting,
+ psstrmIn, psstrmOut, islot,
+ m_vnStack, &smf);
+
+ if (smf == ksmfDone)
+ return nRet;
+
+ if (smf == ksmfUnderflow)
+ {
+ Warn("Underflow in Graphite stack machine");
+ gAssert(false);
+ FontException fexptn;
+ fexptn.version = -1;
+ fexptn.subVersion = -1;
+ fexptn.errorCode = kferrUnknown;
+ throw fexptn; // disastrous error in rendering; fall back to dumb rendering
+ }
+ }
+ return nRet; // not needed, but to avoid compiler warning
+}
+
+/*----------------------------------------------------------------------------------------------
+ Perform a single command. Specifically, read the arguments from the byte buffer and the
+ run the appropriate functions.
+
+ @param ptman - table manager, for generating new slots; or NULL
+ @param fConstraints - true if we are running constraints; false if we are running
+ rule actions
+ @param op - command operator
+ @param ppbArg - pointer to first argument
+ @param pfMustGet - state: getting input or processing it; when running constraints,
+ always false
+ @param pfInserting - true if current item is to be inserted, or was inserted
+ @param psstrmIn - input stream
+ @param psstrmOut - output stream
+ @param islot - the slot being processed relative to the beginning of the rule;
+ only relevant for constraint testing, must be 0 for rule actions
+ @param vnStack - the stack of values being manipulated
+ @param psmf - error code, done flag, or continue flag
+----------------------------------------------------------------------------------------------*/
+int GrPass::RunOneCommand(GrTableManager * ptman, bool fConstraints,
+ ActionCommand op, byte ** ppbArg, bool * pfMustGet, bool * pfInserting,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islot,
+ std::vector<int> & vnStack, StackMachineFlag * psmf)
+{
+ *psmf = ksmfContinue;
+
+ // General purpose variables:
+ int arg1, arg2, arg3, arg4;
+ int nSlotRef;
+ int nInputClass;
+ int nOutputClass;
+ int c;
+ int islotArg;
+ int nIndex;
+ int nGlyphAttr;
+ int nAttLevel;
+ int nFeat;
+ int nPState;
+ SlotAttrName slat;
+
+ int i;
+ std::vector<int> vnTmp;
+
+ byte * pbNext = *ppbArg;
+
+ int nRet = 0;
+
+ switch (op)
+ {
+ case kopNop:
+ break;
+
+ case kopPushByte:
+ arg1 = Int8(*pbNext++);
+ vnStack.push_back(arg1);
+ break;
+ case kopPushByteU:
+ arg1 = Uint8(*pbNext++);
+ vnStack.push_back(arg1);
+ break;
+ case kopPushShort:
+ arg1 = Int8(*pbNext++);
+ arg2 = Uint8(*pbNext++);
+ vnStack.push_back((arg1 << 8) + arg2);
+ break;
+ case kopPushShortU:
+ arg1 = Uint8(*pbNext++);
+ arg2 = Uint8(*pbNext++);
+ vnStack.push_back((arg1 << 8) + arg2);
+ break;
+ case kopPushLong:
+ arg1 = Int8(*pbNext++);
+ arg2 = Uint8(*pbNext++);
+ arg3 = Uint8(*pbNext++);
+ arg4 = Uint8(*pbNext++);
+ vnStack.push_back((arg1 << 24) + (arg2 << 16) + (arg3 << 8) + arg4);
+ break;
+
+ case kopNeg:
+ case kopTrunc8: case kopTrunc16:
+ case kopNot:
+ DoStackArithmetic1Arg(op, vnStack, psmf);
+ if (*psmf != ksmfContinue)
+ return 0;
+ break;
+
+ case kopAdd: case kopSub:
+ case kopMul: case kopDiv:
+ case kopMin: case kopMax:
+ case kopAnd: case kopOr:
+ case kopEqual: case kopNotEq:
+ case kopLess: case kopGtr:
+ case kopLessEq: case kopGtrEq:
+ DoStackArithmetic2Args(op, vnStack, psmf);
+ if (*psmf != ksmfContinue)
+ return 0;
+ break;
+
+ case kopCond:
+ DoConditional(vnStack, psmf);
+ if (*psmf != ksmfContinue)
+ return 0;
+ break;
+
+ case kopNext:
+ if (fConstraints)
+ {
+ gAssert(false);
+ }
+ else
+ {
+ gAssert(!*pfMustGet);
+ DoNext(ptman, 1, psstrmIn, psstrmOut);
+ *pfMustGet = true;
+ *pfInserting = false;
+ }
+ break;
+ case kopNextN:
+ c = Int8(*pbNext++);
+ if (fConstraints)
+ {
+ gAssert(false);
+ }
+ else
+ {
+ gAssert(false); // for now we don't allow anything other than moving one slot
+ gAssert(!*pfMustGet); // forward at a time
+ DoNext(ptman, c, psstrmIn, psstrmOut);
+ *pfMustGet = true;
+ }
+ break;
+ case kopPutGlyph8bitObs:
+ case kopPutGlyph:
+ if (op == kopPutGlyph8bitObs)
+ nOutputClass = Uint8(*pbNext++);
+ else
+ {
+ nOutputClass = (Uint8(*pbNext++) << 8);
+ nOutputClass += Uint8(*pbNext++);
+ }
+ if (fConstraints)
+ {
+ gAssert(false);
+ }
+ else
+ {
+ gAssert(*pfMustGet);
+ DoPutGlyph(ptman, *pfInserting, nOutputClass, psstrmIn, psstrmOut);
+ *pfMustGet = false;
+ }
+ break;
+ case kopPutCopy:
+ nSlotRef = Int8(*pbNext++);
+ if (fConstraints)
+ {
+ gAssert(false);
+ }
+ else
+ {
+ gAssert(*pfMustGet);
+ DoPutCopy(ptman, *pfInserting, nSlotRef, psstrmIn, psstrmOut);
+ *pfMustGet = false;
+ }
+ break;
+ case kopPutSubs8bitObs:
+ case kopPutSubs:
+ nSlotRef = Int8(*pbNext++);
+ if (op == kopPutSubs8bitObs)
+ {
+ nInputClass = Uint8(*pbNext++);
+ nOutputClass = Uint8(*pbNext++);
+ }
+ else
+ {
+ nInputClass = (Uint8(*pbNext++) << 8);
+ nInputClass += Uint8(*pbNext++);
+ nOutputClass = (Uint8(*pbNext++) << 8);
+ nOutputClass += Uint8(*pbNext++);
+ }
+ if (fConstraints)
+ {
+ gAssert(false);
+ }
+ else
+ {
+ gAssert(*pfMustGet);
+ DoPutSubs(ptman, *pfInserting, nSlotRef, nInputClass, nOutputClass,
+ psstrmIn, psstrmOut);
+ *pfMustGet = false;
+ }
+ break;
+ case kopCopyNext:
+ if (fConstraints)
+ {
+ gAssert(false);
+ }
+ else
+ {
+ gAssert(*pfMustGet);
+ gAssert(!*pfInserting); // 0 means copy this slot
+ DoPutCopy(ptman, *pfInserting, 0, psstrmIn, psstrmOut);
+ DoNext(ptman, 1, psstrmIn, psstrmOut);
+ // *pfMustGet still = true
+ }
+ break;
+ case kopInsert:
+ if (fConstraints)
+ {
+ gAssert(false);
+ }
+ else
+ {
+ gAssert(*pfMustGet);
+ *pfInserting = true;
+ // *pfMustGet still = true
+
+ if (ptman->LoggingTransduction())
+ m_pzpst->RecordInsertionAt(psstrmOut->WritePos());
+ }
+ break;
+ case kopDelete:
+ if (fConstraints)
+ {
+ gAssert(false);
+ }
+ else
+ {
+ gAssert(*pfMustGet);
+ DoDelete(ptman, psstrmIn, psstrmOut);
+ *pfMustGet = false;
+ }
+ break;
+ case kopAssoc:
+ c = Uint8(*pbNext++);
+ // std::vector<int> vnTmp;
+ for (i = 0; i < c; i++)
+ vnTmp.push_back(Int8(*pbNext++));
+ if (fConstraints)
+ {
+ gAssert(false);
+ }
+ else
+ {
+ gAssert(!*pfMustGet);
+ DoAssoc(c, vnTmp, *pfInserting, psstrmIn, psstrmOut);
+ }
+ break;
+ case kopCntxtItem:
+ islotArg = Int8(*pbNext++);
+ c = Uint8(*pbNext++);
+ if (fConstraints)
+ {
+ // Old approach:
+ // If this is NOT the relevant item, push TRUE, which causes the subsequent tests
+ // (which are eventually ORed with it) to become irrelevant.
+ //vnStack.Push((int)(islotArg != islot));
+
+ // If this is not the relevant item, skip the specified number of bytes.
+ if (islotArg != islot)
+ {
+ pbNext += c;
+ vnStack.push_back(1);
+ }
+ }
+ else
+ {
+ gAssert(false);
+ }
+ break;
+
+ case kopAttrSet:
+ case kopAttrAdd:
+ case kopAttrSub:
+ case kopAttrSetSlot:
+ slat = SlotAttrName(Uint8(*pbNext++)); // slot attribute ID
+ if (fConstraints)
+ {
+ gAssert(false);
+ }
+ else
+ {
+ gAssert(!*pfMustGet);
+ DoSetAttr(ptman, op, *pfInserting, slat, -1, vnStack, psstrmIn, psstrmOut);
+ if (*psmf != ksmfContinue)
+ return 0;
+ }
+ break;
+ case kopIAttrSet:
+ case kopIAttrAdd:
+ case kopIAttrSub:
+ case kopIAttrSetSlot:
+ slat = SlotAttrName(Uint8(*pbNext++)); // slot attribute ID
+ nIndex = Uint8(*pbNext++); // index; eg, global ID for component
+ if (fConstraints)
+ {
+ gAssert(false);
+ }
+ else
+ {
+ gAssert(!*pfMustGet);
+ DoSetAttr(ptman, op, *pfInserting, slat, nIndex, vnStack,
+ psstrmIn, psstrmOut);
+ if (*psmf != ksmfContinue)
+ return 0;
+ }
+ break;
+
+ case kopPushSlotAttr:
+ slat = SlotAttrName(Uint8(*pbNext++));
+ nSlotRef = Int8(*pbNext++);
+ if (fConstraints)
+ nSlotRef += islot + 1; // +1 to peek ahead to a slot we haven't "got" yet
+ DoPushSlotAttr(ptman, nSlotRef, *pfInserting, slat, -1, vnStack, psstrmIn, psstrmOut);
+ if (*psmf != ksmfContinue)
+ return 0;
+ break;
+ case kopPushISlotAttr:
+ slat = SlotAttrName(Uint8(*pbNext++));
+ nSlotRef = Int8(*pbNext++);
+ nIndex = Uint8(*pbNext++);
+ if (fConstraints)
+ nSlotRef += islot + 1; // +1 to peek ahead to a slot we haven't "got" yet
+ DoPushSlotAttr(ptman, nSlotRef, *pfInserting, slat, nIndex, vnStack, psstrmIn, psstrmOut);
+ if (*psmf != ksmfContinue)
+ return 0;
+ break;
+
+ case kopPushGlyphAttrObs:
+ case kopPushAttToGAttrObs:
+ case kopPushGlyphAttr:
+ case kopPushAttToGlyphAttr:
+ if (op == kopPushGlyphAttrObs || op == kopPushAttToGAttrObs)
+ nGlyphAttr = Uint8(*pbNext++);
+ else {
+ nGlyphAttr = (Uint8(*pbNext++) << 8);
+ nGlyphAttr += Uint8(*pbNext++);
+ }
+ nSlotRef = Int8(*pbNext++);
+ if (fConstraints)
+ nSlotRef += islot + 1; // +1 to peek ahead to a slot we haven't "got" yet
+ if (op == kopPushAttToGlyphAttr || op == kopPushAttToGAttrObs)
+ DoPushAttToGlyphAttr(ptman, nSlotRef, *pfInserting, nGlyphAttr,
+ vnStack, psstrmIn, psstrmOut);
+ else
+ DoPushGlyphAttr(ptman, nSlotRef, *pfInserting, nGlyphAttr, vnStack,
+ psstrmIn, psstrmOut);
+ if (*psmf != ksmfContinue)
+ return 0;
+ break;
+ case kopPushGlyphMetric:
+ case kopPushAttToGlyphMetric:
+ nGlyphAttr = Uint8(*pbNext++);
+ nSlotRef = Int8(*pbNext++);
+ nAttLevel = Int8(*pbNext++);
+ if (fConstraints)
+ nSlotRef += islot + 1; // +1 to peek ahead to a slot we haven't "got" yet
+ if (op == kopPushAttToGlyphMetric)
+ DoPushAttToGlyphMetric(ptman, nSlotRef, *pfInserting, nGlyphAttr, nAttLevel,
+ vnStack, psstrmIn, psstrmOut);
+ else
+ DoPushGlyphMetric(ptman, nSlotRef, *pfInserting, nGlyphAttr, nAttLevel,
+ vnStack, psstrmIn, psstrmOut);
+ if (*psmf != ksmfContinue)
+ return 0;
+ break;
+ case kopPushFeat:
+ nFeat = Uint8(*pbNext++);
+ nSlotRef = Int8(*pbNext++);
+ if (fConstraints)
+ nSlotRef += islot + 1; // +1 to peek ahead to a slot we haven't "got" yet
+// else
+// nSlotRef = 0;
+ DoPushFeatValue(ptman, nSlotRef, *pfInserting, nFeat, vnStack, psstrmIn, psstrmOut);
+ if (*psmf != ksmfContinue)
+ return 0;
+ break;
+ case kopPushProcState:
+ nPState = Uint8(*pbNext++);
+ gAssert(fConstraints);
+ DoPushProcState(ptman, nPState, vnStack);
+ break;
+ case kopPushVersion:
+ vnStack.push_back(kRuleVersion);
+ break;
+ case kopPopRet:
+ if ((*psmf = CheckStack(vnStack, 1)) != ksmfContinue)
+ return 0;
+ nRet = vnStack.back();
+ vnStack.pop_back();
+ if (vnStack.size() != 0)
+ {
+ gAssert(false);
+ *psmf = ksmfStackNotEmptied;
+ }
+ else
+ *psmf = ksmfDone;
+ break;
+ case kopRetZero:
+ nRet = 0;
+ if (vnStack.size() != 0)
+ {
+ gAssert(false);
+ *psmf = ksmfStackNotEmptied;
+ }
+ else
+ *psmf = ksmfDone;
+ break;
+ case kopRetTrue:
+ nRet = 1;
+ if (vnStack.size() != 0)
+ {
+ gAssert(false);
+ *psmf = ksmfStackNotEmptied;
+ }
+ else
+ *psmf = ksmfDone;
+ break;
+
+ default:
+ gAssert(false);
+ }
+
+ *ppbArg = pbNext;
+ return nRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Perform arithmetic functions that take two arguments.
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoStackArithmetic2Args(ActionCommand op, std::vector<int> & vnStack,
+ StackMachineFlag * psmf)
+{
+ if ((*psmf = CheckStack(vnStack, 2)) != ksmfContinue)
+ return;
+
+ int nArg2 = vnStack.back();
+ vnStack.pop_back();
+ int nArg1 = vnStack.back();
+ vnStack.pop_back();
+
+ int nResult;
+
+ switch (op)
+ {
+ case kopAdd: nResult = nArg1 + nArg2; break;
+ case kopSub: nResult = nArg1 - nArg2; break;
+ case kopMul: nResult = nArg1 * nArg2; break;
+ case kopDiv: nResult = nArg1 / nArg2; break;
+ case kopMin: nResult = min(nArg1, nArg2); break;
+ case kopMax: nResult = max(nArg1, nArg2); break;
+ case kopAnd: nResult = (nArg1 != 0 && nArg2 != 0)? 1: 0; break;
+ case kopOr: nResult = (nArg1 != 0 || nArg2 != 0)? 1: 0; break;
+ case kopEqual: nResult = (nArg1 == nArg2)? 1: 0; break;
+ case kopNotEq: nResult = (nArg1 != nArg2)? 1: 0; break;
+ case kopLess: nResult = (nArg1 < nArg2)? 1: 0; break;
+ case kopLessEq: nResult = (nArg1 <= nArg2)? 1: 0; break;
+ case kopGtr: nResult = (nArg1 > nArg2)? 1: 0; break;
+ case kopGtrEq: nResult = (nArg1 >= nArg2)? 1: 0; break;
+ default:
+ Assert(false);
+ }
+
+ vnStack.push_back(nResult);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Perform arithmetic functions that take one argument.
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoStackArithmetic1Arg(ActionCommand op, std::vector<int> & vnStack,
+ StackMachineFlag * psmf)
+{
+ if ((*psmf = CheckStack(vnStack, 1)) != ksmfContinue)
+ return;
+
+ int nArg = vnStack.back();
+ vnStack.pop_back();
+ int nResult;
+
+ switch (op)
+ {
+ case kopNeg: nResult = nArg * -1; break;
+ case kopTrunc8: nResult = nArg & 0xFF; break;
+ case kopTrunc16: nResult = nArg & 0xFFFF; break;
+ case kopNot: nResult = (nArg == 0)? 1: 0; break;
+ default:
+ Assert(false);
+ }
+
+ vnStack.push_back(nResult);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Perform the conditional statement.
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoConditional(std::vector<int> & vnStack, StackMachineFlag * psmf)
+{
+ if ((*psmf = CheckStack(vnStack, 3)) != ksmfContinue)
+ return;
+
+ int nArg3 = vnStack.back();
+ vnStack.pop_back();
+ int nArg2 = vnStack.back();
+ vnStack.pop_back();
+ int nArg1 = vnStack.back();
+ vnStack.pop_back();
+
+ if (nArg1 == 0)
+ vnStack.push_back(nArg3);
+ else
+ vnStack.push_back(nArg2);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Check to make sure the stack has the appropriate number of items on it; if not,
+ return a stack error flag.
+----------------------------------------------------------------------------------------------*/
+GrPass::StackMachineFlag GrPass::CheckStack(std::vector<int> & vnStack, int cn)
+{
+ if (signed(vnStack.size()) < cn)
+ return ksmfUnderflow;
+ else
+ return ksmfContinue;
+}
+
+/*----------------------------------------------------------------------------------------------
+ We are finished processing a slot; go on to the next slot, or possibly go backwards.
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoNext(GrTableManager * ptman,
+ int cslot, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ gAssert(cslot == 1); // for now anyway
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set the next glyph to be the given class. There should only be one member of the class,
+ but if there happens to be more than one, just use the first member.
+ All the slot attributes remain unchanged from the current input slot; associations are
+ neutralized.
+
+ @param ptman - table manager, for generating new slots
+ @param fInserting - true if this slot is being inserted, not copied
+ @param nReplacementClass - class from which to take replacement glyph (corresponding to
+ selector slot's glyph's index in selector class)
+ @param psstrmIn / Out - input/output streams
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoPutGlyph(GrTableManager * ptman, bool fInserting, int nReplacementClass,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ EngineState * pengst = ptman->State();
+
+ // If we are exactly at the segment boundary, pass the information on to the output stream.
+ // Note that inserted items always go outside the segment, if they are at the boundary
+ // (you DON'T want them between the segment boundary and the LB slot!).
+ bool fSetSegMin = psstrmIn->AtSegMin() && !fInserting;
+ bool fSetSegLim = psstrmIn->AtSegLim();
+
+ // Slot to copy features and text properties from:
+ GrSlotState * pslotNextInput;
+ if (psstrmIn->AtEndOfContext())
+ {
+ gAssert(fInserting);
+ pslotNextInput = psstrmIn->RuleInputSlot(0, psstrmOut);
+ }
+ else
+ pslotNextInput = (fInserting)? psstrmIn->Peek(): psstrmIn->NextGet();
+
+ gid16 nGlyphReplacement = ptman->GetClassGlyphIDAt(nReplacementClass, 0);
+
+ GrSlotState * pslotNew;
+ if (fInserting)
+ {
+ pengst->NewSlot(nGlyphReplacement, pslotNextInput, m_ipass, &pslotNew);
+ // leave associations empty; eventually they will be "neutralized"
+ }
+ else
+ {
+ pengst->NewSlotCopy(pslotNextInput, m_ipass, &pslotNew);
+ pslotNew->SetGlyphID(nGlyphReplacement);
+ ptman->SetSlotAttrsFromGlyphAttrs(pslotNew);
+ }
+
+ if (fSetSegMin)
+ psstrmOut->SetSegMinToWritePos(false);
+ if (fSetSegLim)
+ psstrmOut->SetSegLimToWritePos(false);
+ psstrmOut->NextPut(pslotNew);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Copy a glyph from the given slot in the input to the output. All the associations and slot
+ attributes are copied from the specified slot as well. Consume a slot from the input
+ (which may or may not be the slot we're copying).
+
+ @param ptman - table manager, for generating new slots
+ @param fInserting - true if this slot is being inserted, not copied
+ @param cslotCopyFrom - slot to copy from
+ @param psstrmIn / Out - input/output streams
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoPutCopy(GrTableManager * ptman, bool fInserting, int cslotCopyFrom,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ EngineState * pengst = ptman->State();
+
+ // If we are exactly at the segment boundary, pass the information on to the output stream.
+ // Note that inserted items always go outside the segment, if they are at the boundary.
+ bool fSetSegMin = psstrmIn->AtSegMin() && !fInserting;
+ bool fSetSegLim = psstrmIn->AtSegLim();
+
+ if (!fInserting)
+ {
+ gAssert(!psstrmIn->AtEndOfContext());
+ // Absorb next slot
+ psstrmIn->NextGet();
+ }
+
+ GrSlotState * pslotCopyFrom = psstrmIn->RuleInputSlot(cslotCopyFrom, psstrmOut);
+
+ GrSlotState * pslotNew;
+ pengst->NewSlotCopy(pslotCopyFrom, m_ipass, &pslotNew);
+
+ if (fSetSegMin)
+ psstrmOut->SetSegMinToWritePos(false);
+ if (fSetSegLim)
+ psstrmOut->SetSegLimToWritePos(false);
+ psstrmOut->NextPut(pslotNew);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Copy the current slot from the input to the output, substituting the corresponding glyph
+ in the output class. All the associations and slot attributes remain unchanged from the
+ current input slot.
+
+ @param ptman - table manager, for generating new slots
+ @param fInserting - true if this slot is being inserted, not copied
+ @param cslotSel - selector slot, relative to current slot
+ @param nSelectorClass - class of selector slot
+ @param nReplacementClass - class from which to take replacement glyph (corresponding to
+ selector slot's glyph's index in selector class)
+ @param psstrmIn / Out - input/output streams
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoPutSubs(GrTableManager * ptman, bool fInserting,
+ int cslotSel, int nSelClass, int nReplacementClass,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ bool fAtSegMin, fAtSegLim;
+ GrSlotState * pslotNextInput;
+ DoPutSubsInit(psstrmIn, psstrmOut, fInserting, &pslotNextInput, &fAtSegMin, &fAtSegLim);
+
+ GrSlotState * pslotInSelector = psstrmIn->RuleInputSlot(cslotSel, psstrmOut);
+
+ gid16 gidSelector = pslotInSelector->GlyphID();
+ int nSelIndex = ptman->GetIndexInGlyphClass(nSelClass, gidSelector);
+ gAssert(nSelIndex != -1);
+ gid16 gidReplacement = (nSelIndex == -1)?
+ gidSelector:
+ ptman->GetClassGlyphIDAt(nReplacementClass, nSelIndex);
+
+ DoPutSubsAux(ptman, fInserting, gidReplacement, psstrmIn, psstrmOut, pslotNextInput,
+ fAtSegMin, fAtSegLim);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Copy the current slot from the input to the output, substituting the corresponding glyph
+ in the output class based on 2 input classes. All the associations and slot attributes
+ remain unchanged from the current input slot.
+
+ @param ptman - table manager, for generating new slots
+ @param fInserting - true if this slot is being inserted, not copied
+ @param cslotSel - selector slot, relative to current slot
+ @param nSelectorClass - class of selector slot
+ @param nReplacementClass - class from which to take replacement glyph (corresponding to
+ selector slot's glyph's index in selector class)
+ @param psstrmIn / Out - input/output streams
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoPutSubs2(GrTableManager * ptman, bool fInserting,
+ int cslotSel1, int nSelClass1, int cslotSel2, int nSelClass2, int nReplacementClass,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ bool fAtSegMin, fAtSegLim;
+ GrSlotState * pslotNextInput;
+ DoPutSubsInit(psstrmIn, psstrmOut, fInserting, &pslotNextInput, &fAtSegMin, &fAtSegLim);
+
+ GrSlotState * pslotInSelector1 = psstrmIn->RuleInputSlot(cslotSel1, psstrmOut);
+ gid16 gidSelector1 = pslotInSelector1->GlyphID();
+ int nSelIndex1 = ptman->GetIndexInGlyphClass(nSelClass1, gidSelector1);
+ gAssert(nSelIndex1 != -1);
+ //size_t cClassLen1 = ptman->NumberOfGlyphsInClass(nSelClass1);
+
+ GrSlotState * pslotInSelector2 = psstrmIn->RuleInputSlot(cslotSel2, psstrmOut);
+ gid16 gidSelector2 = pslotInSelector2->GlyphID();
+ int nSelIndex2 = ptman->GetIndexInGlyphClass(nSelClass2, gidSelector2);
+ gAssert(nSelIndex2 != -1);
+ size_t cClassLen2 = ptman->NumberOfGlyphsInClass(nSelClass2);
+
+ int nSelIndex = (nSelIndex1 == -1 || nSelIndex2 == -1) ?
+ -1 :
+ (nSelIndex1 * static_cast<int>(cClassLen2)) + nSelIndex2;
+
+ gid16 gidReplacement = (nSelIndex == -1)?
+ gidSelector1:
+ ptman->GetClassGlyphIDAt(nReplacementClass, nSelIndex);
+
+ DoPutSubsAux(ptman, fInserting, gidReplacement, psstrmIn, psstrmOut, pslotNextInput,
+ fAtSegMin, fAtSegLim);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Copy the current slot from the input to the output, substituting the corresponding glyph
+ in the output class based on 2 input classes. All the associations and slot attributes
+ remain unchanged from the current input slot.
+
+ @param ptman - table manager, for generating new slots
+ @param fInserting - true if this slot is being inserted, not copied
+ @param cslotSel - selector slot, relative to current slot
+ @param nSelectorClass - class of selector slot
+ @param nReplacementClass - class from which to take replacement glyph (corresponding to
+ selector slot's glyph's index in selector class)
+ @param psstrmIn / Out - input/output streams
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoPutSubs3(GrTableManager * ptman, bool fInserting,
+ int cslotSel1, int nSelClass1, int cslotSel2, int nSelClass2, int cslotSel3, int nSelClass3,
+ int nReplacementClass,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ bool fAtSegMin, fAtSegLim;
+ GrSlotState * pslotNextInput;
+ DoPutSubsInit(psstrmIn, psstrmOut, fInserting, &pslotNextInput, &fAtSegMin, &fAtSegLim);
+
+ GrSlotState * pslotInSelector1 = psstrmIn->RuleInputSlot(cslotSel1, psstrmOut);
+ gid16 gidSelector1 = pslotInSelector1->GlyphID();
+ int nSelIndex1 = ptman->GetIndexInGlyphClass(nSelClass1, gidSelector1);
+ gAssert(nSelIndex1 != -1);
+ //size_t cClassLen1 = ptman->NumberOfGlyphsInClass(nSelClass1);
+
+ GrSlotState * pslotInSelector2 = psstrmIn->RuleInputSlot(cslotSel2, psstrmOut);
+ gid16 gidSelector2 = pslotInSelector2->GlyphID();
+ int nSelIndex2 = ptman->GetIndexInGlyphClass(nSelClass2, gidSelector2);
+ gAssert(nSelIndex2 != -1);
+ size_t cClassLen2 = ptman->NumberOfGlyphsInClass(nSelClass2);
+
+// GrSlotState * pslotInSelector3 = psstrmIn->RuleInputSlot(cslotSel3, psstrmOut);
+// gid16 gidSelector3 = pslotInSelector3->GlyphID();
+ int nSelIndex3 = ptman->GetIndexInGlyphClass(nSelClass3, gidSelector2);
+ gAssert(nSelIndex3 != -1);
+ size_t cClassLen3 = ptman->NumberOfGlyphsInClass(nSelClass3);
+
+ int nSelIndex = (nSelIndex1 == -1 || nSelIndex2 == -1 || nSelIndex3 == -1) ?
+ -1 :
+ (((nSelIndex1 * static_cast<int>(cClassLen2)) + nSelIndex2) * static_cast<int>(cClassLen3)) + nSelIndex3;
+
+ gid16 gidReplacement = (nSelIndex == -1)?
+ gidSelector1:
+ ptman->GetClassGlyphIDAt(nReplacementClass, nSelIndex);
+
+ DoPutSubsAux(ptman, fInserting, gidReplacement, psstrmIn, psstrmOut, pslotNextInput,
+ fAtSegMin, fAtSegLim);
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Initial common part of all the DoPutSubs... methods.
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoPutSubsInit(GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, bool fInserting,
+ GrSlotState ** ppslotNextInput, bool * pfAtSegMin, bool * pfAtSegLim)
+{
+ // Do this before reading from stream.
+ *pfAtSegMin = psstrmIn->AtSegMin();
+ *pfAtSegLim = psstrmIn->AtSegLim();
+
+ // Slot to copy features and text properties from:
+ if (psstrmIn->AtEndOfContext())
+ {
+ gAssert(fInserting);
+ *ppslotNextInput = psstrmIn->RuleInputSlot(0, psstrmOut);
+ }
+ else
+ *ppslotNextInput = (fInserting)? psstrmIn->Peek(): psstrmIn->NextGet();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Common part of all the DoPutSubs... methods.
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoPutSubsAux(GrTableManager * ptman, bool fInserting, gid16 nGlyphReplacement,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, GrSlotState * pslotNextInput,
+ bool fAtSegMin, bool fAtSegLim)
+{
+ EngineState * pengst = ptman->State();
+
+ // If we are exactly at the segment boundary, pass the information on to the output stream.
+ // Note that inserted items always go outside the segment, if they are at the boundary.
+ bool fSetSegMin = fAtSegMin && !fInserting;
+ bool fSetSegLim = fAtSegLim;
+
+ GrSlotState * pslotNew;
+ if (fInserting)
+ {
+ pengst->NewSlot(nGlyphReplacement, pslotNextInput, m_ipass, &pslotNew);
+ // leave associations empty; eventually they will be "neutralized"
+ }
+ else
+ {
+ pengst->NewSlotCopy(pslotNextInput, m_ipass, &pslotNew);
+ pslotNew->SetGlyphID(nGlyphReplacement);
+ ptman->SetSlotAttrsFromGlyphAttrs(pslotNew);
+ }
+
+ if (fSetSegMin)
+ psstrmOut->SetSegMinToWritePos(false);
+ if (fSetSegLim)
+ psstrmOut->SetSegLimToWritePos(false);
+ psstrmOut->NextPut(pslotNew);
+}
+
+/*----------------------------------------------------------------------------------------------
+ A slot has just been inserted. Clear all the associations; eventually (unless we go on
+ to set the associations explicitly) we will set its before-assoc to the slot after it
+ and its after-assoc to the slot before it. This makes it basically unselectable.
+ OBSOLETE - handled by slot initialization code
+----------------------------------------------------------------------------------------------*/
+void GrPass::SetNeutralAssocs(GrSlotState * pslotNew, GrSlotStream * psstrmIn)
+{
+ pslotNew->ClearAssocs();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Delete the next slot in the input.
+
+ @param psstrmIn - input stream
+ @param psstrmOut - output stream
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoDelete(GrTableManager * ptman, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ if (psstrmIn->AtSegMin())
+ psstrmOut->SetSegMinToWritePos();
+ if (psstrmIn->AtSegLim())
+ psstrmOut->SetSegLimToWritePos();
+
+ GrSlotState * pslot = psstrmIn->NextGet();
+ pslot->MarkDeleted();
+
+ if (ptman->LoggingTransduction())
+ m_pzpst->RecordDeletionBefore(psstrmOut->WritePos());
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set the associations for the current slot. Any previous associations will be overwritten.
+
+ @param cn - number of associations
+ @param vnAssoc - list of associations
+ @param fInserting - whether current slot was inserted
+ @param psstrmIn / Out - input/output streams
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoAssoc(int cnAssocs, std::vector<int> & vnAssocs, bool fInserting,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ gAssert((unsigned)cnAssocs == vnAssocs.size());
+
+ // Sort the list of associations. It's okay to use a simple bubble sort
+ // since we expect the list to be very short. Ideally we should remove duplicates
+ // too but I don't think duplicates actually hurt anything.
+ for (int i1 = 0; i1 < cnAssocs - 1; i1++)
+ {
+ for (int i2 = i1 + 1; i2 < cnAssocs; i2++)
+ {
+ if (vnAssocs[i2] < vnAssocs[i1])
+ {
+ int nTmp = vnAssocs[i2];
+ vnAssocs[i2] = vnAssocs[i1];
+ vnAssocs[i1] = nTmp;
+ }
+ }
+ }
+
+ std::vector<GrSlotState *> vpslotAssocs;
+ vpslotAssocs.resize(cnAssocs);
+ for (int i = 0; i < cnAssocs; i++)
+ vpslotAssocs[i] = psstrmIn->RuleInputSlot(vnAssocs[i], psstrmOut);
+
+ GrSlotState * pslot = psstrmOut->RuleOutputSlot();
+ pslot->Associate(vpslotAssocs);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set a slot attribute for the current slot; the value is on the stack.
+
+ @param op - command
+ @param fInserting - whether current slot was inserted
+ @param slat - slot attribute to set
+ @param slati - slot attribute index, or -1 for non-indexed attribute
+ @param vnStack - stack to read value from
+ @param psstrmIn / Out - input/output streams
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoSetAttr(GrTableManager * ptman, ActionCommand op, bool fInserting,
+ SlotAttrName slat, int slati, std::vector<int> & vnStack,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ int nVal = vnStack.back();
+ vnStack.pop_back();
+
+ if (slat == kslatUserDefnV1)
+ slat = kslatUserDefn;
+
+ if (slati != -1 && slat != kslatCompRef && slat != kslatUserDefn)
+ {
+ // Invalid slot attribute index.
+ gAssert(false);
+ slati = -1;
+ }
+
+ if (slati == -1 && (slat == kslatCompRef || slat == kslatUserDefn))
+ {
+ // Missing slot attribute index.
+ gAssert(false);
+ slati = 0;
+ }
+
+ if (slat == kslatPosX || slat == kslatPosY)
+ {
+ // Doesn't make sense to set the pos attribute.
+ gAssert(false);
+ return;
+ }
+
+ GrSlotState * pslotIn = psstrmIn->RuleInputSlot(0, psstrmOut);
+
+ GrSlotState * pslotComp;
+
+ int nOldVal;
+
+ if (op == kopAttrAdd || op == kopAttrSub || op == kopIAttrAdd || op == kopIAttrSub)
+ {
+ // Incrementing or decrementing.
+
+ gAssert(!fInserting);
+
+ switch (slat)
+ {
+ case kslatAdvX: nOldVal = pslotIn->AdvanceX(ptman); break;
+ case kslatAdvY: nOldVal = pslotIn->AdvanceY(ptman); break;
+ case kslatShiftX: nOldVal = pslotIn->ShiftX(); break;
+ case kslatShiftY: nOldVal = pslotIn->ShiftY(); break;
+
+ case kslatAttAtX: nOldVal = pslotIn->AttachAtX(ptman, psstrmIn); break;
+ case kslatAttAtY: nOldVal = pslotIn->AttachAtY(); break;
+ case kslatAttAtXoff: nOldVal = pslotIn->AttachAtXOffset(); break;
+ case kslatAttAtYoff: nOldVal = pslotIn->AttachAtYOffset(); break;
+
+ case kslatAttWithX: nOldVal = pslotIn->AttachWithX(ptman, psstrmIn); break;
+ case kslatAttWithY: nOldVal = pslotIn->AttachWithY(); break;
+ case kslatAttWithXoff: nOldVal = pslotIn->AttachWithXOffset(); break;
+ case kslatAttWithYoff: nOldVal = pslotIn->AttachWithYOffset(); break;
+
+ case kslatUserDefn: nOldVal = pslotIn->UserDefn(slati); break;
+
+ case kslatMeasureSol: nOldVal = pslotIn->MeasureSol(); break;
+ case kslatMeasureEol: nOldVal = pslotIn->MeasureEol(); break;
+
+ case kslatJStretch: nOldVal = pslotIn->JStretch(); break;
+ case kslatJShrink: nOldVal = pslotIn->JShrink(); break;
+ case kslatJStep: nOldVal = pslotIn->JStep(); break;
+ case kslatJWeight: nOldVal = pslotIn->JWeight(); break;
+ case kslatJWidth: nOldVal = pslotIn->JWidth(); break;
+
+ // These are kind of odd, but maybe.
+ case kslatAttLevel: nOldVal = pslotIn->AttachLevel(); break;
+ case kslatBreak: nOldVal = pslotIn->BreakWeight(); break;
+ case kslatDir: nOldVal = pslotIn->Directionality(); break;
+
+ default:
+ // Kind of attribute that it makes no sense to increment.
+ gAssert(false);
+ return;
+ }
+
+ if (op == kopAttrAdd || op == kopIAttrAdd)
+ nVal = nOldVal + nVal;
+ else
+ {
+ gAssert(op == kopAttrSub || op == kopIAttrSub);
+ nVal = nOldVal - nVal;
+ }
+ }
+
+ GrSlotState * pslotOut = psstrmOut->RuleOutputSlot();
+
+ if (pslotOut->IsLineBreak(ptman->LBGlyphID()))
+ {
+ switch (slat)
+ {
+ case kslatAdvX:
+ case kslatAdvY:
+ case kslatShiftX:
+ case kslatShiftY:
+
+ case kslatAttTo:
+ case kslatAttLevel:
+ case kslatAttAtX:
+ case kslatAttAtY:
+ case kslatAttAtGpt:
+ case kslatAttAtXoff:
+ case kslatAttAtYoff:
+ case kslatAttWithX:
+ case kslatAttWithY:
+ case kslatAttWithGpt:
+ case kslatAttWithXoff:
+ case kslatAttWithYoff:
+
+ case kslatMeasureSol:
+ case kslatMeasureEol:
+
+ case kslatJStretch:
+ case kslatJShrink:
+ case kslatJStep:
+ case kslatJWeight:
+ case kslatJWidth:
+ slat = kslatNoEffect;
+ break;
+ default:
+ ; // okay, do nothing
+ }
+ }
+
+ nVal = GrGlyphSubTable::ConvertValueForVersion(nVal, slat, -1, m_fxdVersion);
+
+ switch (slat)
+ {
+ case kslatAdvX: pslotOut->SetAdvanceX(nVal); break;
+ case kslatAdvY: pslotOut->SetAdvanceY(nVal); break;
+ case kslatShiftX: pslotOut->SetShiftX(nVal); break;
+ case kslatShiftY: pslotOut->SetShiftY(nVal); break;
+
+ case kslatAttTo: pslotOut->SetAttachTo(nVal); break;
+ case kslatAttLevel: pslotOut->SetAttachLevel(nVal); break;
+ case kslatAttAtX: pslotOut->SetAttachAtX(nVal); break;
+ case kslatAttAtY: pslotOut->SetAttachAtY(nVal); break;
+ case kslatAttAtGpt: pslotOut->SetAttachAtGpoint(nVal); break;
+ case kslatAttAtXoff: pslotOut->SetAttachAtXOffset(nVal); break;
+ case kslatAttAtYoff: pslotOut->SetAttachAtYOffset(nVal); break;
+ case kslatAttWithX: pslotOut->SetAttachWithX(nVal); break;
+ case kslatAttWithY: pslotOut->SetAttachWithY(nVal); break;
+ case kslatAttWithGpt: pslotOut->SetAttachWithGpoint(nVal); break;
+ case kslatAttWithXoff: pslotOut->SetAttachWithXOffset(nVal); break;
+ case kslatAttWithYoff: pslotOut->SetAttachWithYOffset(nVal); break;
+
+ case kslatUserDefn: pslotOut->SetUserDefn(slati, nVal); break;
+
+ case kslatCompRef:
+ gAssert(nVal - 1 >= psstrmIn->RuleStartReadPos() - psstrmIn->ReadPosForNextGet());
+ pslotComp = psstrmIn->RuleInputSlot(nVal, psstrmOut);
+ pslotOut->SetCompRefSlot(ptman, slati, pslotComp);
+ break;
+
+ case kslatMeasureSol: pslotOut->SetMeasureSol(nVal); break;
+ case kslatMeasureEol: pslotOut->SetMeasureEol(nVal); break;
+
+ case kslatJStretch: pslotOut->SetJStretch(nVal); break;
+ case kslatJShrink: pslotOut->SetJShrink(nVal); break;
+ case kslatJStep: pslotOut->SetJStep(nVal); break;
+ case kslatJWeight: pslotOut->SetJWeight(nVal); break;
+ case kslatJWidth: pslotOut->SetJWidth(nVal); break;
+
+ case kslatBreak: pslotOut->SetBreakWeight(nVal); break;
+ case kslatDir: pslotOut->SetDirectionality(DirCode(nVal)); break;
+ case kslatInsert: pslotOut->SetInsertBefore(bool(nVal)); break;
+
+ case kslatNoEffect:
+ // Do nothing.
+ break;
+
+ default:
+ // Kind of attribute that it makes no sense to set.
+ gAssert(false);
+ return;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Push value of a slot attribute onto the stack.
+
+ @param nSlotRef - slot whose attribute we are interested in
+ @param fInserting - whether current slot was inserted
+ @param slat - slot attribute to get
+ @param slati - slot attribute index, or -1 for non-indexed attribute
+ @param vnStack - stack to push onto
+ @param psstrmIn - input stream
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoPushSlotAttr(GrTableManager * ptman,
+ int nSlotRef, bool fInserting,
+ SlotAttrName slat, int slati, std::vector<int> & vnStack,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ GrSlotState * pslot = psstrmIn->RuleInputSlot(nSlotRef, psstrmOut, true);
+ if (pslot == NULL)
+ {
+ // Non-existent pre-context item.
+ vnStack.push_back(0);
+ return;
+ }
+
+ int nVal;
+ int xyBogus;
+
+ if (slat == kslatUserDefnV1)
+ slat = kslatUserDefn;
+
+ if (slati != -1 && slat != kslatCompRef && slat != kslatUserDefn)
+ {
+ // Invalid slot attribute index.
+ gAssert(false);
+ slati = -1;
+ }
+
+ if (slati == -1 && (slat == kslatCompRef || slat == kslatUserDefn))
+ {
+ // Missing slot attribute index.
+ gAssert(false);
+ slati = 0;
+ }
+
+ switch (slat)
+ {
+ case kslatAdvX: nVal = pslot->AdvanceX(ptman); break;
+ case kslatAdvY: nVal = pslot->AdvanceY(ptman); break;
+ case kslatShiftX: nVal = pslot->ShiftX(); break;
+ case kslatShiftY: nVal = pslot->ShiftY(); break;
+
+ case kslatPosX: pslot->Position(ptman, psstrmIn, &nVal, &xyBogus); break;
+ case kslatPosY: pslot->Position(ptman, psstrmIn, &xyBogus, &nVal); break;
+
+ case kslatAttTo: nVal = pslot->AttachTo(); break;
+ case kslatAttLevel: nVal = pslot->AttachLevel(); break;
+ case kslatAttAtX: nVal = pslot->AttachAtX(ptman, psstrmIn); break;
+ case kslatAttAtY: nVal = pslot->AttachAtY(); break;
+ case kslatAttAtGpt: nVal = pslot->AttachAtGpoint(); break;
+ case kslatAttAtXoff: nVal = pslot->AttachAtXOffset(); break;
+ case kslatAttAtYoff: nVal = pslot->AttachAtYOffset(); break;
+ case kslatAttWithX: nVal = pslot->AttachWithX(ptman, psstrmIn); break;
+ case kslatAttWithY: nVal = pslot->AttachWithY(); break;
+ case kslatAttWithGpt: nVal = pslot->AttachWithGpoint(); break;
+ case kslatAttWithXoff: nVal = pslot->AttachWithXOffset(); break;
+ case kslatAttWithYoff: nVal = pslot->AttachWithYOffset(); break;
+
+ case kslatMeasureSol: nVal = pslot->MeasureSol(); break;
+ case kslatMeasureEol: nVal = pslot->MeasureEol(); break;
+
+ case kslatJStretch: nVal = pslot->JStretch(); break;
+ case kslatJShrink: nVal = pslot->JShrink(); break;
+ case kslatJStep: nVal = pslot->JStep(); break;
+ case kslatJWeight: nVal = pslot->JWeight(); break;
+ case kslatJWidth: nVal = pslot->JWidth(); break;
+
+ case kslatBreak: nVal = pslot->BreakWeight(); break;
+ case kslatDir: nVal = pslot->Directionality(); break;
+ case kslatInsert: nVal = pslot->InsertBefore(); break;
+
+ case kslatUserDefn: nVal = pslot->UserDefn(slati); break;
+
+ // Currently no way to look up component.X.ref.
+
+ default:
+ // Invalid attribute.
+ gAssert(false);
+ nVal = 0;
+ }
+
+ vnStack.push_back(nVal);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Push value of a glyph attribute onto the stack.
+
+ @param nSlotRef - slot whose attribute we are interested in
+ @param fInserting - whether current slot was inserted
+ @param nGlyphAttr - glyph attribute to get
+ @param vnStack - stack to push onto
+ @param psstrmIn - input stream
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoPushGlyphAttr(GrTableManager * ptman, int nSlotRef, bool fInserting,
+ int nGlyphAttr,
+ std::vector<int> & vnStack, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ GrSlotState * pslot = psstrmIn->RuleInputSlot(nSlotRef, psstrmOut, true);
+ if (pslot == NULL)
+ {
+ // Non-existent pre-context item.
+ vnStack.push_back(0);
+ return;
+ }
+ int nVal = pslot->GlyphAttrValueEmUnits(ptman, nGlyphAttr);
+ vnStack.push_back(nVal);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Push value of a glyph attribute onto the stack. The slot of interest is the slot to
+ which the current slot is attached.
+
+ @param nSlotRef - leaf slot
+ @param fInserting - whether current slot was inserted
+ @param nGlyphAttr - glyph attribute to get
+ @param vnStack - stack to push onto
+ @param psstrmIn - input stream
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoPushAttToGlyphAttr(GrTableManager * ptman, int nSlotRef, bool fInserting,
+ int nGlyphAttr, std::vector<int> & vnStack,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ // Note that it is the slot in the output stream that has
+ // the relevant attach.to attribute set.
+ GrSlotState * pslotLeaf = psstrmOut->RuleOutputSlot(0);
+ int srAttTo = pslotLeaf->AttachTo();
+ if (srAttTo == 0)
+ {
+ gAssert(false);
+ vnStack.push_back(0);
+ return;
+ }
+
+ GrSlotState * pslotRoot = psstrmIn->RuleInputSlot(nSlotRef + srAttTo, psstrmOut);
+ int nVal = pslotRoot->GlyphAttrValueEmUnits(ptman, nGlyphAttr);
+ vnStack.push_back(nVal);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Push value of a glyph metric onto the stack.
+
+ @param nSlotRef - slot whose attribute we are interested in
+ @param fInserting - whether current slot was inserted
+ @param nGlyphAttr - glyph attribute to get
+ @param nAttLevel - for accessing composite metrics
+ @param vnStack - stack to push onto
+ @param psstrmIn - input stream
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoPushGlyphMetric(GrTableManager * ptman, int nSlotRef, bool fInserting,
+ int nGlyphAttr, int nAttLevel,
+ std::vector<int> & vnStack, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ GrSlotState * pslot = psstrmIn->RuleInputSlot(nSlotRef, psstrmOut, true);
+ if (pslot == NULL)
+ {
+ // Non-existent pre-context item.
+ vnStack.push_back(0);
+ return;
+ }
+
+ DoPushGlyphMetricAux(ptman, pslot, nGlyphAttr, nAttLevel, vnStack, psstrmIn);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Push value of a glyph metric onto the stack. The slot of interest is the slot to
+ which the current slot is attached.
+
+ @param nSlotRef - slot whose attribute we are interested in
+ @param fInserting - whether current slot was inserted
+ @param nGlyphAttr - glyph attribute to get
+ @param nAttLevel - for accessing composite metrics
+ @param vnStack - stack to push onto
+ @param psstrmIn - input stream
+ @param psstrmOut - output stream
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoPushAttToGlyphMetric(GrTableManager * ptman, int nSlotRef, bool fInserting,
+ int nGlyphAttr, int nAttLevel,
+ std::vector<int> & vnStack,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ // Note that it is the slot in the output stream that has
+ // the relevant attach.to attribute set.
+ GrSlotState * pslotLeaf = psstrmOut->RuleOutputSlot(0);
+ int srAttTo = pslotLeaf->AttachTo();
+ if (srAttTo == 0)
+ {
+ gAssert(false);
+ vnStack.push_back(0);
+ return;
+ }
+
+ GrSlotState * pslot = psstrmIn->RuleInputSlot(nSlotRef + srAttTo, psstrmOut);
+
+ DoPushGlyphMetricAux(ptman, pslot, nGlyphAttr, nAttLevel, vnStack, psstrmIn);
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+void GrPass::DoPushGlyphMetricAux(GrTableManager * ptman,
+ GrSlotState * pslot, int nGlyphAttr, int nAttLevel,
+ std::vector<int> & vnStack, GrSlotStream * psstrmIn)
+{
+ int mVal;
+ GlyphMetric gmet = GlyphMetric(nGlyphAttr);
+ if (nAttLevel == 0 || gmet == kgmetAscent || gmet == kgmetDescent)
+ {
+ mVal = pslot->GlyphMetricEmUnits(ptman, nGlyphAttr);
+ }
+ else
+ {
+ pslot->CalcCompositeMetrics(ptman, psstrmIn, nAttLevel, true);
+
+ float xy;
+ switch (gmet)
+ {
+ case kgmetLsb: xy = pslot->ClusterLsb(psstrmIn); break;
+ case kgmetRsb: xy = pslot->ClusterRsb(psstrmIn); break;
+ case kgmetBbTop: xy = pslot->ClusterBbTop(psstrmIn); break;
+ case kgmetBbBottom: xy = pslot->ClusterBbBottom(psstrmIn); break;
+ case kgmetBbLeft: xy = pslot->ClusterBbLeft(psstrmIn); break;
+ case kgmetBbRight: xy = pslot->ClusterBbRight(psstrmIn); break;
+ case kgmetBbHeight: xy = pslot->ClusterBbHeight(psstrmIn); break;
+ case kgmetBbWidth: xy = pslot->ClusterBbWidth(psstrmIn); break;
+// case kgmetAdvHeight: xy = pslot->ClusterAdvHeight(psstrmIn); break;
+ case kgmetAdvWidth: xy = pslot->ClusterAdvWidth(psstrmIn); break;
+ default:
+ gAssert(false);
+ xy = 0;
+ }
+ mVal = ptman->LogToEmUnits(xy);
+ }
+
+ vnStack.push_back(mVal);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Push a feature value onto the stack. For rule actions, the slot of interest is the
+ current slot.
+
+ @param nSlotRef - slot being examined
+ @param fInserting - whether current slot was inserted
+ @param nFeat - feature of interest
+ @param vnStack - stack to push onto
+ @param psstrmIn - input stream
+ @param psstrmOut - output stream
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoPushFeatValue(GrTableManager * ptman, int nSlotRef, bool fInserting,
+ int nFeat, std::vector<int> & vnStack, GrSlotStream * psstrmIn, GrSlotStream * psstrmOut)
+{
+ gAssert(!fInserting);
+
+ GrSlotState * pslot = psstrmIn->RuleInputSlot(nSlotRef, psstrmOut, true);
+ if (pslot == NULL)
+ {
+ // Non-existent pre-context item.
+ vnStack.push_back(0);
+ return;
+ }
+
+ int nVal = pslot->FeatureValue(nFeat);
+ vnStack.push_back(nVal);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Push a processing-state value onto the stack.
+
+ @param nFeat - feature of interest
+ @param vnStack - stack to push onto
+----------------------------------------------------------------------------------------------*/
+void GrPass::DoPushProcState(GrTableManager * ptman, int nPState, std::vector<int> & vnStack)
+{
+ int nValue;
+ if (nPState == kpstatJustifyMode)
+ {
+ // Convert from internal modes to user modes.
+ int jmodi = ptman->InternalJustificationMode();
+ switch (jmodi)
+ {
+ case kjmodiNormal:
+ case kjmodiCanShrink:
+ nValue = kjmoduNormal;
+ break;
+ case kjmodiMeasure:
+ nValue = kjmoduMeasure;
+ break;
+ case kjmodiJustify:
+ nValue = kjmoduJustify;
+ break;
+ default:
+ gAssert(false);
+ nValue = kjmoduNormal;
+ }
+ }
+ else if (nPState == kpstatJustifyLevel)
+ nValue = 1; // TODO: get justify level from ptman
+ vnStack.push_back(nValue);
+}
+
+} // namespace gr
diff --git a/Build/source/libs/graphite/src/segment/GrPseudoMap.h b/Build/source/libs/graphite/src/segment/GrPseudoMap.h
new file mode 100644
index 00000000000..c6fec210808
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrPseudoMap.h
@@ -0,0 +1,48 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrPseudoMap.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ The GrPseudoMap class.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GR_PSEUDOMAP_INCLUDED
+#define GR_PSEUDOMAP_INCLUDED
+
+//:End Ignore
+
+namespace gr
+{
+
+/*----------------------------------------------------------------------------------------------
+ A mapping between a Unicode value and a pseudo-glyph.
+
+ Hungarian: psd
+----------------------------------------------------------------------------------------------*/
+
+class GrPseudoMap
+{
+public:
+ unsigned int Unicode() { return m_nUnicode; }
+ gid16 PseudoGlyph() { return m_chwPseudo; }
+
+ void SetUnicode(int n) { m_nUnicode = n; }
+ void SetPseudoGlyph(gid16 chw) { m_chwPseudo = chw; }
+
+protected:
+ // Instance variables:
+ unsigned int m_nUnicode;
+ gid16 m_chwPseudo;
+};
+
+} // namespace gr
+
+#endif // !GR_PSEUDOMAP_INCLUDED
diff --git a/Build/source/libs/graphite/src/segment/GrSlotState.cpp b/Build/source/libs/graphite/src/segment/GrSlotState.cpp
new file mode 100644
index 00000000000..f2d61e45eed
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrSlotState.cpp
@@ -0,0 +1,1481 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrSlotState.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ GrSlotState class implementation.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Initialize slots.
+----------------------------------------------------------------------------------------------*/
+// standard for pass 0 slots
+void GrSlotState::Initialize(gid16 chw, GrEngine * pgreng,
+ GrFeatureValues fval, int ipass, int ichwSegOffset, int nUnicode)
+{
+ Assert(ipass == 0);
+ m_chwGlyphID = chw;
+ m_chwActual = kInvalidGlyph;
+ m_xysGlyphWidth = -1;
+ m_bStyleIndex = byte(fval.m_nStyleIndex);
+ u_intslot nullSlot;
+ nullSlot.pslot = NULL;
+ std::fill_n(PUserDefnBuf(), m_cnUserDefn, nullSlot);
+ std::fill_n(PCompRefBuf(), m_cnCompPerLig, nullSlot);
+ std::fill_n(PSlatiBuf(), m_cnCompPerLig, nullSlot);
+ u_intslot * pFeatBuf = PFeatureBuf();
+ for (size_t i = 0; i < m_cnFeat; i++)
+ pFeatBuf[i].nValue = fval.m_rgnFValues[i];
+ m_ipassFsmCol = -1;
+ m_colFsm = -1;
+
+ m_ipassModified = ipass;
+ m_ichwSegOffset = ichwSegOffset;
+ m_nUnicode = nUnicode;
+ m_vpslotAssoc.clear();
+ pgreng->InitSlot(this, nUnicode);
+
+ switch (nUnicode)
+ {
+ case knLRM: m_spsl = kspslLRM; break;
+ case knRLM: m_spsl = kspslRLM; break;
+ case knLRO: m_spsl = kspslLRO; break;
+ case knRLO: m_spsl = kspslRLO; break;
+ case knLRE: m_spsl = kspslLRE; break;
+ case knRLE: m_spsl = kspslRLE; break;
+ case knPDF: m_spsl = kspslPDF; break;
+ default:
+ Assert(m_spsl == kspslNone);
+ m_spsl = kspslNone;
+ break;
+ }
+}
+
+// line-break slots
+void GrSlotState::Initialize(gid16 chw, GrEngine * pgreng,
+ GrSlotState * pslotFeat, int ipass, int ichwSegOffset)
+{
+ m_chwGlyphID = chw;
+ m_chwActual = kInvalidGlyph;
+ m_xysGlyphWidth = -1;
+ u_intslot nullSlot;
+ nullSlot.pslot = NULL;
+ std::fill_n(PUserDefnBuf(), m_cnUserDefn, nullSlot);
+ std::fill_n(PCompRefBuf(), m_cnCompPerLig, nullSlot);
+ std::fill_n(PSlatiBuf(), m_cnCompPerLig, nullSlot);
+ CopyFeaturesFrom(pslotFeat);
+ m_ipassModified = ipass;
+ m_ichwSegOffset = ichwSegOffset;
+ m_nUnicode = -1;
+ m_vpslotAssoc.clear();
+ pgreng->InitSlot(this);
+ // Caller is responsible for setting m_spsl.
+ m_ipassFsmCol = -1;
+ m_colFsm = -1;
+}
+
+// for inserting new slots after pass 0 (under-pos and unicode are irrelevant)
+void GrSlotState::Initialize(gid16 chw, GrEngine * pgreng,
+ GrSlotState * pslotFeat, int ipass)
+{
+ m_chwGlyphID = chw;
+ m_chwActual = kInvalidGlyph;
+ m_xysGlyphWidth = -1;
+ u_intslot nullSlot;
+ nullSlot.pslot = NULL;
+ std::fill_n(PUserDefnBuf(), m_cnUserDefn, nullSlot);
+ std::fill_n(PCompRefBuf(), m_cnCompPerLig, nullSlot);
+ std::fill_n(PSlatiBuf(), m_cnCompPerLig, nullSlot);
+ CopyFeaturesFrom(pslotFeat);
+ m_ipassModified = ipass;
+ m_ichwSegOffset = kInvalid;
+ m_nUnicode = kInvalid;
+ m_vpslotAssoc.clear();
+ pgreng->InitSlot(this);
+ m_spsl = kspslNone;
+ m_ipassFsmCol = -1;
+ m_colFsm = -1;
+}
+
+/*----------------------------------------------------------------------------------------------
+ The slot has been modified by the given pass and therefore is in a new state;
+ make a new SlotState initialized from the old one.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::InitializeFrom(GrSlotState * pslotOld, int ipass)
+{
+ CopyFrom(pslotOld, false);
+
+ m_ipassModified = ipass;
+ m_pslotPrevState = pslotOld;
+ m_ichwSegOffset = kInvalid;
+ m_vpslotAssoc.clear();
+ m_vpslotAssoc.push_back(pslotOld);
+
+ m_dircProc = pslotOld->m_dircProc;
+ m_fDirProcessed = pslotOld->m_fDirProcessed;
+
+ // Since we're going on to a new pass, no point in copying these:
+ m_ipassFsmCol = -1;
+ m_colFsm = -1;
+
+ ////FixAttachmentTree(pslotOld);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Copy the features and style information from the given slot.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::CopyFeaturesFrom(GrSlotState * pslotSrc)
+{
+ m_bStyleIndex = pslotSrc->m_bStyleIndex;
+ Assert(m_cnFeat == pslotSrc->m_cnFeat);
+ std::copy(pslotSrc->PFeatureBuf(), pslotSrc->PFeatureBuf() + m_cnFeat, PFeatureBuf());
+}
+
+/*----------------------------------------------------------------------------------------------
+ Copy the basic information.
+ Warning: the functions below will break if GrSlotState and subclasses are given virtual
+ methods. In that case, we will need to copy from the address of the first variable in
+ GrSlotAbstract.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::CopyFrom(GrSlotState * pslot, bool fCopyEverything)
+{
+ GrSlotAbstract::CopyAbstractFrom(pslot);
+ std::copy(pslot->m_prgnVarLenBuf, pslot->m_prgnVarLenBuf + CExtraSpace(), m_prgnVarLenBuf);
+
+ if (fCopyEverything)
+ {
+ Assert(false);
+ m_ipassModified = pslot->m_ipassModified;
+ m_pslotPrevState = pslot->m_pslotPrevState;
+ m_ichwSegOffset = pslot->m_ichwSegOffset;
+ m_colFsm = pslot->m_colFsm;
+ m_ipassFsmCol = pslot->m_ipassFsmCol;
+ // TODO: copy m_vpslotAssocs.
+ m_fNeutralAssocs = pslot->m_fNeutralAssocs;
+ }
+
+ m_dislotRootFixed = pslot->m_dislotRootFixed;
+
+ m_vdislotAttLeaves.resize(pslot->m_vdislotAttLeaves.size());
+ for (size_t i = 0; i < pslot->m_vdislotAttLeaves.size(); i++)
+ m_vdislotAttLeaves[i] = pslot->m_vdislotAttLeaves[i];
+
+ m_islotPosPass = pslot->m_islotPosPass;
+ m_nUnicode = pslot->m_nUnicode;
+ m_dircProc = pslot->m_dircProc;
+ m_fDirProcessed = pslot->m_fDirProcessed;
+ m_cnUserDefn = pslot->m_cnUserDefn;
+ m_cnFeat = pslot->m_cnFeat;
+ m_bStyleIndex = pslot->m_bStyleIndex;
+ m_mAdvanceX = pslot->m_mAdvanceX;
+ m_mAdvanceY = pslot->m_mAdvanceY;
+ m_mShiftX = pslot->m_mShiftX;
+ m_mShiftY = pslot->m_mShiftY;
+ m_srAttachTo = pslot->m_srAttachTo;
+ m_nAttachLevel = pslot->m_nAttachLevel;
+ m_mAttachAtX = pslot->m_mAttachAtX;
+ m_mAttachAtY = pslot->m_mAttachAtY;
+ m_mAttachAtXOffset = pslot->m_mAttachAtXOffset;
+ m_mAttachAtYOffset = pslot->m_mAttachAtYOffset;
+ m_mAttachWithX = pslot->m_mAttachWithX;
+ m_mAttachWithY = pslot->m_mAttachWithY;
+ m_mAttachWithXOffset = pslot->m_mAttachWithXOffset;
+ m_mAttachWithYOffset = pslot->m_mAttachWithYOffset;
+ m_nAttachAtGpoint = pslot->m_nAttachAtGpoint;
+ m_nAttachWithGpoint = pslot->m_nAttachWithGpoint;
+ m_fAttachMod = pslot->m_fAttachMod;
+ m_fShiftMod = pslot->m_fShiftMod;
+ m_fIgnoreAdvance = pslot->m_fIgnoreAdvance;
+
+ m_nCompositeLevel = kNegInfinity; // uncalculated, so don't need to copy the positions??
+}
+
+void GrSlotAbstract::CopyAbstractFrom(GrSlotState * pslot)
+{
+ u_intslot * pnBufSave = m_prgnVarLenBuf;
+ *this = *pslot;
+ m_prgnVarLenBuf = pnBufSave;
+ Assert(m_prgnVarLenBuf);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Initialize the output slot from the one use within the passes, with the basic information.
+ Warning: this function will break if GrSlotState and subclasses are given virtual
+ methods. In that case, we will need to copy from the address of the first variable in
+ GrSlotAbstract.
+----------------------------------------------------------------------------------------------*/
+void GrSlotOutput::InitializeOutputFrom(GrSlotState * pslot)
+{
+ CopyAbstractFrom(pslot);
+
+ // Copy just the component information, which is of length (m_cnCompPerLig * 2)
+ //std::copy(pslot->PCompRefBuf(),
+ // pslot->PCompRefBuf() + (m_cnCompPerLig * 2),
+ // this->PCompRefBufSlout());
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the ID of the actual glyph that will be used for output and metrics. This is the
+ same for most glyphs, but will be different for pseudo-glyphs.
+----------------------------------------------------------------------------------------------*/
+gid16 GrSlotAbstract::ActualGlyphForOutput(GrTableManager * ptman)
+{
+ if (m_chwActual == kInvalidGlyph)
+ m_chwActual = ptman->ActualGlyphForOutput(m_chwGlyphID);
+ return m_chwActual;
+}
+/*----------------------------------------------------------------------------------------------
+ We are replacing the old slot with the recipient. Replace the pointers in any attachment
+ root or attached leaf slots.
+ OBSOLETE
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::FixAttachmentTree(GrSlotState * pslotOld)
+{
+#if 0
+ pslotOld->m_vpslotAttLeaves.CopyTo(m_vpslotAttLeaves);
+ for (int islot = 0; islot < m_vpslotAttLeaves.Size(); islot++)
+ {
+ Assert(m_vpslotAttLeaves[islot]->m_pslotAttRoot == pslotOld);
+ m_vpslotAttLeaves[islot]->m_pslotAttRoot = this;
+ }
+
+ m_pslotAttRoot = pslotOld->m_pslotAttRoot;
+ if (m_pslotAttRoot)
+ {
+ for (int islot = 0; islot < m_pslotAttRoot->m_vpslotAttLeaves.Size(); islot++)
+ {
+ if (m_pslotAttRoot->m_vpslotAttLeaves[islot] == pslotOld)
+ {
+ m_pslotAttRoot->m_vpslotAttLeaves.Delete(islot);
+ m_pslotAttRoot->m_vpslotAttLeaves.Push(this);
+ return;
+ }
+ }
+ Assert(false); // didn't find old slot in the list
+ }
+#endif // 0
+}
+
+/*----------------------------------------------------------------------------------------------
+ Make sure all the values are cached that are needed to be copied to the output slots
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::EnsureCacheForOutput(GrTableManager * ptman)
+{
+ // Make sure the actual glyph ID is set.
+ gid16 gidActual = ActualGlyphForOutput(ptman);
+
+ // Make sure the glyph metrics are stored.
+ Font * pfont = ptman->State()->GetFont();
+ if (IsLineBreak(ptman->LBGlyphID()))
+ {
+ GetGlyphMetric(pfont, kgmetAscent, 0);
+ GetGlyphMetric(pfont, kgmetDescent, 0);
+ m_xysGlyphX = 0;
+ m_xysGlyphY = 0;
+ m_xysGlyphHeight = 0;
+ m_xysGlyphWidth = 0;
+ m_xysAdvX = 0;
+ m_xysAdvY = 0;
+ m_bIsSpace = true;
+ }
+ else
+ {
+ //IsSpace(ptman); // cache this flag--doing bb-top below will do it
+
+ GetGlyphMetric(pfont, kgmetAscent, gidActual);
+ GetGlyphMetric(pfont, kgmetDescent, gidActual);
+ GetGlyphMetric(pfont, kgmetBbTop, gidActual);
+ // call above will also cache all the values below
+ //GetGlyphMetric(pfont, kgmetBbBottom, gidActual);
+ //GetGlyphMetric(pfont, kgmetBbLeft, gidActual);
+ //GetGlyphMetric(pfont, kgmetBbRight, gidActual);
+ //GetGlyphMetric(pfont, kgmetAdvWidth, gidActual);
+ //GetGlyphMetric(pfont, kgmetAdvHeight, gidActual);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set the associations for the slot.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::Associate(GrSlotState * pslot)
+{
+ m_vpslotAssoc.clear();
+ m_vpslotAssoc.push_back(pslot);
+}
+
+void GrSlotState::Associate(GrSlotState * pslotBefore, GrSlotState * pslotAfter)
+{
+ m_vpslotAssoc.clear();
+ m_vpslotAssoc.push_back(pslotBefore);
+ m_vpslotAssoc.push_back(pslotAfter);
+}
+
+void GrSlotState::Associate(std::vector<GrSlotState*> & vpslot)
+{
+ m_vpslotAssoc.clear();
+ ///vpslot.CopyTo(m_vpslotAssoc); -- bug in CopyTo, so we do it ourselves:
+ for (size_t islot = 0; islot < vpslot.size(); ++islot)
+ {
+ m_vpslotAssoc.push_back(vpslot[islot]);
+ }
+
+ // Set its character styles and features from the associated slot.
+ if (vpslot.size() > 0) // && !m_pslotPrevState
+ {
+ std::copy(m_vpslotAssoc[0]->PFeatureBuf(),
+ m_vpslotAssoc[0]->PFeatureBuf() + m_cnFeat, PFeatureBuf());
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Clear the associations for the slot.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::ClearAssocs()
+{
+ m_vpslotAssoc.clear();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return a list of (ie, add into the vector) all the underlying associations, relative
+ to the official beginning of the segment.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::AllAssocs(std::vector<int> & vichw)
+{
+ if (PassModified() == 0)
+ {
+ Assert(m_ichwSegOffset != kInvalid);
+ vichw.push_back(m_ichwSegOffset);
+ }
+ else
+ {
+ for (size_t i = 0; i < m_vpslotAssoc.size(); ++i)
+ m_vpslotAssoc[i]->AllAssocs(vichw);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the underlying position of the before-association, relative to the official
+ beginning of the segment. May be -1, if this slot maps to a character in the previous
+ segment, or >= the length of the segment, if it maps to a character in the following
+ segment.
+----------------------------------------------------------------------------------------------*/
+int GrSlotState::BeforeAssoc()
+{
+ GrSlotState * pslot = this;
+ while (pslot->PassModified() > 0)
+ {
+ pslot = pslot->RawBeforeAssocSlot();
+ if (pslot == NULL)
+ {
+ return kPosInfinity;
+ }
+ }
+ Assert(pslot->m_ichwSegOffset != kInvalid);
+ return pslot->m_ichwSegOffset;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the underlying position of the after-association, relative to the official
+ beginning of the segment. May be -1, if this slot maps to a character in the previous
+ segment, or >= the length of the segment, if it maps to a character in the following
+ segment.
+----------------------------------------------------------------------------------------------*/
+int GrSlotState::AfterAssoc()
+{
+ GrSlotState * pslot = this;
+ while (pslot->PassModified() > 0)
+ {
+ pslot = pslot->RawAfterAssocSlot();
+ if (pslot == NULL)
+ {
+ return kNegInfinity;
+ }
+ }
+ Assert(pslot->m_ichwSegOffset != kInvalid);
+ return pslot->m_ichwSegOffset;
+}
+
+/*----------------------------------------------------------------------------------------------
+ It is possible to get into a state where we are associated with an invalid state.
+ For instance, slot C may be associated with slots B1 and B2, but slot B1 is not associated
+ with any earlier slot, in which case slot C should remove the association with B1 and just
+ be associated with B2.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::CleanUpAssocs()
+{
+ for (size_t i = 0; i < m_vpslotAssoc.size(); i++)
+ m_vpslotAssoc[i]->CleanUpAssocs();
+
+ GrSlotState * pslot;
+
+ pslot = RawBeforeAssocSlot();
+ while (pslot && BeforeAssoc() == kPosInfinity)
+ {
+ // The before association is bogus--delete it.
+ m_vpslotAssoc.erase(m_vpslotAssoc.begin());
+ pslot = RawBeforeAssocSlot();
+ }
+
+ pslot = RawAfterAssocSlot();
+ while (pslot && AfterAssoc() == kNegInfinity)
+ {
+ // The after association is bogus--delete it.
+ m_vpslotAssoc.pop_back();
+ pslot = RawAfterAssocSlot();
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Fill in the array of the given output slot with the underlying positions of the
+ ligature components, relative to the official beginning of the segment.
+ Positions may be < 0, if this slot maps to a character in the previous segment,
+ or >= the length of the segment, if it maps to a character in the following segment.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::SetComponentRefsFor(GrSlotOutput * pslout, int slatiArg)
+{
+ if (PassModified() > 0)
+ {
+ GrSlotState * pslot;
+ int slati;
+ if (HasComponents())
+ {
+ for (int iComponent = 0; iComponent < m_cnCompPerLig; iComponent++)
+ {
+ pslot = CompRefSlot(iComponent);
+ slati = Slati(iComponent);
+ if (pslot)
+ {
+ Assert(slati != -1);
+ Assert(PassModified() >= pslot->PassModified());
+ pslot->SetComponentRefsFor(pslout, slati);
+ }
+ }
+ }
+ else
+ {
+ // Follow the chain back through the passes.
+ pslot = RawBeforeAssocSlot();
+ if (pslot)
+ {
+ Assert(PassModified() >= pslot->PassModified());
+ // Passing slati here is definitely needed for our Arabic font: for instance when
+ // you type something like "mla", so the l is transformed into a temporary glyph
+ // before creating the ligature. However, this seems to have broken something,
+ // which I will probably find eventually. :-(
+ pslot->SetComponentRefsFor(pslout, slatiArg);
+ //pslot->SetComponentRefsFor(pslout, -1);
+ }
+ }
+ }
+ else
+ {
+ Assert(m_ichwSegOffset != kInvalid);
+ pslout->AddComponentReference(m_ichwSegOffset, slatiArg);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Fill in the vector with the underlying positions of the
+ ligature components, relative to the official beginning of the segment.
+ Positions may be < 0, if this slot maps to a character in the previous segment,
+ or >= the length of the segment, if it maps to a character in the following segment.
+ ENHANCE: merge with method above.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::AllComponentRefs(std::vector<int> & vichw)
+{
+ if (PassModified() > 0)
+ {
+ GrSlotState * pslot;
+ if (HasComponents())
+ {
+ for (int iComponent = 0; iComponent < m_cnCompPerLig; iComponent++)
+ {
+ pslot = CompRefSlot(iComponent);
+ if (pslot)
+ {
+ Assert(PassModified() >= pslot->PassModified());
+ pslot->AllComponentRefs(vichw);
+ }
+ }
+ }
+ else
+ {
+ // ENHANCE: Strictly speaking we should probably have separate before-
+ // and after-lists for the components, but I think it would be pretty
+ // rare to have both deletion and ligatures overlapping, so I'm not
+ // going to bother with it for now.
+ //for (int islot = 0; islot < AssocsSize(); islot++)
+ for (int islot = 0; islot < 1; islot++)
+ {
+ m_vpslotAssoc[islot]->AllComponentRefs(vichw);
+ }
+ }
+ }
+ else
+ {
+ Assert(m_ichwSegOffset != kInvalid);
+ vichw.push_back(m_ichwSegOffset);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the value of the component.???.ref attribute for the slot.
+ Note that 'i' is the local index for the component as defined for this glyph.
+----------------------------------------------------------------------------------------------*/
+GrSlotState * GrSlotState::CompRefSlot(int i)
+{
+ Assert(i < m_cnCompPerLig);
+ if (i < m_cnCompPerLig)
+ return CompRef(i);
+ else
+ return NULL;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set the value of the component.???.ref attribute for the slot.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::SetCompRefSlot(GrTableManager * ptman, int slati, GrSlotState * pslotComp)
+{
+ // Convert the global identifer for the component to the index for this glyph.
+ int icomp = ptman->ComponentIndexForGlyph(GlyphID(), slati);
+ Assert(icomp != -1);
+ if (icomp == -1)
+ // Component not defined for this glyph--ignore.
+ return;
+ Assert(icomp < m_cnCompPerLig);
+
+ if (m_fHasComponents == false)
+ {
+ // None have been set yet; initialize them.
+ for (int iLoop = 0; iLoop < m_cnCompPerLig; iLoop++)
+ {
+ SetCompRef(iLoop, NULL);
+ SetSlati(iLoop, -1);
+ }
+ }
+
+ m_fHasComponents = true;
+ int iLoop;
+ for (iLoop = 0; iLoop < m_cnCompPerLig; iLoop++)
+ {
+ if (Slati(iLoop) == slati)
+ break;
+ if (Slati(iLoop) == -1)
+ break;
+ }
+ //if (icomp < m_cnCompPerLig)
+ if (iLoop < m_cnCompPerLig)
+ {
+ //SetCompRef(icomp, pslotComp);
+ SetCompRef(iLoop, pslotComp);
+ SetSlati(iLoop, slati);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the underlying position for the slot, relative to the official beginning of the
+ segment.
+----------------------------------------------------------------------------------------------*/
+int GrSlotState::SegOffset()
+{
+ if (m_ichwSegOffset == kInvalid)
+ {
+ Assert(m_pslotPrevState);
+ Assert(m_ipassModified > 0);
+ return m_pslotPrevState->SegOffset();
+ }
+ else
+ {
+ Assert(m_pslotPrevState == NULL);
+ Assert(m_ipassModified == 0);
+ return m_ichwSegOffset;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the value of the glyph attribute (in design units, if this is a measurement).
+----------------------------------------------------------------------------------------------*/
+int GrSlotState::GlyphAttrValueEmUnits(GrTableManager * ptman, int nAttrID)
+{
+ return ptman->GlyphAttrValue(m_chwGlyphID, nAttrID);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the value of the glyph metric, in design coordinates (ie, based on the font's
+ em-square).
+----------------------------------------------------------------------------------------------*/
+int GrSlotState::GlyphMetricEmUnits(GrTableManager * ptman, int nMetricID)
+{
+ int mValue;
+ if (ptman->State()->GetFont())
+ {
+ // Get the actual metric, possibly adjusted for hinting, then convert back to
+ // design units.
+ float xysValue = GlyphMetricLogUnits(ptman, nMetricID);
+ mValue = ptman->LogToEmUnits(xysValue);
+ }
+ else
+ // Ask the font directly.
+ ////mValue = ???
+ mValue = 0;
+
+ return mValue;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the value of the glyph attribute, converted to source device coordinates.
+ The attribute is assumed to be one whose value is a measurement.
+----------------------------------------------------------------------------------------------*/
+float GrSlotState::GlyphAttrValueLogUnits(GrTableManager * ptman, int nAttrID)
+{
+ int mValue = GlyphAttrValueEmUnits(ptman, nAttrID);
+ float xysRet = ptman->EmToLogUnits(mValue);
+ return xysRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the value of the glyph metric, in the source device's logical units.
+----------------------------------------------------------------------------------------------*/
+float GrSlotState::GlyphMetricLogUnits(GrTableManager * ptman, int nMetricID)
+{
+#ifdef OLD_TEST_STUFF
+ if (ptman->GlyphTable() == NULL)
+ return 0;
+#endif // OLD_TEST_STUFF
+
+#ifdef _DEBUG
+ if (IsLineBreak(ptman->LBGlyphID()))
+ {
+ Warn("Getting metrics of line-break slot");
+ }
+#endif // _DEBUG
+ if (IsLineBreak(ptman->LBGlyphID()))
+ {
+ return 0;
+ }
+
+ return GetGlyphMetric(ptman->State()->GetFont(), nMetricID,
+ ActualGlyphForOutput(ptman));
+}
+
+
+float GrSlotOutput::GlyphMetricLogUnits(Font * pfont, int nMetricID)
+{
+ Assert(m_chwActual != kInvalidGlyph);
+ if (m_chwActual == kInvalidGlyph)
+ return 0;
+
+ return GetGlyphMetric(pfont, nMetricID, m_chwActual);
+}
+
+//float GrSlotOutput::GlyphMetricLogUnits(int gmet) -- obsolete: no longer caching these values
+//{
+// // When the font is not passed as an argument, the values better be cached!
+//
+// switch (gmet)
+// { // There may be off by one errors below, depending on what width and height mean
+// case kgmetLsb:
+// return m_xysGlyphX;
+// case kgmetRsb:
+// return (m_xysAdvX - m_xysGlyphX - m_xysGlyphWidth);
+// case kgmetBbTop:
+// return m_xysGlyphY;
+// case kgmetBbBottom:
+// return (m_xysGlyphY - m_xysGlyphHeight);
+// case kgmetBbLeft:
+// return m_xysGlyphX;
+// case kgmetBbRight:
+// return (m_xysGlyphX + m_xysGlyphWidth);
+// case kgmetBbHeight:
+// return m_xysGlyphHeight;
+// case kgmetBbWidth:
+// return m_xysGlyphWidth;
+// case kgmetAdvWidth:
+// return m_xysAdvX;
+// case kgmetAdvHeight:
+// return m_xysAdvY;
+// default:
+// Warn("GetGlyphMetric was asked for an illegal metric.");
+// };
+//
+// return 0;
+//}
+
+
+float GrSlotAbstract::GetGlyphMetric(Font * pfont, int nMetricID, gid16 chwGlyphID)
+{
+ GlyphMetric gmet = GlyphMetric(nMetricID);
+
+ float yAscent, yDescent;
+ gr::Point ptAdvances;
+ gr::Rect rectBb;
+
+ if (kgmetAscent == gmet)
+ {
+ //if (m_xysFontAscent != -1)
+ // return m_xysFontAscent;
+ pfont->getFontMetrics(&yAscent);
+ //m_xysFontAscent = xysRet;
+ //if (pfont)
+ // m_xysFontAscent = yAscent;
+ return yAscent;
+ }
+
+ if (kgmetDescent == gmet)
+ {
+ //if (m_xysFontDescent != -1)
+ // return m_xysFontDescent;
+ pfont->getFontMetrics(NULL, &yDescent);
+ //m_xysFontDescent = xysRet;
+ //if (pfont)
+ // m_xysFontDescent = yDescent;
+ return yDescent;
+ }
+
+ float xysGlyphX, xysGlyphY, xysGlyphWidth, xysGlyphHeight, xysAdvX, xysAdvY;
+ //if (m_xysGlyphWidth == -1)
+ //{
+ pfont->getGlyphMetrics(chwGlyphID, rectBb, ptAdvances);
+
+ xysGlyphX = rectBb.left;
+ xysGlyphY = rectBb.top;
+ xysGlyphWidth = (rectBb.right - rectBb.left);
+ xysGlyphHeight = (rectBb.top - rectBb.bottom);
+ xysAdvX = ptAdvances.x;
+ xysAdvY = ptAdvances.y;
+
+ m_bIsSpace = (0 == xysGlyphX && 0 == xysGlyphY); // should agree with test done in IsSpace() below
+
+ if (m_bIsSpace == 1)
+ {
+ // White space glyph - only case where nGlyphX == nGlyphY == 0
+ // nGlyphWidth & nGlyphHeight are always set to 16 for unknown reasons, so correct.
+ xysGlyphWidth = xysGlyphHeight = 0;
+ }
+ //}
+
+ switch (gmet)
+ { // There may be off-by-one errors below, depending on what width and height mean
+ case kgmetLsb:
+ return xysGlyphX;
+ case kgmetRsb:
+ return (xysAdvX - xysGlyphX - xysGlyphWidth);
+ case kgmetBbTop:
+ return xysGlyphY;
+ case kgmetBbBottom:
+ return (xysGlyphY - xysGlyphHeight);
+ case kgmetBbLeft:
+ return xysGlyphX;
+ case kgmetBbRight:
+ return (xysGlyphX + xysGlyphWidth);
+ case kgmetBbHeight:
+ return xysGlyphHeight;
+ case kgmetBbWidth:
+ return xysGlyphWidth;
+ case kgmetAdvWidth:
+ return xysAdvX;
+ case kgmetAdvHeight:
+ return xysAdvY;
+ default:
+ Warn("GetGlyphMetric was asked for an illegal metric.");
+ };
+
+ return 0;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Test the glyph id to see if it is a white space glyph.
+----------------------------------------------------------------------------------------------*/
+int GrSlotState::IsSpace(GrTableManager * ptman)
+{
+ gid16 gidActual = ActualGlyphForOutput(ptman);
+
+ ////if (m_xysGlyphWidth == -1)
+ ////{
+ //// res = ptman->State()->GraphicsObject()->GetGlyphMetrics(gidActual,
+ //// &m_xysGlyphWidth, &m_xysGlyphHeight,
+ //// &m_xysGlyphX, &m_xysGlyphY, &m_xysAdvX, &m_xysAdvY);
+ //// if (ResultFailed(res))
+ //// {
+ //// WARN(res);
+ //// return 2; // will test as true but can be distinguished by separate value
+ //// }
+
+ //// gr::Point ptAdvances;
+ //// gr::Rect rectBb;
+ //// ptman->State()->Font()->getGlyphMetrics(gidActual, rectBb, ptAdvances);
+ ////}
+
+ if (m_bIsSpace == -1)
+ GetGlyphMetric(ptman->State()->GetFont(), kgmetBbLeft, gidActual);
+ // One call is enough to cache the information.
+ //GetGlyphMetric(ptman->State()->Font(), kgmetBbBottom, gidActual);
+
+ // should agree with test done in GetGlyphMetric() above
+ //////m_bIsSpace = (0 == m_xysGlyphX && 0 == m_xysGlyphY);
+
+ Assert(m_bIsSpace == 0 || m_bIsSpace == 1);
+
+ return m_bIsSpace;
+}
+
+bool GrSlotOutput::IsSpace()
+{
+ Assert(m_bIsSpace == 0 || m_bIsSpace == 1);
+ return m_bIsSpace;
+}
+
+/*----------------------------------------------------------------------------------------------
+ If any of the attach attributes have been modified, fix things up. Set up the attachment
+ tree, and set any needed default positions. Zap the cached positions of any following
+ glyphs in the stream.
+
+ @param psstrm - the stream in which the modifications were made
+ @param islotThis - the index of the attached (leaf) slot in the stream;
+ -1 if we don't know
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::HandleModifiedPosition(GrTableManager * ptman,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islotThis)
+{
+ if (!m_fAttachMod && !m_fShiftMod)
+ return;
+
+ if (islotThis == -1)
+ {
+ for (int islot = 0; islot < psstrmOut->WritePos(); islot++)
+ {
+ if (psstrmOut->SlotAt(islot) == this)
+ {
+ islotThis = islot;
+ break;
+ }
+ }
+ Assert(islotThis > -1);
+ }
+
+ if (m_fAttachMod)
+ {
+ // Attachments.
+
+ // Note that it doesn't make sense to attach a slot to itself, so if the value of
+ // the attach.to attribute is 0, that means clear the attachment.
+ GrSlotState * pslotNewRoot = AttachRoot(psstrmOut);
+
+ AttachToRoot(ptman, psstrmOut, pslotNewRoot);
+
+ if (pslotNewRoot)
+ {
+ // If this is an attachment with no positions, attach the two glyphs side by side
+ // in the appropriate order.
+ bool fRtl = ((pslotNewRoot->PostBidiDirLevel(ptman) % 2) != 0);
+ if ((fRtl && m_srAttachTo < 0) || (!fRtl && m_srAttachTo > 0))
+ {
+ // The root is on the right, the leaf is on the left.
+ if (m_mAttachAtX == kNotYetSet && m_nAttachAtGpoint == kNotYetSet)
+ m_mAttachAtX = 0;
+ if (m_mAttachWithX == kNotYetSet && m_nAttachWithGpoint == kNotYetSet)
+ m_mAttachWithX = short(AdvanceX(ptman));
+ }
+ else
+ {
+ // The root is on the left, the leaf is on the right.
+ if (m_mAttachAtX == kNotYetSet && m_nAttachAtGpoint == kNotYetSet)
+ m_mAttachAtX = short(pslotNewRoot->AdvanceX(ptman));
+ if (m_mAttachWithX == kNotYetSet && m_nAttachWithGpoint == kNotYetSet)
+ m_mAttachWithX = 0;
+ }
+ }
+ }
+ else
+ {
+ // Shifting, or changing the advance width.
+ Assert(m_fShiftMod);
+ EnsureLocalAttachmentTree(ptman, psstrmIn, psstrmOut, islotThis);
+ ZapMetricsAndPositionDownToBase(psstrmOut);
+ ZapMetricsOfLeaves(psstrmOut);
+ }
+
+ if (psstrmOut->m_ipass == ptman->NumberOfPasses() - 1)
+ ptman->InitPosCache(); // cached position is most likely no longer valid
+
+ // Invalidate the positions of this and any following glyphs.
+ for (int islot = islotThis + 1; islot < psstrmOut->WritePos(); islot++)
+ psstrmOut->SlotAt(islot)->ZapPosition();
+
+ m_fAttachMod = false;
+ m_fShiftMod = false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ The shift attribute of a slot has been modified. Make sure any slots that are part of the
+ same attachment cluster are local to this stream. The reason for this is so that the
+ position calculations stay consistent within the stream.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::EnsureLocalAttachmentTree(GrTableManager * ptman,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islotThis)
+{
+ if (m_dislotRootFixed)
+ {
+ GrSlotState * pslotRoot = SlotAtOffset(psstrmOut, m_dislotRootFixed);
+ psstrmOut->EnsureLocalCopy(ptman, pslotRoot, psstrmIn);
+ pslotRoot = SlotAtOffset(psstrmOut, m_dislotRootFixed); // get the new one!
+ pslotRoot->EnsureLocalAttachmentTree(ptman, psstrmIn, psstrmOut, islotThis + m_dislotRootFixed);
+ }
+ for (size_t islot = 0; islot < m_vdislotAttLeaves.size(); islot++)
+ {
+ GrSlotState * pslotLeaf = SlotAtOffset(psstrmOut, m_vdislotAttLeaves[islot]);
+ psstrmOut->EnsureLocalCopy(ptman, pslotLeaf, psstrmIn);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ The recipient slot is being attached to the argument slot.
+ NOTE: the caller is responsible to zap the cached positions of following glyphs
+ in the stream.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::AttachToRoot(GrTableManager * ptman, GrSlotStream * psstrm,
+ GrSlotState * pslotNewRoot)
+{
+ GrSlotState * pslotOldRoot = (m_dislotRootFixed == 0) ?
+ NULL :
+ SlotAtOffset(psstrm, m_dislotRootFixed);
+
+ if (pslotOldRoot)
+ {
+ if (pslotOldRoot != pslotNewRoot)
+ pslotOldRoot->RemoveLeaf(m_dislotRootFixed);
+ pslotOldRoot->ZapMetricsAndPositionDownToBase(psstrm);
+ pslotOldRoot->ZapMetricsOfLeaves(psstrm);
+ }
+
+ ZapCompositeMetrics();
+
+ if (pslotNewRoot && pslotNewRoot != pslotOldRoot)
+ {
+ pslotNewRoot->AddLeaf(m_srAttachTo);
+ pslotNewRoot->ZapMetricsAndPositionDownToBase(psstrm);
+ pslotNewRoot->ZapMetricsOfLeaves(psstrm);
+ }
+
+ m_dislotRootFixed = m_srAttachTo;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the absolute position of the glyph, relative to the start of the segment,
+ in font design units.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::Position(GrTableManager * ptman,
+ GrSlotStream * psstrmOut, int * pmXPos, int * pmYPos)
+{
+ Assert(!m_fAttachMod); // the attachment tree should be set up
+ Assert(!m_fShiftMod);
+
+ float xsWidth, xsVisWidth;
+ if (m_xsPositionX == kNegInfFloat || m_ysPositionY == kNegInfFloat)
+ ptman->CalcPositionsUpTo(psstrmOut->m_ipass, this, &xsWidth, &xsVisWidth);
+
+ *pmXPos = ptman->LogToEmUnits(m_xsPositionX);
+ *pmYPos = ptman->LogToEmUnits(m_ysPositionY);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Recalculate the metrics for this slot, which has attachments on it (or possibly
+ did in the past).
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::AdjustRootMetrics(GrTableManager * ptman, GrSlotStream * psstrm)
+{
+ Assert(m_dislotRootFixed == m_srAttachTo);
+ GrSlotState * pslotRoot = AttachRoot(psstrm);
+ CalcRootMetrics(ptman, psstrm, kPosInfinity);
+ if (pslotRoot)
+ pslotRoot->AdjustRootMetrics(ptman, psstrm);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Calculate the composite metrics for this slot.
+
+ @param psstrm - stream for which we are calculating it
+ @param nLevel - attachment level we are asking for; kPosInifinity means all levels
+ @param fThorough - true: do a thorough recalculation; false: don't recalculate
+ metrics for leaves (are they assumed to be accurate???)
+ --currently not used
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::CalcCompositeMetrics(GrTableManager * ptman, GrSlotStream * psstrm,
+ int nLevel, bool fThorough)
+{
+ if (m_nCompositeLevel == nLevel)
+ return;
+
+ if (fThorough)
+ {
+ Assert(m_dislotRootFixed == m_srAttachTo);
+ GrSlotState * pslotRoot = AttachRoot(psstrm);
+
+ InitMetrics(ptman, pslotRoot);
+
+ for (size_t islot = 0; islot < m_vdislotAttLeaves.size(); islot++)
+ {
+ GrSlotState * pslotLeaf = SlotAtOffset(psstrm, m_vdislotAttLeaves[islot]);
+ if (pslotLeaf->AttachLevel() <= nLevel)
+ pslotLeaf->CalcCompositeMetrics(ptman, psstrm, nLevel, fThorough);
+ else
+ // this slot will be ignored in the composite metrics
+ pslotLeaf->ZapRootMetrics();
+ }
+ CalcRootMetrics(ptman, psstrm, nLevel);
+
+ m_nCompositeLevel = nLevel;
+ }
+ else
+ {
+ Assert(false); // for now
+
+ // Don't bother with the leaves.
+ InitRootMetrics(ptman);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Calculate the metrics for this node and all its leaf nodes.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::CalcRootMetrics(GrTableManager * ptman, GrSlotStream * psstrm, int nLevel)
+{
+ for (size_t idislot = 0; idislot < m_vdislotAttLeaves.size(); idislot++)
+ {
+ GrSlotState * pslot = SlotAtOffset(psstrm, m_vdislotAttLeaves[idislot]);
+ if (pslot->AttachLevel() > nLevel)
+ continue;
+
+ m_xsClusterXOffset = min(m_xsClusterXOffset, pslot->m_xsClusterXOffset);
+ if (!pslot->m_fIgnoreAdvance)
+ {
+ m_xsClusterAdv = max(
+ m_xsClusterAdv,
+ pslot->m_xsClusterAdv + m_xsRootShiftX);
+ }
+ m_xsClusterBbLeft = min(m_xsClusterBbLeft, pslot->m_xsClusterBbLeft);
+ m_xsClusterBbRight = max(m_xsClusterBbRight, pslot->m_xsClusterBbRight);
+ m_ysClusterBbTop = max(m_ysClusterBbTop, pslot->m_ysClusterBbTop);
+ m_ysClusterBbBottom = min(m_ysClusterBbBottom, pslot->m_ysClusterBbBottom);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Reset the cluster metrics of this slot.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::InitMetrics(GrTableManager * ptman, GrSlotState * pslotRoot)
+{
+ InitLeafMetrics(ptman, pslotRoot);
+ InitRootMetrics(ptman);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Initialize the variables that store the offsets of just this node (ignoring any of its
+ leaves) relative to the cluster base.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::InitLeafMetrics(GrTableManager * ptman, GrSlotState * pslotRoot)
+{
+ float xsShiftX = ptman->EmToLogUnits(ShiftX());
+ float ysShiftY = ptman->EmToLogUnits(ShiftY());
+
+ if (ptman->RightToLeft())
+ xsShiftX *= -1;
+
+ if (IsBase())
+ {
+ // The x-value below has to be zero because the shift is incorporated into
+ // m_xsRootShiftX. (m_ysRootShiftY, on the other hand, isn't used anywhere.)
+ m_xsOffsetX = 0;
+ m_ysOffsetY = ysShiftY;
+
+ m_xsRootShiftX = xsShiftX;
+ m_ysRootShiftY = ysShiftY;
+ Assert(!IsLineBreak(ptman->LBGlyphID())
+ || (m_xsRootShiftX == 0 && m_ysRootShiftY == 0));
+ return;
+ }
+
+ Assert(!IsLineBreak(ptman->LBGlyphID()));
+
+ // Hint-adjusted logical coordinates equivalent to attach.at and attach.with attributes.
+ // If attach.at or attach.with attributes were unset, the defaults for a side-by-side
+ // attachment should have been supplied in HandleModifiedPosition().
+ float xsAttAtX, ysAttAtY, xsAttWithX, ysAttWithY;
+ AttachLogUnits(ptman, pslotRoot, &xsAttAtX, &ysAttAtY, &xsAttWithX, &ysAttWithY);
+
+ m_xsOffsetX = xsAttAtX - xsAttWithX;
+ m_xsOffsetX += pslotRoot->m_xsOffsetX;
+ m_xsOffsetX += xsShiftX;
+
+ m_ysOffsetY = ysAttAtY - ysAttWithY;
+ m_ysOffsetY += pslotRoot->m_ysOffsetY;
+ m_ysOffsetY += ysShiftY;
+
+ // Cumulative effect of shifts on this and all base nodes:
+ m_xsRootShiftX = pslotRoot->m_xsRootShiftX + xsShiftX;
+ m_ysRootShiftY = pslotRoot->m_ysRootShiftY + ysShiftY;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Initialize the variables that store the offsets of this node taking into account its
+ leaves; these are relative to the cluster base.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::InitRootMetrics(GrTableManager * ptman)
+{
+ if (IsLineBreak(ptman->LBGlyphID()))
+ {
+ m_fIgnoreAdvance = true;
+ m_xsClusterXOffset = 0;
+ m_xsClusterAdv = 0;
+ m_xsClusterBbLeft = 0;
+ m_xsClusterBbRight = 0;
+ m_ysClusterBbTop = 0;
+ m_ysClusterBbBottom = 0;
+ return;
+ }
+
+ float xsAdvanceX = ptman->EmToLogUnits(AdvanceX(ptman));
+
+ // If the glyph's advance width is zero, then we NEVER want it to have any affect,
+ // even if the glyph is attached way out to the right of its base's advance.
+ m_fIgnoreAdvance = (xsAdvanceX == 0);
+
+ float xsBbLeft = GlyphMetricLogUnits(ptman, kgmetBbLeft);
+ float xsBbRight = GlyphMetricLogUnits(ptman, kgmetBbRight);
+ float ysBbTop = GlyphMetricLogUnits(ptman, kgmetBbTop);
+ float ysBbBottom = GlyphMetricLogUnits(ptman, kgmetBbBottom);
+
+ // Any shifts should be ignored for the sake of calculating actual position or width,
+ // hence we subtract the cumulative effect of the shifts.
+ m_xsClusterXOffset = m_xsOffsetX - m_xsRootShiftX;
+ m_xsClusterAdv = m_xsOffsetX + xsAdvanceX - m_xsRootShiftX;
+
+ m_xsClusterBbLeft = m_xsOffsetX + xsBbLeft;
+ m_xsClusterBbRight = m_xsOffsetX + xsBbRight;
+ m_ysClusterBbTop = m_ysOffsetY + ysBbTop;
+ m_ysClusterBbBottom = m_ysOffsetY + ysBbBottom;
+}
+
+/*----------------------------------------------------------------------------------------------
+ X-offset of a single glyph relative to the previous advance position.
+----------------------------------------------------------------------------------------------*/
+float GrSlotState::GlyphXOffset(GrSlotStream * psstrm, float fakeItalicRatio)
+{
+ float xsRet = Base(psstrm)->ClusterRootOffset() + m_xsOffsetX;
+
+ // fake an italic slant
+ xsRet += m_ysOffsetY * fakeItalicRatio;
+
+ return xsRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Y-offsets of a single glyph relative to the previous advance position.
+----------------------------------------------------------------------------------------------*/
+float GrSlotState::GlyphYOffset(GrSlotStream * psstrm)
+{
+ return m_ysOffsetY;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the offset of the last leaf of the cluster, relative to this slot, which is
+ the base. Return kNegInfinity if there are not enough slots in the stream to tell.
+----------------------------------------------------------------------------------------------*/
+int GrSlotState::LastLeafOffset(GrSlotStream * psstrm)
+{
+ int islotRet = 0;
+ for (size_t idislot = 0; idislot < m_vdislotAttLeaves.size(); idislot++)
+ {
+ int dislot = m_vdislotAttLeaves[idislot];
+ Assert(dislot != 0);
+ if (!psstrm->HasSlotAtPosPassIndex(PosPassIndex() + dislot))
+ return kNegInfinity;
+ GrSlotState * pslotLeaf = SlotAtOffset(psstrm, dislot);
+ int islotTmp = pslotLeaf->LastLeafOffset(psstrm);
+ if (islotTmp == kNegInfinity)
+ return kNegInfinity;
+ islotRet = max(islotRet, (dislot + islotTmp));
+ }
+ return islotRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the attach positions in the device context's logical units,
+ adjusted for hinting if possible.
+
+ Note that m_nAttachAt/WithGpoint = 0 is always an invalid value (resulting from a
+ glyph attribute that was defined in terms of x/y coordinates that didn't map to an
+ actual on-curve point). Therefore the x/y coordinates should be used to do the
+ attachment. In the case where we actually want point #0 on the curve,
+ m_nAttachAt/WithGpoint will have the special value 'kGpointZero' (the glyph attribute
+ is defined this way).
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::AttachLogUnits(GrTableManager * ptman, GrSlotState * pslotRoot,
+ float * pxsAttAtX, float * pysAttAtY,
+ float * pxsAttWithX, float * pysAttWithY)
+{
+ if (m_nAttachAtGpoint == kNotYetSet || m_nAttachAtGpoint == 0)
+ {
+ // Use x- and y-coordinates; no adjustment for hinting is done.
+ int mX = m_mAttachAtX + m_mAttachAtXOffset;
+ int mY = m_mAttachAtY + m_mAttachAtYOffset;
+
+ *pxsAttAtX = ptman->EmToLogUnits(mX);
+ *pysAttAtY = ptman->EmToLogUnits(mY);
+ }
+ else
+ {
+ // Look up the actual on-curve point.
+ int nGpoint = m_nAttachAtGpoint;
+ if (nGpoint == kGpointZero)
+ nGpoint = 0;
+ bool fImpl = ptman->GPointToXY(pslotRoot->GlyphID(), nGpoint, pxsAttAtX, pysAttAtY);
+
+ // Debuggers:
+ //int mXTmpAt = m_mAttachAtX + m_mAttachAtXOffset;
+ //int mYTmpAt = m_mAttachAtY + m_mAttachAtYOffset;
+ //int xsAttAtXTmp = ptman->EmToLogUnits(mXTmpAt);
+ //int ysAttAtYTmp = ptman->EmToLogUnits(mYTmpAt);
+ //fImpl = false;
+
+ if (!fImpl)
+ {
+ // Fall back to using x- and y-coordinates; no adjustment for hinting.
+ int mX = m_mAttachAtX + m_mAttachAtXOffset;
+ int mY = m_mAttachAtY + m_mAttachAtYOffset;
+ *pxsAttAtX = ptman->EmToLogUnits(mX);
+ *pysAttAtY = ptman->EmToLogUnits(mY);
+ }
+ else
+ {
+ // Adjust by offsets.
+ *pxsAttAtX += ptman->EmToLogUnits(m_mAttachAtXOffset);
+ *pysAttAtY += ptman->EmToLogUnits(m_mAttachAtYOffset);
+ }
+ }
+
+ if (m_nAttachWithGpoint == kNotYetSet || m_nAttachWithGpoint == 0)
+ {
+ // Use x- and y-coordinates; no adjustment for hinting is done.
+ int mX = m_mAttachWithX + m_mAttachWithXOffset;
+ int mY = m_mAttachWithY + m_mAttachWithYOffset;
+
+ *pxsAttWithX = ptman->EmToLogUnits(mX);
+ *pysAttWithY = ptman->EmToLogUnits(mY);
+ }
+ else
+ {
+ // Look up the actual on-curve point.
+ int nGpoint = m_nAttachWithGpoint;
+ if (nGpoint == kGpointZero)
+ nGpoint = 0;
+ bool fImpl = ptman->GPointToXY(m_chwGlyphID, nGpoint, pxsAttWithX, pysAttWithY);
+
+ // Debuggers:
+ //int mXTmpWith = m_mAttachWithX + m_mAttachWithXOffset;
+ //int mYTmpWith = m_mAttachWithY + m_mAttachWithYOffset;
+ //int xsAttWithXTmp = ptman->EmToLogUnits(mXTmpWith);
+ //int ysAttWithYTmp = ptman->EmToLogUnits(mYTmpWith);
+ //fImpl = false;
+
+ if (!fImpl)
+ {
+ // Fall back to using x- and y-coordinates; no adjustment for hinting.
+ int mX = m_mAttachWithX + m_mAttachWithXOffset;
+ int mY = m_mAttachWithY + m_mAttachWithYOffset;
+ *pxsAttWithX = ptman->EmToLogUnits(mX);
+ *pysAttWithY = ptman->EmToLogUnits(mY);
+ }
+ else
+ {
+ // Adjust by offsets.
+ *pxsAttWithX += ptman->EmToLogUnits(m_mAttachWithXOffset);
+ *pysAttWithY += ptman->EmToLogUnits(m_mAttachWithYOffset);
+ }
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the slot that is 'dislot' slots away from this slot in the given stream.
+ Only valid for streams that are the input to or output of positioning passes.
+----------------------------------------------------------------------------------------------*/
+GrSlotState * GrSlotState::SlotAtOffset(GrSlotStream * psstrm, int dislot)
+{
+ Assert(psstrm->m_fUsedByPosPass);
+ return psstrm->SlotAtPosPassIndex(PosPassIndex() + dislot);
+}
+
+/*----------------------------------------------------------------------------------------------
+ If the direction level has not been calculated at this point, assume it is the
+ top direction. This should only happen if there was no bidi pass to set it.
+ This method should only be called by the positioning passes; it assumes any bidi
+ pass has been run.
+----------------------------------------------------------------------------------------------*/
+int GrSlotState::PostBidiDirLevel(GrTableManager * ptman)
+{
+ if (m_nDirLevel == -1)
+ {
+ Assert(!ptman->HasBidiPass());
+ return ptman->TopDirectionLevel();
+ }
+ return m_nDirLevel;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if this glyph represents a LRM code.
+----------------------------------------------------------------------------------------------*/
+bool GrSlotState::IsLrm()
+{
+ if (PassModified() == 0)
+ return (m_nUnicode == knLRM);
+ return m_pslotPrevState->IsLrm();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if this glyph represents a RLM code.
+----------------------------------------------------------------------------------------------*/
+bool GrSlotState::IsRlm()
+{
+ if (PassModified() == 0)
+ return (m_nUnicode == knRLM);
+ return m_pslotPrevState->IsRlm();
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Used by GlyphInfo
+----------------------------------------------------------------------------------------------*/
+//float GrSlotOutput::AdvanceX(Segment * pseg)
+//{
+// return pseg->EmToLogUnits(m_mAdvanceX);
+//}
+//float GrSlotOutput::AdvanceY(Segment * pseg)
+//{
+// return pseg->EmToLogUnits(m_mAdvanceY);
+//}
+float GrSlotOutput::MaxStretch(Segment * pseg, int level)
+{
+ Assert(level == 0);
+ return (level == 0) ? pseg->EmToLogUnits(m_mJStretch0) : 0;
+}
+float GrSlotOutput::MaxShrink(Segment * pseg, int level)
+{
+ Assert(level == 0);
+ return (level == 0) ? pseg->EmToLogUnits(m_mJShrink0) : 0;
+}
+float GrSlotOutput::StretchStep(Segment * pseg, int level)
+{
+ Assert(level == 0);
+ return (level == 0) ? pseg->EmToLogUnits(m_mJStep0) : 0;
+}
+int GrSlotOutput::JustWeight(int level)
+{
+ Assert(level == 0);
+ return (level == 0) ? m_nJWeight0 : 0;
+}
+float GrSlotOutput::JustWidth(Segment * pseg, int level)
+{
+ Assert(level == 0);
+ return (level == 0) ? pseg->EmToLogUnits(m_mJWidth0) : 0;
+}
+float GrSlotOutput::MeasureSolLogUnits(Segment * pseg)
+{
+ return pseg->EmToLogUnits(m_mMeasureSol);
+}
+float GrSlotOutput::MeasureEolLogUnits(Segment * pseg)
+{
+ return pseg->EmToLogUnits(m_mMeasureEol);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Make a copy of the GrSlotOutput. This is used in making an identical copy of the segment.
+ Warning: this function will break if GrSlotState and subclasses are given virtual
+ methods. In that case, we will need to copy from the address of the first variable in
+ GrSlotAbstract.
+----------------------------------------------------------------------------------------------*/
+void GrSlotOutput::ExactCopyFrom(GrSlotOutput * pslout, u_intslot * pnVarLenBuf, int cnExtraPerSlot)
+{
+ // The chunk of the object from GrSlotAbstract can be copied exactly,
+ // except for the variable-length buffer.
+ *this = *pslout;
+ m_prgnVarLenBuf = pnVarLenBuf;
+ std::copy(pslout->m_prgnVarLenBuf, pslout->m_prgnVarLenBuf + cnExtraPerSlot,
+ m_prgnVarLenBuf);
+
+ // Now copy the stuff specific to GrSlotOutput.
+ m_ichwBeforeAssoc = pslout->m_ichwBeforeAssoc;
+ m_ichwAfterAssoc = pslout->m_ichwAfterAssoc;
+ m_cComponents = pslout->m_cComponents;
+
+ m_isloutClusterBase = pslout->m_isloutClusterBase;
+ m_disloutCluster = pslout->m_disloutCluster;
+ m_xsClusterXOffset = pslout->m_xsClusterXOffset;
+ m_xsClusterAdvance = pslout->m_xsClusterAdvance;
+ m_igbb = pslout->m_igbb;
+ m_xsAdvanceX = pslout->m_xsAdvanceX;
+// m_ysAdvanceY = pslout->m_ysAdvanceY;
+// m_rectBB = pslout->m_rectBB;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Shift the glyph to the opposite end of the segment. This is needed for white-space-only
+ segments whose direction is being changed.
+----------------------------------------------------------------------------------------------*/
+void GrSlotOutput::ShiftForDirDepthChange(float dxsSegWidth)
+{
+ float dxsShift = dxsSegWidth - m_xsAdvanceX - (2 * m_xsPositionX);
+ int tmp; tmp = (int) dxsShift;
+ m_xsPositionX += dxsShift;
+// m_rectBB.left += dxsShift;
+// m_rectBB.right += dxsShift;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the indices of all the glyphs attached to this cluster, in logical order.
+ Return an empty vector if this glyph is not the base glyph or if there are no
+ attached glyphs.
+ This method return glyph indices, not slot indices.
+----------------------------------------------------------------------------------------------*/
+void GrSlotOutput::ClusterMembers(Segment * pseg, int isloutThis, std::vector<int> & visloutRet)
+{
+ if (m_isloutClusterBase == -1 || m_isloutClusterBase == isloutThis) // yes, a base
+ pseg->ClusterMembersForGlyph(isloutThis, m_disloutCluster, visloutRet);
+ else
+ {
+ Assert(visloutRet.size() == 0);
+ }
+}
+
+} // namespace gr
diff --git a/Build/source/libs/graphite/src/segment/GrSlotState.h b/Build/source/libs/graphite/src/segment/GrSlotState.h
new file mode 100644
index 00000000000..d000927d1a4
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrSlotState.h
@@ -0,0 +1,1287 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999 - 2008 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrSlotState.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Copyright (C) 1999 by SIL International. All rights reserved.
+
+Description:
+ Classes GrSlotAbstract, GrSlotState, and GrSlotOutput
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef SLOTSTATE_INCLUDED
+#define SLOTSTATE_INCLUDED
+
+namespace gr
+{
+
+class GrSlotAbstract;
+class GrSlotState;
+class GrSlotOutput;
+class GrSlotStream;
+class Font;
+
+//:End Ignore
+
+
+/*----------------------------------------------------------------------------------------------
+ Subsumes GrSlotState and GrSlotOutput, both of which represent a single glyph
+ and its slot attributes and features.
+
+ Hungarian: slab
+----------------------------------------------------------------------------------------------*/
+class GrSlotAbstract
+{
+ friend class GrSlotStream;
+ friend class GlyphInfo;
+
+public:
+ // Constructor:
+ GrSlotAbstract()
+ {
+ }
+
+ ~GrSlotAbstract()
+ {
+ // the table manager is responsible for destroying the contents of m_prgnVarLenBuf
+ }
+
+ void BasicInitializeAbstract(int cnCompPerLig, u_intslot * pnBuf)
+ {
+ m_dirc = kNotYetSet8;
+ m_lb = kNotYetSet8;
+ m_fInsertBefore = true;
+ m_nDirLevel = -1;
+
+ m_bIsSpace = -1; // unknown
+
+ m_fInsertBefore = true;
+
+ m_mMeasureSol = 0;
+ m_mMeasureEol = 0;
+
+ m_mJStretch0 = 0;
+ m_mJShrink0 = 0;
+ m_mJStep0 = 0;
+ m_nJWeight0 = 0;
+ m_mJWidth0 = 0;
+
+ m_cnCompPerLig = byte(cnCompPerLig);
+ m_prgnVarLenBuf = pnBuf;
+ }
+
+ void CopyAbstractFrom(GrSlotState * pslot);
+
+ void SetBufferPtr(u_intslot * pn)
+ {
+ m_prgnVarLenBuf = pn;
+ }
+
+ gid16 GlyphID() { return m_chwGlyphID; }
+ gid16 RawActualGlyph() { return m_chwActual; }
+ float GetGlyphMetric(Font * pfont, int nGlyphMetricID, gid16 chwGlyphID);
+
+ //GrSlotState * CompRefSlot(int i);
+
+ int BreakWeight()
+ {
+ return (int)m_lb;
+ }
+ DirCode Directionality()
+ {
+ return DirCode(int(m_dirc));
+ }
+ int InsertBefore()
+ {
+ return m_fInsertBefore;
+ }
+ int MeasureSol()
+ {
+ return m_mMeasureSol;
+ }
+ int MeasureEol()
+ {
+ return m_mMeasureEol;
+ }
+
+ int DirLevel()
+ {
+ return m_nDirLevel;
+ }
+
+ int SpecialSlotFlag()
+ {
+ return m_spsl;
+ }
+ void SetSpecialSlotFlag(int spsl)
+ {
+ m_spsl = sdata8(spsl);
+ }
+
+ enum {
+ kNotYetSet = 0x7FFF,
+ kNotYetSet8 = 0x7F,
+ kInvalidGlyph = 0xFFFF
+ };
+
+ gid16 ActualGlyphForOutput(GrTableManager * ptman);
+
+ // Needed for GlyphInfo:
+ float XPosition()
+ {
+ return m_xsPositionX;
+ }
+ float YPosition()
+ {
+ return m_ysPositionY; // relative to baseline (positive is up)
+ }
+
+protected:
+ gid16 m_chwGlyphID;
+ gid16 m_chwActual; // actual glyph to output (which is a different glyph for pseudos)
+
+ sdata8 m_spsl; // special slot flag: LB, bidi marker
+
+// bool m_fInitialLB; // for LB slots: true if this is the initial LB;
+ // false if it is the terminating LB
+ // TODO: remove
+
+ sdata8 m_dirc; // default = kNotYetSet8 (read from glyph attr)
+ sdata8 m_lb; // default = kNotYetSet8 (read from glyph attr)
+
+ sdata8 m_nDirLevel;
+
+ // Slot attributes that are used by GrSlotOutput:
+ short m_mMeasureSol;
+ short m_mMeasureEol;
+
+ unsigned short m_mJStretch0;
+ unsigned short m_mJShrink0;
+ unsigned short m_mJStep0;
+ int m_mJWidth0;
+ byte m_nJWeight0;
+
+ bool m_fInsertBefore; // default = true
+
+ sdata8 m_bIsSpace; // 0 = false, 1 = true, -1 = unknown
+
+ byte m_cnCompPerLig;
+ // There is a large block managed by either the GrTableManager (for GrSlotState)
+ // or the segment (for GrSlotOutput); this variable points at the sub-buffer for this
+ // particular slot:
+ u_intslot * m_prgnVarLenBuf;
+
+ float m_xsPositionX;
+ float m_ysPositionY;
+
+}; // end of class GrSlotAbstract
+
+
+/*----------------------------------------------------------------------------------------------
+ A GrSlotState represents one slot as modified by a pass in the table.
+ Each time a slot state is modified, a new instance is created, copying the relevant
+ information.
+
+ Hungarian: slot
+
+ Other hungarian:
+ m - integer indicating glyph design units ("em-units")
+ sr - integer indicating slot reference
+----------------------------------------------------------------------------------------------*/
+class GrSlotState : public GrSlotAbstract
+{
+ friend class GrSlotStream;
+ friend class FontMemoryUsage;
+
+public:
+ enum { kNeutral = 99 };
+
+ // Constructors:
+ GrSlotState()
+ : GrSlotAbstract(),
+ m_pslotPrevState(NULL)
+ {
+ m_vpslotAssoc.clear();
+ //m_fInitialLB = false; // TODO: remove
+ m_spsl = kspslNone;
+ m_fNeutralAssocs = false;
+ m_dircProc = kdircUnknown;
+ m_fDirProcessed = false;
+
+ m_vdislotAttLeaves.clear();
+ m_fAttachMod = false;
+ m_fShiftMod = false;
+ m_dislotRootFixed = 0;
+ ZapCompositeMetrics();
+ }
+
+ ~GrSlotState()
+ {
+ }
+
+ void BasicInitialize(int cnUserDefn, int cnCompPerLig, int cnFeat, u_intslot * pnBuf)
+ {
+ BasicInitializeAbstract(cnCompPerLig, pnBuf);
+
+ m_xysGlyphWidth = -1;
+ m_xysFontAscent = -1;
+ m_xysFontDescent = -1;
+
+ m_mAdvanceX = kNotYetSet;
+ m_mAdvanceY = kNotYetSet;
+ m_mShiftX = 0;
+ m_mShiftY = 0;
+
+ m_fAdvXSet = false; // for transduction logging
+ m_fAdvYSet = false;
+
+ m_srAttachTo = 0;
+ m_nAttachLevel = 0;
+
+ m_mAttachAtX = kNotYetSet;
+ m_mAttachAtY = 0;
+ m_nAttachAtGpoint = kNotYetSet;
+ m_mAttachAtXOffset = 0;
+ m_mAttachAtYOffset = 0;
+ m_mAttachWithX = kNotYetSet;
+ m_mAttachWithY = 0;
+ m_nAttachWithGpoint = kNotYetSet;
+ m_mAttachWithXOffset = 0;
+ m_mAttachWithYOffset = 0;
+
+ m_islotPosPass = kNotYetSet;
+
+ m_cnUserDefn = byte(cnUserDefn);
+ m_cnFeat = byte(cnFeat);
+
+ m_fHasComponents = false;
+ }
+
+ void Initialize(gid16 chw, GrEngine *, GrFeatureValues fval,
+ int ipass, int ichwSegOffset, int nUnicode = -1);
+ void Initialize(gid16 chw, GrEngine *, GrSlotState * pslotFeat,
+ int ipass, int ichwSegOffset);
+ void Initialize(gid16 chw, GrEngine *, GrSlotState * pslotFeat,
+ int ipass);
+
+ void InitializeFrom(GrSlotState * pslot, int ipass);
+ void CopyFeaturesFrom(GrSlotState * pslotSrc);
+ void FixAttachmentTree(GrSlotState * pslotOld);
+
+ void CopyFrom(GrSlotState * pslot, bool fCopyEverything = true);
+
+ // General:
+ int RawSegOffset() { return m_ichwSegOffset; }
+
+ void SetGlyphID(gid16 chw)
+ {
+ m_chwGlyphID = chw;
+ m_chwActual = kInvalidGlyph;
+ m_xysGlyphWidth = -1; // indicate glyph metrics are invalid
+ m_ipassFsmCol = -1;
+ m_colFsm = -1;
+ }
+
+ int PosPassIndex()
+ {
+ return m_islotPosPass;
+ }
+ void SetPosPassIndex(int islot, bool fInputToPosPass1)
+ {
+ // If we're resetting it, it should be to the same value as before:
+ Assert(fInputToPosPass1 || m_islotPosPass == kNotYetSet || m_islotPosPass == islot);
+ m_islotPosPass = islot;
+ }
+ void IncPosPassIndex()
+ {
+ m_islotPosPass++;
+ }
+ void ZapPosPassIndex()
+ {
+ m_islotPosPass = kNotYetSet;
+ }
+
+ int StyleIndex() { return m_bStyleIndex; }
+
+ int AttachTo() { return m_srAttachTo; }
+ int AttachLevel() { return m_nAttachLevel; }
+
+ int RawAttachAtX() { return m_mAttachAtX; }
+ int AttachAtY() { return m_mAttachAtY; }
+ int AttachAtGpoint() { return m_nAttachAtGpoint; }
+ int AttachAtXOffset() { return m_mAttachAtXOffset; }
+ int AttachAtYOffset() { return m_mAttachAtYOffset; }
+
+ int RawAttachWithX() { return m_mAttachWithX; }
+ int AttachWithY() { return m_mAttachWithY; }
+ int AttachWithGpoint() { return m_nAttachWithGpoint; }
+ int AttachWithXOffset() { return m_mAttachWithXOffset; }
+ int AttachWithYOffset() { return m_mAttachWithYOffset; }
+
+ void Associate(GrSlotState *);
+ void Associate(GrSlotState *, GrSlotState *);
+ void Associate(std::vector<GrSlotState*> &);
+ void ClearAssocs();
+
+ int AssocsSize() { return m_vpslotAssoc.size(); }
+ GrSlotState * RawBeforeAssocSlot()
+ {
+ if (m_vpslotAssoc.size() == 0)
+ return NULL;
+ return m_vpslotAssoc[0];
+ }
+ GrSlotState * RawAfterAssocSlot()
+ {
+ if (m_vpslotAssoc.size() == 0)
+ return NULL;
+ return m_vpslotAssoc.back();
+ }
+ ////GrSlotState * AssocSlot(int i) { return m_vpslotAssoc[i]; }
+
+ GrSlotState * AssocSlot(int i)
+ {
+ if (i < 0)
+ return NULL;
+ if (i >= signed(m_vpslotAssoc.size()))
+ return NULL;
+
+ GrSlotState * pslotAssoc = m_vpslotAssoc[i];
+ // handle possible reprocessing
+ while (pslotAssoc && pslotAssoc->PassModified() == m_ipassModified)
+ pslotAssoc = pslotAssoc->m_pslotPrevState;
+ return pslotAssoc;
+ }
+
+ void AllAssocs(std::vector<int> & vichw);
+ int BeforeAssoc();
+ int AfterAssoc();
+
+ void CleanUpAssocs();
+
+ void SetComponentRefsFor(GrSlotOutput *, int iComp = -1);
+ void AllComponentRefs(std::vector<int> & vichw);
+
+ int PassModified() { return m_ipassModified; }
+ int SegOffset();
+ int UnderlyingPos();
+ GrSlotState * PrevState() { return m_pslotPrevState; }
+
+ void MarkDeleted() // for now, do nothing
+ {
+ }
+
+ int IsSpace(GrTableManager * ptman);
+
+ // TODO: remove argument from these methods; it is no longer needed.
+ bool IsLineBreak(gid16 chwLB)
+ {
+ return (IsInitialLineBreak(chwLB) || IsFinalLineBreak(chwLB));
+ //return (m_chwGlyphID == chwLB); // TODO: remove
+ }
+ bool IsInitialLineBreak(gid16 chwLB)
+ {
+ return (m_spsl == kspslLbInitial);
+ //return (IsLineBreak(chwLB) && m_fInitialLB == true); // TODO: remove
+ }
+ bool IsFinalLineBreak(gid16 chwLB)
+ {
+ return (m_spsl == kspslLbFinal);
+ //return (IsLineBreak(chwLB) && m_fInitialLB == false); // TODO: remove
+ }
+
+ bool IsBidiMarker()
+ {
+ switch (m_spsl)
+ {
+ case kspslLRM:
+ case kspslRLM:
+ case kspslLRO:
+ case kspslRLO:
+ case kspslLRE:
+ case kspslRLE:
+ case kspslPDF:
+ return true;
+ default:
+ return false;
+ }
+ return false;
+ }
+
+ bool HasComponents() { return m_fHasComponents; }
+
+ // Directionality as determined by the bidi algorithm
+ DirCode DirProcessed() // return the value
+ {
+ Assert(m_dirc != kNotYetSet8);
+ if (m_dircProc == kdircUnknown)
+ m_dircProc = DirCode(m_dirc);
+ return m_dircProc;
+ }
+ void SetDirProcessed(DirCode dirc) // set the directionality
+ {
+ m_dircProc = dirc;
+ }
+ bool DirHasBeenProcessed() // has this slot been fully processed?
+ {
+ return m_fDirProcessed;
+ }
+ void MarkDirProcessed() // this slot has been fully processed
+ {
+ m_fDirProcessed = true;
+ }
+
+ int RawAdvanceX() { return m_mAdvanceX; }
+ int RawAdvanceY() { return m_mAdvanceY; }
+ int ShiftX() { return m_mShiftX; }
+ int ShiftY() { return m_mShiftY; }
+
+ // Slot attributes that must be calculated:
+
+ int AdvanceX(GrTableManager * ptman)
+ {
+ if (m_mAdvanceX == kNotYetSet)
+ // Initialize it from the glyph metric (adjusted for hinting).
+ m_mAdvanceX = short(GlyphMetricEmUnits(ptman, kgmetAdvWidth));
+ return m_mAdvanceX;
+ }
+
+ int AdvanceY(GrTableManager * ptman)
+ {
+ if (m_mAdvanceY == kNotYetSet)
+ // Initialize it from the glyph metric (adjusted for hinting).
+ m_mAdvanceY = short(GlyphMetricEmUnits(ptman, kgmetAdvHeight));
+ return m_mAdvanceY;
+ }
+
+ int AttachAtX(GrTableManager * ptman, GrSlotStream * psstrm)
+ {
+ if (m_mAttachAtX == kNotYetSet)
+ {
+ Assert(false); // Should have already been set in HandleModifiedPosition,
+ // but just in case...
+ if (m_srAttachTo == 0)
+ return 0;
+ else
+ m_mAttachAtX = short(AttachRoot(psstrm)->AdvanceX(ptman)); // attach on the right
+ }
+ return m_mAttachAtX;
+ }
+
+ int AttachWithX(GrTableManager * ptman, GrSlotStream * psstrm)
+ {
+ if (m_mAttachAtX == kNotYetSet)
+ {
+ Assert(false); // Should have already been set in HandleModifiedPosition,
+ // but just in case.
+ if (!m_srAttachTo == 0)
+ return 0;
+ else
+ m_mAttachAtX = 0; // attach on the right
+ }
+ return m_mAttachAtX;
+ }
+
+ int JStretch()
+ {
+ return m_mJStretch0;
+ }
+ int JShrink()
+ {
+ return m_mJShrink0;
+ }
+ int JStep()
+ {
+ return m_mJStep0;
+ }
+ int JWeight()
+ {
+ return m_nJWeight0;
+ }
+ int JWidth()
+ {
+ return m_mJWidth0;
+ }
+
+ // Slot attribute setters:
+
+ void SetAdvanceX(int mVal)
+ {
+ Assert(mVal < 0xFFFF); m_mAdvanceX = short(mVal & 0xFFFF); m_fShiftMod = true;
+ m_fAdvXSet = true; // for transduction logging
+ }
+ void SetAdvanceY(int mVal)
+ {
+ Assert(mVal < 0xFFFF); m_mAdvanceY = short(mVal & 0xFFFF); m_fShiftMod = true;
+ m_fAdvYSet = true; // for transduction logging
+ }
+ void SetShiftX(int mVal)
+ {
+ Assert(mVal < 0xFFFF); m_mShiftX = short(mVal & 0xFFFF);
+ m_fShiftMod = true;
+ }
+ void SetShiftY(int mVal)
+ {
+ Assert(mVal < 0xFFFF); m_mShiftY = short(mVal & 0xFFFF);
+ m_fShiftMod = true;
+ }
+
+ void SetAttachTo(int srVal)
+ {
+ Assert(srVal < 0xFFFF);
+ m_srAttachTo = short(srVal & 0xFFFF);
+ m_fAttachMod = true;
+ }
+ void SetAttachLevel(int nVal) {
+ Assert(nVal < 0xFFFF); m_nAttachLevel = short(nVal & 0xFFFF); m_fAttachMod = true; }
+
+ void SetAttachAtX(int mVal)
+ {
+ Assert(mVal < 0xFFFF);
+ m_mAttachAtX = short(mVal) & 0xFFFF;
+ m_fAttachMod = true;
+ }
+ void SetAttachAtY(int mVal) {
+ Assert(mVal < 0xFFFF); m_mAttachAtY = short(mVal & 0xFFFF); m_fAttachMod = true; }
+ void SetAttachAtGpoint(int nVal) {
+ m_nAttachAtGpoint = short(nVal); m_fAttachMod = true; }
+ void SetAttachAtXOffset(int mVal) {
+ Assert(mVal < 0xFFFF); m_mAttachAtXOffset = short(mVal & 0xFFFF); m_fAttachMod = true; }
+ void SetAttachAtYOffset(int mVal) {
+ Assert(mVal < 0xFFFF); m_mAttachAtYOffset = short(mVal & 0xFFFF); m_fAttachMod = true; }
+
+ void SetAttachWithX(int mVal) {
+ Assert(mVal < 0xFFFF); m_mAttachWithX = short(mVal & 0xFFFF); m_fAttachMod = true; }
+ void SetAttachWithY(int mVal) {
+ Assert(mVal < 0xFFFF); m_mAttachWithY = short(mVal & 0xFFFF); m_fAttachMod = true; }
+ void SetAttachWithGpoint(int nVal) {
+ m_nAttachWithGpoint = short(nVal); m_fAttachMod = true; }
+ void SetAttachWithXOffset(int mVal) {
+ Assert(mVal < 0xFFFF); m_mAttachWithXOffset = short(mVal & 0xFFFF); m_fAttachMod = true; }
+ void SetAttachWithYOffset(int mVal) {
+ Assert(mVal < 0xFFFF); m_mAttachWithYOffset = short(mVal & 0xFFFF); m_fAttachMod = true; }
+
+ void SetCompRefSlot(GrTableManager * ptman, int i, GrSlotState * pslotComp);
+
+ void SetBreakWeight(int lb) { m_lb = sdata8(lb); }
+ void SetInsertBefore(bool f) { m_fInsertBefore = f; }
+
+ void SetDirectionality(DirCode dirc) { m_dirc = sdata8(dirc); }
+ void SetDirLevel(int n) { m_nDirLevel = sdata8(n); }
+
+ void SetMeasureSol(int mVal) { m_mMeasureSol = short(mVal); }
+ void SetMeasureEol(int mVal) { m_mMeasureEol = short(mVal); }
+
+ void SetJStretch(int mVal) { m_mJStretch0 = short(mVal); }
+ void SetJShrink(int mVal) { m_mJShrink0 = short(mVal); }
+ void SetJStep(int mVal) { m_mJStep0 = short(mVal); }
+ void SetJWeight(int nVal) { m_nJWeight0 = byte(nVal); }
+ void SetJWidth(int mVal) { m_mJWidth0 = mVal; }
+ void AddJWidthToAdvance(GrTableManager * ptman)
+ {
+ // Don't change m_fShiftMod.
+ m_mAdvanceX = short(m_mJWidth0 + AdvanceX(ptman)); // make sure it is calculated
+ m_mJWidth0 = 0;
+ m_fAdvXSet = true; // for transduction logging
+ }
+
+ int PostBidiDirLevel(GrTableManager * ptman);
+
+ bool BaseEarlierInStream();
+
+ void ZapDirLevel()
+ {
+ m_nDirLevel = -1;
+ m_dircProc = kdircUnknown;
+ m_fDirProcessed = false;
+ }
+
+ int GlyphAttrValueEmUnits(GrTableManager * ptman, int nAttrID);
+ int GlyphMetricEmUnits(GrTableManager * ptman, int nGlyphMetricID);
+
+ float GlyphAttrValueLogUnits(GrTableManager * ptman, int nAttrID);
+ float GlyphMetricLogUnits(GrTableManager * ptman, int nGlyphMetricID);
+
+// void HandleModifiedCluster(GrTableManager * ptman,
+// GrSlotStream * psstrm, int islotThis);
+ void HandleModifiedPosition(GrTableManager * ptman,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islotThis);
+
+ void CalcCompositeMetrics(GrTableManager * ptman, GrSlotStream * psstrm,
+ int nLevel, bool fThorough = false);
+
+ void Position(GrTableManager * ptman,
+ GrSlotStream * psstrmOut, int * pmXPos, int * pmYPos);
+
+ void ZapPosition()
+ {
+ m_xsPositionX = kNegInfFloat;
+ m_ysPositionY = kNegInfFloat;
+ }
+
+ void SetXPos(float xs)
+ {
+ m_xsPositionX = xs;
+ }
+ void SetYPos(float ys)
+ {
+ m_ysPositionY = ys; // relative to baseline (positive is up)
+ }
+
+ float ClusterRootOffset() { return -m_xsClusterXOffset; } // the offset of the root
+ // relative to the whole cluster
+
+ float ClusterAdvWidthFrom(float xs) { return xs + m_xsClusterAdv; }
+ float ClusterBbLeftFrom(float xs) { return xs + m_xsClusterBbLeft; }
+ float ClusterBbRightFrom(float xs) { return xs + m_xsClusterBbRight; }
+
+ float ClusterLsb(GrSlotStream * psstrm, float xs)
+ {
+ return ClusterBbLeft(psstrm) + xs;
+ }
+ float ClusterRsb(GrSlotStream * psstrm, float xs)
+ {
+ return ClusterAdvWidthFrom(xs) - ClusterBbRightFrom(xs);
+ }
+
+ float ClusterAdvWidth(GrSlotStream * psstrm)
+ {
+ return ClusterAdvWidthFrom(Base(psstrm)->ClusterRootOffset());
+ }
+// int ClusterAdvHeight(GrSlotStream * psstrm)
+// {
+// Assert(m_mAdvanceY != kNotYetSet);
+// return EmUnitsToTwips(m_mAdvanceY);
+// }
+ float ClusterBbLeft(GrSlotStream * psstrm)
+ {
+ return ClusterBbLeftFrom(Base(psstrm)->ClusterRootOffset());
+ }
+ float ClusterBbRight(GrSlotStream * psstrm)
+ {
+ return ClusterBbRightFrom(Base(psstrm)->ClusterRootOffset());
+ }
+ float ClusterBbTop(GrSlotStream * psstrm)
+ {
+ return m_ysClusterBbTop;
+ }
+ float ClusterBbBottom(GrSlotStream * psstrm)
+ {
+ return m_ysClusterBbBottom;
+ }
+ float ClusterBbWidth(GrSlotStream * psstrm)
+ {
+ return m_xsClusterBbRight - m_xsClusterBbLeft + 1;
+ }
+ float ClusterBbHeight(GrSlotStream * psstrm)
+ {
+ return m_ysClusterBbTop - m_ysClusterBbBottom + 1;
+ }
+ float ClusterLsb(GrSlotStream * psstrm)
+ {
+ return ClusterBbLeft(psstrm);
+ }
+ float ClusterRsb(GrSlotStream * psstrm)
+ {
+ return ClusterAdvWidth(psstrm) - ClusterBbRight(psstrm);
+ }
+
+ float GlyphXOffset(GrSlotStream * psstrm, float fakeItalicRatio = 0);
+ float GlyphYOffset(GrSlotStream * psstrm = NULL);
+
+ bool IsBase()
+ {
+ Assert(m_dislotRootFixed == m_srAttachTo);
+ return (m_dislotRootFixed == 0);
+ }
+
+ bool HasClusterMembers()
+ {
+ return (m_vdislotAttLeaves.size() > 0);
+ }
+
+ GrSlotState * AttachRoot(GrSlotStream * psstrm)
+ {
+ if (m_srAttachTo == 0)
+ return NULL;
+ else
+ return SlotAtOffset(psstrm, m_srAttachTo);
+ }
+
+ int AttachRootPosPassIndex()
+ {
+ return PosPassIndex() + m_srAttachTo;
+ }
+
+ GrSlotState * Base(GrSlotStream * psstrm)
+ {
+ GrSlotState * pslotRoot = AttachRoot(psstrm);
+ if (!pslotRoot)
+ return this;
+ else
+ return pslotRoot->Base(psstrm);
+ }
+
+ int LastLeafOffset(GrSlotStream * psstrm);
+
+ void AddLeaf(int dislot)
+ {
+ m_vdislotAttLeaves.push_back(dislot * -1);
+ }
+ void RemoveLeaf(int dislot)
+ {
+ for (size_t iislot = 0; iislot < m_vdislotAttLeaves.size(); iislot++)
+ {
+ if (m_vdislotAttLeaves[iislot] == dislot * -1)
+ {
+ m_vdislotAttLeaves.erase(m_vdislotAttLeaves.begin() + iislot);
+ return;
+ }
+ }
+ Assert(false);
+ }
+
+ bool HasAsRoot(GrSlotStream * psstrm, GrSlotState * pslot)
+ {
+ GrSlotState * pslotRoot = AttachRoot(psstrm);
+ if (pslotRoot == pslot)
+ return true;
+ else if (pslotRoot == NULL)
+ return false;
+ else
+ return pslotRoot->HasAsRoot(psstrm, pslot);
+ }
+
+ bool HasAsPreviousState(GrSlotState * pslot)
+ {
+ if (this == pslot)
+ return true;
+ else
+ return m_pslotPrevState->HasAsPreviousState(pslot);
+ }
+
+ void EnsureCacheForOutput(GrTableManager * ptman);
+
+ bool IsLrm();
+ bool IsRlm();
+
+ // Cache of FSM column information for the most recent pass:
+ int FsmColumn() { return m_colFsm; }
+ int PassNumberForColumn() { return m_ipassFsmCol; }
+ void CacheFsmColumn(int ipass, int col)
+ {
+ m_colFsm = col;
+ m_ipassFsmCol = ipass;
+ }
+
+ // Variable-length buffer--includes four sub-buffers:
+ // * user-defined variables
+ // * component.???.ref assignments
+ // * mapping from components used to global attribute IDs for components
+ // * feature values
+
+ // user-defined slot attributes
+ int UserDefn(int slati)
+ {
+ Assert(slati < m_cnUserDefn);
+ return m_prgnVarLenBuf[slati].nValue;
+ }
+ void SetUserDefn(int slati, int nVal)
+ {
+ Assert(slati < m_cnUserDefn);
+ m_prgnVarLenBuf[slati].nValue = nVal;
+ }
+ u_intslot * PUserDefnBuf()
+ {
+ return m_prgnVarLenBuf;
+ }
+
+ // pointer to the associated slot which is the value of the comp.ref attribute
+ GrSlotState * CompRef(int slati)
+ {
+ Assert(slati < m_cnCompPerLig);
+ return m_prgnVarLenBuf[m_cnUserDefn + slati].pslot;
+ }
+ void SetCompRef(int slati, GrSlotState * pvSlot)
+ {
+ Assert(slati < m_cnCompPerLig);
+ m_prgnVarLenBuf[m_cnUserDefn + slati].pslot = pvSlot;
+ }
+ u_intslot * PCompRefBuf()
+ {
+ return m_prgnVarLenBuf + m_cnUserDefn;
+ }
+
+ // global component identifier
+ int Slati(int i)
+ {
+ Assert(i < m_cnCompPerLig);
+ return m_prgnVarLenBuf[m_cnUserDefn + m_cnCompPerLig + i].nValue;
+ }
+ void SetSlati(int i, int n)
+ {
+ Assert(i < m_cnCompPerLig);
+ m_prgnVarLenBuf[m_cnUserDefn + m_cnCompPerLig + i].nValue = n;
+ }
+ u_intslot * PSlatiBuf()
+ {
+ return m_prgnVarLenBuf + m_cnUserDefn + m_cnCompPerLig;
+ }
+
+ // feature settings
+ int FeatureValue(int i)
+ {
+ Assert(i < m_cnFeat);
+ return m_prgnVarLenBuf[m_cnUserDefn + (m_cnCompPerLig * 2) + i].nValue;
+ }
+
+ u_intslot * PFeatureBuf()
+ {
+ return m_prgnVarLenBuf + m_cnUserDefn + (m_cnCompPerLig * 2);
+ }
+
+ int CExtraSpace()
+ {
+ return m_cnUserDefn + (m_cnCompPerLig * 2) + m_cnFeat;
+ }
+
+ GrSlotState * CompRefSlot(int i);
+
+ void GetFeatureValues(GrFeatureValues * pfval)
+ {
+ pfval->m_nStyleIndex = m_bStyleIndex;
+ std::fill(pfval->m_rgnFValues, pfval->m_rgnFValues + kMaxFeatures, 0);
+ for (size_t i = 0; i < m_cnFeat; i++)
+ pfval->m_rgnFValues[i] = PFeatureBuf()[i].nValue;
+ }
+
+ // For transduction logging:
+#ifdef TRACING
+ void SlotAttrsModified(bool * rgfMods, bool fPreJust, int * pccomp, int * pcassoc);
+ void LogSlotAttributeValue(GrTableManager *, std::ostream &, int ipass, int slat, int icomp,
+ bool fPreJust, bool fPostJust);
+ void LogAssociation(GrTableManager * ptman,
+ std::ostream & strmOut, int ipass, int iassoc, bool fBoth, bool fAfter);
+ void LogXmlAttributes(std::ostream & strmOut, GrTableManager * ptman, GrSlotStream * psstrmOut,
+ int ipass, int islot,
+ bool fPreJust, bool fPostJust, bool fBidi, bool fBidiNext, int nIndent);
+ int GetSlotAttrValue(std::ostream & strmOut, GrTableManager * ptman,
+ int ipass, int slat, int iIndex, bool fPreJust, bool fPostJust);
+ int m_islotTmpIn; // for use by transduction log; index of slot in input stream
+ int m_islotTmpOut; // ditto; index of slot in output stream
+#endif // TRACING
+
+protected:
+
+ // Instance variables:
+ int m_ipassModified; // pass in which this slot was modified
+
+ GrSlotState * m_pslotPrevState;
+
+ int m_ichwSegOffset; // for original (pass 0) slot states: position in
+ // underlying text relative to the official
+ // beginning of the segment;
+ // should == kInvalid for other slot states
+ int m_islotPosPass; // index of slot in positioning streams, relative to first official
+ // slot in the segment (possibly the LB slot)
+
+ int m_colFsm; // which FSM column this glyph corresponds to...
+ int m_ipassFsmCol; // ...for the most recent pass
+
+ std::vector<GrSlotState*> m_vpslotAssoc; // association mappings
+
+ bool m_fNeutralAssocs; // true if we've set the associations to some neutral
+ // default, rather than them being set explicitly
+ // within a rule
+
+ int m_nUnicode; // for debugging
+
+ DirCode m_dircProc; // directionality as processed in bidi algorithm
+ bool m_fDirProcessed;
+
+ // affects length of variable-length buffer
+ byte m_cnUserDefn;
+ byte m_cnFeat;
+
+ byte m_bStyleIndex;
+
+ // Slot attributes:
+ short m_mAdvanceX;
+ short m_mAdvanceY;
+ short m_mShiftX;
+ short m_mShiftY;
+
+ short m_srAttachTo;
+ short m_nAttachLevel;
+
+ short m_mAttachAtX;
+ short m_mAttachAtY;
+ short m_mAttachAtXOffset;
+ short m_mAttachAtYOffset;
+ short m_mAttachWithX;
+ short m_mAttachWithY;
+ short m_mAttachWithXOffset;
+ short m_mAttachWithYOffset;
+
+ short m_nAttachAtGpoint;
+ short m_nAttachWithGpoint;
+
+ // Raw glyph metrics (directly from font)
+ float m_xysFontAscent;
+ float m_xysFontDescent;
+ float m_xysGlyphWidth;
+ float m_xysGlyphHeight;
+ float m_xysGlyphX;
+ float m_xysGlyphY;
+ float m_xysAdvX;
+ float m_xysAdvY;
+
+ // Attachment and metrics
+
+ // This is a flag that is set whenever we change the value of any of the attach
+ // slot attributes. Then when we want to find out something about the attachments,
+ // if it is set, we have some work to do in updating the pointers and metrics.
+ bool m_fAttachMod;
+
+ // This is a flag that is set whenever we change the value of any of the shift or
+ // advance slot attributes. It forces us to zap the metrics.
+ bool m_fShiftMod;
+
+ // This glyph (and all its leaves, if any) have a zero advance width;
+ // never allow it to affect the advance width of a cluster it is part of.
+ bool m_fIgnoreAdvance;
+
+ int m_dislotRootFixed; // the offset of the slot (relative to this one) that considers
+ // this slot to be one of its leaves
+ std::vector<int> m_vdislotAttLeaves;
+
+ // The following are used by the CalcCompositeMetrics() method and depend on
+ // the cluster level that was passed as an argument.
+
+ int m_nCompositeLevel; // cluster level last used to calculate composite metrics;
+ // kNegInfinity if uncalculated
+
+ // offsets for this node only, relative to cluster base
+ float m_xsOffsetX;
+ float m_ysOffsetY; // relative to baseline (positive is up)
+
+ // offsets for this node and its leaves, relative to cluster base (y-coords are
+ // relative to baseline)
+ float m_xsClusterXOffset;
+ float m_xsClusterAdv;
+ float m_xsClusterBbLeft;
+ float m_xsClusterBbRight;
+ float m_ysClusterBbTop;
+ float m_ysClusterBbBottom;
+
+ // cumulative total of shifts for this node and roots; advance needs to ignore these
+ float m_xsRootShiftX;
+ float m_ysRootShiftY;
+
+ bool m_fHasComponents; // default = false
+
+ // Private methods:
+
+ void CopyAbstractFrom(GrSlotState * pslot);
+
+ void AdjustRootMetrics(GrTableManager * ptman, GrSlotStream *);
+ void InitMetrics(GrTableManager * ptman, GrSlotState * pslotRoot);
+ void InitLeafMetrics(GrTableManager * ptman, GrSlotState * pslotRoot);
+ void InitRootMetrics(GrTableManager * ptman);
+ void CalcRootMetrics(GrTableManager * ptman, GrSlotStream *, int nLevel);
+ void AttachToRoot(GrTableManager * ptman, GrSlotStream *, GrSlotState * pslotNewRoot);
+ void AttachLogUnits(GrTableManager * ptman,
+ GrSlotState * pslotRoot,
+ float * pxsAttAtX, float * pysAttAtY,
+ float * pxsAttWithX, float * pysAttWithY);
+
+ GrSlotState * SlotAtOffset(GrSlotStream * psstrm, int dislot); // ENHANCE SharonC: inline?
+
+ void EnsureLocalAttachmentTree(GrTableManager * ptman,
+ GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islotThis);
+
+ void ZapCompositeMetrics()
+ {
+ m_nCompositeLevel = kNegInfinity;
+ m_xsPositionX = kNegInfFloat;
+ m_ysPositionY = kNegInfFloat;
+ m_xsOffsetX = 0;
+ m_ysOffsetY = 0;
+ m_xsRootShiftX = 0;
+ m_ysRootShiftY = 0;
+ ZapRootMetrics();
+ }
+
+ void ZapRootMetrics()
+ {
+ m_xsClusterXOffset = 0;
+ m_xsClusterAdv = 0;
+ m_xsClusterBbLeft = 0;
+ m_xsClusterBbRight = 0;
+ m_ysClusterBbTop = 0;
+ m_ysClusterBbBottom = 0;
+ m_fIgnoreAdvance = false;
+ }
+
+ void ZapMetricsAndPositionDownToBase(GrSlotStream * psstrm)
+ {
+ ZapCompositeMetrics();
+ if (m_dislotRootFixed)
+ SlotAtOffset(psstrm, m_dislotRootFixed)->ZapMetricsAndPositionDownToBase(psstrm);
+ }
+
+ void ZapMetricsOfLeaves(GrSlotStream * psstrm, bool fThis = false)
+ {
+ if (fThis)
+ ZapCompositeMetrics();
+ for (size_t islot = 0; islot < m_vdislotAttLeaves.size(); islot++)
+ {
+ SlotAtOffset(psstrm, m_vdislotAttLeaves[islot])->ZapMetricsOfLeaves(psstrm, true);
+ }
+ }
+
+public: // for transduction logging
+ bool m_fAdvXSet;
+ bool m_fAdvYSet;
+
+}; // end of class GrSlotState
+
+
+/*----------------------------------------------------------------------------------------------
+ A GrSlotOutput represents one slot as the final output of the final pass. These
+ are recorded in the segment.
+
+ Hungarian: slout
+----------------------------------------------------------------------------------------------*/
+class GrSlotOutput : public GrSlotAbstract
+{
+ friend class GlyphInfo;
+ friend class Segment;
+ friend class SegmentMemoryUsage;
+
+public:
+ GrSlotOutput()
+ {
+ m_cComponents = 0;
+ m_isloutClusterBase = -1; // not part of any cluster
+ m_disloutCluster = 0;
+ m_igbb = -1;
+ }
+
+ void ExactCopyFrom(GrSlotOutput * pslout, u_intslot * pnVarLenBuf, int cnExtraPerSlot);
+
+ void InitializeOutputFrom(GrSlotState * pslot);
+
+ int BeforeAssoc()
+ {
+ return m_ichwBeforeAssoc; // relative to the official beginning of the segment
+ }
+ int AfterAssoc()
+ {
+ return m_ichwAfterAssoc; // relative to the official beginning of the segment
+ }
+
+ void SetBeforeAssoc(int ichw)
+ {
+ m_ichwBeforeAssoc = ichw;
+ }
+ void SetAfterAssoc(int ichw)
+ {
+ m_ichwAfterAssoc = ichw;
+ }
+ void AddComponentReference(int ichw, int slati)
+ {
+ if (m_cComponents >= m_cnCompPerLig)
+ {
+ Assert(false); // ignore the requested component ref
+ }
+ else
+ {
+ m_prgnVarLenBuf[m_cComponents].nValue
+ = ichw;
+
+ // OBSOLETE comment:
+ // Maps the used components to the defined components. Normally this will be
+ // one-to-one and the buffer will hold [0,1,2...]. But possibly we may
+ // have defined components a, b, and c, but only mapped a and c to actual
+ // characters. This buffer will then hold [0,2].
+
+ m_prgnVarLenBuf[m_cnCompPerLig + m_cComponents].nValue
+ = slati;
+
+// Assert(iComp >= m_cComponents); // because we process them in order they are defined
+ // in, but we could have skipped some that are
+ // defined
+ m_cComponents++;
+ }
+ }
+ int NumberOfComponents() // the number used by the rules
+ {
+ return m_cComponents;
+ }
+ // Index of ligature components, relative to the beginning of the segment.
+ // iComp is index of components USED in this glyph.
+ int UnderlyingComponent(int iComp)
+ {
+ Assert(iComp < m_cnCompPerLig);
+ return m_prgnVarLenBuf[iComp].nValue;
+ }
+ int ComponentId(int iComp)
+ {
+ return m_prgnVarLenBuf[m_cnCompPerLig + iComp].nValue;
+ }
+
+ //u_intslot * PCompRefBufSlout()
+ //{
+ // return m_prgnVarLenBuf;
+ //}
+
+ int CExtraSpaceSlout()
+ {
+ return (m_cnCompPerLig * 2);
+ }
+
+ void SetClusterBase(int islout)
+ {
+ m_isloutClusterBase = islout;
+ }
+
+ int ClusterBase()
+ {
+ return m_isloutClusterBase;
+ }
+
+ bool IsPartOfCluster()
+ {
+ return (m_isloutClusterBase > -1);
+ }
+
+ //int NumClusterMembers()
+ //{
+ // return m_visloutClusterMembers.size();
+ //}
+ //int ClusterMember(int iislout)
+ //{
+ // return m_visloutClusterMembers[iislout];
+ //}
+
+ void AddClusterMember(int isloutThis, int isloutAttached)
+ {
+ m_disloutCluster = sdata8(max(int(m_disloutCluster), abs(isloutThis - isloutAttached)));
+ }
+
+ void ClusterMembers(Segment * pseg, int islout, std::vector<int> & visloutRet);
+
+ int ClusterRange()
+ {
+ return m_disloutCluster;
+ }
+
+ float ClusterXOffset() { return m_xsClusterXOffset; }
+ float ClusterAdvance() { return m_xsClusterAdvance; }
+ void SetClusterXOffset(float xs) { m_xsClusterXOffset = xs; }
+ void SetClusterAdvance(float xs) { m_xsClusterAdvance = xs; }
+
+ float GlyphMetricLogUnits(Font * pfont, int nGlyphMetric);
+ //float GlyphMetricLogUnits(int nMetricID);
+
+ int GlyphBbIndex() { return m_igbb; }
+ void SetGlyphBbIndex (int i) { m_igbb = i; }
+
+ Rect BoundingBox(Font & font)
+ {
+ Rect rectBB;
+ rectBB.left = m_xsPositionX + GlyphMetricLogUnits(&font, kgmetBbLeft);
+ if (IsSpace())
+ rectBB.right = m_xsPositionX + GlyphMetricLogUnits(&font, kgmetAdvWidth);
+ else
+ rectBB.right = m_xsPositionX + GlyphMetricLogUnits(&font, kgmetBbRight);
+ rectBB.top = m_ysPositionY + GlyphMetricLogUnits(&font, kgmetBbTop);
+ rectBB.bottom = m_ysPositionY + GlyphMetricLogUnits(&font, kgmetBbBottom);
+ return rectBB;
+ }
+
+ bool IsLineBreak()
+ {
+ return (IsInitialLineBreak() || IsFinalLineBreak());
+ }
+ bool IsInitialLineBreak()
+ {
+ return (m_spsl == kspslLbInitial);
+ }
+ bool IsFinalLineBreak()
+ {
+ return (m_spsl == kspslLbFinal);
+ }
+
+ //float AdvanceXMetric()
+ //{
+ // return m_xysAdvX;
+ //}
+
+ bool IsSpace();
+
+ void AdjustPosXBy(float dxs)
+ {
+ m_xsPositionX += dxs;
+ //m_rectBB.left += dxs;
+ //m_rectBB.right += dxs;
+ }
+
+ void ShiftForDirDepthChange(float dxsSegWidth);
+
+ // Used by GlyphInfo
+ int IndexAttachedTo();
+ //inline float AdvanceX(Segment * pseg);
+ //inline float AdvanceY(Segment * pseg);
+ float MaxStretch(Segment * pseg, int level);
+ float MaxShrink(Segment * pseg, int level);
+ float StretchStep(Segment * pseg, int level);
+ int JustWeight(int level);
+ float JustWidth(Segment * pseg, int level);
+ float MeasureSolLogUnits(Segment * pseg);
+ float MeasureEolLogUnits(Segment * pseg);
+ Rect ComponentRect(Segment * pseg, int icomp);
+
+protected:
+ // Instance variables:
+
+ sdata8 m_cComponents;
+
+ data8 m_disloutCluster; // how far to search on either side of this glyph to find
+ // other members of the cluster;
+ // 0 means there are no cluster members or this glyph is
+ // attached to some other base
+
+ int m_isloutClusterBase; // the index of the slot that serves as the base for the
+ // cluster this slot is a part of; -1 if not part of cluster
+
+ int m_ichwBeforeAssoc; // index of associated character in the string
+ int m_ichwAfterAssoc; // (relative to the official beginning of the segment)
+ // char might possibly not be officially in this segment,
+ // in which case value is infinity
+
+ // Measurements for highlighting an entire cluster, relative to origin of this slot,
+ // which is the cluster base.
+ float m_xsClusterXOffset;
+ float m_xsClusterAdvance; // for single non-cluster glyphs, advance width of positioned glyph
+
+ // Index into m_prggbb in Segment; -1 indicates a line break slot that is not rendered:
+ int m_igbb;
+
+ float m_xsAdvanceX;
+// float m_ysAdvanceY; -- not used
+// Rect m_rectBB;
+
+}; // end of class GrSlotOutput
+
+} // namespace gr
+
+
+#endif // !SLOTSTATE_INCLUDED
diff --git a/Build/source/libs/graphite/src/segment/GrSlotStream.cpp b/Build/source/libs/graphite/src/segment/GrSlotStream.cpp
new file mode 100644
index 00000000000..db6a5c8af7e
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrSlotStream.cpp
@@ -0,0 +1,2368 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrSlotStream.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ GrSlotStream class implementation.
+----------------------------------------------------------------------------------------------*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+
+#include "GrConstants.h"
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:End Ignore
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Answer true if there is nothing valid available to read from the stream.
+----------------------------------------------------------------------------------------------*/
+bool GrSlotStream::AtEnd()
+{
+ Assert(AssertValid());
+
+ if (m_islotReprocPos > -1 && m_islotReprocPos < signed(m_vpslotReproc.size()))
+ return false;
+
+ if (m_islotSegLim > -1 && m_islotReadPos >= m_islotSegLim)
+ // We've determined the segment limit, and we're at or past it.
+ return true;
+
+ return (m_islotReadPos == m_islotWritePos);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Answer true if there is nothing at all available to read from the stream.
+ For substitution passes, we need to consider slots that may be beyond what we know
+ will be the official end of the segment.
+----------------------------------------------------------------------------------------------*/
+bool GrSlotStream::AtEndOfContext()
+{
+ if (m_fUsedByPosPass)
+ return AtEnd();
+
+ if (m_islotReprocPos > -1 && m_islotReprocPos < signed(m_vpslotReproc.size()))
+ return false;
+
+ return (m_islotReadPos == m_islotWritePos);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Append a slot to the end of the stream.
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::NextPut(GrSlotState * pslot)
+{
+ Assert(AssertValid());
+
+ if (m_islotWritePos < signed(m_vpslot.size()))
+ {
+ m_vpslot[m_islotWritePos] = pslot;
+ }
+ else
+ {
+ m_vpslot.push_back(pslot);
+ m_vislotPrevChunkMap.push_back(-1);
+ m_vislotNextChunkMap.push_back(-1);
+ }
+
+ if (m_fUsedByPosPass && GotIndexOffset())
+ pslot->SetPosPassIndex(m_islotWritePos - m_cslotPreSeg, m_fInputToPosPass1);
+
+ m_islotWritePos++;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the next slot from the stream.
+----------------------------------------------------------------------------------------------*/
+GrSlotState * GrSlotStream::NextGet()
+{
+ Assert(AssertValid());
+ Assert(!AtEndOfContext());
+
+ GrSlotState * pslotRet;
+
+ if (m_islotReprocPos > -1)
+ {
+ if (m_islotReprocPos >= signed(m_vpslotReproc.size()))
+ {
+ // Finished reprocessing.
+ Assert((unsigned)m_islotReprocPos == m_vpslotReproc.size());
+ m_islotReprocPos = -1;
+ // But leave the m_vpslotReproc array in place so that earlier slots can
+ // be accessed by the rules.
+ pslotRet = m_vpslot[m_islotReadPos];
+ m_islotReadPos++;
+ }
+ else
+ {
+ // Read from the reprocess buffer.
+ pslotRet = m_vpslotReproc[m_islotReprocPos];
+ m_islotReprocPos++;
+ }
+ }
+ else
+ {
+ // Read normally.
+ pslotRet = m_vpslot[m_islotReadPos];
+ m_islotReadPos++;
+ }
+
+ Assert(!m_fUsedByPosPass || pslotRet->PosPassIndex() != GrSlotAbstract::kNotYetSet);
+
+ return pslotRet;
+}
+
+/*---------------------------------------------------------------------------------------------
+ Peek at the next slot from the stream (dislot = 0 means the very next slot).
+ Only used for peeking forward. RuleInputSlot is used for accessing any possible
+ slot in the rule's context.
+----------------------------------------------------------------------------------------------*/
+GrSlotState * GrSlotStream::Peek(int dislot)
+{
+ Assert(AssertValid());
+ Assert(!AtEndOfContext());
+ Assert(dislot >= 0);
+
+ GrSlotState * pslotRet;
+
+ if (m_islotReprocPos > -1)
+ {
+ int cslotReproc = m_vpslotReproc.size() - m_islotReprocPos; // num left in reproc buffer
+ if (dislot >= cslotReproc)
+ {
+ // Not quite enough slots in the reprocess buffer.
+ pslotRet = m_vpslot[m_islotReadPos + dislot - cslotReproc];
+ }
+ else if (m_islotReprocPos + dislot < 0)
+ {
+ // Reading prior to the reprocess buffer
+ pslotRet = m_vpslot[m_islotReadPos + dislot - cslotReproc];
+ }
+ else
+ {
+ // Read from the reprocess buffer.
+ pslotRet = m_vpslotReproc[m_islotReprocPos + dislot];
+ }
+ }
+ else
+ {
+ // Read normally.
+ Assert(m_islotWritePos - m_islotReadPos > dislot);
+ pslotRet = m_vpslot[m_islotReadPos + dislot];
+ }
+
+ return pslotRet;
+}
+
+/*---------------------------------------------------------------------------------------------
+ Treat the stream, which is really the output stream, as an input stream,
+ retrieving a recently output slot. This happens when we are reading before the
+ current stream position when the rule is being matched, or before the original
+ stream position when the rule is being run.
+
+ @param dislot - how far back to peek before the write position
+ when the rule started; a negative number
+ (NOTE: the current write position is irrelevant)
+ @param fNullOkay - true if it's okay to return NULL in the situation where we're asking
+ for something before the beginning of the stream
+----------------------------------------------------------------------------------------------*/
+GrSlotState * GrSlotStream::PeekBack(int dislot, bool fNullOkay)
+{
+ Assert(dislot < 0);
+ if (dislot < m_islotRuleStartWrite * -1)
+ {
+ Assert(fNullOkay);
+ return NULL;
+ }
+ GrSlotState * pslotRet;
+ if (m_islotReprocPos > -1)
+ {
+ if (dislot < m_islotReprocLim - m_islotRuleStartWrite &&
+ dislot >= m_islotReprocLim - m_islotRuleStartWrite - signed(m_vpslotReproc.size()))
+ {
+ // Read from the reprocess buffer.
+ // Review: this is weird; can it ever happen?
+ pslotRet = m_vpslotReproc[m_vpslotReproc.size()
+ - (m_islotReprocLim - m_islotRuleStartWrite) + dislot];
+ }
+ else
+ pslotRet = m_vpslot[m_islotRuleStartWrite + dislot];
+ }
+ else
+ pslotRet = m_vpslot[m_islotRuleStartWrite + dislot];
+
+ return pslotRet;
+}
+
+/*---------------------------------------------------------------------------------------------
+ Skip the given number of slots in the stream.
+ ENHANCE: implement more efficiently
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::Skip(int dislot)
+{
+ for (int islot = 0; islot < dislot; ++islot)
+ NextGet();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Perform assertions to ensure that the stream is in a valid state.
+----------------------------------------------------------------------------------------------*/
+bool GrSlotStream::AssertValid()
+{
+ Assert(m_islotWritePos <= signed(m_vpslot.size()));
+ Assert(m_islotReadPos <= m_islotWritePos);
+ // Streams used by the positioning passes (input or output) should not be working
+ // with slots beyond the segment lim
+ Assert(m_islotSegLim == -1 || !m_fUsedByPosPass || m_islotReadPos <= m_islotSegLim);
+ Assert(m_vpslot.size() == m_vislotPrevChunkMap.size());
+ Assert(m_vpslot.size() == m_vislotNextChunkMap.size());
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the number of slots that have been completely output by the previous pass but not
+ yet processed by the following pass. ("Completely" output means that they do not need
+ to be reprocessed by the same pass, only then are they available as valid input.)
+ Include any slots that are present by virtue of needing to be reprocessed by the
+ corresponding output stream.
+----------------------------------------------------------------------------------------------*/
+int GrSlotStream::SlotsPending()
+{
+ Assert(AssertValid());
+ if (m_islotSegLim > -1)
+ return (m_islotSegLim - m_islotReadPos + SlotsToReprocess());
+ else
+ return (m_islotWritePos - m_islotReadPos + SlotsToReprocess());
+}
+
+int GrSlotStream::SlotsPendingInContext()
+{
+ Assert(AssertValid());
+ if (m_fUsedByPosPass)
+ return SlotsPending();
+ else
+ return (m_islotWritePos - m_islotReadPos + SlotsToReprocess());
+}
+
+int GrSlotStream::TotalSlotsPending()
+{
+ int cslot = SlotsPendingInContext();
+ if (m_fUsedByPosPass && m_islotSegLim > -1)
+ {
+ int ctmp = m_islotWritePos - m_islotReadPos + SlotsToReprocess();
+ if (ctmp > cslot)
+ {
+ int x; x = 3;
+ }
+ cslot = max(cslot, ctmp);
+ }
+ return cslot;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if this pass is input or output to a positioning pass and we're past the end
+ of the segment. So this stream is virtually finished.
+----------------------------------------------------------------------------------------------*/
+bool GrSlotStream::PastEndOfPositioning(bool fOutput)
+{
+ if (m_fUsedByPosPass && m_islotSegLim > -1)
+ {
+ if (fOutput) // this stream is functioning as an output stream
+ return (m_islotWritePos >= m_islotSegLim);
+ else // this stream is functioning as an input stream
+ return (m_islotReadPos >= m_islotSegLim);
+ }
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Mark the stream as fully written, so that the output pass doesn't keep trying to ask
+ for more input.
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::MarkFullyWritten()
+{
+ m_fFullyWritten = true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the position of the first glyph at or following the given position
+ that is in the top direction, or -1 if we do not have a complete range.
+
+ @param ptman
+ @param islotStart
+ @nTopDirLevel - top direction: 0 = left-to-right, 1 = right-to-left
+----------------------------------------------------------------------------------------------*/
+int GrSlotStream::OldDirLevelRange(EngineState * pengst, int islotStart, int nTopDirLevel)
+{
+ Assert(m_islotReadPos <= islotStart);
+ Assert(islotStart < m_islotWritePos);
+
+ int islot = islotStart;
+ int nSlotDirLevel = GetSlotDirLevel(pengst, islot, nTopDirLevel, nTopDirLevel,
+ kdircUnknown, kdircNeutral);
+ if (nSlotDirLevel == -1)
+ return -1;
+ while (nSlotDirLevel > nTopDirLevel)
+ {
+ islot++;
+ if (islot >= m_islotWritePos)
+ {
+ if (m_fFullyWritten)
+ return islot;
+ else
+ return -1;
+ }
+ else if (m_islotSegLim > -1 && islot >= m_islotSegLim)
+ {
+ return islot;
+ }
+
+ nSlotDirLevel = GetSlotDirLevel(pengst, islot, nTopDirLevel, nTopDirLevel,
+ kdircUnknown, kdircNeutral);
+ if (nSlotDirLevel == -1)
+ return -1;
+ }
+ return islot;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the position of the first glyph at or following the given position
+ that is in the top direction, or -1 if we do not have a complete range.
+
+ @param ptman
+ @param islotStart
+ @nTopDirLevel - top direction: 0 = left-to-right, 1 = right-to-left
+----------------------------------------------------------------------------------------------*/
+int GrSlotStream::DirLevelRange(EngineState * pengst, int islotStart, int nTopDirLevel,
+ std::vector<int> & vislotStarts, std::vector<int> & vislotStops)
+{
+ Assert(m_islotReadPos <= islotStart);
+ Assert(islotStart < m_islotWritePos);
+
+ std::vector<int> vislotStartStack; // indices of starts of ranges to reverse
+
+ // Stack corresponding to embedding and override markers:
+ std::vector<DirCode> vdircMarkerStack;
+ std::vector<DirCode> vdircOverrideStack;
+ std::vector<int> vnLevelStack;
+
+ vislotStarts.clear();
+ vislotStops.clear();
+
+ //vislotStartStack.Push(islot);
+
+ int islotSegLim = (FullyWritten() || m_islotSegLim > -1) ?
+ FinalSegLim() :
+ WritePos() + 100; // arbitrarily large number
+
+ if (islotStart > islotSegLim)
+ {
+ // Don't do anything fancy with stuff beyond the end of the segment.
+ return 0;
+ }
+
+ DirCode dircMarker = kdircNeutral; // none so far
+ int nCurrLevel = nTopDirLevel;
+ int nMarkerLevel = nTopDirLevel;
+ //bool fHitMark = false;
+ DirCode dircOverride = kdircNeutral;
+ int islot = islotStart;
+ Assert(islot <= m_islotWritePos);
+
+ while (true)
+ {
+ GrSlotState * pslot = m_vpslot[islot];
+ DirCode dirc = pslot->DirProcessed();
+ bool fIncludeLast = false;
+ int nSlotDirLevel;
+ if (dirc == kdircLRO || dirc == kdircLRE) // steps X1, X3 in the Unicode bidi algorithm
+ {
+ vdircMarkerStack.push_back(dircMarker);
+ vdircOverrideStack.push_back(dircOverride);
+ vnLevelStack.push_back(nCurrLevel);
+ dircMarker = dirc;
+ dircOverride = (dirc == kdircLRO) ? kdircL : kdircNeutral;
+ nSlotDirLevel = (nCurrLevel % 2) ?
+ nCurrLevel + 1 : nCurrLevel + 2; // next highest LTR level
+ nMarkerLevel = nSlotDirLevel;
+
+ pslot->SetDirProcessed(dircMarker);
+ pslot->SetDirLevel(nMarkerLevel);
+ pslot->MarkDirProcessed();
+ }
+ else if (dirc == kdircRLO || dirc == kdircRLE) // steps X2, X4
+ {
+ vdircMarkerStack.push_back(dircMarker);
+ vdircOverrideStack.push_back(dircOverride);
+ vnLevelStack.push_back(nCurrLevel);
+ dircMarker = dirc;
+ dircOverride = (dirc == kdircRLO) ? kdircR : kdircNeutral;
+ nSlotDirLevel = (nCurrLevel % 2) ?
+ nCurrLevel + 2 : nCurrLevel + 1; // next highest RTL level
+ nMarkerLevel = nSlotDirLevel;
+
+ pslot->SetDirProcessed(dircMarker);
+ pslot->SetDirLevel(nMarkerLevel);
+ pslot->MarkDirProcessed();
+ }
+ else if (dirc == kdircPDF)
+ {
+ if (dircMarker == kdircNeutral)
+ pslot->SetDirProcessed((nCurrLevel % 2) ? kdircR : kdircL);
+ else
+ pslot->SetDirProcessed(RightToLeftDir(dircMarker) ? kdircPdfR : kdircPdfL);
+ pslot->SetDirLevel(nMarkerLevel);
+ pslot->MarkDirProcessed();
+
+ if (vnLevelStack.size())
+ {
+ dircMarker = vdircMarkerStack.back();
+ vdircMarkerStack.pop_back();
+ dircOverride = vdircOverrideStack.back();
+ vdircOverrideStack.pop_back();
+ nMarkerLevel = vnLevelStack.back();
+ vnLevelStack.pop_back();
+ nSlotDirLevel = nMarkerLevel;
+ fIncludeLast = true;
+ }
+ else // ignore
+ nSlotDirLevel = nCurrLevel;
+ }
+ else
+ {
+ nSlotDirLevel = GetSlotDirLevel(pengst, islot, nTopDirLevel, nMarkerLevel,
+ dircMarker, dircOverride);
+ if (nSlotDirLevel == -1)
+ return -1; // not enough slots
+ }
+
+ Assert(pengst->WhiteSpaceOnly() || nCurrLevel >= nTopDirLevel);
+ while (nSlotDirLevel > nCurrLevel)
+ {
+ vislotStartStack.push_back(islot);
+ nCurrLevel++;
+ }
+ // otherwise...
+ while (nTopDirLevel <= nCurrLevel && nSlotDirLevel < nCurrLevel)
+ {
+ if (vislotStartStack.size())
+ {
+ int islotStartTmp = vislotStartStack.back();
+ vislotStartStack.pop_back();
+ vislotStarts.push_back(islotStartTmp);
+ vislotStops.push_back(islot - 1); // previous character was the end of the range
+ }
+ else
+ Assert(pengst->WhiteSpaceOnly()); // the space is higher than the segment itself
+ nCurrLevel--;
+ }
+ // In the case of white-space-only segments, the space may be bumped up to a level
+ // higher than the segment itself.
+ Assert(pengst->WhiteSpaceOnly() || vislotStartStack.size() + nTopDirLevel == (unsigned)nCurrLevel);
+ Assert(pengst->WhiteSpaceOnly() || vnLevelStack.size() == vdircMarkerStack.size());
+ Assert(pengst->WhiteSpaceOnly() || vdircOverrideStack.size() == vdircMarkerStack.size());
+
+ if (nCurrLevel <= nTopDirLevel)
+ {
+ if (fIncludeLast)
+ {
+ // Include in the range to reverse the PDF or the char after the LRM/RLM.
+ // (Note: don't use a size_t below: we are decrementing below zero.)
+ for (int i = signed(vislotStops.size()) - 1; i >= 0 && vislotStops[i] == islot-1; i--)
+ {
+ vislotStops[i] = islot;
+ }
+ islot++;
+ }
+ break; // reached end of reversible range
+ }
+
+ islot++;
+ if (islot >= m_islotWritePos)
+ {
+ if (m_fFullyWritten)
+ break; // end of input
+ else
+ return -1; // not enough slots
+ }
+ else if (islot >= islotSegLim)
+ {
+ break; // end of input
+ }
+ }
+
+ // Reached the end of a reversable range.
+ while (vislotStartStack.size() > 0)
+ {
+ int islotStartTmp = vislotStartStack.back();
+ vislotStartStack.pop_back();
+ vislotStarts.push_back(islotStartTmp);
+ //vislotStops.push_back(min(islot, ReadPos() - 1));
+ //vislotStops.push_back(min(islot, max(ReadPos() - 1, islotStartTmp)));
+ vislotStops.push_back(min(islot - 1, islotSegLim - 1));
+ nCurrLevel--;
+ }
+ Assert(pengst->WhiteSpaceOnly() || nCurrLevel == nTopDirLevel);
+ Assert(vislotStarts.size() == vislotStops.size());
+
+ // The start- and stop-lists were generated in the order that we hit the stops, in other
+ // words, from inner to outer. Which is the order in which we need to do the reversals, too.
+
+ return islot;
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Return the direction level of the glyph at the given position, according to the
+ Unicode bidi algorithm. Return -1 if there aren't enough slots in the stream to
+ figure it out.
+
+ ???? How should this handle the reprocessing sub-stream????
+
+ @param ptman
+ @param islot - slot for which information is requested
+ @param nOuterLevel - 0 = left-to-right, 1 = right-to-left
+ @param nCurrLevel
+ @param dircMarker - most recent override or embedding marker, if any
+ (for interpreting PDF codes)
+ @param dircOverride - override imposed by LRO or RLO
+----------------------------------------------------------------------------------------------*/
+int GrSlotStream::GetSlotDirLevel(EngineState * pengst, int islot,
+ int nOuterLevel, int nCurrLevel, DirCode dircMarker, DirCode dircOverride)
+{
+// Assert(m_psstrmReprocess == NULL);
+
+ GrSlotState * pslot = m_vpslot[islot];
+
+ int nDirLevel = pslot->DirLevel();
+ if (nDirLevel > -1)
+ // already figured out
+ return nDirLevel;
+
+ if (pengst->WhiteSpaceOnly())
+ {
+ // White-space-only segments should not have any reordering.
+ nDirLevel = pengst->ParaRightToLeft();
+ pslot->SetDirLevel(nDirLevel);
+ pslot->MarkDirProcessed();
+ return nDirLevel;
+ }
+
+ DirCode dirc = pslot->DirProcessed();
+
+ if (!pslot->DirHasBeenProcessed() && (WeakDir(dirc) || NeutralDir(dirc)) )
+ {
+ // Resolve weak and neutral types; process an entire run of weak types at once,
+ // in several passes.
+
+ int islotWeakRunLim = islot + 1;
+ while (true)
+ {
+ if (islotWeakRunLim >= m_islotWritePos)
+ {
+ if (!m_fFullyWritten)
+ return -1; // get more slots
+ else
+ break;
+ }
+ else if (m_islotSegLim > -1 && islotWeakRunLim >= SegLimIfKnown())
+ {
+ break;
+ }
+ if (StrongDir(m_vpslot[islotWeakRunLim]->DirProcessed()))
+ // ignore the line-break; we need the next strong dir after that
+ //// && !m_vpslot[islotWeakRunLim]->IsFinalLineBreak(ptman->LBGlyphID()))
+ {
+ break;
+ }
+ if (m_vpslot[islotWeakRunLim]->DirProcessed() == kdircPDF &&
+ dircMarker != kdircUnknown)
+ {
+ // A valid PDF is a strong code. TODO: replace kdircPDF with kdircPdfL/R
+ break;
+ }
+
+ islotWeakRunLim++;
+ }
+
+ int islotLp;
+
+ // X6. Handle directional overrides: LRO, RLO.
+ if (dircOverride != kdircNeutral)
+ {
+ for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++)
+ {
+ m_vpslot[islotLp]->SetDirProcessed(dircOverride);
+ m_vpslot[islotLp]->MarkDirProcessed();
+ }
+ goto LSetDir;
+ }
+
+ DirCode dircLp;
+ //DirCode dircTmp;
+
+ // W1. Non-spacing marks get the type of the previous slot.
+ for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++)
+ {
+ Assert(!m_vpslot[islotLp]->DirHasBeenProcessed());
+
+ if (m_vpslot[islotLp]->DirProcessed() == kdircNSM)
+ {
+#ifdef _DEBUG
+ if (islotLp <= 0)
+ {
+ Warn("Pathological case in bidi algorithm");
+ }
+#endif // _DEBUG
+ dircLp = AdjacentNonBndNeutralCode(pengst, islotLp - 1, -1, dircMarker);
+
+ m_vpslot[islotLp]->SetDirProcessed(dircLp);
+ }
+ }
+
+ // W2. European numbers are changed to Arabic numbers if the previous strong type
+ // was an Arabic letter.
+ DirCode dircPrevStrong = AdjacentStrongCode(pengst, islot - 1, -1, dircMarker);
+ if (dircPrevStrong == kdircRArab)
+ {
+ for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++)
+ {
+ dircLp = m_vpslot[islotLp]->DirProcessed();
+ if (dircLp == kdircEuroNum)
+ m_vpslot[islotLp]->SetDirProcessed(kdircArabNum);
+ }
+ }
+
+ // W4. A single European separator between two Latin numbers changes to a Latin number.
+ // A single common separator between two numbers of the same type changes to that
+ // type.
+ for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++)
+ {
+ dircLp = m_vpslot[islotLp]->DirProcessed();
+ if ((dircLp == kdircEuroSep || dircLp == kdircComSep) &&
+ islotLp + 1 < m_islotWritePos) // don't test last slot in stream
+ {
+ DirCode dircPrev = AdjacentNonBndNeutralCode(pengst, islotLp - 1, -1, dircMarker);
+ DirCode dircNext = AdjacentNonBndNeutralCode(pengst, islotLp + 1, 1, dircMarker);
+ if (dircPrev == dircNext)
+ {
+ if (dircLp == kdircEuroSep && dircPrev == kdircEuroNum)
+ {
+ m_vpslot[islotLp]->SetDirProcessed(kdircEuroNum);
+ }
+ else if (dircLp == kdircComSep &&
+ (dircPrev == kdircEuroNum || dircPrev == kdircArabNum))
+ {
+ m_vpslot[islotLp]->SetDirProcessed(dircPrev);
+ }
+ }
+ }
+ }
+
+ // W5, W6. A sequence of European number terminators adjacent to Latin numbers changes
+ // to Latin numbers.
+ // This appears to be an ambiguity in the official algorithm: do we search backward
+ // first, or forward? For our purposes, it is easier to search backward first.
+ for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++)
+ {
+ dircLp = m_vpslot[islotLp]->DirProcessed();
+ if (dircLp == kdircEuroTerm || dircLp == kdircBndNeutral)
+ {
+ if (TerminatorSequence(pengst, islotLp - 1, -1, dircMarker) == kdircEuroNum)
+ dircLp = kdircEuroNum;
+ else
+ {
+ if (TerminatorSequence(pengst, islotLp + 1, 1, dircMarker) == kdircEuroNum)
+ dircLp = kdircEuroNum;
+ // else could possibly be unknown if we are at the end of the stream
+ }
+ }
+
+ // W6. Separators and terminators change to neutral. (Don't change
+ // boundary neutrals at this point, because that would confuse step Pre-L1.)
+ if (dircLp == kdircEuroSep || dircLp == kdircEuroTerm || dircLp == kdircComSep)
+ {
+ dircLp = kdircNeutral;
+ }
+ m_vpslot[islotLp]->SetDirProcessed(dircLp);
+ }
+
+ // W7. European numbers are changed to plain left-to-right if the previous strong type
+ // was left-to-right.
+ dircPrevStrong = AdjacentStrongCode(pengst, islot - 1, -1, dircMarker);
+ if (dircPrevStrong == kdircL)
+ {
+ for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++)
+ {
+ dircLp = (m_vpslot[islotLp]->DirProcessed());
+ if (dircLp == kdircEuroNum)
+ m_vpslot[islotLp]->SetDirProcessed(kdircL);
+ }
+ }
+
+ // Pre-L1. Make a list of all the trailing whitespace characters that need to take
+ // on the direction of the final line break (ie, the top direction). We can't actually
+ // change them yet, because that would confuse the loop below. But we have to
+ // record them now because they might get changed in the loop below.
+ std::vector<int> vislotTrailingWS;
+ int islotFinalLB = -1;
+ for (islotLp = islotWeakRunLim; islotLp-- > islot; )
+ {
+ if (m_vpslot[islotLp]->IsFinalLineBreak(pengst->TableManager()->LBGlyphID()))
+ {
+ islotFinalLB = islotLp;
+ for (int islotLp2 = islotLp; islotLp2-- > islot; )
+ {
+ dircLp = m_vpslot[islotLp2]->DirProcessed();
+ if (dircLp == kdircWhiteSpace || dircLp == kdircBndNeutral)
+ vislotTrailingWS.push_back(islotLp2);
+ else
+ break; // hit something other than whitespace or neutral
+ }
+ break;
+ }
+ }
+
+ // N1. A sequence of neutrals takes the direction of the strong surrounding text if
+ // the text on both sides has the same direction. Latin and Arabic numbers are treated
+ // as if they are right-to-left.
+ // (If they are not the same, leave the type as neutral.)
+ for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++)
+ {
+ dircLp = m_vpslot[islotLp]->DirProcessed();
+
+ // Change Boundary Neutrals to plain neutrals (must happen after Pre-L1).
+ if (dircLp == kdircBndNeutral)
+ {
+ m_vpslot[islotLp]->SetDirProcessed(kdircNeutral);
+ dircLp = kdircNeutral;
+ }
+
+ if (NeutralDir(dircLp))
+ {
+ // First, look for either a strong code or a number. If we get at least
+ // one strong code and a number with the same direction, use that strong
+ // code.
+ DirCode dircPrev = AdjacentStrongCode(pengst, islotLp - 1, -1, dircMarker, true);
+ DirCode dircNext = AdjacentStrongCode(pengst, islotLp + 1, 1, dircMarker, true);
+
+ if (dircNext == kdircUnknown)
+ return -1;
+
+ if (dircPrev == kdircUnknown)
+ dircPrev = dircNext;
+
+ DirCode dircResult = kdircUnknown;
+ if (dircNext == kdircNeutral)
+ {}
+ else if (RightToLeftDir(dircPrev) == RightToLeftDir(dircNext) &&
+ (StrongDir(dircNext) || StrongDir(dircPrev)))
+ {
+ // Got a strong matching direction.
+ dircResult = (StrongDir(dircPrev)) ? dircPrev : dircNext;
+ }
+ else if (dircNext == kdircPdfL || dircNext == kdircPdfR)
+ {
+ // A following PDF flag wins, because it represents the edge of a run.
+ dircResult = dircNext;
+ }
+ else if (StrongDir(dircNext) && StrongDir(dircPrev))
+ { // We must have text in different directions.
+ }
+ else
+ {
+ // Try again, insisting on strong codes, no numbers.
+ if (!StrongDir(dircPrev))
+ dircPrev = AdjacentStrongCode(pengst, islotLp - 1, -1, dircMarker, false);
+ if (!StrongDir(dircNext))
+ dircNext = AdjacentStrongCode(pengst, islotLp + 1, 1, dircMarker, false);
+ if (dircPrev == kdircUnknown)
+ dircPrev = dircNext;
+
+ if (RightToLeftDir(dircPrev) == RightToLeftDir(dircNext) &&
+ (StrongDir(dircNext) || StrongDir(dircPrev)))
+ {
+ // Got a strong matching direction.
+ dircResult = (StrongDir(dircPrev)) ? dircPrev : dircNext;
+ }
+ }
+
+ if (dircResult != kdircUnknown)
+ {
+ dircResult = (RightToLeftDir(dircResult)) ? kdircR : kdircL;
+ m_vpslot[islotLp]->SetDirProcessed(dircResult);
+ }
+ // else leave as neutral
+ }
+ }
+
+ // L1. Now change trailing neutrals recorded above to the directionality of
+ // the immediately following line-break, if any.
+ if (islotFinalLB != -1)
+ {
+ DirCode dircLB = m_vpslot[islotFinalLB]->DirProcessed();
+ dircLB = (dircLB == kdircLlb) ? kdircL : kdircR;
+ for (int iislot = 0; iislot < signed(vislotTrailingWS.size()); iislot++)
+ {
+ int islotTmp = vislotTrailingWS[iislot];
+ m_vpslot[islotTmp]->SetDirProcessed(dircLB);
+ }
+ }
+
+ // Mark all the slots processed.
+ for (islotLp = islot; islotLp < islotWeakRunLim; islotLp++)
+ m_vpslot[islotLp]->MarkDirProcessed();
+ }
+ else
+ m_vpslot[islot]->MarkDirProcessed();
+
+LSetDir:
+
+ // Final resolution.
+
+ dirc = pslot->DirProcessed();
+
+ if (dirc != kdircLlb && dirc != kdircRlb && dircOverride != kdircNeutral)
+ {
+ // Enforce whatever is imposed by the override.
+ m_vpslot[islot]->SetDirProcessed(dircOverride);
+ nDirLevel = nCurrLevel;
+ }
+ else if ((nCurrLevel % 2) == 0) // current level is even (left-to-right)
+ {
+ switch (dirc)
+ {
+ case kdircNeutral:
+ case kdircWhiteSpace:
+ nDirLevel = nCurrLevel;
+ break;
+
+ case kdircL:
+ nDirLevel = nCurrLevel;
+ break;
+
+ case kdircLlb:
+ case kdircRlb: // all line-breaks have the direction of the paragraph
+ nDirLevel = nOuterLevel;
+ break;
+
+ case kdircR:
+ case kdircRArab:
+ nDirLevel = nCurrLevel + 1;
+ break;
+
+ case kdircEuroNum:
+ case kdircArabNum:
+ nDirLevel = nCurrLevel + 2;
+ break;
+
+ default:
+ Assert(false);
+ nDirLevel = nCurrLevel;
+ }
+ }
+ else // current level is odd (right-to-left)
+ {
+ switch (dirc)
+ {
+ case kdircNeutral:
+ case kdircWhiteSpace:
+ nDirLevel = nCurrLevel;
+ break;
+
+ case kdircR:
+ //case kdircRlb:
+ case kdircRArab:
+ nDirLevel = nCurrLevel;
+ break;
+
+ case kdircL:
+ //case kdircLlb:
+ case kdircEuroNum:
+ case kdircArabNum:
+ nDirLevel = nCurrLevel + 1;
+ break;
+
+ case kdircLlb:
+ case kdircRlb: // all line-breaks have the direction of the paragraph
+ nDirLevel = nOuterLevel;
+ break;
+
+ default:
+ Assert(false);
+ nDirLevel = nCurrLevel;
+ }
+ }
+ pslot->SetDirLevel(nDirLevel);
+
+ return nDirLevel;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the next or previous strong code, kdircNeutral if we don't find one,
+ or kdircUnknown if we need more slots to process.
+
+ @param islot - index of slot of interest
+ @param nInc - +1 to search forward, -1 to search backward
+ @param fNumbersAreStrong - true if we want to treat numbers as having strong
+ directionality
+ @param dircPDF - how to interpret PDF codes (from corresponding RLO, etc)
+----------------------------------------------------------------------------------------------*/
+DirCode GrSlotStream::AdjacentStrongCode(EngineState * pengst, int islot, int nInc,
+ DirCode dircPDF, bool fNumbersAreStrong)
+{
+ if (islot < 0)
+ return pengst->InitialStrongDir();
+
+ else if (islot >= m_islotWritePos)
+ {
+ if (m_fFullyWritten || (m_islotSegLim > -1 && islot >= SegLimIfKnown()))
+ return kdircNeutral;
+ else
+ return kdircUnknown;
+ }
+
+ DirCode dirc = m_vpslot[islot]->DirProcessed();
+
+ if (dirc == kdircPDF && StrongDir(dircPDF))
+ return (RightToLeftDir(dircPDF)) ? kdircPdfR : kdircPdfL;
+ if (StrongDir(dirc))
+ return dirc;
+ if (fNumbersAreStrong && (dirc == kdircEuroNum || dirc == kdircArabNum))
+ return dirc;
+
+ return AdjacentStrongCode(pengst, islot + nInc, nInc, dircPDF, fNumbersAreStrong);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return kdircEuroNum if there is a terminator sequence starting or ending with a
+ European number. Return kdircUnknown if we need more slots to process.
+ Return kdircNeutral otherwise.
+
+ @param islot - index of slot of interest
+ @param nInc - +1 to search forward, -1 to search backward
+ @param dircPDF - how to interpret PDF codes (from corresponding RLO, etc)
+----------------------------------------------------------------------------------------------*/
+DirCode GrSlotStream::TerminatorSequence(EngineState * pengst, int islot, int nInc,
+ DirCode dircPDF)
+{
+ if (islot < 0)
+ return pengst->InitialTermDir();
+
+ else if (islot >= m_islotWritePos)
+ {
+ if (m_fFullyWritten)
+ return kdircNeutral;
+ else
+ return kdircUnknown;
+ }
+
+ DirCode dirc = m_vpslot[islot]->DirProcessed();
+
+ if (dirc == kdircPDF)
+ return (RightToLeftDir(dircPDF)) ? kdircPdfR : kdircPdfL;
+ else if (dirc == kdircEuroNum)
+ // number found at end of terminator sequence
+ return kdircEuroNum;
+ else if (dirc == kdircEuroTerm)
+ // yes, this slot is a terminator; are there more?
+ return TerminatorSequence(pengst, islot + nInc, nInc, dircPDF);
+ else if (dirc == kdircLlb || dirc == kdircRlb)
+ // line-break slot--ignore and keep going
+ return TerminatorSequence(pengst, islot + nInc, nInc, dircPDF);
+ else if (dirc == kdircBndNeutral)
+ // boundary neutral--ignore and keep going
+ return TerminatorSequence(pengst, islot + nInc, nInc, dircPDF);
+ else
+ // no number found
+ return kdircNeutral;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the previous code that is not a Boundary Neutral. Return Other Neutral if there
+ is no such.
+
+ @param islot - index of slot of interest
+ @param nInc - +1 to search forward, -1 to search backward
+ @param dircPDF - how to interpret PDF codes (from corresponding RLO, etc)
+----------------------------------------------------------------------------------------------*/
+DirCode GrSlotStream::AdjacentNonBndNeutralCode(EngineState * pengst, int islot, int nInc,
+ DirCode dircPDF)
+{
+ Assert(islot < m_islotWritePos);
+ if (islot < 0)
+ return kdircNeutral; // or should we use: ptman->InitialStrongDir() ??
+
+ else if (islot >= m_islotWritePos)
+ {
+ if (m_fFullyWritten)
+ return kdircNeutral;
+ else
+ return kdircUnknown;
+ }
+
+ DirCode dirc = m_vpslot[islot]->DirProcessed();
+
+ if (dirc == kdircBndNeutral)
+ return AdjacentNonBndNeutralCode(pengst, islot + nInc, nInc, dircPDF);
+ else if (dirc == kdircPDF)
+ return (RightToLeftDir(dircPDF)) ? kdircPdfR : kdircPdfL;
+ else
+ return dirc;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Directionality type functions.
+----------------------------------------------------------------------------------------------*/
+bool StrongDir(DirCode dirc)
+{
+ return (dirc == kdircL || dirc == kdircR || dirc == kdircRArab ||
+ dirc == kdircLRO || dirc == kdircRLO || dirc == kdircLRE || dirc == kdircRLE ||
+ dirc == kdircPdfL || dirc == kdircPdfR);
+}
+
+bool WeakDir(DirCode dirc)
+{
+ return (dirc == kdircEuroNum || dirc == kdircEuroSep ||
+ dirc == kdircEuroTerm || dirc == kdircArabNum ||
+ dirc == kdircComSep || dirc == kdircBndNeutral || dirc == kdircNSM);
+}
+
+bool NeutralDir(DirCode dirc)
+{
+ return (dirc == kdircWhiteSpace || dirc == kdircNeutral);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Special values used by the bidi algorithm.
+----------------------------------------------------------------------------------------------*/
+bool BidiCode(int nUnicode)
+{
+ switch (nUnicode)
+ {
+ case knLRM:
+ case knRLM:
+ case knLRO:
+ case knRLO:
+ case knLRE:
+ case knRLE:
+ case knPDF:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if the directionality should be treated as right-to-left.
+ Used for the step of resolving neutrals (N1).
+----------------------------------------------------------------------------------------------*/
+bool RightToLeftDir(DirCode dirc)
+{
+ switch (dirc)
+ {
+ case kdircL:
+ case kdircLRO:
+ case kdircLRE:
+ case kdircPdfL:
+ return false;
+
+ case kdircR:
+ case kdircRArab:
+ case kdircArabNum:
+ case kdircEuroNum:
+ case kdircRLO:
+ case kdircRLE:
+ case kdircPdfR:
+ return true;
+
+ case kdircNeutral:
+ return false;
+
+ default:
+ Assert(false);
+ return false;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Copy a slot from prevStream, incrementing the positions.
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::CopyOneSlotFrom(GrSlotStream * psstrmPrev)
+{
+#ifdef _DEBUG
+ gid16 chw; chw = psstrmPrev->Peek()->GlyphID();
+#endif
+
+ // If we are exactly at the segment boundary, pass the information on to this stream.
+ if (psstrmPrev->AtSegMin())
+ SetSegMinToWritePos();
+ if (psstrmPrev->AtSegLim())
+ SetSegLimToWritePos();
+
+ NextPut(psstrmPrev->NextGet());
+
+ AssertValid();
+ psstrmPrev->AssertValid();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Copy one slot from the input stream to the recipient, which is the output stream.
+ Used when reversing ranges of glyphs; caller is responsible for adjusting the read-
+ and write-positions of the streams.
+
+ REVIEW: How should this handle the reprocessing sub-stream? Currently this is not a problem
+ because this function is only used by the bidi pass, which never has intra-pass
+ reprocessing.
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::SimpleCopyFrom(GrSlotStream * psstrmI, int islotInput, int islotOutput)
+{
+ if (signed(m_vpslot.size()) < islotOutput + 1)
+ {
+ m_vpslot.resize(islotOutput + 1);
+ m_vislotPrevChunkMap.resize(islotOutput + 1);
+ m_vislotNextChunkMap.resize(islotOutput + 1);
+ }
+
+ m_vpslot[islotOutput] = psstrmI->m_vpslot[islotInput];
+ m_vislotPrevChunkMap[islotOutput] = -1;
+ m_vislotNextChunkMap[islotOutput] = -1;
+
+ Assert(m_fUsedByPosPass);
+ if (m_fUsedByPosPass && GotIndexOffset())
+ m_vpslot[islotOutput]->SetPosPassIndex(islotOutput - m_cslotPreSeg, m_fInputToPosPass1);
+
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if there is physical space to add more glyphs, false if the positioning
+ has caused them to use all the alotted space. Recipient is assumed to be output
+ stream from the final pass.
+
+ @param ptman - table manager, for handling the positioning
+ @param pgg - graphics device
+ @param xsSpaceAllotted - how much space is available
+ @param fWidthIsCharCount - kludge for test procedures
+ @param fIgnoreTrailingWS - true if we are ignoring trailing white-space (currently
+ always true)
+ @param twsh - how the segment is handling trailing white-space
+ @param pxsWidth - return width of stuff so far
+----------------------------------------------------------------------------------------------*/
+bool GrSlotStream::MoreSpace(GrTableManager * ptman,
+ float xsSpaceAllotted, bool fWidthIsCharCount,
+ bool fIgnoreTrailingWS, TrWsHandling twsh,
+ float * pxsWidth)
+{
+ Assert(ptman->NumberOfPasses() - 1 == m_ipass);
+
+ if (fWidthIsCharCount)
+ {
+ // Used in test procedures
+ *pxsWidth = (float)m_islotWritePos;
+ return (m_islotWritePos < xsSpaceAllotted);
+ }
+ else
+ {
+ *pxsWidth = -1;
+ if (!GotIndexOffset())
+ return true;
+ if (WritePos() <= IndexOffset())
+ return true;
+ int dislot = MaxClusterSlot(WritePos());
+ if (dislot == kNegInfinity || dislot > 0)
+ // We're in the middle of processing a cluster--we have to keep processing,
+ // so for now assume there is more space.
+ return true;
+
+ float xsWidth, xsVisWidth;
+ ptman->CalcPositionsUpTo(m_ipass, NULL, &xsWidth, &xsVisWidth);
+
+ *pxsWidth = (fIgnoreTrailingWS || twsh == ktwshOnlyWs) ? xsVisWidth : xsWidth;
+ return (*pxsWidth < xsSpaceAllotted);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Work backwards from the prevLineBreak position (or if none, the readPos) to find the
+ previous line-break of the given weight or less. Return the position of the inserted
+ line-break slot, or -1 if no appropriate break point was found. Recipient should be
+ the output of the final line break pass, or if none, the output of the
+ glyph-generation pass.
+
+ @param ptman - table manager, for supplying new slots
+ @param islotPrevBreak - position of previous inserted line break
+ @param fInsertedLB - did we actually insert a line-break glyph before?
+ @param islotStartTry - where to start looking, or -1 for the end of the stream
+ @param lb - (max) break weight to allow
+ @param twsh - how we are handling trailing white-space
+ @param islotMin - first slot that is officially part of the segment (after initial LB)
+ @param plbNextToTry - the best we found
+----------------------------------------------------------------------------------------------*/
+int GrSlotStream::InsertLineBreak(GrTableManager * ptman,
+ int islotPrevBreak, bool fInsertedLB, int islotStartTry,
+ LineBrk lb, TrWsHandling twsh, int islotMin,
+ LineBrk * plbNextToTry)
+{
+ EngineState * pengst = ptman->State();
+
+ Assert(!fInsertedLB || islotPrevBreak > -1);
+
+ int ichwSegOffset;
+ int islot;
+ LineBrk lbFound;
+ if (!FindSegmentEnd(ptman, islotStartTry, lb, twsh, islotMin,
+ &islot, &ichwSegOffset, &lbFound, plbNextToTry))
+ {
+ return -1; // didn't find a legal break
+ }
+
+ GrSlotState * pslotCopyFeat = pengst->AnAdjacentSlot(m_ipass, islot + 1);
+ Assert(pslotCopyFeat);
+
+ if (islotPrevBreak > -1 && fInsertedLB)
+ {
+ //GrSlotState * pslotOld = m_vpslot[islotPrevBreak];
+
+ m_vpslot.erase(m_vpslot.begin() + islotPrevBreak);
+ m_vislotPrevChunkMap.erase(m_vislotPrevChunkMap.begin() + islotPrevBreak);
+ m_vislotNextChunkMap.erase(m_vislotNextChunkMap.begin() + islotPrevBreak);
+ AdjustPrevStreamNextChunkMap(ptman, islotPrevBreak + 1, -1);
+ }
+ else
+ {
+ m_islotReadPos++;
+ m_islotWritePos++;
+ }
+
+ GrSlotState * pslotNew;
+ pengst->NewSlot(ptman->LBGlyphID(), pslotCopyFeat, 0, ichwSegOffset, &pslotNew);
+
+ pslotNew->SetSpecialSlotFlag(kspslLbFinal);
+ pslotNew->SetBreakWeight(lbFound);
+ pslotNew->SetDirectionality(ptman->RightToLeft() ? kdircRlb : kdircLlb);
+
+ int islotLB = islot + 1;
+ m_vpslot.insert(m_vpslot.begin() + islotLB, pslotNew);
+ // Inserting -1 makes it part of a chunk with the previous char/glyph
+ m_vislotPrevChunkMap.insert(m_vislotPrevChunkMap.begin() + islotLB, -1);
+ m_vislotNextChunkMap.insert(m_vislotNextChunkMap.begin() + islotLB, -1);
+ AdjustPrevStreamNextChunkMap(ptman, islotLB, 1);
+ // We don't need to adjust the following stream because we are going to unwind it anyway.
+
+ if (m_fUsedByPosPass && GotIndexOffset())
+ {
+ pslotNew->SetPosPassIndex(islot - m_cslotPreSeg, m_fInputToPosPass1);
+ // Increment the stream index for the following slots.
+ for (int islotTmp = islotLB;
+ islotTmp < ((islotPrevBreak == -1) ? m_islotWritePos : islotPrevBreak + 1);
+ islotTmp++)
+ {
+ SlotAt(islotTmp)->IncPosPassIndex();
+ }
+ }
+
+ m_islotSegLim = islotLB + 1; // after the line-break glyph
+
+ return islotLB;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Make a segment break that does not correspond to a line break; ie, don't insert
+ a line-break glyph.
+
+ Work backwards from the prevLineBreak position (or if none, the readPos) to find the
+ previous line-break of the given weight or less. Return the position of the final slot
+ in the segment, or -1 if no appropriate break point was found. Recipient should be
+ the output of the final line break pass, if any, or the glyph-generation pass.
+
+ @param ptman - table manager, for supplying new slots
+ @param islotPrevBreak - position of previous inserted line break
+ @param fInsertedLB - did we actually insert a line-break glyph previously; currently
+ ignored
+ @param islotStartTry - where to start looking, or -1 for the end of the stream
+ @param lb - (max) break weight to allow
+ @param twsh - how we are handling trailing white-space
+ @param islotMin - first slot that is officially part of the segment (after initial LB)
+----------------------------------------------------------------------------------------------*/
+int GrSlotStream::MakeSegmentBreak(GrTableManager * ptman,
+ int islotPrevBreak, bool fInsertedLB, int islotStartTry,
+ LineBrk lb, TrWsHandling twsh, int islotMin,
+ LineBrk * plbNextToTry)
+{
+ int ichwSegOffset;
+ int islot;
+ LineBrk lbFound;
+ if (!FindSegmentEnd(ptman, islotStartTry, lb, twsh, islotMin,
+ &islot, &ichwSegOffset, &lbFound, plbNextToTry))
+ {
+ return -1; // didn't find a legal break
+ }
+
+ // Review: do we need to delete any previously-inserted line-break glyph from the stream?
+ // Doesn't seem like this has been a problem so far.
+
+ m_islotSegLim = islot + 1; // after the final glyph of this segment
+
+ return islot;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Work backwards from the prev line break position (or if none, the readPos) to find an
+ earlier line-break of the given weight or less.
+ Recipient should be the output of the final line break pass, if any, or the output
+ of the glyph-generation pass.
+
+ @param ptman - table manager, for supplying new slots
+ @param islotStartTry - where to start looking, or -1 for the end of the stream
+ @param lb - (max) break weight to allow
+ @param twsh - how we are handling trailing white-space
+ @param islotMin - first slot that is officially part of the segment (after initial LB)
+ @param pislot - slot AFTER which the break will go (not the lim of the segment)
+ @param pichwSegOffset - offset relative to the segment
+ @param plbFound - weight of break to be created
+ @param plbNextToTry - best found, in case we didn't find one at the requested level
+
+ @return Whether or not an appropriate break was found.
+----------------------------------------------------------------------------------------------*/
+bool GrSlotStream::FindSegmentEnd(GrTableManager * ptman,
+ int islotStartTry, LineBrk lb, TrWsHandling twsh, int islotMin,
+ int * pislot, int * pichwSegOffset, LineBrk * plbFound,
+ LineBrk * plbNextToTry)
+{
+ Assert(AssertValid());
+ Assert(m_ipass == ptman->NumberOfLbPasses());
+
+ if (islotStartTry < 0)
+ return false;
+
+ *pislot = islotStartTry;
+ GrSlotState * pslot = m_vpslot[*pislot];
+ *plbNextToTry = klbClipBreak; // worst break
+
+ ptman->State()->SetRemovedTrWhiteSpace(false);
+
+ while (twsh != ktwshOnlyWs) // in white-space only case, ignore lb values
+ {
+ if (*pislot < islotMin)
+ {
+ return false;
+ }
+ *plbFound = LineBrk(pslot->m_lb);
+ // Sanity check
+ if (abs(*plbFound) > klbClipBreak)
+ {
+// Assert(false);
+ Warn("Unusually large breakweight");
+ *plbFound = (LineBrk)((*plbFound < 0) ? -klbClipBreak : klbClipBreak);
+ }
+ *plbNextToTry = (LineBrk)(min(static_cast<int>(*plbNextToTry), abs(*plbFound)));
+ *pichwSegOffset = pslot->SegOffset();
+
+ if (int(*plbFound) >= 0 && *plbFound <= lb)
+ break;
+
+ --(*pislot);
+ if (*pislot < 0)
+ {
+ return false;
+ }
+ pslot = m_vpslot[*pislot];
+
+ if (int(*plbFound) <= 0 && ((int)*plbFound * -1) <= lb)
+ {
+ *plbFound = LineBrk(int(*plbFound) * -1);
+ break;
+ }
+ }
+
+ // Found a good break.
+
+ if (twsh == ktwshOnlyWs)
+ {
+ // white-space-only segment
+ while (pslot->Directionality() != kdircWhiteSpace)
+ {
+ --(*pislot);
+ if (*pislot < 0)
+ return false;
+ pslot = m_vpslot[*pislot];
+ *pichwSegOffset = pslot->SegOffset();
+ }
+ }
+ else if (twsh == ktwshNoWs)
+ {
+ // no trailing white-space: remove it
+ while (pslot->Directionality() == kdircWhiteSpace)
+ {
+ --(*pislot);
+ if (*pislot < 0)
+ return false;
+ pslot = m_vpslot[*pislot];
+ *pichwSegOffset = pslot->SegOffset();
+ ptman->State()->SetRemovedTrWhiteSpace(true);
+ }
+ }
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if the stream (which should be the output of the last linebreak pass) has
+ a better break at some earlier point than the one we found.
+
+ @param islotBreak - position of inserted or final break point in stream, or index
+ of last valid slot
+----------------------------------------------------------------------------------------------*/
+bool GrSlotStream::HasEarlierBetterBreak(int islotBreak, LineBrk lbFound, gid16 chwLB)
+{
+ Assert(AssertValid());
+
+ int islot = islotBreak;
+ if (SlotAt(islot)->IsFinalLineBreak(chwLB))
+ islot--;
+
+ if (lbFound == klbNoBreak)
+ lbFound = (LineBrk)SlotAt(islot)->BreakWeight();
+
+ while (islot >= 0)
+ {
+ if (SlotAt(islot)->IsInitialLineBreak(chwLB))
+ return false;
+ if (SlotAt(islot)->BreakWeight() < lbFound)
+ return true;
+ islot--;
+ }
+
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Make sure the stream contains a local instance of the given slot, not a copy used by
+ a previous pass.
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::EnsureLocalCopy(GrTableManager * ptman, GrSlotState * pslot,
+ GrSlotStream * psstrmIn)
+{
+ //Assert(m_vpslot[islot + m_cslotPreSeg] == pslot);
+ Assert(pslot->PassModified() <= m_ipass);
+
+ if (pslot->PassModified() < m_ipass)
+ {
+ int islot = pslot->PosPassIndex();
+ Assert(SlotAtPosPassIndex(islot) == pslot);
+ GrSlotState * pslotNew;
+ ptman->State()->NewSlotCopy(pslot, m_ipass, &pslotNew);
+ m_vpslot[islot + m_cslotPreSeg] = pslotNew;
+
+ psstrmIn->ReplaceSlotInReprocessBuffer(pslot, pslotNew);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ A slot has been replace within the coorsponding output stream. Make sure the reprocess
+ buffer of this stream constains the same slot.
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::ReplaceSlotInReprocessBuffer(GrSlotState * pslotOld, GrSlotState * pslotNew)
+{
+ if (m_islotReprocPos > -1)
+ {
+ for (size_t islot = 0; islot < m_vpslotReproc.size(); islot++)
+ {
+ if (m_vpslotReproc[islot] == pslotOld)
+ m_vpslotReproc[islot] = pslotNew;
+ }
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Inserting a line break can potentially alter the directionality of preceeding glyphs.
+ Zap the information that has been calculated.
+
+ @param islotLB - index of the inserted final line-break glyph
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::ZapCalculatedDirLevels(int islotLB)
+{
+ int islot;
+ for (islot = m_islotWritePos; islot-- > islotLB; )
+ m_vpslot[islot]->ZapDirLevel();
+
+ for (islot = islotLB; islot-- > 0; )
+ {
+ if (StrongDir(m_vpslot[islot]->Directionality()))
+ // We've found a strong direction code; don't need to zap beyond this point.
+ return;
+
+ m_vpslot[islot]->ZapDirLevel();
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the slot index of the last slot in the cluster for the just-processed chunk,
+ relative to the last slot in the chunk.
+
+ Return kNegInfinity if there are not enough slots in the stream to tell. This can
+ happen while we are in the middle of processing a cluster.
+----------------------------------------------------------------------------------------------*/
+int GrSlotStream::MaxClusterSlot(int islotChunkMin, int islotChunkLim)
+{
+ Assert(islotChunkLim > islotChunkMin);
+
+ if (!m_fUsedByPosPass)
+ return 0; // no clusters yet
+
+ int islotRet = SlotAt(islotChunkLim - 1)->PosPassIndex();
+
+ for (int islot = islotChunkMin; islot < islotChunkLim; islot++)
+ {
+ GrSlotState * pslot = SlotAt(islot);
+
+ if (m_cslotPreSeg == -1)
+ return kNegInfinity;
+ if (!HasSlotAtPosPassIndex(pslot->AttachRootPosPassIndex()))
+ return kNegInfinity;
+
+ GrSlotState * pslotBase = pslot->Base(this);
+
+ int dislotOffset = pslotBase->LastLeafOffset(this);
+ if (dislotOffset == kNegInfinity)
+ return kNegInfinity;
+ islotRet = max(islotRet, pslotBase->PosPassIndex() + dislotOffset);
+ }
+
+ // Make it relative to the last slot in the chunk.
+ islotRet -= SlotAt(islotChunkLim - 1)->PosPassIndex();
+
+ return islotRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the break weight of the given slot, which should be a line-break.
+ OBSOLETE??
+----------------------------------------------------------------------------------------------*/
+LineBrk GrSlotStream::BreakWeightAt(gid16 chwLB, int islot)
+{
+ GrSlotState * pslot = GetSlotAt(islot);
+ Assert(pslot->IsLineBreak(chwLB));
+ return LineBrk(pslot->m_lb);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Append an initial or final line break of the given weight to the stream.
+
+ @param ptman - table manager, for generating new slot
+ @param lb - break weight for the line-break glyph
+ @param dirc - directionality code for the line-break glyph
+ @param islotLB - where to insert, or -1 if at the end
+ @param fInitial - is this an initial line-break, or a final break?
+ @param ichwSegOffset - offset relative to the beginning of the segment
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::AppendLineBreak(GrTableManager * ptman, GrCharStream * pchstrm,
+ LineBrk lb, DirCode dirc, int islotLB, bool fInitial, int ichwSegOffset)
+{
+ EngineState * pengst = ptman->State();
+
+ Assert(AssertValid());
+/// Assert(m_islotReprocPos == -1);
+
+ Assert(islotLB == -1 || fInitial);
+ if (islotLB == -1)
+ islotLB = m_islotWritePos;
+
+// int islot = m_islotWritePos;
+
+ GrSlotState * pslotCopyFeat = pengst->AnAdjacentSlot(m_ipass, islotLB);
+ GrSlotState * pslotNew;
+ if (pslotCopyFeat)
+ pengst->NewSlot(ptman->LBGlyphID(), pslotCopyFeat, 0, ichwSegOffset, &pslotNew);
+ else
+ {
+ GrFeatureValues fval;
+ pchstrm->CurrentFeatures(ptman, &fval);
+ pengst->NewSlot(ptman->LBGlyphID(), fval, 0, ichwSegOffset, -1, &pslotNew);
+ }
+
+ pslotNew->m_lb = sdata8(lb);
+ pslotNew->SetSpecialSlotFlag(fInitial ? kspslLbInitial : kspslLbFinal);
+ //pslotNew->m_fInitialLB = fInitial; // TODO: remove
+ pslotNew->SetDirectionality(dirc);
+
+ m_vpslot.insert(m_vpslot.begin() + islotLB, pslotNew);
+ // Make it part of a chunk with previous char/glyph
+ m_vislotPrevChunkMap.insert(m_vislotPrevChunkMap.begin() + islotLB, -1);
+ m_vislotNextChunkMap.insert(m_vislotNextChunkMap.begin() + islotLB, -1);
+ if (m_ipass > 0)
+ AdjustPrevStreamNextChunkMap(ptman, islotLB, 1);
+
+ m_islotWritePos++;
+
+ if (m_fUsedByPosPass && GotIndexOffset())
+ {
+ pslotNew->SetPosPassIndex(islotLB - m_cslotPreSeg, m_fInputToPosPass1);
+ // Increment the stream index for the following slots.
+ for (int islotTmp = islotLB + 1; islotTmp < m_islotWritePos; islotTmp++)
+ {
+ SlotAt(islotTmp)->IncPosPassIndex();
+ }
+ }
+
+ if (fInitial)
+ m_islotSegMin = islotLB; // just before the LB
+ else
+ m_islotSegLim = islotLB + 1; // just after the LB
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the index of the line break glyph within the specified range, or -1 if none.
+ Recipient is functioning as the output stream.
+
+ @param chwLB - glyph ID being used for line-break glyphs
+ @param islotMin/Lim - range to search
+----------------------------------------------------------------------------------------------*/
+int GrSlotStream::FindFinalLineBreak(gid16 chwLB, int islotMin, int islotLim)
+{
+ for (int islot = islotMin; islot < islotLim; ++islot)
+ {
+ if (m_vpslot[islot]->IsFinalLineBreak(chwLB))
+ return islot;
+ }
+ return -1;
+}
+
+/*----------------------------------------------------------------------------------------------
+ A slot has been inserted (nInc == 1) or deleted (nInc == -1). Adjust the next-chunk map
+ of the previous stream to match.
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::AdjustPrevStreamNextChunkMap(GrTableManager * ptman, int islotMod, int nInc)
+{
+ if (m_ipass == 0)
+ return; // no previous stream to adjust
+
+ int islotTmp = max(islotMod - 5, 0);
+ while (islotTmp > 0 && m_vislotPrevChunkMap[islotTmp] == -1)
+ islotTmp--;
+
+ ptman->InputStream(m_ipass)->AdjustNextChunkMap(
+ ((islotTmp <= 0) ? 0 : m_vislotPrevChunkMap[islotTmp]),
+ islotMod, nInc);
+}
+
+/*----------------------------------------------------------------------------------------------
+ An insertion or deletion has occurred at the given location in the following stream
+ (specifically of an line-break glyph). Adjust the next-chunk-map accordingly so
+ the indices still match.
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::AdjustNextChunkMap(int islotMin, int islotInsOrDel, int nInc)
+{
+ for (int islot = islotMin; islot < m_islotWritePos; islot++)
+ {
+ if (m_vislotNextChunkMap[islot] != -1 && m_vislotNextChunkMap[islot] >= islotInsOrDel)
+ m_vislotNextChunkMap[islot] += nInc;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Unwind the read position of the stream, so that the following pass will begin
+ reading from the new position. The recipient is functioning as the input stream.
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::UnwindInput(int islotNewPos, bool fPreBidiPass)
+{
+ Assert(m_islotReprocPos == -1);
+ Assert(islotNewPos <= m_islotReadPos);
+
+ int islot;
+ for (islot = islotNewPos; islot < m_islotReadPos; ++islot)
+ m_vislotNextChunkMap[islot] = -1;
+
+ m_islotReadPos = islotNewPos;
+ m_islotReadPosMax = m_islotReadPos;
+
+ Assert(m_islotReadPos <= m_islotWritePos);
+ if (fPreBidiPass)
+ {
+ for (islot = m_islotReadPos; islot < m_islotWritePos; ++islot)
+ SlotAt(islot)->ZapDirLevel();
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Unwind the write position of the stream, so that the pass will begin writing
+ at the new position. The recipient is functioning as the output stream
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::UnwindOutput(int islotNewPos, bool fOutputOfPosPass)
+{
+ Assert(islotNewPos <= m_islotWritePos);
+
+ int islot;
+ for (islot = islotNewPos; islot < m_islotWritePos; ++islot)
+ {
+ m_vislotPrevChunkMap[islot] = -1;
+
+ if (!fOutputOfPosPass && m_fUsedByPosPass)
+ // This stream is the input to the first positioning pass, ie, the output
+ // of the last sub pass or the bidi pass. Zap the stream indices,
+ // since unwinding this pass could cause them to be invalid due to a later
+ // reordering.
+ SlotAt(islot)->ZapPosPassIndex();
+ }
+
+ m_islotWritePos = islotNewPos;
+
+ m_fFullyWritten = false;
+
+ if (m_islotSegMin > m_islotWritePos)
+ m_islotSegMin = -1;
+ if (m_islotSegLim > m_islotWritePos)
+ m_islotSegLim = -1;
+}
+
+/*----------------------------------------------------------------------------------------------
+ We've just created a new chunk, with the recipient as the output stream. The beginning
+ of the chunk is passed as 'islotOutput' and the end of the chunk is assumed to be the
+ write-position of the recipient. Store the mappings into the corresponding
+ input position.
+
+ @param islotInputMin - beginning of chunk in input stream
+ @param islotOutputMin - beginning of chunk in output stream (recipient)
+ @param islotInputLim - end of chunk in input stream (currently not used)
+ @param fSkipChunkStart - if true, either we have reprocessed part of a
+ previously created chunk,
+ or there was no input consumed;
+ in either case, don't record the beginning of the chunk,
+ just make this chunk be part of the previous
+ @param fBackingUp - this chunk results in the stream position moving backwards,
+ so clear anything we're backing over
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::MapInputChunk(int islotInputMin, int islotOutputMin, int islotInputLim,
+ bool fSkipChunkStart, bool fBackingUp)
+{
+ Assert(AssertValid());
+ Assert(islotOutputMin >= -1);
+
+ if (!fSkipChunkStart)
+ {
+ Assert(islotOutputMin >= 0);
+ if (islotOutputMin >= 0) // just in case an invalid value was passed
+ m_vislotPrevChunkMap[islotOutputMin] = islotInputMin;
+ }
+
+ int islot;
+ for (islot = max(0, islotOutputMin + 1); islot < m_islotWritePos; ++islot)
+ m_vislotPrevChunkMap[islot] = -1; // not a chunk boundary
+
+// if (fBackingUp && m_islotWritePos < m_vislotPrevChunkMap.Size())
+// m_vislotPrevChunkMap[m_islotWritePos] = -1;
+
+ if (fBackingUp)
+ for (islot = m_islotWritePos; islot < signed(m_vislotPrevChunkMap.size()); islot++)
+ m_vislotPrevChunkMap[islot] = -1;
+
+// m_vislotPrevChunkMap[m_islotWritePos] = islotInputLim;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the length of the final chunk, where the recipient is the input stream.
+----------------------------------------------------------------------------------------------*/
+int GrSlotStream::LastNextChunkLength()
+{
+ int cslotRet = 1;
+ for (int islot = m_islotReadPos; islot-- > 0; )
+ {
+ if (m_vislotNextChunkMap[islot] != -1)
+ return cslotRet;
+ cslotRet++;
+ }
+ return cslotRet + 1;
+}
+
+/*----------------------------------------------------------------------------------------------
+ We've just created a new chunk, with the recipient as the input stream. The beginning of
+ the chunk is passed as 'islotInputMin' and the end of the chunk is assumed to be the
+ read-position of the recipient. Store the mappings into the corresponding
+ output position.
+
+ @param islotOutputMin - beginning of chunk in output stream
+ @param islotInputMin - beginning of chunk in input stream (recipient)
+ @param islotOutputLim - end of chunk in output stream (currently not used)
+ @param fSkipChunkStart - if true, either we have reprocessed part of a
+ previously created chunk,
+ or there was no output generated;
+ in either case, don't record the beginning of the chunk,
+ just make this chunk be part of the previous
+ @param fBackingUp - this chunk results in the stream position moving backwards,
+ so clear anything we're backing over
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::MapOutputChunk(int islotOutputMin, int islotInputMin, int islotOutputLim,
+ bool fSkipChunkStart, int cslotReprocess, bool fBackingUp)
+{
+ Assert(AssertValid());
+
+ // Note: islotInputMin can be less than -1 if there is a large reprocess buffer near the
+ // beginning of the input stream. In which case, fSkipChunk start should be true and
+ // cslotReprocess large enough to keep any of the stuff below from having any problems.
+ //Assert(islotInputMin >= -1);
+
+ if (!fSkipChunkStart)
+ {
+ Assert(islotInputMin >= 0);
+ if (islotInputMin >= 0) // just in case an invalid value was passed
+ m_vislotNextChunkMap[islotInputMin] = islotOutputMin;
+ }
+
+ int islot;
+ for (islot = max(0, islotInputMin + 1 + cslotReprocess); islot < m_islotReadPos; ++islot)
+ m_vislotNextChunkMap[islot] = -1; // not a chunk boundary
+
+// if (fBackingUp && m_islotReadPos < m_vislotNextChunkMap.Size())
+// m_vislotNextChunkMap[m_islotReadPos] = -1;
+
+ if (fBackingUp)
+ for (islot = m_islotReadPos; islot < signed(m_vislotNextChunkMap.size()); islot++)
+ m_vislotNextChunkMap[islot] = -1;
+
+// m_vislotNextChunkMap[m_islotReadPos] = islotOutputLim;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Ensure that the chunk maps for a pair of streams match properly. The recipient is
+ the input stream.
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::AssertChunkMapsValid(GrSlotStream * psstrmOut)
+{
+#ifdef _DEBUG
+ GrSlotStream * psstrmIn = this;
+
+ Assert(m_ipass == 0 || (m_ipass + 1 == psstrmOut->m_ipass));
+
+ int islotMapNext;
+ int islotMapPrev;
+ int islot;
+ for (islot = 0; islot < m_islotReadPos; ++islot)
+ {
+ islotMapNext = psstrmIn->ChunkInNext(islot);
+ Assert(islotMapNext != -2);
+ if (islotMapNext != -1)
+ {
+ islotMapPrev = psstrmOut->ChunkInPrev(islotMapNext);
+ if (islotMapPrev == -2)
+ {
+ Assert(islot == psstrmOut->WritePos());
+ }
+ else
+ {
+ Assert(islot == islotMapPrev);
+ }
+ }
+ }
+
+ for (islot = 0; islot < psstrmOut->m_islotWritePos; ++islot)
+ {
+ islotMapPrev = psstrmOut->ChunkInPrev(islot);
+ Assert(islotMapPrev != -2);
+ if (islotMapPrev != -1)
+ {
+ islotMapNext = psstrmIn->ChunkInNext(islotMapPrev);
+ if (islotMapNext == -2)
+ {
+ Assert(islot == psstrmIn->ReadPos());
+ }
+ else
+ {
+ Assert(islot == islotMapNext);
+ }
+ }
+ }
+#endif // _DEBUG
+}
+
+/*----------------------------------------------------------------------------------------------
+ Ensure that corresponding items in the streams of a positioning pass have matching
+ stream indices. The recipient is the output stream.
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::AssertStreamIndicesValid(GrSlotStream * psstrmIn)
+{
+#ifdef _DEBUG
+ if (!GotIndexOffset())
+ return;
+
+ Assert(m_fUsedByPosPass);
+
+ for (int islot = 0; islot < WritePos(); islot++)
+ {
+ GrSlotState * pslotOut = SlotAt(islot);
+ GrSlotState * pslotIn =
+ psstrmIn->SlotAt(islot + psstrmIn->IndexOffset() - IndexOffset());
+ Assert(pslotOut->PosPassIndex() == pslotIn->PosPassIndex());
+ Assert(pslotOut->HasAsPreviousState(pslotIn));
+ }
+#endif // _DEBUG
+}
+
+/*----------------------------------------------------------------------------------------------
+ Ensure that the roots of all attachments made in this chunk are present
+ in the output stream. (Currently the compiler ensures this by making it an error
+ to write rules that don't do this.)
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::AssertAttachmentsInOutput(int islotMin, int islotLim)
+{
+#ifdef _DEBUG
+ for (int islot = islotMin; islot < islotLim; islot++)
+ {
+ GrSlotState * pslotOut = SlotAt(islot);
+ int dislot = pslotOut->AttachTo();
+ Assert(islotMin <= islot + dislot);
+ Assert(islot + dislot < islotLim);
+ }
+#endif // _DEBUG
+}
+
+/*----------------------------------------------------------------------------------------------
+ Answer the slot index corresponding to the start of the chunk (as mapped to the following
+ stream).
+ ENHANCE: make more robust.
+----------------------------------------------------------------------------------------------*/
+int GrSlotStream::ChunkInNextMin(int islot)
+{
+ int islotRet = islot;
+ while (m_vislotNextChunkMap[islotRet] == -1 && islotRet > 0)
+ --islotRet;
+ return islotRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Answer the slot index corresponding to the end of the chunk (as mapped to the following
+ stream).
+ ENHANCE: make more robust.
+----------------------------------------------------------------------------------------------*/
+int GrSlotStream::ChunkInNextLim(int islot)
+{
+ int islotRet = islot + 1;
+ if (islotRet == m_islotReadPos)
+ return islot;
+ while (m_vislotNextChunkMap[islotRet] == -1 && islotRet < m_islotReadPos)
+ {
+ ++islotRet;
+ Assert(islotRet < signed(m_vislotNextChunkMap.size()));
+ }
+ return islotRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Skip over the given number slots. This is used to resync the streams when we
+ are restarting a new segment. Specifically the output stream informs the
+ input stream of the number of slots to skip to get the boundary for a chunk that
+ the output finds interesting.
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::ResyncSkip(int cslot)
+{
+ Assert(AssertValid());
+ m_islotReadPos += cslot;
+ m_cslotSkippedForResync = cslot;
+ // Should never skip past the beginning of the line.
+ Assert(m_islotSegMin == -1 || m_islotReadPos <= m_islotSegMin);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Record the number of slots in the stream that are previous to the official start of the
+ segment.
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::CalcIndexOffset(GrTableManager * ptman)
+{
+ if (GotIndexOffset())
+ return; // already figured it
+
+ if (m_islotSegMin > -1)
+ {
+ m_cslotPreSeg = m_islotSegMin;
+ if (m_fUsedByPosPass)
+ {
+ for (int islotPre = 0; islotPre < WritePos(); islotPre++)
+ {
+ SlotAt(islotPre)->SetPosPassIndex(islotPre - m_cslotPreSeg,
+ m_fInputToPosPass1);
+ }
+ }
+ }
+ // else can't figure it out yet
+
+ // Old code:
+#if 0
+ gid16 chwLB = ptman->LBGlyphID();
+
+ for (int islot = 0; islot < WritePos(); islot++)
+ {
+ if (SlotAt(islot)->IsLineBreak(chwLB))
+ {
+ if (SlotAt(islot)->IsInitialLineBreak(chwLB))
+ {
+ m_cslotPreSeg = islot;
+ }
+ else
+ {
+ // Otherwise, we hit the final line break, which is kind of strange, because
+ // in this case there is no initial line break, and we should have set
+ // m_cslotPreSeg to 0 immediately when it was initialized.
+ Assert(false);
+ m_cslotPreSeg = 0;
+ }
+
+ if (m_fUsedByPosPass)
+ {
+ for (int islotPre = 0; islotPre < WritePos(); islotPre++)
+ {
+ SlotAt(islotPre)->SetPosPassIndex(islotPre - m_cslotPreSeg,
+ m_fInputToPosPass1);
+ }
+ }
+ return;
+ }
+
+ }
+ // No line breaks yet, so no way to tell.
+#endif
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set the positions in the streams for the next rule. The recipient is the output stream.
+ If we are moving backwards, copy part of the output stream back to (a temporary buffer
+ in) the input stream, so that we can reprocess it.
+
+ @param cslotArg - how far to skip forward or back; most commonly zero
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::SetPosForNextRule(int cslotArg, GrSlotStream * psstrmIn,
+ bool fOutputOfPosPass)
+{
+ Assert(AssertValid());
+
+ int cslot = cslotArg;
+ // Can't reprocess what has already been read by the next pass. MaxBackup should allow
+ // the flexibility needed, but if not, we fix it here.
+ if (m_islotWritePos + cslot < m_islotReadPos)
+ cslot = m_islotReadPos - m_islotWritePos;
+
+ Assert(psstrmIn->m_ipass == m_ipass-1);
+
+ if (cslot >= 0)
+ {
+ // Skipping forward.
+ Assert(cslot <= psstrmIn->SlotsPendingInContext());
+ for (int islot = 0; islot < cslot; islot++)
+ CopyOneSlotFrom(psstrmIn);
+ }
+ else
+ {
+ // Reprocessing.
+
+ // Save corresponding positions before doing the back-up.
+ int islotReadPosInSave = psstrmIn->ReadPosForNextGet();
+ int islotWritePosOutSave = this->WritePos();
+
+ std::vector<GrSlotState*> vpslotTmp;
+ int islot;
+ if (psstrmIn->SlotsToReprocess() > 0)
+ {
+ // Stick any slots still to reprocess in a temporary buffer.
+ for (islot = psstrmIn->m_islotReprocPos;
+ islot < signed(psstrmIn->m_vpslotReproc.size());
+ islot++)
+ {
+ vpslotTmp.push_back(psstrmIn->m_vpslotReproc[islot]);
+ }
+ }
+
+ psstrmIn->ClearReprocBuffer();
+ psstrmIn->m_islotReprocLim = psstrmIn->m_islotReadPos;
+
+ for (islot = cslot; islot < 0; islot++)
+ psstrmIn->m_vpslotReproc.push_back(m_vpslot[m_islotWritePos+islot]);
+ for (islot = 0; islot < signed(vpslotTmp.size()); islot++)
+ psstrmIn->m_vpslotReproc.push_back(vpslotTmp[islot]);
+ psstrmIn->m_islotReprocPos = 0;
+
+ if (!fOutputOfPosPass && m_fUsedByPosPass)
+ {
+ // Last substitution pass; zap the stream indices, since they may
+ // now be invalid.
+ for (islot = 0; islot < signed(psstrmIn->m_vpslotReproc.size()); islot++)
+ psstrmIn->m_vpslotReproc[islot]->ZapPosPassIndex();
+ }
+
+ // If either the min or lim is in the middle of the reprocess buffer,
+ // adjust as necessary to match where it is in the output stream.
+ int islotSegMinIn = psstrmIn->SegMin();
+ if (islotSegMinIn > -1 &&
+ psstrmIn->ReadPosForNextGet() <= islotSegMinIn &&
+ islotSegMinIn < islotReadPosInSave)
+ {
+ Assert(this->SegMin() > -1);
+ int dislotIn = islotReadPosInSave - islotSegMinIn;
+ int dislotOut = islotWritePosOutSave - SegMin();
+ psstrmIn->SetSegMin(islotSegMinIn + dislotIn - dislotOut, true);
+ if (psstrmIn->m_cslotPreSeg > psstrmIn->SegMin())
+ psstrmIn->m_cslotPreSeg = -1;
+ }
+ int islotSegLimIn = psstrmIn->SegLimIfKnown();
+ if (islotSegLimIn > -1 &&
+ psstrmIn->ReadPosForNextGet() <= islotSegLimIn &&
+ islotSegLimIn < islotReadPosInSave)
+ {
+ int islotSegLimOut = this->SegLimIfKnown();
+ Assert(islotSegLimOut > -1);
+ int dislotIn = islotReadPosInSave - islotSegLimIn;
+ int dislotOut = islotWritePosOutSave - islotSegLimOut;
+ psstrmIn->SetSegLim(islotSegLimIn + dislotIn - dislotOut);
+ }
+
+ m_islotWritePos += cslot;
+
+ if (m_islotSegMin >= m_islotWritePos)
+ m_islotSegMin = -1;
+ if (m_islotSegLim >= m_islotWritePos)
+ m_islotSegLim = -1;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ If a rule was run over a LB glyph, set the appropriate flag in the table manager.
+ CURRENTLY NOT USED
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::SetLBContextFlag(GrTableManager * ptman, int islotStart)
+{
+ gid16 chwLB = ptman->LBGlyphID();
+ for (int islot = islotStart; islot < WritePos(); islot++)
+ {
+ GrSlotState * pslot = SlotAt(islot);
+ if (pslot->IsInitialLineBreak(chwLB))
+ ptman->State()->SetStartLineContext(true);
+ if (pslot->IsFinalLineBreak(chwLB))
+ ptman->State()->SetEndLineContext(true);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the number of slots that have been output by the current pass but must be
+ reprocessed by this same pass. The recipient is serving as the input stream.
+----------------------------------------------------------------------------------------------*/
+int GrSlotStream::SlotsToReprocess()
+{
+ Assert(AssertValid());
+
+ if (m_islotReprocPos == -1)
+ return 0;
+ return (m_vpslotReproc.size() - m_islotReprocPos);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the input at the given slot, that is, the original input, ignoring the issue of
+ reprocessing.
+----------------------------------------------------------------------------------------------*/
+GrSlotState * GrSlotStream::GetSlotAt(int islot)
+{
+ return m_vpslot[islot];
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the "current" input item from the rule's perspective, ie, the last slot read.
+ So dislotOffset = 0 means not the slot at the read position but one slot earlier.
+
+ If dislotOffset is less the the original read position that was in effect at the
+ beginning of the rule, we need to read from the output stream, which has the
+ up-to-date values. See the class comment for more details.
+
+ @param dislotOffset - offset from current stream position
+ @param fNullOkay - true if it's okay to return NULL in the situation where we're asking
+ for something before the beginning of the stream
+----------------------------------------------------------------------------------------------*/
+
+GrSlotState * GrSlotStream::RuleInputSlot(int dislotOffset, GrSlotStream * psstrmOutput,
+ bool fNullOkay)
+{
+ Assert(m_islotRuleStartRead <= m_islotReadPos);
+
+ if (dislotOffset > 0)
+ return Peek(dislotOffset - 1);
+
+ int cslotOffsetBack = dislotOffset * -1;
+
+ if (m_islotReprocLim > -1)
+ {
+ // There is a reprocess buffer.
+
+ // Position when starting the rule should never be earlier than the
+ // beginning of the reprocess buffer.
+ Assert(m_islotRuleStartRead >= m_islotReprocLim - signed(m_vpslotReproc.size()));
+
+ // number of items following the reprocess buffer:
+ int cslotPostReproc = m_islotReadPos - m_islotReprocLim;
+
+ if (cslotOffsetBack >= cslotPostReproc)
+ {
+ // number of items in the reprocess buffer that were valid when the rule
+ // was started:
+ int cslotValidReproc = m_islotReprocLim - m_islotRuleStartRead;
+
+ if (cslotOffsetBack >= cslotPostReproc + cslotValidReproc)
+ {
+ // Read from the output stream.
+ int dislotTmp = dislotOffset - 1 + cslotPostReproc + cslotValidReproc;
+ Assert(dislotTmp < 0);
+ return psstrmOutput->PeekBack(dislotTmp);
+ }
+ else
+ {
+ if (m_islotReprocPos > -1)
+ {
+ // Current read pos is inside reprocess buffer.
+ Assert(cslotPostReproc == 0);
+ int islotStartReadReprocBuf = m_vpslotReproc.size() - cslotValidReproc;
+ Assert(islotStartReadReprocBuf >= 0);
+ int islotInReprocBuf = m_islotReprocPos - cslotOffsetBack - 1;
+ if (islotInReprocBuf < islotStartReadReprocBuf)
+ {
+ // Return a slot from before the reprocess buffer, from the
+ // output stream (which is serving as our input stream for precontext
+ // items).
+ return psstrmOutput->PeekBack(islotInReprocBuf - islotStartReadReprocBuf);
+ }
+ else if (islotInReprocBuf < 0)
+ {
+ Assert(false);
+ //int islotReprocMin = m_islotReprocLim - m_vpslotReproc.Size();
+ //return m_vpslot[islotReprocMin + islotInReprocBuf];
+ }
+ else
+ // Read from the reprocess buffer.
+ return m_vpslotReproc[islotInReprocBuf];
+ }
+ else
+ // Looking backwards into the reprocess buffer.
+ return m_vpslotReproc[
+ m_vpslotReproc.size() - cslotOffsetBack + cslotPostReproc - 1];
+ }
+ }
+ }
+
+ // There is no reprocess buffer, or it is not a factor.
+
+ if (m_islotReadPos + dislotOffset - 1 < m_islotRuleStartRead)
+ {
+ // Read from the output stream.
+ return psstrmOutput->PeekBack(m_islotReadPos + dislotOffset - 1 - m_islotRuleStartRead,
+ fNullOkay);
+ }
+ else
+ {
+ // Read normally from the input stream.
+ return m_vpslot[m_islotReadPos - cslotOffsetBack - 1];
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the "current" output item from the rule's perspective, ie, the last slot written.
+ So dislotOffset = 0 means not the slot at the write position but one slot earlier.
+----------------------------------------------------------------------------------------------*/
+
+GrSlotState * GrSlotStream::RuleOutputSlot(int dislotOffset)
+{
+ return m_vpslot[m_islotWritePos - 1 + dislotOffset];
+}
+
+/*----------------------------------------------------------------------------------------------
+ For any slot in the final output that has no associations, set the "before" pointer to
+ the following slot and the "after" pointer to the preceding slot. The idea of this is
+ that it will make it impossible to select a the glyph separately.
+
+ Note that if the slot is the first on the line, it will not be associated with
+ a slot in the previous segment.
+
+ @param chwLB - the glyph IB for the line-break glyphs
+----------------------------------------------------------------------------------------------*/
+void GrSlotStream::SetNeutralAssociations(gid16 chwLB)
+{
+ for (int islot = 0; islot < m_islotWritePos; ++islot)
+ {
+ GrSlotState * pslot = SlotAt(islot);
+ if (pslot->PassModified() > 0 &&
+ (pslot->BeforeAssoc() == kPosInfinity || pslot->AfterAssoc() == kNegInfinity))
+ {
+ pslot->CleanUpAssocs();
+ if (pslot->BeforeAssoc() != kPosInfinity && pslot->AfterAssoc() != kNegInfinity)
+ continue;
+
+ Assert(pslot->BeforeAssoc() == kPosInfinity && pslot->AfterAssoc() == kNegInfinity);
+
+ GrSlotState * pslotBefore = FindAssociatedSlot(islot, 1, chwLB);
+ GrSlotState * pslotAfter = FindAssociatedSlot(islot, -1, chwLB);
+
+ if (pslotBefore && pslotAfter)
+ pslot->Associate(pslotBefore, pslotAfter);
+ else if (pslotBefore)
+ pslot->Associate(pslotBefore);
+ else if (pslotAfter)
+ pslot->Associate(pslotAfter);
+ else
+ // Weird, but can happen with an empty segment.
+ Warn("No assocations");
+
+// Assert(pslot->m_vpslotAssoc.Size() > 0);
+ pslot->m_fNeutralAssocs = true;
+ }
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Find the next or previous slot in the final output that has explicit associations, or
+ return NULL if none.
+
+ @param islot - starting slot
+ @param nInc - +1 if we want to find the next slot, -1 if we want the previous slot
+ @param chwLB - the glyph IB for the line-break glyphs
+----------------------------------------------------------------------------------------------*/
+GrSlotState * GrSlotStream::FindAssociatedSlot(int islot, int nInc, gid16 chwLB)
+{
+ int islotNext = islot + nInc;
+
+ while (islotNext >= 0 && islotNext < m_islotWritePos)
+ {
+ GrSlotState * pslotRet = SlotAt(islotNext);
+ if (pslotRet->IsLineBreak(chwLB))
+ { }
+ else if (pslotRet->PassModified() == 0 ||
+ (pslotRet->m_vpslotAssoc.size() > 0 && pslotRet->m_fNeutralAssocs == false))
+ {
+ return pslotRet;
+ }
+ islotNext += nInc;
+ }
+ return NULL;
+}
+
+} // namespace gr
diff --git a/Build/source/libs/graphite/src/segment/GrSlotStream.h b/Build/source/libs/graphite/src/segment/GrSlotStream.h
new file mode 100644
index 00000000000..006191252dc
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrSlotStream.h
@@ -0,0 +1,577 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrSlotStream.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Classes GrSlotStream and GrSlotState.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef SLOTSTREAM_INCLUDED
+#define SLOTSTREAM_INCLUDED
+
+//:End Ignore
+
+namespace gr
+{
+
+class EngineState;
+class Font;
+
+/*----------------------------------------------------------------------------------------------
+ Each GrSlotStream represents the output of one pass, which also serves as the input
+ of the following pass. Hence it has two positions, a write position for when it is
+ serving as an output stream, and a read position for when it is serving as an input
+ stream. The TableManager holds a list of the streams.
+
+ The reading of slot streams is complicated by two factors. First, it may be necessary
+ to access the "pre-context" items of a rule, which are the slots before the current
+ stream position at the point when the rule is matched. These items will not be modified
+ by the rule, but may have been modified by a previous rule in the same pass, Therefore
+ we need to read these slots from the output stream, rather than the input stream,
+ because the output stream has the current slot attribute values that we want to work with.
+ In order make this happen, we keep track of the read and write positions of
+ the streams at the time the current rule was matched (m_islotRuleStartRead and
+ m_islotRuleStartWrite) and whenever we try to read a slot before m_islotRuleStartRead,
+ we read the corresponding slot from the output stream instead.
+
+ Second, a rule may explicitly set the advance position so that some items are
+ actually reprocessed (and potentially modified) by the same pass. When this happens,
+ we actually copy the slots to reprocess from the output stream back
+ into a temporary buffer (m_vpslotReproc) in the input stream, and set up the stream so
+ that the next read operations will read from the buffer.
+
+ It gets tricky because these two mechanisms can overlap with each other, so care
+ must be taken to read from the right place: the input stream in the normal way,
+ the reprocess buffer, or the output stream. See the RuleInputSlot method.
+
+ Another messy bit of code has to do with maintaining chunks. These are used for
+ backtracking and unwinding after inserting a line-break. Adjacent streams have maps
+ showing how many slots were processed by a single rule; the maps must be consisent
+ between adjacent rules. The following is an example of a pair of valid chunk maps:
+
+ Input stream Output stream
+ Pos next-map prev-map
+ 0 0 0
+ 1 -1 -1
+ 2 2 2
+ 3 4 -1
+ 4 -1 3
+ 5 -1 -1
+ 6 7 -1
+ 7 -1 6
+ 8 -1 -1
+
+ A -1 means that slot is not at the beginning of a chunk. Otherwise, there must be a
+ corresponding value in the parallel map of the adjacent stream--eg, the input stream's
+ next-map(3) == 4 and the output stream's prev-map(4) == 3. Assertions are run
+ regularly to ensure that the chunk maps stay valid.
+
+ So above, the first chunk corresponds to slots 0-1 in the input and 0-1 in the output;
+ two slots were processed by the rule. The second chunk corresponds to slot 2
+ in the input and slots 2-3 in the output (a slot was inserted).
+ The third corresponds to slots 3-5 in the input and 4-6 in the output (three slots
+ processed). The fourth chunk covers slots 6-8 in the input and 7-8 in the output
+ (one slot was deleted).
+
+ ENHANCE SharonC: explain the effect of skipped slots on the chunk maps.
+
+ Hungarian: sstrm
+----------------------------------------------------------------------------------------------*/
+class GrSlotStream {
+
+ friend class GrSlotState;
+ friend class FontMemoryUsage;
+
+public:
+ // Constructor:
+ GrSlotStream(int ipass)
+ {
+ m_ipass = ipass;
+ m_vpslot.clear();
+ m_vislotPrevChunkMap.clear();
+ m_vislotNextChunkMap.clear();
+ m_vpslotReproc.clear();
+ }
+
+ // Destructor:
+ ~GrSlotStream()
+ {
+ ReleaseSlots(0, m_vpslot.size());
+ }
+
+ void ReleaseSlots(int islotMin, int islotLim)
+ {
+ // A slot stream is responsible for deleting the slot states that it created,
+ // that is, the ones whose modified tag equals this stream's pass index.
+ // NO LONGER TRUE - there is a master list of them managed by the GrTableManager.
+// for (int islot = islotMin; islot < islotLim; ++islot)
+// {
+// if (m_vpslot[islot]->m_ipassModified == m_ipass)
+// delete m_vpslot[islot];
+// }
+ }
+
+ // Getters:
+ int WritePos() { return m_islotWritePos; }
+ int ReadPos() { return m_islotReadPos; }
+ bool FullyWritten() { return m_fFullyWritten; }
+
+ int SlotsPresent() { return m_vpslot.size(); }
+
+ // Setters:
+ void SetWritePos(int islot)
+ {
+ m_islotWritePos = islot;
+ }
+ void SetReadPos(int islot)
+ {
+ m_islotReadPos = islot;
+ }
+
+ void Initialize(int ipassPos1, bool fAnythingPrevious)
+ {
+ m_islotWritePos = 0;
+ m_islotReadPos = 0;
+ m_islotReprocPos = -1;
+ m_islotReprocLim = -1;
+ m_islotRuleStartRead = 0;
+ m_islotRuleStartWrite = 0;
+ m_islotReadPosMax = 0;
+ m_cslotSkippedForResync = 0;
+ m_cslotPreSeg = (fAnythingPrevious) ? -1 : 0;
+ m_fFullyWritten = false;
+ m_islotSegMin = -1;
+ m_islotSegLim = -1;
+ m_fUsedByPosPass = (m_ipass + 1 >= ipassPos1);
+ m_fInputToPosPass1 = (m_ipass + 1 == ipassPos1);
+ m_vpslot.clear(); // not responsible for destroying the slots
+ m_vislotPrevChunkMap.clear();
+ m_vislotNextChunkMap.clear();
+ }
+
+public:
+ bool AtEnd();
+ bool AtEndOfContext();
+ void NextPut(GrSlotState* pslot);
+ GrSlotState * NextGet();
+ GrSlotState * Peek(int dislot = 0);
+ GrSlotState * PeekBack(int dislot, bool fNullOkay = false);
+ void Skip(int = 1);
+ GrSlotState * SlotAt(int islot)
+ {
+ return m_vpslot[islot];
+ }
+
+ int OutputOfPass()
+ {
+ return m_ipass;
+ }
+
+ // This function is intended to be used within positioning passes where there is a
+ // one-to-one correspondence beween the slots in consecutive streams.
+ GrSlotState * OutputSlotAt(int islot)
+ {
+ return Peek(islot - ReadPosForNextGet());
+ }
+
+ int ReadPosForNextGet()
+ {
+ return ReadPos() - SlotsToReprocess();
+ }
+
+ // Only valid for streams that are the input or output to a positioning pass.
+ GrSlotState * SlotAtPosPassIndex(int islot)
+ {
+ Assert(GotIndexOffset());
+ Assert(m_fUsedByPosPass);
+ return m_vpslot[islot + m_cslotPreSeg];
+ }
+
+ // Only valid for streams that are the input or output to a positioning pass.
+ bool HasSlotAtPosPassIndex(int islot)
+ {
+ Assert(GotIndexOffset());
+ Assert(m_fUsedByPosPass);
+ return (signed(m_vpslot.size()) > (islot + m_cslotPreSeg));
+ }
+
+ bool AssertValid();
+ void AssertChunkMapsValid(GrSlotStream * psstrmOut);
+ void AssertStreamIndicesValid(GrSlotStream * psstrmIn);
+ void AssertAttachmentsInOutput(int islotMin, int islotLim);
+ bool NoReproc()
+ {
+ return (m_islotReprocPos == -1 || (m_islotReprocPos >= signed(m_vpslotReproc.size())));
+ }
+
+ int SlotsPending();
+ int SlotsPendingInContext();
+ int TotalSlotsPending();
+ bool PastEndOfPositioning(bool fOutput);
+
+ void ClearReprocBuffer()
+ {
+ m_islotReprocPos = -1;
+ m_islotReprocLim = -1;
+ m_vpslotReproc.clear();
+ }
+
+ int ReprocLim()
+ {
+ return m_islotReprocLim;
+ }
+
+ int ReprocMin()
+ {
+ Assert(m_islotReprocPos > -1);
+ return m_islotReprocLim - m_vpslot.size();
+ }
+
+ int RuleStartReadPos()
+ {
+ return m_islotRuleStartRead;
+ }
+
+ void SetRuleStartReadPos()
+ {
+ if (m_islotReprocPos > -1)
+ m_islotRuleStartRead = m_islotReprocLim - SlotsToReprocess();
+ else
+ m_islotRuleStartRead = m_islotReadPos;
+ }
+
+ int RuleStartWritePos()
+ {
+ return m_islotRuleStartWrite;
+ }
+
+ void SetRuleStartWritePos()
+ {
+ m_islotRuleStartWrite = m_islotWritePos;
+ }
+
+ void MarkFullyWritten();
+
+ void SetSegMin(int islot, bool fAdjusting = false)
+ {
+ Assert(fAdjusting || m_islotSegMin == -1 || m_islotSegMin == islot);
+ m_islotSegMin = islot;
+ }
+ void SetSegMinToWritePos(bool fMod = true)
+ {
+ if (m_islotSegMin == -1)
+ m_islotSegMin = m_islotWritePos;
+ else
+ Assert(m_islotSegMin <= m_islotWritePos); // eg, already set to before the initial LB
+ }
+ int SegMin()
+ {
+ return m_islotSegMin;
+ }
+ void SetSegLim(int islot)
+ {
+ m_islotSegLim = islot;
+ }
+ void SetSegLimToWritePos(bool fMod = true)
+ {
+ if (m_islotSegLim > -1 && !fMod)
+ {
+ Assert(m_islotSegLim <= m_islotWritePos);
+ return;
+ }
+ m_islotSegLim = m_islotWritePos;
+ }
+ int SegLimIfKnown()
+ {
+ return m_islotSegLim;
+ }
+ int FinalSegLim()
+ {
+ if (m_islotSegLim > -1)
+ return m_islotSegLim;
+ else
+ return m_islotWritePos;
+ }
+
+ // Return true if we are exactly at the segment min.
+ bool AtSegMin()
+ {
+ if (m_islotSegMin == -1)
+ return false;
+ return (m_islotSegMin == ReadPosForNextGet());
+ }
+
+ // Return true if we are exactly at the segment lim.
+ bool AtSegLim()
+ {
+ if (m_islotSegLim == -1)
+ return false;
+ return (m_islotSegLim == ReadPosForNextGet());
+ }
+
+ int ReadPosMax()
+ {
+ return m_islotReadPosMax;
+ }
+ void SetReadPosMax(int islot)
+ {
+ m_islotReadPosMax = std::max(m_islotReadPosMax, islot);
+ }
+
+ int OldDirLevelRange(EngineState * pengst, int islotStart, int nTopDirection);
+ int DirLevelRange(EngineState * pengst, int islotStart, int nTopDirection,
+ std::vector<int> & vislotStarts, std::vector<int> & vislotStops);
+ int GetSlotDirLevel(EngineState * pengst, int islot,
+ int nOuterLevel, int nCurrLevel, DirCode dircMarker, DirCode dircOverride);
+ DirCode AdjacentStrongCode(EngineState * pengst, int islot, int nInc,
+ DirCode dircPDF, bool fNumbersAreStrong = false);
+ DirCode TerminatorSequence(EngineState * pengst, int islot, int nInc, DirCode dircPDF);
+ DirCode AdjacentNonBndNeutralCode(EngineState * pengst, int islot, int nInc,
+ DirCode dircPDF);
+
+ void CopyOneSlotFrom(GrSlotStream * psstrmPrev);
+ void SimpleCopyFrom(GrSlotStream * psstrmI, int islotInput, int islotOutput);
+
+ bool MoreSpace(GrTableManager * ptman,
+ float xsSpaceAllotted, bool fWidthIsCharCount,
+ bool fIgnoreTrailingWS, TrWsHandling twsh,
+ float * pxsWidth);
+
+ int InsertLineBreak(GrTableManager * ptman,
+ int islotPrevBreak, bool fInsertedLB, int islotStartTry,
+ LineBrk lb, TrWsHandling twsh, int islotMin, LineBrk * plbNextToTry);
+ int MakeSegmentBreak(GrTableManager * ptman,
+ int islotPrevBreak, bool fInsertedLB, int islotStartTry,
+ LineBrk lb, TrWsHandling twsh, int islotMin, LineBrk * plbNextToTry);
+ bool FindSegmentEnd(GrTableManager * ptman,
+ int islotStartTry, LineBrk lb, TrWsHandling twsh, int islotMin,
+ int * pislot, int * pichwSegOffset,
+ LineBrk * plbFound, LineBrk * plbNextToTry);
+ bool HasEarlierBetterBreak(int islotBreak, LineBrk lbFound, gid16 chwLB);
+ LineBrk BreakWeightAt(gid16 chwLB, int islot);
+ void AppendLineBreak(GrTableManager *, GrCharStream * pchstrm,
+ LineBrk, DirCode dirc, int islot, bool fInitial, int ichwSegOffset);
+ int FindFinalLineBreak(gid16 chwLB, int islotMin, int islotLim);
+ void AdjustPrevStreamNextChunkMap(GrTableManager * ptman, int islotMod, int nInc);
+ void AdjustNextChunkMap(int islotMin, int islotMod, int nInc);
+
+ void EnsureLocalCopy(GrTableManager * ptman, GrSlotState * pslot, GrSlotStream * psstrmIn);
+ void ReplaceSlotInReprocessBuffer(GrSlotState * pslotOld, GrSlotState * pslotNew);
+
+ void ZapCalculatedDirLevels(int islotLB);
+
+ int MaxClusterSlot(int islotChunkLim)
+ {
+ return MaxClusterSlot(islotChunkLim - 1, islotChunkLim);
+ }
+ int MaxClusterSlot(int islotChunkMin, int islotChunkLim);
+
+ void UnwindInput( int islot, bool fPreBidiPass);
+ void UnwindOutput(int islot, bool fOutputOfPosPass);
+
+ void MapInputChunk( int islotIn, int islotOut, int islotInLim,
+ bool fReprocessing, bool fBackingUp);
+ void MapOutputChunk(int islotOut, int islotIn, int islotOutLim,
+ bool fReprocessing, int cslotReprocess, bool fBackingUp);
+
+ int LastNextChunkLength();
+
+ int ChunkInPrev(int i)
+ {
+ Assert(i >= 0);
+ Assert(i < signed(m_vislotPrevChunkMap.size()));
+ Assert(i < m_islotWritePos);
+ return m_vislotPrevChunkMap[i];
+ }
+ int ChunkInNext(int i)
+ {
+ Assert(i >= 0);
+ Assert(i < signed(m_vislotNextChunkMap.size()));
+ Assert(i < m_islotReadPos);
+ return m_vislotNextChunkMap[i];
+ }
+
+ int ChunkInNextMin(int islot);
+ int ChunkInNextLim(int islot);
+
+ void ResyncSkip(int nslot);
+ int SlotsSkippedToResync()
+ {
+ return m_cslotSkippedForResync;
+ }
+ void ClearSlotsSkippedToResync()
+ {
+ m_cslotSkippedForResync = 0;
+ }
+
+ int IndexOffset()
+ {
+ Assert(GotIndexOffset()); // should have been calculated
+ return m_cslotPreSeg;
+ }
+ void SetIndexOffset(int c)
+ {
+ m_cslotPreSeg = c;
+ }
+ bool GotIndexOffset()
+ {
+ return (m_cslotPreSeg >= 0);
+ }
+ void CalcIndexOffset(GrTableManager * ptman);
+
+ void SetPosForNextRule(int nslot, GrSlotStream * psstrmInput, bool fOutputOfPosPass);
+ void SetLBContextFlag(GrTableManager * ptman, int islotStart);
+ int SlotsToReprocess();
+
+ void SetNeutralAssociations(gid16 chwLB);
+protected:
+ GrSlotState * FindAssociatedSlot(int islot, int nInc, gid16 chwLB);
+
+ GrSlotState * GetSlotAt(int islot);
+
+public:
+ // Used by the action code:
+ void BackupReadPos(int cslot = 1)
+ {
+ for (int islot = 0; islot < cslot; islot++)
+ {
+ if (m_islotReprocLim > -1 && m_islotReprocLim == m_islotReadPos)
+ {
+ if (m_islotReprocPos == -1)
+ m_islotReprocPos = m_vpslotReproc.size() - 1;
+ else
+ --m_islotReprocPos;
+ Assert(m_islotReprocPos >= 0);
+ }
+ else
+ --m_islotReadPos;
+ }
+ }
+
+ GrSlotState * RuleInputSlot(int dislot = 0, GrSlotStream * psstrmOut = NULL,
+ bool fNullOkay = false);
+ GrSlotState * RuleOutputSlot(int dislot = 0);
+
+ void PutSlotAt(GrSlotState * pslot, int islot)
+ {
+ // Currently only used for the final pass, when applying justify.width to
+ // the advance width.
+ Assert(signed(m_vpslot.size()) > islot);
+ Assert(WritePos() > islot);
+ Assert(ReadPos() <= islot);
+ Assert(SlotsToReprocess() == 0);
+ m_vpslot[islot] = pslot;
+ }
+
+protected:
+ // Instance variables:
+ int m_ipass; // which pass this stream is serving as OUTPUT of
+
+ std::vector<GrSlotState*> m_vpslot; // the slots being processed
+
+ // Chunking information:
+ std::vector<int> m_vislotPrevChunkMap; // chunk mapping into previous stream;
+ // -1 if not at a chunk boundary
+ // (this information is needed for
+ // reinitialization after inserting a line break)
+
+ std::vector<int> m_vislotNextChunkMap; // chunk mapping into next stream, or -1
+ // (this information is needed for backtracking)
+
+ // Since most streams serve as both input and output, there are two positions.
+ // Note that readPos <= writePos always.
+ int m_islotWritePos; // where previous pass should put next output
+ int m_islotReadPos; // where following pass should start processing from
+
+ // When we are reprocessing some of the output from the next stream:
+ std::vector<GrSlotState*> m_vpslotReproc; // temporary buffer
+ int m_islotReprocLim; // the read position corresponding to the end of the reprocess
+ // buffer; -1 if buffer is invalid
+ int m_islotReprocPos; // index into m_vpslotReproc from where we should read next;
+ // -1 if we are not reprocessing
+
+ int m_islotRuleStartRead; // read position when the rule was started; any requests before
+ // this point should access the output stream, because it has
+ // the most up-to-date values.
+ int m_islotRuleStartWrite; // write position when the rule started
+
+ bool m_fFullyWritten; // set to true when we can't get any more from the
+ // previous pass; initially false.
+
+ int m_islotSegMin; // the official min of the segment; -1 if not yet set
+ int m_islotSegLim; // the official lim of the segment; -1 if not yet set
+ // (only set for the output of the final line-break pass
+ // and those beyond)
+
+ int m_cslotSkippedForResync; // number of slots skipped to resync;
+ // specifically, the number of slots' worth of the
+ // next-chunk-map that are invalid, not mapped
+ // to any slots in the following stream
+
+ int m_cslotPreSeg; // number of slots previous to the official beginning of the segment;
+ // -1 if we haven't figured it out yet. Used for keeping streams
+ // in the positioning pass in sync; not particularly useful for
+ // substitution passes, and will possibly be left uncalculated.
+
+ bool m_fUsedByPosPass; // true if this is input to or output from a positioning pass
+ bool m_fInputToPosPass1; // true if this is the input to the first positioning pass
+
+ // Max value of m_islotReadPos; used for recognizing infinite loops and forcibly
+ // advancing (see GrPass::CheckInputProgress).
+ int m_islotReadPosMax;
+
+public:
+ // For transduction logging:
+#ifdef TRACING
+// void LogSlotGlyphs(std::ofstream & strmOut, gid16 chwLB);
+#endif // TRACING
+
+ // For test procedures:
+ int NumberOfSlots() { return m_vpslot.size(); }
+ GrSlotState * LastSlotWritten()
+ {
+ if (m_islotWritePos == 0)
+ return NULL;
+ else
+ return m_vpslot[m_islotWritePos-1];
+ }
+ GrSlotState * LastSlotRead()
+ {
+ if (m_islotReadPos == 0)
+ return NULL;
+ else
+ return m_vpslot[m_islotReadPos-1];
+ }
+
+ gid16 GlyphIDAt(int islot)
+ {
+ return m_vpslot[islot]->m_chwGlyphID;
+ }
+
+ int PreChunk() // answer the number of prepended items that are not in any chunk;
+ // should be obsolete now
+ {
+ int islot;
+ for (islot = 0; islot < m_islotReadPos; ++islot)
+ {
+ if (m_vislotNextChunkMap[islot] != -1)
+ return islot;
+ }
+ Assert(false);
+ return islot;
+ }
+
+}; // end of class GrSlotStream
+
+} // namespace gr
+
+
+#endif // !SLOTSTREAM_INCLUDED
diff --git a/Build/source/libs/graphite/src/segment/GrTableManager.cpp b/Build/source/libs/graphite/src/segment/GrTableManager.cpp
new file mode 100644
index 00000000000..fde364e7e2e
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrTableManager.cpp
@@ -0,0 +1,2691 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrTableManager.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ GrTableManager, which handles the interactions between passes, including the demand-pull
+ algorithm.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#undef THIS_FILE
+DEFINE_THIS_FILE
+//#ifndef _WIN32
+#include <stdlib.h>
+#include <math.h>
+//#endif
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Constructors and initializers
+----------------------------------------------------------------------------------------------*/
+EngineState::EngineState()
+ : m_ipassJustCalled(-1),
+ m_fStartLineContext(false),
+ m_fEndLineContext(false),
+ ////m_pgg(NULL),
+ m_cslotPreSeg(0),
+ m_islotblkCurr(-1),
+ m_islotNext(kSlotBlockSize),
+ m_fInitialLB(false),
+ m_fFinalLB(false),
+ m_fInsertedLB(false),
+ m_fExceededSpace(false),
+ m_fHitHardBreak(false),
+ m_fRemovedWhtsp(false),
+ m_dxsShrinkPossible(GrSlotState::kNotYetSet),
+ m_islotPosNext(-1),
+ m_xsPosXNext(0),
+ m_ysPosYNext(0),
+ m_dxsTotWidthSoFar(0),
+ m_dxsVisWidthSoFar(0),
+ m_prgzpst(NULL),
+ m_prgpsstrm(NULL)
+{
+ m_vslotblk.clear();
+ m_vprgnSlotVarLenBufs.clear();
+}
+
+void EngineState::Initialize(GrEngine * pgreng, GrTableManager * ptman)
+{
+ m_ptman = ptman;
+ m_cpass = ptman->NumberOfPasses(); // duplicate for convenience
+
+ m_cUserDefn = pgreng->NumUserDefn();
+ m_cFeat = pgreng->NumFeat();
+ m_cCompPerLig = pgreng->NumCompPerLig();
+
+ if (m_prgzpst)
+ delete[] m_prgzpst;
+ m_prgzpst = new PassState[m_cpass];
+ ptman->StorePassStates(m_prgzpst);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Destructors
+----------------------------------------------------------------------------------------------*/
+GrTableManager::~GrTableManager()
+{
+ for (int ipass = 0; ipass < m_cpass; ++ipass)
+ delete Pass(ipass);
+
+ delete[] m_prgppass;
+}
+
+EngineState::~EngineState()
+{
+ DestroySlotBlocks();
+
+ delete[] m_prgzpst;
+
+ if (m_prgpsstrm)
+ {
+ for (int isstrm = 0; isstrm < m_cpass; ++isstrm)
+ delete OutputStream(isstrm);
+
+ delete[] m_prgpsstrm;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Delete all the slots.
+----------------------------------------------------------------------------------------------*/
+void EngineState::DestroySlotBlocks()
+{
+ Assert(m_vslotblk.size() == m_vprgnSlotVarLenBufs.size());
+ for (size_t islotblk = 0; islotblk < m_vslotblk.size(); ++islotblk)
+ {
+ delete[] m_vslotblk[islotblk];
+ delete[] m_vprgnSlotVarLenBufs[islotblk];
+ }
+ m_vslotblk.clear();
+ m_vprgnSlotVarLenBufs.clear();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Create the passes, and them fill them in by reading from the file stream.
+----------------------------------------------------------------------------------------------*/
+bool GrTableManager::CreateAndReadPasses(GrIStream & grstrm,
+ int fxdSilfVersion, int fxdRuleVersion,
+ int cpassFont, long lSubTableStart, int * rgnPassOffsets,
+ int ipassSub1Font, int ipassPos1Font, int ipassJust1Font, byte ipassPostBidiFont)
+{
+ Assert(ipassSub1Font <= ipassJust1Font);
+ Assert(ipassJust1Font <= ipassPos1Font);
+ Assert(ipassPos1Font <= cpassFont);
+ if (ipassSub1Font > ipassJust1Font || ipassJust1Font > ipassPos1Font
+ || ipassPos1Font > cpassFont)
+ {
+ return false; // bad table
+ }
+
+ // Adjusted indices based on the fact that we have a glyph generation pass that is
+ // pass 0, and possibly a bidi pass:
+ m_cpass = cpassFont + 1;
+ int ipassLB1, ipassSub1, ipassBidi, ipassPos1, ipassJust1;
+ ipassLB1 = 1;
+ ipassSub1 = ipassSub1Font + 1;
+ if (ipassPostBidiFont == 0xFF)
+ {
+ // No bidi pass.
+ m_fBidi = false;
+ // Add 1 below to account for the glyph-generation pass.
+ ipassPos1 = ipassPos1Font + 1;
+ ipassJust1 = ipassJust1Font + 1;
+ ipassBidi = ipassJust1;
+ }
+ else
+ {
+ m_fBidi = true;
+ m_cpass++;
+ Assert(ipassPostBidiFont == ipassJust1Font);
+ ipassJust1 = ipassJust1Font + 2;
+ ipassPos1 = ipassPos1Font + 2;
+ ipassBidi = ipassJust1 - 1;
+ }
+
+ // Always make at least one positioning pass, even if there are no rules.
+ if (ipassPos1 == m_cpass)
+ {
+ m_cpass++;
+ }
+
+ m_prgppass = new GrPass*[m_cpass + 1];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+
+ int ipass = 1;
+ int ipassFont = 0;
+ m_cpassLB = 0;
+ m_ipassJust1 = 1;
+ m_ipassPos1 = 1;
+ for ( ; ipass < m_cpass; ipass++, ipassFont++)
+ {
+ if (ipass < ipassSub1)
+ {
+ m_prgppass[ipass] = new GrLineBreakPass(ipass);
+ m_prgppass[ipass]->ReadFromFont(grstrm, fxdSilfVersion, fxdRuleVersion,
+ lSubTableStart + rgnPassOffsets[ipassFont]);
+ m_cpassLB++;
+ m_ipassJust1++;
+ m_ipassPos1++;
+ }
+ else if (ipassSub1 <= ipass && ipass < ipassBidi)
+ {
+ m_prgppass[ipass] = new GrSubPass(ipass);
+ m_prgppass[ipass]->ReadFromFont(grstrm, fxdSilfVersion, fxdRuleVersion,
+ lSubTableStart + rgnPassOffsets[ipassFont]);
+ m_ipassJust1++;
+ m_ipassPos1++;
+ }
+ else if (ipassBidi == ipass && ipass < ipassJust1)
+ {
+ m_prgppass[ipass] = new GrBidiPass(ipass);
+ m_prgppass[ipass]->SetTopDirLevel(TopDirectionLevel());
+ ipassFont--; // no corresponding pass in font
+ m_ipassJust1++;
+ m_ipassPos1++;
+ }
+ else if (ipassJust1 <= ipass && ipass < ipassPos1)
+ {
+ // A justification pass is, in essence, a substitution pass.
+ m_prgppass[ipass] = new GrSubPass(ipass);
+ m_prgppass[ipass]->ReadFromFont(grstrm, fxdSilfVersion, fxdRuleVersion,
+ lSubTableStart + rgnPassOffsets[ipassFont]);
+ m_ipassPos1++;
+ }
+ else if (ipassPos1 <= ipass)
+ {
+ m_prgppass[ipass] = new GrPosPass(ipass);
+ if (ipassFont < cpassFont)
+ {
+ m_prgppass[ipass]->ReadFromFont(grstrm, fxdSilfVersion, fxdRuleVersion,
+ lSubTableStart + rgnPassOffsets[ipassFont]);
+ }
+ else
+ {
+ // No positioning pass in font: create a bogus one.
+ m_prgppass[ipass]->InitializeWithNoRules();
+ }
+ }
+ else
+ {
+ Assert(false);
+ return false; // bad table
+ }
+ }
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Create passes corresponding to an invalid font.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::CreateEmpty()
+{
+ m_cpass = 2;
+
+ m_prgppass = new GrPass*[2];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+
+ m_prgppass[1] = new GrPosPass(1);
+ m_prgppass[1]->InitializeWithNoRules();
+
+ m_ipassPos1 = 1;
+ m_cpassLB = 0;
+ m_fBidi = false;
+
+ m_engst.CreateEmpty();
+}
+
+void EngineState::CreateEmpty()
+{
+ m_fStartLineContext = false;
+ m_fEndLineContext = false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Create the slot streams corresponding to the passes.
+----------------------------------------------------------------------------------------------*/
+void EngineState::CreateSlotStreams()
+{
+ if (m_prgpsstrm)
+ return;
+
+ m_prgpsstrm = new GrSlotStream * [m_cpass];
+ for (int ipass = 0; ipass < m_cpass; ++ipass)
+ {
+ m_prgpsstrm[ipass] = new GrSlotStream(ipass);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Store information about the pass-states in the pass objects.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::StorePassStates(PassState * rgzpst)
+{
+ for (int ipass = 0; ipass < m_cpass; ipass++)
+ Pass(ipass)->SetPassState(rgzpst + ipass);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Demand-driven loop: with goal of filling up final slot stream, loop backward and forward
+ filling up slot streams until final stream has reached physical capacity.
+
+ @param pgjus - justification agent; NULL if justification is of no interest
+ @param jmodi - (internal) justification mode
+ @param fStartLine, fEndLine
+ @param ichSegLim - known end of segment; -1 when using backtracking
+ @param dxWidthRequested - available width; when justifying, exact width desired
+ @param dxUnjustifiedWidth - when justifying, what the width would be normally
+ @param fNeedFinalBreak - true if the end of the segment needs to be a valid break point
+ @param fMoreText - true if char stream doesn't go up to text-stream lim
+ @param ichFontLim - end of the range that could be rendered by this font
+ @param fInfiniteWidth - used for "measured" segments
+ @param fWidthIsCharCount - kludge for test procedures: the width is a character count,
+ not a pixel count
+ @param lbPref - try for longest segment ending with this breakweight
+ - when justifying, lb to assume
+ @param lbMax - max (last resort) breakweight if no preferred break possible
+ @param ichwCallerBtLim - caller's backtrack lim; -1 if caller is not backtracking
+ @param twsh - how to handle trailing white-space
+ @param fParaRtl - overall paragraph direction
+ @param nDirDepth - direction depth of this segment
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::Run(Segment * psegNew, Font * pfont,
+ GrCharStream * pchstrm, IGrJustifier * pgjus, int jmodi,
+ LayoutEnvironment & layout,
+ int ichSegLim,
+ float dxWidthRequested, float dxUnjustifiedWidth,
+ bool fNeedFinalBreak, bool fMoreText, int ichFontLim,
+ bool fInfiniteWidth, bool fWidthIsCharCount,
+ int ichwCallerBtLim,
+ int nDirDepth, SegEnd estJ)
+{
+ bool fStartLine = layout.startOfLine();
+ bool fEndLine = layout.endOfLine();
+ LineBrk lbPref = layout.bestBreak();
+ LineBrk lbMax = layout.worstBreak();
+ TrWsHandling twsh = layout.trailingWs();
+ bool fParaRtl = layout.rightToLeft();
+ Segment * psegPrev = layout.prevSegment();
+ Segment * psegInit = layout.segmentForInit();
+ std::ostream * pstrmLog = layout.loggingStream();
+
+ m_engst.Initialize(Engine(), this); // do this after the tables have been fully read
+ m_engst.m_jmodi = jmodi;
+ m_engst.m_ipassJustCalled = -1;
+ m_engst.m_twsh = twsh;
+ m_engst.m_fParaRtl = fParaRtl;
+ m_engst.m_dxsShrinkPossible = GrSlotState::kNotYetSet;
+ m_fLogging = (pstrmLog != NULL);
+
+ int cbPrev;
+ byte * pbPrevSegDat = NULL;
+ if (psegPrev)
+ cbPrev = psegPrev->NextSegInitBuffer(&pbPrevSegDat);
+ else if (psegInit)
+ cbPrev = psegInit->ThisSegInitBuffer(&pbPrevSegDat);
+ else
+ cbPrev = 0;
+
+ if (pchstrm->IsEmpty())
+ {
+ m_engst.m_lbPrevEnd = klbNoBreak;
+ InitSegmentAsEmpty(psegNew, pfont, pchstrm, fStartLine, fEndLine);
+ psegNew->SetWidths(0, 0);
+ psegNew->SetUpOutputArrays(pfont, this, NULL, 0, 0, 0, twsh,
+ fParaRtl, nDirDepth, true);
+ psegNew->SetLayout(layout);
+ return;
+ }
+
+ int islotUnderBreak = -1; // position of inserted or final break point in underlying
+ // data; none so far (if an actual LB has been inserted,
+ // this is the index of that slot; otherwise it is the
+ // index of the last valid slot)
+ int islotSurfaceBreak = -1; // position of line break in surface stream; none so far
+ LineBrk lbBestToTry = lbPref;
+ LineBrk lbFound = klbNoBreak;
+
+ float dxMaxWidth = dxWidthRequested;
+
+ if (m_engst.m_jmodi == kjmodiJustify)
+ {
+ Assert(fInfiniteWidth);
+ lbBestToTry = klbClipBreak;
+ lbFound = lbPref;
+ }
+
+ float dxWidth;
+
+ std::vector<int> vnslotNeeded;
+ vnslotNeeded.resize(m_cpass);
+
+ m_engst.InitializeStreams(this, pchstrm, cbPrev, pbPrevSegDat, fNeedFinalBreak, &islotUnderBreak);
+
+ int ipassCurr;
+ int nNeedInput; // kNextPass: go on to the next pass
+ // kBacktrack: need to insert a line break
+ // > 0: need more input from previous pass
+
+ int cchwPostXlbContext = m_pgreng->PostXlbContext();
+ if (ichSegLim > -1)
+ {
+ // When we know exactly where the end of the segment will be, get as much as
+ // we need from the character stream, and then fill up the remaining streams.
+ // (3 below is an arbitrary number; we just want to get slightly more than
+ // we really need.)
+ vnslotNeeded[0] = ichSegLim - pchstrm->Min() + cchwPostXlbContext + 3;
+ for (int ipass = 1; ipass < m_cpass; ipass++)
+ vnslotNeeded[ipass] = 10000;
+ // Start at pass 0.
+ ipassCurr = 0;
+ }
+ else
+ {
+ // When we're doing line-breaking to find the end of the segment, use the
+ // demand-driven approach that tries to fill up the available space.
+ vnslotNeeded[m_cpass - 1] = 1;
+
+ // Start at the last pass. (It might be more efficient to start at the first pass and
+ // generate a small arbitrary number of glyphs.)
+ ipassCurr = m_cpass - 1;
+ }
+
+ while (ipassCurr < m_cpass)
+ {
+ if (ipassCurr == 0)
+ {
+ int nNeedNow = vnslotNeeded[0];
+ // Zeroth pass: generate glyph IDs from the underlying input.
+ nNeedInput = Pass(0)->ExtendGlyphIDOutput(this,
+ pchstrm, OutputStream(0), ichSegLim, cchwPostXlbContext, lbPref,
+ nNeedNow, fNeedFinalBreak, m_engst.m_twsh, &islotUnderBreak);
+ Assert(nNeedInput == kNextPass || nNeedInput == kBacktrack);
+ vnslotNeeded[0] -= nNeedNow;
+ }
+ else if (ipassCurr < m_cpass - 1)
+ {
+ // Middle pass.
+ int cslotNeedNow = vnslotNeeded[ipassCurr];
+ cslotNeedNow = max(1, cslotNeedNow);
+ int cslotGot;
+ Pass(ipassCurr)->ExtendOutput(this,
+ InputStream(ipassCurr), OutputStream(ipassCurr), cslotNeedNow, twsh,
+ &nNeedInput, &cslotGot, &islotUnderBreak);
+ vnslotNeeded[ipassCurr] -= cslotGot;
+ //if (nNeedInput != kNextPass && nNeedInput != kBacktrack)
+ // nNeedInput = max(nNeedInput, cslotNeedNow - cslotGot);
+ }
+ else // (ipassCurr == m_cpass - 1)
+ {
+ // Final pass: position and test allotted space.
+ float dxWidthWShrink = dxMaxWidth;
+ if (m_engst.m_dxsShrinkPossible != GrSlotState::kNotYetSet)
+ dxWidthWShrink += (int)m_engst.m_dxsShrinkPossible;
+ nNeedInput = Pass(ipassCurr)->ExtendFinalOutput(this,
+ InputStream(ipassCurr), OutputStream(ipassCurr),
+ dxWidthWShrink, fWidthIsCharCount, fInfiniteWidth,
+ (islotUnderBreak > -1), (fNeedFinalBreak && lbFound == klbNoBreak),
+ lbMax, twsh,
+ &islotSurfaceBreak, &dxWidth);
+ }
+
+ if (m_engst.m_jmodi == kjmodiJustify)
+ {
+ if (ipassCurr < m_ipassJust1 && !OutputStream(ipassCurr)->FullyWritten())
+ {
+ // When justifying, fill up all the streams up to the point where we need
+ // to interact with the justification routine.
+ // I think this code is obsolete.
+ int nStillNeed = 1000;
+ if ((ipassCurr == 1 && nNeedInput != kNextPass) || ipassCurr == 0)
+ nStillNeed = ichSegLim - (pchstrm->Pos() - pchstrm->Min())
+ + cchwPostXlbContext + 3;
+ if (nStillNeed > 0)
+ {
+ if (nNeedInput == kNextPass)
+ ipassCurr++; // repeat this pass
+ nNeedInput = nStillNeed;
+ }
+ }
+ else if (nNeedInput == kNextPass && ipassCurr + 1 == m_ipassJust1)
+ {
+ CallJustifier(pgjus, ipassCurr, dxUnjustifiedWidth, dxWidthRequested, fEndLine);
+ }
+ }
+ DetermineShrink(pgjus, ipassCurr);
+
+ if (nNeedInput == kBacktrack)
+ {
+ // Final output has overflowed its space--find (or adjust) the break point.
+
+ bool fFoundBreak = Backtrack(&islotUnderBreak,
+ &lbBestToTry, lbMax, twsh, fMoreText, ichwCallerBtLim, &lbFound);
+ if (!fFoundBreak)
+ {
+ // Nothing will fit. Initialize the new segment just enough so that
+ // we can delete it.
+ InitSegmentToDelete(psegNew, pfont, pchstrm);
+ return;
+ }
+ }
+ else if (nNeedInput == kNextPass)
+ {
+ // This pass is sufficiently full--return to following pass.
+ ipassCurr++;
+ }
+ else
+ {
+ // Get more input from previous pass.
+ ipassCurr--;
+ vnslotNeeded[ipassCurr] = nNeedInput;
+ }
+ }
+
+ // At this point we have fully transduced all the text for this segment.
+
+ // Figure out why we broke the segment and what the caller is supposed to do about it.
+ SegEnd est;
+ if (m_engst.m_jmodi == kjmodiJustify)
+ {
+ // Don't change what was passed in.
+ est = estJ;
+ }
+ else if (m_engst.m_fRemovedWhtsp) // (islotUnderBreak > -1 && twsh == ktwshNoWs)
+ {
+ Assert(!m_engst.m_fInsertedLB);
+ est = kestMoreWhtsp;
+ }
+
+ else if (m_engst.m_fHitHardBreak)
+ {
+ est = kestHardBreak;
+ }
+
+ else if (!m_engst.m_fExceededSpace && !fMoreText)
+ // Rendered to the end of the original requested range.
+ est = kestNoMore;
+
+// else if (!m_fExceededSpace && !fNextIsSameWs && fMoreText)
+// // Writing system break; may be more room on the line. But see tweak below.
+// *pest = kestWsBreak;
+
+ else if (m_engst.m_fExceededSpace)
+ {
+ // Exceeded available space, found a legal break.
+ if (twsh == ktwshNoWs && m_engst.m_fRemovedWhtsp)
+ est = kestMoreWhtsp;
+ else
+ est = kestMoreLines;
+ }
+
+ else if (twsh == ktwshOnlyWs)
+ {
+ est = kestOkayBreak; // but see tweak below
+ }
+
+ else
+ {
+ // Broke because of something like a font change. Determine whether this is a legal
+ // break or not.
+ // TODO SharonC: handle the situation where it is legal to break BEFORE the first
+ // character of the following segment.
+ Assert(fMoreText);
+ //Assert(fNextIsSameWs);
+ if (ichwCallerBtLim > -1)
+ {
+ Assert(m_engst.m_fInsertedLB);
+ }
+ else if (ichSegLim > -1)
+ {
+ // We stopped where caller said to.
+ Assert(fInfiniteWidth);
+ }
+ else
+ {
+ Assert(!m_engst.m_fInsertedLB);
+ Assert(islotUnderBreak == -1 || m_engst.m_fFinalLB);
+ }
+ int islotTmp = OutputStream(m_cpass - 1)->WritePos();
+ GrSlotState * pslotTmp;
+ if (m_engst.m_fFinalLB || m_engst.m_fInsertedLB)
+ pslotTmp = OutputStream(m_cpass-1)->SlotAt(islotTmp - 2);
+ else
+ pslotTmp = OutputStream(m_cpass-1)->SlotAt(islotTmp - 1);
+
+ if (abs(pslotTmp->BreakWeight()) <= lbPref)
+ est = kestOkayBreak;
+
+ else if (abs(pslotTmp->BreakWeight()) > lbMax)
+ est = kestBadBreak;
+
+ else if (OutputStream(m_cpassLB)->HasEarlierBetterBreak(islotUnderBreak, lbFound,
+ this->LBGlyphID()))
+ {
+ est = kestBadBreak;
+ }
+ else
+ est = kestOkayBreak;
+
+ // We no longer have the ability to know whether or not the next segment will use
+ // the same writing system.
+ //if (est == kestBadBreak && m_engst.m_fExceededSpace && !fNextIsSameWs && fMoreText)
+ // est = kestWsBreak;
+ }
+
+ // Make a segment out of it and return it.
+ int dichSegLen;
+ InitNewSegment(psegNew, pfont, pchstrm, pgjus,
+ islotUnderBreak, islotSurfaceBreak, fStartLine, fEndLine, ichFontLim, lbFound, est,
+ &dichSegLen);
+ if (psegNew->segmentTermination() == kestNothingFit)
+ {
+ return;
+ }
+ else if (psegNew->segmentTermination() == kestHardBreak &&
+ psegNew->startCharacter() == psegNew->stopCharacter())
+ {
+ // Empty segment caused by a hard-break.
+ m_engst.m_lbPrevEnd = klbNoBreak;
+ psegNew->SetWidths(0, 0);
+ psegNew->SetUpOutputArrays(pfont, this, NULL, 0, 0, 0, twsh,
+ fParaRtl, nDirDepth, true);
+ psegNew->SetLayout(layout);
+ return;
+ }
+
+ psegNew->RecordInitializationForThisSeg(cbPrev, pbPrevSegDat);
+
+ if ((est == kestNoMore || est == kestWsBreak) && twsh == ktwshOnlyWs &&
+ dichSegLen < pchstrm->Lim() - pchstrm->Min())
+ {
+ // If we are asking for white-space only, and we didn't use up everything in the font
+ // range, we could possibly have gotten an initial white-space only segment
+ // (as opposed to a writing system break).
+ est = kestOkayBreak;
+ psegNew->FixTermination(est);
+ }
+
+ SetFinalPositions(psegNew, fWidthIsCharCount);
+
+ // Do this before fixing up the associations below, so we can see the raw ones produced by the
+ // rules themselves.
+ //if (m_pgreng->LoggingTransduction())
+ // WriteTransductionLog(pchstrm, *ppsegRet,
+ // cbPrev, pbPrevSegDat, pbNextSegDat, pcbNextSegDat);
+ WriteTransductionLog(pstrmLog, pchstrm, psegNew, cbPrev, pbPrevSegDat);
+
+ RecordAssocsAndOutput(pfont, psegNew, twsh, fParaRtl, nDirDepth);
+
+ // Do this after fixing up the associations.
+ //if (m_pgreng->LoggingTransduction())
+ // WriteAssociationLog(pchstrm, *ppsegRet);
+ WriteAssociationLog(pstrmLog, pchstrm, psegNew);
+
+ psegNew->SetLayout(layout);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Create a new segment to return.
+
+ @param pchstrm - input stream
+ @param pgjus - justification agent, in case this segment needs to be
+ stretched or shrunk
+ @param islotLBStreamBreak - position of inserted line break slot (which should be equal
+ to the position in the glyph generation stream);
+ -1 if no line-break was inserted (we rendered to the
+ end of the range)
+ @param islotSurfaceBreak - position of line break slot in final (surface) stream
+ @param fStartLine - does this segment start a line?
+ @param fEndLine - does this segment end a line?
+ @param ichFontLim - end of range that could be rendered by this font
+ @param lbEndFound - line break found; possibly adjusted here
+ @param est - why did the segment terminate
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::InitNewSegment(Segment * psegNew,
+ Font * pfont, GrCharStream * pchstrm, IGrJustifier * pgjus,
+ int islotLBStreamBreak, int islotSurfaceBreak, bool fStartLine, bool fEndLine, int ichFontLim,
+ LineBrk lbEndFound, SegEnd est, int * pdichSegLen)
+{
+ LineBrk lbStart = m_engst.m_lbPrevEnd;
+ LineBrk lbEnd = lbEndFound;
+ if (est == kestBadBreak)
+ lbEnd = klbLetterBreak;
+
+ int ichwMin = pchstrm->Min();
+ int ichwLim;
+
+// int cslotPreSegStream0 = m_cslotPreSeg;
+// if (m_fInitialLB && m_cpassLB > 0)
+// {
+// // Initial LB is included in m_cslotPreSeg, but is not in stream 0.
+// // --Not really needed, because both islotLBStreamBreak and m_cslotPreSeg take
+// // the initial LB into account if it is there.
+// cslotPreSegStream0--;
+// }
+
+ // No longer have to subtract this, because the chunk map takes it into
+ // consideration.
+ //int cslotPreInitialLB = m_cslotPreSeg - (m_fInitialLB ? 1 : 0);
+
+ //int ichwOldTmp;
+
+ if (m_engst.m_fInsertedLB)
+ {
+ Assert(islotLBStreamBreak > -1);
+ int ichwSegLim = m_engst.LbSlotToSegLim(islotLBStreamBreak, pchstrm, m_cpassLB);
+ ichwLim = ichwSegLim + pchstrm->Min(); // - cslotPreInitialLB;
+
+ // Old result, for debugging:
+ //ichwOldTmp = islotLBStreamBreak + pchstrm->Min() - m_cslotPreSeg;
+ }
+ else if (m_engst.m_fFinalLB || islotLBStreamBreak == -1)
+ ichwLim = pchstrm->Lim();
+ else
+ {
+ int ichwSegLim = m_engst.LbSlotToSegLim(islotLBStreamBreak, pchstrm, m_cpassLB);
+ ichwLim = ichwSegLim + pchstrm->Min(); // - cslotPreInitialLB;
+
+ // Old result, for debugging:
+ // islotLBStreamBreak is the last slot in the segment, not the LB glyph; hence +1.
+ //ichwOldTmp = islotLBStreamBreak + pchstrm->Min() - m_cslotPreSeg + 1;
+ }
+
+ *pdichSegLen = ichwLim - ichwMin;
+
+ if (ichwMin >= ichwLim)
+ {
+ if (est == kestHardBreak)
+ {
+ // Empty segment cause by a hard-break.
+ InitSegmentAsEmpty(psegNew, pfont, pchstrm, fStartLine, fEndLine);
+ psegNew->FixTermination(est);
+ }
+ else
+ {
+ // Invalid empty segment.
+ Assert(ichwMin == ichwLim);
+ InitSegmentToDelete(psegNew, pfont, pchstrm);
+ }
+ return;
+ }
+
+ Assert(psegNew);
+
+ psegNew->Initialize(pchstrm->TextSrc(),
+ ichwMin, ichwLim,
+ lbStart, lbEnd, est, fStartLine, fEndLine, m_pgreng->RightToLeft());
+
+ psegNew->SetEngine(m_pgreng);
+ psegNew->SetFont(pfont);
+ psegNew->SetJustifier(pgjus);
+ psegNew->SetFaceName(m_pgreng->FaceName(), m_pgreng->BaseFaceName());
+
+ bool fNextSegNeedsContext =
+ !(est == kestNoMore || est == kestWsBreak
+ || ichwLim >= pchstrm->Lim() || ichwLim >= ichFontLim);
+
+ InitializeForNextSeg(psegNew, islotLBStreamBreak, islotSurfaceBreak, lbEnd,
+ fNextSegNeedsContext, pchstrm);
+
+ psegNew->SetPreContext(0 - m_pgreng->PreXlbContext());
+}
+
+/*----------------------------------------------------------------------------------------------
+ The newly created segment is invalid, for instance, because we were backtracking and
+ couldn't find a valid break point. Initialize it just enough so that it can be
+ deleted by the client.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::InitSegmentToDelete(Segment * psegNew, Font * pfont,
+ GrCharStream * pchstrm)
+{
+ psegNew->Initialize(pchstrm->TextSrc(), 0, 0,
+ klbClipBreak, klbClipBreak, kestNothingFit, false, false,
+ m_pgreng->RightToLeft());
+
+ psegNew->SetEngine(m_pgreng);
+ psegNew->SetFont(pfont);
+ psegNew->SetJustifier(NULL); // can't justify an empty segment
+ psegNew->SetFaceName(m_pgreng->FaceName(), m_pgreng->BaseFaceName());
+ psegNew->SetPreContext(0);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Map from the given slot (which is generally the final LB slot) to the end of the segment,
+ taking into account the fact that a single slot may represent two 16-bit surrogates.
+
+ There are several approaches that seem reasonable but do NOT work. (I tried them!)
+ You can't calculate it directly from the length of the streams, because that doesn't take
+ into account the possible presence of surrogate pairs in the character stream. You can't
+ use the chunk map at the point of the LB, because if a rule spanned a LB the chunk won't
+ have ended there and so there won't be any valid information.
+
+ What seems to work is to figure out the slot(s) in the zeroth stream using the associations
+ and then use the segment offset for this slot. This should be reliable because there is
+ always a one-to-one correspondence between glyphs in the line-break passes (ie, no
+ insertions or deletions), so the associations should be dependable and straightforward.
+----------------------------------------------------------------------------------------------*/
+int EngineState::LbSlotToSegLim(int islotLB, GrCharStream * pchstrm, int cpassLB)
+{
+ Assert(islotLB < OutputStream(cpassLB)->WritePos());
+
+ // Figure out the corresponding characters in the zeroth stream. These should be straight-
+ // forward to figure out because no substitutions are permitted in the LB passes.
+ // I do the slots before and after the LB, if possible, as a sanity check.
+ GrSlotStream * psstrmLB = OutputStream(cpassLB);
+ GrSlotState * pslotPreLB = (m_fFinalLB || m_fInsertedLB) ?
+ psstrmLB->SlotAt(islotLB - 1) :
+ psstrmLB->SlotAt(islotLB);
+ GrSlotState * pslotPostLB = (psstrmLB->WritePos() > islotLB + 1) ?
+ psstrmLB->SlotAt(islotLB + 1) :
+ NULL;
+
+ int ichwPreLB = pslotPreLB->AfterAssoc();
+
+ int ichwSegLim;
+ if (pslotPostLB)
+ {
+ ichwSegLim = pslotPostLB->BeforeAssoc();
+ Assert(ichwPreLB + 1 == ichwSegLim
+ || ichwPreLB + 2 == ichwSegLim); // in case of a surrogate
+ }
+ else
+ {
+ ichwSegLim = ichwPreLB + 1;
+ while (!pchstrm->AtUnicodeCharBoundary(ichwSegLim))
+ ichwSegLim++;
+ Assert(pchstrm->AtUnicodeCharBoundary(ichwSegLim));
+ }
+
+ // Old buggy routine that doesn't handle the case where a rule (and hence the chunk map) did
+ // not end at the LB character:
+ // Map backwards through the LB pass streams, if any.
+ //int islotAdjusted = islotLB + 1; // after the LB
+ //for (int ipass = m_cpassLB; ipass > 0; ipass--)
+ //{
+ // islotAdjusted = ChunkInPrev(ipass, islotAdjusted, pchstrm);
+ //}
+ //
+ //int ichwSegLim = ChunkInPrev(0, islotAdjusted, pchstrm);
+
+ // Mapping from 32-bit to 16-bit should only increase the index. Except that there
+ // may be a LB in the slot stream that is not in the character stream, so it could be
+ // one less.
+ Assert(ichwSegLim + m_cslotPreSeg >= islotLB - 1);
+
+ return ichwSegLim;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the chunk mapping into the previous stream, taking into account the fact that it
+ is not recorded for the write-position.
+----------------------------------------------------------------------------------------------*/
+int GrTableManager::ChunkInPrev(int ipass, int islot, GrCharStream * pchstrm)
+{
+ GrSlotStream * psstrmOut = OutputStream(ipass);
+ GrSlotStream * psstrmIn = (ipass == 0) ? NULL : InputStream(ipass);
+
+ int islotTmp = islot;
+ int islotAdjusted;
+ do {
+ if (islot >= psstrmOut->WritePos())
+ {
+ Assert(islot == psstrmOut->WritePos());
+ islotAdjusted = (ipass == 0) ? pchstrm->SegOffset() : psstrmIn->ReadPos();
+ Assert(islotAdjusted > -1);
+ }
+ else
+ islotAdjusted = psstrmOut->ChunkInPrev(islotTmp);
+ islotTmp--;
+ } while (islotAdjusted == -1);
+
+ return islotAdjusted;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Create a new segment corresponding to an empty string.
+
+ @param pchstrm - input stream
+ @param fStartLine - does this segment start a line?
+ @param fEndLine - does this segment end a line?
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::InitSegmentAsEmpty(Segment * psegNew, Font * pfont,
+ GrCharStream * pchstrm, bool fStartLine, bool fEndLine)
+{
+ LineBrk lbStart = m_engst.m_lbPrevEnd;
+ LineBrk lbEnd = klbNoBreak;
+
+ int ichwMin = 0;
+ int ichwLim = 0;
+
+ Assert(psegNew);
+
+ psegNew->Initialize(pchstrm->TextSrc(), ichwMin, ichwLim,
+ lbStart, lbEnd, kestNoMore, fStartLine, fEndLine, m_pgreng->RightToLeft());
+
+ psegNew->SetEngine(m_pgreng);
+ psegNew->SetFont(pfont);
+ psegNew->SetJustifier(NULL); // can't justify an empty segment
+ psegNew->SetFaceName(m_pgreng->FaceName(), m_pgreng->BaseFaceName());
+
+ byte pbNextSegDat[256];
+ int cbNextSegDat;
+ int * pcbNextSegDat = &cbNextSegDat;
+
+ // Initialization for (theoretical) next segment.
+ byte * pb = pbNextSegDat;
+ *pb++ = byte(lbEnd);
+ *pb++ = kdircNeutral;
+ *pb++ = kdircNeutral;
+ *pb++ = 0;
+ for (int ipass = 0; ipass < m_cpass; ipass++)
+ *pb++ = 0;
+ *pcbNextSegDat = 0;
+ psegNew->RecordInitializationForNextSeg(*pcbNextSegDat, pbNextSegDat);
+
+ psegNew->SetPreContext(0);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Find a line-break and unwind the passes. Return true if we were able to
+ backtrack successfully (which may have meant using a less-than-optimal line-break).
+ Return false if no line-break could be found (because maxBreakWeight did not allow
+ letter breaks or clipping--generally because there was already something on this
+ line).
+
+ @param pislotPrevBreak - position of previously-created break, -1 if none;
+ this is the index of the line-break glyph if any,
+ or the index of the last slot in the segment;
+ adjusted to contain the position of the newly
+ found break
+ @param plbMin - minimum (best) line break weight to try
+ @param lbMax - maximum (worst possible) line break weight
+ @param twsh - how to handle trailing white-space
+ @param fMoreText - true if char stream doesn't go up to original lim
+ @param ichwCallerBtLim - caller's backtrack lim; -1 if caller is not backtracking
+ @param plbFound - kind of line-break created
+----------------------------------------------------------------------------------------------*/
+bool GrTableManager::Backtrack(int * pislotPrevBreak,
+ LineBrk * plbMin, LineBrk lbMax, TrWsHandling twsh, bool fMoreText,
+ int ichwCallerBtLim,
+ LineBrk * plbFound)
+{
+ int islotStartTry;
+ //if (*pislotPrevBreak == ichwCallerBtLim - 1)
+ //{
+ // islotStartTry = *pislotPrevBreak;
+ //}
+ //else
+ if (*pislotPrevBreak == -1)
+ {
+ // If no line break has been found so far, figure out where to start trying based
+ // on where the final stream choked.
+ GrSlotStream * psstrmFinal = OutputStream(m_cpass-1);
+ if ((islotStartTry
+ = m_engst.TraceStreamZeroPos(psstrmFinal->WritePos()-1, TopDirectionLevel()))
+ == -1)
+ {
+ // Just start looking at the end of what's been generated.
+ islotStartTry = OutputStream(m_cpassLB)->ReadPos() - 1;
+ }
+ }
+ else
+ {
+ // Start just before previous line break.
+ if (m_engst.m_fInsertedLB || m_engst.m_fFinalLB)
+ islotStartTry = *pislotPrevBreak - 2; // skip inserted LB and previous slot
+ else
+ islotStartTry = *pislotPrevBreak - 1; // skip previous slot
+ }
+ if (ichwCallerBtLim > -1 && islotStartTry > ichwCallerBtLim - 1)
+ {
+ islotStartTry = ichwCallerBtLim - 1;
+ }
+
+ // Determine if we want to insert an actual line-break "glyph". Don't do that if
+ // we are omitting trailing white space or we are at a writing-system or font break.
+ bool fInsertLB;
+ if (twsh == ktwshNoWs)
+ // omitting trailing white-space
+ fInsertLB = false;
+ else if (twsh == ktwshOnlyWs)
+ // trailing white-space segment
+ fInsertLB = true;
+ else if (ichwCallerBtLim > -1)
+ // backtracking
+ fInsertLB = true;
+ else if (*pislotPrevBreak > -1)
+ // no longer at the edge of the writing system or font
+ fInsertLB = true;
+ else if (!fMoreText)
+ // at final edge of total range to render
+ fInsertLB = true;
+ else
+ fInsertLB = false;
+
+ // Try to insert a line-break in the output of the (final) line-break pass (if any, or
+ // the output of the glyph-generation pass). First try the preferred (strictest)
+ // break weight and gradually relax.
+ LineBrk lb = *plbMin;
+ Assert(*plbMin <= lbMax);
+ GrSlotStream * psstrmLB = OutputStream(m_cpassLB);
+ islotStartTry = min(islotStartTry, psstrmLB->WritePos() - 1);
+ int islotNewBreak = -1;
+ while (lb <= lbMax)
+ {
+ LineBrk lbNextToTry;
+ if (fInsertLB)
+ {
+ islotNewBreak = psstrmLB->InsertLineBreak(this,
+ *pislotPrevBreak, m_engst.m_fInsertedLB, islotStartTry,
+ lb, twsh, m_engst.m_cslotPreSeg, &lbNextToTry);
+ }
+ else
+ {
+ islotNewBreak = psstrmLB->MakeSegmentBreak(this,
+ *pislotPrevBreak, m_engst.m_fInsertedLB, islotStartTry,
+ lb, twsh, m_engst.m_cslotPreSeg, &lbNextToTry);
+ }
+ if (islotNewBreak > -1)
+ break;
+ if (lb >= lbMax)
+ break;
+ lb = IncLineBreak(lb); // relax the break weight
+ }
+
+ if (islotNewBreak == -1)
+ {
+ return false;
+ }
+
+ // We've successfully inserted a line break.
+
+ if (fInsertLB)
+ m_engst.m_fInsertedLB = true;
+
+ m_engst.m_fFinalLB = false;
+
+ UnwindAndReinit(islotNewBreak);
+
+ *pislotPrevBreak = islotNewBreak;
+ *plbMin = lb; // return the best break we were able to find, so we don't keep trying
+ // for a better one when we know now that we can't find it
+ *plbFound = lb;
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ This method is called after backtracking or removing trailing white-space.
+ Unwind the following slot streams as necessary depending on where the change was made.
+
+ @param islotNewBreak - in output of (final) line-break pass
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::UnwindAndReinit(int islotNewBreak)
+{
+ OutputStream(m_cpassLB)->ZapCalculatedDirLevels(islotNewBreak);
+
+ // Mark the passes before the line-break pass as fully written, so that if there
+ // isn't a line-break glyph to intercept, we don't keep trying to get more input
+ // from them.
+ int ipass;
+ for (ipass = 1; ipass < m_cpassLB + 1; ++ipass)
+ {
+ InputStream(ipass)->MarkFullyWritten();
+ }
+
+ // Unwind the passes to the changed positions.
+ // Note that we don't need to unwind pass 0, since all it does is generate glyph IDs.
+ // Also we don't need to unwind the line-break passes, because conceptually they happen
+ // before the break is inserted.
+
+ int islotChgPos = islotNewBreak;
+ bool fFirst = true;
+ for (ipass = m_cpassLB + 1 ; ipass < m_cpass ; ++ipass)
+ {
+ islotChgPos =
+ Pass(ipass)->Unwind(this, islotChgPos, InputStream(ipass), OutputStream(ipass),
+ fFirst);
+ fFirst = false;
+ }
+ // For anything that may have been skipped in the final output:
+ OutputStream(m_cpass - 1)->SetReadPos(0);
+ OutputStream(m_cpass - 1)->SetReadPosMax(0);
+ Pass(m_cpass - 1)->UndoResyncSkip();
+ OutputStream(m_cpass - 1)->ClearSlotsSkippedToResync();
+
+ m_engst.InitPosCache();
+
+ m_engst.m_dxsShrinkPossible = GrSlotState::kNotYetSet; // recalculate it
+}
+
+/*----------------------------------------------------------------------------------------------
+ Store information in the newly created segment that will allow us to reinitalize
+ the streams in order to process the next segment, appropriately handling any
+ cross-line-boundary contextuals.
+
+ The information required is the number of glyphs in the first stream that must
+ be reprocessed, and a skip-offset between each stream indicating the beginning
+ of chunk boundaries.
+
+ In most cases, where there are no cross-line-boundary contextuals, all these numbers
+ will be zero.
+
+ The buffer generated is of the following format (all are 1 byte, unsigned):
+ end breakweight
+ previous strong directionality code
+ previous terminator dir code
+ restart backup
+ skip offsets for each pass
+ This format must match what is generated by InitializeStreams.
+
+ @param pseg - newly created segment
+ @param islotUnderBreak - position of line break inserted in underlying stream (output
+ of glyph-generation pass--stream 0); -1 if we rendered to
+ the end of the range
+ @param islotSurfaceBreak - position of line break in surface stream;
+ -1 if we rendered to the end of the range
+ @param lbEnd - kind of line-break at the end of this segment
+ @param fNextSegNeedsContext - true if we need to remember the context for the next seg
+ @param pchstrm - character stream input for this segment
+ @param cbNextMax - amount of space available in the buffer
+ @param pbNextSegDat - buffer for initializing next segment
+ @param pcbNextSegDat - amount of space used in buffer
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::InitializeForNextSeg(Segment * pseg,
+ int islotUnderBreak, int islotSurfaceBreak, LineBrk lbEnd,
+ bool fNextSegNeedsContext, GrCharStream * pchstrm)
+{
+ byte pbNextSegDat[256];
+ int cbNextSegDat;
+ int * pcbNextSegDat = &cbNextSegDat;
+
+ std::vector<int> vcslotSkipOffsets;
+ vcslotSkipOffsets.resize(m_cpass);
+
+ byte * pb = pbNextSegDat;
+
+ if (!fNextSegNeedsContext)
+ {
+ // No contextualization between this segment and the next, whatever kind of renderer
+ // it might use.
+ *pcbNextSegDat = 0;
+ return;
+ }
+
+ gid16 chwLB = LBGlyphID();
+
+ int islotUnderLim = islotUnderBreak;
+ if (!m_engst.m_fInsertedLB && !m_engst.m_fFinalLB)
+ // Then islotUnderBreak is the position of the last slot in the segment; increment
+ // to get the lim in stream zero.
+ islotUnderLim++;
+
+ int islotSurfaceLim = islotSurfaceBreak;
+ if (islotSurfaceLim == -1)
+ islotSurfaceLim = OutputStream(m_cpass - 1)->FinalSegLim();
+
+ *pb++ = byte(lbEnd);
+
+ // Find previous strong and terminator directionality codes.
+
+ GrSlotStream * psstrm = OutputStream(m_cpass - 1);
+ DirCode dircStrong = kdircNeutral;
+ DirCode dircTerm = kdircNeutral;
+ int islot;
+ for (islot = islotSurfaceLim; islot-- > 0; )
+ {
+ GrSlotState * pslot = psstrm->SlotAt(islot);
+ DirCode dirc = pslot->Directionality();
+ if (dircTerm == kdircNeutral && dirc == kdircEuroTerm)
+ dircTerm = dirc;
+ if (StrongDir(dirc))
+ {
+ dircStrong = dirc;
+ break;
+ }
+ }
+ *pb++ = byte(dircStrong);
+ *pb++ = byte(dircTerm);
+
+ // Record how much of each pass to redo in the next segment.
+ // The basic algorithm is described in the "WR Data Transform Engine" document.
+ // But here we are doing a variation on what is described there. We are calculating
+ // the backup locations for BOTH the rule start locations and the necessary pre-contexts.
+ // It is the precontext values that are recorded for use by the following segment. But we
+ // also calculate the positions for the rule-start locations to make sure there is enough
+ // pre-context at each pass.
+
+ int islotRS = islotSurfaceLim; // rule-start positions
+ int islotPC = islotRS; // to handle pre-context positions
+
+ // If line-breaks are irrelevant to this font, we don't need to bother.
+ bool fGiveUp = !m_pgreng->LineBreakFlag();
+
+ int ipass;
+ for (ipass = m_cpass - 1; ipass >= 0 && !fGiveUp; --ipass)
+ {
+ GrSlotStream * psstrmIn = (ipass == 0) ? NULL : InputStream(ipass);
+ GrSlotStream * psstrmOut = OutputStream(ipass);
+ int islotBackupMin = (ipass == 0) ? 0 : psstrmOut->SegMin();
+ if (ipass >= m_cpassLB && m_engst.m_fInitialLB)
+ islotBackupMin++; // how far we can back up--not before the start of this segment
+
+ int islotPrevRS = 0; // corresponding slot in the previous stream for rule-start position
+ int islotPrevPC = 0; // same for pre-context position
+
+ // Initially we have to include at least this many prior slots:
+ int cslotSkipOffset = 0;
+
+ if (islotRS == psstrmOut->WritePos())
+ {
+ islotPrevRS = (ipass == 0) ? pchstrm->Pos() : psstrmIn->ReadPos();
+ }
+ else
+ {
+ // Ignore the final line-break, because it is explicitly inserted during
+ // the (final) line-break pass.
+// if (ipass == m_cpassLB && psstrm->SlotAt(islotRS)->IsFinalLineBreak(chwLB))
+// {
+// Assert(islotRS > 0);
+// islotRS--;
+// }
+ // Ignore the chunk in the pass that generated the line break that corresponds
+ // to the inserted line break being chunked with the previous glyph--we don't
+ // want to treat that as a cross-line-boundary contextual!
+ if (ipass == m_cpassLB && psstrmOut->SlotAt(islotRS)->IsFinalLineBreak(chwLB))
+ {
+// Assert(psstrm->ChunkInPrev(islotRS) == -1);
+ if (islotRS + 1 == psstrmOut->WritePos())
+ islotPrevRS = (ipass == 0) ? pchstrm->SegOffset() : psstrmIn->ReadPos();
+ else
+ islotPrevRS = psstrmOut->ChunkInPrev(islotRS + 1);
+ }
+ else
+ {
+ // Back up to the beginning of a chunk.
+ while (islotRS >= islotBackupMin &&
+ (islotPrevRS = psstrmOut->ChunkInPrev(islotRS)) == -1)
+ {
+ --islotRS;
+ //++cslotSkipOffset;
+ }
+ }
+ }
+ if (islotPrevRS == -1 || islotRS < islotBackupMin) // hit the start of the segment
+ {
+ // In order to get enough context to be sure to run the same rules again,
+ // we'd have to back up into the previous segment. Too complicated, so give up.
+ fGiveUp = true;
+ break;
+ }
+
+ int cslotPreContext = Pass(ipass)->MaxRulePreContext();
+LBackupPC:
+ if (islotPC == psstrmOut->WritePos())
+ {
+ islotPrevPC = (ipass == 0) ? pchstrm->Pos() : psstrmIn->ReadPos();
+ }
+ else
+ {
+ if (ipass == m_cpassLB && psstrmOut->SlotAt(islotPC)->IsFinalLineBreak(chwLB))
+ {
+ if (islotPC+1 == psstrmOut->WritePos())
+ islotPrevPC = (ipass == 0) ? pchstrm->SegOffset() : psstrmIn->ReadPos();
+ else
+ islotPrevPC = psstrmOut->ChunkInPrev(islotPC+1);
+ }
+ else
+ {
+ // Back up to the beginning of a chunk; also make sure there are enough slots
+ // to handle the required pre-context for this pass.
+ while (islotPC >= islotBackupMin &&
+ ((islotPrevPC = psstrmOut->ChunkInPrev(islotPC)) == -1 ||
+ islotPrevRS - islotPrevPC < cslotPreContext))
+ {
+ --islotPC;
+ ++cslotSkipOffset;
+ }
+ }
+ }
+ if (islotPC >= islotBackupMin && islotPrevRS - islotPrevPC < cslotPreContext)
+ {
+ --islotPC;
+ ++cslotSkipOffset;
+ goto LBackupPC;
+ }
+ if (islotPrevPC == -1 || islotPC < islotBackupMin) // hit the start of the segment
+ {
+ fGiveUp = true;
+ break;
+ }
+
+ vcslotSkipOffsets[ipass] = cslotSkipOffset;
+
+ islotRS = islotPrevRS;
+ islotPC = islotPrevPC;
+
+ if (ipass == 0)
+ {
+ // Convert from underlying chars to stream-zero slots.
+ islotRS += m_engst.m_cslotPreSeg;
+ islotPC += m_engst.m_cslotPreSeg;
+ }
+ }
+
+ // The following should be the case unless they tried to position contextually across
+ // the line break boundary, which is a very strange thing to do! - no longer true,
+ // because the pre-context is now included in this count, and it normal to have
+ // a pre-context in the final positioning pass.
+ //Assert(vcslotSkipOffsets[m_cpass-1] == 0);
+
+ // Also no adjustments are made by the glyph-generation pass, so this should always
+ // be true:
+ Assert(vcslotSkipOffsets[0] == 0);
+
+ // The number of slots in the underlying input previous to the line-break
+ // that must be reprocessed:
+ int cslotPreLB = islotUnderLim - islotPC;
+
+ if (fGiveUp)
+ {
+ // We can't reasonably provide enough context, so don't try to do it at all.
+ cslotPreLB = 0;
+ for (ipass = 0; ipass < m_cpass; ipass++)
+ vcslotSkipOffsets[ipass] = 0;
+ }
+
+ Assert(cslotPreLB >= 0);
+ Assert(cslotPreLB < 0xFF);
+
+ *pb++ = byte(cslotPreLB);
+ for (ipass = 0; ipass < m_cpass; ipass++)
+ *pb++ = byte(vcslotSkipOffsets[ipass]);
+
+ *pcbNextSegDat = 4 + m_cpass;
+
+ pseg->RecordInitializationForNextSeg(*pcbNextSegDat, pbNextSegDat);
+}
+/*----------------------------------------------------------------------------------------------
+ Make sure the final positions are set for every glyph.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::SetFinalPositions(Segment * pseg, bool fWidthIsCharCount)
+{
+ float xsTotalWidth, xsVisWidth;
+
+#ifdef OLD_TEST_STUFF
+ if (fWidthIsCharCount)
+ xsTotalWidth = xsVisWidth = 0;
+ else
+#endif // OLD_TEST_STUFF
+
+ // Make sure the final positions are set for every glyph.
+ CalcPositionsUpTo(m_cpass-1, reinterpret_cast<GrSlotState *>(NULL),
+ &xsTotalWidth, &xsVisWidth);
+ pseg->SetWidths(xsVisWidth, xsTotalWidth);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Calculate the associations, and record the output slots in the segment.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::RecordAssocsAndOutput(Font * pfont, Segment * pseg,
+ TrWsHandling twsh, bool fParaRtl, int nDirDepth)
+{
+ int cchwUnderlying = pseg->stopCharacter() - pseg->startCharacter();
+ GrSlotStream * psstrmFinal = OutputStream(m_cpass-1);
+ int csloutSurface = psstrmFinal->WritePos() - psstrmFinal->IndexOffset(); // # of output slots
+
+ psstrmFinal->SetNeutralAssociations(LBGlyphID());
+
+ pseg->SetUpOutputArrays(pfont, this, psstrmFinal, cchwUnderlying, csloutSurface, LBGlyphID(),
+ twsh, fParaRtl, nDirDepth);
+
+ // Set underlying-to-surface assocations in the segment.
+ CalculateAssociations(pseg, csloutSurface);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Calculate the underlying-to-surface associations and ligature mappings.
+ Assumes the arrays have been properly initialized.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::CalculateAssociations(Segment * pseg, int csloutSurface)
+{
+ GrSlotStream * psstrmFinal = OutputStream(m_cpass-1);
+
+ std::vector<int> vichwAssocs;
+ std::vector<int> vichwComponents;
+
+ for (int islot = psstrmFinal->IndexOffset(); islot < psstrmFinal->WritePos(); islot++)
+ {
+ GrSlotState * pslot = psstrmFinal->SlotAt(islot);
+ int islout = islot - psstrmFinal->IndexOffset();
+ if (!pslot->IsLineBreak(LBGlyphID()))
+ {
+ vichwAssocs.clear();
+ pslot->AllAssocs(vichwAssocs);
+
+ size_t iichw;
+ for (iichw = 0; iichw < vichwAssocs.size(); ++iichw)
+ {
+ pseg->RecordSurfaceAssoc(vichwAssocs[iichw], islout, 0);
+ }
+
+ vichwComponents.clear();
+ if (pslot->HasComponents())
+ pslot->AllComponentRefs(vichwComponents);
+
+ for (iichw = 0; iichw < vichwComponents.size(); iichw++)
+ {
+ pseg->RecordLigature(vichwComponents[iichw], islout, iichw);
+ }
+ }
+ }
+
+ AdjustAssocsForOverlaps(pseg);
+ pseg->CleanUpAssocsVectors();
+
+// pseg->AdjustForOverlapsWithPrevSeg(); // for any characters officially in the
+ // previous segment but rendered in this one,
+ // or vice versa
+
+ // TODO SharonC: for all characters that are right-to-left in the underlying stream,
+ // reverse the before and after flags in the segment.
+}
+
+/*----------------------------------------------------------------------------------------------
+ For any slots associated with characters in the new segment but not rendered in the
+ segment, adjust the underlying-to-surface mappings accordingly. Ie, set the before
+ mapping to kNegInfinity for slots at the beginning of the streams, and set the
+ after mapping to kPosInfinity for slots at the end of the streams.
+
+ TODO SharonC: Rework this method more carefully to handle each slot exactly once. The current
+ approach could possibly, for instance, process a slot that is inserted in one pass
+ and deleted in the next.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::AdjustAssocsForOverlaps(Segment * pseg)
+{
+ if (!m_engst.m_fInitialLB && !m_engst.m_fFinalLB && !m_engst.m_fInsertedLB)
+ // no cross-line contextualization possible
+ return;
+
+ gid16 chwLB = LBGlyphID();
+ std::vector<int> vichwAssocs;
+
+ // Process any slots output by any substitution pass (or later) on either side of the
+ // line-breaks. These are the relevant slots that are rendered in the previous and
+ // following segments.
+ for (int ipass = m_cpass; ipass-- > m_cpassLB + 1; )
+ {
+ GrSlotStream * psstrm = OutputStream(ipass);
+ int islotMin = (ipass == m_cpass - 1) ? psstrm->IndexOffset() : 0;
+
+ if (m_engst.m_fInitialLB)
+ {
+ for (int islot = islotMin; ; islot++)
+ {
+ GrSlotState * pslot = psstrm->SlotAt(islot);
+ if (pslot->IsInitialLineBreak(chwLB))
+ break;
+ Assert(!pslot->IsFinalLineBreak(chwLB));
+ if (pslot->PassModified() != ipass)
+ continue;
+
+ vichwAssocs.clear();
+ pslot->AllAssocs(vichwAssocs);
+ for (size_t iichw = 0; iichw < vichwAssocs.size(); ++iichw)
+ pseg->MarkSlotInPrevSeg(vichwAssocs[iichw], islot);
+ }
+ }
+
+ if ((m_engst.m_fFinalLB || m_engst.m_fInsertedLB) && ipass > m_cpassLB)
+ {
+ for (int islot = psstrm->WritePos(); islot-- > islotMin ; )
+ {
+ GrSlotState * pslot = psstrm->SlotAt(islot);
+ if (pslot->IsFinalLineBreak(chwLB))
+ break;
+ Assert(!pslot->IsInitialLineBreak(chwLB));
+ if (pslot->PassModified() != ipass)
+ continue;
+
+ vichwAssocs.clear();
+ pslot->AllAssocs(vichwAssocs);
+ for (size_t iichw = 0; iichw < vichwAssocs.size(); ++iichw)
+ pseg->MarkSlotInNextSeg(vichwAssocs[iichw], islot);
+ }
+ }
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Initialize all the streams. In particular, process the information about the
+ skip-offsets to handle segments other than the first.
+
+ @param cbPrev - number of bytes in the pbPrevSegDat buffer
+ @param pbPrevSegDat - buffer in the following format (all are 1 byte, unsigned):
+ prev seg's end breakweight
+ prev seg's previous strong directionality code
+ prev seg's previous terminator dir code
+ restart backup
+ skip offsets for each pass
+ This format must match what is generated by InitializeForNextSeg.
+----------------------------------------------------------------------------------------------*/
+void EngineState::InitializeStreams(GrTableManager * ptman,
+ GrCharStream * pchstrm,
+ int cbPrev, byte * pbPrevSegDat, bool fNeedFinalBreak, int * pislotFinalBreak)
+{
+ int cpassLB = ptman->NumberOfLbPasses();
+ int ipassPos1 = ptman->FirstPosPass();
+
+ CreateSlotStreams();
+
+ int cslotBackup = 0;
+
+ InitForNewSegment(ptman);
+
+ if (cbPrev == 0)
+ {
+ m_lbPrevEnd = klbNoBreak;
+ m_dircInitialStrongDir = kdircNeutral;
+ m_dircInitialTermDir = kdircNeutral;
+ for (int ipass = 0; ipass < m_cpass; ++ipass)
+ {
+ OutputStream(ipass)->Initialize(ipassPos1, false);
+ m_prgzpst[ipass].SetResyncSkip(0);
+
+ if (ptman->LoggingTransduction())
+ m_prgzpst[ipass].InitializeLogInfo();
+ }
+ }
+ else
+ {
+ Assert(cbPrev >= 4);
+ byte * pb = pbPrevSegDat;
+
+ m_lbPrevEnd = LineBrk(*pb++);
+
+ // Directionality codes from the previous segment.
+ m_dircInitialStrongDir = DirCode((int)*pb++);
+ m_dircInitialTermDir = DirCode((int)*pb++);
+
+ cslotBackup = (int)*pb++;
+ Assert((cbPrev == 4 || cslotBackup == 0) || cbPrev == m_cpass + 4);
+
+ for (int ipass = 0; ipass < m_cpass; ++ipass)
+ {
+ OutputStream(ipass)->Initialize(ipassPos1, true);
+ if (cbPrev == 4)
+ m_prgzpst[ipass].SetResyncSkip(0); // different writing system
+ else
+ m_prgzpst[ipass].SetResyncSkip(*pb++);
+
+ if (ptman->LoggingTransduction())
+ m_prgzpst[ipass].InitializeLogInfo();
+ }
+
+ pchstrm->Backup(cslotBackup);
+ }
+
+ if (cbPrev > 0 || pchstrm->StartLine())
+ {
+ // Go ahead and run the initial line-break passes (if any), and then insert
+ // a line-break at the appropriate place where the new segment will begin.
+ int cslotToGet = cslotBackup;
+LGetMore:
+ ptman->Pass(0)->ExtendGlyphIDOutput(ptman, pchstrm, OutputStream(0),
+ -1, 0, klbWordBreak,
+ cslotToGet, fNeedFinalBreak, m_twsh, pislotFinalBreak);
+ OutputStream(0)->SetSegMin(cslotBackup);
+ for (int ipass = 1; ipass <= cpassLB; ipass++)
+ {
+ if (cslotToGet > 0)
+ {
+ int nRet = kNextPass;
+ int cslotGot;
+ ptman->Pass(ipass)->ExtendOutput(ptman,
+ InputStream(ipass), OutputStream(ipass),
+ cslotToGet, m_twsh, &nRet, &cslotGot, pislotFinalBreak);
+ if (nRet != kNextPass)
+ {
+ cslotToGet = 1;
+ goto LGetMore;
+ }
+ }
+ OutputStream(ipass)->SetSegMin(cslotBackup);
+ }
+ Assert(OutputStream(cpassLB)->WritePos() >= cslotBackup);
+ m_cslotPreSeg = cslotBackup;
+ if (pchstrm->StartLine())
+ {
+ OutputStream(cpassLB)->AppendLineBreak(ptman, pchstrm, m_lbPrevEnd,
+ (ptman->RightToLeft() ? kdircRlb : kdircLlb), cslotBackup, true, -1);
+ SetInitialLB();
+ m_cslotPreSeg++;
+ if (cpassLB > 0 && *pislotFinalBreak > -1)
+ // See corresponding kludge in GrPass::ExtendGlyphIDOutput.
+ *pislotFinalBreak += 1;
+ }
+ else
+ {
+ OutputStream(cpassLB)->SetSegMin(cslotBackup);
+ }
+ OutputStream(cpassLB)->CalcIndexOffset(ptman);
+ }
+
+ else
+ {
+ Assert(cslotBackup == 0);
+ OutputStream(0)->SetSegMin(0);
+ m_cslotPreSeg = 0;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Reinitialize as we start to generate a new segment.
+----------------------------------------------------------------------------------------------*/
+void EngineState::InitForNewSegment(GrTableManager * ptman)
+{
+ // Set up a fresh batch of slots.
+ DestroySlotBlocks();
+ m_islotblkCurr = -1;
+ m_islotNext = kSlotBlockSize;
+
+ m_fInitialLB = false;
+ m_fFinalLB = false;
+ m_fInsertedLB = false;
+ m_fExceededSpace = false;
+ m_fHitHardBreak = false;
+ m_fRemovedWhtsp = false;
+ InitPosCache();
+ //////m_pgg = pgg;
+
+ for (int ipass = 0; ipass < m_cpass; ipass++)
+ m_prgzpst[ipass].InitForNewSegment(ipass, ptman->Pass(ipass)->MaxRuleContext());
+}
+
+/*----------------------------------------------------------------------------------------------
+ Calculate the position in stream zero of the given slot in the final stream,
+ based on the associations. (This will be the same as the position at the end of the
+ line-break passes, which is really what we want.)
+
+ @param islotFinal - index of the final slot in the final stream
+----------------------------------------------------------------------------------------------*/
+int EngineState::TraceStreamZeroPos(int islotFinal, int nTopDir)
+{
+ GrSlotStream * psstrmFinal = OutputStream(m_cpass - 1);
+ if (psstrmFinal->WritePos() == 0)
+ return -1;
+
+ GrSlotState * pslot = psstrmFinal->SlotAt(islotFinal);
+
+ // If we're in the middle of reordered bidi stuff, just use the end of the stream.
+ if (pslot->DirLevel() > nTopDir)
+ return -1;
+
+ int islot = pslot->BeforeAssoc();
+ if (islot == kPosInfinity || islot < 0)
+ return -1;
+ return islot + m_cslotPreSeg;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the next higher (more relaxed, less desirable) line break weight.
+----------------------------------------------------------------------------------------------*/
+LineBrk GrTableManager::IncLineBreak(LineBrk lb)
+{
+ Assert(lb != klbClipBreak);
+ return (LineBrk)((int)lb + 1);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return a pointer to a slot that is near the current position in the given stream.
+ Return NULL if no slots have been output at all.
+ This is used for initializing features of line-break slots.
+ @param ipassArg - pass at which to start looking
+ @param islot - slot to look for; -1 if considering the current position
+----------------------------------------------------------------------------------------------*/
+GrSlotState * EngineState::AnAdjacentSlot(int ipassArg, int islot)
+{
+ int ipass = ipassArg;
+ while (ipass >= 0)
+ {
+ GrSlotStream * psstrm = OutputStream(ipass);
+ if (psstrm->NumberOfSlots() > 0)
+ {
+ if (islot == -1)
+ {
+ if (psstrm->AtEnd())
+ return psstrm->SlotAt(psstrm->WritePos() - 1);
+ else
+ return psstrm->Peek();
+ }
+ else
+ {
+ if (psstrm->WritePos() <= islot)
+ return psstrm->SlotAt(psstrm->WritePos() - 1);
+ else
+ return psstrm->SlotAt(islot);
+ }
+ }
+ ipass--;
+ }
+ return NULL;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Simple access methods.
+----------------------------------------------------------------------------------------------*/
+GrEngine * GrTableManager::Engine()
+{
+ return m_pgreng;
+}
+
+EngineState * GrTableManager::State()
+{
+ return &m_engst;
+}
+
+GrEngine * EngineState::Engine()
+{
+ return m_ptman->Engine();
+}
+
+GrTableManager * EngineState::TableManager()
+{
+ return m_ptman;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Memory management for slots
+----------------------------------------------------------------------------------------------*/
+
+// standard for pass 0 slots
+void EngineState::NewSlot(
+ gid16 gID, GrFeatureValues fval, int ipass, int ichwSegOffset, int nUnicode,
+ GrSlotState ** ppslotRet)
+{
+ NextSlot(ppslotRet);
+ (*ppslotRet)->Initialize(gID, Engine(), fval, ipass, ichwSegOffset, nUnicode);
+}
+
+// line-break slots
+void EngineState::NewSlot(
+ gid16 gID, GrSlotState * pslotFeat, int ipass, int ichwSegOffset,
+ GrSlotState ** ppslotRet)
+{
+ NextSlot(ppslotRet);
+ (*ppslotRet)->Initialize(gID, Engine(), pslotFeat, ipass, ichwSegOffset);
+}
+
+// for inserting new slots after pass 0 (under-pos and unicode are irrelevant)
+void EngineState::NewSlot(
+ gid16 gID, GrSlotState * pslotFeat, int ipass,
+ GrSlotState ** ppslotRet)
+{
+ NextSlot(ppslotRet);
+ (*ppslotRet)->Initialize(gID, Engine(), pslotFeat, ipass);
+}
+
+// for making a new version of the slot initialized from the old
+void EngineState::NewSlotCopy(GrSlotState * pslotCopyFrom, int ipass,
+ GrSlotState ** ppslotRet)
+{
+ NextSlot(ppslotRet);
+ (*ppslotRet)->InitializeFrom(pslotCopyFrom, ipass);
+}
+
+void EngineState::NextSlot(GrSlotState ** ppslotRet)
+{
+ int cnExtraPerSlot = m_cUserDefn + (m_cCompPerLig * 2) + m_cFeat;
+ if (m_islotNext >= kSlotBlockSize)
+ {
+ // Allocate a new block of slots
+ GrSlotState * slotblkNew = new GrSlotState[kSlotBlockSize];
+ u_intslot * prgnSlotBuf = new u_intslot[kSlotBlockSize * cnExtraPerSlot];
+
+ m_vslotblk.push_back(slotblkNew);
+ m_vprgnSlotVarLenBufs.push_back(prgnSlotBuf);
+ m_islotblkCurr++;
+ m_islotNext = 0;
+ Assert((unsigned)m_islotblkCurr == m_vslotblk.size()-1);
+ }
+
+ *ppslotRet = m_vslotblk[m_islotblkCurr] + m_islotNext;
+ (*ppslotRet)->BasicInitialize(m_cUserDefn, m_cCompPerLig, m_cFeat,
+ (m_vprgnSlotVarLenBufs[m_islotblkCurr] + (m_islotNext * cnExtraPerSlot)));
+ m_islotNext++;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Convert the number of font design units into source device logical units.
+----------------------------------------------------------------------------------------------*/
+float GrTableManager::EmToLogUnits(int m)
+{
+ return m_engst.EmToLogUnits(m);
+}
+
+float EngineState::EmToLogUnits(int m)
+{
+ if (m == 0)
+ return 0;
+
+ float xysFontEmSquare;
+ m_pfont->getFontMetrics(NULL, NULL, &xysFontEmSquare);
+
+ // mEmUnits should be equal to the design units in the font's em square
+ int mEmUnits = Engine()->GetFontEmUnits();
+ if (mEmUnits <= 0)
+ {
+ Warn("Failed to obtain font em-units");
+ return (float)m;
+ }
+
+ return GrEngine::GrIFIMulDiv(m, xysFontEmSquare, mEmUnits);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Convert the source device coordinates to font design units.
+----------------------------------------------------------------------------------------------*/
+int GrTableManager::LogToEmUnits(float xys)
+{
+ return m_engst.LogToEmUnits(xys);
+}
+
+int EngineState::LogToEmUnits(float xys)
+{
+ if (xys == 0)
+ return 0;
+
+ float xysFontEmSquare;
+ m_pfont->getFontMetrics(NULL, NULL, &xysFontEmSquare);
+
+ // mEmUnits should be equal to the design units in the font's em square
+ int mEmUnits = Engine()->GetFontEmUnits();
+ if (mEmUnits < 0)
+ {
+ Warn("Failed to obtain font em-units");
+ return (int)xys;
+ }
+
+ return GrEngine::GrFIFMulDiv(xys, mEmUnits, xysFontEmSquare);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Find the coordinates for a given glyph point.
+ Return true on success, false otherwise.
+----------------------------------------------------------------------------------------------*/
+bool GrTableManager::GPointToXY(gid16 chwGlyphID, int nGPoint, float * pxs, float * pys)
+{
+ return m_engst.GPointToXY(chwGlyphID, nGPoint, pxs, pys);
+}
+
+bool EngineState::GPointToXY(gid16 chwGlyphID, int nGPoint, float * pxs, float * pys)
+{
+ *pxs = INT_MIN;
+ *pys = INT_MIN;
+ Point pointRet;
+ m_pfont->getGlyphPoint(chwGlyphID, nGPoint, pointRet);
+ *pxs = pointRet.x;
+ *pys = pointRet.y;
+
+ return true;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Call the justification routines.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::CallJustifier(IGrJustifier * pgjus, int ipassCurr,
+ float dxUnjustified, float dxJustified, bool fEndLine)
+{
+ // Indicates the stream the justification routines will read and modify:
+ m_engst.m_ipassJustCalled = ipassCurr;
+
+ int iGlyphMin = OutputStream(ipassCurr)->SegMin();
+ int iGlyphLim = OutputStream(ipassCurr)->SegLimIfKnown();
+ if (iGlyphLim == -1)
+ iGlyphLim = OutputStream(ipassCurr)->WritePos();
+
+ GrSlotStream * psstrm = OutputStream(ipassCurr);
+ if (m_pgreng->BasicJustification() && fEndLine)
+ UnstretchTrailingWs(psstrm, iGlyphLim);
+
+ pgjus->adjustGlyphWidths(m_pgreng, iGlyphMin, iGlyphLim, dxUnjustified, dxJustified);
+
+ // After returning, reading and modifying slot attributes is not permitted:
+ m_engst.m_ipassJustCalled = -1;
+}
+
+/*----------------------------------------------------------------------------------------------
+ For the basic justification approach, remove stretch from the trailing whitespace.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::UnstretchTrailingWs(GrSlotStream * psstrm, int iGlyphLim)
+{
+ int islot = iGlyphLim - 1;
+ while (islot >= 0)
+ {
+ GrSlotState * pslot = psstrm->SlotAt(islot);
+ if (pslot->IsLineBreak(LBGlyphID()))
+ { } // keep looking for the trailing space
+ else if (pslot->IsSpace(this))
+ pslot->SetJStretch(0); // TODO: do this at level 0
+ else
+ // something other than space--quit
+ return;
+ islot--;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Determine how much shrink is permissible.
+
+ This method is really used only for testing the shrink mechanism, since at this time
+ we don't allow low-end justification to do any shrinking.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::DetermineShrink(IGrJustifier * pgjus, int ipassCurr)
+{
+ if (m_engst.m_dxsShrinkPossible != GrSlotState::kNotYetSet)
+ return;
+
+ if (m_engst.m_jmodi != kjmodiCanShrink || pgjus == NULL)
+ {
+ m_engst.m_dxsShrinkPossible = 0;
+ return;
+ }
+
+ if (ipassCurr != m_ipassJust1 - 1)
+ return;
+
+ GrSlotStream * psstrm = OutputStream(ipassCurr);
+ if (!psstrm->FullyWritten())
+ return;
+
+ // Normally just answer 0. To test shrinking, turn on the code below.
+ m_engst.m_dxsShrinkPossible = 0;
+
+#if TEST_SHRINK
+ int mTotal = 0;
+ int mShrink = 0;
+ int islotLim = psstrm->SegLimIfKnown();
+ if (islotLim == -1)
+ islotLim = psstrm->WritePos();
+ for ( ; islotLim >= 0; islotLim--)
+ {
+ // Trailing white space is not shrinkable.
+ GrSlotState * pslot = psstrm->SlotAt(islotLim - 1);
+ if (pslot->IsLineBreak(LBGlyphID()))
+ continue;
+ if (!pslot->IsSpace(this))
+ break;
+ }
+ int islot;
+ for (islot = psstrm->SegMin(); islot < islotLim; islot++)
+ {
+ GrSlotState * pslot = psstrm->SlotAt(islot);
+ if (pslot->IsLineBreak(LBGlyphID()))
+ continue;
+ mTotal += pslot->AdvanceX(this);
+ mShrink += pslot->JShrink();
+ }
+
+ // Say that we are allowed to shrink up to 10% of the width of the segment.
+ mShrink = min(mShrink, mTotal/10);
+ m_engst.m_dxsShrinkPossible = EmToLogUnits(mShrink);
+#endif // TEST_SHRINK
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the attribute of the given slot, back to the justification routine. Return
+ logical units.
+----------------------------------------------------------------------------------------------*/
+GrResult EngineState::GetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel,
+ float * pValueRet)
+{
+ GrResult res;
+ int valueRetInt = 0;
+ switch(jgat)
+ {
+ case kjgatWeight:
+ case kjgatStretchInSteps:
+ case kjgatBreak:
+ res = GetGlyphAttrForJustification(iGlyph, jgat, nLevel, &valueRetInt);
+ *pValueRet = (float)valueRetInt;
+ return res;
+ default:
+ break;
+ }
+
+ if (m_ipassJustCalled == -1)
+ return kresUnexpected;
+
+ if (nLevel != 1)
+ return kresInvalidArg;
+
+ GrSlotStream * psstrm = OutputStream(m_ipassJustCalled);
+
+ if (iGlyph < -1 || iGlyph >= psstrm->WritePos())
+ return kresInvalidArg;
+
+ GrSlotState * pslot = psstrm->SlotAt(iGlyph);
+
+ // bool fConvertUnits = true;
+
+ switch(jgat)
+ {
+ case kjgatStretch:
+ *pValueRet = EmToLogUnits(pslot->JStretch());
+ break;
+ case kjgatShrink:
+ *pValueRet = EmToLogUnits(pslot->JShrink());
+ break;
+ case kjgatStep:
+ *pValueRet = EmToLogUnits(pslot->JStep());
+ break;
+ default:
+ return kresNotImpl;
+ }
+ return kresOk;
+}
+
+GrResult EngineState::GetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel,
+ int * pValueRet)
+{
+ GrResult res;
+ float valueRetFloat;
+ switch(jgat)
+ {
+ case kjgatStretch:
+ case kjgatShrink:
+ case kjgatStep:
+ res = GetGlyphAttrForJustification(iGlyph, jgat, nLevel, &valueRetFloat);
+ *pValueRet = GrEngine::RoundFloat(valueRetFloat);
+ return res;
+ default:
+ break;
+ }
+
+ if (m_ipassJustCalled == -1)
+ return kresUnexpected;
+
+ if (nLevel != 1)
+ return kresInvalidArg;
+
+ GrSlotStream * psstrm = OutputStream(m_ipassJustCalled);
+
+ if (iGlyph < -1 || iGlyph >= psstrm->WritePos())
+ return kresInvalidArg;
+
+ GrSlotState * pslot = psstrm->SlotAt(iGlyph);
+
+ int mStretch, mStep;
+ //float xsStretch, xsStep;
+
+ switch(jgat)
+ {
+ case kjgatWeight:
+ *pValueRet = pslot->JWeight();
+ break;
+ case kjgatStretchInSteps:
+ // ???? should this be calculated in terms of logical units??
+ // Probably doesn't matter, since the logical units are floating point, so the
+ // level of precision is about the same.
+ mStretch = pslot->JStretch();
+ mStep = pslot->JStep();
+ if (mStep == 0)
+ return kresUnexpected;
+ *pValueRet = int(mStretch / mStep); // round down
+ break;
+ //case kjgatStretchInSteps:
+ // xsStretch = EmToLogUnits(pslot->JStretch());
+ // xsStep = EmToLogUnits(pslot->JStep());
+ // if (xsStep == 0)
+ // return kresUnexpected;
+ // *pValueRet = int(xsStretch / xsStep); // round down
+ // break;
+ case kjgatBreak:
+ *pValueRet = pslot->BreakWeight();
+ break;
+ default:
+ return kresNotImpl;
+ }
+ return kresOk;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set the attribute of the given slot, for the justification routine.
+----------------------------------------------------------------------------------------------*/
+GrResult EngineState::SetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel,
+ float value)
+{
+ GrResult res;
+ int valueInt;
+ switch(jgat)
+ {
+ case kjgatWeight:
+ case kjgatStretchInSteps:
+ case kjgatBreak:
+ valueInt = (int)value;
+ res = SetGlyphAttrForJustification(iGlyph, jgat, nLevel, valueInt);
+ return res;
+ default:
+ break;
+ }
+
+ if (m_ipassJustCalled == -1)
+ return kresUnexpected;
+
+ if (nLevel != 1)
+ return kresInvalidArg;
+
+ GrSlotStream * psstrm = OutputStream(m_ipassJustCalled);
+
+ if (iGlyph < -1 || iGlyph >= psstrm->WritePos())
+ return kresInvalidArg;
+
+ GrSlotState * pslot = psstrm->SlotAt(iGlyph);
+
+ int mValue = LogToEmUnits(value);
+ mValue = min(mValue, 0xFFFF); // truncate to an unsigned short
+
+ // Review: do we really want to allow them to set stretch/shrink/step/weight? The normal
+ // thing for them to do is set width.
+ switch(jgat)
+ {
+ case kjgatStretch:
+ pslot->SetJStretch(mValue);
+ break;
+ case kjgatShrink:
+ pslot->SetJShrink(mValue);
+ break;
+ case kjgatStep:
+ pslot->SetJStep(mValue);
+ break;
+ case kjgatWidth:
+ pslot->SetJWidth(mValue);
+ break;
+ default:
+ return kresNotImpl;
+ }
+ return kresOk;
+}
+
+GrResult EngineState::SetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel,
+ int value)
+{
+ GrResult res;
+ float valueFloat;
+ switch(jgat)
+ {
+ case kjgatStretch:
+ case kjgatShrink:
+ case kjgatStep:
+ case kjgatWidth:
+ valueFloat = (float)value;
+ res = SetGlyphAttrForJustification(iGlyph, jgat, nLevel, valueFloat);
+ return res;
+ default:
+ break;
+ }
+
+ if (m_ipassJustCalled == -1)
+ return kresUnexpected;
+
+ if (nLevel != 1)
+ return kresInvalidArg;
+
+ GrSlotStream * psstrm = OutputStream(m_ipassJustCalled);
+
+ if (iGlyph < -1 || iGlyph >= psstrm->WritePos())
+ return kresInvalidArg;
+
+ GrSlotState * pslot = psstrm->SlotAt(iGlyph);
+
+ int mValue, cSteps;
+ switch(jgat)
+ {
+ case kjgatWeight:
+ pslot->SetJWeight(value);
+ break;
+ case kjgatWidthInSteps:
+ cSteps = value;
+ mValue = pslot->JStep();
+ if (mValue == 0)
+ return kresUnexpected;
+ pslot->SetJWidth(mValue * cSteps);
+ break;
+ default:
+ return kresNotImpl;
+ }
+ return kresOk;
+}
+
+//:>--------------------------------------------------------------------------------------------
+//:> Functions to forward to the engine.
+//:>------------------------------------------------------------------------------------------*/
+gid16 GrTableManager::GetGlyphIDFromUnicode(int nUnicode)
+{
+ return m_pgreng->GetGlyphIDFromUnicode(nUnicode);
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+gid16 GrTableManager::ActualGlyphForOutput(utf16 chw)
+{
+ return m_pgreng->ActualGlyphForOutput(chw);
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+GrGlyphTable * GrTableManager::GlyphTable()
+{
+ return m_pgreng->GlyphTable();
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+gid16 GrTableManager::LBGlyphID()
+{
+ return m_pgreng->LBGlyphID();
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+gid16 GrTableManager::GetClassGlyphIDAt(int nClass, int nIndex)
+{
+ return m_pgreng->GetClassGlyphIDAt(nClass, nIndex);
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+int GrTableManager::GetIndexInGlyphClass(int nClass, gid16 chwGlyphID)
+{
+ return m_pgreng->GetIndexInGlyphClass(nClass, chwGlyphID);
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+size_t GrTableManager::NumberOfGlyphsInClass(int nClass)
+{
+ return m_pgreng->NumberOfGlyphsInClass(nClass);
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+void GrTableManager::SetSlotAttrsFromGlyphAttrs(GrSlotState * pslot)
+{
+ m_pgreng->SetSlotAttrsFromGlyphAttrs(pslot);
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+int GrTableManager::NumFeat()
+{
+ return m_pgreng->NumFeat();
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+int GrTableManager::DefaultForFeatureAt(int ifeat)
+{
+ return m_pgreng->DefaultForFeatureAt(ifeat);
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+void GrTableManager::DefaultsForLanguage(isocode lgcode,
+ std::vector<featid> & vnFeats, std::vector<int> & vnValues)
+{
+ return m_pgreng->DefaultsForLanguage(lgcode, vnFeats, vnValues);
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+GrFeature * GrTableManager::FeatureWithID(featid nID, int * pifeat)
+{
+ return m_pgreng->FeatureWithID(nID, pifeat);
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+GrFeature * GrTableManager::Feature(int ifeat)
+{
+ return m_pgreng->Feature(ifeat);
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+bool GrTableManager::RightToLeft()
+{
+ if (m_engst.WhiteSpaceOnly())
+ return m_engst.m_fParaRtl;
+ else
+ return m_pgreng->RightToLeft();
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+int GrTableManager::TopDirectionLevel()
+{
+ return m_pgreng->TopDirectionLevel();
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+float GrTableManager::VerticalOffset()
+{
+ return m_pgreng->VerticalOffset();
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+int GrTableManager::NumUserDefn()
+{
+ return m_pgreng->NumUserDefn();
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+int GrTableManager::NumCompPerLig()
+{
+ return m_pgreng->NumCompPerLig();
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+int GrTableManager::ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID)
+{
+ return m_pgreng->ComponentIndexForGlyph(chwGlyphID, nCompID);
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+int GrTableManager::GlyphAttrValue(gid16 chwGlyphID, int nAttrID)
+{
+ return m_pgreng->GlyphAttrValue(chwGlyphID, nAttrID);
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+bool GrTableManager::LoggingTransduction()
+{
+ return m_fLogging;
+ //return m_pgreng->LoggingTransduction();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Calculate the positions of the glyphs up to the given slot, within the output of the given
+ pass. If the slot is NULL, go all the way to the end of what has been generated.
+
+ @param ipass - index of pass needing positioning; normally this will be the
+ final pass, but it could be another if positions are
+ requested by the rules themselves
+ @param pslotLast - last slot that needs to be positioned, or NULL
+ @param pxsWidth - return the total width used so far
+ @param psxVisibleWidth - return the visible width so far
+
+ MOVE to EngineState
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::CalcPositionsUpTo(int ipass, GrSlotState * pslotLast,
+ float * pxsWidth, float * pxsVisibleWidth)
+{
+ Assert(ipass >= m_ipassPos1 - 1);
+
+ int isstrm = ipass;
+ GrSlotStream * psstrm = OutputStream(isstrm);
+ Assert(psstrm->GotIndexOffset());
+ if (psstrm->WritePos() <= psstrm->IndexOffset())
+ {
+ Assert(psstrm->WritePos() == 0);
+ *pxsWidth = 0;
+ *pxsVisibleWidth = 0;
+ return;
+ }
+ if (!pslotLast)
+ {
+ pslotLast = psstrm->SlotAt(psstrm->WritePos() - 1);
+ }
+ Assert(pslotLast);
+
+ // First set positions of all base slots.
+
+ int islot = psstrm->IndexOffset();
+ GrSlotState * pslot;
+ float xs = 0;
+ float ys = VerticalOffset();
+ *pxsWidth = 0;
+ *pxsVisibleWidth = 0;
+
+ bool fLast = false;
+ bool fLastBase = false;
+
+ bool fFakeItalic = m_pgreng->FakeItalic();
+ float fakeItalicRatio = 0;
+ if (fFakeItalic)
+ fakeItalicRatio = State()->GetFont()->fakeItalicRatio();
+ bool fBasicJust = m_pgreng->BasicJustification();
+
+ // Figure out how to know when to stop.
+ // We need to calculate up to the base of the last leaf slot, if it happens
+ // to be later in the stream than the last actual slot passed in.
+ if (!psstrm->HasSlotAtPosPassIndex(pslotLast->AttachRootPosPassIndex()))
+ return;
+ GrSlotState * pslotLastBase = pslotLast->Base(psstrm);
+
+ if (ipass == m_cpass - 1 && m_engst.m_islotPosNext > -1)
+ {
+ // For final pass, initialize from cache of previous calculations.
+ islot = m_engst.m_islotPosNext;
+ xs = m_engst.m_xsPosXNext;
+ ys = m_engst.m_ysPosYNext;
+ *pxsWidth = m_engst.m_dxsTotWidthSoFar;
+ *pxsVisibleWidth = m_engst.m_dxsVisWidthSoFar;
+
+ if (psstrm->SlotsPresent() <= islot)
+ return;
+
+ if (pslotLastBase->PosPassIndex() == GrSlotAbstract::kNotYetSet)
+ {
+ Assert(false); // I think this case is handled above
+ return; // can't position this slot yet; its base has not been processed
+ }
+
+ if (pslotLastBase->PosPassIndex() + psstrm->IndexOffset() < islot)
+ {
+ fLastBase = true;
+ if (pslotLast == pslotLastBase)
+ fLast = true;
+ }
+ }
+
+ std::vector<GrSlotState *> vpslotAttached;
+
+ bool fRtl = RightToLeft();
+
+ while (!fLast || !fLastBase)
+ {
+ Assert(islot < psstrm->SlotsPresent());
+
+ pslot = (isstrm == ipass) ? psstrm->SlotAt(islot) : psstrm->OutputSlotAt(islot);
+
+ if (!pslot->IsBase())
+ {
+ // This slot is attached to another; it will be positioned strictly
+ // relative to that one. This happens in the loop below.
+ vpslotAttached.push_back(pslot);
+ }
+ else
+ {
+ // Base character.
+
+ bool fLB = pslot->IsLineBreak(LBGlyphID());
+ if (InternalJustificationMode() == kjmodiJustify && fBasicJust
+ && ipass == m_cpass - 1 && !fLB)
+ {
+ m_engst.AddJWidthToAdvance(psstrm, &pslot, islot, &pslotLast, &pslotLastBase);
+ }
+
+ // Make sure the metrics are the complete ones.
+ pslot->CalcCompositeMetrics(this, psstrm, kPosInfinity, true);
+
+ float xsInc = pslot->GlyphXOffset(psstrm, fakeItalicRatio);
+ float ysInc = pslot->GlyphYOffset(psstrm);
+ float xsAdvX = pslot->ClusterAdvWidth(psstrm);
+ float ysAdvY = (fLB) ?
+ 0 :
+ EmToLogUnits(pslot->AdvanceY(this));
+
+ if (fRtl)
+ {
+ xs -= xsAdvX;
+ ys -= ysAdvY;
+ pslot->SetXPos(xs + xsInc);
+ pslot->SetYPos(ys + ysInc);
+ }
+ else
+ {
+ pslot->SetXPos(xs + xsInc);
+ pslot->SetYPos(ys + ysInc);
+ xs += xsAdvX;
+ ys += ysAdvY;
+ }
+
+ *pxsWidth = max(*pxsWidth, fabsf(xs));
+ if (!IsWhiteSpace(pslot))
+ *pxsVisibleWidth = *pxsWidth;
+
+ if (isstrm == m_cpass - 1)
+ {
+ // For the final output pass, cache the results of the calculation so far.
+ // Only do this for slots that have actually been processed by the final
+ // pass, because others may have intermediate values that may be changed
+ // later.
+ m_engst.m_islotPosNext = pslot->PosPassIndex() + psstrm->IndexOffset() + 1;
+ m_engst.m_xsPosXNext = xs;
+ m_engst.m_ysPosYNext = ys;
+ m_engst.m_dxsTotWidthSoFar = *pxsWidth;
+ m_engst.m_dxsVisWidthSoFar = *pxsVisibleWidth;
+ }
+ }
+
+ // Need to have calculated both the last leaf and the last base (if they happen to
+ // be different); if so, we're done.
+ if (pslot == pslotLast)
+ fLast = true;
+ if (pslot == pslotLastBase)
+ fLastBase = true;
+
+ islot++;
+ }
+
+ Assert(fLast);
+ Assert(fLastBase);
+
+ // Now set positions of non-base slots, relative to their bases.
+
+ for (size_t ipslot = 0; ipslot < vpslotAttached.size(); ipslot++)
+ {
+ GrSlotState * pslot = vpslotAttached[ipslot];
+ GrSlotState * pslotBase = pslot->Base(psstrm);
+ if (pslotBase->XPosition() == kNegInfinity || pslotBase->YPosition() == kNegInfinity)
+ {
+ Assert(false);
+ continue;
+ }
+ float xsCluster = pslotBase->XPosition() - pslotBase->GlyphXOffset(psstrm, fakeItalicRatio);
+ float ysCluster = pslotBase->YPosition() - pslotBase->GlyphYOffset(psstrm);
+ float xsInc = pslot->GlyphXOffset(psstrm, fakeItalicRatio);
+ float ysInc = pslot->GlyphYOffset(psstrm);
+ pslot->SetXPos(xsCluster + xsInc);
+ pslot->SetYPos(ysCluster + ysInc);
+
+ // My theory is that we don't need to adjust *pxsWidth here, because the width of
+ // any non-base slots should be factored into the advance width of their cluster
+ // base, which was handled above.
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if the given slot is white space.
+----------------------------------------------------------------------------------------------*/
+bool GrTableManager::IsWhiteSpace(GrSlotState * pslot)
+{
+ if (pslot->IsLineBreak(LBGlyphID()))
+ return true;
+ return pslot->IsSpace(this);
+}
+
+/*----------------------------------------------------------------------------------------------
+ When doing basic justification, apply the value of justify.width to the advance width.
+ This happens during the final positioning routine.
+----------------------------------------------------------------------------------------------*/
+void EngineState::AddJWidthToAdvance(GrSlotStream * psstrm, GrSlotState ** ppslot, int islot,
+ GrSlotState ** ppslotLast, GrSlotState ** ppslotLastBase)
+{
+ Assert(psstrm->OutputOfPass() == m_cpass - 1); // only used for final stream
+ if ((*ppslot)->JWidth() > 0)
+ {
+ if ((*ppslot)->PassModified() != m_cpass - 1)
+ {
+ // Replace the slot with a new slot, so it gets marked properly with the
+ // pass in which it was modified. (Otherwise the debug log gets screwed up.)
+ GrSlotState * pslotNew;
+ NewSlotCopy((*ppslot), m_cpass - 1, &pslotNew);
+ psstrm->PutSlotAt(pslotNew, islot);
+ if (*ppslot == *ppslotLast)
+ *ppslotLast = pslotNew;
+ if (*ppslot == *ppslotLastBase)
+ *ppslotLastBase = pslotNew;
+ *ppslot = pslotNew;
+ }
+ (*ppslot)->AddJWidthToAdvance(TableManager());
+ }
+}
+
+
+//:>********************************************************************************************
+//:> Debuggers and utilities
+//:>********************************************************************************************
+
+//:Ignore
+#if 0
+void GrTableManager::TempDebug()
+{
+ for (int ipass = 0; ipass < m_cpass; ++ipass)
+ {
+ int wpos = OutputStream(ipass)->WritePos();
+ int rpos = OutputStream(ipass)->ReadPos();
+ GrSlotState * wslot = OutputStream(ipass)->LastSlotWritten();
+ GrSlotState * rslot = OutputStream(ipass)->LastSlotRead();
+
+ }
+}
+#endif
+/*----------------------------------------------------------------------------------------------
+ Given a character index in the original string, locate the corresponding line-break slot
+ in the final surface stream. The character index must be one before which there is a
+ line-break (seg lim), or the beginning or the end of the string.
+ TODO SharonC: fix the bugs
+----------------------------------------------------------------------------------------------*/
+int GrTableManager::SurfaceLineBreakSlot(int ichw, GrCharStream * pchstrm, bool fInitial)
+{
+ if (ichw == 0)
+ {
+ Assert(fInitial);
+ return -1; // no initial line break
+ }
+ if (ichw == pchstrm->Lim())
+ {
+ Assert(!fInitial);
+ return -1; // no terminating line break
+ }
+
+ int islotIn = pchstrm->SegOffset(ichw);
+ Assert(islotIn >= 0);
+ islotIn += (fInitial? m_engst.m_cslotPreSeg - 1: m_engst.m_cslotPreSeg);
+
+ gid16 chwLBGlyphID = LBGlyphID();
+
+ // Now islotIn is the position in stream 0;
+
+ for (int ipass = 1; ipass < m_cpass; ++ipass)
+ {
+ int islotChunkMin;
+ int islotChunkLim;
+ GrSlotStream * psstrmOut = OutputStream(ipass);
+
+ GrSlotStream * psstrmIn = InputStream(ipass);
+ if (fInitial)
+ islotIn = max(islotIn, psstrmIn->PreChunk());
+ int islotT = psstrmIn->ChunkInNextMin(islotIn);
+ islotChunkMin = psstrmIn->ChunkInNext(islotT);
+ islotChunkMin = (islotChunkMin == -1)? 0: islotChunkMin;
+
+ islotT = psstrmIn->ChunkInNextLim(islotIn);
+ Assert(islotT <= psstrmIn->ReadPos());
+ if (islotT == psstrmIn->ReadPos())
+ islotChunkLim = psstrmOut->WritePos();
+ else
+ islotChunkLim = psstrmIn->ChunkInNext(islotT);
+
+ int islotOut;
+ for (islotOut = islotChunkMin; islotOut < islotChunkLim; ++islotOut)
+ {
+ gid16 chw = psstrmOut->GlyphIDAt(islotOut);
+ if (chw == chwLBGlyphID)
+ break;
+ }
+ Assert(psstrmOut->GlyphIDAt(islotOut) == chwLBGlyphID);
+
+ islotIn = islotOut;
+ }
+ return islotIn;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Generate a debugger string showing the chunk boundaries for the given stream.
+----------------------------------------------------------------------------------------------*/
+std::wstring GrTableManager::ChunkDebugString(int ipass)
+{
+ GrSlotStream * psstrm = OutputStream(ipass);
+ std::wstring stuRet;
+ //utf16 chwN = '\\';
+ //utf16 chwR = '^';
+
+ gid16 chwLBGlyphID = LBGlyphID();
+
+ for (int islot = 0; islot < psstrm->WritePos(); islot++)
+ {
+ if (psstrm->ChunkInPrev(islot) != -1)
+ {
+ if (psstrm->ChunkInNext(islot) != -1)
+ stuRet.append(L">");
+ else
+ stuRet.append(L"\\");
+ }
+ else if (psstrm->ChunkInNext(islot) != -1)
+ stuRet.append(L"/");
+ else
+ stuRet.append(L" ");
+
+// if (islot == psstrm->ReadPos())
+// stuRet.Append(&chwR, 1);
+
+ wchar_t chw = psstrm->SlotAt(islot)->GlyphID();
+ if (chw == chwLBGlyphID)
+ stuRet.append(L"#");
+ else
+ stuRet.append(&chw, 1);
+ }
+ return stuRet;
+}
+
+} // namespace gr
+
+//:End Ignore
diff --git a/Build/source/libs/graphite/src/segment/GrTableManager.h b/Build/source/libs/graphite/src/segment/GrTableManager.h
new file mode 100644
index 00000000000..e0306c832c7
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/GrTableManager.h
@@ -0,0 +1,583 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999 - 2008 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrTableManager.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ The GrTableManager class.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GR_TABLEMAN_INCLUDED
+#define GR_TABLEMAN_INCLUDED
+
+#include <cassert>
+//:End Ignore
+
+namespace gr
+{
+
+class Font;
+
+/*----------------------------------------------------------------------------------------------
+ There is a single instance of Engine State that keeps track of the state of the processing
+ for a single segment generation.
+
+ Hungarian: engst
+----------------------------------------------------------------------------------------------*/
+class EngineState
+{
+ friend class GrTableManager;
+ friend class FontMemoryUsage;
+
+public:
+ EngineState();
+ void Initialize(GrEngine *, GrTableManager *);
+
+ ~EngineState();
+ void DestroySlotBlocks();
+
+ void InitForNewSegment(GrTableManager * ptman);
+
+ void CreateEmpty();
+
+ GrEngine * Engine();
+ GrTableManager * TableManager();
+
+ void CreateSlotStreams();
+
+ GrSlotStream * InputStream(int ipass)
+ {
+ Assert(ipass > 0); // the char stream serves as input to the zeroth pass
+ return m_prgpsstrm[ipass - 1];
+ }
+
+ // Return the stream that serves as output to the given pass.
+ GrSlotStream * OutputStream(int ipass)
+ {
+ Assert(ipass < m_cpass);
+ return m_prgpsstrm[ipass];
+ }
+
+ GrSlotState * AnAdjacentSlot(int ipassArg, int islotArg);
+
+ GrResult GetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, float * pxysValueRet);
+ GrResult GetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, int * pxysValueRet);
+ GrResult SetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, float xysValue);
+ GrResult SetGlyphAttrForJustification(int iGlyph, int jgat, int nLevel, int xysValue);
+
+ enum { kSlotBlockSize = 50 }; // number of slots to allocate in a block
+
+ void InitPosCache()
+ {
+ m_islotPosNext = -1;
+ m_xsPosXNext = 0;
+ m_ysPosYNext = 0;
+ m_dxsTotWidthSoFar = 0;
+ m_dxsVisWidthSoFar = 0;
+ }
+
+ void SetFont(Font * pfont)
+ {
+ m_pfont = pfont;
+ }
+ Font * GetFont()
+ {
+ return m_pfont;
+ }
+
+ bool StartLineContext()
+ {
+ return m_fStartLineContext;
+ }
+ bool EndLineContext()
+ {
+ return m_fEndLineContext;
+ }
+ void SetStartLineContext(bool f)
+ {
+ m_fStartLineContext = f;
+ }
+ void SetEndLineContext(bool f)
+ {
+ m_fEndLineContext = f;
+ }
+
+ void SetInitialLB(bool f = true)
+ {
+ m_fInitialLB = f;
+ }
+
+ void SetFinalLB(bool f = true)
+ {
+ m_fFinalLB = f;
+ }
+
+ void SetInsertedLB(bool f = true)
+ {
+ m_fInsertedLB = f;
+ }
+
+ bool HasInitialLB()
+ {
+ return m_fInitialLB;
+ }
+ bool HasInsertedLB()
+ {
+ return m_fInsertedLB;
+ }
+ bool HasFinalLB()
+ {
+ return m_fFinalLB;
+ }
+
+ void SetExceededSpace(bool f = true)
+ {
+ m_fExceededSpace = f;
+ }
+
+ bool ExceededSpace()
+ {
+ return m_fExceededSpace;
+ }
+
+ void SetHitHardBreak(bool f = true)
+ {
+ m_fHitHardBreak = f;
+ }
+
+ bool HitHardBreak()
+ {
+ return m_fHitHardBreak;
+ }
+
+ void SetRemovedTrWhiteSpace(bool f = true)
+ {
+ m_fRemovedWhtsp = f;
+ }
+
+ bool RemovedTrWhiteSpace()
+ {
+ return m_fRemovedWhtsp;
+ }
+
+ bool WhiteSpaceOnly()
+ {
+ return (m_twsh == ktwshOnlyWs);
+ }
+
+ bool ParaRightToLeft()
+ {
+ return m_fParaRtl;
+ }
+
+ //int PrevPassMaxBackup(int ipass)
+ //{
+ // if (ipass == 0)
+ // return 0;
+ // return Pass(ipass - 1)->MaxBackup();
+ //}
+
+ DirCode InitialStrongDir()
+ {
+ return m_dircInitialStrongDir;
+ }
+ DirCode InitialTermDir()
+ {
+ return m_dircInitialTermDir;
+ }
+
+ void InitializeStreams(GrTableManager * ptman, GrCharStream * pchstrm,
+ int cbPrev, byte * pbPrevSegDat, bool fNeedFinalBreak, int * pislotFinalBreak);
+ int LbSlotToSegLim(int islot, GrCharStream * pchstrm, int cpassLB);
+ int TraceStreamZeroPos(int islotFinal, int nTopDir);
+
+ float EmToLogUnits(int m);
+ int LogToEmUnits(float xys);
+ bool GPointToXY(gid16 chwGlyphID, int nGPoint, float * xs, float * ys);
+
+ void AddJWidthToAdvance(GrSlotStream * psstrm, GrSlotState ** ppslot, int islot,
+ GrSlotState ** ppslotLast, GrSlotState ** ppslotLastBase);
+
+ // Memory management for slots:
+ void NewSlot(gid16 gID, GrFeatureValues fval, int ipass, int ichwSegOffset, int nUnicode,
+ GrSlotState **);
+ void NewSlot(gid16 gID, GrSlotState * pslotFeat, int ipass, int ichwSegOffset,
+ GrSlotState **);
+ void NewSlot(gid16 gID, GrSlotState * pslotFeat, int ipass, GrSlotState **);
+ void NewSlotCopy(GrSlotState * pslotCopyFrom, int ipass,
+ GrSlotState ** pslotRet);
+protected:
+ void NextSlot(GrSlotState ** ppslot);
+
+protected:
+ GrTableManager * m_ptman;
+
+ int m_cFeat;
+ int m_cCompPerLig;
+ int m_cUserDefn;
+
+ int m_jmodi; // justification mode
+ int m_ipassJustCalled; // pass after which justification routine was called;
+ // -1 if we are not in the midst of interacting with the
+ // GrJustifier
+
+ // Pointer to font
+ Font * m_pfont;
+
+ bool m_fStartLineContext; // true if there was a rule that ran over the initial LB
+ bool m_fEndLineContext; // true if there was a rule that ran over the final LB
+
+ // the number of slots inserted in the first stream before the official beginning
+ // of the segment, including any initial line break
+ int m_cslotPreSeg;
+
+ // List of allocated GrSlotStates; hungarian slotblk = prgslot
+ std::vector<GrSlotState *> m_vslotblk;
+ std::vector<u_intslot *> m_vprgnSlotVarLenBufs; // corresponding var-length blocks
+ int m_islotblkCurr;
+ int m_islotNext;
+
+ // Directionality codes from previous segment; these are used by the bidi algorithm
+ // at the initial line-break character.
+ DirCode m_dircInitialStrongDir;
+ DirCode m_dircInitialTermDir;
+
+ LineBrk m_lbPrevEnd;
+
+ // All of the following 3 are true only when there is an actual LB glyph in the stream
+ bool m_fInitialLB; // is there is an initial LB (an actual LB glyph--in all streams)
+ bool m_fFinalLB; // is there is a final LB (in all streams--true when we've hit
+ // the end of the input and end-of-line is true)
+ bool m_fInsertedLB; // is there is a final LB inserted in the output of LB pass
+ // (true when we've backtracked)
+
+ bool m_fExceededSpace; // true if we backtracked due to exceeding space; false if we
+ // haven't backtracked, or we did so for some other reason
+ // (eg, omitting trailing whitespace)
+
+ bool m_fHitHardBreak; // true if we encountered a hard-break in the input stream
+ // (before the natural end of the segment)
+
+ bool m_fRemovedWhtsp; // true if we've hit trailing whitespace characters that we've
+ // removed
+
+ TrWsHandling m_twsh; // white-space handling
+ bool m_fParaRtl; // paragraph direction
+
+ float m_dxsShrinkPossible;
+
+ // The final positioning pass is where we are going to do most of the positioning.
+ // Cache the intermediate results so we don't have to calculate from the beginning of
+ // the segment every time.
+ int m_islotPosNext; // where to continue calculating positions in final output stream
+ // (one past the last base that was calculated)
+ float m_xsPosXNext;
+ float m_ysPosYNext;
+ float m_dxsTotWidthSoFar;
+ float m_dxsVisWidthSoFar;
+
+ int m_cpass; // number of passes
+
+ // array of pass-state objects
+ PassState * m_prgzpst;
+
+ // array of slot streams which are output of passes (input of zeroth
+ // pass is the character stream, not a slot stream):
+ GrSlotStream ** m_prgpsstrm;
+ // For instance, a simple set of passes might look like this:
+ // CharStream
+ // GlyphGenPass pass 0
+ // SlotStream stream 0
+ // SubPass pass 1
+ // SlotStream stream 1
+ // PosPass pass 2
+ // SlotStream stream 2
+ //
+ // m_cpass = 3
+
+}; // end of class EngineState
+
+/*----------------------------------------------------------------------------------------------
+ There is a single instance of GrTableManager that handle the interactions between
+ passes, including the demand-pull mechanism.
+
+ Hungarian: tman
+----------------------------------------------------------------------------------------------*/
+
+class GrTableManager {
+ friend class FontMemoryUsage;
+
+public:
+ // Constructor & destructor:
+ GrTableManager(GrEngine * pgreng)
+ : m_cpass(0),
+ m_fBidi(false),
+ m_prgppass(NULL),
+ m_pgreng(pgreng)
+ {
+ Assert(pgreng);
+ }
+
+ ~GrTableManager();
+
+ bool CreateAndReadPasses(GrIStream & grstrm, int fxdSilfVersion, int fxdRuleVersion,
+ int cpassFont, long lSubTableStart, int * rgnPassOffsets,
+ int ipassSub1Font, int ipassPos1Font, int ipassJust1Font, byte ipassPostBidiFont);
+
+ void CreateEmpty();
+
+ GrEngine * Engine();
+ EngineState * State();
+
+ void Run(Segment * psegNew, Font * pfont, GrCharStream * pchstrm,
+ IGrJustifier * pgjus, int jmodi,
+ LayoutEnvironment & layout,
+ int ichStop, float dxWidth, float dxUnjustified,
+ bool fNeedFinalBreak, bool fMoreText, int ichFontLim,
+ bool fInfiniteWidth, bool fWidthIsCharCount,
+ int ichwCallerBtLim,
+ int nDirDepth, SegEnd estJ);
+
+ GrPass* Pass(int ipass)
+ {
+ Assert(ipass >= 0);
+ return m_prgppass[ipass];
+ }
+
+ int NumberOfPasses()
+ {
+ return m_cpass;
+ }
+
+ int NumberOfLbPasses()
+ {
+ return m_cpassLB;
+ }
+
+ bool HasBidiPass()
+ {
+ return m_fBidi;
+ }
+
+ int FirstPosPass()
+ {
+ return m_ipassPos1;
+ }
+
+ void StorePassStates(PassState * rgzpst);
+
+ // Return the stream that serves as input to the given pass.
+ GrSlotStream * InputStream(int ipass)
+ {
+ return m_engst.InputStream(ipass);
+ }
+ GrSlotStream * OutputStream(int ipass)
+ {
+ return m_engst.OutputStream(ipass);
+ }
+
+ void UnwindAndReinit(int islotNewBreak);
+
+public:
+ int InternalJustificationMode()
+ {
+ return m_engst.m_jmodi;
+ }
+
+ bool ShouldLogJustification()
+ {
+ return (m_engst.m_jmodi != kjmodiNormal);
+ }
+
+ int PrevPassMaxBackup(int ipass)
+ {
+ if (ipass == 0)
+ return 0;
+ return Pass(ipass - 1)->MaxBackup();
+ }
+
+ // Forward to the engine itself
+ gid16 GetGlyphIDFromUnicode(int nUnicode);
+ gid16 ActualGlyphForOutput(utf16 chwGlyphID);
+ GrGlyphTable * GlyphTable();
+
+ gid16 LBGlyphID();
+
+ gid16 GetClassGlyphIDAt(int nClass, int nIndex);
+ int GetIndexInGlyphClass(int nClass, gid16 chwGlyphID);
+ size_t NumberOfGlyphsInClass(int nClass);
+
+ void SetSlotAttrsFromGlyphAttrs(GrSlotState * pslot);
+
+ int NumFeat();
+ int DefaultForFeatureAt(int ifeat);
+ GrFeature * FeatureWithID(featid nID, int * pifeat);
+ GrFeature * Feature(int ifeat);
+ void DefaultsForLanguage(isocode lgcode,
+ std::vector<featid> & vnFeats, std::vector<int> & vnValues);
+
+ bool RightToLeft();
+ int TopDirectionLevel();
+
+ float VerticalOffset();
+
+ int NumUserDefn();
+ int NumCompPerLig();
+
+ int ComponentIndexForGlyph(gid16 chwGlyphID, int nCompID);
+ int GlyphAttrValue(gid16 chwGlyphID, int nAttrID);
+
+ // ---
+
+ bool LoggingTransduction();
+
+ float EmToLogUnits(int m);
+ int LogToEmUnits(float xys);
+ bool GPointToXY(gid16 chwGlyphID, int nGPoint, float * xs, float * ys);
+
+ void CalcPositionsUpTo(int ipass, GrSlotState * pslotLast,
+ float * pxsWidth, float * pxsVisibleWidth);
+
+ void InitPosCache()
+ {
+ m_engst.InitPosCache();
+ }
+
+ bool IsWhiteSpace(GrSlotState * pslot);
+
+ // For transduction logging:
+ bool WriteTransductionLog(std::ostream * pstrmLog,
+ GrCharStream * pchstrm, Segment * psegRet, int cbPrevSetDat, byte * pbPrevSegDat);
+ bool WriteAssociationLog(std::ostream * pstrmLog,
+ GrCharStream * pchstrm, Segment * psegRet);
+ bool WriteXmlLog(std::ostream * pstrmLog,
+ GrCharStream * pchstrm, Segment * psegRet, int cbPrevSegDat, byte * pbPrevSegDat);
+ bool WriteXmlAssocLog(std::ostream * pstrmLog,
+ GrCharStream * pchstrm, Segment * psegRet);
+
+#ifdef TRACING
+ void WriteXductnLog(std::ostream & strmOut, GrCharStream * pchstrm, Segment * psegRet,
+ int cbPrevSegDat, byte * pbPrevSegDat);
+ //bool LogFileName(std::string & staFile);
+ void LogUnderlying(std::ostream & strmOut, GrCharStream * pchstrm, int cchwBackup);
+ void LogPass1Input(std::ostream & strmOut);
+ void LogPassOutput(std::ostream & strmOut, int ipass, int cslotSkipped);
+ void LogAttributes(std::ostream & strmOut, int ipass, bool fJustWidths = false);
+ void LogFinalPositions(std::ostream & strmOut);
+ void LogUnderlyingHeader(std::ostream & strmOut, int ichwMin,
+ int ichwLim, int cchwBackup, int * prgichw16bit);
+ void LogSlotHeader(std::ostream & strmOut, int cslot,
+ int cspPerSlot, int cspLeading, int islotMin = 0);
+ void LogSlotGlyphs(std::ostream & strmOut, GrSlotStream * psstrm);
+ void SlotAttrsModified(int ipass, bool * rgfMods, bool fPreJust, int * pccomp, int *pcassoc);
+ void LogInTable(std::ostream & strmOut, int n);
+ void LogInTable(std::ostream & strmOut, float n);
+ void LogHexInTable(std::ostream & strmOut, gid16 chw, bool fPlus = false);
+ void LogDirCodeInTable(std::ostream & strmOut, int dirc);
+ void LogBreakWeightInTable(std::ostream & strmOut, int lb);
+
+ void WriteXmlLogAux(std::ostream & strmOut,
+ GrCharStream * pchstrm, Segment * psegRet, int cbPrevSegDat, byte * pbPrevSegDat);
+ void LogXmlUnderlying(std::ostream & strmOut, GrCharStream * pchstrm, int cchwBackup, size_t nIndent);
+ void LogXmlUnderlyingAux(std::ostream & strmOut, GrCharStream * pchstrm,
+ int cch32Backup, int cch32Lim, size_t nIndent,
+ bool fLogText, bool fLogFeatures, bool fLogColor, bool fLogStrOff, bool fLogLig, bool fLogGlyphs);
+ void LogXmlPass(std::ostream & strmOut, int ipass, int cslotSkipped, int nIndent);
+
+ void LogXmlTagOpen(std::ostream & strmOut, std::string strTag, size_t nIndent, bool fContent);
+ void LogXmlTagPostAttrs(std::ostream & strmOut, bool fContent);
+ void LogXmlTagClose(std::ostream & strmOut, std::string strTag, size_t nIndent, bool fContent);
+ void LogXmlTagAttr(std::ostream & strmOut, std::string strAttr, int nValue, size_t nIndent = 0);
+ void LogXmlTagAttr(std::ostream & strmOut, std::string strAttr, const char * szValue, size_t nIndent = 0);
+ void LogXmlTagAttrHex(std::ostream & strmOut, std::string strAttr, int nValue, size_t nIndent = 0);
+ std::string HexString(int n1, int n2, int n3, int n4, int n5, int n6);
+ std::string HexString(std::vector<int>);
+ void LogXmlTagColor(std::ostream & strmOut, std::string strAttr, int clrValue, bool fBack,
+ size_t nIndent = 0);
+ void LogXmlDirCode(std::ostream & strmOut, std::string strAttr, int dircValue, size_t nIndent = 0);
+ void LogXmlBreakWeight(std::ostream & strmOut, std::string strAttr, int dircValue,
+ size_t nIndent = 0);
+ void LogXmlComment(std::ostream & strmOut, std::string strComment, size_t nIndent = 0);
+
+#endif // TRACING
+
+protected:
+ void InitNewSegment(Segment * psegNew, Font * pfont, GrCharStream * pchstrm, IGrJustifier * pgjus,
+ int islotStream0Break, int islotSurfaceBreak, bool fStartLine, bool fEndLine, int ichFontLim,
+ LineBrk lbEnd, SegEnd est, int * dichSegLen);
+
+ void InitSegmentAsEmpty(Segment * psegNew, Font * pfont, GrCharStream * pchstrm,
+ bool fStartLine, bool fEndLine);
+
+ void InitSegmentToDelete(Segment * psegNew, Font * pfont, GrCharStream * pchstrm);
+
+ int ChunkInPrev(int ipass, int islot, GrCharStream * pchstrm);
+
+ bool Backtrack(int * islotPrevLB,
+ LineBrk * plbPref, LineBrk lbMax, TrWsHandling, bool fMoreText,
+ int ichwCallerBtLim, LineBrk * plbFound);
+
+ LineBrk IncLineBreak(LineBrk lb);
+
+ void InitializeForNextSeg(Segment* pseg,
+ int islotStream0Break, int islotSurfaceBreak, LineBrk lbEnd,
+ bool fNextSegNeedsContext, GrCharStream * pchstrm);
+
+ void SetFinalPositions(Segment * pseg, bool fWidthIsCharCount);
+ void RecordAssocsAndOutput(Font * pfont, Segment * pseg,
+ TrWsHandling twsh, bool fParaRtl, int nDirDepth);
+
+ void CalculateAssociations(Segment * pseg, int csloutSurface);
+ void AdjustAssocsForOverlaps(Segment * pseg);
+
+ void UnstretchTrailingWs(GrSlotStream * psstrm, int iGlyphLim);
+ void CallJustifier(IGrJustifier * pgjus, int ipassCurr, float dxUnjustified, float dxJustified,
+ bool fEndLine);
+
+ void DetermineShrink(IGrJustifier * pgjus, int ipass);
+
+protected:
+ // Instance variables:
+
+ int m_cpass; // number of passes; zero-th pass is Unicode character -> glyph ID mapping;
+ // Note thatwe always have one positioning pass to measure things even
+ // if there are no tables to run.
+
+ int m_cpassLB; // number of line-break passes
+ int m_ipassPos1; // first positioning pass
+ int m_ipassJust1; // first justification pass (== m_ipassPos1 if none)
+
+ bool m_fBidi; // is there a bidi pass?
+
+ // array of passes:
+ GrPass ** m_prgppass;
+
+ // Pointer back to Graphite engine, to give access to global constants and tables.
+ GrEngine * m_pgreng;
+
+ // State of processing.
+ EngineState m_engst;
+
+ bool m_fLogging;
+
+public:
+ // For test procedures:
+ void SetUpTest(std::wstring);
+
+protected:
+ void TempDebug();
+ int SurfaceLineBreakSlot(int ichw, GrCharStream * pchstrm, bool fInitial);
+ std::wstring ChunkDebugString(int ipass);
+}; // end of class GrTableManager
+
+} // namespace gr
+
+
+#endif // !GR_TABLEMAN_INCLUDED
diff --git a/Build/source/libs/graphite/src/segment/Main.h b/Build/source/libs/graphite/src/segment/Main.h
new file mode 100644
index 00000000000..da95af09ce8
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/Main.h
@@ -0,0 +1,181 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: Main.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Main.header file for the Graphite engine.
+----------------------------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GRAPHITE_H
+#define GRAPHITE_H 1
+
+//:End Ignore
+
+#define NO_EXCEPTIONS 1
+
+// It's okay to use functions that were declared deprecated by VS 2005:
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_DEPRECATE
+#pragma warning(disable: 4996) // warning: function was declared deprecated
+#pragma warning(disable: 4702) // unreachable code
+#endif
+
+#include "GrCommon.h"
+
+//:>********************************************************************************************
+//:> Interfaces.
+//:>********************************************************************************************
+#include "GrData.h"
+
+//:>********************************************************************************************
+//:> Implementations.
+//:>********************************************************************************************
+
+#ifndef _WIN32
+#include "GrMstypes.h"
+#ifndef HAVE_FABSF
+float fabsf(float x);
+#endif
+#endif
+#include "GrDebug.h"
+
+// For reading the font (FieldWorks's approach) and transduction logging:
+#include <fstream>
+#include <iostream>
+
+#include <vector>
+////#include <algorithm>
+#include <string>
+
+// gAssert should be used for any kind of assertions that can be caused by a corrupted font,
+// particularly those that won't be caught when loading the tables.
+#define gAssert(x) Assert(x)
+// When testing the error mechanism (because the process of bringing up the assertion dialog
+// interferes with FW repainting the invalid window:
+////#define gAssert(x) if (!(x)) Warn("corrupted font?")
+
+// Internal headers.
+#include "FileInput.h"
+
+// Public headers.
+#include "GrResult.h"
+//////#include "IGrGraphics.h"
+#include "ITextSource.h"
+#include "IGrJustifier.h"
+#include "IGrEngine.h"
+#include "GrConstants.h"
+#include "GrFeature.h"
+
+// External helper classes.
+#include "GrExt.h"
+
+
+// Forward declarations.
+namespace gr
+{
+ class GrTableManager;
+ class Segment;
+ class GrEngine;
+}
+
+// Define after GrExt.h to avoid conflict with FW Rect class.
+namespace gr
+{
+/*
+struct Point
+{
+ float x;
+ float y;
+
+ Point()
+ {
+ x = y = 0;
+ }
+
+ Point(POINT & p)
+ {
+ x = (float)p.x;
+ y = (float)p.y;
+ }
+};
+
+
+struct Rect
+{
+ float top;
+ float bottom;
+ float left;
+ float right;
+
+ Rect()
+ {
+ top = bottom = left = right = 0;
+ };
+
+ Rect(RECT & r)
+ {
+ top = (float)r.top;
+ bottom = (float)r.bottom;
+ left = (float)r.left;
+ right = (float)r.right;
+ };
+};
+*/
+}; // namespace gr
+
+#include "GrFeatureValues.h"
+#include "GrSlotState.h"
+
+#include "SegmentAux.h"
+
+// Internal headers
+#include "GrCharStream.h"
+#include "GrGlyphTable.h"
+#include "GrClassTable.h"
+#include "GrPseudoMap.h"
+#include "GrSlotStream.h"
+#include "GrFSM.h"
+#include "GrPass.h"
+#include "GrTableManager.h"
+#include "FontCache.h"
+
+
+// Public headers
+#include "Font.h"
+#include "GraphiteProcess.h"
+#include "GrEngine.h"
+#include "FontFace.h"
+#include "Segment.h"
+#include "SegmentPainter.h"
+
+//#ifdef _WIN32
+//#include <hash_map>
+//#include "WinFont.h"
+//#include "WinSegmentPainter.h"
+//#endif
+
+// Internal headers
+#include "TtfUtil.h"
+//#include "GrUtil.h"
+
+#include "GrWrappers.h"
+
+//#include "IGrDebug.h"
+//#include "GrSegmentDebug.h"
+//#include "GrEngineDebug.h"
+
+/////<<<<<<< .mine
+// clashes with non gr stuff
+// using namespace gr;
+///////>>>>>>> .r98
+
+#endif // GRAPHITE_H
+
diff --git a/Build/source/libs/graphite/src/segment/Makefile.am b/Build/source/libs/graphite/src/segment/Makefile.am
new file mode 100644
index 00000000000..59113aa924b
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/Makefile.am
@@ -0,0 +1,26 @@
+segmentdir = $(top_srcdir)/src/segment
+
+libgraphite_la_SOURCES += $(segmentdir)/FileInput.cpp
+libgraphite_la_SOURCES += $(segmentdir)/FontCache.cpp
+libgraphite_la_SOURCES += $(segmentdir)/FontFace.cpp
+libgraphite_la_SOURCES += $(segmentdir)/GrCharStream.cpp
+libgraphite_la_SOURCES += $(segmentdir)/GrClassTable.cpp
+libgraphite_la_SOURCES += $(segmentdir)/GrEngine.cpp
+libgraphite_la_SOURCES += $(segmentdir)/GrFeature.cpp
+libgraphite_la_SOURCES += $(segmentdir)/GrFSM.cpp
+libgraphite_la_SOURCES += $(segmentdir)/GrGlyphTable.cpp
+libgraphite_la_SOURCES += $(segmentdir)/GrPassActionCode.cpp
+libgraphite_la_SOURCES += $(segmentdir)/GrPass.cpp
+libgraphite_la_SOURCES += $(segmentdir)/GrSlotState.cpp
+libgraphite_la_SOURCES += $(segmentdir)/GrSlotStream.cpp
+libgraphite_la_SOURCES += $(segmentdir)/GrTableManager.cpp
+libgraphite_la_SOURCES += $(segmentdir)/MemoryUsage.cpp
+libgraphite_la_SOURCES += $(segmentdir)/Platform.cpp
+libgraphite_la_SOURCES += $(segmentdir)/SegmentAux.cpp
+libgraphite_la_SOURCES += $(segmentdir)/Segment.cpp
+libgraphite_la_SOURCES += $(segmentdir)/TestFSM.cpp
+libgraphite_la_SOURCES += $(segmentdir)/TestPasses.cpp
+libgraphite_la_SOURCES += $(segmentdir)/TransductionLog.cpp
+
+EXTRA_DIST += $(segmentdir)/*.h
+
diff --git a/Build/source/libs/graphite/src/segment/MemoryUsage.cpp b/Build/source/libs/graphite/src/segment/MemoryUsage.cpp
new file mode 100644
index 00000000000..1fb3fc25282
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/MemoryUsage.cpp
@@ -0,0 +1,781 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: MemoryUsage.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Calculates memory usage for the engine and segments.
+----------------------------------------------------------------------------------------------*/
+
+#pragma warning(disable: 4244) // conversion from wchar_t to char
+#pragma warning(disable: 4702) // unreachable code
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+
+#include "GrCommon.h"
+#include "GrData.h"
+#ifndef _WIN32
+#include "GrMstypes.h"
+#endif
+#include "GrDebug.h"
+//#include <fstream>
+#include <iostream>
+#include <cstring>
+//#include <string>
+// Forward declarations.
+
+#include "Main.h"
+
+//namespace gr
+//{
+// class GrTableManager;
+// class Segment;
+// class GrEngine;
+//}
+//
+//#include "GrTableManager.h"
+//#include "GrFeatureValues.h"
+//#include "GrSlotState.h"
+//#include "SegmentAux.h"
+//#include "Segment.h"
+#include "MemoryUsage.h"
+
+//#ifndef _MSC_VER
+//#include "config.h"
+//#endif
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:End Ignore
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+const int stringOverhead = (3 * sizeof(int)) + (sizeof(void *)) + (8 * sizeof(short));
+const int vectorOverhead = 3 * sizeof(void *);
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Font/engine
+//:>********************************************************************************************
+
+void FontMemoryUsage::initialize()
+{
+ font = 0;
+ fontCache = 0;
+ fontFace = 0;
+
+ eng_count = 0;
+ eng_overhead = 0;
+ eng_scalars = 0;
+ eng_strings = 0;
+ eng_pointers = 0;
+ eng_cmap = 0;
+ eng_nameTable = 0;
+
+ pseudoMap = 0;
+
+ clstbl_counters = 0;
+ clstbl_offsets = 0;
+ clstbl_glyphList = 0;
+
+ glftbl_general = 0;
+ glftbl_compDefns = 0;
+ glftbl_attrTable = 0;
+ glftbl_attrOffsets = 0;
+
+ lngtbl_general = 0;
+ lngtbl_entries = 0;
+ lngtbl_featureSets = 0;
+
+ tman_general = 0;
+
+ pass_count = 0;
+ pass_general = 0;
+ pass_fsm = 0;
+ pass_ruleExtras = 0;
+ pass_constraintOffsets = 0;
+ pass_constraintCode = 0;
+ pass_actionOffsets = 0;
+ pass_actionCode = 0;
+
+ engst_general = 0;
+ engst_passState = 0;
+
+ sstrm_count = 0;
+ sstrm_general = 0;
+ sstrm_chunkMapsUsed = 0;
+ sstrm_chunkMapsAlloc = 0;
+ sstrm_reprocBuf = 0;
+
+ slot_count = 0;
+ slot_general = 0;
+ slot_abstract = 0;
+ slot_varLenBuf = 0;
+ slot_assocsUsed = 0;
+ slot_assocsAlloc = 0;
+ slot_attachUsed = 0;
+ slot_attachAlloc = 0;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the total byte count.
+----------------------------------------------------------------------------------------------*/
+int FontMemoryUsage::total()
+{
+ int grandTotal = 0;
+ grandTotal += font + fontCache + fontFace;
+ grandTotal += eng_overhead + eng_scalars + eng_strings + eng_pointers + eng_cmap + eng_nameTable;
+ grandTotal += pseudoMap;
+ grandTotal += clstbl_counters + clstbl_offsets + clstbl_glyphList;
+ grandTotal += glftbl_general + glftbl_compDefns + glftbl_attrTable + glftbl_attrOffsets;
+ grandTotal += lngtbl_general + lngtbl_entries + lngtbl_featureSets;
+ grandTotal += tman_general;
+ grandTotal += pass_general + pass_fsm + pass_ruleExtras
+ + pass_constraintOffsets + pass_constraintCode + pass_actionOffsets + pass_actionCode;
+ grandTotal += engst_general + engst_passState;
+ grandTotal += sstrm_general + sstrm_chunkMapsAlloc + sstrm_reprocBuf;
+ grandTotal += slot_general + slot_abstract + slot_varLenBuf + slot_assocsAlloc + slot_attachAlloc;
+
+ return grandTotal;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Add the results of two runs together.
+----------------------------------------------------------------------------------------------*/
+void FontMemoryUsage::add(FontMemoryUsage & fmu)
+{
+ font += fmu.font;
+ fontCache += fmu.fontCache;
+ fontFace += fmu.fontFace;
+
+ eng_count += fmu.eng_count;
+ eng_overhead += fmu.eng_overhead;
+ eng_scalars += fmu.eng_scalars;
+ eng_strings += fmu.eng_strings;
+ eng_pointers += fmu.eng_pointers;
+ eng_cmap += fmu.eng_cmap;
+ eng_nameTable += fmu.eng_nameTable;
+
+ pseudoMap += fmu.pseudoMap;
+
+ clstbl_counters += fmu.clstbl_counters;
+ clstbl_offsets += fmu.clstbl_offsets;
+ clstbl_glyphList += fmu.clstbl_glyphList;
+
+ glftbl_general += fmu.glftbl_general;
+ glftbl_compDefns += fmu.glftbl_compDefns;
+ glftbl_attrTable += fmu.glftbl_attrTable;
+ glftbl_attrOffsets += fmu.glftbl_attrOffsets;
+
+ lngtbl_general += fmu.lngtbl_general;
+ lngtbl_entries += fmu.lngtbl_entries;
+ lngtbl_featureSets += fmu.lngtbl_featureSets;
+
+ tman_general += fmu.tman_general;
+
+ pass_count += fmu.pass_count;
+ pass_general += fmu.pass_general;
+ pass_fsm += fmu.pass_fsm;
+ pass_ruleExtras += fmu.pass_ruleExtras;
+ pass_constraintOffsets += fmu.pass_constraintOffsets;
+ pass_constraintCode += fmu.pass_constraintCode;
+ pass_actionOffsets += fmu.pass_actionOffsets;
+ pass_actionCode += fmu.pass_actionCode;
+
+ engst_general += fmu.engst_general;
+ engst_passState += fmu.engst_passState;
+
+ sstrm_count += fmu.sstrm_count;
+ sstrm_general += fmu.sstrm_general;
+ sstrm_chunkMapsUsed += fmu.sstrm_chunkMapsUsed;
+ sstrm_chunkMapsAlloc += fmu.sstrm_chunkMapsAlloc;
+ sstrm_reprocBuf += fmu.sstrm_reprocBuf;
+
+ slot_count += fmu.slot_count;
+ slot_general += fmu.slot_general;
+ slot_abstract += fmu.slot_abstract;
+ slot_varLenBuf += fmu.slot_varLenBuf;
+ slot_assocsUsed += fmu.slot_assocsUsed;
+ slot_assocsAlloc += fmu.slot_assocsAlloc;
+ slot_attachUsed += fmu.slot_attachUsed;
+ slot_attachAlloc += fmu.slot_attachAlloc;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Add up the memory used by all the engines in the cache.
+----------------------------------------------------------------------------------------------*/
+FontMemoryUsage Font::calculateMemoryUsage()
+{
+ FontMemoryUsage fmu;
+ FontFace::calculateAllMemoryUsage(fmu);
+ return fmu;
+}
+
+void FontFace::calculateAllMemoryUsage(FontMemoryUsage & fmu)
+{
+ s_pFontCache->calculateMemoryUsage(fmu);
+}
+
+void FontCache::calculateMemoryUsage(FontMemoryUsage & fmuTotal)
+{
+ fmuTotal.fontCache += sizeof(int) * 4; // m_cfci, m_cfciMax, m_cfface, m_flush
+ fmuTotal.fontCache += sizeof(void*); // m_prgfci;
+
+ // Iterate through all the font faces in the cache.
+ for (int ifci = 0; ifci < m_cfci; ifci++)
+ {
+ CacheItem * pfci = m_prgfci + ifci;
+ char rgchFontName[32];
+ memset(rgchFontName, 0, 32 * sizeof(char));
+ std::copy(pfci->szFaceName, pfci->szFaceName + 32, rgchFontName);
+ std::string strFontName(rgchFontName);
+ fmuTotal.vstrFontNames.push_back(strFontName);
+ int cface = 0;
+ if (pfci->pffaceRegular)
+ {
+ FontMemoryUsage fmu;
+ pfci->pffaceRegular->calculateMemoryUsage(fmu);
+ fmuTotal.add(fmu);
+ fmuTotal.vFontTotalsReg.push_back(fmu.total());
+ cface++;
+ }
+ else
+ fmuTotal.vFontTotalsReg.push_back(0);
+
+ if (pfci->pffaceBold)
+ {
+ FontMemoryUsage fmu;
+ pfci->pffaceBold->calculateMemoryUsage(fmu);
+ fmuTotal.add(fmu);
+ fmuTotal.vFontTotalsBold.push_back(fmu.total());
+ cface++;
+ }
+ else
+ fmuTotal.vFontTotalsBold.push_back(0);
+
+ if (pfci->pffaceItalic)
+ {
+ FontMemoryUsage fmu;
+ pfci->pffaceItalic->calculateMemoryUsage(fmu);
+ fmuTotal.add(fmu);
+ fmuTotal.vFontTotalsItalic.push_back(fmu.total());
+ cface++;
+ }
+ else
+ fmuTotal.vFontTotalsItalic.push_back(0);
+
+ if (pfci->pffaceBI)
+ {
+ FontMemoryUsage fmu;
+ pfci->pffaceBI->calculateMemoryUsage(fmu);
+ fmuTotal.add(fmu);
+ fmuTotal.vFontTotalsBI.push_back(fmu.total());
+ cface++;
+ }
+ else
+ fmuTotal.vFontTotalsBI.push_back(0);
+
+ fmuTotal.vFaceCount.push_back(cface);
+ }
+}
+
+void FontFace::calculateMemoryUsage(FontMemoryUsage & fmu)
+{
+ fmu.fontFace += sizeof(int); // m_cfonts
+ fmu.fontFace += sizeof(void *) * 2; // s_pFontCache, m_pgreng
+
+ fmu.font += m_cfonts * sizeof(void*); // m_pfface
+
+ fmu.addEngine(m_pgreng);
+}
+
+void FontMemoryUsage::addEngine(GrEngine * pgreng)
+{
+ eng_count++;
+
+ eng_overhead += sizeof(long); // m_cref
+ eng_scalars += sizeof(bool) * 6; // m_fBold, m_fItalic, m_fSmart...
+ eng_scalars += sizeof(bool) * 2; // m_fFakeItalicCache, m_fFakeBICache;
+ eng_strings += stringOverhead * 4; // m_strCtrlFileReg/Bold/Italic/BI
+ eng_strings += sizeof(wchar_t) * pgreng->m_strCtrlFileReg.length();
+ eng_strings += sizeof(wchar_t) * pgreng->m_strCtrlFileBold.length();
+ eng_strings += sizeof(wchar_t) * pgreng->m_strCtrlFileItalic.length();
+ eng_strings += sizeof(wchar_t) * pgreng->m_strCtrlFileBI.length();
+ eng_scalars += sizeof(bool);
+ eng_strings += stringOverhead * 6; // m_stuCtrlFile etc.
+ eng_strings += sizeof(wchar_t) * pgreng->m_stuCtrlFile.length();
+ eng_strings += sizeof(wchar_t) * pgreng->m_stuInitError.length();
+ eng_strings += sizeof(wchar_t) * pgreng->m_stuFaceName.length();
+ eng_strings += sizeof(wchar_t) * pgreng->m_stuFeatures.length();
+ eng_strings += sizeof(wchar_t) * pgreng->m_stuBaseFaceName.length();
+ eng_scalars += sizeof(bool); // m_fUseSepBase
+ eng_scalars += sizeof(GrResult) * 2; // m_resFontRead, m_resFontValid
+ eng_scalars += sizeof(FontErrorCode);
+ eng_scalars += sizeof(int) * 3; // m_fxdBadVersion, m_nFontCheckSum, m_nScriptTag, m_grfsdc
+ eng_scalars += sizeof(bool); // m_fRightToLeft
+ eng_scalars += sizeof(int) * 2; // m_mXAscent, m_mXDescent
+ eng_scalars += sizeof(float); // m_dysOffset
+ eng_scalars += sizeof(bool); // m_fBasicJust
+ eng_scalars += sizeof(int); // m_cJLevels
+ eng_pointers += sizeof(void*) * 4; // m_ptman, m_pctbl, m_pgtbl, m_pfface
+ eng_scalars += sizeof(GrFeature) * kMaxFeatures;
+ eng_scalars += sizeof(int); // m_cfeat
+ eng_scalars += sizeof(size_t); // m_clcidFeatLabelLangs
+ eng_scalars += sizeof(short) * pgreng->m_clcidFeatLabelLangs;
+ // m_langtbl
+ eng_scalars += sizeof(bool); // m_fLineBreak
+ eng_scalars += sizeof(int) * 2; // m_cchwPreXlbContext, m_cchwPostXlbContext
+ eng_scalars += sizeof(data16) * 7; // m_chwPseudoAttr, etc.
+ eng_scalars += sizeof(gid16); // m_chwLBGlyphID
+ eng_scalars += sizeof(int) * 4; // m_cComponents, m_cnUserDefn, m_cnCompPerLig, m_mFontEmUnits
+
+ pseudoMap += sizeof(int) * 3;
+ pseudoMap += sizeof(GrPseudoMap) * pgreng->m_cpsd;
+
+ eng_cmap += sizeof(void*) * 2;
+ eng_cmap += sizeof(byte*);
+ eng_cmap += sizeof(bool);
+ if (pgreng->m_fCmapTblCopy)
+ eng_cmap += pgreng->m_cbCmapTbl;
+
+ eng_nameTable += sizeof(byte *);
+ eng_nameTable += sizeof(bool);
+ if (pgreng->m_fNameTblCopy)
+ eng_nameTable += pgreng->m_cbNameTbl;
+
+ eng_scalars += sizeof(bool) * 2; // m_fLogXductn, m_fInErrorState
+
+ clstbl_counters += sizeof(int) * 2; // m_ccls, m_cclsLinear
+ clstbl_offsets += sizeof(data16) * (pgreng->m_pctbl->m_ccls + 1);
+ clstbl_glyphList += sizeof(data16) * (pgreng->m_pctbl->m_prgichwOffsets[pgreng->m_pctbl->m_ccls]);
+
+ glftbl_general += sizeof(int) * 3; // m_cglf, m_cComponents, m_cgstbl
+ glftbl_general += vectorOverhead; // m_vpgstbl
+ GrGlyphSubTable * pgstbl = pgreng->m_pgtbl->m_vpgstbl[0];
+ glftbl_general += sizeof(int) * 4; // m_fxdSilfVersion, m_nAttrIDLim, m_cComponents, m_cnCompPerLig
+ glftbl_general += sizeof(bool) * 2; // m_fHasDebugStrings, m_fGlocShort
+ glftbl_general += sizeof(data16) * 3; // m_chw...Attr
+ glftbl_compDefns += sizeof(int) * (pgstbl->m_cnCompPerLig + 1) * pgreng->m_pgtbl->m_cglf;
+ glftbl_attrTable += sizeof(int) * 2; // m_fxdSilfVersion, m_cbEntryBufLen
+ glftbl_attrTable += sizeof(byte) * pgstbl->m_pgatbl->m_cbEntryBufLen;
+ glftbl_attrOffsets +=
+ (pgreng->m_pgtbl->m_cglf + 1) * ((pgstbl->m_fGlocShort) ? sizeof(data16) : sizeof(data32));
+
+ lngtbl_general += sizeof(size_t); // m_clang
+ lngtbl_general += sizeof(data16) * 3; // m_dilangInit, m_cLoop, m_ilangStart
+ lngtbl_general += sizeof(void*) * 2; // m_prglang, m_prgfset
+ lngtbl_general += sizeof(int); // m_cbOffset0
+ lngtbl_entries += sizeof(GrLangTable::LangEntry) * pgreng->m_langtbl.m_clang;
+ lngtbl_featureSets += sizeof(GrLangTable::FeatSet) * pgreng->m_langtbl.m_cfset;
+
+ GrTableManager * ptman = pgreng->m_ptman;
+ tman_general += sizeof(int) * 4; // m_cpass, m_cpassLB, m_ipassPos1, m_ipassJust1
+ tman_general += sizeof(bool); // m_fBidi
+ tman_general += sizeof(void*) * 2; // m_prgppass, m_pgreng
+ tman_general += sizeof(void*) * ptman->m_cpass; // m_prgppass
+ tman_general += sizeof(bool); // m_fLogging
+
+ pass_count += ptman->m_cpass;
+ for (int ipass = 0; ipass < ptman->m_cpass; ipass++)
+ {
+ GrPass * ppass = ptman->m_prgppass[ipass];
+ pass_general = sizeof(GrPass);
+
+ GrFSM * pfsm = ppass->m_pfsm;
+ if (pfsm)
+ {
+ pass_fsm += sizeof(int) * 5; // m_crow, m_crowFinal, m_rowFinalMin, m_crowNonAcpt, m_ccol
+ pass_fsm += sizeof(void*) * 3; // m_prgirulnMin, m_prgrulnMatched, m_prgrowTransitions
+ int crowSuccess = pfsm->m_crow - pfsm->m_crowNonAcpt;
+ pass_fsm += sizeof(data16) * (crowSuccess + 1); // m_prgirulnMin
+ pass_fsm += sizeof(data16) * (pfsm->m_crulnMatched); // m_prgrulnMatched
+ pass_fsm += sizeof(short) * ((pfsm->m_crow - pfsm->m_crowFinal) * pfsm->m_ccol);
+ pass_fsm += sizeof(data16); // m_dimcrInit, m_cLoop, m_imcrStart
+ pass_fsm += sizeof(int); // m_cmcr
+ pass_fsm += sizeof(void*); // m_prgmcr
+ pass_fsm += sizeof(GrFSMClassRange) * pfsm->m_cmcr;
+ pass_fsm += sizeof(int) * 2; // m_critMinRulePreContext, m_critMaxRulePreContext
+ pass_fsm += sizeof(void*); // m_prgrowStartStates
+ pass_fsm += sizeof(short) * (pfsm->m_critMaxRulePreContext - pfsm->m_critMinRulePreContext + 1);
+ }
+
+ pass_ruleExtras = sizeof(data16) * ppass->m_crul; // m_prgchwRuleSortKeys
+ pass_ruleExtras = sizeof(byte*) * ppass->m_crul; // m_prgcritRulePreModContext
+
+ pass_constraintOffsets += sizeof(data16) * (ppass->m_crul + 1);
+ pass_actionOffsets =+ sizeof(data16) * (ppass->m_crul + 1);
+
+ pass_constraintCode += sizeof(byte) * ppass->m_cbConstraints;
+ pass_actionCode += sizeof(byte) * ppass->m_cbActions;
+
+ pass_general += sizeof(bool) * ppass->m_crul; // m_prgfRuleOkay
+ pass_general += vectorOverhead; // m_vnStack
+ pass_general += sizeof(int) * ppass->m_vnStack.capacity();
+ }
+
+ engst_general += sizeof(EngineState);
+ engst_general += sizeof(void *) * ptman->m_engst.m_vslotblk.capacity();
+ engst_general += sizeof(void *) * ptman->m_engst.m_vprgnSlotVarLenBufs.capacity();
+ engst_general += sizeof(void *) * ptman->m_engst.m_cpass; // m_prgpsstrm
+
+ engst_passState += sizeof(PassState) * ptman->m_engst.m_cpass;
+
+ for (int isstrm = 0; isstrm < ptman->m_engst.m_cpass; isstrm++)
+ {
+ sstrm_count++;
+ GrSlotStream * psstrm = ptman->m_engst.m_prgpsstrm[isstrm];
+ sstrm_general += sizeof(GrSlotStream);
+ sstrm_chunkMapsUsed += psstrm->m_vislotPrevChunkMap.size();
+ sstrm_chunkMapsUsed += psstrm->m_vislotPrevChunkMap.size();
+ sstrm_chunkMapsAlloc += psstrm->m_vislotPrevChunkMap.capacity();
+ sstrm_chunkMapsAlloc += psstrm->m_vislotNextChunkMap.capacity();
+ sstrm_reprocBuf += psstrm->m_vpslotReproc.capacity();
+ sstrm_reprocBuf += sizeof(int) * 2;
+ sstrm_general -= sizeof(int) * 2;
+ }
+
+ slot_general += ptman->m_engst.m_vslotblk.size() * EngineState::kSlotBlockSize
+ * (sizeof(GrSlotState) - sizeof(GrSlotAbstract));
+ slot_abstract += ptman->m_engst.m_vslotblk.size() * EngineState::kSlotBlockSize
+ * sizeof(GrSlotAbstract);
+ int cnExtraPerSlot = ptman->m_engst.m_cUserDefn + (ptman->m_engst.m_cCompPerLig * 2)
+ + ptman->m_engst.m_cFeat;
+ slot_varLenBuf += EngineState::kSlotBlockSize * cnExtraPerSlot * sizeof(u_intslot);
+ for (size_t islotblk = 0; islotblk < ptman->m_engst.m_vslotblk.size(); islotblk++)
+ {
+ for (int islot = 0; islot < EngineState::kSlotBlockSize; islot++)
+ {
+ slot_count++;
+ GrSlotState * pslot = ptman->m_engst.m_vslotblk[islotblk] + islot;
+ slot_assocsUsed += pslot->m_vpslotAssoc.size();
+ slot_assocsAlloc += pslot->m_vpslotAssoc.capacity();
+ slot_attachUsed += pslot->m_vdislotAttLeaves.size();
+ slot_attachAlloc += pslot->m_vdislotAttLeaves.capacity();
+ }
+ }
+
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write out the memory usage onto a stream.
+----------------------------------------------------------------------------------------------*/
+void FontMemoryUsage::prettyPrint(std::ostream & strm)
+{
+ int totalBytes = total();
+
+ strm << "Number of engines: " << eng_count << "\n";
+ strm << "Number of passes: " << pass_count << "\n\n";
+
+ strm << "Number of slot streams: " << sstrm_count << "\n";
+ strm << "Number of slots: " << slot_count << "\n\n";
+
+ int classTableTotal = clstbl_counters + clstbl_offsets + clstbl_glyphList;
+ int glyphTableTotal = glftbl_general + glftbl_compDefns + glftbl_attrTable + glftbl_attrOffsets;
+ int langTableTotal = lngtbl_general + lngtbl_entries + lngtbl_featureSets;
+ int passTotal = pass_general + pass_fsm + pass_ruleExtras + pass_constraintOffsets + pass_constraintCode
+ + pass_actionOffsets + pass_actionCode;
+ int engineTotal = eng_overhead + eng_scalars + eng_strings + eng_pointers + eng_cmap + eng_nameTable
+ + pseudoMap + classTableTotal + glyphTableTotal + langTableTotal + tman_general
+ + passTotal;
+
+ strm << "BYTE COUNT TOTALS\n";
+ strm << "Font: " << font << "\n";
+ strm << "Font cache: " << fontCache << "\n";
+ strm << "Font face: " << fontFace << "\n";
+ strm << "Engine " << engineTotal << "\n";
+ strm << " Overhead: " << eng_overhead << "\n";
+ strm << " Scalars: " << eng_scalars << "\n";
+ strm << " Strings: " << eng_strings << "\n";
+ strm << " Pointers: " << eng_pointers << "\n";
+ strm << " Cmap table: " << eng_cmap << "\n";
+ strm << " Name table: " << eng_nameTable << "\n";
+ strm << " Pseudo map: " << pseudoMap << "\n";
+ strm << " Class table: " << classTableTotal << "\n";
+ strm << " Counters: " << clstbl_counters << "\n";
+ strm << " Offsets: " << clstbl_offsets << "\n";
+ strm << " Glyph list: " << clstbl_glyphList << "\n";
+ strm << " Glyph table: " << glyphTableTotal << "\n";
+ strm << " General: " << glftbl_general << "\n";
+ strm << " Component defns: " << glftbl_compDefns << "\n";
+ strm << " Attr table: " << glftbl_attrTable << "\n";
+ strm << " Attr offsets: " << glftbl_attrOffsets << "\n";
+ strm << " Language table: " << langTableTotal << "\n";
+ strm << " General: " << lngtbl_general << "\n";
+ strm << " Entries: " << lngtbl_entries << "\n";
+ strm << " Feature sets: " << lngtbl_featureSets << "\n";
+ strm << " Table manager: " << tman_general << "\n";
+ strm << " Passes: " << passTotal << "\n";
+ strm << " General: " << pass_general << "\n";
+ strm << " FSM: " << pass_fsm << "\n";
+ strm << " Rule extras: " << pass_ruleExtras << "\n";
+ strm << " Constraint offsets: " << pass_constraintOffsets << "\n\n";
+ strm << " Constraint code: " << pass_constraintCode << "\n";
+ strm << " Action offsets: " << pass_actionOffsets << "\n";
+ strm << " Action code: " << pass_actionCode << "\n\n";
+
+ int slotTotal = slot_general + slot_abstract + slot_varLenBuf + slot_assocsAlloc + slot_attachAlloc;
+ int streamTotal = sstrm_general + sstrm_chunkMapsAlloc + sstrm_reprocBuf + slotTotal;
+ int engineStateTotal = engst_general + engst_passState + streamTotal;
+
+ strm << " Engine State: " << engineStateTotal << "\n";
+ strm << " General: " << engst_general << "\n";
+ strm << " Pass states: " << engst_passState << "\n";
+ strm << " Slot streams: " << streamTotal << "\n";
+ strm << " General: " << sstrm_general << "\n";
+ strm << " Chunk maps: " << sstrm_chunkMapsAlloc << " (" << sstrm_chunkMapsUsed << " used)\n";
+ strm << " Reprocess buffer: " << sstrm_reprocBuf << "\n";
+ strm << " Slots: " << slotTotal << "\n";
+ strm << " General: " << slot_general << "\n";
+ strm << " Abstract: " << slot_abstract << "\n";
+ strm << " Var-length buf: " << slot_varLenBuf << "\n";
+ strm << " Associations: " << slot_assocsAlloc << " (" << slot_assocsUsed << " used)\n";
+ strm << " Attachments: " << slot_attachAlloc << " (" << slot_attachUsed << " used)\n\n";
+
+ strm << "Total bytes used: " << totalBytes << "\n\n";
+
+ strm << "TOTALS PER FONT\n";
+ for (size_t ifont = 0; ifont < vstrFontNames.size(); ifont++)
+ {
+ strm << vstrFontNames[ifont].c_str() << "\n";
+ strm << " Regular: " << vFontTotalsReg[ifont] << "\n";
+ strm << " Bold: " << vFontTotalsBold[ifont] << "\n";
+ strm << " Italic: " << vFontTotalsItalic[ifont] << "\n";
+ strm << " Bold-italic: " << vFontTotalsBI[ifont] << "\n\n";
+ }
+}
+
+
+//:>********************************************************************************************
+//:> Segment
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Initialize the data structure.
+----------------------------------------------------------------------------------------------*/
+void SegmentMemoryUsage::initialize()
+{
+ seg_count = 0;
+ overhead = 0;
+ pointers = 0;
+ scalars = 0;
+ strings = 0;
+ metrics = 0;
+ associations = 0;
+ init = 0;
+ obsolete = 0;
+
+ slot_count = 0;
+ slot_abstract = 0;
+ slot_varLenBuf = 0;
+ slot_scalars = 0;
+ slot_clusterMembers = 0;
+
+ glyphInfo_count = 0;
+ glyphInfo = 0;
+
+ wastedVector = 0;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Add the memory for the segemtn to the SegmentMemoryUsage data structure.
+----------------------------------------------------------------------------------------------*/
+void Segment::calculateMemoryUsage(SegmentMemoryUsage & smu)
+{
+ smu.addSegment(*this);
+}
+
+
+void SegmentMemoryUsage::addSegment(Segment & seg)
+{
+ seg_count++;
+
+ overhead += sizeof(long); // m_cref
+ pointers += sizeof(void*); // m_pgts
+ scalars += sizeof(int); // m_dichwLim
+ scalars += sizeof(int); // m_ichwMin
+ pointers += sizeof(void*); // m_pfont
+ pointers += sizeof(void*); // m_preneng
+ scalars += sizeof(bool); // m_fErroneous
+ pointers += sizeof(void*); // m_pgjus
+ scalars += sizeof(LayoutEnvironment);
+ scalars += sizeof(bool); // m_fWsRtl
+ scalars += sizeof(bool); // m_fParaRtl
+ scalars += sizeof(TrWsHandling);
+ scalars += sizeof(int); // m_nDirDepth
+ init += sizeof(byte*); // m_prgbNextSegDat
+ init += sizeof(int); // m_cbNextSegDat
+ init += sizeof(byte) * seg.m_cbNextSegDat;
+ init += sizeof(byte*); // m_prgInitDat
+ init += sizeof(int); // m_cbInitDat
+ init += sizeof(byte) * seg.m_cbInitDat;
+ init += sizeof(int); // m_dichPreContext
+// obsolete += sizeof(void *); // m_psegPrev
+// obsolete += sizeof(void *); // m_psegNext
+// strings += stringOverhead * 2;
+// strings += sizeof(wchar_t) * seg.m_stuFaceName.length();
+// strings += sizeof(wchar_t) * seg.m_stuBaseFaceName.length();
+// scalars += sizeof(bool); // m_fUseSepBase;
+// scalars += sizeof(float); // m_pixHeight
+// scalars += sizeof(bool); // m_fBold
+// scalars += sizeof(bool); // m_fItalic
+ scalars += sizeof(LineBrk); // m_lbStart
+ scalars += sizeof(LineBrk); // m_lbEnd
+ scalars += sizeof(bool); // m_fStartLine
+ scalars += sizeof(bool); // m_fEndLine
+ scalars += sizeof(SegEnd); // m_est
+ metrics += sizeof(int); // m_mFontEmUnits
+ metrics += sizeof(float) * 17; // was 19, removed m_x/ysDPI
+ associations += sizeof(int); // m_ichwAssocsMin
+ associations += sizeof(int); // m_ichwAssocsLim
+ int dichw = seg.m_ichwAssocsLim - seg.m_ichwAssocsMin;
+ associations += sizeof(int*); // m_prgisloutBefore
+ associations += sizeof(int) * dichw;
+ associations += sizeof(int*); // m_prgisloutAfter
+ associations += sizeof(int) * dichw;
+ associations += sizeof(void*); // m_prgpvisloutAssocs
+ associations += sizeof(void*) * dichw;
+ for (int idichw = 0; idichw < dichw; idichw++)
+ {
+ std::vector<int> * pvisloutAssocs = seg.m_prgpvisloutAssocs[idichw];
+ if (pvisloutAssocs)
+ {
+ associations += vectorOverhead;
+ associations += sizeof(int) * pvisloutAssocs->capacity();
+ wastedVector += sizeof(int) * (pvisloutAssocs->capacity() - pvisloutAssocs->size());
+ }
+ }
+ associations += sizeof(int*); // m_prgisloutLigature
+ associations += sizeof(int) * dichw;
+ associations += sizeof(sdata8*); // m_prgiComponent
+ associations += sizeof(sdata8) * dichw;
+// obsolete += sizeof(void*); // m_psstrm
+ scalars += sizeof(int); // m_cslout
+ slot_count += seg.m_cslout;
+ for (int islout = 0; islout < seg.m_cslout; islout++)
+ {
+ GrSlotOutput * pslout = seg.m_prgslout + islout;
+ slot_abstract += sizeof(gid16) * 2; // m_chwGlyphID, m_chwActual
+ slot_abstract += sizeof(sdata8) * 4; // m_spsl, m_dirc, m_lb, m_nDirLevel
+// slot_abstract += sizeof(float) * 8; // font/glyph metrics
+ slot_abstract += sizeof(short) * 5; // slot attributes - was 21
+ slot_abstract += sizeof(int); // m_mJWidth0;
+ slot_abstract += sizeof(byte); // m_nJWeight0;
+ slot_abstract += sizeof(bool); // m_fInsertBefore
+ slot_abstract += sizeof(sdata8); // m_bIsSpace
+ slot_abstract += sizeof(byte); // m_cnCompPerLig
+ slot_abstract += sizeof(void*); // m_prgnVarLenBuf
+ slot_varLenBuf += pslout->CExtraSpaceSlout() * sizeof(u_intslot);
+ slot_abstract += sizeof(float); // m_xsPositionX, m_ysPositionY
+// slot_abstract += sizeof(bool); // m_fAdvXSet, m_fAdvYSet
+ slot_scalars += sizeof(int) * 2; // m_ichwBefore/AfterAssoc
+ slot_scalars += sizeof(sdata8); // m_cComponents
+ slot_scalars += sizeof(int); // m_isloutClusterBase
+ slot_scalars += sizeof(sdata8); // m_disloutCluster
+ slot_scalars += sizeof(float) * 3; // m_xsClusterXOffset, m_xsClusterAdvance, m_xsAdvanceX
+ slot_scalars += sizeof(int); // m_igbb
+// slot_scalars += sizeof(Rect); // m_rectBB
+ }
+ scalars += sizeof(int); // m_cnUserDefn
+ scalars += sizeof(int); // m_cnCompPerLig
+ scalars += sizeof(int); // m_cnFeat
+ glyphInfo_count += seg.m_cginf;
+ scalars += sizeof(int); // m_cginf;
+ scalars += sizeof(int); // m_isloutGinf0
+ for (int iginf = 0; iginf < seg.m_cginf; iginf++)
+ {
+ ///GlyphInfo * pginf = seg.m_prgginf + iginf;
+ glyphInfo += sizeof(void *); // m_pseg
+ glyphInfo += sizeof(void *); // m_pslout
+ glyphInfo += sizeof(int); // m_islout
+ }
+ init += sizeof(int); // m_cslotRestartBackup
+ init += vectorOverhead;
+ init += sizeof(sdata8) * seg.m_vnSkipOffsets.capacity();
+ wastedVector += sizeof(sdata8) * (seg.m_vnSkipOffsets.capacity() - seg.m_vnSkipOffsets.size());
+ init += sizeof(DirCode); // m_dircPrevStrong
+ init += sizeof(DirCode); // m_dircPrevTerm
+
+ //int grandTotal;
+ //grandTotal = overhead + pointers + scalars + strings + metrics + associations
+ // + init + obsolete + slot_count + slot_abstract + slot_varLenBuf + slot_scalars
+ // + slot_clusterMembers + glyphInfo_count + glyphInfo;
+
+ //int totalPerSeg = grandTotal / seg_count;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write out the memory usage onto a stream.
+----------------------------------------------------------------------------------------------*/
+void SegmentMemoryUsage::prettyPrint(std::ostream & strm)
+{
+ int totalBytes = overhead + pointers + scalars + strings + metrics + associations
+ + init + obsolete + slot_count + slot_abstract + slot_varLenBuf + slot_scalars
+ + slot_clusterMembers + glyphInfo_count + glyphInfo;
+
+ int slotTotal = slot_abstract + slot_varLenBuf + slot_scalars + slot_clusterMembers;
+
+ strm << "Number of segments: " << seg_count << "\n\n";
+
+ strm << "TOTALS\n";
+ strm << "Overhead: " << overhead << "\n";
+ strm << "Pointers: " << pointers << "\n";
+ strm << "Scalars: " << scalars << "\n";
+ strm << "Strings: " << strings << "\n";
+ strm << "Metrics: " << metrics << "\n";
+ strm << "Associations: " << associations << "\n";
+ strm << "Obsolete: " << obsolete << "\n";
+ strm << "Slot data: " << slotTotal << "\n";
+ strm << " Abstract: " << slot_abstract << "\n";
+ strm << " Var-length buffer: " << slot_varLenBuf << "\n";
+ strm << " Scalars: " << slot_scalars << "\n";
+ strm << " Cluster members: " << slot_clusterMembers << "\n";
+ strm << "Glyph info: " << glyphInfo << "\n\n";
+
+ strm << "Wasted in vectors: " << wastedVector << "\n\n";
+
+ strm << "Total bytes used: " << totalBytes << "\n\n";
+
+ if (seg_count > 0)
+ {
+ strm << "AVERAGES\n";
+ strm << "Overhead: " << overhead/seg_count << "\n";
+ strm << "Pointers: " << pointers/seg_count << "\n";
+ strm << "Scalars: " << scalars/seg_count << "\n";
+ strm << "Strings: " << strings/seg_count << "\n";
+ strm << "Metrics: " << metrics/seg_count << "\n";
+ strm << "Associations: " << associations/seg_count << "\n";
+ strm << "Obsolete: " << obsolete/seg_count << "\n";
+ strm << "Slot data: " << slotTotal/seg_count << "\n";
+ strm << " Abstract: " << slot_abstract/seg_count << "\n";
+ strm << " Var-length buffer: " << slot_varLenBuf/seg_count << "\n";
+ strm << " Scalars: " << slot_scalars/seg_count << "\n";
+ strm << " Cluster members: " << slot_clusterMembers/seg_count << "\n";
+ strm << "Glyph info: " << glyphInfo/seg_count << "\n\n";
+
+ strm << "Avg. bytes per segment: " << totalBytes / seg_count << "\n\n";
+
+ strm << "Avg. # of slots per segment: " << slot_count / seg_count << "\n\n";
+ }
+}
+
+} //namespace gr
+
diff --git a/Build/source/libs/graphite/src/segment/Platform.cpp b/Build/source/libs/graphite/src/segment/Platform.cpp
new file mode 100644
index 00000000000..30ec3f4bf1f
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/Platform.cpp
@@ -0,0 +1,113 @@
+#include "GrPlatform.h"
+
+#ifdef _WIN32
+#include "windows.h"
+
+namespace gr
+{
+
+size_t Platform_UnicodeToANSI(const utf16 * prgchwSrc, size_t cchwSrc, char * prgchsDst, size_t cchsDst)
+{
+ return ::WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)prgchwSrc, cchwSrc, prgchsDst, cchsDst, NULL, NULL);
+}
+
+size_t Platform_AnsiToUnicode(const char * prgchsSrc, size_t cchsSrc, utf16 * prgchwDst, size_t cchwDst)
+{
+ return ::MultiByteToWideChar(CP_ACP, 0, prgchsSrc, cchsSrc, (LPWSTR)prgchwDst, cchwDst);
+}
+
+size_t Platform_8bitToUnicode(int nCodePage, const char * prgchsSrc, int cchsSrc,
+ utf16 * prgchwDst, int cchwDst)
+{
+ return ::MultiByteToWideChar(nCodePage, 0, prgchsSrc, cchsSrc, (LPWSTR)prgchwDst, cchwDst);
+}
+
+size_t utf8len(const char *s)
+{
+ return mbstowcs(NULL,s,0);
+}
+
+utf16 *utf16cpy(utf16 *dest, const utf16 *src)
+{
+ return (utf16*)wcscpy((wchar_t*)dest, (const wchar_t*)src);
+}
+
+utf16 *utf16ncpy(utf16 *dest, const utf16 *src, size_t n)
+{
+ return (utf16*)wcsncpy((wchar_t*)dest, (const wchar_t*)src, n);
+}
+
+utf16 *utf16ncpy(utf16 *dest, const char *src, size_t n)
+{
+ #ifdef UTF16DEBUG
+ std::cerr << "utf16ncpy8: " << src << std::endl;
+ #endif
+ Platform_AnsiToUnicode(src, strlen(src), dest, n);
+ return dest;
+}
+
+
+size_t utf16len(const utf16 *s)
+{
+ return wcslen((const wchar_t*)s);
+}
+
+int utf16cmp(const utf16 *s1, const utf16 *s2)
+{
+return wcscmp((const wchar_t*)s1, (const wchar_t*)s2);
+}
+
+int utf16ncmp(const utf16 *s1, const utf16 *s2, size_t n)
+{
+ return wcsncmp((const wchar_t*)s1, (const wchar_t*)s2, n);
+}
+
+int utf16cmp(const utf16 *s1, const char *s2)
+{
+ while (*s1 && s2)
+ {
+ if (*s1 < *s2)
+ {
+ return -1;
+ }
+ if (*s1 > *s2)
+ {
+ return 1;
+ }
+ *s1++;
+ *s2++;
+ }
+ if (*s1) return -1;
+ else if (*s2) return 1;
+ return 0;
+}
+
+}
+#else // not _WIN32
+
+#include <iostream>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef HAVE_FABSF
+float fabsf(float x)
+{
+ return (x < 0.0f) ? -x : x;
+}
+#endif
+
+namespace gr
+{
+
+size_t utf16len(const utf16 *s)
+{
+ // assumes NULL terminated strings
+ const utf16 *start = s;
+ for (; *s; ++s);
+
+ return s - start;
+}
+
+} // namespace gr
+#endif // _WIN32
+
diff --git a/Build/source/libs/graphite/src/segment/Segment.cpp b/Build/source/libs/graphite/src/segment/Segment.cpp
new file mode 100644
index 00000000000..b936b037a64
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/Segment.cpp
@@ -0,0 +1,3547 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: Segment.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Implements a Graphite segment--a range of rendered text in one writing system, that can be
+ rendered with a single font, and that fits on a single line.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+// any other headers (not precompiled)
+#include <math.h>
+#ifndef _WIN32
+#include <stdlib.h>
+#endif
+
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+#if 0 // TODO remove
+namespace
+{
+
+static bool g_fDrawing;
+
+} // namespace
+#endif
+
+
+static int g_csegTotal = 0;
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Segment methods
+//:>********************************************************************************************
+
+
+int Segment::GetSegmentCount() /// TEMP
+{
+ return g_csegTotal;
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Constructor: basic initialization.
+----------------------------------------------------------------------------------------------*/
+Segment::Segment() :
+ m_pgts(NULL),
+ m_pfont(NULL),
+ m_preneng(NULL),
+ m_fErroneous(false),
+ m_pgjus(NULL),
+ m_prgbNextSegDat(NULL),
+ m_cbNextSegDat(0),
+ m_prgInitDat(NULL),
+ m_cbInitDat(0),
+// m_fUseSepBase(0),
+ //m_psegAltEndLine(NULL),
+ m_prgisloutBefore(NULL),
+ m_prgisloutAfter(NULL),
+ m_prgpvisloutAssocs(NULL),
+ m_prgisloutLigature(NULL),
+ m_prgiComponent(NULL),
+// m_psstrm(NULL),
+ m_cslout(0),
+ m_prgslout(NULL),
+ m_prgnSlotVarLenBuf(NULL),
+// m_cnUserDefn(0),
+ m_cnCompPerLig(0),
+// m_cnFeat(0),
+ m_cginf(0),
+ m_prgginf(NULL)
+{
+ m_cref = 1;
+
+ g_csegTotal++;
+
+// m_stuFaceName.erase();
+// m_stuBaseFaceName.erase();
+ m_vnSkipOffsets.clear();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Reference counting.
+----------------------------------------------------------------------------------------------*/
+
+long Segment::IncRefCount(void)
+{
+ AssertPtr(this);
+ return InterlockedIncrement(&m_cref);
+}
+
+long Segment::DecRefCount(void)
+{
+ AssertPtr(this);
+ long cref = InterlockedDecrement(&m_cref);
+ if (cref == 0) {
+ m_cref = 1;
+ delete this;
+ }
+ return cref;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Constructor to fit as much of the text on the line as possible,
+ finding a reasonable break point if necessary.
+----------------------------------------------------------------------------------------------*/
+LineFillSegment::LineFillSegment(
+ Font * pfont,
+ ITextSource * pts,
+ LayoutEnvironment * playoutArg,
+ toffset ichStart,
+ toffset ichStop,
+ float xsMaxWidth,
+ bool fBacktracking)
+ : Segment()
+{
+ if (!pfont)
+ throw;
+ if (!pts)
+ throw;
+
+ LayoutEnvironment layoutDefault;
+ LayoutEnvironment * playout = (!playoutArg) ? &layoutDefault : playoutArg;
+
+ pfont->RenderLineFillSegment(this, pts, *playout, ichStart, ichStop, xsMaxWidth,
+ fBacktracking);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Constructor to create a segment representing the given range of characters.
+----------------------------------------------------------------------------------------------*/
+RangeSegment::RangeSegment(
+ Font * pfont,
+ ITextSource * pts,
+ LayoutEnvironment * playoutArg,
+ toffset ichStart,
+ toffset ichStop,
+ Segment * psegInitLike)
+ : Segment()
+{
+ if (!pfont)
+ throw;
+ if (!pts)
+ throw;
+
+ LayoutEnvironment layoutDefault;
+ LayoutEnvironment * playout = (!playoutArg) ? &layoutDefault : playoutArg;
+ playout->setSegmentForInit(psegInitLike);
+
+ pfont->RenderRangeSegment(this, pts, *playout, ichStart, ichStop);
+
+ playout->setSegmentForInit(NULL);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Constructor to create a justified segment. Private.
+----------------------------------------------------------------------------------------------*/
+JustSegmentAux::JustSegmentAux(
+ Font * pfont,
+ ITextSource * pts,
+ LayoutEnvironment * playoutArg,
+ toffset ichStart,
+ toffset ichStop,
+ float xsNaturalWidth,
+ float xsJustifiedWidth,
+ Segment * psegInitLike)
+ : Segment()
+{
+ if (!pfont)
+ throw;
+ if (!pts)
+ throw;
+
+ LayoutEnvironment layoutDefault;
+ LayoutEnvironment * playout = (!playoutArg) ? &layoutDefault : playoutArg;
+ playout->setSegmentForInit(psegInitLike);
+
+ pfont->RenderJustifiedSegment(this, pts, *playout, ichStart, ichStop,
+ xsNaturalWidth, xsJustifiedWidth);
+
+ playout->setSegmentForInit(NULL);
+}
+
+//Segment::Segment(ITextSource * pgts, int ichwMin, int ichwLim,
+// LineBrk lbStart, LineBrk lbEnd,
+// bool fStartLine, bool fEndLine, bool fWsRtl)
+//{
+// m_cref = 1;
+// Initialize(pgts, ichwMin, ichwLim, lbStart, lbEnd, fStartLine, fEndLine, fWsRtl);
+//}
+
+void Segment::Initialize(ITextSource * pgts, int ichwMin, int ichwLim,
+ LineBrk lbStart, LineBrk lbEnd, SegEnd est,
+ bool fStartLine, bool fEndLine, bool fWsRtl)
+{
+ AssertPtrN(pgts);
+ Assert(ichwMin >= 0);
+ Assert(ichwLim >= 0);
+ Assert(ichwMin <= ichwLim);
+
+ //pgts->TextSrcObject(&m_pgts); // create a permanent wrapper, if necessary
+ // m_pgts->AddRef(); no, smart pointer
+ m_pgts = pgts;
+
+ m_ichwMin = ichwMin;
+ m_dichwLim = ichwLim - ichwMin;
+ m_lbStart = lbStart;
+ m_lbEnd = lbEnd;
+ m_est = est;
+ m_dxsStretch = 0;
+ m_dxsWidth = -1;
+ m_dysAscent = -1; // to properly init, ComputeDimensions must be called
+ m_dysHeight = -1;
+ m_dysXAscent = -1;
+ m_dysXDescent = -1;
+ m_dysAscentOverhang = -1;
+ m_dysDescentOverhang = -1;
+ m_dxsLeftOverhang = -1;
+ m_dxsRightOverhang = -1;
+ m_dysOffset = 0;
+ m_fStartLine = fStartLine;
+ m_fEndLine = fEndLine;
+ m_fWsRtl = fWsRtl;
+
+ m_dxsVisibleWidth = -1;
+ m_dxsTotalWidth = -1;
+
+// m_psstrm = NULL;
+ m_prgslout = NULL;
+ m_prgnSlotVarLenBuf = NULL;
+ m_prgisloutBefore = NULL;
+ m_prgisloutAfter = NULL;
+ m_prgpvisloutAssocs = NULL;
+ m_prgisloutLigature = NULL;
+ m_prgiComponent = NULL;
+
+ m_prgbNextSegDat = NULL;
+ m_cbNextSegDat = 0;
+
+ //m_psegAltEndLine = NULL;
+
+// m_stuFaceName.erase();
+// m_stuBaseFaceName.erase();
+// m_fUseSepBase = false;
+
+// m_psegPrev = NULL; // obsolete
+// m_psegNext = NULL;
+
+ //InitializePlatform();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Destructor.
+----------------------------------------------------------------------------------------------*/
+Segment::~Segment()
+{
+ g_csegTotal--;
+
+ DestroyContents();
+}
+
+void Segment::DestroyContents()
+{
+ delete m_pfont;
+ m_pfont = NULL;
+
+ //if (m_pgts)
+ // // A specially-created wrapper object has to be deleted.
+ // m_pgts->DeleteTextSrcPtr();
+ m_pgts = NULL;
+
+ //if (m_pgjus)
+ // // A specially-created wrapper object has to be deleted.
+ // m_pgjus->DeleteJustifierPtr();
+ m_pgjus = NULL;
+
+ //if (m_psegAltEndLine)
+ //{
+ // if (m_psegAltEndLine->m_psegAltEndLine == this)
+ // m_psegAltEndLine->m_psegAltEndLine = NULL;
+ // delete m_psegAltEndLine;
+ //}
+
+ //for (int iginf = 0; iginf < m_cginf; iginf++) // DELETE
+ // delete m_prgginf[iginf].components;
+
+ Assert((m_prgslout && m_prgnSlotVarLenBuf) || (!m_prgslout && !m_prgnSlotVarLenBuf));
+ delete[] m_prgslout;
+ delete[] m_prgnSlotVarLenBuf;
+ delete[] m_prgisloutBefore;
+ delete[] m_prgisloutAfter;
+ for (int ichw = 0; ichw < m_ichwAssocsLim - m_ichwAssocsMin; ichw++)
+ {
+ if (m_prgpvisloutAssocs && m_prgpvisloutAssocs[ichw])
+ delete m_prgpvisloutAssocs[ichw];
+ }
+ delete[] m_prgpvisloutAssocs;
+ delete[] m_prgisloutLigature;
+ delete[] m_prgiComponent;
+ delete[] m_prgbNextSegDat;
+ delete[] m_prgInitDat;
+ delete[] m_prgginf;
+ m_cginf = 0;
+
+ //DestroyContentsPlatform();
+
+ // ReleaseObj(m_pgts); automatic because smart pointer
+}
+
+/*----------------------------------------------------------------------------------------------
+ Factory method to create a new version of an existing segment with different
+ line-boundary flags.
+----------------------------------------------------------------------------------------------*/
+Segment * Segment::LineContextSegment(Segment & seg, bool fStartLine, bool fEndLine)
+{
+ if (!seg.hasLineBoundaryContext())
+ {
+ // Make an identical segment and just change the flags.
+ Segment * psegNew = new Segment(seg);
+ psegNew->InitLineContextSegment(fStartLine, fEndLine);
+ return psegNew;
+ }
+ else
+ {
+ // Rerun the processing.
+ LayoutEnvironment layout = seg.Layout();
+ layout.setStartOfLine(fStartLine);
+ layout.setEndOfLine(fEndLine);
+ ITextSource & gts = seg.getText();
+ Font & font = seg.getFont();
+ return new RangeSegment(&font, &gts, &layout,
+ seg.startCharacter(), seg.stopCharacter(), &seg);
+ }
+}
+
+void Segment::InitLineContextSegment(bool fStartLine, bool fEndLine)
+{
+ // For RTL end-of-line segments, trailing white space hangs off the left of
+ // the origin of the segment. So when changing that flag
+ // shift appropriately.
+ bool fShift = ((m_nDirDepth % 2) && (m_fEndLine != fEndLine));
+
+ m_fStartLine = fStartLine;
+ m_fEndLine = fEndLine;
+
+ m_layout.setStartOfLine(fStartLine);
+ m_layout.setEndOfLine(fEndLine);
+
+ if (fShift)
+ {
+ (m_fEndLine) ?
+ ShiftGlyphs(m_dxsVisibleWidth - m_dxsTotalWidth) : // shift left
+ ShiftGlyphs(m_dxsTotalWidth - m_dxsVisibleWidth); // shift right
+ }
+
+ m_dxsWidth = -1;
+}
+
+/*----------------------------------------------------------------------------------------------
+ A factory method to create a justified version of an existing segment.
+----------------------------------------------------------------------------------------------*/
+Segment * Segment::JustifiedSegment(Segment & seg, float xsNewWidth)
+{
+ LayoutEnvironment layout(seg.Layout());
+ ITextSource & gts = seg.getText();
+
+ // Why do we have to do this?
+ layout.setJustifier(seg.Justifier());
+ Font & font = seg.getFont();
+ return new JustSegmentAux(&font, &gts, &layout,
+ seg.startCharacter(), seg.stopCharacter(),
+ seg.advanceWidth(), xsNewWidth, &seg);
+}
+
+/*----------------------------------------------------------------------------------------------
+ A factory method to create a new version of an existing trailing white-space segment
+ with a different direction.
+----------------------------------------------------------------------------------------------*/
+Segment * Segment::WhiteSpaceSegment(Segment & seg, int nNewDepth)
+{
+ Segment * psegNew = new Segment(seg);
+ psegNew->InitWhiteSpaceSegment(nNewDepth);
+ return psegNew;
+}
+
+void Segment::InitWhiteSpaceSegment(int nNewDepth)
+{
+ if (nNewDepth == m_nDirDepth)
+ {
+ return;
+ }
+ else if ((nNewDepth % 2) == (m_nDirDepth % 2))
+ {
+ // Same direction, not much to change.
+ m_nDirDepth = nNewDepth;
+ return;
+ }
+ else if (m_twsh != ktwshOnlyWs)
+ return; // couldn't change it, oh, well
+
+ // Otherwise, do the hard stuff: reverse the positions of the glyphs.
+ for (int islout = 0; islout < m_cslout; islout++)
+ {
+ OutputSlot(islout)->ShiftForDirDepthChange(m_dxsTotalWidth);
+ }
+ m_nDirDepth = nNewDepth;
+
+ //SetDirectionDepthPlatform(nNewDepth);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Basic copy method.
+----------------------------------------------------------------------------------------------*/
+Segment::Segment(Segment & seg)
+{
+ int islout;
+
+ m_pgts = seg.m_pgts;
+ m_dichwLim = seg.m_dichwLim;
+ m_ichwMin = seg.m_ichwMin;
+ m_pfont = seg.m_pfont->copyThis();
+ m_preneng = seg.m_preneng;
+ m_fErroneous = seg.m_fErroneous;
+ m_pgjus = seg.m_pgjus;
+ m_fWsRtl = seg.m_fWsRtl;
+ m_fParaRtl = seg.m_fParaRtl;
+ m_twsh = seg.m_twsh;
+ m_nDirDepth = seg.m_nDirDepth;
+ m_cbNextSegDat = seg.m_cbNextSegDat;
+ m_prgbNextSegDat = new byte[m_cbNextSegDat];
+ std::copy(seg.m_prgbNextSegDat, seg.m_prgbNextSegDat + m_cbNextSegDat, m_prgbNextSegDat);
+// m_psegPrev = seg.m_psegPrev;
+// m_psegNext = seg.m_psegNext;
+// m_stuFaceName = seg.m_stuFaceName;
+// m_stuBaseFaceName = seg.m_stuBaseFaceName;
+// m_fUseSepBase = seg.m_fUseSepBase;
+// m_pixHeight = seg.m_pixHeight;
+// m_fBold = seg.m_fBold;
+// m_fItalic = seg.m_fItalic;
+ m_lbStart = seg.m_lbStart;
+ m_lbEnd = seg.m_lbEnd;
+ m_fStartLine = seg.m_fStartLine;
+ m_fEndLine = seg.m_fEndLine;
+ m_est = seg.m_est;
+ m_mFontEmUnits = seg.m_mFontEmUnits;
+ m_dysFontAscent = seg.m_dysFontAscent;
+ m_dysFontDescent = seg.m_dysFontDescent;
+ m_xysEmSquare = seg.m_xysEmSquare;
+// m_xsDPI = seg.m_xsDPI;
+// m_ysDPI = seg.m_ysDPI;
+ m_dxsStretch = seg.m_dxsStretch;
+ m_dxsWidth = seg.m_dxsWidth;
+ m_dysHeight = seg.m_dysHeight;
+ m_dysAscent = seg.m_dysAscent;
+ m_dysXAscent = seg.m_dysXAscent;
+ m_dysXDescent = seg.m_dysXDescent;
+ m_dysAscentOverhang = seg.m_dysAscentOverhang;
+ m_dysDescentOverhang = seg.m_dysDescentOverhang;
+ m_dxsLeftOverhang = seg.m_dxsLeftOverhang;
+ m_dxsRightOverhang = seg.m_dxsRightOverhang;
+ m_dxsVisibleWidth = seg.m_dxsVisibleWidth;
+ m_dxsTotalWidth = seg.m_dxsTotalWidth;
+ m_isloutVisLim = seg.m_isloutVisLim;
+ m_dysOffset = seg.m_dysOffset;
+
+ m_ichwAssocsMin = seg.m_ichwAssocsMin;
+ m_ichwAssocsLim = seg.m_ichwAssocsLim;
+
+ int dichw = m_ichwAssocsLim - m_ichwAssocsMin;
+ m_prgisloutBefore = new int[dichw];
+ std::copy(seg.m_prgisloutBefore, seg.m_prgisloutBefore + dichw, m_prgisloutBefore);
+ m_prgisloutAfter = new int[dichw];
+ std::copy(seg.m_prgisloutAfter, seg.m_prgisloutAfter + dichw, m_prgisloutAfter);
+ m_prgpvisloutAssocs = new std::vector<int> * [dichw];
+ for (int ivislout = 0; ivislout < dichw; ivislout++)
+ {
+ std::vector<int> * pvislout = seg.m_prgpvisloutAssocs[ivislout];
+ if (pvislout)
+ {
+ std::vector<int> * pvisloutNew = new std::vector<int>;
+ m_prgpvisloutAssocs[ivislout] = pvisloutNew;
+ *pvisloutNew = *pvislout; // copy the vector
+ }
+ }
+ m_prgisloutLigature = new int[dichw];
+ std::copy(seg.m_prgisloutLigature, seg.m_prgisloutLigature + dichw, m_prgisloutLigature);
+ m_prgiComponent = new sdata8[dichw];
+ std::copy(seg.m_prgiComponent, seg.m_prgiComponent + dichw, m_prgiComponent);
+
+ m_cslout = seg.m_cslout;
+ int cnExtraPerSlot = (m_cslout > 0) ? seg.m_prgslout[0].CExtraSpaceSlout() : 0;
+ m_prgnSlotVarLenBuf = new u_intslot[m_cslout * cnExtraPerSlot];
+ m_prgslout = new GrSlotOutput[m_cslout];
+ for (islout = 0; islout < m_cslout; islout++)
+ {
+ GrSlotOutput * psloutOrig = seg.m_prgslout + islout;
+ GrSlotOutput * psloutThis = m_prgslout + islout;
+ psloutThis->ExactCopyFrom(psloutOrig,
+ m_prgnSlotVarLenBuf + (islout * cnExtraPerSlot), // var-length buffer location
+ cnExtraPerSlot);
+ }
+
+// m_cnUserDefn = seg.m_cnUserDefn;
+ m_cnCompPerLig = seg.m_cnCompPerLig;
+// m_cnFeat = seg.m_cnFeat;
+ m_cslotRestartBackup = seg.m_cslotRestartBackup;
+ std::copy(seg.m_prgnSlotVarLenBuf, seg.m_prgnSlotVarLenBuf +
+ (m_cslout * cnExtraPerSlot), m_prgnSlotVarLenBuf);
+
+ m_cginf = seg.m_cginf;
+ m_isloutGinf0 = seg.m_isloutGinf0;
+ m_prgginf = new GlyphInfo[m_cginf];
+ std::copy(seg.m_prgginf, seg.m_prgginf + m_cginf, m_prgginf);
+ for (int iginf = 0; iginf < m_cginf; iginf++)
+ {
+ m_prgginf[iginf].m_pseg = this;
+ m_prgginf[iginf].m_pslout = m_prgslout + m_prgginf[iginf].m_islout;
+ }
+
+ // Platform-specific; remove eventually:
+ //m_cgstrm = seg.m_cgstrm;
+ //m_prggstrm = new GlyphStrm[m_cgstrm];
+ //for (int igstrm = 0; igstrm < m_cgstrm; igstrm++)
+ //{
+ // m_prggstrm[igstrm].gsk.ys = seg.m_prggstrm[igstrm].gsk.ys;
+ // m_prggstrm[igstrm].gsk.clrFore = seg.m_prggstrm[igstrm].gsk.clrFore;
+ // m_prggstrm[igstrm].gsk.clrBack = seg.m_prggstrm[igstrm].gsk.clrBack;
+ // m_prggstrm[igstrm].vchwGlyphId = seg.m_prggstrm[igstrm].vchwGlyphId;
+ // m_prggstrm[igstrm].vdxs = seg.m_prggstrm[igstrm].vdxs;
+ // m_prggstrm[igstrm].vigbb = seg.m_prggstrm[igstrm].vigbb;
+ // m_prggstrm[igstrm].xsStart = seg.m_prggstrm[igstrm].xsStart;
+ // m_prggstrm[igstrm].xsStartInt = seg.m_prggstrm[igstrm].xsStartInt;
+ //}
+ //m_cgbb = seg.m_cgbb;
+ //m_prggbb = new GlyphBb[m_cgbb];
+ //memcpy(m_prggbb, seg.m_prggbb, m_cgbb * sizeof(GlyphBb));
+ //-------------------------------------
+
+ m_vnSkipOffsets = seg.m_vnSkipOffsets;
+ m_dircPrevStrong = seg.m_dircPrevStrong;
+ m_dircPrevTerm = seg.m_dircPrevTerm;
+ m_cbInitDat = seg.m_cbInitDat;
+ m_prgInitDat = new byte[m_cbInitDat];
+ std::copy(seg.m_prgInitDat, seg.m_prgInitDat + m_cbInitDat, m_prgInitDat);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Swap the guts of the two segments.
+ OBSOLETE
+----------------------------------------------------------------------------------------------*/
+void Segment::SwapWith(Segment * pgrseg)
+{
+ int crefThis = m_cref;
+ int crefOther = pgrseg->m_cref;
+
+ std::swap(*this, *pgrseg);
+
+ m_cref = crefThis;
+ pgrseg->m_cref = crefOther;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Delete the pointer to the alternate-end-of-line segment.
+----------------------------------------------------------------------------------------------*/
+void Segment::ClearAltEndLineSeg()
+{
+ //if (m_psegAltEndLine)
+ //{
+ // if (m_psegAltEndLine->m_psegAltEndLine == this)
+ // m_psegAltEndLine->m_psegAltEndLine = NULL; // so we don't get into a loop
+ // delete m_psegAltEndLine;
+ // m_psegAltEndLine = NULL;
+ //}
+}
+
+
+//:>********************************************************************************************
+//:> Interface methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Return the font that was used to create this segment.
+ Note that in some implementations, the font may be invalid; eg, on Windows the font
+ may not contain a valid device context.
+----------------------------------------------------------------------------------------------*/
+Font & Segment::getFont()
+{
+ return *m_pfont;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the text-source that the segment is representing.
+----------------------------------------------------------------------------------------------*/
+ITextSource & Segment::getText()
+{
+ return *m_pgts;
+}
+
+/*----------------------------------------------------------------------------------------------
+ The distance the drawing point should advance after drawing this segment.
+ Always positive, even for RtoL segments.
+----------------------------------------------------------------------------------------------*/
+float Segment::advanceWidth()
+{
+ if (m_dxsWidth < 0)
+ {
+ ////SetUpGraphics(ichwBase, pgg, true);
+ ComputeDimensions();
+ }
+ return m_dxsWidth;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Compute the rectangle in destination coords which contains all the pixels drawn by
+ this segment. This should be a sufficient rectangle to invalidate if the segment is
+ about to be discarded.
+----------------------------------------------------------------------------------------------*/
+Rect Segment::boundingRect()
+{
+ if (m_dxsWidth < 0)
+ {
+ ////SetUpGraphics(ichwBase, pgg, true);
+ ComputeDimensions();
+ }
+
+ Rect rectRet;
+ rectRet.top = m_dysAscent + m_dysAscentOverhang;
+ rectRet.bottom = (m_dysAscent - m_dysHeight) - m_dysDescentOverhang;
+ rectRet.left = m_dxsLeftOverhang;
+ rectRet.right = m_dxsVisibleWidth + m_dxsRightOverhang;
+
+ return rectRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Answer whether the primary direction of the segment is right-to-left. This is based
+ on the direction of the writing system, except for white-space-only segments, in
+ which case it is based on the main paragraph direction.
+----------------------------------------------------------------------------------------------*/
+bool Segment::rightToLeft()
+{
+ if (m_twsh == ktwshOnlyWs)
+ {
+ // White-space-only segment: use main paragraph direction.
+ return (m_nDirDepth % 2);
+ }
+
+ GrEngine * pgreng = EngineImpl();
+ if (pgreng)
+ {
+ return pgreng->RightToLeft();
+ }
+ return (m_pgts->getRightToLeft(m_ichwMin));
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the depth of direction embedding used by this segment. It is presumably the same
+ for all runs of the segment, otherwise, some of them would use a different writing
+ system and therefore be part of a different segment. So just use the first.
+----------------------------------------------------------------------------------------------*/
+int Segment::directionDepth(bool * pfWeak)
+{
+ if (pfWeak)
+ *pfWeak = (m_twsh == ktwshOnlyWs);
+
+// *pnDepth = m_pgts->getDirectionDepth(m_ichwLim);
+// Assert(*pnDepth == m_nDirDepth);
+
+ return m_nDirDepth;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Change the direction of the segment. This is needed specifically for white-space-only
+ segments, which are initially created to be in the direction of the paragraph, but then
+ later are discovered to not be line-end after all, and need to be changed to use the
+ directionality of the writing system.
+
+ @return kresFail for segments that do not have weak directionality and therefore
+ cannot be changed.
+----------------------------------------------------------------------------------------------*/
+bool Segment::setDirectionDepth(int nNewDepth)
+{
+ Assert(false);
+
+ if (nNewDepth == m_nDirDepth)
+ {
+ return true;
+ }
+ else if ((nNewDepth % 2) == (m_nDirDepth % 2))
+ {
+ // Same direction, not much to change.
+ m_nDirDepth = nNewDepth;
+ return true;
+ }
+ else if (m_twsh != ktwshOnlyWs)
+ return false;
+
+ // Otherwise, do the hard stuff: reverse the positions of the glyphs.
+ for (int islout = 0; islout < m_cslout; islout++)
+ {
+ OutputSlot(islout)->ShiftForDirDepthChange(m_dxsTotalWidth);
+ }
+
+ //SetDirectionDepthPlatform(nNewDepth);
+
+ return true;
+
+}
+
+/*----------------------------------------------------------------------------------------------
+ The logical range of characters covered by the segment, relative to the beginning of
+ the segment. The stop character is the index of the first character beyond the end
+ of the segment.
+
+ These values should be exact at a writing system or string boundary,
+ but may be somewhat fuzzy at a line-break, since characters may be re-ordered
+ across such boundaries. The renderer is free to apply any definition it likes of
+ where a line-break occurs. This should always be the same value obtained from the
+ renderer as pdichLimSeg.
+----------------------------------------------------------------------------------------------*/
+int Segment::startCharacter()
+{
+ return m_ichwMin;
+}
+
+int Segment::stopCharacter()
+{
+ return m_ichwMin + m_dichwLim;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Returns an indication of why the segment ended.
+----------------------------------------------------------------------------------------------*/
+bool Segment::startOfLine()
+{
+ return m_fStartLine;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Returns an indication of why the segment ended.
+----------------------------------------------------------------------------------------------*/
+bool Segment::endOfLine()
+{
+ return m_fEndLine;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Returns true if this segment has something special happening at line boundaries.
+----------------------------------------------------------------------------------------------*/
+bool Segment::hasLineBoundaryContext()
+{
+ return (EngineImpl()->LineBreakFlag());
+}
+
+/*----------------------------------------------------------------------------------------------
+ Returns an indication of why the segment ended.
+----------------------------------------------------------------------------------------------*/
+SegEnd Segment::segmentTermination()
+{
+ return m_est;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Indicates the last character of interest to the segment, relative to the beginning
+ of the segment. The meaning of this is that no behavior of this segment will be
+ affected if characters beyond that change. This does not necessarily mean that
+ a different line break could not have been obtained by the renderer if characters
+ beyond that change, just that a segment with the boundaries of this one would
+ not behave differently.
+----------------------------------------------------------------------------------------------*/
+//GrResult Segment::get_LimInterest(int ichwBase, int * pdichw)
+//{
+// ChkGrOutPtr(pdichw);
+//
+// GrEngine * pgreng = EngineImpl();
+// Assert(pgreng);
+// *pdichw = m_dichwLim + pgreng->PostXlbContext();
+// ReturnResult(kresOk);
+//}
+
+/*----------------------------------------------------------------------------------------------
+ Changes the end-of-line status of the segment. This is used after making the last segment
+ of a string if we want to attempt to put some more text after it (e.g., in another
+ writing system), or if we have reordered due to bidirectionality.
+
+ ENHANCE: the current version handles switching back and forth when we are trying to
+ decide whether we can put more stuff on a line. So it assumes we are at the end of
+ the contextual run (ie, the next batch of stuff will be in a different ows).
+ This will not correctly handle the way this function could or possibly
+ should be used for bidirectional reordering.
+----------------------------------------------------------------------------------------------*/
+/*
+GrResult Segment::changeLineEnds(bool fNewStart, bool fNewEnd)
+{
+ if (m_fStartLine != fNewStart || m_fEndLine != fNewEnd)
+ {
+ if (EngineImpl()->LineBreakFlag())
+ {
+ if (!m_psegAltEndLine)
+ {
+ int dichwLimSeg, dichwContext;
+ float dxWidth;
+ SegEnd est;
+ int cbNextSegDat;
+ byte rgbNextSegDat[256];
+ OLECHAR rgchErrMsg[256];
+ Segment * pseg;
+
+ EngineImpl()->FindBreakPointAux(m_pfont, m_pgts, m_pgjus,
+ m_ichwMin, m_ichwMin + m_dichwLim, m_ichwMin + m_dichwLim,
+ false, fNewStart, fNewEnd, kPosInfFloat, false,
+ klbNoBreak, klbNoBreak, m_twsh, m_fParaRtl,
+ &pseg,
+ &dichwLimSeg, &dxWidth, &est,
+ m_cbInitDat, m_prgInitDat, 256, rgbNextSegDat, &cbNextSegDat,
+ &dichwContext,
+ NULL,
+ rgchErrMsg, 256);
+ // TODO: do something with the error message. This shouldn't really happen,
+ // since to get here we already created a segment with this font.
+ if (!pseg)
+ {
+ // Because we provide INT_MAX as the amount of space, there should
+ // always be enough room to generate the alternate segment.
+ Assert(false);
+ THROW(kresUnexpected);
+ }
+ Assert(cbNextSegDat == 0);
+ m_psegAltEndLine = pseg;
+ }
+ Assert(m_psegAltEndLine->m_fEndLine == fNewEnd);
+ Segment * pseg = m_psegAltEndLine; // save the value
+ SwapWith(m_psegAltEndLine);
+ m_psegAltEndLine = pseg; // reset it after swap
+ pseg->m_psegAltEndLine = this;
+ }
+ else
+ {
+ bool fShift = ((m_nDirDepth % 2) && (m_fEndLine != fNewEnd));
+ m_fStartLine = fNewStart;
+ m_fEndLine = fNewEnd;
+ if (fShift)
+ {
+ (m_fEndLine) ?
+ ShiftGlyphs(m_dxsVisibleWidth - m_dxsTotalWidth) : // shift left
+ ShiftGlyphs(m_dxsTotalWidth - m_dxsVisibleWidth); // shift right
+ }
+ m_dxsWidth = -1;
+ }
+ }
+
+ ReturnResult(kresOk);
+}
+*/
+
+/*----------------------------------------------------------------------------------------------
+ Get the type of break that occurs at the logical start of the segment.
+----------------------------------------------------------------------------------------------*/
+LineBrk Segment::startBreakWeight()
+{
+ return m_lbStart;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Get the type of break that occurs at the logical end of the segment.
+----------------------------------------------------------------------------------------------*/
+LineBrk Segment::endBreakWeight()
+{
+ return m_lbEnd;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Read the amount of stretch, that is, the difference between the actual and natural width.
+ If the segment has been shrunk, returns a negative number.
+ TODO: implement properly.
+----------------------------------------------------------------------------------------------*/
+float Segment::stretch()
+{
+ return (float)m_dxsStretch;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the maximum stretch possible.
+ TODO: implement properly.
+----------------------------------------------------------------------------------------------*/
+float Segment::maxStretch()
+{
+ return 1000;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the maximum shrink possible.
+ TODO: implement properly.
+----------------------------------------------------------------------------------------------*/
+float Segment::maxShrink()
+{
+ return 0;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return iterators representing the complete range of glyphs in the segment.
+----------------------------------------------------------------------------------------------*/
+std::pair<GlyphIterator, GlyphIterator> Segment::glyphs()
+{
+ return std::make_pair(GlyphIterator(*this, 0), GlyphIterator(*this, m_cginf));
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return iterators representing the set of glyphs for the given character.
+----------------------------------------------------------------------------------------------*/
+std::pair<GlyphSetIterator, GlyphSetIterator> Segment::charToGlyphs(toffset ich)
+{
+ std::vector<int> vislout = UnderlyingToLogicalAssocs(ich);
+
+ if (vislout.size() == 0)
+ return std::make_pair(GlyphSetIterator(), GlyphSetIterator());
+ else
+ {
+ // Note that BOTH instances of GlyphSetIterator must use the same underlying vector,
+ // so that comparisons make sense.
+ RcVector * qvislout = new RcVector(vislout);
+ return std::make_pair(
+ GlyphSetIterator(*this, 0, qvislout),
+ GlyphSetIterator(*this, vislout.size(), qvislout));
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the rendered glyphs and their x- and y-coordinates, in the order generated by
+ the final positioning pass, relative to the top-left of the segment. They are always
+ returned in (roughly) left-to-right order. Note: any of the arrays may be null.
+----------------------------------------------------------------------------------------------*/
+/*
+GrResult Segment::GetGlyphsAndPositions(
+ Rect rs, Rect rd, int cchMax, int * pcchRet,
+ utf16 * prgchGlyphs, float * prgxd, float * prgyd, float * prgdxdAdv)
+{
+ ChkGrOutPtr(pcchRet);
+ if (prgchGlyphs)
+ ChkGrArrayArg(prgchGlyphs, cchMax);
+ if (prgxd)
+ ChkGrArrayArg(prgxd, cchMax);
+ if (prgyd)
+ ChkGrArrayArg(prgyd, cchMax);
+ if (prgdxdAdv)
+ ChkGrArrayArg(prgdxdAdv, cchMax);
+
+ GrResult res;
+
+ //SetUpGraphics(ichwBase, pgg, true);
+
+ Assert(m_dxsWidth >= 0);
+ Assert(m_dysAscent >= 0);
+
+ *pcchRet = m_cginf;
+ if (cchMax < m_cginf)
+ {
+ res = (cchMax == 0) ? kresFalse : kresInvalidArg;
+ //RestoreFont(pgg);
+ ReturnResult(res);
+ }
+
+ if (m_dxsWidth < 0)
+ ComputeDimensions();
+
+ float dysFontAscent = m_dysFontAscent;
+ //////res = GetFontAscentSourceUnits(pgg, &dysFontAscent);
+ //////if (ResultFailed(res))
+ //////{
+ ////// RestoreFont(pgg);
+ ////// ReturnResult(res);
+ //////}
+
+ float xs = 0;
+ // Top of text that sits on the baseline, relative to top of segment:
+ float ys = m_dysAscent - dysFontAscent;
+
+ float * prgxdLocal;
+ if (prgxd == NULL)
+ prgxdLocal = new float[cchMax];
+ else
+ prgxdLocal = prgxd;
+
+ res = GetGlyphsAndPositionsPlatform(xs, ys, rs, rd,
+ prgchGlyphs, prgxdLocal, prgyd, prgdxdAdv);
+
+ if (!prgxd)
+ delete[] prgxdLocal;
+
+ //RestoreFont(pgg);
+
+ ReturnResult(res);
+}
+*/
+
+/*----------------------------------------------------------------------------------------------
+ For debugging. Return the characters in this segment.
+ OBSOLETE
+----------------------------------------------------------------------------------------------*/
+GrResult Segment::GetCharData(int cchMax, utf16 * prgch, int * pcchRet)
+{
+ ChkGrArgPtr(prgch);
+ ChkGrOutPtr(pcchRet);
+
+ int ichLimTmp = m_ichwMin + min(m_dichwLim, cchMax);
+ m_pgts->fetch(m_ichwMin, ichLimTmp - m_ichwMin, prgch);
+ *pcchRet = ichLimTmp - m_ichwMin;
+ ReturnResult(kresOk);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return either the first or last character that the the glyph corresponds to. The
+ index of the glyph matches what was returned by GetGlyphsAndPositions.
+ OBSOLETE
+----------------------------------------------------------------------------------------------*/
+GrResult Segment::GlyphToChar(int iginf, bool fFirst, int * pich)
+{
+ Assert(m_dxsWidth >= 0);
+ Assert(m_dysAscent >= 0);
+
+ *pich = PhysicalSurfaceToUnderlying(iginf, fFirst);
+ ReturnResult(kresOk);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return all the characters that the glyph corresponds to. Most commonly this will
+ be only one char, but ligatures, for instance, will have several. The index of the
+ glyph matches what was returned by GetGlyphsAndPositions.
+ OBSOLETE
+----------------------------------------------------------------------------------------------*/
+GrResult Segment::GlyphToAllChars(int iginf,
+ int cichMax, int * prgich, int * pcichRet)
+{
+ Assert(m_dxsWidth >= 0);
+ Assert(m_dysAscent >= 0);
+
+ std::vector<int> vich;
+ int ichFirst = PhysicalSurfaceToUnderlying(iginf, true);
+ int ichLast = PhysicalSurfaceToUnderlying(iginf, false);
+ Assert(ichFirst <= ichLast);
+
+ if (ichFirst < ichLast)
+ {
+ // Loop over the range of characters that might be associated with this glyph
+ // and add any that actually are.
+ // TODO: we should probably use a method that gets us all the physical associations,
+ // but this should get us 99.5% of the way there for now.
+ for (int ich = ichFirst; ich <= ichLast; ich++)
+ {
+ int iginfFirst = UnderlyingToPhysicalSurface(ich, true);
+ int iginfLast = UnderlyingToPhysicalSurface(ich, false);
+ if (iginfFirst == iginf || iginfLast == iginf)
+ vich.push_back(ich);
+ }
+ }
+ else
+ vich.push_back(ichFirst);
+
+ *pcichRet = vich.size();
+ if (cichMax < signed(vich.size()))
+ {
+ GrResult res = (cichMax == 0 ? kresFalse : kresInvalidArg);
+ ReturnResult(res);
+ }
+ int * pi = prgich;
+ for (size_t i = 0; i < vich.size(); i++)
+ *pi++ = vich[i];
+
+ ReturnResult(kresOk);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return either the first or last glyph that corresponds to the character. The
+ index of the glyph matches what was returned by GetGlyphsAndPositions.
+ OBSOLETE
+----------------------------------------------------------------------------------------------*/
+GrResult Segment::CharToGlyph(int ich, bool fFirst, int * pigbb)
+{
+ Assert(m_dxsWidth >= 0);
+ Assert(m_dysAscent >= 0);
+
+ *pigbb = UnderlyingToPhysicalSurface(ich, fFirst);
+ ReturnResult(kresOk);
+}
+
+
+//:>********************************************************************************************
+//:> Non-FieldWorks interface methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Return the breakweight for the given character. Returns the best value if the character is
+ mapped to glyphs with different values.
+----------------------------------------------------------------------------------------------*/
+LineBrk Segment::getBreakWeight(int ich, bool fBreakBefore)
+{
+ LineBrk lbFirst, lbLast;
+
+ int isloutFirst = UnderlyingToLogicalSurface(ich, true);
+ if (isloutFirst == kPosInfinity || isloutFirst == kNegInfinity)
+ return klbClipBreak;
+ GrSlotOutput * psloutFirst = m_prgslout + isloutFirst;
+ bool fNotFirst = false;
+ if ((psloutFirst->NumberOfComponents() > 0)
+ && psloutFirst->UnderlyingComponent(0) != ich)
+ {
+ // Not the first component of a ligature.
+ lbFirst = (LineBrk) ((int)klbClipBreak * -1);
+ fNotFirst = true;
+ }
+ else
+ {
+ lbFirst = (LineBrk) psloutFirst->BreakWeight();
+ }
+
+ int isloutLast = UnderlyingToLogicalSurface(ich, false);
+ if (isloutLast == kPosInfinity || isloutLast == kNegInfinity)
+ return klbClipBreak;
+ GrSlotOutput * psloutLast = m_prgslout + isloutLast;
+ bool fNotLast = false;
+ if ((psloutLast->NumberOfComponents() > 0)
+ && psloutLast->UnderlyingComponent(psloutLast->NumberOfComponents() - 1) != ich)
+ {
+ // Not the last component of a ligature.
+ lbLast = klbClipBreak;
+ fNotLast = true;
+ }
+ else
+ {
+ lbLast = (LineBrk) psloutLast->BreakWeight();
+ }
+
+ LineBrk lbRet;
+ if (fNotLast && fNotFirst)
+ // middle of a ligature
+ lbRet = klbClipBreak;
+ else if (fNotLast)
+ lbRet = (fBreakBefore) ? lbFirst : klbClipBreak;
+ else if (fNotFirst)
+ lbRet = (fBreakBefore) ? klbClipBreak : lbLast;
+ else
+ lbRet = (fBreakBefore) ? lbFirst : lbLast;
+
+ return lbRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the width of the range of characters. Line-boundary contextualization is handled
+ by the measure attributes on the glyphs. The width returned is equivalent to the sum of
+ the widths of any line-segments that would be needed to underline all the characters.
+
+ Since this method is intended to be used on "measured" segments that include the entire
+ paragraph, it is not very smart about handling cross-line-boundary contextualization.
+ It basically ignores any glyphs that are rendered by this segment but not officially
+ part of the segment.
+----------------------------------------------------------------------------------------------*/
+float Segment::getRangeWidth(int ichMin, int ichLim,
+ bool fStartLine, bool fEndLine, bool fSkipSpace)
+{
+ if (m_dxsWidth < 0)
+ {
+ ////SetUpGraphics(ichwBase, pgg, true);
+ ComputeDimensions();
+ }
+
+ Assert(m_dxsWidth >= 0);
+ Assert(m_dysAscent >= 0);
+
+ //float xsSegRight = m_dxsTotalWidth;
+
+ int ichMinRange = min(ichMin, ichLim);
+ int ichLimRange = max(ichMin, ichLim);
+
+ //int ichMinSeg = max(ichMinRange, m_ichwMin + m_ichwAssocsMin);
+ //int ichLimSeg = min(ichLimRange, m_ichwMin + m_ichwAssocsLim);
+ int ichMinSeg = max(ichMinRange, m_ichwMin);
+ int ichLimSeg = min(ichLimRange, m_ichwMin + m_dichwLim);
+
+ if (ichLimSeg < m_ichwMin) // not + m_ichwAssocsMin
+ return 0;
+ if (ichMinSeg >= m_ichwMin + m_dichwLim) // not m_ichwAssocsLim
+ return 0;
+
+ if (fSkipSpace)
+ {
+ int islout = UnderlyingToLogicalSurface(ichLimSeg - 1, true);
+ GrSlotOutput * pslout = (islout == kNegInfinity || islout == kPosInfinity) ?
+ NULL :
+ OutputSlot(islout);
+ while (pslout && pslout->IsSpace())
+ {
+ ichLimSeg--;
+ islout = UnderlyingToLogicalSurface(ichLimSeg - 1, true);
+// pslout = OutputSlot(islout);
+ pslout = (islout == kNegInfinity || islout == kPosInfinity) ?
+ NULL : OutputSlot(islout);
+ }
+ }
+
+ float xsWidth = 0;
+ SegmentNonPainter segp(this); // doesn't really need to paint
+ float rgxdLefts[100];
+ float rgxdRights[100];
+ size_t cxd = 0;
+ if (ichMinRange < ichLimRange)
+ cxd = segp.getUnderlinePlacement(ichMinSeg, ichLimSeg, fSkipSpace,
+ 100, rgxdLefts, rgxdRights, NULL);
+ for (size_t i = 0; i < cxd; i++)
+ xsWidth += rgxdRights[i] - rgxdLefts[i];
+
+ // Add in the line-boundary contextualization.
+ int isloutFirst = UnderlyingToLogicalSurface(ichMin, true);
+ int isloutLast = UnderlyingToLogicalSurface(ichLim - 1, false);
+ int mSol = 0;
+ int mEol = 0;
+ if (0 <= isloutFirst && isloutFirst < m_cslout)
+ mSol = m_prgslout[isloutFirst].MeasureSol();
+ if (0 <= isloutLast && isloutLast < m_cslout)
+ mEol = m_prgslout[isloutLast].MeasureEol();
+ float dxsSol = GrEngine::GrIFIMulDiv(mSol, m_xysEmSquare, m_mFontEmUnits);
+ float dxsEol = GrEngine::GrIFIMulDiv(mEol, m_xysEmSquare, m_mFontEmUnits);
+ xsWidth += dxsSol;
+ xsWidth += dxsEol;
+
+ //RestoreFont(pgg);
+
+ return xsWidth;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the next reasonable breakpoint after ichStart resulting in range that fits in
+ the specified width.
+----------------------------------------------------------------------------------------------*/
+int Segment::findNextBreakPoint(int ichStart,
+ LineBrk lbPref, LineBrk lbWorst, float dxMaxWidth,
+ float * pdxBreakWidth, bool fStartLine, bool fEndLine)
+{
+ ChkGrOutPtr(pdxBreakWidth);
+
+ int ichBreak;
+
+ // First make a rough estimation of how much will fit, using a binary chop approach.
+ int iginfStart = UnderlyingToPhysicalSurface(ichStart, !m_fWsRtl);
+ int iginfEnd = UnderlyingToPhysicalSurface(m_ichwMin + m_dichwLim - 1, m_fWsRtl);
+ int iginfLeft = min(iginfStart, iginfEnd);
+ int iginfRight= max(iginfStart, iginfEnd);
+
+ int iginfMin = iginfLeft;
+ int iginfLim = iginfRight;
+ int ichFit;
+ if (m_fWsRtl) // right-to-left
+ {
+ float xRight = GlyphLeftEdge(iginfRight + 1);
+ float xLeftMost = xRight - dxMaxWidth;
+ while (GlyphLeftEdge(iginfLim) < xLeftMost)
+ {
+ if (iginfLim - iginfMin <= 1)
+ break;
+ int iginfMid = (iginfLim + iginfMin) >> 1; // divide by 2
+ if (GlyphLeftEdge(iginfMid) < xLeftMost)
+ iginfLim = iginfMid;
+ else
+ iginfMin = iginfMid;
+ }
+ ichFit = PhysicalSurfaceToUnderlying(iginfLim, false);
+ }
+ else // left-to-right
+ {
+ float xLeft = GlyphLeftEdge(iginfLeft);
+ float xRightMost = dxMaxWidth - xLeft; // QUESTION: shouldn't this be +, not -?
+ iginfLim++;
+ while (GlyphLeftEdge(iginfLim) > xRightMost)
+ {
+ if (iginfLim - iginfMin <= 1)
+ break;
+ int iginfMid = (iginfLim + iginfMin) >> 1; // divide by 2
+ if (GlyphLeftEdge(iginfMid) > xRightMost)
+ iginfLim = iginfMid;
+ else
+ iginfMin = iginfMid;
+ }
+ Assert(iginfLim <= m_cginf);
+ if (iginfLim >= m_cginf) iginfLim = m_cginf - 1;
+ ichFit = PhysicalSurfaceToUnderlying(iginfLim, false);
+ }
+
+ // Breaking after ichFit should pretty much fit in the space. But make sure.
+ float dxWidthFit;
+ while (ichFit > ichStart)
+ {
+ dxWidthFit = getRangeWidth(ichStart, ichFit, fStartLine, fEndLine);
+ if (dxWidthFit <= dxMaxWidth)
+ break;
+ ichFit--;
+ }
+
+ if (ichFit <= ichStart)
+ {
+ // Nothing will fit.
+ return ichStart - 1;
+ }
+
+ // Now look for a good break. First look forward until the range doesn't fit anymore.
+ int ichTry = ichFit;
+ int nExtra = 2;
+ LineBrk lbBest = klbClipBreak;
+ int ichBestBreak = -1;
+ while (nExtra > 0 && ichTry < m_ichwMin + m_dichwLim)
+ {
+ float dxWTmp;
+ dxWTmp = getRangeWidth(ichStart, ichTry, fStartLine, fEndLine);
+ if (dxWTmp <= dxMaxWidth)
+ {
+ LineBrk lbTmp;
+ lbTmp = getBreakWeight(ichTry - 1, false);
+ if (lbTmp > 0 && lbTmp < lbWorst && max(lbTmp, lbPref) <= lbBest)
+ {
+ ichBestBreak = ichTry;
+ lbBest = max(lbTmp, lbPref); // any value better than lbPref is insignificant
+ }
+ else
+ {
+ lbTmp = getBreakWeight(ichTry - 1, true);
+ if (lbTmp < 0)
+ {
+ lbTmp = LineBrk(max(lbTmp * -1L, long(lbPref)));
+ if (lbTmp < lbWorst && lbTmp <= lbBest)
+ {
+ ichBestBreak = ichTry - 1;
+ lbBest = lbTmp;
+ }
+ }
+ }
+ }
+ else
+ {
+ // Didn't fit. But it is theoretically possible that actually adding another
+ // character will! Try a few more.
+ nExtra--;
+ }
+ ichTry++;
+ }
+
+ if (ichTry >= m_ichwMin + m_dichwLim)
+ {
+ // Break at the end of the segment.
+ ichBreak = m_ichwMin + m_dichwLim;
+ *pdxBreakWidth = getRangeWidth(ichStart, m_dichwLim, fStartLine, fEndLine);
+ return ichBreak;
+ }
+
+ if (ichBestBreak > -1 && lbBest <= lbPref)
+ {
+ // Found a reasonable break by looking forward; return it.
+ ichBreak = ichBestBreak;// + m_ichwMin;
+ *pdxBreakWidth = getRangeWidth(ichStart, ichBestBreak, fStartLine, fEndLine);
+ return ichBreak;
+ }
+
+ // Didn't find a really good break point looking forward from our rough guess.
+ // Now look backward.
+
+ ichTry = ichFit;
+ while (ichTry > ichStart)
+ {
+ LineBrk lbTmp;
+ lbTmp = getBreakWeight(ichTry - 1, false);
+ if (lbTmp > 0 && lbTmp < lbWorst && max(lbTmp, lbPref) < lbBest)
+ {
+ ichBestBreak = ichTry;
+ lbBest = max(lbTmp, lbPref); // any value better than lbPref is insignificant
+ }
+ else
+ {
+ lbTmp = getBreakWeight(ichTry - 1, true);
+ if (lbTmp < 0)
+ {
+ lbTmp = LineBrk(max(lbTmp * -1L, long(lbPref)));
+ if (lbTmp < lbWorst && lbTmp < lbBest)
+ {
+ ichBestBreak = ichTry - 1;
+ lbBest = lbTmp;
+ }
+ }
+ }
+ if (lbBest <= lbPref)
+ break;
+
+ ichTry--;
+ }
+
+ if (ichBestBreak > -1 && ichBestBreak > ichStart)
+ {
+ // Found a reasonable break by looking backward; return it.
+ ichBreak = ichBestBreak;// + m_ichwMin;
+ *pdxBreakWidth = getRangeWidth(ichStart, ichBestBreak, fStartLine, fEndLine);
+ return ichBreak;
+ }
+
+ // No reasonable break.
+ return ichStart - 1;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Private; used by findNextBreakPoint().
+----------------------------------------------------------------------------------------------*/
+float Segment::GlyphLeftEdge(int iginf)
+{
+ if (iginf >= m_cginf)
+ return m_prgginf[m_cginf - 1].origin() + m_prgginf[m_cginf - 1].advanceWidth();
+// return m_prgginf[m_cginf].origin() + m_prgginf[m_cginf].advanceWidth();
+ else
+ return m_prgginf[iginf].origin();
+}
+
+
+//:>********************************************************************************************
+//:> Other methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Get the embedded string. For temporary use; AddRef is not automatically called.
+ Do not release unless you AddRef.
+----------------------------------------------------------------------------------------------*/
+ITextSource * Segment::GetString()
+{
+ return m_pgts;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Compute the ascent, height, width, and overhangs of the segment.
+ The ascent is the ascent of the font (distance from the baseline to the top)
+ plus any extra ascent height specified by the font.
+ The descent is distance from the baseline to the bottom of font, plus any extra descent
+ specified by the font (ExtraDescent).
+ The ascent overhang is the distance from the top of the font to the top of the highest
+ glyph, or zero if all the glyphs fit within the ascent.
+ The descent overhang is the distance from the bottom of the font to the bottom of the lowest
+ glyph, or zero if all the glyphs fit within the descent.
+ The height is the sum of the ascent and descent.
+----------------------------------------------------------------------------------------------*/
+void Segment::ComputeDimensions()
+{
+ if (m_fEndLine)
+ m_dxsWidth = m_dxsVisibleWidth; // don't include trailing white space.
+ else
+ m_dxsWidth = m_dxsTotalWidth;
+
+ if (m_dxsWidth == -1)
+ {
+ for (int iginf = 0; iginf < m_cginf; iginf++)
+ {
+ GlyphInfo * pginf = m_prgginf + iginf;
+ if (pginf->isSpace())
+ continue;
+ m_dxsWidth = max(m_dxsWidth, (pginf->origin() + pginf->advanceWidth()));
+ }
+ }
+
+ int dysNegFontDescent = (int)m_dysFontDescent * -1;
+
+ // if there were no glyphs in the segment then there is sometimes no EngineImpl
+ if (!EngineImpl())
+ {
+ Assert(m_cslout == 0);
+ Assert(m_cginf == 0);
+ m_dxsWidth = 0;
+ m_dysAscent = 0; // max(0.0, m_dysFontAscent);
+ m_dysHeight = 0; // max(0.0, m_dysAscent - dysNegFontDescent);
+ m_dysAscentOverhang = 0;
+ m_dysDescentOverhang = 0;
+ m_dxsLeftOverhang = 0;
+ m_dxsRightOverhang = 0;
+ return;
+ }
+
+ // Calculate the extra ascent and descent.
+ int mXAscent = EngineImpl()->ExtraAscent();
+ int mXDescent = EngineImpl()->ExtraDescent();
+
+ m_dysXAscent = GrEngine::GrIFIMulDiv(mXAscent, m_xysEmSquare, m_mFontEmUnits);
+ m_dysXDescent = GrEngine::GrIFIMulDiv(mXDescent, m_xysEmSquare, m_mFontEmUnits);
+
+ m_dysAscent = m_dysFontAscent + m_dysXAscent;
+ float dysNegDescent = dysNegFontDescent - m_dysXDescent; // dysNegDescent < 0
+ m_dysHeight = m_dysAscent - dysNegDescent;
+
+ // Calculate the overhangs.
+ float dysVisAscent = m_dysAscent;
+ float dysNegVisDescent = dysNegDescent;
+ float dxsVisLeft = 0;
+ float dxsVisRight = m_dxsTotalWidth;
+ ComputeOverhangs(&dysVisAscent, &dysNegVisDescent, &dxsVisLeft, &dxsVisRight);
+ m_dysAscentOverhang = max(float(0), (dysVisAscent - m_dysAscent));
+ m_dysDescentOverhang = max(float(0), (dysNegDescent - dysNegVisDescent));
+ m_dxsLeftOverhang = min(float(0), dxsVisLeft);
+ m_dxsRightOverhang = max(float(0), dxsVisRight - m_dxsTotalWidth);
+
+ m_dysOffset = EngineImpl()->VerticalOffset();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Compute the visible ascent and descent, based on how much the bounding box of any
+ glyph may extend beyond the ascent or descent of the font.
+ Also compute the left- and right-overhangs.
+----------------------------------------------------------------------------------------------*/
+void Segment::ComputeOverhangs(float * pdysVisAscent, float * pdysNegVisDescent,
+ float * pdxsVisLeft, float * pdxsVisRight)
+{
+ for (int iginf = 0; iginf < m_cginf; iginf++)
+ {
+ *pdysVisAscent = max(*pdysVisAscent, m_prgginf[iginf].bb().top);
+ *pdysNegVisDescent = min(*pdysNegVisDescent, m_prgginf[iginf].bb().bottom);
+
+ *pdxsVisLeft = min(*pdxsVisLeft, m_prgginf[iginf].bb().left);
+ *pdxsVisRight = max(*pdxsVisRight, m_prgginf[iginf].bb().right);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Create the arrays to store the final output and association information.
+----------------------------------------------------------------------------------------------*/
+void Segment::SetUpOutputArrays(Font * pfont, GrTableManager * ptman,
+ GrSlotStream * psstrmFinal,
+ int cchwInThisSeg, int csloutSurface, gid16 chwLB,
+ TrWsHandling twsh, bool fParaRtl, int nDirDepth, bool fEmpty)
+{
+ m_mFontEmUnits = EngineImpl()->GetFontEmUnits();
+
+ pfont->getFontMetrics(&m_dysFontAscent, &m_dysFontDescent, &m_xysEmSquare);
+// m_xsDPI = (float)pfont->getDPIx();
+// m_ysDPI = (float)pfont->getDPIy();
+
+ // Note that storing both of these values is redundant; they should be the same.
+// Assert(m_xysEmSquare == m_pixHeight);
+
+ m_twsh = twsh;
+ m_fParaRtl = fParaRtl;
+ if (m_twsh == ktwshOnlyWs)
+ m_nDirDepth = (int)fParaRtl;
+ else if (fParaRtl && nDirDepth == 0)
+ m_nDirDepth = 2;
+ else
+ m_nDirDepth = nDirDepth;
+
+ // Create association mappings and set up final versions of slots.
+
+ Assert((psstrmFinal == NULL) == fEmpty);
+
+ m_ichwAssocsMin = 0;
+ m_ichwAssocsLim = cchwInThisSeg;
+
+ m_prgisloutBefore = new int[cchwInThisSeg];
+
+ m_prgisloutAfter = new int[cchwInThisSeg];
+
+ m_prgpvisloutAssocs = new std::vector<int> * [cchwInThisSeg];
+
+ m_prgisloutLigature = new int[cchwInThisSeg];
+
+ m_prgiComponent = new sdata8[cchwInThisSeg];
+
+ int cslot = 0;
+ //m_psstrm = psstrmFinal; // TODO: make a local variable
+ if (psstrmFinal)
+ cslot = psstrmFinal->FinalSegLim();
+ else
+ Assert(fEmpty);
+
+ float xsMin = 0;
+ int islot;
+ int islotMin = (psstrmFinal) ? psstrmFinal->IndexOffset() : 0;
+ for (islot = islotMin; islot < cslot; islot++)
+ xsMin = min(xsMin, psstrmFinal->SlotAt(islot)->XPosition());
+
+ // For right-to-left segments, the draw origin is at the left side of the visible
+ // portion of the text. So if necessary, scoot everything left so that the invisible
+ // trailing white-space is to the left of the draw position.
+ Assert(m_dxsTotalWidth > -1);
+ Assert(m_dxsVisibleWidth > -1);
+ float dxsInvisible = (m_fEndLine) ? m_dxsTotalWidth - m_dxsVisibleWidth : 0;
+ for (islot = islotMin; ((m_nDirDepth % 2) && (islot < cslot)); islot++)
+ {
+ GrSlotState * pslot = psstrmFinal->SlotAt(islot);
+ // int islout = islot - islotMin;
+ if (pslot->GlyphID() == chwLB)
+ continue; // skip over linebreak markers
+ if (m_nDirDepth % 2) // redundant test
+ {
+ // RTL will have descending neg values, adjust to be positive. Also make sure
+ // invisible trailing white space is to the left of the draw origin.
+ // Review: will changing this value have side affects?
+ pslot->SetXPos(pslot->XPosition() - xsMin - dxsInvisible);
+ }
+ }
+
+ Assert(kPosInfinity > 0);
+ Assert(kNegInfinity < 0);
+ for (int ichw = 0; ichw < cchwInThisSeg; ++ichw)
+ {
+ m_prgisloutBefore[ichw] = kPosInfinity;
+ m_prgisloutAfter[ichw] = kNegInfinity;
+ m_prgpvisloutAssocs[ichw] = new std::vector<int>;
+ m_prgisloutLigature[ichw] = kNegInfinity;
+ m_prgiComponent[ichw] = 0;
+ }
+
+ m_cslout = csloutSurface;
+ if (ptman->NumUserDefn() > 0 && ptman->NumCompPerLig() > 0)
+ {
+ int x; x = 3;
+ }
+
+// m_cnUserDefn = ptman->NumUserDefn();
+ m_cnCompPerLig = ptman->NumCompPerLig();
+// m_cnFeat = ptman->NumFeat();
+ // Normal buffers, plus underlying indices of ligature components, plus
+ // map from used components to defined components.
+// int cnExtraPerSlot = m_cnUserDefn + (m_cnCompPerLig * 2) + m_cnFeat + (m_cnCompPerLig * 2);
+
+ // We don't need to store the user-defined slot attributes or the features in the segment itself.
+ // What we need is: (1) component.ref attr settings, (2) slot-attribute indices,
+ // (3) underlying indicates of ligature components, and (4) map from used components
+ // to defined components
+ int cnExtraPerSlot = m_cnCompPerLig * 4;
+ m_prgslout = new GrSlotOutput[m_cslout];
+ m_prgnSlotVarLenBuf = new u_intslot[m_cslout * cnExtraPerSlot];
+
+ m_isloutVisLim = 0;
+ if (psstrmFinal)
+ {
+ for (islot = islotMin; islot < psstrmFinal->FinalSegLim(); ++islot)
+ {
+ int isloutRel = islot - islotMin;
+
+ GrSlotState * pslot = psstrmFinal->SlotAt(islot);
+ pslot->SetPosPassIndex(isloutRel, false);
+ pslot->EnsureCacheForOutput(ptman);
+ GrSlotOutput * pslout = OutputSlot(isloutRel);
+ pslout->SetBufferPtr(m_prgnSlotVarLenBuf + (isloutRel * cnExtraPerSlot));
+ pslout->InitializeOutputFrom(pslot);
+ pslout->SetBeforeAssoc(pslot->BeforeAssoc());
+ pslout->SetAfterAssoc(pslot->AfterAssoc());
+ if (pslot->HasComponents())
+ pslot->SetComponentRefsFor(pslout);
+ Assert(pslot->HasComponents() == (pslout->NumberOfComponents() > 0));
+ //if (pslot->HasClusterMembers())
+ //{
+ //Assert(pslot->HasClusterMembers() || pslot->ClusterRootOffset() == 0);
+ pslout->SetClusterXOffset(pslot->ClusterRootOffset() * -1);
+ pslout->SetClusterAdvance(pslot->ClusterAdvWidthFrom(0));
+
+ //}
+
+ if (!ptman->IsWhiteSpace(pslot))
+ m_isloutVisLim = islot + 1;
+ }
+ }
+
+ // Set up the clusters.
+ for (islot = islotMin; islot < m_cslout; islot++)
+ {
+ GrSlotState * pslot = psstrmFinal->SlotAt(islot);
+ int isloutAdj = islot - islotMin;
+ int isloutBaseIndex = pslot->Base(psstrmFinal)->PosPassIndex();
+ if (!pslot->IsBase())
+ {
+ OutputSlot(isloutBaseIndex)->AddClusterMember(isloutBaseIndex, pslot->PosPassIndex());
+ OutputSlot(isloutAdj)->SetClusterBase(isloutBaseIndex);
+ }
+ else if (pslot->HasClusterMembers() && pslot->IsBase())
+ {
+ Assert(isloutBaseIndex == islot - islotMin);
+ OutputSlot(isloutAdj)->SetClusterBase(isloutBaseIndex);
+ }
+ }
+
+ ///AssertValidClusters(psstrmFinal);
+
+#ifdef OLD_TEST_STUFF
+ if (ptman->GlyphTable() == NULL)
+ return; // test procedures
+#endif // OLD_TEST_STUFF
+
+ // CalcPositionsUpTo() called on final pass already from Table Mgr
+
+ // Final output for draw routines.
+
+ SetUpGlyphInfo(ptman, psstrmFinal, chwLB, nDirDepth, islotMin, cslot);
+
+ //SetUpOutputArraysPlatform(ptman, chwLB, nDirDepth, islotMin, cslot);
+
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set up the data structures that represent the actual rendered glyphs for the new segment.
+----------------------------------------------------------------------------------------------*/
+void Segment::SetUpGlyphInfo(GrTableManager * ptman, GrSlotStream * psstrmFinal,
+ gid16 chwLB, int nDirDepth, int islotMin, int cslot)
+{
+ //int paraDirLevel = (ptman->State()->ParaRightToLeft()) ? 1 : 0;
+
+ m_cginf = 0;
+
+ int islot;
+ for (islot = islotMin; islot < cslot; islot++)
+ {
+ if (psstrmFinal->SlotAt(islot)->GlyphID() != chwLB)
+ {
+ m_cginf++;
+ }
+ }
+
+ // For right-to-left segments, the draw origin will be at the left side of the visible
+ // portion of the text. So if necessary, scoot everything left so that the invisible
+ // trailing white-space is to the left of the draw position.
+ Assert(m_dxsTotalWidth > -1);
+ Assert(m_dxsVisibleWidth > -1);
+ //float dxsInvisible = (m_fEndLine) ? m_dxsTotalWidth - m_dxsVisibleWidth : 0;
+
+ m_prgginf = new GlyphInfo [m_cginf];
+
+ m_isloutGinf0 = -1;
+ int iginf = 0;
+ for (int islot = islotMin; islot < cslot; islot++)
+ {
+ GrSlotState * pslot = psstrmFinal->SlotAt(islot);
+
+ if (pslot->GlyphID() == chwLB)
+ {
+ continue; // skip over linebreak markers
+ }
+
+ int islout = islot - islotMin;
+ GrSlotOutput * pslout = OutputSlot(islout);
+
+ if (m_isloutGinf0 == -1)
+ m_isloutGinf0 = islout;
+
+ m_prgginf[iginf].m_pslout = pslout;
+ m_prgginf[iginf].m_islout = islout;
+ m_prgginf[iginf].m_pseg = this;
+
+ // Fill in stuff in the output slot that is needed by the GlyphInfo object.
+ pslout->m_xsAdvanceX = pslot->GlyphMetricLogUnits(ptman, kgmetAdvWidth);
+ //pslout->m_ysAdvanceY = pslot->GlyphMetricLogUnits(ptman, kgmetAdvHeight);
+ //pslout->m_rectBB.top
+ // = pslot->YPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbTop);
+ //pslout->m_rectBB.bottom
+ // = pslot->YPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbBottom);
+ //pslout->m_rectBB.left
+ // = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbLeft);
+ //if (pslot->IsSpace(ptman))
+ // pslout->m_rectBB.right
+ // = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetAdvWidth);
+ //else
+ // pslout->m_rectBB.right
+ // = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbRight);
+
+ iginf++;
+ }
+
+ if (cslot - islotMin == 0)
+ m_isloutGinf0 = 0;
+ if (m_isloutGinf0 == -1)
+ {
+ Assert(m_cginf == 0);
+ m_isloutGinf0 = ((OutputSlot(0)->IsInitialLineBreak()) ? 1 : 0);
+ }
+
+ Assert(m_isloutGinf0 == 0 || m_isloutGinf0 == 1);
+}
+
+/*
+// OLD VERSION
+void Segment::SetUpGlyphInfo(GrTableManager * ptman, GrSlotStream * psstrmFinal, gid16 chwLB, int nDirDepth,
+ int islotMin, int cslot)
+{
+ int paraDirLevel = (ptman->State()->ParaRightToLeft()) ? 1 : 0;
+
+ m_cginf = 0;
+ int islot;
+ for (islot = islotMin; islot < cslot; islot++)
+ {
+ if (psstrmFinal->SlotAt(islot)->GlyphID() != chwLB)
+ m_cginf++;
+ }
+
+ // For right-to-left segments, the draw origin will be at the left side of the visible
+ // portion of the text. So if necessary, scoot everything left so that the invisible
+ // trailing white-space is to the left of the draw position.
+ Assert(m_dxsTotalWidth > -1);
+ Assert(m_dxsVisibleWidth > -1);
+ float dxsInvisible = (m_fEndLine) ? m_dxsTotalWidth - m_dxsVisibleWidth : 0;
+
+ m_prgginf = new GlyphInfo [m_cginf];
+
+ // Fill in glyph information structures.
+ m_isloutGinf0 = -1;
+ for (islot = islotMin; islot < cslot; islot++)
+ {
+ GrSlotState * pslot = psstrmFinal->SlotAt(islot);
+
+ int islout = islot - islotMin;
+ if (pslot->GlyphID() == chwLB)
+ {
+ continue; // skip over linebreak markers
+ }
+ if (m_isloutGinf0 == -1)
+ m_isloutGinf0 = islout;
+
+ GrSlotOutput * pslout = OutputSlot(islout);
+
+ int iginf = islout - m_isloutGinf0;
+ GlyphInfo & ginf = m_prgginf[iginf];
+
+ ginf.glyphID = pslot->ActualGlyphForOutput(ptman);
+ ginf.pseudoGlyphID = pslot->GlyphID();
+ if (ginf.glyphID == ginf.pseudoGlyphID)
+ ginf.pseudoGlyphID = 0;
+
+ ginf.isSpace = pslot->IsSpace(ptman);
+
+ ginf.origin = pslot->XPosition();
+ ginf.yOffset = pslot->YPosition();
+
+ ginf.bbLeft = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbLeft);
+ ginf.bbTop = pslot->YPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbTop);
+ if (ginf.isSpace)
+ {
+ ginf.bbRight = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetAdvWidth);
+ }
+ else
+ {
+ ginf.bbRight = pslot->XPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbRight);
+ }
+ ginf.bbBottom = pslot->YPosition() + pslot->GlyphMetricLogUnits(ptman, kgmetBbBottom);
+
+ ginf.advanceWidth = pslot->GlyphMetricLogUnits(ptman, kgmetAdvWidth);
+ ginf.advanceHeight = 0;
+
+ if (pslot->AttachTo() == 0) // not attached
+ ginf.attachedTo = -1;
+ else
+ ginf.attachedTo = pslot->AttachTo() + islot;
+
+ ginf.directionality = byte(pslot->Directionality());
+ if (pslot->DirLevel() == -1)
+ ginf.directionLevel = paraDirLevel;
+ else
+ ginf.directionLevel = byte(pslot->DirLevel());
+
+ //ginf.firstChar = LogicalSurfaceToUnderlying(islout, true);
+ //ginf.lastChar = LogicalSurfaceToUnderlying(islout, false);
+
+ if (pslot->HasComponents())
+ {
+ SetUpLigInfo(ptman, ginf, pslout);
+ }
+ else
+ {
+ ginf.numberOfComponents = 0;
+ ginf.components = NULL;
+ }
+
+ ginf.insertBefore = pslot->InsertBefore();
+
+ ginf.maxStretch[0] = ptman->EmToLogUnits(pslot->JStretch());
+ ginf.maxShrink[0] = ptman->EmToLogUnits(pslot->JShrink());
+ ginf.stretchStep[0]= ptman->EmToLogUnits(pslot->JStep());
+ ginf.justWidth[0] = ptman->EmToLogUnits(pslot->JWidth());
+ ginf.justWeight[0] = pslot->JWeight();
+
+ ginf.measureStartOfLine = pslout->MeasureSolLogUnits();
+ ginf.measureEndOfLine = pslout->MeasureEolLogUnits();
+ }
+}
+*/
+
+/*----------------------------------------------------------------------------------------------
+ Set up the data structures that represent the components of a ligature glyph.
+----------------------------------------------------------------------------------------------*/
+/*
+void Segment::SetUpLigInfo(GrTableManager * ptman, GlyphInfo & ginf, GrSlotOutput * pslout)
+{
+ GrGlyphTable * pgtbl = ptman->GlyphTable();
+
+ int ccomp = pslout->NumberOfComponents();
+ ginf.numberOfComponents = ccomp;
+ ginf.components = new ComponentBox[ccomp];
+ for (int icomp = 0; icomp < ccomp; icomp++)
+ {
+ ComponentBox & cb = ginf.components[icomp];
+
+ // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph.
+ float xsLeft, xsRight, ysTop, ysBottom;
+ int slati = pslout->ComponentId(icomp);
+ int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati);
+ pgtbl->ComponentBoxLogUnits(m_xysEmSquare, pslout->GlyphID(), iForGlyph,
+ m_mFontEmUnits, m_dysAscent,
+ &xsLeft, &ysTop, &xsRight, &ysBottom, false);
+
+ cb.firstChar = pslout->UnderlyingComponent(icomp);
+ cb.lastChar = cb.firstChar; // TODO: is this supported?
+ cb.left = xsLeft;
+ cb.right = xsRight;
+ cb.top = ysTop;
+ cb.bottom = ysBottom;
+ }
+}
+*/
+
+
+// --------- OBSOLETE - replaced by GrTableManager::AdjustAssocsForOverlaps() ---------------
+#if 0
+
+/*----------------------------------------------------------------------------------------------
+ Now that this segment is finished and has its associations set, handle any overlaps in
+ the associations between the previous segment and this one.
+
+ Review: Think about whether we need to distinguish between before==kPosInfinity meaning
+ that the glyph is in the next segment vs. there is no association at all.
+ OBSOLETE
+----------------------------------------------------------------------------------------------*/
+void Segment::AdjustForOverlapsWithPrevSeg()
+{
+ if (m_psegPrev)
+ {
+ AdjustBeforeArrayFromPrevSeg();
+ m_psegPrev->AdjustAfterArrayFromNextSeg();
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ For any characters that are officially in this segment but are rendered in
+ the previous segment, initialize this segment's before array appropriately. Specifically,
+ set this segment's before value to something invalid--negative infinity, which will
+ never be overwritten.
+ OBSOLETE - replaced by AdjustAfterArrayFromNextSeg
+----------------------------------------------------------------------------------------------*/
+void Segment::InitBeforeArrayFromPrevSeg()
+{
+ Assert(m_psegPrev);
+
+ int ichwPrevMin = m_psegPrev->m_ichwMin;
+ int ichwPrevLim = m_psegPrev->m_ichwLim;
+// int ichwPrevContextLim =
+// m_psegPrev->m_ichwAssocsLim - m_psegPrev->m_ichwAssocsMin + m_psegPrev->m_ichwMin;
+ int cchwPrevAssocsMin = m_psegPrev->m_ichwAssocsMin;
+ int cchwPrevAssocsLim = m_psegPrev->m_ichwAssocsLim;
+
+ // Loop over associations appended to the end of the previous segment;
+ // ichwPrev and ichwThis are relative to the start of their respective segments.
+ for (int ichwPrev = ichwPrevLim - ichwPrevMin; ichwPrev < cchwPrevAssocsLim; ++ichwPrev)
+ {
+ int ichwThis = ichwPrev - (ichwPrevLim - ichwPrevMin); // relative to start of this seg
+ if (m_psegPrev->m_prgisloutBefore[ichwPrev - cchwPrevAssocsMin] < kPosInfinity)
+ // The "before" value is in the previous segment, so make this segment's
+ // before value invalid.
+ m_prgisloutBefore[ichwThis - m_ichwAssocsMin] = kNegInfinity;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ For any associations that overlap between the previous segment and this, adjust
+ this segment's before array appropriately. Specifically, for any characters that
+ are rendered in both, set this segment's before value to something invalid.
+ OBSOLETE
+----------------------------------------------------------------------------------------------*/
+void Segment::AdjustBeforeArrayFromPrevSeg()
+{
+ Assert(m_psegPrev);
+
+ int ichwPrevMin = m_psegPrev->m_ichwMin;
+ int ichwPrevLim = m_psegPrev->m_ichwLim;
+ int ichwPrevAssocsMin = m_psegPrev->m_ichwAssocsMin;
+ int ichwPrevAssocsLim = m_psegPrev->m_ichwAssocsLim;
+
+ // Loop over associations appended to the end of the previous segment
+ // (ie, rendered in the previous segment but officially in this one);
+ // ichwPrev and ichwThis are relative to the start of their respective segments.
+ for (int ichwPrev = ichwPrevLim - ichwPrevMin; ichwPrev < ichwPrevAssocsLim; ++ichwPrev)
+ {
+ int ichwThis = ichwPrev - (ichwPrevLim - ichwPrevMin); // relative to start of this seg
+ if (m_psegPrev->m_prgisloutBefore[ichwPrev - ichwPrevAssocsMin] < kPosInfinity)
+ // The "before" value is in the previous segment, so make this segment's
+ // before value invalid.
+ m_prgisloutBefore[ichwThis - m_ichwAssocsMin] = kNegInfinity;
+ }
+ // Loop over associations prepended to the start of this segment
+ // (ie, rendered in this segment but officially in the previous one);
+ // ichwPrev and ichwThis are relative to the start of their respective segments.
+ for (int ichwThis = m_ichwAssocsMin; ichwThis < 0; ++ichwThis)
+ {
+ int ichwPrev = ichwThis + (ichwPrevLim - ichwPrevMin);
+ if (m_psegPrev->m_prgisloutBefore[ichwPrev - ichwPrevAssocsMin] < kPosInfinity)
+ // The "before" value is in the previous segment, so make this segment's
+ // before value invalid.
+ m_prgisloutBefore[ichwThis - m_ichwAssocsMin] = kNegInfinity;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ For any associations that overlap between this segment and the next, adjust
+ this segment's after array appropriately. Specifically, for any characters that
+ are rendered in both, set this segment's after value to something invalid.
+ OBSOLETE
+----------------------------------------------------------------------------------------------*/
+void Segment::AdjustAfterArrayFromNextSeg()
+{
+ Assert(m_psegNext);
+
+ int ichwNextMin = m_psegNext->m_ichwMin;
+ int ichwNextContextMin = ichwNextMin + m_psegNext->m_ichwAssocsMin;
+ int ichwNextAssocsMin = m_psegNext->m_ichwAssocsMin;
+
+ // Loop over associations prepended to the beginning of the following segment
+ // (ie, rendered in the next segment but officially in this one);
+ // ichwThis and ichwNext are relative to the start of their respective segments.
+ for (int ichwNext = cchwNextAssocsMin; ichwNext < 0; ++ichwNext)
+ {
+ int ichwThis = ichwNext + (m_ichwLim - m_ichwMin);
+ if (m_psegNext->m_prgisloutAfter[ichwNext - ichwNextAssocsMin] > kNegInfinity)
+ // The "after" value is in the next segment, so make this segment's
+ // after value invalid.
+ m_prgisloutAfter[ichwThis - m_ichwAssocsMin] = kPosInfinity;
+ }
+
+ // Loop over associations appended to the end of this segment
+ // (ie, rendered in this segment but officially in the next one);
+ // ichwThis and ichwNext are relative to the start of their respective segments.
+ for (int ichwThis = m_ichwLim - m_ichwMin; ichwThis < m_cchwAssocsLim; ++ichwThis)
+ {
+ int ichwNext = ichwThis - (m_ichwLim - m_ichwMin);
+ if (m_psegNext->m_prgisloutAfter[ichwNext - ichwNextAssocsMin] > kNegInfinity)
+ // The "after" value is in the next segment, so make this segment's
+ // after value invalid.
+ m_prgisloutAfter[ichwThis - m_ichwAssocsMin] = kPosInfinity;
+ }
+}
+
+#endif // -------------------------- END OF OBSOLETE CODE ----------------------------------
+
+
+/*----------------------------------------------------------------------------------------------
+ Generate a list of all the glyphs that are attached to the base with the given index.
+ Note that we want to generate glyph indices, not slot indices.
+
+ @param disloutCluster - indicates how far on either side of the base to look.
+----------------------------------------------------------------------------------------------*/
+void Segment::ClusterMembersForGlyph(int isloutBase, int disloutCluster,
+ std::vector<int> & visloutRet)
+{
+ for (int islout = max(0, isloutBase - disloutCluster);
+ islout < min(m_cslout, isloutBase + disloutCluster + 1);
+ islout++)
+ {
+ if (islout == isloutBase)
+ continue; // don't include the base itself
+ GrSlotOutput * pslout = m_prgslout + islout;
+ if (pslout->ClusterBase() == isloutBase)
+ {
+ visloutRet.push_back(islout);
+ }
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Record an underlying-to-surface association mapping, based on the fact that there is
+ a corresponding surface-to-underlying association in the streams.
+
+ @param ichwUnder - character index relative to the official beginning of the segment
+ @param islotSurface - surface glyph it maps to
+----------------------------------------------------------------------------------------------*/
+void Segment::RecordSurfaceAssoc(int ichwUnder, int islotSurface, int nDir)
+{
+ // If we are recording an association across the line boundary, make sure there
+ // is space for it.
+ EnsureSpaceAtLineBoundaries(ichwUnder);
+
+ // For left-to-right chars, the before-value is the minimum of the previous
+ // and new values, and the after-value is the maximum.
+ if (nDir % 2 == 0)
+ {
+ // left-to-right
+ m_prgisloutBefore[ichwUnder - m_ichwAssocsMin] =
+ min(m_prgisloutBefore[ichwUnder - m_ichwAssocsMin], islotSurface);
+ m_prgisloutAfter[ ichwUnder - m_ichwAssocsMin] =
+ max(m_prgisloutAfter[ ichwUnder - m_ichwAssocsMin], islotSurface);
+ }
+ else
+ {
+ // right-to-left: the before-value is the max and the after-value is the min
+ m_prgisloutBefore[ichwUnder - m_ichwAssocsMin] =
+ max(m_prgisloutBefore[ichwUnder - m_ichwAssocsMin], islotSurface);
+ m_prgisloutAfter[ ichwUnder - m_ichwAssocsMin] =
+ min(m_prgisloutAfter[ ichwUnder - m_ichwAssocsMin], islotSurface);
+ }
+
+ m_prgpvisloutAssocs[ichwUnder - m_ichwAssocsMin]->push_back(islotSurface);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Record an underlying-to-surface ligature mapping, based on the fact that there is
+ a component.ref attribute in the surface stream. Note that if there was a previous
+ ligature value there, it will be overwritten.
+
+ @param ichwUnder - character index relative to the official beginning of the segment
+ @param islotSurface - surface glyph it maps to
+ @param iComponent - which component this glyph represents
+----------------------------------------------------------------------------------------------*/
+void Segment::RecordLigature(int ichwUnder, int islotSurface, int iComponent)
+{
+ // If we are recording a mapping across the line boundary, make sure there
+ // is space for it.
+ EnsureSpaceAtLineBoundaries(ichwUnder);
+
+ Assert(m_prgisloutLigature[ichwUnder - m_ichwAssocsMin] == kNegInfinity);
+
+ m_prgisloutLigature[ichwUnder - m_ichwAssocsMin] = islotSurface;
+ Assert(iComponent < kMaxComponentsPerGlyph);
+ m_prgiComponent[ ichwUnder - m_ichwAssocsMin] = sdata8(iComponent);
+}
+
+/*----------------------------------------------------------------------------------------------
+ The given slot is one that is rendered in the previous segment.
+ If it is associated with a character officially in this segment, mark the
+ before-association kNegInfinity.
+
+ @param ichwUnder - character index relative to the official beginning of the segment
+ @param islot - processed glyph it maps to
+----------------------------------------------------------------------------------------------*/
+void Segment::MarkSlotInPrevSeg(int ichwUnder, int islot)
+{
+ if (ichwUnder >= m_ichwAssocsMin)
+ m_prgisloutBefore[ichwUnder - m_ichwAssocsMin] = kNegInfinity;
+}
+
+/*----------------------------------------------------------------------------------------------
+ The given slot is one that is rendered in the following segment.
+ If it is associated with a character officially in this segment, mark the
+ after-association kPosInfinity.
+
+ @param ichwUnder - character index relative to the official beginning of the segment
+ @param islot - processed glyph it maps to
+----------------------------------------------------------------------------------------------*/
+void Segment::MarkSlotInNextSeg(int ichwUnder, int islot)
+{
+ if (ichwUnder < m_ichwAssocsLim)
+ m_prgisloutAfter[ichwUnder - m_ichwAssocsMin] = kPosInfinity;
+}
+
+/*----------------------------------------------------------------------------------------------
+ If we are recording an association across the line boundary (in either direction),
+ make sure there is space for it. This involves adding space to the beginning or
+ the end of the association arrays, and adjusting the min and lim indicators.
+----------------------------------------------------------------------------------------------*/
+void Segment::EnsureSpaceAtLineBoundaries(int ichwUnder)
+{
+ int cchwNewMin = min(ichwUnder, m_ichwAssocsMin);
+ int cchwNewLim = max(ichwUnder+1, m_ichwAssocsLim);
+ if (cchwNewMin < m_ichwAssocsMin || cchwNewLim > m_ichwAssocsLim)
+ {
+ // Make space either at the beginning or the end of the arrays.
+ int cchwPreAdd = m_ichwAssocsMin - cchwNewMin;
+ int cchwPostAdd = cchwNewLim - m_ichwAssocsLim;
+
+ int * prgisloutTmp = m_prgisloutBefore;
+ m_prgisloutBefore = new int[cchwNewLim - cchwNewMin];
+ std::copy(prgisloutTmp, prgisloutTmp + (m_ichwAssocsLim - m_ichwAssocsMin),
+ m_prgisloutBefore + cchwPreAdd);
+ delete[] prgisloutTmp;
+
+ prgisloutTmp = m_prgisloutAfter;
+ m_prgisloutAfter = new int[cchwNewLim - cchwNewMin];
+ std::copy(prgisloutTmp, prgisloutTmp + (m_ichwAssocsLim - m_ichwAssocsMin),
+ m_prgisloutAfter + cchwPreAdd);
+ delete[] prgisloutTmp;
+
+ std::vector<int> ** ppvisloutTmp = m_prgpvisloutAssocs;
+ m_prgpvisloutAssocs = new std::vector<int> * [cchwNewLim - cchwNewMin];
+ std::swap_ranges(m_prgpvisloutAssocs + cchwPreAdd,
+ m_prgpvisloutAssocs + cchwPreAdd +
+ (m_ichwAssocsLim - m_ichwAssocsMin), ppvisloutTmp);
+ delete[] ppvisloutTmp;
+
+ prgisloutTmp = m_prgisloutLigature;
+ m_prgisloutLigature = new int[cchwNewLim - cchwNewMin];
+ std::copy(prgisloutTmp, prgisloutTmp + (m_ichwAssocsLim - m_ichwAssocsMin),
+ m_prgisloutLigature + cchwPreAdd);
+ delete[] prgisloutTmp;
+
+ sdata8 * prgiCompTmp = m_prgiComponent;
+ m_prgiComponent = new sdata8[cchwNewLim - cchwNewMin];
+ std::copy(prgiCompTmp, prgiCompTmp + (m_ichwAssocsLim - m_ichwAssocsMin),
+ m_prgiComponent + cchwPreAdd);
+ delete[] prgiCompTmp;
+
+ // Initialize new slots.
+ int i;
+ for (i = 0; i < cchwPreAdd; ++i)
+ {
+ m_prgisloutBefore[i] = kPosInfinity;
+ m_prgisloutAfter[i] = kNegInfinity;
+ m_prgpvisloutAssocs[i] = new std::vector<int>;
+ m_prgisloutLigature[i] = kNegInfinity;
+ m_prgiComponent[i] = 0;
+ }
+ for (i = m_ichwAssocsLim - m_ichwAssocsMin + cchwPreAdd;
+ i < m_ichwAssocsLim - m_ichwAssocsMin + cchwPreAdd + cchwPostAdd;
+ ++i)
+ {
+ m_prgisloutBefore[i] = kPosInfinity;
+ m_prgisloutAfter[i] = kNegInfinity;
+ m_prgpvisloutAssocs[i] = new std::vector<int>;
+ m_prgisloutLigature[i] = kNegInfinity;
+ m_prgiComponent[i] = 0;
+ }
+ m_ichwAssocsMin = cchwNewMin;
+ m_ichwAssocsLim = cchwNewLim;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the given output slot.
+----------------------------------------------------------------------------------------------*/
+GrSlotOutput * Segment::OutputSlot(int islout)
+{
+ return m_prgslout + islout;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set the rendering engine to the current one.
+----------------------------------------------------------------------------------------------*/
+void Segment::SetEngine(GrEngine * pgreng)
+{
+ //if (m_preneng)
+ // m_preneng->DecRefCount();
+ m_preneng = pgreng;
+ //if (m_preneng)
+ // m_preneng->IncRefCount();
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set the font.
+----------------------------------------------------------------------------------------------*/
+void Segment::SetFont(Font * pfont)
+{
+ m_pfont = pfont->copyThis();
+
+// m_fBold = pfont->bold();
+// m_fItalic = pfont->italic();
+ // Note that we store the character height (which does not include the internal leading),
+ // not the actual font height, ie, ascent + descent. This is what is used in the LOGFONT.
+ pfont->getFontMetrics(NULL, NULL, &m_xysEmSquare); // m_xysEmSquare = m_pixHeight
+}
+
+/*----------------------------------------------------------------------------------------------
+ Switch the font out.
+ ??? Do we need to change the member variables too?
+----------------------------------------------------------------------------------------------*/
+void Segment::SwitchFont(Font * pfont)
+{
+ m_pfont = pfont;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the engine implementation if it is a proper GrEngine, or NULL otherwise.
+----------------------------------------------------------------------------------------------*/
+GrEngine * Segment::EngineImpl()
+{
+ return m_preneng;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set the justification agent, in case this segment will ever need to be stretched
+ or shrunk.
+----------------------------------------------------------------------------------------------*/
+void Segment::SetJustifier(IGrJustifier * pgjus)
+{
+ m_pgjus = pgjus;
+ //if (pgjus)
+ // pgjus->JustifierObject(&m_pgjus);
+ //else
+ // m_pgjus = NULL;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set the graphics object to use the base font.
+----------------------------------------------------------------------------------------------*/
+//void Segment::SetToBaseFont(IGrGraphics * pgg)
+//{
+// if (m_fUseSepBase)
+// EngineImpl()->SwitchGraphicsFont(pgg, true);
+//}
+
+/*----------------------------------------------------------------------------------------------
+ Restore the graphics object to use the font that it originally had when passed in to
+ the interface method.
+----------------------------------------------------------------------------------------------*/
+//void Segment::RestoreFont(IGrGraphics * pgg)
+//{
+// if (m_fUseSepBase)
+// EngineImpl()->SwitchGraphicsFont(pgg, false);
+//}
+
+/*----------------------------------------------------------------------------------------------
+ Given a logical surface location, return the underlying position (relative to the
+ beginning of the string). NOTE that we are returning the index of the closest charater
+ (plus an indication of which side the click was on), not a position between characters.
+
+ @param islout - output slot
+ @param xsOffset - x coordinate of physical click, relative to left of glyph;
+ kPosInfinity means all the way to the right;
+ kNegInfinity means all the way to the left
+ @param ysOffset - y coordinate of physical click, relative to TOP of segment (NOT
+ upwards from baseline); kPosInfinity means all the way at
+ the top; kNegInfinity means all the way at the bottom
+ @param dxsGlyphWidth - width of glyph clicked on, or 0 if irrelevant
+ @param dysGlyphHeight - actually line height -- CURRENTLY NOT USED
+ @param pfAfter - return true if they clicked on trailing side; possibly NULL
+----------------------------------------------------------------------------------------------*/
+int Segment::LogicalSurfaceToUnderlying(int islout, float xsOffset, float ysClick,
+ float dxsGlyphWidth, float dysGlyphHeight, bool * pfAfter)
+{
+ Assert(islout >= 0);
+ Assert(islout < m_cslout);
+
+ GrSlotOutput * pslout = OutputSlot(islout);
+ bool fGlyphRtl = SlotIsRightToLeft(pslout);
+
+ int dichw;
+ bool fAfter, fRight;
+
+ float ysForGlyph = pslout->YPosition();
+
+ float dysFontAscent = m_dysFontAscent;
+ ////GrResult res = GetFontAscentSourceUnits(pgg, &dysFontAscent);
+ ////if (ResultFailed(res))
+ //// THROW(WARN(res));
+ dysFontAscent += m_dysXAscent;
+
+ float dysOffset = ysClick - (m_dysAscent - dysFontAscent); // relative to top of 0-baseline text
+
+ // If the slot has components, see if the offset falls within one of them.
+
+ if (pslout->NumberOfComponents() > 0)
+ {
+ GrEngine * pgreng = EngineImpl();
+ if (!pgreng)
+ goto LNotLigature;
+
+ GrGlyphTable * pgtbl = pgreng->GlyphTable();
+
+ for (int icomp = 0; icomp < pslout->NumberOfComponents(); icomp++)
+ {
+ float xsLeft, xsRight, ysTop, ysBottom;
+
+ // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph.
+ int slati = pslout->ComponentId(icomp);
+ int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati);
+ if (!pgtbl->ComponentBoxLogUnits(m_xysEmSquare, pslout->GlyphID(), iForGlyph,
+ m_mFontEmUnits, m_dysAscent,
+ &xsLeft, &ysTop, &xsRight, &ysBottom))
+ {
+ continue; // component not defined
+ }
+ Assert(xsLeft <= xsRight);
+ Assert(ysTop <= ysBottom);
+ if (xsOffset < xsLeft || xsOffset > xsRight)
+ continue;
+ if ((dysOffset - ysForGlyph) < ysTop || (dysOffset - ysForGlyph) > ysBottom)
+ continue;
+
+ // Click was within the component's box.
+
+ dichw = pslout->UnderlyingComponent(icomp);
+ Assert(m_ichwMin + dichw >= 0);
+ Assert(dichw < m_dichwLim);
+
+ fRight = (xsOffset - xsLeft > xsRight - xsOffset);
+ fAfter = (fGlyphRtl) ? !fRight : fRight;
+ if (pfAfter)
+ *pfAfter = fAfter;
+
+ Assert(GrCharStream::AtUnicodeCharBoundary(m_pgts, m_ichwMin + dichw));
+
+ return m_ichwMin + dichw;
+ }
+ }
+
+LNotLigature:
+
+ // No relevant ligature component.
+ // If the x-offset is less than half way across,
+ // answer the before-association; otherwise answer the after-association.
+
+ if (xsOffset == kPosInfinity)
+ fRight = true;
+ else if (xsOffset == kNegInfinity)
+ fRight = false;
+ else
+ fRight = (xsOffset > (dxsGlyphWidth / 2));
+
+ fAfter = (fGlyphRtl) ? !fRight : fRight;
+
+ int diCharAdj = 0;
+ if (fAfter)
+ {
+ dichw = pslout->AfterAssoc();
+ if (pfAfter)
+ *pfAfter = true;
+ // The following should not be necessary because of the way associations are set up:
+ //while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichwBase + dichw + diCharAdj))
+ // diCharAdj++;
+ }
+ else
+ {
+ dichw = pslout->BeforeAssoc();
+ if (pfAfter)
+ *pfAfter = false;
+ // The following should not be necessary because of the way associations are set up:
+ //while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichwBase + dichw + diCharAdj))
+ // diCharAdj--;
+ }
+
+ if (dichw == kNegInfinity || dichw == kPosInfinity)
+ return dichw;
+
+ // This should be true because of the way the associations are set up:
+ Assert(GrCharStream::AtUnicodeCharBoundary(m_pgts, m_ichwMin + dichw)); // + diCharAdj));
+
+ return m_ichwMin + dichw + diCharAdj;
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+int Segment::LogicalSurfaceToUnderlying(int islout, bool fBefore)
+{
+ if (fBefore)
+ return LogicalSurfaceToUnderlying(islout, kNegInfFloat, kNegInfFloat);
+ else
+ return LogicalSurfaceToUnderlying(islout, kPosInfFloat, kPosInfFloat);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Given a physical surface location (an index into the glyph boxes),
+ return the underlying position, relative to the beginning of the string.
+
+ @param igbb - index of glyph
+ @param xsOffset - relative to left side of glyph
+ @param ysOffset - downwards from top of segment (not upwards from baseline)
+----------------------------------------------------------------------------------------------*/
+int Segment::PhysicalSurfaceToUnderlying(
+ int iginf, float xsOffset, float ysOffset,
+ float dxsGlyphWidth, float dysGlyphHeight, bool * pfAfter)
+{
+ int islout = iginf + m_isloutGinf0;
+ return LogicalSurfaceToUnderlying(islout, xsOffset, ysOffset,
+ dxsGlyphWidth, dysGlyphHeight, pfAfter);
+}
+
+/*--------------------------------------------------------------------------------------------*/
+
+int Segment::PhysicalSurfaceToUnderlying(int iginf, bool fBefore)
+{
+ int islout = iginf + m_isloutGinf0;
+ bool fGlyphRtl = SlotIsRightToLeft(OutputSlot(islout));
+ if (fBefore == fGlyphRtl)
+ return PhysicalSurfaceToUnderlying(iginf, kPosInfFloat, kPosInfFloat);
+ else
+ return PhysicalSurfaceToUnderlying(iginf, kNegInfFloat, kNegInfFloat);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Given an underlying position (relative to the beginning of the string),
+ return the logical surface location (ignoring right-to-left).
+ NOTE that ichw indicates a CHARACTER, not a location between characters. So ichw = 3,
+ fBefore = false indicates a selection between characters 3 and 4.
+ For surrogates, it indicates the FIRST of the pair of 16-bit chars.
+----------------------------------------------------------------------------------------------*/
+int Segment::UnderlyingToLogicalSurface(int ichw, bool fBefore)
+{
+ int ichwSegOffset = ichw - m_ichwMin;
+
+ if (ichwSegOffset < m_ichwAssocsMin)
+ return kNegInfinity; // probably rendered in previous segment
+
+
+ // if the buffers aren't even allocated, then it probably means there
+ // wasn't room for any glyphs, so the following segment is most likely
+// else if (ichwSegOffset >= m_ichwAssocsLim)
+ else if (ichwSegOffset >= m_ichwAssocsLim || !m_prgisloutBefore || !m_prgisloutAfter)
+ return kPosInfinity; // probably rendered in following segment
+
+ else if (fBefore)
+ {
+ int isloutRet;
+ int ichw = ichwSegOffset;
+ // If no association has been made, loop forward to the next slot
+ // we are before. As a last resort, answer kPosInfinity, meaning we
+ // aren't before anything.
+ do
+ {
+ isloutRet = m_prgisloutBefore[ichw - m_ichwAssocsMin];
+ do { ++ichw; }
+ while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichw));
+ } while (isloutRet == kPosInfinity && ichw < m_ichwAssocsLim);
+ return isloutRet;
+ }
+ else
+ {
+ int isloutRet;
+ int ichw = ichwSegOffset;
+ // If no association has been made, loop backward to the previous slot
+ // we are after. As a last resort, answer kNegInfinity, meaning we
+ // aren't after anything.
+ do
+ {
+ isloutRet = m_prgisloutAfter[ichw - m_ichwAssocsMin];
+ do { --ichw; }
+ while (!GrCharStream::AtUnicodeCharBoundary(m_pgts, ichw));
+ } while (isloutRet == kNegInfinity && ichw >= 0);
+ return isloutRet;
+ }
+ Assert(false); // should never reach here
+}
+
+/*----------------------------------------------------------------------------------------------
+ Given an underlying position (relative to the beginning of the string),
+ return the physical surface location, the index into m_prgginf.
+----------------------------------------------------------------------------------------------*/
+int Segment::UnderlyingToPhysicalSurface(int ichw, bool fBefore)
+{
+ int islout = UnderlyingToLogicalSurface(ichw, fBefore);
+ return LogicalToPhysicalSurface(islout);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Given a logical position (index into output slots), return the physical position,
+ the index into the list of glyphs (m_prgginf).
+----------------------------------------------------------------------------------------------*/
+int Segment::LogicalToPhysicalSurface(int islout)
+{
+ if (islout == kNegInfinity || islout == kPosInfinity)
+ return islout;
+
+ Assert(m_prgginf[islout - m_isloutGinf0].logicalIndex() == (unsigned)(islout - m_isloutGinf0));
+
+ return islout - m_isloutGinf0;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Given an underlying position (relative to the beginning of the string),
+ return the physical surface locations of all the associated surface glyphs.
+ OBSOLETE
+----------------------------------------------------------------------------------------------*/
+#if 0
+void Segment::UnderlyingToPhysicalAssocs(int ichw, std::vector<int> & viginf)
+{
+ int ichwSegOffset = ichw - m_ichwMin;
+
+ if (ichwSegOffset < m_ichwAssocsMin)
+ return; // possibly rendered in previous segment
+
+ else if (ichwSegOffset >= m_ichwAssocsLim)
+ return; // possibly rendered in following segment
+
+ else
+ {
+ std::vector<int> * pvisloutTmp = &(m_prgvisloutAssocs[ichwSegOffset - m_ichwAssocsMin]);
+
+ for (size_t i = 0; i < pvisloutTmp->size(); i++)
+ {
+ int islout = (*pvisloutTmp)[i];
+ Assert(islout != kNegInfinity);
+ Assert(islout != kPosInfinity);
+ viginf.push_back(LogicalToPhysicalSurface(islout));
+ }
+ }
+}
+#endif
+
+/*----------------------------------------------------------------------------------------------
+ Given an underlying character position (relative to the beginning of the string),
+ return a pointer to the vector containing the logical surface locations of
+ all the associated surface glyphs.
+
+ Returns an empty vector (not something containing infinities) if the character is
+ "invisible."
+----------------------------------------------------------------------------------------------*/
+std::vector<int> Segment::UnderlyingToLogicalAssocs(int ichw)
+{
+ std::vector<int> vnEmpty;
+ vnEmpty.clear();
+ Assert(vnEmpty.size() == 0);
+
+ int ichwSegOffset = ichw - m_ichwMin;
+
+ if (ichwSegOffset < m_ichwAssocsMin)
+ return vnEmpty; // probably rendered in previous segment
+
+ else if (ichwSegOffset >= m_ichwAssocsLim)
+ return vnEmpty; // probably rendered in following segment
+
+ else if (m_prgpvisloutAssocs[ichwSegOffset - m_ichwAssocsMin] == NULL)
+ {
+ // Create a vector using the before and after values.
+ std::vector<int> visloutRet;
+ int isloutBefore = m_prgisloutBefore[ichwSegOffset - m_ichwAssocsMin];
+ int isloutAfter = m_prgisloutAfter[ichwSegOffset - m_ichwAssocsMin];
+ if (isloutBefore != kPosInfinity && isloutBefore != kNegInfinity)
+ visloutRet.push_back(isloutBefore);
+ if (isloutAfter != kPosInfinity && isloutAfter != kNegInfinity && isloutBefore != isloutAfter)
+ {
+ visloutRet.push_back(isloutAfter);
+ }
+ return visloutRet;
+ }
+ else
+ {
+ std::vector<int> * pvisloutRet = m_prgpvisloutAssocs[ichwSegOffset - m_ichwAssocsMin];
+ return *pvisloutRet;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Given an underlying character position (relative to the beginning of the string),
+ return an index of a slot in this segment that can used to test things like
+ InsertBefore. Don't return kNegInfinity or kPosInfinity except as a last resort.
+----------------------------------------------------------------------------------------------*/
+int Segment::UnderlyingToLogicalInThisSeg(int ichw)
+{
+ int isloutTest = kNegInfinity;
+ std::vector<int> vislout = UnderlyingToLogicalAssocs(ichw);
+ for (size_t iislout = 0; iislout < vislout.size(); iislout++)
+ {
+ isloutTest = vislout[iislout];
+ if (isloutTest != kNegInfinity && isloutTest != kPosInfinity)
+ return isloutTest;
+ }
+ return isloutTest;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if the two characters map to exactly the same set of glyphs.
+----------------------------------------------------------------------------------------------*/
+bool Segment::SameSurfaceGlyphs(int ichw1, int ichw2)
+{
+ std::vector<int> vislout1 = UnderlyingToLogicalAssocs(ichw1);
+ std::vector<int> vislout2 = UnderlyingToLogicalAssocs(ichw2);
+
+ bool fRet = true;
+ if (vislout1.size() == 0 || vislout2.size() == 0)
+ fRet = false;
+ else if (vislout1.size() != vislout2.size())
+ fRet = false;
+ else
+ {
+ for (size_t islout = 0; islout < vislout1.size(); islout++)
+ {
+ if (vislout1[islout] != vislout2[islout])
+ {
+ fRet = false;
+ break;
+ }
+ }
+ }
+ return fRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the direction level of the given character.
+----------------------------------------------------------------------------------------------*/
+int Segment::DirLevelOfChar(int ichw, bool fBefore)
+{
+ if (m_twsh == ktwshOnlyWs)
+ return m_nDirDepth;
+ int islot = UnderlyingToLogicalSurface(ichw, fBefore);
+ if (islot == kNegInfinity || islot == kPosInfinity)
+ return 0;
+ int nDir = OutputSlot(islot)->DirLevel();
+ if (nDir == -1)
+ // Not calculated: assume to be the top direction level.
+ nDir = TopDirLevel();
+
+ return nDir;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return whether the given character is right-to-left.
+----------------------------------------------------------------------------------------------*/
+int Segment::CharIsRightToLeft(int ichw, bool fBefore)
+{
+ int nDir = DirLevelOfChar(ichw, fBefore);
+ return ((nDir % 2) != 0);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return whether the given slot is right-to-left.
+----------------------------------------------------------------------------------------------*/
+int Segment::SlotIsRightToLeft(GrSlotOutput * pslout)
+{
+ if (m_twsh == ktwshOnlyWs)
+ return (m_nDirDepth % 2);
+ int nDir = pslout->DirLevel();
+ if (nDir == -1)
+ nDir = TopDirLevel();
+ return (nDir % 2);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Check to make sure that the attachments are valid. Specifically, for every glyph that
+ is part of a cluster, all glyphs between that glyph and its root must (ultimately) have
+ that root glyph as one of its roots.
+ OBSOLETE
+----------------------------------------------------------------------------------------------*/
+void Segment::AssertValidClusters(GrSlotStream * psstrm)
+{
+#ifdef _DEBUG
+ for (int islot = 0; islot < psstrm->WritePos(); islot++)
+ {
+ GrSlotState * pslotThis = psstrm->SlotAt(islot);
+ GrSlotState * pslotRoot = pslotThis->AttachRoot(psstrm);
+ if (!pslotRoot)
+ continue;
+ Assert(pslotRoot != pslotThis);
+
+ int inc = (pslotThis->PosPassIndex() > pslotRoot->PosPassIndex()) ? -1 : 1;
+
+ for (int islot2 = pslotThis->PosPassIndex() + inc;
+ islot2 != pslotRoot->PosPassIndex();
+ islot2 += inc)
+ {
+ GrSlotState * pslotMid = psstrm->SlotAt(islot2);
+ Assert(pslotMid->HasAsRoot(psstrm, pslotRoot));
+ }
+ }
+#endif // _DEBUG
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return information about (editing) clusters as appropriate for Uniscribe, ie, consistent
+ with the ScriptShape funciton.
+ A cluster includes all attachments, all clumps of characters created by insert = false,
+ and clumps of reordered glyphs.
+
+ prgiginfFirstOfCluster returns the first glyph of the cluster for each CHARACTER
+ (glyph indices returned are zero-based and refer to physical order--left-to-right, etc.).
+ pfClusterStart returns a flag for each GLYPH indicating whether it is the first (left-most)
+ of a cluster.
+ Both arrays are optional.
+ CORRECTION: for now we use strictly logical order. It's not clear whether physical
+ order is needed for right-to-left text or not. See note below.
+
+ TODO: convert from GlyphInfo objects which are RTL.
+----------------------------------------------------------------------------------------------*/
+GrResult Segment::getUniscribeClusters(
+ int * prgiginfFirstOfCluster, int cchMax, int * pcch,
+ bool * pfClusterStart, int cfMax, int * pcf)
+{
+ ChkGrOutPtr(pcch);
+ if (prgiginfFirstOfCluster)
+ ChkGrArrayArg(prgiginfFirstOfCluster, cchMax);
+ ChkGrOutPtr(pcf);
+ if (pfClusterStart)
+ ChkGrArrayArg(pfClusterStart, cfMax);
+
+ GrResult res = kresOk;
+
+ //SetUpGraphics(ichwBase, pgg, true);
+
+ if (m_dxsWidth == -1)
+ ComputeDimensions();
+
+ Assert(m_dxsWidth >= 0);
+ Assert(m_dysAscent >= 0);
+
+ if (pcch)
+ *pcch = m_dichwLim;
+ if (pcf)
+ *pcf = m_cginf;
+ if (cchMax < m_dichwLim)
+ {
+ if (cchMax == 0 && cfMax == 0)
+ res = kresFalse; // just asking for size information
+ else if (prgiginfFirstOfCluster || cchMax > 0)
+ res = kresInvalidArg; // not enough space
+ }
+ if (cfMax < m_cginf)
+ {
+ if (cchMax == 0 && cfMax == 0)
+ res = kresFalse;
+ else if (pfClusterStart || cfMax > 0)
+ res = kresInvalidArg;
+ }
+ if (res != kresOk)
+ {
+ //RestoreFont(pgg);
+ ReturnResult(res);
+ }
+
+ // Generate a pair of arrays, indicating the first and last (logical) slots
+ // of the cluster for each character. Initially clusters are based just on
+ // character-to-glyph associations, but they expand as we process
+ // insert=false settings, attachments, and reordering.
+
+ std::vector<int> visloutBefore;
+ std::vector<int> visloutAfter;
+ visloutBefore.resize(m_dichwLim);
+ visloutAfter.resize(m_dichwLim);
+
+ int ich;
+ for (ich = 0; ich < m_dichwLim; ich++)
+ {
+ visloutBefore[ich] = m_prgisloutBefore[ich - m_ichwAssocsMin];
+ visloutAfter[ich] = m_prgisloutAfter[ich - m_ichwAssocsMin];
+ }
+
+ if (m_dichwLim == 1)
+ {
+ // Only one character, therefore only one cluster.
+ visloutBefore[0] = m_isloutGinf0;
+ visloutAfter[0] = max(m_cginf - 1, 0) + m_isloutGinf0;
+ }
+ else
+ {
+ // Make all glyphs attached to each other part of a cluster, or glyphs where
+ // insertion is not allowed.
+ for (ich = 0; ich < m_dichwLim; ich++)
+ {
+ std::vector<int> vislout = UnderlyingToLogicalAssocs(ich + m_ichwMin);
+
+ if (vislout.size() == 0)
+ {
+ // No glyphs represent this character. Merge it with the previous
+ // character.
+ visloutBefore[ich] = (ich == 0) ? visloutBefore[ich + 1] : visloutBefore[ich - 1];
+ visloutAfter[ich] = (ich == 0) ? visloutAfter[ich + 1] : visloutAfter[ich - 1];
+ continue;
+ }
+
+ size_t iislout;
+ for (iislout = 0; iislout < vislout.size(); iislout++)
+ {
+ int islout = vislout[iislout];
+ if (!m_prgslout[islout].InsertBefore())
+ {
+ // This glyph does not allow insertion before it; make its character part
+ // of the same cluster as the previous character.
+ MergeUniscribeCluster(visloutBefore, visloutAfter, ich - 1, ich);
+/*
++ // Keith Stribley's fix:
++ // NOTE: this is NOT always the same as the previous character, so
++ // check whether the next character actually has a glyph before this
++ // one
++ if ((ich == m_dichwLim - 1) ||
++ (std::min(visloutBefore[ich + 1], visloutAfter[ich + 1]) >
++ std::max(visloutBefore[ich], visloutAfter[ich])))
++ {
++ MergeUniscribeCluster(visloutBefore, visloutAfter, ich - 1, ich);
++ }
++ else
++ MergeUniscribeCluster(visloutBefore, visloutAfter, ich, ich + 1);
+*/
+ }
+ else if (m_prgslout[islout].ClusterBase() != -1
+ && m_prgslout[islout].ClusterBase() != islout)
+ {
+ // This glyph is attached to something; make them part of the same cluster.
+ int isloutBase = m_prgslout[islout].ClusterBase();
+ int ichBase = LogicalSurfaceToUnderlying(isloutBase, false) - m_ichwMin;
+ MergeUniscribeCluster(visloutBefore, visloutAfter,
+ ich, ichBase);
+ int ichBase1 = LogicalSurfaceToUnderlying(isloutBase, false) - m_ichwMin;
+ if (ichBase1 != ichBase)
+ MergeUniscribeCluster(visloutBefore, visloutAfter,
+ ich, ichBase1);
+ }
+ }
+ }
+
+ // Handle reordering. Whenever the islout values get out of order, we need to
+ // merge into a single cluster.
+ for (ich = 0; ich < m_dichwLim - 1; ich++)
+ {
+ Assert(visloutBefore[ich] <= visloutAfter[ich]);
+ Assert(visloutBefore[ich] != kPosInfinity);
+ Assert(visloutBefore[ich] != kNegInfinity);
+ Assert(visloutAfter[ich] != kPosInfinity);
+ Assert(visloutAfter[ich] != kNegInfinity);
+ const int b1 = visloutBefore[ich];
+ const int a1 = visloutAfter[ich];
+ const int b2 = visloutBefore[ich + 1];
+ const int a2 = visloutAfter[ich + 1];
+ if (b1 == b2 && a1 == a2)
+ continue; // already a cluster
+
+ if (std::min(b2, a2) <= std::max(b1, a1))
+ {
+ MergeUniscribeCluster(visloutBefore, visloutAfter, ich, ich + 1);
+ }
+ }
+ }
+
+ if (pfClusterStart)
+ {
+ // Initialize.
+ int iginf;
+ for (iginf = 0; iginf < m_cginf; iginf++)
+ pfClusterStart[iginf] = false;
+ }
+
+ // To skip line-break slots; remember that the number of output slots equals the
+ // number of gbbs plus initial and/or final line-break slots if any.
+ // In this case the beginning of the first cluster indicates the first real glyph.
+ int isloutFirstReal = (m_dichwLim) ? ((m_fWsRtl)? visloutAfter[0] : visloutBefore[0]) : 0;
+
+ // Kludge to make assertions below easier:
+ if (m_dichwLim > 0)
+ {
+ visloutBefore.push_back(visloutAfter.back() + 1);
+ visloutAfter.push_back(visloutAfter.back() + 1);
+ }
+
+ // Convert (logical) slots to actual glyphs.
+ for (ich = 0; ich < m_dichwLim; ich++)
+ {
+ // NOTE: to treat the first of the cluster as the left-most, use visloutAfter for
+ // right-to-left situations.
+
+ if (prgiginfFirstOfCluster)
+ prgiginfFirstOfCluster[ich]
+ = LogicalToPhysicalSurface((m_fWsRtl) ? visloutAfter[ich] : visloutBefore[ich]);
+ int clusterStartPos = ((m_fWsRtl) ? visloutAfter[ich] : visloutBefore[ich]) - isloutFirstReal;
+ if (pfClusterStart)
+ pfClusterStart[clusterStartPos] = true;
+
+ Assert((visloutBefore[ich] == visloutBefore[ich + 1] &&
+ visloutAfter[ich] == visloutAfter[ich + 1])
+ || (visloutBefore[ich] <= visloutAfter[ich] &&
+ visloutAfter[ich] < visloutBefore[ich + 1]));
+ }
+
+ //RestoreFont(pgg);
+
+ return kresOk;
+}
+
+
+// suppress GCC 4.3 warning for optimized min()/max() when called with (ich, ich+1) or similar
+#pragma GCC diagnostic ignored "-Wstrict-overflow"
+
+/*----------------------------------------------------------------------------------------------
+ Merge the given characters into the same Uniscribe cluster. This means merging any
+ intervening characters as well.
+----------------------------------------------------------------------------------------------*/
+void Segment::MergeUniscribeCluster(
+ std::vector<int> & visloutBefore, std::vector<int> & visloutAfter,
+ int ich1, int ich2)
+{
+ int ichStartOrig = min(ich1, ich2);
+ int ichStopOrig = max(ich1, ich2);
+
+ int isloutMin = visloutBefore[ichStopOrig];
+ int isloutMax = visloutAfter[ichStartOrig];
+
+ int ichStart = ichStopOrig;
+ int ichStop = ichStartOrig;
+ // Find the beginning of the cluster.
+ while (ichStart > 0 &&
+ (ichStart > ichStartOrig
+ || visloutBefore[ichStart - 1] >= visloutBefore[ichStopOrig]
+ || visloutBefore[ichStart - 1] == visloutBefore[ichStart]))
+ {
+ ichStart--;
+ isloutMin = std::min(isloutMin, visloutBefore[ichStart]);
+ isloutMax = std::max(isloutMax, visloutAfter[ichStart]);
+ }
+ // Find end of cluster.
+ while (ichStop < m_dichwLim - 1 &&
+ (ichStop < ichStopOrig
+ || visloutAfter[ichStop + 1] <= visloutAfter[ichStartOrig]
+ || visloutAfter[ichStop + 1] == visloutAfter[ichStop]))
+ {
+ ichStop++;
+ isloutMin = std::min(isloutMin, visloutBefore[ichStop]);
+ isloutMax = std::max(isloutMax, visloutAfter[ichStop]);
+ }
+
+ int ich;
+ for (ich = ichStart; ich <= ichStop; ich++)
+ {
+ visloutBefore[ich] = isloutMin;
+ visloutAfter[ich] = isloutMax;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return information about the positioning of glyphs as appropriate for Uniscribe.
+ The advance widths returned are the natural ones (what would be applied if no smart
+ rendering were happening), and the x-offsets are the difference between the
+ natural location of the glyph and what is produced by Graphite. The y-offset
+ is the same as GetGlyphsAndPositions.
+
+ This is an experimental method. Its behavior may change signficantly in the future.
+----------------------------------------------------------------------------------------------*/
+/*
+GrResult Segment::GetUniscribePositions(
+ Rect rs, Rect rd, int cgidMax, int *pcgidRet,
+ float * prgxd, float * prgyd, float * prgdxdAdv)
+{
+ ChkGrOutPtr(pcgidRet);
+ ChkGrArrayArg(prgxd, cgidMax);
+ ChkGrArrayArg(prgyd, cgidMax);
+ ChkGrArrayArg(prgdxdAdv, cgidMax);
+
+ GrResult res;
+
+ //SetUpGraphics(ichBase, pgg, true);
+
+ Assert(m_dxsWidth >= 0);
+ Assert(m_dysAscent >= 0);
+
+ *pcgidRet = m_cginf;
+ if (cgidMax < m_cginf)
+ {
+ res = (cgidMax == 0) ? kresFalse : kresInvalidArg;
+ //RestoreFont(pgg);
+ ReturnResult(res);
+ }
+
+ if (m_dxsWidth < 0)
+ ComputeDimensions();
+
+ float * rgxdTmp = new float[cgidMax];
+ float * rgdxdAdvTmp = new float[cgidMax];
+ res = GetGlyphsAndPositions(rs, rd, cgidMax, pcgidRet,
+ NULL, rgxdTmp, prgyd, rgdxdAdvTmp);
+ if (ResultFailed(res))
+ {
+ delete[] rgxdTmp;
+ delete[] rgdxdAdvTmp;
+ //RestoreFont(pgg);
+ ReturnResult(res);
+ }
+
+ float xdLeft = SegmentPainter::ScaleX(0, rs, rd);
+ float xdXPosNatural = xdLeft;
+ for (int iginf = 0; iginf < *pcgidRet; iginf++)
+ {
+ int islout = iginf + m_isloutGinf0;
+ GrSlotOutput * pslout = OutputSlot(islout);
+ float dxsAdvNatural = pslout->AdvanceXMetric();
+ float dxdAdvNatural = SegmentPainter::ScaleX(dxsAdvNatural, rs, rd) - xdLeft;
+ prgdxdAdv[iginf] = dxdAdvNatural;
+ prgxd[iginf] = rgxdTmp[iginf] - xdXPosNatural;
+
+ xdXPosNatural += dxdAdvNatural;
+ }
+
+ delete[] rgxdTmp;
+ delete[] rgdxdAdvTmp;
+
+ //RestoreFont(pgg);
+
+ ReturnResult(res);
+
+}
+*/
+
+/*----------------------------------------------------------------------------------------------
+ Return information about the positioning of glyphs as appropriate for Uniscribe.
+ The advance widths returned are the natural ones (what would be applied if no smart
+ rendering were happening), and the x-offsets are the difference between the
+ natural location of the glyph and what is produced by Graphite. The y-offset
+ is the same as GetGlyphsAndPositions.
+
+ This is an experimental method. Its behavior may change signficantly in the future.
+----------------------------------------------------------------------------------------------*/
+/*
+GrResult Segment::GetUniscribeGlyphsAndPositions(
+ Rect rs, Rect rd, int cgidMax, int *pcgidRet, utf16 * prgchGlyphs,
+ float * prgxd, float * prgyd, float * prgdxdAdv)
+{
+ ChkGrOutPtr(pcgidRet);
+ ChkGrArrayArg(prgxd, cgidMax);
+ ChkGrArrayArg(prgyd, cgidMax);
+ ChkGrArrayArg(prgdxdAdv, cgidMax);
+
+ GrResult res;
+
+ //SetUpGraphics(ichBase, pgg, true);
+
+ Assert(m_dxsWidth >= 0);
+ Assert(m_dysAscent >= 0);
+
+ *pcgidRet = m_cginf;
+ if (cgidMax < m_cginf)
+ {
+ res = (cgidMax == 0) ? kresFalse : kresInvalidArg;
+ //RestoreFont(pgg);
+ ReturnResult(res);
+ }
+
+ if (m_dxsWidth < 0)
+ ComputeDimensions();
+
+ float * rgxdTmp = new float[cgidMax];
+ float * rgdxdAdvTmp = new float[cgidMax];
+ res = GetGlyphsAndPositions(rs, rd, cgidMax, pcgidRet,
+ prgchGlyphs, rgxdTmp, prgyd, rgdxdAdvTmp);
+ if (ResultFailed(res))
+ {
+ delete[] rgxdTmp;
+ delete[] rgdxdAdvTmp;
+ //RestoreFont(pgg);
+ ReturnResult(res);
+ }
+
+ float xdLeft = SegmentPainter::ScaleX(0, rs, rd);
+ float xdXPosNatural = xdLeft;
+ for (int iginf = 0; iginf < *pcgidRet; iginf++)
+ {
+ int islout = iginf + m_isloutGinf0;
+ GrSlotOutput * pslout = OutputSlot(islout);
+ float dxsAdvNatural = pslout->AdvanceXMetric();
+ float dxdAdvNatural = SegmentPainter::ScaleX(dxsAdvNatural, rs, rd) - xdLeft;
+ prgdxdAdv[iginf] = dxdAdvNatural;
+ prgxd[iginf] = rgxdTmp[iginf] - xdXPosNatural;
+
+ xdXPosNatural += dxdAdvNatural;
+ }
+
+ delete[] rgxdTmp;
+ delete[] rgdxdAdvTmp;
+
+ //RestoreFont(pgg);
+
+ ReturnResult(res);
+}
+*/
+
+/*----------------------------------------------------------------------------------------------
+ Return the visual box for the given ligature component. Return (0,0,0,0) if the component
+ is not defined.
+----------------------------------------------------------------------------------------------*/
+Rect Segment::ComponentRect(GrSlotOutput * pslout, int icomp)
+{
+ Rect rectRet;
+ rectRet.top = rectRet.bottom = rectRet.left = rectRet.right = 0;
+ if (icomp < 0 || icomp > pslout->NumberOfComponents())
+ return rectRet;
+
+ GrEngine * pgreng = EngineImpl();
+ if (!pgreng)
+ return rectRet;
+ GrGlyphTable * pgtbl = pgreng->GlyphTable();
+ if (!pgtbl)
+ return rectRet;
+
+ float xsLeft, xsRight, ysTop, ysBottom;
+
+ // TODO: Rework ComponentIndexForGlyph to take slati rather than iForGlyph.
+ int slati = pslout->ComponentId(icomp);
+ int iForGlyph = pgtbl->ComponentIndexForGlyph(pslout->GlyphID(), slati);
+ if (!pgtbl->ComponentBoxLogUnits(m_xysEmSquare, pslout->GlyphID(), iForGlyph,
+ m_mFontEmUnits, m_dysAscent,
+ &xsLeft, &ysTop, &xsRight, &ysBottom,
+ false)) // origin is baseline
+ {
+ return rectRet;
+ }
+ rectRet.top = ysTop;
+ rectRet.bottom = ysBottom;
+ rectRet.left = xsLeft;
+ rectRet.right = xsRight;
+
+ return rectRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Shift the glyphs physically by the given amount. This happens when a right-to-left
+ segment is changed from being end-of-line to not, so we have to account for the fact
+ that the trailing white-space was previous invisible but is now visible.
+----------------------------------------------------------------------------------------------*/
+void Segment::ShiftGlyphs(float dxsShift)
+{
+ for (int islout = 0; islout < m_cslout; islout++)
+ {
+ GrSlotOutput * pslout = OutputSlot(islout);
+ pslout->AdjustPosXBy(dxsShift);
+ }
+
+ //ShiftGlyphsPlatform(dxsShift);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Find the glyph that best matches the given click location.
+
+ @param xsClick - relative to start of segment
+ @param ysClick - relative to segment baseline
+----------------------------------------------------------------------------------------------*/
+int Segment::GlyphHit(float xsClick, float ysClick)
+{
+ float xsLeft = kPosInfFloat;
+ float xsRight = kNegInfFloat;
+
+ int iginf;
+ for (iginf = 0; iginf < m_cginf; iginf++)
+ {
+ GlyphInfo * pginf = m_prgginf + iginf;
+ xsLeft = min(xsLeft, pginf->origin());
+ xsRight = max(xsRight, pginf->origin() + pginf->advanceWidth());
+ }
+
+ if (xsClick < xsLeft)
+ return m_fWsRtl ? m_cginf - 1 : 0;
+ else if (xsClick > xsRight)
+ return m_fWsRtl ? 0 : m_cginf - 1;
+
+ int iginfHit;
+ std::vector<int> viginfNear;
+ std::vector<int> viginfHit;
+ std::vector<int> viginfInside;
+
+ // Find glyph which might contain click point.
+
+ for (iginfHit = m_cginf; iginfHit-- > 0; )
+ {
+ if (m_fWsRtl)
+ {
+ if (m_prgginf[iginfHit].bb().right >= xsClick)
+ break;
+ }
+ else
+ {
+ if (m_prgginf[iginfHit].bb().left <= xsClick)
+ break;
+ }
+ }
+ if (iginfHit < 0) // click within lsb of first glyph
+ {
+ return 0;
+ }
+
+ // Find all BB that OVERLAP the click point (bb.left < XClick < bb.right).
+ for (iginf = iginfHit; iginf >= 0; iginf--)
+ {
+ Rect rectBB = m_prgginf[iginf].bb();
+ if (rectBB.left <= xsClick && xsClick <= rectBB.right)
+ {
+ viginfNear.push_back(iginf);
+ }
+ }
+
+ // Find all BB that CONTAIN the click point (considering the click's Y coor too).
+ int iiginf;
+ for (iiginf = 0; iiginf < (int)viginfNear.size(); iiginf++)
+ {
+ Rect rectBB = m_prgginf[viginfNear[iiginf]].bb();
+ if (rectBB.bottom <= ysClick && ysClick <= rectBB.top)
+ {
+ viginfHit.push_back(viginfNear[iiginf]);
+ }
+ }
+
+ if (viginfNear.size() > 2 && viginfHit.size() == 0)
+ {
+ // No hit along y-axis; find the closest thing.
+ float dy = float(10000000.0);
+ for (int iiginf2 = 0; iiginf2 < (int)viginfNear.size(); iiginf2++)
+ {
+ Rect rectBB = m_prgginf[viginfNear[iiginf2]].bb();
+ if (fabsf(rectBB.top - ysClick) < dy)
+ {
+ dy = fabsf(rectBB.top - ysClick);
+ viginfHit.clear();
+ viginfHit.push_back(viginfNear[iiginf2]);
+ }
+ if (fabsf(rectBB.bottom - ysClick) < dy)
+ {
+ dy = fabsf(rectBB.bottom - ysClick);
+ viginfHit.clear();
+ viginfHit.push_back(viginfNear[iiginf2]);
+ }
+ }
+ }
+
+ // Find all BB for which the click is within their advance width, if any.
+ for (iiginf = 0; iiginf < (int)viginfHit.size(); iiginf++)
+ {
+ //Rect rectBB = m_prgginf[viginfHit[iiginf]].bb(); -- ?? this tests the bounding box again :-/
+ //if (rectBB.left <= xsClick && xsClick <= rectBB.right)
+ gr::GlyphInfo * pginf = m_prgginf + viginfHit[iiginf];
+ if (pginf->advanceWidth() == 0 // advance width is irrelevant
+ || (pginf->origin() < xsClick && xsClick <= pginf->origin() + pginf->advanceWidth()))
+ {
+ viginfInside.push_back(viginfHit[iiginf]);
+ }
+ }
+
+ // If no BB coincides in any way with the click point, take the BB whose leading edge
+ // is closest to the click point.
+ // There could be more than one BB with the same leading x coor.
+ if (viginfHit.size() == 0 && viginfNear.size() == 0 && viginfInside.size() == 0)
+ {
+ float xsLeading;
+ if (iginfHit + 1 == m_cginf)
+ {
+ viginfNear.push_back(iginfHit);
+ }
+ else if (!m_fWsRtl)
+ {
+ // Left-to-right:
+ xsLeading = m_prgginf[iginfHit + 1].bb().left;
+ for (iginf = iginfHit + 1; iginf < m_cginf; iginf++)
+ {
+ if (m_prgginf[iginf].bb().left == xsLeading)
+ viginfNear.push_back(iginf);
+ }
+ }
+ else
+ {
+ // Right-to-left:
+ xsLeading = m_prgginf[iginfHit].bb().right;
+ for (iginf = iginfHit; iginf < m_cginf; iginf++)
+ {
+ if (m_prgginf[iginf].bb().right == xsLeading)
+ viginfNear.push_back(iginf);
+ }
+ }
+ }
+
+ Assert(viginfNear.size());
+
+ int iginfLoc;
+
+ // Select the BB based on its leading edge, offset from baseline, position in final pass.
+ if (viginfInside.size())
+ iginfLoc = SelectBb(viginfInside, m_fWsRtl);
+ else if (viginfHit.size())
+ iginfLoc = SelectBb(viginfHit, m_fWsRtl);
+ else
+ iginfLoc = SelectBb(viginfNear, m_fWsRtl);
+
+ return iginfLoc;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Select the bounding box we will use for a mouse hit.
+ First select any glyph with a significantly smaller bounding box.
+ Then, select the BB with the left-most (LTR) or right-most (RTL) edge.
+ If more than one BB has same edge of interest, select the one that is closest to the
+ the baseline.
+ If that is a tie, select the one with the lowest islout.
+
+ @param vigbb - list of indexes into m_prggbb
+ @param fRTL - writing system direction
+----------------------------------------------------------------------------------------------*/
+int Segment::SelectBb(std::vector<int> & viginf, bool fRTL)
+{
+ if (!viginf.size())
+ {
+ Assert(false);
+ return -1;
+ }
+
+ if (viginf.size() == 1)
+ return viginf[0];
+
+ // Find a glyph that has a signficantly smaller bounding box.
+ // The idea is that it is going to be harder to hit than the bigger glyph.
+ float smallestArea = float(1000000000.0);
+ float largestArea = 0.0;
+ size_t iiginfSmallest = 0;
+ size_t iiginf;
+ for (iiginf = 0; iiginf < viginf.size(); iiginf++)
+ {
+ gr::GlyphInfo * pginf = m_prgginf + viginf[iiginf];
+ Rect rectBB = pginf->bb();
+ float thisArea = (rectBB.right - rectBB.left) * (rectBB.top - rectBB.bottom);
+ if (smallestArea > thisArea)
+ {
+ smallestArea = thisArea;
+ iiginfSmallest = iiginf;
+ }
+ largestArea = max(largestArea, thisArea);
+ }
+ if (smallestArea * 2.0 < largestArea)
+ return viginf[iiginfSmallest];
+
+ // Find appropriate x coor of leading edge.
+ float xsLeading;
+ if (!fRTL)
+ xsLeading = m_prgginf[viginf[0]].bb().left;
+ else
+ xsLeading = m_prgginf[viginf[0]].bb().right;
+
+ for (iiginf = 1; iiginf < viginf.size(); iiginf++)
+ {
+ Rect rectBB = m_prgginf[viginf[iiginf]].bb();
+ if (!fRTL)
+ xsLeading = min(xsLeading, rectBB.left);
+ else
+ xsLeading = max(xsLeading, rectBB.right);
+ }
+
+ // Find BBs with the leading edge.
+ std::vector<int> viginfSameEdge;
+ for (iiginf = 0; iiginf < viginf.size(); iiginf++)
+ {
+ Rect rectBB = m_prgginf[viginf[iiginf]].bb();
+ if (!fRTL)
+ {
+ if (rectBB.left == xsLeading)
+ viginfSameEdge.push_back(viginf[iiginf]);
+ }
+ else
+ {
+ if (rectBB.right == xsLeading)
+ viginfSameEdge.push_back(viginf[iiginf]);
+ }
+ }
+
+ if (viginfSameEdge.size() == 1)
+ return viginfSameEdge[0];
+
+ // Find minimum distance from baseline.
+ float ysMin = fabsf(m_prgginf[viginfSameEdge[0]].yOffset());
+ for (iiginf = 1; iiginf < viginfSameEdge.size(); iiginf++)
+ {
+ float ysThis = fabsf(m_prgginf[viginfSameEdge[iiginf]].yOffset());
+ ysMin = min(ysMin, ysThis);
+ }
+
+ // Find BBs with minimum distance from baseline.
+ std::vector<int> viginfSameY;
+ for (iiginf = 0; iiginf < viginfSameEdge.size(); iiginf++)
+ {
+ if (fabsf(m_prgginf[viginfSameEdge[iiginf]].yOffset()) == ysMin)
+ viginfSameY.push_back(viginfSameEdge[iiginf]);
+ }
+
+ if (viginfSameY.size() == 1)
+ return viginfSameY[0];
+
+ // Find minimum index of current candidates.
+ int islout = m_prgginf[viginfSameY[0]].logicalIndex();
+ for (iiginf = 1; iiginf < viginfSameY.size(); iiginf++)
+ {
+ int isloutThis = m_prgginf[viginfSameY[iiginf]].logicalIndex();
+ islout = min(islout, isloutThis);
+ }
+
+ // Find BB with minimum islout - islout should be unique for all glyphs.
+ for (iiginf = 0; iiginf < viginfSameY.size(); iiginf++)
+ {
+ if (m_prgginf[viginfSameY[iiginf]].logicalIndex() == (unsigned)islout)
+ return viginfSameY[iiginf];
+ }
+
+ Assert(false);
+ return -1; // needed to stop compiler warning
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the right-most glyph on the physical surface. If there are ties, it will
+ prefer the one that is logically closest to the edge.
+----------------------------------------------------------------------------------------------*/
+int Segment::RightMostGlyph()
+{
+ float xsRight = kNegInfFloat;
+ int iginfRet = -1;
+ for (int iginf = 0; iginf < m_cginf; iginf++)
+ {
+ float xsThis = m_prgginf[iginf].bb().right;
+ // For RTL, we prefer the glyph that is logically first; for LTR we prefer logically last.
+ if (xsThis > xsRight || (!m_fWsRtl && xsRight == xsThis))
+ {
+ xsRight = xsThis;
+ iginfRet = iginf;
+ }
+ }
+ return iginfRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the left-most glyph on the physical surface. If there are ties, it will
+ prefer the one that is logically closest to the edge.
+----------------------------------------------------------------------------------------------*/
+int Segment::LeftMostGlyph()
+{
+ float xsLeft = kPosInfFloat;
+ int iginfRet = -1;
+ for (int iginf = 0; iginf < m_cginf; iginf++)
+ {
+ float xsThis = m_prgginf[iginf].bb().left;
+ // For RTL, we prefer the glyph that is logically last; for LTR we prefer logically first.
+ if (xsThis < xsLeft || (m_fWsRtl && xsLeft == xsThis))
+ {
+ xsLeft = xsThis;
+ iginfRet = iginf;
+ }
+ }
+ return iginfRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Convert from em-units to logical units.
+----------------------------------------------------------------------------------------------*/
+float Segment::EmToLogUnits(int m)
+{
+ return GrEngine::GrIFIMulDiv(m, m_xysEmSquare, m_mFontEmUnits);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the line-break pseudo glyph ID.
+----------------------------------------------------------------------------------------------*/
+gid16 Segment::LBGlyphID()
+{
+ return m_preneng->LBGlyphID();
+}
+
+} // namespace gr
diff --git a/Build/source/libs/graphite/src/segment/SegmentAux.cpp b/Build/source/libs/graphite/src/segment/SegmentAux.cpp
new file mode 100644
index 00000000000..9191e8724d5
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/SegmentAux.cpp
@@ -0,0 +1,256 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2005 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: SegmentAux.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Implements auxiliary class that work with Segment:
+ - GlyphInfo
+ - GlyphIterator
+ - LayoutEnvironment
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+// any other headers (not precompiled)
+#ifndef _WIN32
+#include <stdlib.h>
+#endif
+
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> GlyphInfo methods
+//:>********************************************************************************************
+
+gid16 GlyphInfo::glyphID()
+{
+ return m_pslout->m_chwActual;
+}
+
+gid16 GlyphInfo::pseudoGlyphID()
+{
+ if (m_pslout->m_chwActual == m_pslout->m_chwGlyphID)
+ return 0; // not a pseudo-glyph
+ return m_pslout->m_chwGlyphID;
+}
+
+bool GlyphInfo::isAttached() const throw()
+{
+ return m_pslout->IsPartOfCluster();
+}
+
+gr::GlyphIterator GlyphInfo::attachedClusterBase() const throw()
+{
+ const int islout = m_pslout->ClusterBase();
+
+ // Since we are not passing an array, the constructor expects a ginf index, not a slout index.
+ return GlyphIterator(*m_pseg, ((islout >= 0) ? islout : m_islout) - m_pseg->m_isloutGinf0);
+}
+
+float GlyphInfo::attachedClusterAdvance() const throw()
+{
+ return m_pslout->ClusterAdvance();
+}
+
+std::pair<gr::GlyphSetIterator, gr::GlyphSetIterator> GlyphInfo::attachedClusterGlyphs() const
+{
+ std::vector<int> visloutClusterMembers;
+ m_pslout->ClusterMembers(m_pseg, m_islout, visloutClusterMembers);
+ RcVector * qvislout = new RcVector(visloutClusterMembers);
+ return std::make_pair(
+ GlyphSetIterator(*m_pseg, 0, qvislout),
+ GlyphSetIterator(*m_pseg, visloutClusterMembers.size(), qvislout));
+}
+
+size_t GlyphInfo::logicalIndex()
+{
+ if (m_pseg->OutputSlot(0)->IsLineBreak())
+ return m_islout - 1;
+ else
+ return m_islout;
+}
+
+float GlyphInfo::origin()
+{
+ return m_pslout->XPosition();
+}
+
+float GlyphInfo::advanceWidth() // logical units
+{
+ return m_pslout->m_xsAdvanceX;
+}
+
+float GlyphInfo::advanceHeight() // logical units; zero for horizontal fonts
+{
+ Font & font = m_pseg->getFont();
+ return m_pslout->GlyphMetricLogUnits(&font, kgmetAdvHeight);
+}
+
+float GlyphInfo::yOffset()
+{
+ return m_pslout->YPosition();
+}
+
+Rect GlyphInfo::bb() // logical units
+{
+ return m_pslout->BoundingBox(m_pseg->getFont());
+}
+
+bool GlyphInfo::isSpace()
+{
+ return m_pslout->IsSpace();
+}
+
+// first char associated with this glyph, relative to start of the text-source
+toffset GlyphInfo::firstChar()
+{
+ return m_pseg->LogicalSurfaceToUnderlying(m_islout, true);
+}
+
+// last char associated with this glyph, relative to start of the text-source
+toffset GlyphInfo::lastChar()
+{
+ return m_pseg->LogicalSurfaceToUnderlying(m_islout, false);
+}
+
+unsigned int GlyphInfo::directionality()
+{
+ return m_pslout->Directionality();
+}
+
+// Embedding depth
+unsigned int GlyphInfo::directionLevel()
+{
+ return m_pslout->DirLevel();
+}
+
+bool GlyphInfo::insertBefore()
+{
+ return m_pslout->InsertBefore();
+}
+
+int GlyphInfo::breakweight()
+{
+ return m_pslout->BreakWeight();
+}
+
+float GlyphInfo::maxStretch(size_t level)
+{
+ return m_pslout->MaxStretch(m_pseg, (int)level);
+}
+
+float GlyphInfo::maxShrink(size_t level)
+{
+ return m_pslout->MaxShrink(m_pseg, (int)level);
+}
+
+float GlyphInfo::stretchStep(size_t level)
+{
+ return m_pslout->StretchStep(m_pseg, (int)level);
+}
+
+byte GlyphInfo::justWeight(size_t level)
+{
+ return byte(m_pslout->JustWeight((int)level));
+}
+
+float GlyphInfo::justWidth(size_t level)
+{
+ return m_pslout->JustWidth(m_pseg, (int)level);
+}
+
+float GlyphInfo::measureStartOfLine()
+{
+ return m_pslout->MeasureSolLogUnits(m_pseg);
+}
+
+float GlyphInfo::measureEndOfLine()
+{
+ return m_pslout->MeasureEolLogUnits(m_pseg);
+}
+
+size_t GlyphInfo::numberOfComponents()
+{
+ return m_pslout->NumberOfComponents();
+}
+
+Rect GlyphInfo::componentBox(size_t icomp)
+{
+ return m_pseg->ComponentRect(m_pslout, icomp);
+}
+
+toffset GlyphInfo::componentFirstChar(size_t icomp)
+{
+ Assert((int)icomp < m_pslout->NumberOfComponents());
+ return m_pslout->UnderlyingComponent(icomp) + m_pseg->startCharacter();
+}
+toffset GlyphInfo::componentLastChar(size_t icomp)
+{
+ Assert((int)icomp < m_pslout->NumberOfComponents());
+ return m_pslout->UnderlyingComponent(icomp) + m_pseg->startCharacter();
+}
+
+bool GlyphInfo::erroneous()
+{
+ return m_pseg->Erroneous();
+}
+
+
+//:>********************************************************************************************
+//:> GlyphIterator methods
+//:>********************************************************************************************
+
+// Constructor
+GlyphIterator::GlyphIterator(Segment & seg, size_t iginf)
+: m_pginf(seg.m_prgginf + iginf)
+{}
+
+// Copy constructor.
+// Check if the incoming iterator is null, as we cannot dereference
+// it to get the segment, and create a null GlyphIterator.
+// Technically this might better be an assert as converting a null
+// GlyphSetIterator into a null GlyphIterator is pointless and suggests
+// some kind of error.
+GlyphIterator::GlyphIterator(const GlyphSetIterator & sit)
+: m_pginf((sit == GlyphSetIterator())
+ ? 0
+ : sit->segment().m_prgginf + sit->logicalIndex())
+{}
+
+/*----------------------------------------------------------------------------------------------
+ Dereference the iterator, returning a GlyphInfo object.
+----------------------------------------------------------------------------------------------*/
+
+GlyphSetIterator::reference GlyphSetIterator::operator*() const
+{
+ assert(m_pseg != 0);
+ assert(m_vit != std::vector<int>::const_iterator());
+ // in the case of a non-contiguous list
+ return m_pseg->m_prgginf[(*m_vit) - m_pseg->m_isloutGinf0];
+}
+
+
+} // namespace gr
diff --git a/Build/source/libs/graphite/src/segment/TestFSM.cpp b/Build/source/libs/graphite/src/segment/TestFSM.cpp
new file mode 100644
index 00000000000..6dad1dc9dc8
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/TestFSM.cpp
@@ -0,0 +1,3416 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: TestFSM.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Hard-coded FSMs for test procedures.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+//:Ignore
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+#ifdef OLD_TEST_STUFF
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Methods
+//:>********************************************************************************************
+
+#ifndef _DEBUG
+
+bool GrLineBreakPass::RunTestRules(GrTableManager * ptman, int ruln,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ return false;
+}
+
+bool GrSubPass::RunTestRules(GrTableManager * ptman, int ruln,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ return false;
+}
+
+bool GrPosPass::RunTestRules(GrTableManager * ptman, int ruln,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ return false;
+}
+#endif // !_DEBUG
+
+
+#ifdef _DEBUG
+
+/*----------------------------------------------------------------------------------------------
+ Call the appropriate test function.
+----------------------------------------------------------------------------------------------*/
+
+bool GrLineBreakPass::RunTestRules(GrTableManager * ptman, int ruln,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ return false;
+}
+
+bool GrSubPass::RunTestRules(GrTableManager * ptman, int ruln,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ if (m_staBehavior == "SimpleFSM")
+ return RunSimpleFSMTest(ptman, ruln, psstrmInput, psstrmOutput);
+ else if (m_staBehavior == "RuleAction")
+ return false;
+ else if (m_staBehavior == "RuleAction2")
+ return false;
+ else if (m_staBehavior == "Assoc")
+ return false;
+ else
+ return false;
+}
+
+bool GrPosPass::RunTestRules(GrTableManager * ptman, int ruln,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ return false;
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ A simple FSM.
+
+ Rules:
+ r1. clsCons clsVowel clsDiacrAcute
+ r2. clsCons clsVowelAE clsDiacr
+ r3. clsCons clsVowelI
+ r4. clsCons clsVowelI clsDiacrGrave
+ r5. clsCons clsVowelI clsDiacr
+
+ Machine classes:
+ mcCons: b,c,d / f,g,h / j,k,l,m,n / p,q,r,s,t / v,w,x,y,z
+ mcVae: a 97/ e 101
+ mcVi: i 105
+ mcVou: o 111 / u 117
+ mcDa: acute '/' 47
+ mcDg: grave '\' 92
+ mcDct: other diacritics-circumflex '^' 94 / tilde '~' 126
+
+
+ FSM: (T=transition, F=final, A=accepting, NA=non-accepting)
+
+ | mcCons mcVae mcVi mcVou mcDa mcDg mcDct
+ ---------------------------------------------------------------------------
+ T NA s0 | s1
+ | - - - - - - -
+ T NA s1 | s2 s4 s3
+ | - - - - - - -
+ T NA s2 | s5 s6 s6
+ | - - - - - - -
+ T NA s3 | s10
+ | - - - - - - -
+ T A s4 | s7 s8 s9
+ | - - - - - - -
+ F A s5 |
+ | - - - - - - -
+ F A s6 |
+ | - - - - - - -
+ F A s7 |
+ | - - - - - - -
+ F A s8 |
+ | - - - - - - -
+ F A s9 |
+ | - - - - - - -
+ F A s10 |
+ | - - - - - - -
+
+ Rules Matched:
+ s4: r3
+ s5: r1, r2
+ s6: r2
+ s7: r1, r5
+ s8: r4, r5
+ s9: r5
+ s10: r1
+
+----------------------------------------------------------------------------------------------*/
+
+void GrSubPass::SetUpSimpleFSMTest()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 3;
+ m_nMaxRuleLoop = 2;
+ m_staBehavior = "SimpleFSM";
+
+ m_pfsm = new GrFSM();
+ Assert(m_pfsm);
+ m_pfsm->SetUpSimpleFSMTest();
+}
+
+void GrFSM::SetUpSimpleFSMTest()
+{
+ // Create machine class ranges.
+ m_cmcr = 14;
+ m_prgmcr = new GrFSMClassRange[14];
+ m_prgmcr[0].m_chwFirst = 47; // forward slash (acute): mcDa
+ m_prgmcr[0].m_chwLast = 47;
+ m_prgmcr[0].m_col = 4;
+
+ m_prgmcr[1].m_chwFirst = 92; // backslash: mcDg
+ m_prgmcr[1].m_chwLast = 92;
+ m_prgmcr[1].m_col = 5;
+
+ m_prgmcr[2].m_chwFirst = 94; // caret: mcDct
+ m_prgmcr[2].m_chwLast = 94;
+ m_prgmcr[2].m_col = 6;
+
+ m_prgmcr[3].m_chwFirst = 97; // a: mcVae
+ m_prgmcr[3].m_chwLast = 97;
+ m_prgmcr[3].m_col = 1;
+
+ m_prgmcr[4].m_chwFirst = 98; // b - d: mcCons
+ m_prgmcr[4].m_chwLast = 100;
+ m_prgmcr[4].m_col = 0;
+
+ m_prgmcr[5].m_chwFirst = 101; // e: mcVae
+ m_prgmcr[5].m_chwLast = 101;
+ m_prgmcr[5].m_col = 1;
+
+ m_prgmcr[6].m_chwFirst = 102; // f - h: mcCons
+ m_prgmcr[6].m_chwLast = 104;
+ m_prgmcr[6].m_col = 0;
+
+ m_prgmcr[7].m_chwFirst = 105; // i: mcVi
+ m_prgmcr[7].m_chwLast = 105;
+ m_prgmcr[7].m_col = 2;
+
+ m_prgmcr[8].m_chwFirst = 106; // j - n: mcCons
+ m_prgmcr[8].m_chwLast = 110;
+ m_prgmcr[8].m_col = 0;
+
+ m_prgmcr[9].m_chwFirst = 111; // o: mcVou
+ m_prgmcr[9].m_chwLast = 111;
+ m_prgmcr[9].m_col = 3;
+
+ m_prgmcr[10].m_chwFirst = 112; // p - t: mcCons
+ m_prgmcr[10].m_chwLast = 116;
+ m_prgmcr[10].m_col = 0;
+
+ m_prgmcr[11].m_chwFirst = 117; // u: mcVou
+ m_prgmcr[11].m_chwLast = 117;
+ m_prgmcr[11].m_col = 3;
+
+ m_prgmcr[12].m_chwFirst = 118; // v - z: mcCons
+ m_prgmcr[12].m_chwLast = 122;
+ m_prgmcr[12].m_col = 0;
+
+ m_prgmcr[13].m_chwFirst = 126; // tilde: mcDct
+ m_prgmcr[13].m_chwLast = 126;
+ m_prgmcr[13].m_col = 6;
+
+ m_dimcrInit = 8; // (max power of 2 <= m_cmcr);
+ m_cLoop = 3; // log2(max power of 2 <= m_cmcr);
+ m_imcrStart = m_cmcr - m_dimcrInit;
+
+
+ m_crow = 11;
+ m_crowNonAcpt = 4;
+ m_crowFinal = 6;
+ m_rowFinalMin = m_crow - m_crowFinal;
+ m_ccol = 7;
+
+ // Set up transition table.
+ m_prgrowTransitions = new short[35]; // 35 = (m_crow-m_crowFinal) * m_ccol
+ short * psn = m_prgrowTransitions;
+ *psn++ = 1; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 2; *psn++ = 4; *psn++ = 3; *psn++ = 0; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 5; *psn++ = 6; *psn++ = 6;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ =10; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 7; *psn++ = 8; *psn++ = 9;
+
+ // Set up matched-rules tables.
+ m_prgrulnMatched = new data16[10]; // 10 = sum of rules matched for each accepting state
+ m_prgirulnMin = new data16[7+1]; // 7 = m_crow - m_crowNonAcpt
+
+ m_prgirulnMin[0] = 0; // s4: r3
+ m_prgrulnMatched[0] = 3;
+
+ m_prgirulnMin[1] = 1; // s5: r1, r2
+ m_prgrulnMatched[1] = 1;
+ m_prgrulnMatched[2] = 2;
+
+ m_prgirulnMin[2] = 3; // s6: r2
+ m_prgrulnMatched[3] = 2;
+
+ m_prgirulnMin[3] = 4; // s7: r1, r5
+ m_prgrulnMatched[4] = 1;
+ m_prgrulnMatched[5] = 5;
+
+ m_prgirulnMin[4] = 6; // s8: r4, r5
+ m_prgrulnMatched[6] = 4;
+ m_prgrulnMatched[7] = 5;
+
+ m_prgirulnMin[5] = 8; // s9: r5
+ m_prgrulnMatched[8] = 5;
+
+ m_prgirulnMin[6] = 9; // s10: r1
+ m_prgrulnMatched[9] = 1;
+
+ m_prgirulnMin[7] = 10;
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ The "rule" does something silly: just inserts *'s--the number equals the number of the
+ rule.
+----------------------------------------------------------------------------------------------*/
+bool GrSubPass::RunSimpleFSMTest(GrTableManager * ptman, int ruln, GrSlotStream * psstrmInput,
+ GrSlotStream * psstrmOutput)
+{
+ int cslotMatched = (ruln == 3)? 2: 3;
+
+ GrSlotState * pslot0 = psstrmInput->Peek(0);
+
+ for (int islot = 0; islot < cslotMatched; islot++)
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+
+ for (islot = 0; islot < ruln; islot++)
+ {
+ GrSlotState * pslot;
+ ptman->NewSlot('*', pslot0, NULL, m_ipass, &pslot);
+ pslot->Associate(pslot0);
+ psstrmOutput->NextPut(pslot);
+ }
+
+ return true;
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ A simple set of rules with actions.
+
+ Rules:
+ r0. clsDigit gSlash clsDigit _ > @3 _ @1 gTilde; // tilde = 126
+ r1. _ clsDigit gBackSlash clsDigit > gDollar @4 _ @2; // dollar sign = 36
+
+ Machine classes:
+ mcDigit: '0' - '9' 48 - 57
+ mcSlash: '/' 47
+ mcBSlash: '\' 92
+
+
+ FSM: (T=transition, F=final, A=accepting, NA=non-accepting)
+
+ | clsDig mcSlash mcBSlash
+ ------------------------------------------------------
+ T NA s0 | s1
+ | - - -
+ T NA s1 | s2 s3
+ | - - -
+ T NA s2 | s4
+ | - - -
+ T NA s3 | s5
+ | - - -
+ F A s4 |
+ | - - -
+ F A s5 |
+ | - - -
+
+ Rules Matched:
+ s4: r0
+ s5: r1
+
+----------------------------------------------------------------------------------------------*/
+void GrEngine::SetUpRuleActionTest()
+{
+ if (m_pctbl)
+ delete m_pctbl;
+
+ m_pctbl = new GrClassTable();
+ m_pctbl->SetUpRuleActionTest();
+}
+
+void GrClassTable::SetUpRuleActionTest()
+{
+ m_ccls = 2; // number of classes
+ m_cclsLinear = 2; // number of classes in linear format
+
+ m_prgchwBIGGlyphList = new data16[100];
+
+ m_prgichwOffsets = new data16[2+1];
+
+ gid16 * pchw = m_prgchwBIGGlyphList;
+
+ // Output class 0: tilde
+ m_prgichwOffsets[0] = 0;
+ *pchw++ = msbf(data16(126)); // '~'
+
+ // Output class 1: dollar
+ m_prgichwOffsets[1] = 1;
+ *pchw++ = msbf(data16(36)); // '$'
+
+ m_prgichwOffsets[2] = 2;
+}
+
+void GrSubPass::SetUpRuleActionTest()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 3;
+ m_nMaxRuleLoop = 2;
+ m_staBehavior = "RuleAction";
+
+ m_pfsm = new GrFSM();
+ Assert(m_pfsm);
+ m_pfsm->SetUpRuleActionTest();
+
+ m_crul = 2;
+
+ // Set up constraint code--succeed trivially.
+ m_prgbConstraintBlock = new byte[3];
+ byte * pb = m_prgbConstraintBlock;
+ *pb++ = kopPushByte; *pb++ = 1; // Push true
+ *pb++ = kopPopRet; // PopAndRet
+
+ m_prgibConstraintStart = new data16[m_crul];
+ m_prgibConstraintStart[0] = 0;
+ m_prgibConstraintStart[1] = 0;
+
+ // Set up rule action code.
+ m_prgbActionBlock = new byte[30];
+ pb = m_prgbActionBlock;
+
+ // Rule 1: clsDigit gSlash clsDigit _ > @3 _ @1 gTilde;
+
+ *pb++ = kopPutCopy; *pb++ = 2; // PutCopy 2
+ *pb++ = kopNext; // Next
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopPutCopy; *pb++ = -2; // PutCopy -2
+ *pb++ = kopNext; // Next
+ *pb++ = kopInsert; // Insert
+ *pb++ = kopPutGlyph8bitObs; *pb++ = 0; // PutGlyph 0 ('~' = 126)
+ *pb++ = kopNext; // Next
+ *pb++ = kopPushByte; *pb++ = 0; // Push 0
+ *pb++ = kopPopRet; // PopAndRet
+
+ // Rule 2: _ clsDigit gBackSlash clsDigit > gDollar @4 _ @2;
+
+ *pb++ = kopInsert; // Insert
+ *pb++ = kopPutGlyph8bitObs; *pb++ = 1; // PutGlyph 1 ('$' = 36)
+ *pb++ = kopNext; // Next
+ *pb++ = kopPutCopy; *pb++ = 2; // PutCopy 2
+ *pb++ = kopNext; // Next
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopPutCopy; *pb++ = -2; // PutCopy -2
+ *pb++ = kopNext; // Next
+ *pb++ = kopPushByte; *pb++ = 0; // Push 0
+ *pb++ = kopPopRet; // PopAndRet
+
+ m_prgibActionStart = new data16[m_crul];
+ m_prgibActionStart[0] = 0;
+ m_prgibActionStart[1] = 15;
+}
+
+void GrFSM::SetUpRuleActionTest()
+{
+ // Create machine class ranges.
+ m_cmcr = 3;
+ m_prgmcr = new GrFSMClassRange[3];
+ m_prgmcr[0].m_chwFirst = 47; // forward slash: mcSlash
+ m_prgmcr[0].m_chwLast = 47;
+ m_prgmcr[0].m_col = 1;
+
+ m_prgmcr[1].m_chwFirst = 48; // 0 - 9: mcDigit
+ m_prgmcr[1].m_chwLast = 57;
+ m_prgmcr[1].m_col = 0;
+
+ m_prgmcr[2].m_chwFirst = 92; // backslash
+ m_prgmcr[2].m_chwLast = 92;
+ m_prgmcr[2].m_col = 2;
+
+
+ m_dimcrInit = 2; // (max power of 2 <= m_cmcr);
+ m_cLoop = 1; // log2(max power of 2 <= m_cmcr);
+ m_imcrStart = m_cmcr - m_dimcrInit;
+
+
+ m_crow = 6;
+ m_crowNonAcpt = 4;
+ m_crowFinal = 2;
+ m_rowFinalMin = m_crow - m_crowFinal;
+ m_ccol = 3;
+
+ // Set up transition table.
+ m_prgrowTransitions = new short[12]; // 12 = (m_crow-m_crowFinal) * m_ccol
+ short * psn = m_prgrowTransitions;
+ *psn++ = 1; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 2; *psn++ = 3;
+ *psn++ = 4; *psn++ = 0; *psn++ = 0;
+ *psn++ = 5; *psn++ = 0; *psn++ = 0;
+
+ // Set up matched-rules tables.
+ m_prgrulnMatched = new data16[2]; // 2 = sum of rules matched for each accepting state
+ m_prgirulnMin = new data16[2+1]; // 2 = m_crow - m_crowNonAcpt
+
+ m_prgirulnMin[0] = 0; // s4: r0
+ m_prgrulnMatched[0] = 0;
+
+ m_prgirulnMin[1] = 1; // s5: r1
+ m_prgrulnMatched[1] = 1;
+
+ m_prgirulnMin[2] = 2;
+}
+
+/*----------------------------------------------------------------------------------------------
+ A more complicated set of rules with actions.
+
+ PASS 1:
+ r0. clsDigit > @1 {dir = DIR_RIGHT} / ^ _ {dir == DIR_LEFT};
+ r1. clsSpecial > @2 {dir = DIR_ARABNUMBER} / clsDigit {dir != DIR_LEFT} ^ _;
+ r2. clsSpecial > @2 {dir = @1.dir} / clsSpecial ^ _;
+
+ Pass 1 machine classes:
+ mcDigit: '0' - '9' 48 - 57
+ mcSpecial: '-', '_', '=', '~' 45, 95, 61, 126
+
+ Pass 1 FSM: (T=transition, F=final, A=accepting, NA=non-accepting)
+
+ | mcDigit mcSpecial
+ ------------------------------------------
+ T NA s0 | s2 s1
+ | - _
+ T NA s1 | s4
+ | - -
+ T A s2 | s3
+ | - -
+ F A s3 |
+ | - -
+ F A s4 |
+ | - -
+
+ Rules Matched:
+ s2: r0
+ s3: r1
+ s4: r2
+
+ PASS 2:
+ r0. clsVowel gCaret > clsCirumVowel _;
+ r1. clsVowel gSlash > _ clsAcuteVowel$1;
+
+ Pass 2 machine classes:
+ mcVowel
+ mcCaret: '^' 94
+ mcSlash: '/' 47
+
+
+ Pass 2 FSM:
+ | mcVowel mcCaret mcSlash
+ -----------------------------------------------------
+ T NA s0 | s1
+ | - _
+ T NA s1 | s2 s3
+ | - -
+ F A s2 |
+ | - -
+ F A s3 |
+ | - -
+
+ Rules matched:
+ s2: r0
+ s3: r1
+
+
+ PASS 3:
+ r0. clsLeft > clsRight {dir = @1.dir} / _ clsDir {dir==DIR_RIGHT};
+ r1. clsRight > clsLeft {dir = @1.dir} / clsDir {dir==DIR_RIGHT} _;
+
+ Pass 3 machine classes:
+ mcDir: (clsDigit, clsSpecial)
+ mcLeft: '(', '[', '{' 40, 91, 123
+ mcRight: ')', ']', '}' 41, 93, 125
+
+ Pass 3 FSM:
+ | mcDir mcLeft mcRight
+ -----------------------------------------------------
+ T NA s0 | s2 s1
+ | - _
+ T NA s1 | s3
+ | - -
+ T NA s2 | s4
+ | - -
+ F A s3 |
+ | - -
+ F A s4 |
+ | - -
+
+ Rules matched:
+ s3: r0
+ s4: r1
+
+
+----------------------------------------------------------------------------------------------*/
+void GrEngine::SetUpRuleAction2Test()
+{
+ if (m_pctbl)
+ delete m_pctbl;
+
+ m_pctbl = new GrClassTable();
+ m_pctbl->SetUpRuleAction2Test();
+}
+
+void GrClassTable::SetUpRuleAction2Test()
+{
+ m_ccls = 7; // number of classes
+ m_cclsLinear = 4; // number of classes in linear format
+
+ m_prgchwBIGGlyphList = new data16[70];
+
+ m_prgichwOffsets = new data16[7+1];
+
+ data16 * pchw = m_prgchwBIGGlyphList;
+
+ // Output class 0: clsCirumVowel
+ m_prgichwOffsets[0] = 0;
+ *pchw++ = msbf(data16(226)); // a
+ *pchw++ = msbf(data16(234)); // e
+ *pchw++ = msbf(data16(238)); // i
+ *pchw++ = msbf(data16(244)); // o
+ *pchw++ = msbf(data16(251)); // u
+ *pchw++ = msbf(data16(194)); // A
+ *pchw++ = msbf(data16(202)); // E
+ *pchw++ = msbf(data16(206)); // I
+ *pchw++ = msbf(data16(212)); // O
+ *pchw++ = msbf(data16(219)); // U
+
+ // Output class 1: clsAcuteVowel
+ m_prgichwOffsets[1] = 10;
+ *pchw++ = msbf(data16(225)); // a
+ *pchw++ = msbf(data16(233)); // e
+ *pchw++ = msbf(data16(237)); // i
+ *pchw++ = msbf(data16(243)); // o
+ *pchw++ = msbf(data16(250)); // u
+ *pchw++ = msbf(data16(193)); // A
+ *pchw++ = msbf(data16(201)); // E
+ *pchw++ = msbf(data16(205)); // I
+ *pchw++ = msbf(data16(211)); // O
+ *pchw++ = msbf(data16(218)); // U
+
+ // Output class 2: clsLeft
+ m_prgichwOffsets[2] = 10 + 10;
+ *pchw++ = msbf(data16(40)); // (
+ *pchw++ = msbf(data16(91)); // [
+ *pchw++ = msbf(data16(123)); // {
+
+ // Output class 3: clsRight
+ m_prgichwOffsets[3] = 20 + 3;
+ *pchw++ = msbf(data16(41)); // )
+ *pchw++ = msbf(data16(93)); // ]
+ *pchw++ = msbf(data16(125)); // }
+
+ // Input class 4: clsVowel
+ m_prgichwOffsets[4] = 23 + 3; // 26
+ *pchw++ = msbf(data16(10));
+ *pchw++ = msbf(data16(8)); *pchw++ = msbf(data16(3)); *pchw++ = msbf(data16(10-8));
+ *pchw++ = msbf(data16(65)); *pchw++ = msbf(data16(5)); // A
+ *pchw++ = msbf(data16(69)); *pchw++ = msbf(data16(6)); // E
+ *pchw++ = msbf(data16(73)); *pchw++ = msbf(data16(7)); // I
+ *pchw++ = msbf(data16(79)); *pchw++ = msbf(data16(8)); // O
+ *pchw++ = msbf(data16(85)); *pchw++ = msbf(data16(9)); // U
+ *pchw++ = msbf(data16(97)); *pchw++ = msbf(data16(0)); // a
+ *pchw++ = msbf(data16(101)); *pchw++ = msbf(data16(1)); // e
+ *pchw++ = msbf(data16(105)); *pchw++ = msbf(data16(2)); // i
+ *pchw++ = msbf(data16(111)); *pchw++ = msbf(data16(3)); // o
+ *pchw++ = msbf(data16(117)); *pchw++ = msbf(data16(4)); // u
+
+ // Input class 5: clsLeft
+ m_prgichwOffsets[5] = 26 + 4 + 10*2; // 50
+ *pchw++ = msbf(data16(3));
+ *pchw++ = msbf(data16(2)); *pchw++ = msbf(data16(1)); *pchw++ = msbf(data16(3-2));
+ *pchw++ = msbf(data16(40)); *pchw++ = msbf(data16(0)); // (
+ *pchw++ = msbf(data16(91)); *pchw++ = msbf(data16(1)); // [
+ *pchw++ = msbf(data16(123)); *pchw++ = msbf(data16(2)); // {
+
+ // Input class 6: clsRight
+ m_prgichwOffsets[6] = 50 + 4 + 3*2; // 60
+ *pchw++ = msbf(data16(3));
+ *pchw++ = msbf(data16(2)); *pchw++ = msbf(data16(1)); *pchw++ = msbf(data16(3-2));
+ *pchw++ = msbf(data16(41)); *pchw++ = msbf(data16(0)); // )
+ *pchw++ = msbf(data16(93)); *pchw++ = msbf(data16(1)); // ]
+ *pchw++ = msbf(data16(125)); *pchw++ = msbf(data16(2)); // }
+
+ m_prgichwOffsets[7] = 60 + 4 + 3*2; // 70
+}
+
+void GrSubPass::SetUpRuleAction2Test()
+{
+ if (m_ipass == 1)
+ {
+ m_nMaxRuleContext = m_nMaxChunk = 2;
+ m_nMaxRuleLoop = 5;
+ m_staBehavior = "RuleAction2";
+
+ m_pfsm = new GrFSM();
+ Assert(m_pfsm);
+ m_pfsm->SetUpRuleAction2Test(m_ipass);
+
+ m_crul = 3;
+
+ // Set up constraint code.
+ m_prgbConstraintBlock = new byte[1 + 10 + 10];
+ byte * pb = m_prgbConstraintBlock;
+ *pb++ = kopRetTrue; // RetTrue
+
+ *pb++ = kopCntxtItem; *pb++ = 0; // ContextItem 0
+ *pb++ = kopPushSlotAttr; *pb++= kslatDir; // PushSlotAttr dir 0
+ *pb++ = 0;
+ *pb++ = kopPushByte; *pb++ = kdircL; // Push DIR_LEFT
+ *pb++ = kopEqual; // Equal
+ *pb++ = kopOr; // Or
+ *pb++ = kopPopRet; // PopAndRet
+
+ *pb++ = kopCntxtItem; *pb++ = 0; // ContextItem 0
+ *pb++ = kopPushSlotAttr; *pb++= kslatDir; // PushSlotAttr dir 0
+ *pb++ = 0;
+ *pb++ = kopPushByte; *pb++ = kdircL; // Push DIR_LEFT
+ *pb++ = kopNotEq; // NotEqual
+ *pb++ = kopOr; // Or
+ *pb++ = kopPopRet; // PopAndRet
+
+ m_prgibConstraintStart = new data16[m_crul];
+ m_prgibConstraintStart[0] = 1;
+ m_prgibConstraintStart[1] = 11;
+ m_prgibConstraintStart[2] = 0;
+
+ // Set up rule action code.
+ m_prgbActionBlock = new byte[10 + 11 + 12];
+ pb = m_prgbActionBlock;
+
+ // Rule 0: clsDigit > @1 {dir = DIR_RIGHT} / ^ _ {dir == DIR_LEFT};
+
+ *pb++ = kopPutCopy; *pb++ = 0; // PutCopy 0
+ *pb++ = kopPushByte; *pb++ = kdircR; // PushByte DIR_RIGHT
+ *pb++ = kopAttrSet; *pb++ = kslatDir; // AttrSet dir
+ *pb++ = kopNext; // Next
+ *pb++ = kopPushByte; *pb++ = -1; // Push -1
+ *pb++ = kopPopRet; // PopAndRet
+
+ // Rule 1: clsSpecial > @2 {dir = DIR_ARABNUMBER} / clsDigit {dir != DIR_LEFT} ^ _;
+
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopPutCopy; *pb++ = 0; // PutCopy 0
+ *pb++ = kopPushByte; *pb++ = kdircArabNum; // Push DIR_ARABNUMBER
+ *pb++ = kopAttrSet; *pb++ = kslatDir; // AttrSet dir
+ *pb++ = kopNext; // Next
+ *pb++ = kopPushByte; *pb++ = -1; // Push -1
+ *pb++ = kopPopRet; // PopAndRet
+
+ // Rule 2: clsSpecial > @2 {dir = @1.dir} / clsSpecial ^ _;
+
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopPutCopy; *pb++ = 0; // PutCopy 0
+ *pb++ = kopPushSlotAttr;*pb++ = kslatDir; // PushSlotAttr dir -1
+ *pb++ = -1;
+ *pb++ = kopAttrSet; *pb++ = kslatDir; // AttrSet dir
+ *pb++ = kopNext; // Next
+ *pb++ = kopPushByte; *pb++ = -1; // Push -1
+ *pb++ = kopPopRet; // PopAndRet
+
+ m_prgibActionStart = new data16[m_crul];
+ m_prgibActionStart[0] = 0;
+ m_prgibActionStart[1] = 10;
+ m_prgibActionStart[2] = 10 + 11;
+ }
+ else if (m_ipass == 2)
+ {
+ m_nMaxRuleContext = m_nMaxChunk = 2;
+ m_nMaxRuleLoop = 3;
+ m_staBehavior = "RuleAction2";
+
+ m_pfsm = new GrFSM();
+ Assert(m_pfsm);
+ m_pfsm->SetUpRuleAction2Test(m_ipass);
+
+ m_crul = 2;
+
+ // Set up constraint code--succeed trivially.
+ m_prgbConstraintBlock = new byte[1];
+ byte * pb = m_prgbConstraintBlock;
+ *pb++ = kopRetTrue; // RetTrue
+
+ m_prgibConstraintStart = new data16[m_crul];
+ m_prgibConstraintStart[0] = 0;
+ m_prgibConstraintStart[1] = 0;
+
+ // Set up rule action code.
+ m_prgbActionBlock = new byte[16];
+ pb = m_prgbActionBlock;
+
+ // Rule 0: clsVowel gCaret > clsCirumVowel _;
+
+ *pb++ = kopPutSubs8bitObs; *pb++ = 0; // PutSubs 0 clsVowel clsCircumVowel
+ *pb++ = 4; *pb++ = 0;
+ *pb++ = kopNext; // Next
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 1: clsVowel gSlash > _ clsAcuteVowel$1;
+
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopPutSubs8bitObs; *pb++ = -1; // PutSubs -1 clsVowel clsAcuteVowel
+ *pb++ = 4; *pb++ = 1;
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ m_prgibActionStart = new data16[m_crul];
+ m_prgibActionStart[0] = 0;
+ m_prgibActionStart[1] = 8;
+ }
+ else if (m_ipass == 3)
+ {
+ m_nMaxRuleContext = m_nMaxChunk = 2;
+ m_nMaxRuleLoop = 3;
+ m_staBehavior = "RuleAction2";
+
+ m_pfsm = new GrFSM();
+ Assert(m_pfsm);
+ m_pfsm->SetUpRuleAction2Test(m_ipass);
+
+ m_crul = 2;
+
+ // Set up constraint code.
+ m_prgbConstraintBlock = new byte[1 + 10 + 10];
+ byte * pb = m_prgbConstraintBlock;
+ *pb++ = kopRetTrue; // RetTrue
+
+ *pb++ = kopCntxtItem; *pb++ = 1; // ContextItem 1
+ *pb++ = kopPushSlotAttr;*pb++ = kslatDir; // PushSlotAttr dir 0
+ *pb++ = 0;
+ *pb++ = kopPushByte; *pb++ = kdircR; // Push DIR_RIGHT
+ *pb++ = kopEqual; // Equal
+ *pb++ = kopOr; // Or
+ *pb++ = kopPopRet; // PopAndRet
+
+ *pb++ = kopCntxtItem; *pb++ = 0; // ContextItem 0
+ *pb++ = kopPushSlotAttr;*pb++ = kslatDir; // PushSlotAttr dir 0
+ *pb++ = 0;
+ *pb++ = kopPushByte; *pb++ = kdircR; // Push DIR_RIGHT
+ *pb++ = kopEqual; // Equal
+ *pb++ = kopOr; // Or
+ *pb++ = kopPopRet; // PopAndRet
+
+ m_prgibConstraintStart = new data16[m_crul];
+ m_prgibConstraintStart[0] = 1;
+ m_prgibConstraintStart[1] = 1 + 10;
+
+ // Set up rule action code.
+ m_prgbActionBlock = new byte[23];
+ pb = m_prgbActionBlock;
+
+ // Rule 0: clsLeft > clsRight {dir = @1.dir} / _ clsDir {dir == DIR_RIGHT};
+
+ *pb++ = kopPutSubs8bitObs; *pb++ = 0; // PutSubs 0 clsLeft clsRight
+ *pb++ = 5; *pb++ = 3;
+ *pb++ = kopPushSlotAttr;*pb++ = kslatDir; // PushSlotAttr dir 1
+ *pb++ = 1;
+ *pb++ = kopAttrSet; *pb++ = kslatDir; // AttrSet dir
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 1: clsRight > clsLeft {dir = @1.dir} / clsDir {dir == DIR_RIGHT} _;
+
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopPutSubs8bitObs; *pb++ = 0; // PutSubs 0 clsRight clsLeft
+ *pb++ = 6; *pb++ = 2;
+ *pb++ = kopPushSlotAttr;*pb++ = kslatDir; // PushSlotAttr dir -1
+ *pb++ = -1;
+ *pb++ = kopAttrSet; *pb++ = kslatDir; // AttrSet dir
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ m_prgibActionStart = new data16[m_crul];
+ m_prgibActionStart[0] = 0;
+ m_prgibActionStart[1] = 11;
+ }
+}
+
+
+void GrFSM::SetUpRuleAction2Test(int ipass)
+{
+ if (ipass == 1)
+ {
+ // Create machine class ranges.
+ m_cmcr = 5;
+ m_prgmcr = new GrFSMClassRange[5];
+ m_prgmcr[0].m_chwFirst = 45; // hyphen
+ m_prgmcr[0].m_chwLast = 45;
+ m_prgmcr[0].m_col = 1;
+
+ m_prgmcr[1].m_chwFirst = 48; // 0 - 9: mcDigit
+ m_prgmcr[1].m_chwLast = 57;
+ m_prgmcr[1].m_col = 0;
+
+ m_prgmcr[2].m_chwFirst = 61; // equals sign
+ m_prgmcr[2].m_chwLast = 61;
+ m_prgmcr[2].m_col = 1;
+
+ m_prgmcr[3].m_chwFirst = 95; // underscore
+ m_prgmcr[3].m_chwLast = 95;
+ m_prgmcr[3].m_col = 1;
+
+ m_prgmcr[4].m_chwFirst = 126; // tilde
+ m_prgmcr[4].m_chwLast = 126;
+ m_prgmcr[4].m_col = 1;
+
+ m_dimcrInit = 4; // (max power of 2 <= m_cmcr);
+ m_cLoop = 2; // log2(max power of 2 <= m_cmcr);
+ m_imcrStart = m_cmcr - m_dimcrInit;
+
+
+ m_crow = 5;
+ m_crowNonAcpt = 2;
+ m_crowFinal = 2;
+ m_rowFinalMin = m_crow - m_crowFinal;
+ m_ccol = 2;
+
+ // Set up transition table.
+ m_prgrowTransitions = new short[6]; // 6 = (m_crow-m_crowFinal) * m_ccol
+ short * psn = m_prgrowTransitions;
+ *psn++ = 2; *psn++ = 1;
+ *psn++ = 0; *psn++ = 4;
+ *psn++ = 0; *psn++ = 3;
+
+ // Set up matched-rules tables.
+ m_prgrulnMatched = new data16[3]; // 3 = sum of rules matched for each accepting state
+ m_prgirulnMin = new data16[3+1]; // 3 = m_crow - m_crowNonAcpt
+
+ m_prgirulnMin[0] = 0; // s2: r0
+ m_prgrulnMatched[0] = 0;
+
+ m_prgirulnMin[1] = 1; // s3: r1
+ m_prgrulnMatched[1] = 1;
+
+ m_prgirulnMin[2] = 2; // s3: r2
+ m_prgrulnMatched[2] = 2;
+
+ m_prgirulnMin[3] = 3;
+ }
+ else if (ipass == 2)
+ {
+ // Create machine class ranges.
+ m_cmcr = 12;
+ m_prgmcr = new GrFSMClassRange[12];
+ m_prgmcr[0].m_chwFirst = 47; // slash
+ m_prgmcr[0].m_chwLast = 47;
+ m_prgmcr[0].m_col = 2;
+
+ m_prgmcr[1].m_chwFirst = 65; // A
+ m_prgmcr[1].m_chwLast = 65;
+ m_prgmcr[1].m_col = 0;
+
+ m_prgmcr[2].m_chwFirst = 69; // E
+ m_prgmcr[2].m_chwLast = 69;
+ m_prgmcr[2].m_col = 0;
+
+ m_prgmcr[3].m_chwFirst = 73; // I
+ m_prgmcr[3].m_chwLast = 73;
+ m_prgmcr[3].m_col = 0;
+
+ m_prgmcr[4].m_chwFirst = 79; // O
+ m_prgmcr[4].m_chwLast = 79;
+ m_prgmcr[4].m_col = 0;
+
+ m_prgmcr[5].m_chwFirst = 85; // U
+ m_prgmcr[5].m_chwLast = 85;
+ m_prgmcr[5].m_col = 0;
+
+ m_prgmcr[6].m_chwFirst = 94; // caret
+ m_prgmcr[6].m_chwLast = 94;
+ m_prgmcr[6].m_col = 1;
+
+ m_prgmcr[7].m_chwFirst = 97; // a
+ m_prgmcr[7].m_chwLast = 97;
+ m_prgmcr[7].m_col = 0;
+
+ m_prgmcr[8].m_chwFirst = 101; // e
+ m_prgmcr[8].m_chwLast = 101;
+ m_prgmcr[8].m_col = 0;
+
+ m_prgmcr[9].m_chwFirst = 105; // i
+ m_prgmcr[9].m_chwLast = 105;
+ m_prgmcr[9].m_col = 0;
+
+ m_prgmcr[10].m_chwFirst = 111; // o
+ m_prgmcr[10].m_chwLast = 111;
+ m_prgmcr[10].m_col = 0;
+
+ m_prgmcr[11].m_chwFirst = 117; // u
+ m_prgmcr[11].m_chwLast = 117;
+ m_prgmcr[11].m_col = 0;
+
+ m_dimcrInit = 8; // (max power of 2 <= m_cmcr);
+ m_cLoop = 3; // log2(max power of 2 <= m_cmcr);
+ m_imcrStart = m_cmcr - m_dimcrInit;
+
+
+ m_crow = 4;
+ m_crowNonAcpt = 2;
+ m_crowFinal = 2;
+ m_rowFinalMin = m_crow - m_crowFinal;
+ m_ccol = 3;
+
+ // Set up transition table.
+ m_prgrowTransitions = new short[6]; // 6 = (m_crow-m_crowFinal) * m_ccol
+ short * psn = m_prgrowTransitions;
+ *psn++ = 1; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 2; *psn++ = 3;
+
+ // Set up matched-rules tables.
+ m_prgrulnMatched = new data16[2]; // 2 = sum of rules matched for each accepting state
+ m_prgirulnMin = new data16[2+1]; // 2 = m_crow - m_crowNonAcpt
+
+ m_prgirulnMin[0] = 0; // s1: r0
+ m_prgrulnMatched[0] = 0;
+
+ m_prgirulnMin[1] = 1; // s2: r1
+ m_prgrulnMatched[1] = 1;
+
+ m_prgirulnMin[2] = 2;
+ }
+ else if (ipass == 3)
+ {
+ // Create machine class ranges.
+ m_cmcr = 11;
+ m_prgmcr = new GrFSMClassRange[11];
+ m_prgmcr[0].m_chwFirst = 40; // (
+ m_prgmcr[0].m_chwLast = 40;
+ m_prgmcr[0].m_col = 1;
+
+ m_prgmcr[1].m_chwFirst = 41; // )
+ m_prgmcr[1].m_chwLast = 41;
+ m_prgmcr[1].m_col = 2;
+
+ m_prgmcr[2].m_chwFirst = 45; // hyphen
+ m_prgmcr[2].m_chwLast = 45;
+ m_prgmcr[2].m_col = 0;
+
+ m_prgmcr[3].m_chwFirst = 48; // 0 - 9: mcDigit
+ m_prgmcr[3].m_chwLast = 57;
+ m_prgmcr[3].m_col = 0;
+
+ m_prgmcr[4].m_chwFirst = 61; // =
+ m_prgmcr[4].m_chwLast = 61;
+ m_prgmcr[4].m_col = 0;
+
+ m_prgmcr[5].m_chwFirst = 91; // [
+ m_prgmcr[5].m_chwLast = 91;
+ m_prgmcr[5].m_col = 1;
+
+ m_prgmcr[6].m_chwFirst = 93; // ]
+ m_prgmcr[6].m_chwLast = 93;
+ m_prgmcr[6].m_col = 2;
+
+ m_prgmcr[7].m_chwFirst = 95; // underscore
+ m_prgmcr[7].m_chwLast = 95;
+ m_prgmcr[7].m_col = 0;
+
+ m_prgmcr[8].m_chwFirst = 123; // {
+ m_prgmcr[8].m_chwLast = 123;
+ m_prgmcr[8].m_col = 1;
+
+ m_prgmcr[9].m_chwFirst = 125; // }
+ m_prgmcr[9].m_chwLast = 125;
+ m_prgmcr[9].m_col = 2;
+
+ m_prgmcr[10].m_chwFirst = 126; // tilde
+ m_prgmcr[10].m_chwLast = 126;
+ m_prgmcr[10].m_col = 0;
+
+ m_dimcrInit = 8; // (max power of 2 <= m_cmcr);
+ m_cLoop = 3; // log2(max power of 2 <= m_cmcr);
+ m_imcrStart = m_cmcr - m_dimcrInit;
+
+
+ m_crow = 5;
+ m_crowNonAcpt = 3;
+ m_crowFinal = 2;
+ m_rowFinalMin = m_crow - m_crowFinal;
+ m_ccol = 3;
+
+ // Set up transition table.
+ m_prgrowTransitions = new short[9]; // 9 = (m_crow-m_crowFinal) * m_ccol
+ short * psn = m_prgrowTransitions;
+ *psn++ = 2; *psn++ = 1; *psn++ = 0;
+ *psn++ = 3; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ = 4;
+
+ // Set up matched-rules tables.
+ m_prgrulnMatched = new data16[2]; // 2 = sum of rules matched for each accepting state
+ m_prgirulnMin = new data16[2+1]; // 2 = m_crow - m_crowNonAcpt
+
+ m_prgirulnMin[0] = 0; // s3: r0
+ m_prgrulnMatched[0] = 0;
+
+ m_prgirulnMin[1] = 1; // s4: r1
+ m_prgrulnMatched[1] = 1;
+
+ m_prgirulnMin[2] = 2;
+ }
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Tests of various kinds of assocations.
+
+ PASS 1 (line-break):
+ r0. gX / # _ ^ ; // do nothing
+ r1. gX {break = -2};
+
+ Pass 1 machine classes:
+ mcX: 'x' 120
+ mcLB: 35
+
+ Pass 1 FSM: (T=transition, F=final, A=accepting, NA=non-accepting)
+
+ | gX gLB
+ --------------------------------
+ T NA s0 | s2 s1
+ |
+ T NA s1 | s3
+ |
+ F A s2 |
+ |
+ F A s3 |
+
+
+ Rules Matched:
+ s2: r1
+ s3: r0
+
+
+
+ PASS 2:
+ r0. clsOA clsE > clsELig:(1 2) _;
+ r1. clsLC _ _ gX > @1 @5 @1 @5 / _ _ # {break==2} _ _ ;
+ r2. _ clsFraction _ > clsNumerator:2 gSlash:2 clsDenom:2;
+
+ Pass 2 machine classes:
+ mcOA: O A 79 65
+ mcOAlc: o a 111 97
+ mcE E e 69 101
+ mcFraction: 188 189 190
+ mcX: x 120
+ mcLCother
+ mcLB: 35
+
+
+ Pass 2 FSM: mcLC
+ | mcOA mcOAlc mcE mcElc other mcX mcFractn mcLB
+ -----------------------------------------------------------------------------------------
+ T NA s0 | s1 s2 s4 s3 s3 s6
+ | - - - - - - -
+ T NA s1 | s7
+ | - - - - - - -
+ T NA s2 | s7 s5
+ | - - - - - - -
+ T NA s3 | s5
+ | - - - - - - -
+ T NA s4 | s5
+ | - - - - - - -
+ T NA s5 | s8
+ | - - - - - - -
+ F A s6 |
+ | - - - - - -
+ F A s7 |
+ | - - - - - -
+ F A s8 |
+ | - - - - - -
+
+ Rules matched:
+ s6: r2
+ s7: r0
+ s8: r1
+
+
+ PASS 3:
+ r0. _ > gHyphen / _ # {break == 2} ^;
+
+ Pass 3 machine classes:
+ mcLB: 35
+
+ Pass 3 FSM:
+
+ | gLB
+ --------------------------------
+ T NA s0 | s1
+ |
+ F A s1 |
+ |
+
+ Rules Matched:
+ s1: r0
+----------------------------------------------------------------------------------------------*/
+void GrEngine::SetUpAssocTest()
+{
+ if (m_pctbl)
+ delete m_pctbl;
+
+ m_pctbl = new GrClassTable();
+ m_pctbl->SetUpAssocTest();
+
+ m_fLineBreak = true;
+ m_cchwPreXlbContext = 1;
+ m_cchwPostXlbContext = 1;
+}
+
+void GrClassTable::SetUpAssocTest()
+{
+ m_ccls = 11; // number of classes
+ m_cclsLinear = 5; // number of classes in linear format (output classes)
+
+ m_prgchwBIGGlyphList = new data16[143];
+
+ m_prgichwOffsets = new data16[m_ccls+1];
+
+ data16 * pchw = m_prgchwBIGGlyphList;
+
+ // Output class 0: clsELig
+ m_prgichwOffsets[0] = 0;
+ *pchw++ = msbf(data16(140)); // OE
+ *pchw++ = msbf(data16(198)); // AE
+ *pchw++ = msbf(data16(156)); // oe
+ *pchw++ = msbf(data16(230)); // ae
+
+ // Output class 1: clsNumerator
+ m_prgichwOffsets[1] = 4;
+ *pchw++ = msbf(data16(49)); // 1
+ *pchw++ = msbf(data16(49)); // 1
+ *pchw++ = msbf(data16(51)); // 3
+
+ // Output class 2: clsDenom
+ m_prgichwOffsets[2] = 4 + 3;
+ *pchw++ = msbf(data16(52)); // 4
+ *pchw++ = msbf(data16(50)); // 2
+ *pchw++ = msbf(data16(52)); // 4
+
+ // Output class 3: gSlash
+ m_prgichwOffsets[3] = 7 + 3;
+ *pchw++ = msbf(data16(47)); // '/'
+
+ // Output class 4: gHyphen
+ m_prgichwOffsets[4] = 10 + 1;
+ *pchw++ = msbf(data16(45)); // '-'
+
+ // Input class 5: clsOA
+ m_prgichwOffsets[5] = 11 + 1;
+ *pchw++ = msbf(data16(4));
+ *pchw++ = msbf(data16(4)); *pchw++ = msbf(data16(2)); *pchw++ = msbf(data16(0));
+ *pchw++ = msbf(data16(65)); *pchw++ = msbf(data16(1)); // A
+ *pchw++ = msbf(data16(79)); *pchw++ = msbf(data16(0)); // O
+ *pchw++ = msbf(data16(97)); *pchw++ = msbf(data16(3)); // a
+ *pchw++ = msbf(data16(111)); *pchw++ = msbf(data16(2)); // o
+
+ // Input class 6: clsE
+ m_prgichwOffsets[6] = 12 + 4 + 4*2; // 24
+ *pchw++ = msbf(data16(3));
+ *pchw++ = msbf(data16(2)); *pchw++ = msbf(data16(1)); *pchw++ = msbf(data16(3-2));
+ *pchw++ = msbf(data16(40)); *pchw++ = msbf(data16(0)); // E
+ *pchw++ = msbf(data16(91)); *pchw++ = msbf(data16(1)); // e
+
+ // Input class 7: clsLC
+ m_prgichwOffsets[7] = 24 + 4 + 2*2; // 32
+ *pchw++ = msbf(data16(26));
+ *pchw++ = msbf(data16(16)); *pchw++ = msbf(data16(4)); *pchw++ = msbf(data16(26-16));
+ for (int i = 0; i < 26; ++i)
+ {
+ *pchw++ = msbf(data16(97+i)); *pchw++ = msbf(data16(i));
+ }
+
+ // Input class 8: gX
+ m_prgichwOffsets[8] = 32 + 4 + 26*2; // 88
+ *pchw++ = msbf(data16(1));
+ *pchw++ = msbf(data16(1)); *pchw++ = msbf(data16(0)); *pchw++ = msbf(data16(0));
+ *pchw++ = msbf(data16(120)); *pchw++ = msbf(data16(0));
+
+ // Input class 9: clsFraction
+ m_prgichwOffsets[9] = 88 + 4 + 1*2; // 127
+ *pchw++ = msbf(data16(3));
+ *pchw++ = msbf(data16(2)); *pchw++ = msbf(data16(1)); *pchw++ = msbf(data16(3-2));
+ *pchw++ = msbf(data16(188)); *pchw++ = msbf(data16(0)); // 1/4
+ *pchw++ = msbf(data16(189)); *pchw++ = msbf(data16(1)); // 1/2
+ *pchw++ = msbf(data16(190)); *pchw++ = msbf(data16(2)); // 3/4
+
+ // Input class 10: #
+ m_prgichwOffsets[10] = 127 + 4 + 3*2; // 137
+ *pchw++ = msbf(data16(1));
+ *pchw++ = msbf(data16(1)); *pchw++ = msbf(data16(0)); *pchw++ = msbf(data16(0));
+ *pchw++ = msbf(data16(35)); *pchw++ = msbf(data16(0)); // 1/4
+
+ m_prgichwOffsets[11] = 137 + 4 + 1*2; // 143
+}
+
+void GrLineBreakPass::SetUpAssocTest()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 1;
+ m_nMaxRuleLoop = 5;
+ m_staBehavior = "Assoc";
+
+ m_pfsm = new GrFSM();
+ Assert(m_pfsm);
+ m_pfsm->SetUpAssocTest(m_ipass);
+
+ m_crul = 2;
+
+ // Set up constraint code--succeed trivially.
+ m_prgbConstraintBlock = new byte[1];
+ byte * pb = m_prgbConstraintBlock;
+ *pb++ = kopRetTrue; // RetTrue
+
+ m_prgibConstraintStart = new data16[m_crul];
+ m_prgibConstraintStart[0] = 0;
+ m_prgibConstraintStart[1] = 0;
+
+ // Set up rule action code.
+ m_prgbActionBlock = new byte[7 + 8];
+ pb = m_prgbActionBlock;
+
+ // Rule 0: gX / # _ ^ ; // do nothing
+
+ *pb++ = kopPutCopy; *pb++ = 0; // PutCopy 0
+ *pb++ = kopNext; // Next
+ *pb++ = kopPutCopy; *pb++ = 0; // PutCopy 0
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 1: gX {break = -2};
+
+ *pb++ = kopPutCopy; *pb++ = 0; // PutCopy 0
+ *pb++ = kopPushByte; *pb++ = -2; // PushByte -2
+ *pb++ = kopAttrSet; *pb++ = kslatBreak; // AttrSet breakweight
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ m_prgibActionStart = new data16[m_crul];
+ m_prgibActionStart[0] = 0;
+ m_prgibActionStart[1] = 7;
+}
+
+void GrSubPass::SetUpAssocTest()
+{
+ if (m_ipass == 2)
+ {
+ m_nMaxRuleContext = m_nMaxChunk = 3;
+ m_nMaxRuleLoop = 5;
+ m_staBehavior = "Assoc";
+
+ m_pfsm = new GrFSM();
+ Assert(m_pfsm);
+ m_pfsm->SetUpAssocTest(m_ipass);
+
+ m_crul = 3;
+
+ // Set up constraint code.
+ m_prgbConstraintBlock = new byte[1 + 10];
+ byte * pb = m_prgbConstraintBlock;
+ *pb++ = kopRetTrue; // RetTrue
+
+ *pb++ = kopCntxtItem; *pb++ = 1; // ContextItem 1
+ *pb++ = kopPushSlotAttr;*pb++ = kslatBreak; // PushSlotAttr break 0
+ *pb++ = 0;
+ *pb++ = kopPushByte; *pb++ = 2; // Push 2
+ *pb++ = kopEqual; // Equal
+ *pb++ = kopOr; // Or
+ *pb++ = kopPopRet; // PopAndRet
+
+ m_prgibConstraintStart = new data16[m_crul];
+ m_prgibConstraintStart[0] = 0;
+ m_prgibConstraintStart[1] = 1;
+ m_prgibConstraintStart[2] = 0;
+
+ // Set up rule action code.
+ m_prgbActionBlock = new byte[12 + 12 + 22];
+ pb = m_prgbActionBlock;
+
+ // Rule 0: clsOA clsE > clsELig:(1 2) _ ;
+
+ *pb++ = kopPutSubs8bitObs; *pb++ = 0; // PutSubs 0 clsOA clsELig
+ *pb++ = 5; *pb++ = 0;
+ *pb++ = kopAssoc; *pb++ = 2; // Assoc 2 0 1
+ *pb++ = 0; *pb++ = 1;
+ *pb++ = kopNext; // Next
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 1: clsLC _ _ gX > @1 @5 @1 @5 / _ _ # {break==2} _ _ ;
+
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopInsert; // Insert
+ *pb++ = kopPutCopy; *pb++ = 2; // PutCopy 2
+ *pb++ = kopNext; // Next
+ *pb++ = kopCopyNext; // CopyNext - line break
+ *pb++ = kopInsert; // Insert
+ *pb++ = kopPutCopy; *pb++ = -1; // PutCopy -1
+ *pb++ = kopNext; // Next
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 2: _ clsFraction _ > clsNumerator:2 gSlash:2 clsDenom:2;
+
+ *pb++ = kopInsert; // Insert
+ *pb++ = kopPutSubs8bitObs; *pb++ = 1; // PutSubs 1 clsFraction clsNumerator
+ *pb++ = 9; *pb++ = 1;
+ *pb++ = kopAssoc; *pb++ = 1; // Assoc 1 1
+ *pb++ = 1;
+ *pb++ = kopNext; // Next
+ *pb++ = kopPutGlyph8bitObs; *pb++ = 3; // PutGlyph gSlash
+ *pb++ = kopNext; // Next
+ *pb++ = kopInsert; // Insert
+ *pb++ = kopPutSubs8bitObs; *pb++ = 0; // PutSubs 0 clsFraction clsDenom
+ *pb++ = 9; *pb++ = 2;
+ *pb++ = kopAssoc; *pb++ = 1; // Assoc 1 0
+ *pb++ = 0;
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ m_prgibActionStart = new data16[m_crul];
+ m_prgibActionStart[0] = 0;
+ m_prgibActionStart[1] = 12;
+ m_prgibActionStart[2] = 12 + 12;
+ }
+ else if (m_ipass == 3)
+ {
+ m_nMaxRuleContext = m_nMaxChunk = 1;
+ m_nMaxRuleLoop = 3;
+ m_staBehavior = "Assoc";
+
+ m_pfsm = new GrFSM();
+ Assert(m_pfsm);
+ m_pfsm->SetUpAssocTest(m_ipass);
+
+ m_crul = 1;
+
+ // Set up constraint code.
+ m_prgbConstraintBlock = new byte[1 + 10];
+ byte * pb = m_prgbConstraintBlock;
+ *pb++ = kopRetTrue; // RetTrue
+
+ *pb++ = kopCntxtItem; *pb++ = 0; // ContextItem 0
+ *pb++ = kopPushSlotAttr;*pb++ = kslatBreak; // PushSlotAttr break 0
+ *pb++ = 0;
+ *pb++ = kopPushByte; *pb++ = 2; // Push 2
+ *pb++ = kopEqual; // Equal
+ *pb++ = kopOr; // Or
+ *pb++ = kopPopRet; // PopAndRet
+
+ m_prgibConstraintStart = new data16[m_crul];
+ m_prgibConstraintStart[0] = 1;
+
+ m_prgbActionBlock = new byte[7];
+ pb = m_prgbActionBlock;
+
+ // Rule 0: _ > gHyphen / _ # {break == 2} ^;
+
+ *pb++ = kopInsert; // Insert
+ *pb++ = kopPutGlyph8bitObs; *pb++ = 4; // PutGlyph 4 ('-' = 45)
+ *pb++ = kopNext; // Next
+ *pb++ = kopPushByte; *pb++ = 1; // Push 1
+ *pb++ = kopPopRet; // PopAndRet
+
+ m_prgibActionStart = new data16[m_crul];
+ m_prgibActionStart[0] = 0;
+ }
+ else
+ Assert(false);
+}
+
+
+void GrFSM::SetUpAssocTest(int ipass)
+{
+ if (ipass == 1)
+ {
+ // Create machine class ranges.
+ m_cmcr = 2;
+ m_prgmcr = new GrFSMClassRange[m_cmcr];
+ m_prgmcr[0].m_chwFirst = 35; // #
+ m_prgmcr[0].m_chwLast = 35;
+ m_prgmcr[0].m_col = 1;
+
+ m_prgmcr[1].m_chwFirst = 120; // x
+ m_prgmcr[1].m_chwLast = 120;
+ m_prgmcr[1].m_col = 0;
+
+ m_dimcrInit = 2; // (max power of 2 <= m_cmcr);
+ m_cLoop = 1; // log2(max power of 2 <= m_cmcr);
+ m_imcrStart = m_cmcr - m_dimcrInit;
+
+
+ m_crow = 4;
+ m_crowNonAcpt = 2;
+ m_crowFinal = 2;
+ m_rowFinalMin = m_crow - m_crowFinal;
+ m_ccol = 2;
+
+ // Set up transition table.
+ m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 4
+ short * psn = m_prgrowTransitions;
+ *psn++ = 2; *psn++ = 1;
+ *psn++ = 3; *psn++ = 0;
+
+ // Set up matched-rules tables.
+ m_prgrulnMatched = new data16[2]; // 2 = sum of rules matched for each accepting state
+ m_prgirulnMin = new data16[m_crow - m_crowNonAcpt + 1];
+
+ m_prgirulnMin[0] = 0; // s2: r1
+ m_prgrulnMatched[0] = 1;
+
+ m_prgirulnMin[1] = 1; // s3: r0
+ m_prgrulnMatched[1] = 0;
+
+ m_prgirulnMin[2] = 2;
+ }
+ else if (ipass == 2)
+ {
+ // Create machine class ranges.
+ m_cmcr = 13;
+ m_prgmcr = new GrFSMClassRange[m_cmcr];
+ m_prgmcr[0].m_chwFirst = 35; // #
+ m_prgmcr[0].m_chwLast = 35;
+ m_prgmcr[0].m_col = 7;
+
+ m_prgmcr[1].m_chwFirst = 65; // A
+ m_prgmcr[1].m_chwLast = 65;
+ m_prgmcr[1].m_col = 0;
+
+ m_prgmcr[2].m_chwFirst = 69; // E
+ m_prgmcr[2].m_chwLast = 69;
+ m_prgmcr[2].m_col = 2;
+
+ m_prgmcr[3].m_chwFirst = 79; // O
+ m_prgmcr[3].m_chwLast = 79;
+ m_prgmcr[3].m_col = 0;
+
+ m_prgmcr[4].m_chwFirst = 97; // a
+ m_prgmcr[4].m_chwLast = 97;
+ m_prgmcr[4].m_col = 1;
+
+ m_prgmcr[5].m_chwFirst = 98; // b - d
+ m_prgmcr[5].m_chwLast = 100;
+ m_prgmcr[5].m_col = 4;
+
+ m_prgmcr[6].m_chwFirst = 101; // e
+ m_prgmcr[6].m_chwLast = 101;
+ m_prgmcr[6].m_col = 3;
+
+ m_prgmcr[7].m_chwFirst = 102; // f - n
+ m_prgmcr[7].m_chwLast = 110;
+ m_prgmcr[7].m_col = 4;
+
+ m_prgmcr[8].m_chwFirst = 111; // o
+ m_prgmcr[8].m_chwLast = 111;
+ m_prgmcr[8].m_col = 1;
+
+ m_prgmcr[9].m_chwFirst = 112; // p - w
+ m_prgmcr[9].m_chwLast = 119;
+ m_prgmcr[9].m_col = 4;
+
+ m_prgmcr[10].m_chwFirst = 120; // x
+ m_prgmcr[10].m_chwLast = 120;
+ m_prgmcr[10].m_col = 5;
+
+ m_prgmcr[11].m_chwFirst = 121; // y - z
+ m_prgmcr[11].m_chwLast = 122;
+ m_prgmcr[11].m_col = 4;
+
+ m_prgmcr[12].m_chwFirst = 188; // 1/4, 1/2, 3/4
+ m_prgmcr[12].m_chwLast = 190;
+ m_prgmcr[12].m_col = 6;
+
+
+ m_dimcrInit = 8; // (max power of 2 <= m_cmcr);
+ m_cLoop = 3; // log2(max power of 2 <= m_cmcr);
+ m_imcrStart = m_cmcr - m_dimcrInit;
+
+
+ m_crow = 9;
+ m_crowNonAcpt = 6;
+ m_crowFinal = 3;
+ m_rowFinalMin = m_crow - m_crowFinal;
+ m_ccol = 8;
+
+ // Set up transition table.
+ m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 48
+ short * psn = m_prgrowTransitions;
+ *psn++ = 1; *psn++ = 2; *psn++ = 0; *psn++ = 4; *psn++ = 3; *psn++ = 3; *psn++ = 6; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ = 7; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 7; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 5;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 5;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 5;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 8; *psn++ = 0; *psn++ = 0;
+
+ // Set up matched-rules tables.
+ m_prgrulnMatched = new data16[3]; // 3 = sum of rules matched for each accepting state
+ m_prgirulnMin = new data16[3+1]; // 3 = m_crow - m_crowNonAcpt
+
+ m_prgirulnMin[0] = 0; // s6: r2
+ m_prgrulnMatched[0] = 2;
+
+ m_prgirulnMin[1] = 1; // s7: r0
+ m_prgrulnMatched[1] = 0;
+
+ m_prgirulnMin[2] = 2; // s8: r1
+ m_prgrulnMatched[2] = 1;
+
+ m_prgirulnMin[3] = 3;
+ }
+ else if (ipass == 3)
+ {
+ // Create machine class ranges.
+ m_cmcr = 1;
+ m_prgmcr = new GrFSMClassRange[m_cmcr];
+ m_prgmcr[0].m_chwFirst = 35; // #
+ m_prgmcr[0].m_chwLast = 35;
+ m_prgmcr[0].m_col = 0;
+
+ m_dimcrInit = 1; // (max power of 2 <= m_cmcr);
+ m_cLoop = 0; // log2(max power of 2 <= m_cmcr);
+ m_imcrStart = m_cmcr - m_dimcrInit;
+
+
+ m_crow = 2;
+ m_crowNonAcpt = 1;
+ m_crowFinal = 1;
+ m_rowFinalMin = m_crow - m_crowFinal;
+ m_ccol = 1;
+
+ // Set up transition table.
+ m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 1
+ short * psn = m_prgrowTransitions;
+ *psn++ = 1;
+
+ // Set up matched-rules tables.
+ m_prgrulnMatched = new data16[1]; // 1 = sum of rules matched for each accepting state
+ m_prgirulnMin = new data16[m_crow - m_crowNonAcpt + 1];
+
+ m_prgirulnMin[0] = 0; // s1: r0
+ m_prgrulnMatched[0] = 0;
+
+ m_prgirulnMin[1] = 1;
+ }
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Second batch of association tests.
+
+ PASS 1:
+ r0. clsSymbol _ > _ @1 / _ gNumber gHyphen # gNumber _;
+ r1. clsSymbol _ > _ @1 / _ gHyphen # _;
+ r2. _ clsSymbol > @6 _ / _ gNumber gHyphen # gNumber _;
+ r3. _ clsSymbol > @4 _ / _ gHyphen # _;
+ r4. clsLeft _ > @1 clsRight$1:1 / _ clsLetter gHyphen # _ gSpace;
+ r5. clsLeft _ > @1 clsRight$1:1 / _ clsLetter gHyphen # clsLetter _ gSpace;
+ r6. clsLeft _ > @1 clsRight$1:1 / _ clsLetter _ gSpace;
+ r7. clsLeft _ > @1 clsRight$1:1 / _ clsLetter clsLetter _ gSpace;
+
+ Pass 1 machine classes:
+ mcSym: @, $, %, & 64, 36, 37, 38
+ mcNum: 48-57
+ mcHyphen: 45
+ mcSpace: 32
+ mcLet: 97-122
+ mcLeft: ( [ { 40, 91, 123
+ mcRight: ) ] } 41, 93, 125
+
+ Pass 1 FSM: (T=transition, F=final, A=accepting, NA=non-accepting)
+
+ | mcSym mcNum mcHyph mcSpace mcLet mcLeft mcLB
+ ----------------------------------------------------------------------------------
+ T NA s0 | s1 s2 s3 s4
+ |
+ T NA s1 | s5 s6
+ |
+ T NA s2 | s7
+ |
+ T NA s3 | s8
+ |
+ T NA s4 | s9
+ |
+ T NA s5 | s10
+ |
+ T NA s6 | s18
+ |
+ T NA s7 | s11
+ |
+ T NA s8 | s19
+ |
+ T NA s9 | s12 s20 s13
+ |
+ T NA s10 | s14
+ |
+ T NA s11 | s15
+ |
+ T NA s12 | s16
+ |
+ T NA s13 | s21
+ |
+ T NA s14 | s22
+ |
+ T NA s15 | s23
+ |
+ T NA s16 | s24 s17
+ |
+ T NA s17 | s25
+ |
+ F A s18 |
+ |
+ F A s19 |
+ |
+ F A s20 |
+ |
+ F A s21 |
+ |
+ F A s22 |
+ |
+ F A s23 |
+ |
+ F A s24 |
+ |
+ F A s25 |
+
+
+ Rules Matched:
+ s18: r1
+ s19: r3
+ s20: r6
+ s21: r7
+ s22: r0
+ s23: r2
+ s24: r4
+ s25: r5
+----------------------------------------------------------------------------------------------*/
+void GrEngine::SetUpAssoc2Test()
+{
+ if (m_pctbl)
+ delete m_pctbl;
+
+ m_pctbl = new GrClassTable();
+ m_pctbl->SetUpAssoc2Test();
+
+ m_fLineBreak = true;
+ m_cchwPreXlbContext = 3;
+ m_cchwPostXlbContext = 2;
+}
+
+void GrClassTable::SetUpAssoc2Test()
+{
+ m_ccls = 2; // number of classes
+ m_cclsLinear = 1; // number of classes in linear format (output classes)
+
+ m_prgchwBIGGlyphList = new data16[13];
+
+ m_prgichwOffsets = new data16[m_ccls+1];
+
+ data16 * pchw = m_prgchwBIGGlyphList;
+
+ // Output class 0: clsRight
+ m_prgichwOffsets[0] = 0;
+ *pchw++ = msbf(data16(41)); // )
+ *pchw++ = msbf(data16(93)); // ]
+ *pchw++ = msbf(data16(125)); // }
+
+ // Input class 1: clsLeft
+ m_prgichwOffsets[1] = 3;
+ *pchw++ = msbf(data16(3));
+ *pchw++ = msbf(data16(2)); *pchw++ = msbf(data16(1)); *pchw++ = msbf(data16(3-2));
+ *pchw++ = msbf(data16(40)); *pchw++ = msbf(data16(0)); // (
+ *pchw++ = msbf(data16(91)); *pchw++ = msbf(data16(1)); // [
+ *pchw++ = msbf(data16(123)); *pchw++ = msbf(data16(2)); // {
+
+ m_prgichwOffsets[2] = 3 + 4 + 3*2; // 13
+}
+
+void GrSubPass::SetUpAssoc2Test()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 6;
+ m_nMaxRuleLoop = 5;
+ m_staBehavior = "Assoc2";
+
+ m_pfsm = new GrFSM();
+ Assert(m_pfsm);
+ m_pfsm->SetUpAssoc2Test(m_ipass);
+
+ m_crul = 8;
+
+ // Set up constraint code.
+ m_prgbConstraintBlock = new byte[1];
+ byte * pb = m_prgbConstraintBlock;
+ *pb++ = kopRetTrue; // RetTrue
+
+ m_prgibConstraintStart = new data16[m_crul];
+ m_prgibConstraintStart[0] = 0;
+ m_prgibConstraintStart[1] = 0;
+ m_prgibConstraintStart[2] = 0;
+ m_prgibConstraintStart[3] = 0;
+ m_prgibConstraintStart[4] = 0;
+ m_prgibConstraintStart[5] = 0;
+ m_prgibConstraintStart[6] = 0;
+ m_prgibConstraintStart[7] = 0;
+
+ // Set up rule action code.
+ m_prgbActionBlock = new byte[11 + 9 + 11 + 9 + 14 + 15 + 12 + 13];
+ pb = m_prgbActionBlock;
+
+ // Rule 0: clsSymbol _ > _ @1 / _ gNumber gHyphen # gNumber _;
+
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopInsert; // Insert
+ *pb++ = kopPutCopy; *pb++ = -4; // PutCopy -4
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 1: clsSymbol _ > _ @1 / _ gHyphen # _;
+
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopInsert; // Insert
+ *pb++ = kopPutCopy; *pb++ = -2; // PutCopy -2
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 2: _ clsSymbol > @6 _ / _ gNumber gHyphen # gNumber _;
+
+ *pb++ = kopInsert; // Insert
+ *pb++ = kopPutCopy; *pb++ = 5; // PutCopy 5
+ *pb++ = kopNext; // Next
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 3: _ clsSymbol > @4 _ / _ gHyphen # _;
+
+ *pb++ = kopInsert; // Insert
+ *pb++ = kopPutCopy; *pb++ = 3; // PutCopy 3
+ *pb++ = kopNext; // Next
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 4: clsLeft _ > @1 clsRight$1 / _ clsLetter gHyphen # _ gSpace;
+
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopInsert; // Insert
+ *pb++ = kopPutSubs8bitObs; *pb++ = -3; // PutSubs -3 1 0
+ *pb++ = 1; *pb++ = 0;
+ *pb++ = kopAssoc; *pb++ = 1; // Assoc 1 -3
+ *pb++ = -3;
+ *pb++ = kopNext; // Next;
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 5: clsLeft _ > @1 clsRight$1 / _ clsLetter gHyphen # clsLetter _ gSpace;
+
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopInsert; // Insert
+ *pb++ = kopPutSubs8bitObs; *pb++ = -4; // PutSubs -4 1 0
+ *pb++ = 1; *pb++ = 0;
+ *pb++ = kopAssoc; *pb++ = 1; // Assoc 1 -4
+ *pb++ = -4;
+ *pb++ = kopNext; // Next;
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 6: clsLeft _ > @1 clsRight$1 / _ clsLetter _ gSpace;
+
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopInsert; // Insert
+ *pb++ = kopPutSubs8bitObs; *pb++ = -1; // PutSubs -1 1 0
+ *pb++ = 1; *pb++ = 0;
+ *pb++ = kopAssoc; *pb++ = 1; // Assoc 1 -1
+ *pb++ = -1;
+ *pb++ = kopNext; // Next;
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 7: clsLeft _ > @1 clsRight$1 / _ clsLetter clsLetter _ gSpace;
+
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopInsert; // Insert
+ *pb++ = kopPutSubs8bitObs; *pb++ = -2; // PutSubs -2 1 0
+ *pb++ = 1; *pb++ = 0;
+ *pb++ = kopAssoc; *pb++ = 1; // Assoc 1 -2
+ *pb++ = -2;
+ *pb++ = kopNext; // Next;
+ *pb++ = kopRetZero; // RetZero
+
+
+ m_prgibActionStart = new data16[m_crul];
+ m_prgibActionStart[0] = 0;
+ m_prgibActionStart[1] = 11;
+ m_prgibActionStart[2] = 11 + 9;
+ m_prgibActionStart[3] = 20 + 11;
+ m_prgibActionStart[4] = 31 + 9;
+ m_prgibActionStart[5] = 40 + 14;
+ m_prgibActionStart[6] = 54 + 15;
+ m_prgibActionStart[7] = 69 + 12;
+}
+
+
+void GrFSM::SetUpAssoc2Test(int ipass)
+{
+ // Create machine class ranges.
+ m_cmcr = 10;
+ m_prgmcr = new GrFSMClassRange[m_cmcr];
+ m_prgmcr[0].m_chwFirst = 32; // space
+ m_prgmcr[0].m_chwLast = 32;
+ m_prgmcr[0].m_col = 3;
+
+ m_prgmcr[1].m_chwFirst = 35; // #
+ m_prgmcr[1].m_chwLast = 35;
+ m_prgmcr[1].m_col = 6;
+
+ m_prgmcr[2].m_chwFirst = 36; // $, %, &
+ m_prgmcr[2].m_chwLast = 38;
+ m_prgmcr[2].m_col = 0;
+
+ m_prgmcr[3].m_chwFirst = 40; // (
+ m_prgmcr[3].m_chwLast = 40;
+ m_prgmcr[3].m_col = 5;
+
+ m_prgmcr[4].m_chwFirst = 45; // -
+ m_prgmcr[4].m_chwLast = 45;
+ m_prgmcr[4].m_col = 2;
+
+ m_prgmcr[5].m_chwFirst = 48; // 0 - 9
+ m_prgmcr[5].m_chwLast = 57;
+ m_prgmcr[5].m_col = 1;
+
+ m_prgmcr[6].m_chwFirst = 64; // @
+ m_prgmcr[6].m_chwLast = 64;
+ m_prgmcr[6].m_col = 0;
+
+ m_prgmcr[7].m_chwFirst = 91; // [
+ m_prgmcr[7].m_chwLast = 91;
+ m_prgmcr[7].m_col = 5;
+
+ m_prgmcr[8].m_chwFirst = 97; // a - z
+ m_prgmcr[8].m_chwLast = 122;
+ m_prgmcr[8].m_col = 4;
+
+ m_prgmcr[9].m_chwFirst = 123; // {
+ m_prgmcr[9].m_chwLast = 123;
+ m_prgmcr[9].m_col = 5;
+
+
+ m_dimcrInit = 8; // (max power of 2 <= m_cmcr);
+ m_cLoop = 3; // log2(max power of 2 <= m_cmcr);
+ m_imcrStart = m_cmcr - m_dimcrInit;
+
+
+ m_crow = 26;
+ m_crowNonAcpt = 18;
+ m_crowFinal = 8;
+ m_rowFinalMin = m_crow - m_crowFinal;
+ m_ccol = 7;
+
+ // Set up transition table.
+ m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 126
+ short * psn = m_prgrowTransitions;
+ *psn++ = 1; *psn++ = 2; *psn++ = 3; *psn++ = 0; *psn++ = 0; *psn++ = 4; *psn++ = 0;
+ *psn++ = 0; *psn++ = 5; *psn++ = 6; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ = 7; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 8;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 9; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ =10; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ =18;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ =11;
+ *psn++ =19; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ =12; *psn++ =20; *psn++ =13; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ =14;
+ *psn++ = 0; *psn++ =15; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ =16;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ =21; *psn++ = 0; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ =22; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0;
+ *psn++ =23; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ =24; *psn++ =17; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ =25; *psn++ = 0; *psn++ = 0; *psn++ = 0;
+
+ // Set up matched-rules tables.
+ m_prgrulnMatched = new data16[8]; // 3 = sum of rules matched for each accepting state
+ m_prgirulnMin = new data16[m_crow - m_crowNonAcpt + 1];
+
+ m_prgirulnMin[0] = 0; // s18: r1
+ m_prgrulnMatched[0] = 1;
+
+ m_prgirulnMin[1] = 1; // s19: r3
+ m_prgrulnMatched[1] = 3;
+
+ m_prgirulnMin[2] = 2; // s20: r6
+ m_prgrulnMatched[2] = 6;
+
+ m_prgirulnMin[3] = 3; // s21: r7
+ m_prgrulnMatched[3] = 7;
+
+ m_prgirulnMin[4] = 4; // s22: r0
+ m_prgrulnMatched[4] = 0;
+
+ m_prgirulnMin[5] = 5; // s23: r2
+ m_prgrulnMatched[5] = 2;
+
+ m_prgirulnMin[6] = 6; // s24: r4
+ m_prgrulnMatched[6] = 4;
+
+ m_prgirulnMin[7] = 7; // s25: r5
+ m_prgrulnMatched[7] = 5;
+
+ m_prgirulnMin[8] = 8;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Test of default associations
+
+ PASS 1:
+ r0. gDollar _ > @1 gEquals;
+ r1. gAtSign > _ ;
+
+ Pass 1 machine classes:
+ mcDollar: $ 36
+ mcAt: @ 64
+
+ Pass 1 FSM: (T=transition, F=final, A=accepting, NA=non-accepting)
+
+ | mcDollar mcAt
+ --------------------------------------
+ T NA s0 | s1 s2
+ |
+ F A s1 |
+ |
+ F A s2 |
+
+
+ Rules Matched:
+ s1: r0
+ s2: r1
+----------------------------------------------------------------------------------------------*/
+void GrEngine::SetUpDefaultAssocTest()
+{
+ if (m_pctbl)
+ delete m_pctbl;
+
+ m_pctbl = new GrClassTable();
+ m_pctbl->SetUpDefaultAssocTest();
+}
+
+void GrClassTable::SetUpDefaultAssocTest()
+{
+ m_ccls = 1; // number of classes
+ m_cclsLinear = 1; // number of classes in linear format
+
+ m_prgchwBIGGlyphList = new data16[1];
+
+ m_prgichwOffsets = new data16[m_ccls+1];
+
+ data16 * pchw = m_prgchwBIGGlyphList;
+
+ // Output class 0: gEquals
+ m_prgichwOffsets[0] = 0;
+ *pchw++ = msbf(data16(61));
+
+ m_prgichwOffsets[1] = 1;
+}
+
+void GrSubPass::SetUpDefaultAssocTest()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 1;
+ m_nMaxRuleLoop = 5;
+ m_staBehavior = "DefaultAssoc";
+
+ m_pfsm = new GrFSM();
+ Assert(m_pfsm);
+ m_pfsm->SetUpDefaultAssocTest();
+
+ m_crul = 2;
+
+ // Set up constraint code.
+ m_prgbConstraintBlock = new byte[1];
+ byte * pb = m_prgbConstraintBlock;
+ *pb++ = kopRetTrue;
+
+ m_prgibConstraintStart = new data16[m_crul];
+ m_prgibConstraintStart[0] = 0;
+ m_prgibConstraintStart[1] = 0;
+
+ // Set up rule action code.
+ m_prgbActionBlock = new byte[6 + 3];
+ pb = m_prgbActionBlock;
+
+ // Rule 0: gDollar _ > @1 gEquals;
+
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopInsert; // Insert
+ *pb++ = kopPutGlyph8bitObs; *pb++ = 0; // PutGlyph 0
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 1: gAtSign > _ ;
+
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ m_prgibActionStart = new data16[m_crul];
+ m_prgibActionStart[0] = 0;
+ m_prgibActionStart[1] = 6;
+}
+
+
+void GrFSM::SetUpDefaultAssocTest()
+{
+ // Create machine class ranges.
+ m_cmcr = 2;
+ m_prgmcr = new GrFSMClassRange[m_cmcr];
+ m_prgmcr[0].m_chwFirst = 36; // $
+ m_prgmcr[0].m_chwLast = 36;
+ m_prgmcr[0].m_col = 0;
+
+ m_prgmcr[1].m_chwFirst = 64; // @
+ m_prgmcr[1].m_chwLast = 64;
+ m_prgmcr[1].m_col = 1;
+
+
+ m_dimcrInit = 2; // (max power of 2 <= m_cmcr);
+ m_cLoop = 1; // log2(max power of 2 <= m_cmcr);
+ m_imcrStart = m_cmcr - m_dimcrInit;
+
+
+ m_crow = 3;
+ m_crowNonAcpt = 1;
+ m_crowFinal = 2;
+ m_rowFinalMin = m_crow - m_crowFinal;
+ m_ccol = 2;
+
+ // Set up transition table.
+ m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 2
+ short * psn = m_prgrowTransitions;
+ *psn++ = 1; *psn++ = 2;
+
+ // Set up matched-rules tables.
+ m_prgrulnMatched = new data16[2]; // 2 = sum of rules matched for each accepting state
+ m_prgirulnMin = new data16[m_crow - m_crowNonAcpt + 1];
+
+ m_prgirulnMin[0] = 0; // s1: r0
+ m_prgrulnMatched[0] = 0;
+
+ m_prgirulnMin[1] = 1; // s2: r1
+ m_prgrulnMatched[1] = 1;
+
+ m_prgirulnMin[2] = 2;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Test of features. The ID of "theFeature" == 234, its index is 0. The default value is 1.
+
+ PASS 1:
+ if (theFeature == 0) // * -> $
+ r0. gAsterisk > gDollar ;
+ else if (theFeature == 1) // * -> %
+ r1. gAsterisk > gPercent ;
+ else // * -> @
+ r2. gAsterisk > gAt ;
+
+ Pass 1 machine classes:
+ mcAsterisk: * 42
+
+ Pass 1 FSM: (T=transition, F=final, A=accepting, NA=non-accepting)
+
+ | mcAsterisk
+ --------------------------------
+ T NA s0 | s1
+ |
+ F A s1 |
+
+
+ Rules Matched:
+ s1: r0, r1, r2
+----------------------------------------------------------------------------------------------*/
+void GrEngine::SetUpFeatureTest()
+{
+ AddFeature(234, 0, 1, 1);
+
+ if (m_pctbl)
+ delete m_pctbl;
+
+ m_pctbl = new GrClassTable();
+ m_pctbl->SetUpFeatureTest();
+}
+
+void GrClassTable::SetUpFeatureTest()
+{
+ m_ccls = 4; // number of classes
+ m_cclsLinear = 4; // number of classes in linear format
+
+ m_prgchwBIGGlyphList = new data16[4];
+
+ m_prgichwOffsets = new data16[m_ccls + 1];
+
+ data16 * pchw = m_prgchwBIGGlyphList;
+
+ m_prgichwOffsets[0] = 0;
+ *pchw++ = msbf(data16(36)); // $
+
+ m_prgichwOffsets[1] = 1;
+ *pchw++ = msbf(data16(37)); // %
+
+ m_prgichwOffsets[2] = 2;
+ *pchw++ = msbf(data16(64)); // @
+
+ m_prgichwOffsets[3] = 3;
+ *pchw++ = msbf(data16(42)); // *
+
+ m_prgichwOffsets[4] = 4;
+}
+
+void GrSubPass::SetUpFeatureTest()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 1;
+ m_nMaxRuleLoop = 5;
+ m_staBehavior = "Feature";
+
+ m_pfsm = new GrFSM();
+ Assert(m_pfsm);
+ m_pfsm->SetUpFeatureTest();
+
+ m_crul = 3;
+
+ // Set up constraint code.
+ m_prgbConstraintBlock = new byte[1 + 6 + 12 + 12];
+ byte * pb = m_prgbConstraintBlock;
+ *pb++ = kopRetTrue;
+
+ // (theFeature == 0)
+ *pb++ = kopPushFeat; *pb++ = 0; // PushFeat 0
+ *pb++ = kopPushByte; *pb++ = 0; // PushByte 0
+ *pb++ = kopEqual; // Equal
+ *pb++ = kopPopRet; // PopAndRet
+
+ // (theFeature != 0 && theFeature == 1)
+ *pb++ = kopPushFeat; *pb++ = 0; // PushFeat 0
+ *pb++ = kopPushByte; *pb++ = 0; // PushByte 0
+ *pb++ = kopNotEq; // NotEq
+ *pb++ = kopPushFeat; *pb++ = 0; // PushFeat 0
+ *pb++ = kopPushByte; *pb++ = 1; // PushByte 1
+ *pb++ = kopEqual; // Equal
+ *pb++ = kopAnd; // And
+ *pb++ = kopPopRet; // PopAndRet
+
+ // (theFeature != 0 && theFeature != 1)
+ *pb++ = kopPushFeat; *pb++ = 0; // PushFeat 0
+ *pb++ = kopPushByte; *pb++ = 0; // PushByte 0
+ *pb++ = kopNotEq; // NotEq
+ *pb++ = kopPushFeat; *pb++ = 0; // PushFeat 0
+ *pb++ = kopPushByte; *pb++ = 1; // PushByte 1
+ *pb++ = kopNotEq; // NotEq
+ *pb++ = kopAnd; // And
+ *pb++ = kopPopRet; // PopAndRet
+
+ m_prgibConstraintStart = new data16[m_crul];
+ m_prgibConstraintStart[0] = 1;
+ m_prgibConstraintStart[1] = 1 + 6;
+ m_prgibConstraintStart[2] = 1 + 6 + 12;
+
+ // Set up rule action code.
+ m_prgbActionBlock = new byte[4 + 4 + 4];
+ pb = m_prgbActionBlock;
+
+ // Rule 0: gAsterisk > gDollar ;
+
+ *pb++ = kopPutGlyph8bitObs; *pb++ = 0; // PutGlyph 0
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 1: gAsterisk > gPercent ;
+
+ *pb++ = kopPutGlyph8bitObs; *pb++ = 1; // PutGlyph 1
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 2: gAsterisk > gAt ;
+
+ *pb++ = kopPutGlyph8bitObs; *pb++ = 2; // PutGlyph 2
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ m_prgibActionStart = new data16[m_crul];
+ m_prgibActionStart[0] = 0;
+ m_prgibActionStart[1] = 4;
+ m_prgibActionStart[2] = 4 + 4;
+}
+
+
+void GrFSM::SetUpFeatureTest()
+{
+ // Create machine class ranges.
+ m_cmcr = 1;
+ m_prgmcr = new GrFSMClassRange[m_cmcr];
+ m_prgmcr[0].m_chwFirst = 42; // *
+ m_prgmcr[0].m_chwLast = 42;
+ m_prgmcr[0].m_col = 0;
+
+
+ m_dimcrInit = 1; // (max power of 2 <= m_cmcr);
+ m_cLoop = 0; // log2(max power of 2 <= m_cmcr);
+ m_imcrStart = m_cmcr - m_dimcrInit;
+
+
+ m_crow = 2;
+ m_crowNonAcpt = 1;
+ m_crowFinal = 1;
+ m_rowFinalMin = m_crow - m_crowFinal;
+ m_ccol = 1;
+
+ // Set up transition table.
+ m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 1
+ short * psn = m_prgrowTransitions;
+ *psn++ = 1;
+
+ // Set up matched-rules tables.
+ m_prgrulnMatched = new data16[3]; // 3 = sum of rules matched for each accepting state
+ m_prgirulnMin = new data16[m_crow - m_crowNonAcpt + 1];
+
+ m_prgirulnMin[0] = 0; // s1: r0, r1, r2
+ m_prgrulnMatched[0] = 0;
+ m_prgrulnMatched[1] = 1;
+ m_prgrulnMatched[2] = 2;
+
+ m_prgirulnMin[1] = 3;
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Tests of ligatures and components.
+
+ PASS 1 (line-break):
+ r0. clsLetter { break = 2 }
+
+ Pass 1 machine classes:
+ mcLetter: a - z 97 - 122
+
+ Pass 1 FSM: (T=transition, F=final, A=accepting, NA=non-accepting)
+
+ | clsLetter
+ --------------------------------
+ T NA s0 | s1
+ |
+ F A s1 |
+
+
+ Rules Matched:
+ s1: r0
+
+
+ PASS 2 (substitution):
+ r0. gX gY gZ > gCapX:(1 2 4) { comp {X.ref=@1; Y.ref=@2; Z.ref=@4 }} _ _
+ / _ _ # {break==2} _;
+ r1. gX gY gZ > _ _ gCapZ:(1 3 4) { comp {X.ref=@1; Y.ref=@3; Z.ref=@4 }}
+ / _ # {break==2} _ _;
+ r2. gX gY gZ > _ gCapY:(1 2 3) { comp {X.ref=@1; Y.ref=@2; Z.ref=@3 }} gPlus;
+
+ Pass 2 machine classes:
+ mcX: x 120
+ mcY: y 121
+ mcZ: z 122
+ mcLB: 35
+
+
+ Pass 2 FSM:
+ | mcX mcY mcZ mcLB
+ ----------------------------------------------------
+ T NA s0 | s1
+ | - - -
+ T NA s1 | s2 s3
+ | - - -
+ T NA s2 | s6 s4
+ | - - -
+ T NA s3 | s5
+ | - - -
+ T NA s4 | s7
+ | - - -
+ T NA s5 | s8
+ | - - -
+ F A s6 |
+ | - - -
+ F A s7 |
+ | - - -
+ F A s8 |
+ | - - -
+
+ Rules matched:
+ s6: r2
+ s7: r0
+ s8: r1
+----------------------------------------------------------------------------------------------*/
+void GrEngine::SetUpLigatureTest()
+{
+ if (m_pctbl)
+ delete m_pctbl;
+
+ m_pctbl = new GrClassTable();
+ m_pctbl->SetUpLigatureTest();
+
+ m_pgtbl = new GrGlyphTable();
+ m_pgtbl->SetUpLigatureTest();
+
+ m_fLineBreak = true;
+ m_cchwPreXlbContext = 2;
+ m_cchwPostXlbContext = 2;
+}
+
+void GrClassTable::SetUpLigatureTest()
+{
+ m_ccls = 7; // number of classes
+ m_cclsLinear = 7; // number of classes in linear format (all classes are single-item)
+
+ m_prgchwBIGGlyphList = new data16[7];
+
+ m_prgichwOffsets = new data16[m_ccls+1];
+
+ data16 * pchw = m_prgchwBIGGlyphList;
+
+ // Class 0: gCapX
+ m_prgichwOffsets[0] = 0;
+ *pchw++ = msbf(data16(88)); // X
+
+ // Class 1: gCapY
+ m_prgichwOffsets[1] = 1;
+ *pchw++ = msbf(data16(89)); // Y
+
+ // Class 2: gCapZ
+ m_prgichwOffsets[2] = 2;
+ *pchw++ = msbf(data16(90)); // Z
+
+ // Class 3: gPlus
+ m_prgichwOffsets[3] = 3;
+ *pchw++ = msbf(data16(43)); // +
+
+ // Class 4: gX
+ m_prgichwOffsets[4] = 4;
+ *pchw++ = msbf(data16(120)); // x
+
+ // Class 5: gY
+ m_prgichwOffsets[5] = 5;
+ *pchw++ = msbf(data16(121)); // y
+
+ // Class 6: gZ
+ m_prgichwOffsets[6] = 6;
+ *pchw++ = msbf(data16(122)); // z
+
+ m_prgichwOffsets[7] = 7;
+}
+
+void GrGlyphTable::SetUpLigatureTest()
+{
+ SetNumberOfGlyphs(128);
+ SetNumberOfStyles(1);
+
+ GrGlyphSubTable * pgstbl = new GrGlyphSubTable();
+ Assert(pgstbl);
+
+ pgstbl->Initialize(1, 0, 128, 10, 4);
+ SetSubTable(0, pgstbl);
+
+ SetNumberOfComponents(4); // comp.w, comp.x, comp.y, comp.z
+
+ pgstbl->SetUpLigatureTest();
+}
+
+/***********************************************************************************************
+ TODO: This method is BROKEN because m_prgibBIGAttrValues has been changed. It is no
+ longer a data16 *. The Gloc table can contain 16-bit or 32-bit entries and must be
+ accessed accordingly.
+***********************************************************************************************/
+void GrGlyphSubTable::SetUpLigatureTest()
+{
+ m_nAttrIDLim = 20;
+
+ m_pgatbl = new GrGlyphAttrTable();
+ m_pgatbl->Initialize(0, 102);
+
+ for (int i = 0; i < 88; i++)
+ m_prgibBIGAttrValues[i] = (byte)msbf(data16(0));
+
+ m_prgibBIGAttrValues[88] = (byte)msbf(data16(0));
+ m_prgibBIGAttrValues[89] = (byte)msbf(data16(34));
+ m_prgibBIGAttrValues[90] = (byte)msbf(data16(68));
+
+ for (i = 91; i < 128; i++)
+ m_prgibBIGAttrValues[i] = (byte)msbf(data16(102));
+
+ m_pgatbl->SetUpLigatureTest();
+}
+
+void GrGlyphAttrTable::SetUpLigatureTest()
+{
+ // Glyph 88 'X' (2 runs; offset = 0):
+ // 0 = 0 comp.w undefined
+ // 1 = 8 comp.x: (0,0, 25,100)
+ // 2 = 12 comp.y: (25,0, 75,100)
+ // 3 = 16 comp.z: (75,0, 100,100)
+ // 4-7 = 0 comp.w box corners
+ // 8 = 100 comp.x. top
+ // 9 = 0 bottom
+ // 10= 0 left
+ // 11= 25 right
+ // 12= 100 comp.y. top
+ // 13= 0 bottom
+ // 14= 25 left
+ // 15= 75 right
+ // 16= 100 comp.z. top
+ // 17= 0 bottom
+ // 18= 75 left
+ // 19= 100 right
+ //
+ // Glyph 89 (2 runs; offset = 34):
+ // 0 = 0 comp.w undefined
+ // 1 = 8 comp.x: (0,0, 33,100)
+ // 2 = 12 comp.y: (33,0, 67,100)
+ // 3 = 16 comp.z: (67,0, 100,100)
+ // 4-7 = 0 comp.w box corners
+ // 8 = 100 comp.x. top
+ // 9 = 0 bottom
+ // 10= 0 left
+ // 11= 33 right
+ // 12= 100 comp.y. top
+ // 13= 0 bottom
+ // 14= 33 left
+ // 15= 67 right
+ // 16= 100 comp.z. top
+ // 17= 0 bottom
+ // 18= 67 left
+ // 19= 100 right
+ //
+ // Glyph 90 (2 runs; offset = 68):
+ // 0 = 0 comp.w undefined
+ // 1 = 8 comp.x: (0,0, 10,100)
+ // 2 = 12 comp.y: (10,0, 90,100)
+ // 3 = 16 comp.z: (90,0, 100,100)
+ // 4-7 = 0 comp.w box corners
+ // 8 = 100 comp.x. top
+ // 9 = 0 bottom
+ // 10= 0 left
+ // 11= 10 right
+ // 12= 100 comp.y. top
+ // 13= 0 bottom
+ // 14= 10 left
+ // 15= 90 right
+ // 16= 100 comp.z. top
+ // 17= 0 bottom
+ // 18= 90 left
+ // 19= 100 right
+
+ byte * pbBIG = m_prgbBIGEntries;
+
+ GrGlyphAttrRun gatrun;
+
+ // Glyph 88 'X'
+ gatrun.m_bMinAttrID = 1;
+ gatrun.m_cAttrs = 3;
+ gatrun.m_rgchwBIGValues[0] = msbf(data16(8));
+ gatrun.m_rgchwBIGValues[1] = msbf(data16(12));
+ gatrun.m_rgchwBIGValues[2] = msbf(data16(16));
+ memcpy(pbBIG, &gatrun, 8); // 8 = 3*2 + 2
+ pbBIG += 8;
+ gatrun.m_bMinAttrID = 8; // comp.x.top
+ gatrun.m_cAttrs = 12;
+ gatrun.m_rgchwBIGValues[0] = msbf(data16(100));
+ gatrun.m_rgchwBIGValues[1] = msbf(data16(0));
+ gatrun.m_rgchwBIGValues[2] = msbf(data16(0));
+ gatrun.m_rgchwBIGValues[3] = msbf(data16(25));
+ gatrun.m_rgchwBIGValues[4] = msbf(data16(100));
+ gatrun.m_rgchwBIGValues[5] = msbf(data16(0));
+ gatrun.m_rgchwBIGValues[6] = msbf(data16(25));
+ gatrun.m_rgchwBIGValues[7] = msbf(data16(75));
+ gatrun.m_rgchwBIGValues[8] = msbf(data16(100));
+ gatrun.m_rgchwBIGValues[9] = msbf(data16(0));
+ gatrun.m_rgchwBIGValues[10] = msbf(data16(75));
+ gatrun.m_rgchwBIGValues[11] = msbf(data16(100));
+ memcpy(pbBIG, &gatrun, 26); // 26 = 12*2 + 2
+ pbBIG += 26;
+
+ // Glyph 89 'Y'
+ gatrun.m_bMinAttrID = 1;
+ gatrun.m_cAttrs = 3;
+ gatrun.m_rgchwBIGValues[0] = msbf(data16(8));
+ gatrun.m_rgchwBIGValues[1] = msbf(data16(12));
+ gatrun.m_rgchwBIGValues[2] = msbf(data16(16));
+ memcpy(pbBIG, &gatrun, 8); // 8 = 3*2 + 2
+ pbBIG += 8;
+ gatrun.m_bMinAttrID = 8; // comp.x.top
+ gatrun.m_cAttrs = 12;
+ gatrun.m_rgchwBIGValues[0] = msbf(data16(100));
+ gatrun.m_rgchwBIGValues[1] = msbf(data16(0));
+ gatrun.m_rgchwBIGValues[2] = msbf(data16(0));
+ gatrun.m_rgchwBIGValues[3] = msbf(data16(33));
+ gatrun.m_rgchwBIGValues[4] = msbf(data16(100));
+ gatrun.m_rgchwBIGValues[5] = msbf(data16(0));
+ gatrun.m_rgchwBIGValues[6] = msbf(data16(33));
+ gatrun.m_rgchwBIGValues[7] = msbf(data16(67));
+ gatrun.m_rgchwBIGValues[8] = msbf(data16(100));
+ gatrun.m_rgchwBIGValues[9] = msbf(data16(0));
+ gatrun.m_rgchwBIGValues[10] = msbf(data16(67));
+ gatrun.m_rgchwBIGValues[11] = msbf(data16(100));
+ memcpy(pbBIG, &gatrun, 26); // 26 = 12*2 + 2
+ pbBIG += 26;
+
+ // Glyph 90 'Z'
+ gatrun.m_bMinAttrID = 1;
+ gatrun.m_cAttrs = 3;
+ gatrun.m_rgchwBIGValues[0] = msbf(data16(8));
+ gatrun.m_rgchwBIGValues[1] = msbf(data16(12));
+ gatrun.m_rgchwBIGValues[2] = msbf(data16(16));
+ memcpy(pbBIG, &gatrun, 8); // 8 = 3*2 + 2
+ pbBIG += 8;
+ gatrun.m_bMinAttrID = 8; // comp.x.top
+ gatrun.m_cAttrs = 12;
+ gatrun.m_rgchwBIGValues[0] = msbf(data16(100));
+ gatrun.m_rgchwBIGValues[1] = msbf(data16(0));
+ gatrun.m_rgchwBIGValues[2] = msbf(data16(0));
+ gatrun.m_rgchwBIGValues[3] = msbf(data16(10));
+ gatrun.m_rgchwBIGValues[4] = msbf(data16(100));
+ gatrun.m_rgchwBIGValues[5] = msbf(data16(0));
+ gatrun.m_rgchwBIGValues[6] = msbf(data16(10));
+ gatrun.m_rgchwBIGValues[7] = msbf(data16(90));
+ gatrun.m_rgchwBIGValues[8] = msbf(data16(100));
+ gatrun.m_rgchwBIGValues[9] = msbf(data16(0));
+ gatrun.m_rgchwBIGValues[10] = msbf(data16(90));
+ gatrun.m_rgchwBIGValues[11] = msbf(data16(100));
+ memcpy(pbBIG, &gatrun, 26); // 26 = 12*2 + 2
+ pbBIG += 26;
+
+ Assert(pbBIG == m_prgbBIGEntries + 102);
+}
+
+void GrLineBreakPass::SetUpLigatureTest()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 1;
+ m_nMaxRuleLoop = 5;
+ m_staBehavior = "Ligatures";
+
+ m_pfsm = new GrFSM();
+ Assert(m_pfsm);
+ m_pfsm->SetUpLigatureTest(m_ipass);
+
+ m_crul = 1;
+
+ // Set up constraint code--succeed trivially.
+ m_prgbConstraintBlock = new byte[1];
+ byte * pb = m_prgbConstraintBlock;
+ *pb++ = kopRetTrue; // RetTrue
+
+ m_prgibConstraintStart = new data16[m_crul];
+ m_prgibConstraintStart[0] = 0;
+
+ // Set up rule action code.
+ m_prgbActionBlock = new byte[8];
+ pb = m_prgbActionBlock;
+
+ // Rule 0: clsLetter { break = 2 }
+
+ *pb++ = kopPutCopy; *pb++ = 0; // PutCopy 0
+ *pb++ = kopPushByte; *pb++ = 2; // PushByte 2
+ *pb++ = kopAttrSet; *pb++ = kslatBreak; // AttrSet breakweight
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ m_prgibActionStart = new data16[m_crul];
+ m_prgibActionStart[0] = 0;
+}
+
+void GrSubPass::SetUpLigatureTest()
+{
+ if (m_ipass == 2)
+ {
+ m_nMaxRuleContext = m_nMaxChunk = 4;
+ m_nMaxRuleLoop = 5;
+ m_staBehavior = "Ligatures";
+
+ m_pfsm = new GrFSM();
+ Assert(m_pfsm);
+ m_pfsm->SetUpLigatureTest(m_ipass);
+
+ m_crul = 3;
+
+ // Set up constraint code.
+ m_prgbConstraintBlock = new byte[1 + 10 + 10];
+ byte * pb = m_prgbConstraintBlock;
+ *pb++ = kopRetTrue; // RetTrue
+
+ *pb++ = kopCntxtItem; *pb++ = 2; // ContextItem 2
+ *pb++ = kopPushSlotAttr;*pb++ = kslatBreak; // PushSlotAttr break 0
+ *pb++ = 0;
+ *pb++ = kopPushByte; *pb++ = 2; // Push 2
+ *pb++ = kopEqual; // Equal
+ *pb++ = kopOr; // Or
+ *pb++ = kopPopRet; // PopAndRet
+
+ *pb++ = kopCntxtItem; *pb++ = 1; // ContextItem 1
+ *pb++ = kopPushSlotAttr;*pb++ = kslatBreak; // PushSlotAttr break 0
+ *pb++ = 0;
+ *pb++ = kopPushByte; *pb++ = 2; // Push 2
+ *pb++ = kopEqual; // Equal
+ *pb++ = kopOr; // Or
+ *pb++ = kopPopRet; // PopAndRet
+
+ m_prgibConstraintStart = new data16[m_crul];
+ m_prgibConstraintStart[0] = 1;
+ m_prgibConstraintStart[1] = 11;
+ m_prgibConstraintStart[2] = 0;
+
+ // Set up rule action code.
+ m_prgbActionBlock = new byte[29 + 29 + 29];
+ pb = m_prgbActionBlock;
+
+ // Rule 0: gX gY gZ > gCapX:(1 2 4) { comp {X.ref=@1; Y.ref=@2; Z.ref=@4 }} _ _
+ // / _ _ # {break==2} _;
+
+ *pb++ = kopPutGlyph8bitObs; *pb++ = 0; // PutGlyph 0 (gCapX)
+ *pb++ = kopAssoc; *pb++ = 3; // Assoc 3 0 1 3
+ *pb++ = 0; *pb++ = 1; *pb++ = 3;
+ *pb++ = kopPushByte; *pb++ = 0; // Push 0
+ *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref x
+ *pb++ = kslatCompRef; *pb++ = 1;
+ *pb++ = kopPushByte; *pb++ = 1; // Push 1
+ *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref y
+ *pb++ = kslatCompRef; *pb++ = 2;
+ *pb++ = kopPushByte; *pb++ = 3; // Push 3
+ *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref z
+ *pb++ = kslatCompRef; *pb++ = 3;
+ *pb++ = kopNext; // Next
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 1: gX gY gZ > _ _ gCapZ:(1 3 4) { comp {X.ref=@1; Y.ref=@3; Z.ref=@4 }}
+ // / _ # {break==2} _ _;
+
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopCopyNext; // CopyNext
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopPutGlyph8bitObs; *pb++ = 2; // PutGlyph 2 (gCapZ)
+ *pb++ = kopAssoc; *pb++ = 3; // Assoc 3 -3 -1 0
+ *pb++ = -3; *pb++ = -1; *pb++ = 0;
+ *pb++ = kopPushByte; *pb++ = -3; // Push -3
+ *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref x
+ *pb++ = kslatCompRef; *pb++ = 1;
+ *pb++ = kopPushByte; *pb++ = -1; // Push -1
+ *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref y
+ *pb++ = kslatCompRef; *pb++ = 2;
+ *pb++ = kopPushByte; *pb++ = 0; // Push 0
+ *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref z
+ *pb++ = kslatCompRef; *pb++ = 3;
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 2: gX gY gZ > _ gCapY:(1 2 3) { comp {X.ref=@1; Y.ref=@2; Z.ref=@3 }} gPlus;
+
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopPutGlyph8bitObs; *pb++ = 1; // PutGlyph 1 (gCapY)
+ *pb++ = kopAssoc; *pb++ = 3; // Assoc 3 -1 0 1
+ *pb++ = -1; *pb++ = 0; *pb++ = 1;
+ *pb++ = kopPushByte; *pb++ = -1; // Push -1
+ *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref x
+ *pb++ = kslatCompRef; *pb++ = 1;
+ *pb++ = kopPushByte; *pb++ = 0; // Push 0
+ *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref y
+ *pb++ = kslatCompRef; *pb++ = 2;
+ *pb++ = kopPushByte; *pb++ = 1; // Push 1
+ *pb++ = kopIAttrSetSlot; // IAttrSetSlot comp_ref z
+ *pb++ = kslatCompRef; *pb++ = 3;
+ *pb++ = kopNext; // Next
+ *pb++ = kopPutGlyph8bitObs; *pb++ = 3; // PutGlyph 3 (gPlus)
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ m_prgibActionStart = new data16[m_crul];
+ m_prgibActionStart[0] = 0;
+ m_prgibActionStart[1] = 29;
+ m_prgibActionStart[2] = 29 + 29;
+ }
+ else
+ Assert(false);
+}
+
+
+void GrFSM::SetUpLigatureTest(int ipass)
+{
+ if (ipass == 1)
+ {
+ // Create machine class ranges.
+ m_cmcr = 1;
+ m_prgmcr = new GrFSMClassRange[m_cmcr];
+ m_prgmcr[0].m_chwFirst = 97; // a - z
+ m_prgmcr[0].m_chwLast = 122;
+ m_prgmcr[0].m_col = 0;
+
+ m_dimcrInit = 1; // (max power of 2 <= m_cmcr);
+ m_cLoop = 0; // log2(max power of 2 <= m_cmcr);
+ m_imcrStart = m_cmcr - m_dimcrInit;
+
+
+ m_crow = 2;
+ m_crowNonAcpt = 1;
+ m_crowFinal = 1;
+ m_rowFinalMin = m_crow - m_crowFinal;
+ m_ccol = 1;
+
+ // Set up transition table.
+ m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 1
+ short * psn = m_prgrowTransitions;
+ *psn++ = 1;
+
+ // Set up matched-rules tables.
+ m_prgrulnMatched = new data16[1]; // 1 = sum of rules matched for each accepting state
+ m_prgirulnMin = new data16[m_crow - m_crowNonAcpt + 1];
+
+ m_prgirulnMin[0] = 0; // s1: r0
+ m_prgrulnMatched[0] = 0;
+
+ m_prgirulnMin[1] = 1;
+ }
+ else if (ipass == 2)
+ {
+ // Create machine class ranges.
+ m_cmcr = 4;
+ m_prgmcr = new GrFSMClassRange[m_cmcr];
+ m_prgmcr[0].m_chwFirst = 35; // #
+ m_prgmcr[0].m_chwLast = 35;
+ m_prgmcr[0].m_col = 3;
+
+ m_prgmcr[1].m_chwFirst = 120; // x
+ m_prgmcr[1].m_chwLast = 120;
+ m_prgmcr[1].m_col = 0;
+
+ m_prgmcr[2].m_chwFirst = 121; // y
+ m_prgmcr[2].m_chwLast = 121;
+ m_prgmcr[2].m_col = 1;
+
+ m_prgmcr[3].m_chwFirst = 122; // z
+ m_prgmcr[3].m_chwLast = 123;
+ m_prgmcr[3].m_col = 2;
+
+
+ m_dimcrInit = 4; // (max power of 2 <= m_cmcr);
+ m_cLoop = 2; // log2(max power of 2 <= m_cmcr);
+ m_imcrStart = m_cmcr - m_dimcrInit;
+
+
+ m_crow = 9;
+ m_crowNonAcpt = 6;
+ m_crowFinal = 3;
+ m_rowFinalMin = m_crow - m_crowFinal;
+ m_ccol = 4;
+
+ // Set up transition table.
+ m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 24
+ short * psn = m_prgrowTransitions;
+ *psn++ = 1; *psn++ = 0; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 2; *psn++ = 0; *psn++ = 3;
+ *psn++ = 0; *psn++ = 0; *psn++ = 6; *psn++ = 4;
+ *psn++ = 0; *psn++ = 5; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ = 7; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ = 8; *psn++ = 0;
+
+ // Set up matched-rules tables.
+ m_prgrulnMatched = new data16[3]; // 3 = sum of rules matched for each accepting state
+ m_prgirulnMin = new data16[3+1]; // 3 = m_crow - m_crowNonAcpt
+
+ m_prgirulnMin[0] = 0; // s6: r2
+ m_prgrulnMatched[0] = 2;
+
+ m_prgirulnMin[1] = 1; // s7: r0
+ m_prgrulnMatched[1] = 0;
+
+ m_prgirulnMin[2] = 2; // s8: r1
+ m_prgrulnMatched[2] = 1;
+
+ m_prgirulnMin[3] = 3;
+ }
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Tests of ligatures and components where the components are modified glyphs.
+
+ PASS 1:
+ r0. gX gI > @2 @1;
+ r1. clsPlainVowel gAcute > clsVowelAcute:(1 2) _;
+ r2. clsPlainVowel gGrave > clsVowelGrave:(1 2) _;
+
+ Pass 1 machine classes:
+ mcX: x 120
+ mcI: i 105
+ mcPV: a e o u 97 101 111 117
+ mcAcute: / 47
+ mcGrave: \ 92
+
+ Pass 1 FSM: (T=transition, F=final, A=accepting, NA=non-accepting)
+
+ | mcX mcPV mcI mcAcute mcGrave
+ ---------------------------------------------------------------
+ T NA s0 | s1 s2 s2
+ | - - - -
+ T NA s1 | s3
+ | - - - -
+ T NA s2 | s4 s5
+ | - - - -
+ F A s3 |
+ | - - - -
+ F A s4 |
+ | - - - -
+ F A s5 |
+ | - - - -
+
+
+ Rules Matched:
+ s3: r0
+ s4: r1
+ s5: r2
+
+
+ PASS 2:
+ r0. clsVowel gI > clsCapVowel:(1 2) { comp {v.ref = @1; i.ref = @2}} _;
+
+ Pass 2 machine classes:
+ mcV: 97 101 111 117
+ 224 225 232 233 236 237 242 243 249 250
+ mcI: i 105
+
+
+ Pass 2 FSM:
+ | mcV mcI
+ ----------------------------------------------------
+ T NA s0 | s1 s1
+ | -
+ T NA s1 | s2
+ | -
+ F A s2 |
+ | -
+
+ Rules matched:
+ s2: r0
+----------------------------------------------------------------------------------------------*/
+void GrEngine::SetUpLigature2Test()
+{
+ if (m_pctbl)
+ delete m_pctbl;
+
+ m_pctbl = new GrClassTable();
+ m_pctbl->SetUpLigature2Test();
+
+ m_pgtbl = new GrGlyphTable();
+ m_pgtbl->SetUpLigature2Test();
+}
+
+void GrClassTable::SetUpLigature2Test()
+{
+ m_ccls = 5; // number of classes
+ m_cclsLinear = 3; // number of classes in linear format
+
+ m_prgchwBIGGlyphList = new data16[73];
+
+ m_prgichwOffsets = new data16[m_ccls+1];
+
+ data16 * pchw = m_prgchwBIGGlyphList;
+
+ // Output class 0: clsVowelAcute
+ m_prgichwOffsets[0] = 0;
+ *pchw++ = msbf(data16(225)); // a-acute
+ *pchw++ = msbf(data16(233)); // e-acute
+ *pchw++ = msbf(data16(237)); // i-acute
+ *pchw++ = msbf(data16(243)); // o-acute
+ *pchw++ = msbf(data16(250)); // u-acute
+
+ // Output class 1: clsVowelGrave
+ m_prgichwOffsets[1] = 5;
+ *pchw++ = msbf(data16(224)); // a-grave
+ *pchw++ = msbf(data16(232)); // e-grave
+ *pchw++ = msbf(data16(236)); // i-grave
+ *pchw++ = msbf(data16(242)); // o-grave
+ *pchw++ = msbf(data16(249)); // u-grave
+
+ // Output class 2: clsCapVowel
+ m_prgichwOffsets[2] = 5 + 5; // 10
+ *pchw++ = msbf(data16(65)); // A
+ *pchw++ = msbf(data16(69)); // E
+ *pchw++ = msbf(data16(73)); // I
+ *pchw++ = msbf(data16(79)); // O
+ *pchw++ = msbf(data16(85)); // U
+ *pchw++ = msbf(data16(193)); // A-acute
+ *pchw++ = msbf(data16(201)); // E-acute
+ *pchw++ = msbf(data16(205)); // I-acute
+ *pchw++ = msbf(data16(211)); // O-acute
+ *pchw++ = msbf(data16(218)); // U-acute
+ *pchw++ = msbf(data16(192)); // A-grave
+ *pchw++ = msbf(data16(200)); // E-grave
+ *pchw++ = msbf(data16(204)); // I-grave
+ *pchw++ = msbf(data16(210)); // O-grave
+ *pchw++ = msbf(data16(217)); // U-grave
+
+ // Input class 3: clsPlainVowel
+ m_prgichwOffsets[3] = 10 + 15; // 25
+ *pchw++ = msbf(data16(5));
+ *pchw++ = msbf(data16(4)); *pchw++ = msbf(data16(2)); *pchw++ = msbf(data16(5-4));
+ *pchw++ = msbf(data16(97)); *pchw++ = msbf(data16(0)); // a
+ *pchw++ = msbf(data16(101)); *pchw++ = msbf(data16(1)); // e
+ *pchw++ = msbf(data16(105)); *pchw++ = msbf(data16(2)); // i
+ *pchw++ = msbf(data16(111)); *pchw++ = msbf(data16(3)); // o
+ *pchw++ = msbf(data16(117)); *pchw++ = msbf(data16(4)); // u
+
+ // Input class 4: clsVowel
+ m_prgichwOffsets[4] = 25 + 4+(5*2); // 39
+ *pchw++ = msbf(data16(15));
+ *pchw++ = msbf(data16(8)); *pchw++ = msbf(data16(3)); *pchw++ = msbf(data16(15-8));
+ *pchw++ = msbf(data16(97)); *pchw++ = msbf(data16(0)); // a
+ *pchw++ = msbf(data16(101)); *pchw++ = msbf(data16(1)); // e
+ *pchw++ = msbf(data16(105)); *pchw++ = msbf(data16(2)); // i
+ *pchw++ = msbf(data16(111)); *pchw++ = msbf(data16(3)); // o
+ *pchw++ = msbf(data16(117)); *pchw++ = msbf(data16(4)); // u
+ *pchw++ = msbf(data16(224)); *pchw++ = msbf(data16(10)); // a-grave
+ *pchw++ = msbf(data16(225)); *pchw++ = msbf(data16(5)); // a-acute
+ *pchw++ = msbf(data16(232)); *pchw++ = msbf(data16(11)); // e-grave
+ *pchw++ = msbf(data16(233)); *pchw++ = msbf(data16(6)); // e-acute
+ *pchw++ = msbf(data16(236)); *pchw++ = msbf(data16(12)); // i-grave
+ *pchw++ = msbf(data16(237)); *pchw++ = msbf(data16(7)); // i-acute
+ *pchw++ = msbf(data16(242)); *pchw++ = msbf(data16(13)); // o-grave
+ *pchw++ = msbf(data16(243)); *pchw++ = msbf(data16(8)); // o-acute
+ *pchw++ = msbf(data16(249)); *pchw++ = msbf(data16(14)); // u-grave
+ *pchw++ = msbf(data16(250)); *pchw++ = msbf(data16(9)); // u-acute
+
+ m_prgichwOffsets[5] = 39 + 4+(15*2); // 73
+}
+
+void GrGlyphTable::SetUpLigature2Test()
+{
+ SetNumberOfGlyphs(256);
+ SetNumberOfStyles(1);
+
+ GrGlyphSubTable * pgstbl = new GrGlyphSubTable();
+ Assert(pgstbl);
+
+ pgstbl->Initialize(1, 0, 256, 10, 4);
+ SetSubTable(0, pgstbl);
+
+ SetNumberOfComponents(2); // comp.base, comp.i
+
+ pgstbl->SetUpLigature2Test();
+}
+
+/***********************************************************************************************
+ TODO: This method is BROKEN because m_prgibBIGAttrValues has been changed. It is no
+ longer a data16 *. The Gloc table can contain 16-bit or 32-bit entries and must be
+ accessed accordingly.
+***********************************************************************************************/
+void GrGlyphSubTable::SetUpLigature2Test()
+{
+ m_nAttrIDLim = 10;
+
+ m_pgatbl = new GrGlyphAttrTable();
+ m_pgatbl->Initialize(0, 330);
+
+ for (int i = 0; i <= 65; i++) // A
+ m_prgibBIGAttrValues[i] = (byte)msbf(data16(0));
+
+ for (i = 66; i <= 69; i++) // E
+ m_prgibBIGAttrValues[i] = (byte)msbf(data16(22));
+
+ for (i = 70; i <= 73; i++) // I
+ m_prgibBIGAttrValues[i] = (byte)msbf(data16(44));
+
+ for (i = 74; i <= 79; i++) // O
+ m_prgibBIGAttrValues[i] = (byte)msbf(data16(66));
+
+ for (i = 80; i <= 85; i++) // U
+ m_prgibBIGAttrValues[i] = (byte)msbf(data16(88));
+
+ for (i = 86; i <= 192; i++) // A-grave
+ m_prgibBIGAttrValues[i] = (byte)msbf(data16(110));
+
+ m_prgibBIGAttrValues[193] = (byte)msbf(data16(132)); // A-acute
+
+ for (i = 194; i <= 200; i++) // E-grave
+ m_prgibBIGAttrValues[i] = (byte)msbf(data16(154));
+
+ m_prgibBIGAttrValues[201] = (byte)msbf(data16(176)); // E-acute
+
+ for (i = 202; i <= 204; i++) // I-grave
+ m_prgibBIGAttrValues[i] = (byte)msbf(data16(198));
+
+ m_prgibBIGAttrValues[205] = (byte)msbf(data16(220)); // I-acute
+
+ for (i = 206; i <= 210; i++) // O-grave
+ m_prgibBIGAttrValues[i] = (byte)msbf(data16(242));
+
+ m_prgibBIGAttrValues[211] = (byte)msbf(data16(264)); // O-acute
+
+ for (i = 212; i <= 217; i++) // U-grave
+ m_prgibBIGAttrValues[i] = (byte)msbf(data16(286));
+
+ m_prgibBIGAttrValues[218] = (byte)msbf(data16(308)); // O-acute
+
+ for (i = 219; i < 256; i++)
+ m_prgibBIGAttrValues[i] = (byte)msbf(data16(330));
+
+ m_pgatbl->SetUpLigature2Test();
+}
+
+void GrGlyphAttrTable::SetUpLigature2Test()
+{
+ // All ligatures have the following defined:
+ //
+ // 0 = 2 comp.base (0,30, 100,100)
+ // 1 = 6 comp.i (0,0, 100,30)
+ // 2= 100 comp.base.top
+ // 3= 30 bottom
+ // 4= 0 left
+ // 5= 100 right
+ // 6 = 30 comp.i.top
+ // 7 = 0 bottom
+ // 8= 0 left
+ // 9= 100 right
+
+ byte * pbBIG = m_prgbBIGEntries;
+
+ GrGlyphAttrRun gatrun;
+
+ for (int i = 0; i < 15; i++)
+ {
+ gatrun.m_bMinAttrID = 0;
+ gatrun.m_cAttrs = 10;
+ gatrun.m_rgchwBIGValues[0] = msbf(data16(2));
+ gatrun.m_rgchwBIGValues[1] = msbf(data16(6));
+ gatrun.m_rgchwBIGValues[2] = msbf(data16(100));
+ gatrun.m_rgchwBIGValues[3] = msbf(data16(30));
+ gatrun.m_rgchwBIGValues[4] = msbf(data16(0));
+ gatrun.m_rgchwBIGValues[5] = msbf(data16(100));
+ gatrun.m_rgchwBIGValues[6] = msbf(data16(30));
+ gatrun.m_rgchwBIGValues[7] = msbf(data16(0));
+ gatrun.m_rgchwBIGValues[8] = msbf(data16(0));
+ gatrun.m_rgchwBIGValues[9] = msbf(data16(100));
+ memcpy(pbBIG, &gatrun, 22); // 22 = 10*2 + 2
+ pbBIG += 22;
+ }
+
+ Assert(pbBIG == m_prgbBIGEntries + (22 * 15));
+}
+
+void GrSubPass::SetUpLigature2Test()
+{
+ if (m_ipass == 1)
+ {
+ m_nMaxRuleContext = m_nMaxChunk = 2;
+ m_nMaxRuleLoop = 5;
+ m_staBehavior = "Ligatures2";
+
+ m_pfsm = new GrFSM();
+ Assert(m_pfsm);
+ m_pfsm->SetUpLigature2Test(m_ipass);
+
+ m_crul = 3;
+
+ // Set up constraint code.
+ m_prgbConstraintBlock = new byte[1];
+ byte * pb = m_prgbConstraintBlock;
+ *pb++ = kopRetTrue; // RetTrue
+
+ m_prgibConstraintStart = new data16[m_crul];
+ m_prgibConstraintStart[0] = 0;
+ m_prgibConstraintStart[1] = 0;
+ m_prgibConstraintStart[2] = 0;
+
+ // Set up rule action code.
+ m_prgbActionBlock = new byte[7 + 12 + 12];
+ pb = m_prgbActionBlock;
+
+ // Rule 0: gX gI > @2 @1;
+
+ *pb++ = kopPutCopy; *pb++ = 1; // PutCopy 1
+ *pb++ = kopNext; // Next
+ *pb++ = kopPutCopy; *pb++ = -1; // PutCopy -1
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 1: clsPlainVowel gAcute > clsVowelAcute:(1 2) _;
+
+ *pb++ = kopPutSubs8bitObs; *pb++ = 0; // PutSubs 0 3 0
+ *pb++ = 3; *pb++ = 0;
+ *pb++ = kopAssoc; *pb++ = 2; // Assoc 2 0 1
+ *pb++ = 0; *pb++ = 1;
+ *pb++ = kopNext; // Next
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ // Rule 2: clsPlainVowel gGrave > clsVowelGrave:(1 2) _;
+
+ *pb++ = kopPutSubs8bitObs; *pb++ = 0; // PutSubs 0 3 1
+ *pb++ = 3; *pb++ = 1;
+ *pb++ = kopAssoc; *pb++ = 2; // Assoc 2 0 1
+ *pb++ = 0; *pb++ = 1;
+ *pb++ = kopNext; // Next
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ m_prgibActionStart = new data16[m_crul];
+ m_prgibActionStart[0] = 0;
+ m_prgibActionStart[1] = 7;
+ m_prgibActionStart[2] = 7 + 12;
+ }
+ else if (m_ipass == 2)
+ {
+ m_nMaxRuleContext = m_nMaxChunk = 2;
+ m_nMaxRuleLoop = 5;
+ m_staBehavior = "Ligatures2";
+
+ m_pfsm = new GrFSM();
+ Assert(m_pfsm);
+ m_pfsm->SetUpLigature2Test(m_ipass);
+
+ m_crul = 1;
+
+ // Set up constraint code.
+ m_prgbConstraintBlock = new byte[1];
+ byte * pb = m_prgbConstraintBlock;
+ *pb++ = kopRetTrue; // RetTrue
+
+ m_prgibConstraintStart = new data16[m_crul];
+ m_prgibConstraintStart[0] = 0;
+
+ // Set up rule action code.
+ m_prgbActionBlock = new byte[7 + 12 + 12];
+ pb = m_prgbActionBlock;
+
+ // Rule 0: clsVowel gI > clsCapVowel:(1 2) { comp {v.ref = @1; i.ref = @2}} _;
+
+ *pb++ = kopPutSubs8bitObs; *pb++ = 0; // PutSubs 0 4 2
+ *pb++ = 4; *pb++ = 2;
+ *pb++ = kopAssoc; *pb++ = 2; // Assoc 2 0 1
+ *pb++ = 0; *pb++ = 1;
+ *pb++ = kopPushByte; *pb++ = 0; // Push 0
+ *pb++ = kopIAttrSetSlot; // IAttrSetSlot compRef v
+ *pb++ = kslatCompRef; *pb++ = 0;
+ *pb++ = kopPushByte; *pb++ = 1; // Push 1
+ *pb++ = kopIAttrSetSlot; // IAttrSetSlot compRef i
+ *pb++ = kslatCompRef; *pb++ = 1;
+ *pb++ = kopNext; // Next
+ *pb++ = kopDelete; // Delete
+ *pb++ = kopNext; // Next
+ *pb++ = kopRetZero; // RetZero
+
+ m_prgibActionStart = new data16[m_crul];
+ m_prgibActionStart[0] = 0;
+ }
+ else
+ Assert(false);
+}
+
+
+void GrFSM::SetUpLigature2Test(int ipass)
+{
+ if (ipass == 1)
+ {
+ // Create machine class ranges.
+ m_cmcr = 8;
+ m_prgmcr = new GrFSMClassRange[m_cmcr];
+ m_prgmcr[0].m_chwFirst = 47; // acute
+ m_prgmcr[0].m_chwLast = 47;
+ m_prgmcr[0].m_col = 3;
+
+ m_prgmcr[1].m_chwFirst = 92; // grave
+ m_prgmcr[1].m_chwLast = 92;
+ m_prgmcr[1].m_col = 4;
+
+ m_prgmcr[2].m_chwFirst = 97; // a
+ m_prgmcr[2].m_chwLast = 97;
+ m_prgmcr[2].m_col = 1;
+
+ m_prgmcr[3].m_chwFirst = 101; // e
+ m_prgmcr[3].m_chwLast = 101;
+ m_prgmcr[3].m_col = 1;
+
+ m_prgmcr[4].m_chwFirst = 105; // i
+ m_prgmcr[4].m_chwLast = 105;
+ m_prgmcr[4].m_col = 2;
+
+ m_prgmcr[5].m_chwFirst = 111; // o
+ m_prgmcr[5].m_chwLast = 111;
+ m_prgmcr[5].m_col = 1;
+
+ m_prgmcr[6].m_chwFirst = 117; // u
+ m_prgmcr[6].m_chwLast = 117;
+ m_prgmcr[6].m_col = 1;
+
+ m_prgmcr[7].m_chwFirst = 120; // x
+ m_prgmcr[7].m_chwLast = 120;
+ m_prgmcr[7].m_col = 0;
+
+ m_dimcrInit = 8; // (max power of 2 <= m_cmcr);
+ m_cLoop = 3; // log2(max power of 2 <= m_cmcr);
+ m_imcrStart = m_cmcr - m_dimcrInit;
+
+
+ m_crow = 6;
+ m_crowNonAcpt = 3;
+ m_crowFinal = 3;
+ m_rowFinalMin = m_crow - m_crowFinal;
+ m_ccol = 5;
+
+ // Set up transition table.
+ m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 15
+ short * psn = m_prgrowTransitions;
+ *psn++ = 1; *psn++ = 2; *psn++ = 2; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ = 3; *psn++ = 0; *psn++ = 0;
+ *psn++ = 0; *psn++ = 0; *psn++ = 0; *psn++ = 4; *psn++ = 5;
+
+ // Set up matched-rules tables.
+ m_prgrulnMatched = new data16[3]; // 3 = sum of rules matched for each accepting state
+ m_prgirulnMin = new data16[3+1]; // 3 = m_crow - m_crowNonAcpt
+
+ m_prgirulnMin[0] = 0; // s3: r0
+ m_prgrulnMatched[0] = 0;
+
+ m_prgirulnMin[1] = 1; // s4: r1
+ m_prgrulnMatched[1] = 1;
+
+ m_prgirulnMin[2] = 2; // s5: r2
+ m_prgrulnMatched[2] = 2;
+
+ m_prgirulnMin[3] = 3;
+ }
+ else if (ipass == 2)
+ {
+ // Create machine class ranges.
+ m_cmcr = 10;
+ m_prgmcr = new GrFSMClassRange[m_cmcr];
+ m_prgmcr[0].m_chwFirst = 97; // a
+ m_prgmcr[0].m_chwLast = 97;
+ m_prgmcr[0].m_col = 0;
+
+ m_prgmcr[1].m_chwFirst = 101; // e
+ m_prgmcr[1].m_chwLast = 101;
+ m_prgmcr[1].m_col = 0;
+
+ m_prgmcr[2].m_chwFirst = 105; // i
+ m_prgmcr[2].m_chwLast = 105;
+ m_prgmcr[2].m_col = 1;
+
+ m_prgmcr[3].m_chwFirst = 111; // o
+ m_prgmcr[3].m_chwLast = 111;
+ m_prgmcr[3].m_col = 0;
+
+ m_prgmcr[4].m_chwFirst = 117; // u
+ m_prgmcr[4].m_chwLast = 117;
+ m_prgmcr[4].m_col = 0;
+
+ m_prgmcr[5].m_chwFirst = 224; // a-grave, a-acute
+ m_prgmcr[5].m_chwLast = 225;
+ m_prgmcr[5].m_col = 0;
+
+ m_prgmcr[6].m_chwFirst = 232; // e-grave, e-acute
+ m_prgmcr[6].m_chwLast = 233;
+ m_prgmcr[6].m_col = 0;
+
+ m_prgmcr[7].m_chwFirst = 236; // i-grave, i-acute
+ m_prgmcr[7].m_chwLast = 237;
+ m_prgmcr[7].m_col = 0;
+
+ m_prgmcr[8].m_chwFirst = 242; // o-grave, o-acute
+ m_prgmcr[8].m_chwLast = 243;
+ m_prgmcr[8].m_col = 0;
+
+ m_prgmcr[9].m_chwFirst = 249; // u-grave, u-acute
+ m_prgmcr[9].m_chwLast = 250;
+ m_prgmcr[9].m_col = 0;
+
+
+ m_dimcrInit = 8; // (max power of 2 <= m_cmcr);
+ m_cLoop = 3; // log2(max power of 2 <= m_cmcr);
+ m_imcrStart = m_cmcr - m_dimcrInit;
+
+
+ m_crow = 3;
+ m_crowNonAcpt = 2;
+ m_crowFinal = 1;
+ m_rowFinalMin = m_crow - m_crowFinal;
+ m_ccol = 2;
+
+ // Set up transition table.
+ m_prgrowTransitions = new short[(m_crow-m_crowFinal) * m_ccol]; // 4
+ short * psn = m_prgrowTransitions;
+ *psn++ = 1; *psn++ = 1;
+ *psn++ = 0; *psn++ = 2;
+
+ // Set up matched-rules tables.
+ m_prgrulnMatched = new data16[1]; // 1 = sum of rules matched for each accepting state
+ m_prgirulnMin = new data16[1+1]; // 1 = m_crow - m_crowNonAcpt
+
+ m_prgirulnMin[0] = 0; // s2: r0
+ m_prgrulnMatched[0] = 0;
+
+ m_prgirulnMin[1] = 1;
+ }
+}
+
+#endif // _DEBUG
+
+} // namespace gr
+
+#endif // OLD_TEST_STUFF
+
+//:End Ignore
diff --git a/Build/source/libs/graphite/src/segment/TestPasses.cpp b/Build/source/libs/graphite/src/segment/TestPasses.cpp
new file mode 100644
index 00000000000..a85e6c56207
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/TestPasses.cpp
@@ -0,0 +1,1005 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: TestPasses.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Hard-coded passes for test procedures.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+//:Ignore
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+#ifdef OLD_TEST_STUFF
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ For release version.
+----------------------------------------------------------------------------------------------*/
+#ifndef _DEBUG
+
+bool GrLineBreakPass::RunTestRules(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ return false;
+}
+
+bool GrSubPass::RunTestRules(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ return false;
+}
+
+bool GrPosPass::RunTestRules(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ return false;
+}
+
+#endif // !_DEBUG
+
+
+#ifdef _DEBUG
+
+/*----------------------------------------------------------------------------------------------
+ Set up a table manager for testing.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::SetUpTest(std::wstring stuRendBehavior)
+{
+ if (stuRendBehavior == L"NoRules")
+ {
+ m_cpass = 2;
+ m_cpassLB = 0;
+ m_ipassPos1 = 1;
+ m_fBidi = false;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrPosPass(1);
+
+ m_prgppass[0]->SetUpTestData();
+ m_prgppass[1]->SetUpTestData();
+ }
+ else if (stuRendBehavior == L"JustReorder" || stuRendBehavior == "RightToLeftLayout")
+ {
+ m_cpass = 4;
+ m_cpassLB = 0;
+ m_ipassPos1 = 3;
+ m_fBidi = true;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrSubPass(1);
+ m_prgppass[2] = new GrBidiPass(2);
+ m_prgppass[3] = new GrPosPass(3);
+
+ m_prgppass[0]->SetUpTestData();
+ m_prgppass[1]->SetUpReverseNumbersTest();
+ m_prgppass[2]->SetUpTestData();
+ m_prgppass[3]->SetUpTestData();
+
+ m_prgppass[2]->SetTopDirLevel(TopDirectionLevel());
+ }
+ else if (stuRendBehavior == L"CrossLineContext")
+ {
+ m_cpass = 4;
+ m_cpassLB = 1;
+ m_ipassPos1 = 3;
+ m_fBidi = false;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrLineBreakPass(1);
+ m_prgppass[2] = new GrSubPass(2);
+ m_prgppass[3] = new GrPosPass(3);
+
+ m_prgppass[0]->SetUpTestData();
+ m_prgppass[1]->SetUpCrossLineContextTest();
+ m_prgppass[2]->SetUpCrossLineContextTest();
+ m_prgppass[3]->SetUpTestData();
+ }
+ else if (stuRendBehavior == L"Reprocess")
+ {
+ m_cpass = 6;
+ m_cpassLB = 1;
+ m_ipassPos1 = 5;
+ m_fBidi = true;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrLineBreakPass(1);
+ m_prgppass[2] = new GrSubPass(2);
+ m_prgppass[3] = new GrSubPass(3);
+ m_prgppass[4] = new GrBidiPass(4);
+ m_prgppass[5] = new GrPosPass(5);
+
+ m_prgppass[0]->SetUpTestData(); // glyph-gen pass
+ m_prgppass[1]->SetUpReprocessTest(); // line-break pass
+ m_prgppass[2]->SetUpReverseNumbersTest(); // sub pass 1
+ m_prgppass[3]->SetUpReprocessTest(); // sub pass 2
+ m_prgppass[4]->SetUpTestData(); // bidi pass
+ m_prgppass[5]->SetUpTestData(); // pos pass
+
+ m_prgppass[4]->SetTopDirLevel(TopDirectionLevel());
+ }
+ else if (stuRendBehavior == L"LineEdgeContext")
+ {
+ m_cpass = 4;
+ m_cpassLB = 0;
+ m_ipassPos1 = 3;
+ m_fBidi = false;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrSubPass(1);
+ m_prgppass[2] = new GrSubPass(2);
+ m_prgppass[3] = new GrPosPass(3);
+
+ m_prgppass[0]->SetUpTestData();
+ m_prgppass[1]->SetUpLineEdgeContextTest(1);
+ m_prgppass[2]->SetUpLineEdgeContextTest(2);
+ m_prgppass[3]->SetUpTestData();
+ }
+ else if (stuRendBehavior == L"BidiAlgorithm")
+ {
+ m_cpass = 4;
+ m_cpassLB = 0;
+ m_ipassPos1 = 3;
+ m_fBidi = true;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrSubPass(1);
+ m_prgppass[2] = new GrBidiPass(2);
+ m_prgppass[3] = new GrPosPass(3);
+
+ m_prgppass[0]->SetUpTestData();
+ m_prgppass[1]->SetUpBidiAlgorithmTest();
+ m_prgppass[2]->SetUpBidiAlgorithmTest();
+ m_prgppass[3]->SetUpTestData();
+
+ m_prgppass[2]->SetTopDirLevel(TopDirectionLevel());
+ }
+ else if (stuRendBehavior == L"PseudoGlyphs")
+ {
+ m_cpass = 3;
+ m_cpassLB = 0;
+ m_ipassPos1 = 2;
+ m_fBidi = false;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrSubPass(1);
+ m_prgppass[2] = new GrPosPass(2);
+
+ m_prgppass[0]->SetUpTestData();
+ m_prgppass[1]->SetUpPseudoGlyphsTest();
+ m_prgppass[2]->SetUpTestData();
+ }
+ else if (stuRendBehavior == L"SimpleFSM")
+ {
+ m_cpass = 3;
+ m_cpassLB = 0;
+ m_ipassPos1 = 2;
+ m_fBidi = false;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrSubPass(1);
+ m_prgppass[2] = new GrPosPass(2);
+
+ m_prgppass[0]->SetUpTestData();
+ m_prgppass[1]->SetUpSimpleFSMTest();
+ m_prgppass[2]->SetUpTestData();
+ }
+ else if (stuRendBehavior == L"RuleAction")
+ {
+ m_cpass = 3;
+ m_cpassLB = 0;
+ m_ipassPos1 = 2;
+ m_fBidi = false;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrSubPass(1);
+ m_prgppass[2] = new GrPosPass(2);
+
+ m_prgppass[0]->SetUpTestData();
+ m_prgppass[1]->SetUpRuleActionTest();
+ m_prgppass[2]->SetUpTestData();
+ }
+ else if (stuRendBehavior == L"RuleAction2")
+ {
+ m_cpass = 6;
+ m_cpassLB = 0;
+ m_ipassPos1 = 5;
+ m_fBidi = true;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrSubPass(1);
+ m_prgppass[2] = new GrSubPass(2);
+ m_prgppass[3] = new GrSubPass(3);
+ m_prgppass[4] = new GrBidiPass(4);
+ m_prgppass[5] = new GrPosPass(5);
+
+ m_prgppass[0]->SetUpTestData(); // glyph-gen pass
+ m_prgppass[1]->SetUpRuleAction2Test(); // sub pass 1
+ m_prgppass[2]->SetUpRuleAction2Test(); // sub pass 2
+ m_prgppass[3]->SetUpRuleAction2Test(); // sub pass 3
+ m_prgppass[4]->SetUpTestData(); // bidi pass
+ m_prgppass[5]->SetUpTestData(); // pos pass
+
+ m_prgppass[4]->SetTopDirLevel(TopDirectionLevel());
+ }
+ else if (stuRendBehavior == L"Assoc")
+ {
+ m_cpass = 5;
+ m_cpassLB = 1;
+ m_ipassPos1 = 4;
+ m_fBidi = false;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrLineBreakPass(1);
+ m_prgppass[2] = new GrSubPass(2);
+ m_prgppass[3] = new GrSubPass(3);
+ m_prgppass[4] = new GrPosPass(4);
+
+ m_prgppass[0]->SetUpTestData();
+ m_prgppass[1]->SetUpAssocTest();
+ m_prgppass[2]->SetUpAssocTest();
+ m_prgppass[3]->SetUpAssocTest();
+ m_prgppass[4]->SetUpTestData();
+ }
+ else if (stuRendBehavior == L"Assoc2")
+ {
+ m_cpass = 3;
+ m_cpassLB = 0;
+ m_ipassPos1 = 2;
+ m_fBidi = false;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrSubPass(1);
+ m_prgppass[2] = new GrPosPass(2);
+
+ m_prgppass[0]->SetUpTestData();
+ m_prgppass[1]->SetUpAssoc2Test();
+ m_prgppass[2]->SetUpTestData();
+ }
+ else if (stuRendBehavior == L"DefaultAssoc")
+ {
+ m_cpass = 3;
+ m_cpassLB = 0;
+ m_ipassPos1 = 2;
+ m_fBidi = false;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrSubPass(1);
+ m_prgppass[2] = new GrPosPass(2);
+
+ m_prgppass[0]->SetUpTestData();
+ m_prgppass[1]->SetUpDefaultAssocTest();
+ m_prgppass[2]->SetUpTestData();
+ }
+ else if (stuRendBehavior == L"BidiNumbers")
+ {
+ m_cpass = 4;
+ m_cpassLB = 0;
+ m_ipassPos1 = 3;
+ m_fBidi = true;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrSubPass(1);
+ m_prgppass[2] = new GrBidiPass(2);
+ m_prgppass[3] = new GrPosPass(3);
+
+ m_prgppass[0]->SetUpTestData();
+ m_prgppass[1]->SetUpBidiNumbersTest();
+ m_prgppass[2]->SetUpBidiNumbersTest();
+ m_prgppass[3]->SetUpTestData();
+
+ m_prgppass[2]->SetTopDirLevel(TopDirectionLevel());
+ }
+ else if (stuRendBehavior == L"Feature")
+ {
+ m_cpass = 3;
+ m_cpassLB = 0;
+ m_ipassPos1 = 2;
+ m_fBidi = false;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrSubPass(1);
+ m_prgppass[2] = new GrPosPass(2);
+
+ m_prgppass[0]->SetUpTestData();
+ m_prgppass[1]->SetUpFeatureTest();
+ m_prgppass[2]->SetUpTestData();
+ }
+ else if (stuRendBehavior == L"Ligatures")
+ {
+ m_cpass = 4;
+ m_cpassLB = 1;
+ m_ipassPos1 = 3;
+ m_fBidi = false;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrLineBreakPass(1);
+ m_prgppass[2] = new GrSubPass(2);
+ m_prgppass[3] = new GrPosPass(3);
+
+ m_prgppass[0]->SetUpTestData();
+ m_prgppass[1]->SetUpLigatureTest();
+ m_prgppass[2]->SetUpLigatureTest();
+ m_prgppass[3]->SetUpTestData();
+ }
+ else if (stuRendBehavior == L"Ligatures2")
+ {
+ m_cpass = 4;
+ m_cpassLB = 1;
+ m_ipassPos1 = 3;
+ m_fBidi = false;
+
+ m_prgppass = new GrPass*[m_cpass];
+ m_prgppass[0] = new GrGlyphGenPass(0);
+ m_prgppass[1] = new GrSubPass(1);
+ m_prgppass[2] = new GrSubPass(2);
+ m_prgppass[3] = new GrPosPass(3);
+
+ m_prgppass[0]->SetUpTestData();
+ m_prgppass[1]->SetUpLigature2Test();
+ m_prgppass[2]->SetUpLigature2Test();
+ m_prgppass[3]->SetUpTestData();
+ }
+ else
+ Assert(false);
+
+ m_engst.m_prgpsstrm = new GrSlotStream*[m_cpass];
+ for (int ipass = 0; ipass < m_cpass; ++ipass)
+ m_engst.m_prgpsstrm[ipass] = new GrSlotStream(ipass);
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Set the pass variables that normally will be read from the ECF.
+----------------------------------------------------------------------------------------------*/
+
+void GrPass::SetUpTestData()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 2;
+ m_nMaxRuleLoop = 2;
+}
+
+//void GrBidiPass::SetUpTestData()
+//{
+// m_nMaxRuleContext = m_nMaxChunk = 1;
+// m_nMaxRuleLoop = 2;
+//}
+
+/*----------------------------------------------------------------------------------------------
+ Call the appropriate test function.
+----------------------------------------------------------------------------------------------*/
+
+bool GrLineBreakPass::RunTestRules(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ if (m_staBehavior == "Reprocess")
+ return RunReprocessTest(ptman, psstrmInput, psstrmOutput);
+ else if (m_staBehavior == "CrossLineContext")
+ return RunCrossLineContextTest(ptman, psstrmInput, psstrmOutput);
+ else
+ return false;
+}
+
+bool GrSubPass::RunTestRules(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ if (m_staBehavior == "ReverseNumbers")
+ return RunReverseNumbersTest(ptman, psstrmInput, psstrmOutput);
+ else if (m_staBehavior == "CrossLineContext")
+ return RunCrossLineContextTest(ptman, psstrmInput, psstrmOutput);
+ else if (m_staBehavior == "Reprocess")
+ return RunReprocessTest(ptman, psstrmInput, psstrmOutput);
+ else if (m_staBehavior == "LineEdgeContext")
+ return RunLineEdgeContextTest(ptman, psstrmInput, psstrmOutput);
+ else if (m_staBehavior == "BidiAlgorithm")
+ return RunBidiAlgorithmTest(ptman, psstrmInput, psstrmOutput);
+ else if (m_staBehavior == "PseudoGlyphs")
+ return RunPseudoGlyphsTest(ptman, psstrmInput, psstrmOutput);
+ else if (m_staBehavior == "BidiNumbers")
+ return RunBidiNumbersTest(ptman, psstrmInput, psstrmOutput);
+ else
+ return false;
+}
+
+bool GrPosPass::RunTestRules(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ A substitution pass that causes numbers to be reversed. Used by both the JustReorder test
+ and the Reprocess test.
+----------------------------------------------------------------------------------------------*/
+
+void GrSubPass::SetUpReverseNumbersTest()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 1;
+ m_nMaxRuleLoop = 2;
+ m_staBehavior = "ReverseNumbers";
+}
+
+bool GrSubPass::RunReverseNumbersTest(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ data16 chw0;
+
+ // clsDigit { dir = DIR_RIGHT };
+ if (psstrmInput->SlotsPending() >= 1)
+ {
+ bool fRtl = ptman->RightToLeft();
+ chw0 = psstrmInput->Peek(0)->GlyphID();
+ if ((chw0 >= '0') && (chw0 <= '9'))
+ {
+ GrSlotState * pslot0 = psstrmInput->NextGet();
+// GrFeatureValues fval0;
+// pslot0->GetFeatureValues(&fval0);
+
+ GrSlotState * pslotNew;
+ ptman->NewSlotCopy(pslot0, m_ipass, &pslotNew);
+ pslotNew->SetDirectionality(fRtl ? kdircArabNum : kdircR);
+ pslotNew->Associate(pslot0);
+ psstrmOutput->NextPut(pslotNew);
+
+ return true;
+ }
+ else
+ {
+ GrSlotState * pslot0 = psstrmInput->NextGet();
+// GrFeatureValues fval0;
+// pslot0->GetFeatureValues(&fval0);
+
+ GrSlotState * pslotNew;
+ ptman->NewSlotCopy(pslot0, m_ipass, &pslotNew);
+ if (chw0 == 32)
+ pslotNew->SetDirectionality(kdircWhiteSpace);
+ else if (chw0 == '.')
+ pslotNew->SetDirectionality(kdircComSep);
+ else
+ pslotNew->SetDirectionality(fRtl ? kdircR : kdircL);
+ pslotNew->Associate(pslot0);
+ psstrmOutput->NextPut(pslotNew);
+
+ return true;
+ }
+ }
+ else
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ A substitution pass that will do some hard-coded actions resulting in cross-line-boundary
+ contextuals.
+----------------------------------------------------------------------------------------------*/
+void GrEngine::SetUpCrossLineContextTest()
+{
+ m_fLineBreak = true;
+ m_cchwPreXlbContext = 2;
+ m_cchwPostXlbContext = 0;
+}
+
+void GrLineBreakPass::SetUpCrossLineContextTest()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 1;
+ m_nMaxRuleLoop = 2;
+ m_staBehavior = "CrossLineContext";
+}
+
+void GrSubPass::SetUpCrossLineContextTest()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 3;
+ m_nMaxRuleLoop = 2;
+ m_staBehavior = "CrossLineContext";
+}
+
+bool GrLineBreakPass::RunCrossLineContextTest(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ // '=' { break = intra };
+ if ((psstrmInput->SlotsPending() >= 1) &&
+ (psstrmInput->Peek(0)->GlyphID() == 61))
+ {
+ GrSlotState * pslotNew0;
+ ptman->NewSlotCopy(psstrmInput->NextGet(), m_ipass, &pslotNew0);
+ pslotNew0->SetBreakWeight(int(klbHyphenBreak));
+ psstrmOutput->NextPut(pslotNew0);
+
+ psstrmOutput->SetPosForNextRule(0, psstrmInput, false);
+
+ return true;
+ }
+ else
+ return false;
+}
+
+bool GrSubPass::RunCrossLineContextTest(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ // any '=' _ _ > any '=' '=':2 any:1 / _ _ # _ _
+ if ((psstrmInput->SlotsPending() >= 3) &&
+ (psstrmInput->Peek(1)->GlyphID() == 61) &&
+ (psstrmInput->Peek(2)->GlyphID() == ptman->LBGlyphID()))
+ {
+ GrSlotState * pslot0 = psstrmInput->Peek(0);
+ GrSlotState * pslot1 = psstrmInput->Peek(1);
+ gid16 chw0 = pslot0->GlyphID();
+// GrFeatureValues fval0;
+// pslot0->GetFeatureValues(&fval0);
+// GrFeatureValues fval1;
+// pslot1->GetFeatureValues(&fval1);
+
+ // copy the first 3 slots
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+
+ // insert 2 more
+ GrSlotState * pslot3;
+ ptman->NewSlot(61, pslot1, NULL, m_ipass, &pslot3);
+ pslot3->Associate(pslot1);
+ psstrmOutput->NextPut(pslot3);
+
+ GrSlotState * pslot4;
+ ptman->NewSlot(chw0, pslot0, NULL, m_ipass, &pslot4);
+ pslot4->Associate(pslot0);
+ psstrmOutput->NextPut(pslot4);
+
+ return true;
+ }
+ else
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Line break and substitution passes that cause intra-pass reprocessing (ie, the ^ mechanism).
+----------------------------------------------------------------------------------------------*/
+
+void GrLineBreakPass::SetUpReprocessTest()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 2;
+ m_nMaxRuleLoop = 2;
+ m_staBehavior = "Reprocess";
+}
+
+bool GrLineBreakPass::RunReprocessTest(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ gid16 chw;
+
+ // '^' {lb=2} / _ lc
+ if ((psstrmInput->SlotsPending() >=2) &&
+ (psstrmInput->Peek(0)->GlyphID() == '^') &&
+ (((chw = psstrmInput->Peek(1)->GlyphID()) >= 'a') &&
+ (chw <= 'z')))
+ {
+ GrSlotState * pslotNew0;
+ ptman->NewSlotCopy(psstrmInput->NextGet(), m_ipass, &pslotNew0);
+ pslotNew0->SetBreakWeight(int(klbHyphenBreak));
+ psstrmOutput->NextPut(pslotNew0);
+
+ psstrmOutput->SetPosForNextRule(0, psstrmInput, false);
+
+ return true;
+ }
+ else
+ return false;
+}
+
+
+void GrSubPass::SetUpReprocessTest()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 3;
+ m_nMaxRuleLoop = 2;
+ m_staBehavior = "Reprocess";
+}
+
+bool GrSubPass::RunReprocessTest(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ gid16 chw;
+ gid16 chwLB = ptman->LBGlyphID();
+
+ // symbol > @2 {dir = DIR_ARABNUMBER} / any {dir != DIR_LEFT} ^ _
+ if ((psstrmInput->SlotsPending() >= 2) &&
+ (psstrmInput->Peek(0)->Directionality() != kdircL) &&
+ (((chw = psstrmInput->Peek(1)->GlyphID()) == '@') ||
+ (chw == '@') || (chw == '$') || (chw == '%') ||
+ (chw == '^') || (chw == '&') || (chw == '*')))
+ {
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+ GrSlotState * pslotNew1;
+ ptman->NewSlotCopy(psstrmInput->NextGet(), m_ipass, &pslotNew1);
+ pslotNew1->SetDirectionality(kdircArabNum);
+ psstrmOutput->NextPut(pslotNew1);
+
+ psstrmOutput->SetPosForNextRule(-1, psstrmInput, false);
+
+ return true;
+ }
+
+ // '^' lc > @1 uc
+ else if ((psstrmInput->SlotsPending() >= 2) &&
+ (psstrmInput->Peek(0)->GlyphID() == '^') &&
+ (((chw = psstrmInput->Peek(1)->GlyphID()) >= 'a') &&
+ (chw <= 'z')))
+ {
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+
+ gid16 chwNew = chw - 'a' + 'A';
+ GrSlotState * pslotNew1;
+ ptman->NewSlotCopy(psstrmInput->NextGet(), m_ipass, &pslotNew1);
+ pslotNew1->SetGlyphID(chwNew);
+ psstrmOutput->NextPut(pslotNew1);
+
+ psstrmOutput->SetPosForNextRule(0, psstrmInput, false);
+
+ return true;
+ }
+
+ // '^' lc > @1 uc / _ # _
+ else if ((psstrmInput->SlotsPending() >= 3) &&
+ (psstrmInput->Peek(0)->GlyphID() == '^') &&
+ (psstrmInput->Peek(1)->IsLineBreak(chwLB)) &&
+ (((chw = psstrmInput->Peek(2)->GlyphID()) >= 'a') &&
+ (chw <= 'z')))
+ {
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+
+ gid16 chwNew = chw - 'a' + 'A';
+ GrSlotState * pslotNew1;
+ ptman->NewSlotCopy(psstrmInput->NextGet(), m_ipass, &pslotNew1);
+ pslotNew1->SetGlyphID(chwNew);
+ psstrmOutput->NextPut(pslotNew1);
+
+ psstrmOutput->SetPosForNextRule(0, psstrmInput, false);
+
+ return true;
+ }
+
+ else
+ return false;
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Substitution passes that create contextual forms at the line breaks; also a cross-line-
+ boundary contextual.
+----------------------------------------------------------------------------------------------*/
+
+void GrSubPass::SetUpLineEdgeContextTest(int ipass)
+{
+ m_nMaxRuleContext = (ipass == 2)? 5: 2;
+ m_nMaxChunk = m_nMaxRuleContext;
+ m_nMaxRuleLoop = 2;
+ m_staBehavior = "LineEdgeContext";
+}
+
+bool GrSubPass::RunLineEdgeContextTest(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ gid16 chwLB = ptman->LBGlyphID();
+
+ // any _ _ > @1 '-' '-' / _ _ _ #
+ if ((m_ipass == 1) &&
+ (psstrmInput->SlotsPending() >= 2) &&
+ (psstrmInput->Peek(1)->IsLineBreak(chwLB)))
+ {
+ GrSlotState * pslot0 = psstrmInput->Peek(0);
+// GrFeatureValues fval;
+// pslot0->GetFeatureValues(&fval);
+
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+
+ GrSlotState * pslotNew1;
+ ptman->NewSlot('-', pslot0, NULL, m_ipass, &pslotNew1);
+ pslotNew1->Associate(pslot0);
+ psstrmOutput->NextPut(pslotNew1);
+
+ GrSlotState * pslotNew2;
+ ptman->NewSlot('-', pslot0, NULL, m_ipass, &pslotNew2);
+ pslotNew2->Associate(pslot0);
+ psstrmOutput->NextPut(pslotNew2);
+
+ return true;
+ }
+
+ // _ _ any > '+' '+' @4 / # _ _ _
+ else if ((m_ipass == 1) &&
+ (psstrmInput->SlotsPending() >= 2) &&
+ (psstrmInput->Peek(0)->IsLineBreak(chwLB)))
+ {
+ GrSlotState * pslot2 = psstrmInput->Peek(1);
+// GrFeatureValues fval;
+// pslot2->GetFeatureValues(&fval);
+
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+
+ GrSlotState * pslotNew0;
+ ptman->NewSlot('+', pslot2, NULL, m_ipass, &pslotNew0);
+ pslotNew0->Associate(pslot2);
+ psstrmOutput->NextPut(pslotNew0);
+
+ GrSlotState * pslotNew1;
+ ptman->NewSlot('+', pslot2, NULL, m_ipass, &pslotNew1);
+ pslotNew1->Associate(pslot2);
+ psstrmOutput->NextPut(pslotNew1);
+
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+
+ return true;
+ }
+
+ // '-' '-' '+' '+' > @1 _ _ @4 / _ _ # _ _
+ else if ((m_ipass == 2) &&
+ (psstrmInput->SlotsPending() >= 5) &&
+ (psstrmInput->Peek(0)->GlyphID() == '-') &&
+ (psstrmInput->Peek(1)->GlyphID() == '-') &&
+ (psstrmInput->Peek(2)->IsLineBreak(chwLB)) &&
+ (psstrmInput->Peek(3)->GlyphID() == '+') &&
+ (psstrmInput->Peek(4)->GlyphID() == '+'))
+ {
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+ psstrmInput->Skip(1);
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+ psstrmInput->Skip(1);
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+
+ return true;
+ }
+
+ else
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Substitution passes that do something special with pseudo glyphs.
+----------------------------------------------------------------------------------------------*/
+
+void GrSubPass::SetUpPseudoGlyphsTest()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 3;
+ m_nMaxRuleLoop = 2;
+ m_staBehavior = "PseudoGlyphs";
+}
+
+bool GrSubPass::RunPseudoGlyphsTest(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ gid16 chwLB = ptman->LBGlyphID();
+
+ // pseudo > uppercase / _ ' '
+ if ((psstrmInput->SlotsPending() >= 2) &&
+ (psstrmInput->Peek(0)->GlyphID() > 1000) && // pseudo
+ (psstrmInput->Peek(1)->GlyphID() == 32))
+ {
+ GrSlotState * pslot0 = psstrmInput->NextGet();
+// GrFeatureValues fval;
+// pslot0->GetFeatureValues(&fval);
+
+ GrSlotState * pslotNew;
+ ptman->NewSlotCopy(pslot0, m_ipass, &pslotNew);
+ pslotNew->SetGlyphID(pslot0->GlyphID() - 1000);
+ pslotNew->Associate(pslot0);
+ psstrmOutput->NextPut(pslotNew);
+
+ psstrmOutput->SetPosForNextRule(0, psstrmInput, false);
+
+ return true;
+ }
+
+ // pseudo > uppercase / _ |
+ // pseudo > uppercase / _ #
+ else if ((psstrmInput->SlotsPending() <= 2) &&
+ (psstrmInput->Peek(0)->GlyphID() > 1000) && // pseudo
+ (psstrmInput->SlotsPending() < 2 || psstrmInput->Peek(1)->GlyphID() == 35))
+ {
+ GrSlotState * pslot0 = psstrmInput->NextGet();
+// GrFeatureValues fval;
+// pslot0->GetFeatureValues(&fval);
+
+ GrSlotState * pslotNew;
+ ptman->NewSlotCopy(pslot0, m_ipass, &pslotNew);
+ pslotNew->SetGlyphID(pslot0->GlyphID() - 1000);
+ pslotNew->Associate(pslot0);
+ psstrmOutput->NextPut(pslotNew);
+
+ psstrmOutput->SetPosForNextRule(0, psstrmInput, false);
+
+ return true;
+ }
+
+ // pseudo any _ > lowercase:1 @2 @1 / _ _ ^ _;
+ else if ((psstrmInput->SlotsPending() >= 3) &&
+ (psstrmInput->Peek(0)->GlyphID() > 1000)) // pseudo
+ {
+ GrSlotState * pslot0 = psstrmInput->NextGet();
+// GrFeatureValues fval;
+// pslot0->GetFeatureValues(&fval);
+
+ GrSlotState * pslotNew0;
+ ptman->NewSlot(pslot0->GlyphID()-1000-65+97, pslot0, NULL, m_ipass, &pslotNew0);
+ pslotNew0->Associate(pslot0);
+ psstrmOutput->NextPut(pslotNew0);
+
+ psstrmOutput->CopyOneSlotFrom(psstrmInput);
+
+ GrSlotState * pslotNew2;
+ ptman->NewSlot(pslot0->GlyphID(), pslot0, NULL, m_ipass, &pslotNew2);
+ pslotNew2->Associate(pslot0);
+ psstrmOutput->NextPut(pslotNew2);
+
+ psstrmOutput->SetPosForNextRule(-1, psstrmInput, false);
+
+ return true;
+ }
+ else
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Substitution pass that tests reversing numbers.
+----------------------------------------------------------------------------------------------*/
+void GrSubPass::SetUpBidiNumbersTest()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 1;
+ m_nMaxRuleLoop = 2;
+ m_staBehavior = "BidiNumbers";
+}
+
+bool GrSubPass::RunBidiNumbersTest(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ gid16 chw0;
+
+ // clsDigit > clsDigit { dir = DIR_ARABNUMBER };
+ if ((psstrmInput->SlotsPending() >= 1) &&
+ (((chw0 = psstrmInput->Peek(0)->GlyphID()) >= '0' && chw0 <= '9') ||
+ (chw0 >= 'A' && chw0 <= 'Z') || (chw0 >= 'a' && chw0 <= 'z')))
+ {
+ GrSlotState * pslot0 = psstrmInput->NextGet();
+// GrFeatureValues fval0;
+// pslot0->GetFeatureValues(&fval0);
+
+ GrSlotState * pslotNew;
+ ptman->NewSlot(chw0, pslot0, NULL, m_ipass, &pslotNew);
+ if (chw0 >= '0' && chw0 <= '9')
+ pslotNew->SetDirectionality(kdircArabNum);
+ else // a-z and A-Z
+ pslotNew->SetDirectionality(kdircR);
+ pslotNew->Associate(pslot0);
+ psstrmOutput->NextPut(pslotNew);
+
+ return true;
+ }
+ else
+ return false;
+}
+
+void GrBidiPass::SetUpBidiNumbersTest()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 1;
+ m_nMaxRuleLoop = 2;
+ m_nTopDirection = 1;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Substitution pass that tests the bidi algorithm thoroughly.
+----------------------------------------------------------------------------------------------*/
+void GrSubPass::SetUpBidiAlgorithmTest()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 1;
+ m_nMaxRuleLoop = 2;
+ m_staBehavior = "BidiAlgorithm";
+}
+
+bool GrSubPass::RunBidiAlgorithmTest(GrTableManager * ptman,
+ GrSlotStream * psstrmInput, GrSlotStream * psstrmOutput)
+{
+ gid16 chw0;
+
+ if (psstrmInput->SlotsPending() >= 1)
+ {
+ chw0 = psstrmInput->Peek(0)->GlyphID();
+
+ DirCode dircNew;
+
+ if (chw0 >= '0' && chw0 <= '9')
+ dircNew = kdircEuroNum;
+ else if (chw0 >= 'a' && chw0 <= 'z')
+ dircNew = kdircL;
+ else if (chw0 >= 'A' && chw0 <= 'M')
+ dircNew = kdircR;
+ else if (chw0 >= 'N' && chw0 <= 'T')
+ dircNew = kdircRArab;
+ else if (chw0 >= 'U' && chw0 <= 'Z')
+ dircNew = kdircArabNum;
+ else if (chw0 == '$' || chw0 == '%')
+ dircNew = kdircEuroTerm;
+ else if (chw0 == '.' || chw0 == '*' || chw0 == '+')
+ dircNew = kdircEuroSep;
+ else if (chw0 == '@')
+ dircNew = kdircComSep;
+ else if (chw0 == '_' || chw0 == '=')
+ dircNew = kdircNeutral;
+ else if (chw0 == ':')
+ dircNew = kdircNSM;
+ else
+ return false;
+
+ GrSlotState * pslot0 = psstrmInput->NextGet();
+// GrFeatureValues fval0;
+// pslot0->GetFeatureValues(&fval0);
+
+ GrSlotState * pslotNew;
+ ptman->NewSlot(chw0, pslot0, NULL, m_ipass, &pslotNew);
+ pslotNew->SetDirectionality(dircNew);
+ pslotNew->Associate(pslot0);
+ psstrmOutput->NextPut(pslotNew);
+
+ return true;
+ }
+ else
+ return false;
+}
+
+void GrBidiPass::SetUpBidiAlgorithmTest()
+{
+ m_nMaxRuleContext = m_nMaxChunk = 1;
+ m_nMaxRuleLoop = 2;
+ m_nTopDirection = 0;
+}
+
+
+#endif // _DEBUG
+
+} // namespace gr
+
+#endif // OLD_TEST_STUFF
+
+//:End Ignore
diff --git a/Build/source/libs/graphite/src/segment/TransductionLog.cpp b/Build/source/libs/graphite/src/segment/TransductionLog.cpp
new file mode 100644
index 00000000000..73273ae3feb
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/TransductionLog.cpp
@@ -0,0 +1,2091 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2000 - 2008 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: TransductionLog.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Contains the functions for writing a log of the transduction process.
+----------------------------------------------------------------------------------------------*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <math.h>
+
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:End Ignore
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Methods
+//:>********************************************************************************************
+
+#define SP_PER_SLOT 7
+#define LEADING_SP 15
+#define MAX_SLOTS 128
+
+/*----------------------------------------------------------------------------------------------
+ Output a file showing a log of the transduction process and the resulting segment.
+----------------------------------------------------------------------------------------------*/
+//bool GrTableManager::WriteTransductionLog(GrCharStream * pchstrm, Segment * psegRet,
+// int cbPrevSegDat, byte * pbPrevSegDat, byte * pbNextSegDat, int * pcbNextSegDat)
+//{
+//#ifdef TRACING
+// std::string staFile;
+// if (!LogFileName(staFile))
+// return false;
+//
+// std::ofstream strmOut;
+// if (cbPrevSegDat > 0)
+// strmOut.open(staFile.c_str(), std::ios::app); // append
+// else
+// strmOut.open(staFile.c_str());
+// if (strmOut.fail())
+// return false;
+//
+// WriteXductnLog(strmOut, pchstrm, psegRet, cbPrevSegDat, pbPrevSegDat);
+//
+// strmOut.close();
+// return true;
+//#else
+// return false;
+//#endif // TRACING
+//}
+
+bool GrTableManager::WriteTransductionLog(std::ostream * pstrmLog,
+ GrCharStream * pchstrm, Segment * psegRet, int cbPrevSegDat, byte * pbPrevSegDat)
+{
+#ifdef TRACING
+ if (!pstrmLog)
+ return false;
+ std::ostream & strmOut = *pstrmLog;
+ WriteXductnLog(strmOut, pchstrm, psegRet, cbPrevSegDat, pbPrevSegDat);
+ return true;
+#else
+ return false;
+#endif // TRACING
+}
+
+/*----------------------------------------------------------------------------------------------
+ Append to the file, showing the surface/underlying mappings. This must be done after
+ figuring out all the associations.
+
+ Also write the final glyph positions, since they are now determined.
+----------------------------------------------------------------------------------------------*/
+//bool GrTableManager::WriteAssociationLog(GrCharStream * pchstrm, Segment * psegRet)
+//{
+//#ifdef TRACING
+// std::string staFile;
+// if (!LogFileName(staFile))
+// return false;
+//
+// std::ofstream strmOut;
+// strmOut.open(staFile.c_str(), std::ios::app); // append
+// if (strmOut.fail())
+// return false;
+//
+// LogFinalPositions(strmOut);
+//
+// strmOut << "\n\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n";
+//
+// psegRet->LogUnderlyingToSurface(this, strmOut, pchstrm);
+// psegRet->LogSurfaceToUnderlying(this, strmOut);
+//
+// strmOut << "\n\n=======================================================================\n\n";
+//
+// strmOut.close();
+// return true;
+//#else
+// return false;
+//#endif // TRACING
+//}
+
+
+bool GrTableManager::WriteAssociationLog(std::ostream * pstrmLog,
+ GrCharStream * pchstrm, Segment * psegRet)
+{
+#ifdef TRACING
+ if (!pstrmLog)
+ return false;
+
+ std::ostream & strmOut = *pstrmLog;
+
+ psegRet->LogUnderlyingToSurface(this, strmOut, pchstrm);
+ psegRet->LogSurfaceToUnderlying(this, strmOut);
+
+ strmOut << "\n\n=======================================================================\n\n";
+
+ return true;
+#else
+ return false;
+#endif // TRACING
+}
+
+#ifdef TRACING
+
+/*----------------------------------------------------------------------------------------------
+ Generate the name of the file where the log will be written. It goes in the directory
+ defined by either the TEMP or TMP environment variable.
+
+ TODO: remove
+----------------------------------------------------------------------------------------------*/
+//bool GrTableManager::LogFileName(std::string & staFile)
+//{
+// char * pchTmpEnv = getenv("TEMP");
+// if (pchTmpEnv == 0)
+// pchTmpEnv = getenv("TMP");
+// if (pchTmpEnv == 0)
+// return false;
+//
+// staFile.assign(pchTmpEnv);
+// if (staFile[staFile.size() - 1] != '\\')
+// staFile.append("\\");
+// staFile.append("gr_xductn.log");
+//
+// return true;
+//}
+
+/*----------------------------------------------------------------------------------------------
+ Output a file showing a log of the transduction process and the resulting segment.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::WriteXductnLog(std::ostream & strmOut,
+ GrCharStream * pchstrm, Segment * psegRet,
+ int cbPrevSegDat, byte * pbPrevSegDat)
+{
+ if (cbPrevSegDat == 0)
+ LogUnderlying(strmOut, pchstrm, 0);
+ else
+ {
+ Assert(*(pbPrevSegDat + 4) == 0); // skip offset for first pass
+ LogUnderlying(strmOut, pchstrm, *(pbPrevSegDat + 3));
+ }
+
+ LogPass1Input(strmOut);
+
+ for (int ipass = 1; ipass < m_cpass; ipass++)
+ {
+ if (cbPrevSegDat == 0)
+ LogPassOutput(strmOut, ipass, 0);
+ else
+ LogPassOutput(strmOut, ipass, *(pbPrevSegDat + 4 + ipass));
+ }
+
+ LogFinalPositions(strmOut);
+
+ strmOut << "\n\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n";
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write out a log of the underlying input.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogUnderlying(std::ostream & strmOut, GrCharStream * pchstrm,
+ int cchwBackup)
+{
+ strmOut << "UNDERLYING INPUT\n\n";
+
+ int rgnChars[MAX_SLOTS];
+ bool rgfNewRun[MAX_SLOTS];
+ std::fill_n(rgfNewRun, MAX_SLOTS, false);
+ GrFeatureValues rgfval[MAX_SLOTS];
+ int cchwMaxRawChars;
+
+ int cnUtf32 = pchstrm->GetLogData(this, rgnChars, rgfNewRun, rgfval,
+ cchwBackup, &cchwMaxRawChars);
+ cnUtf32 = min(cnUtf32, MAX_SLOTS);
+
+ int ichw;
+
+ // For UTF-8 and surrogate representation:
+ utf16 rgchwChars2[MAX_SLOTS];
+ utf16 rgchwChars3[MAX_SLOTS];
+ utf16 rgchwChars4[MAX_SLOTS];
+ utf16 rgchwChars5[MAX_SLOTS];
+ utf16 rgchwChars6[MAX_SLOTS];
+ int rgcchwRaw[MAX_SLOTS];
+
+ if (cchwMaxRawChars > 1)
+ {
+ cchwMaxRawChars = min(cchwMaxRawChars, 6); // max of 6 raw (UTF-8 or UTF-16) chars per slot
+ pchstrm->GetLogDataRaw(this, cnUtf32, cchwBackup, cchwMaxRawChars,
+ rgnChars, rgchwChars2, rgchwChars3, rgchwChars4, rgchwChars5, rgchwChars6,
+ rgcchwRaw);
+ }
+ else
+ {
+ for (ichw = 0; ichw < cnUtf32; ichw++)
+ {
+ rgcchwRaw[ichw] = 1;
+ rgchwChars2[ichw] = 0;
+ rgchwChars3[ichw] = 0;
+ rgchwChars4[ichw] = 0;
+ rgchwChars5[ichw] = 0;
+ rgchwChars6[ichw] = 0;
+ }
+ }
+
+ LogUnderlyingHeader(strmOut, pchstrm->Min(), (pchstrm->Min() + cnUtf32 - cchwBackup),
+ cchwBackup, rgcchwRaw);
+
+ // Text
+ strmOut << "Text: "; // 15 spaces
+ for (ichw = 0; ichw < cnUtf32; ichw++)
+ {
+ if (rgnChars[ichw] < 0x0100 && rgchwChars2[ichw] == 0) // ANSI
+ strmOut << (char)rgnChars[ichw] << " "; // 6 spaces
+ else if (rgnChars[ichw] == knLRM)
+ strmOut << "<LRM> ";
+ else if (rgnChars[ichw] == knRLM)
+ strmOut << "<RLM> ";
+ else if (rgnChars[ichw] == knLRO)
+ strmOut << "<LRO> ";
+ else if (rgnChars[ichw] == knRLO)
+ strmOut << "<RLO> ";
+ else if (rgnChars[ichw] == knLRE)
+ strmOut << "<LRE> ";
+ else if (rgnChars[ichw] == knRLE)
+ strmOut << "<RLE> ";
+ else if (rgnChars[ichw] == knPDF)
+ strmOut << "<PDF> ";
+ else
+ strmOut << " ";
+ }
+ strmOut << "\n";
+
+ // Unicode
+ strmOut << "Unicode: ";
+ for (ichw = 0; ichw < cnUtf32; ichw++)
+ LogHexInTable(strmOut, utf16(rgnChars[ichw]));
+ strmOut << "\n";
+ for (int icchRaw = 2; icchRaw <= cchwMaxRawChars; icchRaw++)
+ {
+ strmOut << " ";
+ for (ichw = 0; ichw < cnUtf32; ichw++)
+ {
+ utf16 chw;
+ switch (icchRaw)
+ {
+ case 2: chw = rgchwChars2[ichw]; break;
+ case 3: chw = rgchwChars3[ichw]; break;
+ case 4: chw = rgchwChars4[ichw]; break;
+ case 5: chw = rgchwChars5[ichw]; break;
+ case 6: chw = rgchwChars6[ichw]; break;
+ default: chw = 0;
+ }
+ if (chw == 0)
+ strmOut << " ";
+ else
+ LogHexInTable(strmOut, chw);
+ }
+ strmOut << "\n";
+ }
+
+ // Runs
+ strmOut << "Runs: ";
+ int crun = 0;
+ for (ichw = 0; ichw < cnUtf32; ichw++)
+ {
+ if (rgfNewRun[ichw])
+ {
+ crun++;
+ strmOut << "|" << crun << ((crun < 10) ? " " : " ");
+ }
+ else
+ strmOut << " ";
+ }
+ strmOut << "\n";
+
+ // Features
+ strmOut << "Features and character properties:\n";
+ crun = 0;
+ for (ichw = 0; ichw < cnUtf32; ichw++)
+ {
+ if (rgfNewRun[ichw])
+ {
+ crun++;
+ strmOut << " Run " << crun << ": ";
+ rgfval[ichw].WriteXductnLog(this, strmOut);
+
+ }
+ }
+}
+
+
+void GrFeatureValues::WriteXductnLog(GrTableManager * ptman, std::ostream & strmOut)
+{
+ bool fFirst = true;
+ for (int i = 0; i < kMaxFeatures; i++)
+ {
+ if (m_rgnFValues[i] != 0)
+ {
+ GrFeature * pfeat = ptman->Feature(i);
+ if (!fFirst)
+ strmOut << ",";
+ strmOut << pfeat->ID() << "=" << m_rgnFValues[i];
+ fFirst = false;
+ }
+ }
+ if (fFirst)
+ strmOut << "all features=0";
+
+ strmOut << "\n\n";
+}
+
+/*----------------------------------------------------------------------------------------------
+ Loop through the input stream of underlying characters, storing information in the
+ arrays for the log.
+ ENHANCE SharonC: do we need to show the underline properties?
+----------------------------------------------------------------------------------------------*/
+int GrCharStream::GetLogData(GrTableManager * ptman, int * rgchl, bool * rgfNewRun,
+ GrFeatureValues * rgfval, int cchrBackup, int * pcchrMax)
+{
+ Assert(cchrBackup <= m_cchrBackedUp);
+
+ int ichrPosToStop = m_ichrPos;
+ int ichrStart = m_ichrMin - max(cchrBackup, m_cchrBackedUp);
+
+ *pcchrMax = 0;
+
+ // Restart the stream.
+ m_ichrPos = ichrStart;
+ m_ichrRunMin = 0;
+ m_ichrRunLim = 0;
+ m_ichrRunOffset = kPosInfinity;
+ m_vislotNextChunkMap.clear();
+
+ int cchrSkipBackup = m_cchrBackedUp - cchrBackup;
+
+ int c = 0;
+ int cchr = 0;
+
+ while (m_ichrPos < ichrPosToStop)
+ {
+ if ((c < MAX_SLOTS) && (m_ichrPos >= m_ichrRunLim))
+ {
+ rgfNewRun[c] = true;
+ }
+
+ GrFeatureValues fval;
+ int ichrOffset, cchrThis;
+ int chl = NextGet(ptman, &fval, &ichrOffset, &cchrThis);
+ cchr += cchrThis;
+ if (cchr <= cchrSkipBackup)
+ {} // ignore - this is before the pre-segment stuff that we want to skip
+ else if (c < MAX_SLOTS)
+ {
+ rgchl[c] = chl;
+ *pcchrMax = max(*pcchrMax, cchrThis);
+ if (rgfNewRun[c])
+ {
+ rgfval[c] = fval;
+ }
+ c++;
+ }
+ }
+
+ ////return (m_ichwPos - (m_ichwMin - cchwBackup));
+ return c;
+}
+
+/*----------------------------------------------------------------------------------------------
+ If any of the characters are comprised of surrogates or UTF-8, fill in the arrays with
+ the raw (UTF-16 or UTF-8) chars for display. To do this we get the raw characters
+ directly from the text source.
+----------------------------------------------------------------------------------------------*/
+void GrCharStream::GetLogDataRaw(GrTableManager * ptman, int cchl, int cchrBackup,
+ int cchrMaxRaw, int * prgchl,
+ utf16 * prgchw2, utf16 * prgchw3, utf16 * prgchw4, utf16 * prgchw5, utf16 * prgchw6,
+ int * prgcchr)
+{
+ for (int i = 0; i < cchl; i++)
+ {
+ prgchw2[i] = 0;
+ }
+
+ int ichrLim = m_ichrPos;
+ int ichrMin = m_ichrMin - cchrBackup;
+
+ int cchrRange = ichrLim - ichrMin;
+ int ichr;
+ utf16 * prgchwRunText = new utf16[cchrRange];
+ utf8 * prgchsRunText8 = NULL;
+
+ UtfType utf = m_pgts->utfEncodingForm();
+
+ switch (utf)
+ {
+ case kutf8:
+ prgchsRunText8 = new utf8[cchrRange];
+ m_pgts->fetch(ichrMin, cchrRange, prgchsRunText8);
+ for (int ichr = 0; ichr < cchrRange; ichr++)
+ prgchwRunText[ichr] = (utf16)prgchsRunText8[ichr]; // zero-extend into UTF-16 buffer
+ break;
+ case kutf16:
+ m_pgts->fetch(ichrMin, cchrRange, prgchwRunText);
+ break;
+ default:
+ case kutf32: // this method should never have been called
+ Assert(false);
+ for (int ichrLp = 0; ichrLp < cchrRange; ichrLp++)
+ {
+ prgcchr[ichrLp] = 1;
+ prgchw2[ichrLp] = 0;
+ prgchw3[ichrLp] = 0;
+ prgchw4[ichrLp] = 0;
+ prgchw5[ichrLp] = 0;
+ prgchw6[ichrLp] = 0;
+ }
+ return;
+ }
+
+ ichr = ichrMin;
+ int ichl = 0;
+ while (ichr < ichrLim)
+ {
+ int cchrThis = 1;
+ // Replace 32-bit char with (first) 16-bit or 8-bit char.
+ prgchl[ichl] = (int)prgchwRunText[ichr - ichrMin];
+ prgcchr[ichr] = cchrThis;
+ ichr++;
+
+ while (!AtUnicodeCharBoundary(prgchwRunText, cchrRange, ichr - ichrMin, utf))
+ {
+ cchrThis++;
+ switch (cchrThis)
+ {
+ case 2: prgchw2[ichl] = prgchwRunText[ichr - ichrMin]; break;
+ case 3: prgchw3[ichl] = prgchwRunText[ichr - ichrMin]; break;
+ case 4: prgchw4[ichl] = prgchwRunText[ichr - ichrMin]; break;
+ case 5: prgchw5[ichl] = prgchwRunText[ichr - ichrMin]; break;
+ case 6: prgchw6[ichl] = prgchwRunText[ichr - ichrMin]; break;
+ default:
+ break;
+ }
+ prgcchr[ichr] = cchrThis;
+ ichr++;
+ }
+ switch (cchrThis)
+ {
+ case 1:
+ prgchw2[ichl] = 0;
+ // fall through
+ case 2:
+ prgchw3[ichl] = 0;
+ // fall through
+ case 3:
+ prgchw4[ichl] = 0;
+ // fall through
+ case 4:
+ prgchw5[ichl] = 0;
+ // fall through
+ case 5:
+ prgchw6[ichl] = 0;
+ }
+ ichl++;
+ }
+
+ delete[] prgchwRunText;
+ delete[] prgchsRunText8;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Output the glyph IDs generated by the glyph generation pass (pass 0).
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogPass1Input(std::ostream & strmOut)
+{
+ strmOut << "INPUT TO PASS 1\n\n";
+
+ GrSlotStream * psstrm = OutputStream(0);
+
+ LogSlotHeader(strmOut, psstrm->WritePos(), SP_PER_SLOT, LEADING_SP);
+
+ LogSlotGlyphs(strmOut, psstrm);
+
+ strmOut << "\n";
+}
+
+/*----------------------------------------------------------------------------------------------
+ Output the the results of pass.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogPassOutput(std::ostream & strmOut, int ipass, int cslotSkipped)
+{
+ strmOut << "\n";
+
+ GrPass * ppass = Pass(ipass);
+ GrSlotStream * psstrmIn = InputStream(ipass);
+ GrSlotStream * psstrmOut = OutputStream(ipass);
+
+ int islot;
+ // Mark each slot with its index in the input and output streams.
+ for (islot = 0; islot < psstrmIn->ReadPos(); islot++)
+ psstrmIn->SlotAt(islot)->m_islotTmpIn = islot;
+
+ for (islot = 0; islot < psstrmOut->WritePos(); islot++)
+ psstrmOut->SlotAt(islot)->m_islotTmpOut = islot;
+
+ if (!dynamic_cast<GrBidiPass *>(ppass))
+ ppass->LogRulesFiredAndFailed(strmOut, psstrmIn);
+
+ strmOut << "\nOUTPUT OF PASS " << ipass;
+ if (dynamic_cast<GrBidiPass *>(ppass))
+ strmOut << " (bidi)";
+ else if (dynamic_cast<GrSubPass *>(ppass))
+ {
+ if (ipass >= m_ipassJust1)
+ strmOut << " (justification)";
+ else
+ strmOut << " (substitution)";
+ }
+ else if (dynamic_cast<GrPosPass *>(ppass))
+ strmOut << " (positioning)";
+ else if (dynamic_cast<GrLineBreakPass *>(ppass))
+ strmOut << " (linebreak)";
+ strmOut << "\n";
+
+ ppass->LogInsertionsAndDeletions(strmOut, psstrmOut);
+
+ LogSlotHeader(strmOut, psstrmOut->WritePos(), SP_PER_SLOT, LEADING_SP);
+
+ LogSlotGlyphs(strmOut, psstrmOut);
+
+ bool fAnyPseudos = false;
+ if (dynamic_cast<GrPosPass *>(ppass))
+ {
+ for (islot = 0; islot < psstrmOut->WritePos(); islot++)
+ {
+ GrSlotState * pslotTmp = psstrmOut->SlotAt(islot);
+ if (pslotTmp->GlyphID() != pslotTmp->ActualGlyphForOutput(this))
+ {
+ fAnyPseudos = true;
+ break;
+ }
+ }
+ }
+ if (fAnyPseudos)
+ {
+ strmOut << "Actual glyphs: ";
+ for (islot = 0; islot < psstrmOut->WritePos(); islot++)
+ {
+ GrSlotState * pslotTmp = psstrmOut->SlotAt(islot);
+ if (pslotTmp->GlyphID() != pslotTmp->ActualGlyphForOutput(this))
+ LogHexInTable(strmOut, pslotTmp->ActualGlyphForOutput(this));
+ else
+ strmOut << " ";
+ }
+ strmOut << "\n";
+ }
+
+ LogAttributes(strmOut, ipass);
+
+ // Do this later, after we're sure the positions have been set:
+ //if (ipass == m_cpass - 1)
+ // LogFinalPositions(strmOut);
+
+ if (cslotSkipped > 0)
+ {
+ strmOut << "\n ";
+ for (islot = 0; islot < cslotSkipped; islot++)
+ strmOut << "SKIP ";
+ strmOut << "\n";
+ }
+
+ // If this was the pass just before the justification routines get run, output a
+ // special line that just shows the results, ie, the values of justify.width.
+ // TODO: adjust this when measure mode get functioning.
+ if (ipass == m_ipassJust1 - 1 && ShouldLogJustification()
+ && m_engst.m_jmodi == kjmodiJustify)
+ {
+ strmOut << "\nJUSTIFICATION\n\n";
+ LogSlotHeader(strmOut, psstrmOut->WritePos(), SP_PER_SLOT, LEADING_SP);
+ LogSlotGlyphs(strmOut, psstrmOut);
+ LogAttributes(strmOut, ipass, true);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write the list of rules fired and failed for a given pass.
+----------------------------------------------------------------------------------------------*/
+void GrPass::LogRulesFiredAndFailed(std::ostream & strmOut, GrSlotStream * psstrmIn)
+{
+ m_pzpst->LogRulesFiredAndFailed(strmOut, psstrmIn);
+}
+
+void PassState::LogRulesFiredAndFailed(std::ostream & strmOut, GrSlotStream * psstrmIn)
+{
+
+ strmOut << "PASS " << m_ipass << "\n\n" << "Rules matched: ";
+ if (m_crulrec == 0)
+ strmOut << "none";
+ strmOut << "\n";
+
+ for (int irulrec = 0; irulrec < m_crulrec; irulrec++)
+ {
+ if (m_rgrulrec[irulrec].m_fFired)
+ strmOut << " * ";
+ else
+ strmOut << " ";
+
+ strmOut << m_rgrulrec[irulrec].m_islot << ". ";
+
+ if (m_rgrulrec[irulrec].m_irul == PassState::kHitMaxRuleLoop)
+ strmOut << "hit MaxRuleLoop\n";
+ else if (m_rgrulrec[irulrec].m_irul == PassState::kHitMaxBackup)
+ strmOut << "hit MaxBackup\n";
+ else
+ {
+ strmOut << "rule " << m_ipass << "." << m_rgrulrec[irulrec].m_irul;
+
+ if (m_rgrulrec[irulrec].m_fFired)
+ strmOut << " FIRED\n";
+ else
+ strmOut << " failed\n";
+ }
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write out the marks on top of the slot table indicating insertions and deletions.
+----------------------------------------------------------------------------------------------*/
+void GrPass::LogInsertionsAndDeletions(std::ostream & strmOut, GrSlotStream * psstrmOut)
+{
+ m_pzpst->LogInsertionsAndDeletions(strmOut, psstrmOut);
+}
+
+void PassState::LogInsertionsAndDeletions(std::ostream & strmOut, GrSlotStream * psstrmOut)
+{
+ int cslotDel = m_rgcslotDeletions[0];
+ bool fIns;
+ if (cslotDel > 1)
+ strmOut << "\n DEL-" << cslotDel;
+ else if (cslotDel == 1)
+ strmOut << "\n DEL ";
+ else
+ strmOut << "\n ";
+
+ for (int islot = 0; islot < psstrmOut->WritePos(); islot++)
+ {
+ cslotDel = (islot + 1 >= MAX_SLOTS) ? 0 : m_rgcslotDeletions[islot + 1];
+ fIns = (islot >= MAX_SLOTS) ? 0 : m_rgfInsertion[islot];
+
+ if (fIns)
+ {
+ strmOut << "INS";
+ if (cslotDel > 0)
+ {
+ if (cslotDel > 1)
+ strmOut << "/D-" << cslotDel;
+ else
+ strmOut << "/DEL";
+ }
+ else
+ strmOut << " ";
+
+ }
+ else if (cslotDel > 0)
+ {
+ if (cslotDel >= 10)
+ strmOut << "DEL-" << cslotDel << " ";
+ else if (cslotDel > 1)
+ strmOut << " DEL-" << cslotDel << " ";
+ else
+ strmOut << " DEL ";
+ }
+ else
+ strmOut << " ";
+ }
+
+ strmOut << "\n";
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write out a line for each slot attribute that changed during the pass.
+
+ @param fJustWidths - a special pass that writes out just the effects of the justification
+ routines, ie, the values of justify.width
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogAttributes(std::ostream & strmOut, int ipass,
+ bool fJustWidths)
+{
+ // Figure out which slot attributes were modified for some slot during the pass.
+ bool * prgfMods = new bool[kslatMax + NumUserDefn() - 1];
+
+ bool fPreJust = (!fJustWidths && ipass == m_ipassJust1 - 1 && ShouldLogJustification());
+ bool fPostJust = ((fJustWidths || ipass == m_ipassJust1) && ShouldLogJustification());
+
+ int ccomp; // max number of components per slot
+ int cassoc; // max number of associations per slot
+ SlotAttrsModified(ipass, prgfMods, fPreJust, &ccomp, &cassoc);
+
+ if (fPreJust)
+ {
+ // prgfMods[kslatJStretch] = true;
+ // prgfMods[kslatJShrink] = true;
+ // prgfMods[kslatJStep] = true;
+ // prgfMods[kslatWeight] = true;
+ prgfMods[kslatJWidth] = false; // output j.width in its own line (we call this
+ // method with fJustWidths == true)
+ }
+ else if (fPostJust)
+ prgfMods[kslatJWidth] = true;
+
+ GrPass * ppass = Pass(ipass);
+ GrPass * ppassNext = (ipass < m_cpass - 1) ? Pass(ipass + 1) : NULL;
+ GrSlotStream * psstrm = OutputStream(ipass);
+
+ if (fJustWidths)
+ {}
+ else if (dynamic_cast<GrBidiPass *>(ppass))
+ {
+ // Special stuff for Bidi pass:
+ // Log value of directionality attribute.
+ strmOut << "directionality ";
+ int islot;
+ for (islot = 0; islot < psstrm->WritePos(); islot++)
+ {
+ GrSlotState * pslot = psstrm->SlotAt(islot);
+ LogDirCodeInTable(strmOut, pslot->DirProcessed());
+ }
+ strmOut << "\n";
+
+ // Log final direction level for bidi pass.
+ strmOut << "dir level ";
+ for (islot = 0; islot < psstrm->WritePos(); islot++)
+ {
+ GrSlotState * pslot = psstrm->SlotAt(islot);
+ LogInTable(strmOut, pslot->DirLevel());
+ }
+ strmOut << "\n";
+ }
+ else if (ppassNext && dynamic_cast<GrBidiPass *>(ppassNext))
+ {
+ // Next pass is Bidi: log input values of directionality attribute that are input for it.
+ strmOut << "directionality ";
+ for (int islot = 0; islot < psstrm->WritePos(); islot++)
+ {
+ GrSlotState * pslot = psstrm->SlotAt(islot);
+ LogDirCodeInTable(strmOut, pslot->Directionality());
+ }
+ strmOut << "\n";
+ }
+
+ for (int slat = 0; slat < kslatMax + NumUserDefn() - 1; slat++)
+ {
+ int cIndexLim = 1;
+ if (slat == kslatCompRef)
+ cIndexLim = ccomp;
+ else if (slat == kslatUserDefn)
+ cIndexLim = 1; // kMaxUserDefinedSlotAttributes;
+
+ if (fJustWidths && slat != kslatJWidth)
+ continue;
+
+ bool fValidAttr = true;
+ for (int iIndex = 0; iIndex < cIndexLim; iIndex++)
+ {
+ if (prgfMods[slat])
+ {
+ switch(slat)
+ {
+ case kslatAdvX: strmOut << "advance.x "; break;
+ case kslatAdvY: strmOut << "advance.y "; break;
+ case kslatAttTo: strmOut << "att.to "; break;
+ case kslatAttAtX: strmOut << "att.at.x "; break;
+ case kslatAttAtY: strmOut << "att.at.y "; break;
+ case kslatAttAtGpt: strmOut << "att.at.gpt "; break;
+ case kslatAttAtXoff: strmOut << "att.at.xoff "; break;
+ case kslatAttAtYoff: strmOut << "att.at.yoff "; break;
+ case kslatAttWithX: strmOut << "att.with.x "; break;
+ case kslatAttWithY: strmOut << "att.with.y "; break;
+ case kslatAttWithGpt: strmOut << "att.with.gpt "; break;
+ case kslatAttWithXoff: strmOut << "att.with.xoff "; break;
+ case kslatAttWithYoff: strmOut << "att.with.yoff "; break;
+ case kslatAttLevel: strmOut << "att.level "; break;
+ case kslatBreak: strmOut << "breakweight "; break;
+ case kslatCompRef: strmOut << "component " << iIndex + 1 // 1-based
+ << " "; break;
+ case kslatDir: strmOut << "dir "; break;
+ case kslatInsert: strmOut << "insert "; break;
+ case kslatMeasureSol: strmOut << "measure.sol "; break;
+ case kslatMeasureEol: strmOut << "measure.eol "; break;
+ case kslatJStretch: strmOut << "j.stretch "; break;
+ case kslatJShrink: strmOut << "j.shrink "; break;
+ case kslatJStep: strmOut << "j.step "; break;
+ case kslatJWeight: strmOut << "j.weight "; break;
+ case kslatJWidth: strmOut << "j.width "; break;
+ case kslatPosX:
+ case kslatPosY:
+ Assert(false);
+ break;
+ case kslatShiftX: strmOut << "shift.x "; break;
+ case kslatShiftY: strmOut << "shift.y "; break;
+ default:
+ if (kslatUserDefn <= slat &&
+ slat < kslatUserDefn + NumUserDefn())
+ {
+ strmOut << "user" << (slat - kslatUserDefn + 1) // 1-based
+ << ((iIndex >= 9) ? " " : " ");
+ }
+ else
+ {
+ // Invalid attribute:
+ Warn("bad slot attribute");
+ fValidAttr = false;
+ break;
+ }
+ }
+
+ if (!fValidAttr)
+ break; // out of iIndex loop
+
+ for (int islot = 0; islot < psstrm->WritePos(); islot++)
+ {
+ GrSlotState * pslot = psstrm->SlotAt(islot);
+ pslot->LogSlotAttributeValue(this, strmOut, ipass, slat, iIndex,
+ fPreJust, fPostJust);
+ }
+
+ strmOut << "\n";
+ }
+ }
+ }
+
+ if (fJustWidths)
+ goto LDone;
+
+ for (int iassoc = 0; iassoc < cassoc; iassoc++)
+ {
+ // Log associations. Put them on one line it that will work; otherwise use several.
+ bool fBoth = (cassoc <= 2);
+ bool fAfter = (iassoc == (cassoc - 1));
+ if (fBoth)
+ strmOut << "assocs ";
+ else if (iassoc == 0)
+ strmOut << "assocs-before ";
+ else if (fAfter)
+ strmOut << " -after ";
+ else
+ strmOut << " -other ";
+
+ for (int islot = 0; islot < psstrm->WritePos(); islot++)
+ {
+ GrSlotState * pslot = psstrm->SlotAt(islot);
+ pslot->LogAssociation(this, strmOut, ipass, iassoc, fBoth, fAfter);
+ }
+
+ strmOut << "\n";
+
+ if (fBoth)
+ break;
+ }
+
+ if (cassoc == 0 && dynamic_cast<GrBidiPass *>(ppass))
+ {
+ strmOut << "assocs ";
+
+ // Log associations for all slots moved during the Bidi pass.
+ for (int islot = 0; islot < psstrm->WritePos(); islot++)
+ {
+ GrSlotState * pslot = psstrm->SlotAt(islot);
+ if (pslot->m_islotTmpIn != pslot->m_islotTmpOut)
+ LogInTable(strmOut, pslot->m_islotTmpIn);
+ else
+ strmOut << " ";
+ }
+
+ strmOut << "\n";
+ }
+
+LDone:
+
+ delete[] prgfMods;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write out the final positions.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogFinalPositions(std::ostream & strmOut)
+{
+ GrSlotStream * psstrm = OutputStream(m_cpass - 1);
+
+ strmOut << "x position ";
+ for (int islot = 0; islot < psstrm->WritePos(); islot++)
+ {
+ GrSlotState * pslot = psstrm->SlotAt(islot);
+ if (pslot->IsLineBreak(LBGlyphID()))
+ {
+ strmOut << " ";
+ continue;
+ }
+ LogInTable(strmOut, pslot->XPosition());
+ }
+ strmOut << "\n";
+
+ strmOut << "y position ";
+ for (int islot = 0; islot < psstrm->WritePos(); islot++)
+ {
+ GrSlotState * pslot = psstrm->SlotAt(islot);
+ if (pslot->IsLineBreak(LBGlyphID()))
+ {
+ strmOut << " ";
+ continue;
+ }
+ LogInTable(strmOut, pslot->YPosition());
+ }
+ strmOut << "\n";
+}
+#endif // TRACING
+
+/*----------------------------------------------------------------------------------------------
+ Write out the final underlying-to-surface associations.
+----------------------------------------------------------------------------------------------*/
+void Segment::LogUnderlyingToSurface(GrTableManager * ptman, std::ostream & strmOut,
+ GrCharStream * pchstrm)
+{
+#ifdef TRACING
+ strmOut << "\n\nUNDERLYING TO SURFACE MAPPINGS\n\n";
+
+ size_t cassocs = 0;
+ int fLigs = false;
+ int ichw;
+ for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ if (m_prgpvisloutAssocs[ichw])
+ cassocs = max(cassocs, m_prgpvisloutAssocs[ichw]->size());
+ if (m_prgisloutLigature[ichw] != kNegInfinity)
+ fLigs = true;
+ }
+
+// ptman->LogSlotHeader(strmOut, m_ichwAssocsLim, SP_PER_SLOT, LEADING_SP, m_ichwAssocsMin);
+ ptman->LogUnderlyingHeader(strmOut, pchstrm->Min(), (pchstrm->Min() + m_ichwAssocsLim),
+ -m_ichwAssocsMin, NULL);
+
+ int rgnChars[MAX_SLOTS];
+ bool rgfNewRun[MAX_SLOTS];
+ std::fill_n(rgfNewRun, MAX_SLOTS, false);
+ GrFeatureValues rgfval[MAX_SLOTS];
+ int cchwMaxRawChars;
+
+ int cchw = pchstrm->GetLogData(ptman, rgnChars, rgfNewRun, rgfval,
+ -m_ichwAssocsMin, &cchwMaxRawChars);
+ cchw = min(cchw, MAX_SLOTS);
+
+ utf16 rgchwChars2[MAX_SLOTS];
+ utf16 rgchwChars3[MAX_SLOTS];
+ utf16 rgchwChars4[MAX_SLOTS];
+ utf16 rgchwChars5[MAX_SLOTS];
+ utf16 rgchwChars6[MAX_SLOTS];
+ int rgcchwRaw[MAX_SLOTS];
+ if (cchwMaxRawChars > 1)
+ {
+ cchwMaxRawChars = min(cchwMaxRawChars, 6);
+ pchstrm->GetLogDataRaw(ptman, cchw, -m_ichwAssocsMin, cchwMaxRawChars,
+ rgnChars, rgchwChars2, rgchwChars3, rgchwChars4, rgchwChars5, rgchwChars6,
+ rgcchwRaw);
+ }
+ else
+ {
+ for (ichw = 0 ; ichw <(m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ rgcchwRaw[ichw] = 1;
+ rgchwChars2[ichw] = 0;
+ rgchwChars3[ichw] = 0;
+ rgchwChars4[ichw] = 0;
+ rgchwChars5[ichw] = 0;
+ rgchwChars6[ichw] = 0;
+ }
+ }
+
+ // Text
+ strmOut << "Text: "; // 15 spaces
+ int inUtf32 = 0;
+ for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ utf16 chw, chwNext;
+ switch (rgcchwRaw[ichw])
+ {
+ default:
+ case 1: chw = utf16(rgnChars[inUtf32]); chwNext = rgchwChars2[inUtf32]; break;
+ case 2: chw = rgchwChars2[inUtf32]; chwNext = rgchwChars3[inUtf32]; break;
+ case 3: chw = rgchwChars3[inUtf32]; chwNext = rgchwChars4[inUtf32]; break;
+ case 4: chw = rgchwChars4[inUtf32]; chwNext = rgchwChars5[inUtf32]; break;
+ case 5: chw = rgchwChars5[inUtf32]; chwNext = rgchwChars6[inUtf32]; break;
+ case 6: chw = rgchwChars6[inUtf32]; chwNext = 0; break;
+ }
+ if (rgcchwRaw[ichw] == 1 && chwNext == 0 && chw < 0x0100) // ANSI
+ strmOut << (char)chw << " "; // 6 spaces
+ else
+ strmOut << " "; // 7 spaces
+ if (chwNext == 0)
+ inUtf32++;
+ }
+ strmOut << "\n";
+
+ // Unicode
+ strmOut << "Unicode: ";
+ inUtf32 = 0;
+ for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ utf16 chw, chwNext;
+ switch (rgcchwRaw[ichw])
+ {
+ default:
+ case 1: chw = utf16(rgnChars[inUtf32]); chwNext = rgchwChars2[inUtf32]; break;
+ case 2: chw = rgchwChars2[inUtf32]; chwNext = rgchwChars3[inUtf32]; break;
+ case 3: chw = rgchwChars3[inUtf32]; chwNext = rgchwChars4[inUtf32]; break;
+ case 4: chw = rgchwChars4[inUtf32]; chwNext = rgchwChars5[inUtf32]; break;
+ case 5: chw = rgchwChars5[inUtf32]; chwNext = rgchwChars6[inUtf32]; break;
+ case 6: chw = rgchwChars6[inUtf32]; chwNext = 0; break;
+ }
+ ptman->LogHexInTable(strmOut, chw, chwNext != 0);
+ if (chwNext == 0)
+ inUtf32++;
+ }
+ strmOut << "\n";
+
+ strmOut << "before ";
+ for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ if (rgcchwRaw[ichw] > 1)
+ // continuation of Unicode codepoint
+ strmOut << " ";
+ else if (m_prgisloutBefore[ichw] == kNegInfinity)
+ strmOut << "<-- ";
+ else if (m_prgisloutBefore[ichw] == kPosInfinity)
+ strmOut << "--> ";
+ else
+ ptman->LogInTable(strmOut, m_prgisloutBefore[ichw]);
+ }
+ strmOut <<"\n";
+
+ for (int ix = 1; ix < signed(cassocs) - 1; ix++) //(cassocs > 2)
+ {
+ if (ix == 1)
+ strmOut << "other ";
+ else
+ strmOut << " ";
+ for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ std::vector<int> * pvislout = m_prgpvisloutAssocs[ichw];
+ if (pvislout == NULL)
+ strmOut << " ";
+ else if (signed(pvislout->size()) <= ix)
+ strmOut << " ";
+ else if ((*pvislout)[ix] != m_prgisloutAfter[ichw])
+ ptman->LogInTable(strmOut, (*pvislout)[ix]);
+ else
+ strmOut << " ";
+ }
+ strmOut << "\n";
+ }
+
+ strmOut << "after ";
+ for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ if (rgcchwRaw[ichw] > 1)
+ // continuation of Unicode codepoint
+ strmOut << " ";
+ else if (m_prgisloutAfter[ichw] == kNegInfinity)
+ strmOut << "<-- ";
+ else if (m_prgisloutAfter[ichw] == kPosInfinity)
+ strmOut << "--> ";
+ else
+ ptman->LogInTable(strmOut, m_prgisloutAfter[ichw]);
+ }
+ strmOut <<"\n";
+
+ if (fLigs)
+ {
+ strmOut << "ligature ";
+ for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ if (rgcchwRaw[ichw] > 1)
+ // continuation of Unicode codepoint
+ strmOut << " ";
+ else if (m_prgisloutLigature[ichw] != kNegInfinity)
+ ptman->LogInTable(strmOut, m_prgisloutLigature[ichw]);
+ else
+ strmOut << " ";
+ }
+ strmOut << "\n";
+
+ strmOut << "component ";
+ for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ if (rgcchwRaw[ichw] > 1)
+ // continuation of Unicode codepoint
+ strmOut << " ";
+ else if (m_prgisloutLigature[ichw] != kNegInfinity)
+ ptman->LogInTable(strmOut, m_prgiComponent[ichw] + 1); // 1-based
+ else
+ strmOut << " ";
+ }
+ strmOut << "\n";
+ }
+
+ strmOut << "\n";
+#endif
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write out the final surface-to-underlying associations.
+----------------------------------------------------------------------------------------------*/
+void Segment::LogSurfaceToUnderlying(GrTableManager * ptman, std::ostream & strmOut)
+{
+#ifdef TRACING
+ strmOut << "\nSURFACE TO UNDERLYING MAPPINGS\n\n";
+
+ ptman->LogSlotHeader(strmOut, m_cslout, SP_PER_SLOT, LEADING_SP);
+
+ int ccomp = 0;
+
+ strmOut << "Glyph IDs: ";
+ int islout;
+ for (islout = 0; islout < m_cslout; islout++)
+ {
+ GrSlotOutput * psloutTmp = m_prgslout + islout;
+ if (psloutTmp->SpecialSlotFlag() == kspslLbInitial ||
+ psloutTmp->SpecialSlotFlag() == kspslLbFinal)
+ {
+ strmOut << "# ";
+ }
+ else
+ {
+ ptman->LogHexInTable(strmOut, psloutTmp->GlyphID());
+ ccomp = max(ccomp, psloutTmp->NumberOfComponents());
+ }
+ }
+ strmOut << "\n";
+
+ bool fAnyPseudos = false;
+ for (islout = 0; islout < m_cslout; islout++)
+ {
+ GrSlotOutput * psloutTmp = m_prgslout + islout;
+ if (psloutTmp->GlyphID() != psloutTmp->ActualGlyphForOutput(ptman))
+ {
+ fAnyPseudos = true;
+ break;
+ }
+ }
+ if (fAnyPseudos)
+ {
+ strmOut << "Actual glyphs: ";
+ for (int islout = 0; islout < m_cslout; islout++)
+ {
+ GrSlotOutput * psloutTmp = m_prgslout + islout;
+ if (psloutTmp->GlyphID() != psloutTmp->ActualGlyphForOutput(ptman))
+ ptman->LogHexInTable(strmOut, psloutTmp->ActualGlyphForOutput(ptman));
+ else
+ strmOut << " ";
+ }
+ strmOut << "\n";
+ }
+
+ strmOut << "before ";
+ for (islout = 0; islout < m_cslout; islout++)
+ {
+ GrSlotOutput * psloutTmp = m_prgslout + islout;
+ if (psloutTmp->SpecialSlotFlag() == kspslLbInitial ||
+ psloutTmp->SpecialSlotFlag() == kspslLbFinal)
+ {
+ strmOut << " ";
+ }
+ else
+ ptman->LogInTable(strmOut, psloutTmp->BeforeAssoc());
+ }
+ strmOut << "\n";
+
+ strmOut << "after ";
+ for (islout = 0; islout < m_cslout; islout++)
+ {
+ GrSlotOutput * psloutTmp = m_prgslout + islout;
+ if (psloutTmp->SpecialSlotFlag() == kspslLbInitial ||
+ psloutTmp->SpecialSlotFlag() == kspslLbFinal)
+ {
+ strmOut << " ";
+ }
+ else
+ ptman->LogInTable(strmOut, psloutTmp->AfterAssoc());
+ }
+ strmOut << "\n";
+
+ for (int icomp = 0; icomp < ccomp; icomp++)
+ {
+ strmOut << "component " << icomp + 1 // 1=based
+ << " ";
+ for (islout = 0; islout < m_cslout; islout++)
+ {
+ GrSlotOutput * psloutTmp = m_prgslout + islout;
+ if (psloutTmp->SpecialSlotFlag() == kspslLbInitial ||
+ psloutTmp->SpecialSlotFlag() == kspslLbFinal)
+ {
+ strmOut << " ";
+ }
+ else if (icomp < psloutTmp->NumberOfComponents())
+ ptman->LogInTable(strmOut, psloutTmp->UnderlyingComponent(icomp));
+ else
+ strmOut << " ";
+ }
+ strmOut << "\n";
+ }
+#endif
+}
+
+#ifdef TRACING
+/*----------------------------------------------------------------------------------------------
+ Write out the header lines for the underlying data.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogUnderlyingHeader(std::ostream & strmOut, int iMin,
+ int iLim, int cBackup, int * prgichr)
+{
+ strmOut << "string ";
+ int i, iLabel;
+ int * pichr = prgichr;
+ for (i = iMin - cBackup, iLabel = i; i < iLim; i++, iLabel++, pichr++)
+ {
+ while (prgichr && *pichr > 1)
+ {
+ // continuation of upper-plane char
+ iLabel++;
+ pichr++;
+ }
+ LogInTable(strmOut, iLabel);
+ }
+ strmOut << "\n";
+
+ strmOut << "segment ";
+ pichr = prgichr;
+ for (i = 0 - cBackup, iLabel = i; i < (iLim - iMin); i++, iLabel++, pichr++)
+ {
+ while (prgichr && *pichr > 1)
+ {
+ // continuation of upper-plane char
+ iLabel++;
+ pichr++;
+ }
+ LogInTable(strmOut, iLabel);
+ }
+ strmOut << "\n\n";
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write out the header lines for the slot contents.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogSlotHeader(std::ostream & strmOut, int islotLim,
+ int cspPerSlot, int cspLeading, int islotMin)
+{
+ islotLim = min(islotLim, MAX_SLOTS);
+
+ int isp, islot;
+
+ for (isp = 0; isp < cspLeading; isp++)
+ strmOut << " ";
+
+ for (islot = islotMin; islot < islotLim; islot++)
+ LogInTable(strmOut, islot);
+ strmOut << "\n\n";
+
+/****
+ if (cslot >= 100)
+ {
+ for (isp = 0; isp < cspLeading; isp++)
+ strmOut << " ";
+
+ for (islot = 0; islot < 100; islot++)
+ {
+ for (isp = 0; isp < cspPerSlot; isp++)
+ strmOut << " ";
+ }
+
+ for (islot = 100; islot < cslot; islot++)
+ {
+ strmOut << "1";
+ for (isp = 1; isp < cspPerSlot; isp++)
+ strmOut << " ";
+ }
+ }
+
+ if (cslot > 10)
+ {
+ for (isp = 0; isp < cspLeading; isp++)
+ strmOut << " ";
+
+ for (islot = 0; islot < 10; islot++)
+ {
+ for (isp = 0; isp < cspPerSlot; isp++)
+ strmOut << " ";
+ }
+
+ for (islot = 10; islot < cslot; islot++)
+ {
+ if (true) // (islot % 10 == 0)
+ {
+ if (islot >= 100)
+ strmOut << ((islot - 100) / 10);
+ else
+ strmOut << (islot / 10);
+ }
+ else
+ strmOut << " ";
+
+ for (isp = 1; isp < cspPerSlot; isp++)
+ strmOut << " ";
+ }
+ strmOut << "\n";
+ }
+
+ for (isp = 0; isp < cspLeading; isp++)
+ strmOut << " ";
+
+ for (islot = 0; islot < cslot; islot++)
+ {
+ strmOut << (islot % 10);
+ for (isp = 1; isp < cspPerSlot; isp++)
+ strmOut << " ";
+
+ }
+ strmOut << "\n";
+****/
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write out the glyph numbers for the given stream.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogSlotGlyphs(std::ostream & strmOut, GrSlotStream * psstrm)
+{
+ strmOut << "Glyph IDs: ";
+ int islot;
+ for (islot = 0; islot < psstrm->WritePos(); islot++)
+ {
+ GrSlotState * pslotTmp = psstrm->SlotAt(islot);
+ if (pslotTmp->IsLineBreak(LBGlyphID()))
+ strmOut << "# ";
+ else
+ LogHexInTable(strmOut, pslotTmp->GlyphID());
+ }
+ strmOut << "\n";
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return flags indicating which attributes were modified for some slot during the pass
+ and therefore need a line in the log file.
+
+ The 'pfMods' array has one flag per slot attribute; the final group are the user-
+ definable attributes. 'pccomp' returns the maximum number of ligature components
+ in this pass. Associations are assumed to have changed if anything else for the slot did.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::SlotAttrsModified(int ipass, bool * rgfMods, bool fPreJust,
+ int * pccomp, int * pcassoc)
+{
+ // Zero the flags
+ std::fill_n(rgfMods, kslatMax + NumUserDefn() - 1, false);
+ *pccomp = 0;
+ *pcassoc = 0;
+
+ //GrSlotStream * psstrmIn = InputStream(ipass);
+ GrSlotStream * psstrmOut = OutputStream(ipass);
+
+ for (int islot = 0; islot < psstrmOut->WritePos(); islot++)
+ {
+ GrSlotState * pslot = psstrmOut->SlotAt(islot);
+ Assert(pslot->PassModified() <= ipass);
+ if (pslot->PassModified() < ipass && !fPreJust)
+ continue; // not modified during this pass
+
+ pslot->SlotAttrsModified(rgfMods, fPreJust, pccomp, pcassoc);
+ }
+}
+
+void GrSlotState::SlotAttrsModified(bool * rgfMods, bool fPreJust, int * pccomp, int * pcassoc)
+{
+ // To handle reprocessing, in which case there may be a chain of slots modified
+ // in the same pass:
+ GrSlotState * pslotPrev = m_pslotPrevState;
+ while (pslotPrev && pslotPrev->PassModified() == PassModified())
+ pslotPrev = pslotPrev->m_pslotPrevState;
+
+ if (!pslotPrev)
+ {
+ // Inserted slot?
+ if (m_fAdvXSet)
+ rgfMods[kslatAdvX] = true;
+ if (m_fAdvYSet)
+ rgfMods[kslatAdvY] = true;
+
+ if (m_srAttachTo != 0)
+ rgfMods[kslatAttTo] = true;
+
+ if (m_mAttachAtX != kNotYetSet || m_mAttachAtY != 0)
+ { // always do these in pairs
+ rgfMods[kslatAttAtX] = true;
+ rgfMods[kslatAttAtY] = true;
+ }
+ if (m_nAttachAtGpoint != kNotYetSet)
+ rgfMods[kslatAttAtGpt] = true;
+ if (m_mAttachAtXOffset != 0 || m_mAttachAtYOffset != 0)
+ { // always do these in pairs
+ rgfMods[kslatAttAtXoff] = true;
+ rgfMods[kslatAttAtYoff] = true;
+ }
+
+ if (m_mAttachWithX != kNotYetSet || m_mAttachWithY != 0)
+ { // always do these in pairs
+ rgfMods[kslatAttWithX] = true;
+ rgfMods[kslatAttWithY] = true;
+ }
+ if (m_nAttachWithGpoint != kNotYetSet)
+ rgfMods[kslatAttWithGpt] = true;
+ if (m_mAttachWithXOffset != 0 || m_mAttachWithYOffset != 0)
+ { // always do these in pairs
+ rgfMods[kslatAttWithXoff] = true;
+ rgfMods[kslatAttWithYoff] = true;
+ }
+
+ if (m_nAttachLevel != 0)
+ rgfMods[kslatAttLevel] = true;
+
+ if (m_lb != kNotYetSet8)
+ rgfMods[kslatBreak] = true;
+ if (m_dirc != kNotYetSet8)
+ rgfMods[kslatDir] = true;
+ if (m_fInsertBefore != true)
+ rgfMods[kslatInsert] = true;
+
+ if (m_mMeasureSol != kNotYetSet && m_mMeasureSol != 0)
+ rgfMods[kslatMeasureSol] = true;
+ if (m_mMeasureEol != kNotYetSet && m_mMeasureEol != 0)
+ rgfMods[kslatMeasureEol] = true;
+
+ if (m_mJStretch0 != kNotYetSet && m_mJStretch0 != 0)
+ rgfMods[kslatJStretch] = true;
+ if (m_mJShrink0 != kNotYetSet && m_mJShrink0 != 0)
+ rgfMods[kslatJShrink] = true;
+ if (m_mJStep0 != kNotYetSet && m_mJStep0 != 0)
+ rgfMods[kslatJStep] = true;
+ if (m_nJWeight0 != byte(kNotYetSet) &&
+ m_nJWeight0 != 0 && m_nJWeight0 != 1)
+ rgfMods[kslatJWeight] = true;
+ if (m_mJWidth0 != kNotYetSet && m_mJWidth0 != 0)
+ rgfMods[kslatJWidth] = true;
+
+ if (m_mShiftX != 0)
+ rgfMods[kslatShiftX] = true;
+ if (m_mShiftY != 0)
+ rgfMods[kslatShiftY] = true;
+
+ int i;
+ for (i = 0; i < m_cnCompPerLig; i++)
+ {
+ if (CompRef(i) != NULL)
+ rgfMods[kslatCompRef] = true;
+ if (CompRef(i))
+ *pccomp = max(*pccomp, i + 1); // max number of ligatures in this pass
+ }
+
+ for (i = 0; i < m_cnUserDefn; i++)
+ {
+ if (UserDefn(i) != 0)
+ rgfMods[kslatUserDefn + i] = true;
+ }
+ }
+ else
+ {
+ if (m_fAdvXSet && m_mAdvanceX != pslotPrev->m_mAdvanceX)
+ rgfMods[kslatAdvX] = true;
+ if (m_fAdvYSet && m_mAdvanceY != pslotPrev->m_mAdvanceY)
+ rgfMods[kslatAdvY] = true;
+
+ if (m_srAttachTo != pslotPrev->m_srAttachTo)
+ rgfMods[kslatAttTo] = true;
+
+ if (m_mAttachAtX != pslotPrev->m_mAttachAtX || m_mAttachAtY != pslotPrev->m_mAttachAtY)
+ {
+ rgfMods[kslatAttAtX] = true;
+ rgfMods[kslatAttAtY] = true;
+ }
+ if (m_nAttachAtGpoint != pslotPrev->m_nAttachAtGpoint)
+ rgfMods[kslatAttAtGpt] = true;
+ if (m_mAttachAtXOffset != pslotPrev->m_mAttachAtXOffset ||
+ m_mAttachAtYOffset != pslotPrev->m_mAttachAtYOffset)
+ {
+ rgfMods[kslatAttAtXoff] = true;
+ rgfMods[kslatAttAtYoff] = true;
+ }
+
+ if (m_mAttachWithX != pslotPrev->m_mAttachWithX ||
+ m_mAttachWithY != pslotPrev->m_mAttachWithY)
+ {
+ rgfMods[kslatAttWithX] = true;
+ rgfMods[kslatAttWithY] = true;
+ }
+ if (m_nAttachWithGpoint != pslotPrev->m_nAttachWithGpoint)
+ rgfMods[kslatAttWithGpt] = true;
+ if (m_mAttachWithXOffset != pslotPrev->m_mAttachWithXOffset ||
+ m_mAttachWithYOffset != pslotPrev->m_mAttachWithYOffset)
+ {
+ rgfMods[kslatAttWithXoff] = true;
+ rgfMods[kslatAttWithYoff] = true;
+ }
+
+ if (m_nAttachLevel != pslotPrev->m_nAttachLevel)
+ rgfMods[kslatAttLevel] = true;
+
+ if (m_lb != pslotPrev->m_lb)
+ rgfMods[kslatBreak] = true;
+ if (m_dirc != pslotPrev->m_dirc)
+ rgfMods[kslatDir] = true;
+ if (m_fInsertBefore != pslotPrev->m_fInsertBefore)
+ rgfMods[kslatInsert] = true;
+
+ if (m_mMeasureSol != pslotPrev->m_mMeasureSol)
+ rgfMods[kslatMeasureSol] = true;
+ if (m_mMeasureEol != pslotPrev->m_mMeasureEol)
+ rgfMods[kslatMeasureEol] = true;
+
+ if (m_mJStretch0 != pslotPrev->m_mJStretch0 || (fPreJust && m_mJStretch0 != 0))
+ rgfMods[kslatJStretch] = true;
+ if (m_mJShrink0 != pslotPrev->m_mJShrink0 || (fPreJust && m_mJShrink0 != 0))
+ rgfMods[kslatJShrink] = true;
+ if (m_mJStep0 != pslotPrev->m_mJStep0 || (fPreJust && m_mJStep0 != 0))
+ rgfMods[kslatJStep] = true;
+ if (m_nJWeight0 != pslotPrev->m_nJWeight0 || (fPreJust && m_nJWeight0 != 0))
+ rgfMods[kslatJWeight] = true;
+ if (m_mJWidth0 != pslotPrev->m_mJWidth0)
+ rgfMods[kslatJWidth] = true;
+
+ if (m_mShiftX != pslotPrev->m_mShiftX)
+ rgfMods[kslatShiftX] = true;
+ if (m_mShiftY != pslotPrev->m_mShiftY)
+ rgfMods[kslatShiftY] = true;
+
+ int i;
+ for (i = 0; i < m_cnCompPerLig; i++)
+ {
+ if (CompRef(i) != pslotPrev->CompRef(i))
+ rgfMods[kslatCompRef] = true;
+ if (CompRef(i))
+ *pccomp = max(*pccomp, i + 1); // max number of ligatures in this pass
+ }
+
+ for (i = 0; i < m_cnUserDefn; i++)
+ {
+ if (UserDefn(i) != pslotPrev->UserDefn(i))
+ rgfMods[kslatUserDefn + i] = true;
+ }
+ }
+
+ *pcassoc = max(*pcassoc, AssocsSize());
+}
+
+/*----------------------------------------------------------------------------------------------
+ Log the value of the slot attribute for the given slot, if it changed.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::LogSlotAttributeValue(GrTableManager * ptman,
+ std::ostream & strmOut, int ipass, int slat, int iIndex,
+ bool fPreJust, bool fPostJust)
+{
+ if (m_ipassModified != ipass && !fPreJust && !fPostJust)
+ {
+ strmOut << " ";
+ return;
+ }
+
+ // To handle reprocessing, in which case there may be a chain of slots modified
+ // in the same pass:
+ GrSlotState * pslotPrev = m_pslotPrevState;
+ while (pslotPrev && pslotPrev->PassModified() == PassModified())
+ pslotPrev = pslotPrev->m_pslotPrevState;
+
+ // General-purpose variables for em-unit attributes:
+ int mThis = 0;
+ int mPrev = 0;
+ switch (slat)
+ {
+ case kslatShiftX:
+ mThis = m_mShiftX;
+ mPrev = (pslotPrev) ? pslotPrev->m_mShiftX : 0;
+ break;
+ case kslatShiftY:
+ mThis = m_mShiftY;
+ mPrev = (pslotPrev) ? pslotPrev->m_mShiftY : 0;
+ break;
+ case kslatMeasureSol:
+ mThis = m_mMeasureSol;
+ mPrev = (pslotPrev) ? pslotPrev->m_mMeasureSol : 0;
+ break;
+ case kslatMeasureEol:
+ mThis = m_mMeasureEol;
+ mPrev = (pslotPrev) ? pslotPrev->m_mMeasureEol : 0;
+ break;
+ case kslatJStretch:
+ mThis = m_mJStretch0;
+ mPrev = (pslotPrev) ? pslotPrev->m_mJStretch0 : 0;
+ mPrev = (fPreJust && mThis > 0) ? -1 : mPrev; // log it even if it didn't change
+ break;
+ case kslatJShrink:
+ mThis = m_mJShrink0;
+ mPrev = (pslotPrev) ? pslotPrev->m_mJShrink0 : 0;
+ mPrev = (fPreJust && mThis > 0) ? -1 : mPrev; // log it even if it didn't change
+ break;
+ case kslatJStep:
+ mThis = m_mJStep0;
+ mPrev = (pslotPrev) ? pslotPrev->m_mJStep0 : 0;
+ mPrev = (fPreJust && mThis > 1) ? -1 : mPrev; // log it even if it didn't change
+ break;
+ case kslatJWeight:
+ mThis = m_nJWeight0;
+ mPrev = (pslotPrev) ? pslotPrev->m_nJWeight0 : 0;
+ mPrev = (fPreJust && mThis > 1) ? -1 : mPrev; // log it even if it didn't change
+ break;
+ case kslatJWidth:
+ mThis = m_mJWidth0;
+ mPrev = (pslotPrev) ? pslotPrev->m_mJWidth0 : 0;
+ mPrev = (fPostJust && mThis > 0) ? -1 : mPrev; // log it even if it didn't change
+ break;
+ default:
+ // don't use these variables
+ break;
+ }
+
+ switch (slat)
+ {
+ case kslatAdvX:
+ if (m_fAdvXSet && (!pslotPrev || m_mAdvanceX != pslotPrev->m_mAdvanceX))
+ {
+ ptman->LogInTable(strmOut, m_mAdvanceX);
+ return;
+ }
+ break;
+ case kslatAdvY:
+ if (m_fAdvYSet && (!pslotPrev || m_mAdvanceY != pslotPrev->m_mAdvanceY))
+ {
+ ptman->LogInTable(strmOut, m_mAdvanceY);
+ return;
+ }
+ break;
+
+ case kslatAttTo:
+ if (m_srAttachTo != (pslotPrev ? pslotPrev->m_srAttachTo : 0))
+ {
+ ptman->LogInTable(strmOut, m_srAttachTo);
+ return;
+ }
+ break;
+
+ case kslatAttAtX: // always do these in pairs
+ case kslatAttAtY:
+ if (m_mAttachAtX != (pslotPrev ? pslotPrev->m_mAttachAtX : kNotYetSet) ||
+ m_mAttachAtY != (pslotPrev ? pslotPrev->m_mAttachAtY : 0))
+ {
+ ptman->LogInTable(strmOut,
+ ((slat == kslatAttAtX) ? m_mAttachAtX : m_mAttachAtY));
+ return;
+ }
+ break;
+ case kslatAttAtGpt:
+ if (m_nAttachAtGpoint != (pslotPrev ? pslotPrev->m_nAttachAtGpoint : kNotYetSet))
+ {
+ ptman->LogInTable(strmOut,
+ ((m_nAttachAtGpoint == kGpointZero) ? 0 : m_nAttachAtGpoint));
+ return;
+ }
+ break;
+ case kslatAttAtXoff: // always do these in pairs
+ case kslatAttAtYoff:
+ if (m_mAttachAtXOffset != (pslotPrev ? pslotPrev->m_mAttachAtXOffset : 0) ||
+ m_mAttachAtYOffset != (pslotPrev ? pslotPrev->m_mAttachAtYOffset : 0))
+ {
+ ptman->LogInTable(strmOut,
+ ((slat == kslatAttAtXoff) ? m_mAttachAtXOffset : m_mAttachAtYOffset));
+ return;
+ }
+ break;
+
+ case kslatAttWithX: // always do these in pairs
+ case kslatAttWithY:
+ if (m_mAttachWithX != (pslotPrev ? pslotPrev->m_mAttachWithX : kNotYetSet) ||
+ m_mAttachWithY != (pslotPrev ? pslotPrev->m_mAttachWithY : 0))
+ {
+ ptman->LogInTable(strmOut,
+ ((slat == kslatAttWithX) ? m_mAttachWithX : m_mAttachWithY));
+ return;
+ }
+ break;
+ case kslatAttWithGpt:
+ if (m_nAttachWithGpoint != (pslotPrev ? pslotPrev->m_nAttachWithGpoint : kNotYetSet))
+ {
+ ptman->LogInTable(strmOut,
+ ((m_nAttachWithGpoint == kGpointZero) ? 0 : m_nAttachWithGpoint));
+ return;
+ }
+ break;
+ case kslatAttWithXoff: // always do these in pairs
+ case kslatAttWithYoff:
+ if (m_mAttachWithXOffset != (pslotPrev ? pslotPrev->m_mAttachWithXOffset : 0) ||
+ m_mAttachWithYOffset != (pslotPrev ? pslotPrev->m_mAttachWithYOffset : 0))
+ {
+ ptman->LogInTable(strmOut,
+ ((slat == kslatAttWithXoff) ? m_mAttachWithXOffset : m_mAttachWithYOffset));
+ return;
+ }
+ break;
+
+ case kslatAttLevel:
+ if (m_nAttachLevel != (pslotPrev ? pslotPrev->m_nAttachLevel : 0))
+ {
+ ptman->LogInTable(strmOut, m_nAttachLevel);
+ return;
+ }
+ break;
+
+ case kslatBreak:
+ if (m_lb != (pslotPrev ? pslotPrev->m_lb : kNotYetSet8))
+ {
+ ptman->LogBreakWeightInTable(strmOut, m_lb);
+ return;
+ }
+ break;
+ case kslatDir:
+ if (m_dirc != (pslotPrev ? pslotPrev->m_dirc : kNotYetSet8))
+ {
+ ptman->LogDirCodeInTable(strmOut, m_dirc);
+ return;
+ }
+ break;
+ case kslatInsert:
+ if (m_fInsertBefore != (pslotPrev ? pslotPrev->m_fInsertBefore : true))
+ {
+ if (m_fInsertBefore)
+ strmOut << "true ";
+ else
+ strmOut << "false ";
+ return;
+ }
+ break;
+
+ case kslatJWeight:
+ if (m_mJStretch0 == 0 && m_mJShrink0 == 0)
+ mPrev = mThis; // don't log; weight is irrelevant
+ // fall through
+ case kslatShiftX:
+ case kslatShiftY:
+ case kslatMeasureSol:
+ case kslatMeasureEol:
+ case kslatJStretch:
+ case kslatJShrink:
+ case kslatJStep:
+ case kslatJWidth:
+ if (mThis != mPrev)
+ {
+ ptman->LogInTable(strmOut, mThis);
+ return;
+ }
+ break;
+
+ case kslatCompRef:
+ if (CompRef(iIndex) != (pslotPrev ? pslotPrev->CompRef(iIndex) : 0))
+ {
+ GrSlotState * pslotComp = reinterpret_cast<GrSlotState *>(CompRef(iIndex));
+ ptman->LogInTable(strmOut, pslotComp->m_islotTmpIn);
+ return;
+ }
+ break;
+
+ default:
+ if (kslatUserDefn <= slat && slat <= kslatUserDefn + m_cnUserDefn)
+ {
+ int iTmp = slat - kslatUserDefn;
+ if (UserDefn(iTmp) != (pslotPrev ? pslotPrev->UserDefn(iTmp) : 0))
+ {
+ ptman->LogInTable(strmOut, UserDefn(iTmp));
+ return;
+ }
+ }
+ else
+ gAssert(false);
+ }
+
+ strmOut << " ";
+}
+
+/*----------------------------------------------------------------------------------------------
+ Log the value of the association, if the slot changed.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::LogAssociation(GrTableManager * ptman,
+ std::ostream & strmOut, int ipass, int iassoc, bool fBoth, bool fAfter)
+{
+ if (m_ipassModified != ipass)
+ {
+ strmOut << " ";
+ return;
+ }
+
+ if (fBoth)
+ {
+ GrSlotState * pslotBefore = AssocSlot(0);
+ GrSlotState * pslotAfter = AssocSlot(m_vpslotAssoc.size() - 1);
+
+ int nBefore, nAfter;
+
+ int csp = 4;
+ if (pslotBefore)
+ {
+ nBefore = pslotBefore->m_islotTmpIn;
+ strmOut << nBefore;
+ if (nBefore > 99) csp--;
+ if (nBefore > 9) csp--;
+ }
+ else
+ {
+ strmOut << "??";
+ csp--;
+ }
+ if (pslotAfter)
+ {
+ nAfter = pslotAfter->m_islotTmpIn;
+ strmOut << "/" << nAfter;
+ if (nAfter > 99) csp--;
+ if (nAfter > 9) csp--;
+ }
+ else
+ {
+ if (pslotBefore)
+ {
+ strmOut << "/" << "??";
+ csp--;
+ }
+ else
+ csp = 5;
+ }
+
+ for (int isp = 0; isp < csp; isp++)
+ strmOut << " ";
+ }
+
+ else if (fAfter)
+ {
+ Assert(m_vpslotAssoc.size());
+ GrSlotState * pslotAfter = AssocSlot(m_vpslotAssoc.size() - 1);
+
+ if (pslotAfter)
+ {
+ int nAfter = pslotAfter->m_islotTmpIn;
+ ptman->LogInTable(strmOut, nAfter);
+ }
+ else
+ strmOut << "?? ";
+ }
+ else if (iassoc < signed(m_vpslotAssoc.size() - 1))
+ {
+ GrSlotState * pslot = AssocSlot(iassoc);
+
+ if (pslot)
+ {
+ int n = pslot->m_islotTmpIn;
+ ptman->LogInTable(strmOut, n);
+ }
+ else
+ strmOut << "?? ";
+ }
+ else
+ strmOut << " ";
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write a hex value (a glyphID or Unicode codepoint) into the table.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogInTable(std::ostream & strmOut, int n)
+{
+ if (n == kNegInfinity)
+ {
+ strmOut << "-inf ";
+ return;
+ }
+ if (n == kPosInfinity)
+ {
+ strmOut << "+inf ";
+ return;
+ }
+ if (n > 999999)
+ {
+ strmOut << "****** ";
+ return;
+ }
+ if (n < -99999)
+ {
+ strmOut << "-***** ";
+ return;
+ }
+
+ strmOut << n;
+ int csp = SP_PER_SLOT - 1;
+
+ if (abs(n) > 99999) csp--;
+ if (abs(n) > 9999) csp--;
+ if (abs(n) > 999) csp--;
+ if (abs(n) > 99) csp--;
+ if (abs(n) > 9) csp--;
+
+ if (n < 0) csp--;
+
+ for (int isp = 0; isp < csp; isp++)
+ strmOut << " ";
+}
+
+void GrTableManager::LogInTable(std::ostream & strmOut, float n)
+{
+ if (n == kNegInfFloat)
+ {
+ strmOut << "-inf ";
+ return;
+ }
+ if (n == kPosInfFloat)
+ {
+ strmOut << "+inf ";
+ return;
+ }
+ if (n > 9999)
+ {
+ strmOut << "****.* ";
+ return;
+ }
+ if (n < -999)
+ {
+ strmOut << "-***.* ";
+ return;
+ }
+
+ int csp = SP_PER_SLOT - 4;
+
+ int nInt = (int)(fabsf(n));
+ int nTenths = (int)fabsf((fabsf(n) - float(nInt) + 0.05f) * 10);
+ if (nTenths >= 10)
+ {
+ nTenths = 0;
+ nInt++;
+ }
+
+ if (nInt >= 1000) csp--;
+ if (nInt >= 100) csp--;
+ if (nInt >= 10) csp--;
+
+ if (n < 0) csp--;
+
+ for (int isp = 0; isp < csp; isp++)
+ strmOut << " ";
+ if (n < 0)
+ strmOut << "-";
+ strmOut << nInt << "." << nTenths << " ";
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write a hex value (a glyphID or Unicode codepoint) into the table.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogHexInTable(std::ostream & strmOut, utf16 chw, bool fPlus)
+{
+ //char rgch[20];
+ if (chw <= 0x0fff) strmOut << "0";
+ if (chw <= 0x00ff) strmOut << "0";
+ if (chw <= 0x000f) strmOut << "0";
+
+ strmOut << std::hex << chw << std::dec;
+
+ for (int i = 4; i < SP_PER_SLOT - 2; i++)
+ strmOut << " ";
+
+ if (fPlus)
+ strmOut << "+ ";
+ else
+ strmOut << " ";
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write a directionality code to the table.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogDirCodeInTable(std::ostream & strmOut, int dirc)
+{
+ switch (dirc)
+ {
+ case kdircUnknown: strmOut << "??? "; break;
+ case kdircNeutral: strmOut << "ON "; break;
+ case kdircL: strmOut << "L "; break;
+ case kdircR: strmOut << "R "; break;
+ case kdircRArab: strmOut << "AR "; break;
+ case kdircEuroNum: strmOut << "EN "; break;
+ case kdircEuroSep: strmOut << "ES "; break;
+ case kdircEuroTerm: strmOut << "ET "; break;
+ case kdircArabNum: strmOut << "AN "; break;
+ case kdircComSep: strmOut << "CS "; break;
+ case kdircWhiteSpace: strmOut << "WS "; break;
+ case kdircBndNeutral: strmOut << "BN "; break;
+ case kdircNSM: strmOut << "NSM "; break;
+ case kdircLRO: strmOut << "LRO "; break;
+ case kdircRLO: strmOut << "RLO "; break;
+ case kdircLRE: strmOut << "LRE "; break;
+ case kdircRLE: strmOut << "RLE "; break;
+ case kdircPDF: strmOut << "PDF "; break;
+ case kdircPdfL: strmOut << "PDF-L "; break;
+ case kdircPdfR: strmOut << "PDF-R "; break;
+ case kdircLlb: strmOut << "L "; break;
+ case kdircRlb: strmOut << "R "; break;
+ default: LogInTable(strmOut, dirc); break;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write a breakweight code to the table.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogBreakWeightInTable(std::ostream & strmOut, int lb)
+{
+ if (lb < 0)
+ {
+ lb = lb * -1;
+ switch (lb)
+ {
+ case klbWsBreak: strmOut << "-ws "; break;
+ case klbWordBreak: strmOut << "-word "; break;
+ case klbHyphenBreak: strmOut << "-intra "; break;
+ case klbLetterBreak: strmOut << "-lettr "; break;
+ case klbClipBreak: strmOut << "-clip "; break;
+ default: LogInTable(strmOut, lb*-1); break;
+ }
+ }
+ else
+ {
+ switch (lb)
+ {
+ case klbNoBreak: strmOut << "none "; break;
+ case klbWsBreak: strmOut << "ws "; break;
+ case klbWordBreak: strmOut << "word "; break;
+ case klbHyphenBreak: strmOut << "intra "; break;
+ case klbLetterBreak: strmOut << "letter "; break;
+ case klbClipBreak: strmOut << "clip "; break;
+ default: LogInTable(strmOut, lb); break;
+ }
+ }
+}
+
+#endif // TRACING
+
+} // namespace gr
diff --git a/Build/source/libs/graphite/src/segment/XmlTransductionLog.cpp b/Build/source/libs/graphite/src/segment/XmlTransductionLog.cpp
new file mode 100644
index 00000000000..d0dfcaafbe8
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/XmlTransductionLog.cpp
@@ -0,0 +1,1583 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2008 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: TransductionLog.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Contains the functions for writing a log of the transduction process using an XML format.
+----------------------------------------------------------------------------------------------*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#include "Main.h"
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <math.h>
+
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:End Ignore
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Local Constants and static variables
+//:>********************************************************************************************
+
+namespace gr
+{
+
+//:>********************************************************************************************
+//:> Methods
+//:>********************************************************************************************
+
+#define SP_PER_SLOT 7
+#define LEADING_SP 15
+#define MAX_SLOTS 128
+
+/*----------------------------------------------------------------------------------------------
+ Output a file showing a log of the transduction process and the resulting segment.
+----------------------------------------------------------------------------------------------*/
+bool GrTableManager::WriteXmlLog(std::ostream * pstrmLog,
+ GrCharStream * pchstrm, Segment * psegRet, int cbPrevSegDat, byte * pbPrevSegDat)
+{
+#ifdef TRACING
+ if (!pstrmLog)
+ return false;
+ std::ostream & strmOut = *pstrmLog;
+ WriteXmlLogAux(strmOut, pchstrm, psegRet, cbPrevSegDat, pbPrevSegDat);
+ return true;
+#else
+ return false;
+#endif // TRACING
+}
+
+
+bool GrTableManager::WriteXmlAssocLog(std::ostream * pstrmLog,
+ GrCharStream * pchstrm, Segment * psegRet)
+{
+#ifdef TRACING
+ if (!pstrmLog)
+ return false;
+
+ std::ostream & strmOut = *pstrmLog;
+ LogFinalPositions(strmOut);
+
+ LogXmlTagOpen(strmOut, "Mappings", 1, true);
+ LogXmlTagPostAttrs(strmOut, true);
+
+ //psegRet->LogXmlUnderlyingToSurface(strmOut, this, pchstrm, 2);
+ //psegRet->LogXmlSurfaceToUnderlying(strmOut, this, 2);
+
+ LogXmlTagClose(strmOut, "Mappings", 1, true);
+
+ strmOut << "\n";
+ LogXmlTagClose(strmOut, "GraphiteTraceLog", 0, true);
+
+ return true;
+#else
+ return false;
+#endif // TRACING
+}
+
+#ifdef TRACING
+
+/*----------------------------------------------------------------------------------------------
+ Output a file showing a log of the transduction process and the resulting segment.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::WriteXmlLogAux(std::ostream & strmOut,
+ GrCharStream * pchstrm, Segment * psegRet,
+ int cbPrevSegDat, byte * pbPrevSegDat)
+{
+ strmOut
+ << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ << "<!DOCTYPE GraphiteTraceLog SYSTEM \"GraphiteTraceLog.dtd\">\n"
+ << "\n";
+
+ LogXmlTagOpen(strmOut, "GraphiteTraceLog", 0, true);
+ LogXmlTagPostAttrs(strmOut, true);
+ strmOut << "\n";
+
+ LogXmlTagOpen(strmOut, "SegmentRun", 1, true);
+ LogXmlTagAttr(strmOut, "stringOffset", pchstrm->Min(), 0);
+ LogXmlTagPostAttrs(strmOut, true);
+
+ if (cbPrevSegDat == 0)
+ LogXmlUnderlying(strmOut, pchstrm, 0, 2);
+ else
+ {
+ Assert(*(pbPrevSegDat + 4) == 0); // skip offset for first pass
+ LogXmlUnderlying(strmOut, pchstrm, *(pbPrevSegDat + 3), 2);
+ }
+
+ //LogXmlPass1Input(strmOut);
+
+ for (int ipass = 0; ipass < m_cpass; ipass++)
+ {
+ if (cbPrevSegDat == 0)
+ LogXmlPass(strmOut, ipass, 0, 2);
+ else
+ LogXmlPass(strmOut, ipass, *(pbPrevSegDat + 4 + ipass), 2);
+ }
+
+ LogXmlTagClose(strmOut, "SegmentRun", 1, true);
+ strmOut << "\n";
+
+ // Don't do this until after we've logged the associations.
+ //LogXmlTagClose(strmOut, "GraphiteTraceLog", 0, true);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write out a log of the underlying input.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogXmlUnderlying(std::ostream & strmOut, GrCharStream * pchstrm,
+ int cchwBackup, size_t nIndent)
+{
+ LogXmlTagOpen(strmOut, "Input", nIndent, true);
+ LogXmlTagPostAttrs(strmOut, true);
+
+ LogXmlUnderlyingAux(strmOut, pchstrm, cchwBackup, -1, nIndent,
+ true, // text
+ true, // features
+ true, // color
+ false, // string offset
+ false, // ligature components
+ false); // glyph associations
+
+ LogXmlTagClose(strmOut, "Input", nIndent, true);
+}
+
+void GrTableManager::LogXmlUnderlyingAux(std::ostream & strmOut, GrCharStream * pchstrm,
+ int cch32Backup, int cch32Lim, size_t nIndent,
+ bool fLogText, bool fLogFeatures, bool fLogColor, bool fLogStrOff, bool fLogLig, bool fLogGlyphs)
+{
+ int rgnChars[MAX_SLOTS];
+ bool rgfNewRun[MAX_SLOTS];
+ std::fill_n(rgfNewRun, MAX_SLOTS, false);
+ GrFeatureValues rgfval[MAX_SLOTS];
+ int cchwMaxRawChars;
+
+ int cch32 = pchstrm->GetLogData(this, rgnChars, rgfNewRun, rgfval,
+ cch32Backup, &cchwMaxRawChars);
+ cch32 = min(cch32, MAX_SLOTS);
+ if (cch32Lim > -1)
+ cch32 = min(cch32Lim, cch32);
+
+ int ichw;
+
+ // For UTF-8 and surrogate representation:
+ int rgchwChars1[MAX_SLOTS];
+ utf16 rgchwChars2[MAX_SLOTS];
+ utf16 rgchwChars3[MAX_SLOTS];
+ utf16 rgchwChars4[MAX_SLOTS];
+ utf16 rgchwChars5[MAX_SLOTS];
+ utf16 rgchwChars6[MAX_SLOTS];
+ utf16 rgiRawString[MAX_SLOTS]; // indices from underlying slots to text-source chars (0-based)
+
+ int rgichwRaw[MAX_SLOTS]; // index of input char with in the given UTF32, 1-based
+
+ if (cchwMaxRawChars > 1)
+ {
+ cchwMaxRawChars = min(cchwMaxRawChars, 6); // max of 6 raw (UTF-8 or UTF-16) chars per slot
+ pchstrm->GetLogDataRaw(this, cch32, cch32Backup, cchwMaxRawChars,
+ rgchwChars1, rgchwChars2, rgchwChars3, rgchwChars4, rgchwChars5, rgchwChars6,
+ rgichwRaw);
+ }
+ else
+ {
+ for (ichw = 0; ichw < cch32; ichw++)
+ {
+ rgichwRaw[ichw] = 1;
+ rgchwChars1[ichw] = rgnChars[ichw];
+ rgchwChars2[ichw] = 0;
+ rgchwChars3[ichw] = 0;
+ rgchwChars4[ichw] = 0;
+ rgchwChars5[ichw] = 0;
+ rgchwChars6[ichw] = 0;
+ }
+ }
+
+ int ichUtf32 = 0;
+ ichw = 0;
+ while (ichUtf32 < cch32)
+ {
+ if (rgichwRaw[ichw] == 1)
+ {
+ rgiRawString[ichUtf32++] = (utf16)ichw;
+ }
+ ichw++;
+ }
+
+ int ichwFeat = 0;
+ for (ichw = 0; ichw < cch32; ichw++)
+ {
+ if (rgfNewRun[ichw])
+ ichwFeat = ichw; // because rgfval only saves features for first of run
+
+ // See if there are any features.
+ bool fFeatures = false;
+ size_t ifeat;
+ for (ifeat = 0; fLogFeatures && ifeat < kMaxFeatures; ifeat++)
+ {
+ if (rgfval[ichwFeat].FeatureValue(ifeat) != 0)
+ {
+ fFeatures = true;
+ break;
+ }
+ }
+
+ bool fContent = fFeatures;
+
+ LogXmlTagOpen(strmOut, "Char", nIndent+1, fContent);
+
+ LogXmlTagAttr(strmOut, "index", rgiRawString[ichw] - cch32Backup, 0);
+ LogXmlTagAttrHex(strmOut, "usv", rgnChars[ichw], 0);
+
+ if (fLogText)
+ {
+ char rgch[20];
+ rgch[0] = (char)rgnChars[ichw];
+ rgch[1] = 0;
+ if (rgnChars[ichw] < 0x0100 && rgchwChars2[ichw] == 0) // ANSI
+ LogXmlTagAttr(strmOut, "text", rgch);
+ else if (rgnChars[ichw] == knLRM)
+ LogXmlTagAttr(strmOut, "text", "<LRM>");
+ else if (rgnChars[ichw] == knRLM)
+ LogXmlTagAttr(strmOut, "text", "<RLM>");
+ else if (rgnChars[ichw] == knLRO)
+ LogXmlTagAttr(strmOut, "text", "<LRO>");
+ else if (rgnChars[ichw] == knRLO)
+ LogXmlTagAttr(strmOut, "text", "<RLO>");
+ else if (rgnChars[ichw] == knLRE)
+ LogXmlTagAttr(strmOut, "text", "<LRE>");
+ else if (rgnChars[ichw] == knRLE)
+ LogXmlTagAttr(strmOut, "text", "<RLE>");
+ else if (rgnChars[ichw] == knPDF)
+ LogXmlTagAttr(strmOut, "text", "<PDF>");
+ }
+
+ if (fLogStrOff)
+ LogXmlTagAttr(strmOut, "stringOffset", pchstrm->Min() + rgiRawString[ichw] - cch32Backup, 0);
+
+ if (rgchwChars2[ichw] != 0)
+ {
+ std::string strHex = HexString(rgchwChars1[ichw], rgchwChars2[ichw], rgchwChars3[ichw],
+ rgchwChars4[ichw], rgchwChars5[ichw], rgchwChars6[ichw]);
+ if (pchstrm->TextSrc()->utfEncodingForm() == kutf8)
+ LogXmlTagAttr(strmOut, "textSourceUtf8", strHex.c_str());
+ else
+ LogXmlTagAttr(strmOut, "textSourceUtf16", strHex.c_str());
+ }
+
+ if (fLogColor)
+ {
+ IColorTextSource * tscolor = dynamic_cast<IColorTextSource *>(pchstrm->TextSrc());
+ if (tscolor)
+ {
+ int clrFore, clrBack;
+ tscolor->getColors(ichw, &clrFore, &clrBack);
+ LogXmlTagColor(strmOut, "color", clrFore, false);
+ LogXmlTagColor(strmOut, "background", clrBack, true);
+ }
+ }
+
+ if (fLogLig)
+ {
+
+ }
+
+//if (fLogLig || fLogGlyphs)
+//{
+// size_t cassocs = 0;
+// int fLigs = false;
+// int ichw;
+// for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+// {
+// if (m_prgpvisloutAssocs[ichw])
+// cassocs = max(cassocs, m_prgpvisloutAssocs[ichw]->size());
+// if (m_prgisloutLigature[ichw] != kNegInfinity)
+// fLigs = true;
+// }
+//}
+
+ LogXmlTagPostAttrs(strmOut, fContent);
+
+ if (fLogFeatures)
+ {
+ for (ifeat = 0; ifeat < kMaxFeatures; ifeat++)
+ {
+ if (rgfval[ichwFeat].FeatureValue(ifeat) != 0)
+ {
+ GrFeature * pfeat = Feature(ifeat);
+
+ LogXmlTagOpen(strmOut, "Feature", nIndent+2, false);
+ LogXmlTagAttr(strmOut, "id", pfeat->ID());
+ LogXmlTagAttr(strmOut, "value", rgfval[ichwFeat].FeatureValue(ifeat));
+ //LogXmlTagPostAttrs(strmOut, false);
+ LogXmlTagClose(strmOut, "Feature", nIndent+1, false);
+ }
+ }
+ }
+
+ if (fLogGlyphs)
+ {
+ }
+
+ LogXmlTagClose(strmOut, "Char", nIndent+1, fContent);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Output the the results of pass.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogXmlPass(std::ostream & strmOut, int ipass, int cslotSkipped, int nIndent)
+{
+ strmOut << "\n";
+
+ GrPass * ppass = Pass(ipass);
+ GrSlotStream * psstrmIn = (ipass == 0) ? NULL : InputStream(ipass);
+ GrSlotStream * psstrmOut = OutputStream(ipass);
+
+ int islot;
+ // Mark each slot with its index in the input and output streams.
+ for (islot = 0; ipass > 0 && islot < psstrmIn->ReadPos(); islot++)
+ psstrmIn->SlotAt(islot)->m_islotTmpIn = islot;
+
+ for (islot = 0; islot < psstrmOut->WritePos(); islot++)
+ psstrmOut->SlotAt(islot)->m_islotTmpOut = islot;
+
+ LogXmlTagOpen(strmOut, "Pass", nIndent, true);
+ LogXmlTagAttr(strmOut, "number", ipass);
+
+ std::string strType;
+ if (dynamic_cast<GrGlyphGenPass *>(ppass))
+ strType = "glyphGeneration";
+ else if (dynamic_cast<GrBidiPass *>(ppass))
+ strType = "bidi";
+ else if (dynamic_cast<GrSubPass *>(ppass))
+ {
+ if (ipass >= m_ipassJust1)
+ strType = "justification";
+ else
+ strType = "substitution";
+ }
+ else if (dynamic_cast<GrPosPass *>(ppass))
+ strType = "positioning";
+ else if (dynamic_cast<GrLineBreakPass *>(ppass))
+ strType = "linebreak";
+ LogXmlTagAttr(strmOut, "type", strType.c_str());
+
+ LogXmlTagPostAttrs(strmOut, true);
+
+ if (!dynamic_cast<GrBidiPass *>(ppass) && !dynamic_cast<GrGlyphGenPass *>(ppass))
+ {
+ LogXmlTagOpen(strmOut, "RulesMatched", nIndent+1, true);
+ LogXmlTagPostAttrs(strmOut, true);
+ ppass->LogXmlRules(strmOut, this, psstrmIn, nIndent+2);
+ LogXmlTagClose(strmOut, "RulesMatched", nIndent+1, true);
+ }
+
+ bool fJustWidths = false;
+ if (ipass == m_ipassJust1 - 1 && ShouldLogJustification()
+ && m_engst.m_jmodi == kjmodiJustify)
+ {
+ fJustWidths = true;
+ }
+
+ LogXmlTagOpen(strmOut, "Output", nIndent+1, true);
+ LogXmlTagPostAttrs(strmOut, true);
+ bool fPreJust = (!fJustWidths && ipass == m_ipassJust1 - 1 && ShouldLogJustification());
+ bool fPostJust = (fJustWidths || ipass == m_ipassJust1 && ShouldLogJustification());
+ ppass->LogXmlGlyphs(strmOut, this, psstrmOut, m_ipassJust1, fPreJust, fPostJust, cslotSkipped, nIndent+2);
+ LogXmlTagClose(strmOut, "Output", nIndent+1, true);
+
+ LogXmlTagClose(strmOut, "Pass", nIndent, true);
+
+#ifdef XMLOMIT
+
+ // If this was the pass just before the justification routines get run, output a
+ // special line that just shows the results, ie, the values of justify.width.
+ // TODO: adjust this when measure mode get functioning.
+ if (ipass == m_ipassJust1 - 1 && ShouldLogJustification()
+ && m_engst.m_jmodi == kjmodiJustify)
+ {
+ strmOut << "\nJUSTIFICATION\n\n";
+ LogSlotHeader(strmOut, psstrmOut->WritePos(), SP_PER_SLOT, LEADING_SP);
+ LogSlotGlyphs(strmOut, psstrmOut);
+ LogAttributes(strmOut, ipass, true);
+ }
+
+#endif // XMLOMIT
+
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write the list of rules fired and failed for a given pass.
+----------------------------------------------------------------------------------------------*/
+void GrPass::LogXmlRules(std::ostream & strmOut, GrTableManager * ptman,
+ GrSlotStream * psstrmIn, int nIndent)
+{
+ m_pzpst->LogXmlRules(strmOut, ptman, psstrmIn, nIndent);
+}
+
+void PassState::LogXmlRules(std::ostream & strmOut, GrTableManager * ptman,
+ GrSlotStream * psstrmIn, int nIndent)
+{
+ if (m_crulrec == 0)
+ {
+ ptman->LogXmlComment(strmOut, "none", nIndent);
+ return;
+ }
+
+ for (int irulrec = 0; irulrec < m_crulrec; irulrec++)
+ {
+ bool fSourceAvailable = false;
+
+ ptman->LogXmlTagOpen(strmOut, "Rule", nIndent, fSourceAvailable);
+
+ ptman->LogXmlTagAttr(strmOut, "slot", m_rgrulrec[irulrec].m_islot);
+
+ if (m_rgrulrec[irulrec].m_irul == PassState::kHitMaxRuleLoop)
+ ptman->LogXmlTagAttr(strmOut, "hitMaxRuleLoop", "true");
+ else if (m_rgrulrec[irulrec].m_irul == PassState::kHitMaxBackup)
+ ptman->LogXmlTagAttr(strmOut, "hitMaxBackup", "true");
+ else
+ {
+ ptman->LogXmlTagAttr(strmOut, "debugNumber", m_rgrulrec[irulrec].m_irul);
+ ptman->LogXmlTagAttr(strmOut, "fired", (m_rgrulrec[irulrec].m_fFired) ? "true" : "false");
+ }
+
+ ptman->LogXmlTagPostAttrs(strmOut, fSourceAvailable);
+
+ // TODO: output Source
+
+ ptman->LogXmlTagClose(strmOut, "Rule", nIndent, fSourceAvailable);
+ }
+}
+
+void GrPass::LogXmlGlyphs(std::ostream & strmOut, GrTableManager * ptman, GrSlotStream * psstrmOut,
+ int ipassJust1, bool fPreJust, bool fPostJust, int cslotSkipped, int nIndent)
+{
+ GrBidiPass * ppassBidi = dynamic_cast<GrBidiPass *>(this);
+ GrBidiPass * ppassBidiNext = (m_ipass + 1 >= ptman->NumberOfPasses()) ?
+ NULL :
+ dynamic_cast<GrBidiPass *>(ptman->Pass(m_ipass + 1));
+ m_pzpst->LogXmlGlyphs(strmOut, ptman, psstrmOut, ipassJust1, fPreJust, fPostJust,
+ (ppassBidi != NULL), (ppassBidiNext != NULL), cslotSkipped, nIndent);
+}
+
+void PassState::LogXmlGlyphs(std::ostream & strmOut, GrTableManager * ptman, GrSlotStream * psstrmOut,
+ int ipassJust1, bool fPreJust, bool fPostJust, bool fBidi, bool fBidiNext, int cslotSkipped,
+ int nIndent)
+{
+ ptman->LogXmlTagOpen(strmOut, "Output", nIndent, true);
+ ptman->LogXmlTagPostAttrs(strmOut, true);
+
+ for (int islot = 0; islot < psstrmOut->WritePos() + 1; islot++) // +1 allows us to handle final deletion
+ {
+ if (islot > MAX_SLOTS)
+ break;
+
+ for (int islotDel = 0; islotDel < m_rgcslotDeletions[islot]; islotDel++)
+ {
+ ptman->LogXmlTagOpen(strmOut, "Glyph", nIndent+1, false);
+ ptman->LogXmlTagAttr(strmOut, "slot", "deleted");
+ ptman->LogXmlTagPostAttrs(strmOut, false);
+ ptman->LogXmlTagClose(strmOut, "Glyph", nIndent+1, false);
+ }
+ if (islot >= psstrmOut->WritePos())
+ break;
+
+ GrSlotState * pslot = psstrmOut->SlotAt(islot);
+
+ bool fMod = (pslot->PassModified() >= m_ipass && m_ipass > 0);
+ if (fBidi || fBidiNext)
+ fMod = true;
+
+ ptman->LogXmlTagOpen(strmOut, "Glyph", nIndent+1, fMod);
+
+ ptman->LogXmlTagAttr(strmOut, "slot", islot);
+ if (pslot->GlyphID() == ptman->LBGlyphID())
+ ptman->LogXmlTagAttr(strmOut, "gid", "linebreak");
+ else
+ ptman->LogXmlTagAttr(strmOut, "gid", pslot->GlyphID());
+ if (pslot->GlyphID() != pslot->ActualGlyphForOutput(ptman))
+ ptman->LogXmlTagAttr(strmOut, "actual", pslot->ActualGlyphForOutput(ptman));
+ if (m_rgfInsertion[islot])
+ ptman->LogXmlTagAttr(strmOut, "inserted", "true");
+ if (islot < cslotSkipped)
+ ptman->LogXmlTagAttr(strmOut, "nextPassSkips", "true");
+
+ ptman->LogXmlTagPostAttrs(strmOut, fMod);
+
+ if (fMod)
+ {
+ pslot->LogXmlAttributes(strmOut, ptman, psstrmOut, m_ipass, islot,
+ fPreJust, fPostJust, fBidi, fBidiNext, nIndent+2);
+ }
+
+ ptman->LogXmlTagClose(strmOut, "Glyph", nIndent+1, fMod);
+ }
+
+ ptman->LogXmlTagClose(strmOut, "Output", nIndent, true);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write out the attributes that have changes.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::LogXmlAttributes(std::ostream & strmOut, GrTableManager * ptman,
+ GrSlotStream * psstrmOut, int ipass,
+ int islot, bool fPreJust, bool fPostJust, bool fBidi, bool fBidiNext, int nIndent)
+{
+ // To handle reprocessing, in which case there may be a chain of slots modified
+ // in the same pass:
+ GrSlotState * pslotPrev = PrevState();
+ while (pslotPrev && pslotPrev->PassModified() == PassModified())
+ pslotPrev = pslotPrev->m_pslotPrevState;
+
+ bool * prgfMods = new bool[kslatMax + ptman->NumUserDefn() - 1];
+ memset(prgfMods, 0, (kslatMax + ptman->NumUserDefn() - 1) * sizeof(bool));
+ int ccomp;
+ int cassoc;
+ SlotAttrsModified(prgfMods, fPreJust, &ccomp, &cassoc); // just for this one slot
+
+ if (fPreJust)
+ prgfMods[kslatJWidth] = false;
+ else if (fPostJust)
+ prgfMods[kslatJWidth] = true;
+
+ //if (fJustWidths)
+ //{}
+
+ bool fLogAssocs = false;
+
+ for (int slat = 0; slat < kslatMax + ptman->NumUserDefn() - 1; slat++)
+ {
+ if (!prgfMods[slat] && (slat != kslatDir || (!fBidi && !fBidiNext)))
+ continue;
+
+ if (slat == kslatPosX)
+ continue;
+ if (slat == kslatPosY)
+ continue;
+
+ std::string strAttrName;
+ switch (slat)
+ {
+ case kslatAdvX: strAttrName = "advance.x"; break;
+ case kslatAdvY: strAttrName = "advance.y"; break;
+ case kslatAttTo: strAttrName = "att.to"; break;
+ case kslatAttAtX: strAttrName = "att.at.x"; break;
+ case kslatAttAtY: strAttrName = "att.at.y"; break;
+ case kslatAttAtGpt: strAttrName = "att.at.gpt"; break;
+ case kslatAttAtXoff: strAttrName = "att.at.xoff"; break;
+ case kslatAttAtYoff: strAttrName = "att.at.yoff"; break;
+ case kslatAttWithX: strAttrName = "att.with.x"; break;
+ case kslatAttWithY: strAttrName = "att.with.y"; break;
+ case kslatAttWithGpt: strAttrName = "att.with.gpt"; break;
+ case kslatAttWithXoff: strAttrName = "att.with.xoff"; break;
+ case kslatAttWithYoff: strAttrName = "att.with.yoff"; break;
+ case kslatAttLevel: strAttrName = "att.level"; break;
+ case kslatBreak: strAttrName = "breakweight"; break;
+ case kslatCompRef: strAttrName = "component"; break; // << iIndex + 1 - 1-based
+ case kslatDir: strAttrName = "dir"; break;
+ case kslatInsert: strAttrName = "insert"; break;
+ case kslatMeasureSol: strAttrName = "measure.sol"; break;
+ case kslatMeasureEol: strAttrName = "measure.eol"; break;
+ case kslatJStretch: strAttrName = "just.stretch"; break;
+ case kslatJShrink: strAttrName = "just.shrink"; break;
+ case kslatJStep: strAttrName = "just.step"; break;
+ case kslatJWeight: strAttrName = "just.weight"; break;
+ case kslatJWidth: strAttrName = "just.width"; break;
+ case kslatPosX:
+ case kslatPosY:
+ Assert(false);
+ break;
+ case kslatShiftX: strAttrName = "shift.x"; break;
+ case kslatShiftY: strAttrName = "shift.y"; break;
+ default:
+ if (kslatUserDefn <= slat &&
+ slat < kslatUserDefn + ptman->NumUserDefn())
+ {
+ strAttrName.assign("user");
+ char rgch[20];
+ itoa(slat - kslatUserDefn + 1, rgch, 10); // 1-based
+ strAttrName.append(rgch);
+ }
+ else
+ {
+ // Invalid attribute:
+ Warn("bad slot attribute");
+ break;
+ }
+ }
+
+ fLogAssocs = (fLogAssocs || prgfMods[slat]);
+
+ if (slat == kslatCompRef)
+ {
+ for (int icomp = 0; icomp < ccomp; icomp++)
+ {
+ ptman->LogXmlTagOpen(strmOut, "Attribute", nIndent, false);
+ ptman->LogXmlTagAttr(strmOut, "name", strAttrName.c_str());
+ ptman->LogXmlTagAttr(strmOut, "index", icomp+1);
+ int nValue = GetSlotAttrValue(strmOut, ptman, ipass, slat, icomp, fPreJust, fPostJust);
+ ptman->LogXmlTagAttr(strmOut, "newValue", nValue);
+ ptman->LogXmlTagPostAttrs(strmOut, false);
+ ptman->LogXmlTagClose(strmOut, "Attribute", nIndent, false);
+ }
+ }
+ else
+ {
+ std::string strValue = "newValue";
+ if ((!prgfMods[slat] && fBidiNext) || fBidi)
+ strValue = "value";
+
+ ptman->LogXmlTagOpen(strmOut, "Attribute", nIndent, false);
+ ptman->LogXmlTagAttr(strmOut, "name", strAttrName.c_str());
+ int nValue = GetSlotAttrValue(strmOut, ptman, ipass, slat, 0, fPreJust, fPostJust);
+ switch (slat)
+ {
+ case kslatDir: ptman->LogXmlDirCode(strmOut, strValue.c_str(), nValue);break;
+ case kslatBreak: ptman->LogXmlBreakWeight(strmOut, "newValue", nValue); break;
+ default: ptman->LogXmlTagAttr(strmOut, "newValue", nValue); break;
+ }
+ ptman->LogXmlTagPostAttrs(strmOut, false);
+ ptman->LogXmlTagClose(strmOut, "Attribute", nIndent, false);
+ }
+ }
+
+ if (fBidi)
+ {
+ // Output final directionality level
+ ptman->LogXmlTagOpen(strmOut, "Attribute", nIndent, false);
+ ptman->LogXmlTagAttr(strmOut, "name", "directionLevel");
+ ptman->LogXmlTagAttr(strmOut, "value", DirLevel());
+ ptman->LogXmlTagPostAttrs(strmOut, false);
+ ptman->LogXmlTagClose(strmOut, "Attribute", nIndent, false);
+ }
+
+ if (m_vpslotAssoc.size() > 1)
+ fLogAssocs = true; // multiple associations
+ else if (m_vpslotAssoc.size() == 1)
+ {
+ // association change from previous stream
+ GrSlotState * pslotAssoc = AssocSlot(0);
+ if (pslotAssoc == NULL || pslotAssoc->m_islotTmpIn != islot)
+ fLogAssocs = true;
+ }
+ if (fLogAssocs)
+ {
+ std::string strAssocs;
+ char rgch[20];
+ for (size_t iassoc = 0; iassoc < m_vpslotAssoc.size(); iassoc++)
+ {
+ GrSlotState * pslotAssoc = AssocSlot(iassoc);
+ if (pslotAssoc)
+ {
+ int n = pslotAssoc->m_islotTmpIn;
+ memset(rgch,0,20);
+ itoa(n,rgch,10);
+ if (iassoc > 0)
+ strAssocs.append(" ");
+ strAssocs.append(rgch);
+ }
+ }
+ if (strAssocs.length() == 0)
+ strAssocs.assign("??");
+ ptman->LogXmlTagOpen(strmOut, "Associations", nIndent, false);
+ ptman->LogXmlTagAttr(strmOut, "slots", strAssocs.c_str());
+ //ptman->LogXmlTagPostAttrs(strmOut, false);
+ ptman->LogXmlTagClose(strmOut, "Associations", nIndent, false);
+ }
+
+ delete prgfMods;
+}
+
+#if XMLOMIT
+/*----------------------------------------------------------------------------------------------
+ Write out the final positions.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogFinalPositions(std::ostream & strmOut)
+{
+ GrSlotStream * psstrm = OutputStream(m_cpass - 1);
+
+ strmOut << "x position ";
+ for (int islot = 0; islot < psstrm->WritePos(); islot++)
+ {
+ GrSlotState * pslot = psstrm->SlotAt(islot);
+ if (pslot->IsLineBreak(LBGlyphID()))
+ {
+ strmOut << " ";
+ continue;
+ }
+ LogInTable(strmOut, pslot->XPosition());
+ }
+ strmOut << "\n";
+
+ strmOut << "y position ";
+ for (int islot = 0; islot < psstrm->WritePos(); islot++)
+ {
+ GrSlotState * pslot = psstrm->SlotAt(islot);
+ if (pslot->IsLineBreak(LBGlyphID()))
+ {
+ strmOut << " ";
+ continue;
+ }
+ LogInTable(strmOut, pslot->YPosition());
+ }
+ strmOut << "\n";
+}
+
+#endif // XMLOMIT
+
+/*----------------------------------------------------------------------------------------------
+ Log the value of the slot attribute for the given slot. Assume it has changed.
+----------------------------------------------------------------------------------------------*/
+int GrSlotState::GetSlotAttrValue(std::ostream & strmOut, GrTableManager * ptman,
+ int ipass, int slat, int iIndex, bool fPreJust, bool fPostJust)
+{
+ switch (slat)
+ {
+ case kslatAdvX:
+ return int(m_mAdvanceX);
+ case kslatAdvY:
+ return int(m_mAdvanceY);
+
+ case kslatAttTo:
+ return m_srAttachTo;
+
+ case kslatAttAtX: // always do these in pairs
+ return m_mAttachAtX;
+ case kslatAttAtY:
+ return m_mAttachAtY;
+ case kslatAttAtGpt:
+ return m_nAttachAtGpoint;
+
+ case kslatAttAtXoff: // always do these in pairs
+ return m_mAttachAtXOffset;
+ case kslatAttAtYoff:
+ return m_mAttachAtYOffset;
+
+ case kslatAttWithX: // always do these in pairs
+ return m_mAttachWithX;
+ case kslatAttWithY:
+ return m_mAttachWithY;
+
+ case kslatAttWithGpt:
+ return m_nAttachWithGpoint;
+
+ case kslatAttWithXoff: // always do these in pairs
+ return m_mAttachWithXOffset;
+ case kslatAttWithYoff:
+ return m_mAttachWithYOffset;
+
+ case kslatAttLevel:
+ return m_nAttachLevel;
+
+ case kslatBreak:
+ return m_lb;
+
+ case kslatDir:
+ return m_dirc;
+
+ case kslatInsert:
+ return m_fInsertBefore;
+
+ case kslatShiftX:
+ return m_mShiftX;
+ case kslatShiftY:
+ return m_mShiftY;
+ case kslatMeasureSol:
+ return m_mMeasureSol;
+ case kslatMeasureEol:
+ return m_mMeasureEol;
+ case kslatJStretch:
+ return m_mJStretch0;
+ case kslatJShrink:
+ return m_mJShrink0;
+ case kslatJStep:
+ return m_mJStep0;
+ case kslatJWeight:
+ return m_nJWeight0;
+ case kslatJWidth:
+ return m_mJWidth0;
+
+ case kslatCompRef:
+ {
+ GrSlotState * pslotComp = reinterpret_cast<GrSlotState *>(CompRef(iIndex));
+ return pslotComp->m_islotTmpIn;
+ }
+
+ default:
+ if (kslatUserDefn <= slat && slat <= kslatUserDefn + m_cnUserDefn)
+ {
+ int iTmp = slat - kslatUserDefn;
+ return UserDefn(iTmp);
+ }
+ else
+ gAssert(false);
+ }
+
+ return 0;
+}
+
+#endif // TRACING
+
+
+/*----------------------------------------------------------------------------------------------
+ Write out the final underlying-to-surface associations.
+----------------------------------------------------------------------------------------------*/
+void Segment::LogXmlUnderlyingToSurface(std::ostream & strmOut, GrTableManager * ptman,
+ GrCharStream * pchstrm, int nIndent)
+{
+#ifdef TRACING
+
+ ptman->LogXmlTagOpen(strmOut, "UnderlyingToSurface", nIndent, true);
+ ptman->LogXmlTagPostAttrs(strmOut, true);
+
+ ptman->LogXmlUnderlyingAux(strmOut, pchstrm, -m_ichwAssocsMin, (m_ichwAssocsLim - m_ichwAssocsMin),
+ nIndent+1,
+ true, // text
+ false, // features
+ false, // color
+ true, // string offset
+ true, // ligature components
+ true // glyph associations
+ );
+
+ ptman->LogXmlTagClose(strmOut, "UnderlyingToSurface", nIndent, true);
+
+
+#ifdef XMLOMIT
+ ptman->LogXmlTagOpen(strmOut, "UnderlyingToSurface", nIndent, true);
+
+ size_t cassocs = 0;
+ int fLigs = false;
+ int ichw;
+ for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ if (m_prgpvisloutAssocs[ichw])
+ cassocs = max(cassocs, m_prgpvisloutAssocs[ichw]->size());
+ if (m_prgisloutLigature[ichw] != kNegInfinity)
+ fLigs = true;
+ }
+
+ ptman->LogUnderlyingHeader(strmOut, pchstrm->Min(), (pchstrm->Min() + m_ichwAssocsLim),
+ -m_ichwAssocsMin, NULL);
+
+ int rgnChars[MAX_SLOTS];
+ bool rgfNewRun[MAX_SLOTS];
+ std::fill_n(rgfNewRun, MAX_SLOTS, false);
+ GrFeatureValues rgfval[MAX_SLOTS];
+ int cchwMaxRawChars;
+
+ int cchw = pchstrm->GetLogData(ptman, rgnChars, rgfNewRun, rgfval,
+ -m_ichwAssocsMin, &cchwMaxRawChars);
+ cchw = min(cchw, MAX_SLOTS);
+
+ utf16 rgchwChars2[MAX_SLOTS];
+ utf16 rgchwChars3[MAX_SLOTS];
+ utf16 rgchwChars4[MAX_SLOTS];
+ utf16 rgchwChars5[MAX_SLOTS];
+ utf16 rgchwChars6[MAX_SLOTS];
+ int rgcchwRaw[MAX_SLOTS];
+ if (cchwMaxRawChars > 1)
+ {
+ cchwMaxRawChars = min(cchwMaxRawChars, 6);
+ pchstrm->GetLogDataRaw(ptman, cchw, -m_ichwAssocsMin, cchwMaxRawChars,
+ rgnChars, rgchwChars2, rgchwChars3, rgchwChars4, rgchwChars5, rgchwChars6,
+ rgcchwRaw);
+ }
+ else
+ {
+ for (ichw = 0 ; ichw <(m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ rgcchwRaw[ichw] = 1;
+ rgchwChars2[ichw] = 0;
+ rgchwChars3[ichw] = 0;
+ rgchwChars4[ichw] = 0;
+ rgchwChars5[ichw] = 0;
+ rgchwChars6[ichw] = 0;
+ }
+ }
+
+ // Text
+ strmOut << "Text: "; // 15 spaces
+ int inUtf32 = 0;
+ for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ utf16 chw, chwNext;
+ switch (rgcchwRaw[ichw])
+ {
+ default:
+ case 1: chw = utf16(rgnChars[inUtf32]); chwNext = rgchwChars2[inUtf32]; break;
+ case 2: chw = rgchwChars2[inUtf32]; chwNext = rgchwChars3[inUtf32]; break;
+ case 3: chw = rgchwChars3[inUtf32]; chwNext = rgchwChars4[inUtf32]; break;
+ case 4: chw = rgchwChars4[inUtf32]; chwNext = rgchwChars5[inUtf32]; break;
+ case 5: chw = rgchwChars5[inUtf32]; chwNext = rgchwChars6[inUtf32]; break;
+ case 6: chw = rgchwChars6[inUtf32]; chwNext = 0; break;
+ }
+ if (rgcchwRaw[ichw] == 1 && chwNext == 0 && chw < 0x0100) // ANSI
+ strmOut << (char)chw << " "; // 6 spaces
+ else
+ strmOut << " "; // 7 spaces
+ if (chwNext == 0)
+ inUtf32++;
+ }
+ strmOut << "\n";
+
+ // Unicode
+ strmOut << "Unicode: ";
+ inUtf32 = 0;
+ for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ utf16 chw, chwNext;
+ switch (rgcchwRaw[ichw])
+ {
+ default:
+ case 1: chw = utf16(rgnChars[inUtf32]); chwNext = rgchwChars2[inUtf32]; break;
+ case 2: chw = rgchwChars2[inUtf32]; chwNext = rgchwChars3[inUtf32]; break;
+ case 3: chw = rgchwChars3[inUtf32]; chwNext = rgchwChars4[inUtf32]; break;
+ case 4: chw = rgchwChars4[inUtf32]; chwNext = rgchwChars5[inUtf32]; break;
+ case 5: chw = rgchwChars5[inUtf32]; chwNext = rgchwChars6[inUtf32]; break;
+ case 6: chw = rgchwChars6[inUtf32]; chwNext = 0; break;
+ }
+ ptman->LogHexInTable(strmOut, chw, chwNext != 0);
+ if (chwNext == 0)
+ inUtf32++;
+ }
+ strmOut << "\n";
+
+ strmOut << "before ";
+ for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ if (rgcchwRaw[ichw] > 1)
+ // continuation of Unicode codepoint
+ strmOut << " ";
+ else if (m_prgisloutBefore[ichw] == kNegInfinity)
+ strmOut << "<-- ";
+ else if (m_prgisloutBefore[ichw] == kPosInfinity)
+ strmOut << "--> ";
+ else
+ ptman->LogInTable(strmOut, m_prgisloutBefore[ichw]);
+ }
+ strmOut <<"\n";
+
+ for (int ix = 1; ix < signed(cassocs) - 1; ix++) //(cassocs > 2)
+ {
+ if (ix == 1)
+ strmOut << "other ";
+ else
+ strmOut << " ";
+ for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ std::vector<int> * pvislout = m_prgpvisloutAssocs[ichw];
+ if (pvislout == NULL)
+ strmOut << " ";
+ else if (signed(pvislout->size()) <= ix)
+ strmOut << " ";
+ else if ((*pvislout)[ix] != m_prgisloutAfter[ichw])
+ ptman->LogInTable(strmOut, (*pvislout)[ix]);
+ else
+ strmOut << " ";
+ }
+ strmOut << "\n";
+ }
+
+ strmOut << "after ";
+ for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ if (rgcchwRaw[ichw] > 1)
+ // continuation of Unicode codepoint
+ strmOut << " ";
+ else if (m_prgisloutAfter[ichw] == kNegInfinity)
+ strmOut << "<-- ";
+ else if (m_prgisloutAfter[ichw] == kPosInfinity)
+ strmOut << "--> ";
+ else
+ ptman->LogInTable(strmOut, m_prgisloutAfter[ichw]);
+ }
+ strmOut <<"\n";
+
+ if (fLigs)
+ {
+ strmOut << "ligature ";
+ for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ if (rgcchwRaw[ichw] > 1)
+ // continuation of Unicode codepoint
+ strmOut << " ";
+ else if (m_prgisloutLigature[ichw] != kNegInfinity)
+ ptman->LogInTable(strmOut, m_prgisloutLigature[ichw]);
+ else
+ strmOut << " ";
+ }
+ strmOut << "\n";
+
+ strmOut << "component ";
+ for (ichw = 0; ichw < (m_ichwAssocsLim - m_ichwAssocsMin); ichw++)
+ {
+ if (rgcchwRaw[ichw] > 1)
+ // continuation of Unicode codepoint
+ strmOut << " ";
+ else if (m_prgisloutLigature[ichw] != kNegInfinity)
+ ptman->LogInTable(strmOut, m_prgiComponent[ichw] + 1); // 1-based
+ else
+ strmOut << " ";
+ }
+ strmOut << "\n";
+ }
+
+ strmOut << "\n";
+#endif // XMLOMIT
+#endif // TRACING
+
+}
+
+#ifdef XMLOMIT
+
+/*----------------------------------------------------------------------------------------------
+ Write out the final surface-to-underlying associations.
+----------------------------------------------------------------------------------------------*/
+void Segment::LogSurfaceToUnderlying(GrTableManager * ptman, std::ostream & strmOut)
+{
+#ifdef TRACING
+ strmOut << "\nSURFACE TO UNDERLYING MAPPINGS\n\n";
+
+ ptman->LogSlotHeader(strmOut, m_cslout, SP_PER_SLOT, LEADING_SP);
+
+ int ccomp = 0;
+
+ strmOut << "Glyph IDs: ";
+ int islout;
+ for (islout = 0; islout < m_cslout; islout++)
+ {
+ GrSlotOutput * psloutTmp = m_prgslout + islout;
+ if (psloutTmp->SpecialSlotFlag() == kspslLbInitial ||
+ psloutTmp->SpecialSlotFlag() == kspslLbFinal)
+ {
+ strmOut << "# ";
+ }
+ else
+ {
+ ptman->LogHexInTable(strmOut, psloutTmp->GlyphID());
+ ccomp = max(ccomp, psloutTmp->NumberOfComponents());
+ }
+ }
+ strmOut << "\n";
+
+ bool fAnyPseudos = false;
+ for (islout = 0; islout < m_cslout; islout++)
+ {
+ GrSlotOutput * psloutTmp = m_prgslout + islout;
+ if (psloutTmp->GlyphID() != psloutTmp->ActualGlyphForOutput(ptman))
+ {
+ fAnyPseudos = true;
+ break;
+ }
+ }
+ if (fAnyPseudos)
+ {
+ strmOut << "Actual glyphs: ";
+ for (int islout = 0; islout < m_cslout; islout++)
+ {
+ GrSlotOutput * psloutTmp = m_prgslout + islout;
+ if (psloutTmp->GlyphID() != psloutTmp->ActualGlyphForOutput(ptman))
+ ptman->LogHexInTable(strmOut, psloutTmp->ActualGlyphForOutput(ptman));
+ else
+ strmOut << " ";
+ }
+ strmOut << "\n";
+ }
+
+ strmOut << "before ";
+ for (islout = 0; islout < m_cslout; islout++)
+ {
+ GrSlotOutput * psloutTmp = m_prgslout + islout;
+ if (psloutTmp->SpecialSlotFlag() == kspslLbInitial ||
+ psloutTmp->SpecialSlotFlag() == kspslLbFinal)
+ {
+ strmOut << " ";
+ }
+ else
+ ptman->LogInTable(strmOut, psloutTmp->BeforeAssoc());
+ }
+ strmOut << "\n";
+
+ strmOut << "after ";
+ for (islout = 0; islout < m_cslout; islout++)
+ {
+ GrSlotOutput * psloutTmp = m_prgslout + islout;
+ if (psloutTmp->SpecialSlotFlag() == kspslLbInitial ||
+ psloutTmp->SpecialSlotFlag() == kspslLbFinal)
+ {
+ strmOut << " ";
+ }
+ else
+ ptman->LogInTable(strmOut, psloutTmp->AfterAssoc());
+ }
+ strmOut << "\n";
+
+ for (int icomp = 0; icomp < ccomp; icomp++)
+ {
+ strmOut << "component " << icomp + 1 // 1=based
+ << " ";
+ for (islout = 0; islout < m_cslout; islout++)
+ {
+ GrSlotOutput * psloutTmp = m_prgslout + islout;
+ if (psloutTmp->SpecialSlotFlag() == kspslLbInitial ||
+ psloutTmp->SpecialSlotFlag() == kspslLbFinal)
+ {
+ strmOut << " ";
+ }
+ else if (icomp < psloutTmp->NumberOfComponents())
+ ptman->LogInTable(strmOut, psloutTmp->UnderlyingComponent(icomp));
+ else
+ strmOut << " ";
+ }
+ strmOut << "\n";
+ }
+#endif // TRACING
+}
+
+#ifdef TRACING
+/*----------------------------------------------------------------------------------------------
+ Log the value of the association, if the slot changed.
+----------------------------------------------------------------------------------------------*/
+void GrSlotState::LogAssociation(GrTableManager * ptman,
+ std::ostream & strmOut, int ipass, int iassoc, bool fBoth, bool fAfter)
+{
+ if (m_ipassModified != ipass)
+ {
+ strmOut << " ";
+ return;
+ }
+
+ if (fBoth)
+ {
+ GrSlotState * pslotBefore = (m_vpslotAssoc.size()) ? m_vpslotAssoc[0] : NULL;
+ GrSlotState * pslotAfter = (m_vpslotAssoc.size()) ? m_vpslotAssoc.back() : NULL;
+ // handle possible reprocessing
+ while (pslotBefore && pslotBefore->PassModified() == m_ipassModified)
+ pslotBefore = pslotBefore->m_pslotPrevState;
+ while (pslotAfter && pslotAfter->PassModified() == m_ipassModified)
+ pslotAfter = pslotAfter->m_pslotPrevState;
+
+ int nBefore, nAfter;
+
+
+ int csp = 4;
+ if (pslotBefore)
+ {
+ nBefore = pslotBefore->m_islotTmpIn;
+ strmOut << nBefore;
+ if (nBefore > 99) csp--;
+ if (nBefore > 9) csp--;
+ }
+ else
+ {
+ strmOut << "??";
+ csp--;
+ }
+ if (pslotAfter)
+ {
+ nAfter = pslotAfter->m_islotTmpIn;
+ strmOut << "/" << nAfter;
+ if (nAfter > 99) csp--;
+ if (nAfter > 9) csp--;
+ }
+ else
+ {
+ if (pslotBefore)
+ {
+ strmOut << "/" << "??";
+ csp--;
+ }
+ else
+ csp = 5;
+ }
+
+ for (int isp = 0; isp < csp; isp++)
+ strmOut << " ";
+ }
+
+ else if (fAfter)
+ {
+ Assert(m_vpslotAssoc.size());
+ GrSlotState * pslotAfter = m_vpslotAssoc.back();
+ // handle possible reprocessing
+ while (pslotAfter && pslotAfter->PassModified() == m_ipassModified)
+ pslotAfter = pslotAfter->m_pslotPrevState;
+
+ if (pslotAfter)
+ {
+ int nAfter = pslotAfter->m_islotTmpIn;
+ ptman->LogInTable(strmOut, nAfter);
+ }
+ else
+ strmOut << "?? ";
+ }
+ else if (iassoc < signed(m_vpslotAssoc.size()))
+ {
+ GrSlotState * pslot = m_vpslotAssoc[iassoc];
+ // handle possible reprocessing
+ while (pslot && pslot->PassModified() == m_ipassModified)
+ pslot = pslot->m_pslotPrevState;
+
+ if (pslot)
+ {
+ int n = pslot->m_islotTmpIn;
+ ptman->LogInTable(strmOut, n);
+ }
+ else
+ strmOut << "?? ";
+ }
+ else
+ strmOut << " ";
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Write a directionality code to the table.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogDirCodeInTable(std::ostream & strmOut, int dirc)
+{
+ switch (dirc)
+ {
+ case kdircUnknown: strmOut << "??? "; break;
+ case kdircNeutral: strmOut << "ON "; break;
+ case kdircL: strmOut << "L "; break;
+ case kdircR: strmOut << "R "; break;
+ case kdircRArab: strmOut << "AR "; break;
+ case kdircEuroNum: strmOut << "EN "; break;
+ case kdircEuroSep: strmOut << "ES "; break;
+ case kdircEuroTerm: strmOut << "ET "; break;
+ case kdircArabNum: strmOut << "AN "; break;
+ case kdircComSep: strmOut << "CS "; break;
+ case kdircWhiteSpace: strmOut << "WS "; break;
+ case kdircBndNeutral: strmOut << "BN "; break;
+ case kdircNSM: strmOut << "NSM "; break;
+ case kdircLRO: strmOut << "LRO "; break;
+ case kdircRLO: strmOut << "RLO "; break;
+ case kdircLRE: strmOut << "LRE "; break;
+ case kdircRLE: strmOut << "RLE "; break;
+ case kdircPDF: strmOut << "PDF "; break;
+ case kdircPdfL: strmOut << "PDF-L "; break;
+ case kdircPdfR: strmOut << "PDF-R "; break;
+ case kdircLlb: strmOut << "L "; break;
+ case kdircRlb: strmOut << "R "; break;
+ default: LogInTable(strmOut, dirc); break;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write a breakweight code to the table.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogBreakWeightInTable(std::ostream & strmOut, int lb)
+{
+ if (lb < 0)
+ {
+ lb = lb * -1;
+ switch (lb)
+ {
+ case klbWsBreak: strmOut << "-ws "; break;
+ case klbWordBreak: strmOut << "-word "; break;
+ case klbHyphenBreak: strmOut << "-intra "; break;
+ case klbLetterBreak: strmOut << "-lettr "; break;
+ case klbClipBreak: strmOut << "-clip "; break;
+ default: LogInTable(strmOut, lb); break;
+ }
+ }
+ else
+ {
+ switch (lb)
+ {
+ case klbNoBreak: strmOut << "none "; break;
+ case klbWsBreak: strmOut << "ws "; break;
+ case klbWordBreak: strmOut << "word "; break;
+ case klbHyphenBreak: strmOut << "intra "; break;
+ case klbLetterBreak: strmOut << "letter "; break;
+ case klbClipBreak: strmOut << "clip "; break;
+ default: LogInTable(strmOut, lb); break;
+ }
+ }
+}
+
+#endif // TRACING
+
+#endif // XMLOMIT
+
+#ifdef TRACING
+/*----------------------------------------------------------------------------------------------
+ Write an XML tag, leaving it open to possibly add attributes.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogXmlTagOpen(std::ostream & strmOut, std::string strTag, size_t nIndent,
+ bool fContent)
+{
+ for (size_t i = 0; i < nIndent; i++)
+ strmOut << " ";
+
+ strmOut << "<" << strTag;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write the termination of the opening XML tag.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogXmlTagPostAttrs(std::ostream & strmOut,
+ bool fContent)
+{
+ if (fContent)
+ strmOut << ">\n";
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write the closing form of the XML tag.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogXmlTagClose(std::ostream & strmOut, std::string strTag, size_t nIndent,
+ bool fContent)
+{
+ if (fContent)
+ {
+ for (size_t i = 0; i < nIndent; i++)
+ strmOut << " ";
+ strmOut << "</" << strTag << ">\n";
+ }
+ else
+ {
+ strmOut << " />\n";
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write an attribute/value pair inside of a tag.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogXmlTagAttr(std::ostream & strmOut, std::string strAttr, int nValue,
+ size_t nIndent)
+{
+ char chBuf[20];
+ itoa(nValue, chBuf, 10);
+ LogXmlTagAttr(strmOut, strAttr, chBuf, nIndent);
+}
+
+void GrTableManager::LogXmlTagAttr(std::ostream & strmOut, std::string strAttr, const char * szValue,
+ size_t nIndent)
+{
+ if (nIndent > 0)
+ {
+ strmOut << "\n";
+ for (size_t i = 0; i < nIndent + 2; i++)
+ strmOut << " ";
+ }
+ else
+ strmOut << " ";
+
+ strmOut << strAttr << "=\"" << szValue << "\"";
+}
+
+void GrTableManager::LogXmlTagAttrHex(std::ostream & strmOut, std::string strAttr, int nValue,
+ size_t nIndent)
+{
+ char chBuf[20];
+ chBuf[0] = chBuf[1] = chBuf[2] = '0';
+ if (nValue < 0x10)
+ itoa(nValue, chBuf+3, 16); // prepend 3 zeros
+ else if (nValue < 0x100)
+ itoa(nValue, chBuf+2, 16); // prepend 2 zeros
+ else if (nValue < 0x1000)
+ itoa(nValue, chBuf+1, 16); // prepend 1 zero
+ else
+ itoa(nValue, chBuf, 16);
+ LogXmlTagAttr(strmOut, strAttr, chBuf, nIndent);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Concatenate the hex form of the given numbers into a string.
+----------------------------------------------------------------------------------------------*/
+std::string GrTableManager::HexString(std::vector<int> vn)
+{
+ std::string strRet;
+ for (size_t in = 0; in < vn.size(); in++)
+ {
+ char rgch[20];
+ itoa(vn[in],rgch,16);
+ strRet.append(rgch);
+ if (in < vn.size() - 1)
+ strRet.append(" ");
+ }
+ return strRet;
+}
+
+std::string GrTableManager::HexString(int n1, int n2, int n3, int n4, int n5, int n6)
+{
+ std::vector<int> vn;
+ if (n1 > 0)
+ {
+ vn.push_back(n1);
+ if (n2 > 0)
+ {
+ vn.push_back(n2);
+ if (n3 > 0)
+ {
+ vn.push_back(n3);
+ if (n4 > 0)
+ {
+ vn.push_back(n4);
+ if (n5 > 0)
+ {
+ vn.push_back(n5);
+ if (n6 > 0)
+ vn.push_back(n6);
+ }
+ }
+ }
+ }
+ }
+ return HexString(vn);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write an attribute/value pair inside of a tag.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogXmlTagColor(std::ostream & strmOut, std::string strAttr, int clrValue,
+ bool fBack, size_t nIndent)
+{
+ // Ignore black foreground and white background.
+ if (!fBack && clrValue == kclrBlack)
+ return;
+ if (fBack && (clrValue == kclrWhite || clrValue == kclrTransparent))
+ return;
+
+ std::string strValue;
+ char rgch[20];
+ switch (clrValue)
+ {
+ case kclrBlack: strValue = "black"; break;
+ case kclrWhite: strValue = "white"; break;
+ case kclrRed: strValue = "red"; break;
+ case kclrGreen: strValue = "green"; break;
+ case kclrBlue: strValue = "blue"; break;
+ case 0x00ffff: strValue = "yellow"; break;
+ case 0xff00ff: strValue = "magenta"; break;
+ case 0xffff00: strValue = "cyan"; break;
+ default:
+ rgch[0] = '#';
+ itoa(clrValue, rgch+1, 16);
+ strValue.assign(rgch);
+ break;
+ }
+
+ LogXmlTagAttr(strmOut, strAttr, strValue.c_str(), nIndent);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write a directionality code to the table.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogXmlDirCode(std::ostream & strmOut, std::string strAttr, int dircValue,
+ size_t nIndent)
+{
+ std::string strValue;
+ char rgch[20];
+ switch (dircValue)
+ {
+ case kdircUnknown: strValue = "unknown"; break;
+ case kdircNeutral: strValue = "ON"; break;
+ case kdircL: strValue = "L"; break;
+ case kdircR: strValue = "R"; break;
+ case kdircRArab: strValue = "AR"; break;
+ case kdircEuroNum: strValue = "EN"; break;
+ case kdircEuroSep: strValue = "ES"; break;
+ case kdircEuroTerm: strValue = "ET"; break;
+ case kdircArabNum: strValue = "AN"; break;
+ case kdircComSep: strValue = "CS"; break;
+ case kdircWhiteSpace: strValue = "WS"; break;
+ case kdircBndNeutral: strValue = "BN"; break;
+ case kdircNSM: strValue = "NSM"; break;
+ case kdircLRO: strValue = "LRO"; break;
+ case kdircRLO: strValue = "RLO"; break;
+ case kdircLRE: strValue = "LRE"; break;
+ case kdircRLE: strValue = "RLE"; break;
+ case kdircPDF: strValue = "PDF"; break;
+ case kdircPdfL: strValue = "PDF-L"; break;
+ case kdircPdfR: strValue = "PDF-R"; break;
+ case kdircLlb: strValue = "L"; break;
+ case kdircRlb: strValue = "R"; break;
+ default:
+ itoa(dircValue, rgch, 10);
+ strValue.assign(rgch);
+ break;
+ }
+ LogXmlTagAttr(strmOut, strAttr, strValue.c_str(), nIndent);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write a breakweight code to the table.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogXmlBreakWeight(std::ostream & strmOut, std::string strAttr, int lbValue,
+ size_t nIndent)
+{
+ std::string strValue;
+ char rgch[20];
+ if (lbValue < 0)
+ {
+ lbValue = lbValue * -1;
+ switch (lbValue)
+ {
+ case klbWsBreak: strValue = "-ws"; break;
+ case klbWordBreak: strValue = "-word"; break;
+ case klbHyphenBreak: strValue = "-intra"; break;
+ case klbLetterBreak: strValue = "-letter"; break;
+ case klbClipBreak: strValue = "-clip"; break;
+ default:
+ itoa(lbValue * -1, rgch, 10);
+ strValue.assign(rgch);
+ break;
+ }
+ }
+ else
+ {
+ switch (lbValue)
+ {
+ case klbNoBreak: strValue = "none"; break;
+ case klbWsBreak: strValue = "ws"; break;
+ case klbWordBreak: strValue = "word"; break;
+ case klbHyphenBreak: strValue = "intra"; break;
+ case klbLetterBreak: strValue = "letter"; break;
+ case klbClipBreak: strValue = "clip"; break;
+ default:
+ itoa(lbValue, rgch, 10);
+ strValue.assign(rgch);
+ break;
+ }
+ }
+ LogXmlTagAttr(strmOut, strAttr, strValue.c_str(), nIndent);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Add a comment to the log file.
+----------------------------------------------------------------------------------------------*/
+void GrTableManager::LogXmlComment(std::ostream & strmOut, std::string strComment,
+ size_t nIndent)
+{
+ for (size_t i = 0; i < nIndent; i++)
+ strmOut << " ";
+
+ strmOut << "<!-- " << strComment << " -->\n";
+}
+
+
+#endif // TRACING
+
+} // namespace gr
diff --git a/Build/source/libs/graphite/src/segment/resource.h b/Build/source/libs/graphite/src/segment/resource.h
new file mode 100644
index 00000000000..775418f76bf
--- /dev/null
+++ b/Build/source/libs/graphite/src/segment/resource.h
@@ -0,0 +1,15 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by Graphite.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/Build/source/libs/graphite/test/Makefile.am b/Build/source/libs/graphite/test/Makefile.am
new file mode 100644
index 00000000000..96570ad125a
--- /dev/null
+++ b/Build/source/libs/graphite/test/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS = ProfileHarness RegressionTest
+EXTRA_DIST = fonterrors
diff --git a/Build/source/libs/graphite/test/Makefile.in b/Build/source/libs/graphite/test/Makefile.in
new file mode 100644
index 00000000000..29d0d87eeb5
--- /dev/null
+++ b/Build/source/libs/graphite/test/Makefile.in
@@ -0,0 +1,478 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = test
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LSB_RELEASE = @LSB_RELEASE@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+REL_CODENAME = @REL_CODENAME@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SIZEOF_WCHAR_T = @SIZEOF_WCHAR_T@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+SUBDIRS = ProfileHarness RegressionTest
+EXTRA_DIST = fonterrors
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-generic mostlyclean-libtool \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Build/source/libs/graphite/test/ProfileHarness/GrUtfTextSrc.cpp b/Build/source/libs/graphite/test/ProfileHarness/GrUtfTextSrc.cpp
new file mode 100644
index 00000000000..30bfac34a9f
--- /dev/null
+++ b/Build/source/libs/graphite/test/ProfileHarness/GrUtfTextSrc.cpp
@@ -0,0 +1,310 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is sila.mozdev.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Keith Stribley.
+ * Portions created by the Initial Developer are Copyright (C) 2004
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the NPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <graphite/GrClient.h>
+#include <graphite/ITextSource.h>
+#include <graphite/IGrJustifier.h>
+#include <graphite/IGrEngine.h>
+#include <graphite/SegmentAux.h>
+#include <graphite/Font.h>
+#include <graphite/Segment.h>
+#include <graphite/GraphiteProcess.h>
+#include <graphite/FileFont.h>
+
+#include "GrUtfTextSrc.h"
+
+
+
+GrUtfTextSrc::GrUtfTextSrc()
+: mLength(0),
+ mBufferLength8(64), mBufferLength16(64), mBufferLength32(64),
+ mData8(NULL), mData16(NULL), mData32(NULL),
+ mType(gr::kutf16),
+ mForeground(gr::kclrBlack), mBackground(gr::kclrTransparent),
+ mSelectForeground(0), mSelectBackground(0),
+ mIsSelected(false),
+ mFont(NULL),
+ mRtl(false)
+{
+
+}
+
+GrUtfTextSrc::~GrUtfTextSrc()
+{
+ if (mData8) delete [] mData8;
+ if (mData16) delete [] mData16;
+ if (mData32) delete [] mData32;
+ mSelectionVector.clear();
+}
+
+bool GrUtfTextSrc::setText(const char * pszText, int len)
+{
+ return setText((gr::utf8*)pszText, len);
+}
+
+bool GrUtfTextSrc::setText(const gr::utf8 * pszText, int len)
+{
+ mType = gr::kutf8;
+ mLength = len;
+ if (!checkBuffer8()) return false;
+
+ for(size_t i = 0; i < mLength; i++)
+ {
+ mData8[i] = pszText[i];
+ // stray line feeds and other control characters from the html file
+ // cause artificial truncation of segments
+ if (mData8[i] < 0x0020)//(pszText[i] == '\n' || pszText[i] == '\r')
+ mData8[i] = 0x20; // ZWSP
+ }
+ mData8[mLength] = '\0'; // zero-terminate
+ mSelectionVector.clear();
+ mIsSelected = false;
+ return true;
+}
+
+
+bool GrUtfTextSrc::setText(const gr::utf16 * pszText, int len)
+{
+ mType = gr::kutf16;
+ mLength = len;
+ if (!checkBuffer16()) return false;
+
+ for(size_t i = 0; i < mLength; i++)
+ {
+ mData16[i] = pszText[i];
+ // stray line feeds and other control characters from the html file
+ // cause artificial truncation of segments
+ if (mData16[i] < 0x0020)//(pszText[i] == '\n' || pszText[i] == '\r')
+ mData16[i] = 0x200B; // ZWSP
+ }
+ mData16[mLength] = '\0'; // zero-terminate
+ mSelectionVector.clear();
+ mIsSelected = false;
+ return true;
+}
+
+bool GrUtfTextSrc::setText(const gr::utf32 * pszText, int len)
+{
+ mType = gr::kutf32;
+ mLength = len;
+ if (!checkBuffer32()) return false;
+
+ for(size_t i = 0; i < mLength; i++)
+ {
+ mData32[i] = pszText[i];
+ }
+ mData32[mLength] = '\0'; // zero-terminate
+ mSelectionVector.clear();
+ mIsSelected = false;
+ return true;
+}
+
+bool GrUtfTextSrc::checkBuffer8(void)
+{
+ if (!mData8 || mBufferLength8 < mLength + 1)
+ {
+ do
+ {
+ mBufferLength8 *= 2;
+ } while (mBufferLength8 < mLength + 1);
+ if (mData8) delete [] mData8;
+ mData8 = new gr::utf8[mBufferLength8];
+ }
+ return (mData8) ? true : false;
+}
+
+bool GrUtfTextSrc::checkBuffer16(void)
+{
+ if (!mData16 || mBufferLength16 < mLength + 1)
+ {
+ do
+ {
+ mBufferLength16 *= 2;
+ } while (mBufferLength16 < mLength + 1);
+ if (mData16) delete [] mData16;
+ mData16 = new gr::utf16[mBufferLength16];
+ }
+ return (mData16) ? true : false;
+}
+
+bool GrUtfTextSrc::checkBuffer32(void)
+{
+ if (!mData32 || mBufferLength32 < mLength + 1)
+ {
+ do
+ {
+ mBufferLength32 *= 2;
+ } while (mBufferLength32 < mLength + 1);
+ if (mData32) delete [] mData32;
+ mData32 = new gr::utf32[mBufferLength32];
+ }
+ return (mData32) ? true : false;
+}
+
+size_t GrUtfTextSrc::fetch(gr::toffset ichMin, size_t cch, gr::utf8 * prgchwBuffer)
+{
+ assert(cch <= mLength);
+ if (cch > mLength)
+ {
+ return 0;
+ }
+ std::copy(mData8 + ichMin, mData8 + ichMin + cch, prgchwBuffer);
+ return (cch - ichMin);
+}
+
+size_t GrUtfTextSrc::fetch(gr::toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer)
+{
+ assert(cch <= mLength);
+ if (cch > mLength)
+ {
+ return 0;
+ }
+ std::copy(mData16 + ichMin, mData16 + ichMin + cch, prgchwBuffer);
+ return (cch - ichMin);
+}
+
+size_t GrUtfTextSrc::fetch(gr::toffset ichMin, size_t cch, gr::utf32 * prgchwBuffer)
+{
+ assert(cch <= mLength);
+ if (cch > mLength)
+ {
+ return 0;
+ }
+ std::copy(mData32 + ichMin, mData32 + ichMin + cch, prgchwBuffer);
+ return (cch - ichMin);
+}
+
+
+bool GrUtfTextSrc::getRightToLeft(gr::toffset ich)
+{
+ return mRtl; // assumes src only contains one direction
+}
+
+unsigned int GrUtfTextSrc::getDirectionDepth(gr::toffset ich)
+{
+ return (mRtl) ? 1 : 0; // TBD
+}
+
+std::pair<gr::toffset, gr::toffset> GrUtfTextSrc::propertyRange(gr::toffset ich)
+{
+ std::pair<gr::toffset, gr::toffset> range(0, mLength);
+ if (mIsSelected)
+ {
+ bool selectState = mSelectionVector[ich];
+ // find start
+ int s = ich - 1;
+ int e = ich + 1;
+ if (s > -1)
+ for ( ; s >= 0; s--)
+ {
+ if (mSelectionVector[s] != selectState)
+ {
+ s++; // backup
+ break;
+ }
+ }
+ if (s < 0) s = 0;
+ // find end
+ for ( ; e < static_cast<int>(mLength); e++)
+ {
+ if (mSelectionVector[e] != selectState)
+ {
+ // don't need to backup for end
+ break;
+ }
+ }
+ range.first = s;
+ range.second = e;
+ }
+ return range;
+}
+
+size_t GrUtfTextSrc::getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset)
+{
+ return 0;
+}
+
+void GrUtfTextSrc::getColors(gr::toffset ich, int * pclrFore, int * pclrBack)
+{
+ // selections are handled here
+ if (mIsSelected && mSelectionVector[ich])
+ {
+ *pclrFore = mSelectForeground;
+ *pclrBack = mSelectBackground;
+ }
+ else
+ {
+ *pclrFore = mForeground;
+ *pclrBack = mBackground;
+ }
+}
+
+
+// these should be called I hope
+float
+GrUtfTextSrc::getFontSize(gr::toffset ich)
+{
+ assert(mFont);
+ return mPointSize;
+}
+
+bool
+GrUtfTextSrc::getBold(gr::toffset ich)
+{
+ assert(mFont);
+// NS_ASSERTION(false, "unexpected call to getBold");
+// return false;
+ return mFont->bold();
+}
+
+bool
+GrUtfTextSrc::getItalic(gr::toffset ich)
+{
+ assert(mFont);
+ //NS_ASSERTION(false, "unexpected call to getItalic");
+ //return false;
+ return mFont->italic();
+}
+
+gr::isocode GrUtfTextSrc::getLanguage(gr::toffset ich)
+{
+ gr::isocode unknown;
+ std::fill_n(unknown.rgch, 4, '\0');
+ return unknown;
+}
+
diff --git a/Build/source/libs/graphite/test/ProfileHarness/GrUtfTextSrc.h b/Build/source/libs/graphite/test/ProfileHarness/GrUtfTextSrc.h
new file mode 100644
index 00000000000..cae0a4850b5
--- /dev/null
+++ b/Build/source/libs/graphite/test/ProfileHarness/GrUtfTextSrc.h
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is sila.mozdev.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Keith Stribley.
+ * Portions created by the Initial Developer are Copyright (C) 2004
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the NPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GRUTFTXTSRC_INCLUDED
+#define GRUTFTXTSRC_INCLUDED
+
+#include <vector>
+#include <assert.h>
+
+#include <graphite/GrAppData.h>
+#include <graphite/GrStructs.h>
+#include <graphite/ITextSource.h>
+
+class nsIGrSegWrapper;
+
+/*-----------------------------------------------------------------------------
+ Class: ITextSource
+ This class provides an interface of a text source for the Graphite engine.
+------------------------------------------------------------------------------*/
+class GrUtfTextSrc : public gr::IColorTextSource
+{
+public:
+ GrUtfTextSrc();
+ ~GrUtfTextSrc();
+ bool setText(const gr::utf8 * pszText, int len);
+ bool setText(const char * pszText, int len);
+ bool setText(const gr::utf16 * pszText, int len);
+ bool setText(const gr::utf32 * pszText, int len);
+ void setColors(int foreground, int background)
+ {
+ mForeground = foreground;
+ mBackground = background;
+ };
+ //void setSelectionDetails(nsIGrSegWrapper * wrapper);
+ void setFont(gr::Font * font) { mFont = font; };
+ void setPointSize(float & pointSize) { mPointSize = pointSize; };
+ // --------------------------------------------------------------------------
+ // New V2 interface:
+
+ virtual gr::UtfType utfEncodingForm() { return mType; };
+ virtual size_t getLength() { return mLength; };
+ virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf32 * prgchBuffer);
+ virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer);
+ virtual size_t fetch(gr::toffset ichMin, size_t cch, gr::utf8 * prgchsBuffer);
+ virtual gr::GrResult getFaceName(int ich, unsigned int cchMax,
+ gr::utf16 * prgchFaceName, unsigned int * pcchLen)
+ {
+ prgchFaceName[0] = 0;
+ *pcchLen = 0;
+ return gr::kresNotImpl;
+ };
+ //virtual std::wstring getFaceName(int ich) { return mFont->getFaceName(); };
+ virtual float getFontSize(gr::toffset ich);
+ virtual bool getBold(gr::toffset ich);
+ virtual bool getItalic(gr::toffset ich);
+ virtual bool getRightToLeft(gr::toffset ich);
+ virtual unsigned int getDirectionDepth(gr::toffset ich);
+ virtual float getVerticalOffset(gr::toffset ich) { return 0;};
+ virtual gr::isocode getLanguage(gr::toffset ich);
+
+ virtual std::pair<gr::toffset, gr::toffset> propertyRange(gr::toffset ich);
+ virtual size_t getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset);
+ virtual bool sameSegment(gr::toffset ich1, gr::toffset ich2) { return true; };
+
+protected:
+ bool checkBuffer8();
+ bool checkBuffer16();
+ bool checkBuffer32();
+
+private:
+ size_t mLength;
+ size_t mBufferLength8;
+ size_t mBufferLength16;
+ size_t mBufferLength32;
+ gr::utf8 * mData8;
+ gr::utf16 * mData16;
+ gr::utf32 * mData32;
+ gr::UtfType mType;
+ int mForeground;
+ int mBackground;
+ int mSelectForeground;
+ int mSelectBackground;
+ bool mIsSelected;
+ std::wstring mFaceName;
+ std::vector<bool> mSelectionVector;
+ gr::Font * mFont;
+ bool mRtl;
+ float mPointSize;
+
+public: // methods that will go
+ // Temporary--eventually these will be of interest only to SegmentPainter.
+ virtual void getColors(gr::toffset ich, int * pclrFore, int * pclrBack);
+
+ // Shouldn't be here!
+ virtual gr::GrResult Fetch(int ichMin, int ichLim, gr::utf16 * prgchBuf) { return gr::kresNotImpl; };
+ virtual gr::GrResult get_Length(int * pcch) { return gr::kresNotImpl; };
+ virtual gr::GrResult GetFontVariations(int ich,
+ wchar_t * prgchFontVar, int ichMax, int * pich,
+ int * pichMin, int * pichLim) { return gr::kresNotImpl; };
+
+};
+
+
+#if !defined(GR_NAMESPACE)
+using namespace gr;
+#endif
+
+#endif // !GRUTFTXTSRC_INCLUDED
+
diff --git a/Build/source/libs/graphite/test/ProfileHarness/Makefile.am b/Build/source/libs/graphite/test/ProfileHarness/Makefile.am
new file mode 100644
index 00000000000..07d07348eff
--- /dev/null
+++ b/Build/source/libs/graphite/test/ProfileHarness/Makefile.am
@@ -0,0 +1,14 @@
+AUTOMAKE_OPTIONS = 1.6
+
+noinst_PROGRAMS = profile-graphite
+
+AM_CPPFLAGS = -I$(top_srcdir)/include
+
+profile_graphite_LDFLAGS = -L$(top_builddir)/src -lgraphite
+
+profile_graphite_SOURCES = \
+ GrUtfTextSrc.cpp GrUtfTextSrc.h \
+ ProfileHarness.cpp
+
+#dist-hook:
+# rm -f grregtest.log tracelog.txt
diff --git a/Build/source/libs/graphite/test/ProfileHarness/Makefile.in b/Build/source/libs/graphite/test/ProfileHarness/Makefile.in
new file mode 100644
index 00000000000..a9d264683b2
--- /dev/null
+++ b/Build/source/libs/graphite/test/ProfileHarness/Makefile.in
@@ -0,0 +1,447 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+noinst_PROGRAMS = profile-graphite$(EXEEXT)
+subdir = test/ProfileHarness
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+PROGRAMS = $(noinst_PROGRAMS)
+am_profile_graphite_OBJECTS = GrUtfTextSrc.$(OBJEXT) \
+ ProfileHarness.$(OBJEXT)
+profile_graphite_OBJECTS = $(am_profile_graphite_OBJECTS)
+profile_graphite_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(profile_graphite_SOURCES)
+DIST_SOURCES = $(profile_graphite_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LSB_RELEASE = @LSB_RELEASE@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+REL_CODENAME = @REL_CODENAME@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SIZEOF_WCHAR_T = @SIZEOF_WCHAR_T@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AUTOMAKE_OPTIONS = 1.6
+AM_CPPFLAGS = -I$(top_srcdir)/include
+profile_graphite_LDFLAGS = -L$(top_builddir)/src -lgraphite
+profile_graphite_SOURCES = \
+ GrUtfTextSrc.cpp GrUtfTextSrc.h \
+ ProfileHarness.cpp
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/ProfileHarness/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign test/ProfileHarness/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+profile-graphite$(EXEEXT): $(profile_graphite_OBJECTS) $(profile_graphite_DEPENDENCIES)
+ @rm -f profile-graphite$(EXEEXT)
+ $(CXXLINK) $(profile_graphite_LDFLAGS) $(profile_graphite_OBJECTS) $(profile_graphite_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrUtfTextSrc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ProfileHarness.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstPROGRAMS ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-info-am
+
+
+#dist-hook:
+# rm -f grregtest.log tracelog.txt
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Build/source/libs/graphite/test/ProfileHarness/ProfileHarness.cpp b/Build/source/libs/graphite/test/ProfileHarness/ProfileHarness.cpp
new file mode 100644
index 00000000000..361d6a6b734
--- /dev/null
+++ b/Build/source/libs/graphite/test/ProfileHarness/ProfileHarness.cpp
@@ -0,0 +1,476 @@
+/*-----------------------------------------------------------------------------
+Copyright (C) 2007 SIL International
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File:
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+A simple console app that creates a segment using FileFont and dumps a
+diagnostic table of the resulting glyph vector to the console.
+If graphite has been built with -DTRACING then it will also produce a
+diagnostic log of the segment creation in grSegmentLog.txt
+-----------------------------------------------------------------------------*/
+
+//#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <sstream>
+#include <cstring>
+
+#include <graphite/GrClient.h>
+#include <graphite/ITextSource.h>
+///#include <graphite/IGrJustifier.h>
+#include <graphite/IGrEngine.h>
+#include <graphite/SegmentAux.h>
+#include <graphite/Font.h>
+#include <graphite/Segment.h>
+#include <graphite/GraphiteProcess.h>
+#include <graphite/FileFont.h>
+
+#include "GrUtfTextSrc.h"
+
+typedef std::pair< gr::GlyphIterator, gr::GlyphIterator > GlyphRange;
+
+#ifndef HAVE_STRTOF
+float strtof(char * text, char ** ignore)
+{
+ return static_cast<float>(atof(text));
+}
+#endif
+
+#ifndef HAVE_STRTOL
+long strtol(char * text, char ** ignore)
+{
+ return atol(text);
+}
+#endif
+
+struct Parameters
+{
+ const char * textFile;
+ const char * fontFile;
+ float pointSize;
+ int dpi;
+ bool lineStart;
+ bool lineEnd;
+ bool useLineFill;
+ bool useCodes;
+ float width;
+ int textArgIndex;
+ gr::utf16 * pText16;
+ gr::utf32 * pText32;
+ size_t charLength;
+ size_t offset;
+};
+
+#ifdef HAVE_ICONV
+void
+convertUtf8ToUtf32(char* pText, Parameters & parameters)
+{
+ int length = strlen(reinterpret_cast<char*>(pText));
+ //gr::utf8 * pText = reinterpret_cast<gr::utf8*>(argv[2]);
+ // convert text to utf32 using iconv because its easier to debug string placements
+ size_t bytesLeft = length;
+ size_t outBytesLeft = (length + 1) * sizeof(gr::utf32);
+ size_t outBufferSize = outBytesLeft;
+ gr::utf32 * text32 = new gr::utf32[length + 1];
+ iconv_t utf8to32 = iconv_open("utf32","utf8");
+ assert(utf8to32 != (iconv_t)(-1));
+ char * pText32 = reinterpret_cast<char*>(&text32[0]);
+ size_t convertLength = iconv(utf8to32, &pText, &bytesLeft, &pText32, &outBytesLeft);
+ if (convertLength == size_t(-1)) perror("iconv failed:");
+ size_t charLength = (outBufferSize - outBytesLeft) / sizeof(gr::utf32);
+ assert(convertLength != size_t(-1));
+ // size_t offset = 0;
+ // offset by 1 to avoid bom
+ if (text32[0] == 0xfeff)
+ {
+ parameters.offset = 1;
+ charLength--;
+ }
+ std::cout << "String has " << charLength << " characters (" << length << " bytes)" << std::endl;
+ size_t ci;
+ for (ci = 0; ci < 10 && ci < charLength; ci++)
+ {
+ std::cout << std::setw(4) << ci << '\t';
+ }
+ std::cout << std::endl;
+ for (ci = 0; ci < charLength; ci++)
+ {
+ std::cout << std::setw(4) << std::hex
+ << text32[ci+parameters.offset] << '\t';
+ if (((ci + 1) % 10) == 0) std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ parameters.charLength = charLength;
+ parameters.pText32 = text32;
+ iconv_close(utf8to32);
+}
+#endif
+
+bool parseArgs(int argc, char *argv[], Parameters & parameters)
+{
+ int mainArgOffset = 0;
+ bool argError = false;
+ char* pText = NULL;
+ typedef enum
+ {
+ NONE,
+ POINT_SIZE,
+ DPI,
+ LINE_START,
+ LINE_END,
+ LINE_FILL,
+ CODES
+ } TestOptions;
+ TestOptions option = NONE;
+ char * pIntEnd = NULL;
+ char * pFloatEnd = NULL;
+ long lTestSize = 0;
+ float fTestSize = 0.0f;
+ for (int a = 1; a < argc; a++)
+ {
+ switch (option)
+ {
+ case DPI:
+ pIntEnd = NULL;
+ lTestSize = strtol(argv[a],&pIntEnd, 10);
+ if (lTestSize > 0 && lTestSize < INT_MAX && lTestSize != LONG_MAX)
+ {
+ parameters.dpi = lTestSize;
+ }
+ else
+ {
+ fprintf(stderr,"Invalid dpi %s\n", argv[a]);
+ }
+ option = NONE;
+ break;
+ case POINT_SIZE:
+ pFloatEnd = NULL;
+ fTestSize = strtof(argv[a],&pFloatEnd);
+ // what is a reasonable maximum here
+ if (fTestSize > 0 && fTestSize < 5000.0f)
+ {
+ parameters.pointSize = fTestSize;
+ }
+ else
+ {
+ fprintf(stderr,"Invalid point size %s\n", argv[a]);
+ argError = true;
+ }
+ option = NONE;
+ break;
+ case LINE_FILL:
+ pFloatEnd = NULL;
+ fTestSize = strtof(argv[a],&pFloatEnd);
+ // what is a good max width?
+ if (fTestSize > 0 && fTestSize < 10000)
+ {
+ parameters.width = fTestSize;
+ }
+ else
+ {
+ fprintf(stderr,"Invalid line width %s\n", argv[a]);
+ argError = true;
+ }
+ option = NONE;
+ break;
+ default:
+ option = NONE;
+ if (argv[a][0] == '-')
+ {
+ if (strcmp(argv[a], "-pt") == 0)
+ {
+ option = POINT_SIZE;
+ }
+ else if (strcmp(argv[a], "-dpi") == 0)
+ {
+ option = DPI;
+ }
+ else if (strcmp(argv[a], "-ls") == 0)
+ {
+ option = NONE;
+ parameters.lineStart = true;
+ }
+ else if (strcmp(argv[a], "-le") == 0)
+ {
+ option = NONE;
+ parameters.lineEnd = true;
+ }
+ else if (strcmp(argv[a], "-linefill") == 0)
+ {
+ option = LINE_FILL;
+ parameters.useLineFill = true;
+ }
+ else if (strcmp(argv[a], "-codes") == 0)
+ {
+ option = NONE;
+ parameters.useCodes = true;
+ // must be less than argc
+ parameters.pText32 = new gr::utf32[argc];
+ printf("\nText codes\n");
+ }
+ else
+ {
+ argError = true;
+ fprintf(stderr,"Unknown option %s\n",argv[a]);
+ }
+ }
+ else if (mainArgOffset == 0)
+ {
+ parameters.textFile = argv[a];
+ mainArgOffset++;
+ }
+ else if (mainArgOffset == 1)
+ {
+ parameters.fontFile = argv[a];
+ mainArgOffset++;
+ }
+ else if (parameters.useCodes)
+ {
+ pIntEnd = NULL;
+ mainArgOffset++;
+ gr::utf32 code = strtol(argv[a],&pIntEnd, 16);
+ if (code > 0)
+ {
+ parameters.pText32[parameters.charLength++] = code;
+ if (parameters.charLength % 10 == 0)
+ printf("%4x\n",code);
+ else
+ printf("%4x\t",code);
+ }
+ else
+ {
+ fprintf(stderr,"Invalid dpi %s\n", argv[a]);
+ }
+ }
+ else if (mainArgOffset == 1)
+ {
+ mainArgOffset++;
+ pText = argv[a];
+ parameters.textArgIndex = a;
+ }
+ else
+ {
+ argError = true;
+ fprintf(stderr,"too many arguments %s\n",argv[a]);
+ }
+ }
+ }
+ if (mainArgOffset < 2) argError = true;
+ else
+ {
+ if (!parameters.useCodes && pText != NULL)
+ {
+#ifdef HAVE_ICONV
+ convertUtf8ToUtf32(pText, parameters);
+#else
+ fprintf(stderr,"Only the -codes option is supported on Win32\r\n");
+ argError = true;
+#endif
+ }
+ else
+ {
+ ///parameters.pText32[parameters.charLength] = 0;
+ printf("\n");
+ }
+ }
+ return (argError) ? false : true;
+}
+
+
+void initParameters(Parameters & parameters)
+{
+ parameters.textFile = "";
+ parameters.fontFile = "";
+ parameters.pointSize = 12.0f;
+ parameters.dpi = 72;
+ parameters.lineStart = false;
+ parameters.lineEnd = false;
+ parameters.useLineFill = false;
+ parameters.useCodes = false;
+ parameters.width = 100.0f;
+ parameters.pText16 = NULL;
+ parameters.pText32 = NULL;
+ parameters.textArgIndex = 0;
+ parameters.charLength = 0;
+ parameters.offset = 0;
+}
+
+
+
+int runGraphite(Parameters parameters)
+{
+ int returnCode = 0;
+ FILE * file = fopen(parameters.fontFile, "rb");
+ gr::FileFont * fileFont = NULL;
+
+ // Put the text into an array of string, each string is one paragraph.
+ std::ifstream textFileStrm(parameters.textFile);
+ std::cout << "FILE: " << parameters.textFile << "\n";
+ std::string stringArray[100];
+
+ std::stringbuf buf;
+ textFileStrm >> &buf;
+ std::cout << "read " << buf.str().length() << " characters" << std::endl;
+ std::cout << "====BEGIN===" << buf.str() << "====END====" << std::endl;
+ const std::string strTemp = buf.str();
+ stringArray[0] = strTemp;
+ int cpara = 1;
+
+ try
+ {
+ if (file)
+ {
+ fileFont = new gr::FileFont(file, parameters.pointSize, parameters.dpi);
+ if (!fileFont || !fileFont->isValid())
+ {
+ fprintf(stderr,"graphitejni:Invalid font!");
+ delete fileFont;
+ fileFont = NULL;
+ return 2;
+ }
+ printf("Font: %s bold=%d italic=%d %4.1fpt dpi %d\n",
+ parameters.fontFile,
+ fileFont->bold(), fileFont->italic(),
+ parameters.pointSize, parameters.dpi);
+ bool isGraphite = fileFont->fontHasGraphiteTables();
+ if (!isGraphite)
+ {
+ fprintf(stderr,"graphitejni: %s does not have graphite tables",
+ parameters.fontFile);
+ delete fileFont;
+ fileFont = NULL;
+ return 3;
+ }
+ }
+ else
+ {
+ fprintf(stderr, "Failed to open %s\n", parameters.fontFile);
+ return 4;
+ }
+
+ for (int ipara = 0; ipara < cpara; ipara++)
+ {
+ GrUtfTextSrc textSrc;
+ gr::LayoutEnvironment layout;
+
+ textSrc.setText(stringArray[ipara].data(), stringArray[ipara].length());
+ textSrc.setPointSize(parameters.pointSize);
+ textSrc.setFont(fileFont);
+
+ layout.setStartOfLine(parameters.lineStart);
+ layout.setEndOfLine(parameters.lineEnd);
+ layout.setDumbFallback(true);
+ layout.setJustifier(NULL);
+
+ gr::Segment * pSegment = NULL;
+ //try
+ //{
+ if (parameters.useLineFill)
+ {
+ pSegment = new gr::LineFillSegment(fileFont, &textSrc, &layout,
+ 0, stringArray[ipara].length(),
+ parameters.width);
+ printf("LineFillSegment overing char %d - %d\nline start=%d line end=%d\n",
+ pSegment->startCharacter(), pSegment->stopCharacter(),
+ parameters.lineStart, parameters.lineEnd);
+ }
+ else
+ {
+ pSegment = new gr::RangeSegment(fileFont, &textSrc, &layout,
+ 0, stringArray[ipara].length());
+ printf("RangeSegment covering char %d - %d\nline start=%d line end=%d\n",
+ pSegment->startCharacter(), pSegment->stopCharacter(),
+ parameters.lineStart, parameters.lineEnd);
+ }
+ //}
+ //catch (...)
+ //{
+ // printf("Exception occurred while creating segment\n");
+ // returnCode = 5;
+ // throw;
+ //}
+
+ if (!pSegment) return returnCode;
+
+ // for justifier testing
+ /*
+ gr::GrJustifier justifier;
+ pSegment->SetJustifier(&justifier);
+ gr::Segment * justified = gr::Segment::JustifiedSegment(*pSegment, 2.0f * advanceWidth);
+ delete justified;
+ */
+
+ delete pSegment;
+ }
+ }
+ catch (...)
+ {
+ printf("Exception occurred\n");
+ returnCode = 5;
+ }
+
+ delete fileFont;
+
+ return returnCode;
+}
+
+#ifdef WIN32
+
+int _tmain(int argc, _TCHAR* argv[])
+{
+ Parameters parameters;
+ initParameters(parameters);
+
+ if (!parseArgs(argc, argv, parameters))
+ {
+ fprintf(stderr,"Usage: %s [options] textfile fontfile \n",argv[0]);
+ return 1;
+ }
+ // UTF16 arguments
+ //if (parameters.textArgIndex > 0)
+ //{
+ // parameters.pText16 = reinterpret_cast<wchar_t*>(argv[parameters.textArgIndex]);
+ // std::wstring text(parameters.pText16);
+ // parameters.charLength = text.size();
+ // for (int i = 0; i < text.size(); i++)
+ // {
+ // if (i % 10 == 0)
+ // printf("\r\n%4x", text[i]);
+ // else
+ // printf("\t%4x", text[i]);
+ // }
+ //}
+ //else
+ //{
+ // assert(parameters.pText32);
+ //}
+
+ return runGraphite(parameters);
+}
+
+#else
+
+int main(int argc, char *argv[])
+{
+
+ Parameters parameters;
+ initParameters(parameters);
+
+ if (!parseArgs(argc, argv, parameters))
+ {
+ fprintf(stderr,"Usage: %s [options] textfile fontfile \n",argv[0]);
+ return 1;
+ }
+ return runGraphite(parameters);
+}
+
+#endif
diff --git a/Build/source/libs/graphite/test/ProfileHarness/makefile.vc b/Build/source/libs/graphite/test/ProfileHarness/makefile.vc
new file mode 100644
index 00000000000..5f42ba97b3b
--- /dev/null
+++ b/Build/source/libs/graphite/test/ProfileHarness/makefile.vc
@@ -0,0 +1,111 @@
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+
+!IF "$(CFG)" == ""
+CFG=DEBUG
+!ENDIF
+
+!IF "$(CFG)" == "RELEASE"
+
+OUTDIR=.\release
+INTDIR=.\release_temp
+
+all : "$(OUTDIR)\ProfileHarness.exe"
+
+clean :
+ @- rd /s/q .\release_temp
+
+realclean : clean
+ @- rd /s/q .\release
+
+CPP_PROJ=/nologo /MT /W3 /GR /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /c
+LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shell32.lib uuid.lib graphite.lib /nologo /subsystem:console /incremental:no /machine:I386 /out:"$(OUTDIR)\ProfileHarness.exe" /libpath:"..\..\release"
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\ProfileHarness.bsc"
+
+!ELSEIF "$(CFG)" == "DEBUG"
+
+OUTDIR=.\debug
+INTDIR=.\debug_temp
+
+all : "$(OUTDIR)\ProfileHarness.exe" "$(OUTDIR)\ProfileHarness.bsc"
+
+clean :
+ @- rd /s/q .\debug_temp
+
+realclean : clean
+ @- rd /s/q .\debug
+
+CPP_PROJ=/nologo /MTd /W3 /Gm /GR /GX /GZ /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"$(INTDIR)\\" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /c
+LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shell32.lib uuid.lib graphite.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\ProfileHarness.pdb" /debug /machine:I386 /out:"$(OUTDIR)\ProfileHarness.exe" /libpath:"..\..\debug"
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\ProfileHarness.bsc"
+
+!ENDIF
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+"$(INTDIR)" :
+ if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+{$(APPLIB)}.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+{$(APPLIB)}.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+{$(TEXTSRCDIR)}.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+{$(TEXTSRCDIR)}.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+
+CPP=cl.exe
+RSC=rc.exe
+BSC32=bscmake.exe
+LINK32=link.exe
+
+LINK32_OBJS= \
+ "$(INTDIR)\ProfileHarness.obj" \
+ "$(INTDIR)\GrUtfTextSrc.obj" \
+
+"$(OUTDIR)\ProfileHarness.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+BSC32_SBRS= \
+ "$(INTDIR)\ProfileHarness.sbr" \
+ "$(INTDIR)\GrUtfTextSrc.sbr"
+
+"$(OUTDIR)\ProfileHarness.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
+ $(BSC32) @<<
+ $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+
+"$(INTDIR)\ProfileHarness.obj" "$(INTDIR)\ProfileHarness.sbr" : ".\ProfileHarness.cpp" "$(INTDIR)"
+"$(INTDIR)\GrTxtSrc.obj" "$(INTDIR)\GrUtfTextSrc.sbr" : ".\GrUtfTextSrc.cpp" "$(INTDIR)"
+
+
diff --git a/Build/source/libs/graphite/test/RegressionTest/GrJustifier.cpp b/Build/source/libs/graphite/test/RegressionTest/GrJustifier.cpp
new file mode 100644
index 00000000000..566811c9907
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/GrJustifier.cpp
@@ -0,0 +1,566 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2003 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrJustifier.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ A default justification agent for Graphite.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+//#include "main.h" // This is used by clients, so main.h is not available
+
+#pragma hdrstop
+// any other headers (not precompiled)
+#include "GrClient.h"
+#include "ITextSource.h"
+#include "IGrJustifier.h"
+#include "GraphiteProcess.h"
+#include "GrDebug.h"
+
+#include "GrJustifier.h"
+
+#ifdef WIN32
+#include <string>
+#endif
+
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:>********************************************************************************************
+//:> Global constants
+//:>********************************************************************************************
+
+const int g_cnPrimes = 7;
+static const int g_rgnPrimes[] =
+{
+ 2, 3, 5, 7, 11, 13, 17, // these primes will allow a range of weights up to 255
+ // 19, 23, 31, 37, 41, 43, 47, 53, 59, 61
+};
+
+//:>********************************************************************************************
+//:> Forward declarations
+//:>********************************************************************************************
+
+//:>********************************************************************************************
+//:> Methods
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Constructors.
+----------------------------------------------------------------------------------------------*/
+GrJustifier::GrJustifier()
+{
+ m_cref = 1; // COM-like behavior
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Destructor.
+----------------------------------------------------------------------------------------------*/
+GrJustifier::~GrJustifier()
+{
+}
+
+/*----------------------------------------------------------------------------------------------
+ Determine how to adjust the widths of the glyphs to get a justified effect.
+ Return kresFalse if we can't achieve the desired width.
+----------------------------------------------------------------------------------------------*/
+gr::GrResult GrJustifier::adjustGlyphWidths(gr::GraphiteProcess * pgje,
+ int iGlyphMin, int iGlyphLim,
+ float dxCurrentWidthArg, float dxDesiredWidthArg)
+{
+ if (dxCurrentWidthArg == dxDesiredWidthArg)
+ return gr::kresOk; // no stretch needed
+
+ int dxCurrentWidth = (int)dxCurrentWidthArg;
+ int dxDesiredWidth = (int)dxDesiredWidthArg;
+
+ bool fShrinking = (dxDesiredWidth < dxCurrentWidth);
+
+ // First, get the relevant values for each glyph out of the Graphite engine.
+
+ int dxsStretchAvail = 0;
+ std::vector<int> viGlyphs;
+ std::vector<int> vdxStretchLeft;
+ std::vector<int> vdxStep;
+ std::vector<int> vnWeight;
+ std::vector<int> vdxWidth;
+ std::vector<int> vdxStretchOrig;
+ bool fStep = false;
+ int nMaxWt = 1;
+ int cUnits = 0; // glyph-weight units
+ int cStretchable = 0;
+ for (int iGlyph = iGlyphMin; iGlyph < iGlyphLim; iGlyph++)
+ {
+ int dx;
+ pgje->getGlyphAttribute(iGlyph,
+ (fShrinking ? gr::kjgatShrink : gr::kjgatStretch), 1, &dx);
+ if (dx > 0)
+ {
+ int dxStep = 0;
+ pgje->getGlyphAttribute(iGlyph, gr::kjgatStep, 1, &dxStep);
+ if (fShrinking)
+ dxStep = (dxStep > 0) ? 0 : dxStep; // step is applicable if it is negative
+ else // stretching
+ dxStep = (dxStep < 0) ? 0 : dxStep; // step is applicable if it is positive
+ if (dxStep != 0)
+ {
+ // Get the actual number of steps allowed. This is more accurate than
+ // trying to calculate it, due to rounding when converting between
+ // font units and pixels.
+ int cSteps;
+ pgje->getGlyphAttribute(iGlyph, gr::kjgatStretchInSteps, 1, &cSteps);
+ dx = abs(dxStep * cSteps);
+ fStep = true;
+ }
+ dxStep = abs(dxStep);
+
+ int nWt;
+ pgje->getGlyphAttribute(iGlyph, gr::kjgatWeight, 1, &nWt);
+ nWt = max(nWt, 0);
+ nMaxWt = max(nMaxWt, nWt);
+
+ viGlyphs.push_back(iGlyph);
+ vdxStretchLeft.push_back(dx);
+ vdxStep.push_back(dxStep);
+ vnWeight.push_back(nWt);
+ vdxWidth.push_back(0);
+ vdxStretchOrig.push_back(dx);
+
+ dxsStretchAvail += dx;
+ cUnits += nWt;
+ cStretchable++;
+ }
+ }
+
+ int dxStretchNeeded = dxDesiredWidth - dxCurrentWidth;
+ if (fShrinking)
+ dxStretchNeeded *= -1; // always a positive number
+ int dxStretchAchieved = 0;
+ bool fIgnoreStepGlyphs = false;
+ int iiGlyph;
+ std::vector<int> vnMFactor;
+
+ if (viGlyphs.size() > 0)
+ {
+
+ // The way weights are handled is the following: we calculate the least common multiple
+ // of all the weights, and then scale each stretch value accordingly before distributing
+ // widths. In other words, we put the stretch values into an alternate "common" scaled
+ // system based on the LCM. "cUnits" represents the total number of stretch-units
+ // available, where each glyph contributes a number of units equal to its weight.
+ // To get into this scaled system, small-weight stretches are scaled by a large amount
+ // and large-weight stretches are scaled by a small amount. After assigning the width,
+ // we do the reverse scaling on that width. Since large-weight stretches are scaled
+ // back by less, this results in more width being assigned to glyphs with a large weight.
+
+ int nLcm = 1;
+ if (nMaxWt > 1)
+ nLcm = Lcm(vnWeight, vnMFactor);
+ else
+ {
+ vnMFactor.push_back(1); // weight 0 - bogus
+ vnMFactor.push_back(1); // weight 1
+ }
+
+ // Loop over the glyphs until we have assigned all the available space. (If a small amount
+ // is left over it will be distributed using a special method.)
+
+LMainLoop:
+
+ int dxStretchStillNeeded = dxStretchNeeded - dxStretchAchieved;
+ int dxNonStepMore = 0;
+ int dxNonStepLess = 0;
+ while (cUnits > 0 && dxStretchStillNeeded >= cStretchable)
+ // && dxStretchStillNeeded * nLcm >= cUnits)
+ {
+ // This is the scaled stretch per glyph, that is, in the scaled system of the LCM.
+ int dxwStretchPerGlyph = dxStretchStillNeeded * nLcm / cUnits;
+
+ // Recalculate these for the next round:
+ cUnits = 0;
+ cStretchable = 0;
+
+ for (iiGlyph = 0; iiGlyph < (signed)viGlyphs.size(); iiGlyph++)
+ {
+ if (vdxStep[iiGlyph] > 0 && fIgnoreStepGlyphs)
+ continue; // leave step-glyphs as they are
+
+ int nWt = vnWeight[iiGlyph];
+ int dxwThis = vdxStretchLeft[iiGlyph] * vnMFactor[nWt]; // weighted stretch
+ dxwThis = min(dxwStretchPerGlyph, dxwThis);
+ int dxThis = dxwThis / vnMFactor[nWt]; // scale back to unweighted stretch
+ vdxWidth[iiGlyph] += dxThis;
+ dxStretchAchieved += dxThis;
+ vdxStretchLeft[iiGlyph] -= dxThis;
+ if (vdxStretchLeft[iiGlyph] > 0)
+ {
+ cUnits += nWt; // can do some more on the next round
+ cStretchable++;
+ }
+
+ // Keep track of how much we could adjust in either direction
+ // on the second round to handle steps.
+ if (vdxStep[iiGlyph] == 0)
+ {
+ dxNonStepMore += vdxStretchOrig[iiGlyph] - vdxWidth[iiGlyph];
+ dxNonStepLess += vdxWidth[iiGlyph];
+ }
+ }
+ dxStretchStillNeeded = dxStretchNeeded - dxStretchAchieved;
+ }
+
+ Assert(dxStretchAchieved <= dxStretchNeeded);
+
+ // Make adjustments so that the step values are honored.
+
+ if (fStep // there are some step-glyphs
+ && !fIgnoreStepGlyphs) // and we didn't already do this
+ {
+ // First make some basic adjustments, alternating making more and fewer steps
+ // and see how much that buys us.
+ int dxAdjusted = 0;
+ int cNonStepUnits = 0;
+ int cStretchableNonStep = 0;
+ bool fReloop = false;
+ for (iiGlyph = 0; iiGlyph < (signed)viGlyphs.size(); iiGlyph++)
+ {
+ if (vdxStep[iiGlyph] > 1)
+ {
+ int dxRem = vdxWidth[iiGlyph] % vdxStep[iiGlyph];
+ int dxFewer = vdxWidth[iiGlyph] - dxRem; // round down
+ int dxMore = dxFewer + vdxStep[iiGlyph]; // round up
+ int dxAdd = dxMore - vdxWidth[iiGlyph];
+ if (dxRem == 0)
+ { // Step is okay; no adjustment needed.
+ }
+ else if (
+ // this glyph has stretch available to make more steps:
+ (dxMore <= vdxStretchOrig[iiGlyph])
+ // and we need at least this much extra:
+ && (dxAdd + dxStretchAchieved <= dxStretchNeeded)
+ // and we still have enough slack in the non-step-glyphs:
+ && (dxNonStepLess - dxAdjusted - dxAdd > 0)
+ // and we don't have to adjust much to get to the next step
+ // (we're 75% of the way there):
+ && ((dxRem > ((vdxStep[iiGlyph] * 3) << 2))
+ // or this glyph has a high weight:
+ || (vnWeight[iiGlyph] > (nMaxWt >> 2))
+ // or we've removed a fair amount already:
+ || (dxAdjusted < (dxAdd * -2))
+ // or we don't have enough slack to remove more:
+ || (dxNonStepMore + dxAdjusted - dxRem < 0)))
+ {
+ // Use the next larger number of steps.
+ vdxWidth[iiGlyph] += dxAdd;
+ dxStretchAchieved += dxAdd;
+ dxAdjusted += dxAdd;
+ fReloop = true;
+ }
+ else
+ {
+ // Use the next smaller number of steps.
+ vdxWidth[iiGlyph] -= dxRem;
+ dxStretchAchieved -= dxRem;
+ dxAdjusted -= dxRem;
+ fReloop = true;
+ }
+ }
+ else if (vdxStep[iiGlyph] == 0)
+ {
+ cNonStepUnits += vnWeight[iiGlyph];
+ cStretchableNonStep++;
+ }
+ }
+
+ if (cNonStepUnits < cUnits || cStretchableNonStep < cStretchable)
+ {
+ // Even if no step-glyphs need to be adjusted, there is a different number
+ // of (non-step) glyphs to divide the space over. (The first time through
+ // there may not have been enough space per glyph to run the main loop,
+ // but now there may be.)
+ fReloop = true;
+ }
+
+ // Any left over adjustments need to be made by adjusting the items with
+ // step = 1 (ie, the glyphs that allow fine-grained adjustments).
+ // Do the main loop again, but only adjust the non-step glyphs.
+ if (fReloop)
+ {
+ cUnits = cNonStepUnits;
+ cStretchable = cStretchableNonStep;
+ fIgnoreStepGlyphs = true;
+ goto LMainLoop;
+ }
+ }
+
+ // Divide up any remainder that is due to rounding errors.
+
+ int dxRemainder = dxStretchNeeded - dxStretchAchieved;
+ if (0 < dxRemainder && dxRemainder < cStretchable)
+ {
+ if (cStretchable < (signed)viGlyphs.size() || fStep)
+ {
+ // Make sub-lists using the glyphs that are still stretchable.
+ std::vector<int> vdxStretchRem;
+ std::vector<int> vdxWidthRem;
+ std::vector<int> viiGlyphsRem;
+ for (iiGlyph = 0; iiGlyph < (signed)viGlyphs.size(); iiGlyph++)
+ {
+ if (vdxStretchLeft[iiGlyph] > 0 && vdxStep[iiGlyph] == 0)
+ {
+ viiGlyphsRem.push_back(iiGlyph);
+ vdxStretchRem.push_back(vdxStretchLeft[iiGlyph]);
+ vdxWidthRem.push_back(vdxWidth[iiGlyph]);
+ }
+ }
+ Assert(viiGlyphsRem.size() == size_t(cStretchable));
+ DistributeRemainder(vdxWidthRem, vdxStretchRem, dxRemainder, 0, vdxWidthRem.size(),
+ &dxStretchAchieved);
+ for (int iiiGlyph = 0; iiiGlyph < cStretchable; iiiGlyph++)
+ {
+ int iiGlyph = viiGlyphsRem[iiiGlyph];
+ vdxStretchLeft[iiGlyph] = vdxStretchRem[iiiGlyph];
+ vdxWidth[iiGlyph] = vdxWidthRem[iiiGlyph];
+ }
+ }
+ else
+ {
+ // All glyphs are still stretchable.
+ DistributeRemainder(vdxWidth, vdxStretchLeft, dxRemainder, 0, vdxWidth.size(),
+ &dxStretchAchieved);
+ }
+ }
+ // otherwise we assume left-over is cannot be handled
+
+ // Assign the widths to the glyphs.
+
+ for (iiGlyph = 0; iiGlyph < (signed)viGlyphs.size(); iiGlyph++)
+ {
+ int dxThis = vdxWidth[iiGlyph] * ((fShrinking) ? -1 : 1);
+ if (vdxStep[iiGlyph] == 0)
+ pgje->setGlyphAttribute(viGlyphs[iiGlyph], gr::kjgatWidth, 1, dxThis);
+ else
+ {
+ // Set the actual number of steps allowed. This is more accurate than
+ // setting the pixels and then converting to font em-units.
+ Assert(int(dxThis) % vdxStep[iiGlyph] == 0); // width divides evenly into steps
+ int cSteps = dxThis/vdxStep[iiGlyph];
+ pgje->setGlyphAttribute(viGlyphs[iiGlyph], gr::kjgatWidthInSteps, 1, cSteps);
+ }
+ }
+ }
+//LLeave:
+
+ if (dxStretchAchieved == dxStretchNeeded)
+ return gr::kresOk;
+ else
+ {
+#ifdef WIN32
+ wchar_t rgchw[20];
+ std::fill_n(rgchw, 20, 0);
+ _itow(dxStretchNeeded - dxStretchAchieved, rgchw, 10);
+ std::wstring strTmp(L"justification failed by ");
+ strTmp += rgchw;
+ strTmp += L" units (width needed = ";
+ std::fill_n(rgchw, 10, 0);
+ _itow(dxDesiredWidth, rgchw, 10);
+ strTmp += rgchw;
+ strTmp += L")\n";
+ OutputDebugString(strTmp.c_str());
+#else
+ Assert(fprintf(stderr,
+ "justification failed by %d units (width needed = %d)\n",
+ dxStretchNeeded - dxStretchAchieved, dxDesiredWidth));
+#endif
+ return gr::kresFalse;
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Distribute the remainder of the width evenly over the stretchable glyphs.
+----------------------------------------------------------------------------------------------*/
+void GrJustifier::DistributeRemainder(std::vector<int> & vdxWidths, std::vector<int> & vdxStretch,
+ int dx, int iiMin, int iiLim,
+ int * pdxStretchAchieved)
+{
+ if (dx == 0)
+ return;
+
+ Assert(dx <= iiLim - iiMin);
+ if (iiMin + 1 == iiLim)
+ {
+ int dxThis = min(dx, vdxStretch[iiMin]);
+ Assert(dxThis == 1); // we're never adjusting by more than 1, and the glyph should be
+ // adjustable by that much
+ vdxWidths[iiMin] += dxThis;
+ vdxStretch[iiMin] -= dxThis;
+ *pdxStretchAchieved += dxThis;
+ }
+ else
+ {
+ int iiMid = (iiLim + iiMin) / 2;
+ int dxHalf1 = dx / 2;
+ int dxHalf2 = dx - dxHalf1;
+ DistributeRemainder(vdxWidths, vdxStretch, dxHalf1, iiMin, iiMid, pdxStretchAchieved);
+ DistributeRemainder(vdxWidths, vdxStretch, dxHalf2, iiMid, iiLim, pdxStretchAchieved);
+ }
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the least common multiple of the given weights. Also return
+ a std::vector of multiplicative factors for each weight.
+----------------------------------------------------------------------------------------------*/
+int GrJustifier::Lcm(std::vector<int> & vnWeights, std::vector<int> & vnMFactors)
+{
+ // The basic algorithm is to factor each weight into primes, counting how many times
+ // each prime occurs in the factorization. The LCM is the multiple of the primes
+ // with each prime raised to maximum power encountered within the factorizations.
+ // Example: weights = [2, 4, 5, 10]
+ // 2 = 2^1
+ // 4 = 2^2
+ // 5 = 5^1
+ // 10 = 2^1 * 5^1
+ // So the LCM = 2^2 * 5^1 = 20.
+
+ std::vector<int> vnPowersForLcm;
+ int inPrime;
+ for (inPrime = 0; inPrime < g_cnPrimes; inPrime++)
+ vnPowersForLcm.push_back(0);
+
+ std::vector<int> vnPowersPerPrime;
+ vnPowersPerPrime.resize(g_cnPrimes);
+ int nWtMax = 1;
+ for (int inWt = 0; inWt < (signed)vnWeights.size(); inWt++)
+ {
+ int inMax = PrimeFactors(vnWeights[inWt], vnPowersPerPrime);
+ for (inPrime = 0; inPrime <= inMax; inPrime++)
+ vnPowersForLcm[inPrime] = max(vnPowersForLcm[inPrime], vnPowersPerPrime[inPrime]);
+ nWtMax = max(nWtMax, vnWeights[inWt]);
+ }
+
+ int nLcm = 1;
+ for (inPrime = 0; inPrime < g_cnPrimes; inPrime++)
+ nLcm = nLcm * NthPower(g_rgnPrimes[inPrime], vnPowersForLcm[inPrime]);
+
+ // For each weight, calculate the multiplicative factor. This is the value by which
+ // to multiply stretch values of this weight in order to get them properly proportioned.
+ // Note that weights that are not used will have bogus factors.
+ vnMFactors.push_back(nLcm); // bogus, for weight 0
+ for (int nWt = 1; nWt <= nWtMax; nWt++)
+ {
+ vnMFactors.push_back(nLcm / nWt);
+ }
+ return nLcm;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return a std::vector indicating the prime factors of n. The values of the std::vector correspond
+ to the primes in g_rgnPrimes: [2, 3, 5, 7, ...]; they are the powers to which each
+ prime should be raised. For instance, 20 = 2^2 * 5^1, so the result would contain
+ [2, 0, 1, 0, 0, ...].
+ The returned int is index of the highest prime in the list that we found.
+----------------------------------------------------------------------------------------------*/
+int GrJustifier::PrimeFactors(int n, std::vector<int> & vnPowersPerPrime)
+{
+ // Short-cut for common cases:
+ switch (n)
+ {
+ case 0:
+ case 1:
+ vnPowersPerPrime[0] = 0;
+ return 0;
+ case 2:
+ vnPowersPerPrime[0] = 1; // 2^1
+ return 0;
+ case 3:
+ vnPowersPerPrime[0] = 0;
+ vnPowersPerPrime[1] = 1; // 3^1
+ return 1;
+ case 4:
+ vnPowersPerPrime[0] = 2; // 2^2
+ return 0;
+ case 5:
+ vnPowersPerPrime[0] = 0;
+ vnPowersPerPrime[1] = 0;
+ vnPowersPerPrime[2] = 1; // 5^1
+ return 2;
+ case 6:
+ vnPowersPerPrime[0] = 1; // 2^1
+ vnPowersPerPrime[1] = 1; // 3^1
+ return 1;
+ case 7:
+ vnPowersPerPrime[0] = 0;
+ vnPowersPerPrime[1] = 0;
+ vnPowersPerPrime[2] = 0;
+ vnPowersPerPrime[3] = 1; // 7^1
+ return 3;
+ case 8:
+ vnPowersPerPrime[0] = 3; // 2^3
+ return 0;
+ case 9:
+ vnPowersPerPrime[0] = 0;
+ vnPowersPerPrime[1] = 2; // 3^2
+ return 1;
+ case 10:
+ vnPowersPerPrime[0] = 1; // 2^1
+ vnPowersPerPrime[1] = 0;
+ vnPowersPerPrime[2] = 1; // 5^1
+ return 2;
+ default:
+ break;
+ }
+
+ // Otherwise use the general algorithm: suck out prime numbers one by one,
+ // keeping track of how many we have of each.
+
+ int inPrime;
+ for (inPrime = 0; inPrime < g_cnPrimes; inPrime++)
+ vnPowersPerPrime[inPrime] = 0;
+
+ int nRem = n;
+ for (inPrime = 0; inPrime < g_cnPrimes; inPrime++)
+ {
+ while (nRem % g_rgnPrimes[inPrime] == 0)
+ {
+ vnPowersPerPrime[inPrime] += 1;
+ nRem = nRem / g_rgnPrimes[inPrime];
+ }
+ if (nRem == 1)
+ break;
+ }
+ Assert(n > 255 || nRem == 1);
+ return inPrime;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return nX raised to the nY power.
+----------------------------------------------------------------------------------------------*/
+int GrJustifier::NthPower(int nX, int nY)
+{
+ int nRet = 1;
+ for (int i = 0; i < nY; i++)
+ nRet *= nX;
+ return nRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Determine how much shrinking is possible for low-end justification.
+----------------------------------------------------------------------------------------------*/
+//GrResult GrJustifier::suggestShrinkAndBreak(GraphiteProcess * pgje,
+// int iGlyphMin, int iGlyphLim, int dxsWidth, LgLineBreak lbPref, LgLineBreak lbMax,
+// int * pdxShrink, LgLineBreak * plbToTry)
+//{
+// *pdxShrink = 0;
+// *plbToTry = lbPref;
+// return kresOk;
+//}
+
diff --git a/Build/source/libs/graphite/test/RegressionTest/GrJustifier.h b/Build/source/libs/graphite/test/RegressionTest/GrJustifier.h
new file mode 100644
index 00000000000..ea5fc21bec9
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/GrJustifier.h
@@ -0,0 +1,82 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2003 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: GrJustifier.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ A default justification agent for Graphite.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+#pragma once
+#ifndef GRJUSTIFIER_INCLUDED
+#define GRJUSTIFIER_INCLUDED
+
+/*----------------------------------------------------------------------------------------------
+ Class: GrJustifier
+ This class provides a basic justification/layout algorithm for applications that use
+ Graphite.
+----------------------------------------------------------------------------------------------*/
+class GrJustifier : public gr::IGrJustifier
+{
+public:
+ // Constructor:
+ GrJustifier();
+ ~GrJustifier();
+
+/*
+ virtual long IncRefCount(void)
+ {
+ return InterlockedIncrement(&m_cref);
+ }
+ virtual long DecRefCount(void)
+ {
+ long cref = InterlockedDecrement(&m_cref);
+ if (cref == 0) {
+ m_cref = 1;
+ delete this;
+ }
+ return cref;
+ }
+*/
+
+ virtual gr::GrResult adjustGlyphWidths(gr::GraphiteProcess * pfgje,
+ int iGlyphMin, int iGlyphLim,
+ float dxCurrWidth, float dxDesiredWidth);
+
+ //virtual GrResult suggestShrinkAndBreak(GraphiteProcess * pfgjwe,
+ // int iGlyphMin, int iGlyphLim, int dxsWidth, LgLineBreak lbPref, LgLineBreak lbMax,
+ // int * pdxShrink, LgLineBreak * plbToTry);
+
+ // Return a Graphite-compatible justifier that can be stored in a Graphite segment.
+ // TODO: remove
+ //virtual void JustifierObject(IGrJustifier ** ppgjus)
+ //{
+ // *ppgjus = this;
+ //}
+
+ // When a segment is being destroyed, there is nothing to do, since this is a pointer
+ // to an object that is allocated elsewhere.
+ // TODO: remove
+ //virtual void DeleteJustifierPtr()
+ //{
+ //}
+
+protected:
+ long m_cref;
+
+ gr::GraphiteProcess * m_pgreng;
+
+ void DistributeRemainder(std::vector<int> & vdxWidths, std::vector<int> & vdxStretch,
+ int dx, int iiMin, int iiLim,
+ int * pdxStretchAchieved);
+ int Lcm(std::vector<int> & vnWeights, std::vector<int> & vnMFactors);
+ int PrimeFactors(int n, std::vector<int> & vnPowersPerPrime);
+ int NthPower(int nX, int nY);
+};
+
+
+#endif // !GRJUSTIFIER_INCLUDED
diff --git a/Build/source/libs/graphite/test/RegressionTest/Makefile.am b/Build/source/libs/graphite/test/RegressionTest/Makefile.am
new file mode 100644
index 00000000000..fe59b65fbaa
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/Makefile.am
@@ -0,0 +1,38 @@
+AUTOMAKE_OPTIONS = 1.6
+
+EXTRA_DIST = \
+ burmeseText.wpx \
+ romanText.wpx \
+ xlineText.wpx \
+ grtest_arabic.ttf \
+ grtest_badVersion.ttf \
+ grtest_badCmap.ttf \
+ grtest_burmese.ttf \
+ grtest_roman.ttf \
+ grtest_taiviet.ttf \
+ grtest_xline.ttf \
+ xline.gdl \
+ Makefile.vc \
+ makedebug.bat \
+ readme.txt
+
+noinst_PROGRAMS = regression-test
+
+AM_CPPFLAGS = -I$(top_srcdir)/include/graphite
+
+regression_test_LDFLAGS = -L$(top_builddir)/src -lgraphite
+
+regression_test_SOURCES = \
+ main.h \
+ stdafx.cpp stdafx.h \
+ RegressionTest.cpp \
+ TestCase.cpp TestCase.h \
+ RtTextSrc.h \
+ SimpleTextSrc.cpp SimpleTextSrc.h \
+ GrJustifier.cpp GrJustifier.h
+
+check-local: regression-test
+ $(top_builddir)/test/RegressionTest/regression-test -p $(srcdir)
+
+dist-hook:
+ rm -f grregtest.log tracelog.txt
diff --git a/Build/source/libs/graphite/test/RegressionTest/Makefile.in b/Build/source/libs/graphite/test/RegressionTest/Makefile.in
new file mode 100644
index 00000000000..547e7dfa408
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/Makefile.in
@@ -0,0 +1,478 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+noinst_PROGRAMS = regression-test$(EXEEXT)
+subdir = test/RegressionTest
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+PROGRAMS = $(noinst_PROGRAMS)
+am_regression_test_OBJECTS = stdafx.$(OBJEXT) RegressionTest.$(OBJEXT) \
+ TestCase.$(OBJEXT) SimpleTextSrc.$(OBJEXT) \
+ GrJustifier.$(OBJEXT)
+regression_test_OBJECTS = $(am_regression_test_OBJECTS)
+regression_test_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(regression_test_SOURCES)
+DIST_SOURCES = $(regression_test_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LSB_RELEASE = @LSB_RELEASE@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+REL_CODENAME = @REL_CODENAME@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SIZEOF_WCHAR_T = @SIZEOF_WCHAR_T@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AUTOMAKE_OPTIONS = 1.6
+EXTRA_DIST = \
+ burmeseText.wpx \
+ romanText.wpx \
+ xlineText.wpx \
+ grtest_arabic.ttf \
+ grtest_badVersion.ttf \
+ grtest_badCmap.ttf \
+ grtest_burmese.ttf \
+ grtest_roman.ttf \
+ grtest_xline.ttf \
+ xline.gdl \
+ Makefile.vc \
+ makedebug.bat \
+ readme.txt
+
+AM_CPPFLAGS = -I$(top_srcdir)/include/graphite
+regression_test_LDFLAGS = -L$(top_builddir)/src -lgraphite
+regression_test_SOURCES = \
+ main.h \
+ stdafx.cpp stdafx.h \
+ RegressionTest.cpp \
+ TestCase.cpp TestCase.h \
+ RtTextSrc.h \
+ SimpleTextSrc.cpp SimpleTextSrc.h \
+ GrJustifier.cpp GrJustifier.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/RegressionTest/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign test/RegressionTest/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+regression-test$(EXEEXT): $(regression_test_OBJECTS) $(regression_test_DEPENDENCIES)
+ @rm -f regression-test$(EXEEXT)
+ $(CXXLINK) $(regression_test_LDFLAGS) $(regression_test_OBJECTS) $(regression_test_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrJustifier.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RegressionTest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SimpleTextSrc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestCase.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdafx.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-hook
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-local
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \
+ clean-generic clean-libtool clean-noinstPROGRAMS ctags \
+ dist-hook distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am
+
+
+check-local: regression-test
+ $(top_builddir)/test/RegressionTest/regression-test -p $(srcdir)
+
+dist-hook:
+ rm -f grregtest.log tracelog.txt
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Build/source/libs/graphite/test/RegressionTest/Makefile.vc b/Build/source/libs/graphite/test/RegressionTest/Makefile.vc
new file mode 100644
index 00000000000..ff75d7e9e16
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/Makefile.vc
@@ -0,0 +1,121 @@
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+
+TARGET=RegressionTest
+REGT_SRC=.
+REGT_RES=.
+REGT_APPLIB=..\..\..\examples\applib
+
+
+!IF "$(CFG)" == ""
+CFG=DEBUG
+!ENDIF
+
+!IF "$(CFG)" == "RELEASE"
+
+OUTDIR=.\release
+INTDIR=.\release_temp
+
+all : "$(OUTDIR)\$(TARGET).exe"
+
+clean :
+ @- rd /s/q $(INTDIR)
+
+realclean : clean
+ @- rd /s/q $(OUTDIR)
+
+CPP_PROJ=/nologo /MT /W3 /GR /GX /O2 /I "." /I "../../examples/applib" /I "../../include" /I "../../include/graphite" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /c
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\$(TARGET).res" /d "NDEBUG"
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib graphite.lib /nologo /subsystem:console /incremental:no /machine:I386 /out:"$(OUTDIR)\$(TARGET).exe" /libpath:"..\..\release"
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\$(TARGET).bsc"
+
+!ELSEIF "$(CFG)" == "DEBUG"
+
+OUTDIR=.\debug
+INTDIR=.\debug_temp
+
+all : "$(OUTDIR)\$(TARGET).exe" "$(OUTDIR)\$(TARGET).bsc"
+
+clean :
+ @- rd /s/q $(INTDIR)
+
+realclean : clean
+ @- rd /s/q $(OUTDIR)
+
+CPP_PROJ=/nologo /MTd /W3 /Gm /GR /GX /GZ /ZI /Od /I "." /I "../../examples/applib" /I "../../include" /I "../../include/graphite" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /FR"$(INTDIR)\\" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /c
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\$(TARGET).res" /d "_DEBUG"
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib graphite.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\$(TARGET).pdb" /debug /machine:I386 /out:"$(OUTDIR)\$(TARGET).exe" /libpath:"..\..\debug"
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\$(TARGET).bsc"
+
+!ENDIF
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+"$(INTDIR)" :
+ if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
+
+{$(REGT_SRC)}.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+{$(REGT_SRC)}.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+{$(REGT_APPLIB)}.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+{$(REGT_APPLIB)}.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+
+
+CPP=cl.exe
+RSC=rc.exe
+BSC32=bscmake.exe
+LINK32=link.exe
+
+LINK32_OBJS= \
+ "$(INTDIR)\RegressionTest.obj" \
+ "$(INTDIR)\TestCase.obj" \
+ "$(INTDIR)\GrJustifier.obj" \
+ "$(INTDIR)\SimpleTextSrc.obj" \
+
+# "$(INTDIR)\RegressionTest.res"
+
+"$(OUTDIR)\$(TARGET).exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+BSC32_SBRS= \
+ "$(INTDIR)\RegressionTest.sbr" \
+ "$(INTDIR)\TestCase.sbr" \
+ "$(INTDIR)\GrJustifier.sbr" \
+ "$(INTDIR)\SimpleTextSrc.sbr" \
+#
+
+"$(OUTDIR)\$(TARGET).bsc" : "$(OUTDIR)" $(BSC32_SBRS)
+ $(BSC32) @<<
+ $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+"$(INTDIR)\RegressionTest.obj" "$(INTDIR)\RegressionTest.sbr" : "$(REGT_SRC)\RegressionTest.cpp" "$(INTDIR)"
+"$(INTDIR)\TestCase.obj" "$(INTDIR)\TestCase.sbr" : "$(REGT_SRC)\TestCase.cpp" "$(INTDIR)"
+"$(INTDIR)\GrJustifier.obj" "$(INTDIR)\GrJustifier.sbr" : "$(REGT_APPLIB)\GrJustifier.cpp" "$(INTDIR)"
+"$(INTDIR)\SimpleTextSrc.obj" "$(INTDIR)\SimpleTextSrc.sbr" : "$(REGT_APPLIB)\SimpleTextSrc.cpp" "$(INTDIR)"
+
+
+"$(INTDIR)\$(TARGET).res" : "$(REGT_RES)\$(TARGET).rc" "$(INTDIR)"
+ $(RSC) $(RSC_PROJ) "$(REGT_RES)\$(TARGET).rc"
+
diff --git a/Build/source/libs/graphite/test/RegressionTest/RegressionTest.cpp b/Build/source/libs/graphite/test/RegressionTest/RegressionTest.cpp
new file mode 100644
index 00000000000..1d361a4f3cd
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/RegressionTest.cpp
@@ -0,0 +1,748 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2004 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: RegressionTest.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Main file for the Graphite regression test program.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+#include "main.h"
+#include "MemoryUsage.h"
+#include <cstring>
+
+//:>********************************************************************************************
+//:> Global variables
+//:>********************************************************************************************
+std::ofstream g_strmLog; // log file output stream
+std::ofstream g_strmTrace; // debugger trace for selected tests
+std::ofstream g_strmMemUsage;
+
+int g_errorCount;
+
+// HDC g_hdc; // device-context for bogus window on which to do drawing
+
+bool g_debugMode = false;
+bool g_silentMode = false;
+
+int g_itcaseStart = 0; // adjust to skip to a certain test
+
+SegmentMemoryUsage g_smu;
+FontMemoryUsage g_fmu;
+
+std::string g_fontPath = ".";
+#ifdef _WIN32
+#define PATH_SEP "\\"
+#else
+#define PATH_SEP "/"
+#endif
+
+// Forward defintions.
+int WriteLog(int);
+void CopyWstringToUtf16(std::wstring textStr, gr::utf16 * utf16Buf, int bufSize);
+
+//:>********************************************************************************************
+//:> Functions
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Main function.
+----------------------------------------------------------------------------------------------*/
+
+int main(int argc, char* argv[])
+{
+#ifdef _WIN32
+ _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
+#endif // WIN32
+
+ int iargc = 1;
+ while (iargc < argc)
+ {
+ if ((strcmp(argv[iargc], "/d") == 0) || (strcmp(argv[iargc], "-d") == 0))
+ {
+ g_debugMode = true;
+ }
+ if ((strcmp(argv[iargc], "/s") == 0) || (strcmp(argv[iargc], "-s") == 0))
+ {
+ g_silentMode = true;
+ }
+ if ((strcmp(argv[iargc], "/p") == 0) || (strcmp(argv[iargc], "-p") == 0))
+ {
+ iargc++;
+ if (iargc < argc)
+ {
+ g_fontPath = argv[iargc];
+ }
+ }
+ iargc++;
+ }
+
+ if (!g_silentMode)
+ {
+ std::cout << "Graphite Regression Test\n";
+ std::cout << "Files path is " << g_fontPath << "\n\n";
+ if (g_debugMode)
+ std::cout << "In debug mode\n";
+ }
+
+ // Start a new log.
+ g_strmLog.open("grregtest.log");
+ if (g_strmLog.fail())
+ {
+ std::cout << "Unable to open log file.";
+ return -1;
+ }
+
+ g_errorCount = 0;
+
+// g_hdc = ::GetDC(NULL);
+
+ WriteToLog("Graphite Regression Test\n\n");
+
+ // Initialize the tracelog file.
+ g_strmTrace.open("tracelog.txt");
+ g_strmTrace.close();
+
+ TestCase * ptcaseList = NULL;
+ int numberOfTests = TestCase::SetupTests(&ptcaseList);
+
+ RunTests(numberOfTests, ptcaseList);
+
+ WriteToLog("\n==============================================\n");
+ g_strmLog << "\n\nTOTAL NUMBER OF ERRORS: " << g_errorCount << "\n";
+ if (!g_silentMode)
+ std::cout << "\n\nTOTAL NUMBER OF ERRORS: " << g_errorCount << "\n";
+
+ g_strmLog.close();
+
+ ////EngineInstance::DeleteEngines();
+ TestCase::DeleteTests();
+
+// ::ReleaseDC(NULL, g_hdc);
+
+ // Output segment memory usage information.
+ //g_strmMemUsage.open("SegMemoryUsage.log");
+ //g_smu.prettyPrint(g_strmMemUsage);
+ //g_strmMemUsage.close();
+
+ return g_errorCount;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Run the tests.
+----------------------------------------------------------------------------------------------*/
+void RunTests(int numberOfTests, TestCase * ptcaseList)
+{
+ Segment * psegPrev = NULL;
+ RtTextSrc * ptsrcPrev = NULL;
+ Segment * psegRet = NULL;
+ RtTextSrc * ptsrcRet = NULL;
+
+ for (int itcase = g_itcaseStart; itcase < numberOfTests; itcase++)
+ {
+ TestCase * ptcase = ptcaseList + itcase;
+ WriteToLog("\n----------------------------------------------\n");
+ WriteToLog("Test: ");
+
+ if (!g_silentMode)
+ std::cout << "Test " << ptcase->TestName() << "...";
+ WriteToLog(ptcase->TestName());
+ WriteToLog("\n");
+
+ RunOneTestCase(ptcase, psegPrev, &psegRet, &ptsrcRet);
+
+ delete psegPrev;
+ delete ptsrcPrev;
+ psegPrev = psegRet;
+ ptsrcPrev = ptsrcRet;
+ psegRet = NULL;
+ ptsrcRet = NULL;
+ }
+
+ delete psegPrev;
+ delete ptsrcPrev;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Run a single test case.
+----------------------------------------------------------------------------------------------*/
+int RunOneTestCase(TestCase * ptcase, Segment * psegPrev, Segment ** ppsegRet, RtTextSrc ** pptsrcRet)
+{
+ if (ptcase->Skip())
+ {
+ std::cout << "\nskipped\n";
+ g_strmLog << "skipping\n";
+ *ppsegRet = NULL;
+ return 0;
+ }
+
+#ifdef _WIN32
+ // Break into the debugger if requested.
+ if (ptcase->RunDebugger() && ::IsDebuggerPresent())
+ {
+ ::DebugBreak();
+ }
+#endif
+
+ int errorCount = 0;
+
+ gr::utf16 text[1024];
+ CopyWstringToUtf16(ptcase->Text(), text, 1024);
+
+ *ppsegRet = NULL;
+ SegmentPainter * ppainter = NULL;
+ std::pair<GlyphIterator, GlyphIterator> iterPair;
+ GlyphIterator gitBegin;
+ GlyphIterator gitEnd;
+
+ //LOGFONT lf;
+ //memset(&lf, '\0', sizeof(LOGFONT));
+ //lf.lfCharSet = DEFAULT_CHARSET;
+ //lf.lfHeight = (signed(ptcase->FontSize()) * -96) / 72; // 96 = resolution, 72 = points per inch
+ //lf.lfWeight = 400;
+ //lf.lfItalic = FALSE;
+ //wcscpy(lf.lfFaceName, ptcase->FontName().data());
+ //HDC hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
+ //HFONT hfont = CreateFontIndirect(&lf);
+ //HFONT hfontOld = (HFONT)::SelectObject(hdc, hfont); // restore before destroying the DC.
+ //WinFont winfont(hdc);
+
+ FileFont font(g_fontPath + PATH_SEP + ptcase->FontFile(), float(signed(ptcase->FontSize())), 96, 96);
+
+ if (!font.isValid())
+ {
+ OutputError(ptcase, std::string("ERROR: reading font file: \"") + ptcase->FontFile() + "\" at path \"" + g_fontPath + "\"; remaining tests skipped");
+ *ppsegRet = NULL;
+ errorCount++;
+ return WriteLog(errorCount);
+ }
+
+ // Set up the text source.
+ *pptsrcRet = new RtTextSrc(&(text[0]));
+ RtTextSrc * ptsrc = *pptsrcRet;
+ (*pptsrcRet)->setFeatures(ptcase->Features());
+ (*pptsrcRet)->setRightToLeft(ptcase->Rtl());
+
+ // Generate a segment.
+ LayoutEnvironment layout;
+ layout.setDumbFallback(ptcase->DumbFallback());
+ layout.setStartOfLine(true);
+ layout.setRightToLeft(ptcase->ParaRtl());
+ if (ptcase->InitWithPrevSeg())
+ layout.setPrevSegment(psegPrev);
+
+ if (ptcase->TraceLog())
+ {
+ g_strmTrace.open("tracelog.txt", std::ios::app);
+ g_strmTrace << "Test: " << ptcase->TestName() << "\n\n";
+ layout.setLoggingStream(&g_strmTrace);
+ }
+
+ try
+ {
+ if (ptcase->AvailWidth() < 10000)
+ {
+ layout.setBestBreak(ptcase->PrefBreak());
+ layout.setWorstBreak(ptcase->WorstBreak());
+ layout.setTrailingWs(ptcase->Twsh());
+ *ppsegRet = new LineFillSegment(&font, ptsrc, &layout,
+ ptcase->FirstChar(), ptsrc->getLength(),
+ (float)ptcase->AvailWidth(),
+ ptcase->Backtrack());
+ }
+ else
+ {
+ *ppsegRet = new RangeSegment(&font, ptsrc, &layout);
+ }
+ }
+ catch (...)
+ {
+ if (!ptcase->NoSegment())
+ {
+ if (ptcase->BadFont() && !ptcase->DumbFallback())
+ // Weird situation.
+ OutputError(ptcase, "ERROR: bad font with no fallback, yet a segment was expected???");
+ else
+ OutputError(ptcase, "ERROR: generating segment; remaining tests skipped");
+ errorCount++;
+ }
+ // else segment creation failed as expected
+
+ // NB: failure to create a segment due to throwing an exception seems to result in a memory
+ // leak--the FontCache object FontFace::s_pFontCache does not get deleted.
+
+ *ppsegRet = NULL;
+ return WriteLog(errorCount);
+ }
+
+ if (ptcase->TraceLog())
+ {
+ g_strmTrace << "\n\n*********************************************************************************************************************\n\n";
+ g_strmTrace.close();
+ }
+
+ if ((*ppsegRet) && (*ppsegRet)->segmentTermination() == kestNothingFit)
+ {
+ delete *ppsegRet;
+ *ppsegRet = NULL;
+ }
+
+ if ((*ppsegRet) == NULL && !ptcase->NoSegment())
+ {
+ OutputError(ptcase, "ERROR: segment not created; remaining tests skipped");
+ errorCount++;
+ return WriteLog(errorCount);
+ }
+ else if (ptcase->NoSegment())
+ {
+ if (*ppsegRet)
+ {
+ OutputError(ptcase, "ERROR: segment created when none expected");
+ errorCount++;
+ }
+ delete *ppsegRet;
+ *ppsegRet = NULL;
+ return WriteLog(errorCount);
+ }
+
+ Segment * pseg = *ppsegRet;
+
+ pseg->calculateMemoryUsage(g_smu);
+
+ // Calculate and output font memory usage.
+ //g_fmu = Font::calculateMemoryUsage();
+ //g_strmMemUsage.open("fontMemoryUsage.log");
+ //g_fmu.prettyPrint(g_strmMemUsage);
+ //g_strmMemUsage.close();
+
+ // Test results.
+ int segMin = pseg->startCharacter();
+ int segLim = pseg->stopCharacter();
+ if ((segLim - segMin) != ptcase->CharCount())
+ {
+ OutputErrorWithValues(ptcase, "ERROR: number of characters in segment", -1,
+ (segLim - segMin), ptcase->CharCount());
+ errorCount++;
+ }
+
+ int segWidth = (int)pseg->advanceWidth();
+ if (segWidth != ptcase->SegWidth())
+ {
+ OutputErrorWithValues(ptcase, "ERROR: width of segment", -1,
+ segWidth, ptcase->SegWidth());
+ errorCount++;
+ }
+
+ iterPair = pseg->glyphs();
+ gitBegin = iterPair.first;
+ gitEnd = iterPair.second;
+ int cGlyphs = gitEnd - gitBegin;
+ if (cGlyphs != ptcase->GlyphCount())
+ {
+ OutputErrorWithValues(ptcase, "ERROR: number of glyphs", -1,
+ cGlyphs, ptcase->GlyphCount());
+ errorCount++;
+ }
+ else
+ {
+ GlyphIterator gitThis = gitBegin;
+ for (int iglyph = 0; gitThis != gitEnd; ++gitThis, iglyph++)
+ {
+ if ((*gitThis).glyphID() != ptcase->GlyphID(iglyph))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: glyph id ", iglyph,
+ (*gitThis).glyphID(), ptcase->GlyphID(iglyph));
+ errorCount++;
+ }
+ if (int((*gitThis).origin()) != ptcase->XPos(iglyph))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: glyph x-position ", iglyph,
+ int((*gitThis).origin()), ptcase->XPos(iglyph));
+ errorCount++;
+ }
+ if (int((*gitThis).yOffset()) != ptcase->YPos(iglyph))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: glyph y-position ", iglyph,
+ int((*gitThis).yOffset()), ptcase->YPos(iglyph));
+ errorCount++;
+ }
+ if (int((*gitThis).advanceWidth()) != ptcase->AdvWidth(iglyph))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: advance width ", iglyph,
+ int((*gitThis).advanceWidth()), ptcase->AdvWidth(iglyph));
+ errorCount++;
+ }
+ if (ptcase->BbTests())
+ {
+ gr::Rect rectBb = (*gitThis).bb();
+ if (int(rectBb.left) != ptcase->BbLeft(iglyph))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: bb left ", iglyph,
+ int(rectBb.left), ptcase->BbLeft(iglyph));
+ errorCount++;
+ }
+ if (int(rectBb.right) != ptcase->BbRight(iglyph))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: bb right ", iglyph,
+ int(rectBb.right), ptcase->BbRight(iglyph));
+ errorCount++;
+ }
+ if (int(rectBb.top) != ptcase->BbTop(iglyph))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: bb top ", iglyph,
+ int(rectBb.top), ptcase->BbTop(iglyph));
+ errorCount++;
+ }
+ if (int(rectBb.bottom) != ptcase->BbBottom(iglyph))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: bb bottom ", iglyph,
+ int(rectBb.bottom), ptcase->BbBottom(iglyph));
+ errorCount++;
+ }
+ }
+ }
+ }
+
+ ppainter = new SegmentNonPainter(pseg);
+
+ if (segLim == ptcase->CharCount())
+ {
+ for (int ichar = 0; ichar < segLim; ichar++)
+ {
+ LgIpValidResult ipvr = ppainter->isValidInsertionPoint(ichar);
+ if ((ipvr == kipvrOK && !ptcase->InsPtFlag(ichar)) // TODO: handle kipvrUnknown
+ || (ipvr != kipvrOK && ptcase->InsPtFlag(ichar)))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: valid insertion point ", ichar,
+ (ipvr == kipvrOK), ptcase->InsPtFlag(ichar));
+ errorCount++;
+ }
+ }
+ }
+
+ int c2gi = 0;
+ while (c2gi < ptcase->CharToGlyphCount())
+ {
+ int ichar = ptcase->CharToGlyphItem(c2gi++);
+ int glyphCount = ptcase->CharToGlyphItem(c2gi++);
+ std::pair<gr::GlyphSetIterator, gr::GlyphSetIterator> glyphSet = pseg->charToGlyphs(ichar);
+ gr::GlyphSetIterator gitStart = glyphSet.first;
+ gr::GlyphSetIterator gitStop = glyphSet.second;
+ if ((gitStop - gitStart) != glyphCount)
+ {
+ OutputErrorWithValues(ptcase, "ERROR: number of glyphs for char ", ichar,
+ gitStop - gitStart, glyphCount);
+ errorCount++;
+ c2gi += glyphCount;
+ }
+ else
+ {
+ GlyphSetIterator glyphLp = glyphSet.first;
+ for (int ig = 0; ig < glyphCount; ig++)
+ {
+ if (static_cast<int>((*glyphLp).logicalIndex()) != ptcase->CharToGlyphItem(c2gi))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: glyph for char ", ichar,
+ (*glyphLp).logicalIndex(), ptcase->CharToGlyphItem(c2gi));
+ errorCount++;
+ }
+ c2gi++;
+ glyphLp++;
+ }
+ }
+ }
+
+ int att = 0;
+ while (att < ptcase->AttachedGlyphCount())
+ {
+ int iglyph = ptcase->AttachedGlyphItem(att++);
+ if (iglyph > cGlyphs)
+ {
+ OutputError(ptcase, "ERROR: non-existent glyph in attachment test ", iglyph);
+ errorCount++;
+ att++;
+ att += ptcase->AttachedGlyphItem(att) + 1;
+ continue;
+ }
+
+ GlyphIterator gitThis = gitBegin + iglyph;
+ GlyphIterator gitBase = gitThis->attachedClusterBase();
+ int ibase = gitBase->logicalIndex();
+ if (ibase != ptcase->AttachedGlyphItem(att))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: attachment base for glyph ", iglyph,
+ ibase, ptcase->AttachedGlyphItem(att));
+ errorCount++;
+ }
+ att++;
+ std::pair<gr::GlyphSetIterator, gr::GlyphSetIterator> glyphSet = gitThis->attachedClusterGlyphs();
+ gr::GlyphSetIterator gitStart = glyphSet.first;
+ gr::GlyphSetIterator gitStop = glyphSet.second;
+ int glyphCount = ptcase->AttachedGlyphItem(att++);
+ if ((gitStop - gitStart) != glyphCount)
+ {
+ OutputErrorWithValues(ptcase, "ERROR: number of attachments for glyph ", iglyph,
+ gitStop - gitStart, glyphCount);
+ errorCount++;
+ att += glyphCount;
+ }
+ else
+ {
+ GlyphSetIterator glyphLp = glyphSet.first;
+ for (int ig = 0; ig < glyphCount; ig++)
+ {
+ if (static_cast<int>((*glyphLp).logicalIndex()) != ptcase->AttachedGlyphItem(att))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: attachment for glyph ", iglyph,
+ (*glyphLp).logicalIndex(), ptcase->AttachedGlyphItem(att));
+ errorCount++;
+ }
+ att++;
+ glyphLp++;
+ }
+ }
+ }
+
+ for (int iclicktest = 0; iclicktest < ptcase->NumberOfClickTests(); iclicktest++)
+ {
+ gr::Point ptClick;
+ ptClick.x = static_cast<float>(ptcase->XClick(iclicktest));
+ ptClick.y = static_cast<float>(ptcase->YClick(iclicktest));
+ int charIndex;
+ bool assocPrev;
+ ppainter->pointToChar(ptClick, &charIndex, &assocPrev);
+ if (charIndex != ptcase->ClickCharIndex(iclicktest))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: char index from click ", iclicktest,
+ charIndex, ptcase->ClickCharIndex(iclicktest));
+ errorCount++;
+ continue;
+ }
+ if (assocPrev != ptcase->ClickAssocPrev(iclicktest))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: assoc-prev from click ", iclicktest,
+ assocPrev, ptcase->ClickAssocPrev(iclicktest));
+ errorCount++;
+ }
+ gr::Rect rect1, rect2;
+ ppainter->positionsOfIP(charIndex, assocPrev,
+ false, &rect1, &rect2);
+ if (ptcase->Sel1Top(iclicktest) == TestCase::kAbsent)
+ {
+ if (rect1.top != 0 || rect1.bottom != 0 || rect1.left != 0 || rect1.right != 0)
+ {
+ OutputError(ptcase, "ERROR: IP prim rect found ", iclicktest);
+ errorCount++;
+ }
+ }
+ else if (rect1.top == 0 && rect1.bottom == 0 && rect1.left == 0 && rect1.right == 0)
+ {
+ OutputError(ptcase, "ERROR: IP prim rect not found ", iclicktest);
+ errorCount++;
+ }
+ else
+ {
+ if ((int)rect1.top != ptcase->Sel1Top(iclicktest))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: IP prim rect top ", iclicktest,
+ int(rect1.top), ptcase->Sel1Top(iclicktest));
+ errorCount++;
+ }
+ if ((int)rect1.bottom != ptcase->Sel1Bottom(iclicktest))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: IP prim rect bottom ", iclicktest,
+ int(rect1.bottom), ptcase->Sel1Bottom(iclicktest));
+ errorCount++;
+ }
+ if ((int)rect1.left != ptcase->Sel1Left(iclicktest))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: IP prim rect left ", iclicktest,
+ int(rect1.left), ptcase->Sel1Left(iclicktest));
+ errorCount++;
+ }
+ }
+
+ if (ptcase->Sel2Top(iclicktest) == TestCase::kAbsent)
+ {
+ if (rect2.top != 0 || rect2.bottom != 0 || rect2.left != 0 || rect2.right != 0)
+ {
+ OutputError(ptcase, "ERROR: IP sec rect found when not expected ", iclicktest);
+ errorCount++;
+ }
+ }
+ else if (rect2.top == 0 && rect2.bottom == 0 && rect2.left == 0 && rect2.right == 0)
+ {
+ OutputError(ptcase, "ERROR: IP sec rect not found ", iclicktest);
+ errorCount++;
+ }
+ else
+ {
+ if ((int)rect2.top != ptcase->Sel2Top(iclicktest))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: IP sec rect top ", iclicktest,
+ int(rect2.top), ptcase->Sel2Top(iclicktest));
+ errorCount++;
+ }
+ if ((int)rect2.bottom != ptcase->Sel2Bottom(iclicktest))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: IP sec rect bottom ", iclicktest,
+ int(rect2.bottom), ptcase->Sel2Bottom(iclicktest));
+ errorCount++;
+ }
+ if ((int)rect2.left != ptcase->Sel2Left(iclicktest))
+ {
+ OutputErrorWithValues(ptcase, "ERROR: IP sec rect left ", iclicktest,
+ int(rect2.left), ptcase->Sel2Left(iclicktest));
+ errorCount++;
+ }
+ }
+ }
+
+ ////if (contextBlockOut != ptcase->OutputContextBlockSize())
+ ////{
+ //// OutputErrorWithValues(ptcase, "ERROR: output context block size ", -1,
+ //// (int)contextBlockOut, (int)ptcase->OutputContextBlockSize());
+ //// errorCount++;
+ ////}
+ ////else if (!ptcase->CompareContextBlock(pContextBlockOut))
+ ////{
+ //// OutputError(ptcase, "ERROR: output context block");
+ //// errorCount++;
+ ////}
+ delete ppainter;
+
+ return WriteLog(errorCount);
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Write the error count to the log.
+----------------------------------------------------------------------------------------------*/
+int WriteLog(int errorCount)
+{
+ WriteToLog("\nError count = ");
+ WriteToLog(errorCount);
+ WriteToLog("\n");
+
+ if (!g_silentMode)
+ {
+ if (errorCount == 0)
+ std::cout << "ok\n";
+ else
+ std::cout << "FAILED\n";
+ }
+
+
+ //delete pseg; // don't delete these; they are passed back to the calling method
+ //delete ptsrc;
+
+ // Delete device context
+ //DeleteObject(SelectObject(hdc, hfontOld));
+ //DeleteDC(hdc);
+
+ g_errorCount += errorCount;
+ return errorCount;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Copy a std::wstring (whose bytes can be of various sizes on different platforms)
+ to a buffer of UTF16.
+----------------------------------------------------------------------------------------------*/
+void CopyWstringToUtf16(std::wstring textStr, gr::utf16 * utf16Buf, int bufSize)
+{
+ std::fill_n(utf16Buf, bufSize, 0);
+ int cc = textStr.length();
+ for (int i = 0; i < cc; i++)
+ utf16Buf[i] = textStr[i];
+}
+
+/*----------------------------------------------------------------------------------------------
+ Output information about an error.
+----------------------------------------------------------------------------------------------*/
+void OutputError(TestCase * ptcase, std::string strErr, int i)
+{
+ OutputErrorAux(ptcase, strErr, i, false, 0, 0);
+}
+
+void OutputErrorWithValues(TestCase * ptcase, std::string strErr, int i,
+ int valueFound, int valueExpected)
+{
+ OutputErrorAux(ptcase, strErr, i, true, valueFound, valueExpected);
+}
+
+void OutputErrorAux(TestCase * ptcase, std::string strErr, int i,
+ bool showValues, int valueFound, int valueExpected)
+{
+// if (g_debugMode)
+// ::DebugBreak();
+
+ if (!g_silentMode)
+ {
+ //std::cout << ptcase->TestName() << ": ";
+ std::cout << strErr;
+ if (i > -1)
+ {
+ std::cout << "[" << i << "]";
+ }
+ std::cout << "\n ";
+ }
+
+ WriteToLog(strErr, i, showValues, valueFound, valueExpected);
+
+ WriteToLog("\n");
+}
+
+/*----------------------------------------------------------------------------------------------
+ Write some text to the log file.
+----------------------------------------------------------------------------------------------*/
+bool WriteToLog(std::string str, int i)
+{
+ if (g_strmLog.fail())
+ {
+ std::cout << "Error opening log file.";
+ return false;
+ }
+ g_strmLog << str;
+ if (i > -1)
+ g_strmLog << "[" << i << "]";
+ g_strmLog.flush();
+ return true;
+}
+
+bool WriteToLog(std::string str, int i,
+ bool showValues, int valueFound, int valueExpected)
+{
+ if (g_strmLog.fail())
+ {
+ std::cout << "Error opening log file.";
+ return false;
+ }
+ g_strmLog << str;
+ if (i > -1)
+ g_strmLog << "[" << i << "]";
+ if (showValues)
+ {
+ g_strmLog << "; found " << valueFound << " not " << valueExpected;
+ }
+ g_strmLog.flush();
+ return true;
+}
+
+
+bool WriteToLog(int n)
+{
+ if (g_strmLog.fail())
+ {
+ std::cout << "Error opening log file.";
+ return false;
+ }
+ g_strmLog << n;
+ g_strmLog.flush();
+ return true;
+}
+
diff --git a/Build/source/libs/graphite/test/RegressionTest/RtTextSrc.h b/Build/source/libs/graphite/test/RegressionTest/RtTextSrc.h
new file mode 100644
index 00000000000..cdbd51e90df
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/RtTextSrc.h
@@ -0,0 +1,74 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: RtTextSrc.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+
+-------------------------------------------------------------------------------*//*:End Ignore*/
+#pragma once
+#ifndef RTTXTSRC_INCLUDED
+#define RTTXTSRC_INCLUDED
+
+#include <cstring>
+
+/*----------------------------------------------------------------------------------------------
+ Class: RtTextSrc
+ This class extends the SimpleTextSource to allow setting of features.
+----------------------------------------------------------------------------------------------*/
+class RtTextSrc : public SimpleTextSrc
+{
+public:
+ RtTextSrc(gr::utf16 * pszText) : SimpleTextSrc(pszText)
+ {
+ m_fRtl = false;
+ memset(m_fset, 0, MAXFEAT * sizeof(FeatureSetting));
+ }
+
+ void setFeatures(FeatureSetting * fset)
+ {
+ m_cFeats = 0;
+ for (int i = 0; i < MAXFEAT; i++)
+ {
+ if (fset[i].id > 0)
+ {
+ m_fset[i].id = fset[i].id;
+ m_fset[i].value = fset[i].value;
+ m_cFeats++;
+ }
+ }
+ }
+
+ virtual size_t getFontFeatures(toffset ich, FeatureSetting * prgfset)
+ {
+ // Note: size of prgfset buffer = gr::kMaxFeatures = 64
+ std::copy(m_fset, m_fset + MAXFEAT, prgfset);
+ return m_cFeats;
+ }
+
+ virtual bool getRightToLeft(toffset ich)
+ {
+ return m_fRtl;
+ }
+ virtual unsigned int getDirectionDepth(toffset ich)
+ {
+ return ((m_fRtl == 1) ? 1 : 0);
+ }
+ void setRightToLeft(bool f)
+ {
+ m_fRtl = f;
+ }
+
+protected:
+ bool m_fRtl;
+ int m_cFeats;
+ FeatureSetting m_fset[MAXFEAT];
+};
+
+
+#endif // !RTTXTSRC_INCLUDED
diff --git a/Build/source/libs/graphite/test/RegressionTest/SimpleTextSrc.cpp b/Build/source/libs/graphite/test/RegressionTest/SimpleTextSrc.cpp
new file mode 100644
index 00000000000..c50799c96bc
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/SimpleTextSrc.cpp
@@ -0,0 +1,93 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: SimpleTextSrc.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ A simple text source that shows how to use this interface within Graphite.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+#pragma hdrstop
+// any other headers (not precompiled)
+
+#include "GrClient.h"
+#include "GrDebug.h"
+#include "ITextSource.h"
+#include "SimpleTextSrc.h"
+
+#undef THIS_FILE
+DEFINE_THIS_FILE
+
+//:>********************************************************************************************
+//:> Initialization and destruction
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Constructors.
+----------------------------------------------------------------------------------------------*/
+SimpleTextSrc::SimpleTextSrc(gr::utf16 * pszText)
+{
+ m_cref = 1; // COM-like behavior
+
+ //m_cchLength = wcslen(pszText); // don't use wcslen, it's not cross-platform
+ m_cchLength = 0;
+ for (gr::utf16 * pch = pszText; *pch != 0; pch++)
+ m_cchLength++;
+ m_prgchText = new gr::utf16[m_cchLength + 1];
+ std::copy(pszText, pszText + m_cchLength, m_prgchText);
+ m_prgchText[m_cchLength] = 0; // zero-terminate
+}
+
+/*----------------------------------------------------------------------------------------------
+ Destructor.
+----------------------------------------------------------------------------------------------*/
+SimpleTextSrc::~SimpleTextSrc()
+{
+ delete[] m_prgchText;
+}
+
+//:>********************************************************************************************
+//:> Interface methods
+//:>********************************************************************************************
+/*----------------------------------------------------------------------------------------------
+ Get the specified range of text
+----------------------------------------------------------------------------------------------*/
+size_t SimpleTextSrc::fetch(toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer)
+{
+ size_t ichRet = min(cch, size_t(m_cchLength - ichMin));
+ std::copy(m_prgchText + ichMin, m_prgchText+ichMin + ichRet, prgchwBuffer);
+ return ichRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return true if the text uses a right-to-left writing system.
+----------------------------------------------------------------------------------------------*/
+bool SimpleTextSrc::getRightToLeft(toffset ich)
+{
+ return false;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the depth of embedding of the writing system.
+----------------------------------------------------------------------------------------------*/
+unsigned int SimpleTextSrc::getDirectionDepth(toffset ich)
+{
+ return 0;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Return the vertical offset of the text. This simple implementation provides no
+ vertical offset.
+----------------------------------------------------------------------------------------------*/
+float SimpleTextSrc::getVerticalOffset(toffset ich)
+{
+ return 0;
+}
diff --git a/Build/source/libs/graphite/test/RegressionTest/SimpleTextSrc.h b/Build/source/libs/graphite/test/RegressionTest/SimpleTextSrc.h
new file mode 100644
index 00000000000..a5d191b4ac3
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/SimpleTextSrc.h
@@ -0,0 +1,113 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 1999, 2001 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: SimpleTextSrc.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ A simple text source that shows how to use this interface within Graphite.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+#pragma once
+#ifndef GRTXTSRC_INCLUDED
+#define GRTXTSRC_INCLUDED
+
+using namespace gr;
+
+/*----------------------------------------------------------------------------------------------
+ Class: SimpleTextSrc
+ This class provides a simple implementation for a text source for the Graphite engine.
+ There are no paragraph properties of interest and one set of character properties that
+ apply to the entire string.
+
+ This class is a subclass of IColorTextSource so that it can be used by the
+ WinSegmentPainter class, which expects the getColors method to be defined.
+----------------------------------------------------------------------------------------------*/
+class SimpleTextSrc : public IColorTextSource
+{
+public:
+ // Constructor:
+ SimpleTextSrc(gr::utf16 * pszText);
+ ~SimpleTextSrc();
+
+/*
+ virtual long IncRefCount(void)
+ {
+ return InterlockedIncrement(&m_cref);
+ }
+ virtual long DecRefCount(void)
+ {
+ long cref = InterlockedDecrement(&m_cref);
+ if (cref == 0) {
+ m_cref = 1;
+ delete this;
+ }
+ return cref;
+ }
+*/
+ // -------------------------------------------------------------------------------
+ // Interface methods:
+
+ virtual UtfType utfEncodingForm()
+ {
+ return kutf16;
+ }
+ virtual size_t getLength()
+ {
+ return m_cchLength;
+ }
+ virtual size_t fetch(toffset ichMin, size_t cch, utf32 * prgchBuffer)
+ {
+ throw;
+ }
+ virtual size_t fetch(toffset ichMin, size_t cch, gr::utf16 * prgchwBuffer);
+ virtual size_t fetch(toffset ichMin, size_t cch, utf8 * prgchsBuffer)
+ {
+ throw;
+ };
+
+ virtual bool getRightToLeft(toffset ich);
+ virtual unsigned int getDirectionDepth(toffset ich);
+ virtual float getVerticalOffset(toffset ich);
+
+ virtual isocode getLanguage(toffset ich)
+ {
+ isocode ret;
+ ret.rgch[0] = 'e'; ret.rgch[1] = 'n'; ret.rgch[2] = 0; ret.rgch[3] = 0;
+ return ret;
+ }
+
+ virtual std::pair<toffset, toffset> propertyRange(toffset ich)
+ {
+ std::pair<toffset, toffset> pairRet;
+ pairRet.first = 0;
+ pairRet.second = m_cchLength;
+ return pairRet;
+ }
+
+ virtual size_t getFontFeatures(toffset ich, FeatureSetting * prgfset)
+ {
+ return 0; // no features in this simple implementation
+ }
+ virtual bool sameSegment(toffset ich1, toffset ich2)
+ {
+ return true;
+ }
+
+ virtual void getColors(toffset ich, int * pclrFore, int * pclrBack)
+ {
+ *pclrFore = kclrBlack;
+ *pclrBack = kclrTransparent;
+ }
+
+protected:
+ long m_cref;
+ gr::utf16 * m_prgchText;
+ int m_cchLength;
+};
+
+
+#endif // !GRTXTSRC_INCLUDED
diff --git a/Build/source/libs/graphite/test/RegressionTest/TestCase.cpp b/Build/source/libs/graphite/test/RegressionTest/TestCase.cpp
new file mode 100644
index 00000000000..c9696141c95
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/TestCase.cpp
@@ -0,0 +1,1974 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2004 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: TestCase.cpp
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ File to set up test cases for the Graphite regression test program.
+
+How to add a test:
+ 1. Add the name of your test method to the class declaration in TestCase.h.
+ 2. Increment the g_numberOfTests constant in this file.
+ 3. Add a call to your test method in the SetupTests method in this file.
+ 4. Copy one of the existing test methods such as SetupSimpleTest and change the name
+ and data.
+
+Things that still need testing:
+ Ligatures (there is one small test of this)
+ Justification
+ Fake italic
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+#include "main.h"
+#include <cstring>
+
+//:>********************************************************************************************
+//:> Test constants and methods
+//:>********************************************************************************************
+
+const int g_numberOfTests = 25; // *** increment as tests are added ***
+
+TestCase * g_ptcaseList; // list of test cases
+
+namespace gr { // and it was SC who got rid of the byte defn in GrPlatform.h!
+typedef unsigned char byte;
+}
+
+
+/*----------------------------------------------------------------------------------------------
+ Create the list of tests.
+----------------------------------------------------------------------------------------------*/
+int TestCase::SetupTests(TestCase ** pptcaseList)
+{
+ g_ptcaseList = new TestCase[g_numberOfTests];
+ int cptcase = 0;
+
+ // The number of methods called here should equal g_numberOfTests above.
+ g_ptcaseList[0].SetupSimpleTest(); cptcase++;
+ g_ptcaseList[1].SetupSimpleBacktrackTest(); cptcase++;
+ g_ptcaseList[2].SetupSurrogateTest(); cptcase++;
+ g_ptcaseList[3].SetupBurmese1(); cptcase++;
+ g_ptcaseList[4].SetupBurmese2(); cptcase++;
+ g_ptcaseList[5].SetupBurmese3(); cptcase++;
+ g_ptcaseList[6].SetupBurmese4(); cptcase++;
+ g_ptcaseList[7].SetupRoman(); cptcase++;
+ g_ptcaseList[8].SetupRomanFeatures(); cptcase++;
+ g_ptcaseList[9].SetupStackingAndBridging(); cptcase++;
+ g_ptcaseList[10].SetupNoWhiteSpace(); cptcase++;
+ g_ptcaseList[11].SetupNoWhiteSpaceNoSeg(); cptcase++;
+ g_ptcaseList[12].SetupOnlyWhiteSpace(); cptcase++;
+ g_ptcaseList[13].SetupCrossLine1(); cptcase++;
+ g_ptcaseList[14].SetupCrossLine2(); cptcase++;
+ g_ptcaseList[15].SetupCrossLine3(); cptcase++;
+ g_ptcaseList[16].SetupCrossLine4(); cptcase++;
+ g_ptcaseList[17].SetupArabic1(); cptcase++;
+ g_ptcaseList[18].SetupArabic2(); cptcase++;
+ g_ptcaseList[19].SetupTaiViet1(); cptcase++;
+ g_ptcaseList[20].SetupTaiViet2(); cptcase++;
+ g_ptcaseList[21].SetupDumbFallback1(); cptcase++;
+ g_ptcaseList[22].SetupDumbFallback2(); cptcase++;
+ g_ptcaseList[23].SetupBadFont(); cptcase++;
+ g_ptcaseList[24].SetupBugTest(); cptcase++;
+ // *** Add more method calls here. ***
+
+ assert(cptcase == g_numberOfTests);
+
+ *pptcaseList = g_ptcaseList;
+
+ return g_numberOfTests;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set up a simple test.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupSimpleTest()
+{
+ m_testName = "Simple";
+ //m_debug = true;
+ //m_traceLog = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test Roman";
+ m_fontFile = "grtest_roman.ttf";
+ m_text = L"This is a test."; // text to render
+ m_fontSize = 12; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 500; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+
+ // Output:
+ m_segWidth = 86; // physical width of segment
+
+ const int charCnt = 15; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true
+ };
+
+ const int glyphCnt = 15; // number of glyphs in the segment
+
+ // need glyphCnt elements in these arrays:
+ gid16 glyphList[] = {55, 75, 76, 86, 3, 76, 86, 3, 68, 3, 87, 72, 86, 87, 17};
+ int xPositions[] = { 0, 9, 17, 22, 28, 33, 37, 43, 48, 55, 60, 64, 71, 77, 82};
+ int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ int advWidths[] = { 9, 8, 4, 6, 4, 4, 6, 4, 7, 4, 4, 7, 6, 4, 4};
+
+ int bbLefts[] = { 0, 9, 18, 22, 28, 33, 38, 43, 48, 55, 60, 65, 72, 78, 83};
+ int bbRights[] = { 9, 17, 21, 27, 33, 37, 43, 48, 55, 60, 64, 71, 77, 82, 85};
+ int bbTops[] = {10, 11, 10, 7, 0, 10, 7, 0, 7, 0, 9, 7, 7, 9, 1};
+ int bbBottoms[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+ int charsToGlyphs[] = {
+ 1, 1, 1, 2, 1, 2, 3, 1, 3, 4, 1, 4, 5, 1, 5, 6, 1, 6, 7, 1, 7
+ };
+ int c2gCount = 21;
+
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel Top, prim sel bottom, prim sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ const int clickTestCnt = 3;
+ int clickStuff[] = {
+ 11, 25, 1, false, 0, 24, 8, kAbsent, kAbsent, kAbsent, // below baseline
+ 42, 5, 7, true, 0, 24, 42, kAbsent, kAbsent, kAbsent, // near top of text
+ 90, 16, 15, true, 0, 24, 85, kAbsent, kAbsent, kAbsent // near baseline
+ };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(bbLefts, bbRights, bbTops, bbBottoms);
+ SetInsPtFlags(insPtFlags);
+ SetCharsToGlyphs(charsToGlyphs, c2gCount);
+ SetClickTests(clickTestCnt, clickStuff);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set up a simple test with backtracking.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupSimpleBacktrackTest()
+{
+ m_testName = "Simple Backtrack";
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test Roman";
+ m_fontFile = "grtest_roman.ttf";
+ m_text = L"This is a test."; // text to render
+ m_fontSize = 12; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 500; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = true;
+
+ // Output:
+ m_segWidth = 55; // physical width of segment
+
+ const int charCnt = 10; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, true, true, true, true, true, true, true, true
+ };
+
+ const int glyphCnt = 10; // number of glyphs in the segment
+
+ // need glyphCnt elements in these arrays:
+ gid16 glyphList[] = {55, 75, 76, 86, 3, 76, 86, 3, 68, 3};
+ int xPositions[] = { 0, 9, 17, 22, 28, 33, 37, 43, 48, 55};
+ int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ int advWidths[] = { 9, 8, 4, 6, 4, 4, 6, 4, 7, 4};
+
+ const int contextBlockOutSize = 10;
+ gr::byte contextBlockOut[] = { 15, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
+ SetInsPtFlags(insPtFlags);
+ SetOutputContextBlock(contextBlockOutSize, contextBlockOut);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set up a test that includes surrogates.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupSurrogateTest()
+{
+ m_testName = "Surrogates";
+ //m_debug = true;
+ //m_traceLog = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test Roman";
+ m_fontFile = "grtest_roman.ttf";
+ m_text = L"abXXcdYYe"; // text to render
+ m_text[2] = 0xD835;
+ m_text[3] = 0xDD13;
+ m_text[6] = 0xD835;
+ m_text[7] = 0xDD10;
+ m_fontSize = 12; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 500; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+
+ // Output:
+ m_segWidth = 65; // physical width of segment
+
+ const int charCnt = 9; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, true, false, true, true, true, false, true
+ };
+
+ const int glyphCnt = 7; // number of glyphs in the segment
+
+ // need glyphCnt elements in these arrays:
+ gid16 glyphList[] = {68, 69,1227, 70, 71,1015, 72};
+ int xPositions[] = { 0, 7, 15, 27, 34, 42, 58};
+ int yPositions[] = { 0, 0, 0, 0, 0, 0, 0};
+ int advWidths[] = { 7, 8, 12, 7, 8, 15, 7};
+
+ int bbLefts[] = { 0, 7, 15, 28, 35, 43, 59};
+ int bbRights[] = { 7, 14, 26, 34, 42, 57, 65};
+ int bbTops[] = { 7, 11, 10, 7, 11, 10, 7};
+ int bbBottoms[] = { 0, 0, -3, 0, 0, 0, 0};
+
+ int charsToGlyphs[] = {
+ 0, 1, 0, 1, 1, 1, 2, 1, 2, 3, 0, 4, 1, 3, 5, 1, 4, 6, 1, 5, 7, 0,
+ 8, 1, 6,
+ };
+ int c2gCount = 25;
+
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel Top, prim sel bottom, prim sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ const int clickTestCnt = 3;
+ int clickStuff[] = {
+ 17, 25, 2, false, 0, 24, 14, kAbsent, kAbsent, kAbsent, // below baseline
+ 25, 5, 4, true, 0, 24, 26, kAbsent, kAbsent, kAbsent, // near top of text
+ 55, 16, 8, true, 0, 24, 57, kAbsent, kAbsent, kAbsent // near baseline
+ };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(bbLefts, bbRights, bbTops, bbBottoms);
+ SetInsPtFlags(insPtFlags);
+ SetCharsToGlyphs(charsToGlyphs, c2gCount);
+ SetClickTests(clickTestCnt, clickStuff);
+}
+
+/*----------------------------------------------------------------------------------------------
+ A set of tests using Burmese, to test complex positioning and non-white-space
+ linebreaking.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupBurmese1()
+{
+ m_testName = "Burmese 1";
+ m_debug = false;
+ //m_traceLog = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test Burmese";
+ m_fontFile = "grtest_burmese.ttf";
+ m_text = BurmeseText();
+ m_fontSize = 20; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 300; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_backtrack = false;
+
+ // Output:
+ m_segWidth = 281; // physical width of segment
+
+ SetupBurmeseAux(
+ 64, // character count
+ 45, // glyph count
+ 5); // number of click-tests
+
+ // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices
+ int attachments[] = {
+ 0,0,0, 1,1,0, 2,2,2,3,4, 3,2,0, 4,2,0, 5,5,1,6, 6,5,0, 7,7,3,8,9,10,
+ 8,7,0, 9,7,0, 10,7,0, 11,11,0, 12,12,0, 13,13,0, 14,14,0, 15,15,0,
+ 16,16,1,17, 17,16,0, 18,18,1,19, 19,18,0, 20,20,1,21, 21,20,0, 22,22,1,23,
+ 23,22,0, 24,24,0, 25,25,0
+ };
+ int attCount = sizeof(attachments) / sizeof(int);
+ SetAttachedClusters(attachments, attCount);
+
+ const int contextBlockOutSize = 11;
+ gr::byte contextBlockOut[] = { 20, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ SetOutputContextBlock(contextBlockOutSize, contextBlockOut);
+}
+
+void TestCase::SetupBurmese2()
+{
+ m_testName = "Burmese 2";
+ //m_debug = true;
+ //m_traceLog = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test Burmese";
+ m_fontFile = "grtest_burmese.ttf";
+
+ m_text = BurmeseText();
+ m_fontSize = 20; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 275; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_backtrack = false;
+
+ // Output:
+ m_segWidth = 215; // physical width of segment
+
+ SetupBurmeseAux(
+ 47, // character count
+ 33, // glyph count
+ 3); // number of click-tests
+
+ const int contextBlockOutSize = 11;
+ gr::byte contextBlockOut[] = { 20, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ SetOutputContextBlock(contextBlockOutSize, contextBlockOut);
+}
+
+void TestCase::SetupBurmese3()
+{
+ m_testName = "Burmese 3";
+ //m_debug = true;
+ //m_traceLog = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test Burmese";
+ m_fontFile = "grtest_burmese.ttf";
+
+ m_text = BurmeseText();
+ m_fontSize = 20; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 75; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_backtrack = false;
+
+ // Output:
+ m_segWidth = 73; // physical width of segment
+
+ SetupBurmeseAux(
+ 19, // character count
+ 13, // glyph count
+ 2); // number of click-tests
+
+ const int contextBlockOutSize = 11;
+ gr::byte contextBlockOut[] = { 20, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ SetOutputContextBlock(contextBlockOutSize, contextBlockOut);
+}
+
+void TestCase::SetupBurmese4()
+{
+ m_testName = "Burmese 4";
+ //m_traceLog = true;
+ //m_debug = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test Burmese";
+ m_fontFile = "grtest_burmese.ttf";
+
+ m_text = BurmeseText();
+ m_fontSize = 20; // font size in points
+ m_prefBreak = klbWsBreak; // preferred break-weight
+ m_worstBreak = klbHyphenBreak; // worst-case break-weight
+ m_availWidth = 30; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_backtrack = false;
+
+ // Output:
+ m_noSegment = true;
+ m_segWidth = 0; // physical width of segment
+
+ SetupBurmeseAux(
+ 0, // character count
+ 0, // glyph count
+ 0); // number of click-tests
+}
+
+void TestCase::SetupBurmeseAux(int charCnt, int glyphCnt, int clickTestCnt)
+{
+ m_rtl = false;
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, false, false, false, true, false, false, false, false, // 0 - 9
+ true, false, false, true, false, false, false, true, true, true, // 10 - 19
+ true, false, true, true, false, false, true, false, false, false, // 20 - 29
+ false, true, false, false, true, false, false, false, true, true, // 30 - 39
+ true, true, true, true, true, true, true, true, true, false, // 40 - 49
+ true, true, true, false, false, false, true, false, false, true, // 50 - 59
+ false, false, false, true
+ };
+
+ // need glyphCnt elements in these arrays:
+ // 0 10 20 30 40
+ gid16 glyphList[] = {105,174,158,202,231,162,231,148,223,219,229,248, 3,226,162,173,216,231,177,195,115,231,170,204,243, 3,197,216,172,216, 3,233, 3,226,179,162,216,170,204,158,202,115,231,229, 3};
+ int xPositions[] = { 0, 17, 20, 22, 28, 29, 38, 40, 50, 55, 56, 57, 73, 79, 89, 99,102,109,110,111,120,129,130,131,140,143,149,167,174,191,198,205,215,222,232,234,245,252,253,262,264,271,280,278,281};
+ int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ int advWidths[] = { 17, 2, 9, 4, 0, 10, 0, 17, 2, 0, 0, 15, 6, 10, 10, 2, 7, 0, 10, 9, 9, 0, 10, 7, 2, 6, 17, 7, 17, 7, 6, 10, 6, 10, 2, 10, 7, 10, 7, 9, 4, 9, 0, 0, 6};
+
+ int bbLefts[] = { 0, 10, 21, 23, 23, 30, 33, 41, 51, 49, 53, 58, 73, 80, 90, 96,100,103,111,109,121,123,131,132,141,143,150,165,175,189,198,206,215,223,233,235,243,253,254,263,265,272,275,275,281};
+ int bbRights[] = { 16, 19, 28, 25, 28, 39, 38, 56, 54, 55, 56, 72, 79, 88, 98,101,109,109,119,119,129,129,139,138,142,149,166,173,190,197,205,214,222,231,244,244,251,261,260,271,267,280,280,278,288};
+ int bbTops[] = { 7, 7, 7, -1, 15, 7, 15, 7, -1, 15, -2, 15, 0, 7, 7, 7, 7, 15, 7, -1, 7, 15, 7, -1, 7, 0, 7, 7, 7, 7, 0, 7, 0, 7, 16, 7, 7, 7, -1, 7, -1, 7, 15, -2, 0};
+ int bbBottoms[] = { 0, -7, -1, -7, 9, 0, 9, 0, -7, 9, -5, 0, 0, 0, 0, -7, 0, 9, -4, -7, 0, 9, 0, -7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -7, 0, 0, 0, -7, -1, -7, 0, 9, -5, 0};
+
+ // Each group = char-index, number of glyphs, glyph-indices.
+ int charsToGlyphs[] = {
+ 0, 1, 0, 1, 1, 1, 2, 1, 1, 3, 1, 1, 4, 1, 1, 5, 1, 2, 6, 1, 3, 7, 1, 3,
+ 8, 1, 4, 9, 1, 4, 10, 1, 5, 11, 1, 6, 12, 1, 6, 13, 1, 7
+ };
+ int c2gCount = sizeof(charsToGlyphs) / sizeof(int);
+
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel Top, prim sel bottom, prim sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ int clickStuff[] = {
+ 10, 25, 1, true, 0, 25, 16, kAbsent, kAbsent, kAbsent,
+ 40, 5, 13, false, 0, 25, 39, kAbsent, kAbsent, kAbsent,
+ 93, 40, 19, false, 0, 25, 88, 0, 25, 77,
+ 251, 5, 52, true, 0, 25,251, kAbsent, kAbsent, kAbsent,
+ 235, 30, 48, false, -1, 27,230, 7, 19,243,
+ };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetCharsToGlyphs(charsToGlyphs, c2gCount);
+ SetBBs(bbLefts, bbRights, bbTops, bbBottoms);
+ SetInsPtFlags(insPtFlags);
+ SetClickTests(clickTestCnt, clickStuff);
+}
+
+std::wstring TestCase::BurmeseText()
+{
+ std::wstring strRet;
+ wchar_t charData[] = {
+ 0x1000, 0x1039, 0x101a, 0x1039, 0x101d, 0x1014, 0x1039, 0x101f, 0x1039, 0x200c,
+ 0x1015, 0x1039, 0x200c, 0x1010, 0x102f, 0x102d, 0x1037, 0x104f, 0x0020, 0x1015,
+ 0x1039, 0x101a, 0x1031, 0x102c, 0x1039, 0x200c, 0x101b, 0x1039, 0x101d, 0x1039,
+ 0x101f, 0x1004, 0x1039, 0x200c, 0x1019, 0x1039, 0x101f, 0x102f, 0x104a, 0x0020,
+ 0x101e, 0x102c, 0x101a, 0x102c, 0x0020, 0x1040, 0x0020, 0x1015, 0x1039, 0x101b,
+ 0x1031, 0x102c, 0x1019, 0x1039, 0x101f, 0x102f, 0x1014, 0x1039, 0x101f, 0x1004,
+ 0x1039, 0x200c, 0x1037, 0x0020, 0x1021, 0x1031, 0x102c, 0x1004, 0x1039, 0x200c,
+ 0x1019, 0x1039, 0x101b, 0x1004, 0x1039, 0x200c, 0x1019, 0x1039, 0x101f, 0x102f,
+ 0x1010, 0x102f, 0x102d, 0x1037, 0x101e, 0x100a, 0x1039, 0x200c, 0x0020, 0x1000,
+ 0x1039, 0x101a, 0x1039, 0x101d, 0x1014, 0x102f, 0x1039, 0x200c, 0x1015, 0x1039,
+ 0x200c, 0x1010, 0x102f, 0x102d, 0x1037, 0x104f, 0x0000
+ };
+ strRet.assign(charData);
+ return strRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ A set of tests using Roman script, which tests stacking diacritics, many-to-one glyphs,
+ and features.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupRoman()
+{
+ m_testName = "Roman";
+ m_traceLog = true;
+ //m_debug = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test Roman";
+ m_fontFile = "grtest_roman.ttf";
+ m_text = RomanText(); // text to render
+ m_fontSize = 36; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 500; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+
+ // Output:
+ m_segWidth = 278; // physical width of segment
+
+ const int charCnt = 26; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true
+ };
+
+ const int glyphCnt = 24; // number of glyphs in the segment
+
+ // need glyphCnt elements in these arrays:
+ // 0 10 20
+ gid16 glyphList[] = {72,1815,1768, 83,1789, 86, 74,1943,1956,1926,1061, 68,1777,1755,805,1815, 44,1815, 80,1833,1768,1855,1838,637};
+ int xPositions[] = { 0, 23, 23, 21, 41, 45, 64, 88, 98, 112, 116,148, 171, 171,170, 188,183, 203, 199, 230, 230, 230, 230,236};
+ int yPositions[] = { 0, 0, 10, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 0, 10, 20, 0};
+ int advWidths[] = {21, 0, 0, 24, 0, 18, 24, 13, 13, 4, 31, 21, 0, 0, 13, 0, 15, 0, 37, 0, 0, 0, 0, 41};
+
+ // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices
+ int attachments[] = {
+ 0,0,2,1,2, 1,0,0, 2,0,0, 3,3,0, 4,4,0, 5,5,0, 6,6,0, 7,7,2,8,9,
+ 8,7,0, 9,7,0, 10,10,0, 11,11,2,12,13, 12,11,0, 13,11,0, 14,14,1,15, 15,14,0,
+ 16,16,1,17, 17,16,0, 18,18,4,19,20,21,22, 19,18,0, 20,18,0, 21,18,0, 22,18,0,
+ 23,23,0
+ };
+ int attCount = sizeof(attachments) / sizeof(int);
+
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel Top, prim sel bottom, prim sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ const int clickTestCnt = 5;
+ int clickStuff[] = {
+ 10, 15, 2, false, 9, 21, 1, 20, 30, 18,
+ 61, 50, 6, true, 0, 72, 63, kAbsent, kAbsent, kAbsent,
+ 90, 40, 7, false, 0, 72, 87, kAbsent, kAbsent, kAbsent,
+ 260, 40, 25, true, 0, 73,263, kAbsent, kAbsent, kAbsent, // ligature
+ 267, 40, 25, false, 0, 73,263, kAbsent, kAbsent, kAbsent, // ligature
+ };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
+ SetAttachedClusters(attachments, attCount);
+ SetInsPtFlags(insPtFlags);
+ SetClickTests(clickTestCnt, clickStuff);
+}
+
+void TestCase::SetupRomanFeatures()
+{
+ m_testName = "Roman Features";
+ m_traceLog = true;
+ //m_debug = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test Roman";
+ m_fontFile = "grtest_roman.ttf";
+ m_text = RomanText(); // text to render
+ m_fontSize = 36; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 500; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+
+ m_fset[0].id = 1024; m_fset[0].value = 2; // capital eng with tail
+ m_fset[1].id = 1026; m_fset[1].value = 1; // tone numbers
+ m_fset[2].id = 1029; m_fset[2].value = 1; // vietnamese diacritics
+ m_fset[3].id = 1032; m_fset[3].value = 1; // literacy alternates
+ m_fset[4].id = 1034; m_fset[4].value = 1; // y-hook alternate (default)
+ m_fset[5].id = 1051; m_fset[5].value = 0; // diacritic selection
+ m_fset[6].id = 0;
+
+ // Output:
+ m_segWidth = 307; // physical width of segment
+
+ const int charCnt = 26; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, false, false, true, true, true, true, true, true, true,
+ true, true, false, false, true, false, true, false, true, false,
+ false, false, false, true, true, true
+ };
+
+ const int glyphCnt = 23; // number of glyphs in the segment
+
+ // need glyphCnt elements in these arrays:
+ // 0 10 20
+ gid16 glyphList[] = {72,1815,1768, 83,1789, 86,681,1659,1667,1662,1056,274,1778, 805,1815, 44,1815, 80,1833,1768,1855,1838,637};
+ int xPositions[] = { 0, 23, 23, 21, 41, 45, 64, 87, 104, 121, 138,173, 174, 198, 217, 211, 231, 227, 258, 258, 258, 258,265};
+ int yPositions[] = { 0, 0, 10, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 10, 20, 0};
+ int advWidths[] = {21, 0, 0, 24, 0, 18, 23, 17, 17, 17, 34, 24, 24, 13, 0, 15, 0, 37, 0, 0, 0, 0, 41};
+
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel Top, prim sel bottom, prim sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ const int clickTestCnt = 3;
+ int clickStuff[] = {
+ 10, 15, 3, true, 0, 72, 20, kAbsent, kAbsent, kAbsent,
+ 116, 5, 9, true, 0, 72, 120, kAbsent, kAbsent, kAbsent,
+ 90, 40, 7, false, 0, 72, 86, kAbsent, kAbsent, kAbsent
+ };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
+ SetInsPtFlags(insPtFlags);
+ SetClickTests(clickTestCnt, clickStuff);
+}
+
+std::wstring TestCase::RomanText()
+{
+ std::wstring strRet;
+ wchar_t charData[] = {
+ 0x0065, 0x0303, 0x0300, 0x0070, 0x0361, 0x0073, 0x0067, 0x02e8, 0x02e5, 0x02e7,
+ 0x014a, 0x0061, 0x0302, 0x0301, 0x0069, 0x0303, 0x0049, 0x0303, 0x006d, 0x033c,
+ 0x0300, 0x0308, 0x0304, 0x0066, 0x0066, 0x0069, 0x0000
+ };
+ strRet.assign(charData);
+ return strRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ A set of tests for handling complex diacritic stacking and bridging.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupStackingAndBridging()
+{
+ m_testName = "Roman Stacking and Bridging";
+ //m_traceLog = true;
+ //m_debug = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test Roman";
+ m_fontFile = "grtest_roman.ttf";
+ m_fontSize = 36; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 500; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+
+ // text to render
+ wchar_t charData[] = {
+ 0x0061,0x035d,0x0061,0x0020,0x0074,0x035d,0x0061,0x0020,0x0061,0x0300,
+ 0x0300,0x035d,0x0061,0x0020,0x0283,0x0300,0x0300,0x035d,0x0061,0x0020,
+ 0x0061,0x0316,0x0316,0xf176,0x0061,0x0020,0x0283,0x0300,0x0300,0xf176,
+ 0x0061,0x0020,0x0061,0x0316,0x0316,0xf176,0x0061,0x0020,0x0283,0x035d,
+ 0xf176,0x0061,0x0000
+ };
+ m_text.assign(charData);
+
+ // Output:
+ m_segWidth = 414; // physical width of segment
+
+ const int charCnt = 42; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true,
+ };
+
+ const int glyphCnt = 42; // number of glyphs in the segment
+
+ // 68 = a, 97 = t, 1305 = esh, 1768 = upper grave, 1765 = lower grave, 1802 = upper bridge,
+ // 1801 = lower bridge
+
+ // need glyphCnt elements in these arrays:
+ // 0 10 20 30 40
+ gid16 glyphList[] = {68,1802, 68, 3, 87,1802, 68, 3, 68,1768,1768,1802, 68, 3,1305,1768,1768,1802, 68, 3, 68,1765,1765,1801, 68, 3,1305,1768,1768,1801, 68, 3, 68,1765,1765,1801, 68, 3,1305,1802,1801, 68};
+ int xPositions[] = { 0, 21, 21, 42, 56, 73, 69, 91, 105, 127, 127, 126, 126,147, 161, 181, 181, 178,177,199,212, 235, 235, 234,234,255, 269, 289, 289, 286,285,307,320, 343, 343, 342,342,363, 377, 393, 393,393};
+ int yPositions[] = { 0, -7, 0, 0, 0, -1, 0, 0, 0, 0, 10, 12, 0, 0, 0, 10, 20, 23, 0, 0, 0, 0, -9, -17, 0, 0, 0, 10, 20, -6, 0, 0, 0, 0, -9, -17, 0, 0, 0, 3, -6, 0};
+ int advWidths[] = {21, 0, 21, 13, 13, 0, 21, 13, 21, 0, 0, 0, 21, 13, 16, 0, 0, 0, 21, 13, 21, 0, 0, 0, 21, 13, 16, 0, 0, 0, 21, 13, 21, 0, 0, 0, 21, 13, 16, 0, 0, 21};
+
+ int bbLefts[] = { 1, 0, 23, 42, 56, 52, 71, 91, 106, 108, 108, 105, 128,147, 159, 162, 162, 157,179,199,214, 217, 217, 213,235,255, 267, 270, 270, 265,287,307,322, 325, 325, 321,343,363, 375, 373, 373,395};
+ int bbRights[] = {21, 41, 42, 56, 69, 93, 91,105, 126, 119, 119, 146, 147,161, 178, 173, 173, 198,199,212,234, 228, 228, 254,255,269, 286, 281, 281, 306,306,320,342, 336, 336, 362,363,377, 394, 413, 414,414};
+ int bbTops [] = {22, 33, 22, 0, 28, 40, 22, 0, 22, 32, 42, 54, 22, 0, 33, 42, 53, 64, 22, 0, 22, -3, -13, -26, 22, 0, 33, 42, 53, -15, 22, 0, 22, -3, -13, -26, 22, 0, 33, 44, -15, 22};
+ int bbBottoms [] = { 0, 26, 0, 0, 0, 33, 0, 0, 0, 24, 34, 47, 0, 0, -10, 34, 44, 57, 0, 0, 0, -11, -21, -32, 0, 0, -10, 34, 44, -21, 0, 0, 0, -11, -21, -32, 0, 0, -10, 38, -21, 0};
+
+ // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices
+ int attachments[] = {
+ 0,0,0, 1,1,0, 2,2,0, 3,3,0, 4,4,0, 5,5,0, 6,6,0, 7,7,0,
+ 8,8,2,9,10, 9,8,0, 10,8,0, 11,11,0, 12,12,0, 13,13,0, 14,14,2,15,16,
+ 15,14,0, 16,14,0, 17,17,0, 18,18,0, 19,19,0, 20,20,2,21,22, 21,20,0,
+ 22,20,0, 23,23,0, 24,24,0, 25,25,0, 26,26,2,27,28, 27,26,0, 28,26,0,
+ 29,29,0, 30,30,0, 31,31,0, 32,32,2,33,34, 33,32,0, 34,32,0, 35,35,0,
+ 36,36,0, 37,37,0, 38,38,0, 39,39,0, 40,40,0, 41,41,0
+ };
+ int attCount = sizeof(attachments) / sizeof(int);
+
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel Top, prim sel bottom, prim sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ const int clickTestCnt = 6;
+ int clickStuff[] = {
+ 109, 25, 9, false, 19, 32, 105, 30, 56, 125, // first grave on 4th a
+ 178, 26, 15, true, 19, 66, 176, 9, 21, 159, // top of 1st esh, right side
+ 220, 84, 23, false, 78, 89, 210, 65, 77, 228, // first lower bridge diac
+ 271, 40, 26, false, 0, 72, 266, kAbsent, kAbsent, kAbsent, // second esh, left side
+ 271, 65, 26, false, 0, 72, 266, kAbsent, kAbsent, kAbsent, // just below second esh, left side
+ 271, 68, 29, false, 67, 78, 262, 0, 11, 280 // lower bridge diac under esh, left side
+ };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(bbLefts, bbRights, bbTops, bbBottoms);
+ SetInsPtFlags(insPtFlags);
+ SetAttachedClusters(attachments, attCount);
+ SetClickTests(clickTestCnt, clickStuff);
+}
+
+/*----------------------------------------------------------------------------------------------
+ A set of tests for handling trailing whitespace.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupNoWhiteSpace()
+{
+ m_testName = "No white space";
+ //m_debug = true;
+ //m_traceLog = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test Roman";
+ m_fontFile = "grtest_roman.ttf";
+ m_text = L"The quick brown fox."; // text to render
+ m_fontSize = 12; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 150; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+ m_twsh = ktwshNoWs;
+ m_paraRtl = true;
+
+ // Output:
+ m_segWidth = 115; // physical width of segment
+
+ const int charCnt = 16; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true
+ };
+
+ const int glyphCnt = 16; // number of glyphs in the segment
+
+ // need glyphCnt elements in these arrays:
+ gid16 glyphList[] = {55, 75, 72, 3, 3, 84, 88, 76, 70, 78, 3, 69, 85, 82, 90, 81};
+ int xPositions[] = { 0, 9, 17, 24, 29, 34, 42, 50, 54, 61, 69, 74, 82, 87, 95,107};
+ int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ int advWidths[] = { 9, 8, 7, 4, 4, 8, 8, 4, 7, 8, 4, 8, 5, 8, 11, 8};
+
+ const int contextBlockOutSize = 10;
+ gr::byte contextBlockOut[] = { 15, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
+ SetInsPtFlags(insPtFlags);
+ SetClickTests(0, NULL);
+ SetOutputContextBlock(contextBlockOutSize, contextBlockOut);
+}
+
+void TestCase::SetupNoWhiteSpaceNoSeg()
+{
+ m_testName = "No white space - no segment";
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test Roman";
+ m_fontFile = "grtest_roman.ttf";
+ m_text = L"The quick brown fox."; // text to render
+ m_firstChar = 15; // spaces after brown
+ m_fontSize = 12; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 2; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+ m_twsh = ktwshNoWs;
+ m_paraRtl = true;
+
+ // Output:
+ m_noSegment = true;
+ m_segWidth = 0; // physical width of segment
+
+ const int charCnt = 0; // number of characters in the segment
+
+ const int glyphCnt = 0; // number of glyphs in the segment
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+}
+
+void TestCase::SetupOnlyWhiteSpace()
+{
+ m_testName = "Only white space";
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test Roman";
+ m_fontFile = "grtest_roman.ttf";
+ m_text = L" fox."; // text to render
+ m_fontSize = 12; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 2; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+ m_twsh = ktwshOnlyWs;
+ m_paraRtl = true;
+
+ // Output:
+ m_segWidth = 0; // physical width of segment - visible
+
+ const int charCnt = 3; // number of characters in the segment
+ // need charCnt elements in this array:
+ bool insPtFlags[] = { true, true, true };
+
+ const int glyphCnt = 3; // number of glyphs in the segment
+ // need glyphCnt elements in these arrays:
+ gid16 glyphList[] = { 3, 3, 3 };
+ int xPositions[] = { -4, -9,-13 };
+ int yPositions[] = { 0, 0, 0 };
+ int advWidths[] = { 4, 4, 4 };
+
+ // TODO: add click tests when the bug fix with upstream tr white space is integrated.
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel Top, prim sel bottom, prim sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ const int clickTestCnt = 6;
+ int clickStuff[] = {
+ 2, 25, 0, false, 0, 24, -1, kAbsent, kAbsent, kAbsent,
+ -1, 5, 0, false, 0, 24, -1, kAbsent, kAbsent, kAbsent,
+ -6, -3, 1, false, 0, 24, -5, kAbsent, kAbsent, kAbsent,
+ -8, -3, 2, true, 0, 24, -10, kAbsent, kAbsent, kAbsent,
+ -13, 40, 3, true, 0, 24, -14, kAbsent, kAbsent, kAbsent,
+ -18, 0, 3, true, 0, 24, -14, kAbsent, kAbsent, kAbsent
+ };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
+ SetInsPtFlags(insPtFlags);
+ SetClickTests(clickTestCnt, clickStuff);
+}
+
+/*----------------------------------------------------------------------------------------------
+ A set of tests of cross-line contextualization.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupCrossLine1()
+{
+ m_testName = "Cross-line 1";
+ //m_traceLog = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test CrossLine";
+ m_fontFile = "grtest_xline.ttf";
+ m_text = CrossLineText(); // "abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww";
+ m_fontSize = 30; // font size in points
+ m_prefBreak = klbHyphenBreak; // preferred break-weight
+ m_availWidth = 350; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+
+ // Output:
+ m_segWidth = 312; // physical width of segment
+
+ const int charCnt = 10; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, true, true, true, true, true, true, true, true
+ };
+
+ const int glyphCnt = 13; // number of glyphs in the segment
+
+ // need glyphCnt elements in these arrays:
+ gid16 glyphList[] = {30, 67, 68, 69, 70, 70, 70, 70, 71, 72, 34, 90, 32 };
+ int xPositions[] = { 0, 40, 58, 79, 97,118,139,160,180,199,213,251,272 };
+ int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ int advWidths[] = {40, 18, 20, 18, 20, 20, 20, 20, 18, 13, 38, 20, 40 };
+
+ // TODO: add click tests
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel Top, prim sel bottom, prim sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ const int clickTestCnt = 0;
+ int * clickStuff = NULL;
+ //int clickStuff[] = ;
+ //{
+ // 10, 25, 1, false, 0, 24, 9, kAbsent, kAbsent, kAbsent,
+ //};
+
+ const int contextBlockOutSize = 9;
+ gr::byte contextBlockOut[] = { 20, 1, 0, 2, 0, 0, 4, 0, 0, 0 };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
+ SetInsPtFlags(insPtFlags);
+ SetClickTests(clickTestCnt, clickStuff);
+ SetOutputContextBlock(contextBlockOutSize, contextBlockOut);
+}
+
+void TestCase::SetupCrossLine2()
+{
+ m_testName = "Cross-line 2";
+ //m_traceLog = true;
+ //m_debug = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test CrossLine";
+ m_fontFile = "grtest_xline.ttf";
+ m_text = CrossLineText(); // "abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww";
+ m_firstChar = 10;
+ m_fontSize = 30; // font size in points
+ m_prefBreak = klbHyphenBreak; // preferred break-weight
+ m_availWidth = 400; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+ m_initWithPrev = true;
+
+ const int contextBlockInSize = 9; // output from Cross-line 1
+ gr::byte contextBlockIn[] = { 20, 1, 0, 2, 0, 0, 4, 0, 0, 0 };
+
+ // Output:
+ m_segWidth = 395; // physical width of segment
+
+ const int charCnt = 13; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ false, true, true, true, true, true, true, true, true, true, true, true, true
+ };
+
+ const int glyphCnt = 15; // number of glyphs in the segment
+
+ // need glyphCnt elements in these arrays:
+ gid16 glyphList[] = {30, 34, 73, 74, 75, 76, 77, 79, 79, 79, 79, 80, 6, 91, 32 };
+ int xPositions[] = { 0, 40, 78, 99,119,131,143,163,196,228,260,293,314,334,355 };
+ int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ int advWidths[] = {40, 38, 20, 20, 11, 11, 20, 32, 32, 32, 32, 20, 20, 20, 40 };
+
+ // TODO: add click tests
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel Top, prim sel bottom, prim sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ const int clickTestCnt = 0;
+ int * clickStuff = NULL;
+ //int clickStuff[] = ;
+ //{
+ // 10, 25, 1, false, 0, 24, 9, kAbsent, kAbsent, kAbsent,
+ //};
+
+ const int contextBlockOutSize = 9;
+ gr::byte contextBlockOut[] = { 20, 1, 0, 3, 0, 0, 4, 0, 0, 0 };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
+ SetInsPtFlags(insPtFlags);
+ SetClickTests(clickTestCnt, clickStuff);
+ SetInputContextBlock(contextBlockInSize, contextBlockIn);
+ SetOutputContextBlock(contextBlockOutSize, contextBlockOut);
+}
+
+void TestCase::SetupCrossLine3()
+{
+ m_testName = "Cross-line 3";
+ m_traceLog = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test CrossLine";
+ m_fontFile = "grtest_xline.ttf";
+ m_text = CrossLineText(); // "abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww";
+ m_firstChar = 23;
+ m_fontSize = 30; // font size in points
+ m_prefBreak = klbHyphenBreak; // preferred break-weight
+ m_availWidth = 400; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+ m_initWithPrev = true;
+
+ const int contextBlockInSize = 9; // output from Cross-line 2
+ gr::byte contextBlockIn[] = { 20, 1, 0, 3, 0, 0, 4, 0, 0, 0 };
+
+ // Output:
+ m_segWidth = 358; // physical width of segment
+
+ const int charCnt = 13; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, true, true, true, true, true, true, true, true, true, false, true
+ };
+
+ const int glyphCnt = 16; // number of glyphs in the segment
+
+ // need glyphCnt elements in these arrays:
+ gid16 glyphList[] = {30, 81, 6, 82, 82, 82, 82, 82, 83, 84, 85, 85, 85, 34, 8, 92 };
+ int xPositions[] = { 0, 40, 60, 81,102,123,144,164,185,206,220,236,253,269,307,339 };
+ int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ int advWidths[] = {40, 20, 20, 20, 20, 20, 20, 20, 20, 14, 16, 16, 16, 38, 32, 18 };
+
+ // TODO: add click tests
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel Top, prim sel bottom, prim sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ const int clickTestCnt = 0;
+ int * clickStuff = NULL;
+ //int clickStuff[] = ;
+ //{
+ // 10, 25, 1, false, 0, 24, 9, kAbsent, kAbsent, kAbsent,
+ //};
+
+ const int contextBlockOutSize = 9;
+ gr::byte contextBlockOut[] = { 20, 1, 0, 3, 0, 0, 4, 0, 0, 0 };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
+ SetInsPtFlags(insPtFlags);
+ SetClickTests(clickTestCnt, clickStuff);
+ SetInputContextBlock(contextBlockInSize, contextBlockIn);
+ SetOutputContextBlock(contextBlockOutSize, contextBlockOut);
+}
+
+void TestCase::SetupCrossLine4()
+{
+ m_testName = "Cross-line 4";
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test CrossLine";
+ m_fontFile = "grtest_xline.ttf";
+ m_text = CrossLineText(); // "abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww";
+ m_firstChar = 36;
+ m_fontSize = 30; // font size in points
+ m_prefBreak = klbHyphenBreak; // preferred break-weight
+ m_availWidth = 400; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+ m_initWithPrev = true;
+
+ const int contextBlockInSize = 9; // output from Cross-line 3
+ gr::byte contextBlockIn[] = { 20, 1, 0, 3, 0, 0, 4, 0, 0, 0 };
+
+ // Output:
+ m_segWidth = 248; // physical width of segment
+
+ const int charCnt = 8; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ false, true, true, true, true, true, true, true
+ };
+
+ const int glyphCnt = 10; // number of glyphs in the segment
+
+ // need glyphCnt elements in these arrays:
+ gid16 glyphList[] = { 8, 6, 86, 86, 86, 89, 89, 89, 89, 32 };
+ int xPositions[] = { 0, 32, 53, 64, 76, 87,117,147,177,208 };
+ int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ int advWidths[] = {32, 20, 11, 11, 11, 30, 30, 30, 30, 40 };
+
+ // TODO: add click tests
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel Top, prim sel bottom, prim sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ const int clickTestCnt = 0;
+ int * clickStuff = NULL;
+ //int clickStuff[] = ;
+ //{
+ // 10, 25, 1, false, 0, 24, 9, kAbsent, kAbsent, kAbsent,
+ //};
+
+ const int contextBlockOutSize = 0;
+ gr::byte * contextBlockOut = NULL;
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
+ SetInsPtFlags(insPtFlags);
+ SetClickTests(clickTestCnt, clickStuff);
+ SetInputContextBlock(contextBlockInSize, contextBlockIn);
+ SetOutputContextBlock(contextBlockOutSize, contextBlockOut);
+}
+
+std::wstring TestCase::CrossLineText()
+{
+ // The equivalent data is in the "xlineTest.wpx" file.
+ std::wstring strRet;
+ strRet.assign(L"abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww");
+ return strRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ A set of tests using Arabic: RTL, bidi, and embedded direction codes.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupArabic1()
+{
+ m_testName = "Arabic 1";
+ //m_debug = true;
+ //m_traceLog = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test Arabic";
+ m_fontFile = "grtest_arabic.ttf";
+ m_text = ArabicText();
+ m_fontSize = 20; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 1000; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_backtrack = false;
+
+ // Output:
+ m_segWidth = 409; // physical width of segment
+
+ SetupArabicAux(
+ 61, // character count
+ 61); // glyph count
+
+ // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices
+ int attachments[] = {
+ 0,0,0, 1,1,1,2, 2,1,0, 3,3,4,4,5,6,7, 4,3,0, 5,3,0, 6,3,0, 7,3,0,
+ 8,8,0, 9,9,4,10,11,12,13, 10,9,0, 11,9,0, 12,9,0, 13,9,0, 14,14,0,
+ 15,15,0, 16,16,1,17, 17,16,0, 18,18,1,19, 19,18,0 // etc
+ };
+ int attCount = sizeof(attachments) / sizeof(int);
+ SetAttachedClusters(attachments, attCount);
+
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel Top, prim sel bottom, prim sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ int clickStuff[] = {
+ 199, 13, 37, true, 0, 35,196, kAbsent, kAbsent, kAbsent,
+ 396, 13, 3, false, 8, 26,399, 10, 17, 397,
+ 396, 8, 6, true, 3, 11,391, 9, 22, 394,
+ 222, 5, 32, true, 0, 35,225, kAbsent, kAbsent, kAbsent,
+ 217, 5, 31, false, 0, 35,215, 0, 35, 246,
+ };
+ SetClickTests(4, clickStuff);
+}
+
+void TestCase::SetupArabic2()
+{
+ m_testName = "Arabic 2";
+ m_debug = false;
+ //m_traceLog = false;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test Arabic";
+ m_fontFile = "grtest_arabic.ttf";
+ m_text = ArabicText();
+ m_fontSize = 20; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 230; // width available for segment-break after number
+ m_bold = false;
+ m_italic = false;
+ m_backtrack = false;
+
+ // Output:
+ m_segWidth = 193; // physical width of segment
+
+ SetupArabicAux(
+ 35, // character count
+ 35); // glyph count
+
+ // The x-positions are different for a shorter segment:
+ // 0 10 20 30
+ int xPositions[] = {188,183,184,177,178,178,170,169,162,150,154,154,153,155,139,132,127,127,115,118,108,102, 84, 77, 77, 72, 65, 46, 46, 37, 31, 20, 10, 0, -6};
+ SetXPositions(xPositions);
+}
+
+void TestCase::SetupArabicAux(int charCnt, int glyphCnt)
+{
+ m_rtl = true;
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, true, true, true, true, true, true, true, true, // 0 - 9
+ true, true, true, true, true, true, true, true, true, true, // 10 - 19
+ true, true, true, true, true, true, true, true, true, true, // 20 - 29
+ true, true, true, true, true, true, true, true, true, true, // 30 - 39
+ true, true, true, true, true, true, true, true, true, true, // 40 - 49
+ true, true, true, true, true, true, true, true, true, true, // 50 - 59
+ true
+ };
+
+ // need glyphCnt elements in these arrays:
+ // 0 10 20 30 40 50 60
+ gid16 glyphList[] = {785,658,907,1182,913,907,1192,907, 3,811,914,909,911,934,592, 3,785,909,621,911, 12, 3,321, 3,236,659,731,555,925,961, 3,992,991,990, 3,821,924,712,474,882,527, 3,411,924,950, 3,236,990,991,992,993,995,236, 3,821,769,455,290,839,620,961};
+ int xPositions[] = {404,400,401, 393,394,394, 386,385,379,366,370,370,370,371,355,348,343,343,331,334,324,318,300,293,293,289,281,263,262,254,247,237,226,216,209,197,197,189,179,172,154,147,135,139,127,120,120,110, 99, 89, 79, 68, 68, 62, 50, 41, 36, 29, 19, 8, 0};
+ int yPositions[] = { 0, 0, -5, 0, 0, 4, 0, 0, 0, 0, -5, -3, -2, 4, 0, 0, 0, 1, 0, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ int advWidths[] = { 4, 4, 0, 6, 0, 0, 6, 0, 6, 12, 0, 0, 0, 0, 11, 6, 4, 0, 11, 0, 7, 6, 17, 6, 0, 4, 7, 18, 0, 8, 6, 10, 10, 10, 6, 11, 0, 7, 9, 7, 17, 6, 11, 0, 8, 6, 0, 10, 10, 10, 10, 10, 0, 6, 11, 9, 4, 6, 9, 11, 8};
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
+ SetInsPtFlags(insPtFlags);
+}
+
+std::wstring TestCase::ArabicText()
+{
+ std::wstring strRet;
+ wchar_t charData[] = {
+ 0x0628, 0x0628, 0x064e, 0x0644, 0x064e, 0x0654, 0x0627, 0x064e, 0x0020, 0x0686,
+ 0x0650, 0x0652, 0x0655, 0x06e0, 0x06a8, 0x0020, 0x0628, 0x0650, 0x06b9, 0x0652,
+ 0x0029, 0x0020, 0x0628, 0x0020, 0x200d, 0x062a, 0x06a8, 0x0633, 0x0670, 0x061b,
+ 0x0020, 0x06f1, 0x06f2, 0x06f3, 0x0020, 0x0633, 0x0670, 0x0639, 0x062f, 0x0645,
+ 0x067e, 0x0020, 0x0644, 0x0670, 0x060c, 0x0020, 0x202e, 0x06f1, 0x06f2, 0x06f3,
+ 0x06f4, 0x06f5, 0x202c, 0x0020, 0x0633, 0x0647, 0x0627, 0x0631, 0x0639, 0x0646,
+ 0x061b, 0x0000
+ };
+ strRet.assign(charData);
+ return strRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ A set of tests that uses Tai Viet script to test positioning.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupTaiViet1()
+{
+ m_testName = "Tai Viet Collisions";
+ //m_traceLog = true;
+ //m_debug = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test TaiViet";
+ m_fontFile = "grtest_taiviet.ttf";
+ m_fontSize = 36; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 2000; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+ m_text = TaiVietText();
+
+ m_fset[0].id = 2001; m_fset[0].value = 2; // vowel position = final consonant
+ m_fset[1].id = 1051; m_fset[1].value = 0; // diacritic selection = off
+ m_fset[2].id = 2102; m_fset[2].value = 0; // collision avoidance = off
+ m_fset[3].id = 0;
+
+ // Output:
+ m_segWidth = 946; // physical width of segment
+
+ const int charCnt = 46; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, false, true, true, true, false, true, true, true,
+ false, false, true, true, false, true, true, false, false, true,
+ true, false, false, true, true, false, false, true, true, false,
+ false, true, true, false, true, true, false, false, true, true,
+ false, true, true, true, false, false
+ };
+
+ const int glyphCnt = 46; // number of glyphs in the segment
+
+ // need glyphCnt elements in these arrays:
+ // 0 10 20 30 40
+ gid16 glyphList[] = {59, 70, 71, 65, 59, 70, 71, 23, 32, 175, 70, 65, 55, 70, 73, 55, 175, 184,185, 55, 76, 184,185, 55, 77, 70, 185, 41, 77, 70, 23, 56,175, 65, 27, 93, 70,185, 53, 69, 81, 50, 27,175, 70, 23};
+ int xPositions[] = { 0, 72, 47, 72,101, 174,149,174, 206, 281, 283, 251, 283,352, 316, 352, 418, 425,386,425,493, 495,458, 495,556,559, 528, 559, 623, 623,591,623,706, 676, 706, 776,777,738, 777, 836, 816,843,880,944,946,912};
+ int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 5, 13, 0, 0, 5, 22, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 19, 0, 0, 8, 0, 0, 0, 5, 21, 0};
+ int advWidths[] = {47, 0, 24, 29, 47, 0, 24, 32, 44, 0, 0, 29, 33, 0, 36, 33, 0, 0, 26, 33, 0, 0, 26, 33, 0, 0, 26, 32, 0, 0, 32, 52, 0, 29, 32, 0, 0, 26, 39, 0, 26, 36, 32, 0, 0, 32};
+
+ int bbLefts[] = { 5, 45, 52, 73,106, 147,154,177, 209, 254, 257, 252, 286,326, 322, 355, 391, 414,390,428,463, 484, 462,498,540,532, 532, 562, 607, 597,594,627,679, 677, 709, 744,751,742, 784, 825, 820,849,883,917,919,915};
+ int bbRights[] = {72, 72, 63, 97,174, 174,165,211, 277, 281, 283, 276, 349,352, 355, 419, 418, 422,409,491,494, 491, 481,561,553,559, 551, 621, 620, 623,628,681,706, 701, 756, 776,777,761, 835, 833, 840,882,930,944,946,949};
+ int bbTops [] = {60, 50, 25, 25, 60, 50, 25, 41, 60, 49, 66, 25, 60, 50, 40, 60, 55, 65, 36, 60, 56, 74, 36, 60, -5, 55, 36, 60, -5, 50, 41, 40, 49, 25, 55, 56, 69, 36, 55, 61, 41, 40, 55, 55, 71, 41};
+ int bbBottoms [] = { 0, 35, 0, 0, 0, 35, 0, 0, 0, 34, 50, 0, 0, 35, 0, 0, 39, 51, 0, 0, 40, 60, 0, 0,-27, 40, 0, 0, -27, 35, 0, 0, 34, 0, 0, 40, 54, 0, 0, 45, 0, 0, 0, 39, 56, 0};
+
+ // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices
+ int attachments[] = {
+ 0,0,0, 1,2,0, 2,2,1,1, 3,3,0, 4,4,0, 5,6,0, 6,6,1,5, 7,7,0,
+ 8,8,0, 9,11,0, 10,11,0, 11,11,2,9,10, 12,12,0, 13,14,0, 14,14,1,13,
+ 15,15,0, 16,18,0, 17,18,0, 18,18,2,16,17, 19,19,0, 20,22,0, 21,22,0,
+ 22,22,2,20,21, 23,23,0, 24,26,0, 25,26,0, 26,26,2,24,25, 27,27,0, 28,30,0,
+ 29,30,0, 30,30,2,28,29, 31,31,0, 32,33,0, 33,33,1,32, 34,34,0, 35,37,0,
+ 36,37,0, 37,37,2,35,36, 38,38,0, 39,40,0, 40,40,1,39, 41,41,0, 42,42,0,
+ 43,45,0, 44,45,0, 45,45,2,43,44
+ };
+ int attCount = sizeof(attachments) / sizeof(int);
+
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel Top, prim sel bottom, prim sel left,
+ // sec sel Top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ const int clickTestCnt = 4;
+ int clickStuff[] = {
+ 55, 40, 1, true, 0,100, 46, kAbsent, kAbsent, kAbsent,
+ 65, 20, 1, false, 0,100, 46, kAbsent, kAbsent, kAbsent, // adjust to the left to get a valid IP?
+ 95, 84, 4, true, 0,100, 100, kAbsent, kAbsent, kAbsent,
+ 104, 40, 4, false, 0,100, 100, kAbsent, kAbsent, kAbsent
+ };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(bbLefts, bbRights, bbTops, bbBottoms);
+ SetInsPtFlags(insPtFlags);
+ SetAttachedClusters(attachments, attCount);
+ SetClickTests(clickTestCnt, clickStuff);
+}
+
+/*----------------------------------------------------------------------------------------------
+ A set of tests that uses Tai Viet script to test positioning.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupTaiViet2()
+{
+ m_testName = "Tai Viet No Collisions";
+ //m_traceLog = true;
+ //m_debug = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"Graphite Test TaiViet";
+ m_fontFile = "grtest_taiviet.ttf";
+ m_fontSize = 36; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 2000; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+ m_text = TaiVietText();
+
+ m_fset[0].id = 2001; m_fset[0].value = 2; // vowel position = final consonant
+ m_fset[1].id = 1051; m_fset[1].value = 1; // diacritic selection = on
+ m_fset[2].id = 2102; m_fset[2].value = 1; // collision avoidance = off
+ m_fset[3].id = 0;
+
+ // Output:
+ m_segWidth = 947; // physical width of segment
+
+ const int charCnt = 46; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true
+ };
+
+ const int glyphCnt = 46; // number of glyphs in the segment
+
+ // need glyphCnt elements in these arrays:
+ // 0 10 20 30 40
+ gid16 glyphList[] = {59, 70, 71, 65, 59, 70, 71, 23, 32, 175, 70, 65, 55, 70, 73, 55, 175, 184,185, 55, 76, 184,185, 55, 77, 70, 185, 41, 77, 70, 23, 56,175, 65, 27, 93, 70,185, 53, 69, 81, 50, 27,175, 70, 23};
+ int xPositions[] = { 0, 82, 47, 72,101, 184,149,174, 206, 281, 283, 251, 283,359, 316, 352, 418, 431,386,425,496, 508,458, 497,559,578, 530, 561, 626, 635,593,626,709, 678, 708, 778,780,740, 780, 853, 819,846,882,942,947,914};
+ int yPositions[] = { 0, -3, 0, 0, 0, -3, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 9, 0, 0, 2, 20, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -4, 0, 0, 5, 25, 0, 0, 8, 0, 0, 0, 0, 23, 0};
+ int advWidths[] = {47, 0, 24, 29, 47, 0, 24, 32, 44, 0, 0, 29, 33, 0, 36, 33, 0, 0, 26, 33, 0, 0, 26, 33, 0, 0, 26, 32, 0, 0, 32, 52, 0, 29, 32, 0, 0, 26, 39, 0, 26, 36, 32, 0, 0, 32};
+
+ int bbLefts[] = { 5, 56, 52, 73,106, 158,154,177, 209, 254, 257, 252, 286,333, 322, 355, 391, 420,390,428,466, 497, 462,500,542,552, 534, 564, 609, 609,597,629,682, 679, 711, 747,753,744, 786, 842, 823,851,885,916,921,918};
+ int bbRights[] = {72, 82, 63, 97,174, 184,165,211, 277, 281, 283, 276, 349,359, 355, 419, 418, 427,409,491,496, 504, 481,564,555,578, 553, 624, 622, 635,630,684,709, 703, 758, 778,780,763, 837, 850, 842,885,932,942,947,951};
+ int bbTops [] = {60, 46, 25, 25, 60, 46, 25, 41, 60, 49, 73, 25, 60, 50, 40, 60, 50, 60, 36, 60, 54, 72, 36, 60, -5, 52, 36, 60, -5, 50, 41, 40, 45, 25, 55, 56, 75, 36, 55, 61, 41, 40, 55, 50, 73, 41};
+ int bbBottoms [] = { 0, 31, 0, 0, 0, 31, 0, 0, 0, 34, 57, 0, 0, 35, 0, 0, 34, 46, 0, 0, 37, 57, 0, 0,-27, 36, 0, 0, -27, 35, 0, 0, 29, 0, 0, 40, 60, 0, 0, 45, 0, 0, 0, 34, 58, 0};
+
+ // Each group = glyph-index, base, number of attached, glyphs, attached-glyph-indices
+ int attachments[] = {
+ 0,0,0, 1,2,0, 2,2,1,1, 3,3,0, 4,4,0, 5,6,0, 6,6,1,5, 7,7,0,
+ 8,8,0, 9,11,0, 10,11,0, 11,11,2,9,10, 12,12,0, 13,14,0, 14,14,1,13,
+ 15,15,0, 16,18,0, 17,18,0, 18,18,2,16,17, 19,19,0, 20,22,0, 21,22,0,
+ 22,22,2,20,21, 23,23,0, 24,26,0, 25,26,0, 26,26,2,24,25, 27,27,0, 28,30,0,
+ 29,30,0, 30,30,2,28,29, 31,31,0, 32,33,0, 33,33,1,32, 34,34,0, 35,37,0,
+ 36,37,0, 37,37,2,35,36, 38,38,0, 39,40,0, 40,40,1,39, 41,41,0, 42,42,0,
+ 43,45,0, 44,45,0, 45,45,2,43,44
+ };
+ int attCount = sizeof(attachments) / sizeof(int);
+
+ // Each line in clickStuff represents one click test with the following items:
+ // click x-coord, click y-coord, char index, assoc-prev,
+ // prim sel top, prim sel bottom, prim sel left,
+ // sec sel top, sec sel bottom, sec sel left
+ // Y-coordinates are offsets from segment top; ie, (0,0) is segment top-left.
+ const int clickTestCnt = 4;
+ int clickStuff[] = {
+ 55, 40, 2, false, 35, 65, 49, 14, 33, 82,
+ 65, 20, 1, false, 0,100, 50, kAbsent, kAbsent, kAbsent,
+ 95, 84, 4, true, 0,100, 100, kAbsent, kAbsent, kAbsent,
+ 104, 40, 4, false, 0,100, 100, kAbsent, kAbsent, kAbsent
+ };
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(bbLefts, bbRights, bbTops, bbBottoms);
+ SetInsPtFlags(insPtFlags);
+ SetAttachedClusters(attachments, attCount);
+ SetClickTests(clickTestCnt, clickStuff);
+}
+
+std::wstring TestCase::TaiVietText()
+{
+ std::wstring strRet;
+ wchar_t charData[] = {
+ 0xe00f,0xe042,0xe031,0xe02b,0xe00f,0xe042,0xe031,0xe025,0xe021,0xe033,
+ 0xe042,0xe02b,0xe01c,0xe042,0xe03e,0xe01c,0xe033,0xe040,0xe009,0xe01c,
+ 0xe039,0xe040,0xe009,0xe01c,0xe035,0xe042,0xe009,0xe024,0xe035,0xe042,
+ 0xe025,0xe01b,0xe033,0xe02b,0xe00a,0xe030,0xe042,0xe009,0xe01e,0xe040,
+ 0xe03b,0xe019,0xe00a,0xe033,0xe042,0xe025,0x0000
+ };
+ strRet.assign(charData);
+ return strRet;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Set up a test where the font is bad and we revert to dumb rendering
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupDumbFallback1()
+{
+ m_testName = "Dumb Fallback 1";
+ //m_debug = true;
+ //m_traceLog = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"GrErr BadVersion";
+ m_fontFile = "grtest_badVersion.ttf";
+ m_text = RomanText(); // text to render
+ m_fontSize = 12; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 500; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+ m_dumbFallback = true;
+
+ // Output:
+ m_badFont = true;
+ m_segWidth = 196; // physical width of segment
+
+ const int charCnt = 26; // number of characters in the segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true
+ };
+
+ const int glyphCnt = 26; // number of glyphs in the segment
+
+ // need glyphCnt elements in these arrays:
+ // 0 10 20
+ gid16 glyphList[] = {71, 0, 0, 82, 0, 85, 73, 0, 0, 0, 0, 67, 0, 0, 75, 0, 43, 0, 79, 0, 0, 0, 0, 72, 72, 75};
+ int xPositions[] = { 0, 7, 15, 23, 31, 39, 46, 54, 62, 70, 78, 86, 93,101,109,114,122,128,136,149,157,165,173,181,186,192};
+ int yPositions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ int advWidths[] = { 7, 8, 8, 8, 8, 6, 8, 8, 8, 8, 8, 7, 8, 8, 4, 8, 5, 8, 12, 8, 8, 8, 8, 5, 5, 4};
+
+ const int clickTestCnt = 0;
+ int * clickStuff = NULL;
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetBBs(NULL, NULL, NULL, NULL);
+ SetInsPtFlags(insPtFlags);
+ SetClickTests(clickTestCnt, clickStuff);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Now make sure we will get a crash when we turn dumb rendering off for the same font.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupDumbFallback2()
+{
+ m_testName = "Dumb Fallback 2";
+ //m_debug = true;
+ //m_traceLog = true;
+ //m_skip = true;
+
+ // Input:
+ m_fontName = L"GrErr BadVersion";
+ m_fontFile = "grtest_badVersion.ttf";
+ m_text = L"This is a test."; // text to render
+ m_fontSize = 12; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 500; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+ m_dumbFallback = false;
+
+ // Output:
+ m_badFont = true;
+ m_noSegment = true;
+ m_segWidth = 0; // physical width of segment
+
+ const int charCnt = 0; // number of characters in the segment
+
+ const int glyphCnt = 0; // number of glyphs in the segment
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+}
+
+/*----------------------------------------------------------------------------------------------
+ Now make sure we will get a crash when we turn dumb rendering off for the same font.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetupBadFont()
+{
+ m_testName = "Bad Font";
+ //m_debug = true;
+ //m_traceLog = true;
+ m_skip = true;
+
+ // Input:
+ // The font has been corrupted so that the size of the cmap in the directory is invalid.
+ m_fontName = L"Graphite Test Roman";
+ m_fontFile = "grtest_badCmap.ttf";
+ m_text = L"This is a test."; // text to render
+ m_fontSize = 12; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_availWidth = 500; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_rtl = false;
+ m_backtrack = false;
+ m_dumbFallback = true; // wants to do dumb fall-back, but can't because the font is totally invalid
+
+ // Output:
+ m_badFont = true;
+ m_noSegment = true;
+ m_segWidth = 0; // physical width of segment
+
+ const int charCnt = 0; // number of characters in the segment
+
+ const int glyphCnt = 0; // number of glyphs in the segment
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+}
+// *** Add more methods here. ***
+
+
+//:>********************************************************************************************
+//:> Utility methods.
+//:>********************************************************************************************
+
+/*----------------------------------------------------------------------------------------------
+ Delete the list of tests.
+----------------------------------------------------------------------------------------------*/
+void TestCase::DeleteTests()
+{
+ delete[] g_ptcaseList;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Constructor: initialize test case with default values.
+----------------------------------------------------------------------------------------------*/
+TestCase::TestCase()
+{
+ m_testName = "Unknown";
+ m_debug = false;
+ m_traceLog = false;
+ m_skip = false;
+
+ m_fontName.erase();
+ m_fontFile.erase();
+ m_text.erase(); // text to render
+ m_fontSize = 12; // font size in points
+ m_prefBreak = klbWordBreak; // preferred break-weight
+ m_worstBreak = klbClipBreak; // worst-case break-weight
+ m_availWidth = 500; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_backtrack = false;
+ m_twsh = ktwshAll;
+ m_paraRtl = false;
+ m_firstChar = 0;
+ m_contextBlockInSize = 0;
+ m_contextBlockIn = NULL;
+ m_initWithPrev = false;
+ memset(m_fset, 0, MAXFEAT * sizeof(FeatureSetting));
+ m_dumbFallback = true;
+
+ m_badFont = false;
+ m_noSegment = false; // yes, a segment should be generated
+ m_charCount = 0;
+ m_glyphCount = 0;
+ m_glyphArray = NULL;
+ m_xPositions = NULL;
+ m_yPositions = NULL;
+ m_advWidths = NULL;
+ m_bbLefts = NULL;
+ m_bbRights = NULL;
+ m_bbTops = NULL;
+ m_bbBottoms = NULL;
+ m_insPointFlags = NULL;
+ m_charsToGlyphs = NULL;
+ m_c2gCount = 0;
+ m_attGlyphs = NULL;
+ m_attGCount = 0;
+ m_contextBlockOutSize = 0;
+ m_contextBlockOut = NULL;
+
+ m_clickTestCount = 0;
+ m_clickTests = NULL;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Destructor.
+----------------------------------------------------------------------------------------------*/
+TestCase::~TestCase()
+{
+ delete[] m_glyphArray;
+ delete[] m_xPositions;
+ delete[] m_yPositions;
+ delete[] m_advWidths;
+ delete[] m_bbLefts;
+ delete[] m_bbRights;
+ delete[] m_bbTops;
+ delete[] m_bbBottoms;
+ delete[] m_insPointFlags;
+ delete[] m_charsToGlyphs;
+ delete[] m_attGlyphs;
+ delete[] m_clickTests;
+ delete[] m_contextBlockIn;
+ delete[] m_contextBlockOut;
+}
+
+/*----------------------------------------------------------------------------------------------
+ Setters.
+----------------------------------------------------------------------------------------------*/
+void TestCase::SetCharCount(int charCount)
+{
+ m_charCount = charCount;
+ m_insPointFlags = new bool[charCount];
+}
+
+void TestCase::SetGlyphCount(int glyphCount)
+{
+ m_glyphCount = glyphCount;
+ m_glyphArray = new gid16[glyphCount];
+ m_xPositions = new int[glyphCount];
+ m_yPositions = new int[glyphCount];
+ m_advWidths = new int[glyphCount];
+ m_bbLefts = new int[glyphCount];
+ m_bbRights = new int[glyphCount];
+ m_bbTops = new int[glyphCount];
+ m_bbBottoms = new int[glyphCount];
+}
+
+void TestCase::SetGlyphList(gid16 * glyphList)
+{
+ for (int i = 0; i < m_glyphCount; i++)
+ m_glyphArray[i] = glyphList[i];
+}
+
+void TestCase::SetXPositions(int * xPosList)
+{
+ for (int i = 0; i < m_glyphCount; i++)
+ m_xPositions[i] = xPosList[i];
+}
+
+void TestCase::SetYPositions(int * yPosList)
+{
+ for (int i = 0; i < m_glyphCount; i++)
+ m_yPositions[i] = yPosList[i];
+}
+
+void TestCase::SetAdvWidths(int * advWidths)
+{
+ for (int i = 0; i < m_glyphCount; i++)
+ m_advWidths[i] = advWidths[i];
+}
+
+void TestCase::SetBBs(int * bbLefts, int * bbRights, int * bbTops, int * bbBottoms)
+{
+ if (bbLefts == NULL) // no bb tests
+ {
+ delete[] m_bbLefts;
+ delete[] m_bbRights;
+ delete[] m_bbTops;
+ delete[] m_bbBottoms;
+ m_bbLefts = NULL;
+ m_bbRights = NULL;
+ m_bbTops = NULL;
+ m_bbBottoms = NULL;
+ return;
+ }
+
+ for (int i = 0; i < m_glyphCount; i++)
+ {
+ m_bbLefts[i] = bbLefts[i];
+ m_bbRights[i] = bbRights[i];
+ m_bbTops[i] = bbTops[i];
+ m_bbBottoms[i] = bbBottoms[i];
+ }
+}
+
+void TestCase::SetInsPtFlags(bool * flags)
+{
+ for (int i = 0; i < m_charCount; i++)
+ m_insPointFlags[i] = flags[i];
+}
+
+void TestCase::SetCharsToGlyphs(int * stuff, int count)
+{
+ m_c2gCount = count;
+ m_charsToGlyphs = new int[count];
+ for (int i = 0; i < count; i++)
+ m_charsToGlyphs[i] = stuff[i];
+}
+
+void TestCase::SetAttachedClusters(int * stuff, int count)
+{
+ m_attGCount = count;
+ m_attGlyphs = new int[count];
+ for (int i = 0; i < count; i++)
+ m_attGlyphs[i] = stuff[i];
+}
+
+void TestCase::SetClickTests(int clickTestCount, int * clickStuff)
+{
+ const int fc = ClickTest::fieldCnt;
+
+ m_clickTestCount = clickTestCount;
+ m_clickTests = new ClickTest[clickTestCount];
+ for (int i = 0; i < clickTestCount; i++)
+ {
+ m_clickTests[i].xClick = clickStuff[(i * fc) + 0];
+ m_clickTests[i].yClick = clickStuff[(i * fc) + 1];
+ m_clickTests[i].charIndex = clickStuff[(i * fc) + 2];
+ m_clickTests[i].assocPrev = clickStuff[(i * fc) + 3];
+ m_clickTests[i].sel1Top = clickStuff[(i * fc) + 4];
+ m_clickTests[i].sel1Bottom = clickStuff[(i * fc) + 5];
+ m_clickTests[i].sel1Left = clickStuff[(i * fc) + 6];
+ m_clickTests[i].sel2Top = clickStuff[(i * fc) + 7];
+ m_clickTests[i].sel2Bottom = clickStuff[(i * fc) + 8];
+ m_clickTests[i].sel2Left = clickStuff[(i * fc) + 9];
+ }
+}
+
+void TestCase::SetInputContextBlock(int contextBlockInSize, gr::byte * pContextBlockIn)
+{
+ m_contextBlockInSize = contextBlockInSize;
+ if (contextBlockInSize == 0)
+ {
+ m_contextBlockIn = NULL;
+ }
+ else
+ {
+ m_contextBlockIn = new gr::byte[contextBlockInSize];
+ std::copy(pContextBlockIn, pContextBlockIn + contextBlockInSize, m_contextBlockIn);
+ }
+}
+
+void TestCase::SetOutputContextBlock(int contextBlockOutSize, gr::byte * pContextBlockOut)
+{
+ m_contextBlockOutSize = contextBlockOutSize;
+ m_contextBlockOut = new gr::byte[contextBlockOutSize];
+ std::copy(pContextBlockOut, pContextBlockOut + contextBlockOutSize, m_contextBlockOut);
+}
+
+
+
+
+void TestCase::SetupBugTest()
+{
+ m_testName = "Bug Test";
+ m_traceLog = true;
+ m_debug = true;
+ m_skip = true;
+
+ // Input:
+ m_fontName = L"Padauk";
+ m_fontFile = "grtest_infinity.ttf";
+
+ wchar_t charData[] = { 0x101e, 0x1032, 0x1015, 0x103c, 0x103d, 0x103e, 0x102d, 0x1038, 0x0000 };
+ m_text.assign(charData);
+ int charCnt = 8;
+
+ m_fontSize = 20; // font size in points
+ m_prefBreak = klbWsBreak; // preferred break-weight
+ m_worstBreak = klbHyphenBreak; // worst-case break-weight
+ m_availWidth = 1000; // width available for segment
+ m_bold = false;
+ m_italic = false;
+ m_backtrack = false;
+ m_rtl = false;
+
+ // Output:
+ m_noSegment = false;
+ m_segWidth = 52; // physical width of segment
+
+ // need charCnt elements in this array:
+ bool insPtFlags[] = {
+ true, false, true, true, false, false, false, true
+ };
+
+ int glyphCnt = 7;
+ // need glyphCnt elements in these arrays:
+ gid16 glyphList[] = {105,174,158,202,231,162,231};
+ int xPositions[] = { 0, 17, 20, 22, 28, 29, 38};
+ int yPositions[] = { 0, 0, 0, 0, 0, 0, 0};
+ int advWidths[] = { 17, 2, 9, 4, 0, 10, 0};
+
+ int bbLefts[] = { 0, 10, 21, 23, 23, 30, 33};
+ int bbRights[] = { 16, 19, 28, 25, 28, 39, 38};
+ int bbTops[] = { 7, 7, 7, -1, 15, 7, 15};
+ int bbBottoms[] = { 0, -7, -1, -7, 9, 0, 9};
+
+ // Each group = char-index, number of glyphs, glyph-indices.
+ int charsToGlyphs[] = {
+ 0, 1, 0, 1, 1, 1, 2, 1, 3, 3, 1, 2, 4, 1, 4, 5, 0, 6, 1, 5, 7, 1, 6
+ };
+ int c2gCount = sizeof(charsToGlyphs) / sizeof(int);
+
+ // Finish setting up test case.
+ SetCharCount(charCnt);
+ SetGlyphCount(glyphCnt);
+ SetGlyphList(glyphList);
+ SetXPositions(xPositions);
+ SetYPositions(yPositions);
+ SetAdvWidths(advWidths);
+ SetCharsToGlyphs(charsToGlyphs, c2gCount);
+ SetBBs(bbLefts, bbRights, bbTops, bbBottoms);
+ SetInsPtFlags(insPtFlags);
+}
diff --git a/Build/source/libs/graphite/test/RegressionTest/TestCase.h b/Build/source/libs/graphite/test/RegressionTest/TestCase.h
new file mode 100644
index 00000000000..68258929a1f
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/TestCase.h
@@ -0,0 +1,245 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2004 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: TestCase.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Definition of TestCase class for Graphite regression test program.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef TESTCASE_H
+#define TESTCASE_H 1
+
+#define NO_EXCEPTIONS 1
+
+class TestCase
+{
+public:
+ // Methods to set up test cases.
+ void SetupSimpleTest();
+ void SetupSimpleBacktrackTest();
+ void SetupSurrogateTest(); // TODO: add a test for UTF-8
+ void SetupBurmese1();
+ void SetupBurmese2();
+ void SetupBurmese3();
+ void SetupBurmese4();
+ void SetupRoman();
+ void SetupRomanFeatures();
+ void SetupStackingAndBridging();
+ void SetupNoWhiteSpace();
+ void SetupNoWhiteSpaceNoSeg();
+ void SetupOnlyWhiteSpace();
+ void SetupCrossLine1();
+ void SetupCrossLine2();
+ void SetupCrossLine3();
+ void SetupCrossLine4();
+ void SetupArabic1();
+ void SetupArabic2();
+ void SetupTaiViet1();
+ void SetupTaiViet2();
+ void SetupDumbFallback1();
+ void SetupDumbFallback2();
+ void SetupBadFont();
+ void SetupBugTest();
+ // *** Add more methods here. ***
+
+protected:
+ // Auxiliary functions to set up test cases.
+ void SetupBurmeseAux(int charCount, int glyphCount, int clickTestCount);
+ void SetupArabicAux(int charCount, int glyphCount);
+ std::wstring BurmeseText();
+ std::wstring RomanText();
+ std::wstring CrossLineText();
+ std::wstring ArabicText();
+ std::wstring TaiVietText();
+
+public:
+ const static int kAbsent = -100; // not present in data
+
+public:
+ // constructor:
+ TestCase();
+ // destructor:
+ ~TestCase();
+
+ static int SetupTests(TestCase **);
+ static void DeleteTests();
+
+ // Getters:
+ std::string TestName() { return m_testName; }
+ bool RunDebugger() { return m_debug; }
+ bool TraceLog() { return m_traceLog; }
+ bool Skip() { return m_skip; }
+
+ std::wstring Text() { return m_text; }
+ std::wstring FontName() { return m_fontName; }
+ std::string FontFile() { return m_fontFile; }
+ size_t FontSize() { return m_fontSize; }
+ LineBrk PrefBreak() { return m_prefBreak; }
+ LineBrk WorstBreak() { return m_worstBreak; }
+ int FeatureID(int i) { return m_fset[i].id; }
+ int FeatureValue(int i) { return m_fset[i].value; }
+ FeatureSetting * Features() { return m_fset; }
+ int AvailWidth() { return m_availWidth; }
+ bool Backtrack() { return m_backtrack; }
+ TrWsHandling Twsh() { return m_twsh; }
+ bool Rtl() { return m_rtl; }
+ bool ParaRtl() { return m_paraRtl; }
+ size_t FirstChar() { return m_firstChar; }
+ bool DumbFallback() { return m_dumbFallback; }
+ size_t InputContextBlock(gr::byte ** ppContextBlock)
+ {
+ *ppContextBlock = m_contextBlockIn;
+ return m_contextBlockInSize;
+ }
+
+ bool InitWithPrevSeg() { return m_initWithPrev; }
+ bool BadFont() { return m_badFont; }
+ bool NoSegment() { return m_noSegment; }
+ int SegWidth() { return m_segWidth; }
+ int CharCount() { return m_charCount; }
+ int GlyphCount() { return m_glyphCount; }
+
+ int GlyphID(int i) { return m_glyphArray[i]; }
+ int XPos(int i) { return m_xPositions[i]; }
+ int YPos(int i) { return m_yPositions[i]; }
+ int AdvWidth(int i) { return m_advWidths[i]; }
+ int BbLeft(int i) { return m_bbLefts[i]; }
+ int BbRight(int i) { return m_bbRights[i]; }
+ int BbTop(int i) { return m_bbTops[i]; }
+ int BbBottom(int i) { return m_bbBottoms[i]; }
+ bool BbTests() { return (m_bbLefts != NULL); }
+
+ int InsPtFlag(int i) { return m_insPointFlags[i]; }
+
+ int CharToGlyphCount() { return m_c2gCount; }
+ int CharToGlyphItem(int i) { return m_charsToGlyphs[i]; }
+ int AttachedGlyphCount() { return m_attGCount; } // that is, the lenght of the data
+ int AttachedGlyphItem(int i) { return m_attGlyphs[i]; }
+
+ int NumberOfClickTests() { return m_clickTestCount; }
+ int XClick(int i) { return m_clickTests[i].xClick; }
+ int YClick(int i) { return m_clickTests[i].yClick; }
+ int ClickCharIndex(int i) { return m_clickTests[i].charIndex; }
+ bool ClickAssocPrev(int i) { return (bool)m_clickTests[i].assocPrev; }
+ int Sel1Top(int i) { return m_clickTests[i].sel1Top; }
+ int Sel1Bottom(int i) { return m_clickTests[i].sel1Bottom; }
+ int Sel1Left(int i) { return m_clickTests[i].sel1Left; }
+ int Sel2Top(int i) { return m_clickTests[i].sel2Top; }
+ int Sel2Bottom(int i) { return m_clickTests[i].sel2Bottom; }
+ int Sel2Left(int i) { return m_clickTests[i].sel2Left; }
+ size_t OutputContextBlockSize() { return m_contextBlockOutSize; }
+ bool CompareContextBlock(gr::byte * pResult)
+ {
+ for (size_t i = 0; i < m_contextBlockOutSize; i++)
+ {
+ if (m_contextBlockOut[i] != pResult[i])
+ return false;
+ }
+ return true;
+ }
+
+ struct ClickTest
+ {
+ int xClick;
+ int yClick;
+ int charIndex;
+ int assocPrev; // boolean: 0 or 1
+ int sel1Top;
+ int sel1Bottom;
+ int sel1Left; // we only need left or right, not both
+ int sel2Top;
+ int sel2Bottom;
+ int sel2Left;
+
+ const static int fieldCnt = 10;
+ };
+
+protected:
+ std::string m_testName;
+ bool m_debug; // break into the debugger when running this test
+ bool m_traceLog; // generate a logging file (tracelog.txt) for this test; if this is turned on for
+ // more than one test, the tests will be appended
+ bool m_skip;
+
+#define MAXFEAT 10
+
+ // Input parameters:
+ std::wstring m_text; // default: none
+ std::wstring m_fontName; // default: empty
+ std::string m_fontFile; // default: empty
+ size_t m_fontSize; // default: 12
+ LineBrk m_prefBreak; // default: word-break
+ LineBrk m_worstBreak; // default: clip-break
+ FeatureSetting m_fset[MAXFEAT]; // default: none
+ int m_availWidth; // default: 100
+ bool m_bold; // default: false
+ bool m_italic; // default: false
+ bool m_rtl; // default: false
+ bool m_backtrack; // default: false
+ TrWsHandling m_twsh; // default: ktwshAll
+ bool m_paraRtl; // default: false
+ size_t m_firstChar; // default: 0
+ size_t m_contextBlockInSize; // default: 0
+ gr::byte * m_contextBlockIn; // default: NULL -- DELETE
+ bool m_initWithPrev; // default: false
+ bool m_dumbFallback; // default: true
+ // start of line flag
+ // resolution
+ // justification
+
+ // Output:
+ bool m_badFont; // default: false
+ bool m_noSegment; // no segment should be generated
+ int m_segWidth;
+ int m_charCount;
+ int m_glyphCount;
+ gid16 * m_glyphArray;
+ int * m_xPositions;
+ int * m_yPositions;
+ int * m_advWidths;
+ int * m_bbLefts;
+ int * m_bbRights;
+ int * m_bbTops;
+ int * m_bbBottoms;
+ bool * m_insPointFlags;
+ int * m_charsToGlyphs; // char-to-glyph mappings
+ int m_c2gCount;
+ int * m_attGlyphs; // attachment clusters
+ int m_attGCount;
+ int m_clickTestCount;
+ ClickTest * m_clickTests;
+ size_t m_contextBlockOutSize;
+ gr::byte * m_contextBlockOut;
+ // glyphs-to-chars
+ // pdichwContext
+ // arrow key behavior
+ // etc.
+
+ // Setters:
+ void SetCharCount(int charCount);
+ void SetGlyphCount(int glyphCount);
+ void SetGlyphList(gid16 * glyphList);
+ void SetXPositions(int * posList);
+ void SetYPositions(int * posList);
+ void SetAdvWidths(int * advWidths);
+ void SetBBs(int * bbLefts, int * bbRights, int * bbTops, int * bbBottoms);
+ void SetInsPtFlags(bool * flags);
+ void SetCharsToGlyphs(int * stuff, int count);
+ void SetAttachedClusters(int * stuff, int count);
+ void SetClickTests(int clickTestCount, int * clickStuff);
+ void SetInputContextBlock(int contextBlockInSize, gr::byte * contextBlockIn);
+ void SetOutputContextBlock(int contextBlockOutSize, gr::byte * contextBlockIn);
+};
+
+
+#endif // !TESTCASE_H
+
diff --git a/Build/source/libs/graphite/test/RegressionTest/arabicText.wpx b/Build/source/libs/graphite/test/RegressionTest/arabicText.wpx
new file mode 100644
index 00000000000..62fee81be5b
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/arabicText.wpx
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE WpDoc SYSTEM "WorldPad.dtd">
+<WpDoc wpxVersion="2.0">
+
+<Languages>
+ <LgWritingSystem id="arb" language="arb" type="ISO-639-2">
+ <Name24>
+ <AUni ws="en">Arabic, Standard</AUni>
+ </Name24>
+ <Abbr24>
+ <AUni ws="en">Ara</AUni>
+ </Abbr24>
+ <Locale24><Integer val="1033"/></Locale24>
+ <RightToLeft24><Boolean val="true"/></RightToLeft24>
+ <DefaultSerif24><Uni>Scheherazade Graphite Alpha</Uni></DefaultSerif24>
+ <DefaultSansSerif24><Uni>Scheherazade Graphite Alpha</Uni></DefaultSansSerif24>
+ <DefaultBodyFont24><Uni>Charis SIL</Uni></DefaultBodyFont24>
+ <DefaultMonospace24><Uni>Courier</Uni></DefaultMonospace24>
+ <ICULocale24><Uni>arb</Uni></ICULocale24>
+ <KeyboardType24><Uni>standard</Uni></KeyboardType24>
+ <KeymanKeyboard24><Uni>Arabic Demo</Uni></KeymanKeyboard24>
+ <Collations24>
+ <LgCollation>
+ <Name30>
+ <AUni ws="en">DefaultCollation</AUni>
+ </Name30>
+ <WinLCID30><Integer val="1033"/></WinLCID30>
+ <WinCollation30><Uni>Latin1_General_CI_AI</Uni></WinCollation30>
+ </LgCollation>
+ </Collations24>
+ </LgWritingSystem>
+</Languages>
+
+<Styles>
+ <StStyle>
+ <Name17><Uni>Normal</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni></Uni></BasedOn17>
+ <Next17><Uni>Normal</Uni></Next17>
+ <Rules17>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Bulleted List</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Bulleted List</Uni></Next17>
+ <Rules17>
+ <Prop firstIndent="-18000" bulNumScheme="101" bulNumStartAt="1"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 1</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 1</Uni></Next17>
+ <Rules17>
+ <Prop bold="invert" fontsize="14000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 2</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 2</Uni></Next17>
+ <Rules17>
+ <Prop italic="invert" fontsize="12000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 3</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 3</Uni></Next17>
+ <Rules17>
+ <Prop fontsize="12000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Numbered List</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Numbered List</Uni></Next17>
+ <Rules17>
+ <Prop firstIndent="-18000" bulNumScheme="10"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>External Link</Uni></Name17>
+ <Type17><Integer val="1"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>External Link</Uni></Next17>
+ <Rules17>
+ <Prop underline="single" forecolor="7f007f" undercolor="7f007f"/>
+ </Rules17>
+ </StStyle>
+</Styles>
+
+<Body docRightToLeft="false">
+ <StTxtPara>
+ <StyleRules15>
+ <Prop spaceBefore="12000" spaceAfter="12000" rightToLeft="1" namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="arb" fontsize="36000" fontsizeUnit="mpt" fontFamily="Graphite Test Arabic" fontVariations="1051=1,1030=0">ببَلَٔاَ چِْٕ۠ڨ بِڹْ) ب ‍تڨسٰ؛ ۱۲۳ سٰعدمپ لٰ، ‮۱۲۳۴۵‬ سهارعن؛</Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+</Body>
+
+<PageSetup>
+ <PageInfo>
+ <TopMargin9999><Integer val="72000"/></TopMargin9999>
+ <BottomMargin9999><Integer val="72000"/></BottomMargin9999>
+ <LeftMargin9999><Integer val="90000"/></LeftMargin9999>
+ <RightMargin9999><Integer val="90000"/></RightMargin9999>
+ <HeaderMargin9999><Integer val="36000"/></HeaderMargin9999>
+ <FooterMargin9999><Integer val="36000"/></FooterMargin9999>
+ <PageSize9999><Integer val="0"/></PageSize9999>
+ <PageHeight9999><Integer val="792000"/></PageHeight9999>
+ <PageWidth9999><Integer val="612000"/></PageWidth9999>
+ <PageOrientation9999><Integer val="0"/></PageOrientation9999>
+ <Header9999>
+ <Str>
+ <Run ws="en">arabicText.wpx</Run>
+ </Str>
+ </Header9999>
+ <Footer9999>
+ <Str>
+ <Run ws="en">&amp;[page],&amp;[date]</Run>
+ </Str>
+ </Footer9999>
+ </PageInfo>
+</PageSetup>
+
+</WpDoc>
diff --git a/Build/source/libs/graphite/test/RegressionTest/bridgingStackingText.wpx b/Build/source/libs/graphite/test/RegressionTest/bridgingStackingText.wpx
new file mode 100644
index 00000000000..d91ecea8262
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/bridgingStackingText.wpx
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE WpDoc SYSTEM "WorldPad.dtd">
+<WpDoc wpxVersion="2.0">
+
+<Languages>
+ <LgWritingSystem id="en" language="en" type="ISO-639-1">
+ <Name24>
+ <AUni ws="en">English</AUni>
+ </Name24>
+ <Abbr24>
+ <AUni ws="en">Eng</AUni>
+ </Abbr24>
+ <Description24>
+ <AStr ws="en">
+ <Run ws="en">The standard alphabetic representation of English (United States style).</Run>
+ </AStr>
+ </Description24>
+ <Locale24><Integer val="1033"/></Locale24>
+ <RightToLeft24><Boolean val="false"/></RightToLeft24>
+ <DefaultSerif24><Uni>Times New Roman</Uni></DefaultSerif24>
+ <DefaultSansSerif24><Uni>Arial</Uni></DefaultSansSerif24>
+ <DefaultBodyFont24><Uni>Charis SIL</Uni></DefaultBodyFont24>
+ <DefaultMonospace24><Uni>Courier New</Uni></DefaultMonospace24>
+ <ICULocale24><Uni>en</Uni></ICULocale24>
+ <KeyboardType24><Uni>standard</Uni></KeyboardType24>
+ <Collations24>
+ <LgCollation>
+ <Name30>
+ <AUni ws="en">Default Collation</AUni>
+ </Name30>
+ <WinLCID30><Integer val="1033"/></WinLCID30>
+ <WinCollation30><Uni>Latin1_General_CI_AI</Uni></WinCollation30>
+ </LgCollation>
+ <LgCollation>
+ <Name30>
+ <AUni ws="en">Case Sensitive</AUni>
+ </Name30>
+ <WinLCID30><Integer val="1033"/></WinLCID30>
+ <WinCollation30><Uni>Latin1_General_CS_AI</Uni></WinCollation30>
+ </LgCollation>
+ </Collations24>
+ </LgWritingSystem>
+</Languages>
+
+<Styles>
+ <StStyle>
+ <Name17><Uni>Normal</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni></Uni></BasedOn17>
+ <Next17><Uni>Normal</Uni></Next17>
+ <Rules17>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Bulleted List</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Bulleted List</Uni></Next17>
+ <Rules17>
+ <Prop firstIndent="-18000" bulNumScheme="101" bulNumStartAt="1"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 1</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 1</Uni></Next17>
+ <Rules17>
+ <Prop bold="invert" fontsize="14000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 2</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 2</Uni></Next17>
+ <Rules17>
+ <Prop italic="invert" fontsize="12000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 3</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 3</Uni></Next17>
+ <Rules17>
+ <Prop fontsize="12000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Numbered List</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Numbered List</Uni></Next17>
+ <Rules17>
+ <Prop firstIndent="-18000" bulNumScheme="10"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>External Link</Uni></Name17>
+ <Type17><Integer val="1"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>External Link</Uni></Next17>
+ <Rules17>
+ <Prop underline="single" forecolor="7f007f" undercolor="7f007f"/>
+ </Rules17>
+ </StStyle>
+</Styles>
+
+<Body docRightToLeft="false">
+ <StTxtPara>
+ <StyleRules15>
+ <Prop namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="en" fontsize="48000" fontsizeUnit="mpt" fontFamily="Doulos SIL"></Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+ <StTxtPara>
+ <StyleRules15>
+ <Prop namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="en" fontsize="36000" fontsizeUnit="mpt" fontFamily="Graphite Test Roman">a͝a t͝a à̀͝a ʃ̀̀͝a a̖̖a ʃ̀̀a a̖̖a ʃ͝a</Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+</Body>
+
+<PageSetup>
+ <PageInfo>
+ <TopMargin9999><Integer val="72000"/></TopMargin9999>
+ <BottomMargin9999><Integer val="72000"/></BottomMargin9999>
+ <LeftMargin9999><Integer val="90000"/></LeftMargin9999>
+ <RightMargin9999><Integer val="90000"/></RightMargin9999>
+ <HeaderMargin9999><Integer val="36000"/></HeaderMargin9999>
+ <FooterMargin9999><Integer val="36000"/></FooterMargin9999>
+ <PageSize9999><Integer val="0"/></PageSize9999>
+ <PageHeight9999><Integer val="792000"/></PageHeight9999>
+ <PageWidth9999><Integer val="612000"/></PageWidth9999>
+ <PageOrientation9999><Integer val="0"/></PageOrientation9999>
+ <Header9999>
+ <Str>
+ <Run ws="en">bridgingDiacTest.wpx</Run>
+ </Str>
+ </Header9999>
+ <Footer9999>
+ <Str>
+ <Run ws="en">&amp;[page],&amp;[date]</Run>
+ </Str>
+ </Footer9999>
+ </PageInfo>
+</PageSetup>
+
+</WpDoc>
diff --git a/Build/source/libs/graphite/test/RegressionTest/burmeseText.wpx b/Build/source/libs/graphite/test/RegressionTest/burmeseText.wpx
new file mode 100644
index 00000000000..94d699a2a1c
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/burmeseText.wpx
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE WpDoc SYSTEM "WorldPad.dtd">
+<WpDoc wpxVersion="2.0">
+
+<Languages>
+ <LgWritingSystem id="my" language="my" type="ISO-639-1">
+ <Name24>
+ <AUni ws="en">Burmese</AUni>
+ </Name24>
+ <Description24>
+ <AStr ws="en">
+ <Run></Run>
+ </AStr>
+ </Description24>
+ <Locale24><Integer val="1109"/></Locale24>
+ <RightToLeft24><Boolean val="false"/></RightToLeft24>
+ <DefaultSerif24><Uni>Padauk</Uni></DefaultSerif24>
+ <DefaultSansSerif24><Uni>Arial</Uni></DefaultSansSerif24>
+ <DefaultMonospace24><Uni>Courier</Uni></DefaultMonospace24>
+ <ICULocale24><Uni>my</Uni></ICULocale24>
+ <KeyboardType24><Uni>keyman</Uni></KeyboardType24>
+ <KeymanKeyboard24><Uni>Burmese Unicode 0.03</Uni></KeymanKeyboard24>
+ <Collations24>
+ <LgCollation>
+ <Name30>
+ <AUni ws="en">DefaultCollation</AUni>
+ </Name30>
+ <WinLCID30><Integer val="1033"/></WinLCID30>
+ <WinCollation30><Uni>Latin1_General_CI_AI</Uni></WinCollation30>
+ </LgCollation>
+ </Collations24>
+ </LgWritingSystem>
+</Languages>
+
+<Styles>
+ <StStyle>
+ <Name17><Uni>Normal</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni></Uni></BasedOn17>
+ <Next17><Uni>Normal</Uni></Next17>
+ <Rules17>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Bulleted List</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Bulleted List</Uni></Next17>
+ <Rules17>
+ <Prop firstIndent="-18000" bulNumScheme="101" bulNumStartAt="1"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 1</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 1</Uni></Next17>
+ <Rules17>
+ <Prop bold="invert" fontsize="14000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 2</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 2</Uni></Next17>
+ <Rules17>
+ <Prop italic="invert" fontsize="12000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 3</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 3</Uni></Next17>
+ <Rules17>
+ <Prop fontsize="12000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Numbered List</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Numbered List</Uni></Next17>
+ <Rules17>
+ <Prop firstIndent="-18000" bulNumScheme="10"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>External Link</Uni></Name17>
+ <Type17><Integer val="1"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>External Link</Uni></Next17>
+ <Rules17>
+ <Prop underline="single" forecolor="7f007f" undercolor="7f007f"/>
+ </Rules17>
+ </StStyle>
+</Styles>
+
+<Body docRightToLeft="false">
+ <StTxtPara>
+ <StyleRules15>
+ <Prop rightToLeft="0" namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="my" fontsize="20000" fontsizeUnit="mpt" fontFamily="Graphite Test Burmese">က္ယ္ဝန္ဟ္‌ပ္‌တုိ့၏ ပ္ယော္‌ရ္ဝ္ဟင္‌မ္ဟု၊ </Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+</Body>
+
+<PageSetup>
+ <PageInfo>
+ <TopMargin9999><Integer val="72000"/></TopMargin9999>
+ <BottomMargin9999><Integer val="72000"/></BottomMargin9999>
+ <LeftMargin9999><Integer val="90000"/></LeftMargin9999>
+ <RightMargin9999><Integer val="90000"/></RightMargin9999>
+ <HeaderMargin9999><Integer val="36000"/></HeaderMargin9999>
+ <FooterMargin9999><Integer val="36000"/></FooterMargin9999>
+ <PageSize9999><Integer val="0"/></PageSize9999>
+ <PageHeight9999><Integer val="792000"/></PageHeight9999>
+ <PageWidth9999><Integer val="612000"/></PageWidth9999>
+ <PageOrientation9999><Integer val="0"/></PageOrientation9999>
+ <Header9999>
+ <Str>
+ <Run ws="en">brumeseText.wpx</Run>
+ </Str>
+ </Header9999>
+ <Footer9999>
+ <Str>
+ <Run ws="en">&amp;[page],&amp;[date]</Run>
+ </Str>
+ </Footer9999>
+ </PageInfo>
+</PageSetup>
+
+</WpDoc>
diff --git a/Build/source/libs/graphite/test/RegressionTest/grtest_arabic.ttf b/Build/source/libs/graphite/test/RegressionTest/grtest_arabic.ttf
new file mode 100644
index 00000000000..df25e54b3f3
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/grtest_arabic.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/RegressionTest/grtest_badCmap.ttf b/Build/source/libs/graphite/test/RegressionTest/grtest_badCmap.ttf
new file mode 100644
index 00000000000..d66c725f12e
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/grtest_badCmap.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/RegressionTest/grtest_badVersion.ttf b/Build/source/libs/graphite/test/RegressionTest/grtest_badVersion.ttf
new file mode 100644
index 00000000000..babe42e5352
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/grtest_badVersion.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/RegressionTest/grtest_burmese.ttf b/Build/source/libs/graphite/test/RegressionTest/grtest_burmese.ttf
new file mode 100644
index 00000000000..ab253fbbfd6
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/grtest_burmese.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/RegressionTest/grtest_roman.ttf b/Build/source/libs/graphite/test/RegressionTest/grtest_roman.ttf
new file mode 100644
index 00000000000..2001ff6b5ac
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/grtest_roman.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/RegressionTest/grtest_taiviet.ttf b/Build/source/libs/graphite/test/RegressionTest/grtest_taiviet.ttf
new file mode 100644
index 00000000000..3bf4a662b11
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/grtest_taiviet.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/RegressionTest/grtest_xline.ttf b/Build/source/libs/graphite/test/RegressionTest/grtest_xline.ttf
new file mode 100644
index 00000000000..537a4b9532a
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/grtest_xline.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/RegressionTest/main.h b/Build/source/libs/graphite/test/RegressionTest/main.h
new file mode 100644
index 00000000000..1fcdacf6293
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/main.h
@@ -0,0 +1,89 @@
+/*--------------------------------------------------------------------*//*:Ignore this sentence.
+Copyright (C) 2004 SIL International. All rights reserved.
+
+Distributable under the terms of either the Common Public License or the
+GNU Lesser General Public License, as specified in the LICENSING.txt file.
+
+File: Main.h
+Responsibility: Sharon Correll
+Last reviewed: Not yet.
+
+Description:
+ Header files to include in the Graphite regression test program.
+-------------------------------------------------------------------------------*//*:End Ignore*/
+
+#ifdef _MSC_VER
+#pragma once
+#endif
+#ifndef GRCOMPILER_H
+#define GRCOMPILER_H 1
+
+#define NO_EXCEPTIONS 1
+
+// To allow call to IsDebuggerPresent:
+#define _WIN32_WINNT WINVER
+
+//:>********************************************************************************************
+//:> Include files
+//:>********************************************************************************************
+// #include "windows.h"
+#include "stdafx.h"
+////#include "resource.h"
+// #include <hash_map>
+#include <fstream>
+#include <iostream>
+#include <vector>
+////#include <algorithm>
+#include <string>
+#ifdef _WIN32
+#include <crtdbg.h>
+#endif // _WIN32
+#include <assert.h>
+
+////using std::max;
+////using std::min;
+
+#include "GrCommon.h"
+#include "GrPlatform.h"
+
+////////#include "LgCharPropsStub.h"
+
+#include "GrConstants.h"
+///#include "TtfUtil.h"
+///#include "Tt.h"
+
+#include "GrClient.h"
+#include "ITextSource.h"
+#include "SimpleTextSrc.h"
+#include "IGrEngine.h"
+#include "IGrJustifier.h"
+#include "GrJustifier.h"
+#include "SegmentAux.h"
+#include "Font.h"
+// #include "WinFont.h"
+#include "FileFont.h"
+#include "Segment.h"
+#include "SegmentPainter.h"
+// #include "WinSegmentPainter.h"
+
+#include "TestCase.h"
+#include "RtTextSrc.h"
+
+
+//:>********************************************************************************************
+//:> Functions
+//:>********************************************************************************************
+void RunTests(int numberOfTests, TestCase * ptcaseList);
+int RunOneTestCase(TestCase * ptcase, Segment * psegPrev, Segment ** ppsegRet, RtTextSrc ** pptsrcRet);
+void OutputError(TestCase * ptcase, std::string strErr, int i = -1);
+void OutputErrorWithValues(TestCase * ptcase, std::string strErr, int i,
+ int valueFound, int valueExpected);
+void OutputErrorAux(TestCase * ptcase, std::string strErr, int i,
+ bool showValues, int valueFound, int valueExpected);
+bool WriteToLog(std::string str, int i = -1);
+bool WriteToLog(std::string str, int i,
+ bool showValues, int valueFound, int valueExpected);
+bool WriteToLog(int n);
+
+#endif //!WRCOMPILER_H
+
diff --git a/Build/source/libs/graphite/test/RegressionTest/makedebug.bat b/Build/source/libs/graphite/test/RegressionTest/makedebug.bat
new file mode 100644
index 00000000000..94d09eb720a
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/makedebug.bat
@@ -0,0 +1,2 @@
+cls
+nmake CFG=DEBUG -f makefile.vc \ No newline at end of file
diff --git a/Build/source/libs/graphite/test/RegressionTest/readme.txt b/Build/source/libs/graphite/test/RegressionTest/readme.txt
new file mode 100644
index 00000000000..e9f7facad20
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/readme.txt
@@ -0,0 +1,19 @@
+Graphite Regression Test
+
+COMPILING
+Use makedebug.bat to build a debug version. Creating a release version is not supported.
+
+RUNNING
+Extract the fonts from the fonts.zip file and install them.
+
+Options:
+/d - breaks into the debugger (if any) when an error occurs
+/s - silent mode; does not write to the standard output but only to the log file
+
+The program generates a file called grregtest.log with a list of errors.
+
+A file called tracelog.txt will be output for the tests for which tracing is turned on.
+
+ADDING TESTS
+See TestCase.cpp.
+
diff --git a/Build/source/libs/graphite/test/RegressionTest/romanText.wpx b/Build/source/libs/graphite/test/RegressionTest/romanText.wpx
new file mode 100644
index 00000000000..594cc886a0f
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/romanText.wpx
@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE WpDoc SYSTEM "WorldPad.dtd">
+<WpDoc wpxVersion="2.0">
+
+<Languages>
+ <LgWritingSystem id="en" language="en" type="ISO-639-1">
+ <Name24>
+ <AUni ws="en">English</AUni>
+ </Name24>
+ <Abbr24>
+ <AUni ws="en">Eng</AUni>
+ </Abbr24>
+ <Description24>
+ <AStr ws="en">
+ <Run ws="en">The standard alphabetic representation of English (United States style).</Run>
+ </AStr>
+ </Description24>
+ <Locale24><Integer val="1033"/></Locale24>
+ <RightToLeft24><Boolean val="false"/></RightToLeft24>
+ <DefaultSerif24><Uni>Times New Roman</Uni></DefaultSerif24>
+ <DefaultSansSerif24><Uni>Arial</Uni></DefaultSansSerif24>
+ <DefaultBodyFont24><Uni>Charis SIL</Uni></DefaultBodyFont24>
+ <DefaultMonospace24><Uni>Courier New</Uni></DefaultMonospace24>
+ <ICULocale24><Uni>en</Uni></ICULocale24>
+ <KeyboardType24><Uni>standard</Uni></KeyboardType24>
+ <Collations24>
+ <LgCollation>
+ <Name30>
+ <AUni ws="en">Default Collation</AUni>
+ </Name30>
+ <WinLCID30><Integer val="1033"/></WinLCID30>
+ <WinCollation30><Uni>Latin1_General_CI_AI</Uni></WinCollation30>
+ </LgCollation>
+ <LgCollation>
+ <Name30>
+ <AUni ws="en">Case Sensitive</AUni>
+ </Name30>
+ <WinLCID30><Integer val="1033"/></WinLCID30>
+ <WinCollation30><Uni>Latin1_General_CS_AI</Uni></WinCollation30>
+ </LgCollation>
+ </Collations24>
+ </LgWritingSystem>
+</Languages>
+
+<Styles>
+ <StStyle>
+ <Name17><Uni>Normal</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni></Uni></BasedOn17>
+ <Next17><Uni>Normal</Uni></Next17>
+ <Rules17>
+ <Prop italic="off" bold="off" superscript="off" underline="none" fontsize="10000" fontsizeUnit="mpt" offset="0" offsetUnit="mpt" forecolor="black" backcolor="white" undercolor="black" align="leading" firstIndent="0" leadingIndent="0" trailingIndent="0" spaceBefore="0" spaceAfter="0" lineHeight="10000" lineHeightUnit="mpt" lineHeightType="atLeast" rightToLeft="0" borderTop="0" borderBottom="0" borderLeading="0" borderTrailing="0" borderColor="black" bulNumScheme="0" bulNumStartAt="1" fontFamily="&lt;default serif&gt;">
+ <BulNumFontInfo backcolor="white" bold="off" fontsize="10000mpt" forecolor="black" italic="off" offset="0mpt" superscript="off" undercolor="black" underline="none" fontFamily="Times New Roman"/>
+ </Prop>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Bulleted List</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Bulleted List</Uni></Next17>
+ <Rules17>
+ <Prop firstIndent="-18000" bulNumScheme="101" bulNumStartAt="1"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 1</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 1</Uni></Next17>
+ <Rules17>
+ <Prop bold="invert" fontsize="14000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 2</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 2</Uni></Next17>
+ <Rules17>
+ <Prop italic="invert" fontsize="12000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 3</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 3</Uni></Next17>
+ <Rules17>
+ <Prop fontsize="12000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Numbered List</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Numbered List</Uni></Next17>
+ <Rules17>
+ <Prop firstIndent="-18000" bulNumScheme="10"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>External Link</Uni></Name17>
+ <Type17><Integer val="1"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>External Link</Uni></Next17>
+ <Rules17>
+ <Prop underline="single" forecolor="7f007f" undercolor="7f007f"/>
+ </Rules17>
+ </StStyle>
+</Styles>
+
+<Body docRightToLeft="false">
+ <StTxtPara>
+ <StyleRules15>
+ <Prop rightToLeft="0" namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="en" fontsize="36000" fontsizeUnit="mpt" fontFamily="Graphite Test Roman">ẽ̀p͡sg˨˥˧ŊấĩĨm̼̀̈̄ffi</Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+ <StTxtPara>
+ <StyleRules15>
+ <Prop rightToLeft="0" namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="en" fontsize="20000" fontsizeUnit="mpt" fontFamily="Graphite Test Roman">with features:</Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+ <StTxtPara>
+ <StyleRules15>
+ <Prop rightToLeft="0" namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="en" fontsize="36000" fontsizeUnit="mpt" fontFamily="Graphite Test Roman" fontVariations="1026=1,1029=1,1032=1,1024=2,1051=0">ẽ̀p͡sg˨˥˧ŊấĩĨm̼̀̈̄ffi</Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+ <StTxtPara>
+ <StyleRules15>
+ <Prop rightToLeft="0" namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="en" fontsize="36000" fontsizeUnit="mpt" fontFamily="Graphite Test Roman"></Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+ <StTxtPara>
+ <StyleRules15>
+ <Prop rightToLeft="0" namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="en" fontsize="20000" fontsizeUnit="mpt" fontFamily="Graphite Test Roman">stacking and bridging:</Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+ <StTxtPara>
+ <StyleRules15>
+ <Prop rightToLeft="0" namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="en" fontsize="36000" fontsizeUnit="mpt" fontFamily="Graphite Test Roman">a͝a t͝a à̀͝a </Run>
+ <Run ws="en" fontsize="36000" fontsizeUnit="mpt" forecolor="ff6000" fontFamily="Graphite Test Roman">ʃ̀̀͝a</Run>
+ <Run ws="en" fontsize="36000" fontsizeUnit="mpt" fontFamily="Graphite Test Roman"> a̖̖a </Run>
+ <Run ws="en" fontsize="36000" fontsizeUnit="mpt" forecolor="blue" fontFamily="Graphite Test Roman">ʃ̀̀a</Run>
+ <Run ws="en" fontsize="36000" fontsizeUnit="mpt" fontFamily="Graphite Test Roman"> </Run>
+ <Run ws="en" fontsize="36000" fontsizeUnit="mpt" forecolor="yellow" fontFamily="Graphite Test Roman">a̖̖a</Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+</Body>
+
+<PageSetup>
+ <PageInfo>
+ <TopMargin9999><Integer val="72000"/></TopMargin9999>
+ <BottomMargin9999><Integer val="72000"/></BottomMargin9999>
+ <LeftMargin9999><Integer val="90000"/></LeftMargin9999>
+ <RightMargin9999><Integer val="90000"/></RightMargin9999>
+ <HeaderMargin9999><Integer val="36000"/></HeaderMargin9999>
+ <FooterMargin9999><Integer val="36000"/></FooterMargin9999>
+ <PageSize9999><Integer val="0"/></PageSize9999>
+ <PageHeight9999><Integer val="792000"/></PageHeight9999>
+ <PageWidth9999><Integer val="612000"/></PageWidth9999>
+ <PageOrientation9999><Integer val="0"/></PageOrientation9999>
+ <Header9999>
+ <Str>
+ <Run ws="en">romanText.wpx</Run>
+ </Str>
+ </Header9999>
+ <Footer9999>
+ <Str>
+ <Run ws="en">&amp;[page],&amp;[date]</Run>
+ </Str>
+ </Footer9999>
+ </PageInfo>
+</PageSetup>
+
+</WpDoc>
diff --git a/Build/source/libs/graphite/test/RegressionTest/stdafx.cpp b/Build/source/libs/graphite/test/RegressionTest/stdafx.cpp
new file mode 100644
index 00000000000..7f699d258e2
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/stdafx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// RegressionTest.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/Build/source/libs/graphite/test/RegressionTest/stdafx.h b/Build/source/libs/graphite/test/RegressionTest/stdafx.h
new file mode 100644
index 00000000000..c5e242de5cb
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/stdafx.h
@@ -0,0 +1,12 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+
+#include <iostream>
+// #include <tchar.h>
+
+// TODO: reference additional headers your program requires here
diff --git a/Build/source/libs/graphite/test/RegressionTest/taivietText.wpx b/Build/source/libs/graphite/test/RegressionTest/taivietText.wpx
new file mode 100644
index 00000000000..964c4968611
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/taivietText.wpx
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE WpDoc SYSTEM "WorldPad.dtd">
+<WpDoc wpxVersion="2.0">
+
+<Languages>
+ <LgWritingSystem id="blt_TV" language="blt" type="ISO-639-2">
+ <Name24>
+ <AUni ws="en">Tai Dam</AUni>
+ </Name24>
+ <Locale24><Integer val="1033"/></Locale24>
+ <RightToLeft24><Boolean val="false"/></RightToLeft24>
+ <FontVariation24><Uni>2001=0,2005=0,2101=1,1051=1,2102=1</Uni></FontVariation24>
+ <DefaultSerif24><Uni>Tai Heritage Graphite</Uni></DefaultSerif24>
+ <DefaultSansSerif24><Uni>Arial</Uni></DefaultSansSerif24>
+ <DefaultBodyFont24><Uni>Charis SIL</Uni></DefaultBodyFont24>
+ <DefaultMonospace24><Uni>Courier</Uni></DefaultMonospace24>
+ <ICULocale24><Uni>blt_TV</Uni></ICULocale24>
+ <KeyboardType24><Uni>standard</Uni></KeyboardType24>
+ <Collations24>
+ <LgCollation>
+ <WinLCID30><Integer val="1033"/></WinLCID30>
+ <WinCollation30><Uni>Latin1_General_CI_AI</Uni></WinCollation30>
+ </LgCollation>
+ </Collations24>
+ </LgWritingSystem>
+</Languages>
+
+<Styles>
+ <StStyle>
+ <Name17><Uni>Normal</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni></Uni></BasedOn17>
+ <Next17><Uni>Normal</Uni></Next17>
+ <Rules17>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Bulleted List</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Bulleted List</Uni></Next17>
+ <Rules17>
+ <Prop firstIndent="-18000" bulNumScheme="101" bulNumStartAt="1"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 1</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 1</Uni></Next17>
+ <Rules17>
+ <Prop bold="invert" fontsize="14000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 2</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 2</Uni></Next17>
+ <Rules17>
+ <Prop italic="invert" fontsize="12000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 3</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 3</Uni></Next17>
+ <Rules17>
+ <Prop fontsize="12000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Numbered List</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Numbered List</Uni></Next17>
+ <Rules17>
+ <Prop firstIndent="-18000" bulNumScheme="10"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>External Link</Uni></Name17>
+ <Type17><Integer val="1"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>External Link</Uni></Next17>
+ <Rules17>
+ <Prop underline="single" forecolor="7f007f" undercolor="7f007f"/>
+ </Rules17>
+ </StStyle>
+</Styles>
+
+<Body docRightToLeft="false">
+ <StTxtPara>
+ <StyleRules15>
+ <Prop namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run></Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+ <StTxtPara>
+ <StyleRules15>
+ <Prop namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="blt_TV" fontsize="36000" fontsizeUnit="mpt" forecolor="transparent" fontFamily="Graphite Test TaiViet" fontVariations="2001=2,1051=0,2102=0"></Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+ <StTxtPara>
+ <StyleRules15>
+ <Prop namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="blt_TV" fontsize="36000" fontsizeUnit="mpt" forecolor="transparent" fontFamily="Graphite Test TaiViet" fontVariations="2001=2,2102=0"></Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+ <StTxtPara>
+ <StyleRules15>
+ <Prop namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="blt_TV" fontsize="36000" fontsizeUnit="mpt" forecolor="transparent" fontFamily="Graphite Test TaiViet" fontVariations="2001=2,2102=1"></Run>
+ <Run ws="blt_TV" fontsize="36000" fontsizeUnit="mpt" forecolor="transparent" fontFamily="Graphite Test TaiViet" fontVariations="2001=2"></Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+</Body>
+
+<PageSetup>
+ <PageInfo>
+ <TopMargin9999><Integer val="72000"/></TopMargin9999>
+ <BottomMargin9999><Integer val="72000"/></BottomMargin9999>
+ <LeftMargin9999><Integer val="90000"/></LeftMargin9999>
+ <RightMargin9999><Integer val="90000"/></RightMargin9999>
+ <HeaderMargin9999><Integer val="36000"/></HeaderMargin9999>
+ <FooterMargin9999><Integer val="36000"/></FooterMargin9999>
+ <PageSize9999><Integer val="0"/></PageSize9999>
+ <PageHeight9999><Integer val="792000"/></PageHeight9999>
+ <PageWidth9999><Integer val="612000"/></PageWidth9999>
+ <PageOrientation9999><Integer val="0"/></PageOrientation9999>
+ <Header9999>
+ <Str>
+ <Run ws="en">collision_examples.wpx</Run>
+ </Str>
+ </Header9999>
+ <Footer9999>
+ <Str>
+ <Run ws="en">&amp;[page],&amp;[date]</Run>
+ </Str>
+ </Footer9999>
+ </PageInfo>
+</PageSetup>
+
+</WpDoc>
diff --git a/Build/source/libs/graphite/test/RegressionTest/xline.gdl b/Build/source/libs/graphite/test/RegressionTest/xline.gdl
new file mode 100644
index 00000000000..70bfa15902a
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/xline.gdl
@@ -0,0 +1,146 @@
+
+/*********************************************************************************
+ File: xline.gdl
+
+ For testing cross-line contextualization.
+
+ Compile with stddr.ttf
+
+ To test, type something like these examples:
+ abc$x
+ abcx@
+ abc$x@
+ and force a line break after the x.
+*********************************************************************************/
+
+#include "stddef.gdh"
+
+Bidi = false;
+
+#define duplicated user1
+
+
+table(glyph) {MUnits = 1000 }
+
+ g_A = codepoint("A");
+ g_B = codepoint("B");
+ g_C = codepoint("C");
+ g_D = codepoint("D");
+ g_E = codepoint("E");
+ g_F = codepoint("F");
+ g_G = codepoint("G");
+
+ g_a = codepoint("a");
+ g_b = codepoint("b");
+ g_c = codepoint("c");
+ g_d = codepoint("d");
+ g_e = codepoint("e");
+ g_f = codepoint("f");
+ g_g = codepoint("g");
+
+ g_x = codepoint("x");
+ g_y = codepoint("y");
+ g_z = codepoint("z");
+
+ g_asterisk = codepoint("*") { ptCenter = point(bb.width/2, bb.height/2) };
+ g_dollar = codepoint("$") { xWid = aw };
+ g_hash = codepoint("#");
+ g_at = codepoint("@") { xWid = aw };
+ g_amp = codepoint("&") {xWid = aw };
+ g_percent = codepoint("%");
+
+ g_leftArrow = codepoint("<") { xWid = aw };
+ g_rightArrow = codepoint(">") { xWid = aw };
+
+ clsUpper = codepoint("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
+ { ptCenter = point(bb.width/2, ascent/2) };
+ clsLower = codepoint("abcdefghijklmnopqrstuvwxyz");
+
+ clsMyAny = glyphid(2..216) { justify.stretch = 700m };
+
+ g_m = codepoint("m");
+ g_Mlig = codepoint("M") {
+ component.one = box(0,0, bb.width/2, ascent);
+ component.two = box(bb.width/2,0, bb.width,ascent) };
+
+ gSpace = U+0020 { justify.stretch = 3000m };
+
+ clsXYZ = (g_x g_y g_z);
+
+endtable; // glyph
+
+
+table(lb)
+
+ // Allow non-optimal linebreaks after x, y, or z.
+ clsXYZ {break = BREAK_INTRA};
+
+endtable; // lb
+
+
+table(sub)
+
+pass(1)
+
+ // Switch the $ and @ if they are both there, and insert & after the one on the first
+ // line and before the one on the second line. Note that these rules supercede the rule
+ // to insert the left- and right-arrows.
+ g_dollar _ _ g_at > @7 g_amp:7 g_amp:1 @1
+ / _ _ ANY? # {break == BREAK_INTRA} ANY? _ _ ;
+
+ g_dollar
+ clsXYZ {measure.endofline = g_at.aw - g_dollar.aw + g_amp.aw}
+ ANY {measure.startofline = g_dollar.aw - g_at.aw + g_amp.aw}
+ g_at;
+ g_dollar
+ clsXYZ {measure.endofline = g_at.aw - g_dollar.aw + g_amp.aw}
+ g_at {measure.startofline = g_dollar.aw - g_at.aw + g_amp.aw};
+
+
+ // Just copy the $ to the following segment.
+ g_dollar _ > @1 {duplicated = true} g_dollar:1
+ / _ {duplicated == false} ANY? ^ # {break == BREAK_INTRA} ANY? _ ;
+
+ g_dollar
+ clsXYZ {measure.endofline = g_rightArrow.aw}
+ ANY {measure.startofline = g_dollar.aw + g_leftArrow.aw};
+
+
+ // Just copy the @ to the previous segment.
+ _ g_at > g_at:5 @5 {duplicated = true}
+ / _ ANY? ^ # {break == BREAK_INTRA} ANY? _ {duplicated == false};
+
+ clsXYZ {measure.endofline = g_at.aw + g_rightArrow.aw}
+ ANY {measure.startofline = g_leftArrow.aw}
+ g_at;
+
+ clsXYZ {measure.endofline = g_at.aw + g_rightArrow.aw}
+ g_at {measure.startofline = g_leftArrow.aw};
+
+
+ // Insert a '<' at the beginning of the line and a '>' at the end.
+ _ > g_leftArrow / # _;
+ _ > g_rightArrow / clsMyAny _ # ^ ;
+
+ clsMyAny {measure {startofline = g_leftArrow.aw; endofline = g_rightArrow.aw}};
+
+endpass;
+
+pass(2)
+
+ // Don't stretch trailing white space.
+ gSpace {justify.stretch = 0} / _ [gSpace [gSpace [gSpace gSpace?]? ]? ]? # ;
+ // In fact, don't stretch any line-boundary glyph.
+ clsMyAny {justify.stretch = 0} / _ #;
+
+
+endpass;
+
+endtable; // sub
+
+
+table(pos)
+
+ clsMyAny {adv.x += justify.width};
+
+endtable; // pos
diff --git a/Build/source/libs/graphite/test/RegressionTest/xlineText.wpx b/Build/source/libs/graphite/test/RegressionTest/xlineText.wpx
new file mode 100644
index 00000000000..a8d51fefda7
--- /dev/null
+++ b/Build/source/libs/graphite/test/RegressionTest/xlineText.wpx
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE WpDoc SYSTEM "WorldPad.dtd">
+<WpDoc wpxVersion="2.0">
+
+<Languages>
+ <LgWritingSystem id="en" language="en" type="ISO-639-1">
+ <Name24>
+ <AUni ws="en">English</AUni>
+ </Name24>
+ <Locale24><Integer val="1033"/></Locale24>
+ <RightToLeft24><Boolean val="false"/></RightToLeft24>
+ <DefaultSerif24><Uni>Times New Roman</Uni></DefaultSerif24>
+ <DefaultSansSerif24><Uni>Arial</Uni></DefaultSansSerif24>
+ <DefaultMonospace24><Uni>Courier New</Uni></DefaultMonospace24>
+ <ICULocale24><Uni>en</Uni></ICULocale24>
+ <KeyboardType24><Uni>standard</Uni></KeyboardType24>
+ <Collations24>
+ <LgCollation>
+ <Name30>
+ <AUni ws="en">DefaultCollation</AUni>
+ </Name30>
+ <WinLCID30><Integer val="1033"/></WinLCID30>
+ <WinCollation30><Uni>Latin1_General_CI_AI</Uni></WinCollation30>
+ </LgCollation>
+ </Collations24>
+ </LgWritingSystem>
+</Languages>
+
+<Styles>
+ <StStyle>
+ <Name17><Uni>Normal</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni></Uni></BasedOn17>
+ <Next17><Uni>Normal</Uni></Next17>
+ <Rules17>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Bulleted List</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Bulleted List</Uni></Next17>
+ <Rules17>
+ <Prop firstIndent="-18000" bulNumScheme="101" bulNumStartAt="1"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 1</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 1</Uni></Next17>
+ <Rules17>
+ <Prop bold="invert" fontsize="14000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 2</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 2</Uni></Next17>
+ <Rules17>
+ <Prop italic="invert" fontsize="12000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Heading 3</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Heading 3</Uni></Next17>
+ <Rules17>
+ <Prop fontsize="12000" fontsizeUnit="mpt" spaceBefore="12000" spaceAfter="3000"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>Numbered List</Uni></Name17>
+ <Type17><Integer val="0"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>Numbered List</Uni></Next17>
+ <Rules17>
+ <Prop firstIndent="-18000" bulNumScheme="10"/>
+ </Rules17>
+ </StStyle>
+ <StStyle>
+ <Name17><Uni>External Link</Uni></Name17>
+ <Type17><Integer val="1"/></Type17>
+ <BasedOn17><Uni>Normal</Uni></BasedOn17>
+ <Next17><Uni>External Link</Uni></Next17>
+ <Rules17>
+ <Prop underline="single" forecolor="7f007f" undercolor="7f007f"/>
+ </Rules17>
+ </StStyle>
+</Styles>
+
+<Body docRightToLeft="false">
+ <StTxtPara>
+ <StyleRules15>
+ <Prop namedStyle="Normal"/>
+ </StyleRules15>
+ <Contents16>
+ <Str>
+ <Run ws="en" fontsize="28000" fontsizeUnit="mpt" fontFamily="Graphite Test CrossLine">abcddddefx@ghijkmmmmn$yopppppqrsss$z@tttwwww</Run>
+ </Str>
+ </Contents16>
+ </StTxtPara>
+</Body>
+
+<PageSetup>
+ <PageInfo>
+ <TopMargin9999><Integer val="72000"/></TopMargin9999>
+ <BottomMargin9999><Integer val="72000"/></BottomMargin9999>
+ <LeftMargin9999><Integer val="90000"/></LeftMargin9999>
+ <RightMargin9999><Integer val="90000"/></RightMargin9999>
+ <HeaderMargin9999><Integer val="36000"/></HeaderMargin9999>
+ <FooterMargin9999><Integer val="36000"/></FooterMargin9999>
+ <PageSize9999><Integer val="0"/></PageSize9999>
+ <PageHeight9999><Integer val="792000"/></PageHeight9999>
+ <PageWidth9999><Integer val="612000"/></PageWidth9999>
+ <PageOrientation9999><Integer val="0"/></PageOrientation9999>
+ <Header9999>
+ <Str>
+ <Run ws="en">xline_test.wpx</Run>
+ </Str>
+ </Header9999>
+ <Footer9999>
+ <Str>
+ <Run ws="en">&amp;[page],&amp;[date]</Run>
+ </Str>
+ </Footer9999>
+ </PageInfo>
+</PageSetup>
+
+</WpDoc>
diff --git a/Build/source/libs/graphite/test/examples/burmese/Padauk.ttf b/Build/source/libs/graphite/test/examples/burmese/Padauk.ttf
new file mode 100644
index 00000000000..16a2ed864d9
--- /dev/null
+++ b/Build/source/libs/graphite/test/examples/burmese/Padauk.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/examples/burmese/bh1.utx b/Build/source/libs/graphite/test/examples/burmese/bh1.utx
new file mode 100644
index 00000000000..9dcaa5c3459
--- /dev/null
+++ b/Build/source/libs/graphite/test/examples/burmese/bh1.utx
@@ -0,0 +1,4 @@
+ကျွနှ်ပ်တို့၏ ပျော်ရွှင်မှု၊ သာယာ ၀ ပြောမှုနှင့် အောင်မြင်မှုတို့သည် ကျွနု်ပ်တို့၏ ကျန်းမာခြင်းအပေါ်တွင် အများကြီး မှီခိုနေပါသည်။ ပညာတတ်ရန်၊ ကြွယ်၀ချမ်းသာရန်နှင့် ကြိုးပမ်း လုပ်ဆောင်မှုအားလုံး အောင်မြင်စေရန်အတွက် ကျန်းမာရေးသည် အထူးပင် အရေးကြီးပါသည်။ ကျန်းမာရေးမပြည့်စုံလျှင် ကျွနု်ပ်တို့၏ ပညာရေး၊ စီးပွားရေး မြှင့်တင်မှုလုပ်ငန်းများ လုပ်နိုင်လိမ့်မည် မဟုတ်ပါ။ သို့ဖြစ်၍ အစဥ်သဖြင့် ကျန်းမာနေရန် ကျွနု်ပ်တို့ ကြိုးစားကြရပါမည်။
+ကျွန်းမာရေးနှင့် ပြည့်စုံရန်အတွက် ဆောင်ရွက်ရန် နည်းလမ်းများကို သိရှိလိုက်နာရပါမည်။ အစားအသောက်၊ အအိပ်အနေ၊ လေ့ကျင့်ခန်းနှင့် သန့်ရှင်းမှုတို့သည် ကျန်းမာရေးအတွက် လိုအပ်ချက်များ ဖြစ်ပါသည်။ အစားအစာသည် အသက်ရှင်မှုအတွက် အထူးလိုအပ်ချက် ဖြစ်ပါသည်။ ကျွနု်ပ်တို့သည် အသက် ရှင်နေနိုင်ရန် အစာစားရခြင်းဖြစ်ပြီး စားသောက်ရန် အသက်ရှင်နေခြင်း မဟုတ််ပါ။ ကျန်းမာမှုအတွက် သင့်တော်သည့် ပရိုတိန်း၊ သတ္တုဓာတ်များနှင့် ဗီတာမင်များ များစွာပါ၀င်သည့် အစာများကို ရယူစားသုံးရန် လိုအပ်ပါသည်။ ကျွနု်ပ်တို့နှင့် လျှော်ကန်သင့် မြတ်မည့် အိပ်စက်အနားယူမှုမှာလည်း အရေးကြီးပါသည်။ ကျွနု်ပ်တို့၏ ခန္ဓာကိုယ်မှ ကြွက်သားများနှင့် အသားမျှင်များအား ထိန်းသိမ်းပြုပြင်မှုအတွက် အိပ်စက်ခြင်းနှင့် နားနေခြင်းတို့ အညီအမျှ လိုအပ်ပါသည်။ ထို့ကြောင့် လုံလောက်စွာ အိပ်စက်နားနေရပါမည်။
+ကိုယ်ကာယလေ့ကျင့်ခန်းများနှင့် သန့်ရှင်းမှုတို့လည်း အရေးကြီး လိုအပ်ပါသည်။ လမ်းလျှောက်ခြင်းနှင့် အိမ်တွင်း လေ့ကျင့်ခန်းများသည် အစားအသောက်စားလိုစိတ်နှင့် စိတ်ရွှင်လန်းမှုတို့ကို တိုးပွားစေပါသည်။ တစ်ကိုယ်ရေသန့်ရှင်းရေးက ကျန်းမာမှုကို အထောက်အကူပြုပါသည်။ နေ့စဥ် ရေချိုးခြင်း၊ အစာမစားမီနှင့် စားပြီးတိုင်း လက်များကို စနစ်တကျဆေးကြော ရပါမည်။
+အထက်ပါ ကျန်းမာရေး နည်းလမ်းများကို လိုက်နာဆောင်ရွက်ပါက ကျွနု်ပ်တို့ တစ်သက်တာအတွက် ကျန်းမာရေးနှင့်ပြည့်စုံနေမည်မှာ သေချာပါသည်။ ကျွနု်ပ်တို့ ကျန်းမာနေလျှင် စီးပွားဥစ္စာပြည့်စုံခြင်း၊ ပညာရေးပြည့်စုံခြင်းနှင့် အခြားအောင်မြင်မှုများကို စွမ်းဆောင်နိုင်ပါမည်။ သို့ပါ၍ ကျန်းမာခြင်းသည် ချမ်းသာခြင်းဖြစ်ကြောင်းနှင့် ကျန်းမာခြင်းသည် ချမ်းသာခြင်းထက် ပိုမိုကောင်းမွန်သည်ဟု ဆိုရမည် ဖြစ်ပါသည်။
diff --git a/Build/source/libs/graphite/test/examples/khmer/cloudsku2.txt b/Build/source/libs/graphite/test/examples/khmer/cloudsku2.txt
new file mode 100755
index 00000000000..6026347f841
--- /dev/null
+++ b/Build/source/libs/graphite/test/examples/khmer/cloudsku2.txt
@@ -0,0 +1,29 @@
+ពពក
+១-ពពកនៅលើមេឃគឺ​ជា​តំណក់ទឹក​តូចៗ​ជា​ច្រើន​ ។
+២-ពពកមើលទៅឃើញស្អាត ​ហើយ​មាន​ប្រយោជន៍​ចំញេះមនុស្សដែរ​​ ។​
+៣-ពពកគឺជាប្រភពនៃទឹកភ្លៀង ដែលរុក្ខជាតិ​ នឹង​សត្វទាំងឡាយត្រូវការ​ ។​
+៤-ទឹកភ្លៀង​បង្អុរពីលើ "ពពក" ទៅក្នុង​ទន្លេ​ដែល​ជា​ទី​កន្លែង​សំរាប់យើងរកត្រី​ ​។​
+៥-ទឹក​អ​ណ្ដូង​របស់​យើង​ក៏មក​ពី​ទឹក​ភ្លៀង​ដែរ​ ។​
+៦-យើងប្រើទឹកសំរាប់ហូប​ សំរាប់ដាំស្ល​ និងសំ​រាប់​ងូត​ទឹក​សំរាប់បោកគក់​ ។​
+៧-នៅពេលថ្ងៃ​ ពពកផ្ដល់ម្លប់អោយ​យើង​ពី​កំ​ដៅ​ព្រះអាទិត្យ​​ ។
+៨-ប្រសិនបើមានពពកនៅពេលយប់​ នោះ​នឹង​​ អាច​​ការពារកំដៅពីចំហាយផែនដី ។​ ហេតុ​ដូច្នេះ​ហើយ​ទើប​ធ្វើអោយយើងមានអារម្មណ៍កក់ក្ដៅ​នៅ​ពេល​យប់​ដែលមានពពកច្រើន​​ ។
+៩-ពេលខ្លះពពកធ្វើអោយមានភ្លៀងធ្លាក់យ៉ាង​ខ្លាំង​ និងធ្វើអោយមានទឹកជំនន់​ទឹក​ទន្លេ​ជន់​ឡើងយ៉ាងខ្លាំង​ហើយផ្ទះសំបែង​ជា​ច្រើន​បាន​ត្រូវ​លិចលង់ ​។​
+១០-ទឹកជំនន់បំផ្លិចបំផ្លាញផលដំណាំជាច្រើន​​ ។
+១១-សត្វជាច្រើនបានលង់ទឹកស្លាប់​​​ ។
+១២-មានផ្ទាំងដីធ្លាក់បាក់ចុះមកជាច្រើន​ ។​
+១៣-ប៉ុន្ដែនៅទីណាដែលគ្មានពពកច្រើន​ ទីកន្លែង​នោះ​ខ្វះ​ខាតទឹក ​ ​និង​ក្លាយទៅជាវាល​រហោ​ស្ថាន​ ។ អត់​មាន​ដើម​ឈើ​រុក្ខជាតិ​រស់ ស្វត​និង​មនុស្ស​ក៏​មិន​អាច​រស់​នៅ​ទី​នោះ​បាន​ដែរ​ ។​​ ​
+
+CLOUDS
+1 The clouds in the sky are made up of little drops of water.
+2 Clouds are pretty to look at as well as useful to man.
+3 Clouds are the source of rain, which is needed by both plants and animals.
+4 Rain from the clouds fills the rivers where we get fish.
+5 Our wells are also filled by the rain that falls from the clouds.
+6 We use water for drinking, for cooking and for washing.
+7 During the day, the clouds provide shade from the heat of the sun.
+8 If there are clouds at night, they prevent the heat from the surface of the earth from rising. So that is why we feel warm on a cloudy night.
+9 Sometimes clouds bring heavy rains and floods. Rivers overflow and houses get flooded.
+10 The floods destroy crops.
+11 Animals are drowned.
+12 There are landslides.
+13 But in places where there are not many clouds, there is less water and the place becomes a desert in which no plants grow and no animals and people live.
diff --git a/Build/source/libs/graphite/test/examples/khmer/mond40gr6.ttf b/Build/source/libs/graphite/test/examples/khmer/mond40gr6.ttf
new file mode 100755
index 00000000000..a4a784c9026
--- /dev/null
+++ b/Build/source/libs/graphite/test/examples/khmer/mond40gr6.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/fonterrors/errBadGloc.ttf b/Build/source/libs/graphite/test/fonterrors/errBadGloc.ttf
new file mode 100644
index 00000000000..6cce2701493
--- /dev/null
+++ b/Build/source/libs/graphite/test/fonterrors/errBadGloc.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/fonterrors/errBadGloc2.ttf b/Build/source/libs/graphite/test/fonterrors/errBadGloc2.ttf
new file mode 100644
index 00000000000..89c54507f58
--- /dev/null
+++ b/Build/source/libs/graphite/test/fonterrors/errBadGloc2.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/fonterrors/errBadPass.ttf b/Build/source/libs/graphite/test/fonterrors/errBadPass.ttf
new file mode 100644
index 00000000000..82ae6b66c7a
--- /dev/null
+++ b/Build/source/libs/graphite/test/fonterrors/errBadPass.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/fonterrors/errBadStackMachine.ttf b/Build/source/libs/graphite/test/fonterrors/errBadStackMachine.ttf
new file mode 100644
index 00000000000..27350bef70c
--- /dev/null
+++ b/Build/source/libs/graphite/test/fonterrors/errBadStackMachine.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/fonterrors/errBadSubs.ttf b/Build/source/libs/graphite/test/fonterrors/errBadSubs.ttf
new file mode 100644
index 00000000000..8027c72b79a
--- /dev/null
+++ b/Build/source/libs/graphite/test/fonterrors/errBadSubs.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/fonterrors/errBadVersion.ttf b/Build/source/libs/graphite/test/fonterrors/errBadVersion.ttf
new file mode 100644
index 00000000000..babe42e5352
--- /dev/null
+++ b/Build/source/libs/graphite/test/fonterrors/errBadVersion.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/fonterrors/errGarbageFsm.ttf b/Build/source/libs/graphite/test/fonterrors/errGarbageFsm.ttf
new file mode 100644
index 00000000000..7909e115949
--- /dev/null
+++ b/Build/source/libs/graphite/test/fonterrors/errGarbageFsm.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/fonterrors/errGarbageGlat.ttf b/Build/source/libs/graphite/test/fonterrors/errGarbageGlat.ttf
new file mode 100644
index 00000000000..012e6b5d5b2
--- /dev/null
+++ b/Build/source/libs/graphite/test/fonterrors/errGarbageGlat.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/fonterrors/errGarbageSilf.ttf b/Build/source/libs/graphite/test/fonterrors/errGarbageSilf.ttf
new file mode 100644
index 00000000000..b540a0d4dd5
--- /dev/null
+++ b/Build/source/libs/graphite/test/fonterrors/errGarbageSilf.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/fonterrors/errSilfVerMismatch.ttf b/Build/source/libs/graphite/test/fonterrors/errSilfVerMismatch.ttf
new file mode 100644
index 00000000000..9088e11ea9a
--- /dev/null
+++ b/Build/source/libs/graphite/test/fonterrors/errSilfVerMismatch.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/fonterrors/errSubsUnderflow.ttf b/Build/source/libs/graphite/test/fonterrors/errSubsUnderflow.ttf
new file mode 100644
index 00000000000..a7b04a1e146
--- /dev/null
+++ b/Build/source/libs/graphite/test/fonterrors/errSubsUnderflow.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/fonterrors/errTooManyClasses.ttf b/Build/source/libs/graphite/test/fonterrors/errTooManyClasses.ttf
new file mode 100644
index 00000000000..9c73c9a38a1
--- /dev/null
+++ b/Build/source/libs/graphite/test/fonterrors/errTooManyClasses.ttf
Binary files differ
diff --git a/Build/source/libs/graphite/test/fonterrors/fonterrors.gdl b/Build/source/libs/graphite/test/fonterrors/fonterrors.gdl
new file mode 100644
index 00000000000..862284a2440
--- /dev/null
+++ b/Build/source/libs/graphite/test/fonterrors/fonterrors.gdl
@@ -0,0 +1,43 @@
+
+/*********************************************************************************
+ File: fonterrors.gdl
+
+ For seeing some basic Graphite behavior. This version is used to generate
+ fonts that can be deliberately corrupted to test error handling in the
+ engine.
+
+ Compile with Std SILDoulos (stddr.ttf).
+*********************************************************************************/
+
+#include "stddef.gdh"
+
+Bidi = false;
+
+
+table(glyph)
+
+ clsUpperVowel = codepoint("AEIOU");
+ clsLowerVowel = codepoint("aeiou");
+
+ clsUpperCons = codepoint("BCDFGHJKLMNPQRSTVWXYZ");
+ clsLowerCons = codepoint("bcdfghjklmnpqrstvwxyz");
+
+ clsDigit = codepoint("0123456789") {tSuper = 400m};
+
+endtable; // glyph
+
+
+table(sub)
+
+ clsUpperVowel > clsLowerVowel;
+ clsLowerCons > clsUpperCons;
+
+endtable;
+
+
+table(pos)
+
+ clsDigit {shift.y += tSuper};
+
+endtable;
+
diff --git a/Build/source/libs/graphite/test/fonterrors/readme.txt b/Build/source/libs/graphite/test/fonterrors/readme.txt
new file mode 100644
index 00000000000..943b2853cf6
--- /dev/null
+++ b/Build/source/libs/graphite/test/fonterrors/readme.txt
@@ -0,0 +1,43 @@
+FONTS FOR TESTING ERROR HANDLING
+
+This directory constains a set of fonts that have been deliberately corrupted in order to test Graphite's error recovery capabilities.
+
+The "correct" behavior of the font is that vowels are rendered as lowercase, consonants as uppercase, and digits are raised vertically. For some of the fonts, recovery will be adequate to show some smart behaviors; for others the engine will revert to pure dumb rendering.
+
+
+* GrErr BadGloc - errBadGloc.ttf
+ The stated number of attributes exceeds actual number. This actually should not cause any real error, since the attributes are never read.
+
+* GrErr BadGloc2 - errBadGloc2.ttf
+ The stated number of attributes is less than actual number. This causes attributes greater than the number specified to have the value zero.
+
+* GrErr BadPass - errBadPass.ttf
+ One of the offsets to the pass information points off to somewhere nonsensical.
+
+* GrErr BadStackMachine - errStackMachine.ttf
+ Extra bytes have been inserted into the stack machine commands for both of the substitution rules. The engine manages to recover and handle the rule correctly in this case. (Reproduce using lowercase consonants or uppercase vowels.)
+
+* GrErr BadSubs - errSubs.ttf
+ A PutSubs command references a non-existent replacement class. This causes the glyph to appear as a square box. (Reproduce using lowercase consonants or uppercase vowels.)
+
+* GrErr BadVersion - errBadVersion.ttf
+ Bad version numbers are recorded in the Silf, Gloc, Glat, and Feat tables. Reading the Silf table will trigger an error being thrown, and the font will fall back to dumb rendering.
+
+* GrErr GarbageFsm - errGarbageFsm.ttf
+ The state table portions of the FSMs have been overwritten with garbage. Font will fall back to dumb rendering when any rules are fired.
+
+* GrErr GarbageGlat - errGarbageGlat.ttf
+ A section of Glat is overwritten with garbage. The "normal" behavior of the font is to raise the digits by 400m. But the lower digits (1 and 2) have been corrupted so they should simply not show that behavior.
+
+* GrErr GarbageSilf - errGarbageSilf.ttf
+ A section of Silf table is overwritten with garbage. Font will fall back to dumb rendering.
+
+* GrErr SilfVersionMismatch - errSilfVerMismatch.ttf
+ The Silf table claims to be version 1.0, but is actually version 2.0. Font will fall back to dumb rendering.
+
+* GrErr SubsUnderflow - errSubsUnderflow.ttf
+ A bogus command is inserted into the stack machine commands for both the substitution rules, causing an underflow when running the rules. The engine manages to recover and handle the rule correctly in this case. (Reproduce using lowercase consonants or uppercase vowels.)
+
+* GrErr TooManyClasses - errTooManyClasses.ttf
+ Very large number of classes in the list of replacement classes, larger than are actually there.
+
diff --git a/Build/source/libs/graphite/uninstalled-top.pc.in b/Build/source/libs/graphite/uninstalled-top.pc.in
new file mode 100644
index 00000000000..e6dff4bb12e
--- /dev/null
+++ b/Build/source/libs/graphite/uninstalled-top.pc.in
@@ -0,0 +1,6 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+priv_includedir=@abs_srcdir@/src
+includedir=@abs_srcdir@/include
+libdir=@abs_builddir@/src/.libs
+version=@VERSION@
diff --git a/Build/source/libs/graphite/withenable.ac b/Build/source/libs/graphite/withenable.ac
new file mode 100644
index 00000000000..83db7006d82
--- /dev/null
+++ b/Build/source/libs/graphite/withenable.ac
@@ -0,0 +1,4 @@
+# we don't currently support use of an installed graphite lib
+
+AC_ARG_WITH([graphite],
+ [ --without-graphite build xetex without graphite support])