summaryrefslogtreecommitdiff
path: root/src/user/mkpopup/main.cpp
blob: 8b3746cce740129e9c59291915a0b5e1167a7f12 (plain) (blame)
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
#include <raleigh/w/padding.h>
#include <raleigh/w/label.h>
#include <raleigh/window.h>

using namespace raleigh;

void main(const char *text) {
  char *unescaped = new char[strlen(text) + 1];
  char *ui = unescaped;
  while (1) {
    const uint32_t len = str_find_any(text, "\\");
    if (len) {
      blockcpy(ui, text, len);
      text += len;
      ui += len;
    }
    if (!*text)
      break;
    if (text[1] == 'n') {
      *(ui++) = '\n';
      text += 2;
    }
    else {
      *(ui++) = '\\';
      ++text;
    }
  }
  *ui = '\0';

  label l(unescaped);
  delete[] unescaped;
  padding p(l, 4);
  window w(p);

  w.show();
  start_runtime();
}