summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mixutils/mixasm.c6
-rw-r--r--mixutils/mixvm.c21
-rw-r--r--mixutils/mixvm_loop.c16
3 files changed, 28 insertions, 15 deletions
diff --git a/mixutils/mixasm.c b/mixutils/mixasm.c
index 3f21b02..4e682ef 100644
--- a/mixutils/mixasm.c
+++ b/mixutils/mixasm.c
@@ -1,9 +1,9 @@
/* -*-c-*- -------------- mixasm.c:
* Main function of mixasm, the mix assembler
* ------------------------------------------------------------------
- * $Id: mixasm.c,v 1.3 2001/09/28 23:10:45 jao Exp $
+ * $Id: mixasm.c,v 1.4 2002/03/20 01:30:11 jao Exp $
* ------------------------------------------------------------------
- * Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ * Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -56,7 +56,7 @@ static struct option long_options_[] =
};
static const gchar *USAGE_ =
-N_("Usage: %s [-vhulg] [-o OUTPUT_FILE] [--version] [--help]\n"
+N_("Usage: %s [-vhultg] [-o OUTPUT_FILE] [--version] [--help]\n"
"\t[--usage] [--debug] [--output=OUTPUT_FILE] [--list[=LIST_FILE]] file\n");
diff --git a/mixutils/mixvm.c b/mixutils/mixvm.c
index 8c02095..4cb589f 100644
--- a/mixutils/mixvm.c
+++ b/mixutils/mixvm.c
@@ -1,9 +1,9 @@
/* -*-c-*- -------------- mixvm.c :
* Main function for mixvm, the mix vm simulator
* ------------------------------------------------------------------
- * $Id: mixvm.c,v 1.6 2001/09/28 23:10:45 jao Exp $
+ * $Id: mixvm.c,v 1.7 2002/03/20 01:30:11 jao Exp $
* ------------------------------------------------------------------
- * Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ * Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ mix_vmloop (int argc, char *argv[], gboolean initfile,
const gchar *code_file, gboolean use_emacs);
extern void
-mix_vmrun (const gchar *code_file, gboolean dump);
+mix_vmrun (const gchar *code_file, gboolean dump, gboolean ptime);
enum {
VER_OPT = 'v',
@@ -49,11 +49,12 @@ enum {
USAGE_OPT = 'u',
RUN_OPT = 'r',
DUMP_OPT = 'd',
+ TIME_OPT = 't',
EMACS_OPT = 'e', /* used by mixvm-gud only */
NOINIT_OPT = 'q'
};
-static const char *options_ = "vhurd"; /* no short opt for --emacs */
+static const char *options_ = "vhurdt"; /* no short opt for --emacs */
static struct option long_options_[] =
{
@@ -62,6 +63,7 @@ static struct option long_options_[] =
{"usage", no_argument, 0, USAGE_OPT},
{"run", required_argument, 0, RUN_OPT},
{"dump", no_argument, 0, DUMP_OPT},
+ {"time", no_argument, 0, TIME_OPT},
/* pek: yo! */
{"emacs", no_argument, 0, EMACS_OPT},
{"noinit", no_argument, 0, NOINIT_OPT},
@@ -69,7 +71,8 @@ static struct option long_options_[] =
};
static const gchar *USAGE_ =
-N_("Usage: %s [-vhurdq] [--version] [--help] [--noinit] [--usage] [--run] [--dump] [MIX_FILE]\n");
+N_("Usage: %s [-vhurdqt] [--version] [--help] [--noinit] [--usage]"
+ "\n\t[--run] [--dump] [--time] [MIX_FILE]\n");
int
main (int argc, char **argv)
@@ -81,7 +84,8 @@ main (int argc, char **argv)
gboolean dump = FALSE;
gboolean emacs = FALSE;
gboolean initfile = TRUE;
-
+ gboolean ptime = FALSE;
+
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -109,6 +113,9 @@ main (int argc, char **argv)
case DUMP_OPT:
dump = TRUE;
break;
+ case TIME_OPT:
+ ptime = TRUE;
+ break;
case '?':
/* getopt already handles the output of a warning message */
fprintf (stderr, _("(Try: %s -h)\n"), prog_name);
@@ -134,7 +141,7 @@ main (int argc, char **argv)
mix_init_lib ();
- if (run) mix_vmrun(in, dump);
+ if (run) mix_vmrun(in, dump, ptime);
else mix_vmloop (argc, argv, initfile, in, emacs);
mix_release_lib ();
diff --git a/mixutils/mixvm_loop.c b/mixutils/mixvm_loop.c
index 74ea8f8..a158427 100644
--- a/mixutils/mixvm_loop.c
+++ b/mixutils/mixvm_loop.c
@@ -1,9 +1,9 @@
/* -*-c-*- -------------- mixvm_loop.c :
* Implementation of mix vm command loop.
* ------------------------------------------------------------------
- * $Id: mixvm_loop.c,v 1.7 2001/09/24 23:27:02 jao Exp $
+ * $Id: mixvm_loop.c,v 1.8 2002/03/20 01:30:11 jao Exp $
* ------------------------------------------------------------------
- * Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ * Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -127,12 +127,18 @@ mix_vmloop (int argc, char *argv[], gboolean initfile,
/* run a program and exit */
void
-mix_vmrun (const gchar *code_file, gboolean dump)
+mix_vmrun (const gchar *code_file, gboolean dump, gboolean ptime)
{
+ gchar *time_cmd = ptime? g_strdup("stime on") : g_strdup("stime off");
+ gchar *run_cmd = g_strdup("run");
+ gchar *dump_cmd = dump? g_strdup("pall") : NULL;
gboolean result;
init_mixvm_ (code_file, FALSE);
- result = mixvm_cmd_exec (g_strdup ("run"));
- if (result && dump) mixvm_cmd_exec (g_strdup ("pall"));
+ result = mixvm_cmd_exec (time_cmd) && mixvm_cmd_exec (run_cmd);
+ if (result && dump) mixvm_cmd_exec (dump_cmd);
mix_config_delete (config_);
+ g_free(time_cmd);
+ g_free(run_cmd);
+ if (dump_cmd) g_free(dump_cmd);
}