21/08/2013 11:45, Jean-Marc Lasgouttes:
21/08/2013 11:35, Jean-Marc Lasgouttes:
20/08/2013 16:38, Stephan Witt:
For the Encoding class I've made a patch for review.
Here is an easy one: Lexer.cpp
Second easy one: ModuleList.cpp.
Then I move those dummy definitions in their own file.
BTW, Enrico, my light testing seems to show that declaring
LyXRC::iconset is not needed. Do you remember why you introduced it at
a99340cd ?
Next in line: Layout.cpp, which uses LAYOUT_NO_CSS to try to trick us.
JMarc
>From b2411f13539d823d09b7582203db98c48036b345 Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Wed, 21 Aug 2013 12:20:20 +0200
Subject: [PATCH] Move tex2lyx dummy implementations in their own file.
Also try to document their use.
---
src/tex2lyx/Makefile.am | 1 +
src/tex2lyx/dummy_impl.cpp | 120 ++++++++++++++++++++++++++++++++++++++++++++
src/tex2lyx/tex2lyx.cpp | 66 ------------------------
3 files changed, 121 insertions(+), 66 deletions(-)
create mode 100644 src/tex2lyx/dummy_impl.cpp
diff --git a/src/tex2lyx/Makefile.am b/src/tex2lyx/Makefile.am
index 9ebbdc0..cdfd98a 100644
--- a/src/tex2lyx/Makefile.am
+++ b/src/tex2lyx/Makefile.am
@@ -88,6 +88,7 @@ tex2lyx_SOURCES = \
boost.cpp \
Context.cpp \
Context.h \
+ dummy_impl.cpp \
math.cpp \
Parser.cpp \
Parser.h \
diff --git a/src/tex2lyx/dummy_impl.cpp b/src/tex2lyx/dummy_impl.cpp
new file mode 100644
index 0000000..c32c633
--- /dev/null
+++ b/src/tex2lyx/dummy_impl.cpp
@@ -0,0 +1,120 @@
+/**
+ * \file dummy_impl.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Jean-Marc Lasgouttes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+/**
+ * This file contains dummy implementation of some methods that are
+ * needed byclasses used by tex2lyx. This allows to reduce the number
+ * of classes we have to link against.
+*/
+
+// {[(
+
+#include <config.h>
+
+#include "Format.h"
+#include "LaTeXFeatures.h"
+
+#include "support/Messages.h"
+
+#include <iostream>
+
+using namespace std;
+
+namespace lyx {
+
+//
+// Dummy Alert support (needed by TextClass)
+//
+
+
+namespace frontend {
+namespace Alert {
+ void warning(docstring const & title, docstring const & message,
+ bool const &)
+ {
+ cerr << to_utf8(title) << "\n" << to_utf8(message) << endl;
+ }
+}
+}
+
+
+//
+// Dummy TexRow support (needed by docstream)
+//
+
+
+void TexRow::newline()
+{}
+
+
+void TexRow::newlines(int)
+{}
+
+
+//
+// Dummy LyXRC support
+//
+
+//FIXME This does not seem to be needed after all
+class LyXRC {
+public:
+ string icon_set;
+} lyxrc;
+
+
+//
+// Dummy translation support (needed at many places)
+//
+
+
+Messages messages_;
+Messages const & getMessages(string const &)
+{
+ return messages_;
+}
+
+
+Messages const & getGuiMessages()
+{
+ return messages_;
+}
+
+
+//
+// Dummy formats support (needed by Lexer)
+//
+
+Formats formats;
+
+bool Formats::isZippedFile(support::FileName const&) const
+{
+ return false;
+}
+
+
+//
+// Dummy features support (needed by ModuleList)
+//
+
+
+bool LaTeXFeatures::isAvailable(string const &)
+{
+ return true;
+}
+
+
+//
+// Keep the linker happy on Windows
+//
+
+void lyx_exit(int)
+{}
+
+}
diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp
index f750f42..8772d6b 100644
--- a/src/tex2lyx/tex2lyx.cpp
+++ b/src/tex2lyx/tex2lyx.cpp
@@ -17,8 +17,6 @@
#include "Context.h"
#include "Encoding.h"
-#include "Format.h"
-#include "LaTeXFeatures.h"
#include "Layout.h"
#include "LayoutFile.h"
#include "LayoutModuleList.h"
@@ -31,7 +29,6 @@
#include "support/filetools.h"
#include "support/lassert.h"
#include "support/lstrings.h"
-#include "support/Messages.h"
#include "support/os.h"
#include "support/Package.h"
#include "support/Systemcall.h"
@@ -50,69 +47,6 @@ using namespace lyx::support::os;
namespace lyx {
-namespace frontend {
-namespace Alert {
- void warning(docstring const & title, docstring const & message,
- bool const &)
- {
- cerr << to_utf8(title) << "\n" << to_utf8(message) << endl;
- }
-}
-}
-
-
-// Dummy texrow support
-void TexRow::newline()
-{}
-
-
-void TexRow::newlines(int)
-{}
-
-
-// Dummy LyXRC support
-class LyXRC {
-public:
- string icon_set;
-} lyxrc;
-
-
-// Dummy translation support
-Messages messages_;
-Messages const & getMessages(string const &)
-{
- return messages_;
-}
-
-
-Messages const & getGuiMessages()
-{
- return messages_;
-}
-
-
-// tex2lyx does not read lyxrc and therefore can't really check for
-// zipped formats (Used by lexer)
-
-Formats formats;
-
-bool Formats::isZippedFile(FileName const&) const
-{
- return false;
-}
-
-
-bool LaTeXFeatures::isAvailable(string const &)
-{
- return true;
-}
-
-
-// Keep the linker happy on Windows
-void lyx_exit(int)
-{}
-
-
string const trimSpaceAndEol(string const & a)
{
return trim(a, " \t\n\r");
--
1.7.0.4