diff options
Diffstat (limited to 'mixlib/mix_vm_command.c')
-rw-r--r-- | mixlib/mix_vm_command.c | 45 |
1 files changed, 22 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); |