File: loadboot.c

package info (click to toggle)
rscheme 0.7.2-1.1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 10,672 kB
  • ctags: 12,430
  • sloc: lisp: 37,104; ansic: 29,763; cpp: 2,630; sh: 1,677; makefile: 568; yacc: 202; lex: 175; perl: 33
file content (52 lines) | stat: -rw-r--r-- 1,508 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*-----------------------------------------------------------------*-C-*---
 * File:    handc/loadboot/loadboot.c
 *
 *          Copyright (C)1997 Donovan Kolbly <d.kolbly@rscheme.org>
 *          as part of the RScheme project, licensed for free use.
 *          See <http://www.rscheme.org/> for the latest information.
 *
 * File version:     1.7
 * File mod date:    1997.11.29 23:10:43
 * System build:     v0.7.2, 97.12.21
 *
 * Purpose:          load the boot image
 *------------------------------------------------------------------------*
 * Notes:
 *      the function here is designed to be replaced by alternate
 *      boot image loaders, like FASL
 *------------------------------------------------------------------------*/

#include <rscheme/smemory.h>
#include <rscheme/scheme.h>
#include <rscheme/heapi.h>

obj load_initial_heap( const char *path, obj *pre_args, rs_bool verbose )
{
char *gc_argv[3];
int vers;
obj r;

  gc_argv[0] = "rs";
  gc_argv[1] = verbose ? (char *)NULL : "-q";
  gc_argv[2] = NULL;
  init_gc( verbose ? 1 : 2, (const char **)gc_argv );
  
  /* make room for it... */
  
  gc_safe_point( 1024*1024 );
  r = load_image_file( path, FALSE_OBJ, FALSE_OBJ, &vers );

  if (EQ(r,FALSE_OBJ))
    return FALSE_OBJ;

  switch (vers)
    {
    case FMTV_RSCHEME_0_5:  /* assume it's bootable */
    case FMTV_RSCHEME_0_6_BOOT:
      return r;
    default:
      fprintf( stderr, "%s: image version %d -- not bootable\n",
	       path, vers );
      return FALSE_OBJ;
    }
}