24.02.2018, 12:22
I divided my project into modules. But there have some problems with functions, as (maybe) you know when project divided into modules you must create many functions with different names and call them from the primary file (gamemode), inventing, memorizing names and locations of all functions is hard for me. That's why I decide to create some preprocessor parsers. But I face some problems as (maybe) you know max length of function's/callback's name is 31 and there have some functions as OnPlayerClickPlayerTextDraw (length is 27) what is the barrier to add tags to them, otherwise you can meet the limitation. My question: How to truncated function's name with parsers what is sent through macros? I'm sorry for my bad English. I guess you understood my question.
These are my parsers that I already created:
P.S.
If you have some advises to improve my parsers, please tell me.
These are my parsers that I already created:
PHP код:
#define ACCOUNT_MODULE_TAG_FUNCTION: _accmfn_
#define ACCOUNT_MODULE_TAG_CALLBACK: _accmcb_
#define AccountSystem:<%0:%1>%2(%3) accm@%0@%1@(%2,%3)
#define accm@call@function@(%0,%1) ACCOUNT_MODULE_TAG_FUNCTION:%0(%1)
#define accm@call@callback@(%0,%1) ACCOUNT_MODULE_TAG_CALLBACK:%0(%1)
#define accm@create@function@(%0,%1) stock ACCOUNT_MODULE_TAG_FUNCTION:%0(%1)
#define accm@create@callback@(%0,%1) \
forward ACCOUNT_MODULE_TAG_CALLBACK:%0(%1);\
public ACCOUNT_MODULE_TAG_CALLBACK:%0(%1)
AccountSystem:<create:function>SayHello()
{
print("hello");
}
main()
{
AccountSystem:<call:function>SayHello();
AccountSystem:<call:callback>OnPlayerConnect(666);
}
AccountSystem:<create:callback>OnPlayerConnect(playerid)
{
printf("OnPlayerConnect(%d)", playerid);
return 1;
}
If you have some advises to improve my parsers, please tell me.