-/* Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001 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, or (at your option)
gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
#include <stdio.h>
+#include <errno.h>
#include <ctype.h>
+
#include "libguile/_scm.h"
#include "libguile/gh.h"
#include "libguile/load.h"
n = strlen (str2);
if (str1)
{
- long len = strlen (str1);
- str1 = (char *) realloc (str1, (scm_sizet) (len + n + 1));
+ size_t len = strlen (str1);
+ str1 = (char *) realloc (str1, (size_t) (len + n + 1));
if (!str1)
return 0L;
strncat (str1 + len, str2, n);
return str1;
}
- str1 = (char *) malloc ((scm_sizet) (n + 1));
+ str1 = (char *) malloc ((size_t) (n + 1));
if (!str1)
return 0L;
str1[0] = 0;
script_read_arg (FILE *f)
#define FUNC_NAME "script_read_arg"
{
- int size = 7;
+ size_t size = 7;
char *buf = malloc (size + 1);
- int len = 0;
+ size_t len = 0;
if (! buf)
return 0;
" --debug start with debugging evaluator and backtraces\n"
" -q inhibit loading of user init file\n"
" --emacs enable Emacs protocol (experimental)\n"
+ " --use-srfi=LS load SRFI modules for the SRFIs in LS,\n"
+ " which is a list of numbers like \"2,13,14\"\n"
" -h, --help display this help and exit\n"
" -v, --version display version information and exit\n"
" \\ read arguments from following script lines\n",
SCM_SYMBOL (sym_load_user_init, "load-user-init");
SCM_SYMBOL (sym_top_repl, "top-repl");
SCM_SYMBOL (sym_quit, "quit");
+SCM_SYMBOL (sym_use_srfis, "use-srfis");
/* Given an array of command-line switches, return a Scheme expression
probably agree. I'd say I didn't feel comfortable doing that in
the present system. You'd say, well, fix the system so you are
comfortable doing that. I'd agree again. *shrug*
-
- We load the ice-9 system from here. It might be nicer if the
- libraries initialized from the inner_main function in guile.c (which
- will be auto-generated eventually) could assume ice-9 were already
- loaded. Then again, it might be nice if ice-9 could assume that
- certain libraries were already loaded. The solution is to break up
- ice-9 into modules which can be frozen and statically linked like any
- other module. Then all the modules can describe their dependencies in
- the usual way, and the auto-generated inner_main will do the right
- thing. */
+ */
static char guile[] = "guile";
else if (! strcmp (argv[i], "-q")) /* don't load user init */
inhibit_user_init = 1;
+ else if (! strncmp (argv[i], "--use-srfi=", 11)) /* load SRFIs */
+ {
+ SCM srfis = SCM_EOL; /* List of requested SRFIs. */
+ char * p = argv[i] + 11;
+ while (*p)
+ {
+ long num;
+ char * end;
+
+ num = strtol (p, &end, 10);
+ if (end - p > 0)
+ {
+ srfis = scm_cons (scm_long2num (num), srfis);
+ if (*end)
+ {
+ if (*end == ',')
+ p = end + 1;
+ else
+ scm_shell_usage (1, "invalid SRFI specification");
+ }
+ else
+ break;
+ }
+ else
+ scm_shell_usage (1, "invalid SRFI specification");
+ }
+ if (scm_ilength (srfis) <= 0)
+ scm_shell_usage (1, "invalid SRFI specification");
+ srfis = scm_reverse_x (srfis, SCM_UNDEFINED);
+ tail = scm_cons (scm_listify
+ (sym_use_srfis,
+ scm_listify (scm_sym_quote,
+ srfis, SCM_UNDEFINED),
+ SCM_UNDEFINED),
+ tail);
+ }
+
else if (! strcmp (argv[i], "-h")
|| ! strcmp (argv[i], "--help"))
{
scm_set_program_arguments (argc ? argc - i : 0, argv + i, argv0);
/* If the --emacs switch was set, now is when we process it. */
- scm_sysintern ("use-emacs-interface", SCM_BOOL (use_emacs_interface));
+ scm_c_define ("use-emacs-interface", SCM_BOOL (use_emacs_interface));
/* Handle the `-e' switch, if it was specified. */
if (!SCM_NULLP (entry_point))
}
exit (scm_exit_status (scm_eval_x (scm_compile_shell_switches (argc, argv),
- scm_the_root_module ())));
+ scm_current_module ())));
}