@ -257,6 +257,19 @@ gloadarrayout:
return 1 ;
return 1 ;
}
}
int vm_intfn___stackdump ( void ) {
int n = vm_current - > sp - vm_current - > stackbase ;
int i ;
printf ( " \n =====Stack dump====== \n " ) ;
for ( i = 0 ; i < n ; i + + ) {
int e = stack_get ( vm_current , i ) ;
printf ( " %x \t %d \n " , e , e ) ;
}
return 1 ;
}
int vm_intfn_printint ( void )
int vm_intfn_printint ( void )
{
{
printf ( " %d " , stack_get ( vm_current , 1 ) ) ;
printf ( " %d " , stack_get ( vm_current , 1 ) ) ;
@ -768,12 +781,13 @@ int vm_intfn_map3d_transform(void)
int vm_intfn_map3d_setparams ( void )
int vm_intfn_map3d_setparams ( void )
{
{
map3d_setparams ( stack_get ( vm_current , 6 ) , /* light */
map3d_setparams ( stack_get ( vm_current , 7 ) , /* light */
( double ) stack_get ( vm_current , 5 ) , /* opan */
( double ) stack_get ( vm_current , 6 ) , /* opan */
( double ) stack_get ( vm_current , 4 ) , /* otilt */
( double ) stack_get ( vm_current , 5 ) , /* otilt */
( double ) stack_getreal ( vm_current , 3 ) , /* lpan */
( double ) stack_getreal ( vm_current , 4 ) , /* lpan */
( double ) stack_getreal ( vm_current , 2 ) , /* ltilt */
( double ) stack_getreal ( vm_current , 3 ) , /* ltilt */
( double ) stack_getreal ( vm_current , 1 ) ) ; /* dist */
( double ) stack_getreal ( vm_current , 2 ) , /* dist */
( double ) stack_get ( vm_current , 1 ) ) ; /* invert */
return 1 ;
return 1 ;
}
}
@ -897,10 +911,10 @@ void vm_init_functions(void)
errx ( 1 , " Bad version - recompile " ) ;
errx ( 1 , " Bad version - recompile " ) ;
if ( ( GETINT ( vm_codearea , 8 ) ! = vm_abiversion1 ) | |
if ( ( GETINT ( vm_codearea , 8 ) ! = vm_abiversion1 ) | |
( GETINT ( vm_codearea , 12 ) = = vm_abiversion2 ) | |
( GETINT ( vm_codearea , 12 ) ! = vm_abiversion2 ) | |
( GETINT ( vm_codearea , 16 ) = = vm_abiversion3 ) | |
( GETINT ( vm_codearea , 16 ) ! = vm_abiversion3 ) | |
( GETINT ( vm_codearea , 20 ) = = vm_abiversion4 ) | |
( GETINT ( vm_codearea , 20 ) ! = vm_abiversion4 ) | |
( GETINT ( vm_codearea , 24 ) = = vm_abiversion5 ) )
( GETINT ( vm_codearea , 24 ) ! = vm_abiversion5 ) )
errx ( 1 , " Incompatible ABI version - recompile " ) ;
errx ( 1 , " Incompatible ABI version - recompile " ) ;
/* Now, get the function table pointer */
/* Now, get the function table pointer */
@ -992,8 +1006,6 @@ int vm_spawn_args(char *fn, int n, ...)
}
}
newt - > sp = newt - > stackbase ;
newt - > sp = newt - > stackbase ;
stack_push ( newt , 0 ) ; /* Return value */
/* Push optional arguments */
/* Push optional arguments */
va_start ( ap , n ) ;
va_start ( ap , n ) ;
while ( n - - ) {
while ( n - - ) {
@ -1003,6 +1015,8 @@ int vm_spawn_args(char *fn, int n, ...)
}
}
va_end ( ap ) ;
va_end ( ap ) ;
stack_push ( newt , 0 ) ; /* Return value */
/* Push return address here, to point to some special thread exit
/* Push return address here, to point to some special thread exit
routine */
routine */
stack_push ( newt , 0 ) ; /* Return address */
stack_push ( newt , 0 ) ; /* Return address */