mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-17 04:15:44 +00:00
u/pp: Add array and array2d f64 pretty printers
This commit is contained in:
parent
2785c6bcfa
commit
7d80729358
|
@ -10,6 +10,7 @@
|
||||||
#include "util/u_misc.h"
|
#include "util/u_misc.h"
|
||||||
#include "util/u_pretty_print.h"
|
#include "util/u_pretty_print.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -359,6 +360,27 @@ u_pp_small_matrix_4x4_f64(u_pp_delegate_t dg, const struct xrt_matrix_4x4_f64 *m
|
||||||
m->v[3], m->v[7], m->v[11], m->v[15]); //
|
m->v[3], m->v[7], m->v[11], m->v[15]); //
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
u_pp_small_array_f64(struct u_pp_delegate dg, const double *arr, size_t n)
|
||||||
|
{
|
||||||
|
assert(n != 0);
|
||||||
|
DG("[");
|
||||||
|
for (size_t i = 0; i < n - 1; i++) {
|
||||||
|
u_pp(dg, "%lf, ", arr[i]);
|
||||||
|
}
|
||||||
|
u_pp(dg, "%lf]", arr[n - 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
u_pp_small_array2d_f64(struct u_pp_delegate dg, const double *arr, size_t n, size_t m)
|
||||||
|
{
|
||||||
|
DG("[\n");
|
||||||
|
for (size_t i = 0; i < n; i++) {
|
||||||
|
u_pp_small_array_f64(dg, &arr[i], m);
|
||||||
|
}
|
||||||
|
DG("\n]");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
u_pp_vec3(u_pp_delegate_t dg, const struct xrt_vec3 *vec, const char *name, const char *indent)
|
u_pp_vec3(u_pp_delegate_t dg, const struct xrt_vec3 *vec, const char *name, const char *indent)
|
||||||
{
|
{
|
||||||
|
@ -425,6 +447,20 @@ u_pp_matrix_4x4_f64(u_pp_delegate_t dg, const struct xrt_matrix_4x4_f64 *m, cons
|
||||||
indent); //
|
indent); //
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
u_pp_array_f64(u_pp_delegate_t dg, const double *arr, size_t n, const char *name, const char *indent)
|
||||||
|
{
|
||||||
|
u_pp(dg, "\n%s%s = ", indent, name);
|
||||||
|
u_pp_small_array_f64(dg, arr, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
u_pp_array2d_f64(u_pp_delegate_t dg, const double *arr, size_t n, size_t m, const char *name, const char *indent)
|
||||||
|
{
|
||||||
|
u_pp(dg, "\n%s%s = ", indent, name);
|
||||||
|
u_pp_small_array2d_f64(dg, arr, n, m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
|
|
@ -98,6 +98,8 @@ u_pp_xrt_result(struct u_pp_delegate dg, xrt_result_t xret);
|
||||||
* the other functions does. This is so that you can easily chain print
|
* the other functions does. This is so that you can easily chain print
|
||||||
* functions to print a struct.
|
* functions to print a struct.
|
||||||
*
|
*
|
||||||
|
* @note xrt_matrix_* parameters assumed to be column major.
|
||||||
|
*
|
||||||
* @ingroup aux_pretty
|
* @ingroup aux_pretty
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
@ -116,6 +118,12 @@ u_pp_small_matrix_4x4(u_pp_delegate_t dg, const struct xrt_matrix_4x4 *m);
|
||||||
void
|
void
|
||||||
u_pp_small_matrix_4x4_f64(u_pp_delegate_t dg, const struct xrt_matrix_4x4_f64 *m);
|
u_pp_small_matrix_4x4_f64(u_pp_delegate_t dg, const struct xrt_matrix_4x4_f64 *m);
|
||||||
|
|
||||||
|
void
|
||||||
|
u_pp_small_array_f64(struct u_pp_delegate dg, const double *arr, size_t n);
|
||||||
|
|
||||||
|
void
|
||||||
|
u_pp_small_array2d_f64(struct u_pp_delegate dg, const double *arr, size_t n, size_t m);
|
||||||
|
|
||||||
void
|
void
|
||||||
u_pp_vec3(u_pp_delegate_t dg, const struct xrt_vec3 *vec, const char *name, const char *indent);
|
u_pp_vec3(u_pp_delegate_t dg, const struct xrt_vec3 *vec, const char *name, const char *indent);
|
||||||
|
|
||||||
|
@ -130,6 +138,15 @@ u_pp_matrix_4x4(u_pp_delegate_t dg, const struct xrt_matrix_4x4 *m, const char *
|
||||||
|
|
||||||
void
|
void
|
||||||
u_pp_matrix_4x4_f64(u_pp_delegate_t dg, const struct xrt_matrix_4x4_f64 *m, const char *name, const char *indent);
|
u_pp_matrix_4x4_f64(u_pp_delegate_t dg, const struct xrt_matrix_4x4_f64 *m, const char *name, const char *indent);
|
||||||
|
|
||||||
|
//! Pretty prints `double arr[n]`
|
||||||
|
void
|
||||||
|
u_pp_array_f64(u_pp_delegate_t dg, const double *arr, size_t n, const char *name, const char *indent);
|
||||||
|
|
||||||
|
//! Pretty prints `double arr[n][m]`
|
||||||
|
void
|
||||||
|
u_pp_array2d_f64(u_pp_delegate_t dg, const double *arr, size_t n, size_t m, const char *name, const char *indent);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue