diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-01-11 09:09:46 -0800 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-01-11 10:32:54 -0800 |
| commit | c68345e57e82e7233e0f875bd416f46e1f8859e1 (patch) | |
| tree | 394fdadbb90e0eb8661e1a9475985f12629ada67 /src/rt/rust_shape.cpp | |
| parent | f3b867fd04d06c732a41e05c3abddb8e8bcbdbbb (diff) | |
| download | rust-c68345e57e82e7233e0f875bd416f46e1f8859e1.tar.gz rust-c68345e57e82e7233e0f875bd416f46e1f8859e1.zip | |
add a log_str() function and allow '%?' in fmt strings to use it
Diffstat (limited to 'src/rt/rust_shape.cpp')
| -rw-r--r-- | src/rt/rust_shape.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/rt/rust_shape.cpp b/src/rt/rust_shape.cpp index 1743aaad9dd..ee7e389dc77 100644 --- a/src/rt/rust_shape.cpp +++ b/src/rt/rust_shape.cpp @@ -548,6 +548,24 @@ shape_cmp_type(int8_t *result, const type_desc *tydesc, } } +extern "C" rust_str * +shape_log_str(const type_desc *tydesc, uint8_t *data) { + rust_task *task = rust_scheduler::get_task(); + + shape::arena arena; + shape::type_param *params = + shape::type_param::from_tydesc_and_data(tydesc, data, arena); + + std::stringstream ss; + shape::log log(task, true, tydesc->shape, params, tydesc->shape_tables, + data, ss); + + log.walk(); + + int len = ss.str().length(); + return make_str(task->kernel, ss.str().c_str(), len, "log_str"); +} + extern "C" void shape_log_type(const type_desc *tydesc, uint8_t *data, uint32_t level) { rust_task *task = rust_scheduler::get_task(); |
