]> gitweb.factorcode.org Git - factor.git/commitdiff
numbers-game has MAIN:, image loading cleanup
authorslava <slava@factorcode.org>
Thu, 9 Nov 2006 03:13:33 +0000 (03:13 +0000)
committerslava <slava@factorcode.org>
Thu, 9 Nov 2006 03:13:33 +0000 (03:13 +0000)
TODO.FACTOR.txt
examples/numbers-game.factor
library/compiler/test/callbacks.factor
vm/image.c

index 86519d6f0400add1fee47bc439ab110c6af8b600..60d9108db607e3a852a8682f54ada31c6e875a04 100644 (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:
 
index 4fea6933bcf5b01f9e2202df6f53a114e0edd3e6..d9c765c0cb59f606dd6a3bdb370a14c2e6143dbe 100644 (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 ;
index cda0f4fc6bb673f3a468d6c1b66957a5371a3dd3..5b8e7d1ffeb1fb0deabeeb5eb6347822de7ec252 100644 (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
 
index 00b0deb100e0072d12b1c6e1af4d0be6abbf57d1..9f11db286119015a7b52b2ac00a1aea6472fc142 100644 (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;