#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+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCnN0YXRpYyB2b2lkIGVyckV4aXQoY29uc3QgY2hhciAqcykKewogICAgcGVycm9yKHMpOwogICAgZXhpdCgtMSk7Cn0KCmludCBtYWluKCkKewogICAgY29uc3QgaW50IGJhc2UgPSAxNjsKICAgIGNvbnN0IGludCBoZWlnaHQgPSA1OwogICAgY29uc3QgaW50IHdpZHRoID0gMzsKICAgIGNvbnN0IGludCBjc2l6ZSA9IDM7CiAgICBjb25zdCBjaGFyICpmbnRQYXRoID0gIm1vamkudHh0IjsKICAgIGNvbnN0IGNoYXIgKm91dFBhdGggPSAiZGF0ZS50eHQiOwogICAgY2hhciBmbnRbYmFzZV1baGVpZ2h0XVt3aWR0aF1bY3NpemVdOwogICAgY2hhciBidWZbOF07CiAgICBpbnQgYywgaSwgaiwgazsKICAgIEZJTEUgKnA7CgogICAgcCA9IGZvcGVuKGZudFBhdGgsICJyIik7CiAgICBpZiAocCA9PSBOVUxMKQogICAgICAgIGVyckV4aXQoZm50UGF0aCk7CiAgICBmb3IgKGkgPSAwOyBpIDwgYmFzZTsgaSsrKSB7CiAgICAgICAgZm9yIChqID0gMDsgaiA8IGhlaWdodDsgaisrKQogICAgICAgICAgICBmb3IgKGsgPSAwOyBrIDwgd2lkdGg7IGsrKykgewogICAgICAgICAgICAgICAgZm50W2ldW2pdW2tdWzBdID0gMHhFMjsKICAgICAgICAgICAgICAgIGMgPSBmZ2V0YyhwKTsKICAgICAgICAgICAgICAgIHN3aXRjaChjKSB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnMCc6CiAgICAgICAgICAgICAgICAgICAgICAgIGZudFtpXVtqXVtrXVsxXSA9IDB4ODA7CiAgICAgICAgICAgICAgICAgICAgICAgIGZudFtpXVtqXVtrXVsyXSA9IDB4OTU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIGNhc2UgJzEnOgogICAgICAgICAgICAgICAgICAgICAgICBmbnRbaV1bal1ba11bMV0gPSAweDk3OwogICAgICAgICAgICAgICAgICAgICAgICBmbnRbaV1bal1ba11bMl0gPSAweDhGOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICBmY2xvc2UocCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjIDwgMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVyckV4aXQoZm50UGF0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW50ZigiJXM6IGlsbGVnYWwgY2hhcmFjdGVyXG4iLCBmbnRQYXRoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoZnNlZWsocCwgMSwgU0VFS19DVVIpID09IEVPRikgewogICAgICAgICAgICAgICAgICAgIGZjbG9zZShwKTsKICAgICAgICAgICAgICAgICAgICBlcnJFeGl0KGZudFBhdGgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgZnNlZWsocCwgMSwgU0VFS19DVVIpOwogICAgfQogICAgaWYgKGZjbG9zZShwKSkKICAgICAgICAgZXJyRXhpdChmbnRQYXRoKTsKCiAgICBwID0gZm9wZW4ob3V0UGF0aCwgInciKTsKICAgIGlmIChwID09IE5VTEwpCiAgICAgICAgIGVyckV4aXQob3V0UGF0aCk7CiAgICBmb3IgKGkgPSAwOyBpIDwgNTsgaSsrKSB7CiAgICAgICAgZm9yIChqID0gMDsgaiA8IHNpemVvZihidWYpOyBqKyspCiAgICAgICAgICAgIGJ1ZltqXSA9IHJhbmQoKSAmIDE1OwogICAgICAgIGZvciAoaiA9IDA7IGogPCBoZWlnaHQ7IGkrKykgewogICAgICAgICAgICBmb3IgKGsgPSAwOyBrIDwgc2l6ZW9mKGJ1Zik7IGsrKykgewogICAgICAgICAgICAgICAgZndyaXRlKGZudFtidWZba11dW2pdLCBjc2l6ZSwgd2lkdGgsIHN0ZG91dCk7CiAgICAgICAgICAgICAgICBpZiAoZndyaXRlKGZudFtidWZba11dW2pdLCBjc2l6ZSwgd2lkdGgsIHApIDw9IDApIHsKICAgICAgICAgICAgICAgICAgICBmY2xvc2UocCk7CiAgICAgICAgICAgICAgICAgICAgcHV0Y2hhcignXG4nKTsKICAgICAgICAgICAgICAgICAgICBlcnJFeGl0KG91dFBhdGgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZwdXRjKCdcbicsIHN0ZG91dCk7CiAgICAgICAgICAgIGlmIChmcHV0YygnXG4nLCBwKSA8IDApIHsKICAgICAgICAgICAgICAgIGZjbG9zZShwKTsKICAgICAgICAgICAgICAgIGVyckV4aXQob3V0UGF0aCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICBpZiAoZmNsb3NlKHApKQogICAgICAgIGVyckV4aXQob3V0UGF0aCk7CgogICAgcmV0dXJuIDA7Cn0=