summaryrefslogtreecommitdiffhomepage
path: root/mixlib
diff options
context:
space:
mode:
Diffstat (limited to 'mixlib')
-rw-r--r--mixlib/mix_src_file.c13
-rw-r--r--mixlib/mix_vm.c8
-rw-r--r--mixlib/mix_vm.h3
-rw-r--r--mixlib/mix_vm_command.c30
4 files changed, 34 insertions, 20 deletions
diff --git a/mixlib/mix_src_file.c b/mixlib/mix_src_file.c
index 1cb6656..4e1489b 100644
--- a/mixlib/mix_src_file.c
+++ b/mixlib/mix_src_file.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mix_src_file.c :
* Implementation of the functions declared in mix_src_file.h
* ------------------------------------------------------------------
- * Last change: Time-stamp: "01/03/10 03:25:50 jose"
+ * Last change: Time-stamp: "01/03/10 15:23:46 jose"
* ------------------------------------------------------------------
* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
*
@@ -22,6 +22,7 @@
*/
#include <ctype.h>
+#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include "mix_src_file.h"
@@ -42,8 +43,8 @@ format_line_ (gchar *line)
gint k = 0;
if (!line) return line;
- if (line[0] == '*' || strlen(line) == 0) return g_strdup (line);
-
+ if (line[0] == '*' || strlen(line) == 0)
+ return g_strdup (line);
if (isspace (line[0]))
{
@@ -64,15 +65,15 @@ format_line_ (gchar *line)
while (line[k] && !isspace (line[k])) ++k;
while (line[k] && isspace (line[k])) ++k;
line[k - 1] = 0;
- rest = (line[k]) ? line + k: "\n";
+ rest = (line[k]) ? line + k: "";
}
else
{
- op = rest = "\n";
+ op = rest = "";
}
- return g_strdup_printf ("%-12s%-6s%s", label, op, rest);
+ return g_strdup_printf ("%-11s %-5s %s", label, op, rest);
}
/* load the source file lines into memory */
diff --git a/mixlib/mix_vm.c b/mixlib/mix_vm.c
index 0a885d8..9a39247 100644
--- a/mixlib/mix_vm.c
+++ b/mixlib/mix_vm.c
@@ -496,6 +496,14 @@ mix_vm_set_breakpoint_address (mix_vm_t *vm, guint address)
return MIX_VM_BP_OK;
}
+gboolean
+mix_vm_has_breakpoint_at_address (const mix_vm_t *vm, guint address)
+{
+ g_return_val_if_fail (vm != NULL, FALSE);
+ if (address >= MIX_VM_CELL_NO) return FALSE;
+ return (bp_is_set_ (vm, address));
+}
+
static gint
clear_break_ (gpointer key, gpointer value, gpointer data)
{
diff --git a/mixlib/mix_vm.h b/mixlib/mix_vm.h
index 95ed742..b64e197 100644
--- a/mixlib/mix_vm.h
+++ b/mixlib/mix_vm.h
@@ -189,6 +189,9 @@ mix_vm_clear_breakpoint (mix_vm_t *vm, guint lineno);
extern gint /* one of MIX_VM_BP_ */
mix_vm_clear_breakpoint_address (mix_vm_t *vm, guint address) ;
+extern gboolean
+mix_vm_has_breakpoint_at_address (const mix_vm_t *vm, guint address);
+
extern void
mix_vm_clear_all_breakpoints (mix_vm_t *vm);
diff --git a/mixlib/mix_vm_command.c b/mixlib/mix_vm_command.c
index 1ef0d7e..90283f0 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: "01/03/10 03:21:33 jose"
+ * Last change: Time-stamp: "01/03/11 01:50:17 jose"
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -48,6 +48,7 @@ typedef struct
struct mix_vm_cmd_dispatcher_t
{
mix_vm_t *vm; /* the virtual machine */
+ gchar *program; /* the name of the last loaded program */
FILE *out; /* message output file */
FILE *err; /* error output file */
mix_dump_context_t *dump; /* dump context for output */
@@ -193,6 +194,7 @@ mix_vm_cmd_dispatcher_new (FILE *out_fd, /* output messages file */
result->uptime = result->laptime = result->progtime = 0;
result->printtime = TRUE;
result->trace = FALSE;
+ result->program = NULL;
result->eval = mix_eval_new ();
result->dump = mix_dump_context_new (out_fd,
MIX_SHORT_ZERO, MIX_SHORT_ZERO,
@@ -480,6 +482,13 @@ cmd_load_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg)
perror (NULL);
return TRUE + 1;
}
+
+ if (dis->program != arg)
+ {
+ if (dis->program) g_free (dis->program);
+ dis->program = g_strdup (arg);
+ }
+
mix_eval_set_symbols_from_table (dis->eval,
mix_vm_get_symbol_table (dis->vm));
@@ -496,14 +505,11 @@ cmd_run_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg)
{
if (arg != NULL && *arg != '\0' && cmd_load_ (dis, arg) != TRUE)
return TRUE;
- fputs (_("Running ...\n"), dis->out);
-
- if (mix_vm_is_halted (dis->vm))
- {
- mix_vm_reset_program (dis->vm);
- dis->laptime = dis->progtime = 0;
- }
+ if (mix_vm_is_halted (dis->vm)) cmd_load_ (dis, dis->program);
+
+ fputs (_("Running ...\n"), dis->out);
+
switch (run_and_trace_ (dis))
{
case MIX_VM_HALT:
@@ -552,12 +558,8 @@ cmd_next_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg)
ins_no = atoi (arg);
}
- if (mix_vm_is_halted (dis->vm))
- {
- mix_vm_reset_program (dis->vm);
- dis->laptime = dis->progtime = 0;
- }
-
+ if (mix_vm_is_halted (dis->vm)) cmd_load_ (dis, dis->program);
+
while ( ins_no-- > 0 )
{
if (dis->trace) trace_ (dis);