예제 #1
0
파일: filesystem.c 프로젝트: davidk01/recc
int main(void){
	const char * file_to_open = "test/c89/empty-main-return-zero.c";
	struct c_lexer_state c_lexer_state;
	struct memory_pool_collection memory_pool_collection;
	struct unsigned_char_list input_characters;
	int rtn = 0;
	struct parser_state parser_state;
	struct unsigned_char_list generated_code;
	struct unsigned_char_list lexer_output;
	struct unsigned_char_list buffered_symbol_table;
	struct preprocessor_state * preprocessor_state;
	struct unsigned_char_list preprocssed_characters;
	struct struct_c_lexer_token_ptr_list output_tokens;
	struct code_gen_state code_gen_state;
	struct_c_lexer_token_ptr_list_create(&output_tokens);
	unsigned_char_list_create(&lexer_output);
	unsigned_char_list_create(&input_characters);
	unsigned_char_list_create(&buffered_symbol_table);
	unsigned_char_list_create(&preprocssed_characters);
	memory_pool_collection_create(&memory_pool_collection);
	unsigned_char_list_create(&generated_code);
	preprocessor_state = create_preprocessor_state(&memory_pool_collection);

	if(!(rtn = get_preprocessed_output_from_file(preprocessor_state, (unsigned char *)file_to_open, &output_tokens))){
		unsigned int i;
		for(i = 0; i < struct_c_lexer_token_ptr_list_size(&output_tokens); i++){
			struct c_lexer_token * current_token = struct_c_lexer_token_ptr_list_get(&output_tokens, i);
			unsigned char * j;
			for(j = current_token->first_byte; j < (current_token->last_byte + 1); j++){
				unsigned_char_list_add_end(&preprocssed_characters, *j);
				putchar(*j);
			}
		}
	}else{
		printf("Nothing to output.  Preprocessing failed for %s\n", file_to_open);
	}
	printf("\nCompleted preprocessing\n");
	printf("\n");

	create_c_lexer_state(&c_lexer_state, &lexer_output, &memory_pool_collection, (unsigned char *)file_to_open, unsigned_char_list_data(&preprocssed_characters), unsigned_char_list_size(&preprocssed_characters));
	rtn = lex_c(&c_lexer_state);
	if(!rtn){
		unsigned int i;
		for(i = 0; i < struct_c_lexer_token_ptr_list_size(&c_lexer_state.tokens); i++){
			struct c_lexer_token * tok = struct_c_lexer_token_ptr_list_get(&c_lexer_state.tokens, i);
			printf("%s\n", get_c_token_type_names()[tok->type]);
		}
		printf("Lex was successful.\n");
	}

	printf("Begin parsing:\n");
	
	create_parser_state(&parser_state, &memory_pool_collection, &c_lexer_state, &generated_code, unsigned_char_list_data(&preprocssed_characters));
	if(parse(&parser_state)){
		printf("Parsing failed.\n");
	}else{
		printf("Full parser true:\n");
		print_parser_nodes(parser_state.top_node, 0);
	}

	create_code_gen_state(&code_gen_state, &parser_state, &generated_code, &buffered_symbol_table);
	if(generate_code(&code_gen_state)){
		printf("Parsing failed.\n");
	}else{
		unsigned int i;
		unsigned int size;
		unsigned char * data;
		printf("Code generation was successful.\n");
		size = unsigned_char_list_size(&generated_code);
		data = unsigned_char_list_data(&generated_code);

		printf("About to print\n");
		printf("%c\n",'a');
		printf("print %d size\n", size);
		printf("print %c first \n", data[0]);
		for(i = 0; i < size; i++){
			printf("%c", data[i]);
		}
	}

	struct_c_lexer_token_ptr_list_destroy(&output_tokens);
	unsigned_char_list_destroy(&input_characters);
	unsigned_char_list_destroy(&generated_code);
	unsigned_char_list_destroy(&buffered_symbol_table);
	unsigned_char_list_destroy(&lexer_output);
	destroy_code_gen_state(&code_gen_state);
	destroy_parser_state(&parser_state);
	destroy_preprocessor_state(preprocessor_state);
	unsigned_char_list_destroy(&preprocssed_characters);
	destroy_c_lexer_state(&c_lexer_state);
	memory_pool_collection_destroy(&memory_pool_collection);
	return 0;
}
예제 #2
0
void create_filesystem_impl(unsigned char * out_file){
	unsigned char * root_dir;
	struct unsigned_char_ptr_to_unsigned_char_ptr_map files;
	struct unsigned_char_ptr_to_unsigned_char_ptr_map directories;
	struct unsigned_char_ptr_list directory_keys;
	struct unsigned_char_list tmp;
	struct memory_pool_collection mpc;

	const char * filesystem_files[NUM_FILES][2] = {
		{"./data-structures/void_ptr_compare.h", "/./data-structures/void_ptr_compare.h"},
		{"./data-structures/void_ptr_memory_pool.h", "/./data-structures/void_ptr_memory_pool.h"},
		{"./data-structures/generic.h.memory_pool", "/./data-structures/generic.h.memory_pool"},
		{"./data-structures/void_ptr_to_unsigned_int_map.h", "/./data-structures/void_ptr_to_unsigned_int_map.h"},
		{"./data-structures/generic.h.binary_search", "/./data-structures/generic.h.binary_search"},
		{"./data-structures/struct_constant_description_ptr_list.h", "/./data-structures/struct_constant_description_ptr_list.h"},
		{"./data-structures/struct_type_description_memory_pool.h", "/./data-structures/struct_type_description_memory_pool.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair_merge_sort.h"},
		{"./data-structures/unsigned_char_ptr_to_unsigned_char_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_unsigned_char_ptr_map.h"},
		{"./data-structures/struct_normalized_declarator_ptr_list.h", "/./data-structures/struct_normalized_declarator_ptr_list.h"},
		{"./data-structures/struct_c_lexer_token_ptr_to_unsigned_char_ptr_map.h", "/./data-structures/struct_c_lexer_token_ptr_to_unsigned_char_ptr_map.h"},
		{"./data-structures/struct_macro_definition_ptr_list.h", "/./data-structures/struct_macro_definition_ptr_list.h"},
		{"./data-structures/unsigned_char_ptr_to_struct_macro_definition_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_macro_definition_ptr_map.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/struct_namespace_object_ptr_list.h", "/./data-structures/struct_namespace_object_ptr_list.h"},
		{"./data-structures/generic.h.list", "/./data-structures/generic.h.list"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair_merge_sort.h"},
		{"./data-structures/generic.h.map", "/./data-structures/generic.h.map"},
		{"./data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/struct_macro_parameter_ptr_list.h", "/./data-structures/struct_macro_parameter_ptr_list.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/generic.h.merge_sort", "/./data-structures/generic.h.merge_sort"},
		{"./data-structures/unsigned_char_ptr_to_struct_special_macro_definition_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_special_macro_definition_ptr_map.h"},
		{"./data-structures/struct_constant_initializer_level_ptr_list.h", "/./data-structures/struct_constant_initializer_level_ptr_list.h"},
		{"./data-structures/struct_normalized_declaration_element_ptr_list.h", "/./data-structures/struct_normalized_declaration_element_ptr_list.h"},
		{"./data-structures/unsigned_int_list.h", "/./data-structures/unsigned_int_list.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair_merge_sort.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair_merge_sort.h"},
		{"./data-structures/replace_tool.h", "/./data-structures/replace_tool.h"},
		{"./data-structures/struct_preprocessor_file_context_ptr_list.h", "/./data-structures/struct_preprocessor_file_context_ptr_list.h"},
		{"./data-structures/struct_switch_frame_ptr_list.h", "/./data-structures/struct_switch_frame_ptr_list.h"},
		{"./data-structures/unsigned_int_binary_search.h", "/./data-structures/unsigned_int_binary_search.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair_merge_sort.h"},
		{"./data-structures/struct_void_ptr_to_unsigned_int_key_value_pair_binary_search.h", "/./data-structures/struct_void_ptr_to_unsigned_int_key_value_pair_binary_search.h"},
		{"./data-structures/struct_asm_lexer_token_ptr_list.h", "/./data-structures/struct_asm_lexer_token_ptr_list.h"},
		{"./data-structures/binary_exponential_buffer.h", "/./data-structures/binary_exponential_buffer.h"},
		{"./data-structures/struct_void_ptr_to_unsigned_int_key_value_pair_merge_sort.h", "/./data-structures/struct_void_ptr_to_unsigned_int_key_value_pair_merge_sort.h"},
		{"./data-structures/struct_linker_symbol_ptr_list.h", "/./data-structures/struct_linker_symbol_ptr_list.h"},
		{"./data-structures/unsigned_char_ptr_to_struct_macro_parameter_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_macro_parameter_ptr_map.h"},
		{"./data-structures/struct_type_traversal_ptr_list.h", "/./data-structures/struct_type_traversal_ptr_list.h"},
		{"./data-structures/char_list.h", "/./data-structures/char_list.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/struct_scope_level_ptr_list.h", "/./data-structures/struct_scope_level_ptr_list.h"},
		{"./data-structures/struct_asm_instruction_ptr_list.h", "/./data-structures/struct_asm_instruction_ptr_list.h"},
		{"./data-structures/struct_c_lexer_state_ptr_list.h", "/./data-structures/struct_c_lexer_state_ptr_list.h"},
		{"./data-structures/struct_unsigned_char_list_ptr_list.h", "/./data-structures/struct_unsigned_char_list_ptr_list.h"},
		{"./data-structures/unsigned_char_ptr_to_struct_linker_symbol_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_linker_symbol_ptr_map.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair_merge_sort.h"},
		{"./data-structures/struct_asm_lexer_state_ptr_list.h", "/./data-structures/struct_asm_lexer_state_ptr_list.h"},
		{"./data-structures/unsigned_int_merge_sort.h", "/./data-structures/unsigned_int_merge_sort.h"},
		{"./data-structures/struct_c_lexer_token_memory_pool.h", "/./data-structures/struct_c_lexer_token_memory_pool.h"},
		{"./data-structures/unsigned_char_ptr_list.h", "/./data-structures/unsigned_char_ptr_list.h"},
		{"./data-structures/struct_parser_node_memory_pool.h", "/./data-structures/struct_parser_node_memory_pool.h"},
		{"./data-structures/unsigned_char_ptr_to_struct_namespace_object_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_namespace_object_ptr_map.h"},
		{"./data-structures/struct_preloader_instruction_list.h", "/./data-structures/struct_preloader_instruction_list.h"},
		{"./data-structures/struct_normalized_specifier_ptr_list.h", "/./data-structures/struct_normalized_specifier_ptr_list.h"},
		{"./data-structures/struct_linker_symbol_memory_pool.h", "/./data-structures/struct_linker_symbol_memory_pool.h"},
		{"./data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair_merge_sort.h"},
		{"./data-structures/unsigned_char_list.h", "/./data-structures/unsigned_char_list.h"},
		{"./data-structures/struct_asm_lexer_token_memory_pool.h", "/./data-structures/struct_asm_lexer_token_memory_pool.h"},
		{"./data-structures/struct_linker_object_ptr_merge_sort.h", "/./data-structures/struct_linker_object_ptr_merge_sort.h"},
		{"./data-structures/struct_special_macro_definition_ptr_list.h", "/./data-structures/struct_special_macro_definition_ptr_list.h"},
		{"./data-structures/struct_parser_operation_stack.h", "/./data-structures/struct_parser_operation_stack.h"},
		{"./data-structures/struct_struct_c_lexer_token_ptr_list_ptr_list.h", "/./data-structures/struct_struct_c_lexer_token_ptr_list_ptr_list.h"},
		{"./data-structures/unsigned_char_ptr_compare.h", "/./data-structures/unsigned_char_ptr_compare.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair_merge_sort.h"},
		{"./data-structures/struct_linker_object_ptr_list.h", "/./data-structures/struct_linker_object_ptr_list.h"},
		{"./data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/struct_c_lexer_token_ptr_list.h", "/./data-structures/struct_c_lexer_token_ptr_list.h"},
		{"./data-structures/unsigned_int_stack.h", "/./data-structures/unsigned_int_stack.h"},
		{"./data-structures/char_ptr_list.h", "/./data-structures/char_ptr_list.h"},
		{"./data-structures/generic.h.stack", "/./data-structures/generic.h.stack"},
		{"./data-structures/void_ptr_list.h", "/./data-structures/void_ptr_list.h"},
		{"./data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/struct_c_lexer_token_ptr_compare.h", "/./data-structures/struct_c_lexer_token_ptr_compare.h"},
		{"./data-structures/struct_preprocessor_if_branch_ptr_list.h", "/./data-structures/struct_preprocessor_if_branch_ptr_list.h"},
		{"./data-structures/struct_asm_instruction_memory_pool.h", "/./data-structures/struct_asm_instruction_memory_pool.h"},
		{"./data-structures/unsigned_int_ptr_list.h", "/./data-structures/unsigned_int_ptr_list.h"},
		{"./data-structures/struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_map.h", "/./data-structures/struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_map.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/struct_type_description_ptr_list.h", "/./data-structures/struct_type_description_ptr_list.h"},
		{"./data-structures/unsigned_char_ptr_to_struct_constant_description_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_constant_description_ptr_map.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair_merge_sort.h"},
		{"./parser.h", "/./parser.h"},
		{"./linker.h", "/./linker.h"},
		{"./filesystem/filesystem_compiler.h", "/./filesystem/filesystem_compiler.h"},
		{"./heap_memory_pool.h", "/./heap_memory_pool.h"},
		{"./io.h", "/./io.h"},
		{"./kernel/private_kernel_interface.h", "/./kernel/private_kernel_interface.h"},
		{"./kernel/user_proc.h", "/./kernel/user_proc.h"},
		{"./kernel/public_kernel_interface.h", "/./kernel/public_kernel_interface.h"},
		{"./kernel/kernel_state.h", "/./kernel/kernel_state.h"},
		{"./kernel/core_data_types.h", "/./kernel/core_data_types.h"},
		{"./kernel/queue.h", "/./kernel/queue.h"},
		{"./core_data_types.h", "/./core_data_types.h"},
		{"./libc/size_t.h", "/./libc/size_t.h"},
		{"./libc/common.h", "/./libc/common.h"},
		{"./libc/putchar.h", "/./libc/putchar.h"},
		{"./libc/stdio.h", "/./libc/stdio.h"},
		{"./libc/unistd.h", "/./libc/unistd.h"},
		{"./libc/string.h", "/./libc/string.h"},
		{"./libc/stdarg.h", "/./libc/stdarg.h"},
		{"./libc/stdlib.h", "/./libc/stdlib.h"},
		{"./libc/assert.h", "/./libc/assert.h"},
		{"./libc/filesystem.h", "/./libc/filesystem.h"},
		{"./lexer.h", "/./lexer.h"},
		{"./preloader.h", "/./preloader.h"},
		{"./memory_pool_collection.h", "/./memory_pool_collection.h"},
		{"./emulators/javascript/index.html", "/./emulators/javascript/index.html"},
		{"./emulators/c/op-cpu.h", "/./emulators/c/op-cpu.h"},
		{"./builtin/includetest2.h", "/./builtin/includetest2.h"},
		{"./builtin/includetest1.h", "/./builtin/includetest1.h"},
		{"./preprocessor.h", "/./preprocessor.h"},
		{"./code_generator.h", "/./code_generator.h"},
		{"code_generator.c", "/code_generator.c"},
		{"io.c", "/io.c"},
		{"lexer.c", "/lexer.c"},
		{"linker.c", "/linker.c"},
		{"parser.c", "/parser.c"},
		{"preloader.c", "/preloader.c"},
		{"preprocessor.c", "/preprocessor.c"},
		{"test/c89/basic-operations.c", "/test/c89/basic-operations.c"},
		{"test/c89/basic-putchar-aa.c", "/test/c89/basic-putchar-aa.c"},
		{"test/c89/basic-putchar-a.c", "/test/c89/basic-putchar-a.c"},
		{"test/c89/basic-putchar-b.c", "/test/c89/basic-putchar-b.c"},
		{"test/c89/constants.c", "/test/c89/constants.c"},
		{"test/c89/empty-main-return-zero.c", "/test/c89/empty-main-return-zero.c"},
		{"test/c89/exotic-declarators.c", "/test/c89/exotic-declarators.c"},
		{"test/c89/filesystem.c", "/test/c89/filesystem.c"},
		{"test/c89/for-loop.c", "/test/c89/for-loop.c"},
		{"test/c89/ignore-local.c", "/test/c89/ignore-local.c"},
		{"test/c89/main_with_parameters.c", "/test/c89/main_with_parameters.c"},
		{"test/c89/malloc-test.c", "/test/c89/malloc-test.c"},
		{"test/c89/many-types.c", "/test/c89/many-types.c"},
		{"test/c89/nested-putchar-a.c", "/test/c89/nested-putchar-a.c"},
		{"test/c89/nested-putchar-a-param-ignored.c", "/test/c89/nested-putchar-a-param-ignored.c"},
		{"test/c89/nested-putchar-a-param-used.c", "/test/c89/nested-putchar-a-param-used.c"},
		{"test/c89/preprocessor_test.c", "/test/c89/preprocessor_test.c"},
		{"test/c89/print.c", "/test/c89/print.c"},
		{"test/c89/putchar-return.c", "/test/c89/putchar-return.c"},
		{"test/c89/string-literal.c", "/test/c89/string-literal.c"},
		{"test/c89/typedef.c", "/test/c89/typedef.c"},
		{"test/c89/use-array.c", "/test/c89/use-array.c"},
		{"test/c89/use-local.c", "/test/c89/use-local.c"},
		{"test/c89/use-reference.c", "/test/c89/use-reference.c"},
		{"test/c89/va_list_call.c", "/test/c89/va_list_call.c"},
		{"test/c89/while-loop.c", "/test/c89/while-loop.c"},
		{"libc/assert.c", "/libc/assert.c"},
		{"libc/filesystem.c", "/libc/filesystem.c"},
		{"libc/fopen.c", "/libc/fopen.c"},
		{"libc/getcwd.c", "/libc/getcwd.c"},
		{"libc/Makefile", "/libc/Makefile"},
		{"libc/malloc.c", "/libc/malloc.c"},
		{"libc/printf.c", "/libc/printf.c"},
		{"libc/l2/putchar.l2", "/libc/l2/putchar.l2"},
		{"libc/string.c", "/libc/string.c"},
		{"kernel/filesystem.c", "/kernel/filesystem.c"},
		{"kernel/kernel_impl.c", "/kernel/kernel_impl.c"},
		{"kernel/kernel_state.c", "/kernel/kernel_state.c"},
		{"kernel/main.c", "/kernel/main.c"},
		{"kernel/putchar.c", "/kernel/putchar.c"},
		{"kernel/queue.c", "/kernel/queue.c"},
		{"kernel/user_proc.c", "/kernel/user_proc.c"},
		{"filesystem/filesystem_compiler.c", "/filesystem/filesystem_compiler.c"},
		{"types/struct_l0_build_info.h","/types/struct_l0_build_info.h"},
		{"types/data-structures/struct_struct_linker_symbol_ptr_list.h","/types/data-structures/struct_struct_linker_symbol_ptr_list.h"},
		{"types/data-structures/struct_struct_preprocessor_macro_level_ptr_list.h","/types/data-structures/struct_struct_preprocessor_macro_level_ptr_list.h"},
		{"types/data-structures/struct_void_ptr_list.h","/types/data-structures/struct_void_ptr_list.h"},
		{"types/data-structures/struct_struct_constant_description_ptr_list.h","/types/data-structures/struct_struct_constant_description_ptr_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_map.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair.h"},
		{"types/data-structures/struct_unsigned_int_ptr_list.h","/types/data-structures/struct_unsigned_int_ptr_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_map.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_map.h"},
		{"types/data-structures/struct_struct_c_lexer_token_ptr_list.h","/types/data-structures/struct_struct_c_lexer_token_ptr_list.h"},
		{"types/data-structures/unsigned_int.h","/types/data-structures/unsigned_int.h"},
		{"types/data-structures/struct_struct_namespace_object_ptr_list.h","/types/data-structures/struct_struct_namespace_object_ptr_list.h"},
		{"types/data-structures/struct_struct_asm_instruction_ptr_list.h","/types/data-structures/struct_struct_asm_instruction_ptr_list.h"},
		{"types/data-structures/struct_struct_c_lexer_state_ptr_list.h","/types/data-structures/struct_struct_c_lexer_state_ptr_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair.h"},
		{"types/data-structures/struct_struct_normalized_declaration_element_ptr_list.h","/types/data-structures/struct_struct_normalized_declaration_element_ptr_list.h"},
		{"types/data-structures/struct_char_list.h","/types/data-structures/struct_char_list.h"},
		{"types/data-structures/struct_struct_macro_definition_ptr_list.h","/types/data-structures/struct_struct_macro_definition_ptr_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_map.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair.h"},
		{"types/data-structures/struct_struct_asm_lexer_state_ptr_list.h","/types/data-structures/struct_struct_asm_lexer_state_ptr_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_map.h"},
		{"types/data-structures/struct_char_ptr_list.h","/types/data-structures/struct_char_ptr_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair.h"},
		{"types/data-structures/struct_struct_normalized_declarator_ptr_list.h","/types/data-structures/struct_struct_normalized_declarator_ptr_list.h"},
		{"types/data-structures/struct_struct_struct_c_lexer_token_ptr_list_ptr_list.h","/types/data-structures/struct_struct_struct_c_lexer_token_ptr_list_ptr_list.h"},
		{"types/data-structures/struct_struct_preprocessor_if_branch_ptr_list.h","/types/data-structures/struct_struct_preprocessor_if_branch_ptr_list.h"},
		{"types/data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_map.h","/types/data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_map.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_build_target_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_build_target_ptr_key_value_pair.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_linker_object_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_linker_object_ptr_key_value_pair.h"},
		{"types/data-structures/struct_struct_scope_level_ptr_list.h","/types/data-structures/struct_struct_scope_level_ptr_list.h"},
		{"types/data-structures/struct_void_ptr_to_unsigned_int_key_value_pair.h","/types/data-structures/struct_void_ptr_to_unsigned_int_key_value_pair.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_map.h"},
		{"types/data-structures/struct_unsigned_char_list.h","/types/data-structures/struct_unsigned_char_list.h"},
		{"types/data-structures/struct_struct_unsigned_char_list_ptr_list.h","/types/data-structures/struct_struct_unsigned_char_list_ptr_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_list.h","/types/data-structures/struct_unsigned_char_ptr_list.h"},
		{"types/data-structures/struct_struct_build_target_ptr_list.h","/types/data-structures/struct_struct_build_target_ptr_list.h"},
		{"types/data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair.h","/types/data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair.h"},
		{"types/data-structures/struct_struct_special_macro_definition_ptr_list.h","/types/data-structures/struct_struct_special_macro_definition_ptr_list.h"},
		{"types/data-structures/struct_struct_macro_parameter_ptr_list.h","/types/data-structures/struct_struct_macro_parameter_ptr_list.h"},
		{"types/data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair.h","/types/data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_build_target_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_build_target_ptr_map.h"},
		{"types/data-structures/struct_unsigned_int_list.h","/types/data-structures/struct_unsigned_int_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair.h"},
		{"types/data-structures/struct_struct_linker_object_ptr_list.h","/types/data-structures/struct_struct_linker_object_ptr_list.h"},
		{"types/data-structures/struct_linker_object_ptr.h","/types/data-structures/struct_linker_object_ptr.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_map.h"},
		{"types/data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_map.h","/types/data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_map.h"},
		{"types/data-structures/struct_struct_preprocessor_file_context_ptr_list.h","/types/data-structures/struct_struct_preprocessor_file_context_ptr_list.h"},
		{"types/data-structures/struct_struct_type_traversal_ptr_list.h","/types/data-structures/struct_struct_type_traversal_ptr_list.h"},
		{"types/data-structures/struct_void_ptr_to_unsigned_int_map.h","/types/data-structures/struct_void_ptr_to_unsigned_int_map.h"},
		{"types/data-structures/struct_struct_type_description_ptr_list.h","/types/data-structures/struct_struct_type_description_ptr_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair.h"},
		{"types/data-structures/struct_struct_constant_initializer_level_ptr_list.h","/types/data-structures/struct_struct_constant_initializer_level_ptr_list.h"},
		{"types/data-structures/struct_struct_preloader_instruction_list.h","/types/data-structures/struct_struct_preloader_instruction_list.h"},
		{"types/data-structures/struct_struct_normalized_specifier_ptr_list.h","/types/data-structures/struct_struct_normalized_specifier_ptr_list.h"},
		{"types/data-structures/struct_struct_switch_frame_ptr_list.h","/types/data-structures/struct_struct_switch_frame_ptr_list.h"},
		{"types/data-structures/struct_struct_asm_lexer_token_ptr_list.h","/types/data-structures/struct_struct_asm_lexer_token_ptr_list.h"},
		{"types/lexer/struct_common_lexer_state.h","/types/lexer/struct_common_lexer_state.h"},
		{"types/lexer/struct_asm_lexer_token.h","/types/lexer/struct_asm_lexer_token.h"},
		{"types/lexer/enum_c_token_type.h","/types/lexer/enum_c_token_type.h"},
		{"types/lexer/enum_asm_token_type.h","/types/lexer/enum_asm_token_type.h"},
		{"types/lexer/struct_c_lexer_token.h","/types/lexer/struct_c_lexer_token.h"},
		{"types/lexer/struct_c_lexer_state.h","/types/lexer/struct_c_lexer_state.h"},
		{"types/lexer/struct_asm_lexer_state.h","/types/lexer/struct_asm_lexer_state.h"},
		{"types/struct_heap_memory_pool.h","/types/struct_heap_memory_pool.h"},
		{"types/preprocessor/struct_macro_definition.h","/types/preprocessor/struct_macro_definition.h"},
		{"types/preprocessor/struct_preprocessor_file_context.h","/types/preprocessor/struct_preprocessor_file_context.h"},
		{"types/preprocessor/struct_preprocessor_macro_level.h","/types/preprocessor/struct_preprocessor_macro_level.h"},
		{"types/preprocessor/enum_macro_definition_type.h","/types/preprocessor/enum_macro_definition_type.h"},
		{"types/preprocessor/struct_preprocessor_if_branch.h","/types/preprocessor/struct_preprocessor_if_branch.h"},
		{"types/preprocessor/struct_special_macro_definition.h","/types/preprocessor/struct_special_macro_definition.h"},
		{"types/preprocessor/struct_preprocessor_state.h","/types/preprocessor/struct_preprocessor_state.h"},
		{"types/preprocessor/struct_macro_parameter.h","/types/preprocessor/struct_macro_parameter.h"},
		{"types/preprocessor/enum_special_macro_type.h","/types/preprocessor/enum_special_macro_type.h"},
		{"types/code_generator/struct_switch_frame.h","/types/code_generator/struct_switch_frame.h"},
		{"types/code_generator/struct_compile_time_constant.h","/types/code_generator/struct_compile_time_constant.h"},
		{"types/code_generator/struct_constant_initializer_level.h","/types/code_generator/struct_constant_initializer_level.h"},
		{"types/code_generator/struct_type_traversal.h","/types/code_generator/struct_type_traversal.h"},
		{"types/code_generator/enum_copy_method.h","/types/code_generator/enum_copy_method.h"},
		{"types/code_generator/struct_code_gen_state.h","/types/code_generator/struct_code_gen_state.h"},
		{"types/linker/struct_asm_instruction.h","/types/linker/struct_asm_instruction.h"},
		{"types/linker/struct_linker_object.h","/types/linker/struct_linker_object.h"},
		{"types/linker/struct_linker_symbol.h","/types/linker/struct_linker_symbol.h"},
		{"types/enum_build_target_type.h","/types/enum_build_target_type.h"},
		{"types/parser/enum_normalized_declarator_type.h","/types/parser/enum_normalized_declarator_type.h"},
		{"types/parser/enum_add_or_remove.h","/types/parser/enum_add_or_remove.h"},
		{"types/parser/struct_scope_level.h","/types/parser/struct_scope_level.h"},
		{"types/parser/enum_normalized_specifier_type.h","/types/parser/enum_normalized_specifier_type.h"},
		{"types/parser/enum_object_location.h","/types/parser/enum_object_location.h"},
		{"types/parser/struct_normalized_declaration_element.h","/types/parser/struct_normalized_declaration_element.h"},
		{"types/parser/struct_namespace_object.h","/types/parser/struct_namespace_object.h"},
		{"types/parser/struct_first_and_last_namespace_object.h","/types/parser/struct_first_and_last_namespace_object.h"},
		{"types/parser/struct_constant_description.h","/types/parser/struct_constant_description.h"},
		{"types/parser/struct_current_function_change.h","/types/parser/struct_current_function_change.h"},
		{"types/parser/struct_normalized_declarator.h","/types/parser/struct_normalized_declarator.h"},
		{"types/parser/enum_node_type.h","/types/parser/enum_node_type.h"},
		{"types/parser/struct_type_description.h","/types/parser/struct_type_description.h"},
		{"types/parser/struct_namespace_object_change.h","/types/parser/struct_namespace_object_change.h"},
		{"types/parser/struct_namespace_modification.h","/types/parser/struct_namespace_modification.h"},
		{"types/parser/struct_parser_node.h","/types/parser/struct_parser_node.h"},
		{"types/parser/struct_normalized_declaration_set.h","/types/parser/struct_normalized_declaration_set.h"},
		{"types/parser/enum_declaration_or_definition.h","/types/parser/enum_declaration_or_definition.h"},
		{"types/parser/struct_normalized_specifier.h","/types/parser/struct_normalized_specifier.h"},
		{"types/parser/enum_type_class.h","/types/parser/enum_type_class.h"},
		{"types/parser/enum_value_type.h","/types/parser/enum_value_type.h"},
		{"types/parser/enum_normalized_declaration_type.h","/types/parser/enum_normalized_declaration_type.h"},
		{"types/parser/struct_parser_state.h","/types/parser/struct_parser_state.h"},
		{"types/parser/enum_scope_type.h","/types/parser/enum_scope_type.h"},
		{"types/struct_memory_pool_collection.h","/types/struct_memory_pool_collection.h"},
		{"types/preloader/struct_preloader_instruction.h","/types/preloader/struct_preloader_instruction.h"},
		{"types/preloader/enum_preloader_instruction_type.h","/types/preloader/enum_preloader_instruction_type.h"},
		{"types/struct_build_state.h","/types/struct_build_state.h"},
		{"types/struct_build_target.h","/types/struct_build_target.h"}
	};
	unsigned int i;
	memory_pool_collection_create(&mpc);
	initialize_filesystem_datastructures();
	unsigned_char_ptr_to_unsigned_char_ptr_map_create(&files);
	unsigned_char_ptr_to_unsigned_char_ptr_map_create(&directories);
	unsigned_char_list_create(&tmp);
	for(i = 0; i < NUM_FILES; i++){
		unsigned int j = 0;
		if(unsigned_char_ptr_to_unsigned_char_ptr_map_exists(&files, (unsigned char *)filesystem_files[i][1])){
			printf("Duplicate file: %s\n", filesystem_files[i][1]);
			assert(0 && "Duplicate file in target filesystem.");
		}else{
			unsigned_char_ptr_to_unsigned_char_ptr_map_put(&files, (unsigned char *)&filesystem_files[i][1][0], (unsigned char *)&filesystem_files[i][0][0]);
		}
		while(filesystem_files[i][1][j]){
			unsigned_char_list_add_end(&tmp, (unsigned char)filesystem_files[i][1][j]);
			if(filesystem_files[i][1][j] == '/'){
				unsigned char * s = copy_string(unsigned_char_list_data(&tmp), ((unsigned char *)unsigned_char_list_data(&tmp)) + j, &mpc);
				if(unsigned_char_ptr_to_unsigned_char_ptr_map_exists(&directories, s)){
					heap_memory_pool_free(mpc.heap_pool, s);
				}else{
					unsigned_char_ptr_to_unsigned_char_ptr_map_put(&directories, s, s);
				}
			}
			j++;
		}
		unsigned_char_list_destroy(&tmp);
		unsigned_char_list_create(&tmp);
	}

	/*  Remove the root directory because its inode has already been created */
	root_dir = unsigned_char_ptr_to_unsigned_char_ptr_map_get(&directories, (unsigned char *)"/");
	unsigned_char_ptr_to_unsigned_char_ptr_map_remove(&directories, (unsigned char *)"/");
	heap_memory_pool_free(mpc.heap_pool, root_dir);

	directory_keys = unsigned_char_ptr_to_unsigned_char_ptr_map_keys(&directories);

	create_directories(&directory_keys, &mpc);

	for(i = 0; i < unsigned_char_ptr_list_size(&directory_keys); i++){
		unsigned char * dir = unsigned_char_ptr_list_get(&directory_keys, i);
		printf("Unique Directory: %s\n", dir);
		heap_memory_pool_free(mpc.heap_pool, dir);
	}

	create_files(&files, &mpc);

	unsigned_char_list_destroy(&tmp);
	unsigned_char_ptr_list_destroy(&directory_keys);
	unsigned_char_ptr_to_unsigned_char_ptr_map_destroy(&files);
	unsigned_char_ptr_to_unsigned_char_ptr_map_destroy(&directories);
	memory_pool_collection_destroy(&mpc);
	output_filesystem_impl(out_file);  /*  Create l2 file the represents filesystem state */
}