@@ -29,35 +29,60 @@ Author: Peter Schrammel
2929
3030void show_goto_functions (
3131 const namespacet &ns,
32+ message_handlert &message_handler,
3233 ui_message_handlert::uit ui,
33- const goto_functionst &goto_functions)
34+ const goto_functionst &goto_functions,
35+ bool list_only)
3436{
37+ messaget msg (message_handler);
3538 switch (ui)
3639 {
3740 case ui_message_handlert::uit::XML_UI:
3841 {
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);
4144 }
4245 break ;
4346
4447 case ui_message_handlert::uit::JSON_UI:
4548 {
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);
4851 }
4952 break ;
5053
5154 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+
5375 break ;
5476 }
5577}
5678
5779void show_goto_functions (
5880 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)
6084{
6185 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);
6388}
0 commit comments