示例#1
0
//! (static)
void init() {
	Namespace * SGLOBALS=getSGlobals();

	Object::init(*SGLOBALS);
	Type::init(*SGLOBALS);
	ExtObject::init(*SGLOBALS);

	Number::init(*SGLOBALS);
	NumberRef::init(*SGLOBALS);
	Bool::init(*SGLOBALS);
	String::init(*SGLOBALS);

	Collection::init(*SGLOBALS);
	Identifier::init(*SGLOBALS);
	Iterator::init(*SGLOBALS);
	Array::init(*SGLOBALS);
	Map::init(*SGLOBALS);
	Exception::init(*SGLOBALS);
	Delegate::init(*SGLOBALS);
	Namespace::init(*SGLOBALS);
	Function::init(*SGLOBALS);
	UserFunction::init(*SGLOBALS);
	YieldIterator::init(*SGLOBALS);

	Parser::init(*SGLOBALS);
	Runtime::init(*SGLOBALS);

	declareConstant(SGLOBALS,"SGLOBALS",SGLOBALS);

	// init EScript namespace
	Namespace * escript = new Namespace();
	declareConstant(SGLOBALS,"EScript",escript);

	declareConstant(escript,"VERSION",Number::create(ES_VERSION));
	declareConstant(escript,"VERSION_STRING",String::create(ES_VERSION_STRING));

	// define attribute constants
	declareConstant(escript,"ATTR_NORMAL_ATTRIBUTE",Number::create(Attribute::NORMAL_ATTRIBUTE));
	declareConstant(escript,"ATTR_CONST_BIT",Number::create(Attribute::CONST_BIT));
	declareConstant(escript,"ATTR_PRIVATE_BIT",Number::create(Attribute::PRIVATE_BIT));
	declareConstant(escript,"ATTR_TYPE_ATTR_BIT",Number::create(Attribute::TYPE_ATTR_BIT));
	declareConstant(escript,"ATTR_INIT_BIT",Number::create(Attribute::INIT_BIT));
	declareConstant(escript,"ATTR_REFERENCE_BIT",Number::create(Attribute::REFERENCE_BIT));
	declareConstant(escript,"ATTR_OVERRIDE_BIT",Number::create(Attribute::OVERRIDE_BIT));
	// -------------

	initLibrary(StdLib::init);
	initLibrary(IOLib::init);
	initLibrary(MathLib::init);
	#ifdef _WIN32
	initLibrary(Win32Lib::init);
	#endif
}
示例#2
0
HikNetHelper::HikNetHelper() {
    _hikNetUserId = -1;
    _hikRealPlayHandle = -1;
    _isLogin = false;
    _user =NULL;
    initLibrary();
}
示例#3
0
文件: Font.cpp 项目: Jereq/PongOut
Font::ErrorCode Font::init(const boost::filesystem::path& _fontPath, unsigned int _size, bool _flipOrigin)
{
	ErrorCode err;

	fontPath = _fontPath;
	size = _size;
	flipOrigin = _flipOrigin;

	if (!library)
	{
		err = initLibrary();
		if (err != ErrorCode::OK)
		{
			return err;
		}
	}

	FT_Error error = FT_New_Face(Font::library, fontPath.string().c_str(), 0, &face);
	if (error)
	{
		return ErrorCode::FONT_LOAD_FAILED;
	}

	error = FT_Set_Pixel_Sizes(face, 0, _size);
	if (error)
	{
		return ErrorCode::SIZE_FAILED;
	}

	return ErrorCode::OK;
}
示例#4
0
void Font::init()
{
	if(!libraryInitialized)
		initLibrary();

	mMaxGlyphHeight = 0;

	buildAtlas();
}
示例#5
0
void Font::init(ResourceData data)
{
	if(!libraryInitialized)
		initLibrary();

	mMaxGlyphHeight = 0;

	buildAtlas(data);
}
示例#6
0
int
android_initOpenglesEmulation(void)
{
    char* error = NULL;

    if (rendererLib != NULL)
        return 0;

    D("Initializing hardware OpenGLES emulation support");

    rendererLib = adynamicLibrary_open(RENDERER_LIB_NAME, &error);
    if (rendererLib == NULL) {
        derror("Could not load OpenGLES emulation library: %s", error);
        return -1;
    }

#ifndef CONFIG_STANDALONE_UI
    android_init_opengles_pipes();
#endif


    /* Resolve the functions */
    if (initOpenglesEmulationFuncs(rendererLib) < 0) {
        derror("OpenGLES emulation library mismatch. Be sure to use the correct version!");
        goto BAD_EXIT;
    }

    if (!initLibrary()) {
        derror("OpenGLES initialization failed!");
        goto BAD_EXIT;
    }

    if (android_gles_fast_pipes) {
#ifdef _WIN32
        /* XXX: NEED Win32 pipe implementation */
        setStreamMode(STREAM_MODE_TCP);
#else
	setStreamMode(STREAM_MODE_UNIX);
#endif
    } else {
	setStreamMode(STREAM_MODE_TCP);
    }
    return 0;

BAD_EXIT:
    derror("OpenGLES emulation library could not be initialized!");
    adynamicLibrary_close(rendererLib);
    rendererLib = NULL;
    return -1;
}
示例#7
0
void Font::onInit()
{
	if(!libraryInitialized)
		initLibrary();

	mMaxGlyphHeight = 0;

	if(FT_New_Face(sLibrary, mPath.c_str(), 0, &face))
	{
		LOG(LogError) << "Error creating font face! (path: " << mPath.c_str();
		return;
	}

	//FT_Set_Char_Size(face, 0, size * 64, getDpiX(), getDpiY());
	FT_Set_Pixel_Sizes(face, 0, mSize);

	buildAtlas();

	FT_Done_Face(face);
}
示例#8
0
/*! \class XsUdev
	\brief Class for dynamic loading of winusb
*/
XsUdev::XsUdev(void)
{
	m_libraryLoader = new XsLibraryLoader();
	initLibrary();
}
示例#9
0
bool ZLibrary::init(int &argc, char **&argv) {
#ifdef ZLSHARED
	const std::string pluginPath = std::string(LIBDIR) + "/zlibrary/ui";

	void *handle = 0;

	if ((argc > 2) && std::string("-zlui") == argv[1]) {
		handle = dlopen((pluginPath + "/zlui-" + argv[2] + ".so").c_str(), RTLD_NOW);
		argc -= 2;
		argv += 2;
	}

	if (handle == 0) {
		DIR *dir = opendir(pluginPath.c_str());
		if (dir == 0) {
			return false;
		}
		std::vector<std::string> names;
		const dirent *file;
		struct stat fileInfo;
		while ((file = readdir(dir)) != 0) {
			const std::string shortName = file->d_name;
			if ((shortName.substr(0, 5) != "zlui-") ||
					!ZLStringUtil::stringEndsWith(shortName, ".so")) {
				continue;
			}
			const std::string fullName = pluginPath + "/" + shortName;
			stat(fullName.c_str(), &fileInfo);
			if (!S_ISREG(fileInfo.st_mode)) {
				continue;
			}
			names.push_back(fullName);
		}
		closedir(dir);

		std::sort(names.begin(), names.end());
		for (std::vector<std::string>::const_iterator it = names.begin(); it != names.end(); ++it) {
			std::cerr << "loading " << *it << "...\n";
			handle = dlopen(it->c_str(), RTLD_NOW);
			if (handle == 0) {
				std::cerr << dlerror() << "\n";
			} else {
				break;
			}
		}

		if (handle == 0) {
			return false;
		}
	}

	void (*initLibrary)();
	*(void**)&initLibrary = dlsym(handle, "initLibrary");
	const char *error = dlerror();
	if (error != 0) {
		std::cerr << error << "\n";
		return false;
	}
#endif /* ZLSHARED */
	initLibrary();

	if (ZLibraryImplementation::Instance == 0) {
		return false;
	}

	ZLibraryImplementation::Instance->init(argc, argv);
	return true;
}
示例#10
0
文件: xswinusb.cpp 项目: 3660628/mrpt
/*! \class XsWinUsb
	\brief Class for dynamic loading of winusb
*/
XsWinUsb::XsWinUsb(void)
{
	m_libraryLoader = new XsLibraryLoader();
	initLibrary();
}
示例#11
0
MLScriptLanguage::MLScriptLanguage()
:reserved(),langfuncs(),worddelimiter(),wordsjoiner(),openpar(),closepar(),libraries()
{
	initLibrary();
}
示例#12
0
bool QKDEIntegration::enabled()
    {
    if( !inited )
        initLibrary();
    return enable;
    }