summaryrefslogtreecommitdiffhomepage
path: root/mixlib
diff options
context:
space:
mode:
Diffstat (limited to 'mixlib')
-rw-r--r--mixlib/mix_vm_command.c21
-rw-r--r--mixlib/mix_vm_command.h5
2 files changed, 18 insertions, 8 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;
+ }
}
diff --git a/mixlib/mix_vm_command.h b/mixlib/mix_vm_command.h
index 8d9e86e..cedb650 100644
--- a/mixlib/mix_vm_command.h
+++ b/mixlib/mix_vm_command.h
@@ -1,7 +1,7 @@
/* -*-c-*- ---------------- mix_vm_command.h :
* declarations for mix_vm_command_t, describing commands issued to a vm
* ------------------------------------------------------------------
- * Last change: Time-stamp: <01/03/15 15:57:36 jose>
+ * $Id: mix_vm_command.h,v 1.14 2001/09/16 22:32:12 jao Exp $
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -48,6 +48,7 @@ typedef enum {
MIX_CMD_SASM, /* set assembler command */
MIX_CMD_RUN, /* run a loaded program */
MIX_CMD_NEXT, /* run next instruction */
+ MIX_CMD_PSTAT, /* print current vm status */
MIX_CMD_LOC, /* print location pointer */
MIX_CMD_PSYM, /* print symbol */
MIX_CMD_PREG, /* print registry */
@@ -218,7 +219,7 @@ mix_vm_cmd_dispatcher_get_src_file_lineno (const mix_vm_cmd_dispatcher_t *dis);
extern const gchar *
mix_vm_cmd_dispatcher_get_src_file_line (const mix_vm_cmd_dispatcher_t *dis,
- gulong line);
+ gulong line, gboolean cr);
/* toggle time printing */
extern void