@@ -1011,7 +1011,7 @@ static exprt get_array(
1011
1011
// / should only be used for debugging.
1012
1012
// / \par parameters: a constant array expression and a integer expression
1013
1013
// / \return a string
1014
- std::string string_refinementt:: string_of_array (const array_exprt &arr)
1014
+ static std::string string_of_array (const array_exprt &arr)
1015
1015
{
1016
1016
unsigned n;
1017
1017
if (arr.type ().id ()!=ID_array)
@@ -1025,39 +1025,44 @@ std::string string_refinementt::string_of_array(const array_exprt &arr)
1025
1025
1026
1026
// / Display part of the current model by mapping the variables created by the
1027
1027
// / solver to constant expressions given by the current model
1028
- void string_refinementt::debug_model ()
1028
+ void debug_model (
1029
+ const replace_mapt &symbol_resolve,
1030
+ messaget::mstreamt &stream,
1031
+ const namespacet &ns,
1032
+ std::size_t max_string_length,
1033
+ std::function<exprt(const exprt&)> super_get,
1034
+ const std::vector<symbol_exprt> &boolean_symbols,
1035
+ const std::vector<symbol_exprt> &index_symbols)
1029
1036
{
1030
- const auto super_get = [this ](const exprt& expr) {
1031
- return supert::get (expr);
1032
- };
1037
+ const auto eom = messaget::eom;
1033
1038
const std::string indent (" " );
1034
1039
for (auto it : symbol_resolve)
1035
1040
{
1036
1041
if (const auto refined=expr_cast<string_exprt>(it.second ))
1037
1042
{
1038
- debug () << " - " << from_expr (ns, " " , to_symbol_expr (it.first )) << " :\n " ;
1039
- debug () << indent << indent << " in_map: "
1040
- << from_expr (ns, " " , *refined) << eom;
1041
- debug () << indent << indent << " resolved: "
1042
- << from_expr (ns, " " , *refined) << eom;
1043
+ stream << " - " << from_expr (ns, " " , to_symbol_expr (it.first )) << " :\n " ;
1044
+ stream << indent << indent << " in_map: "
1045
+ << from_expr (ns, " " , *refined) << eom;
1046
+ stream << indent << indent << " resolved: "
1047
+ << from_expr (ns, " " , *refined) << eom;
1043
1048
const exprt &econtent=refined->content ();
1044
1049
const exprt &elength=refined->length ();
1045
1050
1046
- exprt len=supert::get (elength);
1051
+ exprt len=super_get (elength);
1047
1052
len=simplify_expr (len, ns);
1048
1053
const exprt arr=get_array (
1049
1054
super_get,
1050
1055
ns,
1051
- generator. max_string_length ,
1056
+ max_string_length,
1052
1057
econtent, len);
1053
1058
if (arr.id ()==ID_array)
1054
- debug () << indent << indent << " as_string: \" "
1055
- << string_of_array (to_array_expr (arr)) << " \"\n " ;
1059
+ stream << indent << indent << " as_string: \" "
1060
+ << string_of_array (to_array_expr (arr)) << " \"\n " ;
1056
1061
else
1057
- debug () << indent << indent << " as_char_array: "
1058
- << from_expr (ns, " " , arr) << " \n " ;
1062
+ stream << indent << indent << " as_char_array: "
1063
+ << from_expr (ns, " " , arr) << " \n " ;
1059
1064
1060
- debug () << indent << indent << " size: " << from_expr (ns, " " , len) << eom;
1065
+ stream << indent << indent << " size: " << from_expr (ns, " " , len) << eom;
1061
1066
}
1062
1067
else
1063
1068
{
@@ -1068,25 +1073,25 @@ void string_refinementt::debug_model()
1068
1073
" handled" ));
1069
1074
exprt arr=it.second ;
1070
1075
replace_expr (symbol_resolve, arr);
1071
- debug () << " - " << from_expr (ns, " " , to_symbol_expr (it.first )) << " :\n " ;
1072
- debug () << indent << indent << " resolved: "
1076
+ stream << " - " << from_expr (ns, " " , to_symbol_expr (it.first )) << " :\n " ;
1077
+ stream << indent << indent << " resolved: "
1073
1078
<< from_expr (ns, " " , arr) << " \n " ;
1074
1079
exprt arr_model=get_array (super_get, arr);
1075
- debug () << indent << indent << " char_array: "
1076
- << from_expr (ns, " " , arr_model) << eom;
1080
+ stream << indent << indent << " char_array: "
1081
+ << from_expr (ns, " " , arr_model) << eom;
1077
1082
}
1078
1083
}
1079
1084
1080
- for (const auto it : generator. get_boolean_symbols () )
1085
+ for (const auto it : boolean_symbols )
1081
1086
{
1082
- debug () << " - " << it.get_identifier () << " : "
1083
- << from_expr (ns, " " , supert::get (it)) << eom;
1087
+ stream << " - " << it.get_identifier () << " : "
1088
+ << from_expr (ns, " " , super_get (it)) << eom;
1084
1089
}
1085
1090
1086
- for (const auto it : generator. get_index_symbols () )
1091
+ for (const auto it : index_symbols )
1087
1092
{
1088
- debug () << " - " << it.get_identifier () << " : "
1089
- << from_expr (ns, " " , supert::get (it)) << eom;
1093
+ stream << " - " << it.get_identifier () << " : "
1094
+ << from_expr (ns, " " , super_get (it)) << eom;
1090
1095
}
1091
1096
}
1092
1097
@@ -1382,7 +1387,16 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
1382
1387
{
1383
1388
const auto eom = messaget::eom;
1384
1389
stream << " string_refinementt::check_axioms:" << eom;
1385
- // debug_model();
1390
+
1391
+ #if 0
1392
+ debug_model(symbol_resolve,
1393
+ stream,
1394
+ ns,
1395
+ max_string_length,
1396
+ get,
1397
+ generator.get_boolean_symbols(),
1398
+ generator.get_index_symbols());
1399
+ #endif
1386
1400
1387
1401
// Maps from indexes of violated universal axiom to a witness of violation
1388
1402
std::map<size_t , exprt> violated;
0 commit comments