diff --git a/libguile/list.h b/libguile/list.h index 238926e21..c5813e981 100644 --- a/libguile/list.h +++ b/libguile/list.h @@ -3,7 +3,7 @@ #ifndef SCM_LIST_H #define SCM_LIST_H -/* Copyright (C) 1995,1996,1997,2000,2001,2003,2004,2005,2006,2008,2009 +/* Copyright (C) 1995-1997,2000-2001,2003-2006,2008-2009,2018 * Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or @@ -69,6 +69,40 @@ SCM_API SCM scm_filter (SCM pred, SCM list); SCM_API SCM scm_filter_x (SCM pred, SCM list); SCM_API SCM scm_copy_tree (SCM obj); + + +#define SCM_VALIDATE_REST_ARGUMENT(x) \ + do { \ + if (SCM_DEBUG_REST_ARGUMENT) { \ + if (scm_ilength (x) < 0) { \ + SCM_MISC_ERROR ("Rest arguments do not form a proper list.", SCM_EOL); \ + } \ + } \ + } while (0) + +#define SCM_VALIDATE_LIST(pos, lst) \ + do { \ + SCM_ASSERT (scm_ilength (lst) >= 0, lst, pos, FUNC_NAME); \ + } while (0) + +#define SCM_VALIDATE_NONEMPTYLIST(pos, lst) \ + do { \ + SCM_ASSERT (scm_ilength (lst) > 0, lst, pos, FUNC_NAME); \ + } while (0) + +#define SCM_VALIDATE_LIST_COPYLEN(pos, lst, cvar) \ + do { \ + cvar = scm_ilength (lst); \ + SCM_ASSERT (cvar >= 0, lst, pos, FUNC_NAME); \ + } while (0) + +#define SCM_VALIDATE_NONEMPTYLIST_COPYLEN(pos, lst, cvar) \ + do { \ + cvar = scm_ilength (lst); \ + SCM_ASSERT (cvar >= 1, lst, pos, FUNC_NAME); \ + } while (0) + + /* Guile internal functions */ diff --git a/libguile/validate.h b/libguile/validate.h index 08fcb9278..cb15622bc 100644 --- a/libguile/validate.h +++ b/libguile/validate.h @@ -31,17 +31,6 @@ - - -#define SCM_VALIDATE_REST_ARGUMENT(x) \ - do { \ - if (SCM_DEBUG_REST_ARGUMENT) { \ - if (scm_ilength (x) < 0) { \ - SCM_MISC_ERROR ("Rest arguments do not form a proper list.", SCM_EOL); \ - } \ - } \ - } while (0) - #define SCM_VALIDATE_NIM(pos, scm) SCM_MAKE_VALIDATE_MSG (pos, scm, NIMP, "non-immediate") #define SCM_VALIDATE_BOOL(pos, flag) \ @@ -86,28 +75,6 @@ SCM_I_MAKE_VALIDATE_MSG2 (pos, scm, scm_is_mutable_pair, "mutable pair") #endif /* BUILDING_LIBGUILE */ -#define SCM_VALIDATE_LIST(pos, lst) \ - do { \ - SCM_ASSERT (scm_ilength (lst) >= 0, lst, pos, FUNC_NAME); \ - } while (0) - -#define SCM_VALIDATE_NONEMPTYLIST(pos, lst) \ - do { \ - SCM_ASSERT (scm_ilength (lst) > 0, lst, pos, FUNC_NAME); \ - } while (0) - -#define SCM_VALIDATE_LIST_COPYLEN(pos, lst, cvar) \ - do { \ - cvar = scm_ilength (lst); \ - SCM_ASSERT (cvar >= 0, lst, pos, FUNC_NAME); \ - } while (0) - -#define SCM_VALIDATE_NONEMPTYLIST_COPYLEN(pos, lst, cvar) \ - do { \ - cvar = scm_ilength (lst); \ - SCM_ASSERT (cvar >= 1, lst, pos, FUNC_NAME); \ - } while (0) - #define SCM_VALIDATE_ALISTCELL(pos, alist) \ do { \ SCM_ASSERT (scm_is_pair (alist) && scm_is_pair (SCM_CAR (alist)), \