writerfilter/CustomTarget_source.mk         |    9 ++-------
 writerfilter/source/ooxml/tokens-to-xml.sed |   19 +++++++++++++++++++
 writerfilter/source/ooxml/tokenxmlfooter    |    1 -
 writerfilter/source/ooxml/tokenxmlheader    |    1 -
 4 files changed, 21 insertions(+), 9 deletions(-)

New commits:
commit d595e5ec4e092344460f53d287b970c147913e99
Author: Jan Holesovsky <ke...@collabora.com>
Date:   Thu Jun 5 08:56:48 2014 +0200

    writerfilter: Avoid a temporary file, sed can handle this by itself.
    
    Change-Id: I7fde1b44809b1886730145f16878e0f1045b2555

diff --git a/writerfilter/CustomTarget_source.mk 
b/writerfilter/CustomTarget_source.mk
index 249ebca..98da398 100644
--- a/writerfilter/CustomTarget_source.mk
+++ b/writerfilter/CustomTarget_source.mk
@@ -70,7 +70,6 @@ 
writerfilter_GEN_ooxml_Namespacesmap_xsl=$(writerfilter_WORK)/namespacesmap.xsl
 writerfilter_GEN_ooxml_Preprocess_xsl=$(writerfilter_WORK)/modelpreprocess.xsl
 writerfilter_GEN_ooxml_QNameToStr_cxx=$(writerfilter_WORK)/ooxml/qnametostr.cxx
 
writerfilter_GEN_ooxml_ResourceIds_hxx=$(writerfilter_WORK)/ooxml/resourceids.hxx
-writerfilter_GEN_ooxml_Token_tmp=$(writerfilter_WORK)/token.tmp
 writerfilter_GEN_ooxml_Token_xml=$(writerfilter_WORK)/token.xml
 
writerfilter_SRC_model_NamespacePreprocess=$(writerfilter_SRC)/resourcemodel/namespace_preprocess.pl
 
writerfilter_SRC_ooxml_Analyze_model_xsl=$(writerfilter_SRC)/ooxml/analyzemodel.xsl
@@ -134,15 +133,11 @@ $(writerfilter_GEN_ooxml_ResourceIds_hxx) : 
$(writerfilter_SRC_ooxml_ResourceIds
        $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,XSL,1)
        $(call gb_Helper_abbreviate_dirs, $(writerfilter_XSLTCOMMAND) 
$(writerfilter_SRC_ooxml_ResourceIds_xsl) 
$(writerfilter_GEN_ooxml_Model_processed)) > $@
 
-$(writerfilter_GEN_ooxml_Token_tmp) : $(SRCDIR)/oox/source/token/tokens.txt | 
$(writerfilter_WORK)/.dir
+$(writerfilter_GEN_ooxml_Token_xml) : $(SRCDIR)/oox/source/token/tokens.txt 
$(writerfilter_SRC)/ooxml/tokens-to-xml.sed | $(writerfilter_WORK)/.dir
        $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,CAT,1)
-       sed "s/\(.*\)/<fasttoken>\1<\/fasttoken>/" \
+       sed -f $(writerfilter_SRC)/ooxml/tokens-to-xml.sed \
                < $(SRCDIR)/oox/source/token/tokens.txt > $@
 
-$(writerfilter_GEN_ooxml_Token_xml) : $(writerfilter_SRC)/ooxml/tokenxmlheader 
$(writerfilter_GEN_ooxml_Token_tmp) $(writerfilter_SRC)/ooxml/tokenxmlfooter
-       $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,CAT,1)
-       cat $(writerfilter_SRC)/ooxml/tokenxmlheader 
$(writerfilter_GEN_ooxml_Token_tmp) $(writerfilter_SRC)/ooxml/tokenxmlfooter > 
$@
-
 $(writerfilter_WORK)/OOXMLFactory%.cxx : 
$(writerfilter_SRC)/ooxml/factoryimpl_ns.xsl 
$(writerfilter_GEN_ooxml_Model_processed)
        $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,XSL,1)
        $(call gb_Helper_abbreviate_dirs, $(writerfilter_XSLTCOMMAND) 
--stringparam file $@ $< $(writerfilter_GEN_ooxml_Model_processed)) > $@
diff --git a/writerfilter/source/ooxml/tokens-to-xml.sed 
b/writerfilter/source/ooxml/tokens-to-xml.sed
new file mode 100755
index 0000000..a45bc6a
--- /dev/null
+++ b/writerfilter/source/ooxml/tokens-to-xml.sed
@@ -0,0 +1,19 @@
+#! /usr/bin/sed -f
+#
+# 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/.
+#
+
+# first line - insert <model>
+1,1i\
+<model>
+
+# last line - append </model>
+$,$a\
+</model>
+
+# everywhere - replace the input line with <fasttoken>...</fasttoken>
+s/\(.*\)/<fasttoken>\1<\/fasttoken>/
diff --git a/writerfilter/source/ooxml/tokenxmlfooter 
b/writerfilter/source/ooxml/tokenxmlfooter
deleted file mode 100644
index 6f66407..0000000
--- a/writerfilter/source/ooxml/tokenxmlfooter
+++ /dev/null
@@ -1 +0,0 @@
-</model>
diff --git a/writerfilter/source/ooxml/tokenxmlheader 
b/writerfilter/source/ooxml/tokenxmlheader
deleted file mode 100644
index 25a9243..0000000
--- a/writerfilter/source/ooxml/tokenxmlheader
+++ /dev/null
@@ -1 +0,0 @@
-<model>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to