1 /* 2 * Copyright 2011 Steven Watanabe 3 * 4 * This file is part of Jam - see jam.c for Copyright information. 5 */ 6 7 /* 8 * object.h - object manipulation routines 9 */ 10 11 #ifndef BOOST_JAM_OBJECT_H 12 #define BOOST_JAM_OBJECT_H 13 14 #include "config.h" 15 16 typedef struct _object OBJECT; 17 18 OBJECT * object_new( char const * const ); 19 OBJECT * object_new_range( char const * const, int const size ); 20 void object_done( void ); 21 22 #if defined(NDEBUG) && !defined(BJAM_NO_MEM_CACHE) 23 24 struct hash_header 25 { 26 unsigned int hash; 27 struct hash_item * next; 28 }; 29 30 #define object_str( obj ) ((char const *)(obj)) 31 #define object_copy( obj ) (obj) 32 #define object_free( obj ) ((void)0) 33 #define object_equal( lhs, rhs ) ((lhs) == (rhs)) 34 #define object_hash( obj ) (((struct hash_header *)((char *)(obj) - sizeof(struct hash_header)))->hash) 35 36 #else 37 38 char const * object_str ( OBJECT * ); 39 OBJECT * object_copy ( OBJECT * ); 40 void object_free ( OBJECT * ); 41 int object_equal( OBJECT *, OBJECT * ); 42 unsigned int object_hash ( OBJECT * ); 43 44 #endif 45 46 #endif 47