@@ -29,35 +29,60 @@ Author: Peter Schrammel
29
29
30
30
void show_goto_functions (
31
31
const namespacet &ns,
32
+ message_handlert &message_handler,
32
33
ui_message_handlert::uit ui,
33
- const goto_functionst &goto_functions)
34
+ const goto_functionst &goto_functions,
35
+ bool list_only)
34
36
{
37
+ messaget msg (message_handler);
35
38
switch (ui)
36
39
{
37
40
case ui_message_handlert::uit::XML_UI:
38
41
{
39
- show_goto_functions_xmlt xml_show_functions (ns);
40
- xml_show_functions (goto_functions, std::cout );
42
+ show_goto_functions_xmlt xml_show_functions (ns, list_only );
43
+ msg. status () << xml_show_functions. convert (goto_functions);
41
44
}
42
45
break ;
43
46
44
47
case ui_message_handlert::uit::JSON_UI:
45
48
{
46
- show_goto_functions_jsont json_show_functions (ns);
47
- json_show_functions (goto_functions, std::cout );
49
+ show_goto_functions_jsont json_show_functions (ns, list_only );
50
+ msg. status () << json_show_functions. convert (goto_functions);
48
51
}
49
52
break ;
50
53
51
54
case ui_message_handlert::uit::PLAIN:
52
- goto_functions.output (ns, std::cout);
55
+ if (list_only)
56
+ {
57
+ for (const auto &fun : goto_functions.function_map )
58
+ {
59
+ const symbolt &symbol = ns.lookup (fun.first );
60
+ msg.status () << ' \n '
61
+ << symbol.display_name () << " /* " << symbol.name
62
+ << (fun.second .body_available () ? " "
63
+ : " , body not available" )
64
+ << " */" ;
65
+ }
66
+
67
+ msg.status () << messaget::eom;
68
+ }
69
+ else
70
+ {
71
+ goto_functions.output (ns, msg.status ());
72
+ msg.status () << messaget::eom;
73
+ }
74
+
53
75
break ;
54
76
}
55
77
}
56
78
57
79
void show_goto_functions (
58
80
const goto_modelt &goto_model,
59
- ui_message_handlert::uit ui)
81
+ message_handlert &message_handler,
82
+ ui_message_handlert::uit ui,
83
+ bool list_only)
60
84
{
61
85
const namespacet ns (goto_model.symbol_table );
62
- show_goto_functions (ns, ui, goto_model.goto_functions );
86
+ show_goto_functions (
87
+ ns, message_handler, ui, goto_model.goto_functions , list_only);
63
88
}
0 commit comments