Merge branch 'master' of git://factorcode.org/git/factor

db4
Slava Pestov 2008-06-30 19:24:34 -05:00
commit cd4fca852d
3 changed files with 31 additions and 13 deletions

View File

@ -1,13 +1,13 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
IN: bootstrap.image.download
USING: http.client checksums checksums.openssl splitting assocs
kernel io.files bootstrap.image sequences io ;
kernel io.files bootstrap.image sequences io urls ;
IN: bootstrap.image.download
: url "http://factorcode.org/images/latest/" ;
: url URL" http://factorcode.org/images/latest/" ;
: download-checksums ( -- alist )
url "checksums.txt" append http-get nip
url "checksums.txt" >url derive-url http-get nip
string-lines [ " " split1 ] { } map>assoc ;
: need-new-image? ( image -- ? )
@ -21,7 +21,10 @@ kernel io.files bootstrap.image sequences io ;
: download-image ( arch -- )
boot-image-name dup need-new-image? [
"Downloading " write dup write "..." print
url prepend download
url over >url derive-url download
need-new-image? [
"Boot image corrupt, or checksums.txt on server out of date" throw
] when
] [
"Boot image up to date" print
drop

View File

@ -1,6 +1,6 @@
USING: kernel parser math quotations namespaces sequences namespaces.lib
inference.transforms ;
inference.transforms fry ;
IN: rewrite-closures
@ -19,15 +19,17 @@ IN: rewrite-closures
: parametric-quot ( parameters quot -- quot ) '[ , set-parameters , call ] ;
: scoped-quot ( quot -- quot ) [ with-scope ] curry ;
! : closed-quot ( quot -- quot )
! [ namestack >r [ namestack ] set-namestack [ ] call r> set-namestack ] make* ;
: closed-quot ( quot -- quot )
[ namestack >r [ namestack ] set-namestack [ ] call r> set-namestack ] make* ;
namestack swap '[ namestack [ , set-namestack @ ] dip set-namestack ] ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: lambda ( parameters quot -- ) parametric-quot scoped-quot closed-quot ;
: lambda ( parameters quot -- quot ) parametric-quot scoped-quot closed-quot ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

View File

@ -28,8 +28,14 @@ INLINE void load_data_heap(FILE *file, F_HEADER *h, F_PARAMETERS *p)
F_ZONE *tenured = &data_heap->generations[TENURED];
if(fread((void*)tenured->start,h->data_size,1,file) != 1)
long int bytes_read = fread((void*)tenured->start,1,h->data_size,file);
if(bytes_read != h->data_size)
{
fprintf(stderr,"truncated image: %ld bytes read, %ld bytes expected\n",
bytes_read,h->data_size);
fatal_error("load_data_heap failed",0);
}
tenured->here = tenured->start + h->data_size;
data_relocation_base = h->data_relocation_base;
@ -44,9 +50,16 @@ INLINE void load_code_heap(FILE *file, F_HEADER *h, F_PARAMETERS *p)
init_code_heap(p->code_size);
if(h->code_size != 0
&& fread(first_block(&code_heap),h->code_size,1,file) != 1)
fatal_error("load_code_heap failed",0);
if(h->code_size != 0)
{
long int bytes_read = fread(first_block(&code_heap),1,h->code_size,file);
if(bytes_read != h->code_size)
{
fprintf(stderr,"truncated image: %ld bytes read, %ld bytes expected\n",
bytes_read,h->code_size);
fatal_error("load_code_heap failed",0);
}
}
code_relocation_base = h->code_relocation_base;
build_free_list(&code_heap,h->code_size);