static inline mccp_hashentry_t s_find_entry(mccp_hashmap_t hm, void *key) { mccp_hashentry_t ret = NULL; if (hm != NULL) { ret = FindHashEntry(&(hm->m_hashtable), key); } return ret; }
static void resolveTypePrototypes( void ) { /*****************************************/ /* adds required protoypes to the protoype section */ statement *finger; statement *rc; long len; char *name; char *libname; if( !SRU.type_sec ) { return; } finger = SRU.forward_prots; /* loop through the chain of prototypes and add them if necessary */ while( finger ) { name = finger->data.sp.name; len = strlen( name ); /* check in hash table for function name */ if( !FindHashEntry(SRU.type_prots, HashString(name, len), name, len) ) { /* add to prototype section */ rc = insertTypePrototype( finger, SRU.type_sec ); rc->link = SRU.cpp_prots; SRU.cpp_prots = rc; rc->keep = TRUE; InsertHashValue( SRU.type_prots, rc->data.sp.name, strlen( rc->data.sp.name ), rc ); } finger = finger->link; } /* generate constructors and destructor prototypes if necessary */ libname = GetLibName(); len = max( sizeof( DES_DECL_TEMPLATE ) + strlen( SRU.des_name ), sizeof( CONS_DECL_TEMPLATE ) + strlen( SRU.con_name ) ); name = alloca( len + strlen( libname ) + 1 ); if( !( SRU.flags & DESTRUCTOR_DEFINED ) ) { sprintf( name, DES_DECL_TEMPLATE, SRU.des_name, libname ); insertStatement( SRU.type_sec, name ); } if( !( SRU.flags & CONSTRUCTOR_DEFINED ) ) { sprintf( name, CONS_DECL_TEMPLATE, SRU.con_name, libname ); insertStatement( SRU.type_sec, name ); } }
static id_type isTypeKnown( TypeInfo *typ ) { /********************************************/ /* checks hash table to determine if a type is known and if it is, returns it id */ long len; id_type rc; keyword *tmp; assert( typ ); len = strlen( typ->name ); tmp = FindHashEntry( SRU.typ_tab, HashString( typ->name, len ), typ->name, len ); if( tmp ) { rc = tmp->id; if( typ->isref ) { rc |= TY_REF_INDICATOR; } return( rc ); } return( 0 ); }