From 36ad5567a4aae912bfa2a54b3857f9832b108996 Mon Sep 17 00:00:00 2001
From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com>
Date: Mon, 23 Oct 2017 15:23:48 -0700
Subject: [PATCH] Fixed linux build
---
Makefile.am | 2 -
api/sourcefiles.mak | 81 ++++++++++++------------
moo/Makefile.am | 1 +
moo/mooapp/Makefile.incl | 8 +--
moo/mooapp/moohtml.cpp | 2 +-
moo/moocpp/Makefile.incl | 12 ++++
moo/moocpp/fileutils.cpp | 2 -
moo/moocpp/fileutils.h | 6 +-
moo/moocpp/gstr.cpp | 2 -
moo/moocpp/gstr.h | 23 ++++---
moo/moocpp/regex.cpp | 2 -
moo/mooedit/Makefile.incl | 38 +++++------
moo/mooedit/mooedit-enum-types.c | 14 ----
moo/mooedit/mooedit-enum-types.h | 13 ----
moo/mooglib/moo-glib.h | 22 +++++++
moo/moopython/Makefile.incl | 2 +-
moo/moopython/moopython-utils.h | 14 ++--
moo/moopython/pygtk/Makefile.incl | 4 +-
moo/mooutils/Makefile.incl | 12 ++--
moo/mooutils/moo-test-utils.cpp | 2 +-
moo/mooutils/moofilewatch.c | 2 +
moo/mooutils/mooutils-enums.c | 11 ----
moo/mooutils/mooutils-enums.h | 7 --
moo/mooutils/mooutils-fs.cpp | 5 +-
moo/plugins/Makefile.incl | 10 +--
moo/plugins/support/Makefile.incl | 8 +--
moo/plugins/usertools/Makefile.incl | 14 ++--
moo/plugins/usertools/moocommand-exe.cpp | 2 +-
28 files changed, 159 insertions(+), 162 deletions(-)
create mode 100644 moo/moocpp/Makefile.incl
diff --git a/Makefile.am b/Makefile.am
index b499a491..bd1718d9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,8 +17,6 @@ endif
CLEANFILES =
-MOO_INTL
-
include plat/win32/Makefile.incl
if MOO_OS_WIN32
diff --git a/api/sourcefiles.mak b/api/sourcefiles.mak
index d22dfa5f..d45070f0 100644
--- a/api/sourcefiles.mak
+++ b/api/sourcefiles.mak
@@ -1,72 +1,71 @@
source_files = \
../moo/moolua/medit-lua.h\
../moo/moolua/medit-lua.cpp\
- ../moo/mooapp/mooappabout.c\
+ ../moo/mooapp/mooappabout.cpp\
../moo/mooapp/mooappabout.h\
../moo/mooapp/mooapp-accels.h\
- ../moo/mooapp/mooapp.c\
+ ../moo/mooapp/mooapp.cpp\
../moo/mooapp/mooapp.h\
../moo/mooapp/mooapp-info.h\
../moo/mooapp/mooapp-private.h\
- ../moo/mooapp/moohtml.c\
+ ../moo/mooapp/moohtml.cpp\
../moo/mooapp/moohtml.h\
- ../moo/mooapp/moolinklabel.c\
+ ../moo/mooapp/moolinklabel.cpp\
../moo/mooapp/moolinklabel.h\
../moo/mooedit/mooedit-accels.h\
- ../moo/mooedit/mooeditaction.c\
- ../moo/mooedit/mooeditaction-factory.c\
+ ../moo/mooedit/mooeditaction.cpp\
+ ../moo/mooedit/mooeditaction-factory.cpp\
../moo/mooedit/mooeditaction-factory.h\
../moo/mooedit/mooeditaction.h\
- ../moo/mooedit/mooeditbookmark.c\
+ ../moo/mooedit/mooeditbookmark.cpp\
../moo/mooedit/mooeditbookmark.h\
../moo/mooedit/mooedit.cpp\
- ../moo/mooedit/mooeditconfig.c\
+ ../moo/mooedit/mooeditconfig.cpp\
../moo/mooedit/mooeditconfig.h\
../moo/mooedit/mooeditdialogs.cpp\
../moo/mooedit/mooeditdialogs.h\
../moo/mooedit/mooedit-enum-types.c\
../moo/mooedit/mooedit-enum-types.h\
../moo/mooedit/mooedit-enums.h\
- ../moo/mooedit/mooeditfileinfo.c\
- ../moo/mooedit/mooeditfileinfo.c\
+ ../moo/mooedit/mooeditfileinfo.cpp\
../moo/mooedit/mooeditfileinfo.h\
../moo/mooedit/mooedit-fileops.cpp\
../moo/mooedit/mooedit-fileops.h\
- ../moo/mooedit/mooeditfiltersettings.c\
+ ../moo/mooedit/mooeditfiltersettings.cpp\
../moo/mooedit/mooeditfiltersettings.h\
../moo/mooedit/mooedit.h\
- ../moo/mooedit/mooedithistoryitem.c\
+ ../moo/mooedit/mooedithistoryitem.cpp\
../moo/mooedit/mooedithistoryitem.h\
../moo/mooedit/mooedit-impl.h\
../moo/mooedit/mooeditor.cpp\
../moo/mooedit/mooeditor.h\
../moo/mooedit/mooeditor-impl.h\
../moo/mooedit/mooeditor-private.h\
- ../moo/mooedit/mooeditor-tests.c\
+ ../moo/mooedit/mooeditor-tests.cpp\
../moo/mooedit/mooeditor-tests.h\
- ../moo/mooedit/mooeditprefs.c\
+ ../moo/mooedit/mooeditprefs.cpp\
../moo/mooedit/mooeditprefs.h\
- ../moo/mooedit/mooeditprefspage.c\
+ ../moo/mooedit/mooeditprefspage.cpp\
../moo/mooedit/mooedit-private.h\
- ../moo/mooedit/mooedit-script.c\
+ ../moo/mooedit/mooedit-script.cpp\
../moo/mooedit/mooedit-script.h\
- ../moo/mooedit/mooedittab.c\
+ ../moo/mooedit/mooedittab.cpp\
../moo/mooedit/mooedittab.h\
../moo/mooedit/mooedittypes.h\
- ../moo/mooedit/mooeditview.c\
+ ../moo/mooedit/mooeditview.cpp\
../moo/mooedit/mooeditview.h\
- ../moo/mooedit/mooeditview-script.c\
+ ../moo/mooedit/mooeditview-script.cpp\
../moo/mooedit/mooeditview-script.h\
- ../moo/mooedit/mooeditwindow.c\
+ ../moo/mooedit/mooeditwindow.cpp\
../moo/mooedit/mooeditwindow.h\
../moo/mooedit/mooeditwindow-impl.h\
- ../moo/mooedit/moofold.c\
+ ../moo/mooedit/moofold.cpp\
../moo/mooedit/moofold.h\
- ../moo/mooedit/mooindenter.c\
+ ../moo/mooedit/mooindenter.cpp\
../moo/mooedit/mooindenter.h\
- ../moo/mooedit/moolang.c\
+ ../moo/mooedit/moolang.cpp\
../moo/mooedit/moolang.h\
- ../moo/mooedit/moolangmgr.c\
+ ../moo/mooedit/moolangmgr.cpp\
../moo/mooedit/moolangmgr.h\
../moo/mooedit/moolangmgr-private.h\
../moo/mooedit/moolang-private.h\
@@ -131,7 +130,7 @@ source_files = \
../moo/moofileview/mootreeview.h\
../moo/mooutils/mooaccelbutton.c\
../moo/mooutils/mooaccelbutton.h\
- ../moo/mooutils/mooaccel.c\
+ ../moo/mooutils/mooaccel.cpp\
../moo/mooutils/mooaccel.h\
../moo/mooutils/mooaccelprefs.c\
../moo/mooutils/mooaccelprefs.h\
@@ -176,7 +175,7 @@ source_files = \
../moo/mooutils/moofileicon.h\
../moo/mooutils/moofilewatch.c\
../moo/mooutils/moofilewatch.h\
- ../moo/mooutils/moofilewriter.c\
+ ../moo/mooutils/moofilewriter.cpp\
../moo/mooutils/moofilewriter.h\
../moo/mooutils/moofilewriter-private.h\
../moo/mooutils/moofiltermgr.c\
@@ -193,7 +192,7 @@ source_files = \
../moo/mooutils/moohistorylist.h\
../moo/mooutils/moohistorymgr.c\
../moo/mooutils/moohistorymgr.h\
- ../moo/mooutils/mooi18n.c\
+ ../moo/mooutils/mooi18n.cpp\
../moo/mooutils/mooi18n.h\
../moo/mooutils/moolist.h\
../moo/mooutils/moomarkup.c\
@@ -226,7 +225,7 @@ source_files = \
../moo/mooutils/moostock.c\
../moo/mooutils/moostock.h\
../moo/mooutils/moo-test-macros.h\
- ../moo/mooutils/moo-test-utils.c\
+ ../moo/mooutils/moo-test-utils.cpp\
../moo/mooutils/moo-test-utils.h\
../moo/mooutils/mootypedecl-macros.h\
../moo/mooutils/mootype-macros.h\
@@ -239,9 +238,9 @@ source_files = \
../moo/mooutils/mooutils-enums.h\
../moo/mooutils/mooutils-file.c\
../moo/mooutils/mooutils-file.h\
- ../moo/mooutils/mooutils-fs.c\
+ ../moo/mooutils/mooutils-fs.cpp\
../moo/mooutils/mooutils-fs.h\
- ../moo/mooutils/mooutils-gobject.c\
+ ../moo/mooutils/mooutils-gobject.cpp\
../moo/mooutils/mooutils-gobject.h\
../moo/mooutils/mooutils-gobject-private.h\
../moo/mooutils/mooutils.h\
@@ -257,31 +256,31 @@ source_files = \
../moo/mooutils/mooutils-thread.h\
../moo/mooutils/mooutils-treeview.c\
../moo/mooutils/mooutils-treeview.h\
- ../moo/mooutils/mooutils-win32.c\
+ ../moo/mooutils/mooutils-win32.cpp\
../moo/mooutils/moowin32/mingw/fnmatch.h\
../moo/mooutils/moowin32/mingw/netinet/in.h\
../moo/mooutils/moowin32/ms/sys/time.h\
../moo/mooutils/moowin32/ms/unistd.h\
../moo/mooutils/moowindow.c\
../moo/mooutils/moowindow.h\
- ../moo/plugins/support/moocmdview.c\
+ ../moo/plugins/support/moocmdview.cpp\
../moo/plugins/support/moocmdview.h\
- ../moo/plugins/support/mooeditwindowoutput.c\
+ ../moo/plugins/support/mooeditwindowoutput.cpp\
../moo/plugins/support/mooeditwindowoutput.h\
- ../moo/plugins/support/moolineview.c\
+ ../moo/plugins/support/moolineview.cpp\
../moo/plugins/support/moolineview.h\
- ../moo/plugins/support/moooutputfilter.c\
+ ../moo/plugins/support/moooutputfilter.cpp\
../moo/plugins/support/moooutputfilter.h\
- ../moo/plugins/usertools/moocommand.c\
- ../moo/plugins/usertools/moocommanddisplay.c\
+ ../moo/plugins/usertools/moocommand.cpp\
+ ../moo/plugins/usertools/moocommanddisplay.cpp\
../moo/plugins/usertools/moocommanddisplay.h\
../moo/plugins/usertools/moocommand.h\
../moo/plugins/usertools/moocommand-private.h\
- ../moo/plugins/usertools/moooutputfilterregex.c\
+ ../moo/plugins/usertools/moooutputfilterregex.cpp\
../moo/plugins/usertools/moooutputfilterregex.h\
- ../moo/plugins/usertools/moousertools.c\
- ../moo/plugins/usertools/moousertools-enums.c\
+ ../moo/plugins/usertools/moousertools.cpp\
+ ../moo/plugins/usertools/moousertools-enums.cpp\
../moo/plugins/usertools/moousertools-enums.h\
../moo/plugins/usertools/moousertools.h\
- ../moo/plugins/usertools/moousertools-prefs.c\
+ ../moo/plugins/usertools/moousertools-prefs.cpp\
../moo/plugins/usertools/moousertools-prefs.h
diff --git a/moo/Makefile.am b/moo/Makefile.am
index 4e579d4d..5e131aa7 100644
--- a/moo/Makefile.am
+++ b/moo/Makefile.am
@@ -49,6 +49,7 @@ include moopython/Makefile.incl
include plugins/Makefile.incl
include medit-app/Makefile.incl
include medit-module/Makefile.incl
+include moocpp/Makefile.incl
BUILT_SOURCES += $(built_moo_sources) $(built_plugins_sources)
CLEANFILES += $(built_moo_sources) $(built_plugins_sources)
diff --git a/moo/mooapp/Makefile.incl b/moo/mooapp/Makefile.incl
index bef64faf..237f85d3 100644
--- a/moo/mooapp/Makefile.incl
+++ b/moo/mooapp/Makefile.incl
@@ -1,15 +1,15 @@
moo_sources += \
- mooapp/mooappabout.c \
+ mooapp/mooappabout.cpp \
mooapp/mooappabout.h \
- mooapp/mooapp.c \
+ mooapp/mooapp.cpp \
mooapp/mooapp.h \
mooapp/mooapp-accels.h \
mooapp/mooapp-info.h \
mooapp/mooapp-private.h \
mooapp/moohtml.h \
- mooapp/moohtml.c \
+ mooapp/moohtml.cpp \
mooapp/moolinklabel.h \
- mooapp/moolinklabel.c
+ mooapp/moolinklabel.cpp
EXTRA_DIST += \
mooapp/glade/mooappabout-dialog.glade \
diff --git a/moo/mooapp/moohtml.cpp b/moo/mooapp/moohtml.cpp
index 8f4a5df7..ae97053e 100644
--- a/moo/mooapp/moohtml.cpp
+++ b/moo/mooapp/moohtml.cpp
@@ -1771,7 +1771,7 @@ static void
add_func__ (const char *static_elm_name,
ProcessElm func)
{
- g_hash_table_insert (proc_elm_funcs__, (char*) static_elm_name, func);
+ g_hash_table_insert (proc_elm_funcs__, (char*) static_elm_name, (void*) func);
}
static void
diff --git a/moo/moocpp/Makefile.incl b/moo/moocpp/Makefile.incl
new file mode 100644
index 00000000..ce338ef4
--- /dev/null
+++ b/moo/moocpp/Makefile.incl
@@ -0,0 +1,12 @@
+moo_sources += \
+ moocpp/fileutils.h \
+ moocpp/fileutils.cpp \
+ moocpp/gobjptr.h \
+ moocpp/gstr.h \
+ moocpp/gstr.cpp \
+ moocpp/moocpp.h \
+ moocpp/regex.h \
+ moocpp/regex.cpp \
+ moocpp/util.h
+
+
diff --git a/moo/moocpp/fileutils.cpp b/moo/moocpp/fileutils.cpp
index 5ce072ee..6d3b6595 100644
--- a/moo/moocpp/fileutils.cpp
+++ b/moo/moocpp/fileutils.cpp
@@ -13,8 +13,6 @@
* License along with medit. If not, see .
*/
-#pragma once
-
#include "moocpp/fileutils.h"
gstr g::build_filename_impl(const char* comp1, const char* comp2, const char* comp3)
diff --git a/moo/moocpp/fileutils.h b/moo/moocpp/fileutils.h
index 9ecddcf8..3f5a015b 100644
--- a/moo/moocpp/fileutils.h
+++ b/moo/moocpp/fileutils.h
@@ -26,19 +26,19 @@ gstr build_filename_impl(const char* comp1, const char* comp2 = nullptr, const c
template
gstr build_filename(const T1& comp1)
{
- return build_filename_impl(ConstCharSource::get(comp1));
+ return build_filename_impl(ConstCharSource::get(comp1));
}
template
gstr build_filename(const T1& comp1, const T2& comp2)
{
- return build_filename_impl(ConstCharSource::get(comp1), ConstCharSource::get(comp2));
+ return build_filename_impl(ConstCharSource::get(comp1), ConstCharSource::get(comp2));
}
template
gstr build_filename(const T1& comp1, const T2& comp2, const T3& comp3)
{
- return build_filename_impl(ConstCharSource::get(comp1), ConstCharSource::get(comp2), ConstCharSource::get(comp3));
+ return build_filename_impl(ConstCharSource::get(comp1), ConstCharSource::get(comp2), ConstCharSource::get(comp3));
}
gstr build_filenamev(const std::vector& components);
diff --git a/moo/moocpp/gstr.cpp b/moo/moocpp/gstr.cpp
index 0ac02a91..3affc841 100644
--- a/moo/moocpp/gstr.cpp
+++ b/moo/moocpp/gstr.cpp
@@ -13,8 +13,6 @@
* License along with medit. If not, see .
*/
-#pragma once
-
#include "gstr.h"
gstr::gstr()
diff --git a/moo/moocpp/gstr.h b/moo/moocpp/gstr.h
index ad31a8ae..768bbb9d 100644
--- a/moo/moocpp/gstr.h
+++ b/moo/moocpp/gstr.h
@@ -15,6 +15,10 @@
#pragma once
+#ifndef __cplusplus
+#error "This is a c++ header"
+#endif
+
#include
#include
#include
@@ -81,23 +85,24 @@ struct hash
} // namespace std
-template
-struct ConstCharSource;
-
-template<>
-struct ConstCharSource
+class ConstCharSource
{
+public:
static const char* get(const char* s) { return s; }
+
+#if 0
+template
+struct ConstCharSource
+{
+ static const char* get(char (&s)[arr_size]) { return &s[0]; }
};
template
struct ConstCharSource
{
- static const char* get(const char s[arr_size]) { return s; }
+ static const char* get(const char (&s)[arr_size]) { return &s[0]; }
};
+#endif
-template<>
-struct ConstCharSource
-{
static const char* get(const gstr& s) { return s.get(); }
};
diff --git a/moo/moocpp/regex.cpp b/moo/moocpp/regex.cpp
index f13ec657..b2e2677c 100644
--- a/moo/moocpp/regex.cpp
+++ b/moo/moocpp/regex.cpp
@@ -13,8 +13,6 @@
* License along with medit. If not, see .
*/
-#pragma once
-
#include "moocpp/regex.h"
#include "mooutils/mooutils-messages.h"
#include
diff --git a/moo/mooedit/Makefile.incl b/moo/mooedit/Makefile.incl
index d6fedcc6..6a3e49b3 100644
--- a/moo/mooedit/Makefile.incl
+++ b/moo/mooedit/Makefile.incl
@@ -24,48 +24,48 @@ moo_sources += \
mooedit/mootextiter.h \
mooedit/mootextsearch.h \
mooedit/mootextstylescheme.h \
- mooedit/mooeditview.c \
+ mooedit/mooeditview.cpp \
mooedit/mooeditview-priv.h \
mooedit/mooeditview-impl.h \
- mooedit/mooeditview-script.c \
+ mooedit/mooeditview-script.cpp \
mooedit/mooeditview-script.h \
mooedit/mooedit-accels.h \
- mooedit/mooeditaction.c \
- mooedit/mooeditaction-factory.c \
+ mooedit/mooeditaction.cpp \
+ mooedit/mooeditaction-factory.cpp\
mooedit/mooeditaction-factory.h \
- mooedit/mooeditbookmark.c \
+ mooedit/mooeditbookmark.cpp \
mooedit/mooedit.cpp \
- mooedit/mooeditconfig.c \
+ mooedit/mooeditconfig.cpp \
mooedit/mooeditdialogs.cpp \
mooedit/mooedit-enum-types.c \
mooedit/mooedit-enum-types.h \
mooedit/mooedit-enums.h \
mooedit/mooedit-fileops.cpp \
mooedit/mooedit-fileops.h \
- mooedit/mooeditfiltersettings.c \
- mooedit/mooedithistoryitem.c \
+ mooedit/mooeditfiltersettings.cpp\
+ mooedit/mooedithistoryitem.cpp \
mooedit/mooedit-impl.h \
- mooedit/mooedit-script.c \
+ mooedit/mooedit-script.cpp \
mooedit/mooedit-script.h \
- mooedit/mooeditprefs.c \
- mooedit/mooeditprefspage.c \
+ mooedit/mooeditprefs.cpp \
+ mooedit/mooeditprefspage.cpp \
mooedit/mooedit-private.h \
mooedit/mooeditprogress.h \
mooedit/mooeditprogress.c \
- mooedit/mooedittab.c \
+ mooedit/mooedittab.cpp \
mooedit/mooedittab.h \
mooedit/mooedittab-impl.h \
- mooedit/mooeditwindow.c \
+ mooedit/mooeditwindow.cpp \
mooedit/mooeditwindow-impl.h \
mooedit/mooeditfileinfo-impl.h \
- mooedit/mooeditfileinfo.c \
- mooedit/moofold.c \
+ mooedit/mooeditfileinfo.cpp \
+ mooedit/moofold.cpp \
mooedit/moofold.h \
- mooedit/mooindenter.c \
+ mooedit/mooindenter.cpp \
mooedit/mooindenter.h \
- mooedit/moolang.c \
+ mooedit/moolang.cpp \
mooedit/moolang.h \
- mooedit/moolangmgr.c \
+ mooedit/moolangmgr.cpp \
mooedit/moolangmgr.h \
mooedit/moolangmgr-private.h \
mooedit/moolang-private.h \
@@ -93,7 +93,7 @@ moo_sources += \
mooedit/mooeditor.cpp \
mooedit/mooeditor-impl.h \
mooedit/mooeditor-private.h \
- mooedit/mooeditor-tests.c \
+ mooedit/mooeditor-tests.cpp \
mooedit/mooeditor-tests.h \
mooedit/mooeditor-tests.h
diff --git a/moo/mooedit/mooedit-enum-types.c b/moo/mooedit/mooedit-enum-types.c
index 636a9d2c..9f3ad8cf 100644
--- a/moo/mooedit/mooedit-enum-types.c
+++ b/moo/mooedit/mooedit-enum-types.c
@@ -2,9 +2,7 @@
/* Generated data (by glib-mkenums) */
#include "mooedit/mooedit-enum-types.h"
-
#include "mooedit/mooedit-enums.h"
-
/* enum MooEditConfigSource */
GType
moo_edit_config_source_get_type (void)
@@ -27,7 +25,6 @@ moo_edit_config_source_get_type (void)
return etype;
}
-
/* enum MooSaveResponse */
GType
moo_save_response_get_type (void)
@@ -47,7 +44,6 @@ moo_save_response_get_type (void)
return etype;
}
-
/* enum MooEditState */
GType
moo_edit_state_get_type (void)
@@ -69,7 +65,6 @@ moo_edit_state_get_type (void)
return etype;
}
-
/* flags MooEditStatus */
GType
moo_edit_status_get_type (void)
@@ -94,7 +89,6 @@ moo_edit_status_get_type (void)
return etype;
}
-
/* enum MooLineEndType */
GType
moo_line_end_type_get_type (void)
@@ -117,7 +111,6 @@ moo_line_end_type_get_type (void)
return etype;
}
-
/* flags MooOpenFlags */
GType
moo_open_flags_get_type (void)
@@ -140,7 +133,6 @@ moo_open_flags_get_type (void)
return etype;
}
-
/* enum MooTextSelectionType */
GType
moo_text_selection_type_get_type (void)
@@ -161,7 +153,6 @@ moo_text_selection_type_get_type (void)
return etype;
}
-
/* flags MooTextSearchFlags */
GType
moo_text_search_flags_get_type (void)
@@ -183,7 +174,6 @@ moo_text_search_flags_get_type (void)
return etype;
}
-
/* flags MooFindFlags */
GType
moo_find_flags_get_type (void)
@@ -209,7 +199,6 @@ moo_find_flags_get_type (void)
return etype;
}
-
/* flags MooDrawWsFlags */
GType
moo_draw_ws_flags_get_type (void)
@@ -231,7 +220,6 @@ moo_draw_ws_flags_get_type (void)
return etype;
}
-
/* enum MooActionCheckType */
GType
moo_action_check_type_get_type (void)
@@ -252,7 +240,6 @@ moo_action_check_type_get_type (void)
return etype;
}
-
/* enum MooTextCursor */
GType
moo_text_cursor_get_type (void)
@@ -275,6 +262,5 @@ moo_text_cursor_get_type (void)
return etype;
}
-
/* Generated data ends here */
diff --git a/moo/mooedit/mooedit-enum-types.h b/moo/mooedit/mooedit-enum-types.h
index 53380fcf..c2b39084 100644
--- a/moo/mooedit/mooedit-enum-types.h
+++ b/moo/mooedit/mooedit-enum-types.h
@@ -7,55 +7,42 @@
#include
G_BEGIN_DECLS
-
/* MooEditConfigSource */
GType moo_edit_config_source_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_EDIT_CONFIG_SOURCE (moo_edit_config_source_get_type ())
-
/* MooSaveResponse */
GType moo_save_response_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_SAVE_RESPONSE (moo_save_response_get_type ())
-
/* MooEditState */
GType moo_edit_state_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_EDIT_STATE (moo_edit_state_get_type ())
-
/* MooEditStatus */
GType moo_edit_status_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_EDIT_STATUS (moo_edit_status_get_type ())
-
/* MooLineEndType */
GType moo_line_end_type_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_LINE_END_TYPE (moo_line_end_type_get_type ())
-
/* MooOpenFlags */
GType moo_open_flags_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_OPEN_FLAGS (moo_open_flags_get_type ())
-
/* MooTextSelectionType */
GType moo_text_selection_type_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_TEXT_SELECTION_TYPE (moo_text_selection_type_get_type ())
-
/* MooTextSearchFlags */
GType moo_text_search_flags_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_TEXT_SEARCH_FLAGS (moo_text_search_flags_get_type ())
-
/* MooFindFlags */
GType moo_find_flags_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_FIND_FLAGS (moo_find_flags_get_type ())
-
/* MooDrawWsFlags */
GType moo_draw_ws_flags_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_DRAW_WS_FLAGS (moo_draw_ws_flags_get_type ())
-
/* MooActionCheckType */
GType moo_action_check_type_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_ACTION_CHECK_TYPE (moo_action_check_type_get_type ())
-
/* MooTextCursor */
GType moo_text_cursor_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_TEXT_CURSOR (moo_text_cursor_get_type ())
-
G_END_DECLS
#endif /* MOO_EDIT_ENUM_TYPES_H */
diff --git a/moo/mooglib/moo-glib.h b/moo/mooglib/moo-glib.h
index 9e31ef0e..d49ded48 100644
--- a/moo/mooglib/moo-glib.h
+++ b/moo/mooglib/moo-glib.h
@@ -3,6 +3,9 @@
#include
#include
#include
+#ifndef __WIN32__
+#include
+#endif
G_BEGIN_DECLS
@@ -23,6 +26,8 @@ typedef struct mgw_access_mode_t mgw_access_mode_t;
#error "C libraries may not be shared between medit and glib"
#endif
+#ifdef __WIN32__
+
enum mgw_errno_value_t
{
MGW_ENOERROR = 0,
@@ -39,6 +44,23 @@ enum mgw_errno_value_t
typedef enum mgw_errno_value_t mgw_errno_value_t;
+#else
+
+typedef int mgw_errno_value_t;
+
+#define MGW_ENOERROR 0
+#define MGW_EACCES EACCESS
+#define MGW_EPERM EPERM
+#define MGW_EEXIST EEXIST
+#define MGW_ELOOP ELOOP
+#define MGW_ENAMETOOLONG ENAMETOOLONG
+#define MGW_ENOENT ENOENT
+#define MGW_ENOTDIR ENOTDIR
+#define MGW_EROFS EROFS
+#define MGW_EXDEV EXDEV
+
+#endif
+
struct mgw_errno_t
{
mgw_errno_value_t value;
diff --git a/moo/moopython/Makefile.incl b/moo/moopython/Makefile.incl
index 5746851d..07777863 100644
--- a/moo/moopython/Makefile.incl
+++ b/moo/moopython/Makefile.incl
@@ -14,7 +14,7 @@ moo_python_sources += \
moopython/moopython-utils.h \
moopython/moopython-utils.c \
moopython/moopython-tests.h \
- moopython/moopython-tests.c
+ moopython/moopython-tests.cpp
moo_sources += \
moopython/medit-python.h \
diff --git a/moo/moopython/moopython-utils.h b/moo/moopython/moopython-utils.h
index 21a101b4..98017b44 100644
--- a/moo/moopython/moopython-utils.h
+++ b/moo/moopython/moopython-utils.h
@@ -66,13 +66,19 @@ void moo_python_remove_path (const char *dir);
#define return_Int(v) return PyInt_FromLong (v)
-#define return_AttrError(msg) return PyErr_SetString (PyExc_AttributeError, msg), NULL
+#ifdef __cplusplus
+const nullptr_t moo_nullptr = nullptr;
+#else
+#define moo_nullptr NULL
+#endif
+
+#define return_AttrError(msg) return PyErr_SetString (PyExc_AttributeError, msg), moo_nullptr
#define return_AttrErrorInt(msg) return PyErr_SetString (PyExc_AttributeError, msg), -1
-#define return_TypeError(msg) return PyErr_SetString (PyExc_TypeError, msg), NULL
+#define return_TypeError(msg) return PyErr_SetString (PyExc_TypeError, msg), moo_nullptr
#define return_TypeErrorInt(msg) return PyErr_SetString (PyExc_TypeError, msg), -1
-#define return_RuntimeError(msg) return PyErr_SetString (PyExc_RuntimeError, msg), NULL
+#define return_RuntimeError(msg) return PyErr_SetString (PyExc_RuntimeError, msg), moo_nullptr
#define return_RuntimeErrorInt(msg) return PyErr_SetString (PyExc_RuntimeError, msg), -1
-#define return_ValueError(msg) return PyErr_SetString (PyExc_ValueError, msg), NULL
+#define return_ValueError(msg) return PyErr_SetString (PyExc_ValueError, msg), moo_nullptr
#define return_ValueErrorInt(msg) return PyErr_SetString (PyExc_ValueError, msg), -1
G_END_DECLS
diff --git a/moo/moopython/pygtk/Makefile.incl b/moo/moopython/pygtk/Makefile.incl
index 9169a18f..1cff8d65 100644
--- a/moo/moopython/pygtk/Makefile.incl
+++ b/moo/moopython/pygtk/Makefile.incl
@@ -22,7 +22,7 @@ EXTRA_DIST += \
moopython/pygtk/moo.py
built_moo_python_sources += \
- moopython/pygtk/moo-mod.c \
+ moopython/pygtk/moo-mod.cpp \
moopython/pygtk/moo-mod.h
if MOO_OS_WIN32
@@ -45,7 +45,7 @@ codegen = $(MOO_PYTHON) $(codegen_script) $(codegen_platform) \
--codebefore $(srcdir)/moopython/pygtk/codebefore.c \
--codeafter $(srcdir)/moopython/pygtk/codeafter.c
-moopython/pygtk/moo-mod.c: $(moo_override_files) moopython/pygtk/moo.defs $(codegen_files) \
+moopython/pygtk/moo-mod.cpp: $(moo_override_files) moopython/pygtk/moo.defs $(codegen_files) \
$(srcdir)/moopython/pygtk/codebefore.c \
$(srcdir)/moopython/pygtk/codeafter.c
$(AM_V_at)$(MKDIR_P) moopython/pygtk
diff --git a/moo/mooutils/Makefile.incl b/moo/mooutils/Makefile.incl
index 1de58a19..7d4faa8c 100644
--- a/moo/mooutils/Makefile.incl
+++ b/moo/mooutils/Makefile.incl
@@ -12,7 +12,7 @@ moo_sources += \
mooutils/moohistorymgr.c \
mooutils/moohistorymgr.h \
mooutils/moo-environ.h \
- mooutils/mooaccel.c \
+ mooutils/mooaccel.cpp \
mooutils/mooaccel.h \
mooutils/mooaccelbutton.c \
mooutils/mooaccelbutton.h \
@@ -56,7 +56,7 @@ moo_sources += \
mooutils/moofileicon.h \
mooutils/moofilewatch.c \
mooutils/moofilewatch.h \
- mooutils/moofilewriter.c \
+ mooutils/moofilewriter.cpp \
mooutils/moofilewriter.h \
mooutils/moofilewriter-private.h\
mooutils/moofiltermgr.c \
@@ -71,7 +71,7 @@ moo_sources += \
mooutils/moohistorycombo.h \
mooutils/moohistorylist.c \
mooutils/moohistorylist.h \
- mooutils/mooi18n.c \
+ mooutils/mooi18n.cpp \
mooutils/mooi18n.h \
mooutils/moolist.h \
mooutils/moomarkup.c \
@@ -114,10 +114,10 @@ moo_sources += \
mooutils/mooutils-enums.h \
mooutils/mooutils-file.c \
mooutils/mooutils-file.h \
- mooutils/mooutils-fs.c \
+ mooutils/mooutils-fs.cpp \
mooutils/mooutils-fs.h \
mooutils/mooutils-gobject-private.h \
- mooutils/mooutils-gobject.c \
+ mooutils/mooutils-gobject.cpp \
mooutils/mooutils-gobject.h \
mooutils/mooutils-macros.h \
mooutils/mooutils-mem.h \
@@ -169,7 +169,7 @@ mooutils_unix_sources = \
mooutils/mooappinput-unix.c
mooutils_unittest_sources = \
- mooutils/moo-test-utils.c \
+ mooutils/moo-test-utils.cpp \
mooutils/moo-test-utils.h \
mooutils/moo-test-macros.h
diff --git a/moo/mooutils/moo-test-utils.cpp b/moo/mooutils/moo-test-utils.cpp
index 19e5e07d..b0b565de 100644
--- a/moo/mooutils/moo-test-utils.cpp
+++ b/moo/mooutils/moo-test-utils.cpp
@@ -258,7 +258,7 @@ moo_test_run_tests (const gstrvec& tests,
if (!find_test (name, &single_ts, &single_test))
{
- g_printerr ("could not find test %s", name);
+ g_printerr ("could not find test %s", name.get());
exit (EXIT_FAILURE);
}
diff --git a/moo/mooutils/moofilewatch.c b/moo/mooutils/moofilewatch.c
index 570e9303..5d0a8862 100644
--- a/moo/mooutils/moofilewatch.c
+++ b/moo/mooutils/moofilewatch.c
@@ -605,9 +605,11 @@ errno_to_file_error (mgw_errno_t code)
switch (code.value)
{
+#ifdef EACCESS
case MGW_EACCES:
fcode = MOO_FILE_WATCH_ERROR_ACCESS_DENIED;
break;
+#endif
case MGW_ENAMETOOLONG:
fcode = MOO_FILE_WATCH_ERROR_BAD_FILENAME;
break;
diff --git a/moo/mooutils/mooutils-enums.c b/moo/mooutils/mooutils-enums.c
index 7dba77a8..c3133e9d 100644
--- a/moo/mooutils/mooutils-enums.c
+++ b/moo/mooutils/mooutils-enums.c
@@ -2,9 +2,7 @@
/* Generated data (by glib-mkenums) */
#include "mooutils/mooutils-enums.h"
-
#include "mooutils/moodialogs.h"
-
/* MooSaveChangesResponse */
GType
moo_save_changes_response_get_type (void)
@@ -25,9 +23,7 @@ moo_save_changes_response_get_type (void)
return etype;
}
-
#include "mooutils/moofiledialog.h"
-
/* MooFileDialogType */
GType
moo_file_dialog_type_get_type (void)
@@ -49,9 +45,7 @@ moo_file_dialog_type_get_type (void)
return etype;
}
-
#include "mooutils/moouixml.h"
-
/* MooUiNodeType */
GType
moo_ui_node_type_get_type (void)
@@ -74,7 +68,6 @@ moo_ui_node_type_get_type (void)
return etype;
}
-
/* MooUiNodeFlags */
GType
moo_ui_node_flags_get_type (void)
@@ -93,7 +86,6 @@ moo_ui_node_flags_get_type (void)
return etype;
}
-
/* MooUiWidgetType */
GType
moo_ui_widget_type_get_type (void)
@@ -114,9 +106,7 @@ moo_ui_widget_type_get_type (void)
return etype;
}
-
#include "mooutils/moowindow.h"
-
/* MooCloseResponse */
GType
moo_close_response_get_type (void)
@@ -137,6 +127,5 @@ moo_close_response_get_type (void)
return etype;
}
-
/* Generated data ends here */
diff --git a/moo/mooutils/mooutils-enums.h b/moo/mooutils/mooutils-enums.h
index e1e58768..dfbf1dc1 100644
--- a/moo/mooutils/mooutils-enums.h
+++ b/moo/mooutils/mooutils-enums.h
@@ -7,32 +7,25 @@
#include
G_BEGIN_DECLS
-
/* MooSaveChangesResponse */
GType moo_save_changes_response_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_SAVE_CHANGES_RESPONSE (moo_save_changes_response_get_type ())
-
/* MooFileDialogType */
GType moo_file_dialog_type_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_FILE_DIALOG_TYPE (moo_file_dialog_type_get_type ())
-
/* MooUiNodeType */
GType moo_ui_node_type_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_UI_NODE_TYPE (moo_ui_node_type_get_type ())
-
/* MooUiNodeFlags */
GType moo_ui_node_flags_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_UI_NODE_FLAGS (moo_ui_node_flags_get_type ())
-
/* MooUiWidgetType */
GType moo_ui_widget_type_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_UI_WIDGET_TYPE (moo_ui_widget_type_get_type ())
-
/* MooCloseResponse */
GType moo_close_response_get_type (void) G_GNUC_CONST;
#define MOO_TYPE_CLOSE_RESPONSE (moo_close_response_get_type ())
-
G_END_DECLS
#endif /* MOO_UTILS_ENUMS_H */
diff --git a/moo/mooutils/mooutils-fs.cpp b/moo/mooutils/mooutils-fs.cpp
index 4b588809..95b995d1 100644
--- a/moo/mooutils/mooutils-fs.cpp
+++ b/moo/mooutils/mooutils-fs.cpp
@@ -452,7 +452,9 @@ _moo_file_error_from_errno (mgw_errno_t code)
{
switch (code.value)
{
+#ifdef __WIN32__
case MGW_EACCES:
+#endif
case MGW_EPERM:
return MOO_FILE_ERROR_ACCESS_DENIED;
case MGW_EEXIST:
@@ -1018,7 +1020,8 @@ test_normalize_file_path_win32 (void)
for (i = 0; i < paths->len; i += 2)
{
- test_normalize_path_one (paths->pdata[i], paths->pdata[i+1],
+ test_normalize_path_one ((const char*) paths->pdata[i],
+ (const char*) paths->pdata[i+1],
normalize_full_path_win32,
"normalize_full_path_win32");
g_free (paths->pdata[i]);
diff --git a/moo/plugins/Makefile.incl b/moo/plugins/Makefile.incl
index 3a4526a0..3144a437 100644
--- a/moo/plugins/Makefile.incl
+++ b/moo/plugins/Makefile.incl
@@ -1,11 +1,11 @@
plugins_sources += \
- plugins/moofileselector-prefs.c \
- plugins/moofileselector.c \
+ plugins/moofileselector-prefs.cpp\
+ plugins/moofileselector.cpp \
plugins/moofileselector.h \
plugins/mooplugin-builtin.h \
- plugins/mooplugin-builtin.c \
- plugins/moofilelist.c \
- plugins/moofind.c
+ plugins/mooplugin-builtin.cpp \
+ plugins/moofilelist.cpp \
+ plugins/moofind.cpp
EXTRA_DIST += \
plugins/glade/moofileselector-prefs.glade \
diff --git a/moo/plugins/support/Makefile.incl b/moo/plugins/support/Makefile.incl
index 0e2be7ba..5d8fef30 100644
--- a/moo/plugins/support/Makefile.incl
+++ b/moo/plugins/support/Makefile.incl
@@ -2,10 +2,10 @@ AM_CPPFLAGS += -I$(srcdir)/plugins/support
plugins_sources += \
plugins/support/moocmdview.h \
- plugins/support/moocmdview.c \
+ plugins/support/moocmdview.cpp \
plugins/support/mooeditwindowoutput.h \
- plugins/support/mooeditwindowoutput.c \
- plugins/support/moolineview.c \
+ plugins/support/mooeditwindowoutput.cpp \
+ plugins/support/moolineview.cpp \
plugins/support/moolineview.h \
- plugins/support/moooutputfilter.c \
+ plugins/support/moooutputfilter.cpp \
plugins/support/moooutputfilter.h
diff --git a/moo/plugins/usertools/Makefile.incl b/moo/plugins/usertools/Makefile.incl
index e2560870..f37caddc 100644
--- a/moo/plugins/usertools/Makefile.incl
+++ b/moo/plugins/usertools/Makefile.incl
@@ -1,18 +1,18 @@
plugins_sources += \
- plugins/usertools/moousertools.c \
+ plugins/usertools/moousertools.cpp \
plugins/usertools/moousertools.h \
- plugins/usertools/moousertools-prefs.c \
+ plugins/usertools/moousertools-prefs.cpp \
plugins/usertools/moousertools-prefs.h \
- plugins/usertools/moocommand.c \
+ plugins/usertools/moocommand.cpp \
plugins/usertools/moocommand.h \
plugins/usertools/moocommand-private.h \
- plugins/usertools/moocommanddisplay.c \
+ plugins/usertools/moocommanddisplay.cpp \
plugins/usertools/moocommanddisplay.h \
- plugins/usertools/moooutputfilterregex.c \
+ plugins/usertools/moooutputfilterregex.cpp \
plugins/usertools/moooutputfilterregex.h \
plugins/usertools/moousertools-enums.h \
- plugins/usertools/moousertools-enums.c \
- plugins/usertools/moocommand-exe.c \
+ plugins/usertools/moousertools-enums.cpp \
+ plugins/usertools/moocommand-exe.cpp \
plugins/usertools/moocommand-exe.h \
plugins/usertools/moocommand-script.cpp \
plugins/usertools/moocommand-script.h
diff --git a/moo/plugins/usertools/moocommand-exe.cpp b/moo/plugins/usertools/moocommand-exe.cpp
index b9b0a92d..3aa09482 100644
--- a/moo/plugins/usertools/moocommand-exe.cpp
+++ b/moo/plugins/usertools/moocommand-exe.cpp
@@ -40,7 +40,7 @@
#endif
#ifndef __WIN32__
-#define RUN_CMD_FLAGS 0
+#define RUN_CMD_FLAGS ((GSpawnFlags)0)
#define SCRIPT_EXTENSION ".sh"
#else
#define RUN_CMD_FLAGS G_SPAWN_SEARCH_PATH