Create a gist now

Instantly share code, notes, and snippets.

macros use case by FROGGS
I have to do basically hundrets of times stuff like that:
our sub get_ticks( )
returns Int
is native('libSDL')
is symbol('SDL_GetTicks')
{ * } 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