summaryrefslogtreecommitdiffhomepage
path: root/mixutils
diff options
context:
space:
mode:
Diffstat (limited to 'mixutils')
-rw-r--r--mixutils/mixvm_loop.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/mixutils/mixvm_loop.c b/mixutils/mixvm_loop.c
index 57953b0..dd37bc6 100644
--- a/mixutils/mixvm_loop.c
+++ b/mixutils/mixvm_loop.c
@@ -1,24 +1,24 @@
/* -*-c-*- -------------- mixvm_loop.c :
* Implementation of mix vm command loop.
* ------------------------------------------------------------------
- * $Id: mixvm_loop.c,v 1.10 2002/04/08 01:59:38 jao Exp $
+ * $Id: mixvm_loop.c,v 1.11 2004/06/07 05:05:27 jao Exp $
* ------------------------------------------------------------------
- * Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
- *
+ * Copyright (C) 2000, 2001, 2002, 2004 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
+ *
*/
@@ -75,14 +75,14 @@ rl_gets ()
g_free (line_read);
line_read = (char *)NULL;
}
-
+
/* Get a line from the user. */
line_read = readline ((char *)PROMPT);
-
+
/* If the line has any text in it, save it on the history. */
if (line_read && *line_read)
add_history (line_read);
-
+
return (line_read);
}
@@ -103,16 +103,16 @@ init_mixvm_ (const gchar *file, gboolean use_emacs)
mix_config_set_history_file (config_, HISTORY_FILE);
if (mix_config_get_history_size (config_) == 0)
mix_config_set_history_size (config_, HISTORY_SIZE);
-
+
prompt = mix_config_get (config_, PROMPT_KEY_);
if (!prompt) prompt = "MIX > ";
mix_vmloop_set_prompt (prompt);
-
+
return mixvm_cmd_init (config_, (char *)file, use_emacs);
}
void
-mix_vmloop_set_prompt (const gchar *prompt)
+mix_vmloop_set_prompt (const gchar *prompt)
{
if (prompt)
{
@@ -127,7 +127,7 @@ mix_vmloop_set_prompt (const gchar *prompt)
static void
loop_ (int argc, char *argv[])
{
- while ( mixvm_cmd_exec (rl_gets ()) )
+ while ( mixvm_cmd_exec (rl_gets ()) )
;
mix_config_delete (config_);
}
@@ -147,16 +147,17 @@ mix_vmloop (int argc, char *argv[], gboolean initfile,
/* run a program and exit */
void
-mix_vmrun (const gchar *code_file, gboolean dump, gboolean ptime)
+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;
+ 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 (time_cmd) && mixvm_cmd_exec (run_cmd);
if (result && dump) mixvm_cmd_exec (dump_cmd);
+ mix_config_set_autosave (config_, FALSE);
mix_config_delete (config_);
g_free(time_cmd);
g_free(run_cmd);