version 1.41, 1996/09/30 13:16:12
|
version 1.42, 1996/10/02 09:48:58
|
Line 39
|
Line 39
|
jmp_buf throw_jmp_buf; |
jmp_buf throw_jmp_buf; |
#endif |
#endif |
|
|
|
#ifndef FUZZ |
|
# define FUZZ 0x4000 |
|
#endif |
|
|
#ifndef DEFAULTPATH |
#ifndef DEFAULTPATH |
# define DEFAULTPATH "/usr/local/lib/gforth:." |
# define DEFAULTPATH "/usr/local/lib/gforth:." |
#endif |
#endif |
Line 220 Address loader(FILE *imagefile, char* fi
|
Line 224 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)/*+sizeof(Float)*/); |
image=malloc((wholesize>imagesize?wholesize:imagesize) |
|
#ifndef __unix__ |
|
+FUZZ |
|
#endif |
|
); |
/*image = maxaligned(image);*/ |
/*image = maxaligned(image);*/ |
memset(image,0,wholesize); /* why? - anton */ |
/* memset(image,0,wholesize); */ |
|
|
|
#ifndef __unix__ |
|
if(header.base==0) image += FUZZ/2; |
|
else if((UCell)(header.base - (Cell)image + preamblesize) < FUZZ) |
|
image = header.base - preamblesize; |
|
#endif |
rewind(imagefile); /* fseek(imagefile,0L,SEEK_SET); */ |
rewind(imagefile); /* fseek(imagefile,0L,SEEK_SET); */ |
fread(image,1,imagesize,imagefile); |
fread(image,1,imagesize,imagefile); |
fclose(imagefile); |
fclose(imagefile); |
Line 312 int convsize(char *s, int elemsize)
|
Line 326 int convsize(char *s, int elemsize)
|
|
|
int main(int argc, char **argv, char **env) |
int main(int argc, char **argv, char **env) |
{ |
{ |
char *path, *path1; |
char *path, *path1, *p; |
char *imagename="gforth.fi"; |
char *imagename="gforth.fi"; |
FILE *image_file; |
FILE *image_file; |
int c, retvalue; |
int c, retvalue; |
|
#ifdef __unix__ |
|
char pathsep=':'; |
|
#else |
|
char pathsep=';'; |
|
#endif |
|
|
#if defined(i386) && defined(ALIGNMENT_CHECK) && !defined(DIRECT_THREADED) |
#if defined(i386) && defined(ALIGNMENT_CHECK) && !defined(DIRECT_THREADED) |
/* turn on alignment checks on the 486. |
/* turn on alignment checks on the 486. |
Line 367 int main(int argc, char **argv, char **e
|
Line 386 int main(int argc, char **argv, char **e
|
if(strchr(imagename, '/')==NULL) |
if(strchr(imagename, '/')==NULL) |
{ |
{ |
do { |
do { |
char *pend=strchr(path, ':'); |
char *pend=strchr(path, pathsep); |
if (pend==NULL) |
if (pend==NULL) |
pend=path+strlen(path); |
pend=path+strlen(path); |
if (strlen(path)==0) { |
if (strlen(path)==0) { |
Line 384 int main(int argc, char **argv, char **e
|
Line 403 int main(int argc, char **argv, char **e
|
strcpy(fullfilename+dirlen,imagename); |
strcpy(fullfilename+dirlen,imagename); |
image_file=fopen(fullfilename,"rb"); |
image_file=fopen(fullfilename,"rb"); |
} |
} |
path=pend+(*pend==':'); |
path=pend+(*pend==pathsep); |
} while (image_file==NULL); |
} while (image_file==NULL); |
} |
} |
else |
else |
Line 400 int main(int argc, char **argv, char **e
|
Line 419 int main(int argc, char **argv, char **e
|
Cell environ[]= { |
Cell environ[]= { |
(Cell)argc-(optind-1), |
(Cell)argc-(optind-1), |
(Cell)(argv+(optind-1)), |
(Cell)(argv+(optind-1)), |
|
(Cell)strlen(path1), |
(Cell)path1}; |
(Cell)path1}; |
argv[optind-1] = progname; |
argv[optind-1] = progname; |
/* |
/* |
for (i=0; i<environ[0]; i++) |
for (i=0; i<environ[0]; i++) |
printf("%s\n", ((char **)(environ[1]))[i]); |
printf("%s\n", ((char **)(environ[1]))[i]); |
*/ |
*/ |
retvalue=go_forth(loader(image_file, imagename),3,environ); |
/* make path OS-independent by replacing path separators with NUL */ |
|
for (p=path1; *p!='\0'; p++) |
|
if (*p==pathsep) |
|
*p='\0'; |
|
retvalue=go_forth(loader(image_file, imagename),4,environ); |
deprep_terminal(); |
deprep_terminal(); |
exit(retvalue); |
exit(retvalue); |
} |
} |