[Libreoffice-commits] .: 11 commits - filter/source hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk hwpfilter/inc hwpfilter/Library_hwp.mk hwpfilter/Makefile hwpfilter/Module_hwpfilter.mk hwpfilter/prj hwpfilter/qa hwpfilter/source lotuswordpro/source writerperfect/source
Caolán McNamara
caolan at kemper.freedesktop.org
Tue Jun 14 01:58:32 PDT 2011
filter/source/config/fragments/types/writer_MIZI_Hwp_97.xcu | 4
hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk | 84
hwpfilter/Library_hwp.mk | 98
hwpfilter/Makefile | 38
hwpfilter/Module_hwpfilter.mk | 38
hwpfilter/inc/makefile.mk | 47
hwpfilter/prj/build.lst | 7
hwpfilter/prj/d.lst | 5
hwpfilter/prj/makefile.mk | 40
hwpfilter/qa/cppunit/data/fail/BK.hwp |binary
hwpfilter/qa/cppunit/data/pass/hangul97-3.0.hwp |binary
hwpfilter/qa/cppunit/test_hwpfilter.cxx | 171
hwpfilter/source/cspline.cpp | 176
hwpfilter/source/cspline.cxx | 176
hwpfilter/source/fontmap.cpp | 177
hwpfilter/source/fontmap.cxx | 177
hwpfilter/source/formula.cpp | 689 ---
hwpfilter/source/formula.cxx | 689 +++
hwpfilter/source/formula.h | 24
hwpfilter/source/grammar.cpp | 1456 -------
hwpfilter/source/grammar.cxx | 1456 +++++++
hwpfilter/source/hbox.cpp | 715 ---
hwpfilter/source/hbox.cxx | 715 +++
hwpfilter/source/hcode.cpp | 1525 -------
hwpfilter/source/hcode.cxx | 1525 +++++++
hwpfilter/source/hfont.cpp | 108
hwpfilter/source/hfont.cxx | 108
hwpfilter/source/hgzip.cpp | 340 -
hwpfilter/source/hgzip.cxx | 340 +
hwpfilter/source/himgutil.cpp | 172
hwpfilter/source/himgutil.cxx | 172
hwpfilter/source/hinfo.cpp | 208 -
hwpfilter/source/hinfo.cxx | 208 +
hwpfilter/source/hiodev.cpp | 366 -
hwpfilter/source/hiodev.cxx | 366 +
hwpfilter/source/hpara.cpp | 318 -
hwpfilter/source/hpara.cxx | 318 +
hwpfilter/source/hstream.cpp | 83
hwpfilter/source/hstream.cxx | 83
hwpfilter/source/hstyle.cpp | 154
hwpfilter/source/hstyle.cxx | 154
hwpfilter/source/htags.cpp | 167
hwpfilter/source/htags.cxx | 167
hwpfilter/source/hutil.cpp | 102
hwpfilter/source/hutil.cxx | 102
hwpfilter/source/hwp.component | 1
hwpfilter/source/hwpeq.cpp | 754 ---
hwpfilter/source/hwpeq.cxx | 754 +++
hwpfilter/source/hwpfile.cpp | 673 ---
hwpfilter/source/hwpfile.cxx | 658 +++
hwpfilter/source/hwpfile.h | 16
hwpfilter/source/hwpread.cpp | 814 ----
hwpfilter/source/hwpread.cxx | 814 ++++
hwpfilter/source/hwpreader.cxx | 83
hwpfilter/source/hwpreader.hxx | 141
hwpfilter/source/lexer.cpp | 2364 ------------
hwpfilter/source/lexer.cxx | 2364 ++++++++++++
hwpfilter/source/list.hxx | 8
hwpfilter/source/makefile.mk | 102
hwpfilter/source/mzstring.cpp | 312 -
hwpfilter/source/mzstring.cxx | 312 +
hwpfilter/source/solver.cpp | 187
hwpfilter/source/solver.cxx | 187
lotuswordpro/source/filter/LotusWordProImportFilter.cxx | 7
writerperfect/source/wpdimp/WordPerfectImportFilter.cxx | 2
writerperfect/source/wpgimp/WPGImportFilter.cxx | 2
writerperfect/source/wpsimp/MSWorksImportFilter.cxx | 2
67 files changed, 12441 insertions(+), 12184 deletions(-)
New commits:
commit b8cf210d359c08211cc1e41e02e3c601727e3cd8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 14 00:56:56 2011 +0100
add regression test
diff --git a/hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk b/hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk
new file mode 100644
index 0000000..0f7ea41
--- /dev/null
+++ b/hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk
@@ -0,0 +1,84 @@
+#*************************************************************************
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+# Bjoern Michaelsen, Canonical Ltd. <bjoern.michaelsen at canonical.com>
+# Portions created by the Initial Developer are Copyright (C) 2010 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+# Caolán McNamara, Red Hat, Inc. <caolanm at redhat.com>
+# David Tardon, Red Hat Inc. <dtardon at redhat.com>
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,hwpfilter_test_hwpfilter))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,hwpfilter_test_hwpfilter, \
+ hwpfilter/qa/cppunit/test_hwpfilter \
+))
+
+$(eval $(call gb_CppunitTest_add_linked_libs,hwpfilter_test_hwpfilter, \
+ ucbhelper \
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ vcl \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,hwpfilter_test_hwpfilter,\
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc/offuh \
+ -I$(OUTDIR)/inc \
+))
+
+$(eval $(call gb_CppunitTest_uses_ure,hwpfilter_test_hwpfilter))
+
+$(eval $(call gb_CppunitTest_add_type_rdbs,hwpfilter_test_hwpfilter,\
+ types \
+))
+
+$(eval $(call gb_CppunitTest_add_service_rdbs,hwpfilter_test_hwpfilter,\
+ hwpfilter_test_hwpfilter \
+))
+
+$(eval $(call gb_CppunitTest_set_args,hwpfilter_test_hwpfilter,\
+ --headless \
+ --invisible \
+))
+
+$(eval $(call gb_RdbTarget_RdbTarget,hwpfilter_test_hwpfilter))
+
+$(eval $(call gb_RdbTarget_add_components,hwpfilter_test_hwpfilter,\
+ hwpfilter/source/hwp,\
+))
+
+$(eval $(call gb_RdbTarget_add_old_components,hwpfilter_test_hwpfilter,\
+ ucb1 \
+ ucpfile1 \
+))
+
+# we need to explicitly depend on library hwp because it is not implied
+# by a link relation
+$(call gb_CppunitTest_get_target,hwpfilter_test_hwpfilter) : $(call gb_Library_get_target,hwp)
+
+# vim: set noet sw=4:
diff --git a/hwpfilter/Module_hwpfilter.mk b/hwpfilter/Module_hwpfilter.mk
index b4e5530..9985b7e 100644
--- a/hwpfilter/Module_hwpfilter.mk
+++ b/hwpfilter/Module_hwpfilter.mk
@@ -31,4 +31,8 @@ $(eval $(call gb_Module_add_targets,hwpfilter,\
Library_hwp \
))
+$(eval $(call gb_Module_add_check_targets,hwpfilter,\
+ CppunitTest_hwpfilter_test_hwpfilter \
+))
+
# vim: set noet ts=4 sw=4:
diff --git a/hwpfilter/prj/build.lst b/hwpfilter/prj/build.lst
index f17ca9d..3fa47f7 100644
--- a/hwpfilter/prj/build.lst
+++ b/hwpfilter/prj/build.lst
@@ -1,2 +1,2 @@
-hw hwpfilter : offuh cppuhelper ZLIB:zlib LIBXSLT:libxslt ure NULL
+hw hwpfilter : offuh cppuhelper ZLIB:zlib LIBXSLT:libxslt ucbhelper ucb ure NULL
hw hwpfilter\prj nmake - all hw_prj NULL
diff --git a/hwpfilter/qa/cppunit/data/fail/.gitignore b/hwpfilter/qa/cppunit/data/fail/.gitignore
deleted file mode 100644
index e69de29..0000000
diff --git a/hwpfilter/qa/cppunit/test_hwpfilter.cxx b/hwpfilter/qa/cppunit/test_hwpfilter.cxx
new file mode 100644
index 0000000..56c887f
--- /dev/null
+++ b/hwpfilter/qa/cppunit/test_hwpfilter.cxx
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Caolán McNamara <caolanm at redhat.com> (Red Hat, Inc.)
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Caolán McNamara <caolanm at redhat.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <sal/cppunit.h>
+
+#include <cppuhelper/bootstrap.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+
+#include <osl/file.hxx>
+#include <osl/process.h>
+#include <osl/thread.h>
+
+#include <ucbhelper/contentbroker.hxx>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+ class HwpFilterTest : public ::CppUnit::TestFixture
+ {
+ public:
+ HwpFilterTest();
+ ~HwpFilterTest();
+
+ virtual void setUp();
+ virtual void tearDown();
+
+ void recursiveScan(const rtl::OUString &rURL, bool bExpected);
+ bool load(const rtl::OUString &rURL);
+ void test();
+
+ CPPUNIT_TEST_SUITE(HwpFilterTest);
+ CPPUNIT_TEST(test);
+ CPPUNIT_TEST_SUITE_END();
+ private:
+ uno::Reference<uno::XComponentContext> m_xContext;
+ uno::Reference<lang::XMultiComponentFactory> m_xFactory;
+ uno::Reference<lang::XMultiServiceFactory> m_xMSF;
+ uno::Reference<document::XFilter> m_xFilter;
+
+ ::rtl::OUString m_aSrcRoot;
+ int m_nLoadedDocs;
+ };
+
+ HwpFilterTest::HwpFilterTest() : m_aSrcRoot( RTL_CONSTASCII_USTRINGPARAM( "file://" ) ), m_nLoadedDocs(0)
+ {
+ m_xContext = cppu::defaultBootstrap_InitialComponentContext();
+ m_xFactory = m_xContext->getServiceManager();
+ m_xMSF = uno::Reference<lang::XMultiServiceFactory>(m_xFactory, uno::UNO_QUERY_THROW);
+ m_xFilter = uno::Reference< document::XFilter >(m_xMSF->createInstance(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.comp.hwpimport.HwpImportFilter"))),
+ uno::UNO_QUERY_THROW);
+
+ const char* pSrcRoot = getenv( "SRC_ROOT" );
+ CPPUNIT_ASSERT_MESSAGE("SRC_ROOT env variable not set", pSrcRoot != NULL && pSrcRoot[0] != 0);
+
+#ifdef WNT
+ if (pSrcRoot[1] == ':')
+ m_aSrcRoot += rtl::OUString::createFromAscii( "/" );
+#endif
+ m_aSrcRoot += rtl::OUString::createFromAscii( pSrcRoot );
+
+ //Without this we're crashing because callees are using
+ //getProcessServiceFactory. In general those should be removed in favour
+ //of retaining references to the root ServiceFactory as its passed around
+ comphelper::setProcessServiceFactory(m_xMSF);
+
+ // initialise UCB-Broker
+ uno::Sequence<uno::Any> aUcbInitSequence(2);
+ aUcbInitSequence[0] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Local"));
+ aUcbInitSequence[1] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office"));
+ bool bInitUcb = ucbhelper::ContentBroker::initialize(m_xMSF, aUcbInitSequence);
+ CPPUNIT_ASSERT_MESSAGE("Should be able to initialize UCB", bInitUcb);
+
+ uno::Reference<ucb::XContentProviderManager> xUcb =
+ ucbhelper::ContentBroker::get()->getContentProviderManagerInterface();
+ uno::Reference<ucb::XContentProvider> xFileProvider(m_xMSF->createInstance(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.FileContentProvider"))), uno::UNO_QUERY);
+ xUcb->registerContentProvider(xFileProvider, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file")), sal_True);
+ }
+
+ HwpFilterTest::~HwpFilterTest()
+ {
+ }
+
+ void HwpFilterTest::setUp()
+ {
+ }
+
+ void HwpFilterTest::tearDown()
+ {
+ }
+
+ bool HwpFilterTest::load(const rtl::OUString &rURL)
+ {
+ uno::Sequence< beans::PropertyValue > aDescriptor(1);
+ aDescriptor[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"));
+ aDescriptor[0].Value <<= rURL;
+ sal_Bool bRet = m_xFilter->filter(aDescriptor);
+
+ ++m_nLoadedDocs;
+
+ return bRet;
+ }
+
+ void HwpFilterTest::recursiveScan(const rtl::OUString &rURL, bool bExpected)
+ {
+ osl::Directory aDir(rURL);
+
+ CPPUNIT_ASSERT(osl::FileBase::E_None == aDir.open());
+ osl::DirectoryItem aItem;
+ osl::FileStatus aFileStatus(osl_FileStatus_Mask_FileURL|osl_FileStatus_Mask_Type);
+ while (aDir.getNextItem(aItem) == osl::FileBase::E_None)
+ {
+ aItem.getFileStatus(aFileStatus);
+ rtl::OUString sURL = aFileStatus.getFileURL();
+ if (aFileStatus.getFileType() == osl::FileStatus::Directory)
+ recursiveScan(sURL, bExpected);
+ else
+ {
+ bool bRes = load(sURL);
+ rtl::OString aRes(rtl::OUStringToOString(sURL, osl_getThreadTextEncoding()));
+ CPPUNIT_ASSERT_MESSAGE(aRes.getStr(), bRes == bExpected);
+ }
+ }
+ CPPUNIT_ASSERT(osl::FileBase::E_None == aDir.close());
+ }
+
+ void HwpFilterTest::test()
+ {
+ recursiveScan(m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/filters/hwpfilter/qa/cppunit/data/pass")), true);
+ recursiveScan(m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/filters/hwpfilter/qa/cppunit/data/fail/")), false);
+
+ printf("HwpFilter: tested %d files\n", m_nLoadedDocs);
+ }
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(HwpFilterTest);
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 7f58ea3b8bff713caec0f89a43f68b74f869ffb0
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 14 00:56:22 2011 +0100
return the correct return code
diff --git a/hwpfilter/source/hwpreader.hxx b/hwpfilter/source/hwpreader.hxx
index 5bb6469..91db601 100644
--- a/hwpfilter/source/hwpreader.hxx
+++ b/hwpfilter/source/hwpreader.hxx
@@ -264,10 +264,8 @@ HwpImportFilter::~HwpImportFilter()
sal_Bool HwpImportFilter::filter( const Sequence< PropertyValue >& aDescriptor )
throw( RuntimeException )
{
- // delegate to IchitaroImpoter
- rFilter->filter( aDescriptor );
-
- return sal_True;
+ // delegate to IchitaroImpoter
+ return rFilter->filter( aDescriptor );
}
void HwpImportFilter::cancel() throw(::com::sun::star::uno::RuntimeException)
commit 3dfb3945531d8edb6a829ae344472b39f0eb9f20
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 14 00:32:25 2011 +0100
ditch MyDataSink and use comphelper::MediaDescriptor::addInputStream
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx
index a179a5f..177a6df 100644
--- a/hwpfilter/source/hwpreader.cxx
+++ b/hwpfilter/source/hwpreader.cxx
@@ -134,51 +134,23 @@ HwpReader::~HwpReader()
}
-sal_Bool HwpReader::filter(const Sequence< PropertyValue >& aDescriptor) throw(RuntimeException)
+sal_Bool HwpReader::filter(const Sequence< PropertyValue >& rDescriptor) throw(RuntimeException)
{
- Reference< XInputStream> rInputStream;
- for ( sal_Int32 i = 0; i < aDescriptor.getLength(); i++ )
- {
- if ( aDescriptor[i].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream")) )
- {
- aDescriptor[i].Value >>= rInputStream;
- break;
- }
- else if ( aDescriptor[i].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("URL")) )
- {
- OUString sURL;
- aDescriptor[i].Value >>= sURL;
-
- Reference< XContentIdentifierFactory > xIdFactory( rUCB, UNO_QUERY );
- Reference< XContentProvider > xProvider( rUCB, UNO_QUERY );
- Reference< XContentIdentifier > xId = xIdFactory->createContentIdentifier( sURL );
- Reference< XContent > xContent = xProvider->queryContent( xId );
- MyDataSink * pSink = new MyDataSink();
- OpenCommandArgument2 aArgument;
- aArgument.Sink = Reference< XInterface > ((OWeakObject *)pSink);
- aArgument.Mode = OpenMode::DOCUMENT;
- Command aCommand;
- aCommand.Name = OUString( RTL_CONSTASCII_USTRINGPARAM("open"));
- aCommand.Handle = -1;
- aCommand.Argument <<= aArgument;
- Reference< XCommandProcessor > xCmdProcessor( xContent, UNO_QUERY );
- xCmdProcessor->execute( aCommand, 0, Reference< XCommandEnvironment > () );
-
- rInputStream = pSink->getInputStream();
+ comphelper::MediaDescriptor aDescriptor(rDescriptor);
+ aDescriptor.addInputStream();
- break;
- }
- }
+ Reference< XInputStream > xInputStream(
+ aDescriptor[comphelper::MediaDescriptor::PROP_INPUTSTREAM()], UNO_QUERY_THROW);
HStream stream;
Sequence < sal_Int8 > aBuffer;
sal_Int32 nRead, nBlock = 32768, nTotal = 0;
while( 1 )
{
- nRead = rInputStream.get()->readBytes(aBuffer, nBlock);
+ nRead = xInputStream->readBytes(aBuffer, nBlock);
if( nRead == 0 )
break;
- stream.addData( (byte *)aBuffer.getConstArray(), nRead );
+ stream.addData( (const byte *)aBuffer.getConstArray(), nRead );
nTotal += nRead;
}
diff --git a/hwpfilter/source/hwpreader.hxx b/hwpfilter/source/hwpreader.hxx
index 543c7ed..5bb6469 100644
--- a/hwpfilter/source/hwpreader.hxx
+++ b/hwpfilter/source/hwpreader.hxx
@@ -84,44 +84,11 @@ using namespace ::com::sun::star::document;
#include "drawdef.h"
#include "attributes.hxx"
-
#define IMPLEMENTATION_NAME "com.sun.comp.hwpimport.HwpImportFilter"
#define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
#define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection"
#define WRITER_IMPORTER_NAME "com.sun.star.comp.Writer.XMLImporter"
-class MyDataSink : public ::cppu::WeakImplHelper2< XActiveDataControl, XActiveDataSink >
-{
- Reference < XInputStream > m_xInputStream;
-public:
-
- // XActiveDataControl.
- virtual void SAL_CALL addListener ( const Reference<XStreamListener> &)
- throw(RuntimeException) {}
- virtual void SAL_CALL removeListener ( const Reference<XStreamListener> &)
- throw(RuntimeException) {}
- virtual void SAL_CALL start (void) throw(RuntimeException) {}
- virtual void SAL_CALL terminate (void) throw(RuntimeException) {}
-
- // XActiveDataSink.
- virtual void SAL_CALL setInputStream ( const Reference<XInputStream> &rxInputStream)
- throw(RuntimeException);
- virtual Reference<XInputStream> SAL_CALL getInputStream (void)
- throw(RuntimeException);
-};
-
-void SAL_CALL MyDataSink::setInputStream ( const Reference<XInputStream> &rxInputStream)
- throw(RuntimeException )
-{
- m_xInputStream = rxInputStream;
-}
-
-Reference < XInputStream > SAL_CALL MyDataSink::getInputStream (void)
- throw(RuntimeException)
-{
- return m_xInputStream;
-}
-
struct HwpReaderPrivate;
/**
* This class implements the external Parser interface
commit 4e65328bce1d7a3c9dff5ca32df5aaf470572f8a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jun 13 23:20:18 2011 +0100
gbuildize hwpfilter
diff --git a/hwpfilter/Library_hwp.mk b/hwpfilter/Library_hwp.mk
new file mode 100644
index 0000000..321d4be
--- /dev/null
+++ b/hwpfilter/Library_hwp.mk
@@ -0,0 +1,98 @@
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+# Caolán McNamara, Red Hat, Inc. <caolanm at redhat.com>
+# Portions created by the Initial Developer are Copyright (C) 2011 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+$(eval $(call gb_Library_Library,hwp))
+
+$(eval $(call gb_Library_add_precompiled_header,hwp,$(SRCDIR)/hwpfilter/inc/pch/precompiled_hwpfilter))
+
+$(eval $(call gb_Library_set_include,hwp,\
+ $$(INCLUDE) \
+ -I$(realpath $(SRCDIR)/hwpfilter/inc/pch) \
+ -I$(OUTDIR)/inc/offuh \
+))
+
+$(eval $(call gb_Library_add_linked_libs,hwp,\
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ $(gb_STDLIBS) \
+))
+
+ifeq ($(SYSTEM_ZLIB),YES)
+$(eval $(call gb_Library_set_cxxflags,hwp,\
+ $$(CXXFLAGS) \
+ -DSYSTEM_ZLIB \
+))
+$(eval $(call gb_Library_add_linked_libs,hwp,\
+ z \
+))
+else
+$(eval $(call gb_Library_add_linked_static_libs,hwp,\
+ zlib \
+))
+endif
+
+ifeq ($(OS),WNT)
+
+$(eval $(call gb_Library_add_linked_libs,hwp,\
+ ole32 \
+ uuid \
+))
+
+endif
+
+$(eval $(call gb_Library_set_componentfile,hwp,hwpfilter/source/hwp))
+
+$(eval $(call gb_Library_add_exception_objects,hwp,\
+ hwpfilter/source/attributes \
+ hwpfilter/source/cspline \
+ hwpfilter/source/fontmap \
+ hwpfilter/source/formula \
+ hwpfilter/source/grammar \
+ hwpfilter/source/hbox \
+ hwpfilter/source/hcode \
+ hwpfilter/source/hfont \
+ hwpfilter/source/hgzip \
+ hwpfilter/source/himgutil \
+ hwpfilter/source/hinfo \
+ hwpfilter/source/hiodev \
+ hwpfilter/source/hpara \
+ hwpfilter/source/hstream \
+ hwpfilter/source/hstyle \
+ hwpfilter/source/htags \
+ hwpfilter/source/hutil \
+ hwpfilter/source/hwpeq \
+ hwpfilter/source/hwpfile \
+ hwpfilter/source/hwpread \
+ hwpfilter/source/hwpreader \
+ hwpfilter/source/lexer \
+ hwpfilter/source/mzstring \
+ hwpfilter/source/solver \
+))
+
+# vim: set noet ts=4 sw=4:
diff --git a/hwpfilter/Makefile b/hwpfilter/Makefile
new file mode 100644
index 0000000..a79aff8
--- /dev/null
+++ b/hwpfilter/Makefile
@@ -0,0 +1,38 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+ifeq ($(strip $(SOLARENV)),)
+$(error No environment set!)
+endif
+
+gb_PARTIALBUILD := T
+GBUILDDIR := $(SOLARENV)/gbuild
+include $(GBUILDDIR)/gbuild.mk
+
+$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/Module*.mk)))
+
+# vim: set noet sw=4 ts=4:
diff --git a/hwpfilter/Module_hwpfilter.mk b/hwpfilter/Module_hwpfilter.mk
new file mode 100644
index 0000000..b4e5530
--- /dev/null
+++ b/hwpfilter/Module_hwpfilter.mk
@@ -0,0 +1,34 @@
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+# Caolán McNamara, Red Hat, Inc. <caolanm at redhat.com>
+# Portions created by the Initial Developer are Copyright (C) 2011 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+$(eval $(call gb_Module_Module,hwpfilter))
+
+$(eval $(call gb_Module_add_targets,hwpfilter,\
+ Library_hwp \
+))
+
+# vim: set noet ts=4 sw=4:
diff --git a/hwpfilter/inc/makefile.mk b/hwpfilter/inc/makefile.mk
deleted file mode 100644
index 12bc002..0000000
--- a/hwpfilter/inc/makefile.mk
+++ /dev/null
@@ -1,47 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org 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 version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-PRJ=..
-
-PRJNAME=hwpfilter
-TARGET=inc
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-# --- Files --------------------------------------------------------
-# --- Targets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
-.IF "$(ENABLE_PCH)"!=""
-ALLTAR : \
- $(SLO)$/precompiled.pch \
- $(SLO)$/precompiled_ex.pch
-
-.ENDIF # "$(ENABLE_PCH)"!=""
-
diff --git a/hwpfilter/prj/build.lst b/hwpfilter/prj/build.lst
index 5124045..f17ca9d 100644
--- a/hwpfilter/prj/build.lst
+++ b/hwpfilter/prj/build.lst
@@ -1,5 +1,2 @@
-hw hwpfilter : offuh cppuhelper ZLIB:zlib LIBXSLT:libxslt NULL
-hw hwpfilter usr1 - all hw_mkout NULL
-hw hwpfilter\prj get - all hw_prj NULL
-hw hwpfilter\inc nmake - all hw_inc NULL
-hw hwpfilter\source nmake - all hw_source hw_inc NULL
+hw hwpfilter : offuh cppuhelper ZLIB:zlib LIBXSLT:libxslt ure NULL
+hw hwpfilter\prj nmake - all hw_prj NULL
diff --git a/hwpfilter/prj/d.lst b/hwpfilter/prj/d.lst
index 24f09e9..e69de29 100644
--- a/hwpfilter/prj/d.lst
+++ b/hwpfilter/prj/d.lst
@@ -1,5 +0,0 @@
-..\%__SRC%\bin\hwp.dll %_DEST%\bin\hwp.dll
-..\%__SRC%\lib\ihwp*.lib %_DEST%\bin\ihwp*.lib
-..\%__SRC%\lib\libhwp.so %_DEST%\lib\libhwp.so
-..\%__SRC%\lib\*.dylib %_DEST%\lib\*.dylib
-..\%__SRC%\misc\hwp.component %_DEST%\xml\hwp.component
diff --git a/hwpfilter/prj/makefile.mk b/hwpfilter/prj/makefile.mk
new file mode 100755
index 0000000..e312a7c
--- /dev/null
+++ b/hwpfilter/prj/makefile.mk
@@ -0,0 +1,40 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..
+TARGET=prj
+
+.INCLUDE : settings.mk
+
+.IF "$(VERBOSE)"!=""
+VERBOSEFLAG :=
+.ELSE
+VERBOSEFLAG := -s
+.ENDIF
+
+all:
+ cd $(PRJ) && $(GNUMAKE) $(VERBOSEFLAG) -r -j$(MAXPROCESS) $(gb_MAKETARGET) && $(GNUMAKE) $(VERBOSEFLAG) -r deliverlog
diff --git a/hwpfilter/source/cspline.cpp b/hwpfilter/source/cspline.cpp
deleted file mode 100644
index 07eecbd..0000000
--- a/hwpfilter/source/cspline.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// Natural, Clamped, or Periodic Cubic Splines
-//
-// Input: A list of N+1 points (x_i,a_i), 0 <= i <= N, which are sampled
-// from a function, a_i = f(x_i). The function f is unknown. Boundary
-// conditions are
-// (1) Natural splines: f"(x_0) = f"(x_N) = 0
-// (2) Clamped splines: f'(x_0) and f'(x_N) are user-specified.
-// (3) Periodic splines: f(x_0) = f(x_N) [in which case a_N = a_0 is
-// required in the input], f'(x_0) = f'(x_N), and f"(x_0) = f"(x_N).
-//
-// Output: b_i, c_i, d_i, 0 <= i <= N-1, which are coefficients for the cubic
-// spline S_i(x) = a_i + b_i(x-x_i) + c_i(x-x_i)^2 + d_i(x-x_i)^3 for
-// x_i <= x < x_{i+1}.
-//
-// The natural and clamped algorithms were implemented from
-//
-// Numerical Analysis, 3rd edition
-// Richard L. Burden and J. Douglas Faires
-// Prindle, Weber & Schmidt
-// Boston, 1985, pp. 122-124.
-//
-// The algorithm sets up a tridiagonal linear system of equations in the
-// c_i values. This can be solved in O(N) time.
-//
-// The periodic spline algorithm was implemented from my own derivation. The
-// linear system of equations is not tridiagonal. For now I use a standard
-// linear solver that does not take advantage of the sparseness of the
-// matrix. Therefore for very large N, you may have to worry about memory
-// usage.
-
-#include "solver.h"
-//-----------------------------------------------------------------------------
-void NaturalSpline (int N, double* x, double* a, double*& b, double*& c,
- double*& d)
-{
- const double oneThird = 1.0/3.0;
-
- int i;
- double* h = new double[N];
- double* hdiff = new double[N];
- double* alpha = new double[N];
-
- for (i = 0; i < N; i++){
- h[i] = x[i+1]-x[i];
- }
-
- for (i = 1; i < N; i++)
- hdiff[i] = x[i+1]-x[i-1];
-
- for (i = 1; i < N; i++)
- {
- double numer = 3.0*(a[i+1]*h[i-1]-a[i]*hdiff[i]+a[i-1]*h[i]);
- double denom = h[i-1]*h[i];
- alpha[i] = numer/denom;
- }
-
- double* ell = new double[N+1];
- double* mu = new double[N];
- double* z = new double[N+1];
- double recip;
-
- ell[0] = 1.0;
- mu[0] = 0.0;
- z[0] = 0.0;
-
- for (i = 1; i < N; i++)
- {
- ell[i] = 2.0*hdiff[i]-h[i-1]*mu[i-1];
- recip = 1.0/ell[i];
- mu[i] = recip*h[i];
- z[i] = recip*(alpha[i]-h[i-1]*z[i-1]);
- }
- ell[N] = 1.0;
- z[N] = 0.0;
-
- b = new double[N];
- c = new double[N+1];
- d = new double[N];
-
- c[N] = 0.0;
-
- for (i = N-1; i >= 0; i--)
- {
- c[i] = z[i]-mu[i]*c[i+1];
- recip = 1.0/h[i];
- b[i] = recip*(a[i+1]-a[i])-h[i]*(c[i+1]+2.0*c[i])*oneThird;
- d[i] = oneThird*recip*(c[i+1]-c[i]);
- }
-
- delete[] h;
- delete[] hdiff;
- delete[] alpha;
- delete[] ell;
- delete[] mu;
- delete[] z;
-}
-
-void PeriodicSpline (int N, double* x, double* a, double*& b, double*& c,
- double*& d)
-{
- double* h = new double[N];
- int i;
- for (i = 0; i < N; i++)
- h[i] = x[i+1]-x[i];
-
- mgcLinearSystemD sys;
- double** mat = sys.NewMatrix(N+1); // guaranteed to be zeroed memory
- c = sys.NewVector(N+1); // guaranteed to be zeroed memory
-
- // c[0] - c[N] = 0
- mat[0][0] = +1.0f;
- mat[0][N] = -1.0f;
-
- // h[i-1]*c[i-1]+2*(h[i-1]+h[i])*c[i]+h[i]*c[i+1] =
- // 3*{(a[i+1]-a[i])/h[i] - (a[i]-a[i-1])/h[i-1]}
- for (i = 1; i <= N-1; i++)
- {
- mat[i][i-1] = h[i-1];
- mat[i][i ] = 2.0f*(h[i-1]+h[i]);
- mat[i][i+1] = h[i];
- c[i] = 3.0f*((a[i+1]-a[i])/h[i] - (a[i]-a[i-1])/h[i-1]);
- }
-
- // "wrap around equation" for periodicity
- // h[N-1]*c[N-1]+2*(h[N-1]+h[0])*c[0]+h[0]*c[1] =
- // 3*{(a[1]-a[0])/h[0] - (a[0]-a[N-1])/h[N-1]}
- mat[N][N-1] = h[N-1];
- mat[N][0 ] = 2.0f*(h[N-1]+h[0]);
- mat[N][1 ] = h[0];
- c[N] = 3.0f*((a[1]-a[0])/h[0] - (a[0]-a[N-1])/h[N-1]);
-
- // solve for c[0] through c[N]
- sys.Solve(N+1,mat,c);
-
- const double oneThird = 1.0/3.0;
- b = new double[N];
- d = new double[N];
- for (i = 0; i < N; i++)
- {
- b[i] = (a[i+1]-a[i])/h[i] - oneThird*(c[i+1]+2.0f*c[i])*h[i];
- d[i] = oneThird*(c[i+1]-c[i])/h[i];
- }
-
- delete[] h;
- sys.DeleteMatrix(N+1,mat);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/hwpfilter/source/cspline.cxx b/hwpfilter/source/cspline.cxx
new file mode 100644
index 0000000..8493ff3
--- /dev/null
+++ b/hwpfilter/source/cspline.cxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// Natural, Clamped, or Periodic Cubic Splines
+//
+// Input: A list of N+1 points (x_i,a_i), 0 <= i <= N, which are sampled
+// from a function, a_i = f(x_i). The function f is unknown. Boundary
+// conditions are
+// (1) Natural splines: f"(x_0) = f"(x_N) = 0
+// (2) Clamped splines: f'(x_0) and f'(x_N) are user-specified.
+// (3) Periodic splines: f(x_0) = f(x_N) [in which case a_N = a_0 is
+// required in the input], f'(x_0) = f'(x_N), and f"(x_0) = f"(x_N).
+//
+// Output: b_i, c_i, d_i, 0 <= i <= N-1, which are coefficients for the cubic
+// spline S_i(x) = a_i + b_i(x-x_i) + c_i(x-x_i)^2 + d_i(x-x_i)^3 for
+// x_i <= x < x_{i+1}.
+//
+// The natural and clamped algorithms were implemented from
+//
+// Numerical Analysis, 3rd edition
+// Richard L. Burden and J. Douglas Faires
+// Prindle, Weber & Schmidt
+// Boston, 1985, pp. 122-124.
+//
+// The algorithm sets up a tridiagonal linear system of equations in the
+// c_i values. This can be solved in O(N) time.
+//
+// The periodic spline algorithm was implemented from my own derivation. The
+// linear system of equations is not tridiagonal. For now I use a standard
+// linear solver that does not take advantage of the sparseness of the
+// matrix. Therefore for very large N, you may have to worry about memory
+// usage.
+
+#include "solver.h"
+//-----------------------------------------------------------------------------
+void NaturalSpline (int N, double* x, double* a, double*& b, double*& c,
+ double*& d)
+{
+ const double oneThird = 1.0/3.0;
+
+ int i;
+ double* h = new double[N];
+ double* hdiff = new double[N];
+ double* alpha = new double[N];
+
+ for (i = 0; i < N; i++){
+ h[i] = x[i+1]-x[i];
+ }
+
+ for (i = 1; i < N; i++)
+ hdiff[i] = x[i+1]-x[i-1];
+
+ for (i = 1; i < N; i++)
+ {
+ double numer = 3.0*(a[i+1]*h[i-1]-a[i]*hdiff[i]+a[i-1]*h[i]);
+ double denom = h[i-1]*h[i];
+ alpha[i] = numer/denom;
+ }
+
+ double* ell = new double[N+1];
+ double* mu = new double[N];
+ double* z = new double[N+1];
+ double recip;
+
+ ell[0] = 1.0;
+ mu[0] = 0.0;
+ z[0] = 0.0;
+
+ for (i = 1; i < N; i++)
+ {
+ ell[i] = 2.0*hdiff[i]-h[i-1]*mu[i-1];
+ recip = 1.0/ell[i];
+ mu[i] = recip*h[i];
+ z[i] = recip*(alpha[i]-h[i-1]*z[i-1]);
+ }
+ ell[N] = 1.0;
+ z[N] = 0.0;
+
+ b = new double[N];
+ c = new double[N+1];
+ d = new double[N];
+
+ c[N] = 0.0;
+
+ for (i = N-1; i >= 0; i--)
+ {
+ c[i] = z[i]-mu[i]*c[i+1];
+ recip = 1.0/h[i];
+ b[i] = recip*(a[i+1]-a[i])-h[i]*(c[i+1]+2.0*c[i])*oneThird;
+ d[i] = oneThird*recip*(c[i+1]-c[i]);
+ }
+
+ delete[] h;
+ delete[] hdiff;
+ delete[] alpha;
+ delete[] ell;
+ delete[] mu;
+ delete[] z;
+}
+
+void PeriodicSpline (int N, double* x, double* a, double*& b, double*& c,
+ double*& d)
+{
+ double* h = new double[N];
+ int i;
+ for (i = 0; i < N; i++)
+ h[i] = x[i+1]-x[i];
+
+ mgcLinearSystemD sys;
+ double** mat = sys.NewMatrix(N+1); // guaranteed to be zeroed memory
+ c = sys.NewVector(N+1); // guaranteed to be zeroed memory
+
+ // c[0] - c[N] = 0
+ mat[0][0] = +1.0f;
+ mat[0][N] = -1.0f;
+
+ // h[i-1]*c[i-1]+2*(h[i-1]+h[i])*c[i]+h[i]*c[i+1] =
+ // 3*{(a[i+1]-a[i])/h[i] - (a[i]-a[i-1])/h[i-1]}
+ for (i = 1; i <= N-1; i++)
+ {
+ mat[i][i-1] = h[i-1];
+ mat[i][i ] = 2.0f*(h[i-1]+h[i]);
+ mat[i][i+1] = h[i];
+ c[i] = 3.0f*((a[i+1]-a[i])/h[i] - (a[i]-a[i-1])/h[i-1]);
+ }
+
+ // "wrap around equation" for periodicity
+ // h[N-1]*c[N-1]+2*(h[N-1]+h[0])*c[0]+h[0]*c[1] =
+ // 3*{(a[1]-a[0])/h[0] - (a[0]-a[N-1])/h[N-1]}
+ mat[N][N-1] = h[N-1];
+ mat[N][0 ] = 2.0f*(h[N-1]+h[0]);
+ mat[N][1 ] = h[0];
+ c[N] = 3.0f*((a[1]-a[0])/h[0] - (a[0]-a[N-1])/h[N-1]);
+
+ // solve for c[0] through c[N]
+ sys.Solve(N+1,mat,c);
+
+ const double oneThird = 1.0/3.0;
+ b = new double[N];
+ d = new double[N];
+ for (i = 0; i < N; i++)
+ {
+ b[i] = (a[i+1]-a[i])/h[i] - oneThird*(c[i+1]+2.0f*c[i])*h[i];
+ d[i] = oneThird*(c[i+1]-c[i])/h[i];
+ }
+
+ delete[] h;
+ sys.DeleteMatrix(N+1,mat);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/hwpfilter/source/fontmap.cpp b/hwpfilter/source/fontmap.cpp
deleted file mode 100644
index 40016c9..0000000
--- a/hwpfilter/source/fontmap.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <stdio.h>
-#ifdef SOLARIS
-#include <strings.h>
-#else
-#include <string.h>
-#endif
-
-// #i42367# prevent MS compiler from using system locale for parsing
-#ifdef _MSC_VER
-#pragma setlocale("C")
-#endif
-
-
-struct FontEntry
-{
- const char *familyname;
- int key;
- double ratio;
-};
-/**
- * ratio\xb4\xc2 \xc7\xd1\xb1\xdb 70%, \xbc\xfd\xc0\xda 10% \xbf\xb5\xb9\xae 20%\xc0\xc7 \xba\xf1\xc0\xb2\xb7\xce \xb1\xb8\xbc\xba\xb5\xc7\xbe\xfa\xb4\xd9\xb4\xc2 \xb0\xa1\xc1\xa4\xc7\xcf\xbf\xa1 \xc1\xa4\xc7\xd8\xc1\xf8\xb4\xd9.
- */
-const struct FontEntry FontMapTab[] =
-{
- {"\xb8\xed\xc1\xb6",0, 0.97},
- {"\xb0\xed\xb5\xf1",1, 0.97},
- {"\xbb\xf9\xb9\xb0",1, 0.97},
- {"\xc7\xca\xb1\xe2",0, 0.97},
- {"\xbd\xc3\xbd\xba\xc5\xdb",1, 0.84},
- {"\xbd\xc3\xbd\xba\xc5\xdb \xbe\xe0\xc0\xda",1, 0.84},
- {"\xbd\xc3\xbd\xba\xc5\xdb \xb0\xa3\xc0\xda",1, 0.84},
- {"HY\xb5\xd5\xb1\xd9 \xb0\xed\xb5\xf1",2, 0.97},
- {"\xbf\xbe\xc7\xd1\xb1\xdb",0, 0.97},
- {"\xb0\xa1\xb4\xc2\xb0\xf8\xc7\xd1",0, 0.72},
- {"\xc1\xdf\xb0\xa3\xb0\xf8\xc7\xd1",0, 0.72},
- {"\xb1\xbd\xc0\xba\xb0\xf8\xc7\xd1",0, 0.72},
- {"\xb0\xa1\xb4\xc2\xc7\xd1",0, 0.72},
- {"\xc1\xdf\xb0\xa3\xc7\xd1",0, 0.72},
- {"\xb1\xbd\xc0\xba\xc7\xd1",0, 0.72},
- {"\xc8\xde\xb8\xd5\xb8\xed\xc1\xb6",0, 0.97},
- {"\xc8\xde\xb8\xd5\xb0\xed\xb5\xf1",1, 0.97},
- {"\xb0\xa1\xb4\xc2\xbe\xc8\xbb\xf3\xbc\xf6\xc3\xbc",0, 0.55},
- {"\xc1\xdf\xb0\xa3\xbe\xc8\xbb\xf3\xbc\xf6\xc3\xbc",0, 0.637},
- {"\xb1\xbd\xc0\xba\xbe\xc8\xbb\xf3\xbc\xf6\xc3\xbc",0, 0.63},
- {"\xc8\xde\xb8\xd5\xb0\xa1\xb4\xc2\xbb\xf9\xc3\xbc",0, 0.666},
- {"\xc8\xde\xb8\xd5\xc1\xdf\xb0\xa3\xbb\xf9\xc3\xbc",0, 0.685},
- {"\xc8\xde\xb8\xd5\xb1\xbd\xc0\xba\xbb\xf9\xc3\xbc",0, 0.727},
- {"\xc8\xde\xb8\xd5\xb0\xa1\xb4\xc2\xc6\xd4\xc3\xbc",0, 0.666},
- {"\xc8\xde\xb8\xd5\xc1\xdf\xb0\xa3\xc6\xd4\xc3\xbc",0, 0.685},
- {"\xc8\xde\xb8\xd5\xb1\xbd\xc0\xba\xc6\xd4\xc3\xbc",0, 0.727},
- {"\xc8\xde\xb8\xd5\xbf\xbe\xc3\xbc",3, 0.97},
- {"\xc7\xd1\xbe\xe7\xbd\xc5\xb8\xed\xc1\xb6",0, 0.97},
- {"\xc7\xd1\xbe\xe7\xb0\xdf\xb8\xed\xc1\xb6",1, 0.97},
- {"\xc7\xd1\xbe\xe7\xc1\xdf\xb0\xed\xb5\xf1",1, 0.97},
- {"\xc7\xd1\xbe\xe7\xb0\xdf\xb0\xed\xb5\xf1",1, 0.97},
- {"\xc7\xd1\xbe\xe7\xb1\xd7\xb7\xa1\xc7\xc8",0, 0.97},
- {"\xc7\xd1\xbe\xe7\xb1\xc3\xbc\xad",3, 0.97},
- {"\xb9\xae\xc8\xad\xb9\xd9\xc5\xc1",0, 0.97},
- {"\xb9\xae\xc8\xad\xb9\xd9\xc5\xc1\xc1\xa6\xb8\xf1",1, 0.97},
- {"\xb9\xae\xc8\xad\xb5\xb8\xbf\xf2",1, 0.97},
- {"\xb9\xae\xc8\xad\xb5\xb8\xbf\xf2\xc1\xa6\xb8\xf1",0, 0.97},
- {"\xb9\xae\xc8\xad\xbe\xb2\xb1\xe2",0, 0.97},
- {"\xb9\xae\xc8\xad\xbe\xb2\xb1\xe2\xc8\xea\xb8\xb2",0, 0.97},
- {"\xc6\xe6\xc8\xea\xb8\xb2",0, 0.97},
- {"\xba\xb9\xbc\xfe\xbe\xc6",0, 0.827},
- {"\xbf\xc1\xbc\xf6\xbc\xf6",0, 0.97},
- {"\xbf\xc0\xc0\xcc",0, 0.97},
- {"\xb0\xa1\xc1\xf6",0, 0.97},
- {"\xb0\xad\xb3\xb6\xc4\xe1",2, 0.97},
- {"\xb5\xfe\xb1\xe2",3, 0.97},
- {"\xc5\xb8\xc0\xcc\xc7\xc1",0, 0.987},
- {"\xc5\xc2 \xb3\xaa\xb9\xab",1, 0.97},
- {"\xc5\xc2 \xc7\xec\xb5\xe5\xb6\xf3\xc0\xce",0, 0.97},
- {"\xc5\xc2 \xb0\xa1\xb4\xc2 \xc7\xec\xb5\xe5\xb6\xf3\xc0\xce",0, 0.97},
- {"\xc5\xc2 \xc7\xec\xb5\xe5\xb6\xf3\xc0\xceT",0, 0.97},
- {"\xc5\xc2 \xb0\xa1\xb4\xc2 \xc7\xec\xb5\xe5\xb6\xf3\xc0\xceT",0, 0.97},
- {"\xbe\xe7\xc0\xe7 \xb4\xd9\xbf\xee\xb8\xed\xc1\xb6M",0, 0.97},
- {"\xbe\xe7\xc0\xe7 \xba\xbb\xb8\xf1\xb0\xa2M",0, 0.97},
- {"\xbe\xe7\xc0\xe7 \xbc\xd2\xbd\xbd",1, 0.97},
- {"\xbe\xe7\xc0\xe7 \xb8\xc5\xc8\xad",1, 0.987},
- {"\xbe\xe7\xc0\xe7 \xc6\xb0\xc6\xb0",0, 0.97},
- {"\xbe\xe7\xc0\xe7 \xc2\xfc\xbd\xa1",1, 0.97},
- {"\xbe\xe7\xc0\xe7 \xb5\xd1\xb1\xe2",0, 0.97},
- {"\xbe\xe7\xc0\xe7 \xbb\xfe\xb3\xda",1, 0.97},
- {"\xbe\xe7\xc0\xe7 \xbf\xcd\xb4\xe7",1, 0.97},
- {"\xbd\xc5\xb8\xed \xbc\xbc\xb8\xed\xc1\xb6",0, 0.97},
- {"\xbd\xc5\xb8\xed \xbd\xc5\xb8\xed\xc1\xb6",0, 0.97},
- {"\xbd\xc5\xb8\xed \xbd\xc5\xbd\xc5\xb8\xed\xc1\xb6",0, 0.97},
- {"\xbd\xc5\xb8\xed \xc1\xdf\xb8\xed\xc1\xb6",0, 0.97},
- {"\xbd\xc5\xb8\xed \xc5\xc2\xb8\xed\xc1\xb6",0, 0.97},
- {"\xbd\xc5\xb8\xed \xb0\xdf\xb8\xed\xc1\xb6",0, 0.97},
- {"\xbd\xc5\xb8\xed \xbd\xc5\xb9\xae\xb8\xed\xc1\xb6",0, 0.97},
- {"\xbd\xc5\xb8\xed \xbc\xf8\xb8\xed\xc1\xb6",0, 0.97},
- {"\xbd\xc5\xb8\xed \xbc\xbc\xb0\xed\xb5\xf1",1, 0.97},
- {"\xbd\xc5\xb8\xed \xc1\xdf\xb0\xed\xb5\xf1",1, 0.97},
- {"\xbd\xc5\xb8\xed \xc5\xc2\xb0\xed\xb5\xf1",1, 0.97},
- {"\xbd\xc5\xb8\xed \xb0\xdf\xb0\xed\xb5\xf1",1, 0.97},
- {"\xbd\xc5\xb8\xed \xbc\xbc\xb3\xaa\xb7\xe7",2, 0.97},
- {"\xbd\xc5\xb8\xed \xb5\xf0\xb3\xaa\xb7\xe7",2, 0.97},
- {"\xbd\xc5\xb8\xed \xbd\xc5\xb1\xd7\xb7\xa1\xc7\xc8",2, 0.97},
- {"\xbd\xc5\xb8\xed \xc5\xc2\xb1\xd7\xb7\xa1\xc7\xc8",2, 0.97},
- {"\xbd\xc5\xb8\xed \xb1\xc3\xbc\xad",3, 0.97}
-};
-
-#define FONTCOUNT 4
-#ifndef WIN32
-#if defined(LINUX)
-const char* RepFontTab[] =
-{
- "\xb9\xe9\xb9\xac \xb9\xd9\xc5\xc1", /* 0 */
- "\xb9\xe9\xb9\xac \xb5\xb8\xbf\xf2", /* 1 */
- "\xb9\xe9\xb9\xac \xb1\xbc\xb8\xb2", /* 2 */
- "\xb9\xe9\xb9\xac \xc7\xec\xb5\xe5\xb6\xf3\xc0\xce" /* 3 */
-};
-#else
-const char* RepFontTab[] =
-{
- "Batang", /* 0 */
- "Dotum", /* 1 */
- "Gulim", /* 2 */
- "Gungso" /* 3 */
-};
-#endif
-#else
-char* RepFontTab[] =
-{
- "\xb9\xd9\xc5\xc1", /* 0 */
- "\xb5\xb8\xbf\xf2", /* 1 */
- "\xb1\xbc\xb8\xb2", /* 2 */
- "\xb1\xc3\xbc\xad" /* 3 */
-};
-#endif
-
-int getRepFamilyName(const char* orig, char *buf, double &ratio)
-{
- int i;
- int size = sizeof(FontMapTab)/sizeof(FontEntry);
- for( i = 0 ; i < size ; i++)
- {
- if( !strcmp(orig, FontMapTab[i].familyname) ){
- ratio = FontMapTab[i].ratio;
- return strlen( strcpy(buf,RepFontTab[FontMapTab[i].key]) );
- }
- }
- ratio = FontMapTab[0].ratio;
- return strlen( strcpy(buf, RepFontTab[0] ) );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/hwpfilter/source/fontmap.cxx b/hwpfilter/source/fontmap.cxx
new file mode 100644
index 0000000..d3f9906
--- /dev/null
+++ b/hwpfilter/source/fontmap.cxx
@@ -0,0 +1,177 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#ifdef SOLARIS
+#include <strings.h>
+#else
+#include <string.h>
+#endif
+
+// #i42367# prevent MS compiler from using system locale for parsing
+#ifdef _MSC_VER
+#pragma setlocale("C")
+#endif
+
+
+struct FontEntry
+{
+ const char *familyname;
+ int key;
+ double ratio;
+};
+/**
+ * ratio\xb4\xc2 \xc7\xd1\xb1\xdb 70%, \xbc\xfd\xc0\xda 10% \xbf\xb5\xb9\xae 20%\xc0\xc7 \xba\xf1\xc0\xb2\xb7\xce \xb1\xb8\xbc\xba\xb5\xc7\xbe\xfa\xb4\xd9\xb4\xc2 \xb0\xa1\xc1\xa4\xc7\xcf\xbf\xa1 \xc1\xa4\xc7\xd8\xc1\xf8\xb4\xd9.
+ */
+const struct FontEntry FontMapTab[] =
+{
+ {"\xb8\xed\xc1\xb6",0, 0.97},
+ {"\xb0\xed\xb5\xf1",1, 0.97},
+ {"\xbb\xf9\xb9\xb0",1, 0.97},
+ {"\xc7\xca\xb1\xe2",0, 0.97},
+ {"\xbd\xc3\xbd\xba\xc5\xdb",1, 0.84},
+ {"\xbd\xc3\xbd\xba\xc5\xdb \xbe\xe0\xc0\xda",1, 0.84},
+ {"\xbd\xc3\xbd\xba\xc5\xdb \xb0\xa3\xc0\xda",1, 0.84},
+ {"HY\xb5\xd5\xb1\xd9 \xb0\xed\xb5\xf1",2, 0.97},
+ {"\xbf\xbe\xc7\xd1\xb1\xdb",0, 0.97},
+ {"\xb0\xa1\xb4\xc2\xb0\xf8\xc7\xd1",0, 0.72},
+ {"\xc1\xdf\xb0\xa3\xb0\xf8\xc7\xd1",0, 0.72},
+ {"\xb1\xbd\xc0\xba\xb0\xf8\xc7\xd1",0, 0.72},
+ {"\xb0\xa1\xb4\xc2\xc7\xd1",0, 0.72},
+ {"\xc1\xdf\xb0\xa3\xc7\xd1",0, 0.72},
+ {"\xb1\xbd\xc0\xba\xc7\xd1",0, 0.72},
+ {"\xc8\xde\xb8\xd5\xb8\xed\xc1\xb6",0, 0.97},
+ {"\xc8\xde\xb8\xd5\xb0\xed\xb5\xf1",1, 0.97},
+ {"\xb0\xa1\xb4\xc2\xbe\xc8\xbb\xf3\xbc\xf6\xc3\xbc",0, 0.55},
+ {"\xc1\xdf\xb0\xa3\xbe\xc8\xbb\xf3\xbc\xf6\xc3\xbc",0, 0.637},
+ {"\xb1\xbd\xc0\xba\xbe\xc8\xbb\xf3\xbc\xf6\xc3\xbc",0, 0.63},
+ {"\xc8\xde\xb8\xd5\xb0\xa1\xb4\xc2\xbb\xf9\xc3\xbc",0, 0.666},
+ {"\xc8\xde\xb8\xd5\xc1\xdf\xb0\xa3\xbb\xf9\xc3\xbc",0, 0.685},
+ {"\xc8\xde\xb8\xd5\xb1\xbd\xc0\xba\xbb\xf9\xc3\xbc",0, 0.727},
+ {"\xc8\xde\xb8\xd5\xb0\xa1\xb4\xc2\xc6\xd4\xc3\xbc",0, 0.666},
+ {"\xc8\xde\xb8\xd5\xc1\xdf\xb0\xa3\xc6\xd4\xc3\xbc",0, 0.685},
+ {"\xc8\xde\xb8\xd5\xb1\xbd\xc0\xba\xc6\xd4\xc3\xbc",0, 0.727},
+ {"\xc8\xde\xb8\xd5\xbf\xbe\xc3\xbc",3, 0.97},
+ {"\xc7\xd1\xbe\xe7\xbd\xc5\xb8\xed\xc1\xb6",0, 0.97},
+ {"\xc7\xd1\xbe\xe7\xb0\xdf\xb8\xed\xc1\xb6",1, 0.97},
+ {"\xc7\xd1\xbe\xe7\xc1\xdf\xb0\xed\xb5\xf1",1, 0.97},
+ {"\xc7\xd1\xbe\xe7\xb0\xdf\xb0\xed\xb5\xf1",1, 0.97},
+ {"\xc7\xd1\xbe\xe7\xb1\xd7\xb7\xa1\xc7\xc8",0, 0.97},
+ {"\xc7\xd1\xbe\xe7\xb1\xc3\xbc\xad",3, 0.97},
+ {"\xb9\xae\xc8\xad\xb9\xd9\xc5\xc1",0, 0.97},
+ {"\xb9\xae\xc8\xad\xb9\xd9\xc5\xc1\xc1\xa6\xb8\xf1",1, 0.97},
+ {"\xb9\xae\xc8\xad\xb5\xb8\xbf\xf2",1, 0.97},
+ {"\xb9\xae\xc8\xad\xb5\xb8\xbf\xf2\xc1\xa6\xb8\xf1",0, 0.97},
+ {"\xb9\xae\xc8\xad\xbe\xb2\xb1\xe2",0, 0.97},
+ {"\xb9\xae\xc8\xad\xbe\xb2\xb1\xe2\xc8\xea\xb8\xb2",0, 0.97},
+ {"\xc6\xe6\xc8\xea\xb8\xb2",0, 0.97},
+ {"\xba\xb9\xbc\xfe\xbe\xc6",0, 0.827},
+ {"\xbf\xc1\xbc\xf6\xbc\xf6",0, 0.97},
+ {"\xbf\xc0\xc0\xcc",0, 0.97},
+ {"\xb0\xa1\xc1\xf6",0, 0.97},
+ {"\xb0\xad\xb3\xb6\xc4\xe1",2, 0.97},
+ {"\xb5\xfe\xb1\xe2",3, 0.97},
+ {"\xc5\xb8\xc0\xcc\xc7\xc1",0, 0.987},
+ {"\xc5\xc2 \xb3\xaa\xb9\xab",1, 0.97},
+ {"\xc5\xc2 \xc7\xec\xb5\xe5\xb6\xf3\xc0\xce",0, 0.97},
+ {"\xc5\xc2 \xb0\xa1\xb4\xc2 \xc7\xec\xb5\xe5\xb6\xf3\xc0\xce",0, 0.97},
+ {"\xc5\xc2 \xc7\xec\xb5\xe5\xb6\xf3\xc0\xceT",0, 0.97},
+ {"\xc5\xc2 \xb0\xa1\xb4\xc2 \xc7\xec\xb5\xe5\xb6\xf3\xc0\xceT",0, 0.97},
+ {"\xbe\xe7\xc0\xe7 \xb4\xd9\xbf\xee\xb8\xed\xc1\xb6M",0, 0.97},
+ {"\xbe\xe7\xc0\xe7 \xba\xbb\xb8\xf1\xb0\xa2M",0, 0.97},
+ {"\xbe\xe7\xc0\xe7 \xbc\xd2\xbd\xbd",1, 0.97},
+ {"\xbe\xe7\xc0\xe7 \xb8\xc5\xc8\xad",1, 0.987},
+ {"\xbe\xe7\xc0\xe7 \xc6\xb0\xc6\xb0",0, 0.97},
+ {"\xbe\xe7\xc0\xe7 \xc2\xfc\xbd\xa1",1, 0.97},
+ {"\xbe\xe7\xc0\xe7 \xb5\xd1\xb1\xe2",0, 0.97},
+ {"\xbe\xe7\xc0\xe7 \xbb\xfe\xb3\xda",1, 0.97},
+ {"\xbe\xe7\xc0\xe7 \xbf\xcd\xb4\xe7",1, 0.97},
+ {"\xbd\xc5\xb8\xed \xbc\xbc\xb8\xed\xc1\xb6",0, 0.97},
+ {"\xbd\xc5\xb8\xed \xbd\xc5\xb8\xed\xc1\xb6",0, 0.97},
+ {"\xbd\xc5\xb8\xed \xbd\xc5\xbd\xc5\xb8\xed\xc1\xb6",0, 0.97},
+ {"\xbd\xc5\xb8\xed \xc1\xdf\xb8\xed\xc1\xb6",0, 0.97},
+ {"\xbd\xc5\xb8\xed \xc5\xc2\xb8\xed\xc1\xb6",0, 0.97},
+ {"\xbd\xc5\xb8\xed \xb0\xdf\xb8\xed\xc1\xb6",0, 0.97},
+ {"\xbd\xc5\xb8\xed \xbd\xc5\xb9\xae\xb8\xed\xc1\xb6",0, 0.97},
+ {"\xbd\xc5\xb8\xed \xbc\xf8\xb8\xed\xc1\xb6",0, 0.97},
+ {"\xbd\xc5\xb8\xed \xbc\xbc\xb0\xed\xb5\xf1",1, 0.97},
+ {"\xbd\xc5\xb8\xed \xc1\xdf\xb0\xed\xb5\xf1",1, 0.97},
+ {"\xbd\xc5\xb8\xed \xc5\xc2\xb0\xed\xb5\xf1",1, 0.97},
+ {"\xbd\xc5\xb8\xed \xb0\xdf\xb0\xed\xb5\xf1",1, 0.97},
+ {"\xbd\xc5\xb8\xed \xbc\xbc\xb3\xaa\xb7\xe7",2, 0.97},
+ {"\xbd\xc5\xb8\xed \xb5\xf0\xb3\xaa\xb7\xe7",2, 0.97},
+ {"\xbd\xc5\xb8\xed \xbd\xc5\xb1\xd7\xb7\xa1\xc7\xc8",2, 0.97},
+ {"\xbd\xc5\xb8\xed \xc5\xc2\xb1\xd7\xb7\xa1\xc7\xc8",2, 0.97},
+ {"\xbd\xc5\xb8\xed \xb1\xc3\xbc\xad",3, 0.97}
+};
+
+#define FONTCOUNT 4
+#ifndef WIN32
+#if defined(LINUX)
+const char* RepFontTab[] =
+{
+ "\xb9\xe9\xb9\xac \xb9\xd9\xc5\xc1", /* 0 */
+ "\xb9\xe9\xb9\xac \xb5\xb8\xbf\xf2", /* 1 */
+ "\xb9\xe9\xb9\xac \xb1\xbc\xb8\xb2", /* 2 */
+ "\xb9\xe9\xb9\xac \xc7\xec\xb5\xe5\xb6\xf3\xc0\xce" /* 3 */
+};
+#else
+const char* RepFontTab[] =
+{
+ "Batang", /* 0 */
+ "Dotum", /* 1 */
+ "Gulim", /* 2 */
+ "Gungso" /* 3 */
+};
+#endif
+#else
+char* RepFontTab[] =
+{
+ "\xb9\xd9\xc5\xc1", /* 0 */
+ "\xb5\xb8\xbf\xf2", /* 1 */
+ "\xb1\xbc\xb8\xb2", /* 2 */
+ "\xb1\xc3\xbc\xad" /* 3 */
+};
+#endif
+
+int getRepFamilyName(const char* orig, char *buf, double &ratio)
+{
+ int i;
+ int size = sizeof(FontMapTab)/sizeof(FontEntry);
+ for( i = 0 ; i < size ; i++)
+ {
+ if( !strcmp(orig, FontMapTab[i].familyname) ){
+ ratio = FontMapTab[i].ratio;
+ return strlen( strcpy(buf,RepFontTab[FontMapTab[i].key]) );
+ }
+ }
+ ratio = FontMapTab[0].ratio;
+ return strlen( strcpy(buf, RepFontTab[0] ) );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/hwpfilter/source/formula.cpp b/hwpfilter/source/formula.cpp
deleted file mode 100644
index eecc013..0000000
--- a/hwpfilter/source/formula.cpp
+++ /dev/null
@@ -1,689 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "formula.h"
-
-#include "mzstring.h"
-#include "nodes.h"
-#include "mapping.h"
-#include "hwpeq.h"
-#include <iostream>
-
-extern LinkedList<Node> nodelist;
-
-#ifndef DEBUG
-
-#include "hcode.h"
-
-static hchar entity[32];
-#define ascii(x) OUString::createFromAscii(x)
-#define rstartEl(x,y) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->startElement(x,y); } while(0)
-#define rendEl(x) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->endElement(x); } while(0)
-#define rchars(x) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->characters(ascii(x)); } while(0)
-#define runistr(x) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->characters(OUString(x)); } while(0)
-#define reucstr(x,y) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->characters(OUString(x,y, RTL_TEXTENCODING_EUC_KR)); } while(0)
-#define padd(x,y,z) pList->addAttribute(x,y,z)
-#else
-static char entity[32];
-static int indent = 0;
-#define inds indent++; for(int i = 0 ; i < indent ; i++) fprintf(stderr," ")
-#define inde for(int i = 0 ; i < indent ; i++) fprintf(stderr," "); indent--
-#define indo indent--;
-#endif
-
-extern Node *mainParse(const char *);
-
-
-void Formula::makeMathML(Node *res)
-{
- Node *tmp = res;
- if( !tmp ) return;
-#ifdef DEBUG
- inds;
- fprintf(stderr,"<math:math xmlns:math=\"http://www.w3.org/1998/Math/MathML\">\n");
-#else
- padd(ascii("xmlns:math"), ascii("CDATA"), ascii("http://www.w3.org/1998/Math/MathML"));
- rstartEl(ascii("math:math"), rList);
- pList->clear();
- rstartEl(ascii("math:semantics"), rList);
-#endif
- if( tmp->child )
- makeLines( tmp->child );
-
-#ifdef DEBUG
- inds;
- fprintf(stderr,"<math:semantics/>\n");
- indo;
- inde;
- fprintf(stderr,"</math:math>\n");
-#else
- rendEl(ascii("math:semantics"));
- rendEl(ascii("math:math"));
-#endif
-}
-
-void Formula::makeLines(Node *res)
-{
- Node *tmp = res;
- if( !tmp ) return;
-
- if( tmp->child ){
- if( tmp->child->id == ID_LINES )
- makeLines( tmp->child );
- else
- makeLine( tmp->child );
- }
- if( tmp->next )
- makeLine( tmp->next );
-}
-
-void Formula::makeLine(Node *res)
-{
- if( !res ) return;
-#ifdef DEBUG
- inds; fprintf(stderr,"<math:mrow>\n");
-#else
- rstartEl(ascii("math:mrow"), rList);
-#endif
- if( res->child )
- makeExprList( res->child );
-#ifdef DEBUG
- inde; fprintf(stderr,"</math:mrow>\n");
-#else
- rendEl(ascii("math:mrow"));
-#endif
-}
-
-void Formula::makeExprList(Node *res)
-{
- if( !res ) return;
- Node *tmp = res->child;
- if( !tmp ) return ;
-
- if( tmp->id == ID_EXPRLIST ){
- Node *next = tmp->next;
- makeExprList( tmp ) ;
- if( next )
- makeExpr( next );
- }
- else
- makeExpr( tmp );
-}
-
-void Formula::makeExpr(Node *res)
-{
- if( !res ) return;
- Node *tmp = res->child;
- if( !tmp ) return;
- switch( tmp->id ) {
- case ID_PRIMARYEXPR:
- if( tmp->next ){
-#ifdef DEBUG
- inds;
- fprintf(stderr,"<math:mrow>\n");
-#else
- rstartEl(ascii("math:mrow"), rList);
-#endif
- }
-
- makePrimary(tmp);
-
- if( tmp->next ){
-#ifdef DEBUG
- inde; fprintf(stderr,"</math:mrow>\n");
-#else
- rendEl(ascii("math:mrow"));
-#endif
- }
- break;
- case ID_SUBEXPR:
- case ID_SUPEXPR:
- case ID_SUBSUPEXPR:
- makeSubSup(tmp);
- break;
- case ID_FRACTIONEXPR:
- case ID_OVER:
- makeFraction(tmp);
- break;
- case ID_DECORATIONEXPR:
- makeDecoration(tmp);
- break;
- case ID_SQRTEXPR:
- case ID_ROOTEXPR:
- makeRoot(tmp);
- break;
- case ID_ARROWEXPR:
- makeArrow(tmp);
- break;
- case ID_ACCENTEXPR:
- makeAccent(tmp);
- break;
- case ID_PARENTH:
- case ID_ABS:
- makeParenth(tmp);
- break;
- case ID_FENCE:
- makeFence(tmp);
- break;
- case ID_BLOCK:
- makeBlock(tmp);
- case ID_BEGIN:
- makeBegin(tmp);
- case ID_END:
- makeEnd(tmp);
- break;
- }
-}
-
-void Formula::makeIdentifier(Node *res)
-{
- Node *tmp = res;
- if( !tmp ) return;
- if( !tmp->value ) return;
- switch( tmp->id ){
- case ID_CHARACTER :
-#ifdef DEBUG
- inds;
- fprintf(stderr,"<math:mi>%s</math:mi>\n",tmp->value);
- indo;
-#else
- rstartEl(ascii("math:mi"), rList);
- rchars(tmp->value);
- rendEl(ascii("math:mi"));
-#endif
- break;
- case ID_STRING :
- {
-#ifdef DEBUG
-#else
- rstartEl(ascii("math:mi"), rList);
- reucstr(tmp->value, strlen(tmp->value));
- rendEl(ascii("math:mi"));
-#endif
- }
- break;
- case ID_IDENTIFIER :
-#ifdef DEBUG
- inds;
- fprintf(stderr,"<math:mi>%s</math:mi>\n",getMathMLEntity(tmp->value, entity));
- indo;
-#else
- rstartEl(ascii("math:mi"), rList);
- runistr(getMathMLEntity(tmp->value, entity));
- rendEl(ascii("math:mi"));
-#endif
- break;
- case ID_NUMBER :
-#ifdef DEBUG
- inds;
- fprintf(stderr,"<math:mn>%s</math:mn>\n",tmp->value);
- indo;
-#else
- rstartEl(ascii("math:mn"), rList);
- rchars(tmp->value);
- rendEl(ascii("math:mn"));
-#endif
- break;
- case ID_OPERATOR :
- case ID_DELIMETER :
- {
-#ifdef DEBUG
- inds; fprintf(stderr,"<math:mo>%s</math:mo>\n",tmp->value); indo;
-#else
- rstartEl(ascii("math:mo"), rList);
- runistr(getMathMLEntity(tmp->value,entity));
- rendEl(ascii("math:mo"));
-#endif
- break;
- }
- }
-}
-void Formula::makePrimary(Node *res)
-{
- Node *tmp = res;
- if( !tmp ) return ;
- if( tmp->child ){
- if( tmp->child->id == ID_PRIMARYEXPR ){
- makePrimary(tmp->child);
- }
- else{
- makeIdentifier(tmp->child);
- }
- }
- if( tmp->next ){
- makeIdentifier(tmp->next);
- }
-}
-
-void Formula::makeSubSup(Node *res)
-{
- Node *tmp = res;
- if( !tmp ) return;
-
-#ifdef DEBUG
- inds;
- if( res->id == ID_SUBEXPR )
- fprintf(stderr,"<math:msub>\n");
- else if( res->id == ID_SUPEXPR )
- fprintf(stderr,"<math:msup>\n");
- else
- fprintf(stderr,"<math:msubsup>\n");
-#else
- if( res->id == ID_SUBEXPR )
- rstartEl(ascii("math:msub"), rList);
- else if( res->id == ID_SUPEXPR )
- rstartEl(ascii("math:msup"), rList);
- else
- rstartEl(ascii("math:msubsup"), rList);
-#endif
-
- tmp = tmp->child;
- if( res->id == ID_SUBSUPEXPR ) {
- makeExpr(tmp);
- makeBlock(tmp->next);
- makeBlock(tmp->next->next);
- }
- else{
- makeExpr(tmp);
- makeExpr(tmp->next);
- }
-
-#ifdef DEBUG
- inde;
- if( res->id == ID_SUBEXPR )
- fprintf(stderr,"</math:msub>\n");
- else if( res->id == ID_SUPEXPR )
- fprintf(stderr,"</math:msup>\n");
- else
- fprintf(stderr,"</math:msubsup>\n");
-#else
- if( res->id == ID_SUBEXPR )
- rendEl(ascii("math:msub"));
- else if( res->id == ID_SUPEXPR )
- rendEl(ascii("math:msup"));
- else
- rendEl(ascii("math:msubsup"));
-#endif
-}
-
-void Formula::makeFraction(Node *res)
-{
- Node *tmp = res;
- if( !tmp ) return;
-
-#ifdef DEBUG
- inds;
- fprintf(stderr,"<math:mfrac>\n");
-#else
- rstartEl(ascii("math:mfrac"), rList);
-#endif
-
- tmp = tmp->child;
-#ifdef DEBUG
- inds;
- fprintf(stderr,"<math:mrow>\n");
-#else
- rstartEl(ascii("math:mrow"), rList);
-#endif
-
- if( res->id == ID_FRACTIONEXPR )
- makeBlock(tmp);
- else
- makeExprList(tmp);
-
-#ifdef DEBUG
- inde;
- fprintf(stderr,"</math:mrow>\n");
- inds;
- fprintf(stderr,"<math:mrow>\n");
-#else
- rendEl(ascii("math:mrow"));
- rstartEl(ascii("math:mrow"), rList);
-#endif
-
- if( res->id == ID_FRACTIONEXPR )
- makeBlock(tmp->next);
- else
- makeExprList(tmp->next);
-
-#ifdef DEBUG
- inde;
- fprintf(stderr,"</math:mrow>\n");
- inde;
- fprintf(stderr,"</math:mfrac>\n");
-#else
- rendEl(ascii("math:mrow"));
- rendEl(ascii("math:mfrac"));
-#endif
-}
-
-void Formula::makeDecoration(Node *res)
-{
- int isover = 1;
- Node *tmp = res->child;
- if( !tmp ) return;
- if( !strncmp(tmp->value,"under", 5) )
- isover = 0;
-#ifdef DEBUG
- inds;
- if( isover )
- fprintf(stderr,"<math:mover>\n");
- else
- fprintf(stderr,"<math:munder>\n");
-#else
- /* accent´Â ¾ðÁ¦ trueÀÌ°í, ¾ðÁ¦, falseÀÎÁö ¸ð¸£°Ú´Ù. */
- if( isover ){
- padd(ascii("accent"),ascii("CDATA"),ascii("true"));
- rstartEl(ascii("math:mover"), rList);
- }
- else{
- padd(ascii("accentunder"),ascii("CDATA"),ascii("true"));
- rstartEl(ascii("math:munder"), rList);
- }
- pList->clear();
-#endif
-
- makeBlock(tmp->next);
-
-#ifdef DEBUG
- inds;
- fprintf(stderr,"<math:mo>%s</math:mo>\n", getMathMLEntity(tmp->value,entity));
- indo;
-#else
- rstartEl(ascii("math:mo"), rList);
- runistr(getMathMLEntity(tmp->value,entity));
- rendEl(ascii("math:mo"));
-#endif
-
-#ifdef DEBUG
- inde;
- if( isover )
- fprintf(stderr,"</math:mover>\n");
- else
- fprintf(stderr,"</math:munder>\n");
-#else
- if( isover )
- rendEl(ascii("math:mover"));
- else
- rendEl(ascii("math:munder"));
-#endif
-}
-
-void Formula::makeRoot(Node *res)
-{
- Node *tmp = res;
- if( !tmp ) return;
-#ifdef DEBUG
- inds;
- if( tmp->id == ID_SQRTEXPR )
- fprintf(stderr,"<math:msqrt>\n");
- else
- fprintf(stderr,"<math:mroot>\n");
-#else
- if( tmp->id == ID_SQRTEXPR )
- rstartEl(ascii("math:msqrt"), rList);
- else
- rstartEl(ascii("math:mroot"), rList);
-#endif
-
- if( tmp->id == ID_SQRTEXPR ){
- makeBlock(tmp->child);
- }
- else{
- makeBracket(tmp->child);
- makeBlock(tmp->child->next);
- }
-
-#ifdef DEBUG
- inde;
- if( tmp->id == ID_SQRTEXPR )
- fprintf(stderr,"</math:msqrt>\n");
- else
- fprintf(stderr,"</math:mroot>\n");
-#else
- if( tmp->id == ID_SQRTEXPR )
- rendEl(ascii("math:msqrt"));
- else
- rendEl(ascii("math:mroot"));
-#endif
-}
-// DVO: add space to avoid warning
-void Formula::makeArrow(Node * /*res*/)
-{
-}
-void Formula::makeAccent(Node *res)
-{
- makeDecoration( res );
-}
-void Formula::makeParenth(Node *res)
-{
- Node *tmp = res;
- if( !tmp ) return;
-#ifdef DEBUG
- inds;
- fprintf(stderr,"<math:mrow>\n");
- inds;
- if( tmp->id == ID_PARENTH ){
- fprintf(stderr,"<math:mo>(</math:mo>\n");
- }
- else
- fprintf(stderr,"<math:mo>|</math:mo>\n");
- indo; inds;
- fprintf(stderr,"<math:mrow>\n");
-#else
- rstartEl(ascii("math:mrow"), rList);
- rstartEl(ascii("math:mo"), rList);
- if( tmp->id == ID_PARENTH )
- rchars("(");
- else
- rchars("|");
- rendEl(ascii("math:mo"));
- rstartEl(ascii("math:mrow"), rList);
-#endif
-
- if( tmp->child )
- makeExprList(tmp->child);
-
-#ifdef DEBUG
- inde;
- fprintf(stderr,"</math:mrow>\n");
- inds;
- if( tmp->id == ID_PARENTH )
- fprintf(stderr,"<math:mo>)</math:mo>\n");
- else
- fprintf(stderr,"<math:mo>|</math:mo>\n");
- indo;
- inde;
- fprintf(stderr,"</math:mrow>\n");
-#else
- rendEl(ascii("math:mrow"));
- rstartEl(ascii("math:mo"), rList);
- if( tmp->id == ID_PARENTH )
- rchars(")");
- else
- rchars("|");
- rendEl(ascii("math:mo"));
- rendEl(ascii("math:mrow"));
-#endif
-}
-
-void Formula::makeFence(Node *res)
-{
- Node *tmp = res->child;
-#ifdef DEBUG
- inds;
- fprintf(stderr,"<math:mfenced open=\"%s\" close=\"%s\">\n",getMathMLEntity(tmp->value, entity),
- getMathMLEntity(tmp->next->next->value,entity));
-#else
- padd(ascii("open"), ascii("CDATA"), OUString(getMathMLEntity(tmp->value,entity)) );
- padd(ascii("close"), ascii("CDATA"), OUString(getMathMLEntity(tmp->next->next->value,entity)) );
- rstartEl(ascii("math:mfenced"), rList);
- pList->clear();
-#endif
-
- makeExprList(tmp->next);
-
-#ifdef DEBUG
- inde;
- fprintf(stderr,"</math:mfenced>\n");
-#else
- rendEl(ascii("math:mfenced"));
-#endif
-}
-
-void Formula::makeBracket(Node *res)
-{
- makeBlock(res);
-}
-
-void Formula::makeBlock(Node *res)
-{
-#ifdef DEBUG
- inds;
- fprintf(stderr,"<math:mrow>\n");
-#else
- rstartEl(ascii("math:mrow"), rList);
-#endif
-
- if( res->child )
- makeExprList(res->child);
-
-#ifdef DEBUG
- inde;
- fprintf(stderr,"</math:mrow>\n");
-#else
- rendEl(ascii("math:mrow"));
-#endif
-}
-
-// DVO: add space to avoid warning
-void Formula::makeBegin(Node * /*res*/)
-{
-}
-
-// DVO: add space to avoid warning
-void Formula::makeEnd(Node * /*res*/)
-{
-}
-
-int Formula::parse()
-{
- Node *res = 0L;
- if( !eq ) return 0;
- if( isHwpEQ ){
- MzString a;
- // fprintf(stderr,"\n\n[BEFORE]\n[%s]\n",eq);
- eq2latex(a,eq);
-
- int idx=a.find(sal::static_int_cast<char>(0xff));
- while(idx){
- //printf("idx = [%d]\n",idx);
- a.replace(idx,0x20);
- if((idx = a.find(sal::static_int_cast<char>(0xff),idx+1)) < 0)
- break;
- }
-
- char *buf = (char *)malloc(a.length()+1);
- bool bStart = false;
- int i, j;
- for( i = 0, j=0 ; i < a.length() ; i++){ // rtrim and ltrim 32 10 13
- if( bStart ){
- buf[j++] = a[i];
- }
- else{
- if( a[i] != 32 && a[i] != 10 && a[i] != 13){
- bStart = true;
- buf[j++] = a[i];
- }
- }
- }
- buf[j] = 0;
- for( i = j-1 ; i >= 0 ; i++ ){
- if( buf[i] == 32 || buf[i] == 10 || buf[i] == 13 ){
- buf[i] = 0;
- }
- else
- break;
- }
- // fprintf(stderr,"\n\n[RESULT]\n[%s]\n",a.c_str());
- if( strlen(buf) > 0 )
- res = mainParse( a.c_str() );
- else
- res = 0L;
- free(buf);
- }
- else{
- res = mainParse( eq );
- }
-
- if( res ){
- makeMathML( res );
- }
- Node *tmpNode;
- int count = nodelist.count();
- for( int i = 0 ; i < count ; i++ ){
- tmpNode = nodelist.remove(0);
- delete tmpNode;
- }
-
- return 0;
-}
-
-void Formula::trim()
-{
- int len = strlen(eq);
- char *buf = (char *)malloc(len+1);
- bool bStart = false;
- int i, j;
- for( i = 0, j=0 ; i < len ; i++){ // rtrim and ltrim 32 10 13
- if( bStart ){
- buf[j++] = eq[i];
- }
- else{
- if( eq[i] != 32 && eq[i] != 10 && eq[i] != 13){
- bStart = true;
- buf[j++] = eq[i];
- }
- }
- }
- buf[j] = 0;
- for( i = j-1 ; i >= 0 ; i++ ){
- if( buf[i] == 32 || buf[i] == 10 || buf[i] == 13 ){
- buf[i] = 0;
- }
- else
- break;
- }
- if( strlen(buf) > 0 )
- strcpy(eq, buf);
- else
- eq = 0L;
- free(buf);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/hwpfilter/source/formula.cxx b/hwpfilter/source/formula.cxx
new file mode 100644
index 0000000..d2a73ac
--- /dev/null
+++ b/hwpfilter/source/formula.cxx
@@ -0,0 +1,689 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "formula.h"
+
+#include "mzstring.h"
+#include "nodes.h"
+#include "mapping.h"
+#include "hwpeq.h"
+#include <iostream>
+
+extern LinkedList<Node> nodelist;
+
+#ifndef DEBUG
+
+#include "hcode.h"
+
+static hchar entity[32];
+#define ascii(x) OUString::createFromAscii(x)
+#define rstartEl(x,y) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->startElement(x,y); } while(0)
+#define rendEl(x) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->endElement(x); } while(0)
+#define rchars(x) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->characters(ascii(x)); } while(0)
+#define runistr(x) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->characters(OUString(x)); } while(0)
+#define reucstr(x,y) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->characters(OUString(x,y, RTL_TEXTENCODING_EUC_KR)); } while(0)
+#define padd(x,y,z) pList->addAttribute(x,y,z)
+#else
+static char entity[32];
+static int indent = 0;
+#define inds indent++; for(int i = 0 ; i < indent ; i++) fprintf(stderr," ")
+#define inde for(int i = 0 ; i < indent ; i++) fprintf(stderr," "); indent--
+#define indo indent--;
+#endif
+
+extern Node *mainParse(const char *);
+
+
+void Formula::makeMathML(Node *res)
+{
+ Node *tmp = res;
+ if( !tmp ) return;
+#ifdef DEBUG
+ inds;
+ fprintf(stderr,"<math:math xmlns:math=\"http://www.w3.org/1998/Math/MathML\">\n");
+#else
+ padd(ascii("xmlns:math"), ascii("CDATA"), ascii("http://www.w3.org/1998/Math/MathML"));
+ rstartEl(ascii("math:math"), rList);
+ pList->clear();
+ rstartEl(ascii("math:semantics"), rList);
+#endif
+ if( tmp->child )
+ makeLines( tmp->child );
+
+#ifdef DEBUG
+ inds;
+ fprintf(stderr,"<math:semantics/>\n");
+ indo;
+ inde;
+ fprintf(stderr,"</math:math>\n");
+#else
+ rendEl(ascii("math:semantics"));
+ rendEl(ascii("math:math"));
+#endif
+}
+
+void Formula::makeLines(Node *res)
+{
+ Node *tmp = res;
+ if( !tmp ) return;
+
+ if( tmp->child ){
+ if( tmp->child->id == ID_LINES )
+ makeLines( tmp->child );
+ else
+ makeLine( tmp->child );
+ }
+ if( tmp->next )
+ makeLine( tmp->next );
+}
+
+void Formula::makeLine(Node *res)
+{
+ if( !res ) return;
+#ifdef DEBUG
+ inds; fprintf(stderr,"<math:mrow>\n");
+#else
+ rstartEl(ascii("math:mrow"), rList);
+#endif
+ if( res->child )
+ makeExprList( res->child );
+#ifdef DEBUG
+ inde; fprintf(stderr,"</math:mrow>\n");
+#else
+ rendEl(ascii("math:mrow"));
+#endif
+}
+
+void Formula::makeExprList(Node *res)
+{
+ if( !res ) return;
+ Node *tmp = res->child;
+ if( !tmp ) return ;
+
+ if( tmp->id == ID_EXPRLIST ){
+ Node *next = tmp->next;
+ makeExprList( tmp ) ;
+ if( next )
+ makeExpr( next );
+ }
+ else
+ makeExpr( tmp );
+}
+
+void Formula::makeExpr(Node *res)
+{
+ if( !res ) return;
+ Node *tmp = res->child;
+ if( !tmp ) return;
+ switch( tmp->id ) {
+ case ID_PRIMARYEXPR:
+ if( tmp->next ){
+#ifdef DEBUG
+ inds;
+ fprintf(stderr,"<math:mrow>\n");
+#else
+ rstartEl(ascii("math:mrow"), rList);
+#endif
+ }
+
+ makePrimary(tmp);
+
+ if( tmp->next ){
+#ifdef DEBUG
+ inde; fprintf(stderr,"</math:mrow>\n");
+#else
+ rendEl(ascii("math:mrow"));
+#endif
+ }
+ break;
+ case ID_SUBEXPR:
+ case ID_SUPEXPR:
+ case ID_SUBSUPEXPR:
+ makeSubSup(tmp);
+ break;
+ case ID_FRACTIONEXPR:
+ case ID_OVER:
+ makeFraction(tmp);
+ break;
+ case ID_DECORATIONEXPR:
+ makeDecoration(tmp);
+ break;
+ case ID_SQRTEXPR:
+ case ID_ROOTEXPR:
+ makeRoot(tmp);
+ break;
+ case ID_ARROWEXPR:
+ makeArrow(tmp);
+ break;
+ case ID_ACCENTEXPR:
+ makeAccent(tmp);
+ break;
+ case ID_PARENTH:
+ case ID_ABS:
+ makeParenth(tmp);
+ break;
+ case ID_FENCE:
+ makeFence(tmp);
+ break;
+ case ID_BLOCK:
+ makeBlock(tmp);
+ case ID_BEGIN:
+ makeBegin(tmp);
+ case ID_END:
+ makeEnd(tmp);
+ break;
+ }
+}
+
+void Formula::makeIdentifier(Node *res)
+{
+ Node *tmp = res;
+ if( !tmp ) return;
+ if( !tmp->value ) return;
+ switch( tmp->id ){
+ case ID_CHARACTER :
+#ifdef DEBUG
+ inds;
+ fprintf(stderr,"<math:mi>%s</math:mi>\n",tmp->value);
+ indo;
+#else
+ rstartEl(ascii("math:mi"), rList);
+ rchars(tmp->value);
+ rendEl(ascii("math:mi"));
+#endif
+ break;
+ case ID_STRING :
+ {
+#ifdef DEBUG
+#else
+ rstartEl(ascii("math:mi"), rList);
+ reucstr(tmp->value, strlen(tmp->value));
+ rendEl(ascii("math:mi"));
+#endif
+ }
+ break;
+ case ID_IDENTIFIER :
+#ifdef DEBUG
+ inds;
+ fprintf(stderr,"<math:mi>%s</math:mi>\n",getMathMLEntity(tmp->value, entity));
+ indo;
+#else
+ rstartEl(ascii("math:mi"), rList);
+ runistr(getMathMLEntity(tmp->value, entity));
+ rendEl(ascii("math:mi"));
+#endif
+ break;
+ case ID_NUMBER :
+#ifdef DEBUG
+ inds;
+ fprintf(stderr,"<math:mn>%s</math:mn>\n",tmp->value);
+ indo;
+#else
+ rstartEl(ascii("math:mn"), rList);
+ rchars(tmp->value);
+ rendEl(ascii("math:mn"));
+#endif
+ break;
+ case ID_OPERATOR :
+ case ID_DELIMETER :
+ {
+#ifdef DEBUG
+ inds; fprintf(stderr,"<math:mo>%s</math:mo>\n",tmp->value); indo;
+#else
+ rstartEl(ascii("math:mo"), rList);
+ runistr(getMathMLEntity(tmp->value,entity));
+ rendEl(ascii("math:mo"));
+#endif
+ break;
+ }
+ }
+}
+void Formula::makePrimary(Node *res)
+{
+ Node *tmp = res;
+ if( !tmp ) return ;
+ if( tmp->child ){
+ if( tmp->child->id == ID_PRIMARYEXPR ){
+ makePrimary(tmp->child);
+ }
+ else{
+ makeIdentifier(tmp->child);
+ }
+ }
+ if( tmp->next ){
+ makeIdentifier(tmp->next);
+ }
+}
+
+void Formula::makeSubSup(Node *res)
+{
+ Node *tmp = res;
+ if( !tmp ) return;
+
+#ifdef DEBUG
+ inds;
+ if( res->id == ID_SUBEXPR )
+ fprintf(stderr,"<math:msub>\n");
+ else if( res->id == ID_SUPEXPR )
+ fprintf(stderr,"<math:msup>\n");
+ else
+ fprintf(stderr,"<math:msubsup>\n");
+#else
+ if( res->id == ID_SUBEXPR )
+ rstartEl(ascii("math:msub"), rList);
+ else if( res->id == ID_SUPEXPR )
+ rstartEl(ascii("math:msup"), rList);
+ else
+ rstartEl(ascii("math:msubsup"), rList);
+#endif
+
+ tmp = tmp->child;
+ if( res->id == ID_SUBSUPEXPR ) {
+ makeExpr(tmp);
+ makeBlock(tmp->next);
+ makeBlock(tmp->next->next);
+ }
+ else{
+ makeExpr(tmp);
+ makeExpr(tmp->next);
+ }
+
+#ifdef DEBUG
+ inde;
+ if( res->id == ID_SUBEXPR )
+ fprintf(stderr,"</math:msub>\n");
+ else if( res->id == ID_SUPEXPR )
+ fprintf(stderr,"</math:msup>\n");
+ else
+ fprintf(stderr,"</math:msubsup>\n");
+#else
+ if( res->id == ID_SUBEXPR )
+ rendEl(ascii("math:msub"));
+ else if( res->id == ID_SUPEXPR )
+ rendEl(ascii("math:msup"));
+ else
+ rendEl(ascii("math:msubsup"));
+#endif
+}
+
+void Formula::makeFraction(Node *res)
+{
+ Node *tmp = res;
+ if( !tmp ) return;
+
+#ifdef DEBUG
+ inds;
+ fprintf(stderr,"<math:mfrac>\n");
+#else
+ rstartEl(ascii("math:mfrac"), rList);
+#endif
+
+ tmp = tmp->child;
+#ifdef DEBUG
+ inds;
+ fprintf(stderr,"<math:mrow>\n");
+#else
+ rstartEl(ascii("math:mrow"), rList);
+#endif
+
+ if( res->id == ID_FRACTIONEXPR )
+ makeBlock(tmp);
+ else
+ makeExprList(tmp);
+
+#ifdef DEBUG
+ inde;
+ fprintf(stderr,"</math:mrow>\n");
+ inds;
+ fprintf(stderr,"<math:mrow>\n");
+#else
+ rendEl(ascii("math:mrow"));
+ rstartEl(ascii("math:mrow"), rList);
+#endif
+
+ if( res->id == ID_FRACTIONEXPR )
+ makeBlock(tmp->next);
+ else
+ makeExprList(tmp->next);
+
+#ifdef DEBUG
+ inde;
+ fprintf(stderr,"</math:mrow>\n");
+ inde;
+ fprintf(stderr,"</math:mfrac>\n");
+#else
+ rendEl(ascii("math:mrow"));
+ rendEl(ascii("math:mfrac"));
+#endif
+}
+
+void Formula::makeDecoration(Node *res)
+{
+ int isover = 1;
+ Node *tmp = res->child;
+ if( !tmp ) return;
+ if( !strncmp(tmp->value,"under", 5) )
+ isover = 0;
+#ifdef DEBUG
+ inds;
+ if( isover )
+ fprintf(stderr,"<math:mover>\n");
+ else
+ fprintf(stderr,"<math:munder>\n");
+#else
+ /* accent´Â ¾ðÁ¦ trueÀÌ°í, ¾ðÁ¦, falseÀÎÁö ¸ð¸£°Ú´Ù. */
+ if( isover ){
+ padd(ascii("accent"),ascii("CDATA"),ascii("true"));
+ rstartEl(ascii("math:mover"), rList);
+ }
+ else{
+ padd(ascii("accentunder"),ascii("CDATA"),ascii("true"));
+ rstartEl(ascii("math:munder"), rList);
+ }
+ pList->clear();
+#endif
+
+ makeBlock(tmp->next);
+
+#ifdef DEBUG
+ inds;
+ fprintf(stderr,"<math:mo>%s</math:mo>\n", getMathMLEntity(tmp->value,entity));
+ indo;
+#else
+ rstartEl(ascii("math:mo"), rList);
+ runistr(getMathMLEntity(tmp->value,entity));
+ rendEl(ascii("math:mo"));
+#endif
+
+#ifdef DEBUG
+ inde;
+ if( isover )
+ fprintf(stderr,"</math:mover>\n");
+ else
+ fprintf(stderr,"</math:munder>\n");
+#else
+ if( isover )
+ rendEl(ascii("math:mover"));
+ else
+ rendEl(ascii("math:munder"));
+#endif
+}
+
+void Formula::makeRoot(Node *res)
+{
+ Node *tmp = res;
+ if( !tmp ) return;
+#ifdef DEBUG
+ inds;
+ if( tmp->id == ID_SQRTEXPR )
+ fprintf(stderr,"<math:msqrt>\n");
+ else
+ fprintf(stderr,"<math:mroot>\n");
+#else
+ if( tmp->id == ID_SQRTEXPR )
+ rstartEl(ascii("math:msqrt"), rList);
+ else
+ rstartEl(ascii("math:mroot"), rList);
+#endif
+
+ if( tmp->id == ID_SQRTEXPR ){
+ makeBlock(tmp->child);
+ }
+ else{
+ makeBracket(tmp->child);
+ makeBlock(tmp->child->next);
+ }
+
+#ifdef DEBUG
+ inde;
+ if( tmp->id == ID_SQRTEXPR )
+ fprintf(stderr,"</math:msqrt>\n");
+ else
+ fprintf(stderr,"</math:mroot>\n");
+#else
+ if( tmp->id == ID_SQRTEXPR )
+ rendEl(ascii("math:msqrt"));
+ else
+ rendEl(ascii("math:mroot"));
+#endif
+}
+// DVO: add space to avoid warning
+void Formula::makeArrow(Node * /*res*/)
+{
+}
+void Formula::makeAccent(Node *res)
+{
+ makeDecoration( res );
+}
+void Formula::makeParenth(Node *res)
+{
+ Node *tmp = res;
+ if( !tmp ) return;
+#ifdef DEBUG
+ inds;
+ fprintf(stderr,"<math:mrow>\n");
+ inds;
+ if( tmp->id == ID_PARENTH ){
+ fprintf(stderr,"<math:mo>(</math:mo>\n");
+ }
+ else
+ fprintf(stderr,"<math:mo>|</math:mo>\n");
+ indo; inds;
+ fprintf(stderr,"<math:mrow>\n");
+#else
+ rstartEl(ascii("math:mrow"), rList);
+ rstartEl(ascii("math:mo"), rList);
+ if( tmp->id == ID_PARENTH )
+ rchars("(");
+ else
+ rchars("|");
+ rendEl(ascii("math:mo"));
+ rstartEl(ascii("math:mrow"), rList);
+#endif
+
+ if( tmp->child )
+ makeExprList(tmp->child);
+
+#ifdef DEBUG
+ inde;
+ fprintf(stderr,"</math:mrow>\n");
+ inds;
+ if( tmp->id == ID_PARENTH )
+ fprintf(stderr,"<math:mo>)</math:mo>\n");
+ else
+ fprintf(stderr,"<math:mo>|</math:mo>\n");
+ indo;
+ inde;
+ fprintf(stderr,"</math:mrow>\n");
+#else
+ rendEl(ascii("math:mrow"));
+ rstartEl(ascii("math:mo"), rList);
+ if( tmp->id == ID_PARENTH )
+ rchars(")");
+ else
+ rchars("|");
+ rendEl(ascii("math:mo"));
+ rendEl(ascii("math:mrow"));
+#endif
+}
+
+void Formula::makeFence(Node *res)
+{
+ Node *tmp = res->child;
+#ifdef DEBUG
+ inds;
+ fprintf(stderr,"<math:mfenced open=\"%s\" close=\"%s\">\n",getMathMLEntity(tmp->value, entity),
+ getMathMLEntity(tmp->next->next->value,entity));
+#else
+ padd(ascii("open"), ascii("CDATA"), OUString(getMathMLEntity(tmp->value,entity)) );
+ padd(ascii("close"), ascii("CDATA"), OUString(getMathMLEntity(tmp->next->next->value,entity)) );
+ rstartEl(ascii("math:mfenced"), rList);
+ pList->clear();
+#endif
+
+ makeExprList(tmp->next);
+
+#ifdef DEBUG
+ inde;
+ fprintf(stderr,"</math:mfenced>\n");
+#else
+ rendEl(ascii("math:mfenced"));
+#endif
+}
+
+void Formula::makeBracket(Node *res)
+{
+ makeBlock(res);
+}
+
+void Formula::makeBlock(Node *res)
+{
+#ifdef DEBUG
+ inds;
+ fprintf(stderr,"<math:mrow>\n");
+#else
+ rstartEl(ascii("math:mrow"), rList);
+#endif
+
+ if( res->child )
+ makeExprList(res->child);
+
+#ifdef DEBUG
+ inde;
+ fprintf(stderr,"</math:mrow>\n");
+#else
+ rendEl(ascii("math:mrow"));
+#endif
+}
+
+// DVO: add space to avoid warning
+void Formula::makeBegin(Node * /*res*/)
+{
+}
+
+// DVO: add space to avoid warning
+void Formula::makeEnd(Node * /*res*/)
+{
+}
+
+int Formula::parse()
+{
+ Node *res = 0L;
+ if( !eq ) return 0;
+ if( isHwpEQ ){
+ MzString a;
+ // fprintf(stderr,"\n\n[BEFORE]\n[%s]\n",eq);
+ eq2latex(a,eq);
+
+ int idx=a.find(sal::static_int_cast<char>(0xff));
+ while(idx){
+ //printf("idx = [%d]\n",idx);
+ a.replace(idx,0x20);
+ if((idx = a.find(sal::static_int_cast<char>(0xff),idx+1)) < 0)
+ break;
+ }
+
+ char *buf = (char *)malloc(a.length()+1);
+ bool bStart = false;
+ int i, j;
+ for( i = 0, j=0 ; i < a.length() ; i++){ // rtrim and ltrim 32 10 13
+ if( bStart ){
+ buf[j++] = a[i];
+ }
+ else{
+ if( a[i] != 32 && a[i] != 10 && a[i] != 13){
+ bStart = true;
+ buf[j++] = a[i];
+ }
+ }
+ }
+ buf[j] = 0;
+ for( i = j-1 ; i >= 0 ; i++ ){
+ if( buf[i] == 32 || buf[i] == 10 || buf[i] == 13 ){
+ buf[i] = 0;
+ }
+ else
+ break;
+ }
+ // fprintf(stderr,"\n\n[RESULT]\n[%s]\n",a.c_str());
+ if( strlen(buf) > 0 )
+ res = mainParse( a.c_str() );
+ else
+ res = 0L;
+ free(buf);
+ }
+ else{
+ res = mainParse( eq );
+ }
+
+ if( res ){
+ makeMathML( res );
+ }
+ Node *tmpNode;
+ int count = nodelist.count();
+ for( int i = 0 ; i < count ; i++ ){
+ tmpNode = nodelist.remove(0);
+ delete tmpNode;
+ }
+
+ return 0;
+}
+
+void Formula::trim()
+{
+ int len = strlen(eq);
+ char *buf = (char *)malloc(len+1);
+ bool bStart = false;
+ int i, j;
+ for( i = 0, j=0 ; i < len ; i++){ // rtrim and ltrim 32 10 13
+ if( bStart ){
+ buf[j++] = eq[i];
+ }
+ else{
+ if( eq[i] != 32 && eq[i] != 10 && eq[i] != 13){
+ bStart = true;
+ buf[j++] = eq[i];
+ }
+ }
+ }
+ buf[j] = 0;
+ for( i = j-1 ; i >= 0 ; i++ ){
+ if( buf[i] == 32 || buf[i] == 10 || buf[i] == 13 ){
+ buf[i] = 0;
+ }
+ else
+ break;
+ }
+ if( strlen(buf) > 0 )
+ strcpy(eq, buf);
+ else
+ eq = 0L;
+ free(buf);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/hwpfilter/source/grammar.cpp b/hwpfilter/source/grammar.cpp
deleted file mode 100644
index 3bd9528..0000000
--- a/hwpfilter/source/grammar.cpp
+++ /dev/null
@@ -1,1456 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-/* A Bison parser, made from grammar.y
- by GNU Bison version 1.28 */
-
-#define YYBISON 1 /* Identify Bison output. */
-
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#ifndef YYMAXDEPTH
-#define YYMAXDEPTH 0
-#endif
-
-#define ACCENT 257
-#define SMALL_GREEK 258
-#define CAPITAL_GREEK 259
-#define BINARY_OPERATOR 260
-#define RELATION_OPERATOR 261
-#define ARROW 262
-#define GENERAL_IDEN 263
-#define GENERAL_OPER 264
-#define BIG_SYMBOL 265
-#define FUNCTION 266
-#define ROOT 267
-#define FRACTION 268
-#define SUBSUP 269
-#define EQOVER 270
-#define DELIMETER 271
-#define LARGE_DELIM 272
-#define DECORATION 273
-#define SPACE_SYMBOL 274
-#define CHARACTER 275
-#define STRING 276
-#define OPERATOR 277
-#define EQBEGIN 278
-#define EQEND 279
-#define EQLEFT 280
-#define EQRIGHT 281
-#define NEWLINE 282
-#define LEFT_DELIM 283
-#define RIGHT_DELIM 284
-#define DIGIT 285
-
-#line 1 "grammar.y"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "nodes.h"
-
-LinkedList<Node> nodelist;
-
-Node *mainParse(const char *_code);
-void yyerror(const char *);
-int yylex();
-void initFlex( const char *s );
-void viewResult(Node *res);
-
-Node *top=0L;
-
-int Node::count = 0;
-
-#define allocValue(x,y) \
-x = (char *)malloc( strlen(y) +1 ); \
-strcpy(x,y)
-
-#define allocChar(x,y) \
-x = (char *)malloc(2); \
-sprintf(x,"%c",y)
-#ifdef PARSE_DEBUG
-#define debug printf
-#else
-int debug(const char *format, ...);
-#endif
-
-
-#line 35 "grammar.y"
-typedef union {
- char *dval;
- char *str;
- Node *ptr;
-} YYSTYPE;
-#include <stdio.h>
-
-#ifndef __cplusplus
-#ifndef __STDC__
-#define const
-#endif
-#endif
-
-
-
-#define YYFINAL 102
-#define YYFLAG -32768
-#define YYNTBASE 43
-
-#define YYTRANSLATE(x) ((unsigned)(x) <= 285 ? yytranslate[x] : 66)
-
-static const char yytranslate[] = { 0,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 33,
- 37, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 36,
- 2, 40, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 34, 2, 38, 42, 41, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 35, 32, 39, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31
-};
-
-#if YYDEBUG != 0
-static const short yyprhs[] = { 0,
- 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
- 20, 22, 24, 26, 28, 30, 32, 34, 36, 39,
- 42, 45, 48, 51, 54, 58, 60, 63, 66, 69,
- 72, 75, 79, 81, 85, 89, 92, 96, 99, 103,
- 106, 110, 114, 120, 124, 130, 132, 135, 137, 140,
- 143, 147, 150, 154, 157, 159, 161, 165, 167, 169,
- 172, 174, 176, 178, 180, 182, 184, 186, 188, 190,
- 192, 194
-};
-
-static const short yyrhs[] = { 4,
- 0, 9, 0, 10, 0, 5, 0, 11, 0, 12,
- 0, 20, 0, 21, 0, 7, 0, 6, 0, 23,
- 0, 17, 0, 18, 0, 8, 0, 32, 0, 31,
- 0, 22, 0, 43, 0, 44, 43, 0, 26, 33,
- 0, 26, 34, 0, 26, 35, 0, 26, 36, 0,
- 26, 32, 0, 26, 32, 32, 0, 29, 0, 27,
- 37, 0, 27, 38, 0, 27, 39, 0, 27, 40,
- 0, 27, 32, 0, 27, 32, 32, 0, 30, 0,
- 45, 64, 46, 0, 33, 64, 37, 0, 33, 37,
- 0, 35, 64, 39, 0, 35, 39, 0, 34, 64,
- 38, 0, 34, 38, 0, 65, 41, 65, 0, 65,
- 42, 65, 0, 65, 41, 49, 42, 49, 0, 14,
- 49, 49, 0, 35, 64, 16, 64, 39, 0, 3,
- 0, 54, 49, 0, 19, 0, 56, 49, 0, 13,
- 49, 0, 13, 50, 49, 0, 24, 49, 0, 24,
- 49, 49, 0, 25, 49, 0, 62, 0, 63, 0,
- 62, 28, 63, 0, 64, 0, 65, 0, 64, 65,
- 0, 49, 0, 48, 0, 47, 0, 51, 0, 52,
- 0, 53, 0, 57, 0, 58, 0, 55, 0, 44,
- 0, 59, 0, 60, 0
-};
-
-#endif
-
-#if YYDEBUG != 0
-static const short yyrline[] = { 0,
- 59, 61, 62, 63, 64, 65, 66, 67, 68, 69,
- 70, 71, 72, 73, 74, 75, 76, 79, 81, 84,
- 86, 87, 88, 89, 90, 91, 94, 96, 97, 98,
- 99, 100, 101, 104, 108, 110, 113, 115, 118, 120,
- 123, 125, 126, 129, 133, 138, 142, 145, 149, 153,
- 155, 158, 160, 163, 168, 172, 174, 177, 181, 183,
- 186, 188, 189, 190, 191, 192, 193, 194, 195, 196,
- 197, 198
-};
-#endif
-
-
-#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
-
-static const char * const yytname[] = { "$","error","$undefined.","ACCENT",
-"SMALL_GREEK","CAPITAL_GREEK","BINARY_OPERATOR","RELATION_OPERATOR","ARROW",
-"GENERAL_IDEN","GENERAL_OPER","BIG_SYMBOL","FUNCTION","ROOT","FRACTION","SUBSUP",
-"EQOVER","DELIMETER","LARGE_DELIM","DECORATION","SPACE_SYMBOL","CHARACTER","STRING",
-"OPERATOR","EQBEGIN","EQEND","EQLEFT","EQRIGHT","NEWLINE","LEFT_DELIM","RIGHT_DELIM",
-"DIGIT","'|'","'('","'['","'{'","'<'","')'","']'","'}'","'>'","'_'","'^'","Identifier",
-"PrimaryExpr","EQLeft","EQRight","Fence","Parenth","Block","Bracket","SubSupExpr",
-"FractionExpr","OverExpr","Accent","AccentExpr","Decoration","DecorationExpr",
-"RootExpr","BeginExpr","EndExpr","MathML","Lines","Line","ExprList","Expr", NULL
-};
-#endif
-
-static const short yyr1[] = { 0,
- 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 44, 44, 45,
- 45, 45, 45, 45, 45, 45, 46, 46, 46, 46,
- 46, 46, 46, 47, 48, 48, 49, 49, 50, 50,
- 51, 51, 51, 52, 53, 54, 55, 56, 57, 58,
- 58, 59, 59, 60, 61, 62, 62, 63, 64, 64,
- 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65
-};
-
-static const short yyr2[] = { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
- 2, 2, 2, 2, 3, 1, 2, 2, 2, 2,
- 2, 3, 1, 3, 3, 2, 3, 2, 3, 2,
- 3, 3, 5, 3, 5, 1, 2, 1, 2, 2,
- 3, 2, 3, 2, 1, 1, 3, 1, 1, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1
-};
-
-static const short yydefact[] = { 0,
- 46, 1, 4, 10, 9, 14, 2, 3, 5, 6,
- 0, 0, 12, 13, 48, 7, 8, 17, 11, 0,
- 0, 0, 26, 16, 15, 0, 0, 18, 70, 0,
- 63, 62, 61, 64, 65, 66, 0, 69, 0, 67,
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list