diff options
| -rw-r--r-- | mixutils/mixvm.c | 38 | ||||
| -rw-r--r-- | mixutils/mixvm_command.c | 44 | 
2 files changed, 41 insertions, 41 deletions
| diff --git a/mixutils/mixvm.c b/mixutils/mixvm.c index f4a5b99..90d33d7 100644 --- a/mixutils/mixvm.c +++ b/mixutils/mixvm.c @@ -1,24 +1,24 @@  /* -*-c-*- -------------- mixvm.c :   * Main function for mixvm, the mix vm simulator   * ------------------------------------------------------------------ - *  $Id: mixvm.c,v 1.8 2002/04/08 00:31:06 jao Exp $ + *  $Id: mixvm.c,v 1.9 2004/06/09 12:58:38 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. - *   + *   */ @@ -65,7 +65,7 @@ static struct option long_options_[] =    {0, 0, 0, 0}  }; -static const gchar *USAGE_ =  +static const gchar *USAGE_ =  N_("Usage: %s [-vhurdqt] [--version] [--help] [--noinit] [--usage]"     "\n\t[--run] [--dump] [--time] [MIX_FILE]\n"); @@ -80,7 +80,7 @@ main (int argc, char **argv)    gboolean emacs = FALSE;    gboolean initfile = TRUE;    gboolean ptime = FALSE; -   +    setlocale (LC_ALL, "");    bindtextdomain (PACKAGE, LOCALEDIR);    textdomain (PACKAGE); @@ -88,11 +88,11 @@ main (int argc, char **argv)    while (1)      {        c = getopt_long (argc, argv, options_, long_options_, (int*)0); -      +        /* Detect the end of the options. */        if (c == -1)  	break; -      +        switch (c)  	{  	case HELP_OPT: case USAGE_OPT: @@ -125,26 +125,26 @@ main (int argc, char **argv)  	  g_assert_not_reached ();  	}      } -    +    if ( optind < argc-1 )      {        fprintf (stderr, _("*** Error: Too many input files.\n"));        return EXIT_FAILURE;      } -   -  if (!in)  in = argv[optind]; -   + +  if (!in) in = argv[optind]; +    mix_init_lib (); -   -  if (run) mix_vmrun(in, dump, ptime); + +  if (run) mix_vmrun (in, dump, ptime);    else mix_vmloop (argc, argv, initfile, in, emacs);    mix_release_lib (); -   +    return EXIT_SUCCESS; -   +  } -   + 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; | 
