@@ -19,15 +19,12 @@ Author: CM Wintersteiger
1919
2020#include < goto-programs/goto_model.h>
2121
22- // / Writes a goto program to disc, using goto binary format
23- bool write_goto_binary (
22+ // / Writes the symbol table to file.
23+ static void write_symbol_table_binary (
2424 std::ostream &out,
2525 const symbol_table_baset &symbol_table,
26- const goto_functionst &goto_functions,
2726 irep_serializationt &irepconverter)
2827{
29- // first write symbol table
30-
3128 write_gb_word (out, symbol_table.symbols .size ());
3229
3330 for (const auto &symbol_pair : symbol_table.symbols )
@@ -70,9 +67,14 @@ bool write_goto_binary(
7067
7168 write_gb_word (out, flags);
7269 }
70+ }
7371
74- // now write functions, but only those with body
75-
72+ // / Writes the functions to file, but only those with non-empty body.
73+ static void write_goto_functions_binary (
74+ std::ostream &out,
75+ const goto_functionst &goto_functions,
76+ irep_serializationt &irepconverter)
77+ {
7678 unsigned cnt=0 ;
7779 for (const auto &gf_entry : goto_functions.function_map )
7880 {
@@ -116,6 +118,17 @@ bool write_goto_binary(
116118 }
117119 }
118120 }
121+ }
122+
123+ // / Writes a goto program to disc, using goto binary format
124+ bool write_goto_binary (
125+ std::ostream &out,
126+ const symbol_table_baset &symbol_table,
127+ const goto_functionst &goto_functions,
128+ irep_serializationt &irepconverter)
129+ {
130+ write_symbol_table_binary (out, symbol_table, irepconverter);
131+ write_goto_functions_binary (out, goto_functions, irepconverter);
119132
120133 // irepconverter.output_map(f);
121134 // irepconverter.output_string_map(f);
0 commit comments