The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

u/pp: Add array and array2d f64 pretty printers

+53
+36
src/xrt/auxiliary/util/u_pretty_print.c
··· 10 10 #include "util/u_misc.h" 11 11 #include "util/u_pretty_print.h" 12 12 13 + #include <assert.h> 13 14 #include <string.h> 14 15 #include <stdarg.h> 15 16 #include <stdio.h> ··· 360 361 } 361 362 362 363 void 364 + u_pp_small_array_f64(struct u_pp_delegate dg, const double *arr, size_t n) 365 + { 366 + assert(n != 0); 367 + DG("["); 368 + for (size_t i = 0; i < n - 1; i++) { 369 + u_pp(dg, "%lf, ", arr[i]); 370 + } 371 + u_pp(dg, "%lf]", arr[n - 1]); 372 + } 373 + 374 + void 375 + u_pp_small_array2d_f64(struct u_pp_delegate dg, const double *arr, size_t n, size_t m) 376 + { 377 + DG("[\n"); 378 + for (size_t i = 0; i < n; i++) { 379 + u_pp_small_array_f64(dg, &arr[i], m); 380 + } 381 + DG("\n]"); 382 + } 383 + 384 + void 363 385 u_pp_vec3(u_pp_delegate_t dg, const struct xrt_vec3 *vec, const char *name, const char *indent) 364 386 { 365 387 u_pp(dg, "\n%s%s = ", indent, name); ··· 423 445 indent, m->v[2], m->v[6], m->v[10], m->v[14], // 424 446 indent, m->v[3], m->v[7], m->v[11], m->v[15], // 425 447 indent); // 448 + } 449 + 450 + void 451 + u_pp_array_f64(u_pp_delegate_t dg, const double *arr, size_t n, const char *name, const char *indent) 452 + { 453 + u_pp(dg, "\n%s%s = ", indent, name); 454 + u_pp_small_array_f64(dg, arr, n); 455 + } 456 + 457 + void 458 + u_pp_array2d_f64(u_pp_delegate_t dg, const double *arr, size_t n, size_t m, const char *name, const char *indent) 459 + { 460 + u_pp(dg, "\n%s%s = ", indent, name); 461 + u_pp_small_array2d_f64(dg, arr, n, m); 426 462 } 427 463 428 464
+17
src/xrt/auxiliary/util/u_pretty_print.h
··· 98 98 * the other functions does. This is so that you can easily chain print 99 99 * functions to print a struct. 100 100 * 101 + * @note xrt_matrix_* parameters assumed to be column major. 102 + * 101 103 * @ingroup aux_pretty 102 104 * @{ 103 105 */ ··· 117 119 u_pp_small_matrix_4x4_f64(u_pp_delegate_t dg, const struct xrt_matrix_4x4_f64 *m); 118 120 119 121 void 122 + u_pp_small_array_f64(struct u_pp_delegate dg, const double *arr, size_t n); 123 + 124 + void 125 + u_pp_small_array2d_f64(struct u_pp_delegate dg, const double *arr, size_t n, size_t m); 126 + 127 + void 120 128 u_pp_vec3(u_pp_delegate_t dg, const struct xrt_vec3 *vec, const char *name, const char *indent); 121 129 122 130 void ··· 130 138 131 139 void 132 140 u_pp_matrix_4x4_f64(u_pp_delegate_t dg, const struct xrt_matrix_4x4_f64 *m, const char *name, const char *indent); 141 + 142 + //! Pretty prints `double arr[n]` 143 + void 144 + u_pp_array_f64(u_pp_delegate_t dg, const double *arr, size_t n, const char *name, const char *indent); 145 + 146 + //! Pretty prints `double arr[n][m]` 147 + void 148 + u_pp_array2d_f64(u_pp_delegate_t dg, const double *arr, size_t n, size_t m, const char *name, const char *indent); 149 + 133 150 /*! 134 151 * @} 135 152 */