build: Don't include <config.h> in native programs when cross-compiling.
[bpt/guile.git] / libguile / private-gc.h
1 /*
2 * private-gc.h - private declarations for garbage collection.
3 *
4 * Copyright (C) 2002, 03, 04, 05, 06, 07, 08, 09 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either version 3 of
9 * the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 */
21
22 #ifndef SCM_PRIVATE_GC
23 #define SCM_PRIVATE_GC
24
25 #include "_scm.h"
26
27 /* {heap tuning parameters}
28 *
29 * These are parameters for controlling memory allocation. The heap
30 * is the area out of which scm_cons, and object headers are allocated.
31 *
32 * Each heap cell is 8 bytes on a 32 bit machine and 16 bytes on a
33 * 64 bit machine. The units of the _SIZE parameters are bytes.
34 * Cons pairs and object headers occupy one heap cell.
35 */
36
37
38 #define SCM_DEFAULT_INIT_HEAP_SIZE_2 32*1024
39
40 #define SCM_DOUBLECELL_ALIGNED_P(x) (((2 * sizeof (scm_t_cell) - 1) & SCM_UNPACK (x)) == 0)
41
42
43 SCM_INTERNAL int scm_getenv_int (const char *var, int def);
44
45
46 typedef enum { return_on_error, abort_on_error } policy_on_error;
47
48
49 #define SCM_MAX(A, B) ((A) > (B) ? (A) : (B))
50 #define SCM_MIN(A, B) ((A) < (B) ? (A) : (B))
51
52 /* CELL_P checks a random word whether it has the right form for a
53 pointer to a cell. Use scm_i_find_heap_segment_containing_object
54 to find out whether it actually points to a real cell.
55
56 The right form for a cell pointer is this: the low three bits must
57 be scm_tc3_cons, and when the scm_tc3_cons tag is stripped, the
58 resulting pointer must be correctly aligned.
59 scm_i_initialize_heap_segment_data guarantees that the test below
60 works.
61 */
62 #define CELL_P(x) ((SCM_UNPACK(x) & (sizeof(scm_t_cell)-1)) == scm_tc3_cons)
63
64 SCM_INTERNAL char const *scm_i_tag_name (scm_t_bits tag); /* MOVEME */
65
66 #endif