File: saveimg.h

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 (63 lines) | stat: -rw-r--r-- 1,692 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
53
54
55
56
57
58
59
60
61
62
63
/*-----------------------------------------------------------------*-C-*---
 * File:    handc/heapi/saveimg.h
 *
 *          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.5
 * File mod date:    1997.12.18 22:16:14
 * System build:     v0.7.2, 97.12.21
 *
 * Purpose:          Definitions for heap image saving (traversal/output interface)
 *------------------------------------------------------------------------*/

#ifndef _H_HEAPI_SAVEIMG
#define _H_HEAPI_SAVEIMG

#include <stdio.h>
#include "saveq.h"
#include <rscheme/imagfile.h>

#define TEMPLATE_CODE_PTR	SLOT(0)
#define TEMPLATE_LINKAGE	SLOT(1)

#define SYMBOL_STR		SLOT(0)

#define PART_DESCR_PART_TAG	SLOT(1)
#define PART_DESCR_MODULE_NAME	SLOT(0)

#define NUM_CLASS_MODES (9)

struct writer_info {
  void            (*queue_writer)( SaveQueue *q );
  enum load2_mode mode2;
};

extern struct writer_info hi_writers[NUM_CLASS_MODES];

void hi_init_output( FILE *f, obj refs_vec, obj ref_names, obj root,
		     SaveQueue *used_refs, UINT_32 n_objects );
void hi_output_refs( SaveQueue *q );
void hi_done_output( void );
void hi_output_mode2( enum load2_mode mode2,
		      SaveQueue **queues, unsigned num_queues );

/*    Find out if the given PTR is to be replaced by some other PTR
 */

static _rs_inline obj replace_ptr( obj thing )
{
  obj c;
  assert( OBJ_ISA_PTR(thing) );

  c = PTR_TO_HDRPTR(thing)->pob_class;

  if (OBJ_ISA_IMMOB(c))
    {
      return OBJ(VAL(c) - IMMOB_TAG + POINTER_TAG);
    }
  return thing;
}

#endif /* _H_HEAPI_SAVEIMG */