1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00

Implement a mechanism for generating pure typename functions.

This commit is contained in:
Sandu Liviu Catalin 2016-11-15 21:06:41 +02:00
parent 2b282951af
commit 351d44a8e5

View File

@ -33,6 +33,23 @@ extern PluginFuncs* _Func;
extern PluginCallbacks* _Clbk;
extern PluginInfo* _Info;
/* ------------------------------------------------------------------------------------------------
* Helper to register pure typename functions for better performance.
*/
#define SQMODE_DECL_TYPENAME(t, s) /*
*/ namespace { /*
*/ struct t { /*
*/ static const SQChar Str[]; /*
*/ static SQInteger Fn(HSQUIRRELVM vm); /*
*/ }; /*
*/ const SQChar t::Str[] = s; /*
*/ SQInteger t::Fn(HSQUIRRELVM vm) { /*
*/ sq_pushstring(vm, Str, sizeof(Str) / sizeof(SQChar)); /*
*/ return 1; /*
*/ } /*
*/ } /*
*/
/* ------------------------------------------------------------------------------------------------
* Retrieve the temporary buffer.
*/