<commit_before>#include "CommandLoader.h"
#include "CommandFactory.h"

#include <ee/SymbolFactory.h>
#include <ee/SpriteFactory.h>
#include <ee/Config.h>
#include <ee/Exception.h>
#include <ee/SymbolFile.h>
#include <ee/SymbolType.h>

#include <easycomplex.h>
#include <easyanim.h>
#include <easyanim2.h>
#include <easyscale9.h>
#include <easymesh.h>
#include <easyshape.h>
#include <easytexture.h>
#include <easyterrain2d.h>
#include <easyicon.h>
#include <easyparticle3d.h>
#include <easyparticle2d.h>
#include <easytext.h>
#include <easymask.h>
#include <easytrail.h>
#include <easyaudio.h>

#include <sprite2/SymType.h>
#include <gum/Facade.h>

static void InitSymbolCreators() 
{
	ee::SymbolFactory::RegisterCreator(s2::SYM_COMPLEX, &ecomplex::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_COMPLEX, &ecomplex::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_ANIMATION, &libanim::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_ANIMATION, &libanim::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_ANIM2, &libanim2::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_ANIM2, &libanim2::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_SCALE9, &escale9::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_SCALE9, &escale9::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_MESH, &emesh::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_MESH, &emesh::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_SHAPE, &eshape::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_SHAPE, &eshape::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_TEXTURE, &etexture::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_TEXTURE, &etexture::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_ICON, &eicon::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_ICON, &eicon::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_PARTICLE3D, &eparticle3d::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_PARTICLE3D, &eparticle3d::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_PARTICLE2D, &eparticle2d::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_PARTICLE2D, &eparticle2d::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_TEXTBOX, &etext::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_TEXTBOX, &etext::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_MASK, &emask::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_MASK, &emask::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_TRAIL, &etrail::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_TRAIL, &etrail::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_AUDIO, &eaudio::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_AUDIO, &eaudio::Sprite::Create);
}

static void Help()
{
	const std::vector<edb::ICommand*>& cmds 
		= edb::CommandFactory::Instance()->GetAllCmds();

	std::cout << "All commands:" << std::endl;
	for (int i = 0, n = cmds.size(); i < n; ++i) {
		edb::ICommand* cmd = cmds[i];
		std::cout << cmd->Command() << "\t" << cmd->Description() << std::endl;
	}
}

int main(int argc, char *argv[])
{
	wxInitializer initializer;
	if ( !initializer )
	{
		fprintf(stderr, "Failed to initialize the wxWidgets library, aborting.");
		return -1;
	}

	edb::CommandLoader::Init();

	if (argc < 2) {
		std::cerr << "Need Command!" << std::endl;
		Help();
		return 0;
	}

	std::string scmd = argv[1];
	if (scmd == "-h" || scmd == "--help") {
		Help();
		return 0;
	}

	ee::Config::Instance()->EnableUseDTex(false);
	ee::Config::Instance()->EnableRender(false);

	InitSymbolCreators();

	const std::vector<edb::ICommand*>& cmds 
		= edb::CommandFactory::Instance()->GetAllCmds();
	for (int i = 0, n = cmds.size(); i < n; ++i)
	{
		edb::ICommand* cmd = cmds[i];
		if (scmd == cmd->Command()) {
			try {
				cmd->Run(argc, argv);
				gum::Facade::Terminate();
			} catch (ee::Exception& e) {
				std::cout << e.What() << std::endl;
				return -1;
			}
		}
	}

	return 0;
}<commit_msg>[FIXED] rm gum::Facade::Terminate(), for thread dtor's crash<commit_after>#include "CommandLoader.h"
#include "CommandFactory.h"

#include <ee/SymbolFactory.h>
#include <ee/SpriteFactory.h>
#include <ee/Config.h>
#include <ee/Exception.h>
#include <ee/SymbolFile.h>
#include <ee/SymbolType.h>

#include <easycomplex.h>
#include <easyanim.h>
#include <easyanim2.h>
#include <easyscale9.h>
#include <easymesh.h>
#include <easyshape.h>
#include <easytexture.h>
#include <easyterrain2d.h>
#include <easyicon.h>
#include <easyparticle3d.h>
#include <easyparticle2d.h>
#include <easytext.h>
#include <easymask.h>
#include <easytrail.h>
#include <easyaudio.h>

#include <sprite2/SymType.h>
#include <gum/Facade.h>

static void InitSymbolCreators() 
{
	ee::SymbolFactory::RegisterCreator(s2::SYM_COMPLEX, &ecomplex::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_COMPLEX, &ecomplex::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_ANIMATION, &libanim::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_ANIMATION, &libanim::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_ANIM2, &libanim2::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_ANIM2, &libanim2::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_SCALE9, &escale9::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_SCALE9, &escale9::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_MESH, &emesh::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_MESH, &emesh::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_SHAPE, &eshape::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_SHAPE, &eshape::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_TEXTURE, &etexture::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_TEXTURE, &etexture::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_ICON, &eicon::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_ICON, &eicon::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_PARTICLE3D, &eparticle3d::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_PARTICLE3D, &eparticle3d::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_PARTICLE2D, &eparticle2d::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_PARTICLE2D, &eparticle2d::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_TEXTBOX, &etext::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_TEXTBOX, &etext::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_MASK, &emask::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_MASK, &emask::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_TRAIL, &etrail::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_TRAIL, &etrail::Sprite::Create);

	ee::SymbolFactory::RegisterCreator(s2::SYM_AUDIO, &eaudio::Symbol::Create);
	ee::SpriteFactory::Instance()->RegisterCreator(s2::SYM_AUDIO, &eaudio::Sprite::Create);
}

static void Help()
{
	const std::vector<edb::ICommand*>& cmds 
		= edb::CommandFactory::Instance()->GetAllCmds();

	std::cout << "All commands:" << std::endl;
	for (int i = 0, n = cmds.size(); i < n; ++i) {
		edb::ICommand* cmd = cmds[i];
		std::cout << cmd->Command() << "\t" << cmd->Description() << std::endl;
	}
}

int main(int argc, char *argv[])
{
	wxInitializer initializer;
	if ( !initializer )
	{
		fprintf(stderr, "Failed to initialize the wxWidgets library, aborting.");
		return -1;
	}

	edb::CommandLoader::Init();

	if (argc < 2) {
		std::cerr << "Need Command!" << std::endl;
		Help();
		return 0;
	}

	std::string scmd = argv[1];
	if (scmd == "-h" || scmd == "--help") {
		Help();
		return 0;
	}

	ee::Config::Instance()->EnableUseDTex(false);
	ee::Config::Instance()->EnableRender(false);

	InitSymbolCreators();

	const std::vector<edb::ICommand*>& cmds 
		= edb::CommandFactory::Instance()->GetAllCmds();
	for (int i = 0, n = cmds.size(); i < n; ++i)
	{
		edb::ICommand* cmd = cmds[i];
		if (scmd == cmd->Command()) {
			try {
				cmd->Run(argc, argv);
//				gum::Facade::Terminate();
			} catch (ee::Exception& e) {
				std::cout << e.What() << std::endl;
				return -1;
			}
		}
	}

	return 0;
}
{'fraction_non_alphanumeric': 0.20094480930982833, 'fraction_numerical': 0.013596036409724623, 'mean_word_length': 8.323308270676693, 'pattern_counts': {'":': 0, '<': 99, '<?xml version=': 0, '>': 97, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1528358', 'n_tokens_mistral': 3364, 'n_tokens_neox': 3274, 'n_words': 434}