diff options
author | (no author) <(no author)@1f5c12ca-751b-0410-a591-d2e778427230> | 2006-08-03 00:51:06 +0400 |
---|---|---|
committer | (no author) <(no author)@1f5c12ca-751b-0410-a591-d2e778427230> | 2006-08-03 00:51:06 +0400 |
commit | 08b1ddca22410cab2acb0f5067f560a4603d386b (patch) | |
tree | 2fffc15a899f8818ad86ef865c0d6922e8729821 | |
parent | 8b459e004a657500343abe1be6a4d2a929ed55e3 (diff) |
This commit was manufactured by cvs2svn to create tagSCRIPTS-RELEASE-20060802-1746
'SCRIPTS-RELEASE-20060802-1746'.
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/tags/SCRIPTS-RELEASE-20060802-1746@473 1f5c12ca-751b-0410-a591-d2e778427230
220 files changed, 0 insertions, 43854 deletions
diff --git a/CVSROOT/checkoutlist b/CVSROOT/checkoutlist deleted file mode 100644 index 2921bffcd..000000000 --- a/CVSROOT/checkoutlist +++ /dev/null @@ -1,13 +0,0 @@ -# The "checkoutlist" file is used to support additional version controlled -# administrative files in $CVSROOT/CVSROOT, such as template files. -# -# The first entry on a line is a filename which will be checked out from -# the corresponding RCS file in the $CVSROOT/CVSROOT directory. -# The remainder of the line is an error message to use if the file cannot -# be checked out. -# -# File format: -# -# [<whitespace>]<filename>[<whitespace><error message>]<end-of-line> -# -# comment lines begin with '#' diff --git a/CVSROOT/commitinfo b/CVSROOT/commitinfo deleted file mode 100644 index b19e7b7a6..000000000 --- a/CVSROOT/commitinfo +++ /dev/null @@ -1,15 +0,0 @@ -# The "commitinfo" file is used to control pre-commit checks. -# The filter on the right is invoked with the repository and a list -# of files to check. A non-zero exit of the filter program will -# cause the commit to be aborted. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being committed to, relative -# to the $CVSROOT. For the first match that is found, then the remainder -# of the line is the name of the filter to run. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". diff --git a/CVSROOT/config b/CVSROOT/config deleted file mode 100644 index 92c150bf7..000000000 --- a/CVSROOT/config +++ /dev/null @@ -1,21 +0,0 @@ -# Set this to "no" if pserver shouldn't check system users/passwords -#SystemAuth=no - -# Put CVS lock files in this directory rather than directly in the repository. -#LockDir=/var/lock/cvs - -# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top -# level of the new working directory when using the `cvs checkout' -# command. -#TopLevelAdmin=no - -# Set `LogHistory' to `all' or `TOEFWUPCGMAR' to log all transactions to the -# history file, or a subset as needed (ie `TMAR' logs all write operations) -#LogHistory=TOEFWUPCGMAR - -# Set `RereadLogAfterVerify' to `always' (the default) to allow the verifymsg -# script to change the log message. Set it to `stat' to force CVS to verify# that the file has changed before reading it (this can take up to an extra -# second per directory being committed, so it is not recommended for large -# repositories. Set it to `never' (the previous CVS behavior) to prevent -# verifymsg scripts from changing the log message. -#RereadLogAfterVerify=always diff --git a/CVSROOT/cvswrappers b/CVSROOT/cvswrappers deleted file mode 100644 index e989b7545..000000000 --- a/CVSROOT/cvswrappers +++ /dev/null @@ -1,19 +0,0 @@ -# This file affects handling of files based on their names. -# -# The -m option specifies whether CVS attempts to merge files. -# -# The -k option specifies keyword expansion (e.g. -kb for binary). -# -# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers) -# -# wildcard [option value][option value]... -# -# where option is one of -# -f from cvs filter value: path to filter -# -t to cvs filter value: path to filter -# -m update methodology value: MERGE or COPY -# -k expansion mode value: b, o, kkv, &c -# -# and value is a single-quote delimited value. -# For example: -#*.gif -k 'b' diff --git a/CVSROOT/editinfo b/CVSROOT/editinfo deleted file mode 100644 index d78886c15..000000000 --- a/CVSROOT/editinfo +++ /dev/null @@ -1,21 +0,0 @@ -# The "editinfo" file is used to allow verification of logging -# information. It works best when a template (as specified in the -# rcsinfo file) is provided for the logging procedure. Given a -# template with locations for, a bug-id number, a list of people who -# reviewed the code before it can be checked in, and an external -# process to catalog the differences that were code reviewed, the -# following test can be applied to the code: -# -# Making sure that the entered bug-id number is correct. -# Validating that the code that was reviewed is indeed the code being -# checked in (using the bug-id number or a seperate review -# number to identify this particular code set.). -# -# If any of the above test failed, then the commit would be aborted. -# -# Actions such as mailing a copy of the report to each reviewer are -# better handled by an entry in the loginfo file. -# -# One thing that should be noted is the the ALL keyword is not -# supported. There can be only one entry that matches a given -# repository. diff --git a/CVSROOT/loginfo b/CVSROOT/loginfo deleted file mode 100644 index ce4dad5d7..000000000 --- a/CVSROOT/loginfo +++ /dev/null @@ -1,37 +0,0 @@ -# The "loginfo" file controls where "cvs commit" log information -# is sent. The first entry on a line is a regular expression which must match -# the directory that the change is being made to, relative to the -# $CVSROOT. If a match is found, then the remainder of the line is a filter -# program that should expect log information on its standard input. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name ALL appears as a regular expression it is always used -# in addition to the first matching regex or DEFAULT. -# -# You may specify a format string as part of the -# filter. The string is composed of a `%' followed -# by a single format character, or followed by a set of format -# characters surrounded by `{' and `}' as separators. The format -# characters are: -# -# s = file name -# V = old version number (pre-checkin) -# v = new version number (post-checkin) -# t = tag or branch name -# -# For example: -#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog -# or -#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog - -# This line sends all changes to the CVSROOT module to the user specified -# by USERNAME. It is recommended that someone be watching this module -# as it shouldn't need to be modified very often. -CVSROOT /cvsroot/sitedocs/CVSROOT/cvstools/syncmail %{sVv} redpony@gmail.com - -# This sends mail to a mailing list, defined by the PROJECTNAME-LISTNAME -# value. Any changes to any modules in the project will thus generate an -# email message to the mailing list specified. -DEFAULT /cvsroot/sitedocs/CVSROOT/cvstools/syncmail %{sVv} redpony@gmail.com,brooke@csail.mit.edu,callison-burch@ed.ac.uk,hieuhoang@gmail.com,corbett@csail.mit.edu diff --git a/CVSROOT/modules b/CVSROOT/modules deleted file mode 100644 index cb9e9efc9..000000000 --- a/CVSROOT/modules +++ /dev/null @@ -1,26 +0,0 @@ -# Three different line formats are valid: -# key -a aliases... -# key [options] directory -# key [options] directory files... -# -# Where "options" are composed of: -# -i prog Run "prog" on "cvs commit" from top-level of module. -# -o prog Run "prog" on "cvs checkout" of module. -# -e prog Run "prog" on "cvs export" of module. -# -t prog Run "prog" on "cvs rtag" of module. -# -u prog Run "prog" on "cvs update" of module. -# -d dir Place module in directory "dir" instead of module name. -# -l Top-level directory only -- do not recurse. -# -# NOTE: If you change any of the "Run" options above, you'll have to -# release and re-checkout any working directories of these modules. -# -# And "directory" is a path to a directory relative to $CVSROOT. -# -# The "-a" option specifies an alias. An alias is interpreted as if -# everything on the right of the "-a" had been typed on the command line. -# -# You can encode a module within a module by using the special '&' -# character to interpose another module into the current module. This -# can be useful for creating a module that consists of many directories -# spread out over the entire source repository. diff --git a/CVSROOT/notify b/CVSROOT/notify deleted file mode 100644 index 74ae6f9e9..000000000 --- a/CVSROOT/notify +++ /dev/null @@ -1,12 +0,0 @@ -# The "notify" file controls where notifications from watches set by -# "cvs watch add" or "cvs edit" are sent. The first entry on a line is -# a regular expression which is tested against the directory that the -# change is being made to, relative to the $CVSROOT. If it matches, -# then the remainder of the line is a filter program that should contain -# one occurrence of %s for the user to notify, and information on its -# standard input. -# -# "ALL" or "DEFAULT" can be used in place of the regular expression. -# -# For example: -#ALL mail -s "CVS notification" %s diff --git a/CVSROOT/rcsinfo b/CVSROOT/rcsinfo deleted file mode 100644 index 49e59f4d0..000000000 --- a/CVSROOT/rcsinfo +++ /dev/null @@ -1,13 +0,0 @@ -# The "rcsinfo" file is used to control templates with which the editor -# is invoked on commit and import. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being made to, relative to the -# $CVSROOT. For the first match that is found, then the remainder of the -# line is the name of the file that contains the template. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". diff --git a/CVSROOT/taginfo b/CVSROOT/taginfo deleted file mode 100644 index 274a46dd5..000000000 --- a/CVSROOT/taginfo +++ /dev/null @@ -1,20 +0,0 @@ -# The "taginfo" file is used to control pre-tag checks. -# The filter on the right is invoked with the following arguments: -# -# $1 -- tagname -# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d -# $3 -- repository -# $4-> file revision [file revision ...] -# -# A non-zero exit of the filter program will cause the tag to be aborted. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being committed to, relative -# to the $CVSROOT. For the first match that is found, then the remainder -# of the line is the name of the filter to run. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". diff --git a/CVSROOT/verifymsg b/CVSROOT/verifymsg deleted file mode 100644 index 86f747ce2..000000000 --- a/CVSROOT/verifymsg +++ /dev/null @@ -1,21 +0,0 @@ -# The "verifymsg" file is used to allow verification of logging -# information. It works best when a template (as specified in the -# rcsinfo file) is provided for the logging procedure. Given a -# template with locations for, a bug-id number, a list of people who -# reviewed the code before it can be checked in, and an external -# process to catalog the differences that were code reviewed, the -# following test can be applied to the code: -# -# Making sure that the entered bug-id number is correct. -# Validating that the code that was reviewed is indeed the code being -# checked in (using the bug-id number or a seperate review -# number to identify this particular code set.). -# -# If any of the above test failed, then the commit would be aborted. -# -# Actions such as mailing a copy of the report to each reviewer are -# better handled by an entry in the loginfo file. -# -# One thing that should be noted is the the ALL keyword is not -# supported. There can be only one entry that matches a given -# repository. diff --git a/irstlm/.cdtbuild b/irstlm/.cdtbuild deleted file mode 100644 index 5c8f99dd4..000000000 --- a/irstlm/.cdtbuild +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?fileVersion 3.0.0?> - -<ManagedProjectBuildInfo> -<project id="irstlm.cdt.managedbuild.target.gnu.lib.1070956508" name="Static Library (Gnu)" projectType="cdt.managedbuild.target.gnu.lib"> -<configuration artifactExtension="a" artifactName="irstlm" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.lib.debug.8750958" name="Debug" parent="cdt.managedbuild.config.gnu.lib.debug"> -<toolChain id="cdt.managedbuild.toolchain.gnu.lib.debug.1732402088" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.lib.debug"> -<tool id="cdt.managedbuild.tool.gnu.c.compiler.lib.debug.208381076" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.lib.debug"/> -<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.lib.debug.1534243185" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.lib.debug"> -<option id="gnu.cpp.compiler.option.debugging.gprof.1713594612" superClass="gnu.cpp.compiler.option.debugging.gprof" value="true" valueType="boolean"/> -</tool> -<tool id="cdt.managedbuild.tool.gnu.archiver.lib.debug.1727542516" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.lib.debug"/> -<tool id="cdt.managedbuild.tool.gnu.assembler.lib.debug.1884793796" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.lib.debug"/> -<macros/> -</toolChain> -</configuration> -<configuration artifactExtension="a" artifactName="irstlm" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.lib.release.1538178030" name="Release" parent="cdt.managedbuild.config.gnu.lib.release"> -<toolChain id="cdt.managedbuild.toolchain.gnu.lib.release.508823597" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.lib.release"> -<tool id="cdt.managedbuild.tool.gnu.c.compiler.lib.release.723647841" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.lib.release"/> -<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.lib.release.1586280207" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.lib.release"/> -<tool id="cdt.managedbuild.tool.gnu.archiver.lib.release.1518934657" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.lib.release"/> -<tool id="cdt.managedbuild.tool.gnu.assembler.lib.release.1672118671" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.lib.release"/> -<macros/> -</toolChain> -</configuration> -<configuration artifactExtension="a" artifactName="irstlm" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.lib.debug.1333974501" name="DebugNBest" parent="cdt.managedbuild.config.gnu.lib.debug"> -<toolChain id="cdt.managedbuild.toolchain.gnu.lib.debug.365917155" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.lib.debug"> -<tool id="cdt.managedbuild.tool.gnu.c.compiler.lib.debug.100325283" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.lib.debug"/> -<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.lib.debug.955425850" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.lib.debug"> -<option id="gnu.cpp.compiler.option.debugging.gprof.2034209861" superClass="gnu.cpp.compiler.option.debugging.gprof" value="true" valueType="boolean"/> -</tool> -<tool id="cdt.managedbuild.tool.gnu.archiver.lib.debug.370966026" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.lib.debug"/> -<tool id="cdt.managedbuild.tool.gnu.assembler.lib.debug.720742733" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.lib.debug"/> -<macros/> -</toolChain> -</configuration> -<configuration artifactExtension="a" artifactName="irstlm" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.lib.release.32089835" name="ReleaseNBest" parent="cdt.managedbuild.config.gnu.lib.release"> -<toolChain id="cdt.managedbuild.toolchain.gnu.lib.release.158080822" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.lib.release"> -<tool id="cdt.managedbuild.tool.gnu.c.compiler.lib.release.1803995257" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.lib.release"/> -<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.lib.release.152646939" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.lib.release"/> -<tool id="cdt.managedbuild.tool.gnu.archiver.lib.release.58978613" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.lib.release"/> -<tool id="cdt.managedbuild.tool.gnu.assembler.lib.release.2018125558" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.lib.release"/> -<macros/> -</toolChain> -</configuration> -</project> -</ManagedProjectBuildInfo> diff --git a/irstlm/.cdtproject b/irstlm/.cdtproject deleted file mode 100644 index 41c23c46b..000000000 --- a/irstlm/.cdtproject +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse-cdt version="2.0"?> - -<cdtproject id="org.eclipse.cdt.managedbuilder.core.managedMake"> -<extension id="org.eclipse.cdt.managedbuilder.core.ManagedBuildManager" point="org.eclipse.cdt.core.ScannerInfoProvider"/> -<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> -<extension id="org.eclipse.cdt.core.domsourceindexer" point="org.eclipse.cdt.core.CIndexer"/> -<data> -<item id="org.eclipse.cdt.core.pathentry"> -<pathentry kind="src" path=""/> -<pathentry kind="out" path=""/> -<pathentry kind="con" path="org.eclipse.cdt.managedbuilder.MANAGED_CONTAINER"/> -</item> -</data> -</cdtproject> diff --git a/irstlm/.cvsignore b/irstlm/.cvsignore deleted file mode 100644 index 9816a999f..000000000 --- a/irstlm/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Debug* -Release* diff --git a/irstlm/.project b/irstlm/.project deleted file mode 100644 index bb14e64fb..000000000 --- a/irstlm/.project +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>irstlm</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.cdt.core.cnature</nature> - <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> - <nature>org.eclipse.cdt.core.ccnature</nature> - </natures> -</projectDescription> diff --git a/irstlm/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/irstlm/.settings/org.eclipse.cdt.managedbuilder.core.prefs deleted file mode 100644 index d0951526a..000000000 --- a/irstlm/.settings/org.eclipse.cdt.managedbuilder.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -#Thu Jul 27 11:13:57 EDT 2006 -=\=\=\=\=\=\= -<<<<<<<=org.eclipse.cdt.managedbuilder.core.prefs ->>>>>>>=1.2 -eclipse.preferences.version=1 -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.lib.debug.1333974501=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.lib.debug.8750958=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.lib.release.1538178030=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.lib.release.32089835=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/project=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n -environment/project/cdt.managedbuild.config.gnu.lib.debug.1333974501=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n -environment/project/cdt.managedbuild.config.gnu.lib.debug.8750958=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n -environment/project/cdt.managedbuild.config.gnu.lib.release.1538178030=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n diff --git a/irstlm/Makefile.am b/irstlm/Makefile.am deleted file mode 100644 index 4566b2680..000000000 --- a/irstlm/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# not a GNU package. You can remove this line, if -# have all needed files, that a GNU package needs -AUTOMAKE_OPTIONS = foreign -SUBDIRS = src - diff --git a/irstlm/README b/irstlm/README deleted file mode 100644 index 17a9b920f..000000000 --- a/irstlm/README +++ /dev/null @@ -1,14 +0,0 @@ -To build: - - aclocal - autoconf - automake - - ./configure --with-prefix=PATH TO INSTALL (probably `pwd`) - make - make install - -*Make install is important since it creates the include/ and lib/ directories -that client software will depend on. - - diff --git a/irstlm/config.h.in b/irstlm/config.h.in deleted file mode 100644 index b292ea963..000000000 --- a/irstlm/config.h.in +++ /dev/null @@ -1,22 +0,0 @@ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Version number of package */ -#undef VERSION diff --git a/irstlm/configure.in b/irstlm/configure.in deleted file mode 100644 index c2ad8dda5..000000000 --- a/irstlm/configure.in +++ /dev/null @@ -1,11 +0,0 @@ -AC_INIT(src) - -AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(irstlm, 1.0) - -AC_PROG_CXX -AC_LANG_CPLUSPLUS -AC_PROG_RANLIB -#AM_PROG_LIBTOOL - -AC_OUTPUT(Makefile src/Makefile) diff --git a/irstlm/depcomp b/irstlm/depcomp deleted file mode 100755 index 11e2d3bfe..000000000 --- a/irstlm/depcomp +++ /dev/null @@ -1,522 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2004-05-31.23 - -# Copyright (C) 1999, 2000, 2003, 2004 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, 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 0 - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit 0 - ;; -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 - # Dependencies are output in .lo.d with libtool 1.4. - # With libtool 1.5 they are output both in $dir.libs/$base.o.d - # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the - # latter, because the former will be cleaned when $dir.libs is - # erased. - tmpdepfile1="$dir.libs/$base.lo.d" - tmpdepfile2="$dir$base.o.d" - tmpdepfile3="$dir.libs/$base.d" - "$@" -Wc,-MD - else - tmpdepfile1="$dir$base.o.d" - tmpdepfile2="$dir$base.d" - tmpdepfile3="$dir$base.d" - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - if test -f "$tmpdepfile1"; then - tmpdepfile="$tmpdepfile1" - elif test -f "$tmpdepfile2"; then - tmpdepfile="$tmpdepfile2" - else - tmpdepfile="$tmpdepfile3" - fi - 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 '/^# [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/irstlm/install-sh b/irstlm/install-sh deleted file mode 100755 index dd97db7aa..000000000 --- a/irstlm/install-sh +++ /dev/null @@ -1,322 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2004-09-10.20 - -# 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. It can only install one file at a time, a restriction -# shared with many OS's install programs. - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -chmodcmd="$chmodprog 0755" -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= -dstarg= -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: --c (ignored) --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. ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test -n "$1"; do - case $1 in - -c) shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit 0;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit 0;; - - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done - break;; - esac -done - -if test -z "$1"; 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 - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - src= - - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - 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 "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # 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: $dstarg: Is a directory" >&2 - exit 1 - fi - dst=$dst/`basename "$src"` - fi - fi - - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - IFS=$oIFS - - pathcomp= - - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 - shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit - fi - pathcomp=$pathcomp/ - done - fi - - if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - - else - dstfile=`basename "$dst"` - - # 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 - trap '(exit $?); exit' 1 2 13 15 - - # Copy the file name to the temp name. - $doit $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 "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 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. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit; } -done - -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit -} - -# 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/irstlm/irstlm.vcproj b/irstlm/irstlm.vcproj deleted file mode 100644 index 0ceb12191..000000000 --- a/irstlm/irstlm.vcproj +++ /dev/null @@ -1,347 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="irstlm"
- ProjectGUID="{19C023D8-67DE-4609-9C89-3152EF95995D}"
- RootNamespace="irstlm"
- Keyword="ManagedCProj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- ManagedExtensions="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- ManagedExtensions="0"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="DebugNBest|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- ManagedExtensions="0"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ReleaseNBest|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- ManagedExtensions="0"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- <AssemblyReference
- RelativePath="System.dll"
- AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
- />
- <AssemblyReference
- RelativePath="System.Data.dll"
- AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86"
- />
- <AssemblyReference
- RelativePath="System.XML.dll"
- AssemblyName="System.Xml, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
- />
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\src\cmd.c"
- >
- </File>
- <File
- RelativePath=".\src\dictionary.cpp"
- >
- </File>
- <File
- RelativePath=".\src\htable.cpp"
- >
- </File>
- <File
- RelativePath=".\src\lmtable.cpp"
- >
- </File>
- <File
- RelativePath=".\src\mempool.cpp"
- >
- </File>
- <File
- RelativePath=".\src\ngram.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\src\cmd.h"
- >
- </File>
- <File
- RelativePath=".\src\dictionary.h"
- >
- </File>
- <File
- RelativePath=".\src\htable.h"
- >
- </File>
- <File
- RelativePath=".\src\index.h"
- >
- </File>
- <File
- RelativePath=".\src\lmtable.h"
- >
- </File>
- <File
- RelativePath=".\src\mempool.h"
- >
- </File>
- <File
- RelativePath=".\src\ngram.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/irstlm/missing b/irstlm/missing deleted file mode 100755 index 64b5f901d..000000000 --- a/irstlm/missing +++ /dev/null @@ -1,353 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2004-09-07.08 - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004 -# 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 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, 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. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: - -# 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' - 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] - -Send bug reports to <bug-automake@gnu.org>." - exit 0 - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit 0 - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - -esac - -# 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). -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 "$1" 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 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` - 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 [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -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 [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -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 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - 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." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` - fi - 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/irstlm/src/Makefile.am b/irstlm/src/Makefile.am deleted file mode 100644 index ea26d6945..000000000 --- a/irstlm/src/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -lib_LIBRARIES = libirstlm.a - -libirstlm_a_SOURCES = \ - dictionary.cpp \ - htable.cpp \ - lmtable.cpp \ - mempool.cpp \ - ngram.cpp - -library_includedir=$(includedir) -library_include_HEADERS = dictionary.h lmtable.h ngram.h - -bin_PROGRAMS = compile-lm - -AM_LDFLAGS=-L . -LIBS=-lirstlm - -compile_lm_SOURCES = compile-lm.cpp - diff --git a/irstlm/src/cmd.c b/irstlm/src/cmd.c deleted file mode 100644 index aeb36d7b9..000000000 --- a/irstlm/src/cmd.c +++ /dev/null @@ -1,661 +0,0 @@ -/****************************************************************************** - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -******************************************************************************/ - -#include <stdio.h> -#include <stdlib.h> -#include <ctype.h> -#include <string.h> - -#include "cmd.h" - -static Enum_T BoolEnum[] = { - { "FALSE", 0 }, - { "TRUE", 1 }, - { 0, 0 } -}; - -#ifdef NEEDSTRDUP -char *strdup(); -#endif - -#define FALSE 0 -#define TRUE 1 - -#define LINSIZ 10240 -#define MAXPARAM 256 - -static char *GetLine(), - **str2array(); -static int Scan(), - SetParam(), - SetEnum(), - SetSubrange(), - SetStrArray(), - SetGte(), - SetLte(), - CmdError(), - EnumError(), - SubrangeError(), - GteError(), - LteError(), - PrintParam(), - PrintEnum(), - PrintStrArray(); - -static Cmd_T cmds[MAXPARAM+1]; -static char *SepString = " \t\n"; - -#if defined(__STDC__) -#include <stdarg.h> -int DeclareParams(char *ParName, ...) -#else -#include <varargs.h> -int DeclareParams(ParName, va_alist) -char *ParName; -va_dcl -#endif -{ - va_list args; - static int ParamN = 0; - int j, - c; - char *s; - -#if defined(__STDC__) - va_start(args, ParName); -#else - va_start(args); -#endif - for(;ParName;) { - if(ParamN==MAXPARAM) { - fprintf(stderr, "Too many parameters !!\n"); - break; - } - for(j=0,c=1; j<ParamN&&(c=strcmp(cmds[j].Name,ParName))<0; j++) - ; - if(!c) { - fprintf(stderr, - "Warning: parameter \"%s\" declared twice.\n", - ParName); - } - for(c=ParamN; c>j; c--) { - cmds[c] = cmds[c-1]; - } - cmds[j].Name = ParName; - cmds[j].Type = va_arg(args, int); - cmds[j].Val = va_arg(args, void *); - switch(cmds[j].Type) { - case CMDENUMTYPE: /* get the pointer to Enum_T struct */ - cmds[j].p = va_arg(args, void *); - break; - case CMDSUBRANGETYPE: /* get the two extremes */ - cmds[j].p = (void*) calloc(2, sizeof(int)); - ((int*)cmds[j].p)[0] = va_arg(args, int); - ((int*)cmds[j].p)[1] = va_arg(args, int); - break; - case CMDGTETYPE: /* get lower or upper bound */ - case CMDLTETYPE: - cmds[j].p = (void*) calloc(1, sizeof(int)); - ((int*)cmds[j].p)[0] = va_arg(args, int); - break; - case CMDSTRARRAYTYPE: /* get the separators string */ - cmds[j].p = (s=va_arg(args, char*)) - ? (void*)strdup(s) : 0; - break; - case CMDBOOLTYPE: - cmds[j].Type = CMDENUMTYPE; - cmds[j].p = BoolEnum; - break; - case CMDDOUBLETYPE: /* nothing else is needed */ - case CMDINTTYPE: - case CMDSTRINGTYPE: - break; - default: - fprintf(stderr, "%s: %s %d %s \"%s\"\n", - "DeclareParam()", "Unknown Type", - cmds[j].Type, "for parameter", cmds[j].Name); - exit(1); - } - ParamN++; - ParName = va_arg(args, char *); - } - cmds[ParamN].Name = NULL; - va_end(args); - return 0; -} - -int GetParams(n, a, CmdFileName) -int *n; -char ***a; -char *CmdFileName; -{ - char *Line, - *ProgName; - int argc = *n; - char **argv = *a, - *s; - FILE *fp; - int IsPipe; - -#ifdef MSDOS -#define PATHSEP '\\' - char *dot = NULL; -#else -#define PATHSEP '/' -#endif - - if(!(Line=malloc(LINSIZ))) { - fprintf(stderr, "GetParams(): Unable to alloc %d bytes\n", - LINSIZ); - exit(1); - } - if((ProgName=strrchr(*argv, PATHSEP))) { - ++ProgName; - } else { - ProgName = *argv; - } -#ifdef MSDOS - if(dot=strchr(ProgName, '.')) *dot = 0; -#endif - --argc; - ++argv; - for(;;) { - if(argc && argv[0][0]=='-' && argv[0][1]=='=') { - CmdFileName = argv[0]+2; - ++argv; - --argc; - } - if(!CmdFileName) { - break; - } - IsPipe = !strncmp(CmdFileName, "@@", 2); - fp = IsPipe - ? popen(CmdFileName+2, "r") - : strcmp(CmdFileName, "-") - ? fopen(CmdFileName, "r") - : stdin; - if(!fp) { - fprintf(stderr, "Unable to open command file %s\n", - CmdFileName); - exit(1); - } - while(GetLine(fp, LINSIZ, Line) && strcmp(Line, "\\End")) { - if(Scan(ProgName, cmds, Line)) { - CmdError(Line); - } - } - if(fp!=stdin) { - if(IsPipe) pclose(fp); else fclose(fp); - } - CmdFileName = NULL; - } - while(argc && **argv=='-' && (s=strchr(*argv, '='))) { - *s = ' '; - sprintf(Line, "%s/%s", ProgName, *argv+1); - *s = '='; - if(Scan(ProgName, cmds, Line)) CmdError(*argv); - --argc; - ++argv; - } - *n = argc; - *a = argv; -#ifdef MSDOS - if(dot) *dot = '.'; -#endif - free(Line); - return 0; -} - -int PrintParams(ValFlag, fp) -int ValFlag; -FILE *fp; -{ - int i; - - fflush(fp); - if(ValFlag) { - fprintf(fp, "Parameters Values:\n"); - } else { - fprintf(fp, "Parameters:\n"); - } - for(i=0; cmds[i].Name; i++) PrintParam(cmds+i, ValFlag, fp); - fprintf(fp, "\n"); - fflush(fp); - return 0; -} - -int SPrintParams(a, pfx) -char ***a, - *pfx; -{ - int l, - n; - Cmd_T *cmd; - - if(!pfx) pfx=""; - l = strlen(pfx); - for(n=0, cmd=cmds; cmd->Name; cmd++) n += !!cmd->ArgStr; - a[0] = calloc(n, sizeof(char*)); - for(n=0, cmd=cmds; cmd->Name; cmd++) { - if(!cmd->ArgStr) continue; - a[0][n] = malloc(strlen(cmd->Name)+strlen(cmd->ArgStr)+l+2); - sprintf(a[0][n], "%s%s=%s", pfx, cmd->Name, cmd->ArgStr); - ++n; - } - return n; -} - -static int CmdError(opt) -char *opt; -{ - fprintf(stderr, "Invalid option \"%s\"\n", opt); - fprintf(stderr, "This program expectes the following parameters:\n"); - PrintParams(FALSE, stderr); - exit(0); -} - -static int PrintParam(cmd, ValFlag, fp) -Cmd_T *cmd; -int ValFlag; -FILE *fp; -{ - fprintf(fp, "%4s", ""); - switch(cmd->Type) { - case CMDDOUBLETYPE: - fprintf(fp, "%s", cmd->Name); - if(ValFlag) fprintf(fp, ": %22.15e", *(double *)cmd->Val); - fprintf(fp, "\n"); - break; - case CMDENUMTYPE: - PrintEnum(cmd, ValFlag, fp); - break; - case CMDINTTYPE: - case CMDSUBRANGETYPE: - case CMDGTETYPE: - case CMDLTETYPE: - fprintf(fp, "%s", cmd->Name); - if(ValFlag) fprintf(fp, ": %d", *(int *)cmd->Val); - fprintf(fp, "\n"); - break; - case CMDSTRINGTYPE: - fprintf(fp, "%s", cmd->Name); - if(ValFlag) { - if(*(char **)cmd->Val) { - fprintf(fp, ": \"%s\"", *(char **)cmd->Val); - } else { - fprintf(fp, ": %s", "NULL"); - } - } - fprintf(fp, "\n"); - break; - case CMDSTRARRAYTYPE: - PrintStrArray(cmd, ValFlag, fp); - break; - default: - fprintf(stderr, "%s: %s %d %s \"%s\"\n", - "PrintParam", - "Unknown Type", - cmd->Type, - "for parameter", - cmd->Name); - exit(1); - } - return 0; -} - -static char *GetLine(fp, n, Line) -FILE *fp; -int n; -char *Line; -{ - int j, - l, - offs=0; - - for(;;) { - if(!fgets(Line+offs, n-offs, fp)) { - return NULL; - } - if(Line[offs]=='#') continue; - l = strlen(Line+offs)-1; - Line[offs+l] = 0; - for(j=offs; Line[j] && isspace(Line[j]); j++, l--) - ; - if(l<1) continue; - if(j > offs) { - char *s = Line+offs, - *q = Line+j; - - while((*s++=*q++)) - ; - } - if(Line[offs+l-1]=='\\') { - offs += l; - Line[offs-1] = ' '; - } else { - break; - } - } - return Line; -} - -static int Scan(ProgName, cmds, Line) -char *ProgName, - *Line; -Cmd_T *cmds; -{ - char *q, - *p; - int i, - hl, - HasToMatch = FALSE, - c0, - c; - - p = Line+strspn(Line, SepString); - if(!(hl=strcspn(p, SepString))) { - return 0; - } - if((q=strchr(p, '/')) && q-p<hl) { - *q = 0; - if(strcmp(p, ProgName)) { - *q = '/'; - return 0; - } - *q = '/'; - HasToMatch=TRUE; - p = q+1; - } - if(!(hl = strcspn(p, SepString))) { - return 0; - } - c0 = p[hl]; - p[hl] = 0; - for(i=0, c=1; cmds[i].Name&&(c=strcmp(cmds[i].Name, p))<0; i++) - ; - p[hl] = c0; - if(!c) return SetParam(cmds+i, p+hl+strspn(p+hl, SepString)); - return HasToMatch && c; -} - -static int SetParam(cmd, s) -Cmd_T *cmd; -char *s; -{ - if(!*s && cmd->Type != CMDSTRINGTYPE) { - fprintf(stderr, - "WARNING: No value specified for parameter \"%s\"\n", - cmd->Name); - return 0; - } - switch(cmd->Type) { - case CMDDOUBLETYPE: - if(sscanf(s, "%lf", (double*)cmd->Val)!=1) { - fprintf(stderr, - "Float value required for parameter \"%s\"\n", - cmd->Name); - exit(1); - } - break; - case CMDENUMTYPE: - SetEnum(cmd, s); - break; - case CMDINTTYPE: - if(sscanf(s, "%d", (int*)cmd->Val)!=1) { - fprintf(stderr, - "Integer value required for parameter \"%s\"\n", - cmd->Name); - exit(1); - } - break; - case CMDSTRINGTYPE: - *(char **)cmd->Val = (strcmp(s, "<NULL>") && strcmp(s, "NULL")) - ? strdup(s) - : 0; - break; - case CMDSTRARRAYTYPE: - SetStrArray(cmd, s); - break; - case CMDGTETYPE: - SetGte(cmd, s); - break; - case CMDLTETYPE: - SetLte(cmd, s); - break; - case CMDSUBRANGETYPE: - SetSubrange(cmd, s); - break; - default: - fprintf(stderr, "%s: %s %d %s \"%s\"\n", - "SetParam", - "Unknown Type", - cmd->Type, - "for parameter", - cmd->Name); - exit(1); - } - cmd->ArgStr = strdup(s); - return 0; -} - -static int SetEnum(cmd, s) -Cmd_T *cmd; -char *s; -{ - Enum_T *en; - - for(en=(Enum_T *)cmd->p; en->Name; en++) { - if(*en->Name && !strcmp(s, en->Name)) { - *(int *) cmd->Val = en->Idx; - return 0; - } - } - return EnumError(cmd, s); -} - -static int SetSubrange(cmd, s) -Cmd_T *cmd; -char *s; -{ - int n; - - if(sscanf(s, "%d", &n)!=1) { - fprintf(stderr, - "Integer value required for parameter \"%s\"\n", - cmd->Name); - exit(1); - } - if(n < *(int *)cmd->p || n > *((int *)cmd->p+1)) { - return SubrangeError(cmd, n); - } - *(int *)cmd->Val = n; - return 0; -} - -static int SetGte(cmd, s) -Cmd_T *cmd; -char *s; -{ - int n; - - if(sscanf(s, "%d", &n)!=1) { - fprintf(stderr, - "Integer value required for parameter \"%s\"\n", - cmd->Name); - exit(1); - } - if(n<*(int *)cmd->p) { - return GteError(cmd, n); - } - *(int *)cmd->Val = n; - return 0; -} - -static int SetStrArray(cmd, s) -Cmd_T *cmd; -char *s; -{ - *(char***)cmd->Val = str2array(s, (char*)cmd->p); - return 0; -} - -static int SetLte(cmd, s) -Cmd_T *cmd; -char *s; -{ - int n; - - if(sscanf(s, "%d", &n)!=1) { - fprintf(stderr, - "Integer value required for parameter \"%s\"\n", - cmd->Name); - exit(1); - } - if(n > *(int *)cmd->p) { - return LteError(cmd, n); - } - *(int *)cmd->Val = n; - return 0; -} - -static int EnumError(cmd, s) -Cmd_T *cmd; -char *s; -{ - Enum_T *en; - - fprintf(stderr, - "Invalid value \"%s\" for parameter \"%s\"\n", s, cmd->Name); - fprintf(stderr, "Valid values are:\n"); - for(en=(Enum_T *)cmd->p; en->Name; en++) { - if(*en->Name) { - fprintf(stderr, " %s\n", en->Name); - } - } - fprintf(stderr, "\n"); - exit(1); -} - -static int GteError(cmd, n) -Cmd_T *cmd; -int n; -{ - fprintf(stderr, - "Value %d out of range for parameter \"%s\"\n", n, cmd->Name); - fprintf(stderr, "Valid values must be greater than or equal to %d\n", - *(int *)cmd->p); - exit(1); -} - -static int LteError(cmd, n) -Cmd_T *cmd; -int n; -{ - fprintf(stderr, - "Value %d out of range for parameter \"%s\"\n", n, cmd->Name); - fprintf(stderr, "Valid values must be less than or equal to %d\n", - *(int *)cmd->p); - exit(1); -} - -static int SubrangeError(cmd, n) -Cmd_T *cmd; -int n; -{ - fprintf(stderr, - "Value %d out of range for parameter \"%s\"\n", n, cmd->Name); - fprintf(stderr, "Valid values range from %d to %d\n", - *(int *)cmd->p, *((int *)cmd->p+1)); - exit(1); -} - -static int PrintEnum(cmd, ValFlag, fp) -Cmd_T *cmd; -int ValFlag; -FILE *fp; -{ - Enum_T *en; - - fprintf(fp, "%s", cmd->Name); - if(ValFlag) { - for(en=(Enum_T *)cmd->p; en->Name; en++) { - if(*en->Name && en->Idx==*(int *)cmd->Val) { - fprintf(fp, ": %s", en->Name); - } - } - } - fprintf(fp, "\n"); - return 0; -} - -static int PrintStrArray(cmd, ValFlag, fp) -Cmd_T *cmd; -int ValFlag; -FILE *fp; -{ - char *indent, - **s = *(char***)cmd->Val; - int l = 4+strlen(cmd->Name); - - fprintf(fp, "%s", cmd->Name); - indent = malloc(l+2); - memset(indent, ' ', l+1); - indent[l+1] = 0; - if(ValFlag) { - fprintf(fp, ": %s", s ? (*s ? *s++ : "NULL") : ""); - if(s) while(*s) { - fprintf(fp, "\n%s %s", indent, *s++); - } - } - free(indent); - fprintf(fp, "\n"); - return 0; -} - -static char **str2array(s, sep) -char *s, - *sep; -{ - char *p, - **a; - int n = 0, - l; - - if(!sep) sep = SepString; - p = s += strspn(s, sep); - while(*p) { - p += strcspn(p, sep); - p += strspn(p, sep); - ++n; - } - a = calloc(n+1, sizeof(char *)); - p = s; - n = 0; - while(*p) { - l = strcspn(p, sep); - a[n] = malloc(l+1); - memcpy(a[n], p, l); - a[n][l] = 0; - ++n; - p += l; - p += strspn(p, sep); - } - return a; -} diff --git a/irstlm/src/cmd.h b/irstlm/src/cmd.h deleted file mode 100644 index 708905f6f..000000000 --- a/irstlm/src/cmd.h +++ /dev/null @@ -1,68 +0,0 @@ -/****************************************************************************** - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -******************************************************************************/ - -#if !defined(CMD_H) - -#define CMD_H - -#define CMDDOUBLETYPE 1 -#define CMDENUMTYPE 2 -#define CMDINTTYPE 3 -#define CMDSTRINGTYPE 4 -#define CMDSUBRANGETYPE 5 -#define CMDGTETYPE 6 -#define CMDLTETYPE 7 -#define CMDSTRARRAYTYPE 8 -#define CMDBOOLTYPE 9 - -typedef struct { - char *Name; - int Idx; -} Enum_T; - -typedef struct { - int Type; - char *Name, - *ArgStr; - void *Val, - *p; -} Cmd_T; - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(__STDC__) -int DeclareParams(char *, ...); -#else -int DeclareParams(); -#endif - -int GetParams(int *n, char ***a,char *CmdFileName), - SPrintParams(), - PrintParams(); - -#ifdef __cplusplus -} -#endif -#endif - - - diff --git a/irstlm/src/compile-lm.cpp b/irstlm/src/compile-lm.cpp deleted file mode 100644 index 17c152fcf..000000000 --- a/irstlm/src/compile-lm.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/****************************************************************************** - IrstLM: IRST Language Model Toolkit, compile LM - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -******************************************************************************/ - - -#include <iostream> -#include <fstream> -#include <vector> -#include <string> -#include <stdlib.h> - -#include "lmtable.h" - - -/* GLOBAL OPTIONS ***************/ -std::string sn = "0"; -std::string sres = "0"; -std::string sdecay = "0.95"; -/********************************/ - -void usage(const char *msg = 0) { - if (msg) { std::cerr << msg << std::endl; } - std::cerr << "Usage: compile-lm [options] input-file.lm [output-file.blm]" << std::endl; - if (!msg) std::cerr << std::endl - << " compile-lm reads a standard LM file in ARPA format and produces" << std::endl - << " a compiled representation that the IRST LM toolkit can quickly" << std::endl - << " read and process." << std::endl << std::endl; - std::cerr << "Options:\n -r=RESOLUTION\n -d=DECAY\n -n=NGRAM SIZE <required>\n\n"; -} - -bool starts_with(const std::string &s, const std::string &pre) { - if (pre.size() > s.size()) return false; - - if (pre == s) return true; - std::string pre_equals(pre+'='); - if (pre_equals.size() > s.size()) return false; - return (s.substr(0,pre_equals.size()) == pre_equals); -} - -std::string get_param(const std::string& opt, int argc, const char **argv, int& argi) -{ - std::string::size_type equals = opt.find_first_of('='); - if (equals != std::string::npos && equals < opt.size()-1) { - return opt.substr(equals+1); - } - std::string nexto; - if (argi + 1 < argc) { - nexto = argv[++argi]; - } else { - usage((opt + " requires a value!").c_str()); - exit(1); - } - return nexto; -} - -void handle_option(const std::string& opt, int argc, const char **argv, int& argi) -{ - if (opt == "--help" || opt == "-h") { usage(); exit(1); } - if (starts_with(opt, "--resolution") || starts_with(opt, "-r")) - sres = get_param(opt, argc, argv, argi); - else if (starts_with(opt, "--decay") || starts_with(opt, "-d")) - sdecay = get_param(opt, argc, argv, argi); - else if (starts_with(opt, "--ngram-size") || starts_with(opt, "-n")) - sn = get_param(opt, argc, argv, argi); - else { - usage(("Don't understand option " + opt).c_str()); - exit(1); - } -} - -int main(int argc, const char **argv) -{ - if (argc < 2) { usage(); exit(1); } - std::vector<std::string> files; - for (int i=1; i < argc; i++) { - std::string opt = argv[i]; - if (opt[0] == '-') { handle_option(opt, argc, argv, i); } - else files.push_back(opt); - } - if (files.size() > 2) { usage("Too many arguments"); exit(1); } - if (files.size() < 1) { usage("Please specify a LM file to read from"); exit(1); } - double decay = strtod(sdecay.c_str(),0); - int resolution = strtol(sres.c_str(),0,10); - int ngram_size = strtol(sn.c_str(),0,10); - if (ngram_size < 1) { usage("Please specify an ngram size greater than or equal 1 with -n"); exit(1); } - std::string infile = files[0]; - if (files.size() == 1) { - std::string::size_type p = infile.rfind('/'); - if (p != std::string::npos && ((p+1) < infile.size())) { - files.push_back(infile.substr(p+1) + ".blm"); - } else { - files.push_back(infile + ".blm"); - } - } - std::string outfile = files[1]; - std::cout << "Using decay=" << decay << ", resolution=" << resolution << std::endl; - std::cout << "Reading " << infile << "..." << std::endl; - std::ifstream inp(infile.c_str()); - if (!inp.good()) { - std::cerr << "Failed to open " << infile << "!\n"; - exit(1); - } - lmtable lmt(inp); - std::cout << "Saving to " << outfile << std::endl; - lmt.savebin(outfile.c_str()); - return 0; -} - diff --git a/irstlm/src/dictionary.cpp b/irstlm/src/dictionary.cpp deleted file mode 100644 index ab53116a2..000000000 --- a/irstlm/src/dictionary.cpp +++ /dev/null @@ -1,418 +0,0 @@ -/****************************************************************************** - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -******************************************************************************/ - -#include <iomanip> -#include <iostream> -#include <fstream> -#include "mempool.h" -#include "htable.h" -#include "dictionary.h" -#include "index.h" - -using namespace std; - -dictionary::dictionary(char *filename,int size,char* isymb,char* oovlexfile){ - - // unitialized memory - if (oovlexfile!=NULL) - oovlex=new dictionary(oovlexfile,size,isymb,NULL); - else - oovlex=(dictionary *)NULL; - - htb = new htable(size/LOAD_FACTOR); - tb = new dict_entry[size]; - st = new strstack(size * 10); - - for (int i=0;i<size;i++) tb[i].freq=0; - - is=(char*) NULL; - intsymb(isymb); - - oov_code = -1; - in_oov_lex=0; - n = 0; - N = 0; - dubv = 0; - lim = size; - ifl=0; //increment flag - - if (filename==NULL) return; - - std::ifstream inp(filename,ios::in); - - if (!inp){ - cerr << "cannot open " << filename << "\n"; - exit(1); - } - - char buffer[100]; - - inp >> setw(100) >> buffer; - - inp.close(); - - if ((strncmp(buffer,"dict",4)==0) || - (strncmp(buffer,"DICT",4)==0)) - load(filename); - else - generate(filename); - - cerr << "loaded \n"; - - -} - - - -void dictionary::generate(char *filename){ - - char buffer[MAX_WORD]; - int k; - - ifstream inp(filename,ios::in); - - if (!inp){ - cerr << "cannot open " << filename << "\n"; - exit(1); - } - - cerr << "dict:"; - - ifl=1; k=0; - while (inp >> setw(MAX_WORD) >> buffer){ - - if (strlen(buffer)==(MAX_WORD-1)){ - cerr << "dictionary: a too long word was read (" - << buffer << ")\n"; - }; - - - if (strlen(buffer)==0){ - cerr << "zero lenght word!\n"; - continue; - } - - //if (is && (strlen(buffer)==1) && !index(is,buffer[0])) - if (is && (strlen(buffer)==1) && (index(is,buffer[0])!=NULL)) - continue; //skip over the interruption symbol - - incfreq(encode(buffer),1); - - if (!(++k % 1000000)) cerr << "."; - } - ifl=0; - cerr << "\n"; - - inp.close(); - -} - -void dictionary::load(char* filename){ - char header[100]; - char buffer[MAX_WORD]; - char *addr; - int freqflag=0; - - ifstream inp(filename,ios::in); - - if (!inp){ - cerr << "\ncannot open " << filename << "\n"; - exit(1); - } - - cerr << "dict:"; - - inp.getline(header,100); - if (strncmp(header,"DICT",4)==0) - freqflag=1; - else - if (strncmp(header,"dict",4)!=0){ - cerr << "\ndictionary file " << filename << " has a wrong header\n"; - exit(1); - } - - - while (inp >> setw(MAX_WORD) >> buffer){ - - if (strlen(buffer)==(MAX_WORD-1)){ - cerr << "\ndictionary: a too long word was read (" - << buffer << ")\n"; - }; - - tb[n].word=st->push(buffer); - tb[n].code=n; - - if (freqflag) - inp >> tb[n].freq; - else - tb[n].freq=0; - - if ((addr=htb->search((char *)&tb[n].word,HT_ENTER))) - if (addr!=(char *)&tb[n].word){ - cerr << "dictionary::loadtxt wrong entry was found (" - << buffer << ") in position " << n << "\n"; - exit(1); - } - - N+=tb[n].freq; - - if (strcmp(buffer,OOV())==0) oov_code=n; - - if (++n==lim) grow(); - - } - - inp.close(); -} - - -void dictionary::load(std::istream& inp){ - - char buffer[MAX_WORD]; - char *addr; - int size; - - inp >> size; - - for (int i=0;i<size;i++){ - - inp >> buffer; - - tb[n].word=st->push(buffer); - tb[n].code=n; - inp >> tb[n].freq; - N+=tb[n].freq; - - if ((addr=htb->search((char *)&tb[n].word,HT_ENTER))) - if (addr!=(char *)&tb[n].word){ - cerr << "dictionary::loadtxt wrong entry was found (" - << buffer << ") in position " << n << "\n"; - exit(1); - } - - if (strcmp(tb[n].word,OOV())==0) - oov_code=n; - - if (++n==lim) grow(); - } - inp.getline(buffer,MAX_WORD-1); -} - -void dictionary::save(std::ostream& out){ - out << n << "\n"; - for (int i=0;i<n;i++) - out << tb[i].word << " " << tb[i].freq << "\n"; -} - - -int cmpdictentry(const void *a,const void *b){ - dict_entry *ae=(dict_entry *)a; - dict_entry *be=(dict_entry *)b; - return be->freq-ae->freq; -} - -dictionary::dictionary(dictionary* d){ - - //transfer values - - n=d->n; //total entries - N=d->N; //total frequency - lim=d->lim; //limit of entries - oov_code=-1; //code od oov must be re-defined - ifl=0; //increment flag=0; - dubv=d->dubv; //dictionary upperbound transferred - in_oov_lex=0; //does not copy oovlex; - - - //creates a sorted copy of the table - - tb = new dict_entry[lim]; - htb = new htable(lim/LOAD_FACTOR); - st = new strstack(lim * 10); - - for (int i=0;i<n;i++){ - tb[i].code=d->tb[i].code; - tb[i].freq=d->tb[i].freq; - tb[i].word=st->push(d->tb[i].word); - } - - //sort all entries according to frequency - cerr << "sorting dictionary ..."; - qsort(tb,n,sizeof(dict_entry),cmpdictentry); - cerr << "done\n"; - - for (int i=0;i<n;i++){ - - //eventually re-assign oov code - if (d->oov_code==tb[i].code) oov_code=i; - - tb[i].code=i; - htb->search((char *)&tb[i].word,HT_ENTER); - }; - -} - - - -dictionary::~dictionary(){ - delete htb; - delete st; - delete [] tb; -} - -void dictionary::stat(){ - cout << "dictionary class statistics\n"; - cout << "size " << n - << " used memory " - << (lim * sizeof(int) + - htb->used() + - st->used())/1024 << " Kb\n"; -} - -void dictionary::grow(){ - - delete htb; - - cerr << "+\b"; - - dict_entry *tb2=new dict_entry[lim+GROWTH_STEP]; - - memcpy(tb2,tb,sizeof(dict_entry) * lim ); - - delete [] tb; tb=tb2; - - htb=new htable((lim+GROWTH_STEP)/LOAD_FACTOR); - - for (int i=0;i<lim;i++) - - htb->search((char *)&tb[i].word,HT_ENTER); - - for (int i=lim;i<lim+GROWTH_STEP;i++) tb[i].freq=0; - - lim+=GROWTH_STEP; - - -} - -void dictionary::save(char *filename,int freqflag){ - - std::ofstream out(filename,ios::out); - - if (!out){ - cerr << "cannot open " << filename << "\n"; - } - - // header - if (freqflag) - out << "DICTIONARY 0 " << n << "\n"; - else - out << "dictionary 0 " << n << "\n"; - - for (int i=0;i<n;i++){ - out << tb[i].word; - if (freqflag) - out << " " << tb[i].freq; - out << "\n"; - } - - out.close(); -} - - -int dictionary::getcode(const char *w){ - dict_entry* ptr=(dict_entry *)htb->search((char *)&w,HT_FIND); - if (ptr==NULL) return -1; - return ptr->code; -} - -int dictionary::encode(const char *w){ - - //case of strange characters - if (strlen(w)==0){cerr << "0";w=OOV();} - - dict_entry* ptr; - - if ((ptr=(dict_entry *)htb->search((char *)&w,HT_FIND))!=NULL) - return ptr->code; - else{ - if (!ifl){ //do not extend dictionary - if (oov_code==-1){ //did not use OOV yet - cerr << "starting to use OOV words [" << w << "]\n"; - tb[n].word=st->push(OOV()); - htb->search((char *)&tb[n].word,HT_ENTER); - tb[n].code=n; - tb[n].freq=0; - oov_code=n; - if (++n==lim) grow(); - } - //if there is an oov lexicon, check if this word belongs to - dict_entry* oovptr; - if (oovlex){ - if ((oovptr=(dict_entry *)oovlex->htb->search((char *)&w,HT_FIND))!=NULL){ - in_oov_lex=1; - oov_lex_code=oovptr->code; - }else - in_oov_lex=0; - } - return encode(OOV()); - } - else{ //extend dictionary - tb[n].word=st->push((char *)w); - htb->search((char *)&tb[n].word,HT_ENTER); - tb[n].code=n; - tb[n].freq=0; - if (++n==lim) grow(); - return n-1; - } - } -} - - -char *dictionary::decode(int c){ - if (c>=0 && c < n) - return tb[c].word; - else{ - cerr << "decode: code out of boundary\n"; - return OOV(); - } -} - - -dictionary_iter::dictionary_iter(dictionary *dict) : m_dict(dict) { - m_dict->htb->scan(HT_INIT); -} - -dict_entry* dictionary_iter::next() { - return (dict_entry*)m_dict->htb->scan(HT_CONT); -} - - - - - -/* -main(int argc,char **argv){ - dictionary d(argv[1],40000); - d.stat(); - cout << "ROMA" << d.decode(0) << "\n"; - cout << "ROMA:" << d.encode("ROMA") << "\n"; - d.save(argv[2]); -} -*/ diff --git a/irstlm/src/dictionary.h b/irstlm/src/dictionary.h deleted file mode 100644 index 494b240d2..000000000 --- a/irstlm/src/dictionary.h +++ /dev/null @@ -1,209 +0,0 @@ -/****************************************************************************** - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -******************************************************************************/ - -/* - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MF_DICTIONARY_H -#define MF_DICTIONARY_H - -#include <string.h> -#include <iostream> - -#define MAX_WORD 100 -#define LOAD_FACTOR 5 - -#ifndef GROWTH_STEP -#define GROWTH_STEP 100000 -#endif - -#ifndef DICT_INITSIZE -#define DICT_INITSIZE 100000 -#endif - - -//Begin of sentence symbol -#ifndef BOS_ -#define BOS_ "<s>" -#endif - - -//End of sentence symbol -#ifndef EOS_ -#define EOS_ "</s>" -#endif - -//End of sentence symbol -#ifndef OOV_ -#define OOV_ "_unk_" -#endif - - -typedef struct{ - char *word; - int code; - int freq; -}dict_entry; - -class strstack; -class htable; - -class dictionary{ - strstack *st; //!< stack of strings - dict_entry *tb; //!< entry table - htable *htb; //!< hash table - int n; //!< number of entries - int N; //!< total frequency - int lim; //!< limit of entries - int oov_code; //!< code assigned to oov words - char* is; //!< interruption symbol list - char ifl; //!< increment flag - int dubv; //!< dictionary size upper bound - int in_oov_lex; //!< flag - int oov_lex_code; //< dictionary - char* oov_str; //!< oov string - - public: - - friend class dictionary_iter; - - dictionary* oovlex; //<! additional dictionary - - inline int dub(){return dubv;} - inline int dub(int value){return (dubv=value);} - - inline char *OOV(){return (OOV_);} - inline char *BoS(){return (BOS_);} - inline char *EoS(){return (EOS_);} - - inline int oovcode(int v=-1){return oov_code=(v>=0?v:oov_code);} - - inline char *intsymb(char* isymb=NULL){ - if (isymb==NULL) return is; - if (is!=NULL) delete [] is; - is=new char[strlen(isymb+1)]; - strcpy(is,isymb); - return is=isymb; - } - - inline int incflag(){return ifl;} - inline int incflag(int v){return ifl=v;} - inline int oovlexsize(){return oovlex?oovlex->n:0;} - inline int inoovlex(){return in_oov_lex;} - inline int oovlexcode(){return oov_lex_code;} - - - int isprintable(char* w){ - char buffer[MAX_WORD]; - sprintf(buffer,"%s",w); - return strcmp(w,buffer)==0; - } - - inline void genoovcode(){ - int c=encode(OOV()); - std::cerr << "OOV code is "<< c << std::endl; - oovcode(c); - } - - inline dictionary* oovlexp(char *fname=NULL){ - if (fname==NULL) return oovlex; - if (oovlex!=NULL) delete oovlex; - oovlex=new dictionary(fname,DICT_INITSIZE); - return oovlex; - } - - inline int setoovrate(double oovrate){ - encode(OOV()); //be sure OOV code exists - int oovfreq=(int)(oovrate * totfreq()); - std::cerr << "setting OOV rate to: " << oovrate << " -- freq= " << oovfreq << std::endl; - return freq(oovcode(),oovfreq); - - return 1; - } - - - inline int incfreq(int code,int value){N+=value;return tb[code].freq+=value;} - - inline int multfreq(int code,double value){ - N+=(int)(value * tb[code].freq)-tb[code].freq; - return tb[code].freq=(int)(value * tb[code].freq); - } - - inline int freq(int code,int value=-1){ - if (value>=0){ - N+=value-tb[code].freq; - tb[code].freq=value; - } - return tb[code].freq; - } - - inline int totfreq(){return N;} - - void grow(); - //dictionary(int size=400,char* isym=NULL,char* oovlex=NULL); - dictionary(char *filename=NULL,int size=DICT_INITSIZE,char* isymb=NULL,char* oovlex=NULL); - dictionary(dictionary* d); - - ~dictionary(); - void generate(char *filename); - void load(char *filename); - void save(char *filename,int freqflag=0); - void load(std::istream& fd); - void save(std::ostream& fd); - - int size(){return n;}; - int getcode(const char *w); - int encode(const char *w); - char *decode(int c); - void stat(); - - void cleanfreq(){ - for (int i=0;i<n;tb[i++].freq=0); - N=0; - } - -}; - -class dictionary_iter { - public: - dictionary_iter(dictionary *dict); - dict_entry* next(); - private: - dictionary* m_dict; -}; - -#endif - diff --git a/irstlm/src/htable.cpp b/irstlm/src/htable.cpp deleted file mode 100644 index 1f56723a2..000000000 --- a/irstlm/src/htable.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/****************************************************************************** - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -******************************************************************************/ - -#include <iostream> -#include <assert.h> -#include "mempool.h" -#include "htable.h" - -using namespace std; - -htable::htable(int n,int kl,HTYPE ht,size_t (*klf)(const char* )){ - - memory=new mempool( sizeof(entry) , BlockSize ); - - table = new entry* [ size=n ]; - - memset(table,0,sizeof(entry *) * n ); - - keylen=kl; - - htype=ht; - - keys = accesses = collisions = 0; - - keylenfunc=(klf?klf:&strlen); - -} - - -char *htable::search(char *item, HT_ACTION action) - -{ - address h; - entry *q,**p; - int i; - - //if (action == HT_FIND) - accesses++; - - h = Hash(item); - - i=(h % size); - - p = &table[h % size]; - - q=*p; - - /* - ** Follow collision chain - */ - - while (q != NULL && Comp((char *)q->key,(char *)item)) - { - p = (entry **)&q->next; - q=*p; - //if (action == HT_FIND) - collisions++; - } - - if ( - q != NULL /* found */ - || - action == HT_FIND /* not found, search only */ - || - (q = (entry *)memory->alloc()) - == - NULL /* not found, no room */ - ) - - return((q!=NULL)?(char *)q->key:(char *)NULL); - - *p = q; /* link into chain */ - /* - ** Initialize new element - */ - - q->key = item; - q->next = NULL; - keys++; - - return((char *)q->key); -} - - -char *htable::scan(HT_ACTION action){ - - char *k; - - if (action == HT_INIT) - { - scan_i=0;scan_p=table[0]; - return NULL; - } - - // if scan_p==NULL go to the first non null pointer - while ((scan_p==NULL) && (++scan_i<size)) scan_p=table[scan_i]; - - if (scan_p!=NULL) - { - k=scan_p->key; - scan_p=(entry *)scan_p->next; - return k; - }; - - return NULL; -} - - -void htable::map(ostream& co,int cols){ - - entry *p; - char* img=new char[cols+1]; - - img[cols]='\0'; - memset(img,'.',cols); - - co << "htable memory map: . (0 items), - (<5), # (>5)\n"; - - for (int i=0; i<size;i++) - { - int n=0;p=table[i]; - - while(p!=NULL){ - n++; - p=(entry *)p->next; - }; - - if (i && (i % cols)==0){ - co << img << "\n"; - memset(img,'.',cols); - } - - if (n>0) - img[i % cols]=n<=5?'-':'#'; - - } - - img[size % cols]='\0'; - co << img << "\n"; - - delete []img; -} - - -void htable::stat(){ - cout << "htable class statistics\n"; - cout << "size " << size - << " keys " << keys - << " acc " << accesses - << " coll " << collisions - << " used memory " << used()/1024 << "Kb\n"; -} - -htable::~htable() -{ - delete [] table; - delete memory; -} - -address htable::Hash(char *key) -{ - char *Key=(htype==STRPTR? *(char **)key:key); - int length=(keylen?keylen:keylenfunc(Key)); - - //cerr << "hash: " << Key << " length:" << length << "\n"; - - register address h=0; - register int i; - - for (i=0,h=0;i<length;i++) - h = h * Prime1 ^ (Key[i] - ' '); - h %= Prime2; - - return h; -} - - -int htable::Comp(char *key1, char *key2) -{ - assert(key1 && key2); - - char *Key1=(htype==STRPTR?*(char **)key1:key1); - char *Key2=(htype==STRPTR?*(char **)key2:key2); - - assert(Key1 && Key2); - - int length1=(keylen?keylen:keylenfunc(Key1)); - int length2=(keylen?keylen:keylenfunc(Key2)); - - if (length1!=length2) return 1; - - register int i; - - for (i=0;i<length1;i++) - if (Key1[i]!=Key2[i]) return 1; - return 0; -} - - - -/* -main(){ - -const int n=1000; - -htable *ht=new htable(1000/5); - - char w[n][20]; - char *c; - - for (int i=0;i<n;i++) - { - sprintf(w[i],"ciao%d",i); - ht->search((char *)&w[i],HT_ENTER); - } - - for (int i=0;i<n;i++) - if (ht->search((char *)&w[i],HT_FIND)) - cout << w[i] << " trovato\n" ; - else - cout << w[i] << " non trovato\n"; - - ht->stat(); - - delete ht; - htable *ht2=new htable(n); - for (int i=0;i<n;i++) - ht2->search((char *)&w[i],HT_ENTER); - - ht2->scan(INIT); - cout << "elenco:\n"; - while ((c=ht2->scan(CONT))!=NULL) - cout << *(char **) c << "\n"; - - ht2->map(); -} -*/ - - - - - - - diff --git a/irstlm/src/htable.h b/irstlm/src/htable.h deleted file mode 100644 index 3fd484094..000000000 --- a/irstlm/src/htable.h +++ /dev/null @@ -1,125 +0,0 @@ -/****************************************************************************** - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -******************************************************************************/ - -/* - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MF_HTABLE_H -#define MF_HTABLE_H - -#include <iostream> - -#define Prime1 37 -#define Prime2 1048583 -#define BlockSize 100 - - -// Fast arithmetic, relying on powers of 2, -// and on pre-processor concatenation property - -typedef struct{ - char* key; - char* next; // secret from user -}entry; - -typedef unsigned int address; - -typedef enum {HT_FIND, //!< search: find an entry - HT_ENTER, //!< search: enter an entry - HT_INIT, //!< scan: start scan - HT_CONT //!< scan: continue scan -} HT_ACTION; - -typedef enum {STR, //!< string - STRPTR //!< pointer to string -}HTYPE; - -//! Hash Table for strings - -class htable { - int size; //!< table size - int keylen; //!< key length - HTYPE htype; //!< type of entry pointer - entry **table; //!< hash table - int scan_i; //!< scan support - entry *scan_p; //!< scan support - // statistics - long keys; //!< # of entries - long accesses; //!< # of accesses - long collisions; //!< # of collisions - - mempool *memory; //!< memory pool - - size_t (*keylenfunc)(const char*); //!< function computing key length - - public: - - //! Creates an hash table - htable(int n,int kl=0,HTYPE ht=STRPTR,size_t (*klf)(const char* )=NULL); - - //! Destroys an and hash table - ~htable(); - - //! Computes the hash function - address Hash(char *key); - - //! Compares the keys of two entries - int Comp(char *Key1,char *Key2); - - //! Searches for an item - char *search(char *item, HT_ACTION action); - - //! Scans the content - char *scan(HT_ACTION action); - - //! Prints statistics - void stat(); - - //! Print a map of memory use - void map(std::ostream& co=std::cout, int cols=80); - - //! Returns amount of used memory - int used(){return - size * sizeof(entry **) + - memory->used();}; -}; - - - -#endif - - - diff --git a/irstlm/src/index.h b/irstlm/src/index.h deleted file mode 100644 index 500587989..000000000 --- a/irstlm/src/index.h +++ /dev/null @@ -1,19 +0,0 @@ - - -#pragma once - -#ifdef WIN32 - -inline const char *index(const char *str, char search) -{ - int i=0; - while (i< strlen(str) ){ - if (str[i]==search) return &str[i]; - } - return NULL; -} - - -#endif - - diff --git a/irstlm/src/lmtable.cpp b/irstlm/src/lmtable.cpp deleted file mode 100644 index 997102da2..000000000 --- a/irstlm/src/lmtable.cpp +++ /dev/null @@ -1,728 +0,0 @@ -/* - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <iostream> -#include <stdexcept> -#include <assert.h> - -#include "math.h" -#include "mempool.h" -#include "htable.h" -#include "dictionary.h" -#include "ngram.h" -#include "lmtable.h" - -using namespace std; - -inline void error(char* message){ - cerr << message << "\n"; - throw std::runtime_error(message); -} - -lmtable::lmtable(std::istream& inp){ - - //initialization - maxlev=1; - - memset(cursize, 0, sizeof(cursize)); - memset(tbltype, 0, sizeof(tbltype)); - memset(maxsize, 0, sizeof(maxsize)); - memset(info, 0, sizeof(info)); - memset(NumCenters, 0, sizeof(NumCenters)); - - dict=new dictionary((char *)NULL,1000000,(char*)NULL,(char*)NULL); - - //default settings is a non quantized lmtable - configure(1,isQtable=0); - - char header[1024]; - - inp >> header; cerr << header << "\n"; - - if (strncmp(header,"Qblmt",5)==0 || strncmp(header,"blmt",4)==0) - loadbin(inp, header); - else - loadtxt(inp, header); - - dict->genoovcode(); - - cerr << "OOV code is " << dict->oovcode() << "\n"; -} - - -int parseWords(char *sentence, char **words, int max) -{ - char *word; - int i = 0; - - char *const wordSeparators = " \t\r\n"; - - for (word = strtok(sentence, wordSeparators); - i < max && word != 0; - i++, word = strtok(0, wordSeparators)) - { - words[i] = word; - } - - if (i < max){words[i] = 0;} - - return i; -} - - - -//Load a LM as a text file. LM could have been generated either with the -//IRST LM toolkit or with the SRILM Toolkit. In the latter we are not -//sure that n-grams are lexically ordered (according to the 1-grams). -//However, we make the following assumption: -//"all successors of any prefix are sorted and written in contiguous lines!" -//This method also loads files processed with the quantization -//tool: qlm - -void parseline(std::istream& inp, int Order,ngram& ng,float& prob,float& bow){ - - char* words[1+ LMTMAXLEV + 1 + 1]; - int howmany; - char line[1024]; - - inp.getline(line,1024); - - howmany = parseWords(line, words, Order + 3); - assert(howmany == (Order+ 1) || howmany == (Order + 2)); - - //read words - ng.size=0; - for (int i=1;i<=Order;i++) - ng.pushw(strcmp(words[i],"<unk>")?words[i]:ng.dict->OOV()); - //read logprob/code and logbow/code - assert(sscanf(words[0],"%f",&prob)); - if (howmany==(Order+2)) - assert(sscanf(words[Order+1],"%f",&bow)); - else - bow=0.0; //this is log10prob=0 for implicit backoff -} - - -void lmtable::loadcenters(std::istream& inp,int Order){ - char line[11]; - - //first read the coodebook - cerr << Order << " read code book "; - inp >> NumCenters[Order]; - Pcenters[Order]=new float[NumCenters[Order]]; - Bcenters[Order]=(Order<maxlev?new float[NumCenters[Order]]:NULL); - - for (int c=0;c<NumCenters[Order];c++){ - inp >> Pcenters[Order][c]; - if (Order<maxlev) inp >> Bcenters[Order][c]; - }; - //empty the last line - inp.getline((char*)line,10); - -} - - -void lmtable::loadtxt(std::istream& inp, const char* header){ - - //open input stream and prepare an input string - char line[1024]; - - //prepare word dictionary - //dict=(dictionary*) new dictionary(NULL,1000000,NULL,NULL); - dict->incflag(1); - - //put here ngrams, log10 probabilities or their codes - ngram ng(dict); - float prob,bow,log10=(float)log(10.0); - - //check the header to decide if the LM is quantized or not - isQtable=(strncmp(header,"qARPA",5)==0?true:false); - - //we will configure the table later we we know the maxlev; - bool yetconfigured=false; - - cerr << "loadtxt()\n"; - - // READ ARPA Header - int Order, n; - - while (inp.getline(line,1024)){ - - bool backslash = (line[0] == '\\'); - - if (sscanf(line, "ngram %d=%d", &Order, &n) == 2) { - maxsize[Order] = n; maxlev=Order; //upadte Order - } - - if (backslash && sscanf(line, "\\%d-grams", &Order) == 1) { - - //at this point we are sure about the size of the LM - if (!yetconfigured) {configure(maxlev,isQtable);yetconfigured=true;} - - cerr << Order << "-grams: reading "; - - if (isQtable) loadcenters(inp,Order); - - //allocate space for loading the table of this level - table[Order]= new char[maxsize[Order] * nodesize(tbltype[Order])]; - - //allocate support vector to manage badly ordered n-grams - if (maxlev>1) { - startpos[Order]=new int[maxsize[Order]]; - for (int c=0;c<maxsize[Order];c++) startpos[Order][c]=-1; - } - - //prepare to read the n-grams entries - cerr << maxsize[Order] << " entries\n"; - - //WE ASSUME A WELL STRUCTURED FILE!!! - - for (int c=0;c<maxsize[Order];c++){ - - parseline(inp,Order,ng,prob,bow); - - //add to table - add(ng, - (int)(isQtable?prob:exp(prob * log10)*UNIGRAM_RESOLUTION), - (int)(isQtable?bow:exp(bow * log10)*UNIGRAM_RESOLUTION)); - } - // now we can fix table at level Order -1 - if (maxlev>1 && Order>1) checkbounds(Order-1); - } - } - - dict->incflag(0); - cerr << "done\n"; - -} - -//set all bounds of entries with no successors to the bound -//of the previous entry. - -void lmtable::checkbounds(int level){ - - char* tbl=table[level]; - char* succtbl=table[level+1]; - - LMT_TYPE ndt=tbltype[level], succndt=tbltype[level+1]; - int ndsz=nodesize(ndt), succndsz=nodesize(succndt); - - //re-order table at level+1 - char* newtbl=new char[succndsz * cursize[level+1]]; - int start,end,newstart; - - //re-order table at - newstart=0; - for (int c=0;c<cursize[level];c++){ - start=startpos[level][c]; end=bound(tbl+c*ndsz,ndt); - //is start==-1 there are no successors for this entry and end==-2 - if (end==-2) end=start; - assert(start<=end); - assert(newstart+(end-start)<=cursize[level+1]); - assert(end<=cursize[level+1]); - - if (start<end) - memcpy((void*)(newtbl + newstart * succndsz), - (void*)(succtbl + start * succndsz), - (end-start) * succndsz); - - bound(tbl+c*ndsz,ndt,newstart+(end-start)); - newstart+=(end-start); - } - delete [] table[level+1]; - table[level+1]=newtbl; - newtbl=NULL; -} - -//Add method inserts n-grams in the table structure. It is ONLY used during -//loading of LMs in text format. It searches for the prefix, then it adds the -//suffix to the last level and updates the start-end positions. - -int lmtable::add(ngram& ng,int iprob,int ibow){ - - char *found; LMT_TYPE ndt; int ndsz; - - if (ng.size>1){ - - // find the prefix starting from the first level - int start=0, end=cursize[1]; - - for (int l=1;l<ng.size;l++){ - - ndt=tbltype[l]; ndsz=nodesize(ndt); - - if (search(table[l] + (start * ndsz),ndt,l,(end-start),ndsz, - ng.wordp(ng.size-l+1),LMT_FIND, &found)){ - - //update start-end positions for next step - if (l< (ng.size-1)){ - //set start position - if (found==table[l]) start=0; //first pos in table - else start=bound(found - ndsz,ndt); //end of previous entry - - //set end position - end=bound(found,ndt); - } - } - else{ - cerr << "warning: missing back-off for ngram " << ng << "\n"; - return 0; - } - } - - // update book keeping information about level ng-size -1. - // if this is the first successor update start position - int position=(found-table[ng.size-1])/ndsz; - if (startpos[ng.size-1][position]==-1) - startpos[ng.size-1][position]=cursize[ng.size]; - - //always update ending position - bound(found,ndt,cursize[ng.size]+1); - //cout << "startpos: " << startpos[ng.size-1][position] - //<< " endpos: " << bound(found,ndt) << "\n"; - - } - - // just add at the end of table[ng.size] - - assert(cursize[ng.size]< maxsize[ng.size]); // is there enough space? - ndt=tbltype[ng.size];ndsz=nodesize(ndt); - - found=table[ng.size] + (cursize[ng.size] * ndsz); - word(found,*ng.wordp(1)); - prob(found,ndt,iprob); - if (ng.size<maxlev){bow(found,ndt,ibow);bound(found,ndt,-2);} - - cursize[ng.size]++; - - return 1; - -} - - -void *lmtable::search(char* tb, - LMT_TYPE ndt, - int lev, - int n, - int sz, - int *ngp, - LMT_ACTION action, - char **found){ - - //prepare search pattern - char w[LMTCODESIZE];putmem(w,ngp[0],0,LMTCODESIZE); - - int idx=0; // index returned by mybsearch - if (found) *found=NULL; //initialize output variable - switch(action){ - case LMT_FIND: - if (!tb || !mybsearch(tb,n,sz,(unsigned char *)w,&idx)) - return 0; - else - if (found) *found=tb + (idx * sz); - return tb + (idx * sz); - default: - error("lmtable::search: this option is available"); - }; - - return (void *)0x0; -} - - -int lmtable::mybsearch(char *ar, int n, int size, - unsigned char *key, int *idx) -{ - register int low, high; - register unsigned char *p; - register int result; - register int i; - - /* return idx with the first - position equal or greater than key */ - - /* Warning("start bsearch \n"); */ - - low = 0;high = n; *idx=0; - while (low < high) - { - *idx = (low + high) / 2; - p = (unsigned char *) (ar + (*idx * size)); - - //comparison - for (i=(LMTCODESIZE-1);i>=0;i--){ - result=key[i]-p[i]; - if (result) break; - } - - if (result < 0) - high = *idx; - else if (result > 0) - low = *idx + 1; - else - return 1; - } - - *idx=low; - - return 0; - -} - - -// saves a LM table in text format - -void lmtable::savetxt(const char* filename){ - - fstream out(filename,ios::out); - int l; - - out.precision(6); - - if (isQtable) out << "qARPA\n"; - - - ngram ng(dict,0); - - cerr << "savetxt()\n"; - - out << "\n\\data\\\n"; - for (l=1;l<=maxlev;l++){ - out << "ngram " << l << "= " << cursize[l] << "\n"; - } - - for (l=1;l<=maxlev;l++){ - - out << "\n\\" << l << "-grams:\n"; - cerr << "save: " << cursize[l] << " " << l << "-grams\n"; - if (isQtable){ - out << NumCenters[l] << "\n"; - for (int c=0;c<NumCenters[l];c++){ - out << Pcenters[l][c]; - if (l<maxlev) out << " " << Bcenters[l][c]; - out << "\n"; - } - } - - ng.size=0; - dumplm(out,ng,1,l,0,cursize[1]); - - } - - out << "\\end\\\n"; - cerr << "done\n"; -} - - -void lmtable::savebin(const char *filename){ - - fstream out(filename,ios::out); - cerr << "savebin: " << filename << "\n"; - - // print header - if (isQtable){ - out << "Qblmt " << maxlev; - for (int i=1;i<=maxlev;i++) out << " " << cursize[i]; - out << "\nNumCenters"; - for (int i=1;i<=maxlev;i++) out << " " << NumCenters[i]; - out << "\n"; - - }else{ - out << "blmt " << maxlev; - for (int i=1;i<=maxlev;i++) out << " " << cursize[i] ; - out << "\n"; - } - - dict->save(out); - - for (int i=1;i<=maxlev;i++){ - cerr << "saving " << cursize[i] << " " << i << "-grams\n"; - if (isQtable){ - out.write((char*)Pcenters[i],NumCenters[i] * sizeof(float)); - if (i<maxlev) - out.write((char *)Bcenters[i],NumCenters[i] * sizeof(float)); - } - out.write(table[i],cursize[i]*nodesize(tbltype[i])); - } - - cerr << "done\n"; -} - - -void lmtable::loadbin(std::istream& inp, const char *header){ - - cerr << "loadbin()\n"; - - // read header - inp >> maxlev; - - if (strncmp(header,"Qblmt",5)==0) isQtable=1; - else if(strncmp(header,"blmt",4)==0) isQtable=0; - else error("loadbin: wrong header"); - - configure(maxlev,isQtable); - - for (int i=1;i<=maxlev;i++){ - inp >> cursize[i]; maxsize[i]=cursize[i]; - table[i]=new char[cursize[i] * nodesize(tbltype[i])]; - } - - if (isQtable){ - cerr << "reading num centers:"; - char tmp[1024]; - inp >> tmp; - for (int i=1;i<=maxlev;i++){ - inp >> NumCenters[i];cerr << " " << NumCenters[i]; - Pcenters[i]=new float [NumCenters[i]]; - Bcenters[i]=(i<maxlev?new float [NumCenters[i]]:NULL); - } - cerr << "\n"; - } - - //dict=new dictionary(NULL,1000000,NULL,NULL); - dict->load(inp); - - for (int i=1;i<=maxlev;i++){ - if (isQtable){ - inp.read((char*)Pcenters[i],NumCenters[i] * sizeof(float)); - if (i<maxlev) inp.read((char *)Bcenters[i],NumCenters[i]*sizeof(float)); - } - cerr << "loading " << cursize[i] << " " << i << "-grams\n"; - inp.read(table[i],cursize[i]*nodesize(tbltype[i])); - } - - cerr << "done\n"; -} - - - -int lmtable::get(ngram& ng,int n,int lev){ - - // cout << "cerco:" << ng << "\n"; - - if (lev > maxlev) error("get: lev exceeds maxlevel"); - if (n < lev) error("get: ngram is too small"); - - //set boudaries for 1-gram - int offset=0,limit=cursize[1]; - - //information of table entries - char* found; LMT_TYPE ndt; - - for (int l=1;l<=lev;l++){ - - //initialize entry information - found = NULL; ndt=tbltype[l]; - - //search in table at level i - search(table[l] + (offset * nodesize(ndt)), - ndt, - l, - (limit-offset), - nodesize(ndt), - ng.wordp(n-l+1), - LMT_FIND, - &found); - - if (!found) return 0; - - if (l<maxlev){ //set start/end point for next search - - //if current offset is at the bottom also that of successors will be - if (offset+1==cursize[l]) limit=cursize[l+1]; - else limit=bound(found,ndt); - - //if current start is at the begin, then also that of successors will be - if (found==table[l]) offset=0; - else offset=bound((found - nodesize(ndt)),ndt); - - assert(offset!=-1); assert(limit!=-1); - } - } - - //put information inside ng - ng.size=n; ng.lev=lev; ng.freq=0; ng.link=found; ng.info=ndt; - ng.succ=(lev<maxlev?limit-offset:0); - - return 1; -} - - -//recursively prints the language model table - -void lmtable::dumplm(std::ostream& out,ngram ng, int ilev, int elev, int ipos,int epos){ - - LMT_TYPE ndt=tbltype[ilev]; - int ndsz=nodesize(ndt); - float log10=log(10.0); - - assert(ng.size==ilev-1); - assert(ipos>=0 && epos<=cursize[ilev] && ipos<epos); - ng.pushc(0); - - for (int i=ipos;i<epos;i++){ - *ng.wordp(1)=word(table[ilev]+i*ndsz); - if (ilev<elev){ - //get first and last successor position - int isucc=(i>0?bound(table[ilev]+(i-1)*ndsz,ndt):0); - int esucc=bound(table[ilev]+i*ndsz,ndt); - if (isucc < esucc) //there are successors! - dumplm(out,ng,ilev+1,elev,isucc,esucc); - //else - //cout << "no successors for " << ng << "\n"; - } - else{ - //out << i << " "; //this was just to count printed n-grams - int ipr=prob(table[ilev]+ i * ndsz,ndt); - out << (isQtable?ipr:log((ipr+1)/UNIGRAM_RESOLUTION)/log10) <<"\t"; - for (int k=ng.size;k>=1;k--){ - if (k<ng.size) out << " "; - out << dict->decode(*ng.wordp(k)); - } - int ibo=(int)(ilev<maxlev?bow(table[ilev]+ i * ndsz,ndt):UNIGRAM_RESOLUTION); - if (ibo!=UNIGRAM_RESOLUTION) - out << "\t" << (isQtable?ibo:log((ibo+1)/UNIGRAM_RESOLUTION)/log10); - out << "\n"; - } - } -} - -//succscan iteratively returns all successors of an ngram h for which -//get(h,h.size,h.size) returned true. - - -int lmtable::succscan(ngram& h,ngram& ng,LMT_ACTION action,int lev){ - assert(lev==h.lev+1 && h.size==lev && lev<=maxlev); - - LMT_TYPE ndt=tbltype[h.lev]; - int ndsz=nodesize(ndt); - - switch (action){ - - case LMT_INIT: - //reset ngram local indexes - - ng.size=lev; - ng.trans(h); - ng.midx[lev]=(h.link>table[h.lev]?bound(h.link-ndsz,ndt):0); - - return 1; - - case LMT_CONT: - - if (ng.midx[lev]<bound(h.link,ndt)) - { - //put current word into ng - *ng.wordp(1)=word(table[lev]+ng.midx[lev]*nodesize(tbltype[lev])); - ng.midx[lev]++; - return 1; - } - else - return 0; - - default: - cerr << "succscan: only permitted options are LMT_INIT and LMT_CONT\n"; - exit(0); - } - -} - -//maxsuffptr returns the largest suffix of an n-gram that is contained -//in the LM table. This can be used as a compact representation of the -//(n-1)-gram state of a n-gram LM. if the input k-gram has k>=n then it -//is trimmed to its n-1 suffix. - -const char *lmtable::maxsuffptr(ngram ong){ - - if (ong.size==0) return (char*) NULL; - if (ong.size>=maxlev) ong.size=maxlev-1; - - ngram ng(dict); //eventually use the <unk> word - ng.trans(ong); - - if (get(ng,ng.size,ng.size)) - return ng.link; - else{ - ong.size--; -#ifndef WIN32 -#warning maxsuffptr is not implemented -#endif - exit(1); -// return getstate(ong); - } -} - - -// returns the probability of an n-gram - -double lmtable::prob(const ngram& ong){ - - if (ong.size==0) return 0.0; - - ngram ng(dict); - ng.trans(ong); - if (ong.size>maxlev) ng.size=maxlev; - - double rbow; - int ibow,iprob; - LMT_TYPE ndt; - - if (get(ng,ng.size,ng.size)){ - ndt=(LMT_TYPE)ng.info; iprob=prob(ng.link,ndt); - return (double)(isQtable?Pcenters[ng.size][iprob] - :(iprob+1.0)/UNIGRAM_RESOLUTION); - } - else{ //size==1 means an OOV word - if (ng.size==1) return (double)1.0/UNIGRAM_RESOLUTION; - else{ // compute backoff - //set backoff state, shift n-gram, set default bow prob - bo_state(1); ng.shift();rbow=1.0; - if (get(ng)){ - ndt= (LMT_TYPE)ng.info; ibow=bow(ng.link,ndt); - rbow= (double) (isQtable?Bcenters[ng.size][ibow]:(ibow+1.0)/UNIGRAM_RESOLUTION); - } - //prepare recursion step - ng.size--; - return rbow * prob(ng); - } - } -} - - -void lmtable::stat(int level){ - int totmem=0,memory; - float mega=1024 * 1024; - - cout.precision(2); - - cout << "lmtable class statistics\n"; - - cout << "levels " << maxlev << "\n"; - for (int l=1;l<=maxlev;l++){ - memory=cursize[l] * nodesize(tbltype[l]); - cout << "lev " << l - << " entries "<< cursize[l] - << " used mem " << memory/mega << "Mb\n"; - totmem+=memory; - } - - cout << "total allocated mem " << totmem/mega << "Mb\n"; - - if (level >1 ) dict->stat(); - -} diff --git a/irstlm/src/lmtable.h b/irstlm/src/lmtable.h deleted file mode 100644 index 9e392bc9a..000000000 --- a/irstlm/src/lmtable.h +++ /dev/null @@ -1,245 +0,0 @@ -/****************************************************************************** - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -******************************************************************************/ - -/* - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MF_LMTABLE_H -#define MF_LMTABLE_H - -#include "ngram.h" - -#define LMTMAXLEV 11 - -#ifndef LMTCODESIZE -#define LMTCODESIZE (int)3 -#endif - -#define SHORTSIZE (int)2 -#define PTRSIZE (int)sizeof(char *) -#define INTSIZE (int)4 -#define CHARSIZE (int)1 - -#define PROBSIZE (int)4 //use float -#define QPROBSIZE (int)1 -#define BOUNDSIZE (int)4 - -#define UNIGRAM_RESOLUTION 10000000.0 - -typedef enum {INTERNAL,QINTERNAL,LEAF,QLEAF} LMT_TYPE; -typedef char* node; - -typedef enum {LMT_FIND, //!< search: find an entry - LMT_ENTER, //!< search: enter an entry - LMT_INIT, //!< scan: start scan - LMT_CONT //!< scan: continue scan -} LMT_ACTION; - - -class lmtable{ - - char* table[LMTMAXLEV]; //storage of all levels - LMT_TYPE tbltype[LMTMAXLEV]; //table type for each levels - int cursize[LMTMAXLEV]; //current size of levels - int maxsize[LMTMAXLEV]; //current size of levels - int* startpos[LMTMAXLEV]; //support vector to store start positions - - int maxlev; //max level of table - char info[100]; //information put in the header - - //probability quantization - bool isQtable; - - int NumCenters[LMTMAXLEV]; - float* Pcenters[LMTMAXLEV]; - float* Bcenters[LMTMAXLEV]; - - int lmt_oov_code; - int lmt_oov_size; - int backoff_state; - - - public: - - dictionary *dict; // dictionary - - lmtable(std::istream& in); - - ~lmtable(){ - for (int i=1;i<=maxlev;i++){ - delete [] table[i]; - if (isQtable){ - delete [] Pcenters[i]; - if (i<maxlev) delete [] Bcenters[i]; - } - } - } - - void configure(int n,bool quantized){ - maxlev=n; - if (n==1) - tbltype[1]=(quantized?QLEAF:LEAF); - else{ - for (int i=1;i<n;i++) tbltype[i]=(quantized?QINTERNAL:INTERNAL); - tbltype[n]=(quantized?QLEAF:LEAF); - } - }; - - int maxlevel(){return maxlev;}; - - void savetxt(const char *filename); - void savebin(const char *filename); - void dumplm(std::ostream& out,ngram ng, int ilev, int elev, int ipos,int epos); - - void loadtxt(std::istream& in, const char* header); - void loadbin(std::istream& in, const char* header); - - void loadcenters(std::istream& inp,int Order); - - double prob(const ngram& ng); - - void *search(char *tb,LMT_TYPE ndt,int lev,int n,int sz,int *w, - LMT_ACTION action,char **found=(char **)NULL); - - int mybsearch(char *ar, int n, int size, unsigned char *key, int *idx); - - int add(ngram& ng,int prob,int bow); - void checkbounds(int level); - - int get(ngram& ng){return get(ng,ng.size,ng.size);} - int get(ngram& ng,int n,int lev); - - int succscan(ngram& h,ngram& ng,LMT_ACTION action,int lev); - const char *maxsuffptr(ngram ong); - inline int putmem(char* ptr,int value,int offs,int size){ - assert(ptr!=NULL); - for (int i=0;i<size;i++) - ptr[offs+i]=(value >> (8 * i)) & 0xff; - return value; - }; - - inline int getmem(char* ptr,int* value,int offs,int size){ - assert(ptr!=NULL); - *value=ptr[offs] & 0xff; - for (int i=1;i<size;i++) - *value= *value | ( ( ptr[offs+i] & 0xff ) << (8 *i)); - return *value; - }; - - - int bo_state(int value=-1){ - return (value==-1?backoff_state:backoff_state=value); - }; - - - int nodesize(LMT_TYPE ndt){ - switch (ndt){ - case INTERNAL: - return LMTCODESIZE + PROBSIZE + PROBSIZE + BOUNDSIZE; - case QINTERNAL: - return LMTCODESIZE + QPROBSIZE + QPROBSIZE + BOUNDSIZE; - case QLEAF: - return LMTCODESIZE + QPROBSIZE; - case LEAF: - return LMTCODESIZE + PROBSIZE; - default: - assert(0); - return 0; - } - } - - inline int word(node nd,int value=-1) - { - int offset=0; - - if (value==-1) - getmem(nd,&value,offset,LMTCODESIZE); - else - putmem(nd,value,offset,LMTCODESIZE); - - return value; - }; - - inline int prob(node nd,LMT_TYPE ndt, int value=-1) - { - int offs=LMTCODESIZE; - int size=(ndt==QINTERNAL || ndt==QLEAF?QPROBSIZE:PROBSIZE); - - if (value==-1) - getmem(nd,&value,offs,size); - else - putmem(nd,value,offs,size); - - return value; - }; - - - inline int bow(node nd,LMT_TYPE ndt, int value=-1) - { - assert(ndt==INTERNAL || ndt==QINTERNAL); - int size=(ndt==QINTERNAL?QPROBSIZE:PROBSIZE); - int offs=LMTCODESIZE+size; - - if (value==-1) - getmem(nd,&value,offs,size); - else - putmem(nd,value,offs,size); - - return value; - }; - - inline int bound(node nd,LMT_TYPE ndt, int value=-1) - { - assert(ndt==INTERNAL || ndt==QINTERNAL); - int offs=LMTCODESIZE+2*(ndt==QINTERNAL?QPROBSIZE:PROBSIZE); - - if (value==-1) - getmem(nd,&value,offs,BOUNDSIZE); - else - putmem(nd,value,offs,BOUNDSIZE); - - return value; - }; - - void stat(int lev=0); - -}; - -#endif - - - - diff --git a/irstlm/src/mempool.cpp b/irstlm/src/mempool.cpp deleted file mode 100644 index 00a9777d0..000000000 --- a/irstlm/src/mempool.cpp +++ /dev/null @@ -1,516 +0,0 @@ -/****************************************************************************** - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -******************************************************************************/ - -// An efficient memory pool manager -// by M. Federico -// Copyright Marcello Federico, ITC-irst, 1998 - -#include <iostream> -#include <assert.h> -#include "mempool.h" - -using namespace std; - -/*! The pool contains: - - entries of size is - - tables for bs entries -*/ - -mempool::mempool(int is, int bs){ - - // item size must be multiple of memory alignment step (4 bytes) - // example: is is=9 becomes i=12 (9 + 4 - 9 %4 ) - - is=(is>(int)sizeof(char *)?is:0); - - is=is + sizeof(char *) - (is % sizeof(char *)); - - item_size = is; - - block_size = bs; - - true_size = is * bs; - - block_list = new memnode; - - block_list->block = new char[true_size]; - - memset(block_list->block,'0',true_size); - - block_list->next = 0; - - blocknum = 1; - - entries = 0; - - // build free list - - char *ptr = free_list = block_list->block; - - for (int i=0;i<block_size-1;i++) { - *(char **)ptr= ptr + item_size; - ptr+=item_size; - } - *(char **)ptr = NULL; //last item - -} - - -char * mempool::alloc(){ - - char *ptr; - - if (free_list==NULL) - { - memnode *new_block = new memnode; - - new_block->block = new char[true_size]; - - memset(new_block->block,'0',true_size); - - new_block->next = block_list; - - block_list=new_block; // update block list - - /* update free list */ - - ptr = free_list = block_list->block; - - for (int i=0;i<block_size-1;i++) { - *(char **)ptr = ptr + item_size; - ptr = ptr + item_size; - } - - *(char **)ptr=NULL; - - blocknum++; - } - - ptr = free_list; - - free_list=*(char **)ptr; - - *(char **)ptr=NULL; // reset the released item - - entries++; - - return ptr; - -} - - -int mempool::free(char* addr){ - - // do not check if it belongs to this pool !! - /* - memnode *list=block_list; - while ((list != NULL) && - ((addr < list->block) || - (addr >= (list->block + true_size)))) - list=list->next; - - if ((list==NULL) || (((addr - list->block) % item_size)!=0)) - { - //cerr << "mempool::free-> addr does not belong to this pool\n"; - return 0; - } - */ - - *(char **)addr=free_list; - free_list=addr; - - entries--; - - return 1; -} - - -mempool::~mempool() -{ - memnode *ptr; - - while (block_list !=NULL){ - ptr=block_list->next; - delete [] block_list->block; - delete block_list; - block_list=ptr; - } - -} - -void mempool::map (ostream& co){ - - co << "mempool memory map:\n"; - //percorri piu` volte la lista libera - - memnode *bl=block_list; - char *fl=free_list; - - char* img=new char[block_size+1]; - img[block_size]='\0'; - - while (bl !=NULL){ - - memset(img,'#',block_size); - - fl=free_list; - while (fl != NULL){ - if ((fl >= bl->block) - && - (fl < bl->block + true_size)) - { - img[(fl-bl->block)/item_size]='-'; - } - - fl=*(char **)fl; - } - - co << img << "\n"; - bl=bl->next; - } - delete [] img; -} - -void mempool::stat(){ - - cout << "mempool class statistics\n" - << "entries " << entries - << " blocks " << blocknum - << " used memory " << (blocknum * true_size)/1024 << " Kb\n"; -} - - - -strstack::strstack(int bs){ - - size=bs; - list=new memnode; - - list->block=new char[size]; - - list->next=0; - - memset(list->block,'\0',size); - idx=0; - - waste=0; - memory=size; - entries=0; - blocknum=1; - -} - - -void strstack::stat(){ - - cout << "strstack class statistics\n" - << "entries " << entries - << " blocks " << blocknum - << " used memory " << memory/1024 << " Kb\n"; -} - - -char *strstack::push(char *s){ - int len=strlen(s); - - if ((len+1) >= size){ - cerr << "strstack::push string is too long\n"; - exit(1); - }; - - if ((idx+len+1) >= size){ - //append a new block - //there must be space to - //put the index after - //the word - - waste+=size-idx; - blocknum++; - memory+=size; - - memnode* nd=new memnode; - nd->block=new char[size]; - nd->next=list; - - list=nd; - - memset(list->block,'\0',size); - - idx=0; - - } - - // append in current block - - strcpy(&list->block[idx],s); - - idx+=len+1; - - entries++; - - return &list->block[idx-len-1]; - -} - - -char *strstack::pop(){ - - if (list==0) return 0; - - if (idx==0){ - - // free this block and go to next - - memnode *ptr=list->next; - - delete [] list->block; - delete list; - - list=ptr; - - if (list==0) - return 0; - else - idx=size-1; - } - - //go back to first non \0 - while (idx>0) - if (list->block[idx--]!='\0') - break; - - //go back to first \0 - while (idx>0) - if (list->block[idx--]=='\0') - break; - - entries--; - - if (list->block[idx+1]=='\0') - { - idx+=2; - memset(&list->block[idx],'\0',size-idx); - return &list->block[idx]; - } - else{ - idx=0; - memset(&list->block[idx],'\0',size); - return &list->block[0]; - } -} - - -char *strstack::top(){ - - int tidx=idx; - memnode *tlist=list; - - if (tlist==0) return 0; - - if (idx==0){ - - tlist=tlist->next; - - if (tlist==0) return 0; - - tidx=size-1; - } - - //go back to first non \0 - while (tidx>0) - if (tlist->block[tidx--]!='\0') - break; - - //aaa\0bbb\0\0\0\0 - - //go back to first \0 - while (tidx>0) - if (tlist->block[tidx--]=='\0') - break; - - if (tlist->block[tidx+1]=='\0') - { - tidx+=2; - return &tlist->block[tidx]; - } - else{ - tidx=0; - return &tlist->block[0]; - } - -} - - -strstack::~strstack(){ - memnode *ptr; - while (list !=NULL){ - ptr=list->next; - delete [] list->block; - delete list; - list=ptr; - } -} - - -storage::storage(int maxsize,int blocksize) -{ - newmemory=0; - newcalls=0; - setsize=maxsize; - poolsize=blocksize; //in bytes - poolset=new mempool* [setsize+1]; - for (int i=0;i<=setsize;i++) - poolset[i]=NULL; -} - - -storage::~storage(){ - for (int i=0;i<=setsize;i++) - if (poolset[i]) - delete poolset[i]; - delete [] poolset; -} - - -char *storage::alloc(int size){ - - if (size<=setsize){ - if (!poolset[size]){ - poolset[size]=new mempool(size,poolsize/size); - } - return poolset[size]->alloc(); - } - else{ - - newmemory+=size+8; - newcalls++; - char* p=(char *)calloc(sizeof(char),size); - if (p==NULL){ - cerr << "storage::alloc insufficient memory\n"; - exit(1); - } - return p; - } -} - - - -char *storage::realloc(char *oldptr,int oldsize,int newsize){ - - char *newptr; - - assert(newsize>oldsize); - - if (oldsize<=setsize){ - if (newsize<=setsize){ - if (!poolset[newsize]) - poolset[newsize]=new mempool(newsize,poolsize/newsize); - newptr=poolset[newsize]->alloc(); - memset((char*)newptr,0,newsize); - } - else - newptr=(char *)calloc(sizeof(char),newsize); - - if (oldptr && oldsize){ - memcpy(newptr,oldptr,oldsize); - poolset[oldsize]->free(oldptr); - } - } - else{ - newptr=(char *)std::realloc(oldptr,newsize); - if (newptr==oldptr) - cerr << "r\b"; - else - cerr << "a\b"; - } - if (newptr==NULL){ - cerr << "storage::realloc insufficient memory\n"; - exit(1); - } - - return newptr; - -} - - -int storage::free(char *addr,int size){ - - /* - while(size<=setsize){ - if (poolset[size] && poolset[size]->free(addr)) - break; - size++; - } - */ - - if (size>setsize) - return free(addr),1; - else{ - poolset[size] && poolset[size]->free(addr); - } - return 1; -} - -void storage::stat(){ - int used=0; - int memory=sizeof(char *) * setsize; - int waste=0; - - for (int i=0;i<=setsize;i++) - if (poolset[i]){ - used++; - memory+=poolset[i]->used(); - waste+=poolset[i]->wasted(); - } - - cout << "storage class statistics\n"; - cout << "alloc entries " << newcalls - << " used memory " << newmemory/1024 << "Kb\n"; - cout << "mpools " << setsize - << " active " << used - << " used memory " << memory/1024 << "Kb" - << " wasted " << waste/1024 << "Kb\n"; -} - -/* -main(){ - - mempool* mp=new mempool(sizeof(int),80); - - int** ar= new (int*) [ 1000 ]; - - for (int i=0;i<1000;i++){ - ar[i]= (int *)mp->alloc(); - } - - mp->map(cout); - - for (int i=0;i<500;i++){ - mp->free(ar[i]); - } - - mp->map(cout); - -} - -*/ - - - diff --git a/irstlm/src/mempool.h b/irstlm/src/mempool.h deleted file mode 100644 index 20dc4d59f..000000000 --- a/irstlm/src/mempool.h +++ /dev/null @@ -1,181 +0,0 @@ -/****************************************************************************** - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -******************************************************************************/ - -// An efficient memory manager -// by M. Federico -// Copyright Marcello Federico, ITC-irst, 1998 - -#ifndef MF_MEMPOOL_H -#define MF_MEMPOOL_H - -#ifndef NULL -const int NULL=0; -//#define NULL=0; -#endif - -#include <iostream> // std::ostream - -//! Memory block -/*! This can be used by: -- mempool to store items of fixed size -- strstack to store strings of variable size -*/ - -class memnode{ - friend class mempool; //!< grant access - friend class strstack; //!< grant access - char *block; //!< block of memory - memnode *next; //!< next block ptr -}; - - -//! Memory pool - -/*! A memory pool is composed of: - - a linked list of block_num memory blocks - - each block might contain up to block_size items - - each item is made of exactly item_size bytes -*/ - -class mempool{ - int block_size; //!< number of entries per block - int item_size; //!< number of bytes per entry - int true_size; //!< number of bytes per block - memnode* block_list; //!< list of blocks - char* free_list; //!< free entry list - int entries; //!< number of stored entries - int blocknum; //!< number of allocated blocks - public: - - //! Creates a memory pool - mempool(int is, int bs); - - //! Destroys memory pool - ~mempool(); - - //! Prints a map of memory occupancy - void map(std::ostream& co); - - //! Allocates a single memory entry - char *alloc(); - - //! Frees a single memory entry - int free(char* addr); - - //! Prints statistics about this mempool - void stat(); - - //! Returns effectively used memory (bytes) - /*! includes 8 bytes required by each call of new */ - - int used(){return blocknum * (true_size + 8);}; - - //! Returns amount of wasted memory (bytes) - int wasted(){return used()-(entries * item_size);}; -}; - -//! A stack to store strings - -/*! - The stack is composed of - - a list of blocks memnode of fixed size - - attribute blocknum tells the block on top - - attribute idx tells position of the top string -*/ - -class strstack{ - memnode* list; //!< list of memory blocks - int size; //!< size of each block - int idx; //!< index of last stored string - int waste; //!< current waste of memory - int memory; //!< current use of memory - int entries; //!< current number of stored strings - int blocknum; //!< current number of used blocks - - public: - - strstack(int bs=1000); - - ~strstack(); - - char *push(char *s); - - char *pop(); - - char *top(); - - void stat(); - - int used(){return memory;}; - - int wasted(){return waste;}; - -}; - - -//! Manages multiple memory pools - -/*! - This class permits to manage memory pools - with items up to a specified size. - - items within the allowed range are stored in memory pools - - items larger than the limit are allocated with new -*/ - - -class storage{ - mempool **poolset; //!< array of memory pools - int setsize; //!< number of memory pools/maximum elem size - int poolsize; //!< size of each block - int newmemory; //!< stores amount of used memory - int newcalls; //!< stores number of allocated blocks - public: - - //! Creates storage - storage(int maxsize,int blocksize); - - //! Destroys storage - ~storage(); - - //! Allocates memory - char *alloc(int size); - - //! Realloc memory - char *realloc(char *oldptr,int oldsize,int newsize); - - //! Frees memory of an entry - int free(char *addr,int size=0); - - //! Prints statistics about storage - void stat(); -}; - - -#endif - - - - - - - - - - diff --git a/irstlm/src/ngram.cpp b/irstlm/src/ngram.cpp deleted file mode 100644 index 70a1a7c97..000000000 --- a/irstlm/src/ngram.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/****************************************************************************** - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -******************************************************************************/ - -#include <iomanip> -#include <assert.h> -#include "mempool.h" -#include "htable.h" -#include "dictionary.h" -#include "ngram.h" -#include "index.h" - -using namespace std; - -ngram::ngram(dictionary* d,int sz){ - dict=d; - size=sz; - succ=0; - freq=0; - info=0; - pinfo=0; - link=NULL; - isym=-1; - memset(word,0,sizeof(int)*MAX_NGRAM); - memset(midx,0,sizeof(int)*MAX_NGRAM); -} - -ngram::ngram(ngram& ng){ - size=ng.size; - freq=ng.freq; - succ=0; - info=0; - pinfo=0; - link=NULL; - isym=-1; - dict=ng.dict; - memcpy(word,ng.word,sizeof(int)*MAX_NGRAM); - memcpy(midx,ng.word,sizeof(int)*MAX_NGRAM); - -} - -void ngram::trans (const ngram& ng){ - size=ng.size; - freq=ng.freq; - if (dict == ng.dict){ - info=ng.info; - isym=ng.isym; - memcpy(word,ng.word,sizeof(int)*MAX_NGRAM); - memcpy(midx,ng.midx,sizeof(int)*MAX_NGRAM); - } - else{ - info=0; - memset(midx,0,sizeof(int)*MAX_NGRAM); - isym=-1; - for (int i=1;i<=size;i++) - word[MAX_NGRAM-i]=dict->encode(ng.dict->decode(*ng.wordp(i))); - } -} - - -ifstream& operator>> ( ifstream& fi , ngram& ng){ - char w[MAX_WORD]; - memset(w,0,MAX_WORD); - w[0]='\0'; - - if (!(fi >> setw(MAX_WORD) >> w)) - return fi; - - if (strlen(w)==(MAX_WORD-1)) - cerr << "ngram: a too long word was read (" - << w << ")\n"; - - if (ng.dict->intsymb() && - (strlen(w)==1) && (index(ng.dict->intsymb(),w[0])!=NULL)){ - - ng.isym=(long)index(ng.dict->intsymb(),w[0]) - - (long)ng.dict->intsymb(); - ng.size=0; - return fi; - } - - int c=ng.dict->encode(w); - - if (c == -1 ){ - cerr << "ngram: " << w << " is OOV \n"; - exit(1); - } - - memcpy(ng.word,ng.word+1,(MAX_NGRAM-1)*sizeof(int)); - - ng.word[MAX_NGRAM-1]=(int)c; - ng.freq=1; - - if (ng.size<MAX_NGRAM) ng.size++; - - return fi; - -} - - -int ngram::pushw(char* w){ - - assert(dict!=NULL); - - int c=dict->encode(w); - - if (c == -1 ){ - cerr << "ngram: " << w << " is OOV \n"; - exit(1); - } - - pushc(c); - - return 1; - -} - -int ngram::pushc(int c){ - - int buff[MAX_NGRAM-1]; - memcpy(buff,word+1,(MAX_NGRAM-1)*sizeof(int)); - memcpy(word,buff,(MAX_NGRAM-1)*sizeof(int)); - - word[MAX_NGRAM-1]=(int)c; - if (size<MAX_NGRAM) size++; - - return 1; - -} - - -istream& operator>> ( istream& fi , ngram& ng){ - char w[MAX_WORD]; - memset(w,0,MAX_WORD); - w[0]='\0'; - - assert(ng.dict != NULL); - - if (!(fi >> setw(MAX_WORD) >> w)) - return fi; - - if (strlen(w)==(MAX_WORD-1)) - cerr << "ngram: a too long word was read (" - << w << ")\n"; - - if (ng.dict->intsymb() && - (strlen(w)==1) && (index(ng.dict->intsymb(),w[0])!=NULL)){ - ng.isym=(long)index(ng.dict->intsymb(),w[0])-(long)ng.dict->intsymb(); - ng.size=0; - return fi; - } - - ng.pushw(w); - - ng.freq=1; - - return fi; - -} - -ofstream& operator<< (ofstream& fo,ngram& ng){ - - assert(ng.dict != NULL); - - for (int i=ng.size;i>0;i--) - fo << ng.dict->decode(ng.word[MAX_NGRAM-i]) << " "; - //fo << "[size " << ng.size << " freq " << ng.freq << "]"; - fo << ng.freq; - return fo; -} - -ostream& operator<< (ostream& fo,ngram& ng){ - - assert(ng.dict != NULL); - - for (int i=ng.size;i>0;i--) - fo << ng.dict->decode(ng.word[MAX_NGRAM-i]) << " "; - //fo << "[size " << ng.size << " freq " << ng.freq << "]"; - fo << ng.freq; - - return fo; -} - -/* -main(int argc, char** argv){ - dictionary d(argv[1]); - ifstream txt(argv[1]); - ngram ng(&d); - - while (txt >> ng){ - cout << ng << "\n"; - } - - ngram ng2=ng; - cerr << "copia l'ultimo =" << ng << "\n"; -} -*/ - diff --git a/irstlm/src/ngram.h b/irstlm/src/ngram.h deleted file mode 100644 index 12a885be0..000000000 --- a/irstlm/src/ngram.h +++ /dev/null @@ -1,117 +0,0 @@ -/****************************************************************************** - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -******************************************************************************/ - -// n-gram tables -// by M. Federico -// Copyright Marcello Federico, ITC-irst, 1998 - -#ifndef MF_NGRAM_H -#define MF_NGRAM_H - -#include <fstream> -#include "dictionary.h" - -#ifdef MYMAXNGRAM -#define MAX_NGRAM MYMAXNGRAM -#else -#define MAX_NGRAM 20 -#endif - -class dictionary; - -//typedef int code; - -class ngram{ - int word[MAX_NGRAM]; //encoded ngram - public: - dictionary *dict; //dictionary - char* link; // ngram-tree pointer - int midx[MAX_NGRAM]; // ngram-tree scan pointer - int lev; // ngram-tree level - int size; // ngram size - int freq; // ngram frequency - int succ; // number of successors - - unsigned char info; // ngram-tree info flags - unsigned char pinfo; // ngram-tree parent info flags - int isym; // last interruption symbol - - ngram(dictionary* d,int sz=0); - ngram(ngram& ng); - - int *wordp()// n-gram pointer - {return wordp(size);}; - int *wordp(int k) // n-gram pointer - {return size>=k?&word[MAX_NGRAM-k]:0;}; - const int *wordp() const // n-gram pointer - {return wordp(size);}; - const int *wordp(int k) const // n-gram pointer - {return size>=k?&word[MAX_NGRAM-k]:0;}; - - int shift(){ - for (int i=(MAX_NGRAM-1);i>0;i--){ - word[i]=word[i-1]; - } - size--; - return 1; - } - - - int containsWord(char* s,int lev){ - - int c=dict->encode(s); - if (c == -1) return 0; - - assert(lev <= size); - for (int i=0;i<lev;i++){ - if (*wordp(size-i)== c) return 1; - } - return 0; - } - - - void trans(const ngram& ng); - - friend std::ifstream& operator>> (std::ifstream& fi,ngram& ng); - friend std::ofstream& operator<< (std::ofstream& fi,ngram& ng); - friend std::istream& operator>> (std::istream& fi,ngram& ng); - friend std::ostream& operator<< (std::ostream& fi,ngram& ng); - - inline int ckhisto(int sz){ - - for (int i=sz;i>1;i--) - if (*wordp(i)==dict->oovcode()) - return 0; - return 1; - } - - int pushc(int c); - int pushw(char* w); - - //~ngram(); - - - -}; - -#endif - - - diff --git a/misc/.project b/misc/.project deleted file mode 100644 index 8da09013f..000000000 --- a/misc/.project +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>misc</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - </buildSpec> - <natures> - </natures> -</projectDescription> diff --git a/misc/GenerateTuples.cpp b/misc/GenerateTuples.cpp deleted file mode 100644 index 97b0bdd96..000000000 --- a/misc/GenerateTuples.cpp +++ /dev/null @@ -1,294 +0,0 @@ - -//////////////////////////////////////////////////////////// -// -// generate set of target candidates for confusion net -// -//////////////////////////////////////////////////////////// - - - -#include <numeric> -#include "Word.h" -#include "Phrase.h" -#include "ConfusionNet.h" -#include "WordsRange.h" -#include "PhraseDictionaryTree.h" -#if 0 -// Generates all tuples from n indexes with ranges 0 to card[j]-1, respectively.. -// Input: number of indexes and ranges: ranges[0] ... ranges[num_idx-1] -// Output: number of tuples and monodimensional array of tuples. -// Reference: mixed-radix generation algorithm (D. E. Knuth, TAOCP v. 4.2) - -size_t GenerateTuples(unsigned num_idx,unsigned* ranges,unsigned *&tuples) -{ - unsigned* single_tuple= new unsigned[num_idx+1]; - unsigned num_tuples=1; - - for (unsigned k=0;k<num_idx;++k) - { - num_tuples *= ranges[k]; - single_tuple[k]=0; - } - - tuples=new unsigned[num_idx * num_tuples]; - - // we need this additional element for the last iteration - single_tuple[num_idx]=0; - unsigned j=0; - for (unsigned n=0;n<num_tuples;++n){ - memcpy((void *)((tuples + n * num_idx)),(void *)single_tuple,num_idx * sizeof(unsigned)); - j=0; - while (single_tuple[j]==ranges[j]-1){single_tuple[j]=0; ++j;} - ++single_tuple[j]; - } - delete [] single_tuple; - return num_tuples; -} - - -typedef PhraseDictionaryTree::PrefixPtr PPtr; -typedef std::vector<PPtr> vPPtr; -typedef std::vector<std::vector<Factor const*> > mPhrase; - -std::ostream& operator<<(std::ostream& out,const mPhrase& p) { - for(size_t i=0;i<p.size();++i) { - out<<i<<" - "; - for(size_t j=0;j<p[i].size();++j) - out<<p[i][j]->ToString()<<" "; - out<<"|"; - } - - return out; -} - -struct State { - vPPtr ptrs; - WordsRange range; - float score; - - State() : range(0,0),score(0.0) {} - State(size_t b,size_t e,const vPPtr& v,float sc=0.0) : ptrs(v),range(b,e),score(sc) {} - - size_t begin() const {return range.GetStartPos();} - size_t end() const {return range.GetEndPos();} - float GetScore() const {return score;} - -}; - -std::ostream& operator<<(std::ostream& out,const State& s) { - out<<"["<<s.ptrs.size()<<" ("<<s.begin()<<","<<s.end()<<") "<<s.GetScore()<<"]"; - - return out; -} - -typedef std::map<mPhrase,float> E2Costs; - - -struct GCData { - const std::vector<PhraseDictionaryTree const*>& pdicts; - const std::vector<std::vector<float> >& weights; - std::vector<FactorType> inF,outF; - size_t distinctOutputFactors; - vPPtr root; - size_t totalTuples,distinctTuples; - - - GCData(const std::vector<PhraseDictionaryTree const*>& a, - const std::vector<std::vector<float> >& b) - : pdicts(a),weights(b),totalTuples(0),distinctTuples(0) { - - assert(pdicts.size()==weights.size()); - std::set<FactorType> distinctOutFset; - inF.resize(pdicts.size()); - outF.resize(pdicts.size()); - root.resize(pdicts.size()); - for(size_t i=0;i<pdicts.size();++i) - { - root[i]=pdicts[i]->GetRoot(); - inF[i]=pdicts[i]->GetInputFactorType(); - outF[i]=pdicts[i]->GetOutputFactorType(); - distinctOutFset.insert(pdicts[i]->GetOutputFactorType()); - } - distinctOutputFactors=distinctOutFset.size(); - } - - FactorType OutFT(size_t i) const {return outF[i];} - FactorType InFT(size_t i) const {return inF[i];} - size_t DistinctOutFactors() const {return distinctOutputFactors;} - - const vPPtr& GetRoot() const {return root;} - -}; - -typedef std::vector<Factor const*> vFactor; -typedef std::vector<std::pair<float,vFactor> > TgtCandList; - -typedef std::vector<TgtCandList> OutputFactor2TgtCandList; -typedef std::vector<OutputFactor2TgtCandList*> Len2Cands; - -void GeneratePerFactorTgtList(size_t factorType,PPtr pptr,GCData& data,Len2Cands& len2cands) -{ - std::vector<FactorTgtCand> cands; - data.pdicts[factorType]->GetTargetCandidates(pptr,cands); - - for(std::vector<FactorTgtCand>::const_iterator cand=cands.begin();cand!=cands.end();++cand) { - assert(data.weights[factorType].size()==cand->second.size()); - float costs=std::inner_product(data.weights[factorType].begin(), - data.weights[factorType].end(), - cand->second.begin(), - 0.0); - - size_t len=cand->first.size(); - if(len>=len2cands.size()) len2cands.resize(len+1,0); - if(!len2cands[len]) len2cands[len]=new OutputFactor2TgtCandList(data.DistinctOutFactors()); - OutputFactor2TgtCandList &outf2tcandlist=*len2cands[len]; - - outf2tcandlist[data.OutFT(factorType)].push_back(std::make_pair(costs,cand->first)); - } -} - -void GenerateTupleTgtCands(OutputFactor2TgtCandList& tCand,E2Costs& e2costs,GCData& data) -{ - // check if candidates are non-empty - bool gotCands=1; - for(size_t j=0;gotCands && j<tCand.size();++j) - gotCands &= !tCand[j].empty(); - - if(gotCands) { - // enumerate tuples - assert(data.DistinctOutFactors()==tCand.size()); - std::vector<unsigned> radix(data.DistinctOutFactors()); - for(size_t i=0;i<tCand.size();++i) radix[i]=tCand[i].size(); - - unsigned *tuples=0; - size_t numTuples=GenerateTuples(radix.size(),&radix[0],tuples); - - data.totalTuples+=numTuples; - - for(size_t i=0;i<numTuples;++i) - { - mPhrase e(radix.size());float costs=0.0; - for(size_t j=0;j<radix.size();++j) - { - assert(tuples[radix.size()*i+j]<tCand[j].size()); - std::pair<float,vFactor> const& mycand=tCand[j][tuples[radix.size()*i+j]]; - e[j]=mycand.second; - costs+=mycand.first; - } -#ifdef DEBUG - bool mismatch=0; - for(size_t j=1;!mismatch && j<e.size();++j) - if(e[j].size()!=e[j-1].size()) mismatch=1; - assert(mismatch==0); -#endif - std::pair<E2Costs::iterator,bool> p=e2costs.insert(std::make_pair(e,costs)); - if(p.second) ++data.distinctTuples; - else { - // entry known, take min of costs, alternative: sum probs - if(costs<p.first->second) p.first->second=costs; - } - } - delete [] tuples; - } -} - -void GenerateCandidates_(E2Costs& e2costs,const vPPtr& nextP,GCData& data) -{ - Len2Cands len2cands; - // generate candidates for each element of nextP: - for(size_t factorType=0;factorType<nextP.size();++factorType) - if(nextP[factorType]) - GeneratePerFactorTgtList(factorType,nextP[factorType],data,len2cands); - - // for each length: enumerate tuples, compute score, and insert in e2costs - for(size_t len=0;len<len2cands.size();++len) if(len2cands[len]) - GenerateTupleTgtCands(*len2cands[len],e2costs,data); -} - -void GenerateCandidates(const ConfusionNet& src, - const std::vector<PhraseDictionaryTree const*>& pdicts, - const std::vector<std::vector<float> >& weights, - int verbose) { - GCData data(pdicts,weights); - - std::vector<State> stack; - for(size_t i=0;i<src.GetSize();++i) stack.push_back(State(i,i,data.GetRoot())); - - std::map<WordsRange,E2Costs> cov2E; - - // std::cerr<<"start while loop. initial stack size: "<<stack.size()<<"\n"; - - while(!stack.empty()) - { - State curr(stack.back()); - stack.pop_back(); - - //std::cerr<<"processing state "<<curr<<" stack size: "<<stack.size()<<"\n"; - - assert(curr.end()<src.GetSize()); - const ConfusionNet::Column &currCol=src[curr.end()]; - for(size_t colidx=0;colidx<currCol.size();++colidx) - { - const Word& w=currCol[colidx].first; - vPPtr nextP(curr.ptrs); - for(size_t j=0;j<nextP.size();++j) - nextP[j]=pdicts[j]->Extend(nextP[j], - w.GetFactor(data.InFT(j))->GetString()); - - bool valid=1; - for(size_t j=0;j<nextP.size();++j) if(!nextP[j]) {valid=0;break;} - - if(valid) - { - if(curr.end()+1<src.GetSize()) - stack.push_back(State(curr.begin(),curr.end()+1,nextP, - curr.GetScore()+currCol[colidx].second)); - - E2Costs &e2costs=cov2E[WordsRange(curr.begin(),curr.end()+1)]; - GenerateCandidates_(e2costs,nextP,data); - } - } - - // check if there are translations of one-word phrases ... - //if(curr.begin()==curr.end() && tCand.empty()) {} - - } // end while(!stack.empty()) - - if(verbose) { - // print statistics for debugging purposes - std::cerr<<"tuple stats: total: "<<data.totalTuples - <<" distinct: "<<data.distinctTuples<<" (" - <<(data.distinctTuples/(0.01*data.totalTuples)) - <<"%)\n"; - std::cerr<<"per coverage set:\n"; - for(std::map<WordsRange,E2Costs>::const_iterator i=cov2E.begin(); - i!=cov2E.end();++i) { - std::cerr<<i->first<<" -- distinct cands: " - <<i->second.size()<<"\n"; - } - std::cerr<<"\n\n"; - } - - if(verbose>10) { - std::cerr<<"full list:\n"; - for(std::map<WordsRange,E2Costs>::const_iterator i=cov2E.begin(); - i!=cov2E.end();++i) { - std::cerr<<i->first<<" -- distinct cands: " - <<i->second.size()<<"\n"; - for(E2Costs::const_iterator j=i->second.begin();j!=i->second.end();++j) - std::cerr<<j->first<<" -- "<<j->second<<"\n"; - } - } -} - -#else - -void GenerateCandidates(const ConfusionNet&, - const std::vector<PhraseDictionaryTree const*>&, - const std::vector<std::vector<float> >&, - int) -{ - std::cerr<<"ERROR: GenerateCandidates is currently broken\n"; -} - -#endif diff --git a/misc/GenerateTuples.h b/misc/GenerateTuples.h deleted file mode 100644 index 362c1534f..000000000 --- a/misc/GenerateTuples.h +++ /dev/null @@ -1,12 +0,0 @@ -// $Id$ -#ifndef GENERATETUPLES_H_ -#define GENERATETUPLES_H_ -#include "PhraseDictionaryTree.h" - -class ConfusionNet; - -void GenerateCandidates(const ConfusionNet& src, - const std::vector<PhraseDictionaryTree const*>& pdicts, - const std::vector<std::vector<float> >& weights, - int verbose=0) ; -#endif diff --git a/misc/Makefile b/misc/Makefile deleted file mode 100644 index ab038611e..000000000 --- a/misc/Makefile +++ /dev/null @@ -1,26 +0,0 @@ - - -BOOSTDIR=/home/ws06/cdyer/boost-stage -SRIDIR=/home/ws06/cdyer/srilm/lib/i686 -CXX=g++ -CXXFLAGS=-W -Wall -O0 -g -ggdb -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -LDFLAGS=-static -INCLUDES=-I../moses/src -I$(BOOSTDIR) -I$(BOOSTDIR)/include -BOOSTLIBS=-L$(BOOSTDIR)/lib -L$(BOOSTDIR)/stage/lib -lboost_iostreams-gcc-mt -lboost_filesystem-gcc-mt -lboost_thread-gcc-mt -lz -SRILIBS=-L$(SRIDIR) -loolm -ldstruct -lmisc - -default: processPhraseTable - -%.o: %.cpp - $(CXX) $(CXXFLAGS) $(INCLUDES) $< -c -o $@ - - - -MOSESLIB =../moses/src/libmoses.a - -processPhraseTable: processPhraseTable.o GenerateTuples.o $(MOSESLIB) - $(CXX) $(LDFLAGS) $^ -o $@ $(SRILIBS) $(BOOSTLIBS) - - - - diff --git a/misc/processPhraseTable.cpp b/misc/processPhraseTable.cpp deleted file mode 100644 index 9a92daeac..000000000 --- a/misc/processPhraseTable.cpp +++ /dev/null @@ -1,193 +0,0 @@ -#include <iostream> -//#include <fstream> -#include <sstream> -#include <vector> -#include <string> -#include <iterator> -#include <functional> -#include <sys/stat.h> -#include "TypeDef.h" -#include "PhraseDictionaryTree.h" -#include "ConfusionNet.h" -#include "FactorCollection.h" -#include "Phrase.h" -#include "InputFileStream.h" -#include "Timer.h" - -Timer timer; - -template<typename T> -std::ostream& operator<<(std::ostream& out,const std::vector<T>& x) -{ - out<<x.size()<<" "; - typename std::vector<T>::const_iterator iend=x.end(); - for(typename std::vector<T>::const_iterator i=x.begin();i!=iend;++i) - out<<*i<<' '; - return out; -} - -FactorType getFactorType(int i) { - switch(i) { - case 0: return Surface; - case 1: return POS; - case 2: return Stem; - case 3: return Morphology; - } - return Surface; -} - - -FactorCollection factorCollection; - -inline bool existsFile(const char* filename) { - struct stat mystat; - return (stat(filename,&mystat)==0); -} -inline bool existsFile(const std::string& filename) { - return existsFile(filename.c_str()); -} - -int main(int argc,char **argv) { - std::string fto;size_t noScoreComponent=5;int cn=0; - std::vector<std::pair<std::string,std::pair<char*,char*> > > ftts; - int verb=0; - for(int i=1;i<argc;++i) { - std::string s(argv[i]); - if(s=="-ttable") { - std::pair<char*,char*> p; - p.first=argv[++i]; - p.second=argv[++i]; - ftts.push_back(std::make_pair(std::string(argv[++i]),p)); - } - else if(s=="-nscores") noScoreComponent=atoi(argv[++i]); - else if(s=="-out") fto=std::string(argv[++i]); - else if(s=="-cn") cn=1; - else if(s=="-irst") cn=2; - else if(s=="-v") verb=atoi(argv[++i]); - else if(s=="-h") - { - std::cerr<<"usage "<<argv[0]<<" :\n\n" - "options:\n" - "\t-ttable int int string -- translation table file, use '-' for stdin\n" - "\t-out string -- output file name prefix for binary ttable\n" - "\t-nscores int -- number of scores in ttable\n" - "\nfunctions:\n" - "\t - convert ascii ttable in binary format\n" - "\t - if ttable is not read from stdin:\n" - "\t treat each line as source phrase an print tgt candidates\n" - "\n"; - return 1; - } - else - { - std::cerr<<"ERROR: unknown option '"<<s<<"'\n"; - return 1; - } - } - - if(ftts.size()) { - std::cerr<<"processing ptree for\n"; - - if(ftts.size()==1 && ftts[0].first=="-") { - PhraseDictionaryTree pdt(noScoreComponent); - pdt.Create(std::cin,fto);} - else - { -#if 0 - std::vector<PhraseDictionaryTree const*> pdicts; - std::vector<FactorType> factorOrder; - for(size_t i=0;i<ftts.size();++i) { - - PhraseDictionaryTree *pdtptr=new PhraseDictionaryTree(noScoreComponent, - &factorCollection, - getFactorType(atoi(ftts[i].second.first)), - getFactorType(atoi(ftts[i].second.second)) - ); - factorOrder.push_back(pdtptr->GetInputFactorType()); - PhraseDictionaryTree &pdt=*pdtptr; - pdicts.push_back(pdtptr); - - std::string facStr="."+std::string(ftts[i].second.first)+"-"+std::string(ftts[i].second.second); - std::string prefix=ftts[i].first+facStr; - if(!existsFile(prefix+".binphr.idx")) { - std::cerr<<"bin ttable does not exist -> create it\n"; - InputFileStream in(prefix); - pdt.Create(in,prefix); - } - std::cerr<<"reading bin ttable\n"; - pdt.Read(prefix); - } - - std::cerr<<"processing stdin\n"; - if(!cn) { - std::string line; - while(getline(std::cin,line)) { - std::istringstream is(line); -#if 0 - std::vector<std::string> f; - std::copy(std::istream_iterator<std::string>(is), - std::istream_iterator<std::string>(), - std::back_inserter(f)); -#endif - std::cerr<<"got source phrase '"<<line<<"'\n"; - - Phrase F(Input); - F.CreateFromString(factorOrder,line,factorCollection); - - for(size_t k=0;k<pdicts.size();++k) { - PhraseDictionaryTree const& pdt=*pdicts[k]; - - std::vector<std::string> f(F.GetSize()); - for(size_t i=0;i<F.GetSize();++i) - f[i]=F.GetFactor(i,pdt.GetInputFactorType())->ToString(); - - std::stringstream iostA,iostB; - std::cerr<<"full phrase processing "<<f<<"\n"; - pdt.PrintTargetCandidates(f,iostA); - - std::cerr<<"processing with prefix ptr\n"; - PhraseDictionaryTree::PrefixPtr p(pdt.GetRoot()); - - for(size_t i=0;i<f.size() && p;++i) { - std::cerr<<"pre "<<i<<" "<<(p?"1":"0")<<"\n"; - p=pdt.Extend(p,f[i]); - std::cerr<<"post "<<i<<" "<<(p?"1":"0")<<"\n"; - } - if(p) { - std::cerr<<"retrieving candidates from prefix ptr\n"; - pdt.PrintTargetCandidates(p,iostB);} - else { - std::cerr<<"final ptr is invalid\n"; - iostB<<"there are 0 target candidates\n"; - } - if(iostA.str() != iostB.str()) - std::cerr<<"ERROR: translation candidates mismatch '"<<iostA.str()<<"' and for prefix pointer: '"<<iostB.str()<<"'\n"; - - std::cerr<<"translation candidates:\n"<<iostA.str()<<"\n"; - pdt.FreeMemory(); - - } - - } - } - else { - // process confusion net input - ConfusionNet net(&factorCollection); - std::vector<std::vector<float> > weights; - for(size_t i=0;i<pdicts.size();++i) - weights.push_back(std::vector<float>(noScoreComponent,1/(1.0*noScoreComponent))); - - while(net.ReadF(std::cin,factorOrder,cn-1)) { - net.Print(std::cerr); - GenerateCandidates(net,pdicts,weights,verb); - } - - } -#else - std::cerr<<"ERROR: these functions are currently broken...\n"; - exit(1); -#endif - } - } - -} diff --git a/moses-cmd/.cdtbuild b/moses-cmd/.cdtbuild deleted file mode 100644 index 0e19ab66a..000000000 --- a/moses-cmd/.cdtbuild +++ /dev/null @@ -1,268 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?fileVersion 3.0.0?> - -<ManagedProjectBuildInfo> -<project id="moses-cmd.cdt.managedbuild.target.gnu.exe.880461730" name="Executable (Gnu)" projectType="cdt.managedbuild.target.gnu.exe"> -<configuration artifactName="moses-cmd" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.exe.debug.862821065" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug"> -<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.442539703" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.exe.debug"> -<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.626133972" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug"/> -<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.381079048" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug"> -<option id="gnu.cpp.compiler.option.include.paths.1241301640" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> -<listOptionValue builtIn="false" value="${ProjDirPath}/../moses/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../irstlm/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/include/boost-1_33_1"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/misc/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/dstruct/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/include"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/lm/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysql/include"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib"/> -</option> -<option id="gnu.cpp.compiler.option.preprocessor.def.1028025969" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols"> -<listOptionValue builtIn="false" value="LM_SRI"/> -<listOptionValue builtIn="false" value="TRACE_ENABLE"/> -</option> -<option id="gnu.cpp.compiler.option.debugging.gprof.514527174" superClass="gnu.cpp.compiler.option.debugging.gprof" value="false" valueType="boolean"/> -</tool> -<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1905266391" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/> -<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.888044188" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug"> -<option id="gnu.cpp.link.option.libs.427302130" superClass="gnu.cpp.link.option.libs" valueType="libs"> -<listOptionValue builtIn="false" value="pthread"/> -<listOptionValue builtIn="false" value="mysqlclient"/> -<listOptionValue builtIn="false" value="z"/> -<listOptionValue builtIn="false" value="lattice"/> -<listOptionValue builtIn="false" value="misc"/> -<listOptionValue builtIn="false" value="dstruct"/> -<listOptionValue builtIn="false" value="oolm"/> -</option> -<option id="gnu.cpp.link.option.paths.1718276622" superClass="gnu.cpp.link.option.paths" valueType="stringList"> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysql/lib"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/lib/i686"/> -</option> -<option id="gnu.cpp.link.option.userobjs.551693347" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs"> -<listOptionValue builtIn="false" value="${ProjDirPath}/../moses/${ConfigName}/libmoses.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../irstlm/${ConfigName}/libirstlm.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/lib/libboost_filesystem-gcc.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/lib/libboost_iostreams-gcc.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/lib/libboost_thread-gcc-mt.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/manip.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/myset.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/qparms.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/sql_string.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/string_util.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/type_info.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/vallist.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/coldata.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/datetime.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/field_names.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/field_types.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/result.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/query.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/connection.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/row.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/fields.o"/> -</option> -<option id="gnu.cpp.link.option.flags.1995182231" superClass="gnu.cpp.link.option.flags" value="" valueType="string"/> -</tool> -<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.1540394737" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug"/> -<macros/> -</toolChain> -</configuration> -<configuration artifactName="moses-cmd" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.exe.release.1126249995" name="Release" parent="cdt.managedbuild.config.gnu.exe.release"> -<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1691856622" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.exe.release"> -<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1171408650" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release"/> -<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1960479367" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release"> -<option id="gnu.cpp.compiler.option.include.paths.1986529351" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> -<listOptionValue builtIn="false" value="${ProjDirPath}/../moses/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../irstlm/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/include/boost-1_33_1"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/misc/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/dstruct/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/include"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/lm/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysql/include"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib"/> -</option> -<option id="gnu.cpp.compiler.option.preprocessor.def.542441515" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols"> -<listOptionValue builtIn="false" value="LM_SRI"/> -<listOptionValue builtIn="false" value="TRACE_ENABLE"/> -</option> -<option id="gnu.cpp.compiler.option.debugging.gprof.24360799" superClass="gnu.cpp.compiler.option.debugging.gprof" value="false" valueType="boolean"/> -</tool> -<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.285054015" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/> -<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1153317521" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release"> -<option id="gnu.cpp.link.option.libs.1100640875" superClass="gnu.cpp.link.option.libs" valueType="libs"> -<listOptionValue builtIn="false" value="pthread"/> -<listOptionValue builtIn="false" value="mysqlclient"/> -<listOptionValue builtIn="false" value="z"/> -<listOptionValue builtIn="false" value="lattice"/> -<listOptionValue builtIn="false" value="misc"/> -<listOptionValue builtIn="false" value="dstruct"/> -<listOptionValue builtIn="false" value="oolm"/> -</option> -<option id="gnu.cpp.link.option.paths.724264639" superClass="gnu.cpp.link.option.paths" valueType="stringList"> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysql/lib"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/lib/i686"/> -</option> -<option id="gnu.cpp.link.option.userobjs.1365891611" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs"> -<listOptionValue builtIn="false" value="${ProjDirPath}/../moses/${ConfigName}/libmoses.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../irstlm/${ConfigName}/libirstlm.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/lib/libboost_filesystem-gcc.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/lib/libboost_iostreams-gcc.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/lib/libboost_thread-gcc-mt.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/manip.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/myset.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/qparms.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/sql_string.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/string_util.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/type_info.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/vallist.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/coldata.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/datetime.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/field_names.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/field_types.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/result.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/query.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/connection.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/row.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/fields.o"/> -</option> -<option id="gnu.cpp.link.option.flags.213483667" superClass="gnu.cpp.link.option.flags" value="" valueType="string"/> -</tool> -<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.1402140367" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release"/> -<macros/> -</toolChain> -</configuration> -<configuration artifactName="moses-cmd" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.exe.debug.807464492" name="DebugNBest" parent="cdt.managedbuild.config.gnu.exe.debug"> -<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.531059494" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.exe.debug"> -<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.55255226" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug"/> -<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.103376107" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug"> -<option id="gnu.cpp.compiler.option.include.paths.2145251726" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> -<listOptionValue builtIn="false" value="${ProjDirPath}/../moses/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../irstlm/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/include/boost-1_33_1"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/misc/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/dstruct/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/include"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/lm/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysql/include"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib"/> -</option> -<option id="gnu.cpp.compiler.option.preprocessor.def.196944732" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols"> -<listOptionValue builtIn="false" value="LM_SRI"/> -<listOptionValue builtIn="false" value="TRACE_ENABLE"/> -<listOptionValue builtIn="false" value="N_BEST"/> -</option> -<option id="gnu.cpp.compiler.option.debugging.gprof.728581842" superClass="gnu.cpp.compiler.option.debugging.gprof" value="false" valueType="boolean"/> -</tool> -<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.472952110" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/> -<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.1942657060" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug"> -<option id="gnu.cpp.link.option.libs.1462416765" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs"> -<listOptionValue builtIn="false" value="pthread"/> -<listOptionValue builtIn="false" value="mysqlclient"/> -<listOptionValue builtIn="false" value="z"/> -<listOptionValue builtIn="false" value="lattice"/> -<listOptionValue builtIn="false" value="misc"/> -<listOptionValue builtIn="false" value="dstruct"/> -<listOptionValue builtIn="false" value="oolm"/> -</option> -<option id="gnu.cpp.link.option.paths.2032452995" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="stringList"> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysql/lib"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/lib/i686"/> -</option> -<option id="gnu.cpp.link.option.userobjs.2014263007" name="Other objects" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs"> -<listOptionValue builtIn="false" value="${ProjDirPath}/../moses/${ConfigName}/libmoses.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../irstlm/${ConfigName}/libirstlm.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/lib/libboost_filesystem-gcc.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/lib/libboost_iostreams-gcc.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/lib/libboost_thread-gcc-mt.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/manip.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/myset.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/qparms.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/sql_string.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/string_util.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/type_info.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/vallist.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/coldata.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/datetime.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/field_names.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/field_types.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/result.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/query.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/connection.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/row.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/fields.o"/> -</option> -<option id="gnu.cpp.link.option.flags.806618667" superClass="gnu.cpp.link.option.flags" value="" valueType="string"/> -</tool> -<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.1424900936" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug"/> -<macros/> -</toolChain> -</configuration> -<configuration artifactName="moses-cmd" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.exe.release.797815336" name="ReleaseNBest" parent="cdt.managedbuild.config.gnu.exe.release"> -<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1069742386" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.exe.release"> -<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.151444721" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release"/> -<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1731051429" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release"> -<option id="gnu.cpp.compiler.option.include.paths.46087237" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> -<listOptionValue builtIn="false" value="${ProjDirPath}/../moses/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../irstlm/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/include/boost-1_33_1"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/misc/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/dstruct/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/include"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/lm/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysql/include"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib"/> -</option> -<option id="gnu.cpp.compiler.option.preprocessor.def.324132996" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols"> -<listOptionValue builtIn="false" value="LM_SRI"/> -<listOptionValue builtIn="false" value="TRACE_ENABLE"/> -<listOptionValue builtIn="false" value="N_BEST"/> -</option> -</tool> -<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.691341260" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/> -<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1920640347" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release"> -<option id="gnu.cpp.link.option.libs.1023851287" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs"> -<listOptionValue builtIn="false" value="pthread"/> -<listOptionValue builtIn="false" value="mysqlclient"/> -<listOptionValue builtIn="false" value="z"/> -<listOptionValue builtIn="false" value="lattice"/> -<listOptionValue builtIn="false" value="misc"/> -<listOptionValue builtIn="false" value="dstruct"/> -<listOptionValue builtIn="false" value="oolm"/> -</option> -<option id="gnu.cpp.link.option.paths.995589625" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="stringList"> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysql/lib"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/lib/i686"/> -</option> -<option id="gnu.cpp.link.option.userobjs.288492909" name="Other objects" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs"> -<listOptionValue builtIn="false" value="${ProjDirPath}/../moses/${ConfigName}/libmoses.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../irstlm/${ConfigName}/libirstlm.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/lib/libboost_filesystem-gcc.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/lib/libboost_iostreams-gcc.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/lib/libboost_thread-gcc-mt.a"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/manip.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/myset.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/qparms.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/sql_string.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/string_util.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/type_info.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/vallist.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/coldata.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/datetime.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/field_names.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/field_types.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/result.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/query.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/connection.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/row.o"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib/fields.o"/> -</option> -</tool> -<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.391536868" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release"/> -<macros/> -</toolChain> -</configuration> -<macros/> -</project> -</ManagedProjectBuildInfo> diff --git a/moses-cmd/.cdtproject b/moses-cmd/.cdtproject deleted file mode 100644 index 9d4253d9e..000000000 --- a/moses-cmd/.cdtproject +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse-cdt version="2.0"?> - -<cdtproject id="org.eclipse.cdt.managedbuilder.core.managedMake"> -<extension id="org.eclipse.cdt.managedbuilder.core.ManagedBuildManager" point="org.eclipse.cdt.core.ScannerInfoProvider"/> -<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> -<extension id="org.eclipse.cdt.core.nullindexer" point="org.eclipse.cdt.core.CIndexer"/> -<data> -<item id="org.eclipse.cdt.core.pathentry"> -<pathentry kind="src" path=""/> -<pathentry kind="out" path=""/> -<pathentry kind="con" path="org.eclipse.cdt.managedbuilder.MANAGED_CONTAINER"/> -</item> -</data> -</cdtproject> diff --git a/moses-cmd/.cvsignore b/moses-cmd/.cvsignore deleted file mode 100644 index 115b864d6..000000000 --- a/moses-cmd/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Debug* -Release* - -gmon.out diff --git a/moses-cmd/.project b/moses-cmd/.project deleted file mode 100644 index d53cf546e..000000000 --- a/moses-cmd/.project +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>moses-cmd</name> - <comment></comment> - <projects> - <project>irstlm</project> - <project>moses</project> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.cdt.core.cnature</nature> - <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> - <nature>org.eclipse.cdt.core.ccnature</nature> - </natures> -</projectDescription> diff --git a/moses-cmd/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/moses-cmd/.settings/org.eclipse.cdt.managedbuilder.core.prefs deleted file mode 100644 index 6e3c357b6..000000000 --- a/moses-cmd/.settings/org.eclipse.cdt.managedbuilder.core.prefs +++ /dev/null @@ -1,18 +0,0 @@ -#Tue Jul 25 11:19:35 EDT 2006 -=\=\=\=\=\=\= -<<<<<<<=org.eclipse.cdt.managedbuilder.core.prefs ->>>>>>>=1.2 -eclipse.preferences.version=1 -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.807464492=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.862821065=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1126249995=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.797815336=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.807464492=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.862821065=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.release.1126249995=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.release.797815336=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n -environment/project=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n -environment/project/cdt.managedbuild.config.gnu.exe.debug.807464492=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n -environment/project/cdt.managedbuild.config.gnu.exe.debug.862821065=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n -environment/project/cdt.managedbuild.config.gnu.exe.release.1126249995=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n -environment/project/cdt.managedbuild.config.gnu.exe.release.797815336=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n diff --git a/moses-cmd/Makefile.am b/moses-cmd/Makefile.am deleted file mode 100644 index 9b16c41cc..000000000 --- a/moses-cmd/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# not a GNU package. You can remove this line, if -# have all needed files, that a GNU package needs -#AUTOMAKE_OPTIONS = foreign 1.4 -SUBDIRS = src - diff --git a/moses-cmd/Makefile.in b/moses-cmd/Makefile.in deleted file mode 100644 index e6530e546..000000000 --- a/moses-cmd/Makefile.in +++ /dev/null @@ -1,574 +0,0 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 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 = : -subdir = . -DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(top_srcdir)/configure depcomp install-sh missing -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.in -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_HEADER = config.h -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) -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@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BUILD_MYSQL_SUPPORT_FALSE = @BUILD_MYSQL_SUPPORT_FALSE@ -BUILD_MYSQL_SUPPORT_TRUE = @BUILD_MYSQL_SUPPORT_TRUE@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTERNAL_LM_FALSE = @INTERNAL_LM_FALSE@ -INTERNAL_LM_TRUE = @INTERNAL_LM_TRUE@ -IRST_LM_FALSE = @IRST_LM_FALSE@ -IRST_LM_TRUE = @IRST_LM_TRUE@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MYSQLCLIENT_CPPFLAGS = @MYSQLCLIENT_CPPFLAGS@ -MYSQLCLIENT_LDFLAGS = @MYSQLCLIENT_LDFLAGS@ -MYSQLCLIENT_LIBS = @MYSQLCLIENT_LIBS@ -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@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SRI_LM_FALSE = @SRI_LM_FALSE@ -SRI_LM_TRUE = @SRI_LM_TRUE@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -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_alias = @build_alias@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -# not a GNU package. You can remove this line, if -# have all needed files, that a GNU package needs -#AUTOMAKE_OPTIONS = foreign 1.4 -SUBDIRS = src -all: config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -.SUFFIXES: -am--refresh: - @: -$(srcdir)/Makefile.in: $(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: $(am__configure_deps) - cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) - -config.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) stamp-h1; \ - else :; fi - -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: $(am__configure_deps) - cd $(top_srcdir) && $(AUTOHEADER) - rm -f stamp-h1 - touch $@ - -distclean-hdr: - -rm -f config.h stamp-h1 -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): - @set fnord $$MAKEFLAGS; amf=$$2; \ - 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) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - 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: - @set fnord $$MAKEFLAGS; amf=$$2; \ - 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) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - 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) config.h.in $(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) config.h.in $(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) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) config.h.in $(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) - @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 - -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 config.h -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 mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-hdr 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 $(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 - -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 am--refresh check \ - check-am clean clean-generic clean-recursive ctags \ - ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ - dist-tarZ dist-zip distcheck distclean distclean-generic \ - distclean-hdr 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-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-generic 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/moses-cmd/aclocal.m4 b/moses-cmd/aclocal.m4 deleted file mode 100644 index ef60f9840..000000000 --- a/moses-cmd/aclocal.m4 +++ /dev/null @@ -1,1044 +0,0 @@ -# generated automatically by aclocal 1.9.2 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# 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. - -# -*- Autoconf -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. -# Generated from amversion.in; do not edit by hand. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - -# 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. -AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION so it can be traced. -# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.9.2])]) - -# AM_AUX_DIR_EXPAND - -# Copyright (C) 2001, 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# 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 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 6 - -# 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]) -AC_SUBST([$1_FALSE]) -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])]) - -# serial 7 -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 -# 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - - -# 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], 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/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]) -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 -# 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -#serial 2 - -# _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. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /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"]) -]) - -# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 2000, 2001, 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 7 - -# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. -AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) - -# Do all the work for Automake. -*- Autoconf -*- - -# 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. - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 11 - -# 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.58])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 -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -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 - 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 -]) -]) - - -# 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_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $1 | $1:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. - -# Copyright (C) 2001, 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"$am_aux_dir/install-sh"} -AC_SUBST(install_sh)]) - -# -*- Autoconf -*- -# Copyright (C) 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 1 - -# 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])]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 - -# 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 -]) - -# -*- Autoconf -*- - - -# Copyright (C) 1997, 1999, 2000, 2001, 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - -# 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 -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 -]) - -# AM_PROG_MKDIR_P -# --------------- -# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. - -# Copyright (C) 2003, 2004 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories -# created by `make install' are always world readable, even if the -# installer happens to have an overly restrictive umask (e.g. 077). -# This was a mistake. There are at least two reasons why we must not -# use `-m 0755': -# - it causes special bits like SGID to be ignored, -# - it may be too restrictive (some setups expect 775 directories). -# -# Do not use -m 0755 and let people choose whatever they expect by -# setting umask. -# -# We cannot accept any implementation of `mkdir' that recognizes `-p'. -# Some implementations (such as Solaris 8's) are not thread-safe: if a -# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' -# concurrently, both version can detect that a/ is missing, but only -# one can create it and the other will error out. Consequently we -# restrict ourselves to GNU make (using the --version option ensures -# this.) -AC_DEFUN([AM_PROG_MKDIR_P], -[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi -AC_SUBST([mkdir_p])]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 - -# _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. -# - -# Copyright (C) 1996, 1997, 2000, 2001, 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - -# 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)]) - -# AM_PROG_INSTALL_STRIP - -# Copyright (C) 2001, 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# 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="\${SHELL} \$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 1 - - -# _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/moses-cmd/acsite.m4 b/moses-cmd/acsite.m4 deleted file mode 100644 index 36ed5c2bf..000000000 --- a/moses-cmd/acsite.m4 +++ /dev/null @@ -1,3 +0,0 @@ -builtin(include,config/mysql-client.m4) -builtin(include,config/mysql++.m4) - diff --git a/moses-cmd/config.h.in b/moses-cmd/config.h.in deleted file mode 100644 index 10bc1419c..000000000 --- a/moses-cmd/config.h.in +++ /dev/null @@ -1,58 +0,0 @@ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef HAVE_INTTYPES_H - -/* flag for IRSTLM */ -#undef HAVE_IRSTLM - -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* flag for SRILM */ -#undef HAVE_SRILM - -/* Define to 1 if you have the <stdint.h> header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION diff --git a/moses-cmd/config.in b/moses-cmd/config.in deleted file mode 100644 index 0f4b2d35b..000000000 --- a/moses-cmd/config.in +++ /dev/null @@ -1,93 +0,0 @@ -AC_INIT(src) - -AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(moses, 0.1) - -AC_PROG_CXX -AC_LANG_CPLUSPLUS -AC_PROG_RANLIB -#AM_PROG_LIBTOOL - -AC_ARG_WITH(srilm, - [AC_HELP_STRING([--with-srilm=PATH], [(optional) path to SRI's LM toolkit])], - [with_srilm=$withval], - [with_srilm=no] - ) - -AC_ARG_WITH(boost, - [AC_HELP_STRING([--with-srilm=PATH], [path to BOOST libraries])], - [with_boost=$withval], - [with_boost=no] - ) - -AC_ARG_WITH(moses, - [AC_HELP_STRING([--with-moses=PATH], [path to moses library])], - [with_moses=$withval], - [with_moses=no] - ) - -AC_ARG_ENABLE(mysql, AC_HELP_STRING([--enable-mysql], [(optional) build in MySQL support])], - [mysql_flag=yes], [mysql_flag=no]) -if test "x$with_boost" != 'xno' -then - CPPFLAGS="$CPPFLAGS -I${with_boost}" - LDFLAGS="$LDFLAGS -L${with_boost}/lib -L${with_boost}/stage/lib" -fi - -if test "x$with_moses" != 'xno' -then - CPPFLAGS="$CPPFLAGS -I${with_moses}/src" - LDFLAGS="$LDFLAGS -L${with_moses}/src" -fi -LIBS="$LIBS -lmoses" - -AC_CHECK_HEADER([Manager.h], [], [AC_MSG_ERROR([Cannot find moses headers! Use --with-moses=PATH])]) -AC_CHECK_HEADER([boost/algorithm/string.hpp], [], [AC_MSG_ERROR([Cannot find boost. Use --with-boost=PATH])]) -AC_CHECK_HEADER([boost/iostreams/filtering_stream.hpp], [], [AC_MSG_ERROR([Cannot find boost. Use --with-boost=PATH])]) - -if test "$mysql_flag" = 'yes' -then - AC_MYSQLCLIENT(,, - [AC_ERROR([Could not locate mysql client libraries. Try --with-mysql-prefix/-include/-lib])]) - LDFLAGS="$LDFLAGS $MYSQLCLIENT_LDFLAGS" - CPPFLAGS="$CPPFLAGS $MYSQLCLIENT_CPPFLAGS" - LIBS="$LIBS $MYSQLCLIENT_LIBS" - - MYSQLPP_DEVEL - LIBS="$LIBS -lmysqlpp" - - AM_CONDITIONAL([BUILD_MYSQL_SUPPORT], true) -else - AM_CONDITIONAL([BUILD_MYSQL_SUPPORT], false) -fi - -if test "x$with_srilm" != 'xno' -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I${with_srilm}/include" - - AC_CHECK_HEADER(Ngram.h, - [AC_DEFINE([HAVE_SRILM], [], [flag for SRILM])], - [AC_MSG_ERROR([Cannot find SRILM!])]) - - LIB_SRILM="-loolm -ldstruct -lmisc" - # ROOT/lib/i686-m64/liboolm.a - # ROOT/lib/i686-m64/libdstruct.a - # ROOT/lib/i686-m64/libmisc.a - MY_ARCH=`${with_srilm}/sbin/machine-type` - LDFLAGS="$LDFLAGS -L${with_srilm}/lib/${MY_ARCH}" - LIBS="$LIBS $LIB_SRILM" - FMTLIBS="$FMTLIBS liboolm.a libdstruct.a libmisc.a" - AM_CONDITIONAL([SRI_LM], true) - AM_CONDITIONAL([INTERNAL_LM], false) -else - echo "Using internal language model (use --with-srilm to change)!" - AM_CONDITIONAL([SRI_LM], false) - AM_CONDITIONAL([INTERNAL_LM], true) -fi - -LIBS="$LIBS -lboost_iostreams-gcc-mt -lboost_filesystem-gcc-mt -lboost_thread-gcc-mt -lz" -FMT_LIBS="$FMT_LIBS libboost_iostreams.a libboost_filesystem.a libboost_thread.a" - - -AC_OUTPUT(Makefile src/Makefile) diff --git a/moses-cmd/config/mysql++.m4 b/moses-cmd/config/mysql++.m4 deleted file mode 100644 index 862a881a1..000000000 --- a/moses-cmd/config/mysql++.m4 +++ /dev/null @@ -1,130 +0,0 @@ -#-###################################################################### -# mysql++.m4 - Example autoconf macro showing how to find MySQL++ -# library and header files. -# -# Copyright (c) 2004-2005 by Educational Technology Resources, Inc. -# -# This file 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 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with MySQL++; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 -# USA -#-###################################################################### - -dnl @synopsis MYSQLPP_DEVEL -dnl -dnl This macro tries to find the MySQL++ library and header files. -dnl -dnl We define the following configure script flags: -dnl -dnl --with-mysqlpp: Give prefix for both library and headers, and try -dnl to guess subdirectory names for each. (e.g. tack /lib and -dnl /include onto given dir name, and other common schemes.) -dnl --with-mysqlpp-lib: Similar to --with-mysqlpp, but for library only. -dnl --with-mysqlpp-include: Similar to --with-mysqlpp, but for headers -dnl only. -dnl -dnl This macro depends on having the default compiler and linker flags -dnl set up for building programs against the MySQL C API. The mysql.m4 -dnl macro in this directory fits this bill; run it first. -dnl -dnl @version 1.0, 2005/07/13 -dnl @author Warren Young <mysqlpp@etr-usa.com> - -AC_DEFUN([MYSQLPP_DEVEL], -[ -AC_CACHE_CHECK([for MySQL++ libraries], ac_cv_mysqlpp_devel, -[ - # - # Set up configure script macros - # - AC_ARG_WITH(mysqlpp, - [ --with-mysqlpp=<path> path containing MySQL++ header and library subdirs], - [MYSQLPP_lib_check="$with_mysqlpp/lib $with_mysqlpp/lib/mysql++" - MYSQLPP_inc_check="$with_mysqlpp/include $with_mysqlpp/include/mysql++"], - [MYSQLPP_lib_check="/usr/local/mysql++/lib /usr/local/lib/mysql++ /opt/mysql++/lib /usr/lib/mysql++ /usr/local/lib /usr/lib" - MYSQLPP_inc_check="/usr/local/mysql++/include /usr/local/include/mysql++ /opt/mysql++/include /usr/local/include/mysql++ /usr/local/include /usr/include/mysql++ /usr/include"]) - AC_ARG_WITH(mysqlpp-lib, - [ --with-mysqlpp-lib=<path> directory path of MySQL++ library], - [MYSQLPP_lib_check="$with_mysqlpp_lib $with_mysqlpp_lib/lib $with_mysqlpp_lib/lib/mysql"]) - AC_ARG_WITH(mysqlpp-include, - [ --with-mysqlpp-include=<path> directory path of MySQL++ headers], - [MYSQLPP_inc_check="$with_mysqlpp_include $with_mysqlpp_include/include $with_mysqlpp_include/include/mysql"]) - - # - # Look for MySQL++ library - # - MYSQLPP_libdir= - for dir in $MYSQLPP_lib_check - do - if test -d "$dir" && \ - ( test -f "$dir/libmysqlpp.so" || - test -f "$dir/libmysqlpp.a" ) - then - MYSQLPP_libdir=$dir - break - fi - done - - if test -z "$MYSQLPP_libdir" - then - AC_MSG_ERROR([Didn't find the MySQL++ library dir in '$MYSQLPP_lib_check']) - fi - - case "$MYSQLPP_libdir" in - /* ) ;; - * ) AC_MSG_ERROR([The MySQL++ library directory ($MYSQLPP_libdir) must be an absolute path.]) ;; - esac - - AC_MSG_RESULT([lib in $MYSQLPP_libdir]) - - case "$MYSQLPP_libdir" in - /usr/lib) ;; - *) LDFLAGS="$LDFLAGS -L${MYSQLPP_libdir} -Wl,-rpath ${MYSQLPP_libdir}" ;; - esac - - # - # Look for MySQL++ headers - # - AC_MSG_CHECKING([for MySQL++ include directory]) - MYSQLPP_incdir= - for dir in $MYSQLPP_inc_check - do - if test -d "$dir" && test -f "$dir/mysql++.h" - then - MYSQLPP_incdir=$dir - break - fi - done - - if test -z "$MYSQLPP_incdir" - then - AC_MSG_ERROR([Didn't find the MySQL++ header dir in '$MYSQLPP_inc_check']) - fi - - case "$MYSQLPP_incdir" in - /* ) ;; - * ) AC_MSG_ERROR([The MySQL++ header directory ($MYSQLPP_incdir) must be an absolute path.]) ;; - esac - - AC_MSG_RESULT([$MYSQLPP_incdir]) - - CPPFLAGS="$CPPFLAGS -I${MYSQLPP_incdir}" - - AC_MSG_CHECKING([that we can build MySQL++ programs]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([#include <mysql++.h>], - [std::string s; mysqlpp::escape_string(s)])], - ac_cv_mysqlpp_devel=yes, - AC_MSG_ERROR(no)) -])]) dnl End MYSQLPP_DEVEL - diff --git a/moses-cmd/config/mysql-client.m4 b/moses-cmd/config/mysql-client.m4 deleted file mode 100644 index f12965c6b..000000000 --- a/moses-cmd/config/mysql-client.m4 +++ /dev/null @@ -1,133 +0,0 @@ -dnl Test for libmysqlclient and -dnl define MYSQLCLIENT_CPPFLAGS, MYSQLCLIENT_LDFLAGS and MYSQLCLIENT_LIBS -dnl usage: -dnl AC_MYSQLCLIENT( -dnl [MINIMUM-VERSION, -dnl [ACTION-IF-FOUND [, -dnl ACTION-IF-NOT-FOUND ]]]) -dnl - -AC_DEFUN(AC_MYSQLCLIENT, -[ -AC_ARG_WITH(mysqlclient-prefix, - [ --with-mysqlclient-prefix=PFX Prefix where mysqlclient is -installed], - mysqlclient_prefix="$withval", - mysqlclient_prefix="") - -AC_ARG_WITH(mysqlclient-include, [ --with-mysqlclient-include=DIR Directory pointing - to mysqlclient include files], - mysqlclient_include="$withval", - mysqlclient_include="") - -AC_ARG_WITH(mysqlclient-lib, -[ --with-mysqlclient-lib=LIB Directory pointing to mysqlclient library - (Note: -include and -lib do override - paths found with -prefix) -], - mysqlclient_lib="$withval", - mysqlclient_lib="") - - AC_MSG_CHECKING([for mysqlclient ifelse([$1], , ,[>= v$1])]) - MYSQLCLIENT_LDFLAGS="" - MYSQLCLIENT_CPPFLAGS="" - MYSQLCLIENT_LIBS="-lmysqlclient" - mysqlclient_fail="" - - dnl test --with-mysqlclient-prefix - for tryprefix in /usr /usr/local /usr/mysql /usr/local/mysql /usr/pkg $msqlclient_prefix; do - #testloop - for hloc in lib/mysql lib lib64/mysql lib64 ; do - if test -e "$tryprefix/$hloc/libmysqlclient.so"; then - MYSQLCLIENT_LDFLAGS="-L$tryprefix/$hloc" - fi - done - - for iloc in include/mysql include; do - if test -e "$tryprefix/$iloc/mysql.h"; then - MYSQLCLIENT_CPPFLAGS="-I$tryprefix/$iloc" - fi - done - # testloop - done - - dnl test --with-mysqlclient-include - if test "x$mysqlclient_include" != "x" ; then - echo "checking for mysql includes... " - if test -d "$mysqlclient_include/mysql" ; then - MYSQLCLIENT_CPPFLAGS="-I$mysqlclient_include" - echo " found $MYSQLCLIENT_CPPFLAGS" - elif test -d "$mysqlclient_include/include/mysql" ; then - MYSQLCLIENT_CPPFLAGS="-I$mysqlclient_include/include" - echo " found $MYSQLCLIENT_CPPFLAGS" - elif test -d "$mysqlclient_include" ; then - MYSQLCLIENT_CPPFLAGS="-I$mysqlclient_include" - echo "found $MYSQLCLIENT_CPPFLAGS" - else - echo "not found! no include dir found in $mysqlclient_include" - fi - fi - - dnl test --with-mysqlclient-lib - if test "x$mysqlclient_lib" != "x" ; then - echo "checking for mysql libx... " - if test -d "$mysqlclient_lib/lib/mysql" ; then - MYSQLCLIENT_LDFLAGS="-L$mysqlclient_lib/lib/mysql" - echo "found $MYSQLCLIENT_LDFLAGS" - elif test -d "$mysqlclient_lib/lin" ; then - MYSQLCLIENT_LDFLAGS="-L$mysqlclient_lib/lib" - echo "found $MYSQLCLIENT_LDFLAGS" - else - MYSQLCLIENT_LDFLAGS="-L$mysqlclient_lib" - echo "defaultd to $MYSQLCLIENT_LDFLAGS" - fi - fi - - ac_save_CPPFLAGS="$CPPFLAGS" - ac_save_LDFLAGS="$LDFLAGS" - ac_save_LIBS="$LIBS" - CPPFLAGS="$CPPFLAGS $MYSQLCLIENT_CPPFLAGS" - LDFLAGS="$LDFLAGS $MYSQLCLIENT_LDFLAGS" - LIBS="$LIBS $MYSQLCLIENT_LIBS" - dnl if no minimum version is given, just try to compile - dnl else try to compile AND run - AC_TRY_COMPILE([ - #include <mysql.h> - ],[ - mysql_real_connect( 0, 0, 0, 0, 0, 0, 0, 0); - ], [AC_MSG_RESULT(yes $MYSQLCLIENT_CPPFLAGS $MYSQLCLIENT_LDFLAGS) - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" - LIBS="$ac_save_LIBS" - ifelse([$2], ,:,[$2]) - ],[ - echo "no" - echo "can't compile a simple app with mysql_connnect in it. -bad." - mysqlclient_fail="yes" - ]) - - if test "x$mysqlclient_fail" != "x" ; then - dnl AC_MSG_RESULT(no) - echo - echo "***" - echo "*** mysqlclient test source had problems, check your config.log ." - echo "*** Also try one of the following switches :" - echo "*** --with-mysqlclient-prefix=PFX" - echo "*** --with-mysqlclient-include=DIR" - echo "*** --with-mysqlclient-lib=DIR" - echo "***" - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" - LIBS="$ac_save_LIBS" - ifelse([$3], ,:,[$3]) - fi - - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" - LIBS="$ac_save_LIBS" - AC_SUBST(MYSQLCLIENT_LDFLAGS) - AC_SUBST(MYSQLCLIENT_CPPFLAGS) - AC_SUBST(MYSQLCLIENT_LIBS) -]) - diff --git a/moses-cmd/configure b/moses-cmd/configure deleted file mode 100755 index facfeff35..000000000 --- a/moses-cmd/configure +++ /dev/null @@ -1,5846 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59. -# -# Copyright (C) 2003 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 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+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -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 - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; 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 || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# 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 - -# 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 - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - 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 - - ;; - 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 - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - 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=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # 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 before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, 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 - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { 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 sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -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$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# 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'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -# 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` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= - -ac_unique_file="src" -# Factoring default headers for most tests. -ac_includes_default="\ -#include <stdio.h> -#if HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif -#if HAVE_SYS_STAT_H -# include <sys/stat.h> -#endif -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#else -# if HAVE_STDLIB_H -# include <stdlib.h> -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include <memory.h> -# endif -# include <string.h> -#endif -#if HAVE_STRINGS_H -# include <strings.h> -#endif -#if HAVE_INTTYPES_H -# include <inttypes.h> -#else -# if HAVE_STDINT_H -# include <stdint.h> -# endif -#endif -#if 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 datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE RANLIB ac_ct_RANLIB CXXCPP EGREP MYSQLCLIENT_LDFLAGS MYSQLCLIENT_CPPFLAGS MYSQLCLIENT_LIBS BUILD_MYSQL_SUPPORT_TRUE BUILD_MYSQL_SUPPORT_FALSE SRI_LM_TRUE SRI_LM_FALSE INTERNAL_LM_TRUE INTERNAL_LM_FALSE IRST_LM_TRUE IRST_LM_FALSE LIBOBJS LTLIBOBJS' -ac_subst_files='' - -# 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. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -ac_prev= -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 - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -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 | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$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 ;; - - -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 ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - 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 ;; - - -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_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=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 ;; - - -*) { 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 && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - 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'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -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 - 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 - - -# 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 its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -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 - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CXX_set=${CXX+set} -ac_env_CXX_value=$CXX -ac_cv_env_CXX_set=${CXX+set} -ac_cv_env_CXX_value=$CXX -ac_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_env_CXXFLAGS_value=$CXXFLAGS -ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_cv_env_CXXFLAGS_value=$CXXFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CXXCPP_set=${CXXCPP+set} -ac_env_CXXCPP_value=$CXXCPP -ac_cv_env_CXXCPP_set=${CXXCPP+set} -ac_cv_env_CXXCPP_value=$CXXCPP - -# -# 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 this package 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 \`..'] - -_ACEOF - - cat <<_ACEOF -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] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --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] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_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 -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - --enable-profiling moses will dump profiling info - --enable-optimization compile with -O3 flag - --enable-mysql (optional) build in MySQL support] - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-srilm=PATH (optional) path to SRI's LM toolkit - --with-boost=PATH path to BOOST libraries - --with-irstlm=PATH (optional) path to IRST's LM toolkit - --with-moses=PATH path to moses library - --with-mysqlclient-prefix=PFX Prefix where mysqlclient is -installed - --with-mysqlclient-include=DIR Directory pointing - to mysqlclient include files - --with-mysqlclient-lib=LIB Directory pointing to mysqlclient library - (Note: -include and -lib do override - paths found with -prefix) - - --with-mysqlpp=<path> path containing MySQL++ header and library subdirs - --with-mysqlpp-lib=<path> directory path of MySQL++ library - --with-mysqlpp-include=<path> directory path of MySQL++ headers - -Some influential environment variables: - CXX C++ compiler command - CXXFLAGS C++ compiler flags - LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a - nonstandard directory <lib dir> - CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have - headers in a nonstandard directory <include dir> - CXXCPP C++ preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -_ACEOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style 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 - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF - -Copyright (C) 2003 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 0 -fi -exec 5>config.log -cat >&5 <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.59. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -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` -hostinfo = `(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=. - echo "PATH: $as_dir" -done - -} >&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_sep= -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=`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_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - 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: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -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, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core && - rm -rf 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 -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >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 -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -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 - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -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 `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -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 - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -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=`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 - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -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_config_headers="$ac_config_headers config.h" - -am__api_version="1.9" -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; 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 - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - -# 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. -echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$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 - - -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. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL=$ac_install_sh - fi -fi -echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$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' - -echo "$as_me:$LINENO: checking whether build environment is sane" >&5 -echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&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". - { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&5 -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 - { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! -Check your system clock" >&5 -echo "$as_me: error: newly created file is older than distributed files! -Check your system clock" >&2;} - { (exit 1); exit 1; }; } -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}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 $. echo might interpret backslashes. -# By default was `s,x,x', remove it if useless. -cat <<\_ACEOF >conftest.sed -s/[\\$]/&&/g;s/;s,x,x,$// -_ACEOF -program_transform_name=`echo $program_transform_name | sed -f conftest.sed` -rm conftest.sed - -# 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= - { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 -echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi - -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - echo "$as_me:$LINENO: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$AWK" && break -done - -echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.make <<\_ACEOF -all: - @echo 'ac_maketemp="$(MAKE)"' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftest.make -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - SET_MAKE= -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 - -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} - { (exit 1); exit 1; }; } -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=moses - VERSION=0.1 - - -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-"$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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - STRIP=$ac_ct_STRIP -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(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 -' - - - - - - -ac_ext=cc -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 -n "$ac_tool_prefix"; then - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl 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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CXX" && break -done -test -n "$ac_ct_CXX" || ac_ct_CXX="g++" - - CXX=$ac_ct_CXX -fi - - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C++ compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 - (eval $ac_compiler --version </dev/null >&5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 - (eval $ac_compiler -v </dev/null >&5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 - (eval $ac_compiler -V </dev/null >&5) 2>&5 - ac_status=$? - 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. -echo "$as_me:$LINENO: checking for C++ compiler default output file name" >&5 -echo $ECHO_N "checking for C++ compiler default output file name... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; - * ) - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C++ compiler cannot create executables -See \`config.log' for more details." >&5 -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 -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C++ compiler works" >&5 -echo $ECHO_N "checking whether the C++ compiler works... $ECHO_C" >&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' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - 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 - { { 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 -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 -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - 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 | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -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 -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -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 -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -CXXFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cxx_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$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 -for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include <stdlib.h> -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -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 -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. -echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 -echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&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 - - -echo "$as_me:$LINENO: result: $_am_result" >&5 -echo "${ECHO_T}$_am_result" >&6 -rm -f confinc confmf - -# Check whether --enable-dependency-tracking or --disable-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 - - - - -depcc="$CXX" am_compiler_list= - -echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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/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 -echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 -echo "${ECHO_T}$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 - - -ac_ext=cc -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 -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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}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 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -echo "${ECHO_T}$ac_ct_RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - RANLIB=$ac_ct_RANLIB -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -#AM_PROG_LIBTOOL - - -# Check whether --with-srilm or --without-srilm was given. -if test "${with_srilm+set}" = set; then - withval="$with_srilm" - with_srilm=$withval -else - with_srilm=no - -fi; - - -# Check whether --with-boost or --without-boost was given. -if test "${with_boost+set}" = set; then - withval="$with_boost" - with_boost=$withval -else - with_boost=no - -fi; - - -# Check whether --with-irstlm or --without-irstlm was given. -if test "${with_irstlm+set}" = set; then - withval="$with_irstlm" - with_irstlm=$withval -else - with_irstlm=no - -fi; - - -# Check whether --with-moses or --without-moses was given. -if test "${with_moses+set}" = set; then - withval="$with_moses" - with_moses=$withval -else - with_moses=no - -fi; - -# Check whether --enable-profiling or --disable-profiling was given. -if test "${enable_profiling+set}" = set; then - enableval="$enable_profiling" - CPPFLAGS="$CPPFLAGS -pg"; LDFLAGS="$LDFLAGS -pg" - -fi; - -# Check whether --enable-optimization or --disable-optimization was given. -if test "${enable_optimization+set}" = set; then - enableval="$enable_optimization" - CPPFLAGS="$CPPFLAGS -O3"; LDFLAGS="$LDFLAGS -O3" - -fi; - -# Check whether --enable-mysql or --disable-mysql was given. -if test "${enable_mysql+set}" = set; then - enableval="$enable_mysql" - mysql_flag=yes -else - mysql_flag=no -fi; - -if test "x$with_boost" != 'xno' -then - CPPFLAGS="$CPPFLAGS -I${with_boost} -I${with_boost}/include" - LDFLAGS="$LDFLAGS -L${with_boost}/lib -L${with_boost}/stage/lib" -fi - -if test "x$with_moses" != 'xno' -then - CPPFLAGS="$CPPFLAGS -I${with_moses}/src" - LDFLAGS="$LDFLAGS -L${with_moses}/src" -fi -LIBS="$LIBS -lmoses" - - -ac_ext=cc -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 -echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 -echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 -if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - 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 non-existent 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - 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 -echo "$as_me:$LINENO: result: $CXXCPP" >&5 -echo "${ECHO_T}$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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - 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 non-existent 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - 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 - { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=cc -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 - - -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - 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 -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no -fi -rm -f 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> -#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)) - exit(2); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -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 gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$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=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -if test "${ac_cv_header_Manager_h+set}" = set; then - echo "$as_me:$LINENO: checking for Manager.h" >&5 -echo $ECHO_N "checking for Manager.h... $ECHO_C" >&6 -if test "${ac_cv_header_Manager_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_Manager_h" >&5 -echo "${ECHO_T}$ac_cv_header_Manager_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking Manager.h usability" >&5 -echo $ECHO_N "checking Manager.h usability... $ECHO_C" >&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 <Manager.h> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking Manager.h presence" >&5 -echo $ECHO_N "checking Manager.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <Manager.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: Manager.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: Manager.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: Manager.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: Manager.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: Manager.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: Manager.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: Manager.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: Manager.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: Manager.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: Manager.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: Manager.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: Manager.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: Manager.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: Manager.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: Manager.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: Manager.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for Manager.h" >&5 -echo $ECHO_N "checking for Manager.h... $ECHO_C" >&6 -if test "${ac_cv_header_Manager_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_Manager_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_Manager_h" >&5 -echo "${ECHO_T}$ac_cv_header_Manager_h" >&6 - -fi -if test $ac_cv_header_Manager_h = yes; then - : -else - { { echo "$as_me:$LINENO: error: Cannot find moses headers! Use --with-moses=PATH" >&5 -echo "$as_me: error: Cannot find moses headers! Use --with-moses=PATH" >&2;} - { (exit 1); exit 1; }; } -fi - - -if test "${ac_cv_header_boost_algorithm_string_hpp+set}" = set; then - echo "$as_me:$LINENO: checking for boost/algorithm/string.hpp" >&5 -echo $ECHO_N "checking for boost/algorithm/string.hpp... $ECHO_C" >&6 -if test "${ac_cv_header_boost_algorithm_string_hpp+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_boost_algorithm_string_hpp" >&5 -echo "${ECHO_T}$ac_cv_header_boost_algorithm_string_hpp" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking boost/algorithm/string.hpp usability" >&5 -echo $ECHO_N "checking boost/algorithm/string.hpp usability... $ECHO_C" >&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 <boost/algorithm/string.hpp> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking boost/algorithm/string.hpp presence" >&5 -echo $ECHO_N "checking boost/algorithm/string.hpp presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <boost/algorithm/string.hpp> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: boost/algorithm/string.hpp: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: boost/algorithm/string.hpp: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: boost/algorithm/string.hpp: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: boost/algorithm/string.hpp: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: boost/algorithm/string.hpp: present but cannot be compiled" >&5 -echo "$as_me: WARNING: boost/algorithm/string.hpp: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: boost/algorithm/string.hpp: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: boost/algorithm/string.hpp: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: boost/algorithm/string.hpp: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: boost/algorithm/string.hpp: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: boost/algorithm/string.hpp: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: boost/algorithm/string.hpp: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: boost/algorithm/string.hpp: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: boost/algorithm/string.hpp: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: boost/algorithm/string.hpp: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: boost/algorithm/string.hpp: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for boost/algorithm/string.hpp" >&5 -echo $ECHO_N "checking for boost/algorithm/string.hpp... $ECHO_C" >&6 -if test "${ac_cv_header_boost_algorithm_string_hpp+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_boost_algorithm_string_hpp=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_boost_algorithm_string_hpp" >&5 -echo "${ECHO_T}$ac_cv_header_boost_algorithm_string_hpp" >&6 - -fi -if test $ac_cv_header_boost_algorithm_string_hpp = yes; then - : -else - { { echo "$as_me:$LINENO: error: Cannot find boost. Use --with-boost=PATH" >&5 -echo "$as_me: error: Cannot find boost. Use --with-boost=PATH" >&2;} - { (exit 1); exit 1; }; } -fi - - -if test "${ac_cv_header_boost_iostreams_filtering_stream_hpp+set}" = set; then - echo "$as_me:$LINENO: checking for boost/iostreams/filtering_stream.hpp" >&5 -echo $ECHO_N "checking for boost/iostreams/filtering_stream.hpp... $ECHO_C" >&6 -if test "${ac_cv_header_boost_iostreams_filtering_stream_hpp+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_boost_iostreams_filtering_stream_hpp" >&5 -echo "${ECHO_T}$ac_cv_header_boost_iostreams_filtering_stream_hpp" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking boost/iostreams/filtering_stream.hpp usability" >&5 -echo $ECHO_N "checking boost/iostreams/filtering_stream.hpp usability... $ECHO_C" >&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 <boost/iostreams/filtering_stream.hpp> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking boost/iostreams/filtering_stream.hpp presence" >&5 -echo $ECHO_N "checking boost/iostreams/filtering_stream.hpp presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <boost/iostreams/filtering_stream.hpp> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: boost/iostreams/filtering_stream.hpp: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: boost/iostreams/filtering_stream.hpp: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: boost/iostreams/filtering_stream.hpp: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: boost/iostreams/filtering_stream.hpp: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: boost/iostreams/filtering_stream.hpp: present but cannot be compiled" >&5 -echo "$as_me: WARNING: boost/iostreams/filtering_stream.hpp: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: boost/iostreams/filtering_stream.hpp: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: boost/iostreams/filtering_stream.hpp: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: boost/iostreams/filtering_stream.hpp: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: boost/iostreams/filtering_stream.hpp: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: boost/iostreams/filtering_stream.hpp: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: boost/iostreams/filtering_stream.hpp: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: boost/iostreams/filtering_stream.hpp: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: boost/iostreams/filtering_stream.hpp: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: boost/iostreams/filtering_stream.hpp: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: boost/iostreams/filtering_stream.hpp: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for boost/iostreams/filtering_stream.hpp" >&5 -echo $ECHO_N "checking for boost/iostreams/filtering_stream.hpp... $ECHO_C" >&6 -if test "${ac_cv_header_boost_iostreams_filtering_stream_hpp+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_boost_iostreams_filtering_stream_hpp=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_boost_iostreams_filtering_stream_hpp" >&5 -echo "${ECHO_T}$ac_cv_header_boost_iostreams_filtering_stream_hpp" >&6 - -fi -if test $ac_cv_header_boost_iostreams_filtering_stream_hpp = yes; then - : -else - { { echo "$as_me:$LINENO: error: Cannot find boost. Use --with-boost=PATH" >&5 -echo "$as_me: error: Cannot find boost. Use --with-boost=PATH" >&2;} - { (exit 1); exit 1; }; } -fi - - - -if test "$mysql_flag" = 'yes' -then - - -# Check whether --with-mysqlclient-prefix or --without-mysqlclient-prefix was given. -if test "${with_mysqlclient_prefix+set}" = set; then - withval="$with_mysqlclient_prefix" - mysqlclient_prefix="$withval" -else - mysqlclient_prefix="" -fi; - - -# Check whether --with-mysqlclient-include or --without-mysqlclient-include was given. -if test "${with_mysqlclient_include+set}" = set; then - withval="$with_mysqlclient_include" - mysqlclient_include="$withval" -else - mysqlclient_include="" -fi; - - -# Check whether --with-mysqlclient-lib or --without-mysqlclient-lib was given. -if test "${with_mysqlclient_lib+set}" = set; then - withval="$with_mysqlclient_lib" - mysqlclient_lib="$withval" -else - mysqlclient_lib="" -fi; - - echo "$as_me:$LINENO: checking for mysqlclient " >&5 -echo $ECHO_N "checking for mysqlclient ... $ECHO_C" >&6 - MYSQLCLIENT_LDFLAGS="" - MYSQLCLIENT_CPPFLAGS="" - MYSQLCLIENT_LIBS="-lmysqlclient" - mysqlclient_fail="" - - for tryprefix in /usr /usr/local /usr/mysql /usr/local/mysql /usr/pkg $msqlclient_prefix; do - #testloop - for hloc in lib/mysql lib lib64/mysql lib64 ; do - if test -e "$tryprefix/$hloc/libmysqlclient.so"; then - MYSQLCLIENT_LDFLAGS="-L$tryprefix/$hloc" - fi - done - - for iloc in include/mysql include; do - if test -e "$tryprefix/$iloc/mysql.h"; then - MYSQLCLIENT_CPPFLAGS="-I$tryprefix/$iloc" - fi - done - # testloop - done - - if test "x$mysqlclient_include" != "x" ; then - echo "checking for mysql includes... " - if test -d "$mysqlclient_include/mysql" ; then - MYSQLCLIENT_CPPFLAGS="-I$mysqlclient_include" - echo " found $MYSQLCLIENT_CPPFLAGS" - elif test -d "$mysqlclient_include/include/mysql" ; then - MYSQLCLIENT_CPPFLAGS="-I$mysqlclient_include/include" - echo " found $MYSQLCLIENT_CPPFLAGS" - elif test -d "$mysqlclient_include" ; then - MYSQLCLIENT_CPPFLAGS="-I$mysqlclient_include" - echo "found $MYSQLCLIENT_CPPFLAGS" - else - echo "not found! no include dir found in $mysqlclient_include" - fi - fi - - if test "x$mysqlclient_lib" != "x" ; then - echo "checking for mysql libx... " - if test -d "$mysqlclient_lib/lib/mysql" ; then - MYSQLCLIENT_LDFLAGS="-L$mysqlclient_lib/lib/mysql" - echo "found $MYSQLCLIENT_LDFLAGS" - elif test -d "$mysqlclient_lib/lin" ; then - MYSQLCLIENT_LDFLAGS="-L$mysqlclient_lib/lib" - echo "found $MYSQLCLIENT_LDFLAGS" - else - MYSQLCLIENT_LDFLAGS="-L$mysqlclient_lib" - echo "defaultd to $MYSQLCLIENT_LDFLAGS" - fi - fi - - ac_save_CPPFLAGS="$CPPFLAGS" - ac_save_LDFLAGS="$LDFLAGS" - ac_save_LIBS="$LIBS" - CPPFLAGS="$CPPFLAGS $MYSQLCLIENT_CPPFLAGS" - LDFLAGS="$LDFLAGS $MYSQLCLIENT_LDFLAGS" - LIBS="$LIBS $MYSQLCLIENT_LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - #include <mysql.h> - -int -main () -{ - - mysql_real_connect( 0, 0, 0, 0, 0, 0, 0, 0); - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes $MYSQLCLIENT_CPPFLAGS $MYSQLCLIENT_LDFLAGS" >&5 -echo "${ECHO_T}yes $MYSQLCLIENT_CPPFLAGS $MYSQLCLIENT_LDFLAGS" >&6 - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" - LIBS="$ac_save_LIBS" - : - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - - echo "no" - echo "can't compile a simple app with mysql_connnect in it. -bad." - mysqlclient_fail="yes" - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - - if test "x$mysqlclient_fail" != "x" ; then - echo - echo "***" - echo "*** mysqlclient test source had problems, check your config.log ." - echo "*** Also try one of the following switches :" - echo "*** --with-mysqlclient-prefix=PFX" - echo "*** --with-mysqlclient-include=DIR" - echo "*** --with-mysqlclient-lib=DIR" - echo "***" - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" - LIBS="$ac_save_LIBS" - { { echo "$as_me:$LINENO: error: Could not locate mysql client libraries. Try --with-mysql-prefix/-include/-lib" >&5 -echo "$as_me: error: Could not locate mysql client libraries. Try --with-mysql-prefix/-include/-lib" >&2;} - { (exit 1); exit 1; }; } - fi - - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" - LIBS="$ac_save_LIBS" - - - - - LDFLAGS="$LDFLAGS $MYSQLCLIENT_LDFLAGS" - CPPFLAGS="$CPPFLAGS $MYSQLCLIENT_CPPFLAGS" - LIBS="$LIBS $MYSQLCLIENT_LIBS" - - -echo "$as_me:$LINENO: checking for MySQL++ libraries" >&5 -echo $ECHO_N "checking for MySQL++ libraries... $ECHO_C" >&6 -if test "${ac_cv_mysqlpp_devel+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - # - # Set up configure script macros - # - -# Check whether --with-mysqlpp or --without-mysqlpp was given. -if test "${with_mysqlpp+set}" = set; then - withval="$with_mysqlpp" - MYSQLPP_lib_check="$with_mysqlpp/lib $with_mysqlpp/lib/mysql++" - MYSQLPP_inc_check="$with_mysqlpp/include $with_mysqlpp/include/mysql++" -else - MYSQLPP_lib_check="/usr/local/mysql++/lib /usr/local/lib/mysql++ /opt/mysql++/lib /usr/lib/mysql++ /usr/local/lib /usr/lib" - MYSQLPP_inc_check="/usr/local/mysql++/include /usr/local/include/mysql++ /opt/mysql++/include /usr/local/include/mysql++ /usr/local/include /usr/include/mysql++ /usr/include" -fi; - -# Check whether --with-mysqlpp-lib or --without-mysqlpp-lib was given. -if test "${with_mysqlpp_lib+set}" = set; then - withval="$with_mysqlpp_lib" - MYSQLPP_lib_check="$with_mysqlpp_lib $with_mysqlpp_lib/lib $with_mysqlpp_lib/lib/mysql" -fi; - -# Check whether --with-mysqlpp-include or --without-mysqlpp-include was given. -if test "${with_mysqlpp_include+set}" = set; then - withval="$with_mysqlpp_include" - MYSQLPP_inc_check="$with_mysqlpp_include $with_mysqlpp_include/include $with_mysqlpp_include/include/mysql" -fi; - - # - # Look for MySQL++ library - # - MYSQLPP_libdir= - for dir in $MYSQLPP_lib_check - do - if test -d "$dir" && \ - ( test -f "$dir/libmysqlpp.so" || - test -f "$dir/libmysqlpp.a" ) - then - MYSQLPP_libdir=$dir - break - fi - done - - if test -z "$MYSQLPP_libdir" - then - { { echo "$as_me:$LINENO: error: Didn't find the MySQL++ library dir in '$MYSQLPP_lib_check'" >&5 -echo "$as_me: error: Didn't find the MySQL++ library dir in '$MYSQLPP_lib_check'" >&2;} - { (exit 1); exit 1; }; } - fi - - case "$MYSQLPP_libdir" in - /* ) ;; - * ) { { echo "$as_me:$LINENO: error: The MySQL++ library directory ($MYSQLPP_libdir) must be an absolute path." >&5 -echo "$as_me: error: The MySQL++ library directory ($MYSQLPP_libdir) must be an absolute path." >&2;} - { (exit 1); exit 1; }; } ;; - esac - - echo "$as_me:$LINENO: result: lib in $MYSQLPP_libdir" >&5 -echo "${ECHO_T}lib in $MYSQLPP_libdir" >&6 - - case "$MYSQLPP_libdir" in - /usr/lib) ;; - *) LDFLAGS="$LDFLAGS -L${MYSQLPP_libdir} -Wl,-rpath ${MYSQLPP_libdir}" ;; - esac - - # - # Look for MySQL++ headers - # - echo "$as_me:$LINENO: checking for MySQL++ include directory" >&5 -echo $ECHO_N "checking for MySQL++ include directory... $ECHO_C" >&6 - MYSQLPP_incdir= - for dir in $MYSQLPP_inc_check - do - if test -d "$dir" && test -f "$dir/mysql++.h" - then - MYSQLPP_incdir=$dir - break - fi - done - - if test -z "$MYSQLPP_incdir" - then - { { echo "$as_me:$LINENO: error: Didn't find the MySQL++ header dir in '$MYSQLPP_inc_check'" >&5 -echo "$as_me: error: Didn't find the MySQL++ header dir in '$MYSQLPP_inc_check'" >&2;} - { (exit 1); exit 1; }; } - fi - - case "$MYSQLPP_incdir" in - /* ) ;; - * ) { { echo "$as_me:$LINENO: error: The MySQL++ header directory ($MYSQLPP_incdir) must be an absolute path." >&5 -echo "$as_me: error: The MySQL++ header directory ($MYSQLPP_incdir) must be an absolute path." >&2;} - { (exit 1); exit 1; }; } ;; - esac - - echo "$as_me:$LINENO: result: $MYSQLPP_incdir" >&5 -echo "${ECHO_T}$MYSQLPP_incdir" >&6 - - CPPFLAGS="$CPPFLAGS -I${MYSQLPP_incdir}" - - echo "$as_me:$LINENO: checking that we can build MySQL++ programs" >&5 -echo $ECHO_N "checking that we can build MySQL++ programs... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <mysql++.h> -int -main () -{ -std::string s; mysqlpp::escape_string(s) - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_mysqlpp_devel=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: no" >&5 -echo "$as_me: error: no" >&2;} - { (exit 1); exit 1; }; } -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ac_cv_mysqlpp_devel" >&5 -echo "${ECHO_T}$ac_cv_mysqlpp_devel" >&6 - LIBS="$LIBS -lmysqlpp" - - - -if true; then - BUILD_MYSQL_SUPPORT_TRUE= - BUILD_MYSQL_SUPPORT_FALSE='#' -else - BUILD_MYSQL_SUPPORT_TRUE='#' - BUILD_MYSQL_SUPPORT_FALSE= -fi - -else - - -if false; then - BUILD_MYSQL_SUPPORT_TRUE= - BUILD_MYSQL_SUPPORT_FALSE='#' -else - BUILD_MYSQL_SUPPORT_TRUE='#' - BUILD_MYSQL_SUPPORT_FALSE= -fi - -fi - -if test "x$with_srilm" != 'xno' -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I${with_srilm}/include" - - if test "${ac_cv_header_Ngram_h+set}" = set; then - echo "$as_me:$LINENO: checking for Ngram.h" >&5 -echo $ECHO_N "checking for Ngram.h... $ECHO_C" >&6 -if test "${ac_cv_header_Ngram_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_Ngram_h" >&5 -echo "${ECHO_T}$ac_cv_header_Ngram_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking Ngram.h usability" >&5 -echo $ECHO_N "checking Ngram.h usability... $ECHO_C" >&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 <Ngram.h> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking Ngram.h presence" >&5 -echo $ECHO_N "checking Ngram.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <Ngram.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: Ngram.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: Ngram.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: Ngram.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: Ngram.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: Ngram.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: Ngram.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: Ngram.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: Ngram.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: Ngram.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: Ngram.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: Ngram.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: Ngram.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: Ngram.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: Ngram.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: Ngram.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: Ngram.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for Ngram.h" >&5 -echo $ECHO_N "checking for Ngram.h... $ECHO_C" >&6 -if test "${ac_cv_header_Ngram_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_Ngram_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_Ngram_h" >&5 -echo "${ECHO_T}$ac_cv_header_Ngram_h" >&6 - -fi -if test $ac_cv_header_Ngram_h = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_SRILM -_ACEOF - -else - { { echo "$as_me:$LINENO: error: Cannot find SRILM!" >&5 -echo "$as_me: error: Cannot find SRILM!" >&2;} - { (exit 1); exit 1; }; } -fi - - - - LIB_SRILM="-loolm -ldstruct -lmisc" - # ROOT/lib/i686-m64/liboolm.a - # ROOT/lib/i686-m64/libdstruct.a - # ROOT/lib/i686-m64/libmisc.a - MY_ARCH=`${with_srilm}/sbin/machine-type` - LDFLAGS="$LDFLAGS -L${with_srilm}/lib/${MY_ARCH}" - LIBS="$LIBS $LIB_SRILM" - FMTLIBS="$FMTLIBS liboolm.a libdstruct.a libmisc.a" - - -if true; then - SRI_LM_TRUE= - SRI_LM_FALSE='#' -else - SRI_LM_TRUE='#' - SRI_LM_FALSE= -fi - - - -if false; then - INTERNAL_LM_TRUE= - INTERNAL_LM_FALSE='#' -else - INTERNAL_LM_TRUE='#' - INTERNAL_LM_FALSE= -fi - - - -if false; then - IRST_LM_TRUE= - IRST_LM_FALSE='#' -else - IRST_LM_TRUE='#' - IRST_LM_FALSE= -fi - -else if test "x$with_irstlm" != 'xno' -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I${with_irstlm}/include" - - if test "${ac_cv_header_ngram_h+set}" = set; then - echo "$as_me:$LINENO: checking for ngram.h" >&5 -echo $ECHO_N "checking for ngram.h... $ECHO_C" >&6 -if test "${ac_cv_header_ngram_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_ngram_h" >&5 -echo "${ECHO_T}$ac_cv_header_ngram_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking ngram.h usability" >&5 -echo $ECHO_N "checking ngram.h usability... $ECHO_C" >&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 <ngram.h> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking ngram.h presence" >&5 -echo $ECHO_N "checking ngram.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <ngram.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - 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 -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: ngram.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: ngram.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: ngram.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: ngram.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: ngram.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: ngram.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: ngram.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: ngram.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: ngram.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: ngram.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: ngram.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: ngram.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: ngram.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: ngram.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: ngram.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: ngram.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for ngram.h" >&5 -echo $ECHO_N "checking for ngram.h... $ECHO_C" >&6 -if test "${ac_cv_header_ngram_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_ngram_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_ngram_h" >&5 -echo "${ECHO_T}$ac_cv_header_ngram_h" >&6 - -fi -if test $ac_cv_header_ngram_h = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_IRSTLM -_ACEOF - -else - { { echo "$as_me:$LINENO: error: Cannot find IRST-LM!" >&5 -echo "$as_me: error: Cannot find IRST-LM!" >&2;} - { (exit 1); exit 1; }; } -fi - - - - LIB_SRILM="-lirstlm" - LDFLAGS="$LDFLAGS -L${with_irstlm}/lib" - LIBS="$LIBS $LIB_SRILM" - FMTLIBS="$FMTLIBS libirstlm.a" - - -if false; then - SRI_LM_TRUE= - SRI_LM_FALSE='#' -else - SRI_LM_TRUE='#' - SRI_LM_FALSE= -fi - - - -if false; then - INTERNAL_LM_TRUE= - INTERNAL_LM_FALSE='#' -else - INTERNAL_LM_TRUE='#' - INTERNAL_LM_FALSE= -fi - - - -if true; then - IRST_LM_TRUE= - IRST_LM_FALSE='#' -else - IRST_LM_TRUE='#' - IRST_LM_FALSE= -fi - -else - echo "Using internal language model (use --with-srilm or --with-irstlm to change)!" - - -if false; then - SRI_LM_TRUE= - SRI_LM_FALSE='#' -else - SRI_LM_TRUE='#' - SRI_LM_FALSE= -fi - - - -if true; then - INTERNAL_LM_TRUE= - INTERNAL_LM_FALSE='#' -else - INTERNAL_LM_TRUE='#' - INTERNAL_LM_FALSE= -fi - - - -if false; then - IRST_LM_TRUE= - IRST_LM_FALSE='#' -else - IRST_LM_TRUE='#' - IRST_LM_FALSE= -fi - -fi -fi - -LIBS="$LIBS -lboost_iostreams-gcc-mt -lboost_filesystem-gcc-mt -lboost_thread-gcc-mt -lz" -FMT_LIBS="$FMT_LIBS libboost_iostreams.a libboost_filesystem.a libboost_thread.a" - - - ac_config_files="$ac_config_files Makefile src/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, don't put newlines in cache variables' values. -# 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. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *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 \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!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" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - 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}' - -# 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 - -DEFS=-DHAVE_CONFIG_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_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -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__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -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 -if test -z "${BUILD_MYSQL_SUPPORT_TRUE}" && test -z "${BUILD_MYSQL_SUPPORT_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"BUILD_MYSQL_SUPPORT\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"BUILD_MYSQL_SUPPORT\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${BUILD_MYSQL_SUPPORT_TRUE}" && test -z "${BUILD_MYSQL_SUPPORT_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"BUILD_MYSQL_SUPPORT\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"BUILD_MYSQL_SUPPORT\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${SRI_LM_TRUE}" && test -z "${SRI_LM_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"SRI_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"SRI_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${INTERNAL_LM_TRUE}" && test -z "${INTERNAL_LM_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"INTERNAL_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"INTERNAL_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${IRST_LM_TRUE}" && test -z "${IRST_LM_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"IRST_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"IRST_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${SRI_LM_TRUE}" && test -z "${SRI_LM_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"SRI_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"SRI_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${INTERNAL_LM_TRUE}" && test -z "${INTERNAL_LM_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"INTERNAL_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"INTERNAL_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${IRST_LM_TRUE}" && test -z "${IRST_LM_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"IRST_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"IRST_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${SRI_LM_TRUE}" && test -z "${SRI_LM_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"SRI_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"SRI_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${INTERNAL_LM_TRUE}" && test -z "${INTERNAL_LM_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"INTERNAL_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"INTERNAL_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${IRST_LM_TRUE}" && test -z "${IRST_LM_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"IRST_LM\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"IRST_LM\" 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" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -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 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+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -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 - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; 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 || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# 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 - -# 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 - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - 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 - - ;; - 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 - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - 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=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # 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 before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, 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 - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -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 sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -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$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# 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'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by $as_me, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -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, 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 - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to <bug-autoconf@gnu.org>." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2003 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -INSTALL="$INSTALL" -_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 - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -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" ;; - - 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 - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# -# INIT-COMMANDS section. -# - -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - -_ACEOF - - - -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -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_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - 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 to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $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 -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@CYGPATH_W@,$CYGPATH_W,;t t -s,@PACKAGE@,$PACKAGE,;t t -s,@VERSION@,$VERSION,;t t -s,@ACLOCAL@,$ACLOCAL,;t t -s,@AUTOCONF@,$AUTOCONF,;t t -s,@AUTOMAKE@,$AUTOMAKE,;t t -s,@AUTOHEADER@,$AUTOHEADER,;t t -s,@MAKEINFO@,$MAKEINFO,;t t -s,@install_sh@,$install_sh,;t t -s,@STRIP@,$STRIP,;t t -s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t -s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t -s,@mkdir_p@,$mkdir_p,;t t -s,@AWK@,$AWK,;t t -s,@SET_MAKE@,$SET_MAKE,;t t -s,@am__leading_dot@,$am__leading_dot,;t t -s,@AMTAR@,$AMTAR,;t t -s,@am__tar@,$am__tar,;t t -s,@am__untar@,$am__untar,;t t -s,@CXX@,$CXX,;t t -s,@CXXFLAGS@,$CXXFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CXX@,$ac_ct_CXX,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@DEPDIR@,$DEPDIR,;t t -s,@am__include@,$am__include,;t t -s,@am__quote@,$am__quote,;t t -s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t -s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t -s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t -s,@CXXDEPMODE@,$CXXDEPMODE,;t t -s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t -s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t -s,@RANLIB@,$RANLIB,;t t -s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t -s,@CXXCPP@,$CXXCPP,;t t -s,@EGREP@,$EGREP,;t t -s,@MYSQLCLIENT_LDFLAGS@,$MYSQLCLIENT_LDFLAGS,;t t -s,@MYSQLCLIENT_CPPFLAGS@,$MYSQLCLIENT_CPPFLAGS,;t t -s,@MYSQLCLIENT_LIBS@,$MYSQLCLIENT_LIBS,;t t -s,@BUILD_MYSQL_SUPPORT_TRUE@,$BUILD_MYSQL_SUPPORT_TRUE,;t t -s,@BUILD_MYSQL_SUPPORT_FALSE@,$BUILD_MYSQL_SUPPORT_FALSE,;t t -s,@SRI_LM_TRUE@,$SRI_LM_TRUE,;t t -s,@SRI_LM_FALSE@,$SRI_LM_FALSE,;t t -s,@INTERNAL_LM_TRUE@,$INTERNAL_LM_TRUE,;t t -s,@INTERNAL_LM_FALSE@,$INTERNAL_LM_FALSE,;t t -s,@IRST_LM_TRUE@,$IRST_LM_TRUE,;t t -s,@IRST_LM_FALSE@,$IRST_LM_FALSE,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; - esac - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # 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. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } -_ACEOF -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,@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,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - # Do quote $f, to prevent DOS paths from being IFS'd. - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -_ACEOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\_ACEOF - # 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. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -# Compute $ac_file's index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $ac_file | $ac_file:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || -$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X$ac_file : 'X\(//\)[^/]' \| \ - X$ac_file : 'X\(//\)$' \| \ - X$ac_file : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X$ac_file | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'`/stamp-h$_am_stamp_count -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_COMMANDS section. -# -for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_dir=`(dirname "$ac_dest") 2>/dev/null || -$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_dest" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 -echo "$as_me: executing $ac_dest commands" >&6;} - case $ac_dest in - depfiles ) 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. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`(dirname "$mf") 2>/dev/null || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -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=`(dirname "$file") 2>/dev/null || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p $dirpart/$fdir - else - as_dir=$dirpart/$fdir - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 -echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} - { (exit 1); exit 1; }; }; } - - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - esac -done -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -{ (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/moses-cmd/configure.in b/moses-cmd/configure.in deleted file mode 100644 index 7f3972cdc..000000000 --- a/moses-cmd/configure.in +++ /dev/null @@ -1,129 +0,0 @@ -AC_INIT(src) - -AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(moses, 0.1) - -AC_PROG_CXX -AC_LANG_CPLUSPLUS -AC_PROG_RANLIB -#AM_PROG_LIBTOOL - -AC_ARG_WITH(srilm, - [AC_HELP_STRING([--with-srilm=PATH], [(optional) path to SRI's LM toolkit])], - [with_srilm=$withval], - [with_srilm=no] - ) - -AC_ARG_WITH(boost, - [AC_HELP_STRING([--with-boost=PATH], [path to BOOST libraries])], - [with_boost=$withval], - [with_boost=no] - ) - -AC_ARG_WITH(irstlm, - [AC_HELP_STRING([--with-irstlm=PATH], [(optional) path to IRST's LM toolkit])], - [with_irstlm=$withval], - [with_irstlm=no] - ) - -AC_ARG_WITH(moses, - [AC_HELP_STRING([--with-moses=PATH], [path to moses library])], - [with_moses=$withval], - [with_moses=no] - ) - -AC_ARG_ENABLE(profiling, - [AC_HELP_STRING([--enable-profiling], [moses will dump profiling info])], - [CPPFLAGS="$CPPFLAGS -pg"; LDFLAGS="$LDFLAGS -pg" ] - ) - -AC_ARG_ENABLE(optimization, - [AC_HELP_STRING([--enable-optimization], [compile with -O3 flag])], - [CPPFLAGS="$CPPFLAGS -O3"; LDFLAGS="$LDFLAGS -O3" ] - ) - -AC_ARG_ENABLE(mysql, AC_HELP_STRING([--enable-mysql], [(optional) build in MySQL support])], - [mysql_flag=yes], [mysql_flag=no]) - -if test "x$with_boost" != 'xno' -then - CPPFLAGS="$CPPFLAGS -I${with_boost} -I${with_boost}/include" - LDFLAGS="$LDFLAGS -L${with_boost}/lib -L${with_boost}/stage/lib" -fi - -if test "x$with_moses" != 'xno' -then - CPPFLAGS="$CPPFLAGS -I${with_moses}/src" - LDFLAGS="$LDFLAGS -L${with_moses}/src" -fi -LIBS="$LIBS -lmoses" - -AC_CHECK_HEADER([Manager.h], [], [AC_MSG_ERROR([Cannot find moses headers! Use --with-moses=PATH])]) -AC_CHECK_HEADER([boost/algorithm/string.hpp], [], [AC_MSG_ERROR([Cannot find boost. Use --with-boost=PATH])]) -AC_CHECK_HEADER([boost/iostreams/filtering_stream.hpp], [], [AC_MSG_ERROR([Cannot find boost. Use --with-boost=PATH])]) - -if test "$mysql_flag" = 'yes' -then - AC_MYSQLCLIENT(,, - [AC_ERROR([Could not locate mysql client libraries. Try --with-mysql-prefix/-include/-lib])]) - LDFLAGS="$LDFLAGS $MYSQLCLIENT_LDFLAGS" - CPPFLAGS="$CPPFLAGS $MYSQLCLIENT_CPPFLAGS" - LIBS="$LIBS $MYSQLCLIENT_LIBS" - - MYSQLPP_DEVEL - LIBS="$LIBS -lmysqlpp" - - AM_CONDITIONAL([BUILD_MYSQL_SUPPORT], true) -else - AM_CONDITIONAL([BUILD_MYSQL_SUPPORT], false) -fi - -if test "x$with_srilm" != 'xno' -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I${with_srilm}/include" - - AC_CHECK_HEADER(Ngram.h, - [AC_DEFINE([HAVE_SRILM], [], [flag for SRILM])], - [AC_MSG_ERROR([Cannot find SRILM!])]) - - LIB_SRILM="-loolm -ldstruct -lmisc" - # ROOT/lib/i686-m64/liboolm.a - # ROOT/lib/i686-m64/libdstruct.a - # ROOT/lib/i686-m64/libmisc.a - MY_ARCH=`${with_srilm}/sbin/machine-type` - LDFLAGS="$LDFLAGS -L${with_srilm}/lib/${MY_ARCH}" - LIBS="$LIBS $LIB_SRILM" - FMTLIBS="$FMTLIBS liboolm.a libdstruct.a libmisc.a" - AM_CONDITIONAL([SRI_LM], true) - AM_CONDITIONAL([INTERNAL_LM], false) - AM_CONDITIONAL([IRST_LM], false) -else if test "x$with_irstlm" != 'xno' -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I${with_irstlm}/include" - - AC_CHECK_HEADER(ngram.h, - [AC_DEFINE([HAVE_IRSTLM], [], [flag for IRSTLM])], - [AC_MSG_ERROR([Cannot find IRST-LM!])]) - - LIB_SRILM="-lirstlm" - LDFLAGS="$LDFLAGS -L${with_irstlm}/lib" - LIBS="$LIBS $LIB_SRILM" - FMTLIBS="$FMTLIBS libirstlm.a" - AM_CONDITIONAL([SRI_LM], false) - AM_CONDITIONAL([INTERNAL_LM], false) - AM_CONDITIONAL([IRST_LM], true) -else - echo "Using internal language model (use --with-srilm or --with-irstlm to change)!" - AM_CONDITIONAL([SRI_LM], false) - AM_CONDITIONAL([INTERNAL_LM], true) - AM_CONDITIONAL([IRST_LM], false) -fi -fi - -LIBS="$LIBS -lboost_iostreams-gcc-mt -lboost_filesystem-gcc-mt -lboost_thread-gcc-mt -lz" -FMT_LIBS="$FMT_LIBS libboost_iostreams.a libboost_filesystem.a libboost_thread.a" - - -AC_OUTPUT(Makefile src/Makefile) diff --git a/moses-cmd/depcomp b/moses-cmd/depcomp deleted file mode 100755 index 4c20c6c94..000000000 --- a/moses-cmd/depcomp +++ /dev/null @@ -1,441 +0,0 @@ -#! /bin/sh - -# depcomp - compile a program generating dependencies as side-effects -# Copyright 1999, 2000 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, 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>. - -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 -# `libtool' can also be set to `yes' or `no'. - -depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`} -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. 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. - stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - outname="$stripped.o" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - # 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) - # Must come before tru64. - - # Intel's C compiler understands `-MD -MF file'. However - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # 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: - - "$@" -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'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^[^:]*: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - rm -f "$tmpdepfile" - ;; - -tru64) - # The Tru64 AIX 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. - - tmpdepfile1="$object.d" - tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` - if test "$libtool" = yes; then - "$@" -Wc,-MD - else - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - if test -f "$tmpdepfile1"; then - tmpdepfile="$tmpdepfile1" - else - tmpdepfile="$tmpdepfile2" - fi - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a space and a tab 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 proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - test -z "$dashmflag" && dashmflag=-M - ( IFS=" " - case " $* " in - *" --mode=compile "*) # this is libtool, let us make it quiet - for arg - do # cycle over the arguments - case "$arg" in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; - esac - "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi - 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) - # 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;; - -*) - ;; - *) - set fnord "$@" "$arg"; shift;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tail +3 "$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 proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - ( IFS=" " - case " $* " in - *" --mode=compile "*) - for arg - do # cycle over the arguments - case $arg in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; - esac - "$@" -E | - sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi - 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 proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - ( IFS=" " - case " $* " in - *" --mode=compile "*) - for arg - do # cycle over the arguments - case $arg in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; - esac - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi - 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 diff --git a/moses-cmd/install-sh b/moses-cmd/install-sh deleted file mode 100755 index 36f96f3e0..000000000 --- a/moses-cmd/install-sh +++ /dev/null @@ -1,276 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# 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. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd=$cpprog - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "$0: no input file specified" >&2 - exit 1 -else - : -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d "$dst" ]; then - instcmd=: - chmodcmd="" - else - instcmd=$mkdirprog - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f "$src" ] || [ -d "$src" ] - then - : - else - echo "$0: $src does not exist" >&2 - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "$0: no destination specified" >&2 - exit 1 - else - : - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d "$dst" ] - then - dst=$dst/`basename "$src"` - else - : - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' - ' -IFS="${IFS-$defaultIFS}" - -oIFS=$IFS -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS=$oIFS - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp=$pathcomp$1 - shift - - if [ ! -d "$pathcomp" ] ; - then - $mkdirprog "$pathcomp" - else - : - fi - - pathcomp=$pathcomp/ -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd "$dst" && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename "$dst"` - else - dstfile=`basename "$dst" $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename "$dst"` - else - : - fi - -# Make a couple of temp file names in the proper directory. - - dsttmp=$dstdir/#inst.$$# - rmtmp=$dstdir/#rm.$$# - -# Trap to clean up temp files at exit. - - trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 - trap '(exit $?); exit' 1 2 13 15 - -# Move or copy the file name to the temp name - - $doit $instcmd "$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 $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && - -# 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. - -{ - if [ -f "$dstdir/$dstfile" ] - then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || - $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || - { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit - } - else - : - fi -} && - -# Now rename the file to the real destination. - - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - -fi && - -# The final little trick to "correctly" pass the exit status to the exit trap. - -{ - (exit 0); exit -} diff --git a/moses-cmd/missing b/moses-cmd/missing deleted file mode 100755 index 6a37006e8..000000000 --- a/moses-cmd/missing +++ /dev/null @@ -1,336 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. -# Copyright (C) 1996, 1997, 1999, 2000, 2002 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 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, 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. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: - -# 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 - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - - -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' - 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]" - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing 0.4 - GNU automake" - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - - aclocal*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the - proper tools for further handling them. - You can get \`$1Help2man' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` - 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' is missing on your system. 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 [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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 [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then - # We have makeinfo, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` - fi - touch $file - ;; - - tar) - shift - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - fi - - # 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 you do not seem to have it handy on your - system. 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 prerequirements 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 diff --git a/moses-cmd/moses-cmd.vcproj b/moses-cmd/moses-cmd.vcproj deleted file mode 100644 index 07a9cac51..000000000 --- a/moses-cmd/moses-cmd.vcproj +++ /dev/null @@ -1,379 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="moses-cmd"
- ProjectGUID="{5BBAC701-84F5-438E-8F54-B3391F451F2A}"
- RootNamespace="mosescmd"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""$(SolutionDir)\src";"$(SolutionDir)..\mysqlpp\lib";"$(SolutionDir)..\irstlm\src""
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;LM_INTERNAL;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies=""$(SolutionDir)\$(ConfigurationName)\moses.lib" "$(SolutionDir)\$(ConfigurationName)\irstlm.lib" mysqlpp.lib libmysql.lib libboost_thread-vc80-mt-gd.lib"
- OutputFile="$(ProjectDir)\$(ProjectName).exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(SolutionDir)\src";"$(SolutionDir)..\mysqlpp\lib";"$(SolutionDir)..\irstlm\src""
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;LM_INTERNAL;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies=""$(SolutionDir)\$(ConfigurationName)\moses.lib" "$(SolutionDir)\$(ConfigurationName)\irstlm.lib" mysqlpp.lib libmysql.lib libboost_thread-vc80-mt-gd.lib"
- OutputFile="$(ProjectDir)\$(ProjectName).exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="DebugNBest|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""$(SolutionDir)\src";"$(SolutionDir)..\mysqlpp\lib";"$(SolutionDir)..\irstlm\src""
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;N_BEST;LM_INTERNAL;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies=""$(SolutionDir)\$(ConfigurationName)\moses.lib" "$(SolutionDir)\$(ConfigurationName)\irstlm.lib" mysqlpp.lib libmysql.lib libboost_thread-vc80-mt-gd.lib"
- OutputFile="$(ProjectDir)\$(ProjectName).exe"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ReleaseNBest|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(SolutionDir)\src";"$(SolutionDir)..\mysqlpp\lib";"$(SolutionDir)..\irstlm\src""
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;N_BEST;LM_INTERNAL;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies=""$(SolutionDir)\$(ConfigurationName)\moses.lib" "$(SolutionDir)\$(ConfigurationName)\irstlm.lib" mysqlpp.lib libmysql.lib libboost_thread-vc80-mt-gd.lib"
- OutputFile="$(ProjectDir)\$(ProjectName).exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\src\IOCommandLine.cpp"
- >
- </File>
- <File
- RelativePath=".\src\IOFile.cpp"
- >
- </File>
- <File
- RelativePath=".\src\Main.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\src\IOCommandLine.h"
- >
- </File>
- <File
- RelativePath=".\src\IOFile.h"
- >
- </File>
- <File
- RelativePath=".\src\Main.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/moses-cmd/regenerate-makefiles.sh b/moses-cmd/regenerate-makefiles.sh deleted file mode 100755 index e217cbbd9..000000000 --- a/moses-cmd/regenerate-makefiles.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -echo "Calling autoconf..." -autoconf -echo "Calling automake..." -automake - -echo -echo "You should now be able to configure and build:" -echo " env LDFLAGS=-static ./configure --with-boost=/home/ws06/cdyer/boost-stage --with-srilm=/home/ws06/cdyer/srilm --with-moses=\`pwd\`/../moses" -echo " make -j 4" -echo diff --git a/moses-cmd/src/IOCommandLine.cpp b/moses-cmd/src/IOCommandLine.cpp deleted file mode 100755 index 153fe4283..000000000 --- a/moses-cmd/src/IOCommandLine.cpp +++ /dev/null @@ -1,202 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (c) 2006 University of Edinburgh -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the University of Edinburgh nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -***********************************************************************/ - -// example file on how to use moses library - -#include <iostream> -#include "TypeDef.h" -#include "Util.h" -#include "IOCommandLine.h" -#include "Hypothesis.h" -#include "WordsRange.h" -#include "LatticePathList.h" -#include "StaticData.h" -#include "DummyScoreProducers.h" - -using namespace std; - -IOCommandLine::IOCommandLine( - const vector<FactorType> &inputFactorOrder - , const vector<FactorType> &outputFactorOrder - , const FactorTypeSet &inputFactorUsed - , FactorCollection &factorCollection - , size_t nBestSize - , const string &nBestFilePath) -:m_inputFactorOrder(inputFactorOrder) -,m_outputFactorOrder(outputFactorOrder) -,m_inputFactorUsed(inputFactorUsed) -,m_factorCollection(factorCollection) -{ - if (nBestSize > 0) - { - m_nBestFile.open(nBestFilePath.c_str()); - } -} - -InputType*IOCommandLine::GetInput(InputType* in) -{ - return InputOutput::GetInput(in,std::cin,m_inputFactorOrder, m_factorCollection); -} - -// help fn -void OutputSurface(std::ostream &out, const Phrase &phrase, const std::vector<FactorType> &outputFactorOrder, bool reportAllFactors) -{ - assert(outputFactorOrder.size() > 0); - if (reportAllFactors == true) - { - out << phrase; - } - else - { - size_t size = phrase.GetSize(); - for (size_t pos = 0 ; pos < size ; pos++) - { - const Factor *factor = phrase.GetFactor(pos, outputFactorOrder[0]); - out << *factor; - - for (size_t i = 1 ; i < outputFactorOrder.size() ; i++) - { - const Factor *factor = phrase.GetFactor(pos, outputFactorOrder[i]); - out << "|" << *factor; - } - out << " "; - } - } -} - -void OutputSurface(std::ostream &out, const Hypothesis *hypo, const std::vector<FactorType> &outputFactorOrder - ,bool reportSourceSpan, bool reportAllFactors) -{ - if ( hypo != NULL) - { - OutputSurface(out, hypo->GetPrevHypo(), outputFactorOrder, reportSourceSpan, reportAllFactors); - OutputSurface(out, hypo->GetPhrase(), outputFactorOrder, reportAllFactors); - - if (reportSourceSpan == true - && hypo->GetPhrase().GetSize() > 0) { - out << "|" << hypo->GetCurrSourceWordsRange().GetStartPos() - << "-" << hypo->GetCurrSourceWordsRange().GetEndPos() << "| "; - } - } -} - - -void IOCommandLine::Backtrack(const Hypothesis *hypo){ - - if (hypo->GetPrevHypo() != NULL) { - TRACE_ERR("["<< hypo ->m_id<<" => "<<hypo->GetPrevHypo()->m_id<<"]" <<endl); - Backtrack(hypo->GetPrevHypo()); - } -} - -void IOCommandLine::SetOutput(const Hypothesis *hypo, long /*translationId*/, bool reportSourceSpan, bool reportAllFactors) -{ - if (hypo != NULL) - { - TRACE_ERR("BEST HYPO: " << *hypo << endl); - #ifdef NBEST - TRACE_ERR(hypo->GetScoreBreakdown() << std::endl); - #endif - Backtrack(hypo); - - OutputSurface(cout, hypo, m_outputFactorOrder, reportSourceSpan, reportAllFactors); - } - else - { - TRACE_ERR("NO BEST HYPO" << endl); - } - - cout << endl; -} - -void IOCommandLine::SetNBest(const LatticePathList &nBestList, long translationId) -{ -#ifdef N_BEST - LatticePathList::const_iterator iter; - for (iter = nBestList.begin() ; iter != nBestList.end() ; ++iter) - { - const LatticePath &path = **iter; - const std::vector<const Hypothesis *> &edges = path.GetEdges(); - - // out the surface factor of the translation - m_nBestFile << translationId << " ||| "; - for (int currEdge = (int)edges.size() - 1 ; currEdge >= 0 ; currEdge--) - { - const Hypothesis &edge = *edges[currEdge]; - OutputSurface(m_nBestFile, edge.GetTargetPhrase(), m_outputFactorOrder, false); // false for not reporting all factors - } - m_nBestFile << " ||| "; - - // score - // rolled up scores - - // basic distortion - m_nBestFile << path.GetScoreBreakdown().GetScoreForProducer(StaticData::Instance()->GetDistortionScoreProducer()) << " "; - - // lm - const LMList& lml = StaticData::Instance()->GetAllLM(); - LMList::const_iterator lmi = lml.begin(); - for (; lmi != lml.end(); ++lmi) { - m_nBestFile << path.GetScoreBreakdown().GetScoreForProducer(*lmi) << " "; - } - - // trans components - vector<PhraseDictionaryBase*> pds = StaticData::Instance()->GetPhraseDictionaries(); - vector<PhraseDictionaryBase*>::reverse_iterator i = pds.rbegin(); - for (; i != pds.rend(); ++i) { - vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*i); - for (size_t j = 0; j<scores.size(); ++j) - m_nBestFile << scores[j] << " "; - - } - - // WP - m_nBestFile << path.GetScoreBreakdown().GetScoreForProducer(StaticData::Instance()->GetWordPenaltyProducer()) << " "; - - // generation - vector<GenerationDictionary*> gds = StaticData::Instance()->GetGenerationDictionaries(); - vector<GenerationDictionary*>::reverse_iterator gi = gds.rbegin(); - for (; gi != gds.rend(); ++gi) { - vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*gi); - for (size_t j = 0; j<scores.size(); j++) { - m_nBestFile << scores[j] << " "; - } - } - - // total - m_nBestFile << "||| " << path.GetTotalScore() << endl; - } - - m_nBestFile<<std::flush; -#endif -} - diff --git a/moses-cmd/src/IOCommandLine.h b/moses-cmd/src/IOCommandLine.h deleted file mode 100755 index f2218a12a..000000000 --- a/moses-cmd/src/IOCommandLine.h +++ /dev/null @@ -1,86 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (c) 2006 University of Edinburgh -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the University of Edinburgh nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -***********************************************************************/ - -// example file on how to use moses library - -#pragma once - -#include <fstream> -#include <vector> -#include <boost/algorithm/string.hpp> -#include "TypeDef.h" -#include "InputOutput.h" -#include "Sentence.h" - -class FactorTypeSet; -class FactorCollection; - -class IOCommandLine : public InputOutput -{ -protected: - const std::vector<FactorType> &m_inputFactorOrder; - const std::vector<FactorType> &m_outputFactorOrder; - const FactorTypeSet &m_inputFactorUsed; - FactorCollection &m_factorCollection; - std::ofstream m_nBestFile; -public: - IOCommandLine(const std::vector<FactorType> &inputFactorOrder - , const std::vector<FactorType> &outputFactorOrder - , const FactorTypeSet &inputFactorUsed - , FactorCollection &factorCollection - , size_t nBestSize - , const std::string &nBestFilePath); - - InputType* GetInput(InputType*); - void SetOutput(const Hypothesis *hypo, long translationId, bool reportSourceSpan, bool reportAllFactors); - void SetNBest(const LatticePathList &nBestList, long translationId); - void Backtrack(const Hypothesis *hypo); -}; - -#if 0 -// help fn -inline Sentence *GetInput(std::istream &inputStream - , const std::vector<FactorType> &factorOrder - , FactorCollection &factorCollection) -{ - - return dynamic_cast<Sentence*>(GetInput(new Sentence(Input),inputStream,factorOrder,factorCollection)); -#if 0 - Sentence *rv=new Sentence(Input); - if(rv->Read(inputStream,factorOrder,factorCollection)) - return rv; - else {delete rv; return 0;} -#endif -} - - -#endif diff --git a/moses-cmd/src/IOFile.cpp b/moses-cmd/src/IOFile.cpp deleted file mode 100755 index 97eddd894..000000000 --- a/moses-cmd/src/IOFile.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (c) 2006 University of Edinburgh -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the University of Edinburgh nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -***********************************************************************/ - -// example file on how to use moses library - -#include "IOFile.h" -#include "Sentence.h" -using namespace std; - -IOFile::IOFile(const std::vector<FactorType> &inputFactorOrder - , const std::vector<FactorType> &outputFactorOrder - , const FactorTypeSet &inputFactorUsed - , FactorCollection &factorCollection - , size_t nBestSize - , const std::string &nBestFilePath - , const std::string &inputFilePath) -:IOCommandLine(inputFactorOrder, outputFactorOrder, inputFactorUsed, factorCollection, nBestSize, nBestFilePath) -,m_inputFilePath(inputFilePath) -,m_inputFile(inputFilePath) -{ -} - -InputType* IOFile::GetInput(InputType* in) -{ - return InputOutput::GetInput(in,m_inputFile, m_inputFactorOrder, m_factorCollection); -} - -void IOFile::GetInputPhrase(std::list<Phrase> &inputPhraseList) -{ - ifstream inputFile(m_inputFilePath.c_str()); - while(Sentence *sentence=dynamic_cast<Sentence*>(InputOutput::GetInput(new Sentence(Input),inputFile, m_inputFactorOrder, m_factorCollection))) - { - inputPhraseList.push_back(*sentence); - Release(sentence); - } -} - diff --git a/moses-cmd/src/IOFile.h b/moses-cmd/src/IOFile.h deleted file mode 100755 index fa1501055..000000000 --- a/moses-cmd/src/IOFile.h +++ /dev/null @@ -1,60 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (c) 2006 University of Edinburgh -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the University of Edinburgh nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -***********************************************************************/ - -// example file on how to use moses library - -#pragma once - -#include <fstream> -#include <vector> -#include "TypeDef.h" -#include "IOCommandLine.h" -#include "InputFileStream.h" - -class IOFile : public IOCommandLine -{ -protected: - std::string m_inputFilePath; - InputFileStream m_inputFile; -public: - IOFile(const std::vector<FactorType> &inputFactorOrder - , const std::vector<FactorType> &outputFactorOrder - , const FactorTypeSet &inputFactorUsed - , FactorCollection &factorCollection - , size_t nBestSize - , const std::string &nBestFilePath - , const std::string &inputFilePath); - - InputType *GetInput(InputType*); - void GetInputPhrase(std::list<Phrase> &inputPhraseList); -}; - diff --git a/moses-cmd/src/IOMySQL.cpp b/moses-cmd/src/IOMySQL.cpp deleted file mode 100755 index 355782987..000000000 --- a/moses-cmd/src/IOMySQL.cpp +++ /dev/null @@ -1,111 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (c) 2006 University of Edinburgh -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the University of Edinburgh nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -***********************************************************************/ - -// example file on how to use moses library - -#include <sstream> -#include <string> -#include <iostream> -#include "Hypothesis.h" -#include "Sentence.h" -#include "FactorCollection.h" -#include "IOMySQL.h" - // redefines max() ?? - -using namespace std; - -// sleep helper fns -#ifdef WIN32 -#include "windows.h" -// get Sleep(millisec) - -#endif -#ifndef WIN32 -void Sleep(unsigned int mSec) -{ - usleep( mSec * 1000 ); -} -#endif - -IOMySQL::IOMySQL(const string &host - , const string &db - , const string &login - , const string &password - , long inputStreamId - , long outputStreamId - , const std::vector<FactorType> &factorOrder - , const FactorTypeSet &inputFactorUsed - , FactorCollection &factorCollection) -:m_db(db) -,m_host(host) -,m_login(login) -,m_password(password) -,m_inputStreamId(inputStreamId) -,m_outputStreamId(outputStreamId) -,m_factorOrder(factorOrder) -,m_inputFactorUsed(inputFactorUsed) -,m_factorCollection(factorCollection) -{ - Connect(m_conn); - m_threadMySQL = new ThreadMySQL(m_conn, inputStreamId, outputStreamId, factorCollection); - m_inputThread = new boost::thread(*m_threadMySQL); -} - -IOMySQL::~IOMySQL() -{ - //m_inputThread->join(); - delete m_inputThread; - delete m_threadMySQL; -} - -void IOMySQL::Connect(mysqlpp::Connection &conn) -{ - TRACE_ERR(m_db << " " << m_host << " " << m_login << " " << m_password << endl); - while (!conn.connect(m_db.c_str(), m_host.c_str(), m_login.c_str(), m_password.c_str())) - { // try again in a few seconds - TRACE_ERR("connection failed, trying again in 10 seconds" << endl); - Sleep(10000); - } -} - -InputType *IOMySQL::GetInput(InputType*) -{ - TRACE_ERR("boo" << endl); - //return m_threadMySQL->GetSentence(); - return NULL; -} - -void IOMySQL::SetOutput(const Hypothesis *hypo, long translationId, bool reportSourceSpan, bool reportAllFactors) -{ - //m_threadMySQL->SetTranslation(hypo, translationId); -} - diff --git a/moses-cmd/src/IOMySQL.h b/moses-cmd/src/IOMySQL.h deleted file mode 100755 index ce7e5ba87..000000000 --- a/moses-cmd/src/IOMySQL.h +++ /dev/null @@ -1,78 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (c) 2006 University of Edinburgh -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the University of Edinburgh nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -***********************************************************************/ - -// example file on how to use moses library - -#pragma once - -#include <string> -#include <vector> -#include <boost/thread/thread.hpp> -#include <boost/thread/xtime.hpp> -#include "mysql++.h" -#include "InputOutput.h" -#include "ThreadMySQL.h" - -class LatticePathList; - -class IOMySQL : public InputOutput -{ -protected: - std::string m_db, m_host, m_login, m_password; - mysqlpp::Connection m_conn; - long m_inputStreamId, m_outputStreamId; - const std::vector<FactorType> &m_factorOrder; - const FactorTypeSet &m_inputFactorUsed; - FactorCollection &m_factorCollection; - ThreadMySQL *m_threadMySQL; - boost::thread *m_inputThread; - -public: - IOMySQL(const std::string &host - , const std::string &db - , const std::string &login - , const std::string &password - , long inputStreamId - , long outputStreamId - , const std::vector<FactorType> &factorOrder - , const FactorTypeSet &inputFactorUsed - , FactorCollection &factorCollection); - ~IOMySQL(); - void Connect(mysqlpp::Connection &conn); - InputType *GetInput(InputType*); - void SetOutput(const Hypothesis *hypo, long translationId, bool reportSourceSpan, bool reportAllFactors); - void SetNBest(const LatticePathList &nBestList, long translationId) - { - } - -}; - diff --git a/moses-cmd/src/Main.cpp b/moses-cmd/src/Main.cpp deleted file mode 100644 index 6b89e281b..000000000 --- a/moses-cmd/src/Main.cpp +++ /dev/null @@ -1,229 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (c) 2006 University of Edinburgh -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the University of Edinburgh nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -***********************************************************************/ - -// example file on how to use moses library - -#ifdef WIN32 -// Include Visual Leak Detector -#include <vld.h> -#endif - -#include <fstream> -#include "Main.h" -#include "LatticePath.h" -#include "FactorCollection.h" -#include "Manager.h" -#include "Phrase.h" -#include "Util.h" -#include "LatticePathList.h" -#include "Timer.h" -#include "IOCommandLine.h" -#include "IOFile.h" -#include "Sentence.h" -#include "ConfusionNet.h" - -#if HAVE_CONFIG_H -#include "config.h" -# ifdef HAVE_MYSQLPP -# define USE_MYSQL 1 -# endif -#else -// those not using autoconf have to build MySQL support for now -# define USE_MYSQL 1 -#endif - -#undef USE_MYSQL -#ifdef USE_MYSQL -#include "IOMySQL.h" -#endif - -using namespace std; -Timer timer; - -int main(int argc, char* argv[]) -{ - timer.start("Starting..."); - - std::cerr - <<"============================================================================\n" - <<"starting "<<argv[0]<<" (build on "<<__DATE__<<")\n" - <<"============================================================================\n" - <<"\n" - <<"the command line was: \n"; - for(int i=0;i<argc;++i) std::cerr<<argv[i]<<" "; - std::cerr - <<"\n" - <<"============================================================================\n"; - - StaticData staticData; - - if (!staticData.LoadParameters(argc, argv)) - return EXIT_FAILURE; - - /* - * boost::shared_ptr<UnknownWordHandler> unknownWordHandler(new UnknownWordHandler); - staticData.SetUnknownWordHandler(unknownWordHandler); - */ - if (staticData.GetVerboseLevel() > 0) - { -#if N_BEST - std::cerr << "N_BEST=enabled\n"; -#else - std::cerr << "N_BEST=disabled\n"; -#endif - } - - - // set up read/writing class - InputOutput *inputOutput = GetInputOutput(staticData); - - std::cerr << "The score component vector looks like this:\n" << staticData.GetScoreIndexManager(); - std::cerr << "The global weight vector looks like this:\n"; - vector<float> weights = staticData.GetAllWeights(); - std::cerr << weights[0]; - for (size_t j=1; j<weights.size(); j++) { std::cerr << ", " << weights[j]; } - std::cerr << "\n"; - // every score must have a weight! check that here: - assert(weights.size() == staticData.GetScoreIndexManager().GetTotalNumberOfScores()); - - if (inputOutput == NULL) - return EXIT_FAILURE; - - // read each sentence & decode - while(InputType *source = inputOutput->GetInput((staticData.GetInputType() ? - static_cast<InputType*>(new ConfusionNet) : - static_cast<InputType*>(new Sentence(Input))))) - { - TRACE_ERR(*source<<"\n"); - - TranslationOptionCollection *translationOptionCollection=source->CreateTranslationOptionCollection(); - assert(translationOptionCollection); - - staticData.InitializeBeforeSentenceProcessing(*source); - Manager manager(*source, *translationOptionCollection, staticData); - manager.ProcessSentence(); - inputOutput->SetOutput(manager.GetBestHypothesis(), source->GetTranslationId(), - staticData.GetReportSourceSpan(), - staticData.GetReportAllFactors() - ); - - // n-best - size_t nBestSize = staticData.GetNBestSize(); - if (nBestSize > 0) - { - TRACE_ERR(nBestSize << " " << staticData.GetNBestFilePath() << endl); - LatticePathList nBestList; - manager.CalcNBest(nBestSize, nBestList); - inputOutput->SetNBest(nBestList, source->GetTranslationId()); - RemoveAllInColl< LatticePathList::iterator > (nBestList); - } - - // delete source - // inputOutput->Release(source); - staticData.CleanUpAfterSentenceProcessing(); - delete translationOptionCollection; - delete source; - } - - delete inputOutput; - - timer.check("End."); - return EXIT_SUCCESS; -} - -InputOutput *GetInputOutput(StaticData &staticData) -{ - InputOutput *inputOutput; - const std::vector<FactorType> &inputFactorOrder = staticData.GetInputFactorOrder() - ,&outputFactorOrder = staticData.GetOutputFactorOrder(); - FactorTypeSet inputFactorUsed(inputFactorOrder); - - // io - if (staticData.GetIOMethod() == IOMethodMySQL) - { - TRACE_ERR("IO from MySQL" << endl); -#if USE_MYSQL - const PARAM_VEC &mySQLParam = staticData.GetParam("mysql"); - inputOutput = new IOMySQL(mySQLParam[0], mySQLParam[1], mySQLParam[2], mySQLParam[3] - , Scan<long>(mySQLParam[4]), Scan<long>(mySQLParam[5]) - , inputFactorOrder, inputFactorUsed, staticData.GetFactorCollection()); - staticData.LoadPhraseTables(); -#else - TRACE_ERR( "moses was not built with mysql libraries, please configure\n" - << " to use another input method.\n"); - inputOutput = NULL; -#endif - } - else if (staticData.GetIOMethod() == IOMethodFile) - { - TRACE_ERR("IO from File" << endl); - string inputFileHash; - list< Phrase > inputPhraseList; - string filePath = staticData.GetParam("input-file")[0]; - - TRACE_ERR("About to create ioFile" << endl); - IOFile *ioFile = new IOFile(inputFactorOrder, outputFactorOrder, inputFactorUsed - , staticData.GetFactorCollection() - , staticData.GetNBestSize() - , staticData.GetNBestFilePath() - , filePath); - if(staticData.GetInputType()) - { - TRACE_ERR("Do not read input phrases for confusion net translation\n"); - } - else - { - TRACE_ERR("About to GetInputPhrase\n"); - ioFile->GetInputPhrase(inputPhraseList); - } - TRACE_ERR("After GetInputPhrase" << endl); - inputOutput = ioFile; - inputFileHash = GetMD5Hash(filePath); - TRACE_ERR("About to LoadPhraseTables" << endl); - staticData.LoadPhraseTables(true, inputFileHash, inputPhraseList); - ioFile->ResetSentenceId(); - } - else - { - TRACE_ERR("IO from STDOUT/STDIN" << endl); - inputOutput = new IOCommandLine(inputFactorOrder, outputFactorOrder, inputFactorUsed - , staticData.GetFactorCollection() - , staticData.GetNBestSize() - , staticData.GetNBestFilePath()); - staticData.LoadPhraseTables(); - } - staticData.LoadMapping(); - timer.check("Created input-output object"); - - return inputOutput; -} - diff --git a/moses-cmd/src/Main.h b/moses-cmd/src/Main.h deleted file mode 100644 index 1c3628533..000000000 --- a/moses-cmd/src/Main.h +++ /dev/null @@ -1,42 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (c) 2006 University of Edinburgh -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the University of Edinburgh nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -***********************************************************************/ - -// example file on how to use moses library - -#pragma once - -#include "StaticData.h" - -class InputOutput; - -int main(int argc, char* argv[]); -InputOutput *GetInputOutput(StaticData &staticData); diff --git a/moses-cmd/src/Makefile b/moses-cmd/src/Makefile deleted file mode 100644 index e33fa7f24..000000000 --- a/moses-cmd/src/Makefile +++ /dev/null @@ -1,416 +0,0 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. -# src/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 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. - - - -SOURCES = $(moses_SOURCES) - -srcdir = . -top_srcdir = .. - -pkgdatadir = $(datadir)/moses -pkglibdir = $(libdir)/moses -pkgincludedir = $(includedir)/moses -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = /usr/bin/install -c -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 = : -bin_PROGRAMS = moses$(EXEEXT) -#am__append_1 = IOMySQL.cpp ThreadMySQL.cpp -subdir = src -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(bin_PROGRAMS) -am__moses_SOURCES_DIST = Main.cpp IOCommandLine.cpp IOFile.cpp \ - IOMySQL.cpp ThreadMySQL.cpp -#am__objects_1 = IOMySQL.$(OBJEXT) \ -# ThreadMySQL.$(OBJEXT) -am_moses_OBJECTS = Main.$(OBJEXT) IOCommandLine.$(OBJEXT) \ - IOFile.$(OBJEXT) $(am__objects_1) -moses_OBJECTS = $(am_moses_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ - -o $@ -SOURCES = $(moses_SOURCES) -DIST_SOURCES = $(am__moses_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /home/ws06/rzens/workspace/Jul31/moses-cmd/missing --run aclocal-1.9 -AMDEP_FALSE = # -AMDEP_TRUE = -AMTAR = ${SHELL} /home/ws06/rzens/workspace/Jul31/moses-cmd/missing --run tar -AUTOCONF = ${SHELL} /home/ws06/rzens/workspace/Jul31/moses-cmd/missing --run autoconf -AUTOHEADER = ${SHELL} /home/ws06/rzens/workspace/Jul31/moses-cmd/missing --run autoheader -AUTOMAKE = ${SHELL} /home/ws06/rzens/workspace/Jul31/moses-cmd/missing --run automake-1.9 -AWK = gawk -BUILD_MYSQL_SUPPORT_FALSE = -BUILD_MYSQL_SUPPORT_TRUE = # -CPPFLAGS = -I/home/ws06/cdyer/boost-stage -I/home/ws06/cdyer/boost-stage/include -I/home/ws06/rzens/workspace/Jul31/moses/src -I/home/ws06/cdyer/srilm/include -CXX = g++ -CXXCPP = g++ -E -CXXDEPMODE = depmode=gcc3 -CXXFLAGS = -g -O2 -CYGPATH_W = echo -DEFS = -DHAVE_CONFIG_H -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = grep -E -EXEEXT = -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -INTERNAL_LM_FALSE = -INTERNAL_LM_TRUE = # -IRST_LM_FALSE = -IRST_LM_TRUE = # -LDFLAGS = -static -L/home/ws06/cdyer/boost-stage/lib -L/home/ws06/cdyer/boost-stage/stage/lib -L/home/ws06/rzens/workspace/Jul31/moses/src -L/home/ws06/cdyer/srilm/lib/i686 -LIBOBJS = -LIBS = -lmoses -loolm -ldstruct -lmisc -lboost_iostreams-gcc-mt -lboost_filesystem-gcc-mt -lboost_thread-gcc-mt -lz -LTLIBOBJS = -MAKEINFO = ${SHELL} /home/ws06/rzens/workspace/Jul31/moses-cmd/missing --run makeinfo -MYSQLCLIENT_CPPFLAGS = -MYSQLCLIENT_LDFLAGS = -MYSQLCLIENT_LIBS = -OBJEXT = o -PACKAGE = moses -PACKAGE_BUGREPORT = -PACKAGE_NAME = -PACKAGE_STRING = -PACKAGE_TARNAME = -PACKAGE_VERSION = -PATH_SEPARATOR = : -RANLIB = ranlib -SET_MAKE = -SHELL = /bin/sh -SRI_LM_FALSE = # -SRI_LM_TRUE = -STRIP = -VERSION = 0.1 -ac_ct_CXX = g++ -ac_ct_RANLIB = ranlib -ac_ct_STRIP = -am__fastdepCXX_FALSE = # -am__fastdepCXX_TRUE = -am__include = include -am__leading_dot = . -am__quote = -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -bindir = ${exec_prefix}/bin -build_alias = -datadir = ${prefix}/share -exec_prefix = ${prefix} -host_alias = -includedir = ${prefix}/include -infodir = ${prefix}/info -install_sh = /home/ws06/rzens/workspace/Jul31/moses-cmd/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localstatedir = ${prefix}/var -mandir = ${prefix}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -prefix = /usr/local -program_transform_name = s,x,x, -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target_alias = -moses_SOURCES = Main.cpp IOCommandLine.cpp IOFile.cpp $(am__append_1) -AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -moses_LDADD = -lmoses -moses_DEPENDENCIES = $(top_srcdir)/../moses/src/libmoses.a -all: all-am - -.SUFFIXES: -.SUFFIXES: .cpp .o .obj -$(srcdir)/Makefile.in: $(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 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: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -moses$(EXEEXT): $(moses_OBJECTS) $(moses_DEPENDENCIES) - @rm -f moses$(EXEEXT) - $(CXXLINK) $(moses_LDFLAGS) $(moses_OBJECTS) $(moses_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -include ./$(DEPDIR)/IOCommandLine.Po -include ./$(DEPDIR)/IOFile.Po -include ./$(DEPDIR)/IOMySQL.Po -include ./$(DEPDIR)/Main.Po -include ./$(DEPDIR)/ThreadMySQL.Po - -.cpp.o: - if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(CXXCOMPILE) -c -o $@ $< - -.cpp.obj: - if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ - then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -# source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` -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: - for dir in "$(DESTDIR)$(bindir)"; 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-binPROGRAMS clean-generic mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-binPROGRAMS - -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 - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - 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 pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS 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/moses-cmd/src/Makefile.am b/moses-cmd/src/Makefile.am deleted file mode 100644 index 8a29f9ec9..000000000 --- a/moses-cmd/src/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -bin_PROGRAMS = moses -moses_SOURCES = Main.cpp IOCommandLine.cpp IOFile.cpp -AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES - -moses_LDADD = -lmoses -moses_DEPENDENCIES = $(top_srcdir)/../moses/src/libmoses.a - -if BUILD_MYSQL_SUPPORT -moses_SOURCES += IOMySQL.cpp ThreadMySQL.cpp -endif - diff --git a/moses-cmd/src/Makefile.in b/moses-cmd/src/Makefile.in deleted file mode 100644 index 4338dc611..000000000 --- a/moses-cmd/src/Makefile.in +++ /dev/null @@ -1,416 +0,0 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 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@ - -SOURCES = $(moses_SOURCES) - -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 = : -bin_PROGRAMS = moses$(EXEEXT) -@BUILD_MYSQL_SUPPORT_TRUE@am__append_1 = IOMySQL.cpp ThreadMySQL.cpp -subdir = src -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(bin_PROGRAMS) -am__moses_SOURCES_DIST = Main.cpp IOCommandLine.cpp IOFile.cpp \ - IOMySQL.cpp ThreadMySQL.cpp -@BUILD_MYSQL_SUPPORT_TRUE@am__objects_1 = IOMySQL.$(OBJEXT) \ -@BUILD_MYSQL_SUPPORT_TRUE@ ThreadMySQL.$(OBJEXT) -am_moses_OBJECTS = Main.$(OBJEXT) IOCommandLine.$(OBJEXT) \ - IOFile.$(OBJEXT) $(am__objects_1) -moses_OBJECTS = $(am_moses_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ - -o $@ -SOURCES = $(moses_SOURCES) -DIST_SOURCES = $(am__moses_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BUILD_MYSQL_SUPPORT_FALSE = @BUILD_MYSQL_SUPPORT_FALSE@ -BUILD_MYSQL_SUPPORT_TRUE = @BUILD_MYSQL_SUPPORT_TRUE@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTERNAL_LM_FALSE = @INTERNAL_LM_FALSE@ -INTERNAL_LM_TRUE = @INTERNAL_LM_TRUE@ -IRST_LM_FALSE = @IRST_LM_FALSE@ -IRST_LM_TRUE = @IRST_LM_TRUE@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MYSQLCLIENT_CPPFLAGS = @MYSQLCLIENT_CPPFLAGS@ -MYSQLCLIENT_LDFLAGS = @MYSQLCLIENT_LDFLAGS@ -MYSQLCLIENT_LIBS = @MYSQLCLIENT_LIBS@ -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@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SRI_LM_FALSE = @SRI_LM_FALSE@ -SRI_LM_TRUE = @SRI_LM_TRUE@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -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_alias = @build_alias@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -moses_SOURCES = Main.cpp IOCommandLine.cpp IOFile.cpp $(am__append_1) -AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -moses_LDADD = -lmoses -moses_DEPENDENCIES = $(top_srcdir)/../moses/src/libmoses.a -all: all-am - -.SUFFIXES: -.SUFFIXES: .cpp .o .obj -$(srcdir)/Makefile.in: $(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 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: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -moses$(EXEEXT): $(moses_OBJECTS) $(moses_DEPENDENCIES) - @rm -f moses$(EXEEXT) - $(CXXLINK) $(moses_LDFLAGS) $(moses_OBJECTS) $(moses_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IOCommandLine.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IOFile.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IOMySQL.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ThreadMySQL.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) '$<'` -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: - for dir in "$(DESTDIR)$(bindir)"; 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-binPROGRAMS clean-generic mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-binPROGRAMS - -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 - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - 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 pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS 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/moses-cmd/src/ThreadMySQL.cpp b/moses-cmd/src/ThreadMySQL.cpp deleted file mode 100644 index 36fb7b7ec..000000000 --- a/moses-cmd/src/ThreadMySQL.cpp +++ /dev/null @@ -1,242 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (c) 2006 University of Edinburgh -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the University of Edinburgh nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -***********************************************************************/ - -// example file on how to use moses library - -#include "Sentence.h" -#include "Hypothesis.h" -#include "ThreadMySQL.h" -#include "TypeDef.h" - -using namespace std; - -void ThreadMySQL::operator()() -{ - for (int i = 0; i < 100 ; i++) - { - TRACE_ERR("from class" << std::endl); - - for (int currSentence = 0 ; currSentence < 5 ; currSentence++) - { - } - } -} - -Sentence *ThreadMySQL::GetSentence() -{ - if (m_sentenceList.size()) - { - Sentence *ret = m_sentenceList.front(); - m_sentenceList.erase(m_sentenceList.begin()); - return ret; - } - else - { - return NULL; - } -} - -// helper fn -void EscapeString(string &sql) -{ - if (!sql.size()) - { - return; - } - - for (unsigned int i = 0; i < sql.size(); i++) - { - switch (sql[i]) - { - case '\\': - sql.insert(i, "\\", 1); - i++; - break; - case '\"': - sql.insert(i, "\\", 1); - i++; - break; - case '\'': - sql.insert(i, "\\", 1); - i++; - break; - } - } -} - -void ThreadMySQL::SetTranslation(const Hypothesis *hypo, long translationId) -{ - stringstream strme; - - // tell people we've finished this translation - if (hypo == NULL) - { - strme << "UPDATE translation" - << " SET unparsed = ''" - << " ,completed_date = NOW()" - << " WHERE translation_id = " << translationId; - } - else - { - TRACE_ERR("BEST HYPO: " << *hypo << endl); - // translated string - strme << *hypo; - string unparsed = strme.str(); - EscapeString(unparsed); - - // sql - strme.str(""); - strme << "UPDATE translation" - << " SET unparsed = ' " << unparsed << "'" - << " ,completed_date = NOW()" - << " ,cost_translation = " << "0" - << " ,cost_LM = " << "0" - << " ,cost_distortion = " << "0" - << " ,cost_word_penalty = " << "0" - << " ,cost_future = " << "0" - << " ,cost_total = " << "0" - << " WHERE translation_id = " << translationId; - } - - mysqlpp::Query query = m_conn.query(); - query.exec(strme.str()); - query.reset(); - - - // delete any previous results - strme.str(""); - strme << "DELETE word_occurence WHERE translation_id = " - << translationId; - query.exec(strme.str()); - query.reset(); - - for (size_t pos = 0 ; pos < hypo->GetSize() ; pos++) - { - - strme.str(""); - strme << "INSERT word_occurence (translation_id, ordering, surface, pos, stem, morphology)" - << " VALUES (" << translationId << "," << pos << ","; - - for (unsigned int currFactor = 0 ; currFactor < NUM_FACTORS ; currFactor++) - { - FactorType factorType = static_cast<FactorType>(currFactor); - const Factor *factor = hypo->GetFactor(pos, factorType); - if (factor == NULL) - { - strme << "NULL,"; - } - else - { - string str = factor->GetString(); - EscapeString(str); - strme << "'" << str << "',"; - } - } - - string sql = strme.str(); - sql = sql.substr(0, sql.size() - 1); - sql += ")"; - - query.exec(sql); - query.reset(); - } -} - -Sentence *ThreadMySQL::ReadSentence(mysqlpp::Connection &conn) -{ - /* - stringstream strme; - strme << "SELECT Tin.translation_id idIn, Tout.translation_id idOut" - << " FROM translation Tin, translation Tout" - << " WHERE Tin.datastream_id = " << m_inputStreamId - << " AND Tout.datastream_id = " << m_outputStreamId - << " AND Tin.sentence_id = Tout.sentence_id" - << " AND Tout.completed_date IS NULL" - << " AND (Tout.scheduled_date IS NULL" - << " OR Tout.scheduled_date < DATE_SUB(NOW(), INTERVAL 20 MINUTE) )" - << " LIMIT 1" - << " FOR UPDATE;"; - - mysqlpp::Query query = conn.query(); - query << strme.str(); - mysqlpp::Result res = query.store(); - query.reset(); - mysqlpp::Row row; - if (res && (row = res.at(0))) - { // found a sentence to translate. get all words in it -// cerr << row["translation_id"] << endl; - long idIn = row["idIn"] - ,idOut= row["idOut"]; - - Sentence *sentence = new Sentence(Input); - sentence->SetTranslationId(idOut); - - strme.str(""); - strme << "SELECT surface, pos, stem, morphology" - << " FROM word_occurence" - << " WHERE translation_id = " << idIn - << " ORDER BY ordering;"; - - query << strme.str(); - res = query.store(); - if (res) - { - for (int i = 0; row = res.at(i); ++i) - { - FactorArray &factorArray = sentence->AddWord(); - if (!row["surface"].is_null()) - factorArray[Surface] = m_factorCollection.AddFactor(Input, Surface, row["surface"].c_str()); - if (!row["pos"].is_null()) - factorArray[POS] = m_factorCollection.AddFactor(Input, POS, row["pos"].c_str()); - if (!row["stem"].is_null()) - factorArray[Stem] = m_factorCollection.AddFactor(Input, Stem, row["stem"].c_str()); - if (!row["morphology"].is_null()) - factorArray[Morphology] =m_factorCollection.AddFactor(Input, Morphology, row["morphology"].c_str()); - } - - // update output translation to let people know we're currently translating it - query.reset(); - strme.str(""); - strme << "UPDATE translation SET scheduled_date = NOW() WHERE translation_id = " - << idOut; - query.exec(strme.str()); - } - - return sentence; - } - else - { // no more sentences - return NULL; - } - */ -} - diff --git a/moses-cmd/src/ThreadMySQL.h b/moses-cmd/src/ThreadMySQL.h deleted file mode 100644 index a7194c1b2..000000000 --- a/moses-cmd/src/ThreadMySQL.h +++ /dev/null @@ -1,90 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (c) 2006 University of Edinburgh -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the University of Edinburgh nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -***********************************************************************/ - -// example file on how to use moses library - -#pragma once - -#include <iostream> -#include "mysql++.h" -#include "TypeDef.h" -#include "Util.h" -#include "FactorCollection.h" - -class Sentence; -class Hypothesis; - -class ThreadMySQL -{ -protected: - //std::string m_db, m_host, m_login, m_password; - mysqlpp::Connection &m_conn; - long m_inputStreamId, m_outputStreamId; - FactorCollection &m_factorCollection; - std::list<Sentence*> m_sentenceList; - - Sentence *ReadSentence(mysqlpp::Connection &conn); - -public: - ThreadMySQL(mysqlpp::Connection &conn - , long inputStreamId - , long outputStreamId - , FactorCollection &factorCollection) - :m_conn(conn) - ,m_inputStreamId(inputStreamId) - ,m_outputStreamId(outputStreamId) - ,m_factorCollection(factorCollection) - { - } - /* - ThreadMySQL(const std::string &host - , const std::string &db - , const std::string &login - , const std::string &password - , long inputStreamId - , long outputStreamId - , FactorCollection &factorCollection) - :m_db(db) - ,m_host(host) - ,m_login(login) - ,m_password(password) - ,m_inputStreamId(inputStreamId) - ,m_outputStreamId(outputStreamId) - ,m_factorCollection(factorCollection) - {} - */ - - Sentence *GetSentence(); - void SetTranslation(const Hypothesis *hypo, long translationId); - void operator()(); -}; - diff --git a/moses/.cdtbuild b/moses/.cdtbuild deleted file mode 100755 index 94fab21ce..000000000 --- a/moses/.cdtbuild +++ /dev/null @@ -1,117 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?fileVersion 3.0.0?> - -<ManagedProjectBuildInfo> -<project id="moses.cdt.managedbuild.target.gnu.lib.1654550987" name="Static Library (Gnu)" projectType="cdt.managedbuild.target.gnu.lib"> -<configuration artifactExtension="a" artifactName="moses" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.lib.debug.2082569407" name="Debug" parent="cdt.managedbuild.config.gnu.lib.debug"> -<toolChain id="cdt.managedbuild.toolchain.gnu.lib.debug.2031285777" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.lib.debug"> -<tool id="cdt.managedbuild.tool.gnu.c.compiler.lib.debug.1319234555" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.lib.debug"/> -<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.lib.debug.1022475428" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.lib.debug"> -<option id="gnu.cpp.compiler.option.preprocessor.def.2071633498" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols"> -<listOptionValue builtIn="false" value="LM_SRI"/> -<listOptionValue builtIn="false" value="TRACE_ENABLE"/> -<listOptionValue builtIn="false" value="_FILE_OFFSET_BITS=64"/> -<listOptionValue builtIn="false" value="_LARGE_FILES"/> -</option> -<option id="gnu.cpp.compiler.option.include.paths.560695438" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/include/boost-1_33_1"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../irstlm/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/misc/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/dstruct/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/include"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/lm/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysql/include"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib"/> -</option> -<option id="gnu.cpp.compiler.option.debugging.gprof.1598624147" superClass="gnu.cpp.compiler.option.debugging.gprof" value="false" valueType="boolean"/> -</tool> -<tool id="cdt.managedbuild.tool.gnu.archiver.lib.debug.187676627" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.lib.debug"/> -<tool id="cdt.managedbuild.tool.gnu.assembler.lib.debug.1660142337" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.lib.debug"/> -<macros/> -</toolChain> -</configuration> -<configuration artifactExtension="a" artifactName="moses" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.lib.release.875756117" name="Release" parent="cdt.managedbuild.config.gnu.lib.release"> -<toolChain id="cdt.managedbuild.toolchain.gnu.lib.release.1956672127" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.lib.release"> -<tool id="cdt.managedbuild.tool.gnu.c.compiler.lib.release.1930771681" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.lib.release"/> -<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.lib.release.703142952" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.lib.release"> -<option id="gnu.cpp.compiler.option.include.paths.28728819" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/include/boost-1_33_1"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../irstlm/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/misc/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/dstruct/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/include"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/lm/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysql/include"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib"/> -</option> -<option id="gnu.cpp.compiler.option.preprocessor.def.444585015" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols"> -<listOptionValue builtIn="false" value="LM_SRI"/> -<listOptionValue builtIn="false" value="TRACE_ENABLE"/> -<listOptionValue builtIn="false" value="_FILE_OFFSET_BITS=64"/> -<listOptionValue builtIn="false" value="_LARGE_FILES"/> -</option> -<option id="gnu.cpp.compiler.option.debugging.gprof.1449614968" superClass="gnu.cpp.compiler.option.debugging.gprof" value="false" valueType="boolean"/> -</tool> -<tool id="cdt.managedbuild.tool.gnu.archiver.lib.release.1731276863" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.lib.release"/> -<tool id="cdt.managedbuild.tool.gnu.assembler.lib.release.693340097" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.lib.release"/> -<macros/> -</toolChain> -</configuration> -<configuration artifactExtension="a" artifactName="moses" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.lib.debug.837708408" name="DebugNBest" parent="cdt.managedbuild.config.gnu.lib.debug"> -<toolChain id="cdt.managedbuild.toolchain.gnu.lib.debug.1361461230" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.lib.debug"> -<tool id="cdt.managedbuild.tool.gnu.c.compiler.lib.debug.489823169" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.lib.debug"/> -<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.lib.debug.57605597" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.lib.debug"> -<option id="gnu.cpp.compiler.option.preprocessor.def.547610699" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols"> -<listOptionValue builtIn="false" value="LM_SRI"/> -<listOptionValue builtIn="false" value="TRACE_ENABLE"/> -<listOptionValue builtIn="false" value="N_BEST"/> -<listOptionValue builtIn="false" value="_FILE_OFFSET_BITS=64"/> -<listOptionValue builtIn="false" value="_LARGE_FILES"/> -</option> -<option id="gnu.cpp.compiler.option.include.paths.2084651176" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/include/boost-1_33_1"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../irstlm/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/misc/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/dstruct/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/include"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/lm/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysql/include"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib"/> -</option> -<option id="gnu.cpp.compiler.option.debugging.gprof.1182039672" superClass="gnu.cpp.compiler.option.debugging.gprof" value="false" valueType="boolean"/> -</tool> -<tool id="cdt.managedbuild.tool.gnu.archiver.lib.debug.1451721331" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.lib.debug"/> -<tool id="cdt.managedbuild.tool.gnu.assembler.lib.debug.1914532442" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.lib.debug"/> -<macros/> -</toolChain> -</configuration> -<configuration artifactExtension="a" artifactName="moses" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.lib.release.1054653020" name="ReleaseNBest" parent="cdt.managedbuild.config.gnu.lib.release"> -<toolChain id="cdt.managedbuild.toolchain.gnu.lib.release.1271789636" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.lib.release"> -<tool id="cdt.managedbuild.tool.gnu.c.compiler.lib.release.1895488585" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.lib.release"/> -<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.lib.release.322987396" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.lib.release"> -<option id="gnu.cpp.compiler.option.include.paths.1663320352" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> -<listOptionValue builtIn="false" value="${ProjDirPath}/../boost/include/boost-1_33_1"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../irstlm/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/misc/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/dstruct/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/include"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../srilm/lm/src"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysql/include"/> -<listOptionValue builtIn="false" value="${ProjDirPath}/../mysqlpp/lib"/> -</option> -<option id="gnu.cpp.compiler.option.preprocessor.def.1390867069" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols"> -<listOptionValue builtIn="false" value="LM_SRI"/> -<listOptionValue builtIn="false" value="TRACE_ENABLE"/> -<listOptionValue builtIn="false" value="N_BEST"/> -<listOptionValue builtIn="false" value="_FILE_OFFSET_BITS=64"/> -<listOptionValue builtIn="false" value="_LARGE_FILES"/> -</option> -</tool> -<tool id="cdt.managedbuild.tool.gnu.archiver.lib.release.22025776" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.lib.release"/> -<tool id="cdt.managedbuild.tool.gnu.assembler.lib.release.676430715" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.lib.release"/> -<macros/> -</toolChain> -</configuration> -<macros/> -</project> -</ManagedProjectBuildInfo> diff --git a/moses/.cdtproject b/moses/.cdtproject deleted file mode 100755 index 9d4253d9e..000000000 --- a/moses/.cdtproject +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse-cdt version="2.0"?> - -<cdtproject id="org.eclipse.cdt.managedbuilder.core.managedMake"> -<extension id="org.eclipse.cdt.managedbuilder.core.ManagedBuildManager" point="org.eclipse.cdt.core.ScannerInfoProvider"/> -<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> -<extension id="org.eclipse.cdt.core.nullindexer" point="org.eclipse.cdt.core.CIndexer"/> -<data> -<item id="org.eclipse.cdt.core.pathentry"> -<pathentry kind="src" path=""/> -<pathentry kind="out" path=""/> -<pathentry kind="con" path="org.eclipse.cdt.managedbuilder.MANAGED_CONTAINER"/> -</item> -</data> -</cdtproject> diff --git a/moses/.cvsignore b/moses/.cvsignore deleted file mode 100644 index 2317eb748..000000000 --- a/moses/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Debug* -Release* -.deps* diff --git a/moses/.project b/moses/.project deleted file mode 100755 index bad551be6..000000000 --- a/moses/.project +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>moses</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.cdt.core.cnature</nature> - <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> - <nature>org.eclipse.cdt.core.ccnature</nature> - </natures> -</projectDescription> diff --git a/moses/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/moses/.settings/org.eclipse.cdt.managedbuilder.core.prefs deleted file mode 100755 index 7eb2ca3bc..000000000 --- a/moses/.settings/org.eclipse.cdt.managedbuilder.core.prefs +++ /dev/null @@ -1,19 +0,0 @@ -#Sat Jun 24 11:17:00 BST 2006 -eclipse.preferences.version=1 -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.182985892=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.454331295=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1765997310=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.659132175=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.lib.debug.2082569407=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.lib.debug.837708408=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.lib.release.1054653020=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.lib.release.875756117=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.182985892=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.454331295=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.release.1765997310=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.release.659132175=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n -environment/project=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n -environment/project/cdt.managedbuild.config.gnu.lib.debug.2082569407=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n -environment/project/cdt.managedbuild.config.gnu.lib.debug.837708408=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n -environment/project/cdt.managedbuild.config.gnu.lib.release.1054653020=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n -environment/project/cdt.managedbuild.config.gnu.lib.release.875756117=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n diff --git a/moses/Makefile.am b/moses/Makefile.am deleted file mode 100644 index 4566b2680..000000000 --- a/moses/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# not a GNU package. You can remove this line, if -# have all needed files, that a GNU package needs -AUTOMAKE_OPTIONS = foreign -SUBDIRS = src - diff --git a/moses/aclocal.m4 b/moses/aclocal.m4 deleted file mode 100644 index ef60f9840..000000000 --- a/moses/aclocal.m4 +++ /dev/null @@ -1,1044 +0,0 @@ -# generated automatically by aclocal 1.9.2 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# 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. - -# -*- Autoconf -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. -# Generated from amversion.in; do not edit by hand. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - -# 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. -AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION so it can be traced. -# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.9.2])]) - -# AM_AUX_DIR_EXPAND - -# Copyright (C) 2001, 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# 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 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 6 - -# 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]) -AC_SUBST([$1_FALSE]) -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])]) - -# serial 7 -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 -# 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - - -# 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], 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/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]) -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 -# 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -#serial 2 - -# _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. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /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"]) -]) - -# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 2000, 2001, 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 7 - -# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. -AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) - -# Do all the work for Automake. -*- Autoconf -*- - -# 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. - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 11 - -# 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.58])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 -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -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 - 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 -]) -]) - - -# 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_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $1 | $1:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. - -# Copyright (C) 2001, 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"$am_aux_dir/install-sh"} -AC_SUBST(install_sh)]) - -# -*- Autoconf -*- -# Copyright (C) 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 1 - -# 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])]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 - -# 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 -]) - -# -*- Autoconf -*- - - -# Copyright (C) 1997, 1999, 2000, 2001, 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - -# 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 -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 -]) - -# AM_PROG_MKDIR_P -# --------------- -# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. - -# Copyright (C) 2003, 2004 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories -# created by `make install' are always world readable, even if the -# installer happens to have an overly restrictive umask (e.g. 077). -# This was a mistake. There are at least two reasons why we must not -# use `-m 0755': -# - it causes special bits like SGID to be ignored, -# - it may be too restrictive (some setups expect 775 directories). -# -# Do not use -m 0755 and let people choose whatever they expect by -# setting umask. -# -# We cannot accept any implementation of `mkdir' that recognizes `-p'. -# Some implementations (such as Solaris 8's) are not thread-safe: if a -# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' -# concurrently, both version can detect that a/ is missing, but only -# one can create it and the other will error out. Consequently we -# restrict ourselves to GNU make (using the --version option ensures -# this.) -AC_DEFUN([AM_PROG_MKDIR_P], -[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi -AC_SUBST([mkdir_p])]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 - -# _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. -# - -# Copyright (C) 1996, 1997, 2000, 2001, 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - -# 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)]) - -# AM_PROG_INSTALL_STRIP - -# Copyright (C) 2001, 2003 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# 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="\${SHELL} \$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 1 - - -# _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/moses/config.h.in b/moses/config.h.in deleted file mode 100644 index 10bc1419c..000000000 --- a/moses/config.h.in +++ /dev/null @@ -1,58 +0,0 @@ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef HAVE_INTTYPES_H - -/* flag for IRSTLM */ -#undef HAVE_IRSTLM - -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* flag for SRILM */ -#undef HAVE_SRILM - -/* Define to 1 if you have the <stdint.h> header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION diff --git a/moses/configure.in b/moses/configure.in deleted file mode 100644 index f1af3eae7..000000000 --- a/moses/configure.in +++ /dev/null @@ -1,94 +0,0 @@ -AC_INIT(src) - -AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(moses, 0.1) - -AC_PROG_CXX -AC_LANG_CPLUSPLUS -AC_PROG_RANLIB -#AM_PROG_LIBTOOL - -AC_ARG_WITH(srilm, - [AC_HELP_STRING([--with-srilm=PATH], [(optional) path to SRI's LM toolkit])], - [with_srilm=$withval], - [with_srilm=no] - ) - -AC_ARG_WITH(irstlm, - [AC_HELP_STRING([--with-irstlm=PATH], [(optional) path to IRST's LM toolkit])], - [with_irstlm=$withval], - [with_irstlm=no] - ) - -AC_ARG_WITH(boost, - [AC_HELP_STRING([--with-srilm=PATH], [path to BOOST libraries])], - [with_boost=$withval], - [with_boost=no] - ) - -AC_ARG_ENABLE(optimization, - [AC_HELP_STRING([--enable-optimization], [compile with -O3 flag])], - [CPPFLAGS="$CPPFLAGS -O3"; LDFLAGS="$LDFLAGS -O3" ] - ) -AC_ARG_ENABLE(profiling, - [AC_HELP_STRING([--enable-profiling], [moses will dump profiling info])], - [CPPFLAGS="$CPPFLAGS -pg"; LDFLAGS="$LDFLAGS -pg" ] - ) - -if test "x$with_boost" != 'xno' -then - CPPFLAGS="$CPPFLAGS -I${with_boost} -I${with_boost}/include" - LDFLAGS="$LDFLAGS -L${with_boost}/lib" -fi - -AC_CHECK_HEADER([boost/algorithm/string.hpp], [], [AC_MSG_ERROR([Cannot find boost. Use --with-boost=PATH])]) -AC_CHECK_HEADER([boost/iostreams/filtering_stream.hpp], [], [AC_MSG_ERROR([Cannot find boost. Use --with-boost=PATH])]) - -if test "x$with_srilm" != 'xno' -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I${with_srilm}/include" - - AC_CHECK_HEADER(Ngram.h, - [AC_DEFINE([HAVE_SRILM], [], [flag for SRILM])], - [AC_MSG_ERROR([Cannot find SRILM!])]) - - LIB_SRILM="-loolm -ldstruct -lmisc" - # ROOT/lib/i686-m64/liboolm.a - # ROOT/lib/i686-m64/libdstruct.a - # ROOT/lib/i686-m64/libmisc.a - MY_ARCH=`${with_srilm}/sbin/machine-type` - LDFLAGS="$LDFLAGS -L${with_srilm}/lib/${MY_ARCH}" - LIBS="$LIBS $LIB_SRILM" - FMTLIBS="$FMTLIBS liboolm.a libdstruct.a libmisc.a" - AM_CONDITIONAL([SRI_LM], true) - AM_CONDITIONAL([INTERNAL_LM], false) - AM_CONDITIONAL([IRST_LM], false) -else if test "x$with_irstlm" != 'xno' -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I${with_irstlm}/include" - - AC_CHECK_HEADER(ngram.h, - [AC_DEFINE([HAVE_IRSTLM], [], [flag for IRSTLM])], - [AC_MSG_ERROR([Cannot find IRST-LM!])]) - - LIB_SRILM="-lirstlm" - LDFLAGS="$LDFLAGS -L${with_irstlm}/lib" - LIBS="$LIBS $LIB_SRILM" - FMTLIBS="$FMTLIBS libirstlm.a" - AM_CONDITIONAL([SRI_LM], false) - AM_CONDITIONAL([INTERNAL_LM], false) - AM_CONDITIONAL([IRST_LM], true) -else - echo "Using internal language model (use --with-srilm or --with-irstlm to change)!" - AM_CONDITIONAL([SRI_LM], false) - AM_CONDITIONAL([INTERNAL_LM], true) - AM_CONDITIONAL([IRST_LM], false) -fi -fi -LIBS="$LIBS -lboost_iostreams -lboost_filesystem -lboost_thread" -FMT_LIBS="$FMT_LIBS libboost_iostreams.a libboost_filesystem.a libboost_thread.a" - - -AC_OUTPUT(Makefile src/Makefile) diff --git a/moses/depcomp b/moses/depcomp deleted file mode 100755 index 4c20c6c94..000000000 --- a/moses/depcomp +++ /dev/null @@ -1,441 +0,0 @@ -#! /bin/sh - -# depcomp - compile a program generating dependencies as side-effects -# Copyright 1999, 2000 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, 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>. - -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 -# `libtool' can also be set to `yes' or `no'. - -depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`} -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. 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. - stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - outname="$stripped.o" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - # 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) - # Must come before tru64. - - # Intel's C compiler understands `-MD -MF file'. However - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # 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: - - "$@" -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'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^[^:]*: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - rm -f "$tmpdepfile" - ;; - -tru64) - # The Tru64 AIX 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. - - tmpdepfile1="$object.d" - tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` - if test "$libtool" = yes; then - "$@" -Wc,-MD - else - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - if test -f "$tmpdepfile1"; then - tmpdepfile="$tmpdepfile1" - else - tmpdepfile="$tmpdepfile2" - fi - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a space and a tab 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 proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - test -z "$dashmflag" && dashmflag=-M - ( IFS=" " - case " $* " in - *" --mode=compile "*) # this is libtool, let us make it quiet - for arg - do # cycle over the arguments - case "$arg" in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; - esac - "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi - 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) - # 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;; - -*) - ;; - *) - set fnord "$@" "$arg"; shift;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tail +3 "$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 proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - ( IFS=" " - case " $* " in - *" --mode=compile "*) - for arg - do # cycle over the arguments - case $arg in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; - esac - "$@" -E | - sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi - 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 proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - ( IFS=" " - case " $* " in - *" --mode=compile "*) - for arg - do # cycle over the arguments - case $arg in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; - esac - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi - 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 diff --git a/moses/install-sh b/moses/install-sh deleted file mode 100755 index 36f96f3e0..000000000 --- a/moses/install-sh +++ /dev/null @@ -1,276 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# 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. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd=$cpprog - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "$0: no input file specified" >&2 - exit 1 -else - : -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d "$dst" ]; then - instcmd=: - chmodcmd="" - else - instcmd=$mkdirprog - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f "$src" ] || [ -d "$src" ] - then - : - else - echo "$0: $src does not exist" >&2 - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "$0: no destination specified" >&2 - exit 1 - else - : - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d "$dst" ] - then - dst=$dst/`basename "$src"` - else - : - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' - ' -IFS="${IFS-$defaultIFS}" - -oIFS=$IFS -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS=$oIFS - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp=$pathcomp$1 - shift - - if [ ! -d "$pathcomp" ] ; - then - $mkdirprog "$pathcomp" - else - : - fi - - pathcomp=$pathcomp/ -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd "$dst" && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename "$dst"` - else - dstfile=`basename "$dst" $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename "$dst"` - else - : - fi - -# Make a couple of temp file names in the proper directory. - - dsttmp=$dstdir/#inst.$$# - rmtmp=$dstdir/#rm.$$# - -# Trap to clean up temp files at exit. - - trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 - trap '(exit $?); exit' 1 2 13 15 - -# Move or copy the file name to the temp name - - $doit $instcmd "$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 $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && - -# 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. - -{ - if [ -f "$dstdir/$dstfile" ] - then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || - $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || - { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit - } - else - : - fi -} && - -# Now rename the file to the real destination. - - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - -fi && - -# The final little trick to "correctly" pass the exit status to the exit trap. - -{ - (exit 0); exit -} diff --git a/moses/ltmain.sh b/moses/ltmain.sh deleted file mode 100644 index b36e997fe..000000000 --- a/moses/ltmain.sh +++ /dev/null @@ -1,6343 +0,0 @@ -# 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 -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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. - -# 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 "$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 name of this program. -progname=`$echo "$0" | ${SED} 's%^.*/%%'` -modename="$progname" - -# Constants. -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION=1.5a -TIMESTAMP=" (1.1240 2003/06/26 06:55:19)" - -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 A|tr A '\301'` in - A) # EBCDIC based system - SP2NL="tr '\100' '\n'" - NL2SP="tr '\r\n' '\100\100'" - ;; - *) # Assume ASCII based system - SP2NL="tr '\040' '\012'" - NL2SP="tr '\015\012' '\040\040'" - ;; -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. -if test "${LC_ALL+set}" = set; then - save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL -fi -if test "${LANG+set}" = set; then - save_LANG="$LANG"; LANG=C; export LANG -fi - -# Make sure IFS has a sensible default -: ${IFS=" "} - -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 1 -fi - -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" - -##################################### -# Shell function definitions: -# This seems to be the best place for them - -# 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. -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 | \ - grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | \ - sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` - if test "X$win32_nmres" = "Ximport" ; then - win32_libid_type="x86 archive import" - else - win32_libid_type="x86 archive static" - fi - 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 -} - -# End of Shell function definitions -##################################### - -# 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" - - # Check whether tagname contains only valid characters - case $tagname in - *[!-_A-Za-z0-9,/]*) - $echo "$progname: invalid tag name: $tagname" 1>&2 - exit 1 - ;; - 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$" < "$0" > /dev/null; then - taglist="$taglist $tagname" - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" - 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" - $echo - $echo "Copyright (C) 2003 Free Software Foundation, Inc." - $echo "This is free software; see the source for copying conditions. There is NO" - $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit 0 - ;; - - --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 - # 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" < "$0" - done - exit 0 - ;; - - --debug) - $echo "$progname: enabling shell trace mode" - set -x - ;; - - --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 0 - ;; - - --finish) mode="finish" ;; - - --mode) prevopt="--mode" prev=mode ;; - --mode=*) mode="$optarg" ;; - - --preserve-dup-deps) duplicate_deps="yes" ;; - - --quiet | --silent) - show=: - ;; - - --tag) prevopt="--tag" prev=tag ;; - --tag=*) - set tag "$optarg" ${1+"$@"} - shift - prev=tag - ;; - - -dlopen) - prevopt="-dlopen" - prev=execute_dlfiles - ;; - - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - - *) - nonopt="$arg" - break - ;; - esac -done - -if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 -fi - -# 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 1 - 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_output= - arg_mode=normal - libobj= - - 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 1 - fi - arg_mode=target - continue - ;; - - -static) - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=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, so we specify it 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 1 - ;; - target) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit 1 - ;; - *) - # 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 ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - *.java) xform=java ;; - 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 1 - ;; - esac - - # 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. - if test -n "$available_tags" && test -z "$tagname"; then - case $base_compile 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` "*) ;; - # 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$" < "$0" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" - case "$base_compile " in - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) - # 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 1 -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi - - 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 1 - 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 1" 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 1" 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 "$0" "$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 1 - fi - $echo $srcfile > "$lockfile" - fi - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi - - $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 $srcfile $pic_flag" - else - # Don't build PIC code - command="$base_compile $srcfile" - fi - - if test ! -d "${xdir}$objdir"; then - $show "$mkdir ${xdir}$objdir" - $run $mkdir ${xdir}$objdir - status=$? - if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then - 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 1 - 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 1 - 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. - suppress_output=' >/dev/null 2>&1' - 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 $srcfile" - else - command="$base_compile $srcfile $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 1 - 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 1 - 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 0 - ;; - - # 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= - add_flags= - 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= - prefer_static_libs=no - preload=no - prev= - prevarg= - release= - rpath= - xrpath= - perm_rpath= - temp_rpath= - thread_safe=no - vinfo= - vinfo_number=no - - # We need to know -static, to get the right output filenames. - for arg - do - case $arg in - -all-static | -static) - if test "X$arg" = "X-all-static"; then - 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 - else - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - fi - build_libtool_libs=no - build_old_libs=yes - prefer_static_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" - base_compile="$base_compile $arg" - 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 1 - fi - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$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 1 - 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 - 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 1 - 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 1 - 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 1 - ;; - 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 - ;; - *) - 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 1 - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - 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 - exit 1 - 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*) - case :$dllsearchpath: in - *":$dir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-pw32* | *-*-beos*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-freebsd*-gnu*) - # prevent being parsed by the freebsd regexp below - ;; - *-*-mingw* | *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd*) - # 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 - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-freebsd*-gnu*) - # prevent being parsed by the freebsd regexp below - ;; - *-*-openbsd*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - deplibs="$deplibs $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # gcc -m* arguments should be passed to the linker via $compiler_flags - # in order to pass architecture information to the linker - # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo - # but this is not reliable with gcc because gcc may use -mfoo to - # select a different linker, different libraries, etc, while - # -Wl,-mfoo simply passes -mfoo to the linker. - -m*) - # 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" - if test "$with_gcc" = "yes" ; then - compiler_flags="$compiler_flags $arg" - fi - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - # The PATH hackery in wrapper scripts is required on Windows - # 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 ;; - - -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 1 - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -static) - # 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 - add_flags="$add_flags $arg" - ;; - - *.$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 1 - 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 - 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 1 - 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 - add_flags="$add_flags $arg" - ;; - 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 1 - fi - - # 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 link - # command doesn't match the default compiler. - if test -n "$available_tags" && test -z "$tagname"; then - case $base_compile 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` "*) ;; - # 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$" < "$0" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" - case $base_compile in - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) - # The compiler in $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 1 -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - 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 - status=$? - if test "$status" -ne 0 && test ! -d "$output_objdir"; then - 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 1 - ;; - *.$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 duplcations 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 - notinst_path= # paths that contain 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 1 - ;; - 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 - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 - continue - fi - if test "$pass" = conv && test "$allow_undefined" = yes; then - deplibs="$deplib $deplibs" - 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 $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" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - ;; - *) - $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) - if test "$deplibs_check_method" != pass_all; 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'" 1>&2 - exit 1 - 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 1 - 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 - - # 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" - tmp_libs= - for deplib in $dependency_libs; do - #echo "Adding $deplib to \$deplibs" - 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 - if test -z "$libdir"; then - if test -z "$old_library"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 - 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" - elif test "$linkmode" != prog && test "$linkmode" != lib; then - $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit 1 - 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 1 - 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 1 - 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 - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - 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 1 - 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 -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - 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 - if test -n "$library_names" && - { test "$prefer_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='~' - eval cmds=\"$extract_expsyms_cmds\" - for cmd in $cmds; do - IFS="$save_ifs" - $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='~' - eval cmds=\"$old_archive_from_expsyms_cmds\" - for cmd in $cmds; do - IFS="$save_ifs" - $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* ) 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 | grep "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="-L$inst_prefix_dir$libdir $add_dir" - ;; - 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 1 - 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="-L$inst_prefix_dir$libdir $add_dir" - ;; - 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 - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" - 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 1 - fi - if test "$absdir" != "$libdir"; then - # Sure, some shells/systems don't implement the -ef. - # Those will have to live with the warning. - test "$absdir" -ef "$libdir" > /dev/null 2>&1 || - $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 - path="" - fi - ;; - *) - 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 - *" $depdepl "*) ;; - *) deplibs="$deplibs $depdepl" ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$deplibs $path" ;; - 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\" - 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 1 - 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\" - 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 1 - 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 1 - 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) - 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 - 1` - age="$number_minor" - revision="$number_minor" - ;; - 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]) ;; - *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case $revision in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; - *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case $age in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; - *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - 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 1 - 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` - 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) - major=`expr $current - $age + 1` - - 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 1 - ;; - 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}.*) - 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 true || 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. - ;; - *-*-freebsd*-gnu*) - # Prevent $arg from being parsed by the freebsd regexp below. - if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" - fi - ;; - *-*-openbsd* | *-*-freebsd*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *) - # 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 - $LTCC -o conftest conftest.c $deplibs - if test "$?" -eq 0 ; 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" -ne "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 - $LTCC -o conftest conftest.c $i - # Did it work? - if test "$?" -eq 0 ; 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 - - # 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 && test "$fast_install" = no && 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 - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - 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\" - 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" - 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 - eval cmds=\"$export_symbols_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - 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=: - 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" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - 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 - - # Add all flags from the command line. We here create a library, - # but those flags were only added to compile_command and - # finalize_command, which are only used when creating executables. - # So do it by hand here. - compiler_flags="$compiler_flags $add_flags" - # Only add it to commands which use CC, instead of LD, i.e. - # only to $compiler_flags - #linker_flags="$linker_flags $add_flags" - - # 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 cmds=\"$module_expsym_cmds\" - else - eval cmds=\"$module_cmds\" - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" - else - eval cmds=\"$archive_cmds\" - fi - fi - - if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` && - 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 - - # 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/$save_output-${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" : ".*"` && - 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/$save_output-${k}.$objext - k=`expr $k + 1` - output=$output_objdir/$save_output-${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 reloadale object files - # after they are used. - i=0 - while test "$i" -lt "$k" - do - i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$save_output-${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 -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" - else - eval cmds=\"$archive_cmds\" - 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" - $show "$cmd" - $run eval "$cmd" || 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 $? - exit 0 - 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 1 - 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 - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${obj}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - 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" - eval cmds=\"$reload_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $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 0 - 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 0 - 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" - eval cmds=\"$reload_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $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 0 - ;; - - 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 - - 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*) - case :$dllsearchpath: in - *":$libdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$libdir";; - 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/$output.exp" - $run $rm $export_symbols - $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - else - $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' - $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' - $run eval 'mv "$nlist"T "$nlist"' - 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. */ -const struct { - 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 -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $LTCC -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. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - ;; - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit 1 - ;; - 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" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - # AIX runtime linking requires linking programs with -Wl,-brtl and libs with -Wl,-G - # Also add -bnolibpath to the beginning of the link line, to clear the hardcoded runpath. - # Otherwise, things like the -L path to libgcc.a are accidentally hardcoded by ld. - # This does not apply on AIX for ia64, which uses a SysV linker. - case "$host" in - ia64-*-aix5*) ;; - *-*-aix4* | *-*-aix5*) - compile_command=`$echo "X$compile_command $wl-brtl" | $Xsed -e "s/\$CC/\$CC $wl-bnolibpath/1"` - finalize_command=`$echo "X$finalize_command $wl-brtl" | $Xsed -e "s/\$CC/\$CC $wl-bnolibpath/1"` ;; - esac - - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - $show "$link_command" - $run eval "$link_command" - 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 $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 0 - 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" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` - 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" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $0 --fallback-echo"; then - case $0 in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; - *) qecho="$SHELL `pwd`/$0 --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* ) - cwrappersource=`$echo ${objdir}/lt-${output}.c` - cwrapper=`$echo ${output}.exe` - $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit 1" 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> - -#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 '/' -#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 -#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 */ - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -const char *program_name = NULL; - -void * xmalloc (size_t num); -char * xstrdup (const char *string); -char * basename (const char *name); -char * fnqualify(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 ((char *) basename (argv[0])); - newargz = XMALLOC(char *, argc+2); -EOF - - cat >> $cwrappersource <<EOF - newargz[0] = "$SHELL"; -EOF - - cat >> $cwrappersource <<"EOF" - newargz[1] = fnqualify(argv[0]); - /* 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; -EOF - - cat >> $cwrappersource <<EOF - execv("$SHELL",newargz); -EOF - - cat >> $cwrappersource <<"EOF" -} - -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 -; -} - -char * -basename (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha (name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return (char *) base; -} - -char * -fnqualify(const char *path) -{ - size_t size; - char *p; - char tmp[LT_PATHMAX + 1]; - - assert(path != NULL); - - /* Is it qualified already? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha (path[0]) && path[1] == ':') - return xstrdup (path); -#endif - if (IS_DIR_SEPARATOR (path[0])) - return xstrdup (path); - - /* prepend the current directory */ - /* doesn't handle '~' */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ - p = XMALLOC(char, size); - sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); - return p; -} - -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 -s -o $cwrapper $cwrappersource - ;; - esac - $rm $output - trap "$rm $output; exit 1" 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' - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi - -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 1 - 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 \${1+\"\$@\"}\" - exit 1 - 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 1 - fi -fi\ -" - chmod +x $output - fi - exit 0 - ;; - 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" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - # Add in members from convenience archives. - for xlib in $addlibs; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` - done - fi - - compiler_flags="$compiler_flags $add_flags" - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - eval cmds=\"$old_archive_from_new_cmds\" - else - eval cmds=\"$old_archive_cmds\" - - if len=`expr "X$cmds" : ".*"` && - 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 in parts - $echo "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi - # 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" : ".*"` && - 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 - 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 $0 --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - 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 1 - 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 1 - 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 1 - fi - newdlprefiles="$newdlprefiles $libdir/$name" - 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 && test "$fast_install" = no; 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 0 - ;; - - # 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" | $Xsed | 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) prev="-f" ;; - -g) prev="-g" ;; - -m) prev="-m" ;; - -o) prev="-o" ;; - -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 1 - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - 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 1 - 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 1 - 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 1 - ;; - 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 1 - 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 1 - fi - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - 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 1 - 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. - for linkname - do - if test "$linkname" != "$realname"; then - $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - fi - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - eval cmds=\"$postinstall_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || 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 1 - ;; - 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 0 - ;; - - *) - # 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= - - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac - # If there is no directory component, then add one. - case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; - 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 1 - 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= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac - # If there is no directory component, then add one. - case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; - esac - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - if test "$finalize" = yes && test -z "$run"; then - tmpdir="/tmp" - test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" - if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : - else - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue - fi - file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - - $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 anyways - 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 "$striplib"; then - $show "$old_striplib $oldlib" - $run eval "$old_striplib $oldlib" || exit $? - fi - - # Do each command in the postinstall commands. - eval cmds=\"$old_postinstall_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $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 $0 --finish$current_libdirs' - else - exit 0 - 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. - eval cmds=\"$finish_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $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. - exit 0 - - $echo "----------------------------------------------------------------------" - $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 "----------------------------------------------------------------------" - exit 0 - ;; - - # 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 1 - 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 1 - 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 1 - 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 - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit 1 - 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 - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi - if test "${save_LANG+set}" = set; then - LANG="$save_LANG"; export LANG - fi - - # 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 0 - 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 1 - 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" - test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - - if test "$mode" = uninstall; then - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - eval cmds=\"$postuninstall_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $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. - eval cmds=\"$old_postuninstall_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $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. - fi - 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 1 - ;; - esac - - if test -z "$exec_cmd"; then - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 - fi -fi # test -z "$show_help" - -if test -n "$exec_cmd"; then - eval exec $exec_cmd - exit 1 -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 0 - ;; - -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 - -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 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 1 - ;; -esac - -$echo -$echo "Try \`$modename --help' for more information about other modes." - -exit 0 - -# 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 -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: diff --git a/moses/missing b/moses/missing deleted file mode 100755 index 6a37006e8..000000000 --- a/moses/missing +++ /dev/null @@ -1,336 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. -# Copyright (C) 1996, 1997, 1999, 2000, 2002 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 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, 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. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: - -# 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 - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - - -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' - 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]" - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing 0.4 - GNU automake" - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - - aclocal*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the - proper tools for further handling them. - You can get \`$1Help2man' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` - 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' is missing on your system. 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 [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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 [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then - # We have makeinfo, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. 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." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` - fi - touch $file - ;; - - tar) - shift - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - fi - - # 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 you do not seem to have it handy on your - system. 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 prerequirements 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 diff --git a/moses/mkinstalldirs b/moses/mkinstalldirs deleted file mode 100755 index d2d5f21b6..000000000 --- a/moses/mkinstalldirs +++ /dev/null @@ -1,111 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman <friedman@prep.ai.mit.edu> -# Created: 1993-05-16 -# Public domain - -errstatus=0 -dirmode="" - -usage="\ -Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." - -# process command line arguments -while test $# -gt 0 ; do - case $1 in - -h | --help | --h*) # -h for help - echo "$usage" 1>&2 - exit 0 - ;; - -m) # -m PERM arg - shift - test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } - dirmode=$1 - shift - ;; - --) # stop option processing - shift - break - ;; - -*) # unknown option - echo "$usage" 1>&2 - exit 1 - ;; - *) # first non-opt arg - break - ;; - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in - 0) exit 0 ;; -esac - -case $dirmode in - '') - if mkdir -p -- . 2>/dev/null; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - fi - ;; - *) - if mkdir -m "$dirmode" -p -- . 2>/dev/null; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - fi - ;; -esac - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case $pathcomp in - -*) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# End: -# mkinstalldirs ends here diff --git a/moses/moses.sln b/moses/moses.sln deleted file mode 100755 index c255e355e..000000000 --- a/moses/moses.sln +++ /dev/null @@ -1,49 +0,0 @@ -
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual C++ Express 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "moses", "moses.vcproj", "{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "moses-cmd", "..\moses-cmd\moses-cmd.vcproj", "{5BBAC701-84F5-438E-8F54-B3391F451F2A}"
- ProjectSection(ProjectDependencies) = postProject
- {8122157A-0DE5-44FF-8E5B-024ED6ACE7AF} = {8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "irstlm", "..\irstlm\irstlm.vcproj", "{19C023D8-67DE-4609-9C89-3152EF95995D}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- DebugNBest|Win32 = DebugNBest|Win32
- Release|Win32 = Release|Win32
- ReleaseNBest|Win32 = ReleaseNBest|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Debug|Win32.ActiveCfg = Debug|Win32
- {8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Debug|Win32.Build.0 = Debug|Win32
- {8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.DebugNBest|Win32.ActiveCfg = DebugNBest|Win32
- {8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.DebugNBest|Win32.Build.0 = DebugNBest|Win32
- {8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Release|Win32.ActiveCfg = Release|Win32
- {8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Release|Win32.Build.0 = Release|Win32
- {8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.ReleaseNBest|Win32.ActiveCfg = ReleaseNBest|Win32
- {8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.ReleaseNBest|Win32.Build.0 = ReleaseNBest|Win32
- {5BBAC701-84F5-438E-8F54-B3391F451F2A}.Debug|Win32.ActiveCfg = Debug|Win32
- {5BBAC701-84F5-438E-8F54-B3391F451F2A}.Debug|Win32.Build.0 = Debug|Win32
- {5BBAC701-84F5-438E-8F54-B3391F451F2A}.DebugNBest|Win32.ActiveCfg = DebugNBest|Win32
- {5BBAC701-84F5-438E-8F54-B3391F451F2A}.DebugNBest|Win32.Build.0 = DebugNBest|Win32
- {5BBAC701-84F5-438E-8F54-B3391F451F2A}.Release|Win32.ActiveCfg = Release|Win32
- {5BBAC701-84F5-438E-8F54-B3391F451F2A}.Release|Win32.Build.0 = Release|Win32
- {5BBAC701-84F5-438E-8F54-B3391F451F2A}.ReleaseNBest|Win32.ActiveCfg = ReleaseNBest|Win32
- {5BBAC701-84F5-438E-8F54-B3391F451F2A}.ReleaseNBest|Win32.Build.0 = ReleaseNBest|Win32
- {19C023D8-67DE-4609-9C89-3152EF95995D}.Debug|Win32.ActiveCfg = Debug|Win32
- {19C023D8-67DE-4609-9C89-3152EF95995D}.Debug|Win32.Build.0 = Debug|Win32
- {19C023D8-67DE-4609-9C89-3152EF95995D}.DebugNBest|Win32.ActiveCfg = Debug|Win32
- {19C023D8-67DE-4609-9C89-3152EF95995D}.DebugNBest|Win32.Build.0 = Debug|Win32
- {19C023D8-67DE-4609-9C89-3152EF95995D}.Release|Win32.ActiveCfg = Release|Win32
- {19C023D8-67DE-4609-9C89-3152EF95995D}.Release|Win32.Build.0 = Release|Win32
- {19C023D8-67DE-4609-9C89-3152EF95995D}.ReleaseNBest|Win32.ActiveCfg = Release|Win32
- {19C023D8-67DE-4609-9C89-3152EF95995D}.ReleaseNBest|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/moses/moses.vcproj b/moses/moses.vcproj deleted file mode 100755 index acb22f43d..000000000 --- a/moses/moses.vcproj +++ /dev/null @@ -1,821 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="moses"
- ProjectGUID="{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}"
- RootNamespace="moses"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""$(SolutionDir)..\mysqlpp\lib";"$(SolutionDir)..\irstlm\src""
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;LM_INTERNAL;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- AdditionalIncludeDirectories=""$(SolutionDir)..\mysqlpp\lib";"$(SolutionDir)..\irstlm\src""
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;LM_INTERNAL;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="DebugNBest|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""$(SolutionDir)..\mysqlpp\lib";"$(SolutionDir)..\irstlm\src""
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;LM_INTERNAL;TRACE_ENABLE;N_BEST;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ReleaseNBest|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- AdditionalIncludeDirectories=""$(SolutionDir)..\mysqlpp\lib";"$(SolutionDir)..\irstlm\src""
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;LM_INTERNAL;N_BEST;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\src\ConfusionNet.cpp"
- >
- </File>
- <File
- RelativePath=".\src\Dictionary.cpp"
- >
- </File>
- <File
- RelativePath=".\src\DistortionOrientation.cpp"
- >
- </File>
- <File
- RelativePath=".\src\DummyScoreProducers.cpp"
- >
- </File>
- <File
- RelativePath=".\src\Factor.cpp"
- >
- </File>
- <File
- RelativePath=".\src\FactorCollection.cpp"
- >
- </File>
- <File
- RelativePath=".\src\FactorTypeSet.cpp"
- >
- </File>
- <File
- RelativePath=".\src\GenerationDictionary.cpp"
- >
- </File>
- <File
- RelativePath=".\src\hash.cpp"
- >
- </File>
- <File
- RelativePath=".\src\Hypothesis.cpp"
- >
- </File>
- <File
- RelativePath=".\src\HypothesisCollection.cpp"
- >
- </File>
- <File
- RelativePath=".\src\Input.cpp"
- >
- </File>
- <File
- RelativePath=".\src\InputFileStream.cpp"
- >
- </File>
- <File
- RelativePath=".\src\InputOutput.cpp"
- >
- </File>
- <File
- RelativePath=".\src\LanguageModel.cpp"
- >
- </File>
- <File
- RelativePath=".\src\LanguageModel_Internal.cpp"
- >
- </File>
- <File
- RelativePath=".\src\LanguageModel_IRST.cpp"
- >
- </File>
- <File
- RelativePath=".\src\LanguageModelFactory.cpp"
- >
- </File>
- <File
- RelativePath=".\src\LatticePath.cpp"
- >
- </File>
- <File
- RelativePath=".\src\LexicalReordering.cpp"
- >
- </File>
- <File
- RelativePath=".\src\LMList.cpp"
- >
- </File>
- <File
- RelativePath=".\src\Manager.cpp"
- >
- </File>
- <File
- RelativePath=".\src\md5.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)\$(InputName)1.obj"
- XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)\$(InputName)1.obj"
- XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="DebugNBest|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)\$(InputName)1.obj"
- XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ReleaseNBest|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)\$(InputName)1.obj"
- XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\src\mempool.cpp"
- >
- </File>
- <File
- RelativePath=".\src\NGramCollection.cpp"
- >
- </File>
- <File
- RelativePath=".\src\Parameter.cpp"
- >
- </File>
- <File
- RelativePath=".\src\Phrase.cpp"
- >
- </File>
- <File
- RelativePath=".\src\PhraseDictionary.cpp"
- >
- </File>
- <File
- RelativePath=".\src\PhraseDictionaryBase.cpp"
- >
- </File>
- <File
- RelativePath=".\src\PhraseDictionaryNode.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)\$(InputName)1.obj"
- XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)\$(InputName)1.obj"
- XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="DebugNBest|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)\$(InputName)1.obj"
- XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ReleaseNBest|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)\$(InputName)1.obj"
- XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\src\PhraseDictionaryTree.cpp"
- >
- </File>
- <File
- RelativePath=".\src\PhraseDictionaryTreeAdaptor.cpp"
- >
- </File>
- <File
- RelativePath=".\src\ScoreComponentCollection.cpp"
- >
- </File>
- <File
- RelativePath=".\src\ScoreIndexManager.cpp"
- >
- </File>
- <File
- RelativePath=".\src\ScoreProducer.cpp"
- >
- </File>
- <File
- RelativePath=".\src\Sentence.cpp"
- >
- </File>
- <File
- RelativePath=".\src\SquareMatrix.cpp"
- >
- </File>
- <File
- RelativePath=".\src\StaticData.cpp"
- >
- </File>
- <File
- RelativePath=".\src\TargetPhrase.cpp"
- >
- </File>
- <File
- RelativePath=".\src\TranslationOption.cpp"
- >
- </File>
- <File
- RelativePath=".\src\TranslationOptionCollection.cpp"
- >
- </File>
- <File
- RelativePath=".\src\TranslationOptionCollectionConfusionNet.cpp"
- >
- </File>
- <File
- RelativePath=".\src\TranslationOptionCollectionText.cpp"
- >
- </File>
- <File
- RelativePath=".\src\UserMessage.cpp"
- >
- </File>
- <File
- RelativePath=".\src\Util.cpp"
- >
- </File>
- <File
- RelativePath=".\src\WeightOptimization.cpp"
- >
- </File>
- <File
- RelativePath=".\src\Word.cpp"
- >
- </File>
- <File
- RelativePath=".\src\WordsBitmap.cpp"
- >
- </File>
- <File
- RelativePath=".\src\WordsRange.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\src\ConfusionNet.h"
- >
- </File>
- <File
- RelativePath=".\src\DecodeStep.h"
- >
- </File>
- <File
- RelativePath=".\src\Dictionary.h"
- >
- </File>
- <File
- RelativePath=".\src\DistortionOrientation.h"
- >
- </File>
- <File
- RelativePath=".\src\DummyScoreProducers.h"
- >
- </File>
- <File
- RelativePath=".\src\Factor.h"
- >
- </File>
- <File
- RelativePath=".\src\FactorCollection.h"
- >
- </File>
- <File
- RelativePath=".\src\FactorTypeSet.h"
- >
- </File>
- <File
- RelativePath=".\src\File.h"
- >
- </File>
- <File
- RelativePath=".\src\FilePtr.h"
- >
- </File>
- <File
- RelativePath=".\src\GenerationDictionary.h"
- >
- </File>
- <File
- RelativePath=".\src\hash.h"
- >
- </File>
- <File
- RelativePath=".\src\Hypothesis.h"
- >
- </File>
- <File
- RelativePath=".\src\HypothesisCollection.h"
- >
- </File>
- <File
- RelativePath=".\src\Input.h"
- >
- </File>
- <File
- RelativePath=".\src\InputFileStream.h"
- >
- </File>
- <File
- RelativePath=".\src\InputOutput.h"
- >
- </File>
- <File
- RelativePath=".\src\LanguageModel.h"
- >
- </File>
- <File
- RelativePath=".\src\LanguageModel_Internal.h"
- >
- </File>
- <File
- RelativePath=".\src\LanguageModel_IRST.h"
- >
- </File>
- <File
- RelativePath=".\src\LanguageModel_SRI.h"
- >
- </File>
- <File
- RelativePath=".\src\LanguageModelFactory.h"
- >
- </File>
- <File
- RelativePath=".\src\LatticePath.h"
- >
- </File>
- <File
- RelativePath=".\src\LatticePathCollection.h"
- >
- </File>
- <File
- RelativePath=".\src\LatticePathList.h"
- >
- </File>
- <File
- RelativePath=".\src\LexicalReordering.h"
- >
- </File>
- <File
- RelativePath=".\src\LMList.h"
- >
- </File>
- <File
- RelativePath=".\src\Manager.h"
- >
- </File>
- <File
- RelativePath=".\src\md5.h"
- >
- </File>
- <File
- RelativePath=".\src\mempool.h"
- >
- </File>
- <File
- RelativePath=".\src\NGramCollection.h"
- >
- </File>
- <File
- RelativePath=".\src\NGramNode.h"
- >
- </File>
- <File
- RelativePath=".\src\ObjectPool.h"
- >
- </File>
- <File
- RelativePath=".\src\Parameter.h"
- >
- </File>
- <File
- RelativePath=".\src\PartialTranslOptColl.h"
- >
- </File>
- <File
- RelativePath=".\src\Phrase.h"
- >
- </File>
- <File
- RelativePath=".\src\PhraseDictionary.h"
- >
- </File>
- <File
- RelativePath=".\src\PhraseDictionaryBase.h"
- >
- </File>
- <File
- RelativePath=".\src\PhraseDictionaryNode.h"
- >
- </File>
- <File
- RelativePath=".\src\PhraseDictionaryTree.h"
- >
- </File>
- <File
- RelativePath=".\src\PhraseDictionaryTreeAdaptor.h"
- >
- </File>
- <File
- RelativePath=".\src\PrefixTree.h"
- >
- </File>
- <File
- RelativePath=".\src\ScoreComponentCollection.h"
- >
- </File>
- <File
- RelativePath=".\src\ScoreIndexManager.h"
- >
- </File>
- <File
- RelativePath=".\src\ScoreProducer.h"
- >
- </File>
- <File
- RelativePath=".\src\Sentence.h"
- >
- </File>
- <File
- RelativePath=".\src\SentenceStats.h"
- >
- </File>
- <File
- RelativePath=".\src\SquareMatrix.h"
- >
- </File>
- <File
- RelativePath=".\src\StaticData.h"
- >
- </File>
- <File
- RelativePath=".\src\TargetPhrase.h"
- >
- </File>
- <File
- RelativePath=".\src\TargetPhraseCollection.h"
- >
- </File>
- <File
- RelativePath=".\src\Timer.h"
- >
- </File>
- <File
- RelativePath=".\src\TranslationOption.h"
- >
- </File>
- <File
- RelativePath=".\src\TranslationOptionCollection.h"
- >
- </File>
- <File
- RelativePath=".\src\TranslationOptionCollectionConfusionNet.h"
- >
- </File>
- <File
- RelativePath=".\src\TranslationOptionCollectionText.h"
- >
- </File>
- <File
- RelativePath=".\src\TypeDef.h"
- >
- </File>
- <File
- RelativePath=".\src\UserMessage.h"
- >
- </File>
- <File
- RelativePath=".\src\Util.h"
- >
- </File>
- <File
- RelativePath=".\src\WeightOptimization.h"
- >
- </File>
- <File
- RelativePath=".\src\Word.h"
- >
- </File>
- <File
- RelativePath=".\src\WordInsertionTable.h"
- >
- </File>
- <File
- RelativePath=".\src\WordsBitmap.h"
- >
- </File>
- <File
- RelativePath=".\src\WordsRange.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/moses/regenerate-makefiles.sh b/moses/regenerate-makefiles.sh deleted file mode 100755 index 6c78e2b3b..000000000 --- a/moses/regenerate-makefiles.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -echo "Calling autoconf..." -autoconf -echo "Calling automake..." -automake - -echo -echo "You should now be able to configure and build:" -echo " ./configure --with-boost=/home/ws06/cdyer/boost-stage --with-srilm=/home/ws06/cdyer/srilm" -echo " make -j 4" -echo diff --git a/moses/src/ConfusionNet.cpp b/moses/src/ConfusionNet.cpp deleted file mode 100644 index 7cd14367a..000000000 --- a/moses/src/ConfusionNet.cpp +++ /dev/null @@ -1,209 +0,0 @@ -// $Id$ - -#include "ConfusionNet.h" -#include <sstream> - -#include "FactorCollection.h" -#include "Util.h" -#include "PhraseDictionaryTreeAdaptor.h" -#include "TranslationOptionCollectionConfusionNet.h" -#include "StaticData.h" - -struct CNStats { - unsigned created,destr,read,colls,words; - - CNStats() : created(0),destr(0),read(0),colls(0),words(0) {} - ~CNStats() {print(std::cerr);} - - void createOne() {++created;} - void destroyOne() {++destr;} - - void collect(const ConfusionNet& cn) - { - ++read; - colls+=cn.GetSize(); - for(size_t i=0;i<cn.GetSize();++i) - words+=cn[i].size(); - } - void print(std::ostream& out) const - { - if(created>0) - { - out<<"confusion net statistics:\n" - " created:\t"<<created<<"\n" - " destroyed:\t"<<destr<<"\n" - " succ. read:\t"<<read<<"\n" - " columns:\t"<<colls<<"\n" - " words:\t"<<words<<"\n" - " avg. word/column:\t"<<words/(1.0*colls)<<"\n" - " avg. cols/sent:\t"<<colls/(1.0*read)<<"\n" - "\n\n"; - } - } - -}; - -CNStats stats; - - -ConfusionNet::ConfusionNet(FactorCollection* p) - : InputType(),m_factorCollection(p) {stats.createOne();} -ConfusionNet::~ConfusionNet() {stats.destroyOne();} - -void ConfusionNet::SetFactorCollection(FactorCollection *p) -{ - m_factorCollection=p; -} -bool ConfusionNet::ReadF(std::istream& in, - const std::vector<FactorType>& factorOrder, - int format) -{ - TRACE_ERR("read confusion net with format "<<format<<"\n"); - switch(format) - { - case 0: return ReadFormat0(in,factorOrder); - case 1: return ReadFormat1(in,factorOrder); - default: - std::cerr<<"ERROR: unknown format '"<<format - <<"' in ConfusionNet::Read\n"; - } - return 0; -} - -int ConfusionNet::Read(std::istream& in, - const std::vector<FactorType>& factorOrder, - FactorCollection &factorCollection) -{ - SetFactorCollection(&factorCollection); - int rv=ReadF(in,factorOrder,0); - if(rv) stats.collect(*this); - return rv; -} - - -void ConfusionNet::String2Word(const std::string& s,Word& w, - const std::vector<FactorType>& factorOrder) -{ - std::vector<std::string> factorStrVector = Tokenize(s, "|"); - for(size_t i=0;i<factorOrder.size();++i) - w.SetFactor(factorOrder[i], - m_factorCollection->AddFactor(Input,factorOrder[i], - factorStrVector[i])); -} - -bool ConfusionNet::ReadFormat0(std::istream& in, - const std::vector<FactorType>& factorOrder) -{ - assert(m_factorCollection); - Clear(); - std::string line; - while(getline(in,line)) { - std::istringstream is(line); - std::string word;double prob; - Column col; - while(is>>word>>prob) { - Word w; - String2Word(word,w,factorOrder); - if(prob<0.0) - { - std::cerr<<"WARN: negative prob: "<<prob<<" ->set to 0.0\n"; - prob=0.0; - } - else if (prob>1.0) - { - std::cerr<<"WARN: prob > 1.0 : "<<prob<<" -> set to 1.0\n"; - prob=1.0; - } - col.push_back(std::make_pair(w,std::max(static_cast<float>(log(prob)), - LOWEST_SCORE))); - } - if(col.size()) { - data.push_back(col); - ShrinkToFit(data.back()); - } - else break; - } - return !data.empty(); -} -bool ConfusionNet::ReadFormat1(std::istream& in, - const std::vector<FactorType>& factorOrder) -{ - assert(m_factorCollection); - Clear(); - std::string line; - if(!getline(in,line)) return 0; - size_t s; - if(getline(in,line)) s=atoi(line.c_str()); else return 0; - data.resize(s); - for(size_t i=0;i<data.size();++i) { - if(!getline(in,line)) return 0; - std::istringstream is(line); - if(!(is>>s)) return 0; - std::string word;double prob; - data[i].resize(s); - for(size_t j=0;j<s;++j) - if(is>>word>>prob) { - data[i][j].second=log(prob); - if(data[i][j].second<0) { - std::cerr<<"WARN: neg costs: "<<data[i][j].second<<" -> set to 0\n"; - data[i][j].second=0.0;} - String2Word(word,data[i][j].first,factorOrder); - } else return 0; - } - return !data.empty(); -} - -void ConfusionNet::Print(std::ostream& out) const { - out<<"conf net: "<<data.size()<<"\n"; - for(size_t i=0;i<data.size();++i) { - out<<i<<" -- "; - for(size_t j=0;j<data[i].size();++j) - out<<"("<<data[i][j].first.ToString()<<", "<<data[i][j].second<<") "; - out<<"\n"; - } - out<<"\n\n"; -} - -Phrase ConfusionNet::GetSubString(const WordsRange&) const { - std::cerr<<"ERROR: call to ConfusionNet::GetSubString\n"; - abort(); - return Phrase(); -} - -std::string ConfusionNet::GetStringRep(const WordsRange&) const{ //not well defined yet - std::cerr<<"ERROR: call to ConfusionNet::GeStringRep\n"; - abort(); - return ""; -} -#pragma warning(disable:4716) -const FactorArray& ConfusionNet::GetFactorArray(size_t) const { - std::cerr<<"ERROR: call to ConfusionNet::GetFactorArray\n"; - abort(); -} -#pragma warning(default:4716) - -std::ostream& operator<<(std::ostream& out,const ConfusionNet& cn) -{ - cn.Print(out);return out; -} - -TargetPhraseCollection const* ConfusionNet:: -CreateTargetPhraseCollection(PhraseDictionaryBase const& d, - const WordsRange& r) const -{ - if(PhraseDictionaryTreeAdaptor const* pdict= - dynamic_cast<PhraseDictionaryTreeAdaptor const*>(&d)) - return pdict->GetTargetPhraseCollection(*this,r); - - std::cerr<<"ERROR: wrong phrase dictionary type for confusion net decoding!" - " Has to be PhraseDictionaryTreeAdaptor\n"; - abort(); -} - -TranslationOptionCollection* -ConfusionNet::CreateTranslationOptionCollection() const -{ - size_t maxNoTransOptPerCoverage = StaticData::Instance()->GetMaxNoTransOptPerCoverage(); - return new TranslationOptionCollectionConfusionNet(*this, maxNoTransOptPerCoverage); -} - diff --git a/moses/src/ConfusionNet.h b/moses/src/ConfusionNet.h deleted file mode 100644 index 6c3d75c14..000000000 --- a/moses/src/ConfusionNet.h +++ /dev/null @@ -1,55 +0,0 @@ -// $Id$ - -#ifndef CONFUSIONNET_H_ -#define CONFUSIONNET_H_ -#include <vector> -#include <iostream> -#include "Word.h" -#include "Input.h" - -class FactorCollection; -class TranslationOptionCollection; - -class ConfusionNet : public InputType { - public: - typedef std::vector<std::pair<Word,float> > Column; - - private: - std::vector<Column> data; - FactorCollection *m_factorCollection; - public: - ConfusionNet(FactorCollection* p=0); - ~ConfusionNet(); - - void SetFactorCollection(FactorCollection*); - - const Column& GetColumn(size_t i) const {assert(i<data.size());return data[i];} - const Column& operator[](size_t i) const {return GetColumn(i);} - - bool Empty() const {return data.empty();} - size_t GetSize() const {return data.size();} - void Clear() {data.clear();} - - bool ReadF(std::istream&,const std::vector<FactorType>& factorOrder,int format=0); - void Print(std::ostream&) const; - - int Read(std::istream& in,const std::vector<FactorType>& factorOrder, FactorCollection &factorCollection); - - - Phrase GetSubString(const WordsRange&) const; - std::string GetStringRep(const WordsRange&) const; //not well defined yet - const FactorArray& GetFactorArray(size_t pos) const; - - - TargetPhraseCollection const* CreateTargetPhraseCollection(PhraseDictionaryBase const& d,const WordsRange& r) const; - TranslationOptionCollection* CreateTranslationOptionCollection() const; - - - private: - bool ReadFormat0(std::istream&,const std::vector<FactorType>& factorOrder); - bool ReadFormat1(std::istream&,const std::vector<FactorType>& factorOrder); - void String2Word(const std::string& s,Word& w,const std::vector<FactorType>& factorOrder); -}; - -std::ostream& operator<<(std::ostream& out,const ConfusionNet& cn); -#endif diff --git a/moses/src/DecodeStep.h b/moses/src/DecodeStep.h deleted file mode 100644 index 4a87f4047..000000000 --- a/moses/src/DecodeStep.h +++ /dev/null @@ -1,60 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <cassert> -#include "TypeDef.h" -#include "PhraseDictionary.h" -#include "GenerationDictionary.h" - -class Dictionary; -class DecodeStep -{ -protected: - const DecodeType m_decodeType; - const Dictionary *m_ptr; - // 2nd = pointer to a phraseDictionary or generationDictionary -public: - DecodeStep(DecodeType decodeType, Dictionary *ptr) - :m_decodeType(decodeType) - ,m_ptr(ptr) - { - } - DecodeType GetDecodeType() const - { - return m_decodeType; - } - const PhraseDictionaryBase &GetPhraseDictionary() const - { - assert (m_decodeType == Translate); - assert (dynamic_cast<const PhraseDictionaryBase*>(m_ptr)); - return *dynamic_cast<const PhraseDictionaryBase*>(m_ptr); - } - const GenerationDictionary &GetGenerationDictionary() const - { - assert (m_decodeType == Generate); - assert (dynamic_cast<const GenerationDictionary*>(m_ptr)); - return *dynamic_cast<const GenerationDictionary*>(m_ptr); - } - const Dictionary* GetDictionaryPtr() const {return m_ptr;} - -}; diff --git a/moses/src/Dictionary.cpp b/moses/src/Dictionary.cpp deleted file mode 100644 index 3cee67497..000000000 --- a/moses/src/Dictionary.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// $Id$ -#include "Dictionary.h" -#include "FactorTypeSet.h" - -size_t Dictionary::s_index = 0; - -Dictionary::Dictionary(size_t noScoreComponent) - :m_noScoreComponent(noScoreComponent) - ,m_index(s_index++) - ,m_factorsUsed(2) -{ -} - -Dictionary::~Dictionary() {} - -void Dictionary::CleanUp() {} - diff --git a/moses/src/Dictionary.h b/moses/src/Dictionary.h deleted file mode 100644 index 0530be302..000000000 --- a/moses/src/Dictionary.h +++ /dev/null @@ -1,57 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <vector> -#include "FactorTypeSet.h" -#include "ScoreProducer.h" - -class Dictionary -{ -protected: - static size_t s_index; - - const size_t m_noScoreComponent, m_index; - std::vector< FactorTypeSet* > m_factorsUsed; - -public: - Dictionary(size_t noScoreComponent); - - const FactorTypeSet &GetFactorsUsed(FactorDirection direction) const - { - assert(static_cast<size_t>(direction)<m_factorsUsed.size()); - assert(m_factorsUsed[direction]); - return *m_factorsUsed[direction]; - } - virtual ~Dictionary(); - - size_t GetNoScoreComponents() const { return m_noScoreComponent; } - - size_t GetIndex() const - { - return m_index; - } - virtual DecodeType GetDecodeType() const = 0; - - // clean up temporary memory, called after processing each sentence - virtual void CleanUp(); -}; diff --git a/moses/src/DistortionOrientation.cpp b/moses/src/DistortionOrientation.cpp deleted file mode 100755 index a1ffff05d..000000000 --- a/moses/src/DistortionOrientation.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// $Id$ - -#include <iostream> -#include <limits> -#include <assert.h> -#include "DistortionOrientation.h" -#include "TypeDef.h" -#include "Hypothesis.h" -/* - * Load the file pointed to by filename; set up the table according to - * the orientation and condition parameters. Direction will be used - * later for computing the score. - * - * default type is Msd, meaning will distinguish between monotone, swap, discontinuous rather than - * just monotone/non monotone. - */ -int DistortionOrientation::GetOrientation(const Hypothesis *curr_hypothesis, int direction, int type) -{ - size_t numSourceWords = curr_hypothesis->GetWordsBitmap().GetSize(); - const WordsRange &currTargetRange = curr_hypothesis->GetPrevHypo()->GetCurrSourceWordsRange() - , &prevSourceRange = curr_hypothesis->GetCurrSourceWordsRange() - , &currSourceRange = curr_hypothesis->GetCurrTargetWordsRange(); - - size_t prev_source_start = prevSourceRange.GetStartPos(); - size_t prev_source_end = prevSourceRange.GetEndPos(); - size_t curr_source_start = currSourceRange.GetStartPos(); - size_t curr_source_end = currSourceRange.GetEndPos(); - size_t curr_target_start = currTargetRange.GetStartPos(); - size_t curr_target_end = currTargetRange.GetEndPos(); - - if(direction==LexReorderType::Backward) - { - if(curr_target_start==0 || curr_target_end==numSourceWords || prev_source_end==curr_source_start) - { - //the first two conditionals are edge cases which judge first and last phrases as monotonic - return DistortionOrientationType::MONO; - } - else if(type==DistortionOrientationType::Msd) //distinguish between monotone, swap, discontinuous - { - if(prev_source_start==curr_source_end) - return DistortionOrientationType::SWAP; - else - return DistortionOrientationType::DISC; - } - else //only distinguish between Monotone, non monotone - { - return DistortionOrientationType::NON_MONO; - } - - } - else //assume direction is forward, do same computation but on PREVIOUS hypothesis - { - return DistortionOrientation::GetOrientation(curr_hypothesis->GetPrevHypo() - ,LexReorderType::Forward - ,type); - } -} - diff --git a/moses/src/DistortionOrientation.h b/moses/src/DistortionOrientation.h deleted file mode 100755 index d539a426a..000000000 --- a/moses/src/DistortionOrientation.h +++ /dev/null @@ -1,44 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -/* -* The DistortionOrientation class contains a static method which returns -* what DistortionOrientation type (one of {MONO, NON_MONO, SWAP, DISC } -* as enumerated under ORIENTATIONS in TypeDef.h) the current phrase -* is with respect to the previous. -*/ - -#pragma once - -#include <string> -#include <vector> -#include <map> -#include "TypeDef.h" -#include "WordsRange.h" -#include "Hypothesis.h" - - -class DistortionOrientation -{ - public: - static int GetOrientation(const Hypothesis *curr_hypothesis, int direction, int type=DistortionOrientationType::Msd); -}; - diff --git a/moses/src/DummyScoreProducers.cpp b/moses/src/DummyScoreProducers.cpp deleted file mode 100644 index 5d5ab8a7a..000000000 --- a/moses/src/DummyScoreProducers.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// $Id$ - -#include "StaticData.h" -#include "DummyScoreProducers.h" -#include "WordsRange.h" - -DistortionScoreProducer::DistortionScoreProducer() -{ - const_cast<ScoreIndexManager&>(StaticData::Instance()->GetScoreIndexManager()).AddScoreProducer(this); -} - -unsigned int DistortionScoreProducer::GetNumScoreComponents() const -{ - return 1; -} - -const std::string DistortionScoreProducer::GetScoreProducerDescription() const -{ - return "distortion score"; -} - -float DistortionScoreProducer::CalculateDistortionScore(const WordsRange &prev, const WordsRange &curr) const -{ - if (prev.GetWordsCount() == 0) - { // 1st hypothesis with translated phrase. NOT the seed hypo. - return - (float) curr.GetStartPos(); - } - else - { // add distortion score of current translated phrase to - // distortions scores of all previous partial translations - return - (float) curr.CalcDistortion(prev); - } -} - -WordPenaltyProducer::WordPenaltyProducer() -{ - const_cast<ScoreIndexManager&>(StaticData::Instance()->GetScoreIndexManager()).AddScoreProducer(this); -} - -unsigned int WordPenaltyProducer::GetNumScoreComponents() const -{ - return 1; -} - -const std::string WordPenaltyProducer::GetScoreProducerDescription() const -{ - return "word penalty"; -} - diff --git a/moses/src/DummyScoreProducers.h b/moses/src/DummyScoreProducers.h deleted file mode 100644 index f31401737..000000000 --- a/moses/src/DummyScoreProducers.h +++ /dev/null @@ -1,33 +0,0 @@ -// $Id$ - -#ifndef _DUMMY_SCORE_PRODUCERS_H_ -#define _DUMMY_SCORE_PRODUCERS_H_ - -#include "ScoreProducer.h" - -class WordsRange; - -/** Calculates Distortion scores - */ -class DistortionScoreProducer : public ScoreProducer { -public: - DistortionScoreProducer(); - - float CalculateDistortionScore(const WordsRange &prev, const WordsRange &curr) const; - - unsigned int GetNumScoreComponents() const; - const std::string GetScoreProducerDescription() const; -}; - -/** Doesn't do anything but provide a key into the global - * score array to store the word penalty in. - */ -class WordPenaltyProducer : public ScoreProducer { -public: - WordPenaltyProducer(); - - unsigned int GetNumScoreComponents() const; - const std::string GetScoreProducerDescription() const; -}; - -#endif diff --git a/moses/src/Factor.cpp b/moses/src/Factor.cpp deleted file mode 100755 index ec60e0aa1..000000000 --- a/moses/src/Factor.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include "Factor.h" - -using namespace std; - -size_t Factor::s_id = 0; - -Factor::Factor(FactorDirection direction, FactorType factorType, const std::string *factorString) -:m_direction(direction) -,m_factorType(factorType) -,m_ptrString(factorString) -,m_id(s_id++) -{ -} - -TO_STRING_BODY(Factor) - -// friend -ostream& operator<<(ostream& out, const Factor& factor) -{ - out << factor.GetString(); - return out; -} - diff --git a/moses/src/Factor.h b/moses/src/Factor.h deleted file mode 100755 index a58bd12d2..000000000 --- a/moses/src/Factor.h +++ /dev/null @@ -1,124 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <sstream> -#include <iostream> -#include <list> -#include <vector> -#include <map> -#include <string> -#include "TypeDef.h" -#include "Util.h" -#include "hash.h" - -class FactorCollection; - -/** Represents a factor (word, POS, etc) on the E or F side - * - * A Factor object is a tuple of direction (Input or Output, - * corresponding to French or English), a type (surface form, - * POS, stem, etc), and the value of the factor. - * - * @TODO I find this design problematic- essentially, a factor should - * just be a value type and the factor type and "direction" - * should be the keys in a larger identification system that - * find instances of specific factors. - * - */ -class Factor -{ - friend std::ostream& operator<<(std::ostream&, const Factor&); - - // only these classes are allowed to instantiate this class - friend class FactorCollection; - -protected: - static size_t s_id; - - FactorDirection m_direction; - FactorType m_factorType; - const std::string *m_ptrString; - const size_t m_id; - - Factor(FactorDirection direction, FactorType factorType, const std::string *factorString); - -public: - inline size_t hash() const - { - size_t h=quick_hash((const char*)&m_direction, sizeof(FactorDirection), 0xc7e7f2fd); - h=quick_hash((const char*)&m_factorType, sizeof(FactorType), h); - h=quick_hash((const char*)&m_ptrString, sizeof(const std::string *), h); - return h; - } - - inline FactorDirection GetFactorDirection() const - { - return m_direction; - } - inline FactorType GetFactorType() const - { - return m_factorType; - } - inline const std::string &GetString() const - { - return *m_ptrString; - } - inline size_t GetId() const - { - return m_id; - } - // do it properly. needed for insert & finding of words in dictionary - inline int Compare(const Factor &compare) const - { - if (m_ptrString < compare.m_ptrString) - return -1; - if (m_ptrString > compare.m_ptrString) - return 1; - - if (m_direction < compare.m_direction) - return -1; - if (m_direction > compare.m_direction) - return 1; - - if (m_factorType < compare.m_factorType) - return -1; - if (m_factorType > compare.m_factorType) - return 1; - - return 0; - } - - inline bool operator<(const Factor &compare) const - { - return Compare(compare) < 0; - } - - inline bool operator==(const Factor &compare) const - { - return Compare(compare) == 0; - } - - TO_STRING; - -}; - diff --git a/moses/src/FactorCollection.cpp b/moses/src/FactorCollection.cpp deleted file mode 100755 index 1a276c2ba..000000000 --- a/moses/src/FactorCollection.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include <iostream> -#include <fstream> -#include <string> -#include <vector> -#include "FactorCollection.h" -#include "LanguageModel.h" -#include "Util.h" - -using namespace std; - -void FactorCollection::LoadVocab(FactorDirection direction, FactorType factorType, const string &fileName) -{ - ifstream inFile(fileName.c_str()); - - string line; - - while( !getline(inFile, line, '\n').eof()) - { - vector<string> token = Tokenize( line ); - if (token.size() < 2) - { - continue; - } - // looks like good line - AddFactor(direction, factorType, token[1]); - } -} - -bool FactorCollection::Exists(FactorDirection direction, FactorType factorType, const string &factorString) -{ - // find string id - const string *ptrString=&(*m_factorStringCollection.insert(factorString).first); - - FactorSet::const_iterator iterFactor; - Factor search(direction, factorType, ptrString); - - iterFactor = m_collection.find(search); - return iterFactor != m_collection.end(); -} - -const Factor *FactorCollection::AddFactor(FactorDirection direction - , FactorType factorType - , const string &factorString) -{ - // find string id - const string *ptrString=&(*m_factorStringCollection.insert(factorString).first); - return &(*m_collection.insert(Factor(direction, factorType, ptrString)).first); -} - -FactorCollection::~FactorCollection() -{ - //FactorSet::iterator iter; - //for (iter = m_collection.begin() ; iter != m_collection.end() ; iter++) - //{ - // delete (*iter); - //} -} - -TO_STRING_BODY(FactorCollection); - -// friend -ostream& operator<<(ostream& out, const FactorCollection& factorCollection) -{ - FactorSet::const_iterator iterFactor; - - for (iterFactor = factorCollection.m_collection.begin() ; iterFactor != factorCollection.m_collection.end() ; ++iterFactor) - { - const Factor &factor = *iterFactor; - out << factor; - } - - return out; -} - diff --git a/moses/src/FactorCollection.h b/moses/src/FactorCollection.h deleted file mode 100755 index 39122be46..000000000 --- a/moses/src/FactorCollection.h +++ /dev/null @@ -1,74 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <string> -#include "Factor.h" - -class LanguageModel; - -#if 0 -#include <ext/hash_set> - -struct StringHasher { - __gnu_cxx::hash<const char*> hasher; - size_t operator()(const std::string& s) const { return hasher(s.c_str()); } -}; -struct FactorHasher { - size_t operator()(const Factor& s) const { return s.hash(); } -}; - -typedef __gnu_cxx::hash_set<std::string, StringHasher> StringSet; -typedef __gnu_cxx::hash_set<Factor, FactorHasher> FactorSet; -#else -#include <set> -typedef std::set<Factor> FactorSet; -typedef std::set<std::string> StringSet; -#endif - -/** collects factors - * - * All Factors in moses are accessed and created by a FactorCollection. - * By enforcing this strict creation processes (ie, forbidding factors - * from being created on the stack, etc), their memory addresses can - * be used as keys to uniquely identify them. - */ -class FactorCollection -{ - friend std::ostream& operator<<(std::ostream&, const FactorCollection&); - -protected: - - FactorSet m_collection; - StringSet m_factorStringCollection; -public: - ~FactorCollection(); - - bool Exists(FactorDirection direction, FactorType factorType, const std::string &factorString); - const Factor *AddFactor(FactorDirection direction, FactorType factorType, const std::string &factorString); - - void LoadVocab(FactorDirection direction, FactorType factorType, const std::string &fileName); - - TO_STRING; - -}; - diff --git a/moses/src/FactorTypeSet.cpp b/moses/src/FactorTypeSet.cpp deleted file mode 100755 index ee11aeb0a..000000000 --- a/moses/src/FactorTypeSet.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include "FactorTypeSet.h" - -using namespace std; - -FactorTypeSet::FactorTypeSet(const vector<FactorType> &factors) -{ - m_bit = 0; - vector<FactorType>::const_iterator iter; - for (iter = factors.begin() ; iter != factors.end() ; ++iter) - { - Add(*iter); - } -} - -TO_STRING_BODY(FactorTypeSet); - - diff --git a/moses/src/FactorTypeSet.h b/moses/src/FactorTypeSet.h deleted file mode 100755 index 81d018a82..000000000 --- a/moses/src/FactorTypeSet.h +++ /dev/null @@ -1,95 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <iostream> -#include <set> -#include <vector> -#include <algorithm> -#include <iterator> -#include "TypeDef.h" -#include "Util.h" - -class FactorTypeSet -{ - friend std::ostream& operator<<(std::ostream&, const FactorTypeSet&); - -protected: - unsigned int m_bit; - - inline FactorTypeSet(unsigned int bit) - { - m_bit = bit; - } -public: - inline FactorTypeSet() - :m_bit(0) - { - } - FactorTypeSet (const std::vector<FactorType> &factors); - - inline void Add(const FactorType &factorType) - { - unsigned int value = static_cast<unsigned int>(factorType); - m_bit |= (1 << value); - } - - inline FactorTypeSet Intersect(const FactorTypeSet &other) const - { - unsigned int bit = m_bit & other.m_bit; - return FactorTypeSet(bit);; - } - - inline void Merge(const FactorTypeSet &other) - { - m_bit |= other.m_bit; - } - void Set(const FactorTypeSet &other) - { - m_bit = 0; - Merge(other); - } - inline bool Contains(FactorType factorType) const - { - unsigned int value = static_cast<unsigned int>(factorType); - return Contains(value); - } - TO_STRING; -}; - -// friend -inline -std::ostream& operator<<(std::ostream& out, const FactorTypeSet& factorTypeSet) -{ - out << "("; - - for (size_t currFactor = 0 ; currFactor < NUM_FACTORS ; currFactor++) - { - if (factorTypeSet.Contains(currFactor)) - { - out << "," << currFactor; - } - } - out << ") "; - - return out; -} diff --git a/moses/src/File.h b/moses/src/File.h deleted file mode 100644 index cb5f7f875..000000000 --- a/moses/src/File.h +++ /dev/null @@ -1,83 +0,0 @@ -// $Id$ - -/* ---------------------------------------------------------------- */ -/* Copyright 2005 (c) by RWTH Aachen - Lehrstuhl fuer Informatik VI */ -/* Richard Zens */ -/* ---------------------------------------------------------------- */ -#ifndef FILE_H_ -#define FILE_H_ -#include <cstdio> -#include <vector> - -static const off_t InvalidOffT=-1; - -// WARNING: -// these functions work only for bitwise read/write-able types - -template<typename T> inline size_t fWrite(FILE* f,const T& t) { - if(fwrite(&t,sizeof(t),1,f)!=1) { - std::cerr<<"ERROR:: fwrite!\n";abort();} - return sizeof(t); -} - -template<typename T> inline void fRead(FILE* f,T& t) { - if(fread(&t,sizeof(t),1,f)!=1) {std::cerr<<"ERROR: fread!\n";abort();} -} - -template<typename T> inline size_t fWrite(FILE* f,const T* b,const T* e) { - unsigned s=e-b;size_t rv=fWrite(f,s); - if(fwrite(b,sizeof(T),s,f)!=s) {std::cerr<<"ERROR: fwrite!\n";abort();} - return rv+sizeof(T)*s; -} - -template<typename T> inline size_t fWrite(FILE* f,const T b,const T e) { - unsigned s=std::distance(b,e);size_t rv=fWrite(f,s); - if(fwrite(&(*b),sizeof(T),s,f)!=s) {std::cerr<<"ERROR: fwrite!\n";abort();} - return rv+sizeof(T)*s; -} - -template<typename C> inline size_t fWriteVector(FILE* f,const C& v) { - unsigned s=v.size(); - size_t rv=fWrite(f,s); - if(fwrite(&v[0],sizeof(typename C::value_type),s,f)!=s) {std::cerr<<"ERROR: fwrite!\n";abort();} - return rv+sizeof(typename C::value_type)*s; -} - -template<typename C> inline void fReadVector(FILE* f, C& v) { - unsigned s;fRead(f,s);v.resize(s); - unsigned r=fread(&(*v.begin()),sizeof(typename C::value_type),s,f); - if(r!=s) { - std::cerr<<"ERROR: freadVec! "<<r<<" "<<s<<"\n";abort();} -} - -#ifdef WIN32 -inline off_t fTell(FILE* f) {return ftell(f);} - -inline void fSeek(FILE* f,off_t o) { - if(fseek(f,o,SEEK_SET)<0) { - std::cerr<<"ERROR: could not fseeko position "<<o<<"\n"; - if(o==InvalidOffT) std::cerr<<"You tried to seek for 'InvalidOffT'!\n"; - abort(); - } -} -#else -inline off_t fTell(FILE* f) {return ftello(f);} - -inline void fSeek(FILE* f,off_t o) { - if(fseeko(f,o,SEEK_SET)<0) { - std::cerr<<"ERROR: could not fseeko position "<<o<<"\n"; - if(o==InvalidOffT) std::cerr<<"You tried to seek for 'InvalidOffT'!\n"; - abort(); - } -} -#endif - -inline FILE* fOpen(const char* fn,const char* m) { - if(FILE* f=fopen(fn,m)) return f; else { - std::cerr<<"ERROR: could not open file "<<fn<<" with mode "<<m<<"\n"; - abort();} -} -inline void fClose(FILE* f) {fclose(f);} // for consistent function names only - -#endif - diff --git a/moses/src/FilePtr.h b/moses/src/FilePtr.h deleted file mode 100644 index 36a5aa991..000000000 --- a/moses/src/FilePtr.h +++ /dev/null @@ -1,48 +0,0 @@ -// $Id$ - -/* ---------------------------------------------------------------- */ -/* Copyright 2005 (c) by RWTH Aachen - Lehrstuhl fuer Informatik VI */ -/* Richard Zens */ -/* ---------------------------------------------------------------- */ - -#ifndef FILEPTR_H_ -#define FILEPTR_H_ -#include "File.h" - -// smart pointer for on-demand loading from file -// requirement: T has a constructor T(FILE*) - -template<typename T> class FilePtr { -public: - typedef T* Ptr; -private: - FILE* f; - off_t pos; - mutable Ptr t; -public: - FilePtr(FILE* f_=0,off_t p=0) : f(f_),pos(p),t(0) {} - ~FilePtr() {} - - void set(FILE* f_,off_t p) {f=f_;pos=p;} - void free() {delete t; t=0;} - - T& operator* () {load();return *t;} - Ptr operator->() {load();return t;} - operator Ptr () {load();return t;} - - const T& operator* () const {load();return *t;} - const Ptr operator->() const {load();return t;} - operator const Ptr () const {load();return t;} - - // direct access to pointer, use with care! - Ptr getPtr() {return t;} - const Ptr getPtr() const {return t;} - - operator bool() const {return (f && pos!=InvalidOffT);} - - void load() const { - if(t) return; - if(f && pos!=InvalidOffT) {fSeek(f,pos); t=new T(f);} - } -}; -#endif diff --git a/moses/src/GenerationDictionary.cpp b/moses/src/GenerationDictionary.cpp deleted file mode 100755 index 12f3f8192..000000000 --- a/moses/src/GenerationDictionary.cpp +++ /dev/null @@ -1,126 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include <fstream> -#include <string> -#include "GenerationDictionary.h" -#include "FactorCollection.h" -#include "Word.h" -#include "Util.h" -#include "InputFileStream.h" -#include "StaticData.h" - -using namespace std; - -GenerationDictionary::GenerationDictionary() - : Dictionary(1) -{ - const_cast<ScoreIndexManager&>(StaticData::Instance()->GetScoreIndexManager()).AddScoreProducer(this); -} - -void GenerationDictionary::Load(const std::vector<FactorType> &input - , const std::vector<FactorType> &output - , FactorCollection &factorCollection - , const std::string &filePath - , float weight - , FactorDirection direction) -{ - m_weight = weight; - - //factors - m_factorsUsed[Input] = new FactorTypeSet(input); - m_factorsUsed[Output] = new FactorTypeSet(output); - - // data from file - InputFileStream inFile(filePath); - - m_filename = filePath; - string line; - while(getline(inFile, line)) - { - vector<string> token = Tokenize( line ); - - // add each line in generation file into class - Word inputWord, outputWord; - - // create word with certain factors filled out - - // inputs - vector<string> factorString = Tokenize( token[0], "|" ); - for (size_t i = 0 ; i < input.size() ; i++) - { - FactorType factorType = input[i]; - const Factor *factor = factorCollection.AddFactor( direction, factorType, factorString[i]); - inputWord.SetFactor(factorType, factor); - } - - factorString = Tokenize( token[1], "|" ); - for (size_t i = 0 ; i < output.size() ; i++) - { - FactorType factorType = output[i]; - - const Factor *factor = factorCollection.AddFactor( direction, factorType, factorString[i]); - outputWord.SetFactor(factorType, factor); - } - - float score = TransformScore(Scan<float>(token[2])); - - m_collection[inputWord][outputWord] = score; - } - inFile.Close(); -} - -GenerationDictionary::~GenerationDictionary() -{ - for (size_t i = 0 ; i < m_factorsUsed.size() ; i++) - { - delete m_factorsUsed[i]; - } -} - -unsigned int GenerationDictionary::GetNumScoreComponents() const -{ - return this->GetNoScoreComponents(); -} - -const std::string GenerationDictionary::GetScoreProducerDescription() const -{ - return "Generation score, file=" + m_filename; -} - -const OutputWordCollection *GenerationDictionary::FindWord(const FactorArray &factorArray) const -{ - const OutputWordCollection *ret; - Word word; - Word::Copy(word.GetFactorArray(), factorArray); - - std::map<Word , OutputWordCollection>::const_iterator iter = m_collection.find(word); - if (iter == m_collection.end()) - { // can't find source phrase - ret = NULL; - } - else - { - ret = &iter->second; - } - return ret; -} - diff --git a/moses/src/GenerationDictionary.h b/moses/src/GenerationDictionary.h deleted file mode 100755 index 27a1ed526..000000000 --- a/moses/src/GenerationDictionary.h +++ /dev/null @@ -1,79 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <list> -#include <map> -#include <vector> -#include "Phrase.h" -#include "TypeDef.h" -#include "Dictionary.h" - -class FactorCollection; - -typedef std::map < Word , float > OutputWordCollection; - // 1st = output phrase - // 2nd = log probability (score) - -class GenerationDictionary : public Dictionary, public ScoreProducer -{ -protected: - std::map<Word , OutputWordCollection> m_collection; - // 1st = source - // 2nd = target - float m_weight; - std::string m_filename; - -public: - GenerationDictionary(); - virtual ~GenerationDictionary(); - - DecodeType GetDecodeType() const - { - return Generate; - } - - void Load(const std::vector<FactorType> &input - , const std::vector<FactorType> &output - , FactorCollection &factorCollection - , const std::string &filePath - , float weight - , FactorDirection direction); - - unsigned int GetNumScoreComponents() const; - const std::string GetScoreProducerDescription() const; - - float GetWeight() const - { - return m_weight; - } - size_t GetSize() const - { - return m_collection.size(); - } - void SetWeight(float weight) - { - m_weight = weight; - } - const OutputWordCollection *FindWord(const FactorArray &factorArray) const; -}; - diff --git a/moses/src/Hypothesis.cpp b/moses/src/Hypothesis.cpp deleted file mode 100755 index 7c5321104..000000000 --- a/moses/src/Hypothesis.cpp +++ /dev/null @@ -1,470 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ -#include <cassert> -#include <iostream> -#include <limits> -#include "TranslationOption.h" -#include "TranslationOptionCollection.h" -#include "DummyScoreProducers.h" -#include "Hypothesis.h" -#include "Util.h" -#include "SquareMatrix.h" -#include "LexicalReordering.h" -#include "StaticData.h" -#include "Input.h" -#include "LMList.h" -#include "hash.h" - -using namespace std; - -unsigned int Hypothesis::s_numNodes = 0; -unsigned int Hypothesis::s_HypothesesCreated = 0; -ObjectPool<Hypothesis> Hypothesis::s_objectPool("Hypothesis", 300000); - -Hypothesis::Hypothesis(InputType const& source, const TargetPhrase &emptyTarget) - : m_prevHypo(NULL) - , m_targetPhrase(emptyTarget) - , m_sourcePhrase(0) - , m_sourceCompleted(source.GetSize()) - , m_sourceInput(source) - , m_currSourceWordsRange(NOT_FOUND, NOT_FOUND) - , m_currTargetWordsRange(NOT_FOUND, NOT_FOUND) - , m_wordDeleted(false) - , m_languageModelStates(StaticData::Instance()->GetLMSize(), LanguageModel::UnknownState) -#ifdef N_BEST - , m_arcList(NULL) -#endif - , m_id(s_HypothesesCreated++) -{ // used for initial seeding of trans process - // initialize scores - _hash_computed = false; - ResetScore(); -} - -/*** - * continue prevHypo by appending the phrases in transOpt - */ -Hypothesis::Hypothesis(const Hypothesis &prevHypo, const TranslationOption &transOpt) - : m_prevHypo(&prevHypo) - , m_targetPhrase(transOpt.GetTargetPhrase()) - , m_sourcePhrase(0) - , m_sourceCompleted (prevHypo.m_sourceCompleted ) - , m_sourceInput (prevHypo.m_sourceInput) - , m_currSourceWordsRange (transOpt.GetSourceWordsRange()) - , m_currTargetWordsRange ( prevHypo.m_currTargetWordsRange.GetEndPos() + 1 - ,prevHypo.m_currTargetWordsRange.GetEndPos() + transOpt.GetTargetPhrase().GetSize()) - , m_wordDeleted(false) - , m_totalScore(0.0f) - , m_futureScore(0.0f) - , m_scoreBreakdown (prevHypo.m_scoreBreakdown) - , m_languageModelStates(prevHypo.m_languageModelStates) -#ifdef N_BEST - , m_arcList(NULL) -#endif - , m_id(s_HypothesesCreated++) -{ - // assert that we are not extending our hypothesis by retranslating something - // that this hypothesis has already translated! - assert(!m_sourceCompleted.Overlap(m_currSourceWordsRange)); - - _hash_computed = false; - m_sourceCompleted.SetValue(m_currSourceWordsRange.GetStartPos(), m_currSourceWordsRange.GetEndPos(), true); - m_wordDeleted = transOpt.IsDeletionOption(); - m_scoreBreakdown.PlusEquals(transOpt.GetScoreBreakdown()); -} - -Hypothesis::~Hypothesis() -{ -#ifdef N_BEST - if (m_arcList) - { - ArcList::iterator iter; - for (iter = m_arcList->begin() ; iter != m_arcList->end() ; ++iter) - { - s_objectPool.freeObject (*iter); - } - m_arcList->clear(); - - delete m_arcList; - } -#endif -} - -#ifdef N_BEST -void Hypothesis::AddArc(Hypothesis *loserHypo) -{ - if (!m_arcList) { - if (loserHypo->m_arcList) // we don't have an arcList, but loser does - { - this->m_arcList = loserHypo->m_arcList; // take ownership, we'll delete - loserHypo->m_arcList = 0; // prevent a double deletion - } - else - { this->m_arcList = new ArcList(); } - } else { - if (loserHypo->m_arcList) { // both have an arc list: merge. delete loser - size_t my_size = m_arcList->size(); - size_t add_size = loserHypo->m_arcList->size(); - this->m_arcList->resize(my_size + add_size, 0); - std::memcpy(&(*m_arcList)[0] + my_size, &(*m_arcList)[0], add_size * sizeof(Hypothesis *)); - delete loserHypo->m_arcList; - loserHypo->m_arcList = 0; - } else { // loserHypo doesn't have any arcs - // DO NOTHING - } - } - m_arcList->push_back(loserHypo); -} -#endif - -/*** - * return the subclass of Hypothesis most appropriate to the given translation option - */ -Hypothesis* Hypothesis::CreateNext(const TranslationOption &transOpt) const -{ - return Create(*this, transOpt); -} - -/*** - * return the subclass of Hypothesis most appropriate to the given translation option - */ -Hypothesis* Hypothesis::Create(const Hypothesis &prevHypo, const TranslationOption &transOpt) -{ - Hypothesis *ptr = s_objectPool.getPtr(); - return new(ptr) Hypothesis(prevHypo, transOpt); -} -/*** - * return the subclass of Hypothesis most appropriate to the given target phrase - */ - -Hypothesis* Hypothesis::Create(InputType const& m_source, const TargetPhrase &emptyTarget) -{ - Hypothesis *ptr = s_objectPool.getPtr(); - return new(ptr) Hypothesis(m_source, emptyTarget); -} - -bool Hypothesis::IsCompatible(const Phrase &phrase) const -{ - // make sure factors don't contradict each other - // similar to phrase comparison - - if (m_currTargetWordsRange.GetWordsCount() != phrase.GetSize()) - { - return false; - } - size_t hypoSize = GetSize(); - - size_t transOptPos = 0; - for (size_t hypoPos = hypoSize - m_currTargetWordsRange.GetWordsCount() ; hypoPos < hypoSize ; hypoPos++) - { - for (unsigned int currFactor = 0 ; currFactor < NUM_FACTORS ; currFactor++) - { - FactorType factorType = static_cast<FactorType>(currFactor); - const Factor *thisFactor = GetFactor(hypoPos, factorType) - ,*compareFactor = phrase.GetFactor(transOptPos, factorType); - if (thisFactor != NULL && compareFactor != NULL && thisFactor != compareFactor) - return false; - } - transOptPos++; - } - return true; -} - -#if 0 -void Hypothesis::GenerateNGramCompareKey(size_t contextSize) -{ - struct MD5Context md5c; - - MD5Init(&md5c); - size_t thisSize = this->GetSize(); - size_t effectiveContextSize = std::min(thisSize, contextSize); - int start = thisSize - effectiveContextSize; - - if (m_currTargetWordsRange.GetWordsCount() > 0) // initial hypothesis check - { - const Hypothesis *curHyp = this; - int curStart = 0; - while (start < (curStart = curHyp->m_currTargetWordsRange.GetStartPos())) { - for (int col = curHyp->m_currTargetWordsRange.GetEndPos(); col >= curStart; col--) { - MD5Update(&md5c, - (unsigned char*)curHyp->GetCurrFactorArray(col - curStart), - sizeof(FactorArray)); - curHyp = curHyp->m_prevHypo; - } - } - for (int col = curHyp->m_currTargetWordsRange.GetEndPos(); col >= (int)start; col--) { - MD5Update(&md5c, - (unsigned char*)curHyp->GetCurrFactorArray(col - curStart), - sizeof(FactorArray)); - } - } - MD5Final(m_compSignature, &md5c); -} -#endif - -void Hypothesis::GenerateNGramCompareHash() const -{ - _hash = quick_hash((const char*)&m_languageModelStates[0], sizeof(LanguageModel::State) * m_languageModelStates.size(), 0xcafe5137); - _hash_computed = true; - vector<size_t> wordCoverage = m_sourceCompleted.GetCompressedReprentation(); - _hash = quick_hash((const char*)&wordCoverage[0], sizeof(size_t)*wordCoverage.size(), _hash); -} - -int Hypothesis::NGramCompare(const Hypothesis &compare) const -{ // -1 = this < compare - // +1 = this > compare - // 0 = this ==compare - if (m_languageModelStates < compare.m_languageModelStates) return -1; - if (m_languageModelStates > compare.m_languageModelStates) return 1; - return 0; -} -/** - * Calculates the overall language model score by combining the scores - * of language models generated for each of the factors. Because the factors - * represent a variety of tag sets, and because factors with smaller tag sets - * (such as POS instead of words) allow us to calculate richer statistics, we - * allow a different length of n-gram to be specified for each factor. - * /param lmListInitial todo - describe this parameter - * /param lmListEnd todo - describe this parameter - */ -void Hypothesis::CalcLMScore(const LMList &languageModels) -{ - const size_t startPos = m_currTargetWordsRange.GetStartPos(); - LMList::const_iterator iterLM; - size_t lmIdx = 0; - - // already have LM scores from previous and trigram score of poss trans. - // just need trigram score of the words of the start of current phrase - for (iterLM = languageModels.begin() ; iterLM != languageModels.end() ; ++iterLM,++lmIdx) - { - const LanguageModel &languageModel = **iterLM; - FactorType factorType = languageModel.GetFactorType(); - size_t nGramOrder = languageModel.GetNGramOrder(); - size_t currEndPos = m_currTargetWordsRange.GetEndPos(); - float lmScore; - - if(m_currTargetWordsRange.GetWordsCount() == 0) { - lmScore = 0; //the score associated with dropping source words is not part of the language model - } else { //non-empty target phrase - // 1st n-gram - vector<const Factor*> contextFactor(nGramOrder); - size_t index = 0; - for (int currPos = (int) startPos - (int) nGramOrder + 1 ; currPos <= (int) startPos ; currPos++) - { - if (currPos >= 0) - contextFactor[index++] = GetFactor(currPos, factorType); - else - contextFactor[index++] = languageModel.GetSentenceStart(); - } - lmScore = languageModel.GetValue(contextFactor); - //cout<<"context factor: "<<languageModel.GetValue(contextFactor)<<endl; - - // main loop - size_t endPos = std::min(startPos + nGramOrder - 2 - , currEndPos); - for (size_t currPos = startPos + 1 ; currPos <= endPos ; currPos++) - { - // shift all args down 1 place - for (size_t i = 0 ; i < nGramOrder - 1 ; i++) - contextFactor[i] = contextFactor[i + 1]; - - // add last factor - contextFactor.back() = GetFactor(currPos, factorType); - - lmScore += languageModel.GetValue(contextFactor); - //cout<<"context factor: "<<languageModel.GetValue(contextFactor)<<endl; - } - - // end of sentence - if (m_sourceCompleted.IsComplete()) - { - const size_t size = GetSize(); - contextFactor.back() = languageModel.GetSentenceEnd(); - - for (size_t i = 0 ; i < nGramOrder - 1 ; i ++) - { - int currPos = size - nGramOrder + i + 1; - if (currPos < 0) - contextFactor[i] = languageModel.GetSentenceStart(); - else - contextFactor[i] = GetFactor((size_t)currPos, factorType); - } - lmScore += languageModel.GetValue(contextFactor, &m_languageModelStates[lmIdx]); - } else { - for (size_t currPos = endPos+1; currPos <= currEndPos; currPos++) { - for (size_t i = 0 ; i < nGramOrder - 1 ; i++) - contextFactor[i] = contextFactor[i + 1]; - contextFactor.back() = GetFactor(currPos, factorType); - } - m_languageModelStates[lmIdx]=languageModel.GetState(contextFactor); - } - } - - m_scoreBreakdown.PlusEquals(&languageModel, lmScore); - } -} - -void Hypothesis::CalcDistortionScore() - -{ - const DistortionScoreProducer *dsp = StaticData::Instance()->GetDistortionScoreProducer(); - float distortionScore = dsp->CalculateDistortionScore( - m_prevHypo->GetCurrSourceWordsRange(), - this->GetCurrSourceWordsRange() - ); - m_scoreBreakdown.PlusEquals(dsp, distortionScore); -} - -void Hypothesis::ResetScore() -{ - m_scoreBreakdown.ZeroAll(); - m_futureScore = m_totalScore = 0.0f; -} - -/*** - * calculate the logarithm of our total translation score (sum up components) - */ -void Hypothesis::CalcScore(const StaticData& staticData, const SquareMatrix &futureScore) -{ - // DISTORTION COST - CalcDistortionScore(); - - // LANGUAGE MODEL COST - CalcLMScore(staticData.GetAllLM()); - - // WORD PENALTY - m_scoreBreakdown.PlusEquals(staticData.GetWordPenaltyProducer(), - (float) m_currTargetWordsRange.GetWordsCount()); - - // FUTURE COST - CalcFutureScore(futureScore); - - - //LEXICAL REORDERING COST - LexicalReordering *m_lexReorder = staticData.GetLexReorder(); - if (m_lexReorder) { - m_scoreBreakdown.PlusEquals(m_lexReorder, m_lexReorder->CalcScore(this)); - } - - // TOTAL - m_totalScore = m_scoreBreakdown.InnerProduct(staticData.GetAllWeights()) + m_futureScore; -} - -void Hypothesis::CalcFutureScore(const SquareMatrix &futureScore) -{ - const size_t maxSize= numeric_limits<size_t>::max(); - size_t start = maxSize; - m_futureScore = 0.0f; - for(size_t currPos = 0 ; currPos < m_sourceCompleted.GetSize() ; currPos++) - { - if(m_sourceCompleted.GetValue(currPos) == 0 && start == maxSize) - { - start = currPos; - } - if(m_sourceCompleted.GetValue(currPos) == 1 && start != maxSize) - { -// m_score[ScoreType::FutureScoreEnum] += futureScore[start][currPos - 1]; - m_futureScore += futureScore.GetScore(start, currPos - 1); - start = maxSize; - } - } - if (start != maxSize) - { -// m_score[ScoreType::FutureScoreEnum] += futureScore[start][m_sourceCompleted.GetSize() - 1]; - m_futureScore += futureScore.GetScore(start, m_sourceCompleted.GetSize() - 1); - } - - // add future costs for distortion model - if(StaticData::Instance()->UseDistortionFutureCosts()) - m_futureScore += m_sourceCompleted.GetFutureCosts(m_currSourceWordsRange.GetEndPos()) * StaticData::Instance()->GetWeightDistortion(); - -} - - -int Hypothesis::GetId()const{ - return m_id; -} - -const Hypothesis* Hypothesis::GetPrevHypo()const{ - return m_prevHypo; -} - -/** - * print hypothesis information for pharaoh-style logging - */ -void Hypothesis::PrintHypothesis(const InputType &source, float weightDistortion, float weightWordPenalty) const{ - cout<<"creating hypothesis "<< m_id <<" from "<< m_prevHypo->m_id<<" ( "; - int end = m_prevHypo->m_targetPhrase.GetSize()-1; - int start = end-1; - if ( start < 0 ) start = 0; - if ( m_prevHypo->m_currTargetWordsRange.GetStartPos() == NOT_FOUND ) { - cout << "<s> "; - } - else { - cout << "... "; - } - if (end>=0) { - WordsRange range(start, end); - cout << m_prevHypo->m_targetPhrase.GetSubString(range) << " "; - } - cout<<")"<<endl; - cout<<"\tbase score "<< (m_prevHypo->m_totalScore - m_prevHypo->m_futureScore) <<endl; - cout<<"\tcovering "<<m_currSourceWordsRange.GetStartPos()<<"-"<<m_currSourceWordsRange.GetEndPos()<<": "<< source.GetSubString(m_currSourceWordsRange) <<endl; - cout<<"\ttranslated as: "<<m_targetPhrase; // <<" => translation cost "<<m_score[ScoreType::PhraseTrans]; - if (m_wordDeleted) cout <<" word_deleted"; - cout<<endl; - cout<<"\tdistance: "<<GetCurrSourceWordsRange().CalcDistortion(m_prevHypo->GetCurrSourceWordsRange()); // << " => distortion cost "<<(m_score[ScoreType::Distortion]*weightDistortion)<<endl; - cout<<"\tlanguage model cost "; // <<m_score[ScoreType::LanguageModelScore]<<endl; - cout<<"\tword penalty "; // <<(m_score[ScoreType::WordPenalty]*weightWordPenalty)<<endl; - cout<<"\tscore "<<m_totalScore - m_futureScore<<" + future cost "<<m_futureScore<<" = "<<m_totalScore<<endl; - cout << "\tunweighted feature scores: " << m_scoreBreakdown << endl; - //PrintLMScores(); -} - -TO_STRING_BODY(Hypothesis) - -// friend -ostream& operator<<(ostream& out, const Hypothesis& hypothesis) -{ - hypothesis.ToStream(out); - // words bitmap - out << "[" << hypothesis.m_sourceCompleted << "] "; - - // scores - out << " [0.12, " << hypothesis.GetTotalScore() << "]"; - out << " " << hypothesis.GetScoreBreakdown(); - return out; -} - - -std::string Hypothesis::GetSourcePhraseStringRep() const -{ - if(m_sourcePhrase) { - assert(m_sourcePhrase->ToString()==m_sourcePhrase->GetStringRep(WordsRange(0,m_sourcePhrase->GetSize()-1))); - return m_sourcePhrase->ToString(); - } - else - return m_sourceInput.GetStringRep(m_currSourceWordsRange); - -} -std::string Hypothesis::GetTargetPhraseStringRep() const -{ - return m_targetPhrase.GetStringRep(m_currTargetWordsRange); -} diff --git a/moses/src/Hypothesis.h b/moses/src/Hypothesis.h deleted file mode 100755 index 77cd36933..000000000 --- a/moses/src/Hypothesis.h +++ /dev/null @@ -1,269 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <iostream> -#include <vector> -#include "Phrase.h" -#include "TypeDef.h" -#include "WordsBitmap.h" -#include "Sentence.h" -#include "Phrase.h" -#include "PhraseDictionary.h" -#include "GenerationDictionary.h" -#include "LanguageModel.h" -#include "ScoreComponentCollection.h" -#include "LexicalReordering.h" -#include "Input.h" -#include "ObjectPool.h" - -class SquareMatrix; -class StaticData; -class TranslationOption; -class WordsRange; -class Hypothesis; - -typedef std::vector<Hypothesis*> ArcList; - -class Hypothesis -{ - friend std::ostream& operator<<(std::ostream&, const Hypothesis&); -private: - // MD5 checksum for fast comparison - unsigned char m_compSignature[16]; - -protected: - static ObjectPool<Hypothesis> s_objectPool; - - const Hypothesis* m_prevHypo; - const Phrase &m_targetPhrase; //target phrase being created at the current decoding step - Phrase const* m_sourcePhrase; - WordsBitmap m_sourceCompleted; - //TODO: how to integrate this into confusion network framework; what if - //it's a confusion network in the end??? - InputType const& m_sourceInput; - WordsRange m_currSourceWordsRange, m_currTargetWordsRange; - bool m_wordDeleted; - float m_totalScore; - float m_futureScore; - ScoreComponentCollection2 m_scoreBreakdown; - std::vector<LanguageModel::State> m_languageModelStates; -#ifdef N_BEST - const Hypothesis *m_mainHypo; - ArcList *m_arcList; //all arcs that end at the same lattice point as we do -#endif - -// * \return whether none of the factors clash -// * \param phrase TODO ??? -// */ - bool IsCompatible(const Phrase &phrase) const; - - void CalcFutureScore(const SquareMatrix &futureScore); - //void CalcFutureScore(float futureScore[256][256]); - void CalcLMScore(const LMList &languageModels); - void CalcDistortionScore(); - //TODO: add appropriate arguments to score calculator - - void GenerateNGramCompareHash() const; - mutable size_t _hash; - mutable bool _hash_computed; - -public: - static ObjectPool<Hypothesis> &GetObjectPool() - { - return s_objectPool; - } - - static unsigned int s_HypothesesCreated; // Statistics: how many hypotheses were created in total - static unsigned int s_numNodes; // Statistics: how many hypotheses were created in total - int m_id; - - Hypothesis(InputType const& source, const TargetPhrase &emptyTarget); - // used for initial seeding of trans process - Hypothesis(const Hypothesis &prevHypo, const TranslationOption &transOpt); - // create next - ~Hypothesis(); - - /*** - * return the subclass of Hypothesis most appropriate to the given translation option - */ - static Hypothesis* Create(const Hypothesis &prevHypo, const TranslationOption &transOpt); - /*** - * return the subclass of Hypothesis most appropriate to the given target phrase - */ - - static Hypothesis* Create(const WordsBitmap &initialCoverage); - /*** - * return the subclass of Hypothesis most appropriate to the given target phrase - */ - static Hypothesis* Create(InputType const& source, const TargetPhrase &emptyTarget); - - - /*** - * return the subclass of Hypothesis most appropriate to the given translation option - */ - Hypothesis* CreateNext(const TranslationOption &transOpt) const; - /*** - * if any factors aren't set in our target phrase but are present in transOpt, copy them over - * (unless the factors that we do have fail to match the corresponding ones in transOpt, - * in which case presumably there's a programmer's error) - * - * return NULL if we aren't compatible with the given option - */ - - void PrintHypothesis( const InputType &source, float weightDistortion, float weightWordPenalty) const; - - const Phrase &GetTargetPhrase() const - { - return m_targetPhrase; - } - - // void PrintLMScores(const LMList &lmListInitial, const LMList &lmListEnd) const; - inline const WordsRange &GetCurrSourceWordsRange() const - { - return m_currSourceWordsRange; - } - - inline const WordsRange &GetCurrTargetWordsRange() const - { - return m_currTargetWordsRange; - } - - // subsequent translation should only translate this sub-phrase - size_t GetCurrTargetLength() const - { - return m_currTargetWordsRange.GetWordsCount(); - } - - void ResetScore(); - - void CalcScore(const StaticData& staticData, const SquareMatrix &futureScore); - - int GetId() const; - - - const Hypothesis* GetPrevHypo() const; - - // same as for phrase - inline size_t GetSize() const - { - return m_currTargetWordsRange.GetEndPos() + 1; - } - inline const Phrase &GetPhrase() const - { - return m_targetPhrase; - } - inline const InputType &GetSourcePhrase() const - { - return m_sourceInput; - } - - std::string GetSourcePhraseStringRep() const; - std::string GetTargetPhraseStringRep() const; - - // curr - pos is relative from CURRENT hypothesis's starting ind ex - // (ie, start of sentence would be some negative number, which is - // not allowed- USE WITH CAUTION) - inline const FactorArray &GetCurrFactorArray(size_t pos) const - { - return m_targetPhrase.GetFactorArray(pos); - } - inline const Factor *GetCurrFactor(size_t pos, FactorType factorType) const - { - return m_targetPhrase.GetFactor(pos, factorType); - } - // recursive - pos is relative from start of sentence - inline const FactorArray &GetFactorArray(size_t pos) const - { - const Hypothesis *hypo = this; - while (pos < hypo->GetCurrTargetWordsRange().GetStartPos()) - { - hypo = hypo->GetPrevHypo(); - assert(hypo != NULL); - } - return hypo->GetCurrFactorArray(pos - hypo->GetCurrTargetWordsRange().GetStartPos()); - } - inline const Factor* GetFactor(size_t pos, FactorType factorType) const - { - return GetFactorArray(pos)[factorType]; - } - - /*** - * \return The bitmap of source words we cover - */ - inline const WordsBitmap &GetWordsBitmap() const - { - return m_sourceCompleted; - } - - int Hypothesis::NGramCompare(const Hypothesis &compare) const; - - inline size_t hash() const - { - if (_hash_computed) return _hash; - GenerateNGramCompareHash(); - return _hash; - } - - void ToStream(std::ostream& out) const - { - if (m_prevHypo != NULL) - { - m_prevHypo->ToStream(out); - } - out << GetPhrase(); - } - - TO_STRING; - -#ifdef N_BEST - inline void SetMainHypo(const Hypothesis *hypo) - { - m_mainHypo = hypo; - } - void AddArc(Hypothesis *loserHypo); - inline void InitializeArcs() - { - if (!m_arcList) return; - ArcList::iterator iter = m_arcList->begin(); - for (; iter != m_arcList->end() ; ++iter) - { - Hypothesis *arc = *iter; - arc->SetMainHypo(this); - } - } - inline const ArcList* GetArcList() const - { - return m_arcList; - } -#endif - const ScoreComponentCollection2& GetScoreBreakdown() const - { - return m_scoreBreakdown; - } - float GetTotalScore() const { return m_totalScore; } - float GetFutureScore() const { return m_futureScore; } -}; - - -std::ostream& operator<<(std::ostream& out, const Hypothesis& hypothesis); - diff --git a/moses/src/HypothesisCollection.cpp b/moses/src/HypothesisCollection.cpp deleted file mode 100755 index b7561eb93..000000000 --- a/moses/src/HypothesisCollection.cpp +++ /dev/null @@ -1,240 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include <algorithm> -#include <set> -#include <queue> -#include "HypothesisCollection.h" -#include "TypeDef.h" -#include "Util.h" -#include "StaticData.h" - -using namespace std; - -size_t HypothesisRecombinationOrderer::s_ngramMaxOrder[NUM_FACTORS] = {0,0,0,0}; - // need to change if we add more factors, or use a macro - -void HypothesisCollection::RemoveAll() -{ - while (m_hypos.begin() != m_hypos.end()) - { - Remove(m_hypos.begin()); - } -} - -void HypothesisCollection::Add(Hypothesis *hypo) -{ - - AddNoPrune(hypo); - - if (hypo->GetTotalScore() > m_bestScore) - { - m_bestScore = hypo->GetTotalScore(); - if ( m_bestScore + m_beamThreshold > m_worstScore ) - m_worstScore = m_bestScore + m_beamThreshold; - } - - // Prune only of stack is twice as big as needed - if (m_hypos.size() > 2*m_maxHypoStackSize-10) - { - PruneToSize(m_maxHypoStackSize); - } -} - -void HypothesisCollection::AddPrune(Hypothesis *hypo) -{ // if returns false, hypothesis not used - // caller must take care to delete unused hypo to avoid leak - - if (hypo->GetTotalScore() < m_worstScore) - { // really bad score. don't bother adding hypo into collection - ObjectPool<Hypothesis> &pool = Hypothesis::GetObjectPool(); - pool.freeObject(hypo); - return; - } - - // over threshold - // recombine if ngram-equivalent to another hypo - iterator iter = m_hypos.find(hypo); - if (iter == m_hypos.end()) - { // nothing found. add to collection - Add(hypo); - return; - } - - StaticData::Instance()->GetSentenceStats().numRecombinations++; - - // found existing hypo with same target ending. - // keep the best 1 - Hypothesis *hypoExisting = *iter; - if (hypo->GetTotalScore() > hypoExisting->GetTotalScore()) - { // incoming hypo is better than the 1 we have - #ifdef N_BEST - hypo->AddArc(hypoExisting); - Detach(iter); - #else - Remove(iter); - #endif - Add(hypo); - return; - } - else - { // already storing the best hypo. discard current hypo - #ifdef N_BEST - (*iter)->AddArc(hypo); - #else - ObjectPool<Hypothesis> &pool = Hypothesis::GetObjectPool(); - pool.freeObject(hypo); - #endif - return; - } -} - -void HypothesisCollection::PruneToSize(size_t newSize) -{ - if (m_hypos.size() > newSize) - { - // Pruning alg: find a threshold and delete all hypothesis below it - // the threshold is chosen so that exactly newSize top items remain on the stack - // in fact, in situations where some of the hypothesis fell below m_beamThreshold, - // the stack will contain less items - - priority_queue<float> bestScores; - - // cerr << "About to prune from " << size() << " to " << newSize << endl; - // push all scores to a heap - // (but never push scores below m_bestScore+m_beamThreshold) - iterator iter = m_hypos.begin(); - float score = 0; - while (iter != m_hypos.end()) - { - Hypothesis *hypo = *iter; - score = hypo->GetTotalScore(); - // cerr << "H score: " << score << ", mbestscore: " << m_bestScore << " + m_beamThreshold "<< m_beamThreshold << " = " << m_bestScore+m_beamThreshold; - if (score > m_bestScore+m_beamThreshold) { - bestScores.push(score); - // cerr << " pushed."; - } - // cerr << endl; - ++iter; - } - // cerr << "Heap contains " << bestScores.size() << " items" << endl; - - // pop the top newSize scores (and ignore them, these are the scores of hyps that will remain) - // ensure to never pop beyond heap size - size_t minNewSizeHeapSize = newSize > bestScores.size() ? bestScores.size() : newSize; - for (size_t i = 1 ; i < minNewSizeHeapSize ; i++) - bestScores.pop(); - - // cerr << "Popped "<< newSize << ", heap now contains " << bestScores.size() << " items" << endl; - - // and remember the threshold - float scoreThreshold = bestScores.top(); - // cerr << "threshold: " << scoreThreshold << endl; - - // delete all hypos under score threshold - iter = m_hypos.begin(); - while (iter != m_hypos.end()) - { - Hypothesis *hypo = *iter; - float score = hypo->GetTotalScore(); - if (score < scoreThreshold) - { - iterator iterRemove = iter++; - Remove(iterRemove); - StaticData::Instance()->GetSentenceStats().numPruned++; - } - else - { - ++iter; - } - } - // cerr << "Stack size after pruning: " << size() << endl; - - // set the worstScore, so that newly generated hypotheses will not be added if worse than the worst in the stack - m_worstScore = scoreThreshold; - } -} - -const Hypothesis *HypothesisCollection::GetBestHypothesis() const -{ - if (!m_hypos.empty()) - { - const_iterator iter = m_hypos.begin(); - Hypothesis *bestHypo = *iter; - while (++iter != m_hypos.end()) - { - Hypothesis *hypo = *iter; - if (hypo->GetTotalScore() > bestHypo->GetTotalScore()) - bestHypo = hypo; - } - return bestHypo; - } - return NULL; -} - -// sorting helper -struct HypothesisSortDescending -{ - const bool operator()(const Hypothesis* hypo1, const Hypothesis* hypo2) const - { - return hypo1->GetTotalScore() > hypo2->GetTotalScore(); - } -}; - -vector<const Hypothesis*> HypothesisCollection::GetSortedList() const -{ - vector<const Hypothesis*> ret; ret.reserve(m_hypos.size()); - std::copy(m_hypos.begin(), m_hypos.end(), std::inserter(ret, ret.end())); - sort(ret.begin(), ret.end(), HypothesisSortDescending()); - - return ret; -} - - -void HypothesisCollection::InitializeArcs() -{ -#ifdef N_BEST - iterator iter; - for (iter = m_hypos.begin() ; iter != m_hypos.end() ; ++iter) - { - Hypothesis *mainHypo = *iter; - mainHypo->InitializeArcs(); - } -#endif -} - -TO_STRING_BODY(HypothesisCollection); - - -// friend -std::ostream& operator<<(std::ostream& out, const HypothesisCollection& hypoColl) -{ - HypothesisCollection::const_iterator iter; - - for (iter = hypoColl.begin() ; iter != hypoColl.end() ; ++iter) - { - const Hypothesis &hypo = **iter; - out << hypo << endl; - - } - return out; -} - diff --git a/moses/src/HypothesisCollection.h b/moses/src/HypothesisCollection.h deleted file mode 100755 index a5baea308..000000000 --- a/moses/src/HypothesisCollection.h +++ /dev/null @@ -1,174 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <limits> -#include <set> -#include "Hypothesis.h" - -#ifdef __GNUG__ -#include <ext/hash_set> -#endif - -class HypothesisRecombinationOrderer -{ -protected: - // static - static size_t s_ngramMaxOrder[NUM_FACTORS]; - -public: - bool operator()(const Hypothesis* hypoA, const Hypothesis* hypoB) const - // this function defines less-than relation on hypotheses - // the particular order is not important for us, we need just to figure out - // which hypothesis are equal based on: - // the last n-1 target words are the same - // and the covers (source words translated) are the same - { - // Are the last (n-1) words the same on the target side (n for n-gram LM)? - int ret = hypoA->NGramCompare(*hypoB); -// int ret = hypoA->FastNGramCompare(*hypoB, m_NGramMaxOrder - 1); - if (ret != 0) - { - return (ret < 0); - } - - // same last n-grams. compare source words translated - const WordsBitmap &bitmapA = hypoA->GetWordsBitmap() - , &bitmapB = hypoB->GetWordsBitmap(); - ret = bitmapA.Compare(bitmapB); - - return (ret < 0); - } - - // static - static inline void SetMaxNGramOrder(FactorType factorType, size_t ngramMaxOrder) - { - assert((size_t)factorType < NUM_FACTORS); - if (s_ngramMaxOrder[factorType] < ngramMaxOrder) - s_ngramMaxOrder[factorType] = ngramMaxOrder; - } -}; - -struct HypothesisRecombinationComparer -{ - //! returns true if hypoA can be recombined with hypoB - bool operator()(const Hypothesis* hypoA, const Hypothesis* hypoB) const - { - if (hypoA->NGramCompare(*hypoB) != 0) return false; - return (hypoA->GetWordsBitmap().Compare(hypoB->GetWordsBitmap()) == 0); - } -}; - -struct HypothesisRecombinationHasher -{ - size_t operator()(const Hypothesis* hypo) const { - return hypo->hash(); - } -}; - -class HypothesisCollection -{ -private: -#if 0 -//#ifdef __GNUG__ - typedef __gnu_cxx::hash_set< Hypothesis*, HypothesisRecombinationHasher, HypothesisRecombinationComparer > _HCType; -#else - typedef std::set< Hypothesis*, HypothesisRecombinationOrderer > _HCType; -#endif -public: - typedef _HCType::iterator iterator; - typedef _HCType::const_iterator const_iterator; - friend std::ostream& operator<<(std::ostream&, const HypothesisCollection&); - -protected: - float m_bestScore; - float m_worstScore; - float m_beamThreshold; - size_t m_maxHypoStackSize; - _HCType m_hypos; - - - void Add(Hypothesis *hypothesis); - // if returns false, hypothesis not used - // caller must take care to delete unused hypo to avoid leak - // used by Add(Hypothesis *hypothesis, float beamThreshold); - void RemoveAll(); - - inline void Detach(const HypothesisCollection::iterator &iter) - { - m_hypos.erase(iter); - } - inline void Remove(const HypothesisCollection::iterator &iter) - { - ObjectPool<Hypothesis> &pool = Hypothesis::GetObjectPool(); - pool.freeObject(*iter); - Detach(iter); - } - inline void AddNoPrune(Hypothesis *hypothesis) - { - if (!m_hypos.insert(hypothesis).second) { - } - } - -public: - const_iterator begin() const { return m_hypos.begin(); } - const_iterator end() const { return m_hypos.end(); } - size_t size() const { return m_hypos.size(); } - - inline HypothesisCollection() - { - m_bestScore = -std::numeric_limits<float>::infinity(); - m_worstScore = -std::numeric_limits<float>::infinity(); - } - - // this function will recombine hypotheses silently! There is no record - // (could affect n-best list generation...TODO) - void AddPrune(Hypothesis *hypothesis); - // AddPrune adds the hypo, but only if within thresholds (beamThr+stackSize) - - inline ~HypothesisCollection() - { - RemoveAll(); - } - inline void SetMaxHypoStackSize(size_t maxHypoStackSize) - { - m_maxHypoStackSize = maxHypoStackSize; - } - inline void SetBeamThreshold(float beamThreshold) - { - m_beamThreshold = beamThreshold; - } - inline float GetBestScore() const - { - return m_bestScore; - } - - //void Prune(); - void PruneToSize(size_t newSize); - - const Hypothesis *GetBestHypothesis() const; - std::vector<const Hypothesis*> GetSortedList() const; - void InitializeArcs(); - - TO_STRING; - -}; diff --git a/moses/src/Input.cpp b/moses/src/Input.cpp deleted file mode 100644 index 24be57c76..000000000 --- a/moses/src/Input.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "Input.h" - - -InputType::InputType(long translationId) : m_translationId(translationId) {} -InputType::~InputType() {} - -TO_STRING_BODY(InputType); - -std::ostream& operator<<(std::ostream& out,InputType const& x) -{ - x.Print(out); return out; -} diff --git a/moses/src/Input.h b/moses/src/Input.h deleted file mode 100644 index c152ba4b2..000000000 --- a/moses/src/Input.h +++ /dev/null @@ -1,52 +0,0 @@ -// $Id$ - -#ifndef INPUT_H_ -#define INPUT_H_ -#include <string> -#include "TypeDef.h" -#include "Phrase.h" -#include "TargetPhraseCollection.h" - -class WordsRange; -class Factor; -class PhraseDictionaryBase; -class TranslationOptionCollection; - -// base class for sentences and confusion networks -class InputType -{ -protected: - long m_translationId; - public: - - InputType(long translationId=0); - virtual ~InputType(); - - // for db stuff - long GetTranslationId() - { - return m_translationId; - } - void SetTranslationId(long translationId) - { // for db stuff; - m_translationId = translationId; - } - virtual size_t GetSize() const=0; - - virtual int Read(std::istream& in,const std::vector<FactorType>& factorOrder, FactorCollection &factorCollection) =0; - - virtual void Print(std::ostream&) const=0; - - virtual TargetPhraseCollection const* CreateTargetPhraseCollection(PhraseDictionaryBase const& d,const WordsRange& r) const=0; - virtual TranslationOptionCollection* CreateTranslationOptionCollection() const=0; - - virtual Phrase GetSubString(const WordsRange&) const =0; - virtual std::string GetStringRep(const WordsRange&) const=0; - virtual const FactorArray& GetFactorArray(size_t pos) const=0; - - TO_STRING; - -}; - -std::ostream& operator<<(std::ostream&,InputType const&); -#endif diff --git a/moses/src/InputFileStream.cpp b/moses/src/InputFileStream.cpp deleted file mode 100644 index d90ad24df..000000000 --- a/moses/src/InputFileStream.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include <boost/iostreams/filter/gzip.hpp> - -#if HAVE_BZIP2 -#include <boost/iostreams/filter/bzip2.hpp> -#endif - -#include "InputFileStream.h" - -InputFileStream::InputFileStream(const std::string &filePath) -{ - using namespace boost::iostreams; - - if (filePath.size() > 3 && - filePath.substr(filePath.size() - 3, 3) == ".gz") - { - m_file.open(filePath.c_str(), ios_base::in | ios_base::binary); - push(gzip_decompressor()); - } -#if HAVE_BZIP2 - else if (filePath.size() > 4 && - filePath.substr(filePath.size() - 4, 4) == ".bz2") - { - m_file.open(filePath.c_str(), ios_base::in | ios_base::binary); - push(bzip2_decompressor()); - } -#endif - else - { - m_file.open(filePath.c_str()); - } - push(m_file); -} - -void InputFileStream::Close() -{ - pop(); -} - diff --git a/moses/src/InputFileStream.h b/moses/src/InputFileStream.h deleted file mode 100644 index f2a3babc8..000000000 --- a/moses/src/InputFileStream.h +++ /dev/null @@ -1,38 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <fstream> -#include <string> -#include <boost/iostreams/filtering_stream.hpp> - -class InputFileStream : public boost::iostreams::filtering_stream<boost::iostreams::input> -{ -protected: - std::ifstream m_file; -public: - - InputFileStream(const std::string &filePath); - - void Close(); -}; - diff --git a/moses/src/InputOutput.cpp b/moses/src/InputOutput.cpp deleted file mode 100644 index 1d6b1c856..000000000 --- a/moses/src/InputOutput.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// $Id$ -#include "InputOutput.h" -#include "Input.h" - -InputOutput::InputOutput() : sentenceId(0) {} - -InputOutput::~InputOutput() {} - -void InputOutput::Release(InputType *s) {delete s;} - - -InputType* InputOutput::GetInput(InputType *inputType - , std::istream &inputStream - , const std::vector<FactorType> &factorOrder - , FactorCollection &factorCollection) -{ - if(inputType->Read(inputStream,factorOrder,factorCollection)) - { - inputType->SetTranslationId(sentenceId++); - return inputType; - } - else - { - delete inputType; - return 0; - } -} - diff --git a/moses/src/InputOutput.h b/moses/src/InputOutput.h deleted file mode 100755 index c0759a71b..000000000 --- a/moses/src/InputOutput.h +++ /dev/null @@ -1,52 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <string> -#include <iostream> -#include <vector> -#include "TypeDef.h" - -class Hypothesis; -class LatticePathList; -class FactorCollection; -class InputType; - -class InputOutput -{ - protected: - long sentenceId; - public: - InputOutput(); - virtual InputType* GetInput(InputType*) = 0; - virtual void SetOutput(const Hypothesis *hypo, long translationId, bool reportSourceSpan, bool reportAllFactors) = 0; - virtual void SetNBest(const LatticePathList &nBestList, long translationId) = 0; - virtual ~InputOutput(); - virtual void Release(InputType*); - void ResetSentenceId() { sentenceId = 0; } - - protected: - InputType* GetInput(InputType * inputType - , std::istream &inputStream - , const std::vector<FactorType> &factorOrder - , FactorCollection &factorCollection); -}; diff --git a/moses/src/LMList.cpp b/moses/src/LMList.cpp deleted file mode 100644 index 1c7cf0191..000000000 --- a/moses/src/LMList.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include "LMList.h" -#include "Phrase.h" -#include "ScoreComponentCollection.h" - -using namespace std; - -void LMList::CalcScore(const Phrase &phrase, float &retFullScore, float &retNGramScore, ScoreComponentCollection2* breakdown) const -{ - const_iterator lmIter; - for (lmIter = begin(); lmIter != end(); ++lmIter) - { - const LanguageModel &lm = **lmIter; - const float weightLM = lm.GetWeight(); - - float fullScore, nGramScore; - - lm.CalcScore(phrase, fullScore, nGramScore); - - #ifdef N_BEST - breakdown->Assign(&lm, nGramScore); // I'm not sure why += doesn't work here- it should be 0.0 right? - #endif - - retFullScore += fullScore * weightLM; - retNGramScore += nGramScore * weightLM; - } -} diff --git a/moses/src/LMList.h b/moses/src/LMList.h deleted file mode 100644 index f54121fad..000000000 --- a/moses/src/LMList.h +++ /dev/null @@ -1,16 +0,0 @@ - -#pragma once - -#include <list> -#include "LanguageModel.h" - -class Phrase; -class ScoreColl; -class ScoreComponentCollection2; - -class LMList : public std::list < LanguageModel* > -{ -public: - void CalcScore(const Phrase &phrase, float &retFullScore, float &retNGramScore, ScoreComponentCollection2* breakdown) const; - -}; diff --git a/moses/src/LanguageModel.cpp b/moses/src/LanguageModel.cpp deleted file mode 100755 index df3f92d97..000000000 --- a/moses/src/LanguageModel.cpp +++ /dev/null @@ -1,125 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include <cassert> -#include <limits> -#include <iostream> -#include <sstream> - -#include "NGramNode.h" - -#include "LanguageModel.h" -#include "TypeDef.h" -#include "Util.h" -#include "FactorCollection.h" -#include "Phrase.h" -#include "StaticData.h" - -using namespace std; - -// static variable init -LanguageModel::State LanguageModel::UnknownState=0; - -LanguageModel::LanguageModel() -{ - const_cast<ScoreIndexManager&>(StaticData::Instance()->GetScoreIndexManager()).AddScoreProducer(this); -} -LanguageModel::~LanguageModel() {} - -// don't inline virtual funcs... -unsigned int LanguageModel::GetNumScoreComponents() const -{ - return 1; -} - -const std::string LanguageModel::GetScoreProducerDescription() const -{ - std::ostringstream oss; - // what about LMs that are over multiple factors at once, POS + stem, for example? - oss << m_nGramOrder << "-gram LM score, factor-type=" << GetFactorType() << ", file=" << m_filename; - return oss.str(); -} - -/*** - * ngramComponent should be an invalid pointer iff n-best ranking is turned off - */ -void LanguageModel::CalcScore(const Phrase &phrase - , float &fullScore - , float &ngramScore) const -{ - fullScore = 0; - ngramScore = 0; - FactorType factorType = GetFactorType(); - - size_t phraseSize = phrase.GetSize(); - vector<const Factor*> contextFactor; - contextFactor.reserve(m_nGramOrder); - -#undef CDYER_DEBUG_LMSCORE -#ifdef CDYER_DEBUG_LMSCORE - std::cout<<"LM::CalcScore(" << phrase << "):\n"; -#endif - - // start of sentence - for (size_t currPos = 0 ; currPos < m_nGramOrder - 1 && currPos < phraseSize ; currPos++) - { - contextFactor.push_back(phrase.GetFactor(currPos, factorType)); -#ifdef CDYER_DEBUG_LMSCORE - float score = GetValue(contextFactor); - std::cout << "\t" << currPos << ": " << score << std::endl; -#endif - fullScore += GetValue(contextFactor); - } - - if (phraseSize >= m_nGramOrder) - { - contextFactor.push_back(phrase.GetFactor(m_nGramOrder - 1, factorType)); - ngramScore = GetValue(contextFactor); -#ifdef CDYER_DEBUG_LMSCORE - std::cout << "\t" << m_nGramOrder-1 << " " << ngramScore << " (first full ngram)" << std::endl; -#endif - } - - // main loop - for (size_t currPos = m_nGramOrder; currPos < phraseSize ; currPos++) - { // used by hypo to speed up lm score calc - for (size_t currNGramOrder = 0 ; currNGramOrder < m_nGramOrder - 1 ; currNGramOrder++) - { - contextFactor[currNGramOrder] = contextFactor[currNGramOrder + 1]; - } - contextFactor[m_nGramOrder - 1] = phrase.GetFactor(currPos, factorType); - float partScore = GetValue(contextFactor); -#ifdef CDYER_DEBUG_LMSCORE - std::cout << "\t" << currPos << " " << partScore << " (full ngram)" << std::endl; -#endif - - ngramScore += partScore; - } - fullScore += ngramScore; -} - -LanguageModel::State LanguageModel::GetState(const std::vector<const Factor*> &contextFactor) const -{ - State state; - GetValue(contextFactor,&state); - return state; -} - diff --git a/moses/src/LanguageModel.h b/moses/src/LanguageModel.h deleted file mode 100755 index 93a2ecbfc..000000000 --- a/moses/src/LanguageModel.h +++ /dev/null @@ -1,97 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <string> -#include <vector> -#include "Factor.h" -#include "TypeDef.h" -#include "Util.h" -#include "ScoreProducer.h" - -class FactorCollection; -class Factor; -class Phrase; - -class LanguageModel : public ScoreProducer -{ -protected: - const Factor *m_sentenceStart, *m_sentenceEnd; - FactorType m_factorType; - float m_weight; - size_t m_nGramOrder; - std::string m_filename; -public: - typedef const void* State; - static State UnknownState; - - LanguageModel(); - virtual ~LanguageModel(); - virtual void Load(const std::string &fileName - , FactorCollection &factorCollection - , FactorType factorType - , float weight - , size_t nGramOrder) = 0; - - // see ScoreProducer.h - unsigned int GetNumScoreComponents() const; - - size_t GetNGramOrder() const - { - return m_nGramOrder; - } - const Factor *GetSentenceStart() const - { - return m_sentenceStart; - } - const Factor *GetSentenceEnd() const - { - return m_sentenceEnd; - } - /*** - * ngramComponent should be an invalid pointer iff n-best ranking is turned off - */ - void CalcScore(const Phrase &phrase - , float &fullScore - , float &ngramScore) const; - FactorType GetFactorType() const - { - return m_factorType; - } - float GetWeight() const - { - return m_weight; - } - void SetWeight(float weight) - { - m_weight = weight; - } - virtual const std::string GetScoreProducerDescription() const; - virtual float GetValue(const std::vector<const Factor*> &contextFactor, State* finalState = 0) const = 0; - - LanguageModel::State GetState(const std::vector<const Factor*> &contextFactor) const; - - // one of the following should probably be made available - // virtual LmId GetLmID( const Factor *factor ) const = 0; - // virtual LmId GetLmID( const std::string &factor ) const = 0; -}; - diff --git a/moses/src/LanguageModelFactory.cpp b/moses/src/LanguageModelFactory.cpp deleted file mode 100644 index 9e1d1e7db..000000000 --- a/moses/src/LanguageModelFactory.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// $Id$ - -#include "LanguageModelFactory.h" -#include "TypeDef.h" - -// include appropriate header -#ifdef LM_SRI -# include "LanguageModel_SRI.h" -#else -# ifdef LM_IRST -# include "LanguageModel_IRST.h" -# else -# include "LanguageModel_Internal.h" -# endif -#endif - - -namespace LanguageModelFactory -{ - - LanguageModel* createLanguageModel() - { - LanguageModel *lm = 0; -#ifdef LM_SRI - lm = new LanguageModel_SRI(); -#else -# ifdef LM_IRST - lm = new LanguageModel_IRST(); -# else - lm = new LanguageModel_Internal(); -# endif -#endif - return lm; - } - -} diff --git a/moses/src/LanguageModelFactory.h b/moses/src/LanguageModelFactory.h deleted file mode 100644 index 5c0709b55..000000000 --- a/moses/src/LanguageModelFactory.h +++ /dev/null @@ -1,18 +0,0 @@ -// $Id$ - -#ifndef _LANGUAGE_MODEL_FACTORY_H_ -#define _LANGUAGE_MODEL_FACTORY_H_ - -class LanguageModel; - -namespace LanguageModelFactory { - - /** - * creates a language model that will use the appropriate - * language model toolkit as its underlying implementation - */ - LanguageModel* createLanguageModel(); - -}; - -#endif diff --git a/moses/src/LanguageModel_IRST.cpp b/moses/src/LanguageModel_IRST.cpp deleted file mode 100755 index fac11aa43..000000000 --- a/moses/src/LanguageModel_IRST.cpp +++ /dev/null @@ -1,147 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include <assert.h> -#include <limits> -#include <iostream> -#include <fstream> - -#include "ngram.h" -#include "lmtable.h" -#include "dictionary.h" - -#include "LanguageModel_IRST.h" -#include "TypeDef.h" -#include "Util.h" -#include "FactorCollection.h" -#include "Phrase.h" -#include "InputFileStream.h" - -using namespace std; - -LanguageModel_IRST::LanguageModel_IRST() -:m_lmtb(0) -{ -} - -LanguageModel_IRST::~LanguageModel_IRST() -{ - delete m_lmtb; -} - - -void LanguageModel_IRST::Load(const std::string &fileName - , FactorCollection &factorCollection - , FactorType factorType - , float weight - , size_t nGramOrder) -{ - m_factorType = factorType; - m_weight = weight; - m_nGramOrder = nGramOrder; - m_filename = fileName; - - InputFileStream inp(fileName); - - - - m_lmtb = new lmtable(inp); - - // LM can be ok, just outputs warnings - CreateFactors(factorCollection); - m_unknownId = m_lmtb->dict->oovcode(); - std::cerr << "IRST: m_unknownId=" << m_unknownId << std::endl; -} - -void LanguageModel_IRST::CreateFactors(FactorCollection &factorCollection) -{ // add factors which have srilm id - // code copied & paste from SRI LM class. should do template function - std::map<size_t, int> lmIdMap; - size_t maxFactorId = 0; // to create lookup vector later on - - dict_entry *entry; - dictionary_iter iter(m_lmtb->dict); - while ( (entry = iter.next()) != NULL) - { - size_t factorId = factorCollection.AddFactor(Output, m_factorType, entry->word)->GetId(); - lmIdMap[factorId] = entry->code; - maxFactorId = (factorId > maxFactorId) ? factorId : maxFactorId; - } - - int lmId; - size_t factorId; - - lmId = GetLmID(BOS_); - m_sentenceStart = factorCollection.AddFactor(Output, m_factorType, SENTENCE_START); - factorId = m_sentenceStart->GetId(); - lmIdMap[factorId] = lmId; - - lmId = GetLmID(EOS_); - m_sentenceEnd = factorCollection.AddFactor(Output, m_factorType, SENTENCE_END); - factorId = m_sentenceEnd->GetId(); - lmIdMap[factorId] = lmId; - - // add to lookup vector in object - m_lmIdLookup.resize(maxFactorId+1); - - fill(m_lmIdLookup.begin(), m_lmIdLookup.end(), m_unknownId); - - map<size_t, int>::iterator iterMap; - for (iterMap = lmIdMap.begin() ; iterMap != lmIdMap.end() ; ++iterMap) - { - m_lmIdLookup[iterMap->first] = iterMap->second; - } - -} - -int LanguageModel_IRST::GetLmID( const std::string &str ) const -{ - return m_lmtb->dict->encode( str.c_str() ); -} -int LanguageModel_IRST::GetLmID( const Factor *factor ) const -{ - size_t factorId = factor->GetId(); - return ( factorId >= m_lmIdLookup.size()) ? m_unknownId : m_lmIdLookup[factorId]; -} - -float LanguageModel_IRST::GetValue(const vector<const Factor*> &contextFactor, State* finalState) const -{ - // set up context - size_t count = contextFactor.size(); - ngram ng(m_lmtb->dict); - for (size_t i = 0 ; i < count ; i++) - { -#undef CDYER_DEBUG_LMSCORE -#ifdef CDYER_DEBUG_LMSCORE - std::cout << i <<"="<<contextFactor[i]->GetLmId().irst <<"," << contextFactor[i]->GetString()<<" "; -#endif - int lmId = GetLmID(contextFactor[i]); - ng.pushc(lmId); - } -#ifdef CDYER_DEBUG_LMSCORE - std::cout <<" (ng='" << ng << "')\n"; -#endif - if (finalState) { - assert("!LM State needs to be implemented!"); - } - return TransformScore(m_lmtb->prob(ng)); -} - diff --git a/moses/src/LanguageModel_IRST.h b/moses/src/LanguageModel_IRST.h deleted file mode 100755 index 60f52113a..000000000 --- a/moses/src/LanguageModel_IRST.h +++ /dev/null @@ -1,63 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <string> -#include <vector> -#include "Factor.h" -#include "TypeDef.h" -#include "Util.h" - -#include "LanguageModel.h" - -class FactorCollection; -class Factor; -class Phrase; - -class lmtable; // irst lm table -class ngram; - -class LanguageModel_IRST : public LanguageModel -{ -protected: - std::vector<int> m_lmIdLookup; - lmtable* m_lmtb; - int m_unknownId; - -// float GetValue(LmId wordId, ngram *context) const; - - void CreateFactors(FactorCollection &factorCollection); - int GetLmID( const std::string &str ) const; - int GetLmID( const Factor *factor ) const; -public: - LanguageModel_IRST(); - ~LanguageModel_IRST(); - void Load(const std::string &fileName - , FactorCollection &factorCollection - , FactorType factorType - , float weight - , size_t nGramOrder); - - virtual float GetValue(const std::vector<const Factor*> &contextFactor, State* finalState = 0) const; - -}; - diff --git a/moses/src/LanguageModel_SRI.cpp b/moses/src/LanguageModel_SRI.cpp deleted file mode 100755 index 250ac79e1..000000000 --- a/moses/src/LanguageModel_SRI.cpp +++ /dev/null @@ -1,159 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include <assert.h> -#include <limits> -#include <iostream> -#include <fstream> - -#include "Ngram.h" -#include "Vocab.h" - -#include "LanguageModel_SRI.h" -#include "TypeDef.h" -#include "Util.h" -#include "FactorCollection.h" -#include "Phrase.h" - -using namespace std; - -LanguageModel_SRI::LanguageModel_SRI() -:m_srilmVocab(0) -,m_srilmModel(0) -{ -} - -LanguageModel_SRI::~LanguageModel_SRI() -{ - delete m_srilmModel; - delete m_srilmVocab; -} - -void LanguageModel_SRI::Load(const std::string &fileName - , FactorCollection &factorCollection - , FactorType factorType - , float weight - , size_t nGramOrder) -{ - m_srilmVocab = new Vocab(); - m_srilmModel = new Ngram(*m_srilmVocab, nGramOrder); - m_factorType = factorType; - m_weight = weight; - m_nGramOrder = nGramOrder; - m_filename = fileName; - - m_srilmModel->skipOOVs() = false; - - File file( fileName.c_str(), "r" ); - if (m_srilmModel->read(file)) - { - } - else - { - TRACE_ERR("warning/failed loading language model" << endl); - } - // LM can be ok, just outputs warnings - CreateFactors(factorCollection); - m_unknownId = m_srilmVocab->unkIndex(); -} - -void LanguageModel_SRI::CreateFactors(FactorCollection &factorCollection) -{ // add factors which have srilm id - - std::map<size_t, VocabIndex> lmIdMap; - size_t maxFactorId = 0; // to create lookup vector later on - - VocabString str; - VocabIter iter(*m_srilmVocab); - while ( (str = iter.next()) != NULL) - { - VocabIndex lmId = GetLmID(str); - size_t factorId = factorCollection.AddFactor(Output, m_factorType, str)->GetId(); - lmIdMap[factorId] = lmId; - maxFactorId = (factorId > maxFactorId) ? factorId : maxFactorId; - } - - size_t factorId; - - m_sentenceStart = factorCollection.AddFactor(Output, m_factorType, SENTENCE_START); - factorId = m_sentenceStart->GetId(); - lmIdMap[factorId] = GetLmID(SENTENCE_START); - maxFactorId = (factorId > maxFactorId) ? factorId : maxFactorId; - - m_sentenceEnd = factorCollection.AddFactor(Output, m_factorType, SENTENCE_END); - factorId = m_sentenceEnd->GetId(); - lmIdMap[factorId] = GetLmID(SENTENCE_END); - maxFactorId = (factorId > maxFactorId) ? factorId : maxFactorId; - - // add to lookup vector in object - m_lmIdLookup.resize(maxFactorId+1); - - fill(m_lmIdLookup.begin(), m_lmIdLookup.end(), m_unknownId); - - map<size_t, VocabIndex>::iterator iterMap; - for (iterMap = lmIdMap.begin() ; iterMap != lmIdMap.end() ; ++iterMap) - { - m_lmIdLookup[iterMap->first] = iterMap->second; - } -} - -VocabIndex LanguageModel_SRI::GetLmID( const std::string &str ) const -{ - return m_srilmVocab->getIndex( str.c_str(), m_unknownId ); -} -VocabIndex LanguageModel_SRI::GetLmID( const Factor *factor ) const -{ - size_t factorId = factor->GetId(); - return ( factorId >= m_lmIdLookup.size()) ? m_unknownId : m_lmIdLookup[factorId]; -} - -float LanguageModel_SRI::GetValue(VocabIndex wordId, VocabIndex *context) const -{ - float p = m_srilmModel->wordProb( wordId, context ); - return FloorSRIScore(TransformSRIScore(p)); // log10->log -} - -float LanguageModel_SRI::GetValue(const vector<const Factor*> &contextFactor, State* finalState) const -{ - // set up context - VocabIndex context[MAX_NGRAM_SIZE]; - size_t count = contextFactor.size(); - for (size_t i = 0 ; i < count - 1 ; i++) - { - context[i] = GetLmID(contextFactor[count-2-i]); - } - context[count-1] = Vocab_None; - - // call sri lm fn - VocabIndex lmId= GetLmID(contextFactor[count-1]); - float ret = GetValue(lmId, context); - - if (finalState) { - for (int i = count - 2 ; i >= 0 ; i--) - context[i+1] = context[i]; - context[0] = lmId; - unsigned int len; - *finalState = m_srilmModel->contextID(context,len); - } - return ret; -} - - diff --git a/moses/src/LanguageModel_SRI.h b/moses/src/LanguageModel_SRI.h deleted file mode 100755 index 6014fb032..000000000 --- a/moses/src/LanguageModel_SRI.h +++ /dev/null @@ -1,61 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <string> -#include <vector> -#include "Factor.h" -#include "TypeDef.h" -#include "Vocab.h" -#include "LanguageModel.h" - - -class FactorCollection; -class Factor; -class Phrase; -class Ngram; // SRI forward decl - -class LanguageModel_SRI : public LanguageModel -{ -protected: - std::vector<VocabIndex> m_lmIdLookup; - Vocab *m_srilmVocab; - Ngram *m_srilmModel; - VocabIndex m_unknownId; - - float GetValue(VocabIndex wordId, VocabIndex *context) const; - void CreateFactors(FactorCollection &factorCollection); - VocabIndex GetLmID( const std::string &str ) const; - VocabIndex GetLmID( const Factor *factor ) const; - -public: - LanguageModel_SRI(); - ~LanguageModel_SRI(); - void Load(const std::string &fileName - , FactorCollection &factorCollection - , FactorType factorType - , float weight - , size_t nGramOrder); - - virtual float GetValue(const std::vector<const Factor*> &contextFactor, State* finalState = 0) const; -}; - diff --git a/moses/src/LatticePath.cpp b/moses/src/LatticePath.cpp deleted file mode 100755 index 072f5d29f..000000000 --- a/moses/src/LatticePath.cpp +++ /dev/null @@ -1,139 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include "LatticePath.h" -#include "LatticePathCollection.h" - -using namespace std; - -LatticePath::LatticePath(const Hypothesis *hypo) -: m_prevEdgeChanged(NOT_FOUND) -{ // create path OF pure hypo - m_scoreBreakdown = hypo->GetScoreBreakdown(); - m_totalScore = hypo->GetTotalScore(); - - // enumerate path using prevHypo - while (hypo != NULL) - { - m_path.push_back(hypo); - hypo = hypo->GetPrevHypo(); - } -} - -LatticePath::LatticePath(const LatticePath ©, size_t edgeIndex, const Hypothesis *arc) -:m_prevEdgeChanged(edgeIndex) -{ - for (size_t currEdge = 0 ; currEdge < edgeIndex ; currEdge++) - { // copy path from parent - m_path.push_back(copy.m_path[currEdge]); - } - - // 1 deviation - m_path.push_back(arc); - - // rest of path comes from the deviation - const Hypothesis *prevHypo = arc->GetPrevHypo(); - while (prevHypo != NULL) - { - m_path.push_back(prevHypo); - prevHypo = prevHypo->GetPrevHypo(); - } - - CalcScore(copy, edgeIndex, arc); -} - -LatticePath::LatticePath(const LatticePath ©, size_t edgeIndex, const Hypothesis *arc, bool /*reserve*/) -:m_path(copy.m_path) -,m_prevEdgeChanged(edgeIndex) -{ - // 1 deviation - m_path[edgeIndex] = arc; - - CalcScore(copy, edgeIndex, arc); -} - -void LatticePath::CalcScore(const LatticePath ©, size_t edgeIndex, const Hypothesis *arc) -{ -#ifdef N_BEST - ScoreComponentCollection2 adj = arc->GetScoreBreakdown(); - adj.MinusEquals(copy.m_path[edgeIndex]->GetScoreBreakdown()); - m_scoreBreakdown = copy.m_scoreBreakdown; - m_scoreBreakdown.PlusEquals(adj); - - float fadj = arc->GetTotalScore() - copy.m_path[edgeIndex]->GetTotalScore(); - m_totalScore = copy.GetTotalScore() + fadj; -#endif -} - -#ifdef N_BEST -void LatticePath::CreateDeviantPaths(LatticePathCollection &pathColl) const -{ - const size_t sizePath = m_path.size(); - - if (m_prevEdgeChanged == NOT_FOUND) - { // initial enumration from a pure hypo - for (size_t currEdge = 0 ; currEdge < sizePath ; currEdge++) - { - const Hypothesis *hypo = static_cast<const Hypothesis*>(m_path[currEdge]); - const ArcList *pAL = hypo->GetArcList(); - if (!pAL) continue; - const ArcList &arcList = *pAL; - - // every possible Arc to replace this edge - ArcList::const_iterator iterArc; - for (iterArc = arcList.begin() ; iterArc != arcList.end() ; ++iterArc) - { - const Hypothesis *arc = *iterArc; - LatticePath *deviantPath = new LatticePath(*this, currEdge, arc); - pathColl.insert(deviantPath); - } - } - } - else - { // wiggle 1 of the edges only - for (size_t currEdge = 0 ; currEdge < sizePath ; currEdge++) - { - if (currEdge != m_prevEdgeChanged) - { - const Hypothesis *edgeOrig = m_path[currEdge]; - const ArcList *pAL = m_path[currEdge]->GetArcList(); - if (!pAL) continue; - const ArcList &arcList = *pAL; - ArcList::const_iterator iterArc; - - for (iterArc = arcList.begin() ; iterArc != arcList.end() ; ++iterArc) - { // copy this Path & change 1 edge - const Hypothesis *arcReplace = *iterArc; - - if (arcReplace != edgeOrig && arcReplace->GetPrevHypo() == edgeOrig->GetPrevHypo()) - { - LatticePath *deviantPath = new LatticePath(*this, currEdge, arcReplace, true); - pathColl.insert(deviantPath); - } - } - } - } - } -} -#endif - -TO_STRING_BODY(LatticePath); - diff --git a/moses/src/LatticePath.h b/moses/src/LatticePath.h deleted file mode 100755 index 3fed4440f..000000000 --- a/moses/src/LatticePath.h +++ /dev/null @@ -1,100 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <iostream> -#include <vector> -#include <limits> -#include "Hypothesis.h" -#include "TypeDef.h" - -class LatticePathCollection; - -class LatticePath -{ - friend std::ostream& operator<<(std::ostream&, const LatticePath&); - -protected: - std::vector<const Hypothesis *> m_path; - size_t m_prevEdgeChanged; - - ScoreComponentCollection2 m_scoreBreakdown; - float m_totalScore; - - void CalcScore(const LatticePath ©, size_t edgeIndex, const Hypothesis *arc); - -public: - LatticePath(); // not implemented - - LatticePath(const Hypothesis *hypo); - // create path OF pure hypo - LatticePath(const LatticePath ©, size_t edgeIndex, const Hypothesis *arc); - // create path FROM pure hypo - // deviate from edgeIndex backwards - LatticePath(const LatticePath ©, size_t edgeIndex, const Hypothesis *arc, bool reserve); - // create path from ANY hypo - // reserve arg not used. to differential from other constructor - // deviate from edgeIndex. however, all other edges the same - - inline float GetTotalScore() const { return m_totalScore; } - - inline const std::vector<const Hypothesis *> &GetEdges() const - { - return m_path; - } - - inline bool IsPurePath() const - { - return m_prevEdgeChanged == NOT_FOUND; - } - -#ifdef N_BEST - void CreateDeviantPaths(LatticePathCollection &pathColl) const; - - inline const ScoreComponentCollection2 &GetScoreBreakdown() const - { - return m_scoreBreakdown; - } - -#endif - - TO_STRING; - -}; - -// friend -inline std::ostream& operator<<(std::ostream& out, const LatticePath& path) -{ - const size_t sizePath = path.m_path.size(); - for (int pos = (int) sizePath - 1 ; pos >= 0 ; pos--) - { - const Hypothesis *edge = path.m_path[pos]; - out << *edge; - } - // scores - out << " total=" << path.GetTotalScore(); -#ifdef N_BEST - out << " " << path.GetScoreBreakdown(); -#endif - - return out; -} diff --git a/moses/src/LatticePathCollection.h b/moses/src/LatticePathCollection.h deleted file mode 100755 index 74fddb3b8..000000000 --- a/moses/src/LatticePathCollection.h +++ /dev/null @@ -1,56 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <set> -#include <iostream> - -struct CompareLatticePathCollection -{ - bool operator()(const LatticePath* pathA, const LatticePath* pathB) const - { - return (pathA->GetTotalScore() > pathB->GetTotalScore()); - } -}; - -class LatticePathCollection : public std::multiset<LatticePath*, CompareLatticePathCollection> -{ -public: - ~LatticePathCollection() - { - // clean up - RemoveAllInColl<LatticePathCollection::iterator> (*this); - } -}; - -inline std::ostream& operator<<(std::ostream& out, const LatticePathCollection& pathColl) -{ - LatticePathCollection::const_iterator iter; - - for (iter = pathColl.begin() ; iter != pathColl.end() ; ++iter) - { - const LatticePath &path = **iter; - out << path << std::endl; - } - return out; -} - diff --git a/moses/src/LatticePathList.h b/moses/src/LatticePathList.h deleted file mode 100755 index 0e9a6bc22..000000000 --- a/moses/src/LatticePathList.h +++ /dev/null @@ -1,43 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <list> -#include "LatticePath.h" - - -class LatticePathList : public std::list<const LatticePath*> -{ - -public: - ~LatticePathList() - { - // clean up - LatticePathList::iterator iter; - for (iter = begin() ; iter != end() ; ++iter) - { - delete *iter; - } - clear(); - } -}; - diff --git a/moses/src/LexicalReordering.cpp b/moses/src/LexicalReordering.cpp deleted file mode 100755 index 347007e0c..000000000 --- a/moses/src/LexicalReordering.cpp +++ /dev/null @@ -1,217 +0,0 @@ -// $Id$ - -#include <iostream> -#include <limits> -#include <assert.h> -#include <vector> -#include "LexicalReordering.h" -#include "InputFileStream.h" -#include "DistortionOrientation.h" -#include "StaticData.h" - -using namespace std; - -/* - * Load the file pointed to by filename; set up the table according to - * the orientation and condition parameters. Direction will be used - * later for computing the score. - */ -LexicalReordering::LexicalReordering(const std::string &filename, - int orientation, int direction, - int condition, const std::vector<float>& weights) : - m_orientation(orientation), m_condition(condition), m_filename(filename), m_numberscores(weights.size()) -{ - //add score producer - const_cast<ScoreIndexManager&>(StaticData::Instance()->GetScoreIndexManager()).AddScoreProducer(this); - //manage the weights by SetWeightsForScoreProducer method of static data. - if(direction == LexReorderType::Bidirectional) - { - m_direction.push_back(LexReorderType::Forward); - m_direction.push_back(LexReorderType::Backward); - } - else - { - m_direction.push_back(direction); - } - const_cast<StaticData*>(StaticData::Instance())->SetWeightsForScoreProducer(this, weights); - // Load the file - LoadFile(); - PrintTable(); -} - - -/* - * Loads the file into a map. - */ -void LexicalReordering::LoadFile() -{ - InputFileStream inFile(m_filename); - string line = "", key = ""; - while (getline(inFile,line)) - { - vector<string> tokens = TokenizeMultiCharSeparator(line , "|||"); - string f = "", e = ""; - // For storing read-in probabilities. - vector<float> probs; - if (m_condition == LexReorderType::Fe) - { - f = tokens[FE_FOREIGN]; - e = tokens[FE_ENGLISH]; - // if condition is "fe", then concatenate the first two tokens - // to make a single token - key = f + "|||" + e; - probs = Scan<float>(Tokenize(tokens[FE_PROBS])); - } - else - { - // otherwise, key is just foreign - f = tokens[F_FOREIGN]; - key = f; - probs = Scan<float>(Tokenize(tokens[F_PROBS])); - } - if (m_orientation == DistortionOrientationType::Monotone) - { - assert(probs.size() == MONO_NUM_PROBS); // 2 backward, 2 forward - } - else - { - assert(probs.size() == MSD_NUM_PROBS); // 3 backward, 3 forward - } - m_orientation_table[key] = probs; - } - inFile.Close(); -} - -/* - * Print the table in a readable format. - */ -void LexicalReordering::PrintTable() -{ - // iterate over map - map<string, vector<float> >::iterator table_iter = - m_orientation_table.begin(); - while (table_iter != m_orientation_table.end()) - { - // print key - cout << table_iter->first << " ||| "; - // print values - vector<float> val = table_iter->second; - int i=0, num_probs = val.size(); - while (i<num_probs-1) - { - cout << val[i] << " "; - i++; - } - cout << val[i] << endl; - table_iter++; - } -} - -std::vector<float> LexicalReordering::CalcScore(Hypothesis *hypothesis) -{ - std::vector<float> score(m_numberscores, 0); - vector<float> val; - for(int i=0; i < m_direction.size(); i++) - { - int direction = m_direction[i]; - int orientation = DistortionOrientation::GetOrientation(hypothesis, direction); - if(m_condition==LexReorderType::Fe) - { - //this key string is be F+'|||'+E from the hypothesis - val=m_orientation_table[hypothesis->GetSourcePhrase().GetStringRep(hypothesis->GetCurrSourceWordsRange()) - +"|||" - +hypothesis->GetTargetPhrase().GetStringRep(hypothesis->GetCurrTargetWordsRange())]; - - } - else - { - //this key string is F from the hypothesis - val=m_orientation_table[hypothesis->GetTargetPhrase().GetStringRep(hypothesis->GetCurrTargetWordsRange())]; - } - //the forward_offset is only applicable if we have a bidirectional model - //as the forward weights/scores come after the backward in this model, we need to offset by this amount. - int forward_offset = 0; - //we know we have a bidirectional model if the number of scores is 4 or 6, not 2 or 3. - if(m_numberscores==4) - { - forward_offset=2; - } - else if(m_numberscores==6) - { - forward_offset=3; - } - if(m_orientation==DistortionOrientationType::Msd) - { - if(direction==LexReorderType::Backward) - { - if(orientation==DistortionOrientationType::MONO) - { - score[BACK_M] = val[BACK_M]; - } - else if(orientation==DistortionOrientationType::SWAP) - { - score[BACK_S] = val[BACK_S]; - } - else - { - score[BACK_D] = val[BACK_D]; - } - - } - else - { - if(orientation==DistortionOrientationType::MONO) - { - score[FOR_M+forward_offset] = val[FOR_M+forward_offset]; - } - else if(orientation==DistortionOrientationType::SWAP) - { - score[FOR_S+forward_offset] = val[FOR_S+forward_offset]; - } - else - { - score[FOR_D+forward_offset] = val[FOR_D+forward_offset]; - } - } - } - else - { - if(direction==LexReorderType::Backward) - { - if(orientation==DistortionOrientationType::MONO) - { - score[BACK_MONO] = val[BACK_MONO]; - } - else - { - score[BACK_NONMONO] = val[BACK_NONMONO]; - } - } - else - { - if(orientation==DistortionOrientationType::MONO) - { - score[FOR_MONO+forward_offset] = val[FOR_MONO+forward_offset]; - } - else - { - score[FOR_NONMONO+forward_offset] = val[FOR_NONMONO+forward_offset]; - } - } - } - - } - return score; -} - - -unsigned int LexicalReordering::GetNumScoreComponents() const -{ - return m_numberscores; -} - -const std::string LexicalReordering::GetScoreProducerDescription() const -{ - return "Lexicalized reordering score, file=" + m_filename; -} - diff --git a/moses/src/LexicalReordering.h b/moses/src/LexicalReordering.h deleted file mode 100755 index 20d97538f..000000000 --- a/moses/src/LexicalReordering.h +++ /dev/null @@ -1,112 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <string> -#include <vector> -#include <map> -#include "Factor.h" -#include "Phrase.h" -#include "TypeDef.h" -#include "Util.h" -#include "WordsRange.h" -#include "ScoreProducer.h" - -class FactorCollection; -class Factor; -class Phrase; -class Hypothesis; - - -/*** - * The LexicalReordering class handles everything involved with - * lexical reordering. It loads a probability table P(orientation|f,e) - * and computes scores in either forward, backward, or bidirectional - * direction. - */ - -class LexicalReordering : public ScoreProducer -{ - -private: - - // Members - typedef std::map<std::string, std::vector<float> > ORIENTATION_TABLE; - - // This is the order in which the different forward/backward - // probabilities are stored in the table. - enum TableLookupMsd { BACK_M, BACK_S, BACK_D, FOR_M,FOR_S, FOR_D }; - enum TableLookupMonotone { BACK_MONO, BACK_NONMONO, FOR_MONO, FOR_NONMONO}; - - // This is the order in which pieces appear in the orientation table - // when conditioning on f and e. - enum FEFileFormat { FE_FOREIGN, FE_ENGLISH, FE_PROBS }; - - // This is the order in which pieces appear in the orientation table - // when conditioning on f only. - enum FFileFormat { F_FOREIGN, F_PROBS }; - - // different numbers of probabilities for different ranges of - // orientation variable - static const int MSD_NUM_PROBS = 6; - static const int MONO_NUM_PROBS = 4; - - int m_orientation; // msd or monotone - std::vector<int> m_direction; // contains forward, backward, or both (bidirectional) - int m_condition; // fe or f - int m_numberscores; //2, 3, 4 or 6 - std::string m_filename; // probability table location - - ORIENTATION_TABLE m_orientation_table; // probability table - - // Functions - void LoadFile(void); - -public: - // Constructor: takes 3 arguments -- filename is the path to the - // orientation probability table, orientation is one of {MSD, MONO}, - // direction is one of {FOR,BACK,BI}, and condition is one of {F,FE}. - LexicalReordering(const std::string &filename, int orientation, int direction, - int condition, const std::vector<float>& weights); - - // Descructor - ~LexicalReordering(void) {} - - // Compute and return a score for a hypothesis - std::vector<float> CalcScore(Hypothesis *curr_hypothesis); - - // Print the orientation probability table - void PrintTable(void); - - void SetForwardWeight(float weight); - - void SetBackwardWeight(float weight); - - float GetForwardWeight(void); - - float GetBackwardWeight(void); - - float GetProbability(Hypothesis *hypothesis, int orientation); - - unsigned int GetNumScoreComponents() const; - const std::string GetScoreProducerDescription() const; -}; diff --git a/moses/src/Makefile.am b/moses/src/Makefile.am deleted file mode 100644 index 0735b9dd1..000000000 --- a/moses/src/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -lib_LIBRARIES = libmoses.a -AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -libmoses_a_SOURCES = \ - ConfusionNet.cpp \ - Dictionary.cpp \ - DistortionOrientation.cpp \ - DummyScoreProducers.cpp \ - Factor.cpp \ - FactorCollection.cpp \ - FactorTypeSet.cpp \ - GenerationDictionary.cpp \ - hash.cpp \ - Hypothesis.cpp \ - HypothesisCollection.cpp \ - Input.cpp \ - InputFileStream.cpp \ - InputOutput.cpp \ - LMList.cpp \ - LanguageModel.cpp \ - LanguageModelFactory.cpp \ - LatticePath.cpp \ - LexicalReordering.cpp \ - Manager.cpp \ - md5.cpp \ - mempool.cpp \ - Parameter.cpp \ - Phrase.cpp \ - PhraseDictionary.cpp \ - PhraseDictionaryBase.cpp \ - PhraseDictionaryNode.cpp \ - PhraseDictionaryTree.cpp \ - PhraseDictionaryTreeAdaptor.cpp \ - ScoreComponentCollection.cpp \ - ScoreIndexManager.cpp \ - ScoreProducer.cpp \ - Sentence.cpp \ - StaticData.cpp \ - TargetPhrase.cpp \ - TranslationOption.cpp \ - TranslationOptionCollection.cpp \ - TranslationOptionCollectionText.cpp \ - TranslationOptionCollectionConfusionNet.cpp \ - UserMessage.cpp \ - Util.cpp \ - WeightOptimization.cpp \ - Word.cpp \ - WordsBitmap.cpp \ - WordsRange.cpp - - -if INTERNAL_LM -libmoses_a_SOURCES += NGramCollection.cpp LanguageModel_Internal.cpp -endif - -if SRI_LM -libmoses_a_SOURCES += LanguageModel_SRI.cpp -endif - -if IRST_LM -libmoses_a_SOURCES += LanguageModel_IRST.cpp -endif - diff --git a/moses/src/Manager.cpp b/moses/src/Manager.cpp deleted file mode 100755 index 2f0949537..000000000 --- a/moses/src/Manager.cpp +++ /dev/null @@ -1,311 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include <limits> -#include <cmath> -#include "Manager.h" -#include "TypeDef.h" -#include "Util.h" -#include "TargetPhrase.h" -#include "LatticePath.h" -#include "LatticePathCollection.h" -#include "TranslationOption.h" -#include "LMList.h" - -using namespace std; - -Manager::Manager(InputType const& source, - TranslationOptionCollection& toc, - StaticData &staticData) -:m_source(source) -,m_hypoStack(source.GetSize() + 1) -,m_staticData(staticData) -,m_possibleTranslations(toc) //dynamic_cast<Sentence const&>(source)) -,m_initialTargetPhrase(Output) -{ - std::vector < HypothesisCollection >::iterator iterStack; - for (iterStack = m_hypoStack.begin() ; iterStack != m_hypoStack.end() ; ++iterStack) - { - HypothesisCollection &sourceHypoColl = *iterStack; - sourceHypoColl.SetMaxHypoStackSize(m_staticData.GetMaxHypoStackSize()); - sourceHypoColl.SetBeamThreshold(m_staticData.GetBeamThreshold()); - } -} - -Manager::~Manager() {} - -/** - * this is the main loop when a sentence is translated - * hypotheses are expanded stack by stack, until the end of the sentence - */ -void Manager::ProcessSentence() -{ - m_staticData.GetSentenceStats().ZeroAll(); - list < DecodeStep > &decodeStepList = m_staticData.GetDecodeStepList(); - // create list of all possible translations - // this is only valid if: - // 1. generation of source sentence is not done 1st - // 2. initial hypothesis factors are given in the sentence - //CreateTranslationOptions(m_source, phraseDictionary, lmListInitial); - m_possibleTranslations.CreateTranslationOptions(decodeStepList - , m_staticData.GetAllLM() - , m_staticData.GetFactorCollection() - , m_staticData.GetWeightWordPenalty() - , m_staticData.GetDropUnknown() - , m_staticData.GetVerboseLevel()); - - // initial seed hypothesis: nothing translated, no words produced - { - Hypothesis *hypo = Hypothesis::Create(m_source, m_initialTargetPhrase); - m_hypoStack[0].AddPrune(hypo); - } - - // go through each stack - std::vector < HypothesisCollection >::iterator iterStack; - for (iterStack = m_hypoStack.begin() ; iterStack != m_hypoStack.end() ; ++iterStack) - { - HypothesisCollection &sourceHypoColl = *iterStack; - - // the stack is pruned before processing (lazy pruning): - sourceHypoColl.PruneToSize(m_staticData.GetMaxHypoStackSize()); - - sourceHypoColl.InitializeArcs(); - - // go through each hypothesis on the stack and try to expand it - HypothesisCollection::const_iterator iterHypo; - for (iterHypo = sourceHypoColl.begin() ; iterHypo != sourceHypoColl.end() ; ++iterHypo) - { - Hypothesis &hypothesis = **iterHypo; - ProcessOneHypothesis(hypothesis); // expand the hypothesis - } - // some logging - if (m_staticData.GetVerboseLevel() > 0) { - //OutputHypoStack(); - OutputHypoStackSize(); - } - - } - - // some more logging - if (m_staticData.GetVerboseLevel() > 0) { - cerr << m_staticData.GetSentenceStats(); - cerr << "Hypotheses created since startup: "<< Hypothesis::s_HypothesesCreated<<endl; - //OutputHypoStack(); - //OutputHypoStackSize(); - } -} - -/** - * find all translation options to expand one hypothesis, trigger expansion - * this is mostly a check for overlap with already covered words, and for - * violation of reordering limits. - */ -void Manager::ProcessOneHypothesis(const Hypothesis &hypothesis) -{ - // since we check for reordering limits, its good to have that limit handy - int maxDistortion = m_staticData.GetMaxDistortion(); - - // no limit of reordering: only check for overlap - if (maxDistortion < 0) - { - const WordsBitmap hypoBitmap = hypothesis.GetWordsBitmap(); - const size_t hypoFirstGapPos = hypoBitmap.GetFirstGapPos() - , sourceSize = m_source.GetSize(); - - for (size_t startPos = hypoFirstGapPos ; startPos < sourceSize ; ++startPos) - { - for (size_t endPos = startPos ; endPos < sourceSize ; ++endPos) - { - if (!hypoBitmap.Overlap(WordsRange(startPos, endPos))) - { - ExpandAllHypotheses(hypothesis - , m_possibleTranslations.GetTranslationOptionList(WordsRange(startPos, endPos))); - } - } - } - - return; // done with special case (no reordering limit) - } - - // if there are reordering limits, make sure it is not violated - // the coverage bitmap is handy here (and the position of the first gap) - const WordsBitmap hypoBitmap = hypothesis.GetWordsBitmap(); - const size_t hypoWordCount = hypoBitmap.GetWordsCount() - , hypoFirstGapPos = hypoBitmap.GetFirstGapPos() - , sourceSize = m_source.GetSize(); - - // MAIN LOOP. go through each possible hypo - for (size_t startPos = hypoFirstGapPos ; startPos < sourceSize ; ++startPos) - { - for (size_t endPos = startPos ; endPos < sourceSize ; ++endPos) - { - // no gap so far => don't skip more than allowed limit - if (hypoFirstGapPos == hypoWordCount) - { - if (startPos == hypoWordCount - || (startPos > hypoWordCount - && endPos <= hypoWordCount + maxDistortion) - ) - { - ExpandAllHypotheses(hypothesis - ,m_possibleTranslations.GetTranslationOptionList(WordsRange(startPos, endPos))); - } - } - // filling in gap => just check for overlap - else if (startPos < hypoWordCount) - { - if (startPos >= hypoFirstGapPos - && !hypoBitmap.Overlap(WordsRange(startPos, endPos))) - { - ExpandAllHypotheses(hypothesis - ,m_possibleTranslations.GetTranslationOptionList(WordsRange(startPos, endPos))); - } - } - // ignoring, continuing forward => be limited by start of gap - else - { - if (endPos <= hypoFirstGapPos + maxDistortion - && !hypoBitmap.Overlap(WordsRange(startPos, endPos))) - { - ExpandAllHypotheses(hypothesis - ,m_possibleTranslations.GetTranslationOptionList(WordsRange(startPos, endPos))); - } - } - } - } -} - -void Manager::ExpandAllHypotheses(const Hypothesis &hypothesis,const TranslationOptionList &transOptList) -{ - TranslationOptionList::const_iterator iter; - for (iter = transOptList.begin() ; iter != transOptList.end() ; ++iter) - { - ExpandHypothesis(hypothesis, **iter); - } -} - -/** - * Expand one hypothesis with a translation option. - * this involves initial creation, scoring and adding it to the proper stack - */ -void Manager::ExpandHypothesis(const Hypothesis &hypothesis, const TranslationOption &transOpt) -{ - // create hypothesis and calculate all its scores - Hypothesis *newHypo = hypothesis.CreateNext(transOpt); - newHypo->CalcScore(m_staticData, m_possibleTranslations.GetFutureScore()); - - // logging for the curious - if(m_staticData.GetVerboseLevel() > 2) - { - newHypo->PrintHypothesis(m_source, m_staticData.GetWeightDistortion(), m_staticData.GetWeightWordPenalty()); - } - - // add to hypothesis stack - size_t wordsTranslated = newHypo->GetWordsBitmap().GetWordsCount(); - m_hypoStack[wordsTranslated].AddPrune(newHypo); -} - -/** - * Find best hypothesis on the last steck - * this is the end point of the best translation - */ -const Hypothesis *Manager::GetBestHypothesis() const -{ - const HypothesisCollection &hypoColl = m_hypoStack.back(); - return hypoColl.GetBestHypothesis(); -} - -/** - * Logging of hypotheses stacks and their sizes - */ -void Manager::OutputHypoStackSize() -{ - std::vector < HypothesisCollection >::const_iterator iterStack = m_hypoStack.begin(); - TRACE_ERR ((int)iterStack->size()); - for (++iterStack; iterStack != m_hypoStack.end() ; ++iterStack) - { - TRACE_ERR ( ", " << (int)iterStack->size()); - } - TRACE_ERR (endl); -} - -void Manager::OutputHypoStack(int stack) -{ - if (stack >= 0) - { - TRACE_ERR ( "Stack " << stack << ": " << endl << m_hypoStack[stack] << endl); - } - else - { // all stacks - int i = 0; - vector < HypothesisCollection >::iterator iterStack; - for (iterStack = m_hypoStack.begin() ; iterStack != m_hypoStack.end() ; ++iterStack) - { - HypothesisCollection &hypoColl = *iterStack; - TRACE_ERR ( "Stack " << i++ << ": " << endl << hypoColl << endl); - } - } -} - -/** - * After decoding, the hypotheses in the stacks and additional arcs - * form a search graph that can be mined for n-best lists. - * the heavy lifting is done in the LatticePath and LatticePathCollection - * this function controls this for one sentence - */ -void Manager::CalcNBest(size_t count, LatticePathList &ret) const -{ -#ifdef N_BEST - if (count <= 0) - return; - - vector<const Hypothesis*> sortedPureHypo = m_hypoStack.back().GetSortedList(); - - if (sortedPureHypo.size() == 0) - return; - - LatticePathCollection contenders; - - // path of the best - contenders.insert(new LatticePath(*sortedPureHypo.begin())); - - // used to add next pure hypo path - vector<const Hypothesis*>::const_iterator iterBestHypo = ++sortedPureHypo.begin(); - - for (size_t currBest = 0 ; currBest <= count && contenders.size() > 0 ; currBest++) - { - // get next best from list of contenders - LatticePath *path = *contenders.begin(); - ret.push_back(path); - contenders.erase(contenders.begin()); - - // create deviations from current best - path->CreateDeviantPaths(contenders); - - // if necessary, add next pure path - if (path->IsPurePath() && iterBestHypo != sortedPureHypo.end()) - { - contenders.insert(new LatticePath(*iterBestHypo)); - ++iterBestHypo; - } - } -#endif -} diff --git a/moses/src/Manager.h b/moses/src/Manager.h deleted file mode 100755 index 13fdd0018..000000000 --- a/moses/src/Manager.h +++ /dev/null @@ -1,67 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <vector> -#include <list> -#include "Input.h" -#include "Hypothesis.h" -#include "StaticData.h" -#include "TranslationOption.h" -#include "HypothesisCollection.h" -#include "TranslationOptionCollectionText.h" -#include "LatticePathList.h" -#include "SquareMatrix.h" -#include "WordsBitmap.h" -//#include "UnknownWordHandler.h" - -class LatticePath; - -class Manager -{ -protected: - // data - InputType const& m_source; - - std::vector < HypothesisCollection > m_hypoStack; - // no of elements = no of words in source + 1 - StaticData &m_staticData; - TranslationOptionCollection &m_possibleTranslations; - TargetPhrase m_initialTargetPhrase; // used to seed 1st hypo - - // functions for creating hypotheses - void ProcessOneHypothesis(const Hypothesis &hypothesis); - void ExpandAllHypotheses(const Hypothesis &hypothesis,const TranslationOptionList &transOptList); - void ExpandHypothesis(const Hypothesis &hypothesis,const TranslationOption &transOpt); - - // logging - void OutputHypoStack(int stack = -1); - void OutputHypoStackSize(); -public: - Manager(InputType const& source, TranslationOptionCollection&, StaticData &staticData); - ~Manager(); - - void ProcessSentence(); - const Hypothesis *GetBestHypothesis() const; - void CalcNBest(size_t count, LatticePathList &ret) const; -}; - diff --git a/moses/src/NGramCollection.cpp b/moses/src/NGramCollection.cpp deleted file mode 100755 index 1dec46677..000000000 --- a/moses/src/NGramCollection.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include "NGramCollection.h" -#include "NGramNode.h" - -NGramCollection::~NGramCollection() -{ - clear(); -} - -NGramNode *NGramCollection::GetOrCreateNGram(const Factor *factor) -{ - NGramCollection::iterator iter = this->find(factor); - if (iter == NGramCollection::end()) - { - return &((*this)[factor] = NGramNode()); - } - else - { - return &(iter->second); - } -} - -NGramNode *NGramCollection::GetNGram(const Factor *factor) -{ - NGramCollection::iterator iter = this->find(factor); - return (iter == NGramCollection::end()) ? NULL : &(iter->second) ; -} - -const NGramNode *NGramCollection::GetNGram(const Factor *factor) const -{ - NGramCollection::const_iterator iter = this->find(factor); - return (iter == NGramCollection::end()) ? NULL : &(iter->second) ; -} - diff --git a/moses/src/NGramCollection.h b/moses/src/NGramCollection.h deleted file mode 100755 index 6179c7e4f..000000000 --- a/moses/src/NGramCollection.h +++ /dev/null @@ -1,46 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <map> -#include <vector> - -class Factor; -class NGramNode; - -typedef std::vector<const Factor*> FactorVector; - -class NGramCollection : public std::map<const Factor*, NGramNode> -{ - -public: - NGramCollection() - { - } - ~NGramCollection(); - - NGramNode *GetOrCreateNGram(const Factor *factor); - NGramNode *GetNGram(const Factor *factor); - const NGramNode *GetNGram(const Factor *factor) const; - -}; - diff --git a/moses/src/NGramNode.h b/moses/src/NGramNode.h deleted file mode 100755 index c79d4d678..000000000 --- a/moses/src/NGramNode.h +++ /dev/null @@ -1,80 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include "NGramCollection.h" - -class NGramNode -{ -protected: - float m_score, m_logBackOff; - NGramCollection m_map; - NGramNode *m_rootNGram; -public: - NGramNode() - { - } - NGramCollection *GetNGramColl() - { - return &m_map; - } - //const NGramCollection *GetNGramColl() const - //{ - // return &m_map; - //} - const NGramNode *GetNGram(const Factor *factor) const - { - return m_map.GetNGram(factor); - } - NGramNode *GetNGram(const Factor *factor) - { - return m_map.GetNGram(factor); - } - - const NGramNode *GetRootNGram() const - { - return m_rootNGram; - } - void SetRootNGram(NGramNode *rootNGram) - { - m_rootNGram = rootNGram; - } - - float GetScore() const - { - return m_score; - } - float GetLogBackOff() const - { - return m_logBackOff; - } - void SetScore(float score) - { - m_score = score; - } - void SetLogBackOff(float logBackOff) - { - m_logBackOff = logBackOff; - } - -}; - diff --git a/moses/src/ObjectPool.h b/moses/src/ObjectPool.h deleted file mode 100644 index d4979e67f..000000000 --- a/moses/src/ObjectPool.h +++ /dev/null @@ -1,124 +0,0 @@ -// $Id$ - -/* ---------------------------------------------------------------- */ -/* Copyright 2005 (c) by RWTH Aachen - Lehrstuhl fuer Informatik VI */ -/* Richard Zens */ -/* ---------------------------------------------------------------- */ -#ifndef OBJECTPOOL_H_ -#define OBJECTPOOL_H_ -#include <vector> -#include <deque> -#include <string> -#include <iostream> -#include <iterator> - -// template class for pool of objects -// - usefull if many small objects are frequently created and destroyed -// - allocates memory for N objects at a time -// - separates memory allocation from constructor/destructor calls -// - prevents memory leak - -template<typename T> class ObjectPool { - public: - typedef T Object; - private: - std::string name; - size_t idx,dIdx,N; - std::vector<Object*> data; - std::vector<size_t> dataSize; - std::deque<Object*> freeObj; - int mode; - public: - static const int cleanUpOnDestruction=1; - static const int hasTrivialDestructor=2; - - // constructor arguments: - // N: initial number of objects to allocate memory at a time - // m & cleanUpOnDestruction = clean up objects in destructor - // m & hasTrivialDestructor = the object type has a trivial destructor, - // i.e. no sub-object uses dynamically allocated memory - // note: not equivalent to empty destructor - // -> more efficient (destructor calls can be omitted), - // note: looks like memory leak, but is not - ObjectPool(std::string name_="T",size_t N_=100000,int m=cleanUpOnDestruction) - : name(name_),idx(0),dIdx(0),N(N_),mode(m) {allocate();} - - // main accesss functions: - // get pointer to object via default or copy constructor - Object* get() {return new (getPtr()) Object;} - Object* get(const Object& x) {return new (getPtr()) Object(x);} - - // get pointer to uninitialized memory, - // WARNING: use only if you know what you are doing ! - // usefull for non-default constructors, you have to use placement new - Object* getPtr() { - if(freeObj.size()) { - Object* rv=freeObj.back();freeObj.pop_back();rv->~Object();return rv;} - if(idx==dataSize[dIdx]) {idx=0; if(++dIdx==data.size()) allocate();} - return data[dIdx]+idx++; - } - - // return object(s) to pool for reuse - // note: objects are not destroyed here, but in 'getPtr'/'destroyObjects', - // otherwise 'destroyObjects' would have to check the freeObj-stack - // before each destructor call - void freeObject(Object* x) {freeObj.push_back(x);} - template<class fwiter> void freeObjects(fwiter b,fwiter e) { - for(;b!=e;++b) this->free(*b);} - - // destroy all objects, but do not free memory - void reset() {destroyObjects();idx=0;dIdx=0;freeObj.clear();} - // destroy all objects and free memory - void cleanUp() { - reset(); for(size_t i=0;i<data.size();++i) free(data[i]); - data.clear();dataSize.clear(); - } - - ~ObjectPool() {if(mode & cleanUpOnDestruction) cleanUp();} - - void printInfo(std::ostream& out) const { - out<<"OPOOL ("<<name<<") info: "<<data.size()<<" "<<dataSize.size()<<" " - <<freeObj.size()<<"\n"<<idx<<" "<<dIdx<<" "<<N<<"\n"; - std::copy(dataSize.begin(),dataSize.end(), - std::ostream_iterator<size_t>(out," ")); - out<<"\n\n"; - } - - - private: - void destroyObjects() { - if(mode & hasTrivialDestructor) return; - for(size_t i=0;i<=dIdx;++i) { - size_t lastJ= (i<dIdx ? dataSize[i] : idx); - for(size_t j=0;j<lastJ;++j) (data[i]+j)->~Object();} - } - // allocate memory for a N objects, for follow-up allocations, - // the block size is doubled every time - // if allocation fails, block size is reduced by 1/4 - void allocate() { - // std::cerr<<"start "<<name<<" - objectpool allocate "<<N<<"\n"; - try { - if(dataSize.empty()) dataSize.push_back(N); - else dataSize.push_back(dataSize.back()*2); - void *m=malloc(sizeof(Object)*dataSize.back()); - while(!m) { - // std::cerr<<"malloc failed for size "<<dataSize.back()<<"!\n"; - dataSize.back()=static_cast<size_t>(dataSize.back()*0.75); - m=malloc(sizeof(Object)*dataSize.back()); - } - data.push_back(static_cast<Object*>(m)); - } - catch (const std::exception& e) { - std::cerr<<"caught std::exception: "<<e.what() - <<" in ObjectPool::allocate(), name: "<<name<<", last size: " - <<dataSize.back()<<"\n"; - std::cerr<<"OPOOL info: "<<data.size()<<" "<<dataSize.size()<<" " - <<freeObj.size()<<"\n"<<idx<<" "<<dIdx<<" "<<N<<"\n"; - std::copy(dataSize.begin(),dataSize.end(), - std::ostream_iterator<size_t>(std::cerr," ")); - std::cerr<<"\n"; - throw; - } - } -}; -#endif diff --git a/moses/src/Parameter.cpp b/moses/src/Parameter.cpp deleted file mode 100755 index 147bb83d4..000000000 --- a/moses/src/Parameter.cpp +++ /dev/null @@ -1,309 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include <iostream> -#include <fstream> -#include <sstream> -#include "boost/filesystem/operations.hpp" // includes boost/filesystem/path.hpp -#include "boost/filesystem/fstream.hpp" // ditto -#include <boost/algorithm/string.hpp> -#include "Parameter.h" -#include "Util.h" -#include "InputFileStream.h" -#include "UserMessage.h" - -using namespace std; - -PARAM_VEC &Parameter::AddParam(const string ¶mName) -{ - return m_setting[paramName]; -} - -// default parameter values -Parameter::Parameter() -{ - AddParam("ttable-file"); - AddParam("lmodel-file"); - AddParam("ttable-limit"); - AddParam("weight-d"); - AddParam("weight-l"); - AddParam("weight-t"); - AddParam("weight-w"); - AddParam("weight-e"); //source word deletion overall weight - AddParam("weight-generation"); - AddParam("weight-i"); - AddParam("mapping"); - AddParam("n-best-list"); - AddParam("beam-threshold"); - AddParam("distortion-limit"); - AddParam("input-factors"); - AddParam("output-factors"); - AddParam("mysql"); - AddParam("input-file"); - AddParam("cache-path"); - AddParam("input-file"); - AddParam("distortion-file"); - AddParam("distortion"); - AddParam("stack"); - AddParam("verbose"); - AddParam("report-source-span"); - AddParam("report-all-factors"); - AddParam("drop-unknown"); - AddParam("inputtype"); - AddParam("max-trans-opt-per-coverage"); -} - -// check if parameter settings make sense -bool Parameter::Validate() -{ - bool ret = true; - - // required parameters - if (m_setting["ttable-file"].size() == 0) - { - UserMessage::Add("No phrase translation table (ttable-file)"); - ret = false; - } - - if (m_setting["lmodel-file"].size() == 0) - { - UserMessage::Add("No language model (lmodel-file)"); - ret = false; - } - - if (m_setting["lmodel-file"].size() != m_setting["weight-l"].size()) - { - stringstream errorMsg(""); - errorMsg << static_cast<int>(m_setting["lmodel-file"].size()) - << " language model files given (lmodel-file), but " - << static_cast<int>(m_setting["weight-l"].size()) - << " weights (weight-l)"; - UserMessage::Add(errorMsg.str()); - ret = false; - } - - // do files exist? - // phrase tables - if (ret) - { - std::vector<std::string> ext; - // standard phrase table extension (i.e. full name has to be specified) - ext.push_back(""); - // alternative file extension for binary phrase table format: - ext.push_back(".binphr.idx"); - ret = FilesExist("ttable-file", 3,ext); - } - // generation tables - if (ret) - ret = FilesExist("generation-file", 2); - // language model - if (ret) - ret = FilesExist("lmodel-file", 3); - if (ret) - ret = FilesExist("input-file", 0); - - return ret; -} - -bool Parameter::FilesExist(const string ¶mName, size_t tokenizeIndex,std::vector<std::string> const& extensions) -{ - using namespace boost::filesystem; - - typedef std::vector<std::string> StringVec; - StringVec::const_iterator iter; - - PARAM_MAP::const_iterator iterParam = m_setting.find(paramName); - if (iterParam == m_setting.end()) - { // no param. therefore nothing to check - return true; - } - const StringVec &pathVec = (*iterParam).second; - for (iter = pathVec.begin() ; iter != pathVec.end() ; ++iter) - { - StringVec vec = Tokenize(*iter); - if (tokenizeIndex >= vec.size()) - { - stringstream errorMsg(""); - errorMsg << "Expected " << tokenizeIndex << " tokens per" - << " entry in '" << paramName << "', but only found " - << vec.size(); - UserMessage::Add(errorMsg.str()); - return false; - } - const string &pathStr = vec[tokenizeIndex]; - - bool fileFound=0; - for(size_t i=0;i<extensions.size() && !fileFound;++i) - { - path filePath(pathStr+extensions[i], native); - fileFound|=exists(filePath); - } - if(!fileFound) - { - stringstream errorMsg(""); - errorMsg << "File " << pathStr << " does not exists"; - UserMessage::Add(errorMsg.str()); - return false; - } - - } - return true; -} - -// TODO arg parsing like this does not belong in the library, it belongs -// in moses-cmd -string Parameter::FindParam(const string ¶mSwitch, int argc, char* argv[]) -{ - for (int i = 0 ; i < argc ; i++) - { - if (string(argv[i]) == paramSwitch) - { - if (i+1 < argc) - { - return argv[i+1]; - } else { - stringstream errorMsg(""); - errorMsg << "Option " << paramSwitch << " requires a parameter!"; - UserMessage::Add(errorMsg.str()); - // TODO return some sort of error, not the empty string - } - } - } - return ""; -} - -bool isOption(const char* x) { - if (!x) return false; - std::string s(x); - size_t len = s.size(); - if (len > 0 && s.substr(0,1) != "-") return false; - if (len > 1 && s.substr(1,1).find_first_not_of("0123456789") == 0) return true; - return false; -} - -void Parameter::OverwriteParam(const string ¶mSwitch, const string ¶mName, int argc, char* argv[]) -{ - int startPos = -1; - for (int i = 0 ; i < argc ; i++) - { - if (string(argv[i]) == paramSwitch) - { - startPos = i+1; - break; - } - } - if (startPos < 0) - return; - - int index = 0; - while (startPos < argc && (!isOption(argv[startPos]))) - { - if (m_setting[paramName].size() > (size_t)index) - m_setting[paramName][index] = argv[startPos]; - else - m_setting[paramName].push_back(argv[startPos]); - index++; - startPos++; - } -} - -// TODO this should be renamed to have at least a plural name -bool Parameter::LoadParam(int argc, char* argv[]) -{ - // config file (-f) arg mandatory - string configPath; - if ( (configPath = FindParam("-f", argc, argv)) == "" - && (configPath = FindParam("-config", argc, argv)) == "") - { - UserMessage::Add("No configuration file was specified. Use -config or -f"); - return false; - } - else - { - if (!ReadConfigFile(configPath)) - { - UserMessage::Add("Could not read "+configPath); - return false; - } - } - - string inFile = FindParam("-i", argc, argv); - if (inFile != "") - m_setting["input-file"].push_back(inFile); - - // overwrite weights - OverwriteParam("-dl", "distortion-limit", argc, argv); - OverwriteParam("-d", "weight-d", argc, argv); - OverwriteParam("-lm", "weight-l", argc, argv); - OverwriteParam("-tm", "weight-t", argc, argv); - OverwriteParam("-w", "weight-w", argc, argv); - OverwriteParam("-e", "weight-e", argc, argv); - OverwriteParam("-g", "weight-generation", argc, argv); - OverwriteParam("-n-best-list", "n-best-list", argc, argv); - OverwriteParam("-s", "stack", argc, argv); - OverwriteParam("-v", "verbose", argc, argv); - OverwriteParam("-report-source-span", "report-source-span", argc, argv); - OverwriteParam("-report-all-factors", "report-all-factors", argc, argv); - OverwriteParam("-drop-unknown", "drop-unknown", argc, argv); - OverwriteParam("-inputtype","inputtype",argc,argv); - OverwriteParam("-I","weight-i",argc,argv); - OverwriteParam("-ttable-limit","ttable-limit",argc,argv); - OverwriteParam("-lmodel-file","lmodel-file",argc,argv); - OverwriteParam("-beam-threshold","beam-threshold",argc,argv); - // OverwriteParam("-","",argc,argv); - - - // check if parameters make sense - return Validate(); -} - -// read parameters from a configuration file -bool Parameter::ReadConfigFile( string filePath ) -{ - InputFileStream inFile(filePath); - string line, paramName; - while(getline(inFile, line)) - { - // comments - size_t comPos = line.find_first_of("#"); - if (comPos != string::npos) - line = line.substr(0, comPos); - // trim leading and trailing spaces/tabs - boost::trim(line); - - if (line[0]=='[') - { // new parameter - for (size_t currPos = 0 ; currPos < line.size() ; currPos++) - { - if (line[currPos] == ']') - { - paramName = line.substr(1, currPos - 1); - break; - } - } - } - else if (line != "") - { // add value to parameter - m_setting[paramName].push_back(line); - } - } - return true; -} diff --git a/moses/src/Parameter.h b/moses/src/Parameter.h deleted file mode 100755 index a43e52c03..000000000 --- a/moses/src/Parameter.h +++ /dev/null @@ -1,64 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <string> -#include <map> -#include <vector> -#include "TypeDef.h" - -typedef std::vector<std::string> PARAM_VEC; -typedef std::map<std::string, PARAM_VEC > PARAM_MAP; - -/*** - * store raw parameter data (names and values as strings) for StaticData to parse; - * to get useful values, see StaticData - */ -class Parameter -{ -protected: - PARAM_MAP m_setting; - - std::string FindParam(const std::string ¶mSwitch, int argc, char* argv[]); - void OverwriteParam(const std::string ¶mSwitch, const std::string ¶mName, int argc, char* argv[]); - bool ReadConfigFile( std::string filePath ); - bool FilesExist(const std::string ¶mName, size_t tokenizeIndex,std::vector<std::string> const& fileExtension=std::vector<std::string>(1,"")); - - bool Validate(); - - PARAM_VEC &AddParam(const std::string ¶mName); - -public: - Parameter(); - bool LoadParam(int argc, char* argv[]); - - /*** - * return a vector of strings holding the whitespace-delimited values on the ini-file line - * corresponding to the given parameter name - */ - const PARAM_VEC &GetParam(const std::string ¶mName) - { - return m_setting[paramName]; - } - -}; - diff --git a/moses/src/PartialTranslOptColl.h b/moses/src/PartialTranslOptColl.h deleted file mode 100644 index b54c6bc25..000000000 --- a/moses/src/PartialTranslOptColl.h +++ /dev/null @@ -1,44 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <list> -#include "TranslationOption.h" -#include "Util.h" - -class PartialTranslOptColl : public std::list< TranslationOption* > -{ -public: - ~PartialTranslOptColl() - { - RemoveAllInColl<PartialTranslOptColl::iterator>(*this); - } - - void Add(TranslationOption *partialTranslOpt) - { - push_back(partialTranslOpt); - } - void DetachAll() - { - clear(); - } -}; diff --git a/moses/src/Phrase.cpp b/moses/src/Phrase.cpp deleted file mode 100755 index 90cfad831..000000000 --- a/moses/src/Phrase.cpp +++ /dev/null @@ -1,366 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include <cassert> -#include <algorithm> -#include <sstream> -#include <string> -#include "memory.h" -#include "FactorCollection.h" -#include "Phrase.h" -#include "Util.h" - -using namespace std; - -std::vector<mempool*> Phrase::s_memPool; - -Phrase::Phrase(const Phrase ©) -:m_direction(copy.m_direction) -,m_phraseSize(copy.m_phraseSize) -,m_arraySize(copy.m_arraySize) -,m_memPoolIndex(copy.m_memPoolIndex) -{ - assert(m_memPoolIndex<s_memPool.size() && s_memPool[m_memPoolIndex]); - m_factorArray = (FactorArray*) s_memPool[m_memPoolIndex]->alloc(); - memcpy(m_factorArray, copy.m_factorArray, m_phraseSize * sizeof(FactorArray)); -} - -Phrase& Phrase::operator=(const Phrase& x) -{ - if(this!=&x) - { - - if(m_factorArray) - { - assert(m_memPoolIndex<s_memPool.size()); - s_memPool[m_memPoolIndex]->free((char*)m_factorArray); - } - - m_direction=x.m_direction; - m_phraseSize=x.m_phraseSize; - m_arraySize=x.m_arraySize; - m_memPoolIndex=x.m_memPoolIndex; - - m_factorArray = (FactorArray*) s_memPool[m_memPoolIndex]->alloc(); - memcpy(m_factorArray, x.m_factorArray, m_phraseSize * sizeof(FactorArray)); - } - return *this; -} - - -Phrase::Phrase(FactorDirection direction) - : m_direction(direction) - , m_phraseSize(0) - , m_arraySize(ARRAY_SIZE_INCR) - , m_memPoolIndex(0) -{ - assert(m_memPoolIndex<s_memPool.size()); - m_factorArray = (FactorArray*) s_memPool[m_memPoolIndex]->alloc(); -} - -Phrase::Phrase(FactorDirection direction, const vector< const Word* > &mergeWords) -:m_direction(direction) -,m_phraseSize(mergeWords.size()) -{ - m_memPoolIndex = (m_phraseSize + ARRAY_SIZE_INCR - 1) / ARRAY_SIZE_INCR - 1; - m_arraySize = (m_memPoolIndex + 1) * ARRAY_SIZE_INCR; - m_factorArray = (FactorArray*) s_memPool[m_memPoolIndex]->alloc(); - - for (size_t currPos = 0 ; currPos < m_phraseSize ; currPos++) - { - FactorArray &thisWord = m_factorArray[currPos]; - const Word &mergeWord = *mergeWords[currPos]; - - for (unsigned int currFactor = 0 ; currFactor < NUM_FACTORS ; currFactor++) - { - FactorType factorType = static_cast<FactorType>(currFactor); - thisWord[currFactor] = mergeWord.GetFactor(factorType); - } - } -} - -Phrase::~Phrase() -{ - // RZ: - // will segFault if Phrase was default constructed and AddWord was never called - // not sure if this is really the intended behaviour - // assertion failure is better than segFault, but if(m_factorArray) might be more appropriate - //assert(m_factorArray); - if(m_factorArray) - { - assert(m_memPoolIndex<s_memPool.size()); - assert((char*)m_factorArray); - s_memPool[m_memPoolIndex]->free((char*)m_factorArray); - } -} - -void Phrase::MergeFactors(const Phrase ©) -{ - assert(GetSize() == copy.GetSize()); - size_t size = GetSize(); - for (size_t currPos = 0 ; currPos < size ; currPos++) - { - for (unsigned int currFactor = 0 ; currFactor < NUM_FACTORS ; currFactor++) - { - FactorType factorType = static_cast<FactorType>(currFactor); - const Factor *factor = copy.GetFactor(currPos, factorType); - if (factor != NULL) - SetFactor(currPos, factorType, factor); - } - } -} - -Phrase Phrase::GetSubString(const WordsRange &wordsRange) const -{ - Phrase retPhrase(m_direction); - - for (size_t currPos = wordsRange.GetStartPos() ; currPos <= wordsRange.GetEndPos() ; currPos++) - { - FactorArray &newWord = retPhrase.AddWord(); - Word::Copy(newWord, GetFactorArray(currPos)); - } - - return retPhrase; -} - -std::string Phrase::GetStringRep(const WordsRange &wordsRange) const -{ - std::stringstream phrase_string(""); - for (size_t currPos = wordsRange.GetStartPos() ; currPos <= wordsRange.GetEndPos() ; currPos++) - { - phrase_string << " " << Word::ToString(GetFactorArray(currPos)); - } - return phrase_string.str(); -} - -FactorArray &Phrase::AddWord() -{ - if ((m_phraseSize+1) % ARRAY_SIZE_INCR == 0) - { // need to expand array - FactorArray *newArray = (FactorArray*) s_memPool[m_memPoolIndex+1]->alloc(); - memcpy(newArray, m_factorArray, m_phraseSize * sizeof(FactorArray)); - s_memPool[m_memPoolIndex]->free((char*)m_factorArray); - - m_memPoolIndex++; - m_arraySize += ARRAY_SIZE_INCR; - m_factorArray = newArray; - } - - FactorArray &factorArray = m_factorArray[m_phraseSize]; - Word::Initialize(factorArray); - - m_phraseSize++; - - return factorArray; -} - -vector< vector<string> > Phrase::Parse(const std::string &phraseString) -{ - // parse - vector< vector<string> > phraseVector; - vector<string> annotatedWordVector = Tokenize(phraseString); - // KOMMA|none ART|Def.Z NN|Neut.NotGen.Sg VVFIN|none - // to - // "KOMMA|none" "ART|Def.Z" "NN|Neut.NotGen.Sg" "VVFIN|none" - - for (size_t phrasePos = 0 ; phrasePos < annotatedWordVector.size() ; phrasePos++) - { - string &annotatedWord = annotatedWordVector[phrasePos]; - vector<string> factorStrVector = Tokenize(annotatedWord, "|"); - // KOMMA|none - // to - // "KOMMA" "none" - phraseVector.push_back(factorStrVector); - } - return phraseVector; -} - -void Phrase::CreateFromString(const std::vector<FactorType> &factorOrder - , const vector< vector<string> > &phraseVector - , FactorCollection &factorCollection) -{ - for (size_t phrasePos = 0 ; phrasePos < phraseVector.size() ; phrasePos++) - { - // add word this phrase - FactorArray &factorArray = AddWord(); - for (size_t currFactorIndex= 0 ; currFactorIndex < factorOrder.size() ; currFactorIndex++) - { - FactorType factorType = factorOrder[currFactorIndex]; - const string &factorStr = phraseVector[phrasePos][currFactorIndex]; - const Factor *factor = factorCollection.AddFactor(m_direction, factorType, factorStr); - factorArray[factorType] = factor; - } - } -} - -void Phrase::CreateFromString(const std::vector<FactorType> &factorOrder - , const string &phraseString - , FactorCollection &factorCollection) -{ - vector< vector<string> > phraseVector = Parse(phraseString); - CreateFromString(factorOrder, phraseVector, factorCollection); -} - -bool Phrase::operator < (const Phrase &compare) const -{ -#ifdef min -#undef min -#endif - size_t thisSize = GetSize() - ,compareSize = compare.GetSize(); - - // decide by using length. quick decision - if (thisSize != compareSize) - { - return thisSize < compareSize; - } - else - { - size_t minSize = std::min( thisSize , compareSize ); - - // taken from word.Compare() - for (size_t i = 0 ; i < NUM_FACTORS ; i++) - { - FactorType factorType = static_cast<FactorType>(i); - - for (size_t currPos = 0 ; currPos < minSize ; currPos++) - { - const Factor *thisFactor = GetFactor(currPos, factorType) - ,*compareFactor = compare.GetFactor(currPos, factorType); - - if (thisFactor != NULL && compareFactor != NULL) - { - const int result = thisFactor->Compare(*compareFactor); - if (result == 0) - { - continue; - } - else - { - return (result < 0); - } - } - } - } - - // identical - return false; - } -} - -bool Phrase::Contains(const vector< vector<string> > &subPhraseVector - , const vector<FactorType> &inputFactor) const -{ - const size_t subSize = subPhraseVector.size() - ,thisSize= GetSize(); - if (subSize > thisSize) - return false; - - // try to match word-for-word - for (size_t currStartPos = 0 ; currStartPos < (thisSize - subSize + 1) ; currStartPos++) - { - bool match = true; - - for (size_t currFactorIndex = 0 ; currFactorIndex < inputFactor.size() ; currFactorIndex++) - { - FactorType factorType = inputFactor[currFactorIndex]; - for (size_t currSubPos = 0 ; currSubPos < subSize ; currSubPos++) - { - size_t currThisPos = currSubPos + currStartPos; - const string &subStr = subPhraseVector[currSubPos][currFactorIndex] - ,&thisStr = GetFactor(currThisPos, factorType)->GetString(); - if (subStr != thisStr) - { - match = false; - break; - } - } - if (!match) - break; - } - - if (match) - return true; - } - return false; -} - -bool Phrase::IsCompatible(const Phrase &inputPhrase) const -{ - if (inputPhrase.GetSize() != GetSize()) - { - return false; - } - - const size_t size = GetSize(); - - for (size_t currPos = 0 ; currPos < size ; currPos++) - { - for (unsigned int currFactor = 0 ; currFactor < NUM_FACTORS ; currFactor++) - { - FactorType factorType = static_cast<FactorType>(currFactor); - const Factor *thisFactor = GetFactor(currPos, factorType) - ,*inputFactor = inputPhrase.GetFactor(currPos, factorType); - if (thisFactor != NULL && inputFactor != NULL && thisFactor != inputFactor) - return false; - } - } - return true; - -} - -void Phrase::InitializeMemPool() -{ - s_memPool.push_back( new mempool(1 * ARRAY_SIZE_INCR * sizeof(FactorArray) , 50000 )); - s_memPool.push_back( new mempool(2 * ARRAY_SIZE_INCR * sizeof(FactorArray) , 1000 )); - s_memPool.push_back( new mempool(3 * ARRAY_SIZE_INCR * sizeof(FactorArray) , 1000 )); - s_memPool.push_back( new mempool(4 * ARRAY_SIZE_INCR * sizeof(FactorArray) , 100 )); - s_memPool.push_back( new mempool(5 * ARRAY_SIZE_INCR * sizeof(FactorArray) , 10 )); - s_memPool.push_back( new mempool(6 * ARRAY_SIZE_INCR * sizeof(FactorArray) , 10 )); - s_memPool.push_back( new mempool(7 * ARRAY_SIZE_INCR * sizeof(FactorArray) , 10 )); - - for (size_t i = 8 ; i < 30 ; ++i) - s_memPool.push_back( new mempool(i * ARRAY_SIZE_INCR * sizeof(FactorArray) , 2 )); -} - -void Phrase::FinalizeMemPool() -{ - std::vector<mempool*>::iterator iter; - for (iter = s_memPool.begin() ; iter != s_memPool.end() ; ++iter) - { - delete *iter; - } -} - -TO_STRING_BODY(Phrase); - -// friend -ostream& operator<<(ostream& out, const Phrase& phrase) -{ -// out << "(size " << phrase.GetSize() << ") "; - for (size_t pos = 0 ; pos < phrase.GetSize() ; pos++) - { - const FactorArray &factorArray = phrase.GetFactorArray(pos); - out << Word::ToString(factorArray); - } - return out; -} - diff --git a/moses/src/Phrase.h b/moses/src/Phrase.h deleted file mode 100755 index ee6e0c21e..000000000 --- a/moses/src/Phrase.h +++ /dev/null @@ -1,122 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <iostream> -#include <vector> -#include <list> -#include <string> -#include "Word.h" -#include "WordsBitmap.h" -#include "TypeDef.h" -#include "Util.h" -#include "mempool.h" - -class Phrase -{ - friend std::ostream& operator<<(std::ostream&, const Phrase&); - private: - static std::vector<mempool*> s_memPool; - - FactorDirection m_direction; - size_t m_phraseSize, //number of words - m_arraySize, - m_memPoolIndex; - FactorArray *m_factorArray; - -public: - static void InitializeMemPool(); - static void FinalizeMemPool(); - - inline Phrase() - : m_phraseSize(0) - , m_arraySize(0) - , m_memPoolIndex(0) - , m_factorArray(NULL) - { // shouldn't be used. only for map - } - Phrase(const Phrase ©); - Phrase& operator=(const Phrase&); - - Phrase(FactorDirection direction); - Phrase(FactorDirection direction, const std::vector< const Word* > &mergeWords); - - virtual ~Phrase(); - - static std::vector< std::vector<std::string> > Parse(const std::string &phraseString); - void CreateFromString(const std::vector<FactorType> &factorOrder - , const std::string &phraseString - , FactorCollection &factorCollection); - void CreateFromString(const std::vector<FactorType> &factorOrder - , const std::vector< std::vector<std::string> > &phraseVector - , FactorCollection &factorCollection); - - void MergeFactors(const Phrase ©); - // must run IsCompatible() to ensure incompatible factors aren't being overwritten - - bool IsCompatible(const Phrase &inputPhrase) const; - - inline FactorDirection GetDirection() const - { - return m_direction; - } - - inline size_t GetSize() const - { - return m_phraseSize; - } - inline const FactorArray &GetFactorArray(size_t pos) const - { - return m_factorArray[pos]; - } - inline FactorArray &GetFactorArray(size_t pos) - { - return m_factorArray[pos]; - } - inline const Factor *GetFactor(size_t pos, FactorType factorType) const - { - FactorArray &ptr = m_factorArray[pos]; - return ptr[factorType]; - } - inline void SetFactor(size_t pos, FactorType factorType, const Factor *factor) - { - FactorArray &ptr = m_factorArray[pos]; - ptr[factorType] = factor; - } - - bool Contains(const std::vector< std::vector<std::string> > &subPhraseVector - , const std::vector<FactorType> &inputFactor) const; - - FactorArray &AddWord(); - - Phrase GetSubString(const WordsRange &wordsRange) const; - - std::string GetStringRep(const WordsRange &wordsRange) const; - - void push_back(Word const& w) {Word::Copy(AddWord(),w.GetFactorArray());} - - TO_STRING; - - // used to insert & find phrase in dictionary - bool operator< (const Phrase &compare) const; -}; - diff --git a/moses/src/PhraseDictionary.cpp b/moses/src/PhraseDictionary.cpp deleted file mode 100755 index 1de4d3d79..000000000 --- a/moses/src/PhraseDictionary.cpp +++ /dev/null @@ -1,268 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include <fstream> -#include <string> -#include <iterator> -#include <sys/stat.h> -#include "boost/filesystem/operations.hpp" // includes boost/filesystem/path.hpp -#include "PhraseDictionary.h" -#include "FactorCollection.h" -#include "Word.h" -#include "Util.h" -#include "InputFileStream.h" -#include "StaticData.h" -#include "WordsRange.h" - -using namespace std; - -void PhraseDictionary::Load(const std::vector<FactorType> &input - , const std::vector<FactorType> &output - , FactorCollection &factorCollection - , const string &filePath - , const string &hashFilePath - , const vector<float> &weight - , size_t maxTargetPhrase - , bool filter - , const list< Phrase > &inputPhraseList - , const LMList &languageModels - , float weightWP - , const StaticData& staticData) -{ - m_maxTargetPhrase = maxTargetPhrase; - m_filename = filePath; - - //factors - m_factorsUsed[Input] = new FactorTypeSet(input); - m_factorsUsed[Output] = new FactorTypeSet(output); - - // data from file - InputFileStream inFile(filePath); - - // create hash file if necessary - ofstream tempFile; - string tempFilePath; - if (filter) - { - CreateTempFile(tempFile, tempFilePath); - TRACE_ERR(filePath << " -> " << tempFilePath << " -> " << hashFilePath << endl); - } - - vector< vector<string> > phraseVector; - string line, prevSourcePhrase = ""; - bool addPhrase = !filter; - size_t count = 0; - size_t line_num = 0; - while(getline(inFile, line)) - { - ++line_num; - vector<string> tokens = TokenizeMultiCharSeparator( line , "|||" ); - if (tokens.size() != 3) - { - TRACE_ERR("Syntax error at " << filePath << ":" << line_num); - abort(); // TODO- error handling - } - - bool isLHSEmpty = (tokens[1].find_first_not_of(" \t", 0) == string::npos); - if (isLHSEmpty && !staticData.IsWordDeletionEnabled()) { - TRACE_ERR(filePath << ":" << line_num << ": pt entry contains empty target, skipping\n"); - continue; - } - - if (!filter) - { - if (tokens[0] != prevSourcePhrase) - phraseVector = Phrase::Parse(tokens[0]); - } - else if (tokens[0] == prevSourcePhrase) - { // same source phrase as prev line. - } - else - { - phraseVector = Phrase::Parse(tokens[0]); - prevSourcePhrase = tokens[0]; - - addPhrase = Contains(phraseVector, inputPhraseList, input); - } - - if (addPhrase) - { - vector<float> scoreVector = Tokenize<float>(tokens[2]); - if (scoreVector.size() != m_noScoreComponent) { - TRACE_ERR("Size of scoreVector != number (" <<scoreVector.size() << "!=" <<m_noScoreComponent<<") of score components on line " << line_num); - abort(); - } -// assert(scoreVector.size() == m_noScoreComponent); - - // source - Phrase sourcePhrase(Input); - sourcePhrase.CreateFromString( input, phraseVector, factorCollection); - //target - TargetPhrase targetPhrase(Output); - targetPhrase.CreateFromString( output, tokens[1], factorCollection); - - // component score, for n-best output - std::vector<float> scv(scoreVector.size()); - std::transform(scoreVector.begin(),scoreVector.end(),scv.begin(),TransformScore); - targetPhrase.SetScore(this, scv, weight, languageModels, weightWP); - - AddEquivPhrase(sourcePhrase, targetPhrase); - - // add to hash file - if (filter) - tempFile << line << endl; - } - count++; - } - - // move temp file to hash file - if (filter) - { - tempFile.close(); - using namespace boost::filesystem; - if (!exists(path(hashFilePath, native))) - { - try - { - rename( path(tempFilePath, native) , path(hashFilePath, native) ); - } - catch (...) - { // copy instead - copy_file(path(tempFilePath, native) , path(hashFilePath, native) ); - remove(tempFilePath); - } - } -#ifndef _WIN32 - // change permission to let everyone use cached file - chmod(hashFilePath.c_str(), S_IRWXU | S_IRWXG | S_IRWXO); -#endif - } -} - -TargetPhraseCollection *PhraseDictionary::CreateTargetPhraseCollection(const Phrase &source) -{ - const size_t size = source.GetSize(); - - PhraseDictionaryNode *currNode = &m_collection; - for (size_t pos = 0 ; pos < size ; ++pos) - { - Word word(source.GetFactorArray(pos)); - currNode = currNode->GetOrCreateChild(word); - if (currNode == NULL) - return NULL; - } - - return currNode->CreateTargetPhraseCollection(); -} - -void PhraseDictionary::AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase) -{ - TargetPhraseCollection &phraseColl = *CreateTargetPhraseCollection(source); - if (m_maxTargetPhrase == 0) - { // don't need keep list sorted - // create sub tree & put target phrase into collection - phraseColl.push_back(targetPhrase); - } - else - { // must keep list in sorted order - TargetPhraseCollection::iterator iter; - for (iter = phraseColl.begin() ; iter != phraseColl.end() ; ++iter) - { - TargetPhrase &insertPhrase = *iter; - if (targetPhrase.GetFutureScore() < insertPhrase.GetFutureScore()) - { - break; - } - } - phraseColl.insert(iter, targetPhrase); - - // get rid of least probable phrase if we have enough - if (phraseColl.size() > m_maxTargetPhrase) - { - phraseColl.erase(phraseColl.begin()); - } - } -} - -const TargetPhraseCollection *PhraseDictionary::GetTargetPhraseCollection(const Phrase &source) const -{ // exactly like CreateTargetPhraseCollection, but don't create - const size_t size = source.GetSize(); - - const PhraseDictionaryNode *currNode = &m_collection; - for (size_t pos = 0 ; pos < size ; ++pos) - { - Word word(source.GetFactorArray(pos)); - currNode = currNode->GetChild(word); - if (currNode == NULL) - return NULL; - } - - return currNode->GetTargetPhraseCollection(); -} - -PhraseDictionary::~PhraseDictionary() -{ - for (size_t i = 0 ; i < m_factorsUsed.size() ; i++) - { - delete m_factorsUsed[i]; - } -} - -void PhraseDictionary::SetWeightTransModel(const vector<float> &weightT) -{ - PhraseDictionaryNode::iterator iterDict; - for (iterDict = m_collection.begin() ; iterDict != m_collection.end() ; ++iterDict) - { - PhraseDictionaryNode &phraseDictionaryNode = iterDict->second; - // recursively set weights in nodes - phraseDictionaryNode.SetWeightTransModel(this, weightT); - } -} - -bool PhraseDictionary::Contains(const vector< vector<string> > &phraseVector - , const list<Phrase> &inputPhraseList - , const vector<FactorType> &inputFactorType) -{ - std::list<Phrase>::const_iterator iter; - for (iter = inputPhraseList.begin() ; iter != inputPhraseList.end() ; ++iter) - { - const Phrase &inputPhrase = *iter; - if (inputPhrase.Contains(phraseVector, inputFactorType)) - return true; - } - return false; -} - -TO_STRING_BODY(PhraseDictionary); - -// friend -ostream& operator<<(ostream& out, const PhraseDictionary& phraseDict) -{ - const PhraseDictionaryNode &coll = phraseDict.m_collection; - PhraseDictionaryNode::const_iterator iter; - for (iter = coll.begin() ; iter != coll.end() ; ++iter) - { - const Word &word = (*iter).first; - out << word; - } - return out; -} - diff --git a/moses/src/PhraseDictionary.h b/moses/src/PhraseDictionary.h deleted file mode 100755 index bd5536a19..000000000 --- a/moses/src/PhraseDictionary.h +++ /dev/null @@ -1,71 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include "PhraseDictionaryBase.h" -#include "PhraseDictionaryNode.h" - -class PhraseDictionary : public PhraseDictionaryBase -{ - typedef PhraseDictionaryBase MyBase; - friend std::ostream& operator<<(std::ostream&, const PhraseDictionary&); - -protected: - PhraseDictionaryNode m_collection; - // 1st = source - // 2nd = target - - bool Contains(const std::vector< std::vector<std::string> > &phraseVector - , const std::list<Phrase> &inputPhraseList - , const std::vector<FactorType> &inputFactorType); - TargetPhraseCollection *CreateTargetPhraseCollection(const Phrase &source); -public: - PhraseDictionary(size_t noScoreComponent) - : MyBase(noScoreComponent) - { - } - virtual ~PhraseDictionary(); - - void Load(const std::vector<FactorType> &input - , const std::vector<FactorType> &output - , FactorCollection &factorCollection - , const std::string &filePath - , const std::string &hashFilePath - , const std::vector<float> &weight - , size_t maxTargetPhrase - , bool filter - , const std::list< Phrase > &inputPhraseList - , const LMList &languageModels - , float weightWP - , const StaticData& staticData); - - const TargetPhraseCollection *GetTargetPhraseCollection(const Phrase &source) const; - - void AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase); - - // for mert - void SetWeightTransModel(const std::vector<float> &weightT); - - TO_STRING; - -}; - diff --git a/moses/src/PhraseDictionaryBase.cpp b/moses/src/PhraseDictionaryBase.cpp deleted file mode 100644 index 76b0e52d3..000000000 --- a/moses/src/PhraseDictionaryBase.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "PhraseDictionaryBase.h" -#include "StaticData.h" -#include "Input.h" - -PhraseDictionaryBase::PhraseDictionaryBase(size_t noScoreComponent) - : Dictionary(noScoreComponent),m_maxTargetPhrase(0) -{ - const_cast<ScoreIndexManager&>(StaticData::Instance()->GetScoreIndexManager()).AddScoreProducer(this); -} - -PhraseDictionaryBase::~PhraseDictionaryBase() {} - -const TargetPhraseCollection *PhraseDictionaryBase:: -GetTargetPhraseCollection(InputType const& src,WordsRange const& range) const -{ - return GetTargetPhraseCollection(src.GetSubString(range)); -} - -const std::string PhraseDictionaryBase::GetScoreProducerDescription() const -{ - return "Translation score, file=" + m_filename; -} - -unsigned int PhraseDictionaryBase::GetNumScoreComponents() const -{ - return this->GetNoScoreComponents(); -} - diff --git a/moses/src/PhraseDictionaryBase.h b/moses/src/PhraseDictionaryBase.h deleted file mode 100644 index 41dfea011..000000000 --- a/moses/src/PhraseDictionaryBase.h +++ /dev/null @@ -1,63 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <iostream> -#include <map> -#include <list> -#include <vector> -#include <string> -#include "Phrase.h" -#include "TargetPhrase.h" -#include "Dictionary.h" -#include "TargetPhraseCollection.h" - -class StaticData; -class InputType; -class WordsRange; - -class PhraseDictionaryBase : public Dictionary, public ScoreProducer -{ - protected: - size_t m_maxTargetPhrase; - std::string m_filename; // just for debugging purposes - - public: - PhraseDictionaryBase(size_t noScoreComponent); - virtual ~PhraseDictionaryBase(); - - DecodeType GetDecodeType() const - { - return Translate; - } - - virtual void InitializeForInput(InputType const&) {} - const std::string GetScoreProducerDescription() const; - unsigned int GetNumScoreComponents() const; - - virtual void SetWeightTransModel(const std::vector<float> &weightT)=0; - - virtual const TargetPhraseCollection *GetTargetPhraseCollection(const Phrase& src) const=0; - virtual const TargetPhraseCollection *GetTargetPhraseCollection(InputType const& src,WordsRange const& range) const; - - virtual void AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase)=0; -}; diff --git a/moses/src/PhraseDictionaryNode.cpp b/moses/src/PhraseDictionaryNode.cpp deleted file mode 100644 index 2368ff1af..000000000 --- a/moses/src/PhraseDictionaryNode.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include "PhraseDictionaryNode.h" -#include "TargetPhrase.h" -#include "PhraseDictionary.h" - -PhraseDictionaryNode *PhraseDictionaryNode::GetOrCreateChild(const Word &word) -{ - NodeMap::iterator iter = m_map.find(word); - if (iter != m_map.end()) - return &iter->second; // found it - - // can't find node. create a new 1 - return &(m_map[word] = PhraseDictionaryNode()); -} - -const PhraseDictionaryNode *PhraseDictionaryNode::GetChild(const Word &word) const -{ - NodeMap::const_iterator iter = m_map.find(word); - if (iter != m_map.end()) - return &iter->second; // found it - - // don't return anything - return NULL; -} - -void PhraseDictionaryNode::SetWeightTransModel(const PhraseDictionary *phraseDictionary - , const std::vector<float> &weightT) -{ - // recursively set weights - NodeMap::iterator iterNodeMap; - for (iterNodeMap = m_map.begin() ; iterNodeMap != m_map.end() ; ++iterNodeMap) - { - iterNodeMap->second.SetWeightTransModel(phraseDictionary, weightT); - } - - // set wieghts for this target phrase - if (m_targetPhraseCollection == NULL) - return; - - TargetPhraseCollection::iterator iterTargetPhrase; - for (iterTargetPhrase = m_targetPhraseCollection->begin(); - iterTargetPhrase != m_targetPhraseCollection->end(); - ++iterTargetPhrase) - { - TargetPhrase &targetPhrase = *iterTargetPhrase; - targetPhrase.SetWeights(phraseDictionary, weightT); - } - -} diff --git a/moses/src/PhraseDictionaryNode.h b/moses/src/PhraseDictionaryNode.h deleted file mode 100644 index 3efb1758c..000000000 --- a/moses/src/PhraseDictionaryNode.h +++ /dev/null @@ -1,71 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <map> -#include <vector> -#include <iterator> -#include "Word.h" -#include "TargetPhraseCollection.h" - -class PhraseDictionary; - -class PhraseDictionaryNode -{ - typedef std::map<Word, PhraseDictionaryNode> NodeMap; -protected: - NodeMap m_map; - TargetPhraseCollection *m_targetPhraseCollection; - -public: - PhraseDictionaryNode() - :m_targetPhraseCollection(NULL) - {} - ~PhraseDictionaryNode() - { - delete m_targetPhraseCollection; - } - - PhraseDictionaryNode *GetOrCreateChild(const Word &word); - const PhraseDictionaryNode *GetChild(const Word &word) const; - const TargetPhraseCollection *GetTargetPhraseCollection() const - { - return m_targetPhraseCollection; - } - TargetPhraseCollection *CreateTargetPhraseCollection() - { - if (m_targetPhraseCollection == NULL) - m_targetPhraseCollection = new TargetPhraseCollection(); - return m_targetPhraseCollection; - } - // for mert - void SetWeightTransModel(const PhraseDictionary *phraseDictionary - , const std::vector<float> &weightT); - - // iterators - typedef NodeMap::iterator iterator; - typedef NodeMap::const_iterator const_iterator; - const_iterator begin() const { return m_map.begin(); } - const_iterator end() const { return m_map.end(); } - iterator begin() { return m_map.begin(); } - iterator end() { return m_map.end(); } -}; diff --git a/moses/src/PhraseDictionaryTree.cpp b/moses/src/PhraseDictionaryTree.cpp deleted file mode 100644 index 781a6346b..000000000 --- a/moses/src/PhraseDictionaryTree.cpp +++ /dev/null @@ -1,505 +0,0 @@ -// $Id$ -#include "PhraseDictionaryTree.h" -#include <map> -#include <cassert> -#include <sstream> -#include <iostream> -#include <fstream> - -#include "PrefixTree.h" -#include "File.h" -#include "ObjectPool.h" - -template<typename T> -std::ostream& operator<<(std::ostream& out,const std::vector<T>& x) -{ - out<<x.size()<<" "; - typename std::vector<T>::const_iterator iend=x.end(); - for(typename std::vector<T>::const_iterator i=x.begin();i!=iend;++i) - out<<*i<<' '; - return out; -} - -typedef unsigned LabelId; -LabelId InvalidLabelId=std::numeric_limits<LabelId>::max(); -LabelId Epsilon=InvalidLabelId-1; - -typedef std::vector<LabelId> IPhrase; -typedef std::vector<float> Scores; -typedef PrefixTreeF<LabelId,off_t> PTF; - -template<typename A,typename B=std::map<A,LabelId> > -class LVoc { - typedef A Key; - typedef B M; - typedef std::vector<Key> V; - M m; - V data; -public: - LVoc() {} - - bool isKnown(const Key& k) const {return m.find(k)!=m.end();} - LabelId index(const Key& k) const { - typename M::const_iterator i=m.find(k); - return i!=m.end()? i->second : InvalidLabelId;} - LabelId add(const Key& k) { - std::pair<typename M::iterator,bool> p - =m.insert(std::make_pair(k,data.size())); - if(p.second) data.push_back(k); - assert(static_cast<size_t>(p.first->second)<data.size()); - return p.first->second; - } - Key const& symbol(LabelId i) const { - assert(static_cast<size_t>(i)<data.size()); - return data[i];} - - typedef typename V::const_iterator const_iterator; - const_iterator begin() const {return data.begin();} - const_iterator end() const {return data.end();} - - void Write(const std::string& fname) const { - std::ofstream out(fname.c_str()); Write(out);} - void Write(std::ostream& out) const { - for(int i=data.size()-1;i>=0;--i) - out<<i<<' '<<data[i]<<'\n'; - } - void Read(const std::string& fname) { - std::ifstream in(fname.c_str());Read(in);} - void Read(std::istream& in) { - Key k;size_t i;std::string line; - while(getline(in,line)) { - std::istringstream is(line); - if(is>>i>>k) { - if(i>=data.size()) data.resize(i+1); - data[i]=k; - m[k]=i; - } - } - } -}; - -class TgtCand { - IPhrase e; - Scores sc; -public: - TgtCand() {} - TgtCand(const IPhrase& a,const Scores& b) : e(a),sc(b) {} - TgtCand(FILE* f) {readBin(f);} - - const IPhrase& GetPhrase() const {return e;} - const Scores& GetScores() const {return sc;} - - void writeBin(FILE* f) const {fWriteVector(f,e);fWriteVector(f,sc);} - void readBin(FILE* f) {fReadVector(f,e);fReadVector(f,sc);} -}; - -class TgtCands : public std::vector<TgtCand> { - typedef std::vector<TgtCand> MyBase; -public: - TgtCands() : MyBase() {} - - void writeBin(FILE* f) const - { - unsigned s=size();fWrite(f,s); - for(size_t i=0;i<s;++i) MyBase::operator[](i).writeBin(f); - } - void readBin(FILE* f) - { - unsigned s;fRead(f,s);resize(s); - for(size_t i=0;i<s;++i) MyBase::operator[](i).readBin(f); - } -}; - - -struct PPimp { - PTF const*p;size_t idx;bool root; - - PPimp(PTF const* x,size_t i,bool b) : p(x),idx(i),root(b) {} - bool isValid() const {return root || (p && idx<p->size());} - - bool isRoot() const {return root;} - PTF const* ptr() const {return p;} -}; - -PhraseDictionaryTree::PrefixPtr::operator bool() const -{ - return imp && imp->isValid(); -} - - -struct PDTimp { - typedef PrefixTreeF<LabelId,off_t> PTF; - typedef FilePtr<PTF> CPT; - typedef std::vector<CPT> Data; - typedef LVoc<std::string> WordVoc; - - Data data; - std::vector<off_t> srcOffsets; - - FILE *os,*ot; - WordVoc sv,tv; - - ObjectPool<PPimp> pPool; - // a comparison with the Boost MemPools might be useful - - - PDTimp() : os(0),ot(0) {PTF::setDefault(InvalidOffT);} - ~PDTimp() {if(os) fClose(os);if(ot) fClose(ot);FreeMemory();} - - void FreeMemory() - { - for(Data::iterator i=data.begin();i!=data.end();++i) (*i).free(); - pPool.reset(); - } - - int Read(const std::string& fn); - - void GetTargetCandidates(const IPhrase& f,TgtCands& tgtCands) - { - if(f.empty()) return; - if(f[0]>=data.size()) return; - if(!data[f[0]]) return; - assert(data[f[0]]->findKey(f[0])<data[f[0]]->size()); - off_t tCandOffset=data[f[0]]->find(f); - if(tCandOffset==InvalidOffT) return; - fSeek(ot,tCandOffset); - tgtCands.readBin(ot); - } - - typedef PhraseDictionaryTree::PrefixPtr PPtr; - - void GetTargetCandidates(PPtr p,TgtCands& tgtCands) - { - assert(p); - if(p.imp->isRoot()) return; - off_t tCandOffset=p.imp->ptr()->getData(p.imp->idx); - if(tCandOffset==InvalidOffT) return; - fSeek(ot,tCandOffset); - tgtCands.readBin(ot); - } - void PrintTgtCand(const TgtCands& tcands,std::ostream& out) const; - - // convert target candidates from internal data structure to the external one - void ConvertTgtCand(const TgtCands& tcands,std::vector<StringTgtCand>& rv) const - { - for(TgtCands::const_iterator i=tcands.begin();i!=tcands.end();++i) - { - const IPhrase& iphrase=i->GetPhrase(); - std::vector<std::string const*> vs; - vs.reserve(iphrase.size()); - for(size_t j=0;j<iphrase.size();++j) - vs.push_back(&tv.symbol(iphrase[j])); - rv.push_back(StringTgtCand(vs,i->GetScores())); - } - } - - PPtr GetRoot() - { - return PPtr(pPool.get(PPimp(0,0,1))); - } - - PPtr Extend(PPtr p,const std::string& w) - { - assert(p); - if(w.empty() || w==EPSILON) return p; - LabelId wi=sv.index(w); - if(wi==InvalidLabelId) return PPtr(); - else if(p.imp->isRoot()) - { - if(wi<data.size() && data[wi]) - { - assert(data[wi]->findKeyPtr(wi)); - return PPtr(pPool.get(PPimp(data[wi],data[wi]->findKey(wi),0))); - } - } - else if(PTF const* nextP=p.imp->ptr()->getPtr(p.imp->idx)) - return PPtr(pPool.get(PPimp(nextP,nextP->findKey(wi),0))); - - return PPtr(); - } -}; - - -//////////////////////////////////////////////////////////// -// -// member functions of PDTimp -// -//////////////////////////////////////////////////////////// - -int PDTimp::Read(const std::string& fn) -{ - std::string ifs(fn+".binphr.srctree"), - ift(fn+".binphr.tgtdata"), - ifi(fn+".binphr.idx"), - ifsv(fn+".binphr.srcvoc"), - iftv(fn+".binphr.tgtvoc"); - - FILE *ii=fOpen(ifi.c_str(),"rb"); - fReadVector(ii,srcOffsets); - fClose(ii); - - os=fOpen(ifs.c_str(),"rb"); - ot=fOpen(ift.c_str(),"rb"); - - data.resize(srcOffsets.size()); - for(size_t i=0;i<data.size();++i) - data[i]=CPT(os,srcOffsets[i]); - - sv.Read(ifsv); - tv.Read(iftv); - - std::cerr<<"binary phrasefile loaded, default off_t: "<<PTF::getDefault() - <<"\n"; - return 1; -} - -void PDTimp::PrintTgtCand(const TgtCands& tcand,std::ostream& out) const -{ - for(size_t i=0;i<tcand.size();++i) - { - out<<i<<" -- "<<tcand[i].GetScores()<<" -- "; - const IPhrase& iphr=tcand[i].GetPhrase(); - for(size_t j=0;j<iphr.size();++j) - out<<tv.symbol(iphr[j])<<" "; - out<<'\n'; - } -} - -//////////////////////////////////////////////////////////// -// -// member functions of PhraseDictionaryTree -// -//////////////////////////////////////////////////////////// - -PhraseDictionaryTree::PhraseDictionaryTree(size_t noScoreComponent) - : Dictionary(noScoreComponent),imp(new PDTimp) -{ - if(sizeof(off_t)!=8) - { - std::cerr<<"ERROR: size of type 'off_t' has to be 64 bit!\n" - "use compiler settings '-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES'\n" - " -> abort \n\n"; - abort(); - } -} - -PhraseDictionaryTree::~PhraseDictionaryTree() -{ - delete imp; -} -void PhraseDictionaryTree::FreeMemory() const -{ - imp->FreeMemory(); -} - -void PhraseDictionaryTree:: -GetTargetCandidates(const std::vector<std::string>& src, - std::vector<StringTgtCand>& rv) const -{ - IPhrase f(src.size()); - for(size_t i=0;i<src.size();++i) - { - f[i]=imp->sv.index(src[i]); - if(f[i]==InvalidLabelId) return; - } - - TgtCands tgtCands; - imp->GetTargetCandidates(f,tgtCands); - imp->ConvertTgtCand(tgtCands,rv); -} - -void PhraseDictionaryTree:: -PrintTargetCandidates(const std::vector<std::string>& src, - std::ostream& out) const -{ - IPhrase f(src.size()); - for(size_t i=0;i<src.size();++i) - { - f[i]=imp->sv.index(src[i]); - if(f[i]==InvalidLabelId) - { - std::cerr<<"the source phrase '"<<src<<"' contains an unknown word '" - <<src[i]<<"'\n"; - return; - } - } - - TgtCands tcand; - imp->GetTargetCandidates(f,tcand); - out<<"there are "<<tcand.size()<<" target candidates\n"; - imp->PrintTgtCand(tcand,out); -} - -int PhraseDictionaryTree::Create(std::istream& inFile,const std::string& out) -{ - std::string line; - size_t count = 0; - - std::string ofn(out+".binphr.srctree"), - oft(out+".binphr.tgtdata"), - ofi(out+".binphr.idx"), - ofsv(out+".binphr.srcvoc"), - oftv(out+".binphr.tgtvoc"); - - FILE *os=fOpen(ofn.c_str(),"wb"), - *ot=fOpen(oft.c_str(),"wb"); - - typedef PrefixTreeSA<LabelId,off_t> PSA; - PSA *psa=new PSA;PSA::setDefault(InvalidOffT); - - LabelId currFirstWord=InvalidLabelId; - IPhrase currF; - TgtCands tgtCands; - std::vector<off_t> vo; - size_t lnc=0; - while(getline(inFile, line)) - { - ++lnc; - std::istringstream is(line);std::string w; - IPhrase f,e;Scores sc; - - while(is>>w && w!="|||") f.push_back(imp->sv.add(w)); - while(is>>w && w!="|||") e.push_back(imp->tv.add(w)); - while(is>>w && w!="|||") sc.push_back(atof(w.c_str())); - - - if(f.empty()) - { - std::cerr<<"WARNING: empty source phrase in line '"<<line<<"'\n"; - continue; - } - - if(currFirstWord==InvalidLabelId) currFirstWord=f[0]; - if(currF.empty()) - { - currF=f; - // insert src phrase in prefix tree - assert(psa); - PSA::Data& d=psa->insert(f); - if(d==InvalidOffT) d=fTell(ot); - else - { - std::cerr<<"ERROR: source phrase already inserted (A)!\nline: '" - <<line<<"'\nf: "<<f<<"\n"; - abort(); - } - } - - if(currF!=f) - { - // new src phrase - currF=f; - tgtCands.writeBin(ot); - tgtCands.clear(); - - if(++count%10000==0) - { - std::cerr<<"."; - if(count%500000==0) std::cerr<<"[phrase:"<<count<<"]\n"; - } - - if(f[0]!=currFirstWord) - { - // write src prefix tree to file and clear - PTF pf; - if(currFirstWord>=vo.size()) - vo.resize(currFirstWord+1,InvalidOffT); - vo[currFirstWord]=fTell(os); - pf.create(*psa,os); - // clear - delete psa;psa=new PSA; - currFirstWord=f[0]; - } - - // insert src phrase in prefix tree - assert(psa); - PSA::Data& d=psa->insert(f); - if(d==InvalidOffT) d=fTell(ot); - else - { - std::cerr<<"ERROR: source phrase already inserted (B)!\nline: '" - <<line<<"'\nf: "<<f<<"\n"; - abort(); - } - } - tgtCands.push_back(TgtCand(e,sc)); - assert(currFirstWord!=InvalidLabelId); - } - tgtCands.writeBin(ot);tgtCands.clear(); - - std::cerr<<"total word count: "<<count<<" -- "<<vo.size()<<" line count: " - <<lnc<<" -- "<<currFirstWord<<"\n"; - - PTF pf; - if(currFirstWord>=vo.size()) vo.resize(currFirstWord+1,InvalidOffT); - vo[currFirstWord]=fTell(os); - pf.create(*psa,os); - delete psa;psa=0; - - fClose(os); - fClose(ot); - - std::vector<size_t> inv; - for(size_t i=0;i<vo.size();++i) - if(vo[i]==InvalidOffT) inv.push_back(i); - - if(inv.size()) - { - std::cerr<<"WARNING: there are src voc entries with no phrase " - "translation: count "<<inv.size()<<"\n" - "There exists phrase translations for "<<vo.size()-inv.size() - <<" entries\n"; - } - - FILE *oi=fOpen(ofi.c_str(),"wb"); - fWriteVector(oi,vo); - fClose(oi); - - imp->sv.Write(ofsv); - imp->tv.Write(oftv); - - return 1; -} - - -int PhraseDictionaryTree::Read(const std::string& fn) -{ - std::cerr<<"size of off_t "<<sizeof(off_t)<<"\n"; - return imp->Read(fn); -} - - -PhraseDictionaryTree::PrefixPtr PhraseDictionaryTree::GetRoot() const -{ - return imp->GetRoot(); -} - -PhraseDictionaryTree::PrefixPtr -PhraseDictionaryTree::Extend(PrefixPtr p, const std::string& w) const -{ - return imp->Extend(p,w); -} - -void PhraseDictionaryTree::PrintTargetCandidates(PrefixPtr p,std::ostream& out) const -{ - - TgtCands tcand; - imp->GetTargetCandidates(p,tcand); - out<<"there are "<<tcand.size()<<" target candidates\n"; - imp->PrintTgtCand(tcand,out); -} - -void PhraseDictionaryTree:: -GetTargetCandidates(PrefixPtr p, - std::vector<StringTgtCand>& rv) const -{ - TgtCands tcands; - imp->GetTargetCandidates(p,tcands); - imp->ConvertTgtCand(tcands,rv); -} - -const std::string PhraseDictionaryTree::GetScoreProducerDescription() const -{ - return "Phrase dictionary tree"; -} - diff --git a/moses/src/PhraseDictionaryTree.h b/moses/src/PhraseDictionaryTree.h deleted file mode 100644 index f96180960..000000000 --- a/moses/src/PhraseDictionaryTree.h +++ /dev/null @@ -1,91 +0,0 @@ -// $Id$ - -#ifndef PHRASEDICTIONARYTREE_H_ -#define PHRASEDICTIONARYTREE_H_ -#include <string> -#include <vector> -#include <iostream> -#include "TypeDef.h" -#include "Dictionary.h" - -class Phrase; -class Word; -class ConfusionNet; - -typedef std::pair<std::vector<std::string const*>,std::vector<float> > StringTgtCand; - -class PDTimp; -class PPimp; - -class PhraseDictionaryTree : public Dictionary { - PDTimp *imp; //implementation - - PhraseDictionaryTree(); // not implemented - PhraseDictionaryTree(const PhraseDictionaryTree&); //not implemented - void operator=(const PhraseDictionaryTree&); //not implemented -public: - PhraseDictionaryTree(size_t noScoreComponent); - - virtual ~PhraseDictionaryTree(); - - DecodeType GetDecodeType() const {return Translate;} - size_t GetSize() const {return 0;} - - // convert from ascii phrase table format - // note: only creates table, does not keep it in memory - // -> use Read(outFileNamePrefix); - int Create(std::istream& in,const std::string& outFileNamePrefix); - - int Read(const std::string& fileNamePrefix); - - // free memory used by the prefix tree etc. - void FreeMemory() const; - - - /************************************** - * access with full source phrase * - **************************************/ - // print target candidates for a given phrase, mainly for debugging - void PrintTargetCandidates(const std::vector<std::string>& src, - std::ostream& out) const; - - // get the target candidates for a given phrase - void GetTargetCandidates(const std::vector<std::string>& src, - std::vector<StringTgtCand>& rv) const; - - /***************************** - * access to prefix tree * - *****************************/ - - // 'pointer' into prefix tree - // the only permitted direct operation is a check for NULL, - // e.g. PrefixPtr p; if(p) ... - // other usage only through PhraseDictionaryTree-functions below - - class PrefixPtr { - PPimp* imp; - friend class PDTimp; - public: - PrefixPtr(PPimp* x=0) : imp(x) {} - operator bool() const; - }; - - // return pointer to root node - PrefixPtr GetRoot() const; - // extend pointer with a word/Factorstring and return the resulting successor - // pointer. If there is no such successor node, the result will evaluate to - // false. Requirement: the input pointer p evaluates to true. - PrefixPtr Extend(PrefixPtr p,const std::string& s) const; - - // get the target candidates for a given prefix pointer - // requirement: the pointer has to evaluate to true - void GetTargetCandidates(PrefixPtr p, - std::vector<StringTgtCand>& rv) const; - - // print target candidates for a given prefix pointer to a stream, mainly - // for debugging - void PrintTargetCandidates(PrefixPtr p,std::ostream& out) const; - const std::string GetScoreProducerDescription() const; -}; - -#endif /*PHRASEDICTIONARYTREE_H_*/ diff --git a/moses/src/PhraseDictionaryTreeAdaptor.cpp b/moses/src/PhraseDictionaryTreeAdaptor.cpp deleted file mode 100644 index 1e67ccd99..000000000 --- a/moses/src/PhraseDictionaryTreeAdaptor.cpp +++ /dev/null @@ -1,441 +0,0 @@ -// $Id$ - -#include "PhraseDictionaryTreeAdaptor.h" -#include <sys/stat.h> -#include "PhraseDictionaryTree.h" -#include "Phrase.h" -#include "FactorCollection.h" -#include "InputFileStream.h" -#include "Input.h" -#include "ConfusionNet.h" -#include "StaticData.h" -#include "UniqueObject.h" - -inline bool existsFile(const char* filename) { - struct stat mystat; - return (stat(filename,&mystat)==0); -} - -struct PDTAimp { - std::vector<float> m_weights; - LMList const* m_languageModels; - float m_weightWP; - std::vector<FactorType> m_input,m_output; - FactorCollection *m_factorCollection; - PhraseDictionaryTree *m_dict; - mutable std::vector<TargetPhraseCollection const*> m_tgtColls; - - typedef std::map<Phrase,TargetPhraseCollection const*> MapSrc2Tgt; - mutable MapSrc2Tgt m_cache; - PhraseDictionaryTreeAdaptor *m_obj; - int useCache; - - typedef std::vector<TargetPhraseCollection const*> vTPC; - std::vector<vTPC> m_rangeCache; - unsigned m_numInputScores; - - PDTAimp(PhraseDictionaryTreeAdaptor *p,unsigned nis) - : m_languageModels(0),m_weightWP(0.0),m_factorCollection(0),m_dict(0), - m_obj(p),useCache(1),m_numInputScores(nis) {} - - void Factors2String(FactorArray const& w,std::string& s) const - { - for(size_t j=0;j<m_input.size();++j) - { - assert(static_cast<size_t>(m_input[j]) < static_cast<size_t>(NUM_FACTORS)); - assert(w[m_input[j]]); - if(s.size()) s+="|"; - s+=w[m_input[j]]->ToString(); - } - } - - void CleanUp() - { - assert(m_dict); - m_dict->FreeMemory(); - for(size_t i=0;i<m_tgtColls.size();++i) delete m_tgtColls[i]; - m_tgtColls.clear(); - m_cache.clear(); - m_rangeCache.clear(); - Phrase dummy(Input); uniqueObject(dummy,1); - } - - void AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase) - { - assert(GetTargetPhraseCollection(source)==0); - TRACE_ERR("adding unk source phrase "<<source<<"\n"); - std::pair<MapSrc2Tgt::iterator,bool> p - =m_cache.insert(std::make_pair(source,static_cast<TargetPhraseCollection const*>(0))); - if(p.second || p.first->second==0) - { - TargetPhraseCollection *ptr=new TargetPhraseCollection; - ptr->push_back(targetPhrase); - p.first->second=ptr; - m_tgtColls.push_back(ptr); - } - else std::cerr<<"WARNING: you added an already existing phrase!\n"; - } - - TargetPhraseCollection const* - GetTargetPhraseCollection(Phrase const &src) const - { - assert(m_dict); - if(src.GetSize()==0) return 0; - - std::pair<MapSrc2Tgt::iterator,bool> piter; - if(useCache) - { - piter=m_cache.insert(std::make_pair(src,static_cast<TargetPhraseCollection const*>(0))); - if(!piter.second) return piter.first->second; - } - else if (m_cache.size()) - { - MapSrc2Tgt::const_iterator i=m_cache.find(src); - return (i!=m_cache.end() ? i->second : 0); - } - - std::vector<std::string> srcString(src.GetSize()); - // convert source Phrase into vector of strings - for(size_t i=0;i<srcString.size();++i) - Factors2String(src.GetFactorArray(i),srcString[i]); - - // get target phrases in string representation - std::vector<StringTgtCand> cands; - m_dict->GetTargetCandidates(srcString,cands); - if(cands.empty()) return 0; - - std::vector<TargetPhrase> tCands;tCands.reserve(cands.size()); - std::vector<std::pair<float,size_t> > costs;costs.reserve(cands.size()); - - // convert into TargetPhrases - for(size_t i=0;i<cands.size();++i) - { - TargetPhrase targetPhrase(Output); - - StringTgtCand::first_type const& factorStrings=cands[i].first; - StringTgtCand::second_type const& probVector=cands[i].second; - - std::vector<float> scoreVector(probVector.size()); - std::transform(probVector.begin(),probVector.end(),scoreVector.begin(),TransformScore); - CreateTargetPhrase(targetPhrase,factorStrings,scoreVector); - costs.push_back(std::make_pair(targetPhrase.GetFutureScore(),tCands.size())); - tCands.push_back(targetPhrase); - } - - TargetPhraseCollection *rv=PruneTargetCandidates(tCands,costs); - - if(rv->empty()) - { - delete rv; - return 0; - } - else - { - if(useCache) piter.first->second=rv; - m_tgtColls.push_back(rv); - return rv; - } - } - - - - void Create(const std::vector<FactorType> &input - , const std::vector<FactorType> &output - , FactorCollection &factorCollection - , const std::string &filePath - , const std::vector<float> &weight - , const LMList &languageModels - , float weightWP - ) - { - - // set my members - m_factorCollection=&factorCollection; - m_dict=new PhraseDictionaryTree(weight.size()-m_numInputScores); - m_input=input; - m_output=output; - m_languageModels=&languageModels; - m_weightWP=weightWP; - m_weights=weight; - - - - std::string binFname=filePath+".binphr.idx"; - if(!existsFile(binFname.c_str())) { - TRACE_ERR("bin ttable does not exist -> create it\n"); - InputFileStream in(filePath); - m_dict->Create(in,filePath); - } - TRACE_ERR("reading bin ttable\n"); - m_dict->Read(filePath); - } - - typedef PhraseDictionaryTree::PrefixPtr PPtr; - typedef std::pair<size_t,size_t> Range; - struct State { - PPtr ptr; - Range range; - float score; - unsigned realWords; - Phrase src; - - State() : range(0,0),score(0.0),realWords(0),src(Input) {} - State(size_t b,size_t e,const PPtr& v,float sc=0.0,unsigned rw=0) : ptr(v),range(b,e),score(sc),realWords(rw),src(Input) {} - State(Range const& r,const PPtr& v,float sc=0.0,unsigned rw=0) : ptr(v),range(r),score(sc),realWords(rw),src(Input) {} - - size_t begin() const {return range.first;} - size_t end() const {return range.second;} - float GetScore() const {return score;} - - }; - - void CreateTargetPhrase(TargetPhrase& targetPhrase, - StringTgtCand::first_type const& factorStrings, - StringTgtCand::second_type const& scoreVector, - Phrase const* srcPtr=0) const - { - - for(size_t k=0;k<factorStrings.size();++k) - { - std::vector<std::string> factors=Tokenize(*factorStrings[k],"|"); - FactorArray& fa=targetPhrase.AddWord(); - for(size_t l=0;l<m_output.size();++l) - fa[m_output[l]]=m_factorCollection->AddFactor(Output, m_output[l], factors[l]); - } - targetPhrase.SetScore(m_obj, scoreVector, m_weights, *m_languageModels, m_weightWP); - targetPhrase.SetSourcePhrase(srcPtr); - } - - - TargetPhraseCollection* PruneTargetCandidates(std::vector<TargetPhrase> const & tCands, - std::vector<std::pair<float,size_t> >& costs) const - { - // prune target candidates and sort according to score - std::vector<std::pair<float,size_t> >::iterator nth=costs.end(); - if(m_obj->m_maxTargetPhrase>0 && costs.size()>m_obj->m_maxTargetPhrase) { - nth=costs.begin()+m_obj->m_maxTargetPhrase; - std::nth_element(costs.begin(),nth,costs.end(),std::greater<std::pair<float,size_t> >()); - } - std::sort(costs.begin(),nth,std::greater<std::pair<float,size_t> >()); - - // convert into TargetPhraseCollection - TargetPhraseCollection *rv=new TargetPhraseCollection; - for(std::vector<std::pair<float,size_t> >::iterator it=costs.begin();it!=nth;++it) - rv->push_back(tCands[it->second]); - return rv; - } - - // POD for target phrase scores - struct TScores { - float total; - StringTgtCand::second_type trans; - Phrase const* src; - - TScores() : total(0.0),src(0) {} - }; - - void CacheSource(ConfusionNet const& src) - { - assert(m_dict); - std::vector<State> stack; - for(size_t i=0;i<src.GetSize();++i) stack.push_back(State(i,i,m_dict->GetRoot())); - - typedef StringTgtCand::first_type sPhrase; - typedef std::map<StringTgtCand::first_type,TScores> E2Costs; - - std::map<Range,E2Costs> cov2cand; - - while(!stack.empty()) - { - State curr(stack.back()); - stack.pop_back(); - - //std::cerr<<"processing state "<<curr<<" stack size: "<<stack.size()<<"\n"; - - assert(curr.end()<src.GetSize()); - const ConfusionNet::Column &currCol=src[curr.end()]; - for(size_t colidx=0;colidx<currCol.size();++colidx) - { - const Word& w=currCol[colidx].first; - std::string s; - Factors2String(w.GetFactorArray(),s); - bool isEpsilon=(s=="" || s==EPSILON); - PPtr nextP = (isEpsilon ? curr.ptr : m_dict->Extend(curr.ptr,s)); - unsigned newRealWords=curr.realWords + (isEpsilon ? 0 : 1); - if(nextP) - { - Range newRange(curr.begin(),curr.end()+1); - float newScore=curr.GetScore()+currCol[colidx].second; - Phrase newSrc(curr.src); - newSrc.push_back(w); - if(newRange.second<src.GetSize()) - { - stack.push_back(State(newRange,nextP,newScore,newRealWords)); - stack.back().src=newSrc; - } - - std::vector<StringTgtCand> tcands; - m_dict->GetTargetCandidates(nextP,tcands); - - if(tcands.size()) - { - E2Costs& e2costs=cov2cand[newRange]; - Phrase const* srcPtr=uniqueObject(newSrc); - for(size_t i=0;i<tcands.size();++i) - { - std::vector<float> nscores(tcands[i].second.size()+m_numInputScores,0.0); - std::transform(tcands[i].second.begin(),tcands[i].second.end(),nscores.begin(),TransformScore); - switch(m_numInputScores) - { - case 2: nscores[nscores.size()-1-m_numInputScores+2]=-1.0*newRealWords; // do not use -newRealWords ! -- RZ - case 1: nscores[nscores.size()-1-m_numInputScores+1]=newScore; - case 0: break; - default: - std::cerr<<"ERROR: too many model scaling factors for input weights 'weight-i' : "<<m_numInputScores<<"\n"; - abort(); - } - assert(nscores.size()==m_weights.size()); - float score=std::inner_product(nscores.begin(),nscores.end(),m_weights.begin(),0.0); - - score-=tcands[i].first.size() * m_weightWP; - std::pair<E2Costs::iterator,bool> p=e2costs.insert(std::make_pair(tcands[i].first,TScores())); - - TScores & scores=p.first->second; - if(p.second || scores.total<score) - { - scores.total=score; - scores.trans=nscores; - scores.src=srcPtr; - } - } - } - } - } - } // end while(!stack.empty()) - - m_rangeCache.resize(src.GetSize(),vTPC(src.GetSize(),0)); - - for(std::map<Range,E2Costs>::const_iterator i=cov2cand.begin();i!=cov2cand.end();++i) - { - assert(i->first.first<m_rangeCache.size()); - assert(i->first.second>0); - assert(i->first.second-1<m_rangeCache[i->first.first].size()); - assert(m_rangeCache[i->first.first][i->first.second-1]==0); - - std::vector<TargetPhrase> tCands;tCands.reserve(i->second.size()); - std::vector<std::pair<float,size_t> > costs;costs.reserve(i->second.size()); - - for(E2Costs::const_iterator j=i->second.begin();j!=i->second.end();++j) - { - TScores const & scores=j->second; - TargetPhrase targetPhrase(Output); - CreateTargetPhrase(targetPhrase,j->first,scores.trans,scores.src); - costs.push_back(std::make_pair(targetPhrase.GetFutureScore(),tCands.size())); - tCands.push_back(targetPhrase); - } - - TargetPhraseCollection *rv=PruneTargetCandidates(tCands,costs); - - if(rv->empty()) - delete rv; - else - { - m_rangeCache[i->first.first][i->first.second-1]=rv; - m_tgtColls.push_back(rv); - } - } - } -}; - - - - -/************************************************************* - function definitions of the interface class - virtually everything is forwarded to the implementation class -*************************************************************/ - -PhraseDictionaryTreeAdaptor:: -PhraseDictionaryTreeAdaptor(size_t noScoreComponent,unsigned numInputScores) - : MyBase(noScoreComponent),imp(new PDTAimp(this,numInputScores)) {} - -PhraseDictionaryTreeAdaptor::~PhraseDictionaryTreeAdaptor() -{ - imp->CleanUp(); -} - -void PhraseDictionaryTreeAdaptor::CleanUp() -{ - imp->CleanUp(); - MyBase::CleanUp(); -} - -void PhraseDictionaryTreeAdaptor::InitializeForInput(InputType const& source) -{ - // only required for confusion net - if(ConfusionNet const* cn=dynamic_cast<ConfusionNet const*>(&source)) - imp->CacheSource(*cn); -} - -void PhraseDictionaryTreeAdaptor::Create(const std::vector<FactorType> &input - , const std::vector<FactorType> &output - , FactorCollection &factorCollection - , const std::string &filePath - , const std::vector<float> &weight - , size_t maxTargetPhrase - , const LMList &languageModels - , float weightWP - ) -{ - if(m_noScoreComponent!=weight.size()) { - std::cerr<<"ERROR: mismatch of number of scaling factors: "<<weight.size() - <<" "<<m_noScoreComponent<<"\n"; - abort(); - } - m_filename = filePath; - - // set Dictionary members - m_factorsUsed[Input] = new FactorTypeSet(input); - m_factorsUsed[Output] = new FactorTypeSet(output); - - // set PhraseDictionaryBase members - m_maxTargetPhrase=maxTargetPhrase; - - imp->Create(input,output,factorCollection,filePath, - weight,languageModels,weightWP); -} - -TargetPhraseCollection const* -PhraseDictionaryTreeAdaptor::GetTargetPhraseCollection(Phrase const &src) const -{ - return imp->GetTargetPhraseCollection(src); -} -TargetPhraseCollection const* -PhraseDictionaryTreeAdaptor::GetTargetPhraseCollection(InputType const& src,WordsRange const &range) const -{ - if(imp->m_rangeCache.empty()) - return imp->GetTargetPhraseCollection(src.GetSubString(range)); - else - return imp->m_rangeCache[range.GetStartPos()][range.GetEndPos()]; -} - -void PhraseDictionaryTreeAdaptor:: -SetWeightTransModel(const std::vector<float> &weightT) -{ - CleanUp(); - imp->m_weights=weightT; -} - -void PhraseDictionaryTreeAdaptor:: -AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase) -{ - imp->AddEquivPhrase(source,targetPhrase); -} -void PhraseDictionaryTreeAdaptor::EnableCache() -{ - imp->useCache=1; -} -void PhraseDictionaryTreeAdaptor::DisableCache() -{ - imp->useCache=0; -} diff --git a/moses/src/PhraseDictionaryTreeAdaptor.h b/moses/src/PhraseDictionaryTreeAdaptor.h deleted file mode 100644 index fd6a35012..000000000 --- a/moses/src/PhraseDictionaryTreeAdaptor.h +++ /dev/null @@ -1,63 +0,0 @@ -// $Id$ - -#ifndef PHRASEDICTIONARYTREEADAPTOR_H_ -#define PHRASEDICTIONARYTREEADAPTOR_H_ -#include <vector> -#include "TypeDef.h" -#include "PhraseDictionary.h" -#include "TargetPhraseCollection.h" - -class Phrase; -class PDTAimp; -class WordsRange; -class InputType; - -class PhraseDictionaryTreeAdaptor : public PhraseDictionaryBase { - typedef PhraseDictionaryBase MyBase; - PDTAimp *imp; - friend class PDTAimp; - PhraseDictionaryTreeAdaptor(); - PhraseDictionaryTreeAdaptor(const PhraseDictionaryTreeAdaptor&); - void operator=(const PhraseDictionaryTreeAdaptor&); - public: - PhraseDictionaryTreeAdaptor(size_t noScoreComponent,unsigned numInputScores); - virtual ~PhraseDictionaryTreeAdaptor(); - - // enable/disable caching - // you enable caching if you request the target candidates for a source phrase multiple times - // if you do caching somewhere else, disable it - // good settings for current Moses: disable for first factor, enable for other factors - // default: enable - - void EnableCache(); - void DisableCache(); - - // initialize ... - void Create(const std::vector<FactorType> &input - , const std::vector<FactorType> &output - , FactorCollection &factorCollection - , const std::string &filePath - , const std::vector<float> &weight - , size_t maxTargetPhrase - , const LMList &languageModels - , float weightWP - - ); - - // get translation candidates for a given source phrase - // returns null pointer if nothing found - TargetPhraseCollection const* GetTargetPhraseCollection(Phrase const &src) const; - TargetPhraseCollection const* GetTargetPhraseCollection(InputType const& src,WordsRange const & srcRange) const; - - // clean up temporary memory etc. - void CleanUp(); - - void InitializeForInput(InputType const& source); - - // change model scaling factors - void SetWeightTransModel(const std::vector<float> &weightT); - - // this function can be only used for UNKNOWN source phrases - void AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase); -}; -#endif diff --git a/moses/src/PrefixTree.h b/moses/src/PrefixTree.h deleted file mode 100644 index a036e563e..000000000 --- a/moses/src/PrefixTree.h +++ /dev/null @@ -1,277 +0,0 @@ -// $Id$ - -/* ---------------------------------------------------------------- */ -/* Copyright 2005 (c) by RWTH Aachen - Lehrstuhl fuer Informatik VI */ -/* Richard Zens */ -/* ---------------------------------------------------------------- */ -#ifndef PREFIXTREE_H_ -#define PREFIXTREE_H_ -#include <vector> -#include <algorithm> -#include <cassert> -#include <deque> -#include "Util.h" -#include "FilePtr.h" -#include "File.h" - -template<typename T,typename D> -class PrefixTreeSA { -public: - typedef T Key; - typedef D Data; - - typedef PrefixTreeSA<T,D> Self; - typedef std::vector<T> VT; - typedef std::vector<Self*> VP; - typedef std::vector<D> VD; - - VT keys; - VP ptr; - VD data; - - static Data def; - -public: - PrefixTreeSA() {} - - ~PrefixTreeSA() {for(size_t i=0;i<ptr.size();++i) delete ptr[i];} - - static const Data& getDefault() {return def;} - static void setDefault(const Data& x) {def=x;} - - - // insert sequence - template<typename fwiter> Data& insert(fwiter b,fwiter e) { - typename VT::iterator i=std::lower_bound(keys.begin(),keys.end(),*b); - typename VT::iterator kb=keys.begin(); - size_t pos=std::distance(kb,i); - - if(i==keys.end() || *i!=*b) { - keys.insert(i,*b); - data.insert(data.begin()+pos,def); - ptr.insert(ptr.begin()+pos,0); - } - if(++b!=e) { - if(!ptr[pos]) ptr[pos]=new Self; - return ptr[pos]->insert(b,e); - } - else return data[pos]; - } - // insert container - template<typename cont> Data& insert(const cont& c) { - return insert(c.begin(),c.end());} - - size_t size() const {return keys.size();} - const Key& getKey(size_t i) const {return keys[i];} - const Data& getData(size_t i) const {return data[i];} - const Self* getPtr(size_t i) const {return ptr[i];} - - size_t findKey(const Key& k) const { - typename VT::const_iterator i=std::lower_bound(keys.begin(),keys.end(),k); - if(i==keys.end() || *i!=k) return keys.size(); - return std::distance(keys.begin(),i); - } - - // find sequence - template<typename fwiter> const Data* findPtr(fwiter b,fwiter e) const { - size_t pos=findKey(*b); - if(pos==keys.size()) return 0; - if(++b==e) return &data[pos]; - if(ptr[pos]) return ptr[pos]->findPtr(b,e); else return 0; - } - // find container - template<typename cont> const Data* findPtr(const cont& c) const { - return findPtr(c.begin(),c.end());} - - - // find sequence - template<typename fwiter> const Data& find(fwiter b,fwiter e) const { - if(const Data* p=findPtr(b,e)) return *p; else return def; - } - - // find container - template<typename cont> const Data& find(const cont& c) const { - return find(c.begin(),c.end());} - - void shrink() { - ShrinkToFit(keys); ShrinkToFit(ptr); ShrinkToFit(data);} - -}; -template<typename T,typename D> D PrefixTreeSA<T,D>::def; - -///////////////////////////////////////////////////////////////////////////// - -template<typename T,typename D> -class PrefixTreeF { -public: - typedef T Key; - typedef D Data; -private: - typedef PrefixTreeF<Key,Data> Self; -public: - typedef FilePtr<Self> Ptr; -private: - typedef std::vector<Key> VK; - typedef std::vector<Data> VD; - typedef std::vector<Ptr> VP; - - VK keys; - VD data; - VP ptr; - - static Data def; - - off_t startPos; - FILE* f; -public: -#ifdef DEBUG - DECLAREMEMSTAT(Self); -#endif - - PrefixTreeF(FILE* f_=0) : f(f_) {if(f) read();} - - ~PrefixTreeF() {free();} - - void read() { - startPos=fTell(f); - fReadVector(f,keys); - fReadVector(f,data); - ptr.clear();ptr.resize(keys.size()); - for(size_t i=0;i<ptr.size();++i) { - off_t pos; - fRead(f,pos); - if(pos) ptr[i].set(f,pos); - } - } - - void free() { - for(typename VP::iterator i=ptr.begin();i!=ptr.end();++i) i->free();} - - void reserve(size_t s) { - keys.reserve(s);data.reserve(s);ptr.reserve(s);} - - template<typename fwiter> - void changeData(fwiter b,fwiter e,const Data& d) { - typename VK::const_iterator i=std::lower_bound(keys.begin(),keys.end(),*b); - if(i==keys.end() || *i!=*b) { - std::cerr<<"ERROR: key not found in changeData!\n"; return;} - typename VK::const_iterator kb=keys.begin(); - size_t pos=std::distance(kb,i); - if(++b==e) { - off_t p=startPos+keys.size()*sizeof(Key)+2*sizeof(unsigned)+pos*sizeof(Data); - std::cerr<<"elem found at pos "<<p<<" old val: "<<data[pos]<<" startpos: "<<startPos<<"\n"; - if(data[pos]!=d) { - data[pos]=d;fSeek(f,p);fWrite(f,d);} - return; - } - if(ptr[pos]) ptr[pos]->changeData(b,e,d); else { - std::cerr<<"ERROR: seg not found!in changeData\n"; - } - } - - - void create(const PrefixTreeSA<Key,Data>& psa,const std::string& fname) { - FILE* f=fOpen(fname.c_str(),"wb"); - create(psa,f); - fclose(f); - } - - void create(const PrefixTreeSA<Key,Data>& psa,FILE* f,int verbose=0) { - setDefault(psa.getDefault()); - - typedef std::pair<const PrefixTreeSA<Key,Data>*,off_t> P; - typedef std::deque<P> Next; - - Next next; - - next.push_back(P(&psa,fTell(f))); - bool isFirst=1; - size_t ns=1; - while(next.size()) { - if(verbose && next.size()>ns) { - std::cerr<<"stack size in PF create: "<<next.size()<<"\n"; - while(ns<next.size()) ns*=2;} - const P& pp=next.back(); - const PrefixTreeSA<Key,Data>& p=*pp.first; - off_t pos=pp.second; - next.pop_back(); - - if(!isFirst) { - off_t curr=fTell(f); - fSeek(f,pos); - fWrite(f,curr); - fSeek(f,curr); - } else isFirst=0; - - size_t s=0; - s+=fWriteVector(f,p.keys); - s+=fWriteVector(f,p.data); - - for(size_t i=0;i<p.ptr.size();++i) { - if(p.ptr[i]) - next.push_back(P(p.ptr[i],fTell(f))); - off_t ppos=0; - s+=fWrite(f,ppos); - } - } - } - - size_t size() const {return keys.size();} - const Key& getKey(size_t i) const {return keys[i];} - const Data& getData(size_t i) const {return data[i];} - const Self* getPtr(size_t i) const {return ptr[i];} - - size_t findKey(const Key& k) const { - typename VK::const_iterator i=std::lower_bound(keys.begin(),keys.end(),k); - if(i==keys.end() || *i!=k) return keys.size(); - return std::distance(keys.begin(),i); - } - - Ptr const* findKeyPtr(const Key& k) const { - size_t pos=findKey(k); - return (pos<keys.size() ? &ptr[pos] : 0); - } - - // find sequence - template<typename fwiter> const Data* findPtr(fwiter b,fwiter e) const { - typename VK::const_iterator i=std::lower_bound(keys.begin(),keys.end(),*b); - if(i==keys.end() || *i!=*b) return 0; - size_t pos=std::distance(keys.begin(),i); - if(++b==e) return &data[pos]; - if(ptr[pos]) return ptr[pos]->findPtr(b,e); else return 0; - } - // find container - template<typename cont> const Data* findPtr(const cont& c) const { - return findPtr(c.begin(),c.end());} - - - // find sequence - template<typename fwiter> const Data& find(fwiter b,fwiter e) const { - if(const Data* p=findPtr(b,e)) return *p; else return def;} //return (p?*p:def);} - - // find container - template<typename cont> const Data& find(const cont& c) const { - return find(c.begin(),c.end());} - - static void setDefault(const Data& d) {def=d;} - static const Data& getDefault() {return def;} - - - void print(std::ostream& out,const std::string s="") const { - - out<<s<<"startpos: "<<startPos<<" size: "<<keys.size()<<"\n"; - for(size_t i=0;i<keys.size();++i) { - out<<s<<i<<" - "<<keys[i]<<" "<<data[i]<<"\n"; - } - for(size_t i=0;i<ptr.size();++i) - if(ptr[i]) - ptr[i]->print(out,s+" "); - } - - -}; -template<typename T,typename D> D PrefixTreeF<T,D>::def; -#ifdef DEBUG -template<typename T,typename D> MemoryStatsPrinter< PrefixTreeF<T,D> > PrefixTreeF<T,D>::memStat("PrefixTreeF<T,D>",0); -#endif -#endif diff --git a/moses/src/ScoreComponentCollection.cpp b/moses/src/ScoreComponentCollection.cpp deleted file mode 100644 index bbf8d5920..000000000 --- a/moses/src/ScoreComponentCollection.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// $Id$ - -#include "ScoreComponentCollection.h" -#include "StaticData.h" - -ScoreComponentCollection2::ScoreComponentCollection2() - : m_scores(StaticData::Instance()->GetTotalScoreComponents(), 0.0f) - , m_sim(&StaticData::Instance()->GetScoreIndexManager()) -{} - diff --git a/moses/src/ScoreComponentCollection.h b/moses/src/ScoreComponentCollection.h deleted file mode 100644 index 8e7bca80f..000000000 --- a/moses/src/ScoreComponentCollection.h +++ /dev/null @@ -1,173 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <numeric> -#include <assert.h> -#include "ScoreProducer.h" -#include "ScoreIndexManager.h" - -/*** An unweighted collection of scores for a translation or step in a translation. - * - * In the factored phrase-based models that are implemented by moses, there are a set of - * scores that come from a variety of sources (translation probabilities, language model - * probablilities, distortion probabilities, generation probabilities). Furthermore, while - * some of these scores may be 0, this number is fixed (and generally quite small, ie, less - * than 15), for a given model. - * - * The values contained in ScoreComponentCollection2 objects are unweighted scores (log-probs). - * - * ScoreComponentCollection objects can be added and subtracted, which makes them appropriate - * to be the datatype used to return the result of a score computations (in this case they will - * have most values set to zero, except for the ones that are results of the indivudal computation - * this will then be added into the "running total" in the Hypothesis. In fact, for a score - * to be tracked in the hypothesis (and thus to participate in the decoding process), a class - * representing that score must extend the ScoreProducer abstract base class. For an example - * refer to the DistortionScoreProducer class. - */ -class ScoreComponentCollection2 { - friend std::ostream& operator<<(std::ostream& os, const ScoreComponentCollection2& rhs); -private: - std::vector<float> m_scores; - const ScoreIndexManager* m_sim; - -public: - //! Create a new score collection with all values set to 0.0 - ScoreComponentCollection2(); - - //! Clone a score collection - ScoreComponentCollection2(const ScoreComponentCollection2& rhs) - : m_scores(rhs.m_scores) - , m_sim(rhs.m_sim) - {} - - //! Set all values to 0.0 - void ZeroAll() - { - for (std::vector<float>::iterator i=m_scores.begin(); i!=m_scores.end(); ++i) - *i = 0.0f; - } - - //! add the score in rhs - void PlusEquals(const ScoreComponentCollection2& rhs) - { - assert(m_scores.size() >= rhs.m_scores.size()); - const size_t l = rhs.m_scores.size(); - for (size_t i=0; i<l; i++) { m_scores[i] += rhs.m_scores[i]; } - } - - //! subtract the score in rhs - void MinusEquals(const ScoreComponentCollection2& rhs) - { - assert(m_scores.size() >= rhs.m_scores.size()); - const size_t l = rhs.m_scores.size(); - for (size_t i=0; i<l; i++) { m_scores[i] -= rhs.m_scores[i]; } - } - - //! Add scores from a single ScoreProducer only - //! The length of scores must be equal to the number of score components - //! produced by sp - void PlusEquals(const ScoreProducer* sp, const std::vector<float>& scores) - { - - if(scores.size() != sp->GetNumScoreComponents()) std::cerr<<"ERROr: "<<scores.size()<<" "<<sp->GetNumScoreComponents()<<"\n"; - - assert(scores.size() == sp->GetNumScoreComponents()); - size_t i = m_sim->GetBeginIndex(sp->GetScoreBookkeepingID()); - for (std::vector<float>::const_iterator vi = scores.begin(); - vi != scores.end(); ++vi) - { - m_scores[i++] += *vi; - } - } - - //! Special version PlusEquals(ScoreProducer, vector<float>) - //! to add the score from a single ScoreProducer that produces - //! a single value - void PlusEquals(const ScoreProducer* sp, float score) - { - assert(1 == sp->GetNumScoreComponents()); - const size_t i = m_sim->GetBeginIndex(sp->GetScoreBookkeepingID()); - m_scores[i] += score; - } - - //! Special version PlusEquals(ScoreProducer, vector<float>) - //! to add the score from a single ScoreProducer that produces - //! a single value - void Assign(const ScoreProducer* sp, float score) - { - assert(1 == sp->GetNumScoreComponents()); - const size_t i = m_sim->GetBeginIndex(sp->GetScoreBookkeepingID()); - m_scores[i] = score; - } - - //! Used to find the weighted total of scores. rhs should contain a vector of weights - //! of the same length as the number of scores. - float InnerProduct(const std::vector<float>& rhs) const - { - return std::inner_product(m_scores.begin(), m_scores.end(), rhs.begin(), 0.0f); - } - - float PartialInnerProduct(const ScoreProducer* sp, const std::vector<float>& rhs) const - { - std::vector<float> lhs = GetScoresForProducer(sp); - assert(lhs.size() == rhs.size()); - return std::inner_product(lhs.begin(), lhs.end(), rhs.begin(), 0.0f); - } - - //! return a vector of all the scores associated with a certain ScoreProducer - std::vector<float> GetScoresForProducer(const ScoreProducer* sp) const - { - size_t id = sp->GetScoreBookkeepingID(); - const size_t begin = m_sim->GetBeginIndex(id); - const size_t end = m_sim->GetEndIndex(id); - std::vector<float> res(end-begin); - size_t j = 0; - for (size_t i = begin; i < end; i++) { - res[j++] = m_scores[i]; - } - return res; - } - - //! if a ScoreProducer produces a single score (for example, a language model score) - //! this will return it. If not, this method will throw - float GetScoreForProducer(const ScoreProducer* sp) const - { - size_t id = sp->GetScoreBookkeepingID(); - const size_t begin = m_sim->GetBeginIndex(id); -#ifndef NDEBUG - const size_t end = m_sim->GetEndIndex(id); - assert(end-begin == 1); -#endif - return m_scores[begin]; - } - -}; - -inline std::ostream& operator<<(std::ostream& os, const ScoreComponentCollection2& rhs) -{ - os << "<<" << rhs.m_scores[0]; - for (size_t i=1; i<rhs.m_scores.size(); i++) - os << ", " << rhs.m_scores[i]; - return os << ">>"; -} - diff --git a/moses/src/ScoreIndexManager.cpp b/moses/src/ScoreIndexManager.cpp deleted file mode 100644 index 285cbcbfb..000000000 --- a/moses/src/ScoreIndexManager.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// $Id$ - -#include <iostream> -#include <string> -#include <assert.h> -#include "ScoreIndexManager.h" -#include "ScoreProducer.h" - -void ScoreIndexManager::AddScoreProducer(const ScoreProducer* sp) -{ - // Producers must be inserted in the order they are created - assert(m_begins.size() == (sp->GetScoreBookkeepingID())); - m_producers.push_back(sp); - m_begins.push_back(m_last); - size_t numScoreCompsProduced = sp->GetNumScoreComponents(); - assert(numScoreCompsProduced > 0); - m_last += numScoreCompsProduced; - m_ends.push_back(m_last); - std::cerr << "AddScoreProducer(" << sp << "): id=" << sp->GetScoreBookkeepingID() << ", new last=" << m_last << std::endl; -} - -std::ostream& operator<<(std::ostream& os, const ScoreIndexManager& sim) -{ - size_t cur_i = 0; - size_t cur_scoreType = 0; - while (cur_i < sim.m_last) { - bool first = true; - while (cur_i < sim.m_ends[cur_scoreType]) { - os << " " << (cur_i < 10 ? " " : "") << cur_i << " "; - if (first) { - os << sim.m_producers[cur_scoreType]->GetScoreProducerDescription() - << std::endl; - first = false; - } else { - os << " \" \"" << std::endl; - } - cur_i++; - } - cur_scoreType++; - } - return os; -} - diff --git a/moses/src/ScoreIndexManager.h b/moses/src/ScoreIndexManager.h deleted file mode 100644 index 43f16e262..000000000 --- a/moses/src/ScoreIndexManager.h +++ /dev/null @@ -1,30 +0,0 @@ -// $Id$ - -#ifndef _SCORE_INDEX_MANAGER_H_ -#define _SCORE_INDEX_MANAGER_H_ - -#include <iostream> -#include <vector> - -class ScoreProducer; - -class ScoreIndexManager -{ - friend std::ostream& operator<<(std::ostream& os, const ScoreIndexManager& sim); -public: - ScoreIndexManager() : m_last(0) {} - void AddScoreProducer(const ScoreProducer* producer); - size_t GetBeginIndex(size_t scoreBookkeepingID) const { return m_begins[scoreBookkeepingID]; } - size_t GetEndIndex(size_t scoreBookkeepingID) const { return m_ends[scoreBookkeepingID]; } - size_t GetTotalNumberOfScores() const { return m_last; } - -private: - ScoreIndexManager(const ScoreIndexManager&); // don't implement - - std::vector<size_t> m_begins; - std::vector<size_t> m_ends; - std::vector<const ScoreProducer*> m_producers; - size_t m_last; -}; - -#endif diff --git a/moses/src/ScoreProducer.cpp b/moses/src/ScoreProducer.cpp deleted file mode 100644 index 3986fa3bb..000000000 --- a/moses/src/ScoreProducer.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// $Id$ - -#include <iostream> -#include <typeinfo> -#include "ScoreProducer.h" -#include "StaticData.h" -#include "ScoreIndexManager.h" - -unsigned int ScoreProducer::s_globalScoreBookkeepingIdCounter(0); - -ScoreProducer::~ScoreProducer() {} - -ScoreProducer::ScoreProducer() -{ - m_scoreBookkeepingId = s_globalScoreBookkeepingIdCounter++; - std::cerr << "ScoreProducer created (id=" << m_scoreBookkeepingId << ", this=" << this << ")\n"; -} - diff --git a/moses/src/ScoreProducer.h b/moses/src/ScoreProducer.h deleted file mode 100644 index bd56a7a0d..000000000 --- a/moses/src/ScoreProducer.h +++ /dev/null @@ -1,40 +0,0 @@ -// $Id$ - -#ifndef _SCORE_PRODUCER_H_ -#define _SCORE_PRODUCER_H_ - -#include <string> - -class ScoreIndexManager; - -// to keep track of the various things that can produce a score, -// we use this evil implementation-inheritance to give them each -// a unique, sequential (read: good for vector indices) ID -// -// NOTE- do not confuse this with a producer/consumer pattern. -// this is not a producer in that sense. -class ScoreProducer -{ -private: - static unsigned int s_globalScoreBookkeepingIdCounter; - unsigned int m_scoreBookkeepingId; - - ScoreProducer(const ScoreProducer&); // don't implement -protected: - // it would be nice to force registration here, but some Producer objects - // are constructed before they know how many scores they have - ScoreProducer(); - virtual ~ScoreProducer(); - -public: - unsigned int GetScoreBookkeepingID() const { return m_scoreBookkeepingId; } - - //! returns the number of scores that a subclass produces. - // For example, a language model conventionally produces 1, a translation table some arbitrary number, etc - virtual unsigned int GetNumScoreComponents() const = 0; - - //! returns a string description of this producer - virtual const std::string GetScoreProducerDescription() const = 0; -}; - -#endif diff --git a/moses/src/Sentence.cpp b/moses/src/Sentence.cpp deleted file mode 100755 index 8c18c03eb..000000000 --- a/moses/src/Sentence.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ -#include "Sentence.h" -#include <boost/algorithm/string.hpp> -#include "PhraseDictionary.h" -#include "TranslationOptionCollectionText.h" -#include "StaticData.h" - -int Sentence::Read(std::istream& in,const std::vector<FactorType>& factorOrder, - FactorCollection &factorCollection) -{ - std::string line; - do - { - if (getline(in, line, '\n').eof()) return 0; - boost::trim(line); - } while (line == ""); - - CreateFromString(factorOrder, line, factorCollection); - return 1; -} - -TargetPhraseCollection const* Sentence:: -CreateTargetPhraseCollection(PhraseDictionaryBase const& d, - const WordsRange& r) const -{ - Phrase src=GetSubString(r); - return d.GetTargetPhraseCollection(src); -} - -TranslationOptionCollection* -Sentence::CreateTranslationOptionCollection() const -{ - size_t maxNoTransOptPerCoverage = StaticData::Instance()->GetMaxNoTransOptPerCoverage(); - return new TranslationOptionCollectionText(*this, maxNoTransOptPerCoverage); -} -void Sentence::Print(std::ostream& out) const -{ - out<<*static_cast<Phrase const*>(this)<<"\n"; -} diff --git a/moses/src/Sentence.h b/moses/src/Sentence.h deleted file mode 100755 index 93d2675d6..000000000 --- a/moses/src/Sentence.h +++ /dev/null @@ -1,72 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <vector> -#include <string> -#include "Word.h" -#include "Phrase.h" -#include "Input.h" - -class WordsRangs; -class PhraseDictionaryBase; -class TranslationOptionCollection; - - -/*** - * a Sentence is a Phrase with an ID - */ -class Sentence : public Phrase, public InputType -{ - protected: - Sentence() - { - } - public: - Sentence(FactorDirection direction) : Phrase(direction), InputType() - { - } - - Phrase GetSubString(const WordsRange& r) const - { - return Phrase::GetSubString(r); - } - std::string GetStringRep(const WordsRange& r) const - { - return Phrase::GetStringRep(r); - } - const FactorArray& GetFactorArray(size_t pos) const - { - return Phrase::GetFactorArray(pos); - } - size_t GetSize() const - { - return Phrase::GetSize(); - } - - int Read(std::istream& in,const std::vector<FactorType>& factorOrder, FactorCollection &factorCollection); - void Print(std::ostream& out) const; - - TargetPhraseCollection const* CreateTargetPhraseCollection(PhraseDictionaryBase const& d,const WordsRange& r) const; - TranslationOptionCollection* CreateTranslationOptionCollection() const; -}; - diff --git a/moses/src/SentenceStats.h b/moses/src/SentenceStats.h deleted file mode 100644 index e3c1715b2..000000000 --- a/moses/src/SentenceStats.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _SENTENCE_STATS_H_ -#define _SENTENCE_STATS_H_ - -#include <iostream> - -struct SentenceStats -{ - SentenceStats() : numRecombinations(0), numPruned(0) {}; - unsigned int numRecombinations; - unsigned int numPruned; - - void ZeroAll() { numRecombinations = 0; numPruned = 0; } -}; - -inline std::ostream& operator<<(std::ostream& os, const SentenceStats& ss) -{ - return os << "number of hypotheses recombined=" << ss.numRecombinations << std::endl - << " \" \" pruned=" << ss.numPruned << std::endl; -} - -#endif diff --git a/moses/src/SquareMatrix.cpp b/moses/src/SquareMatrix.cpp deleted file mode 100644 index 347837f9b..000000000 --- a/moses/src/SquareMatrix.cpp +++ /dev/null @@ -1,11 +0,0 @@ - - -#include <string> -#include <iostream> -#include "SquareMatrix.h" -#include "TypeDef.h" -#include "Util.h" - -using namespace std; - -TO_STRING_BODY(SquareMatrix); diff --git a/moses/src/SquareMatrix.h b/moses/src/SquareMatrix.h deleted file mode 100644 index a91c66eff..000000000 --- a/moses/src/SquareMatrix.h +++ /dev/null @@ -1,75 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <iostream> -#include "TypeDef.h" -#include "Util.h" - -class SquareMatrix -{ - friend std::ostream& operator<<(std::ostream &out, const SquareMatrix &matrix); -protected: - const size_t m_size; - float *m_array; - - SquareMatrix(); // not implemented - SquareMatrix(const SquareMatrix ©); // not implemented - -public: - SquareMatrix(size_t size) - :m_size(size) - { - m_array = (float*) malloc(sizeof(float) * size * size); - } - ~SquareMatrix() - { - free(m_array); - } - inline size_t GetSize() const - { - return m_size; - } - inline float GetScore(size_t row, size_t col) const - { - return m_array[row * m_size + col]; - } - inline void SetScore(size_t row, size_t col, float value) - { - m_array[row * m_size + col] = value; - } - - TO_STRING; -}; - -inline std::ostream& operator<<(std::ostream &out, const SquareMatrix &matrix) -{ - for (size_t col = 0 ; col < matrix.GetSize() ; col++) - { - for (size_t row = 0 ; row < matrix.GetSize() ; row++) - TRACE_ERR(matrix.GetScore(row, col) << " "); - TRACE_ERR(std::endl); - } - - return out; -} - diff --git a/moses/src/StaticData.cpp b/moses/src/StaticData.cpp deleted file mode 100755 index 4b90fb2c1..000000000 --- a/moses/src/StaticData.cpp +++ /dev/null @@ -1,615 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include <string> -#include <cassert> - -#include "PhraseDictionary.h" -#include "GenerationDictionary.h" -#include "DummyScoreProducers.h" -#include "StaticData.h" -#include "Util.h" -#include "FactorCollection.h" -#include "HypothesisCollection.h" -#include "Timer.h" -#include "boost/filesystem/operations.hpp" // boost::filesystem::exists -#include "boost/algorithm/string/case_conv.hpp" //boost::algorithm::to_lower -#include "LanguageModel.h" -#include "LanguageModelFactory.h" -#include "LexicalReordering.h" -#include "SentenceStats.h" - -#ifndef WIN32 -#include "PhraseDictionaryTreeAdaptor.h" -#endif - -using namespace std; - -extern Timer timer; - -StaticData* StaticData::s_instance(0); - -StaticData::StaticData() -:m_lexReorder(NULL) -,m_inputOutput(NULL) -,m_fLMsLoaded(false) -,m_inputType(0) -,m_numInputScores(0) -,m_distortionScoreProducer(0) -,m_wpProducer(0) -,m_useDistortionFutureCosts(0) -{ - s_instance = this; - - // mempory pools - Phrase::InitializeMemPool(); - -} - -bool StaticData::LoadParameters(int argc, char* argv[]) -{ - if (!m_parameter.LoadParam(argc, argv)) - return false; - - // input type has to specified BEFORE loading the phrase tables! - if(m_parameter.GetParam("inputtype").size()) - m_inputType=Scan<int>(m_parameter.GetParam("inputtype")[0]); - TRACE_ERR("input type is: "<<m_inputType<<" (0==default: text input, else confusion net format)\n"); - - // mysql - m_mySQLParam = m_parameter.GetParam("mysql"); - - if (m_parameter.GetParam("cache-path").size() == 1) - m_cachePath = m_parameter.GetParam("cache-path")[0]; - else - m_cachePath = GetTempFolder(); - - // n-best - if (m_parameter.GetParam("n-best-list").size() == 2) - { - m_nBestFilePath = m_parameter.GetParam("n-best-list")[0]; - m_nBestSize = Scan<size_t>( m_parameter.GetParam("n-best-list")[1] ); - } - else - { - m_nBestSize = 0; - } - - // verbose level - if (m_parameter.GetParam("verbose").size() == 1) - { - m_verboseLevel = 1; - m_verboseLevel = Scan<size_t>( m_parameter.GetParam("verbose")[0]); - } - else - { - m_verboseLevel = 0; - } - - - // printing source phrase spans - if (m_parameter.GetParam("report-source-span").size() > 0) - m_reportSourceSpan = Scan<bool>(m_parameter.GetParam("report-source-span")[0]); - else - m_reportSourceSpan = false; - - - // print all factors of output translations - if (m_parameter.GetParam("report-all-factors").size() > 0) - m_reportAllFactors = Scan<bool>(m_parameter.GetParam("report-all-factors")[0]); - else - m_reportAllFactors = false; - - //distortion weights - std::vector<float> distortionWeights = Scan<float>(m_parameter.GetParam("weight-d")); - - - - //input-factors - const vector<string> &inputFactorVector = m_parameter.GetParam("input-factors"); - for(size_t i=0; i<inputFactorVector.size(); i++) - { - m_inputFactorOrder.push_back(Scan<FactorType>(inputFactorVector[i])); - } - if(m_inputFactorOrder.empty()) - { - std::cerr<<"ERROR: no input factor specified in config file" - " (param input-factors) -> abort!\n"; - abort(); - } - - //output-factors - const vector<string> &outputFactorVector = m_parameter.GetParam("output-factors"); - for(size_t i=0; i<outputFactorVector.size(); i++) - { - m_outputFactorOrder.push_back(Scan<FactorType>(outputFactorVector[i])); - } - if(m_outputFactorOrder.empty()) - { // default. output factor 0 - m_outputFactorOrder.push_back(0); - } - - //source word deletion - if(m_parameter.GetParam("phrase-drop-allowed").size() > 0) - { - m_wordDeletionEnabled = Scan<bool>(m_parameter.GetParam("phrase-drop-allowed")[0]); - } - else - { - m_wordDeletionEnabled = false; - } - // load Lexical Reordering model - // check to see if the lexical reordering parameter exists - //TODO: doesn't work for bidirectional: yet. - const vector<string> &lrFileVector = - m_parameter.GetParam("distortion-file"); - - if (lrFileVector.size() > 0) - { - //get the weights for the lex reorderer - TRACE_ERR("weights-lex") - for(int i=1; i<distortionWeights.size(); i++) - { - m_lexWeights.push_back(distortionWeights[i]); - TRACE_ERR(distortionWeights[i] << "\t"); - } - TRACE_ERR(endl); - assert(m_lexWeights.size()>0); - - // if there is a lexical reordering model, then parse the - // parameters associated with it, and create a new Lexical - // Reordering object (which will load the probability table) - const vector<string> &lrTypeVector = - m_parameter.GetParam("distortion"); - // if type values have been set in the .ini file, then use them; - // first initialize to the defaults (msd, bidirectional, fe). - int orientation = DistortionOrientationType::Msd, - direction = LexReorderType::Bidirectional, - condition = LexReorderType::Fe; - if (lrTypeVector.size() > 0) - { - // loop through type vector and set the orientation, - // direction, and condition to override the defaults - int size = lrTypeVector.size(); - string val; - //if multiple parameters of the same type (direction, orientation, condition) - //are seen, default behavior is to set the type to the last seen - for (int i=0; i<size; i++) - { - val = lrTypeVector[i]; - boost::algorithm::to_lower(val); - //TODO:Lowercase val! - //orientation - if(val == "monotone") - orientation = DistortionOrientationType::Monotone; - else if(val == "msd") - orientation = DistortionOrientationType::Msd; - //direction - else if(val == "forward") - direction = LexReorderType::Forward; - else if(val == "backward") - direction = LexReorderType::Backward; - else if(val == "bidirectional") - direction = LexReorderType::Bidirectional; - //condition - else if(val == "f") - condition = LexReorderType::F; - else if(val == "fe") - condition = LexReorderType::Fe; - } - } - else // inform the user that the defaults are being employed - { - //cout << "Lexical reordering is using defaults: Msd, Bidirectional, Fe Parameters" << endl; - } - - // for now, assume there is just one lexical reordering model - timer.check("Starting to load lexical reorder table..."); - m_lexReorder = new LexicalReordering(lrFileVector[0], orientation, direction, condition, m_lexWeights); - timer.check("Finished loading lexical reorder table."); - } - if (m_parameter.GetParam("lmodel-file").size() > 0) - { - // weights - vector<float> weightAll = Scan<float>(m_parameter.GetParam("weight-l")); - - TRACE_ERR("weight-l: "); - for (size_t i = 0 ; i < weightAll.size() ; i++) - { - TRACE_ERR(weightAll[i] << "\t"); - m_allWeights.push_back(weightAll[i]); - } - TRACE_ERR(endl); - - - size_t nGramMaxOrder = 0; - timer.check("Start loading LanguageModels"); - const vector<string> &lmVector = m_parameter.GetParam("lmodel-file"); - - for(size_t i=0; i<lmVector.size(); i++) - { - vector<string> token = Tokenize(lmVector[i]); - if (token.size() != 4 ) - { - TRACE_ERR("Expected format 'LM-TYPE FACTOR-TYPE NGRAM-ORDER filename'"); - return false; - } - // type = whether or not to use in future cost calcs - - // factorType = (see TypeDef.h) - // 0 = Surface, 1 = POS, 2 = Stem, 3 = Morphology, etc - FactorType factorType = Scan<FactorType>(token[1]); - // nGramOrder = 2 = bigram, 3 = trigram, etc - size_t nGramOrder = Scan<int>(token[2]); - // keep track of the largest n-gram length - // (used by CompareHypothesisCollection) - if (nGramOrder > nGramMaxOrder) // remove - nGramMaxOrder = nGramOrder; // remove - string &languageModelFile = token[3]; - if ((size_t)factorType >= m_maxNgramOrderForFactor.size()) { - m_maxNgramOrderForFactor.resize((size_t)factorType+1, 0); - } - if (nGramOrder > m_maxNgramOrderForFactor[(size_t)factorType]) { - m_maxNgramOrderForFactor[(size_t)factorType] = nGramOrder; - } - timer.check(("Start loading LanguageModel " + languageModelFile).c_str()); - LanguageModel *lm = LanguageModelFactory::createLanguageModel(); - - // error handling here? - lm->Load(languageModelFile, m_factorCollection, factorType, weightAll[i], nGramOrder); - timer.check(("Finished loading LanguageModel " + languageModelFile).c_str()); - m_languageModel.push_back(lm); - - HypothesisRecombinationOrderer::SetMaxNGramOrder(factorType, nGramMaxOrder); - } - } - // flag indicating that language models were loaded, - // since phrase table loading requires their presence - m_fLMsLoaded = true; - timer.check("Finished loading LanguageModels"); - - // generation tables - if (m_parameter.GetParam("generation-file").size() > 0) - { - const vector<string> &generationVector = m_parameter.GetParam("generation-file"); - const vector<float> &weight = Scan<float>(m_parameter.GetParam("weight-generation")); - - TRACE_ERR("weight-generation: "); - for (size_t i = 0 ; i < weight.size() ; i++) - { - TRACE_ERR(weight[i] << "\t"); - } - TRACE_ERR(endl); - - for(size_t currDict = 0 ; currDict < generationVector.size(); currDict++) - { - vector<string> token = Tokenize(generationVector[currDict]); - vector<FactorType> input = Tokenize<FactorType>(token[0], ",") - ,output = Tokenize<FactorType>(token[1], ","); - string filePath= token[2]; - - m_allWeights.push_back(weight[currDict]); - TRACE_ERR(filePath << endl); - m_generationDictionary.push_back(new GenerationDictionary()); - m_generationDictionary.back()->Load(input - , output - , m_factorCollection - , filePath - , weight[currDict] - , Output); // always target, for now - } - } - - timer.check("Finished loading generation tables"); - - // score weights - m_weightDistortion = distortionWeights[0]; - m_weightWordPenalty = Scan<float>( m_parameter.GetParam("weight-w")[0] ); - - TRACE_ERR("weight-d: " << m_weightDistortion << endl); - m_distortionScoreProducer = new DistortionScoreProducer; - m_allWeights.push_back(m_weightDistortion); - - TRACE_ERR("weight-w: " << m_weightWordPenalty << endl); - m_wpProducer = new WordPenaltyProducer; - m_allWeights.push_back(m_weightWordPenalty); - - // misc - m_maxHypoStackSize = (m_parameter.GetParam("stack").size() > 0) - ? Scan<size_t>(m_parameter.GetParam("stack")[0]) : DEFAULT_MAX_HYPOSTACK_SIZE; - m_maxDistortion = (m_parameter.GetParam("distortion-limit").size() > 0) ? - Scan<int>(m_parameter.GetParam("distortion-limit")[0]) - : -1; - m_useDistortionFutureCosts = (m_parameter.GetParam("use-distortion-future-costs").size() > 0) - ? Scan<int>(m_parameter.GetParam("use-distortion-future-costs")[0]) : 0; - m_beamThreshold = (m_parameter.GetParam("beam-threshold").size() > 0) ? - TransformScore(Scan<float>(m_parameter.GetParam("beam-threshold")[0])) - : TransformScore(DEFAULT_BEAM_THRESHOLD); - - m_maxNoTransOptPerCoverage = (m_parameter.GetParam("max-trans-opt-per-coverage").size() > 0) - ? Scan<size_t>(m_parameter.GetParam("max-trans-opt-per-coverage")[0]) : DEFAULT_MAX_TRANS_OPT_SIZE; - TRACE_ERR("max translation options per coverage span: "<<m_maxNoTransOptPerCoverage<<"\n"); - - // Unknown Word Processing -- wade - //TODO replace this w/general word dropping -- EVH - if (m_parameter.GetParam("drop-unknown").size() == 1) - { m_dropUnknown = Scan<bool>( m_parameter.GetParam("drop-unknown")[0]); } - else - { m_dropUnknown = 0; } - - TRACE_ERR("m_dropUnknown: " << m_dropUnknown << endl); - - return true; -} - -StaticData::~StaticData() -{ - delete m_inputOutput; - for (size_t i = 0 ; i < m_phraseDictionary.size() ; i++) - { - delete m_phraseDictionary[i]; - } - for (size_t i = 0 ; i < m_generationDictionary.size() ; i++) - { - delete m_generationDictionary[i]; - } - - LMList::const_iterator iterLM; - for (iterLM = m_languageModel.begin() ; iterLM != m_languageModel.end() ; ++iterLM) - { - delete *iterLM; - } - // small score producers - delete m_distortionScoreProducer; - delete m_wpProducer; - - // memory pools - Phrase::FinalizeMemPool(); - -} - -IOMethod StaticData::GetIOMethod() -{ - if (m_mySQLParam.size() == 6) - return IOMethodMySQL; - else if (m_parameter.GetParam("input-file").size() == 1) - return IOMethodFile; - else - return IOMethodCommandLine; -} - -void StaticData::SetWeightTransModel(const vector<float> &weight) -{ - size_t currWeight = 0; - for(vector<PhraseDictionaryBase*>::iterator iter = m_phraseDictionary.begin(); - iter != m_phraseDictionary.end(); ++iter) - { - PhraseDictionaryBase *phraseDict = *iter; - const size_t noScoreComponent = phraseDict->GetNumScoreComponents(); - // weights for this particular dictionary - vector<float> dictWeight(noScoreComponent); - for (size_t i = 0 ; i < noScoreComponent ; i++) - { - dictWeight[i] = weight[currWeight++]; - } - phraseDict->SetWeightTransModel(dictWeight); - } -} - -void StaticData::SetWeightLM(const std::vector<float> &weight) -{ - assert(weight.size() == m_languageModel.size()); - - size_t currIndex = 0; - LMList::iterator iter; - for (iter = m_languageModel.begin() ; iter != m_languageModel.end() ; ++iter) - { - LanguageModel *languageModel = *iter; - languageModel->SetWeight(weight[currIndex++]); - } -} - -void StaticData::SetWeightGeneration(const std::vector<float> &weight) -{ - assert(weight.size() == GetGenerationDictionarySize()); - - size_t currWeight = 0; - vector<GenerationDictionary*>::iterator iter; - for(iter = m_generationDictionary.begin() ; iter != m_generationDictionary.end(); ++iter) - { - GenerationDictionary *dict = *iter; - dict->SetWeight(weight[currWeight++]); - } -} - -void StaticData::LoadPhraseTables(bool filter - , const string &inputFileHash - , const list< Phrase > &inputPhraseList) -{ - // language models must be loaded prior to loading phrase tables - assert(m_fLMsLoaded); - // load phrase translation tables - if (m_parameter.GetParam("ttable-file").size() > 0) - { - // weights - vector<float> weightAll = Scan<float>(m_parameter.GetParam("weight-t")); - - TRACE_ERR("weight-t: "); - for (size_t i = 0 ; i < weightAll.size() ; i++) - { - TRACE_ERR(weightAll[i] << "\t"); - } - TRACE_ERR(endl); - - const vector<string> &translationVector = m_parameter.GetParam("ttable-file"); - vector<size_t> maxTargetPhrase = Scan<size_t>(m_parameter.GetParam("ttable-limit")); - cerr<<"ttable-limits: ";copy(maxTargetPhrase.begin(),maxTargetPhrase.end(),ostream_iterator<size_t>(cerr," "));cerr<<"\n"; - - size_t index = 0; - size_t totalPrevNoScoreComponent = 0; - for(size_t currDict = 0 ; currDict < translationVector.size(); currDict++) - { - vector<string> token = Tokenize(translationVector[currDict]); - //characteristics of the phrase table - vector<FactorType> input = Tokenize<FactorType>(token[0], ",") - ,output = Tokenize<FactorType>(token[1], ","); - string filePath= token[3]; - size_t noScoreComponent = Scan<size_t>(token[2]); - // weights for this phrase dictionary - vector<float> weight(noScoreComponent); - for (size_t currScore = 0 ; currScore < noScoreComponent ; currScore++) - weight[currScore] = weightAll[totalPrevNoScoreComponent + currScore]; - - if(weight.size()!=noScoreComponent) - { - std::cerr<<"ERROR: your phrase table has "<<noScoreComponent<<" scores, but you specified "<<weight.size()<<" weights!\n"; - abort(); - } - - if(currDict==0 && m_inputType) - { - m_numInputScores=m_parameter.GetParam("weight-i").size(); - for(unsigned k=0;k<m_numInputScores;++k) - weight.push_back(Scan<float>(m_parameter.GetParam("weight-i")[k])); - - noScoreComponent+=m_numInputScores; - } - - assert(noScoreComponent==weight.size()); - - std::copy(weight.begin(),weight.end(),std::back_inserter(m_allWeights)); - - totalPrevNoScoreComponent += noScoreComponent; - string phraseTableHash = GetMD5Hash(filePath); - string hashFilePath = GetCachePath() - + PROJECT_NAME + "--" - + token[0] + "--" - + inputFileHash + "--" - + phraseTableHash + ".txt"; - - timer.check("Start loading PhraseTable"); - using namespace boost::filesystem; - if (!exists(path(filePath+".binphr.idx", native))) - { - bool filterPhrase; - if (filter) - { - boost::filesystem::path tempFile(hashFilePath, boost::filesystem::native); - if (boost::filesystem::exists(tempFile)) - { // load filtered file instead - filterPhrase = false; - filePath = hashFilePath; - } - else - { // load original file & create has file - filterPhrase = true; - } - } - else - { // load original file - filterPhrase = false; - } - TRACE_ERR(filePath << endl); - - - TRACE_ERR("using standard phrase tables"); - PhraseDictionary *pd=new PhraseDictionary(noScoreComponent); - pd->Load(input - , output - , m_factorCollection - , filePath - , hashFilePath - , weight - , maxTargetPhrase[index] - , filterPhrase - , inputPhraseList - , GetAllLM() - , GetWeightWordPenalty() - , *this); - m_phraseDictionary.push_back(pd); - } - else - { - #ifdef WIN32 - TRACE_ERR("binary phrase tables not available under Windows\n"); - assert(false); - #else - TRACE_ERR("using binary phrase tables for idx "<<currDict<<"\n"); - PhraseDictionaryTreeAdaptor *pd=new PhraseDictionaryTreeAdaptor(noScoreComponent,(currDict==0 ? m_numInputScores : 0)); - pd->Create(input,output,m_factorCollection,filePath,weight, - maxTargetPhrase[index], - GetAllLM(), - GetWeightWordPenalty()); - m_phraseDictionary.push_back(pd); - #endif - } - - index++; - timer.check("Finished loading PhraseTable"); - } - } - timer.check("Finished loading phrase tables"); -} - -void StaticData::LoadMapping() -{ - // mapping - const vector<string> &mappingVector = m_parameter.GetParam("mapping"); - for(size_t i=0; i<mappingVector.size(); i++) - { - vector<string> token = Tokenize(mappingVector[i]); - if (token.size() == 2) - { - DecodeType decodeType = token[0] == "T" ? Translate : Generate; - size_t index = Scan<size_t>(token[1]); - DecodeStep decodeStep (decodeType - ,decodeType == Translate ? (Dictionary*) m_phraseDictionary[index] : (Dictionary*) m_generationDictionary[index]); - m_decodeStepList.push_back(decodeStep); - } - } -} - -void StaticData::CleanUpAfterSentenceProcessing() -{ - for(size_t i=0;i<m_phraseDictionary.size();++i) - m_phraseDictionary[i]->CleanUp(); - for(size_t i=0;i<m_generationDictionary.size();++i) - m_generationDictionary[i]->CleanUp(); -} - -void StaticData::InitializeBeforeSentenceProcessing(InputType const& in) -{ - for(size_t i=0;i<m_phraseDictionary.size();++i) - m_phraseDictionary[i]->InitializeForInput(in); -} - -void StaticData::SetWeightsForScoreProducer(const ScoreProducer* sp, const std::vector<float>& weights) -{ - const size_t id = sp->GetScoreBookkeepingID(); - const size_t begin = m_scoreIndexManager.GetBeginIndex(id); - const size_t end = m_scoreIndexManager.GetEndIndex(id); - assert(end - begin == weights.size()); - if (m_allWeights.size() < end) - m_allWeights.resize(end); - std::vector<float>::const_iterator weightIter = weights.begin(); - for (size_t i = begin; i < end; i++) - m_allWeights[i] = *weightIter++; -} diff --git a/moses/src/StaticData.h b/moses/src/StaticData.h deleted file mode 100755 index 36e0be369..000000000 --- a/moses/src/StaticData.h +++ /dev/null @@ -1,302 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <list> -#include <vector> -#include <boost/shared_ptr.hpp> -#include "TypeDef.h" -#include "ScoreIndexManager.h" -#include "FactorCollection.h" -#include "Parameter.h" -#include "LanguageModel.h" -#include "InputOutput.h" -#include "DecodeStep.h" -#include "LMList.h" -#include "SentenceStats.h" -//#include "UnknownWordHandler.h" - -class InputType; -class LexicalReordering; -class PhraseDictionaryBase; -class GenerationDictionary; -class DistortionScoreProducer; -class WordPenaltyProducer; - -class StaticData -{ -private: - static StaticData* s_instance; -protected: - FactorCollection m_factorCollection; - std::vector<PhraseDictionaryBase*> m_phraseDictionary; - std::vector<GenerationDictionary*> m_generationDictionary; - std::list < DecodeStep > m_decodeStepList; - Parameter m_parameter; - std::vector<FactorType> m_inputFactorOrder, m_outputFactorOrder; -// boost::shared_ptr<UnknownWordHandler> m_unknownWordHandler; //defaults to NULL; pointer allows polymorphism - LMList m_languageModel; - std::vector<float> m_lexWeights; - ScoreIndexManager m_scoreIndexManager; - std::vector<float> m_allWeights; - LexicalReordering *m_lexReorder; - // Initial = 0 = can be used when creating poss trans - // Other = 1 = used to calculate LM score once all steps have been processed - float - m_beamThreshold, - m_weightDistortion, - m_weightWordPenalty, - m_wordDeletionWeight; - // PhraseTrans, Generation & LanguageModelScore has multiple weights. - int m_maxDistortion; - // do it differently from old pharaoh - // -ve = no limit on distortion - // 0 = no disortion (monotone in old pharaoh) - size_t - m_maxHypoStackSize //hypothesis-stack size that triggers pruning - , m_nBestSize - , m_maxNoTransOptPerCoverage; - - std::string m_nBestFilePath, m_cachePath; - std::vector<std::string> m_mySQLParam; - InputOutput *m_inputOutput; - bool m_fLMsLoaded; - std::vector<size_t> m_maxNgramOrderForFactor; - /*** - * false = treat unknown words as proper nouns, and translate them as themselves; - * true = drop (ignore) them - */ - bool m_dropUnknown; - bool m_wordDeletionEnabled; - - int m_inputType; - unsigned m_numInputScores; - - size_t m_verboseLevel; - DistortionScoreProducer *m_distortionScoreProducer; - WordPenaltyProducer *m_wpProducer; - bool m_reportSourceSpan; - bool m_reportAllFactors; - - mutable SentenceStats m_sentenceStats; - - int m_useDistortionFutureCosts; - - - -public: - StaticData(); - ~StaticData(); - - static const StaticData* Instance() { return s_instance; } - - /*** - * also initialize the Parameter object - */ - bool LoadParameters(int argc, char* argv[]); - - /*** - * load not only the main phrase table but also any auxiliary tables that depend on which features are being used - * (eg word-deletion, word-insertion tables) - */ - void LoadPhraseTables(bool filter - , const std::string &inputFileHash - , const std::list< Phrase > &inputPhraseList); - void LoadPhraseTables() - { - LoadPhraseTables(false, "", std::list< Phrase >()); - } - void LoadMapping(); -/* void SetUnknownWordHandler(boost::shared_ptr<UnknownWordHandler> unknownWordHandler) - { - m_unknownWordHandler = unknownWordHandler; - } -*/ - const PARAM_VEC &GetParam(const std::string ¶mName) - { - return m_parameter.GetParam(paramName); - } - - InputOutput &GetInputOutput() - { - return *m_inputOutput; - } - - const std::vector<FactorType> &GetInputFactorOrder() const - { - return m_inputFactorOrder; - } - const std::vector<FactorType> &GetOutputFactorOrder() const - { - return m_outputFactorOrder; - } - - std::list < DecodeStep > &GetDecodeStepList() - { - return m_decodeStepList; - } - - inline bool GetDropUnknown() const - { - return m_dropUnknown; - } - inline size_t GetMaxNoTransOptPerCoverage() const - { - return m_maxNoTransOptPerCoverage; - } - FactorCollection &GetFactorCollection() - { - return m_factorCollection; - } - size_t GetMaxNGramOrderForFactorId(size_t factorType) const - { - if (factorType >= m_maxNgramOrderForFactor.size()) return 0; - return m_maxNgramOrderForFactor[factorType]; - } - LexicalReordering *GetLexReorder() const - { - return m_lexReorder; - } - float GetWeightDistortion() const - { - return m_weightDistortion; - } - float GetWeightWordPenalty() const - { - return m_weightWordPenalty; - } - bool IsWordDeletionEnabled() const - { - return m_wordDeletionEnabled; - } - size_t GetMaxHypoStackSize() const - { - return m_maxHypoStackSize; - } - int GetMaxDistortion() const - { - return m_maxDistortion; - } - float GetBeamThreshold() const - { - return m_beamThreshold; - } - //! returns the total number of score components across all types, all factors - size_t GetTotalScoreComponents() const - { - return m_scoreIndexManager.GetTotalNumberOfScores(); - } - const ScoreIndexManager& GetScoreIndexManager() const - { - return m_scoreIndexManager; - } - IOMethod GetIOMethod(); - const std::vector<std::string> &GetMySQLParam() - { - return m_mySQLParam; - } - - size_t GetLMSize() const - { - return m_languageModel.size(); - } - const LMList &GetAllLM() const - { - return m_languageModel; - } - size_t GetPhraseDictionarySize() const - { - return m_phraseDictionary.size(); - } - std::vector<PhraseDictionaryBase*> GetPhraseDictionaries() const - { - return m_phraseDictionary; - } - std::vector<GenerationDictionary*> GetGenerationDictionaries() const - { - return m_generationDictionary; - } - size_t GetGenerationDictionarySize() const - { - return m_generationDictionary.size(); - } - const std::string GetCachePath() const - { - return m_cachePath; - } - size_t GetVerboseLevel() const - { - return m_verboseLevel; - } - bool GetReportSourceSpan() const - { - return m_reportSourceSpan; - } - bool GetReportAllFactors() const - { - return m_reportAllFactors; - } - - // for mert - size_t GetNBestSize() const - { - return m_nBestSize; - } - const std::string &GetNBestFilePath() const - { - return m_nBestFilePath; - } - // TODO use IsNBestEnabled instead of conditional compilation - const bool IsNBestEnabled() const { - return !m_nBestFilePath.empty(); - } - void SetWeightDistortion(float weightDistortion) - { - m_weightDistortion = weightDistortion; - } - void SetWeightWordPenalty(float weightWordPenalty) - { - m_weightWordPenalty = weightWordPenalty; - } -//! Sets the global score vector weights for a given ScoreProducer. - void SetWeightsForScoreProducer(const ScoreProducer* sp, const std::vector<float>& weights); - void SetWeightTransModel(const std::vector<float> &weight); - void SetWeightLM(const std::vector<float> &weight); - void SetWeightGeneration(const std::vector<float> &weight); - int GetInputType() const {return m_inputType;} - unsigned GetNumInputScores() const {return m_numInputScores;} - void InitializeBeforeSentenceProcessing(InputType const&); - void CleanUpAfterSentenceProcessing(); - SentenceStats& GetSentenceStats() const - { - return m_sentenceStats; - } - const std::vector<float>& GetAllWeights() const - { - return m_allWeights; - } - const DistortionScoreProducer *GetDistortionScoreProducer() const { return m_distortionScoreProducer; } - const WordPenaltyProducer *GetWordPenaltyProducer() const { return m_wpProducer; } - - bool UseDistortionFutureCosts() const {return m_useDistortionFutureCosts;} -}; - diff --git a/moses/src/TargetPhrase.cpp b/moses/src/TargetPhrase.cpp deleted file mode 100644 index d4bf30ee1..000000000 --- a/moses/src/TargetPhrase.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include <cassert> -#include "TargetPhrase.h" -#include "PhraseDictionary.h" -#include "GenerationDictionary.h" -#include "LanguageModel.h" -#include "StaticData.h" -#include "LMList.h" -#include "ScoreComponentCollection.h" - -using namespace std; - -TargetPhrase::TargetPhrase(FactorDirection direction) - :Phrase(direction),m_transScore(0.0), m_ngramScore(0.0), m_fullScore(0.0), m_sourcePhrase(0) -{ -} - -void TargetPhrase::SetScore(float weightWP) -{ // used when creating translations of unknown words: - m_transScore = m_ngramScore = 0; - m_fullScore = - weightWP; -} - -void TargetPhrase::SetScore(const ScoreProducer* translationScoreProducer, - const vector<float> &scoreVector, const vector<float> &weightT, - const LMList &languageModels, float weightWP) -{ - assert(weightT.size() == scoreVector.size()); - // calc average score if non-best - - m_transScore = std::inner_product(scoreVector.begin(),scoreVector.end(),weightT.begin(),0.0); - m_scoreBreakdown.PlusEquals(translationScoreProducer, scoreVector); - - // Replicated from TranslationOptions.cpp - float totalFutureScore = 0; - float totalNgramScore = 0; - float totalFullScore = 0; - - LMList::const_iterator lmIter; - for (lmIter = languageModels.begin(); lmIter != languageModels.end(); ++lmIter) - { - const LanguageModel &lm = **lmIter; - FactorType lmFactorType = lm.GetFactorType(); - - if (GetSize() > 0 && GetFactor(0, lmFactorType) != NULL) - { // contains factors used by this LM - const float weightLM = lm.GetWeight(); - float fullScore, nGramScore; - - lm.CalcScore(*this, fullScore, nGramScore); - m_scoreBreakdown.Assign(&lm, nGramScore); - - // total LM score so far - totalNgramScore += nGramScore * weightLM; - totalFullScore += fullScore * weightLM; - - } - } - m_ngramScore = totalNgramScore; - - m_fullScore = m_transScore + totalFutureScore + totalFullScore - - (this->GetSize() * weightWP); // word penalty -} - -void TargetPhrase::SetWeights(const ScoreProducer* translationScoreProducer, const vector<float> &weightT) -{ - // calling this function in case of confusion net input is undefined - assert(StaticData::Instance()->GetInputType()==0); - - /* one way to fix this, you have to make sure the weightT contains (in - addition to the usual phrase translation scaling factors) the input - weight factor as last element - */ - - m_transScore = m_scoreBreakdown.PartialInnerProduct(translationScoreProducer, weightT); -} - -void TargetPhrase::ResetScore() -{ - m_transScore = m_fullScore = m_ngramScore = 0; - m_scoreBreakdown.ZeroAll(); -} - -TargetPhrase *TargetPhrase::MergeNext(const TargetPhrase &inputPhrase) const -{ - if (! IsCompatible(inputPhrase)) - { - return NULL; - } - - // ok, merge - TargetPhrase *clone = new TargetPhrase(*this); - - int currWord = 0; - const size_t len = GetSize(); - for (size_t currPos = 0 ; currPos < len ; currPos++) - { - const FactorArray &inputWord = inputPhrase.GetFactorArray(currPos); - FactorArray &cloneWord = clone->GetFactorArray(currPos); - Word::Merge(cloneWord, inputWord); - - currWord++; - } - - return clone; -} - -TO_STRING_BODY(TargetPhrase); - -std::ostream& operator<<(std::ostream& os, const TargetPhrase& tp) -{ - os << static_cast<const Phrase&>(tp) << ", pC=" << tp.m_transScore << ", c=" << tp.m_fullScore; - return os; -} diff --git a/moses/src/TargetPhrase.h b/moses/src/TargetPhrase.h deleted file mode 100644 index e4f3110aa..000000000 --- a/moses/src/TargetPhrase.h +++ /dev/null @@ -1,112 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <vector> -#include "Phrase.h" -#include "ScoreComponentCollection.h" - -class LMList; -class PhraseDictionaryBase; -class GenerationDictionary; -class ScoreProducer; - -/** TargetPhrase represents a full entry in a phrase table (scores, translation) EXCEPT for the - * French side of the rule. - */ -class TargetPhrase: public Phrase -{ - friend std::ostream& operator<<(std::ostream&, const TargetPhrase&); -protected: - float m_transScore, m_ngramScore, m_fullScore; - ScoreComponentCollection2 m_scoreBreakdown; - - // in case of confusion net, ptr to source phrase - Phrase const* m_sourcePhrase; -public: - TargetPhrase(FactorDirection direction=Output); - - //! used by the unknown word handler- these targets - //! don't have a translation score, so wp is the only thing used - void SetScore(float weightWP); - - /*** Called immediately after creation to initialize scores. - * - * @param translationScoreProducer The PhraseDictionary that this TargetPhrase is contained by. - * Used to identify where the scores for this phrase belong in the list of all scores. - * @param scoreVector the vector of scores (log probs) associated with this translation - * @param weighT the weights for the individual scores (t-weights in the .ini file) - * @param languageModels all the LanguageModels that should be used to compute the LM scores - * @param weightWP the weight of the word penalty - * - * @TODO should this be part of the constructor? If not, add explanation why not. - */ - void SetScore(const ScoreProducer* translationScoreProducer, - const std::vector<float> &scoreVector, - const std::vector<float> &weightT, - const LMList &languageModels, - float weightWP); - - // used when creating translations of unknown words: - void ResetScore(); - void SetWeights(const ScoreProducer*, const std::vector<float> &weightT); - - TargetPhrase *MergeNext(const TargetPhrase &targetPhrase) const; - // used for translation step - - inline float GetTranslationScore() const - { - return m_transScore; - } - /*** - * return the estimated score resulting from our being added to a sentence - * (it's an estimate because we don't have full n-gram info for the language model - * without using the (unknown) full sentence) - * - */ - inline float GetFutureScore() const - { - return m_fullScore; - } - inline float GetNgramScore() const - { - return m_ngramScore; - } - inline const ScoreComponentCollection2 &GetScoreBreakdown() const - { - return m_scoreBreakdown; - } - - void SetSourcePhrase(Phrase const* p) - { - m_sourcePhrase=p; - } - Phrase const* GetSourcePhrase() const - { - return m_sourcePhrase; - } - - TO_STRING; -}; - -std::ostream& operator<<(std::ostream&, const TargetPhrase&); - diff --git a/moses/src/TargetPhraseCollection.h b/moses/src/TargetPhraseCollection.h deleted file mode 100644 index 5e6be58df..000000000 --- a/moses/src/TargetPhraseCollection.h +++ /dev/null @@ -1,27 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <list> -#include "TargetPhrase.h" -typedef std::list<TargetPhrase> TargetPhraseCollection; - diff --git a/moses/src/Timer.h b/moses/src/Timer.h deleted file mode 100644 index 6dd977e39..000000000 --- a/moses/src/Timer.h +++ /dev/null @@ -1,128 +0,0 @@ -#ifndef TIMER_H -#define TIMER_H - -#include <ctime> -#include <iostream> -#include <iomanip> -#include "Util.h" - -class Timer -{ - friend std::ostream& operator<<(std::ostream& os, Timer& t); - - private: - bool running; - time_t start_time; - - double elapsed_time(); - - public: - // 'running' is initially false. A timer needs to be explicitly started - // using 'start' or 'restart' - Timer() : running(false), start_time(0) { } - - void start(const char* msg = 0); -// void restart(const char* msg = 0); -// void stop(const char* msg = 0); - void check(const char* msg = 0); - -}; // class timer - -//=========================================================================== -// Return the total time that the timer has been in the "running" -// state since it was first "started" or last "restarted". For -// "short" time periods (less than an hour), the actual cpu time -// used is reported instead of the elapsed time. - -inline double Timer::elapsed_time() -{ - time_t now; - time(&now); - return difftime(now, start_time); -} // timer::elapsed_time - -//=========================================================================== -// Start a timer. If it is already running, let it continue running. -// Print an optional message. - -inline void Timer::start(const char* msg) -{ - // Print an optional message, something like "Starting timer t"; - if (msg) TRACE_ERR(msg << std::endl); - - // Return immediately if the timer is already running - if (running) return; - - // Change timer status to running - running = true; - - // Set the start time; - time(&start_time); - -} // timer::start - -//=========================================================================== -// Turn the timer off and start it again from 0. Print an optional message. -/* -inline void Timer::restart(const char* msg) -{ - // Print an optional message, something like "Restarting timer t"; - if (msg) TRACE_ERR(msg << std::endl); - - // Set the timer status to running - running = true; - - // Set the accumulated time to 0 and the start time to now - acc_time = 0; - start_clock = clock(); - start_time = time(0); - -} // timer::restart -*/ - -//=========================================================================== -// Stop the timer and print an optional message. -/* -inline void Timer::stop(const char* msg) -{ - // Print an optional message, something like "Stopping timer t"; - check(msg); - - // Recalculate and store the total accumulated time up until now - if (running) acc_time += elapsed_time(); - - running = false; - -} // timer::stop -*/ -//=========================================================================== -// Print out an optional message followed by the current timer timing. - -inline void Timer::check(const char* msg) -{ - // Print an optional message, something like "Checking timer t"; - if (msg) TRACE_ERR(msg << " : "); - - TRACE_ERR("[" << std::setiosflags(std::ios::fixed) << std::setprecision(2) - << (running ? elapsed_time() : 0) << "] seconds\n"); - -} // timer::check - -//=========================================================================== -// Allow timers to be printed to ostreams using the syntax 'os << t' -// for an ostream 'os' and a timer 't'. For example, "cout << t" will -// print out the total amount of time 't' has been "running". - -inline std::ostream& operator<<(std::ostream& os, Timer& t) -{ -#ifdef TRACE_ENABLE - os << std::setprecision(2) << std::setiosflags(std::ios::fixed) - << (t.running ? t.elapsed_time() : 0); -#endif - return os; -} - -//=========================================================================== - -#endif // TIMER_H - diff --git a/moses/src/TranslationOption.cpp b/moses/src/TranslationOption.cpp deleted file mode 100755 index ec9600670..000000000 --- a/moses/src/TranslationOption.cpp +++ /dev/null @@ -1,143 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include "TranslationOption.h" -#include "WordsBitmap.h" -#include "PhraseDictionary.h" -#include "GenerationDictionary.h" -#include "LMList.h" - -using namespace std; - - -TranslationOption::TranslationOption(const WordsRange &wordsRange, const TargetPhrase &targetPhrase) - : m_targetPhrase(targetPhrase),m_sourcePhrase(targetPhrase.GetSourcePhrase()) - ,m_sourceWordsRange (wordsRange) -{ // used by initial translation step - - // set score - m_scoreGen = 0; - m_scoreTrans = targetPhrase.GetTranslationScore(); - m_scoreBreakdown.PlusEquals(targetPhrase.GetScoreBreakdown()); -} - -TranslationOption::TranslationOption(const TranslationOption ©, const TargetPhrase &targetPhrase) - : m_targetPhrase(targetPhrase) - ,m_sourcePhrase(copy.m_sourcePhrase) // take source phrase pointer from initial translation option - ,m_sourceWordsRange (copy.m_sourceWordsRange) - ,m_scoreBreakdown(copy.m_scoreBreakdown) -{ // used in creating the next translation step - m_scoreGen = copy.GetGenerationScore(); - m_scoreTrans = copy.GetTranslationScore() + targetPhrase.GetTranslationScore(); - - m_scoreBreakdown.PlusEquals(targetPhrase.GetScoreBreakdown()); -} - -TranslationOption::TranslationOption(const TranslationOption © - , const Phrase &inputPhrase - , const GenerationDictionary *generationDictionary - , float generationScore - , float weight) - : m_targetPhrase (inputPhrase),m_sourcePhrase(copy.m_sourcePhrase) -, m_sourceWordsRange (copy.m_sourceWordsRange) -, m_scoreBreakdown(copy.m_scoreBreakdown) -{ // used in creating the next generation step - - m_scoreTrans = copy.GetTranslationScore(); - m_scoreGen = copy.GetGenerationScore() + generationScore * weight; - - m_scoreBreakdown.PlusEquals(generationDictionary, generationScore); -} - -TranslationOption::TranslationOption(const WordsRange &wordsRange, const TargetPhrase &targetPhrase, int /*whatever*/) -: m_targetPhrase(targetPhrase) -,m_sourceWordsRange (wordsRange) -,m_scoreTrans(0) -,m_scoreGen(0) -,m_futureScore(0) -,m_ngramScore(0) -{ // used to create trans opt from unknown word -} - -TranslationOption *TranslationOption::MergeTranslation(const TargetPhrase &targetPhrase) const -{ - if (m_targetPhrase.IsCompatible(targetPhrase)) - { - TargetPhrase mergePhrase(targetPhrase); - mergePhrase.MergeFactors(m_targetPhrase); - TranslationOption *newTransOpt = new TranslationOption(*this, mergePhrase); - return newTransOpt; - } - else - { - return NULL; - } -} - -TranslationOption *TranslationOption::MergeGeneration(const Phrase &inputPhrase - , const GenerationDictionary *generationDictionary - , float generationScore - , float weight) const -{ - if (m_targetPhrase.IsCompatible(inputPhrase)) - { - Phrase mergePhrase(inputPhrase); - mergePhrase.MergeFactors(m_targetPhrase); - TranslationOption *newTransOpt = new TranslationOption(*this, mergePhrase, generationDictionary, generationScore, weight); - return newTransOpt; - } - else - return NULL; -} - -bool TranslationOption::Overlap(const Hypothesis &hypothesis) const -{ - const WordsBitmap &bitmap = hypothesis.GetWordsBitmap(); - return bitmap.Overlap(GetSourceWordsRange()); -} - -void TranslationOption::CalcScore(const LMList &allLM, float weightWordPenalty) -{ - // LM scores - m_ngramScore = 0; - float retFullScore = 0; - - allLM.CalcScore(GetTargetPhrase(), retFullScore, m_ngramScore, &m_scoreBreakdown); - // future score - m_futureScore = retFullScore; - - size_t phraseSize = GetTargetPhrase().GetSize(); - m_futureScore += m_scoreTrans - phraseSize * weightWordPenalty; -} - -TO_STRING_BODY(TranslationOption); - -// friend -ostream& operator<<(ostream& out, const TranslationOption& possibleTranslation) -{ - out << possibleTranslation.GetTargetPhrase() - << ", pC=" << possibleTranslation.GetTranslationScore() - << ", c=" << possibleTranslation.GetFutureScore() - << " [" << possibleTranslation.GetSourceWordsRange() << "]" - << possibleTranslation.GetScoreBreakdown(); - return out; -} - diff --git a/moses/src/TranslationOption.h b/moses/src/TranslationOption.h deleted file mode 100755 index 5cea2cd24..000000000 --- a/moses/src/TranslationOption.h +++ /dev/null @@ -1,159 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <vector> -#include "WordsBitmap.h" -#include "WordsRange.h" -#include "Phrase.h" -#include "TargetPhrase.h" -#include "Hypothesis.h" -#include "Util.h" -#include "TypeDef.h" -#include "ScoreComponentCollection.h" - -class PhraseDictionaryBase; -class GenerationDictionary; - -/*** - * Specify source and target words for a possible translation. m_targetPhrase points to a phrase-table entry. - * The source word range is zero-indexed, so it can't refer to an empty range. The target phrase may be empty. - */ -class TranslationOption -{ - friend std::ostream& operator<<(std::ostream& out, const TranslationOption& possibleTranslation); - -protected: - - const Phrase m_targetPhrase; - Phrase const* m_sourcePhrase; - const WordsRange m_sourceWordsRange; - float m_scoreTrans, m_scoreGen, m_futureScore, m_ngramScore; - - //! in TranslationOption, m_scoreBreakdown is not complete. It cannot, - //! for example, know the full n-gram score since the length of the - //! TargetPhrase may be shorter than the n-gram order. But, if it is - //! possible to estimate, it will be known - ScoreComponentCollection2 m_scoreBreakdown; - -public: - TranslationOption(const WordsRange &wordsRange, const TargetPhrase &targetPhrase); - // used by initial translation step - TranslationOption(const TranslationOption ©, const TargetPhrase &targetPhrase); - // used by MergeTranslation - TranslationOption(const TranslationOption © - , const Phrase &inputPhrase - , const GenerationDictionary *generationDictionary - , float generationScore - , float weight); - TranslationOption(const WordsRange &wordsRange, const TargetPhrase &targetPhrase, int /*whatever*/); - // used to create trans opt from unknown word - - TranslationOption *MergeTranslation(const TargetPhrase &targetPhrase) const; - TranslationOption *MergeGeneration(const Phrase &inputPhrase - , const GenerationDictionary *generationDictionary - , float generationScore - , float weight) const; - - inline const Phrase &GetTargetPhrase() const - { - return m_targetPhrase; - } - inline const WordsRange &GetSourceWordsRange() const - { - return m_sourceWordsRange; - } - Phrase const* GetSourcePhrase() const - { - return m_sourcePhrase; - } - - bool Overlap(const Hypothesis &hypothesis) const; - /*** - * return start index of source phrase - */ - inline size_t GetStartPos() const - { - return m_sourceWordsRange.GetStartPos(); - } - /*** - * return end index of source phrase - */ - inline size_t GetEndPos() const - { - return m_sourceWordsRange.GetEndPos(); - } - /*** - * return length of source phrase - */ - inline size_t GetSize() const - { - return m_sourceWordsRange.GetEndPos() - m_sourceWordsRange.GetStartPos() + 1; - } - /*** - * return source words range - */ - inline const WordsRange &GetWordsRange() const - { - return m_sourceWordsRange; - } - /*** - * returns true if the source phrase translates into nothing - */ - inline float GetTranslationScore() const - { - return m_scoreTrans; - } - inline float GetGenerationScore() const - { - return m_scoreGen; - } - inline float GetFutureScore() const - { - return m_futureScore; - } - inline float GetNgramScore() const - { - return m_ngramScore; - } - inline float GetTotalScore() const - { - return m_scoreTrans + m_scoreGen + m_futureScore; - } - /*** - * returns true if the source phrase translates into nothing - */ - inline bool IsDeletionOption() const - { - return m_targetPhrase.GetSize() == 0; - } - void CalcScore(const LMList &allLM, float weightWordPenalty); - - inline const ScoreComponentCollection2 &GetScoreBreakdown() const - { - return m_scoreBreakdown; - } - - TO_STRING; -}; - - diff --git a/moses/src/TranslationOptionCollection.cpp b/moses/src/TranslationOptionCollection.cpp deleted file mode 100644 index 5a4522847..000000000 --- a/moses/src/TranslationOptionCollection.cpp +++ /dev/null @@ -1,583 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include "TranslationOptionCollection.h" -#include "Sentence.h" -#include "DecodeStep.h" -#include "LanguageModel.h" -#include "PhraseDictionary.h" -#include "FactorCollection.h" -#include "Input.h" -#include "Util.h" - -#include "StaticData.h" - -using namespace std; - -TranslationOptionCollection::TranslationOptionCollection(InputType const& src, size_t maxNoTransOptPerCoverage) - : m_source(src) - ,m_futureScore(src.GetSize()) - ,m_unknownWordPos(src.GetSize()) - ,m_maxNoTransOptPerCoverage(maxNoTransOptPerCoverage) -{ - // create 2-d vector - size_t size = src.GetSize(); - for (size_t startPos = 0 ; startPos < size ; ++startPos) - { - m_collection.push_back( vector< TranslationOptionList >() ); - for (size_t endPos = startPos ; endPos < size ; ++endPos) - { - m_collection[startPos].push_back( TranslationOptionList() ); - } - } -} - -TranslationOptionCollection::~TranslationOptionCollection() -{ - // delete all trans opt - size_t size = m_source.GetSize(); - for (size_t startPos = 0 ; startPos < size ; ++startPos) - { - for (size_t endPos = startPos ; endPos < size ; ++endPos) - { - RemoveAllInColl<TranslationOptionList::iterator>(GetTranslationOptionList(startPos, endPos)); - } - } -} - -// helper -bool CompareTranslationOption(const TranslationOption *a, const TranslationOption *b) -{ - return a->GetTotalScore() > b->GetTotalScore(); -} - -void TranslationOptionCollection::Prune() -{ - if (m_maxNoTransOptPerCoverage == 0) - return; - - size_t total = 0; - size_t totalPruned = 0; - size_t size = m_source.GetSize(); - for (size_t startPos = 0 ; startPos < size ; ++startPos) - { - for (size_t endPos = startPos ; endPos < size ; ++endPos) - { - TranslationOptionList &fullList = GetTranslationOptionList(startPos, endPos); - total += fullList.size(); - if (fullList.size() <= m_maxNoTransOptPerCoverage) - continue; - - // sort in vector - nth_element(fullList.begin(), fullList.begin() + m_maxNoTransOptPerCoverage, fullList.end(), CompareTranslationOption); - - totalPruned += fullList.size() - m_maxNoTransOptPerCoverage; - - // delete the rest - for (size_t i = m_maxNoTransOptPerCoverage ; i < fullList.size() ; ++i) - { - delete fullList[i]; - } - fullList.resize(m_maxNoTransOptPerCoverage); - } - } - if (StaticData::Instance()->GetVerboseLevel() >= 1) - { - std::cerr << " Total translation options: " << total << std::endl; - std::cerr << "Total translation options pruned: " << totalPruned << std::endl; - } -} - -void TranslationOptionCollection::CalcFutureScore(size_t verboseLevel) -{ - // create future score matrix in a dynamic programming fashion - - // setup the matrix (ignore lower triangle, set upper triangle to -inf - size_t size = m_source.GetSize(); // the width of the matrix - - for(size_t row=0; row<size; row++) { - for(size_t col=row; col<size; col++) { - m_futureScore.SetScore(row, col, -numeric_limits<float>::infinity()); - } - } - - // walk all the translation options and record the cheapest option for each span - for (size_t startPos = 0 ; startPos < m_source.GetSize() ; ++startPos) - { - for (size_t endPos = startPos ; endPos < m_source.GetSize() ; ++endPos) - { - TranslationOptionList &transOptList = GetTranslationOptionList(startPos, endPos); - - TranslationOptionList::const_iterator iterTransOpt; - for(iterTransOpt = transOptList.begin() ; iterTransOpt != transOptList.end() ; ++iterTransOpt) - { - const TranslationOption &transOpt = **iterTransOpt; - float score = transOpt.GetFutureScore(); - if (score > m_futureScore.GetScore(startPos, endPos)) - m_futureScore.SetScore(startPos, endPos, score); - } - } - } - - // now fill all the cells in the strictly upper triangle - // there is no way to modify the diagonal now, in the case - // where no translation option covers a single-word span, - // we leave the +inf in the matrix - // like in chart parsing we want each cell to contain the highest score - // of the full-span trOpt or the sum of scores of joining two smaller spans - - for(size_t colstart = 1; colstart < size ; colstart++) { - for(size_t diagshift = 0; diagshift < size-colstart ; diagshift++) { - size_t startPos = diagshift; - size_t endPos = colstart+diagshift; - for(size_t joinAt = startPos; joinAt < endPos ; joinAt++) { - float joinedScore = m_futureScore.GetScore(startPos, joinAt) - + m_futureScore.GetScore(joinAt+1, endPos); - /* // uncomment to see the cell filling scheme - cerr << "[" <<startPos<<","<<endPos<<"] <-? ["<<startPos<<","<<joinAt<<"]+["<<joinAt+1<<","<<endPos - << "] (colstart: "<<colstart<<", diagshift: "<<diagshift<<")"<<endl; - */ - if (joinedScore > m_futureScore.GetScore(startPos, endPos)) - m_futureScore.SetScore(startPos, endPos, joinedScore); - } - } - } - - if(verboseLevel > 2) - { - int total = 0; - for(size_t row=0; row<size; row++) - { - for(size_t col=row; col<size; col++) - { - int count = GetTranslationOptionList(row, col).size(); - TRACE_ERR("translation options spanning from " - << row <<" to "<< col <<" is " - << count <<endl); - total += count; - } - } - cout << "translation options generated in total: "<< total << endl; - - for(size_t row=0; row<size; row++) - for(size_t col=row; col<size; col++) - cout<<"future cost from "<< row <<" to "<< col <<" is "<< m_futureScore.GetScore(row, col) <<endl; - } -} - - -// helpers -typedef pair<Word, float> WordPair; -typedef list< WordPair > WordList; -// 1st = word -// 2nd = score -typedef list< WordPair >::const_iterator WordListIterator; - -inline void IncrementIterators(vector< WordListIterator > &wordListIterVector - , const vector< WordList > &wordListVector) -{ - for (size_t currPos = 0 ; currPos < wordListVector.size() ; currPos++) - { - WordListIterator &iter = wordListIterVector[currPos]; - iter++; - if (iter != wordListVector[currPos].end()) - { // eg. 4 -> 5 - return; - } - else - { // eg 9 -> 10 - iter = wordListVector[currPos].begin(); - } - } -} - -void TranslationOptionCollection::ProcessGeneration( - const TranslationOption &inputPartialTranslOpt - , const DecodeStep &decodeStep - , PartialTranslOptColl &outputPartialTranslOptColl - , int dropUnknown - , FactorCollection &factorCollection - , float weightWordPenalty) -{ - //TRACE_ERR(inputPartialTranslOpt << endl); - if (inputPartialTranslOpt.GetTargetPhrase().GetSize() == 0) - { // word deletion - - TranslationOption *newTransOpt = new TranslationOption(inputPartialTranslOpt); - outputPartialTranslOptColl.Add(newTransOpt); - - return; - } - - // normal generation step - const GenerationDictionary &generationDictionary = decodeStep.GetGenerationDictionary(); - const WordsRange &sourceWordsRange = inputPartialTranslOpt.GetSourceWordsRange(); - const float weight = generationDictionary.GetWeight(); - - const Phrase &targetPhrase = inputPartialTranslOpt.GetTargetPhrase(); - size_t targetLength = targetPhrase.GetSize(); - - // generation list for each word in hypothesis - vector< WordList > wordListVector(targetLength); - - // create generation list - int wordListVectorPos = 0; - for (size_t currPos = 0 ; currPos < targetLength ; currPos++) - { - WordList &wordList = wordListVector[wordListVectorPos]; - const FactorArray &factorArray = targetPhrase.GetFactorArray(currPos); - - const OutputWordCollection *wordColl = generationDictionary.FindWord(factorArray); - - if (wordColl == NULL) - { // word not found in generation dictionary - ProcessUnknownWord(sourceWordsRange.GetStartPos(), dropUnknown, factorCollection, weightWordPenalty); - return; - } - else - { - OutputWordCollection::const_iterator iterWordColl; - for (iterWordColl = wordColl->begin() ; iterWordColl != wordColl->end(); ++iterWordColl) - { - const Word &outputWord = (*iterWordColl).first; - float score = (*iterWordColl).second; - wordList.push_back(WordPair(outputWord, score)); - } - - wordListVectorPos++; - } - } - - // use generation list (wordList) - // set up iterators - size_t numIteration = 1; - vector< WordListIterator > wordListIterVector(targetLength); - vector< const Word* > mergeWords(targetLength); - for (size_t currPos = 0 ; currPos < targetLength ; currPos++) - { - wordListIterVector[currPos] = wordListVector[currPos].begin(); - numIteration *= wordListVector[currPos].size(); - } - - // go thru each possible factor for each word & create hypothesis - for (size_t currIter = 0 ; currIter < numIteration ; currIter++) - { - float generationScore = 0; // total score for this string of words - - // create vector of words with new factors for last phrase - for (size_t currPos = 0 ; currPos < targetLength ; currPos++) - { - const WordPair &wordPair = *wordListIterVector[currPos]; - mergeWords[currPos] = &(wordPair.first); - generationScore += wordPair.second; - } - - // merge with existing trans opt - Phrase genPhrase(Output, mergeWords); - TranslationOption *newTransOpt = inputPartialTranslOpt.MergeGeneration(genPhrase, &generationDictionary, generationScore, weight); - if (newTransOpt != NULL) - { - outputPartialTranslOptColl.Add(newTransOpt); - } - - // increment iterators - IncrementIterators(wordListIterVector, wordListVector); - } -} - - -void TranslationOptionCollection::ProcessTranslation( - const TranslationOption &inputPartialTranslOpt - , const DecodeStep &decodeStep - , PartialTranslOptColl &outputPartialTranslOptColl - , int dropUnknown - , FactorCollection &factorCollection - , float weightWordPenalty) -{ - //TRACE_ERR(inputPartialTranslOpt << endl); - if (inputPartialTranslOpt.GetTargetPhrase().GetSize() == 0) - { // word deletion - - outputPartialTranslOptColl.Add(new TranslationOption(inputPartialTranslOpt)); - - return; - } - - // normal trans step - const WordsRange &sourceWordsRange = inputPartialTranslOpt.GetSourceWordsRange(); - const PhraseDictionaryBase &phraseDictionary = decodeStep.GetPhraseDictionary(); - const TargetPhraseCollection *phraseColl = phraseDictionary.GetTargetPhraseCollection(m_source,sourceWordsRange); - - if (phraseColl != NULL) - { - TargetPhraseCollection::const_iterator iterTargetPhrase; - - for (iterTargetPhrase = phraseColl->begin(); iterTargetPhrase != phraseColl->end(); ++iterTargetPhrase) - { - const TargetPhrase& targetPhrase = *iterTargetPhrase; - - TranslationOption *newTransOpt = inputPartialTranslOpt.MergeTranslation(targetPhrase); - if (newTransOpt != NULL) - { - outputPartialTranslOptColl.Add( newTransOpt ); - } - } - } - else if (sourceWordsRange.GetWordsCount() == 1) - { // unknown handler - ProcessUnknownWord(sourceWordsRange.GetStartPos(), dropUnknown, factorCollection, weightWordPenalty); - } -} - - -/*** - * Add to m_possibleTranslations all possible translations the phrase table gives us for - * the given phrase - * - * \param phrase The source phrase to translate - * \param phraseDictionary The phrase table - * \param lmListInitial A list of language models - */ -void TranslationOptionCollection::CreateTranslationOptions( - const list < DecodeStep > &decodeStepList - , const LMList &allLM - , FactorCollection &factorCollection - , float weightWordPenalty - , bool dropUnknown - , size_t verboseLevel) -{ - m_allLM = &allLM; - // partial trans opt stored in here - vector < PartialTranslOptColl* > outputPartialTranslOptCollVec( decodeStepList.size() ); - outputPartialTranslOptCollVec[0] = new PartialTranslOptColl(); - - // initial translation step - list < DecodeStep >::const_iterator iterStep = decodeStepList.begin(); - const DecodeStep &decodeStep = *iterStep; - - ProcessInitialTranslation(decodeStep, factorCollection - , weightWordPenalty, dropUnknown - , verboseLevel, *outputPartialTranslOptCollVec[0]); - - // do rest of decode steps - - int indexStep = 0; - for (++iterStep ; iterStep != decodeStepList.end() ; ++iterStep) - { - const DecodeStep &decodeStep = *iterStep; - - outputPartialTranslOptCollVec[indexStep + 1] = new PartialTranslOptColl(); - PartialTranslOptColl &inputPartialTranslOptColl = *outputPartialTranslOptCollVec[indexStep] - ,&outputPartialTranslOptColl = *outputPartialTranslOptCollVec[indexStep + 1]; - - // is it translation or generation - switch (decodeStep.GetDecodeType()) - { - case Translate: - { - // go thru each intermediate trans opt just created - PartialTranslOptColl::const_iterator iterPartialTranslOpt; - for (iterPartialTranslOpt = inputPartialTranslOptColl.begin() ; iterPartialTranslOpt != inputPartialTranslOptColl.end() ; ++iterPartialTranslOpt) - { - const TranslationOption &inputPartialTranslOpt = **iterPartialTranslOpt; - ProcessTranslation(inputPartialTranslOpt - , decodeStep - , outputPartialTranslOptColl - , dropUnknown - , factorCollection - , weightWordPenalty); - } - break; - } - case Generate: - { - // go thru each hypothesis just created - PartialTranslOptColl::const_iterator iterPartialTranslOpt; - for (iterPartialTranslOpt = inputPartialTranslOptColl.begin() ; iterPartialTranslOpt != inputPartialTranslOptColl.end() ; ++iterPartialTranslOpt) - { - const TranslationOption &inputPartialTranslOpt = **iterPartialTranslOpt; - ProcessGeneration(inputPartialTranslOpt - , decodeStep - , outputPartialTranslOptColl - , dropUnknown - , factorCollection - , weightWordPenalty); - } - break; - } - case InsertNullFertilityWord: - { // TODO ask chris or evan what should be done - assert(false); - break; - } - } - // last but 1 partial trans not required anymore - delete outputPartialTranslOptCollVec[indexStep]; - indexStep++; - } // for (++iterStep - - // add to real trans opt list - PartialTranslOptColl &lastPartialTranslOptColl = *outputPartialTranslOptCollVec[decodeStepList.size() - 1]; - PartialTranslOptColl::iterator iterColl; - for (iterColl = lastPartialTranslOptColl.begin() ; iterColl != lastPartialTranslOptColl.end() ; iterColl++) - { - TranslationOption *transOpt = *iterColl; - transOpt->CalcScore(allLM, weightWordPenalty); - Add(transOpt); - } - - lastPartialTranslOptColl.DetachAll(); - delete outputPartialTranslOptCollVec[decodeStepList.size() - 1]; - - // Prune - Prune(); - - // future score - CalcFutureScore(verboseLevel); -} - - - -void TranslationOptionCollection::ProcessOneUnknownWord(const FactorArray &sourceWord, - size_t sourcePos - , int dropUnknown - , FactorCollection &factorCollection - , float weightWordPenalty) -{ - // unknown word, add as trans opt - - size_t isDigit = 0; - if (dropUnknown) - { - const Factor *f = sourceWord[0]; // ??? hack. shouldn't know which factor is surface - std::string s = f->ToString(); - isDigit = s.find_first_of("0123456789"); - if (isDigit == string::npos) - isDigit = 0; - else - isDigit = 1; - // modify the starting bitmap - } - - TranslationOption *transOpt; - if (!dropUnknown || isDigit) - { - // add to dictionary - TargetPhrase targetPhrase(Output); - FactorArray &targetWord = targetPhrase.AddWord(); - - for (unsigned int currFactor = 0 ; currFactor < NUM_FACTORS ; currFactor++) - { - FactorType factorType = static_cast<FactorType>(currFactor); - - const Factor *sourceFactor = sourceWord[currFactor]; - if (sourceFactor == NULL) - targetWord[factorType] = factorCollection.AddFactor(Output, factorType, UNKNOWN_FACTOR); - else - targetWord[factorType] = factorCollection.AddFactor(Output, factorType, sourceFactor->GetString()); - } - - targetPhrase.SetScore(weightWordPenalty); - - transOpt = new TranslationOption(WordsRange(sourcePos, sourcePos), targetPhrase, 0); - } - else - { // drop source word. create blank trans opt - const TargetPhrase targetPhrase(Output); - transOpt = new TranslationOption(WordsRange(sourcePos, sourcePos), targetPhrase, 0); - } - - transOpt->CalcScore(*m_allLM, weightWordPenalty); - Add(transOpt); - - m_unknownWordPos.SetValue(sourcePos, true); -} - - - -void TranslationOptionCollection::ProcessInitialTranslation( - const DecodeStep &decodeStep - , FactorCollection &factorCollection - , float weightWordPenalty - , int dropUnknown - , size_t verboseLevel - , PartialTranslOptColl &outputPartialTranslOptColl) -{ - // loop over all substrings of the source sentence, look them up - // in the phraseDictionary (which is the- possibly filtered-- phrase - // table loaded on initialization), generate TranslationOption objects - // for all phrases - // - // possible optimization- don't consider phrases longer than the longest - // phrase in the PhraseDictionary? - - const PhraseDictionaryBase &phraseDictionary = decodeStep.GetPhraseDictionary(); - for (size_t startPos = 0 ; startPos < m_source.GetSize() ; startPos++) - { - if (m_unknownWordPos.GetValue(startPos)) - { // unknown word but already processed. skip - continue; - } - - for (size_t endPos = startPos ; endPos < m_source.GetSize() ; endPos++) - { - const WordsRange wordsRange(startPos, endPos); - const TargetPhraseCollection *phraseColl = phraseDictionary.GetTargetPhraseCollection(m_source,wordsRange); - if (phraseColl != NULL) - { - if (verboseLevel >= 3) - { - cout << "[" << m_source.GetSubString(wordsRange) << "; " << startPos << "-" << endPos << "]\n"; - } - - TargetPhraseCollection::const_iterator iterTargetPhrase; - for (iterTargetPhrase = phraseColl->begin() ; iterTargetPhrase != phraseColl->end() ; ++iterTargetPhrase) - { - const TargetPhrase &targetPhrase = *iterTargetPhrase; - outputPartialTranslOptColl.push_back ( new TranslationOption(wordsRange, targetPhrase) ); - - if (verboseLevel >= 3) - { - cout << "\t" << targetPhrase << "\n"; - } - } - if (verboseLevel >= 3) - { - cout << endl; - } - } - else if (wordsRange.GetWordsCount() == 1) - { - ProcessUnknownWord(startPos, dropUnknown, factorCollection, weightWordPenalty); - continue; - } - } - } -} - -void TranslationOptionCollection::Add(const TranslationOption *translationOption) -{ - const WordsRange &coverage = translationOption->GetSourceWordsRange(); - m_collection[coverage.GetStartPos()][coverage.GetEndPos() - coverage.GetStartPos()].push_back(translationOption); -} - -TO_STRING_BODY(TranslationOptionCollection); - diff --git a/moses/src/TranslationOptionCollection.h b/moses/src/TranslationOptionCollection.h deleted file mode 100755 index a231b2add..000000000 --- a/moses/src/TranslationOptionCollection.h +++ /dev/null @@ -1,147 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <list> -#include "TypeDef.h" -#include "TranslationOption.h" -#include "SquareMatrix.h" -#include "WordsBitmap.h" -#include "PartialTranslOptColl.h" -#include "DecodeStep.h" - -class LanguageModel; -class FactorCollection; -class InputType; -class PhraseDictionary; -class GenerationDictionary; -class InputType; -class LMList; - -typedef std::vector<const TranslationOption*> TranslationOptionList; - -class TranslationOptionCollection -{ - friend std::ostream& operator<<(std::ostream& out, const TranslationOptionCollection& coll); - TranslationOptionCollection(const TranslationOptionCollection&); // no copy constructor -protected: - std::vector< std::vector< TranslationOptionList > > m_collection; - InputType const &m_source; - SquareMatrix m_futureScore; - WordsBitmap m_unknownWordPos; - const size_t m_maxNoTransOptPerCoverage; - const LMList *m_allLM; - - TranslationOptionCollection(InputType const& src, size_t maxNoTransOptPerCoverage); - - void CalcFutureScore(size_t verboseLevel); - - virtual void ProcessInitialTranslation(const DecodeStep &decodeStep - , FactorCollection &factorCollection - , float weightWordPenalty - , int dropUnknown - , size_t verboseLevel - , PartialTranslOptColl &outputPartialTranslOptColl); - - virtual void ProcessUnknownWord(size_t sourcePos - , int dropUnknown - , FactorCollection &factorCollection - , float weightWordPenalty)=0; - - virtual void ProcessOneUnknownWord(const FactorArray &sourceWord - , size_t sourcePos - , int dropUnknown - , FactorCollection &factorCollection - , float weightWordPenalty); - - void ProcessGeneration( const TranslationOption &inputPartialTranslOpt - , const DecodeStep &decodeStep - , PartialTranslOptColl &outputPartialTranslOptColl - , int dropUnknown - , FactorCollection &factorCollection - , float weightWordPenalty); - void ProcessTranslation( const TranslationOption &inputPartialTranslOpt - , const DecodeStep &decodeStep - , PartialTranslOptColl &outputPartialTranslOptColl - , int dropUnknown - , FactorCollection &factorCollection - , float weightWordPenalty); - - void ComputeFutureScores(size_t verboseLevel); - void Prune(); - - TranslationOptionList &GetTranslationOptionList(size_t startPos, size_t endPos) - { - return m_collection[startPos][endPos - startPos]; - } - -public: - virtual ~TranslationOptionCollection(); - - // get length/size of source input - size_t GetSize() const; - - virtual void CreateTranslationOptions(const std::list < DecodeStep > &decodeStepList - , const LMList &allLM - , FactorCollection &factorCollection - , float weightWordPenalty - , bool dropUnknown - , size_t verboseLevel); - - - void Add(const TranslationOption *translationOption); - - inline virtual const SquareMatrix &GetFutureScore() const - { - return m_futureScore; - } - - const TranslationOptionList &GetTranslationOptionList(size_t startPos, size_t endPos) const - { - return m_collection[startPos][endPos - startPos]; - } - const TranslationOptionList &GetTranslationOptionList(const WordsRange &coverage) const - { - return GetTranslationOptionList(coverage.GetStartPos(), coverage.GetEndPos()); - } - - TO_STRING; -}; - -inline std::ostream& operator<<(std::ostream& out, const TranslationOptionCollection& coll) -{ - std::vector< std::vector< TranslationOptionList > >::const_iterator i = coll.m_collection.begin(); - size_t j = 0; - for (; i!=coll.m_collection.end(); ++i) { - out << "s[" << j++ << "].size=" << i->size() << std::endl; - } - - /* - TranslationOptionCollection::const_iterator iter; - for (iter = coll.begin() ; iter != coll.end() ; ++iter) - { - TRACE_ERR (*iter << std::endl); - } - */ - return out; -} - diff --git a/moses/src/TranslationOptionCollectionConfusionNet.cpp b/moses/src/TranslationOptionCollectionConfusionNet.cpp deleted file mode 100644 index 86d9634b5..000000000 --- a/moses/src/TranslationOptionCollectionConfusionNet.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// $Id$ -#include "TranslationOptionCollectionConfusionNet.h" -#include "ConfusionNet.h" -#include "DecodeStep.h" -#include "LanguageModel.h" -#include "PhraseDictionary.h" -#include "FactorCollection.h" -#include "LMList.h" - -TranslationOptionCollectionConfusionNet:: -TranslationOptionCollectionConfusionNet(const ConfusionNet &input, size_t maxNoTransOptPerCoverage) - : TranslationOptionCollection(input, maxNoTransOptPerCoverage) {} - -void TranslationOptionCollectionConfusionNet:: -ProcessUnknownWord( size_t sourcePos - , int dropUnknown - , FactorCollection &factorCollection - , float weightWordPenalty) -{ - ConfusionNet const& source=dynamic_cast<ConfusionNet const&>(m_source); - - ConfusionNet::Column const& coll=source.GetColumn(sourcePos); - for(ConfusionNet::Column::const_iterator i=coll.begin();i!=coll.end();++i) - ProcessOneUnknownWord(i->first.GetFactorArray(),sourcePos,dropUnknown,factorCollection,weightWordPenalty); - -} - diff --git a/moses/src/TranslationOptionCollectionConfusionNet.h b/moses/src/TranslationOptionCollectionConfusionNet.h deleted file mode 100644 index 20fe84cb0..000000000 --- a/moses/src/TranslationOptionCollectionConfusionNet.h +++ /dev/null @@ -1,17 +0,0 @@ -// $Id$ -#pragma once - -#include "TranslationOptionCollection.h" - -class ConfusionNet; - -class TranslationOptionCollectionConfusionNet : public TranslationOptionCollection { - public: - TranslationOptionCollectionConfusionNet(const ConfusionNet &source, size_t maxNoTransOptPerCoverage); - - void ProcessUnknownWord( size_t sourcePos - , int dropUnknown - , FactorCollection &factorCollection - , float weightWordPenalty); - -}; diff --git a/moses/src/TranslationOptionCollectionText.cpp b/moses/src/TranslationOptionCollectionText.cpp deleted file mode 100644 index 483f13b7e..000000000 --- a/moses/src/TranslationOptionCollectionText.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include "TranslationOptionCollectionText.h" -#include "Sentence.h" -#include "DecodeStep.h" -#include "LanguageModel.h" -#include "PhraseDictionary.h" -#include "FactorCollection.h" -#include "WordsRange.h" -#include "LMList.h" - -using namespace std; - -TranslationOptionCollectionText::TranslationOptionCollectionText(Sentence const &inputSentence, size_t maxNoTransOptPerCoverage) - : TranslationOptionCollection(inputSentence, maxNoTransOptPerCoverage) {} - -void TranslationOptionCollectionText::ProcessUnknownWord(size_t sourcePos - , int dropUnknown - , FactorCollection &factorCollection - , float weightWordPenalty) -{ - const FactorArray &sourceWord = m_source.GetFactorArray(sourcePos); - ProcessOneUnknownWord(sourceWord,sourcePos,dropUnknown,factorCollection,weightWordPenalty); -} diff --git a/moses/src/TranslationOptionCollectionText.h b/moses/src/TranslationOptionCollectionText.h deleted file mode 100644 index 6095fba8c..000000000 --- a/moses/src/TranslationOptionCollectionText.h +++ /dev/null @@ -1,41 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include "TranslationOptionCollection.h" - -class Sentence; -class LMList; - -class TranslationOptionCollectionText : public TranslationOptionCollection { -protected: - - void ProcessUnknownWord( size_t sourcePos - , int dropUnknown - , FactorCollection &factorCollection - , float weightWordPenalty); - - public: - TranslationOptionCollectionText(Sentence const& inputSentence, size_t maxNoTransOptPerCoverage); - -}; - diff --git a/moses/src/TypeDef.h b/moses/src/TypeDef.h deleted file mode 100755 index 16f696e14..000000000 --- a/moses/src/TypeDef.h +++ /dev/null @@ -1,127 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <list> -#include <limits> - -#define PROJECT_NAME "moses" - -#define SENTENCE_START "<s>" -#define SENTENCE_END "</s>" -#define UNKNOWN_FACTOR "UNK" -#define EPSILON "*EPS*" - -#define NOT_FOUND std::numeric_limits<size_t>::max() -#define MAX_NGRAM_SIZE 20 - -const size_t DEFAULT_MAX_HYPOSTACK_SIZE = 200; -const size_t DEFAULT_MAX_TRANS_OPT_SIZE = 50; -const size_t ARRAY_SIZE_INCR = 10; //amount by which a phrase gets resized when necessary -const float LOWEST_SCORE = -100.0f; -const float DEFAULT_BEAM_THRESHOLD = 0.00001f; -const size_t DEFAULT_VERBOSE_LEVEL = 1; - -///////////////////////////////////////////////// -// for those using autoconf/automake -#if HAVE_CONFIG_H -#include "config.h" - -#define TRACE_ENABLE 1 // REMOVE after we figure this out -#define N_BEST 1 // REMOVE - -# ifdef HAVE_SRILM -# define LM_SRI 1 -# undef LM_INTERNAL -# else -# undef LM_SRI -# define LM_INTERNAL 1 -# endif - -# ifdef HAVE_IRSTLM -# define LM_IRST 1 -# undef LM_INTERNAL -# undef LM_SRI -# endif - -#endif -///////////////////////////////////////////////// - -// enums. -// must be 0, 1, 2, ..., unless otherwise stated - -// can only be 2 at the moment -const int NUM_LANGUAGES = 2; - -// count of above -const size_t NUM_FACTORS = 4; - -enum FactorDirection -{ - Input = 0 - ,Output = 1 -}; - -enum DecodeType -{ - Translate - ,Generate - ,InsertNullFertilityWord //! an optional step that attempts to insert a few closed-class words to improve LM scores -}; - -namespace LexReorderType -{ - enum LexReorderType - { - Forward - ,Backward - ,Bidirectional - ,Fe - ,F - }; -} - -namespace DistortionOrientationType -{ - enum DistortionOrientationOptions - { - Monotone - ,Msd - }; - // Possible values for orientation. - enum ORIENTATIONS { MONO, NON_MONO, SWAP, DISC }; - - -}; - -enum IOMethod -{ - IOMethodCommandLine - ,IOMethodFile - ,IOMethodMySQL -}; - -// typedef -typedef size_t FactorType; - -class Factor; -typedef const Factor * FactorArray[NUM_FACTORS]; diff --git a/moses/src/UniqueObject.h b/moses/src/UniqueObject.h deleted file mode 100644 index f57fd82f5..000000000 --- a/moses/src/UniqueObject.h +++ /dev/null @@ -1,54 +0,0 @@ -/* ---------------------------------------------------------------- */ -/* Copyright 2004 (c) by RWTH Aachen - Lehrstuhl fuer Informatik VI */ -/* Richard Zens */ -/* ---------------------------------------------------------------- */ -#ifndef UNIQUEOBJECT_HH_ -#define UNIQUEOBJECT_HH_ -#include <iostream> -#include <set> - -template<class T> T const* uniqueObject(const T& x,int mode=0) { - typedef std::set<T> Pool; - - static Pool pool; - static size_t Size=0; - - if(mode==0) { - std::pair<typename Pool::iterator,bool> p=pool.insert(x); - if(p.second && (++Size%100000==0)) - std::cerr<<"uniqueObjects -- size: "<<Size<<" object size: "<<sizeof(T)<<"\n"; - - return &(*(p.first)); - } - else { - pool.clear();Size=0;return 0; - } -} - -template<class T> class UniqueObjectManager { -public: - typedef T Object; -private: - typedef std::set<T> Pool; - Pool pool; -public: - UniqueObjectManager() {} - - void clear() {pool.clear();} - size_t size() const {return pool.size();} - - Object const * operator()(const Object& x) { -#ifdef DEBUG - std::pair<typename Pool::iterator,bool> p=pool.insert(x); - if(p.second && (size()%100000==0)) - std::cerr<<"uniqueObjects -- size: "<<size()<<" object size: "<<sizeof(Object)<<"\n"; - return &(*(p.first)); -#else - return &(*(pool.insert(x).first)); -#endif - } -}; - - - -#endif diff --git a/moses/src/UserMessage.cpp b/moses/src/UserMessage.cpp deleted file mode 100644 index 6b1444e95..000000000 --- a/moses/src/UserMessage.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include <sstream> -#include <iostream> -#include "UserMessage.h" - -using namespace std; - -const int MAX_MSG_QUEUE = 5; - -bool UserMessage::m_toStderr = true; -bool UserMessage::m_toQueue = false; -queue<string> UserMessage::m_msgQueue; - -void UserMessage::Add(const string &msg) -{ - if (m_toStderr) - { - cerr << "ERROR:" << msg << endl; - } - if (m_toQueue) - { - if (m_msgQueue.size() >= MAX_MSG_QUEUE) - m_msgQueue.pop(); - m_msgQueue.push(msg); - } -} - -string UserMessage::GetQueue() -{ - stringstream strme(""); - while (!m_msgQueue.empty()) - { - strme << m_msgQueue.front() << endl; - m_msgQueue.pop(); - } - return strme.str(); -} - - diff --git a/moses/src/UserMessage.h b/moses/src/UserMessage.h deleted file mode 100644 index b2104ab1f..000000000 --- a/moses/src/UserMessage.h +++ /dev/null @@ -1,43 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <string> -#include <queue> - -class UserMessage -{ -protected: - static bool m_toStderr, m_toQueue; - static std::queue<std::string> m_msgQueue; - -public: - static void SetOutput(bool toStderr, bool toQueue) - { - m_toStderr = toStderr; - m_toQueue = toQueue; - } - - static void Add(const std::string &msg); - static std::string GetQueue(); -}; - diff --git a/moses/src/Util.cpp b/moses/src/Util.cpp deleted file mode 100644 index 230f56570..000000000 --- a/moses/src/Util.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#ifdef WIN32 -#include <windows.h> -#endif - -#include <cctype> -#include <algorithm> -#include <stdio.h> -#include <iostream> -#include <iomanip> -#include "TypeDef.h" -#include "Util.h" -#include "md5.h" - -using namespace std; - -string GetTempFolder() -{ -#ifdef _WIN32 - char *tmpPath = getenv("TMP"); - string str(tmpPath); - if (str.substr(str.size() - 1, 1) != "\\") - str += "\\"; - return str; -#else - return "/tmp/"; -#endif -} - -void CreateTempFile(ofstream &fileStream, string &filePath) -{ -#ifdef _WIN32 - char buffer[BUFSIZ]; - ::GetTempFileNameA(GetTempFolder().c_str(), "", 0, buffer); - filePath = buffer; -#else - char buffer[L_tmpnam]; - strcpy(buffer, GetTempFolder().c_str()); - strcat(buffer, PROJECT_NAME); - strcat(buffer, "--XXXXXX"); - mkstemp(buffer); - filePath = buffer; -#endif - fileStream.open(filePath.c_str(), ofstream::out | ofstream::app); -} - -string GetMD5Hash(const string &filePath) -{ - unsigned char buffer[16384], signature[16]; - struct MD5Context md5c; - - FILE *in; - if ((in = fopen(filePath.c_str(), "rb")) == NULL) - { - return ""; - } - - MD5Init(&md5c); - size_t j; - while ((j = fread(buffer, 1, sizeof buffer, in)) > 0) - { - MD5Update(&md5c, buffer, (unsigned) j); - } - MD5Final(signature, &md5c); - - std::stringstream stream(""); - stream.setf(std::ios_base::hex,std::ios_base::basefield); - for (j = 0; j < sizeof signature; j++) - { - stream << setw(2) << setfill('0') << (int) signature[j]; - } - - return stream.str(); -} - -template<> -bool Scan<bool>(const std::string &input) -{ - std::string lc(input); - std::transform(lc.begin(), lc.end(), lc.begin(), (int(*)(int))std::tolower); - return (lc == "yes" || lc == "y" || lc == "true" || lc == "1"); -} - - diff --git a/moses/src/Util.h b/moses/src/Util.h deleted file mode 100644 index 367d77f09..000000000 --- a/moses/src/Util.h +++ /dev/null @@ -1,208 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <cassert> -#include <fstream> -#include <sstream> -#include <string> -#include <vector> -#include <cmath> -#include <assert.h> - -#ifdef TRACE_ENABLE -#define TRACE_ERR(str) { std::cerr << str; } -#else -#define TRACE_ERR(str) { } -#endif - -template<typename T> -inline std::string SPrint(const T &input) -{ - std::stringstream stream(""); - stream << input; - return stream.str(); -} - -template<typename T> -inline T Scan(const std::string &input) -{ - std::stringstream stream(input); - T ret; - stream >> ret; - return ret; -} - -template<> -inline int Scan<int>(const std::string &input) -{ - return atoi(input.c_str()); -} - -template<> -bool Scan<bool>(const std::string &input); - -template<> -inline float Scan<float>(const std::string &input) -{ - return (float) atof(input.c_str()); -} - -// convert vectors -template<typename T> -inline std::vector<T> Scan(const std::vector< std::string > &input) -{ - std::vector<T> output(input.size()); - for (size_t i = 0 ; i < input.size() ; i++) - { - output[i] = Scan<T>( input[i] ); - } - return output; -} - -inline std::vector<std::string> Tokenize(const std::string& str, - const std::string& delimiters = " \t") -{ - std::vector<std::string> tokens; - // Skip delimiters at beginning. - std::string::size_type lastPos = str.find_first_not_of(delimiters, 0); - // Find first "non-delimiter". - std::string::size_type pos = str.find_first_of(delimiters, lastPos); - - while (std::string::npos != pos || std::string::npos != lastPos) - { - // Found a token, add it to the vector. - tokens.push_back(str.substr(lastPos, pos - lastPos)); - // Skip delimiters. Note the "not_of" - lastPos = str.find_first_not_of(delimiters, pos); - // Find next "non-delimiter" - pos = str.find_first_of(delimiters, lastPos); - } - - return tokens; -} - -// tokenize then convert each element into another type -template<typename T> -inline std::vector<T> Tokenize( const std::string &input - , const std::string& delimiters = " \t") -{ - std::vector<std::string> stringVector = Tokenize(input, delimiters); - return Scan<T>( stringVector ); -} - -inline std::vector<std::string> TokenizeMultiCharSeparator( - const std::string& str, - const std::string& separator) -{ - std::vector<std::string> tokens; - - size_t pos = 0; - // Find first "non-delimiter". - std::string::size_type nextPos = str.find(separator, pos); - - while (nextPos != std::string::npos) - { - // Found a token, add it to the vector. - tokens.push_back(str.substr(pos, nextPos - pos)); - // Skip delimiters. Note the "not_of" - pos = nextPos + separator.size(); - // Find next "non-delimiter" - nextPos = str.find(separator, pos); - } - tokens.push_back(str.substr(pos, nextPos - pos)); - - return tokens; - -} - -// transform prob to natural log score -inline float TransformScore(float prob) -{ - return log(prob); -} - -// transform natural log score to prob. -// not sure if needed -inline float UntransformScore(float score) -{ - return exp(score); -} - -inline float TransformSRIScore(float sriScore) -{ // sri number are in log 10 - // transform to natural log - return sriScore * 2.30258509299405f; -} - -inline float UntransformSRIScore(float logNScore) -{ // opposite of above - return logNScore / 2.30258509299405f; -} - -inline float FloorSRIScore(float sriScore) -{ - return (std::max)(sriScore , LOWEST_SCORE); -} - -inline float CalcTranslationScore(const std::vector<float> &scoreVector, - const std::vector<float> &weightT) -{ - assert(weightT.size()==scoreVector.size()); - float rv=0.0; - for(float const *sb=&scoreVector[0],*se=sb+scoreVector.size(),*wb=&weightT[0]; - sb!=se;++sb,++wb) - rv += TransformScore(*sb) * (*wb); - return rv; -} - -#define TO_STRING std::string ToString() const; - -#define TO_STRING_BODY(CLASS) \ - std::string CLASS::ToString() const \ - { \ - std::stringstream out; \ - out << *this; \ - return out.str(); \ - } \ - -template<class ITER, class COLL> -void RemoveAllInColl(COLL &coll) -{ - ITER iter; - for (iter = coll.begin() ; iter != coll.end() ; ++iter) - { - delete (*iter); - } - coll.clear(); - -} - -std::string GetTempFolder(); -void CreateTempFile(std::ofstream &fileStream, std::string &filePath); -std::string GetMD5Hash(const std::string &filePath); - -template<typename T> inline void ShrinkToFit(T& v) { - if(v.capacity()>v.size()) T(v).swap(v);assert(v.capacity()==v.size());} - - - diff --git a/moses/src/WeightOptimization.cpp b/moses/src/WeightOptimization.cpp deleted file mode 100755 index b31284461..000000000 --- a/moses/src/WeightOptimization.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include "WeightOptimization.h" -#include "StaticData.h" - -using namespace std; - -WeightOptimizationImpl::WeightOptimizationImpl(StaticData &staticData) -:m_staticData(staticData) -{ -} - -void WeightOptimizationImpl::SetWeight(const std::vector<float> &weight) -{ - m_staticData.SetWeightDistortion(weight[0]); - - size_t currIndex = 1; - - // LM - { - size_t numLM = m_staticData.GetLMSize(); - std::vector<float> lmWeight(numLM); - for (size_t i = 0 ; i < numLM ; i++) - { - lmWeight[i] = weight[currIndex++]; - } - m_staticData.SetWeightLM(lmWeight); - } - - // phrase trans - { - size_t numPhraseDict = 0 ; // NUM_PHRASE_SCORES * m_staticData.GetPhraseDictionarySize(); - std::vector<float> transModelWeight(numPhraseDict); - - for (size_t i = 0 ; i < numPhraseDict ; i++) - { - transModelWeight[i] = weight[currIndex++]; - } - m_staticData.SetWeightTransModel(transModelWeight); - } - - // WP - m_staticData.SetWeightWordPenalty(weight[currIndex++]); - - // generation - { - size_t numGenerationDict = m_staticData.GetGenerationDictionarySize(); - std::vector<float> generationWeight(numGenerationDict); - - for (size_t i = 0 ; i < numGenerationDict ; i++) - { - generationWeight[i] = weight[currIndex++]; - } - m_staticData.SetWeightGeneration(generationWeight); - } -} diff --git a/moses/src/WeightOptimization.h b/moses/src/WeightOptimization.h deleted file mode 100755 index 74fad2365..000000000 --- a/moses/src/WeightOptimization.h +++ /dev/null @@ -1,44 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <vector> - -class StaticData; - -class WeightOptimization -{ -public: - //virtual std::vector<float> GetComponentScore() = 0; - virtual void SetWeight(const std::vector<float> &weight) = 0; -}; - -class WeightOptimizationImpl : public WeightOptimization -{ - StaticData &m_staticData; - - WeightOptimizationImpl(); // not implemented -public: - WeightOptimizationImpl(StaticData &staticData); - //std::vector<float> GetComponentScore(); - void SetWeight(const std::vector<float> &weight); -}; diff --git a/moses/src/Word.cpp b/moses/src/Word.cpp deleted file mode 100755 index 9a36cc821..000000000 --- a/moses/src/Word.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include <sstream> -#include "memory.h" -#include "Word.h" -#include "TypeDef.h" - -using namespace std; - -Word::Word(const Word ©) -{ // automatically points to orig's factors - Word::Copy(m_factorArray, copy.m_factorArray); -} - -Word::Word() -{ - Word::Initialize(m_factorArray); -} - -Word::Word(const FactorArray &factorArray) -{ - for (size_t factor = 0 ; factor < NUM_FACTORS ; factor++) - { - m_factorArray[factor] = factorArray[factor]; - } -} - -int Word::Compare(const Word &compare) const -{ - return Compare(GetFactorArray(), compare.GetFactorArray()); -} - -// static -int Word::Compare(const FactorArray &targetWord, const FactorArray &sourceWord) -{ - for (size_t factorType = 0 ; factorType < NUM_FACTORS ; factorType++) - { - const Factor *targetFactor = targetWord[factorType] - ,*sourceFactor = sourceWord[factorType]; - - if (targetFactor == NULL || sourceFactor == NULL) - { - continue; - } - int result = targetFactor->Compare(*sourceFactor); - if ( result ) - return result; - } - return 0; - -} - -void Word::Copy(FactorArray &target, const FactorArray &source) -{ - memcpy(target, source, sizeof(FactorArray)); -} - -void Word::Initialize(FactorArray &factorArray) -{ - memset(factorArray, 0, sizeof(FactorArray)); -} - -void Word::Merge(FactorArray &targetWord, const FactorArray &sourceWord) -{ - for (unsigned int currFactor = 0 ; currFactor < NUM_FACTORS ; currFactor++) - { - const Factor *sourcefactor = sourceWord[currFactor] - ,*targetFactor = targetWord[currFactor]; - if (targetFactor == NULL && sourcefactor != NULL) - { - targetWord[currFactor] = sourcefactor; - } - } -} - -std::string Word::ToString(const FactorArray &factorArray) -{ - stringstream strme; - - for (unsigned int currFactor = 0 ; currFactor < NUM_FACTORS ; currFactor++) - { - const Factor *factor = factorArray[currFactor]; - if (factor != NULL) - { - strme << *factor << "|"; - } - } - string str = strme.str(); - str = str.substr(0, str.size() - 1) + " "; - return str; -} - -TO_STRING_BODY(Word); - -// friend -ostream& operator<<(ostream& out, const Word& word) -{ - stringstream strme; - -// strme << "("; - for (unsigned int currFactor = 0 ; currFactor < NUM_FACTORS ; currFactor++) - { - FactorType factorType = static_cast<FactorType>(currFactor); - const Factor *factor = word.GetFactor(factorType); - if (factor != NULL) - { - strme << *factor << "|"; - } - } - string str = strme.str(); - str = str.substr(0, str.size() - 1); - out << str << " "; - return out; -} - diff --git a/moses/src/Word.h b/moses/src/Word.h deleted file mode 100755 index 691018e39..000000000 --- a/moses/src/Word.h +++ /dev/null @@ -1,92 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <iostream> -#include <vector> -#include <list> -#include "TypeDef.h" -#include "Factor.h" -#include "FactorTypeSet.h" -#include "Util.h" - -class Phrase; - -class Word -{ - friend std::ostream& operator<<(std::ostream&, const Word&); - -protected: - FactorArray m_factorArray; - -public: - Word(const Word ©); - Word(const FactorArray &factorArray); - Word(); - - ~Word() - { - } - - inline FactorArray &GetFactorArray() - { - return m_factorArray; - } - inline const FactorArray &GetFactorArray() const - { - return m_factorArray; - } - inline const Factor *GetFactor(FactorType factorType) const - { - return m_factorArray[factorType]; - } - inline void SetFactor(FactorType factorType, const Factor *factor) - { - m_factorArray[factorType] = factor; - } - - int Compare(const Word &compare) const; - // -1 = less than - // +1 = more than - // 0 = same - - inline bool operator< (const Word &compare) const - { // needed to store word in GenerationDictionary map - // uses comparison of FactorKey - // 'proper' comparison, not address/id comparison - return Compare(compare) < 0; - } - - TO_STRING; - - // FactorArray - static void Copy(FactorArray &target, const FactorArray &source); - static void Initialize(FactorArray &factorArray); - /*** - * wherever the source word has a given factor that the target word is missing, add it to the target word - */ - static void Merge(FactorArray &targetWord, const FactorArray &sourceWord); - static std::string ToString(const FactorArray &factorArray); - static int Compare(const FactorArray &targetWord, const FactorArray &sourceWord); - -}; - diff --git a/moses/src/WordInsertionTable.h b/moses/src/WordInsertionTable.h deleted file mode 100644 index 04139d137..000000000 --- a/moses/src/WordInsertionTable.h +++ /dev/null @@ -1,20 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ diff --git a/moses/src/WordsBitmap.cpp b/moses/src/WordsBitmap.cpp deleted file mode 100755 index 1b12aa487..000000000 --- a/moses/src/WordsBitmap.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include "WordsBitmap.h" - -TO_STRING_BODY(WordsBitmap); -int WordsBitmap::GetFutureCosts(int lastPos) const -{ - - // std::cerr<<" for lastpos "<<lastPos<<" and cov: "<<*this<<" got costs "; - - int sum=0; - bool aim1=0,ai=0,aip1=m_bitmap[0]; - - for(size_t i=0;i<m_size;++i) { - aim1 = ai; - ai = aip1; - aip1 = (i+1==m_size || m_bitmap[i+1]); - -#ifndef NDEBUG - if( i>0 ) assert( aim1==(i==0||m_bitmap[i-1]==1)); - //assert( ai==a[i] ); - if( i+1<m_size ) assert( aip1==m_bitmap[i+1]); -#endif - if((i==0||aim1)&&ai==0) { - sum+=abs(lastPos-static_cast<int>(i)+1); - // sum+=getJumpCosts(lastPos,i,maxJumpWidth); - } - // if(sum>1e5) return sum; - if(i>0 && ai==0 && (i+1==m_size||aip1) ) lastPos=i+1; - } - - // sum+=getJumpCosts(lastPos,as,maxJumpWidth); - sum+=abs(lastPos-static_cast<int>(m_size)+1); //getCosts(lastPos,as); - assert(sum>=0); - - // std::cerr<<sum<<"\n"; - - return sum; -} - - -std::vector<size_t> WordsBitmap::GetCompressedReprentation() const -{ - std::vector<size_t> res(1 + (m_size >> (sizeof(int) + 3)), 0); - size_t c=0; size_t x=0; size_t ci=0; - for(size_t i=0;i<m_size;++i) { - x |= (size_t)m_bitmap[i]; - x <<= 1; - c++; - if (c == sizeof(int)*8) { - res[ci++] = x; x = 0; - } - } - return res; -} - diff --git a/moses/src/WordsBitmap.h b/moses/src/WordsBitmap.h deleted file mode 100755 index c80633a46..000000000 --- a/moses/src/WordsBitmap.h +++ /dev/null @@ -1,177 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <limits> -#include <vector> -#include <iostream> -#include <cstring> -#include <cmath> -#include "TypeDef.h" -#include "WordsRange.h" - -class WordsBitmap -{ - friend std::ostream& operator<<(std::ostream& out, const WordsBitmap& wordsBitmap); -protected: - const size_t m_size; - bool *m_bitmap; - // ticks of words that have been done; - - WordsBitmap(); // not implemented - - void Initialize() - { - for (size_t pos = 0 ; pos < m_size ; pos++) - { - m_bitmap[pos] = false; - } - } - -public: - WordsBitmap(size_t size) - :m_size (size) - { - m_bitmap = (bool*) malloc(sizeof(bool) * size); - Initialize(); - } - - WordsBitmap(const WordsBitmap ©) - :m_size (copy.m_size) - { - m_bitmap = (bool*) malloc(sizeof(bool) * m_size); - for (size_t pos = 0 ; pos < m_size ; pos++) - { - m_bitmap[pos] = copy.GetValue(pos); - } - } - ~WordsBitmap() - { - free(m_bitmap); - } - - size_t GetWordsCount() const - { - size_t count = 0; - for (size_t pos = 0 ; pos < m_size ; pos++) - { - if (m_bitmap[pos]) - count++; - } - return count; - } - - size_t GetFirstGapPos() const - { - for (size_t pos = 0 ; pos < m_size ; pos++) - { - if (m_bitmap[pos] == 0) - { - return pos; - } - } - // no starting pos - return NOT_FOUND; - } - size_t GetLastPos() const - { - for (int pos = (int) m_size - 1 ; pos >= 0 ; pos--) - { - if (m_bitmap[pos]) - { - return pos; - } - } - // no starting pos - return NOT_FOUND; - } - bool GetValue(size_t pos) const - { - return m_bitmap[pos]; - } - void SetValue( size_t pos, bool value ) - { - m_bitmap[pos] = value; - } - void SetValue( size_t startPos, size_t endPos, bool value ) - { - for(size_t pos = startPos ; pos <= endPos ; pos++) - { - m_bitmap[pos] = value; - } - } - bool IsComplete() const - { - return GetSize() == GetWordsCount(); - } - - bool Overlap(const WordsRange &compare) const - { - for (size_t pos = compare.GetStartPos() ; pos <= compare.GetEndPos() ; pos++) - { - if (m_bitmap[pos]) - return true; - } - return false; - } - - size_t GetSize() const - { - return m_size; - } - - std::vector<size_t> GetCompressedReprentation() const; - - inline int Compare (const WordsBitmap &compare) const - { - // -1 = less than - // +1 = more than - // 0 = same - - size_t thisSize = GetSize() - ,compareSize = compare.GetSize(); - - if (thisSize != compareSize) - { - return (thisSize < compareSize) ? -1 : 1; - } - - return std::memcmp(m_bitmap, compare.m_bitmap, thisSize); - } - - - int GetFutureCosts(int lastPos) const ; - - TO_STRING; -}; - - -// friend -inline std::ostream& operator<<(std::ostream& out, const WordsBitmap& wordsBitmap) -{ - for (size_t i = 0 ; i < wordsBitmap.m_size ; i++) - { - out << (wordsBitmap.GetValue(i) ? 1 : 0); - } - return out; -} - diff --git a/moses/src/WordsRange.cpp b/moses/src/WordsRange.cpp deleted file mode 100644 index af22fd591..000000000 --- a/moses/src/WordsRange.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#include "WordsRange.h" - -TO_STRING_BODY(WordsRange); - -std::ostream& operator << (std::ostream& out, const WordsRange& range) -{ - out << "[" << range.m_startPos << " -> " << range.m_endPos << "]"; - return out; -} diff --git a/moses/src/WordsRange.h b/moses/src/WordsRange.h deleted file mode 100755 index d1b2d1786..000000000 --- a/moses/src/WordsRange.h +++ /dev/null @@ -1,70 +0,0 @@ -// $Id$ - -/*********************************************************************** -Moses - factored phrase-based language decoder -Copyright (C) 2006 University of Edinburgh - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -***********************************************************************/ - -#pragma once - -#include <iostream> -#include "TypeDef.h" -#include "Util.h" - -/*** - * Efficient version of WordsBitmap for contiguous ranges - */ -class WordsRange -{ - friend std::ostream& operator << (std::ostream& out, const WordsRange& range); - - size_t m_startPos, m_endPos; -public: - inline WordsRange(size_t startPos, size_t endPos) : m_startPos(startPos), m_endPos(endPos) {} - inline WordsRange(const WordsRange ©) - : m_startPos(copy.GetStartPos()) - , m_endPos(copy.GetEndPos()) - {} - - inline size_t GetStartPos() const - { - return m_startPos; - } - inline size_t GetEndPos() const - { - return m_endPos; - } - - inline int CalcDistortion(const WordsRange &prevRange) const - { - int dist = (int)prevRange.GetEndPos() - (int)GetStartPos() + 1 ; - return abs(dist); - } - - inline size_t GetWordsCount() const - { - return (m_startPos == NOT_FOUND) ? 0 : m_endPos - m_startPos + 1; - } - inline bool operator<(const WordsRange& x) const - { - return (m_startPos<x.m_startPos - || (m_startPos==x.m_startPos && m_endPos<x.m_endPos)); - } - - TO_STRING; -}; - diff --git a/moses/src/hash.cpp b/moses/src/hash.cpp deleted file mode 100644 index 3ea6af62b..000000000 --- a/moses/src/hash.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// $Id$ - -#define mix(a,b,c) \ -{ \ - a -= b; a -= c; a ^= (c>>13); \ - b -= c; b -= a; b ^= (a<<8); \ - c -= a; c -= b; c ^= (b>>13); \ - a -= b; a -= c; a ^= (c>>12); \ - b -= c; b -= a; b ^= (a<<16); \ - c -= a; c -= b; c ^= (b>>5); \ - a -= b; a -= c; a ^= (c>>3); \ - b -= c; b -= a; b ^= (a<<10); \ - c -= a; c -= b; c ^= (b>>15); \ -} - -/* the key */ -/* the length of the key */ -/* the previous hash, or an arbitrary value */ -unsigned int quick_hash(register const char *k, register unsigned int length, register unsigned int initval) -{ - register unsigned int a,b,c,len; - - /* Set up the internal state */ - len = length; - a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */ - c = initval; /* the previous hash value */ - - /*---------------------------------------- handle most of the key */ - while (len >= 12) - { - a += (k[0] +((unsigned int)k[1]<<8) +((unsigned int)k[2]<<16) +((unsigned int)k[3]<<24)); - b += (k[4] +((unsigned int)k[5]<<8) +((unsigned int)k[6]<<16) +((unsigned int)k[7]<<24)); - c += (k[8] +((unsigned int)k[9]<<8) +((unsigned int)k[10]<<16)+((unsigned int)k[11]<<24)); - mix(a,b,c); - k += 12; len -= 12; - } - - /*------------------------------------- handle the last 11 bytes */ - c += length; - switch(len) /* all the case statements fall through */ - { - case 11: c+=((unsigned int)k[10]<<24); - case 10: c+=((unsigned int)k[9]<<16); - case 9 : c+=((unsigned int)k[8]<<8); - /* the first byte of c is reserved for the length */ - case 8 : b+=((unsigned int)k[7]<<24); - case 7 : b+=((unsigned int)k[6]<<16); - case 6 : b+=((unsigned int)k[5]<<8); - case 5 : b+=k[4]; - case 4 : a+=((unsigned int)k[3]<<24); - case 3 : a+=((unsigned int)k[2]<<16); - case 2 : a+=((unsigned int)k[1]<<8); - case 1 : a+=k[0]; - /* case 0: nothing left to add */ - } - mix(a,b,c); - /*-------------------------------------------- report the result */ - return c; -} - diff --git a/moses/src/hash.h b/moses/src/hash.h deleted file mode 100644 index 83ddfd38f..000000000 --- a/moses/src/hash.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _HASH_H_ -#define _HASH_H_ - -// taken from burtleburtle.net/bob/hash/doobs.html -unsigned int quick_hash(register const char *k, register unsigned int length, register unsigned int initval); - -#endif - diff --git a/moses/src/md5.cpp b/moses/src/md5.cpp deleted file mode 100644 index 47999d092..000000000 --- a/moses/src/md5.cpp +++ /dev/null @@ -1,261 +0,0 @@ -// $Id$ - -/* - * This code implements the MD5 message-digest algorithm. - * The algorithm is due to Ron Rivest. This code was - * written by Colin Plumb in 1993, no copyright is claimed. - * This code is in the public domain; do with it what you wish. - * - * Equivalent code is available from RSA Data Security, Inc. - * This code has been tested against that, and is equivalent, - * except that you don't need to include two pages of legalese - * with every copy. - * - * To compute the message digest of a chunk of bytes, declare an - * MD5Context structure, pass it to MD5Init, call MD5Update as - * needed on buffers full of bytes, and then call MD5Final, which - * will fill a supplied 16-byte array with the digest. - */ - -/* Brutally hacked by John Walker back from ANSI C to K&R (no - prototypes) to maintain the tradition that Netfone will compile - with Sun's original "cc". */ - -#include <memory.h> /* for memcpy() */ -#include "md5.h" - -#ifdef sgi -#define HIGHFIRST -#endif - -#ifdef sun -#define HIGHFIRST -#endif - -#ifndef HIGHFIRST -#define byteReverse(buf, len) /* Nothing */ -#else -/* - * Note: this code is harmless on little-endian machines. - */ -void byteReverse(buf, longs) - unsigned char *buf; unsigned longs; -{ - uint32 t; - do { - t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 | - ((unsigned) buf[1] << 8 | buf[0]); - *(uint32 *) buf = t; - buf += 4; - } while (--longs); -} -#endif - -/* - * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious - * initialization constants. - */ -void MD5Init(struct MD5Context *ctx) -{ - ctx->buf[0] = 0x67452301; - ctx->buf[1] = 0xefcdab89; - ctx->buf[2] = 0x98badcfe; - ctx->buf[3] = 0x10325476; - - ctx->bits[0] = 0; - ctx->bits[1] = 0; -} - -/* - * Update context to reflect the concatenation of another buffer full - * of bytes. - */ -void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len) -{ - uint32 t; - - /* Update bitcount */ - - t = ctx->bits[0]; - if ((ctx->bits[0] = t + ((uint32) len << 3)) < t) - ctx->bits[1]++; /* Carry from low to high */ - ctx->bits[1] += len >> 29; - - t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ - - /* Handle any leading odd-sized chunks */ - - if (t) { - unsigned char *p = (unsigned char *) ctx->in + t; - - t = 64 - t; - if (len < t) { - memcpy(p, buf, len); - return; - } - memcpy(p, buf, t); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32 *) ctx->in); - buf += t; - len -= t; - } - /* Process data in 64-byte chunks */ - - while (len >= 64) { - memcpy(ctx->in, buf, 64); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32 *) ctx->in); - buf += 64; - len -= 64; - } - - /* Handle any remaining bytes of data. */ - - memcpy(ctx->in, buf, len); -} - -/* - * Final wrapup - pad to 64-byte boundary with the bit pattern - * 1 0* (64-bit count of bits processed, MSB-first) - */ -void MD5Final(unsigned char digest[16], struct MD5Context *ctx) -{ - unsigned count; - unsigned char *p; - - /* Compute number of bytes mod 64 */ - count = (ctx->bits[0] >> 3) & 0x3F; - - /* Set the first char of padding to 0x80. This is safe since there is - always at least one byte free */ - p = ctx->in + count; - *p++ = 0x80; - - /* Bytes of padding needed to make 64 bytes */ - count = 64 - 1 - count; - - /* Pad out to 56 mod 64 */ - if (count < 8) { - /* Two lots of padding: Pad the first block to 64 bytes */ - memset(p, 0, count); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32 *) ctx->in); - - /* Now fill the next block with 56 bytes */ - memset(ctx->in, 0, 56); - } else { - /* Pad block to 56 bytes */ - memset(p, 0, count - 8); - } - byteReverse(ctx->in, 14); - - /* Append length in bits and transform */ - ((uint32 *) ctx->in)[14] = ctx->bits[0]; - ((uint32 *) ctx->in)[15] = ctx->bits[1]; - - MD5Transform(ctx->buf, (uint32 *) ctx->in); - byteReverse((unsigned char *) ctx->buf, 4); - memcpy(digest, ctx->buf, 16); - memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ -} - - -/* The four core functions - F1 is optimized somewhat */ - -/* #define F1(x, y, z) (x & y | ~x & z) */ -#define F1(x, y, z) (z ^ (x & (y ^ z))) -#define F2(x, y, z) F1(z, x, y) -#define F3(x, y, z) (x ^ y ^ z) -#define F4(x, y, z) (y ^ (x | ~z)) - -/* This is the central step in the MD5 algorithm. */ -#define MD5STEP(f, w, x, y, z, data, s) \ - ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x ) - -/* - * The core of the MD5 algorithm, this alters an existing MD5 hash to - * reflect the addition of 16 longwords of new data. MD5Update blocks - * the data and converts bytes into longwords for this routine. - */ -void MD5Transform(uint32 buf[4], uint32 in[16]) -{ - register uint32 a, b, c, d; - - a = buf[0]; - b = buf[1]; - c = buf[2]; - d = buf[3]; - - MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); - MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); - MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); - MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); - MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); - MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); - MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); - MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); - MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); - MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); - MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); - MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); - MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); - MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); - MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); - MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); - - MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); - MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); - MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); - MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); - MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); - MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); - MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); - MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); - MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); - MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); - MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); - MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); - MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); - MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); - MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); - MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); - - MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); - MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); - MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); - MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); - MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); - MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); - MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); - MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); - MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); - MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); - MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); - MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); - MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); - MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); - MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); - MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); - - MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); - MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); - MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); - MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); - MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); - MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); - MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); - MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); - MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); - MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); - MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); - MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); - MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); - MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); - MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); - MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); - - buf[0] += a; - buf[1] += b; - buf[2] += c; - buf[3] += d; -} diff --git a/moses/src/md5.h b/moses/src/md5.h deleted file mode 100644 index ff5f7a775..000000000 --- a/moses/src/md5.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef MD5_H -#define MD5_H - -#ifdef __alpha -typedef unsigned int uint32; -#else -typedef unsigned long uint32; -#endif - -struct MD5Context { - uint32 buf[4]; - uint32 bits[2]; - unsigned char in[64]; -}; - -void MD5Init(struct MD5Context *ctx); -void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len); -extern void MD5Final(unsigned char digest[16], struct MD5Context *ctx); -void MD5Transform(uint32 buf[4], uint32 in[16]); - -/* - * This is needed to make RSAREF happy on some MS-DOS compilers. - */ -typedef struct MD5Context MD5_CTX; - -#endif /* !MD5_H */ diff --git a/moses/src/mempool.cpp b/moses/src/mempool.cpp deleted file mode 100644 index 0f60f0791..000000000 --- a/moses/src/mempool.cpp +++ /dev/null @@ -1,518 +0,0 @@ -/****************************************************************************** - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -******************************************************************************/ - -// An efficient memory pool manager -// by M. Federico -// Copyright Marcello Federico, ITC-irst, 1998 - -#include <iostream> -#include <assert.h> -#include "mempool.h" - -using namespace std; - -/*! The pool contains: - - entries of size is - - tables for bs entries -*/ - -mempool::mempool(int is, int bs){ - - // item size must be multiple of memory alignment step (4 bytes) - // example: is is=9 becomes i=12 (9 + 4 - 9 %4 ) - - is=(is>(int)sizeof(char *)?is:0); - - is=is + sizeof(char *) - (is % sizeof(char *)); - - item_size = is; - - block_size = bs; - - true_size = is * bs; - - block_list = new memnode; - - block_list->block = new char[true_size]; - - memset(block_list->block,'0',true_size); - - block_list->next = 0; - - blocknum = 1; - - entries = 0; - - // build free list - - char *ptr = free_list = block_list->block; - - for (int i=0;i<block_size-1;i++) { - *(char **)ptr= ptr + item_size; - ptr+=item_size; - } - *(char **)ptr = NULL; //last item - -} - - -char * mempool::alloc(){ - - char *ptr; - - if (free_list==NULL) - { - memnode *new_block = new memnode; - - new_block->block = new char[true_size]; - - //memset(new_block->block,'0',true_size); - - new_block->next = block_list; - - block_list=new_block; // update block list - - /* update free list */ - - ptr = free_list = block_list->block; - - for (int i=0;i<block_size-1;i++) { - *(char **)ptr = ptr + item_size; - ptr = ptr + item_size; - } - - *(char **)ptr=NULL; - - blocknum++; - } - - assert(free_list); - - ptr = free_list; - - free_list=*(char **)ptr; - - *(char **)ptr=NULL; // reset the released item - - entries++; - - return ptr; - -} - - -int mempool::free(char* addr){ - - // do not check if it belongs to this pool !! - /* - memnode *list=block_list; - while ((list != NULL) && - ((addr < list->block) || - (addr >= (list->block + true_size)))) - list=list->next; - - if ((list==NULL) || (((addr - list->block) % item_size)!=0)) - { - //cerr << "mempool::free-> addr does not belong to this pool\n"; - return 0; - } - */ - - *(char **)addr=free_list; - free_list=addr; - - entries--; - - return 1; -} - - -mempool::~mempool() -{ - memnode *ptr; - - while (block_list !=NULL){ - ptr=block_list->next; - delete [] block_list->block; - delete block_list; - block_list=ptr; - } - -} - -void mempool::map (ostream& co){ - - co << "mempool memory map:\n"; - //percorri piu` volte la lista libera - - memnode *bl=block_list; - char *fl=free_list; - - char* img=new char[block_size+1]; - img[block_size]='\0'; - - while (bl !=NULL){ - - memset(img,'#',block_size); - - fl=free_list; - while (fl != NULL){ - if ((fl >= bl->block) - && - (fl < bl->block + true_size)) - { - img[(fl-bl->block)/item_size]='-'; - } - - fl=*(char **)fl; - } - - co << img << "\n"; - bl=bl->next; - } - delete [] img; -} - -void mempool::stat(){ - - cout << "mempool class statistics\n" - << "entries " << entries - << " blocks " << blocknum - << " used memory " << (blocknum * true_size)/1024 << " Kb\n"; -} - - - -strstack::strstack(int bs){ - - size=bs; - list=new memnode; - - list->block=new char[size]; - - list->next=0; - - memset(list->block,'\0',size); - idx=0; - - waste=0; - memory=size; - entries=0; - blocknum=1; - -} - - -void strstack::stat(){ - - cout << "strstack class statistics\n" - << "entries " << entries - << " blocks " << blocknum - << " used memory " << memory/1024 << " Kb\n"; -} - - -char *strstack::push(char *s){ - int len=strlen(s); - - if ((len+1) >= size){ - cerr << "strstack::push string is too long\n"; - exit(1); - }; - - if ((idx+len+1) >= size){ - //append a new block - //there must be space to - //put the index after - //the word - - waste+=size-idx; - blocknum++; - memory+=size; - - memnode* nd=new memnode; - nd->block=new char[size]; - nd->next=list; - - list=nd; - - memset(list->block,'\0',size); - - idx=0; - - } - - // append in current block - - strcpy(&list->block[idx],s); - - idx+=len+1; - - entries++; - - return &list->block[idx-len-1]; - -} - - -char *strstack::pop(){ - - if (list==0) return 0; - - if (idx==0){ - - // free this block and go to next - - memnode *ptr=list->next; - - delete [] list->block; - delete list; - - list=ptr; - - if (list==0) - return 0; - else - idx=size-1; - } - - //go back to first non \0 - while (idx>0) - if (list->block[idx--]!='\0') - break; - - //go back to first \0 - while (idx>0) - if (list->block[idx--]=='\0') - break; - - entries--; - - if (list->block[idx+1]=='\0') - { - idx+=2; - memset(&list->block[idx],'\0',size-idx); - return &list->block[idx]; - } - else{ - idx=0; - memset(&list->block[idx],'\0',size); - return &list->block[0]; - } -} - - -char *strstack::top(){ - - int tidx=idx; - memnode *tlist=list; - - if (tlist==0) return 0; - - if (idx==0){ - - tlist=tlist->next; - - if (tlist==0) return 0; - - tidx=size-1; - } - - //go back to first non \0 - while (tidx>0) - if (tlist->block[tidx--]!='\0') - break; - - //aaa\0bbb\0\0\0\0 - - //go back to first \0 - while (tidx>0) - if (tlist->block[tidx--]=='\0') - break; - - if (tlist->block[tidx+1]=='\0') - { - tidx+=2; - return &tlist->block[tidx]; - } - else{ - tidx=0; - return &tlist->block[0]; - } - -} - - -strstack::~strstack(){ - memnode *ptr; - while (list !=NULL){ - ptr=list->next; - delete [] list->block; - delete list; - list=ptr; - } -} - - -storage::storage(int maxsize,int blocksize) -{ - newmemory=0; - newcalls=0; - setsize=maxsize; - poolsize=blocksize; //in bytes - poolset=new mempool* [setsize+1]; - for (int i=0;i<=setsize;i++) - poolset[i]=NULL; -} - - -storage::~storage(){ - for (int i=0;i<=setsize;i++) - if (poolset[i]) - delete poolset[i]; - delete [] poolset; -} - - -char *storage::alloc(int size){ - - if (size<=setsize){ - if (!poolset[size]){ - poolset[size]=new mempool(size,poolsize/size); - } - return poolset[size]->alloc(); - } - else{ - - newmemory+=size+8; - newcalls++; - char* p=(char *)calloc(sizeof(char),size); - if (p==NULL){ - cerr << "storage::alloc insufficient memory\n"; - exit(1); - } - return p; - } -} - - - -char *storage::realloc(char *oldptr,int oldsize,int newsize){ - - char *newptr; - - assert(newsize>oldsize); - - if (oldsize<=setsize){ - if (newsize<=setsize){ - if (!poolset[newsize]) - poolset[newsize]=new mempool(newsize,poolsize/newsize); - newptr=poolset[newsize]->alloc(); - memset((char*)newptr,0,newsize); - } - else - newptr=(char *)calloc(sizeof(char),newsize); - - if (oldptr && oldsize){ - memcpy(newptr,oldptr,oldsize); - poolset[oldsize]->free(oldptr); - } - } - else{ - newptr=(char *)std::realloc(oldptr,newsize); - if (newptr==oldptr) - cerr << "r\b"; - else - cerr << "a\b"; - } - if (newptr==NULL){ - cerr << "storage::realloc insufficient memory\n"; - exit(1); - } - - return newptr; - -} - - -int storage::free(char *addr,int size){ - - /* - while(size<=setsize){ - if (poolset[size] && poolset[size]->free(addr)) - break; - size++; - } - */ - - if (size>setsize) - return free(addr),1; - else{ - poolset[size] && poolset[size]->free(addr); - } - return 1; -} - -void storage::stat(){ - int used=0; - int memory=sizeof(char *) * setsize; - int waste=0; - - for (int i=0;i<=setsize;i++) - if (poolset[i]){ - used++; - memory+=poolset[i]->used(); - waste+=poolset[i]->wasted(); - } - - cout << "storage class statistics\n"; - cout << "alloc entries " << newcalls - << " used memory " << newmemory/1024 << "Kb\n"; - cout << "mpools " << setsize - << " active " << used - << " used memory " << memory/1024 << "Kb" - << " wasted " << waste/1024 << "Kb\n"; -} - -/* -main(){ - - mempool* mp=new mempool(sizeof(int),80); - - int** ar= new (int*) [ 1000 ]; - - for (int i=0;i<1000;i++){ - ar[i]= (int *)mp->alloc(); - } - - mp->map(cout); - - for (int i=0;i<500;i++){ - mp->free(ar[i]); - } - - mp->map(cout); - -} - -*/ - - - diff --git a/moses/src/mempool.h b/moses/src/mempool.h deleted file mode 100644 index 20dc4d59f..000000000 --- a/moses/src/mempool.h +++ /dev/null @@ -1,181 +0,0 @@ -/****************************************************************************** - IrstLM: IRST Language Model Toolkit - Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -******************************************************************************/ - -// An efficient memory manager -// by M. Federico -// Copyright Marcello Federico, ITC-irst, 1998 - -#ifndef MF_MEMPOOL_H -#define MF_MEMPOOL_H - -#ifndef NULL -const int NULL=0; -//#define NULL=0; -#endif - -#include <iostream> // std::ostream - -//! Memory block -/*! This can be used by: -- mempool to store items of fixed size -- strstack to store strings of variable size -*/ - -class memnode{ - friend class mempool; //!< grant access - friend class strstack; //!< grant access - char *block; //!< block of memory - memnode *next; //!< next block ptr -}; - - -//! Memory pool - -/*! A memory pool is composed of: - - a linked list of block_num memory blocks - - each block might contain up to block_size items - - each item is made of exactly item_size bytes -*/ - -class mempool{ - int block_size; //!< number of entries per block - int item_size; //!< number of bytes per entry - int true_size; //!< number of bytes per block - memnode* block_list; //!< list of blocks - char* free_list; //!< free entry list - int entries; //!< number of stored entries - int blocknum; //!< number of allocated blocks - public: - - //! Creates a memory pool - mempool(int is, int bs); - - //! Destroys memory pool - ~mempool(); - - //! Prints a map of memory occupancy - void map(std::ostream& co); - - //! Allocates a single memory entry - char *alloc(); - - //! Frees a single memory entry - int free(char* addr); - - //! Prints statistics about this mempool - void stat(); - - //! Returns effectively used memory (bytes) - /*! includes 8 bytes required by each call of new */ - - int used(){return blocknum * (true_size + 8);}; - - //! Returns amount of wasted memory (bytes) - int wasted(){return used()-(entries * item_size);}; -}; - -//! A stack to store strings - -/*! - The stack is composed of - - a list of blocks memnode of fixed size - - attribute blocknum tells the block on top - - attribute idx tells position of the top string -*/ - -class strstack{ - memnode* list; //!< list of memory blocks - int size; //!< size of each block - int idx; //!< index of last stored string - int waste; //!< current waste of memory - int memory; //!< current use of memory - int entries; //!< current number of stored strings - int blocknum; //!< current number of used blocks - - public: - - strstack(int bs=1000); - - ~strstack(); - - char *push(char *s); - - char *pop(); - - char *top(); - - void stat(); - - int used(){return memory;}; - - int wasted(){return waste;}; - -}; - - -//! Manages multiple memory pools - -/*! - This class permits to manage memory pools - with items up to a specified size. - - items within the allowed range are stored in memory pools - - items larger than the limit are allocated with new -*/ - - -class storage{ - mempool **poolset; //!< array of memory pools - int setsize; //!< number of memory pools/maximum elem size - int poolsize; //!< size of each block - int newmemory; //!< stores amount of used memory - int newcalls; //!< stores number of allocated blocks - public: - - //! Creates storage - storage(int maxsize,int blocksize); - - //! Destroys storage - ~storage(); - - //! Allocates memory - char *alloc(int size); - - //! Realloc memory - char *realloc(char *oldptr,int oldsize,int newsize); - - //! Frees memory of an entry - int free(char *addr,int size=0); - - //! Prints statistics about storage - void stat(); -}; - - -#endif - - - - - - - - - - diff --git a/moses/templates/cpp b/moses/templates/cpp deleted file mode 100644 index e69de29bb..000000000 --- a/moses/templates/cpp +++ /dev/null diff --git a/moses/templates/h b/moses/templates/h deleted file mode 100644 index e69de29bb..000000000 --- a/moses/templates/h +++ /dev/null diff --git a/scripts/analysis/smtgui/Corpus.pm b/scripts/analysis/smtgui/Corpus.pm deleted file mode 100644 index f191ce273..000000000 --- a/scripts/analysis/smtgui/Corpus.pm +++ /dev/null @@ -1,867 +0,0 @@ -#package Corpus: hold a bunch of sentences in any language, with translation factors and stats about individual sentences and the corpus as a whole -#Evan Herbst, 7 / 25 / 06 - -package Corpus; -BEGIN -{ - push @INC, "."; -} -use Error; - -return 1; - -########################################################################################################################### - -#'our' variables are available outside the package -our @FACTORNAMES = ('surf', 'pos', 'lemma', 'stem', 'morph'); - -#constructor -#arguments: short corpus name (-name), hashref of filenames to descriptions (-descriptions), hashref of factor names to indices in this corpus (-indices) -sub new -{ - my $class = shift; - my %args = @_; #turn the remainder of @_ into a hash - my ($corpusName, $refFileDescs, $factorIndices) = ($args{'-name'}, $args{'-descriptions'}, $args{'-indices'}); - my $self = {}; - $self->{'corpusName'} = $corpusName; - $self->{'truth'} = []; #arrayref of arrayrefs of factors - $self->{'input'} = []; #same; also same for any system outputs that get loaded - $self->{'truthFilename'} = ""; - $self->{'inputFilename'} = ""; - $self->{'sysoutFilenames'} = {}; #hashref of (string => string) for (system name, filename) - $self->{'phraseTableFilenames'} = {}; #factor name (from @FACTORNAMES) => filename - $self->{'factorIndices'} = {}; #factor name => index; names ought to be strings from the standard list in @FACTORNAMES - %{$self->{'factorIndices'}} = %$factorIndices; - $self->{'phraseTables'} = {}; #factor name (from @FACTORNAMES) => hashref of source phrases to anything; used for unknown-word counting - $self->{'unknownCount'} = {}; #factor name => count of unknown tokens in input - $self->{'totalTokens'} = 0; #useful with counts of unknown tokens - $self->{'sysoutWER'} = {}; #system name => (factor name => arrayref with system output total WER and arrayref of WER scores for individual sysout sentences wrt truth) - $self->{'sysoutPWER'} = {}; #similarly - $self->{'fileDescriptions'} = {}; #filename associated with us => string description of file - $self->{'bleuScores'} = {}; #system name => (factor name => arrayref of (overall score, arrayref of per-sentence scores) ) - $self->{'cacheFilename'} = "cache/$corpusName.cache"; #all memory of various scores is stored here - bless $self, $class; - $self->locateFiles($refFileDescs); #find all relevant files in the current directory; set filenames and descriptions - $self->loadCacheFile(); - return $self; -} - -#arguments: filename -#return: description string -#throw if filename doesn't belong to this corpus -sub getFileDescription -{ - my ($self, $filename) = @_; - if(!defined($self->{'fileDescriptions'}->{$filename})) - { - throw Error::Simple(-text => "Corpus::getFileDescription(): invalid filename '$filename'\n"); - } - return $self->{'fileDescriptions'}->{$filename}; -} - -#arguments: hashref of factor names to indices (not all factors in @FACTORNAMES must be included, but no strings not from the list should be) -#return: none -sub setFactorIndices -{ - my ($self, $refIndices) = @_; - %{$self->{'factorIndices'}} = %{$refIndices}; -} - -#calculate the number of unknown factor values for the given factor in the input file -#arguments: factor name -#return: unknown factor count, total factor count (note the total doesn't depend on the factor) -#throw if we don't have an input file or a phrase table for the given factor defined or if there's no index known for the given factor -sub calcUnknownTokens -{ - my ($self, $factorName) = @_; - #check in-memory cache first - if(defined($self->{'unknownCount'}->{$factorName})) - { - return ($self->{'unknownCount'}->{$factorName}, $self->{'totalTokens'}); - } - - $self->ensureFilenameDefined('input'); - $self->ensurePhraseTableDefined($factorName); - $self->ensureFactorPosDefined($factorName); - $self->loadSentences('input', $self->{'inputFilename'}); - $self->loadPhraseTable($factorName); - - #count unknown and total words - my ($unknownTokens, $totalTokens) = (0, 0); - my $factorIndex = $self->{'factorIndices'}->{$factorName}; - foreach my $sentence (@{$self->{'input'}}) - { - $totalTokens += scalar(@$sentence); - foreach my $word (@$sentence) - { - if(!defined($self->{'phraseTables'}->{$factorName}->{$word->[$factorIndex]})) - { - $unknownTokens++; - } - } - } - $self->{'unknownCount'}->{$factorName} = $unknownTokens; - $self->{'totalTokens'} = $totalTokens; - - return ($unknownTokens, $totalTokens); -} - -#arguments: system name -#return: (WER, PWER) for nouns and adjectives in given system wrt truth -#throw if given system or truth is not set or if index of 'surf' or 'pos' hasn't been specified -sub calcNounAdjWER_PWERDiff -{ - my ($self, $sysname) = @_; - $self->ensureFilenameDefined('truth'); - $self->ensureFilenameDefined($sysname); - $self->ensureFactorPosDefined('surf'); - $self->ensureFactorPosDefined('pos'); - $self->loadSentences('truth', $self->{'truthFilename'}); - $self->loadSentences($sysname, $self->{'sysoutFilenames'}->{$sysname}); - #find nouns and adjectives and score them - my ($werScore, $pwerScore) = (0, 0); - my $nnNadjTags = $self->getPOSTagList('nounAndAdj'); - for(my $i = 0; $i < scalar(@{$self->{'truth'}}); $i++) - { -# warn "truth " . join(', ', map {join('|', @$_)} @{$self->{'truth'}->[$i]}) . "\n"; -# warn "sysout " . join(', ', map {join('|', @$_)} @{$self->{$sysname}->[$i]}) . "\n"; - my @nnAdjEWords = $self->filterFactors($self->{'truth'}->[$i], $self->{'factorIndices'}->{'pos'}, $nnNadjTags); - my @nnAdjSWords = $self->filterFactors($self->{$sysname}->[$i], $self->{'factorIndices'}->{'pos'}, $nnNadjTags); -# warn "filtered truth: " . join(' ', map {join('|', @$_)} @nnAdjEWords) . "\n"; -# warn "filtered sysout: " . join(' ', map {join('|', @$_)} @nnAdjSWords) . "\n\n\n"; - my ($sentWer, $tmp) = $self->sentenceWER(\@nnAdjSWords, \@nnAdjEWords, $self->{'factorIndices'}->{'surf'}); - $werScore += $sentWer; - ($sentWer, $tmp) = $self->sentencePWER(\@nnAdjSWords, \@nnAdjEWords, $self->{'factorIndices'}->{'surf'}); - $pwerScore += $sentWer; - } - - #unhog memory - $self->releaseSentences('truth'); - $self->releaseSentences($sysname); - return ($werScore, $pwerScore); -} - -#calculate detailed WER statistics and put them into $self -#arguments: system name, factor name to consider (default 'surf', surface form) -#return: overall surface WER for given system (w/o filtering) -#throw if given system or truth is not set or if index of factor name hasn't been specified -sub calcOverallWER -{ - my ($self, $sysname, $factorName) = (shift, shift, 'surf'); - if(scalar(@_) > 0) {$factorName = shift;} - #check in-memory cache first - if(defined($self->{'sysoutWER'}->{$sysname}->{$factorName})) - { - return $self->{'sysoutWER'}->{$sysname}->{$factorName}->[0]; - } - - $self->ensureFilenameDefined('truth'); - $self->ensureFilenameDefined($sysname); - $self->ensureFactorPosDefined($factorName); - $self->loadSentences('truth', $self->{'truthFilename'}); - $self->loadSentences($sysname, $self->{'sysoutFilenames'}->{$sysname}); - - my ($wer, $swers, $indices) = $self->corpusWER($self->{$sysname}, $self->{'truth'}, $self->{'factorIndices'}->{$factorName}); - $self->{'sysoutWER'}->{$sysname}->{$factorName} = [$wer, $swers, $indices]; #total; arrayref of scores for individual sentences; arrayref of arrayrefs of offending words in each sentence - - #unhog memory - $self->releaseSentences('truth'); - $self->releaseSentences($sysname); - return $self->{'sysoutWER'}->{$sysname}->{$factorName}->[0]; -} - -#calculate detailed PWER statistics and put them into $self -#arguments: system name, factor name to consider (default 'surf') -#return: overall surface PWER for given system (w/o filtering) -#throw if given system or truth is not set or if index of factor name hasn't been specified -sub calcOverallPWER -{ - my ($self, $sysname, $factorName) = (shift, shift, 'surf'); - if(scalar(@_) > 0) {$factorName = shift;} - #check in-memory cache first - if(defined($self->{'sysoutPWER'}->{$sysname}->{$factorName})) - { - return $self->{'sysoutPWER'}->{$sysname}->{$factorName}->[0]; - } - - $self->ensureFilenameDefined('truth'); - $self->ensureFilenameDefined($sysname); - $self->ensureFactorPosDefined($factorName); - $self->loadSentences('truth', $self->{'truthFilename'}); - $self->loadSentences($sysname, $self->{'sysoutFilenames'}->{$sysname}); - - my ($pwer, $spwers, $indices) = $self->corpusPWER($self->{$sysname}, $self->{'truth'}, $self->{'factorIndices'}->{$factorName}); - $self->{'sysoutPWER'}->{$sysname}->{$factorName} = [$pwer, $spwers, $indices]; #total; arrayref of scores for individual sentences; arrayref of arrayrefs of offending words in each sentence - - #unhog memory - $self->releaseSentences('truth'); - $self->releaseSentences($sysname); - return $self->{'sysoutPWER'}->{$sysname}->{$factorName}->[0]; -} - -#arguments: system name, factor name to consider (default 'surf') -#return: BLEU score, n-gram precisions, brevity penalty -sub calcBLEU -{ - my ($self, $sysname, $factorName) = (shift, shift, 'surf'); - if(scalar(@_) > 0) {$factorName = shift;} - #check in-memory cache first - if(defined($self->{'bleuScores'}->{$sysname}->{$factorName})) - { - return $self->{'bleuScores'}->{$sysname}->{$factorName}; - } - - $self->ensureFilenameDefined('truth'); - $self->ensureFilenameDefined($sysname); - $self->ensureFactorPosDefined($factorName); - $self->loadSentences('truth', $self->{'truthFilename'}); - $self->loadSentences($sysname, $self->{'sysoutFilenames'}->{$sysname}); - - #score structure: various total scores, arrayref of by-sentence score arrays - if(!defined($self->{'bleuScores'}->{$sysname})) {$self->{'bleuScores'}->{$sysname} = {};} - if(!defined($self->{'bleuScores'}->{$sysname}->{$factorName})) {$self->{'bleuScores'}->{$sysname}->{$factorName} = [[], []];} - - my ($good1, $tot1, $good2, $tot2, $good3, $tot3, $good4, $tot4, $totCLength, $totRLength) = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - my $factorIndex = $self->{'factorIndices'}->{$factorName}; - for(my $i = 0; $i < scalar(@{$self->{'truth'}}); $i++) - { - my ($truthSentence, $sysoutSentence) = ($self->{'truth'}->[$i], $self->{$sysname}->[$i]); - my ($unigood, $unicount, $bigood, $bicount, $trigood, $tricount, $quadrugood, $quadrucount, $cLength, $rLength) = - $self->sentenceBLEU($truthSentence, $sysoutSentence, $factorIndex, 0); #last argument is whether to debug-print - push @{$self->{'bleuScores'}->{$sysname}->{$factorName}->[1]}, [$unigood, $unicount, $bigood, $bicount, $trigood, $tricount, $quadrugood, $quadrucount, $cLength, $rLength]; - $good1 += $unigood; $tot1 += $unicount; - $good2 += $bigood; $tot2 += $bicount; - $good3 += $trigood; $tot3 += $tricount; - $good4 += $quadrugood; $tot4 += $quadrucount; - $totCLength += $cLength; - $totRLength += $rLength; - } - my $brevity = ($totCLength > $totRLength || $totCLength == 0) ? 1 : exp(1 - $totRLength / $totCLength); - my ($pct1, $pct2, $pct3, $pct4) = ($good1 / $tot1, $good2 / $tot2, $good3 / $tot3, $good4 / $tot4); -# warn sprintf("n-gram prec: %d/%d = %.3lf, %d/%d = %.3lf, %d/%d = %.3lf, %d/%d = %.3lf\n", -# $good1, $tot1, $pct1, $good2, $tot2, $pct2, $good3, $tot3, $pct3, $good4, $tot4, $pct4); - my $bleu = $brevity * exp((my_log($pct1) + my_log($pct2) + my_log($pct3) + my_log($pct4)) / 4); -# warn sprintf("brevity: %.3lf (%d ref, %d sys)\n", $brevity, $totRLength, $totCLength); - sleep 8; - $self->{'bleuScores'}->{$sysname}->{$factorName}->[0] = [$bleu, 100 * $pct1, 100 * $pct2, 100 * $pct3, 100 * $pct4, $brevity]; - - #unhog memory - $self->releaseSentences('truth'); - $self->releaseSentences($sysname); - return @{$self->{'bleuScores'}->{$sysname}->{$factorName}->[0]}; -} - -#write HTML to be displayed to compare the various versions we have of each sentence in the corpus; -#allow filtering of which versions will be displayed -#(we don't write the whole page, just the contents of the body) -#arguments: filehandleref to which to write, regex to filter filename extensions to be included -#return: none -sub writeComparisonPage -{ - my ($self, $fh, $filter) = @_; - my @filteredExtensions = grep($filter, ('e', 'f', keys %{$self->{'sysoutFilenames'}})); - my %openedFiles = $self->openFiles(@filteredExtensions); - my $id = 1; #sentence ID string - while(my %lines = $self->readLineFromFiles(%openedFiles)) - { - $self->printSingleSentenceComparison($fh, $id, %lines); - $id++; - } - $self->closeFiles(%openedFiles); -} - -########################################################################################################## -##### INTERNAL ################################################################################### -########################################################################################################## - -#destructor! -#arguments: none -#return: none -sub DESTROY -{ - my $self = shift; - $self->writeCacheFile(); -} - -#write all scores in memory to disk -#arguments: none -#return: none -sub writeCacheFile -{ - my $self = shift; - if(!open(CACHEFILE, ">" . $self->{'cacheFilename'})) - { - warn "Corpus::writeCacheFile(): can't open '" . $self->{'cacheFilename'} . "' for write\n"; - return; - } - - #store file changetimes to disk - print CACHEFILE "File changetimes\n"; - #store bleu scores to disk - print CACHEFILE "\nBLEU scores\n"; - foreach my $sysname (keys %{$self->{'bleuScores'}}) - { - foreach my $factorName (keys %{$self->{'bleuScores'}->{$sysname}}) - { - print CACHEFILE "$sysname $factorName " . join(' ', @{$self->{'bleuScores'}->{$sysname}->{$factorName}->[0]}); - foreach my $sentenceBLEU (@{$self->{'bleuScores'}->{$sysname}->{$factorName}->[1]}) - { - print CACHEFILE "; " . join(' ', @$sentenceBLEU); - } - print CACHEFILE "\n"; - } - } - #store unknown-token counts to disk - print CACHEFILE "\nUnknown-token counts\n"; - foreach my $factorName (keys %{$self->{'unknownCount'}}) - { - print CACHEFILE $factorName . " " . $self->{'phraseTableFilenames'}->{$factorName} . " " . $self->{'unknownCount'}->{$factorName} . " " . $self->{'totalTokens'} . "\n"; - } - #store WER, PWER to disk - print CACHEFILE "\nWER scores\n"; - my $printWERFunc = - sub - { - my $werType = shift; - foreach my $sysname (keys %{$self->{$werType}}) - { - foreach my $factorName (keys %{$self->{$werType}->{$sysname}}) - { - my ($totalWER, $sentenceWERs, $errorWords) = @{$self->{$werType}->{$sysname}->{$factorName}}; - print CACHEFILE "$werType $sysname $factorName $totalWER " . join(' ', @$sentenceWERs); - foreach my $indices (@$errorWords) - { - print CACHEFILE ";" . join(' ', @$indices); - } - print CACHEFILE "\n"; - } - } - }; - &$printWERFunc('sysoutWER'); - &$printWERFunc('sysoutPWER'); - #store misc scores to disk - print CACHEFILE "\nMisc scores\n"; - close(CACHEFILE); -} - -#load all scores present in the cache file into the appropriate fields of $self -#arguments: none -#return: none -sub loadCacheFile -{ - my $self = shift; - if(!open(CACHEFILE, "<" . $self->{'cacheFilename'})) - { - warn "Corpus::loadCacheFile(): can't open '" . $self->{'cacheFilename'} . "' for read\n"; - return; - } - my $mode = 'none'; - while(my $line = <CACHEFILE>) - { - next if $line =~ /^[ \t\n\r\x0a]*$/; #anyone know why char 10 (0x0a) shows up on empty lines, at least on solaris? - chop $line; - #check for start of section - if($line eq "File changetimes\n") {$mode = 'ctime';} - elsif($line eq "BLEU scores\n") {$mode = 'bleu';} - elsif($line eq "Unknown-token counts\n") {$mode = 'unk';} - elsif($line eq "WER scores") {$mode = 'wer';} - elsif($line eq "Misc scores") {$mode = 'misc';} - #get data when in a mode already - elsif($mode eq 'ctime') - { - } - elsif($mode eq 'bleu') - { - local ($sysname, $factorName, $rest) = split(/\s+/, $line, 3); - if(!defined($self->{'bleuScores'}->{$sysname})) {$self->{'bleuScores'}->{$sysname} = {};} - if(!defined($self->{'bleuScores'}->{$sysname}->{$factorName})) {$self->{'bleuScores'}->{$sysname}->{$factorName} = [[], []];} - my @stats = map {my @tmp = split(/\s+/, $_); \@tmp;} split(/;/, $rest); - $self->{'bleuScores'}->{$sysname}->{$factorName}->[0] = shift @stats; - $self->{'bleuScores'}->{$sysname}->{$factorName}->[1] = \@stats; - } - elsif($mode eq 'unk') - { - local ($factorName, $phraseTableFilename, $unknownCount, $totalCount) = split(' ', $line); - if(defined($self->{'phraseTableFilenames'}->{$factorName}) && $self->{'phraseTableFilenames'}->{$factorName} eq $phraseTableFilename) - { - $self->{'unknownCount'}->{$factorName} = $unknownCount; - $self->{'totalTokens'} = $totalCount; - } - } - elsif($mode eq 'wer') - { - local ($werType, $sysname, $factorName, $totalWER, $details) = split(/\s+/, $line, 5); #werType is 'sysoutWER' or 'sysoutPWER' - $details =~ /^([^;]*);(.*)/; - my @sentenceWERs = split(/\s+/, $1); - if(!defined($self->{$werType}->{$sysname})) {$self->{$werType}->{$sysname} = {};} - $self->{$werType}->{$sysname}->{$factorName} = [$totalWER, \@sentenceWERs, []]; - my @indexLists = split(/;/, $2); - sleep 6; - for(my $i = 0; $i < scalar(@sentenceWERs); $i++) - { - my @indices = split(/\s+/, $indexLists[$i]); - $self->{$werType}->{$sysname}->{$factorName}->[2] = \@indices; - } - } - elsif($mode eq 'misc') - { - } - } - close(CACHEFILE); -} - -##### utils ##### -#arguments: a, b (scalars) -sub min -{ - my ($a, $b) = @_; - return ($a < $b) ? $a : $b; -} -#arguments: a, b (scalars) -sub max -{ - my ($a, $b) = @_; - return ($a > $b) ? $a : $b; -} -#arguments: x -sub my_log -{ - return -9999999999 unless $_[0]; - return log($_[0]); -} - -#throw if the given factor doesn't have an index defined -#arguments: factor name -#return: none -sub ensureFactorPosDefined -{ - my ($self, $factorName) = @_; - if(!defined($self->{'factorIndices'}->{$factorName})) - { - throw Error::Simple(-text => "Corpus: no index known for factor '$factorName'\n"); - } -} - -#throw if the filename field corresponding to the argument hasn't been defined -#arguments: 'truth' | 'input' | a system name -#return: none -sub ensureFilenameDefined -{ - my ($self, $sysname) = @_; - if($sysname eq 'truth' || $sysname eq 'input') - { - if(!defined($self->{"${sysname}Filename"})) - { - throw Error::Simple(-text => "Corpus: no $sysname corpus defined\n"); - } - } - else - { - if(!defined($self->{'sysoutFilenames'}->{$sysname})) - { - throw Error::Simple(-text => "Corpus: no system $sysname defined\n"); - } - } -} - -#throw if there isn't a defined phrase-table filename for the given factor -#arguments: factor name -#return: none -sub ensurePhraseTableDefined -{ - my ($self, $factorName) = @_; - if(!defined($self->{'phraseTableFilenames'}->{$factorName})) - { - throw Error::Simple(-text => "Corpus: no phrase table defined for factor '$factorName'\n"); - } -} - -#search current directory for files with our corpus name as basename and set filename fields of $self -#arguments: hashref of filenames to descriptions -#return: none -sub locateFiles -{ - my ($self, $refDescs) = @_; - open(DIR, "ls -x1 . |") or die "Corpus::locateFiles(): couldn't list current directory\n"; - my $corpusName = $self->{'corpusName'}; - while(my $filename = <DIR>) - { - chop $filename; #remove \n - if($filename =~ /^$corpusName\.(.*)$/) - { - my $ext = $1; - if($ext eq 'e') {$self->{'truthFilename'} = $filename;} - elsif($ext eq 'f') {$self->{'inputFilename'} = $filename;} - elsif($ext =~ /pt_(.*)/) {$self->{'phraseTableFilenames'}->{$1} = $filename;} - else {$self->{'sysoutFilenames'}->{$ext} = $filename;} - if(defined($refDescs->{$filename})) - { - $self->{'fileDescriptions'}->{$filename} = $refDescs->{$filename}; - } - } - } - close(DIR); -# warn "truth is set to '" . $self->{'truthFilename'} . "'\n"; -# warn "input is set to '" . $self->{'inputFilename'} . "'\n"; -# warn "sysouts set are '" . join("', '", keys %{$self->{'sysoutFilenames'}}) . "'\n"; -# warn "phrase tables set are '" . join("', '", keys %{$self->{'phraseTableFilenames'}}) . "'\n"; -} - -#arguments: type ('truth' | 'input' | a string to represent a system output), filename -#pre: filename exists -#return: none -sub loadSentences -{ - my ($self, $sysname, $filename) = @_; - $self->{$sysname} = []; - open(INFILE, "<$filename") or die "Corpus::load(): couldn't open '$filename' for read\n"; - while(my $line = <INFILE>) - { - my @words = split(/\s+/, $line); - my $refFactors = []; - foreach my $word (@words) - { - my @factors = split(/\|/, $word); - push @$refFactors, \@factors; - } - push @{$self->{$sysname}}, $refFactors; - } - close(INFILE); -} - -#free the memory used for the given corpus (but NOT any associated calculations, eg WER) -#arguments: type ('truth' | 'input' | a string to represent a system output) -#return: none -sub releaseSentences -{ - my ($self, $sysname) = @_; - $self->{$sysname} = []; -} - -#arguments: factor name -#return: none -#throw if we don't have a filename for the given phrase table -sub loadPhraseTable -{ - my ($self, $factorName) = @_; - $self->ensurePhraseTableDefined($factorName); - - my $filename = $self->{'phraseTableFilenames'}->{$factorName}; - open(PTABLE, "<$filename") or die "couldn't open '$filename' for read\n"; - $self->{'phraseTables'}->{$factorName} = {}; #create ref to phrase table (hash of strings, for source phrases, to anything whatsoever) - #assume the table is sorted so that duplicate source phrases will be consecutive - while(my $line = <PTABLE>) - { - my @phrases = split(/\s*\|\|\|\s*/, $line, 2); - $self->{'phraseTables'}->{$factorName}->{$phrases[0]} = 0; #just so that it's set to something - } - close(PTABLE); -} - -#arguments: factor name -#return: none -sub releasePhraseTable -{ - my ($self, $factorName) = @_; - $self->{'phraseTables'}->{$factorName} = {}; -} - -#arguments: name of list ('nounAndAdj' | ...) -#return: arrayref of strings (postags) -sub getPOSTagList -{ - my ($self, $listname) = @_; - ##### assume PTB tagset ##### - if($listname eq 'nounAndAdj') {return ['NN', 'NNS', 'NNP', 'NNPS', 'JJ', 'JJR', 'JJS'];} -# if($listname eq '') {return [];} -} - -#arguments: list to be filtered (arrayref of arrayrefs of factor strings), desired factor index, arrayref of allowable values -#return: filtered list as array of arrayrefs of factor strings -sub filterFactors -{ - my ($self, $refFullList, $index, $refFactorValues) = @_; - my $valuesRegex = join("|", @$refFactorValues); - my @filteredList = (); - foreach my $factors (@$refFullList) - { - if($factors->[$index] =~ m/$valuesRegex/) - { - push @filteredList, $factors; - } - } - return @filteredList; -} - -#arguments: system output (arrayref of arrayrefs of arrayrefs of factor strings), truth (same), factor index to use -#return: wer score, arrayref of sentence scores, arrayref of arrayrefs of indices of errorful words -sub corpusWER -{ - my ($self, $refSysOutput, $refTruth, $index) = @_; - my ($totWER, $sentenceWER, $errIndices) = (0, [], []); - for(my $i = 0; $i < scalar(@$refSysOutput); $i++) - { - my ($sentWER, $indices) = $self->sentenceWER($refSysOutput->[$i], $refTruth->[$i], $index); - $totWER += $sentWER; - push @$sentenceWER, $sentWER; - push @$errIndices, $indices; - } - return ($totWER, $sentenceWER, $errIndices); -} - -#arguments: system output (arrayref of arrayrefs of factor strings), truth (same), factor index to use -#return: wer score, arrayref of arrayrefs of indices of errorful words -sub sentenceWER -{ - my ($self, $refSysOutput, $refTruth, $index) = @_; - my ($totWER, $indices) = (0, []); - my ($sLength, $eLength) = (scalar(@$refSysOutput), scalar(@$refTruth)); - for(my $j = 0; $j < min($sLength, $eLength); $j++) - { - if(lc $refSysOutput->[$j]->[$index] ne lc $refTruth->[$j]->[$index]) #check output word against truth word in same position - { - $totWER++; - push @$indices, $j; - } - } - $totWER += max(0, $sLength - $eLength); - return ($totWER, $indices); -} - -#arguments: system output (arrayref of arrayrefs of arrayrefs of factor strings), truth (same), factor index to use -#return: wer score, arrayref of sentence scores, arrayref of arrayrefs of indices of errorful words -sub corpusPWER -{ - my ($self, $refSysOutput, $refTruth, $index) = @_; - my ($totWER, $sentenceWER, $errIndices) = (0, [], []); - for(my $i = 0; $i < scalar(@$refSysOutput); $i++) - { - my ($sentWER, $indices) = $self->sentencePWER($refSysOutput->[$i], $refTruth->[$i], $index); - $totWER += $sentWER; - push @$sentenceWER, $sentWER; - push @$errIndices, $indices; - } - return ($totWER, $sentenceWER, $errIndices); -} - -#arguments: system output (arrayref of arrayrefs of factor strings), truth (same), factor index to use -#return: wer score, arrayref of arrayrefs of indices of errorful words -sub sentencePWER -{ - my ($self, $refSysOutput, $refTruth, $index) = @_; - my ($totWER, $indices) = (0, []); - my ($sLength, $eLength) = (scalar(@$refSysOutput), scalar(@$refTruth)); - my @truthWordUsed = (0) x $eLength; #array of 0/1; can only match a given truth word once - for(my $j = 0; $j < $sLength; $j++) - { - my $found = 0; - for(my $k = 0; $k < $eLength; $k++) #check output word against entire truth sentence - { - if(lc $refSysOutput->[$j]->[$index] eq lc $refTruth->[$k]->[$index] && $truthWordUsed[$k] == 0) - { - $truthWordUsed[$k] = 1; - $found = 1; - } - } - if($found == 0) - { - $totWER++; - push @$indices, $j; - } - } - return ($totWER, $indices); -} - -#BLEU calculation for a single sentence -#arguments: truth sentence (arrayref of arrayrefs of factor strings), sysout sentence (same), factor index to use -#return: 1- through 4-gram matching and total counts (1-g match, 1-g tot, 2-g match...), candidate length, reference length -sub sentenceBLEU -{ - my ($self, $refTruth, $refSysOutput, $factorIndex, $debug) = @_; - my ($length_reference, $length_translation) = (scalar(@$refTruth), scalar(@$refSysOutput)); - my ($correct1, $correct2, $correct3, $correct4, $total1, $total2, $total3, $total4) = (0, 0, 0, 0, 0, 0, 0, 0); - my %REF_GRAM = (); - my ($i, $gram); - for($i = 0; $i < $length_reference; $i++) - { - $gram = $refTruth->[$i]->[$factorIndex]; - $REF_GRAM{$gram}++; - next if $i<1; - $gram = $refTruth->[$i - 1]->[$factorIndex] ." ".$gram; - $REF_GRAM{$gram}++; - next if $i<2; - $gram = $refTruth->[$i - 2]->[$factorIndex] ." ".$gram; - $REF_GRAM{$gram}++; - next if $i<3; - $gram = $refTruth->[$i - 3]->[$factorIndex] ." ".$gram; - $REF_GRAM{$gram}++; - } - for($i = 0; $i < $length_translation; $i++) - { - $gram = $refSysOutput->[$i]->[$factorIndex]; - if (defined($REF_GRAM{$gram}) && $REF_GRAM{$gram} > 0) { - $REF_GRAM{$gram}--; - if($debug != 0) {warn "'$gram' ";} - $correct1 += 1; - } - next if $i<1; - $gram = $refSysOutput->[$i - 1]->[$factorIndex] ." ".$gram; - if (defined($REF_GRAM{$gram}) && $REF_GRAM{$gram} > 0) { - $REF_GRAM{$gram}--; - if($debug != 0) {warn "'$gram' ";} - $correct2 += 1; - } - next if $i<2; - $gram = $refSysOutput->[$i - 2]->[$factorIndex] ." ".$gram; - if (defined($REF_GRAM{$gram}) && $REF_GRAM{$gram} > 0) { - $REF_GRAM{$gram}--; - if($debug != 0) {warn "'$gram' ";} - $correct3 += 1; - } - next if $i<3; - $gram = $refSysOutput->[$i - 3]->[$factorIndex] ." ".$gram; - if (defined($REF_GRAM{$gram}) && $REF_GRAM{$gram} > 0) { - $REF_GRAM{$gram}--; - if($debug != 0) {warn "'$gram' ";} - $correct4 += 1; - } - } - if($debug != 0) {warn "\n";} - my $total = $length_translation; - $total1 = max(1, $total); - $total2 = max(1, $total - 1); - $total3 = max(1, $total - 2); - $total4 = max(1, $total - 3); - if($debug != 0) - { - warn "BLEU($factorIndex)\n"; - warn "truth: " . join(' ', map {join('|', @$_)} @{$refTruth}) . "\n"; - warn "sysop: " . join(' ', map {join('|', @$_)} @{$refSysOutput}) . "\n"; - warn "stats: $correct1 / $total1, $correct2 / $total2, $correct3 / $total3, $correct4 / $total4\n"; - sleep 8; - } - - return ($correct1, $total1, $correct2, $total2, $correct3, $total3, $correct4, $total4, $length_translation, $length_reference); -} - -##### filesystem ##### - -#open as many given files as possible; only warn about the rest -#arguments: list of filename extensions to open (assume corpus name is file title) -#return: hash from type string to filehandleref, giving all files that were successfully opened -sub openFiles -{ - my ($self, @extensions) = @_; - my %openedFiles = (); - foreach my $ext (@extensions) - { - if(!open(FILE, "<" . $self->{'corpusName'} . $ext)) - { - warn "Corpus::openFiles(): couldn't open '" . $self->{'corpusName'} . $ext . "' for read\n"; - } - else #success - { - $openedFiles{$ext} = \*FILE; - } - } - return %openedFiles; -} - -#read one line from each given file -#arguments: hash from type string to filehandleref -#return: hash from type string to sentence (stored as arrayref of arrayrefs of factors) read from corresponding file -sub readLineFromFiles -{ - my ($self, %openedFiles) = @_; - my %lines; - foreach my $type (keys %openedFiles) - { - $lines{$type} = []; - my $sentence = <$openedFiles{$type}>; - my @words = split(/\s+/, $sentence); - foreach my $word (@words) - { - my @factors = split(/\|/, $word); - push @{$lines{$type}}, \@factors; - } - } - return %lines; -} - -#close all given files -#arguments: hash from type string to filehandleref -#return: none -sub closeFiles -{ - my ($self, %openedFiles) = @_; - foreach my $type (keys %openedFiles) - { - close($openedFiles{$type}); - } -} - -##### write HTML ##### - -#print HTML for comparing various versions of a sentence, with special processing for each version as appropriate -#arguments: filehandleref to which to write, sentence ID string, hashref of version string to sentence (stored as arrayref of arrayref of factor strings) -#return: none -sub printSingleSentenceComparison -{ - my ($self, $fh, $sentID, $sentences) = @_; - my $curFH = select; - select $fh; - #javascript to reorder rows to look nice afterward - print "<script type=\"text/javascript\"> - function reorder_$sentID() - {/* - var table = document.getElementById('div_$sentID').firstChild; - var refTransRow = table.getElementById('row_e'); - var inputRow = table.getElementById('row_f'); - table.removeRow(refTransRow); - table.removeRow(inputRow); - var newRow1 = table.insertRow(0); - var newRow2 = table.insertRow(1); - newRow1.childNodes = inputRow.childNodes; - newRow2.childNodes = refTransRow.childNodes;*/ - } - </script>"; - #html for sentences - print "<div id=\"div_$sentID\" style=\"padding: 3px; margin: 5px\">"; - print "<table border=\"1\">"; -# my $rowCount = 0; -# my @bgColors = ("#ffefbf", "#ffdf7f"); - #process all rows in order - foreach my $sentType (keys %$sentences) - { - my $bgcolor = $bgColors[$rowCount % 2]; - print "<tr id=\"row_$sentType\"><td align=right>"; - #description of sentence - if(defined($self->{'fileDescriptions'}->{$self->{'corpusName'} . $sentType})) - { - print "(" . $self->{'fileDescriptions'}->{$self->{'corpusName'} . $sentType} . ")"; - } - else - { - print "($sentType)"; - } - print "</td><td align=left>"; - #sentence with markup - if($sentType eq 'f') #input - { -# $self->writeHTMLSentenceWithFactors($fh, $sentences->{$sentType}, $inputColor); - } - elsif($sentType eq 'e') #reference translation - { -# $self->writeHTMLSentenceWithFactors($fh, $sentences->{$sentType}, $reftransColor); - } - else #system output - { -# $self->writeHTMLTranslationHighlightedWithFactors($fh, $sentences->{$sentType}, $sentences->{'e'}, $highlightColors); - } - print "</td></tr>"; -# $rowCount++; - } - print "</table>"; - print "</div>\n"; - select $curFH; -} diff --git a/scripts/analysis/smtgui/Error.pm b/scripts/analysis/smtgui/Error.pm deleted file mode 100644 index cc9edbb69..000000000 --- a/scripts/analysis/smtgui/Error.pm +++ /dev/null @@ -1,744 +0,0 @@ -# Error.pm -# -# Copyright (c) 1997-8 Graham Barr <gbarr@ti.com>. All rights reserved. -# This program is free software; you can redistribute it and/or -# modify it under the same terms as Perl itself. -# -# Based on my original Error.pm, and Exceptions.pm by Peter Seibel -# <peter@weblogic.com> and adapted by Jesse Glick <jglick@sig.bsh.com>. -# -# but modified ***significantly*** - -package Error; - -use strict; -use vars qw($VERSION); -use 5.004; - -$VERSION = "0.15"; - -use overload ( - '""' => 'stringify', - '0+' => 'value', - 'bool' => sub { return 1; }, - 'fallback' => 1 -); - -$Error::Depth = 0; # Depth to pass to caller() -$Error::Debug = 0; # Generate verbose stack traces -@Error::STACK = (); # Clause stack for try -$Error::THROWN = undef; # last error thrown, a workaround until die $ref works - -my $LAST; # Last error created -my %ERROR; # Last error associated with package - -# Exported subs are defined in Error::subs - -sub import { - shift; - local $Exporter::ExportLevel = $Exporter::ExportLevel + 1; - Error::subs->import(@_); -} - -# I really want to use last for the name of this method, but it is a keyword -# which prevent the syntax last Error - -sub prior { - shift; # ignore - - return $LAST unless @_; - - my $pkg = shift; - return exists $ERROR{$pkg} ? $ERROR{$pkg} : undef - unless ref($pkg); - - my $obj = $pkg; - my $err = undef; - if($obj->isa('HASH')) { - $err = $obj->{'__Error__'} - if exists $obj->{'__Error__'}; - } - elsif($obj->isa('GLOB')) { - $err = ${*$obj}{'__Error__'} - if exists ${*$obj}{'__Error__'}; - } - - $err; -} - -# Return as much information as possible about where the error -# happened. The -stacktrace element only exists if $Error::DEBUG -# was set when the error was created - -sub stacktrace { - my $self = shift; - - return $self->{'-stacktrace'} - if exists $self->{'-stacktrace'}; - - my $text = exists $self->{'-text'} ? $self->{'-text'} : "Died"; - - $text .= sprintf(" at %s line %d.\n", $self->file, $self->line) - unless($text =~ /\n$/s); - - $text; -} - -# Allow error propagation, ie -# -# $ber->encode(...) or -# return Error->prior($ber)->associate($ldap); - -sub associate { - my $err = shift; - my $obj = shift; - - return unless ref($obj); - - if($obj->isa('HASH')) { - $obj->{'__Error__'} = $err; - } - elsif($obj->isa('GLOB')) { - ${*$obj}{'__Error__'} = $err; - } - $obj = ref($obj); - $ERROR{ ref($obj) } = $err; - - return; -} - -sub new { - my $self = shift; - my($pkg,$file,$line) = caller($Error::Depth); - - my $err = bless { - '-package' => $pkg, - '-file' => $file, - '-line' => $line, - @_ - }, $self; - - $err->associate($err->{'-object'}) - if(exists $err->{'-object'}); - - # To always create a stacktrace would be very inefficient, so - # we only do it if $Error::Debug is set - - if($Error::Debug) { - require Carp; - local $Carp::CarpLevel = $Error::Depth; - my $text = defined($err->{'-text'}) ? $err->{'-text'} : "Error"; - my $trace = Carp::longmess($text); - # Remove try calls from the trace - $trace =~ s/(\n\s+\S+__ANON__[^\n]+)?\n\s+eval[^\n]+\n\s+Error::subs::try[^\n]+(?=\n)//sog; - $trace =~ s/(\n\s+\S+__ANON__[^\n]+)?\n\s+eval[^\n]+\n\s+Error::subs::run_clauses[^\n]+\n\s+Error::subs::try[^\n]+(?=\n)//sog; - $err->{'-stacktrace'} = $trace - } - - $@ = $LAST = $ERROR{$pkg} = $err; -} - -# Throw an error. this contains some very gory code. - -sub throw { - my $self = shift; - local $Error::Depth = $Error::Depth + 1; - - # if we are not rethrow-ing then create the object to throw - $self = $self->new(@_) unless ref($self); - - die $Error::THROWN = $self; -} - -# syntactic sugar for -# -# die with Error( ... ); - -sub with { - my $self = shift; - local $Error::Depth = $Error::Depth + 1; - - $self->new(@_); -} - -# syntactic sugar for -# -# record Error( ... ) and return; - -sub record { - my $self = shift; - local $Error::Depth = $Error::Depth + 1; - - $self->new(@_); -} - -# catch clause for -# -# try { ... } catch CLASS with { ... } - -sub catch { - my $pkg = shift; - my $code = shift; - my $clauses = shift || {}; - my $catch = $clauses->{'catch'} ||= []; - - unshift @$catch, $pkg, $code; - - $clauses; -} - -# Object query methods - -sub object { - my $self = shift; - exists $self->{'-object'} ? $self->{'-object'} : undef; -} - -sub file { - my $self = shift; - exists $self->{'-file'} ? $self->{'-file'} : undef; -} - -sub line { - my $self = shift; - exists $self->{'-line'} ? $self->{'-line'} : undef; -} - -sub text { - my $self = shift; - exists $self->{'-text'} ? $self->{'-text'} : undef; -} - -# overload methods - -sub stringify { - my $self = shift; - defined $self->{'-text'} ? $self->{'-text'} : "Died"; -} - -sub value { - my $self = shift; - exists $self->{'-value'} ? $self->{'-value'} : undef; -} - -package Error::Simple; - -@Error::Simple::ISA = qw(Error); - -sub new { - my $self = shift; - my $text = "" . shift; - my $value = shift; - my(@args) = (); - - local $Error::Depth = $Error::Depth + 1; - - @args = ( -file => $1, -line => $2) - if($text =~ s/ at (\S+) line (\d+)(\.\n)?$//s); - - push(@args, '-value', 0 + $value) - if defined($value); - - $self->SUPER::new(-text => $text, @args); -} - -sub stringify { - my $self = shift; - my $text = $self->SUPER::stringify; - $text .= sprintf(" at %s line %d.\n", $self->file, $self->line) - unless($text =~ /\n$/s); - $text; -} - -########################################################################## -########################################################################## - -# Inspired by code from Jesse Glick <jglick@sig.bsh.com> and -# Peter Seibel <peter@weblogic.com> - -package Error::subs; - -use Exporter (); -use vars qw(@EXPORT_OK @ISA %EXPORT_TAGS); - -@EXPORT_OK = qw(try with finally except otherwise); -%EXPORT_TAGS = (try => \@EXPORT_OK); - -@ISA = qw(Exporter); - -sub run_clauses ($$$\@) { - my($clauses,$err,$wantarray,$result) = @_; - my $code = undef; - - $err = new Error::Simple($err) unless ref($err); - - CATCH: { - - # catch - my $catch; - if(defined($catch = $clauses->{'catch'})) { - my $i = 0; - - CATCHLOOP: - for( ; $i < @$catch ; $i += 2) { - my $pkg = $catch->[$i]; - unless(defined $pkg) { - #except - splice(@$catch,$i,2,$catch->[$i+1]->()); - $i -= 2; - next CATCHLOOP; - } - elsif($err->isa($pkg)) { - $code = $catch->[$i+1]; - while(1) { - my $more = 0; - local($Error::THROWN); - my $ok = eval { - if($wantarray) { - @{$result} = $code->($err,\$more); - } - elsif(defined($wantarray)) { - @{$result} = (); - $result->[0] = $code->($err,\$more); - } - else { - $code->($err,\$more); - } - 1; - }; - if( $ok ) { - next CATCHLOOP if $more; - undef $err; - } - else { - $err = defined($Error::THROWN) - ? $Error::THROWN : $@; - $err = new Error::Simple($err) - unless ref($err); - } - last CATCH; - }; - } - } - } - - # otherwise - my $owise; - if(defined($owise = $clauses->{'otherwise'})) { - my $code = $clauses->{'otherwise'}; - my $more = 0; - my $ok = eval { - if($wantarray) { - @{$result} = $code->($err,\$more); - } - elsif(defined($wantarray)) { - @{$result} = (); - $result->[0] = $code->($err,\$more); - } - else { - $code->($err,\$more); - } - 1; - }; - if( $ok ) { - undef $err; - } - else { - $err = defined($Error::THROWN) - ? $Error::THROWN : $@; - $err = new Error::Simple($err) - unless ref($err); - } - } - } - $err; -} - -sub try (&;$) { - my $try = shift; - my $clauses = @_ ? shift : {}; - my $ok = 0; - my $err = undef; - my @result = (); - - unshift @Error::STACK, $clauses; - - my $wantarray = wantarray(); - - do { - local $Error::THROWN = undef; - - $ok = eval { - if($wantarray) { - @result = $try->(); - } - elsif(defined $wantarray) { - $result[0] = $try->(); - } - else { - $try->(); - } - 1; - }; - - $err = defined($Error::THROWN) ? $Error::THROWN : $@ - unless $ok; - }; - - shift @Error::STACK; - - $err = run_clauses($clauses,$err,wantarray,@result) - unless($ok); - - $clauses->{'finally'}->() - if(defined($clauses->{'finally'})); - - throw $err if defined($err); - - wantarray ? @result : $result[0]; -} - -# Each clause adds a sub to the list of clauses. The finally clause is -# always the last, and the otherwise clause is always added just before -# the finally clause. -# -# All clauses, except the finally clause, add a sub which takes one argument -# this argument will be the error being thrown. The sub will return a code ref -# if that clause can handle that error, otherwise undef is returned. -# -# The otherwise clause adds a sub which unconditionally returns the users -# code reference, this is why it is forced to be last. -# -# The catch clause is defined in Error.pm, as the syntax causes it to -# be called as a method - -sub with (&;$) { - @_ -} - -sub finally (&) { - my $code = shift; - my $clauses = { 'finally' => $code }; - $clauses; -} - -# The except clause is a block which returns a hashref or a list of -# key-value pairs, where the keys are the classes and the values are subs. - -sub except (&;$) { - my $code = shift; - my $clauses = shift || {}; - my $catch = $clauses->{'catch'} ||= []; - - my $sub = sub { - my $ref; - my(@array) = $code->($_[0]); - if(@array == 1 && ref($array[0])) { - $ref = $array[0]; - $ref = [ %$ref ] - if(UNIVERSAL::isa($ref,'HASH')); - } - else { - $ref = \@array; - } - @$ref - }; - - unshift @{$catch}, undef, $sub; - - $clauses; -} - -sub otherwise (&;$) { - my $code = shift; - my $clauses = shift || {}; - - if(exists $clauses->{'otherwise'}) { - require Carp; - Carp::croak("Multiple otherwise clauses"); - } - - $clauses->{'otherwise'} = $code; - - $clauses; -} - -1; -__END__ - -=head1 NAME - -Error - Error/exception handling in an OO-ish way - -=head1 SYNOPSIS - - use Error qw(:try); - - throw Error::Simple( "A simple error"); - - sub xyz { - ... - record Error::Simple("A simple error") - and return; - } - - unlink($file) or throw Error::Simple("$file: $!",$!); - - try { - do_some_stuff(); - die "error!" if $condition; - throw Error::Simple -text => "Oops!" if $other_condition; - } - catch Error::IO with { - my $E = shift; - print STDERR "File ", $E->{'-file'}, " had a problem\n"; - } - except { - my $E = shift; - my $general_handler=sub {send_message $E->{-description}}; - return { - UserException1 => $general_handler, - UserException2 => $general_handler - }; - } - otherwise { - print STDERR "Well I don't know what to say\n"; - } - finally { - close_the_garage_door_already(); # Should be reliable - }; # Don't forget the trailing ; or you might be surprised - -=head1 DESCRIPTION - -The C<Error> package provides two interfaces. Firstly C<Error> provides -a procedural interface to exception handling. Secondly C<Error> is a -base class for errors/exceptions that can either be thrown, for -subsequent catch, or can simply be recorded. - -Errors in the class C<Error> should not be thrown directly, but the -user should throw errors from a sub-class of C<Error>. - -=head1 PROCEDURAL INTERFACE - -C<Error> exports subroutines to perform exception handling. These will -be exported if the C<:try> tag is used in the C<use> line. - -=over 4 - -=item try BLOCK CLAUSES - -C<try> is the main subroutine called by the user. All other subroutines -exported are clauses to the try subroutine. - -The BLOCK will be evaluated and, if no error is throw, try will return -the result of the block. - -C<CLAUSES> are the subroutines below, which describe what to do in the -event of an error being thrown within BLOCK. - -=item catch CLASS with BLOCK - -This clauses will cause all errors that satisfy C<$err-E<gt>isa(CLASS)> -to be caught and handled by evaluating C<BLOCK>. - -C<BLOCK> will be passed two arguments. The first will be the error -being thrown. The second is a reference to a scalar variable. If this -variable is set by the catch block then, on return from the catch -block, try will continue processing as if the catch block was never -found. - -To propagate the error the catch block may call C<$err-E<gt>throw> - -If the scalar reference by the second argument is not set, and the -error is not thrown. Then the current try block will return with the -result from the catch block. - -=item except BLOCK - -When C<try> is looking for a handler, if an except clause is found -C<BLOCK> is evaluated. The return value from this block should be a -HASHREF or a list of key-value pairs, where the keys are class names -and the values are CODE references for the handler of errors of that -type. - -=item otherwise BLOCK - -Catch any error by executing the code in C<BLOCK> - -When evaluated C<BLOCK> will be passed one argument, which will be the -error being processed. - -Only one otherwise block may be specified per try block - -=item finally BLOCK - -Execute the code in C<BLOCK> either after the code in the try block has -successfully completed, or if the try block throws an error then -C<BLOCK> will be executed after the handler has completed. - -If the handler throws an error then the error will be caught, the -finally block will be executed and the error will be re-thrown. - -Only one finally block may be specified per try block - -=back - -=head1 CLASS INTERFACE - -=head2 CONSTRUCTORS - -The C<Error> object is implemented as a HASH. This HASH is initialized -with the arguments that are passed to it's constructor. The elements -that are used by, or are retrievable by the C<Error> class are listed -below, other classes may add to these. - - -file - -line - -text - -value - -object - -If C<-file> or C<-line> are not specified in the constructor arguments -then these will be initialized with the file name and line number where -the constructor was called from. - -If the error is associated with an object then the object should be -passed as the C<-object> argument. This will allow the C<Error> package -to associate the error with the object. - -The C<Error> package remembers the last error created, and also the -last error associated with a package. This could either be the last -error created by a sub in that package, or the last error which passed -an object blessed into that package as the C<-object> argument. - -=over 4 - -=item throw ( [ ARGS ] ) - -Create a new C<Error> object and throw an error, which will be caught -by a surrounding C<try> block, if there is one. Otherwise it will cause -the program to exit. - -C<throw> may also be called on an existing error to re-throw it. - -=item with ( [ ARGS ] ) - -Create a new C<Error> object and returns it. This is defined for -syntactic sugar, eg - - die with Some::Error ( ... ); - -=item record ( [ ARGS ] ) - -Create a new C<Error> object and returns it. This is defined for -syntactic sugar, eg - - record Some::Error ( ... ) - and return; - -=back - -=head2 STATIC METHODS - -=over 4 - -=item prior ( [ PACKAGE ] ) - -Return the last error created, or the last error associated with -C<PACKAGE> - -=back - -=head2 OBJECT METHODS - -=over 4 - -=item stacktrace - -If the variable C<$Error::Debug> was non-zero when the error was -created, then C<stacktrace> returns a string created by calling -C<Carp::longmess>. If the variable was zero the C<stacktrace> returns -the text of the error appended with the filename and line number of -where the error was created, providing the text does not end with a -newline. - -=item object - -The object this error was associated with - -=item file - -The file where the constructor of this error was called from - -=item line - -The line where the constructor of this error was called from - -=item text - -The text of the error - -=back - -=head2 OVERLOAD METHODS - -=over 4 - -=item stringify - -A method that converts the object into a string. This method may simply -return the same as the C<text> method, or it may append more -information. For example the file name and line number. - -By default this method returns the C<-text> argument that was passed to -the constructor, or the string C<"Died"> if none was given. - -=item value - -A method that will return a value that can be associated with the -error. For example if an error was created due to the failure of a -system call, then this may return the numeric value of C<$!> at the -time. - -By default this method returns the C<-value> argument that was passed -to the constructor. - -=back - -=head1 PRE-DEFINED ERROR CLASSES - -=over 4 - -=item Error::Simple - -This class can be used to hold simple error strings and values. It's -constructor takes two arguments. The first is a text value, the second -is a numeric value. These values are what will be returned by the -overload methods. - -If the text value ends with C<at file line 1> as $@ strings do, then -this infomation will be used to set the C<-file> and C<-line> arguments -of the error object. - -This class is used internally if an eval'd block die's with an error -that is a plain string. - -=back - -=head1 KNOWN BUGS - -None, but that does not mean there are not any. - -=head1 AUTHORS - -Graham Barr <gbarr@pobox.com> - -The code that inspired me to write this was originally written by -Peter Seibel <peter@weblogic.com> and adapted by Jesse Glick -<jglick@sig.bsh.com>. - -=head1 MAINTAINER - -Arun Kumar U <u_arunkumar@yahoo.com> - -=cut diff --git a/scripts/analysis/smtgui/README b/scripts/analysis/smtgui/README deleted file mode 100644 index c86cd9c1a..000000000 --- a/scripts/analysis/smtgui/README +++ /dev/null @@ -1,31 +0,0 @@ -Readme for SMTGUI -Philipp Koehn, Evan Herbst -7 / 31 / 06 ------------------------------------ - -SMTGUI is Philipp's and my code to analyze a decoder's output (the decoder doesn't have to be moses, but most of SMTGUI's features relate to factors, so it probably will be). You can view a list of available corpora by running <newsmtgui.cgi?ACTION=> on any web server. When you're viewing a corpus, click the checkboxes and Compare to see sentences from various sources on one screen. Currently they're in an annoying format; feel free to make the display nicer and more useful. There are per-sentence stats stored in a Corpus object; they just aren't used yet. See compare2() in newsmtgui and Corpus::printSingleSentenceComparison() for a start to better display code. For now it's mostly the view-corpus screen that's useful. - -newsmtgui.cgi is the main program. Corpus.pm is my module; Error.pm is a standard part of Perl but appears to not always be distributed. The accompanying version is Error.pm v1.15. - -The program requires file 'file-factors', which gives the list of factors included in each corpus (see the example file for details). Only corpi included in 'file-factors' are displayed. The file 'file-descriptions' is optional and associates a descriptive string with each included filename. These are used only for display. Again an example is provided. - -For the corpus with name CORPUS, there should be present the files: -- CORPUS.f, the foreign input -- CORPUS.e, the truth (aka reference translation) -- CORPUS.SYSTEM_TRANSLATION for each system to be analyzed -- CORPUS.pt_FACTORNAME for each factor that requires a phrase table (these are currently used only to count unknown source words) - -The .f, .e and system-output files should have the usual pipe-delimited format, one sentence per line. Phrase tables should also have standard three-pipe format. - -A list of standard factor names is available in @Corpus::FACTORNAMES. Feel free to add, but woe betide you if you muck with 'surf', 'pos' and 'lemma'; those are hardcoded all over the place. - -Currently the program assumes you've included factors 'surf', 'pos' and 'lemma', in whatever order; if not you'll want to edit view_corpus() in newsmtgui.cgi to not automatically display all info. To get English POS tags and lemmas from a words-only corpus and put together factors into one file: - -$ $BIN/tag-english < CORPUS.lc > CORPUS.pos-tmp (call Brill) -$ $BIN/morph < CORPUS.pos-tmp > CORPUS.morph -$ $DATA/test/factor-stem.en.perl < CORPUS.morph > CORPUS.lemma -$ cat CORPUS.pos-tmp | perl -n -e 's/_/\|/g; print;' > CORPUS.lc+pos (replace _ with |) -$ $DATA/test/combine-features.perl CORPUS lc+pos lemma > CORPUS.lc+pos+lemma -$ rm CORPUS.pos-tmp (cleanup) - -where $BIN=/export/ws06osmt/bin, $DATA=/export/ws06osmt/data. diff --git a/scripts/analysis/smtgui/file-descriptions b/scripts/analysis/smtgui/file-descriptions deleted file mode 100644 index 97ac6f31a..000000000 --- a/scripts/analysis/smtgui/file-descriptions +++ /dev/null @@ -1 +0,0 @@ -devtest2006.de-en.top100.matrix05-baseline.pharaoh Pharaoh JHUWS baseline run diff --git a/scripts/analysis/smtgui/file-factors b/scripts/analysis/smtgui/file-factors deleted file mode 100644 index a1128eb2a..000000000 --- a/scripts/analysis/smtgui/file-factors +++ /dev/null @@ -1,6 +0,0 @@ -#corpus name, factors given (/\s+/-delimited) -#(the given factors should be present in all target-language files for the given corpus) -devtest2006.de-en surf pos lemma -devtest2006.de-en.top100 surf pos lemma -#pstem: lemmas come from the Porter stemmer (and so are really a mix of stems and lemmas) -pstem_devtest2006.de-en surf pos lemma diff --git a/scripts/analysis/smtgui/filter-phrase-table.pl b/scripts/analysis/smtgui/filter-phrase-table.pl deleted file mode 100644 index a7e998794..000000000 --- a/scripts/analysis/smtgui/filter-phrase-table.pl +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/perl -w - -#by Philipp Koehn, de-augmented by Evan Herbst -#filter a phrase table for a specific input corpus -#arguments: phrasetable_filename input_filename factor_index (0...) -#outputs to phrasetable_filename.short - -#similar function to filter-model-given-input.pl, but only operates -#on the phrase table and doesn't require that any subdirectories exist - -use strict; - -my $MAX_LENGTH = 10; - -my ($file, $input, $source_factor) = @ARGV; -my $dir = "."; - - # get tables to be filtered (and modify config file) - my (@TABLE,@TABLE_FACTORS,@TABLE_NEW_NAME,%CONSIDER_FACTORS); - push @TABLE,$file; - - my $new_name = "$file.short";#"$dir/phrase-table.$source_factor"; - push @TABLE_NEW_NAME,$new_name; - - $CONSIDER_FACTORS{$source_factor} = 1; - push @TABLE_FACTORS,$source_factor; - - # get the phrase pairs appearing in the input text - my %PHRASE_USED; - die("could not find input file $input") unless -e $input; - open(INPUT,$input); - while(my $line = <INPUT>) { - chop($line); - my @WORD = split(/ +/,$line); - for(my $i=0;$i<=$#WORD;$i++) { - for(my $j=0;$j<$MAX_LENGTH && $j+$i<=$#WORD;$j++) { - foreach (keys %CONSIDER_FACTORS) { - my @FACTOR = split(/,/); - my $phrase = ""; - for(my $k=$i;$k<=$i+$j;$k++) { - my @WORD_FACTOR = split(/\|/,$WORD[$k]); - for(my $f=0;$f<=$#FACTOR;$f++) { - $phrase .= $WORD_FACTOR[$FACTOR[$f]]."|"; - } - chop($phrase); - $phrase .= " "; - } - chop($phrase); - $PHRASE_USED{$_}{$phrase}++; - } - } - } - } - close(INPUT); - - # filter files - for(my $i=0;$i<=$#TABLE;$i++) { - my ($used,$total) = (0,0); - my $file = $TABLE[$i]; - my $factors = $TABLE_FACTORS[$i]; - my $new_file = $TABLE_NEW_NAME[$i]; - print STDERR "filtering $file -> $new_file...\n"; - - if (-e $file && $file =~ /\.gz$/) { open(FILE,"zcat $file |"); } - elsif (! -e $file && -e "$file.gz") { open(FILE,"zcat $file.gz|"); } - elsif (-e $file) { open(FILE,$file); } - else { die("could not find model file $file"); } - - open(FILE_OUT,">$new_file"); - - while(my $entry = <FILE>) { - my ($foreign,$rest) = split(/ \|\|\| /,$entry,2); - $foreign =~ s/ $//; - if (defined($PHRASE_USED{$factors}{$foreign})) { - print FILE_OUT $entry; - $used++; - } - $total++; - } - close(FILE); - close(FILE_OUT); - printf STDERR "$used of $total phrases pairs used (%.2f%s) - note: max length $MAX_LENGTH\n",(100*$used/$total),'%'; - } diff --git a/scripts/analysis/smtgui/newsmtgui.cgi b/scripts/analysis/smtgui/newsmtgui.cgi deleted file mode 100755 index 0e969a788..000000000 --- a/scripts/analysis/smtgui/newsmtgui.cgi +++ /dev/null @@ -1,935 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -use CGI; -use Corpus; #Evan's code -use Error qw(:try); - -#files with extensions other than these are interpreted as system translations; see the file 'file-descriptions', if it exists, for the comments that go with them -my %FILETYPE = ('e' => 'Reference Translation', - 'f' => 'Foreign Original', - 'ref.sgm' => 'Reference Translations', - 'e.sgm' => 'Reference Translations', - 'src.sgm' => 'Foreign Originals', - 'f.sgm' => 'Foreign Originals'); -my %DONTSCORE = ('f' => 1, 'f.sgm' => 1, 'src.sgm' => 1, - 'e' => 1, 'e.sgm' => 1, 'ref.sgm' => 1); -my @SHOW = ('f', 'e', 'comm'); -my %SHOW_COLOR = ('f' => "BLUE", - 'e' => "GREEN"); -my $FOREIGN = 'f'; - -#FILEDESC: textual descriptions associated with specific filenames; to be displayed on the single-corpus view -my %FILEDESC = (); &load_descriptions(); -my %factorIndices = loadFactorIndices('file-factors'); -my %MEMORY; &load_memory(); -my (@mBLEU,@NIST); -@mBLEU=`cat mbleu-memory.dat` if -e "mbleu-memory.dat"; chop(@mBLEU); -@NIST = `cat nist-memory.dat` if -e "nist-memory.dat"; chop(@NIST); -my %in; &ReadParse(); #parse arguments - -if (scalar(@ARGV) > 0 && $ARGV[0] eq 'bleu') { - $in{CORPUS} = $ARGV[1]; - $in{ACTION} = "VIEW_CORPUS"; -} - -my %MULTI_REF; -if ($in{CORPUS} && -e "$in{CORPUS}.ref.sgm") { - my $sysid; - open(REF,"$in{CORPUS}.ref.sgm"); - while(<REF>) { - $sysid = $1 if /<DOC.+sysid=\"([^\"]+)\"/; - if (/<seg[^>]*> *(\S.+\S) *<\/seg>/) { - push @{$MULTI_REF{$sysid}}, $1; - } - } - close(REF); -} - -if ($in{ACTION} eq '') { &show_corpora(); } -elsif ($in{ACTION} eq 'VIEW_CORPUS') { &view_corpus(); } -elsif ($in{ACTION} eq 'SCORE_FILE') { &score_file(); } -elsif ($in{ACTION} eq 'RESCORE_FILE') { &score_file(); } -elsif ($in{ACTION} eq 'COMPARE') { &compare(); } -else { &htmlhead("Unknown Action $in{ACTION}"); } -print "</BODY></HTML>\n"; - -###### SHOW CORPORA IN EVALUATION DIRECTORY - -sub show_corpora { - my %CORPUS = (); - - # find corpora in evaluation directory: see the factor-index file, which was already read in - foreach my $corpusName (keys %factorIndices) - { - $CORPUS{$corpusName} = 1; - } - - # list corpora - &htmlhead("All Corpora"); - print "<UL>\n"; - foreach (sort (keys %CORPUS)) { - print "<LI><A HREF=\"?ACTION=VIEW_CORPUS&CORPUS=".CGI::escape($_)."\">Corpus $_</A>\n"; - } - print "</UL>\n"; -} - -###### SHOW INFORMATION FOR ONE CORPUS - -sub view_corpus { - my @TABLE; - &htmlhead("View Corpus $in{CORPUS}"); - - # find corpora in evaluation directory - my $corpus = new Corpus('-name' => "$in{CORPUS}", '-descriptions' => \%FILEDESC, '-indices' => $factorIndices{$in{CORPUS}}); - - my ($sentence_count, $lineInfo); - if(-e "$in{CORPUS}.f") - { - $lineInfo = `wc -l $in{CORPUS}.f`; - $lineInfo =~ /^\s*(\d+)\s+/; - $sentence_count = 0 + $1; - } - else - { - $lineInfo = `wc -l $in{CORPUS}.e`; - $lineInfo =~ /^\s*(\d+)\s+/; - $sentence_count = 0 + $1; - } - - print "Corpus '$in{CORPUS}' consists of $sentence_count sentences\n"; - print "(<A HREF=?ACTION=VIEW_CORPUS&CORPUS=" . CGI::escape($in{CORPUS})."&mBLEU=1>with mBLEU</A>)" if ((!defined($in{mBLEU})) && (scalar keys %MEMORY) && -e "$in{CORPUS}.e" && -e "$in{CORPUS}.f"); - print "<P>\n"; - print "<FORM ACTION=''>\n"; - print "<INPUT TYPE=HIDDEN NAME=ACTION VALUE=COMPARE>\n"; - print "<INPUT TYPE=HIDDEN NAME=CORPUS VALUE=\"$in{CORPUS}\">\n"; - print "<TABLE BORDER=1 CELLSPACING=0><TR> -<TD>Filename (<A HREF=?ACTION=VIEW_CORPUS&CORPUS=" . CGI::escape($in{CORPUS}).">sort</A>)</TD> -<TD>Date (<A HREF=?ACTION=VIEW_CORPUS&CORPUS=" . CGI::escape($in{CORPUS})."&SORT=TIME>sort</A>)</TD>"; - if (-e "$in{CORPUS}.e") { - print "<TD>IBM BLEU (<A HREF=?ACTION=VIEW_CORPUS&CORPUS=" . CGI::escape($in{CORPUS})."&SORT=IBM>sort</A>)</TD>"; - } - if (-e "$in{CORPUS}.ref.sgm" && -e "$in{CORPUS}.src.sgm") { - print "<TD>NIST (<A HREF=?ACTION=VIEW_CORPUS&CORPUS=" . CGI::escape($in{CORPUS})."&SORT=NIST>sort</A>)</TD>"; - if (! -e "$in{CORPUS}.e") { - print "<TD>BLEU (<A HREF=?ACTION=VIEW_CORPUS&CORPUS=" . CGI::escape($in{CORPUS})."&SORT=BLEU>sort</A>)</TD>"; - } - } - if ($in{mBLEU} && (scalar keys %MEMORY) && -e "$in{CORPUS}.e" && -e "$in{CORPUS}.f") { - print "<TD>mBLEU (<A HREF=?ACTION=VIEW_CORPUS&CORPUS=" . CGI::escape($in{CORPUS})."&SORT=mBLEU>sort</A>)</TD>"; - } - print "<TD>Unknown Words</TD>"; #can't sort on; only applies to the input - print "<TD>Noun & adj WER-PWER</TD>"; #can't sort on; only applies to sysoutputs - print "<TD>Surface vs. lemma PWER</TD>"; #can't sort on; only applies to sysoutputs - print "<TD>Score (<A HREF=?ACTION=VIEW_CORPUS&CORPUS=" . CGI::escape($in{CORPUS})."&SORT=SCORE>sort</A>)</TD><TD>Actions</TD></TR>"; - - open(DIR,"ls $in{CORPUS}.*|"); - while(<DIR>) { - my $sort = ""; - chop; - my $sgm = 0; - if (/.sgm$/) - { - `grep '<seg' $_ | wc -l` =~ /^\s*(\d+)\s+/; - next unless $1 == $sentence_count; - $sgm = 1; - } - else - { - `wc -l $_` =~ /^\s*(\d+)\s+/; - next unless $1 == $sentence_count; - } - /^$in{CORPUS}.([^\/]+)$/; - my $file = $1; - # checkbox for compare - my $row = "<TR><TD><INPUT TYPE=CHECKBOX NAME=FILE_$file VALUE=1>"; - # README - if (-e "$in{CORPUS}.$file.README") { - my $readme = `cat $in{CORPUS}.$file.README`; - $readme =~ s/([\"\'])/\\\"/g; - $readme =~ s/[\n\r]/\\n/g; - $readme =~ s/\t/\\t/g; - $row .= "<A HREF='javascript:FieldInfo(\"$in{CORPUS}.$file\",\"$readme\")'>"; - } - # filename - $row .= "$in{CORPUS}.$file</A>"; - # description (hard-coded) - my @TRANSLATION_SENTENCE = `cat $in{CORPUS}.$file`; - chop(@TRANSLATION_SENTENCE); - - #count sentences that contain null words - my $null_count = 0; - foreach (@TRANSLATION_SENTENCE) - { - $null_count++ if /^NULL$/ || /^NONE$/; - } - if ($null_count > 0) { - $row .= "$null_count NULL "; - } - - $row .= " (".$FILETYPE{$file}.")" if defined($FILETYPE{$file}); - $row .= " (".$FILEDESC{$in{CORPUS}.".".$file}.")" if defined($FILEDESC{$in{CORPUS}.".".$file}); - $row .= " (".$FILEDESC{$file}.")" if defined($FILEDESC{$file}); - # filedate - my @STAT = stat("$in{CORPUS}.$file"); - my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($STAT[8]); #STAT[8] should be last modify time - my $time = sprintf("%04d-%02d-%02d %02d:%02d:%02d",$year+1900,$mon+1,$mday,$hour,$min,$sec); - $row .= "</TD>\n<TD>".$time."</TD>\n"; - if (defined($in{SORT}) && $in{SORT} eq 'TIME') { $sort = $time; } - # IBM BLEU score - my $no_bleu =0; - if (!$sgm && -e "$in{CORPUS}.e") { - $row .= "<TD>"; - if (!defined($DONTSCORE{$file}) && $file !~ /^f$/ && $file ne "e" && $file !~ /^pt/) { - my ($score,$p1,$p2,$p3,$p4,$bp) = $corpus->calcBLEU($file, 'surf'); - $row .= sprintf("<B>%.04f</B> %.01f/%.01f/%.01f/%.01f *%.03f", $score, $p1, $p2, $p3, $p4, $bp); - if (defined($in{SORT}) && $in{SORT} eq 'IBM') { $sort = $score; } - } - $row .= "</TD>\n"; - } - else { - $no_bleu=1; - } - # NIST score - if (-e "$in{CORPUS}.ref.sgm" && -e "$in{CORPUS}.src.sgm" - && !$DONTSCORE{$file}) { - $row .= "<TD>"; - print "$DONTSCORE{$file}+"; - my ($nist,$nist_bleu); - if ($file =~ /sgm$/) { - ($nist,$nist_bleu) = &get_nist_score("$in{CORPUS}.ref.sgm","$in{CORPUS}.src.sgm","$in{CORPUS}.$file"); - $row .= sprintf("<B>%.04f</B>",$nist); - if ($in{SORT} eq 'NIST') { $sort = $nist; } - } - $row .= "</TD>\n"; - if ($no_bleu) { - $row .= "<TD>"; - if ($file =~ /sgm$/) { - $row .= sprintf("<B>%.04f</B>",$nist_bleu); - if ($in{SORT} eq 'BLEU') { $sort = $nist_bleu; } - } - $row .= "</TD>\n"; - } - } - # multi-bleu - if ($in{mBLEU} && (scalar keys %MEMORY) && -e "$in{CORPUS}.e") { - $row .= "<TD>"; - if (!defined($DONTSCORE{$file}) && $file !~ /^f$/ && $file ne "e") { - my ($score,$p1,$p2,$p3,$p4,$bp) = &get_multi_bleu_score("$in{CORPUS}.f","$in{CORPUS}.e","$in{CORPUS}.$file"); - $row .= sprintf("<B>%.04f</B> %.01f/%.01f/%.01f/%.01f *%.03f",$score,$p1,$p2,$p3,$p4,$bp); - if ($in{SORT} eq 'mBLEU') { $sort = $score; } - } - $row .= "</TD>\n"; - } - - # misc stats - $row .= "<TD align=\"center\">"; - if($file eq 'f') #input - { - try - { - my ($unknownCount, $totalCount) = calc_unknown_words($corpus, 'surf'); - $row .= sprintf("%.4lf (%d / %d)", $unknownCount / $totalCount, $unknownCount, $totalCount); - } - catch Error::Simple with {$row .= "[system error]";}; - } - $row .= "</TD>\n<TD align=\"center\">"; - my ($nnAdjWER, $nnAdjPWER, $surfPWER, $lemmaPWER); - if($file ne 'e' && $file ne 'f' && $file !~ /^pt/) #system output - { - try - { - ($nnAdjWER, $nnAdjPWER, $surfPWER, $lemmaPWER) = calc_misc_stats($corpus, $file); - $row .= "WER = $nnAdjWER<br>PWER = $nnAdjPWER<br><b>diff = " . ($nnAdjWER - $nnAdjPWER) . "</b>"; - } - catch Error::Simple with {$row .= "[system error]";}; - } - $row .= "</TD>\n<TD align=\"center\">"; - if($file ne 'e' && $file ne 'f' && $file !~ /^pt/) #system output - { - if($surfPWER == -1) - { - $row .= "[system error]"; - } - else - { - my ($lemmaBLEU, $p1, $p2, $p3, $p4, $brevity) = $corpus->calcBLEU($file, 'lemma'); - $row .= sprintf("surface = %d<br>lemma = %d<br><b>lemma BLEU = %.04f</b> %.01f/%.01f/%.01f/%.01f *%.03f", - $surfPWER, $lemmaPWER, $lemmaBLEU, $p1, $p2, $p3, $p4, $brevity); - } - } - $row .= "</TD>\n"; - - # correct sentence score - my($correct,$wrong,$unknown); - $row .= "<TD>"; - if (!defined($DONTSCORE{$file}) && (scalar keys %MEMORY)) { - my ($correct,$just_syn,$just_sem,$wrong,$unknown) = - &get_score_from_memory("$in{CORPUS}.$FOREIGN", - "$in{CORPUS}.$file"); - $row .= "<B><FONT COLOR=GREEN>$correct</FONT></B>"; - $row .= "/<FONT COLOR=ORANGE>$just_syn</FONT>"; - $row .= "/<FONT COLOR=ORANGE>$just_sem</FONT>"; - $row .= "/<FONT COLOR=RED>$wrong</FONT> ($unknown)</TD>\n"; - if ($in{SORT} eq 'SCORE') { - $sort = sprintf("%03d %04d",$correct,$just_syn+$just_sem); - } - } - else - { - $row .= "</TD>\n"; - } - - # score / review links - $row .= "<TD>"; - $row .= "<A HREF=\"?ACTION=SCORE_FILE&VIEW=1&CORPUS=".CGI::escape($in{CORPUS})."&FILE=".CGI::escape($file)."\">view</A>" if (!defined($DONTSCORE{$file})); - $row .= " <A HREF=\"?ACTION=SCORE_FILE&CORPUS=".CGI::escape($in{CORPUS})."&FILE=".CGI::escape($file)."\">score</A>" if (!defined($DONTSCORE{$file}) && ($unknown || scalar keys %MEMORY == 0)); - $row .= " <A HREF=\"?ACTION=RESCORE_FILE&CORPUS=".CGI::escape($in{CORPUS})."&FILE=".CGI::escape($file)."\">review</A>" if (!defined($DONTSCORE{$file}) && scalar keys %MEMORY); - $row .= "</TD></TR>\n"; - push @TABLE, "<!-- $sort -->\n$row"; - } - close(DIR); - foreach (reverse sort @TABLE) { print $_; } - print "</TABLE>\n"; - print "<INPUT TYPE=SUBMIT VALUE=\"Compare\">\n"; - print "<INPUT TYPE=CHECKBOX NAME=SURFACE VALUE=1 CHECKED> Compare all different sentences (instead of just differently <I>evaluated</I> sentences) <INPUT TYPE=CHECKBOX NAME=WITH_EVAL VALUE=1 CHECKED> with evaluation</FORM><P>\n"; - print "<P>The score is to be read as: <FONT COLOR=GREEN>correct</FONT>/<FONT COLOR=ORANGE>just-syn-correct</FONT>/<FONT COLOR=ORANGE>just-sem-correct</FONT>/<FONT COLOR=RED>wrong</FONT> (unscored)\n"; - print "<BR>IBM BLEU is to be read as: <B>metric</B> unigram/bigram/trigram/quadgram *brevity-penalty\n"; - print "<P><A HREF=\"newsmtgui.cgi?action=\">All corpora</A>\n"; -} - -###### SCORE TRANSLATIONS - -sub score_file { - if ($in{VIEW}) { - &htmlhead("View Translations"); - } - else { - &htmlhead("Score Translations"); - } - print "<A HREF=\"?ACTION=VIEW_CORPUS&CORPUS=".CGI::escape($in{CORPUS})."\">View Corpus $in{CORPUS}</A><P>\n"; - print "<FORM ACTION=\"\" METHOD=POST>\n"; - print "<INPUT TYPE=HIDDEN NAME=ACTION VALUE=$in{ACTION}>\n"; - print "<INPUT TYPE=HIDDEN NAME=CORPUS VALUE=\"$in{CORPUS}\">\n"; - print "<INPUT TYPE=HIDDEN NAME=FILE VALUE=\"$in{FILE}\">\n"; - - # get sentences - my @SENTENCES; - if ($in{FILE} =~ /.sgm$/) { - @SENTENCES = `grep '<seg' $in{CORPUS}.$in{FILE}`; - for(my $i=0;$i<$#SENTENCES;$i++) { - $SENTENCES[$i] =~ s/^<seg[^>]+> *(\S.+\S) *<\/seg> *$/$1/; - } - } - else { - @SENTENCES = `cat $in{CORPUS}.$in{FILE}`; chop(@SENTENCES); - } - - my %REFERENCE; - foreach (@SHOW) { - if (-e "$in{CORPUS}.$_") { - @{$REFERENCE{$_}} = `cat $in{CORPUS}.$_`; chop(@{$REFERENCE{$_}}); - } - } - - # update memory - foreach (keys %in) { - next unless /^SYN_SCORE_(\d+)$/; - next unless $in{"SEM_SCORE_$1"}; - &store_in_memory($REFERENCE{$FOREIGN}[$1], - $SENTENCES[$1], - "syn_".$in{"SYN_SCORE_$1"}." sem_".$in{"SEM_SCORE_$1"}); - } - - # display sentences - for(my $i=0;$i<=$#SENTENCES;$i++) { - my $evaluation = &get_from_memory($REFERENCE{$FOREIGN}[$i],$SENTENCES[$i]); - next if ($in{ACTION} eq 'SCORE_FILE' && - ! $in{VIEW} && - $evaluation ne '' && $evaluation ne 'wrong'); - print "<P>Sentence ".($i+1).":<BR>\n"; - # color coding - &color_highlight_ngrams($i,&nist_normalize_text($SENTENCES[$i]),$REFERENCE{"e"}[$i]); - if (%MULTI_REF) { - foreach my $sysid (keys %MULTI_REF) { - print "<FONT COLOR=GREEN>".$MULTI_REF{$sysid}[$i]."</FONT> (Reference $sysid)<BR>\n"; - } - } - - # all sentences - print "$SENTENCES[$i] (System output)<BR>\n"; - foreach my $ref (@SHOW) { - if (-e "$in{CORPUS}.$ref") { - print "<FONT COLOR=$SHOW_COLOR{$ref}>".$REFERENCE{$ref}[$i]."</FONT> (".$FILETYPE{$ref}.")<BR>\n" if $REFERENCE{$ref}[$i]; - } - } - if (! $in{VIEW}) { - print "<INPUT TYPE=RADIO NAME=SYN_SCORE_$i VALUE=correct"; - print " CHECKED" if ($evaluation =~ /syn_correct/); - print "> perfect English\n"; - print "<INPUT TYPE=RADIO NAME=SYN_SCORE_$i VALUE=wrong"; - print " CHECKED" if ($evaluation =~ /syn_wrong/); - print "> imperfect English<BR>\n"; - print "<INPUT TYPE=RADIO NAME=SEM_SCORE_$i VALUE=correct"; - print " CHECKED" if ($evaluation =~ /sem_correct/); - print "> correct meaning\n"; - print "<INPUT TYPE=RADIO NAME=SEM_SCORE_$i VALUE=wrong"; - print " CHECKED" if ($evaluation =~ /sem_wrong/); - print "> incorrect meaning\n"; - } - } - if (! $in{VIEW}) { - print "<P><INPUT TYPE=SUBMIT VALUE=\"Add evaluation\">\n"; - print "</FORM>\n"; - } -} - -sub color_highlight_ngrams { - my($i,$sentence,$single_reference) = @_; - my @REF = (); - my %NGRAM = (); - if (%MULTI_REF) { - foreach my $sysid (keys %MULTI_REF) { - push @REF,&nist_normalize_text($MULTI_REF{$sysid}[$i]); - } - } - elsif ($single_reference) { - @REF = ($single_reference); - } - if (@REF) { - foreach my $ref (@REF) { - my @WORD = split(/\s+/,$ref); - for(my $n=1;$n<=4;$n++) { - for(my $w=0;$w<=$#WORD-($n-1);$w++) { - my $ngram = "$n: "; - for(my $j=0;$j<$n;$j++) { - $ngram .= $WORD[$w+$j]." "; - } - $NGRAM{$ngram}++; - } - } - } - $sentence =~ s/^\s+//; - $sentence =~ s/\s+/ /; - $sentence =~ s/\s+$//; - my @WORD = split(/\s+/,$sentence); - my @CORRECT; - for(my $w=0;$w<=$#WORD;$w++) { - $CORRECT[$w] = 0; - } - for(my $n=1;$n<=4;$n++) { - for(my $w=0;$w<=$#WORD-($n-1);$w++) { - my $ngram = "$n: "; - for(my $j=0;$j<$n;$j++) { - $ngram .= $WORD[$w+$j]." "; - } - next unless defined($NGRAM{$ngram}) && $NGRAM{$ngram}>0; - $NGRAM{$ngram}--; - for(my $j=0;$j<$n;$j++) { - $CORRECT[$w+$j] = $n; - } - } - } - my @COLOR; - $COLOR[0] = "#FF0000"; - $COLOR[1] = "#C000C0"; - $COLOR[2] = "#0000FF"; - $COLOR[3] = "#00C0C0"; - $COLOR[4] = "#00C000"; - for(my $w=0;$w<=$#WORD;$w++) { - print "<B><FONT COLOR=".$COLOR[$CORRECT[$w]].">$WORD[$w]<SUB>".$CORRECT[$w]."</SUB></FONT></B> "; - } - print "\n<BR>"; - } -} - -###### OTHER STATS - -#print (in some unspecified way) the offending exception of type Error::Simple -#arguments: the error object, a context string -#return: none -sub printError -{ - my ($err, $context) = @_; - warn "$context: " . $err->{'-text'} . " @ " . $err->{'-file'} . " (" .$err->{'-line'} . ")\n"; -} - -#compute number and percentage of unknown tokens for a given factor in foreign corpus -#arguments: corpus object ref, factor name -#return (unkwordCount, totalWordCount), or (-1, -1) if an error occurs -sub calc_unknown_words -{ - my ($corpus, $factorName) = @_; - try - { - my ($unknownCount, $totalCount) = $corpus->calcUnknownTokens($factorName); - return ($unknownCount, $totalCount); - } - catch Error::Simple with - { - my $err = shift; - printError($err, 'calc_unknown_words()'); - return (-1, -1); - }; -} - -#compute (if we have the necessary factors) info for: -#- diff btwn wer and pwer for NNs & ADJs -- if large, many reordering errors -#- diff btwn pwer for surface forms and pwer for lemmas -- if large, morphology errors -#arguments: corpus object, system name -#return (NN/ADJ (wer, pwer), surf pwer, lemma pwer), or (-1, -1, -1, -1) if an error occurs -sub calc_misc_stats -{ - my ($corpus, $sysname) = @_; - try - { - my ($nnAdjWER, $nnAdjPWER) = $corpus->calcNounAdjWER_PWERDiff($sysname); - my ($surfPWER, $lemmaPWER) = ($corpus->calcOverallPWER($sysname, 'surf'), $corpus->calcOverallPWER($sysname, 'lemma')); - return ($nnAdjWER, $nnAdjPWER, $surfPWER, $lemmaPWER); - } - catch Error::Simple with - { - my $err = shift; - printError($err, 'calc_misc_stats()'); - return (-1, -1, -1, -1); - }; -} - -###### NIST SCORE - -sub get_nist_score { - my($reference_file,$source_file,$translation_file) = @_; - my @STAT = stat($translation_file); - my $current_timestamp = $STAT[9]; - foreach (@NIST) { - my ($file,$time,$nist,$bleu) = split; - return ($nist,$bleu) - if ($file eq $translation_file && $current_timestamp == $time); - } - - my $nist_eval = `/home/pkoehn/statmt/bin/mteval-v10.pl -c -r $reference_file -s $source_file -t $translation_file`; - return (0,0) unless ($nist_eval =~ /NIST score = (\d+\.\d+) BLEU score = (\d+\.\d+)/i); - - open(NIST,">>nist-memory.dat"); - printf NIST "$translation_file $current_timestamp %f %f\n",$1,$2; - close(NIST); - return ($1,$2); -} - -sub nist_normalize_text { - my ($norm_text) = @_; - -# language-independent part: - $norm_text =~ s/<skipped>//g; # strip "skipped" tags - $norm_text =~ s/-\n//g; # strip end-of-line hyphenation and join lines - $norm_text =~ s/\n/ /g; # join lines - $norm_text =~ s/(\d)\s+(\d)/$1$2/g; #join digits - $norm_text =~ s/"/"/g; # convert SGML tag for quote to " - $norm_text =~ s/&/&/g; # convert SGML tag for ampersand to & - $norm_text =~ s/</</g; # convert SGML tag for less-than to > - $norm_text =~ s/>/>/g; # convert SGML tag for greater-than to < - -# language-dependent part (assuming Western languages): - $norm_text = " $norm_text "; -# $norm_text =~ tr/[A-Z]/[a-z]/ unless $preserve_case; - $norm_text =~ s/([\{-\~\[-\` -\&\(-\+\:-\@\/])/ $1 /g; # tokenize punctuation - $norm_text =~ s/([^0-9])([\.,])/$1 $2 /g; # tokenize period and comma unless preceded by a digit - $norm_text =~ s/([\.,])([^0-9])/ $1 $2/g; # tokenize period and comma unless followed by a digit - $norm_text =~ s/([0-9])(-)/$1 $2 /g; # tokenize dash when preceded by a digit - $norm_text =~ s/\s+/ /g; # one space only between words - $norm_text =~ s/^\s+//; # no leading space - $norm_text =~ s/\s+$//; # no trailing space - - return $norm_text; -} - -###### BLEU SCORE - -sub get_multi_bleu_score { - my($foreign_file,$reference_file,$translation_file) = @_; - my @STAT = stat($translation_file); - my $current_timestamp = $STAT[9]; - foreach (@mBLEU) { - my ($file,$time,$score,$g1,$g2,$g3,$g4,$bp) = split; - if ($file eq $translation_file && $current_timestamp == $time) { - return ($score,$g1*100,$g2*100,$g3*100,$g4*100,$bp); - } - } - - # load reference translation from reference file - my @REFERENCE_SENTENCE = `cat $reference_file`; chop(@REFERENCE_SENTENCE); - my @TRANSLATION_SENTENCE = `cat $translation_file`; chop(@TRANSLATION_SENTENCE); - my %REF; - my @FOREIGN_SENTENCE = `cat $foreign_file`; chop(@FOREIGN_SENTENCE); - for(my $i=0;$i<=$#TRANSLATION_SENTENCE;$i++) { - push @{$REF{$FOREIGN_SENTENCE[$i]}},$REFERENCE_SENTENCE[$i]; - } - # load reference translation from translation memory - foreach my $memory (keys %MEMORY) { - next if $MEMORY{$memory} ne 'syn_correct sem_correct'; - my ($foreign,$english) = split(/ .o0O0o. /,$memory); - next unless defined($REF{$foreign}); - push @{$REF{$foreign}},$english; - } - my(@CORRECT,@TOTAL,$length_translation,$length_reference); - # compute bleu - for(my $i=0;$i<=$#TRANSLATION_SENTENCE;$i++) { - my %REF_NGRAM = (); - my @WORD = split(/ /,$TRANSLATION_SENTENCE[$i]); - my $length_translation_this_sentence = scalar(@WORD); - my ($closest_diff,$closest_length) = (9999,9999); - foreach my $reference (@{$REF{$FOREIGN_SENTENCE[$i]}}) { - my @WORD = split(/ /,$reference); - my $length = scalar(@WORD); - if (abs($length_translation_this_sentence-$length) < $closest_diff) { - $closest_diff = abs($length_translation_this_sentence-$length); - $closest_length = $length; - } - for(my $n=1;$n<=4;$n++) { - my %REF_NGRAM_N = (); - for(my $start=0;$start<=$#WORD-($n-1);$start++) { - my $ngram = "$n"; - for(my $w=0;$w<$n;$w++) { - $ngram .= " ".$WORD[$start+$w]; - } - $REF_NGRAM_N{$ngram}++; - } - foreach my $ngram (keys %REF_NGRAM_N) { - if (!defined($REF_NGRAM{$ngram}) || - $REF_NGRAM{$ngram} < $REF_NGRAM_N{$ngram}) { - $REF_NGRAM{$ngram} = $REF_NGRAM_N{$ngram}; - } - } - } - } - $length_translation += $length_translation_this_sentence; - $length_reference += $closest_length; - for(my $n=1;$n<=4;$n++) { - my %T_NGRAM = (); - for(my $start=0;$start<=$#WORD-($n-1);$start++) { - my $ngram = "$n"; - for(my $w=0;$w<$n;$w++) { - $ngram .= " ".$WORD[$start+$w]; - } - $T_NGRAM{$ngram}++; - } - foreach my $ngram (keys %T_NGRAM) { - my $n = 0+$ngram; -# print "$i e $ngram $T_NGRAM{$ngram}<BR>\n"; - $TOTAL[$n] += $T_NGRAM{$ngram}; - if (defined($REF_NGRAM{$ngram})) { - if ($REF_NGRAM{$ngram} >= $T_NGRAM{$ngram}) { - $CORRECT[$n] += $T_NGRAM{$ngram}; -# print "$i e correct1 $T_NGRAM{$ngram}<BR>\n"; - } - else { - $CORRECT[$n] += $REF_NGRAM{$ngram}; -# print "$i e correct2 $REF_NGRAM{$ngram}<BR>\n"; - } - } - } - } - } - my $brevity_penalty = 1; - if ($length_translation<$length_reference) { - $brevity_penalty = exp(1-$length_reference/$length_translation); - } - my $bleu = $brevity_penalty * exp((my_log( $CORRECT[1]/$TOTAL[1] ) + - my_log( $CORRECT[2]/$TOTAL[2] ) + - my_log( $CORRECT[3]/$TOTAL[3] ) + - my_log( $CORRECT[4]/$TOTAL[4] ) ) / 4); - - open(BLEU,">>mbleu-memory.dat"); - @STAT = stat($translation_file); - printf BLEU "$translation_file $STAT[9] %f %f %f %f %f %f\n",$bleu,$CORRECT[1]/$TOTAL[1],$CORRECT[2]/$TOTAL[2],$CORRECT[3]/$TOTAL[3],$CORRECT[4]/$TOTAL[4],$brevity_penalty; - close(BLEU); - - return ($bleu, - 100*$CORRECT[1]/$TOTAL[1], - 100*$CORRECT[2]/$TOTAL[2], - 100*$CORRECT[3]/$TOTAL[3], - 100*$CORRECT[4]/$TOTAL[4], - $brevity_penalty); -} - -sub my_log { - return -9999999999 unless $_[0]; - return log($_[0]); -} - - -###### SCORE TRANSLATIONS - -################################ IN PROGRESS ############################### -sub compare2 -{ - &htmlhead("Compare Translations"); - print "<A HREF=\"?ACTION=VIEW_CORPUS&CORPUS=".CGI::escape($in{CORPUS})."\">View Corpus $in{CORPUS}</A><P>\n"; - print "<FORM ACTION=\"\" METHOD=POST>\n"; - print "<INPUT TYPE=HIDDEN NAME=ACTION VALUE=$in{ACTION}>\n"; - print "<INPUT TYPE=HIDDEN NAME=CORPUS VALUE=\"$in{CORPUS}\">\n"; - my $corpus = new Corpus('-name' => "$in{CORPUS}", '-descriptions' => \%FILEDESC, '-indices' => \%factorIndices); - $corpus->writeComparisonPage(\*STDOUT, /^.*$/); - print "</FORM>\n"; -} - -sub compare { - &htmlhead("Compare Translations"); - print "<A HREF=\"?ACTION=VIEW_CORPUS&CORPUS=".CGI::escape($in{CORPUS})."\">View Corpus $in{CORPUS}</A><P>\n"; - print "<FORM ACTION=\"\" METHOD=POST>\n"; - print "<INPUT TYPE=HIDDEN NAME=ACTION VALUE=$in{ACTION}>\n"; - print "<INPUT TYPE=HIDDEN NAME=CORPUS VALUE=\"$in{CORPUS}\">\n"; - - # get sentences - my %SENTENCES; - my $sentence_count; - foreach (keys %in) { - if (/^FILE_(.+)$/) { - my $file = $1; - print "<INPUT TYPE=HIDDEN NAME=\"$file\" VALUE=1>\n"; - my @SENTENCES; - if ($file =~ /.sgm$/) { - @{$SENTENCES{$file}} = `grep '<seg' $in{CORPUS}.$file`; - for(my $i=0;$i<$#{$SENTENCES{$file}};$i++) { - $SENTENCES{$file}[$i] =~ s/^<seg[^>]+> *(\S.+\S) *<\/seg> *$/$1/; - } - } - else { - @{$SENTENCES{$file}} = `cat $in{CORPUS}.$1`; - chop(@{$SENTENCES{$file}}); - } - - $sentence_count = scalar @{$SENTENCES{$file}}; - } - } - my %REFERENCE; - foreach (@SHOW) { - if (-e "$in{CORPUS}.$_") { - @{$REFERENCE{$_}} = `cat $in{CORPUS}.$_`; chop(@{$REFERENCE{$_}}); - } - } - - # update memory - foreach (keys %in) { - next unless /^SYN_SCORE_(.+)_(\d+)$/; - next unless $in{"SEM_SCORE_$1_$2"}; - &store_in_memory($REFERENCE{$FOREIGN}[$2], - $SENTENCES{$1}[$2], - "syn_".$in{"SYN_SCORE_$1_$2"}." sem_".$in{"SEM_SCORE_$1_$2"}); - } - - # display sentences - for(my $i=0;$i<$sentence_count;$i++) - { - my $evaluation = ""; - my $show = 0; - my $surface = ""; - foreach my $file (keys %SENTENCES) - { - if ($in{SURFACE}) { - $SENTENCES{$file}[$i] =~ s/ *$//; - $surface = $SENTENCES{$file}[$i] if ($surface eq ''); - $show = 1 if ($SENTENCES{$file}[$i] ne $surface); - } - else { - my $this_ev = &get_from_memory($REFERENCE{$FOREIGN}[$i],$SENTENCES{$file}[$i]); - $this_ev = "syn_wrong sem_wrong" unless $this_ev; - $evaluation = $this_ev if ($evaluation eq ''); - $show = 1 if ($evaluation ne $this_ev); - } - } - next unless $show; - print "<HR>Sentence ".($i+1).":<BR>\n"; - foreach my $ref (@SHOW) { - if (-e "$in{CORPUS}.$ref") { - print "<FONT COLOR=$SHOW_COLOR{$ref}>".$REFERENCE{$ref}[$i]."</FONT> (".$FILETYPE{$ref}.")<BR>\n"; - } - } - foreach my $file (keys %SENTENCES) { - print "<B>$SENTENCES{$file}[$i]</B> ($file)<BR>\n"; - &color_highlight_ngrams($i,&nist_normalize_text($SENTENCES{$file}[$i]),$REFERENCE{"e"}[$i]); - if (0 && $in{WITH_EVAL}) { - $evaluation = &get_from_memory($REFERENCE{$FOREIGN}[$i],$SENTENCES{$file}[$i]); - print "<INPUT TYPE=RADIO NAME=SYN_SCORE_$file"."_$i VALUE=correct"; - print " CHECKED" if ($evaluation =~ /syn_correct/); - print "> perfect English\n"; - print "<INPUT TYPE=RADIO NAME=SYN_SCORE_$file"."_$i VALUE=wrong"; - print " CHECKED" if ($evaluation =~ /syn_wrong/); - print "> imperfect English<BR>\n"; - print "<INPUT TYPE=RADIO NAME=SEM_SCORE_$file"."_$i VALUE=correct"; - print " CHECKED" if ($evaluation =~ /sem_correct/); - print "> correct meaning\n"; - print "<INPUT TYPE=RADIO NAME=SEM_SCORE_$file"."_$i VALUE=wrong"; - print " CHECKED" if ($evaluation =~ /sem_wrong/); - print "> incorrect meaning<BR>\n"; - } - } - } - print "<P><INPUT TYPE=SUBMIT VALUE=\"Add evaluation\">\n"; - print "</FORM>\n"; -} - -###### MEMORY SUBS - -sub load_memory { - open(MEMORY,"evaluation-memory.dat") or return; - while(<MEMORY>) { - chop; - my($foreign,$translation,$evaluation) = split(/ \.o0O0o\. /); - $evaluation = 'syn_correct sem_correct' if ($evaluation eq 'correct'); - $MEMORY{"$foreign .o0O0o. $translation"} = $evaluation; - } - close(MEMORY); -} - -sub get_score_from_memory { - my($foreign_file,$translation_file) = @_; - my $unknown=0; - my $correct=0; - my $just_syn=0; - my $just_sem=0; - my $wrong=0; - my @FOREIGN = `cat $foreign_file`; chop(@FOREIGN); - my @TRANSLATION = `cat $translation_file`; chop(@TRANSLATION); - for(my $i=0;$i<=$#FOREIGN;$i++) { - if (my $evaluation = &get_from_memory($FOREIGN[$i],$TRANSLATION[$i])) { - if ($evaluation eq 'syn_correct sem_correct') { $correct++ } - elsif ($evaluation eq 'syn_correct sem_wrong') { $just_syn++ } - elsif ($evaluation eq 'syn_wrong sem_correct') { $just_sem++ } - elsif ($evaluation eq 'syn_wrong sem_wrong') { $wrong++ } - else { $unknown++; } - } - else { $unknown++; } - } - return($correct,$just_syn,$just_sem,$wrong,$unknown); -} - -sub store_in_memory { - my($foreign,$translation,$evaluation) = @_; - &trim(\$translation); - return if $MEMORY{"$foreign .o0O0o. $translation"} eq $evaluation; - $MEMORY{"$foreign .o0O0o. $translation"} = $evaluation; - open(MEMORY,">>evaluation-memory.dat") or die "store_in_memory(): couldn't open 'evaluation-memory.dat' for append\n"; - print MEMORY "$foreign .o0O0o. $translation .o0O0o. $evaluation\n"; - close(MEMORY); -} - -sub get_from_memory { - my($foreign,$translation) = @_; - &trim(\$translation); - return $MEMORY{"$foreign .o0O0o. $translation"}; -} - -sub trim { - my($translation) = @_; - $$translation =~ s/ +/ /g; - $$translation =~ s/^ +//; - $$translation =~ s/ +$//; -# $$translation =~ s/ +[\.]$//; -} - -sub load_descriptions { - open(FD,"file-descriptions") or die "load_descriptions(): couldn't open 'file-descriptions' for read\n"; - while(<FD>) { - my($file,$description) = split(/\s+/,$_,2); - $FILEDESC{$file} = $description; - } - close(FD); -} - -#read config file giving names of corpi and fill factor-index map -#arguments: filename to read -#return: hash of corpus names to hashrefs of factor names to indices -sub loadFactorIndices -{ - my $filename = shift; - my %data = (); - open(INFILE, "<$filename") or die "loadFactorIndices(): couldn't open '$filename' for read\n"; - while(my $line = <INFILE>) - { - if($line =~ /^\#/) {next;} #skip comment lines - my @tokens = split(/\s+/, $line); - my $corpusName = shift @tokens; - $data{$corpusName} = {}; - for(my $i = 0; $i < scalar(@tokens); $i++) - { - $data{$corpusName}->{$tokens[$i]} = $i; - } - } - close(INFILE); - return %data; -} - -###### SUBS - -sub htmlhead { - print <<"___ENDHTML"; -Content-type: text/html - -<HTML><HEAD> -<TITLE>MTEval: $_[0]</TITLE> -<SCRIPT LANGUAGE="JavaScript"> - -<!-- hide from old browsers - -function FieldInfo(field,description) { - popup = window.open("","popDialog","height=500,width=600,scrollbars=yes,resizable=yes"); - popup.document.write("<HTML><HEAD><TITLE>"+field+"</TITLE></HEAD><BODY BGCOLOR=#FFFFCC><CENTER><B>"+field+"</B><HR SIZE=2 NOSHADE></CENTER><PRE>"+description+"</PRE><CENTER><FORM><INPUT TYPE='BUTTON' VALUE='Okay' onClick='self.close()'></FORM><CENTER></BODY></HTML>"); - popup.focus(); - popup.document.close(); -} - -<!-- done hiding --> - -</SCRIPT> -</HEAD> -<BODY BGCOLOR=white> -<H2>Evaluation Tool for Machine Translation<BR>$_[0]</H2> -___ENDHTML -} - - -############################# parts of cgi-lib.pl - - -sub ReadParse { - my ($i, $key, $val); - - # Read in text - my $in; - if (&MethGet) { - $in = $ENV{'QUERY_STRING'}; - } elsif (&MethPost) { - read(STDIN,$in,$ENV{'CONTENT_LENGTH'}); - } - - my @in = split(/[&;]/,$in); - - foreach $i (0 .. $#in) { - # Convert plus's to spaces - $in[$i] =~ s/\+/ /g; - - # Split into key and value. - ($key, $val) = split(/=/,$in[$i],2); # splits on the first =. - - # Convert %XX from hex numbers to alphanumeric - $key =~ s/%(..)/pack("c",hex($1))/ge; - $val =~ s/%(..)/pack("c",hex($1))/ge; - - # Associate key and value - $in{$key} .= "\0" if (defined($in{$key})); # \0 is the multiple separator - $in{$key} .= $val; - - } - - return scalar(@in); -} - -sub MethGet { - return ($ENV{'REQUEST_METHOD'} eq "GET"); -} - -sub MethPost { - return ($ENV{'REQUEST_METHOD'} eq "POST"); -} diff --git a/scripts/tests/README b/scripts/tests/README deleted file mode 100644 index 974cc65a2..000000000 --- a/scripts/tests/README +++ /dev/null @@ -1,4 +0,0 @@ -All *.test files here are run by ../Makefile. -The tests should assume, that they are launched in a fresh directory: - -tests/TESTNAME.test.TIMESTAMP/ diff --git a/scripts/tests/mert-moses-parallel.test b/scripts/tests/mert-moses-parallel.test deleted file mode 100755 index 00c174eff..000000000 --- a/scripts/tests/mert-moses-parallel.test +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -MOSESCMD=/export/ws06osmt/bin/moses.2006-07-29 -DATADIR=/export/ws06osmt/example/met-parallel - -[ -e $MOSESCMD ] || exit 1 - -cp $DATADIR/moses.ini ./ || exit 1 -cp $DATADIR/dev.input ./ || exit 1 -cp $DATADIR/dev.ref ./ || exit 1 - -echo "Starting moses-perl" - -$SCRIPTS_ROOTDIR/training/mert-moses.pl --jobs=10 dev.input dev.ref $MOSESCMD ./moses.ini diff --git a/scripts/tests/mert-moses-serial.test b/scripts/tests/mert-moses-serial.test deleted file mode 100755 index 90df1433d..000000000 --- a/scripts/tests/mert-moses-serial.test +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -MOSESCMD=/export/ws06osmt/bin/moses.2006-07-29 -DATADIR=/export/ws06osmt/example/met-parallel - -[ -e $MOSESCMD ] || exit 1 - -cp $DATADIR/moses.ini ./ || exit 1 -cp $DATADIR/dev.input ./ || exit 1 -cp $DATADIR/dev.ref ./ || exit 1 - -echo "Starting moses-perl" - -$SCRIPTS_ROOTDIR/training/mert-moses.pl dev.input dev.ref $MOSESCMD ./moses.ini |