1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00

remove "discouraged" infrastructure

* libguile/discouraged.h: Remove.

* libguile/deprecated.c (scm_internal_select, scm_thread_sleep)
  (scm_thread_usleep): Deprecate formerly discouraged names.

* libguile/eq.h (SCM_EQ_P):
* libguile/pairs.h (SCM_NULLP, SCM_NNULLP, SCM_CONSP, SCM_NCONSP):
* libguile/boolean.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOLP, SCM_BOOL):
  (SCM_NEGATE_BOOL, SCM_BOOL_NOT): Undiscourage these names, because I'm
  not sure deprecating them will do any good.

* libguile.h:
* libguile/gen-scmconfig.c:
* libguile/numbers.c:
* libguile/init.c:
* libguile/Makefile.am:
* configure.ac: Remove bits that referenced discouraged.h, and dealt
  with the "discouraging" system.
This commit is contained in:
Andy Wingo 2010-08-08 14:15:47 +02:00
parent 220058a835
commit 8a4ed2dd34
13 changed files with 77 additions and 123 deletions

View file

@ -130,15 +130,6 @@ AC_ARG_ENABLE(regex,
[ --disable-regex omit regular expression interfaces],, [ --disable-regex omit regular expression interfaces],,
enable_regex=yes) enable_regex=yes)
AC_ARG_ENABLE([discouraged],
AS_HELP_STRING([--disable-discouraged],[omit discouraged features]))
if test "$enable_discouraged" = no; then
SCM_I_GSC_ENABLE_DISCOURAGED=0
else
SCM_I_GSC_ENABLE_DISCOURAGED=1
fi
AC_ARG_ENABLE([deprecated], AC_ARG_ENABLE([deprecated],
AS_HELP_STRING([--disable-deprecated],[omit deprecated features])) AS_HELP_STRING([--disable-deprecated],[omit deprecated features]))

View file

@ -123,7 +123,6 @@ extern "C" {
#include "libguile/threads.h" #include "libguile/threads.h"
#include "libguile/inline.h" #include "libguile/inline.h"
#include "libguile/discouraged.h"
#include "libguile/deprecated.h" #include "libguile/deprecated.h"
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -487,7 +487,6 @@ modinclude_HEADERS = \
debug.h \ debug.h \
deprecated.h \ deprecated.h \
deprecation.h \ deprecation.h \
discouraged.h \
dynl.h \ dynl.h \
dynwind.h \ dynwind.h \
eq.h \ eq.h \

View file

@ -56,8 +56,7 @@
(SCM_MATCHES_BITS_IN_COMMON ((x), SCM_ELISP_NIL, SCM_BOOL_F)) (SCM_MATCHES_BITS_IN_COMMON ((x), SCM_ELISP_NIL, SCM_BOOL_F))
#define scm_is_true_and_not_nil(x) (!scm_is_false_or_nil (x)) #define scm_is_true_and_not_nil(x) (!scm_is_false_or_nil (x))
/* /* #nil is false. */
#nil is false. */
#define scm_is_false(x) (scm_is_false_or_nil (x)) #define scm_is_false(x) (scm_is_false_or_nil (x))
#define scm_is_true(x) (!scm_is_false (x)) #define scm_is_true(x) (!scm_is_false (x))
@ -91,6 +90,17 @@ SCM_API int scm_to_bool (SCM x);
/* Older spellings for the above routines, kept around for
compatibility. */
#define SCM_FALSEP(x) (scm_is_false (x))
#define SCM_NFALSEP(x) (scm_is_true (x))
#define SCM_BOOLP(x) (scm_is_bool (x))
#define SCM_BOOL(x) (scm_from_bool (x))
#define SCM_NEGATE_BOOL(f) (scm_from_bool (!(f)))
#define SCM_BOOL_NOT(x) (scm_not (x))
/* /*
* The following macros efficiently implement boolean truth testing as * The following macros efficiently implement boolean truth testing as
* expected by most lisps, which treat '() aka SCM_EOL as false. * expected by most lisps, which treat '() aka SCM_EOL as false.

View file

@ -34,7 +34,6 @@
#include "libguile/bytevectors.h" #include "libguile/bytevectors.h"
#include "libguile/bitvectors.h" #include "libguile/bitvectors.h"
#include "libguile/deprecated.h" #include "libguile/deprecated.h"
#include "libguile/discouraged.h"
#include "libguile/deprecation.h" #include "libguile/deprecation.h"
#include "libguile/snarf.h" #include "libguile/snarf.h"
#include "libguile/validate.h" #include "libguile/validate.h"
@ -2333,6 +2332,33 @@ scm_c_make_keyword (const char *s)
return scm_from_locale_keyword (s); return scm_from_locale_keyword (s);
} }
unsigned int
scm_thread_sleep (unsigned int t)
{
scm_c_issue_deprecation_warning
("`scm_thread_sleep' is deprecated. Use scm_std_sleep instead.");
return scm_std_sleep (t);
}
unsigned long
scm_thread_usleep (unsigned long t)
{
scm_c_issue_deprecation_warning
("`scm_thread_usleep' is deprecated. Use scm_std_usleep instead.");
return scm_std_usleep (t);
}
int scm_internal_select (int fds,
SELECT_TYPE *rfds,
SELECT_TYPE *wfds,
SELECT_TYPE *efds,
struct timeval *timeout)
{
scm_c_issue_deprecation_warning
("`scm_internal_select' is deprecated. Use scm_std_select instead.");
return scm_std_select (fds, rfds, wfds, efds, timeout);
}
void void

View file

@ -27,6 +27,7 @@
#include "libguile/strings.h" #include "libguile/strings.h"
#include "libguile/eval.h" #include "libguile/eval.h"
#include "libguile/throw.h" #include "libguile/throw.h"
#include "libguile/iselect.h"
#if (SCM_ENABLE_DEPRECATED == 1) #if (SCM_ENABLE_DEPRECATED == 1)
@ -727,6 +728,13 @@ SCM_DEPRECATED SCM scm_keyword_dash_symbol (SCM keyword);
SCM_DEPRECATED SCM scm_c_make_keyword (const char *s); SCM_DEPRECATED SCM scm_c_make_keyword (const char *s);
SCM_DEPRECATED unsigned int scm_thread_sleep (unsigned int);
SCM_DEPRECATED unsigned long scm_thread_usleep (unsigned long);
SCM_DEPRECATED int scm_internal_select (int fds,
SELECT_TYPE *rfds,
SELECT_TYPE *wfds,
SELECT_TYPE *efds,
struct timeval *timeout);
void scm_i_init_deprecated (void); void scm_i_init_deprecated (void);

View file

@ -1,97 +0,0 @@
/* This file contains definitions for discouraged features. When you
discourage something, move it here when that is feasible.
A discouraged feature is one that shouldn't be used in new code
since we have a better alternative now. However, there is nothing
wrong with using the old feature, so it is OK to continue to use
it.
Eventually, discouraged features can be deprecated since removing
them will make Guile simpler.
*/
#ifndef SCM_DISCOURAGED_H
#define SCM_DISCOURAGED_H
/* Copyright (C) 2004, 2006, 2010 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 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
* 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., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include "libguile/__scm.h"
#if SCM_ENABLE_DISCOURAGED == 1
/* Discouraged because they do not follow the naming convention. That
is, they end in "P" but return a C boolean. Also, SCM_BOOLP
evaluates its argument twice.
*/
#define SCM_FALSEP scm_is_false
#define SCM_NFALSEP scm_is_true
#define SCM_BOOLP scm_is_bool
#define SCM_EQ_P scm_is_eq
/* Convert from a C boolean to a SCM boolean value */
#define SCM_BOOL scm_from_bool
/* Convert from a C boolean to a SCM boolean value and negate it */
#define SCM_NEGATE_BOOL(f) scm_from_bool(!(f))
/* SCM_BOOL_NOT returns the other boolean.
* The order of ^s here is important for Borland C++ (!?!?!)
*/
#define SCM_BOOL_NOT(x) (SCM_PACK (SCM_UNPACK (x) \
^ (SCM_UNPACK (SCM_BOOL_T) \
^ SCM_UNPACK (SCM_BOOL_F))))
/* Discouraged because scm_is_symbol has a better name,
*/
#define SCM_SYMBOLP scm_is_symbol
/* Discouraged because the alternatives have the better names.
*/
#define SCM_SYMBOL_FUNC scm_symbol_fref
#define SCM_SET_SYMBOL_FUNC scm_symbol_fset_x
#define SCM_SYMBOL_PROPS scm_symbol_pref
#define SCM_SET_SYMBOL_PROPS scm_symbol_pset_x
/* Discouraged because there are better ways.
*/
#define SCM_SYMBOL_HASH scm_i_symbol_hash
#define SCM_SYMBOL_INTERNED_P(X) scm_i_symbol_is_interned
/* Discouraged because they evaluated their arguments twice and/or
don't fit the naming scheme.
*/
#define SCM_CONSP(x) (scm_is_pair (x))
#define SCM_NCONSP(x) (!SCM_CONSP (x))
#define SCM_NULLP(x) (scm_is_null (x))
#define SCM_NNULLP(x) (!scm_is_null (x))
/* Discouraged because the 'internal' and 'thread' moniker is
confusing.
*/
#define scm_internal_select scm_std_select
#define scm_thread_sleep scm_std_sleep
#define scm_thread_usleep scm_std_usleep
#endif /* SCM_ENABLE_DISCOURAGED == 1 */
#endif /* SCM_DISCOURAGED_H */

View file

@ -3,7 +3,7 @@
#ifndef SCM_EQ_H #ifndef SCM_EQ_H
#define SCM_EQ_H #define SCM_EQ_H
/* Copyright (C) 1995,1996,2000, 2006, 2008 Free Software Foundation, Inc. /* Copyright (C) 1995,1996,2000, 2006, 2008, 2010 Free Software Foundation, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -27,6 +27,13 @@
/* scm_is_eq is defined in tags.h for some reason. */
/* An older spelling for scm_is_eq. */
#define SCM_EQ_P(x,y) (scm_is_eq (x, y))
SCM_API SCM scm_eq_p (SCM x, SCM y); SCM_API SCM scm_eq_p (SCM x, SCM y);
SCM_API SCM scm_eqv_p (SCM x, SCM y); SCM_API SCM scm_eqv_p (SCM x, SCM y);
SCM_API SCM scm_equal_p (SCM x, SCM y); SCM_API SCM scm_equal_p (SCM x, SCM y);

View file

@ -218,12 +218,6 @@ main (int argc, char *argv[])
else else
pf ("/* #undef GUILE_DEBUG */\n"); pf ("/* #undef GUILE_DEBUG */\n");
/*** SCM_ENABLE_DISCOURAGED (0 or 1) ***/
pf ("\n");
pf ("/* Set to 1 if you want to enable discouraged features. */\n");
pf ("/* (value will be 0 or 1). */\n");
pf ("#define SCM_ENABLE_DISCOURAGED %d\n", SCM_I_GSC_ENABLE_DISCOURAGED);
/*** SCM_ENABLE_DEPRECATED (0 or 1) ***/ /*** SCM_ENABLE_DEPRECATED (0 or 1) ***/
pf ("\n"); pf ("\n");
pf ("/* Set to 1 if you want to enable deprecated features. */\n"); pf ("/* Set to 1 if you want to enable deprecated features. */\n");

View file

@ -134,7 +134,6 @@
#include "libguile/extensions.h" #include "libguile/extensions.h"
#include "libguile/uniform.h" #include "libguile/uniform.h"
#include "libguile/srfi-4.h" #include "libguile/srfi-4.h"
#include "libguile/discouraged.h"
#include "libguile/deprecated.h" #include "libguile/deprecated.h"
#include "libguile/init.h" #include "libguile/init.h"

View file

@ -67,8 +67,6 @@
#include "libguile/eq.h" #include "libguile/eq.h"
#include "libguile/discouraged.h"
/* values per glibc, if not already defined */ /* values per glibc, if not already defined */
#ifndef M_LOG10E #ifndef M_LOG10E
#define M_LOG10E 0.43429448190325182765 #define M_LOG10E 0.43429448190325182765

View file

@ -56,11 +56,19 @@
(SCM_MATCHES_BITS_IN_COMMON ((x), SCM_ELISP_NIL, SCM_EOL)) (SCM_MATCHES_BITS_IN_COMMON ((x), SCM_ELISP_NIL, SCM_EOL))
/* Older spellings for these nil predicates. */
/* Older spellings for these null, nil, and pair predicates. */
#define SCM_NILP(x) (scm_is_eq ((x), SCM_ELISP_NIL)) #define SCM_NILP(x) (scm_is_eq ((x), SCM_ELISP_NIL))
#define SCM_NULL_OR_NIL_P(x) (scm_is_null_or_nil (x)) #define SCM_NULL_OR_NIL_P(x) (scm_is_null_or_nil (x))
#define SCM_NULLP(x) (scm_is_null (x))
#define SCM_NNULLP(x) (!scm_is_null (x))
#define SCM_CONSP(x) (scm_is_pair (x))
#define SCM_NCONSP(x) (!SCM_CONSP (x))
/* #nil is null. */ /* #nil is null. */
#define scm_is_null(x) (scm_is_null_or_nil(x)) #define scm_is_null(x) (scm_is_null_or_nil(x))

View file

@ -3,7 +3,7 @@
#ifndef SCM_SYMBOLS_H #ifndef SCM_SYMBOLS_H
#define SCM_SYMBOLS_H #define SCM_SYMBOLS_H
/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2003, 2004, 2006, 2008 Free Software Foundation, Inc. /* Copyright (C) 1995,1996,1997,1998,2000,2001, 2003, 2004, 2006, 2008, 2010 Free Software Foundation, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -36,6 +36,18 @@
/* Older spellings; don't use in new code.
*/
#define SCM_SYMBOLP(x) (scm_is_symbol (x))
#define SCM_SYMBOL_FUNC(x) (scm_symbol_fref (x))
#define SCM_SET_SYMBOL_FUNC(x,f) (scm_symbol_fset_x (x, f))
#define SCM_SYMBOL_PROPS(x) (scm_symbol_pref (x))
#define SCM_SET_SYMBOL_PROPS(x,p) (scm_symbol_pset_x (x, p))
#define SCM_SYMBOL_HASH(x) (scm_i_symbol_hash (x))
#define SCM_SYMBOL_INTERNED_P(x) (scm_i_symbol_is_interned (x))
#ifdef GUILE_DEBUG #ifdef GUILE_DEBUG
SCM_API SCM scm_sys_symbols (void); SCM_API SCM scm_sys_symbols (void);
#endif #endif