public
Created

macros use case by FROGGS

  • Download Gist
use-case.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
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...

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.