Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@masak
Created August 23, 2012 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masak/3438222 to your computer and use it in GitHub Desktop.
Save masak/3438222 to your computer and use it in GitHub Desktop.
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')
{ * }
...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