aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/main.cpp28
-rwxr-xr-xsrc/symbols-extract.tes9
-rw-r--r--src/symbols.cpp6
-rw-r--r--src/symbols.h6
5 files changed, 22 insertions, 31 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 81cf526..ff1f095 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,8 +12,8 @@ EXTRA_DIST = gtk-info-popup.gob \
if BOOTSTRAP
noinst_PROGRAMS = sciteco-minimal
-BOOTSTRAP_SCITECO = ./sciteco-minimal
-symbols-scintilla.cpp symbols-scilexer.cpp : sciteco-minimal
+BOOTSTRAP_SCITECO = ./sciteco-minimal$(EXEEXT)
+symbols-scintilla.cpp symbols-scilexer.cpp : $(BOOTSTRAP_SCITECO)
else
BOOTSTRAP_SCITECO = @SCITECO@
endif
diff --git a/src/main.cpp b/src/main.cpp
index c93e542..2adb505 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -85,32 +85,22 @@ Interface::process_notify(SCNotification *notify)
#ifdef G_OS_WIN32
/*
- * keep program self-contained under Windows
- * (look for profile in current directory)
+ * Keep program self-contained under Windows
+ * (look for profile in program's directory)
*/
static inline gchar *
-get_teco_ini(void)
-{
- return g_strdup(INI_FILE);
-}
-
-/*
- * Windows sometimes sets the current working directory to very obscure
- * paths when opening files in the Explorer, but we have to read the
- * teco.ini from the directory where our binary resides.
- */
-static inline void
-fix_cwd(const gchar *program)
+get_teco_ini(const gchar *program)
{
gchar *bin_dir = g_path_get_dirname(program);
- g_chdir(bin_dir);
+ gchar *ini = g_build_filename(bin_dir, INI_FILE, NULL);
g_free(bin_dir);
+ return ini;
}
#else
static inline gchar *
-get_teco_ini(void)
+get_teco_ini(const gchar *program __attribute__((unused)))
{
const gchar *home;
@@ -122,8 +112,6 @@ get_teco_ini(void)
return g_build_filename(home, INI_FILE, NULL);
}
-static inline void fix_cwd(const gchar *program __attribute__((unused))) {}
-
#endif /* !G_OS_WIN32 */
static inline void
@@ -158,7 +146,7 @@ process_options(int &argc, char **&argv)
exit(EXIT_FAILURE);
}
} else {
- mung_file = get_teco_ini();
+ mung_file = get_teco_ini(argv[0]);
}
interface.parse_args(argc, argv);
@@ -172,8 +160,6 @@ main(int argc, char **argv)
static GotoTable cmdline_goto_table;
static QRegisterTable local_qregs;
- fix_cwd(argv[0]);
-
process_options(argc, argv);
interface.ssm(SCI_SETCARETSTYLE, CARETSTYLE_BLOCK);
diff --git a/src/symbols-extract.tes b/src/symbols-extract.tes
index 6497324..841530c 100755
--- a/src/symbols-extract.tes
+++ b/src/symbols-extract.tes
@@ -69,8 +69,13 @@ static const SymbolList::Entry entries[] = {
.-Z;>
I};
-/* overwrites weak object in symbols.cpp */
-SymbolList Symbols::Qn(entries, G_N_ELEMENTS(entries));
+__attribute__((constructor(2000)))
+static void
+initialize(void)
+{
+ Symbols::Qn.entries = entries;
+ Symbols::Qn.size = G_N_ELEMENTS(entries);
+}

! write output file !
diff --git a/src/symbols.cpp b/src/symbols.cpp
index 8772fc9..3cafaaa 100644
--- a/src/symbols.cpp
+++ b/src/symbols.cpp
@@ -26,11 +26,11 @@
#include "symbols.h"
/*
- * defaults for sciteco-minimal
+ * Constructors executed before the ones defined in generated code.
*/
namespace Symbols {
- SymbolList __attribute__((weak)) scintilla;
- SymbolList __attribute__((weak)) scilexer;
+ SymbolList __attribute__((init_priority(1000))) scintilla;
+ SymbolList __attribute__((init_priority(1000))) scilexer;
}
/*
diff --git a/src/symbols.h b/src/symbols.h
index dd8bcc4..58bf1ef 100644
--- a/src/symbols.h
+++ b/src/symbols.h
@@ -27,10 +27,10 @@ public:
gint value;
};
-private:
const Entry *entries;
gint size;
+private:
/* for auto-completions */
GList *list;
@@ -48,8 +48,8 @@ public:
};
namespace Symbols {
- extern SymbolList __attribute__((weak)) scintilla;
- extern SymbolList __attribute__((weak)) scilexer;
+ extern SymbolList scintilla;
+ extern SymbolList scilexer;
}
#endif