static void RES_LoadColladaFile( DaoProcess *proc, DaoValue *p[], int N ) { DaoxSceneResource *self = (DaoxSceneResource*) p[0]; const char *file = DaoValue_TryGetMBString( p[1] ); DaoxScene *scene = DaoxSceneResource_LoadColladaFile( self, file ); DaoProcess_PutValue( proc, (DaoValue*) scene ); }
static void STD_Compile( DaoProcess *proc, DaoValue *p[], int N ) { char *source = DaoValue_TryGetMBString( p[0] ); DaoNamespace *ns = proc->activeNamespace; if( DaoProcess_Compile( proc, ns, source ) ==0 ){ DaoProcess_PutValue( proc, dao_none_value ); return; } DaoProcess_PutValue( proc, ns->mainRoutines->items.pValue[ ns->mainRoutines->size-1 ] ); }
static void STD_Compile( DaoProcess *proc, DaoValue *p[], int N ) { char *source = DaoValue_TryGetMBString( p[0] ); DaoNamespace *ns = DaoValue_CastNamespace( p[1] ); DaoTuple *tuple = DaoProcess_PutTuple( proc, 0 ); if( ns == NULL ) ns = proc->activeNamespace; DaoTuple_SetItem( tuple, (DaoValue*) ns, 0 ); if( DaoProcess_Compile( proc, ns, source ) ==0 ){ DaoTuple_SetItem( tuple, dao_none_value, 1 ); return; } DaoTuple_SetItem( tuple, ns->mainRoutines->items.pValue[ ns->mainRoutines->size-1 ], 1 ); }
static void STD_Eval( DaoProcess *proc, DaoValue *p[], int N ) { DaoVmSpace *vms = proc->vmSpace; DaoNamespace *ns = proc->activeNamespace; DaoStream *prevStream = proc->stdioStream; DaoStream *redirect = (DaoStream*) p[1]; char *source = DaoValue_TryGetMBString( p[0] ); int safe = p[2]->xInteger.value; int wasProt = 0; if( vms->options & DAO_OPTION_SAFE ) wasProt = 1; if( redirect != prevStream ){ GC_ShiftRC( redirect, proc->stdioStream ); proc->stdioStream = redirect; } if( safe ) vms->options |= DAO_OPTION_SAFE; DaoProcess_Eval( proc, ns, source ); DaoProcess_PutValue( proc, proc->stackValues[0] ); if( ! wasProt ) vms->options &= ~DAO_OPTION_SAFE; if( redirect != prevStream ){ GC_ShiftRC( prevStream, proc->stdioStream ); proc->stdioStream = prevStream; } }