[cg3] 01/03: Imported Upstream version 0.9.9~r10827
Tino Didriksen
tinodidriksen-guest at moszumanska.debian.org
Thu Jul 2 10:00:54 UTC 2015
This is an automated email from the git hooks/post-receive script.
tinodidriksen-guest pushed a commit to branch master
in repository cg3.
commit 8ef62711bcc235d39787e95bcdaa0248262ee8d6
Author: Tino Didriksen <mail at tinodidriksen.com>
Date: Thu Jul 2 10:00:31 2015 +0000
Imported Upstream version 0.9.9~r10827
---
CMakeLists.txt | 5 +-
ChangeLog | 13 +-
Doxyfile | 261 ----------------------------
all2unix.pl | 4 -
make-naive.sh | 9 -
scripts/auto-linux-wget.sh | 21 ---
scripts/profile-revisions.php | 10 +-
src/CMakeLists.txt | 7 +-
src/GrammarApplicator.hpp | 1 +
src/GrammarApplicator_reflow.cpp | 4 +-
src/GrammarApplicator_runContextualTest.cpp | 7 +-
src/GrammarApplicator_runRules.cpp | 82 ++++++---
src/version.hpp | 2 +-
13 files changed, 91 insertions(+), 335 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e077e6e..857a2e8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,10 +25,11 @@ elseif(LIB_SUFFIX)
set(CG_LIBDIR "${CG_LIBDIR}${LIB_SUFFIX}")
endif()
-option(OPT_TCMALLOC "Set to OFF to disable linking against TCMalloc" ON)
+option(INSTALL_STATIC "Set to ON to install the static library" OFF)
+option(USE_TCMALLOC "Set to OFF to disable linking against TCMalloc" ON)
if(APPLE)
message(STATUS "Disabling TCMalloc for OS X")
- set(OPT_TCMALLOC OFF)
+ set(USE_TCMALLOC OFF)
endif()
if(MSVC)
diff --git a/ChangeLog b/ChangeLog
index 7e69422..d028f05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2015-06-30 tino
+ * [r10822] ChangeLog, src/GrammarApplicator.hpp,
+ src/GrammarApplicator_matchSet.cpp,
+ src/GrammarApplicator_reflow.cpp,
+ src/GrammarApplicator_runContextualTest.cpp,
+ src/GrammarApplicator_runRules.cpp, src/version.hpp,
+ test/T_BasicSubstitute/expected.txt,
+ test/T_BasicSubstitute/grammar.cg3,
+ test/T_BasicSubstitute/grammar.cg3b.10043: Eliminate the
+ performance cost of segfault fixes; Test that so it doesn't
+ happen again
* [r10821] CMakeLists.txt, vapply.sh, vparse.sh: Use C++14 where
available
* [r10819] ChangeLog, scripts/profile-revisions.php,
@@ -2312,7 +2322,4 @@
src/macros.h, src/main.cpp, src/options.h, src/sorted_vector.hpp,
src/stdafx.h, src/test_libcg3.c, src/uextras.cpp, src/uextras.h,
src/version.h: Yearly copyright refresh.
- * [r8876] scripts/cg3-autobin.pl,
- src/GrammarApplicator_runGrammar.cpp, src/version.h: Fixed
- sub-readings breaking everything when they weren't real readings.
diff --git a/Doxyfile b/Doxyfile
deleted file mode 100644
index 6ba17e5..0000000
--- a/Doxyfile
+++ /dev/null
@@ -1,261 +0,0 @@
-# Doxyfile 1.4.7
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "CG-3"
-PROJECT_NUMBER =
-OUTPUT_DIRECTORY = ./docs
-CREATE_SUBDIRS = YES
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = YES
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = YES
-STRIP_FROM_PATH =
-STRIP_FROM_INC_PATH =
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = NO
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = NO
-INHERIT_DOCS = YES
-SEPARATE_MEMBER_PAGES = NO
-TAB_SIZE = 8
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = NO
-OPTIMIZE_OUTPUT_JAVA = NO
-BUILTIN_STL_SUPPORT = NO
-DISTRIBUTE_GROUP_DOC = NO
-SUBGROUPING = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = YES
-EXTRACT_STATIC = YES
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = NO
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-INTERNAL_DOCS = NO
-CASE_SENSE_NAMES = NO
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = YES
-SORT_BRIEF_DOCS = NO
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-SHOW_USED_FILES = YES
-SHOW_DIRECTORIES = NO
-FILE_VERSION_FILTER =
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = NO
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_NO_PARAMDOC = NO
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = "./src/"
-FILE_PATTERNS = *.c \
- *.cc \
- *.cxx \
- *.cpp \
- *.c++ \
- *.d \
- *.java \
- *.ii \
- *.ixx \
- *.ipp \
- *.i++ \
- *.inl \
- *.h \
- *.hh \
- *.hxx \
- *.hpp \
- *.h++ \
- *.idl \
- *.odl \
- *.cs \
- *.php \
- *.php3 \
- *.inc \
- *.m \
- *.mm \
- *.dox \
- *.py
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS = *
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_PATTERNS =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-REFERENCES_LINK_SOURCE = YES
-USE_HTAGS = NO
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = NO
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = html
-HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = YES
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = YES
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = YES
-MAN_OUTPUT = man
-MAN_EXTENSION = .3
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = YES
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = YES
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE =
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-HIDE_UNDOC_RELATIONS = YES
-HAVE_DOT = NO
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-GROUP_GRAPHS = YES
-UML_LOOK = NO
-TEMPLATE_RELATIONS = NO
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = NO
-CALLER_GRAPH = NO
-GRAPHICAL_HIERARCHY = YES
-DIRECTORY_GRAPH = YES
-DOT_IMAGE_FORMAT = png
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 1000
-DOT_TRANSPARENT = NO
-DOT_MULTI_TARGETS = NO
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
diff --git a/all2unix.pl b/all2unix.pl
deleted file mode 100755
index 9a07f41..0000000
--- a/all2unix.pl
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/perl -pi
-
-s/\r\n/\n/;
-s/\r/\n/;
diff --git a/make-naive.sh b/make-naive.sh
deleted file mode 100755
index cb62148..0000000
--- a/make-naive.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-echo "Building vislcg3 ..."
-g++ -DHAVE_BOOST -pipe -Wall -Wextra -Wno-deprecated -O3 -fno-rtti -ffor-scope -licuio -licuuc $@ ./src/all_vislcg3.cpp -o vislcg3
-echo "Building cg-comp ..."
-g++ -DHAVE_BOOST -pipe -Wall -Wextra -Wno-deprecated -O3 -fno-rtti -ffor-scope -licuio -licuuc $@ ./src/all_cg_comp.cpp -o cg-comp
-echo "Building cg-proc ..."
-g++ -DHAVE_BOOST -pipe -Wall -Wextra -Wno-deprecated -O3 -fno-rtti -ffor-scope -licuio -licuuc $@ ./src/all_cg_proc.cpp -o cg-proc
-echo "Building cg-conv ..."
-g++ -DHAVE_BOOST -pipe -Wall -Wextra -Wno-deprecated -O3 -fno-rtti -ffor-scope -licuio -licuuc $@ ./src/all_cg_conv.cpp -o cg-conv
diff --git a/scripts/auto-linux-wget.sh b/scripts/auto-linux-wget.sh
deleted file mode 100755
index 1b7e1c0..0000000
--- a/scripts/auto-linux-wget.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-
-echo "Cleaning up /tmp/vislcg3-auto ..."
-cd /tmp/
-rm -rfv vislcg3-auto
-mkdir vislcg3-auto
-cd vislcg3-auto
-
-echo "Fetching VISL CG-3 source with wget..."
-wget -nv -r -l0 -np -nH --http-user=anonymous --http-passwd=anonymous http://beta.visl.sdu.dk/svn/visl/tools/vislcg3/trunk/
-cd svn/visl/tools/vislcg3/trunk/
-chmod +x *.sh test/*.pl test/*/*.pl
-
-echo "Fetched everything...compiling..."
-./compile-linux.sh
-
-echo "Compiled. Running regression tests..."
-./test/runall.pl
-
-echo "If all normal tests were successful, you can now do:"
-echo "cp $(pwd)/vislcg3 /usr/local/bin/"
diff --git a/scripts/profile-revisions.php b/scripts/profile-revisions.php
index a426918..9b51d0f 100755
--- a/scripts/profile-revisions.php
+++ b/scripts/profile-revisions.php
@@ -14,13 +14,13 @@ function profile_revision($rev) {
if (file_exists('./src/all_vislcg3.cpp')) {
echo "Using all_vislcg3.cpp and Boost...\n";
- echo shell_exec('g++ -std=c++11 -DHAVE_BOOST -DNDEBUG -pthread -pipe -Wall -Wextra -Wno-deprecated -fPIC -O3 -Iinclude -Iinclude/exec-stream -Iinclude/posix ./src/all_vislcg3.cpp -o vislcg3 -L/usr/lib/x86_64-linux-gnu -licui18n -licudata -licuio -licuuc 2>&1');
- echo shell_exec('g++ -std=c++11 -DHAVE_BOOST -DNDEBUG -pthread -pipe -Wall -Wextra -Wno-deprecated -fPIC -O3 -Iinclude -Iinclude/exec-stream -Iinclude/posix ./src/all_vislcg3.cpp -o vislcg3-tc -L/usr/lib/x86_64-linux-gnu -licui18n -licudata -licuio -licuuc -ltcmalloc 2>&1');
+ echo shell_exec('g++ -std=c++1y -DHAVE_BOOST -DNDEBUG -pthread -pipe -Wall -Wextra -Wno-deprecated -fPIC -O3 -Iinclude -Iinclude/exec-stream -Iinclude/posix ./src/all_vislcg3.cpp -o vislcg3 -L/usr/lib/x86_64-linux-gnu -licui18n -licudata -licuio -licuuc 2>&1');
+ echo shell_exec('g++ -std=c++1y -DHAVE_BOOST -DNDEBUG -pthread -pipe -Wall -Wextra -Wno-deprecated -fPIC -O3 -Iinclude -Iinclude/exec-stream -Iinclude/posix ./src/all_vislcg3.cpp -o vislcg3-tc -L/usr/lib/x86_64-linux-gnu -licui18n -licudata -licuio -licuuc -ltcmalloc 2>&1');
}
else {
echo "Using old-style without Boost...\n";
- echo shell_exec('g++ -std=c++11 -DHAVE_BOOST -pthread -pipe -Wall -Wextra -Wno-deprecated -fPIC -O3 -Iinclude -Iinclude/exec-stream $(ls -1 ./src/*.cpp | egrep -v "/test_" | egrep -v "/cg_" | egrep -v "/all_" | grep -v Apertium | grep -v Matxin | grep -v FormatConverter) -o vislcg3 -L/usr/lib/x86_64-linux-gnu -licui18n -licudata -licuio -licuuc -ltcmalloc 2>&1');
- echo shell_exec('g++ -std=c++11 -DHAVE_BOOST -pthread -pipe -Wall -Wextra -Wno-deprecated -fPIC -O3 -ltcmalloc -Iinclude -Iinclude/exec-stream $(ls -1 ./src/*.cpp | egrep -v "/test_" | egrep -v "/cg_" | egrep -v "/all_" | grep -v Apertium | grep -v Matxin | grep -v FormatConverter) -o vislcg3-tc -L/usr/lib/x86_64-linux-gnu -licui18n -licudata -licuio -licuuc -ltcmalloc 2>&1');
+ echo shell_exec('g++ -std=c++1y -DHAVE_BOOST -pthread -pipe -Wall -Wextra -Wno-deprecated -fPIC -O3 -Iinclude -Iinclude/exec-stream $(ls -1 ./src/*.cpp | egrep -v "/test_" | egrep -v "/cg_" | egrep -v "/all_" | grep -v Apertium | grep -v Matxin | grep -v FormatConverter) -o vislcg3 -L/usr/lib/x86_64-linux-gnu -licui18n -licudata -licuio -licuuc -ltcmalloc 2>&1');
+ echo shell_exec('g++ -std=c++1y -DHAVE_BOOST -pthread -pipe -Wall -Wextra -Wno-deprecated -fPIC -O3 -ltcmalloc -Iinclude -Iinclude/exec-stream $(ls -1 ./src/*.cpp | egrep -v "/test_" | egrep -v "/cg_" | egrep -v "/all_" | grep -v Apertium | grep -v Matxin | grep -v FormatConverter) -o vislcg3-tc -L/usr/lib/x86_64-linux-gnu -licui18n -licudata -licuio -licuuc -ltcmalloc 2>&1');
}
if (!file_exists('vislcg3') || !file_exists('vislcg3-tc')) {
@@ -74,7 +74,7 @@ function profile_revision($rev) {
}
$revs = array(10809, 10800, 10373, 10044);
-$revs = array(10811);
+$revs = array(10824);
foreach ($revs as $rev) {
profile_revision($rev);
}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4973469..db5cbc8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -29,7 +29,7 @@ if(ICU_FOUND)
message(STATUS "Found ICU version ${ICU_VERSION}")
endif()
-if(NOT CMAKE_BUILD_TYPE STREQUAL Debug AND OPT_TCMALLOC)
+if(NOT CMAKE_BUILD_TYPE STREQUAL Debug AND USE_TCMALLOC)
find_library(GOOGLE_TCMALLOC_LIB tcmalloc)
if(GOOGLE_TCMALLOC_LIB)
message(STATUS "Found tcmalloc: ${GOOGLE_TCMALLOC_LIB}")
@@ -196,7 +196,10 @@ endif()
add_test(t_libcg3 test_libcg3 "${CMAKE_CURRENT_SOURCE_DIR}/../test/T_BasicSelect/grammar.cg3")
-install(TARGETS libcg3 ARCHIVE DESTINATION "${CG_LIBDIR}/${CMAKE_LIBRARY_ARCHITECTURE}")
+if(INSTALL_STATIC)
+ install(TARGETS libcg3 ARCHIVE DESTINATION "${CG_LIBDIR}/${CMAKE_LIBRARY_ARCHITECTURE}")
+endif()
+
if(NOT MSVC)
install(TARGETS libcg3-shared ARCHIVE DESTINATION "${CG_LIBDIR}/${CMAKE_LIBRARY_ARCHITECTURE}" LIBRARY DESTINATION "${CG_LIBDIR}/${CMAKE_LIBRARY_ARCHITECTURE}" RUNTIME DESTINATION bin)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/cg3.h" DESTINATION include)
diff --git a/src/GrammarApplicator.hpp b/src/GrammarApplicator.hpp
index e07fd2c..c4f51b3 100644
--- a/src/GrammarApplicator.hpp
+++ b/src/GrammarApplicator.hpp
@@ -264,6 +264,7 @@ namespace CG3 {
void delTagFromReading(Reading& reading, Tag *tag);
bool unmapReading(Reading& reading, const uint32_t rule);
TagList getTagList(const Set& theSet, bool unif_mode = false) const;
+ void getTagList(const Set& theSet, TagList& theTags, bool unif_mode = false) const;
void mergeReadings(ReadingList& readings);
void mergeMappings(Cohort& cohort);
bool isChildOf(const Cohort *child, const Cohort *parent);
diff --git a/src/GrammarApplicator_reflow.cpp b/src/GrammarApplicator_reflow.cpp
index 2f21d32..259cac1 100644
--- a/src/GrammarApplicator_reflow.cpp
+++ b/src/GrammarApplicator_reflow.cpp
@@ -367,7 +367,9 @@ Tag *GrammarApplicator::generateVarstringTag(const Tag *tag) {
// Replace unified sets with their matching tags
if (tag->vs_sets) {
for (size_t i=0 ; i<tag->vs_sets->size() ; ++i) {
- TagList tags = getTagList(*(*tag->vs_sets)[i]);
+ static TagList tags;
+ tags.clear();
+ getTagList(*(*tag->vs_sets)[i], tags);
static UString rpl;
rpl.clear();
// If there are multiple tags, such as from CompositeTags, put _ between them
diff --git a/src/GrammarApplicator_runContextualTest.cpp b/src/GrammarApplicator_runContextualTest.cpp
index c437b3f..650036b 100644
--- a/src/GrammarApplicator_runContextualTest.cpp
+++ b/src/GrammarApplicator_runContextualTest.cpp
@@ -516,7 +516,8 @@ Cohort *GrammarApplicator::runDependencyTest(SingleWindow *sWindow, Cohort *curr
}
}
- static uint32SortedVector tmp_deps;
+ // Recursion may happen, so can't be static
+ uint32SortedVector tmp_deps;
uint32SortedVector *deps = 0;
if (test->pos & POS_DEP_CHILD) {
deps = ¤t->dep_children;
@@ -655,8 +656,8 @@ Cohort *GrammarApplicator::runRelationTest(SingleWindow *sWindow, Cohort *curren
return 0;
}
- static CohortSet rels;
- rels.clear();
+ // Recursion may happen, so can't be static
+ CohortSet rels;
if (test->relation == grammar->tag_any) {
const_foreach (RelationCtn, current->relations, riter, riter_end) {
diff --git a/src/GrammarApplicator_runRules.cpp b/src/GrammarApplicator_runRules.cpp
index bbe2306..2406df2 100644
--- a/src/GrammarApplicator_runRules.cpp
+++ b/src/GrammarApplicator_runRules.cpp
@@ -112,25 +112,27 @@ void GrammarApplicator::indexSingleWindow(SingleWindow& current) {
TagList GrammarApplicator::getTagList(const Set& theSet, bool unif_mode) const {
TagList theTags;
+ getTagList(theSet, theTags, unif_mode);
+ return theTags;
+}
+
+void GrammarApplicator::getTagList(const Set& theSet, TagList& theTags, bool unif_mode) const {
if (theSet.type & ST_SET_UNIFY) {
const Set& pSet = *(grammar->sets_list[theSet.sets[0]]);
const_foreach (uint32Vector, pSet.sets, iter, iter_end) {
if (unif_sets->count(*iter)) {
- TagList recursiveTags = getTagList(*(grammar->sets_list[*iter]));
- theTags.insert(theTags.end(), recursiveTags.begin(), recursiveTags.end());
+ getTagList(*(grammar->sets_list[*iter]), theTags);
}
}
}
else if (theSet.type & ST_TAG_UNIFY) {
const_foreach (uint32Vector, theSet.sets, iter, iter_end) {
- TagList recursiveTags = getTagList(*(grammar->sets_list[*iter]), true);
- theTags.insert(theTags.end(), recursiveTags.begin(), recursiveTags.end());
+ getTagList(*(grammar->sets_list[*iter]), theTags, true);
}
}
else if (!theSet.sets.empty()) {
const_foreach (uint32Vector, theSet.sets, iter, iter_end) {
- TagList recursiveTags = getTagList(*(grammar->sets_list[*iter]), unif_mode);
- theTags.insert(theTags.end(), recursiveTags.begin(), recursiveTags.end());
+ getTagList(*(grammar->sets_list[*iter]), theTags, unif_mode);
}
}
else if (unif_mode) {
@@ -157,7 +159,6 @@ TagList GrammarApplicator::getTagList(const Set& theSet, bool unif_mode) const {
}
}
}
- return theTags;
}
Reading *GrammarApplicator::get_sub_reading(Reading *tr, int sub_reading) {
@@ -800,7 +801,10 @@ uint32_t GrammarApplicator::runRulesOnSingleWindow(SingleWindow& current, const
Tag *wf = 0;
std::vector<TagList> readings;
- const TagList theTags = getTagList(*rule.maplist);
+ static TagList theTags;
+ theTags.clear();
+ getTagList(*rule.maplist, theTags);
+
const_foreach (TagList, theTags, tter, tter_end) {
if ((*tter)->type & T_WORDFORM) {
cCohort->wordform = *tter;
@@ -887,9 +891,13 @@ uint32_t GrammarApplicator::runRulesOnSingleWindow(SingleWindow& current, const
index_ruleCohort_no.clear();
reading.hit_by.push_back(rule.number);
reading.noprint = false;
- TagList mappings;
- TagList theTags = getTagList(*rule.maplist);
- foreach (TagList, theTags, tter, tter_end) {
+ static TagList mappings;
+ mappings.clear();
+ static TagList theTags;
+ theTags.clear();
+ getTagList(*rule.maplist, theTags);
+
+ foreach(TagList, theTags, tter, tter_end) {
uint32_t hash = (*tter)->hash;
while ((*tter)->type & T_VARSTRING) {
*tter = generateVarstringTag(*tter);
@@ -929,8 +937,12 @@ uint32_t GrammarApplicator::runRulesOnSingleWindow(SingleWindow& current, const
reading.tags_list.push_back(cohort->wordform->hash);
reading.tags_list.push_back(reading.baseform);
reflowReading(reading);
- TagList mappings;
- TagList theTags = getTagList(*rule.maplist);
+ static TagList mappings;
+ mappings.clear();
+ static TagList theTags;
+ theTags.clear();
+ getTagList(*rule.maplist, theTags);
+
foreach (TagList, theTags, tter, tter_end) {
uint32_t hash = (*tter)->hash;
while ((*tter)->type & T_VARSTRING) {
@@ -960,7 +972,9 @@ uint32_t GrammarApplicator::runRulesOnSingleWindow(SingleWindow& current, const
size_t tpos = std::numeric_limits<size_t>::max();
size_t tagb = reading.tags_list.size();
- TagList theTags = getTagList(*rule.sublist);
+ static TagList theTags;
+ theTags.clear();
+ getTagList(*rule.sublist, theTags);
// Modify the list of tags to remove to be the actual list of tags present, including matching regex and icase tags
for (TagList::iterator it = theTags.begin() ; it != theTags.end() ; ) {
@@ -1009,8 +1023,12 @@ uint32_t GrammarApplicator::runRulesOnSingleWindow(SingleWindow& current, const
tpos = reading.tags_list.size() - 1;
}
++tpos;
- TagList mappings;
- TagList theTags = getTagList(*rule.maplist);
+ static TagList mappings;
+ mappings.clear();
+ static TagList theTags;
+ theTags.clear();
+ getTagList(*rule.maplist, theTags);
+
const_foreach (TagList, theTags, tter, tter_end) {
Tag *tag = *tter;
if (tag->type & T_VARSTRING) {
@@ -1078,7 +1096,10 @@ uint32_t GrammarApplicator::runRulesOnSingleWindow(SingleWindow& current, const
Tag *bf = 0;
std::vector<TagList> readings;
- const TagList theTags = getTagList(*rule.maplist);
+ static TagList theTags;
+ theTags.clear();
+ getTagList(*rule.maplist, theTags);
+
const_foreach (TagList, theTags, tter, tter_end) {
if ((*tter)->type & T_BASEFORM) {
bf = *tter;
@@ -1146,14 +1167,20 @@ uint32_t GrammarApplicator::runRulesOnSingleWindow(SingleWindow& current, const
if (rule.sublist) {
// ToDo: Use the code from Substitute to make this match and remove special tags
- TagList excepts = getTagList(*rule.sublist);
+ static TagList excepts;
+ excepts.clear();
+ getTagList(*rule.sublist, excepts);
const_foreach (TagList, excepts, tter, tter_end) {
delTagFromReading(*cReading, *tter);
}
}
- TagList mappings;
- TagList theTags = getTagList(*rule.maplist);
+ static TagList mappings;
+ mappings.clear();
+ static TagList theTags;
+ theTags.clear();
+ getTagList(*rule.maplist, theTags);
+
foreach (TagList, theTags, tter, tter_end) {
uint32_t hash = (*tter)->hash;
while ((*tter)->type & T_VARSTRING) {
@@ -1363,7 +1390,9 @@ uint32_t GrammarApplicator::runRulesOnSingleWindow(SingleWindow& current, const
if (good) {
swapper<Cohort*> sw((rule.flags & RF_REVERSE) != 0, attach, cohort);
bool rel_did_anything = false;
- TagList theTags = getTagList(*rule.maplist);
+ static TagList theTags;
+ theTags.clear();
+ getTagList(*rule.maplist, theTags);
const_foreach (TagList, theTags, tter, tter_end) {
if (type == K_ADDRELATION) {
attach->type |= CT_RELATED;
@@ -1410,8 +1439,15 @@ uint32_t GrammarApplicator::runRulesOnSingleWindow(SingleWindow& current, const
if (good) {
swapper<Cohort*> sw((rule.flags & RF_REVERSE) != 0, attach, cohort);
bool rel_did_anything = false;
- TagList sublist = getTagList(*rule.sublist);
- TagList maplist = getTagList(*rule.maplist);
+
+ static TagList sublist;
+ sublist.clear();
+ getTagList(*rule.sublist, sublist);
+
+ static TagList maplist;
+ maplist.clear();
+ getTagList(*rule.maplist, maplist);
+
const_foreach (TagList, maplist, tter, tter_end) {
if (type == K_ADDRELATIONS) {
cohort->type |= CT_RELATED;
diff --git a/src/version.hpp b/src/version.hpp
index 77d07b1..25ec59f 100644
--- a/src/version.hpp
+++ b/src/version.hpp
@@ -30,7 +30,7 @@ const char* const CG3_COPYRIGHT_STRING = "Copyright (C) 2007-2015 GrammarSoft Ap
const uint32_t CG3_VERSION_MAJOR = 0;
const uint32_t CG3_VERSION_MINOR = 9;
const uint32_t CG3_VERSION_PATCH = 9;
-const uint32_t CG3_REVISION = 10822;
+const uint32_t CG3_REVISION = 10824;
const uint32_t CG3_FEATURE_REV = 10575;
const uint32_t CG3_TOO_OLD = 10373;
const uint32_t CG3_EXTERNAL_PROTOCOL = 7226;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/cg3.git
More information about the debian-science-commits
mailing list