version 1.47, 1996/12/14 14:21:20
|
version 1.48, 1996/12/23 15:07:45
|
Line 60 static Cell dsize=0;
|
Line 60 static Cell dsize=0;
|
static Cell rsize=0; |
static Cell rsize=0; |
static Cell fsize=0; |
static Cell fsize=0; |
static Cell lsize=0; |
static Cell lsize=0; |
|
static int image_offset=0; |
char *progname; |
char *progname; |
|
|
/* image file format: |
/* image file format: |
Line 224 Address loader(FILE *imagefile, char* fi
|
Line 225 Address loader(FILE *imagefile, char* fi
|
|
|
wholesize = preamblesize+dictsize+dsize+rsize+fsize+lsize; |
wholesize = preamblesize+dictsize+dsize+rsize+fsize+lsize; |
imagesize = preamblesize+header.image_size+((header.image_size-1)/sizeof(Cell))/8+1; |
imagesize = preamblesize+header.image_size+((header.image_size-1)/sizeof(Cell))/8+1; |
image=malloc((wholesize>imagesize?wholesize:imagesize) |
image=malloc(((wholesize>imagesize?wholesize:imagesize)+image_offset) |
#ifdef FUZZ |
#ifdef FUZZ |
+FUZZ |
+FUZZ |
#endif |
#endif |
); |
)+image_offset; |
/*image = maxaligned(image);*/ |
/*image = maxaligned(image);*/ |
/* memset(image,0,wholesize); */ |
/* memset(image,0,wholesize); */ |
|
|
Line 244 Address loader(FILE *imagefile, char* fi
|
Line 245 Address loader(FILE *imagefile, char* fi
|
|
|
if(header.base==0) { |
if(header.base==0) { |
relocate((Cell *)imp,imp+header.image_size,header.image_size,symbols); |
relocate((Cell *)imp,imp+header.image_size,header.image_size,symbols); |
((ImageHeader *)imp)->checksum=check_sum; |
#if 0 |
|
{ /* let's see what the relocator did */ |
|
FILE *snapshot=fopen("snapshot.fi","wb"); |
|
fwrite(image,1,imagesize,snapshot); |
|
fclose(snapshot); |
|
} |
|
#endif |
} |
} |
else if(header.base!=imp) { |
else if(header.base!=imp) { |
fprintf(stderr,"%s: Cannot load nonrelocatable image (compiled for address $%lx) at address $%lx\nThe Gforth installer should look into the INSTALL file\n", |
fprintf(stderr,"%s: Cannot load nonrelocatable image (compiled for address $%lx) at address $%lx\nThe Gforth installer should look into the INSTALL file\n", |
progname, (unsigned long)header.base, (unsigned long)imp); |
progname, (unsigned long)header.base, (unsigned long)imp); |
exit(1); |
exit(1); |
} else if (header.checksum != check_sum) { |
} |
|
if (header.checksum==0) |
|
((ImageHeader *)imp)->checksum=check_sum; |
|
else if (header.checksum != check_sum) { |
fprintf(stderr,"%s: Checksum of image ($%lx) does not match the executable ($%lx)\nThe Gforth installer should look into the INSTALL file\n", |
fprintf(stderr,"%s: Checksum of image ($%lx) does not match the executable ($%lx)\nThe Gforth installer should look into the INSTALL file\n", |
progname, (unsigned long)(header.checksum),(unsigned long)check_sum); |
progname, (unsigned long)(header.checksum),(unsigned long)check_sum); |
exit(1); |
exit(1); |
Line 357 int main(int argc, char **argv, char **e
|
Line 367 int main(int argc, char **argv, char **e
|
{"path", required_argument, NULL, 'p'}, |
{"path", required_argument, NULL, 'p'}, |
{"version", no_argument, NULL, 'v'}, |
{"version", no_argument, NULL, 'v'}, |
{"help", no_argument, NULL, 'h'}, |
{"help", no_argument, NULL, 'h'}, |
|
/* put something != 0 into image_offset; it should be a |
|
not-too-large max-aligned number */ |
|
{"offset-image", no_argument, &image_offset, 28*sizeof(Cell)}, |
{0,0,0,0} |
{0,0,0,0} |
/* no-init-file, no-rc? */ |
/* no-init-file, no-rc? */ |
}; |
}; |
Line 387 Engine Options:\n\
|
Line 400 Engine Options:\n\
|
-i FILE, --image-file=FILE Use image FILE instead of `gforth.fi'\n\ |
-i FILE, --image-file=FILE Use image FILE instead of `gforth.fi'\n\ |
-l SIZE, --locals-stack-size=SIZE Specify locals stack size\n\ |
-l SIZE, --locals-stack-size=SIZE Specify locals stack size\n\ |
-m SIZE, --dictionary-size=SIZE Specify Forth dictionary size\n\ |
-m SIZE, --dictionary-size=SIZE Specify Forth dictionary size\n\ |
|
--offset-image load image at a different position\n\ |
-p PATH, --path=PATH Search path for finding image and sources\n\ |
-p PATH, --path=PATH Search path for finding image and sources\n\ |
-r SIZE, --return-stack-size=SIZE Specify return stack size\n\ |
-r SIZE, --return-stack-size=SIZE Specify return stack size\n\ |
-v, --version Print version and exit\n\ |
-v, --version Print version and exit\n\ |