本文整理汇总了C++中check_state函数的典型用法代码示例。如果您正苦于以下问题:C++ check_state函数的具体用法?C++ check_state怎么用?C++ check_state使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_state函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: task1
void
task1(intptr_t exinf)
{
ER ercd;
T_RTEX rtex;
/*
* 初期状態のチェック
*/
check_point(1);
check_state(false, false, TIPM_ENAALL, false, false, true);
ercd = ref_tex(TSK_SELF, &rtex);
check_ercd(ercd, E_OK);
check_assert((rtex.texstat & TTEX_DIS) != 0);
check_assert(rtex.pndptn == 0);
/*
* ras_texのエラー検出
*/
ercd = ras_tex(TASK3, 0x0001);
check_ercd(ercd, E_OBJ);
ercd = ras_tex(TASK4, 0x0001);
check_ercd(ercd, E_OBJ);
/*
* ref_texのエラー検出
*/
ercd = ref_tex(TASK3, &rtex);
check_ercd(ercd, E_OBJ);
ercd = ref_tex(TASK4, &rtex);
check_ercd(ercd, E_OBJ);
/*
* タスク例外処理の許可
*/
check_point(2);
ercd = ena_tex();
check_ercd(ercd, E_OK);
check_state(false, false, TIPM_ENAALL, false, false, false);
ercd = ref_tex(TSK_SELF, &rtex);
check_ercd(ercd, E_OK);
check_assert((rtex.texstat & TTEX_ENA) != 0);
check_assert(rtex.pndptn == 0);
/*
* タスク例外処理を要求
*/
check_point(3);
ercd = ras_tex(TSK_SELF, 0x0001);
/* ここでタスク例外処理ルーチンが動作する */
check_ercd(ercd, E_OK);
/*
* タスク例外処理からのリターンにより元の状態に戻っていることを
* チェック
*/
check_point(6);
check_state(false, false, TIPM_ENAALL, false, false, false);
/*
* ディスパッチ禁止,割込み優先度マスク変更,タスク例外処理禁止
*/
check_point(7);
ercd = dis_dsp();
check_ercd(ercd, E_OK);
ercd = chg_ipm(TMIN_INTPRI);
check_ercd(ercd, E_OK);
ercd = dis_tex();
check_ercd(ercd, E_OK);
check_state(false, false, TMIN_INTPRI, true, true, true);
/*
* タスク例外処理を要求
*/
check_point(8);
ercd = ras_tex(TASK1, 0x0002);
check_ercd(ercd, E_OK);
ercd = ref_tex(TSK_SELF, &rtex);
check_ercd(ercd, E_OK);
check_assert((rtex.texstat & TTEX_DIS) != 0);
check_assert(rtex.pndptn == 0x0002);
/*
* タスク例外処理を許可
*/
check_point(9);
ercd = ena_tex();
/* ここでタスク例外処理ルーチンが動作する */
check_ercd(ercd, E_OK);
/*
* タスク例外処理からのリターンにより元の状態に戻っていることを
* チェック
*/
check_point(19);
check_state(false, false, TMIN_INTPRI, true, true, false);
/*
* タスク2に切り換える
*/
//.........这里部分代码省略.........
开发者ID:RazeLiberty,项目名称:FINE-PLAY-BOX,代码行数:101,代码来源:test_tex1.c
示例2: st_validate_state
void st_validate_state( struct st_context *st )
{
struct st_state_flags *state = &st->dirty;
GLuint i;
/* The bitmap cache is immune to pixel unpack changes.
* Note that GLUT makes several calls to glPixelStore for each
* bitmap char it draws so this is an important check.
*/
if (state->mesa & ~_NEW_PACKUNPACK)
st_flush_bitmap_cache(st);
check_program_state( st );
st_manager_validate_framebuffers(st);
if (state->st == 0)
return;
/*printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st);*/
if (1) {
/* Debug version which enforces various sanity checks on the
* state flags which are generated and checked to help ensure
* state atoms are ordered correctly in the list.
*/
struct st_state_flags examined, prev;
memset(&examined, 0, sizeof(examined));
prev = *state;
for (i = 0; i < Elements(atoms); i++) {
const struct st_tracked_state *atom = atoms[i];
struct st_state_flags generated;
/*printf("atom %s %x/%x\n", atom->name, atom->dirty.mesa, atom->dirty.st);*/
if (!(atom->dirty.mesa || atom->dirty.st) ||
!atom->update) {
printf("malformed atom %s\n", atom->name);
assert(0);
}
if (check_state(state, &atom->dirty)) {
atoms[i]->update( st );
/*printf("after: %x\n", atom->dirty.mesa);*/
}
accumulate_state(&examined, &atom->dirty);
/* generated = (prev ^ state)
* if (examined & generated)
* fail;
*/
xor_states(&generated, &prev, state);
assert(!check_state(&examined, &generated));
prev = *state;
}
/*printf("\n");*/
}
else {
for (i = 0; i < Elements(atoms); i++) {
if (check_state(state, &atoms[i]->dirty))
atoms[i]->update( st );
}
}
memset(state, 0, sizeof(*state));
}
开发者ID:GunioRobot,项目名称:mesa-7.10.2-PS3,代码行数:69,代码来源:st_atom.c
示例3: u32
void CStateManagerBloodsucker::execute ()
{
u32 state_id = u32(-1);
const CEntityAlive* enemy = object->EnemyMan.get_enemy();
if ( !object->is_drag_anim_jump() && !object->is_animated() )
{
if ( enemy )
{
if ( check_state(eStateCustom_Vampire) )
{
state_id = eStateCustom_Vampire;
}
else
{
switch ( object->EnemyMan.get_danger_type() )
{
case eStrong: state_id = eStatePanic; break;
case eWeak: state_id = eStateAttack; break;
}
}
}
else if ( object->HitMemory.is_hit() )
{
state_id = eStateHitted;
}
else if ( object->hear_interesting_sound )
{
state_id = eStateHearInterestingSound;
}
else
{
if ( can_eat() ) state_id = eStateEat;
else state_id = eStateRest;
}
///////////////////////////////////////////////////////////////////////////////
// Additional
///////////////////////////////////////////////////////////////////////////////
// check if start interesting sound state
// if ( (prev_substate != eStateHearInterestingSound) && (state_id == eStateHearInterestingSound) )
// {
// object->start_invisible_predator();
// }
// else
// // check if stop interesting sound state
// if ( (prev_substate == eStateHearInterestingSound) && (state_id != eStateHearInterestingSound) )
// {
// object->stop_invisible_predator();
// }
select_state(state_id);
// выполнить текущее состояние
get_state_current()->execute();
prev_substate = current_substate;
}
else
{
state_id = eStateCustom;
if ( object->is_drag_anim_jump() )
{
select_state(state_id);
// выполнить текущее состояние
get_state_current()->execute();
prev_substate = current_substate;
drag_object();
}
}
}
开发者ID:2asoft,项目名称:xray,代码行数:77,代码来源:bloodsucker_state_manager.cpp
示例4: on_ok_fileselection_clicked
void
on_ok_fileselection_clicked(GtkWidget *file, GtkFileSelection *fs)
{
int fd, i, size;
char *cmd, buf[MAX_BUF];
#ifdef DEBUG
GtkWidget *error_dialog = NULL;
#endif
size = strlen(exec_path) + strlen(" -c ") + strlen(gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs))) + 1;
cmd = (char *) malloc (size*sizeof(char));
strcpy (cmd, exec_path);
strcat (cmd, " -c ");
strcat (cmd, gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
for(i = 0; i < MAX_PID; i++) {
if(table[i].process == NULL) {
cur_pid = i;
break;
}
}
runPeos(cmd);
free(cmd);
cmd = NULL;
fd = open ("message", O_RDONLY);
if(fd < 0) {
perror("An error has occurred when attempting to open 'message' \n");
exit(1);
}
read (fd, buf, MAX_BUF);
close (fd);
#ifdef DEBUG
if (strncmp ("Executing", buf, 9) != 0) {
error_dialog = create_errordialog();
gtk_widget_show (error_dialog);
} else {
#endif
gtk_widget_destroy (notebook);
freeAll_extra();
notebook = create_notebook();
gtk_widget_set_name (notebook, "notebook");
gtk_widget_ref (notebook);
gtk_object_set_data_full (GTK_OBJECT (Peos), "notebook", notebook,
(GtkDestroyNotify) gtk_widget_unref);
set_selection(1); /* with current action selected */
gtk_widget_show (notebook);
gtk_container_add (GTK_CONTAINER (vbox), notebook);
redisplay_menu();
check_state();
}
void check_state(void)
{
char *state;
if ( table[cur_pid].page.curr != NULL && strcmp (table[cur_pid].page.curr->name , "action") == 0) {
state = xmlGetProp(table[cur_pid].page.curr, "state");
if ( strcmp(state, "NONE") == 0) {
set_sensitive_dep(TRUE, TRUE, FALSE, FALSE, NULL);
} else if ( strcmp(state, "BLOCKED") == 0) {
set_sensitive_dep(TRUE, TRUE, FALSE, FALSE, NULL);
} else if ( strcmp(state, "RUN") == 0) {
set_sensitive_dep(FALSE, TRUE, TRUE, TRUE, NULL);
} else if ( strcmp(state, "SUSPEND") == 0) {
set_sensitive_dep(TRUE, TRUE, FALSE, TRUE, NULL);
} else if ( strcmp(state, "DONE") == 0) {
set_sensitive_dep(TRUE, FALSE, FALSE, FALSE, NULL);
} else if ( strcmp(state, "READY") == 0) {
set_sensitive_dep(TRUE, TRUE, FALSE, FALSE, NULL);
} else if ( strcmp(state, "AVAILABLE") == 0) {
set_sensitive_dep(TRUE, TRUE, FALSE, FALSE, NULL);
} else if ( strcmp(state, "PENDING") == 0) {
set_sensitive_dep(TRUE, TRUE, FALSE, FALSE, NULL);
}
if (GTK_IS_WIDGET (table[cur_pid].page.Start)) gtk_widget_destroy (table[cur_pid].page.Start);
table[cur_pid].page.Start = start_label(state);
} else {
set_sensitive_dep(FALSE, FALSE, FALSE, FALSE, FALSE);
if (GTK_IS_WIDGET (table[cur_pid].page.Start)) gtk_widget_destroy (table[cur_pid].page.Start);
table[cur_pid].page.Start = start_label("Start");
}
gtk_widget_ref (table[cur_pid].page.Start);
gtk_object_set_data_full (GTK_OBJECT (Peos), "Start", table[cur_pid].page.Start,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (table[cur_pid].page.Start);
//.........这里部分代码省略.........
开发者ID:jimiszm,项目名称:peos,代码行数:101,代码来源:callbacks.c
示例5: py_attack_real
/**
* Attack the monster at the given location with a single blow.
*/
static bool py_attack_real(int y, int x, bool *fear) {
/* Information about the target of the attack */
monster_type *m_ptr = cave_monster_at(cave, y, x);
monster_race *r_ptr = &r_info[m_ptr->r_idx];
char m_name[80];
bool stop = FALSE;
/* The weapon used */
object_type *o_ptr = &p_ptr->inventory[INVEN_WIELD];
/* Information about the attack */
int bonus = p_ptr->state.to_h + o_ptr->to_h;
int chance = p_ptr->state.skills[SKILL_TO_HIT_MELEE] + bonus * BTH_PLUS_ADJ;
bool do_quake = FALSE;
bool success = FALSE;
/* Default to punching for one damage */
const char *hit_verb = "punch";
int dmg = 1;
u32b msg_type = MSG_HIT;
/* Extract monster name (or "it") */
monster_desc(m_name, sizeof(m_name), m_ptr, 0);
/* Auto-Recall if possible and visible */
if (m_ptr->ml) monster_race_track(m_ptr->r_idx);
/* Track a new monster */
if (m_ptr->ml) health_track(p_ptr, m_ptr);
/* Handle player fear (only for invisible monsters) */
if (check_state(p_ptr, OF_AFRAID, p_ptr->state.flags)) {
msgt(MSG_AFRAID, "You are too afraid to attack %s!", m_name);
return FALSE;
}
/* Disturb the monster */
mon_clear_timed(m_ptr, MON_TMD_SLEEP, MON_TMD_FLG_NOMESSAGE, FALSE);
/* See if the player hit */
success = test_hit(chance, r_ptr->ac, m_ptr->ml);
/* If a miss, skip this hit */
if (!success) {
msgt(MSG_MISS, "You miss %s.", m_name);
return FALSE;
}
/* Handle normal weapon */
if (o_ptr->kind) {
int i;
const struct slay *best_s_ptr = NULL;
hit_verb = "hit";
/* Get the best attack from all slays or
* brands on all non-launcher equipment */
for (i = INVEN_LEFT; i < INVEN_TOTAL; i++) {
struct object *obj = &p_ptr->inventory[i];
if (obj->kind)
improve_attack_modifier(obj, m_ptr, &best_s_ptr, TRUE, FALSE);
}
improve_attack_modifier(o_ptr, m_ptr, &best_s_ptr, TRUE, FALSE);
if (best_s_ptr != NULL)
hit_verb = best_s_ptr->melee_verb;
dmg = damroll(o_ptr->dd, o_ptr->ds);
dmg *= (best_s_ptr == NULL) ? 1 : best_s_ptr->mult;
dmg += o_ptr->to_d;
dmg = critical_norm(o_ptr->weight, o_ptr->to_h, dmg, &msg_type);
/* Learn by use for the weapon */
object_notice_attack_plusses(o_ptr);
if (check_state(p_ptr, OF_IMPACT, p_ptr->state.flags) && dmg > 50) {
do_quake = TRUE;
wieldeds_notice_flag(p_ptr, OF_IMPACT);
}
}
/* Learn by use for other equipped items */
wieldeds_notice_on_attack();
/* Apply the player damage bonuses */
dmg += p_ptr->state.to_d;
/* No negative damage */
if (dmg <= 0) dmg = 0;
/* Tell the player what happened */
if (dmg <= 0)
msgt(MSG_MISS, "You fail to harm %s.", m_name);
else if (msg_type == MSG_HIT)
msgt(MSG_HIT, "You %s %s.", hit_verb, m_name);
else if (msg_type == MSG_HIT_GOOD)
//.........这里部分代码省略.........
开发者ID:Abigail,项目名称:angband,代码行数:101,代码来源:attack.c
示例6: effect_do
//.........这里部分代码省略.........
if (hp_player(500)) *ident = TRUE;
if (player_clear_timed(p_ptr, TMD_CUT, TRUE)) *ident = TRUE;
return TRUE;
}
case EF_HEAL2:
{
if (hp_player(1000)) *ident = TRUE;
if (player_clear_timed(p_ptr, TMD_CUT, TRUE)) *ident = TRUE;
return TRUE;
}
case EF_HEAL3:
{
if (hp_player(500)) *ident = TRUE;
if (player_clear_timed(p_ptr, TMD_STUN, TRUE)) *ident = TRUE;
if (player_clear_timed(p_ptr, TMD_CUT, TRUE)) *ident = TRUE;
return TRUE;
}
case EF_GAIN_EXP:
{
if (p_ptr->exp < PY_MAX_EXP)
{
msg("You feel more experienced.");
player_exp_gain(p_ptr, 100000L);
*ident = TRUE;
}
return TRUE;
}
case EF_LOSE_EXP:
{
if (!check_state(p_ptr, OF_HOLD_LIFE, p_ptr->state.flags) && (p_ptr->exp > 0))
{
msg("You feel your memories fade.");
player_exp_lose(p_ptr, p_ptr->exp / 4, FALSE);
*ident = TRUE;
}
*ident = TRUE;
wieldeds_notice_flag(p_ptr, OF_HOLD_LIFE);
return TRUE;
}
case EF_RESTORE_EXP:
{
if (restore_level()) *ident = TRUE;
return TRUE;
}
case EF_RESTORE_MANA:
{
if (p_ptr->csp < p_ptr->msp)
{
p_ptr->csp = p_ptr->msp;
p_ptr->csp_frac = 0;
msg("Your feel your head clear.");
p_ptr->redraw |= (PR_MANA);
*ident = TRUE;
}
return TRUE;
}
case EF_GAIN_STR:
case EF_GAIN_INT:
case EF_GAIN_WIS:
开发者ID:nomadicwriter,项目名称:v4,代码行数:67,代码来源:effects.c
示例7: on_OK_clicked
//.........这里部分代码省略.........
size = strlen(exec_path) + strlen(" -r ") + strlen(buf) + strlen(" ")
+ strlen(res_name) + strlen(" ") + strlen(enter) + strlen(" ") + 1;
cmd = (char *) malloc (size);
size = 0;
/* ./peos -r pid resource_name resource_res_value */
strcpy (cmd, exec_path);
strcat (cmd, " -r ");
strcat (cmd, buf);
strcat (cmd, " ");
strcat (cmd, res_name);
strcat (cmd, " ");
strcat (cmd, enter);
strcat (cmd, " ");
tmp = get_current_dir_name();
if(tmp == NULL) {
perror("No current directory found. Aborting. \n");
RTN_ON_OK_CLICKED = EXIT_FAILURE;
exit(1);
} else {
//size = strlen(tmp) + strlen("/") + strlen(enter_tmp) + 1;
size = strlen(tmp) + strlen("/") + 1;
buf2 = (char *) malloc(size*sizeof(char));
size = 0;
strcpy(buf2, tmp);
strcat(buf2,"/");
}
if(enter == NULL) {
perror("Memory alloc error: enter = NULL \n");
RTN_ON_OK_CLICKED = EXIT_FAILURE;
exit(1);
} else enter[strlen(enter)] = '\0';
/* to eliminate the quotes and -2 in alloc to take into acount: '"', '"' */
size = strlen(enter) + 1;
enter_tmp = (char *) malloc(size*sizeof(char));
strcpy(enter_tmp, enter);
int j = 0;
for(i = 1; i < size-3; i++) {
/* integer value for the single quote character */
if(enter[i] != 39) {
enter_tmp[j] = enter[i];
j++;
}
}
enter_tmp[strlen(enter_tmp)-1] = '\0';
/* need more memory */
char *buf2_temp = NULL;
size = 0;
size = strlen(buf2) + strlen(enter_tmp) + 1;
buf2_temp = (char *) malloc(size*sizeof(char));
strcpy(buf2_temp, buf2);
free(buf2);
buf2 = NULL;
strcat(buf2_temp, enter_tmp);
free(enter_tmp);
enter_tmp = NULL;
free(buf2_temp);
buf2_temp = NULL;
runPeos (cmd);
free (cmd);
cmd = NULL;
freeAll_extra();
draw_tree (cur_pid);
/* search through actions and find the current page */
for ( i = 0; i < counting_action; i++) {
if (strcmp (linklist[cur_pid][i].cur->name, "action") == 0) {
if (strcmp (xmlGetProp (linklist[cur_pid][i].cur, "name"), name) == 0) {
table[cur_pid].page.curr = linklist[cur_pid][i].cur;
break;
}
}
}
draw_text(table[cur_pid].page.curr);
/* highlight the current item in the jtree */
if((GTK_IS_WIDGET (table[cur_pid].page.tree1) && GTK_IS_TREE (GTK_TREE (table[cur_pid].page.tree1))))
gtk_tree_select_child ( GTK_TREE (table[cur_pid].page.tree1),
linklist[cur_pid][table[cur_pid].page.index].item);
}
free (enter);
enter = NULL;
/* check to maintain the next and previous states */
check_state();
}
/* return global EXIT_SUCCESS */
RTN_ON_OK_CLICKED = EXIT_SUCCESS;
return EXIT_SUCCESS;
}
开发者ID:jimiszm,项目名称:peos,代码行数:101,代码来源:callbacks.c
示例8: main
//.........这里部分代码省略.........
}
dev->driver->init(dev);
if (!(init_res = init_channel())) {
return 1;
}
if (check_channel() == 0) {
printf("Channel is not as expected. ");
if (init_res == 2) {
printf("But initialization is not supported. Continuing.\n");
}
else {
printf("Aborting\n");
return 1;
}
}
if (!(init_res = init_address())) {
return 1;
}
if (check_address() == 0) {
printf("Address is not as expected. ");
if (init_res == 2) {
printf("But initialization is not supported. Continuing.\n");
}
else {
printf("Aborting\n");
return 1;
}
}
if (!(init_res = init_long_address())) {
return 1;
}
if (check_long_address() == 0) {
printf("Long address is not as expected. ");
if (init_res == 2) {
printf("But initialization is not supported. Continuing.\n");
}
else {
printf("Aborting\n");
return 1;
}
}
if (!(init_res = init_nid())) {
return 1;
}
if (check_nid() == 0) {
printf("Network ID is not as expected. ");
if (init_res == 2) {
printf("But initialization is not supported. Continuing.\n");
}
else {
printf("Aborting\n");
return 1;
}
}
if (check_max_packet_size() == 0) {
return 1;
}
if (check_protocol() == 0) {
return 1;
}
if (!init_state()) {
return 1;
}
if (!check_state()) {
return 1;
}
#ifdef SENDER
if (!send_packet()) {
return 1;
}
#elif RECEIVER
if (!init_receiver_callback()) {
return 1;
}
#endif
return 0;
}
开发者ID:4dahalibut,项目名称:RIOT,代码行数:101,代码来源:main.c
示例9: brw_upload_pipeline_state
//.........这里部分代码省略.........
if (brw->tess_eval_program != ctx->TessEvalProgram._Current) {
brw->tess_eval_program = ctx->TessEvalProgram._Current;
brw->ctx.NewDriverState |= BRW_NEW_TESS_PROGRAMS;
}
if (brw->tess_ctrl_program != ctx->TessCtrlProgram._Current) {
brw->tess_ctrl_program = ctx->TessCtrlProgram._Current;
brw->ctx.NewDriverState |= BRW_NEW_TESS_PROGRAMS;
}
if (brw->geometry_program != ctx->GeometryProgram._Current) {
brw->geometry_program = ctx->GeometryProgram._Current;
brw->ctx.NewDriverState |= BRW_NEW_GEOMETRY_PROGRAM;
}
if (brw->vertex_program != ctx->VertexProgram._Current) {
brw->vertex_program = ctx->VertexProgram._Current;
brw->ctx.NewDriverState |= BRW_NEW_VERTEX_PROGRAM;
}
}
if (brw->compute_program != ctx->ComputeProgram._Current) {
brw->compute_program = ctx->ComputeProgram._Current;
brw->ctx.NewDriverState |= BRW_NEW_COMPUTE_PROGRAM;
}
if (brw->meta_in_progress != _mesa_meta_in_progress(ctx)) {
brw->meta_in_progress = _mesa_meta_in_progress(ctx);
brw->ctx.NewDriverState |= BRW_NEW_META_IN_PROGRESS;
}
if (brw->num_samples != fb_samples) {
brw->num_samples = fb_samples;
brw->ctx.NewDriverState |= BRW_NEW_NUM_SAMPLES;
}
/* Exit early if no state is flagged as dirty */
merge_ctx_state(brw, &state);
if ((state.mesa | state.brw) == 0)
return;
/* Emit Sandybridge workaround flushes on every primitive, for safety. */
if (brw->gen == 6)
brw_emit_post_sync_nonzero_flush(brw);
brw_upload_programs(brw, pipeline);
merge_ctx_state(brw, &state);
brw_upload_state_base_address(brw);
const struct brw_tracked_state *atoms =
brw_get_pipeline_atoms(brw, pipeline);
const int num_atoms = brw->num_atoms[pipeline];
if (unlikely(INTEL_DEBUG)) {
/* Debug version which enforces various sanity checks on the
* state flags which are generated and checked to help ensure
* state atoms are ordered correctly in the list.
*/
struct brw_state_flags examined, prev;
memset(&examined, 0, sizeof(examined));
prev = state;
for (i = 0; i < num_atoms; i++) {
const struct brw_tracked_state *atom = &atoms[i];
struct brw_state_flags generated;
check_and_emit_atom(brw, &state, atom);
accumulate_state(&examined, &atom->dirty);
/* generated = (prev ^ state)
* if (examined & generated)
* fail;
*/
xor_states(&generated, &prev, &state);
assert(!check_state(&examined, &generated));
prev = state;
}
}
else {
for (i = 0; i < num_atoms; i++) {
const struct brw_tracked_state *atom = &atoms[i];
check_and_emit_atom(brw, &state, atom);
}
}
if (unlikely(INTEL_DEBUG & DEBUG_STATE)) {
STATIC_ASSERT(ARRAY_SIZE(brw_bits) == BRW_NUM_STATE_BITS + 1);
brw_update_dirty_count(mesa_bits, state.mesa);
brw_update_dirty_count(brw_bits, state.brw);
if (dirty_count++ % 1000 == 0) {
brw_print_dirty_count(mesa_bits);
brw_print_dirty_count(brw_bits);
fprintf(stderr, "\n");
}
}
}
开发者ID:Echelon9,项目名称:mesa,代码行数:101,代码来源:brw_state_upload.c
示例10: task1
void
task1(intptr_t exinf)
{
ER_UINT ercd;
T_RTEX rtex;
test_start(__FILE__);
check_point(1);
check_state(false, false, TIPM_ENAALL, false, false, true);
ercd = ref_tex(TSK_SELF, &rtex);
check_ercd(ercd, E_OK);
check_assert((rtex.texstat & TTEX_DIS) != 0U);
check_assert(rtex.pndptn == 0U);
ercd = ras_tex(TASK3, 0x0001);
check_ercd(ercd, E_OBJ);
ercd = ras_tex(TASK4, 0x0001);
check_ercd(ercd, E_OBJ);
ercd = ref_tex(TASK3, &rtex);
check_ercd(ercd, E_OBJ);
ercd = ref_tex(TASK4, &rtex);
check_ercd(ercd, E_OBJ);
check_point(2);
ercd = ena_tex();
check_ercd(ercd, E_OK);
check_state(false, false, TIPM_ENAALL, false, false, false);
ercd = ref_tex(TSK_SELF, &rtex);
check_ercd(ercd, E_OK);
check_assert((rtex.texstat & TTEX_ENA) != 0U);
check_assert(rtex.pndptn == 0U);
check_point(3);
ercd = ras_tex(TSK_SELF, 0x0001);
check_ercd(ercd, E_OK);
check_point(6);
check_state(false, false, TIPM_ENAALL, true, true, false);
check_point(7);
ercd = dis_tex();
check_ercd(ercd, E_OK);
check_state(false, false, TIPM_ENAALL, true, true, true);
check_point(8);
ercd = ras_tex(TASK1, 0x0002);
check_ercd(ercd, E_OK);
ercd = ref_tex(TSK_SELF, &rtex);
check_ercd(ercd, E_OK);
check_assert((rtex.texstat & TTEX_DIS) != 0);
check_assert(rtex.pndptn == 0x0002);
check_point(9);
ercd = ena_tex();
check_ercd(ercd, E_OK);
check_point(20);
check_state(false, false, TIPM_ENAALL, true, true, false);
check_point(21);
ercd = ena_dsp();
check_ercd(ercd, E_OK);
ercd = rot_rdq(TPRI_SELF);
check_ercd(ercd, E_OK);
check_point(27);
ercd = ras_tex(TASK2, 0x0001);
check_ercd(ercd, E_OK);
ercd = ref_tex(TASK2, &rtex);
check_ercd(ercd, E_OK);
check_point(28);
ercd = rot_rdq(TPRI_SELF);
check_ercd(ercd, E_OK);
check_point(35);
return;
check_point(0);
}
开发者ID:yuyaotsuka,项目名称:etrobo,代码行数:97,代码来源:test_tex7.c
示例11: tex_task1
void
tex_task1(TEXPTN texptn, intptr_t exinf)
{
ER_UINT ercd;
switch (++tex_task1_count) {
case 1:
check_point(4);
check_assert(texptn == 0x0001);
check_state(false, false, TIPM_ENAALL, false, false, true);
check_point(5);
ercd = dis_dsp();
check_ercd(ercd, E_OK);
ercd = chg_ipm(TMAX_INTPRI);
check_ercd(ercd, E_OK);
ercd = ena_tex();
check_ercd(ercd, E_OK);
ercd = loc_cpu();
check_ercd(ercd, E_OK);
check_state(false, true, TMAX_INTPRI, true, true, false);
return;
check_point(0);
case 2:
check_point(10);
check_assert(texptn == 0x0002);
check_state(false, false, TIPM_ENAALL, true, true, true);
check_point(11);
ercd = ras_tex(TASK1, 0x0001);
check_ercd(ercd, E_OK);
ercd = ras_tex(TASK1, 0x0002);
check_ercd(ercd, E_OK);
check_point(12);
ercd = ena_dsp();
check_ercd(ercd, E_OK);
ercd = chg_ipm(TMAX_INTPRI);
check_ercd(ercd, E_OK);
ercd = loc_cpu();
check_ercd(ercd, E_OK);
check_state(false, true, TMAX_INTPRI, false, true, true);
return;
check_point(0);
case 3:
check_point(13);
check_assert(texptn == 0x0003);
check_state(false, false, TIPM_ENAALL, false, false, true);
check_point(14);
ercd = ena_dsp();
check_ercd(ercd, E_OK);
ercd = chg_ipm(TMAX_INTPRI);
check_ercd(ercd, E_OK);
ercd = ena_tex();
check_ercd(ercd, E_OK);
check_state(false, false, TMAX_INTPRI, false, true, false);
ercd = chg_ipm(TIPM_ENAALL);
check_ercd(ercd, E_OK);
ercd = chg_ipm(TMAX_INTPRI);
check_ercd(ercd, E_OK);
check_point(15);
ercd = ras_tex(TSK_SELF, 0x0004);
check_ercd(ercd, E_OK);
ercd = chg_ipm(TMAX_INTPRI);
check_ercd(ercd, E_OK);
ercd = dis_tex();
check_ercd(ercd, E_OK);
ercd = chg_ipm(TIPM_ENAALL);
check_ercd(ercd, E_OK);
ercd = chg_ipm(TMAX_INTPRI);
check_ercd(ercd, E_OK);
//.........这里部分代码省略.........
开发者ID:yuyaotsuka,项目名称:etrobo,代码行数:101,代码来源:test_tex7.c
示例12: hub_handle_command
static void
hub_handle_command(char *buf, uint32_t len)
{
char *hub_my_nick; /* XXX */
hub_my_nick = main_to_hub_string(my_nick);
if (len >= 6 && strncmp(buf, "$Lock ", 6) == 0) {
char *key;
if (!check_state(buf, (DCUserState) DC_HUB_LOCK))
goto hub_handle_command_cleanup;
key = (char*) memmem(buf+6, len-6, " Pk=", 4);
if (key == NULL) {
warn(_("Invalid $Lock message: Missing Pk value\n"));
key = buf+len;
}
key = decode_lock(buf+6, key-buf-6, DC_CLIENT_BASE_KEY);
if (strleftcmp("EXTENDEDPROTOCOL", buf+6) == 0) {
if (!hub_putf("$Supports TTHSearch NoGetINFO NoHello|")) {
free(key);
goto hub_handle_command_cleanup;
}
}
if (!hub_putf("$Key %s|", key)) {
free(key);
goto hub_handle_command_cleanup;
}
free(key);
if (!hub_putf("$ValidateNick %s|", hub_my_nick))
goto hub_handle_command_cleanup;
hub_state = DC_HUB_HELLO;
}
else if (len >= 10 && strncmp(buf, "$Supports ", 10) == 0) {
char *p0, *p1;
hub_extensions = 0;
for (p0 = buf+10; (p1 = strchr(p0, ' ')) != NULL; p0 = p1+1) {
*p1 = '\0';
parse_hub_extension(p0);
}
if (*p0 != '\0')
parse_hub_extension(p0);
}
else if (strcmp(buf, "$GetPass") == 0) {
if (my_password == NULL) {
screen_putf(_("Hub requires password.\n"));
hub_disconnect();
goto hub_handle_command_cleanup;
}
screen_putf(_("Sending password to hub.\n"));
if (!hub_putf("$MyPass %s|", my_password))
goto hub_handle_command_cleanup;
}
else if (strcmp(buf, "$BadPass") == 0) {
warn(_("Password not accepted.\n"));
hub_disconnect();
}
else if (strcmp(buf, "$LogedIn") == 0) {
screen_putf(_("You have received operator status.\n"));
}
else if (len >= 9 && strncmp(buf, "$HubName ", 9) == 0) {
free(hub_name);
hub_name = hub_to_main_string(buf + 9);
screen_putf(_("Hub name is %s.\n"), quotearg(hub_name));
}
else if (strcmp(buf, "$GetNetInfo") == 0) {
hub_putf("$NetInfo %d$1$%c|", my_ul_slots, is_active ? 'A' : 'P');
}
else if (strcmp(buf, "$ValidateDenide") == 0) {
if (!check_state(buf, (DCUserState) DC_HUB_HELLO))
goto hub_handle_command_cleanup;
/* DC++ disconnects immediately if this is received.
* But shouldn't we give the client a chance to change the nick?
* Also what happens if we receive this when correctly logged in?
*/
warn(_("Hub did not accept nick. Nick may be in use.\n"));
hub_disconnect();
}
else if (len >= 7 && strncmp(buf, "$Hello ", 7) == 0) {
DCUserInfo *ui;
char *conv_nick;
conv_nick = hub_to_main_string(buf + 7);
if (hub_state == DC_HUB_HELLO) {
if (strcmp(buf+7, hub_my_nick) == 0) {
screen_putf(_("Nick accepted. You are now logged in.\n"));
} else {
/* This probably won't happen, but better safe... */
free(my_nick);
my_nick = xstrdup(conv_nick);
free(hub_my_nick);
hub_my_nick = xstrdup(buf + 7);
screen_putf(_("Nick accepted but modified to %s. You are now logged in.\n"), quotearg(my_nick));
}
ui = user_info_new(conv_nick);
ui->info_quered = true; /* Hub is sending this automaticly */
//.........这里部分代码省略.........
开发者ID:dilawar,项目名称:microdc2,代码行数:101,代码来源:hub.c
示例13: main
int main(int argc, char** argv)
{
sim_param_t params;
if (get_params(argc, argv, ¶ms) != 0)
exit(-1);
// Create global
sim_state_t* globalState = init_particles(¶ms);
#pragma omp parallel shared(globalState, params)
{
int proc = omp_get_thread_num();
int nproc = omp_get_num_threads();
FILE* fp = fopen(params.fname, "w");
int nframes = params.nframes;
int npframe = params.npframe;
float dt = params.dt;
int n = globalState->n;
// Processor information and holder
proc_info* pInfo = malloc(sizeof(proc_info));
pInfo->proc = proc;
pInfo->nproc = nproc;
pInfo->beg = round((proc/(double)nproc)*n);
pInfo->end = round(((proc+1)/(double)nproc)*n);
pInfo->forceAccu = calloc(3*n, sizeof(float)); // Never used this...
if (proc == 0) {
printf("Running in parallel with %d processor\n", nproc);
}
normalize_mass(globalState, pInfo, ¶ms);
double t_start = omp_get_wtime();
if (proc == 0) { // We only write for one processor
write_header(fp, n, nframes, params.h);
write_frame_data(fp, n, globalState, NULL);
}
if (proc == 0) {
hash_particles(globalState, params.h);
}
//hash_particles_parallel(globalState, pInfo, params.h);
#pragma omp barrier // Need the hashing to be done
compute_accel(globalState, pInfo, ¶ms);
#pragma omp barrier
leapfrog_start(globalState, pInfo, dt);
check_state(globalState, pInfo);
for (int frame = 1; frame < nframes; ++frame) {
// We sort according to Z-Morton to ensure locality, need to implement paralle qsort
if (frame % 5 == 0) {
// Dividing into chunks of sorting each chunk
// This alone turned out to better than sorting the entire array
qsort(globalState->part+pInfo->beg, pInfo->end-pInfo->beg ,sizeof(particle_t),compPart);
// Sorting the array consisting of sorted chunks
// This turned out to actually lower the performance. That's why
// I commented it.
// #pragma omp barrier
// if( pInfo->nproc >1 ) arraymerge(globalState->part, globalState->n, pInfo);
//#pragma omp barrier*/
// Serial version
/*#pragma omp single // Implied barrier
qsort(globalState->part, n, sizeof(particle_t), compPart);*/
}
/*else if (frame % 49) {*/
/*if (proc == 0) {*/
/*}*/
/*}*/
#pragma omp barrier // Need sort to finish
for (int i = 0; i < npframe; ++i) {
if (proc == 0 && npframe % 4 == 0) { // Ammortize hashing cost
hash_particles(globalState, params.h);
}
#pragma omp barrier
compute_accel(globalState, pInfo, ¶ms);
leapfrog_step(globalState, pInfo, dt);
check_state(globalState, pInfo);
#pragma omp barrier
}
if (proc == 0) {
printf("Frame: %d of %d - %2.1f%%\n",frame, nframes,
100*(float)frame/nframes);
write_frame_data(fp, n, globalState, NULL);
}
}
double t_end = omp_get_wtime();
//.........这里部分代码省略.........
开发者ID:njbooher,项目名称:cs5220_group,代码行数:101,代码来源:sph.c
示例14: brw_upload_state
/***********************************************************************
* Emit all state:
*/
void brw_upload_state(struct brw_context *brw)
{
struct gl_context *ctx = &brw->intel.ctx;
struct intel_context *intel = &brw->intel;
struct brw_state_flags *state = &brw->state.dirty;
int i;
static int dirty_count = 0;
state->mesa |= brw->intel.NewGLState;
brw->intel.NewGLState = 0;
if (brw->emit_state_always) {
state->mesa |= ~0;
state->brw |= ~0;
state->cache |= ~0;
}
if (brw->fragment_program != ctx->FragmentProgram._Current) {
brw->fragment_program = ctx->FragmentProgram._Current;
brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM;
}
if (brw->vertex_program != ctx->VertexProgram._Current) {
brw->vertex_program = ctx->VertexProgram._Current;
brw->state.dirty.brw |= BRW_NEW_VERTEX_PROGRAM;
}
if ((state->mesa | state->cache | state->brw) == 0)
return;
brw->intel.Fallback = false; /* boolean, not bitfield */
intel_check_front_buffer_rendering(intel);
if (unlikely(INTEL_DEBUG)) {
/* Debug version which enforces various sanity checks on the
* state flags which are generated and checked to help ensure
* state atoms are ordered correctly in the list.
*/
struct brw_state_flags examined, prev;
memset(&examined, 0, sizeof(examined));
prev = *state;
for (i = 0; i < brw->num_atoms; i++) {
const struct brw_tracked_state *atom = brw->atoms[i];
struct brw_state_flags generated;
if (brw->intel.Fallback)
break;
if (check_state(state, &atom->dirty)) {
atom->emit(brw);
}
accumulate_state(&examined, &atom->dirty);
/* generated = (prev ^ state)
* if (examined & generated)
* fail;
*/
xor_states(&generated, &prev, state);
assert(!check_state(&examined, &generated));
prev = *state;
}
}
else {
for (i = 0; i < brw->num_atoms; i++) {
const struct brw_tracked_state *atom = brw->atoms[i];
if (brw->intel.Fallback)
break;
if (check_state(state, &atom->dirty)) {
atom->emit(brw);
}
}
}
if (unlikely(INTEL_DEBUG & DEBUG_STATE)) {
brw_update_dirty_count(mesa_bits, state->mesa);
brw_update_dirty_count(brw_bits, state->brw);
brw_update_dirty_count(cache_bits, state->cache);
if (dirty_count++ % 1000 == 0) {
brw_print_dirty_count(mesa_bits, state->mesa);
brw_print_dirty_count(brw_bits, state->brw);
brw_print_dirty_count(cache_bits, state->cache);
fprintf(stderr, "\n");
}
}
if (!brw->intel.Fallback)
memset(state, 0, sizeof(*state));
}
开发者ID:altf4,项目名称:mesa,代码行数:96,代码来源:brw_state_upload.c
示例15: tex_task1
void
tex_task1(TEXPTN texptn, intptr_t exinf)
{
ER ercd;
switch (texptn) {
case 0x0001:
check_point(4);
check_state(false, false, TIPM_ENAALL, false, false, true);
/*
* dispatch disabled, ipm changed, task exception enabled
*/
check_point(5);
ercd = dis_dsp();
check_ercd(ercd, E_OK);
ercd = chg_ipm(TMAX_INTPRI);
check_ercd(ercd, E_OK);
ercd = ena_tex();
check_ercd(ercd, E_OK);
ercd = loc_cpu();
check_ercd(ercd, E_OK);
check_state(false, true, TMAX_INTPRI, true, true, false);
break;
case 0x0002:
check_point(10);
check_state(false, false, TIPM_ENAALL, true, true, true);
/*
* raise task exception request
*/
check_point(11);
ercd = ras_tex(TSK_SELF, 0x0001);
check_ercd(ercd, E_OK);
ercd = ras_tex(TSK_SELF, 0x0002);
check_ercd(ercd, E_OK);
/*
* dispatch enabled, ipm changed, cpu locked
*/
check_point(12);
ercd = ena_dsp();
check_ercd(ercd, E_OK);
ercd = chg_ipm(TMAX_INTPRI);
check_ercd(ercd, E_OK);
ercd = loc_cpu();
check_ercd(ercd, E_OK);
check_state(false, true, TMAX_INTPRI, false, true, true);
break;
case 0x0003:
check_point(13);
check_state(false, false, TIPM_ENAALL, true, true, true);
/*
* dispatch enabled, ipm changed, task exception enabled
*/
check_point(14);
ercd = ena_dsp();
check_ercd(ercd, E_OK);
ercd = chg_ipm(TMAX_INTPRI);
check_ercd(ercd, E_OK);
ercd = ena_tex();
check_ercd(ercd, E_OK);
check_state(false, false, TMAX_INTPRI, false, true, false);
ercd = chg_ipm(TIPM_ENAALL);
check_ercd(ercd, E_OK);
ercd = chg_ipm(TMAX_INTPRI);
check_ercd(ercd, E_OK);
/*
* raise task exception request
*/
check_point(15);
ercd = ras_tex(TSK_SELF, 0x0004);
ercd = dis_tex();
check_ercd(ercd, E_OK);
ercd = chg_ipm(TIPM_ENAALL);
check_ercd(ercd, E_OK);
ercd = chg_ipm(TMAX_INTPRI);
check_ercd(ercd, E_OK);
ercd = ena_tex();
check_ercd(ercd, E_OK);
check_point(16);
ercd = chg_ipm(TIPM_ENAALL);
/* task exception routine runs here */
check_ercd(ercd, E_OK);
/*
* check the state when task exception routine returns
*/
check_point(19);
check_state(false, false, TIPM_ENAALL, false, false, false);
break;
case 0x0004:
//.........这里部分代码省略.........
开发者ID:bzchangguopeng,项目名称:toppers-asp,代码行数:101,代码来源:test_tex1.c
示例16: fprintf
void
Node::print(FILE* out) const {
fprintf(out, "(%d, %d - %d)\t", pos.x, pos.y, pos.level);
fprintf(out, "%.1lf = %.1lf + %.1lf\t", f, g, h);
fprintf(out, "%d %d %d %d %d\n", check_state(GOAL), check_state(START), check_state(WAITING), check_state(FRINGE), check_state(CLOSED));
}
开发者ID:jkkummerfeld,项目名称:pathing,代码行数:6,代码来源:node.cpp
示例17: task1
void
task1(intptr_t exinf)
{
ER ercd;
T_RTEX rtex;
/*
* check init state
*/
check_point(1);
check_state(false, false, TIPM_ENAALL, false, false, true);
ercd = ref_tex(TSK_SELF, &rtex);
check_ercd(ercd, E_OK);
check_assert((rtex.texstat & TTEX_DIS) != 0);
check_assert(rtex.pndptn == 0);
/*
* error check of ras_tex
*/
ercd = ras_tex(TASK3, 0x0001);
check_ercd(ercd, E_OBJ);
ercd = ras_tex(TASK4, 0x0001);
check_ercd(ercd, E_OBJ);
/*
* error check of ref_tex
*/
ercd = ref_tex(TASK3, &rtex);
check_ercd(ercd, E_OBJ);
ercd = ref_tex(TASK4, &rtex);
check_ercd(ercd, E_OBJ);
/*
* enable task exception
*/
check_point(2);
ercd = ena_tex();
check_ercd(ercd, E_OK);
check_state(false, false, TIPM_ENAALL, false, false, false);
ercd = ref_tex(TSK_SELF, &rtex);
check_ercd(ercd, E_OK);
check_assert((rtex.texstat & TTEX_ENA) != 0);
check_assert(rtex.pndptn == 0);
/*
* raise task exception request
*/
check_point(3);
ercd = ras_tex(TSK_SELF, 0x0001);
/* task exception routine runs here */
check_ercd(ercd, E_OK);
/*
* check the state when task exception routine returns
*/
check_point(6);
check_state(false, false, TIPM_ENAALL, false, false, false);
/*
* dispatch disabled, task exception disabled
*/
check_point(7);
ercd = dis_dsp();
check_ercd(ercd, E_OK);
ercd = dis_tex();
check_ercd(ercd, E_OK);
check_state(false, false, TIPM_ENAALL, true, true, true);
/*
* raise task exception request
*/
check_point(8);
ercd = ras_tex(TASK1, 0x0002);
check_ercd(ercd, E_OK);
ercd = ref_tex(TSK_SELF, &rtex);
check_ercd(ercd, E_OK);
check_assert((rtex.texstat & TTEX_DIS) != 0);
check_assert(rtex.pndptn == 0x0002);
/*
* enable task exception
*/
check_point(9);
ercd = ena_tex();
/* task exception routine runs here */
check_ercd(ercd, E_OK);
/*
* check the state when task exception routine returns
*/
check_point(20);
check_state(false, false, TIPM_ENAALL, true, true, false);
/*
* switch task2
*/
check_point(21);
ercd = ena_dsp();
check_ercd(ercd, E_OK);
ercd = rot_rdq(TPRI_SELF);
//.........这里部分代码省略.........
开发者ID:bzchangguopeng,项目名称:toppers-asp,代码行数:101,代 |
请发表评论