You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libreoffice/0001-split-qnametostr-up-to...

209 lines
8.8 KiB

From f1c795baf1268c2650c706fc2aec28c2a7fbaf0e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Fri, 23 Nov 2012 09:42:39 +0000
Subject: [PATCH] split qnametostr up to try and make .o's small enough for
ppc64
i.e. relocation truncated to fix: R_PPC64_TOC16_DS
while I'm at it merge the standalone header/footer files into the .xslt and
simplify the makefile.
Change-Id: Iee0e9b5dd96868f49f1bed22fb5dc6d28c8cef81
---
writerfilter/CustomTarget_source.mk | 16 +++----
writerfilter/Library_writerfilter.mk | 21 ++-------
writerfilter/source/doctok/qnametostr.xsl | 6 +++
writerfilter/source/ooxml/qnametostr.xsl | 8 +++-
.../source/resourcemodel/qnametostrcore.cxx | 52 ++++++++++++++++++++++
writerfilter/source/resourcemodel/qnametostrfooter | 7 ---
writerfilter/source/resourcemodel/qnametostrheader | 48 --------------------
7 files changed, 74 insertions(+), 84 deletions(-)
create mode 100644 writerfilter/source/resourcemodel/qnametostrcore.cxx
delete mode 100644 writerfilter/source/resourcemodel/qnametostrfooter
delete mode 100644 writerfilter/source/resourcemodel/qnametostrheader
diff --git a/writerfilter/CustomTarget_source.mk b/writerfilter/CustomTarget_source.mk
index fc29784..5ee3041 100644
--- a/writerfilter/CustomTarget_source.mk
+++ b/writerfilter/CustomTarget_source.mk
@@ -157,8 +157,8 @@
# resourcemodel
-wf_GEN_model_QNameToStr_cxx=$(writerfilter_WORK)/qnametostr.cxx
-wf_GEN_ooxml_QNameToStr_tmp=$(writerfilter_WORK)/OOXMLqnameToStr.tmp
+wf_GEN_doctok_QNameToStr_cxx=$(writerfilter_WORK)/doctok/qnametostr.cxx
+wf_GEN_ooxml_QNameToStr_cxx=$(writerfilter_WORK)/ooxml/qnametostr.cxx
wf_GEN_model_SprmCodeToStr_cxx=$(writerfilter_WORK)/sprmcodetostr.cxx
wf_GEN_model_SprmCodeToStr_tmp=$(writerfilter_WORK)/sprmcodetostr.tmp
wf_GEN_doctok_QnameToStr_tmp=$(writerfilter_WORK)/DOCTOKqnameToStr.tmp
@@ -170,18 +170,14 @@
wf_DEP_ooxml_namespaces_txt=$(OUTDIR)/inc/oox/namespaces.txt
wf_GEN_ooxml_preprocess_xsl=$(writerfilter_WORK)/modelpreprocess.xsl
-$(wf_GEN_ooxml_QNameToStr_tmp): $(wf_SRC_ooxml_QNameToStr_xsl) $(wf_GEN_ooxml_Model_processed)
+$(wf_GEN_ooxml_QNameToStr_cxx): $(wf_SRC_ooxml_QNameToStr_xsl) $(wf_GEN_ooxml_Model_processed) $(wf_SRC_ooxml_FactoryTools_xsl)
$(call gb_Output_announce,$@,build,XSL,1)
$(call gb_Helper_abbreviate_dirs, $(gb_XSLTPROC) $(wf_SRC_ooxml_QNameToStr_xsl) $(wf_GEN_ooxml_Model_processed)) > $@
-$(wf_GEN_doctok_QnameToStr_tmp): $(wf_SRC_doctok_QNameToStr_xsl) $(wf_SRC_doctok_Model) | $(writerfilter_WORK)/.dir
+$(wf_GEN_doctok_QNameToStr_cxx): $(wf_SRC_doctok_QNameToStr_xsl) $(wf_SRC_doctok_Model) $(wf_SRC_doctok_ResourceTools_xsl) | $(writerfilter_WORK)/.dir
$(call gb_Output_announce,$@,build,XSL,1)
$(call gb_Helper_abbreviate_dirs, $(gb_XSLTPROC) $(wf_SRC_doctok_QNameToStr_xsl) $(wf_SRC_doctok_Model)) > $@
-$(wf_GEN_model_QNameToStr_cxx): $(wf_GEN_ooxml_QNameToStr_tmp) $(wf_GEN_doctok_QnameToStr_tmp) $(writerfilter_SRC)/resourcemodel/qnametostrheader $(writerfilter_SRC)/resourcemodel/qnametostrfooter $(wf_SRC_ooxml_FactoryTools_xsl) $(wf_SRC_doctok_ResourceTools_xsl)
- $(call gb_Output_announce,$@,build,CAT,1)
- cat $(writerfilter_SRC)/resourcemodel/qnametostrheader $(wf_GEN_ooxml_QNameToStr_tmp) $(wf_GEN_doctok_QnameToStr_tmp) $(writerfilter_SRC)/resourcemodel/qnametostrfooter > $@
-
$(wf_GEN_model_SprmCodeToStr_tmp) : $(wf_SRC_doctok_SprmCodeToStr_xsl) $(wf_SRC_doctok_Model) | $(writerfilter_WORK)/.dir
$(call gb_Output_announce,$@,build,XSL,1)
$(call gb_Helper_abbreviate_dirs, $(gb_XSLTPROC) $(wf_SRC_doctok_SprmCodeToStr_xsl) $(wf_SRC_doctok_Model)) > $@
@@ -218,7 +214,8 @@
$(wf_GEN_ooxml_FastTokens_hxx) \
$(wf_GEN_ooxml_GperfFastToken_hxx) \
$(wf_GEN_ooxml_NamespaceIds_hxx) \
- $(wf_GEN_model_QNameToStr_cxx) \
+ $(wf_GEN_doctok_QNameToStr_cxx) \
+ $(wf_GEN_ooxml_QNameToStr_cxx) \
$(wf_GEN_model_SprmCodeToStr_cxx) \
$(patsubst %,$(writerfilter_WORK)/OOXMLFactory_%.hxx,$(WRITERFILTER_OOXMLNAMESPACES)) \
$(patsubst %,$(writerfilter_WORK)/OOXMLFactory_%.cxx,$(WRITERFILTER_OOXMLNAMESPACES)) \
diff --git a/writerfilter/Library_writerfilter.mk b/writerfilter/Library_writerfilter.mk
index 1d7c667..870732f 100644
--- a/writerfilter/Library_writerfilter.mk
+++ b/writerfilter/Library_writerfilter.mk
@@ -170,6 +170,7 @@ $(eval $(call gb_Library_add_exception_objects,writerfilter,\
writerfilter/source/resourcemodel/TagLogger \
writerfilter/source/resourcemodel/WW8Analyzer \
writerfilter/source/resourcemodel/XPathLogger \
+ writerfilter/source/resourcemodel/qnametostrcore \
writerfilter/source/resourcemodel/resourcemodel \
writerfilter/source/resourcemodel/util \
))
@@ -180,24 +181,8 @@ $(eval $(call gb_Library_add_generated_exception_objects,writerfilter,\
CustomTarget/writerfilter/source/OOXMLFactory_generated \
CustomTarget/writerfilter/source/OOXMLFactory_values \
CustomTarget/writerfilter/source/sprmcodetostr \
+ CustomTarget/writerfilter/source/doctok/qnametostr \
+ CustomTarget/writerfilter/source/ooxml/qnametostr \
))
-ifneq ($(COM)-$(OS)-$(CPUNAME),GCC-LINUX-POWERPC64)
-#Apparently some compilers, according to the original .mk this was converted
-#from, require this to be noopt or they fail to compile it, probably good to
-#revisit that and narrow this down to where it's necessary
-$(eval $(call gb_Library_add_generated_cxxobjects,writerfilter,\
- CustomTarget/writerfilter/source/qnametostr \
- , $(gb_COMPILERNOOPTFLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) \
-))
-else
-#Ironically, on RHEL-6 PPC64 with no-opt the output is too large for the
-#toolchain, "Error: operand out of range", but it build fine with
-#normal flags
-$(eval $(call gb_Library_add_generated_cxxobjects,writerfilter,\
- CustomTarget/writerfilter/source/qnametostr \
- , $(gb_LinkTarget_EXCEPTIONFLAGS) \
-))
-endif
-
# vim: set noet sw=4 ts=4:
diff --git a/writerfilter/source/doctok/qnametostr.xsl b/writerfilter/source/doctok/qnametostr.xsl
index a416512..e3009c9 100644
--- a/writerfilter/source/doctok/qnametostr.xsl
+++ b/writerfilter/source/doctok/qnametostr.xsl
@@ -22,8 +22,14 @@
<xsl:include href="resourcetools.xsl"/>
<xsl:template match="/">
+#include "doctok/resourceids.hxx"
+#include "resourcemodel/QNameToString.hxx"
+
+namespace writerfilter
+{
<xsl:apply-templates select=".//UML:Model" mode="qnametostr"/>
<xsl:apply-templates select='.//UML:Model' mode='sprmidstoxml'/>
<xsl:apply-templates select='.//UML:Model' mode='analyzerdoctokids'/>
+}
</xsl:template>
</xsl:stylesheet>
diff --git a/writerfilter/source/ooxml/qnametostr.xsl b/writerfilter/source/ooxml/qnametostr.xsl
index 1dc689f..a7a7d6c 100644
--- a/writerfilter/source/ooxml/qnametostr.xsl
+++ b/writerfilter/source/ooxml/qnametostr.xsl
@@ -113,8 +113,14 @@ void ooxmlidsToXML(::std::ostream &amp; out)
</xsl:template>
<xsl:template match="/">
+#include "ooxml/resourceids.hxx"
+#include "resourcemodel/QNameToString.hxx"
+
+namespace writerfilter
+{
<xsl:call-template name="qnametostr"/>
<xsl:call-template name="ooxmlidstoxml"/>
+}
</xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
diff --git a/writerfilter/source/resourcemodel/qnametostrcore.cxx b/writerfilter/source/resourcemodel/qnametostrcore.cxx
new file mode 100644
index 0000000..81ed0f1
--- /dev/null
+++ b/writerfilter/source/resourcemodel/qnametostrcore.cxx
@@ -0,0 +1,52 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <resourcemodel/QNameToString.hxx>
+
+namespace writerfilter
+{
+
+QNameToString::Pointer_t QNameToString::pInstance;
+
+QNameToString::Pointer_t WRITERFILTER_RESOURCEMODEL_DLLPUBLIC QNameToString::Instance()
+{
+ if (pInstance.get() == NULL)
+ pInstance = QNameToString::Pointer_t(new QNameToString());
+
+ return pInstance;
+}
+
+string WRITERFILTER_RESOURCEMODEL_DLLPUBLIC QNameToString::operator()(Id qName)
+{
+ string sResult;
+
+ Map::const_iterator aIt = mMap.find(qName);
+
+ if (aIt != mMap.end())
+ sResult = aIt->second;
+
+ return mMap[qName];
+}
+
+QNameToString::QNameToString()
+{
+ init_doctok();
+ init_ooxml();
+}
+
+}