|
| 1 | +/* Copyright (C) 2021 Lars Brinkhoff <lars@nocrew.org> |
| 2 | +
|
| 3 | + This program is free software: you can redistribute it and/or modify |
| 4 | + it under the terms of the GNU General Public License as published by |
| 5 | + the Free Software Foundation, either version 2 of the License, or |
| 6 | + (at your option) any later version. |
| 7 | +
|
| 8 | + This program is distributed in the hope that it will be useful, |
| 9 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | + GNU General Public License for more details. |
| 12 | +
|
| 13 | + You should have received a copy of the GNU General Public License |
| 14 | + along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 15 | + |
| 16 | +#include <stdio.h> |
| 17 | +#include <unistd.h> |
| 18 | +#include <string.h> |
| 19 | +#include "dis.h" |
| 20 | + |
| 21 | +static int height; |
| 22 | + |
| 23 | +static void |
| 24 | +character (FILE *f) |
| 25 | +{ |
| 26 | + int row, column, width, bytes, words; |
| 27 | + word_t word; |
| 28 | + |
| 29 | + word = get_word (f); |
| 30 | + if (feof (f)) |
| 31 | + exit (0); |
| 32 | + fprintf (stderr, "USER ID: %012llo\n", word); |
| 33 | + word = get_word (f); |
| 34 | + fprintf (stderr, "LEFT KERN,,CODE: %06llo,,%06llo\n", |
| 35 | + word >> 18, word & 0777777); |
| 36 | + word = get_word (f); |
| 37 | + width = word >> 18; |
| 38 | + fprintf (stderr, "RASTER WIDTH,,CHARACTER WIDTH: %06llo,,%06llo\n", |
| 39 | + width, word & 0777777); |
| 40 | + |
| 41 | + bytes = (width + 7) / 8; |
| 42 | + words = (height * bytes + 3) / 4; |
| 43 | + |
| 44 | + for (column = 0; column < words; column++) |
| 45 | + { |
| 46 | + word = get_word (f); |
| 47 | + fprintf (stderr, "Data: %012llo\n", word); |
| 48 | + } |
| 49 | +} |
| 50 | + |
| 51 | +int |
| 52 | +main (int argc, char **argv) |
| 53 | +{ |
| 54 | + word_t word; |
| 55 | + |
| 56 | + word = get_word (stdin); |
| 57 | + fprintf (stderr, "KSTID: %012llo\n", word); |
| 58 | + word = get_word (stdin); |
| 59 | + height = word & 0777777; |
| 60 | + fprintf (stderr, "Column position adjustment: %03llo\n", word >> 27); |
| 61 | + fprintf (stderr, "Base line: %03llo\n", (word >> 18) & 0777); |
| 62 | + fprintf (stderr, "Character height: %06llo\n", height); |
| 63 | + |
| 64 | + for (;;) |
| 65 | + { |
| 66 | + character (stdin); |
| 67 | + } |
| 68 | + |
| 69 | + return 0; |
| 70 | +} |
0 commit comments