예제 #1
0
int main(int argc, char * argv[]){
    int i = 1;

    setlocale(LC_ALL, "");

    GError * error = NULL;
    GOptionContext * context;

    context = g_option_context_new("- merge k mixture model");
    g_option_context_add_main_entries(context, entries, NULL);
    if (!g_option_context_parse(context, &argc, &argv, &error)) {
        g_print("option parsing failed:%s\n", error->message);
        exit(EINVAL);
    }

    KMixtureModelBigram target(K_MIXTURE_MODEL_MAGIC_NUMBER);
    target.attach(result_filename, ATTACH_READWRITE|ATTACH_CREATE);

    while (i < argc){
        const char * new_filename = argv[i];
        KMixtureModelBigram new_one(K_MIXTURE_MODEL_MAGIC_NUMBER);
        new_one.attach(new_filename, ATTACH_READONLY);
        if ( !merge_two_k_mixture_model(&target, &new_one) )
            exit(EOVERFLOW);
        ++i;
    }

    return 0;
}
예제 #2
0
파일: NodeTerminal.cpp 프로젝트: kniz/World
void NodeTerminal::onKeyPressed(int inputed)
{
	switch (inputed)
	{
	case CANCEL:
		LG::Core::open(MainPopUpMenu(*this));
		break;

	case LG::RENAME:
		if( ! focused) {
			NENode& chosen = castObject();			
			NEScriptEditor& se = Editor::getInstance().getScriptEditor();
			NECode new_one(se.getScriptHeader().getMaxCode(NECodeType::NAME));

			if (chosen.getNameCode() <= 0) {
				se.insertCode(++new_one);
				chosen.setCodes(new_one);
			}

			NETString& bank = se.getBanks().getBank(NECodeType::NAME)[chosen.getNameCode()];
			if (!&bank) {
				::Core::pushMessage("이 노드에 해당하는 NameBank를 찾을 수 없습니다.");
				return;
			}

			call(HeaderModifier::StringInputWindow(bank));
		}
		else if(focused == 2)
			ms_terminal.onKeyPressed(inputed);
		break;

	case CLOSE:
		delete_me = true;
		break;

	case LEFT:
		if( ! focused && enable.Gliph::back == CYAN	&& enable.getValue())
			return enable.onKeyPressed(inputed);
		if(focused == 0 && attributes.choosed == 1)
		{
			LG::Core::play(LG::Core::SND_TICK);
			if(codelist_display_index > -2)
				codelist_display_index--;
		}
		else if (focused > 0)
		{
			LG::Core::play(LG::Core::SND_TRANSITE);
			focused--;
		}

		break;

	case RIGHT:
		if( ! focused && enable.Gliph::back == CYAN && ! enable.getValue())
			return enable.onKeyPressed(inputed);
		if(focused == 0 && attributes.choosed == 1)
		{
			LG::Core::play(LG::Core::SND_TICK);
			if(codelist_display_index < castObject().getGroupCodes().getLengthLastIndex())
				codelist_display_index++;
		}
		else if (focused < 2)
		{
			LG::Core::play(LG::Core::SND_TRANSITE);
			focused++;
		}
		break;

	default:
		switch(focused)
		{
		case 0:
			switch(inputed)
			{
			case UP:
				if(attributes.choosed <= 0)
				{
					enable.Gliph::back = CYAN;
					enable.fore = LIGHTCYAN;
					attributes.choosed = -1;
				}
				break;
				
			case DOWN:
				if(attributes.choosed < 0)
				{
					enable.Gliph::back = DARKGRAY;
					enable.fore = LIGHTGRAY;
				}
				break;
			}

			if(enable.Gliph::back == CYAN)
				enable.onKeyPressed(inputed);
			else
				attributes.onKeyPressed(inputed);
			break;

		case 1:
			ks_terminal.onKeyPressed(inputed);
			break;

		case 2:
			ms_terminal.onKeyPressed(inputed);
			break;
		}
		break;
	}
}