-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 3 of
+ * the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
\f
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "libguile/strings.h"
#include "libguile/ports.h"
+#include "libguile/private-options.h"
+
+
/* Windows defines. */
#ifdef __MINGW32__
#define vsnprintf _vsnprintf
\f
-#if (SCM_ENABLE_DEPRECATED == 1)
-
struct issued_warning {
struct issued_warning *prev;
const char *message;
};
static struct issued_warning *issued_warnings;
-static enum { detailed, summary, summary_print } mode;
+static int print_summary = 0;
void
scm_c_issue_deprecation_warning (const char *msg)
{
- if (mode != detailed)
- mode = summary_print;
+ if (!SCM_WARN_DEPRECATED)
+ print_summary = 1;
else
{
struct issued_warning *iw;
scm_newline (scm_current_error_port ());
}
msg = strdup (msg);
- iw = scm_malloc (sizeof (struct issued_warning));
+ iw = malloc (sizeof (struct issued_warning));
if (msg == NULL || iw == NULL)
return;
iw->message = msg;
"they are printed in turn, each one followed by a newline.")
#define FUNC_NAME s_scm_issue_deprecation_warning
{
- if (mode != detailed)
- mode = summary_print;
+ if (!SCM_WARN_DEPRECATED)
+ print_summary = 1;
else
{
SCM nl = scm_from_locale_string ("\n");
static void
print_deprecation_summary (void)
{
- if (mode == summary_print)
+ if (print_summary)
{
fputs ("\n"
"Some deprecated features have been used. Set the environment\n"
}
}
-#endif
-
SCM_DEFINE(scm_include_deprecated_features,
"include-deprecated-features", 0, 0, 0,
(),
void
scm_init_deprecation ()
{
-#if (SCM_ENABLE_DEPRECATED == 1)
const char *level = getenv ("GUILE_WARN_DEPRECATED");
if (level == NULL)
level = SCM_WARN_DEPRECATED_DEFAULT;
if (!strcmp (level, "detailed"))
- mode = detailed;
+ SCM_WARN_DEPRECATED = 1;
else if (!strcmp (level, "no"))
- mode = summary;
+ SCM_WARN_DEPRECATED = 0;
else
{
- mode = summary;
+ SCM_WARN_DEPRECATED = 0;
atexit (print_deprecation_summary);
}
-#endif
#include "libguile/deprecation.x"
}
/*
Local Variables:
c-file-style: "gnu"
- End: */
+ End:
+ */