franz/tahoe/tahoe.c
/*
 * (int:showstack 'stack_pointer)
 * return
 *   nil if at the end of the stack or illegal
 *   ( expresssion . next_stack_pointer) otherwise
 *   where expression is something passed to eval
 * very tahoe specific
 */
showstack 'stack_pointer)
return
nil if at the end of the stack or illegal
( expresssion . next_stack_pointer) otherwise
where expression is something passed to eval
very tahoe specific
showstack ' stack_pointer ) return nil if at the end of the stack or illegal ( expresssion . next_stack_pointer ) otherwise where expression is something passed to eval very tahoe specific
lispval
LIshowstack()
{
    int **fp;	
    register lispval handy;
    register struct machframe *myfp;
    lispval retval, Lfuncal(), Ifuncal();
    lispval (*pc)() = 0;
    Savestack(2);
    chkarg(1,"int:showstack");
    if((TYPE(handy=lbot[0].val) != INT) && (handy != nil))
        error("int:showstack non fixnum arg", FALSE);
    if(handy == nil)
        asm("movab	-8(fp),r11");		
    else
        myfp = (struct machframe *) handy->i;
    while(myfp > 0)
    {
	if( (pc >= eval  &&  		
            pc < popnames)
	    ||
	    (pc >= Ifuncal &&		
	    pc < Lfuncal)  )
        {
	    if(myfp->removed == 8)	
	    {
		handy = (lispval)(myfp->arg[0]);	
		protect(retval=newdot());
		retval->d.car = handy;
		if(myfp > myfp->fp)
		    myfp = 0;	
		else
	            myfp = (struct machframe *) ((char *)myfp->fp - 8);
		retval->d.cdr = inewint(myfp);
		return(retval);
	    }
	}
	if(myfp > myfp->fp)
	     myfp = 0;	
	else
	  {pc = myfp->pc;
	   myfp = (struct machframe *) ((char *)myfp->fp - 8);
	  }
    }
    return(nil);
}
lispval LIshowstack ( ) { int * * fp ; register lispval handy ; register struct machframe * myfp ; lispval retval , Lfuncal ( ) , Ifuncal ( ) ; lispval ( * pc ) ( ) = 0 ; Savestack ( 2 ) ; chkarg ( 1 , " " ) ; if ( ( TYPE ( handy = lbot [ 0 ] . val ) != INT ) && ( handy != nil ) ) error ( " " , FALSE ) ; if ( handy == nil ) asm ( " " ) ; else myfp = ( struct machframe * ) handy -> i ; while ( myfp > 0 ) { if ( ( pc >= eval && pc < popnames ) || ( pc >= Ifuncal && pc < Lfuncal ) ) { if ( myfp -> removed == 8 ) { handy = ( lispval ) ( myfp -> arg [ 0 ] ) ; protect ( retval = newdot ( ) ) ; retval -> d . car = handy ; if ( myfp > myfp -> fp ) myfp = 0 ; else myfp = ( struct machframe * ) ( ( char * ) myfp -> fp - 8 ) ; retval -> d . cdr = inewint ( myfp ) ; return ( retval ) ; } } if ( myfp > myfp -> fp ) myfp = 0 ; else { pc = myfp -> pc ; myfp = ( struct machframe * ) ( ( char * ) myfp -> fp - 8 ) ; } } return ( nil ) ; }
(int:showstack 'stack_pointer)
 return
   nil if at the end of the stack or illegal
   ( expresssion .
( int : showstack ' stack_pointer ) return nil if at the end of the stack or illegal ( expresssion .
/* must be the first local variable */ /* only way I could think of */ /* if((int ***)myfp <= &fp) error("int:showstack illegal stack value",FALSE); */ /*fprintf(stderr, "myfp=%x pc=%x fp=%x removed=%d\n", myfp, myfp->pc,
			myfp->fp, myfp->removed);
	fflush(stderr);*/ /* interpreted code */ /* compiled code */ /* only if arg given */ /* arg to eval */ /* end of frames */ /* end of frames */