#include <stdio.h>
#include <stdlib.h>
static void errExit(const char *s)
{
}
int main()
{
const int base = 16;
const int height = 5;
const int width = 3;
const int csize = 3;
const char *fntPath = "moji.txt";
const char *outPath = "date.txt";
char fnt[base][height][width][csize];
char buf[8];
int c, i, j, k;
FILE *p;
if (p == NULL)
errExit(fntPath);
for (i = 0; i < base; i++)
for (j = 0; j < height; j++)
for (k = 0; k < width; k++) {
fnt[i][j][k][0] = 0xE2;
switch(c) {
case '0':
fnt[i][j][k][1] = 0x80;
fnt[i][j][k][2] = 0x95;
break;
case '1':
fnt[i][j][k][1] = 0x97;
fnt[i][j][k][2] = 0x8F;
break;
default:
if (c < 0)
errExit(fntPath);
else {
printf("%s: illegal character\n", fntPath
); return -1;
}
}
if (fseek(p
, 1, SEEK_CUR
) == EOF
) { errExit(fntPath);
}
}
errExit(fntPath);
if (p == NULL)
errExit(outPath);
for (i = 0; i < 5; i++) {
for (j = 0; j < sizeof(buf); j++)
for (j = 0; j < height; i++) {
for (k = 0; k < sizeof(buf); k++) {
fwrite(fnt
[buf
[k
]][j
], csize
, width
, stdout
); if (fwrite(fnt
[buf
[k
]][j
], csize
, width
, p
) <= 0) { errExit(outPath);
}
}
if (fputc('\n', p
) < 0) { errExit(outPath);
}
}
}
errExit(outPath);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCnN0YXRpYyB2b2lkIGVyckV4aXQoY29uc3QgY2hhciAqcykKewogICAgcGVycm9yKHMpOwogICAgZXhpdCgtMSk7Cn0KCmludCBtYWluKCkKewogICAgY29uc3QgaW50IGJhc2UgPSAxNjsKICAgIGNvbnN0IGludCBoZWlnaHQgPSA1OwogICAgY29uc3QgaW50IHdpZHRoID0gMzsKICAgIGNvbnN0IGludCBjc2l6ZSA9IDM7CiAgICBjb25zdCBjaGFyICpmbnRQYXRoID0gIm1vamkudHh0IjsKICAgIGNvbnN0IGNoYXIgKm91dFBhdGggPSAiZGF0ZS50eHQiOwogICAgY2hhciBmbnRbYmFzZV1baGVpZ2h0XVt3aWR0aF1bY3NpemVdOwogICAgY2hhciBidWZbOF07CiAgICBpbnQgYywgaSwgaiwgazsKICAgIEZJTEUgKnA7CgogICAgcCA9IGZvcGVuKGZudFBhdGgsICJyIik7CiAgICBpZiAocCA9PSBOVUxMKQogICAgICAgIGVyckV4aXQoZm50UGF0aCk7CiAgICBmb3IgKGkgPSAwOyBpIDwgYmFzZTsgaSsrKQogICAgICAgIGZvciAoaiA9IDA7IGogPCBoZWlnaHQ7IGorKykKICAgICAgICAgICAgZm9yIChrID0gMDsgayA8IHdpZHRoOyBrKyspIHsKICAgICAgICAgICAgICAgIGZudFtpXVtqXVtrXVswXSA9IDB4RTI7CiAgICAgICAgICAgICAgICBjID0gZmdldGMocCk7CiAgICAgICAgICAgICAgICBzd2l0Y2goYykgewogICAgICAgICAgICAgICAgICAgIGNhc2UgJzAnOgogICAgICAgICAgICAgICAgICAgICAgICBmbnRbaV1bal1ba11bMV0gPSAweDgwOwogICAgICAgICAgICAgICAgICAgICAgICBmbnRbaV1bal1ba11bMl0gPSAweDk1OwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlICcxJzoKICAgICAgICAgICAgICAgICAgICAgICAgZm50W2ldW2pdW2tdWzFdID0gMHg5NzsKICAgICAgICAgICAgICAgICAgICAgICAgZm50W2ldW2pdW2tdWzJdID0gMHg4RjsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgZmNsb3NlKHApOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA8IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJFeGl0KGZudFBhdGgpOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmludGYoIiVzOiBpbGxlZ2FsIGNoYXJhY3RlclxuIiwgZm50UGF0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKGZzZWVrKHAsIDEsIFNFRUtfQ1VSKSA9PSBFT0YpIHsKICAgICAgICAgICAgICAgICAgICBmY2xvc2UocCk7CiAgICAgICAgICAgICAgICAgICAgZXJyRXhpdChmbnRQYXRoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgaWYgKGZjbG9zZShwKSkKICAgICAgICAgZXJyRXhpdChmbnRQYXRoKTsKCiAgICBwID0gZm9wZW4ob3V0UGF0aCwgInciKTsKICAgIGlmIChwID09IE5VTEwpCiAgICAgICAgIGVyckV4aXQob3V0UGF0aCk7CiAgICBmb3IgKGkgPSAwOyBpIDwgNTsgaSsrKSB7CiAgICAgICAgZm9yIChqID0gMDsgaiA8IHNpemVvZihidWYpOyBqKyspCiAgICAgICAgICAgIGJ1ZltqXSA9IHJhbmQoKSAmIDE1OwogICAgICAgIGZvciAoaiA9IDA7IGogPCBoZWlnaHQ7IGkrKykgewogICAgICAgICAgICBmb3IgKGsgPSAwOyBrIDwgc2l6ZW9mKGJ1Zik7IGsrKykgewogICAgICAgICAgICAgICAgZndyaXRlKGZudFtidWZba11dW2pdLCBjc2l6ZSwgd2lkdGgsIHN0ZG91dCk7CiAgICAgICAgICAgICAgICBpZiAoZndyaXRlKGZudFtidWZba11dW2pdLCBjc2l6ZSwgd2lkdGgsIHApIDw9IDApIHsKICAgICAgICAgICAgICAgICAgICBmY2xvc2UocCk7CiAgICAgICAgICAgICAgICAgICAgcHV0Y2hhcignXG4nKTsKICAgICAgICAgICAgICAgICAgICBlcnJFeGl0KG91dFBhdGgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZwdXRjKCdcbicsIHN0ZG91dCk7CiAgICAgICAgICAgIGlmIChmcHV0YygnXG4nLCBwKSA8IDApIHsKICAgICAgICAgICAgICAgIGZjbG9zZShwKTsKICAgICAgICAgICAgICAgIGVyckV4aXQob3V0UGF0aCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICBpZiAoZmNsb3NlKHApKQogICAgICAgIGVyckV4aXQob3V0UGF0aCk7CgogICAgcmV0dXJuIDA7Cn0=