예제 #1
0
파일: quicksort.c 프로젝트: ranxian/unisim
int main()
{
    int array[MAXN];
    int i;
    for (i = 0; i < MAXN; i++) {
        seed = seed * MUL + ADD;
        array[i] = seed;
    }
    #ifndef HIVEBOARD
	sys_state(0);
    #endif
    quicksort(array, 0, MAXN-1);
    #ifndef HIVEBOARD
	sys_state(0);
    print(array);
    #endif
    return 0;
}
예제 #2
0
static void handle_event(nge_event * e)
{
	switch (e->state_type) {
	case SERVICE_STATE_CHANGE:
		service_change(e->payload.service_state_change.service,
			       e->payload.service_state_change.is,
			       e->payload.service_state_change.state_name,
			       e->payload.service_state_change.percent_started,
			       e->payload.service_state_change.percent_stopped,
			       e->payload.service_state_change.service_type,
			       e->payload.service_state_change.hidden);
		return;
	case SYSTEM_STATE_CHANGE:
		sys_state(e->payload.system_state_change.system_state,
			  e->payload.system_state_change.runlevel);
		return;
	case ERR_MSG:
		err_msg(e->payload.err_msg.mt,
			e->payload.err_msg.file,
			e->payload.err_msg.func,
			e->payload.err_msg.line, e->payload.err_msg.message);
		return;
	case CONNECT:
		connected(e->payload.connect.pver,
			  e->payload.connect.initng_version);
		return;
	case DISCONNECT:
		disconnected();
		return;
	case SERVICE_OUTPUT:
		service_output(e->payload.service_output.service,
			       e->payload.service_output.process,
			       e->payload.service_output.output);
		return;
	default:
		return;
	}
}
예제 #3
0
static void handle_event(nge_event * e)
{
	switch (e->state_type) {
	case PING:
		ping();
		return;

	case SERVICE_STATE_CHANGE:
	case INITIAL_SERVICE_STATE_CHANGE:
		service_change(e->payload.service_state_change.service,
			       e->payload.service_state_change.is,
			       e->payload.service_state_change.state_name,
			       e->payload.service_state_change.percent_started,
			       e->payload.service_state_change.percent_stopped,
			       e->payload.service_state_change.service_type,
			       e->payload.service_state_change.hidden);
		return;

	case SYSTEM_STATE_CHANGE:
	case INITIAL_SYSTEM_STATE_CHANGE:
		sys_state(e->payload.system_state_change.system_state,
			  e->payload.system_state_change.runlevel);
		return;

	case ERR_MSG:
		err_msg(e->payload.err_msg.mt,
			e->payload.err_msg.file,
			e->payload.err_msg.func,
			e->payload.err_msg.line, e->payload.err_msg.message);
		return;

	case CONNECT:
		connected(e->payload.connect.pver,
			  e->payload.connect.initng_version);
		return;

	case DISCONNECT:
		disconnected();
		return;

	case INITIAL_STATE_FINISHED:
		initial_state_finished();
		return;

	case SERVICE_OUTPUT:
		service_output(e->payload.service_output.service,
			       e->payload.service_output.process,
			       e->payload.service_output.output);
		return;

	case PROCESS_KILLED:
		process_killed(e->payload.process_killed.service,
			       e->payload.process_killed.is,
			       e->payload.process_killed.state_name,
			       e->payload.process_killed.process,
			       e->payload.process_killed.exit_status,
			       e->payload.process_killed.term_sig);
		return;

	default:
		return;
	}
}