Example #1
0
 /**
  * Constructor.
  */
 Container(const std::string path, const std::string dataPath) :
     allocator(new IO::StreamAllocator(path + "\\" + dataPath)),
     buildInfo(path + "\\.build.info"),
     buildConfig(allocator->config<true, false>(buildInfo.build(0).at("Build Key"))),
     cdnConfig(allocator->config<true, false>(buildInfo.build(0).at("CDN Key"))),
     shadowMemory(allocator->shmem<true, false>()),
     index(new Parsers::Binary::Index(shadowMemory.versions(), allocator)),
     encoding(new Parsers::Binary::Encoding(
         index->find(Hex(buildConfig["encoding"].back().substr(0, 18U))), allocator)),
     root(new Filesystem::Root(getProgramCode(buildConfig["build-uid"].front()),
         buildConfig["root"].front(), encoding, index, allocator))
 {
 }
/*---Initialize Main block---*/
int main(int argc, char **argv)
{
    int getFileFlag = 0;
	long codeSize = CODE_SIZE;

    if (argc < 2)
	{
        file = stdin;
		if (getFileFlag) fclose(file);
    }
	else
	{
        if ((file = fopen( argv[1], "r" ))==NULL)
		{
            fprintf(stderr, "This can't open: \"%s\"\n", argv[1]);
            return ERROR;
        }
        getFileFlag = FAILED;
    }

    codeSize = getProgramCode(file, data);
    if (codeSize == ERROR)
	{
		fprintf(stderr, "Error in code file.\n");
		return ERROR;
    }

    if (strstr(data, "Ook") != NULL)
	{
		translatorOokToBFCode(data);
	}

    interpreterBFCode(codeSize, data);

    return OK;
}