?ELSEIF

Previous topic - Next topic

Crivens

Ok so you can use ?IFDEF to define functions specifically for a device. Most of the time I use this for iOS plugins like the following:-
Code (glbasic) Select
?IFDEF IPHONE

IMPORT "C" const char* DeviceName()
IMPORT "C" void EnableAutoLock(int value)

?ELSE

FUNCTION DeviceName%:
ENDFUNCTION
FUNCTION EnableAutoLock%: value%
ENDFUNCTION

?ENDIF

Ok that's fine. So if it's IPHONE it will do proper C calls, and otherwise it will do standard functions that return nothing (because the iOS functions don't relate to anything non-iOS).

But what happens if you have say code to do the same functionality for a different device? Ok you could use ?IFDEF again for each device, but the ?ELSE is gone out of the window surely (defined twice for the iPhone basically because is an ?ELSE on the other device)?

Ideally ?ELSEIF would be perfect (unless you handle all devices manually with ?IFDEF).

So let's say you had the code for the above function for IPHONE, WEBOS, and ANDROID (but NOTHING else), you would then have something like this:-
Code (glbasic) Select
?IFDEF IPHONE

IMPORT "C" const char* DeviceName()
IMPORT "C" void EnableAutoLock(int value)

?ELSEIF WEBOS

Blah blah WEBOS specific code

?ELSEIF ANDROID

Blah blah ANDROID specific code

?ELSE

FUNCTION DeviceName%:
ENDFUNCTION
FUNCTION EnableAutoLock%: value%
ENDFUNCTION

?ENDIF

Good idea no? Unless I've missed something and someone can point me in the correct direction.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

MrTAToad

Yes, ?ELSEIF would be useful

Kitty Hello

added to the list. You know, that 105 MB .txt file called "todo.txt" ;)

No, really, this has good chances to get implemented, for I also really hate the typing work it causes me currently.

Kitty Hello

OK, inserted to V11.