Use std::string in ui_out_table
[deliverable/binutils-gdb.git] / gdb / ui-out.c
1 /* Output generating routines for GDB.
2
3 Copyright (C) 1999-2016 Free Software Foundation, Inc.
4
5 Contributed by Cygnus Solutions.
6 Written by Fernando Nasser for Cygnus.
7
8 This file is part of GDB.
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22
23 #include "defs.h"
24 #include "expression.h" /* For language.h */
25 #include "language.h"
26 #include "ui-out.h"
27
28 #include <vector>
29 #include <memory>
30 #include <string>
31
32 /* table header structures */
33
34 struct ui_out_hdr
35 {
36 int colno;
37 int width;
38 enum ui_align alignment;
39 char *col_name;
40 char *colhdr;
41 struct ui_out_hdr *next;
42 };
43
44 struct ui_out_level
45 {
46 /* Count each field; the first element is for non-list fields. */
47 int field_count;
48 /* The type of this level. */
49 enum ui_out_type type;
50 };
51
52
53 /* Tables are special. Maintain a separate structure that tracks
54 their state. At present an output can only contain a single table
55 but that restriction might eventually be lifted. */
56
57 struct ui_out_table
58 {
59 /* If on, a table is being generated. */
60 int flag;
61
62 /* If on, the body of a table is being generated. If off, the table
63 header is being generated. */
64 int body_flag;
65
66 /* The level at which each entry of the table is to be found. A row
67 (a tuple) is made up of entries. Consequently ENTRY_LEVEL is one
68 above that of the table. */
69 int entry_level;
70
71 /* Number of table columns (as specified in the table_begin call). */
72 int columns;
73
74 /* String identifying the table (as specified in the table_begin
75 call). */
76 std::string id;
77
78 /* Points to the first table header (if any). */
79 struct ui_out_hdr *header_first;
80
81 /* Points to the last table header (if any). */
82 struct ui_out_hdr *header_last;
83
84 /* Points to header of NEXT column to format. */
85 struct ui_out_hdr *header_next;
86
87 };
88
89
90 /* The ui_out structure */
91
92 struct ui_out
93 {
94 int flags;
95 /* Specific implementation of ui-out. */
96 const struct ui_out_impl *impl;
97 void *data;
98
99 /* Current level. */
100 int level;
101
102 /* Vector to store and track the ui-out levels. */
103 std::vector<std::unique_ptr<ui_out_level>> levels;
104
105 /* A table, if any. At present only a single table is supported. */
106 struct ui_out_table table;
107 };
108
109 /* The current (inner most) level. */
110 static struct ui_out_level *
111 current_level (struct ui_out *uiout)
112 {
113 return uiout->levels[uiout->level].get ();
114 }
115
116 /* Create a new level, of TYPE. Return the new level's index. */
117 static int
118 push_level (struct ui_out *uiout,
119 enum ui_out_type type)
120 {
121 std::unique_ptr<ui_out_level> current (new ui_out_level ());
122
123 current->field_count = 0;
124 current->type = type;
125
126 uiout->level++;
127 uiout->levels.push_back (std::move (current));
128
129 return uiout->level;
130 }
131
132 /* Discard the current level, return the discarded level's index.
133 TYPE is the type of the level being discarded. */
134 static int
135 pop_level (struct ui_out *uiout,
136 enum ui_out_type type)
137 {
138 /* We had better not underflow the buffer. */
139 gdb_assert (uiout->level > 0);
140 gdb_assert (current_level (uiout)->type == type);
141
142 uiout->levels.pop_back ();
143 uiout->level--;
144
145 return uiout->level + 1;
146 }
147
148 /* These are the interfaces to implementation functions. */
149
150 static void uo_table_begin (struct ui_out *uiout, int nbrofcols,
151 int nr_rows, const char *tblid);
152 static void uo_table_body (struct ui_out *uiout);
153 static void uo_table_end (struct ui_out *uiout);
154 static void uo_table_header (struct ui_out *uiout, int width,
155 enum ui_align align, const char *col_name,
156 const char *colhdr);
157 static void uo_begin (struct ui_out *uiout,
158 enum ui_out_type type,
159 int level, const char *id);
160 static void uo_end (struct ui_out *uiout,
161 enum ui_out_type type,
162 int level);
163 static void uo_field_int (struct ui_out *uiout, int fldno, int width,
164 enum ui_align align, const char *fldname, int value);
165 static void uo_field_skip (struct ui_out *uiout, int fldno, int width,
166 enum ui_align align, const char *fldname);
167 static void uo_field_fmt (struct ui_out *uiout, int fldno, int width,
168 enum ui_align align, const char *fldname,
169 const char *format, va_list args)
170 ATTRIBUTE_PRINTF (6, 0);
171 static void uo_spaces (struct ui_out *uiout, int numspaces);
172 static void uo_text (struct ui_out *uiout, const char *string);
173 static void uo_message (struct ui_out *uiout,
174 const char *format, va_list args)
175 ATTRIBUTE_PRINTF (2, 0);
176 static void uo_wrap_hint (struct ui_out *uiout, const char *identstring);
177 static void uo_flush (struct ui_out *uiout);
178 static int uo_redirect (struct ui_out *uiout, struct ui_file *outstream);
179
180 /* Prototypes for local functions */
181
182 static void append_header_to_list (struct ui_out *uiout, int width,
183 enum ui_align alignment, const char *col_name,
184 const char *colhdr);
185 static int get_next_header (struct ui_out *uiout, int *colno, int *width,
186 enum ui_align *alignment, char **colhdr);
187 static void clear_header_list (struct ui_out *uiout);
188 static void clear_table (struct ui_out *uiout);
189 static void verify_field (struct ui_out *uiout, int *fldno, int *width,
190 enum ui_align *align);
191
192 /* exported functions (ui_out API) */
193
194 /* Mark beginning of a table. */
195
196 static void
197 ui_out_table_begin (struct ui_out *uiout, int nbrofcols,
198 int nr_rows, const std::string &tblid)
199 {
200 if (uiout->table.flag)
201 internal_error (__FILE__, __LINE__,
202 _("tables cannot be nested; table_begin found before \
203 previous table_end."));
204
205 uiout->table.flag = 1;
206 uiout->table.body_flag = 0;
207 uiout->table.entry_level = uiout->level + 1;
208 uiout->table.columns = nbrofcols;
209 uiout->table.id = tblid;
210
211 clear_header_list (uiout);
212
213 uo_table_begin (uiout, nbrofcols, nr_rows, uiout->table.id.c_str ());
214 }
215
216 void
217 ui_out_table_body (struct ui_out *uiout)
218 {
219 if (!uiout->table.flag)
220 internal_error (__FILE__, __LINE__,
221 _("table_body outside a table is not valid; it must be \
222 after a table_begin and before a table_end."));
223 if (uiout->table.body_flag)
224 internal_error (__FILE__, __LINE__,
225 _("extra table_body call not allowed; there must be \
226 only one table_body after a table_begin and before a table_end."));
227 if (uiout->table.header_next->colno != uiout->table.columns)
228 internal_error (__FILE__, __LINE__,
229 _("number of headers differ from number of table \
230 columns."));
231
232 uiout->table.body_flag = 1;
233 uiout->table.header_next = uiout->table.header_first;
234
235 uo_table_body (uiout);
236 }
237
238 static void
239 ui_out_table_end (struct ui_out *uiout)
240 {
241 if (!uiout->table.flag)
242 internal_error (__FILE__, __LINE__,
243 _("misplaced table_end or missing table_begin."));
244
245 uiout->table.entry_level = 0;
246 uiout->table.body_flag = 0;
247 uiout->table.flag = 0;
248
249 uo_table_end (uiout);
250 clear_table (uiout);
251 }
252
253 void
254 ui_out_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
255 const char *col_name,
256 const char *colhdr)
257 {
258 if (!uiout->table.flag || uiout->table.body_flag)
259 internal_error (__FILE__, __LINE__,
260 _("table header must be specified after table_begin \
261 and before table_body."));
262
263 append_header_to_list (uiout, width, alignment, col_name, colhdr);
264
265 uo_table_header (uiout, width, alignment, col_name, colhdr);
266 }
267
268 static void
269 do_cleanup_table_end (void *data)
270 {
271 struct ui_out *ui_out = (struct ui_out *) data;
272
273 ui_out_table_end (ui_out);
274 }
275
276 struct cleanup *
277 make_cleanup_ui_out_table_begin_end (struct ui_out *ui_out, int nr_cols,
278 int nr_rows, const char *tblid)
279 {
280 ui_out_table_begin (ui_out, nr_cols, nr_rows, tblid);
281 return make_cleanup (do_cleanup_table_end, ui_out);
282 }
283
284 void
285 ui_out_begin (struct ui_out *uiout,
286 enum ui_out_type type,
287 const char *id)
288 {
289 int new_level;
290
291 if (uiout->table.flag && !uiout->table.body_flag)
292 internal_error (__FILE__, __LINE__,
293 _("table header or table_body expected; lists must be \
294 specified after table_body."));
295
296 /* Be careful to verify the ``field'' before the new tuple/list is
297 pushed onto the stack. That way the containing list/table/row is
298 verified and not the newly created tuple/list. This verification
299 is needed (at least) for the case where a table row entry
300 contains either a tuple/list. For that case bookkeeping such as
301 updating the column count or advancing to the next heading still
302 needs to be performed. */
303 {
304 int fldno;
305 int width;
306 enum ui_align align;
307
308 verify_field (uiout, &fldno, &width, &align);
309 }
310
311 new_level = push_level (uiout, type);
312
313 /* If the push puts us at the same level as a table row entry, we've
314 got a new table row. Put the header pointer back to the start. */
315 if (uiout->table.body_flag
316 && uiout->table.entry_level == new_level)
317 uiout->table.header_next = uiout->table.header_first;
318
319 uo_begin (uiout, type, new_level, id);
320 }
321
322 void
323 ui_out_end (struct ui_out *uiout,
324 enum ui_out_type type)
325 {
326 int old_level = pop_level (uiout, type);
327
328 uo_end (uiout, type, old_level);
329 }
330
331 struct ui_out_end_cleanup_data
332 {
333 struct ui_out *uiout;
334 enum ui_out_type type;
335 };
336
337 static void
338 do_cleanup_end (void *data)
339 {
340 struct ui_out_end_cleanup_data *end_cleanup_data
341 = (struct ui_out_end_cleanup_data *) data;
342
343 ui_out_end (end_cleanup_data->uiout, end_cleanup_data->type);
344 xfree (end_cleanup_data);
345 }
346
347 static struct cleanup *
348 make_cleanup_ui_out_end (struct ui_out *uiout,
349 enum ui_out_type type)
350 {
351 struct ui_out_end_cleanup_data *end_cleanup_data;
352
353 end_cleanup_data = XNEW (struct ui_out_end_cleanup_data);
354 end_cleanup_data->uiout = uiout;
355 end_cleanup_data->type = type;
356 return make_cleanup (do_cleanup_end, end_cleanup_data);
357 }
358
359 struct cleanup *
360 make_cleanup_ui_out_tuple_begin_end (struct ui_out *uiout,
361 const char *id)
362 {
363 ui_out_begin (uiout, ui_out_type_tuple, id);
364 return make_cleanup_ui_out_end (uiout, ui_out_type_tuple);
365 }
366
367 struct cleanup *
368 make_cleanup_ui_out_list_begin_end (struct ui_out *uiout,
369 const char *id)
370 {
371 ui_out_begin (uiout, ui_out_type_list, id);
372 return make_cleanup_ui_out_end (uiout, ui_out_type_list);
373 }
374
375 void
376 ui_out_field_int (struct ui_out *uiout,
377 const char *fldname,
378 int value)
379 {
380 int fldno;
381 int width;
382 enum ui_align align;
383
384 verify_field (uiout, &fldno, &width, &align);
385
386 uo_field_int (uiout, fldno, width, align, fldname, value);
387 }
388
389 void
390 ui_out_field_fmt_int (struct ui_out *uiout,
391 int input_width,
392 enum ui_align input_align,
393 const char *fldname,
394 int value)
395 {
396 int fldno;
397 int width;
398 enum ui_align align;
399
400 verify_field (uiout, &fldno, &width, &align);
401
402 uo_field_int (uiout, fldno, input_width, input_align, fldname, value);
403 }
404
405 /* Documented in ui-out.h. */
406
407 void
408 ui_out_field_core_addr (struct ui_out *uiout,
409 const char *fldname,
410 struct gdbarch *gdbarch,
411 CORE_ADDR address)
412 {
413 ui_out_field_string (uiout, fldname,
414 print_core_address (gdbarch, address));
415 }
416
417 void
418 ui_out_field_stream (struct ui_out *uiout,
419 const char *fldname,
420 struct ui_file *stream)
421 {
422 std::string buffer = ui_file_as_string (stream);
423
424 if (!buffer.empty ())
425 ui_out_field_string (uiout, fldname, buffer.c_str ());
426 else
427 ui_out_field_skip (uiout, fldname);
428 ui_file_rewind (stream);
429 }
430
431 /* Used to omit a field. */
432
433 void
434 ui_out_field_skip (struct ui_out *uiout,
435 const char *fldname)
436 {
437 int fldno;
438 int width;
439 enum ui_align align;
440
441 verify_field (uiout, &fldno, &width, &align);
442
443 uo_field_skip (uiout, fldno, width, align, fldname);
444 }
445
446 void
447 ui_out_field_string (struct ui_out *uiout,
448 const char *fldname,
449 const char *string)
450 {
451 int fldno;
452 int width;
453 enum ui_align align;
454
455 verify_field (uiout, &fldno, &width, &align);
456
457 uo_field_string (uiout, fldno, width, align, fldname, string);
458 }
459
460 /* VARARGS */
461 void
462 ui_out_field_fmt (struct ui_out *uiout,
463 const char *fldname,
464 const char *format, ...)
465 {
466 va_list args;
467 int fldno;
468 int width;
469 enum ui_align align;
470
471 /* Will not align, but has to call anyway. */
472 verify_field (uiout, &fldno, &width, &align);
473
474 va_start (args, format);
475
476 uo_field_fmt (uiout, fldno, width, align, fldname, format, args);
477
478 va_end (args);
479 }
480
481 void
482 ui_out_spaces (struct ui_out *uiout, int numspaces)
483 {
484 uo_spaces (uiout, numspaces);
485 }
486
487 void
488 ui_out_text (struct ui_out *uiout,
489 const char *string)
490 {
491 uo_text (uiout, string);
492 }
493
494 void
495 ui_out_message (struct ui_out *uiout, const char *format, ...)
496 {
497 va_list args;
498
499 va_start (args, format);
500 uo_message (uiout, format, args);
501 va_end (args);
502 }
503
504 void
505 ui_out_wrap_hint (struct ui_out *uiout, const char *identstring)
506 {
507 uo_wrap_hint (uiout, identstring);
508 }
509
510 void
511 ui_out_flush (struct ui_out *uiout)
512 {
513 uo_flush (uiout);
514 }
515
516 int
517 ui_out_redirect (struct ui_out *uiout, struct ui_file *outstream)
518 {
519 return uo_redirect (uiout, outstream);
520 }
521
522 /* Test the flags against the mask given. */
523 int
524 ui_out_test_flags (struct ui_out *uiout, int mask)
525 {
526 return (uiout->flags & mask);
527 }
528
529 int
530 ui_out_is_mi_like_p (struct ui_out *uiout)
531 {
532 return uiout->impl->is_mi_like_p;
533 }
534
535 /* Interface to the implementation functions. */
536
537 void
538 uo_table_begin (struct ui_out *uiout, int nbrofcols,
539 int nr_rows,
540 const char *tblid)
541 {
542 if (!uiout->impl->table_begin)
543 return;
544 uiout->impl->table_begin (uiout, nbrofcols, nr_rows, tblid);
545 }
546
547 void
548 uo_table_body (struct ui_out *uiout)
549 {
550 if (!uiout->impl->table_body)
551 return;
552 uiout->impl->table_body (uiout);
553 }
554
555 void
556 uo_table_end (struct ui_out *uiout)
557 {
558 if (!uiout->impl->table_end)
559 return;
560 uiout->impl->table_end (uiout);
561 }
562
563 void
564 uo_table_header (struct ui_out *uiout, int width, enum ui_align align,
565 const char *col_name,
566 const char *colhdr)
567 {
568 if (!uiout->impl->table_header)
569 return;
570 uiout->impl->table_header (uiout, width, align, col_name, colhdr);
571 }
572
573 /* Clear the table associated with UIOUT. */
574
575 static void
576 clear_table (struct ui_out *uiout)
577 {
578 uiout->table.id.clear ();
579 clear_header_list (uiout);
580 }
581
582 void
583 uo_begin (struct ui_out *uiout,
584 enum ui_out_type type,
585 int level,
586 const char *id)
587 {
588 if (uiout->impl->begin == NULL)
589 return;
590 uiout->impl->begin (uiout, type, level, id);
591 }
592
593 void
594 uo_end (struct ui_out *uiout,
595 enum ui_out_type type,
596 int level)
597 {
598 if (uiout->impl->end == NULL)
599 return;
600 uiout->impl->end (uiout, type, level);
601 }
602
603 void
604 uo_field_int (struct ui_out *uiout, int fldno, int width, enum ui_align align,
605 const char *fldname,
606 int value)
607 {
608 if (!uiout->impl->field_int)
609 return;
610 uiout->impl->field_int (uiout, fldno, width, align, fldname, value);
611 }
612
613 void
614 uo_field_skip (struct ui_out *uiout, int fldno, int width, enum ui_align align,
615 const char *fldname)
616 {
617 if (!uiout->impl->field_skip)
618 return;
619 uiout->impl->field_skip (uiout, fldno, width, align, fldname);
620 }
621
622 void
623 uo_field_string (struct ui_out *uiout, int fldno, int width,
624 enum ui_align align,
625 const char *fldname,
626 const char *string)
627 {
628 if (!uiout->impl->field_string)
629 return;
630 uiout->impl->field_string (uiout, fldno, width, align, fldname, string);
631 }
632
633 void
634 uo_field_fmt (struct ui_out *uiout, int fldno, int width, enum ui_align align,
635 const char *fldname,
636 const char *format,
637 va_list args)
638 {
639 if (!uiout->impl->field_fmt)
640 return;
641 uiout->impl->field_fmt (uiout, fldno, width, align, fldname, format, args);
642 }
643
644 void
645 uo_spaces (struct ui_out *uiout, int numspaces)
646 {
647 if (!uiout->impl->spaces)
648 return;
649 uiout->impl->spaces (uiout, numspaces);
650 }
651
652 void
653 uo_text (struct ui_out *uiout,
654 const char *string)
655 {
656 if (!uiout->impl->text)
657 return;
658 uiout->impl->text (uiout, string);
659 }
660
661 void
662 uo_message (struct ui_out *uiout,
663 const char *format,
664 va_list args)
665 {
666 if (!uiout->impl->message)
667 return;
668 uiout->impl->message (uiout, format, args);
669 }
670
671 void
672 uo_wrap_hint (struct ui_out *uiout, const char *identstring)
673 {
674 if (!uiout->impl->wrap_hint)
675 return;
676 uiout->impl->wrap_hint (uiout, identstring);
677 }
678
679 void
680 uo_flush (struct ui_out *uiout)
681 {
682 if (!uiout->impl->flush)
683 return;
684 uiout->impl->flush (uiout);
685 }
686
687 int
688 uo_redirect (struct ui_out *uiout, struct ui_file *outstream)
689 {
690 if (!uiout->impl->redirect)
691 return -1;
692 return uiout->impl->redirect (uiout, outstream);
693 }
694
695 /* local functions */
696
697 /* List of column headers manipulation routines. */
698
699 static void
700 clear_header_list (struct ui_out *uiout)
701 {
702 while (uiout->table.header_first != NULL)
703 {
704 uiout->table.header_next = uiout->table.header_first;
705 uiout->table.header_first = uiout->table.header_first->next;
706 xfree (uiout->table.header_next->colhdr);
707 xfree (uiout->table.header_next->col_name);
708 delete uiout->table.header_next;
709 }
710
711 gdb_assert (uiout->table.header_first == NULL);
712 uiout->table.header_last = NULL;
713 uiout->table.header_next = NULL;
714 }
715
716 static void
717 append_header_to_list (struct ui_out *uiout,
718 int width,
719 enum ui_align alignment,
720 const char *col_name,
721 const char *colhdr)
722 {
723 struct ui_out_hdr *temphdr;
724
725 temphdr = new ui_out_hdr ();
726 temphdr->width = width;
727 temphdr->alignment = alignment;
728 /* We have to copy the column title as the original may be an
729 automatic. */
730 if (colhdr != NULL)
731 temphdr->colhdr = xstrdup (colhdr);
732 else
733 temphdr->colhdr = NULL;
734
735 if (col_name != NULL)
736 temphdr->col_name = xstrdup (col_name);
737 else if (colhdr != NULL)
738 temphdr->col_name = xstrdup (colhdr);
739 else
740 temphdr->col_name = NULL;
741
742 temphdr->next = NULL;
743 if (uiout->table.header_first == NULL)
744 {
745 temphdr->colno = 1;
746 uiout->table.header_first = temphdr;
747 uiout->table.header_last = temphdr;
748 }
749 else
750 {
751 temphdr->colno = uiout->table.header_last->colno + 1;
752 uiout->table.header_last->next = temphdr;
753 uiout->table.header_last = temphdr;
754 }
755 uiout->table.header_next = uiout->table.header_last;
756 }
757
758 /* Extract the format information for the NEXT header and advance
759 the header pointer. Return 0 if there was no next header. */
760
761 static int
762 get_next_header (struct ui_out *uiout,
763 int *colno,
764 int *width,
765 enum ui_align *alignment,
766 char **colhdr)
767 {
768 /* There may be no headers at all or we may have used all columns. */
769 if (uiout->table.header_next == NULL)
770 return 0;
771 *colno = uiout->table.header_next->colno;
772 *width = uiout->table.header_next->width;
773 *alignment = uiout->table.header_next->alignment;
774 *colhdr = uiout->table.header_next->colhdr;
775 /* Advance the header pointer to the next entry. */
776 uiout->table.header_next = uiout->table.header_next->next;
777 return 1;
778 }
779
780
781 /* Verify that the field/tuple/list is correctly positioned. Return
782 the field number and corresponding alignment (if
783 available/applicable). */
784
785 static void
786 verify_field (struct ui_out *uiout, int *fldno, int *width,
787 enum ui_align *align)
788 {
789 struct ui_out_level *current = current_level (uiout);
790 char *text;
791
792 if (uiout->table.flag)
793 {
794 if (!uiout->table.body_flag)
795 internal_error (__FILE__, __LINE__,
796 _("table_body missing; table fields must be \
797 specified after table_body and inside a list."));
798 /* NOTE: cagney/2001-12-08: There was a check here to ensure
799 that this code was only executed when uiout->level was
800 greater than zero. That no longer applies - this code is run
801 before each table row tuple is started and at that point the
802 level is zero. */
803 }
804
805 current->field_count += 1;
806
807 if (uiout->table.body_flag
808 && uiout->table.entry_level == uiout->level
809 && get_next_header (uiout, fldno, width, align, &text))
810 {
811 if (*fldno != current->field_count)
812 internal_error (__FILE__, __LINE__,
813 _("ui-out internal error in handling headers."));
814 }
815 else
816 {
817 *width = 0;
818 *align = ui_noalign;
819 *fldno = current->field_count;
820 }
821 }
822
823
824 /* Access to ui-out members data. */
825
826 void *
827 ui_out_data (struct ui_out *uiout)
828 {
829 return uiout->data;
830 }
831
832 /* Access table field parameters. */
833 int
834 ui_out_query_field (struct ui_out *uiout, int colno,
835 int *width, int *alignment, char **col_name)
836 {
837 struct ui_out_hdr *hdr;
838
839 if (!uiout->table.flag)
840 return 0;
841
842 for (hdr = uiout->table.header_first; hdr; hdr = hdr->next)
843 if (hdr->colno == colno)
844 {
845 *width = hdr->width;
846 *alignment = hdr->alignment;
847 *col_name = hdr->col_name;
848 return 1;
849 }
850
851 return 0;
852 }
853
854 /* Initialize private members at startup. */
855
856 struct ui_out *
857 ui_out_new (const struct ui_out_impl *impl, void *data,
858 int flags)
859 {
860 struct ui_out *uiout = new ui_out ();
861 std::unique_ptr<ui_out_level> current (new ui_out_level ());
862
863 uiout->data = data;
864 uiout->impl = impl;
865 uiout->flags = flags;
866 uiout->table.flag = 0;
867 uiout->table.body_flag = 0;
868 uiout->level = 0;
869
870 /* Create uiout->level 0, the default level. */
871 current->type = ui_out_type_tuple;
872 current->field_count = 0;
873 uiout->levels.push_back (std::move (current));
874
875 uiout->table.header_first = NULL;
876 uiout->table.header_last = NULL;
877 uiout->table.header_next = NULL;
878 return uiout;
879 }
This page took 0.051446 seconds and 5 git commands to generate.