Macro for detecting single argument, removing prefix
#1

I almost managed to detect 0, 1, or multiple arguments:
pawn Код:
#define Foo(%0) @d:@c:@a:@b:Bar(%0)
#define @c:@a:@b:Bar() No arguments
#define @a:@b:Bar(%0,%1) More than one argument
#define @b:Bar(%0) Single argument

Foo(Hai)
Foo(Hai, Hello)
Foo(Hai, Hello, Dickbutt)
Foo()
pawn Код:
#pragma ctrlchar 0x5c
#pragma pack false
#pragma semicolon true
#pragma tabsize 8
#file test.pwn
#line 5

@d:@c:@a:Single argument
@d:@c:More than one argument
@d:@c:More than one argument
@d:No arguments
Now, I completely have no idea how to remove leftover detector tags, as @d macro is already defined. Is there a clear way to do this? With some second compiler pass dark magic?
Reply
#2

Or you could just use, you know, numargs()? Where are you heading with this?
Reply
#3

Of course, but I'm simply curious.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)