Comment on #endif
[bpt/guile.git] / libguile / feature.c
CommitLineData
cc95e00a 1/* Copyright (C) 1995,1996,1998,1999,2000,2001,2002, 2003, 2004 Free Software Foundation, Inc.
0f2d19dd 2 *
73be1d9e
MV
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.
0f2d19dd 7 *
73be1d9e
MV
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.
0f2d19dd 12 *
73be1d9e
MV
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
16 */
1bbd0b84 17
1bbd0b84 18
0f2d19dd 19\f
b652768e
RB
20#if HAVE_CONFIG_H
21# include <config.h>
22#endif
0f2d19dd 23
1a450153
DH
24#ifdef HAVE_STRING_H
25#include <string.h>
26#endif
0f2d19dd 27
1a450153 28#include "libguile/_scm.h"
a0599745 29#include "libguile/root.h"
a0599745 30#include "libguile/strings.h"
a0599745 31#include "libguile/validate.h"
1a450153 32
a0599745 33#include "libguile/feature.h"
20e6290e 34
0f2d19dd
JB
35\f
36
86d31dfe 37static SCM features_var;
1a450153 38
0f2d19dd 39
0f2d19dd 40void
6e8d25a6 41scm_add_feature (const char *str)
0f2d19dd 42{
86d31dfe 43 SCM old = SCM_VARIABLE_REF (features_var);
cc95e00a 44 SCM new = scm_cons (scm_from_locale_symbol (str), old);
86d31dfe 45 SCM_VARIABLE_SET (features_var, new);
0f2d19dd
JB
46}
47
0f2d19dd 48\f
0b886892 49
3b3b36dd 50SCM_DEFINE (scm_program_arguments, "program-arguments", 0, 0, 0,
d46e4713 51 (),
8f85c0c6 52 "@deffnx {Scheme Procedure} command-line\n"
d46e4713
NJ
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}.")
1bbd0b84 57#define FUNC_NAME s_scm_program_arguments
0f2d19dd
JB
58{
59 return scm_progargs;
60}
1bbd0b84 61#undef FUNC_NAME
0f2d19dd 62
f29de790
JB
63/* Set the value returned by program-arguments, given ARGC and ARGV.
64
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
68 element. */
0b886892 69void
1bbd0b84 70scm_set_program_arguments (int argc, char **argv, char *first)
0b886892
JB
71{
72 scm_progargs = scm_makfromstrs (argc, argv);
f29de790 73 if (first)
cc95e00a 74 scm_progargs = scm_cons (scm_from_locale_string (first), scm_progargs);
0b886892
JB
75}
76
0f2d19dd 77
0f2d19dd
JB
78\f
79
0f2d19dd
JB
80void
81scm_init_feature()
0f2d19dd 82{
86d31dfe 83 features_var = scm_c_define ("*features*", SCM_EOL);
0f2d19dd
JB
84#ifndef _Windows
85 scm_add_feature("system");
86#endif
87#ifdef vms
88 scm_add_feature(s_ed);
89#endif
90#ifdef SICP
91 scm_add_feature("sicp");
92#endif
93#ifndef GO32
94 scm_add_feature("char-ready?");
95#endif
96#ifndef CHEAP_CONTINUATIONS
97 scm_add_feature ("full-continuation");
98#endif
a6cba733 99 scm_add_feature ("threads");
a6cba733 100
e11e83f3 101 scm_c_define ("char-code-limit", scm_from_int (SCM_CHAR_CODE_LIMIT));
26425129 102
a0599745 103#include "libguile/feature.x"
0f2d19dd 104}
89e00824
ML
105
106/*
107 Local Variables:
108 c-file-style: "gnu"
109 End:
110*/