From b08a27dca67a2e96b2d7fd194b1d5b6fd5b10529 Mon Sep 17 00:00:00 2001
From: Jose Antonio Ortega Ruiz <jao@gnu.org>
Date: Fri, 8 Jun 2001 22:26:44 +0000
Subject: src file path accessor added

---
 mixlib/mix_vm_command.c | 45 ++++++++++++++++++++++-----------------------
 mixlib/mix_vm_command.h |  3 +++
 2 files changed, 25 insertions(+), 23 deletions(-)

(limited to 'mixlib')

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
@@ -109,6 +109,9 @@ extern void
 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);
 
-- 
cgit v1.2.3