28int main(
int argc,
char **argv) {
35 char **parameter_names;
43 fprintf(stderr,
"Usage: %s filename.sdds\n", argv[0]);
61 printf(
"Page %d\n", page);
66 printf(
"Parameters:\n");
67 for (int32_t i = 0; i < n_params; i++) {
69 printf(
" %s = ", parameter_names[i]);
78 printf(
"%hd\n", value);
87 printf(
"%hu\n", value);
96 printf(
"%" PRId32
"\n", value);
105 printf(
"%" PRIu32
"\n", value);
114 printf(
"%" PRId64
"\n", value);
123 printf(
"%" PRIu64
"\n", value);
132 printf(
"%15.6e\n", value);
141 printf(
"%21.14e\n", value);
150 if (LDBL_DIG == 18) {
151 printf(
"%21.18Le\n", value);
153 printf(
"%21.14Le\n", value);
163 printf(
"%s\n", value);
173 printf(
"%c\n", value);
177 printf(
"Unknown type\n");
183 printf(
"Columns (%" PRId64
" rows):\n", n_rows);
184 for (int32_t i = 0; i < n_columns; i++) {
186 printf(
" Column: %s\n", column_names[i]);
189 fprintf(stderr,
"Error getting column %s\n", column_names[i]);
194 short *values = (
short *)data;
195 for (int64_t row = 0; row < n_rows; row++) {
196 printf(
" %hd\n", values[row]);
201 unsigned short *values = (
unsigned short *)data;
202 for (int64_t row = 0; row < n_rows; row++) {
203 printf(
" %hu\n", values[row]);
208 int32_t *values = (int32_t *)data;
209 for (int64_t row = 0; row < n_rows; row++) {
210 printf(
" %" PRId32
"\n", values[row]);
215 uint32_t *values = (uint32_t *)data;
216 for (int64_t row = 0; row < n_rows; row++) {
217 printf(
" %" PRIu32
"\n", values[row]);
222 int64_t *values = (int64_t *)data;
223 for (int64_t row = 0; row < n_rows; row++) {
224 printf(
" %" PRId64
"\n", values[row]);
229 uint64_t *values = (uint64_t *)data;
230 for (int64_t row = 0; row < n_rows; row++) {
231 printf(
" %" PRIu64
"\n", values[row]);
236 float *values = (
float *)data;
237 for (int64_t row = 0; row < n_rows; row++) {
238 printf(
" %15.6e\n", values[row]);
243 double *values = (
double *)data;
244 for (int64_t row = 0; row < n_rows; row++) {
245 printf(
" %21.14e\n", values[row]);
250 long double *values = (
long double *)data;
251 if (LDBL_DIG == 18) {
252 for (int64_t row = 0; row < n_rows; row++) {
253 printf(
" %21.18Le\n", values[row]);
256 for (int64_t row = 0; row < n_rows; row++) {
257 printf(
" %21.14Le\n", values[row]);
263 char **values = (
char **)data;
264 for (int64_t row = 0; row < n_rows; row++) {
265 printf(
" %s\n", values[row]);
271 char *values = (
char *)data;
272 for (int64_t row = 0; row < n_rows; row++) {
273 printf(
" %c\n", values[row]);
278 printf(
"Unknown type\n");
288 for (int32_t i = 0; i < n_arrays; i++) {
292 fprintf(stderr,
"Error getting array %s\n", array_names[i]);
295 printf(
" Array: %s (dimensions: ", array_names[i]);
298 for (int32_t d = 0; d < array->definition->dimensions; d++) {
299 printf(
"%d", array->dimension[d]);
300 if (d < array->definition->dimensions - 1)
307 short *values = (
short *)array->data;
308 for (int32_t idx = 0; idx < array->elements; idx++) {
309 printf(
" %hd\n", values[idx]);
314 unsigned short *values = (
unsigned short *)array->data;
315 for (int32_t idx = 0; idx < array->elements; idx++) {
316 printf(
" %hu\n", values[idx]);
321 int32_t *values = (int32_t *)array->data;
322 for (int32_t idx = 0; idx < array->elements; idx++) {
323 printf(
" %" PRId32
"\n", values[idx]);
328 uint32_t *values = (uint32_t *)array->data;
329 for (int32_t idx = 0; idx < array->elements; idx++) {
330 printf(
" %" PRIu32
"\n", values[idx]);
335 int64_t *values = (int64_t *)array->data;
336 for (int32_t idx = 0; idx < array->elements; idx++) {
337 printf(
" %" PRId64
"\n", values[idx]);
342 uint64_t *values = (uint64_t *)array->data;
343 for (int32_t idx = 0; idx < array->elements; idx++) {
344 printf(
" %" PRIu64
"\n", values[idx]);
349 float *values = (
float *)array->data;
350 for (int32_t idx = 0; idx < array->elements; idx++) {
351 printf(
" %15.6e\n", values[idx]);
356 double *values = (
double *)array->data;
357 for (int32_t idx = 0; idx < array->elements; idx++) {
358 printf(
" %21.14e\n", values[idx]);
363 long double *values = (
long double *)array->data;
364 if (LDBL_DIG == 18) {
365 for (int32_t idx = 0; idx < array->elements; idx++) {
366 printf(
" %21.18Le\n", values[idx]);
369 for (int32_t idx = 0; idx < array->elements; idx++) {
370 printf(
" %21.14Le\n", values[idx]);
376 char **values = (
char **)array->data;
377 for (int32_t idx = 0; idx < array->elements; idx++) {
378 printf(
" %s\n", values[idx]);
383 char *values = (
char *)array->data;
384 for (int32_t idx = 0; idx < array->elements; idx++) {
385 printf(
" %c\n", values[idx]);
390 printf(
"Unknown type\n");