Created
August 23, 2012 16:20
-
-
Save masak/3438222 to your computer and use it in GitHub Desktop.
macros use case by FROGGS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have to do basically hundrets of times stuff like that: | |
our sub get_ticks( ) | |
returns Int | |
is native('libSDL') | |
is symbol('SDL_GetTicks') | |
{ * } | |
...to make bindings to the libSDL C-library. (And other similar libs) | |
And the macro I could use would look like this I believe and hope: | |
macro _call( $method, $params, $returns, $symbol ) { | |
quasi { | |
our sub {{{$method}}}( {{{$params}}} ) | |
returns {{{$returns}}} | |
is native('libSDL') | |
is symbol("'{{{$symbol}}}'") | |
{ * } | |
}; | |
} | |
_call( 'get_ticks', '', 'Int', 'SDL_GetTicks' ); | |
_call( 'init', '$flags', 'Int', 'SDL_Init' ); | |
Would be cool to actualy test that... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment