@@ -92,69 +92,6 @@ class Address;
92
92
using namespace lldb ;
93
93
using namespace lldb_private ;
94
94
95
- inline std::string FormatAnsiTerminalCodes (const char *format,
96
- bool do_color = true ) {
97
- // Convert "${ansi.XXX}" tokens to ansi values or clear them if do_color is
98
- // false.
99
- static const struct {
100
- const char *name;
101
- const char *value;
102
- } g_color_tokens[] = {
103
- {" fg.black}" , ANSI_ESCAPE1 (ANSI_FG_COLOR_BLACK)},
104
- {" fg.red}" , ANSI_ESCAPE1 (ANSI_FG_COLOR_RED)},
105
- {" fg.green}" , ANSI_ESCAPE1 (ANSI_FG_COLOR_GREEN)},
106
- {" fg.yellow}" , ANSI_ESCAPE1 (ANSI_FG_COLOR_YELLOW)},
107
- {" fg.blue}" , ANSI_ESCAPE1 (ANSI_FG_COLOR_BLUE)},
108
- {" fg.purple}" , ANSI_ESCAPE1 (ANSI_FG_COLOR_PURPLE)},
109
- {" fg.cyan}" , ANSI_ESCAPE1 (ANSI_FG_COLOR_CYAN)},
110
- {" fg.white}" , ANSI_ESCAPE1 (ANSI_FG_COLOR_WHITE)},
111
- {" bg.black}" , ANSI_ESCAPE1 (ANSI_BG_COLOR_BLACK)},
112
- {" bg.red}" , ANSI_ESCAPE1 (ANSI_BG_COLOR_RED)},
113
- {" bg.green}" , ANSI_ESCAPE1 (ANSI_BG_COLOR_GREEN)},
114
- {" bg.yellow}" , ANSI_ESCAPE1 (ANSI_BG_COLOR_YELLOW)},
115
- {" bg.blue}" , ANSI_ESCAPE1 (ANSI_BG_COLOR_BLUE)},
116
- {" bg.purple}" , ANSI_ESCAPE1 (ANSI_BG_COLOR_PURPLE)},
117
- {" bg.cyan}" , ANSI_ESCAPE1 (ANSI_BG_COLOR_CYAN)},
118
- {" bg.white}" , ANSI_ESCAPE1 (ANSI_BG_COLOR_WHITE)},
119
- {" normal}" , ANSI_ESCAPE1 (ANSI_CTRL_NORMAL)},
120
- {" bold}" , ANSI_ESCAPE1 (ANSI_CTRL_BOLD)},
121
- {" faint}" , ANSI_ESCAPE1 (ANSI_CTRL_FAINT)},
122
- {" italic}" , ANSI_ESCAPE1 (ANSI_CTRL_ITALIC)},
123
- {" underline}" , ANSI_ESCAPE1 (ANSI_CTRL_UNDERLINE)},
124
- {" slow-blink}" , ANSI_ESCAPE1 (ANSI_CTRL_SLOW_BLINK)},
125
- {" fast-blink}" , ANSI_ESCAPE1 (ANSI_CTRL_FAST_BLINK)},
126
- {" negative}" , ANSI_ESCAPE1 (ANSI_CTRL_IMAGE_NEGATIVE)},
127
- {" conceal}" , ANSI_ESCAPE1 (ANSI_CTRL_CONCEAL)},
128
- {" crossed-out}" , ANSI_ESCAPE1 (ANSI_CTRL_CROSSED_OUT)},
129
- };
130
- static const char tok_hdr[] = " ${ansi." ;
131
-
132
- std::string fmt;
133
- for (const char *p = format; *p; ++p) {
134
- const char *tok_start = strstr (p, tok_hdr);
135
- if (!tok_start) {
136
- fmt.append (p, strlen (p));
137
- break ;
138
- }
139
-
140
- fmt.append (p, tok_start - p);
141
- p = tok_start;
142
-
143
- const char *tok_str = tok_start + sizeof (tok_hdr) - 1 ;
144
- for (size_t i = 0 ; i < sizeof (g_color_tokens) / sizeof (g_color_tokens[0 ]);
145
- ++i) {
146
- if (!strncmp (tok_str, g_color_tokens[i].name ,
147
- strlen (g_color_tokens[i].name ))) {
148
- if (do_color)
149
- fmt.append (g_color_tokens[i].value );
150
- p = tok_str + strlen (g_color_tokens[i].name ) - 1 ;
151
- break ;
152
- }
153
- }
154
- }
155
- return fmt;
156
- }
157
-
158
95
static lldb::user_id_t g_unique_id = 1 ;
159
96
static size_t g_debugger_event_thread_stack_bytes = 8 * 1024 * 1024 ;
160
97
0 commit comments