Exemplo n.º 1
0
int main(int argc, char *argv[])
{
    stack_bottom = malloc(default_stack_size);
    memset(stack_bottom, 0xcc, default_stack_size);
    gc_initialize(default_heap_size);

    rtldDefault = dlopen(0, RTLD_NOW | RTLD_GLOBAL);

    print(call_scheme());

    printf("\n");
    return 0;
}
Exemplo n.º 2
0
int main(int argc, char *argv[])
{
    stack_bottom = malloc(DEFAULT_STACK_SIZE);
    memset(stack_bottom, 0xcc, DEFAULT_STACK_SIZE);

#ifdef HEAP_SIZE
    unsigned int heap_size = HEAP_SIZE;
#else
    unsigned int heap_size = DEFAULT_HEAP_SIZE;
#endif
    gc_initialize(heap_size);

    rtldDefault = dlopen(0, RTLD_NOW | RTLD_GLOBAL);

    print(call_scheme());

    printf("\n");
    return 0;
}
Exemplo n.º 3
0
void lgh_startup( int packages )
{
  obj start, args, rc;
  const char *system_file = NULL;
  int i = 1;
  rs_bool verbose = YES;
  rs_bool is_script = NO;
  const char *(argv[2]);

  argv[0] = "rs";
  argv[1] = NULL;

  init_dynamic_link( argv[0] ); /* some systems need this */

  start = init_scheme( 1, argv, "sys.img", NO, std_modules );
  if (EQ(start,FALSE_OBJ))
    {
      fprintf( stderr, "initialization from sys.img failed\n" );
      exit(1);
    }

  rc = call_scheme( start, 3, NIL_OBJ, FALSE_OBJ, FALSE_OBJ );
  eval_proc = rc;
}
Exemplo n.º 4
0
int rscheme_std_main( int argc, const char **argv, 
		      struct module_descr **modules,
		      const char *default_image )
{
  obj start, args, rc;
  const char *system_file = NULL;
  int i = 1;
  rs_bool verbose = YES;
  rs_bool is_script = NO;

  init_dynamic_link( argv[0] ); /* some systems need this */

  for (i=1; i<argc && argv[i][0] == (char)'-'; i++)
    {
      if (strcmp(argv[i],"-image") == 0)
	{
	  if (i+1 >= argc)
	    goto miss_arg;
	  system_file = argv[++i];
	}
      else if (strcmp(argv[i],"--version") == 0)
	{
	  puts( RSCHEME_VERSION );
	  return 0;
	}
      else if (strcmp(argv[i],"--install") == 0)
	{
	  puts( rs_install_dir );
	  return 0;
	}
      else if (strcmp(argv[i],"-qimage") == 0)
	{
	  if (i+1 >= argc)
	    goto miss_arg;
	  system_file = argv[++i];
	  verbose = NO;
	}
      else if (strcmp(argv[i],"-bcitrace") == 0)
	{
	  if (bci_trace_flag >= 0)
	    bci_trace_flag = 1;
	  else
	    goto not_comp;
	}
      else if (strcmp(argv[i],"-stepdump") == 0)
	{
#ifdef STEP_DUMP
	  do_step_dump = 1;
#else
	  goto not_comp;
#endif
	}
      else if (strcmp(argv[i],"-q") == 0)
	{
	  verbose = NO;
	}
      else if (strcmp(argv[i],"-script") == 0)
	{
	  verbose = NO;
	  is_script = YES;
	}
#ifdef RECORD_CALL_CHAIN
      else if (strcmp(argv[i],"-abt") == 0)
	{
	  extern rs_bool do_record_call_chain;

	  do_record_call_chain = YES;
	}
#endif
      else
	break;
    }
  if (!system_file)
    system_file = find_system_image( argv[0], default_image );

  if (!system_file)
    {
      fprintf( stderr, "%s: could not find system image\n", argv[0] );
      return 1;			/* boot failed */
    }

  start = init_scheme( argc, argv, system_file, 
		      verbose,
		      modules );
  if (EQ(start,FALSE_OBJ))
    {
      fprintf( stderr, "%s: initialization from %s failed\n", 
	      argv[0], system_file );
      return 1;
    }

  args = NIL_OBJ;
  while (argc > i)
    args = cons( make_string( argv[--argc] ), args );

  rc = call_scheme( start, 3, 
		    args, 
		    rb_to_bo(verbose),
		    rb_to_bo(is_script) );

  if (truish(rc))
    return 0;
  return 1;

 miss_arg:
  fprintf( stderr, "missing arg to `%s'\n", argv[i] );
  return 2;
 not_comp:
  fprintf( stderr, "system not compiled to support `%s'\n", argv[i] );
  return 2;
}
Exemplo n.º 5
0
void lgh_eval( char *str )
{
  call_scheme( eval_proc, 1, make_string(str) );
}