summaryrefslogtreecommitdiffhomepage
path: root/mixlib/mix_vm_command.c
diff options
context:
space:
mode:
Diffstat (limited to 'mixlib/mix_vm_command.c')
-rw-r--r--mixlib/mix_vm_command.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/mixlib/mix_vm_command.c b/mixlib/mix_vm_command.c
index 2b2819e..77005e5 100644
--- a/mixlib/mix_vm_command.c
+++ b/mixlib/mix_vm_command.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mix_vm_command.c :
* Implementation of the functions declared in mix_vm_command.h
* ------------------------------------------------------------------
- * Last change: Time-stamp: "2001-04-22 17:20:07 jao"
+ * $Id: mix_vm_command.c,v 1.26 2001/09/16 22:32:12 jao Exp $
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -60,8 +60,6 @@ exec_global_hook_list_ (GSList *list,
}
}
-
-
/* conversion from/to commands to strings */
const gchar *
mix_vm_command_to_string (mix_vm_command_t cmd)
@@ -134,6 +132,7 @@ mix_vm_cmd_dispatcher_new (FILE *out_fd, /* output messages file */
MIX_DUMP_ALL);
result->vm = mix_vm_new ();
result->global_pre = result->global_post = NULL;
+
for (k =0; k < MIX_CMD_INVALID; ++k)
result->pre_hooks[k] = result->post_hooks[k] = NULL;
@@ -616,16 +615,26 @@ mix_vm_cmd_dispatcher_get_src_file_lineno (const mix_vm_cmd_dispatcher_t *dis)
const gchar *
mix_vm_cmd_dispatcher_get_src_file_line (const mix_vm_cmd_dispatcher_t *dis,
- gulong line)
+ gulong line, gboolean cr)
{
const mix_src_file_t *file;
g_return_val_if_fail (dis != NULL, NULL);
file = mix_vm_get_src_file (dis->vm);
- if (line == 0 || file == NULL) return "";
+ if (line == 0 || file == NULL) return cr? "" : "\n";
- return mix_src_file_get_line (file, line);
+ if (cr)
+ return mix_src_file_get_line (file, line);
+ else
+ {
+ enum {BUFF_SIZE = 256};
+ static gchar BUFFER[BUFF_SIZE];
+ int len =
+ snprintf (BUFFER, BUFF_SIZE, "%s", mix_src_file_get_line (file, line));
+ if (len > 0 && BUFFER[len - 1] == '\n') BUFFER[len - 1] = '\0';
+ return BUFFER;
+ }
}