Beispiel #1
0
void dcRSys::interprete(const char *input){

	char *buff = new char[strlen(input)];
	strcpy(buff,input);

	char *ptr;

	ptr = strtok(buff, " ");

	if(!ptr) return;


	rid *crid = create_rid(ptr);

	while(ptr != NULL){
		ptr = strtok(NULL, " ");
		if(ptr != NULL) link_child(crid, rstr(ptr));

	}

	last = cmd(crid);



}
Beispiel #2
0
// <-> kill()
zz_node * zz_manager::spawn (const char * baby_name, zz_node_type * node_type_to_spawn, bool do_load)
{
	zz_node * new_born = NULL;
	
	//if (!node_type_to_spawn) return NULL;
	assert(node_type_to_spawn);

	// if reuning was turned on, then get the exit_line's.
	if (num_reuse > 0) {
		if (!exit_line.empty()) { // if there are one more exiting items.
			new_born = exit_line.pop(); // get it!
			if (new_born && !baby_name) { // if has no name
				new_born->set_name(0); // reset as unique name to clear old name
			}
		}
	}

	if (!new_born) { // if not found existing instance, then create new instance.
		new_born = node_type_to_spawn->create_instance();
	}

	assert(new_born);
	
	if (baby_name) { // if has specified name, rename to it.
		new_born->set_name(baby_name);
	}
	// else, use default name

	// link to this manager. all instances should be linked to the manager.
	link_child(new_born);
	
	// set current
	_current = new_born;

	// if we load() immediately after creating.
	if (do_load) {
		load(new_born);
	}
	//ZZ_LOG("manager: %s new_born (%s::%s)\n", this->get_name(), new_born->get_node_type()->type_name, new_born->get_name());
	
	return new_born;
}
Beispiel #3
0
/* Init all the menus. Logis is mostly hardcoded */
int init_main_menu()
{
    select_menu *aux;

    main_menu = init_menu(CONF_COMPILE_OPT,0,0);
    if (!main_menu) {
        fprintf(output,"Failed to create main menu\n");
        return -1;
    }

    aux = init_menu(MAKE_INSTALL,INTERNAL_COMMAND,(run_action)run_make_install);
    if (!aux) {
        fprintf(output,"Failed to create menu\n");
        return -1;
    }
    link_sibling(main_menu,aux);

    aux = init_menu(MAKE_PROPER,INTERNAL_COMMAND,(run_action)run_make_proper);
    if (!aux) {
        fprintf(output,"Failed to create menu\n");
        return -1;
    }
    link_sibling(main_menu,aux);

    aux = init_menu(CONF_SCRIPT,0,0);
    if (!aux) {
        fprintf(output,"Failed to create menu\n");
        return -1;
    }
    link_sibling(main_menu,aux);

    if (gen_scripts_menu(aux) < 0) {
        fprintf(output,"Failed to get all script options\n");
        return -1;
    }

    aux = init_menu(EXIT_SAVE_EVERYTHING,INTERNAL_COMMAND|EXIT_MENUCONFIG,(run_action)save_all_changes);
    if (!aux) {
        fprintf(output,"Failed to create menu\n");
        return -1;
    }
    link_sibling(main_menu,aux);

    aux = init_menu(CONF_COMPILE_FLAGS,0,0);
    if (!aux) {
        fprintf(output,"Failed to create menu\n");
        return -1;
    }
    link_child(main_menu,aux);

    aux = init_menu(CONF_EXCLUDED_MODS,0,0);
    if (!aux) {
        fprintf(output,"Failed to create menu\n");
        return -1;
    }
    link_child(main_menu,aux);

    aux = init_menu(CONF_INSTALL_PREFIX,INTERNAL_COMMAND,(run_action)read_install_prefix);
    if (!aux) {
        fprintf(output,"Failed to create menu\n");
        return -1;
    }
    link_child(main_menu,aux);

    aux = init_menu(CONF_RESET_CHANGES,INTERNAL_COMMAND,
                    (run_action)reset_unsaved_compile);
    if (!aux) {
        fprintf(output,"Failed to create menu\n");
        return -1;
    }
    link_child(main_menu,aux);

    aux = init_menu(CONF_SAVE_CHANGES,INTERNAL_COMMAND,
                    (run_action)dump_make_conf);
    if (!aux) {
        fprintf(output,"Failed to create menu\n");
        return -1;
    }
    link_child(main_menu,aux);

    if (parse_make_conf() < 0) {
        fprintf(output,"Failed to parse Makefile.conf");
        return -1;
    }

    return 0;
}