1 /* Copyright (C) 1995,1996,1998,1999,2000,2001,2002 Free Software Foundation, Inc.
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "libguile/_scm.h"
29 #include "libguile/root.h"
30 #include "libguile/strings.h"
31 #include "libguile/validate.h"
33 #include "libguile/feature.h"
37 static SCM features_var
;
41 scm_add_feature (const char *str
)
43 SCM old
= SCM_VARIABLE_REF (features_var
);
44 SCM
new = scm_cons (scm_str2symbol (str
), old
);
45 SCM_VARIABLE_SET (features_var
, new);
50 SCM_DEFINE (scm_program_arguments
, "program-arguments", 0, 0, 0,
52 "@deffnx {Scheme Procedure} command-line\n"
53 "Return the list of command line arguments passed to Guile, as a list of\n"
54 "strings. The list includes the invoked program name, which is usually\n"
55 "@code{\"guile\"}, but excludes switches and parameters for command line\n"
56 "options like @code{-e} and @code{-l}.")
57 #define FUNC_NAME s_scm_program_arguments
63 /* Set the value returned by program-arguments, given ARGC and ARGV.
65 If FIRST is non-zero, make it the first element; we do this in
66 situations where other code (like getopt) has parsed out a few
67 arguments, but we still want the script name to be the first
70 scm_set_program_arguments (int argc
, char **argv
, char *first
)
72 scm_progargs
= scm_makfromstrs (argc
, argv
);
74 scm_progargs
= scm_cons (scm_makfrom0str (first
), scm_progargs
);
83 features_var
= scm_c_define ("*features*", SCM_EOL
);
85 scm_add_feature("system");
88 scm_add_feature(s_ed
);
91 scm_add_feature("sicp");
94 scm_add_feature("char-ready?");
96 #ifndef CHEAP_CONTINUATIONS
97 scm_add_feature ("full-continuation");
99 #if SCM_USE_NULL_THREADS
100 scm_add_feature ("threads");
103 scm_c_define ("char-code-limit", SCM_MAKINUM (SCM_CHAR_CODE_LIMIT
));
105 #include "libguile/feature.x"