Clumsily cheating the type-check
#1

I'm fooling around with typechecks during compile time, with some results:

pawn Код:
#include <a_samp>
#include <sscanf2>

main() {
    new tmp[] = "Hello 15 1.5";
    new str[] = "s[64]df"
    new y[3][3];
    new x[3][64];
    new Float:f, s[64], d;
   
    new j = 0, ss[64];
    for(new i = 0; i < sizeof str; ++i) {
        if(!('a' <= str[i] <= 'z')) continue;
       
        new t;
        #emit LOAD.S.pri ss
        #emit STOR.S.pri t
       
        switch(str[i]) {
            case 's': {
                strcat(y[j], "%s");
                #emit LOAD.S.pri s
                #emit STOR.S.pri t
            }
            case 'd': {
                strcat(y[j], "%d");
                #emit LOAD.S.pri d
                #emit STOR.S.pri t
            }
            case 'f': {
                strcat(y[j], "%f");
                #emit LOAD.S.pri f
                #emit STOR.S.pri t
            }
        }
        strcat(x[j], ss);
        ++j;
    }
    sscanf(tmp, str, x[0], x[1], x[2]);
    new ft[32];
    format(ft, sizeof ft, "Hi %s %s %s", y[0], y[1], y[2]);
    printf(ft, x[0], x[1], x[2]);
}
Returns "Hi Hello 15 1.5" - I was astonished that it worked in the end (so much pointer swaps). Anyway - is there some easier, cleaner way to do this type of experiment? Could someone show me how to pass to sscanf 3 variables with random types?

2. Is there way to smuggle array access into emit?
pawn Код:
#emit LOAD.S.pri x[j]
Extra characters in line
Reply
#2

bump
Reply
#3

bump again
Reply
#4

No one knows wtf is #emit except ******, Slice, Zeex, Ryder, Nero3D and maybe a few other people. Ask them or HERE.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)