[plt-scheme] scheme_signal_error

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Apr 18 10:37:29 EDT 2003

At Fri, 18 Apr 2003 15:19:05 +0200, Olivier ORABONA wrote:
> Scheme_Object* foo(void* p, int argc, Scheme_Object** argv) {
> 	Scheme_Object* tmp = argv[0];
> 
> 	while(!SCHEME_NULLP(tmp)) {
> 		/* short circuit bar and directly try scheme_signal_error() */
> 		scheme_signal_error("Bad input : %S",SCHEME_CAR(tmp));
> 		tmp = SCHEME_CDR(tmp);
> 	}
> 	return scheme_true;
> }

Probably you want %V instead of %S. Even better, perhaps you want
to use scheme_wrong_type() instead of scheme_signal_error().

SCHEME_PAIRP() is probably the right predicate for the loop, with a
SCHEME_NULLP() test at the end to make sure that tmp was a list.

Matthew



Posted on the users mailing list.