--- gforth/Attic/main.c 1996/09/23 20:42:00 1.39 +++ gforth/Attic/main.c 1996/09/24 19:15:04 1.40 @@ -39,6 +39,10 @@ jmp_buf throw_jmp_buf; #endif +#ifndef FUZZ +# define FUZZ 0x4000 +#endif + #ifndef DEFAULTPATH # define DEFAULTPATH "/usr/local/lib/gforth:." #endif @@ -165,6 +169,7 @@ Address loader(FILE *imagefile, char* fi Cell preamblesize=0; Label *symbols=engine(0,0,0,0,0); UCell check_sum=checksum(symbols); + Cell fuzz=FUZZ; /* 16 k fuzz to move fixed size images around */ static char* endianstring[]= { "big","little" }; @@ -220,9 +225,14 @@ Address loader(FILE *imagefile, char* fi wholesize = preamblesize+dictsize+dsize+rsize+fsize+lsize; imagesize = preamblesize+header.image_size+((header.image_size-1)/sizeof(Cell))/8+1; - image=malloc((wholesize>imagesize?wholesize:imagesize)/*+sizeof(Float)*/); + image=malloc((wholesize>imagesize?wholesize:imagesize)+fuzz); /*image = maxaligned(image);*/ - memset(image,0,wholesize); /* why? - anton */ +/* memset(image,0,wholesize); */ /* why? - anton */ + + if(header.base==0) image += fuzz/2; + else if((UCell)(header.base - (Cell)image + preamblesize) < fuzz) + image = header.base - preamblesize; + rewind(imagefile); /* fseek(imagefile,0L,SEEK_SET); */ fread(image,1,imagesize,imagefile); fclose(imagefile);