summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2001-06-08 22:26:44 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2001-06-08 22:26:44 +0000
commitb08a27dca67a2e96b2d7fd194b1d5b6fd5b10529 (patch)
treee5d4daa3d4a4ad8122bc247a76f6ea8f9d617eea
parent4a189e7f6f2a1a4ffa2ccc812b937f95649fc266 (diff)
downloadmdk-b08a27dca67a2e96b2d7fd194b1d5b6fd5b10529.tar.gz
mdk-b08a27dca67a2e96b2d7fd194b1d5b6fd5b10529.tar.bz2
src file path accessor added
-rw-r--r--mixlib/mix_vm_command.c45
-rw-r--r--mixlib/mix_vm_command.h3
2 files changed, 25 insertions, 23 deletions
diff --git a/mixlib/mix_vm_command.c b/mixlib/mix_vm_command.c
index f2abce9..8068ce1 100644
--- a/mixlib/mix_vm_command.c
+++ b/mixlib/mix_vm_command.c
@@ -268,6 +268,26 @@ mix_vm_cmd_dispatcher_get_assembler (const mix_vm_cmd_dispatcher_t *dis)
return dis->assembler;
}
+const gchar *
+mix_vm_cmd_dispatcher_get_src_file_path (const mix_vm_cmd_dispatcher_t *dis)
+{
+ static gchar *PATH = NULL;
+
+ const mix_vm_t *vm = mix_vm_cmd_dispatcher_get_vm (dis);
+ const mix_src_file_t *f = mix_vm_get_src_file (vm);
+
+ if (PATH)
+ {
+ g_free (PATH);
+ PATH = NULL;
+ }
+
+ if (f)
+ PATH = mix_file_complete_name (mix_src_file_get_path (f), MIX_SRC_DEFEXT);
+
+ return PATH;
+}
+
/* install hooks */
void
mix_vm_cmd_dispatcher_pre_hook (mix_vm_cmd_dispatcher_t *dis,
@@ -552,27 +572,6 @@ cmd_load_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg)
return TRUE;
}
-static const gchar *
-get_src_file_path_ (mix_vm_cmd_dispatcher_t *dis)
-{
- static gchar *PATH = NULL;
-
- const mix_vm_t *vm = mix_vm_cmd_dispatcher_get_vm (dis);
- const mix_src_file_t *f = mix_vm_get_src_file (vm);
-
- if (PATH)
- {
- g_free (PATH);
- PATH = NULL;
- }
-
- if (f)
- PATH = mix_file_complete_name (mix_src_file_get_path (f), MIX_SRC_DEFEXT);
-
- return PATH;
-}
-
-
static gboolean
cmd_edit_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg)
{
@@ -581,7 +580,7 @@ cmd_edit_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg)
fputs (_("Editor not specified (set MDK_EDITOR)\n"), dis->err);
return FALSE;
}
- if (!arg || *arg == '\0') arg = get_src_file_path_ (dis);
+ if (!arg || *arg == '\0') arg = mix_vm_cmd_dispatcher_get_src_file_path (dis);
if (!arg)
{
fputs (_("MIXAL source file path not found\n"), dis->err);
@@ -606,7 +605,7 @@ cmd_compile_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg)
fputs (_("MIX assembler not specified\n"), dis->err);
return FALSE;
}
- if (!arg || *arg == '\0') arg = get_src_file_path_ (dis);
+ if (!arg || *arg == '\0') arg = mix_vm_cmd_dispatcher_get_src_file_path (dis);
if (!arg)
{
fputs (_("MIXAL source file path not found\n"), dis->err);
diff --git a/mixlib/mix_vm_command.h b/mixlib/mix_vm_command.h
index 3d51c73..71e5820 100644
--- a/mixlib/mix_vm_command.h
+++ b/mixlib/mix_vm_command.h
@@ -110,6 +110,9 @@ mix_vm_cmd_dispatcher_set_assembler (mix_vm_cmd_dispatcher_t *dis,
const gchar *asm_tplt);
extern const gchar *
+mix_vm_cmd_dispatcher_get_src_file_path (const mix_vm_cmd_dispatcher_t *dis);
+
+extern const gchar *
mix_vm_cmd_dispatcher_get_editor (const mix_vm_cmd_dispatcher_t *dis);
extern const gchar *