summaryrefslogtreecommitdiffhomepage
path: root/mixguile
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2001-08-29 02:14:01 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2001-08-29 02:14:01 +0000
commit94d833c97f99aaa246a775bcccfed7d074ff1720 (patch)
tree4d6332bb8bbe06ada0f653327dbf9bc6ad8b870f /mixguile
parente035a5b2b62bd4fd9a08c7bae07a437dc9adf98e (diff)
downloadmdk-94d833c97f99aaa246a775bcccfed7d074ff1720.tar.gz
mdk-94d833c97f99aaa246a775bcccfed7d074ff1720.tar.bz2
new mix-guile commands
Diffstat (limited to 'mixguile')
-rw-r--r--mixguile/xmixguile_cmd_dispatcher.c60
1 files changed, 49 insertions, 11 deletions
diff --git a/mixguile/xmixguile_cmd_dispatcher.c b/mixguile/xmixguile_cmd_dispatcher.c
index 744b76b..5590e5f 100644
--- a/mixguile/xmixguile_cmd_dispatcher.c
+++ b/mixguile/xmixguile_cmd_dispatcher.c
@@ -267,6 +267,50 @@ mix_set_cmp_ (SCM value)
return gh_symbol2scm ("ok");
}
+static SCM
+mix_basename_ (const gchar *path)
+{
+ SCM result;
+ gchar *name;
+ if (!path) return gh_str02scm ("");
+ SCM_DEFER_INTS;
+ name = g_basename (path);
+ result = gh_str02scm (name);
+ g_free (name);
+ SCM_ALLOW_INTS;
+ return gh_str02scm (name);
+}
+
+static SCM
+mix_src_name_ (void)
+{
+ return
+ mix_basename_ (mix_vm_cmd_dispatcher_get_src_file_path (vm_dispatcher_));
+}
+
+static SCM
+mix_src_path_ (void)
+{
+ const gchar *path = mix_vm_cmd_dispatcher_get_src_file_path (vm_dispatcher_);
+ return gh_str02scm (path? (char *)path : "");
+}
+
+static SCM
+mix_prog_name_ (void)
+{
+ return
+ mix_basename_ (mix_vm_cmd_dispatcher_get_program_path (vm_dispatcher_));
+}
+
+static SCM
+mix_prog_path_ (void)
+{
+ const gchar *path = mix_vm_cmd_dispatcher_get_program_path (vm_dispatcher_);
+ return gh_str02scm (path? (char *)path : "");
+}
+
+
+
/* ----- hook functions ---- */
/* auxiliar arg list maker */
static SCM
@@ -288,18 +332,8 @@ make_arg_list_ (const gchar *arg)
/* command hook auxiliar functions and types */
/*
static SCM
-hook_error_handler_ (void *data, SCM tag, SCM args)
-{
- int len;
- mix_vm_cmd_dispatcher_t *dis = (mix_vm_cmd_dispatcher_t *)dis;
- gchar *argstr = gh_scm2newstr (args, &len);
- fprintf (mix_vm_cmd_dispatcher_get_err_stream (dis), "Error in hook: %s\n",
- argstr);
- g_free (argstr);
- return SCM_BOOL_T;
-}
+hook_error_handler_ (void *data, SCM tag, SCM args){}
*/
-
typedef struct
{
SCM function;
@@ -430,6 +464,10 @@ const scm_command_t DEFAULT_SCM_COMMANDS_[] = {
{"mix-loc", mix_loc_, 0, 0, 0},
{"mix-set-over!", mix_set_over_, 1, 0, 0},
{"mix-cmp", mix_cmp_, 0, 0, 0},
+ {"mix-prog-name", mix_prog_name_, 0, 0, 0},
+ {"mix-prog-path", mix_prog_path_, 0, 0, 0},
+ {"mix-src-name", mix_src_name_, 0, 0, 0},
+ {"mix-src-path", mix_src_path_, 0, 0, 0},
{"mix-set-cmp!", mix_set_cmp_, 1, 0, 0},
{"mix-add-pre-hook", mix_add_pre_hook_, 2, 0, 0},
{"mix-add-post-hook", mix_add_post_hook_, 2, 0, 0},