Skip to content

Instantly share code, notes, and snippets.

@noidi
Last active September 10, 2016 10:48
Show Gist options
  • Save noidi/ad21ec027d83250ef3a5c2f1c187facf to your computer and use it in GitHub Desktop.
Save noidi/ad21ec027d83250ef3a5c2f1c187facf to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <SDL2/SDL.h>
#include <gtmxc_types.h>
void m_SDL_Init(int c, gtm_ulong_t flags, gtm_long_t* result) {
printf("Calling SDL_Init with 0x%lx... ", flags);
*result = SDL_Init(flags);
printf("Done!\n");
fflush(stdout);
}
$PWD/m_sdl.so
init: void m_SDL_Init(I:gtm_ulong_t, O:gtm_long_t*)
file 'm_sdl.so' => 'm_sdl.c' do
sh 'gcc -shared -fpic -o m_sdl.so -Wall -Werror -std=gnu99 m_sdl.c -I/opt/gtm -O3 $(sdl2-config --cflags --libs)'
end
file 'trumps.o' => 'trumps.m' do
sh 'mumps trumps.m'
end
task :run => ['trumps.o', 'm_sdl.so'] do
sh 'env GTMXC_sdl=m_sdl.xc mumps -run trumps'
end
task :clean do
sh 'rm -rf *.o *.so'
end
task :default => :run
sdl
InitVideo() quit 32
init(flags)
do &sdl.init(flags,.result)
quit result
write $$init^sdl($$InitVideo^sdl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment