|
2 | 2 | // actions, such as copying, freeing, comparing, and so on.
|
3 | 3 |
|
4 | 4 | #include <algorithm>
|
| 5 | +#include <iostream> |
5 | 6 | #include <utility>
|
6 | 7 | #include <cassert>
|
7 | 8 | #include <cstdio>
|
@@ -1085,11 +1086,11 @@ class cmp : public data<cmp,ptr_pair> {
|
1085 | 1086 | result(0) {}
|
1086 | 1087 |
|
1087 | 1088 | void walk_evec(bool align, bool is_pod, uint16_t sp_size) {
|
1088 |
| - return walk_vec(align, is_pod, get_evec_data_range(dp)); |
| 1089 | + walk_vec(align, is_pod, get_evec_data_range(dp)); |
1089 | 1090 | }
|
1090 | 1091 |
|
1091 | 1092 | void walk_ivec(bool align, bool is_pod, size_align &elem_sa) {
|
1092 |
| - return walk_vec(align, is_pod, get_ivec_data_range(dp)); |
| 1093 | + walk_vec(align, is_pod, get_ivec_data_range(dp)); |
1093 | 1094 | }
|
1094 | 1095 |
|
1095 | 1096 | void walk_fn(bool align) { return cmp_two_pointers(align); }
|
@@ -1183,6 +1184,48 @@ cmp::walk_variant(bool align, tag_info &tinfo, uint32_t variant_id,
|
1183 | 1184 | }
|
1184 | 1185 | }
|
1185 | 1186 |
|
| 1187 | + |
| 1188 | +// Polymorphic logging, for convenience |
| 1189 | + |
| 1190 | +class log : public data<log,uint8_t *> { |
| 1191 | + friend class data<log,uint8_t *>; |
| 1192 | + |
| 1193 | +private: |
| 1194 | + std::ostream &out; |
| 1195 | + bool in_string; |
| 1196 | + |
| 1197 | + void walk_evec(bool align, bool is_pod, uint16_t sp_size) { |
| 1198 | + walk_vec(align, is_pod, get_evec_data_range(dp)); |
| 1199 | + } |
| 1200 | + |
| 1201 | + void walk_ivec(bool align, bool is_pod, size_align &elem_sa) { |
| 1202 | + walk_vec(align, is_pod, get_ivec_data_range(dp)); |
| 1203 | + } |
| 1204 | + |
| 1205 | + void walk_vec(bool align, bool is_pod, |
| 1206 | + const std::pair<uint8_t *,uint8_t *> &data); |
| 1207 | + |
| 1208 | + template<typename T> |
| 1209 | + void walk_number() { out << get_dp<T>(dp); } |
| 1210 | + |
| 1211 | +public: |
| 1212 | + log(rust_task *in_task, |
| 1213 | + const uint8_t *in_sp, |
| 1214 | + const type_param *in_params, |
| 1215 | + const rust_shape_tables *in_tables, |
| 1216 | + uint8_t *in_data, |
| 1217 | + std::ostream &in_out) |
| 1218 | + : data<log,uint8_t *>(in_task, in_sp, in_params, in_tables, in_data), |
| 1219 | + out(in_out) {} |
| 1220 | +}; |
| 1221 | + |
| 1222 | +void |
| 1223 | +log::walk_vec(bool align, bool is_pod, |
| 1224 | + const std::pair<uint8_t *,uint8_t *> &data) { |
| 1225 | + // TODO: Check to see whether this is a string (contains u8). If so, |
| 1226 | + // write the vector ""-style; otherwise [ ... , ... ] style. |
| 1227 | +} |
| 1228 | + |
1186 | 1229 | } // end namespace shape
|
1187 | 1230 |
|
1188 | 1231 | extern "C" void
|
|
0 commit comments