numbers-game has MAIN:, image loading cleanup

slava 2006-11-09 03:13:33 +00:00
parent f71931cb38
commit 7ee2128ff0
4 changed files with 8 additions and 10 deletions

View File

@ -1,6 +1,5 @@
+ allot refactoring:
- inline float allocation needs a gc check
- docs: don't pass volatile aliens to callbacks
- windows rollover broken again
- intrinsic fixnum>float float>fixnum
@ -15,7 +14,6 @@
- fdasfsdfsa :help -- weird
- %allot-bignum-signed-2 still has issues on ppc
- fix %allot-bignum-signed-1/2 on x86
- see if 0 0 >= is optimized
+ ui:

View File

@ -25,3 +25,5 @@ USING: kernel math parser io ;
: numbers-game number-to-guess numbers-game-loop ;
PROVIDE: examples/numbers-game ;
MAIN: examples/numbers-game numbers-game ;

View File

@ -49,7 +49,7 @@ kernel-internals math memory namespaces test threads ;
[ 1 2 3 ] [ callback-6 callback_test_1 1 2 3 ] unit-test
: callback-7
"void" { } [ yield "hi" print flush yield ] alien-callback ;
"void" { } [ 1000 sleep ] alien-callback ;
[ 1 2 3 ] [ callback-7 callback_test_1 1 2 3 ] unit-test

View File

@ -29,6 +29,7 @@ void load_image(const char* filename)
}
printf("Loading %s...",filename);
fflush(stdout);
/* read it in native byte order */
fread(&h,sizeof(F_HEADER)/sizeof(CELL),sizeof(CELL),file);
@ -38,15 +39,14 @@ void load_image(const char* filename)
if(h.version != IMAGE_VERSION)
fatal_error("Bad version number",h.version);
/* read data heap */
{
CELL size = h.data_size / CELLS;
CELL size = h.data_size;
if(size + tenured.base >= tenured.limit)
fatal_error("Data heap too large",h.code_size);
if(size != fread((void*)tenured.base,sizeof(CELL),size,file))
fatal_error("Wrong data heap length",h.data_size);
fread((void*)tenured.base,size,1,file);
tenured.here = tenured.base + h.data_size;
data_relocation_base = h.data_relocation_base;
@ -58,9 +58,7 @@ void load_image(const char* filename)
if(size + compiling.base > compiling.limit)
fatal_error("Code heap too large",h.code_size);
if(h.version == IMAGE_VERSION
&& size != fread((void*)compiling.base,1,size,file))
fatal_error("Wrong code heap length",h.code_size);
fread((void*)compiling.base,size,1,file);
code_relocation_base = h.code_relocation_base;