module f2c.main;



private import std.file;
private import std.path;
private import std.stream;
private import std.string;



int main(char[][] args)
{
	foreach(pathstring; args[1 .. length])
	{
		auto data = cast(ubyte[]).std.file.read(pathstring);

		auto arrayName = .std.string.toupper(getName(getBaseName(pathstring)));

		auto file = new File(addExt(pathstring, "c"), FileMode.OutNew);

		file.writef("const unsigned char %s[] = {", arrayName);

		foreach(x; data)
		{
			file.writef("%s,", x);
		}

		file.writefln("};");

		file.close();

		file.create(addExt(pathstring, "h"));

		file.writefln("extern const unsigned char %s[];", arrayName);
		file.writefln("#define SIZEOF_%s %d", arrayName, data.length);

		file.close();
	}

	return 0;
}

