summaryrefslogtreecommitdiff
path: root/tools/build/v2/engine/object.h
blob: 1c123f8b0fdb22d114ac3462d2e40a90b4a47281 (plain)
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
/*
 * Copyright 2011 Steven Watanabe
 *
 * This file is part of Jam - see jam.c for Copyright information.
 */

/*
 * object.h - object manipulation routines
 */

#ifndef BOOST_JAM_OBJECT_H
#define BOOST_JAM_OBJECT_H

typedef struct _object OBJECT;

OBJECT *     object_new   ( const char * );
void         object_done  ( void );

#if defined(NDEBUG) && !defined(BJAM_NO_MEM_CACHE)

struct hash_header
{
    unsigned int hash;
    struct hash_item * next;
};

#define object_str( obj ) ( (const char *)( obj ) )
#define object_copy( obj ) ( obj )
#define object_free( obj ) ( (void)0 )
#define object_equal( lhs, rhs ) ( ( lhs ) == ( rhs ) )
#define object_hash( obj ) ( ((struct hash_header *)( (char *)( obj ) - sizeof(struct hash_header) ))->hash )

#else

const char * object_str   ( OBJECT * );
OBJECT *     object_copy  ( OBJECT *     );
void         object_free  ( OBJECT *     );
int          object_equal ( OBJECT *, OBJECT * );
unsigned int object_hash  ( OBJECT * );

#endif

#endif