On Thu, 2004-02-19 at 17:54, Jens Rieks wrote: > > > One downside of making sdl.imc smarter (changing it from sdl.pasm) is > > > that we can no longer use build_tools/build_nativecall.pl as is. That > > > may be an argument for making the tool smarter. > > > > Why?
> Sorry if its a stupid question, but what has build_tools/build_nativecall.pl > todo with sdl.pasm? I have to admin that I only have touched the NCI stuff > cursorily. Oops, I meant util/ncidef2pasm.pl. The easiest way to build up a set of NCI calls is to write a declarations file and process it with util/ncidef2pasm.pl. The original SDL declarations file was: [package] SDL [lib] libSDL.so [defs] # from SDL.h i SDL_Init i p SDL_SetVideoMode iiil v SDL_Quit i SDL_FillRect ppl v SDL_UpdateRect piiii Run that through the tool and it spits out several lines of pasm. It's not hard to write that code by hand, but it's a little tedious. Of course, with various patches and plans, I've been updating it by hand. Maybe it's worth updating to spit out PIR. Maybe not. I've attached a patch that makes it a little bit smarter about register saving though. -- c
Index: util/ncidef2pasm.pl =================================================================== RCS file: /cvs/public/parrot/util/ncidef2pasm.pl,v retrieving revision 1.1 diff -u -u -r1.1 ncidef2pasm.pl --- util/ncidef2pasm.pl 23 Sep 2003 14:42:18 -0000 1.1 +++ util/ncidef2pasm.pl 20 Feb 2004 03:44:31 -0000 @@ -152,8 +152,8 @@ open INPUT, "<$from_file" or die "Can't open up $from_file, error $!"; open OUTPUT, ">$to_file" or die "Can't open up $to_file, error $!"; -# To start, save all the registers, just in case -print OUTPUT "saveall\n"; +# To start, save the two registers we use, just in case +print OUTPUT "save P1\nsave P2\n"; my @libs; @@ -187,7 +187,7 @@ } # Put the registers back and end -print OUTPUT "restoreall\n"; +print OUTPUT "restore P1\nrestore P2\n"; print OUTPUT "end\n"; close OUTPUT;