<commit_before>#include "mapping.h"

void printDouble(Data* object);
void printShort(Data* object);
void printCell(Data* object);
void printStruct(Data* object);

int main (int argc, char* argv[])
{
	char* filename = argv[1];
	char variable_name[30];
	strcpy(variable_name, argv[2]);
	Data* objects = getDataObject(filename, variable_name);
	int index = 0;

	while (objects[index].type != UNDEF)
	{
		switch (objects[index].type)
		{
			case DOUBLE:
				printDouble(&objects[index]);
				break;
			case CHAR:
				//printChar(objects[index]);
				break;
			case UINT16_T:
				printShort(&objects[index]);
				break;
			case REF:
				printCell(&objects[index]);
				break;
			case STRUCT:
				printStruct(&objects[index]);
				break;
			default:
				break;
		}
		index++;
	}
}
void printDouble(Data* object)
{
	int num_elems = 1;
	int num_dims = 0;
	int i = 0;
	while(object->dims[i] > 0)
	{
		num_elems *= object->dims[i];
		num_dims++;
		i++;
	}

	printf("\n%s:\n", object->name);
	for (i = 0; i < num_elems; i++)
	{
		printf("%f ", object->double_data[i]);
		for (int j = 0; j < num_dims - 1; j++)
		{
			if ((i + 1) % object->dims[j] == 0)
			{
				printf("\n");
			}
		}
	}
	printf("\n");
}
void printShort(Data* object)
{
	int num_elems = 1;
	int num_dims = 0;
	int i = 0;
	while(object->dims[i] > 0)
	{
		num_elems *= object->dims[i];
		num_dims++;
		i++;
	}

	char* string = (char *)malloc(num_elems + 1);

	for (i = 0; i < num_elems; i++)
	{
		string[i] = object->ushort_data[i];
	}
	string[num_elems] = 0;
	printf("\n%s:\n", object->name);
	printf("%s\n\n", string);
}
void printCell(Data* object)
{
	printf("\n%s:\n", object->name);
	Data* cell_objects = object->sub_objects;

	int num_elems = 1;
	int num_dims = 0;
	int i = 0;
	while(object->dims[i] > 0)
	{
		num_elems *= object->dims[i];
		num_dims++;
		i++;
	}

	for (i = 0; i < num_elems; i++)
	{
		printf("%f ", cell_objects[i].double_data[0]);
		for (int j = 0; j < num_dims - 1; j++)
		{
			if ((i + 1) % object->dims[j] == 0)
			{
				printf("\n");
			}
		}
	}
	printf("\n");
}
void printStruct(Data* object)
{
	printf("\n%s fields: \n", object->name);

	int index = 0;
	while (object->sub_objects[index].type != UNDEF)
	{
		printf("%s\n", object->sub_objects[index].name);
		index++;
	}

	printf("\n");
}<commit_msg>Logical type handling in user test<commit_after>#include "mapping.h"

void printDouble(Data* object);
void printShort(Data* object);
void printCell(Data* object);
void printStruct(Data* object);
void printChar(Data* object);

int main (int argc, char* argv[])
{
	char* filename = argv[1];
	char variable_name[30];
	strcpy(variable_name, argv[2]);
	Data* objects = getDataObject(filename, variable_name);
	int index = 0;

	while (objects[index].type != UNDEF)
	{
		switch (objects[index].type)
		{
			case DOUBLE:
				printDouble(&objects[index]);
				break;
			case CHAR:
				printChar(&objects[index]);
				break;
			case UINT16_T:
				printShort(&objects[index]);
				break;
			case REF:
				printCell(&objects[index]);
				break;
			case STRUCT:
				printStruct(&objects[index]);
				break;
			default:
				break;
		}
		index++;
	}
}
void printDouble(Data* object)
{
	int num_elems = 1;
	int num_dims = 0;
	int i = 0;
	while(object->dims[i] > 0)
	{
		num_elems *= object->dims[i];
		num_dims++;
		i++;
	}

	printf("\n%s:\n", object->name);
	for (i = 0; i < num_elems; i++)
	{
		printf("%f ", object->double_data[i]);
		for (int j = 0; j < num_dims - 1; j++)
		{
			if ((i + 1) % object->dims[j] == 0)
			{
				printf("\n");
			}
		}
	}
	printf("\n");
}
void printShort(Data* object)
{
	int num_elems = 1;
	int num_dims = 0;
	int i = 0;
	while(object->dims[i] > 0)
	{
		num_elems *= object->dims[i];
		num_dims++;
		i++;
	}

	char* string = (char *)malloc(num_elems + 1);

	for (i = 0; i < num_elems; i++)
	{
		string[i] = object->ushort_data[i];
	}
	string[num_elems] = 0;
	printf("\n%s:\n", object->name);
	printf("%s\n\n", string);
}
void printCell(Data* object)
{
	printf("\n%s:\n", object->name);
	Data* cell_objects = object->sub_objects;

	int num_elems = 1;
	int num_dims = 0;
	int i = 0;
	while(object->dims[i] > 0)
	{
		num_elems *= object->dims[i];
		num_dims++;
		i++;
	}

	for (i = 0; i < num_elems; i++)
	{
		printf("%f ", cell_objects[i].double_data[0]);
		for (int j = 0; j < num_dims - 1; j++)
		{
			if ((i + 1) % object->dims[j] == 0)
			{
				printf("\n");
			}
		}
	}
	printf("\n");
}
void printStruct(Data* object)
{
	printf("\n%s fields: \n", object->name);

	int index = 0;
	while (object->sub_objects[index].type != UNDEF)
	{
		printf("%s\n", object->sub_objects[index].name);
		index++;
	}

	printf("\n");
}
void printChar(Data* object)
{
	printf("%s:\n", object->name);

	int num_elems = 1;
	int num_dims = 0;
	int i = 0;
	while(object->dims[i] > 0)
	{
		num_elems *= object->dims[i];
		num_dims++;
		i++;
	}

	for (i = 0; i < num_elems; i++)
	{
		printf("%d ", object->char_data[i]);
		for (int j = 0; j < num_dims - 1; j++)
		{
			if ((i + 1) % object->dims[j] == 0)
			{
				printf("\n");
			}
		}
	}
	printf("\n");

}
{'fraction_non_alphanumeric': 0.20516385302879842, 'fraction_numerical': 0.015292949354518371, 'mean_word_length': 3.2896081771720613, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3787167', 'n_tokens_mistral': 2354, 'n_tokens_neox': 2113, 'n_words': 461}