SA-MP Forums Archive
Infinite Compile - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Infinite Compile (/showthread.php?tid=421005)



Infinite Compile - xX_Simon_Xx - 07.03.2013

why if i do this
pawn Код:
native mysql_function_query(connectionHandle, query[], bool:cache, callback[], format[], {Float,_}:...);

#define LOAD_mysql_function_query(%1) \
    if(!LoadInfo[Loaded]) LoadInfo[Query]++;\
    mysql_function_query(%1)

#if defined _ALS_mysql_function_query
    #undef mysql_function_query
#else
    #define _ALS_mysql_function_query
#endif
#define mysql_function_query LOAD_mysql_function_query
and then use mysql_function_query

the compiling process never end for me?


Re: Infinite Compile - MP2 - 07.03.2013

#define LOAD_mysql_function_query(%1) \
if(!LoadInfo[Loaded]) LoadInfo[Query]++;\
mysql_function_query(%1)

looks odd to me. Try this:

#define LOAD_mysql_function_query(%1) if(!LoadInfo[Loaded]) mysql_function_query(%1), LoadInfo[Query]++

or perhaps even

#define LOAD_mysql_function_query(%1); if(!LoadInfo[Loaded]) { mysql_function_query(%1); LoadInfo[Query]++; }


Re: Infinite Compile - xX_Simon_Xx - 08.03.2013

Quote:
Originally Posted by MP2
Посмотреть сообщение
#define LOAD_mysql_function_query(%1) \
if(!LoadInfo[Loaded]) LoadInfo[Query]++;\
mysql_function_query(%1)

looks odd to me. Try this:

#define LOAD_mysql_function_query(%1) if(!LoadInfo[Loaded]) mysql_function_query(%1), LoadInfo[Query]++

or perhaps even

#define LOAD_mysql_function_query(%1); if(!LoadInfo[Loaded]) { mysql_function_query(%1); LoadInfo[Query]++; }
is not equal to this

pawn Код:
#define LOAD_mysql_function_query(%1) \
    if(!LoadInfo[Loaded]) LoadInfo[Query]++;\
    mysql_function_query(%1)
perhaps did you mean

pawn Код:
#define LOAD_mysql_function_query(%1) \
    if(!LoadInfo[Loaded]) {LoadInfo[Query]++;} mysql_function_query(%1)
however is this thath causate the problem

pawn Код:
#define mysql_function_query LOAD_mysql_function_query
In my gm I created macros that look like this

pawn Код:
// native MySQLSelectStrOrderBy(query, len, select[], table[], field[], fieldval, order[],bool:cache, callback[], format[],{Float, _}:...);
#define MySQLSelectStrOrderBy(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9) \
    new val2[256]; \
    mysql_real_escape_string(%5,val2); \
    format(%0, %1, "SELECT %s FROM `%s` WHERE `%s` = '%s' ORDER BY %s", %2,%3,%4,%5,%6); \
    mysql_function_query(ConnectionHandle,%0,%7,%8,%9)
in which use the function mysql_function_query already redifined
is what can cause the problem?


Re: Infinite Compile - SuperViper - 08.03.2013

LOAD_mysql_function_query is calling mysql_function_query which then calls LOAD_mysql_function_query again and it keeps on going in a circle.


Re: Infinite Compile - xX_Simon_Xx - 08.03.2013

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
LOAD_mysql_function_query is calling mysql_function_query which then calls LOAD_mysql_function_query again and it keeps on going in a circle.
What Sorry but why?? i can't redefine a native function whit a macro

isn't the same as this??
pawn Код:
stock LOAD_mysql_function_query(connectionHandle, query[], bool:cache, callback[], format[], {Float,_}:...)
{
    if(!LoadInfo[Loaded]) LoadInfo[Query]++;
   return mysql_function_query(connectionHandle, query, cache, callback, format, /*for pass the other elements i need to use the #emit function but i don't know how*/);
}

#if defined _ALS_mysql_function_query
    #undef mysql_function_query
#else
    #define _ALS_mysql_function_query
#endif
#define mysql_function_query LOAD_mysql_function_query
This type of redefinition don't go in an infinite recursion why with the macro should go


Re: Infinite Compile - xX_Simon_Xx - 09.03.2013

BUMP


Re: Infinite Compile - xX_Simon_Xx - 11.03.2013

BUMP