Пример #1
0
int process(unsigned char *rgb_a, unsigned char *rgb_b,unsigned int index, unsigned int showanno) {
    
    unsigned int height, isup, oob;

    if (index<10) gotup=0;
    
    process_function (rgb_a, rgb_b,COMMAND, showanno);

    height = top;

    #ifdef ALGO_1
    if (height>v_STANDING_PERSON_HEIGHT) isup=1; else isup=0;
    if ((centerx<OUTOFBED_LEFT)||(centerx>OUTOFBED_RIGHT)) oob=1; else oob=0;
    
    if ((isup==1)&&(gotup==0)&&(index>9))  { gotup=1; printf("Standing [after %05d Frames]\n",index); }
    
    if ((oob==1)&&(isup==1)) printf("Walking !!\n");
    
    if ((oob==1)&&(isup==0)) printf("* * * Warning : Out of Bed but not Standing up!  * * * \n");
    #endif
    
    #ifdef ALGO_2
    if (cupmoved==1) printf("The cup was moved!\n");
    #endif
}
Пример #2
0
static void
process_record(struct pevent *pevent, struct pevent_record *record)
{
	unsigned long long val;
	int type;

	pevent_read_number_field(common_type_field, record->data, &val);
	type = val;

	if (type == function_type)
		return process_function(pevent, record);

	if (type == function_graph_entry_type)
		return process_function_graph_entry(pevent, record);

	if (type == function_graph_exit_type)
		return process_function_graph_exit(pevent, record);

	if (type == kernel_stack_type)
		return process_kernel_stack(pevent, record);

	if (type == sched_wakeup_type || type == sched_wakeup_new_type)
		process_sched_wakeup(pevent, record, type);

	else if (type == sched_switch_type)
		process_sched_switch(pevent, record);

	process_event(pevent, record, type);
}
Пример #3
0
static struct ast_node*
stmt(void *opaque)
{
	struct ast_node *node;
	token_t	prev_token;

	prev_token = current_token;

	if (match(TOKEN_FUNCTION))

		node = process_function(opaque);
	
	else if (match(TOKEN_LOCAL))
		
		node = process_local_declaration(opaque);

	else if (match(TOKEN_IF)) 
		
		node = if_expr(opaque);
	
	else if (match(TOKEN_FOR))
			
		node = for_expr(opaque);
	
	else if (match(TOKEN_WHILE))
		
		node = while_expr(opaque);
	
	else if (match(TOKEN_BREAK))
		
		node = break_expr(opaque);

	else if (match(TOKEN_CONTINUE))
	
		node = continue_expr(opaque);

	else if (match(TOKEN_RETURN))

		node = process_return_node(opaque);

	else if (match(TOKEN_LBRACE))

		node = process_scope(opaque);

	else if (match(TOKEN_RBRACE)) 

		node = end_scope_expr(opaque);
	
	else if (match(TOKEN_UNKNOWN)) 

		node = unknown_expr(opaque);

	else	
		node = other_expr(opaque);

	return node;	
}
Пример #4
0
// generates code to implement node's action
static void implement_node(ast_node node){
  if (node != NULL){
    if (node->node_type == ROOT){
      process_root(node); 
    }
    // generate code for assignment operator
    else if (node->node_type == OP_ASSIGN){
      process_assign(node); 
    }
    // generate code for negate operator
    else if (node->node_type == OP_NEG) {
      process_negate(node); 
    }
    // generate code for  +, -, *, /, %, =, !=, <, <=, >, >=
    else if (node->node_type > 0 && node->node_type <= 16 && node->node_type != 14 && node->node_type != 15){
      process_math(node); 
    }
    else if (node->node_type == OP_INC){
      process_inc(node, "1"); 
    }
    else if (node->node_type == OP_DEC){
      process_inc(node, "-1"); 
    }
    else if (node->node_type == IF_STMT){
      process_if(node); 
    }
    else if (node->node_type == IF_ELSE_STMT){
      process_ifelse(node); 
    }
    else if (node->node_type == CMPD){
      process_cmpd(node); 
    }
    else if (node->node_type == WHILE_STMT){
      process_while(node); 
    }
    else if (node->node_type == DO_WHILE_STMT){
      process_dowhile(node); 
    }
    else if (node->node_type == OP_AND){
      process_and(node); 
    }
    else if (node->node_type == OP_OR){
      process_or(node); 
    }
    else if (node->node_type == FOR_STRT || node->node_type == FOR_COND || node->node_type == FOR_UPDT){
      process_for_header(node); 
    }
    else if (node->node_type == FOR_STMT){
      process_for(node); 
    }
    else if (node->node_type == READ_STMT){
      process_read(node); 
    }
    else if (node->node_type == PRINT_STMT){
      process_print(node); 
    }
    else if (node->node_type == RETURN_STMT){
      process_return(node); 
    }
    else if (node->node_type == FUNCDEC){
      process_function(node); 
    }
    else if (node->node_type == PARAMS){
      process_params(node); 
    }
    else if (node->node_type == INT_TYPE || node->node_type == DOUBLE_TYPE){
      process_vardec(node); 
    }
    else if (node->node_type == CALL){
      process_call(node); 
    } 
    else if (node->node_type == IDENT){
      process_id(node); 
    } 
    else if (node->node_type == ARRAY){
      process_array(node); 
    }
  }
}
Пример #5
0
gboolean
subsystem_msg_dispatch(IPC_Channel *sender, void *user_data)
{
	int lpc = 0;
	xmlNode *msg = NULL;
	xmlNode *data = NULL;
	gboolean all_is_well = TRUE;
	const char *sys_to;
	const char *task;
	gboolean (*process_function)
	    (xmlNode *msg, xmlNode *data, IPC_Channel *sender) = NULL;

	while(IPC_ISRCONN(sender)) {
		gboolean process = FALSE;
		if(sender->ops->is_message_pending(sender) == 0) {
			break;
		}

		msg = xmlfromIPC(sender, MAX_IPC_DELAY);
		if (msg == NULL) {
		    break;
		}

		lpc++;
		crm_log_xml(LOG_MSG, __FUNCTION__, msg);

		sys_to = crm_element_value(msg, F_CRM_SYS_TO);
		task   = crm_element_value(msg, F_CRM_TASK);

		if(safe_str_eq(task, CRM_OP_HELLO)) {
			process = TRUE;

		} else if(sys_to == NULL) {
			crm_err("Value of %s was NULL!!", F_CRM_SYS_TO);
			
		} else if(task == NULL) {
			crm_err("Value of %s was NULL!!", F_CRM_TASK);
			
		} else {
			process = TRUE;
		}

		if(process == FALSE) {
		    free_xml(msg); msg = NULL;
		    continue;
		}
		
		data = get_message_xml(msg, F_CRM_DATA);		
		process_function = user_data;
		if(FALSE == process_function(msg, data, sender)) {
		    crm_warn("Received a message destined for %s"
			     " by mistake", sys_to);
		}
	
		free_xml(msg); msg = NULL;
		
		if(sender->ch_status == IPC_CONNECT) {
		    break;
		}
	}

	crm_debug_2("Processed %d messages", lpc);
	if (sender->ch_status != IPC_CONNECT) {
		crm_err("The server %d has left us: Shutting down...NOW",
			sender->farside_pid);

		exit(1); /* shutdown properly later */
		
		return !all_is_well;
	}
	return all_is_well;
}