From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Bill Schottstaedt Newsgroups: gmane.lisp.guile.bugs Subject: Re: number->string of float with radix Date: Sun, 20 Oct 2002 03:44:42 -0700 Sender: bug-guile-admin@gnu.org Message-ID: <200210201044.DAA19994@cmn14.stanford.edu> References: <200210141055.DAA10691@cmn14.stanford.edu> <87vg3z1kje.fsf@zagadka.ping.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (NeXT Mail 3.3 v148.2.1) Content-Type: text/plain X-Trace: main.gmane.org 1035110691 27986 80.91.224.249 (20 Oct 2002 10:44:51 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 10:44:51 +0000 (UTC) Cc: bug-guile@gnu.org Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 183DZh-0007HF-00 for ; Sun, 20 Oct 2002 12:44:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 183Da8-0005c2-00; Sun, 20 Oct 2002 06:45:16 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 183DZi-0005YA-00 for bug-guile@gnu.org; Sun, 20 Oct 2002 06:44:50 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 183DZe-0005WN-00 for bug-guile@gnu.org; Sun, 20 Oct 2002 06:44:48 -0400 Original-Received: from cm-mail.stanford.edu ([171.64.197.135]) by monty-python.gnu.org with esmtp (Exim 4.10) id 183DZd-0005WB-00 for bug-guile@gnu.org; Sun, 20 Oct 2002 06:44:46 -0400 Original-Received: from cmn14.stanford.edu (cmn14.stanford.edu [171.64.197.163]) by cm-mail.stanford.edu (8.11.6/8.11.6) with ESMTP id g9KAijL23914; Sun, 20 Oct 2002 03:44:45 -0700 Original-Received: (from bil@localhost) by cmn14.stanford.edu (8.9.3/8.9.3) id DAA19994; Sun, 20 Oct 2002 03:44:44 -0700 (PDT) In-Reply-To: <87vg3z1kje.fsf@zagadka.ping.de> X-Nextstep-Mailer: Mail 3.3 [m68k] (Enhance 2.2p2) Original-Received: by NeXT.Mailer (1.148.2.1) Original-To: Marius Vollmer Errors-To: bug-guile-admin@gnu.org X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Bug reports for GUILE, GNU's Ubiquitous Extension Language List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.bugs:532 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.bugs:532 > then incrementally replace uses of SCM_MAKE_VALIDATE with improved > versions. Or use SCM_ASSERT_TYPE directly. Hmm. It would not be hard to fix SCM_MAKE_VALIDATE entirely -- it's only used in validate.h, async.c, modules.h, and goops.h; here's a suggestion (I'm guessing in some cases -- see the "???"): validate.h starting at line 138): #define SCM_MAKE_VALIDATE2(pos, var, pred, msg) \ do { \ SCM_ASSERT_TYPE (SCM_ ## pred (var), var, pos, FUNC_NAME, msg); \ } while (0) #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_VALIDATE2 (pos, scm, NIMP, "variable") /* ??? */ #define SCM_VALIDATE_BOOL(pos, flag) SCM_MAKE_VALIDATE2(pos, flag, BOOLP, "boolean") #define SCM_VALIDATE_BOOL_COPY(pos, flag, cvar) \ do { \ SCM_ASSERT (SCM_BOOLP (flag), flag, pos, FUNC_NAME); \ cvar = SCM_EQ_P (flag, SCM_BOOL_T) ? 1 : 0; \ } while (0) #define SCM_VALIDATE_CHAR(pos, scm) SCM_MAKE_VALIDATE2 (pos, scm, CHARP, "character") #define SCM_VALIDATE_CHAR_COPY(pos, scm, cvar) \ do { \ SCM_ASSERT (SCM_CHARP (scm), scm, pos, FUNC_NAME); \ cvar = SCM_CHAR (scm); \ } while (0) #define SCM_VALIDATE_STRING(pos, str) SCM_MAKE_VALIDATE2 (pos, str, STRINGP, "string") #define SCM_VALIDATE_STRING_COPY(pos, str, cvar) \ do { \ SCM_ASSERT (SCM_STRINGP (str), str, pos, FUNC_NAME); \ cvar = SCM_STRING_CHARS(str); \ } while (0) /* validate a string and optional start/end arguments which default to 0/string-len. this is unrelated to the old shared substring support, so please do not deprecate it :) */ #define SCM_VALIDATE_SUBSTRING_SPEC_COPY(pos_str, str, c_str, \ pos_start, start, c_start,\ pos_end, end, c_end) \ do {\ SCM_VALIDATE_STRING_COPY (pos_str, str, c_str);\ SCM_VALIDATE_INUM_DEF_COPY (pos_start, start, 0, c_start);\ SCM_VALIDATE_INUM_DEF_COPY (pos_end, end, SCM_STRING_LENGTH (str), c_end);\ SCM_ASSERT_RANGE (pos_start, start,\ 0 <= c_start \ && (size_t) c_start <= SCM_STRING_LENGTH (str));\ SCM_ASSERT_RANGE (pos_end, end,\ c_start <= c_end \ && (size_t) c_end <= SCM_STRING_LENGTH (str));\ } while (0) #define SCM_VALIDATE_REAL(pos, z) SCM_MAKE_VALIDATE2 (pos, z, REALP, "real") #define SCM_VALIDATE_NUMBER(pos, z) SCM_MAKE_VALIDATE2 (pos, z, NUMBERP, "number") #define SCM_VALIDATE_INUM(pos, k) SCM_MAKE_VALIDATE2 (pos, k, INUMP, "exact integer") #define SCM_VALIDATE_INUM_COPY(pos, k, cvar) \ do { \ SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \ cvar = SCM_INUM (k); \ } while (0) #define SCM_VALIDATE_USHORT_COPY(pos, k, cvar) \ do { \ cvar = SCM_NUM2USHORT (pos, k); \ } while (0) #define SCM_VALIDATE_SHORT_COPY(pos, k, cvar) \ do { \ cvar = SCM_NUM2SHORT (pos, k); \ } while (0) #define SCM_VALIDATE_UINT_COPY(pos, k, cvar) \ do { \ cvar = SCM_NUM2UINT (pos, k); \ } while (0) #define SCM_VALIDATE_INT_COPY(pos, k, cvar) \ do { \ cvar = SCM_NUM2INT (pos, k); \ } while (0) #define SCM_VALIDATE_ULONG_COPY(pos, k, cvar) \ do { \ cvar = SCM_NUM2ULONG (pos, k); \ } while (0) #define SCM_VALIDATE_LONG_COPY(pos, k, cvar) \ do { \ cvar = SCM_NUM2LONG (pos, k); \ } while (0) #define SCM_VALIDATE_FLOAT_COPY(pos, k, cvar) \ do { \ cvar = SCM_NUM2FLOAT (pos, k); \ } while (0) #define SCM_VALIDATE_DOUBLE_COPY(pos, k, cvar) \ do { \ cvar = SCM_NUM2DOUBLE (pos, k); \ } while (0) #define SCM_VALIDATE_BIGINT(pos, k) SCM_MAKE_VALIDATE2 (pos, k, BIGP, "bignum") #define SCM_VALIDATE_INUM_MIN(pos, k, min) \ do { \ SCM_ASSERT (SCM_INUMP(k), k, pos, FUNC_NAME); \ SCM_ASSERT_RANGE (pos, k, (SCM_INUM (k) >= min)); \ } while (0) #define SCM_VALIDATE_INUM_MIN_COPY(pos, k, min, cvar) \ do { \ SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \ SCM_ASSERT_RANGE (pos, k, (SCM_INUM (k) >= min)); \ cvar = SCM_INUM (k); \ } while (0) #define SCM_VALIDATE_INUM_MIN_DEF_COPY(pos, k, min, default, cvar) \ do { \ if (SCM_UNBNDP (k)) \ k = SCM_MAKINUM (default); \ SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \ SCM_ASSERT_RANGE (pos, k, (SCM_INUM (k) >= min)); \ cvar = SCM_INUM (k); \ } while (0) #define SCM_VALIDATE_INUM_DEF(pos, k, default) \ do { \ if (SCM_UNBNDP (k)) \ k = SCM_MAKINUM (default); \ else SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \ } while (0) #define SCM_VALIDATE_INUM_DEF_COPY(pos, k, default, cvar) \ do { \ if (SCM_UNBNDP (k)) \ { \ k = SCM_MAKINUM (default); \ cvar = default; \ } \ else \ { \ SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \ cvar = SCM_INUM (k); \ } \ } while (0) #define SCM_VALIDATE_DOUBLE_DEF_COPY(pos, k, default, cvar) \ do { \ if (SCM_UNBNDP (k)) \ { \ k = scm_make_real (default); \ cvar = default; \ } \ else \ { \ cvar = SCM_NUM2DOUBLE (pos, k); \ } \ } while (0) /* [low, high) */ #define SCM_VALIDATE_INUM_RANGE(pos, k, low, high) \ do { SCM_ASSERT(SCM_INUMP(k), k, pos, FUNC_NAME); \ SCM_ASSERT_RANGE(pos, k, \ (SCM_INUM (k) >= low && \ SCM_INUM (k) < high)); \ } while (0) #define SCM_VALIDATE_INUM_RANGE_COPY(pos, k, low, high, cvar) \ do { \ SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \ SCM_ASSERT_RANGE (pos, k, low <= SCM_INUM (k) && SCM_INUM (k) < high); \ cvar = SCM_INUM (k); \ } while (0) #define SCM_VALIDATE_NULL(pos, scm) SCM_MAKE_VALIDATE2 (pos, scm, NULLP, "null") #define SCM_VALIDATE_NULL_OR_NIL(pos, scm) SCM_MAKE_VALIDATE2 (pos, scm, NULL_OR_NIL_P, "null or empty list") /* ??? */ #define SCM_VALIDATE_CONS(pos, scm) SCM_MAKE_VALIDATE2 (pos, scm, CONSP, "cons") #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_CONSP (alist) && SCM_CONSP (SCM_CAR (alist)), \ alist, pos, FUNC_NAME); \ } while (0) #define SCM_VALIDATE_ALISTCELL_COPYSCM(pos, alist, cvar) \ do { \ SCM_ASSERT (SCM_CONSP (alist), alist, pos, FUNC_NAME); \ cvar = SCM_CAR (alist); \ SCM_ASSERT (SCM_CONSP (cvar), alist, pos, FUNC_NAME); \ } while (0) #define SCM_VALIDATE_OPORT_VALUE(pos, port) \ do { \ SCM_ASSERT (scm_valid_oport_value_p (port), port, pos, FUNC_NAME); \ } while (0) #define SCM_VALIDATE_PRINTSTATE(pos, a) SCM_MAKE_VALIDATE2(pos, a, PRINT_STATE_P, "print-state") #define SCM_VALIDATE_SMOB(pos, obj, type) \ do { \ SCM_ASSERT (SCM_TYP16_PREDICATE (scm_tc16_ ## type, obj), \ obj, pos, FUNC_NAME); \ } while (0) #define SCM_VALIDATE_THREAD(pos, a) SCM_MAKE_VALIDATE2 (pos, a, THREADP, "thread") #define SCM_VALIDATE_THUNK(pos, thunk) \ do { \ SCM_ASSERT (!SCM_FALSEP (scm_thunk_p (thunk)), thunk, pos, FUNC_NAME); \ } while (0) #define SCM_VALIDATE_SYMBOL(pos, sym) SCM_MAKE_VALIDATE2 (pos, sym, SYMBOLP, "symbol") #define SCM_VALIDATE_VARIABLE(pos, var) SCM_MAKE_VALIDATE2 (pos, var, VARIABLEP, "variable") #define SCM_VALIDATE_MEMOIZED(pos, obj) SCM_MAKE_VALIDATE2 (pos, obj, MEMOIZEDP, "memoized entity") /* ??? */ #define SCM_VALIDATE_CLOSURE(pos, obj) SCM_MAKE_VALIDATE2 (pos, obj, CLOSUREP, "closure") #define SCM_VALIDATE_PROC(pos, proc) \ do { \ SCM_ASSERT (SCM_EQ_P (scm_procedure_p (proc), SCM_BOOL_T), proc, pos, FUNC_NAME); \ } while (0) #define SCM_VALIDATE_NULLORCONS(pos, env) \ do { \ SCM_ASSERT (SCM_NULLP (env) || SCM_CONSP (env), env, pos, FUNC_NAME); \ } while (0) #define SCM_VALIDATE_HOOK(pos, a) SCM_MAKE_VALIDATE2 (pos, a, HOOKP, "hook") #define SCM_VALIDATE_RGXP(pos, a) SCM_MAKE_VALIDATE2 (pos, a, RGXP, "regexp") /* ??? */ #define SCM_VALIDATE_DIR(pos, port) SCM_MAKE_VALIDATE2 (pos, port, DIRP, "directory") /* ??? */ #define SCM_VALIDATE_PORT(pos, port) SCM_MAKE_VALIDATE2 (pos, port, PORTP, "port") #define SCM_VALIDATE_INPUT_PORT(pos, port) \ SCM_MAKE_VALIDATE2 (pos, port, INPUT_PORT_P, "input port") #define SCM_VALIDATE_OUTPUT_PORT(pos, port) \ SCM_MAKE_VALIDATE2 (pos, port, OUTPUT_PORT_P, "output port") #define SCM_VALIDATE_FPORT(pos, port) SCM_MAKE_VALIDATE2 (pos, port, FPORTP, "port") /* ??? */ #define SCM_VALIDATE_OPFPORT(pos, port) SCM_MAKE_VALIDATE2 (pos, port, OPFPORTP, "port") /* ??? */ #define SCM_VALIDATE_OPINPORT(pos, port) \ SCM_MAKE_VALIDATE2 (pos, port, OPINPORTP, "port") /* ??? */ #define SCM_VALIDATE_OPENPORT(pos, port) \ do { \ SCM_ASSERT (SCM_PORTP (port) && SCM_OPENP (port), \ port, pos, FUNC_NAME); \ } while (0) #define SCM_VALIDATE_OPPORT(pos, port) SCM_MAKE_VALIDATE2 (pos, port, OPPORTP, "port") /* ??? */ #define SCM_VALIDATE_OPOUTPORT(pos, port) \ SCM_MAKE_VALIDATE2 (pos, port, OPOUTPORTP, "port") /* ??? */ #define SCM_VALIDATE_OPOUTSTRPORT(pos, port) \ SCM_MAKE_VALIDATE2 (pos, port, OPOUTSTRPORTP, "port") /* ??? */ #define SCM_VALIDATE_FLUID(pos, fluid) SCM_MAKE_VALIDATE2 (pos, fluid, FLUIDP, "fluid") #define SCM_VALIDATE_KEYWORD(pos, v) SCM_MAKE_VALIDATE2 (pos, v, KEYWORDP, "keyword") #define SCM_VALIDATE_STACK(pos, v) SCM_MAKE_VALIDATE2 (pos, v, STACKP, "stack") /* ??? */ #define SCM_VALIDATE_FRAME(pos, v) SCM_MAKE_VALIDATE2 (pos, v, FRAMEP, "frame") /* ??? */ #define SCM_VALIDATE_RSTATE(pos, v) SCM_MAKE_VALIDATE2 (pos, v, RSTATEP, "random-number-state") /* ??? */ #define SCM_VALIDATE_ARRAY(pos, v) \ do { \ SCM_ASSERT (!SCM_IMP (v) \ && !SCM_FALSEP (scm_array_p (v, SCM_UNDEFINED)), \ v, pos, FUNC_NAME); \ } while (0) #define SCM_VALIDATE_VECTOR(pos, v) SCM_MAKE_VALIDATE2 (pos, v, VECTORP, "vector") #define SCM_VALIDATE_VECTOR_OR_DVECTOR(pos, v) \ do { \ SCM_ASSERT ((SCM_VECTORP (v) \ || (!SCM_IMP (v) && SCM_TYP7 (v) == scm_tc7_dvect)), \ v, pos, FUNC_NAME); \ } while (0) #define SCM_VALIDATE_STRUCT(pos, v) SCM_MAKE_VALIDATE2 (pos, v, STRUCTP, "struct") #define SCM_VALIDATE_VTABLE(pos, v) \ do { \ SCM_ASSERT (!SCM_IMP (v) && !SCM_FALSEP (scm_struct_vtable_p (v)), \ v, pos, FUNC_NAME); \ } while (0) #define SCM_VALIDATE_VECTOR_LEN(pos, v, len) \ do { \ SCM_ASSERT (SCM_VECTORP (v) && len == SCM_VECTOR_LENGTH (v), v, pos, FUNC_NAME); \ } while (0) #endif /* SCM_VALIDATE_H */ ---------------- goops.h: #define SCM_CLASSP(x) \ (SCM_STRUCTP (x) && SCM_STRUCT_VTABLE_FLAGS (x) & SCM_CLASSF_METACLASS) #define SCM_VALIDATE_CLASS(pos, x) SCM_MAKE_VALIDATE2 (pos, x, CLASSP, "class") #define SCM_INSTANCEP(x) \ (SCM_STRUCTP (x) && (SCM_STRUCT_VTABLE_FLAGS (x) & SCM_CLASSF_GOOPS)) #define SCM_VALIDATE_INSTANCE(pos, x) SCM_MAKE_VALIDATE2 (pos, x, INSTANCEP, "instance") #define SCM_PUREGENERICP(x) \ (SCM_STRUCTP (x) && (SCM_STRUCT_VTABLE_FLAGS (x) & SCM_CLASSF_PURE_GENERIC)) #define SCM_VALIDATE_PUREGENERIC(pos, x) SCM_MAKE_VALIDATE2 (pos, x, PUREGENERICP, "generic") /* ??? */ #define SCM_ACCESSORP(x) \ (SCM_STRUCTP (x) && (SCM_STRUCT_VTABLE_FLAGS (x) & SCM_CLASSF_ACCESSOR_METHOD)) #define SCM_VALIDATE_ACCESSOR(pos, x) SCM_MAKE_VALIDATE2 (pos, x, ACCESSORP, "accessor") /* ??? */ #define SCM_SLOT(x, i) (SCM_PACK (SCM_INST (x) [i])) #define SCM_SET_SLOT(x, i, v) (SCM_INST (x) [i] = SCM_UNPACK (v)) #define SCM_INSTANCE_HASH(c, i) (SCM_INST (c) [scm_si_hashsets + (i)]) #define SCM_SET_HASHSET(c, i, h) (SCM_INST (c) [scm_si_hashsets + (i)] = (h)) #define SCM_SUBCLASSP(c1, c2) (!SCM_FALSEP (scm_c_memq (c2, SCM_SLOT (c1, scm_si_cpl)))) #define SCM_IS_A_P(x, c) \ (SCM_INSTANCEP (x) && SCM_SUBCLASSP (SCM_CLASS_OF (x), c)) #define SCM_GENERICP(x) \ (SCM_INSTANCEP (x) && SCM_SUBCLASSP (SCM_CLASS_OF (x), scm_class_generic)) #define SCM_VALIDATE_GENERIC(pos, x) SCM_MAKE_VALIDATE2 (pos, x, GENERICP, "generic function") /* ??? */ #define SCM_METHODP(x) \ (SCM_INSTANCEP (x) && SCM_SUBCLASSP (SCM_CLASS_OF (x), scm_class_method)) #define SCM_VALIDATE_METHOD(pos, x) SCM_MAKE_VALIDATE2 (pos, x, METHODP, "method") ---------------- async.c: #define VALIDATE_ASYNC(pos, a) SCM_MAKE_VALIDATE2(pos, a, ASYNCP, "async") /* ??? */ ---------------- modules.h: #define SCM_VALIDATE_MODULE(pos, scm) SCM_MAKE_VALIDATE2 (pos, scm, MODULEP, "module") _______________________________________________ Bug-guile mailing list Bug-guile@gnu.org http://mail.gnu.org/mailman/listinfo/bug-guile