Line |
Branch |
Exec |
Source |
1 |
|
|
#ifndef TEST_SIZES_H |
2 |
|
|
#define TEST_SIZES_H |
3 |
|
|
|
4 |
|
|
#include "command/cache.h" |
5 |
|
|
#include "command/run.h" |
6 |
|
|
#include "compiler.h" |
7 |
|
|
#include "editor.h" |
8 |
|
|
#include "editorconfig/editorconfig.h" |
9 |
|
|
#include "editorconfig/ini.h" |
10 |
|
|
#include "indent.h" |
11 |
|
|
#include "load-save.h" |
12 |
|
|
#include "regexp.h" |
13 |
|
|
#include "selection.h" |
14 |
|
|
#include "spawn.h" |
15 |
|
|
#include "syntax/syntax.h" |
16 |
|
|
#include "terminal/parse.h" |
17 |
|
|
#include "terminal/terminal.h" |
18 |
|
|
#include "ui.h" |
19 |
|
|
#include "util/exitcode.h" |
20 |
|
|
|
21 |
|
|
#define entry(type, level) { \ |
22 |
|
|
.name = #type, \ |
23 |
|
|
.size = sizeof(type), \ |
24 |
|
|
.indent_level = level \ |
25 |
|
|
} |
26 |
|
|
|
27 |
|
|
#define S(type) entry(type, 0) |
28 |
|
|
#define S1(type) entry(type, 1) |
29 |
|
|
#define S2(type) entry(type, 2) |
30 |
|
|
#define DIVIDER {NULL, 0, 0} |
31 |
|
|
|
32 |
|
|
static const struct { |
33 |
|
|
const char *name; |
34 |
|
|
unsigned int size; |
35 |
|
|
uint8_t indent_level; |
36 |
|
|
} ssizes[] = { |
37 |
|
|
S(EditorState), |
38 |
|
|
S1(Terminal), |
39 |
|
|
S2(TermOutputBuffer), |
40 |
|
|
S2(TermInputBuffer), |
41 |
|
|
S1(ErrorBuffer), |
42 |
|
|
S1(StyleMap), |
43 |
|
|
S2(TermStyle), |
44 |
|
|
S1(CommandLine), |
45 |
|
|
S2(CompletionState), |
46 |
|
|
S1(Clipboard), |
47 |
|
|
S1(FileHistory), |
48 |
|
|
S1(FileLocksContext), |
49 |
|
|
S1(GlobalOptions), |
50 |
|
|
S1(History), |
51 |
|
|
S1(MacroRecorder), |
52 |
|
|
S1(MessageList), |
53 |
|
|
S1(ModeHandler), |
54 |
|
|
S1(SearchState), |
55 |
|
|
S1(SyntaxLoader), |
56 |
|
|
S1(TagFile), |
57 |
|
|
|
58 |
|
|
DIVIDER, |
59 |
|
|
S(Buffer), |
60 |
|
|
S1(FileInfo), |
61 |
|
|
S1(Change), |
62 |
|
|
S1(LocalOptions), |
63 |
|
|
|
64 |
|
|
DIVIDER, |
65 |
|
|
S(View), |
66 |
|
|
S1(BlockIter), |
67 |
|
|
|
68 |
|
|
DIVIDER, |
69 |
|
|
S(Window), |
70 |
|
|
S(Frame), |
71 |
|
|
S(Block), |
72 |
|
|
|
73 |
|
|
DIVIDER, |
74 |
|
|
S(Command), |
75 |
|
|
S(CachedCommand), |
76 |
|
|
S1(CommandArgs), |
77 |
|
|
S(CommandRunner), |
78 |
|
|
S(CommandSet), |
79 |
|
|
|
80 |
|
|
DIVIDER, |
81 |
|
|
S(Syntax), |
82 |
|
|
S(State), |
83 |
|
|
S(Condition), |
84 |
|
|
S1(ConditionData), |
85 |
|
|
S1(Action), |
86 |
|
|
S(HeredocState), |
87 |
|
|
S(StringList), |
88 |
|
|
|
89 |
|
|
DIVIDER, |
90 |
|
|
S(Compiler), |
91 |
|
|
S(EditorConfigOptions), |
92 |
|
|
S(ErrorFormat), |
93 |
|
|
S(FileHistoryEntry), |
94 |
|
|
S(FileLocation), |
95 |
|
|
S(FileSaveContext), |
96 |
|
|
S(HistoryEntry), |
97 |
|
|
S(IndentInfo), |
98 |
|
|
S(IniParser), |
99 |
|
|
S(InternedRegexp), |
100 |
|
|
S1(regex_t), |
101 |
|
|
S(Message), |
102 |
|
|
S(ScreenState), |
103 |
|
|
S(SelectionInfo), |
104 |
|
|
S(SpawnContext), |
105 |
|
|
S(Tag), |
106 |
|
|
S(TermControlParams), |
107 |
|
|
S(TermCursorStyle), |
108 |
|
|
}; |
109 |
|
|
|
110 |
|
|
/* |
111 |
|
|
For a list of typedef'd struct names, see: |
112 |
|
|
|
113 |
|
|
make tags && readtags -lF '(if |
114 |
|
|
(and (eq? $kind "t") (prefix? $typeref "struct")) |
115 |
|
|
(list $name #t) |
116 |
|
|
#f |
117 |
|
|
)' |
118 |
|
|
|
119 |
|
|
See also: |
120 |
|
|
• make print-struct-sizes |
121 |
|
|
• build/test/test -h |
122 |
|
|
• build/test/test -s |
123 |
|
|
*/ |
124 |
|
|
|
125 |
|
✗ |
static inline ExitCode print_struct_sizes(void) |
126 |
|
|
{ |
127 |
|
✗ |
puts ( |
128 |
|
|
"\n" |
129 |
|
|
"---------------------------------\n" |
130 |
|
|
" Struct Size\n" |
131 |
|
|
"---------------------------------" |
132 |
|
|
); |
133 |
|
|
|
134 |
|
✗ |
for (size_t i = 0; i < ARRAYLEN(ssizes); i++) { |
135 |
|
✗ |
const char *name = ssizes[i].name; |
136 |
|
✗ |
int indent = 3 * ssizes[i].indent_level; |
137 |
|
✗ |
if (name) { |
138 |
|
✗ |
printf("%*s %-*s %5u\n", indent, "", 24 - indent, name, ssizes[i].size); |
139 |
|
|
} else { |
140 |
|
✗ |
putchar('\n'); |
141 |
|
|
} |
142 |
|
|
} |
143 |
|
|
|
144 |
|
✗ |
putchar('\n'); |
145 |
|
✗ |
return EC_OK; |
146 |
|
|
} |
147 |
|
|
|
148 |
|
|
#endif |
149 |
|
|
|