Example #1
0
static void COROUT_Suspend( DaoProcess *proc, DaoValue *p[], int N )
{
	DaoxCoroutine *self = (DaoxCoroutine*) p[0];
	DaoValue *value = N > 1 ? p[1] : DaoValue_MakeNone();
	if( self->process != proc ){
		DaoProcess_RaiseError( proc, NULL, "coroutine cannot suspend in alien process." );
		return;
	}
	GC_Assign( & proc->stackValues[0], value );
	proc->status = DAO_PROCESS_SUSPENDED;
	proc->pauseType = DAO_PAUSE_COROUTINE_YIELD;
}
Example #2
0
static void GD_GetGraph( DaoProcess *proc, DaoValue *p[], int N )
{
	DaoxGraphData *self = (DaoxGraphData*) p[0];
	DaoProcess_PutValue( proc, self->graph ? (DaoValue*) self->graph : DaoValue_MakeNone() );
}