head	1.1;
access;
symbols
	RELEASE_8_3_0:1.1
	RELEASE_9_0_0:1.1
	RELEASE_7_4_0:1.1
	RELEASE_8_2_0:1.1
	RELEASE_6_EOL:1.1
	RELEASE_8_1_0:1.1
	RELEASE_7_3_0:1.1
	RELEASE_8_0_0:1.1
	RELEASE_7_2_0:1.1
	RELEASE_7_1_0:1.1
	RELEASE_6_4_0:1.1
	RELEASE_5_EOL:1.1
	RELEASE_7_0_0:1.1
	RELEASE_6_3_0:1.1
	PRE_XORG_7:1.1
	RELEASE_4_EOL:1.1
	RELEASE_6_2_0:1.1
	RELEASE_6_1_0:1.1
	RELEASE_5_5_0:1.1
	RELEASE_6_0_0:1.1
	RELEASE_5_4_0:1.1
	RELEASE_4_11_0:1.1
	RELEASE_5_3_0:1.1
	RELEASE_4_10_0:1.1
	RELEASE_5_2_1:1.1
	RELEASE_5_2_0:1.1
	RELEASE_4_9_0:1.1
	RELEASE_5_1_0:1.1
	RELEASE_4_8_0:1.1
	RELEASE_5_0_0:1.1
	RELEASE_4_7_0:1.1
	RELEASE_4_6_2:1.1
	RELEASE_4_6_1:1.1
	RELEASE_4_6_0:1.1
	RELEASE_5_0_DP1:1.1
	RELEASE_4_5_0:1.1
	RELEASE_4_4_0:1.1
	RELEASE_4_3_0:1.1
	RELEASE_4_2_0:1.1
	RELEASE_4_1_1:1.1
	RELEASE_4_1_0:1.1
	RELEASE_3_5_0:1.1
	RELEASE_4_0_0:1.1;
locks; strict;
comment	@# @;


1.1
date	2000.03.01.09.56.55;	author tg;	state Exp;
branches;
next	;


desc
@@


1.1
log
@- Convert to ELF.
- Support CC/CFLAGS/PREFIX.

PR:		16677
Submitted by:	KATO Tsuguru <tkato@@prontomail.ne.jp>
@
text
@--- scrt/callcc.c.orig	Wed Feb 24 08:25:41 1993
+++ scrt/callcc.c	Wed Feb  2 22:22:22 2000
@@@@ -91,6 +91,11 @@@@
 #define  SETJMP( x )		sc_setjmp( x )
 #endif
 
+#ifdef FREEBSD
+#define  LONGJMP( x, y )	longjmp( x, y )
+#define  SETJMP( x )		setjmp( x )
+#endif
+
 TSCP  sc_clink;		/* Pointer to inner most continuation on stack. */
 
 /* Static declarations for data structures internal to the module.  These
@@@@ -192,6 +197,17 @@@@
 	STACKPTR( tos );
  	count = (((STACK_BYTES (bfp, tos)) + ((sizeof (S2CINT)) - 1))
 		 / (sizeof (S2CINT)));
+#ifdef LAZY_STACK_POP
+	/* NOTE WELL!
+	 * For machines that must pop arguments after a function call, 
+	 * the compiler may let arguments accumulate on the stack for several 
+	 * function calls and pop them all at once.
+	 * If your compiler uses this optimization, 'count' must be incremented
+	 * by the number of S2CINTs pushed as arguments between this point and 
+	 * the point where 'bcount' is computed.
+	 */
+	count += LAZY_STACK_INCREMENT;
+#endif
 	save_fp = (S2CINT*)bfp;
 	cp = sc_allocateheap( NULLCONTINUATIONSIZE+count+2+sc_maxdisplay,
 			      CONTINUATIONTAG,
@@@@ -199,6 +215,13 @@@@
 	STACKPTR( tos );	
 	fp = save_fp;
 	bcount = (STACK_BYTES (fp, tos));
+	if (bcount > count*sizeof(S2CINT))
+	    /* If you get this error, look above at LAZY_STACK_POP */
+	    sc_error( "CALL-WITH-CURRENT-CONTINUATION",
+		     "internal error: want to write ~s bytes of stack, "
+		     "but only ~s bytes allocated.",
+		      LIST2( C_FIXED( bcount ),
+			     C_FIXED( count*sizeof(S2CINT) ) ) );
 	cp->continuation.continuation = sc_clink;
 	cp->continuation.stackbytes = bcount;
 	cp->continuation.stacktrace = sc_stacktrace;
@
