-
Notifications
You must be signed in to change notification settings - Fork 4
/
renderer.h
122 lines (106 loc) · 2.16 KB
/
renderer.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#ifndef COMPILER_H
#define COMPILER_H
#include "parser.h"
#include "style.h"
#include "string.h"
#include <math.h>
extern char *prefix;
extern char *suffix;
#ifdef OPTS_SUP
extern bool printRaw;
#endif
#ifdef PYTHON_BINDING
#define LINE_BUF_CHUNK 50
#define LINE_BUF_PADDING 5
char **PY_list_result;
char *line_buffer;
int result_list_size = 0;
int buffer_size = 0;
int chunk_size = 0;
int failed_at = -1;
#endif
#define GET_LINE_M(from, to) \
(to - from) / 2 + from
typedef struct _coordinates
{
int x;
int y;
} Pos;
#define POS_INIT { .x = 0, .y = 0 }
struct arrow_def_coor
{
int top_padding;
Pos size;
Pos from;
Pos to;
};
struct group
{
Pos from;
Pos to;
char **cases;
int cases_num;
};
struct participant_render
{
int left_padding;
int right_padding;
int middle;
Pos from;
Pos word_size;
Pos to;
};
struct lifeline
{
Pos from;
Pos to;
};
struct seperater
{
int x;
};
typedef struct _area
{
char *title;
struct _header
{
#ifdef UTF_SUPPORT
char ***buffer;
#else
char **buffer;
#endif
Pos pos;
struct participant_render *participants;
} header;
struct _body
{
#ifdef UTF_SUPPORT
char ***buffer;
#else
char **buffer;
#endif
Pos pos;
int *e_s;
int l_p;
struct lifeline *lifelines;
struct group *groups;
struct arrow_def_coor *arrow_defs;
} body;
Pos pos;
} Area;
void render();
void render_test();
// debug
static inline void _debug_header_(Area *area)
{
for (int i = 0; i < participants.members_num; i++)
{
printf("participant '%s'\n", participants.members[i]->name->string);
printf("from -> x: %d, y: %d\n", area->header.participants[i].from.x, area->header.participants[i].from.y);
printf("to -> x: %d, y: %d\n", area->header.participants[i].to.x, area->header.participants[i].to.y);
printf("size -> x: %d, y: %d\n", area->header.participants[i].word_size.x, area->header.participants[i].word_size.y);
printf("============================\n");
}
printf("xpos -> x: %d, y: %d\n", area->header.pos.x, area->header.pos.y);
}
#endif