aboutsummaryrefslogtreecommitdiff
path: root/pk/logo.c
blob: 8f868e87b63c01790ce8b8b54393bbc20823afc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <string.h>
#include "file.h"

#define W 46
#define D 21
#define T 5

void print_logo()
{
  static const char end[] = "\n       INSTRUCTION SETS WANT TO BE FREE\n\n";
  static const char fill[T] = {'r', ' ', 'v', ' ', 'r'};
  static const char logo[D][T] =
   {{0, 14, 46, 46, 46},
    {0, 18, 46, 46, 46},
    {13, 20, 46, 46, 46},
    {16, 22, 46, 46, 46},
    {18, 22, 46, 46, 46},
    {18, 22, 46, 46, 46},
    {18, 22, 46, 46, 46},
    {16, 22, 44, 46, 46},
    {13, 20, 42, 46, 46},
    {2, 18, 40, 46, 46},
    {2, 14, 38, 44, 46},
    {4, 10, 36, 42, 46},
    {6, 12, 34, 40, 46},
    {8, 14, 32, 38, 46},
    {10, 16, 30, 36, 46},
    {12, 18, 28, 34, 46},
    {14, 20, 26, 32, 46},
    {16, 22, 24, 30, 46},
    {18, 22, 22, 28, 46},
    {20, 20, 20, 26, 46},
    {22, 22, 22, 24, 46}};

  char result[D*(W+1) + sizeof(end)];
  char* pos = result;
  for (size_t i = 0; i < D; i++) {
    for (size_t j = 0, p = 0; j < T; j++) {
      if (p == logo[i][j])
        continue;
      do {
        *pos++ = fill[j];
        p++;
      } while (p < logo[i][j]);
    }
    *pos++ = '\n';
  }
  memcpy(pos, end, sizeof(end));

  file_write(stderr, result, (pos - result) + sizeof(end));
}