summaryrefslogtreecommitdiffhomepage
path: root/mixutils/mixvm_command.c
diff options
context:
space:
mode:
Diffstat (limited to 'mixutils/mixvm_command.c')
-rw-r--r--mixutils/mixvm_command.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/mixutils/mixvm_command.c b/mixutils/mixvm_command.c
index bbc1339..4e5659a 100644
--- a/mixutils/mixvm_command.c
+++ b/mixutils/mixvm_command.c
@@ -1,24 +1,24 @@
/* -*-c-*- -------------- mixvm_command.c :
* Implementation of the functions declared in mixvm_command.h
* ------------------------------------------------------------------
- * $Id: mixvm_command.c,v 1.9 2002/04/10 23:39:40 jao Exp $
+ * $Id: mixvm_command.c,v 1.10 2004/06/09 12:59:42 jao Exp $
* ------------------------------------------------------------------
* 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
* 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.
- *
+ *
*/
#include <mixlib/mix.h>
@@ -100,18 +100,18 @@ static char **
mixvm_cmd_completion_ (char *text, int start, int end)
{
char **matches;
-
+
matches = (char **)NULL;
-
+
/* If this word is at the start of the line, then it is a command
to complete. Otherwise it is the name of a file in the current
directory. */
if (start == 0)
matches = rl_completion_matches (text, mixvm_cmd_generator_);
-
+
return (matches);
}
-
+
/* Generator function for command completion. STATE lets us know whether
to start from scratch; without any state (i.e. STATE == 0), then we
start at the top of the list. */
@@ -121,14 +121,14 @@ mixvm_cmd_generator_ (const char *text, int state)
static const GList *comp = NULL;
char *prefix = NULL;
char *name = NULL;
-
+
/* If this is a new word to complete, initialize now. */
if (!state)
{
if (prefix) g_free (prefix);
comp = mix_vm_cmd_dispatcher_complete (dis_, text, &prefix);
}
-
+
/* Return the next name which partially matches from the command list. */
if (comp)
{
@@ -152,7 +152,7 @@ emacs_output_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg, gpointer data)
const mix_vm_t *vm = mix_vm_cmd_dispatcher_get_vm (dis);
const mix_src_file_t *src = mix_vm_get_src_file (vm);
const gchar *path = mix_src_file_get_path (src);
-
+
mix_address_t loc = mix_vm_get_prog_count (vm);
guint lineno = mix_vm_get_address_lineno (vm, loc);
@@ -172,7 +172,7 @@ cmd_quit_ (mix_vm_cmd_dispatcher_t *dis, const char *arg)
return FALSE;
}
-static int
+static int
cmd_shell_ (mix_vm_cmd_dispatcher_t *dis, const char *arg)
{
system (arg);
@@ -185,7 +185,7 @@ cmd_prompt_ (mix_vm_cmd_dispatcher_t *dis, const char *arg)
if (arg && strlen (arg)) mix_vmloop_set_prompt (arg);
return TRUE;
}
-
+
/* external interface */
static void
@@ -193,11 +193,11 @@ init_dis_ (mix_vm_cmd_dispatcher_t *dis)
{
static const gchar * envars[] = { "MDK_EDITOR", "X_EDITOR", "EDITOR",
"VISUAL" };
-
+
static const guint s = sizeof (envars) / sizeof (envars[0]);
static const gchar *editor = NULL;
gchar *edit = NULL;
-
+
if (!editor)
{
int k;
@@ -227,9 +227,9 @@ mixvm_cmd_init (mix_config_t *config, char *arg, gboolean use_emacs)
if ( dis_ == NULL)
g_error (_("Failed initialisation (no memory resources)"));
-
+
init_dis_ (dis_);
-
+
/* add local commands */
k = 0;
while (commands[k].name)
@@ -237,7 +237,7 @@ mixvm_cmd_init (mix_config_t *config, char *arg, gboolean use_emacs)
mix_vm_cmd_dispatcher_register_new (dis_, commands + k);
++k;
}
-
+
/* install post hook for emacs interaction */
if (use_emacs)
{
@@ -248,7 +248,7 @@ mixvm_cmd_init (mix_config_t *config, char *arg, gboolean use_emacs)
if (arg)
mix_vm_cmd_dispatcher_dispatch (dis_, MIX_CMD_LOAD, arg);
-
+
return dis_;
}
@@ -256,14 +256,14 @@ gboolean
mixvm_cmd_exec (char *line)
{
if (!line) return cmd_quit_(dis_, NULL);
-
+
/* strip white space */
line = g_strstrip(line);
if (strlen (line) == 0) return TRUE;
if (try_guile_ (line)) return TRUE;
-
+
(void)mix_vm_cmd_dispatcher_dispatch_text (dis_, line);
return TRUE;