From a7abb051dcb7cc730a527039b962fe9415a6486f Mon Sep 17 00:00:00 2001 From: jaortega Date: Mon, 12 Mar 2001 01:20:22 +0000 Subject: minor changes --- mixlib/mix_vm_command.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'mixlib/mix_vm_command.c') 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); -- cgit v1.2.3