1999-09-14 08:45:02 -04:00
|
|
|
/* Copyright (c) 1993-1999 by Richard Kelsey and Jonathan Rees.
|
|
|
|
See file COPYING. */
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2003-05-01 06:21:33 -04:00
|
|
|
/* I bumped this up from 1.5 Mcell because the debugging info put us over
|
|
|
|
** the top. -Olin
|
|
|
|
*/
|
1999-09-14 08:45:02 -04:00
|
|
|
#if !defined(DEFAULT_HEAP_SIZE)
|
2003-05-01 06:21:33 -04:00
|
|
|
/* 5 megacell = 20 megabytes (10 meg per semispace) */
|
|
|
|
#define DEFAULT_HEAP_SIZE 5000000L
|
1999-09-14 08:45:02 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(DEFAULT_STACK_SIZE)
|
|
|
|
/* 2500 cells = 10000 bytes */
|
|
|
|
#define DEFAULT_STACK_SIZE 2500L
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(STATIC_AREAS)
|
|
|
|
#define DEFAULT_IMAGE_NAME NULL
|
|
|
|
#else
|
|
|
|
|
|
|
|
/* DEFAULT_IMAGE_NAME should be defined using the -D switch to cc. */
|
|
|
|
#if !defined(DEFAULT_IMAGE_NAME)
|
|
|
|
#define DEFAULT_IMAGE_NAME "scheme48.image"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* STATIC_AREAS */
|
|
|
|
|
|
|
|
|
2003-05-01 06:21:33 -04:00
|
|
|
|
|
|
|
char ** process_args(char **argv,
|
2004-01-27 08:39:34 -05:00
|
|
|
char* prog_name,
|
2003-05-01 06:21:33 -04:00
|
|
|
long *heap_size,
|
|
|
|
long *stack_size,
|
|
|
|
char **object_file,
|
|
|
|
char **image_name);
|
|
|
|
|
|
|
|
extern int
|
|
|
|
internal_s48_main(long heap_size, long stack_size,
|
|
|
|
char* prog_name, char* object_file, char* image_name,
|
|
|
|
int argc, char** argv);
|
1999-09-14 08:45:02 -04:00
|
|
|
|
|
|
|
int
|
|
|
|
main(argc, argv)
|
|
|
|
int argc; char **argv;
|
|
|
|
{
|
2003-05-01 06:21:33 -04:00
|
|
|
char **argp; /* JMG */
|
1999-09-14 08:45:02 -04:00
|
|
|
char *image_name = DEFAULT_IMAGE_NAME;
|
|
|
|
long heap_size = DEFAULT_HEAP_SIZE; /* in numbers of cells */
|
|
|
|
long stack_size = DEFAULT_STACK_SIZE; /* in numbers of cells */
|
2003-05-01 06:21:33 -04:00
|
|
|
char *object_file = NULL; /* specified via a command line argument */
|
|
|
|
char *prog_name;
|
1999-09-14 08:45:02 -04:00
|
|
|
|
|
|
|
#if defined(STATIC_AREAS)
|
|
|
|
extern long static_entry;
|
|
|
|
extern long static_symbol_table;
|
|
|
|
extern long static_imported_binding_table, static_exported_binding_table;
|
|
|
|
extern long p_count, *p_areas[], p_sizes[];
|
|
|
|
extern long i_count, *i_areas[], i_sizes[];
|
|
|
|
#endif
|
|
|
|
|
|
|
|
long vm_argc = 0;
|
|
|
|
char *me = *argv; /* Save program name. */
|
2003-05-01 06:21:33 -04:00
|
|
|
prog_name = *argv++;
|
1999-09-14 08:45:02 -04:00
|
|
|
|
2004-01-27 08:39:34 -05:00
|
|
|
argv=process_args(argv, prog_name,
|
2003-05-01 06:21:33 -04:00
|
|
|
&heap_size, &stack_size,
|
|
|
|
&object_file, &image_name);
|
|
|
|
for(argc=0, argp=argv; *argp; argc++, argp++); /* Recompute argc. */
|
|
|
|
return internal_s48_main(heap_size, stack_size, prog_name, object_file, image_name, argc, argv);
|
1999-09-14 08:45:02 -04:00
|
|
|
}
|