Beispiel #1
0
static void proc_menu_line(char *line){
	regex_t reg_exec, reg_exec_icon, reg_submenu, reg_submenu_icon, reg_include, reg_end;

	regmatch_t *match_exec = NULL;
	regmatch_t *match_exec_icon = NULL;
	regmatch_t *match_submenu = NULL;
	regmatch_t *match_submenu_icon = NULL;
	regmatch_t *match_include = NULL;

	char title[MAX_LINE_LENGTH];
	char command[MAX_LINE_LENGTH];
	char icon[MAX_LINE_LENGTH];

	regcomp(&reg_exec			 ,"^(.*\\[exec\\]) (.*\\()(.+)(\\)) (.*\\{)(.+)(\\})",REG_EXTENDED);
	regcomp(&reg_exec_icon	 ,"^(.*\\[exec\\]) (.*\\()(.+)(\\)) (.*\\{)(.+)(\\}) (.*<)(.+)(>)",REG_EXTENDED);
	regcomp(&reg_submenu     ,"^(.*\\[submenu\\]) (.*\\()(.+)(\\))",REG_EXTENDED);
	regcomp(&reg_submenu_icon,"^(.*\\[submenu\\]) (.*\\()(.+)(\\)) (.*<)(.+)(>)",REG_EXTENDED);
	regcomp(&reg_include		 ,"^(.*\\[include\\]) (.*\\()(.+)(\\))",REG_EXTENDED);
	regcomp(&reg_end			 ,"^.*\\[end",REG_EXTENDED);

	match_exec				= (regmatch_t *) malloc((reg_exec.re_nsub+1)*sizeof(regmatch_t));
	match_exec_icon		= (regmatch_t *) malloc((reg_exec_icon.re_nsub+1)*sizeof(regmatch_t));
	match_submenu			= (regmatch_t *) malloc((reg_submenu.re_nsub+1)*sizeof(regmatch_t));
	match_submenu_icon	= (regmatch_t *) malloc((reg_submenu_icon.re_nsub+1)*sizeof(regmatch_t));
	match_include			= (regmatch_t *) malloc((reg_include.re_nsub+1)*sizeof(regmatch_t));

	// exec with icon
	if(regexec(&reg_exec_icon,line,reg_exec_icon.re_nsub+1,match_exec_icon,0)==0){
		substring(line,title  ,match_exec_icon[3].rm_so,match_exec_icon[3].rm_eo);
		substring(line,command,match_exec_icon[6].rm_so,match_exec_icon[6].rm_eo);
		substring(line,icon   ,match_exec_icon[9].rm_so,match_exec_icon[9].rm_eo);
		create_exec(title,command,icon);
	// regular exec
	}else if(regexec(&reg_exec,line,reg_exec.re_nsub+1,match_exec,0)==0){
		substring(line,title  ,match_exec[3].rm_so,match_exec[3].rm_eo);
		substring(line,command,match_exec[6].rm_so,match_exec[6].rm_eo);
		create_exec(title,command,NULL);
	// submenu with icon
	}else if(regexec(&reg_submenu_icon,line,reg_submenu_icon.re_nsub+1,match_submenu_icon,0)==0){
		substring(line,title  ,match_submenu_icon[3].rm_so,match_submenu_icon[3].rm_eo);
		substring(line,icon   ,match_submenu_icon[6].rm_so,match_submenu_icon[6].rm_eo);
		create_submenu(title,icon);
	// regular submenu
	}else if(regexec(&reg_submenu,line,reg_submenu.re_nsub+1,match_submenu,0)==0){
		substring(line,title  ,match_submenu[3].rm_so,match_submenu[3].rm_eo);
		create_submenu(title,NULL);
	}else if(regexec(&reg_include,line,reg_include.re_nsub+1,match_include,0)==0){
		substring(line,title  ,match_include[3].rm_so,match_include[3].rm_eo);
		include_file(title);
	}else if(regexec(&reg_end,line,0,NULL,0)==0){
		menu_depth--;		
	}

	regfree(&reg_exec);
	regfree(&reg_exec_icon);
	regfree(&reg_submenu);
	regfree(&reg_submenu_icon);
	regfree(&reg_end);
}
Beispiel #2
0
int ccEnd(void )
{
    int rv = TRUE;
    if (!create_exec("COMMIT"))
    {
        rv = FALSE;
    }
    return rv;
}
Beispiel #3
0
int ccBegin(void)
{
    int rv = TRUE;
    if (!create_exec("BEGIN"))
    {
        rv = FALSE;
    }
    return rv;
}
Beispiel #4
0
static int createTables(void)
{
    int rv = TRUE;
    if (!create_exec(tables))
    {
        rv = FALSE;
    }
    return rv;
}
Beispiel #5
0
int ccDBDeleteForFile(sqlite3_int64 id)
{
    int rv = TRUE;
    char buf[1000];
    sprintf(buf, deletion, (int)id, (int)id, (int)id, (int)id, (int)id, (int)id, (int)id, (int)id, (int)id);
    if (!create_exec(buf))
    {
        rv = FALSE;
    }
    return rv;
}
static bool arm_cpu_init()
{
	skyeye_config_t* config = get_current_config();
	machine_config_t *mach = config->mach;
	ARM_CPU_State* cpu = (ARM_CPU_State*)skyeye_mm_zero(sizeof(ARM_CPU_State));
	if(!cpu){
		skyeye_log(Critical_log, __FUNCTION__, "Can not allocate the enough memory for cpu.\n");
		skyeye_exit(-1);
	}
	mach->cpu_data = get_conf_obj_by_cast(cpu, "ARM_CPU_State");

	cpu->core_num = 1;

	if(!cpu->core_num){
		skyeye_log(Critical_log, __FUNCTION__, "Can not get the core number or set wrong mach name?\n");
		skyeye_exit(-1);
	}
	else
		cpu->core = (arm_core_t*)skyeye_mm(sizeof(arm_core_t) * cpu->core_num);
	/* TODO: zero the memory by malloc */

	if(!cpu->core){
		skyeye_log(Critical_log, __FUNCTION__, "Can not allocate memory for ppc core.\n");
		skyeye_exit(-1);
	}
	else
		skyeye_log(Info_log, __FUNCTION__, "Initilization for %d core\n", cpu->core_num);

	int i;
	for(i = 0; i < cpu->core_num; i++){
		arm_core_t* core = &cpu->core[i];
		arm_core_init(core, i);
		arm_dyncom_init(core);

		skyeye_exec_t* exec = create_exec();
		//exec->priv_data = get_conf_obj_by_cast(core, "arm_core_t");
		exec->priv_data = (conf_object_t*)core;
		exec->run =  (void (*)(conf_object_t*))per_cpu_step;
		exec->stop = (void (*)(conf_object_t*))per_cpu_stop;
		add_to_default_cell(exec);
	}

	cpu->boot_core_id = 0;

	return true;
}