Example #1
0
TEST(BytesTest, Comparison)
{
  EXPECT_GT(Terabytes(1), Gigabytes(1));
  EXPECT_GT(Gigabytes(1), Megabytes(1));
  EXPECT_GT(Megabytes(1), Kilobytes(1));
  EXPECT_GT(Kilobytes(1), Bytes(1));

  EXPECT_EQ(Bytes(1024), Kilobytes(1));
  EXPECT_LT(Bytes(1023), Kilobytes(1));
  EXPECT_GT(Bytes(1025), Kilobytes(1));
}
Example #2
0
TEST(BytesTest, Stringify)
{
  EXPECT_NE(Megabytes(1023), Gigabytes(1));

  EXPECT_EQ("0B", stringify(Bytes()));

  EXPECT_EQ("1KB", stringify(Kilobytes(1)));
  EXPECT_EQ("1MB", stringify(Megabytes(1)));
  EXPECT_EQ("1GB", stringify(Gigabytes(1)));
  EXPECT_EQ("1TB", stringify(Terabytes(1)));

  EXPECT_EQ("1023B", stringify(Bytes(1023)));
  EXPECT_EQ("1023KB", stringify(Kilobytes(1023)));
  EXPECT_EQ("1023MB", stringify(Megabytes(1023)));
  EXPECT_EQ("1023GB", stringify(Gigabytes(1023)));
}
Example #3
0
int main(int argc, char** argv)
{
    static char BytecodeStream[Kilobytes(64)];
    static int  CommandBuffer[128];
    static int  VarMemory0[128] = {0};
    static int  VarMemory1[128] = {0};
    int*        VarMemoryPtrs[] = {VarMemory0, VarMemory1};
    load_file_result Result = LoadFileIntoMemory("bytecode", BytecodeStream, sizeof BytecodeStream);
    dotForthExecute(BytecodeStream, CommandBuffer, VarMemoryPtrs);


    CmdHnd_Entry(CommandBuffer);
    return 0;
}
Example #4
0
TEST(BytesTest, Parse)
{
  EXPECT_SOME_EQ(Terabytes(1), Bytes::parse("1TB"));
  EXPECT_SOME_EQ(Gigabytes(1), Bytes::parse("1GB"));
  EXPECT_SOME_EQ(Megabytes(1), Bytes::parse("1MB"));
  EXPECT_SOME_EQ(Kilobytes(1), Bytes::parse("1KB"));
  EXPECT_SOME_EQ(Bytes(1), Bytes::parse("1B"));

  // Cannot have fractional bytes.
  EXPECT_ERROR(Bytes::parse("1.5B"));

  // Parsing fractions is unsupported.
  EXPECT_ERROR(Bytes::parse("1.5GB"));

  // Unknown unit.
  EXPECT_ERROR(Bytes::parse("1PB"));
}
Example #5
0
assets_s* AllocateAssets(memoryBlock_s* memoryBlock)
{
	assets_s* assets = PushStruct(memoryBlock, assets_s);
    assets->assetUseQueue = InitLinkedList(memoryBlock, Kilobytes(2));
    assets->dyMemoryBlock = InitDynamicMemoryBlock(memoryBlock, Megabytes(64), Kilobytes(10));
    assets->tagCount = 1;
    assets->assetCount = 1;

    platformFileGroup_s* fileGroup = Platform.getAllFilesOfTypeBegin("wa");
    assets->fileCount = fileGroup->fileCount;
    assets->files = PushArray(memoryBlock, assets->fileCount, assetFile_s);
    for(uint32_t index = 0; index < assets->fileCount; index++)
    {
        assetFile_s* file = assets->files + index;
        file->tagBase = assets->tagCount;
        file->handle = Platform.openNextFile(fileGroup);
        file->header = {};

        Platform.readDataFromFile(file->handle, 0, sizeof(file->header), &file->header);

        uint32_t assetTypeArraySize = file->header.assetTypesCount*sizeof(waAssetType_s);
        file->assetTypeArray = (waAssetType_s*) PushSize(memoryBlock, assetTypeArraySize);
        Platform.readDataFromFile(file->handle, file->header.assetTypes, assetTypeArraySize, 
            file->assetTypeArray);
        if(PlatformNoFileErrors(file->handle))
        {
            if(file->header.magicValue != MAGIC_VALUE)
            {
                Platform.fileError(file->handle, "wa file has an invalid magic value");
            }
            if(file->header.version > WALLACE_ASSET_VERSION)
            {
                Platform.fileError(file->handle, "wa file has a version which exceeds game version");
            } 

            if(PlatformNoFileErrors(file->handle))
            {
                // NOTE: The first asset and tag slot in every
                // .wa is a null (reserved) so we don't count it as
                // something we will need space for!
                assets->tagCount += (file->header.tagCount - 1);
                assets->assetCount += (file->header.assetCount - 1);
            }
        }
        else
        {
            InvalidCodePath;
        }
    }
    Platform.getAllFilesOfTypeEnd(fileGroup);
    assets->assets = PushArray(memoryBlock, assets->assetCount, assetFileData_s);
    assets->slots = PushArray(memoryBlock, assets->assetCount, assetData_s);
    assets->tags = PushArray(memoryBlock, assets->tagCount, waTag_s);

    assets->tags[0] = {};

    for(uint32_t fileIndex = 0; fileIndex < assets->fileCount; fileIndex++)
    {
        assetFile_s* file = assets->files + fileIndex;
        if(PlatformNoFileErrors(file->handle))
        {
            uint32_t tagArraySize = sizeof(waTag_s) * (file->header.tagCount - 1);
            Platform.readDataFromFile(file->handle, file->header.tags + sizeof(waTag_s), tagArraySize, 
                assets->tags + file->tagBase);
        }
    }

    // NOTE: Reserve one null asset at the beginning
    uint32_t assetCount = 0;
    assets->assets[assetCount] = {};
    assetCount++;
    for(uint32_t destTypeId = 0; destTypeId < assetType_last; destTypeId++)
    {
        waAssetType_s* destType = assets->assetTypes + destTypeId;
        destType->firstAssetIndex = assetCount;
        for(uint32_t fileIndex = 0; fileIndex < assets->fileCount; fileIndex++)
        {
            assetFile_s* file = assets->files + fileIndex;
            if(PlatformNoFileErrors(file->handle))
            {
                for(uint32_t sourceIndex = 0; sourceIndex < file->header.assetTypesCount; sourceIndex++)
                {
                    waAssetType_s* sourceType = file->assetTypeArray + sourceIndex;
                    if(sourceType->typeId == destTypeId)
                    {
                        uint32_t assetCountForType = sourceType->onePastLastAssetIndex - 
                            sourceType->firstAssetIndex;
                        temporaryMemory_s tempMem = BeginTemporaryMemory(memoryBlock);
                        waAssetFileData_s* waAssetArray = PushArray(memoryBlock, assetCountForType, waAssetFileData_s);
                        Platform.readDataFromFile(file->handle, file->header.assets +
                                                  sourceType->firstAssetIndex * sizeof(waAssetFileData_s),
                                                  assetCountForType * sizeof(waAssetFileData_s), waAssetArray);
                        for(uint32_t assetIndex = 0; assetIndex < assetCountForType; assetIndex++)
                        {
                            waAssetFileData_s* waAsset = waAssetArray + assetIndex;

                            // Assert(assetCount < assets->assetCount);
                            assetFileData_s* asset = assets->assets + assetCount++;
                            
                            asset->fileIndex = fileIndex;
                            asset->wa = *waAsset;
                            if(asset->wa.firstTagIndex == 0)
                            {
                                asset->wa.firstTagIndex = 0;
                                asset->wa.onePastLastTagIndex = 0;
                            }
                            else
                            {
                                asset->wa.firstTagIndex += (file->tagBase - 1);
                                asset->wa.onePastLastTagIndex += (file->tagBase - 1);
                            }
                        }

                        EndTemporaryMemory(tempMem);
                    }
                }
            }
        }
        destType->onePastLastAssetIndex = assetCount;
    }

    // Assert(assetCount == assets->assetCount);
	return assets;
}
Example #6
0
int main(int argc, char** argv)
{
	//stbi_set_flip_vertically_on_load(1);

	if(SDL_Init(SDL_INIT_EVERYTHING) != 0) {
		Log_Error("Could not init SDL"); 
		Log_Error(SDL_GetError());
		return 1;
	}

	SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
	SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
	SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
	SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1);
	SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
	SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
	

	int32 window_display_index = 0;
#if 1
	window_display_index = 1;
#endif
	SDL_Window* window = SDL_CreateWindow("Rituals", 
			SDL_WINDOWPOS_CENTERED_DISPLAY(window_display_index), 
			SDL_WINDOWPOS_CENTERED_DISPLAY(window_display_index),
			1280, 720, 
			SDL_WINDOW_OPENGL | 
			SDL_WINDOW_RESIZABLE |
			SDL_WINDOW_MOUSE_FOCUS |
			SDL_WINDOW_INPUT_FOCUS);

	if(window == NULL) {
		Log_Error("Could not create window");
		Log_Error(SDL_GetError());
		return 1;
	}

	printf("%s \n", SDL_GetError());
	SDL_GLContext glctx = SDL_GL_CreateContext(window);

	if(ogl_LoadFunctions() == ogl_LOAD_FAILED) {
		Log_Error("Could not load OpenGL 3.3 functions...");
		return 1;
	}

	int ret = SDL_GL_SetSwapInterval(-1);

	{
#define _check_gl_attribute(attr, val) int _##attr##_val; \
	int _##attr##_success = SDL_GL_GetAttribute(attr, &_##attr##_val); \
	gl_checks[gl_check_count++] = _##attr##_val == val; \
	gl_names[gl_check_count - 1] = #attr; \
	gl_vals[gl_check_count - 1] = _##attr##_val; \
	gl_exp_vals[gl_check_count - 1] = val; 
			 
		//check if we got everything
		bool gl_checks[64];
		char* gl_names[64];
		int gl_vals[64];
		int gl_exp_vals[64];
		isize gl_check_count = 0;

		_check_gl_attribute(SDL_GL_RED_SIZE, 8);
		_check_gl_attribute(SDL_GL_GREEN_SIZE, 8);
		_check_gl_attribute(SDL_GL_BLUE_SIZE, 8);
		_check_gl_attribute(SDL_GL_ALPHA_SIZE, 8);
		_check_gl_attribute(SDL_GL_DOUBLEBUFFER, 1);
		_check_gl_attribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
		_check_gl_attribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
		_check_gl_attribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1);
		_check_gl_attribute(SDL_GL_ACCELERATED_VISUAL, 1);
		_check_gl_attribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);

		for(isize i = 0; i < gl_check_count; ++i) {
			printf("%s %s: wanted %d, got %d \n", 
					gl_names[i], 
					gl_checks[i] ? "succeeeded" : "failed", 
					gl_exp_vals[i], 
					gl_vals[i]);
		}

	}	

	// Game initializiation
	game = Allocate(Game, 1);
	{
		game->window = window;
		game->state = Game_State_None;
		game->meta_arena = Allocate(Memory_Arena, 1);
		init_memory_arena(game->meta_arena, isz(Memory_Arena) * 10);
		game->game_arena = new_memory_arena(Kilobytes(64), game->meta_arena);
		game->asset_arena = new_memory_arena(Megabytes(512), game->meta_arena);
		game->temp_arena = new_memory_arena(Megabytes(64), game->meta_arena);
		game->play_arena = new_memory_arena(Megabytes(512), game->meta_arena);
		game->renderer_arena = new_memory_arena(Megabytes(32), game->meta_arena);

		game->base_path = SDL_GetBasePath();
		game->base_path_length = strlen(game->base_path);

		game->input = Arena_Push_Struct(game->game_arena, Game_Input);
		game->input->scancodes = Arena_Push_Array(game->game_arena, int8, SDL_NUM_SCANCODES);
		game->input->keycodes = Arena_Push_Array(game->game_arena, int8, SDL_NUM_SCANCODES);
		game->input->mouse = Arena_Push_Array(game->game_arena, int8, 16);

		init_random(&game->r, time(NULL));
		//TODO(will) load window settings from file
		game->window_size = v2i(1280, 720);
		game->scale = 1.0f;

		game->renderer = Arena_Push_Struct(game->game_arena, Renderer);
		renderer_init(game->renderer, game->renderer_arena);

		renderer = game->renderer;
		input = game->input;
	}

	load_assets();

	bool running = true;
	SDL_Event event;
	glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
	//glClearColor(1, 1, 1, 1);

	play_state->current_time = SDL_GetTicks();
	play_state->prev_time = play_state->current_time;
	while(running) {
		uint64 start_ticks = SDL_GetTicks();

		if(game->input->num_keys_down < 0) game->input->num_keys_down = 0;
		if(game->input->num_mouse_down < 0) game->input->num_mouse_down = 0;

		if(game->input->num_keys_down > 0)
		for(int64 i = 0; i < SDL_NUM_SCANCODES; ++i) {
			int8* t = game->input->scancodes + i;
			if(*t == State_Just_Released) {
				*t = State_Released;
			} else if(*t == State_Just_Pressed) {
				*t = State_Pressed;
			}
			t = game->input->keycodes + i;
			if(*t == State_Just_Released) {
				*t = State_Released;
			} else if(*t == State_Just_Pressed) {
				*t = State_Pressed;
			}
		}
		if(game->input->num_mouse_down > 0)
		for(int64 i = 0; i < 16; ++i) {
			int8* t = game->input->mouse + i;
			if(*t == State_Just_Released) {
				*t = State_Released;
			} else if(*t == State_Just_Pressed) {
				*t = State_Pressed;
			}
		}


		while(SDL_PollEvent(&event)) {
			//TODO(will) handle text input
			switch(event.type) {
				case SDL_QUIT:
					running = false;
					break;
				case SDL_WINDOWEVENT:
					update_screen();
					break;
				case SDL_KEYDOWN:
					game->input->num_keys_down++;
					if(!event.key.repeat) {
						game->input->scancodes[event.key.keysym.scancode] = State_Just_Pressed;
						if(event.key.keysym.sym < SDL_NUM_SCANCODES) {
							game->input->keycodes[event.key.keysym.sym] = State_Just_Pressed;
						}
					}
					break;
				case SDL_KEYUP:
					game->input->num_keys_down--;
					if(!event.key.repeat) {
						game->input->scancodes[event.key.keysym.scancode] = State_Just_Released;
						if(event.key.keysym.sym < SDL_NUM_SCANCODES) {
							game->input->keycodes[event.key.keysym.sym] = State_Just_Released;
						}
					}
					break;
				case SDL_MOUSEBUTTONDOWN:
					game->input->num_mouse_down++;
					game->input->mouse[event.button.button] = State_Just_Pressed;
					break;
				case SDL_MOUSEBUTTONUP:
					game->input->num_mouse_down--;
					game->input->mouse[event.button.button] = State_Just_Released;
					break;
			}
		}
	
		int mx, my;
		SDL_GetMouseState(&mx, &my);
		input->mouse_x = mx;
		input->mouse_y = my;

		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		update();

		SDL_GL_SwapWindow(window);
		uint64 frame_ticks = SDL_GetTicks() - start_ticks;
		//if(frame_ticks > 18) printf("Slow frame! %d\n", frame_ticks);
	}

	SDL_Quit();
	return 0;
}
Example #7
0
  Flags()
  {
    add(&Flags::environment_variable_prefix,
        "environment_variable_prefix",
        "Prefix for environment variables meant to modify the behavior of\n"
        "the container logger for the specific executor being launched.\n"
        "The logger will look for the prefixed environment variables in the\n"
        "'ExecutorInfo's 'CommandInfo's 'Environment':\n"
        "  * DESTINATION_TYPE\n"
        "  * LOGROTATE_MAX_STDOUT_SIZE\n"
        "  * LOGROTATE_STDOUT_OPTIONS\n"
        "  * LOGROTATE_MAX_STDERR_SIZE\n"
        "  * LOGROTATE_STDERR_OPTIONS\n"
        "If present, these variables will override the global values set\n"
        "via module parameters.",
        "CONTAINER_LOGGER_");

    add(&Flags::companion_dir,
        "companion_dir",
        None(),
        "Directory where this module's companion binary is located.\n"
        "The journald container logger will find the '" +
        mesos::journald::logger::NAME + "'\n"
        "binary file under this directory.",
        static_cast<const std::string*>(nullptr),
        [](const std::string& value) -> Option<Error> {
          std::string executablePath =
            path::join(value, mesos::journald::logger::NAME);

          if (!os::exists(executablePath)) {
            return Error("Cannot find: " + executablePath);
          }

          return None();
        });

    add(&Flags::logrotate_path,
        "logrotate_path",
        "If specified, the logrotate container logger will use the specified\n"
        "'logrotate' instead of the system's 'logrotate'.",
        "logrotate",
        [](const std::string& value) -> Option<Error> {
          // Check if `logrotate` exists via the help command.
          // TODO(josephw): Consider a more comprehensive check.
          Try<std::string> helpCommand =
            os::shell(value + " --help > /dev/null");

          if (helpCommand.isError()) {
            return Error(
                "Failed to check logrotate: " + helpCommand.error());
          }

          return None();
        });

    add(&Flags::max_label_payload_size,
        "max_label_payload_size",
        "Maximum size of the label data transferred to the\n"
        "logger companion binary. Can be at most one megabyte.",
        Kilobytes(10),
        [](const Bytes& value) -> Option<Error> {
          if (value > Megabytes(1)) {
            return Error(
                "Maximum --max_label_payload_size is one megabyte");
          }

          return None();
        });

    add(&Flags::libprocess_num_worker_threads,
        "libprocess_num_worker_threads",
        "Number of Libprocess worker threads.\n"
        "Defaults to 8.  Must be at least 1.",
        8u,
        [](const size_t& value) -> Option<Error> {
          if (value < 1u) {
            return Error(
                "Expected --libprocess_num_worker_threads of at least 1");
          }

          return None();
        });


    add(&Flags::fluentbit_ip,
        "fluentbit_ip",
        "IP of the Fluent Bit TCP listener.",
        [](const Option<net::IP>& value) -> Option<Error> {
          if (value.isNone()) {
            return Error("--fluentbit_ip is required");
          }

          return None();
        });

    add(&Flags::fluentbit_port,
        "fluentbit_port",
        "Port of the Fluent Bit TCP listener.");
  }
Example #8
0
// read input load_info from file
internal ndmp_LoadInfo_Error
ndmp_LoadInfo_init(ndmp_LoadInfo* load_info, nv_Nanocube* nanocube, MemoryBlock *filename)
{

	Assert(nanocube->initialized
	       && nanocube->num_index_dimensions==0
	       && nanocube->index_initialized==0);

	load_info->num_dimensions = 0;
	load_info->depth = 0;
	load_info->variable_size = 0;
	load_info->record_size = 0;

	// assumes separator consists of two lines

	char buffer[Kilobytes(4)];

	pt_File input_file = platform.open_read_file(filename->begin, filename->end);

	nu_FileTokenizer ftok;
	nu_FileTokenizer_init(&ftok, '\n', buffer, buffer + sizeof(buffer), &input_file);

	// char token[Kilobytes(1)];

	nu_BufferTokenizer btok;

	while (nu_FileTokenizer_next(&ftok)) {

		if (ftok.token_empty) // signal that data is coming
			break;

		//		fprintf(stderr, "%s\n", ftok.buffer + ftok.token_begin);

		// @todo add mechanism to skip empty tokens
		nu_BufferTokenizer_init(&btok, ' ',
					ftok.token.begin,
					ftok.token.end);

		if (!nu_BufferTokenizer_next(&btok)) { continue; }

		// log
		{
			//auto n = BufferTokenizer_copy_token(&btok, token, sizeof(token)-1);
			//token[n] = 0;
			//fprintf(stderr, "---> %s	[%d] \n", token, btok.overflow);
		}

		s64 tok_index =
			nu_first_match_on_cstr_prefix_table(ndmp_load_info_tokens,
							    ndmp_TOKEN_FIELD,
							    ndmp_TOKEN_FIELD + 1,
							    btok.token.begin,
							    btok.token.end);

		if (tok_index != ndmp_TOKEN_FIELD) {
			continue;
		}

		// read next non empty token
		if (!nu_BufferTokenizer_next(&btok)) {
			//	       fprintf(stderr,"[Error] No field name?\n");
			return(ndmp_LOAD_INFO_NO_FIELD_NAME);
		}

		MemoryBlock field_name = btok.token;

		if (!nu_BufferTokenizer_next(&btok)) {
			//	       fprintf(stderr,"[Error] No field type!\n");
			return(ndmp_LOAD_INFO_NO_FIELD_NAME);
		}

		MemoryBlock field_type = btok.token;

		s64 type_index =
			nu_first_match_on_cstr_prefix_table(
							    ndmp_load_info_tokens,
							    ndmp_TOKEN_TYPE_BEGIN,
							    ndmp_TOKEN_TYPE_END,
							    field_type.begin,
							    field_type.end);

		if (type_index == -1) {
			//	       fprintf(stderr,"[Error] Unkown field type\n");
			return(ndmp_LOAD_INFO_UNKNOWN_FIELD_TYPE);
		}

		// check resolution of type for input purposes
		nu_BufferTokenizer rtok; // resolution tokenizer
		nu_BufferTokenizer_init(&rtok, '_',
					field_type.begin,
					field_type.end);

		MemoryBlock resolution_text = rtok.token;
		while (nu_BufferTokenizer_next(&rtok)) { // annotate last token
			resolution_text = rtok.token;
		}

		if (resolution_text.begin == resolution_text.end ||
		    resolution_text.end-resolution_text.begin > 9) {
			//	       fprintf(stderr,"[Error] Could not decode resolution of field type!\n");
			return(ndmp_LOAD_INFO_INVALID_FIELD_RESOLUTION);
		}

		// @todo library call to covert decimal str into a number
		s32 resolution;
		if (!pt_parse_s32(resolution_text.begin, resolution_text.end,
				  &resolution)
		    || resolution < 1
		    || resolution > 127) {
			//	       fprintf(stderr,"[Error] Field resolution not supported\n");
			return(ndmp_LOAD_INFO_FIELD_RESOLUTION_NOT_SUPPORTED);
		}

		if (type_index == ndmp_TOKEN_VAR_UINT
		    && load_info->variable_size == 0) {
			load_info->variable_size = resolution;
			load_info->record_size  += resolution;

			char measure_name[] = "count";

			nv_Nanocube_insert_measure_dimension
				(nanocube, nv_NUMBER_STORAGE_UNSIGNED_32,
				 measure_name, cstr_end(measure_name));

			continue; // should be the last dimension
		} else if (load_info->variable_size > 0) {
			//	       fprintf(stderr,"[error] variable needs to be the last field.\n");
			return(ndmp_LOAD_INFO_VARIABLE_NOT_LAST_FIELD);
		}

		// annotate everything
		int index = load_info->num_dimensions;
		load_info->formats[index] = (int) type_index;
		load_info->resolutions[index] = resolution;

		int num_levels = 0;
		int bits_per_level = 0;

		if (type_index == ndmp_TOKEN_QUADTREE) {
			num_levels = resolution;
			bits_per_level = 2;
			load_info->record_size += 8; // +8 bites
		} else if (type_index == ndmp_TOKEN_CATEGORICAL) {
			num_levels = 1;
			bits_per_level = 8;
			load_info->record_size += 1;
		} else if (type_index == ndmp_TOKEN_TIME) {
			num_levels = resolution * 8;
			bits_per_level = 1;
			load_info->record_size += resolution;
		} else {
			//	       fprintf(stderr,"[Error] Type not recognized.\n");
			return(ndmp_LOAD_INFO_UNRECOGNIZED_TYPE);
		}

		nv_Nanocube_insert_index_dimension(nanocube,
						   (u8) bits_per_level,
						   (u8) num_levels,
						   field_name.begin,
						   field_name.end);

		load_info->depth += num_levels;
		++load_info->num_dimensions;

		//	   fprintf(stderr,"%s\n",ftok.buffer + ftok.token_begin);

	}


	//     fprintf(stderr,"%lld\n",ftok.file_offset);

	load_info->length = ftok.file_offset;

	platform.close_file(&input_file);

	return ndmp_LOAD_INFO_OK;
}