library/src/utility/BP-StringFormattingSessions.cc
// walks all of the string entries, in all the columns and generates columns for
// each of them.
walks all of the string entries, in all the columns and generates columns for
each of them.
walks all of the string entries in all the columns and generates columns for each of them .
BP_ERROR_T BP_ColumnizeAllStringEntriesSFSession(P_BP_SF_SESSION session)
{
	if(!session)
		return ERR_FAILURE;
	if(!session->tq)
		return ERR_FAILURE;
	size_t row_group_n    = 0;
	size_t row_n          = 0;
	size_t column_group_n = 0;
	size_t column_n       = 0;
	size_t string_entry_n = 0;
	P_BP_SFS_STRING_ENTRY current_entry = NULL;
	BP_DestroyAllStringEntryColumnizedDataSFSession(session);
	P_BP_GENERIC_STRING_COLUMNIZATION * columnizations         = NULL;
	P_BP_GENERIC_STRING_COLUMNIZATION * columnizations_colored = NULL;
	P_BP_GENERIC_STRING_COLUMNIZATION merged_columnizations         = NULL;
	P_BP_GENERIC_STRING_COLUMNIZATION merged_columnizations_colored = NULL;
	P_BP_GENERIC_STRING_COLUMNIZATION borderized_merged_columnizations         = NULL;
	P_BP_GENERIC_STRING_COLUMNIZATION borderized_merged_columnizations_colored = NULL;
	for(row_group_n = 0;    row_group_n    < session->row_group_n; row_group_n++)
	for(row_n = 0;          row_n          < session->row_groups[row_group_n]->row_n; row_n++)
	for(column_group_n = 0; column_group_n < session->row_groups[row_group_n]->rows[row_n]->col_group_n; column_group_n++)
	for(column_n = 0;       column_n       < session->row_groups[row_group_n]->rows[row_n]->col_groups[column_group_n]->columns_n; column_n++)
	for
	(
			string_entry_n = 0;
			string_entry_n < session->row_groups[row_group_n]->rows[row_n]->col_groups[column_group_n]->columns[column_n]->entries;
			string_entry_n++
	)
	{
		current_entry = session->row_groups[row_group_n]->rows[row_n]->col_groups[column_group_n]->columns[column_n]->col_data[string_entry_n];
		if(!current_entry)
			break;
		if(current_entry->marked_display_disabled == BP_TRUE)
			continue;
		if(BP_GenerateOutputStringArrayFromStringEntrySFSession(session, current_entry, BP_TRUE) == ERR_FAILURE)
		{
			printf("\n Failing on: %p", current_entry);
		}
		if(!current_entry->final_columnization)
		{
			printf("\n Failed Generation of Columnization for String Entry (you're probably missing newlines you dummy): %p  - %s  - %u", current_entry, current_entry->string_entry_identifier, current_entry->string_length);
		}
		if(current_entry->final_columnization)
		{
			merged_columnizations = current_entry->final_columnization;
			current_entry->final_columnization = BP_BorderizeStringColumnization(merged_columnizations, &current_entry->border_set);
			BP_DestroyGenericColumnization(merged_columnizations,          BP_TRUE);
		}
		if(current_entry->final_columnization_colorized)
		{
			merged_columnizations_colored = current_entry->final_columnization_colorized;
			current_entry->final_columnization_colorized = BP_BorderizeStringColumnization(merged_columnizations_colored, &current_entry->border_set);
			BP_DestroyGenericColumnization(merged_columnizations_colored,  BP_TRUE);
		}
	}
	return ERR_SUCCESS;
}
BP_ERROR_T BP_ColumnizeAllStringEntriesSFSession ( P_BP_SF_SESSION session ) { if ( ! session ) return ERR_FAILURE ; if ( ! session -> tq ) return ERR_FAILURE ; size_t row_group_n = 0 ; size_t row_n = 0 ; size_t column_group_n = 0 ; size_t column_n = 0 ; size_t string_entry_n = 0 ; P_BP_SFS_STRING_ENTRY current_entry = NULL ; BP_DestroyAllStringEntryColumnizedDataSFSession ( session ) ; P_BP_GENERIC_STRING_COLUMNIZATION * columnizations = NULL ; P_BP_GENERIC_STRING_COLUMNIZATION * columnizations_colored = NULL ; P_BP_GENERIC_STRING_COLUMNIZATION merged_columnizations = NULL ; P_BP_GENERIC_STRING_COLUMNIZATION merged_columnizations_colored = NULL ; P_BP_GENERIC_STRING_COLUMNIZATION borderized_merged_columnizations = NULL ; P_BP_GENERIC_STRING_COLUMNIZATION borderized_merged_columnizations_colored = NULL ; for ( row_group_n = 0 ; row_group_n < session -> row_group_n ; row_group_n ++ ) for ( row_n = 0 ; row_n < session -> row_groups [ row_group_n ] -> row_n ; row_n ++ ) for ( column_group_n = 0 ; column_group_n < session -> row_groups [ row_group_n ] -> rows [ row_n ] -> col_group_n ; column_group_n ++ ) for ( column_n = 0 ; column_n < session -> row_groups [ row_group_n ] -> rows [ row_n ] -> col_groups [ column_group_n ] -> columns_n ; column_n ++ ) for ( string_entry_n = 0 ; string_entry_n < session -> row_groups [ row_group_n ] -> rows [ row_n ] -> col_groups [ column_group_n ] -> columns [ column_n ] -> entries ; string_entry_n ++ ) { current_entry = session -> row_groups [ row_group_n ] -> rows [ row_n ] -> col_groups [ column_group_n ] -> columns [ column_n ] -> col_data [ string_entry_n ] ; if ( ! current_entry ) break ; if ( current_entry -> marked_display_disabled == BP_TRUE ) continue ; if ( BP_GenerateOutputStringArrayFromStringEntrySFSession ( session , current_entry , BP_TRUE ) == ERR_FAILURE ) { printf ( " \n " , current_entry ) ; } if ( ! current_entry -> final_columnization ) { printf ( " \n " , current_entry , current_entry -> string_entry_identifier , current_entry -> string_length ) ; } if ( current_entry -> final_columnization ) { merged_columnizations = current_entry -> final_columnization ; current_entry -> final_columnization = BP_BorderizeStringColumnization ( merged_columnizations , & current_entry -> border_set ) ; BP_DestroyGenericColumnization ( merged_columnizations , BP_TRUE ) ; } if ( current_entry -> final_columnization_colorized ) { merged_columnizations_colored = current_entry -> final_columnization_colorized ; current_entry -> final_columnization_colorized = BP_BorderizeStringColumnization ( merged_columnizations_colored , & current_entry -> border_set ) ; BP_DestroyGenericColumnization ( merged_columnizations_colored , BP_TRUE ) ; } } return ERR_SUCCESS ; }
walks all of the string entries, in all the columns and generates columns for
each of them.
walks all of the string entries in all the columns and generates columns for each of them .
// ensure we have a session and a tailqueue // declare item iterators // this is used as a placehoder for the current entry // first destroy session data if necessary // set columnizations // declare merged values // declare borderized (final) values // this seemingly complex logic simply iterates through each string entry recursively.  It's // not as complex as it looks, it's just self-indexing recursion. // set the current entry // ensure we have a current entry to work with (should always be the case, if not // things were corrupted somewhere.) // only convert items marked for display // attempt to generate string entry columnized data (only time it's ever required) // return indicating success