summaryrefslogtreecommitdiffhomepage
path: root/mixlib/mix_vm_command.c
diff options
context:
space:
mode:
authorjaortega <jaortega>2001-03-12 01:20:22 +0000
committerjaortega <jaortega>2001-03-12 01:20:22 +0000
commita7abb051dcb7cc730a527039b962fe9415a6486f (patch)
tree7a39802dd68e38243b28b38966a28fa25cf31a51 /mixlib/mix_vm_command.c
parentda91a95fc54da6afc1ac2031002cb4462045ea00 (diff)
downloadmdk-a7abb051dcb7cc730a527039b962fe9415a6486f.tar.gz
mdk-a7abb051dcb7cc730a527039b962fe9415a6486f.tar.bz2
minor changes
Diffstat (limited to 'mixlib/mix_vm_command.c')
-rw-r--r--mixlib/mix_vm_command.c30
1 files changed, 16 insertions, 14 deletions
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);