library/src/datastructures/BP-HashTable.cc
// There are two real differing types in the hash registry/tables.  The first type
// is a table.  A table can contain either other tables, or data entries.  This routine
// displays data entries, not tables.
There are two real differing types in the hash registry/tables.  The first type
is a table.  A table can contain either other tables, or data entries.  This routine
displays data entries, not tables.
There are two real differing types in the hash registry / tables . The first type is a table . A table can contain either other tables or data entries . This routine displays data entries not tables .
BP_ERROR_T BP_HashRegDisplayDataEntry
(
	P_BP_HASH_TABLE_REGISTRY    hreg,
	P_BP_HASH_TABLE_KEYED_ENTRY data_entry,
	size_t                      display_tab_depth
)
{
	BP_GLOBAL_HASH_TABLE_OVERRIDE(ERR_FAILURE);
	char *tabs = (char *) calloc(display_tab_depth+2, 1);
	if(!tabs)
	{
		if(BP_DEBUG_BREAKPOINT_ON_ALLOC_FAIL)
		{
			asm("int3");
		}
		return ERR_FAILURE;
	}
	memset(tabs, '\t', display_tab_depth+1);
	printf("\n%s data> %p: ", tabs, data_entry);
	printf(" t: ");
	switch(data_entry->type)
	{
		case BP_HASH_TABLE_KEYED_ENTRY_TYPE_UNSET:
			printf("UNSET");
			break;
		case BP_HASH_TABLE_KEYED_ENTRY_TYPE_NAMED_HASH_TABLE:
			printf("NAMED_HASH_TABLE");
			break;
		case BP_HASH_TABLE_KEYED_ENTRY_TYPE_C_DATASTRUCTURE_EXTERNALLY_MANAGED:
			printf("C_DATASTRUCTURE");
			break;
		case BP_HASH_TABLE_KEYED_ENTRY_TYPE_BINARY_BLOB:
			printf("BINARY_BLOB");
			break;
		case BP_HASH_TABLE_KEYED_ENTRY_TYPE_CPP_CLASS_POINTER_EXTERNALLY_MANAGED:
			printf("CPP_CLASS_POINTER");
			break;
		case BP_HASH_TABLE_KEYED_ENTRY_TYPE_UTF8_STRING:
			printf("UTF8_STRING");
			break;
		case BP_HASH_TABLE_KEYED_ENTRY_TYPE_UNICODE16_STRING:
			printf("UNICODE16_STRING");
			break;
		case BP_HASH_TABLE_KEYED_ENTRY_TYPE_UNICODE32_STRING:
			printf("UNICODE32_STRING");
			break;
		case BP_HASH_TABLE_KEYED_ENTRY_TYPE_SIZE_T:
			printf("SIZE_T");
			break;
		case BP_HASH_TABLE_KEYED_ENTRY_TYPE_SIGNED_INT:
			printf("SIGNED_INT");
			break;
		case BP_HASH_TABLE_KEYED_ENTRY_TYPE_UTF8_JSON:
			printf("UTF8_JSON");
			break;
		case BP_HASH_TABLE_KEYED_ENTRY_TYPE_MESSAGE_TO_WORKER:
			printf("MESSAGE_TO_WORKER");
			break;
		case BP_HASH_TABLE_KEYED_ENTRY_TYPE_MESSAGE_FROM_WORKER:
			printf("MESSAGE_FROM_WORKER");
			break;
		case BP_HASH_TABLE_KEYED_ENTRY_TYPE_EVENT_UNPROCESSED:
			printf("EVENT_UNPROCESSED");
			break;
		case BP_HASH_TABLE_KEYED_ENTRY_TYPE_EVENT_PROCESSED:
			printf("EVENT_PROCESSED");
			break;
		default:
			break;
	}
	printf(", id: \"%s\"" , data_entry->key);
	int lock_tmp = 0;
	BP_HASH_TABLE_SEM_IS_LOCKED(data_entry->lock, lock_tmp);
	printf(", lock: %s", lock_tmp ? "UL" : "L");
	printf(" :%i", lock_tmp );
	if(data_entry->parent)
	{
		P_BP_HASH_TABLE_KEYED_ENTRY tmp_parent = (P_BP_HASH_TABLE_KEYED_ENTRY) data_entry->parent;
		printf(" parent: %s", tmp_parent->key);
	}
	else
	{
		printf(" parent: NULL");
	}
	%%%%%%%%%%%%%%%
	%%%%%%%%%%%%%%%
	if(tabs)
		free(tabs);
	return ERR_SUCCESS;
}
BP_ERROR_T BP_HashRegDisplayDataEntry ( P_BP_HASH_TABLE_REGISTRY hreg , P_BP_HASH_TABLE_KEYED_ENTRY data_entry , size_t display_tab_depth ) { BP_GLOBAL_HASH_TABLE_OVERRIDE ( ERR_FAILURE ) ; char * tabs = ( char * ) calloc ( display_tab_depth + 2 , 1 ) ; if ( ! tabs ) { if ( BP_DEBUG_BREAKPOINT_ON_ALLOC_FAIL ) { asm ( " " ) ; } return ERR_FAILURE ; } memset ( tabs , ' \t ' , display_tab_depth + 1 ) ; printf ( " \n " , tabs , data_entry ) ; printf ( " " ) ; switch ( data_entry -> type ) { case BP_HASH_TABLE_KEYED_ENTRY_TYPE_UNSET : printf ( " " ) ; break ; case BP_HASH_TABLE_KEYED_ENTRY_TYPE_NAMED_HASH_TABLE : printf ( " " ) ; break ; case BP_HASH_TABLE_KEYED_ENTRY_TYPE_C_DATASTRUCTURE_EXTERNALLY_MANAGED : printf ( " " ) ; break ; case BP_HASH_TABLE_KEYED_ENTRY_TYPE_BINARY_BLOB : printf ( " " ) ; break ; case BP_HASH_TABLE_KEYED_ENTRY_TYPE_CPP_CLASS_POINTER_EXTERNALLY_MANAGED : printf ( " " ) ; break ; case BP_HASH_TABLE_KEYED_ENTRY_TYPE_UTF8_STRING : printf ( " " ) ; break ; case BP_HASH_TABLE_KEYED_ENTRY_TYPE_UNICODE16_STRING : printf ( " " ) ; break ; case BP_HASH_TABLE_KEYED_ENTRY_TYPE_UNICODE32_STRING : printf ( " " ) ; break ; case BP_HASH_TABLE_KEYED_ENTRY_TYPE_SIZE_T : printf ( " " ) ; break ; case BP_HASH_TABLE_KEYED_ENTRY_TYPE_SIGNED_INT : printf ( " " ) ; break ; case BP_HASH_TABLE_KEYED_ENTRY_TYPE_UTF8_JSON : printf ( " " ) ; break ; case BP_HASH_TABLE_KEYED_ENTRY_TYPE_MESSAGE_TO_WORKER : printf ( " " ) ; break ; case BP_HASH_TABLE_KEYED_ENTRY_TYPE_MESSAGE_FROM_WORKER : printf ( " " ) ; break ; case BP_HASH_TABLE_KEYED_ENTRY_TYPE_EVENT_UNPROCESSED : printf ( " " ) ; break ; case BP_HASH_TABLE_KEYED_ENTRY_TYPE_EVENT_PROCESSED : printf ( " " ) ; break ; default : break ; } printf ( " \" \" " , data_entry -> key ) ; int lock_tmp = 0 ; BP_HASH_TABLE_SEM_IS_LOCKED ( data_entry -> lock , lock_tmp ) ; printf ( " " , lock_tmp ? " " : " " ) ; printf ( " " , lock_tmp ) ; if ( data_entry -> parent ) { P_BP_HASH_TABLE_KEYED_ENTRY tmp_parent = ( P_BP_HASH_TABLE_KEYED_ENTRY ) data_entry -> parent ; printf ( " " , tmp_parent -> key ) ; } else { printf ( " " ) ; } if ( tabs ) free ( tabs ) ; return ERR_SUCCESS ; }
There are two real differing types in the hash registry/tables.
There are two real differing types in the hash registry / tables .
// macro to override hreg on null // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Format Tab Depth Buffer %%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // create space for tabs // add tabs to buffer // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Display Table Line %%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // display initial basic // display type // display text representation of data type // display the id // display lock status // check if things are locked or unlocked // set the parent // create reference to parent so we can access its members // display the parent key and ptr // display the parent key and ptr // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Exit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // destroy tabs if set // return indicating success